X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=src%2FPrs3d%2FPrs3d_Point.hxx;h=81fd6aeb89fd5b174d2fb4af378e0f684efa97d7;hb=d7223c763e48ab84c4b299466a11ecec9ea79a57;hpb=8ba3c5e0730236b2c42f4acb55a8fa932b3e7d3b diff --git a/src/Prs3d/Prs3d_Point.hxx b/src/Prs3d/Prs3d_Point.hxx new file mode 100644 index 0000000000..81fd6aeb89 --- /dev/null +++ b/src/Prs3d/Prs3d_Point.hxx @@ -0,0 +1,70 @@ +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + +#ifndef _Prs3d_Point_H__ +#define _Prs3d_Point_H__ + + +#include +#include +#include +#include +#include +#include + +template +class Prs3d_Point : Prs3d_Root +{ +public: + DEFINE_STANDARD_ALLOC + +private: + Standard_EXPORT static void DrawPoint + (const AnyPoint& thePoint, + const Handle(Graphic3d_Group) theGroup) + { + Quantity_Length aX,aY,aZ; + PointTool::Coord(thePoint,aX,aY,aZ); + Graphic3d_Vertex aVertex(aX,aY,aZ); + theGroup->Marker(aVertex); + } + +public: + Standard_EXPORT static void Add + (const Handle (Prs3d_Presentation)& thePresentation, + const AnyPoint& thePoint, + const Handle (Prs3d_Drawer)& theDrawer) + { + Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePresentation); + aGroup->SetPrimitivesAspect(theDrawer->PointAspect()->Aspect()); + DrawPoint(thePoint, aGroup); + } + + Standard_EXPORT static Standard_Boolean Match + (const AnyPoint& thePoint, + const Quantity_Length theX, + const Quantity_Length theY, + const Quantity_Length theZ, + const Quantity_Length theDistance) + { + Quantity_Length aX,aY,aZ; + PointTool::Coord(thePoint, aX, aY, aZ); + return Sqrt((theX - aX)*(theX - aX) + (theY - aY)*(theY - aY) + + (theZ - aZ)*(theZ - aZ)) <= theDistance; + } +}; +#endif