Salome HOME
Issue #2343: Take into account new dimensions for show/hide dimensional constraints
[modules/shaper.git] / src / GeomValidators / GeomValidators_Tools.cpp
index 7f16f08144f74048798b6dd4a902d6fcf8d0be97..00212729281b900b3710efed912484826b680104 100644 (file)
@@ -1,8 +1,22 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        GeomValidators_Tools.cpp
-// Created:     06 Aug 2014
-// Author:      Vitaly Smetannikov
+// 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>
+//
 
 #include "GeomValidators_Tools.h"
 
@@ -19,47 +33,24 @@ namespace GeomValidators_Tools {
     ObjectPtr anObject;
     std::string anAttrType = theAttribute->attributeType();
     if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) {
-      AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
+      AttributeRefAttrPtr anAttr =
+        std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
       if (anAttr != NULL && anAttr->isObject())
         anObject = anAttr->object();
     }
     if (anAttrType == ModelAPI_AttributeSelection::typeId()) {
-      AttributeSelectionPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
+      AttributeSelectionPtr anAttr =
+        std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
       if (anAttr != NULL)
         anObject = anAttr->context();
     }
     if (anAttrType == ModelAPI_AttributeReference::typeId()) {
-      AttributeReferencePtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
+      AttributeReferencePtr anAttr =
+        std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
       if (anAttr.get() != NULL)
         anObject = anAttr->value();
     }
     return anObject;
   }
 
-  TopAbs_ShapeEnum getCompoundSubType(const TopoDS_Shape& theShape)
-  {
-    TopAbs_ShapeEnum aShapeType = theShape.ShapeType();
-
-    // for compounds check sub-shapes: it may be compound of needed type:
-    // Booleans may produce compounds of Solids
-    if (aShapeType == TopAbs_COMPOUND) {
-      for(TopoDS_Iterator aSubs(theShape); aSubs.More(); aSubs.Next()) {
-        if (!aSubs.Value().IsNull()) {
-          TopAbs_ShapeEnum aSubType = aSubs.Value().ShapeType();
-          if (aSubType == TopAbs_COMPOUND) { // compound of compound(s)
-            aShapeType = TopAbs_COMPOUND;
-            break;
-          }
-          if (aShapeType == TopAbs_COMPOUND) {
-            aShapeType = aSubType;
-          } else if (aShapeType != aSubType) { // compound of shapes of different types
-            aShapeType = TopAbs_COMPOUND;
-            break;
-          }
-        }
-      }
-    }
-    return aShapeType;
-  }
-
 }