0023510: Integration of test grid "vis" into the new testing system
[occt.git] / src / Prs2d / Prs2d_Point.cxx
CommitLineData
b311480e 1// Copyright (c) 1999-2012 OPEN CASCADE SAS
2//
3// The content of this file is subject to the Open CASCADE Technology Public
4// License Version 6.5 (the "License"). You may not use the content of this file
5// except in compliance with the License. Please obtain a copy of the License
6// at http://www.opencascade.org and read it completely before using this file.
7//
8// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10//
11// The Original Code and all software distributed under the License is
12// distributed on an "AS IS" basis, without warranty of any kind, and the
13// Initial Developer hereby disclaims all such warranties, including without
14// limitation, any warranties of merchantability, fitness for a particular
15// purpose or non-infringement. Please see the License for the specific terms
16// and conditions governing the rights and limitations under the License.
17
7fd59977 18#include <Prs2d_Point.ixx>
19
20Prs2d_Point::Prs2d_Point( const Handle(Graphic2d_GraphicObject)& aGO,
21 const gp_Pnt2d& aPnt,
22 const Aspect_TypeOfMarker aTOM,
23 const Quantity_Length aWSize,
24 const Quantity_Length aHSize,
25 const Quantity_PlaneAngle anAngle )
26
27 : Graphic2d_Line( aGO ),
28 myPoint( aPnt ),
29 myTOM( aTOM ),
30 myIndMark( 0 ),
31 myWSize( aWSize ),
32 myHSize( aHSize ),
33 myAngle( anAngle )
34{
35
36 if ( ( myWSize <= 0.0 ) || ( myHSize <= 0.0 ) )
37 myWSize = myHSize = 0.0;
38
39 myMinX = Standard_ShortReal(myPoint.X() - myWSize/2.);
40 myMinY = Standard_ShortReal(myPoint.Y() - myHSize/2.);
41 myMaxX = Standard_ShortReal(myPoint.X() + myWSize/2.);
42 myMaxY = Standard_ShortReal(myPoint.Y() + myHSize/2.);
43
44}
45
46void Prs2d_Point::Draw( const Handle(Graphic2d_Drawer)& aDrawer ) {
47
48 Standard_Boolean IsIn = Standard_False;
49
50 if ( !myGOPtr->IsTransformed() )
51 IsIn = aDrawer->IsIn( myMinX, myMaxX, myMinY, myMaxY );
52 else {
53 Standard_ShortReal minx, miny, maxx, maxy;
54 MinMax( minx, maxx, miny, maxy );
55 IsIn = aDrawer->IsIn( minx, maxx, miny, maxy );
56 }
57
58 if ( IsIn ) {
59
60 Standard_ShortReal a = Standard_ShortReal(myPoint.X());
61 Standard_ShortReal b = Standard_ShortReal(myPoint.Y());
62
63 if ( myGOPtr->IsTransformed() ) {
64
65 gp_GTrsf2d aTrsf = myGOPtr->Transform();
66 Standard_Real A = Standard_Real( a );
67 Standard_Real B = Standard_Real( b );
68 aTrsf.Transforms( A, B );
69 a = Standard_ShortReal( A );
70 b = Standard_ShortReal( B );
71 }
72
73 DrawMarkerAttrib( aDrawer );
74 aDrawer->MapMarkerFromTo( myIndMark, a, b, Standard_ShortReal(myWSize),
75 Standard_ShortReal(myHSize), Standard_ShortReal(myAngle) );
76 }
77
78}
79
80void Prs2d_Point::DrawElement( const Handle(Graphic2d_Drawer)& /*ADrawer*/,
81 const Standard_Integer /*anIndex*/ ) {
82
83}
84
85void Prs2d_Point::DrawVertex( const Handle(Graphic2d_Drawer)& /*aDrawer*/,
86 const Standard_Integer /*anIndex*/ ) {
87
88}
89
90Standard_Boolean Prs2d_Point::Pick( const Standard_ShortReal X,
91 const Standard_ShortReal Y,
92 const Standard_ShortReal aPrecision,
93 const Handle(Graphic2d_Drawer)& /*aDrawer*/ ) {
94
95 return IsInMinMax( X, Y, aPrecision );
96
97}
98
99void Prs2d_Point::SetPoint( const gp_Pnt2d& aPnt ) {
100 myPoint = aPnt;
101}
102
103void Prs2d_Point::SetMarker( const Aspect_TypeOfMarker aTOM ) {
104 myTOM = aTOM;
105}
106
107void Prs2d_Point::SetIndex( const Standard_Integer anInd ) {
108 myIndMark = anInd;
109}
110
111gp_Pnt2d Prs2d_Point::Point() const {
112 return myPoint;
113}
114
115Aspect_TypeOfMarker Prs2d_Point::Marker() const {
116 return myTOM;
117}
118
119void Prs2d_Point::Save(Aspect_FStream& aFStream) const
120{
121}