CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
FMContoursBaseImp.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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 Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 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
28namespace 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
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
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:
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__
#define FMGEOMETRY_API
#define FMGEOMETRY_API_STATIC
bool operator!=(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:403
bool operator==(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:397
#define odmax(X, Y)
Definition: OdPlatform.h:35
unsigned int OdUInt32
ptrdiff_t OdIntPtr
Attributes2D & setSmooth(bool bSmooth)
Attributes2D getReversed() const
Attributes2D clone() const
Attributes2D & reverse()
static FMGEOMETRY_API_STATIC const Attributes2D kNull
Attributes2D & setHidden(bool bH)
Attributes2D(OdIntPtr uMeta, OdUInt32 uRawFlags)
Attributes2D & setExplodedArc(bool bExploded)
Attributes2D & setOrientation(FaceOrientation eOri)
FaceOrientation orientation() const
Attributes2D & setFlags(OdUInt32 uF)
FMGEOMETRY_API OdGePoint2d FindNearestPoint(const OdGePoint2d &ptOrigin, const std::vector< Intersection > &vecPoints)
FMGEOMETRY_API OdGePoint2d FindFarthestPoint(const OdGePoint2d &ptOrigin, const std::vector< Intersection > &vecPoints)
Result worstResult(Result eRes1, Result eRes2)