Salome HOME
Merge remote-tracking branch 'remotes/origin/EDF_2020_Lot2'
authorArtem Zhidkov <Artem.Zhidkov@gmail.com>
Mon, 13 Jul 2020 08:45:27 +0000 (11:45 +0300)
committerArtem Zhidkov <Artem.Zhidkov@gmail.com>
Mon, 13 Jul 2020 10:55:43 +0000 (13:55 +0300)
# Conflicts:
# doc/gui/General/Introduction.rst
# src/FeaturesPlugin/CMakeLists.txt
# src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.cpp
# src/Model/Model_AttributeSelection.cpp
# src/Model/Model_Document.cpp
# src/Model/Model_Objects.cpp
# src/Model/Model_ResultConstruction.cpp
# src/Model/Model_ResultPart.cpp
# src/ModelAPI/ModelAPI_Events.h
# src/ModelHighAPI/ModelHighAPI_Tools.cpp
# src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
# src/PartSet/PartSet_MenuMgr.cpp
# src/PartSet/PartSet_Module.cpp
# src/PartSet/PartSet_SketcherMgr.cpp
# src/Selector/Selector_Algo.h
# src/Selector/Selector_Intersect.cpp
# src/Selector/Selector_Modify.cpp
# src/Selector/Selector_Primitive.cpp
# src/Selector/Selector_WeakName.cpp
# src/SketchAPI/SketchAPI_Sketch.cpp
# src/SketchPlugin/SketchPlugin_Projection.cpp
# src/SketchPlugin/SketchPlugin_Tools.cpp
# src/SketchPlugin/SketchPlugin_Validators.cpp
# src/SketchPlugin/SketchPlugin_msg_en.ts
# src/XGUI/XGUI_OperationMgr.cpp
# src/XGUI/XGUI_Selection.cpp

178 files changed:
CMakeLists.txt
doc/gui/General/Introduction.rst
doc/gui/images/visualization_preferences.png
src/CollectionPlugin/CollectionPlugin_Group.cpp
src/CollectionPlugin/CollectionPlugin_WidgetField.cpp
src/Events/CMakeLists.txt
src/Events/Events.i
src/Events/Events_InfoMessage.cpp
src/Events/Events_InfoMessage.h
src/ExchangePlugin/CMakeLists.txt
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_CompositeBoolean.h
src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp
src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h
src/FeaturesPlugin/FeaturesPlugin_Copy.cpp
src/FeaturesPlugin/FeaturesPlugin_Validators.cpp
src/FeaturesPlugin/extrusion_widget.xml
src/FeaturesPlugin/extrusionfuse_widget.xml
src/FeaturesPlugin/revolution_widget.xml
src/FeaturesPlugin/revolutionfuse_widget.xml
src/GeomAPI/GeomAPI_AISObject.cpp
src/InitializationPlugin/InitializationPlugin_Plugin.cpp
src/InitializationPlugin/InitializationPlugin_Plugin.h
src/Locale/CMakeLists.txt [new file with mode: 0644]
src/Locale/Locale_Convert.cpp [new file with mode: 0644]
src/Locale/Locale_Convert.h [new file with mode: 0644]
src/Locale/Locale_def.h [new file with mode: 0644]
src/Locale/Test/TestUTF8.py [new file with mode: 0644]
src/Model/CMakeLists.txt
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/Model/Model_Update.cpp
src/ModelAPI/CMakeLists.txt
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_Object.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/CMakeLists.txt
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_IModule.h
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/ModuleBase/ModuleBase_msg_fr.ts
src/ParametersPlugin/CMakeLists.txt
src/ParametersPlugin/ParametersPlugin_EvalListener.cpp
src/ParametersPlugin/ParametersPlugin_Parameter.cpp
src/ParametersPlugin/ParametersPlugin_Validators.cpp
src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp
src/PartSet/CMakeLists.txt
src/PartSet/PartSet_MenuMgr.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_OverconstraintListener.cpp
src/PartSet/PartSet_OverconstraintListener.h
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_SketcherReentrantMgr.cpp
src/PartSet/PartSet_SketcherReentrantMgr.h
src/PartSet/PartSet_TreeNodes.cpp
src/PartSet/PartSet_Validators.cpp
src/PartSet/PartSet_WidgetSketchCreator.cpp
src/PartSet/PartSet_WidgetSketchCreator.h
src/PartSet/PartSet_icons.qrc
src/PartSet/icons/extrusion_edge32.png [new file with mode: 0644]
src/PartSet/icons/extrusion_face32.png [new file with mode: 0644]
src/PartSet/icons/extrusion_vertex32.png [new file with mode: 0644]
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/SHAPERGUI/SHAPERGUI.cpp
src/SHAPERGUI/SHAPERGUI.h
src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp
src/SHAPERGUI/SHAPERGUI_SalomeViewer.h
src/Selector/CMakeLists.txt
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/CMakeLists.txt
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_Sketch.cpp
src/SketchAPI/SketchAPI_Sketch.h
src/SketchPlugin/CMakeLists.txt
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_FacesPanel.cpp
src/XGUI/XGUI_ObjectsBrowser.cpp
src/XGUI/XGUI_Selection.cpp
src/XGUI/XGUI_Tools.cpp
src/XGUI/XGUI_ViewerProxy.cpp
src/XGUI/XGUI_Workshop.cpp

index cfee8962aadb2053f643a048a0b13f2c11045d00..a6942ba5d6a2d53e5936cd14e23c082b03c7542f 100644 (file)
@@ -126,6 +126,7 @@ SET(MAKE_TRANSLATION YES)
 
     ADD_DEFINITIONS( -DMAKE_TRANSLATION )
 ADD_SUBDIRECTORY (src/Config)
+ADD_SUBDIRECTORY (src/Locale)
 ADD_SUBDIRECTORY (src/Events)
 ADD_SUBDIRECTORY (src/Selector)
 ADD_SUBDIRECTORY (src/Model)
index d11c9b6a940caaf030986a360d97f84742e97218..bc4934d30bddf4a3ab3a95eae5a668205ac7079b 100644 (file)
@@ -495,6 +495,8 @@ This tab defines presentation of objects displayed in OCC 3D viewer.
 - **Sketch auxiliary entity color** selects default color for sketch auxiliary objects;
 - **Sketch overconstraint color** selects default color for a sketch with redundant constraints;
 - **Sketch fully constraint color** selects default color for a sketch with zero degrees of freedom.
+- **Zoom trihedron arrows** if this control is checked then arrows of a view trihedron will be scaled according to current view scale
+- **Axis arrow size** relative size of trihedron arrows. It has effect only in case if **Zoom trihedron arrows** is On.
   
 To redefine any color click on the corresponding line to access **Select color** dialog box
 
index 6a1b50983008c62b27def8079e615cf49c2e9738..5328894f6e9e909dc6b628db7c13f705cff0efbd 100755 (executable)
Binary files a/doc/gui/images/visualization_preferences.png and b/doc/gui/images/visualization_preferences.png differ
index aa57838cdd051ba284c3c8e06d1e6714c3687701..4803dadd754a8c8dc7963f7cdb803d3e42c3bd38 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++) {
@@ -196,7 +196,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 adf20b11da7b8ea830baea0fa6fc5d1d6a2cc9be..6cbc53a7efd105ac9e1079b198ab45a10999f243 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 bb1fee6a239c5785fb180a471e50851d1bf3a3e5..46bfecd2a43d338c11473df787992a759e5370f4 100644 (file)
@@ -41,6 +41,10 @@ SET(PROJECT_SOURCES
     Events_InfoMessage.cpp
 )
 
+SET(PROJECT_LIBRARIES
+    Locale
+)
+
 ADD_DEFINITIONS(-DEVENTS_EXPORTS)
 ADD_LIBRARY(Events SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
 
@@ -50,6 +54,7 @@ SET_SOURCE_FILES_PROPERTIES(Events.i PROPERTIES CPLUSPLUS ON)
 SET_SOURCE_FILES_PROPERTIES(Events.i PROPERTIES SWIG_DEFINITIONS "-shadow")
 
 INCLUDE_DIRECTORIES(
+    ../Locale
 )
 
 TARGET_LINK_LIBRARIES(Events ${PROJECT_LIBRARIES})
index 92fdf329c766340dd30c8f74d2b99dc00ecb077d..08176739955fc35d91e8fbba696dd9f0741553b3 100644 (file)
@@ -48,6 +48,7 @@
 // standard definitions
 %include "typemaps.i"
 %include "std_string.i"
+%include "std_wstring.i"
 
 // directors
 %feature("director") Events_Listener;
index 419d85fb6391ab7acd75566fb88da8e5e34d5559..4defa49f9e23663ead86a68ff4d551116f3521ff 100644 (file)
 //
 
 #include "Events_InfoMessage.h"
-
-#ifdef WIN32
-#pragma warning(disable : 4996) // for sprintf
-#endif
+#include <Locale_Convert.h>
+#include <sstream>
 
 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,9 @@ 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)
+{
+  addParameter(Locale::Convert::toString(theParam));
+  return *this;
+}
index e7629f0c428c0ad4debbc980b5f569854c75d783..991677ee8ac478d2a4d4b539acdff1806c78f367 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 f6c615e96a1eedcc9d95643713b4060594a201e2..67880c8e64ff524ad3394591e577cbc9ae9a4117 100644 (file)
@@ -22,6 +22,7 @@ INCLUDE(UnitTest)
 
 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/Events
                     ${PROJECT_SOURCE_DIR}/src/Config
+                    ${PROJECT_SOURCE_DIR}/src/Locale
                     ${PROJECT_SOURCE_DIR}/src/ModelAPI
                     ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
                     ${PROJECT_SOURCE_DIR}/src/GeomAPI
@@ -73,6 +74,7 @@ SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES})
 SET(PROJECT_LIBRARIES
     Events
     Config
+    Locale
     ModelAPI
     ModelHighAPI
     GeomAPI
index 29fcfe43b07dabe5a0585f8e0a5f93e055a4f3f2..d898a08e5dd8895c829986908eed8143629eae56 100644 (file)
@@ -41,6 +41,8 @@
 #include <GeomAPI_ShapeExplorer.h>
 #include <GeomAPI_Trsf.h>
 
+#include <Locale_Convert.h>
+
 #include <ModelAPI_AttributeSelectionList.h>
 #include <ModelAPI_AttributeString.h>
 #include <ModelAPI_AttributeStringArray.h>
@@ -393,7 +395,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 = Locale::Convert::toString(aResultBody->data()->name());
   }
 
   aXao.getGeometry()->setName(aGeometryName);
@@ -428,7 +430,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());
+        Locale::Convert::toString(aResultGroup->data()->name()));
 
       try {
         GeomAPI_ShapeExplorer aGroupResExplorer(aResultGroup->shape(), aSelType);
@@ -447,7 +449,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();
+          Locale::Convert::toString(aResultGroup->data()->name());
         msg += ".\n";
         msg += e.what();
         msg += "\n";
@@ -484,7 +486,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());
+        Locale::Convert::toString(aResultField->data()->name()));
 
 
       try {
@@ -545,7 +547,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();
+          Locale::Convert::toString(aResultField->data()->name());
         msg += ".\n";
         msg += e.what();
         msg += "\n";
index 7ef6c5fe6c329efd30740c0d22eeeab63db4ede8..d7e82659ba77194da02007754727d593d571ca42 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 03ade55469eafea0cd9f0dd81ceebe345574b9eb..b5a51ff08fa248e1e6fec471595c98dd08c62bc1 100644 (file)
@@ -20,6 +20,8 @@
 #include "ExchangePlugin_Import.h"
 #include "ExchangePlugin_ImportFeature.h"
 
+#include <Locale_Convert.h>
+
 #include <PartSetPlugin_Part.h>
 
 #include <ModelAPI_AttributeString.h>
@@ -30,9 +32,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 +102,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(),
+      Locale::Convert::toWString(aPartsAttr->value(aTargetAttr->value())));
 
   if (aDoc.get()) {
     FeaturePtr aImportFeature = aDoc->addFeature(ExchangePlugin_ImportFeature::ID());
@@ -127,7 +130,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 +145,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, Locale::Convert::toString(*anIt));
     }
     else {
       // keep only the name of the current part
@@ -152,7 +155,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, Locale::Convert::toString(aPartFeature->name()));
         aTargetAttr->setValue(0);
       }
     }
index 20dd90a3704a13648ecd5009336597fdcd2c31b3..ade0a3115974fde390294daf839f71047207af17 100644 (file)
@@ -34,6 +34,8 @@
 #include <GeomAPI_Shape.h>
 #include <GeomAPI_ShapeExplorer.h>
 
+#include <Locale_Convert.h>
+
 #include <ModelAPI_AttributeRefList.h>
 #include <ModelAPI_AttributeSelectionList.h>
 #include <ModelAPI_AttributeString.h>
@@ -49,6 +51,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 +140,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(Locale::Convert::toWString(anObjectName));
 
   setResult(createResultBody(aGeomShape));
 }
@@ -161,7 +164,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(Locale::Convert::toWString(aBodyName));
 
   ResultBodyPtr aResultBody = createResultBody(aGeomShape);
   setResult(aResultBody);
@@ -187,7 +190,7 @@ void ExchangePlugin_ImportFeature::importXAO(const std::string& theFileName)
 
     // group name
     if (!aXaoGroup->getName().empty())
-      aGroupFeature->data()->setName(aXaoGroup->getName());
+      aGroupFeature->data()->setName(Locale::Convert::toWString(aXaoGroup->getName()));
 
     // fill selection
     AttributeSelectionListPtr aSelectionList = aGroupFeature->selectionList("group_list");
@@ -217,7 +220,7 @@ void ExchangePlugin_ImportFeature::importXAO(const std::string& theFileName)
 
     // group name
     if (!aXaoField->getName().empty())
-      aFieldFeature->data()->setName(aXaoField->getName());
+      aFieldFeature->data()->setName(Locale::Convert::toWString(aXaoField->getName()));
 
     // fill selection
     AttributeSelectionListPtr aSelectionList = aFieldFeature->selectionList("selected");
index e63d5ee9c0109b8265e43e291f243e405b21da8e..ae74d6b3007eac78e3e70d52ab9ddc07642c632f 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <ExchangePlugin_ImportPart.h>
 
+#include <Locale_Convert.h>
+
 #include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_AttributeString.h>
 #include <ModelAPI_AttributeStringArray.h>
@@ -30,6 +32,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 +105,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(Locale::Convert::toString((*aFIt)->name()));
       }
 
       if ((size_t)aPartsAttr->size() != anAcceptedValues.size())
@@ -119,7 +122,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, Locale::Convert::toString(aPartFeature->name()));
         aTargetAttr->setValue(0);
       }
     }
@@ -147,7 +150,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() &&
+          Locale::Convert::toString((*aFIt)->name()) == thePartName) {
           aPartFeature = *aFIt;
           break;
         }
@@ -164,16 +168,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;
+  bool isOk = aLastUndercore != std::wstring::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 +187,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 +224,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 +234,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 +252,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 +270,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 c05fafcece58f3b0f321af78e03df02a107d54a8..fd2fee853b0accaa82b72a299231afbec8ee05e6 100644 (file)
@@ -49,6 +49,8 @@ public:
   /// Performs the algorithm and stores results it in the data structure.
   FEATURESPLUGIN_EXPORT virtual void executeCompositeBoolean();
 
+  const OperationType& operationType() const { return myOperationType; }
+
 protected:
   struct ResultBaseAlgo {
     ResultBodyPtr resultBody;
index 56f5861753a606f4fa7da04369ad4c0f5b452e0c..8ee137663d548bb7d3fe7ce080caa3e2abc63ac9 100644 (file)
@@ -50,6 +50,7 @@ void FeaturesPlugin_CompositeSketch::initCompositeSketchAttribtues(const int the
   // Initialize selection list.
   if(theInitFlags & InitBaseObjectsList) {
     data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId());
+    myCurrentSelectionType = selectionList(BASE_OBJECTS_ID())->selectionType();
   }
 }
 
@@ -308,3 +309,15 @@ void storeSubShape(
     }
   }
 }
+
+//=================================================================================================
+void FeaturesPlugin_CompositeSketch::attributeChanged(const std::string& theID)
+{
+  if (theID == BASE_OBJECTS_ID()) {
+    AttributeSelectionListPtr anObjects = selectionList(BASE_OBJECTS_ID());
+    if (anObjects->size() == 0 || anObjects->selectionType() != myCurrentSelectionType) {
+      myCurrentSelectionType = anObjects->selectionType();
+      removeResults(0); // clear the results
+    }
+  }
+}
index b42a2a64d10480744430aa20420f069981755dc0..555e35874ba27921d85d73ad706530245b7942da 100644 (file)
@@ -66,6 +66,10 @@ public:
   /// structures of the owner (the remove from the document will be done outside just after).
   FEATURESPLUGIN_EXPORT virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
 
