1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-06 18:26:22 +03:00

0024023: Revamp the OCCT Handle -- downcast (manual)

Manual corrections of C-style casts of Handle types
This commit is contained in:
abv 2015-07-02 16:44:46 +03:00
parent c5f3a42524
commit a1eb3afd0d
12 changed files with 54 additions and 85 deletions

View File

@ -237,9 +237,6 @@ void AIS_SymmetricRelation::ComputeSelection(const Handle(SelectMgr_Selection)&
//=======================Pour les arcs====================== //=======================Pour les arcs======================
if(cu1.GetType() == GeomAbs_Circle) { if(cu1.GetType() == GeomAbs_Circle) {
BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L);
// Handle(Geom_Circle) geom_circ1 = (Handle(Geom_Circle)&) BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L);
//JR/Hp
Handle(Geom_Curve) aGeomCurve = BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L); Handle(Geom_Curve) aGeomCurve = BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L);
Handle(Geom_Circle) geom_circ1 = Handle(Geom_Circle)::DownCast (aGeomCurve) ; Handle(Geom_Circle) geom_circ1 = Handle(Geom_Circle)::DownCast (aGeomCurve) ;
// Handle(Geom_Circle) geom_circ1 = (const Handle(Geom_Circle)&) BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L); // Handle(Geom_Circle) geom_circ1 = (const Handle(Geom_Circle)&) BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L);

View File

@ -25,10 +25,7 @@ Standard_Boolean AIS_TypeFilter::IsOk(const Handle(SelectMgr_EntityOwner)& anObj
if(Handle(AIS_InteractiveObject)::DownCast(anObj->Selectable()).IsNull()) if(Handle(AIS_InteractiveObject)::DownCast(anObj->Selectable()).IsNull())
return Standard_False; return Standard_False;
//#ifndef OCCT_DEBUG Handle(AIS_InteractiveObject) anObject =
Handle(SelectMgr_SelectableObject) aSelectableObject = anObj->Selectable() ; Handle(AIS_InteractiveObject)::DownCast (anObj->Selectable());
return Handle(AIS_InteractiveObject)::DownCast (aSelectableObject)->Type()== myKind; return ! anObject.IsNull() && anObject->Type()== myKind;
//#else
// return ((Handle(AIS_InteractiveObject)&)anObj->Selectable())->Type()== myKind;
//#endif
} }

View File

