Back to index

salome-geom  6.5.0
GEOMImpl_ShapeDriver.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #include <GEOMImpl_ShapeDriver.hxx>
00024 
00025 #include <GEOMImpl_IShapes.hxx>
00026 #include <GEOMImpl_IVector.hxx>
00027 #include <GEOMImpl_Types.hxx>
00028 #include <GEOMImpl_Block6Explorer.hxx>
00029 
00030 #include <GEOM_Function.hxx>
00031 
00032 // OCCT Includes
00033 #include <ShapeFix_Wire.hxx>
00034 #include <ShapeFix_Edge.hxx>
00035 #include <ShapeFix_Shape.hxx>
00036 
00037 #include <BRep_Builder.hxx>
00038 #include <BRep_Tool.hxx>
00039 #include <BRepAdaptor_Curve.hxx>
00040 #include <BRepAlgo_FaceRestrictor.hxx>
00041 #include <BRepBuilderAPI_Copy.hxx>
00042 #include <BRepBuilderAPI_Sewing.hxx>
00043 #include <BRepBuilderAPI_MakeWire.hxx>
00044 #include <BRepBuilderAPI_MakeEdge.hxx>
00045 #include <BRepCheck.hxx>
00046 #include <BRepCheck_Analyzer.hxx>
00047 #include <BRepCheck_Shell.hxx>
00048 #include <BRepClass3d_SolidClassifier.hxx>
00049 #include <BRepLib.hxx>
00050 #include <BRepLib_MakeEdge.hxx>
00051 #include <BRepTools_WireExplorer.hxx>
00052 
00053 #include <ShapeAnalysis_FreeBounds.hxx>
00054 
00055 #include <TopAbs.hxx>
00056 #include <TopExp.hxx>
00057 #include <TopExp_Explorer.hxx>
00058 #include <TopoDS.hxx>
00059 #include <TopoDS_Shape.hxx>
00060 #include <TopoDS_Edge.hxx>
00061 #include <TopoDS_Wire.hxx>
00062 #include <TopoDS_Shell.hxx>
00063 #include <TopoDS_Solid.hxx>
00064 #include <TopoDS_Compound.hxx>
00065 #include <TopoDS_Iterator.hxx>
00066 
00067 #include <TopTools_MapOfShape.hxx>
00068 #include <TopTools_HSequenceOfShape.hxx>
00069 
00070 #include <ElCLib.hxx>
00071 
00072 #include <GCPnts_AbscissaPoint.hxx>
00073 
00074 #include <Geom_TrimmedCurve.hxx>
00075 #include <GeomAbs_CurveType.hxx>
00076 #include <GeomConvert_CompCurveToBSplineCurve.hxx>
00077 #include <GeomConvert.hxx>
00078 #include <GeomLProp.hxx>
00079 
00080 #include <TColStd_SequenceOfReal.hxx>
00081 #include <TColStd_HSequenceOfTransient.hxx>
00082 #include <TColStd_Array1OfReal.hxx>
00083 #include <TColGeom_SequenceOfCurve.hxx>
00084 #include <TColGeom_Array1OfBSplineCurve.hxx>
00085 #include <TColGeom_HArray1OfBSplineCurve.hxx>
00086 
00087 #include <Precision.hxx>
00088 
00089 #include <Standard_NullObject.hxx>
00090 #include <Standard_TypeMismatch.hxx>
00091 #include <Standard_ConstructionError.hxx>
00092 
00093 //modified by NIZNHY-PKV Wed Dec 28 13:48:20 2011f
00094 //static
00095 //  void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges,
00096 //                  const Handle(TopTools_HSequenceOfShape)& aWires);
00097 //modified by NIZNHY-PKV Wed Dec 28 13:48:23 2011t
00098 
00099 //=======================================================================
00100 //function : GetID
00101 //purpose  :
00102 //=======================================================================
00103 const Standard_GUID& GEOMImpl_ShapeDriver::GetID()
00104 {
00105   static Standard_GUID aShapeDriver("FF1BBB54-5D14-4df2-980B-3A668264EA16");
00106   return aShapeDriver;
00107 }
00108 
00109 
00110 //=======================================================================
00111 //function : GEOMImpl_ShapeDriver
00112 //purpose  :
00113 //=======================================================================
00114 GEOMImpl_ShapeDriver::GEOMImpl_ShapeDriver()
00115 {
00116 }
00117 
00118 //=======================================================================
00119 //function : Execute
00120 //purpose  :
00121 //=======================================================================
00122 Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
00123 {
00124   if (Label().IsNull()) return 0;
00125   Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
00126 
00127   GEOMImpl_IShapes aCI (aFunction);
00128   Standard_Integer aType = aFunction->GetType();
00129 
00130   TopoDS_Shape aShape;
00131   TCollection_AsciiString aWarning;
00132 
00133   BRep_Builder B;
00134 
00135   if (aType == WIRE_EDGES) {
00136     Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
00137     TopoDS_Wire aWire;
00138     B.MakeWire(aWire);
00139 
00140     // add edges
00141     for (unsigned int ind = 1; ind <= aShapes->Length(); ind++) {
00142       Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
00143       TopoDS_Shape aShape_i = aRefShape->GetValue();
00144       if (aShape_i.IsNull()) {
00145         Standard_NullObject::Raise("Shape for wire construction is null");
00146       }
00147      if (aShape_i.ShapeType() == TopAbs_EDGE || aShape_i.ShapeType() == TopAbs_WIRE) {
00148        TopExp_Explorer exp (aShape_i, TopAbs_EDGE);
00149        for (; exp.More(); exp.Next())
00150          B.Add(aWire, TopoDS::Edge(exp.Current()));
00151      } else {
00152        Standard_TypeMismatch::Raise
00153          ("Shape for wire construction is neither an edge nor a wire");
00154      }
00155     }
00156 
00157     // fix edges order
00158     Handle(ShapeFix_Wire) aFW = new ShapeFix_Wire;
00159     aFW->Load(aWire);
00160     aFW->FixReorder();
00161 
00162     if (aFW->StatusReorder(ShapeExtend_FAIL1)) {
00163       Standard_ConstructionError::Raise("Wire construction failed: several loops detected");
00164     } else if (aFW->StatusReorder(ShapeExtend_FAIL)) {
00165       Standard_ConstructionError::Raise("Wire construction failed");
00166     } else {
00167     }
00168 
00169     // IMP 0019766: Building a Wire from unconnected edges by introducing a tolerance
00170     Standard_Real aTolerance = aCI.GetTolerance();
00171     if (aTolerance < Precision::Confusion())
00172       aTolerance = Precision::Confusion();
00173 
00174     aFW->ClosedWireMode() = Standard_False;
00175     aFW->FixConnected(aTolerance);
00176     if (aFW->StatusConnected(ShapeExtend_FAIL)) {
00177       Standard_ConstructionError::Raise("Wire construction failed: cannot build connected wire");
00178     }
00179     // IMP 0019766
00180     if (aFW->StatusConnected(ShapeExtend_DONE3)) {
00181       // Confused with <prec> but not Analyzer.Precision(), set the same
00182       aFW->FixGapsByRangesMode() = Standard_True;
00183       if (aFW->FixGaps3d()) {
00184         Handle(ShapeExtend_WireData) sbwd = aFW->WireData();
00185         Handle(ShapeFix_Edge) aFe = new ShapeFix_Edge;
00186         for (Standard_Integer iedge = 1; iedge <= sbwd->NbEdges(); iedge++) {
00187           TopoDS_Edge aEdge = TopoDS::Edge(sbwd->Edge(iedge));
00188           aFe->FixVertexTolerance(aEdge);
00189           aFe->FixSameParameter(aEdge);
00190         }
00191       }
00192       else if (aFW->StatusGaps3d(ShapeExtend_FAIL)) {
00193         Standard_ConstructionError::Raise("Wire construction failed: cannot fix 3d gaps");
00194       }
00195     }
00196       aShape = aFW->WireAPIMake();
00197   }
00198   else if (aType == FACE_WIRE) {
00199     Handle(GEOM_Function) aRefBase = aCI.GetBase();
00200     TopoDS_Shape aShapeBase = aRefBase->GetValue();
00201     if (aShapeBase.IsNull()) Standard_NullObject::Raise("Argument Shape is null");
00202     TopoDS_Wire W;
00203     if (aShapeBase.ShapeType() == TopAbs_WIRE) {
00204       W = TopoDS::Wire(aShapeBase);
00205       // check the wire is closed
00206       TopoDS_Vertex aV1, aV2;
00207       TopExp::Vertices(W, aV1, aV2);
00208       if ( !aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2) )
00209         aShapeBase.Closed(true);
00210       else
00211         Standard_NullObject::Raise
00212           ("Shape for face construction is not closed");
00213     }
00214     else if (aShapeBase.ShapeType() == TopAbs_EDGE && aShapeBase.Closed()) {
00215       BRepBuilderAPI_MakeWire MW;
00216       MW.Add(TopoDS::Edge(aShapeBase));
00217       if (!MW.IsDone()) {
00218         Standard_ConstructionError::Raise("Wire construction failed");
00219       }
00220       W = MW;
00221     }
00222     else {
00223       Standard_NullObject::Raise
00224         ("Shape for face construction is neither a wire nor a closed edge");
00225     }
00226     aWarning = GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), aShape);
00227     if (aShape.IsNull()) {
00228       Standard_ConstructionError::Raise("Face construction failed");
00229     }
00230   }
00231   else if (aType == FACE_WIRES) {
00232     // Try to build a face from a set of wires and edges
00233     int ind;
00234 
00235     Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
00236     int nbshapes = aShapes->Length();
00237     if (nbshapes < 1) {
00238       Standard_ConstructionError::Raise("No wires or edges given");
00239     }
00240 
00241     // 1. Extract all edges from the given arguments
00242     TopTools_MapOfShape aMapEdges;
00243     Handle(TopTools_HSequenceOfShape) aSeqEdgesIn = new TopTools_HSequenceOfShape;
00244 
00245     for (ind = 1; ind <= nbshapes; ind++) {
00246       Handle(GEOM_Function) aRefSh_i = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
00247       TopoDS_Shape aSh_i = aRefSh_i->GetValue();
00248 
00249       TopExp_Explorer anExpE_i (aSh_i, TopAbs_EDGE);
00250       for (; anExpE_i.More(); anExpE_i.Next()) {
00251         if (aMapEdges.Add(anExpE_i.Current())) {
00252           aSeqEdgesIn->Append(anExpE_i.Current());
00253         }
00254       }
00255     }
00256 
00257     // 2. Connect edges to wires of maximum length
00258     Handle(TopTools_HSequenceOfShape) aSeqWiresOut;
00259     ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdgesIn, Precision::Confusion(),
00260                                                   /*shared*/Standard_False, aSeqWiresOut);
00261     //modified by NIZNHY-PKV Wed Dec 28 13:46:55 2011f
00262     //KeepEdgesOrder(aSeqEdgesIn, aSeqWiresOut);
00263     //modified by NIZNHY-PKV Wed Dec 28 13:46:59 2011t
00264 
00265     // 3. Separate closed wires
00266     Handle(TopTools_HSequenceOfShape) aSeqClosedWires = new TopTools_HSequenceOfShape;
00267     Handle(TopTools_HSequenceOfShape) aSeqOpenWires = new TopTools_HSequenceOfShape;
00268     for (ind = 1; ind <= aSeqWiresOut->Length(); ind++) {
00269       if (aSeqWiresOut->Value(ind).Closed())
00270         aSeqClosedWires->Append(aSeqWiresOut->Value(ind));
00271       else
00272         aSeqOpenWires->Append(aSeqWiresOut->Value(ind));
00273     }
00274 
00275     if (aSeqClosedWires->Length() < 1) {
00276       Standard_ConstructionError::Raise
00277         ("There is no closed contour can be built from the given arguments");
00278     }
00279 
00280     // 4. Build a face / list of faces from all the obtained closed wires
00281 
00282     // 4.a. Basic face
00283     TopoDS_Shape aFFace;
00284     TopoDS_Wire aW1 = TopoDS::Wire(aSeqClosedWires->Value(1));
00285     aWarning = GEOMImpl_Block6Explorer::MakeFace(aW1, aCI.GetIsPlanar(), aFFace);
00286     if (aFFace.IsNull()) {
00287       Standard_ConstructionError::Raise("Face construction failed");
00288     }
00289 
00290     // 4.b. Add other wires
00291     if (aSeqClosedWires->Length() == 1) {
00292       aShape = aFFace;
00293     }
00294     else {
00295       TopoDS_Compound C;
00296       BRep_Builder aBuilder;
00297       aBuilder.MakeCompound(C);
00298       BRepAlgo_FaceRestrictor FR;
00299 
00300       TopAbs_Orientation OriF = aFFace.Orientation();
00301       TopoDS_Shape aLocalS = aFFace.Oriented(TopAbs_FORWARD);
00302       FR.Init(TopoDS::Face(aLocalS), Standard_False, Standard_True);
00303 
00304       for (ind = 1; ind <= aSeqClosedWires->Length(); ind++) {
00305         TopoDS_Wire aW = TopoDS::Wire(aSeqClosedWires->Value(ind));
00306         FR.Add(aW);
00307       }
00308 
00309       FR.Perform();
00310 
00311       if (FR.IsDone()) {
00312         int k = 0;
00313         TopoDS_Shape aFace;
00314         for (; FR.More(); FR.Next()) {
00315           aFace = FR.Current().Oriented(OriF);
00316           aBuilder.Add(C, aFace);
00317           k++;
00318         }
00319         if (k == 1) {
00320           aShape = aFace;
00321         } else {
00322           aShape = C;
00323         }
00324       }
00325     }
00326 
00327     // 5. Add all open wires to the result
00328     if (aSeqOpenWires->Length() > 0) {
00329       //Standard_ConstructionError::Raise("There are some open wires");
00330       TopoDS_Compound C;
00331       BRep_Builder aBuilder;
00332       if (aSeqClosedWires->Length() == 1) {
00333         aBuilder.MakeCompound(C);
00334         aBuilder.Add(C, aShape);
00335       }
00336       else {
00337         C = TopoDS::Compound(aShape);
00338       }
00339 
00340       for (ind = 1; ind <= aSeqOpenWires->Length(); ind++) {
00341         aBuilder.Add(C, aSeqOpenWires->Value(ind));
00342       }
00343 
00344       aShape = C;
00345     }
00346   }
00347   else if (aType == SHELL_FACES) {
00348     Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
00349     unsigned int ind, nbshapes = aShapes->Length();
00350 
00351     // add faces
00352     BRepBuilderAPI_Sewing aSewing(Precision::Confusion()*10.0);
00353     for (ind = 1; ind <= nbshapes; ind++) {
00354       Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
00355       TopoDS_Shape aShape_i = aRefShape->GetValue();
00356       if (aShape_i.IsNull()) {
00357         Standard_NullObject::Raise("Face for shell construction is null");
00358       }
00359       aSewing.Add(aShape_i);
00360     }
00361 
00362     aSewing.Perform();
00363 
00364     TopoDS_Shape sh = aSewing.SewedShape();
00365     if( sh.ShapeType()==TopAbs_FACE && nbshapes==1 ) {
00366       // case for creation of shell from one face - PAL12722 (skl 26.06.2006)
00367       TopoDS_Shell ss;
00368       B.MakeShell(ss);
00369       B.Add(ss,sh);
00370       aShape = ss;
00371     }
00372     else {
00373       //TopExp_Explorer exp (aSewing.SewedShape(), TopAbs_SHELL);
00374       TopExp_Explorer exp (sh, TopAbs_SHELL);
00375       Standard_Integer ish = 0;
00376       for (; exp.More(); exp.Next()) {
00377         aShape = exp.Current();
00378         ish++;
00379       }
00380 
00381       if (ish != 1)
00382         aShape = aSewing.SewedShape();
00383     }
00384 
00385   }
00386   else if (aType == SOLID_SHELL) {
00387     Handle(GEOM_Function) aRefShell = aCI.GetBase();
00388     TopoDS_Shape aShapeShell = aRefShell->GetValue();
00389     if (!aShapeShell.IsNull() && aShapeShell.ShapeType() == TopAbs_COMPOUND) {
00390       TopoDS_Iterator It (aShapeShell, Standard_True, Standard_True);
00391       if (It.More()) aShapeShell = It.Value();
00392     }
00393     if (aShapeShell.IsNull() || aShapeShell.ShapeType() != TopAbs_SHELL) {
00394       Standard_NullObject::Raise("Shape for solid construction is null or not a shell");
00395     }
00396 
00397     BRepCheck_Shell chkShell(TopoDS::Shell(aShapeShell));
00398     if (chkShell.Closed() == BRepCheck_NotClosed) return 0;
00399 
00400     TopoDS_Solid Sol;
00401     B.MakeSolid(Sol);
00402     B.Add(Sol, aShapeShell);
00403     BRepClass3d_SolidClassifier SC (Sol);
00404     SC.PerformInfinitePoint(Precision::Confusion());
00405     if (SC.State() == TopAbs_IN) {
00406       B.MakeSolid(Sol);
00407       B.Add(Sol, aShapeShell.Reversed());
00408     }
00409 
00410     aShape = Sol;
00411 
00412   }
00413   else if (aType == SOLID_SHELLS) {
00414     Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
00415     unsigned int ind, nbshapes = aShapes->Length();
00416     Standard_Integer ish = 0;
00417     TopoDS_Solid Sol;
00418     B.MakeSolid(Sol);
00419 
00420     // add shapes
00421     for (ind = 1; ind <= nbshapes; ind++) {
00422       Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
00423       TopoDS_Shape aShapeShell = aRefShape->GetValue();
00424       if (aShapeShell.IsNull()) {
00425         Standard_NullObject::Raise("Shell for solid construction is null");
00426       }
00427       if (aShapeShell.ShapeType() == TopAbs_COMPOUND) {
00428         TopoDS_Iterator It (aShapeShell, Standard_True, Standard_True);
00429         if (It.More()) aShapeShell = It.Value();
00430       }
00431       if (aShapeShell.ShapeType() == TopAbs_SHELL) {
00432         B.Add(Sol, aShapeShell);
00433         ish++;
00434       }
00435     }
00436     if (ish == 0) return 0;
00437     BRepClass3d_SolidClassifier SC (Sol);
00438     SC.PerformInfinitePoint(Precision::Confusion());
00439     if (SC.State() == TopAbs_IN)
00440       aShape = Sol.Reversed();
00441     else
00442       aShape = Sol;
00443   }
00444   else if (aType == COMPOUND_SHAPES) {
00445     Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
00446     unsigned int ind, nbshapes = aShapes->Length();
00447 
00448     // add shapes
00449     TopoDS_Compound C;
00450     B.MakeCompound(C);
00451     for (ind = 1; ind <= nbshapes; ind++) {
00452       Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
00453       TopoDS_Shape aShape_i = aRefShape->GetValue();
00454       if (aShape_i.IsNull()) {
00455         Standard_NullObject::Raise("Shape for compound construction is null");
00456       }
00457       B.Add(C, aShape_i);
00458     }
00459 
00460     aShape = C;
00461 
00462   }
00463   /*
00464   else if (aType == REVERSE_ORIENTATION) {
00465     Handle(GEOM_Function) aRefShape = aCI.GetBase();
00466     TopoDS_Shape aShape_i = aRefShape->GetValue();
00467     if (aShape_i.IsNull()) {
00468        Standard_NullObject::Raise("Shape for reverse is null");
00469     }
00470 
00471     BRepBuilderAPI_Copy Copy(aShape_i);
00472     if( Copy.IsDone() ) {
00473       TopoDS_Shape tds = Copy.Shape();
00474       if( tds.IsNull() ) {
00475         Standard_ConstructionError::Raise("Orientation aborted : Can not reverse the shape");
00476       }
00477 
00478       if( tds.Orientation() == TopAbs_FORWARD)
00479         tds.Orientation(TopAbs_REVERSED);
00480       else
00481         tds.Orientation(TopAbs_FORWARD);
00482 
00483       aShape = tds;
00484     }
00485   }
00486   */
00487   else if (aType == EDGE_WIRE) {
00488     Handle(GEOM_Function) aRefBase = aCI.GetBase();
00489     TopoDS_Shape aWire = aRefBase->GetValue();
00490     Standard_Real LinTol = aCI.GetTolerance();
00491     Standard_Real AngTol = aCI.GetAngularTolerance();
00492     if (aWire.IsNull()) Standard_NullObject::Raise("Argument Wire is null");
00493 
00494     TopoDS_Edge ResEdge;
00495 
00496     BRepLib::BuildCurves3d(aWire);
00497     Handle(ShapeFix_Shape) Fixer = new ShapeFix_Shape(aWire);
00498     Fixer->SetPrecision(LinTol);
00499     Fixer->SetMaxTolerance(LinTol);
00500     Fixer->Perform();
00501     TopoDS_Wire theWire = TopoDS::Wire(Fixer->Shape());
00502 
00503     TColGeom_SequenceOfCurve CurveSeq;
00504     TopTools_SequenceOfShape LocSeq;
00505     TColStd_SequenceOfReal FparSeq;
00506     TColStd_SequenceOfReal LparSeq;
00507     TColStd_SequenceOfReal TolSeq;
00508     GeomAbs_CurveType CurType;
00509     TopoDS_Vertex FirstVertex, LastVertex;
00510     Standard_Boolean FinalReverse = Standard_False;
00511 
00512     BRepTools_WireExplorer wexp(theWire) ;
00513     for (; wexp.More(); wexp.Next())
00514     {
00515       TopoDS_Edge anEdge = wexp.Current();
00516       Standard_Real fpar, lpar;
00517       TopLoc_Location aLoc;
00518       Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aLoc, fpar, lpar);
00519       if (aCurve.IsNull())
00520         continue;
00521 
00522       BRepAdaptor_Curve BAcurve(anEdge);
00523       GeomAbs_CurveType aType = BAcurve.GetType();
00524 
00525       Handle(Geom_Curve) aBasisCurve = BAcurve.Curve().Curve();
00526 
00527       if (aBasisCurve->IsPeriodic())
00528         ElCLib::AdjustPeriodic(aBasisCurve->FirstParameter(), aBasisCurve->LastParameter(),
00529                                Precision::PConfusion(), fpar, lpar);
00530 
00531       if (CurveSeq.IsEmpty())
00532       {
00533         CurveSeq.Append(aCurve);
00534         TopoDS_Shape aLocShape;
00535         aLocShape.Location(aLoc);
00536         aLocShape.Orientation(wexp.Orientation());
00537         LocSeq.Append(aLocShape);
00538         FparSeq.Append(fpar);
00539         LparSeq.Append(lpar);
00540         CurType = aType;
00541         FirstVertex = wexp.CurrentVertex();
00542         if (anEdge.Orientation() == TopAbs_REVERSED)
00543           FinalReverse = Standard_True;
00544       }
00545       else
00546       {
00547         Standard_Boolean Done = Standard_False;
00548         Standard_Real NewFpar, NewLpar;
00549         GeomAdaptor_Curve GAprevcurve(CurveSeq.Last());
00550         TopoDS_Vertex CurVertex = wexp.CurrentVertex();
00551         TopoDS_Vertex CurFirstVer = TopExp::FirstVertex(anEdge);
00552         TopAbs_Orientation ConnectByOrigin = (CurVertex.IsSame(CurFirstVer))? TopAbs_FORWARD : TopAbs_REVERSED;
00553         if (aCurve == CurveSeq.Last())
00554         {
00555           NewFpar = fpar;
00556           NewLpar = lpar;
00557           if (aBasisCurve->IsPeriodic())
00558           {
00559             if (NewLpar < NewFpar)
00560               NewLpar += aBasisCurve->Period();
00561             if (ConnectByOrigin == TopAbs_FORWARD)
00562               ElCLib::AdjustPeriodic(FparSeq.Last(),
00563                                      FparSeq.Last() + aBasisCurve->Period(),
00564                                      Precision::PConfusion(), NewFpar, NewLpar);
00565             else
00566               ElCLib::AdjustPeriodic(FparSeq.Last() - aBasisCurve->Period(),
00567                                      FparSeq.Last(),
00568                                      Precision::PConfusion(), NewFpar, NewLpar);
00569           }
00570           Done = Standard_True;
00571         }
00572         else if (aType == CurType &&
00573                  aType != GeomAbs_BezierCurve &&
00574                  aType != GeomAbs_BSplineCurve &&
00575                  aType != GeomAbs_OtherCurve)
00576         {
00577           switch (aType)
00578           {
00579           case GeomAbs_Line:
00580             {
00581               gp_Lin aLine    = BAcurve.Line();
00582               gp_Lin PrevLine = GAprevcurve.Line();
00583               if (aLine.Contains(PrevLine.Location(), LinTol) &&
00584                   aLine.Direction().IsParallel(PrevLine.Direction(), AngTol))
00585               {
00586                 gp_Pnt P1 = ElCLib::Value(fpar, aLine);
00587                 gp_Pnt P2 = ElCLib::Value(lpar, aLine);
00588                 NewFpar = ElCLib::Parameter(PrevLine, P1);
00589                 NewLpar = ElCLib::Parameter(PrevLine, P2);
00590                 if (NewLpar < NewFpar)
00591                 {
00592                   Standard_Real MemNewFpar = NewFpar;
00593                   NewFpar = NewLpar;
00594                   NewLpar = MemNewFpar;
00595                   ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin);
00596                 }
00597                 Done = Standard_True;
00598               }
00599               break;
00600             }
00601           case GeomAbs_Circle:
00602             {
00603               gp_Circ aCircle    = BAcurve.Circle();
00604               gp_Circ PrevCircle = GAprevcurve.Circle();
00605               if (aCircle.Location().Distance(PrevCircle.Location()) <= LinTol &&
00606                   Abs(aCircle.Radius() - PrevCircle.Radius()) <= LinTol &&
00607                   aCircle.Axis().IsParallel(PrevCircle.Axis(), AngTol))
00608               {
00609                 if (aCircle.Axis().Direction() * PrevCircle.Axis().Direction() < 0.)
00610                 {
00611                   Standard_Real memfpar = fpar;
00612                   fpar = lpar;
00613                   lpar = memfpar;
00614                   ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin);
00615                 }
00616                 gp_Pnt P1 = ElCLib::Value(fpar, aCircle);
00617                 gp_Pnt P2 = ElCLib::Value(lpar, aCircle);
00618                 NewFpar = ElCLib::Parameter(PrevCircle, P1);
00619                 NewLpar = ElCLib::Parameter(PrevCircle, P2);
00620                 if (NewLpar < NewFpar)
00621                   NewLpar += 2.*M_PI;
00622                 //Standard_Real MemNewFpar = NewFpar, MemNewLpar =  NewLpar;
00623                 if (ConnectByOrigin == TopAbs_FORWARD)
00624                   ElCLib::AdjustPeriodic(FparSeq.Last(),
00625                                          FparSeq.Last() + 2.*M_PI,
00626                                          Precision::PConfusion(), NewFpar, NewLpar);
00627                 else
00628                   ElCLib::AdjustPeriodic(FparSeq.Last() - 2.*M_PI,
00629                                          FparSeq.Last(),
00630                                          Precision::PConfusion(), NewFpar, NewLpar);
00631                 Done = Standard_True;
00632               }
00633               break;
00634             }
00635           case GeomAbs_Ellipse:
00636             {
00637               gp_Elips anEllipse   = BAcurve.Ellipse();
00638               gp_Elips PrevEllipse = GAprevcurve.Ellipse();
00639               if (anEllipse.Focus1().Distance(PrevEllipse.Focus1()) <= LinTol &&
00640                   anEllipse.Focus2().Distance(PrevEllipse.Focus2()) <= LinTol &&
00641                   Abs(anEllipse.MajorRadius() - PrevEllipse.MajorRadius()) <= LinTol &&
00642                   Abs(anEllipse.MinorRadius() - PrevEllipse.MinorRadius()) <= LinTol &&
00643                   anEllipse.Axis().IsParallel(PrevEllipse.Axis(), AngTol))
00644               {
00645                 if (anEllipse.Axis().Direction() * PrevEllipse.Axis().Direction() < 0.)
00646                 {
00647                   Standard_Real memfpar = fpar;
00648                   fpar = lpar;
00649                   lpar = memfpar;
00650                   ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin);
00651                 }
00652                 gp_Pnt P1 = ElCLib::Value(fpar, anEllipse);
00653                 gp_Pnt P2 = ElCLib::Value(lpar, anEllipse);
00654                 NewFpar = ElCLib::Parameter(PrevEllipse, P1);
00655                 NewLpar = ElCLib::Parameter(PrevEllipse, P2);
00656                 if (NewLpar < NewFpar)
00657                   NewLpar += 2.*M_PI;
00658                 if (ConnectByOrigin == TopAbs_FORWARD)
00659                   ElCLib::AdjustPeriodic(FparSeq.Last(),
00660                                          FparSeq.Last() + 2.*M_PI,
00661                                          Precision::PConfusion(), NewFpar, NewLpar);
00662                 else
00663                   ElCLib::AdjustPeriodic(FparSeq.Last() - 2.*M_PI,
00664                                          FparSeq.Last(),
00665                                          Precision::PConfusion(), NewFpar, NewLpar);
00666                 Done = Standard_True;
00667               }
00668               break;
00669             }
00670           case GeomAbs_Hyperbola:
00671             {
00672               gp_Hypr aHypr    = BAcurve.Hyperbola();
00673               gp_Hypr PrevHypr = GAprevcurve.Hyperbola();
00674               if (aHypr.Focus1().Distance(PrevHypr.Focus1()) <= LinTol &&
00675                   aHypr.Focus2().Distance(PrevHypr.Focus2()) <= LinTol &&
00676                   Abs(aHypr.MajorRadius() - PrevHypr.MajorRadius()) <= LinTol &&
00677                   Abs(aHypr.MinorRadius() - PrevHypr.MinorRadius()) <= LinTol &&
00678                   aHypr.Axis().IsParallel(PrevHypr.Axis(), AngTol))
00679               {
00680                 gp_Pnt P1 = ElCLib::Value(fpar, aHypr);
00681                 gp_Pnt P2 = ElCLib::Value(lpar, aHypr);
00682                 NewFpar = ElCLib::Parameter(PrevHypr, P1);
00683                 NewLpar = ElCLib::Parameter(PrevHypr, P2);
00684                 if (NewLpar < NewFpar)
00685                 {
00686                   Standard_Real MemNewFpar = NewFpar;
00687                   NewFpar = NewLpar;
00688                   NewLpar = MemNewFpar;
00689                   ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin);
00690                 }
00691                 Done = Standard_True;
00692               }
00693               break;
00694             }
00695           case GeomAbs_Parabola:
00696             {
00697               gp_Parab aParab    = BAcurve.Parabola();
00698               gp_Parab PrevParab = GAprevcurve.Parabola();
00699               if (aParab.Location().Distance(PrevParab.Location()) <= LinTol &&
00700                   aParab.Focus().Distance(PrevParab.Focus()) <= LinTol &&
00701                   Abs(aParab.Focal() - PrevParab.Focal()) <= LinTol &&
00702                   aParab.Axis().IsParallel(PrevParab.Axis(), AngTol))
00703               {
00704                 gp_Pnt P1 = ElCLib::Value(fpar, aParab);
00705                 gp_Pnt P2 = ElCLib::Value(lpar, aParab);
00706                 NewFpar = ElCLib::Parameter(PrevParab, P1);
00707                 NewLpar = ElCLib::Parameter(PrevParab, P2);
00708                 if (NewLpar < NewFpar)
00709                 {
00710                   Standard_Real MemNewFpar = NewFpar;
00711                   NewFpar = NewLpar;
00712                   NewLpar = MemNewFpar;
00713                   ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin);
00714                 }
00715                 Done = Standard_True;
00716               }
00717               break;
00718             }
00719           } //end of switch (aType)
00720         } // end of else if (aType == CurType && ...
00721         if (Done)
00722         {
00723           if (NewFpar < FparSeq.Last())
00724             FparSeq(FparSeq.Length()) = NewFpar;
00725           else
00726             LparSeq(LparSeq.Length()) = NewLpar;
00727         }
00728         else
00729         {
00730           CurveSeq.Append(aCurve);
00731           TopoDS_Shape aLocShape;
00732           aLocShape.Location(aLoc);
00733           aLocShape.Orientation(wexp.Orientation());
00734           LocSeq.Append(aLocShape);
00735           FparSeq.Append(fpar);
00736           LparSeq.Append(lpar);
00737           TolSeq.Append(BRep_Tool::Tolerance(CurVertex));
00738           CurType = aType;
00739         }
00740       } // end of else (CurveSeq.IsEmpty()) -> not first time
00741     } // end for (; wexp.More(); wexp.Next())
00742 
00743     LastVertex = wexp.CurrentVertex();
00744     TolSeq.Append(BRep_Tool::Tolerance(LastVertex));
00745 
00746     TopoDS_Vertex FirstVtx_final = (FinalReverse)? LastVertex : FirstVertex;
00747     FirstVtx_final.Orientation(TopAbs_FORWARD);
00748     TopoDS_Vertex LastVtx_final = (FinalReverse)? FirstVertex : LastVertex;
00749     LastVtx_final.Orientation(TopAbs_REVERSED);
00750 
00751     if (!CurveSeq.IsEmpty())
00752     {
00753       Standard_Integer nb_curve = CurveSeq.Length();   //number of curves
00754       TColGeom_Array1OfBSplineCurve tab(0,nb_curve-1);                    //array of the curves
00755       TColStd_Array1OfReal tabtolvertex(0,nb_curve-1); //(0,nb_curve-2);  //array of the tolerances
00756 
00757       Standard_Integer i;
00758 
00759       if (nb_curve > 1)
00760       {
00761         for (i = 1; i <= nb_curve; i++)
00762         {
00763           if (CurveSeq(i)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve)))
00764             CurveSeq(i) = (*((Handle(Geom_TrimmedCurve)*)&(CurveSeq(i))))->BasisCurve();
00765 
00766           Handle(Geom_TrimmedCurve) aTrCurve = new Geom_TrimmedCurve(CurveSeq(i), FparSeq(i), LparSeq(i));
00767           tab(i-1) = GeomConvert::CurveToBSplineCurve(aTrCurve);
00768           tab(i-1)->Transform(LocSeq(i).Location().Transformation());
00769           GeomConvert::C0BSplineToC1BSplineCurve(tab(i-1), Precision::Confusion());
00770           if (LocSeq(i).Orientation() == TopAbs_REVERSED)
00771             tab(i-1)->Reverse();
00772 
00773           //Temporary
00774           //char* name = new char[100];
00775           //sprintf(name, "c%d", i);
00776           //DrawTrSurf::Set(name, tab(i-1));
00777 
00778           if (i > 1)
00779             tabtolvertex(i-2) = TolSeq(i-1);
00780         } // end for (i = 1; i <= nb_curve; i++)
00781         tabtolvertex(nb_curve-1) = TolSeq(TolSeq.Length());
00782 
00783         Standard_Boolean closed_flag = Standard_False;
00784         Standard_Real closed_tolerance = 0.;
00785         if (FirstVertex.IsSame(LastVertex) &&
00786             GeomLProp::Continuity(tab(0), tab(nb_curve-1),
00787                                   tab(0)->FirstParameter(),
00788                                   tab(nb_curve-1)->LastParameter(),
00789                                   Standard_False, Standard_False, LinTol, AngTol) >= GeomAbs_G1)
00790         {
00791           closed_flag = Standard_True ;
00792           closed_tolerance = BRep_Tool::Tolerance(FirstVertex);
00793         }
00794 
00795         Handle(TColGeom_HArray1OfBSplineCurve)  concatcurve;     //array of the concatenated curves
00796         Handle(TColStd_HArray1OfInteger)        ArrayOfIndices;  //array of the remining Vertex
00797         GeomConvert::ConcatC1(tab,
00798                               tabtolvertex,
00799                               ArrayOfIndices,
00800                               concatcurve,
00801                               closed_flag,
00802                               closed_tolerance);   //C1 concatenation
00803 
00804         if (concatcurve->Length() > 1)
00805         {
00806           GeomConvert_CompCurveToBSplineCurve Concat(concatcurve->Value(concatcurve->Lower()));
00807 
00808           for (i = concatcurve->Lower()+1; i <= concatcurve->Upper(); i++)
00809             Concat.Add( concatcurve->Value(i), LinTol, Standard_True );
00810 
00811           concatcurve->SetValue(concatcurve->Lower(), Concat.BSplineCurve());
00812         }
00813         // rnc : prevents the driver from building an edge without C1 continuity
00814         if (concatcurve->Value(concatcurve->Lower())->Continuity()==GeomAbs_C0){
00815           Standard_ConstructionError::Raise("Construction aborted : The given Wire has sharp bends between some Edges, no valid Edge can be built");
00816         }
00817         ResEdge = BRepLib_MakeEdge(concatcurve->Value(concatcurve->Lower()),
00818                                    FirstVtx_final, LastVtx_final,
00819                                    concatcurve->Value(concatcurve->Lower())->FirstParameter(),
00820                                    concatcurve->Value(concatcurve->Lower())->LastParameter());
00821       }
00822       else
00823       {
00824         if (CurveSeq(1)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve)))
00825           CurveSeq(1) = (*((Handle(Geom_TrimmedCurve)*)&(CurveSeq(1))))->BasisCurve();
00826 
00827         CurveSeq(1)->Transform(LocSeq(1).Location().Transformation());
00828         ResEdge = BRepLib_MakeEdge(CurveSeq(1),
00829                                    FirstVtx_final, LastVtx_final,
00830                                    FparSeq(1), LparSeq(1));
00831       }
00832     }
00833 
00834     if (FinalReverse)
00835       ResEdge.Reverse();
00836 
00837     aShape = ResEdge;
00838   }
00839   else if (aType == EDGE_CURVE_LENGTH) {
00840     GEOMImpl_IVector aVI (aFunction);
00841 
00842     // RefCurve
00843     Handle(GEOM_Function) aRefCurve = aVI.GetPoint1();
00844     if (aRefCurve.IsNull()) Standard_NullObject::Raise("Argument Curve is null");
00845     TopoDS_Shape aRefShape1 = aRefCurve->GetValue();
00846     if (aRefShape1.ShapeType() != TopAbs_EDGE) {
00847       Standard_TypeMismatch::Raise
00848         ("Edge On Curve creation aborted : curve shape is not an edge");
00849     }
00850     TopoDS_Edge aRefEdge = TopoDS::Edge(aRefShape1);
00851     TopoDS_Vertex V1, V2;
00852     TopExp::Vertices(aRefEdge, V1, V2, Standard_True);
00853 
00854     // RefPoint
00855     TopoDS_Vertex aRefVertex;
00856     Handle(GEOM_Function) aRefPoint = aVI.GetPoint2();
00857     if (aRefPoint.IsNull()) {
00858       aRefVertex = V1;
00859     }
00860     else {
00861       TopoDS_Shape aRefShape2 = aRefPoint->GetValue();
00862       if (aRefShape2.ShapeType() != TopAbs_VERTEX) {
00863         Standard_TypeMismatch::Raise
00864           ("Edge On Curve creation aborted : start point shape is not a vertex");
00865       }
00866       aRefVertex = TopoDS::Vertex(aRefShape2);
00867     }
00868     gp_Pnt aRefPnt = BRep_Tool::Pnt(aRefVertex);
00869 
00870     // Length
00871     Standard_Real aLength = aVI.GetParameter();
00872     //Standard_Real aCurveLength = IntTools::Length(aRefEdge);
00873     //if (aLength > aCurveLength) {
00874     //  Standard_ConstructionError::Raise
00875     //    ("Edge On Curve creation aborted : given length is greater than edges length");
00876     //}
00877     if (fabs(aLength) < Precision::Confusion()) {
00878       Standard_ConstructionError::Raise
00879         ("Edge On Curve creation aborted : given length is smaller than Precision::Confusion()");
00880     }
00881 
00882     // Check orientation
00883     Standard_Real UFirst, ULast;
00884     Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(aRefEdge, UFirst, ULast);
00885     Handle(Geom_Curve) ReOrientedCurve = EdgeCurve;
00886 
00887     Standard_Real dU = ULast - UFirst;
00888     Standard_Real par1 = UFirst + 0.1 * dU;
00889     Standard_Real par2 = ULast  - 0.1 * dU;
00890 
00891     gp_Pnt P1 = EdgeCurve->Value(par1);
00892     gp_Pnt P2 = EdgeCurve->Value(par2);
00893 
00894     if (aRefPnt.SquareDistance(P2) < aRefPnt.SquareDistance(P1)) {
00895       ReOrientedCurve = EdgeCurve->Reversed();
00896       UFirst = EdgeCurve->ReversedParameter(ULast);
00897     }
00898 
00899     // Get the point by length
00900     GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve);
00901     GCPnts_AbscissaPoint anAbsPnt (AdapCurve, aLength, UFirst);
00902     Standard_Real aParam = anAbsPnt.Parameter();
00903 
00904     if (AdapCurve.IsClosed() && aLength < 0.0) {
00905       Standard_Real aTmp = aParam;
00906       aParam = UFirst;
00907       UFirst = aTmp;
00908     }
00909 
00910     BRepBuilderAPI_MakeEdge aME (ReOrientedCurve, UFirst, aParam);
00911     if (aME.IsDone())
00912       aShape = aME.Shape();
00913   }
00914   else {
00915   }
00916 
00917   if (aShape.IsNull()) return 0;
00918 
00919   // Check shape validity
00920   BRepCheck_Analyzer ana (aShape, false);
00921   if (!ana.IsValid()) {
00922     //Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
00923   }
00924 
00925   aFunction->SetValue(aShape);
00926 
00927   log.SetTouched(Label());
00928 
00929   if (!aWarning.IsEmpty())
00930     Standard_Failure::Raise(aWarning.ToCString());
00931 
00932   return 1;
00933 }
00934 
00935 
00936 //=======================================================================
00937 //function :  GEOMImpl_ShapeDriver_Type_
00938 //purpose  :
00939 //=======================================================================
00940 Standard_EXPORT Handle_Standard_Type& GEOMImpl_ShapeDriver_Type_()
00941 {
00942 
00943   static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
00944   if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
00945   static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
00946   if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
00947   static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
00948   if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
00949 
00950 
00951   static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
00952   static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ShapeDriver",
00953                                                          sizeof(GEOMImpl_ShapeDriver),
00954                                                          1,
00955                                                          (Standard_Address)_Ancestors,
00956                                                          (Standard_Address)NULL);
00957 
00958   return _aType;
00959 }
00960 
00961 //=======================================================================
00962 //function : DownCast
00963 //purpose  :
00964 //=======================================================================
00965 const Handle(GEOMImpl_ShapeDriver) Handle(GEOMImpl_ShapeDriver)::DownCast(const Handle(Standard_Transient)& AnObject)
00966 {
00967   Handle(GEOMImpl_ShapeDriver) _anOtherObject;
00968 
00969   if (!AnObject.IsNull()) {
00970      if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ShapeDriver))) {
00971        _anOtherObject = Handle(GEOMImpl_ShapeDriver)((Handle(GEOMImpl_ShapeDriver)&)AnObject);
00972      }
00973   }
00974 
00975   return _anOtherObject;
00976 }
00977 
00978 //modified by NIZNHY-PKV Wed Dec 28 13:48:31 2011f
00979 #include <TopoDS_Iterator.hxx>
00980 #include <TopTools_HSequenceOfShape.hxx>
00981 #include <ShapeAnalysis_FreeBounds.hxx>
00982 #include <TopTools_MapOfShape.hxx>
00983 #include <TopTools_MapOfOrientedShape.hxx>
00984 #include <BRep_Builder.hxx>
00985 #include <TopoDS_Wire.hxx>
00986 
00987 //=======================================================================
00988 //function : KeepEdgesOrder
00989 //purpose  : 
00990 //=======================================================================
00991 /*
00992 void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges,
00993                   const Handle(TopTools_HSequenceOfShape)& aWires)
00994 {
00995   Standard_Integer aNbWires, aNbEdges;
00996   // 
00997   if (aEdges.IsNull()) {
00998     return;
00999   }
01000   //
01001   if (aWires.IsNull()) {
01002     return;
01003   }
01004   //
01005   aNbEdges=aEdges->Length();
01006   aNbWires=aWires->Length();
01007   if (!aNbEdges || !aNbWires) {
01008     return;
01009   }
01010   //-----
01011   Standard_Boolean bClosed;
01012   Standard_Integer i, j;
01013   TopoDS_Wire aWy;
01014   TopoDS_Iterator aIt;
01015   BRep_Builder aBB;
01016   TopTools_MapOfOrientedShape aMEx;
01017   //
01018   for (i=1; i<=aNbWires; ++i) {
01019     const TopoDS_Shape& aWx=aWires->Value(i);
01020     //
01021     aMEx.Clear();
01022     aIt.Initialize (aWx);
01023     for (; aIt.More(); aIt.Next()) {
01024       const TopoDS_Shape& aEx=aIt.Value();
01025       aMEx.Add(aEx);
01026     }
01027     // aWy
01028     aBB.MakeWire (aWy);
01029     for (j=1; j<=aNbEdges; ++j) {
01030       const TopoDS_Shape& aE=aEdges->Value(j);
01031       if (aMEx.Contains(aE)) {
01032        aBB.Add(aWy, aE);
01033       }
01034     }
01035     //
01036     bClosed=aWx.Closed();
01037     aWy.Closed(bClosed);
01038     //
01039     aWires->Append(aWy);
01040   }// for (i=1; i<=aNbWires; ++i) {
01041   //
01042   aWires->Remove(1, aNbWires);
01043 }
01044 */
01045 //modified by NIZNHY-PKV Wed Dec 28 13:48:34 2011t