1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
|
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _BRepBuilderAPI_MakePolygon_HeaderFile
#define _BRepBuilderAPI_MakePolygon_HeaderFile
#ifndef _BRepLib_MakePolygon_HeaderFile
#include <BRepLib_MakePolygon.hxx>
#endif
#ifndef _BRepBuilderAPI_MakeShape_HeaderFile
#include <BRepBuilderAPI_MakeShape.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
class StdFail_NotDone;
class gp_Pnt;
class TopoDS_Vertex;
class TopoDS_Edge;
class TopoDS_Wire;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
//! Describes functions to build polygonal wires. A <br>
//! polygonal wire can be built from any number of points <br>
//! or vertices, and consists of a sequence of connected <br>
//! rectilinear edges. <br>
//! When a point or vertex is added to the polygon if <br>
//! it is identic to the previous point no edge is <br>
//! built. The method added can be used to test it. <br>
//! Construction of a Polygonal Wire <br>
//! You can construct: <br>
//! - a complete polygonal wire by defining all its points <br>
//! or vertices (limited to four), or <br>
//! - an empty polygonal wire and add its points or <br>
//! vertices in sequence (unlimited number). <br>
//! A MakePolygon object provides a framework for: <br>
//! - initializing the construction of a polygonal wire, <br>
//! - adding points or vertices to the polygonal wire under construction, and <br>
//! - consulting the result. <br>
class BRepBuilderAPI_MakePolygon : public BRepBuilderAPI_MakeShape {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
//! Initializes an empty polygonal wire, to which points or <br>
//! vertices are added using the Add function. <br>
//! As soon as the polygonal wire under construction <br>
//! contains vertices, it can be consulted using the Wire function. <br>
Standard_EXPORT BRepBuilderAPI_MakePolygon();
Standard_EXPORT BRepBuilderAPI_MakePolygon(const gp_Pnt& P1,const gp_Pnt& P2);
Standard_EXPORT BRepBuilderAPI_MakePolygon(const gp_Pnt& P1,const gp_Pnt& P2,const gp_Pnt& P3,const Standard_Boolean Close = Standard_False);
//! Constructs a polygonal wire from 2, 3 or 4 points. Vertices are <br>
//! automatically created on the given points. The polygonal wire is <br>
//! closed if Close is true; otherwise it is open. Further vertices can <br>
//! be added using the Add function. The polygonal wire under <br>
//! construction can be consulted at any time by using the Wire function. <br>
//! Example <br>
//! //an open polygon from four points <br>
//! TopoDS_Wire W = BRepBuilderAPI_MakePolygon(P1,P2,P3,P4); <br>
//! Warning: The process is equivalent to: <br>
//! initializing an empty polygonal wire, <br>
//! and adding the given points in sequence. <br>
//! Consequently, be careful when using this function: if the <br>
//! sequence of points p1 - p2 - p1 is found among the arguments of the <br>
//! constructor, you will create a polygonal wire with two <br>
//! consecutive coincident edges. <br>
Standard_EXPORT BRepBuilderAPI_MakePolygon(const gp_Pnt& P1,const gp_Pnt& P2,const gp_Pnt& P3,const gp_Pnt& P4,const Standard_Boolean Close = Standard_False);
Standard_EXPORT BRepBuilderAPI_MakePolygon(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2);
Standard_EXPORT BRepBuilderAPI_MakePolygon(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2,const TopoDS_Vertex& V3,const Standard_Boolean Close = Standard_False);
//! Constructs a polygonal wire from <br>
//! 2, 3 or 4 vertices. The polygonal wire is closed if Close is true; <br>
//! otherwise it is open (default value). Further vertices can be <br>
//! added using the Add function. The polygonal wire under <br>
//! construction can be consulted at any time by using the Wire function. <br>
//! Example <br>
//! //a closed triangle from three vertices <br>
//! TopoDS_Wire W = BRepBuilderAPI_MakePolygon(V1,V2,V3,Standard_True); <br>
//! Warning <br>
//! The process is equivalent to: <br>
//! - initializing an empty polygonal wire, <br>
//! - then adding the given points in sequence. <br>
//! So be careful, as when using this function, you could create a <br>
//! polygonal wire with two consecutive coincident edges if <br>
//! the sequence of vertices v1 - v2 - v1 is found among the <br>
//! constructor's arguments. <br>
Standard_EXPORT BRepBuilderAPI_MakePolygon(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2,const TopoDS_Vertex& V3,const TopoDS_Vertex& V4,const Standard_Boolean Close = Standard_False);
Standard_EXPORT void Add(const gp_Pnt& P) ;
//! Adds the point P or the vertex V at the end of the <br>
//! polygonal wire under construction. A vertex is <br>
//! automatically created on the point P. <br>
//! Warning <br>
//! - When P or V is coincident to the previous vertex, <br>
//! no edge is built. The method Added can be used to <br>
//! test for this. Neither P nor V is checked to verify <br>
//! that it is coincident with another vertex than the last <br>
//! one, of the polygonal wire under construction. It is <br>
//! also possible to add vertices on a closed polygon <br>
//! (built for example by using a constructor which <br>
//! declares the polygon closed, or after the use of the Close function). <br>
//! Consequently, be careful using this function: you might create: <br>
//! - a polygonal wire with two consecutive coincident edges, or <br>
//! - a non manifold polygonal wire. <br>
//! - P or V is not checked to verify if it is <br>
//! coincident with another vertex but the last one, of <br>
//! the polygonal wire under construction. It is also <br>
//! possible to add vertices on a closed polygon (built <br>
//! for example by using a constructor which declares <br>
//! the polygon closed, or after the use of the Close function). <br>
//! Consequently, be careful when using this function: you might create: <br>
//! - a polygonal wire with two consecutive coincident edges, or <br>
//! - a non-manifold polygonal wire. <br>
Standard_EXPORT void Add(const TopoDS_Vertex& V) ;
//! Returns true if the last vertex added to the constructed <br>
//! polygonal wire is not coincident with the previous one. <br>
Standard_EXPORT Standard_Boolean Added() const;
//! Closes the polygonal wire under construction. Note - this <br>
//! is equivalent to adding the first vertex to the polygonal <br>
//! wire under construction. <br>
Standard_EXPORT void Close() ;
Standard_EXPORT const TopoDS_Vertex& FirstVertex() const;
//! Returns the first or the last vertex of the polygonal wire under construction. <br>
//! If the constructed polygonal wire is closed, the first and the last vertices are identical. <br>
Standard_EXPORT const TopoDS_Vertex& LastVertex() const;
//! Returns true if this algorithm contains a valid polygonal <br>
//! wire (i.e. if there is at least one edge). <br>
//! IsDone returns false if fewer than two vertices have <br>
//! been chained together by this construction algorithm. <br>
Standard_EXPORT virtual Standard_Boolean IsDone() const;
//! Returns the edge built between the last two points or <br>
//! vertices added to the constructed polygonal wire under construction. <br>
//! Warning <br>
//! If there is only one vertex in the polygonal wire, the result is a null edge. <br>
Standard_EXPORT const TopoDS_Edge& Edge() const;
Standard_EXPORT operator TopoDS_Edge() const;
//! Returns the constructed polygonal wire, or the already <br>
//! built part of the polygonal wire under construction. <br>
//! Exceptions <br>
//! StdFail_NotDone if the wire is not built, i.e. if fewer than <br>
//! two vertices have been chained together by this construction algorithm. <br>
Standard_EXPORT const TopoDS_Wire& Wire() const;
Standard_EXPORT operator TopoDS_Wire() const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
BRepLib_MakePolygon myMakePolygon;
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif
|