1 // Created on: 1994-03-28
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Draw_Color.hxx>
19 #include <Draw_Display.hxx>
20 #include <Draw_Drawable3D.hxx>
21 #include <DrawTrSurf_Point.hxx>
23 #include <gp_Pnt2d.hxx>
24 #include <Standard_Stream.hxx>
25 #include <Standard_Type.hxx>
27 IMPLEMENT_STANDARD_RTTIEXT(DrawTrSurf_Point,Draw_Drawable3D)
29 //=======================================================================
30 //function : DrawTrSurf_Point
32 //=======================================================================
33 DrawTrSurf_Point::DrawTrSurf_Point(const gp_Pnt& P,
34 const Draw_MarkerShape Shape,
35 const Draw_Color& Col) :
43 //=======================================================================
44 //function : DrawTrSurf_Point
46 //=======================================================================
48 DrawTrSurf_Point::DrawTrSurf_Point(const gp_Pnt2d& P,
49 const Draw_MarkerShape Shape,
50 const Draw_Color& Col) :
51 myPoint(P.X(),P.Y(),0.),
58 //=======================================================================
61 //=======================================================================
63 Standard_Boolean DrawTrSurf_Point::Is3D() const
68 //=======================================================================
71 //=======================================================================
73 void DrawTrSurf_Point::DrawOn(Draw_Display& dis) const
75 dis.SetColor(myColor);
77 dis.DrawMarker(myPoint,myShape);
79 dis.DrawMarker(Point2d(),myShape);
82 //=======================================================================
85 //=======================================================================
87 gp_Pnt DrawTrSurf_Point::Point() const
92 //=======================================================================
95 //=======================================================================
97 void DrawTrSurf_Point::Point(const gp_Pnt& P)
100 is3D = Standard_True;
103 //=======================================================================
106 //=======================================================================
108 gp_Pnt2d DrawTrSurf_Point::Point2d() const
110 return gp_Pnt2d(myPoint.X(),myPoint.Y());
113 //=======================================================================
116 //=======================================================================
118 void DrawTrSurf_Point::Point2d(const gp_Pnt2d& P)
120 myPoint.SetCoord(P.X(),P.Y(),0);
121 is3D = Standard_False;
124 //=======================================================================
127 //=======================================================================
129 void DrawTrSurf_Point::Color(const Draw_Color& aColor)
134 //=======================================================================
137 //=======================================================================
139 Draw_Color DrawTrSurf_Point::Color() const
144 //=======================================================================
147 //=======================================================================
149 void DrawTrSurf_Point::Shape(const Draw_MarkerShape S)
154 //=======================================================================
157 //=======================================================================
159 Draw_MarkerShape DrawTrSurf_Point::Shape() const
164 //=======================================================================
167 //=======================================================================
169 Handle(Draw_Drawable3D) DrawTrSurf_Point::Copy() const
171 Handle(DrawTrSurf_Point) P;
173 P = new DrawTrSurf_Point(myPoint,myShape,myColor);
175 P = new DrawTrSurf_Point(Point2d(),myShape,myColor);
180 //=======================================================================
183 //=======================================================================
185 void DrawTrSurf_Point::Dump(Standard_OStream& S) const
187 #if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
188 std::ios::fmtflags F = S.flags();
189 S.setf(std::ios::scientific,std::ios::floatfield);
192 long form = S.setf(std::ios::scientific);
193 std::streamsize prec = S.precision(15);
196 S << "Point : " << myPoint.X() << ", " << myPoint.Y() << ", " << myPoint.Z() <<std::endl;
198 S << "Point 2d : " << myPoint.X() << ", " << myPoint.Y() <<std::endl;
199 #if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
207 //=======================================================================
210 //=======================================================================
212 void DrawTrSurf_Point::Whatis(Draw_Interpretor& S) const