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;
- }
-
}
/// \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
GeomAPI
GeomDataAPI
GeomAlgoAPI
- GeomValidators
${QT_LIBRARIES}
${CAS_VIEWER}
${CAS_KERNEL}
${CMAKE_SOURCE_DIR}/src/GeomDataAPI
${CMAKE_SOURCE_DIR}/src/GeomAPI
${CMAKE_SOURCE_DIR}/src/GeomAlgoAPI
- ${CMAKE_SOURCE_DIR}/src/GeomValidators
${SUIT_INCLUDE}
)
#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>
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
+
#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>
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
class QListWidget;
class QComboBox;
class ModuleBase_IWorkshop;
-class GeomValidators_ShapeType;
class QAction;
#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,
// 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);
}
}
#include <Events_Message.h>
#include <GeomAPI_Interface.h>
#include <GeomAPI_Shape.h>
-#include <GeomValidators_Tools.h>
#include <ModelAPI_AttributeReference.h>
#include <ModelAPI_Data.h>
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()) {
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));
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;
class QToolButton;
class ModuleBase_IWorkshop;
class ModelAPI_Validator;
-class GeomValidators_ShapeType;
/**
* \ingroup GUI
ModuleBase
Config
GeomAPI
- GeomValidators
GeomDataAPI
SketcherPrs
${QT_LIBRARIES}
${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}
#include <ModuleBase_IWorkshop.h>
#include <ModuleBase_IViewer.h>
-#include <GeomValidators_Tools.h>
-
#include <Config_PropManager.h>
#include <AIS_InteractiveContext.hxx>
#include <ModelAPI_Session.h>
#include <ModelAPI_ResultCompSolid.h>
-#include <GeomValidators_Tools.h>
-
#include <GeomAPI_IPresentable.h>
#include <StdPrs_WFDeflectionShape.hxx>
#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>
Config
GeomAPI
GeomAlgoAPI
- GeomValidators
ModelAPI
SketcherPrs
GeomDataAPI
../GeomAPI
../GeomAlgoAPI
../GeomDataAPI
- ../GeomValidators
../SketcherPrs
)
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_Session.h>
-#include <GeomValidators_ShapeType.h>
-
#include <GeomDataAPI_Point2D.h>
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;