]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Remove linking to GeomValidators.
authorspo <sergey.pokhodenko@opencascade.com>
Tue, 3 Nov 2015 14:00:04 +0000 (17:00 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Tue, 3 Nov 2015 14:00:04 +0000 (17:00 +0300)
15 files changed:
src/GeomValidators/GeomValidators_Tools.cpp
src/GeomValidators/GeomValidators_Tools.h
src/ModuleBase/CMakeLists.txt
src/ModuleBase/ModuleBase_Tools.cpp
src/ModuleBase/ModuleBase_Tools.h
src/ModuleBase/ModuleBase_WidgetMultiSelector.h
src/ModuleBase/ModuleBase_WidgetSelector.cpp
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
src/ModuleBase/ModuleBase_WidgetShapeSelector.h
src/PartSet/CMakeLists.txt
src/PartSet/PartSet_CustomPrs.cpp
src/PartSet/PartSet_OperationPrs.cpp
src/PartSet/PartSet_Validators.cpp
src/SketchPlugin/CMakeLists.txt
src/SketchPlugin/SketchPlugin_Validators.cpp

index 7f16f08144f74048798b6dd4a902d6fcf8d0be97..ef49c197d24bd69d48ae8108bb351b6c4509252e 100644 (file)
@@ -36,30 +36,4 @@ namespace GeomValidators_Tools {
     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;
-  }
-
 }
index 83a2c3f666b7d9681fb81078f7cc5a7e971f761e..3912db484c4dd4aa4616c65f785b81a9d4599b70 100644 (file)
@@ -20,10 +20,6 @@ namespace GeomValidators_Tools
   /// \param theObj an object 
   GEOMVALIDATORS_EXPORT ObjectPtr getObject(const AttributePtr& theAttribute);
 
-  // Returns the object from the attribute
-  /// \param theObj an object 
-  GEOMVALIDATORS_EXPORT TopAbs_ShapeEnum getCompoundSubType(const TopoDS_Shape& theShape);
-
 };
 
 #endif
index 3bd1fba4f2563e663d5d727db325e55cc0c45839..5d6e49ef8445a9f79443e531018ef05df852427c 100644 (file)
@@ -113,7 +113,6 @@ SET(PROJECT_LIBRARIES
        GeomAPI
        GeomDataAPI
        GeomAlgoAPI
-       GeomValidators
        ${QT_LIBRARIES}
        ${CAS_VIEWER}
        ${CAS_KERNEL}
@@ -141,7 +140,6 @@ INCLUDE_DIRECTORIES(
     ${CMAKE_SOURCE_DIR}/src/GeomDataAPI
     ${CMAKE_SOURCE_DIR}/src/GeomAPI
     ${CMAKE_SOURCE_DIR}/src/GeomAlgoAPI
-    ${CMAKE_SOURCE_DIR}/src/GeomValidators
     ${SUIT_INCLUDE}
 )
 
index d2009ac41fc63f31006a51439d9916eb51e71362..5d3643ab79a3b882a54a400c0a2f00b11c53dade 100755 (executable)
@@ -7,14 +7,18 @@
 #include "ModuleBase_Tools.h"
 #include <ModuleBase_ParamSpinBox.h>
 
-#include <ModelAPI_Result.h>
-#include <ModelAPI_Data.h>
 #include <ModelAPI_Attribute.h>
 #include <ModelAPI_AttributeRefAttr.h>
-#include <ModelAPI_ResultParameter.h>
+#include <ModelAPI_AttributeReference.h>
+#include <ModelAPI_AttributeSelection.h>
+#include <ModelAPI_Data.h>
+#include <ModelAPI_Result.h>
 #include <ModelAPI_ResultCompSolid.h>
+#include <ModelAPI_ResultParameter.h>
 #include <ModelAPI_Tools.h>
 
+#include <TopoDS_Iterator.hxx>
+
 #include <GeomDataAPI_Point2D.h>
 #include <Events_Error.h>
 
@@ -266,6 +270,54 @@ Quantity_Color color(const std::string& theSection,
   return Quantity_Color(aColor[0] / 255., aColor[1] / 255., aColor[2] / 255., Quantity_TOC_RGB);
 }
 
+ObjectPtr getObject(const AttributePtr& theAttribute)
+{
+  ObjectPtr anObject;
+  std::string anAttrType = theAttribute->attributeType();
+  if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) {
+    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);
+    if (anAttr != NULL)
+      anObject = anAttr->context();
+  }
+  if (anAttrType == ModelAPI_AttributeReference::typeId()) {
+    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;
 }
 
+} // namespace ModuleBase_Tools
+
 
