Handler.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 
10 // Class has virtual function, but destructor is not virtual
11 #pragma warning (disable:4265)
12 
13 #include "DgnPlatform.h"
14 #include "DgnCore.h"
15 
16 DGNPLATFORM_TYPEDEFS (ISubTypeHandlerQuery)
18 
20 
21 //=======================================================================================
23 // @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
24 // @bsiclass Bentley Systems
25 //=======================================================================================
27 {
28 private:
29  Transform m_trans;
30  UInt32 m_options;
31  AnnotationScaleAction m_annotationScaleAction;
32 
33  bool m_haveMirrorPlane;
34  RotMatrix m_mirrorPlane;
35  double m_annotationScale;
36 
37 public:
39  DGNPLATFORM_EXPORT TransformInfo ();
40 
42  DGNPLATFORM_EXPORT explicit TransformInfo (TransformCR t);
43 
45  TransformCP GetTransform () const {return &m_trans;}
46 
48  TransformR GetTransformR () {return m_trans;}
49 
51  RotMatrixCP GetMirrorPlane () const {return m_haveMirrorPlane ? &m_mirrorPlane : NULL;}
52 
54  void SetMirrorPlane (RotMatrixCR mirrorPlane) {m_mirrorPlane = mirrorPlane, m_haveMirrorPlane = true;}
55 
57  void SetOptions (UInt32 options) {m_options = options;}
58 
60  UInt32 GetOptions () const {return m_options;}
61 
63  void SetAnnotationScaleAction (AnnotationScaleAction action) {m_annotationScaleAction = action;}
64 
66  AnnotationScaleAction GetAnnotationScaleAction () const {return m_annotationScaleAction;}
67 
69  void SetAnnotationScale (double annotationScale) {m_annotationScale = annotationScale;}
70 
72  double GetAnnotationScale () const {return m_annotationScale;}
73 };
74 
75 //=======================================================================================
77 // @bsiclass Bentley Systems
78 //=======================================================================================
80 {
81  Query = 200,
82  Edit = 300,
83 };
84 
85 
86 #define ELEMENTHANDLER_DECLARE_MEMBERS(__classname__,__exporter__) \
87  public: __exporter__ static __classname__& GetInstance();
88 
89 #ifndef DOCUMENTATION_GENERATOR
90 #define ELEMENTHANDLER_EXTENSION_DECLARE_MEMBERS(__classname__,__exporter__) \
91  private: __exporter__ static Token& z_Get##__classname__##Token();\
92  public: static Bentley::BentleyStatus RegisterExtension (HandlerR handler, __classname__& obj) {return obj.RegisterExt(handler,z_Get##__classname__##Token());}\
93  static Bentley::BentleyStatus DropExtension (HandlerR handler) {return DropExt(handler,z_Get##__classname__##Token());}\
94  static __classname__* Cast (HandlerR handler) {return (__classname__*) CastExt (handler,z_Get##__classname__##Token());}
95 #endif
96 
97 #define ELEMENTHANDLER_EXTENSION_DEFINE_MEMBERS(__classname__) \
98  Handler::Extension::Token& __classname__::z_Get##__classname__##Token(){static Handler::Extension::Token* s_token=0; if (0==s_token) s_token = NewToken(); return *s_token;}
99 
100 /*=================================================================================**//*+===============+===============+===============+===============+===============+======*/
126 
128 
129 struct ITransactionHandler;
130 struct IDependencyHandler;
131 struct IGeoCoordinateReprojectionHelper;
132 struct IEnumerateAvailableHandlers;
133 
134 
135 
136 /*=================================================================================**/
140 {
141  Selection = 0, // Can be part of selection set
142  CellGroup = 1, // Can be added to orphan cell group
143  CellUnGroup = 2, // Can be un-grouped...i.e. is orphan cell group
144  TransientManipulators = 3, // Can support manipulators with transient elements
145  CacheCutGraphics = 4, // Should cache cut graphics (only called if notRenderable) Shared cell instances need to cache their own cuts.
146  LineStyle = 5, // Element type supports line styles
147  CustomHilite = 6, // Element handler wants to control it's hilited presentation, DrawContext won't setup override symbology.
148 };
149 
150 /*=================================================================================**/
160 {
161 public:
162 
163  /*=================================================================================**/
222  struct Extension
223  {
224  friend class Handler;
225  struct Token
226  {
227  friend struct Extension;
228  private: Token () {}
229  };
230 
231  //@cond DONTINCLUDEINDOC
232  protected:
233  BentleyStatus RegisterExt (Handler& handler, Token& extensionToken) {return handler.AddExtension(extensionToken, *this);}
234  static BentleyStatus DropExt (Handler& handler, Token& extensionToken) {return handler.DropExtension(extensionToken);}
235  static Extension* CastExt (Handler& handler, Token& extensionToken) {return handler.FindExtension(extensionToken);}
236  static Token* NewToken () {return new Token();}
237  //@endcond DONTINCLUDEINDOC
238  };
239 
240 private:
241  DGNPLATFORM_EXPORT BentleyStatus AddExtension (Extension::Token&, Extension&);
242  DGNPLATFORM_EXPORT BentleyStatus DropExtension (Extension::Token&);
243  DGNPLATFORM_EXPORT Extension* FindExtension (Extension::Token&);
244 
245  struct ExtensionEntry;
246 
247  Handler* m_superClass;
248  ExtensionEntry* m_extensions;
249 private:
250  virtual void MakeClassAbstract() = 0;
251 public:
252 public:
253 
254 //@cond DONTINCLUDEINDOC
255 static Handler& z_GetHandlerInstance ();
256 DGNPLATFORM_EXPORT static Handler& GetInstance () {return z_GetHandlerInstance();}
257 //@endcond DONTINCLUDEINDOC
258 
260 
261 
264 DGNPLATFORM_EXPORT DisplayHandlerP GetDisplayHandler ();
265 
268 DGNPLATFORM_EXPORT ITransactionHandlerP GetITransactionHandler ();
269 
272 DGNPLATFORM_EXPORT IDependencyHandlerP GetIDependencyHandler ();
273 
275 
277 
278 
295 DGNPLATFORM_EXPORT StatusInt ApplyTransform (EditElementHandleR element, TransformInfoCR transform);
296 
297 
329 
352 
358 
363 DGNPLATFORM_EXPORT void ConvertTo3d (EditElementHandleR eeh, double elevation);
364 
371 DGNPLATFORM_EXPORT void ConvertTo2d (EditElementHandleR eeh, TransformCR flattenTrans, DVec3dCR flattenDir);
372 
374 
386 DGNPLATFORM_EXPORT void GetDescription (ElementHandleCR el, WStringR string, UInt32 desiredLength);
387 
395 DGNPLATFORM_EXPORT void GetTypeName (WStringR string, UInt32 desiredLength);
396 
397 
399 
400 
409 DGNPLATFORM_EXPORT void QueryProperties (ElementHandleCR eh, PropertyContextR context);
410 
421 DGNPLATFORM_EXPORT void EditProperties (EditElementHandleR eeh, PropertyContextR context);
422 
424 
426 
435 DGNPLATFORM_EXPORT bool ExposeChildren (ElementHandleCR el, ExposeChildrenReason reason);
436 
437 
439 }; // Handler
440 
441 
443 
445 
446 
struct RotMatrix const * RotMatrixCP
Definition: msgeomstructs_typedefs.h:135
FenceStretchFlags
Influences how handler should apply fence stretch.
Definition: DgnPlatform.h:1417
3x3 matrix commonly used for pure rotations, but in general may also have scales and non-perpendicula...
Definition: rotmatrix.h:21
struct DgnPlatform::IDependencyHandler * IDependencyHandlerP
Definition: DgnPlatform.h:286
A transformation matrix. Identifies a few special cases.
Definition: Handler.h:26
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
double GetAnnotationScale() const
Get annotation scale.
Definition: Handler.h:72
struct DgnPlatform::FenceParams * FenceParamsP
Definition: DgnPlatform.h:267
Default reason for ChildElemIter.
ExposeChildrenReason
The reasons an application can ask a handler for an iterator to look at its "public" children...
Definition: Handler.h:79
FenceClipFlags
Influences how handler should apply fence clip.
Definition: DgnPlatform.h:1429
#define DGNPLATFORM_CLASS_TYPEDEFS(_name_)
Definition: DgnPlatform.h:83
void SetAnnotationScale(double annotationScale)
Set annotation scale.
Definition: Handler.h:69
struct RotMatrix const & RotMatrixCR
Definition: msgeomstructs_typedefs.h:135
#define DGNPLATFORM_EXPORT
Definition: DgnPlatform/ExportMacros.h:58
uint32_t UInt32
Definition: Bentley.r.h:128
struct Bentley::WString & WStringR
Definition: Bentley.h:239
#define NULL
Definition: Bentley.h:157
struct DgnPlatform::ITransactionHandler * ITransactionHandlerP
Definition: DgnPlatform.h:341
struct DgnPlatform::TransformInfo const & TransformInfoCR
Definition: DgnPlatform.h:464
TransformCP GetTransform() const
Get pointer to the transformation matrix.
Definition: Handler.h:45
struct DgnPlatform::EditElementHandle & EditElementHandleR
Definition: DgnPlatform.h:254
BentleyStatus
Definition: Bentley.h:208
struct Transform const * TransformCP
Definition: msgeomstructs_typedefs.h:134
AnnotationScaleAction GetAnnotationScaleAction() const
Get annotation scale action.
Definition: Handler.h:66
AnnotationScaleAction
Influences how handler should apply annotation scale.
Definition: DgnPlatform.h:1406
#define DGNPLATFORM_TYPEDEFS(_name_)
Definition: DgnPlatform.h:73
Base class to make a class non-copyable.
Definition: NonCopyableClass.h:23
SupportOperation
Definition: Handler.h:139
struct DgnPlatform::DisplayHandler * DisplayHandlerP
Definition: DgnPlatform.h:235
void SetAnnotationScaleAction(AnnotationScaleAction action)
Set annotation scale action.
Definition: Handler.h:63
#define BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:68
RotMatrixCP GetMirrorPlane() const
If this is a mirroring transform, get the plane across which the element is to be mirrored...
Definition: Handler.h:51
struct DgnPlatform::ElementAgenda * ElementAgendaP
Definition: DgnPlatform.h:258
struct Transform const & TransformCR
Definition: msgeomstructs_typedefs.h:134
int StatusInt
Definition: Bentley.h:222
3x4 matrix for defining coordinate frames and affine transformations.
Definition: transform.h:22
struct DgnPlatform::PropertyContext & PropertyContextR
Definition: DgnPlatform.h:421
void SetOptions(UInt32 options)
Set element-specific transform options.
Definition: Handler.h:57
Handler defines the standard queries and operations available on all elements, whether graphical or n...
Definition: Handler.h:159
A Handler::Extension can be used to add additional interfaces to a Handler at runtime.
Definition: Handler.h:222
struct DgnPlatform::ElementHandle const & ElementHandleCR
Definition: DgnPlatform.h:260
#define EXPORT_VTABLE_ATTRIBUTE
Definition: Bentley.h:67
struct DVec3d const & DVec3dCR
Definition: msgeomstructs_typedefs.h:89
UInt32 GetOptions() const
Check element-specific transform options.
Definition: Handler.h:60
TransformR GetTransformR()
Get a reference to the transformation matrix.
Definition: Handler.h:48
void SetMirrorPlane(RotMatrixCR mirrorPlane)
If this is a mirroring transform, set the plane across which the element is to be mirrored...
Definition: Handler.h:54

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