Back to home page

EIC code displayed by LXR

 
 

    


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

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
0030                  (const AnyPoint& thePoint,
0031                   const Handle(Graphic3d_Group) theGroup)
0032   {
0033     Standard_Real aX,aY,aZ;
0034     PointTool::Coord(thePoint,aX,aY,aZ);
0035     Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
0036     anArrayOfPoints->AddVertex (aX, aY, aZ);
0037     theGroup->AddPrimitiveArray (anArrayOfPoints);
0038   }
0039 
0040 public:
0041   Standard_EXPORT static void Add
0042                  (const Handle (Prs3d_Presentation)& thePrs,
0043                   const AnyPoint& thePoint,
0044                   const Handle (Prs3d_Drawer)& theDrawer)
0045   {
0046     Handle(Graphic3d_Group) aGroup = thePrs->CurrentGroup();
0047     aGroup->SetPrimitivesAspect(theDrawer->PointAspect()->Aspect());
0048     DrawPoint(thePoint, aGroup);
0049   }
0050 
0051   Standard_EXPORT static Standard_Boolean Match
0052                   (const AnyPoint& thePoint,
0053                   const Standard_Real theX,
0054                   const Standard_Real theY,
0055                   const Standard_Real theZ,
0056                   const Standard_Real theDistance)
0057   {
0058     Standard_Real aX,aY,aZ;
0059     PointTool::Coord(thePoint, aX, aY, aZ);
0060     return Sqrt((theX - aX)*(theX - aX) + (theY - aY)*(theY - aY)
0061                  + (theZ - aZ)*(theZ - aZ)) <= theDistance;
0062   }
0063 };
0064 
0065 #endif