+  /// On change of attribute of the result update presentation of this result:
+  /// for the current moment there are only presentation attributes assigned to results
+  FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
+
 protected:
   enum InitFlags {
     InitSketchLauncher   = 1 << 0,
@@ -99,6 +103,8 @@ protected:
                    const ListOfShape& theShapes,
                    const std::string theName);
 
+private:
+  std::string myCurrentSelectionType; //< type of selection (vertex, edge or face)
 };
 
 #endif
index bf8cb1fbe7b1f6650b0408668fbb920a72adb549..830e83a336e12ac9caaac2d1f0163afcd3e3c711 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 e84cae4189a61710a5ec8d30776ba8474f5a03f7..0d22e130a6ccfb15cc20520efa9e8b16a8548bf7 100644 (file)
@@ -23,6 +23,7 @@
 #include "FeaturesPlugin_BooleanFuse.h"
 #include "FeaturesPlugin_BooleanCommon.h"
 #include "FeaturesPlugin_BooleanSmash.h"
+#include "FeaturesPlugin_CompositeBoolean.h"
 #include "FeaturesPlugin_Extrusion.h"
 #include "FeaturesPlugin_Pipe.h"
 #include "FeaturesPlugin_Union.h"
@@ -445,13 +446,16 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute
           return true;
         }
       } else {
-        // Shape on construction selected. Check that it is a face or wire.
-        if(aShape->shapeType() == GeomAPI_Shape::WIRE ||
-           aShape->shapeType() == GeomAPI_Shape::FACE) {
-          return true;
+        // CUT operation supports only FACE or WIRE as a tool base
+        std::shared_ptr<FeaturesPlugin_CompositeBoolean> aComposite =
+            std::dynamic_pointer_cast<FeaturesPlugin_CompositeBoolean>(
+            ModelAPI_Feature::feature(theAttribute->owner()));
+        if (aComposite &&
+            aComposite->operationType() == FeaturesPlugin_CompositeBoolean::BOOL_CUT) {
+          return aShape->shapeType() == GeomAPI_Shape::WIRE ||
+                 aShape->shapeType() == GeomAPI_Shape::FACE;
         }
       }
-      return false;
     }
 
     if(aContextShape.get() && !aShape->isEqual(aContextShape)) {
index 85ca64d7198d8bbaaf203c57c783fe887542df30..94a9d4bc3a5d05302cc90b0974cf7a64fc4cb8df 100644 (file)
@@ -5,13 +5,19 @@
 1. Planar face of non-sketch object or a plane. Sketch creation will be started.&lt;br /&gt;
 2. An existing sketch face or contour. Extrusion will be filled by it.&lt;br /&gt;
 3. An existing result shape of kind: wires/edge/vertices. Extrusion will be filled by it."
-                   shape_types="vertices edges wires faces shells solids compsolids compounds">
+                  shape_types="Vertices Edges Faces"
+                  type_icons=":/icons/extrusion_vertex32.png :/icons/extrusion_edge32.png :/icons/extrusion_face32.png"
+                  default_type = "2"
+                  use_choice="true">
     <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="base,Sketch"/>
   </sketch_launcher>
   <multi_selector id="base"
                   label="Base objects:"
                   tooltip="Select a base objects"
-                  shape_types="vertices edges wires faces shells compounds"
+                  shape_types="Vertices Edges Faces"
+                  type_icons=":/icons/extrusion_vertex32.png :/icons/extrusion_edge32.png :/icons/extrusion_face32.png"
+                  default_type = "2"
+                  use_choice="true"
                   concealment="true">
     <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell,compound"/>
   </multi_selector>
index 5e9d7355698c63a689089848627233e0230331e6..78b9eb1313ff4d00cbe0099bf2c15035b1d7f9d8 100644 (file)
@@ -6,14 +6,20 @@
 1. Planar face of non-sketch object or a plane. Sketch creation will be started.&lt;br /&gt;
 2. An existing sketch face or contour. Extrusion will be filled by it.&lt;br /&gt;
 3. An existing result shape of kind: wires/edge/vertices. Extrusion will be filled by it."
-      shape_types="vertices edges wires faces shells compounds">
+      shape_types="Vertices Edges Faces"
+      type_icons=":/icons/extrusion_vertex32.png :/icons/extrusion_edge32.png :/icons/extrusion_face32.png"
+      default_type = "2"
+      use_choice="true">
       <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="base,Sketch"/>
     </sketch_launcher>
     <multi_selector id="base"
       label="Select a sketch face"
       icon="icons/Features/sketch.png"
       tooltip="Select a sketch face"
-      shape_types="vertices edges wires faces shells compounds"
+      shape_types="Vertices Edges Faces"
+      type_icons=":/icons/extrusion_vertex32.png :/icons/extrusion_edge32.png :/icons/extrusion_face32.png"
+      default_type = "2"
+      use_choice="true"
       concealment="true">
       <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell,compound"/>
     </multi_selector>
index f69065d75ff8bf58b30eb63d956d1c9a8983d48a..dd06cb43328c7da1e67af9a61b4e0048cc29e446 100644 (file)
@@ -5,13 +5,19 @@
 1. Planar face of non-sketch object or a plane. Sketch creation will be started.&lt;br /&gt;
 2. An existing sketch face or contour. Extrusion will be filled by it.&lt;br /&gt;
 3. An existing result shape of kind: wires/edge/vertices. Extrusion will be filled by it."
-                   shape_types="vertices edges wires faces shells compounds">
+                  shape_types="Vertices Edges Faces"
+                  type_icons=":/icons/extrusion_vertex32.png :/icons/extrusion_edge32.png :/icons/extrusion_face32.png"
+                  default_type = "2"
+                  use_choice="true">
     <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="base,Sketch"/>
   </sketch_launcher>
   <multi_selector id="base"
                   label="Base objects:"
                   tooltip="Select a base objects"
-                  shape_types="vertices edges wires faces shells compounds"
+                  shape_types="Vertices Edges Faces"
+                  type_icons=":/icons/extrusion_vertex32.png :/icons/extrusion_edge32.png :/icons/extrusion_face32.png"
+                  default_type = "2"
+                  use_choice="true"
                   concealment="true">
     <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell,compound"/>
   </multi_selector>
index 4f571406e089f1fac9229e8c0348802124fa2443..aaca18add6d576fca1e0273b381bdba79455520d 100644 (file)
@@ -6,14 +6,20 @@
 1. Planar face of non-sketch object or a plane. Sketch creation will be started.&lt;br /&gt;
 2. An existing sketch face or contour. Extrusion will be filled by it.&lt;br /&gt;
 3. An existing result shape of kind: wires/edge/vertices. Extrusion will be filled by it."
-      shape_types="vertices edges wires faces shells compounds">
+      shape_types="Vertices Edges Faces"
+      type_icons=":/icons/extrusion_vertex32.png :/icons/extrusion_edge32.png :/icons/extrusion_face32.png"
+      default_type = "2"
+      use_choice="true">
       <validator id="FeaturesPlugin_ValidatorCompositeLauncher" parameters="base,Sketch"/>
     </sketch_launcher>
     <multi_selector id="base"
       label="Select a sketch face"
       icon="icons/Features/sketch.png"
       tooltip="Select a sketch face"
-      shape_types="vertices edges wires faces shells compounds"
+      shape_types="Vertices Edges Faces"
+      type_icons=":/icons/extrusion_vertex32.png :/icons/extrusion_edge32.png :/icons/extrusion_face32.png"
+      default_type = "2"
+      use_choice="true"
       concealment="true">
       <validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell,compound"/>
     </multi_selector>
index 0cf6c079fc5c54e69d6d380a5c34635619fac06e..b150bffca1345bb50a393a42901721ee072c9ebe 100644 (file)
@@ -369,15 +369,19 @@ bool GeomAPI_AISObject::setColor(int theR, int theG, int theB)
   if (aColor.IsEqual(aCurrentColor))
     return false;
 
+  Handle(AIS_InteractiveContext) aContext = anAIS->GetContext();
   Handle(AIS_Dimension) aDimAIS = Handle(AIS_Dimension)::DownCast(anAIS);
   if (!aDimAIS.IsNull()) {
     aDimAIS->DimensionAspect()->SetCommonColor(aColor);
+    if (!aContext.IsNull())
+      aContext->Redisplay(aDimAIS, false);
+  }
+  else {
+    if (!aContext.IsNull())
+      aContext->SetColor(anAIS, aColor, false);
+    else
+      anAIS->SetColor(aColor);
   }
-  Handle(AIS_InteractiveContext) aContext = anAIS->GetContext();
-  if (!aContext.IsNull())
-    aContext->SetColor(anAIS, aColor, false);
-  else
-    anAIS->SetColor(aColor);
   return true;
 }
 
index 6ddcc0af70d18a9cb32e276f7aaa7c40123174fe..6ff636bc72726342f578d5aaa7b9265465711581 100644 (file)
@@ -73,7 +73,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.));
@@ -116,11 +116,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);
@@ -136,7 +136,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");
@@ -171,11 +171,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 01e879e1353bdbd419356121621fedf7e3ac5ee3..7c05c29daee5f205312dc0c637ae05025e42e854 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
diff --git a/src/Locale/CMakeLists.txt b/src/Locale/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ec83f60
--- /dev/null
@@ -0,0 +1,48 @@
+# Copyright (C) 2020  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+INCLUDE(Common)
+INCLUDE(UnitTest)
+
+INCLUDE_DIRECTORIES(
+    ${CMAKE_CURRENT_SOURCE_DIR}
+    ${Boost_INCLUDE_DIR}
+)
+
+SET(PROJECT_HEADERS
+    Locale_def.h
+    Locale_Convert.h
+)
+
+SET(PROJECT_SOURCES
+    Locale_Convert.cpp
+)
+
+SET(PROJECT_LIBRARIES
+)
+
+ADD_DEFINITIONS(-DLOCALE_EXPORTS)
+ADD_LIBRARY(Locale SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(Locale ${PROJECT_LIBRARIES})
+
+INSTALL(TARGETS Locale DESTINATION ${SHAPER_INSTALL_BIN})
+
+ADD_UNIT_TESTS(
+  TestUTF8.py
+)
diff --git a/src/Locale/Locale_Convert.cpp b/src/Locale/Locale_Convert.cpp
new file mode 100644 (file)
index 0000000..5808883
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) 2020  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <Locale_Convert.h>
+
+#include <boost/locale/encoding_utf.hpp>
+
+namespace Locale
+{
+  std::string Convert::toString(const std::wstring& theWStr)
+  {
+    return boost::locale::conv::utf_to_utf<char>(theWStr);
+  }
+
+  std::string Convert::toString(const char16_t* theExtStr)
+  {
+    return boost::locale::conv::utf_to_utf<char>(theExtStr);
+  }
+
+  std::wstring Convert::toWString(const std::string& theStr)
+  {
+    return boost::locale::conv::utf_to_utf<wchar_t>(theStr);
+  }
+
+  std::wstring Convert::toWString(const char16_t* theExtStr)
+  {
+    return boost::locale::conv::utf_to_utf<wchar_t>(theExtStr);
+  }
+
+}
diff --git a/src/Locale/Locale_Convert.h b/src/Locale/Locale_Convert.h
new file mode 100644 (file)
index 0000000..9a44323
--- /dev/null
@@ -0,0 +1,51 @@
+// Copyright (C) 2020  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef LOCALE_CONVERT_H
+#define LOCALE_CONVERT_H
+
+#include <Locale_def.h>
+
+#include <string>
+
+namespace Locale
+{
+  /// Convert strings
+  namespace Convert
+  {
+    /// Converts a wide-string to a simple (byte) string
+    /// \param theWStr a wide-string
+    LOCALE_EXPORT std::string toString(const std::wstring& theWStr);
+
+    /// Converts an extended string to a simple (byte) string
+    /// \param theExtStr an extended string
+    LOCALE_EXPORT std::string toString(const char16_t* theExtStr);
+
+    /// Converts a byte string to a wide-string
+    /// \param theStr a byte string
+    LOCALE_EXPORT std::wstring toWString(const std::string& theStr);
+
+    /// Converts an extended string to a wide-string
+    /// \param theStr a byte string
+    LOCALE_EXPORT std::wstring toWString(const char16_t* theExtStr);
+
+  }
+}
+
+#endif // Locale_Convert_H
diff --git a/src/Locale/Locale_def.h b/src/Locale/Locale_def.h
new file mode 100644 (file)
index 0000000..36587c9
--- /dev/null
@@ -0,0 +1,33 @@
+// Copyright (C) 2020  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef LOCALE_DEF_H
+#define LOCALE_DEF_H
+
+#if defined WIN32
+# if defined LOCALE_EXPORTS
+#  define LOCALE_EXPORT __declspec( dllexport )
+# else
+#  define LOCALE_EXPORT __declspec( dllimport )
+# endif
+#else
+# define LOCALE_EXPORT
+#endif
+
+#endif
diff --git a/src/Locale/Test/TestUTF8.py b/src/Locale/Test/TestUTF8.py
new file mode 100644 (file)
index 0000000..488bcd0
--- /dev/null
@@ -0,0 +1,63 @@
+# Copyright (C) 2020  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+
+### Create Part
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+
+### Create Box
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Box_1.setName("boîte")
+Box_1.result().setName("boîte")
+
+### Create Sphere
+Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10)
+Sphere_1.setName("sphère")
+Sphere_1.result().setName("sphère")
+
+### Create Shell
+Shell_1_objects = [model.selection("FACE", "boîte/Left"),
+                   model.selection("FACE", "boîte/Back"),
+                   model.selection("FACE", "boîte/Bottom")]
+Shell_1 = model.addShell(Part_1_doc, Shell_1_objects)
+
+### Create Cut
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SHELL", "boîte")], [model.selection("COMPOUND", "all-in-sphère")], keepSubResults = True)
+Cut_1.result().subResult(0).setName("Cut_1_1_1")
+Cut_1.result().subResult(1).setName("Cut_1_1_2")
+Cut_1.result().subResult(2).setName("Cut_1_1_3")
+
+model.end()
+
+from GeomAPI import *
+
+model.testNbResults(Cut_1, 1)
+model.testNbSubResults(Cut_1, [3])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [3])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [9])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [18])
+model.testResultsVolumes(Cut_1, [64.38055098])
+
+assert(model.checkPythonDump())
index a90efebb0458a68b668f782c04eb0bb4041ea4e2..4acd61645700027f44cb7c1b36fec5257136d34b 100644 (file)
@@ -104,6 +104,7 @@ SET(PROJECT_LIBRARIES
     GeomData
     GeomAPI
     GeomAlgoAPI
+    Locale
     ModelGeomAlgo
     ${OpenCASCADE_ApplicationFramework_LIBRARIES}
 )
