#include <ModuleBase_IWorkshop.h>
#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_ResultConstruction.h>
#include <XGUI_Tools.h>
#include <XGUI_Displayer.h>
QObjectPtrList aDisplayed = aDisp->displayedObjects();
foreach (ObjectPtr anObj, aDisplayed) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
- if (aResult.get() != NULL) {
- aBodyIsVisualized = aResult->groupName() == ModelAPI_ResultBody::group();
- if (aBodyIsVisualized)
- break;
+ // result constructions should not be taken as a body
+ if (aResult.get() != NULL && aResult->groupName() == ModelAPI_ResultBody::group()) {
+ GeomShapePtr aShape = aResult->shape();
+ if (aShape.get()) {
+ // vertices, edges should not be taken as a body
+ aBodyIsVisualized = aShape->shapeType() <= GeomAPI_Shape::FACE;
+ if (aBodyIsVisualized)
+ break;
+ }
}
}
return aBodyIsVisualized;
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
if (aResult.get() != NULL) {
FeaturePtr aFeature = ModelAPI_Feature::feature(aResult);
- aSketchIsVisualized = aFeature.get() && aFeature->getKind() == SketchPlugin_Sketch::ID();
- if (aSketchIsVisualized)
- break;
+ if (aFeature.get() && aFeature->getKind() == SketchPlugin_Sketch::ID()) {
+ ResultConstructionPtr aCResult = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>
+ (aResult);
+ if (aCResult.get() && aCResult->facesNum() > 0) {
+ aSketchIsVisualized = true;
+ break;
+ }
+ }
+ break;
}
}
return aSketchIsVisualized;
}
+bool PartSet_PreviewPlanes::isPreviewShape(std::shared_ptr<GeomAPI_Shape> theShape)
+{
+ return (myYZPlane->getShape()->isEqual(theShape) ||
+ myXZPlane->getShape()->isEqual(theShape) ||
+ myXYPlane->getShape()->isEqual(theShape));
+}
+
void PartSet_PreviewPlanes::erasePreviewPlanes(ModuleBase_IWorkshop* theWorkshop)
{
if (myPreviewDisplayed) {
myPreviewDisplayed = true;
}
-AISObjectPtr PartSet_PreviewPlanes::createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin,
- std::shared_ptr<GeomAPI_Dir> theNorm,
+AISObjectPtr PartSet_PreviewPlanes::createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin,
+ std::shared_ptr<GeomAPI_Dir> theNorm,
const int theRGB[3])
{
- double aSize = Config_PropManager::integer("Sketch planes", "planes_size", PLANE_SIZE);
- std::shared_ptr<GeomAPI_Shape> aFace = GeomAlgoAPI_FaceBuilder::square(theOrigin, theNorm, aSize);
+ double aSize = Config_PropManager::integer(SKETCH_TAB_NAME, "planes_size", PLANE_SIZE);
+ std::shared_ptr<GeomAPI_Shape> aFace =
+ GeomAlgoAPI_FaceBuilder::squareFace(theOrigin, theNorm, aSize);
AISObjectPtr aAIS = AISObjectPtr(new GeomAPI_AISObject());
aAIS->createShape(aFace);
- aAIS->setWidth(Config_PropManager::integer("Sketch planes", "planes_thickness", SKETCH_WIDTH));
+ aAIS->setWidth(Config_PropManager::integer(SKETCH_TAB_NAME, "planes_thickness", SKETCH_WIDTH));
aAIS->setColor(theRGB[0], theRGB[1], theRGB[2]);
return aAIS;
}