@ -260,7 +260,7 @@ static Handle(Geom2d_Curve) Couture(const TopoDS_Edge& E,
while (itcr.More()) { while (itcr.More()) {
Handle(BRep_CurveRepresentation)& cr = itcr.Value(); Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsCurveOnSurface(S,l)) { if (cr->IsCurveOnSurface(S,l)) {
Handle(BRep_GCurve)& GC = Handle(BRep_GCurve)::DownCast (cr); Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr));
if (GC->IsCurveOnClosedSurface() && Eisreversed) if (GC->IsCurveOnClosedSurface() && Eisreversed)
return GC->PCurve2(); return GC->PCurve2();
else else

View File

@ -137,7 +137,7 @@ void BndLib_Add3dCurve::Add( const Adaptor3d_Curve& C,
Abs(Bs->LastParameter() - U2) > Precision::Parametric(Tol)) { Abs(Bs->LastParameter() - U2) > Precision::Parametric(Tol)) {
Handle(Geom_Geometry) G = Bs->Copy(); Handle(Geom_Geometry) G = Bs->Copy();
Handle(Geom_BSplineCurve)& Bsaux = Handle(Geom_BSplineCurve)::DownCast (G); Handle(Geom_BSplineCurve) Bsaux (Handle(Geom_BSplineCurve)::DownCast (G));
Standard_Real u1 = U1, u2 = U2; Standard_Real u1 = U1, u2 = U2;
//// modified by jgv, 24.10.01 for BUC61031 //// //// modified by jgv, 24.10.01 for BUC61031 ////
if (Bsaux->IsPeriodic()) if (Bsaux->IsPeriodic())

View File

@ -913,7 +913,7 @@ Standard_Real GeomAdaptor_Surface::UResolution(const Standard_Real R3d) const
} }
case GeomAbs_Torus: case GeomAbs_Torus:
{ {
Handle(Geom_ToroidalSurface)& S = Handle(Geom_ToroidalSurface)::DownCast (mySurface); Handle(Geom_ToroidalSurface) S (Handle(Geom_ToroidalSurface)::DownCast (mySurface));
const Standard_Real R = S->MajorRadius() + S->MinorRadius(); const Standard_Real R = S->MajorRadius() + S->MinorRadius();
if(R>Precision::Confusion()) if(R>Precision::Confusion())
Res = R3d/(2.*R); Res = R3d/(2.*R);
@ -921,7 +921,7 @@ Standard_Real GeomAdaptor_Surface::UResolution(const Standard_Real R3d) const
} }
case GeomAbs_Sphere: case GeomAbs_Sphere:
{ {
Handle(Geom_SphericalSurface)& S = Handle(Geom_SphericalSurface)::DownCast (mySurface); Handle(Geom_SphericalSurface) S (Handle(Geom_SphericalSurface)::DownCast (mySurface));
const Standard_Real R = S->Radius(); const Standard_Real R = S->Radius();
if(R>Precision::Confusion()) if(R>Precision::Confusion())
Res = R3d/(2.*R); Res = R3d/(2.*R);
@ -929,7 +929,7 @@ Standard_Real GeomAdaptor_Surface::UResolution(const Standard_Real R3d) const
} }
case GeomAbs_Cylinder: case GeomAbs_Cylinder:
{ {
Handle(Geom_CylindricalSurface)& S = Handle(Geom_CylindricalSurface)::DownCast (mySurface); Handle(Geom_CylindricalSurface) S (Handle(Geom_CylindricalSurface)::DownCast (mySurface));
const Standard_Real R = S->Radius(); const Standard_Real R = S->Radius();
if(R>Precision::Confusion()) if(R>Precision::Confusion())
Res = R3d/(2.*R); Res = R3d/(2.*R);
@ -941,7 +941,7 @@ Standard_Real GeomAdaptor_Surface::UResolution(const Standard_Real R3d) const
// Pas vraiment borne => resolution inconnue // Pas vraiment borne => resolution inconnue
return Precision::Parametric(R3d); return Precision::Parametric(R3d);
} }
Handle(Geom_ConicalSurface)& S = Handle(Geom_ConicalSurface)::DownCast (mySurface); Handle(Geom_ConicalSurface) S (Handle(Geom_ConicalSurface)::DownCast (mySurface));
Handle(Geom_Curve) C = S->VIso(myVLast); Handle(Geom_Curve) C = S->VIso(myVLast);
const Standard_Real Rayon1 = Handle(Geom_Circle)::DownCast (C)->Radius(); const Standard_Real Rayon1 = Handle(Geom_Circle)::DownCast (C)->Radius();
C = S->VIso(myVFirst); C = S->VIso(myVFirst);
@ -999,7 +999,7 @@ Standard_Real GeomAdaptor_Surface::VResolution(const Standard_Real R3d) const
} }
case GeomAbs_Torus: case GeomAbs_Torus:
{ {
Handle(Geom_ToroidalSurface)& S = Handle(Geom_ToroidalSurface)::DownCast (mySurface); Handle(Geom_ToroidalSurface) S (Handle(Geom_ToroidalSurface)::DownCast (mySurface));
const Standard_Real R = S->MinorRadius(); const Standard_Real R = S->MinorRadius();
if(R>Precision::Confusion()) if(R>Precision::Confusion())
Res = R3d/(2.*R); Res = R3d/(2.*R);
@ -1007,7 +1007,7 @@ Standard_Real GeomAdaptor_Surface::VResolution(const Standard_Real R3d) const
} }
case GeomAbs_Sphere: case GeomAbs_Sphere:
{ {
Handle(Geom_SphericalSurface)& S = Handle(Geom_SphericalSurface)::DownCast (mySurface); Handle(Geom_SphericalSurface) S (Handle(Geom_SphericalSurface)::DownCast (mySurface));
const Standard_Real R = S->Radius(); const Standard_Real R = S->Radius();
if(R>Precision::Confusion()) if(R>Precision::Confusion())
Res = R3d/(2.*R); Res = R3d/(2.*R);

View File

@ -145,7 +145,7 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
const IntPatch_IType typl = L->ArcType(); const IntPatch_IType typl = L->ArcType();
if(typl == IntPatch_Analytic) { if(typl == IntPatch_Analytic) {
Standard_Real u1,v1,u2,v2; Standard_Real u1,v1,u2,v2;
Handle(IntPatch_ALine)& ALine = Handle(IntPatch_ALine)::DownCast (L); Handle(IntPatch_ALine) ALine (Handle(IntPatch_ALine)::DownCast (L));
seqp.Clear(); seqp.Clear();
nbvtx = GeomInt_LineTool::NbVertex(L); nbvtx = GeomInt_LineTool::NbVertex(L);
for(i=1;i<nbvtx;i++) { for(i=1;i<nbvtx;i++) {
@ -171,7 +171,7 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
} // if(typl == IntPatch_Analytic) { } // if(typl == IntPatch_Analytic) {
else if(typl == IntPatch_Walking) { else if(typl == IntPatch_Walking) {
Standard_Real u1,v1,u2,v2; Standard_Real u1,v1,u2,v2;
Handle(IntPatch_WLine)& WLine = Handle(IntPatch_WLine)::DownCast (L); Handle(IntPatch_WLine) WLine (Handle(IntPatch_WLine)::DownCast (L));
seqp.Clear(); seqp.Clear();
nbvtx = GeomInt_LineTool::NbVertex(L); nbvtx = GeomInt_LineTool::NbVertex(L);
for(i=1;i<nbvtx;i++) { for(i=1;i<nbvtx;i++) {
@ -287,7 +287,7 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
else if (typl != IntPatch_Restriction) { else if (typl != IntPatch_Restriction) {
seqp.Clear(); seqp.Clear();
// //
Handle(IntPatch_GLine)& GLine = Handle(IntPatch_GLine)::DownCast (L); Handle(IntPatch_GLine) GLine (Handle(IntPatch_GLine)::DownCast (L));
// //
if(typl == IntPatch_Circle || typl == IntPatch_Ellipse) { if(typl == IntPatch_Circle || typl == IntPatch_Ellipse) {
TreatCircle(L, Tol); TreatCircle(L, Tol);
@ -726,7 +726,7 @@ void GeomInt_LineConstructor::TreatCircle(const Handle(IntPatch_Line)& aLine,
IntPatch_IType aType; IntPatch_IType aType;
// //
aType=aLine->ArcType(); aType=aLine->ArcType();
Handle(IntPatch_GLine)& aGLine=Handle(IntPatch_GLine)::DownCast (aLine); Handle(IntPatch_GLine) aGLine (Handle(IntPatch_GLine)::DownCast (aLine));
// //
bRejected=RejectMicroCircle(aGLine, aType, aTol); bRejected=RejectMicroCircle(aGLine, aType, aTol);
if (bRejected) { if (bRejected) {

View File

@ -2244,7 +2244,7 @@ static void PutIntVertices(Handle(IntPatch_Line)& Line,
if(nbp < 3) if(nbp < 3)
return; return;
Handle(IntPatch_WLine)& WLine = Handle(IntPatch_WLine)::DownCast (Line); Handle(IntPatch_WLine) WLine (Handle(IntPatch_WLine)::DownCast (Line));
Standard_Integer ip = 0, iv = 0; Standard_Integer ip = 0, iv = 0;
gp_Pnt aPnt; gp_Pnt aPnt;
IntPatch_Point thePnt; IntPatch_Point thePnt;

View File

@ -1900,8 +1900,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer ,
if(IType == IntPatch_Walking) nbw++; if(IType == IntPatch_Walking) nbw++;
else if(IType == IntPatch_Restriction) { else if(IType == IntPatch_Restriction) {
nbr++; nbr++;
Handle(IntPatch_RLine)& rlin = Handle(IntPatch_RLine) rlin (Handle(IntPatch_RLine)::DownCast (line));
Handle(IntPatch_RLine)::DownCast (line);
if(rlin->IsArcOnS1()) nbr1++; if(rlin->IsArcOnS1()) nbr1++;
if(rlin->IsArcOnS2()) nbr2++; if(rlin->IsArcOnS2()) nbr2++;
} }
@ -1937,8 +1936,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer ,
nbllc++; nbllc++;
const Handle(IntPatch_Line)& LineK = LineConstructor.Line(k); const Handle(IntPatch_Line)& LineK = LineConstructor.Line(k);
if (LineK->ArcType() == IntPatch_Analytic) { if (LineK->ArcType() == IntPatch_Analytic) {
Handle(IntPatch_ALine)& alin = Handle(IntPatch_ALine) alin (Handle(IntPatch_ALine)::DownCast (LineK));
Handle(IntPatch_ALine)::DownCast (LineK);
nbvtx=alin->NbVertex(); nbvtx=alin->NbVertex();
nbva+=nbvtx; nba++; nbva+=nbvtx; nba++;
for(v=1;v<=nbvtx;v++) { for(v=1;v<=nbvtx;v++) {
@ -1946,8 +1944,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer ,
} }
} }
else if (LineK->ArcType() == IntPatch_Restriction) { else if (LineK->ArcType() == IntPatch_Restriction) {
Handle(IntPatch_RLine)& rlin = Handle(IntPatch_RLine) rlin (Handle(IntPatch_RLine)::DownCast (LineK));
Handle(IntPatch_RLine)::DownCast (LineK);
nbvtx=rlin->NbVertex(); nbvtx=rlin->NbVertex();
nbvr+=nbvtx; nbr++; nbvr+=nbvtx; nbr++;
for(v=1;v<=nbvtx;v++) { for(v=1;v<=nbvtx;v++) {
@ -1955,8 +1952,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer ,
} }
} }
else if (LineK->ArcType() == IntPatch_Walking) { else if (LineK->ArcType() == IntPatch_Walking) {
Handle(IntPatch_WLine)& wlin = Handle(IntPatch_WLine) wlin (Handle(IntPatch_WLine)::DownCast (LineK));
Handle(IntPatch_WLine)::DownCast (LineK);
nbvtx=wlin->NbVertex(); nbvtx=wlin->NbVertex();
nbvw+=nbvtx; nbw++; nbvw+=nbvtx; nbw++;
for(v=1;v<=nbvtx;v++) { for(v=1;v<=nbvtx;v++) {
@ -1964,8 +1960,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer ,
} }
} }
else { else {
Handle(IntPatch_GLine)& glin = Handle(IntPatch_GLine) glin (Handle(IntPatch_GLine)::DownCast (LineK));
Handle(IntPatch_GLine)::DownCast (LineK);
nbvtx=glin->NbVertex(); nbvtx=glin->NbVertex();
nbvg+=nbvtx; nbg++; nbvg+=nbvtx; nbg++;
for(v=1;v<=nbvtx;v++) { for(v=1;v<=nbvtx;v++) {

View File

@ -199,7 +199,7 @@ static Standard_Real LocalFirstParameter (const Handle(IntPatch_Line)& L)
switch (typl) { switch (typl) {
case IntPatch_Analytic: case IntPatch_Analytic:
{ {
Handle(IntPatch_ALine)& alin = Handle(IntPatch_ALine)::DownCast (L); Handle(IntPatch_ALine) alin (Handle(IntPatch_ALine)::DownCast (L));
if (alin->HasFirstPoint()) { if (alin->HasFirstPoint()) {
firstp = alin->FirstPoint().ParameterOnLine(); firstp = alin->FirstPoint().ParameterOnLine();
} }
@ -215,7 +215,7 @@ static Standard_Real LocalFirstParameter (const Handle(IntPatch_Line)& L)
case IntPatch_Restriction: case IntPatch_Restriction:
{ {
Handle(IntPatch_RLine)& rlin = Handle(IntPatch_RLine)::DownCast (L); Handle(IntPatch_RLine) rlin (Handle(IntPatch_RLine)::DownCast (L));
if (rlin->HasFirstPoint()) { if (rlin->HasFirstPoint()) {
firstp = rlin->FirstPoint().ParameterOnLine(); firstp = rlin->FirstPoint().ParameterOnLine();
} }
@ -227,7 +227,7 @@ static Standard_Real LocalFirstParameter (const Handle(IntPatch_Line)& L)
case IntPatch_Walking: case IntPatch_Walking:
{ {
Handle(IntPatch_WLine)& wlin = Handle(IntPatch_WLine)::DownCast (L); Handle(IntPatch_WLine) wlin (Handle(IntPatch_WLine)::DownCast (L));
if (wlin->HasFirstPoint()) { if (wlin->HasFirstPoint()) {
firstp = wlin->FirstPoint().ParameterOnLine(); firstp = wlin->FirstPoint().ParameterOnLine();
} }
@ -239,7 +239,7 @@ static Standard_Real LocalFirstParameter (const Handle(IntPatch_Line)& L)
default: default:
{ {
Handle(IntPatch_GLine)& glin = Handle(IntPatch_GLine)::DownCast (L); Handle(IntPatch_GLine) glin (Handle(IntPatch_GLine)::DownCast (L));
if (glin->HasFirstPoint()) { if (glin->HasFirstPoint()) {
firstp = glin->FirstPoint().ParameterOnLine(); firstp = glin->FirstPoint().ParameterOnLine();
} }
@ -278,7 +278,7 @@ static Standard_Real LocalLastParameter (const Handle(IntPatch_Line)& L)
switch (typl) { switch (typl) {
case IntPatch_Analytic: case IntPatch_Analytic:
{ {
Handle(IntPatch_ALine)& alin = Handle(IntPatch_ALine)::DownCast (L); Handle(IntPatch_ALine) alin (Handle(IntPatch_ALine)::DownCast (L));
if (alin->HasLastPoint()) { if (alin->HasLastPoint()) {
lastp = alin->LastPoint().ParameterOnLine(); lastp = alin->LastPoint().ParameterOnLine();
@ -295,7 +295,7 @@ static Standard_Real LocalLastParameter (const Handle(IntPatch_Line)& L)
case IntPatch_Restriction: case IntPatch_Restriction:
{ {
Handle(IntPatch_RLine)& rlin = Handle(IntPatch_RLine)::DownCast (L); Handle(IntPatch_RLine) rlin (Handle(IntPatch_RLine)::DownCast (L));
if (rlin->HasLastPoint()) { if (rlin->HasLastPoint()) {
lastp = rlin->LastPoint().ParameterOnLine(); lastp = rlin->LastPoint().ParameterOnLine();
@ -307,7 +307,7 @@ static Standard_Real LocalLastParameter (const Handle(IntPatch_Line)& L)
} }
case IntPatch_Walking: case IntPatch_Walking:
{ {
Handle(IntPatch_WLine)& wlin = Handle(IntPatch_WLine)::DownCast (L); Handle(IntPatch_WLine) wlin (Handle(IntPatch_WLine)::DownCast (L));
if (wlin->HasLastPoint()) { if (wlin->HasLastPoint()) {
lastp = wlin->LastPoint().ParameterOnLine(); lastp = wlin->LastPoint().ParameterOnLine();
@ -320,7 +320,7 @@ static Standard_Real LocalLastParameter (const Handle(IntPatch_Line)& L)
default: default:
{ {
Handle(IntPatch_GLine)& glin = Handle(IntPatch_GLine)::DownCast (L); Handle(IntPatch_GLine) glin (Handle(IntPatch_GLine)::DownCast (L));
if (glin->HasLastPoint()) { if (glin->HasLastPoint()) {
lastp = glin->LastPoint().ParameterOnLine(); lastp = glin->LastPoint().ParameterOnLine();
@ -562,7 +562,7 @@ static void AddLine(const Handle(IntPatch_Line)& L,
IntPatch_IType typl = L->ArcType(); IntPatch_IType typl = L->ArcType();
switch (typl) { switch (typl) {
case IntPatch_Analytic: { case IntPatch_Analytic: {
Handle(IntPatch_ALine)& ALine = Handle(IntPatch_ALine)::DownCast (L); Handle(IntPatch_ALine) ALine (Handle(IntPatch_ALine)::DownCast (L));
Handle(IntPatch_ALine) alig; Handle(IntPatch_ALine) alig;
if(L->TransitionOnS1() == IntSurf_Undecided) if(L->TransitionOnS1() == IntSurf_Undecided)
alig = new IntPatch_ALine(ALine->Curve(),L->IsTangent()); alig = new IntPatch_ALine(ALine->Curve(),L->IsTangent());
@ -582,7 +582,7 @@ static void AddLine(const Handle(IntPatch_Line)& L,
break; break;
} }
case IntPatch_Walking: { //-- **************************************** case IntPatch_Walking: { //-- ****************************************
Handle(IntPatch_WLine)& WLine = Handle(IntPatch_WLine)::DownCast (L); Handle(IntPatch_WLine) WLine (Handle(IntPatch_WLine)::DownCast (L));
const Handle(IntSurf_LineOn2S)& Lori = WLine->Curve(); const Handle(IntSurf_LineOn2S)& Lori = WLine->Curve();
Handle(IntSurf_LineOn2S) LineOn2S = new IntSurf_LineOn2S(); Handle(IntSurf_LineOn2S) LineOn2S = new IntSurf_LineOn2S();
Standard_Integer ParamMinOnLine = (Standard_Integer) WLine->Vertex(i).ParameterOnLine(); Standard_Integer ParamMinOnLine = (Standard_Integer) WLine->Vertex(i).ParameterOnLine();
@ -623,7 +623,7 @@ static void AddLine(const Handle(IntPatch_Line)& L,
break; break;
} }
case IntPatch_Restriction: { case IntPatch_Restriction: {
Handle(IntPatch_RLine)& RLine = Handle(IntPatch_RLine)::DownCast (L); Handle(IntPatch_RLine) RLine (Handle(IntPatch_RLine)::DownCast (L));
IndexLastVertex=2; IndexLastVertex=2;
IndexFirstVertex=1; IndexFirstVertex=1;
Handle(IntPatch_RLine) rlig; Handle(IntPatch_RLine) rlig;
@ -661,7 +661,7 @@ static void AddLine(const Handle(IntPatch_Line)& L,
case IntPatch_Hyperbola: case IntPatch_Hyperbola:
case IntPatch_Circle: case IntPatch_Circle:
case IntPatch_Ellipse: { case IntPatch_Ellipse: {
Handle(IntPatch_GLine)& GLine = Handle(IntPatch_GLine)::DownCast (L); Handle(IntPatch_GLine) GLine (Handle(IntPatch_GLine)::DownCast (L));
Handle(IntPatch_GLine) glig; Handle(IntPatch_GLine) glig;
switch (typl) { switch (typl) {
case IntPatch_Lin: case IntPatch_Lin:
@ -1025,34 +1025,34 @@ static void TestWLineToRLine(const IntPatch_SequenceOfLine& slinref,
iv = indicesV1(i); iv = indicesV1(i);
Handle(Adaptor2d_HCurve2d) arc; Handle(Adaptor2d_HCurve2d) arc;
if ((WLine->Vertex(iv).*pIsOnDomS)()) arc = (WLine->Vertex(iv).*pArcOnS)(); if ((WLine->Vertex(iv).*pIsOnDomS)()) arc = (WLine->Vertex(iv).*pArcOnS)();
else arc = (const Handle(Adaptor2d_HCurve2d)&) arcsResolved(iv); else arc = Handle(Adaptor2d_HCurve2d)::DownCast (arcsResolved(iv));
if (!arc.IsNull()) mapArcsV1.Add(arc); if (!arc.IsNull()) mapArcsV1.Add(arc);
} }
for (i=1; i <= indicesV2.Length(); i++) { for (i=1; i <= indicesV2.Length(); i++) {
iv = indicesV2(i); iv = indicesV2(i);
Handle(Adaptor2d_HCurve2d) arc; Handle(Adaptor2d_HCurve2d) arc;
if ((WLine->Vertex(iv).*pIsOnDomS)()) arc = (WLine->Vertex(iv).*pArcOnS)(); if ((WLine->Vertex(iv).*pIsOnDomS)()) arc = (WLine->Vertex(iv).*pArcOnS)();
else arc = (const Handle(Adaptor2d_HCurve2d)&) arcsResolved(iv); else arc = Handle(Adaptor2d_HCurve2d)::DownCast (arcsResolved(iv));
if (!arc.IsNull() && mapArcsV1.Contains(arc)) mapArcs.Add(arc); if (!arc.IsNull() && mapArcsV1.Contains(arc)) mapArcs.Add(arc);
} }
// for each common arc // for each common arc
for (Standard_Integer ia=1; ia <= mapArcs.Extent(); ia++) { for (Standard_Integer ia=1; ia <= mapArcs.Extent(); ia++) {
const Handle(Adaptor2d_HCurve2d)& arc = (const Handle(Adaptor2d_HCurve2d)&) mapArcs(ia); const Handle(Adaptor2d_HCurve2d) arc (Handle(Adaptor2d_HCurve2d)::DownCast (mapArcs(ia)));
// get end vertices of wline linked with this arc // get end vertices of wline linked with this arc
Standard_Integer iv1=0,iv2=0; Standard_Integer iv1=0,iv2=0;
for (i=1; i <= indicesV1.Length() && iv1==0; i++) { for (i=1; i <= indicesV1.Length() && iv1==0; i++) {
iv = indicesV1(i); iv = indicesV1(i);
Handle(Adaptor2d_HCurve2d) arc1; Handle(Adaptor2d_HCurve2d) arc1;
if ((WLine->Vertex(iv).*pIsOnDomS)()) arc1 = (WLine->Vertex(iv).*pArcOnS)(); if ((WLine->Vertex(iv).*pIsOnDomS)()) arc1 = (WLine->Vertex(iv).*pArcOnS)();
else arc1 = (const Handle(Adaptor2d_HCurve2d)&) arcsResolved(iv); else arc1 = Handle(Adaptor2d_HCurve2d)::DownCast (arcsResolved(iv));
if (!arc1.IsNull() && arc1 == arc) iv1 = iv; if (!arc1.IsNull() && arc1 == arc) iv1 = iv;
} }
for (i=1; i <= indicesV2.Length() && iv2==0; i++) { for (i=1; i <= indicesV2.Length() && iv2==0; i++) {
iv = indicesV2(i); iv = indicesV2(i);
Handle(Adaptor2d_HCurve2d) arc1; Handle(Adaptor2d_HCurve2d) arc1;
if ((WLine->Vertex(iv).*pIsOnDomS)()) arc1 = (WLine->Vertex(iv).*pArcOnS)(); if ((WLine->Vertex(iv).*pIsOnDomS)()) arc1 = (WLine->Vertex(iv).*pArcOnS)();
else arc1 = (const Handle(Adaptor2d_HCurve2d)&) arcsResolved(iv); else arc1 = Handle(Adaptor2d_HCurve2d)::DownCast (arcsResolved(iv));
if (!arc1.IsNull() && arc1 == arc) iv2 = iv; if (!arc1.IsNull() && arc1 == arc) iv2 = iv;
} }
if (!iv1 || !iv2) { if (!iv1 || !iv2) {
@ -1194,8 +1194,7 @@ void IntPatch_LineConstructor::Perform(const IntPatch_SequenceOfLine& slinref,
IntPatch_IType typl = L->ArcType(); IntPatch_IType typl = L->ArcType();
if(typl == IntPatch_Analytic) { if(typl == IntPatch_Analytic) {
Standard_Real u1,v1,u2,v2; Standard_Real u1,v1,u2,v2;
Handle(IntPatch_ALine)& ALine Handle(IntPatch_ALine) ALine (Handle(IntPatch_ALine)::DownCast (L));
= Handle(IntPatch_ALine)::DownCast (L);
slin.Clear(); slin.Clear();
nbvtx = ALine->NbVertex(); nbvtx = ALine->NbVertex();
//-- ------------------------------------------------------------------- //-- -------------------------------------------------------------------
@ -1247,8 +1246,7 @@ void IntPatch_LineConstructor::Perform(const IntPatch_SequenceOfLine& slinref,
} }
else if(typl == IntPatch_Walking) { else if(typl == IntPatch_Walking) {
Standard_Real u1,v1,u2,v2; Standard_Real u1,v1,u2,v2;
Handle(IntPatch_WLine)& WLine Handle(IntPatch_WLine) WLine (Handle(IntPatch_WLine)::DownCast (L));
= Handle(IntPatch_WLine)::DownCast (L);
slin.Clear(); slin.Clear();
nbvtx = WLine->NbVertex(); nbvtx = WLine->NbVertex();
//-- ------------------------------------------------------------------- //-- -------------------------------------------------------------------
@ -1407,8 +1405,7 @@ void IntPatch_LineConstructor::Perform(const IntPatch_SequenceOfLine& slinref,
} }
else if (typl != IntPatch_Restriction) { // JAG 01.07.96 else if (typl != IntPatch_Restriction) { // JAG 01.07.96
Standard_Real u1,v1,u2,v2; Standard_Real u1,v1,u2,v2;
Handle(IntPatch_GLine)& GLine Handle(IntPatch_GLine) GLine (Handle(IntPatch_GLine)::DownCast (L));
= Handle(IntPatch_GLine)::DownCast (L);
slin.Clear(); slin.Clear();
nbvtx = GLine->NbVertex(); nbvtx = GLine->NbVertex();
//-- ------------------------------------------------------------------- //-- -------------------------------------------------------------------
@ -1539,8 +1536,7 @@ void IntPatch_LineConstructor::Perform(const IntPatch_SequenceOfLine& slinref,
return; return;
} }
else { //-- Restriction else { //-- Restriction
Handle(IntPatch_RLine)& RLine Handle(IntPatch_RLine) RLine (Handle(IntPatch_RLine)::DownCast (L));
= Handle(IntPatch_RLine)::DownCast (L);
slin.Clear(); slin.Clear();
Standard_Integer NbVtx = RLine->NbVertex(); Standard_Integer NbVtx = RLine->NbVertex();
Standard_Boolean RestOnS1 = RLine->IsArcOnS1(); Standard_Boolean RestOnS1 = RLine->IsArcOnS1();

View File

@ -1845,20 +1845,12 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)&
BRepAdaptor_Curve CURVE(OE); BRepAdaptor_Curve CURVE(OE);
if (CURVE.GetType() == GeomAbs_Line) { if (CURVE.GetType() == GeomAbs_Line) {
// Works only with line !! // Works only with line !!
//#ifndef OCCT_DEBUG
Handle(Geom_Geometry) aGeomGeometry = CURVE.Curve().Curve()->Transformed(CURVE.Trsf()) ; Handle(Geom_Geometry) aGeomGeometry = CURVE.Curve().Curve()->Transformed(CURVE.Trsf()) ;
gp_Lin OLin = Handle(Geom_Line)::DownCast (aGeomGeometry)->Lin(); gp_Lin OLin = Handle(Geom_Line)::DownCast (aGeomGeometry)->Lin();
//#else
// gp_Lin OLin = ((Handle(Geom_Line)&) CURVE.Curve().Curve()->Transformed(CURVE.Trsf()))->Lin();
//#endif
TopoDS_Edge NE = TopoDS::Edge(S2); TopoDS_Edge NE = TopoDS::Edge(S2);
CURVE.Initialize (NE); CURVE.Initialize (NE);
//#ifndef OCCT_DEBUG
aGeomGeometry = CURVE.Curve().Curve()->Transformed(CURVE.Trsf()) ; aGeomGeometry = CURVE.Curve().Curve()->Transformed(CURVE.Trsf()) ;
gp_Lin NLin = Handle(Geom_Line)::DownCast (aGeomGeometry)->Lin(); gp_Lin NLin = Handle(Geom_Line)::DownCast (aGeomGeometry)->Lin();
//#else
// gp_Lin NLin = ((Handle(Geom_Line)&) CURVE.Curve().Curve()->Transformed(CURVE.Trsf()))->Lin();
//#endif
gp_Dir TDir (NLin.Location().XYZ() - OLin.Location().XYZ()); gp_Dir TDir (NLin.Location().XYZ() - OLin.Location().XYZ());
aplane = new Geom_Plane (NLin.Location(),NLin.Direction()^TDir); aplane = new Geom_Plane (NLin.Location(),NLin.Direction()^TDir);
@ -1876,12 +1868,8 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)&
} }
else else
if (CURVE.GetType() == GeomAbs_Circle) { if (CURVE.GetType() == GeomAbs_Circle) {
//#ifndef OCCT_DEBUG
Handle(Geom_Geometry) aGeomGeometry = CURVE.Curve().Curve()->Transformed(CURVE.Trsf()) ; Handle(Geom_Geometry) aGeomGeometry = CURVE.Curve().Curve()->Transformed(CURVE.Trsf()) ;
gp_Ax1 ax = Handle(Geom_Circle)::DownCast (aGeomGeometry)->Circ().Axis(); gp_Ax1 ax = Handle(Geom_Circle)::DownCast (aGeomGeometry)->Circ().Axis();
//#else
// gp_Ax1 ax = ((Handle(Geom_Circle)&) CURVE.Curve().Curve()->Transformed(CURVE.Trsf()))->Circ().Axis();
//#endif
aplane = new Geom_Plane (ax.Location(),ax.Direction()); aplane = new Geom_Plane (ax.Location(),ax.Direction());
is_planar = Standard_True; is_planar = Standard_True;
} }
@ -1902,12 +1890,8 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)&
BRepBuilderAPI_MakeFace MkF (w1,Standard_True); BRepBuilderAPI_MakeFace MkF (w1,Standard_True);
if (MkF.IsDone()) { if (MkF.IsDone()) {
//#ifndef OCCT_DEBUG
Handle(Geom_Surface) aGeomSurface = BRep_Tool::Surface(MkF.Face()); Handle(Geom_Surface) aGeomSurface = BRep_Tool::Surface(MkF.Face());
aplane = Handle(Geom_Plane)::DownCast (aGeomSurface) ; aplane = Handle(Geom_Plane)::DownCast (aGeomSurface);
//#else
// aplane = ((Handle(Geom_Plane)&) BRep_Tool::Surface(MkF.Face()));
//#endif
is_planar = Standard_True; is_planar = Standard_True;
} }
} }

View File

@ -341,9 +341,9 @@ Standard_Boolean TopOpeBRepTool_CurveTool::MakeCurves
Standard_Integer iparmin = (Standard_Integer)parmin; Standard_Integer iparmin = (Standard_Integer)parmin;
Standard_Integer iparmax = (Standard_Integer)parmax; Standard_Integer iparmax = (Standard_Integer)parmax;
Handle(Geom_BSplineCurve)& HC3D = Handle(Geom_BSplineCurve)::DownCast (C3D); Handle(Geom_BSplineCurve) HC3D (Handle(Geom_BSplineCurve)::DownCast (C3D));
Handle(Geom2d_BSplineCurve)& HPC1 = Handle(Geom2d_BSplineCurve)::DownCast (PC1); Handle(Geom2d_BSplineCurve) HPC1 (Handle(Geom2d_BSplineCurve)::DownCast (PC1));
Handle(Geom2d_BSplineCurve)& HPC2 = Handle(Geom2d_BSplineCurve)::DownCast (PC2); Handle(Geom2d_BSplineCurve) HPC2 (Handle(Geom2d_BSplineCurve)::DownCast (PC2));
//--------------------- IFV - "improving" initial curves //--------------------- IFV - "improving" initial curves
#ifdef CurveImprovement #ifdef CurveImprovement
@ -452,21 +452,21 @@ Standard_Boolean TopOpeBRepTool_CurveTool::MakeCurves
if(CompPC1) Polpc1(NbPol) = PolPC1(nbpol); if(CompPC1) Polpc1(NbPol) = PolPC1(nbpol);
if(CompPC2) Polpc2(NbPol) = PolPC2(nbpol); if(CompPC2) Polpc2(NbPol) = PolPC2(nbpol);
HC3D = new Geom_BSplineCurve(Polc3d, knots, mults, 1); const_cast<Handle(Geom_Curve)&>(C3D) = new Geom_BSplineCurve(Polc3d, knots, mults, 1);
if(CompPC1) HPC1 = new Geom2d_BSplineCurve(Polpc1, knots, mults, 1); if(CompPC1) const_cast<Handle(Geom2d_Curve)&>(PC1) = new Geom2d_BSplineCurve(Polpc1, knots, mults, 1);
if(CompPC2) HPC2 = new Geom2d_BSplineCurve(Polpc2, knots, mults, 1); if(CompPC2) const_cast<Handle(Geom2d_Curve)&>(PC2) = new Geom2d_BSplineCurve(Polpc2, knots, mults, 1);
iparmax = NbPol; iparmax = NbPol;
#ifdef IFV #ifdef IFV
sprintf(name,"C3Dmod_%d",NbCalls); sprintf(name,"C3Dmod_%d",NbCalls);
nm = &name[0]; nm = &name[0];
DrawTrSurf::Set(nm, HC3D); DrawTrSurf::Set(nm, C3D);
sprintf(name,"PC1mod_%d",NbCalls); sprintf(name,"PC1mod_%d",NbCalls);
nm = &name[0]; nm = &name[0];
DrawTrSurf::Set(nm, HPC1); DrawTrSurf::Set(nm, PC1);
sprintf(name,"PC2mod_%d",NbCalls); sprintf(name,"PC2mod_%d",NbCalls);
nm = &name[0]; nm = &name[0];
DrawTrSurf::Set(nm, HPC2); DrawTrSurf::Set(nm, PC2);
#endif #endif
} }

View File

@ -73,7 +73,7 @@ void V3d_Viewer::SetCurrentSelectedLight(const Handle(V3d_Light)& TheLight) {
} }
void V3d_Viewer::ClearCurrentSelectedLight() { void V3d_Viewer::ClearCurrentSelectedLight() {
MyCurrentSelectedLight = NULL; MyCurrentSelectedLight.Nullify();
} }
@ -104,7 +104,7 @@ void V3d_Viewer::SetDefaultLights()
{ {
while (MyDefinedLights.Extent() > 0) while (MyDefinedLights.Extent() > 0)
{ {
DelLight ((Handle(V3d_Light)&)MyDefinedLights.First()); DelLight (Handle(V3d_Light)::DownCast (MyDefinedLights.First()));
} }
SetLightOn (new V3d_DirectionalLight (this, V3d_Zneg, Quantity_NOC_WHITE, Standard_True)); SetLightOn (new V3d_DirectionalLight (this, V3d_Zneg, Quantity_NOC_WHITE, Standard_True));