@@ -116,6 +117,7 @@ SET(PROJECT_INCLUDES
   ../GeomDataAPI
   ../GeomAlgoAPI
   ../GeomAPI
+  ../Locale
   ../ModelGeomAlgo
   ../ConstructionPlugin
   ${OpenCASCADE_INCLUDE_DIR}
index 3e1afd7fdbcc39aa7368a63a6285677bee40d8c2..7ffbf61a5712f1ba4423ec53a578a9e04a834597 100644 (file)
@@ -21,6 +21,9 @@
 #include <Model_Document.h>
 
 #include <ModelAPI_Events.h>
+#include <ModelAPI_Tools.h>
+
+#include <Locale_Convert.h>
 
 #include <BinDrivers_DocumentRetrievalDriver.hxx>
 #include <BinDrivers_DocumentStorageDriver.hxx>
@@ -61,7 +64,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 +73,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(), Locale::Convert::toString(theDocName).c_str(), aNew);
     myLoadedByDemand.erase(theDocName);  // done, don't do it anymore
   } else { // error
     aRes = false;
@@ -132,13 +135,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 +155,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 cecb87db3f78244a9c2c39528dcd024117f9f078..0a1f6731448059d059a2f24731e99670945f6cc6 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 27ef884adca2e21cc522a4fd07ef4f9cabf8e303..9219aca4b622c160400eeff90f99a628f7d03eda 100644 (file)
@@ -46,6 +46,8 @@
 #include <GeomAlgoAPI_NExplode.h>
 #include <Selector_Selector.h>
 
+#include <Locale_Convert.h>
+
 #include <TNaming_NamedShape.hxx>
 #include <TNaming_Tool.hxx>
 #include <TNaming_Builder.hxx>
@@ -94,7 +96,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
@@ -362,10 +364,10 @@ std::shared_ptr<GeomAPI_Shape> Model_AttributeSelection::internalValue(CenterTyp
         } else { // face with name is already in the data model, so try to take it by name
           Handle(TDataStd_Name) aName;
           if (aSelLab.FindAttribute(TDataStd_Name::GetID(), aName)) {
-            std::string aSubShapeName(TCollection_AsciiString(aName->Get()).ToCString());
-            std::size_t aPartEnd = aSubShapeName.find('/');
-            if (aPartEnd != std::string::npos && aPartEnd != aSubShapeName.rfind('/')) {
-              std::string aNameInPart = aSubShapeName.substr(aPartEnd + 1);
+            std::wstring aSubShapeName = Locale::Convert::toWString(aName->Get().ToExtString());
+            std::size_t aPartEnd = aSubShapeName.find(L'/');
+            if (aPartEnd != std::wstring::npos && aPartEnd != aSubShapeName.rfind(L'/')) {
+              std::wstring aNameInPart = aSubShapeName.substr(aPartEnd + 1);
               int anInd;
               std::string aType; // to reuse already existing selection the type is not needed
               return aPart->shapeInPart(aNameInPart, aType, anInd);
@@ -715,13 +717,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 +739,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,11 +763,13 @@ std::string Model_AttributeSelection::namingName(const std::string& theDefaultNa
     GeomShapePtr aShape = value();
     if (!aShape.get() && context().get())
       aShape = context()->shape();
+    std::wstring aName;
     if (aShape.get()) {
-      aName = aShape->shapeTypeStr();
+      aName = Locale::Convert::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;
@@ -776,21 +780,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 += Locale::Convert::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
@@ -801,8 +805,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;
@@ -817,7 +822,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) {
@@ -827,13 +832,13 @@ 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);
-    if (aFound != std::string::npos &&
+    if (aFound != std::wstring::npos &&
         aFound == theShapeName.size() - aPrefixIter->second.size()) {
       theShapeName = theShapeName.substr(0, aFound);
       return aPrefixIter->first;
@@ -844,11 +849,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
@@ -867,11 +872,11 @@ void Model_AttributeSelection::selectSubShape(
     std::shared_ptr<Model_Document> aDoc =
       std::dynamic_pointer_cast<Model_Document>(owner()->document());
     // 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::size_t aPartEnd = aSubShapeName.find(L'/');
+    if (aPartEnd != std::wstring::npos) {
+      std::wstring aPartName = aSubShapeName.substr(0, aPartEnd);
       DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-      if (aPartName == aRootDoc->kind()) {
+      if (aPartName == Locale::Convert::toWString(aRootDoc->kind())) {
         aDoc = std::dynamic_pointer_cast<Model_Document>(aRootDoc);
         aSubShapeName = aSubShapeName.substr(aPartEnd + 1);
       }
@@ -880,7 +885,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;
@@ -923,7 +928,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);
@@ -932,7 +937,7 @@ void Model_AttributeSelection::selectSubShape(
     }
 
     // the whole result selection check
-    if (aSubShapeName.find('/') == std::string::npos) {
+    if (aSubShapeName.find(L'/') == std::wstring::npos) {
       ObjectPtr aRes = aDoc->objectByName(ModelAPI_ResultConstruction::group(), aSubShapeName);
       if (!aRes.get()) {
         aRes = aDoc->objectByName(ModelAPI_ResultBody::group(), aSubShapeName);
@@ -1074,7 +1079,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);
@@ -1127,17 +1132,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 = Locale::Convert::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"/";
       }
     }
   }
@@ -1844,7 +1849,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());
@@ -1869,7 +1874,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)
@@ -1878,31 +1883,31 @@ 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 = Locale::Convert::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::string::size_type n = aName.find('/');
-  if (n != std::string::npos) {
+  std::wstring aSubShapeName = aName;
+  std::wstring::size_type n = aName.find(L'/');
+  if (n != std::wstring::npos) {
     aName = aName.substr(0, n);
   }
 
@@ -1913,11 +1918,12 @@ 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(Locale::Convert::toWString(aDoc->kind())) == 0) {
+      // remove the document identifier from name if exists
       aSubShapeName = theName.substr(aDoc->kind().size() + 1);
       aName = aSubShapeName;
-      n = aName.find('/');
-      if (n != std::string::npos) {
+      n = aName.find(L'/');
+      if (n != std::wstring::npos) {
         aName = aName.substr(0, n);
       }
     }
@@ -1932,9 +1938,9 @@ bool Model_AttributeSelection::restoreContext(std::string theName,
 
   // sketch sub-component shape and name is located in separated feature label, try the sub-name
   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::size_type aSlash = aSubShapeName.rfind(L'/');
+    if (aSlash != std::wstring::npos) {
+      std::wstring aCompName = aSubShapeName.substr(aSlash + 1);
       CompositeFeaturePtr aComposite =
         std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aDoc->feature(aCont));
       if (aComposite.get() && aComposite->numberOfSubs()) {
@@ -2130,7 +2136,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 ab7f06cf4a7ab1a2e399df573c84b3a7d215421c..74ae84cb863301a782b74afe8d01715fd446a77b 100644 (file)
@@ -98,21 +98,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();
@@ -127,11 +127,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
@@ -139,7 +139,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 4b9846d696aeb472d08e18d6779b346e6cfe8490..5a692ae9b7c63474c52c53fbbbdb2d7e66858176 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 3a06635646a04ec14147043d1d010a510767ef0a..024ad480083ce2480bf2a143bc8cbbcfd5f01ecc 100644 (file)
@@ -56,14 +56,16 @@ 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 e28cbe647a8bf1ce269673c56639be4a3f223ca7..cf817b65137bb2d67b5edcfdf0af9214801b0e5e 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <Model_BodyBuilder.h>
 
+#include <Locale_Convert.h>
+
 #include <Model_Data.h>
 #include <Model_Document.h>
 #include <ModelAPI_Session.h>
@@ -204,7 +206,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 = Locale::Convert::toWString(anAttr->Get().ToExtString());
         if(!aName.empty()) {
           std::shared_ptr<Model_Document> aDoc =
             std::dynamic_pointer_cast<Model_Document>(document());
@@ -256,7 +258,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 = Locale::Convert::toWString(anAttr->Get().ToExtString());
         if(!aName.empty()) {
           std::shared_ptr<Model_Document> aDoc =
             std::dynamic_pointer_cast<Model_Document>(document());
@@ -348,7 +350,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 = Locale::Convert::toWString(anAttr->Get().ToExtString());
         if(!aName.empty()) {
           std::shared_ptr<Model_Document> aDoc =
             std::dynamic_pointer_cast<Model_Document>(document());
index decf415ac0e2236f12dbf92d1adc0c9185a2811b..b84d441c1c5bcf992285cfbff34731b59a6b9588 100644 (file)
@@ -58,6 +58,8 @@
 #include <Events_Loop.h>
 #include <Events_InfoMessage.h>
 
+#include <Locale_Convert.h>
+
 #include <TDataStd_Name.hxx>
 #include <TDataStd_AsciiString.hxx>
 #include <TDataStd_UAttribute.hxx>
@@ -106,22 +108,22 @@ 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();
+    myObject->myName = Locale::Convert::toWString(aName->Get().ToExtString());
 #endif
-    return std::string(TCollection_AsciiString(aName->Get()).ToCString());
+    return Locale::Convert::toWString(aName->Get().ToExtString());
   }
-  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 +138,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 3577b6e39688e444cfefa8b08129f8e93041d10c..9c544c35ee09f71bc070566e86538d38b95abe9c 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 6893930feef6bfad68286a496580eba73aae3c27..7d9dabeae63c6b15f8e3437ba338621230684685 100644 (file)
@@ -34,6 +34,8 @@
 #include <Events_InfoMessage.h>
 #include <GeomAPI_Tools.h>
 
+#include <Locale_Convert.h>
+
 #include <TDataStd_Integer.hxx>
 #include <TDataStd_Comment.hxx>
 #include <TDF_ChildIDIterator.hxx>
@@ -524,7 +526,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 = Locale::Convert::toString(aPart->data()->name());
         if (!aDocName.empty()) {
           // just copy file
           TCollection_AsciiString aSubPath(DocFileName(anApp->loadPath().c_str(), aDocName));
@@ -541,8 +543,9 @@ bool Model_Document::save(
           }
         }
       } else { // simply save opened document
+        std::string aDocName = Locale::Convert::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);
       }
     }
   }
@@ -1331,7 +1334,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);
 }
@@ -1656,9 +1659,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
@@ -1690,11 +1693,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++) {
@@ -1709,9 +1712,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 = Locale::Convert::toWString(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());
           }
@@ -1768,9 +1771,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++) {
@@ -1783,9 +1786,9 @@ TDF_Label Model_Document::findNamingName(std::string theName, ResultPtr theConte
       return *(aFind->second.rbegin()); // no more variants, so, return the last
   }
   // 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::size_type aSlash = theName.rfind(L'/');
+  if (aSlash != std::wstring::npos) {
+    std::wstring anObjName = theName.substr(0, aSlash);
     aFind = myNamingNames.find(anObjName);
     if (aFind != myNamingNames.end()) {
       TCollection_ExtendedString aSubName(theName.substr(aSlash + 1).c_str());
@@ -1881,7 +1884,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
@@ -1919,10 +1922,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
@@ -1931,7 +1934,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() && (int)aFind->second.size() > aNumInHistory) {
       std::list<TDF_Label>::reverse_iterator aLibIt = aFind->second.rbegin();
       for(; aNumInHistory != 0; aNumInHistory--)
@@ -2076,7 +2079,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 f2acb48a68a1719898e44a765c86726a48a78808..217e77eeb10df953c55b501aa07e8a4fc82314fe 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,20 @@ 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 +452,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 ce23976c3b7feae52fde59411bc1d9e5a8c4e5d8..2c32988e2188e13577ee28df27f657110fbb5c6c 100644 (file)
@@ -38,6 +38,8 @@
 #include <Events_Loop.h>
 #include <Events_InfoMessage.h>
 
+#include <Locale_Convert.h>
+
 #include <TDataStd_Integer.hxx>
 #include <TDataStd_Comment.hxx>
 #include <TDF_ChildIDIterator.hxx>
@@ -627,7 +629,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)
@@ -731,22 +733,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 Locale::Convert::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++;
@@ -767,7 +769,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);
@@ -1188,7 +1190,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) {
@@ -1199,7 +1201,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();
@@ -1216,7 +1218,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;
@@ -1231,13 +1233,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
@@ -1936,7 +1938,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 1be771ea13ef5a31d55dbecadd8ddb3b201dadc8..c929be8ce86a19d26b9a51b3e039d573b5cdf422 100644 (file)
@@ -80,10 +80,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.
@@ -287,7 +287,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 19776ba2ab640fd37c0a4f376eb5a49664875ebc..e6a88069b47ed45de44474826caa59e36953ab07 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,19 +121,19 @@ 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;
-  while(aSyms.find(*aSuffix) != std::string::npos) {
+  static const std::wstring aSyms(L"sefr");
+  std::wstring::iterator aSuffix = aName.end() - 1;
+  while(aSyms.find(*aSuffix) != std::wstring::npos) {
     --aSuffix;
   }
   aName.erase(aSuffix + 1, aName.end());
@@ -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 aSubBuilder(aSubLab);
         aSubBuilder.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
@@ -465,7 +466,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;
@@ -524,8 +525,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());
@@ -538,7 +539,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 0f406a93465e8855391be51564886414cebdd65a..8ec0fc33becd0cc51b58aec6188d4f4aaf2089b7 100644 (file)
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_AttributeIntArray.h>
 #include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_Tools.h>
 
 #include <GeomAlgoAPI_CompoundBuilder.h>
 
+#include <Locale_Convert.h>
+
 #include <Config_PropManager.h>
 
 Model_ResultField::Model_ResultField(std::shared_ptr<ModelAPI_Data> theOwnerData)
@@ -152,10 +155,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)<<" "<< Locale::Convert::toWString(myParent->textLine(myId));
   return aStream.str();
 }
 // LCOV_EXCL_STOP
index 3068a753c18635631dfe8de1e4d02f86511f5154..3af7e78ecdea5600a82a3d6e808a8e1dec7828cf 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 3c52f0986756e0152b4e7d4a6f0cc0802bb0d4f6..01d7ef900e78482cef0e320e097372a5f39ce653 100644 (file)
 #include <Model_Application.h>
 #include <Events_Loop.h>
 #include <ModelAPI_Events.h>
+#include <ModelAPI_Tools.h>
 
 #include <GeomAPI_Trsf.h>
 
+#include <Locale_Convert.h>
+
 #include <TNaming_Tool.hxx>
 #include <TNaming_NamedShape.hxx>
 #include <TDataStd_Name.hxx>
@@ -90,7 +93,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 " + Locale::Convert::toString(data()->name());
     aMgr->startOperation(aMsg);
     isNewTransaction = true;
   }
@@ -253,7 +256,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 +282,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"";
   MAYBE_UNUSED 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();
@@ -346,7 +349,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()) {
@@ -365,7 +368,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 c29312f013585421aa4fbc2940aa2b814c6fce0e..4cfc139c5ab375aa0cad7cb377d477de8ee17a10 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 01d35426856e2e5f9c58f95dd05a5f1924f9d5bc..de638bab6a9d6cac721c9273efa43682b00ee0a5 100644 (file)
@@ -370,7 +370,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 1a6ee699cb5e009a34eacec5667cbdd766fa3a2d..247e2a92997ef0c6ad9bab4c501f8209cf0bc693 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 a2bcdfacbcbb937ed1e2792b68c20157071532f5..a0dfe058af820cd8a7ddb1221d1bd5994bfbc962 100644 (file)
 Model_Update MY_UPDATER_INSTANCE;  /// the only one instance initialized on load of the library
 //#define DEB_UPDATE
 
+#ifdef DEB_UPDATE
+#include <Locale_Convert.h>
+#endif
+
 Model_Update::Model_Update()
 {
   Events_Loop* aLoop = Events_Loop::loop();
@@ -116,7 +120,7 @@ bool Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) {
     else if (myProcessOnFinish.find(theFeature) == myProcessOnFinish.end())
       myProcessOnFinish[theFeature] = std::set<std::shared_ptr<ModelAPI_Feature> >();
 #ifdef DEB_UPDATE
-      std::cout<<"*** Add process on finish "<<theFeature->name()<<std::endl;
+      std::wcout<<L"*** Add process on finish "<<theFeature->name()<<std::endl;
 #endif
     // keeps the currently updated features to avoid infinitive cycling here: where feature on
     // "updateArguments" sends "updated" (in selection attribute) and goes here again
@@ -328,8 +332,8 @@ void Model_Update::processEvent(const std::shared_ptr<Events_Message>& theMessag
       if (!(*anObjIter)->data()->isValid())
         continue;
 #ifdef DEB_UPDATE
-      std::cout<<">>> in event updated "<<(*anObjIter)->groupName()<<
-        " "<<(*anObjIter)->data()->name()<<std::endl;
+      std::wcout<<L">>> in event updated "<<Locale::Convert::toWString((*anObjIter)->groupName())
+                <<L" "<<(*anObjIter)->data()->name()<<std::endl;
 #endif
       if ((*anObjIter)->groupName() == ModelAPI_ResultParameter::group()) {
         myIsParamUpdated = true;
@@ -566,14 +570,14 @@ bool Model_Update::processFeature(FeaturePtr theFeature)
   }
 
 #ifdef DEB_UPDATE
-    std::cout<<"* Process feature "<<theFeature->name()<<std::endl;
+    std::wcout<<L"* Process feature "<<theFeature->name()<<std::endl;
 #endif
 
   // update the sketch plane before the sketch sub-elements are recomputed
   // (otherwise sketch will update plane, modify subs, after executed, but with old subs edges)
     if (aIsModified && theFeature->getKind() == "Sketch") {
 #ifdef DEB_UPDATE
-      std::cout << "****** Update sketch args " << theFeature->name() << std::endl;
+      std::wcout << L"****** Update sketch args " << theFeature->name() << std::endl;
 #endif
       AttributeSelectionPtr anExtSel = theFeature->selection("External");
       if (anExtSel.get()) {
@@ -692,7 +696,7 @@ bool Model_Update::processFeature(FeaturePtr theFeature)
   }
 
 #ifdef DEB_UPDATE
-  std::cout<<"Update args "<<theFeature->name()<<std::endl;
+  std::wcout<<L"Update args "<<theFeature->name()<<std::endl;
 #endif
   // TestImport.py : after arguments are updated, theFeature may be removed
   if (!theFeature->data()->isValid())
@@ -715,7 +719,7 @@ bool Model_Update::processFeature(FeaturePtr theFeature)
       // don't disable Part because it will make disabled all the features
       // (performance and problems with the current feature)
   #ifdef DEB_UPDATE
-    std::cout<<"Invalid args "<<theFeature->name()<<std::endl;
+    std::wcout<<L"Invalid args "<<theFeature->name()<<std::endl;
   #endif
     theFeature->eraseResults(false);
     redisplayWithResults(theFeature, ModelAPI_StateInvalidArgument); // result also must be updated
@@ -745,7 +749,7 @@ bool Model_Update::processFeature(FeaturePtr theFeature)
     }
   } else {
     #ifdef DEB_UPDATE
-      std::cout<<"Feature is not valid, erase results "<<theFeature->name()<<std::endl;
+      std::wcout<<L"Feature is not valid, erase results "<<theFeature->name()<<std::endl;
     #endif
     theFeature->eraseResults(false);
     redisplayWithResults(theFeature, ModelAPI_StateInvalidArgument); // result also must be updated
@@ -996,7 +1000,7 @@ bool Model_Update::isReason(std::shared_ptr<ModelAPI_Feature>& theFeature,
 void Model_Update::executeFeature(FeaturePtr theFeature)
 {
 #ifdef DEB_UPDATE
-  std::cout<<"Execute Feature "<<theFeature->name()<<std::endl;
+  std::wcout<<L"Execute Feature "<<theFeature->name()<<std::endl;
 #endif
   // execute in try-catch to avoid internal problems of the feature
   ModelAPI_ExecState aState = ModelAPI_StateDone;
index 4ac152b264143322b9cf9f707f0700be516254f7..f2947fc56fa5ab0c17204a36c6f204ac764dbbc9 100644 (file)
@@ -117,6 +117,7 @@ SET(PROJECT_SOURCES
 SET(PROJECT_LIBRARIES
     Config
     GeomAPI
+    Locale
 )
 SET(CMAKE_SWIG_FLAGS -threads -w325,321,362,383,302,403,451,473)
 ADD_DEFINITIONS(-DMODELAPI_EXPORTS)
@@ -129,6 +130,7 @@ INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/Config
                     ${PROJECT_SOURCE_DIR}/src/Events
                     ${PROJECT_SOURCE_DIR}/src/GeomAPI
                     ${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI
+                    ${PROJECT_SOURCE_DIR}/src/Locale
 )
 
 
index 068fd4d7a2e75380e997f60ab24545b0a696f0d6..56f39279e38d1edc4fb57ab7597529921bb4c4eb 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 fa5b5605319026dc5d26e6918e58a3191f6545ff..8946ae1378b45879d623699c639cda0c5355748f 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 08927e6d7ad855744724cd64ce0ea2031b21d8df..0dc72d00885843a394773cd7f0221245088f9e55 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 47b58eb95ec11f912f6eb9652f2729e3e0473bc3..ecc27d8658ce567b734295ffffd3c06a1dd0e700 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 b5308186c66f92ada2921d3e553da18d80e277a4..a156377715ac3c755fa1b9e3bf8e14339e3a77a9 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 bf05de24f4be00aee013be2588962f2c5c46150e..4bc97466a39d8396e0500f2c72518ec857c7c080 100644 (file)
@@ -234,8 +234,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(
@@ -256,22 +256,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 68af75b1b4acf3bff1ec651e78b4f172531ac338..0bfb4d53ed64fd0741bb1f029681405fe4c0208b 100644 (file)
@@ -121,7 +121,7 @@ MAYBE_UNUSED static const char * EVENT_VISUAL_ATTRIBUTES = "UpdateVisualAttribut
 
 
 /// Event ID that 1D-fillet failed (comes with ModelAPI_ShapesFailedMessage)
-static const char * EVENT_OPERATION_SHAPES_FAILED = "OperationShapesFailed";
+MAYBE_UNUSED static const char * EVENT_OPERATION_SHAPES_FAILED = "OperationShapesFailed";
 
 /// Message that feature was changed (used for Object Browser update): moved, updated and deleted
 class MODELAPI_EXPORT ModelAPI_ObjectUpdatedMessage : public Events_MessageGroup
@@ -404,8 +404,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.
@@ -418,8 +418,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
@@ -432,13 +432,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 edf117fc2411057a64e5d3adfb72419760d48dda..a700139ec7ce53c41961fce4f5020b03222ed4d1 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 1e30b6d936450cb58ed635dcb953aadf1df4d35a..da93623908719d30fc0d1175e4eeee7f975753ef 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 3db972621ea0b213e309ade25dcb009a95ca177a..a905e6d2978f30e71519e9b6e40961f8ff005e5f 100644 (file)
@@ -47,7 +47,7 @@ class ModelAPI_Object: public ModelAPI_Entity
   std::shared_ptr<ModelAPI_Document> myDoc;  ///< document this object belongs to
  public:
 #ifdef DEBUG_NAMES
-  std::string myName; // name of this object
+  std::wstring myName; // name of this object
 #endif
   /// By default object is displayed in the object browser.
   MODELAPI_EXPORT virtual bool isInHistory();
index dd91362403dbb2752e55c98dc8a0152e4999c46b..60a5d4e897128477a7c6a9431ec59ca172ee08be 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 5d050f06191d7412b8de98374a93c8460c047b50..ff06ed31e8ce2f3001dcb30e3860868d38ca56a3 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 38e39aca48c8c91cc4d38ec092a56815d7b9d094..d3c4919ffd410d6716a7c4ea8d83d4890ec4b815 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 9ea14ed93e9b9869892087bb1b27f09efc34b3c8..2f87922c2c277aea736198a3391fbd4ec0a28d14 100644 (file)
@@ -39,6 +39,7 @@
 #include <sstream>
 
 #include <Events_Loop.h>
+#include <Locale_Convert.h>
 #include <ModelAPI_Events.h>
 
 #include <GeomAPI_ShapeHierarchy.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 = Locale::Convert::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)
index 052993867db4bd23cdf6726bc6370717d942bb9e..27021498a53bf2fee1cf1eb51c4bb49123107fd2 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
@@ -299,7 +299,6 @@ MODELAPI_EXPORT void copyVisualizationAttrs(std::shared_ptr<ModelAPI_Result> the
 MODELAPI_EXPORT std::list<std::shared_ptr<ModelAPI_Feature> > referencedFeatures(
   std::shared_ptr<ModelAPI_Result> theTarget, const std::string& theFeatureKind,
   const bool theSortResults);
-
 }
 
 #endif
index a106279ac5c7813a81508421eca4c1c6e6d84c20..d94749f5c267c60eb8acc57259b838a20e7f7d92 100644 (file)
@@ -55,6 +55,7 @@ SET(PROJECT_LIBRARIES
   GeomAPI
   GeomDataAPI
   GeomAlgoAPI
+  Locale
   ModelAPI
   ModelGeomAlgo
 )
@@ -83,6 +84,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/GeomAPI
   ${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI
   ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
+  ${PROJECT_SOURCE_DIR}/src/Locale
   ${PROJECT_SOURCE_DIR}/src/ModelAPI
   ${PROJECT_SOURCE_DIR}/src/ModelGeomAlgo
   ${PROJECT_SOURCE_DIR}/src/PartSetPlugin
index 778261db1f80229da20d80fcc35681e198b9d9ba..f1ec7251fe4aa34b681e826452a78f39608a814a 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;
 // std::pair -> []
 %template(ResultSubShapePair) std::pair<std::shared_ptr<ModelAPI_Result>, std::shared_ptr<GeomAPI_Shape> >;
 %template(StringsPair) std::pair<std::string, std::string>;
+%template(StringWStringPair) std::pair<std::string, std::wstring>;
 
 
 // fix compilarion error: 'res*' was not declared in this scope
index 636726edabedf10991cdd2bfd863b1e51553a6c0..c46e05119e81084360c7540aecad99d68defe322 100644 (file)
@@ -37,6 +37,8 @@
 #include <GeomDataAPI_Point2D.h>
 #include <GeomDataAPI_Point2DArray.h>
 
+#include <Locale_Convert.h>
+
 #include <ModelAPI_AttributeBoolean.h>
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeDoubleArray.h>
@@ -315,7 +317,7 @@ void ModelHighAPI_Dumper::DumpStorage::write(const AttributeSelectionPtr& theAtt
 
   if (aShape.get()) {
     myDumpBuffer << "\"" << aShape->shapeTypeStr() << "\", \""
-                 << theAttrSelect->namingName() << "\"";
+                 << Locale::Convert::toString(theAttrSelect->namingName()) << "\"";
   }
 
   myDumpBuffer << ")";
@@ -496,7 +498,8 @@ void ModelHighAPI_Dumper::DumpStorageWeak::write(const AttributeSelectionPtr& th
     int anIndex = aNExplode.index(aShape);
     if (anIndex != 0) { // found a week-naming index, so, export it
       myDumpBuffer << "model.selection(\"" << aShape->shapeTypeStr() << "\", \""
-                   << theAttrSelect->contextName(aContext) << "\", " << anIndex << ")";
+                   << Locale::Convert::toString(theAttrSelect->contextName(aContext))
+                   << "\", " << anIndex << ")";
       aStandardDump = false;
     }
   }
@@ -580,18 +583,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 = Locale::Convert::toString(aFeature->name());
     aKind = aFeature->getKind();
   } else {
     FolderPtr aFolder = std::dynamic_pointer_cast<ModelAPI_Folder>(theEntity);
     if (aFolder) {
-      aName = aFolder->data()->name();
+      aName = Locale::Convert::toString(aFolder->data()->name());
       aKind = ModelAPI_Folder::ID();
       isSaveNotDumped = false;
     }
@@ -683,9 +687,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 = Locale::Convert::toString(aName.first);
+    std::string aResName = Locale::Convert::toString((*aRes)->data()->name());
     bool isUserDefined = !(isFeatureDefaultName && aDefaultName == aResName);
     myNames[*aRes] =
       EntityName(aResName, (isUserDefined ? aResName : std::string()), !isUserDefined);
@@ -869,14 +873,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, Locale::Convert::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 = Locale::Convert::toString((*aResIt)->data()->name());
     myNames[*aResIt] = EntityName(aResName, aResName, false);
     aResultsWithNameOrColor.push_back(*aResIt);
   }
@@ -1087,6 +1092,12 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const std::string& theStrin
   return *this;
 }
 
+ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const std::wstring& theString)
+{
+  *myDumpStorage << Locale::Convert::toString(theString);
+  return *this;
+}
+
 ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const bool theValue)
 {
   *myDumpStorage << (theValue ? "True" : "False");
index 5a0461f052938887202f359916d124f9d0825af9..1fa21e9da80e7b181ed6aa4f6859b80f5fa4da40 100644 (file)
@@ -230,6 +230,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 bf7a6fa9e39aa8c179b2b169d409f5eb45f0ac3d..1493d104b49ab504eab8bdc6a2918ec1cdb31315 100644 (file)
@@ -46,6 +46,8 @@
 #include <GeomAlgoAPI_ShapeTools.h>
 #include <GeomAPI_Pnt.h>
 
+#include <Locale_Convert.h>
+
 #include <TopoDS_Shape.hxx>
 #include <TopExp_Explorer.hxx>
 
@@ -75,7 +77,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 '" + Locale::Convert::toString(theObject->data()->name()) +
+      "' differ:" + anError;
   }
 
   FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
@@ -87,11 +90,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 '" + Locale::Convert::toString(aFeature->name()) +
+        "' '" + Locale::Convert::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 '" +
+        Locale::Convert::toString((*aRes)->data()->name()) + "'";
     }
     if (aResIter != myRes.end()) {
       return "Original model had more results '" + (*aResIter)["__name__"] + "'";
@@ -104,7 +109,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__"] = Locale::Convert::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 +194,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<< Locale::Convert::toString(aRes->data()->name());
       }
     } else {
       aResult<<aDoc->kind(); // PartSet
@@ -243,7 +249,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<< Locale::Convert::toString(anAttr->value()->data()->name());
     } else {
       aResult<<"__empty__";
     }
@@ -251,7 +257,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<< Locale::Convert::toString(anAttr->namingName());
     else
       aResult<<"__notinitialized__";
   } else if (aType == ModelAPI_AttributeSelectionList::typeId()) {
@@ -260,14 +266,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<< Locale::Convert::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<< Locale::Convert::toString(anObj->data()->name());
       if (!anAttr->isObject()) {
         aResult<<" "<<anAttr->attr()->id();
       }
@@ -293,7 +299,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(Locale::Convert::toString((*aL)->data()->name()));
       } else if (!isSketchFeatures) {
         aResList.push_back("__empty__");
       }
@@ -313,7 +319,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<< Locale::Convert::toString(anObj->data()->name());
         if (aL->second.get()) {
           aResult<<" "<<aL->second->id();
         }
index 434f6c6c9d1d3969c43a83ec7a9fc5306ef16f46..2a2e583632e6342588dab9fa923e0fb4780feea6 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 d2e234a60dab13a328476216310a0511e5525421..13c1493dfcba4e2074f483fcb6e7f558bb85f72f 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 cec0fb1cec3a359bc2d59d28c5199dda95875d49..8a2f1c6442898be866d9d63384e6013b3d7ac24c 100644 (file)
@@ -86,7 +86,7 @@ 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()->isValid())
     feature()->data()->setName(theName);
@@ -95,7 +95,7 @@ void ModelHighAPI_Interface::setName(const std::string& theName)
   }
 }
 
