DgnModelRef.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 "DgnFileIO/BentleyDgn.h"
12 
13 DGNPLATFORM_TYPEDEFS (DgnAttachmentArray)
14 DGNPLATFORM_TYPEDEFS (ReachableModelRefOptions)
15 DGNPLATFORM_TYPEDEFS (ReachableElementOptions)
16 DGNPLATFORM_TYPEDEFS (ReachableModelRefCollection)
17 DGNPLATFORM_TYPEDEFS (ReachableElementCollection)
18 DGNPLATFORM_TYPEDEFS (ModelRefRangeTree)
19 
21 
22 struct ReachableModelRefCollection;
24 
27 
29 enum class DgnModelRefType
30 {
31  Root = 1,
32  PrimaryRef = 2,
33  Proxy = 4,
34  NonModel = 7,
35  Transient = 8,
36 };
37 
38 //=======================================================================================
42 //=======================================================================================
44 {
45 private:
46  virtual void MakeClassAbstract() = 0;
47 public:
48 public:
49  typedef bvector<DgnAttachmentP>::const_iterator const_iterator;
53  DGNPLATFORM_EXPORT size_t size () const;
54  DGNPLATFORM_EXPORT DgnAttachmentP at (size_t) const;
55 };
56 
57 //=======================================================================================
59 //=======================================================================================
60 struct UpdateSequenceList : bvector<ElementId>
61  {
62  };
63 
64 //=======================================================================================
66 //=======================================================================================
67 struct DgnModelRefList : bvector<DgnModelRefP>
68  {
69  DgnModelRefP FindByModelId (ModelId);
70  void ToDocumentList (DgnDocumentListR list);
71  bool IsFound (DgnModelRefP modelRef) const {return std::find (begin(), end(), modelRef) != end();}
72  };
73 
74 //=======================================================================================
82 //=======================================================================================
84 {
85 private:
86  DgnAttachmentP m_ref;
87 public:
97  DGNPLATFORM_EXPORT DgnAttachmentP operator->() const;
102  DGNPLATFORM_EXPORT DgnAttachmentR AddToParent();
105 };
106 
107 //=======================================================================================
110 //=======================================================================================
112  {
114  bool m_topLevelModel;
116  bool m_loadUndisplayed;
124  LimitRefLoading m_limitLoading;
126  int m_maxDepth;
128 
134  DGNPLATFORM_EXPORT DgnAttachmentLoadOptions (bool loadCaches=true, bool loadUndisplayed=false, bool loadRasterRefs=true);
135 
138  void SetLoadUndisplayed (bool val) {m_loadUndisplayed = val;}
140  void SetOneLevelOnly (bool val) {m_oneLevelDeep = val;}
142  void SetRedundancyCheck (bool val) {m_redundancyCheck = val;}
144  void SetApplyOverrides (bool val) {m_applyOverrides = val;}
148  void SetSectionsToFill (DgnModelSections val) {m_sectionsToFill = val;}
150  void SetMaxDepth (int maxDepth) {m_maxDepth = maxDepth;}
152  void SetShowProgressMeter (bool val) {m_showProgressMeter = val;}
154  void SetLimitRefLoading (LimitRefLoading val) {m_limitLoading = val;}
156  };
157 
158 
159 //=======================================================================================
171 //=======================================================================================
173 {
174 private:
175  virtual void MakeClassAbstract() = 0;
176 public:
177 public:
198  DGNPLATFORM_EXPORT StatusInt CreateDgnAttachment (DgnAttachmentP& attachment, DgnDocumentMonikerR moniker, WCharCP modelName, bool loadCache = true);
199 
204 
205  DGNPLATFORM_EXPORT StatusInt DeleteDgnAttachment (DgnAttachmentP& attachment);
206 
222  DGNPLATFORM_EXPORT DgnAttachmentArrayP GetDgnAttachmentsP () const;
223 
238  DGNPLATFORM_EXPORT DgnAttachmentArrayCP GetDgnAttachmentsCP () const;
239 
257 
274 
280  DGNPLATFORM_EXPORT DgnAttachmentP FindDgnAttachmentByElementId (ElementId attachmentID);
281 
287  DGNPLATFORM_EXPORT StatusInt ReadAndLoadDgnAttachments (DgnAttachmentLoadOptions const&);
288 
291  DGNPLATFORM_EXPORT DgnModelRefP GetParentModelRefP () const;
292 
296  DGNPLATFORM_EXPORT DgnModelP GetDgnModelP () const;
297 
300  DGNPLATFORM_EXPORT DgnFileP GetDgnFileP () const;
301 
304  DGNPLATFORM_EXPORT ModelInfoCP GetModelInfoCP () const;
305 
307  DGNPLATFORM_EXPORT bool IsDgnAttachment () const;
308 
311  DGNPLATFORM_EXPORT bool IsDirectDgnAttachment() const;
312 
315  DGNPLATFORM_EXPORT bool IsNestedDgnAttachment() const;
316 
319  DGNPLATFORM_EXPORT bool IsDwgStyleAttachment() const;
320 
322  DGNPLATFORM_EXPORT bool IsDefault () const;
323 
325  DGNPLATFORM_EXPORT DgnModelRefType GetModelRefType () const;
326 
331  DGNPLATFORM_EXPORT DgnModelCP AsDgnModelCP () const;
332 
335  DgnModelP AsDgnModelP() {return const_cast<DgnModelP>(AsDgnModelCP());}
336 
339  DGNPLATFORM_EXPORT DgnAttachmentCP AsDgnAttachmentCP () const;
340 
343  DgnAttachmentP AsDgnAttachmentP () {return const_cast<DgnAttachmentP>(AsDgnAttachmentCP());}
344 
347  DGNPLATFORM_EXPORT LevelCacheR GetLevelCacheR ();
348 
351  DGNPLATFORM_EXPORT LevelCacheCR GetLevelCache () const;
352 
356  DGNPLATFORM_EXPORT FileLevelCacheP GetFileLevelCacheP ();
357 
361  DGNPLATFORM_EXPORT FileLevelCacheCP GetFileLevelCacheCP () const;
362 
364  DGNPLATFORM_EXPORT bool Is3d () const;
365 
367  DGNPLATFORM_EXPORT bool TreatAs3d () const;
368 
370  DGNPLATFORM_EXPORT DgnFileP GetSymbologySourceDgnFileP() const;
371 
372 };
373 
375 
iterator find(const key_type &__x)
Definition: stdcxx/bstdmap.h:269
void SetApplyOverrides(bool val)
If true, process the override flags for nested attachments that permit display, locate, and snapping to be modified. The default to apply overrides.
Definition: DgnModelRef.h:144
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
void SetShowProgressMeter(bool val)
Specify if a progress meter should be displayed to the user..
Definition: DgnModelRef.h:152
bool m_oneLevelDeep
Read or Load the direct attachments only. If false,.
Definition: DgnModelRef.h:119
DgnModelSections m_sectionsToFill
What sections of the referenced model to fill, if any.
Definition: DgnModelRef.h:123
*//* Bentley Systems
Definition: DgnModelRef.h:60
DgnAttachmentCP GetDgnAttachmentCP()
Returns a const pointer to the DgnAttachment being defined.
Definition: DgnModelRef.h:99
iterator begin()
Definition: stdcxx/bstdmap.h:178
void SetSectionsToFill(DgnModelSections val)
Specify what sections of the referenced model to fill, if any.
Definition: DgnModelRef.h:148
Definition: DocumentManager.h:224
DgnAttachmentBuilder()
Construct an empty DgnAttachmentBuilder.
Definition: DgnModelRef.h:89
const_iterator iterator
only const iteration is possible
Definition: DgnModelRef.h:50
DgnModelRefType
Model types.
Definition: DgnModelRef.h:29
iterator end()
Definition: stdcxx/bstdmap.h:186
#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
void SetMaxDepth(int maxDepth)
Override the nesting depth stored in the attachment. See DgnAttachment::SetNestDepth. When this is set, DgnAttachments are Read to the lesser of maxDepth or the depth required for display.
Definition: DgnModelRef.h:150
A collection that allows code to iterate through the set of persistent elements in a model and all th...
Definition: DgnModelRefCollections.h:149
void SetLoadUndisplayed(bool val)
Load referenced models even if they are not marked for display? Normally, undisplayed references are ...
Definition: DgnModelRef.h:138
#define NULL
Definition: Bentley.h:157
bstdmap & operator=(const bstdmap &__rhs)
Definition: stdcxx/bstdmap.h:170
Is a DgnAttachment that is attached to a DgnModel.
bool m_loadCaches
try to load the referenced model?
Definition: DgnModelRef.h:113
bool m_showProgressMeter
Show progress meter while loading these references. The default is true.
Definition: DgnModelRef.h:122
The DgnAttachmentLoadOptions struct is used to specify the details of how DgnAttachments are to be re...
Definition: DgnModelRef.h:111
A collection that allows code to iterate through the set of ModelRefs attached to a supplied root mod...
Definition: DgnModelRefCollections.h:79
DgnModelP AsDgnModelP()
Cast this to a DgnModel.
Definition: DgnModelRef.h:335
Is a DgnModel that has DgnAttachments.
A smart pointer to a non-persistent Bentley::DgnPlatform::DgnAttachment that is in the process of bei...
Definition: DgnModelRef.h:83
A DgnModel represents a DgnModel in memory.
Definition: DgnModel.h:236
Holds a set of options used to specify a set of ModelRefs to be iterated.
Definition: DgnModelRefCollections.h:22
#define CLRPUBLIC
Definition: DgnPlatform/ExportMacros.h:12
A DgnDocumentMoniker identifies a file.
Definition: DgnDocumentManager.h:181
Is a section of a DgnFile that holds file-wide data.
A DgnModelRef provides access to a model in a Bentley::DgnPlatform::DgnFile.
Definition: DgnModelRef.h:172
DgnModelSections
The element sections within a DgnModel.
Definition: BentleyDgn.h:16
#define DGNPLATFORM_TYPEDEFS(_name_)
Definition: DgnPlatform.h:73
A shared pointer template for reference-counted objects.
Definition: RefCounted.h:119
A collection of pointers to Bentley::DgnPlatform::DgnAttachment objects.
Definition: DgnModelRef.h:43
*//* Bentley Systems
Definition: DgnModelRef.h:67
struct DgnPlatform::DgnModel const * DgnModelCP
Definition: DgnPlatform.h:220
Int32 ModelId
Definition: DgnPlatformBaseType.r.h:84
A level cache holds level definitions.
Definition: LevelCache.h:702
#define BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:68
A FileLevelCache contains the level definitions for a file.
Definition: LevelCache.h:850
A DgnAttachment represents a reference from one model to another, with transforming, clipping, and filtering applied.
Definition: DgnAttachment.h:192
int StatusInt
Definition: Bentley.h:222
UInt64 ElementId
Definition: DgnPlatformBaseType.r.h:83
LimitRefLoading
Values for restricting DgnAttachment model loading.
Definition: DgnPlatform.h:1688
bool m_applyOverrides
Override the flags that permit display, locate, and snapping to nested reference attachments?
Definition: DgnModelRef.h:121
DgnAttachmentP GetDgnAttachmentP()
Returns a non-const pointer to the DgnAttachment being defined.
Definition: DgnModelRef.h:101
void SetOneLevelOnly(bool val)
Load the immediate attachments only. When false, the references are loaded to the nesting depth requi...
Definition: DgnModelRef.h:140
struct DgnPlatform::FileLevelCache const * FileLevelCacheCP
Definition: DgnPlatform.h:268
bool m_loadRasterRefs
Try to load raster references.
Definition: DgnModelRef.h:118
bool IsFound(DgnModelRefP modelRef) const
Definition: DgnModelRef.h:71
struct DgnPlatform::ModelInfo const * ModelInfoCP
Definition: DgnPlatform.h:400
DgnAttachmentP AsDgnAttachmentP()
Cast this to a Bentley::DgnPlatform::DgnAttachment.
Definition: DgnModelRef.h:343
bool m_redundancyCheck
Avoid creating attachments for nested references that would display the same as an existing attachmen...
Definition: DgnModelRef.h:120
struct DgnPlatform::DgnAttachment const * DgnAttachmentCP
Definition: DgnPlatform.h:185
void SetRedundancyCheck(bool val)
If true, avoid creating attachments for nested references that would display the same as an existing ...
Definition: DgnModelRef.h:142
struct DgnPlatform::DgnAttachmentArray const * DgnAttachmentArrayCP
Definition: DgnModelRef.h:13
size_type size() const
Definition: stdcxx/bstdmap.h:214
struct DgnPlatform::LevelCache const & LevelCacheCR
Definition: DgnPlatform.h:353
bvector< DgnAttachmentP >::const_iterator const_iterator
Definition: DgnModelRef.h:49
Holds a set of options used to specify a set of elements to be iterated.
Definition: DgnModelRefCollections.h:109

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