// Copyright (c) 1999-2012 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. inline void Prs2d_Diameter::CalcTxtPos(const Standard_Boolean theFromAbs) { if (!theFromAbs) { gp_Pnt2d thePnt1(myAppX1,myAppY1), thePnt2(myAppX2,myAppY2); if (myInside) { thePnt1.SetCoord(myX1,myY1); thePnt2.SetCoord(myX2,myY2); } gp_Vec2d VX( 1., 0. ), theVecI,theVecJ,theVec(thePnt2,thePnt1); Standard_Real theDist=thePnt1.Distance(thePnt2); theVec.Normalized(); theVecI = theVec.Reversed()*myTextPosH/theDist; theVecJ = theVec.Reversed().Rotated(M_PI/2)*myTextPosV/theDist; theVec.Rotate(-myTextAngle); thePnt2.Translate(theVecI); thePnt2.Translate(theVecJ); thePnt1.Translate(theVecI); thePnt1.Translate(theVecJ); Standard_Real theTxtAngle = VX.Angle( theVec ); gp_Pnt2d pntText; if ( theTxtAngle >= 0 && theTxtAngle <= M_PI/2 ) pntText = thePnt2.Translated(theVec/theDist); else if ( theTxtAngle > M_PI/2 && theTxtAngle <= M_PI ) { pntText = thePnt1.Translated(theVec.Reversed()/theDist) ; theTxtAngle = VX.Angle( theVec.Reversed() ); } else if ( theTxtAngle >= -M_PI/2 && theTxtAngle < 0 ) pntText = thePnt2.Translated(theVec/theDist); else if ( theTxtAngle >= -M_PI && theTxtAngle < -M_PI/2 ) { pntText = thePnt1.Translated(theVec.Reversed()/theDist); theTxtAngle = VX.Angle( theVec.Reversed() ); } myAbsAngle=theTxtAngle; myAbsX=pntText.X(); myAbsY=pntText.Y(); } }