This commit is contained in:
eap 2009-11-10 08:19:04 +00:00
parent ad45bbceaf
commit 1d5db76c2a
9 changed files with 215 additions and 215 deletions

View File

@ -47,10 +47,10 @@ Standard_EXPORT Handle_Standard_Type& GEOM_Application_Type_()
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
static Handle_Standard_Type _aType = new Standard_Type("GEOM_Application", static Handle_Standard_Type _aType = new Standard_Type("GEOM_Application",
sizeof(GEOM_Application), sizeof(GEOM_Application),
1, 1,
(Standard_Address)_Ancestors, (Standard_Address)_Ancestors,
(Standard_Address)NULL); (Standard_Address)NULL);
return _aType; return _aType;
} }

View File

@ -77,7 +77,7 @@ Standard_EXPORT ~GEOM_DataMapNodeOfDataMapOfAsciiStringTransient();
// //
Standard_EXPORT friend Handle_Standard_Type& GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_Type_(); Standard_EXPORT friend Handle_Standard_Type& GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected: protected:

View File

@ -54,10 +54,10 @@ Standard_EXPORT Handle_Standard_Type& GEOM_DataMapNodeOfDataMapOfAsciiStringTran
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
static Handle_Standard_Type _aType = new Standard_Type("GEOM_DataMapNodeOfDataMapOfAsciiStringTransient", static Handle_Standard_Type _aType = new Standard_Type("GEOM_DataMapNodeOfDataMapOfAsciiStringTransient",
sizeof(GEOM_DataMapNodeOfDataMapOfAsciiStringTransient), sizeof(GEOM_DataMapNodeOfDataMapOfAsciiStringTransient),
1, 1,
(Standard_Address)_Ancestors, (Standard_Address)_Ancestors,
(Standard_Address)NULL); (Standard_Address)NULL);
return _aType; return _aType;
} }

View File