index 600a5334f8852f5e34b3ecfe98e39821d0eed325..f78e9b7550a627306754dd9469fbf0aee16f67c5 100755 (executable)
@@ -10,7 +10,9 @@
 #include "ModuleBase.h"
 #include "ModuleBase_Definitions.h"
 
+#include <ModelAPI_Attribute.h>
 #include <ModelAPI_Feature.h>
+
 #include <TopAbs_ShapeEnum.hxx>
 #include <TopoDS_Shape.hxx>
 #include <Prs3d_Drawer.hxx>
@@ -120,6 +122,16 @@ MODULEBASE_EXPORT void setDefaultDeviationCoefficient(const TopoDS_Shape& theSha
 MODULEBASE_EXPORT Quantity_Color color(const std::string& theSection,
                                        const std::string& theName,
                                        const std::string& theDefault);
+
+
+// Returns the object from the attribute
+/// \param theObj an object
+MODULEBASE_EXPORT ObjectPtr getObject(const AttributePtr& theAttribute);
+
+// Returns the object from the attribute
+/// \param theObj an object
+MODULEBASE_EXPORT TopAbs_ShapeEnum getCompoundSubType(const TopoDS_Shape& theShape);
+
 }
 
 #endif
index d3a9b8a09d74e883d3b8f1c25d360e6f8be40fd1..d8df98aa3cb815bba77ee99f2ac008c45575a230 100755 (executable)
@@ -29,7 +29,6 @@ class QWidget;
 class QListWidget;
 class QComboBox;
 class ModuleBase_IWorkshop;
-class GeomValidators_ShapeType;
 class QAction;
 
 
index 130079870bb186c835a1970033a42e5fa9af9d9d..06163532001fea989b218fcffb4432e3ac8ba405 100755 (executable)
@@ -8,11 +8,10 @@
 
 #include <ModuleBase_ISelection.h>
 #include <ModuleBase_IWorkshop.h>
+#include <ModuleBase_Tools.h>
 
 #include <ModelAPI_ResultConstruction.h>
 
