// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#include <BRep_Tool.ixx>
-#include <BRep_TFace.hxx>
-#include <BRep_TEdge.hxx>
-#include <BRep_TVertex.hxx>
-#include <BRep_CurveRepresentation.hxx>
-#include <BRep_CurveOnSurface.hxx>
+
+#include <BRep_Curve3D.hxx>
#include <BRep_CurveOnClosedSurface.hxx>
+#include <BRep_CurveOnSurface.hxx>
+#include <BRep_CurveRepresentation.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
-#include <BRep_PointRepresentation.hxx>
#include <BRep_ListIteratorOfListOfPointRepresentation.hxx>
-#include <BRep_Curve3D.hxx>
+#include <BRep_PointRepresentation.hxx>
#include <BRep_Polygon3D.hxx>
-#include <BRep_PolygonOnSurface.hxx>
#include <BRep_PolygonOnClosedSurface.hxx>
-#include <BRep_PolygonOnTriangulation.hxx>
#include <BRep_PolygonOnClosedTriangulation.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Iterator.hxx>
-#include <TopoDS_Wire.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopExp.hxx>
-#include <TopTools_MapOfShape.hxx>
+#include <BRep_PolygonOnSurface.hxx>
+#include <BRep_PolygonOnTriangulation.hxx>
+#include <BRep_TEdge.hxx>
+#include <BRep_TFace.hxx>
+#include <BRep_Tool.hxx>
+#include <BRep_TVertex.hxx>
#include <ElSLib.hxx>
+#include <Geom2d_Curve.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
+#include <Geom2dAdaptor.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_OffsetSurface.hxx>
#include <Geom_Plane.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
-#include <Geom_OffsetSurface.hxx>
+#include <Geom_Surface.hxx>
#include <Geom_TrimmedCurve.hxx>
-#include <Geom2d_TrimmedCurve.hxx>
-#include <ProjLib_ProjectedCurve.hxx>
-#include <GeomProjLib.hxx>
-#include <Geom2dAdaptor.hxx>
#include <GeomAdaptor_HCurve.hxx>
#include <GeomAdaptor_HSurface.hxx>
-#include <Precision.hxx>
-#include <Poly_Triangulation.hxx>
-#include <Poly_Polygon3D.hxx>
+#include <GeomProjLib.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Pnt2d.hxx>
+#include <NCollection_IncAllocator.hxx>
+#include <NCollection_Map.hxx>
#include <Poly_Polygon2D.hxx>
+#include <Poly_Polygon3D.hxx>
#include <Poly_PolygonOnTriangulation.hxx>
-
-#include <NCollection_Map.hxx>
-#include <NCollection_IncAllocator.hxx>
+#include <Poly_Triangulation.hxx>
+#include <Precision.hxx>
+#include <ProjLib_ProjectedCurve.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <Standard_NullObject.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopLoc_Location.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Wire.hxx>
+#include <TopTools_MapOfShape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
+#include <BRep_GCurve.hxx>
//modified by NIZNHY-PKV Fri Oct 17 14:13:29 2008f
static
const Handle(Geom_Surface)& BRep_Tool::Surface(const TopoDS_Face& F,
TopLoc_Location& L)
{
- Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &F.TShape());
+ const BRep_TFace* TF = static_cast<const BRep_TFace*>(F.TShape().get());
L = F.Location() * TF->Location();
return TF->Surface();
}
Handle(Geom_Surface) BRep_Tool::Surface(const TopoDS_Face& F)
{
- Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &F.TShape());
- TopLoc_Location L = F.Location() * TF->Location();
- Handle(Geom_Surface) S = TF->Surface();
+ const BRep_TFace* TF = static_cast<const BRep_TFace*>(F.TShape().get());
+ const Handle(Geom_Surface)& S = TF->Surface();
if(S.IsNull()) return S;
- Handle(Geom_Geometry) S1;
+ TopLoc_Location L = F.Location() * TF->Location();
if (!L.IsIdentity()) {
- S1 = S->Copy();
- S = Handle(Geom_Surface)::DownCast (S1);
- S->Transform(L.Transformation());
+ Handle(Geom_Geometry) aCopy = S->Transformed(L.Transformation());
+ Geom_Surface* aGS = static_cast<Geom_Surface*>(aCopy.get());
+ return Handle(Geom_Surface)(aGS);
}
return S;
}
// null handle if there is no triangulation.
//=======================================================================
-const Handle(Poly_Triangulation)&
-BRep_Tool::Triangulation(const TopoDS_Face& F,
- TopLoc_Location& L)
+const Handle(Poly_Triangulation)& BRep_Tool::Triangulation(const TopoDS_Face& F,
+ TopLoc_Location& L)
{
L = F.Location();
- return (*((Handle(BRep_TFace)*)&F.TShape()))->Triangulation();
+ const BRep_TFace* TF = static_cast<const BRep_TFace*>(F.TShape().get());
+ return TF->Triangulation();
}
//=======================================================================
Standard_Real BRep_Tool::Tolerance(const TopoDS_Face& F)
{
- Standard_Real p = (*((Handle(BRep_TFace)*)&F.TShape()))->Tolerance();
+ const BRep_TFace* TF = static_cast<const BRep_TFace*>(F.TShape().get());
+ Standard_Real p = TF->Tolerance();
Standard_Real pMin = Precision::Confusion();
if (p > pMin) return p;
else return pMin;
Standard_Boolean BRep_Tool::NaturalRestriction(const TopoDS_Face& F)
{
- return (*((Handle(BRep_TFace)*) &F.TShape()))->NaturalRestriction();
+ const BRep_TFace* TF = static_cast<const BRep_TFace*>(F.TShape().get());
+ return TF->NaturalRestriction();
}
//=======================================================================
Standard_Real& Last)
{
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsCurve3D()) {
- Handle(BRep_Curve3D) GC (Handle(BRep_Curve3D)::DownCast (cr));
+ const BRep_Curve3D* GC = static_cast<const BRep_Curve3D*>(cr.get());
L = E.Location() * GC->Location();
GC->Range(First,Last);
return GC->Curve3D();
Standard_Real& Last)
{
TopLoc_Location L;
- Handle(Geom_Curve) C = Curve(E,L,First,Last);
+ const Handle(Geom_Curve)& C = Curve(E,L,First,Last);
if ( !C.IsNull() ) {
- Handle(Geom_Geometry) C1;
if ( !L.IsIdentity() ) {
- C1 = C->Copy();
- C = Handle(Geom_Curve)::DownCast (C1);
- C->Transform(L.Transformation());
+ Handle(Geom_Geometry) aCopy = C->Transformed(L.Transformation());
+ Geom_Curve* aGC = static_cast<Geom_Curve*>(aCopy.get());
+ return Handle(Geom_Curve)(aGC);
}
}
return C;
Standard_Boolean BRep_Tool::IsGeometric(const TopoDS_Edge& E)
{
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
TopLoc_Location& L)
{
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsPolygon3D()) {
- Handle(BRep_Polygon3D) GC (Handle(BRep_Polygon3D)::DownCast (cr));
+ const BRep_Polygon3D* GC = static_cast<const BRep_Polygon3D*>(cr.get());
L = E.Location() * GC->Location();
return GC->Polygon3D();
}
Standard_Boolean Eisreversed = (E.Orientation() == TopAbs_REVERSED);
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsCurveOnSurface(S,loc)) {
- Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr));
+ const BRep_GCurve* GC = static_cast<const BRep_GCurve*>(cr.get());
GC->Range(First,Last);
if (GC->IsCurveOnClosedSurface() && Eisreversed)
return GC->PCurve2();
Standard_Real& Last)
{
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsCurveOnSurface()) {
- Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr));
+ const BRep_GCurve* GC = static_cast<const BRep_GCurve*>(cr.get());
C = GC->PCurve();
S = GC->Surface();
L = E.Location() * GC->Location();
Standard_Boolean Eisreversed = (E.Orientation() == TopAbs_REVERSED);
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsCurveOnSurface()) {
- Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr));
+ const BRep_GCurve* GC = static_cast<const BRep_GCurve*>(cr.get());
i++;
if (i > Index) break;
if (i == Index) {
static const Handle(Poly_Polygon2D) nullPolygon2D;
-Handle(Poly_Polygon2D)
- BRep_Tool::PolygonOnSurface(const TopoDS_Edge& E,
- const Handle(Geom_Surface)& S,
- const TopLoc_Location& L)
+Handle(Poly_Polygon2D) BRep_Tool::PolygonOnSurface(const TopoDS_Edge& E,
+ const Handle(Geom_Surface)& S,
+ const TopLoc_Location& L)
{
TopLoc_Location l = L.Predivided(E.Location());
Standard_Boolean Eisreversed = (E.Orientation() == TopAbs_REVERSED);
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
TopLoc_Location& L)
{
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsPolygonOnSurface()) {
- Handle(BRep_PolygonOnSurface) PS (Handle(BRep_PolygonOnSurface)::DownCast (cr));
+ const BRep_PolygonOnSurface* PS = static_cast<const BRep_PolygonOnSurface*>(cr.get());
P = PS->Polygon();
S = PS->Surface();
L = E.Location() * PS->Location();
Standard_Integer i = 0;
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsPolygonOnSurface()) {
- Handle(BRep_PolygonOnSurface) PS (Handle(BRep_PolygonOnSurface)::DownCast (cr));
+ const BRep_PolygonOnSurface* PS = static_cast<const BRep_PolygonOnSurface*>(cr.get());
i++;
if (i > Index) break;
if (i == Index) {
Standard_Boolean Eisreversed = (E.Orientation() == TopAbs_REVERSED);
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
TopLoc_Location& L)
{
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsPolygonOnTriangulation()) {
- Handle(BRep_PolygonOnTriangulation) PT (Handle(BRep_PolygonOnTriangulation)::DownCast (cr));
+ const BRep_PolygonOnTriangulation* PT =
+ static_cast<const BRep_PolygonOnTriangulation*>(cr.get());
P = PT->PolygonOnTriangulation();
T = PT->Triangulation();
L = E.Location() * PT->Location();
Standard_Integer i = 0;
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsPolygonOnTriangulation()) {
- Handle(BRep_PolygonOnTriangulation) PT (Handle(BRep_PolygonOnTriangulation)::DownCast (cr));
+ const BRep_PolygonOnTriangulation* PT =
+ static_cast<const BRep_PolygonOnTriangulation*>(cr.get());
i++;
if (i > Index) break;
if (i == Index) {
TopLoc_Location l = L.Predivided(E.Location());
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
TopLoc_Location l = L.Predivided(E.Location());
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
Standard_Real BRep_Tool::Tolerance(const TopoDS_Edge& E)
{
- Standard_Real p = (*((Handle(BRep_TEdge)*)&E.TShape()))->Tolerance();
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ Standard_Real p = TE->Tolerance();
Standard_Real pMin = Precision::Confusion();
if (p > pMin) return p;
else return pMin;
Standard_Boolean BRep_Tool::SameParameter(const TopoDS_Edge& E)
{
- return (*((Handle(BRep_TEdge)*)&E.TShape()))->SameParameter();
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ return TE->SameParameter();
}
//=======================================================================
Standard_Boolean BRep_Tool::SameRange(const TopoDS_Edge& E)
{
- return (*((Handle(BRep_TEdge)*)&E.TShape()))->SameRange();
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ return TE->SameRange();
}
//=======================================================================
Standard_Boolean BRep_Tool::Degenerated(const TopoDS_Edge& E)
{
- return (*((Handle(BRep_TEdge)*)&E.TShape()))->Degenerated();
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ return TE->Degenerated();
}
//=======================================================================
Standard_Real& Last)
{
// set the range to all the representations
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsCurve3D()) {
- Handle(BRep_Curve3D) CR (Handle(BRep_Curve3D)::DownCast (cr));
+ const BRep_Curve3D* CR = static_cast<const BRep_Curve3D*>(cr.get());
if (!CR->Curve3D().IsNull()) {
First = CR->First();
Last = CR->Last();
}
}
else if (cr->IsCurveOnSurface()) {
- Handle(BRep_GCurve) CR (Handle(BRep_GCurve)::DownCast (cr));
+ const BRep_GCurve* CR = static_cast<const BRep_GCurve*>(cr.get());
First = CR->First();
Last = CR->Last();
break;
TopLoc_Location l = L.Predivided(E.Location());
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsCurveOnSurface(S,l)) {
- Handle(BRep_GCurve)::DownCast (cr)->Range(First,Last);
+ const BRep_CurveOnSurface* CR = static_cast<const BRep_CurveOnSurface*>(cr.get());
+ CR->Range(First,Last);
break;
}
itcr.Next();
if (!itcr.More()) {
Range(E,First,Last);
}
- (*((Handle(BRep_TEdge)*)&E.TShape()))->Modified(Standard_True);
+ E.TShape()->Modified(Standard_True);
}
//=======================================================================
Standard_Boolean Eisreversed = (E.Orientation() == TopAbs_REVERSED);
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsCurveOnSurface(S,l)) {
if (cr->IsCurveOnClosedSurface() && Eisreversed)
- Handle(BRep_CurveOnClosedSurface)::DownCast (cr)->UVPoints2(PFirst,PLast);
+ {
+ const BRep_CurveOnClosedSurface* CR =
+ static_cast<const BRep_CurveOnClosedSurface*>(cr.get());
+ CR->UVPoints2(PFirst, PLast);
+ }
else
- Handle(BRep_CurveOnSurface)::DownCast (cr)->UVPoints(PFirst,PLast);
+ {
+ const BRep_CurveOnSurface* CR =
+ static_cast<const BRep_CurveOnSurface*>(cr.get());
+ CR->UVPoints(PFirst, PLast);
+ }
return;
}
itcr.Next();
Standard_Boolean Eisreversed = (E.Orientation() == TopAbs_REVERSED);
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
- const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
+ Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsCurveOnSurface(S,l)) {
if (cr->IsCurveOnClosedSurface() && Eisreversed)
- Handle(BRep_CurveOnClosedSurface)::DownCast (cr)->
- SetUVPoints2(PFirst,PLast);
+ {
+ BRep_CurveOnClosedSurface* CS = static_cast<BRep_CurveOnClosedSurface*>(cr.get());
+ CS->SetUVPoints2(PFirst, PLast);
+ }
else
- Handle(BRep_CurveOnSurface)::DownCast (cr)->
- SetUVPoints(PFirst,PLast);
+ {
+ BRep_CurveOnSurface* CS = static_cast<BRep_CurveOnSurface*>(cr.get());
+ CS->SetUVPoints(PFirst, PLast);
+ }
}
itcr.Next();
}
TopLoc_Location l2 = L2.Predivided(Eloc);
// find the representation
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
Standard_Boolean BRep_Tool::HasContinuity(const TopoDS_Edge& E)
{
- BRep_ListIteratorOfListOfCurveRepresentation itcr
- ((*((Handle(BRep_TEdge)*)&E.TShape()))->Curves());
+ const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(E.TShape().get());
+ BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
for (; itcr.More(); itcr.Next())
{
gp_Pnt BRep_Tool::Pnt(const TopoDS_Vertex& V)
{
- Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
-
- if (TV.IsNull())
+ const BRep_TVertex* TV = static_cast<const BRep_TVertex*>(V.TShape().get());
+
+ if (TV == 0)
{
Standard_NullObject::Raise("BRep_Tool:: TopoDS_Vertex hasn't gp_Pnt");
}
- gp_Pnt P = TV->Pnt();
- P.Transform(V.Location().Transformation());
- return P;
+ const gp_Pnt& P = TV->Pnt();
+ if (V.Location().IsIdentity())
+ {
+ return P;
+ }
+
+ return P.Transformed(V.Location().Transformation());
}
//=======================================================================
Standard_Real BRep_Tool::Tolerance(const TopoDS_Vertex& V)
{
- Handle(BRep_TVertex)& aTVert = *((Handle(BRep_TVertex)*)&V.TShape());
+ const BRep_TVertex* aTVert = static_cast<const BRep_TVertex*>(V.TShape().get());
- if (aTVert.IsNull())
+ if (aTVert == 0)
{
Standard_NullObject::Raise("BRep_Tool:: TopoDS_Vertex hasn't gp_Pnt");
}
//=======================================================================
Standard_Real BRep_Tool::Parameter(const TopoDS_Vertex& V,
- const TopoDS_Edge& E)
+ const TopoDS_Edge& E)
{
// Search the vertex in the edge
const Handle(Geom_Curve)& C = BRep_Tool::Curve(E,L,f,l);
L = L.Predivided(V.Location());
if (!C.IsNull() || Degenerated(E)) {
- BRep_ListIteratorOfListOfPointRepresentation itpr
- ((*((Handle(BRep_TVertex)*) &V.TShape()))->Points());
+ const BRep_TVertex* TV = static_cast<const BRep_TVertex*>(V.TShape().get());
+ BRep_ListIteratorOfListOfPointRepresentation itpr(TV->Points());
while (itpr.More()) {
const Handle(BRep_PointRepresentation)& pr = itpr.Value();
Handle(Geom2d_Curve) PC;
Handle(Geom_Surface) S;
BRep_Tool::CurveOnSurface(E,PC,S,L,f,l);
- L = L.Predivided(V.Location());
- BRep_ListIteratorOfListOfPointRepresentation itpr
- ((*((Handle(BRep_TVertex)*) &V.TShape()))->Points());
+ L = L.Predivided(V.Location());
+ const BRep_TVertex* TV = static_cast<const BRep_TVertex*>(V.TShape().get());
+ BRep_ListIteratorOfListOfPointRepresentation itpr(TV->Points());
while (itpr.More()) {
const Handle(BRep_PointRepresentation)& pr = itpr.Value();
else {
Handle(Geom2d_Curve) PC = BRep_Tool::CurveOnSurface(E,S,L,f,l);
- BRep_ListIteratorOfListOfPointRepresentation itpr
- ((*((Handle(BRep_TVertex)*) &V.TShape()))->Points());
+ const BRep_TVertex* TV = static_cast<const BRep_TVertex*>(V.TShape().get());
+ BRep_ListIteratorOfListOfPointRepresentation itpr(TV->Points());
while (itpr.More()) {
if (itpr.Value()->IsPointOnCurveOnSurface(PC,S,L))
const Handle(Geom_Curve)& C = BRep_Tool::Curve(E,L1,f,l);
L1 = L1.Predivided(V.Location());
if (!C.IsNull() || Degenerated(E)) {
- BRep_ListIteratorOfListOfPointRepresentation itpr
- ((*((Handle(BRep_TVertex)*) &V.TShape()))->Points());
+ const BRep_TVertex* TV = static_cast<const BRep_TVertex*>(V.TShape().get());
+ BRep_ListIteratorOfListOfPointRepresentation itpr(TV->Points());
while (itpr.More()) {
const Handle(BRep_PointRepresentation)& pr = itpr.Value();
TopLoc_Location L;
const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,L);
L = L.Predivided(V.Location());
- BRep_ListIteratorOfListOfPointRepresentation itpr
- ((*((Handle(BRep_TVertex)*) &V.TShape()))->Points());
+ const BRep_TVertex* TV = static_cast<const BRep_TVertex*>(V.TShape().get());
+ BRep_ListIteratorOfListOfPointRepresentation itpr(TV->Points());
+
// It is checked if there is PointRepresentation (case non Manifold)
-
while (itpr.More()) {
if (itpr.Value()->IsPointOnSurface(S,L)) {
return gp_Pnt2d(itpr.Value()->Parameter(),
return bRet;
}
+//=======================================================================
+//function : MaxTolerance
+//purpose :
+//=======================================================================
+Standard_Real BRep_Tool::MaxTolerance (const TopoDS_Shape& theShape,
+ const TopAbs_ShapeEnum theSubShape)
+{
+ Standard_Real aTol = 0.0;
+
+ // Explorer Shape-Subshape.
+ TopExp_Explorer anExpSS(theShape, theSubShape);
+ if (theSubShape == TopAbs_FACE)
+ {
+ for( ; anExpSS.More() ; anExpSS.Next() )
+ {
+ const TopoDS_Shape& aCurrentSubShape = anExpSS.Current();
+ aTol = Max(aTol, Tolerance(TopoDS::Face(aCurrentSubShape)));
+ }
+ }
+ else if (theSubShape == TopAbs_EDGE)
+ {
+ for( ; anExpSS.More() ; anExpSS.Next() )
+ {
+ const TopoDS_Shape& aCurrentSubShape = anExpSS.Current();
+ aTol = Max(aTol, Tolerance(TopoDS::Edge(aCurrentSubShape)));
+ }
+ }
+ else if (theSubShape == TopAbs_VERTEX)
+ {
+ for( ; anExpSS.More() ; anExpSS.Next() )
+ {
+ const TopoDS_Shape& aCurrentSubShape = anExpSS.Current();
+ aTol = Max(aTol, Tolerance(TopoDS::Vertex(aCurrentSubShape)));
+ }
+ }
+
+ return aTol;
+}