CFx SDK Documentation  2020SP3
FMContoursBaseImp.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2015, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2015 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 #ifndef __FMIMPCONTOURSBASE_H__
24 #define __FMIMPCONTOURSBASE_H__
25 
26 #include "FMContoursBase.h"
27 
28 namespace FacetModeler
29 {
30 
31  // Returns first error code (if any), or first warning (if no errors)
32  inline Result worstResult( Result eRes1, Result eRes2 )
33  { return odmax( eRes1, eRes2 ); }
34 
35  // The old code cuts warnings of eRes2 if eRes1 is OK
36 // { return (!isError(eRes2) || isError( eRes1 ) ) ? eRes1 : eRes2; };
37 
38  // Maybe better, but slower solution looks like this one:
39 // inline Result worstResult( Result eRes1, Result eRes2 )
40 // {
41 // int severity1 = 2*isError(eRes1) + isWarning(eRes1);
42 // int severity2 = 2*isError(eRes2) + isWarning(eRes2);
43 // return ( severity1 >= severity2 ? eRes1 : eRes2 );
44 // }
45 
46 
47  class FMGEOMETRY_API Attributes2D
48  {
49  OdIntPtr m_uMetadata; //value which is able to store a pointer; size depends on platform type 32\64
50 
51  union
52  {
54  struct
55  {
56 #ifdef ODA_BIGENDIAN
57  OdUInt32 bSmooth : 1;
58  OdUInt32 bExplodedArc : 1;
59  OdUInt32 bHidden : 1;
60  OdUInt32 uOrientation : 8;
61 #else
66 #endif
67  } m_Flags;
68  };
69  public:
70  Attributes2D() : m_uMetadata(0), m_uAllFlags(0) { }
71  explicit Attributes2D( OdIntPtr uMeta ) : m_uMetadata(uMeta), m_uAllFlags(0) { }
72  explicit Attributes2D( OdIntPtr uMeta, OdUInt32 uRawFlags ) : m_uMetadata(uMeta), m_uAllFlags(uRawFlags) { }
73 
74  inline Attributes2D clone() const { return *this; }
75 
76  inline Attributes2D& operator = (const Attributes2D& rA )
77  {
78  m_uMetadata = rA.m_uMetadata;
79  m_uAllFlags = rA.m_uAllFlags;
80  return *this;
81  }
82 
83  inline bool operator == (const Attributes2D& rA ) const
84  {
85  return m_uMetadata == rA.m_uMetadata && m_uAllFlags == rA.m_uAllFlags;
86  }
87 
88  inline bool operator != (const Attributes2D& rA ) const
89  {
90  return !( *this == rA );
91  }
92 
93  inline bool isNull() const
94  {
95  return 0==m_uMetadata && 0==m_uAllFlags;
96  }
97 
99  inline Attributes2D getReversed() const { return Attributes2D(*this).reverse(); }
100 
101  inline OdIntPtr metadata() const { return m_uMetadata; }
102  inline OdIntPtr& metadata() { return m_uMetadata; }
103 
104  public:
105 
106  inline OdUInt32 flags() const { return m_uAllFlags; }
107  inline Attributes2D& setFlags( OdUInt32 uF ) { m_uAllFlags = uF; return *this; }
108 
109  inline FaceOrientation orientation() const
110  {
111  return FaceOrientation( m_Flags.uOrientation );
112  }
114  {
115  m_Flags.uOrientation = OdUInt32(eOri);
116  return *this;
117  }
118 
119  inline bool isHidden() const
120  {
121  return m_Flags.bHidden;
122  }
123  inline Attributes2D& setHidden(bool bH )
124  {
125  m_Flags.bHidden = bH;
126  return *this;
127  }
128 
129  inline bool isSmooth() const {
130  return m_Flags.bSmooth;
131  }
132  inline Attributes2D& setSmooth(bool bSmooth ) {
133  m_Flags.bSmooth = bSmooth;
134  return *this;
135  }
136 
137  inline bool isExplodedArc() const
138  {
139  return m_Flags.bExplodedArc;
140  }
141  inline Attributes2D& setExplodedArc(bool bExploded )
142  {
143  m_Flags.bExplodedArc = bExploded;
144  return *this;
145  }
146 
147  public:
148  FMGEOMETRY_API_STATIC static const Attributes2D kNull;
149  };
150 
151  FMGEOMETRY_API OdGePoint2d FindNearestPoint(const OdGePoint2d& ptOrigin, const std::vector< Intersection >& vecPoints);
152  FMGEOMETRY_API OdGePoint3d FindNearestPoint(const OdGePoint3d& ptOrigin, const std::vector<OdGePoint3d>& vecPoints);
153 
154  FMGEOMETRY_API OdGePoint2d FindFarthestPoint(const OdGePoint2d& ptOrigin, const std::vector< Intersection >& vecPoints);
155 };
156 
157 #endif //__FMIMPCONTOURSBASE_H__
FacetModeler::Attributes2D::m_uAllFlags
OdUInt32 m_uAllFlags
Definition: FMContoursBaseImp.h:53
FacetModeler::Attributes2D::setFlags
Attributes2D & setFlags(OdUInt32 uF)
Definition: FMContoursBaseImp.h:107
FacetModeler::Attributes2D::getReversed
Attributes2D getReversed() const
Definition: FMContoursBaseImp.h:99
FacetModeler
Definition: FMContour2D.h:35
FacetModeler::FaceOrientation
FaceOrientation
Definition: FMGeometry.h:113
FacetModeler::Attributes2D::uOrientation
OdUInt32 uOrientation
Definition: FMContoursBaseImp.h:62
FacetModeler::worstResult
Result worstResult(Result eRes1, Result eRes2)
Definition: FMContoursBaseImp.h:32
FacetModeler::FindFarthestPoint
FMGEOMETRY_API OdGePoint2d FindFarthestPoint(const OdGePoint2d &ptOrigin, const std::vector< Intersection > &vecPoints)
FacetModeler::Attributes2D::bSmooth
OdUInt32 bSmooth
Definition: FMContoursBaseImp.h:65
FacetModeler::Attributes2D::isHidden
bool isHidden() const
Definition: FMContoursBaseImp.h:119
FacetModeler::Attributes2D::setOrientation
Attributes2D & setOrientation(FaceOrientation eOri)
Definition: FMContoursBaseImp.h:113
FacetModeler::Attributes2D::Attributes2D
Attributes2D()
Definition: FMContoursBaseImp.h:70
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
FacetModeler::Attributes2D::metadata
OdIntPtr metadata() const
Definition: FMContoursBaseImp.h:101
FacetModeler::Attributes2D::isExplodedArc
bool isExplodedArc() const
Definition: FMContoursBaseImp.h:137
FacetModeler::Attributes2D::orientation
FaceOrientation orientation() const
Definition: FMContoursBaseImp.h:109
OdGePoint3d
Definition: GePoint3d.h:55
OdDAI::operator!=
bool DAI_EXPORT operator!=(const OdDAI::OdSelect &left, const OdDAI::OdSelect &right)
FMContoursBase.h
FacetModeler::Attributes2D::Attributes2D
Attributes2D(OdIntPtr uMeta)
Definition: FMContoursBaseImp.h:71
FacetModeler::Attributes2D::bExplodedArc
OdUInt32 bExplodedArc
Definition: FMContoursBaseImp.h:64
FacetModeler::Attributes2D::metadata
OdIntPtr & metadata()
Definition: FMContoursBaseImp.h:102
FacetModeler::FindNearestPoint
FMGEOMETRY_API OdGePoint2d FindNearestPoint(const OdGePoint2d &ptOrigin, const std::vector< Intersection > &vecPoints)
FacetModeler::Attributes2D::setHidden
Attributes2D & setHidden(bool bH)
Definition: FMContoursBaseImp.h:123
FacetModeler::Result
Result
Definition: FMContoursBase.h:44
odmax
#define odmax(X, Y)
Definition: OdPlatform.h:35
FacetModeler::Attributes2D
Definition: FMContoursBaseImp.h:48
FacetModeler::Attributes2D::clone
Attributes2D clone() const
Definition: FMContoursBaseImp.h:74
FacetModeler::Attributes2D::isSmooth
bool isSmooth() const
Definition: FMContoursBaseImp.h:129
OdIntPtr
ptrdiff_t OdIntPtr
Definition: OdPlatformSettings.h:884
FacetModeler::Attributes2D::kNull
static FMGEOMETRY_API_STATIC const Attributes2D kNull
Definition: FMContoursBaseImp.h:148
FacetModeler::Attributes2D::Attributes2D
Attributes2D(OdIntPtr uMeta, OdUInt32 uRawFlags)
Definition: FMContoursBaseImp.h:72
FacetModeler::Attributes2D::setSmooth
Attributes2D & setSmooth(bool bSmooth)
Definition: FMContoursBaseImp.h:132
FacetModeler::Attributes2D::flags
OdUInt32 flags() const
Definition: FMContoursBaseImp.h:106
FacetModeler::Attributes2D::reverse
Attributes2D & reverse()
FacetModeler::Attributes2D::isNull
bool isNull() const
Definition: FMContoursBaseImp.h:93
FacetModeler::Attributes2D::setExplodedArc
Attributes2D & setExplodedArc(bool bExploded)
Definition: FMContoursBaseImp.h:141
FacetModeler::Attributes2D::bHidden
OdUInt32 bHidden
Definition: FMContoursBaseImp.h:63
OdGePoint2d
Definition: GePoint2d.h:60