CFx SDK Documentation  2020SP3
FMContoursBase.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 
24 #ifndef __FMCONTOURSBASE_H__
25 #define __FMCONTOURSBASE_H__
26 
27 #include "FMGeometry.h"
28 #include <Ge/GePoint2d.h>
29 #include "DoubleArray.h"
30 
34 namespace FacetModeler
35 {
43  enum Result
44  {
45  // All correct.
46  erOk = 0,
47 
48  //
50 
51  // Parameter on contour is not valid.
53 
54  // Input point or vector is not on this entity. But it should be.
56 
57  // Contour is empty.
59 
60  // Contour is too small.
62 
63  // Region/Profile contours are not valid
65 
66  // Some contour is not closed, but it should be.
68 
69  //
70  erErrors = 0x1000,
71 
72  // Not implemented.
74 
75  // Array/segment index is out of range
77 
78  // Parameter value is out of range.
80 
81  // Input point or vector is not on this entity.
83 
84  // Invalid (singular) transformation matrix.
86 
87  // wrong segment type. Another type expected.
89 
90  // Contour is empty.
92 
93  // Some points are invalid.
95 
96  // Metadata is not available and/or can`t be updated.
98 
99  // Some input parameters are completely invalid.
101 
102  // Contour is too small.
104 
105  // Contour or profile is self-intersecting.
107 
108  // Contour orientation is not applicable.
110 
111  // Some contour is not closed, but it should be.
113 
114  // Operation is not applicable.
116 
117  // Invalid result in area operation.
119 
120  // Region/Profile is not valid in regional operation.
122 
123  // Region/Profile is not valid in regional operation.
125 
126  // Tolerance is too small, or input contours are singular.
128 
129  // Unknown error.
131 
132  //
134  };
135 
139  inline bool isOk( Result eRes )
140  { return eRes < erErrors; };
141 
145  inline bool isWarning( Result eRes )
146  { return eRes < erErrors && eRes >= erWarnings; };
147 
151  inline bool isError( Result eRes )
152  { return eRes >= erErrors; };
153 
158  {
159  //
161 
162  // Straight segment with length greater than 0.
164 
165  // Arc segment with length greater than 0.
167 
168  // Segment with 0 length.
170  };
171 
176  {
180  elOnBound
181  };
182 
187  {
188  // Merge circular segments
190 
191  // Merge segments with different metadata
193 
194  // Merge first and last segments of a closed contour
195  emfMergeOrigin = 4
196  };
197 
202  {
203  // Close gaps with straight line segments
205 
206  // Extend segments with tangential rays
208 
209  // Extend segments with tangential rays or circular arcs,
210  // depending on segment types
212 
213  // Close gaps with circular arcs
215  };
216 
219  {
223  ecicLast
224  };
225 
228  {
232  esicLast
233  };
234 
238  class FMGEOMETRY_API Intersection
239  {
240  public:
244  enum Types
245  {
246  // No intersection
247  eitNone = 0,
248 
249  // Intersection of any type (the type was not defined).
251 
252  // Curves cross each other at the point.
254 
255  // Curves touch each other at the point.
256  eitTouch
257  };
258 
262  Intersection() : dParamA( 0 ), dParamB( 0 ), eType( eitNone )
263  { }
264 
268  Intersection( const OdGePoint2d& rPt, double dPA = 0, double dPB = 0, Types eIT = eitNone )
269  : ptPoint( rPt ), dParamA( dPA ), dParamB( dPB ), eType( eIT )
270  { }
271 
276  {
277  std::swap( dParamA, dParamB );
278  return *this;
279  };
280 
284  inline static bool lessParamA( const Intersection& rI1, const Intersection& rI2 )
285  { return rI1.dParamA < rI2.dParamA; };
286 
290  inline static bool lessParamB( const Intersection& rI1, const Intersection& rI2 )
291  { return rI1.dParamB < rI2.dParamB; };
292 
293  public:
298 
303 
308 
313  };
314 };
315 
316 #endif //__FMCONTOURSBASE_H__
FacetModeler::estCoincident
@ estCoincident
Definition: FMContoursBase.h:169
FacetModeler::erWarnContourNotClosed
@ erWarnContourNotClosed
Definition: FMContoursBase.h:67
FacetModeler::estArc
@ estArc
Definition: FMContoursBase.h:166
FacetModeler::erWarnImproperAreas
@ erWarnImproperAreas
Definition: FMContoursBase.h:64
FacetModeler::erToleranceViolation
@ erToleranceViolation
Definition: FMContoursBase.h:127
FacetModeler::Intersection::eType
Types eType
Definition: FMContoursBase.h:312
FacetModeler::Intersection::eitCrossing
@ eitCrossing
Definition: FMContoursBase.h:253
FacetModeler::erContourNotClosed
@ erContourNotClosed
Definition: FMContoursBase.h:112
FacetModeler::erSingularPoints
@ erSingularPoints
Definition: FMContoursBase.h:94
FacetModeler
Definition: FMContour2D.h:35
FacetModeler::erWarnEmptyContour
@ erWarnEmptyContour
Definition: FMContoursBase.h:58
FacetModeler::erParamBounds
@ erParamBounds
Definition: FMContoursBase.h:79
FacetModeler::Intersection::lessParamB
static bool lessParamB(const Intersection &rI1, const Intersection &rI2)
Definition: FMContoursBase.h:290
FacetModeler::eftChamfer
@ eftChamfer
Definition: FMContoursBase.h:204
FacetModeler::Locations
Locations
Definition: FMContoursBase.h:176
FacetModeler::erFailedToCloseContours
@ erFailedToCloseContours
Definition: FMContoursBase.h:118
DoubleArray.h
FacetModeler::erErrors
@ erErrors
Definition: FMContoursBase.h:70
FacetModeler::isError
bool isError(Result eRes)
Definition: FMContoursBase.h:151
FacetModeler::esicCachedSeg2D
@ esicCachedSeg2D
Definition: FMContoursBase.h:231
FacetModeler::elInside
@ elInside
Definition: FMContoursBase.h:178
FacetModeler::erFail
@ erFail
Definition: FMContoursBase.h:130
FacetModeler::emfMergeArcs
@ emfMergeArcs
Definition: FMContoursBase.h:189
FacetModeler::erNoMetadata
@ erNoMetadata
Definition: FMContoursBase.h:97
FacetModeler::Intersection
Definition: FMContoursBase.h:239
FacetModeler::elOnBound
@ elOnBound
Definition: FMContoursBase.h:180
slimsig::swap
void swap(signal< Handler, SignalTraits, Allocator > &lhs, signal< Handler, SignalTraits, Allocator > &rhs)
FacetModeler::erWarnings
@ erWarnings
Definition: FMContoursBase.h:49
FacetModeler::ecicSimple
@ ecicSimple
Definition: FMContoursBase.h:221
FacetModeler::esicBulgeSeg2D
@ esicBulgeSeg2D
Definition: FMContoursBase.h:230
FacetModeler::Intersection::Types
Types
Definition: FMContoursBase.h:245
FacetModeler::eftExtend
@ eftExtend
Definition: FMContoursBase.h:211
FacetModeler::ecicLast
@ ecicLast
Definition: FMContoursBase.h:223
FacetModeler::Intersection::Intersection
Intersection()
Definition: FMContoursBase.h:262
FacetModeler::erImproperRegionBounds
@ erImproperRegionBounds
Definition: FMContoursBase.h:121
FacetModeler::erContourIsTooSmall
@ erContourIsTooSmall
Definition: FMContoursBase.h:103
FacetModeler::erEmptyContour
@ erEmptyContour
Definition: FMContoursBase.h:91
FacetModeler::FilletType
FilletType
Definition: FMContoursBase.h:202
FacetModeler::erWarnPointNotOnThis
@ erWarnPointNotOnThis
Definition: FMContoursBase.h:55
FacetModeler::erOk
@ erOk
Definition: FMContoursBase.h:46
FacetModeler::SegmentImplClass
SegmentImplClass
DOM.
Definition: FMContoursBase.h:228
FacetModeler::erOperationNotApplicable
@ erOperationNotApplicable
Definition: FMContoursBase.h:115
FacetModeler::erNotImplementedYet
@ erNotImplementedYet
Definition: FMContoursBase.h:73
FacetModeler::elOutside
@ elOutside
Definition: FMContoursBase.h:179
FacetModeler::Intersection::dParamB
OdDouble dParamB
Definition: FMContoursBase.h:307
FacetModeler::Intersection::dParamA
OdDouble dParamA
Definition: FMContoursBase.h:302
FacetModeler::erImproperRegionAreas
@ erImproperRegionAreas
Definition: FMContoursBase.h:124
FacetModeler::Result
Result
Definition: FMContoursBase.h:44
FacetModeler::erWrongSegType
@ erWrongSegType
Definition: FMContoursBase.h:88
FacetModeler::eftCircular
@ eftCircular
Definition: FMContoursBase.h:214
FMGeometry.h
FacetModeler::SegmentType
SegmentType
Definition: FMContoursBase.h:158
FacetModeler::isOk
bool isOk(Result eRes)
Definition: FMContoursBase.h:139
FacetModeler::Intersection::eitAny
@ eitAny
Definition: FMContoursBase.h:250
FacetModeler::erLastError
@ erLastError
Definition: FMContoursBase.h:133
FacetModeler::erSelfIntersecting
@ erSelfIntersecting
Definition: FMContoursBase.h:106
FacetModeler::erInvalidArgs
@ erInvalidArgs
Definition: FMContoursBase.h:100
FacetModeler::erPointNotOnThis
@ erPointNotOnThis
Definition: FMContoursBase.h:82
FacetModeler::estLine
@ estLine
Definition: FMContoursBase.h:163
FacetModeler::estUnknown
@ estUnknown
Definition: FMContoursBase.h:160
FacetModeler::erWarnParamBounds
@ erWarnParamBounds
Definition: FMContoursBase.h:52
FacetModeler::erInvalidDirection
@ erInvalidDirection
Definition: FMContoursBase.h:109
FacetModeler::emfIgnoreMetadata
@ emfIgnoreMetadata
Definition: FMContoursBase.h:192
FacetModeler::ContourImplClass
ContourImplClass
DOM.
Definition: FMContoursBase.h:219
FacetModeler::Intersection::Intersection
Intersection(const OdGePoint2d &rPt, double dPA=0, double dPB=0, Types eIT=eitNone)
Definition: FMContoursBase.h:268
FacetModeler::eftTangents
@ eftTangents
Definition: FMContoursBase.h:207
FacetModeler::erWarnSmallContour
@ erWarnSmallContour
Definition: FMContoursBase.h:61
FacetModeler::erInvalidTransform
@ erInvalidTransform
Definition: FMContoursBase.h:85
FacetModeler::ecicUnknown
@ ecicUnknown
Definition: FMContoursBase.h:220
FacetModeler::MergeFlags
MergeFlags
Definition: FMContoursBase.h:187
FacetModeler::ecicCached
@ ecicCached
Definition: FMContoursBase.h:222
OdDouble
double OdDouble
Definition: DoubleArray.h:31
FacetModeler::elUnknown
@ elUnknown
Definition: FMContoursBase.h:177
FacetModeler::emfMergeOrigin
@ emfMergeOrigin
Definition: FMContoursBase.h:195
GePoint2d.h
FacetModeler::esicUnknown
@ esicUnknown
Definition: FMContoursBase.h:229
FacetModeler::Intersection::swapParams
Intersection & swapParams()
Definition: FMContoursBase.h:275
FacetModeler::Intersection::lessParamA
static bool lessParamA(const Intersection &rI1, const Intersection &rI2)
Definition: FMContoursBase.h:284
FacetModeler::erInvalidIndex
@ erInvalidIndex
Definition: FMContoursBase.h:76
FacetModeler::Intersection::ptPoint
OdGePoint2d ptPoint
Definition: FMContoursBase.h:291
FacetModeler::isWarning
bool isWarning(Result eRes)
Definition: FMContoursBase.h:145
FacetModeler::esicLast
@ esicLast
Definition: FMContoursBase.h:232
OdGePoint2d
Definition: GePoint2d.h:60