X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FHEXABLOCK%2FHexEdgeShape.cxx;h=0b90d6b68ba005f99d38d2b6064d7d47608afd0a;hb=6100168b28f7fe487a360409ef4f8e7c38df4450;hp=bd34bb705e092d5f3fd1279b2d631a61db40849a;hpb=ab53385205fe062af0e87d4e14296b1492fe3611;p=modules%2Fhexablock.git diff --git a/src/HEXABLOCK/HexEdgeShape.cxx b/src/HEXABLOCK/HexEdgeShape.cxx index bd34bb7..0b90d6b 100755 --- a/src/HEXABLOCK/HexEdgeShape.cxx +++ b/src/HEXABLOCK/HexEdgeShape.cxx @@ -34,6 +34,19 @@ #include #include +#include + +/**************** +#include +#include +#include +#include +#include +#include +#include +#include +#include +*********************************/ BEGIN_NAMESPACE_HEXA @@ -50,6 +63,8 @@ EdgeShape::EdgeShape (NewShape* dad, int id) lin_end [dir_x] = lin_end [dir_y] = lin_end [dir_z] = 0; par_mini = 0; par_maxi = 0; + lin_radius = 0; + lin_angle = 0; } // ====================================================== getCurve BRepAdaptor_Curve* EdgeShape::getCurve () @@ -136,6 +151,19 @@ int EdgeShape::onExtremity (double* point) else return NOTHING; } +// ========================================================= definedBy +bool EdgeShape::definedBy (double p1[], double p2[]) +{ + if (maj_curve) + updateCurve (); + + bool rep = false; + if (samePoints (p1, lin_start)) + rep = samePoints (p2, lin_end); + else if (samePoints (p1, lin_end)) + rep = samePoints (p2, lin_start); + return rep; +} // ========================================================= getParam double EdgeShape::getParam (double* coord) { @@ -168,6 +196,13 @@ double EdgeShape::getParam (double* coord) return -1.0; GeomAdaptor_Curve adapt_curve (handle); + +/****************** + enum GeomAbs_CurveType { GeomAbs_Line, GeomAbs_Circle, GeomAbs_Ellipse, + GeomAbs_Hyperbola, GeomAbs_Parabola, GeomAbs_BezierCurve, + GeomAbs_BSplineCurve, GeomAbs_OtherCurve }; + **********************/ + double abscis = GCPnts_AbscissaPoint::Length (adapt_curve, umin, gparam); double hparam = abscis/lin_length; @@ -189,6 +224,9 @@ void EdgeShape::addAssociation (Edge* edge) is_associated = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + // ------- Cf GEOMImpl_IMeasureOperations.cxx + // ====================================================== updateCurve void EdgeShape::updateCurve () { @@ -216,5 +254,40 @@ void EdgeShape::updateCurve () // Extremites getPoint (0, lin_start); getPoint (1, lin_end); + + lin_radius = lin_angle = 0; + kind_of = (EnumKindOfShape) adapt_curve.GetType(); +#ifndef NO_CASCADE + if (kind_of==KS_Circle) + { + Handle(Geom_Circle) hgc = Handle(Geom_Circle)::DownCast (handle); + lin_radius = hgc->Radius (); + lin_angle = (par_maxi-par_mini)*180/M_PI; + } +#endif +} +// ====================================================== getAngle +double EdgeShape::getAngle () +{ + if (maj_curve) + updateCurve (); + + return lin_angle; +} +// ====================================================== getRadius +double EdgeShape::getRadius () +{ + if (maj_curve) + updateCurve (); + + return lin_radius; +} +// ====================================================== getRadius +EnumKindOfShape EdgeShape::kindOf () +{ + if (maj_curve) + updateCurve (); + + return kind_of; } END_NAMESPACE_HEXA