1 // Created on: 1994-08-25
2 // Created by: Jacques GOUSSARD
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 // IFV 04.06.99 - PRO18974 - processing of INTERNAL shapes.
19 #include <BRepTools_Modification.hxx>
20 #include <BRepTools_Modifier.hxx>
21 #include <Message_ProgressIndicator.hxx>
22 #include <Standard_NoSuchObject.hxx>
23 #include <Standard_NullObject.hxx>
24 #include <TColStd_ListIteratorOfListOfTransient.hxx>
25 #include <TColStd_ListOfTransient.hxx>
26 #include <TopExp_Explorer.hxx>
27 #include <TopoDS_Edge.hxx>
28 #include <TopoDS_Face.hxx>
29 #include <TopoDS_Iterator.hxx>
30 #include <TopoDS_Shape.hxx>
31 #include <TopoDS_Vertex.hxx>
32 #include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
33 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
34 #include <TopTools_ListIteratorOfListOfShape.hxx>
35 #include <TopTools_ListOfShape.hxx>
38 #include <Poly_Triangulation.hxx>
39 #include <Poly_Polygon3D.hxx>
40 #include <BRepMesh_IncrementalMesh.hxx>
43 #include <Geom2d_Line.hxx>
44 #include <BRep_Builder.hxx>
45 #include <BRep_Tool.hxx>
47 #include <BRepTools.hxx>
54 #include <Standard_NullObject.hxx>
55 #include <gp_Trsf.hxx>
56 #include <BRepTools_TrsfModification.hxx>
57 #include <Message_ProgressSentry.hxx>
58 #include <Geom_Surface.hxx>
60 static void SetShapeFlags(const TopoDS_Shape& theInSh, TopoDS_Shape& theOutSh);
62 //=======================================================================
63 //function : BRepTools_Modifier
65 //=======================================================================
67 BRepTools_Modifier::BRepTools_Modifier (Standard_Boolean theMutableInput):
68 myDone(Standard_False), myMutableInput (theMutableInput)
71 //=======================================================================
72 //function : BRepTools_Modifier
74 //=======================================================================
76 BRepTools_Modifier::BRepTools_Modifier (const TopoDS_Shape& S) :
77 myShape(S),myDone(Standard_False), myMutableInput (Standard_False)
82 //=======================================================================
83 //function : BRepTools_Modifier
85 //=======================================================================
87 BRepTools_Modifier::BRepTools_Modifier
88 (const TopoDS_Shape& S,
89 const Handle(BRepTools_Modification)& M)
90 : myShape(S), myDone(Standard_False),
91 myMutableInput (Standard_False)
98 //=======================================================================
101 //=======================================================================
103 void BRepTools_Modifier::Init(const TopoDS_Shape& S)
106 myDone = Standard_False;
111 //=======================================================================
114 //=======================================================================
115 #ifdef DEBUG_Modifier
116 static TopTools_IndexedMapOfShape MapE, MapF;
119 void BRepTools_Modifier::Perform(const Handle(BRepTools_Modification)& M, const Handle(Message_ProgressIndicator) & aProgress)
121 if (myShape.IsNull()) {
122 throw Standard_NullObject();
124 #ifdef DEBUG_Modifier
125 MapE.Clear(); MapF.Clear();
126 TopExp::MapShapes(myShape, TopAbs_EDGE, MapE);
127 TopExp::MapShapes(myShape, TopAbs_FACE, MapF);
129 TopTools_DataMapIteratorOfDataMapOfShapeShape theIter(myMap);
131 Message_ProgressSentry aPSentry(aProgress, "Converting Shape", 0, 2, 1);
133 TopTools_IndexedDataMapOfShapeListOfShape aMVE, aMEF;
134 TopExp::MapShapesAndAncestors(myShape, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
135 TopExp::MapShapesAndAncestors(myShape, TopAbs_EDGE, TopAbs_FACE, aMEF);
137 CreateNewVertices(aMVE, M);
139 FillNewCurveInfo(aMEF, M);
141 FillNewSurfaceInfo(M);
144 CreateOtherVertices(aMVE, aMEF, M);
146 Standard_Boolean aNewGeom;
147 Rebuild(myShape, M, aNewGeom, aProgress);
149 if (!aPSentry.More())
151 // The processing was broken
157 if (myShape.ShapeType() == TopAbs_FACE) {
158 if (myShape.Orientation() == TopAbs_REVERSED) {
159 myMap(myShape).Reverse();
162 myMap(myShape).Orientation(myShape.Orientation());
166 myMap(myShape).Orientation(myShape.Orientation());
169 // Update the continuities
175 Standard_Boolean RecomputeTriangles = Standard_False;
176 Standard_Real MaxDeflection = RealFirst();
177 Handle(Poly_Triangulation) Tr;
178 Handle(Poly_Polygon3D) Po;
182 for (int ii = 1; ii <= aMEF.Extent(); ii++)
184 const TopoDS_Edge& CurE = TopoDS::Edge(aMEF.FindKey(ii));
185 const TopoDS_Edge& NewE = TopoDS::Edge(myMap(CurE));
186 if (!CurE.IsSame(NewE)) {
187 TopTools_ListIteratorOfListOfShape it;
188 it.Initialize(aMEF.FindFromKey(CurE));
190 while (it.More() && F2.IsNull()) {
192 F1 = TopoDS::Face(it.Value());
195 F2 = TopoDS::Face(it.Value());
200 const TopoDS_Face& newf1 = TopoDS::Face(myMap(F1));
201 const TopoDS_Face& newf2 = TopoDS::Face(myMap(F2));
202 GeomAbs_Shape Newcont = M->Continuity(CurE,F1,F2,NewE,newf1,newf2);
203 if (Newcont > GeomAbs_C0) {
204 aBB.Continuity(NewE,newf1,newf2,Newcont);
211 if (RecomputeTriangles) {
212 BRepMesh_IncrementalMesh(myMap(myShape),MaxDeflection);
216 myDone = Standard_True;
220 //=======================================================================
223 //=======================================================================
225 void BRepTools_Modifier::Put(const TopoDS_Shape& S)
227 if (!myMap.IsBound(S)) {
228 myMap.Bind(S,TopoDS_Shape());
229 for(TopoDS_Iterator theIterator(S,Standard_False);theIterator.More();theIterator.Next()) {
231 Put(theIterator.Value());
236 //=======================================================================
239 //=======================================================================
241 Standard_Boolean BRepTools_Modifier::Rebuild
242 (const TopoDS_Shape& S,
243 const Handle(BRepTools_Modification)& M,
244 Standard_Boolean& theNewGeom,
245 const Handle(Message_ProgressIndicator)& aProgress)
247 #ifdef DEBUG_Modifier
248 int iF = MapF.Contains(S) ? MapF.FindIndex(S) : 0;
249 int iE = MapE.Contains(S) ? MapE.FindIndex(S) : 0;
251 TopAbs_ShapeEnum ts = S.ShapeType();
252 TopoDS_Shape& result = myMap(S);
253 if (!result.IsNull())
255 theNewGeom = myHasNewGeom.Contains(S);
256 return !S.IsSame(result);
258 Standard_Boolean rebuild = Standard_False, RevWires = Standard_False;
259 TopAbs_Orientation ResOr = TopAbs_FORWARD;
262 Standard_Boolean No3DCurve = Standard_False; // en fait, si on n`a pas de
263 //modif geometry 3d , it is necessary to test the existence of a curve 3d.
270 rebuild = myNSInfo.IsBound(TopoDS::Face(S));
273 const NewSurfaceInfo& aNSinfo = myNSInfo(TopoDS::Face(S));
274 RevWires = aNSinfo.myRevWires;
275 B.MakeFace(TopoDS::Face(result),aNSinfo.mySurface,
276 aNSinfo.myLoc.Predivided(S.Location()),aNSinfo.myToler);
277 result.Location(S.Location());
278 if (aNSinfo.myRevFace)
279 ResOr = TopAbs_REVERSED;
280 // set specifics flags of a Face
281 B.NaturalRestriction(TopoDS::Face(result), BRep_Tool::NaturalRestriction(TopoDS::Face(S)));
284 // update triangulation on the copied face
285 Handle(Poly_Triangulation) aTriangulation;
286 if (M->NewTriangulation(TopoDS::Face(S), aTriangulation))
288 if (rebuild) // the copied face already exists => update it
289 B.UpdateFace(TopoDS::Face(result), aTriangulation);
291 { // create new face with bare triangulation
292 B.MakeFace(TopoDS::Face(result), aTriangulation);
293 result.Location(S.Location());
295 rebuild = Standard_True;
302 rebuild = myNCInfo.IsBound(TopoDS::Edge(S));
305 const NewCurveInfo& aNCinfo = myNCInfo(TopoDS::Edge(S));
306 if (aNCinfo.myCurve.IsNull()) {
307 B.MakeEdge(TopoDS::Edge(result));
308 B.Degenerated(TopoDS::Edge(result),
309 BRep_Tool::Degenerated(TopoDS::Edge(S)));
310 B.UpdateEdge(TopoDS::Edge(result),aNCinfo.myToler); //OCC217
311 No3DCurve = Standard_True;
314 B.MakeEdge(TopoDS::Edge(result),aNCinfo.myCurve,
315 aNCinfo.myLoc.Predivided(S.Location()),aNCinfo.myToler);
316 No3DCurve = Standard_False;
318 result.Location(S.Location());
319 // result.Orientation(S.Orientation());
321 // set specifics flags of an Edge
322 B.SameParameter(TopoDS::Edge(result),
323 BRep_Tool::SameParameter(TopoDS::Edge(S)));
324 B.SameRange(TopoDS::Edge(result),
325 BRep_Tool::SameRange(TopoDS::Edge(S)));
328 // update polygonal structure on the edge
329 Handle(Poly_Polygon3D) aPolygon;
330 if (M->NewPolygon(TopoDS::Edge(S), aPolygon))
332 if (rebuild) // the copied edge already exists => update it
333 B.UpdateEdge(TopoDS::Edge(result), aPolygon, S.Location());
335 { // create new edge with bare polygon
336 B.MakeEdge(TopoDS::Edge(result), aPolygon);
337 result.Location(S.Location());
339 rebuild = Standard_True;
347 // rebuild sub-shapes and test new sub-shape ?
349 Standard_Boolean newgeom = rebuild;
350 theNewGeom = rebuild;
355 Standard_Integer aShapeCount = 0;
357 for (it.Initialize(S, Standard_False); it.More(); it.Next()) ++aShapeCount;
360 Message_ProgressSentry aPSentry(aProgress, "Converting SubShapes", 0, aShapeCount, 1);
362 for (it.Initialize(S, Standard_False); it.More() && aPSentry.More(); it.Next(), aPSentry.Next()) {
363 // always call Rebuild
364 Standard_Boolean isSubNewGeom = Standard_False;
365 Standard_Boolean subrebuilt = Rebuild(it.Value(), M, isSubNewGeom, aProgress);
366 rebuild = subrebuilt || rebuild ;
367 theNewGeom = theNewGeom || isSubNewGeom;
369 if (!aPSentry.More())
371 // The processing was broken
372 return Standard_False;
378 // make an empty copy
379 if (rebuild && !newgeom) {
380 result = S.EmptyCopied();
381 result.Orientation(TopAbs_FORWARD);
384 // copy the sub-elements
387 TopAbs_Orientation orient;
388 for (it.Initialize(S,Standard_False); it.More(); it.Next()) {
389 orient = it.Value().Orientation();
390 if (RevWires || myMap(it.Value()).Orientation() == TopAbs_REVERSED) {
391 orient = TopAbs::Reverse(orient);
393 B.Add(result,myMap(it.Value()).Oriented(orient));
397 if (ts == TopAbs_FACE) {
399 Handle(Geom2d_Curve) curve2d; //,curve2d1;
400 TopoDS_Face face = TopoDS::Face(S);
401 TopAbs_Orientation fcor = face.Orientation();
402 if(fcor != TopAbs_REVERSED) fcor = TopAbs_FORWARD;
404 TopExp_Explorer ex(face.Oriented(fcor),TopAbs_EDGE);
405 for (;ex.More(); ex.Next())
407 const TopoDS_Edge& edge = TopoDS::Edge(ex.Current());
409 #ifdef DEBUG_Modifier
410 iE = MapE.Contains(edge) ? MapE.FindIndex(edge) : 0;
412 if (theNewGeom && M->NewCurve2d
413 (edge, face, TopoDS::Edge(myMap(ex.Current())), TopoDS::Face(result), curve2d, tol))
415 // rem dub 16/09/97 : Make constant topology or not make at all.
416 // Do not make if CopySurface = 1
417 // Atention, TRUE sewing edges (RealyClosed)
418 // stay even if CopySurface is true.
420 // check that edge contains two pcurves on this surface:
421 // either it is true seam on the current face, or belongs to two faces
422 // built on that same surface (see OCC21772)
423 // Note: this check could be made separate method in BRepTools
424 Standard_Boolean isClosed = Standard_False;
425 if(BRep_Tool::IsClosed(edge,face))
427 isClosed = ( ! newgeom || BRepTools::IsReallyClosed(edge,face) );
430 TopLoc_Location aLoc;
431 TopoDS_Shape resface = (myMap.IsBound(face) ? myMap(face) : face);
434 Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(resface), aLoc);
435 // check other faces sharing the same surface
436 TopExp_Explorer aExpF(myShape,TopAbs_FACE);
437 for( ; aExpF.More() && !isClosed; aExpF.Next())
439 TopoDS_Face anOther = TopoDS::Face(aExpF.Current());
440 if(anOther.IsSame(face))
442 TopoDS_Shape resface2 = (myMap.IsBound(anOther) ? myMap(anOther) : anOther);
443 if(resface2.IsNull())
445 TopLoc_Location anOtherLoc;
446 Handle(Geom_Surface) anOtherSurf =
447 BRep_Tool::Surface(TopoDS::Face(resface2), anOtherLoc);
448 if ( aSurf == anOtherSurf && aLoc.IsEqual (anOtherLoc) )
450 TopExp_Explorer aExpE(anOther,TopAbs_EDGE);
451 for( ; aExpE.More() && !isClosed ; aExpE.Next())
452 isClosed = edge.IsSame(aExpE.Current());
459 TopoDS_Edge CurE = TopoDS::Edge(myMap(edge));
460 TopoDS_Shape aLocalResult = result;
461 aLocalResult.Orientation(TopAbs_FORWARD);
462 TopoDS_Face CurF = TopoDS::Face(aLocalResult);
463 Handle(Geom2d_Curve) curve2d1, currcurv;
465 if ((!RevWires && fcor != edge.Orientation()) ||
466 ( RevWires && fcor == edge.Orientation())) {
467 CurE.Orientation(TopAbs_FORWARD);
468 curve2d1 = BRep_Tool::CurveOnSurface(CurE,CurF,f,l);
469 if (curve2d1.IsNull()) curve2d1 = new Geom2d_Line(gp::OX2d());
470 B.UpdateEdge (CurE, curve2d1, curve2d, CurF, 0.);
473 CurE.Orientation(TopAbs_REVERSED);
474 curve2d1 = BRep_Tool::CurveOnSurface(CurE,CurF,f,l);
475 if (curve2d1.IsNull()) curve2d1 = new Geom2d_Line(gp::OX2d());
476 B.UpdateEdge (CurE, curve2d, curve2d1, CurF, 0.);
478 currcurv = BRep_Tool::CurveOnSurface(CurE,CurF,f,l);
482 B.UpdateEdge(TopoDS::Edge(myMap(ex.Current())),
484 TopoDS::Face(result), 0.);
487 TopLoc_Location theLoc;
488 Standard_Real theF,theL;
489 Handle(Geom_Curve) C3D = BRep_Tool::Curve(TopoDS::Edge(myMap(ex.Current())), theLoc, theF, theL);
490 if (C3D.IsNull()) { // Update vertices
492 TopExp_Explorer ex2(edge,TopAbs_VERTEX);
494 const TopoDS_Vertex& vertex = TopoDS::Vertex(ex2.Current());
495 if (!M->NewParameter(vertex, edge, param, tol)) {
496 tol = BRep_Tool::Tolerance(vertex);
497 param = BRep_Tool::Parameter(vertex,edge);
500 TopAbs_Orientation vtxrelat = vertex.Orientation();
501 if (edge.Orientation() == TopAbs_REVERSED) {
502 // Update considere l'edge FORWARD, et le vertex en relatif
503 vtxrelat= TopAbs::Reverse(vtxrelat);
505 //if (myMap(edge).Orientation() == TopAbs_REVERSED) {
506 // vtxrelat= TopAbs::Reverse(vtxrelat);
509 TopoDS_Vertex aLocalVertex = TopoDS::Vertex(myMap(vertex));
510 aLocalVertex.Orientation(vtxrelat);
511 //B.UpdateVertex(TopoDS::Vertex
512 //(myMap(vertex).Oriented(vtxrelat)),
513 B.UpdateVertex(aLocalVertex, param, TopoDS::Edge(myMap(edge)), tol);
519 // Copy polygon on triangulation
520 Handle(Poly_PolygonOnTriangulation) aPolyOnTria_1, aPolyOnTria_2;
521 Standard_Boolean aNewPonT = M->NewPolygonOnTriangulation(edge, face, aPolyOnTria_1);
522 if (BRepTools::IsReallyClosed(edge, face))
524 // Obtain triangulation on reversed edge
525 TopoDS_Edge anEdgeRev = edge;
527 aNewPonT = M->NewPolygonOnTriangulation(anEdgeRev, face, aPolyOnTria_2) || aNewPonT;
528 // It there is only one polygon on triangulation, store it to aPolyOnTria_1
529 if (aPolyOnTria_1.IsNull() && !aPolyOnTria_2.IsNull())
531 aPolyOnTria_1 = aPolyOnTria_2;
532 aPolyOnTria_2 = Handle(Poly_PolygonOnTriangulation)();
537 TopLoc_Location aLocation;
538 Handle(Poly_Triangulation) aNewFaceTria =
539 BRep_Tool::Triangulation(TopoDS::Face(myMap(face)), aLocation);
540 TopoDS_Edge aNewEdge = TopoDS::Edge(myMap(edge));
541 if (aPolyOnTria_2.IsNull())
542 B.UpdateEdge(aNewEdge, aPolyOnTria_1, aNewFaceTria, aLocation);
545 if (edge.Orientation() == TopAbs_FORWARD)
546 B.UpdateEdge(aNewEdge, aPolyOnTria_1, aPolyOnTria_2, aNewFaceTria, aLocation);
548 B.UpdateEdge(aNewEdge, aPolyOnTria_2, aPolyOnTria_1, aNewFaceTria, aLocation);
555 // else if (ts == TopAbs_EDGE) {
556 else if (ts == TopAbs_EDGE && !No3DCurve) {
559 const TopoDS_Edge& edge = TopoDS::Edge(S);
560 TopAbs_Orientation edor = edge.Orientation();
561 if(edor != TopAbs_REVERSED) edor = TopAbs_FORWARD;
562 TopExp_Explorer ex(edge.Oriented(edor), TopAbs_VERTEX);
564 const TopoDS_Vertex& vertex = TopoDS::Vertex(ex.Current());
566 if (!M->NewParameter(vertex, edge, param, tol)) {
567 tol = BRep_Tool::Tolerance(vertex);
568 param = BRep_Tool::Parameter(vertex,edge);
571 TopAbs_Orientation vtxrelat = vertex.Orientation();
572 if (edor == TopAbs_REVERSED) {
573 // Update considere l'edge FORWARD, et le vertex en relatif
574 vtxrelat= TopAbs::Reverse(vtxrelat);
577 //if (result.Orientation() == TopAbs_REVERSED) {
578 // vtxrelat= TopAbs::Reverse(vtxrelat);
580 TopoDS_Vertex aLocalVertex = TopoDS::Vertex(myMap(vertex));
581 aLocalVertex.Orientation(vtxrelat);
582 //B.UpdateVertex(TopoDS::Vertex(myMap(vertex).Oriented(vtxrelat)),
583 if (myMutableInput || !aLocalVertex.IsSame(vertex))
584 B.UpdateVertex(aLocalVertex, param, TopoDS::Edge(result), tol);
592 result.Orientable(S.Orientable());
593 result.Closed(S.Closed());
594 result.Infinite(S.Infinite());
599 // Set flag of the shape.
600 result.Orientation(ResOr);
602 SetShapeFlags(S, result);
607 void BRepTools_Modifier::CreateNewVertices( const TopTools_IndexedDataMapOfShapeListOfShape& theMVE, const Handle(BRepTools_Modification)& M)
612 for (int i = 1; i <= theMVE.Extent(); i++ )
614 //fill MyMap only with vertices with NewPoint == true
615 const TopoDS_Vertex& aV = TopoDS::Vertex(theMVE.FindKey(i));
616 Standard_Boolean IsNewP = M->NewPoint(aV, aPnt, aToler);
620 aBB.MakeVertex(aNewV, aPnt, aToler);
621 SetShapeFlags(aV, aNewV);
623 myHasNewGeom.Add(aV);
625 else if (myMutableInput)
626 myMap(aV) = aV.Oriented(TopAbs_FORWARD);
630 void BRepTools_Modifier::FillNewCurveInfo(const TopTools_IndexedDataMapOfShapeListOfShape& theMEF, const Handle(BRepTools_Modification)& M)
632 Handle(Geom_Curve) aCurve;
633 TopLoc_Location aLocation;
634 BRepTools_Modifier::NewCurveInfo aNCinfo;
636 for (int i = 1; i <= theMEF.Extent(); i++ )
638 const TopoDS_Edge& anE = TopoDS::Edge(theMEF.FindKey(i));
639 Standard_Boolean IsNewCur = M->NewCurve(anE, aCurve, aLocation, aToler);
642 aNCinfo.myCurve = aCurve;
643 aNCinfo.myLoc = aLocation;
644 aNCinfo.myToler = aToler;
645 myNCInfo.Bind(anE, aNCinfo);
646 myHasNewGeom.Add(anE);
651 void BRepTools_Modifier::FillNewSurfaceInfo(const Handle(BRepTools_Modification)& M)
653 TopTools_IndexedMapOfShape aMF;
654 TopExp::MapShapes(myShape, TopAbs_FACE, aMF);
655 BRepTools_Modifier::NewSurfaceInfo aNSinfo;
656 for (int i = 1; i <= aMF.Extent(); i++ )
658 const TopoDS_Face& aF = TopoDS::Face(aMF(i));
659 Standard_Boolean RevFace;
660 Standard_Boolean RevWires;
661 Handle(Geom_Surface) aSurface;
662 TopLoc_Location aLocation;
664 Standard_Boolean IsNewSur = M->NewSurface(aF, aSurface, aLocation, aToler1, RevWires,RevFace);
667 aNSinfo.mySurface = aSurface;
668 aNSinfo.myLoc = aLocation;
669 aNSinfo.myToler = aToler1;
670 aNSinfo.myRevWires = RevWires;
671 aNSinfo.myRevFace = RevFace;
672 myNSInfo.Bind(aF, aNSinfo);
673 myHasNewGeom.Add(aF);
677 //check if subshapes will be modified
678 Standard_Boolean notRebuilded = Standard_True;
679 TopExp_Explorer exE(aF, TopAbs_EDGE);
680 while (exE.More() && notRebuilded)
682 const TopoDS_Edge& anEE = TopoDS::Edge(exE.Current());
683 if (myNCInfo.IsBound(anEE))
685 notRebuilded = Standard_False;
688 TopExp_Explorer exV(anEE, TopAbs_VERTEX);
689 while (exV.More() && notRebuilded)
691 const TopoDS_Vertex& aVV = TopoDS::Vertex(exV.Current());
692 if (!myMap(aVV).IsNull())
694 notRebuilded = Standard_False;
703 //subshapes is not going to be modified
704 myNonUpdFace.Add(aF);
711 void BRepTools_Modifier::CreateOtherVertices(const TopTools_IndexedDataMapOfShapeListOfShape& theMVE,
712 const TopTools_IndexedDataMapOfShapeListOfShape& theMEF,
713 const Handle(BRepTools_Modification)& M)
716 //The following logic in some ways repeats the logic from the Rebuild() method.
717 //If the face with its subshapes is not going to be modified
718 //(i.e. NewSurface() for this face and NewCurve(), NewPoint() for its edges/vertices returns false)
719 //then the calling of NewCurve2d() for this face with its edges is not performed.
720 //Therefore, the updating of vertices will not present in such cases and
721 //the EmptyCopied() operation for vertices from this face is not needed.
723 for (int i = 1; i <= theMVE.Extent(); i++ )
725 const TopoDS_Vertex& aV = TopoDS::Vertex(theMVE.FindKey(i));
726 TopoDS_Vertex aNewV = TopoDS::Vertex(myMap(aV));
729 const TopTools_ListOfShape& aLEdges = theMVE(i);
730 Standard_Boolean toReplace = Standard_False;
731 TopTools_ListIteratorOfListOfShape it(aLEdges);
732 for (; it.More() && !toReplace; it.Next())
734 const TopoDS_Edge& anE = TopoDS::Edge(it.Value());
735 if (myNCInfo.IsBound(anE) && !myNCInfo(anE).myCurve.IsNull())
736 toReplace = Standard_True;
740 const TopTools_ListOfShape& aLFaces = theMEF.FindFromKey(anE);
741 TopTools_ListIteratorOfListOfShape it2(aLFaces);
742 for (; it2.More(); it2.Next())
744 const TopoDS_Face& aF = TopoDS::Face(it2.Value());
745 if (!myNonUpdFace.Contains(aF))
747 Handle(Geom2d_Curve) aCurve2d;
748 //some NewCurve2d()s may use NewE arg internally, so the
749 //null TShape as an arg may lead to the exceptions
750 TopoDS_Edge aDummyE = TopoDS::Edge(anE.EmptyCopied());
751 if (M->NewCurve2d(anE, aF, aDummyE, TopoDS_Face(), aCurve2d, aToler))
761 aNewV = TopoDS::Vertex(aV.EmptyCopied());
764 aNewV.Orientation(TopAbs_FORWARD);
771 static void SetShapeFlags(const TopoDS_Shape& theInSh, TopoDS_Shape& theOutSh)
773 theOutSh.Modified (theInSh.Modified());
774 theOutSh.Checked (theInSh.Checked());
775 theOutSh.Orientable(theInSh.Orientable());
776 theOutSh.Closed (theInSh.Closed());
777 theOutSh.Infinite (theInSh.Infinite());
778 theOutSh.Convex (theInSh.Convex());
782 Standard_Boolean BRepTools_Modifier::IsMutableInput() const
784 return myMutableInput;
787 void BRepTools_Modifier::SetMutableInput(Standard_Boolean theMutableInput)
789 myMutableInput = theMutableInput;