Salome HOME
projects
/
modules
/
geom.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Porting to new OCCT version
[modules/geom.git]
/
src
/
GEOM
/
GEOM_Engine.cxx
diff --git
a/src/GEOM/GEOM_Engine.cxx
b/src/GEOM/GEOM_Engine.cxx
index d8ad0eb92f1a2512a81d6ecf1c4748879db98cbe..9376296382bacaa3ab1f228bd02caf8c2ae262be 100644
(file)
--- a/
src/GEOM/GEOM_Engine.cxx
+++ b/
src/GEOM/GEOM_Engine.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-201
6
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-201
9
CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@
-82,6
+82,7
@@
#ifdef _DEBUG_
static int MYDEBUG = 0;
#ifdef _DEBUG_
static int MYDEBUG = 0;
+using namespace std;
#else
static int MYDEBUG = 0;
#endif
#else
static int MYDEBUG = 0;
#endif
@@
-434,6
+435,10
@@
bool GEOM_Engine::RemoveObject(Handle(GEOM_BaseObject)& theObject)
if(!_document)
return false; // document is closed...
if(!_document)
return false; // document is closed...
+ TDF_Label aLabel = theObject->GetEntry();
+ if ( aLabel == aLabel.Root() )
+ return false; // already removed object
+
//Remove an object from the map of available objects
TCollection_AsciiString anID = BuildIDFromObject(theObject);
if (_objects.IsBound(anID)) {
//Remove an object from the map of available objects
TCollection_AsciiString anID = BuildIDFromObject(theObject);
if (_objects.IsBound(anID)) {
@@
-462,7
+467,6
@@
bool GEOM_Engine::RemoveObject(Handle(GEOM_BaseObject)& theObject)
aNode->Remove();
}
aNode->Remove();
}
- TDF_Label aLabel = theObject->GetEntry();
aLabel.ForgetAllAttributes(Standard_True);
// Remember the label to reuse it then
aLabel.ForgetAllAttributes(Standard_True);
// Remember the label to reuse it then
@@
-509,7
+513,13
@@
bool GEOM_Engine::Save(const char* theFileName)
{
if(!_document) return false;
{
if(!_document) return false;
- _OCAFApp->SaveAs(_document, theFileName);
+#if defined(WIN32) && defined(UNICODE)
+ std::wstring aFileName = Kernel_Utils::utf8_decode_s(theFileName);
+#else
+ std::string aFileName = theFileName;
+#endif
+
+ _OCAFApp->SaveAs( _document, aFileName.c_str() );
return true;
}
return true;
}
@@
-521,8
+531,13
@@
bool GEOM_Engine::Save(const char* theFileName)
//=============================================================================
bool GEOM_Engine::Load(const char* theFileName)
{
//=============================================================================
bool GEOM_Engine::Load(const char* theFileName)
{
+#if defined(WIN32) && defined(UNICODE)
+ std::wstring aFileName = Kernel_Utils::utf8_decode_s(theFileName);
+#else
+ std::string aFileName = theFileName;
+#endif
Handle(TDocStd_Document) aDoc;
Handle(TDocStd_Document) aDoc;
- if (_OCAFApp->Open(
theFileName
, aDoc) != PCDM_RS_OK) {
+ if (_OCAFApp->Open(
aFileName.c_str()
, aDoc) != PCDM_RS_OK) {
return false;
}
return false;
}
@@
-1265,7
+1280,7
@@
Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theStrin
if(c == 58) isFound = Standard_True;
}
if(c == 58) isFound = Standard_True;
}
- if(isFound && arr[j-2] != 58) { // last char should be a dig
g
it
+ if(isFound && arr[j-2] != 58) { // last char should be a digit
aSeq->Append(i+1); // +1 because AsciiString starts from 1
aSeq->Append(j-1);
}
aSeq->Append(i+1); // +1 because AsciiString starts from 1
aSeq->Append(j-1);
}
@@
-1360,7
+1375,7
@@
void ReplaceVariables(TCollection_AsciiString& theCommand,
if(MYDEBUG) {
cout<<"Variables from SObject:"<<endl;
if(MYDEBUG) {
cout<<"Variables from SObject:"<<endl;
- for (
in
t i = 0; i < aVariables.size();i++)
+ for (
size_
t i = 0; i < aVariables.size();i++)
cout<<"\t Variable["<<i<<"] = "<<aVariables[i].myVariable<<endl;
}
cout<<"\t Variable["<<i<<"] = "<<aVariables[i].myVariable<<endl;
}
@@
-1377,7
+1392,7
@@
void ReplaceVariables(TCollection_AsciiString& theCommand,
//Replace parameters by variables
Standard_Integer aStartPos = 0;
Standard_Integer aEndPos = 0;
//Replace parameters by variables
Standard_Integer aStartPos = 0;
Standard_Integer aEndPos = 0;
-
in
t iVar = 0;
+
size_
t iVar = 0;
TCollection_AsciiString aVar, aReplacedVar;
for(Standard_Integer i=aFirstParam;i <= aTotalNbParams;i++) {
//Replace first parameter (bettwen '(' character and first ',' character)
TCollection_AsciiString aVar, aReplacedVar;
for(Standard_Integer i=aFirstParam;i <= aTotalNbParams;i++) {
//Replace first parameter (bettwen '(' character and first ',' character)
@@
-1401,6
+1416,8
@@
void ReplaceVariables(TCollection_AsciiString& theCommand,
aStartPos = aCommand.Location(i-1, COMMA, 1, aCommand.Length()) + 2;
aEndPos = aCommand.Location(i, COMMA, 1, aCommand.Length());
}
aStartPos = aCommand.Location(i-1, COMMA, 1, aCommand.Length()) + 2;
aEndPos = aCommand.Location(i, COMMA, 1, aCommand.Length());
}
+ if (aStartPos == 0 || aEndPos == 0)
+ continue;
if( aCommand.Value( aStartPos ) == O_SQR_BRACKET )
aStartPos++;
if( aCommand.Value( aStartPos ) == O_SQR_BRACKET )
aStartPos++;
@@
-1565,7
+1582,7
@@
void ReplaceEntriesByNames (TCollection_AsciiString& theScript,
theObjListToPublish.Append( anEntry );
TObjectData& data = aEntry2ObjData[ anEntry ];
theObjListToPublish.Append( anEntry );
TObjectData& data = aEntry2ObjData[ anEntry ];
- if ( data._pyName.IsEmpty() ) { // encounted for the 1st time
+ if ( data._pyName.IsEmpty() ) { // encounte
re
d for the 1st time
if ( !data._name.IsEmpty() ) { // published object
data._pyName = data._name;
engine->healPyName( data._pyName, anEntry, aNameToEntry);
if ( !data._name.IsEmpty() ) { // published object
data._pyName = data._name;
engine->healPyName( data._pyName, anEntry, aNameToEntry);
@@
-1818,6
+1835,8
@@
TCollection_AsciiString GetPublishCommands
if (!thePublished.count(theTag)) {
// This object is not published yet.
if (!thePublished.count(theTag)) {
// This object is not published yet.
+ thePublished.insert(theTag);
+
std::map< int, TCollection_AsciiString >::const_iterator anIt =
theEntryToCmdMap.find(theTag);
std::map< int, TCollection_AsciiString >::const_iterator anIt =
theEntryToCmdMap.find(theTag);
@@
-1826,7
+1845,7
@@
TCollection_AsciiString GetPublishCommands
TIntToListIntMap::const_iterator aRefIt = theMapRefs.find(theTag);
if (aRefIt != theMapRefs.end()) {
TIntToListIntMap::const_iterator aRefIt = theMapRefs.find(theTag);
if (aRefIt != theMapRefs.end()) {
- // Recursively publish all references.
+ // Recursively publish all references.
std::list< int >::const_iterator aRefTagIt = aRefIt->second.begin();
for(; aRefTagIt != aRefIt->second.end(); ++aRefTagIt) {
std::list< int >::const_iterator aRefTagIt = aRefIt->second.begin();
for(; aRefTagIt != aRefIt->second.end(); ++aRefTagIt) {
@@
-1840,8
+1859,6
@@
TCollection_AsciiString GetPublishCommands
// Add the object command.
aResult += anIt->second;
}
// Add the object command.
aResult += anIt->second;
}
-
- thePublished.insert(theTag);
}
return aResult;
}
return aResult;
@@
-1911,7
+1928,7
@@
ObjectStates::~ObjectStates()
//================================================================================
TState ObjectStates::GetCurrectState() const
{
//================================================================================
TState ObjectStates::GetCurrectState() const
{
- if(_states.size() > _dumpstate)
+ if(
(int)
_states.size() > _dumpstate)
return _states[_dumpstate];
return TState();
}
return _states[_dumpstate];
return TState();
}