AccuSnap.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
13 #include <DgnPlatform/Locate.h>
14 #include <DgnView/IViewManager.h>
15 
16 DGNPLATFORM_TYPEDEFS (AccuSnap)
17 DGNPLATFORM_TYPEDEFS (TentativePoint)
18 
20 
21 //=======================================================================================
22 // @bsiclass Bentley Systems
23 //=======================================================================================
25  {
26  ACCUSNAP_ENABLE_OffByDefault = 0, // off unless modifier key is pressed
27  ACCUSNAP_ENABLE_OnByDefault = 1, // on unless modifier key is pressed
28  ACCUSNAP_ENABLE_Never = 2, // AccuSnap is never enabled.
29  };
30 
31 /*=================================================================================**/
36 {
39  {
40  ACCUSNAPHANDLER_PRIORITY_Highest = 1000,
41  ACCUSNAPHANDLER_PRIORITY_High = 750,
42  ACCUSNAPHANDLER_PRIORITY_Normal = 500,
43  ACCUSNAPHANDLER_PRIORITY_Low = 250,
44  ACCUSNAPHANDLER_PRIORITY_Lowest = 0,
45  };
46 
48  {
49  Ok=0,
50  DontShow=1
51  };
52 
53 protected:
54 
56 virtual int _GetHandlerPriority () {return ACCUSNAPHANDLER_PRIORITY_Normal;}
57 
63 virtual AsnapStatus _ShowElemInfoPopup (DPoint3dCP pt, ViewportP vp, WCharCP string) = 0;
64 
66 virtual void _RemoveElemInfoPopup () = 0;
67 
73 virtual AsnapStatus _FlashHitInView (ViewportP vp, HitPathCP path) = 0;
74 
76 virtual void _UnFlashView (ViewportP) = 0;
77 
78 };
79 
80 /*=================================================================================**/
85 {
86 private:
87  virtual void MakeClassAbstract() = 0;
88 public:
89 public:
90 
92  DGNVIEW_EXPORT bool IsActive () const;
93 
95  DGNVIEW_EXPORT bool IsSnapped () const;
96 
98  DGNVIEW_EXPORT SnapPathP GetCurrSnap () const;
99 
101  DGNVIEW_EXPORT DPoint3dCP GetPoint ();
102 
104  DGNVIEW_EXPORT void Clear (bool erase);
105 
107  DGNVIEW_EXPORT static TentativePoint& GetInstance ();
108 
109 }; // TentativePoint
110 
111 /*=================================================================================**/
115 struct AccuSnap
116 {
117 private:
118  virtual void MakeClassAbstract() = 0;
119 public:
120 public:
121 
125  DGNVIEW_EXPORT bool IsActive (DgnButtonEventCR ev);
126 
128  DGNVIEW_EXPORT bool IsHot ();
129 
131  DGNVIEW_EXPORT bool UserWantsSnaps ();
132 
134  DGNVIEW_EXPORT bool UserWantsLocates ();
135 
138  DGNVIEW_EXPORT void EnableSnap (bool yesNo);
139 
142  DGNVIEW_EXPORT void EnableLocate (bool yesNo);
143 
145  DGNVIEW_EXPORT bool IsSnapEnabled ();
146 
148  DGNVIEW_EXPORT bool IsLocateEnabled ();
149 
151  DGNVIEW_EXPORT void SetComponentMode (ComponentMode newMode);
152 
154  DGNVIEW_EXPORT HitPathP CurrHit ();
155 
158  DGNVIEW_EXPORT SnapPathP GetCurrSnapPath ();
159 
161  DGNVIEW_EXPORT void Clear ();
162 
165  DGNVIEW_EXPORT void Suspend (bool doSuspend);
166 
169  DGNVIEW_EXPORT SnapStatus ResetButton ();
170 
173  DGNVIEW_EXPORT static void AddEventHandler (AccuSnapHandler* accuSnapHandler);
174 
178  DGNVIEW_EXPORT static void DropEventHandler (AccuSnapHandler* accuSnapHandler);
179 
181  DGNVIEW_EXPORT static AccuSnap& GetInstance ();
182 
183 }; // AccuSnap
184 
struct DgnPlatform::SnapPath * SnapPathP
Definition: DgnPlatform.h:451
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
struct DPoint3d const * DPoint3dCP
Definition: msgeomstructs_typedefs.h:79
Definition: HitPath.h:87
ComponentMode
Definition: Locate.h:16
AsnapStatus
Definition: AccuSnap.h:47
Definition: AccuSnap.h:84
Definition: AccuSnap.h:115
AccuSnapEnableFlag
Definition: AccuSnap.h:24
An Event Handler for responding to significant events during AccuSnap processing. ...
Definition: AccuSnap.h:35
wchar_t const * WCharCP
Definition: Bentley.h:224
iterator erase(iterator __it)
Definition: stdcxx/bstdmap.h:242
AccuSnapEventHandlerPriority
Priority values to control relative order of processing between AccuSnapHandlers. ...
Definition: AccuSnap.h:38
struct DgnPlatform::DgnButtonEvent const & DgnButtonEventCR
Definition: DgnPlatform.h:191
#define CLRPUBLIC
Definition: DgnPlatform/ExportMacros.h:12
struct DgnPlatform::HitPath const * HitPathCP
Definition: DgnPlatform.h:274
#define DGNPLATFORM_TYPEDEFS(_name_)
Definition: DgnPlatform.h:73
#define BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:68
virtual int _GetHandlerPriority()
Return a priority to control relative order of this handler versus others.
Definition: AccuSnap.h:56
SnapStatus
Definition: DgnPlatform.h:1148
Definition: DgnViewport.h:186

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.