@ -111,7 +111,7 @@ bool ProcessFunction(Handle(GEOM_Function)& theFunction,
TCollection_AsciiString& theScript, TCollection_AsciiString& theScript,
TCollection_AsciiString& theAfterScript, TCollection_AsciiString& theAfterScript,
const TVariablesList& theVariables, const TVariablesList& theVariables,
const bool theIsPublished, const bool theIsPublished,
TDF_LabelMap& theProcessed, TDF_LabelMap& theProcessed,
std::set<std::string>& theIgnoreObjs, std::set<std::string>& theIgnoreObjs,
bool& theIsDumpCollected); bool& theIsDumpCollected);
@ -122,25 +122,25 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString); Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString);
void ReplaceEntriesByNames (TCollection_AsciiString& theScript, void ReplaceEntriesByNames (TCollection_AsciiString& theScript,
Resource_DataMapOfAsciiStringAsciiString& theObjectNames, Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
const bool theIsPublished, const bool theIsPublished,
Resource_DataMapOfAsciiStringAsciiString& theEntryToBadName, Resource_DataMapOfAsciiStringAsciiString& theEntryToBadName,
TColStd_SequenceOfAsciiString& theObjListToPublish); TColStd_SequenceOfAsciiString& theObjListToPublish);
void AddObjectColors (int theDocID, void AddObjectColors (int theDocID,
TCollection_AsciiString& theScript, TCollection_AsciiString& theScript,
const Resource_DataMapOfAsciiStringAsciiString& theObjectNames); const Resource_DataMapOfAsciiStringAsciiString& theObjectNames);
void AddTextures (int theDocID, TCollection_AsciiString& theScript); void AddTextures (int theDocID, TCollection_AsciiString& theScript);
void PublishObject (const TCollection_AsciiString& theEntry, void PublishObject (const TCollection_AsciiString& theEntry,
const TCollection_AsciiString& theName, const TCollection_AsciiString& theName,
const Resource_DataMapOfAsciiStringAsciiString& theObjectNames, const Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
const Resource_DataMapOfAsciiStringAsciiString& theEntry2StEntry, const Resource_DataMapOfAsciiStringAsciiString& theEntry2StEntry,
const Resource_DataMapOfAsciiStringAsciiString& theStEntry2Entry, const Resource_DataMapOfAsciiStringAsciiString& theStEntry2Entry,
const Resource_DataMapOfAsciiStringAsciiString& theEntryToBadName, const Resource_DataMapOfAsciiStringAsciiString& theEntryToBadName,
std::map< int, std::string >& theEntryToCommandMap, std::map< int, std::string >& theEntryToCommandMap,
std::set<std::string>& theMapOfPublished); std::set<std::string>& theMapOfPublished);
//======================================================================= //=======================================================================
//function : GetTextureGUID //function : GetTextureGUID
@ -587,32 +587,32 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
bool isDumpCollected = false; bool isDumpCollected = false;
TCollection_AsciiString aCurScript, anAfterScript; TCollection_AsciiString aCurScript, anAfterScript;
if (!ProcessFunction(aFunction, aCurScript, anAfterScript, theVariables, if (!ProcessFunction(aFunction, aCurScript, anAfterScript, theVariables,
isPublished, aCheckedFuncMap, anIgnoreObjMap, isPublished, aCheckedFuncMap, anIgnoreObjMap,
isDumpCollected )) isDumpCollected ))
continue; continue;
// add function description before dump // add function description before dump
if (!aCurScript.IsEmpty()) if (!aCurScript.IsEmpty())
aFuncScript += aCurScript; aFuncScript += aCurScript;
if (isDumpCollected ) { if (isDumpCollected ) {
// Replace entries by the names // Replace entries by the names
ReplaceEntriesByNames( aFuncScript, theObjectNames, ReplaceEntriesByNames( aFuncScript, theObjectNames,
isPublished, anEntryToBadName, aObjListToPublish ); isPublished, anEntryToBadName, aObjListToPublish );
// publish collected objects // publish collected objects
std::map< int, std::string > anEntryToCommandMap; // sort publishing commands by object entry std::map< int, std::string > anEntryToCommandMap; // sort publishing commands by object entry
int i = 1, n = aObjListToPublish.Length(); int i = 1, n = aObjListToPublish.Length();
for ( ; i <= n; i++ ) for ( ; i <= n; i++ )
{ {
const TCollection_AsciiString& aEntry = aObjListToPublish.Value(i); const TCollection_AsciiString& aEntry = aObjListToPublish.Value(i);
if (!theObjectNames.IsBound( aEntry )) if (!theObjectNames.IsBound( aEntry ))
continue; continue;
PublishObject( aEntry, theObjectNames.Find(aEntry), PublishObject( aEntry, theObjectNames.Find(aEntry),
theObjectNames, aEntry2StEntry, aStEntry2Entry, theObjectNames, aEntry2StEntry, aStEntry2Entry,
anEntryToBadName, anEntryToCommandMap, anIgnoreObjMap ); anEntryToBadName, anEntryToCommandMap, anIgnoreObjMap );
} }
// add publishing commands to the script // add publishing commands to the script
std::map< int, std::string >::iterator anEntryToCommand = anEntryToCommandMap.begin(); std::map< int, std::string >::iterator anEntryToCommand = anEntryToCommandMap.begin();
for ( ; anEntryToCommand != anEntryToCommandMap.end(); ++anEntryToCommand ) for ( ; anEntryToCommand != anEntryToCommandMap.end(); ++anEntryToCommand )
aFuncScript += (char*)anEntryToCommand->second.c_str(); aFuncScript += (char*)anEntryToCommand->second.c_str();
// PTv, 0020001 add result objects from RestoreSubShapes into ignore list, // PTv, 0020001 add result objects from RestoreSubShapes into ignore list,
@ -630,9 +630,9 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
} }
} }
aObjListToPublish.Clear(); aObjListToPublish.Clear();
aScript += aFuncScript; aScript += aFuncScript;
aFuncScript.Clear(); aFuncScript.Clear();
} }
aFuncScript += anAfterScript; aFuncScript += anAfterScript;
} }
@ -661,8 +661,8 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
continue; // should not be dumped continue; // should not be dumped
const TCollection_AsciiString& aName = anEntryToNameIt.Value(); const TCollection_AsciiString& aName = anEntryToNameIt.Value();
PublishObject( aEntry, aName, theObjectNames, PublishObject( aEntry, aName, theObjectNames,
aEntry2StEntry, aStEntry2Entry, aEntry2StEntry, aStEntry2Entry,
anEntryToBadName, anEntryToCommandMap, anIgnoreObjMap ); anEntryToBadName, anEntryToCommandMap, anIgnoreObjMap );
} }
// add publishing commands to the script // add publishing commands to the script
std::map< int, std::string >::iterator anEntryToCommand = anEntryToCommandMap.begin(); std::map< int, std::string >::iterator anEntryToCommand = anEntryToCommandMap.begin();
@ -733,8 +733,8 @@ Handle(TColStd_HSequenceOfAsciiString) GEOM_Engine::GetAllDumpNames() const
#define TEXTURE_LABEL_DATA 5 #define TEXTURE_LABEL_DATA 5
int GEOM_Engine::addTexture(int theDocID, int theWidth, int theHeight, int GEOM_Engine::addTexture(int theDocID, int theWidth, int theHeight,
const Handle(TDataStd_HArray1OfByte)& theTexture, const Handle(TDataStd_HArray1OfByte)& theTexture,
const TCollection_AsciiString& theFileName) const TCollection_AsciiString& theFileName)
{ {
Handle(TDocStd_Document) aDoc = GetDocument(theDocID); Handle(TDocStd_Document) aDoc = GetDocument(theDocID);
Handle(TDataStd_TreeNode) aRoot = TDataStd_TreeNode::Set(aDoc->Main()); Handle(TDataStd_TreeNode) aRoot = TDataStd_TreeNode::Set(aDoc->Main());
@ -771,16 +771,16 @@ int GEOM_Engine::addTexture(int theDocID, int theWidth, int theHeight,
Handle(TDataStd_ByteArray) anAttr = Handle(TDataStd_ByteArray) anAttr =
TDataStd_ByteArray::Set(aChild.FindChild(TEXTURE_LABEL_DATA), TDataStd_ByteArray::Set(aChild.FindChild(TEXTURE_LABEL_DATA),
theTexture.IsNull() ? 0 : theTexture->Lower(), theTexture.IsNull() ? 0 : theTexture->Lower(),
theTexture.IsNull() ? 0 : theTexture->Upper()); theTexture.IsNull() ? 0 : theTexture->Upper());
anAttr->ChangeArray(theTexture); anAttr->ChangeArray(theTexture);
return aTextureID; return aTextureID;
} }
Handle(TDataStd_HArray1OfByte) GEOM_Engine::getTexture(int theDocID, int theTextureID, Handle(TDataStd_HArray1OfByte) GEOM_Engine::getTexture(int theDocID, int theTextureID,
int& theWidth, int& theHeight, int& theWidth, int& theHeight,
TCollection_AsciiString& theFileName) TCollection_AsciiString& theFileName)
{ {
Handle(TDataStd_HArray1OfByte) anArray; Handle(TDataStd_HArray1OfByte) anArray;
theWidth = theHeight = 0; theWidth = theHeight = 0;
@ -795,24 +795,24 @@ Handle(TDataStd_HArray1OfByte) GEOM_Engine::getTexture(int theDocID, int theText
TDF_Label anIDLabel = aTextureLabel.FindChild(TEXTURE_LABEL_ID, Standard_False); TDF_Label anIDLabel = aTextureLabel.FindChild(TEXTURE_LABEL_ID, Standard_False);
Handle(TDataStd_Integer) anIdAttr; Handle(TDataStd_Integer) anIdAttr;
if(!anIDLabel.IsNull() && anIDLabel.FindAttribute(TDataStd_Integer::GetID(), anIdAttr) && if(!anIDLabel.IsNull() && anIDLabel.FindAttribute(TDataStd_Integer::GetID(), anIdAttr) &&
anIdAttr->Get() == theTextureID) { anIdAttr->Get() == theTextureID) {
TDF_Label aFileLabel = aTextureLabel.FindChild(TEXTURE_LABEL_FILE, Standard_False); TDF_Label aFileLabel = aTextureLabel.FindChild(TEXTURE_LABEL_FILE, Standard_False);
TDF_Label aWidthLabel = aTextureLabel.FindChild(TEXTURE_LABEL_WIDTH, Standard_False); TDF_Label aWidthLabel = aTextureLabel.FindChild(TEXTURE_LABEL_WIDTH, Standard_False);
TDF_Label aHeightLabel = aTextureLabel.FindChild(TEXTURE_LABEL_HEIGHT, Standard_False); TDF_Label aHeightLabel = aTextureLabel.FindChild(TEXTURE_LABEL_HEIGHT, Standard_False);
TDF_Label aDataLabel = aTextureLabel.FindChild(TEXTURE_LABEL_DATA, Standard_False); TDF_Label aDataLabel = aTextureLabel.FindChild(TEXTURE_LABEL_DATA, Standard_False);
Handle(TDataStd_Integer) aWidthAttr, aHeightAttr; Handle(TDataStd_Integer) aWidthAttr, aHeightAttr;
Handle(TDataStd_ByteArray) aTextureAttr; Handle(TDataStd_ByteArray) aTextureAttr;
Handle(TDataStd_Comment) aFileAttr; Handle(TDataStd_Comment) aFileAttr;
if (!aWidthLabel.IsNull() && aWidthLabel.FindAttribute(TDataStd_Integer::GetID(), aWidthAttr) && if (!aWidthLabel.IsNull() && aWidthLabel.FindAttribute(TDataStd_Integer::GetID(), aWidthAttr) &&
!aHeightLabel.IsNull() && aHeightLabel.FindAttribute(TDataStd_Integer::GetID(), aHeightAttr) && !aHeightLabel.IsNull() && aHeightLabel.FindAttribute(TDataStd_Integer::GetID(), aHeightAttr) &&
!aDataLabel.IsNull() && aDataLabel.FindAttribute(TDataStd_ByteArray::GetID(), aTextureAttr)) { !aDataLabel.IsNull() && aDataLabel.FindAttribute(TDataStd_ByteArray::GetID(), aTextureAttr)) {
theWidth = aWidthAttr->Get(); theWidth = aWidthAttr->Get();
theHeight = aHeightAttr->Get(); theHeight = aHeightAttr->Get();
anArray = aTextureAttr->InternalArray(); anArray = aTextureAttr->InternalArray();
} }
if (!aFileLabel.IsNull() && aFileLabel.FindAttribute(TDataStd_Comment::GetID(), aFileAttr)) if (!aFileLabel.IsNull() && aFileLabel.FindAttribute(TDataStd_Comment::GetID(), aFileAttr))
theFileName = aFileAttr->Get(); theFileName = aFileAttr->Get();
found = true; found = true;
} }
} }
} }
@ -832,7 +832,7 @@ std::list<int> GEOM_Engine::getAllTextures(int theDocID)
TDF_Label anIDLabel = aTextureLabel.FindChild(TEXTURE_LABEL_ID, Standard_False); TDF_Label anIDLabel = aTextureLabel.FindChild(TEXTURE_LABEL_ID, Standard_False);
Handle(TDataStd_Integer) anIdAttr; Handle(TDataStd_Integer) anIdAttr;
if(!anIDLabel.IsNull() && anIDLabel.FindAttribute(TDataStd_Integer::GetID(), anIdAttr)) if(!anIDLabel.IsNull() && anIDLabel.FindAttribute(TDataStd_Integer::GetID(), anIdAttr))
id_list.push_back((int)anIdAttr->Get()); id_list.push_back((int)anIdAttr->Get());
} }
} }
return id_list; return id_list;
@ -851,7 +851,7 @@ bool ProcessFunction(Handle(GEOM_Function)& theFunction,
TCollection_AsciiString& theScript, TCollection_AsciiString& theScript,
TCollection_AsciiString& theAfterScript, TCollection_AsciiString& theAfterScript,
const TVariablesList& theVariables, const TVariablesList& theVariables,
const bool theIsPublished, const bool theIsPublished,
TDF_LabelMap& theProcessed, TDF_LabelMap& theProcessed,
std::set<std::string>& theIgnoreObjs, std::set<std::string>& theIgnoreObjs,
bool& theIsDumpCollected) bool& theIsDumpCollected)
@ -1029,14 +1029,14 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
int aNbEntries = 1; int aNbEntries = 1;
if( anEntry.Value( 1 ) == O_SQR_BRACKET && anEntry.Value( anEntry.Length() ) == C_SQR_BRACKET ) { if( anEntry.Value( 1 ) == O_SQR_BRACKET && anEntry.Value( anEntry.Length() ) == C_SQR_BRACKET ) {
while(anEntry.Location(aNbEntries,COMMA,1,anEntry.Length())) while(anEntry.Location(aNbEntries,COMMA,1,anEntry.Length()))
aNbEntries++; aNbEntries++;
TCollection_AsciiString aSeparator(COMMA); TCollection_AsciiString aSeparator(COMMA);
anEntry = anEntry.Token(aSeparator.ToCString(),1); anEntry = anEntry.Token(aSeparator.ToCString(),1);
anEntry.Remove( 1, 1 ); anEntry.Remove( 1, 1 );
anEntry.RightAdjust(); anEntry.RightAdjust();
anEntry.LeftAdjust(); anEntry.LeftAdjust();
if(MYDEBUG) if(MYDEBUG)
cout<<"Sub-entry : '" <<anEntry<<"'"<<endl; cout<<"Sub-entry : '" <<anEntry<<"'"<<endl;
} }
//Find variables used for object construction //Find variables used for object construction
@ -1047,7 +1047,7 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
if(!aStates) { if(!aStates) {
if(MYDEBUG) if(MYDEBUG)
cout<<"Valiables list empty!!!"<<endl; cout<<"Valiables list empty!!!"<<endl;
aCommandIndex++; aCommandIndex++;
continue; continue;
} }
@ -1057,7 +1057,7 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
if(MYDEBUG) { if(MYDEBUG) {
cout<<"Variables from SObject:"<<endl; cout<<"Variables from SObject:"<<endl;
for (int i = 0; i < aVariables.size();i++) for (int i = 0; i < aVariables.size();i++)
cout<<"\t Variable["<<i<<"] = "<<aVariables[i].myVariable<<endl; cout<<"\t Variable["<<i<<"] = "<<aVariables[i].myVariable<<endl;
} }
//Calculate total number of parameters //Calculate total number of parameters
@ -1079,136 +1079,136 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
//Replace first parameter (bettwen '(' character and first ',' character) //Replace first parameter (bettwen '(' character and first ',' character)
if(i == aFirstParam) if(i == aFirstParam)
{ {
aStartPos = aCommand.Location(O_BRACKET, 1, aCommand.Length()) + 1; aStartPos = aCommand.Location(O_BRACKET, 1, aCommand.Length()) + 1;
if(aTotalNbParams - aNbEntries > 0 ) if(aTotalNbParams - aNbEntries > 0 )
aEndPos = aCommand.Location(aFirstParam, COMMA, 1, aCommand.Length()); aEndPos = aCommand.Location(aFirstParam, COMMA, 1, aCommand.Length());
else else
aEndPos = aCommand.Location(C_BRACKET, 1, aCommand.Length()); aEndPos = aCommand.Location(C_BRACKET, 1, aCommand.Length());
} }
//Replace last parameter (bettwen ',' character and ')' character) //Replace last parameter (bettwen ',' character and ')' character)
else if(i == aTotalNbParams) else if(i == aTotalNbParams)
{ {
aStartPos = aCommand.Location(i-1, COMMA, 1, aCommand.Length()) + 2; aStartPos = aCommand.Location(i-1, COMMA, 1, aCommand.Length()) + 2;
aEndPos = aCommand.Location(C_BRACKET, 1, aCommand.Length()); aEndPos = aCommand.Location(C_BRACKET, 1, aCommand.Length());
} }
//Replace other parameters (bettwen two ',' characters) //Replace other parameters (bettwen two ',' characters)
else if(i != aFirstParam && i != aTotalNbParams ) else if(i != aFirstParam && i != aTotalNbParams )
{ {
aStartPos = aCommand.Location(i-1, COMMA, 1, aCommand.Length()) + 2; aStartPos = aCommand.Location(i-1, COMMA, 1, aCommand.Length()) + 2;
aEndPos = aCommand.Location(i, COMMA, 1, aCommand.Length()); aEndPos = aCommand.Location(i, COMMA, 1, aCommand.Length());
} }
if( aCommand.Value( aStartPos ) == O_SQR_BRACKET ) if( aCommand.Value( aStartPos ) == O_SQR_BRACKET )
aStartPos++; aStartPos++;
if( aCommand.Value( aEndPos-1 ) == C_SQR_BRACKET ) if( aCommand.Value( aEndPos-1 ) == C_SQR_BRACKET )
aEndPos--; aEndPos--;
if ( aStartPos == aEndPos ) if ( aStartPos == aEndPos )
continue; // PAL20889: for "[]" continue; // PAL20889: for "[]"
if(MYDEBUG) if(MYDEBUG)
cout<<"aStartPos = "<<aStartPos<<", aEndPos = "<<aEndPos<<endl; cout<<"aStartPos = "<<aStartPos<<", aEndPos = "<<aEndPos<<endl;
aVar = aCommand.SubString(aStartPos, aEndPos-1); aVar = aCommand.SubString(aStartPos, aEndPos-1);
aVar.RightAdjust(); aVar.RightAdjust();
aVar.LeftAdjust(); aVar.LeftAdjust();
if(MYDEBUG) if(MYDEBUG)
cout<<"Variable: '"<< aVar <<"'"<<endl; cout<<"Variable: '"<< aVar <<"'"<<endl;
// specific case for sketcher // specific case for sketcher
if(aVar.Location( TCollection_AsciiString("Sketcher:"), 1, aVar.Length() ) != 0) { if(aVar.Location( TCollection_AsciiString("Sketcher:"), 1, aVar.Length() ) != 0) {
Standard_Integer aNbSections = 1; Standard_Integer aNbSections = 1;
while( aVar.Location( aNbSections, ':', 1, aVar.Length() ) ) while( aVar.Location( aNbSections, ':', 1, aVar.Length() ) )
aNbSections++; aNbSections++;
aNbSections--; aNbSections--;
int aStartSectionPos = 0, aEndSectionPos = 0; int aStartSectionPos = 0, aEndSectionPos = 0;
TCollection_AsciiString aSection, aReplacedSection; TCollection_AsciiString aSection, aReplacedSection;
for(Standard_Integer aSectionIndex = 1; aSectionIndex <= aNbSections; aSectionIndex++) { for(Standard_Integer aSectionIndex = 1; aSectionIndex <= aNbSections; aSectionIndex++) {
aStartSectionPos = aVar.Location( aSectionIndex, ':', 1, aVar.Length() ) + 1; aStartSectionPos = aVar.Location( aSectionIndex, ':', 1, aVar.Length() ) + 1;
if( aSectionIndex != aNbSections ) if( aSectionIndex != aNbSections )
aEndSectionPos = aVar.Location( aSectionIndex + 1, ':', 1, aVar.Length() ); aEndSectionPos = aVar.Location( aSectionIndex + 1, ':', 1, aVar.Length() );
else else
aEndSectionPos = aVar.Length(); aEndSectionPos = aVar.Length();
aSection = aVar.SubString(aStartSectionPos, aEndSectionPos-1); aSection = aVar.SubString(aStartSectionPos, aEndSectionPos-1);
if(MYDEBUG) if(MYDEBUG)
cout<<"aSection: "<<aSection<<endl; cout<<"aSection: "<<aSection<<endl;
Standard_Integer aNbParams = 1; Standard_Integer aNbParams = 1;
while( aSection.Location( aNbParams, ' ', 1, aSection.Length() ) ) while( aSection.Location( aNbParams, ' ', 1, aSection.Length() ) )
aNbParams++; aNbParams++;
aNbParams--; aNbParams--;
int aStartParamPos = 0, aEndParamPos = 0; int aStartParamPos = 0, aEndParamPos = 0;
TCollection_AsciiString aParameter, aReplacedParameter; TCollection_AsciiString aParameter, aReplacedParameter;
for(Standard_Integer aParamIndex = 1; aParamIndex <= aNbParams; aParamIndex++) { for(Standard_Integer aParamIndex = 1; aParamIndex <= aNbParams; aParamIndex++) {
aStartParamPos = aSection.Location( aParamIndex, ' ', 1, aSection.Length() ) + 1; aStartParamPos = aSection.Location( aParamIndex, ' ', 1, aSection.Length() ) + 1;
if( aParamIndex != aNbParams ) if( aParamIndex != aNbParams )
aEndParamPos = aSection.Location( aParamIndex + 1, ' ', 1, aSection.Length() ); aEndParamPos = aSection.Location( aParamIndex + 1, ' ', 1, aSection.Length() );
else else
aEndParamPos = aSection.Length() + 1; aEndParamPos = aSection.Length() + 1;
aParameter = aSection.SubString(aStartParamPos, aEndParamPos-1); aParameter = aSection.SubString(aStartParamPos, aEndParamPos-1);
if(MYDEBUG) if(MYDEBUG)
cout<<"aParameter: "<<aParameter<<endl; cout<<"aParameter: "<<aParameter<<endl;
if(iVar >= aVariables.size()) if(iVar >= aVariables.size())
continue; continue;
aReplacedParameter = aVariables[iVar].myVariable; aReplacedParameter = aVariables[iVar].myVariable;
if(aReplacedParameter.IsEmpty()) { if(aReplacedParameter.IsEmpty()) {
iVar++; iVar++;
continue; continue;
} }
if(aVariables[iVar].isVariable) { if(aVariables[iVar].isVariable) {
aReplacedParameter.InsertBefore(1,"'"); aReplacedParameter.InsertBefore(1,"'");
aReplacedParameter.InsertAfter(aReplacedParameter.Length(),"'"); aReplacedParameter.InsertAfter(aReplacedParameter.Length(),"'");
} }
if(MYDEBUG) if(MYDEBUG)
cout<<"aSection before : "<<aSection<<endl; cout<<"aSection before : "<<aSection<<endl;
aSection.Remove(aStartParamPos, aEndParamPos - aStartParamPos); aSection.Remove(aStartParamPos, aEndParamPos - aStartParamPos);
aSection.Insert(aStartParamPos, aReplacedParameter); aSection.Insert(aStartParamPos, aReplacedParameter);
if(MYDEBUG) if(MYDEBUG)
cout<<"aSection after : "<<aSection<<endl<<endl; cout<<"aSection after : "<<aSection<<endl<<endl;
iVar++; iVar++;
} }
if(MYDEBUG) if(MYDEBUG)
cout<<"aVar before : "<<aVar<<endl; cout<<"aVar before : "<<aVar<<endl;
aVar.Remove(aStartSectionPos, aEndSectionPos - aStartSectionPos); aVar.Remove(aStartSectionPos, aEndSectionPos - aStartSectionPos);
aVar.Insert(aStartSectionPos, aSection); aVar.Insert(aStartSectionPos, aSection);
if(MYDEBUG) if(MYDEBUG)
cout<<"aVar after : "<<aVar<<endl<<endl; cout<<"aVar after : "<<aVar<<endl<<endl;
} }
if(MYDEBUG) if(MYDEBUG)
cout<<"aCommand before : "<<aCommand<<endl; cout<<"aCommand before : "<<aCommand<<endl;
aCommand.Remove(aStartPos, aEndPos - aStartPos); aCommand.Remove(aStartPos, aEndPos - aStartPos);
aCommand.Insert(aStartPos, aVar); aCommand.Insert(aStartPos, aVar);
if(MYDEBUG) if(MYDEBUG)
cout<<"aCommand after : "<<aCommand<<endl; cout<<"aCommand after : "<<aCommand<<endl;
break; break;
} // end of specific case for sketcher } // end of specific case for sketcher
//If parameter is entry or 'None', skip it //If parameter is entry or 'None', skip it
if(theVariables.find(aVar) != theVariables.end() || aVar.Search(":") != -1 || aVar == PY_NULL) if(theVariables.find(aVar) != theVariables.end() || aVar.Search(":") != -1 || aVar == PY_NULL)
continue; continue;
if(iVar >= aVariables.size()) if(iVar >= aVariables.size())
continue; continue;
aReplacedVar = aVariables[iVar].myVariable; aReplacedVar = aVariables[iVar].myVariable;
if(aReplacedVar.IsEmpty()) { if(aReplacedVar.IsEmpty()) {
iVar++; iVar++;
continue; continue;
} }
if(aVariables[iVar].isVariable) { if(aVariables[iVar].isVariable) {
aReplacedVar.InsertBefore(1,"\""); aReplacedVar.InsertBefore(1,"\"");
aReplacedVar.InsertAfter(aReplacedVar.Length(),"\""); aReplacedVar.InsertAfter(aReplacedVar.Length(),"\"");
} }
aCommand.Remove(aStartPos, aEndPos - aStartPos); aCommand.Remove(aStartPos, aEndPos - aStartPos);
@ -1234,9 +1234,9 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
*/ */
//============================================================================= //=============================================================================
void ReplaceEntriesByNames (TCollection_AsciiString& theScript, void ReplaceEntriesByNames (TCollection_AsciiString& theScript,
Resource_DataMapOfAsciiStringAsciiString& theObjectNames, Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
const bool theIsPublished, const bool theIsPublished,
Resource_DataMapOfAsciiStringAsciiString& theEntryToBadName, Resource_DataMapOfAsciiStringAsciiString& theEntryToBadName,
TColStd_SequenceOfAsciiString& theObjListToPublish) TColStd_SequenceOfAsciiString& theObjListToPublish)
{ {
Handle(TColStd_HSequenceOfInteger) aSeq = FindEntries(theScript); Handle(TColStd_HSequenceOfInteger) aSeq = FindEntries(theScript);
@ -1307,8 +1307,8 @@ void ReplaceEntriesByNames (TCollection_AsciiString& theScript,
*/ */
//============================================================================= //=============================================================================
void AddObjectColors (int theDocID, void AddObjectColors (int theDocID,
TCollection_AsciiString& theScript, TCollection_AsciiString& theScript,
const Resource_DataMapOfAsciiStringAsciiString& theObjectNames) const Resource_DataMapOfAsciiStringAsciiString& theObjectNames)
{ {
GEOM_Engine* engine = GEOM_Engine::GetEngine(); GEOM_Engine* engine = GEOM_Engine::GetEngine();
Handle(TDocStd_Document) aDoc = engine->GetDocument(theDocID); Handle(TDocStd_Document) aDoc = engine->GetDocument(theDocID);
@ -1390,11 +1390,11 @@ void AddObjectColors (int theDocID,
else if (aMarkerType == Aspect_TOM_USERDEFINED) { else if (aMarkerType == Aspect_TOM_USERDEFINED) {
int aMarkerTextureID = obj->GetMarkerTexture(); int aMarkerTextureID = obj->GetMarkerTexture();
if (aMarkerTextureID >= 0) { if (aMarkerTextureID >= 0) {
TCollection_AsciiString aCommand( "\n\t" ); TCollection_AsciiString aCommand( "\n\t" );
aCommand += aName + ".SetMarkerTexture(texture_map["; aCommand += aName + ".SetMarkerTexture(texture_map[";
aCommand += aMarkerTextureID; aCommand += aMarkerTextureID;
aCommand += "])"; aCommand += "])";
theScript += aCommand.ToCString(); theScript += aCommand.ToCString();
} }
} }
} }
@ -1408,7 +1408,7 @@ static TCollection_AsciiString pack_data(const Handle(TDataStd_HArray1OfByte)& a
Standard_Byte byte = aData->Value(i); Standard_Byte byte = aData->Value(i);
TCollection_AsciiString strByte = ""; TCollection_AsciiString strByte = "";
for (int j = 0; j < 8; j++) for (int j = 0; j < 8; j++)
strByte.Prepend((byte & (1<<j)) ? "1" : "0"); strByte.Prepend((byte & (1<<j)) ? "1" : "0");
stream += strByte; stream += strByte;
} }
} }
@ -1430,20 +1430,20 @@ void AddTextures (int theDocID, TCollection_AsciiString& theScript)
TCollection_AsciiString aFileName; TCollection_AsciiString aFileName;
Handle(TDataStd_HArray1OfByte) aTexture = engine->getTexture(theDocID, *it, aWidth, aHeight, aFileName); Handle(TDataStd_HArray1OfByte) aTexture = engine->getTexture(theDocID, *it, aWidth, aHeight, aFileName);
if (aWidth > 0 && aHeight > 0 && !aTexture.IsNull() && aTexture->Length() > 0 ) { if (aWidth > 0 && aHeight > 0 && !aTexture.IsNull() && aTexture->Length() > 0 ) {
TCollection_AsciiString aCommand = "\n\t"; TCollection_AsciiString aCommand = "\n\t";
aCommand += "texture_map["; aCommand += *it; aCommand += "] = "; aCommand += "texture_map["; aCommand += *it; aCommand += "] = ";
if (aFileName != "" ) { if (aFileName != "" ) {
aCommand += "geompy.LoadTexture(\""; aCommand += "geompy.LoadTexture(\"";
aCommand += aFileName.ToCString(); aCommand += aFileName.ToCString();
aCommand += "\")"; aCommand += "\")";
} }
else { else {
aCommand += "geompy.AddTexture("; aCommand += "geompy.AddTexture(";
aCommand += aWidth; aCommand += ", "; aCommand += aHeight; aCommand += ", \""; aCommand += aWidth; aCommand += ", "; aCommand += aHeight; aCommand += ", \"";
aCommand += pack_data(aTexture); aCommand += pack_data(aTexture);
aCommand += "\")"; aCommand += "\")";
} }
theScript += aCommand; theScript += aCommand;
} }
} }
theScript += "\n"; theScript += "\n";
@ -1456,13 +1456,13 @@ void AddTextures (int theDocID, TCollection_AsciiString& theScript)
*/ */
//============================================================================= //=============================================================================
void PublishObject (const TCollection_AsciiString& theEntry, void PublishObject (const TCollection_AsciiString& theEntry,
const TCollection_AsciiString& theName, const TCollection_AsciiString& theName,
const Resource_DataMapOfAsciiStringAsciiString& theObjectNames, const Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
const Resource_DataMapOfAsciiStringAsciiString& theEntry2StEntry, const Resource_DataMapOfAsciiStringAsciiString& theEntry2StEntry,
const Resource_DataMapOfAsciiStringAsciiString& theStEntry2Entry, const Resource_DataMapOfAsciiStringAsciiString& theStEntry2Entry,
const Resource_DataMapOfAsciiStringAsciiString& theEntryToBadName, const Resource_DataMapOfAsciiStringAsciiString& theEntryToBadName,
std::map< int, std::string >& theEntryToCommandMap, std::map< int, std::string >& theEntryToCommandMap,
std::set<std::string>& theMapOfPublished) std::set<std::string>& theMapOfPublished)
{ {
if ( !theEntry2StEntry.IsBound( theEntry )) if ( !theEntry2StEntry.IsBound( theEntry ))
return; // was not published return; // was not published

View File

@ -119,26 +119,26 @@ class GEOM_Engine
//Adds a new sub shape object of the MainShape object //Adds a new sub shape object of the MainShape object
Standard_EXPORT Handle(GEOM_Object) AddSubShape(Handle(GEOM_Object) theMainShape, Standard_EXPORT Handle(GEOM_Object) AddSubShape(Handle(GEOM_Object) theMainShape,
Handle(TColStd_HArray1OfInteger) theIndices, Handle(TColStd_HArray1OfInteger) theIndices,
bool isStandaloneOperation = false); bool isStandaloneOperation = false);
Standard_EXPORT TCollection_AsciiString DumpPython(int theDocID, Standard_EXPORT TCollection_AsciiString DumpPython(int theDocID,
Resource_DataMapOfAsciiStringAsciiString& theObjectNames, Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
TVariablesList theVariables, TVariablesList theVariables,
bool isPublished, bool isPublished,
bool& aValidScript); bool& aValidScript);
Standard_EXPORT const char* GetDumpName (const char* theStudyEntry) const; Standard_EXPORT const char* GetDumpName (const char* theStudyEntry) const;
Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) GetAllDumpNames() const; Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) GetAllDumpNames() const;
Standard_EXPORT int addTexture(int theDocID, int theWidth, int theHeight, Standard_EXPORT int addTexture(int theDocID, int theWidth, int theHeight,
const Handle(TDataStd_HArray1OfByte)& theTexture, const Handle(TDataStd_HArray1OfByte)& theTexture,
const TCollection_AsciiString& theFileName = ""); const TCollection_AsciiString& theFileName = "");
Standard_EXPORT Handle(TDataStd_HArray1OfByte) getTexture(int theDocID, int theTextureID, Standard_EXPORT Handle(TDataStd_HArray1OfByte) getTexture(int theDocID, int theTextureID,
int& theWidth, int& theHeight, int& theWidth, int& theHeight,
TCollection_AsciiString& theFileName); TCollection_AsciiString& theFileName);
Standard_EXPORT std::list<int> getAllTextures(int theDocID); Standard_EXPORT std::list<int> getAllTextures(int theDocID);

