X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelHighAPI%2FModelHighAPI_Selection.h;h=2a5586e0e7c79e16967de5855d4e148859e2e7f4;hb=88ee9b2b81cf93a6324336b57e30cc8a3a487499;hp=db78cb69ee7c3911d1b2ca6cd3bc0e19a7397c46;hpb=423c10234142d14d0d5de89383f2f96a4ec5930f;p=modules%2Fshaper.git diff --git a/src/ModelHighAPI/ModelHighAPI_Selection.h b/src/ModelHighAPI/ModelHighAPI_Selection.h index db78cb69e..2a5586e0e 100644 --- a/src/ModelHighAPI/ModelHighAPI_Selection.h +++ b/src/ModelHighAPI/ModelHighAPI_Selection.h @@ -1,9 +1,21 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -// Name : ModelHighAPI_Selection.h -// Purpose: +// Copyright (C) 2014-2022 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 // -// History: -// 06/06/16 - Sergey POKHODENKO - Creation of the file #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_SELECTION_H_ #define SRC_MODELHIGHAPI_MODELHIGHAPI_SELECTION_H_ @@ -11,18 +23,23 @@ //-------------------------------------------------------------------------------------- #include "ModelHighAPI.h" +#include #include #include #include //-------------------------------------------------------------------------------------- +class GeomAPI_Pnt; class GeomAPI_Shape; class ModelAPI_AttributeSelection; class ModelAPI_AttributeSelectionList; +class ModelAPI_FiltersFeature; class ModelAPI_Result; //-------------------------------------------------------------------------------------- typedef std::pair, std::shared_ptr > ResultSubShapePair; -typedef std::pair TypeSubShapeNamePair; +typedef std::pair TypeSubShapeNamePair; +typedef std::pair > TypeInnerPointPair; +typedef std::pair > TypeWeakNamingPair; //-------------------------------------------------------------------------------------- /**\class ModelHighAPI_Selection * \ingroup CPPHighAPI @@ -34,7 +51,10 @@ public: enum VariantType { VT_Empty, VT_ResultSubShapePair, - VT_TypeSubShapeNamePair + VT_TypeSubShapeNamePair, + VT_TypeInnerPointPair, + VT_WeakNamingPair, + VT_Filtering }; public: @@ -50,7 +70,24 @@ 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 + ModelHighAPI_Selection(const std::string& theType, + const std::shared_ptr& theSubShapeInnerPoint); + + /// Constructor for sub-shape by inner point coordinates given by a tuple + MODELHIGHAPI_EXPORT + ModelHighAPI_Selection(const std::string& theType, + const std::list& theSubShapeInnerPoint); + + + /// Constructor for sub-shape by weak naming identifier + MODELHIGHAPI_EXPORT + ModelHighAPI_Selection(const std::string& theType, + const std::wstring& theContextName, const int theIndex); + /// Destructor MODELHIGHAPI_EXPORT virtual ~ModelHighAPI_Selection(); @@ -75,26 +112,53 @@ public: MODELHIGHAPI_EXPORT virtual TypeSubShapeNamePair typeSubShapeNamePair() const; + /// \return pair of sub-shape type and inner point to identify sub-shape. + MODELHIGHAPI_EXPORT + virtual TypeInnerPointPair typeInnerPointPair() const; + + /// \return pair of sub-shape type and pair of context name and sub-shape index. + MODELHIGHAPI_EXPORT + virtual TypeWeakNamingPair typeWeakNamingPair() const; + /// \return shape type. MODELHIGHAPI_EXPORT virtual std::string shapeType() const; /// 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::wstring name() const; /// Change result's color MODELHIGHAPI_EXPORT - void setColor(int theRed, int theGreen, int theBlue); + void setColor(int theRed = 0, int theGreen = 0, int theBlue = 0, bool random = false); /// Change result's deflection MODELHIGHAPI_EXPORT void setDeflection(double theValue); -private: + /// Change result's transparency + MODELHIGHAPI_EXPORT + void setTransparency(double theValue); + + /// Returns the number of sub-elements. + MODELHIGHAPI_EXPORT + int numberOfSubs() const; + + /// Returns the sub-result by zero-base index. + MODELHIGHAPI_EXPORT + ModelHighAPI_Selection subResult(int theIndex) const; + +protected: VariantType myVariantType; ResultSubShapePair myResultSubShapePair; TypeSubShapeNamePair myTypeSubShapeNamePair; + TypeInnerPointPair myTypeInnerPointPair; + TypeWeakNamingPair myWeakNamingPair; + std::shared_ptr myFilterFeature; }; //--------------------------------------------------------------------------------------