CFx SDK Documentation  2023 SP0
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__
double OdDouble
Definition: DoubleArray.h:31
static bool lessParamA(const Intersection &rI1, const Intersection &rI2)
static bool lessParamB(const Intersection &rI1, const Intersection &rI2)
Intersection(const OdGePoint2d &rPt, double dPA=0, double dPB=0, Types eIT=eitNone)
Intersection & swapParams()
bool isOk(Result eRes)
bool isWarning(Result eRes)
bool isError(Result eRes)
void swap(signal< Handler, SignalTraits, Allocator > &lhs, signal< Handler, SignalTraits, Allocator > &rhs)