-#include <GeomValidators_Tools.h>
-
 #include <TopoDS_Iterator.hxx>
 
 ModuleBase_WidgetSelector::ModuleBase_WidgetSelector(QWidget* theParent,
@@ -90,7 +89,7 @@ bool ModuleBase_WidgetSelector::acceptSubShape(const GeomShapePtr& theShape,
     // for compounds check sub-shapes: it may be compound of needed type:
     // Booleans may produce compounds of Solids
     if (aShapeType == TopAbs_COMPOUND) {
-      aShapeType = GeomValidators_Tools::getCompoundSubType(aTopoShape);
+      aShapeType = ModuleBase_Tools::getCompoundSubType(aTopoShape);
     }
   }
 
index 1e60ec4049cb8c90ed12ac61673872be54419485..47fc4b44c12474b84c49673fab4988121f6ac93b 100644 (file)
@@ -18,7 +18,6 @@
 #include <Events_Message.h>
 #include <GeomAPI_Interface.h>
 #include <GeomAPI_Shape.h>
-#include <GeomValidators_Tools.h>
 
 #include <ModelAPI_AttributeReference.h>
 #include <ModelAPI_Data.h>
@@ -141,7 +140,7 @@ QList<ModuleBase_ViewerPrs> ModuleBase_WidgetShapeSelector::getAttributeSelectio
     DataPtr aData = myFeature->data();
     AttributePtr anAttribute = myFeature->attribute(attributeID());
 
-    ObjectPtr anObject = GeomValidators_Tools::getObject(anAttribute);
+    ObjectPtr anObject = ModuleBase_Tools::getObject(anAttribute);
     TopoDS_Shape aShape;
     std::shared_ptr<GeomAPI_Shape> aShapePtr = getShape();
     if (aShapePtr.get()) {
@@ -222,7 +221,7 @@ void ModuleBase_WidgetShapeSelector::updateSelectionName()
     isNameUpdated = true;
   }
   if (!isNameUpdated) {
-    ObjectPtr anObject = GeomValidators_Tools::getObject(myFeature->attribute(attributeID()));
+    ObjectPtr anObject = ModuleBase_Tools::getObject(myFeature->attribute(attributeID()));
     if (anObject.get() != NULL) {
       std::string aName = anObject->data()->name();
       myTextLine->setText(QString::fromStdString(aName));
@@ -252,7 +251,7 @@ void ModuleBase_WidgetShapeSelector::storeAttributeValue()
   DataPtr aData = myFeature->data();
   AttributePtr anAttribute = myFeature->attribute(attributeID());
 
-  myObject = GeomValidators_Tools::getObject(anAttribute);
+  myObject = ModuleBase_Tools::getObject(anAttribute);
   myShape = getShape();
   myRefAttribute = AttributePtr();
   myIsObject = false;
index 650d5b1e1848b617e314a13a33cf936c97da0eb5..2c8a10363e630fcade439ae6b895a0545e62459f 100644 (file)
@@ -27,7 +27,6 @@ class QLineEdit;
 class QToolButton;
 class ModuleBase_IWorkshop;
 class ModelAPI_Validator;
-class GeomValidators_ShapeType;
 
 /**
 * \ingroup GUI
index 39ff9186920ea91d0c50788169bd0f28dd1bf858..31ba5f79e3fb2b6c2f45b90e13dbd68b0fced9d6 100644 (file)
@@ -66,7 +66,6 @@ SET(PROJECT_LIBRARIES
     ModuleBase
     Config
     GeomAPI
-    GeomValidators
     GeomDataAPI
        SketcherPrs
     ${QT_LIBRARIES}
@@ -104,7 +103,6 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/XGUI
                     ${CMAKE_SOURCE_DIR}/src/FeaturesPlugin
                     ${CMAKE_SOURCE_DIR}/src/PartSetPlugin
                     ${CMAKE_SOURCE_DIR}/src/GeomAPI
-                    ${CMAKE_SOURCE_DIR}/src/GeomValidators
                     ${CMAKE_SOURCE_DIR}/src/AppElements
                     ${CAS_INCLUDE_DIRS}
                     ${SUIT_INCLUDE}
index ab7a858fb6b8f93ce4663815cfee12a14dd66ad1..ab96e5538938eebb6f9024a3ff652baf211002cd 100755 (executable)
@@ -15,8 +15,6 @@
 #include <ModuleBase_IWorkshop.h>
 #include <ModuleBase_IViewer.h>
 
-#include <GeomValidators_Tools.h>
-
 #include <Config_PropManager.h>
 
 #include <AIS_InteractiveContext.hxx>
index 58b5a53f50a2d1d93972b8bb9adc0cc63b19a013..9f52a502d035ba62e4f290737138cb6ee668b189 100755 (executable)
@@ -25,8 +25,6 @@
 #include <ModelAPI_Session.h>
 #include <ModelAPI_ResultCompSolid.h>
 
-#include <GeomValidators_Tools.h>
-
 #include <GeomAPI_IPresentable.h>
 
 #include <StdPrs_WFDeflectionShape.hxx>
index cc80fc8c894b7bc0385d186e06d8e3fd00faf0ea..a53eb3596cd4e314138db36954cac113726a9ca7 100755 (executable)
@@ -13,7 +13,6 @@
 #include <BRep_Tool.hxx>
 #include <GeomAdaptor_Curve.hxx>
 #include <GeomAbs_CurveType.hxx>
-#include <GeomValidators_Tools.h>
 #include <ModuleBase_ISelection.h>
 #include <ModuleBase_WidgetShapeSelector.h>
 #include <ModuleBase_OperationFeature.h>
index 508a7404906528307802a8a2607e85752352078c..2ef3a06b4e76bc02489d58bb1f68d325937a45af 100644 (file)
@@ -72,7 +72,6 @@ SET(PROJECT_LIBRARIES
     Config
     GeomAPI
     GeomAlgoAPI
-    GeomValidators
     ModelAPI
     SketcherPrs
     GeomDataAPI
@@ -93,7 +92,6 @@ INCLUDE_DIRECTORIES(
   ../GeomAPI
   ../GeomAlgoAPI
   ../GeomDataAPI
-  ../GeomValidators
   ../SketcherPrs
 )
 
index ee7121371bf94d53d0ac811250dfd9527adcd6a1..a432becdaa31f84efa7cf8f0a641362b45d96310 100755 (executable)
@@ -27,8 +27,6 @@
 #include <ModelAPI_AttributeString.h>
 #include <ModelAPI_Session.h>
 
-#include <GeomValidators_ShapeType.h>
-
 #include <GeomDataAPI_Point2D.h>
 
 
@@ -56,7 +54,7 @@ bool SketchPlugin_DistanceAttrValidator::isValid(const AttributePtr& theAttribut
     ObjectPtr anObject = aRefAttr->object();
 
     const ModelAPI_AttributeValidator* aShapeValidator = 
-      dynamic_cast<const GeomValidators_ShapeType*>(aFactory->validator("GeomValidators_ShapeType"));
+      dynamic_cast<const ModelAPI_AttributeValidator*>(aFactory->validator("GeomValidators_ShapeType"));
     std::list<std::string> anArguments;
     anArguments.push_back("circle");
     std::string aCircleError;