1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #ifndef _Select3D_PointData_HeaderFile
15 #define _Select3D_PointData_HeaderFile
17 #include <Select3D_Pnt.hxx>
18 #include <Select3D_Pnt2d.hxx>
20 // A framework for safe management of Select3D_SensitivePoly polygons of 3D and 2D points
21 class Select3D_PointData {
25 // Constructs internal arrays of 2D and 3D points defined
26 // by number of points theNbPoints
27 Select3D_PointData (const Standard_Integer theNbPoints)
30 Standard_ConstructionError::Raise("Select3D_PointData");
32 mynbpoints = theNbPoints;
33 mypolyg3d = new Select3D_Pnt[mynbpoints];
34 mypolyg2d = new Select3D_Pnt2d[mynbpoints];
38 ~Select3D_PointData ()
44 // Sets Select3D_Pnt to internal array
45 // of 3D points if theIndex is valid
46 void SetPnt (const Standard_Integer theIndex,
47 const Select3D_Pnt& theValue)
49 if (theIndex < 0 || theIndex >= mynbpoints)
50 Standard_OutOfRange::Raise("Select3D_PointData::SetPnt");
51 mypolyg3d[theIndex] = theValue;
54 // Sets gp_Pnt to internal array
55 // of 3D points if theIndex is valid
56 void SetPnt (const Standard_Integer theIndex,
57 const gp_Pnt& theValue)
59 if (theIndex < 0 || theIndex >= mynbpoints)
60 Standard_OutOfRange::Raise("Select3D_PointData::SetPnt");
61 mypolyg3d[theIndex] = theValue;
64 // Sets Select3D_Pnt2d to internal array
65 // of 2D points if theIndex is valid
66 void SetPnt2d (const Standard_Integer theIndex,
67 const Select3D_Pnt2d& theValue)
69 if (theIndex < 0 || theIndex >= mynbpoints)
70 Standard_OutOfRange::Raise("Select3D_PointData::SetPnt2d");
71 mypolyg2d[theIndex] = theValue;
74 // Sets gp_Pnt2d to internal array
75 // of 2D points if theIndex is valid
76 void SetPnt2d (const Standard_Integer theIndex,
77 const gp_Pnt2d& theValue)
79 if (theIndex < 0 || theIndex >= mynbpoints)
80 Standard_OutOfRange::Raise("Select3D_PointData::SetPnt2d");
81 mypolyg2d[theIndex] = theValue;
84 // Returns 3D point from internal array
85 // if theIndex is valid
86 Select3D_Pnt Pnt (const Standard_Integer theIndex) const
88 if (theIndex < 0 || theIndex >= mynbpoints)
89 Standard_OutOfRange::Raise("Select3D_PointData::Pnt");
90 return mypolyg3d[theIndex];
93 // Returns 2D point from internal array
94 // if theIndex is valid
95 Select3D_Pnt2d Pnt2d (const Standard_Integer theIndex) const
97 if (theIndex < 0 || theIndex >= mynbpoints)
98 Standard_OutOfRange::Raise("Select3D_PointData::Pnt2d");
99 return mypolyg2d[theIndex];
102 // Returns size of internal arrays
103 const Standard_Integer Size () const
110 // Default constructor
111 Select3D_PointData () {}
113 Select3D_Pnt* mypolyg3d;
114 Select3D_Pnt2d* mypolyg2d;
115 Standard_Integer mynbpoints;