From: Artem Zhidkov Date: Mon, 13 Jul 2020 08:45:27 +0000 (+0300) Subject: Merge remote-tracking branch 'remotes/origin/EDF_2020_Lot2' X-Git-Tag: V9_6_0a1~60 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=380f01e1fce1a012267d604a1190d04bf4659447;p=modules%2Fshaper.git Merge remote-tracking branch 'remotes/origin/EDF_2020_Lot2' # 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 --- 380f01e1fce1a012267d604a1190d04bf4659447 diff --cc doc/gui/General/Introduction.rst index d11c9b6a9,000000000..bc4934d30 mode 100644,000000..100644 --- a/doc/gui/General/Introduction.rst +++ b/doc/gui/General/Introduction.rst @@@ -1,684 -1,0 +1,686 @@@ + +.. _introduction: + +Introduction to SHAPER +====================== + +SHAPER module of SALOME is destined for: + +- import and export of geometrical models in IGES, BREP, STEP and XAO formats; +- parametric construction of geometrical objects using a wide range of functions: + + - creation of complex 2D sections using :ref:`sketchPlugin` with consequent extrusion or revolution (see :ref:`featuresPlugin`); + - construction of model using primitives defined in :ref:`primitivesPlugin`; + - usage of Boolean operations (see :ref:`featuresPlugin`); + +- viewing geometrical objects in the OCC viewer; +- transformation of geometrical objects using various algorithms. + +It is possible to easily set :ref:`parameter_usage` predefined to be used as arguments when objects are created. + +SHAPER module preferences are described in the :ref:`preferences` section of SALOME Help. + +Almost all SHAPER module functionalities are accessible via Python Interface. + +SHAPER module works with one study containing several documents: + +- partset +- one or several parts. + +Only one document can be active. In complicated models partset consists of several parts. Parts in partset may be copied, positioned relatively to each other, or simply translated. + +A new study contains only a partset with 7 default constructions, which cannot be deleted: + +- one point **Origin** coinciding with the origin of the coordinate system; +- three axes **OX**, **OY**, **OZ** coinciding with coordinate axes; +- three planes **YOZ**, **XOZ**, **XOY** coinciding with coordinate planes. + +Only points, axis, planes (see :ref:`constructionPlugin`) and sketches (see :ref:`sketchPlugin`) can be added into Partset to be used in any part later. +:ref:`parameter_usage` can be used both in Partset and any Part. + +A new Part can be created as described in :ref:`partPlugin`. + +Double click or pop-up menu can be used to activate existing document. + +Application desktop +------------------- + +The main window of the application consists of the following components: + +- :ref:`main_menu`; +- :ref:`doc_windows`; +- :ref:`viewer`; +- :ref:`toolbar`; +- status bar. + +.. figure:: /images/main_window.png + :align: center + + Main window of SHAPER module + +.. _main_menu: + +Main menu +--------- + +Main menu provides access to all commands of the application. + +.. figure:: /images/main_menu.png + :align: center + + Main menu + +Main menu includes standard Salome items: + +- File; +- Edit; +- View; +- Tools; +- Window; +- Help; + +and items specific for SHAPER module: + +- Part (see :ref:`partPlugin`); +- Sketch (see :ref:`sketchPlugin`); +- Construction (see :ref:`constructionPlugin`); +- Build (see :ref:`buildPlugin`); +- Primitives (see :ref:`primitivesPlugin`); +- Features (see :ref:`featuresPlugin`); +- Macros. + + .. _toolbar: + +SHAPER toolbar +-------------- + +Application toolbar contains: + +- standard toolbar; +- modules toolbar; +- SHAPER toolbar. + +.. figure:: /images/toolbar.png + :align: center + + Toolbars + +SHAPER toolbar duplicates the main menu and provides access to all commands of the application. + +SHAPER toolbar is separated into sections: + +- Part; +- Movement; +- Measurement; +- Sketch; +- Construction; +- Build; +- Primitives; +- GDML; +- Features; +- Boolean; +- Collections; +- Fillet; +- Macros. + +Visibility of SHAPER toolbar sections is managed using *View -> Toolbar* :ref:`main_menu` item or toolbar pop-up menu. + +.. _doc_windows: + +Dock windows +------------ + +Standard dock windows are: + +- :ref:`object_browser` +- :ref:`inspection_panel` +- :ref:`hidefaces_panel` +- :ref:`python console` +- :ref:`property_panel` + +Dock windows can be placed in three dock areas using drag-and-drop: + +- left, +- right, +- bottom. + +By default Object browser window is placed at the left dock area, Inspection panel at the right dock area and Python console at the bottom dock area of the main window. + +Property Panel is hidden. + +Property Panel is shown on operation start in left dock area of the main window by default. + +If Object browser is shown at the same side then they will be tabbed. + +Each dock window can be closed using **Cross** window button and opened again using a corresponding command from *View - Windows* :ref:`main_menu` or alternatively using pop-up menu. + +.. figure:: /images/popup_menu.png + :align: center + + Pop-up menu for visibility of windows and toolbars + +.. _object_browser: + +Object browser +^^^^^^^^^^^^^^ + +Object browser contains all documents created in the current study. + +Each document includes standard branches where created objects are placed. + +Documents with branches are shown in Tree View. + +.. figure:: /images/object_browser.png + :align: center + + **Object browser**: Partset active + +Partset includes three branches: + +- Parameters; +- Constructions; +- Features + +Part includes the following branches: + +- Parameters; +- Constructions; +- Results; +- Fields; +- Groups; +- Features. + +New part contains only 3 empty branches: + +- Parameters; +- Constructions; +- Results. + +Features are placed one after another in the active document with default names and their results are placed into the corresponding branch. + +Examples of default names assigned automatically for :ref:`box_feature` are: + +* **Box_1**, **Box_2**, ... for Feature; +* **Box_1_1**, **Box_2_1**, ... for Result. + +Note, that a default branch is added into Tree View when the first feature of this type is created. + +Note, that the result used in feature as argument is removed. + +This child result can be restored using **Recover** feature. + +Each feature, result, construction, group, field, parameter can be renamed using *Rename* pop-up menu command (hotkey "F2"). + +.. figure:: /images/popup_menu_object_browser_feature.png + :align: center + + **Feature** pop-up menu + +.. figure:: /images/popup_menu_object_browser_result.png + :align: center + + **Result** pop-up menu + +.. figure:: /images/popup_menu_object_browser_construction.png + :align: center + + **Construction** pop-up menu + +The order of features can be changed using *Move to the end* and *Move to the end and split* pop-up menu commands. They work only for Group features. The selected group or several groups will be moved to the end of features list. The *Move to the end and split* also splits the resulting group in several groups: one group per one selection. + +Folders can be used to arrange long Tree View for features. + +.. figure:: /images/object_browser_folder.png + :align: center + + **Object browser** with folder Dome: Part_1 active + +*Insert a folder before* pop-up menu command creates a new empty folder before the selected feature. The folder can be renamed. + +Features placed after/before the created folder can be moved into the folder using *Move into the previous folder* / *Move into the next folder* pop-up menu command. + +This allows to decrease the length of feature list. + +Features can be removed from the folder using *Move out before the folder* / *Move out after the folder* pop-up menu command. + +*Clean history* pop-up menu command looks for features that do not participate in other features. + +**Clean history** dialog box shows a list of unused features. After confirmation by click **Yes** button unused features are removed. + +.. figure:: /images/clean_history.png + :align: center + + **Clean history** dialog box + +*Select result* and *Select parent feature* pop-up menu commands help to navigate along Tree View. + +A feature and its result can be deleted using *Delete* pop-up menu command. + +Note that all features using the removed feature and their results will be removed simultaneously. + +**Delete feature** dialog box shows the list of features to be removed. After confirmation by click **Yes** button all these features are removed. + +.. figure:: /images/delete_feature.png + :align: center + + **Delete feature** dialog box + +.. _property_panel: + +Property panel +^^^^^^^^^^^^^^ + +.. |ok_btn| image:: /images/button_ok.png +.. |cancel_btn| image:: /images/button_cancel.png +.. |help_btn| image:: /images/button_help.png + +Property panel consists of two parts: + +- controls a container for input of parameters for the current operation; +- buttons panel containing standard buttons: + + | |ok_btn| **Ok/Apply** executes operation with defined parameters, + | |cancel_btn| **Cancel/Close** calls **Abort operation** dialog box to confirm operation abort, + | |help_btn| **Help** calls User's guide opened on page describing the current operation. + + .. figure:: /images/abort_operation.png + :align: center + + **Abort operation** dialog box + +|ok_btn| **OK/Apply** button is disabled if not all input parameters are defined or some errors are found. Error is shown as tooltip and in status bar. + +.. _inspection_panel: + +Inspection panel +^^^^^^^^^^^^^^^^ + +Inspection panel provides the list of types and quantities of all topological entities, composing the selected result, construction or feature. + +.. figure:: /images/inspection_panel.png + :align: center + + **Inspection panel** for default Box + +**Object** displays name of the selected result, construction or feature. + +**Type** characterizes the whole shape. + +The information about Point, Axis or Edge additionally shows coordinates of point / end points. + +.. figure:: /images/inspection_panel_line.png + :align: center + + **Inspection panel** for Axis + +The information about Plane, Face additionally shows coordinates of center point and direction of normal. + +.. figure:: /images/inspection_panel_face.png + :align: center + + **Inspection panel** for Face + +.. _hidefaces_panel: + +Hide Faces panel +^^^^^^^^^^^^^^^^ + +**Hide Faces** panel makes possible to hide temporary faces of any displayed object. **Hide Faces** panel looks like following: + +.. figure:: /images/hide_faces_panel.png + :align: center + + **Hide Faces** panel + +- If this panel is activated it "listens" user selection. +- If a face is selected then its name will be shown in the panel's list and hidden in the viewer. +- If user selects a group of faces (or at least a one face of this group) then whole group will be hidden and also all faces from all objects referenced by this group. +- If user will display the hidden group again (by a show operation) then the group will be removed from Hide Faces list and visibility of all referenced faces will be restored. + +Also it is possible do not to hide faces, but make them transparent. For this purpose **"Transparent"** check-box can be used. Value of the transparency can be changed in **Visualization** tab of **Preferences** dialog box. +Closing of **Hide Faces** panel restores visibility state of all objects. If it is necessary to deactivete the **Hide Faces** panel (preserving the current display state) then user has to press **"Esc"** button. + +.. _python console: + +Python console +^^^^^^^^^^^^^^ + +Python console interpreters Python commands entered manually. + +In particular, it is possible to load the python script: + +*execfile(r"/dn48/newgeom/data/example.py")* + +Pop-up menu gives the possibility to: + +- Copy the selected text to clipboard; +- Paste the text from clipboard to Python console ; +- Clear Python console; +- Dump commands from console into the specified file; +- Start/Stop writing log into the specified file. + +.. figure:: /images/python_console_popup.png + :align: center + + Pop-up menu of Python console + +.. _viewer: + +Viewer +------ + +The application supports one instance of OCC 3D viewer and is able to show only one 3D space. + +This 3D space can be represented in several view windows. New view window can be created using **Clone view** button in viewer toolbar. + +Each view windows shows its own point of view on the 3D scene. + +This point of view can be modified using viewer commands: **Panning**, **Zooming**, **Scaling**, etc. + +.. figure:: /images/2_viewers.png + :align: center + + Two view windows + +The description of OCC 3D Viewer architecture and functionality is provided in GUI module user's guide in chapter **OCC 3D Viewer**. + +.. _parameter_usage: + +Parameters +---------- + +Model parametrization can be done using parameters. + +A parameter can be created in the active partset or part by: + +- :ref:`parameter`; +- :ref:`parameters`; +- :ref:`parameter_expression`. + +Any argument in features can be defined as parameter or expression containing parameters. + +The list of features using parameters is given in **Parameters** dialog box: + + .. figure:: /images/parameters_feature.png + :align: center + + Parameters dialog box + +If a parameter value is changed, then all features where it is used are rebuilt. + +A parameter name should be unique in the active document. + +However, partset and part can have parameters with the same name. If parameter names in Partset and Part are identical, then Part parameter has a higher priority and its value will be used in the features of this part. + +In contrast to features (see :ref:`object_browser`), there is an additional option when parameters are deleted. + +.. figure:: /images/delete_parameter.png + :align: center + + Delete parameter + +After clicking **Replace** button, the selected parameter is removed but its parent parameters and features are not removed. The deleted parameter is replaced by its value. + +.. _parameter_expression: + +Create parameter on fly +^^^^^^^^^^^^^^^^^^^^^^^ + +Parameter can be created during feature creation simply by writing *variable=expression* in any editbox. + +After feature validation a new parameter with the given name **variable** and value equal to the evaluated expression appears in object browser under **Parameters** in the active partset or part. + +.. _preferences: + +SHAPER preferences +------------------ + +Description of General application preferences and **Preferences** dialog box is provided in GUI module user's guide in chapter **Setting Preferences**. + +SHAPER preferences define visualization of objects, visualization during selection, edition. New preferences can be used right after modification or later after activation of SHAPER module. + +To call **Preferences** dialog box: + +#. select in the Main Menu *File - > Preferences* item or +#. use **Ctrl+P** shortcut. + +SHAPER preferences contains the following tabs: + +- :ref:`visualization_preferences`; +- :ref:`plugins_preferences`; +- :ref:`shortcuts_preferences`; +- :ref:`windows_preferences`. +- :ref:`sketch_preferences`. +- :ref:`viewer_preferences`. + +Visualization tab is activated by default when **Preferences** dialog box is opened in the active SHAPER module. + +Other tabs are activated by click on tab header. + +.. _visualization_preferences: + +Visualization tab +^^^^^^^^^^^^^^^^^ + +This tab defines presentation of objects displayed in OCC 3D viewer. + +.. figure:: /images/visualization_preferences.png + :align: center + + **Preferences**: Visualization tab + +**Input fields**: + +- **Selection color** defines a color for selected objects; +- **Result color** selects default shading color for objects from **Results** branch; +- **Group color** selects default color for objects from **Groups** branch; +- **Construction color** selects default color for objects from **Constructions** branch; +- **Part color** selects default color for parts shown in Partset; +- **Field color** selects default color for objects from **Fields** branch; +- **Body deflection coefficient** defines default deflection coefficient for objects from **Results** branch. A smaller coefficient provides better quality of a shape in the viewer; +- **Construction deflection coefficient** defines default deflection coefficient for objects from **Constructions** branch. A smaller coefficient provides better quality of a shape in the viewer; +- **Reference shape wireframe color in operation** selects default color used for wireframe visualization of objects used in active operation; +- **Result shape wireframe color in operation** selects default color used for wireframe visualization of result in active operation. Click **See preview** button to show result; +- **Multi selector item color in operation** selects default color used for visualization of objects selected in property panel to distinguish them among all objects used in active operation; +- **Color of removed feature in operation** selects default color used for visualization of sketch entities to be removed during **Trim/Split** operations; +- **Color of sketch plane** selects default shading color for sketch plane; +- **Hidden faces transparency** defines default transparency value for hidden faces; +- **Dimension arrow size** defines default size of arrows for extension line showing dimensional constraint; +- **Dimension font** defines font used for value of dimensional constraint; +- **Dimension value size** defines default size of value for dimensional constraint; +- **Sketch dimension color** defines default color of dimensional constraint; +- **Construction plane color** selects default color for Construction planes; +- **Sketch entity color** selects default color for sketch objects; +- **Sketch external entity color** selects default color for external objects selected as reference during sketch creation/edition; +- **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 + +.. figure:: /images/select_color.png + :align: center + + **Preferences**: **Select color** dialog box + +Preferences for sketch are applicable during sketch creation/edition operation. + +.. _plugins_preferences: + +Plugins tab +^^^^^^^^^^^ +Plugins tab defines folders where plugins and resources are located. + +.. figure:: /images/plugins_preferences.png + :align: center + + **Preferences**: Plugins tab + +**Input fields**: + +- **Default path** selects default folder where plugins are located. Click on **Open** button opens standard **Find directory** dialog box to navigate to desired folder; + +- **Import initial directory** selects default folder where resources are located. Click on **Open** button opens standard **Find directory** dialog box to navigate to desired folder. + +.. figure:: /images/open_button.png + :align: center + + **Open** button + +.. figure:: /images/find_directory.png + :align: center + + **Find directory** dialog box + + +.. _shortcuts_preferences: + +Shortcuts tab +^^^^^^^^^^^^^ + +Shortcuts tab defines shortcut keys for different operations. + +.. figure:: /images/shortcuts_preferences.png + :align: center + + **Preferences**: Shortcuts tab + +- **Add parameter in parameters manager dialog** defines shortcut keys for adding parameter in parameters manager dialog box. + +.. _windows_preferences: + +Windows tab +^^^^^^^^^^^ + +Windows tab contains definitions for the module windows management. + +.. figure:: /images/windows_preferences.png + :align: center + + **Preferences**: Windows tab + +- **Use HideFaces panel in operation** if the checkbox is checked then HideFaces panel will be launched automatically on launching an operation where using of this panel is considered. + +.. _sketch_preferences: + +Sketch tab +^^^^^^^^^^ + +Sketch tab defines properties of coordinate planes shown for selection of sketch plane when no convenient objects are shown in OCC 3D viewer. + +.. figure:: /images/sketch_preferences.png + :align: center + + **Preferences**: Sketch tab + +**Input fields**: + +- **Size** defines size of coordinate planes; +- **Thickness** defines thickness of coordinate plane borders; +- **Rotate to plane when selected** check-box turns on/off automatic switch the viewer to the top view for the selected sketch plane. +- **Angular tolerance** defines defines an angular tolerance for automatic creation of horizontal and vertical constraints; +- **Default spline weight** defines default weight for B-spline nodes during creation. The default value can be changed by editing of the spline; +- **Cursor for sketch operation** defines a cursor which indicates a launched sketcher sub-operation. +- **Create sketch entities by dragging** defines a style of sketch etities creation. It concerns creation of lines, rectangles, circles, arcs, ellipses, elliptic arcs. If it is switched ON then points of objects have to be defined by mouse press - mouse move - mouse release. Otherwise every point of an object has to be defined by mouse click; + +.. _viewer_preferences: + +Viewer tab +^^^^^^^^^^ + +Viewer tab defines selection in OCC 3D viewer properties. + +.. figure:: /images/viewer_preferences.png + :align: center + + **Preferences**: Viewer tab + +**Input fields**: + +- **Default Selection** defines objects to be selected by mouse click in OCC 3D viewer: + + - **Faces** check-box turns on/off selection of faces; + - **Edges** check-box turns on/off selection of edges; + - **Vertices** check-box turns on/off selection of vertices; + +- **Selection sensitivity** defines size of area around object in pixels, in which mouse click selects object inside this area: + + - **Vertex** defines selection sensitivity for vertices; + - **Edge** defines selection sensitivity for edges. + +.. _toolbars_management: + +Toolbars management +------------------- + +.. _toolbars_dialog: + +**Toolbars** dialog box +^^^^^^^^^^^^^^^^^^^^^^^ +To edit the current tool bars structure select in the Main Menu *Edit - > Edit toolbars* item. +The following dialog box with existing toolbars appears: + +.. figure:: /images/Toolbars.png + :align: center + + **Toolbars** dialog box + +**Input fields**: + +- **Toolbars** window contains list of toolbars names. Number of commands in each tool bar is shown in brackets. +- **Add** button creates a new toolbar. Click on **Add** button opens :ref:`create_toolbar`; +- **Edit** button calls :ref:`edit_toolbar` for currently selected tool bar; +- **Delete** button removes currently selected tool bar. Click on **Delete** button opens warning dialog box. After confirmation by click **Yes** button the selected toolbar is deleted. Click **No** button cancels removing of the selected toolbar; +- **Reset** button restores modified tool bars structure to default state; +- **OK** button closes the dialog box, stores result of tool bars edition and updates Shaper tool bars; +- **Cancel** button closes the dialog box without modification of tool bars. + +.. figure:: /images/delete_toolbar.png + :align: center + + Warning dialog box + +.. _create_toolbar: + +**Create toolbar** dialog box +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +**Input fields** of **Create toolbar** dialog box: + +.. figure:: /images/create_toolbar.png + :align: center + + **Create toolbar** dialog box + +- **Name of a new toolbar** defines name of the new tool bar. The name of tool bar has to be unique. If user defines a not unique name then a warning appears and a new tooolbar with not unique name is not created; +- **Ok** button closes the dialog box and add a new tool bar of the module into **Toolbars** window; +- **Cancel** button closes the dialog box without addition of a new tool bar. + +.. figure:: /images/name_toolbar.png + :align: center + + **Warning** dialog box + +.. _edit_toolbar: + +**Edit toolbar** dialog box +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +**Input fields** of **Edit toolbar** dialog box: + +.. figure:: /images/EditToolbar.png + :align: center + + **Edit toolbar** dialog box + +- **Toolbar name** non-editable field displays name of modified tool bar; +- **Out of toolbars** window contains list of commands which are not included into any tool bar and separator definition "------"; +- **In the toolbar** window contains list of commands which are defined in the current tool bar. Items in this window are listed according to order of commands in the toolbar; +- **Right arrow** button transfers currently selected item from **Out of toolbars** window to **In the toolbar** window and puts new item before the selected item in **In the toolbar** window. + If there is no selected item in **In the toolbar** window then new item will be added at the end of items list. In order to clear current selection it is necessary to click in empty space of the window. +- **Left arrow** button transfers currently selected item from **In the toolbar** window into **Out of toolbars** window; +- **Up** and **Down** buttons change position of selected command in **In the toolbar** window; +- **Ok** button closes the dialog box, stores result of edition; +- **Cancel** button closes the dialog box without modification of tool bar content. diff --cc src/ExchangePlugin/ExchangePlugin_ImportPart.cpp index e63d5ee9c,c0930ef87..ae74d6b30 --- a/src/ExchangePlugin/ExchangePlugin_ImportPart.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportPart.cpp @@@ -102,10 -105,10 +105,10 @@@ void ExchangePlugin_ImportPart::attribu for (std::list::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 (aPartsAttr->size() != anAcceptedValues.size()) + if ((size_t)aPartsAttr->size() != anAcceptedValues.size()) aTargetAttr->setValue(0); aPartsAttr->setSize((int)anAcceptedValues.size()); @@@ -164,16 -168,16 +168,16 @@@ DocumentPtr findDocument(DocumentPtr th return aDoc; } - typedef std::map > > ObjectNameMap; + typedef std::map > > 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); diff --cc src/Model/Model_AttributeSelection.cpp index 27ef884ad,180fb85e5..9219aca4b --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@@ -362,13 -364,13 +364,13 @@@ std::shared_ptr Model_At } 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); - int anIndex; ++ 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(Locale::Convert::toWString(aNameInPart), aType, anIndex); + return aPart->shapeInPart(aNameInPart, aType, anInd); } } } @@@ -833,7 -838,7 +838,7 @@@ static ModelAPI_AttributeSelection::Cen 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; @@@ -867,11 -872,11 +872,11 @@@ void Model_AttributeSelection::selectSu std::shared_ptr aDoc = std::dynamic_pointer_cast(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(aRootDoc); aSubShapeName = aSubShapeName.substr(aPartEnd + 1); } @@@ -932,7 -937,7 +937,7 @@@ } // 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); @@@ -1900,9 -1903,9 +1905,9 @@@ bool Model_AttributeSelection::restoreC std::dynamic_pointer_cast(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::string::size_type n = aName.find('/'); - if (n != std::string::npos) { ++ std::wstring::size_type n = aName.find(L'/'); ++ if (n != std::wstring::npos) { aName = aName.substr(0, n); } @@@ -1913,11 -1916,12 +1918,12 @@@ // name in PartSet? aDoc = std::dynamic_pointer_cast( 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('/'); - std::string::size_type n = aName.find('/'); -- if (n != std::string::npos) { ++ n = aName.find(L'/'); ++ if (n != std::wstring::npos) { aName = aName.substr(0, n); } } @@@ -1932,9 -1936,9 +1938,9 @@@ // 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(aDoc->feature(aCont)); if (aComposite.get() && aComposite->numberOfSubs()) { diff --cc src/Model/Model_Document.cpp index 6893930fe,4ce8f1184..7d9dabeae --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@@ -1783,9 -1782,9 +1786,9 @@@ TDF_Label Model_Document::findNamingNam 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()); @@@ -1931,8 -1930,8 +1934,8 @@@ ResultPtr Model_Document::findByName aRes = myObjs->findByName(aName); } if (aNumInHistory) { - std::map >::iterator aFind = myNamingNames.find(aName); + std::map >::iterator aFind = myNamingNames.find(aName); - if (aFind != myNamingNames.end() && aFind->second.size() > aNumInHistory) { + if (aFind != myNamingNames.end() && (int)aFind->second.size() > aNumInHistory) { std::list::reverse_iterator aLibIt = aFind->second.rbegin(); for(; aNumInHistory != 0; aNumInHistory--) aLibIt++; diff --cc src/Model/Model_Objects.cpp index ce23976c3,3a9cfe583..2c32988e2 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@@ -1187,8 -1190,8 +1189,8 @@@ TDF_Label Model_Objects::resultLabel bool Model_Objects::hasCustomName(DataPtr theFeatureData, ResultPtr theResult, - int theResultIndex, + int /*theResultIndex*/, - std::string& theParentName) const + std::wstring& theParentName) const { ResultBodyPtr aBodyRes = std::dynamic_pointer_cast(theFeatureData->owner()); if (aBodyRes) { diff --cc src/Model/Model_ResultConstruction.cpp index 19776ba2a,18acf89ee..e6a88069b --- a/src/Model/Model_ResultConstruction.cpp +++ b/src/Model/Model_ResultConstruction.cpp @@@ -131,9 -131,9 +131,9 @@@ static std::wstring shortName 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::string::npos) { ++ while(aSyms.find(*aSuffix) != std::wstring::npos) { --aSuffix; } aName.erase(aSuffix + 1, aName.end()); @@@ -294,9 -294,10 +294,10 @@@ void Model_ResultConstruction::storeSha TopExp_Explorer anExp(aShape, TopAbs_VERTEX); for(int anIndex = 1; anExp.More(); anExp.Next(), anIndex++) { TDF_Label aSubLab = aShapeLab.FindChild(anIndex); - TNaming_Builder aBuilder(aSubLab); - aBuilder.Generated(anExp.Current()); + 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); } diff --cc src/Model/Model_ResultPart.cpp index 3c52f0986,1ecd9ce39..01d7ef900 --- a/src/Model/Model_ResultPart.cpp +++ b/src/Model/Model_ResultPart.cpp @@@ -289,11 -292,11 +292,11 @@@ std::wstring Model_ResultPart::nameInPa // getting an access to the document of part std::shared_ptr aDoc = std::dynamic_pointer_cast(partDoc()); if (!aDoc.get()) // the part document is not presented for the moment - return ""; + return L""; - TDF_Label anAccessLabel = aDoc->generalLabel(); + 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(); diff --cc src/ModelAPI/ModelAPI_Events.h index 68af75b1b,c0aa61ef8..0bfb4d53e --- a/src/ModelAPI/ModelAPI_Events.h +++ b/src/ModelAPI/ModelAPI_Events.h @@@ -63,65 -57,62 +63,65 @@@ MAYBE_UNUSED static const char * EVENT_ /// Event ID that order of objects in group is changed, /// so, tree must be fully recreated (movement of feature) -static const char * EVENT_ORDER_UPDATED = "OrderUpdated"; +MAYBE_UNUSED static const char * EVENT_ORDER_UPDATED = "OrderUpdated"; /// Event ID that the sketch is prepared and all grouped messages for the solver may be flushed -static const char * EVENT_UPDATE_SELECTION = "UpdateSelection"; +MAYBE_UNUSED static const char * EVENT_UPDATE_SELECTION = "UpdateSelection"; /// Request for the enabled/disabled actions behavior for some specific features -static const char * EVENT_FEATURE_STATE_REQUEST = "FeatureStateRequest"; +MAYBE_UNUSED static const char * EVENT_FEATURE_STATE_REQUEST = "FeatureStateRequest"; /// Reply for the enabled/disabled actions behavior for some specific features -static const char * EVENT_FEATURE_STATE_RESPONSE = "FeatureStateResponse"; +MAYBE_UNUSED static const char * EVENT_FEATURE_STATE_RESPONSE = "FeatureStateResponse"; /// To block the viewer updates -static const char * EVENT_UPDATE_VIEWER_BLOCKED = "UpdateViewerBlocked"; +MAYBE_UNUSED static const char * EVENT_UPDATE_VIEWER_BLOCKED = "UpdateViewerBlocked"; /// To unblock the viewer updates -static const char * EVENT_UPDATE_VIEWER_UNBLOCKED = "UpdateViewerUnblocked"; +MAYBE_UNUSED static const char * EVENT_UPDATE_VIEWER_UNBLOCKED = "UpdateViewerUnblocked"; /// To inform that there is an empty presentation in the viewer -static const char * EVENT_EMPTY_AIS_PRESENTATION = "EmptyAISPresentation"; +MAYBE_UNUSED static const char * EVENT_EMPTY_AIS_PRESENTATION = "EmptyAISPresentation"; /// To inform that there is an empty operation for presentation in the viewer -static const char * EVENT_EMPTY_OPERATION_PRESENTATION = "EmptyOperationPresentation"; +MAYBE_UNUSED static const char * EVENT_EMPTY_OPERATION_PRESENTATION = "EmptyOperationPresentation"; /// To block preview -static const char * EVENT_PREVIEW_BLOCKED = "PreviewBlocked"; +MAYBE_UNUSED static const char * EVENT_PREVIEW_BLOCKED = "PreviewBlocked"; /// To preview the current feature in the viewer (to compute the result) -static const char * EVENT_PREVIEW_REQUESTED = "PreviewRequested"; +MAYBE_UNUSED static const char * EVENT_PREVIEW_REQUESTED = "PreviewRequested"; /// To block automatic recomputation of any feature (by the GUI button press) -static const char * EVENT_AUTOMATIC_RECOMPUTATION_DISABLE = "DisableAutomaticRecomputation"; +MAYBE_UNUSED static const char * EVENT_AUTOMATIC_RECOMPUTATION_DISABLE + = "DisableAutomaticRecomputation"; /// To unblock block automatic recomputation (default state: the GUI button unpressed) -static const char * EVENT_AUTOMATIC_RECOMPUTATION_ENABLE = "EnableAutomaticRecomputation"; +MAYBE_UNUSED static const char * EVENT_AUTOMATIC_RECOMPUTATION_ENABLE + = "EnableAutomaticRecomputation"; /// Event ID that solver has conflicting constraints (comes with ModelAPI_SolverFailedMessage) -static const char * EVENT_SOLVER_FAILED = "SolverFailed"; +MAYBE_UNUSED static const char * EVENT_SOLVER_FAILED = "SolverFailed"; /// Event ID that the problem in solver disappeared -static const char * EVENT_SOLVER_REPAIRED = "SolverRepaired"; +MAYBE_UNUSED static const char * EVENT_SOLVER_REPAIRED = "SolverRepaired"; /// Event Id that sketch has DoF = 0 -static const char * EVENT_SKETCH_FULLY_CONSTRAINED = "SketchFullyConstrainted"; +MAYBE_UNUSED static const char * EVENT_SKETCH_FULLY_CONSTRAINED = "SketchFullyConstrainted"; /// Event Id that sketch has DoF > 0 -static const char * EVENT_SKETCH_UNDER_CONSTRAINED = "SketchUnderConstrainted"; +MAYBE_UNUSED static const char * EVENT_SKETCH_UNDER_CONSTRAINED = "SketchUnderConstrainted"; /// Event Id that sketch has DoF < 0 -static const char * EVENT_SKETCH_OVER_CONSTRAINED = "SketchOverConstrainted"; +MAYBE_UNUSED static const char * EVENT_SKETCH_OVER_CONSTRAINED = "SketchOverConstrainted"; /// Event ID that informs that some object has changed the stability -static const char * EVENT_STABILITY_CHANGED = "StabilityChanged"; +MAYBE_UNUSED static const char * EVENT_STABILITY_CHANGED = "StabilityChanged"; /// Event ID that the sketch is prepared and all grouped messages for the solver may be flushed -static const char * EVENT_SKETCH_PREPARED = "SketchPrepared"; +MAYBE_UNUSED static const char * EVENT_SKETCH_PREPARED = "SketchPrepared"; /// Event ID that provides a request for list of non-fixed objects necessary for DoF = 0 -static const char * EVENT_GET_DOF_OBJECTS = "GetDoFObjects"; +MAYBE_UNUSED static const char * EVENT_GET_DOF_OBJECTS = "GetDoFObjects"; /// Event ID that provides a request for list of non-fixed objects necessary for DoF = 0 -static const char * EVENT_DOF_OBJECTS = "DoFObjects"; +MAYBE_UNUSED static const char * EVENT_DOF_OBJECTS = "DoFObjects"; /// Event ID that requests updates visual attributes for presentations -static const char * EVENT_VISUAL_ATTRIBUTES = "UpdateVisualAttributes"; +MAYBE_UNUSED static const char * EVENT_VISUAL_ATTRIBUTES = "UpdateVisualAttributes"; + /// 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 diff --cc src/ModelHighAPI/ModelHighAPI_Interface.cpp index cec0fb1ce,5fd4de052..8a2f1c644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Interface.cpp @@@ -86,16 -86,13 +86,16 @@@ void ModelHighAPI_Interface::execute(bo //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()) + if (feature().get() && feature()->data()->isValid()) feature()->data()->setName(theName); + else { + std::cout<<"Error: set name "<data()->name(); } diff --cc src/ModelHighAPI/ModelHighAPI_Tools.cpp index 0b91369bf,f3a280488..0b72c418f --- a/src/ModelHighAPI/ModelHighAPI_Tools.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Tools.cpp @@@ -422,8 -421,8 +424,8 @@@ std::string storeFeatures(const std::ws } } // store the model features information: iterate all features - int anObjectsCount = 0; // stores the number of compared features for this document to compare + size_t anObjectsCount = 0; // stores the number of compared features for this document to compare - std::set aProcessed; // processed features names (that are in the current document) + std::set aProcessed; // processed features names (that are in the current document) // process all objects (features and folders) std::list allObjects = theDoc->allObjects(); diff --cc src/ModuleBase/ModuleBase_Tools.cpp index e190a8fab,ed9717c10..3037eceac --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@@ -1282,11 -1282,13 +1282,11 @@@ FeaturePtr findParameter(const QString //******************************************************************** - std::string generateName(const AttributePtr& theAttribute, + std::wstring generateName(const AttributePtr& theAttribute, ModuleBase_IWorkshop* theWorkshop) { - std::string aName; + std::wstring aName; if (theAttribute.get() != NULL) { - ModuleBase_Operation* anOperation = theWorkshop->currentOperation(); - FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); if (aFeature.get()) { std::string aXmlCfg, aDescription; diff --cc src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 5d12d728a,a6acbc519..21df54023 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@@ -792,11 -816,11 +814,11 @@@ void ModuleBase_WidgetMultiSelector::up else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { AttributeRefAttrListPtr aRefAttrListAttr = aData->refattrlist(attributeID()); for (int i = 0; i < aRefAttrListAttr->size(); i++) { - AttributePtr anAttribute = aRefAttrListAttr->attribute(i); + AttributePtr anAttr = aRefAttrListAttr->attribute(i); QString aName; - if (anAttribute.get()) { - std::wstring anAttrName = ModuleBase_Tools::generateName(anAttribute, myWorkshop); + 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); diff --cc src/PartSet/PartSet_MenuMgr.cpp index 640f9f827,911273a6c..06252baa5 --- a/src/PartSet/PartSet_MenuMgr.cpp +++ b/src/PartSet/PartSet_MenuMgr.cpp @@@ -192,8 -192,8 +192,8 @@@ bool PartSet_MenuMgr::addViewerMenu(con theMenuActions[anIndex++] = aSubMenu->menuAction(); QAction* aAction; int i = 0; - foreach (FeaturePtr aCoins, myCoinsideLines) { - QString anItemText = QString::fromStdWString(aCoins->data()->name()); + 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]"; @@@ -316,9 -317,11 +316,9 @@@ void PartSet_MenuMgr::onLineDetach(QAct if (aToDelFeatures.size() > 0) { XGUI_ModuleConnector* aConnector = dynamic_cast(myModule->workshop()); XGUI_Workshop* aWorkshop = aConnector->workshop(); - ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation(); - 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); - bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation); 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 diff --cc src/PartSet/PartSet_Module.cpp index 446b253b3,eeb18584f..108db7563 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@@ -1152,7 -1170,8 +1160,6 @@@ void PartSet_Module::onViewTransformed( sketchMgr()->isNestedSketchOperation(aCurrentOperation) || (aCurrentOperation->id() == "Measurement"))) { - double aLen = aView->Convert(SketcherPrs_Tools::getConfigArrowSize()); - - double aPrevLen = SketcherPrs_Tools::getArrowSize(); SketcherPrs_Tools::setArrowSize(aLen); const double aCurScale = aViewer->activeView()->Camera()->Scale(); aViewer->SetScale(aViewer->activeView(), aCurScale); diff --cc src/Selector/CMakeLists.txt index d3ab25d0a,aa649d287..f073926ac --- a/src/Selector/CMakeLists.txt +++ b/src/Selector/CMakeLists.txt @@@ -49,14 -49,12 +49,16 @@@ SET(PROJECT_SOURCE ) SET(PROJECT_LIBRARIES + Locale ${OpenCASCADE_ApplicationFramework_LIBRARIES} + GeomAPI + GeomAlgoAPI ) SET(PROJECT_INCLUDES + ../Locale ${OpenCASCADE_INCLUDE_DIR} + ../GeomAPI + ../GeomAlgoAPI ) diff --cc src/Selector/Selector_Algo.cpp index ef53c7dcb,94ce16124..2f484f868 --- a/src/Selector/Selector_Algo.cpp +++ b/src/Selector/Selector_Algo.cpp @@@ -414,7 -414,7 +414,7 @@@ Selector_Algo* Selector_Algo::restoreBy 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,11 +429,12 @@@ 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) { // weak naming identifier + } 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; diff --cc src/Selector/Selector_Algo.h index 6f171afb1,162f0cc24..b9fa6b0cd --- a/src/Selector/Selector_Algo.h +++ b/src/Selector/Selector_Algo.h @@@ -150,28 -148,16 +150,29 @@@ protected static const Standard_GUID kSHAPE_TYPE("864b3267-cb9d-4107-bf58-c3ce1775b171"); 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 = L"weak_name_"; ++ 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 = L"_weak_name_"; ++ 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) diff --cc src/Selector/Selector_Container.cpp index 8b5c537ed,05f8fa2ea..df69d7875 --- a/src/Selector/Selector_Container.cpp +++ b/src/Selector/Selector_Container.cpp @@@ -84,21 -85,21 +84,21 @@@ TDF_Label Selector_Container::restoreBy { 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; diff --cc src/Selector/Selector_FilterByNeighbors.cpp index 0035d48f0,075036400..49992956b --- a/src/Selector/Selector_FilterByNeighbors.cpp +++ b/src/Selector/Selector_FilterByNeighbors.cpp @@@ -300,12 -299,12 +300,12 @@@ TDF_Label Selector_FilterByNeighbors::r { 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::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(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 -327,17 +328,17 @@@ // 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::string::npos && - theName[anEndPos] != '(' && theName[anEndPos] != 0; ++ 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 -347,9 +348,9 @@@ 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::string::npos) { ++ 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)) { diff --cc src/Selector/Selector_Intersect.cpp index 49b0764d7,07671e2f6..1aee58ea1 --- a/src/Selector/Selector_Intersect.cpp +++ b/src/Selector/Selector_Intersect.cpp @@@ -22,6 -22,6 +22,8 @@@ #include #include ++#include ++ #include #include #include @@@ -186,24 -186,19 +188,24 @@@ TDF_Label Selector_Intersect::restoreBy { 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); - if (aSubStr.find(weakNameID()) == 0) { // weak name identifier - std::wstring aWeakIndex = aSubStr.substr(weakNameID().size()); - myWeakIndex = stoi(aWeakIndex); + 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] != '[') { ++ if (theName[anEndPos + 1] != L'[') { switch(aShapeChar) { case 'e': aSubShapeType = TopAbs_EDGE; break; case 'v': aSubShapeType = TopAbs_VERTEX; break; diff --cc src/Selector/Selector_Modify.cpp index 987915eeb,08ad66b0e..98d133719 --- a/src/Selector/Selector_Modify.cpp +++ b/src/Selector/Selector_Modify.cpp @@@ -241,27 -242,19 +243,27 @@@ 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 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::string::npos ? anEnd : anEnd - aStart); - if (aSubStr.find(weakNameID()) == 0) { // weak name identifier - std::wstring aWeakIndex = aSubStr.substr(weakNameID().size()); - myWeakIndex = std::stoi(aWeakIndex.c_str()); ++ 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; } TDF_Label aSubContext, aValue; diff --cc src/Selector/Selector_Primitive.cpp index d93241f73,6825fdf92..02dec6f15 --- a/src/Selector/Selector_Primitive.cpp +++ b/src/Selector/Selector_Primitive.cpp @@@ -47,8 -49,8 +49,8 @@@ 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) + const TopAbs_ShapeEnum /*theShapeType*/, Selector_NameGenerator* theNameGenerator) { TDF_Label aContext; if (theNameGenerator->restoreContext(theName, aContext, myFinal)) { diff --cc src/Selector/Selector_WeakName.cpp index 813fa0b4e,6d3ad0455..559071b9c --- a/src/Selector/Selector_WeakName.cpp +++ b/src/Selector/Selector_WeakName.cpp @@@ -22,6 -22,6 +22,8 @@@ #include #include ++#include ++ #include #include #include @@@ -85,18 -85,16 +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) { - std::wstring aWeakIndex = theName.substr(pureWeakNameID().size()); + 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 = std::stoi(aWeakIndex.c_str()); ++ 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(); diff --cc src/SketchPlugin/SketchPlugin_Tools.cpp index ed4084afe,15222805b..836071aae --- a/src/SketchPlugin/SketchPlugin_Tools.cpp +++ b/src/SketchPlugin/SketchPlugin_Tools.cpp @@@ -645,13 -650,13 +650,13 @@@ void setDimensionColor(const AISObjectP 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()); ++ + aName.substr(aPos + theSource.size()); theObject->data()->setName(aNewName); } } diff --cc src/SketchPlugin/SketchPlugin_Validators.cpp index e226f229e,1727756d6..0ccd6ae4f --- a/src/SketchPlugin/SketchPlugin_Validators.cpp +++ b/src/SketchPlugin/SketchPlugin_Validators.cpp @@@ -560,9 -558,9 +563,9 @@@ bool SketchPlugin_CopyValidator::isVali bool isFound = aSelObject == *anObjIter; if (!isFound) { // check in the results of the feature -- FeaturePtr aFeature = std::dynamic_pointer_cast(*anObjIter); -- if (aFeature) { -- const std::list& aResults = aFeature->results(); ++ FeaturePtr aCurFeature = std::dynamic_pointer_cast(*anObjIter); ++ if (aCurFeature) { ++ const std::list& aResults = aCurFeature->results(); for (std::list::const_iterator aResIt = aResults.begin(); aResIt != aResults.end() && !isFound; ++aResIt) { isFound = aSelObject == *aResIt; @@@ -570,7 -568,7 +573,8 @@@ } } if (isFound) { - std::string aName = aSelObject.get() ? aSelObject->data()->name() : ""; - std::wstring aName = aSelObject.get() ? aSelObject->data()->name() : L""; ++ 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;