View File

@ -727,10 +727,10 @@ Standard_EXPORT Handle_Standard_Type& GEOM_Function_Type_()
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
static Handle_Standard_Type _aType = new Standard_Type("GEOM_Function", static Handle_Standard_Type _aType = new Standard_Type("GEOM_Function",
sizeof(GEOM_Function), sizeof(GEOM_Function),
1, 1,
(Standard_Address)_Ancestors, (Standard_Address)_Ancestors,
(Standard_Address)NULL); (Standard_Address)NULL);
return _aType; return _aType;
} }

View File

@ -455,7 +455,7 @@ int GEOM_Object::GetMarkerTexture()
TDF_Label aTypeLabel = aMarkerLabel.FindChild(MARKER_LABEL_ID, Standard_False); TDF_Label aTypeLabel = aMarkerLabel.FindChild(MARKER_LABEL_ID, Standard_False);
Handle(TDataStd_Integer) anIdAttr; Handle(TDataStd_Integer) anIdAttr;
if (!aTypeLabel.IsNull() && aTypeLabel.FindAttribute(TDataStd_Integer::GetID(), anIdAttr)) if (!aTypeLabel.IsNull() && aTypeLabel.FindAttribute(TDataStd_Integer::GetID(), anIdAttr))
anId = anIdAttr->Get(); anId = anIdAttr->Get();
} }
} }
return anId; return anId;
@ -671,10 +671,10 @@ Standard_EXPORT Handle_Standard_Type& GEOM_Object_Type_()
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
static Handle_Standard_Type _aType = new Standard_Type("GEOM_Object", static Handle_Standard_Type _aType = new Standard_Type("GEOM_Object",
sizeof(GEOM_Object), sizeof(GEOM_Object),
1, 1,
(Standard_Address)_Ancestors, (Standard_Address)_Ancestors,
(Standard_Address)NULL); (Standard_Address)NULL);
return _aType; return _aType;
} }

