-// File: AIS_AngleDimension.cdl
-// Created: Tue Dec 5 15:09:04 1996
-// Author: Arnaud BOUZY/Odile Olivier
-// <ODL>
+// Created on: 1996-12-05
+// Created by: Arnaud BOUZY/Odile Olivier
+// Copyright (c) 1996-1999 Matra Datavision
+// 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.
+
#define BUC60655 //GG 22/03/00 Enable to compute correctly
// the arrow size at object creation time.
#include <GC_MakeConicalSurface.hxx>
#include <gce_MakePln.hxx>
#include <gce_MakeCone.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+
//=======================================================================
//function : Constructor
PrsMgr_PresentableObject::Compute( aProjector , aPresentation ) ;
}
-//=======================================================================
-//function : Compute
-//purpose : : to avoid warning
-//=======================================================================
-
-void AIS_AngleDimension::Compute(const Handle(PrsMgr_PresentationManager2d)& aPresentationManager2d,
- const Handle(Graphic2d_GraphicObject)& aGraphicObject,
- const Standard_Integer anInteger)
-{
-// Standard_NotImplemented::Raise("AIS_AngleDimension::Compute(const Handle(PrsMgr_PresentationManager2d)&,const Handle(Graphic2d_GraphicObject)&,const Standard_Integer)");
- PrsMgr_PresentableObject::Compute( aPresentationManager2d ,aGraphicObject,anInteger) ;
-}
-
void AIS_AngleDimension::Compute(const Handle_Prs3d_Projector& aProjector, const Handle_Geom_Transformation& aTransformation, const Handle_Prs3d_Presentation& aPresentation)
{
// Standard_NotImplemented::Raise("AIS_AngleDimension::Compute(const Handle_Prs3d_Projector&, const Handle_Geom_Transformation&, const Handle_Prs3d_Presentation&)");
if ( aType == STANDARD_TYPE(Geom_OffsetSurface) || Offset > 0.01 ) { //offset surface
aOffsetSurf = new Geom_OffsetSurface (aSurf, Offset);
aSurf = aOffsetSurf->Surface();
- BRepBuilderAPI_MakeFace mkFace(aSurf);
+ BRepBuilderAPI_MakeFace mkFace(aSurf, Precision::Confusion());
mkFace.Build();
if( !mkFace.IsDone() ) return;
tmpSurf.Initialize( mkFace.Face() );
aCurve = aSurf->VIso(midV);
myCircle = Handle(Geom_Circle)::DownCast(aCurve)->Circ();
- myPosition = ElCLib::Value(Standard_PI/2.0, myCircle);
+ myPosition = ElCLib::Value(M_PI / 2.0, myCircle);
myAutomaticPosition = Standard_False;
}
else {
#endif
- if (myVal <= Precision::Angular() || Abs( PI-myVal ) <= Precision::Angular())
+ if (myVal <= Precision::Angular() || Abs( M_PI-myVal ) <= Precision::Angular())
DsgPrs_AnglePresentation::Add(aPresentation,
myDrawer,
myVal,
Standard_Boolean In1(Standard_False);
Standard_Boolean In2(Standard_False);
if ( !(Abs(d1.Angle(d2) - Abs(myVal)) <= Precision::Confusion())
- && (Abs(myVal) < PI) ) {
+ && (Abs(myVal) < M_PI) ) {
Standard_Real parcent1 = ElCLib::Parameter(l1->Lin(), myCenter);
Standard_Real par11 = ElCLib::Parameter(l1->Lin(), ptat11);
Standard_Real par12 = ElCLib::Parameter(l1->Lin(), ptat12);
gp_Lin gpl2 = l2->Lin();
theaxis = gp_Lin(myCenter,myFDir^mySDir);
- if (myVal > PI) {
+ if (myVal > M_PI) {
theaxis.Reverse();
}
mySAttach = ElCLib::Value(par_p2_attach,gpl2);
}
}
- if ( myVal < PI) curpos.SetXYZ(.5*(myFAttach.XYZ()+mySAttach.XYZ()));
+ if ( myVal < M_PI) curpos.SetXYZ(.5*(myFAttach.XYZ()+mySAttach.XYZ()));
else {
curpos.SetXYZ(.5*(myFAttach.XYZ()+mySAttach.XYZ()));
gp_Vec transl(curpos, myCenter);
Standard_Real udeb = uc1;
Standard_Real ufin = uc2;
if (uco > ufin) {
- if (Abs(myVal)<PI) {
+ if (Abs(myVal)<M_PI) {
// test if uco is in the opposite sector
- if (uco > udeb+PI && uco < ufin+PI){
+ if (uco > udeb+M_PI && uco < ufin+M_PI){
dist = -dist;
}
}
Standard_Real FirstParAngleCirc, LastParAngleCirc, FirstParAttachCirc, LastParAttachCirc;
gp_Pnt EndOfArrow1, EndOfArrow2, ProjAttachPoint2;
gp_Dir DirOfArrow1, DirOfArrow2;
- gp_Dir axisdir = (myVal <= Precision::Angular() || Abs( PI-myVal ) <= Precision::Angular())?
+ gp_Dir axisdir = (myVal <= Precision::Angular() || Abs( M_PI-myVal ) <= Precision::Angular())?
myPlane->Pln().Axis().Direction() : (myFDir ^ mySDir);
Standard_Boolean isPlane = (myFirstSurfType == AIS_KOS_Plane)? Standard_True : Standard_False;
Handle( Select3D_SensitiveCurve ) SensCurve;
// Angle's arc or line
- if (myVal > Precision::Angular() && Abs( PI-myVal ) > Precision::Angular())
+ if (myVal > Precision::Angular() && Abs( M_PI-myVal ) > Precision::Angular())
{
curve = new Geom_TrimmedCurve( new Geom_Circle( AngleCirc ), FirstParAngleCirc, LastParAngleCirc );
SensCurve = new Select3D_SensitiveCurve( own, curve );
gp_Lin l2(cu2.Line());
// it is patch!
- if (Abs( myVal ) <= Precision::Angular() || Abs( PI - myVal ) <= Precision::Angular())
+ if (Abs( myVal ) <= Precision::Angular() || Abs( M_PI - myVal ) <= Precision::Angular())
/*
//---------------------------------------------------------
- // Cas de droites paralleles ( <=> angle nul a PI pres)
+ // Cas de droites paralleles ( <=> angle nul a M_PI pres)
if ((Abs(l1.Angle(l2)) < Precision::Angular()) ||
- (Abs((l1.Angle(l2) - PI)) < Precision::Angular()) )
+ (Abs((l1.Angle(l2) - M_PI)) < Precision::Angular()) )
*/
{
Standard_Real ufin = uc2;
if (uco > ufin) {
- if (Abs(myVal)<PI) {
+ if (Abs(myVal)<M_PI) {
// test if uco is in the opposing sector
- if (uco > udeb+PI && uco < ufin+PI){
- udeb = udeb + PI;
- ufin = ufin + PI;
+ if (uco > udeb+M_PI && uco < ufin+M_PI){
+ udeb = udeb + M_PI;
+ ufin = ufin + M_PI;
uc1 = udeb;
uc2 = ufin;
}
}
}
if (uco > ufin) {
- if ((uco-uc2) < (uc1-uco+(2*PI))) ufin = uco;
- else udeb = uco - 2*PI;
+ if ((uco-uc2) < (uc1-uco+(2*M_PI))) ufin = uco;
+ else udeb = uco - 2*M_PI;
}
p1 = ElCLib::Value(udeb,cer);
p2 = ElCLib::Value(ufin,cer);
Standard_Real ufin = uc2;
if (uco > ufin) {
- if (Abs(myVal)<PI) {
+ if (Abs(myVal)<M_PI) {
// test if uco is in the opposing sector
- if (uco > udeb+PI && uco < ufin+PI){
- udeb = udeb + PI;
- ufin = ufin + PI;
+ if (uco > udeb+M_PI && uco < ufin+M_PI){
+ udeb = udeb + M_PI;
+ ufin = ufin + M_PI;
uc1 = udeb;
uc2 = ufin;
}
}
if (uco > ufin) {
- if ((uco-uc2) < (uc1-uco+(2*PI))) {
+ if ((uco-uc2) < (uc1-uco+(2*M_PI))) {
ufin = uco;
}
else {
- udeb = uco - 2*PI;
+ udeb = uco - 2*M_PI;
}
}
if ( aType == STANDARD_TYPE(Geom_OffsetSurface) || Offset > 0.01 ) { //offset surface
aOffsetSurf = new Geom_OffsetSurface (aSurf, Offset);
aSurf = aOffsetSurf->Surface();
- BRepBuilderAPI_MakeFace mkFace(aSurf);
+ BRepBuilderAPI_MakeFace mkFace(aSurf, Precision::Confusion());
mkFace.Build();
if( !mkFace.IsDone() ) return;
tmpSurf.Initialize( mkFace.Face() );
aCurve = aSurf->VIso(midV);
myCircle = Handle(Geom_Circle)::DownCast(aCurve)->Circ();
- myPosition = ElCLib::Value(Standard_PI / 2.0, myCircle);
+ myPosition = ElCLib::Value(M_PI / 2.0, myCircle);
myAutomaticPosition = Standard_False;
}
else {
gp_Pnt AttachmentPnt;
gp_Pnt OppositePnt;
- gp_Pnt aPnt, tmpPnt;
- Quantity_Length X,Y,Z;
Standard_Real param = ElCLib::Parameter(myCircle, myPosition);
- aPnt = Apex;
+ gp_Pnt aPnt = Apex;
gp_Pnt P1 = ElCLib::Value(0., myCircle);
- gp_Pnt P2 = ElCLib::Value(Standard_PI, myCircle);
+ gp_Pnt P2 = ElCLib::Value(M_PI, myCircle);
- gce_MakePln mkPln(P1, P2, aPnt); // create a plane whitch defines plane for projection aPosition on it
+ gce_MakePln mkPln(P1, P2, aPnt); // create a plane whitch defines plane for projection aPosition on it
- aPnt = AIS::ProjectPointOnPlane(myPosition, mkPln.Value());
- tmpPnt = aPnt;
+ aPnt = AIS::ProjectPointOnPlane(myPosition, mkPln.Value());
+ gp_Pnt tmpPnt = aPnt;
if( aPnt.Distance(P1) < aPnt.Distance(P2) ){
AttachmentPnt = P1;
Standard_Real AttParam = ElCLib::Parameter(aCircle2, AttachmentPnt);
Standard_Real OppParam = ElCLib::Parameter(aCircle2, OppositePnt);
- while ( AttParam >= 2*Standard_PI ) AttParam -= 2*Standard_PI;
- while ( OppParam >= 2*Standard_PI ) OppParam -= 2*Standard_PI;
+ while ( AttParam >= 2 * M_PI ) AttParam -= 2 * M_PI;
+ while ( OppParam >= 2 * M_PI ) OppParam -= 2 * M_PI;
if( myPosition.Distance( myCircle.Location() ) <= myCircle.Radius() )
if( 2 * myCircle.Radius() > aCircle2.Radius() * 0.4 ) IsArrowOut = Standard_False; //four times more than an arrow size
-
- Graphic3d_Array1OfVertex V(1, 12);
-
- Standard_Real angle;
- param = ElCLib::Parameter(aCircle2, tmpPnt);
- if(IsArrowOut) {
- angle = OppParam - AttParam + Standard_PI/6; //An angle between AttParam and OppParam + 30 degrees
- param = AttParam - Standard_PI/12; //out parts of dimension line are 15 degrees
-
- while ( angle > 2*Standard_PI ) angle -= 2*Standard_PI;
- for( i = 0; i <= 11; i++ ) { //calculating of arc
- aPnt = ElCLib::Value(param + angle/11 * i, aCircle2);
- aPnt.Coord(X, Y, Z);
- V(i+1).SetCoord(X, Y, Z);
- }
-
- }
- else {
- angle = OppParam - AttParam;
- param = AttParam;
- while ( angle > 2*Standard_PI ) angle -= 2*Standard_PI;
- for( i = 0; i <= 11; i++ ) { //calculating of arc
- aPnt = ElCLib::Value(param + angle/11 * i, aCircle2);
- aPnt.Coord(X, Y, Z);
- V(i+1).SetCoord(X, Y, Z);
- }
+ param = AttParam;
+ Standard_Real angle = OppParam - AttParam;
+
+ if(IsArrowOut)
+ {
+ angle += M_PI / 6; //An angle between AttParam and OppParam + 30 degrees
+ param -= M_PI / 12; //out parts of dimension line are 15 degrees
}
-
- for(i = 1; i<=11; i++) {
- V(i).Coord(X, Y, Z);
- P1.SetCoord(X, Y, Z);
- V(i+1).Coord(X, Y, Z);
- P1.SetCoord(X, Y, Z);
+ while ( angle > 2. * M_PI ) angle -= 2. * M_PI;
- seg = new Select3D_SensitiveSegment(owner, P1, P2);
- aSelection->Add(seg);
+ gp_Pnt Vprev = ElCLib::Value(param, aCircle2);
+ for( i = 1; i <= 11; i++ ) //calculating of arc
+ {
+ gp_Pnt Vcur = ElCLib::Value(param + angle/11 * i, aCircle2);
+ seg = new Select3D_SensitiveSegment(owner, Vprev, Vcur);
+ aSelection->Add(seg);
+ Vprev = Vcur;
}
- tmpPnt = tmpPnt.Translated(gp_Vec(0, 0, -1)*2);
+ tmpPnt = tmpPnt.Translated(gp_Vec(0, 0, -2));
- Standard_Real size(Min(myVal/100.+1.e-6,myArrowSize+1.e-6));
+ const Standard_Real size(Min(myVal/100.+1.e-6,myArrowSize+1.e-6));
Handle( Select3D_SensitiveBox ) box = new Select3D_SensitiveBox( owner,
tmpPnt.X(),
tmpPnt.Y(),
tmpPnt.Z() + size);
aSelection->Add(box);
}
-
-
-