-// File: AIS_IdenticRelation.cxx
-// Created: Mon Mar 3 17:21:37 1997
-// Author: Jean-Pierre COMBE
-// <jpr>
-
+// Created on: 1997-03-03
+// Created by: Jean-Pierre COMBE
+// Copyright (c) 1997-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
#include <Standard_NotImplemented.hxx>
#include <AIS.hxx>
#include <AIS_Shape.hxx>
-#include <AIS_Drawer.hxx>
#include <BRep_Tool.hxx>
#include <Select3D_SensitiveCurve.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <SelectMgr_EntityOwner.hxx>
+#include <SelectMgr_Selection.hxx>
#include <TColStd_ListIteratorOfListOfTransient.hxx>
static Standard_Real Modulo2PI(const Standard_Real ANGLE)
{
- if ( ANGLE < 0 ) return Modulo2PI(ANGLE + 2*PI);
- else if ( ANGLE >= 2*PI ) return Modulo2PI(ANGLE - 2*PI);
+ if ( ANGLE < 0 ) return Modulo2PI(ANGLE + 2*M_PI);
+ else if ( ANGLE >= 2*M_PI ) return Modulo2PI(ANGLE - 2*M_PI);
return ANGLE;
}
{
Standard_Real diff = Abs(angle1-angle2);
if ( diff < precision ) return Standard_True;
- else if ( Abs(diff-2*PI) < precision ) return Standard_True;
+ else if ( Abs(diff-2*M_PI) < precision ) return Standard_True;
return Standard_False;
}
// jfa 15/10/2000 end
Standard_Real deltap = pSAttachM - pFAttach;
if ( deltap < 0 )
{
- deltap += 2*Standard_PI;
- pSAttachM += 2*Standard_PI;
+ deltap += 2 * M_PI;
+ pSAttachM += 2 * M_PI;
}
pSAttachM -= pFAttach;
- Standard_Real pmiddleout = pSAttachM/2.0 + Standard_PI;
+ Standard_Real pmiddleout = pSAttachM/2.0 + M_PI;
Standard_Real pcurpos1 = pcurpos;
// define where curpos lays
if ( pcurpos1 < pFAttach )
{
- pcurpos1 = pcurpos1 + 2*Standard_PI - pFAttach;
+ pcurpos1 = pcurpos1 + 2 * M_PI - pFAttach;
if ( pcurpos1 > pSAttachM ) // out
{
if ( pcurpos1 > pmiddleout ) pcurpos = pFAttach;
Standard_Real deltap = pSAttachM - pFAttach;
if ( deltap < 0 )
{
- deltap += 2*Standard_PI;
- pSAttachM += 2*Standard_PI;
+ deltap += 2 * M_PI;
+ pSAttachM += 2 * M_PI;
}
pSAttachM -= pFAttach;
- Standard_Real pmiddleout = pSAttachM/2.0 + Standard_PI;
+ Standard_Real pmiddleout = pSAttachM/2.0 + M_PI;
Standard_Real pcurpos1 = pcurpos;
// define where curpos lays
if ( pcurpos1 < pFAttach )
{
- pcurpos1 = pcurpos1 + 2*Standard_PI - pFAttach;
+ pcurpos1 = pcurpos1 + 2 * M_PI - pFAttach;
if ( pcurpos1 > pSAttachM ) // out
{
if ( pcurpos1 > pmiddleout ) pcurpos = pFAttach;
PrsMgr_PresentableObject::Compute( aProjector , aPresentation ) ;
}
-//=======================================================================
-//function : Compute
-//purpose :
-//=======================================================================
-void AIS_IdenticRelation::Compute(const Handle(PrsMgr_PresentationManager2d)& aPresentationManager2d,
- const Handle(Graphic2d_GraphicObject)& aGraphicObject,
- const Standard_Integer anInteger)
-{
-// Standard_NotImplemented::Raise("AIS_IdenticRelation::Compute(const Handle(PrsMgr_PresentationManager2d)&,const Handle(Graphic2d_GraphicObject)&,const Standard_Integer)");
- PrsMgr_PresentableObject::Compute( aPresentationManager2d ,aGraphicObject,anInteger) ;
-}
-
-void AIS_IdenticRelation::Compute(const Handle_Prs3d_Projector& aProjector, const Handle_Geom_Transformation& aTransformation, const Handle_Prs3d_Presentation& aPresentation)
+void AIS_IdenticRelation::Compute(const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTransformation, const Handle(Prs3d_Presentation)& aPresentation)
{
-// Standard_NotImplemented::Raise("AIS_IdenticRelation::Compute(const Handle_Prs3d_Projector&, const Handle_Geom_Transformation&, const Handle_Prs3d_Presentation&)");
+// Standard_NotImplemented::Raise("AIS_IdenticRelation::Compute(const Handle(Prs3d_Projector)&, const Handle(Geom_Transformation)&, const Handle(Prs3d_Presentation)&)");
PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation ) ;
}
// "identic" presentation
// note : if we are in the case of lines, we create a segment between
// myFAttach and mySAttach. In the case of Circles, we create
-// an arc of circle between the sames points.We Add a segment
+// an arc of circle between the sames points. We Add a segment
// to link Position to its projection on the curve described
// before.
//=======================================================================
if ( isCircle ) // case of Circles
{
- Handle(Geom_Circle) thecirc = (Handle(Geom_Circle)&) curv1;
+ Handle(Geom_Circle) thecirc = Handle(Geom_Circle)::DownCast (curv1);
Standard_Real udeb = ElCLib::Parameter(thecirc->Circ(),myFAttach);
Standard_Real ufin = ElCLib::Parameter(thecirc->Circ(),mySAttach);
Handle(Geom_TrimmedCurve) thecu = new Geom_TrimmedCurve(thecirc,udeb,ufin);
}
else if ( curv1->IsInstance(STANDARD_TYPE(Geom_Ellipse)) ) // case of ellipses
{
- Handle(Geom_Ellipse) theEll = (Handle(Geom_Ellipse)&) curv1;
+ Handle(Geom_Ellipse) theEll = Handle(Geom_Ellipse)::DownCast (curv1);
Standard_Real udeb = ElCLib::Parameter(theEll->Elips(),myFAttach);
Standard_Real ufin = ElCLib::Parameter(theEll->Elips(),mySAttach);
seg = new Select3D_SensitiveSegment(own, myFAttach, mySAttach);
aSelection->Add(seg);
- //attach = projection de Position() sur la curve;
+ //attach = projection of Position() on the curve;
gp_Vec v1 (myFAttach, mySAttach);
gp_Vec v2 (myFAttach, myPosition);
if ( v1.IsParallel(v2, Precision::Angular()) )
if ( curv1->IsInstance(STANDARD_TYPE(Geom_Line)) && curv2->IsInstance(STANDARD_TYPE(Geom_Line)) ) {
// we take the line curv1 like support
Handle(Geom_Line) thelin;
- if (isInfinite1 && !isInfinite2) thelin = (Handle(Geom_Line)&) curv2;
- else if (!isInfinite1 && isInfinite2) thelin = (Handle(Geom_Line)&) curv1;
- else thelin = (Handle(Geom_Line)&) curv1;
+ if (isInfinite1 && !isInfinite2) thelin = Handle(Geom_Line)::DownCast (curv2);
+ else if (!isInfinite1 && isInfinite2) thelin = Handle(Geom_Line)::DownCast (curv1);
+ else thelin = Handle(Geom_Line)::DownCast (curv1);
ComputeTwoLinesPresentation(aPrs, thelin, firstp1, lastp1, firstp2, lastp2, isInfinite1, isInfinite2);
}
// Treatement of the case of circles
else if ( curv1->IsInstance(STANDARD_TYPE(Geom_Circle)) && curv2->IsInstance(STANDARD_TYPE(Geom_Circle)) ) {
//gp_Pnt curpos;
- isCircle = Standard_True; // usefull for ComputeSelection
- const Handle(Geom_Circle)& thecirc = (Handle(Geom_Circle)&) curv1;
+ isCircle = Standard_True; // useful for ComputeSelection
+ Handle(Geom_Circle) thecirc (Handle(Geom_Circle)::DownCast (curv1));
ComputeTwoCirclesPresentation(aPrs, thecirc, firstp1, lastp1, firstp2, lastp2);
}
// Treatement of the case of ellipses
else if ( curv1->IsInstance(STANDARD_TYPE(Geom_Ellipse)) && curv2->IsInstance(STANDARD_TYPE(Geom_Ellipse)) )
{
- const Handle(Geom_Ellipse)& theEll = (Handle(Geom_Ellipse)&) curv1;
+ Handle(Geom_Ellipse) theEll (Handle(Geom_Ellipse)::DownCast (curv1));
ComputeTwoEllipsesPresentation(aPrs, theEll, firstp1, lastp1, firstp2, lastp2);
}
// jfa 10/10/2000 end
else
return;
- // Calcul de la presentation des edges projettees
+ // Calculate presentation of projected edges
if ( (myExtShape != 0) && !extCurv.IsNull()) {
if (myExtShape == 1 )
ComputeProjEdgePresentation(aPrs, TopoDS::Edge(myFShape), curv1, firstp1, lastp1);
myCenter = thecirc->Location();
Standard_Real aSegSize = thecirc->Radius()/5.0;
- Standard_Real rad = Standard_PI/5.0;
+ Standard_Real rad = M_PI / 5.0;
// I. Case of 2 complete circles
if ( circ1complete && circ2complete )
const Standard_Boolean isstatic)
{
Standard_Real aSegSize = thecirc->Radius()/5.0;
- Standard_Real rad = Standard_PI/5.0;
+ Standard_Real rad = M_PI / 5.0;
Standard_Real pFA = ElCLib::Parameter(thecirc->Circ(),firstp);
Standard_Real pSA = ElCLib::Parameter(thecirc->Circ(),lastp);
curpos.Translate(vprec*1e-5);
}
- Standard_Real rad = Standard_PI/5.0;
+ Standard_Real rad = M_PI / 5.0;
Standard_Real pcurpos = ElCLib::Parameter(cirNotAuto->Circ(),curpos);
Standard_Real pFAttach = pcurpos - rad;
Standard_Real pSAttach = pcurpos + rad;
Standard_Real pSPnt = ElCLib::Parameter(cirNotAuto, pntlast);
Standard_Real deltap = Modulo2PI(pSPnt - pFPnt)/2.0;
- Standard_Real rad = Standard_PI/5;
+ Standard_Real rad = M_PI / 5;
if ( deltap < rad )
{
myFAttach = pntfirst;
myCenter = theEll->Location();
Standard_Real aSegSize = theEll->MajorRadius()/5.0;
- Standard_Real rad = Standard_PI/5.0;
+ Standard_Real rad = M_PI / 5.0;
// I. Case of 2 complete ellipses
if ( circ1complete && circ2complete )
const Standard_Boolean isstatic)
{
Standard_Real aSegSize = theEll->MajorRadius()/5.0;
- Standard_Real rad = Standard_PI/5.0;
+ Standard_Real rad = M_PI / 5.0;
gp_Elips anEll = theEll->Elips();
curpos.Translate(vprec*1e-5);
}
- Standard_Real rad = Standard_PI/5.0;
+ Standard_Real rad = M_PI / 5.0;
// Standard_Real pcurpos = ElCLib::Parameter(anEll,curpos);
GeomAPI_ProjectPointOnCurve aProj (curpos, theEll);
Standard_Real pcurpos = aProj.LowerDistanceParameter();
Standard_Real pSPnt = ElCLib::Parameter(anEll, pntlast);
Standard_Real deltap = Modulo2PI(pSPnt - pFPnt)/2.0;
- Standard_Real rad = Standard_PI/5;
+ Standard_Real rad = M_PI / 5;
if ( deltap < rad )
{
myFAttach = pntfirst;
TColStd_ListIteratorOfListOfTransient it(Users());
if (it.More())
{
- const Handle(AIS_Shape)& USER = Handle(AIS_Shape)::DownCast(it.Value());
+ Handle(AIS_Shape) USER (Handle(AIS_Shape)::DownCast(it.Value()));
if (!USER.IsNull())
{
const TopoDS_Shape& SH =USER->Shape();
vals,
myFAttach,
curpos);
- // Calcul de la projection du vertex
+ // Calculate the projection of vertex
if ( myExtShape == 1)
ComputeProjVertexPresentation(aPrs,FVertex,myFAttach);
else if ( myExtShape == 2)
//function : ComputeDirection
//purpose : Compute a direction according to the different geometric
// elements connected to the vertex <VERT>, in way to not have
-// overlap between the symbol and them.
+// overlap between the symbol and them.
//=======================================================================
Standard_Boolean AIS_IdenticRelation::ComputeDirection(const TopoDS_Wire& aWire,
const TopoDS_Vertex& VERT,
gp_Dir d1, d2;
if ( curv1->IsInstance(STANDARD_TYPE(Geom_Circle)) ) {
- d1 = ComputeCircleDirection((Handle(Geom_Circle)&) curv1, VERT);
+ d1 = ComputeCircleDirection(Handle(Geom_Circle)::DownCast (curv1), VERT);
}
else if (curv1->IsInstance(STANDARD_TYPE(Geom_Line)) ) {
- d1 = ComputeLineDirection((Handle(Geom_Line)&) curv1, firstp1);
+ d1 = ComputeLineDirection(Handle(Geom_Line)::DownCast (curv1), firstp1);
}
else
return Standard_False;
if ( curv2->IsInstance(STANDARD_TYPE(Geom_Circle)) ) {
- d2 = ComputeCircleDirection( (Handle(Geom_Circle)&) curv2, VERT);
+ d2 = ComputeCircleDirection( Handle(Geom_Circle)::DownCast (curv2), VERT);
}
else if (curv2->IsInstance(STANDARD_TYPE(Geom_Line)) ) {
- d2 =ComputeLineDirection( (Handle(Geom_Line)&) curv2, firstp2);
+ d2 =ComputeLineDirection( Handle(Geom_Line)::DownCast (curv2), firstp2);
}
else
return Standard_False;
if ( !AIS::ComputeGeometry(VEdge, curv1, firstp1, lastp1) )
return Standard_False;
if ( curv1->IsInstance(STANDARD_TYPE(Geom_Circle)) ) {
- dF = ComputeCircleDirection( (Handle(Geom_Circle)&) curv1, VERT);
+ dF = ComputeCircleDirection( Handle(Geom_Circle)::DownCast (curv1), VERT);
}
else if (curv1->IsInstance(STANDARD_TYPE(Geom_Line)) ) {
- dF = ComputeLineDirection( (Handle(Geom_Line)&) curv1, firstp1);
+ dF = ComputeLineDirection( Handle(Geom_Line)::DownCast (curv1), firstp1);
}
else
return Standard_False;
if (myFShape.ShapeType() == TopAbs_VERTEX) {
V = TopoDS::Vertex(myFShape);
E = TopoDS::Edge(mySShape);
- numedge = 2;// edge = 2 iem shape
+ numedge = 2;// edge = 2nd shape
}
else {
V = TopoDS::Vertex(mySShape);
E = TopoDS::Edge(myFShape);
- numedge = 1; // edge = 1 ere shape
+ numedge = 1; // edge = 1st shape
}
gp_Pnt ptonedge1,ptonedge2;
Handle(Geom_Curve) aCurve;
aPrs->SetInfiniteState(isInfinite);
AIS::ComputeGeometry(V, myFAttach, myPlane, isOnPlanVertex);
- // on considere que seule la courbe peut etre projetee
+ // only the curve can be projected
if (!isOnPlanEdge && !isOnPlanVertex) return;
if (!isOnPlanEdge) {
// we take the median of the edges connected to vertices
gp_Dir myDir;
if ( aCurve->IsKind(STANDARD_TYPE(Geom_Line))) {
- myDir = ((Handle(Geom_Line)&) aCurve)->Lin().Direction();
+ myDir = Handle(Geom_Line)::DownCast (aCurve)->Lin().Direction();
myDir.Cross(myPlane->Pln().Axis().Direction());
}
else if (aCurve->IsKind(STANDARD_TYPE(Geom_Circle))) {
- Handle(Geom_Circle) CIR = (Handle(Geom_Circle)&) aCurve;
+ Handle(Geom_Circle) CIR = Handle(Geom_Circle)::DownCast (aCurve);
myDir.SetXYZ(myFAttach.XYZ() - CIR->Location().XYZ());
}
// jfa 10/10/2000
else if (aCurve->IsKind(STANDARD_TYPE(Geom_Ellipse))) {
- Handle(Geom_Ellipse) CIR = (Handle(Geom_Ellipse)&) aCurve;
+ Handle(Geom_Ellipse) CIR = Handle(Geom_Ellipse)::DownCast (aCurve);
myDir.SetXYZ(myFAttach.XYZ() - CIR->Location().XYZ());
}
// jfa 10/10/2000 end
myFAttach,
curpos);
if (myExtShape != 0) {
- if (!extCurv.IsNull()) { // c'est l'edge qui n'est pas dans le WP
- ComputeProjEdgePresentation(aPrs,E,(Handle(Geom_Line)&) aCurve,ptonedge1,ptonedge2);
+ if (!extCurv.IsNull()) { // the edge is not in the WP
+ ComputeProjEdgePresentation(aPrs,E,Handle(Geom_Line)::DownCast (aCurve),ptonedge1,ptonedge2);
}
}
}