View File

@ -101,11 +101,11 @@ Standard_Integer GEOM_SubShapeDriver::Execute(TFunction_Logbook& log) const
B.MakeCompound(aCompound); B.MakeCompound(aCompound);
for (int i = anIndices->Lower(); i<= anIndices->Upper(); i++) { for (int i = anIndices->Lower(); i<= anIndices->Upper(); i++) {
if (aMapOfShapes.Extent() < anIndices->Value(i)) if (aMapOfShapes.Extent() < anIndices->Value(i))
Standard_NullObject::Raise("GEOM_SubShapeDriver::Execute: Index is out of range"); Standard_NullObject::Raise("GEOM_SubShapeDriver::Execute: Index is out of range");
TopoDS_Shape aSubShape = aMapOfShapes.FindKey(anIndices->Value(i)); TopoDS_Shape aSubShape = aMapOfShapes.FindKey(anIndices->Value(i));
if (aSubShape.IsNull()) continue; if (aSubShape.IsNull()) continue;
B.Add(aCompound,aSubShape); B.Add(aCompound,aSubShape);
} }
aShape = aCompound; aShape = aCompound;
@ -145,10 +145,10 @@ Standard_EXPORT Handle_Standard_Type& GEOM_SubShapeDriver_Type_()
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
static Handle_Standard_Type _aType = new Standard_Type("GEOM_SubShapeDriver", static Handle_Standard_Type _aType = new Standard_Type("GEOM_SubShapeDriver",
sizeof(GEOM_SubShapeDriver), sizeof(GEOM_SubShapeDriver),
1, 1,
(Standard_Address)_Ancestors, (Standard_Address)_Ancestors,
(Standard_Address)NULL); (Standard_Address)NULL);
return _aType; return _aType;
} }