X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelHighAPI%2FModelHighAPI_Selection.h;h=21da1cdfe188790a4c1f30c6876c21c378f9472d;hb=6b615b773dd6e6901cd246ecb55003a9941e2365;hp=a3970046576f8523a85adbacd2124d7800458062;hpb=5c2ba91e54934c258b5c5caffd3adf347c5c1180;p=modules%2Fshaper.git diff --git a/src/ModelHighAPI/ModelHighAPI_Selection.h b/src/ModelHighAPI/ModelHighAPI_Selection.h index a39700465..21da1cdfe 100644 --- a/src/ModelHighAPI/ModelHighAPI_Selection.h +++ b/src/ModelHighAPI/ModelHighAPI_Selection.h @@ -1,24 +1,40 @@ -// Name : ModelHighAPI_Selection.h -// Purpose: +// Copyright (C) 2014-2017 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_ //-------------------------------------------------------------------------------------- +#include "ModelHighAPI.h" + #include #include #include - -#include //-------------------------------------------------------------------------------------- class GeomAPI_Shape; class ModelAPI_AttributeSelection; +class ModelAPI_AttributeSelectionList; class ModelAPI_Result; //-------------------------------------------------------------------------------------- -typedef std::pair, std::shared_ptr > ResultSubShapePair; +typedef std::pair, std::shared_ptr > + ResultSubShapePair; typedef std::pair TypeSubShapeNamePair; //-------------------------------------------------------------------------------------- /**\class ModelHighAPI_Selection @@ -28,20 +44,86 @@ typedef std::pair TypeSubShapeNamePair; class ModelHighAPI_Selection { public: + enum VariantType { + VT_Empty, + VT_ResultSubShapePair, + VT_TypeSubShapeNamePair + }; + +public: + /// Default constructor with empty selection. + MODELHIGHAPI_EXPORT + ModelHighAPI_Selection(); + /// Constructor for result and sub-shape - ModelHighAPI_Selection(const std::shared_ptr& theContext = std::shared_ptr(), - const std::shared_ptr& theSubShape = std::shared_ptr()); + MODELHIGHAPI_EXPORT + ModelHighAPI_Selection(const std::shared_ptr& theContext, + const std::shared_ptr& theSubShape = + std::shared_ptr()); /// Constructor for sub-shape by the textual Name + MODELHIGHAPI_EXPORT ModelHighAPI_Selection(const std::string& theType, const std::string& theSubShapeName); /// Destructor + MODELHIGHAPI_EXPORT virtual ~ModelHighAPI_Selection(); /// Fill attribute values - virtual void fillAttribute(std::shared_ptr & theAttribute) const; + MODELHIGHAPI_EXPORT virtual + void fillAttribute(const std::shared_ptr & theAttribute) const; + + /// Append to list attribute + MODELHIGHAPI_EXPORT virtual + void appendToList(const std::shared_ptr & theAttribute) const; + + /// \return variant type. + MODELHIGHAPI_EXPORT + virtual VariantType variantType() const; + + /// \return pair of result and sub-shape. + MODELHIGHAPI_EXPORT + virtual ResultSubShapePair resultSubShapePair() const; + + /// \return pair of sub-shape type and name. + MODELHIGHAPI_EXPORT + virtual TypeSubShapeNamePair typeSubShapeNamePair() const; + + /// \return shape type. + MODELHIGHAPI_EXPORT + virtual std::string shapeType() const; + + /// Shortcut for result()->data()->setName() + MODELHIGHAPI_EXPORT + void setName(const std::string& theName); + + /// Shortcut for result()->data()->name() + MODELHIGHAPI_EXPORT + std::string name() const; + + /// Change result's color + MODELHIGHAPI_EXPORT + void setColor(int theRed, int theGreen, int theBlue); + + /// Change result's deflection + MODELHIGHAPI_EXPORT + void setDeflection(double theValue); + + /// 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; private: - boost::variant myValue; + VariantType myVariantType; + ResultSubShapePair myResultSubShapePair; + TypeSubShapeNamePair myTypeSubShapeNamePair; }; //--------------------------------------------------------------------------------------