Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1995-03-13
0002 // Created by: Robert COUBLANC
0003 // Copyright (c) 1995-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Select3D_SensitiveCurve_HeaderFile
0018 #define _Select3D_SensitiveCurve_HeaderFile
0019 
0020 #include <Geom_Curve.hxx>
0021 #include <Select3D_SensitivePoly.hxx>
0022 #include <TColgp_HArray1OfPnt.hxx>
0023 #include <SelectMgr_SelectingVolumeManager.hxx>
0024 
0025 
0026 //! A framework to define a sensitive 3D curve.
0027 //! In some cases this class can raise Standard_ConstructionError and
0028 //! Standard_OutOfRange exceptions. For more details see Select3D_SensitivePoly.
0029 class Select3D_SensitiveCurve : public Select3D_SensitivePoly
0030 {
0031   DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveCurve, Select3D_SensitivePoly)
0032 public:
0033 
0034   //! Constructs a sensitive curve object defined by the
0035   //! owner theOwnerId, the curve theCurve, and the
0036   //! maximum number of points on the curve: theNbPnts.
0037   Select3D_SensitiveCurve (const Handle(SelectMgr_EntityOwner)& theOwnerId,
0038                            const Handle(Geom_Curve)& theCurve,
0039                            const Standard_Integer theNbPnts = 17)
0040   : Select3D_SensitivePoly (theOwnerId, Standard_True, theNbPnts)
0041   {
0042     loadPoints (theCurve, theNbPnts);
0043     mySFactor = 3;
0044   }
0045 
0046   //! Constructs a sensitive curve object defined by the
0047   //! owner theOwnerId and the set of points ThePoints.
0048   Standard_EXPORT Select3D_SensitiveCurve (const Handle(SelectMgr_EntityOwner)& theOwnerId,
0049                                            const Handle(TColgp_HArray1OfPnt)& thePoints);
0050 
0051   //! Creation of Sensitive Curve from Points.
0052   //!          Warning : This Method should disappear in the next version...
0053   Standard_EXPORT Select3D_SensitiveCurve (const Handle(SelectMgr_EntityOwner)& theOwnerId,
0054                                            const TColgp_Array1OfPnt& thePoints);
0055 
0056   //! Returns the copy of this
0057   Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
0058 
0059 private:
0060 
0061   void loadPoints (const Handle(Geom_Curve)& theCurve,
0062                    const Standard_Integer theNbPnts)
0063   {
0064     const Standard_Real aStep = (theCurve->LastParameter() - theCurve->FirstParameter()) / (theNbPnts - 1);
0065     Standard_Real aParam = theCurve->FirstParameter();
0066     for (Standard_Integer aPntIdx = 0; aPntIdx < myPolyg.Size(); ++aPntIdx)
0067     {
0068       myPolyg.SetPnt (aPntIdx, theCurve->Value (aParam));
0069       aParam += aStep;
0070     }
0071   }
0072 
0073 };
0074 
0075 DEFINE_STANDARD_HANDLE(Select3D_SensitiveCurve, Select3D_SensitivePoly)
0076 
0077 #endif // _Select3D_SensitiveCurve_HeaderFile