-std::string ModelHighAPI_Interface::name() const
+std::wstring ModelHighAPI_Interface::name() const
 {
   return feature()->data()->name();
 }
index 47cea396e8a1d76cf415163b3d00852b73e31da7..34f308c6b0e779f598d3ba2bd2d660cf1cd1099d 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 7cc4cf0e402e7645b6253f499827d60c28126632..83fab90dea5adff036f24f0e1a8d6e042fd342d6 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))
 {
 }
 
@@ -188,7 +188,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;
@@ -199,14 +199,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 3b805313b44d41a88a0b548ea3b35a24597456f5..66cb0b8055175cfb7bf4c1774d692f7b06e712d7 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 433f619b0e07806778ee883bab747ff6e9c1d6c3..4aecbb0b2b683ee3e5f182cbc276e9ed04300e73 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 55521992d31b396040cbb4f21b3307797cecf3d3..ed1a363b2a323c0859a1d3bdc889731849167df6 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 0b91369bf71167a38dfbe109721542d3f2aade6f..0b72c418f795263e3808897a343f6f11068bf968 100644 (file)
@@ -29,6 +29,8 @@
 #include <GeomDataAPI_Point2D.h>
 #include <GeomDataAPI_Point2DArray.h>
 //--------------------------------------------------------------------------------------
+#include <Locale_Convert.h>
+//--------------------------------------------------------------------------------------
 #include <ModelAPI_AttributeBoolean.h>
 #include <ModelAPI_AttributeDocRef.h>
 #include <ModelAPI_AttributeDouble.h>
@@ -410,20 +412,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 '" + Locale::Convert::toString(theDocName) + "' not found";
      }
   }
   // store the model features information: iterate all features
   size_t 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();
@@ -439,14 +441,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 '" + Locale::Convert::toString(theDocName)
+          + "' feature '" + Locale::Convert::toString(anObject->data()->name()) + "' not found";
       }
       std::string anError = anObjFind->second.compare(anObject);
       if (!anError.empty()) {
-        anError = "Document " + theDocName + " " + anError;
+        anError = "Document " + Locale::Convert::toString(theDocName) + " " + anError;
         return anError;
       }
       anObjectsCount++;
