correction for wrong case in Extrusion operation.
New custom selection modes(Face, Wire) are implemented in Sketch presentation which is switched on by module when corresponded standard modes are mentioned in XML. It is switched on/off when the Property panel widget control is activated.
/// \param theObject a model object\r
virtual bool canActivateSelection(const ObjectPtr& theObject) const;\r
\r
- /// Returns true if the given selection mode can be activated for the given presentgation\r
- /// \param theIO an object presentation\r
- /// \param theMode selection mode\r
- virtual bool canActivateSelectionMode(const Handle(AIS_InteractiveObject)& theIO, int theMode) const { return true; }\r
-\r
- /// Returns true if the given selection mode must be deactivated for the given presentgation in any case\r
- /// \param theIO an object presentation\r
- /// \param theMode selection mode\r
- virtual bool needDeactivateSelectionMode(const Handle(AIS_InteractiveObject)& theIO, int theMode) const { return false; }\r
-\r
/// Reacts to the delete action in module\r
/// \returns true if the action is processed\r
virtual bool deleteObjects() { return false; };\r
/// \param theModes a list of modes\r
virtual void activeSelectionModes(QIntList& theModes) {}\r
\r
+ /// Appends specific selection modes for the module to the list of types\r
+ /// \param theTypes a selection modes to be extended\r
+ virtual void customSubShapesSelectionModes(QIntList& theTypes) {}\r
+\r
/// Activate custom presentation for the object. Default realization is empty.\r
/// \param theFeature a feature instance\r
/// \param theFlag a flag of level of customization, which means that only part of sub-elements\r
PartSet_SketcherMgr::sketchSelectionModes(theModes);
}
+void PartSet_Module::customSubShapesSelectionModes(QIntList& theTypes)
+{
+ if (theTypes.contains(TopAbs_FACE))
+ theTypes.append(SketcherPrs_Tools::Sel_Sketch_Face);
+ if (theTypes.contains(TopAbs_WIRE))
+ theTypes.append(SketcherPrs_Tools::Sel_Sketch_Wire);
+}
+
bool PartSet_Module::isMouseOverWindow()
{
return mySketchMgr->isMouseOverWindow();
myHasConstraintShown[PartSet_Tools::Dimensional] = true;
myHasConstraintShown[PartSet_Tools::Expressions] = false;
}
-
-//******************************************************
-bool PartSet_Module::canActivateSelectionMode(const Handle(AIS_InteractiveObject)& theIO, int theMode) const
-{
- /*if (theMode == TopAbs_FACE) {
- Handle(PartSet_ResultSketchPrs) aSketchPrs = Handle(PartSet_ResultSketchPrs)::DownCast(theIO);
- if (!aSketchPrs.IsNull()) {
- ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
- if (anOperation) {
- ModuleBase_IPropertyPanel* aPropPanel = anOperation->propertyPanel();
- if (aPropPanel) {
- ModuleBase_ModelWidget* aModelWgt = aPropPanel->activeWidget();
- ModuleBase_WidgetSelector* aWgtSelector = dynamic_cast<ModuleBase_WidgetSelector*>(aModelWgt);
- if (aWgtSelector) {
- return aWgtSelector->isFilterActivated();
- } else
- return true;
- } else
- return false;
- } else
- return false;
- }
- }*/
- return true;
-}
-
-//******************************************************
-bool PartSet_Module::needDeactivateSelectionMode(const Handle(AIS_InteractiveObject)& theIO, int theMode) const
-{
- if (theMode == TopAbs_FACE) {
- // Handle(PartSet_ResultSketchPrs) aSketchPrs = Handle(PartSet_ResultSketchPrs)::DownCast(theIO);
- // return !aSketchPrs.IsNull();
- }
- return false;
-}
/// \param theModes a list of modes
virtual void activeSelectionModes(QIntList& theModes);
+ /// Appends specific selection modes for the module to the list of types
+ /// \param theTypes a selection modes to be extended
+ virtual void customSubShapesSelectionModes(QIntList& theTypes);
+
/// Returns whether the mouse enter the viewer's window
/// \return true if items are added and there is no necessity to provide standard menu
bool isMouseOverWindow();
/// \return theAttribute
virtual AttributePtr findAttribute(const ObjectPtr& theObject, const GeomShapePtr& theGeomShape);
- /// Returns true if the given selection mode can be activated for the given presentgation
- /// \param theIO an object presentation
- /// \param theMode selection mode
- virtual bool canActivateSelectionMode(const Handle(AIS_InteractiveObject)& theIO, int theMode) const;
-
- /// Returns true if the given selection mode must be deactivated for the given presentgation in any case
- /// \param theIO an object presentation
- /// \param theMode selection mode
- virtual bool needDeactivateSelectionMode(const Handle(AIS_InteractiveObject)& theIO, int theMode) const;
-
public slots:
/// Redefines the parent method in order to customize the next case:
/// If the sketch nested operation is active and the presentation is not visualized in the viewer,
#include <SketchPlugin_SketchEntity.h>
+#include <SketcherPrs_Tools.h>
+
#include <Config_PropManager.h>
#include <BRep_Builder.hxx>
#endif
void PartSet_ResultSketchPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
- const Standard_Integer aMode)
+ const Standard_Integer theMode)
{
- if (aMode > 8)
+ int aMode = theMode;
+
+ if (aMode > 8 &&
+ aMode != SketcherPrs_Tools::Sel_Sketch_Face &&
+ aMode != SketcherPrs_Tools::Sel_Sketch_Wire)
// In order to avoid using custom selection modes
return;
bool aShapeIsChanged = false;
- if (aMode == AIS_Shape::SelectionMode(TopAbs_FACE) ||
- aMode == AIS_Shape::SelectionMode(TopAbs_WIRE)) {
+ if (aMode == SketcherPrs_Tools::Sel_Sketch_Face ||
+ aMode == SketcherPrs_Tools::Sel_Sketch_Wire) {
+ aMode = (aMode == SketcherPrs_Tools::Sel_Sketch_Face) ? AIS_Shape::SelectionMode(TopAbs_FACE)
+ : AIS_Shape::SelectionMode(TopAbs_WIRE);
#ifdef DEBUG_WIRE
const TopoDS_Shape& aShape = Shape();
debugInfo(aShape, TopAbs_VERTEX); // 24
/// Redefinition of virtual function
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
- const Standard_Integer aMode) ;
+ const Standard_Integer theMode) ;
private:
/// Appens sensitive and owners for wires of the given shape into selection
/// Selection mode for line of dimension
Sel_Dimension_Line,
- /// Selection mode foe text of dimension
- Sel_Dimension_Text
+ /// Selection mode for text of dimension
+ Sel_Dimension_Text,
+
+ /// Selectiom mode for faces selection on sketch
+ Sel_Sketch_Face,
+
+ /// Selectiom mode for wires selection on sketch
+ Sel_Sketch_Wire
};
/// Type of angle
if (!aContext.IsNull()) {
if (myWorkshop->module()) {
int aMode = (theMode > 8)? theMode : AIS_Shape::SelectionType(theMode);
- if (myWorkshop->module()->canActivateSelectionMode(theIO, aMode))
- aContext->Activate(theIO, theMode, false);
+ aContext->Activate(theIO, theMode, false);
} else
aContext->Activate(theIO, theMode, false);
for (; itr.More(); itr.Next() ) {
Standard_Integer aMode = itr.Value();
int aShapeMode = (aMode > 8)? aMode : AIS_Shape::SelectionType(aMode);
- if (!theModes.contains(aMode) || (myWorkshop->module()->needDeactivateSelectionMode(theIO, aShapeMode))) {
+ if (!theModes.contains(aMode)) {
deactivateAIS(theIO, aMode);
isDeactivated = true;
}
void XGUI_ModuleConnector::activateSubShapesSelection(const QIntList& theTypes)
{
+ QIntList aTypes = theTypes;
+
XGUI_Displayer* aDisp = myWorkshop->displayer();
- aDisp->activateObjects(theTypes, activeObjects(aDisp->displayedObjects()));
+ myWorkshop->module()->customSubShapesSelectionModes(aTypes);
+ aDisp->activateObjects(aTypes, activeObjects(aDisp->displayedObjects()));
}
void XGUI_ModuleConnector::deactivateSubShapesSelection()