ClipPrimitive.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 <Geom/ClipPlaneSet.h>
12 
14 
15 typedef bvector<DPoint2d> T_ClipPolygon;
16 
17 /*=================================================================================**/
21 struct ClipPolygon : bvector <DPoint2d>
22 {
24  ClipPolygon () { }
26  ClipPolygon (DPoint2dCP points, size_t nPoints);
28  void Init(DPoint2dCP points, size_t nPoints);
29 
30 }; // ClipPolygon
31 
32 
33 typedef ClipPolygon const* ClipPolygonCP;
34 typedef ClipPolygon const& ClipPolygonCR;
35 
36 /*=================================================================================**/
43 {
44 
45 public:
47  DGNPLATFORM_EXPORT static ClipPrimitivePtr CreateCopy (ClipPrimitiveCR primitive);
49  DGNPLATFORM_EXPORT static ClipPrimitivePtr CreateFromBlock (DPoint3dCR low, DPoint3dCR high, bool outside, ClipMask clipMask, TransformCP transformFromClip, bool invisible = false);
51  DGNPLATFORM_EXPORT static ClipPrimitivePtr CreateFromShape(DPoint2dCP points, size_t numPoints, bool outside, double const* zLow, double const* zHigh, TransformCP transformFromClip, bool invisible = false);
53  DGNPLATFORM_EXPORT static ClipPrimitivePtr CreateFromClipPlanes(ClipPlaneSetCR planes, bool invisible = false);
55  DGNPLATFORM_EXPORT static ClipPrimitivePtr CreateFromGPA(GPArrayCR gpa, double chordTolerance, double angleTolerance, bool isMask, double const* zLow, double const* zHigh, TransformCP transformFromClip, bool invisible = false);
57  DGNPLATFORM_EXPORT static ClipPrimitivePtr CreateFromGPA(GPArrayCR gpa, ClipPolygonCR, bool isMask, double const* zLow, double const* zHigh, TransformCP transformFromClip, bool invisible = false);
59  DGNPLATFORM_EXPORT static ClipPrimitivePtr CreateFromBoundaryCurveVector(CurveVectorCR curveVector, double chordTolerance, double angleTolerance, double const* zLow, double const* zHigh, TransformCP transformFromClip, bool invisible = false);
61  DGNPLATFORM_EXPORT static ClipPrimitivePtr CreateFromConvexPolyface (PolyfaceQueryCR polyface);
62 
64  DGNPLATFORM_EXPORT ClipPlaneSetCP GetClipPlanes () const;
66  DGNPLATFORM_EXPORT ClipPlaneSetCP GetMaskPlanes() const;
68  DGNPLATFORM_EXPORT ClipPlaneSetCP GetMaskOrClipPlanes() const;
70  DGNPLATFORM_EXPORT GPArrayCP GetGPA (bool onlyIfNonLinear) const;
72  DGNPLATFORM_EXPORT MSBsplineCurveCP GetBCurve () const;
74  DGNPLATFORM_EXPORT bool GetRange (DRange3dR range, TransformCP transform, bool returnMaskRange = false) const;
76  DGNPLATFORM_EXPORT TransformCP GetTransformToClip () const;
78  DGNPLATFORM_EXPORT TransformCP GetTransformFromClip () const;
80  DGNPLATFORM_EXPORT bool GetInvisible () const;
82  DGNPLATFORM_EXPORT bool GetTransforms (TransformP forward, TransformP inverse);
84  DGNPLATFORM_EXPORT BentleyStatus TransformInPlace (TransformCR transform);
86  DGNPLATFORM_EXPORT bool IsMask () const;
88  DGNPLATFORM_EXPORT bool ClipZHigh () const;
90  DGNPLATFORM_EXPORT bool ClipZLow() const;
92  DGNPLATFORM_EXPORT double GetZLow() const;
94  DGNPLATFORM_EXPORT double GetZHigh() const;
96  DGNPLATFORM_EXPORT ClipPolygonCP GetPolygon () const;
98  DGNPLATFORM_EXPORT bool PointInside (DPoint3dCR point, double onTolerance = 0.0) const;
100  DGNPLATFORM_EXPORT bool SphereInside (DPoint3dCR point, double radius) const;
102  DGNPLATFORM_EXPORT void SetIsMask (bool isMask);
104  DGNPLATFORM_EXPORT void SetZLow (double zLow);
106  DGNPLATFORM_EXPORT void SetZHigh(double zHigh);
108  DGNPLATFORM_EXPORT void SetClipZLow(bool clipZLow);
110  DGNPLATFORM_EXPORT void SetClipZHigh(bool clipZHigh);
112  DGNPLATFORM_EXPORT void SetInvisible (bool invisible);
114  DGNPLATFORM_EXPORT bool IsXYPolygon () const;
116  DGNPLATFORM_EXPORT bool ContainsZClip() const;
118  DGNPLATFORM_EXPORT void ParseClipPlanes () const;
120  DGNPLATFORM_EXPORT BentleyStatus ApplyCameraToPlanes (double focalLength);
122  DGNPLATFORM_EXPORT ClipPlaneContainment ClassifyPointContainment (DPoint3dCP points, size_t nPoints, bool ignoreMasks = false) const;
124  DGNPLATFORM_EXPORT void TransformToClip (DPoint3dR point) const;
126  DGNPLATFORM_EXPORT void TransformFromClip(DPoint3dR point) const;
128  DGNPLATFORM_EXPORT void ExpandClipPlanes(double distance);
129 
130 };
131 
133 
struct ClipPlaneSet const & ClipPlaneSetCR
Definition: msgeomstructs_typedefs.h:94
struct ClipPlaneSet const * ClipPlaneSetCP
Definition: msgeomstructs_typedefs.h:94
struct PolyfaceQuery const & PolyfaceQueryCR
Definition: msgeomstructs_typedefs.h:178
struct Bentley::GPArray const & GPArrayCR
Definition: DgnPlatform.h:140
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
struct DPoint3d const * DPoint3dCP
Definition: msgeomstructs_typedefs.h:79
struct Bentley::GPArray const * GPArrayCP
Definition: DgnPlatform.h:140
ClipPolygon const & ClipPolygonCR
Definition: ClipPrimitive.h:34
A ClipPolygon is a collection of 2D Points that form a loop and can be used for clipping.
Definition: ClipPrimitive.h:21
struct CurveVector const & CurveVectorCR
Definition: msgeomstructs_typedefs.h:172
#define DGNPLATFORM_EXPORT
Definition: DgnPlatform/ExportMacros.h:58
ClipMask
Definition: DgnPlatform.h:1064
3d point coordinates.
Definition: dpoint3d.h:19
BentleyStatus
Definition: Bentley.h:208
struct Transform const * TransformCP
Definition: msgeomstructs_typedefs.h:134
A shared pointer template for reference-counted objects.
Definition: RefCounted.h:119
Desciption: ConvexClipPlaneSet, ClipPlaneSet.
ClipPlaneContainment
Definition: ClipPlaneSet.h:16
#define BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:68
ClipPrimitive is an abstract class that represents a single clip object.
Definition: ClipPrimitive.h:42
ClipPolygon const * ClipPolygonCP
Definition: ClipPrimitive.h:33
struct Transform const & TransformCR
Definition: msgeomstructs_typedefs.h:134
3x4 matrix for defining coordinate frames and affine transformations.
Definition: transform.h:22
Concrete class that can be used to implement the reference-counting pattern.
Definition: RefCounted.h:109
struct MSBsplineCurve const * MSBsplineCurveCP
Definition: msgeomstructs_typedefs.h:139
struct DPoint3d const & DPoint3dCR
Definition: msgeomstructs_typedefs.h:79
bvector< DPoint2d > T_ClipPolygon
Definition: ClipPrimitive.h:15
struct DPoint2d const * DPoint2dCP
Definition: msgeomstructs_typedefs.h:78
struct DgnPlatform::ClipPrimitive const & ClipPrimitiveCR
Definition: DgnPlatform.h:177
ClipPolygon()
Constructor.
Definition: ClipPrimitive.h:24
A 3d low and high corner pair for range boxes.
Definition: drange3d.h:20

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