mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-14 02:30:35 +05:00
New OCAF doc reading/writing for OCCT7.0.0
This commit is contained in:
parent
c978009003
commit
b15520064b
@ -1,5 +1,7 @@
|
|||||||
formatlist:SALOME_GEOM
|
formatlist:SALOME_GEOM|BinOcaf
|
||||||
|
!
|
||||||
|
! SALOME_GEOM format
|
||||||
|
!
|
||||||
SALOME_GEOM.Description: GEOM Document Version 1.0
|
SALOME_GEOM.Description: GEOM Document Version 1.0
|
||||||
SALOME_GEOM.FileExtension: sgd
|
SALOME_GEOM.FileExtension: sgd
|
||||||
SALOME_GEOM.StoragePlugin: ad696000-5b34-11d1-b5ba-00a0c9064368
|
SALOME_GEOM.StoragePlugin: ad696000-5b34-11d1-b5ba-00a0c9064368
|
||||||
@ -7,4 +9,10 @@ SALOME_GEOM.RetrievalPlugin: ad696001-5b34-11d1-b5ba-00a0c9064368
|
|||||||
SALOME_GEOMSchema: ad696002-5b34-11d1-b5ba-00a0c9064368
|
SALOME_GEOMSchema: ad696002-5b34-11d1-b5ba-00a0c9064368
|
||||||
SALOME_GEOM.AttributeStoragePlugin: 47b0b826-d931-11d1-b5da-00a0c9064368
|
SALOME_GEOM.AttributeStoragePlugin: 47b0b826-d931-11d1-b5da-00a0c9064368
|
||||||
SALOME_GEOM.AttributeRetrievalPlugin: 47b0b827-d931-11d1-b5da-00a0c9064368
|
SALOME_GEOM.AttributeRetrievalPlugin: 47b0b827-d931-11d1-b5da-00a0c9064368
|
||||||
|
!
|
||||||
|
! BinOcaf format
|
||||||
|
!
|
||||||
|
BinOcaf.Description: Bin Ocaf Document Version 1.0
|
||||||
|
BinOcaf.FileExtension: cbf
|
||||||
|
BinOcaf.StoragePlugin: 03a56835-8269-11d5-aab2-0050044b1af1
|
||||||
|
BinOcaf.RetrievalPlugin: 03a56836-8269-11d5-aab2-0050044b1af1
|
||||||
|
@ -5,4 +5,11 @@ a148e300-5740-11d1-a904-080036aaa103.Location: FWOSPlugin
|
|||||||
!
|
!
|
||||||
! standard attribute drivers plugin
|
! standard attribute drivers plugin
|
||||||
!
|
!
|
||||||
|
ad696000-5b34-11d1-b5ba-00a0c9064368.Location: @CAS_STDPLUGIN@
|
||||||
ad696001-5b34-11d1-b5ba-00a0c9064368.Location: @CAS_STDPLUGIN@
|
ad696001-5b34-11d1-b5ba-00a0c9064368.Location: @CAS_STDPLUGIN@
|
||||||
|
ad696002-5b34-11d1-b5ba-00a0c9064368.Location: @CAS_STDPLUGIN@
|
||||||
|
!
|
||||||
|
! BinOcaf Document Plugin
|
||||||
|
!
|
||||||
|
03a56835-8269-11d5-aab2-0050044b1af1.Location: @CAS_BINPLUGIN@
|
||||||
|
03a56836-8269-11d5-aab2-0050044b1af1.Location: @CAS_BINPLUGIN@
|
||||||
|
@ -50,6 +50,9 @@ GEOM_Application::~GEOM_Application()
|
|||||||
void GEOM_Application::Formats(TColStd_SequenceOfExtendedString& Formats)
|
void GEOM_Application::Formats(TColStd_SequenceOfExtendedString& Formats)
|
||||||
{
|
{
|
||||||
Formats.Append(TCollection_ExtendedString ("SALOME_GEOM"));
|
Formats.Append(TCollection_ExtendedString ("SALOME_GEOM"));
|
||||||
|
#if OCC_VERSION_MAJOR > 6
|
||||||
|
Formats.Append(TCollection_ExtendedString ("BinOcaf"));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -264,7 +264,11 @@ Handle(TDocStd_Document) GEOM_Engine::GetDocument(int theDocID, bool force)
|
|||||||
aDoc = Handle(TDocStd_Document)::DownCast(_mapIDDocument(theDocID));
|
aDoc = Handle(TDocStd_Document)::DownCast(_mapIDDocument(theDocID));
|
||||||
}
|
}
|
||||||
else if (force) {
|
else if (force) {
|
||||||
|
#if OCC_VERSION_MAJOR > 6
|
||||||
|
_OCAFApp->NewDocument("BinOcaf", aDoc);
|
||||||
|
#else
|
||||||
_OCAFApp->NewDocument("SALOME_GEOM", aDoc);
|
_OCAFApp->NewDocument("SALOME_GEOM", aDoc);
|
||||||
|
#endif
|
||||||
aDoc->SetUndoLimit(_UndoLimit);
|
aDoc->SetUndoLimit(_UndoLimit);
|
||||||
_mapIDDocument.Bind(theDocID, aDoc);
|
_mapIDDocument.Bind(theDocID, aDoc);
|
||||||
TDataStd_Integer::Set(aDoc->Main(), theDocID);
|
TDataStd_Integer::Set(aDoc->Main(), theDocID);
|
||||||
@ -563,6 +567,13 @@ bool GEOM_Engine::Load(int theDocID, const char* theFileName)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if OCC_VERSION_MAJOR > 6
|
||||||
|
// Replace old document format by the new one.
|
||||||
|
if (aDoc->StorageFormat().IsEqual("SALOME_GEOM")) {
|
||||||
|
aDoc->ChangeStorageFormat("BinOcaf");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
aDoc->SetUndoLimit(_UndoLimit);
|
aDoc->SetUndoLimit(_UndoLimit);
|
||||||
|
|
||||||
if(_mapIDDocument.IsBound(theDocID)) _mapIDDocument.UnBind(theDocID);
|
if(_mapIDDocument.IsBound(theDocID)) _mapIDDocument.UnBind(theDocID);
|
||||||
@ -1877,7 +1888,7 @@ TCollection_AsciiString GetPublishCommands
|
|||||||
if (aRefIt != theMapRefs.end()) {
|
if (aRefIt != theMapRefs.end()) {
|
||||||
// Recursively publish all references.
|
// Recursively publish all references.
|
||||||
std::list< int >::const_iterator aRefTagIt = aRefIt->second.begin();
|
std::list< int >::const_iterator aRefTagIt = aRefIt->second.begin();
|
||||||
|
|
||||||
for(; aRefTagIt != aRefIt->second.end(); ++aRefTagIt) {
|
for(; aRefTagIt != aRefIt->second.end(); ++aRefTagIt) {
|
||||||
const TCollection_AsciiString aRefCmd = GetPublishCommands
|
const TCollection_AsciiString aRefCmd = GetPublishCommands
|
||||||
(*aRefTagIt, theEntryToCmdMap, theMapRefs, thePublished);
|
(*aRefTagIt, theEntryToCmdMap, theMapRefs, thePublished);
|
||||||
|
25
src/GEOM_I/GEOM_Gen_i.cc
Executable file → Normal file
25
src/GEOM_I/GEOM_Gen_i.cc
Executable file → Normal file
@ -600,7 +600,11 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
|
|||||||
if (isMultiFile)
|
if (isMultiFile)
|
||||||
aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath
|
aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath
|
||||||
(theComponent->GetStudy()->URL())).c_str());
|
(theComponent->GetStudy()->URL())).c_str());
|
||||||
|
#if OCC_VERSION_MAJOR > 6
|
||||||
|
aNameWithExt += TCollection_AsciiString("_GEOM.cbf");
|
||||||
|
#else
|
||||||
aNameWithExt += TCollection_AsciiString("_GEOM.sgd");
|
aNameWithExt += TCollection_AsciiString("_GEOM.sgd");
|
||||||
|
#endif
|
||||||
aSeq[0] = CORBA::string_dup(aNameWithExt.ToCString());
|
aSeq[0] = CORBA::string_dup(aNameWithExt.ToCString());
|
||||||
// Build a full file name of temporary file
|
// Build a full file name of temporary file
|
||||||
TCollection_AsciiString aFullName = TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt;
|
TCollection_AsciiString aFullName = TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt;
|
||||||
@ -662,11 +666,32 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
|
|||||||
// Prepare a file name to open
|
// Prepare a file name to open
|
||||||
TCollection_AsciiString aNameWithExt("");
|
TCollection_AsciiString aNameWithExt("");
|
||||||
SALOMEDS::Study_var study = theComponent->GetStudy();
|
SALOMEDS::Study_var study = theComponent->GetStudy();
|
||||||
|
|
||||||
|
#if OCC_VERSION_MAJOR > 6
|
||||||
|
// Get the file name.
|
||||||
|
int i;
|
||||||
|
int aLength = aSeq->length();
|
||||||
|
const char *aGeomSgd = "_GEOM.sgd";
|
||||||
|
const char *aGeomcbf = "_GEOM.cbf";
|
||||||
|
|
||||||
|
for(i = 0; i < aLength; i++) {
|
||||||
|
std::string aName(aSeq[i]);
|
||||||
|
|
||||||
|
if (aName.rfind(aGeomSgd) != std::string::npos ||
|
||||||
|
aName.rfind(aGeomcbf) != std::string::npos) {
|
||||||
|
aNameWithExt = aName.c_str();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (isMultiFile) {
|
if (isMultiFile) {
|
||||||
CORBA::String_var url = study->URL();
|
CORBA::String_var url = study->URL();
|
||||||
aNameWithExt = (char*)SALOMEDS_Tool::GetNameFromPath(url.in()).c_str();
|
aNameWithExt = (char*)SALOMEDS_Tool::GetNameFromPath(url.in()).c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
aNameWithExt += "_GEOM.sgd";
|
aNameWithExt += "_GEOM.sgd";
|
||||||
|
#endif
|
||||||
|
|
||||||
TCollection_AsciiString aFullName = (TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt);
|
TCollection_AsciiString aFullName = (TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt);
|
||||||
|
|
||||||
// Open document
|
// Open document
|
||||||
|
Loading…
Reference in New Issue
Block a user