Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-10 09:17:52

0001 // Copyright (c) 2013-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 Prs3d_Point_HeaderFile
0015 #define Prs3d_Point_HeaderFile
0016 
0017 #include <Graphic3d_ArrayOfPoints.hxx>
0018 #include <Graphic3d_Group.hxx>
0019 #include <Prs3d_Drawer.hxx>
0020 #include <Prs3d_PointAspect.hxx>
0021 
0022 template <class AnyPoint, class PointTool>
0023 class Prs3d_Point
0024 {
0025 public:
0026   DEFINE_STANDARD_ALLOC
0027 
0028 private:
0029   Standard_EXPORT static void DrawPoint(const AnyPoint&               thePoint,
0030                                         const Handle(Graphic3d_Group) theGroup)
0031   {
0032     Standard_Real aX, aY, aZ;
0033     PointTool::Coord(thePoint, aX, aY, aZ);
0034     Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints(1);
0035     anArrayOfPoints->AddVertex(aX, aY, aZ);
0036     theGroup->AddPrimitiveArray(anArrayOfPoints);
0037   }
0038 
0039 public:
0040   Standard_EXPORT static void Add(const Handle(Prs3d_Presentation)& thePrs,
0041                                   const AnyPoint&                   thePoint,
0042                                   const Handle(Prs3d_Drawer)&       theDrawer)
0043   {
0044     Handle(Graphic3d_Group) aGroup = thePrs->CurrentGroup();
0045     aGroup->SetPrimitivesAspect(theDrawer->PointAspect()->Aspect());
0046     DrawPoint(thePoint, aGroup);
0047   }
0048 
0049   Standard_EXPORT static Standard_Boolean Match(const AnyPoint&     thePoint,
0050                                                 const Standard_Real theX,
0051                                                 const Standard_Real theY,
0052                                                 const Standard_Real theZ,
0053                                                 const Standard_Real theDistance)
0054   {
0055     Standard_Real aX, aY, aZ;
0056     PointTool::Coord(thePoint, aX, aY, aZ);
0057     return Sqrt((theX - aX) * (theX - aX) + (theY - aY) * (theY - aY) + (theZ - aZ) * (theZ - aZ))
0058            <= theDistance;
0059   }
0060 };
0061 
0062 #endif