Method DownCast() is made template, to be available only when argument is actually a pointer or handle to a base class.
For compatibility with existing code, method DownCast() that can be used for the same type, derived, or unrelated class (i.e. where there is no actual down casting) is still available, its use shall cause "deprecated" compiler warning.
OCCT code is updated to remove meaningless DownCast()s; a few places where DownCast() was used with argument of unrelated type are corrected.
DRAW command QAHandleCast is removed (it was useful only during redesign of handles).
Call method <i>get()</i> explicitly to output the address of the Handle.
+#### Method DownCast for non-base types
+
+Method *DownCast()* in OCCT 7.0 is made templated; if it is used with argument which is not a base class, "deprecated" compiler warning is generated.
+This is done to prevent possible unintended errors like this:
+
+~~~~~
+Handle(Geom_Surface) aSurf = ;
+Handle(Geom_Line) aLine =
+ Handle(Geom_Line)::DownCast (aSurf); // will cause a compiler warning in OCCT 7.0, but not OCCT 6.x
+~~~~~
+
+The places where this cast has been used should be corrected manually.
+
+If down casting is used in a template context where argument can have the same or unrelated type so that *DownCast()* may be not available in all cases, use C++ *dynamic_cast<>* instead, e.g.:
+
+~~~~~
+template <class T>
+bool CheckLine (const Handle(T) theArg)
+{
+ Handle(Geom_Line) aLine = dynamic_cast<Geom_Line> (theArg.get());
+ ...
+}
+~~~~~
+
@subsubsection upgrade_occt700_cdl_runtime Possible runtime problems
Here is the list of known possible problems at run time after the upgrade to OCCT 7.0.
In previous versions, the compiler was able to detect the situation when a local variable of a "reference to a Handle" type is initialized by temporary object, and ensured that lifetime of that object is longer than that of the variable.
In OCCT 7.0 with default options, it will not work if types of the temporary object and variable are different (due to involvement of user-defined type cast), thus such temporary object will be destroyed immediately.
+
This problem does not appear if macro *OCCT_HANDLE_NOCAST* is used during compilation, see below.
Example:
Standard_Boolean okstat = Standard_True;
if( hasC && aSelectable->HasColor() )
- okstat = (myCol == Handle(AIS_InteractiveObject)::DownCast (anObj)->Color());
+ okstat = (myCol == aSelectable->Color());
if( hasW && aSelectable->HasWidth() )
- okstat = (myWid == Handle(AIS_InteractiveObject)::DownCast (anObj)->Width()) && okstat;
+ okstat = (myWid == aSelectable->Width()) && okstat;
return okstat;
}
for (aSelector->Init(); aSelector->More(); aSelector->Next())
{
- const Handle(SelectMgr_EntityOwner) anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast (aSelector->Picked());
+ const Handle(SelectMgr_EntityOwner) anOwner = aSelector->Picked();
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
for (aSelector->Init(); aSelector->More(); aSelector->Next())
{
- const Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelector->Picked());
+ const Handle(SelectMgr_EntityOwner) anOwner = aSelector->Picked();
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
for (aSelector->Init(); aSelector->More(); aSelector->Next())
{
- const Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelector->Picked());
+ const Handle(SelectMgr_EntityOwner) anOwner = aSelector->Picked();
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
// myMainPM->Clear(SO,CurAtt->DisplayMode());}
}
else {
- if (CurAtt->IsSubIntensityOn()){
- myCTX->SubIntensityOff(Handle(AIS_InteractiveObject)::DownCast(SO));}
+ if (CurAtt->IsSubIntensityOn())
+ {
+ myCTX->SubIntensityOff(SO);
+ }
Standard_Integer DiMo = SO->HasDisplayMode()?
SO->DisplayMode():myCTX->DisplayMode();
if(CurAtt->DisplayMode()!=-1 &&
// points has less diameter than the tolerance 3D
Degenerated = Standard_True;
Standard_Real Dist;
- Handle(Geom_BSplineCurve) BS3d = Handle(Geom_BSplineCurve)::DownCast( appr.Curve3d());
+ Handle(Geom_BSplineCurve) BS3d = appr.Curve3d();
gp_Pnt P1(0.,0.,0.),PP; // skl : I change "P" to "PP"
Standard_Integer NbPoint,ii ; // skl : I change "i" to "ii"
Standard_Real Par,DPar;
pt = myLastPnt;
Standard_Real fpar = IntPar(cc, myFirstPnt);
Standard_Real lpar = IntPar(cc, pt);
- Handle(Geom_Curve) ccc;
if(fpar > lpar) {
- ccc = Handle(Geom_Curve)::DownCast(cc->Reversed());
- cc = ccc;
+ cc = cc->Reversed();
}
}
TopoDS_Edge ee1;
pt = myLastPnt;
Standard_Real fpar = IntPar(cc, myFirstPnt);
Standard_Real lpar = IntPar(cc, pt);
- Handle(Geom_Curve) ccc;
if(fpar > lpar) {
- ccc = Handle(Geom_Curve)::DownCast(cc->Reversed());
- cc = ccc;
+ cc = cc->Reversed();
}
}
TopoDS_Edge ee1;
Standard_Real lpar = IntPar(FirstCurve, myLastPnt);
Handle(Geom_Curve) c;
if(fpar > lpar)
- c = Handle(Geom_Curve)::DownCast(FirstCurve->Reversed());
+ c = FirstCurve->Reversed();
else
c = FirstCurve;
Standard_Real t1 = OrigParam->Value(ipath-1);
Standard_Real t2 = OrigParam->Value(ipath);
Handle(GeomFill_LocationGuide) Loc;
- Loc = Handle(GeomFill_LocationGuide)::DownCast(theLaw);
+ Loc = theLaw;
Loc->SetOrigine(t1,t2);
myLaws->SetValue(ipath, Loc->Copy());
// project it in the plane and return the associated PCurve
gp_Dir Normal = Plane->Pln().Axis().Direction();
- C =
- Handle(Geom_Curve)::DownCast(GeomProjLib::ProjectOnPlane(CT,Plane,
- Normal,
- Standard_False));
+ C = GeomProjLib::ProjectOnPlane (CT, Plane, Normal, Standard_False);
C2d = GeomProjLib::Curve2d(C,Plane);
// Calculate the extrema with the straight line
{
TCollection_AsciiString aName;
if (! (theSource >> aName)) return Standard_False;
- Handle(TObj_Model) aModel = Handle(TObj_Model)::DownCast
- ( TObj_Assistant::FindModel( aName.ToCString() ));
+ Handle(TObj_Model) aModel = TObj_Assistant::FindModel (aName.ToCString());
if (aModel.IsNull())
{
TCollection_AsciiString anEntry;
if (! isSameDoc)
{
TCollection_AsciiString aName;
- Handle(TObj_Model) aModel =
- Handle(TObj_Model)::DownCast( aLObject->GetModel() );
+ Handle(TObj_Model) aModel = aLObject->GetModel();
aName = TCollection_AsciiString( aModel->GetModelName()->String() );
theTarget << aName;
}
Handle(Geom2d_Curve) basisC1,basisC2;
Handle(Geom2d_TrimmedCurve) T1 = Handle(Geom2d_TrimmedCurve)::DownCast(C1);
if (!T1.IsNull())
- basisC1 = Handle(Geom2d_Curve)::DownCast(T1->BasisCurve());
+ basisC1 = T1->BasisCurve();
else
- basisC1 = Handle(Geom2d_Curve)::DownCast(C1);
+ basisC1 = C1;
Handle(Geom2d_TrimmedCurve) T2 = Handle(Geom2d_TrimmedCurve)::DownCast(C2);
if (!T2.IsNull())
- basisC2 = Handle(Geom2d_Curve)::DownCast(T2->BasisCurve());
+ basisC2 = T2->BasisCurve();
else
- basisC2 = Handle(Geom2d_Curve)::DownCast(C2);
+ basisC2 = C2;
if (basisC1->DynamicType() == STANDARD_TYPE(Geom2d_Circle)) {
Handle(Geom2d_Circle) CC1 = Handle(Geom2d_Circle)::DownCast(basisC1);
Handle(Geom2d_Curve) basisC;
Handle(Geom2d_TrimmedCurve) TC = Handle(Geom2d_TrimmedCurve)::DownCast(C);
if (!TC.IsNull())
- basisC = Handle(Geom2d_Curve)::DownCast(TC->BasisCurve());
+ basisC = TC->BasisCurve();
else
- basisC = Handle(Geom2d_Curve)::DownCast(C);
+ basisC = C;
if ( basisC->DynamicType() == STANDARD_TYPE(Geom2d_Circle)
|| basisC->DynamicType() == STANDARD_TYPE(Geom2d_Line) ) {
Handle(Geom2d_Curve) basisC;
Handle(Geom2d_TrimmedCurve) TC = Handle(Geom2d_TrimmedCurve)::DownCast(C);
if (!TC.IsNull())
- basisC = Handle(Geom2d_Curve)::DownCast(TC->BasisCurve());
+ basisC = TC->BasisCurve();
else
- basisC = Handle(Geom2d_Curve)::DownCast(C);
+ basisC = C;
if ( basisC->DynamicType() == STANDARD_TYPE(Geom2d_Circle)
|| basisC->DynamicType() == STANDARD_TYPE(Geom2d_Line) ) {
if (Complain) cout << Name << " is not a Document" << endl;
return Standard_False;
}
- Handle(TDocStd_Document) STDDOC = Handle(TDocStd_Document)::DownCast(DD->GetDocument());
+ Handle(TDocStd_Document) STDDOC = DD->GetDocument();
if (!STDDOC.IsNull()) {
DOC = STDDOC;
return Standard_True;
void DDocStd_DrawDocument::Dump (Standard_OStream& S) const
{
- Handle(TDocStd_Document) STDDOC = Handle(TDocStd_Document)::DownCast(myDocument);
+ Handle(TDocStd_Document) STDDOC = myDocument;
if (!STDDOC.IsNull()) {
S << "TDocStd_Document\n";
DDF_Data::Dump(S);
{
Standard_Real f,l;
Handle(Geom_Curve) line = BRep_Tool::Curve(edge,f,l);
- GeomAPI_ProjectPointOnCurve pj (point,Handle(Geom_Curve)::DownCast(line));
+ GeomAPI_ProjectPointOnCurve pj (point, line);
if (pj.NbPoints() == 1) {
gp_Pnt first = point;
gp_Pnt last = pj.Point(1);
Handle(Geom_RectangularTrimmedSurface) St =
Handle(Geom_RectangularTrimmedSurface)::DownCast(SBasis);
- Handle(Geom_Surface) S = Handle(Geom_Surface)::DownCast(St->BasisSurface());
+ Handle(Geom_Surface) S = St->BasisSurface();
if (S->IsKind (STANDARD_TYPE(Geom_ElementarySurface))) {
UClosed = SBasis->IsUClosed();
}
Handle(Geom_RectangularTrimmedSurface) St =
Handle(Geom_RectangularTrimmedSurface)::DownCast(SBasis);
- Handle(Geom_Surface) S = Handle(Geom_Surface)::DownCast(St->BasisSurface());
+ Handle(Geom_Surface) S = St->BasisSurface();
if (S->IsKind (STANDARD_TYPE(Geom_ElementarySurface))) {
VClosed = SBasis->IsVClosed();
}
{
Handle(Geom_RectangularTrimmedSurface) S2 =
new Geom_RectangularTrimmedSurface( O->BasisSurface(),U1,U2, V1, V2, USense, VSense);
- Handle(Geom_OffsetSurface) OS = new Geom_OffsetSurface(S2, O->Offset());
- basisSurf = Handle(Geom_Surface)::DownCast(OS);
+ basisSurf = new Geom_OffsetSurface(S2, O->Offset());
}
SetTrim( U1, U2, V1, V2, USense, VSense);
{
Handle(Geom_RectangularTrimmedSurface) S2 =
new Geom_RectangularTrimmedSurface( O->BasisSurface(),Param1,Param2, UTrim, Sense);
- Handle(Geom_OffsetSurface) OS = new Geom_OffsetSurface(S2, O->Offset());
- basisSurf = Handle(Geom_Surface)::DownCast(OS);
+ basisSurf = new Geom_OffsetSurface(S2, O->Offset());
}
SetTrim(Param1, Param2, UTrim, Sense);
NewPoles(ii).SetCoord(jj,NewPoles(ii).Coord(jj)/NewWeights(ii));
Curve1= new Geom2d_BSplineCurve(NewPoles,NewWeights,KnotC1,KnotC1Mults,2*Curve1->Degree());
}
- Geom2dConvert_CompCurveToBSplineCurve C(Handle(Geom2d_BSplineCurve)::DownCast(Curve2));
+ Geom2dConvert_CompCurveToBSplineCurve C(Curve2);
fusion=C.Add(Curve1,
local_tolerance(j-1)); //fusion de deux courbes adjacentes
if (fusion==Standard_False)
if (index==j) //initialisation en debut de groupe
ArrayOfConcatenated->SetValue(i,Curve1);
else{
- Geom2dConvert_CompCurveToBSplineCurve C(Handle(Geom2d_BSplineCurve)::DownCast(ArrayOfConcatenated->Value(i)));
+ Geom2dConvert_CompCurveToBSplineCurve C(ArrayOfConcatenated->Value(i));
fusion=C.Add(Curve1,ArrayOfToler(j-1)); //fusion de deux courbes adjacentes
if (fusion==Standard_False)
Standard_ConstructionError::Raise("Geom2dConvert Concatenation Error") ;
}
Curve1= new Geom2d_BSplineCurve(NewPoles,NewWeights,KnotC1,KnotC1Mults,2*Curve1->Degree());
}
- Geom2dConvert_CompCurveToBSplineCurve C(Handle(Geom2d_BSplineCurve)::DownCast(Curve2));
+ Geom2dConvert_CompCurveToBSplineCurve C(Curve2);
fusion=C.Add(Curve1,
local_tolerance(j-1)); //fusion de deux courbes adjacentes
if (fusion==Standard_False)
if (index==j) //initialisation en debut de groupe
ArrayOfConcatenated->SetValue(i,Curve1);
else{
- Geom2dConvert_CompCurveToBSplineCurve C(Handle(Geom2d_BSplineCurve)::DownCast(ArrayOfConcatenated->Value(i)));
+ Geom2dConvert_CompCurveToBSplineCurve C (ArrayOfConcatenated->Value(i));
fusion=C.Add(Curve1,ArrayOfToler(j-1)); //fusion de deux courbes adjacentes
if (fusion==Standard_False)
Standard_ConstructionError::Raise("Geom2dConvert Concatenation Error") ;
closed_flag,
tolerance);
- Geom2dConvert_CompCurveToBSplineCurve
- C(Handle(Geom2d_BSplineCurve)::DownCast(ArrayOfConcatenated->Value(0)));
+ Geom2dConvert_CompCurveToBSplineCurve C(ArrayOfConcatenated->Value(0));
if (ArrayOfConcatenated->Length()>=2){
for (i=1;i<ArrayOfConcatenated->Length();i++){
fusion=C.Add(ArrayOfConcatenated->Value(i),tolerance);
Handle(Geom_SurfaceOfRevolution)::DownCast(mySurface);
// Create nested adaptor for base curve
Handle(Geom_Curve) aBaseCurve = myRevSurf->BasisCurve();
- Handle(GeomAdaptor_HCurve) aBaseAdaptor = new GeomAdaptor_HCurve(aBaseCurve);
+ Handle(Adaptor3d_HCurve) aBaseAdaptor = new GeomAdaptor_HCurve(aBaseCurve);
// Create corresponding evaluator
- myNestedEvaluator = new GeomEvaluator_SurfaceOfRevolution(
- Handle(Adaptor3d_HCurve)::DownCast(aBaseAdaptor),
- myRevSurf->Direction(), myRevSurf->Location());
+ myNestedEvaluator =
+ new GeomEvaluator_SurfaceOfRevolution (aBaseAdaptor, myRevSurf->Direction(), myRevSurf->Location());
}
else if ( TheType == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))
{
Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(mySurface);
// Create nested adaptor for base curve
Handle(Geom_Curve) aBaseCurve = myExtSurf->BasisCurve();
- Handle(GeomAdaptor_HCurve) aBaseAdaptor = new GeomAdaptor_HCurve(aBaseCurve);
+ Handle(Adaptor3d_HCurve) aBaseAdaptor = new GeomAdaptor_HCurve(aBaseCurve);
// Create corresponding evaluator
- myNestedEvaluator = new GeomEvaluator_SurfaceOfExtrusion(
- Handle(Adaptor3d_HCurve)::DownCast(aBaseAdaptor), myExtSurf->Direction());
+ myNestedEvaluator =
+ new GeomEvaluator_SurfaceOfExtrusion (aBaseAdaptor, myExtSurf->Direction());
}
else if (TheType == STANDARD_TYPE(Geom_BezierSurface))
{
NewPoles(ii).SetCoord(jj,NewPoles(ii).Coord(jj)/NewWeights(ii));
Curve1= new Geom_BSplineCurve(NewPoles,NewWeights,KnotC1,KnotC1Mults,2*Curve1->Degree());
}
- GeomConvert_CompCurveToBSplineCurve C(Handle(Geom_BSplineCurve)::DownCast(Curve2));
+ GeomConvert_CompCurveToBSplineCurve C (Curve2);
fusion=C.Add(Curve1,
local_tolerance(j-1)); //merge of two consecutive curves
if (fusion==Standard_False)
if (index==j) //initialisation at the begining of the loop
ArrayOfConcatenated->SetValue(i,Curve1);
else{
- GeomConvert_CompCurveToBSplineCurve C(Handle(Geom_BSplineCurve)::DownCast(ArrayOfConcatenated->Value(i)));
+ GeomConvert_CompCurveToBSplineCurve C (ArrayOfConcatenated->Value(i));
fusion=C.Add(Curve1,ArrayOfToler(j-1)); //merge of two consecutive curves
if (fusion==Standard_False)
Standard_ConstructionError::Raise("GeomConvert Concatenation Error") ;
NewPoles(ii).SetCoord(jj,NewPoles(ii).Coord(jj)/NewWeights(ii));
Curve1= new Geom_BSplineCurve(NewPoles,NewWeights,KnotC1,KnotC1Mults,2*Curve1->Degree());
}
- GeomConvert_CompCurveToBSplineCurve C(Handle(Geom_BSplineCurve)::DownCast(Curve2));
+ GeomConvert_CompCurveToBSplineCurve C (Curve2);
fusion=C.Add(Curve1,
local_tolerance(j-1)); //merge of two consecutive curves
if (fusion==Standard_False)
else
{
// Merge of two consecutive curves.
- GeomConvert_CompCurveToBSplineCurve C(Handle(Geom_BSplineCurve)::DownCast(ArrayOfConcatenated->Value(i)));
+ GeomConvert_CompCurveToBSplineCurve C (ArrayOfConcatenated->Value(i));
fusion=C.Add(Curve1, local_tolerance(j-1), Standard_True);
if (fusion==Standard_False)
Standard_ConstructionError::Raise("GeomConvert Concatenation Error");
GeomConvert::C0BSplineToArrayOfC1BSplineCurve(BS, ArrayOfConcatenated,
AngularTol, tolerance);
- GeomConvert_CompCurveToBSplineCurve C
- (Handle(Geom_BSplineCurve)::DownCast(ArrayOfConcatenated->Value(0)));
+ GeomConvert_CompCurveToBSplineCurve C (ArrayOfConcatenated->Value(0));
if (ArrayOfConcatenated->Length()>=2){
Standard_Integer i;
for (i=1;i<ArrayOfConcatenated->Length();i++){
}
break;
case 2 :
- Handle(Geom_Surface) Splate;
- Splate = Handle(Geom_Surface)::DownCast(myGeomPlateSurface);
+ Handle(Geom_Surface) Splate (myGeomPlateSurface);
LocalAnalysis_SurfaceContinuity CG2;
for (i=1; i<NbPt; i++)
{ U = ( myParCont->Value(c).Value(i) +
Ang = M_PI -Ang;
break;
case 2 :
- Handle(Geom_Surface) Splate;
- Splate = Handle(Geom_Surface)::DownCast(myGeomPlateSurface);
+ Handle(Geom_Surface) Splate (myGeomPlateSurface);
LocalAnalysis_SurfaceContinuity CG2;
P2d = PntCont->Pnt2dOnSurf();
GeomLProp_SLProps Prop (Splate, P2d.Coord(1), P2d.Coord(2),
tolerance=Draw::Atof(c[3]);
if (n==5)
angular_tolerance = Draw::Atof(c[4]) ;
- Handle(Geom2d_Curve) ACurve = Handle(Geom2d_Curve)::DownCast(DrawTrSurf::GetCurve2d(c[1])) ;
+ Handle(Geom2d_Curve) ACurve = DrawTrSurf::GetCurve2d(c[1]);
Standard_Real f = ACurve->FirstParameter();
Standard_Real l = ACurve->LastParameter();
udirection=Standard_True;
if (voption)
vdirection=Standard_True;
- Handle(Geom_BSplineSurface) BSurf = Handle(Geom_BSplineSurface)::DownCast(DrawTrSurf::GetBSplineSurface(c[1]));
+ Handle(Geom_BSplineSurface) BSurf = DrawTrSurf::GetBSplineSurface(c[1]);
GeomLib::CancelDenominatorDerivative(BSurf,udirection,vdirection);
DrawTrSurf::Set(c[1],BSurf);
return 0;
Handle(IGESData_TransfEntity) IGESAppli_Node::System () const
{
//if Null, Global Cartesian Coordinate System
- return GetCasted(IGESData_TransfEntity,theSystem);
+ return Handle(IGESData_TransfEntity)(theSystem);
}
Standard_Integer IGESAppli_Node::SystemType () const
}
else if (!GTranslate3d && GTranslate2d) {
for (Standard_Integer i = curves2d->Lower(); i <= curves2d->Upper(); i++) {
- TopoDS_Shape Sh = TC.Transfer2dTopoCurve (Handle(IGESData_IGESEntity)::DownCast (curves2d->Value (i)),
- myface, mytrsf, myuFact);
+ TopoDS_Shape Sh = TC.Transfer2dTopoCurve (curves2d->Value (i), myface, mytrsf, myuFact);
if (!Sh.IsNull()) Gsewd2d->Add (Sh);
}
if (toreverse2d) {
(const Handle(IGESData_IGESEntity)& ent, const Interface_Graph& G,
Handle(IGESData_IGESEntity)& /* sup */, Standard_Integer& /* index */)
{
- DeclareAndCast(IGESData_IGESEntity,igesent,ent);
+ Handle(IGESData_IGESEntity) igesent = ent;
if (igesent.IsNull()) return Standard_False;
// Standard_Integer igt = igesent->TypeNumber();
DeclareAndCast(IGESData_IGESModel,model,G.Model());
}
else if (!GTranslate3d && GTranslate2d) {
for (Standard_Integer i = curves2d->Lower(); i <= curves2d->Upper(); i++) {
- TopoDS_Shape Sh = TC.Transfer2dTopoCurve (Handle(IGESData_IGESEntity)::DownCast (curves2d->Value (i)),
- myface, mytrsf, myuFact);
+ TopoDS_Shape Sh = TC.Transfer2dTopoCurve (curves2d->Value (i), myface, mytrsf, myuFact);
if (!Sh.IsNull()) Gsewd2d->Add (Sh);
}
if (toreverse2d)
IVtkOCC_Shape::Handle anIVtkShape = new IVtkOCC_Shape (theShape);
anIVtkShape->SetId (theShapeID);
vtkSmartPointer<IVtkTools_ShapeDataSource> aDataSource = vtkSmartPointer<IVtkTools_ShapeDataSource>::New();
- aDataSource->SetShape (IVtkOCC_Shape::Handle::DownCast (anIVtkShape) );
+ aDataSource->SetShape (anIVtkShape);
IVtkTools_DisplayModeFilter*
aDMFilter = IVtkTools_DisplayModeFilter::SafeDownCast (myFilterMap.Find(Filter_DM_Shape));
Handle(Geom_Curve) C2Prj =
GeomProjLib::ProjectOnPlane(C2,GPln,gp_Dir(DV),Standard_True);
if(C1Prj.IsNull() || C2Prj.IsNull()) return;
- Handle(Geom2d_Curve) C1Prj2d =
- GeomProjLib::Curve2d(C1Prj,Handle(Geom_Surface)::DownCast (GPln));
- Handle(Geom2d_Curve) C2Prj2d =
- GeomProjLib::Curve2d(C2Prj,Handle(Geom_Surface)::DownCast (GPln));
+ Handle(Geom2d_Curve) C1Prj2d = GeomProjLib::Curve2d (C1Prj,GPln);
+ Handle(Geom2d_Curve) C2Prj2d = GeomProjLib::Curve2d (C2Prj,GPln);
Geom2dAPI_InterCurveCurve ICC(C1Prj2d,C2Prj2d,1.0e-7);
if(ICC.NbPoints() > 0 )
{
for(Standard_Integer ip = 1; ip <= sop.Length(); ip++)
{
gp_Lin lin(sop.Value(ip),gp_Dir(v));
- Handle(IntPatch_GLine) gl = new IntPatch_GLine(lin,Standard_False);
- slin.Append(Handle(IntPatch_Line)::DownCast (gl));
+ Handle(IntPatch_Line) gl = new IntPatch_GLine(lin,Standard_False);
+ slin.Append(gl);
}
done = Standard_True;
for(Standard_Integer ip = 1; ip <= sop.Length(); ip++)
{
gp_Lin lin(sop.Value(ip),gp_Dir(v));
- Handle(IntPatch_GLine) gl = new IntPatch_GLine(lin,Standard_False);
- slin.Append(Handle(IntPatch_Line)::DownCast (gl));
+ Handle(IntPatch_Line) gl = new IntPatch_GLine(lin,Standard_False);
+ slin.Append(gl);
}
done = Standard_True;
if (Affich) cout<<"TRIM de "<<abisector->BisectorNumber()<<endl;
#endif
- Handle(Geom2d_TrimmedCurve)
- bisector = Handle(Geom2d_TrimmedCurve)
- ::DownCast(ChangeGeomBis(abisector->BisectorNumber()).ChangeValue());
+ Handle(Geom2d_TrimmedCurve) bisector =
+ ChangeGeomBis(abisector->BisectorNumber()).ChangeValue();
if(bisector->BasisCurve()->IsPeriodic() && param == Precision::Infinite()) {
param = bisector->FirstParameter() + 2*M_PI;
const Standard_Integer apoint)
{
Standard_Real Param;
- Handle(Geom2d_TrimmedCurve)
- Bisector = Handle(Geom2d_TrimmedCurve)::
- DownCast(ChangeGeomBis(abisector->BisectorNumber()).ChangeValue());
+ Handle(Geom2d_TrimmedCurve) Bisector =
+ ChangeGeomBis(abisector->BisectorNumber()).ChangeValue();
Handle(Bisector_Curve) Bis = Handle(Bisector_Curve)::
DownCast(Bisector->BasisCurve());
Standard_Boolean SolutionValide;
gp_Pnt2d PointSolution;
- Handle(Geom2d_TrimmedCurve)
- Bisector1 = Handle(Geom2d_TrimmedCurve)
- ::DownCast(ChangeGeomBis(BisectorOne->BisectorNumber()).ChangeValue());
+ Handle(Geom2d_TrimmedCurve) Bisector1 =
+ ChangeGeomBis(BisectorOne->BisectorNumber()).ChangeValue();
- Handle(Geom2d_TrimmedCurve)
- Bisector2 = Handle(Geom2d_TrimmedCurve)
- ::DownCast(ChangeGeomBis(BisectorTwo->BisectorNumber()).ChangeValue());
+ Handle(Geom2d_TrimmedCurve) Bisector2 =
+ ChangeGeomBis(BisectorTwo->BisectorNumber()).ChangeValue();
if(Bisector1.IsNull() || Bisector2.IsNull()) return Precision::Infinite();
Handle(Geom2d_TrimmedCurve) Bisector1;
Handle(Geom2d_TrimmedCurve) Bisector2;
- Bisector1 = Handle(Geom2d_TrimmedCurve)::DownCast(GeomBis(I1).Value());
- Bisector2 = Handle(Geom2d_TrimmedCurve)::DownCast(GeomBis(I2).Value());
+ Bisector1 = GeomBis(I1).Value();
+ Bisector2 = GeomBis(I2).Value();
UF1 = Bisector1->FirstParameter();
UL1 = Bisector1->LastParameter();
Bis.Perform(BCC1->Curve(2), BCC1->Curve(1), P2, VBid, VBid,
theDirection, theJoinType, Tolerance, Standard_False);
- Bisector1 = Handle(Geom2d_TrimmedCurve)::DownCast(Bis.Value());
+ Bisector1 = Bis.Value();
BCC1 = Handle(Bisector_BisecCC) ::DownCast(Bisector1->BasisCurve());
UF1 = BCC1->FirstParameter();
UL1 = BCC1->Parameter(P1);
Geom2dInt_GInter Intersect;
Standard_Real Distance;
Standard_Real Tolerance = MAT2d_TOLCONF;
- Handle(Geom2d_TrimmedCurve) Bisector =
- Handle(Geom2d_TrimmedCurve)::DownCast(Bis.ChangeValue());
+ Handle(Geom2d_TrimmedCurve) Bisector = Bis.ChangeValue();
IntRes2d_Domain Domain1 = Domain(Bisector,Tolerance);
Standard_Real UB1 = Bisector->FirstParameter();
Standard_Integer nb = myPrinters.Length();
for (Standard_Integer i = 1; i <= nb; i++)
{
- Handle(Message_Printer) aPrinter = Handle(Message_Printer)::DownCast ( myPrinters(i) );
+ Handle(Message_Printer) aPrinter = myPrinters(i);
if ( ! aPrinter.IsNull() )
aPrinter->Send ( theString, theGravity, putEndl );
}
Standard_Integer nb = myPrinters.Length();
for (Standard_Integer i = 1; i <= nb; i++)
{
- Handle(Message_Printer) aPrinter = Handle(Message_Printer)::DownCast ( myPrinters(i) );
+ Handle(Message_Printer) aPrinter = myPrinters(i);
if ( ! aPrinter.IsNull() )
aPrinter->Send ( theString, theGravity, putEndl );
}
Standard_Integer nb = myPrinters.Length();
for (Standard_Integer i = 1; i <= nb; i++)
{
- Handle(Message_Printer) aPrinter = Handle(Message_Printer)::DownCast ( myPrinters(i) );
+ Handle(Message_Printer) aPrinter = myPrinters(i);
if ( ! aPrinter.IsNull() )
aPrinter->Send ( theString, theGravity, putEndl );
}
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
- Handle(Graphic3d_Structure) aStructure = Handle(Graphic3d_Structure)::DownCast (thePrs);
+ Handle(Graphic3d_Structure) aStructure (thePrs);
Handle(Graphic3d_Group) aGroup = aStructure->NewGroup();
Handle(Prs3d_ShadingAspect) anAspect = myDrawer->ShadingAspect();
Graphic3d_MaterialAspect aMat = anAspect->Aspect()->FrontMaterial();
Handle(NCollection_IncAllocator) anInc = Handle(NCollection_IncAllocator)::DownCast (aPtr);
CHECK (theDI, ! anInc.IsNull(), "cast to NCollection_IncAllocator");
- Handle(NCollection_BaseAllocator) anAlloc = Handle(NCollection_BaseAllocator)::DownCast (aPtr);
+ Handle(NCollection_BaseAllocator) anAlloc = aPtr;
CHECK (theDI, ! anAlloc.IsNull(), "cast to NCollection_BaseAllocator");
Handle(NCollection_HeapAllocator) aHAlloc = Handle(NCollection_HeapAllocator)::DownCast (aPtr);
return 0;
}
-namespace
-{
- //! Auxiliary class to perform casting to specified type.
- template<typename TTo> struct QACast
- {
- //! Perform casting using OCCT DownCast() operation.
- template<typename TFrom>
- static void doDownCast (Draw_Interpretor& theDI,
- const Standard_Integer theNbIters,
- const TFrom& theHandle)
- {
- std::vector<TTo> aHandles (theNbIters);
- {
- QATimer aTimer (theDI, " ", QATimer::ns, theNbIters);
- for (Standard_Integer anIter = 0; anIter < theNbIters; ++anIter)
- {
- aHandles[anIter] = TTo::DownCast (theHandle);
- }
- }
- }
-
- //! Perform casting using standard C++ dynamic_cast<> operation.
- template<typename TFrom>
- static void doDynamicCast (Draw_Interpretor& theDI,
- const Standard_Integer theNbIters,
- const TFrom& theHandle)
- {
- std::vector<typename TTo::element_type*> aPointers (theNbIters);
- {
- QATimer aTimer (theDI, " ", QATimer::ns, theNbIters);
- for (Standard_Integer anIter = 0; anIter < theNbIters; ++anIter)
- {
- aPointers[anIter] = dynamic_cast<typename TTo::element_type* > (theHandle.operator->());
- }
- }
- }
-
- //! Perform dynamic casting using shared_ptr::dynamic_pointer_cast operation.
- template<typename TFrom>
- static void doShareCast (Draw_Interpretor& theDI,
- const Standard_Integer theNbIters,
- const std::shared_ptr<TFrom>& theSharePtr)
- {
- std::vector< std::shared_ptr<typename TTo::element_type> > aSharePointers (theNbIters);
- {
- QATimer aTimer (theDI, " ", QATimer::ns, theNbIters);
- for (Standard_Integer anIter = 0; anIter < theNbIters; ++anIter)
- {
- aSharePointers[anIter] = std::dynamic_pointer_cast<typename TTo::element_type, TFrom> (theSharePtr);
- }
- }
- }
-
- };
-
- template<typename TAs>
- static void qaCastAs (Draw_Interpretor& theDI,
- const qaclass00_50& theInst,
- const Standard_Integer theNbIters)
- {
- #define QA_TEST_CAST10(theTens, theDoCast) \
- QACast<QA_HANDLE_NAME(theTens ## 0)>::theDoCast(theDI, theNbIters, aPtr); \
- QACast<QA_HANDLE_NAME(theTens ## 5)>::theDoCast(theDI, theNbIters, aPtr);
-
- typedef typename TAs::element_type aPtrType;
- TAs aDummy (new aPtrType());
- theDI << "Making a pointer:\n";
- theDI << aDummy->DynamicType()->Name() << "* ptr = new " << theInst.DynamicType()->Name() << "\n";
- theDI << "then measuring the time of casting it to base classes from qaclass00_50 to qaclass50_50, ns\n";
- if (!theInst.IsKind (aDummy->DynamicType()))
- {
- return;
- }
-
- theDI << "\nOCCT Handle: ";
- {
- TAs aPtr ((typename TAs::element_type* )theInst.Clone());
- QA_TEST_CAST10(0, doDownCast);
- QA_TEST_CAST10(1, doDownCast);
- QA_TEST_CAST10(2, doDownCast);
- QA_TEST_CAST10(3, doDownCast);
- QA_TEST_CAST10(4, doDownCast);
- QACast<Handle(qaclass50_50)>::doDownCast(theDI, theNbIters, aPtr);
- }
- theDI << "\nC++ dynamic_cast: ";
- {
- TAs aPtr ((typename TAs::element_type* )theInst.Clone());
- QA_TEST_CAST10(0, doDynamicCast);
- QA_TEST_CAST10(1, doDynamicCast);
- QA_TEST_CAST10(2, doDynamicCast);
- QA_TEST_CAST10(3, doDynamicCast);
- QA_TEST_CAST10(4, doDynamicCast);
- QACast<Handle(qaclass50_50)>::doDynamicCast(theDI, theNbIters, aPtr);
- }
- theDI << "\nC++ dynamic_pointer_cast: ";
- {
- std::shared_ptr<typename TAs::element_type> aPtr ((typename TAs::element_type* )theInst.Clone());
- QA_TEST_CAST10(0, doShareCast);
- QA_TEST_CAST10(1, doShareCast);
- QA_TEST_CAST10(2, doShareCast);
- QA_TEST_CAST10(3, doShareCast);
- QA_TEST_CAST10(4, doShareCast);
- QACast<Handle(qaclass50_50)>::doShareCast(theDI, theNbIters, aPtr);
- }
- }
-
-}
-
-//=======================================================================
-//function : QAHandleCast
-//purpose : Estimate performance of RTTI mechanisms - dynamic type casting
-//=======================================================================
-static Standard_Integer QAHandleCast (Draw_Interpretor& theDI,
- Standard_Integer theArgNb,
- const char** theArgVec)
-{
- if (theArgNb > 4)
- {
- std::cout << "Error: wrong syntax! See usage:\n";
- theDI.PrintHelp (theArgVec[0]);
- return 1;
- }
- Standard_Integer anArgIter = 0;
- const Standard_Integer anInst = (++anArgIter < theArgNb) ? Draw::Atoi (theArgVec[anArgIter]) : 50;
- const Standard_Integer aPtrTo = (++anArgIter < theArgNb) ? Draw::Atoi (theArgVec[anArgIter]) : 0;
- const Standard_Integer aNbIters = (++anArgIter < theArgNb) ? Draw::Atoi (theArgVec[anArgIter]) : 1000000;
-
- if (aNbIters < 1)
- {
- std::cout << "Error: number of iterations (" << aNbIters << ") should be positive!\n";
- return 1;
- }
- if (anInst > 50 || anInst < 0)
- {
- std::cout << "Error: class instance (" << anInst << ") should be specified within 0..50 range!\n";
- return 1;
- }
- if (aPtrTo > anInst || aPtrTo < 0)
- {
- std::cout << "Error: class pointer (" << aPtrTo << ") should be specified within 0.." << anInst << " range!\n";
- return 1;
- }
- else if (aPtrTo % 10 != 0)
- {
- std::cout << "Error: class pointer (" << aPtrTo << ") should be multiple of 10!\n";
- return 1;
- }
-
- Handle(qaclass00_50) aHandle = new qaclass50_50();
- for (Standard_Integer anInstIter = 50 - anInst; anInstIter > 0; --anInstIter)
- {
- Handle(Standard_Transient) aParent (aHandle->CreateParent());
- aHandle = Handle(qaclass00_50)::DownCast (aParent);
- }
-
- std::ios::fmtflags aFlags = std::cout.flags();
- std::cout.precision (5);
-
- switch (aPtrTo)
- {
- // vc11 requires /bigobj option
- case 0: qaCastAs<Handle(qaclass00_50)>(theDI, *aHandle, aNbIters); break;
- case 10: qaCastAs<Handle(qaclass10_50)>(theDI, *aHandle, aNbIters); break;
- case 20: qaCastAs<Handle(qaclass20_50)>(theDI, *aHandle, aNbIters); break;
- case 30: qaCastAs<Handle(qaclass30_50)>(theDI, *aHandle, aNbIters); break;
- case 40: qaCastAs<Handle(qaclass40_50)>(theDI, *aHandle, aNbIters); break;
- case 50: qaCastAs<Handle(qaclass50_50)>(theDI, *aHandle, aNbIters); break;
- }
- std::cout.setf (aFlags);
- return 0;
-}
-
//=======================================================================
//function : QAHandleKind
//purpose :
"QAHandleInc nbIter=1000000"
"\n\t\t: Test handle increment performance",
__FILE__, QAHandleInc, THE_GROUP);
- theCommands.Add ("QAHandleCast",
- "QAHandleCast [instance=50 [pointerTo=0 [nbIter=1000000]]]"
- "\n\t\t: Test handle DownCast performance."
- "\n\t\t: instance - specifies the depth of instantiated class"
- "\n\t\t: pointerTo - specifies the depth of pointer class, where instance is stored into",
- __FILE__, QAHandleCast, THE_GROUP);
theCommands.Add ("QAHandleKind",
"Test handle IsKind",
__FILE__, QAHandleKind, THE_GROUP);
const Interface_ShareTool& aShto,
Handle(Interface_Check)& ach) const
{
- Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve) aRationalBSC =
- Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)::DownCast(ent);
+ Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve) aRationalBSC = ent;
Handle(StepGeom_BSplineCurveWithKnots) aBSCWK =
aRationalBSC->BSplineCurveWithKnots();
RWStepGeom_RWBSplineCurveWithKnots t1;
const Interface_ShareTool& aShto,
Handle(Interface_Check)& ach) const
{
- Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface) aRationalBSS =
- Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface)
- ::DownCast(ent);
+ Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface) aRationalBSS = ent;
Handle(StepGeom_BSplineSurfaceWithKnots) aBSSWK =
aRationalBSS->BSplineSurfaceWithKnots();
RWStepGeom_RWBSplineSurfaceWithKnots t1;
if (subSHUO.IsNull())
return Standard_False;
- Handle(StepRepr_NextAssemblyUsageOccurrence) NUNAUO =
- Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(subSHUO->NextUsage());
+ Handle(StepRepr_NextAssemblyUsageOccurrence) NUNAUO = subSHUO->NextUsage();
if (NUNAUO.IsNull())
return Standard_False;
// Handle(Interface_InterfaceModel) Model = WS->Model();
// get upper usage NAUO from SHUO.
Handle(StepRepr_NextAssemblyUsageOccurrence) UUNAUO =
Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(SHUO->UpperUsage());
- Handle(StepRepr_NextAssemblyUsageOccurrence) NUNAUO =
- Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(SHUO->NextUsage());
+ Handle(StepRepr_NextAssemblyUsageOccurrence) NUNAUO = SHUO->NextUsage();
if ( UUNAUO.IsNull() || NUNAUO.IsNull() ) {
#ifdef OCCT_DEBUG
cout << "Warning: " << __FILE__ <<": Upper_usage or Next_usage of styled SHUO is null. Skip it" << endl;
Handle(StepRepr_ShapeAspectRelationship) SAR =
Handle(StepRepr_ShapeAspectRelationship)::DownCast(anIterC.Value());
if(SAR.IsNull()) continue;
- Handle(StepRepr_ShapeAspect) aS =
- Handle(StepRepr_ShapeAspect)::DownCast(SAR->RelatedShapeAspect());
+ Handle(StepRepr_ShapeAspect) aS = SAR->RelatedShapeAspect();
if(aS.IsNull()) continue;
Interface_EntityIterator anIterSA = aGraph.Sharings(aS);
for(anIterSA.Start(); anIterSA.More() && aPGISU.IsNull(); anIterSA.Next()) {
Handle(StepRepr_RepresentationItem) aRI;
for(Standard_Integer i = 1 ; i <= aPGISU->NbIdentifiedItem() && aRI.IsNull(); i++)
{
- aRI = Handle(StepRepr_RepresentationItem)::DownCast(aPGISU->IdentifiedItemValue(i));
+ aRI = aPGISU->IdentifiedItemValue(i);
}
if(aRI.IsNull()) continue;
Standard_Integer index = aTP->MapIndex(aRI);
= Handle(StepAP242_GeometricItemSpecificUsage)::DownCast(anIterDSWP.Value());
Handle(StepRepr_RepresentationItem) anItem;
if(aPGISU->NbIdentifiedItem() > 0) {
- anItem = Handle(StepRepr_RepresentationItem)::DownCast(aPGISU->IdentifiedItemValue(1));
+ anItem = aPGISU->IdentifiedItemValue(1);
}
if(anItem.IsNull()) continue;
Standard_Integer anItemIndex = aTP->MapIndex(anItem);
{
for(Standard_Integer i = aDRCA->Lower(); i <= aDRCA->Upper(); i++)
{
- Handle(StepDimTol_DatumReferenceCompartment) aDRC
- = Handle(StepDimTol_DatumReferenceCompartment)::DownCast(aDRCA->Value(i));
+ Handle(StepDimTol_DatumReferenceCompartment) aDRC = aDRCA->Value(i);
//gete modifiers
Handle(StepDimTol_HArray1OfDatumReferenceModifier) aModif = aDRC->Modifiers();
XCAFDimTolObjects_DatumModifiersSequence aXCAFModifiers;
Handle(StepRepr_HArray1OfRepresentationItem) HARI = VR->ItemElement();
if(HARI.IsNull()) continue;
if(HARI->Length()>0) {
- Handle(StepRepr_RepresentationItem) RI1 =
- Handle(StepRepr_RepresentationItem)::DownCast(HARI->Value(1));
+ Handle(StepRepr_RepresentationItem) RI1 = HARI->Value(1);
if(RI1.IsNull()) continue;
if(RI1->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit))) {
Handle(StepRepr_ReprItemAndLengthMeasureWithUnit) RILMWU =
}
}
if(HARI->Length()>1) {
- Handle(StepRepr_RepresentationItem) RI2 =
- Handle(StepRepr_RepresentationItem)::DownCast(HARI->Value(2));
+ Handle(StepRepr_RepresentationItem) RI2 = HARI->Value(2);
if(RI2.IsNull()) continue;
if(RI2->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit))) {
Handle(StepRepr_ReprItemAndLengthMeasureWithUnit) RILMWU =
{
for(Standard_Integer nr = aHARI->Lower(); nr <= aHARI->Upper(); nr++)
{
- Handle(StepRepr_RepresentationItem) aDRI =
- Handle(StepRepr_RepresentationItem)::DownCast(aHARI->Value(nr));
+ Handle(StepRepr_RepresentationItem) aDRI = aHARI->Value(nr);
if(aDRI.IsNull()) continue;
if(aDRI->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit))) {
for (Standard_Integer jsi = 1; jsi <= aSelItm->NbStyles() && !found; jsi++) {
- Handle(StepVisual_PresentationStyleAssignment) aFatherPSA =
- Handle(StepVisual_PresentationStyleAssignment)::DownCast(aSelItm->StylesValue(jsi));
+ Handle(StepVisual_PresentationStyleAssignment) aFatherPSA = aSelItm->StylesValue(jsi);
// check for PSA for top-level (not Presentation style by contex for NAUO)
if (aFatherPSA.IsNull() || aFatherPSA->IsKind(STANDARD_TYPE(StepVisual_PresentationStyleByContext)))
continue;
{
Standard_Boolean found = Standard_False;
for (Standard_Integer jsi = 1; jsi <= aSelItm->NbStyles() && !found; jsi++) {
- Handle(StepVisual_PresentationStyleAssignment) aFatherPSA =
- Handle(StepVisual_PresentationStyleAssignment)::DownCast(aSelItm->StylesValue(jsi));
+ Handle(StepVisual_PresentationStyleAssignment) aFatherPSA = aSelItm->StylesValue(jsi);
// check for PSA for top-level (not Presentation style by contex for NAUO)
if (aFatherPSA.IsNull() || aFatherPSA->IsKind(STANDARD_TYPE(StepVisual_PresentationStyleByContext)))
return Standard_False;
for ( si=1; si <= oldLengthlen; si++ )
newItems->SetValue( el++, oldItems->Value( si ) );
for ( si=1; si <= Styles.NbStyles(); si++ ) {
- newItems->SetValue( el++, Handle(StepRepr_RepresentationItem)::DownCast(Styles.Style(si)));
-// WP->Model()->AddWithRefs ( Handle(StepRepr_RepresentationItem)::DownCast (Styles.Style(si)));
+ newItems->SetValue( el++, Styles.Style(si));
}
if (newItems->Length() > 0)
new StepVisual_HArray1OfInvisibleItem (1,Styles.NbStyles());
// put all style item into the harray
for ( Standard_Integer si=1; si <= Styles.NbStyles(); si++ ) {
- Handle(StepRepr_RepresentationItem) styledItm =
- Handle(StepRepr_RepresentationItem)::DownCast(Styles.Style(si));
+ Handle(StepRepr_RepresentationItem) styledItm = Styles.Style(si);
StepVisual_InvisibleItem anInvItem;
anInvItem.SetValue( styledItm );
HInvsblItm->SetValue( si, anInvItem );
Standard_Integer el = 1;
for ( si=1; si <= oldLengthlen; si++ )
newItems->SetValue( el++, oldItems->Value( si ) );
- newItems->SetValue( el++, Handle(StepRepr_RepresentationItem)::DownCast(STEPstyle) );
+ newItems->SetValue (el++, STEPstyle);
// init MDGPR be new array of styled items
if (newItems->Length() > 0)
aMDGPR->SetItems( newItems );
StepAP242_ItemIdentifiedRepresentationUsageDefinition aDefinition;
aDefinition.SetValue(aDS);
Handle(StepRepr_HArray1OfRepresentationItem) anReprItems = new StepRepr_HArray1OfRepresentationItem(1, 1);
- Handle(StepRepr_RepresentationItem) anIdentifiedItem = Handle(StepRepr_RepresentationItem)::DownCast(anAxis);
+ Handle(StepRepr_RepresentationItem) anIdentifiedItem = anAxis;
anReprItems->SetValue(1, anIdentifiedItem);
Interface_EntityIterator subs = aGraph.Sharings(aFirstDatum->OfShape());
Handle(StepShape_ShapeDefinitionRepresentation) aSDR;
if (start->IsKind(STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation))) {
DeclareAndCast(StepShape_ContextDependentShapeRepresentation,CDSR,start);
- DeclareAndCast(StepRepr_RepresentationRelationship,SRR,CDSR->RepresentationRelation());
+ Handle(StepRepr_RepresentationRelationship) SRR = CDSR->RepresentationRelation();
if ( SRR.IsNull() ) return ;
Handle(StepRepr_Representation) rep;
if (start->IsKind(STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation))) {
DeclareAndCast(StepShape_ContextDependentShapeRepresentation,CDSR,start);
- DeclareAndCast(StepRepr_RepresentationRelationship,SRR,CDSR->RepresentationRelation());
+ Handle(StepRepr_RepresentationRelationship) SRR = CDSR->RepresentationRelation();
if ( SRR.IsNull() ) return ;
Handle(StepRepr_Representation) rep;
SelectMgr_SequenceOfSelector& aSelectors = myLocal.ChangeFind (theObject);
for (Standard_Integer aSelectorsIdx = 1; aSelectorsIdx <= aSelectors.Length(); aSelectorsIdx++)
{
- Handle(SelectMgr_ViewerSelector) aCurSelector =
- Handle(SelectMgr_ViewerSelector)::DownCast (aSelectors (aSelectorsIdx));
+ Handle(SelectMgr_ViewerSelector) aCurSelector = aSelectors (aSelectorsIdx);
if (!aCurSelector->Contains (theObject))
continue;
SelectMgr_SequenceOfSelector& theSelectors = myLocal.ChangeFind (theObject);
for (Standard_Integer aSelectorIdx = 1; aSelectorIdx <= theSelectors.Length(); aSelectorIdx++)
{
- Handle(SelectMgr_ViewerSelector) aCurSelector =
- Handle(SelectMgr_ViewerSelector)::DownCast (theSelectors (aSelectorIdx));
+ Handle(SelectMgr_ViewerSelector) aCurSelector = theSelectors (aSelectorIdx);
Activate (theObject, theMode, aCurSelector);
}
}
Geom2dConvert_ApproxCurve approx (tcurve, Precision::Approximation(),
GeomAbs_C1, 100, 6 );
if ( approx.HasResult() )
- aBSpline2d = Handle(Geom2d_BSplineCurve)::DownCast(approx.Curve());
+ aBSpline2d = approx.Curve();
else
aBSpline2d = Geom2dConvert::CurveToBSplineCurve(tcurve,Convert_QuasiAngular);
aFirst = aBSpline2d->FirstParameter();
OCC_CATCH_SIGNALS
GeomConvert_ApproxCurve approx (tcurve, Tol3d, Continuity, MaxSegments, MaxDeg);
if ( approx.HasResult() )
- aBSpline = Handle(Geom_BSplineCurve)::DownCast(approx.Curve());
+ aBSpline = approx.Curve();
else
aBSpline = GeomConvert::CurveToBSplineCurve(C3D,Convert_QuasiAngular);
}
Handle(Geom2d_Curve) tcurve = new Geom2d_TrimmedCurve(C2D,First,Last); //protection agains parabols ets
Geom2dConvert_ApproxCurve approx (tcurve, Tol2d, Continuity, MaxSegments, MaxDegree);
if ( approx.HasResult() )
- aBSpline2d = Handle(Geom2d_BSplineCurve)::DownCast(approx.Curve());
+ aBSpline2d = approx.Curve();
else
aBSpline2d = Geom2dConvert::CurveToBSplineCurve(tcurve,Convert_QuasiAngular);
}
}
else {
if(anApprox.HasResult())
- errSpl = Handle(Geom_BSplineSurface)::DownCast(anApprox.Surface());
+ errSpl = anApprox.Surface();
#ifdef OCCT_DEBUG
cout << "\terror = " << anApprox.MaxError() <<endl;
#endif
Handle(Geom_Curve) tcurve = new Geom_TrimmedCurve(aCurve,First,Last); //protection agains parabols ets
GeomConvert_ApproxCurve approx (tcurve, myTol3d/*Precision::Approximation()*/, myContinuity2d, myNbMaxSeg, 6 );
if ( approx.HasResult() )
- aBSpline = Handle(Geom_BSplineCurve)::DownCast(approx.Curve());
+ aBSpline = approx.Curve();
else
aBSpline = GeomConvert::CurveToBSplineCurve(tcurve,Convert_QuasiAngular);
Handle(Geom2d_Curve) tcurve = new Geom2d_TrimmedCurve(aCurve,First,Last); //protection agains parabols ets
Geom2dConvert_ApproxCurve approx (tcurve, myTol2d,myContinuity2d,myNbMaxSeg , 6 );
if ( approx.HasResult() )
- aBSpline2d = Handle(Geom2d_BSplineCurve)::DownCast(approx.Curve());
+ aBSpline2d = approx.Curve();
else
aBSpline2d = Geom2dConvert::CurveToBSplineCurve(tcurve,Convert_QuasiAngular);
{
myStatus = ShapeExtend::EncodeStatus ( ShapeExtend_OK );
myFixWire->SetContext ( Context() );
- Handle(ShapeFix_Wire) theAdvFixWire = Handle(ShapeFix_Wire)::DownCast(myFixWire);
+ Handle(ShapeFix_Wire) theAdvFixWire = myFixWire;
if (theAdvFixWire.IsNull()) return Standard_False;
BRep_Builder B;
{
Standard_Integer savFixSmallAreaWireMode = 0;
Standard_Integer savFixVertexTolMode = myFixVertexTolMode;
- Handle(ShapeFix_Face) fft = Handle(ShapeFix_Face)::DownCast( FixFaceTool() );
+ Handle(ShapeFix_Face) fft = FixFaceTool();
if ( !fft.IsNull() ) {
savFixSmallAreaWireMode = fft->FixSmallAreaWireMode();
if ( savFixSmallAreaWireMode == -1 &&
Handle(ShapeExtend_WireData) sbwd = WireData();
Standard_Integer i, nb = sbwd->NbEdges();
TopoDS_Face face = Face();
- Handle(ShapeFix_Edge) theAdvFixEdge = Handle(ShapeFix_Edge)::DownCast(myFixEdge);
+ Handle(ShapeFix_Edge) theAdvFixEdge = myFixEdge;
if (theAdvFixEdge.IsNull()) myFixReversed2dMode = Standard_False;
// fix revesred 2d / 3d curves
if ( ! IsLoaded() || NbEdges() <=1 ) return Standard_False;
// analysis:
- Handle(ShapeAnalysis_Wire) theAdvAnalyzer = Handle(ShapeAnalysis_Wire)::DownCast(myAnalyzer);
+ Handle(ShapeAnalysis_Wire) theAdvAnalyzer = myAnalyzer;
if (theAdvAnalyzer.IsNull()) return Standard_False;
Standard_Integer n = ( num >0 ? num : NbEdges() );
theAdvAnalyzer->CheckSmall ( n, precsmall );
// analysis
IntRes2d_SequenceOfIntersectionPoint points2d;
TColgp_SequenceOfPnt points3d;
- Handle(ShapeAnalysis_Wire) theAdvAnalyzer = Handle(ShapeAnalysis_Wire)::DownCast(myAnalyzer);
+ Handle(ShapeAnalysis_Wire) theAdvAnalyzer = myAnalyzer;
if (theAdvAnalyzer.IsNull()) return Standard_False;
theAdvAnalyzer->CheckSelfIntersectingEdge ( num, points2d, points3d );
if ( theAdvAnalyzer->LastCheckStatus ( ShapeExtend_FAIL ) ) {
IntRes2d_SequenceOfIntersectionPoint points2d;
TColgp_SequenceOfPnt points3d;
TColStd_SequenceOfReal errors;
- Handle(ShapeAnalysis_Wire) theAdvAnalyzer = Handle(ShapeAnalysis_Wire)::DownCast(myAnalyzer);
+ Handle(ShapeAnalysis_Wire) theAdvAnalyzer = myAnalyzer;
if (theAdvAnalyzer.IsNull()) return Standard_False;
theAdvAnalyzer->CheckIntersectingEdges ( num, points2d, points3d, errors );
if ( theAdvAnalyzer->LastCheckStatus ( ShapeExtend_FAIL ) ) {
IntRes2d_SequenceOfIntersectionPoint points2d;
TColgp_SequenceOfPnt points3d;
TColStd_SequenceOfReal errors;
- Handle(ShapeAnalysis_Wire) theAdvAnalyzer = Handle(ShapeAnalysis_Wire)::DownCast(myAnalyzer);
+ Handle(ShapeAnalysis_Wire) theAdvAnalyzer = myAnalyzer;
if (theAdvAnalyzer.IsNull()) return Standard_False;
theAdvAnalyzer->CheckIntersectingEdges ( num1, num2, points2d, points3d, errors);
if ( theAdvAnalyzer->LastCheckStatus ( ShapeExtend_FAIL ) ) {
//=============
// First phase: analysis whether the problem (gap) exists
gp_Pnt2d p2d1, p2d2;
- Handle(ShapeAnalysis_Wire)::DownCast(myAnalyzer)->CheckLacking ( num, ( force ? Precision() : 0. ), p2d1, p2d2 );
+ myAnalyzer->CheckLacking ( num, ( force ? Precision() : 0. ), p2d1, p2d2 );
if ( myAnalyzer->LastCheckStatus ( ShapeExtend_FAIL ) ) {
myLastFixStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_FAIL1 );
}
myLastFixStatus = ShapeExtend::EncodeStatus ( ShapeExtend_OK );
if ( ! IsReady() ) return Standard_False;
- Handle(ShapeAnalysis_Wire) theAdvAnalyzer = Handle(ShapeAnalysis_Wire)::DownCast(myAnalyzer);
+ Handle(ShapeAnalysis_Wire) theAdvAnalyzer = myAnalyzer;
TopoDS_Face face = Face();
if ( ! Context().IsNull() ) UpdateWire();
Handle(ShapeExtend_WireData) sewd = WireData();
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
- Handle(ShapeFix_Face) sff = Handle(ShapeFix_Face)::DownCast(sfs->FixFaceTool());
- Handle(ShapeFix_Wire) sfw = Handle(ShapeFix_Wire)::DownCast(sfs->FixWireTool());
+ Handle(ShapeFix_Face) sff = sfs->FixFaceTool();
+ Handle(ShapeFix_Wire) sfw = sfs->FixWireTool();
sfs->SetMsgRegistrator( msg );
sfs->SetPrecision ( ctx->RealVal ( "Tolerance3d", Precision::Confusion() ) );
Geom2dConvert_ApproxCurve approx (tcurve, Precision::Approximation(),
GeomAbs_C1, 100, 6 );
if ( approx.HasResult() )
- aBSpline2d = Handle(Geom2d_BSplineCurve)::DownCast(approx.Curve());
+ aBSpline2d = approx.Curve();
else
aBSpline2d = Geom2dConvert::CurveToBSplineCurve(tcurve,Convert_QuasiAngular);
GeomConvert_ApproxCurve approx (tcurve, Precision::Approximation(),
GeomAbs_C1, 100, 6 );
if ( approx.HasResult() )
- aBSpline = Handle(Geom_BSplineCurve)::DownCast(approx.Curve());
+ aBSpline = approx.Curve();
else {
Handle(Geom_TrimmedCurve) t3d = new Geom_TrimmedCurve(myCurve,First,Last);
aBSpline = GeomConvert::CurveToBSplineCurve(t3d,Convert_QuasiAngular);
}
else {
// not a BSpline: trimming instead of segmentation
- Handle(Geom_Surface)
- theNewSurf = Handle(Geom_Surface)::DownCast(theNew);
Handle(Geom_RectangularTrimmedSurface) SplittedSurf=
- new Geom_RectangularTrimmedSurface(theNewSurf,U1,U2,V1,V2);
+ new Geom_RectangularTrimmedSurface(theNew,U1,U2,V1,V2);
Surfaces->SetValue((irow-1),(icol-1),SplittedSurf);
}
return get() < theHandle.get();
}
- //! Down casting operator
+ //! Down casting operator from handle to base type
template <class T2>
- static handle DownCast (const handle<T2>& theObject)
+ static typename std::enable_if<is_base_but_not_same<T2, T>::value, handle>::type
+ DownCast (const handle<T2>& theObject)
{
return handle (dynamic_cast<T*>(const_cast<T2*>(theObject.get())));
}
- //! Down casting operator
+ //! Down casting operator from pointer to base type
template <class T2>
- static handle DownCast (const T2* thePtr)
+ static typename std::enable_if<is_base_but_not_same<T2, T>::value, handle>::type
+ DownCast (const T2* thePtr)
+ {
+ return handle (dynamic_cast<T*>(const_cast<T2*>(thePtr)));
+ }
+
+ //! For compatibility, define down casting operator from non-base type, as deprecated
+ template <class T2>
+ Standard_DEPRECATED("down-casting from object of the same or unrelated type is meaningless")
+ static handle DownCast (const handle<T2>& theObject, typename std::enable_if<!is_base_but_not_same<T2, T>::value, void*>::type = 0)
+ {
+ return handle (dynamic_cast<T*>(const_cast<T2*>(theObject.get())));
+ }
+
+ //! For compatibility, define down casting operator from non-base type, as deprecated
+ template <class T2>
+ Standard_DEPRECATED("down-casting from object of the same or unrelated type is meaningless")
+ static handle DownCast (const T2* thePtr, typename std::enable_if<!is_base_but_not_same<T2, T>::value, void*>::type = 0)
{
return handle (dynamic_cast<T*>(const_cast<T2*>(thePtr)));
}
{
Handle(StdObjMgt_Persistent) aTarget = theTarget;
ReadReference (aTarget);
- theTarget = Handle(Type)::DownCast (aTarget);
+ theTarget = dynamic_cast<Type*> (aTarget.get());
return *this;
}
for (int i = 0; i < anEntities.Length(); i++)
{
- Handle(Select3D_SensitiveEntity) SubEnt = Handle(Select3D_SensitiveEntity)::DownCast(anEntities.Value(i));
+ Handle(Select3D_SensitiveEntity) SubEnt = anEntities.Value(i);
//Segment
if (SubEnt->DynamicType()==STANDARD_TYPE(Select3D_SensitiveSegment))
Handle(StepData_StepModel) smodel = Handle(StepData_StepModel)::DownCast(Model());
// replace existing contexts for using AP209
- Handle(StepBasic_ProductContext) OldProdCtx =
- Handle(StepBasic_ProductContext)::DownCast(Prod->FrameOfReferenceValue(1));
+ Handle(StepBasic_ProductContext) OldProdCtx = Prod->FrameOfReferenceValue(1);
if(!OldProdCtx.IsNull()) {
Handle(StepBasic_ProductContext) ProdCtx = new StepBasic_ProductContext;
ProdCtx->Init(OldProdCtx->Name(),
HAPC->SetValue(1,ProdCtx);
Prod->SetFrameOfReference(HAPC);
}
- Handle(StepBasic_ProductDefinitionContext) OldPDCtx =
- Handle(StepBasic_ProductDefinitionContext)::DownCast(PD->FrameOfReference());
+ Handle(StepBasic_ProductDefinitionContext) OldPDCtx = PD->FrameOfReference();
if(!OldPDCtx.IsNull()) {
Handle(StepBasic_ProductDefinitionContext) PDCtx = new StepBasic_ProductDefinitionContext;
PDCtx->Init(OldPDCtx->Name(),
// replacing contexts:
Handle(StepBasic_ApplicationContext) ApplCtx;
- Handle(StepBasic_ProductContext) ProdCtx =
- Handle(StepBasic_ProductContext)::DownCast(Prod->FrameOfReferenceValue(1));
+ Handle(StepBasic_ProductContext) ProdCtx = Prod->FrameOfReferenceValue(1);
if(!ProdCtx.IsNull()) {
Handle(StepBasic_MechanicalContext) MechCtx = new StepBasic_MechanicalContext;
MechCtx->Init(ProdCtx->Name(), ProdCtx->FrameOfReference(),
Prod->SetFrameOfReference(HAPC);
ApplCtx = MechCtx->FrameOfReference();
}
- Handle(StepBasic_ProductDefinitionContext) PDCtx =
- Handle(StepBasic_ProductDefinitionContext)::DownCast(PD->FrameOfReference());
+ Handle(StepBasic_ProductDefinitionContext) PDCtx = PD->FrameOfReference();
if(!PDCtx.IsNull()) {
Handle(StepBasic_DesignContext) DesCtx = new StepBasic_DesignContext;
DesCtx->Init(PDCtx->Name(), PDCtx->FrameOfReference(),
BSR =
Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface)
::DownCast(SS);
- BS =
- Handle(StepGeom_BSplineSurfaceWithKnots)
- ::DownCast(BSR->BSplineSurfaceWithKnots());
+ BS = BSR->BSplineSurfaceWithKnots();
}
else
BS = Handle(StepGeom_BSplineSurfaceWithKnots)::DownCast(SS);
else if (SS->IsKind(STANDARD_TYPE(StepGeom_SurfaceReplica))) { //:n7 abv 16 Feb 99
const Handle(StepGeom_SurfaceReplica) SR = Handle(StepGeom_SurfaceReplica)::DownCast(SS);
const Handle(StepGeom_Surface) PS = SR->ParentSurface();
- const Handle(StepGeom_CartesianTransformationOperator3d) T =
- Handle(StepGeom_CartesianTransformationOperator3d)::DownCast(SR->Transformation());
+ const Handle(StepGeom_CartesianTransformationOperator3d) T = SR->Transformation();
// protect against cyclic references and wrong type of cartop
if ( !T.IsNull() && PS != SS ) {
Handle(Geom_Surface) S1 = MakeSurface (PS);
if (SC->IsKind(STANDARD_TYPE(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve))) {
BSCWR = Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)::DownCast(SC);
- BSCW = Handle(StepGeom_BSplineCurveWithKnots)::DownCast(BSCWR->BSplineCurveWithKnots());
+ BSCW = BSCWR->BSplineCurveWithKnots();
}
else
BSCW = Handle(StepGeom_BSplineCurveWithKnots)::DownCast(SC);
Standard_Boolean TCollection_HExtendedString::IsSameState
(const Handle(TCollection_HExtendedString)& other) const
{
- Handle(TCollection_HExtendedString) H;
- H = Handle(TCollection_HExtendedString)::DownCast(other);
- return ( myString == H->ChangeString() );
+ return myString == other->String();
}
new TObj_OcafObjectIterator(GetChildLabel(), NULL, Standard_True);
for(; aSrcChildren->More(); aSrcChildren->Next())
{
- Handle(TObj_Object) aSrcChild =
- Handle(TObj_Object)::DownCast(aSrcChildren->Value());
+ Handle(TObj_Object) aSrcChild = aSrcChildren->Value();
TDF_Label aSrcL = aSrcChild->GetLabel();
TDF_Label aDestLabel;
if( !theRelocTable->HasRelocation(aSrcL, aDestLabel) )
{
return anObject;
}
- anObject = Handle(TObj_Object)::DownCast(aTObject->Get());
+ anObject = aTObject->Get();
return anObject;
}
namedisp.ToCString(),namecolor);
}
char *pname = (char *)namedbrep.ToCString();
- Draw::Set(pname,Handle(Draw_Marker3D)::DownCast(D));
+ Draw::Set(pname,D);
}
void tsee_entity0::See()
Handle(TestTopOpeDraw_DrawableC3D) D;
D = new TestTopOpeDraw_DrawableC3D(GTC,namecolor,namedisp.ToCString(),namecolor);
char *pname = (char *)namedbrep.ToCString();
- Draw::Set(pname,Handle(DrawTrSurf_Curve)::DownCast(D));
+ Draw::Set(pname,D);
}
static TopoDS_Shape bidbid;
if (myPar != -1.0 ) D->SetPar(myPar);
char* pname = (char *)myNameDBRep.ToCString();
- Draw::Set(pname,Handle(DBRep_DrawableShape)::DownCast(D));
+ Draw::Set(pname,D);
}
//=======================================================================
template <typename T>
static void printLocalSelectionInfo (const T& theContext, Draw_Interpretor& theDI)
{
- const Standard_Boolean isGlobalCtx = !(Handle(AIS_InteractiveContext)::DownCast (theContext).IsNull());
+ const Standard_Boolean isGlobalCtx = (theContext->DynamicType() == STANDARD_TYPE(AIS_InteractiveContext));
TCollection_AsciiString aPrevName;
for (theContext->InitSelected(); theContext->MoreSelected(); theContext->NextSelected())
{
const Handle(VrmlData_ShapeNode) aNodeShape =
Handle(VrmlData_ShapeNode)::DownCast (anIter.Value());
if (aNodeShape.IsNull() == Standard_False) {
- const Handle(VrmlData_Geometry) aNodeGeom =
- Handle(VrmlData_Geometry)::DownCast(aNodeShape->Geometry());
+ const Handle(VrmlData_Geometry) aNodeGeom = aNodeShape->Geometry();
if (aNodeGeom.IsNull() == Standard_False) {
if (aSingleShape.IsNull() == Standard_False)
isSingleShape = Standard_False;
Standard_Integer aReflection = Draw::Atoi(argv[3]);
for (Standard_Integer aCount = 0 ; aCount < aMesh->GetBuildersCount(); aCount++ ){
- aTempBuilder = Handle(MeshVS_PrsBuilder)::DownCast(aMesh->FindBuilder("MeshVS_ElementalColorPrsBuilder"));
+ aTempBuilder = aMesh->FindBuilder("MeshVS_ElementalColorPrsBuilder");
if( !aTempBuilder.IsNull())
aMesh->RemoveBuilderById(aTempBuilder->GetId());
- aTempBuilder = Handle(MeshVS_PrsBuilder)::DownCast(aMesh->FindBuilder("MeshVS_NodalColorPrsBuilder"));
+ aTempBuilder = aMesh->FindBuilder("MeshVS_NodalColorPrsBuilder");
if( !aTempBuilder.IsNull())
aMesh->RemoveBuilderById(aTempBuilder->GetId());
}
Handle(MeshVS_PrsBuilder) aTempBuilder;
- aTempBuilder = Handle(MeshVS_PrsBuilder)::DownCast(aMesh->FindBuilder("MeshVS_VectorPrsBuilder"));
+ aTempBuilder = aMesh->FindBuilder("MeshVS_VectorPrsBuilder");
if( !aTempBuilder.IsNull())
aMesh->RemoveBuilderById(aTempBuilder->GetId());
TDF_Tool::Label (Target->Label().Data(), RefEntry, aLabel, Standard_True);
else
{
- Handle(TObj_Model) aModel = Handle(TObj_Model)::DownCast
- ( TObj_Assistant::FindModel( InHolderEntry.ToCString() ));
+ Handle(TObj_Model) aModel = TObj_Assistant::FindModel (InHolderEntry.ToCString());
TDF_Tool::Label (aModel->GetLabel().Data(), RefEntry, aLabel, Standard_True);
}
Handle(TObj_TReference) aTarget =
// is reference to other document
if (aLabel.Root() == aMasterLabel.Root()) return;
- Handle(TObj_Model) aModel =
- Handle(TObj_Model)::DownCast( aLObject->GetModel() );
+ Handle(TObj_Model) aModel = aLObject->GetModel();
TCollection_AsciiString aModelName( aModel->GetModelName()->String() );
Target.Element().setAttribute(::ReferredModelEntry(), aModelName.ToCString());
}