20 #ifndef PartSet_SketcherMgr_H
21 #define PartSet_SketcherMgr_H
25 #include "PartSet_PreviewSketchPlane.h"
26 #include "PartSet_Tools.h"
28 #include <ModelAPI_Feature.h>
29 #include <ModelAPI_Attribute.h>
30 #include <ModelAPI_CompositeFeature.h>
31 #include <ModelAPI_Result.h>
32 #include <Events_Listener.h>
33 #include <ModuleBase_SelectionFilterType.h>
35 #include <ModuleBase_Definitions.h>
36 #include <ModuleBase_ModelWidget.h>
38 #include <GeomAPI_Pln.h>
39 #include <GeomAPI_AISObject.h>
42 #include <OCCViewer_ViewModel.h>
44 #include <AppElements_Viewer.h>
48 #include <SelectMgr_IndexedMapOfOwner.hxx>
49 #include <SelectMgr_ListOfFilter.hxx>
51 #include <TopoDS_Shape.hxx>
52 #include <TopTools_MapOfShape.hxx>
53 #include <AIS_Shape.hxx>
85 mySketchMgr(theSketchMgr) {}
91 virtual void fitAll(Handle(V3d_View) theView);
115 myIsInitialized =
false;
125 myIsInitialized =
false;
129 void setValue(
const double theX,
const double theY)
131 myIsInitialized =
true;
136 bool myIsInitialized;
137 double myCurX, myCurY;
146 std::set<ResultPtr> myResults;
150 typedef QMap<FeaturePtr, SelectionInfo> FeatureToSelectionMap;
174 bool isNestedSketchFeature(
const QString& theFeatureKind)
const;
181 const CompositeFeaturePtr& )
const;
187 const CompositeFeaturePtr& )
const;
192 static bool isEntity(
const std::string& theId);
197 static bool isExternalFeature(
const FeaturePtr& theFeature);
207 static bool isDistanceKind(std::string& theKind);
240 bool sketchSelectionFilter(
const ModuleBase_SelectionFilterType theFilterType);
245 void registerSelectionFilter(
const ModuleBase_SelectionFilterType theFilterType,
251 bool operationActivatedByPreselection();
255 bool canUndo()
const;
259 bool canRedo()
const;
268 bool canEraseObject(
const ObjectPtr& theObject)
const;
274 bool canDisplayObject(
const ObjectPtr& theObject)
const;
282 bool canDisplayConstraint(
const FeaturePtr& theObject,
284 bool& isProcessed)
const;
293 bool canDisplayCurrentCreatedFeature()
const;
300 const QMap<PartSet_Tools::ConstraintVisibleState, bool>& showConstraintStates();
305 bool isObjectOfSketch(
const ObjectPtr& theObject)
const;
311 ST_SelectAndHighlightType
319 void storeSelection(
const SelectionType theType, FeatureToSelectionMap& theCurrentSelection);
323 void restoreSelection(FeatureToSelectionMap& theCurrentSelection);
327 bool sketchSolverError();
334 QString getFeatureError(
const FeaturePtr& theFeature);
337 void clearClickedFlags();
340 static const QStringList& replicationsIdList();
343 static const QStringList& constraintsIdList();
348 static void sketchSelectionModes(
const CompositeFeaturePtr& theSketch, QIntList& theModes);
362 void widgetStateChanged(
int thePreviousState);
369 void customizeSketchPresentation(
const ObjectPtr& theObject,
const AISObjectPtr& thePrs)
const;
377 bool isShowFreePointsShown()
const {
378 return myPointsHighlight.size() > 0;
386 virtual void processEvent(
const std::shared_ptr<Events_Message>& theMessage);
389 bool isDragModeCreation()
const;
396 void onPlaneSelected(
const std::shared_ptr<GeomAPI_Pln>& thePln);
400 void onShowPoints(
bool toShow);
403 void onUpdateConstraintsList();
404 void onDeactivate(
bool isNeedDeactivate, std::vector<FeaturePtr> theFeatures);
408 void onShowConstraintsToggle(
int theType,
bool theState);
411 void onEnterViewPort();
414 void onLeaveViewPort();
425 void onApplicationStarted();
428 void onBeforeContextMenu();
429 void onAfterContextMenu();
433 void launchEditing();
439 Point& thePoint,
bool theSnap =
true);
446 bool& theCanCommitOperation);
460 static void getSelectionOwners(
const FeaturePtr& theFeature,
461 const FeaturePtr& theSketch,
463 const FeatureToSelectionMap& theSelection,
464 SelectMgr_IndexedMapOfOwner& theOwnersToSelect);
468 bool isVisibleCreatedFeature()
const;
482 void visualizeFeature(
const FeaturePtr& theFeature,
const bool isEditOperation,
483 const bool isToDisplay,
const bool isFlushRedisplay =
true);
489 void updateSelectionPriority(ObjectPtr theObject, FeaturePtr theFeature);
495 std::vector<int> colorOfObject(
const ObjectPtr& theObject,
496 const FeaturePtr& aFeature,
bool isConstruction,
bool isSuppressedConstraint)
const;
504 bool myPreviousDrawModeEnabled;
505 bool myIsEditLaunching;
508 bool myIsMouseOverWindow;
510 bool myIsMouseOverViewProcessed;
511 bool myIsPopupMenuActive;
512 Point myCurrentPoint;
515 CompositeFeaturePtr myCurrentSketch;
517 std::set<ModuleBase_SelectionFilterType> mySelectionFilterTypes;
519 FeatureToSelectionMap myCurrentSelection;
520 bool myPreviousUpdateViewerEnabled;
522 QMap<PartSet_Tools::ConstraintVisibleState, bool> myIsConstraintsShown;
526 QMap<ResultPtr, Handle(AIS_Shape)> myPointsHighlight;
Base interface for any event listener.
Definition: Events_Listener.h:37
virtual EVENTS_EXPORT void processEvent(const std::shared_ptr< Events_Message > &theMessage)=0
This method is called by loop when the event is started to process.
Interface to ViewWindow object which contains 3d scene.
Definition: ModuleBase_IViewWindow.h:34
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
Base class for all operations.
Definition: ModuleBase_Operation.h:53
A class to manage display of presentations of center points of circular edges outside of a current sk...
Definition: PartSet_ExternalPointsMgr.h:46
Definition: PartSet_SketcherMgr.h:82
virtual void fitAll(HandlettheView)
A method which has top be reimplemented to provide alterantive implementation FitAll command.
Definition: PartSet_SketcherMgr.cpp:2538
Implementation of Partset module.
Definition: PartSet_Module.h:69
Visualization of 2D-bluebrint' accessories: translucent rectangular substrate, basis axes,...
Definition: PartSet_PreviewSketchPlane.h:51
A class for management of sketch operations At the time of the sketcher operation active,...
Definition: PartSet_SketcherMgr.h:107
SelectionType
Enumeration for selection mode used.
Definition: PartSet_SketcherMgr.h:308
@ ST_SelectType
Only highlighted objects.
Definition: PartSet_SketcherMgr.h:310
CompositeFeaturePtr activeSketch() const
Returns current Sketch feature/ Returns NULL if there is no launched sketch operation.
Definition: PartSet_SketcherMgr.h:213
bool isMouseOverWindow()
Returns true if a mouse cursor is over viewer window.
Definition: PartSet_SketcherMgr.h:210
PartSet_PreviewSketchPlane * previewSketchPlane() const
Returns help class to visualize sketcher plane.
Definition: PartSet_SketcherMgr.h:217
Displayer.
Definition: XGUI_Displayer.h:172
Operation manager.
Definition: XGUI_OperationMgr.h:49
Object browser window object.
Definition: XGUI_SketchConstraintsBrowser.h:92
Class which defines a configuration of the application (Workshop) and launches it.
Definition: XGUI_Workshop.h:83
Struct to define selection model information to store/restore selection.
Definition: PartSet_SketcherMgr.h:143
TopoDS_Shape myFirstResultShape
the selected results
Definition: PartSet_SketcherMgr.h:147
std::map< AttributePtr, int > myAttributes
the selected attributes and indices of points if array
Definition: PartSet_SketcherMgr.h:145
TopTools_MapOfShape myLocalSelectedShapes
the first shape of feature result
Definition: PartSet_SketcherMgr.h:148