]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Support of wide string
authorvsv <vsv@opencascade.com>
Tue, 9 Jun 2020 07:49:42 +0000 (10:49 +0300)
committervsv <vsv@opencascade.com>
Tue, 9 Jun 2020 07:49:42 +0000 (10:49 +0300)
136 files changed:
src/CollectionPlugin/CollectionPlugin_Group.cpp
src/CollectionPlugin/CollectionPlugin_WidgetField.cpp
src/Events/Events.i
src/Events/Events_InfoMessage.cpp
src/Events/Events_InfoMessage.h
src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp
src/ExchangePlugin/ExchangePlugin_ExportPart.cpp
src/ExchangePlugin/ExchangePlugin_Import.cpp
src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp
src/ExchangePlugin/ExchangePlugin_ImportPart.cpp
src/FeaturesPlugin/FeaturesPlugin_Copy.cpp
src/InitializationPlugin/InitializationPlugin_Plugin.cpp
src/InitializationPlugin/InitializationPlugin_Plugin.h
src/Model/Model_Application.cpp
src/Model/Model_Application.h
src/Model/Model_AttributeSelection.cpp
src/Model/Model_AttributeSelection.h
src/Model/Model_AttributeSelectionList.cpp
src/Model/Model_AttributeSelectionList.h
src/Model/Model_BodyBuilder.cpp
src/Model/Model_Data.cpp
src/Model/Model_Data.h
src/Model/Model_Document.cpp
src/Model/Model_Document.h
src/Model/Model_Objects.cpp
src/Model/Model_Objects.h
src/Model/Model_ResultConstruction.cpp
src/Model/Model_ResultField.cpp
src/Model/Model_ResultField.h
src/Model/Model_ResultPart.cpp
src/Model/Model_ResultPart.h
src/Model/Model_Session.cpp
src/Model/Model_Session.h
src/ModelAPI/ModelAPI.i
src/ModelAPI/ModelAPI_AttributeSelection.h
src/ModelAPI/ModelAPI_AttributeSelectionList.h
src/ModelAPI/ModelAPI_Data.h
src/ModelAPI/ModelAPI_Document.h
src/ModelAPI/ModelAPI_Events.cpp
src/ModelAPI/ModelAPI_Events.h
src/ModelAPI/ModelAPI_Feature.h
src/ModelAPI/ModelAPI_Folder.h
src/ModelAPI/ModelAPI_ResultField.h
src/ModelAPI/ModelAPI_ResultPart.h
src/ModelAPI/ModelAPI_Session.h
src/ModelAPI/ModelAPI_Tools.cpp
src/ModelAPI/ModelAPI_Tools.h
src/ModelHighAPI/ModelHighAPI.i
src/ModelHighAPI/ModelHighAPI_Dumper.cpp
src/ModelHighAPI/ModelHighAPI_Dumper.h
src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp
src/ModelHighAPI/ModelHighAPI_Folder.cpp
src/ModelHighAPI/ModelHighAPI_Folder.h
src/ModelHighAPI/ModelHighAPI_Interface.cpp
src/ModelHighAPI/ModelHighAPI_Interface.h
src/ModelHighAPI/ModelHighAPI_Selection.cpp
src/ModelHighAPI/ModelHighAPI_Selection.h
src/ModelHighAPI/ModelHighAPI_Services.cpp
src/ModelHighAPI/ModelHighAPI_Services.h
src/ModelHighAPI/ModelHighAPI_Tools.cpp
src/ModuleBase/ModuleBase_ResultPrs.cpp
src/ModuleBase/ModuleBase_Tools.cpp
src/ModuleBase/ModuleBase_Tools.h
src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp
src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetNameEdit.cpp
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
src/ParametersPlugin/ParametersPlugin_EvalListener.cpp
src/ParametersPlugin/ParametersPlugin_Parameter.cpp
src/ParametersPlugin/ParametersPlugin_Validators.cpp
src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp
src/PartSet/PartSet_MenuMgr.cpp
src/PartSet/PartSet_OverconstraintListener.cpp
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_TreeNodes.cpp
src/PartSet/PartSet_Validators.cpp
src/PrimitivesAPI/PrimitivesAPI_Cone.cpp
src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp
src/PrimitivesAPI/PrimitivesAPI_Sphere.cpp
src/PrimitivesAPI/PrimitivesAPI_Torus.cpp
src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp
src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.cpp
src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp
src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp
src/Selector/Selector_Algo.cpp
src/Selector/Selector_Algo.h
src/Selector/Selector_Container.cpp
src/Selector/Selector_Container.h
src/Selector/Selector_FilterByNeighbors.cpp
src/Selector/Selector_FilterByNeighbors.h
src/Selector/Selector_Intersect.cpp
src/Selector/Selector_Intersect.h
src/Selector/Selector_Modify.cpp
src/Selector/Selector_Modify.h
src/Selector/Selector_NameGenerator.h
src/Selector/Selector_Primitive.cpp
src/Selector/Selector_Primitive.h
src/Selector/Selector_Selector.cpp
src/Selector/Selector_Selector.h
src/Selector/Selector_WeakName.cpp
src/Selector/Selector_WeakName.h
src/SketchAPI/SketchAPI.i
src/SketchAPI/SketchAPI_Arc.cpp
src/SketchAPI/SketchAPI_Arc.h
src/SketchAPI/SketchAPI_BSpline.cpp
src/SketchAPI/SketchAPI_Circle.cpp
src/SketchAPI/SketchAPI_Circle.h
src/SketchAPI/SketchAPI_Ellipse.cpp
src/SketchAPI/SketchAPI_Ellipse.h
src/SketchAPI/SketchAPI_EllipticArc.cpp
src/SketchAPI/SketchAPI_EllipticArc.h
src/SketchAPI/SketchAPI_IntersectionPoint.cpp
src/SketchAPI/SketchAPI_IntersectionPoint.h
src/SketchAPI/SketchAPI_Line.cpp
src/SketchAPI/SketchAPI_Line.h
src/SketchAPI/SketchAPI_Point.cpp
src/SketchAPI/SketchAPI_Point.h
src/SketchAPI/SketchAPI_Projection.cpp
src/SketchAPI/SketchAPI_Projection.h
src/SketchAPI/SketchAPI_Sketch.cpp
src/SketchAPI/SketchAPI_Sketch.h
src/SketchPlugin/SketchPlugin_MacroBSpline.cpp
src/SketchPlugin/SketchPlugin_Sketch.cpp
src/SketchPlugin/SketchPlugin_SketchCopy.cpp
src/SketchPlugin/SketchPlugin_Split.cpp
src/SketchPlugin/SketchPlugin_Tools.cpp
src/SketchPlugin/SketchPlugin_Tools.h
src/SketchPlugin/SketchPlugin_Validators.cpp
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_FacesPanel.cpp
src/XGUI/XGUI_ObjectsBrowser.cpp
src/XGUI/XGUI_Selection.cpp
src/XGUI/XGUI_SelectionMgr.cpp
src/XGUI/XGUI_Tools.cpp
src/XGUI/XGUI_Workshop.cpp

index 6af6734f2f0ba8f640e756290ab3fbb2c12ad850..f45454afa0e75e6c41aab73bfc191e9fcf81b04d 100644 (file)
@@ -49,12 +49,12 @@ void CollectionPlugin_Group::execute()
 }
 
 // returns name with suffix, not existing in the existing set
-static std::string findName(
-  const std::string theOrigin, int& theSuffix, std::set<std::string>& theExisting)
+static std::wstring findName(
+  const std::wstring theOrigin, int& theSuffix, std::set<std::wstring>& theExisting)
 {
-  std::string aRes;
+  std::wstring aRes;
   do {
-    std::ostringstream aName;
+    std::wostringstream aName;
     aName<<theOrigin<<"_"<<theSuffix;
     aRes = aName.str();
     theSuffix++;
@@ -82,7 +82,7 @@ bool CollectionPlugin_Group::customAction(const std::string& theActionId)
   if (theActionId == "split") {
     DocumentPtr aDoc = document();
     // collect all existing names of features to give unique names
-    std::set<std::string> aFeatNames, aResNames;
+    std::set<std::wstring> aFeatNames, aResNames;
     std::list<FeaturePtr> allFeat = aDoc->allFeatures();
     std::list<FeaturePtr>::iterator allFeatIter = allFeat.begin();
     for(; allFeatIter != allFeat.end(); allFeatIter++) {
@@ -197,7 +197,7 @@ bool CollectionPlugin_Group::customAction(const std::string& theActionId)
         aFeat->data()->setName(findName(name(), aSuffix, aFeatNames));
         if (!aFeat->results().empty() && !results().empty()) {
           int aResSuf = aSuffix - 1;
-          std::string aResName = findName(firstResult()->data()->name(), aResSuf, aResNames);
+          std::wstring aResName = findName(firstResult()->data()->name(), aResSuf, aResNames);
           aFeat->firstResult()->data()->setName(aResName);
           ModelAPI_Tools::copyVisualizationAttrs(firstResult(), aFeat->firstResult());
         }
index a2e291ed8a8f5d39e4a8386895e893fd5ffb3dc0..8fb703936924cfb7aeb38812660c5a17aedff710 100644 (file)
@@ -578,9 +578,9 @@ bool CollectionPlugin_WidgetField::restoreValueCustom()
           // Add selection names
           AttributeSelectionPtr aAttr = aSelList->value(k - 1);
           if (aItem) {
-            aItem->setText(aAttr->namingName().c_str());
+            aItem->setText(QString::fromStdWString(aAttr->namingName()));
           } else {
-            aItem = new QTableWidgetItem(aAttr->namingName().c_str());
+            aItem = new QTableWidgetItem(QString::fromStdWString(aAttr->namingName()));
             aTable->setItem(k, j, aItem);
           }
         } else if (j > 0) {
@@ -769,8 +769,8 @@ void CollectionPlugin_WidgetField::onAddStep()
           aTable->setItem(j, i, aItem);
         }
         AttributeSelectionPtr aAttr = aSelList->value(j - 1);
-        aItem->setText(aAttr->namingName().c_str());
-        aItem->setToolTip(aAttr->namingName().c_str());
+        aItem->setText(QString::fromStdWString(aAttr->namingName()));
+        aItem->setToolTip(QString::fromStdWString(aAttr->namingName()));
       }
     } else {
       QString aDefVal = aTable->item(0, i)->text();
@@ -885,8 +885,8 @@ bool CollectionPlugin_WidgetField::
               aTable->setItem(j, i, aItem);
             }
             AttributeSelectionPtr aAttr = aSelList->value(j - 1);
-            aItem->setText(aAttr->namingName().c_str());
-            aItem->setToolTip(aAttr->namingName().c_str());
+            aItem->setText(QString::fromStdWString(aAttr->namingName()));
+            aItem->setToolTip(QString::fromStdWString(aAttr->namingName()));
           }
         } else {
           QString aDefVal = aTable->item(0, i)->text();
@@ -904,8 +904,8 @@ bool CollectionPlugin_WidgetField::
       // Update only selection name
       for(int j = 1; j < aNewRows - 1; j++) {
         AttributeSelectionPtr aAttr = aSelList->value(j);
-        aTable->item(j, 0)->setText(aAttr->namingName().c_str());
-        aTable->item(j, 0)->setToolTip(aAttr->namingName().c_str());
+        aTable->item(j, 0)->setText(QString::fromStdWString(aAttr->namingName()));
+        aTable->item(j, 0)->setToolTip(QString::fromStdWString(aAttr->namingName()));
       }
     }
   }
index 5b543e58c54c666c7905784776e3fed70eca732b..23486b0533ef82faeb512f9c5093020b57c26f60 100644 (file)
@@ -43,6 +43,7 @@
 // standard definitions
 %include "typemaps.i"
 %include "std_string.i"
+%include "std_wstring.i"
 
 // directors
 %feature("director") Events_Listener;
index a9b3cd3fbcfe5617a59b4060ef8611b669876cb1..50f41d1214d765149bd947cdac6004978b42d968 100644 (file)
 //
 
 #include "Events_InfoMessage.h"
-
-#ifdef WIN32
-#pragma warning(disable : 4996) // for sprintf
-#endif
+#include <sstream>
+#include <codecvt>
 
 void Events_InfoMessage::addParameter(double theParam)
 {
-  static char aBuf[50];
-  sprintf(aBuf, "%g", theParam);
-  myParameters.push_back(std::string(aBuf));
+  std::stringstream aStream;
+  aStream << theParam;
+  myParameters.push_back(aStream.str());
 }
 
 void Events_InfoMessage::addParameter(int theParam)
 {
-  static char aBuf[50];
-  sprintf(aBuf, "%d", theParam);
-  myParameters.push_back(std::string(aBuf));
+  std::stringstream aStream;
+  aStream << theParam;
+  myParameters.push_back(aStream.str());
 }
 
 void Events_InfoMessage::send()
@@ -42,3 +40,10 @@ void Events_InfoMessage::send()
   std::shared_ptr<Events_Message> aMsg(new Events_InfoMessage(*this));
   Events_Loop::loop()->send(aMsg);
 }
+
+Events_InfoMessage& Events_InfoMessage::arg(const std::wstring& theParam)
+{
+  static std::wstring_convert<std::codecvt_utf8<wchar_t> > aConvertor;
+  addParameter(aConvertor.to_bytes(theParam));
+  return *this;
+}
index a64b5e8bf64e4ceb40947ac5e891f8670f47abd6..ea19ee115017c12e0c3ed7417afb036a947ab02d 100644 (file)
@@ -95,6 +95,10 @@ public:
   /// Returns list of parameters
   std::list<std::string> parameters() const { return myParameters; }
 
+  /// Add parameter for message string of wstring type
+  /// \param theParam the parameter
+  EVENTS_EXPORT Events_InfoMessage& arg(const std::wstring& theParam);
+
   /// Add parameter for message string of string type
   /// \param theParam the parameter
   Events_InfoMessage& arg(const std::string& theParam) { addParameter(theParam); return *this; }
index 93500cc5e7660a345a7aa6e851878269123e23fe..d27a170860c6b4eb80c99e6fbf8ae0a171090e31 100644 (file)
@@ -394,7 +394,7 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName)
   if (aGeometryName.empty() && aResults.size() == 1) {
     // get the name from the first result
     ResultPtr aResultBody = *aResults.begin();
-    aGeometryName = aResultBody->data()->name();
+    aGeometryName = ModelAPI_Tools::toString(aResultBody->data()->name());
   }
 
   aXao.getGeometry()->setName(aGeometryName);
