#include "PartSet_Tools.h"
#include "PartSet_PreviewPlanes.h"
#include "PartSet_WidgetPoint2d.h"
-#include "PartSet_WidgetPoint2dDistance.h"
#include "PartSet_WidgetPoint2DFlyout.h"
#include "PartSet_WidgetShapeSelector.h"
#include "PartSet_WidgetMultiSelector.h"
#include "PartSet_WidgetSubShapeSelector.h"
+#include "PartSet_WidgetFeaturePointSelector.h"
#include "PartSet_WidgetEditor.h"
#include "PartSet_WidgetFileSelector.h"
#include "PartSet_WidgetSketchCreator.h"
#include "PartSet_SketcherMgr.h"
-#include "PartSet_SketcherReetntrantMgr.h"
+#include "PartSet_SketcherReentrantMgr.h"
#include "PartSet_ResultSketchPrs.h"
#include "PartSet_MenuMgr.h"
#include "PartSet_CustomPrs.h"
#include <ModuleBase_IPropertyPanel.h>
#include <ModuleBase_WidgetEditor.h>
#include <ModuleBase_WidgetValidated.h>
-#include <ModuleBase_FilterFactory.h>
#include <ModuleBase_Tools.h>
#include <ModuleBase_OperationFeature.h>
#include <ModuleBase_WidgetFactory.h>
new PartSet_IconFactory();
mySketchMgr = new PartSet_SketcherMgr(this);
- mySketchReentrantMgr = new PartSet_SketcherReetntrantMgr(theWshop);
+ mySketchReentrantMgr = new PartSet_SketcherReentrantMgr(theWshop);
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(theWshop);
XGUI_Workshop* aWorkshop = aConnector->workshop();
Config_PropManager::registerProp("Visualization", "operation_highlight_color",
"Multi selector item color in operation", Config_Prop::Color,
PartSet_CustomPrs::OPERATION_HIGHLIGHT_COLOR());
+ Config_PropManager::registerProp("Visualization", "operation_remove_feature_color",
+ "Color of removed feature in operation", Config_Prop::Color,
+ PartSet_CustomPrs::OPERATION_REMOVE_FEATURE_COLOR());
}
PartSet_Module::~PartSet_Module()
aFactory->registerValidator("PartSet_ProjectionSelection", new PartSet_ProjectionSelection);
}
-void PartSet_Module::registerFilters()
-{
- //Registering of selection filters
- XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
- ModuleBase_FilterFactory* aFactory = aConnector->selectionFilters();
-}
-
-void PartSet_Module::registerProperties()
-{
- Config_PropManager::registerProp(SKETCH_TAB_NAME, "planes_size", "Size", Config_Prop::Double,
- PLANE_SIZE);
- Config_PropManager::registerProp(SKETCH_TAB_NAME, "planes_thickness", "Thickness",
- Config_Prop::Integer, SKETCH_WIDTH);
- Config_PropManager::registerProp(SKETCH_TAB_NAME, "rotate_to_plane",
- "Rotate to plane when selected", Config_Prop::Boolean, "false");
-}
-
void PartSet_Module::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget,
const bool isToConnect)
{
{
bool isEnabledFixed = false;
if (theActionId == XGUI_ActionsMgr::AcceptAll &&
- mySketchReentrantMgr->isInternalEditStarted())
+ mySketchReentrantMgr->isInternalEditActive())
isEnabledFixed = true;
return isEnabledFixed;
}
bool PartSet_Module::isSketchNeutralPointActivated() const
{
bool isNeutralPoint = true;
- if (sketchReentranceMgr()->isInternalEditStarted())
+ if (sketchReentranceMgr()->isInternalEditActive())
isNeutralPoint = false;
if (myIsOperationIsLaunched)
isNeutralPoint = false;
aPointWgt->setSketch(mySketchMgr->activeSketch());
connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), SLOT(onVertexSelected()));
aWgt = aPointWgt;
- } else if (theType == "point2ddistance") {
- PartSet_WidgetPoint2dDistance* aDistanceWgt = new PartSet_WidgetPoint2dDistance(theParent,
- aWorkshop, theWidgetApi);
- aDistanceWgt->setSketch(mySketchMgr->activeSketch());
- aWgt = aDistanceWgt;
} else if (theType == "sketch_shape_selector") {
PartSet_WidgetShapeSelector* aShapeSelectorWgt =
new PartSet_WidgetShapeSelector(theParent, aWorkshop, theWidgetApi);
aSubShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
aWgt = aSubShapeSelectorWgt;
}
+ else if (theType == "sketch_feature_point_selector") {
+ PartSet_WidgetFeaturePointSelector* aPointSelectorWgt =
+ new PartSet_WidgetFeaturePointSelector(theParent, aWorkshop, theWidgetApi);
+ aPointSelectorWgt->setSketcher(mySketchMgr->activeSketch());
+ aWgt = aPointSelectorWgt;
+ }
else if (theType == WDG_DOUBLEVALUE_EDITOR) {
aWgt = new PartSet_WidgetEditor(theParent, aWorkshop, theWidgetApi);
} else if (theType == "export_file_selector") {
return aCustomized;
if (!theResult.get()) {
- bool isConflicting = myOverconstraintListener->isConflictingObject(anObject);
- // customize sketch symbol presentation
- if (thePrs.get()) {
- Handle(AIS_InteractiveObject) anAISIO = thePrs->impl<Handle(AIS_InteractiveObject)>();
- if (!anAISIO.IsNull()) {
- if (!Handle(SketcherPrs_SymbolPrs)::DownCast(anAISIO).IsNull()) {
- Handle(SketcherPrs_SymbolPrs) aPrs = Handle(SketcherPrs_SymbolPrs)::DownCast(anAISIO);
- if (!aPrs.IsNull()) {
- std::vector<int> aColor;
- myOverconstraintListener->getConflictingColor(aColor);
- aPrs->SetConflictingConstraint(isConflicting, aColor);
- aCustomized = true;
- }
- } else if (!Handle(SketcherPrs_Coincident)::DownCast(anAISIO).IsNull()) {
- Handle(SketcherPrs_Coincident) aPrs = Handle(SketcherPrs_Coincident)::DownCast(anAISIO);
- if (!aPrs.IsNull()) {
- std::vector<int> aColor;
- myOverconstraintListener->getConflictingColor(aColor);
- aPrs->SetConflictingConstraint(isConflicting, aColor);
- aCustomized = true;
- }
- }
- }
- }
- // customize sketch dimension constraint presentation
- if (!aCustomized) {
- std::vector<int> aColor;
- if (isConflicting) {
- myOverconstraintListener->getConflictingColor(aColor);
- }
- if (aColor.empty())
- XGUI_CustomPrs::getDefaultColor(anObject, true, aColor);
- if (!aColor.empty()) {
- aCustomized = thePrs->setColor(aColor[0], aColor[1], aColor[2]);
- }
+ std::vector<int> aColor;
+ XGUI_CustomPrs::getDefaultColor(anObject, true, aColor);
+ if (!aColor.empty()) {
+ aCustomized = thePrs->setColor(aColor[0], aColor[1], aColor[2]);
}
}
// customize dimentional constrains
return aCustomized;
}
+bool PartSet_Module::afterCustomisePresentation(std::shared_ptr<ModelAPI_Result> theResult,
+ AISObjectPtr thePrs,
+ GeomCustomPrsPtr theCustomPrs)
+{
+ bool aCustomized = false;
+
+ XGUI_Workshop* aWorkshop = getWorkshop();
+ XGUI_Displayer* aDisplayer = aWorkshop->displayer();
+ ObjectPtr anObject = aDisplayer->getObject(thePrs);
+ if (!anObject)
+ return aCustomized;
+
+ std::vector<int> aColor;
+ bool aUseCustomColor = true;
+ if (aUseCustomColor)
+ myOverconstraintListener->getCustomColor(anObject, aColor);
+ // customize sketch symbol presentation
+ Handle(AIS_InteractiveObject) anAISIO = thePrs->impl<Handle(AIS_InteractiveObject)>();
+ if (!anAISIO.IsNull()) {
+ if (!Handle(SketcherPrs_SymbolPrs)::DownCast(anAISIO).IsNull()) {
+ Handle(SketcherPrs_SymbolPrs) aPrs = Handle(SketcherPrs_SymbolPrs)::DownCast(anAISIO);
+ if (!aPrs.IsNull()) {
+ aPrs->SetCustomColor(aColor);
+ aCustomized = true;
+ }
+ } else if (!Handle(SketcherPrs_Coincident)::DownCast(anAISIO).IsNull()) {
+ Handle(SketcherPrs_Coincident) aPrs = Handle(SketcherPrs_Coincident)::DownCast(anAISIO);
+ if (!aPrs.IsNull()) {
+ aPrs->SetCustomColor(aColor);
+ aCustomized = true;
+ }
+ }
+ }
+ // customize sketch dimension constraint presentation
+ if (!aCustomized) {
+ if (!aColor.empty()) { // otherwise presentation has the default color
+ aCustomized = thePrs->setColor(aColor[0], aColor[1], aColor[2]);
+ }
+ }
+ return aCustomized;
+}
+
bool PartSet_Module::customizeObject(ObjectPtr theObject, const ModuleBase_CustomizeFlag& theFlag,
const bool theUpdateViewer)
{
SessionPtr aMgr = ModelAPI_Session::get();
QAction* aActivatePartAction = myMenuMgr->action("ACTIVATE_PART_CMD");
+ bool hasResult = false;
+ bool hasFeature = false;
+ bool hasParameter = false;
+ bool hasCompositeOwner = false;
+ ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter,
+ hasCompositeOwner);
+
ModuleBase_Operation* aCurrentOp = myWorkshop->currentOperation();
if (aSelected == 1) {
- bool hasResult = false;
- bool hasFeature = false;
- bool hasParameter = false;
- bool hasCompositeOwner = false;
- ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter,
- hasCompositeOwner);
ObjectPtr aObject = aObjects.first();
if (aObject) {
ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
}
}
}
+ } else {
+ if (hasFeature) {
+ myMenuMgr->action("EDIT_CMD")->setEnabled(aCurrentOp == 0);
+ theMenu->addAction(myMenuMgr->action("EDIT_CMD"));
+ theMenu->addSeparator();
+ }
}
bool aNotDeactivate = (aCurrentOp == 0);
if (!aNotDeactivate) {