Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:52

0001 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _Select3D_PointData_HeaderFile
0015 #define _Select3D_PointData_HeaderFile
0016 
0017 #include <Select3D_Pnt.hxx>
0018 
0019 // A framework for safe management of Select3D_SensitivePoly polygons of 3D points
0020 class Select3D_PointData
0021 {
0022 
0023 public:
0024 
0025   // Constructs internal array of 3D points defined
0026   // by number of points theNbPoints
0027   Select3D_PointData (const Standard_Integer theNbPoints)
0028   : mynbpoints(theNbPoints)
0029   {
0030     if (theNbPoints <= 0)
0031       throw Standard_ConstructionError("Select3D_PointData");
0032 
0033     mypolyg3d = new Select3D_Pnt[mynbpoints];
0034   }
0035 
0036   // Destructor
0037   ~Select3D_PointData ()
0038   {
0039     delete [] mypolyg3d;
0040   }
0041 
0042   // Sets Select3D_Pnt to internal array
0043   // of 3D points if theIndex is valid
0044   void SetPnt (const Standard_Integer theIndex,
0045                const Select3D_Pnt& theValue)
0046   {
0047     if (theIndex < 0 || theIndex >= mynbpoints)
0048       throw Standard_OutOfRange("Select3D_PointData::SetPnt");
0049     mypolyg3d[theIndex] = theValue;
0050   }
0051 
0052   // Sets gp_Pnt to internal array
0053   // of 3D points if theIndex is valid
0054   void SetPnt (const Standard_Integer theIndex,
0055                const gp_Pnt& theValue)
0056   {
0057     if (theIndex < 0 || theIndex >= mynbpoints)
0058       throw Standard_OutOfRange("Select3D_PointData::SetPnt");
0059     mypolyg3d[theIndex] = theValue;
0060   }
0061 
0062   // Returns 3D point from internal array
0063   // if theIndex is valid
0064   const Select3D_Pnt& Pnt (const Standard_Integer theIndex) const
0065   {
0066     if (theIndex < 0 || theIndex >= mynbpoints)
0067       throw Standard_OutOfRange("Select3D_PointData::Pnt");
0068     return mypolyg3d[theIndex];
0069   }
0070 
0071   // Returns 3D point from internal array
0072   // if theIndex is valid
0073   gp_Pnt Pnt3d (const Standard_Integer theIndex) const
0074   {
0075     if (theIndex < 0 || theIndex >= mynbpoints)
0076       throw Standard_OutOfRange("Select3D_PointData::Pnt");
0077     return mypolyg3d[theIndex];
0078   }
0079 
0080   // Returns size of internal arrays
0081   Standard_Integer Size () const
0082   {
0083     return mynbpoints;
0084   }
0085 
0086 private:
0087   Select3D_PointData (const Select3D_PointData&);
0088   Select3D_PointData& operator= (const Select3D_PointData&);
0089 
0090 private:
0091 
0092   Select3D_Pnt*    mypolyg3d;
0093   Standard_Integer mynbpoints;
0094 };
0095 
0096 #endif