@@ -429,7 +429,7 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName)
       XAO::Dimension aGroupDimension = XAO::XaoUtils::stringToDimension(aDimensionString);
 
       XAO::Group* aXaoGroup = aXao.addGroup(aGroupDimension,
-                                            aResultGroup->data()->name());
+        ModelAPI_Tools::toString(aResultGroup->data()->name()));
 
       try {
         GeomAPI_ShapeExplorer aGroupResExplorer(aResultGroup->shape(), aSelType);
@@ -448,7 +448,7 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName)
       } catch (XAO::XAO_Exception& e) {
         // LCOV_EXCL_START
         std::string msg = "An error occurred while exporting group " +
-          aResultGroup->data()->name();
+          ModelAPI_Tools::toString(aResultGroup->data()->name());
         msg += ".\n";
         msg += e.what();
         msg += "\n";
@@ -485,7 +485,7 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName)
       XAO::Type aFieldType = XAO::XaoUtils::stringToFieldType(aTypeString);
 
       XAO::Field* aXaoField = aXao.addField(aFieldType, aFieldDimension, aTables->columns(),
-                                            aResultField->data()->name());
+        ModelAPI_Tools::toString(aResultField->data()->name()));
 
 
       try {
@@ -546,7 +546,7 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName)
       } catch (XAO::XAO_Exception& e) {
         // LCOV_EXCL_START
         std::string msg = "An error occurred while exporting field " +
-          aResultField->data()->name();
+          ModelAPI_Tools::toString(aResultField->data()->name());
         msg += ".\n";
         msg += e.what();
         msg += "\n";
index a0889ea2738a3c5bdf96354a5306e033cb6fd2db..84951f3ee16adf786d3179ef9cd64ad1846d6c39 100644 (file)
@@ -50,7 +50,7 @@ static bool verifyExport(const std::list<FeaturePtr>& theFeatures,
                          std::list<FeaturePtr>& theExportedParts,
                          std::list<FeaturePtr>& theReferredParts);
 // Collect names of features as a single string
-static std::string namesOfFeatures(const std::list<FeaturePtr>& theFeatures);
+static std::wstring namesOfFeatures(const std::list<FeaturePtr>& theFeatures);
 
 
 ExchangePlugin_ExportPart::ExchangePlugin_ExportPart()
@@ -101,7 +101,7 @@ void ExchangePlugin_ExportPart::execute()
   std::list<FeaturePtr> anExternalLinks, anExportedParts, aReferredParts;
   if (!verifyExport(aFeaturesToExport, anExternalLinks, anExportedParts, aReferredParts)) {
     if (!anExternalLinks.empty()) {
-      std::string aListOfFeatures = namesOfFeatures(anExternalLinks);
+      std::wstring aListOfFeatures = namesOfFeatures(anExternalLinks);
 
       std::string aMessage = "The selected results were created using external references "
                              "outside of this Part from features %1. "
@@ -110,7 +110,7 @@ void ExchangePlugin_ExportPart::execute()
       Events_InfoMessage(getKind(), aMessage).arg(aListOfFeatures).send();
     }
     if (!aReferredParts.empty()) {
-      std::string aListOfParts = namesOfFeatures(aReferredParts);
+      std::wstring aListOfParts = namesOfFeatures(aReferredParts);
 
       std::string aMessage = "The selected results were created using references "
                              "to the results of Parts: %1. Please, remove these references "
@@ -118,7 +118,7 @@ void ExchangePlugin_ExportPart::execute()
       Events_InfoMessage(getKind(), aMessage).arg(aListOfParts).send();
     }
     if (!anExportedParts.empty()) {
-      std::string aListOfParts = namesOfFeatures(anExportedParts);
+      std::wstring aListOfParts = namesOfFeatures(anExportedParts);
 
       std::string aMessage = "The export of Part's result is forbidden (%1).";
       Events_InfoMessage(getKind(), aMessage).arg(aListOfParts).send();
@@ -273,9 +273,9 @@ bool verifyExport(const std::list<FeaturePtr>& theFeatures,
   return theExternalReferences.empty() && theExportedParts.empty() && theReferredParts.empty();
 }
 
-std::string namesOfFeatures(const std::list<FeaturePtr>& theFeatures)
+std::wstring namesOfFeatures(const std::list<FeaturePtr>& theFeatures)
 {
-  std::ostringstream aListOfFeatures;
+  std::wostringstream aListOfFeatures;
   for (std::list<FeaturePtr>::const_iterator anIt = theFeatures.begin();
        anIt != theFeatures.end(); ++anIt) {
     if (anIt != theFeatures.begin())
index 0f223698cce621912ada211fbcd24d58064867f6..f6d04041dfafa89f7b09dae8f670d75eca9f8a5e 100644 (file)
@@ -30,9 +30,9 @@
 #include <ModelAPI_Tools.h>
 
 
-static const std::string THE_NEW_PART_STR("New Part");
+static const std::wstring THE_NEW_PART_STR(L"New Part");
 
-DocumentPtr findDocument(DocumentPtr thePartSetDoc, const std::string& thePartName)
+DocumentPtr findDocument(DocumentPtr thePartSetDoc, const std::wstring& thePartName)
 {
   DocumentPtr aDoc;
   FeaturePtr aPartFeature;
@@ -100,7 +100,8 @@ void ExchangePlugin_Import::execute()
   AttributeIntegerPtr aTargetAttr = integer(TARGET_PART_ID());
   SessionPtr aSession = ModelAPI_Session::get();
   DocumentPtr aDoc =
-    findDocument(aSession->moduleDocument(), aPartsAttr->value(aTargetAttr->value()));
+    findDocument(aSession->moduleDocument(),
+      ModelAPI_Tools::toWString(aPartsAttr->value(aTargetAttr->value())));
 
   if (aDoc.get()) {
     FeaturePtr aImportFeature = aDoc->addFeature(ExchangePlugin_ImportFeature::ID());
@@ -127,7 +128,7 @@ void ExchangePlugin_Import::attributeChanged(const std::string& theID)
     DocumentPtr aDoc = document();
     bool isPartSet = aDoc == aSession->moduleDocument();
     if (isPartSet) {
-      std::list<std::string> anAcceptedValues;
+      std::list<std::wstring> anAcceptedValues;
       anAcceptedValues.push_back(THE_NEW_PART_STR);
 
       // append names of all parts
@@ -142,9 +143,9 @@ void ExchangePlugin_Import::attributeChanged(const std::string& theID)
         aTargetAttr->setValue(0);
 
       aPartsAttr->setSize((int)anAcceptedValues.size());
-      std::list<std::string>::iterator anIt = anAcceptedValues.begin();
+      std::list<std::wstring>::iterator anIt = anAcceptedValues.begin();
       for (int anInd = 0; anIt != anAcceptedValues.end(); ++anIt, ++anInd)
-        aPartsAttr->setValue(anInd, *anIt);
+        aPartsAttr->setValue(anInd, ModelAPI_Tools::toString(*anIt));
     }
     else {
       // keep only the name of the current part
@@ -152,7 +153,7 @@ void ExchangePlugin_Import::attributeChanged(const std::string& theID)
         FeaturePtr aPartFeature = ModelAPI_Tools::findPartFeature(aSession->moduleDocument(), aDoc);
 
         aPartsAttr->setSize(1);
-        aPartsAttr->setValue(0, aPartFeature->name());
+        aPartsAttr->setValue(0, ModelAPI_Tools::toString(aPartFeature->name()));
         aTargetAttr->setValue(0);
       }
     }
index e6f2e8f3e28cdebdf29df214eb86a4a729e590b1..b2619119eb90d1715c436dfb58ce5982261135eb 100644 (file)
@@ -49,6 +49,7 @@
 #include <ModelAPI_ResultGroup.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Tools.h>
 
 #include <XAO_Xao.hxx>
 #include <XAO_Group.hxx>
@@ -137,7 +138,7 @@ void ExchangePlugin_ImportFeature::importFile(const std::string& theFileName)
 
   // Pass the results into the model
   std::string anObjectName = GeomAlgoAPI_Tools::File_Tools::name(theFileName);
-  data()->setName(anObjectName);
+  data()->setName(ModelAPI_Tools::toWString(anObjectName));
 
   setResult(createResultBody(aGeomShape));
 }
@@ -161,7 +162,7 @@ void ExchangePlugin_ImportFeature::importXAO(const std::string& theFileName)
   std::string aBodyName = aXaoGeometry->getName();
   if (aBodyName.empty())
     aBodyName = GeomAlgoAPI_Tools::File_Tools::name(theFileName);
-  data()->setName(aBodyName);
+  data()->setName(ModelAPI_Tools::toWString(aBodyName));
 
   ResultBodyPtr aResultBody = createResultBody(aGeomShape);
   setResult(aResultBody);
@@ -187,7 +188,7 @@ void ExchangePlugin_ImportFeature::importXAO(const std::string& theFileName)
 
     // group name
     if (!aXaoGroup->getName().empty())
-      aGroupFeature->data()->setName(aXaoGroup->getName());
+      aGroupFeature->data()->setName(ModelAPI_Tools::toWString(aXaoGroup->getName()));
 
     // fill selection
     AttributeSelectionListPtr aSelectionList = aGroupFeature->selectionList("group_list");
@@ -217,7 +218,7 @@ void ExchangePlugin_ImportFeature::importXAO(const std::string& theFileName)
 
     // group name
     if (!aXaoField->getName().empty())
-      aFieldFeature->data()->setName(aXaoField->getName());
+      aFieldFeature->data()->setName(ModelAPI_Tools::toWString(aXaoField->getName()));
 
     // fill selection
     AttributeSelectionListPtr aSelectionList = aFieldFeature->selectionList("selected");
index 3b9ec7e066c9b53ae3b1326b54fe8f33bd3b5469..2dfedff11beefb7b2954903bf60d5af3fc7a25f8 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <map>
 #include <sstream>
+#include <string>
 
 static const std::string THE_NEW_PART_STR("New Part");
 static const std::string THE_PART_SET_STR("PartSet");
@@ -102,7 +103,7 @@ void ExchangePlugin_ImportPart::attributeChanged(const std::string& theID)
       for (std::list<FeaturePtr>::iterator aFIt = aSubFeatures.begin();
            aFIt != aSubFeatures.end(); ++aFIt) {
         if ((*aFIt)->getKind() == PartSetPlugin_Part::ID())
-          anAcceptedValues.push_back((*aFIt)->name());
+          anAcceptedValues.push_back(ModelAPI_Tools::toString((*aFIt)->name()));
       }
 
       if (aPartsAttr->size() != anAcceptedValues.size())
@@ -119,7 +120,7 @@ void ExchangePlugin_ImportPart::attributeChanged(const std::string& theID)
         FeaturePtr aPartFeature = ModelAPI_Tools::findPartFeature(aSession->moduleDocument(), aDoc);
 
         aPartsAttr->setSize(1);
-        aPartsAttr->setValue(0, aPartFeature->name());
+        aPartsAttr->setValue(0, ModelAPI_Tools::toString(aPartFeature->name()));
         aTargetAttr->setValue(0);
       }
     }
@@ -147,7 +148,8 @@ DocumentPtr findDocument(DocumentPtr thePartSetDoc, const std::string& thePartNa
       std::list<FeaturePtr> aSubFeatures = thePartSetDoc->allFeatures();
       for (std::list<FeaturePtr>::iterator aFIt = aSubFeatures.begin();
            aFIt != aSubFeatures.end(); ++aFIt) {
-        if ((*aFIt)->getKind() == PartSetPlugin_Part::ID() && (*aFIt)->name() == thePartName) {
+        if ((*aFIt)->getKind() == PartSetPlugin_Part::ID() &&
+          ModelAPI_Tools::toString((*aFIt)->name()) == thePartName) {
           aPartFeature = *aFIt;
           break;
         }
@@ -164,16 +166,16 @@ DocumentPtr findDocument(DocumentPtr thePartSetDoc, const std::string& thePartNa
   return aDoc;
 }
 
-typedef std::map<std::string, std::map<std::string, std::set<int> > > ObjectNameMap;
+typedef std::map<std::string, std::map<std::wstring, std::set<int> > > ObjectNameMap;
 
-bool splitName(std::string& theName, int& theIndex)
+bool splitName(std::wstring& theName, int& theIndex)
 {
   size_t aLastUndercore = theName.find_last_of('_');
   bool isOk = aLastUndercore != std::string::npos;
   if (isOk) {
-    char* isNumber;
-    std::string anIndexStr = theName.substr(aLastUndercore + 1);
-    theIndex = std::strtol(anIndexStr.c_str(), &isNumber, 10);
+    size_t isNumber;
+    std::wstring anIndexStr = theName.substr(aLastUndercore + 1);
+    theIndex = std::stol(anIndexStr, &isNumber);
     isOk = isNumber != 0;
     if (isOk)
       theName.erase(aLastUndercore);
@@ -183,7 +185,7 @@ bool splitName(std::string& theName, int& theIndex)
 
 void addIndexedName(const ObjectPtr& theObject, ObjectNameMap& theIndexedNames)
 {
-  std::string aName = theObject->data()->name();
+  std::wstring aName =theObject->data()->name();
   std::string aGroup = theObject->groupName();
   int anIndex = 0;
   bool isIndexed = splitName(aName, anIndex);
@@ -220,9 +222,9 @@ static void collectOldNames(DocumentPtr theDocument, std::list<FeaturePtr>& theA
   }
 }
 
-static std::string uniqueName(const ObjectPtr& theObject, ObjectNameMap& theExistingNames)
+static std::wstring uniqueName(const ObjectPtr& theObject, ObjectNameMap& theExistingNames)
 {
-  std::string aName = theObject->data()->name();
+  std::wstring aName = theObject->data()->name();
   std::string aGroup = theObject->groupName();
   int anIndex = 1;
   splitName(aName, anIndex);
@@ -230,7 +232,7 @@ static std::string uniqueName(const ObjectPtr& theObject, ObjectNameMap& theExis
   ObjectNameMap::iterator aFoundGroup = theExistingNames.find(aGroup);
   bool isUnique = aFoundGroup == theExistingNames.end();
 
-  std::map<std::string, std::set<int> >::iterator aFound;
+  std::map<std::wstring, std::set<int> >::iterator aFound;
   if (!isUnique) {
     aFound = aFoundGroup->second.find(aName);
     isUnique = aFound == aFoundGroup->second.end();
@@ -248,7 +250,7 @@ static std::string uniqueName(const ObjectPtr& theObject, ObjectNameMap& theExis
       if (anIndex != *aFoundIndex)
         break;
     // compose the new name
-    std::ostringstream aNewName;
+    std::wostringstream aNewName;
     aNewName << aName << "_" << anIndex;
     aName = aNewName.str();
     // add new index
@@ -266,7 +268,7 @@ void correntNonUniqueNames(DocumentPtr theDocument, std::list<FeaturePtr>& theIm
   for (std::list<FeaturePtr>::iterator anIt = theImported.begin();
        anIt != theImported.end(); ++anIt) {
     // update name of feature
-    std::string aNewName = uniqueName(*anIt, aNames);
+    std::wstring aNewName = uniqueName(*anIt, aNames);
     (*anIt)->data()->setName(aNewName);
     // update names of results
     const std::list<ResultPtr>& aResults = (*anIt)->results();
index 76db7fa04f869ea0bb10043372302b2b92a11fe0..7f480891b5ce46efadd4bd483ae786a5d4d1d83f 100644 (file)
@@ -59,7 +59,7 @@ void FeaturesPlugin_Copy::execute()
   int aCopiesNum = integer(NUMBER())->value();
   AttributeSelectionListPtr aList = selectionList(OBJECTS());
   int aResultIndex = 0;
-  std::set<std::string> anExistingNames; // to avoid names duplication
+  std::set<std::wstring> anExistingNames; // to avoid names duplication
   for(int aCopy = 0; aCopy < aCopiesNum; aCopy++) {
     for (int aSelIndex = 0; aSelIndex < aList->size(); aSelIndex++) {
       AttributeSelectionPtr aSel = aList->value(aSelIndex);
@@ -74,13 +74,13 @@ void FeaturesPlugin_Copy::execute()
       }
       GeomShapePtr aResult = aCopyBuilder->shape();
 
-      std::string aBaseName = aSel->context() ? aSel->context()->data()->name() :
+      std::wstring aBaseName = aSel->context() ? aSel->context()->data()->name() :
         aSel->contextFeature()->firstResult()->data()->name();
-      std::string aName;
+      std::wstring aName;
       int anInd = 0;
       do {
         anInd++;
-        std::ostringstream aNameStr;
+        std::wostringstream aNameStr;
         aNameStr << aBaseName << "_" << (aCopy + anInd);
         aName = aNameStr.str();
       } while (anExistingNames.count(aName));
@@ -90,7 +90,7 @@ void FeaturesPlugin_Copy::execute()
         document()->createBody(data(), aResultIndex);
       aResultBody->data()->setName(aName);
       // to make sub-results also names with a similar name temporarily rename the feature
-      std::string anOrigName = name();
+      std::wstring anOrigName = name();
       data()->setName(aBaseName);
       aResultBody->store(aResult);
       data()->setName(anOrigName);
index 5920c21a7f720cdb6d1edc9f76631bc392619264..462a2c3d80ae51b3ee130d102ff5db5845e35025 100644 (file)
@@ -71,7 +71,7 @@ void InitializationPlugin_Plugin::processEvent(const std::shared_ptr<Events_Mess
         new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED)));
     Events_Loop::loop()->send(aMsg);
 
-    FeaturePtr aOrigin = createPoint(aDoc, "Origin", 0., 0., 0.);
+    FeaturePtr aOrigin = createPoint(aDoc, L"Origin", 0., 0., 0.);
     aFeatures.push_back(aOrigin);
     aFeatures.push_back(createAxis(aDoc, aOrigin, 100., 0., 0.));
     aFeatures.push_back(createAxis(aDoc, aOrigin, 0., 100., 0.));
@@ -114,11 +114,11 @@ FeaturePtr InitializationPlugin_Plugin::createPlane(DocumentPtr theDoc, double t
   aPlane->real("D")->setValue(0.);
 
   if (theX) {
-    aPlane->data()->setName("YOZ");
+    aPlane->data()->setName(L"YOZ");
   } else if (theY) {
-    aPlane->data()->setName("XOZ");
+    aPlane->data()->setName(L"XOZ");
   } else if (theZ) {
-    aPlane->data()->setName("XOY");
+    aPlane->data()->setName(L"XOY");
   }
     // don't show automatically created feature in the features history
   aPlane->setInHistory(aPlane, false);
@@ -134,7 +134,7 @@ FeaturePtr InitializationPlugin_Plugin::createPlane(DocumentPtr theDoc, double t
   return aPlane;
 }
 
-FeaturePtr InitializationPlugin_Plugin::createPoint(DocumentPtr theDoc, const std::string& theName,
+FeaturePtr InitializationPlugin_Plugin::createPoint(DocumentPtr theDoc, const std::wstring& theName,
                                                     double theX, double theY, double theZ)
 {
   std::shared_ptr<ModelAPI_Feature> aPoint = theDoc->addFeature("Point");
@@ -169,11 +169,11 @@ FeaturePtr InitializationPlugin_Plugin::createAxis(DocumentPtr theDoc, FeaturePt
   aAxis->real("Z_Direction")->setValue(theZ);
 
   if (theX != 0) {
-    aAxis->data()->setName("OX");
+    aAxis->data()->setName(L"OX");
   } else if (theY != 0) {
-    aAxis->data()->setName("OY");
+    aAxis->data()->setName(L"OY");
   } else if (theZ != 0) {
-    aAxis->data()->setName("OZ");
+    aAxis->data()->setName(L"OZ");
   }
    // don't show automatically created feature in the features history
   aAxis->setInHistory(aAxis, false);
index dca223f04bcfe065cca002e18158592dc99e544b..b70ff75af7b8bd9b79d71c8eccea699e9b1d8513 100644 (file)
@@ -58,7 +58,7 @@ class InitializationPlugin_Plugin : public Events_Listener
   /// \param theX - X coordinate
   /// \param theY - Y coordinate
   /// \param theZ - Z coordinate
-  FeaturePtr createPoint(DocumentPtr theDoc, const std::string& theName,
+  FeaturePtr createPoint(DocumentPtr theDoc, const std::wstring& theName,
                          double theX, double theY, double theZ);
 
   /// Creates an axis which is started from origin point
index c2772757f8dd2bcc3f2c55e942c561c504ad7b83..36634ff15c608251553bed5be3e7d4a31ed42f0c 100644 (file)
@@ -21,6 +21,7 @@
 #include <Model_Document.h>
 
 #include <ModelAPI_Events.h>
+#include <ModelAPI_Tools.h>
 
 #include <BinDrivers_DocumentRetrievalDriver.hxx>
 #include <BinDrivers_DocumentStorageDriver.hxx>
@@ -61,7 +62,7 @@ void Model_Application::createDocument(const int theDocID)
 }
 
 //=======================================================================
-bool Model_Application::loadDocument(const std::string theDocName, const int theDocID)
+bool Model_Application::loadDocument(const std::wstring theDocName, const int theDocID)
 {
   static const std::string thePartKind("Part"); // root document is never loaded here
   std::shared_ptr<Model_Document> aNew(new Model_Document(theDocID, thePartKind));
@@ -70,7 +71,7 @@ bool Model_Application::loadDocument(const std::string theDocName, const int the
   bool aRes = true;
   // load it if it must be loaded by demand
   if (myLoadedByDemand.find(theDocName) != myLoadedByDemand.end() && !myPath.empty()) {
-    aRes = aNew->load(myPath.c_str(), theDocName.c_str(), aNew);
+    aRes = aNew->load(myPath.c_str(), ModelAPI_Tools::toString(theDocName).c_str(), aNew);
     myLoadedByDemand.erase(theDocName);  // done, don't do it anymore
   } else { // error
     aRes = false;
@@ -132,13 +133,13 @@ const std::string& Model_Application::loadPath() const
 }
 
 //=======================================================================
-void Model_Application::setLoadByDemand(std::string theID, const int theDocID)
+void Model_Application::setLoadByDemand(std::wstring theID, const int theDocID)
 {
   myLoadedByDemand[theID] = theDocID;
 }
 
 //=======================================================================
-bool Model_Application::isLoadByDemand(std::string theID, const int theDocIndex)
+bool Model_Application::isLoadByDemand(std::wstring theID, const int theDocIndex)
 {
   return myLoadedByDemand.find(theID) != myLoadedByDemand.end() &&
     myLoadedByDemand[theID] == theDocIndex;
@@ -152,7 +153,7 @@ int Model_Application::generateDocumentId()
   for(aResult = int(myDocs.size()); true; aResult++) {
     if (myDocs.find(aResult) == myDocs.end()) {
       bool aFound = false;
-      std::map<std::string, int>::iterator aLBDIter = myLoadedByDemand.begin();
+      std::map<std::wstring, int>::iterator aLBDIter = myLoadedByDemand.begin();
       for(; aLBDIter != myLoadedByDemand.end(); aLBDIter++) {
         if (aLBDIter->second == aResult) {
           aFound = true;
index e0fb01c1a2b7798d95a2885961b96be24483abc6..4630c73595cce065bdc320f6d3e65f3fcac5c259 100644 (file)
@@ -66,16 +66,16 @@ public:
   //! \param theDocName name of the document file
   //! \param theDocID the identifier of the loaded document (to be created)
   //! \returns true if load is ok
-  MODEL_EXPORT bool loadDocument(const std::string theDocName, const int theDocID);
+  MODEL_EXPORT bool loadDocument(const std::wstring theDocName, const int theDocID);
 
   //! Set path for the loaded by demand documents
   void setLoadPath(std::string thePath);
   //! Returns the path for the loaded by demand documents
   const std::string& loadPath() const;
   //! Defines that specified document must be loaded by demand
-  void setLoadByDemand(std::string theID, const int theDocID);
+  void setLoadByDemand(std::wstring theID, const int theDocID);
   //! Returns true if specified document must be loaded by demand
-  bool isLoadByDemand(std::string theID, const int theDocIndex);
+  bool isLoadByDemand(std::wstring theID, const int theDocIndex);
 
   //! produces new unique identifier of the document
   int generateDocumentId();
@@ -98,7 +98,7 @@ public:
   /// Path for the loaded by demand documents
   std::string myPath;
   /// Path for the loaded by demand documents (and the persistent ID as the value)
-  std::map<std::string, int> myLoadedByDemand;
+  std::map<std::wstring, int> myLoadedByDemand;
 };
 
 #endif
index 5c85b0237b5f44592c577b59afa127a7d3a5fbb7..88912aaca7d089761b674a01e9704a513f9a4c57 100644 (file)
@@ -94,7 +94,7 @@ Standard_GUID kELLIPSE_CENTER1("f70df04c-3168-4dc9-87a4-f1f840c1275d");
 Standard_GUID kELLIPSE_CENTER2("1395ae73-8e02-4cf8-b204-06ff35873a32");
 
 // prefix for the whole feature context identification
-const static std::string kWHOLE_FEATURE = "all-in-";
+const static std::wstring kWHOLE_FEATURE = L"all-in-";
 
 // on this label is stored:
 // TNaming_NamedShape - selected shape
@@ -368,7 +368,7 @@ std::shared_ptr<GeomAPI_Shape> Model_AttributeSelection::internalValue(CenterTyp
               std::string aNameInPart = aSubShapeName.substr(aPartEnd + 1);
               int anIndex;
               std::string aType; // to reuse already existing selection the type is not needed
-              return aPart->shapeInPart(aNameInPart, aType, anIndex);
+              return aPart->shapeInPart(ModelAPI_Tools::toWString(aNameInPart), aType, anIndex);
             }
           }
         }
@@ -715,13 +715,13 @@ bool Model_AttributeSelection::selectPart(
   }
   // store the shape (in case part is not loaded it should be useful
   TopoDS_Shape aShape;
-  std::string aName = theContext->data()->name();
+  std::wstring aName = theContext->data()->name();
   if (!theSubShape.get() || theSubShape->isNull()) {// the whole part shape is selected
     aShape = theContext->shape()->impl<TopoDS_Shape>();
   } else {
     aShape = theSubShape->impl<TopoDS_Shape>();
     int anIndex;
-    aName += "/" + aPart->nameInPart(theSubShape, anIndex);
+    aName += L"/" + aPart->nameInPart(theSubShape, anIndex);
     TDataStd_Integer::Set(selectionLabel(), anIndex);
   }
   TNaming_Builder aBuilder(selectionLabel());
@@ -737,22 +737,22 @@ TDF_Label Model_AttributeSelection::selectionLabel()
 }
 
 /// prefixes of the shape names with centers defined
-static std::map<ModelAPI_AttributeSelection::CenterType, std::string> kCENTERS_PREFIX;
+static std::map<ModelAPI_AttributeSelection::CenterType, std::wstring> kCENTERS_PREFIX;
 
 /// returns the map that contains all possible prefixes of the center-names
-static std::map<ModelAPI_AttributeSelection::CenterType, std::string>& centersMap()
+static std::map<ModelAPI_AttributeSelection::CenterType, std::wstring>& centersMap()
 {
   if (kCENTERS_PREFIX.empty()) { // fill map by initial values
-    kCENTERS_PREFIX[ModelAPI_AttributeSelection::CIRCLE_CENTER] = "__cc";
-    kCENTERS_PREFIX[ModelAPI_AttributeSelection::ELLIPSE_FIRST_FOCUS] = "__eff";
-    kCENTERS_PREFIX[ModelAPI_AttributeSelection::ELLIPSE_SECOND_FOCUS] = "__esf";
+    kCENTERS_PREFIX[ModelAPI_AttributeSelection::CIRCLE_CENTER] = L"__cc";
+    kCENTERS_PREFIX[ModelAPI_AttributeSelection::ELLIPSE_FIRST_FOCUS] = L"__eff";
+    kCENTERS_PREFIX[ModelAPI_AttributeSelection::ELLIPSE_SECOND_FOCUS] = L"__esf";
   }
   return kCENTERS_PREFIX;
 }
 
-std::string Model_AttributeSelection::namingName(const std::string& theDefaultName)
+std::wstring Model_AttributeSelection::namingName(const std::wstring& theDefaultName)
 {
-  std::string aName("");
+  std::wstring aName(L"");
   if(!this->isInitialized())
     return !theDefaultName.empty() ? theDefaultName : aName;
 
@@ -761,12 +761,13 @@ std::string Model_AttributeSelection::namingName(const std::string& theDefaultNa
     GeomShapePtr aShape = value();
     if (!aShape.get() && context().get())
       aShape = context()->shape();
-    std::string aName;
+    std::wstring aName;
     if (aShape.get()) {
-      aName = aShape->shapeTypeStr();
+      aName = ModelAPI_Tools::toWString(aShape->shapeTypeStr());
       if (myParent) {
-        aName += std::string("_") +
-          TCollection_AsciiString(selectionLabel().Father().Tag()).ToCString();
+        std::wostringstream aStream;
+        aStream << "_" << selectionLabel().Father().Tag();
+        aName += aStream.str();
       }
     }
     return aName;
@@ -777,21 +778,21 @@ std::string Model_AttributeSelection::namingName(const std::string& theDefaultNa
 
   FeaturePtr aContFeature = contextFeature();
   if (aContFeature.get()) {
-    std::string aResName;
+    std::wstring aResName;
     // checking part-owner
     if (aContFeature->document() != owner()->document())
-        aResName += aContFeature->document()->kind() + "/";
+        aResName += ModelAPI_Tools::toWString(aContFeature->document()->kind()) + L"/";
     // selection of a full feature
     if (aContFeature.get()) {
       return aResName + kWHOLE_FEATURE + aContFeature->name();
     }
     // in case of selection of removed result
-    return "";
+    return L"";
   }
 
   ResultPtr aCont = context();
   if (!aCont.get()) {
-    return ""; // invalid case
+    return L""; // invalid case
   }
   TDF_Label aSelLab = selectionLabel();
   if (aSelLab.IsAttribute(kSIMPLE_REF_ID)) { // whole context, no value
@@ -802,8 +803,9 @@ std::string Model_AttributeSelection::namingName(const std::string& theDefaultNa
   if (aCont->groupName() == ModelAPI_ResultPart::group()) {
     ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aCont);
     int anIndex;
-    std::string aResult = aSubSh.get() ?
-      aPart->data()->name() + "/" + aPart->nameInPart(aSubSh, anIndex) : aPart->data()->name();
+    std::wstring aResult = aSubSh.get() ?
+      aPart->data()->name() + L"/" + aPart->nameInPart(aSubSh, anIndex)
+      : aPart->data()->name();
     if (aCenterType != NOT_CENTER)
       aResult += centersMap()[aCenterType];
     return aResult;
@@ -818,7 +820,7 @@ std::string Model_AttributeSelection::namingName(const std::string& theDefaultNa
   }
 
   Selector_Selector aSelector(aSelLab, baseDocumentLab());
-  std::string aResult;
+  std::wstring aResult;
   if (aCont->shape().get() && aSelector.restore(aCont->shape()->impl<TopoDS_Shape>()))
     aResult = aSelector.name(this);
   if (aCenterType != NOT_CENTER) {
@@ -828,9 +830,9 @@ std::string Model_AttributeSelection::namingName(const std::string& theDefaultNa
 }
 
 // returns the center type and modifies the shape name if this name is center-name
-static ModelAPI_AttributeSelection::CenterType centerTypeByName(std::string& theShapeName)
+static ModelAPI_AttributeSelection::CenterType centerTypeByName(std::wstring& theShapeName)
 {
-  std::map<ModelAPI_AttributeSelection::CenterType, std::string>::iterator aPrefixIter =
+  std::map<ModelAPI_AttributeSelection::CenterType, std::wstring>::iterator aPrefixIter =
     centersMap().begin();
   for(; aPrefixIter != centersMap().end(); aPrefixIter++) {
     std::size_t aFound = theShapeName.find(aPrefixIter->second);
@@ -845,11 +847,11 @@ static ModelAPI_AttributeSelection::CenterType centerTypeByName(std::string& the
 
 // type ::= COMP | COMS | SOLD | SHEL | FACE | WIRE | EDGE | VERT
 void Model_AttributeSelection::selectSubShape(
-  const std::string& theType, const std::string& theSubShapeName)
+  const std::string& theType, const std::wstring& theSubShapeName)
 {
   if(theSubShapeName.empty() || theType.empty()) return;
 
-  std::string aSubShapeName = theSubShapeName;
+  std::wstring aSubShapeName = theSubShapeName;
   CenterType aCenterType = theType[0] == 'v' || theType[0] == 'V' ? // only for vertex-type
     centerTypeByName(aSubShapeName) : NOT_CENTER;
   std::string aType = aCenterType == NOT_CENTER ? theType : "EDGE"; // search for edge now
@@ -870,9 +872,9 @@ void Model_AttributeSelection::selectSubShape(
     // check this is Part-name: 2 delimiters in the name
     std::size_t aPartEnd = aSubShapeName.find('/');
     if (aPartEnd != std::string::npos) {
-      std::string aPartName = aSubShapeName.substr(0, aPartEnd);
+      std::wstring aPartName = aSubShapeName.substr(0, aPartEnd);
       DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-      if (aPartName == aRootDoc->kind()) {
+      if (aPartName == ModelAPI_Tools::toWString(aRootDoc->kind())) {
         aDoc = std::dynamic_pointer_cast<Model_Document>(aRootDoc);
         aSubShapeName = aSubShapeName.substr(aPartEnd + 1);
       }
@@ -881,7 +883,7 @@ void Model_AttributeSelection::selectSubShape(
           owner()->document()->objectByName(ModelAPI_ResultPart::group(), aPartName);
         if (aFound.get()) { // found such part, so asking it for the name
           ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aFound);
-          std::string aNameInPart = aSubShapeName.substr(aPartEnd + 1);
+          std::wstring aNameInPart = aSubShapeName.substr(aPartEnd + 1);
           if (aNameInPart.empty()) { // whole part
             setValue(aPart, anEmptyShape);
             return;
@@ -924,7 +926,7 @@ void Model_AttributeSelection::selectSubShape(
     // check this is a whole feature context
     if (aSubShapeName.size() > kWHOLE_FEATURE.size() &&
       aSubShapeName.substr(0, kWHOLE_FEATURE.size()) == kWHOLE_FEATURE) {
-      std::string aFeatureName = aSubShapeName.substr(kWHOLE_FEATURE.size());
+      std::wstring aFeatureName = aSubShapeName.substr(kWHOLE_FEATURE.size());
       ObjectPtr anObj = aDoc->objectByName(ModelAPI_Feature::group(), aFeatureName);
       if (anObj.get()) {
         setValue(anObj, anEmptyShape);
@@ -1075,7 +1077,7 @@ void Model_AttributeSelection::selectSubShape(const std::string& theType,
 }
 
 void Model_AttributeSelection::selectSubShape(const std::string& theType,
-  const std::string& theContextName, const int theIndex)
+  const std::wstring& theContextName, const int theIndex)
 {
   // selection of context by name
   selectSubShape(theType, theContextName);
@@ -1128,17 +1130,17 @@ void Model_AttributeSelection::setId(int theID)
   setValue(aContextRes, aSelection);
 }
 
-std::string Model_AttributeSelection::contextName(const ResultPtr& theContext) const
+std::wstring Model_AttributeSelection::contextName(const ResultPtr& theContext) const
 {
-  std::string aResult;
+  std::wstring aResult;
   if (owner()->document() != theContext->document()) {
     if (theContext->document() == ModelAPI_Session::get()->moduleDocument()) {
-      aResult = theContext->document()->kind() + "/";
+      aResult = ModelAPI_Tools::toWString(theContext->document()->kind()) + L"/";
     } else {
       ResultPtr aDocRes = ModelAPI_Tools::findPartResult(
         ModelAPI_Session::get()->moduleDocument(), theContext->document());
       if (aDocRes.get()) {
-        aResult = aDocRes->data()->name() + "/";
+        aResult = aDocRes->data()->name() + L"/";
       }
     }
   }
@@ -1843,7 +1845,7 @@ void Model_AttributeSelection::setParent(Model_AttributeSelectionList* theParent
   myParent = theParent;
 }
 
-std::string Model_AttributeSelection::contextName(const TDF_Label theSelectionLab)
+std::wstring Model_AttributeSelection::contextName(const TDF_Label theSelectionLab)
 {
   std::shared_ptr<Model_Document> aDoc = myRestoreDocument.get() ? myRestoreDocument :
     std::dynamic_pointer_cast<Model_Document>(owner()->document());
@@ -1868,7 +1870,7 @@ std::string Model_AttributeSelection::contextName(const TDF_Label theSelectionLa
     }
     if (aResult.get()) {
       // this is to avoid duplicated names of results problem
-      std::string aContextName = aResult->data()->name();
+      std::wstring aContextName = aResult->data()->name();
       // myLab corresponds to the current time
       TDF_Label aCurrentLab = selectionLabel();
       while(aCurrentLab.Depth() > 3)
@@ -1877,29 +1879,29 @@ std::string Model_AttributeSelection::contextName(const TDF_Label theSelectionLa
       int aNumInHistoryNames =
         aDoc->numberOfNameInHistory(aResult, aCurrentLab);
       while(aNumInHistoryNames > 1) { // add "_" before name the needed number of times
-        aContextName = "_" + aContextName;
+        aContextName = L"_" + aContextName;
         aNumInHistoryNames--;
       }
       if (aBaseDocumnetUsed)
-        aContextName = aDoc->kind() + "/" + aContextName;
+        aContextName = ModelAPI_Tools::toWString(aDoc->kind()) + L"/" + aContextName;
       return aContextName;
     }
   }
-  return ""; // invalid case
+  return L""; // invalid case
 }
 
 /// This method restores by the context and value name the context label and
 /// sub-label where the value is. Returns true if it is valid.
-bool Model_AttributeSelection::restoreContext(std::string theName,
+bool Model_AttributeSelection::restoreContext(std::wstring theName,
   TDF_Label& theContext, TDF_Label& theValue)
 {
   static const GeomShapePtr anEmptyShape; // to store context only
-  std::string aName = theName;
+  std::wstring aName = theName;
   std::shared_ptr<Model_Document> aDoc = myRestoreDocument.get() ? myRestoreDocument :
     std::dynamic_pointer_cast<Model_Document>(owner()->document());
 
   // remove the sub-value part if exists
-  std::string aSubShapeName = aName;
+  std::wstring aSubShapeName = aName;
   std::string::size_type n = aName.find('/');
   if (n != std::string::npos) {
     aName = aName.substr(0, n);
@@ -1912,7 +1914,7 @@ bool Model_AttributeSelection::restoreContext(std::string theName,
     // name in PartSet?
     aDoc = std::dynamic_pointer_cast<Model_Document>(
       ModelAPI_Session::get()->moduleDocument());
-    if (theName.find(aDoc->kind()) == 0) { // remove the document identifier from name if exists
+    if (theName.find(ModelAPI_Tools::toWString(aDoc->kind())) == 0) { // remove the document identifier from name if exists
       aSubShapeName = theName.substr(aDoc->kind().size() + 1);
       aName = aSubShapeName;
       std::string::size_type n = aName.find('/');
@@ -1933,7 +1935,7 @@ bool Model_AttributeSelection::restoreContext(std::string theName,
   if (theValue.IsNull() && aCont->groupName() == ModelAPI_ResultConstruction::group()) {
     std::string::size_type aSlash = aSubShapeName.rfind('/');
     if (aSlash != std::string::npos) {
-      std::string aCompName = aSubShapeName.substr(aSlash + 1);
+      std::wstring aCompName = aSubShapeName.substr(aSlash + 1);
       CompositeFeaturePtr aComposite =
         std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aDoc->feature(aCont));
       if (aComposite.get() && aComposite->numberOfSubs()) {
@@ -2116,7 +2118,7 @@ void Model_AttributeSelection::combineGeometrical()
     Handle(TDataStd_Integer) anIndex;
     if (aSelLab.FindAttribute(TDataStd_Integer::GetID(), anIndex)) {
       if (anIndex->Get()) { // special selection attribute was created, use it
-        std::string aNewName;
+        std::wstring aNewName;
         aPart->combineGeometrical(anIndex->Get(), aNewName);
         TDataStd_Name::Set(aSelLab, aNewName.c_str());
       }
index 8e70cb28b3f595ea9c10f01c6b2fed92dc9fc296..3b718a223b5b72ecef20e791dc9a3f0accdc7e4c 100644 (file)
@@ -97,21 +97,21 @@ public:
 
   /// Returns a textual string of the selection
   /// \param theDefaultValue a name, which is returned if the naming name can not be obtained
-  MODEL_EXPORT virtual std::string namingName(const std::string& theDefaultValue = "");
+  MODEL_EXPORT virtual std::wstring namingName(const std::wstring& theDefaultValue = L"");
 
   /// Defines the sub-shape by Id
   MODEL_EXPORT virtual void setId(int theID);
 
   /// Selects (i.e. creates Naming data structure) of sub-shape specified by textual name
   MODEL_EXPORT virtual void selectSubShape(const std::string& theType,
-                                           const std::string& theSubShapeName);
+                                           const std::wstring& theSubShapeName);
 
   /// Selects sub-shape by its inner point
   MODEL_EXPORT virtual void selectSubShape(const std::string& theType,
                                            const std::shared_ptr<GeomAPI_Pnt>& thePoint);
   /// Selects sub-shape by weak naming index
   MODEL_EXPORT virtual void selectSubShape(const std::string& theType,
-    const std::string& theContextName, const int theIndex);
+    const std::wstring& theContextName, const int theIndex);
 
   /// Returns true if attribute was  initialized by some value
   MODEL_EXPORT virtual bool isInitialized();
@@ -126,11 +126,11 @@ public:
 
   // Implementation of the name generator method from the Selector package
   // This method returns the context name by the label of the sub-selected shape
-  MODEL_EXPORT virtual std::string contextName(const TDF_Label theSelectionLab) override;
+  MODEL_EXPORT virtual std::wstring contextName(const TDF_Label theSelectionLab) override;
 
   /// This method restores by the context and value name the context label and
   /// sub-label where the value is. Returns true if it is valid.
-  MODEL_EXPORT virtual bool restoreContext(std::string theName,
+  MODEL_EXPORT virtual bool restoreContext(std::wstring theName,
     TDF_Label& theContext, TDF_Label& theValue) override;
 
   /// Returns true if the first result is newer than the second one in the tree of features
@@ -138,7 +138,7 @@ public:
     const override;
 
   /// Returns the name by context. Adds the part name if the context is located in other document
-  MODEL_EXPORT virtual std::string contextName(const ResultPtr& theContext) const;
+  MODEL_EXPORT virtual std::wstring contextName(const ResultPtr& theContext) const;
 
   /// Makes the current local selection becomes all sub-shapes with same base geometry.
   MODEL_EXPORT virtual void combineGeometrical();
index 95a17e9d2e4713dd25844253413fb61bde52c353..6de1b23561834b15cef1916061686f32498c12c2 100644 (file)
@@ -88,7 +88,7 @@ void Model_AttributeSelectionList::append(
 }
 
 void Model_AttributeSelectionList::append(
-  const std::string& theNamingName, const std::string& theType)
+  const std::wstring& theNamingName, const std::string& theType)
 {
   int aNewTag = mySize->Get() + 1;
   TDF_Label aNewLab = mySize->Label().FindChild(aNewTag);
@@ -123,7 +123,7 @@ void Model_AttributeSelectionList::append(const GeomPointPtr& thePoint, const st
 }
 
 void Model_AttributeSelectionList::append(const std::string& theType,
-  const std::string& theContextName, const int theIndex)
+  const std::wstring& theContextName, const int theIndex)
 {
   int aNewTag = mySize->Get() + 1;
   TDF_Label aNewLab = mySize->Label().FindChild(aNewTag);
index 2db50d9b400f5b49254550a7493886c7bcbd24ec..ea93c155cd4a75a427e06b97847dbcc3c0d865a6 100644 (file)
@@ -56,14 +56,14 @@ public:
 
   /// Adds the new reference to the end of the list by the naming name of the selected shape
   /// The type of shape is taken from the current selection type if the given is empty
-  MODEL_EXPORT virtual void append(const std::string& theNamingName, const std::string& theType="");
+  MODEL_EXPORT virtual void append(const std::wstring& theNamingName, const std::string& theType="");
 
   /// Adds the new reference to the end of the list by inner point on the selected shape
   MODEL_EXPORT virtual void append(const std::shared_ptr<GeomAPI_Pnt>& thePoint,
                                    const std::string& theType);
 
   /// Adds the new reference to the end of the list by weak naming index
-  MODEL_EXPORT virtual void append(const std::string& theType, const std::string& theContextName,
+  MODEL_EXPORT virtual void append(const std::string& theType, const std::wstring& theContextName,
                                    const int theIndex);
 
   /// Copy the selection list to the destination attribute
index 9aa0b983b5eeeb65724304e0f06a86701a8ee4c5..fa9fc4468c09ec3a0b9e2fca84eec806689e9e24 100644 (file)
@@ -202,7 +202,7 @@ void Model_BodyBuilder::store(const GeomShapePtr& theShape,
     if(!aBuilder.NamedShape()->IsEmpty()) {
       Handle(TDataStd_Name) anAttr;
       if(aBuilder.NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) {
-        std::string aName (TCollection_AsciiString(anAttr->Get()).ToCString());
+        std::wstring aName ((wchar_t*)anAttr->Get().ToExtString());
         if(!aName.empty()) {
           std::shared_ptr<Model_Document> aDoc =
             std::dynamic_pointer_cast<Model_Document>(document());
@@ -255,7 +255,7 @@ void Model_BodyBuilder::storeGenerated(const GeomShapePtr& theFromShape,
     if(!aBuilder->NamedShape()->IsEmpty()) {
       Handle(TDataStd_Name) anAttr;
       if(aBuilder->NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) {
-        std::string aName (TCollection_AsciiString(anAttr->Get()).ToCString());
+        std::wstring aName((wchar_t*)anAttr->Get().ToExtString());
         if(!aName.empty()) {
           std::shared_ptr<Model_Document> aDoc =
             std::dynamic_pointer_cast<Model_Document>(document());
@@ -347,7 +347,7 @@ void Model_BodyBuilder::storeModified(const GeomShapePtr& theOldShape,
     if(!aBuilder->NamedShape()->IsEmpty()) {
       Handle(TDataStd_Name) anAttr;
       if(aBuilder->NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(), anAttr)) {
-        std::string aName (TCollection_AsciiString(anAttr->Get()).ToCString());
+        std::wstring aName ((wchar_t*)anAttr->Get().ToExtString());
         if(!aName.empty()) {
           std::shared_ptr<Model_Document> aDoc =
             std::dynamic_pointer_cast<Model_Document>(document());
index 41f9980b3d60ed0ea435515b477b236452023090..dea65b8a5295184cfdb70dbd7be41e206feea005 100644 (file)
@@ -106,22 +106,23 @@ void Model_Data::setLabel(TDF_Label theLab)
   }
 }
 
-std::string Model_Data::name()
+std::wstring Model_Data::name()
 {
   Handle(TDataStd_Name) aName;
   if (shapeLab().FindAttribute(TDataStd_Name::GetID(), aName)) {
 #ifdef DEBUG_NAMES
     myObject->myName = TCollection_AsciiString(aName->Get()).ToCString();
 #endif
-    return std::string(TCollection_AsciiString(aName->Get()).ToCString());
+    return std::wstring((wchar_t*)aName->Get().ToExtString());
+    //return std::wstring(TCollection_AsciiString(aName->Get()).ToCString());
   }
-  return "";  // not defined
+  return L"";  // not defined
 }
 
-void Model_Data::setName(const std::string& theName)
+void Model_Data::setName(const std::wstring& theName)
 {
   bool isModified = false;
-  std::string anOldName = name();
+  std::wstring anOldName = name();
   Handle(TDataStd_Name) aName;
   if (!shapeLab().FindAttribute(TDataStd_Name::GetID(), aName)) {
     TDataStd_Name::Set(shapeLab(), theName.c_str());
@@ -136,7 +137,7 @@ void Model_Data::setName(const std::string& theName)
       bool isUserDefined = true;
       ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(myObject);
       if (aResult) {
-        std::string aDefaultName = ModelAPI_Tools::getDefaultName(aResult, false).first;
+        std::wstring aDefaultName = ModelAPI_Tools::getDefaultName(aResult, false).first;
         isUserDefined = aDefaultName != theName;
       }
       if (isUserDefined) {
index fa833bdd32cd5a196db37dfad015c76aa49dfb3b..17e8feb747ff1f0553776bd17be82a43fbe4b573 100644 (file)
@@ -102,9 +102,9 @@ class Model_Data : public ModelAPI_Data
   /// The simplest constructor. "setLabel" must be called just after to initialize correctly.
   Model_Data();
   /// Returns the name of the feature visible by the user in the object browser
-  MODEL_EXPORT virtual std::string name();
+  MODEL_EXPORT virtual std::wstring name();
   /// Defines the name of the feature visible by the user in the object browser
-  MODEL_EXPORT virtual void setName(const std::string& theName);
+  MODEL_EXPORT virtual void setName(const std::wstring& theName);
   /// Return \c true if the object has been renamed by the user
   MODEL_EXPORT virtual bool hasUserDefinedName() const;
   /// Returns version of the feature (empty string if not applicable)
index 87e7e2f9692639e222f93e110ad2e0e129dfc37c..a1babc01586062a6454655efbc7a6831b47b0c53 100644 (file)
@@ -522,7 +522,7 @@ bool Model_Document::save(
       ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aPartRes);
       if (!aPart->isActivated()) {
         // copy not-activated document that is not in the memory
-        std::string aDocName = aPart->data()->name();
+        std::string aDocName = ModelAPI_Tools::toString(aPart->data()->name());
         if (!aDocName.empty()) {
           // just copy file
           TCollection_AsciiString aSubPath(DocFileName(anApp->loadPath().c_str(), aDocName));
@@ -539,8 +539,9 @@ bool Model_Document::save(
           }
         }
       } else { // simply save opened document
+        std::string aDocName = ModelAPI_Tools::toString(aPart->data()->name());
         isDone = std::dynamic_pointer_cast<Model_Document>(aPart->partDoc())->
-          save(theDirName, aPart->data()->name().c_str(), theResults);
+          save(theDirName, aDocName.c_str(), theResults);
       }
     }
   }
@@ -1327,7 +1328,7 @@ ObjectPtr Model_Document::object(const std::string& theGroupID,
 }
 
 std::shared_ptr<ModelAPI_Object> Model_Document::objectByName(
-    const std::string& theGroupID, const std::string& theName)
+    const std::string& theGroupID, const std::wstring& theName)
 {
   return myObjs->objectByName(theGroupID, theName);
 }
@@ -1652,9 +1653,9 @@ ResultPtr Model_Document::resultByLab(const TDF_Label& theLab)
   return ResultPtr(); // not found
 }
 
-void Model_Document::addNamingName(const TDF_Label theLabel, std::string theName)
+void Model_Document::addNamingName(const TDF_Label theLabel, std::wstring theName)
 {
-  std::map<std::string, std::list<TDF_Label> >::iterator aFind = myNamingNames.find(theName);
+  std::map<std::wstring, std::list<TDF_Label> >::iterator aFind = myNamingNames.find(theName);
 
   if (aFind != myNamingNames.end()) { // to avoid duplicate-labels
     // to keep correct order in spite of history line management
@@ -1686,11 +1687,11 @@ void Model_Document::addNamingName(const TDF_Label theLabel, std::string theName
   myNamingNames[theName].push_back(theLabel);
 }
 
-void Model_Document::changeNamingName(const std::string theOldName,
-                                      const std::string theNewName,
+void Model_Document::changeNamingName(const std::wstring theOldName,
+                                      const std::wstring theNewName,
                                       const TDF_Label& theLabel)
 {
-  std::map<std::string, std::list<TDF_Label> >::iterator aFind = myNamingNames.find(theOldName);
+  std::map<std::wstring, std::list<TDF_Label> >::iterator aFind = myNamingNames.find(theOldName);
   if (aFind != myNamingNames.end()) {
     std::list<TDF_Label>::iterator aLabIter = aFind->second.begin();
     for(; aLabIter != aFind->second.end(); aLabIter++) {
@@ -1705,9 +1706,9 @@ void Model_Document::changeNamingName(const std::string theOldName,
         TDF_ChildIDIterator aChild(theLabel, TDataStd_Name::GetID());
         for(; aChild.More(); aChild.Next()) {
           Handle(TDataStd_Name) aSubName = Handle(TDataStd_Name)::DownCast(aChild.Value());
-          std::string aName = TCollection_AsciiString(aSubName->Get()).ToCString();
+          std::wstring aName = (wchar_t*)aSubName->Get().ToExtString();
           if (aName.find(theOldName) == 0) { // started from parent name
-            std::string aNewSubName = theNewName + aName.substr(theOldName.size());
+            std::wstring aNewSubName = theNewName + aName.substr(theOldName.size());
             changeNamingName(aName, aNewSubName, aSubName->Label());
             aSubName->Set(aNewSubName.c_str());
           }
@@ -1764,9 +1765,9 @@ static bool IsExchangedName(const TCollection_ExtendedString& theName1,
   return true;
 }
 
-TDF_Label Model_Document::findNamingName(std::string theName, ResultPtr theContext)
+TDF_Label Model_Document::findNamingName(std::wstring theName, ResultPtr theContext)
 {
-  std::map<std::string, std::list<TDF_Label> >::iterator aFind = myNamingNames.find(theName);
+  std::map<std::wstring, std::list<TDF_Label> >::iterator aFind = myNamingNames.find(theName);
   if (aFind != myNamingNames.end()) {
       std::list<TDF_Label>::reverse_iterator aLabIter = aFind->second.rbegin();
       for(; aLabIter != aFind->second.rend(); aLabIter++) {
@@ -1781,7 +1782,7 @@ TDF_Label Model_Document::findNamingName(std::string theName, ResultPtr theConte
   // not found exact name, try to find by sub-components
   std::string::size_type aSlash = theName.rfind('/');
   if (aSlash != std::string::npos) {
-    std::string anObjName = theName.substr(0, aSlash);
+    std::wstring anObjName = theName.substr(0, aSlash);
     aFind = myNamingNames.find(anObjName);
     if (aFind != myNamingNames.end()) {
       TCollection_ExtendedString aSubName(theName.substr(aSlash + 1).c_str());
@@ -1877,7 +1878,7 @@ bool Model_Document::isLaterByDep(FeaturePtr theThis, FeaturePtr theOther) {
 int Model_Document::numberOfNameInHistory(
   const ObjectPtr& theNameObject, const TDF_Label& theStartFrom)
 {
-  std::map<std::string, std::list<TDF_Label> >::iterator aFind =
+  std::map<std::wstring, std::list<TDF_Label> >::iterator aFind =
     myNamingNames.find(theNameObject->data()->name());
   if (aFind == myNamingNames.end() || aFind->second.size() < 2) {
     return 1; // no need to specify the name by additional identifiers
@@ -1915,10 +1916,10 @@ int Model_Document::numberOfNameInHistory(
 }
 
 ResultPtr Model_Document::findByName(
-  std::string& theName, std::string& theSubShapeName, bool& theUniqueContext)
+  std::wstring& theName, std::wstring& theSubShapeName, bool& theUniqueContext)
 {
   int aNumInHistory = 0;
-  std::string aName = theName;
+  std::wstring aName = theName;
   ResultPtr aRes = myObjs->findByName(aName);
   theUniqueContext = !(aRes.get() && myNamingNames.find(aName) != myNamingNames.end());
   while(!aRes.get() && aName[0] == '_') { // this may be theContext with the history index
@@ -1927,7 +1928,7 @@ ResultPtr Model_Document::findByName(
     aRes = myObjs->findByName(aName);
   }
   if (aNumInHistory) {
-    std::map<std::string, std::list<TDF_Label> >::iterator aFind = myNamingNames.find(aName);
+    std::map<std::wstring, std::list<TDF_Label> >::iterator aFind = myNamingNames.find(aName);
     if (aFind != myNamingNames.end() && aFind->second.size() > aNumInHistory) {
       std::list<TDF_Label>::reverse_iterator aLibIt = aFind->second.rbegin();
       for(; aNumInHistory != 0; aNumInHistory--)
@@ -2072,7 +2073,7 @@ AttributeSelectionListPtr Model_Document::selectionInPartFeature()
     aData->setObject(mySelectionFeature);
     mySelectionFeature->setDoc(myObjs->owner());
     mySelectionFeature->setData(aData);
-    std::string aName = id() + "_Part";
+    std::wstring aName = id() + L"_Part";
     mySelectionFeature->data()->setName(aName);
     mySelectionFeature->setDoc(myObjs->owner());
     mySelectionFeature->initAttributes();
index 277c822ba629730adc39a796a6a78192f72afcc2..5239524e14d71839ae7c8fc185343f6f5bd26efe 100644 (file)
@@ -135,7 +135,7 @@ class Model_Document : public ModelAPI_Document
   //! \param theName name of the object to search
   //! \returns null if such object is not found
   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Object> objectByName(
-    const std::string& theGroupID, const std::string& theName);
+    const std::string& theGroupID, const std::wstring& theName);
 
   //! Returns the object index in the group. Object must be visible. Otherwise returns -1.
   //! \param theObject object of this document
@@ -273,18 +273,18 @@ class Model_Document : public ModelAPI_Document
   void setExecuteFeatures(const bool theFlag);
 
   //! Registers the name of the shape for the topological naming needs
-  void addNamingName(const TDF_Label theLabel, std::string theName);
+  void addNamingName(const TDF_Label theLabel, std::wstring theName);
   //! Updates the name of some object
-  void changeNamingName(std::string theOldName, const std::string theNewName,
+  void changeNamingName(std::wstring theOldName, const std::wstring theNewName,
     const TDF_Label& theLabel);
   //! Returns the label, keeper of the name  for the topological naming needs
-  TDF_Label findNamingName(std::string theName, ResultPtr theContext);
+  TDF_Label findNamingName(std::wstring theName, ResultPtr theContext);
   //! Returns the number of the name in the history relatively to the given object (by label).
   //! Start from 1 (this object).
   int numberOfNameInHistory(const ObjectPtr& theNameObject, const TDF_Label& theStartFrom);
   //! Returns the result by name of the result (names of results must be unique, used for naming
   //! selection by name.
-  ResultPtr findByName(std::string& theName, std::string& theSubShapeName, bool& theUniqueContext);
+  ResultPtr findByName(std::wstring& theName, std::wstring& theSubShapeName, bool& theUniqueContext);
 
   ///! Returns all features of the document including the hidden features which are not in
   ///! history. Not very fast method, for calling once, not in big cycles.
@@ -450,7 +450,7 @@ class Model_Document : public ModelAPI_Document
 
   //! Optimization for finding the shape-label by topological naming names
   //! The name -> list of labels where this name is appeared (the last created name is last here)
-  std::map<std::string, std::list<TDF_Label> > myNamingNames;
+  std::map<std::wstring, std::list<TDF_Label> > myNamingNames;
   //! If it is true, features are not executed on update (on abort, undo, redo)
   bool myExecuteFeatures;
 
index 6d40674d33092660ed3366e92f1159483407c9d7..ef4d72a523fa5ab81bf905ba36e0a16156de3ca6 100644 (file)
@@ -626,7 +626,7 @@ ObjectPtr Model_Objects::object(const std::string& theGroupID,
 }
 
 std::shared_ptr<ModelAPI_Object> Model_Objects::objectByName(
-    const std::string& theGroupID, const std::string& theName)
+    const std::string& theGroupID, const std::wstring& theName)
 {
   createHistory(theGroupID);
   if (theGroupID == ModelAPI_Feature::group()) { // searching among features (in history or not)
@@ -730,22 +730,22 @@ TDF_Label Model_Objects::featuresLabel() const
   return myMain.FindChild(TAG_OBJECTS);
 }
 
-static std::string composeName(const std::string& theFeatureKind, const int theIndex)
+static std::wstring composeName(const std::string& theFeatureKind, const int theIndex)
 {
   std::stringstream aNameStream;
   aNameStream << theFeatureKind << "_" << theIndex;
-  return aNameStream.str();
+  return ModelAPI_Tools::toWString(aNameStream.str());
 }
 
 void Model_Objects::setUniqueName(FeaturePtr theFeature)
 {
   if (!theFeature->data()->name().empty())
     return;  // not needed, name is already defined
-  std::string aName;  // result
+  std::wstring aName;  // result
   // first count all features of such kind to start with index = count + 1
   int aNumObjects = -1; // this feature is already in this map
   NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator aFIter(myFeatures);
-  std::set<std::string> allNames;
+  std::set<std::wstring> allNames;
   for (; aFIter.More(); aFIter.Next()) {
     if (aFIter.Value()->getKind() == theFeature->getKind())
       aNumObjects++;
@@ -766,7 +766,7 @@ void Model_Objects::setUniqueName(FolderPtr theFolder)
     return; // name is already defined
 
   int aNbFolders = myFolders.Size();
-  std::string aName = composeName(ModelAPI_Folder::ID(), aNbFolders);
+  std::wstring aName = composeName(ModelAPI_Folder::ID(), aNbFolders);
 
   // check the uniqueness of the name
   NCollection_DataMap<TDF_Label, ObjectPtr>::Iterator anIt(myFolders);
@@ -1189,7 +1189,7 @@ TDF_Label Model_Objects::resultLabel(
 bool Model_Objects::hasCustomName(DataPtr theFeatureData,
                                   ResultPtr theResult,
                                   int theResultIndex,
-                                  std::string& theParentName) const
+                                  std::wstring& theParentName) const
 {
   ResultBodyPtr aBodyRes = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theFeatureData->owner());
   if (aBodyRes) {
@@ -1200,7 +1200,7 @@ bool Model_Objects::hasCustomName(DataPtr theFeatureData,
     // result of boolean operation 'Boolean_1' is a CompSolid which is renamed to 'MyBOOL',
     // however, sub-elements of 'MyBOOL' should be named 'Boolean_1_1', 'Boolean_1_2' etc.)
     if (std::dynamic_pointer_cast<Model_Data>(aBodyRes->data())->label().Depth() == 6) {
-      std::ostringstream aDefaultName;
+      std::wostringstream aDefaultName;
       // compute default name of CompSolid (name of feature + index of CompSolid's result)
       int aBodyResultIndex = 0;
       const std::list<ResultPtr>& aResults = anOwner->results();
@@ -1217,7 +1217,7 @@ bool Model_Objects::hasCustomName(DataPtr theFeatureData,
     return false;
   }
 
-  std::pair<std::string, bool> aName = ModelAPI_Tools::getDefaultName(theResult);
+  std::pair<std::wstring, bool> aName = ModelAPI_Tools::getDefaultName(theResult);
   if (aName.second)
     theParentName = aName.first;
   return aName.second;
@@ -1232,13 +1232,13 @@ void Model_Objects::storeResult(std::shared_ptr<ModelAPI_Data> theFeatureData,
   initData(theResult, resultLabel(theFeatureData, theResultIndex), TAG_FEATURE_ARGUMENTS);
   if (theResult->data()->name().empty()) {
     // if was not initialized, generate event and set a name
-    std::string aNewName = theFeatureData->name();
+    std::wstring aNewName = theFeatureData->name();
     if (hasCustomName(theFeatureData, theResult, theResultIndex, aNewName)) {
       // if the name of result is user-defined, then, at first time, assign name of the result
       // by empty string to be sure that corresponding flag in the data model is set
-      theResult->data()->setName("");
+      theResult->data()->setName(L"");
     } else {
-      std::stringstream aName;
+      std::wstringstream aName;
       aName << aNewName;
       // if there are several results (issue #899: any number of result),
       // add unique prefix starting from second
@@ -1937,7 +1937,7 @@ void Model_Objects::updateResults(FeaturePtr theFeature, std::set<FeaturePtr>& t
   }
 }
 
-ResultPtr Model_Objects::findByName(const std::string theName)
+ResultPtr Model_Objects::findByName(const std::wstring theName)
 {
   ResultPtr aResult;
   FeaturePtr aResFeature; // keep feature to return the latest one
index b9b8d7f181b7af15719cb4ff689895a943358567..4fe736b3904bf9f63e615e19af44398acc5aa0bc 100644 (file)
@@ -84,10 +84,10 @@ class Model_Objects
   //! \param theName name of the object to search
   //! \returns null if such object is not found
   std::shared_ptr<ModelAPI_Object> objectByName(
-    const std::string& theGroupID, const std::string& theName);
+    const std::string& theGroupID, const std::wstring& theName);
 
   //! Returns the result by the result name
-  ResultPtr findByName(const std::string theName);
+  ResultPtr findByName(const std::wstring theName);
 
 
   //! Returns the object index in the group. Object must be visible. Otherwise returns -1.
@@ -291,7 +291,7 @@ class Model_Objects
   bool hasCustomName(DataPtr theFeatureData,
                      ResultPtr theResult,
                      int theResultIndex,
-                     std::string& theParentName) const;
+                     std::wstring& theParentName) const;
 
   /// Return object representing a folder or empty pointer
   const ObjectPtr& folder(TDF_Label theLabel) const;
index 997eeab619de6daf694e0788b623ca2c9b88f7ce..18acf89ee278d0a96979348288c65492d8d5d965 100644 (file)
@@ -59,7 +59,7 @@ static void indexingSketchEdges(
     const CompositeFeaturePtr& theComposite,
     NCollection_DataMap<Handle(Geom_Curve), int>& theCurvesIndices,
     NCollection_DataMap<int, TopoDS_Edge>& theEdgesIndices,
-    std::map<int, std::string>& theEdgesNames);
+    std::map<int, std::wstring>& theEdgesNames);
 
 /// Convert each face to the list of indices of its edges
 /// \param[in]  theFaces          list of faces to proceed
@@ -82,13 +82,13 @@ static void faceToEdgeIndices(
 /// \param theEdgesNames      named of edges
 static void storeFacesOnLabel(std::shared_ptr<Model_Document>& theDocument,
                               TDF_Label& theShapeLabel,
-                              const std::string& theName,
+                              const std::wstring& theName,
                               const TopoDS_Shape& theShape,
                               NCollection_DataMap<int, TopoDS_Face>& theFacesOrder,
                               NCollection_List<TopoDS_Face>& theUnorderedFaces,
                               const MapFaceToEdgeIndices& theFaceEdges,
                               const NCollection_DataMap<int, TopoDS_Edge>& theEdgesIndices,
-                              const std::map<int, std::string>& theEdgesNames);
+                              const std::map<int, std::wstring>& theEdgesNames);
 
 
 // identifier of the infinite result
@@ -121,18 +121,18 @@ std::shared_ptr<GeomAPI_Shape> Model_ResultConstruction::shape()
   return myShape;
 }
 
-static std::string shortName(
+static std::wstring shortName(
   std::shared_ptr<ModelAPI_ResultConstruction>& theConstr)
 {
-  std::string aName = theConstr->data()->name();
+  std::wstring aName = theConstr->data()->name();
   // remove "-", "/" and "&" command-symbols
   aName.erase(std::remove(aName.begin(), aName.end(), '-'), aName.end());
   aName.erase(std::remove(aName.begin(), aName.end(), '/'), aName.end());
   aName.erase(std::remove(aName.begin(), aName.end(), '&'), aName.end());
   // remove the last 's', 'e', 'f' and 'r' symbols:
   // they are used as markers of start/end/forward/reversed indicators
-  static const std::string aSyms("sefr");
-  std::string::iterator aSuffix = aName.end() - 1;
+  static const std::wstring aSyms(L"sefr");
+  std::wstring::iterator aSuffix = aName.end() - 1;
   while(aSyms.find(*aSuffix) != std::string::npos) {
     --aSuffix;
   }
@@ -270,7 +270,7 @@ void Model_ResultConstruction::storeShape(std::shared_ptr<GeomAPI_Shape> theShap
 {
   std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
   if (aData && aData->isValid()) {
-    std::string aMyName = data()->name();
+    std::wstring aMyName = data()->name();
     TDF_Label aShapeLab = aData->shapeLab();
     if (!theShape.get() || theShape->isNull()) {
       aShapeLab.ForgetAllAttributes();
@@ -296,7 +296,8 @@ void Model_ResultConstruction::storeShape(std::shared_ptr<GeomAPI_Shape> theShap
         TDF_Label aSubLab = aShapeLab.FindChild(anIndex);
         TNaming_Builder aBuilder(aSubLab);
         aBuilder.Generated(anExp.Current());
-        std::string aVertexName = aMyName + "_" + (anIndex == 1 ? "StartVertex" : "EndVertex");
+        std::wstring aVertexName = aMyName + L"_" +
+          (anIndex == 1 ? L"StartVertex" : L"EndVertex");
         TDataStd_Name::Set(aSubLab, aVertexName.c_str());
         aMyDoc->addNamingName(aSubLab, aVertexName);
       }
@@ -316,7 +317,7 @@ void Model_ResultConstruction::storeShape(std::shared_ptr<GeomAPI_Shape> theShap
       // collect indices of curves of current composite
       NCollection_DataMap<Handle(Geom_Curve), int> aCurvesIndices;
       NCollection_DataMap<int, TopoDS_Edge> anEdgeIndices;
-      std::map<int, std::string> aComponentsNames; // names of components that lay on index
+      std::map<int, std::wstring> aComponentsNames; // names of components that lay on index
       indexingSketchEdges(aComposite, aCurvesIndices, anEdgeIndices, aComponentsNames);
 
       GeomAlgoAPI_SketchBuilder aSketchBuilder(aWirePtr->origin(), aWirePtr->dirX(),
@@ -379,7 +380,7 @@ void Model_ResultConstruction::setFacesOrder(const std::list<GeomFacePtr>& theFa
 {
   std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
   if (aData && aData->isValid()) {
-    std::string aMyName = data()->name();
+    std::wstring aMyName = data()->name();
     TDF_Label aShapeLab = aData->shapeLab();
     GeomShapePtr aResShape = shape();
     if (!aResShape.get() || aResShape->isNull()) {
@@ -400,7 +401,7 @@ void Model_ResultConstruction::setFacesOrder(const std::list<GeomFacePtr>& theFa
       // collect indices of curves of current composite
       NCollection_DataMap<Handle(Geom_Curve), int> aCurvesIndices;
       NCollection_DataMap<int, TopoDS_Edge> anEdgeIndices;
-      std::map<int, std::string> aComponentsNames; // names of components that lay on index
+      std::map<int, std::wstring> aComponentsNames; // names of components that lay on index
       indexingSketchEdges(aComposite, aCurvesIndices, anEdgeIndices, aComponentsNames);
 
       ListOfShape aFaces;
@@ -426,13 +427,13 @@ void Model_ResultConstruction::setFacesOrder(const std::list<GeomFacePtr>& theFa
 
 void storeFacesOnLabel(std::shared_ptr<Model_Document>& theDocument,
                        TDF_Label& theShapeLabel,
-                       const std::string& theName,
+                       const std::wstring& theName,
                        const TopoDS_Shape& theShape,
                        NCollection_DataMap<int, TopoDS_Face>& theFacesOrder,
                        NCollection_List<TopoDS_Face>& theUnorderedFaces,
                        const MapFaceToEdgeIndices& theFaceEdges,
                        const NCollection_DataMap<int, TopoDS_Edge>& theEdgesIndices,
-                       const std::map<int, std::string>& theEdgesNames)
+                       const std::map<int, std::wstring>& theEdgesNames)
 {
   theShapeLabel.ForgetAllAttributes(); // clear all previously stored
   TDataStd_Name::Set(theShapeLabel, theName.c_str()); // restore name forgotten
@@ -466,7 +467,7 @@ void storeFacesOnLabel(std::shared_ptr<Model_Document>& theDocument,
     // store also indices of the new face edges
     Handle(TDataStd_IntPackedMap) aNewMap = TDataStd_IntPackedMap::Set(aLab);
     const TColStd_ListOfInteger& aNewInd = theFaceEdges.FindFromKey(aFaceToPut);
-    std::stringstream aName;
+    std::wstringstream aName;
     aName<<"Face";
     TopExp_Explorer aPutEdges(aFaceToPut, TopAbs_EDGE);
     TNaming_Builder *anEdgesBuilder = 0, *aVerticesBuilder = 0;
@@ -525,8 +526,8 @@ void storeFacesOnLabel(std::shared_ptr<Model_Document>& theDocument,
       TDF_Label aWireLab = aLab.FindChild(aWireTag);
       TNaming_Builder aWireBuilder(aWireLab);
       aWireBuilder.Generated(aWires.Current());
-      std::ostringstream aWireName;
-      aWireName<<aName.str()<<"_wire";
+      std::wostringstream aWireName;
+      aWireName<<aName.str()<<L"_wire";
       if (aWireTag > 3)
         aWireName<<"_"<<aWireTag - 2;
       TDataStd_Name::Set(aWireLab, aWireName.str().c_str());
@@ -539,7 +540,7 @@ void storeFacesOnLabel(std::shared_ptr<Model_Document>& theDocument,
 void indexingSketchEdges(const CompositeFeaturePtr& theComposite,
                          NCollection_DataMap<Handle(Geom_Curve), int>& theCurvesIndices,
                          NCollection_DataMap<int, TopoDS_Edge>& theEdgesIndices,
-                         std::map<int, std::string>& theEdgesNames)
+                         std::map<int, std::wstring>& theEdgesNames)
 {
   const int aSubNum = theComposite->numberOfSubs();
   for (int a = 0; a < aSubNum; a++) {
index 56a18c43efaa8a8f4e2d11de96888f2e0632e089..ed6f3bece0454d21127a033f648de17d6316e998 100644 (file)
@@ -24,6 +24,7 @@
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_AttributeIntArray.h>
 #include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_Tools.h>
 
 #include <GeomAlgoAPI_CompoundBuilder.h>
 
@@ -152,10 +153,10 @@ std::shared_ptr<ModelAPI_ResultField::ModelAPI_FieldStep> Model_ResultField::ste
   return NULL;
 }
 
-std::string Model_ResultField::Model_FieldStep::name() {
-  std::ostringstream aStream;
+std::wstring Model_ResultField::Model_FieldStep::name() {
+  std::wostringstream aStream;
   aStream<<myParent->data()->name()<<std::endl;
-  aStream<<"Step "<<(myId + 1)<<" "<<myParent->textLine(myId);
+  aStream<<"Step "<<(myId + 1)<<" "<< ModelAPI_Tools::toWString(myParent->textLine(myId));
   return aStream.str();
 }
 // LCOV_EXCL_STOP
index cbaa3efec852ca8d2d1c93b43fc443af349f1a6d..80dfef1cb85404a49cd78ae5f1a7bf074ac5b434 100644 (file)
@@ -52,7 +52,7 @@ public:
     virtual std::shared_ptr<ModelAPI_Document> document() const { return myParent->document(); }
 
     /// Returns a GUI name of this step
-    virtual std::string name();
+    virtual std::wstring name();
 
   private:
     ModelAPI_ResultField* myParent;
index fd752bc7282da60eb110f4a8ae70d5e44b590378..e6dc4545382087425e5a3c64b5be7540b0f19dcd 100644 (file)
@@ -32,6 +32,7 @@
 #include <Model_Application.h>
 #include <Events_Loop.h>
 #include <ModelAPI_Events.h>
+#include <ModelAPI_Tools.h>
 
 #include <GeomAPI_Trsf.h>
 
@@ -90,7 +91,7 @@ void Model_ResultPart::activate()
   SessionPtr aMgr = ModelAPI_Session::get();
   if (!aMgr->isOperation()) {
     // open transaction even document is not created to set current docs in setActiveDocument
-    std::string aMsg = "Activation " + data()->name();
+    std::string aMsg = "Activation " + ModelAPI_Tools::toString(data()->name());
     aMgr->startOperation(aMsg);
     isNewTransaction = true;
   }
@@ -253,7 +254,7 @@ static bool IsEqualTrsf(gp_Trsf& theT1, gp_Trsf theT2) {
   return true;
 }
 
-std::string Model_ResultPart::nameInPart(const std::shared_ptr<GeomAPI_Shape>& theShape,
+std::wstring Model_ResultPart::nameInPart(const std::shared_ptr<GeomAPI_Shape>& theShape,
   int& theIndex)
 {
   theIndex = 0; // not initialized
@@ -279,21 +280,21 @@ std::string Model_ResultPart::nameInPart(const std::shared_ptr<GeomAPI_Shape>& t
       }
     }
     // something is not right
-    return "";
+    return L"";
   }
 
   TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
   if (aShape.IsNull())
-    return "";
+    return L"";
 
   // getting an access to the document of part
   std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(partDoc());
   if (!aDoc.get()) // the part document is not presented for the moment
-    return "";
+    return L"";
   TDF_Label anAccessLabel = aDoc->generalLabel();
   // make the selection attribute anyway:
   // otherwise just by name it is not stable to search the result
-  std::string aName;
+  std::wstring aName;
   // for this the context result is needed
   ResultPtr aContext;
   const std::string& aBodyGroup = ModelAPI_ResultBody::group();
@@ -342,7 +343,7 @@ gp_Trsf Model_ResultPart::sumTrsf() {
   return aResult;
 }
 
-bool Model_ResultPart::combineGeometrical(const int theIndex, std::string& theNewName)
+bool Model_ResultPart::combineGeometrical(const int theIndex, std::wstring& theNewName)
 {
   std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(partDoc());
   if (aDoc.get()) {
@@ -361,7 +362,7 @@ bool Model_ResultPart::combineGeometrical(const int theIndex, std::string& theNe
 }
 
 std::shared_ptr<GeomAPI_Shape> Model_ResultPart::shapeInPart(
-  const std::string& theName, const std::string& theType, int& theIndex)
+  const std::wstring& theName, const std::string& theType, int& theIndex)
 {
   theIndex = 0; // not found yet
   std::shared_ptr<GeomAPI_Shape> aResult;
index 0f27e9c589cf91b55e358f12e4881d3d0e04c293..8fc6ea0621b0c856ce53048123039aa828b40f9d 100644 (file)
@@ -70,16 +70,16 @@ class Model_ResultPart : public ModelAPI_ResultPart
   /// \param theShape selected shape in this document
   /// \param theIndex is returned as one-based index if selection was required, "0" otherwise
   /// \returns empty name is selection is not correct
-  MODEL_EXPORT virtual std::string nameInPart(const std::shared_ptr<GeomAPI_Shape>& theShape,
+  MODEL_EXPORT virtual std::wstring nameInPart(const std::shared_ptr<GeomAPI_Shape>& theShape,
     int& theIndex);
 
   /// Updates the selection inside of the part by the selection index
   MODEL_EXPORT virtual bool updateInPart(const int theIndex);
   /// Returns the shape by the name in the part
   MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shapeInPart(
-    const std::string& theName, const std::string& theType, int& theIndex);
+    const std::wstring& theName, const std::string& theType, int& theIndex);
   /// Updates the selection inside of the part as a geometrical selection
-  MODEL_EXPORT virtual bool combineGeometrical(const int theIndex, std::string& theNewName);
+  MODEL_EXPORT virtual bool combineGeometrical(const int theIndex, std::wstring& theNewName);
   /// Updates the shape-result of the part (called on Part feature execution)
   MODEL_EXPORT virtual void updateShape();
   /// Applies the additional transformation of the part
index 89f90ee4aff07fa7f3799e7dc193dab01b471437..40251ca3001cd156068d0c1579f1a4707fe3cfba 100644 (file)
@@ -362,7 +362,7 @@ std::list<std::shared_ptr<ModelAPI_Document> > Model_Session::allOpenedDocuments
   return aResult;
 }
 
-bool Model_Session::isLoadByDemand(const std::string theDocID, const int theDocIndex)
+bool Model_Session::isLoadByDemand(const std::wstring theDocID, const int theDocIndex)
 {
   return Model_Application::getApplication()->isLoadByDemand(theDocID, theDocIndex);
 }
index b480a67e951c03cfd5eca6104bb3c9f7eb182f4b..fedd75ef54b54336f5fcdc69e466de52a03cba7b 100644 (file)
@@ -116,7 +116,7 @@ class Model_Session : public ModelAPI_Session, public Events_Listener
   MODEL_EXPORT virtual std::list<std::shared_ptr<ModelAPI_Document> > allOpenedDocuments();
 
   /// Returns true if document is not loaded yet
-  MODEL_EXPORT virtual bool isLoadByDemand(const std::string theDocID, const int theDocIndex);
+  MODEL_EXPORT virtual bool isLoadByDemand(const std::wstring theDocID, const int theDocIndex);
 
   /// Registers the plugin that creates features.
   /// It is obligatory for each plugin to call this function on loading to be found by
index 5652538b04cca5ae1009f5da32afc2521829034f..6bb6eeff40e6ea17a76056b07c8adb23380ed580 100644 (file)
@@ -32,6 +32,8 @@
 
   // fix for SWIG v2.0.4
   #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj))
+
+  #define SWIGPY_UNICODE_ARG(obj) ((PyObject*) (obj))
 %}
 
 // import other modules
@@ -42,8 +44,6 @@
 #define MODELAPI_EXPORT
 
 // standard definitions
-%include "typemaps.i"
-%include "std_string.i"
 %include "std_list.i"
 %include "std_shared_ptr.i"
 %include "std_set.i"
index 119485dc495ae4b69e617f1d2b1c04b29e74edc3..148dd53e050530cf0bed4ae8ef0f3dd09b559fe7 100644 (file)
@@ -92,13 +92,13 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute
 
   /// Returns a textual string of the selection
   /// \param theDefaultValue a value, which is used if the naming name can not be obtained
-  virtual std::string namingName(const std::string& theDefaultValue = "") = 0;
+  virtual std::wstring namingName(const std::wstring& theDefaultValue = L"") = 0;
 
   /// Defines an id of the selection
   virtual void setId(int theID) = 0;
 
   /// Selects sub-shape by the textual Name
-  virtual void selectSubShape(const std::string& theType, const std::string& theSubShapeName) = 0;
+  virtual void selectSubShape(const std::string& theType, const std::wstring& theSubShapeName) = 0;
 
   /// Selects sub-shape by its inner point
   virtual void selectSubShape(const std::string& theType,
@@ -106,7 +106,7 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute
 
   /// Selects sub-shape by weak naming index
   virtual void selectSubShape(const std::string& theType,
-    const std::string& theContextName, const int theIndex) = 0;
+    const std::wstring& theContextName, const int theIndex) = 0;
 
   /// Returns true if recompute of selection become impossible
   virtual bool isInvalid() = 0;
@@ -118,7 +118,7 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute
   MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelection();
 
   /// Returns the name by context. Adds the part name if the context is located in other document
-  MODELAPI_EXPORT virtual std::string contextName(const ResultPtr& theContext) const = 0;
+  MODELAPI_EXPORT virtual std::wstring contextName(const ResultPtr& theContext) const = 0;
 
   /// Makes the current local selection becomes all sub-shapes with same base geometry.
   MODELAPI_EXPORT virtual void combineGeometrical() = 0;
index 16cd5f97981514ce40dbfae7fe18e50d94c438be..57ce5c8bc34a981ac7c717070e48089e4a186324 100644 (file)
@@ -54,14 +54,14 @@ public:
 
   /// Adds the new reference to the end of the list by the naming name of the selected shape
   /// The type of shape is taken from the current selection type if the given is empty
-  virtual void append(const std::string& theNamingName, const std::string& theType = "") = 0;
+  virtual void append(const std::wstring& theNamingName, const std::string& theType = "") = 0;
 
   /// Adds the new reference to the end of the list by inner point on the selected shape
   virtual void append(const std::shared_ptr<GeomAPI_Pnt>& thePoint,
                       const std::string& theType) = 0;
 
   /// Adds the new reference to the end of the list by weak naming index
-  virtual void append(const std::string& theType, const std::string& theContextName,
+  virtual void append(const std::string& theType, const std::wstring& theContextName,
                       const int theIndex) = 0;
 
   /// Copy the selection list to the destination attribute
index bed7201ac7de9939ff5bb6404b9241ebc61f69f3..7743af0ac3aa8bae93bd9afb907f00ab33e0db04 100644 (file)
@@ -72,9 +72,9 @@ class MODELAPI_EXPORT ModelAPI_Data
  public:
 
   /// Returns the name of the feature visible by the user in the object browser
-  virtual std::string name() = 0;
+  virtual std::wstring name() = 0;
   /// Defines the name of the feature visible by the user in the object browser
-  virtual void setName(const std::string& theName) = 0;
+  virtual void setName(const std::wstring& theName) = 0;
   /// Return \c true if the object has been renamed by the user
   virtual bool hasUserDefinedName() const = 0;
 
index 602c4e8033280f0b9eeba6ca31d78b677220f75e..a07a8e801358a64535e4844fea25e013611281ae 100644 (file)
@@ -100,7 +100,7 @@ public:
   //! \param theName name of the object to search
   //! \returns null if such object is not found
   virtual std::shared_ptr<ModelAPI_Object> objectByName(const std::string& theGroupID,
-                                                    const std::string& theName) = 0;
+                                                    const std::wstring& theName) = 0;
 
   //! Returns the object index in the group. Object must be visible. Otherwise returns -1.
   //! \param theObject object of this document
index 92474383c6e743179f0c96e25b445fe2cfa95977..3a9611a2ef039c66e35124a356d5dcda3d87f9de 100644 (file)
@@ -233,8 +233,8 @@ ModelAPI_ObjectRenamedMessage::~ModelAPI_ObjectRenamedMessage()
 {}
 
 void ModelAPI_ObjectRenamedMessage::send(ObjectPtr theObject,
-                                         const std::string& theOldName,
-                                         const std::string& theNewName,
+                                         const std::wstring& theOldName,
+                                         const std::wstring& theNewName,
                                          const void* theSender)
 {
   std::shared_ptr<ModelAPI_ObjectRenamedMessage> aMessage(
@@ -255,22 +255,22 @@ void ModelAPI_ObjectRenamedMessage::setObject(ObjectPtr theObject)
   myObject = theObject;
 }
 
-std::string ModelAPI_ObjectRenamedMessage::oldName() const
+std::wstring ModelAPI_ObjectRenamedMessage::oldName() const
 {
   return myOldName;
 }
 
-void ModelAPI_ObjectRenamedMessage::setOldName(const std::string& theOldName)
+void ModelAPI_ObjectRenamedMessage::setOldName(const std::wstring& theOldName)
 {
   myOldName = theOldName;
 }
 
-std::string ModelAPI_ObjectRenamedMessage::newName() const
+std::wstring ModelAPI_ObjectRenamedMessage::newName() const
 {
   return myNewName;
 }
 
-void ModelAPI_ObjectRenamedMessage::setNewName(const std::string& theNewName)
+void ModelAPI_ObjectRenamedMessage::setNewName(const std::wstring& theNewName)
 {
   myNewName = theNewName;
 }
index 02fdadb0936d97a68e6167a9aa5e4476b4364ac1..9e5697d36822624e7e1b29281a9552837ed804d7 100644 (file)
@@ -389,8 +389,8 @@ public:
 class ModelAPI_ObjectRenamedMessage : public Events_Message
 {
   ObjectPtr myObject;
-  std::string myOldName;
-  std::string myNewName;
+  std::wstring myOldName;
+  std::wstring myNewName;
 
  public:
   /// Static. Returns EventID of the message.
@@ -403,8 +403,8 @@ class ModelAPI_ObjectRenamedMessage : public Events_Message
 
   /// Useful method that creates and sends the AttributeEvalMessage event
   MODELAPI_EXPORT static void send(ObjectPtr theObject,
-                                   const std::string& theOldName,
-                                   const std::string& theNewName,
+                                   const std::wstring& theOldName,
+                                   const std::wstring& theNewName,
                                    const void* theSender);
 
   /// Creates an empty message
@@ -417,13 +417,13 @@ class ModelAPI_ObjectRenamedMessage : public Events_Message
   /// Sets an object
   MODELAPI_EXPORT void setObject(ObjectPtr theObject);
   /// Returns an old name
-  MODELAPI_EXPORT std::string oldName() const;
+  MODELAPI_EXPORT std::wstring oldName() const;
   /// Sets an old name
-  MODELAPI_EXPORT void setOldName(const std::string& theOldName);
+  MODELAPI_EXPORT void setOldName(const std::wstring& theOldName);
   /// Returns a new name
-  MODELAPI_EXPORT std::string newName() const;
+  MODELAPI_EXPORT std::wstring newName() const;
   /// Sets a new name
-  MODELAPI_EXPORT void setNewName(const std::string& theNewName);
+  MODELAPI_EXPORT void setNewName(const std::wstring& theNewName);
 };
 
 /// Message that the parameter should be replaced with its value
index 8c231608656b13658eb1334ce373d715f557adbc..119ddce567316466537d51adde8eda23bf8590c7 100644 (file)
@@ -164,7 +164,7 @@ class ModelAPI_Feature : public ModelAPI_Object
  // Helper methods, aliases for data()->method()
  // -----------------------------------------------------------------------------------------------
   /// Returns the name stored in the attribute
-  inline std::string name()
+  inline std::wstring name()
   {
     return data()->name();
   }
index 1fd19958ee5f8b209069b18b4770424962f5750b..fba630266b19f13596dd95d5acf70f0a24cce617 100644 (file)
@@ -82,7 +82,7 @@ public:
   // Helper methods, aliases for data()->method()
   // -----------------------------------------------------------------------------------------------
   /// Returns the name stored in the attribute
-  inline std::string name()
+  inline std::wstring name()
   {
     return data()->name();
   }
index 4e2be6a4090e102188bdd8b1e88978c490ba3b37..d53f18661441d04430970b717928d6852c3ec9ab 100644 (file)
@@ -68,7 +68,7 @@ public:
     MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay);
 
     /// Returns a GUI name of this step
-    MODELAPI_EXPORT virtual std::string name() = 0;
+    MODELAPI_EXPORT virtual std::wstring name() = 0;
 
   protected:
     /// This method is called just after creation of the object: it must initialize
index 0ceb0865213f1bc03393d288ac1a985e4e9551b0..5991895cc6ac7e6355f158259108a31939eb6a22 100644 (file)
@@ -73,7 +73,7 @@ class ModelAPI_ResultPart : public ModelAPI_Result
   virtual bool isActivated() = 0;
 
   /// Returns the name of the shape inside of the part
-  virtual std::string nameInPart(const std::shared_ptr<GeomAPI_Shape>& theShape,
+  virtual std::wstring nameInPart(const std::shared_ptr<GeomAPI_Shape>& theShape,
     int& theIndex) = 0;
   /// Updates the selection inside of the part by the selection index
   virtual bool updateInPart(const int theIndex) = 0;
@@ -87,10 +87,10 @@ class ModelAPI_ResultPart : public ModelAPI_Result
 
   /// Returns the shape by the name in the part
   virtual std::shared_ptr<GeomAPI_Shape> shapeInPart(
-    const std::string& theName, const std::string& theType, int& theIndex) = 0;
+    const std::wstring& theName, const std::string& theType, int& theIndex) = 0;
 
   /// Updates the selection inside of the part as a geometrical selection
-  virtual bool combineGeometrical(const int theIndex, std::string& theNewName) = 0;
+  virtual bool combineGeometrical(const int theIndex, std::wstring& theNewName) = 0;
 
   /// Returns the shape selected in the selection index
   virtual std::shared_ptr<GeomAPI_Shape> selectionValue(const int theIndex) = 0;
index 84a925aa2074672160275cbdc948ff6a92039d51..fae2a9e97bc2b415a35fc4692e6f8f0b731a2fc0 100644 (file)
@@ -112,7 +112,7 @@ class MODELAPI_EXPORT ModelAPI_Session
   virtual std::list<std::shared_ptr<ModelAPI_Document> > allOpenedDocuments() = 0;
 
   /// Returns true if document is not loaded yet
-  virtual bool isLoadByDemand(const std::string theDocID, const int theDocIndex) = 0;
+  virtual bool isLoadByDemand(const std::wstring theDocID, const int theDocIndex) = 0;
 
   /// Copies the document to the new one with the given id
   virtual std::shared_ptr<ModelAPI_Document> copy(
index 8a19702d6251e081c972b5bfa117532237c17887..7cbdd8089f946ffe562ebe265f62dfb09fb93fe3 100644 (file)
@@ -37,6 +37,7 @@
 #include <map>
 #include <iostream>
 #include <sstream>
+#include <codecvt>
 
 #include <Events_Loop.h>
 #include <ModelAPI_Events.h>
@@ -172,9 +173,10 @@ std::string getFeatureError(const FeaturePtr& theFeature)
 ObjectPtr objectByName(const DocumentPtr& theDocument, const std::string& theGroup,
                        const std::string& theName)
 {
+  std::wstring aName = toWString(theName);
   for (int anIndex = 0; anIndex < theDocument->size(theGroup); ++anIndex) {
     ObjectPtr anObject = theDocument->object(theGroup, anIndex);
-    if (anObject->data()->name() == theName)
+    if (anObject->data()->name() == aName)
       return anObject;
   }
   // not found
@@ -338,9 +340,9 @@ void allResults(const FeaturePtr& theFeature, std::list<ResultPtr>& theResults)
 }
 
 //******************************************************************
-bool allDocumentsActivated(std::string& theNotActivatedNames)
+bool allDocumentsActivated(std::wstring& theNotActivatedNames)
 {
-  theNotActivatedNames = "";
+  theNotActivatedNames = L"";
   bool anAllPartActivated = true;
 
   DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
@@ -351,7 +353,7 @@ bool allDocumentsActivated(std::string& theNotActivatedNames)
     if (!aPart->isActivated()) {
       anAllPartActivated = false;
       if (!theNotActivatedNames.empty())
-        theNotActivatedNames += ", ";
+        theNotActivatedNames += L", ";
       theNotActivatedNames += aObject->data()->name().c_str();
     }
   }
@@ -615,7 +617,7 @@ void getConcealedResults(const FeaturePtr& theFeature,
   }
 }
 
-std::pair<std::string, bool> getDefaultName(const std::shared_ptr<ModelAPI_Result>& theResult,
+std::pair<std::wstring, bool> getDefaultName(const std::shared_ptr<ModelAPI_Result>& theResult,
                                             const bool theInherited)
 {
   typedef std::list< std::pair < std::string, std::list<ObjectPtr> > > ListOfReferences;
@@ -627,10 +629,10 @@ std::pair<std::string, bool> getDefaultName(const std::shared_ptr<ModelAPI_Resul
     // names of sub-solids in CompSolid should be default (for example,
     // result of boolean operation 'Boolean_1_1' is a CompSolid which is renamed to 'MyBOOL',
     // however, sub-elements of 'MyBOOL' should be named 'Boolean_1_1_1', 'Boolean_1_1_2' etc.)
-    std::ostringstream aDefaultName;
+    std::wostringstream aDefaultName;
     aDefaultName << getDefaultName(anOwnerRes).first;
     aDefaultName << "_" << (bodyIndex(theResult) + 1);
-    return std::pair<std::string, bool>(aDefaultName.str(), false);
+    return std::pair<std::wstring, bool>(aDefaultName.str(), false);
   }
 
   FeaturePtr anOwner = ModelAPI_Feature::feature(theResult->data()->owner());
@@ -706,7 +708,7 @@ std::pair<std::string, bool> getDefaultName(const std::shared_ptr<ModelAPI_Resul
       // return name of reference result only if it has been renamed by the user,
       // in other case compose a default name
       if (anObjRes->data()->hasUserDefinedName()) {
-        std::stringstream aName;
+        std::wstringstream aName;
         aName << anObjRes->data()->name();
         std::map<ResultPtr, int>::iterator aFound = aNbRefToObject.find(anObjRes);
         if (aFound != aNbRefToObject.end()) {
@@ -714,19 +716,19 @@ std::pair<std::string, bool> getDefaultName(const std::shared_ptr<ModelAPI_Resul
           // referring to the same shape
           aName << "_" << aFound->second + 1;
         }
-        return std::pair<std::string, bool>(aName.str(), true);
+        return std::pair<std::wstring, bool>(aName.str(), true);
       }
     }
   }
 
   // compose default name by the name of the feature and the index of result
-  std::stringstream aDefaultName;
+  std::wstringstream aDefaultName;
   aDefaultName << anOwner->name();
   // if there are several results (issue #899: any number of result),
   // add unique prefix starting from second
   if (anIndexInOwner > 0 || theResult->groupName() == ModelAPI_ResultBody::group())
     aDefaultName << "_" << anIndexInOwner + 1;
-  return std::pair<std::string, bool>(aDefaultName.str(), false);
+  return std::pair<std::wstring, bool>(aDefaultName.str(), false);
 }
 
 std::set<FeaturePtr> getParents(const FeaturePtr& theFeature)
@@ -1103,5 +1105,21 @@ std::list<FeaturePtr> referencedFeatures(
 }
 
 // LCOV_EXCL_STOP
+std::string toString(const std::wstring& theWStr)
+{
+  static std::wstring_convert<std::codecvt_utf8<wchar_t> > aConvertor;
+  return aConvertor.to_bytes(theWStr);
+}
+
+/*! Converts a byte string to an extended string
+*  \param theStr a byte string
+*/
+std::wstring toWString(const std::string& theStr)
+{
+  static std::wstring_convert<std::codecvt_utf8<wchar_t> > aConvertor;
+  return aConvertor.from_bytes(theStr);
+}
+
+
 
 } // namespace ModelAPI_Tools
index a90cd60fa461c124dad9516f301a20cc3ec71156..f927a67c75dfcf4598a5699d52fcf460b4daf0b2 100644 (file)
@@ -140,7 +140,7 @@ MODELAPI_EXPORT void allResults(const std::shared_ptr<ModelAPI_Feature>& theFeat
  \param theNotActivatedNames out string which contains not activated names
  \return a boolean value
  */
-MODELAPI_EXPORT bool allDocumentsActivated(std::string& theNotActivatedNames);
+MODELAPI_EXPORT bool allDocumentsActivated(std::wstring& theNotActivatedNames);
 
 /*! Removes features from the document
 * \param theFeatures a list of features to be removed
@@ -199,7 +199,7 @@ MODELAPI_EXPORT void getConcealedResults(const std::shared_ptr<ModelAPI_Feature>
  *  Return also whether the name is get from the concealing result of parent object
  *  (means that concealing result has user-defined name).
  */
-MODELAPI_EXPORT std::pair<std::string, bool> getDefaultName(
+MODELAPI_EXPORT std::pair<std::wstring, bool> getDefaultName(
   const std::shared_ptr<ModelAPI_Result>& theResult, const bool theInherited = true);
 
 /*! Collect all parents for the given feature, including the Part
@@ -300,6 +300,16 @@ MODELAPI_EXPORT std::list<std::shared_ptr<ModelAPI_Feature> > referencedFeatures
   std::shared_ptr<ModelAPI_Result> theTarget, const std::string& theFeatureKind,
   const bool theSortResults);
 
+/*! Converts an extended string to a simple (byte) string
+*  \param theWStr an extended string
+*/
+MODELAPI_EXPORT std::string toString(const std::wstring& theWStr);
+
+/*! Converts a byte string to an extended string
+*  \param theStr a byte string
+*/
+MODELAPI_EXPORT std::wstring toWString(const std::string& theStr);
+
 }
 
 #endif
index 9fea6cc192553a0a87b5938d277f78d037cde963..28dd80021e121b532600cf902a54267e76459da5 100644 (file)
@@ -32,6 +32,8 @@
 
   // fix for SWIG v2.0.4
   #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj))
+
+  #define SWIGPY_UNICODE_ARG(obj) ((PyObject*) (obj))
 %}
 
 %include "doxyhelp.i"
 #define MODELHIGHAPI_EXPORT
 
 // standard definitions
-%include "typemaps.i"
-%include "std_list.i"
 %include "std_pair.i"
-%include "std_string.i"
-%include "std_shared_ptr.i"
 
 // directors
 %feature("director") ModelHighAPI_Dumper;
index 5352af49710ce0f43dc4e4116c758aae69d034f0..1b6dbf470fd785991727fcc138b52ab7fe4423ba 100644 (file)
@@ -314,8 +314,8 @@ void ModelHighAPI_Dumper::DumpStorage::write(const AttributeSelectionPtr& theAtt
   getShapeAndContext(theAttrSelect, aShape, aContext);
 
   if (aShape.get()) {
-    myDumpBuffer << "\"" << aShape->shapeTypeStr() << "\", \""
-                 << theAttrSelect->namingName() << "\"";
+    //TODO: vsv myDumpBuffer << "\"" << aShape->shapeTypeStr() << "\", \""
+    //             << theAttrSelect->namingName() << "\"";
   }
 
   myDumpBuffer << ")";
@@ -495,8 +495,8 @@ void ModelHighAPI_Dumper::DumpStorageWeak::write(const AttributeSelectionPtr& th
     GeomAlgoAPI_NExplode aNExplode(aContext->shape(), aShape->shapeType());
     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 << ")";
+      //TODO: vsv myDumpBuffer << "model.selection(\"" << aShape->shapeTypeStr() << "\", \""
+      //             << theAttrSelect->contextName(aContext) << "\", " << anIndex << ")";
       aStandardDump = false;
     }
   }
@@ -580,18 +580,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<ModelAPI_Feature>(theEntity);
   if (aFeature) {
-    aName = aFeature->name();
+    aName = ModelAPI_Tools::toString(aFeature->name());
     aKind = aFeature->getKind();
   } else {
     FolderPtr aFolder = std::dynamic_pointer_cast<ModelAPI_Folder>(theEntity);
     if (aFolder) {
-      aName = aFolder->data()->name();
+      aName = ModelAPI_Tools::toString(aFolder->data()->name());
       aKind = ModelAPI_Folder::ID();
       isSaveNotDumped = false;
     }
@@ -684,9 +685,9 @@ void ModelHighAPI_Dumper::saveResultNames(const FeaturePtr& theFeature)
   std::list<ResultPtr> allRes;
   ModelAPI_Tools::allResults(theFeature, allRes);
   for(std::list<ResultPtr>::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) {
-    std::pair<std::string, bool> aName = ModelAPI_Tools::getDefaultName(*aRes);
-    std::string aDefaultName = aName.first;
-    std::string aResName = (*aRes)->data()->name();
+    std::pair<std::wstring, bool> 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 +871,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<ResultPtr> aResultsWithNameOrColor;
   const std::list<ResultPtr>& aResults = theSubFeature->results();
   std::list<ResultPtr>::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);
   }
@@ -1078,6 +1080,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");
index 8f480c0f16441009b0fac907633dd444a2fae161..8e800930666edf8fdbad2b5601f3e9d58127630f 100644 (file)
@@ -228,6 +228,9 @@ public:
   /// Dump string
   MODELHIGHAPI_EXPORT
   ModelHighAPI_Dumper& operator<<(const std::string& theString);
+  /// Dump wstring
+  MODELHIGHAPI_EXPORT
+  ModelHighAPI_Dumper& operator<<(const std::wstring& theString);
   /// Dump boolean
   MODELHIGHAPI_EXPORT
   ModelHighAPI_Dumper& operator<<(const bool theValue);
index 63ba58607930ae3e3cfa1077672a68ce3a458c2f..6bbc96cecd44a02827618d91bf08f16543c54d23 100644 (file)
@@ -75,7 +75,8 @@ ModelHighAPI_FeatureStore::ModelHighAPI_FeatureStore(ObjectPtr theObject) {
 std::string ModelHighAPI_FeatureStore::compare(ObjectPtr theObject) {
   std::string anError = compareData(theObject->data(), myAttrs);
   if (!anError.empty()) {
-    return "Features '" + theObject->data()->name() + "' differ:" + anError;
+    return "Features '" + ModelAPI_Tools::toString(theObject->data()->name()) +
+      "' differ:" + anError;
   }
 
   FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
@@ -87,11 +88,13 @@ std::string ModelHighAPI_FeatureStore::compare(ObjectPtr theObject) {
     for(; aRes != allResults.end() && aResIter != myRes.end(); aRes++, aResIter++) {
       anError = compareData((*aRes)->data(), *aResIter);
       if (!anError.empty())
-        return "Results of feature '" + aFeature->name() + "' '" + (*aRes)->data()->name() +
+        return "Results of feature '" + ModelAPI_Tools::toString(aFeature->name()) +
+        "' '" + ModelAPI_Tools::toString((*aRes)->data()->name()) +
         "' differ:" + anError;
     }
     if (aRes != allResults.end()) {
-      return "Current model has more results '" + (*aRes)->data()->name() + "'";
+      return "Current model has more results '" +
+        ModelAPI_Tools::toString((*aRes)->data()->name()) + "'";
     }
     if (aResIter != myRes.end()) {
       return "Original model had more results '" + (*aResIter)["__name__"] + "'";
@@ -104,7 +107,7 @@ void ModelHighAPI_FeatureStore::storeData(std::shared_ptr<ModelAPI_Data> theData
   std::map<std::string, std::string>& theAttrs)
 {
   // store name to keep also this information and output if needed
-  theAttrs["__name__"] = theData->name();
+  theAttrs["__name__"] = ModelAPI_Tools::toString(theData->name());
   std::list<std::shared_ptr<ModelAPI_Attribute> > allAttrs = theData->attributes("");
   std::list<std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = allAttrs.begin();
   for(; anAttr != allAttrs.end(); anAttr++) {
@@ -189,7 +192,8 @@ std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr& theAttr) {
     if (anAttr->value() != aDoc) {
       ResultPtr aRes = ModelAPI_Tools::findPartResult(aDoc, anAttr->value());
       if (aRes.get()) {
-        aResult<<aRes->data()->name(); // Part result name (the same as saved file name)
+        // Part result name (the same as saved file name)
+        aResult<< ModelAPI_Tools::toString(aRes->data()->name());
       }
     } else {
       aResult<<aDoc->kind(); // PartSet
@@ -243,7 +247,7 @@ std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr& theAttr) {
     AttributeReferencePtr anAttr =
       std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttr);
     if (anAttr->value().get()) {
-      aResult<<anAttr->value()->data()->name();
+      aResult<< ModelAPI_Tools::toString(anAttr->value()->data()->name());
     } else {
       aResult<<"__empty__";
     }
@@ -251,7 +255,7 @@ std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr& theAttr) {
     AttributeSelectionPtr anAttr =
       std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttr);
     if (anAttr->context().get())
-      aResult<<anAttr->namingName();
+      aResult<< ModelAPI_Tools::toString(anAttr->namingName());
     else
       aResult<<"__notinitialized__";
   } else if (aType == ModelAPI_AttributeSelectionList::typeId()) {
@@ -260,14 +264,14 @@ std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr& theAttr) {
     for(int a = 0; a < anAttr->size(); a++) {
       if (a != 0)
         aResult<<" ";
-      aResult<<anAttr->value(a)->namingName();
+      aResult<< ModelAPI_Tools::toString(anAttr->value(a)->namingName());
     }
   } else if (aType == ModelAPI_AttributeRefAttr::typeId()) {
     AttributeRefAttrPtr anAttr =
       std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttr);
     ObjectPtr anObj = anAttr->isObject() ? anAttr->object() : anAttr->attr()->owner();
     if (anObj.get()) {
-      aResult<<anObj->data()->name();
+      aResult<< ModelAPI_Tools::toString(anObj->data()->name());
       if (!anAttr->isObject()) {
         aResult<<" "<<anAttr->attr()->id();
       }
@@ -293,7 +297,7 @@ std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr& theAttr) {
           if (aStr == "SketchConstraint")
             continue; // no need to dump and check constraints
         }
-        aResList.push_back((*aL)->data()->name());
+        aResList.push_back(ModelAPI_Tools::toString((*aL)->data()->name()));
       } else if (!isSketchFeatures) {
         aResList.push_back("__empty__");
       }
@@ -313,7 +317,7 @@ std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr& theAttr) {
         aResult<<" ";
       ObjectPtr anObj = aL->second.get() ? aL->second->owner() : aL->first;
       if (anObj.get()) {
-        aResult<<anObj->data()->name();
+        aResult<< ModelAPI_Tools::toString(anObj->data()->name());
         if (aL->second.get()) {
           aResult<<" "<<aL->second->id();
         }
index b47d4b48de92e3235940c80389119d77aea5c0cc..18ac4e6e2eaca285d1b9b053e028d482a02957f7 100644 (file)
@@ -59,13 +59,13 @@ bool ModelHighAPI_Folder::initialize()
   return true;
 }
 
-void ModelHighAPI_Folder::setName(const std::string& theName)
+void ModelHighAPI_Folder::setName(const std::wstring& theName)
 {
   if (myFolder && myFolder->data() && myFolder->data()->isValid())
     myFolder->data()->setName(theName);
 }
 
-std::string ModelHighAPI_Folder::name() const
+std::wstring ModelHighAPI_Folder::name() const
 {
   return myFolder->data()->name();
 }
index 2f99aabf82d865f95c571897f3a24e5c9a705aaa..ea0232c742d3dc2dc80aec8fc74fb1f18cd3ff9c 100644 (file)
@@ -58,11 +58,11 @@ public:
 
   /// Shortcut for data()->setName()
   MODELHIGHAPI_EXPORT
-  void setName(const std::string& theName);
+  void setName(const std::wstring& theName);
 
   /// Shortcut for data()->name()
   MODELHIGHAPI_EXPORT
-  std::string name() const;
+  std::wstring name() const;
 
   /// To update the folder state
   /// \param isForce start execution of feature instead of sending events
index cb0373bfa4c2ef4582f6851a6d308bb151dcc143..5fd4de052d0479f8367fb4ee996630c4c7f71adb 100644 (file)
@@ -86,13 +86,13 @@ void ModelHighAPI_Interface::execute(bool isForce)
   //aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED));
 }
 
-void ModelHighAPI_Interface::setName(const std::string& theName)
+void ModelHighAPI_Interface::setName(const std::wstring& theName)
 {
   if (feature().get())
     feature()->data()->setName(theName);
 }
 
-std::string ModelHighAPI_Interface::name() const
+std::wstring ModelHighAPI_Interface::name() const
 {
   return feature()->data()->name();
 }
index 8675bb66ce33f14083bc5ab8d424f5c8100d57b4..a0043592257322f13d0c162948b6a70452ebb825 100644 (file)
@@ -68,11 +68,11 @@ public:
 
   /// Shortcut for feature()->data()->setName()
   MODELHIGHAPI_EXPORT
-  void setName(const std::string& theName);
+  void setName(const std::wstring& theName);
 
   /// Shortcut for feature()->data()->name()
   MODELHIGHAPI_EXPORT
-  std::string name() const;
+  std::wstring name() const;
 
   /// Return firts object of the feature
   MODELHIGHAPI_EXPORT
index 30f92c2223cdf4d2038aeee867879080eb1ae5eb..33f98418bd17c125a4c9d8f4dc8574f775d7188f 100644 (file)
@@ -44,7 +44,7 @@ ModelHighAPI_Selection::ModelHighAPI_Selection(const std::shared_ptr<ModelAPI_Re
 }
 
 ModelHighAPI_Selection::ModelHighAPI_Selection(const std::string& theType,
-                                               const std::string& theSubShapeName)
+                                               const std::wstring& theSubShapeName)
 : myVariantType(VT_TypeSubShapeNamePair)
 , myTypeSubShapeNamePair(theType, theSubShapeName)
 {
@@ -72,9 +72,9 @@ ModelHighAPI_Selection::ModelHighAPI_Selection(const std::string& theType,
 }
 
 ModelHighAPI_Selection::ModelHighAPI_Selection(const std::string& theType,
-  const std::string& theContextName, const int theIndex)
-  : myVariantType(VT_WeakNamingPair)
-  , myWeakNamingPair(theType, std::pair<std::string, int>(theContextName, theIndex))
+  const std::wstring& theContextName, const int theIndex)
+  : myVariantType(VT_WeakNamingPair),
+  myWeakNamingPair(theType, std::pair<std::wstring, int>(theContextName, theIndex))
 {
 }
 
@@ -184,7 +184,7 @@ std::string ModelHighAPI_Selection::shapeType() const
 }
 
 //==================================================================================================
-void ModelHighAPI_Selection::setName(const std::string& theName)
+void ModelHighAPI_Selection::setName(const std::wstring& theName)
 {
   if (myVariantType == VT_ResultSubShapePair) {
     std::shared_ptr<ModelAPI_Result> aResult = myResultSubShapePair.first;
@@ -195,14 +195,14 @@ void ModelHighAPI_Selection::setName(const std::string& theName)
   }
 }
 
-std::string ModelHighAPI_Selection::name() const
+std::wstring ModelHighAPI_Selection::name() const
 {
   if (myVariantType == VT_ResultSubShapePair) {
     std::shared_ptr<ModelAPI_Result> aResult = myResultSubShapePair.first;
     if (aResult.get())
       return aResult->data()->name();
   }
-  return std::string();
+  return std::wstring();
 }
 
 void ModelHighAPI_Selection::setColor(int theRed, int theGreen, int theBlue)
index 3ef133dd9d0cd54476b5f9a27b69609afc475b3e..3bf6d3851b83699593c706183e61f8482ee94dce 100644 (file)
@@ -37,9 +37,9 @@ class ModelAPI_Result;
 //--------------------------------------------------------------------------------------
 typedef std::pair<std::shared_ptr<ModelAPI_Result>, std::shared_ptr<GeomAPI_Shape> >
   ResultSubShapePair;
-typedef std::pair<std::string, std::string> TypeSubShapeNamePair;
+typedef std::pair<std::string, std::wstring> TypeSubShapeNamePair;
 typedef std::pair<std::string, std::shared_ptr<GeomAPI_Pnt> > TypeInnerPointPair;
-typedef std::pair<std::string, std::pair<std::string, int> > TypeWeakNamingPair;
+typedef std::pair<std::string, std::pair<std::wstring, int> > TypeWeakNamingPair;
 //--------------------------------------------------------------------------------------
 /**\class ModelHighAPI_Selection
  * \ingroup CPPHighAPI
@@ -70,7 +70,7 @@ public:
   /// Constructor for sub-shape by the textual Name
   MODELHIGHAPI_EXPORT
   ModelHighAPI_Selection(const std::string& theType,
-                         const std::string& theSubShapeName);
+                         const std::wstring& theSubShapeName);
 
   /// Constructor for sub-shape by inner point coordinates
   MODELHIGHAPI_EXPORT
@@ -86,7 +86,7 @@ public:
   /// Constructor for sub-shape by weak naming identifier
   MODELHIGHAPI_EXPORT
     ModelHighAPI_Selection(const std::string& theType,
-      const std::string& theContextName, const int theIndex);
+      const std::wstring& theContextName, const int theIndex);
 
   /// Destructor
   MODELHIGHAPI_EXPORT
@@ -126,11 +126,11 @@ public:
 
   /// Shortcut for result()->data()->setName()
   MODELHIGHAPI_EXPORT
-  void setName(const std::string& theName);
+  void setName(const std::wstring& theName);
 
   /// Shortcut for result()->data()->name()
   MODELHIGHAPI_EXPORT
-  std::string name() const;
+  std::wstring name() const;
 
   /// Change result's color
   MODELHIGHAPI_EXPORT
index 4bcd182fd39aba1b627f090220c47713cd857ac0..9cb451d7e1ef9858961fa0987973c43117129d8c 100644 (file)
@@ -42,17 +42,17 @@ std::shared_ptr<ModelAPI_Document> activeDocument()
 }
 
 //--------------------------------------------------------------------------------------
-std::shared_ptr<GeomAPI_Ax3> defaultPlane( const std::string& theName )
+std::shared_ptr<GeomAPI_Ax3> defaultPlane( const std::wstring& theName )
 {
   std::shared_ptr<GeomAPI_Pnt> o(new GeomAPI_Pnt(0, 0, 0));
   std::shared_ptr<GeomAPI_Dir> n, x;
-  if (theName == "XOY") {
+  if (theName == L"XOY") {
       n.reset(new GeomAPI_Dir(0, 0, 1));
       x.reset(new GeomAPI_Dir(1, 0, 0));
-  } else if (theName == "XOZ") {
+  } else if (theName == L"XOZ") {
       n.reset(new GeomAPI_Dir(0, -1, 0));
       x.reset(new GeomAPI_Dir(1, 0, 0));
-  } else if (theName == "YOZ") {
+  } else if (theName == L"YOZ") {
       n.reset(new GeomAPI_Dir(1, 0, 0));
       x.reset(new GeomAPI_Dir(0, 1, 0));
   }
@@ -60,35 +60,35 @@ std::shared_ptr<GeomAPI_Ax3> defaultPlane( const std::string& theName )
   return std::shared_ptr<GeomAPI_Ax3>(new GeomAPI_Ax3(o, x, n));
 }
 
-std::string defaultPlane(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
+std::wstring defaultPlane(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
                          const std::shared_ptr<GeomAPI_Dir>& theNormal,
                          const std::shared_ptr<GeomAPI_Dir>& theDirX)
 {
   static const double aTol = 1.e-10;
 
   if (fabs(theOrigin->x()) > aTol || fabs(theOrigin->y()) > aTol || fabs(theOrigin->z()) > aTol)
-    return std::string();
+    return std::wstring();
 
   // XOY or XOZ
   if (fabs(theNormal->x()) < aTol &&
       fabs(theDirX->x() - 1.0) < aTol && fabs(theDirX->y()) < aTol && fabs(theDirX->z()) < aTol) {
     // XOY
     if (fabs(theNormal->y()) < aTol && fabs(theNormal->z() - 1.0) < aTol)
-      return std::string("XOY");
+      return std::wstring(L"XOY");
     else if (fabs(theNormal->y() + 1.0) < aTol && fabs(theNormal->z()) < aTol)
-      return std::string("XOZ");
+      return std::wstring(L"XOZ");
   }
   // YOZ
   else if (fabs(theNormal->x() - 1.0) < aTol &&
            fabs(theNormal->y()) < aTol && fabs(theNormal->z()) < aTol &&
            fabs(theDirX->x()) < aTol && fabs(theDirX->y() - 1.0) < aTol &&
            fabs(theDirX->z()) < aTol)
-    return std::string("YOZ");
+    return std::wstring(L"YOZ");
 
-  return std::string();
+  return std::wstring();
 }
 
-std::shared_ptr<ModelAPI_Result> standardPlane(const std::string & theName){
+std::shared_ptr<ModelAPI_Result> standardPlane(const std::wstring & theName){
   DocumentPtr aPartSet = ModelAPI_Session::get()->moduleDocument();
   // searching for the construction element
   return std::dynamic_pointer_cast<ModelAPI_Result>(
index bb73976be3a85da7686d55a2cba8c8da335d2ba9..00b9f66f1ca1864ff654ee4cb8fb5d273db60f0b 100644 (file)
@@ -49,11 +49,11 @@ std::shared_ptr<ModelAPI_Document> activeDocument();
  *  These planes are respectively referred to by name "XOY" (Z=0), "XOZ" (Y=0) or "YOZ" (X=0).
  */
 MODELHIGHAPI_EXPORT
-std::shared_ptr<GeomAPI_Ax3> defaultPlane(const std::string & theName);
+std::shared_ptr<GeomAPI_Ax3> defaultPlane(const std::wstring & theName);
 
 /// Return name of coordinate plane ("XOY", "XOZ" or "YOZ") or empty string for other planes.
 MODELHIGHAPI_EXPORT
-std::string defaultPlane(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
+std::wstring defaultPlane(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
                          const std::shared_ptr<GeomAPI_Dir>& theNormal,
                          const std::shared_ptr<GeomAPI_Dir>& theDirX);
 
@@ -62,7 +62,7 @@ std::string defaultPlane(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
  *  These planes are respectively referred to by name "XOY" (Z=0), "XOZ" (Y=0) or "YOZ" (X=0).
  */
 MODELHIGHAPI_EXPORT
-std::shared_ptr<ModelAPI_Result> standardPlane(const std::string & theName);
+std::shared_ptr<ModelAPI_Result> standardPlane(const std::wstring & theName);
 
 /** Start a data structure transaction.
  *
index 936775e47ec5e48f9366e107d97dbf8b4f214c2b..0eed22d5845c07c628e00315f2f82c3e5e782fce 100644 (file)
@@ -407,20 +407,20 @@ std::string strByValueType(const ModelAPI_AttributeTables::ValueType theType)
 }
 
 /// stores the features information, recursively stores sub-documents features
-std::string storeFeatures(const std::string& theDocName, DocumentPtr theDoc,
-  std::map<std::string, std::map<std::string, ModelHighAPI_FeatureStore> >& theStore,
+std::string storeFeatures(const std::wstring& theDocName, DocumentPtr theDoc,
+  std::map<std::wstring, std::map<std::wstring, ModelHighAPI_FeatureStore> >& theStore,
   const bool theCompare) // if false => store
 {
-  std::map<std::string, std::map<std::string, ModelHighAPI_FeatureStore> >::iterator aDocFind;
+  std::map<std::wstring, std::map<std::wstring, ModelHighAPI_FeatureStore> >::iterator aDocFind;
   if (theCompare) {
      aDocFind = theStore.find(theDocName);
      if (aDocFind == theStore.end()) {
-       return "Document '" + theDocName + "' not found";
+       return "Document '" + ModelAPI_Tools::toString(theDocName) + "' not found";
      }
   }
   // store the model features information: iterate all features
   int anObjectsCount = 0; // stores the number of compared features for this document to compare
-  std::set<std::string> aProcessed; // processed features names (that are in the current document)
+  std::set<std::wstring> aProcessed; // processed features names (that are in the current document)
 
   // process all objects (features and folders)
   std::list<ObjectPtr> allObjects = theDoc->allObjects();
@@ -436,14 +436,15 @@ std::string storeFeatures(const std::string& theDocName, DocumentPtr theDoc,
         continue; // no need to dump and check constraints
     }
     if (theCompare) {
-      std::map<std::string, ModelHighAPI_FeatureStore>::iterator
+      std::map<std::wstring, ModelHighAPI_FeatureStore>::iterator
         anObjFind = aDocFind->second.find(anObject->data()->name());
       if (anObjFind == aDocFind->second.end()) {
-        return "Document '" + theDocName + "' feature '" + anObject->data()->name() + "' not found";
+        return "Document '" + ModelAPI_Tools::toString(theDocName)
+          + "' feature '" + ModelAPI_Tools::toString(anObject->data()->name()) + "' not found";
       }
       std::string anError = anObjFind->second.compare(anObject);
       if (!anError.empty()) {
-        anError = "Document " + theDocName + " " + anError;
+        anError = "Document " + ModelAPI_Tools::toString(theDocName) + " " + anError;
         return anError;
       }
       anObjectsCount++;
@@ -475,22 +476,23 @@ std::string storeFeatures(const std::string& theDocName, DocumentPtr theDoc,
   if (theCompare) {
     if (aDocFind->second.size() != anObjectsCount) {
       // search for disappeared feature
-      std::string aLostName;
-      std::map<std::string, ModelHighAPI_FeatureStore>::iterator aLostIter;
+      std::wstring aLostName;
+      std::map<std::wstring, ModelHighAPI_FeatureStore>::iterator aLostIter;
       for(aLostIter = aDocFind->second.begin(); aLostIter != aDocFind->second.end(); aLostIter++) {
         if (aProcessed.find(aLostIter->first) == aProcessed.end()) {
           aLostName = aLostIter->first;
         }
       }
-      return "For document '" + theDocName +
-        "' the number of features is decreased, there is no feature '" + aLostName + "'";
+      return "For document '" + ModelAPI_Tools::toString(theDocName) +
+        "' the number of features is decreased, there is no feature '" +
+        ModelAPI_Tools::toString(aLostName) + "'";
     }
   }
   return ""; // ok
 }
 
 //==================================================================================================
-typedef std::map<std::string, std::map<std::string, ModelHighAPI_FeatureStore> > Storage;
+typedef std::map<std::wstring, std::map<std::wstring, ModelHighAPI_FeatureStore> > Storage;
 
 static bool dumpToPython(SessionPtr theSession,
                          const std::string& theFilename,
@@ -536,8 +538,9 @@ static bool checkDump(SessionPtr theSession,
   PyGILState_Release(gstate); /* release python thread */
 
   // compare with the stored data
-  std::string anError = storeFeatures(
-    theSession->moduleDocument()->kind(), theSession->moduleDocument(), theStorage, true);
+  std::string anError =
+    storeFeatures(ModelAPI_Tools::toWString(theSession->moduleDocument()->kind()),
+    theSession->moduleDocument(), theStorage, true);
   if (!anError.empty()) {
     std::cout << anError << std::endl;
     Events_InfoMessage anErrorMsg(theErrorMsgContext, anError);
@@ -575,9 +578,10 @@ bool checkPyDump(const std::string& theFilenameNaming,
     return false;
 
    // map from document name to feature name to feature data
-  std::map<std::string, std::map<std::string, ModelHighAPI_FeatureStore> > aStore;
-  std::string anError = storeFeatures(
-    aSession->moduleDocument()->kind(), aSession->moduleDocument(), aStore, false);
+  std::map<std::wstring, std::map<std::wstring, ModelHighAPI_FeatureStore> > aStore;
+  std::string anError =
+    storeFeatures(ModelAPI_Tools::toWString(aSession->moduleDocument()->kind()),
+    aSession->moduleDocument(), aStore, false);
   if (!anError.empty()) {
     Events_InfoMessage anErrorMsg(std::string("checkPythonDump"), anError);
     anErrorMsg.send();
index 74749fd5ed2633b43ec09950eaf207c8135b399b..76ea42c68a9b7c0c296306c677f504fd901b81e8 100644 (file)
@@ -413,7 +413,7 @@ void ModuleBase_ResultPrs::ComputeSelection(const Handle(SelectMgr_Selection)& a
       Handle(SelectMgr_SensitiveEntity) anEntity = anIt.Value();
       Handle(SelectBasics_EntityOwner) aBasicsOwner = anEntity->BaseSensitive()->OwnerId();
       if (!aBasicsOwner.IsNull())
-        aBasicsOwner->Set(aBasicsOwner->Priority() + myAdditionalSelectionPriority);
+        aBasicsOwner->SetPriority(aBasicsOwner->Priority() + myAdditionalSelectionPriority);
     }
   }
 }
@@ -441,10 +441,8 @@ bool ModuleBase_ResultPrs::appendVertexSelection(const Handle(SelectMgr_Selectio
         anIt.More();
         anIt.Next()) {
       Handle(SelectMgr_SensitiveEntity) anEntity = anIt.Value();
-      Handle(SelectMgr_EntityOwner) anOwner =
-        Handle(SelectMgr_EntityOwner)
-        ::DownCast(anEntity->BaseSensitive()->OwnerId());
-      anOwner->Set(this);
+      Handle(SelectMgr_EntityOwner) anOwner = anEntity->BaseSensitive()->OwnerId();
+      anOwner->SetSelectable(this);
     }
 
     return true;
index a9f463969f9e92b4d10f016838170e48e2ca1f66..ed9717c1009b1a373e61bfdffaf9944c1545b464 100644 (file)
@@ -305,7 +305,7 @@ QString objectName(const ObjectPtr& theObj)
   if (!theObj.get())
     return "";
 
-  return theObj->data()->name().c_str();
+  return QString::fromStdWString(theObj->data()->name());
 }
 
 QString objectInfo(const ObjectPtr& theObj, const bool isUseAttributesInfo)
@@ -336,8 +336,8 @@ QString objectInfo(const ObjectPtr& theObj, const bool isUseAttributesInfo)
   if (aFeature.get()) {
     aFeatureStr.append(QString(": %1").arg(aFeature->getKind().c_str()).toStdString().c_str());
     if (aFeature->data()->isValid()) {
-      aFeatureStr.append(QString(", name=%1").arg(theObj->data()->name().c_str()).toStdString()
-                                                                                       .c_str());
+      aFeatureStr.append(QString(", name=%1")
+        .arg(QString::fromStdWString(theObj->data()->name())).toStdString().c_str());
     }
     if (isUseAttributesInfo) {
       std::set<std::shared_ptr<ModelAPI_Attribute> > anAttributes;
@@ -564,8 +564,8 @@ void getParameters(QStringList& theParameters)
     int aSize = aDocument->size(aGroupId);
     for (int i = 0; i < aSize; i++) {
       ObjectPtr anObject = aDocument->object(aGroupId, i);
-      std::string aParameterName = anObject->data()->name();
-      theParameters.append(aParameterName.c_str());
+      std::wstring aParameterName = anObject->data()->name();
+      theParameters.append(QString::fromStdWString(aParameterName));
     }
   }
 }
@@ -941,12 +941,12 @@ bool askToDelete(const std::set<FeaturePtr> theFeatures,
                  const std::string& thePrefixInfo)
 {
   QString aNotActivatedDocWrn;
-  std::string aNotActivatedNames;
+  std::wstring aNotActivatedNames;
   if (!ModelAPI_Tools::allDocumentsActivated(aNotActivatedNames)) {
     if (ModuleBase_Tools::hasModuleDocumentFeature(theFeatures))
       aNotActivatedDocWrn =
         QObject::tr("Selected objects can be used in Part documents which are not loaded: %1.\n")
-                            .arg(aNotActivatedNames.c_str());
+                            .arg(QString::fromStdWString(aNotActivatedNames));
   }
 
   std::set<FeaturePtr> aFeaturesRefsTo;
@@ -962,7 +962,7 @@ bool askToDelete(const std::set<FeaturePtr> theFeatures,
       continue;
 
     if (isFeatureOfResult(aFeature, ModelAPI_ResultPart::group()))
-      aPartFeatureNames.append(aFeature->name().c_str());
+      aPartFeatureNames.append(QString::fromStdWString(aFeature->name()));
 
     std::set<FeaturePtr> aRefFeatures;
     std::set<FeaturePtr> aRefList = theReferences.at(aFeature);
@@ -992,7 +992,7 @@ bool askToDelete(const std::set<FeaturePtr> theFeatures,
     FeaturePtr aFeature = *anIt;
     if (theReferencesToDelete.find(aFeature) == theReferencesToDelete.end()) {
       aFeaturesRefsToParameterOnly.insert(aFeature);
-      aParamFeatureNames.append(aFeature->name().c_str());
+      aParamFeatureNames.append(QString::fromStdWString(aFeature->name()));
     }
   }
   aParamFeatureNames.sort();
@@ -1004,9 +1004,9 @@ bool askToDelete(const std::set<FeaturePtr> theFeatures,
     if (aFeature->getKind() == "RemoveResults")
       continue; // skip the remove results feature mentioning: result will be removed anyway
     if (isFeatureOfResult(aFeature, ModelAPI_ResultPart::group()))
-      aPartFeatureNames.append(aFeature->name().c_str());
+      aPartFeatureNames.append(QString::fromStdWString(aFeature->name()));
     else
-      anOtherFeatureNames.append(aFeature->name().c_str());
+      anOtherFeatureNames.append(QString::fromStdWString(aFeature->name()));
   }
   aPartFeatureNames.sort();
   anOtherFeatureNames.sort();
@@ -1252,7 +1252,7 @@ bool isNameExist(const QString& theName, FeaturePtr theIgnoreParameter)
   std::shared_ptr<ModelAPI_Document> aDoc = aMgr->activeDocument();
   FeaturePtr aParamFeature;
   int aNbFeatures = aDoc->numInternalFeatures();
-  std::string aName = theName.toStdString();
+  std::wstring aName = theName.toStdWString();
   for (int i = 0; i < aNbFeatures; i++) {
     aParamFeature = aDoc->internalFeature(i);
     if (aParamFeature && aParamFeature->getKind() == "Parameter") {
@@ -1269,7 +1269,7 @@ FeaturePtr findParameter(const QString& theName)
   std::shared_ptr<ModelAPI_Document> aDoc = aMgr->activeDocument();
   FeaturePtr aParamFeature;
   int aNbFeatures = aDoc->numInternalFeatures();
-  std::string aName = theName.toStdString();
+  std::wstring aName = theName.toStdWString();
   for (int i = 0; i < aNbFeatures; i++) {
     aParamFeature = aDoc->internalFeature(i);
     if (aParamFeature && aParamFeature->getKind() == "Parameter") {
@@ -1282,10 +1282,10 @@ FeaturePtr findParameter(const QString& theName)
 
 
 //********************************************************************
-std::string generateName(const AttributePtr& theAttribute,
+std::wstring generateName(const AttributePtr& theAttribute,
   ModuleBase_IWorkshop* theWorkshop)
 {
-  std::string aName;
+  std::wstring aName;
   if (theAttribute.get() != NULL) {
     ModuleBase_Operation* anOperation = theWorkshop->currentOperation();
 
@@ -1298,7 +1298,7 @@ std::string generateName(const AttributePtr& theAttribute,
       std::string anAttributeTitle;
       aFactory.getAttributeTitle(theAttribute->id(), anAttributeTitle);
 
-      std::stringstream aStreamName;
+      std::wstringstream aStreamName;
       aStreamName << theAttribute->owner()->data()->name() << "/" << anAttributeTitle.c_str();
       aName = aStreamName.str();
     }
index 2d1ad9227f50d12ab0d49e4da220256b374f5a77..6343bef978af8a9eda14905a6c590152d299c73a 100644 (file)
@@ -401,7 +401,7 @@ bool MODULEBASE_EXPORT isSameShape(const TopoDS_Shape& theShape1, const TopoDS_S
 /// \param theAttribute a model attribute
 /// \param theWorkshop a workshop class instance
 /// \return string value
-std::string MODULEBASE_EXPORT generateName(const AttributePtr& theAttribute,
+std::wstring MODULEBASE_EXPORT generateName(const AttributePtr& theAttribute,
   ModuleBase_IWorkshop* theWorkshop);
 
 /// Returns pixel ratio of a screen where main window is displayed
index d3d2a45b8ad74cc2542e69770623dd8900462ea9..08ebd471eea1233d3aaf34173dcbf29523c971bc 100644 (file)
@@ -163,7 +163,8 @@ void ModuleBase_WidgetConcealedObjects::addViewRow(
   aVisibilityBtn->setChecked(false);
 
   myView->setCellWidget(anId, 0, aVisibilityWdg);
-  myView->setItem(anId, 1, new QTableWidgetItem(theResult->data()->name().c_str()));
+  myView->setItem(anId, 1,
+    new QTableWidgetItem(QString::fromStdWString(theResult->data()->name())));
 
   if (anId == 1) {
     myView->setColumnWidth(0, myView->verticalHeader()->defaultSectionSize());
index c9685bbf0c1d6de5fe22c92fbf233e234cf1b900..b1191bee9c4d2be24fe9974a367c02e97d5875d5 100644 (file)
@@ -184,8 +184,8 @@ void ModuleBase_WidgetFeatureSelector::updateSelectionName()
 
   ObjectPtr anObject = ModuleBase_Tools::getObject(myFeature->attribute(attributeID()));
   if (anObject.get() != NULL) {
-    std::string aName = anObject->data()->name();
-    myTextLine->setText(QString::fromStdString(aName));
+    std::wstring aName = anObject->data()->name();
+    myTextLine->setText(QString::fromStdWString(aName));
   } else {
     myTextLine->clear();
   }
index bab6ca0029ab230033e73bc315756249009c52b9..0fe71545bc968303e23d57cf199b0dfca2c6c858 100644 (file)
@@ -779,7 +779,7 @@ void ModuleBase_WidgetMultiSelector::updateSelectionList()
     AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID());
     for (int i = 0; i < aSelectionListAttr->size(); i++) {
       AttributeSelectionPtr aAttr = aSelectionListAttr->value(i);
-      myListView->addItem(aAttr->namingName().c_str(), i);
+      myListView->addItem(QString::fromStdWString(aAttr->namingName()), i);
     }
   }
   else if (aType == ModelAPI_AttributeRefList::typeId()) {
@@ -787,7 +787,7 @@ void ModuleBase_WidgetMultiSelector::updateSelectionList()
     for (int i = 0; i < aRefListAttr->size(); i++) {
       ObjectPtr anObject = aRefListAttr->object(i);
       if (anObject.get()) {
-        myListView->addItem(anObject->data()->name().c_str(), i);
+        myListView->addItem(QString::fromStdWString(anObject->data()->name()), i);
       }
     }
   }
@@ -797,13 +797,13 @@ void ModuleBase_WidgetMultiSelector::updateSelectionList()
       AttributePtr anAttribute = aRefAttrListAttr->attribute(i);
       QString aName;
       if (anAttribute.get()) {
-        std::string anAttrName = ModuleBase_Tools::generateName(anAttribute, myWorkshop);
-        aName = QString::fromStdString(anAttrName);
+        std::wstring anAttrName = ModuleBase_Tools::generateName(anAttribute, myWorkshop);
+        aName = QString::fromStdWString(anAttrName);
       }
       else {
         ObjectPtr anObject = aRefAttrListAttr->object(i);
         if (anObject.get()) {
-          aName = anObject->data()->name().c_str();
+          aName = QString::fromStdWString(anObject->data()->name());
         }
       }
       myListView->addItem(aName, i);
index 7ee2e2cd1b83669281ea3481bc10883854990846..92324ff3c17be194631314f593b55c548dff7554 100644 (file)
@@ -30,7 +30,7 @@ bool ModuleBase_WidgetNameEdit::storeValueCustom()
     return false;
 
   QString aValue = myLineEdit->text();
-  std::string aName = aValue.toStdString();
+  std::wstring aName = aValue.toStdWString();
   myFeature->data()->setName(aName);
   ResultPtr aRes = myFeature->firstResult();
   if (aRes.get())
@@ -45,7 +45,7 @@ bool ModuleBase_WidgetNameEdit::restoreValueCustom()
     return false;
 
   bool isBlocked = myLineEdit->blockSignals(true);
-  myLineEdit->setText(QString::fromStdString(myFeature->data()->name()));
+  myLineEdit->setText(QString::fromStdWString(myFeature->data()->name()));
   myLineEdit->blockSignals(isBlocked);
 
   return true;
index 127c7621e4f846c5ca09a4a4b6ff784c702d133e..e50f0d71490a085e9187d06ef1c6c4b79b67ffa9 100644 (file)
@@ -216,21 +216,21 @@ void ModuleBase_WidgetShapeSelector::updateSelectionName()
   bool isNameUpdated = false;
   AttributeSelectionPtr aSelect = aData->selection(attributeID());
   if (aSelect) {
-    std::string aDefault = translate(getDefaultValue()).toStdString();
-    myTextLine->setText(QString::fromStdString(aSelect->namingName(aDefault)));
+    std::wstring aDefault = translate(getDefaultValue()).toStdWString();
+    myTextLine->setText(QString::fromStdWString(aSelect->namingName(aDefault)));
     isNameUpdated = true;
   }
   if (!isNameUpdated) {
     ObjectPtr anObject = ModuleBase_Tools::getObject(myFeature->attribute(attributeID()));
     if (anObject.get() != NULL) {
-      std::string aName = anObject->data()->name();
-      myTextLine->setText(QString::fromStdString(aName));
+      std::wstring aName = anObject->data()->name();
+      myTextLine->setText(QString::fromStdWString(aName));
     } else {
       AttributeRefAttrPtr aRefAttr = aData->refattr(attributeID());
       if (aRefAttr && aRefAttr->attr().get() != NULL) {
         //myIsObject = aRefAttr->isObject();
-        std::string anAttrName = ModuleBase_Tools::generateName(aRefAttr->attr(), myWorkshop);
-        myTextLine->setText(QString::fromStdString(anAttrName));
+        std::wstring anAttrName = ModuleBase_Tools::generateName(aRefAttr->attr(), myWorkshop);
+        myTextLine->setText(QString::fromStdWString(anAttrName));
       }
       else {
         myTextLine->setText(translate(getDefaultValue()));
index 718fa3f4367819c7b443d9734d0630ee41b38180..dec451209fb63b72464cf6a32034456d0f7f889a 100644 (file)
@@ -244,16 +244,16 @@ bool isValidAttribute(const AttributePtr& theAttribute)
 void setParameterName(ResultParameterPtr theResultParameter, const std::string& theName)
 {
   bool aWasBlocked = theResultParameter->data()->blockSendAttributeUpdated(true);
-  theResultParameter->data()->setName(theName);
+  theResultParameter->data()->setName(ModelAPI_Tools::toWString(theName));
   theResultParameter->data()->blockSendAttributeUpdated(aWasBlocked, false);
 
   std::shared_ptr<ParametersPlugin_Parameter> aParameter =
       std::dynamic_pointer_cast<ParametersPlugin_Parameter>(
           ModelAPI_Feature::feature(theResultParameter));
 
-  std::string anOldName = aParameter->name();
+  std::string anOldName = ModelAPI_Tools::toString(aParameter->name());
   aWasBlocked = aParameter->data()->blockSendAttributeUpdated(true);
-  aParameter->data()->setName(theName);
+  aParameter->data()->setName(ModelAPI_Tools::toWString(theName));
   aParameter->string(ParametersPlugin_Parameter::VARIABLE_ID())->setValue(theName);
   aParameter->data()->blockSendAttributeUpdated(aWasBlocked);
 }
@@ -282,7 +282,7 @@ void ParametersPlugin_EvalListener::processObjectRenamedEvent(
   if (!aParameter.get())
     return;
 
-  std::string aNotActivatedNames;
+  std::wstring aNotActivatedNames;
   if (!ModelAPI_Tools::allDocumentsActivated(aNotActivatedNames)) {
     static const std::string aMsgContext("ParametersPlugin");
     static const std::string aMsgText =
@@ -295,28 +295,28 @@ void ParametersPlugin_EvalListener::processObjectRenamedEvent(
         ModuleBase_Tools::translate(aMsg),
         QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
     if (aRes != QMessageBox::Yes) {
-      setParameterName(aResultParameter, aMessage->oldName());
+      setParameterName(aResultParameter, ModelAPI_Tools::toString(aMessage->oldName()));
       return;
     }
   }
 
   // try to update the parameter feature according the new name
-  setParameterName(aResultParameter, aMessage->newName());
+  setParameterName(aResultParameter, ModelAPI_Tools::toString(aMessage->newName()));
   if (!isValidAttribute(aParameter->string(ParametersPlugin_Parameter::VARIABLE_ID()))) {
     //setParameterName(aResultParameter, aMessage->oldName());
     if (myOldNames.find(aParameter.get()) == myOldNames.end())
-      myOldNames[aParameter.get()] = aMessage->oldName();
+      myOldNames[aParameter.get()] = ModelAPI_Tools::toString(aMessage->oldName());
     return;
   }
 
-  std::string anOldName = aMessage->oldName();
+  std::string anOldName = ModelAPI_Tools::toString(aMessage->oldName());
   if (myOldNames.find(aParameter.get()) != myOldNames.end()) {
     anOldName = myOldNames[aParameter.get()];
     myOldNames.erase(aParameter.get());
     aParameter->execute(); // to enable result because of previously incorrect name
   }
 
-  renameInDependents(aResultParameter, anOldName, aMessage->newName());
+  renameInDependents(aResultParameter, anOldName, ModelAPI_Tools::toString(aMessage->newName()));
 }
 
 void ParametersPlugin_EvalListener::processReplaceParameterEvent(
@@ -341,5 +341,6 @@ void ParametersPlugin_EvalListener::processReplaceParameterEvent(
   double aRealValue = aResultParameter->data()->real(ModelAPI_ResultParameter::VALUE())->value();
   std::string aValue = toStdString(aRealValue);
 
-  renameInDependents(aResultParameter, aResultParameter->data()->name(), aValue);
+  renameInDependents(aResultParameter, ModelAPI_Tools::toString(aResultParameter->data()->name()),
+    aValue);
 }
index 2c793535ed56b797ebe4346fc301c1e426838488..b49507befdee9afa4efdd78ace80d44682e8c243 100644 (file)
@@ -74,11 +74,11 @@ void ParametersPlugin_Parameter::attributeChanged(const std::string& theID)
 void ParametersPlugin_Parameter::updateName()
 {
   std::string aName = string(VARIABLE_ID())->value();
-  data()->setName(aName);
+  data()->setName(ModelAPI_Tools::toWString(aName));
 
   ResultParameterPtr aParam = document()->createParameter(data());
-  std::string anOldName = aParam->data()->name();
-  aParam->data()->setName(aName);
+  std::string anOldName = ModelAPI_Tools::toString(aParam->data()->name());
+  aParam->data()->setName(ModelAPI_Tools::toWString(aName));
   setResult(aParam);
 
 
index 1b47e66b6f6e499403ba88aa3a5dbb0b8137499e..47b5ac0b253fca88c828359b5e7c702f94056f5b 100644 (file)
@@ -71,7 +71,7 @@ bool ParametersPlugin_VariableValidator::isUnique(const AttributePtr& theAttribu
   for (int anIndex = 0, aSize = aDocument->size(ModelAPI_ResultParameter::group());
        anIndex < aSize; ++anIndex) {
     ObjectPtr aParamObj = aDocument->object(ModelAPI_ResultParameter::group(), anIndex);
-    if (aParamObj->data()->name() != theString)
+    if (ModelAPI_Tools::toString(aParamObj->data()->name()) != theString)
       continue;
     ResultParameterPtr aParam = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aParamObj);
     if (!aParam.get())
index 9599697852a0cb1c011d8aec28fc0094e1d6114a..fa31070fa9cf2658e91ebd3e1ecd4b29857d5d91 100644 (file)
@@ -385,7 +385,7 @@ QList<QStringList> ParametersPlugin_WidgetParamsMgr::
         } else {
           if (!theFeatureList.contains(aReferenced)) {
             QStringList aValNames;
-            aValNames << aReferenced->data()->name().c_str();
+            aValNames << QString::fromStdWString(aReferenced->data()->name());
 
             std::string aId = aAttr->attributeType();
             if (aId == ModelAPI_AttributeDouble::typeId()) {
@@ -769,7 +769,7 @@ bool ParametersPlugin_WidgetParamsMgr::hasName(const QString& theName) const
   int aCurrent = myDelegate->editIndex().row();
   int i = 0;
   foreach(FeaturePtr aFeature, myParametersList) {
-    if ((i != aCurrent) && (aFeature->data()->name() == theName.toStdString()))
+    if ((i != aCurrent) && (aFeature->data()->name() == theName.toStdWString()))
       return true;
     i++;
   }
index 7ec0f7e819fc4e75dc90facf860ce915469fddef..7eca187494cff72001c3399f38d4e36d375d5d06 100644 (file)
@@ -193,7 +193,7 @@ bool PartSet_MenuMgr::addViewerMenu(const QMap<QString, QAction*>& theStdActions
             QAction* aAction;
             int i = 0;
             foreach (FeaturePtr aCoins, myCoinsideLines) {
-              QString anItemText = aCoins->data()->name().c_str();
+              QString anItemText = QString::fromStdWString(aCoins->data()->name());
 #ifdef _DEBUG
               if (anIsAttributes[i])
                 anItemText += " [attribute]";
@@ -320,7 +320,7 @@ void PartSet_MenuMgr::onLineDetach(QAction* theAction)
     ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation();
 
     ModuleBase_Operation* anOpAction =
-      new ModuleBase_Operation(tr("Detach %1").arg(aLine->data()->name().c_str()), myModule);
+      new ModuleBase_Operation(tr("Detach %1").arg(QString::fromStdWString(aLine->data()->name())), myModule);
     bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation);
     XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
     // the active nested sketch operation should be aborted unconditionally
index a0eff2c34b011e8f26821d22bb0df2b9553379b9..a91cbc8ce92828151ccd280ab1c3ccc5badef8de 100644 (file)
@@ -94,7 +94,6 @@ void PartSet_OverconstraintListener::getCustomColor(const ObjectPtr& theObject,
     return;
 
   FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
-  std::string aFeatureName = aFeature->data()->name();
 
   if (myConflictingObjects.find(theObject) != myConflictingObjects.end()) {
     theColor = Config_PropManager::color("Visualization", "sketch_overconstraint_color");
@@ -202,7 +201,7 @@ void PartSet_OverconstraintListener::processEvent(
     // This Line's message should not be processed, as the reentrant operation is not for Line
     // It is not enoght of kind, the name should be used, e.g. restarted Lines on auxiliary
     // cirlce sometimes causes previous line change, kind the same, but feature line is different
-    std::string aCurrentFeatureName;
+    std::wstring aCurrentFeatureName;
     ModuleBase_Operation* anOperation =
                 XGUI_Tools::workshop(myWorkshop)->operationMgr()->currentOperation();
     if (anOperation) {
index cebeec5860286f479e302ac951776fa0a5d9d6bb..42117e6c4221592fe65eede4650811c7e8818389 100644 (file)
@@ -1141,7 +1141,7 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation)
     for (; anIt != aLast; anIt++) {
       FeaturePtr aFeature = *anIt;
       if (aFeature.get())
-        anInvalidFeatureNames.append(aFeature->name().c_str());
+        anInvalidFeatureNames.append(QString::fromStdWString(aFeature->name()));
     }
     std::string aPrefixInfo = QString("Invalid features of the sketch will be deleted: %1.\n\n").
                                   arg(anInvalidFeatureNames.join(", ")).toStdString().c_str();
index ac694b1ab550c489cec167c9e907ae90e55556a0..384e05b2f4819271607b96d927a33abd85d47918 100644 (file)
@@ -104,10 +104,10 @@ QVariant PartSet_ObjectNode::data(int theColumn, int theRole) const
         AttributeDoublePtr aValueAttribute =
           aParam->data()->real(ModelAPI_ResultParameter::VALUE());
         QString aVal = QString::number(aValueAttribute->value());
-        QString aTitle = QString(myObject->data()->name().c_str());
+        QString aTitle = QString::fromStdWString(myObject->data()->name());
         return aTitle + " = " + aVal;
       }
-      return myObject->data()->name().c_str();
+      return QString::fromStdWString(myObject->data()->name());
     }
     break;
   case Qt::DecorationRole:
@@ -974,9 +974,9 @@ QVariant PartSet_PartRootNode::data(int theColumn, int theRole) const
       ResultPartPtr aPartRes = getPartResult(myObject);
       if (aPartRes.get()) {
         if (aPartRes->partDoc().get() == NULL)
-          return QString(myObject->data()->name().c_str()) + " (Not loaded)";
+          return QString::fromStdWString(myObject->data()->name()) + " (Not loaded)";
       }
-      return QString(myObject->data()->name().c_str());
+      return QString::fromStdWString(myObject->data()->name());
     }
     case Qt::DecorationRole:
       return ModuleBase_IconFactory::get()->getIcon(myObject);
index 2f4d1a82bdc6755f27c96425a30d82364f7beeb5..76c8e61566cd287be78bc273012f5560eaae313a 100644 (file)
@@ -435,8 +435,9 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute
             continue;
           if (isObject) {
             if (aRef->object() == anObject) {
-              theError = errorMessage(EqualObjects, anObject.get() ? anObject->data()->name() : "",
-                                      theAttribute->id(), aRef->id());
+              theError = errorMessage(EqualObjects,
+                anObject.get() ? ModelAPI_Tools::toString(anObject->data()->name()) : "",
+                theAttribute->id(), aRef->id());
               return false;
             }
           }
@@ -512,8 +513,9 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute
             std::dynamic_pointer_cast<ModelAPI_AttributeReference>(*anAttr);
           // check the object is already presented
           if (aRef->value() == anObject) {
-            theError = errorMessage(EqualObjects, anObject.get() ? anObject->data()->name() : "",
-                                    theAttribute->id(), aRef->id());
+            theError = errorMessage(EqualObjects,
+              anObject.get() ? ModelAPI_Tools::toString(anObject->data()->name()) : "",
+              theAttribute->id(), aRef->id());
             return false;
           }
         }
@@ -608,8 +610,9 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute
             for (int j = 0; j < aRefSelList->size(); j++) {
               if (aCurSelObject == aRefSelList->object(j)) {
                 theError = errorMessage(EqualObjects,
-                              aCurSelObject.get() ? aCurSelObject->data()->name() : "",
-                              theAttribute->id(), aCurSelList->id());
+                  aCurSelObject.get()?
+                  ModelAPI_Tools::toString(aCurSelObject->data()->name()) : "",
+                  theAttribute->id(), aCurSelList->id());
                 return false;
               }
             }
index e4525734c9aa61f1cc6dba535b7a4e544e141dc6..63d2acf647a618d9159a31a40deafc93508d7afc 100644 (file)
@@ -114,8 +114,8 @@ ConePtr addCone(const std::shared_ptr<ModelAPI_Document>& thePart,
                 const ModelHighAPI_Double& theTopRadius,
                 const ModelHighAPI_Double& theHeight)
 {
-  ModelHighAPI_Selection aBasePoint("VERTEX", "PartSet/Origin");
-  ModelHighAPI_Selection anAxis("EDGE", "PartSet/OZ");
+  ModelHighAPI_Selection aBasePoint("VERTEX", L"PartSet/Origin");
+  ModelHighAPI_Selection anAxis("EDGE", L"PartSet/OZ");
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PrimitivesAPI_Cone::ID());
   return ConePtr(new PrimitivesAPI_Cone(aFeature, aBasePoint, anAxis, theBaseRadius,
                                         theTopRadius, theHeight));
index f64f8ed841d4b3fa89f6810385c513f428fe63f5..02ff703bb22aa33978d2491e38354a6e7a9fda3b 100644 (file)
@@ -137,8 +137,8 @@ CylinderPtr addCylinder(const std::shared_ptr<ModelAPI_Document>& thePart,
                         const ModelHighAPI_Double& theRadius,
                         const ModelHighAPI_Double& theHeight)
 {
-  ModelHighAPI_Selection aBasePoint("VERTEX", "PartSet/Origin");
-  ModelHighAPI_Selection anAxis("EDGE", "PartSet/OZ");
+  ModelHighAPI_Selection aBasePoint("VERTEX", L"PartSet/Origin");
+  ModelHighAPI_Selection anAxis("EDGE", L"PartSet/OZ");
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID());
   return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, aBasePoint, anAxis,
                                                 theRadius, theHeight));
@@ -150,8 +150,8 @@ CylinderPtr addCylinder(const std::shared_ptr<ModelAPI_Document>& thePart,
                         const ModelHighAPI_Double& theHeight,
                         const ModelHighAPI_Double& theAngle)
 {
-  ModelHighAPI_Selection aBasePoint("VERTEX", "PartSet/Origin");
-  ModelHighAPI_Selection anAxis("EDGE", "PartSet/OZ");
+  ModelHighAPI_Selection aBasePoint("VERTEX", L"PartSet/Origin");
+  ModelHighAPI_Selection anAxis("EDGE", L"PartSet/OZ");
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID());
   return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, aBasePoint, anAxis,
                                                 theRadius, theHeight, theAngle));
index 13a8b19163716713351fbcda610033417df111dd..e2f6b7e9b58978b72c6609fc0310f842a9da20b4 100644 (file)
@@ -94,7 +94,7 @@ SpherePtr addSphere(const std::shared_ptr<ModelAPI_Document>& thePart,
 SpherePtr addSphere(const std::shared_ptr<ModelAPI_Document>& thePart,
                     const ModelHighAPI_Double& theRadius)
 {
-  ModelHighAPI_Selection aCenterPoint("VERTEX", "PartSet/Origin");
+  ModelHighAPI_Selection aCenterPoint("VERTEX", L"PartSet/Origin");
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PrimitivesAPI_Sphere::ID());
   return SpherePtr(new PrimitivesAPI_Sphere(aFeature, aCenterPoint, theRadius));
 }
index 0af0baf330dfe09992ea95dc3e9e8a57fc14c2b9..9308d1e57b2cb6f88c6e94b13eaf80566f983084 100644 (file)
@@ -101,8 +101,8 @@ TorusPtr addTorus(const std::shared_ptr<ModelAPI_Document>& thePart,
                   const ModelHighAPI_Double& theRadius,
                   const ModelHighAPI_Double& theRingRadius)
 {
-  ModelHighAPI_Selection aBasePoint("VERTEX", "PartSet/Origin");
-  ModelHighAPI_Selection anAxis("EDGE", "PartSet/OZ");
+  ModelHighAPI_Selection aBasePoint("VERTEX", L"PartSet/Origin");
+  ModelHighAPI_Selection anAxis("EDGE", L"PartSet/OZ");
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PrimitivesAPI_Torus::ID());
   return TorusPtr(new PrimitivesAPI_Torus(aFeature, aBasePoint, anAxis, theRadius, theRingRadius));
 }
index e3c4d57e220ff50077ca0698740acd667bb831a3..d31a924236b6a8e11cc01551b358eba9e4bf8832 100644 (file)
@@ -63,7 +63,7 @@ void PrimitivesPlugin_Cone::initAttributes()
     data()->selection(PrimitivesPlugin_Cone::BASE_POINT_ID());
   if (!aCenterPoint->isInitialized()) {
     ObjectPtr aPointObj = ModelAPI_Session::get()->moduleDocument()
-      ->objectByName(ModelAPI_ResultConstruction::group(), "Origin");
+      ->objectByName(ModelAPI_ResultConstruction::group(), L"Origin");
     if (aPointObj.get()) {
       ResultPtr aPointRes = std::dynamic_pointer_cast<ModelAPI_Result>(aPointObj);
       aCenterPoint->setValue(aPointRes, std::shared_ptr<GeomAPI_Shape>());
@@ -74,7 +74,7 @@ void PrimitivesPlugin_Cone::initAttributes()
   AttributeSelectionPtr anAxis = data()->selection(PrimitivesPlugin_Cone::AXIS_ID());
   if (!anAxis->isInitialized()) {
     ObjectPtr anAxisObj = ModelAPI_Session::get()->moduleDocument()
-      ->objectByName(ModelAPI_ResultConstruction::group(), "OZ");
+      ->objectByName(ModelAPI_ResultConstruction::group(), L"OZ");
     if (anAxisObj.get()) {
       ResultPtr anAxisRes = std::dynamic_pointer_cast<ModelAPI_Result>(anAxisObj);
       anAxis->setValue(anAxisRes, std::shared_ptr<GeomAPI_Shape>());
index 9b5e544acf8d7a6b339b041e572f0ce55e35a006..22185dbb5808677d6c289d3ef13f6c39d9ca7d71 100644 (file)
@@ -60,7 +60,7 @@ void PrimitivesPlugin_Cylinder::initAttributes()
   AttributeSelectionPtr aBasePoint = data()->selection(BASE_POINT_ID());
   if (!aBasePoint->isInitialized()) {
     ObjectPtr aPointObj = ModelAPI_Session::get()->moduleDocument()
-      ->objectByName(ModelAPI_ResultConstruction::group(), "Origin");
+      ->objectByName(ModelAPI_ResultConstruction::group(), L"Origin");
     if (aPointObj.get()) {
       ResultPtr aPointRes = std::dynamic_pointer_cast<ModelAPI_Result>(aPointObj);
       aBasePoint->setValue(aPointRes, std::shared_ptr<GeomAPI_Shape>());
@@ -71,7 +71,7 @@ void PrimitivesPlugin_Cylinder::initAttributes()
   AttributeSelectionPtr anAxis = data()->selection(AXIS_ID());
   if (!anAxis->isInitialized()) {
     ObjectPtr anAxisObj = ModelAPI_Session::get()->moduleDocument()
-      ->objectByName(ModelAPI_ResultConstruction::group(), "OZ");
+      ->objectByName(ModelAPI_ResultConstruction::group(), L"OZ");
     if (anAxisObj.get()) {
       ResultPtr anAxisRes = std::dynamic_pointer_cast<ModelAPI_Result>(anAxisObj);
       anAxis->setValue(anAxisRes, std::shared_ptr<GeomAPI_Shape>());
index c9c43d750ec8fa478d4cbe6b9b1b77281cbaa5e3..416cec98626df15f9abed99816384f08eb153a04 100644 (file)
@@ -54,7 +54,7 @@ void PrimitivesPlugin_Sphere::initAttributes()
     data()->selection(PrimitivesPlugin_Sphere::CENTER_POINT_ID());
   if (!aCenterPoint->isInitialized()) {
     ObjectPtr aPointObj = ModelAPI_Session::get()->moduleDocument()
-      ->objectByName(ModelAPI_ResultConstruction::group(), "Origin");
+      ->objectByName(ModelAPI_ResultConstruction::group(), L"Origin");
     if (aPointObj.get()) {
       ResultPtr aPointRes = std::dynamic_pointer_cast<ModelAPI_Result>(aPointObj);
       aCenterPoint->setValue(aPointRes, std::shared_ptr<GeomAPI_Shape>());
index fef286d79ba3419179b585393a9f31cc0f0b5c7f..8404df80150d9fc40f89af5fec521e93981877c6 100644 (file)
@@ -61,7 +61,7 @@ void PrimitivesPlugin_Torus::initAttributes()
     data()->selection(PrimitivesPlugin_Torus::BASE_POINT_ID());
   if (!aCenterPoint->isInitialized()) {
     ObjectPtr aPointObj = ModelAPI_Session::get()->moduleDocument()
-      ->objectByName(ModelAPI_ResultConstruction::group(), "Origin");
+      ->objectByName(ModelAPI_ResultConstruction::group(), L"Origin");
     if (aPointObj.get()) {
       ResultPtr aPointRes = std::dynamic_pointer_cast<ModelAPI_Result>(aPointObj);
       aCenterPoint->setValue(aPointRes, std::shared_ptr<GeomAPI_Shape>());
@@ -72,7 +72,7 @@ void PrimitivesPlugin_Torus::initAttributes()
   AttributeSelectionPtr anAxis = data()->selection(PrimitivesPlugin_Torus::AXIS_ID());
   if (!anAxis->isInitialized()) {
     ObjectPtr anAxisObj = ModelAPI_Session::get()->moduleDocument()
-      ->objectByName(ModelAPI_ResultConstruction::group(), "OZ");
+      ->objectByName(ModelAPI_ResultConstruction::group(), L"OZ");
     if (anAxisObj.get()) {
       ResultPtr anAxisRes = std::dynamic_pointer_cast<ModelAPI_Result>(anAxisObj);
       anAxis->setValue(anAxisRes, std::shared_ptr<GeomAPI_Shape>());
index f6035dc72eb7644ede511c73cae40bd11a8a5f1d..94ce161246bdc3343846270db03f8687ddc028d4 100644 (file)
@@ -410,7 +410,7 @@ Selector_Algo* Selector_Algo::restoreByLab(TDF_Label theLab, TDF_Label theBaseDo
 }
 
 Selector_Algo* Selector_Algo::restoreByName(TDF_Label theLab, TDF_Label theBaseDocLab,
-  std::string theName, const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming,
+  std::wstring theName, const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming,
   Selector_NameGenerator* theNameGenerator, TDF_Label& theContextLab)
 {
   Selector_Algo* aResult = NULL;
index ad512aad964fe2d6f9332b5fdaf09f4f6d9eb9a3..162f0cc24fc144fad9490f4435c236448c2c1f84 100644 (file)
@@ -82,14 +82,14 @@ public:
 
   /// Restores the selected shape by the topological name string.
   /// Returns not empty label of the context.
-  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::wstring theName,
     const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) = 0;
 
   /// Updates the current shape by the stored topological name
   SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) = 0;
 
   /// Returns the naming name of the selection
-  SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) = 0;
+  SELECTOR_EXPORT virtual std::wstring name(Selector_NameGenerator* theNameGenerator) = 0;
   /// Returns the current sub-shape value (null if can not resolve)
   SELECTOR_EXPORT TopoDS_Shape value();
   /// Restores sub-algorithm of a given type by the storage-label
@@ -97,7 +97,7 @@ public:
   /// Restores the selected sub-algorithm by the naming name.
   /// Returns not empty label of the context.
   SELECTOR_EXPORT static Selector_Algo* restoreByName(
-    TDF_Label theLab, TDF_Label theBaseDocLab, std::string theName,
+    TDF_Label theLab, TDF_Label theBaseDocLab, std::wstring theName,
     const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming,
     Selector_NameGenerator* theNameGenerator, TDF_Label& theContextLab);
 
@@ -149,15 +149,15 @@ protected:
     return kSHAPE_TYPE;
   }
   /// string identifier of the weak name in modification or intersection types of algorithm
-  static const std::string& weakNameID()
+  static const std::wstring& weakNameID()
   {
-    static const std::string kWEAK_NAME_IDENTIFIER = "weak_name_";
+    static const std::wstring kWEAK_NAME_IDENTIFIER = L"weak_name_";
     return kWEAK_NAME_IDENTIFIER;
   }
   /// string identifier of the pure weak name
-  static const std::string& pureWeakNameID()
+  static const std::wstring& pureWeakNameID()
   {
-    static const std::string kPURE_WEAK_NAME_IDENTIFIER = "_weak_name_";
+    static const std::wstring kPURE_WEAK_NAME_IDENTIFIER = L"_weak_name_";
     return kPURE_WEAK_NAME_IDENTIFIER;
   }
   /// Stores the type of an algorithm in the data tree (in myLab)
index 44d1b1e92d4c75f4d481ad629125afc2d89673cd..05f8fa2ea3a69543c4565d7cf183c41d9ad10c6f 100644 (file)
@@ -80,7 +80,7 @@ bool Selector_Container::restore()
   return true;
 }
 
-TDF_Label Selector_Container::restoreByName(std::string theName,
+TDF_Label Selector_Container::restoreByName(std::wstring theName,
   const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
 {
   myShapeType = theShapeType;
@@ -99,7 +99,7 @@ TDF_Label Selector_Container::restoreByName(std::string theName,
       }
       if (anEndPos == std::string::npos)
         return TDF_Label(); // invalid parentheses
-      std::string aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
+      std::wstring aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
       TopAbs_ShapeEnum aSubShapeType = TopAbs_FACE;
       switch (myShapeType) {
       case TopAbs_COMPSOLID: aSubShapeType = TopAbs_SOLID; break;
@@ -177,9 +177,9 @@ bool Selector_Container::solve(const TopoDS_Shape& theContext)
   return false;
 }
 
-std::string Selector_Container::name(Selector_NameGenerator* theNameGenerator)
+std::wstring Selector_Container::name(Selector_NameGenerator* theNameGenerator)
 {
-  std::string aResult;
+  std::wstring aResult;
   // add names of sub-components one by one in "[]"
   std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
   for(; aSubSel != list().cend(); aSubSel++) {
index e163ea23ef00433c7db3c9afff3a2ef582db11fc..b29cd5f961cb2155de73ad052c6c5aaf23559650 100644 (file)
@@ -45,14 +45,14 @@ public:
 
   /// Restores the selected shape by the topological name string.
   /// Returns not empty label of the context.
-  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::wstring theName,
     const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
 
   /// Updates the current shape by the stored topological name
   SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
 
   /// Returns the naming name of the selection
-  SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+  SELECTOR_EXPORT virtual std::wstring name(Selector_NameGenerator* theNameGenerator) override;
 private:
   /// Initializes selector
   Selector_Container();
index 7a741402beb6b2b70b206a0ab832eeba5fd61c95..07503640024af02fd252c57a9bcfc22a4c5562c8 100644 (file)
@@ -294,17 +294,17 @@ bool Selector_FilterByNeighbors::restore()
   return myNBLevel.size() == list().size() && !myNBLevel.empty();
 }
 
-TDF_Label Selector_FilterByNeighbors::restoreByName(std::string theName,
+TDF_Label Selector_FilterByNeighbors::restoreByName(std::wstring theName,
   const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
 {
   myShapeType = theShapeType;
   TDF_Label aContext;
-  std::string aLastLevel; // last level string (after '(' )  to check the context name in the end
+  std::wstring aLastLevel; // last level string (after '(' )  to check the context name in the end
   for (size_t aStart = 0; aStart != std::string::npos;
     aStart = theName.find('(', aStart + 1)) {
     size_t anEndPos = theName.find(')', aStart + 1);
     if (anEndPos != std::string::npos) {
-      std::string aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
+      std::wstring aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
       TDF_Label aSubContext;
       Selector_Algo* aSubSel =
         Selector_Algo::restoreByName(newSubLabel(), baseDocument(), aSubStr, myShapeType,
@@ -327,7 +327,7 @@ TDF_Label Selector_FilterByNeighbors::restoreByName(std::string theName,
       //  aContext = theNameGenerator->newestContext(aContext);
 
       // searching for the level index
-      std::string aLevel;
+      std::wstring aLevel;
       for (anEndPos++; anEndPos != std::string::npos &&
         theName[anEndPos] != '(' && theName[anEndPos] != 0;
         anEndPos++) {
@@ -337,7 +337,7 @@ TDF_Label Selector_FilterByNeighbors::restoreByName(std::string theName,
       if (aLevel.empty() || aLevel[0] == '_')
         myNBLevel.push_back(1); // by default it is 1
       else {
-        int aNum = atoi(aLevel.c_str());
+        int aNum = std::stoi(aLevel.c_str());
         if (aNum > 0)
           myNBLevel.push_back(aNum);
         else
@@ -347,9 +347,9 @@ TDF_Label Selector_FilterByNeighbors::restoreByName(std::string theName,
       return TDF_Label(); // invalid parentheses
   }
   if (!aLastLevel.empty()) { // get the context
-    size_t aLinePos = aLastLevel.find("_");
+    size_t aLinePos = aLastLevel.find(L"_");
     if (aLinePos != std::string::npos) {
-      std::string aContextName = aLastLevel.substr(aLinePos + 1);
+      std::wstring aContextName = aLastLevel.substr(aLinePos + 1);
       if (!aContextName.empty()) {
         TDF_Label aThisContext, aValue;
         if (theNameGenerator->restoreContext(aContextName, aThisContext, aValue)) {
@@ -387,23 +387,23 @@ bool Selector_FilterByNeighbors::solve(const TopoDS_Shape& theContext)
   return false;
 }
 
-std::string Selector_FilterByNeighbors::name(Selector_NameGenerator* theNameGenerator)
+std::wstring Selector_FilterByNeighbors::name(Selector_NameGenerator* theNameGenerator)
 {
   // (nb1)level_if_more_than_1(nb2)level_if_more_than_1(nb3)level_if_more_than_1
   bool aThisContextNameNeeded = !myContext.IsNull();
-  std::string aContextName;
+  std::wstring aContextName;
   if (aThisContextNameNeeded)
     aContextName = theNameGenerator->contextName(myContext);
-  std::string aResult;
+  std::wstring aResult;
   std::list<int>::iterator aLevel = myNBLevel.begin();
   std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
   for(; aSubSel != list().cend(); aSubSel++, aLevel++) {
     if (!*aSubSel)
       continue;
-    std::string aSubName = (*aSubSel)->name(theNameGenerator);
-    aResult += "(" + aSubName + ")";
+    std::wstring aSubName = (*aSubSel)->name(theNameGenerator);
+    aResult += L"(" + aSubName + L")";
     if (*aLevel > 1) {
-      std::ostringstream aLevelStr;
+      std::wostringstream aLevelStr;
       aLevelStr<<*aLevel;
       aResult += aLevelStr.str();
     }
@@ -413,7 +413,7 @@ std::string Selector_FilterByNeighbors::name(Selector_NameGenerator* theNameGene
       aThisContextNameNeeded = false;
   }
   if (aThisContextNameNeeded) {
-    aResult = aResult + "_" + aContextName;
+    aResult = aResult + L"_" + aContextName;
   }
   return aResult;
 }
index 527f4d8101ba2dca5c1eef8f58c6767ef40242a4..6cc9364d334f1ad24f4b8170e1c2907d508b0ebd 100644 (file)
@@ -49,14 +49,14 @@ public:
 
   /// Restores the selected shape by the topological name string.
   /// Returns not empty label of the context.
-  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::wstring theName,
     const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
 
   /// Updates the current shape by the stored topological name
   SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
 
   /// Returns the naming name of the selection
-  SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+  SELECTOR_EXPORT virtual std::wstring name(Selector_NameGenerator* theNameGenerator) override;
 private:
   /// Initializes selector
   Selector_FilterByNeighbors();
index 81e54b80a8912931a2519871102f8126127c2e73..07671e2f61305b4ea9e9a640ab0e4ed932b242e7 100644 (file)
@@ -181,7 +181,7 @@ bool Selector_Intersect::restore()
   return true;
 }
 
-TDF_Label Selector_Intersect::restoreByName(std::string theName,
+TDF_Label Selector_Intersect::restoreByName(std::wstring theName,
   const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
 {
   myShapeType = theShapeType;
@@ -189,15 +189,15 @@ TDF_Label Selector_Intersect::restoreByName(std::string theName,
   for(size_t aStart = 0; aStart != std::string::npos; aStart = theName.find('[', aStart + 1)) {
     size_t anEndPos = theName.find(']', aStart + 1);
     if (anEndPos != std::string::npos) {
-      std::string aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
+      std::wstring aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
       if (aSubStr.find(weakNameID()) == 0) { // weak name identifier
-        std::string aWeakIndex = aSubStr.substr(weakNameID().size());
-        myWeakIndex = atoi(aWeakIndex.c_str());
+        std::wstring aWeakIndex = aSubStr.substr(weakNameID().size());
+        myWeakIndex = stoi(aWeakIndex);
         continue;
       }
       TopAbs_ShapeEnum aSubShapeType = TopAbs_FACE;
       if (anEndPos != std::string::npos && anEndPos + 1 < theName.size()) {
-        char aShapeChar = theName[anEndPos + 1];
+        wchar_t aShapeChar = theName[anEndPos + 1];
         if (theName[anEndPos + 1] != '[') {
           switch(aShapeChar) {
           case 'e': aSubShapeType = TopAbs_EDGE; break;
@@ -277,9 +277,9 @@ bool Selector_Intersect::solve(const TopoDS_Shape& theContext)
   return false;
 }
 
-std::string Selector_Intersect::name(Selector_NameGenerator* theNameGenerator)
+std::wstring Selector_Intersect::name(Selector_NameGenerator* theNameGenerator)
 {
-  std::string aResult;
+  std::wstring aResult;
   // add names of sub-components one by one in "[]" +optionally [weak_name_1]
   std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
   for(; aSubSel != list().cend(); aSubSel++) {
@@ -291,15 +291,15 @@ std::string Selector_Intersect::name(Selector_NameGenerator* theNameGenerator)
       TopAbs_ShapeEnum aSubType = aSubVal.ShapeType();
       if (aSubType != TopAbs_FACE) { // in case the sub shape type must be stored
         switch(aSubType) {
-        case TopAbs_EDGE: aResult += "e"; break;
-        case TopAbs_VERTEX: aResult += "v"; break;
+        case TopAbs_EDGE: aResult += L"e"; break;
+        case TopAbs_VERTEX: aResult += L"v"; break;
         default:;
         }
       }
     }
   }
   if (myWeakIndex != -1) {
-    std::ostringstream aWeakStr;
+    std::wostringstream aWeakStr;
     aWeakStr<<"["<<weakNameID()<<myWeakIndex<<"]";
     aResult += aWeakStr.str();
   }
index 89bfbf1f82b8c704d95b87420697623213dac682..0d02db5ac0dd67b6970db1a2f3606524c81f309d 100644 (file)
@@ -45,14 +45,14 @@ public:
 
   /// Restores the selected shape by the topological name string.
   /// Returns not empty label of the context.
-  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::wstring theName,
     const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
 
   /// Updates the current shape by the stored topological name
   SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
 
   /// Returns the naming name of the selection
-  SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+  SELECTOR_EXPORT virtual std::wstring name(Selector_NameGenerator* theNameGenerator) override;
 private:
   /// Initializes selector
   Selector_Intersect();
index c73762a7d96a55e8d8a883336557c9b41e490790..149a8e89dd61d57c6d843b73a5ee13e179345d44 100644 (file)
@@ -240,7 +240,7 @@ bool Selector_Modify::restore()
   return false;
 }
 
-TDF_Label Selector_Modify::restoreByName(std::string theName,
+TDF_Label Selector_Modify::restoreByName(std::wstring theName,
   const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
 {
   TDF_Label aContext;
@@ -248,11 +248,11 @@ TDF_Label Selector_Modify::restoreByName(std::string theName,
     if (aStart != 0)
       aStart++;
     anEnd = theName.find('&', aStart);
-    std::string aSubStr =
+    std::wstring aSubStr =
       theName.substr(aStart, anEnd == std::string::npos ? anEnd : anEnd - aStart);
     if (aSubStr.find(weakNameID()) == 0) { // weak name identifier
-      std::string aWeakIndex = aSubStr.substr(weakNameID().size());
-      myWeakIndex = atoi(aWeakIndex.c_str());
+      std::wstring aWeakIndex = aSubStr.substr(weakNameID().size());
+      myWeakIndex = std::stoi(aWeakIndex.c_str());
       continue;
     }
     TDF_Label aSubContext, aValue;
@@ -323,24 +323,24 @@ bool Selector_Modify::solve(const TopoDS_Shape& theContext)
   return false;
 }
 
-std::string Selector_Modify::name(Selector_NameGenerator* theNameGenerator)
+std::wstring Selector_Modify::name(Selector_NameGenerator* theNameGenerator)
 {
   // final&base1&base2 +optionally: [weak_name_1]
-  std::string aResult;
+  std::wstring aResult;
   Handle(TDataStd_Name) aName;
   if (!myFinal.FindAttribute(TDataStd_Name::GetID(), aName))
-    return "";
-  aResult += theNameGenerator->contextName(myFinal) + "/" +
-    std::string(TCollection_AsciiString(aName->Get()).ToCString());
+    return L"";
+  aResult += theNameGenerator->contextName(myFinal) + L"/";
+  aResult += (wchar_t*)aName->Get().ToExtString();
   for(TDF_LabelList::iterator aBase = myBases.begin(); aBase != myBases.end(); aBase++) {
     if (!aBase->FindAttribute(TDataStd_Name::GetID(), aName))
-      return "";
-    aResult += "&";
-    aResult += theNameGenerator->contextName(*aBase) + "/" +
-      std::string(TCollection_AsciiString(aName->Get()).ToCString());
+      return L"";
+    aResult += L"&";
+    aResult += theNameGenerator->contextName(*aBase) + L"/";
+    aResult += (wchar_t*)aName->Get().ToExtString();
   }
   if (myWeakIndex != -1) {
-    std::ostringstream aWeakStr;
+    std::wostringstream aWeakStr;
     aWeakStr<<"&"<<weakNameID()<<myWeakIndex;
     aResult += aWeakStr.str();
   }
index 63953d2ca8f2e484944ed6e8461d91e8cdfa5845..15d754d44608668f412abb9f84f44f81157324fa 100644 (file)
@@ -51,14 +51,14 @@ public:
 
   /// Restores the selected shape by the topological name string.
   /// Returns not empty label of the context.
-  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::wstring theName,
     const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
 
   /// Updates the current shape by the stored topological name
   SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
 
   /// Returns the naming name of the selection
-  SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+  SELECTOR_EXPORT virtual std::wstring name(Selector_NameGenerator* theNameGenerator) override;
 
 private:
   /// Initializes selector
index 2a819a3ff0a8db6947fb649b51abd772371cb472..564eb7dce602148fe5afff39cdaf812a443dd8e8 100644 (file)
@@ -37,11 +37,11 @@ public:
   Selector_NameGenerator() {};
 
   /// This method returns the context name by the label of the sub-selected shape
-  virtual std::string contextName(const TDF_Label theSelectionLab) = 0;
+  virtual std::wstring contextName(const TDF_Label theSelectionLab) = 0;
 
   /// This method restores by the context and value name the context label and
   /// sub-label where the value is. Returns true if it is valid.
-  virtual bool restoreContext(std::string theName,
+  virtual bool restoreContext(std::wstring theName,
     TDF_Label& theContext, TDF_Label& theValue) = 0;
 
   /// Returns true if the first result is older than the second one in the tree of features
index bb2b1f737d3c8bee0c2351117bbc594d356362a2..6b5706f8b317a3fd2bd230384ba5c397e0ebd78f 100644 (file)
@@ -47,7 +47,7 @@ bool Selector_Primitive::restore()
   return restoreBaseArray(anEmptyRefList, myFinal);
 }
 
-TDF_Label Selector_Primitive::restoreByName(std::string theName,
+TDF_Label Selector_Primitive::restoreByName(std::wstring theName,
   const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
 {
   TDF_Label aContext;
@@ -72,13 +72,15 @@ bool Selector_Primitive::solve(const TopoDS_Shape& theContext)
   return false;
 }
 
-std::string Selector_Primitive::name(Selector_NameGenerator* theNameGenerator)
+std::wstring Selector_Primitive::name(Selector_NameGenerator* theNameGenerator)
 {
   Handle(TDataStd_Name) aName;
   if (!myFinal.FindAttribute(TDataStd_Name::GetID(), aName))
-    return "";
-  std::string aResult = theNameGenerator->contextName(myFinal);
-  if (!aResult.empty())
-    aResult += "/" + std::string(TCollection_AsciiString(aName->Get()).ToCString());
+    return L"";
+  std::wstring aResult = theNameGenerator->contextName(myFinal);
+  if (!aResult.empty()) {
+    aResult += L"/";
+    aResult += ((wchar_t*)aName->Get().ToExtString());
+  }
   return aResult;
 }
index b9d02aba09f3c5784b0e24db042b51bb57773410..deee6d4bdcd233a3156580c91d956df3633bb0e2 100644 (file)
@@ -43,14 +43,14 @@ public:
 
   /// Restores the selected shape by the topological name string.
   /// Returns not empty label of the context.
-  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::wstring theName,
     const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
 
   /// Updates the current shape by the stored topological name
   SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
 
   /// Returns the naming name of the selection
-  SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+  SELECTOR_EXPORT virtual std::wstring name(Selector_NameGenerator* theNameGenerator) override;
 private:
   /// Initializes selector
   Selector_Primitive();
index f10a0d082d6e28e87e2887e1d0fb13915c6a86e4..e0d0f4c3d7dd2d0ec9883ec8123c7517a78c53b4 100644 (file)
@@ -73,12 +73,12 @@ TopoDS_Shape Selector_Selector::value()
   return TopoDS_Shape(); // empty, error shape
 }
 
-std::string Selector_Selector::name(Selector_NameGenerator* theNameGenerator) {
+std::wstring Selector_Selector::name(Selector_NameGenerator* theNameGenerator) {
   return myAlgo->name(theNameGenerator);
 }
 
 TDF_Label Selector_Selector::restoreByName(
-  std::string theName, const TopAbs_ShapeEnum theShapeType,
+  std::wstring theName, const TopAbs_ShapeEnum theShapeType,
   Selector_NameGenerator* theNameGenerator, const bool theGeometricalNaming)
 {
   TDF_Label aResult;
index bb84365c02d431c43e86b5e1fe85254e9afea034..52af8af8463a661d8705a14ab623ff1620294e21 100644 (file)
@@ -66,14 +66,14 @@ public:
   /// Restores the selected shape by the topological name string.
   /// Returns not empty label of the context.
   SELECTOR_EXPORT TDF_Label restoreByName(
-    std::string theName, const TopAbs_ShapeEnum theShapeType,
+    std::wstring theName, const TopAbs_ShapeEnum theShapeType,
     Selector_NameGenerator* theNameGenerator, const bool theGeometricalNaming = false);
 
   /// Returns the current sub-shape value (null if can not resolve)
   SELECTOR_EXPORT TopoDS_Shape value();
 
   /// Returns the naming name of the selection
-  SELECTOR_EXPORT std::string name(Selector_NameGenerator* theNameGenerator);
+  SELECTOR_EXPORT std::wstring name(Selector_NameGenerator* theNameGenerator);
 
   /// Makes the current local selection becomes all sub-shapes with same base geometry.
   SELECTOR_EXPORT void combineGeometrical(const TopoDS_Shape theContext);
index ff74df585591df0f4e46182b85beeeb1176b97f3..6d3ad04552ff95f096623d8b901d39c2630e030a 100644 (file)
@@ -85,16 +85,16 @@ bool Selector_WeakName::restore()
   return restoreBaseArray(anEmptyRefList, myContext);
 }
 
-TDF_Label Selector_WeakName::restoreByName(std::string theName,
+TDF_Label Selector_WeakName::restoreByName(std::wstring theName,
   const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
 {
-  std::string aWeakIndex = theName.substr(pureWeakNameID().size());
-  std::size_t aContextPosition = aWeakIndex.find("_");
-  myWeakIndex = atoi(aWeakIndex.c_str());
+  std::wstring aWeakIndex = theName.substr(pureWeakNameID().size());
+  std::size_t aContextPosition = aWeakIndex.find(L"_");
+  myWeakIndex = std::stoi(aWeakIndex.c_str());
   myShapeType = theShapeType;
   TDF_Label aContext;
-  if (aContextPosition != std::string::npos) { // context is also defined
-    std::string aContextName = aWeakIndex.substr(aContextPosition + 1);
+  if (aContextPosition != std::wstring::npos) { // context is also defined
+    std::wstring aContextName = aWeakIndex.substr(aContextPosition + 1);
     if (theNameGenerator->restoreContext(aContextName, aContext, myContext)) {
       if (myContext.IsNull())
         aContext.Nullify();
@@ -126,13 +126,13 @@ bool Selector_WeakName::solve(const TopoDS_Shape& theContext)
   return false;
 }
 
-std::string Selector_WeakName::name(Selector_NameGenerator* theNameGenerator)
+std::wstring Selector_WeakName::name(Selector_NameGenerator* theNameGenerator)
 {
   // _weak_naming_1_Context
-  std::ostringstream aWeakStr;
+  std::wostringstream aWeakStr;
   aWeakStr<<pureWeakNameID()<<myWeakIndex;
-  std::string aResult = aWeakStr.str();
+  std::wstring aResult = aWeakStr.str();
   if (!myContext.IsNull())
-    aResult += "_" + theNameGenerator->contextName(myContext);
+    aResult += L"_" + theNameGenerator->contextName(myContext);
   return aResult;
 }
index aadf4d1879b7695b67d50a2b9907ac5a697ccce9..2ce456e0e7c4ef509e07586a90fd67cfee848b56 100644 (file)
@@ -45,14 +45,14 @@ public:
 
   /// Restores the selected shape by the topological name string.
   /// Returns not empty label of the context.
-  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+  SELECTOR_EXPORT virtual TDF_Label restoreByName(std::wstring theName,
     const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
 
   /// Updates the current shape by the stored topological name
   SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
 
   /// Returns the naming name of the selection
-  SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+  SELECTOR_EXPORT virtual std::wstring name(Selector_NameGenerator* theNameGenerator) override;
 private:
   /// Initializes selector
   Selector_WeakName();
index 6d113b794dc297e1eb211a20b5d2f023127bbe7e..8a324d8b60cfb09422f69c65ff1c5e3e8fef2333 100644 (file)
@@ -27,6 +27,8 @@
 
   // fix for SWIG v2.0.4
   #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj))
+
+  #define SWIGPY_UNICODE_ARG(obj) ((PyObject*) (obj))
 %}
 
 %include "doxyhelp.i"
 #define SKETCHAPI_EXPORT
 
 // standard definitions
-%include "typemaps.i"
-%include "std_list.i"
 %include "std_pair.i"
-%include "std_shared_ptr.i"
 
 // function with named parameters
 %feature("kwargs") SketchAPI_BSpline::controlPoles;
index d71722b83dd253dafe2ac724d0b97122bec72875..5dd2ca951e0456916dd981f58e98c733a78ab936 100644 (file)
@@ -75,7 +75,7 @@ SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature
 
 //================================================================================================
 SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                             const std::string& theExternalName)
+                             const std::wstring& theExternalName)
 : SketchAPI_SketchEntity(theFeature)
 {
   if (initialize()) {
@@ -126,7 +126,7 @@ void SketchAPI_Arc::setByExternal(const ModelHighAPI_Selection & theExternal)
 }
 
 //===============================================================================================
-void SketchAPI_Arc::setByExternalName(const std::string & theExternalName)
+void SketchAPI_Arc::setByExternalName(const std::wstring & theExternalName)
 {
   fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external());
 
index 69e724dcb1a678f4351ad49e4675fc44f5a512f1..8e3ec44771c9e23c2e7253dc4115855b7eb027ba 100644 (file)
@@ -64,7 +64,7 @@ public:
   /// Constructor with values.
   SKETCHAPI_EXPORT
   SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                const std::string& theExternalName);
+                const std::wstring& theExternalName);
 
   /// Destructor.
   SKETCHAPI_EXPORT
@@ -106,7 +106,7 @@ public:
 
   /// Set by external name.
   SKETCHAPI_EXPORT
-  void setByExternalName(const std::string& theExternalName);
+  void setByExternalName(const std::wstring& theExternalName);
 
   /// Dump wrapped feature
   SKETCHAPI_EXPORT
index c89abac78a995dcfba4af40eacc465f5e4c5638d..2280396c170ce60ac341562fd9701b67ba0e1726 100644 (file)
@@ -30,6 +30,8 @@
 #include <ModelHighAPI_Selection.h>
 #include <ModelHighAPI_Tools.h>
 
+#include <ModelAPI_Tools.h>
+
 #include <SketchPlugin_ConstraintCoincidenceInternal.h>
 #include <SketchPlugin_Line.h>
 #include <SketchPlugin_Point.h>
@@ -152,8 +154,8 @@ static void createPole(const CompositeFeaturePtr& theSketch,
   aPointFeature->reference(SketchPlugin_Point::PARENT_ID())->setValue(theBSpline);
   aPointFeature->execute();
 
-  std::ostringstream aName;
-  aName << theBSpline->name() << "_" << thePoles->id() << "_" << thePoleIndex;
+  std::wostringstream aName;
+  aName << theBSpline->name() << "_" << ModelAPI_Tools::toWString(thePoles->id()) << "_" << thePoleIndex;
   aPointFeature->data()->setName(aName.str());
   aPointFeature->lastResult()->data()->setName(aName.str());
 
@@ -185,7 +187,7 @@ static void createSegment(const CompositeFeaturePtr& theSketch,
   aLineFeature->reference(SketchPlugin_Point::PARENT_ID())->setValue(theBSpline);
   aLineFeature->execute();
 
-  std::ostringstream aName;
+  std::wostringstream aName;
   aName << theBSpline->name() << "_segment_" << theStartPoleIndex << "_" << aEndPoleIndex;
   aLineFeature->data()->setName(aName.str());
   aLineFeature->lastResult()->data()->setName(aName.str());
index c4cd7db1543bd9b49ee1bca78e61f7412145c480..378e5be4b0e39946fba0d7d21efa7751df128b13 100644 (file)
@@ -68,7 +68,7 @@ SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theF
 
 //==================================================================================================
 SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                   const std::string& theExternalName)
+                                   const std::wstring& theExternalName)
 : SketchAPI_SketchEntity(theFeature)
 {
   if (initialize()) {
@@ -110,7 +110,7 @@ void SketchAPI_Circle::setByExternal(const ModelHighAPI_Selection & theExternal)
 }
 
 //==================================================================================================
-void SketchAPI_Circle::setByExternalName(const std::string & theExternalName)
+void SketchAPI_Circle::setByExternalName(const std::wstring & theExternalName)
 {
   fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external());
 
index 839c1e58f0304381b59842012730ac004469237d..c2d59d1271362b85f3d600503f0286b3d5bf68ff 100644 (file)
@@ -58,7 +58,7 @@ public:
   /// Constructor with values.
   SKETCHAPI_EXPORT
   SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                   const std::string& theExternalName);
+                   const std::wstring& theExternalName);
 
   /// Destructor.
   SKETCHAPI_EXPORT
@@ -86,7 +86,7 @@ public:
 
   /// Set by external name.
   SKETCHAPI_EXPORT
-  void setByExternalName(const std::string& theExternalName);
+  void setByExternalName(const std::wstring& theExternalName);
 
   /// Set center.
   SKETCHAPI_EXPORT
index 19de091d4f9c55c158462332dcb330f6cdeea734..d05222b9f52a21b1a73c033531a7a54ea44ad7bb 100644 (file)
 #include <ModelHighAPI_Selection.h>
 #include <ModelHighAPI_Tools.h>
 
+#include <ModelAPI_Tools.h>
+
 #include <SketchPlugin_ConstraintCoincidenceInternal.h>
 #include <SketchPlugin_Line.h>
 #include <SketchPlugin_Point.h>
 
-static const std::string AUXILIARY_VALUE = "aux";
+static const std::wstring AUXILIARY_VALUE = L"aux";
 static const std::string MAJOR_AXIS_ID = "majorAxis";
 static const std::string MINOR_AXIS_ID = "minorAxis";
 
@@ -71,7 +73,7 @@ SketchAPI_Ellipse::SketchAPI_Ellipse(const std::shared_ptr<ModelAPI_Feature>& th
 }
 
 SketchAPI_Ellipse::SketchAPI_Ellipse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                     const std::string& theExternalName)
+                                     const std::wstring& theExternalName)
   : SketchAPI_SketchEntity(theFeature)
 {
   if (initialize()) {
@@ -111,7 +113,7 @@ void SketchAPI_Ellipse::setByExternal(const ModelHighAPI_Selection & theExternal
   execute();
 }
 
-void SketchAPI_Ellipse::setByExternalName(const std::string & theExternalName)
+void SketchAPI_Ellipse::setByExternalName(const std::wstring & theExternalName)
 {
   fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external());
   execute();
@@ -191,7 +193,7 @@ static void createInternalConstraint(const CompositeFeaturePtr& theSketch,
 static void createPoint(const CompositeFeaturePtr& theSketch,
                         const FeaturePtr& theEllipse,
                         const std::string& theCoincident,
-                        const std::string& theAuxOrName,
+                        const std::wstring& theAuxOrName,
                         std::list<FeaturePtr>& theEntities)
 {
   if (theAuxOrName.empty())
@@ -207,7 +209,7 @@ static void createPoint(const CompositeFeaturePtr& theSketch,
   aPointFeature->reference(SketchPlugin_Point::PARENT_ID())->setValue(theEllipse);
   aPointFeature->execute();
 
-  std::string aName = theEllipse->name() + "_" + theCoincident;
+  std::wstring aName = theEllipse->name() + L"_" + ModelAPI_Tools::toWString(theCoincident);
   aPointFeature->data()->setName(aName);
   aPointFeature->lastResult()->data()->setName(aName);
 
@@ -227,7 +229,7 @@ static void createAxis(const CompositeFeaturePtr& theSketch,
                        const FeaturePtr& theEllipse,
                        const std::string& theCoincidentStart,
                        const std::string& theCoincidentEnd,
-                       const std::string& theAuxOrName,
+                       const std::wstring& theAuxOrName,
                        std::list<FeaturePtr>& theEntities)
 {
   if (theAuxOrName.empty())
@@ -248,9 +250,9 @@ static void createAxis(const CompositeFeaturePtr& theSketch,
   aLineFeature->reference(SketchPlugin_Point::PARENT_ID())->setValue(theEllipse);
   aLineFeature->execute();
 
-  std::string aName = theEllipse->name() + "_" +
+  std::wstring aName = theEllipse->name() + L"_" +
       (theCoincidentStart == SketchPlugin_Ellipse::MAJOR_AXIS_START_ID() ?
-       "major_axis" : "minor_axis");
+       L"major_axis" : L"minor_axis");
   aLineFeature->data()->setName(aName);
   aLineFeature->lastResult()->data()->setName(aName);
 
@@ -268,15 +270,15 @@ static void createAxis(const CompositeFeaturePtr& theSketch,
 }
 
 std::list<std::shared_ptr<SketchAPI_SketchEntity> > SketchAPI_Ellipse::construction(
-    const std::string& center,
-    const std::string& firstFocus,
-    const std::string& secondFocus,
-    const std::string& majorAxisStart,
-    const std::string& majorAxisEnd,
-    const std::string& minorAxisStart,
-    const std::string& minorAxisEnd,
-    const std::string& majorAxis,
-    const std::string& minorAxis) const
+    const std::wstring& center,
+    const std::wstring& firstFocus,
+    const std::wstring& secondFocus,
+    const std::wstring& majorAxisStart,
+    const std::wstring& majorAxisEnd,
+    const std::wstring& minorAxisStart,
+    const std::wstring& minorAxisEnd,
+    const std::wstring& majorAxis,
+    const std::wstring& minorAxis) const
 {
   FeaturePtr anEllipse = feature();
 
@@ -294,15 +296,15 @@ std::list<std::shared_ptr<SketchAPI_SketchEntity> > SketchAPI_Ellipse::construct
 std::list<std::shared_ptr<SketchAPI_SketchEntity> > SketchAPI_Ellipse::buildConstructionEntities(
       const FeaturePtr& theEllipse,
       const std::list<PairOfStrings>& theAttributes,
-      const std::string& theCenter,
-      const std::string& theFirstFocus,
-      const std::string& theSecondFocus,
-      const std::string& theMajorAxisStart,
-      const std::string& theMajorAxisEnd,
-      const std::string& theMinorAxisStart,
-      const std::string& theMinorAxisEnd,
-      const std::string& theMajorAxis,
-      const std::string& theMinorAxis)
+      const std::wstring& theCenter,
+      const std::wstring& theFirstFocus,
+      const std::wstring& theSecondFocus,
+      const std::wstring& theMajorAxisStart,
+      const std::wstring& theMajorAxisEnd,
+      const std::wstring& theMinorAxisStart,
+      const std::wstring& theMinorAxisEnd,
+      const std::wstring& theMajorAxis,
+      const std::wstring& theMinorAxis)
 {
   CompositeFeaturePtr aSketch = sketchForFeature(theEllipse);
 
index 598d41356f086267419e656675dca3e6e99c8688..3b726ddb849109de4a1fe738485171b9ac95a989 100644 (file)
@@ -61,7 +61,7 @@ public:
   /// Constructor with external.
   SKETCHAPI_EXPORT
   SketchAPI_Ellipse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                    const std::string& theExternalName);
+                    const std::wstring& theExternalName);
 
   /// Destructor.
   SKETCHAPI_EXPORT
@@ -107,7 +107,7 @@ public:
 
   /// Set by external name.
   SKETCHAPI_EXPORT
-  void setByExternalName(const std::string& theExternalName);
+  void setByExternalName(const std::wstring& theExternalName);
 
   /// Set center.
   SKETCHAPI_EXPORT
@@ -135,15 +135,15 @@ public:
   /// And the name of the feature shows that it is a regular feature.
   SKETCHAPI_EXPORT
   std::list<std::shared_ptr<SketchAPI_SketchEntity> > construction(
-      const std::string& center = std::string(),
-      const std::string& firstFocus = std::string(),
-      const std::string& secondFocus = std::string(),
-      const std::string& majorAxisStart = std::string(),
-      const std::string& majorAxisEnd = std::string(),
-      const std::string& minorAxisStart = std::string(),
-      const std::string& minorAxisEnd = std::string(),
-      const std::string& majorAxis = std::string(),
-      const std::string& minorAxis = std::string()) const;
+      const std::wstring& center = std::wstring(),
+      const std::wstring& firstFocus = std::wstring(),
+      const std::wstring& secondFocus = std::wstring(),
+      const std::wstring& majorAxisStart = std::wstring(),
+      const std::wstring& majorAxisEnd = std::wstring(),
+      const std::wstring& minorAxisStart = std::wstring(),
+      const std::wstring& minorAxisEnd = std::wstring(),
+      const std::wstring& majorAxis = std::wstring(),
+      const std::wstring& minorAxis = std::wstring()) const;
 
   /// Dump wrapped feature
   SKETCHAPI_EXPORT
@@ -175,15 +175,15 @@ private:
   static std::list<std::shared_ptr<SketchAPI_SketchEntity> > buildConstructionEntities(
       const FeaturePtr& theEllipse,
       const std::list<PairOfStrings>& theAttributes,
-      const std::string& theCenter,
-      const std::string& theFirstFocus,
-      const std::string& theSecondFocus,
-      const std::string& theMajorAxisStart,
-      const std::string& theMajorAxisEnd,
-      const std::string& theMinorAxisStart,
-      const std::string& theMinorAxisEnd,
-      const std::string& theMajorAxis,
-      const std::string& theMinorAxis);
+      const std::wstring& theCenter,
+      const std::wstring& theFirstFocus,
+      const std::wstring& theSecondFocus,
+      const std::wstring& theMajorAxisStart,
+      const std::wstring& theMajorAxisEnd,
+      const std::wstring& theMinorAxisStart,
+      const std::wstring& theMinorAxisEnd,
+      const std::wstring& theMajorAxis,
+      const std::wstring& theMinorAxis);
 
   friend class SketchAPI_EllipticArc;
 };
index a3e39a2b65147ab1f21c4fd5f3d20974162e1aea..ad85ec056ea80225202dc12614a84881a6e8a19a 100644 (file)
@@ -74,7 +74,7 @@ SketchAPI_EllipticArc::SketchAPI_EllipticArc(const std::shared_ptr<ModelAPI_Feat
 }
 
 SketchAPI_EllipticArc::SketchAPI_EllipticArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                     const std::string& theExternalName)
+                                     const std::wstring& theExternalName)
   : SketchAPI_SketchEntity(theFeature)
 {
   if (initialize()) {
@@ -125,7 +125,7 @@ void SketchAPI_EllipticArc::setByExternal(const ModelHighAPI_Selection & theExte
   execute();
 }
 
-void SketchAPI_EllipticArc::setByExternalName(const std::string & theExternalName)
+void SketchAPI_EllipticArc::setByExternalName(const std::wstring & theExternalName)
 {
   fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external());
   execute();
@@ -178,15 +178,15 @@ static const std::list<PairOfStrings>& ellipticArcAttrAndDumpNames()
 }
 
 std::list<std::shared_ptr<SketchAPI_SketchEntity> > SketchAPI_EllipticArc::construction(
-    const std::string& center,
-    const std::string& firstFocus,
-    const std::string& secondFocus,
-    const std::string& majorAxisStart,
-    const std::string& majorAxisEnd,
-    const std::string& minorAxisStart,
-    const std::string& minorAxisEnd,
-    const std::string& majorAxis,
-    const std::string& minorAxis) const
+    const std::wstring& center,
+    const std::wstring& firstFocus,
+    const std::wstring& secondFocus,
+    const std::wstring& majorAxisStart,
+    const std::wstring& majorAxisEnd,
+    const std::wstring& minorAxisStart,
+    const std::wstring& minorAxisEnd,
+    const std::wstring& majorAxis,
+    const std::wstring& minorAxis) const
 {
   FeaturePtr anEllipse = feature();
 
index dea054449754f58f4977ba8b28ae5d40a539cb59..3749936b689b339033cf93380a95314ae56095a0 100644 (file)
@@ -63,7 +63,7 @@ public:
   /// Constructor with external.
   SKETCHAPI_EXPORT
   SketchAPI_EllipticArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                        const std::string& theExternalName);
+                        const std::wstring& theExternalName);
 
   /// Destructor.
   SKETCHAPI_EXPORT
@@ -119,7 +119,7 @@ public:
 
   /// Set by external name.
   SKETCHAPI_EXPORT
-  void setByExternalName(const std::string& theExternalName);
+  void setByExternalName(const std::wstring& theExternalName);
 
   /// Set center.
   SKETCHAPI_EXPORT
@@ -143,15 +143,15 @@ public:
   /// And the name of the feature shows that it is a regular feature.
   SKETCHAPI_EXPORT
   std::list<std::shared_ptr<SketchAPI_SketchEntity> > construction(
-      const std::string& center = std::string(),
-      const std::string& firstFocus = std::string(),
-      const std::string& secondFocus = std::string(),
-      const std::string& majorAxisStart = std::string(),
-      const std::string& majorAxisEnd = std::string(),
-      const std::string& minorAxisStart = std::string(),
-      const std::string& minorAxisEnd = std::string(),
-      const std::string& majorAxis = std::string(),
-      const std::string& minorAxis = std::string()) const;
+      const std::wstring& center = std::wstring(),
+      const std::wstring& firstFocus = std::wstring(),
+      const std::wstring& secondFocus = std::wstring(),
+      const std::wstring& majorAxisStart = std::wstring(),
+      const std::wstring& majorAxisEnd = std::wstring(),
+      const std::wstring& minorAxisStart = std::wstring(),
+      const std::wstring& minorAxisEnd = std::wstring(),
+      const std::wstring& majorAxis = std::wstring(),
+      const std::wstring& minorAxis = std::wstring()) const;
 
   /// Dump wrapped feature
   SKETCHAPI_EXPORT
index e4732fbda8b5ba74f3c8c94c88927d69f4fbed2f..0faeee6ba0e7c055d657021c2be314af9303fadd 100644 (file)
@@ -47,7 +47,7 @@ SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint(
 
 SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint(
     const std::shared_ptr<ModelAPI_Feature> & theFeature,
-    const std::string & theExternalName )
+    const std::wstring & theExternalName )
 : SketchAPI_SketchEntity(theFeature)
 {
   if (initialize()) {
@@ -68,7 +68,7 @@ void SketchAPI_IntersectionPoint::setByExternalEdge(const ModelHighAPI_Selection
   execute();
 }
 
-void SketchAPI_IntersectionPoint::setByExternalEdgeName(const std::string & theExternalLineName)
+void SketchAPI_IntersectionPoint::setByExternalEdgeName(const std::wstring & theExternalLineName)
 {
   fillAttribute(ModelHighAPI_Selection("EDGE", theExternalLineName), externalFeature());
 
index c85c8a24f258576b40b7086ef92d06d6b6188e2c..970bd8af4162c08fbcd805f122d838527159af28 100644 (file)
@@ -46,7 +46,7 @@ public:
   /// Constructor with values
   SKETCHAPI_EXPORT
   SketchAPI_IntersectionPoint(const std::shared_ptr<ModelAPI_Feature> & theFeature,
-                 const std::string & theExternalName);
+                 const std::wstring & theExternalName);
   /// Destructor
   SKETCHAPI_EXPORT
   virtual ~SketchAPI_IntersectionPoint();
@@ -66,7 +66,7 @@ public:
 
   /// Set by external name
   SKETCHAPI_EXPORT
-  void setByExternalEdgeName(const std::string & theExternalEdgeName);
+  void setByExternalEdgeName(const std::wstring & theExternalEdgeName);
 
   /// Set flag to include projection to result or not
   SKETCHAPI_EXPORT
index 9afa4cce3cec188fd7131693a697eddb38351c3f..fbfdece72c80f1186bf19ce92af7057f65629fcb 100644 (file)
@@ -65,7 +65,7 @@ SketchAPI_Line::SketchAPI_Line(
 
 SketchAPI_Line::SketchAPI_Line(
     const std::shared_ptr<ModelAPI_Feature> & theFeature,
-    const std::string & theExternalName )
+    const std::wstring & theExternalName )
 : SketchAPI_SketchEntity(theFeature)
 {
   if (initialize()) {
@@ -105,7 +105,7 @@ void SketchAPI_Line::setByExternal(const ModelHighAPI_Selection & theExternal)
   execute();
 }
 
-void SketchAPI_Line::setByExternalName(const std::string & theExternalName)
+void SketchAPI_Line::setByExternalName(const std::wstring & theExternalName)
 {
   fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external());
 
index c34db1b741759b198b3b0aedbd2424b43efe88e9..0d0afda1e35820abf1650c9a672dc05ff34c5c3c 100644 (file)
@@ -57,7 +57,7 @@ public:
   /// Constructor with values
   SKETCHAPI_EXPORT
   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
-                 const std::string & theExternalName);
+                 const std::wstring & theExternalName);
   /// Destructor
   SKETCHAPI_EXPORT
   virtual ~SketchAPI_Line();
@@ -86,7 +86,7 @@ public:
 
   /// Set by external name
   SKETCHAPI_EXPORT
-  void setByExternalName(const std::string & theExternalName);
+  void setByExternalName(const std::wstring & theExternalName);
 
   /// Set start point
   SKETCHAPI_EXPORT
index 2a5344db55e6de6c1282e8253147c1e4034fc03b..ee4e3ec44f185aa588e32e288347d356f86fc439 100644 (file)
@@ -64,7 +64,7 @@ SketchAPI_Point::SketchAPI_Point(
 
 SketchAPI_Point::SketchAPI_Point(
     const std::shared_ptr<ModelAPI_Feature> & theFeature,
-    const std::string & theExternalName )
+    const std::wstring & theExternalName )
 : SketchAPI_SketchEntity(theFeature)
 {
   if (initialize()) {
@@ -101,7 +101,7 @@ void SketchAPI_Point::setByExternal(const ModelHighAPI_Selection & theExternal)
   execute();
 }
 
-void SketchAPI_Point::setByExternalName(const std::string & theExternalName)
+void SketchAPI_Point::setByExternalName(const std::wstring & theExternalName)
 {
   fillAttribute(ModelHighAPI_Selection("VERTEX", theExternalName), external());
 
index e9940ac741f6655c5a51ea2fbad0fac5d4e60bae..b1cac1407889e5225bdf4dbba9673f724a5dc4ca 100644 (file)
@@ -56,7 +56,7 @@ public:
   /// Constructor with values
   SKETCHAPI_EXPORT
   SketchAPI_Point(const std::shared_ptr<ModelAPI_Feature> & theFeature,
-                 const std::string & theExternalName);
+                 const std::wstring & theExternalName);
   /// Destructor
   SKETCHAPI_EXPORT
   virtual ~SketchAPI_Point();
@@ -82,7 +82,7 @@ public:
 
   /// Set by external name
   SKETCHAPI_EXPORT
-  void setByExternalName(const std::string & theExternalName);
+  void setByExternalName(const std::wstring & theExternalName);
 
   /// Dump wrapped feature
   SKETCHAPI_EXPORT
index aa94fa895e1b89607d0198dafb243b84d94f2ef9..06c36fa664b988d209e606d75147ae6b6a9462e2 100644 (file)
@@ -58,7 +58,7 @@ SketchAPI_Projection::SketchAPI_Projection(
 
 SketchAPI_Projection::SketchAPI_Projection(
     const std::shared_ptr<ModelAPI_Feature> & theFeature,
-    const std::string & theExternalName)
+    const std::wstring & theExternalName)
 : SketchAPI_SketchEntity(theFeature)
 {
   if (initialize()) {
@@ -79,7 +79,7 @@ void SketchAPI_Projection::setExternalFeature(const ModelHighAPI_Selection & the
   execute(true);
 }
 
-void SketchAPI_Projection::setByExternalName(const std::string& theExternalName)
+void SketchAPI_Projection::setByExternalName(const std::wstring& theExternalName)
 {
   setExternalFeature(ModelHighAPI_Selection("EDGE", theExternalName));
 }
index 02fb43f7e0971464e375dcc04e098cc4f48827ed..3a16dbc4a69070fb7814286f8a7eae95b976cd58 100644 (file)
@@ -46,7 +46,7 @@ public:
   /// Constructor with values
   SKETCHAPI_EXPORT
   SketchAPI_Projection(const std::shared_ptr<ModelAPI_Feature> & theFeature,
-                       const std::string & theExternalName);
+                       const std::wstring & theExternalName);
   /// Destructor
   SKETCHAPI_EXPORT
   virtual ~SketchAPI_Projection();
@@ -68,7 +68,7 @@ public:
 
   /// Set by external name
   SKETCHAPI_EXPORT
-  void setByExternalName(const std::string & theExternalName);
+  void setByExternalName(const std::wstring & theExternalName);
 
   /// Set flag to include projection to result or not
   SKETCHAPI_EXPORT
index 6ce7550f005e1bad1fda95aec479f5972fcd4e47..e576a6b4bd9b6379bd5bd78f83ba807b4a148918 100644 (file)
@@ -220,7 +220,7 @@ SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
 }
 
 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
-                    const std::string & theExternalName)
+                    const std::wstring & theExternalName)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(SketchAPI_Sketch::ID());
   return SketchPtr(
@@ -346,7 +346,7 @@ std::shared_ptr<SketchAPI_Point>
     compositeFeature()->addFeature(SketchPlugin_Point::ID());
   return PointPtr(new SketchAPI_Point(aFeature, theExternal));
 }
-std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(const std::string & theExternalName)
+std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(const std::wstring & theExternalName)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_Point::ID());
@@ -365,7 +365,7 @@ std::shared_ptr<SketchAPI_IntersectionPoint> SketchAPI_Sketch::addIntersectionPo
   return anIntersection;
 }
 std::shared_ptr<SketchAPI_IntersectionPoint> SketchAPI_Sketch::addIntersectionPoint(
-    const std::string & theExternalName,
+    const std::wstring & theExternalName,
     bool theKeepResult)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
@@ -398,7 +398,7 @@ std::shared_ptr<SketchAPI_Line>
     compositeFeature()->addFeature(SketchPlugin_Line::ID());
   return LinePtr(new SketchAPI_Line(aFeature, theExternal));
 }
-std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(const std::string & theExternalName)
+std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(const std::wstring & theExternalName)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_Line::ID());
@@ -490,7 +490,7 @@ std::shared_ptr<SketchAPI_Circle>
   return CirclePtr(new SketchAPI_Circle(aFeature, theExternal));
 }
 
-std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(const std::string & theExternalName)
+std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(const std::wstring & theExternalName)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_Circle::ID());
@@ -584,7 +584,7 @@ std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const ModelHighAPI_Selec
   return ArcPtr(new SketchAPI_Arc(aFeature, theExternal));
 }
 
-std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const std::string & theExternalName)
+std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const std::wstring & theExternalName)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
     compositeFeature()->addFeature(SketchPlugin_Arc::ID());
@@ -659,7 +659,7 @@ std::shared_ptr<SketchAPI_Ellipse> SketchAPI_Sketch::addEllipse(
 }
 
 std::shared_ptr<SketchAPI_Ellipse> SketchAPI_Sketch::addEllipse(
-    const std::string & theExternalName)
+    const std::wstring & theExternalName)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
       compositeFeature()->addFeature(SketchPlugin_Ellipse::ID());
@@ -710,7 +710,7 @@ std::shared_ptr<SketchAPI_EllipticArc> SketchAPI_Sketch::addEllipticArc(
 }
 
 std::shared_ptr<SketchAPI_EllipticArc> SketchAPI_Sketch::addEllipticArc(
-    const std::string & theExternalName)
+    const std::wstring & theExternalName)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
       compositeFeature()->addFeature(SketchPlugin_EllipticArc::ID());
@@ -806,7 +806,7 @@ std::shared_ptr<SketchAPI_Projection> SketchAPI_Sketch::addProjection(
 }
 
 std::shared_ptr<SketchAPI_Projection> SketchAPI_Sketch::addProjection(
-    const std::string & theExternalName,
+    const std::wstring & theExternalName,
     bool theKeepResult)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature =
@@ -1472,7 +1472,7 @@ void SketchAPI_Sketch::dump(ModelHighAPI_Dumper& theDumper) const
         aBase->attribute(SketchPlugin_Sketch::DIRX_ID()))->dir();
 
     // Check the plane is coordinate plane
-    std::string aPlaneName = defaultPlane(anOrigin, aNormal, aDirX);
+    std::wstring aPlaneName = defaultPlane(anOrigin, aNormal, aDirX);
     if(anExternal->context()) { // checking for selected planes
       if (!aPlaneName.empty()
           && anExternal->context()->data()
index 11b6ed91fb41b9a19df53c7d6f276bcbcd5e174c..b2e8076d6cbfc0d64a43c4e1a06707ec01a0b87a 100644 (file)
@@ -139,7 +139,7 @@ public:
   std::shared_ptr<SketchAPI_Point> addPoint(const ModelHighAPI_Selection & theExternal);
   /// Add point
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Point> addPoint(const std::string & theExternalName);
+  std::shared_ptr<SketchAPI_Point> addPoint(const std::wstring & theExternalName);
 
   /// Add intersection point
   SKETCHAPI_EXPORT
@@ -149,7 +149,7 @@ public:
   /// Add point
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_IntersectionPoint>
-    addIntersectionPoint(const std::string & theExternalName,
+    addIntersectionPoint(const std::wstring & theExternalName,
                          bool theKeepResult = false);
 
   /// Add line
@@ -166,7 +166,7 @@ public:
   std::shared_ptr<SketchAPI_Line> addLine(const ModelHighAPI_Selection & theExternal);
   /// Add line
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Line> addLine(const std::string & theExternalName);
+  std::shared_ptr<SketchAPI_Line> addLine(const std::wstring & theExternalName);
 
   /// Add rectangle
   SKETCHAPI_EXPORT
@@ -215,7 +215,7 @@ public:
   std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
   /// Add circle
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Circle> addCircle(const std::string & theExternalName);
+  std::shared_ptr<SketchAPI_Circle> addCircle(const std::wstring & theExternalName);
 
   /// Add arc
   SKETCHAPI_EXPORT
@@ -269,7 +269,7 @@ public:
 
   /// Add arc
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Arc> addArc(const std::string & theExternalName);
+  std::shared_ptr<SketchAPI_Arc> addArc(const std::wstring & theExternalName);
 
   /// Add ellipse
   SKETCHAPI_EXPORT
@@ -302,7 +302,7 @@ public:
   std::shared_ptr<SketchAPI_Ellipse> addEllipse(const ModelHighAPI_Selection & theExternal);
   /// Add ellipse
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Ellipse> addEllipse(const std::string & theExternalName);
+  std::shared_ptr<SketchAPI_Ellipse> addEllipse(const std::wstring & theExternalName);
 
   /// Add elliptic arc
   SKETCHAPI_EXPORT
@@ -325,7 +325,7 @@ public:
   std::shared_ptr<SketchAPI_EllipticArc> addEllipticArc(const ModelHighAPI_Selection & theExternal);
   /// Add elliptic arc
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_EllipticArc> addEllipticArc(const std::string & theExternalName);
+  std::shared_ptr<SketchAPI_EllipticArc> addEllipticArc(const std::wstring & theExternalName);
 
   /// Add B-spline
   SKETCHAPI_EXPORT
@@ -346,7 +346,7 @@ public:
 
   /// Add projection
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Projection> addProjection(const std::string & theExternalName,
+  std::shared_ptr<SketchAPI_Projection> addProjection(const std::wstring & theExternalName,
                                                       bool theKeepResult = false);
 
   /// Add mirror
@@ -581,7 +581,7 @@ SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
  */
 SKETCHAPI_EXPORT
 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
-                    const std::string & theExternalName);
+                    const std::wstring & theExternalName);
 
 /**\ingroup CPPHighAPI
  * \brief Create Sketch feature
index 48158f1a826c86f48da608976153abbee07f3261..da799bd6c3309d3257d99cbbf826054ecb5f8a07 100644 (file)
@@ -33,6 +33,7 @@
 #include <ModelAPI_Events.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Tools.h>
 
 #include <GeomDataAPI_Point2DArray.h>
 
@@ -265,10 +266,10 @@ void SketchPlugin_MacroBSpline::assignDefaultNameForAux(FeaturePtr theAuxFeature
 {
   FeaturePtr aBSpline = ModelAPI_Feature::feature(theBSplinePoles->owner());
 
-  std::ostringstream aName;
+  std::wostringstream aName;
   aName << aBSpline->name();
   if (theAuxFeature->getKind() == SketchPlugin_Point::ID())
-    aName << "_" << theBSplinePoles->id() << "_" << thePoleIndex1;
+    aName << "_" << ModelAPI_Tools::toWString(theBSplinePoles->id()) << "_" << thePoleIndex1;
   else
     aName << "_segment_" << thePoleIndex1 << "_" << thePoleIndex2;
 
index 839d3d96193df5376033321f5c030850cac60442..3f313b1622725494ab49cc4ce2b7b57ed81060a5 100644 (file)
@@ -413,7 +413,7 @@ FeaturePtr SketchPlugin_Sketch::addUniqueNamedCopiedFeature(FeaturePtr theFeatur
 {
   FeaturePtr aNewFeature = theSketch->addFeature(theFeature->getKind());
   // addFeature generates a unique name for the feature, it caches the name
-  std::string aUniqueFeatureName = aNewFeature->data()->name();
+  std::wstring aUniqueFeatureName = aNewFeature->data()->name();
   // all attribute values are copied\pasted to the new feature, name is not an exception
   theFeature->data()->copyTo(aNewFeature->data());
   // external state should not be copied as a new object is an object of the current sketch
@@ -582,9 +582,9 @@ void  SketchPlugin_Sketch::updateCoordinateAxis(ObjectPtr theSub, GeomAx3Ptr the
     return;
 
   DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-  ObjectPtr anOX = aRootDoc->objectByName(ModelAPI_ResultConstruction::group(), "OX");
-  ObjectPtr anOY = aRootDoc->objectByName(ModelAPI_ResultConstruction::group(), "OY");
-  ObjectPtr anOZ = aRootDoc->objectByName(ModelAPI_ResultConstruction::group(), "OZ");
+  ObjectPtr anOX = aRootDoc->objectByName(ModelAPI_ResultConstruction::group(), L"OX");
+  ObjectPtr anOY = aRootDoc->objectByName(ModelAPI_ResultConstruction::group(), L"OY");
+  ObjectPtr anOZ = aRootDoc->objectByName(ModelAPI_ResultConstruction::group(), L"OZ");
 
   AttributeSelectionPtr anExtFeature;
   if (aFeature->getKind() == SketchPlugin_Projection::ID())
index 24ce8f58287c52ea56e03af49f871db1a283165e..43246f9a6ecfafa82957863cab2b08179d12ed4f 100644 (file)
@@ -228,8 +228,8 @@ static void renameByParent(FeaturePtr theOld, FeaturePtr theNew)
 
   AttributeReferencePtr aNewParentRef = theNew->reference(SketchPlugin_SketchEntity::PARENT_ID());
 
-  std::string anOldName = anOldParentRef->value()->data()->name();
-  std::string aNewName = aNewParentRef->value()->data()->name();
+  std::wstring anOldName = anOldParentRef->value()->data()->name();
+  std::wstring aNewName = aNewParentRef->value()->data()->name();
 
   // substitute name of old parent by the new one
   theNew->data()->setName(theOld->name());
@@ -282,14 +282,14 @@ static void copyFeature(const FeaturePtr theFeature,
   renameByParent(theFeature, aNewFeature);
 }
 
-static int index(const std::string& theName, const std::string& thePrefix)
+static int index(const std::wstring& theName, const std::wstring& thePrefix)
 {
   int anIndex = -1;
   if (theName.find(thePrefix) == 0) {
     anIndex = 0;
     if (theName[thePrefix.size()] == '_') {
-      std::string anIndexStr = theName.substr(thePrefix.size() + 1);
-      anIndex = std::atoi(anIndexStr.c_str());
+      std::wstring anIndexStr = theName.substr(thePrefix.size() + 1);
+      anIndex = std::stoi(anIndexStr);
     }
   }
   return anIndex;
@@ -326,8 +326,8 @@ void SketchPlugin_SketchCopy::execute()
   aNewSketch->execute();
 
   // check number of copies of the selected sketch before name the new sketch
-  static const std::string SKETCH_NAME_SUFFIX("_Copy");
-  std::string aSketchName = aBaseSketch->name() + SKETCH_NAME_SUFFIX;
+  static const std::wstring SKETCH_NAME_SUFFIX(L"_Copy");
+  std::wstring aSketchName = aBaseSketch->name() + SKETCH_NAME_SUFFIX;
   int aNewSketchIndex = 0;
   std::list<FeaturePtr> aFeatures = document()->allFeatures();
   for (std::list<FeaturePtr>::iterator aFIt = aFeatures.begin(); aFIt != aFeatures.end(); ++aFIt) {
@@ -340,7 +340,7 @@ void SketchPlugin_SketchCopy::execute()
     if (anIndex >= aNewSketchIndex)
       aNewSketchIndex = anIndex + 1;
   }
-  std::ostringstream aNameStream;
+  std::wostringstream aNameStream;
   aNameStream << aSketchName;
   if (aNewSketchIndex > 0)
     aNameStream << '_' << aNewSketchIndex;
index 62dad8c5fd74ef09b9ba09aaec9dd06b41c06229..f6b5b88ecbb05aad21672763f04af19e6bc615a1 100644 (file)
@@ -1389,7 +1389,7 @@ std::string SketchPlugin_Split::getFeatureInfo(const std::shared_ptr<ModelAPI_Fe
   }
 
   if (theFeature->data()->isValid())
-    anInfo.append(theFeature->data()->name().c_str());
+    anInfo.append(ModelAPI_Tools::toString(theFeature->data()->name()));
 
   if (isUseAttributesInfo) {
     std::string aPointsInfo = ModelGeomAlgo_Point2D::getPontAttributesInfo(theFeature,
index 68765a14e9620b12df1d15b5c1c00f9648d186a1..d75d6fe251e30e85075702d23ac6349238b85602 100644 (file)
@@ -37,6 +37,7 @@
 #include <SketcherPrs_Tools.h>
 
 #include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_Tools.h>
 
 #include <ModelGeomAlgo_Point2D.h>
 #include <ModelGeomAlgo_Shape.h>
@@ -463,7 +464,8 @@ void createAuxiliaryPointOnEllipse(const FeaturePtr& theEllipseFeature,
   aCoord->setValue(anElPoint->x(), anElPoint->y());
 
   aPointFeature->execute();
-  std::string aName = theEllipseFeature->name() + "_" + theEllipsePoint;
+  std::wstring aName = theEllipseFeature->name() + L"_" +
+    ModelAPI_Tools::toWString(theEllipsePoint);
   aPointFeature->data()->setName(aName);
   aPointFeature->lastResult()->data()->setName(aName);
 
@@ -496,8 +498,8 @@ void createAuxiliaryAxisOfEllipse(const FeaturePtr& theEllipseFeature,
   aLineEnd->setValue(aEndPoint->x(), aEndPoint->y());
 
   aLineFeature->execute();
-  std::string aName = theEllipseFeature->name() + "_" +
-    (theStartPoint == SketchPlugin_Ellipse::MAJOR_AXIS_START_ID() ? "major_axis" : "minor_axis");
+  std::wstring aName = theEllipseFeature->name() + L"_" +
+    (theStartPoint == SketchPlugin_Ellipse::MAJOR_AXIS_START_ID() ? L"major_axis" : L"minor_axis");
   aLineFeature->data()->setName(aName);
   aLineFeature->lastResult()->data()->setName(aName);
 
@@ -564,13 +566,13 @@ void setDimensionColor(const AISObjectPtr& theDimPrs)
     theDimPrs->setColor(aColor[0], aColor[1], aColor[2]);
 }
 
-void replaceInName(ObjectPtr theObject, const std::string& theSource, const std::string& theDest)
+void replaceInName(ObjectPtr theObject, const std::wstring& theSource, const std::wstring& theDest)
 {
-  std::string aName = theObject->data()->name();
+  std::wstring aName = theObject->data()->name();
   size_t aPos = aName.find(theSource);
   if (aPos != std::string::npos) {
-    std::string aNewName = aName.substr(0, aPos) + theDest
-                         + aName.substr(aPos + theSource.size());
+    std::wstring aNewName = aName.substr(0, aPos) + theDest
+                          + aName.substr(aPos + theSource.size());
     theObject->data()->setName(aNewName);
   }
 }
index 1a12945c955a508a0c5a81a82266aa2bea2b9725..f9fabe53421b34186b69bbe55548c06c4a65aaee 100644 (file)
@@ -147,7 +147,7 @@ void customizeFeaturePrs(const AISObjectPtr& thePrs, bool isAxiliary);
 void setDimensionColor(const AISObjectPtr& theDimPrs);
 
 /// Replace string in the name of object
-void replaceInName(ObjectPtr theObject, const std::string& theSource, const std::string& theDest);
+void replaceInName(ObjectPtr theObject, const std::wstring& theSource, const std::wstring& theDest);
 
 }; // namespace SketchPlugin_Tools
 
index f9107bc4f9f2f7c55c4d499195bc565abd5b2847..200723dc12f8204aebb4a2349ec17294233a5c09 100644 (file)
@@ -318,7 +318,7 @@ bool SketchPlugin_NotFixedValidator::isValid(const AttributePtr& theAttribute,
     if (aRefAttr->isObject()) {
       if (aRefAttr->object() == aRAttr->object()) {
         ObjectPtr anObject = aRefAttr->object();
-        std::string aName = anObject.get() ? anObject->data()->name() : "";
+        std::wstring aName = anObject.get() ? anObject->data()->name() : L"";
         theError = "The object %1 has been already fixed.";
         theError.arg(aName);
         return false;
@@ -326,7 +326,7 @@ bool SketchPlugin_NotFixedValidator::isValid(const AttributePtr& theAttribute,
     }
     else if (aRefAttr->attr() == aRAttr->attr()) {
       AttributePtr anAttribute = aRefAttr->attr();
-      std::string aName = anAttribute.get() ? anAttribute->id() : "";
+      std::wstring aName = anAttribute.get() ? ModelAPI_Tools::toWString(anAttribute->id()) : L"";
       theError = "The attribute %1 has been already fixed.";
       theError.arg(aName);
       return false;
@@ -423,7 +423,7 @@ bool SketchPlugin_MirrorAttrValidator::isValid(const AttributePtr& theAttribute,
       return false;
     }
 
-    std::string aName = aSelObject.get() ? aSelObject->data()->name() : "";
+    std::wstring aName = aSelObject.get() ? aSelObject->data()->name() : L"";
     std::list<ObjectPtr>::iterator aMirIter = aMirroredObjects.begin();
     for (; aMirIter != aMirroredObjects.end(); aMirIter++)
       if (aSelObject == *aMirIter) {
@@ -542,7 +542,7 @@ bool SketchPlugin_CopyValidator::isValid(const AttributePtr& theAttribute,
     anObjIter = aCopiedObjects.begin();
     for (; anObjIter != aCopiedObjects.end(); anObjIter++)
       if (aSelObject == *anObjIter) {
-        std::string aName = aSelObject.get() ? aSelObject->data()->name() : "";
+        std::wstring aName = aSelObject.get() ? aSelObject->data()->name() : L"";
         theError = "The object %1 is a result of copy";
         theError.arg(aName);
         return false;
index 7e690a0f1d1acf6a414c13d839b025026c5ce885..6629f95c1f8ca0d44bec484c3712cf91a0820715 100644 (file)
@@ -206,7 +206,7 @@ bool XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS,
 
     int aDispMode = isShading? Shading : Wireframe;
     anAISIO->SetDisplayMode(aDispMode);
-    aContext->Display(anAISIO, aDispMode, 0, false, true, AIS_DS_Displayed);
+    aContext->Display(anAISIO, aDispMode, 0, false, AIS_DS_Displayed);
     #ifdef TINSPECTOR
     if (getCallBack()) getCallBack()->Display(anAISIO);
     #endif
@@ -703,7 +703,7 @@ bool XGUI_Displayer::displayAIS(AISObjectPtr theAIS, const bool toActivateInSele
   Handle(AIS_InteractiveContext) aContext = AISContext();
   Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
   if (!aContext.IsNull() && !anAISIO.IsNull()) {
-    aContext->Display(anAISIO, theDisplayMode, 0, false/*update viewer*/, true, AIS_DS_Displayed);
+    aContext->Display(anAISIO, theDisplayMode, 0, false/*update viewer*/, AIS_DS_Displayed);
     #ifdef TINSPECTOR
     if (getCallBack()) getCallBack()->Display(anAISIO);
     #endif
@@ -1058,7 +1058,6 @@ void XGUI_Displayer::displayTrihedron(bool theToDisplay) const
                         0 /*wireframe*/,
                         -1 /* selection mode */,
                         Standard_True /* update viewer*/,
-                        Standard_False /* allow decomposition */,
                         AIS_DS_Displayed /* xdisplay status */);
     #ifdef TINSPECTOR
     if (getCallBack()) getCallBack()->Display(aTrihedron);
@@ -1098,7 +1097,7 @@ void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) th
   /// OCCT: to write about the problem that active owners method returns one owner several times
   QList<size_t> aSelectedIds; // Remember of selected address in order to avoid duplicates
   for (; anOwnersIt.More(); anOwnersIt.Next()) {
-    anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anOwnersIt.Value());
+    anOwner = anOwnersIt.Value();
     if (aSelectedIds.contains((size_t)anOwner.get()))
       continue;
     aSelectedIds.append((size_t)anOwner.get());
index e623a7e9098b3b67b19b11989838f67f036fa694..891ed7e4f064d32f83f47df09e678f183147b1a9 100644 (file)
@@ -379,7 +379,7 @@ void XGUI_FacesPanel::processSelection()
     }
 
     QString aItemName = aResGroup.get()?
-      aResGroup->data()->name().c_str() : XGUI_Tools::generateName(aPrs);
+      QString::fromStdWString(aResGroup->data()->name()) : XGUI_Tools::generateName(aPrs);
     if (myListView->hasItem(aItemName))
       continue;
 
index 754034d3a3cc8b42178ae05569a920e59a5b9880..738b11aeebf15711a38975039858a499152ab753 100644 (file)
@@ -73,7 +73,7 @@ public:
       XGUI_DataModel* aModel = myTreedView->dataModel();
       ObjectPtr aObj = aModel->object(index);
       if (aObj.get() != NULL) {
-        aEditor->setText(aObj->data()->name().c_str());
+        aEditor->setText(QString::fromStdWString(aObj->data()->name()));
         return;
       }
     }
@@ -131,7 +131,8 @@ void XGUI_DataTree::commitData(QWidget* theEditor)
       if (XGUI_Tools::canRename(aObj, aName)) {
         SessionPtr aMgr = ModelAPI_Session::get();
         aMgr->startOperation("Rename");
-        aObj->data()->setName(aName.toStdString());
+        std::wstring aaa = aName.toStdWString();
+        aObj->data()->setName(aName.toStdWString());
         aMgr->finishOperation();
       }
     }
index b74c923ed34cc50679742e4f97bf83082c531a9f..acfa828b2aabe717fa8ca1203070dda7781af181 100644 (file)
@@ -297,12 +297,12 @@ void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrsPtr& thePrs,
     Handle(AIS_TrihedronOwner) aTrihedronOwner = Handle(AIS_TrihedronOwner)::DownCast(theOwner);
     if (!aTrihedronOwner.IsNull()) {
       const Prs3d_DatumParts& aPart = aTrihedronOwner->DatumPart();
-      std::string aName;
+      std::wstring aName;
       switch (aPart) {
-        case Prs3d_DP_Origin: aName = "Origin"; break;
-        case Prs3d_DP_XAxis: aName = "OX"; break;
-        case Prs3d_DP_YAxis: aName = "OY"; break;
-        case Prs3d_DP_ZAxis: aName = "OZ"; break;
+        case Prs3d_DP_Origin: aName = L"Origin"; break;
+        case Prs3d_DP_XAxis: aName = L"OX"; break;
+        case Prs3d_DP_YAxis: aName = L"OY"; break;
+        case Prs3d_DP_ZAxis: aName = L"OZ"; break;
         default: break;
       }
       if (aName.length() > 0) {
@@ -453,8 +453,7 @@ void XGUI_Selection::entityOwners(const Handle(AIS_InteractiveObject)& theObject
       Handle(SelectMgr_SensitiveEntity) anEntity = anIt.Value();
       if (anEntity.IsNull())
         continue;
-       Handle(SelectMgr_EntityOwner) anOwner =
-        Handle(SelectMgr_EntityOwner)::DownCast(anEntity->BaseSensitive()->OwnerId());
+       Handle(SelectMgr_EntityOwner) anOwner = anEntity->BaseSensitive()->OwnerId();
       if (!anOwner.IsNull())
         theOwners.Add(anOwner);
     }
index 49bcdcbd375174e0c6ad221b217250cf38c26ad8..104b0c1b7c270a0eb2f18112913524f0c40e7b0f 100644 (file)
@@ -173,7 +173,7 @@ void XGUI_SelectionMgr::deselectPresentation(const Handle(AIS_InteractiveObject)
   NCollection_List<Handle(SelectBasics_EntityOwner)>::Iterator anOwnersIt (aResultOwners);
   Handle(SelectMgr_EntityOwner) anOwner;
   for (; anOwnersIt.More(); anOwnersIt.Next()) {
-    anOwner = Handle(SelectMgr_EntityOwner)::DownCast(anOwnersIt.Value());
+    anOwner = anOwnersIt.Value();
     if (!anOwner.IsNull())
       aContext->AddOrRemoveSelected(anOwner, false);
   }
index ae2bb898412f6d02e03a09813dec6e30b8ef9058..898d7b7393d7563dafcd92cdae8f7f61cc538093 100644 (file)
@@ -105,7 +105,7 @@ QString unionOfObjectNames(const QObjectPtrList& theObjects, const QString& theS
   QStringList aObjectNames;
   foreach (ObjectPtr aObj, theObjects) {
     if (aObj->data()->isValid())
-      aObjectNames << QString::fromStdString(aObj->data()->name());
+      aObjectNames << QString::fromStdWString(aObj->data()->name());
   }
   if (aObjectNames.count() == 0)
     return QString();
@@ -145,14 +145,14 @@ std::string featureInfo(FeaturePtr theFeature)
 bool canRemoveOrRename(QWidget* theParent, const std::set<FeaturePtr>& theFeatures)
 {
   bool aResult = true;
-  std::string aNotActivatedNames;
+  std::wstring aNotActivatedNames;
   if (!ModelAPI_Tools::allDocumentsActivated(aNotActivatedNames)) {
     bool aFoundPartSetObject = ModuleBase_Tools::hasModuleDocumentFeature(theFeatures);
     if (aFoundPartSetObject) {
       const char* aKeyStr = "Selected objects can be used in Part documents which are not loaded: "
                             "%1. Whould you like to continue?";
       QMessageBox::StandardButton aRes = QMessageBox::warning(theParent, QObject::tr("Warning"),
-               QObject::tr(aKeyStr).arg(aNotActivatedNames.c_str()),
+               QObject::tr(aKeyStr).arg(QString::fromStdWString(aNotActivatedNames)),
                QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
       aResult = aRes == QMessageBox::Yes;
     }
@@ -207,7 +207,7 @@ bool canRename(const ObjectPtr& theObject, const QString& theName)
   else {
     DocumentPtr aDoc = theObject->document();
     ObjectPtr aObj =
-      aDoc->objectByName(aType, theName.toStdString());
+      aDoc->objectByName(aType, theName.toStdWString());
 
     if (aObj.get() && theObject != aObj) {
       QString aErrMsg(QObject::tr("Name %2 already exists in %1.").
@@ -246,7 +246,7 @@ QString generateName(const ModuleBase_ViewerPrsPtr& thePrs)
     // TODO if there is this case
   }
 
-  QString aName = anObject->data()->name().c_str();
+  QString aName = QString::fromStdWString(anObject->data()->name());
   if (aContext.get()) {
     GeomShapePtr aSubShape(new GeomAPI_Shape());
     TopoDS_Shape aShape = ModuleBase_Tools::getSelectedShape(thePrs);
index f5aba9c79ef8cf5e930643876797f4fcc0a917f4..5353baea55a6f6e018a5f9c659c49ba86e176fe3 100644 (file)
@@ -1897,7 +1897,7 @@ bool XGUI_Workshop::prepareForDisplay(const std::set<ObjectPtr>& theObjects) con
     if (!facesPanel()->isObjectHiddenByPanel(*anObjectsIt))
       continue;
     aHiddenObjects.insert(*anObjectsIt);
-    aHiddenObjectNames.append((*anObjectsIt)->data()->name().c_str());
+    aHiddenObjectNames.append(QString::fromStdWString((*anObjectsIt)->data()->name()));
   }
   if (aHiddenObjects.empty()) // in parameter objects there are no hidden objects in hide face
     return true;
@@ -2103,7 +2103,7 @@ void XGUI_Workshop::cleanHistory()
   if (!anUnusedObjects.empty()) {
     QStringList aNames;
     foreach (const FeaturePtr& aFeature, anUnusedObjects) {
-      aNames.append(aFeature->name().c_str());
+      aNames.append(QString::fromStdWString(aFeature->name()));
     }
     aNames.sort();
     QString anUnusedNames = aNames.join(", ");
@@ -2766,7 +2766,7 @@ void XGUI_Workshop::updateColorScaleVisibility()
             aPrs->dataRange(aMin, aMax);
             myViewerProxy->setColorScaleRange(aMin, aMax);
           }
-          myViewerProxy->setColorScaleTitle(aStep->name().c_str());
+          myViewerProxy->setColorScaleTitle(QString::fromStdWString(aStep->name()));
           myViewerProxy->setColorScaleShown(true);
         }
       }