1 // File: LineConn2d_Object.h
2 // Created: 03.08.05 20:34:45
3 // Author: Alexander GRIGORIEV
4 // Copyright: Open Cascade 2005
7 #ifndef LineConn2d_Object_HeaderFile
8 #define LineConn2d_Object_HeaderFile
10 #include <LineConn2d_Box.h>
11 #include <NCollection_List.hxx>
14 * Data Object is represented by:
15 * - Polyline (a list of points) for one closed contour defioning the shape
16 * - Bounding box of the polyline.
17 * The Objects should be allocated/destroyed exclusively from the Model class.
20 class LineConn2d_Object
24 /// Iterator type, to retrieve the contour points
25 typedef NCollection_List<gp_XY>::Iterator PointIterator;
27 // ---------- PUBLIC METHODS ----------
29 /// Empty constructor.
30 inline LineConn2d_Object () {}
33 * Add a next point to the polyline of the given Object.
34 * You should be careful to provide a correct index value.
36 inline void AddPoint (const gp_XY& thePnt)
38 myPoints.Append (thePnt);
43 * Update the Object internal data after its initialisation. This method
44 * builds the bounding box and performs other preparations.
46 Standard_EXPORT void Update ();
49 * Query the bounding box.
51 inline const LineConn2d_Box& Box () const
55 * Query the number of points in the contour.
57 inline Standard_Integer NbPoints () const
58 { return myPoints.Extent(); }
61 * Get Iterator on points.
63 inline PointIterator PointsIterator () const
67 * Query the last point in the contour.
69 inline const gp_XY& LastPoint () const
70 { return myPoints.Last(); }
73 * Classify a point towards the polygon defined by the object
75 * The given point to be classified
77 * Tolerance for ON condition: if thePoint is nearer to any contour segment
78 * than the value theTol, the method returns False.
80 * True if the given point is outside the Object contour.
82 Standard_EXPORT Standard_Boolean IsOut (const gp_XY& thePoint,
83 const Standard_Real theTol)const;
86 // ---------- PROTECTED METHODS ----------
89 inline LineConn2d_Object (const Handle(NCollection_BaseAllocator)& theAlloc)
90 : myPoints (theAlloc) {}
93 // ---------- PRIVATE FIELDS ----------
95 NCollection_List<gp_XY> myPoints;
97 Standard_Boolean myIsModified : 1;
99 friend class LineConn2d_Model;