-// File: AIS_FixRelation.cdl
-// Created: Tue Dec 5 15:09:04 1996
-// Author: Flore Lantheaume/Odile Olivier
-// <ODL>
+// Created on: 1996-12-05
+// Created by: Flore Lantheaume/Odile Olivier
+// Copyright (c) 1996-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.
-#define BUC60915 //GG 05/06/01 Enable to compute the requested arrow size
-// if any in all dimensions.
-
-#include <Standard_NotImplemented.hxx>
-
-#include <AIS_FixRelation.ixx>
+#include <AIS.hxx>
+#include <AIS_FixRelation.hxx>
#include <AIS_Shape.hxx>
-
-#include <TopAbs_ShapeEnum.hxx>
-
-#include <SelectMgr_EntityOwner.hxx>
-#include <Select3D_SensitiveSegment.hxx>
-
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Wire.hxx>
-#include <TopExp.hxx>
-#include <TopLoc_Location.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-
-#include <TColStd_ListIteratorOfListOfTransient.hxx>
-
+#include <DsgPrs_FixPresentation.hxx>
+#include <ElCLib.hxx>
+#include <ElSLib.hxx>
+#include <Geom_Circle.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Line.hxx>
-#include <Geom_Circle.hxx>
#include <Geom_Plane.hxx>
-
+#include <Geom_Transformation.hxx>
+#include <gp_Ax1.hxx>
+#include <gp_Circ.hxx>
+#include <gp_Dir.hxx>
+#include <gp_Lin.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
-#include <gp_Dir.hxx>
-#include <gp_Ax1.hxx>
#include <gp_XYZ.hxx>
-
-#include <ElCLib.hxx>
-#include <ElSLib.hxx>
-
#include <Precision.hxx>
-
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_Projector.hxx>
+#include <Select3D_SensitiveSegment.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+#include <SelectMgr_Selection.hxx>
#include <Standard_DomainError.hxx>
-
-#include <DsgPrs_FixPresentation.hxx>
-
-#include <AIS.hxx>
+#include <Standard_NotImplemented.hxx>
+#include <Standard_Type.hxx>
+#include <TColStd_ListIteratorOfListOfTransient.hxx>
+#include <TopAbs_ShapeEnum.hxx>
+#include <TopExp.hxx>
+#include <TopLoc_Location.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Wire.hxx>
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
static Standard_Boolean InDomain(const Standard_Real fpar,
const Standard_Real lpar,
if (fpar >= 0.) {
return ((para >= fpar) && (para <= lpar));
}
- if (para >= (fpar+2*PI)) return Standard_True;
+ if (para >= (fpar+2*M_PI)) return Standard_True;
if (para <= lpar) return Standard_True;
return Standard_False;
}
const Handle(Geom_Plane)& aPlane,
const TopoDS_Wire& aWire)
:AIS_Relation(),
- myWire(aWire),
- haspos(Standard_False)
+ myWire(aWire)
{
myFShape = aShape;
myPlane = aPlane;
const gp_Pnt& aPosition,
const Standard_Real anArrowSize)
:AIS_Relation(),
- myWire(aWire),
- haspos(Standard_False)
+ myWire(aWire)
{
myFShape = aShape;
myPlane = aPlane;
myPosition = aPosition;
-#ifdef BUC60915
SetArrowSize( anArrowSize );
-#else
- myArrowSize = anArrowSize;
-#endif
myAutomaticPosition = Standard_False;
}
//=======================================================================
AIS_FixRelation::AIS_FixRelation(const TopoDS_Shape& aShape,
- const Handle(Geom_Plane)& aPlane):
-haspos(Standard_False)
+ const Handle(Geom_Plane)& aPlane)
{
myFShape = aShape;
myPlane = aPlane;
const TopoDS_Shape& aShape,
const Handle(Geom_Plane)& aPlane,
const gp_Pnt& aPosition,
- const Standard_Real anArrowSize):
-haspos(Standard_False)
+ const Standard_Real anArrowSize)
{
myFShape = aShape;
myPlane = aPlane;
myPosition = aPosition;
-#ifdef BUC60915
SetArrowSize( anArrowSize );
-#else
- myArrowSize = anArrowSize;
-#endif
myAutomaticPosition = Standard_False;
}
{
aPresentation->Clear();
- // Calcul du point de positionnement du symbole et du
- // point d'attache du segment de raccord sur la shape
+ // Calculate position of the symbol and
+ // point of attach of the segment on the shape
gp_Pnt curpos;
if (myFShape.ShapeType() == TopAbs_VERTEX)
ComputeVertex(TopoDS::Vertex(myFShape), curpos);
const gp_Dir& nor = myPlane->Axis().Direction();
- // calcul de la presentation
- //definition de la taille du symbole
-#ifdef BUC60915
+ // calculate presentation
+ // definition of the symbol size
if( !myArrowSizeIsDefined )
-#endif
myArrowSize = 5.;
- //creation du presentable
+ //creation of the presentation
DsgPrs_FixPresentation::Add(aPresentation,
myDrawer,
myPntAttach,
PrsMgr_PresentableObject::Compute( aProjector , aPresentation ) ;
}
-//=======================================================================
-//function : Compute
-//purpose : to avoid warning
-//=======================================================================
-
-void AIS_FixRelation::Compute(const Handle(PrsMgr_PresentationManager2d)& aPresentationManager2d,
- const Handle(Graphic2d_GraphicObject)& aGraphicObject,
- const Standard_Integer anInteger)
-{
-// Standard_NotImplemented::Raise("AIS_FixRelation::Compute(const Handle(PrsMgr_PresentationManager2d)&,const Handle(Graphic2d_GraphicObject)&,const Standard_Integer)");
- PrsMgr_PresentableObject::Compute( aPresentationManager2d ,aGraphicObject,anInteger) ;
-}
-
//=======================================================================
//function : Compute
//purpose :
//=======================================================================
-void AIS_FixRelation::Compute(const Handle_Prs3d_Projector& aProjector,
- const Handle_Geom_Transformation& aTransformation,
- const Handle_Prs3d_Presentation& aPresentation)
+void AIS_FixRelation::Compute(const Handle(Prs3d_Projector)& aProjector,
+ const Handle(Geom_Transformation)& aTransformation,
+ const Handle(Prs3d_Presentation)& aPresentation)
{
-// Standard_NotImplemented::Raise("AIS_FixRelation::Compute(const Handle_Prs3d_Projector&, const Handle_Geom_Transformation&, const Handle_Prs3d_Presentation&)");
+// Standard_NotImplemented::Raise("AIS_FixRelation::Compute(const Handle(Prs3d_Projector)&, const Handle(Geom_Transformation)&, const Handle(Prs3d_Presentation)&)");
PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation ) ;
}
{
Handle(SelectMgr_EntityOwner) own = new SelectMgr_EntityOwner(this,7);
- // creation d'un segment sensible pour le segment de raccordement
- // de la shape fixe au symbole 'Fix'
+ // creation of segment sensible for the linked segment
+ // of the shape fixed to symbol 'Fix'
Handle(Select3D_SensitiveSegment) seg;
seg = new Select3D_SensitiveSegment(own,
myPntAttach,
myPosition);
aSelection->Add(seg);
- // Creation de la zone sensible du symbole 'Fix'
+ // Creation of the sensible zone of symbol 'Fix'
gp_Dir norm = myPlane->Axis().Direction();
gp_Vec dirac(myPntAttach,myPosition);
dirac.Normalize();
gp_Vec norac = dirac.Crossed(gp_Vec(norm));
gp_Ax1 ax(myPosition, norm);
- norac.Rotate(ax, PI/8);
+ norac.Rotate(ax, M_PI/8);
norac*=(myArrowSize/2);
gp_Pnt P1 = myPosition.Translated(norac);
const gp_Pnt& lastp2) const
{
//---------------------------------------------------------
- // calcul du point d'attache
+ // calculate the point of attach
//---------------------------------------------------------
gp_Pnt curpos;
const gp_Pnt& lastp) const
{
//---------------------------------------------------------
- // calcul du point d'attache
+ // calculate the point of attach
//---------------------------------------------------------
gp_Pnt curpos;
gp_Vec transvec = vec*myArrowSize;
curpos = myPntAttach.Translated(transvec);
gp_Ax1 RotAx( myPntAttach, NormPln);
- curpos.Rotate(RotAx, PI/10);
+ curpos.Rotate(RotAx, M_PI/10);
}
return curpos;
//---------------------------------------------------------
// calcul du point de positionnement du symbole 'fix'
//---------------------------------------------------------
- //--> Dans le cas d'une droite
+ //--> In case of a straight line
if (curEdge->IsKind(STANDARD_TYPE(Geom_Line))){
gp_Lin glin = Handle(Geom_Line)::DownCast(curEdge)->Lin();
Standard_Real pfirst(ElCLib::Parameter(glin,ptbeg));
ComputeLinePosition(glin, curpos, pfirst, plast);
}
- //--> Dans le cas d'un cercle
+ //--> In case of a circle
else if (curEdge->IsKind(STANDARD_TYPE(Geom_Circle))) {
gp_Circ gcirc = Handle(Geom_Circle)::DownCast(curEdge)->Circ();
Standard_Real pfirst, plast;
Standard_Real& plast)
{
if (myAutomaticPosition) {
- // le point d'attache est choisi comme milieu du segment
+ // point of attach is chosen as middle of the segment
myPntAttach = ElCLib::Value((pfirst+ plast)/2, glin);
gp_Dir norm = myPlane ->Axis().Direction();
pos = myPosition;
Standard_Real linparam = ElCLib::Parameter(glin, pos);
- //cas ou la projection de position se situe entre les 2 vertex
+ // case if the projection of position is located between 2 vertices
// de l'edge
if ( (linparam >= pfirst) && (linparam <= plast) )
myPntAttach = ElCLib::Value(linparam,glin);
- // cas ou la projection de Position est en dehors des limites
- // de l'edge : alors on choisit comme point d'attache le point
- // le plus proche de la projection
+ // case if the projection of Position is outside of the limits
+ // of the edge : the point closest to the projection is chosen
+ // as the attach point
else {
Standard_Real pOnLin;
if (linparam > plast)
Standard_Real& pfirst,
Standard_Real& plast)
{
- // reajustement des parametres sur le cercle
- if (plast > 2*PI ) {
- Standard_Real nbtours = Floor(plast / (2*PI));
- plast -= nbtours*2*PI;
- pfirst -= nbtours*2*PI;
+ // readjust parametres on the circle
+ if (plast > 2*M_PI ) {
+ Standard_Real nbtours = Floor(plast / (2*M_PI));
+ plast -= nbtours*2*M_PI;
+ pfirst -= nbtours*2*M_PI;
}
if (myAutomaticPosition) {
- // le point d'attache est le "milieu" du segment (par rapport
- // aux parametres des vertex de debut et de fin de l'edge
+ // the point attach is the "middle" of the segment (relatively
+ // to the parametres of start and end vertices of the edge
Standard_Real circparam = (pfirst + plast)/2.;
if ( !InDomain(pfirst,plast,circparam)) {
- Standard_Real otherpar = circparam + PI;
- if (otherpar > 2*PI) otherpar -= 2*PI;
+ Standard_Real otherpar = circparam + M_PI;
+ if (otherpar > 2*M_PI) otherpar -= 2*M_PI;
circparam = otherpar;
}
} // if (myAutomaticPosition)
else {
- // cas ou la projection de myPosition est en dehors des 2
- // vertex de l'edge. Dans ce cas on reajuste le parametre
- // dans la portion valable du cercle
+ // case if the projection of myPosition is outside of 2
+ // vertices of the edge. In this case the parameter is readjusted
+ // in the valid part of the circle
pos = myPosition;
Standard_Real circparam = ElCLib::Parameter(gcirc, pos);
if ( !InDomain(pfirst,plast,circparam)) {
- Standard_Real otherpar = circparam + PI;
- if (otherpar > 2*PI) otherpar -= 2*PI;
+ Standard_Real otherpar = circparam + M_PI;
+ if (otherpar > 2*M_PI) otherpar -= 2*M_PI;
circparam = otherpar;
}