DisplayStyleManager.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 #include "DgnPlatform.h"
11 #include "Bentley/RefCounted.h"
12 #include "ElementHandle.h"
13 
14 #include <Bentley/bvector.h>
15 #include <Bentley/WString.h>
16 
18 
19 
21 
40 
42 
45 
47 typedef bvector<DisplayStyleCP> DisplayStyleCPVector;
48 
49 
50 
51 //=======================================================================================
53 // @bsiclass Bentley Systems
54 //=======================================================================================
56  {
58  NotRemapped,
61 
62  }; // DisplayStyleImportStatus
63 
64 /*=================================================================================**/
73  {
74  View = 0,
75  ClipVolume = 1
76 
77  }; // DisplayStyleBuiltInUsage
78 
79 //=======================================================================================
81 // @bsiclass Bentley Systems
82 //=======================================================================================
84  {
85  CanBeApplied,
89 
90  }; // DisplayStyleApplyValidity
91 
92 //=======================================================================================
94 // @bsiclass Bentley Systems
95 //=======================================================================================
97  {
98  File,
100 
101  }; // DisplayStyleSource
102 
103 /*=================================================================================**/
111  {
114 
115  }; // SpecialDisplayStyleIndex
116 
117 /*=================================================================================**/
122  {
123  Color = 0,
124  Luxology = 1,
125  };
126 
127 
128 //=======================================================================================
132 // @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
133 // @bsiclass Bentley Systems
134 //=======================================================================================
136  {
137  public: unsigned m_displayMode :6;
138  public: unsigned m_displayVisibleEdges :1;
139  public: unsigned m_displayHiddenEdges :1;
140  public: unsigned m_hiddenEdgeLineStyle :3;
141  public: unsigned m_displayShadows :1;
142  public: unsigned m_legacyDrawOrder :1;
143  public: unsigned m_overrideBackgroundColor :1;
144  public: unsigned m_applyEdgeStyleToLines :1;
145  public: unsigned m_ignoreGeometryMaps :1;
146  public: unsigned m_ignoreImageMaps :1;
147  public: unsigned m_hideInPickers :1;
148  public: unsigned m_invisibleToCamera :1;
149  public: unsigned m_displayGroundPlane :1;
150 
151  unsigned m_unused :12;
152 
155 
157  public: DGNPLATFORM_EXPORT bool Equals (DisplayStyleFlagsCR rhs) const;
158 
159  inline void SetDisplayMode (MSRenderMode value) {m_displayMode = static_cast<UInt32>(value);}
160 
161  }; // DisplayStyleFlags
162 
163 /*=================================================================================**/
177  {
178 
180  {
181  public: unsigned m_visibleEdgeColor :1;
182  public: unsigned m_visibleEdgeWeight :1;
183  public: unsigned m_useTransparency :1;
184  public: unsigned m_elementColor :1;
185  public: unsigned m_lineStyle :1;
186  public: unsigned m_lineWeight :1;
187  public: unsigned m_material :1;
188  public: unsigned m_visibleEdgeStyle :1;
189  public: unsigned m_hiddenEdgeStyle :1;
190  public: unsigned m_hiddenEdgeWeightZero:1;
191  public: unsigned m_hLineTransparency :1;
192  public: unsigned m_hLineMaterialColors :1;
193  public: unsigned m_smoothIgnoreLights :1;
194  public: unsigned m_useDisplayHandler :1;
195  public: unsigned m_unused :18;
196  };
197 
202  public: double m_transparency;
204  public: UInt32 m_lineStyle;
208 
210 
211  enum
212  {
213  HiddenEdgeWeight_SameAsVisible = 0xffff
214  };
215 
216 public:
219 
222  DGNPLATFORM_EXPORT void SetDisplayStyleHandlerP (struct DisplayStyleHandler const* handler);
223 
226  DGNPLATFORM_EXPORT void SetDisplayStyleHandlerSettingsPtr (RefCountedPtr<struct DisplayStyleHandlerSettings> settings);
227 
228  /*---------------------------------------------------------------------------------**/
232  DGNPLATFORM_EXPORT void ResolveDisplayStyleHandler () const;
233 
236  DGNPLATFORM_EXPORT void SetDisplayStyleHandlerById (XAttributeHandlerId id);
237 
240  DGNPLATFORM_EXPORT DisplayStyleHandler const* GetDisplayStyleHandlerCP() const;
241 
244  DGNPLATFORM_EXPORT XAttributeHandlerId GetDisplayStyleHandlerId () const;
245 
248  DGNPLATFORM_EXPORT DisplayStyleHandlerSettingsPtr GetDisplayStyleHandlerSettingsPtr () const;
249 
250  /*---------------------------------------------------------------------------------**/
257  public: DGNPLATFORM_EXPORT ViewDisplayOverrides Clone (DgnFileR sourceDgnFile, DgnFileR destinationDgnFile) const;
258 
259  /*---------------------------------------------------------------------------------**/
267  public: DGNPLATFORM_EXPORT bool Equals (ViewDisplayOverridesCR rhs) const;
268 
269  /*---------------------------------------------------------------------------------**/
279  public: DGNPLATFORM_EXPORT bool Equals (ViewDisplayOverridesCR rhs, DgnFileR sourceDgnFile, DgnFileR rhsDgnFile) const;
280 
281  /*---------------------------------------------------------------------------------**/
287  public: DGNPLATFORM_EXPORT bool AreFlagsEqual (ViewDisplayOverridesCR rhs) const;
288 
289  /*---------------------------------------------------------------------------------**/
297  public: DGNPLATFORM_EXPORT void ExtractMaterialPaletteAndName (WStringR paletteName, WStringR materialName, DgnFileR dgnFile) const;
298 
299 
300  /*---------------------------------------------------------------------------------**/
304  public: bool HiddenEdgeWeightSameAsVisible () const { return HiddenEdgeWeight_SameAsVisible == m_hiddenEdgeWeight; }
305  }; // ViewDisplayOverrides
306 
307 /*=================================================================================**/
312  {
313  friend struct DisplayStyle;
314 
315 private:
317  RgbFactor m_color;
319  double m_height; // stored in meters
321  double m_transparency;
323  bool m_showGroundFromBelow;
324 
325 public:
327 
330  DGNPLATFORM_EXPORT void Clone (DisplayStyleGroundPlane const& rhs);
331 
335  DGNPLATFORM_EXPORT bool Equals (DisplayStyleGroundPlane const& rhs) const;
336 
339  DGNPLATFORM_EXPORT RgbFactor const& GetGroundColor () const;
340 
343  DGNPLATFORM_EXPORT void SetGroundColor (RgbFactor const& color);
344 
347  DGNPLATFORM_EXPORT double GetHeight () const;
348 
351  DGNPLATFORM_EXPORT void SetHeight (double height);
352 
355  DGNPLATFORM_EXPORT double GetTransparency () const;
356 
359  DGNPLATFORM_EXPORT void SetTransparency (double transparency);
360 
363  DGNPLATFORM_EXPORT bool ShowGroundFromBelow () const;
364 
367  DGNPLATFORM_EXPORT void SetShowGroundFromBelow (bool showGroundFromBelow);
368 
369  };
370 
375 
376 //=======================================================================================
383 // @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
384 // @bsiclass Bentley Systems
385 //=======================================================================================
387  {
388 private:
389  virtual void MakeClassAbstract() = 0;
390 public:
391 
396  public: DGNPLATFORM_EXPORT static DisplayStylePtr Create (DgnFileR dgnFile, WCharCP name);
397 
401  public: DGNPLATFORM_EXPORT DisplayStylePtr Clone () const;
402 
407  public: DGNPLATFORM_EXPORT DisplayStylePtr Clone (DgnFileR destinationDgnFile) const;
408 
414  public: DGNPLATFORM_EXPORT DisplayStylePtr Clone (DgnFileR destinationDgnFile, WCharCP newName) const;
415 
420  public: DGNPLATFORM_EXPORT bool Equals (DisplayStyleCR rhs) const;
421 
427  public: DGNPLATFORM_EXPORT bool Equals (DisplayStyleCR rhs, bool testSettingsOnly) const;
428 
431  public: DGNPLATFORM_EXPORT DgnFileR GetFileR () const;
432 
436  public: DGNPLATFORM_EXPORT bool IsInFile (DgnFileR dgnFile) const;
437 
441  public: DGNPLATFORM_EXPORT int GetIndex () const;
442 
446  public: DGNPLATFORM_EXPORT WStringCR GetName () const;
447 
450  public: DGNPLATFORM_EXPORT MSRenderMode GetDisplayMode () const;
451 
455  public: DGNPLATFORM_EXPORT void SetDisplayMode (MSRenderMode newDisplayMode);
456 
459  public: DGNPLATFORM_EXPORT bool IsFromFile () const;
460 
463  public: DGNPLATFORM_EXPORT bool IsFromHardCodedDefault () const;
464 
467  public: DGNPLATFORM_EXPORT DisplayStyleFlagsCR GetFlags () const;
468 
471  public: DGNPLATFORM_EXPORT DisplayStyleFlagsR GetFlagsR ();
472 
475  public: DGNPLATFORM_EXPORT void SetFlags (DisplayStyleFlagsCR newFlags);
476 
479  public: DGNPLATFORM_EXPORT ViewDisplayOverridesCR GetOverrides () const;
480 
483  public: DGNPLATFORM_EXPORT ViewDisplayOverridesR GetOverridesR ();
484 
489  public: DGNPLATFORM_EXPORT void SetOverrides (ViewDisplayOverridesCR newOverrides, DgnFileR sourceDgnFile);
490 
495  public: MSCORE_EXPORT WString GetIconName () const;
496 
499  public: DGNPLATFORM_EXPORT bool IsUsableForViews () const;
500 
503  public: DGNPLATFORM_EXPORT void SetIsUsableForViews (bool isValid);
504 
507  public: DGNPLATFORM_EXPORT bool IsUsableForClipVolumes () const;
508 
511  public: DGNPLATFORM_EXPORT void SetIsUsableForClipVolumes (bool isValid);
512 
515  public: DGNPLATFORM_EXPORT bool MatchesViewInfoData (ViewInfoCR viewInfo) const;
516 
520  public: DGNPLATFORM_EXPORT bool IsValidForViewport (ViewportCR viewport) const;
521 
526  public: DGNPLATFORM_EXPORT bool IsValidForViewport (ViewportCR viewport, DisplayStyleApplyValidity* applyValidity) const;
527 
533  public: DGNPLATFORM_EXPORT void CopySettingsTo (ViewInfoR viewInfo, DgnFileR destinationDgnFile) const;
534 
536  public: DGNPLATFORM_EXPORT WStringCR GetEnvironmentName () const;
537 
540  public: DGNPLATFORM_EXPORT void SetEnvironmentName (WCharCP environmentName);
541 
543  public: DGNPLATFORM_EXPORT EnvironmentDisplay GetEnvironmentTypeDisplayed () const;
544 
547  public: DGNPLATFORM_EXPORT void SetEnvironmentTypeDisplayed (EnvironmentDisplay typeDisplayed);
548 
550  public: DGNPLATFORM_EXPORT DisplayStyleGroundPlaneCR GetGroundPlane () const;
551 
553  public: DGNPLATFORM_EXPORT DisplayStyleGroundPlaneP GetGroundPlaneP ();
554 
556  //\ param[in] the object of DgnFileR
557  public: DGNPLATFORM_EXPORT StatusInt EnsureDisplayStyleHandler (DgnFileR) const;
558 
559  }; // DisplayStyle
560 
561 //=======================================================================================
562 // When creating a list of display styles, some styles may not be provided due to their options or configuration. These flags allow you to customize which styles are provided.
563 // @bsiclass Bentley Systems
564 //=======================================================================================
566  {
568 
571 
572  }; // DisplayStyleListOptions
573 
574 //=======================================================================================
579 // @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
580 // @bsiclass Bentley Systems
581 //=======================================================================================
583  {
584 
590  public: MSCORE_EXPORT static DisplayStyleList CreateFullList (DisplayStyleListOptions);
591 
596  public: MSCORE_EXPORT static DisplayStyleList CreateFullList (DgnFileR dgnFile, DisplayStyleListOptions);
597 
600  public: DGNPLATFORM_EXPORT static DisplayStyleList CreateForFile (DgnFileR dgnFile, DisplayStyleListOptions);
601 
606  public: MSCORE_EXPORT static DisplayStyleList CreateForDgnLibs (DisplayStyleListOptions);
607 
611  public: DGNPLATFORM_EXPORT bool ContainsDisplayStyle (WCharCP styleName) const;
612 
616  public: DGNPLATFORM_EXPORT DisplayStyleCP FindDisplayStyleByName (WCharCP styleName) const;
617 
618  }; // DisplayStyleList
619 
620 
621 //=======================================================================================
625 // @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
626 // @bsiclass Bentley Systems
627 //=======================================================================================
629  {
630 private:
631  virtual void MakeClassAbstract() = 0;
632 public:
633 
638  public: DGNPLATFORM_EXPORT static DisplayStyleCP GetDisplayStyleForViewInfo (ViewInfoCR viewInfo);
639 
644  public: DGNPLATFORM_EXPORT static DisplayStyleCP GetDisplayStyleByIndex (DisplayStyleList::size_type index, DgnFileR dgnFile);
645 
652  public: MSCORE_EXPORT static DisplayStyleCP FindDisplayStyleByName (WCharCP styleName, DgnFileP dgnFile);
653 
660  public: MSCORE_EXPORT static int GetIndexForDisplayStyle (WCharCP styleName, DgnFileP dgnFile);
661 
667  public: DGNPLATFORM_EXPORT static DisplayStyleCP EnsureDisplayStyleIsInFile (DisplayStyleCR displayStyle, DgnFileR destinationDgnFile);
668 
673  public: DGNPLATFORM_EXPORT static DisplayStyleCP WriteDisplayStyleToFile (DisplayStyleCR displayStyle, DgnFileR destinationDgnFile);
674 
683  public: DGNPLATFORM_EXPORT static DisplayStyleCP CopyDisplayStyleToFile (WCharCP styleName, DgnFileR sourceDgnFile, DgnFileR destinationDgnFile);
684 
689  public: DGNPLATFORM_EXPORT static void RemoveDisplayStyleFromFile (WCharCP styleName, DgnFileR dgnFile);
690 
696  public: DGNPLATFORM_EXPORT static void RenameDisplayStyleInFile (WCharCP originalName, WCharCP newName, DgnFileR dgnFile);
697 
703  public: MSCORE_EXPORT static bool DoesDisplayStyleExistInDgnLibs (WCharCP styleName);
704 
709  public: DGNPLATFORM_EXPORT static bool DoesDisplayStyleExistInFile (WCharCP styleName, DgnFileR dgnFile);
710 
718  public: DGNPLATFORM_EXPORT static DisplayStyleImportStatus ImportDisplayStyle (DgnFileR sourceDgnFile, DgnFileR destinationDgnFile, int sourceIndex, int& destinationIndex);
719 
723  public: DGNPLATFORM_EXPORT static BentleyStatus ApplyDisplayStyleToView (DisplayStyleCR, ViewInfoR);
724 
725  }; //DisplayStyleManager
726 
728 
730 
Display style can be applied to the view.
DisplayStyleGroundPlane const * DisplayStyleGroundPlaneCP
Definition: DisplayStyleManager.h:372
DisplayStyleGroundPlane * DisplayStyleGroundPlaneP
Definition: DisplayStyleManager.h:371
UInt32 m_lineWeight
Override element line weight.
Definition: DisplayStyleManager.h:205
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
struct DgnPlatform::DisplayStyleFlags const & DisplayStyleFlagsCR
Definition: DgnPlatform.h:242
double m_transparency
Override element transparency (0..1 inclusive)
Definition: DisplayStyleManager.h:202
The "default" set of display styles; this is optimized for showing pickers.
Definition: DisplayStyleManager.h:569
struct DgnPlatform::DisplayStyle const & DisplayStyleCR
Definition: DgnPlatform.h:241
struct DgnPlatform::Viewport const & ViewportCR
Definition: DgnPlatform.h:480
UInt32 m_visibleEdgeColor
Override edge color (not just visible anymore – must defer name change at this time) ...
Definition: DisplayStyleManager.h:199
Provides utilities for getting collections of display styles from various sources.
Definition: DisplayStyleManager.h:582
DisplayStyleBuiltInUsage
Lists the possible intended usages of a display style.
Definition: DisplayStyleManager.h:72
struct Bentley::WString const & WStringCR
Definition: Bentley.h:239
Could not find a display style in the source file with the provided index.
Display style has shadows enabled, and view is a sheet.
This sub-structure describes the 'flags' part of a DisplayStyle.
Definition: DisplayStyleManager.h:135
EnvironmentDisplay
When display environment is checked descibes what type of environment is displayed.
Definition: DisplayStyleManager.h:121
Includes all display styles.
Definition: DisplayStyleManager.h:570
struct DgnPlatform::DisplayStyle const * DisplayStyleCP
Definition: DgnPlatform.h:241
The source display style was copied into the destination with no overlap */.
UInt32 m_hiddenEdgeWeight
override hidden edge weight (0xffff == same as visible).
Definition: DisplayStyleManager.h:201
UInt32 m_visibleEdgeWeight
Override visible edge weight.
Definition: DisplayStyleManager.h:200
Occurs if source and destination file are the same, or an unexpected error occured.
#define DGNPLATFORM_EXPORT
Definition: DgnPlatform/ExportMacros.h:58
A DgnFile is an in-memory representation of a physical file, regardless of its format.
Definition: DgnFile.h:308
wchar_t const * WCharCP
Definition: Bentley.h:224
MSRenderMode
Definition: DgnPlatform.r.h:401
Display style's display mode is non-wireframe, and view is a sheet.
uint32_t UInt32
Definition: Bentley.r.h:128
Definition: DisplayStyleManager.h:311
The display style is meant to be used for sections of clip volumes.
Red, green, blue color data as doubles.
Definition: GeomApi.r.h:85
A two-part ID used by XAttribute Handlers.
Definition: DgnCore.h:74
UInt32 m_elementColor
Override element color.
Definition: DisplayStyleManager.h:203
struct DgnPlatform::ViewInfo const & ViewInfoCR
Definition: DgnPlatform.h:478
A display style by the same name existed in the destination file, and the existing style was updated ...
This sub-structure describes the 'overrides' part of a display style.
Definition: DisplayStyleManager.h:176
#define CLRPUBLIC
Definition: DgnPlatform/ExportMacros.h:12
BentleyStatus
Definition: Bentley.h:208
DisplayStyleApplyValidity
Describes if a display style can be applied to a view, and if not, why.
Definition: DisplayStyleManager.h:83
double m_hLineTransparencyThreshold
Definition: DisplayStyleManager.h:209
A shared pointer template for reference-counted objects.
Definition: RefCounted.h:119
For references, specifies to use the parent's display style.
Definition: DisplayStyleManager.h:113
SpecialDisplayStyleIndex
Lists the (fake) indices of special display styles.
Definition: DisplayStyleManager.h:110
#define BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:68
void SetDisplayMode(MSRenderMode value)
Definition: DisplayStyleManager.h:159
int StatusInt
Definition: Bentley.h:222
Concrete class that can be used to implement the reference-counting pattern.
Definition: RefCounted.h:109
UInt64 ElementId
Definition: DgnPlatformBaseType.r.h:83
Specifies no display style should be used (note that 0 is the first valid display style) ...
Definition: DisplayStyleManager.h:112
bvector< DisplayStyleCP > DisplayStyleCPVector
A collection of DisplayStyleCP.
Definition: DisplayStyleManager.h:47
OverrideFlags m_flags
Definition: DisplayStyleManager.h:198
bool HiddenEdgeWeightSameAsVisible() const
Return true if hidden edge weight should be same as visible.
Definition: DisplayStyleManager.h:304
A display style is a collection of view-related settings that can be applied to the whole or part of ...
Definition: DisplayStyleManager.h:386
Include display styles that should not be shown in pickers.
Definition: DisplayStyleManager.h:567
struct DgnPlatform::ViewDisplayOverrides const & ViewDisplayOverridesCR
Definition: DgnPlatform.h:470
DisplayStyleGroundPlane & DisplayStyleGroundPlaneR
Definition: DisplayStyleManager.h:373
UInt32 m_backgroundColor
Override view background color.
Definition: DisplayStyleManager.h:207
DisplayStyleGroundPlane const & DisplayStyleGroundPlaneCR
Definition: DisplayStyleManager.h:374
DisplayStyleImportStatus
Describes the outcome of importing a display style from one file to another.
Definition: DisplayStyleManager.h:55
This is what the parameters to the camera methods, and the values stored by ViewInfo mean...
Definition: ViewInfo.h:213
DisplayStyleListOptions
Definition: DisplayStyleManager.h:565
Provides static methods for reading, writing, and modifying display styles in files.
Definition: DisplayStyleManager.h:628
#define ENUM_UNDERLYING_TYPE(T)
Definition: Bentley.h:70
DisplayStyleSource
Describes where the display style came from.
Definition: DisplayStyleManager.h:96
A string class that has many of the same capabilities as std::string, plus additional functions such ...
Definition: WString.h:51
UInt32 m_lineStyle
Override element line style.
Definition: DisplayStyleManager.h:204
RefCountedPtr< DisplayStyle > DisplayStylePtr
Smart pointer wrapper for DisplayStyle.
Definition: DisplayStyleManager.h:44
ElementId m_material
Override element material.
Definition: DisplayStyleManager.h:206

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