@@ -478,22 +481,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 '" + Locale::Convert::toString(theDocName) +
+        "' the number of features is decreased, there is no feature '" +
+        Locale::Convert::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,
@@ -539,8 +543,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(Locale::Convert::toWString(theSession->moduleDocument()->kind()),
+    theSession->moduleDocument(), theStorage, true);
   if (!anError.empty()) {
     std::cout << anError << std::endl;
     Events_InfoMessage anErrorMsg(theErrorMsgContext, anError);
@@ -583,9 +588,10 @@ bool checkPyDump(
     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(Locale::Convert::toWString(aSession->moduleDocument()->kind()),
+    aSession->moduleDocument(), aStore, false);
   if (!anError.empty()) {
     Events_InfoMessage anErrorMsg(std::string("checkPythonDump"), anError);
     anErrorMsg.send();
index 557675b18a70f3745c42542e1eddd4a93e1ae3ab..1ce6a6b55d4fff3393b24e3e61ea1b441bac867e 100644 (file)
@@ -425,6 +425,10 @@ public slots:
   /// \param theAIS a presentation object
   virtual void onBeforeObjectErase(ObjectPtr theObject, AISObjectPtr theAIS) {}
 
+  /// Called on transformation in current viewer
+  /// \param theTrsfType type of tranformation
+  virtual void onViewTransformed(int theTrsfType = 2) {}
+
 protected slots:
   /// Called on selection changed event
   virtual void onSelectionChanged() {}
index e190a8fab4ae9181e82fdb7583690ec2ad086b27..3037eceac9245fca4ac21a6bb21d8ca398656968 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) {
     FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner());
     if (aFeature.get()) {
@@ -1296,7 +1296,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 54eb46c9edd61a342045d577398f00bf09973ffc..1ac68db740cd5133ebee3266cec8580e4739d03d 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 2e28a3f93fae170d96148106cc9f721dfabcbd34..5e3a3d058949ad06c9938c67762dbd627af0d5cc 100644 (file)
@@ -160,7 +160,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 f76eb34e1321318e642fa2954af1c28c1192bfdd..6052fe7a1dfff135d4d3c9d03fe2901ae9edc1b8 100644 (file)
@@ -183,8 +183,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 5d12d728af230f19d6a35ddb51520e3071c7a53a..21df54023958ca84d37343e5786b1b51688c5c2e 100644 (file)
@@ -128,12 +128,31 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
   myMainLayout = new QVBoxLayout(this);
   ModuleBase_Tools::adjustMargins(myMainLayout);
 
-  QStringList aIconsList = getIconsList(myShapeTypes);
+
+  QStringList aIconsList;
+  std::string aIcons = theData->getProperty("type_icons");
+  if (aIcons.size() > 0)
+    aIconsList = QString(aIcons.c_str()).split(' ', QString::SkipEmptyParts);
+
+  if (aIconsList.size() != myShapeTypes.size())
+    aIconsList = getIconsList(myShapeTypes);
+
   myTypeCtrl = new ModuleBase_ChoiceCtrl(this, myShapeTypes, aIconsList);
   myTypeCtrl->setLabel(tr("Type"));
   if (!myShapeTypes.empty()) {
-    myTypeCtrl->setValue(0);
-    myDefMode = myShapeTypes.first().toStdString();
+    std::string aDefType = theData->getProperty("default_type");
+    if (aDefType.size() > 0) {
+      bool aOk = false;
+      int aId = QString(aDefType.c_str()).toInt(&aOk);
+      if (aOk) {
+        myTypeCtrl->setValue(aId);
+        myDefMode = myShapeTypes.at(aId).toStdString();
+      }
+    }
+    if (myDefMode.size() == 0) {
+      myTypeCtrl->setValue(0);
+      myDefMode = myShapeTypes.first().toStdString();
+    }
   }
   myMainLayout->addWidget(myTypeCtrl);
 
@@ -570,6 +589,8 @@ bool ModuleBase_WidgetMultiSelector::processDelete()
 QList<QWidget*> ModuleBase_WidgetMultiSelector::getControls() const
 {
   QList<QWidget*> result;
+  if (myTypeCtrl->isVisible())
+    result << myTypeCtrl;
   result << myListView->getControl();
   return result;
 }
@@ -618,8 +639,9 @@ void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()
   restoreValue();
   myWorkshop->setSelected(getAttributeSelection());
   // may be the feature's result is not displayed, but attributes should be
-  myWorkshop->module()->customizeFeature(myFeature, ModuleBase_IModule::CustomizeArguments,
-                            true); /// hope that something is redisplayed by object updated
+  // hope that something is redisplayed by object updated
+  myWorkshop->module()->customizeFeature(myFeature, ModuleBase_IModule::CustomizeArguments, false);
+  myWorkshop->module()->customizeFeature(myFeature, ModuleBase_IModule::CustomizeResults, true);
   // clear history should follow after set selected to do not increase history by setSelected
   clearSelectedHistory();
 
@@ -777,7 +799,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()) {
@@ -785,7 +807,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);
       }
     }
   }
@@ -795,13 +817,13 @@ void ModuleBase_WidgetMultiSelector::updateSelectionList()
       AttributePtr anAttr = aRefAttrListAttr->attribute(i);
       QString aName;
       if (anAttr.get()) {
-        std::string anAttrName = ModuleBase_Tools::generateName(anAttr, myWorkshop);
-        aName = QString::fromStdString(anAttrName);
+        std::wstring anAttrName = ModuleBase_Tools::generateName(anAttr, 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 1304e97792877a41c13aa598e300e40117e61185..66d05c76b463915b2d22908f57c9cce61ca5477c 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 89c506e8616a6ab567b72501212f57e68f76ff70..c63a3e85d4a4bcf2b55f807570d29a23518cd53a 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 cdcc60aeb24875a49e869da5997d334c50aae913..050f6abb6e3cc9c6e43c98bf4061b56abd1a208b 100644 (file)
         <source>Replace</source>
         <translation>Remplacer</translation>
     </message>
+  <message>
+    <source>Trihedron arrows constant size</source>
+    <translation>Flèche trièdre de taille constante</translation>
+  </message>
+    <message>
+        <source>Keep trihedron arrows view size constant</source>
+        <translation>Maintenir la taille de la vue des flèches trièdres constante</translation>
+    </message>
 </context>
 </TS>
index d9d1a864ce1b8f8c5c248ccb77c5a716b3d477bc..89b45c450620bf1beff857fae6042db6f5600843 100644 (file)
@@ -22,7 +22,10 @@ INCLUDE(UnitTest)
 INCLUDE(UseQtExt)
 
 # additional include directories
-INCLUDE_DIRECTORIES(${QT_INCLUDES})
+INCLUDE_DIRECTORIES(
+    ../Locale
+    ${QT_INCLUDES}
+)
 
 # additional preprocessor / compiler flags
 ADD_DEFINITIONS(${QT_DEFINITIONS})
@@ -68,6 +71,7 @@ INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/Events
 SET(PROJECT_LIBRARIES
     Events
     Config
+    Locale
     ModelAPI
     ModuleBase
     ${QT_LIBRARIES}
index 32194253c7c69fac31b2ea68bd82aedb02b71826..56cefb18287f12da86e9edb2854d12af73e2ce2b 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <Events_InfoMessage.h>
 
+#include <Locale_Convert.h>
+
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_AttributeRefList.h>
@@ -239,16 +241,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(Locale::Convert::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 = Locale::Convert::toString(aParameter->name());
   aWasBlocked = aParameter->data()->blockSendAttributeUpdated(true);
-  aParameter->data()->setName(theName);
+  aParameter->data()->setName(Locale::Convert::toWString(theName));
   aParameter->string(ParametersPlugin_Parameter::VARIABLE_ID())->setValue(theName);
   aParameter->data()->blockSendAttributeUpdated(aWasBlocked);
 }
@@ -277,7 +279,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 =
@@ -290,28 +292,29 @@ void ParametersPlugin_EvalListener::processObjectRenamedEvent(
         ModuleBase_Tools::translate(aMsg),
         QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
     if (aRes != QMessageBox::Yes) {
-      setParameterName(aResultParameter, aMessage->oldName());
+      setParameterName(aResultParameter, Locale::Convert::toString(aMessage->oldName()));
       return;
     }
   }
 
   // try to update the parameter feature according the new name
-  setParameterName(aResultParameter, aMessage->newName());
+  setParameterName(aResultParameter, Locale::Convert::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()] = Locale::Convert::toString(aMessage->oldName());
     return;
   }
 
-  std::string anOldName = aMessage->oldName();
+  std::string anOldName = Locale::Convert::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,
+                     Locale::Convert::toString(aMessage->newName()));
 }
 
 void ParametersPlugin_EvalListener::processReplaceParameterEvent(
@@ -336,5 +339,7 @@ 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,
+                     Locale::Convert::toString(aResultParameter->data()->name()),
+                     aValue);
 }
index 9d77b3e294fb92e2b8286a545d186475d8aaf294..02010379877b7221d700704b4e4ef1de3aa1f0ba 100644 (file)
@@ -21,6 +21,8 @@
 
 #include "ParametersPlugin_Parameter.h"
 
+#include <Locale_Convert.h>
+
 #include <ModelAPI_AttributeString.h>
 #include <ModelAPI_ResultParameter.h>
 #include <ModelAPI_AttributeDouble.h>
@@ -74,11 +76,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(Locale::Convert::toWString(aName));
 
   ResultParameterPtr aParam = document()->createParameter(data());
-  std::string anOldName = aParam->data()->name();
-  aParam->data()->setName(aName);
+  std::string anOldName = Locale::Convert::toString(aParam->data()->name());
+  aParam->data()->setName(Locale::Convert::toWString(aName));
   setResult(aParam);
 
 
index e9f49ffe509627d8e75a250fc0561403a5f7739e..05fd8a83930d7adfe8a3eee4c85a798c12c7f59c 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <Events_InfoMessage.h>
 
+#include <Locale_Convert.h>
+
 #include <ModelAPI_AttributeString.h>
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_ResultParameter.h>
@@ -71,7 +73,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 (Locale::Convert::toString(aParamObj->data()->name()) != theString)
       continue;
     ResultParameterPtr aParam = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aParamObj);
     if (!aParam.get())
index bd89f9a80fba21011262cc233d8a62e563ad51b1..e85dc9a3521ccb8d84c44b58f06b265585576ee6 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()) {
@@ -768,7 +768,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 851ad9d0ec637e2d35ac4e69e3dffb9b996e7c37..d158d3470a1dd3c72cb080ddcbd64ccdebd844ae 100644 (file)
@@ -131,6 +131,7 @@ SET(PROJECT_LIBRARIES
     ModuleBase
     ModelGeomAlgo
     Config
+    Locale
     GeomAPI
     GeomDataAPI
     SketcherPrs
@@ -163,6 +164,7 @@ SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES})
 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/XGUI
                     ${PROJECT_SOURCE_DIR}/src/Config
                     ${PROJECT_SOURCE_DIR}/src/Events
+                    ${PROJECT_SOURCE_DIR}/src/Locale
                     ${PROJECT_SOURCE_DIR}/src/ModuleBase
                     ${PROJECT_SOURCE_DIR}/src/ModelAPI
                     ${PROJECT_SOURCE_DIR}/src/ModelGeomAlgo
index 640f9f82738efcd97db7f348030987b46515927d..06252baa5ff1d3c94a356482a51125673d2802a2 100644 (file)
@@ -193,7 +193,7 @@ bool PartSet_MenuMgr::addViewerMenu(const QMap<QString, QAction*>& theStdActions
             QAction* aAction;
             int i = 0;
             foreach (FeaturePtr aCoinsL, myCoinsideLines) {
-              QString anItemText = aCoinsL->data()->name().c_str();
+              QString anItemText = QString::fromStdWString(aCoinsL->data()->name());
 #ifdef _DEBUG
               if (anIsAttributes[i])
                 anItemText += " [attribute]";
@@ -317,8 +317,8 @@ void PartSet_MenuMgr::onLineDetach(QAction* theAction)
     XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
     XGUI_Workshop* aWorkshop = aConnector->workshop();
 
-    ModuleBase_Operation* anOpAction =
-      new ModuleBase_Operation(tr("Detach %1").arg(aLine->data()->name().c_str()), myModule);
+    ModuleBase_Operation* anOpAction = new ModuleBase_Operation(tr("Detach %1").arg(
+        QString::fromStdWString(aLine->data()->name())), myModule);
     XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
     // the active nested sketch operation should be aborted unconditionally
     // the Delete action should be additionally granted for the Sketch operation
index 446b253b31c064f3380bb860c37458d7bbafe409..108db7563a6e55d89ff1affa57834a6112d3deb3 100644 (file)
@@ -233,6 +233,7 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
                                    "Hidden faces transparency",
                                    Config_Prop::DblSpin,
                                    "0.8");
+
   std::ostringstream aStream;
   aStream << SketcherPrs_Tools::getDefaultArrowSize();
   Config_PropManager::registerProp("Visualization", "dimension_arrow_size",
@@ -255,6 +256,12 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
     "Feature items in Object Browser",
     Config_Prop::Color, FEATURE_ITEM_COLOR);
 
+  Config_PropManager::registerProp("Visualization", "zoom_trihedron_arrows",
+    "Keep trihedron arrows view size constant", Config_Prop::Boolean, "false");
+
+  Config_PropManager::registerProp("Visualization", "axis_arrow_size",
+    "Trihedron arrows constant size", Config_Prop::IntSpin, "10");
+
   Config_PropManager::registerProp("Shortcuts", "add_parameter_shortcut",
     "Add parameter in parameters manager dialog",
     Config_Prop::Shortcut, "Ctrl+A");
@@ -1146,13 +1153,13 @@ void PartSet_Module::onViewTransformed(int theTrsfType)
     return;
 
   bool isModified = false;
+  double aLen = aView->Convert(SketcherPrs_Tools::getConfigArrowSize());
   ModuleBase_Operation* aCurrentOperation = myWorkshop->currentOperation();
   if (aCurrentOperation &&
     (PartSet_SketcherMgr::isSketchOperation(aCurrentOperation) ||
      sketchMgr()->isNestedSketchOperation(aCurrentOperation) ||
      (aCurrentOperation->id() == "Measurement")))
   {
-    double aLen = aView->Convert(SketcherPrs_Tools::getConfigArrowSize());
     SketcherPrs_Tools::setArrowSize(aLen);
     const double aCurScale = aViewer->activeView()->Camera()->Scale();
     aViewer->SetScale(aViewer->activeView(), aCurScale);
@@ -1171,10 +1178,24 @@ void PartSet_Module::onViewTransformed(int theTrsfType)
         isModified = true;
       }
     }
-    if (isModified)
-      aDisplayer->updateViewer();
   }
 
+  // Manage trihedron arrows
+  if (Config_PropManager::boolean("Visualization", "zoom_trihedron_arrows")) {
+    Handle(AIS_Trihedron) aTrihedron = aViewer->trihedron();
+    if (!aTrihedron.IsNull()) {
+      double aAxLen =
+        aView->Convert(Config_PropManager::integer("Visualization", "axis_arrow_size"));
+      Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect();
+      double aAxisLen = aDatumAspect->AxisLength(Prs3d_DP_XAxis);
+      aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, aAxLen / aAxisLen);
+      aTrihedron->Attributes()->SetDatumAspect(aDatumAspect);
+      aContext->Redisplay(aTrihedron, false);
+      isModified = true;
+    }
+  }
+  if (isModified)
+    aDisplayer->updateViewer();
 }
 
 //******************************************************
@@ -1826,3 +1847,30 @@ void PartSet_Module::disableCustomMode(ModuleBase_CustomizeFlag theMode) {
 void PartSet_Module::enableCustomModes() {
   myCustomPrs->enableCustomModes();
 }
+
+//******************************************************
+void PartSet_Module::onConflictingConstraints()
+{
+  const std::set<ObjectPtr>& aConstraints = myOverconstraintListener->conflictingObjects();
+  QObjectPtrList aObjectsList;
+  std::set<ObjectPtr>::const_iterator aIt;
+  for (aIt = aConstraints.cbegin(); aIt != aConstraints.cend(); aIt++) {
+    if (mySketchReentrantMgr->isLastAutoConstraint(*aIt))
+      aObjectsList.append(*aIt);
+  }
+  if (aObjectsList.size() > 0) {
+    XGUI_Workshop* aWorkshop = getWorkshop();
+    QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text();
+    ModuleBase_Operation* anOpAction = new ModuleBase_Operation(aDescription);
+    XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
+
+    ModuleBase_Operation* anOp = anOpMgr->currentOperation();
+    if (sketchMgr()->isNestedSketchOperation(anOp))
+      anOp->abort();
+
+    anOpMgr->startOperation(anOpAction);
+    aWorkshop->deleteFeatures(aObjectsList);
+    anOpMgr->commitOperation();
+    ModuleBase_Tools::flushUpdated(sketchMgr()->activeSketch());
+  }
+}
index a0d62efa3dddc642a9d55afa0121549ff564ffe7..1cf8750e8847b55dea908c16928949a9bc450862 100644 (file)
@@ -412,7 +412,9 @@ public slots:
 
   /// Called on transformation in current viewer
   /// \param theTrsfType type of tranformation
-  void onViewTransformed(int theTrsfType = 2);
+  virtual void onViewTransformed(int theTrsfType = 2);
+
+  void onConflictingConstraints();
 
 protected slots:
   /// Called when previous operation is finished
index 2dd82dbc5e83bd48ee0329c4054e71ca4a284b2b..e263c62217d7222a4deeef1b9e8e272e954a1954 100644 (file)
@@ -35,6 +35,8 @@
 #include "SketchPlugin_SketchEntity.h"
 #include "SketchPlugin_MacroArcReentrantMessage.h"
 #include "SketchPlugin_Sketch.h"
+#include "SketchPlugin_ConstraintHorizontal.h"
+#include "SketchPlugin_ConstraintVertical.h"
 
 #include "Events_Loop.h"
 
@@ -44,6 +46,7 @@
 #include <ModuleBase_Tools.h>
 
 #include <QString>
+#include <QTimer>
 
 //#define DEBUG_FEATURE_OVERCONSTRAINT_LISTENER
 
@@ -91,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");
@@ -196,7 +198,7 @@ void PartSet_OverconstraintListener::processEvent(const std::shared_ptr<Events_M
     // 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) {
@@ -239,17 +241,34 @@ bool PartSet_OverconstraintListener::appendConflictingObjects(
   // set error state for new objects and append them in the internal map of objects
   std::set<ObjectPtr>::const_iterator
     anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end();
+  FeaturePtr aFeature;
+  bool isHVConstraint = false;
   for (; anIt != aLast; anIt++) {
     ObjectPtr anObject = *anIt;
     if (myConflictingObjects.find(anObject) == myConflictingObjects.end()) { // it is not found
       aModifiedObjects.insert(anObject);
       myConflictingObjects.insert(anObject);
     }
+    if (!isHVConstraint) {
+      aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObject);
+      if (aFeature) {
+        std::string aType = aFeature->getKind();
+        isHVConstraint = (aType == SketchPlugin_ConstraintHorizontal::ID()) ||
+          (aType == SketchPlugin_ConstraintVertical::ID());
+      }
+    }
   }
   bool isUpdated = !aModifiedObjects.empty();
   if (isUpdated)
     redisplayObjects(aModifiedObjects);
 
+  // If the conflicting object is an automatic constraint caused the conflict
+  // then it has to be deleted
+  if (isHVConstraint) {
+    PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
+    QTimer::singleShot(5, aModule, SLOT(onConflictingConstraints()));
+  }
+
   return isUpdated;
 }
 
@@ -264,7 +283,6 @@ bool PartSet_OverconstraintListener::repairConflictingObjects(
     ObjectPtr anObject = *anIt;
     if (theConflictingObjects.find(anObject) != theConflictingObjects.end()) { // it is found
       myConflictingObjects.erase(anObject);
-
       aModifiedObjects.insert(anObject);
     }
   }
index 49390f0ee7752b11f9eeee9389fb9512e664c3de..fb56175b2038cce017319173272e3f14a75169b5 100644 (file)
@@ -64,6 +64,11 @@ public:
     return (myConflictingObjects.find(theObject) != myConflictingObjects.end());
   }
 
