X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelHighAPI%2FModelHighAPI_Dumper.cpp;h=1031cf85498a1868ece8135255c77fa4a94591e7;hb=a13f87935d2a6f52f942790b6abc874f1016c9fc;hp=5352af49710ce0f43dc4e4116c758aae69d034f0;hpb=ff6e13e820f033edea5c6b3aa3b0feec59959aa3;p=modules%2Fshaper.git diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp index 5352af497..1031cf854 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp @@ -315,7 +315,7 @@ void ModelHighAPI_Dumper::DumpStorage::write(const AttributeSelectionPtr& theAtt if (aShape.get()) { myDumpBuffer << "\"" << aShape->shapeTypeStr() << "\", \"" - << theAttrSelect->namingName() << "\""; + << ModelAPI_Tools::toString(theAttrSelect->namingName()) << "\""; } myDumpBuffer << ")"; @@ -496,7 +496,8 @@ void ModelHighAPI_Dumper::DumpStorageWeak::write(const AttributeSelectionPtr& th int anIndex = aNExplode.index(aShape); if (anIndex != 0) { // found a week-naming index, so, export it myDumpBuffer << "model.selection(\"" << aShape->shapeTypeStr() << "\", \"" - << theAttrSelect->contextName(aContext) << "\", " << anIndex << ")"; + << ModelAPI_Tools::toString(theAttrSelect->contextName(aContext)) + << "\", " << anIndex << ")"; aStandardDump = false; } } @@ -580,18 +581,19 @@ const std::string& ModelHighAPI_Dumper::name(const EntityPtr& theEntity, return aFound->second.myCurrentName; } // entity is not found, store it - std::string aName, aKind; + std::string aName; + std::string aKind; bool isDefaultName = false; bool isSaveNotDumped = theSaveNotDumped; std::ostringstream aDefaultName; FeaturePtr aFeature = std::dynamic_pointer_cast(theEntity); if (aFeature) { - aName = aFeature->name(); + aName = ModelAPI_Tools::toString(aFeature->name()); aKind = aFeature->getKind(); } else { FolderPtr aFolder = std::dynamic_pointer_cast(theEntity); if (aFolder) { - aName = aFolder->data()->name(); + aName = ModelAPI_Tools::toString(aFolder->data()->name()); aKind = ModelAPI_Folder::ID(); isSaveNotDumped = false; } @@ -684,9 +686,9 @@ void ModelHighAPI_Dumper::saveResultNames(const FeaturePtr& theFeature) std::list allRes; ModelAPI_Tools::allResults(theFeature, allRes); for(std::list::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) { - std::pair aName = ModelAPI_Tools::getDefaultName(*aRes); - std::string aDefaultName = aName.first; - std::string aResName = (*aRes)->data()->name(); + std::pair aName = ModelAPI_Tools::getDefaultName(*aRes); + std::string aDefaultName = ModelAPI_Tools::toString(aName.first); + std::string aResName = ModelAPI_Tools::toString((*aRes)->data()->name()); bool isUserDefined = !(isFeatureDefaultName && aDefaultName == aResName); myNames[*aRes] = EntityName(aResName, (isUserDefined ? aResName : std::string()), !isUserDefined); @@ -870,14 +872,15 @@ void ModelHighAPI_Dumper::dumpSubFeatureNameAndColor(const std::string theSubFea const FeaturePtr& theSubFeature) { name(theSubFeature, false); - myNames[theSubFeature] = EntityName(theSubFeatureGet, theSubFeature->name(), false); + myNames[theSubFeature] = + EntityName(theSubFeatureGet, ModelAPI_Tools::toString(theSubFeature->name()), false); // store results if they have user-defined names or colors std::list aResultsWithNameOrColor; const std::list& aResults = theSubFeature->results(); std::list::const_iterator aResIt = aResults.begin(); for (; aResIt != aResults.end(); ++aResIt) { - std::string aResName = (*aResIt)->data()->name(); + std::string aResName = ModelAPI_Tools::toString((*aResIt)->data()->name()); myNames[*aResIt] = EntityName(aResName, aResName, false); aResultsWithNameOrColor.push_back(*aResIt); } @@ -1060,6 +1063,16 @@ bool ModelHighAPI_Dumper::isDefaultTransparency(const ResultPtr& theResult) cons return fabs(anAttribute->value()) < 1.e-12; } +bool ModelHighAPI_Dumper::dumpCommentBeforeFeature(const FeaturePtr& theFeature) const +{ + // currently, the comment should not be dumped only before the filters + FiltersFeaturePtr aFilters = std::dynamic_pointer_cast(theFeature); + if (aFilters) + return false; + // all other features should be commented before the dump + return true; +} + ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const char theChar) { *myDumpStorage << theChar; @@ -1078,6 +1091,12 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const std::string& theStrin return *this; } +ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const std::wstring& theString) +{ + *myDumpStorage << ModelAPI_Tools::toString(theString); + return *this; +} + ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const bool theValue) { *myDumpStorage << (theValue ? "True" : "False");