GPArray.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 
11 #include <Geom/GeomApi.h>
12 
14 
15 enum class GPCurveType
16 {
17  Invalid = 0,
18  LineString = 1,
19  Ellipse = 2,
20  Bezier = 3,
21  BSpline = 4
22 };
23 
24 /*=================================================================================**/
91 struct GPArray
92 {
93 private:
94  virtual void MakeClassAbstract() = 0;
95 public:
96 public:
97  DGNPLATFORM_EXPORT static GPArrayP Grab ();
98  DGNPLATFORM_EXPORT void Drop ();
99 
103  DGNPLATFORM_EXPORT int GetCount () const;
104 
106  DGNPLATFORM_EXPORT void Empty ();
107  DGNPLATFORM_EXPORT void EmptyAll ();
108 
111  DGNPLATFORM_EXPORT double Length () const;
112 
116  DGNPLATFORM_EXPORT DRange3dP GetRange (DRange3dR range) const;
117 
121  DGNPLATFORM_EXPORT bool GetPlane (DPlane3dR plane) const;
122 
126  DGNPLATFORM_EXPORT bool IsPointInsideXY (DPoint3dR point) const;
127 
130  DGNPLATFORM_EXPORT void Stroke (double tolerance);
131 
134  DGNPLATFORM_EXPORT void Transform (TransformCP transform);
135 
138  DGNPLATFORM_EXPORT void Transform (DMatrix4dCP transform);
139 
143  DGNPLATFORM_EXPORT bool CopyContentsOf (GPArrayCP source);
144 
148  DGNPLATFORM_EXPORT bool Append (GPArrayCP source);
149 
152  DGNPLATFORM_EXPORT void Add (DPoint3dCP pt);
153 
157  DGNPLATFORM_EXPORT void Add (DPoint3dCP pt, int num);
158 
162  DGNPLATFORM_EXPORT void Add (DPoint2dCP pt, int num);
163 
166  DGNPLATFORM_EXPORT void Add (DEllipse3dCR ellipse);
167 
170  DGNPLATFORM_EXPORT void Add (MSBsplineCurveCR curve);
171 
173  DGNPLATFORM_EXPORT void MarkBreak ();
174 
176  DGNPLATFORM_EXPORT void MarkMajorBreak ();
177 
181  DGNPLATFORM_EXPORT BentleyStatus Add (CurveVectorCR curves, bool splinesAsBezier = false);
182 
187  DGNPLATFORM_EXPORT DPoint3dP GetPoint (DPoint3dR point, int index) const;
188 
195  DGNPLATFORM_EXPORT BentleyStatus GetLineString (int *index, DPoint3dP points, int* nPoints, int maxPoints) const;
196 
201  DGNPLATFORM_EXPORT BentleyStatus GetEllipse (int* index, DEllipse3dP ellipse) const;
202 
208  DGNPLATFORM_EXPORT BentleyStatus GetBCurve (int *index, MSBsplineCurveP curve) const;
209 
212  ICurvePrimitivePtr GetCurvePrimitive (int& index) const;
213 
217  DGNPLATFORM_EXPORT GPCurveType GetCurveType (int index) const;
218 
222  DGNPLATFORM_EXPORT bool IsMajorBreak (int index) const;
223 
225  DGNPLATFORM_EXPORT CurveVectorPtr ToCurveVector () const;
226 
234  DGNPLATFORM_EXPORT BentleyStatus ToElement (EditElementHandleR eeh, ElementHandleCP templateEh, bool is3d, bool closed, DgnModelRefR model) const;
235 
243  DGNPLATFORM_EXPORT BentleyStatus ToGroupElement (EditElementHandleR eeh, ElementHandleCP templateEh, bool is3d, bool closePhysicallyClosed, DgnModelRefR model) const;
244 };
245 
246 typedef bvector<GPArrayP> GPArrayVector;
248 
249 //=======================================================================================
251 // @bsiclass Bentley Systems
252 //=======================================================================================
254 {
255 private:
256  GPArrayP m_gpa;
257 
258 public:
259  explicit GPArraySmartP (GPArrayP gpa) {m_gpa = gpa;}
260  GPArraySmartP () {m_gpa = GPArray::Grab();}
261  ~GPArraySmartP () {if (NULL != m_gpa) m_gpa->Drop();}
262  GPArrayP operator -> () const {return m_gpa;}
263  operator GPArrayP () const {return m_gpa;}
264  operator GPArray& () const {return *m_gpa;}
265  void ExtractFrom (GPArraySmartP& donor) {if (NULL != m_gpa) { m_gpa->Drop (); } m_gpa = donor.m_gpa; donor.m_gpa = NULL;}
266 };
267 
268 
269 
270 
MSBsplineCurve is a "Non uniform, rational Bspline curve".
Definition: MSBsplineCurve.h:46
Center, reference vectors, and angular range for elliptic arc.
Definition: dellipse3d.h:19
bvector< GPArrayP > GPArrayVector
Definition: GPArray.h:246
Class that manages the lifecycle of a GPArray.
Definition: GPArray.h:253
GPCurveType
Definition: GPArray.h:15
struct DPoint3d const * DPoint3dCP
Definition: msgeomstructs_typedefs.h:79
Open for both read and write.
void ExtractFrom(GPArraySmartP &donor)
Definition: GPArray.h:265
struct Bentley::GPArray const * GPArrayCP
Definition: DgnPlatform.h:140
A writeable "handle" to an MSElement.
Definition: ElementHandle.h:470
struct CurveVector const & CurveVectorCR
Definition: msgeomstructs_typedefs.h:172
#define DGNPLATFORM_EXPORT
Definition: DgnPlatform/ExportMacros.h:58
GPArrayVector & GPArrayVectorR
Definition: GPArray.h:247
#define NULL
Definition: Bentley.h:157
Origin and normal vector for a plane.
Definition: dplane3d.h:18
#define BEGIN_BENTLEY_NAMESPACE
Definition: Bentley.r.h:24
GeomApi: Bentley::Rounding, Bentley::ValueSizeSize, Bentley::OrderedValueSizeSize, Bentley::IGeometry, Bentley::OrderedIGeometryPtr, Bentley::pointList.
struct MSBsplineCurve const & MSBsplineCurveCR
Definition: msgeomstructs_typedefs.h:139
GPArraySmartP()
Definition: GPArray.h:260
3d point coordinates.
Definition: dpoint3d.h:19
BentleyStatus
Definition: Bentley.h:208
A DgnModelRef provides access to a model in a Bentley::DgnPlatform::DgnFile.
Definition: DgnModelRef.h:172
struct Transform const * TransformCP
Definition: msgeomstructs_typedefs.h:134
struct Bentley::GPArray * GPArrayP
Definition: DgnPlatform.h:140
~GPArraySmartP()
Definition: GPArray.h:261
A shared pointer template for reference-counted objects.
Definition: RefCounted.h:119
struct DgnPlatform::ElementHandle const * ElementHandleCP
Definition: DgnPlatform.h:260
Base class to make a class non-copyable.
Definition: NonCopyableClass.h:23
struct DMatrix4d const * DMatrix4dCP
Definition: msgeomstructs_typedefs.h:97
3x4 matrix for defining coordinate frames and affine transformations.
Definition: transform.h:22
Class for collecting and manipulating curve data.
Definition: GPArray.h:91
struct DEllipse3d const & DEllipse3dCR
Definition: msgeomstructs_typedefs.h:114
#define END_BENTLEY_NAMESPACE
Definition: Bentley.r.h:25
GPArraySmartP(GPArrayP gpa)
Definition: GPArray.h:259
struct DPoint2d const * DPoint2dCP
Definition: msgeomstructs_typedefs.h:78
A 3d low and high corner pair for range boxes.
Definition: drange3d.h:20

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