X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_ResultConstruction.cpp;h=6307b4130304394146105430a78de62fd9b587fa;hb=06e7f5859095193fc7f498bd89a7d28009794f53;hp=997eeab619de6daf694e0788b623ca2c9b88f7ce;hpb=f03c02cd62fe508c65818d31fdf9dcf69f8cbf35;p=modules%2Fshaper.git diff --git a/src/Model/Model_ResultConstruction.cpp b/src/Model/Model_ResultConstruction.cpp index 997eeab61..6307b4130 100644 --- a/src/Model/Model_ResultConstruction.cpp +++ b/src/Model/Model_ResultConstruction.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2023 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -59,7 +59,7 @@ static void indexingSketchEdges( const CompositeFeaturePtr& theComposite, NCollection_DataMap& theCurvesIndices, NCollection_DataMap& theEdgesIndices, - std::map& theEdgesNames); + std::map& 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& theDocument, TDF_Label& theShapeLabel, - const std::string& theName, + const std::wstring& theName, const TopoDS_Shape& theShape, NCollection_DataMap& theFacesOrder, NCollection_List& theUnorderedFaces, const MapFaceToEdgeIndices& theFaceEdges, const NCollection_DataMap& theEdgesIndices, - const std::map& theEdgesNames); + const std::map& theEdgesNames); // identifier of the infinite result @@ -100,7 +100,7 @@ void Model_ResultConstruction::colorConfigInfo(std::string& theSection, std::str std::string& theDefault) { theSection = "Visualization"; - theName = "result_construction_color"; + theName = RESULT_COLOR_NAME(); theDefault = DEFAULT_COLOR(); } @@ -121,19 +121,19 @@ std::shared_ptr Model_ResultConstruction::shape() return myShape; } -static std::string shortName( +static std::wstring shortName( std::shared_ptr& 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()); @@ -222,7 +222,7 @@ void Model_ResultConstruction::setInfinite(const bool theInfinite) } } -int Model_ResultConstruction::facesNum(const bool theUpdateNaming) +int Model_ResultConstruction::facesNum(const bool /*theUpdateNaming*/) { int aResult = 0; std::shared_ptr aData = std::dynamic_pointer_cast(data()); @@ -270,7 +270,7 @@ void Model_ResultConstruction::storeShape(std::shared_ptr theShap { std::shared_ptr aData = std::dynamic_pointer_cast(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(); @@ -294,9 +294,10 @@ void Model_ResultConstruction::storeShape(std::shared_ptr theShap 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()); - std::string aVertexName = aMyName + "_" + (anIndex == 1 ? "StartVertex" : "EndVertex"); + TNaming_Builder aSubBuilder(aSubLab); + aSubBuilder.Generated(anExp.Current()); + 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 theShap // collect indices of curves of current composite NCollection_DataMap aCurvesIndices; NCollection_DataMap anEdgeIndices; - std::map aComponentsNames; // names of components that lay on index + std::map 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& theFa { std::shared_ptr aData = std::dynamic_pointer_cast(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& theFa // collect indices of curves of current composite NCollection_DataMap aCurvesIndices; NCollection_DataMap anEdgeIndices; - std::map aComponentsNames; // names of components that lay on index + std::map 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& theFa void storeFacesOnLabel(std::shared_ptr& theDocument, TDF_Label& theShapeLabel, - const std::string& theName, + const std::wstring& theName, const TopoDS_Shape& theShape, NCollection_DataMap& theFacesOrder, NCollection_List& theUnorderedFaces, const MapFaceToEdgeIndices& theFaceEdges, const NCollection_DataMap& theEdgesIndices, - const std::map& theEdgesNames) + const std::map& theEdgesNames) { theShapeLabel.ForgetAllAttributes(); // clear all previously stored TDataStd_Name::Set(theShapeLabel, theName.c_str()); // restore name forgotten @@ -440,7 +441,6 @@ void storeFacesOnLabel(std::shared_ptr& theDocument, aBuilder.Generated(theShape); theDocument->addNamingName(theShapeLabel, theName); // set new faces to the labels - int aCurrentTag = 1; NCollection_List::Iterator anUnordered(theUnorderedFaces); for (int aCurrentTag = 1; !theFacesOrder.IsEmpty() || anUnordered.More(); aCurrentTag++) { TopoDS_Face aFaceToPut; @@ -466,7 +466,7 @@ void storeFacesOnLabel(std::shared_ptr& theDocument, // store also indices of the new face edges Handle(TDataStd_IntPackedMap) aNewMap = TDataStd_IntPackedMap::Set(aLab); const TColStd_ListOfInteger& aNewInd = theFaceEdges.FindFromKey(aFaceToPut); - std::stringstream aName; + std::wstringstream aName; aName<<"Face"; TopExp_Explorer aPutEdges(aFaceToPut, TopAbs_EDGE); TNaming_Builder *anEdgesBuilder = 0, *aVerticesBuilder = 0; @@ -525,8 +525,8 @@ void storeFacesOnLabel(std::shared_ptr& theDocument, TDF_Label aWireLab = aLab.FindChild(aWireTag); TNaming_Builder aWireBuilder(aWireLab); aWireBuilder.Generated(aWires.Current()); - std::ostringstream aWireName; - aWireName< 3) aWireName<<"_"<& theDocument, void indexingSketchEdges(const CompositeFeaturePtr& theComposite, NCollection_DataMap& theCurvesIndices, NCollection_DataMap& theEdgesIndices, - std::map& theEdgesNames) + std::map& theEdgesNames) { const int aSubNum = theComposite->numberOfSubs(); for (int a = 0; a < aSubNum; a++) {