Salome HOME
Fix incorrect syntax for Windows compiler
[modules/shaper.git] / src / Model / Model_ResultConstruction.h
index 151d8a46aec387a6bb68274c1d2fa7a245db11fe..7b1cfcd1744a40b9029f0c3f36623c53b4354044 100644 (file)
@@ -1,8 +1,22 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModelAPI_ResultConstruction.hxx
-// Created:     07 Jul 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<mailto:webmaster.salome@opencascade.com>
+//
 
 #ifndef Model_ResultConstruction_H_
 #define Model_ResultConstruction_H_
@@ -11,6 +25,9 @@
 #include <ModelAPI_ResultConstruction.h>
 #include <vector>
 
+class ModelAPI_Document;
+class TDF_Label;
+
 /**\class Model_ResultConstruction
  * \ingroup DataModel
  * \brief The construction element result of a feature.
@@ -58,10 +75,40 @@ class Model_ResultConstruction : public ModelAPI_ResultConstruction
   /// The construction element is never concealed
   MODEL_EXPORT virtual void setIsConcealed(const bool theValue);
 
+  // methods related to selection of sub-shapes in construction, used by SelectionAttribute
+
+  /// Selects theSubShape in the construction. Returns an index of the selected sub-shape.
+  /// Puts the selected shape with a needed BRepNaming sub-structure to the data tree of result.
+  /// If theSubShape is null, it selects the whole construction and returns zero index.
+  /// If theIndex is not -1, it re-selects over the existing data (used for update selection).
+  /// If theExtDoc is document where this selection is needed, if it differs from this,
+  /// naming structures will be located there.
+  int select(const std::shared_ptr<GeomAPI_Shape>& theSubShape,
+    const std::shared_ptr<ModelAPI_Document> theExtDoc, const int theIndex = -1);
+
+  /// Returns already selected shape by the given index. Zero index means the whole construction,
+  /// so, the returned shape in this case is null.
+  /// If theExtDoc is document where this selection is needed, if it differs from this,
+  /// naming structures will be located there.
+  std::shared_ptr<GeomAPI_Shape> shape(const int theIndex,
+    const std::shared_ptr<ModelAPI_Document> theExtDoc);
+
+  /// Updates the existing selection by the index.
+  /// Returns false if update is failed. Returns theModified true if the selection was updated.
+  /// If theExtDoc is document where this selection is needed, if it differs from this,
+  /// naming structures will be updated there.
+  bool update(const int theIndex, const std::shared_ptr<ModelAPI_Document> theExtDoc,
+    bool& theModified);
+
  protected:
   /// Makes a body on the given feature
   Model_ResultConstruction();
 
+  /// Searchies for the working label selection/update will start from
+  /// Returns true if this is label of the external document.
+  /// theExtDoc is document where this selection is required
+  TDF_Label startLabel(const std::shared_ptr<ModelAPI_Document> theExtDoc, bool& theExternal);
+
   friend class Model_Objects;
 };