0031313: Foundation Classes - Dump improvement for classes
[occt.git] / src / Prs3d / Prs3d_Point.hxx
CommitLineData
d5f74e42 1// Copyright (c) 2013-2014 OPEN CASCADE SAS
d7223c76 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
d7223c76 4//
d5f74e42 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
973c2be1 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.
d7223c76 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
d7223c76 13
14#ifndef _Prs3d_Point_H__
15#define _Prs3d_Point_H__
16
a577aaab 17#include <Graphic3d_ArrayOfPoints.hxx>
d7223c76 18#include <Graphic3d_Vertex.hxx>
19#include <Graphic3d_Group.hxx>
20#include <Prs3d_Drawer.hxx>
21#include <Prs3d_PointAspect.hxx>
22#include <Prs3d_Root.hxx>
d7223c76 23
24template <class AnyPoint, class PointTool>
25class Prs3d_Point : Prs3d_Root
26{
27public:
28 DEFINE_STANDARD_ALLOC
29
30private:
31 Standard_EXPORT static void DrawPoint
32 (const AnyPoint& thePoint,
33 const Handle(Graphic3d_Group) theGroup)
34 {
ee2be2a8 35 Standard_Real aX,aY,aZ;
d7223c76 36 PointTool::Coord(thePoint,aX,aY,aZ);
a577aaab 37 Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
38 anArrayOfPoints->AddVertex (aX, aY, aZ);
39 theGroup->AddPrimitiveArray (anArrayOfPoints);
d7223c76 40 }
41
42public:
43 Standard_EXPORT static void Add
44 (const Handle (Prs3d_Presentation)& thePresentation,
45 const AnyPoint& thePoint,
46 const Handle (Prs3d_Drawer)& theDrawer)
47 {
48 Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePresentation);
49 aGroup->SetPrimitivesAspect(theDrawer->PointAspect()->Aspect());
50 DrawPoint(thePoint, aGroup);
51 }
52
53 Standard_EXPORT static Standard_Boolean Match
54 (const AnyPoint& thePoint,
ee2be2a8 55 const Standard_Real theX,
56 const Standard_Real theY,
57 const Standard_Real theZ,
58 const Standard_Real theDistance)
d7223c76 59 {
ee2be2a8 60 Standard_Real aX,aY,aZ;
d7223c76 61 PointTool::Coord(thePoint, aX, aY, aZ);
62 return Sqrt((theX - aX)*(theX - aX) + (theY - aY)*(theY - aY)
63 + (theZ - aZ)*(theZ - aZ)) <= theDistance;
64 }
65};
ee2be2a8 66
d7223c76 67#endif