+  const std::set<ObjectPtr>& conflictingObjects() const
+  {
+    return myConflictingObjects;
+  }
+
   bool isFullyConstrained() const { return myIsFullyConstrained; }
 
 protected:
index 689c034b591fbe42854076736793db0ae6291a38..1b515d32b1f50bc35c7f4c6bf93a93d053ebf0d6 100644 (file)
@@ -1134,7 +1134,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 767df1296c5e2e6156a1debf02ed6c4e2a7e0fc5..90dee037af4340a47c60cd40e0e6f700fd525083 100644 (file)
@@ -75,7 +75,8 @@ PartSet_SketcherReentrantMgr::PartSet_SketcherReentrantMgr(ModuleBase_IWorkshop*
   myIsFlagsBlocked(false),
   myIsInternalEditOperation(false),
   myNoMoreWidgetsAttribute(""),
-  myIsAutoConstraints(true)
+  myIsAutoConstraints(true),
+  myLastAutoConstraint(0)
 {
 }
 
@@ -869,16 +870,24 @@ void PartSet_SketcherReentrantMgr::addConstraints(const FeaturePtr& theFeature)
     double aTolerance = Config_PropManager::real(SKETCH_TAB_NAME, "angular_tolerance");
     CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch();
     FeaturePtr aFeature;
-    if (aHorAngle < aTolerance)
+    if (aHorAngle < aTolerance) {
       // Add horizontal constraint
       aFeature = aSketch->addFeature(SketchPlugin_ConstraintHorizontal::ID());
-    else if (aVertAngle < aTolerance)
+    }
+    else if (aVertAngle < aTolerance) {
       // Add vertical constraint
       aFeature = aSketch->addFeature(SketchPlugin_ConstraintVertical::ID());
-
+    }
     if (aFeature.get()) {
       aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())->setObject(
           theFeature->firstResult());
+      myLastAutoConstraint = aFeature.get();
     }
   }
 }
+
+
+bool PartSet_SketcherReentrantMgr::isLastAutoConstraint(const ObjectPtr& theObj) const
+{
+  return theObj.get() == myLastAutoConstraint;
+}
index 378de5ace207f930864e8c32fd3b7c00f2f9d1b4..c641b57dd5171025050b84e688d28e2040c44256 100644 (file)
@@ -134,6 +134,8 @@ public:
   bool isAutoConstraints() const { return myIsAutoConstraints; }
 
 
+  bool isLastAutoConstraint(const ObjectPtr& theObj) const;
+
 public slots:
   /// The slot is called when user checks "Automatic constraints" button
   /// \param isOn a state of the check box
index c0400d6f74f356aa8abe83c655162f062a9b1b95..114eea0a5a6dfb8154a55cb568b2d257a5510d71 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 d54d0caeec06bf201e1dc04275f1bfcafc84fb8e..eca70a4457be241e91f967e04874822500bbebd6 100644 (file)
@@ -53,6 +53,8 @@
 #include <SketchPlugin_Point.h>
 #include <GeomAPI_Edge.h>
 
+#include <Locale_Convert.h>
+
 #include <list>
 #include <unordered_map>
 #ifdef _DEBUG
@@ -435,8 +437,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() ? Locale::Convert::toString(anObject->data()->name()) : "",
+                theAttribute->id(), aRef->id());
               return false;
             }
           }
@@ -512,8 +515,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() ? Locale::Convert::toString(anObject->data()->name()) : "",
+              theAttribute->id(), aRef->id());
             return false;
           }
         }
@@ -608,8 +612,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()?
+                  Locale::Convert::toString(aCurSelObject->data()->name()) : "",
+                  theAttribute->id(), aCurSelList->id());
                 return false;
               }
             }
index 5fe28ccc83abd3bbd8118f15f7a163391de181d4..3fe190981afe16bd41d069bc8916c01f82f57e5b 100644 (file)
@@ -53,6 +53,9 @@
 #include <ModuleBase_IPropertyPanel.h>
 #include <ModuleBase_OperationFeature.h>
 #include <ModuleBase_ViewerPrs.h>
+#include <ModuleBase_ChoiceCtrl.h>
+#include <ModuleBase_IWorkshop.h>
+#include <ModuleBase_ISelectionActivate.h>
 
 #include <Config_WidgetAPI.h>
 
 
 #define DEBUG_UNDO_INVALID_SKETCH
 
+
+
+QStringList getIconsList(const QStringList& theNames)
+{
+  QStringList aIcons;
+  foreach(QString aName, theNames) {
+    QString aUName = aName.toUpper();
+    if ((aUName == "VERTICES") || (aUName == "VERTEX"))
+      aIcons << ":pictures/vertex32.png";
+    else if ((aUName == "EDGES") || (aUName == "EDGE"))
+      aIcons << ":pictures/edge32.png";
+    else if ((aUName == "FACES") || (aUName == "FACE"))
+      aIcons << ":pictures/face32.png";
+  }
+  return aIcons;
+}
+
+
+
 PartSet_WidgetSketchCreator::PartSet_WidgetSketchCreator(QWidget* theParent,
                                                          PartSet_Module* theModule,
                                                          const Config_WidgetAPI* theData)
@@ -102,11 +124,45 @@ PartSet_WidgetSketchCreator::PartSet_WidgetSketchCreator(QWidget* theParent,
 
   aLayout->addWidget(mySizeOfViewWidget);
   aLayout->addWidget(myLabel);
-  aLayout->addStretch(1);
 
   std::string aTypes = theData->getProperty("shape_types");
   myShapeTypes = QString(aTypes.c_str()).split(' ', QString::SkipEmptyParts);
+  myIsUseChoice = theData->getBooleanAttribute("use_choice", false);
+
+  QStringList aIconsList;
+  std::string aIcons = theData->getProperty("type_icons");
+  if (aIcons.size() > 0)
+    aIconsList = QString(aIcons.c_str()).split(' ', QString::SkipEmptyParts);
+
+  if (aIconsList.size() != myShapeTypes.size())
+    aIconsList = getIconsList(myShapeTypes);
+
+  myTypeCtrl = new ModuleBase_ChoiceCtrl(this, myShapeTypes, aIconsList);
+  myTypeCtrl->setLabel(tr("Type"));
+  if (!myShapeTypes.empty()) {
+    std::string aDefType = theData->getProperty("default_type");
+    if (aDefType.size() > 0) {
+      bool aOk = false;
+      int aId = QString(aDefType.c_str()).toInt(&aOk);
+      if (aOk) {
+        myTypeCtrl->setValue(aId);
+        myDefMode = myShapeTypes.at(aId).toStdString();
+      }
+    }
+    if (myDefMode.size() == 0) {
+      myTypeCtrl->setValue(0);
+      myDefMode = myShapeTypes.first().toStdString();
+    }
+  }
+  aLayout->addWidget(myTypeCtrl);
+  // There is no sense to parameterize list of types while we can not parameterize selection mode
+  // if the xml definition contains one type, the controls to select a type should not be shown
+  if (myShapeTypes.size() <= 1 || !myIsUseChoice) {
+    myTypeCtrl->setVisible(false);
+  }
+  connect(myTypeCtrl, SIGNAL(valueChanged(int)), this, SLOT(onSelectionTypeChanged()));
 
+  aLayout->addStretch(1);
   myPreviewPlanes = new PartSet_PreviewPlanes();
 }
 
