X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_AttributeSelection.h;h=9267748a7d33a4e182726643cbb3d2404f94f320;hb=e85bb4f7065e5750e48a7c77056c80c0fa18e559;hp=93fb9876e0888bd5a6c85e607163a367c605f3f2;hpb=698a1c427ab2537e7a96b5206d6987087b78f54f;p=modules%2Fshaper.git diff --git a/src/Model/Model_AttributeSelection.h b/src/Model/Model_AttributeSelection.h index 93fb9876e..9267748a7 100644 --- a/src/Model/Model_AttributeSelection.h +++ b/src/Model/Model_AttributeSelection.h @@ -1,8 +1,22 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: Model_AttributeSelection.h -// Created: 8 May 2014 -// Author: Mikhail PONIKAROV +// 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 +// #ifndef Model_AttributeSelection_H_ #define Model_AttributeSelection_H_ @@ -12,8 +26,10 @@ #include #include #include +#include class Model_AttributeSelectionList; +class Model_Document; /**\class Model_AttributeSelection * \ingroup DataModel @@ -27,6 +43,8 @@ class Model_AttributeSelection : public ModelAPI_AttributeSelection ResultPtr myTmpContext; /// temporarily storages to avoid keeping in the data structure if not needed std::shared_ptr myTmpSubShape; + /// temporarily storages to avoid keeping in the data structure if not needed + CenterType myTmpCenterType; /// Reference to the partent attribute, if any (to split selection compounds in issue 1799) Model_AttributeSelectionList* myParent; public: @@ -35,10 +53,22 @@ public: /// \param theSubShape selected sub-shape (if null, the whole context is selected) /// \param theTemporarily if it is true, do not store and name the added in the data framework /// (used to remove immideately, without the following updates) - MODEL_EXPORT virtual void setValue( - const ResultPtr& theContext, const std::shared_ptr& theSubShape, + /// \returns true if attribute was updated + MODEL_EXPORT virtual bool setValue( + const ObjectPtr& theContext, const std::shared_ptr& theSubShape, const bool theTemporarily = false); + /// Same as SetValue, but it takes an edge (on circular or elliptical curve) + /// and stores the vertex of the central point (for ellipse the first or the second focus point) + MODEL_EXPORT virtual void setValueCenter( + const ObjectPtr& theContext, const std::shared_ptr& theEdge, + const CenterType theCenterType, + const bool theTemporarily = false); + + /// Makes this selection attribute selects the same as in theSource selection + MODEL_EXPORT virtual void selectValue( + const std::shared_ptr& theSource); + /// Reset temporary stored values virtual void removeTemporaryValues(); @@ -48,6 +78,11 @@ public: /// Returns the context of the selection (the whole shape owner) MODEL_EXPORT virtual ResultPtr context(); + /// Returns the context of the selection if the whole feature was selected + MODEL_EXPORT virtual FeaturePtr contextFeature(); + /// Returns the context of the selection : result or feature + MODEL_EXPORT virtual std::shared_ptr contextObject(); + /// Sets the feature object MODEL_EXPORT virtual void setObject(const std::shared_ptr& theObject); @@ -87,16 +122,19 @@ protected: /// Objects are created for features automatically MODEL_EXPORT Model_AttributeSelection(TDF_Label& theLabel); + /// Returns the selected subshape, internal method that works without knowledge + /// about special selection of circle and ellipse focuses (for that the public value + /// method calls this and makes additional processing). + /// Returns theType type of the center, or NOT_CENTER if it is not. + std::shared_ptr internalValue(CenterType& theType); + + /// Performs the selection for the body result (TNaming Selection) /// Performs the selection for the body result (TNaming selection) virtual void selectBody( const ResultPtr& theContext, const std::shared_ptr& theSubShape); - /// Performs the selection for the construction result (selection by index) - virtual void selectConstruction( - const ResultPtr& theContext, const std::shared_ptr& theSubShape); - /// Performs the selection for the part result (selection by name of body result inside of part) /// \param theContext the result - owner of the selection /// \param theSubShape selected shape @@ -125,6 +163,16 @@ protected: /// Splits theNewShape into sub-shapes of theType type (for the list parent of this attribute) void split(ResultPtr theContext, TopoDS_Shape theNewShape, TopAbs_ShapeEnum theType); + /// When group position is updated, searches the new context and new values + bool searchNewContext(std::shared_ptr theDoc, const TopoDS_Shape theContShape, + ResultPtr theContext, TopoDS_Shape theValShape, TDF_Label theAccessLabel, + std::list& theResults, TopTools_ListOfShape& theValShapes); + + /// computes theShapes list - shapes that were generated/modified/deleted the theValShape + /// during creation from new to old context + void computeValues(ResultPtr theOldContext, ResultPtr theNewContext, TopoDS_Shape theValShape, + TopTools_ListOfShape& theShapes); + friend class Model_Data; friend class Model_AttributeSelectionList; };