// the abort leads to selection lost on constraint objects. It can be corrected after #386 issue
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
XGUI_Workshop* aWorkshop = aConnector->workshop();
- ModuleBase_ISelection* aSel = aConnector->selection();
+ ModuleBase_ISelection* aSel = workshop()->selection();
QObjectPtrList aSelectedObj = aSel->selectedPresentations();
// if there are no selected objects in the viewer, that means that the selection in another
// place cased this method. It is necessary to return the false value to understande in above
/// \param isChecked if true, the feature is a construction
void setAuxiliary(const bool isChecked);
-
+ /// Returns state of constraints showing flag
bool isConstraintsShown() const { return myIsConstraintsShown; }
#include <GeomAPI_XYZ.h>
#include <SketchPlugin_Sketch.h>
+#include <SketcherPrs_Tools.h>
#include <Precision.hxx>
#include <gp_Pln.hxx>
// Get default selection modes
QIntList aModes;
- aModes.append(AIS_DSM_Text);
- aModes.append(AIS_DSM_Line);
+ aModes.append(SketcherPrs_Tools::Sel_Dimension_Text);
+ aModes.append(SketcherPrs_Tools::Sel_Dimension_Line);
+ aModes.append(SketcherPrs_Tools::Sel_Constraint);
aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_VERTEX));
aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_EDGE));
void SketcherPrs_Coincident::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer aMode)
{
- Handle(SelectMgr_EntityOwner) aOwn = new SelectMgr_EntityOwner(this, 10);
- Handle(Select3D_SensitivePoint) aSp = new Select3D_SensitivePoint(aOwn, myPoint);
- aSelection->Add(aSp);
+ if ((aMode == 0) || (aMode == SketcherPrs_Tools::Sel_Constraint)) {
+ Handle(SelectMgr_EntityOwner) aOwn = new SelectMgr_EntityOwner(this, 10);
+ Handle(Select3D_SensitivePoint) aSp = new Select3D_SensitivePoint(aOwn, myPoint);
+ aSelection->Add(aSp);
+ }
}
void SketcherPrs_Coincident::SetColor(const Quantity_NameOfColor aCol)
}
return false;
}
+
+
+
+void SketcherPrs_LengthDimension::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
+ const Standard_Integer theMode)
+{
+ Standard_Integer aMode;
+ switch (theMode) {
+ case SketcherPrs_Tools::Sel_Dimension_All:
+ aMode = 0;
+ break;
+ case SketcherPrs_Tools::Sel_Dimension_Line:
+ aMode = 1;
+ break;
+ case SketcherPrs_Tools::Sel_Dimension_Text:
+ aMode = 2;
+ break;
+ default:
+ aMode = theMode;
+ }
+ AIS_LengthDimension::ComputeSelection(aSelection, aMode);
+}
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
+ /// Redefinition of virtual function
+ Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
+ const Standard_Integer aMode);
+
private:
bool getPoints(gp_Pnt& thePnt1, gp_Pnt& thePnt2) const;
AIS_RadiusDimension::Compute(thePresentationManager, thePresentation, theMode);
}
+
+void SketcherPrs_Radius::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
+ const Standard_Integer theMode)
+{
+ Standard_Integer aMode;
+ switch (theMode) {
+ case SketcherPrs_Tools::Sel_Dimension_All:
+ aMode = 0;
+ break;
+ case SketcherPrs_Tools::Sel_Dimension_Line:
+ aMode = 1;
+ break;
+ case SketcherPrs_Tools::Sel_Dimension_Text:
+ aMode = 2;
+ break;
+ default:
+ aMode = theMode;
+ }
+ AIS_RadiusDimension::ComputeSelection(aSelection, aMode);
+}
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
+ /// Redefinition of virtual function
+ Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
+ const Standard_Integer aMode);
+
private:
/// Constraint feature
ModelAPI_Feature* myConstraint;
void SketcherPrs_SymbolPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer aMode)
{
- ClearSelected();
- for (int i = 1; i <= mySPoints.Length(); i++)
- aSelection->Add(mySPoints.Value(i));
+ //ClearSelected();
+ if ((aMode == 0) || (aMode == SketcherPrs_Tools::Sel_Constraint)) {
+ for (int i = 1; i <= mySPoints.Length(); i++)
+ aSelection->Add(mySPoints.Value(i));
+ }
}
namespace SketcherPrs_Tools {
+/// Enumeration with modes for activation of selection custom presentations
+enum SelectionModes {
+ /// Start of enumeration
+ Sel_Mode_First = 100,
+
+ /// Selection mode for all constraints exclude dimensions
+ Sel_Constraint,
+
+ /// Selection mode for whole dimension
+ Sel_Dimension_All,
+
+ /// Selection mode for line of dimension
+ Sel_Dimension_Line,
+
+ /// Selection mode foe text of dimension
+ Sel_Dimension_Text
+};
+
SKETCHERPRS_EXPORT ObjectPtr getResult(ModelAPI_Feature* theFeature,
- const std::string& theAttrName);
+ const std::string& theAttrName);
SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Shape> getShape(ObjectPtr theObject);
// Convert shape types to selection types
QIntList aModes;
foreach(int aType, theTypes) {
- aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)aType));
+ if (aType > TopAbs_SHAPE)
+ aModes.append(aType);
+ else
+ aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)aType));
}
aDisp->activateObjects(aModes);
//TODO: We have to open Local context because at neutral point filters don't work (bug 25340)