@@ -250,8 +306,13 @@ void PartSet_WidgetSketchCreator::setVisibleSelectionControl(const bool theSelec
 QIntList PartSet_WidgetSketchCreator::shapeTypes() const
 {
   QIntList aShapeTypes;
-  foreach(QString aType, myShapeTypes) {
-    aShapeTypes.append(ModuleBase_Tools::shapeType(aType));
+  if (myShapeTypes.length() > 1 && myIsUseChoice) {
+    aShapeTypes.append(ModuleBase_Tools::shapeType(myTypeCtrl->textValue()));
+  }
+  else {
+    foreach(QString aType, myShapeTypes) {
+      aShapeTypes.append(ModuleBase_Tools::shapeType(aType));
+    }
   }
   return aShapeTypes;
 }
@@ -584,3 +645,38 @@ void PartSet_WidgetSketchCreator::setEnabledModelWidget(ModuleBase_ModelWidget*
     eachControl->setEnabled(theEnabled);
   }
 }
+
+void PartSet_WidgetSketchCreator::onSelectionTypeChanged()
+{
+  // Clear current selection in order to avoid updating of object browser with obsolete indexes
+  // which can appear because of results deletetion after changing a type of selection
+  QString aSelectionType = myTypeCtrl->textValue();
+  QList<ModuleBase_ViewerPrsPtr> aEmptyList;
+  myWorkshop->setSelected(aEmptyList);
+
+  updateSelectionModesAndFilters(true);
+  myWorkshop->selectionActivate()->updateSelectionModes();
+
+  if (!myFeature)
+    return;
+
+  if (aSelectionType != "Faces") {
+    setVisibleSelectionControl(false);
+    myWorkshop->propertyPanel()->activateNextWidget();
+  }
+
+  /// store the selected type
+  AttributeSelectionListPtr anAttrList = myFeature->data()->selectionList(myAttributeListID);
+  anAttrList->setSelectionType(aSelectionType.toStdString());
+  anAttrList->clear();
+
+  // update object is necessary to flush update signal. It leads to objects references map update
+  // and the operation presentation will not contain deleted items visualized as parameters of
+  // the feature.
+  updateObject(myFeature);
+  myWorkshop->propertyPanel()->activeWidget()->restoreValue();
+  myWorkshop->setSelected(getAttributeSelection());
+  // may be the feature's result is not displayed, but attributes should be
+  // hope that something is redisplayed by object updated
+  myWorkshop->module()->customizeFeature(myFeature, ModuleBase_IModule::CustomizeArguments, true);
+}
\ No newline at end of file
index 23217a0b2f247840f91922fd48100055440a4997..11c40dcc5680b1f838daec290219bdca63762f10 100644 (file)
@@ -30,6 +30,7 @@ class PartSet_Module;
 class ModuleBase_Operation;
 class ModuleBase_IWorkshop;
 class PartSet_PreviewPlanes;
+class ModuleBase_ChoiceCtrl;
 
 /**
 * \ingroup Modules
@@ -140,6 +141,9 @@ private:
 private slots:
   void onResumed(ModuleBase_Operation* theOp);
 
+  /// Slot is called on selection type changed
+  void onSelectionTypeChanged();
+
 private:
   /// Append new Sketch, set the selected plane for the sketch and start Edit operation.
   /// \param theValues a selection list
@@ -179,6 +183,12 @@ private:
 
   /// class to show/hide preview planes
   PartSet_PreviewPlanes* myPreviewPlanes;
+
+  bool myIsUseChoice; ///< A flag to store use_choice parameter state
+
+  /// Control for types
+  ModuleBase_ChoiceCtrl* myTypeCtrl;
+  std::string myDefMode;
 };
 
 #endif
\ No newline at end of file
index 98eb992f780647158b987c3ca4bb39f31134a84e..74a83a9afca4f91398959cad4ea8dd8d6ee06577 100644 (file)
@@ -1,25 +1,27 @@
- <!DOCTYPE RCC><RCC version="1.0">
- <qresource>
-     <file>icons/activate.png</file>
-     <file>icons/angle_32x32.png</file>
-     <file>icons/concealed_on.png</file>
-     <file>icons/concealed_off.png</file>
-     <file>icons/deactivate.png</file>
-     <file>icons/edit.png</file>
-     <file>icons/exec_state_failed.png</file>
-     <file>icons/exec_state_invalid_parameters.png</file>
-     <file>icons/hand_point.png</file>
-     <file>icons/move_to_end.png</file>
-     <file>icons/sketch_shape.png</file>
-     <file>icons/expression.png</file>
-     <file>icons/paper_roll.png</file>
-
-     <file>icons/group_edge.png</file>
-     <file>icons/group_face.png</file>
-     <file>icons/group_solid.png</file>
-     <file>icons/group_vertex.png</file>
-     <file>icons/toWork.png</file>
-     <file>icons/isFailed.png</file>
-     <file>icons/hasWarning.png</file>
- </qresource>
- </RCC>
+<RCC>
+    <qresource prefix="/">
+        <file>icons/activate.png</file>
+        <file>icons/angle_32x32.png</file>
+        <file>icons/concealed_on.png</file>
+        <file>icons/concealed_off.png</file>
+        <file>icons/deactivate.png</file>
+        <file>icons/edit.png</file>
+        <file>icons/exec_state_failed.png</file>
+        <file>icons/exec_state_invalid_parameters.png</file>
+        <file>icons/hand_point.png</file>
+        <file>icons/move_to_end.png</file>
+        <file>icons/sketch_shape.png</file>
+        <file>icons/expression.png</file>
+        <file>icons/paper_roll.png</file>
+        <file>icons/group_edge.png</file>
+        <file>icons/group_face.png</file>
+        <file>icons/group_solid.png</file>
+        <file>icons/group_vertex.png</file>
+        <file>icons/toWork.png</file>
+        <file>icons/isFailed.png</file>
+        <file>icons/hasWarning.png</file>
+        <file>icons/extrusion_edge32.png</file>
+        <file>icons/extrusion_face32.png</file>
+        <file>icons/extrusion_vertex32.png</file>
+    </qresource>
+</RCC>
diff --git a/src/PartSet/icons/extrusion_edge32.png b/src/PartSet/icons/extrusion_edge32.png
new file mode 100644 (file)
index 0000000..6a9607f
Binary files /dev/null and b/src/PartSet/icons/extrusion_edge32.png differ
diff --git a/src/PartSet/icons/extrusion_face32.png b/src/PartSet/icons/extrusion_face32.png
new file mode 100644 (file)
index 0000000..bd4b925
Binary files /dev/null and b/src/PartSet/icons/extrusion_face32.png differ
diff --git a/src/PartSet/icons/extrusion_vertex32.png b/src/PartSet/icons/extrusion_vertex32.png
new file mode 100644 (file)
index 0000000..6988ae3
Binary files /dev/null and b/src/PartSet/icons/extrusion_vertex32.png differ
index f9261ba34ec1e01e45398e382ffcf8e56a22fd1d..428ce34a1876c58a89623744513be95ee4f88773 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 2e0e6ad1c732f51c3e46b52791066b20a6779da2..55a2a74fa97f3af9f86f57c972eb1e35267dcfa9 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 1e26e3a04430fe71d58187fd6f5e55df31a56fab..ab6c68954562eac8a92d7483c85ad459c6291076 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 02347db7965eb7e3842a3a2046b28f664126cead..912ec5aa769a04bedcbde6d4a267a5e40546c348 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 deb79bf776121265d6e996b9ad4f65da1b49b31d..facd75ba0b8559139feeacf13b69b57a468451e5 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 bffffed32e709d46c3bb67debc64856c67aecb52..d1ba6fd54dfe461d10e5f4dcbec970a24b74a40b 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 c3fdd94b8d57da2c560119ab05888053862ce70b..24344f5a03c1d439a5dac23124d384019e610d36 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 90d662044693da413618788f8d56a84eefdee81f..6bfe22cbf9665dec4715ce7335c10fcd431c7a5e 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 956e97bbe56acc5408c7f170a2f1465ee1329e3f..d5e43e5746bd074c28a902f291ea7a8584ee58f1 100644 (file)
@@ -138,7 +138,8 @@ private:
 SHAPERGUI::SHAPERGUI()
     : LightApp_Module("SHAPER"),
       mySelector(0), myIsOpened(0), myPopupMgr(0), myIsInspectionVisible(false),
-  myInspectionPanel(0), myIsFacesPanelVisible(false), myIsToolbarsModified(false)
+  myInspectionPanel(0), myIsFacesPanelVisible(false), myIsToolbarsModified(false),
+  myAxisArrowRate(-1)
 {
   myWorkshop = new XGUI_Workshop(this);
   connect(myWorkshop, SIGNAL(commandStatusUpdated()),
@@ -348,11 +349,6 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy)
     XGUI_Displayer* aDisp = myWorkshop->displayer();
     QObjectPtrList aObjList = aDisp->displayedObjects();
 
-    //if (myHighlightPointAspect.IsNull()) {
-    //  Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron();
-    //  myHighlightPointAspect =
-    //    new Graphic3d_AspectMarker3d(aTrihedron->getHighlightPointAspect()->Aspect().operator*());
-    //}
     if (myOldSelectionColor.size() == 0)
       myOldSelectionColor = aDisp->selectionColor();
 
@@ -448,11 +444,14 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy)
   }
   // Delete selector because it has to be redefined on next activation
   if (mySelector) {
-    //if (!myHighlightPointAspect.IsNull()) {
-    //  Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron();
-    //  aTrihedron->getHighlightPointAspect()->SetAspect(myHighlightPointAspect);
-    //  myHighlightPointAspect.Nullify();
-    //}
+    // Restore size of arrows of trihedron
+    if (myAxisArrowRate > 0) {
+      Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron();
+      Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect();
+      aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, myAxisArrowRate);
+      Handle(AIS_InteractiveContext) aContext = mySelector->viewer()->getAISContext();
+      aContext->Redisplay(aTrihedron, false);
+    }
     myWorkshop->displayer()->setSelectionColor(myOldSelectionColor);
     myProxyViewer->setSelector(0);
 
@@ -599,11 +598,11 @@ SHAPERGUI_OCCSelector* SHAPERGUI::createSelector(SUIT_ViewManager* theMgr)
   if (theMgr->getType() == OCCViewer_Viewer::Type()) {
     OCCViewer_Viewer* aViewer = static_cast<OCCViewer_Viewer*>(theMgr->getViewModel());
 
-    //if (myHighlightPointAspect.IsNull()) {
-    //  Handle(AIS_Trihedron) aTrihedron = aViewer->getTrihedron();
-    //  myHighlightPointAspect =
-    //    new Graphic3d_AspectMarker3d(aTrihedron->getHighlightPointAspect()->Aspect().operator*());
-    //}
+    // Remember current length of arrow of axis
+    Handle(AIS_Trihedron) aTrihedron = aViewer->getTrihedron();
+    Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect();
+    myAxisArrowRate = aDatumAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent);
+
     SHAPERGUI_OCCSelector* aSelector = new SHAPERGUI_OCCSelector(aViewer,
                                                                  getApp()->selectionMgr());
 #ifdef SALOME_PATCH_FOR_CTRL_WHEEL
@@ -623,6 +622,10 @@ SHAPERGUI_OCCSelector* SHAPERGUI::createSelector(SUIT_ViewManager* theMgr)
 
     std::vector<int> aColor = Config_PropManager::color("Visualization", "selection_color");
     myWorkshop->displayer()->setSelectionColor(aColor);
+
+    // Cause scaling of arrows of axis and dimensions
+    myWorkshop->module()->onViewTransformed();
+
     return aSelector;
   }
   return 0;
index 864cc4c9010580332924bf88c39233b8faabd867..da44562d7782d766eebc9e9b5c48f9152e3979a5 100644 (file)
@@ -287,6 +287,8 @@ private slots:
 
   std::vector<int> myOldSelectionColor;
   Handle(Graphic3d_AspectMarker3d) myHighlightPointAspect;
+
+  double myAxisArrowRate;
 };
 
 #endif
index 02065273b696b7f4d66ab6ede463789964c7b031..7c3ed7326d3b92384908ae3f806029daa97d68b9 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <QMouseEvent>
 #include <QContextMenuEvent>
+#include <QTimer>
 
 #if OCC_VERSION_HEX < 0x070400
   #define SALOME_PATCH_FOR_CTRL_WHEEL
@@ -279,11 +280,19 @@ void SHAPERGUI_SalomeViewer::onViewCreated(SUIT_ViewWindow* theView)
   myWindowScale.insert(aView->getViewPort()->getView(),
                        aView->getViewPort()->getView()->Camera()->Scale());
 
-  emit viewCreated(myView);
+  QTimer::singleShot(10, this, SLOT(onAfterViewCreated()));
 
+  emit viewCreated(myView);
+}
 
+//**********************************************
+void SHAPERGUI_SalomeViewer::onAfterViewCreated()
+{
+  // Update trihedron and dimension arrows
+  emit onViewTransformed(OCCViewer_ViewWindow::ZOOMVIEW);
 }
 
+
 //**********************************************
 void SHAPERGUI_SalomeViewer::onActivated(SUIT_ViewManager* theMgr)
 {
index 776d2c05f1e2f84362db53cc363c63fa1dbce3d1..654aff4f3f8233edc817f059b40644f843363baa 100644 (file)
@@ -235,6 +235,9 @@ Q_OBJECT
   /// It is necessary to activate the viewer trihedron in the current selection mode
   void onViewPortMapped();
 
+  /// Signal called in order to apdate viewer transformed objects
+  void onAfterViewCreated();
+
  private:
   SHAPERGUI_OCCSelector* mySelector;
   SHAPERGUI_SalomeView* myView;
index d3ab25d0a1e0fe613d001e67c80663fe9c029357..f073926ac5dde7191d360dcfcf81afb75b818f5a 100644 (file)
@@ -49,11 +49,13 @@ SET(PROJECT_SOURCES
 )
 
 SET(PROJECT_LIBRARIES
+    Locale
     ${OpenCASCADE_ApplicationFramework_LIBRARIES}
     GeomAPI
     GeomAlgoAPI
 )
 SET(PROJECT_INCLUDES
+  ../Locale
   ${OpenCASCADE_INCLUDE_DIR}
   ../GeomAPI
   ../GeomAlgoAPI
index ef53c7dcb4de8355c836a768636b30eee869c3d3..2f484f8688d6aaa9e1382ed94f2dc5a91eab89ab 100644 (file)
@@ -410,11 +410,11 @@ 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;
-  if (theName[0] == '[') { // intersection or container
+  if (theName[0] == L'[') { // intersection or container
     switch(theShapeType) {
     case TopAbs_COMPOUND:
     case TopAbs_COMPSOLID:
@@ -429,12 +429,12 @@ Selector_Algo* Selector_Algo::restoreByName(TDF_Label theLab, TDF_Label theBaseD
       break;
     default:;
     }
-  } else if (theName[0] == '(') { // filter by neighbors
+  } else if (theName[0] == L'(') { // filter by neighbors
     aResult = new Selector_FilterByNeighbors;
   } else if (theName.find(pureWeakNameID()) == 0 ||
              theName.find(oldPureWeakNameID()) == 0) { // weak naming identifier
     aResult = new Selector_WeakName;
-  } else if (theName.find('&') != std::string::npos) { // modification
+  } else if (theName.find(L'&') != std::wstring::npos) { // modification
     aResult = new Selector_Modify;
   } else { // primitive
     aResult = new Selector_Primitive;
index 6f171afb140df204b094145120de32c480b91534..b9fa6b0cd241544994323f3baa25b6d45effa1ec 100644 (file)
@@ -84,14 +84,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
@@ -99,7 +99,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);
 
@@ -151,27 +151,28 @@ protected:
     return kSHAPE_TYPE;
   }
   /// old string identifier of the weak name in modification or intersection types of algorithm
-  static const std::string& oldWeakNameID()
+  static const std::wstring& oldWeakNameID()
   {
-    static const std::string kWEAK_NAME_IDENTIFIER = "weak_name_";
+    static const std::wstring kWEAK_NAME_IDENTIFIER = L"weak_name_";
     return kWEAK_NAME_IDENTIFIER;
   }
   /// old string identifier of the pure weak name
-  static const std::string& oldPureWeakNameID()
+  static const std::wstring& oldPureWeakNameID()
   {
-    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;
   }
   /// 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 = std::string("new_") + oldWeakNameID();
+    static const std::wstring kWEAK_NAME_IDENTIFIER = std::wstring(L"new_") + oldWeakNameID();
     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 = std::string("_new") + oldPureWeakNameID();
+    static const std::wstring kPURE_WEAK_NAME_IDENTIFIER =
+        std::wstring(L"_new") + oldPureWeakNameID();
     return kPURE_WEAK_NAME_IDENTIFIER;
   }
   /// Stores the type of an algorithm in the data tree (in myLab)
index 8b5c537ed33924c9416dddb19f8a750211bb5b0e..df69d787530bddc65e6b38d243cda0004ac0224f 100644 (file)
@@ -79,26 +79,26 @@ 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;
   TDF_Label aContext;
-  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) {
+  for(size_t aStart = 0; aStart != std::wstring::npos; aStart = theName.find('[', aStart + 1)) {
+    size_t anEndPos = theName.find(L']', aStart + 1);
+    if (anEndPos != std::wstring::npos) {
       // there could be sub-intersections, so, [[...]] case; searching for other open-bracket
-      size_t aNextStart = theName.find('[', aStart + 1);
-      while(aNextStart != std::string::npos && aNextStart < anEndPos) {
-        anEndPos = theName.find(']', anEndPos + 1);
-        if (anEndPos == std::string::npos) {
+      size_t aNextStart = theName.find(L'[', aStart + 1);
+      while(aNextStart != std::wstring::npos && aNextStart < anEndPos) {
+        anEndPos = theName.find(L']', anEndPos + 1);
+        if (anEndPos == std::wstring::npos) {
           return TDF_Label(); // invalid parentheses
         }
-        aNextStart = theName.find('[', aNextStart + 1);
+        aNextStart = theName.find(L'[', aNextStart + 1);
       }
-      if (anEndPos == std::string::npos)
+      if (anEndPos == std::wstring::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;
@@ -178,9 +178,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 0974ad63cd00d546b31825e1c8045e2c254c862f..d29446150f308296960b772353087f63e40085b0 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 0035d48f086b75f46dec9a85c9bd0445e83dc7e3..49992956baf17b69272e20cdb32a5b6e949e68c5 100644 (file)
@@ -295,17 +295,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
-  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 aLastLevel; // last level string (after '(' )  to check the context name in the end
+  for (size_t aStart = 0; aStart != std::wstring::npos;
+       aStart = theName.find(L'(', aStart + 1)) {
+    size_t anEndPos = theName.find(L')', aStart + 1);
+    if (anEndPos != std::wstring::npos) {
+      std::wstring aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
       TDF_Label aSubContext;
       Selector_Algo* aSubSel =
         Selector_Algo::restoreByName(newSubLabel(), baseDocument(), aSubStr, myShapeType,
@@ -328,17 +328,17 @@ TDF_Label Selector_FilterByNeighbors::restoreByName(std::string theName,
       //  aContext = theNameGenerator->newestContext(aContext);
 
       // searching for the level index
-      std::string aLevel;
-      for (anEndPos++; anEndPos != std::string::npos &&
-        theName[anEndPos] != '(' && theName[anEndPos] != 0;
+      std::wstring aLevel;
+      for (anEndPos++; anEndPos != std::wstring::npos &&
+        theName[anEndPos] != L'(' && theName[anEndPos] != 0;
         anEndPos++) {
         aLevel += theName[anEndPos];
       }
       aLastLevel = aLevel;
-      if (aLevel.empty() || aLevel[0] == '_')
+      if (aLevel.empty() || aLevel[0] == L'_')
         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
@@ -348,9 +348,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("_");
-    if (aLinePos != std::string::npos) {
-      std::string aContextName = aLastLevel.substr(aLinePos + 1);
+    size_t aLinePos = aLastLevel.find(L"_");
+    if (aLinePos != std::wstring::npos) {
+      std::wstring aContextName = aLastLevel.substr(aLinePos + 1);
       if (!aContextName.empty()) {
         TDF_Label aThisContext, aValue;
         if (theNameGenerator->restoreContext(aContextName, aThisContext, aValue)) {
@@ -388,23 +388,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();
     }
@@ -414,7 +414,7 @@ std::string Selector_FilterByNeighbors::name(Selector_NameGenerator* theNameGene
       aThisContextNameNeeded = false;
   }
   if (aThisContextNameNeeded) {
-    aResult = aResult + "_" + aContextName;
+    aResult = aResult + L"_" + aContextName;
   }
   return aResult;
 }
index 973dc7b0e1b2a243c9b2eabe3202df1bbd56b195..ce036b2f77fc8610f527706be51bf96ab0b3bca0 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 49b0764d7b593cc758185f1d7c69c72054b986ec..1aee58ea1e35dda1d201a865b62c59df51efab55 100644 (file)
@@ -22,6 +22,8 @@
 #include <Selector_NameGenerator.h>
 #include <Selector_NExplode.h>
 
+#include <Locale_Convert.h>
+
 #include <TNaming_NamedShape.hxx>
 #include <TDataStd_Name.hxx>
 #include <TDataStd_Integer.hxx>
@@ -181,29 +183,29 @@ 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;
   TDF_Label aContext;
-  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);
+  for(size_t aStart = 0; aStart != std::wstring::npos; aStart = theName.find(L'[', aStart + 1)) {
+    size_t anEndPos = theName.find(L']', aStart + 1);
+    if (anEndPos != std::wstring::npos) {
+      std::wstring aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
       size_t aFoundOldWeak = aSubStr.find(oldWeakNameID());
-      size_t aFoundNewWeak = aFoundOldWeak != std::string::npos ?
+      size_t aFoundNewWeak = aFoundOldWeak != std::wstring::npos ?
                              aSubStr.find(weakNameID()) :
                              aFoundOldWeak;
       if (aFoundOldWeak == 0 || aFoundNewWeak == 0) { // weak name identifier
-        std::string aWeakIndex = aSubStr.substr(aFoundOldWeak + oldWeakNameID().size());
-        myWeakIndex = atoi(aWeakIndex.c_str());
+        std::wstring aWeakIndex = aSubStr.substr(aFoundOldWeak + oldWeakNameID().size());
+        myWeakIndex = atoi(Locale::Convert::toString(aWeakIndex).c_str());
         myRecomputeWeakIndex = aFoundOldWeak == 0;
         continue;
       }
       TopAbs_ShapeEnum aSubShapeType = TopAbs_FACE;
-      if (anEndPos != std::string::npos && anEndPos + 1 < theName.size()) {
-        char aShapeChar = theName[anEndPos + 1];
-        if (theName[anEndPos + 1] != '[') {
+      if (anEndPos != std::wstring::npos && anEndPos + 1 < theName.size()) {
+        wchar_t aShapeChar = theName[anEndPos + 1];
+        if (theName[anEndPos + 1] != L'[') {
           switch(aShapeChar) {
           case 'e': aSubShapeType = TopAbs_EDGE; break;
           case 'v': aSubShapeType = TopAbs_VERTEX; break;
@@ -283,9 +285,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++) {
@@ -297,15 +299,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 1df1326c68e0c8fadfdd2a2ae3833e5e9a66ee84..00d02dabbc5846bb8d8ccc381ee54305a8e656ac 100644 (file)
@@ -46,14 +46,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 987915eebe6543acbe1a3acf8879001c5ebaad98..98d1337191e88ce4dde95ff2dac5c91493f067fc 100644 (file)
@@ -22,6 +22,8 @@
 #include <Selector_NameGenerator.h>
 #include <Selector_NExplode.h>
 
+#include <Locale_Convert.h>
+
 #include <TNaming_NamedShape.hxx>
 #include <TNaming_Iterator.hxx>
 #include <TNaming_SameShapeIterator.hxx>
@@ -241,26 +243,26 @@ 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)
 {
   typedef NCollection_DataMap<TopoDS_Shape, bool, TopTools_ShapeMapHasher> MapOfCompsolids;
   MapOfCompsolids aWrongSubsCompsolids;
 
   TDF_Label aContext;
-  for(size_t anEnd, aStart = 0; aStart != std::string::npos; aStart = anEnd) {
+  for(size_t anEnd, aStart = 0; aStart != std::wstring::npos; aStart = anEnd) {
     if (aStart != 0)
       aStart++;
-    anEnd = theName.find('&', aStart);
-    std::string aSubStr =
-      theName.substr(aStart, anEnd == std::string::npos ? anEnd : anEnd - aStart);
+    anEnd = theName.find(L'&', aStart);
+    std::wstring aSubStr =
+      theName.substr(aStart, anEnd == std::wstring::npos ? anEnd : anEnd - aStart);
     size_t aFoundOldWeak = aSubStr.find(oldWeakNameID());
-    size_t aFoundNewWeak = aFoundOldWeak != std::string::npos ?
+    size_t aFoundNewWeak = aFoundOldWeak != std::wstring::npos ?
                            aSubStr.find(weakNameID()) :
                            aFoundOldWeak;
     if (aFoundOldWeak == 0 || aFoundNewWeak == 0) { // weak name identifier
-      std::string aWeakIndex = aSubStr.substr(aFoundOldWeak + oldWeakNameID().size());
-      myWeakIndex = atoi(aWeakIndex.c_str());
+      std::wstring aWeakIndex = aSubStr.substr(aFoundOldWeak + oldWeakNameID().size());
+      myWeakIndex = atoi(Locale::Convert::toString(aWeakIndex).c_str());
       myRecomputeWeakIndex = aFoundOldWeak == 0;
       continue;
     }
@@ -359,25 +361,25 @@ 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 += Locale::Convert::toWString(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 += Locale::Convert::toWString(aName->Get().ToExtString());
   }
   if (myWeakIndex != -1) {
-    std::ostringstream aWeakStr;
-    aWeakStr<<"&"<<weakNameID()<<myWeakIndex;
+    std::wostringstream aWeakStr;
+    aWeakStr<<L"&"<<weakNameID()<<myWeakIndex;
     aResult += aWeakStr.str();
   }
   return aResult;
index 25e0f5ba404e34bb2d59262a4e59820c66c4a952..4a01292f4254a74aba9d6dcb3f92b366add2a27d 100644 (file)
@@ -52,14 +52,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 68de888a59f7206cabc30aea729a4229a170382a..7c8c5542a39e2dd4747cbea65b82dc7bbfd7fdd0 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 d93241f73a1e8fa2041ba26e6a89f3b4749a489d..02dec6f15df41d8d29ad11857ed34462fb80e6c0 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <Selector_NameGenerator.h>
 
+#include <Locale_Convert.h>
+
 #include <TNaming_NamedShape.hxx>
 #include <TDataStd_Name.hxx>
 
@@ -47,7 +49,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 +74,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 += Locale::Convert::toWString(aName->Get().ToExtString());
+  }
   return aResult;
 }
index 78dfc4d8dc07dfe831e30327912030e48fe69729..c91071149a86c0b5adbe779a0d6d169504e2008d 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 a7abc58af56e34f0ad9c46576053a7d708489380..eea18f64473f5573a48c50b9ed539c258749f3e5 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 5e62c948b59972c08c5a55807900107f49381de1..5ad20f26f0b96fc9a34229e0bae9f78dbc103f1c 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 813fa0b4e48ba80c9ea4acbfdb32d80b683361d6..559071b9c461e8f088a681c1a5de86c3bdcbfdba 100644 (file)
@@ -22,6 +22,8 @@
 #include <Selector_NameGenerator.h>
 #include <Selector_NExplode.h>
 
+#include <Locale_Convert.h>
+
 #include <TNaming_Tool.hxx>
 #include <TNaming_SameShapeIterator.hxx>
 #include <TNaming_Iterator.hxx>
@@ -85,18 +87,18 @@ 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)
 {
   size_t aFoundWeak = theName.find(oldPureWeakNameID());
-  std::string aWeakIndex = theName.substr(aFoundWeak + oldPureWeakNameID().size());
-  std::size_t aContextPosition = aWeakIndex.find("_");
-  myWeakIndex = atoi(aWeakIndex.c_str());
+  std::wstring aWeakIndex = theName.substr(aFoundWeak + oldPureWeakNameID().size());
+  std::size_t aContextPosition = aWeakIndex.find(L"_");
+  myWeakIndex = atoi(Locale::Convert::toString(aWeakIndex).c_str());
   myRecomputeWeakIndex = aFoundWeak == 0;
   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();
@@ -129,13 +131,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 317dcc4af655db383a8b5a86effd61d7d7946d79..42319c94260142eabfbd8d1786f433050f320af4 100644 (file)
@@ -46,14 +46,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 7934de9f288fb160c5ffe2f3f7eaf83dbbe1b2fa..a1ea1da27678f648ac4eb2e22fa2c677144fa806 100644 (file)
@@ -72,6 +72,7 @@ SET(PROJECT_SOURCES
 
 SET(PROJECT_LIBRARIES
   GeomAlgoAPI
+  Locale
   ModelAPI
   ModelHighAPI
   SketcherPrs
@@ -88,8 +89,8 @@ INCLUDE_DIRECTORIES(
 
 # Plugin headers dependency
 INCLUDE_DIRECTORIES(
-  # TODO(spo): modify ConstructionPlugin headers to remove dependency on GeomAPI headers
   ${PROJECT_SOURCE_DIR}/src/Config
+  ${PROJECT_SOURCE_DIR}/src/Locale
   ${PROJECT_SOURCE_DIR}/src/GeomAPI
   ${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI
   ${PROJECT_SOURCE_DIR}/src/SketchPlugin
index 66b07c3cc3603105f2a6d4ef40fdaa1670f17914..f98f8929bc54a635bb75f87972656c03bedba29d 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 7fa75aa82ed825e56776d161ffafdc3e0936e1e2..8afc14081c2ea2c32ed023c79a2a2b8805c3218f 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 46d6d8dfe7c60dc9b30c0fb15fd0f203f52169d9..7315c9ec716de74e6563005d8c2d1fe6b2dd720f 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..361f28be6564263595bd0a00e38fd8c78e86760a 100644 (file)
 
 #include <GeomAlgoAPI_EdgeBuilder.h>
 
+#include <Locale_Convert.h>
+
 #include <ModelHighAPI_Double.h>
 #include <ModelHighAPI_Dumper.h>
 #include <ModelHighAPI_Integer.h>
 #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 +156,9 @@ 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() << "_" << Locale::Convert::toWString(thePoles->id())
+                              << "_" << thePoleIndex;
   aPointFeature->data()->setName(aName.str());
   aPointFeature->lastResult()->data()->setName(aName.str());
 
@@ -185,7 +190,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 80207335343853f792453b717779521953276f3e..846fc0a4de950978f34d432b42b0156bfbd90166 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 e3d750713bb17daa1130514467c46569d62f9899..7fba255e0548f07c9e68e71ed05894c4894ecb93 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 5cd6b6f474d5312df5c1ceece2e01a7848b3040d..bb0efcd1090e82f6551bc48ee1da1f3bcde94f4f 100644 (file)
 
 #include <GeomAPI_Pnt2d.h>
 
+#include <Locale_Convert.h>
+
 #include <ModelHighAPI_Dumper.h>
 #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 +75,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 +115,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 +195,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 +211,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"_" + Locale::Convert::toWString(theCoincident);
   aPointFeature->data()->setName(aName);
   aPointFeature->lastResult()->data()->setName(aName);
 
@@ -227,7 +231,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 +252,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 +272,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 +298,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 ea6cee2a2beb6478eb9b139c28c9997bf0871db4..8f37ad6b033c695427ffabaee0163ae862ad0f26 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 052923469708dc01117f6158bc2963be016d5108..26d29942217e6790b1880be3d45c0551820274da 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 86689a555a0007be0cd68f206a3d8d84ffd642b8..4f2418859f4a507f8b515a5fdd0e8db5dd9d2bf2 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 2b1e25de6cd577a63e753bd4a510c748849112f0..03d983cff125b7ca37786836fc00afea4000866e 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 c25f5a0f8758e9cdd93c257173a0ffb89607bfc1..7d9df79921e78c5aa2bc637d1923e464b0ed27ac 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 03e0a7b978430392c0af553d1e4dbab8015c3871..bd71d60c2df5fdabab7f7caa4fcb4abf0df9ee8a 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 3cd64b9f47e9776b4a333cd26cc051c63f65b3f5..5d150735fd282020fbbfb1c08ac84ecfe74d4f23 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 eb48cdfcbda5904e8b617fc07f7f5d5436aa44c4..f92660622ca3e902d5684c262609483184443b4f 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 f26a80ac94d0e2120388fce4d39dfcdcbe07b5b0..bcbad56e84782113115ca7268700a80f49df9211 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 e76cfb3a21199146d85031975feb9fd6e33a557b..5f60ae2a759e204024cc38743020f35587973c09 100644 (file)
@@ -223,7 +223,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(
@@ -349,7 +349,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());
@@ -368,7 +368,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 =
@@ -401,7 +401,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());
@@ -493,7 +493,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());
@@ -587,7 +587,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());
@@ -662,7 +662,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());
@@ -713,7 +713,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());
@@ -1541,7 +1541,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 2bdf2a570d45c22facd60346bc1896a0583d866f..11a2639087700596e0518015e155b05accfd616e 100644 (file)
@@ -140,7 +140,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
@@ -150,7 +150,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
@@ -167,7 +167,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
@@ -216,7 +216,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
@@ -270,7 +270,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
@@ -303,7 +303,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
@@ -326,7 +326,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
@@ -600,7 +600,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 13e6ae0fad1acd1c2360da5daa56a72808f1fa84..d21adaf7175e5fe63457f566039b0f22bfa48b75 100644 (file)
@@ -137,11 +137,12 @@ SET(PROJECT_LIBRARIES
     Config
     GeomAPI
     GeomAlgoAPI
+    GeomDataAPI
+    Locale
     ModelAPI
     ModelGeomAlgo
     ModuleBase
     SketcherPrs
-    GeomDataAPI
 )
 
 SET(XML_RESOURCES
@@ -166,6 +167,7 @@ TARGET_LINK_LIBRARIES(SketchPlugin ${PROJECT_LIBRARIES})
 INCLUDE_DIRECTORIES(
   ../Config
   ../Events
+  ../Locale
   ../ModelAPI
   ../ModelGeomAlgo
   ../ModuleBase
index 3d3ab4c53e7c92616bb209c0ab0b0085f1fe84c9..497288dfb5991d5035bab84d5c0afe6f5ee17742 100644 (file)
 #include <SketchPlugin_Tools.h>
 #include <SketchPlugin_Sketch.h>
 
+#include <Locale_Convert.h>
+
 #include <ModelAPI_AttributeDoubleArray.h>
 #include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_AttributeRefAttrList.h>
 #include <ModelAPI_Events.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Tools.h>
 
 #include <GeomDataAPI_Point2DArray.h>
 
@@ -266,10 +269,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 << "_" << Locale::Convert::toWString(theBSplinePoles->id()) << "_" << thePoleIndex1;
   else
     aName << "_segment_" << thePoleIndex1 << "_" << thePoleIndex2;
 
index 3eb121b863a0ee67344eb58d4d425962e5d2edb8..984293083baf47154dfbad362417e2f1509ef07d 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 4439c1067e27b8344d4086958959d81ec1beaa1a..fc462cdab92a881540ac7651d237cba02014aba3 100644 (file)
@@ -226,8 +226,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());
@@ -280,14 +280,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;
@@ -324,8 +324,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) {
@@ -338,7 +338,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 e4bb31406be75152b76716682e832f28cdf9224d..a4707a8da54fa3520d91a9f65bf85f2b0c460d32 100644 (file)
@@ -28,6 +28,8 @@
 #include <GeomDataAPI_Point2D.h>
 #include <GeomAlgoAPI_ShapeTools.h>
 
+#include <Locale_Convert.h>
+
 #include <ModelAPI_AttributeBoolean.h>
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeRefAttr.h>
@@ -1389,7 +1391,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(Locale::Convert::toString(theFeature->data()->name()));
 
   if (isUseAttributesInfo) {
     std::string aPointsInfo = ModelGeomAlgo_Point2D::getPontAttributesInfo(theFeature,
index ed4084afe60dfdeab7e3325746e7afbee31275da..836071aae1bde7627e2242d87364cc3d990ba690 100644 (file)
 
 #include <SketcherPrs_Tools.h>
 
+#include <Locale_Convert.h>
+
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeInteger.h>
+#include <ModelAPI_Tools.h>
 
 #include <ModelGeomAlgo_Point2D.h>
 #include <ModelGeomAlgo_Shape.h>
@@ -273,7 +276,8 @@ private:
       std::set<FeaturePtr> aCoincToRes =
           SketchPlugin_Tools::findCoincidentConstraints(theFeature->lastResult());
       aCoincidences.insert(aCoincToRes.begin(), aCoincToRes.end());
-    }\r    std::set<FeaturePtr>::const_iterator aCIt = aCoincidences.begin();
+    }
+    std::set<FeaturePtr>::const_iterator aCIt = aCoincidences.begin();
     for (; aCIt != aCoincidences.end(); ++aCIt)
     {
       if (theCoincidences.find(*aCIt) != theCoincidences.end())
@@ -544,7 +548,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"_" +
+    Locale::Convert::toWString(theEllipsePoint);
   aPointFeature->data()->setName(aName);
   aPointFeature->lastResult()->data()->setName(aName);
 
@@ -577,8 +582,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);
 
@@ -645,13 +650,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());
+  if (aPos != std::wstring::npos) {
+    std::wstring aNewName = aName.substr(0, aPos) + theDest
+                          + aName.substr(aPos + theSource.size());
     theObject->data()->setName(aNewName);
   }
 }
index eb86f8b33702e49bfae9ea79f52d9d2ca8584ec6..5418f7c2f46a6904e2179ba3767209b9f8bad8be 100644 (file)
@@ -148,7 +148,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 e226f229e8a22af9f84b98dc27a5c414fa6adf7f..0ccd6ae4ff5bd36148b038447de7beaca06eba6f 100644 (file)
@@ -46,6 +46,8 @@
 
 #include <Events_InfoMessage.h>
 
+#include <Locale_Convert.h>
+
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_AttributeDouble.h>
@@ -328,7 +330,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;
@@ -336,7 +338,8 @@ 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() ? Locale::Convert::toWString(anAttribute->id()) : L"";
       theError = "The attribute %1 has been already fixed.";
       theError.arg(aName);
       return false;
@@ -433,7 +436,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) {
@@ -560,9 +563,9 @@ bool SketchPlugin_CopyValidator::isValid(const AttributePtr& theAttribute,
       bool isFound = aSelObject == *anObjIter;
       if (!isFound) {
         // check in the results of the feature
-        FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(*anObjIter);
-        if (aFeature) {
-          const std::list<ResultPtr>& aResults = aFeature->results();
+        FeaturePtr aCurFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(*anObjIter);
+        if (aCurFeature) {
+          const std::list<ResultPtr>& aResults = aCurFeature->results();
           for (std::list<ResultPtr>::const_iterator aResIt = aResults.begin();
             aResIt != aResults.end() && !isFound; ++aResIt) {
             isFound = aSelObject == *aResIt;
@@ -570,7 +573,8 @@ bool SketchPlugin_CopyValidator::isValid(const AttributePtr& theAttribute,
         }
       }
       if (isFound) {
-        std::string aName = aSelObject.get() ? aSelObject->data()->name() : "";
+        std::string aName =
+            aSelObject.get() ? Locale::Convert::toString(aSelObject->data()->name()) : "";
         theError = "The object %1 is a result of copy";
         theError.arg(aName);
         return false;
index 89528ce7c875d76ea297cb4303e57dab926011da..10819c8f3e7c1a145c8e3046aec4fa06e50b57f2 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 09f572a6243f1e3e1ece680d6a0bd8c9b9b3ae2f..1938f9b79213a7e2165df356ae909789cfb0ae92 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 b7bd0c733d7a2835741ab61fdc3108e235944d33..7330215307a5f30cddac585944ab194521432269 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) {
index 634a4ec8da423deeeaa4e13f695650a090dac491..4ca26b798ef4d8bfc41a36657ed1bbb6f108617d 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 536f224853be5e4f65983401c819cab94a9952dc..2d44953bb3e779617b82ffc0645608c212f40a74 100644 (file)
@@ -699,7 +699,7 @@ void XGUI_ViewerProxy::setColorScaleTitle(const QString& theText)
   myWorkshop->salomeConnector()->viewer()->setColorScaleTitle(theText);
 #else
   Handle(AIS_ColorScale) aColorScale = myWorkshop->mainWindow()->viewer()->colorScale();
-  aColorScale->SetTitle(theText.toStdString().c_str());
+  aColorScale->SetTitle(theText.toStdWString().c_str());
 #endif
 }
 
index 19d750c8614fcc0fe78560323a0fc0d37829e4d9..5ca15dc330cc3de54f38762468c5379594d7e8c6 100644 (file)
@@ -1899,7 +1899,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;
@@ -2105,7 +2105,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(", ");
@@ -2768,7 +2768,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);
         }
       }