0023510: Integration of test grid "vis" into the new testing system
[occt.git] / src / Prs2d / Prs2d_Circularity.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_Circularity.ixx>
19
20Prs2d_Circularity::Prs2d_Circularity( const Handle(Graphic2d_GraphicObject)& aGO,
21 const Standard_Real aX,
22 const Standard_Real aY,
23 const Standard_Real aLength,
24 const Standard_Real anAngle )
25
26 : Prs2d_Tolerance( aGO, aX, aY, aLength, anAngle )
27{
28}
29
30void Prs2d_Circularity::Draw( const Handle(Graphic2d_Drawer)& aDrawer ) {
31
32 Standard_Boolean IsIn = Standard_False;
33
34 if ( !myGOPtr->IsTransformed() )
35 IsIn = aDrawer->IsIn( myMinX, myMaxX, myMinY, myMaxY );
36 else {
37 Standard_ShortReal minx, miny, maxx, maxy;
38 MinMax( minx, maxx, miny, maxy );
39 IsIn = aDrawer->IsIn( minx, maxx, miny, maxy );
40 }
41
42 if ( IsIn ) {
43
44 DrawLineAttrib( aDrawer );
45 Standard_ShortReal X1 = Standard_ShortReal( myX ),
46 Y1 = Standard_ShortReal( myY );
47 gp_Pnt2d P1( X1, Y1 ),
48 PR( myX, myY );
49 P1.Rotate( PR, myAngle );
50 X1 = Standard_ShortReal( P1.X() );
51 Y1 = Standard_ShortReal( P1.Y() );
52
53 if ( myGOPtr->IsTransformed () ) {
54 gp_GTrsf2d aTrsf = myGOPtr->Transform ();
55 Standard_Real a1, b1;
56 a1 = X1;
57 b1 = Y1;
58 aTrsf.Transforms( a1, b1 );
59 X1 = Standard_ShortReal( a1 );
60 Y1 = Standard_ShortReal( b1 );
61 }
c6541a0c 62 aDrawer->MapArcFromTo( X1, Y1, myLength/2, 0.0, Standard_ShortReal( 2. * M_PI ) );
7fd59977 63 }
64}
65
66void Prs2d_Circularity::Save(Aspect_FStream& aFStream) const
67{
68}