1 // Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include <Standard_Stream.hxx>
25 #include <GEOMImpl_GlueDriver.hxx>
26 #include <GEOMImpl_IGlue.hxx>
27 #include <GEOMImpl_Types.hxx>
29 #include <GEOM_Object.hxx>
30 #include <GEOM_Function.hxx>
32 #include "GEOMAlgo_Gluer2.hxx"
33 #include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
34 #include "GEOMAlgo_CoupleOfShapes.hxx"
35 #include "GEOMAlgo_ListOfCoupleOfShapes.hxx"
37 #include "utilities.h"
39 #include <BRep_Builder.hxx>
40 #include <ShapeFix_Shape.hxx>
41 #include <TDataStd_IntegerArray.hxx>
43 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
44 #include <TopTools_IndexedMapOfShape.hxx>
45 #include <TopTools_ListIteratorOfListOfShape.hxx>
46 #include <TopTools_ListOfShape.hxx>
47 #include <TopoDS_Shape.hxx>
49 #include <Standard_NullObject.hxx>
50 #include <Standard_Failure.hxx>
52 #define MSG_BAD_TOLERANCE "Tolerance is too big"
53 #define MSG_BAD_ARG_SHAPE "Argument shape is not a compound of hexahedral solids"
55 //=======================================================================
56 //function : GEOMImpl_GlueDriver
58 //=======================================================================
59 GEOMImpl_GlueDriver::GEOMImpl_GlueDriver()
63 //=======================================================================
66 //=======================================================================
67 const Standard_GUID& GEOMImpl_GlueDriver::GetID()
69 static Standard_GUID aGlueDriver("FF1BBB63-5D14-4df2-980B-3A668264EA16");
73 //=======================================================================
74 //function : GlueFacesWithWarnings
76 //=======================================================================
78 TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& theShape,
79 const Standard_Real theTolerance,
80 const Standard_Boolean doKeepNonSolids,
81 TCollection_AsciiString& theWarning) const
83 Standard_Integer iErr, iWrn;
85 GEOMAlgo_Gluer aGluer;
87 aGluer.SetShape(theShape);
88 aGluer.SetTolerance(theTolerance);
89 aGluer.SetCheckGeometry(Standard_True);
90 aGluer.SetKeepNonSolids(doKeepNonSolids);
94 iErr = aGluer.ErrorStatus();
98 Standard_Failure::Raise("No vertices found in source shape");
102 Standard_Failure::Raise(MSG_BAD_TOLERANCE " or " MSG_BAD_ARG_SHAPE);
105 Standard_Failure::Raise("Source shape is Null");
108 Standard_Failure::Raise("Result shape is Null");
111 Standard_Failure::Raise(MSG_BAD_TOLERANCE);
115 Standard_Failure::Raise(MSG_BAD_ARG_SHAPE);
118 Standard_Failure::Raise("Error occurred during check of geometric coincidence");
122 // description of all errors see in GEOMAlgo_Gluer.cxx
123 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer with code ");
124 aMsg += TCollection_AsciiString(iErr);
125 Standard_Failure::Raise(aMsg.ToCString());
132 iWrn = aGluer.WarningStatus();
137 Standard_Integer nbAlone = aGluer.AloneShapes();
138 theWarning = TCollection_AsciiString(nbAlone);
139 theWarning += " solid(s) can not be glued by faces";
143 // description of all warnings see in GEOMAlgo_Gluer.cxx
144 theWarning = "Warning in GEOMAlgo_Gluer with code ";
145 theWarning += TCollection_AsciiString(iWrn);
150 aRes = aGluer.Result();
152 // SKL 18.01.2010 - patch for 20662
153 Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aRes);
154 aSfs->SetPrecision(Precision::Confusion());
156 aRes = aSfs->Shape();
158 // Fill history to be used by GetInPlace functionality
159 TopTools_IndexedMapOfShape aResIndices;
160 TopExp::MapShapes(aRes, aResIndices);
162 Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
164 // history for all argument shapes
165 TDF_LabelSequence aLabelSeq;
166 aFunction->GetDependency(aLabelSeq);
167 Standard_Integer nbArg = aLabelSeq.Length();
169 for (Standard_Integer iarg = 1; iarg <= nbArg; iarg++) {
171 TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg);
173 Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
174 TopoDS_Shape anArgumentShape = anArgumentObject->GetValue();
176 TopTools_IndexedMapOfShape anArgumentIndices;
177 TopExp::MapShapes(anArgumentShape, anArgumentIndices);
178 Standard_Integer nbArgumentEntities = anArgumentIndices.Extent();
180 // Find corresponding label in history
181 TDF_Label anArgumentHistoryLabel =
182 aFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_True);
184 for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
185 TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie);
186 const TopTools_ListOfShape& aModified = aGluer.Modified(anEntity);
187 Standard_Integer nbModified = aModified.Extent();
189 if (nbModified > 0) {
190 TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True);
191 Handle(TDataStd_IntegerArray) anAttr =
192 TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified);
194 TopTools_ListIteratorOfListOfShape itM (aModified);
195 for (int im = 1; itM.More(); itM.Next(), ++im) {
196 int id = aResIndices.FindIndex(itM.Value());
197 anAttr->SetValue(im, id);
206 //=======================================================================
207 //function : GlueFaces
209 //=======================================================================
210 TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
211 const Standard_Real theTolerance,
212 const Standard_Boolean doKeepNonSolids)
215 GEOMAlgo_Gluer aGluer;
217 aGluer.SetShape(theShape);
218 aGluer.SetTolerance(theTolerance);
219 aGluer.SetCheckGeometry(Standard_True);
220 aGluer.SetKeepNonSolids(doKeepNonSolids);
224 Standard_Integer iErr = aGluer.ErrorStatus();
228 Standard_Failure::Raise("No vertices found in source shape");
231 Standard_Failure::Raise("Source shape is Null");
234 Standard_Failure::Raise("Result shape is Null");
237 Standard_Failure::Raise("Error occurred during check of geometric coincidence");
241 // description of all errors see in GEOMAlgo_Gluer.cxx
242 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer with code ");
243 aMsg += TCollection_AsciiString(iErr);
244 Standard_Failure::Raise(aMsg.ToCString());
251 Standard_Integer iWrn = aGluer.WarningStatus();
255 MESSAGE("Some shapes can not be glued by faces");
258 // description of all warnings see in GEOMAlgo_Gluer.cxx
259 MESSAGE("Warning in GEOMAlgo_Gluer with code " << iWrn);
264 aRes = aGluer.Result();
269 //=======================================================================
270 //function : GlueFacesByList
272 //=======================================================================
273 TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape,
274 const Standard_Real theTolerance,
275 const Standard_Boolean doKeepNonSolids,
276 const TopTools_MapOfShape& aFaces)
280 GEOMAlgo_Gluer1 aGluer;
281 GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS;
282 GEOMAlgo_CoupleOfShapes aCS;
283 GEOMAlgo_ListOfCoupleOfShapes aLCS;
285 aGluer.SetShape(theShape);
286 aGluer.SetTolerance(theTolerance);
287 aGluer.SetKeepNonSolids(doKeepNonSolids);
289 Standard_Integer iErr = aGluer.ErrorStatus();
290 if (iErr) return aRes;
292 TopTools_ListOfShape listShape;
293 const GEOMAlgo_ListOfCoupleOfShapes& aLCSG = aGluer.GluedFaces();
295 aItCS.Initialize(aLCSG);
296 for (; aItCS.More(); aItCS.Next()) {
297 const GEOMAlgo_CoupleOfShapes& aCSG = aItCS.Value();
298 const TopoDS_Shape& aF1 = aCSG.Shape1();
299 const TopoDS_Shape& aF2 = aCSG.Shape2();
300 if (aFaces.Contains(aF1) || aFaces.Contains(aF2))
302 aCS.SetShapes(aF1,aF2);
306 //cout<<"aLCS.Extent() = "<<aLCS.Extent()<<endl;
307 if (aLCS.Extent()>0) {
308 aGluer.SetFacesToUnglue(aLCS);
309 aGluer.UnglueFaces();
310 iErr = aGluer.ErrorStatus();
311 if (iErr) return aRes;
314 aRes = aGluer.Result();
320 //=======================================================================
321 //function : GlueFaces
323 //=======================================================================
324 TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces
325 (const TopoDS_Shape &theShape,
326 const Standard_Real theTolerance,
327 const Standard_Boolean doKeepNonSolids,
328 TopTools_DataMapOfShapeListOfShape *pMapModif)
335 aGA.SetArgument(theShape);
336 aGA.SetTolerance(theTolerance);
337 aGA.SetKeepNonSolids(doKeepNonSolids);
339 // 2. Detect interfered shapes
342 //Standard_Integer iWrnDetect = aGA.WarningStatus();
343 //if (iWrnDetect == 2) {
344 // Standard_Failure::Raise("GLUE_ERROR_STICKED_SHAPES");
347 Standard_Integer iErr = aGA.ErrorStatus();
351 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
355 Standard_Failure::Raise("PerformImagesToWork failed");
359 // description of all errors see in GEOMAlgo_Gluer2.cxx
360 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
361 aMsg += TCollection_AsciiString(iErr);
362 Standard_Failure::Raise(aMsg.ToCString());
369 // 3. Set shapes to glue. If the operator is absent, the whole gluing will be done
370 //aGA.SetShapesToGlue(aMSG);
374 iErr = aGA.ErrorStatus();
378 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
382 Standard_Failure::Raise("PerformImagesToWork failed");
386 // description of all errors see in GEOMAlgo_Gluer2.cxx
387 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
388 aMsg += TCollection_AsciiString(iErr);
389 Standard_Failure::Raise(aMsg.ToCString());
396 Standard_Integer iWrn = aGA.WarningStatus();
400 MESSAGE("No shapes to glue");
403 // description of all warnings see in GEOMAlgo_Gluer2.cxx
404 MESSAGE("Warning in GEOMAlgo_Gluer2 with code " << iWrn);
413 // Fill the map of modified shapes.
414 TopTools_IndexedMapOfShape aMapSubShapes;
416 TopExp::MapShapes(theShape, aMapSubShapes);
419 const Standard_Integer aNbShapes = aMapSubShapes.Extent();
422 for (i = 1; i <= aNbShapes; ++i) {
423 const TopoDS_Shape &aSubShape = aMapSubShapes.FindKey(i);
424 const TopTools_ListOfShape &aModif = aGA.Modified(aSubShape);
426 if (!aModif.IsEmpty()) {
427 pMapModif->Bind(aSubShape, aModif);
435 //=======================================================================
436 //function : GlueWithWarnings
438 //=======================================================================
439 TopoDS_Shape GEOMImpl_GlueDriver::GlueWithWarnings (const TopoDS_Shape& theShape,
440 const Standard_Real theTolerance,
441 const TopAbs_ShapeEnum theShapeType,
442 const Standard_Boolean doKeepNonSolids,
443 TCollection_AsciiString& theWarning) const
450 aGA.SetArgument(theShape);
451 aGA.SetTolerance(theTolerance);
452 aGA.SetKeepNonSolids(doKeepNonSolids);
454 // 2. Detect interfered shapes
457 //modified by NIZNHY-PKV Tue Mar 13 14:07:12 2012f
458 Standard_Integer iWrnDetect = aGA.WarningStatus();
459 if (iWrnDetect == 2) {
460 Standard_Failure::Raise("GLUE_ERROR_STICKED_SHAPES");
462 //modified by NIZNHY-PKV Tue Mar 13 14:07:14 2012t
464 Standard_Integer iErr = aGA.ErrorStatus();
468 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
472 Standard_Failure::Raise("PerformImagesToWork failed");
476 // description of all errors see in GEOMAlgo_Gluer2.cxx
477 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
478 aMsg += TCollection_AsciiString(iErr);
479 Standard_Failure::Raise(aMsg.ToCString());
486 if (theShapeType != TopAbs_FACE) {
487 // 3. Fill shapes to glue aMSG
488 TopTools_DataMapOfShapeListOfShape aMSG;
489 const TopTools_DataMapOfShapeListOfShape& aMSD = aGA.ShapesDetected();
490 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItMSD;
491 aItMSD.Initialize(aMSD);
492 for (; aItMSD.More(); aItMSD.Next()) {
493 const TopoDS_Shape& aSx = aItMSD.Key();
494 const TopTools_ListOfShape& aLSD = aItMSD.Value();
495 if (aSx.ShapeType() == theShapeType) {
496 aMSG.Bind(aSx, aLSD);
500 // 4. Set shapes to glue. If the operator is absent, the whole gluing will be done
501 aGA.SetShapesToGlue(aMSG);
506 iErr = aGA.ErrorStatus();
510 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
514 Standard_Failure::Raise("PerformImagesToWork failed");
518 // description of all errors see in GEOMAlgo_Gluer2.cxx
519 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
520 aMsg += TCollection_AsciiString(iErr);
521 Standard_Failure::Raise(aMsg.ToCString());
528 Standard_Integer iWrn = aGA.WarningStatus();
532 theWarning = "No shapes to glue";
535 // description of all warnings see in GEOMAlgo_Gluer2.cxx
536 theWarning = "Warning in GEOMAlgo_Gluer2 with code ";
537 theWarning += TCollection_AsciiString(iWrn);
545 // 7. Fill history to be used by GetInPlace functionality
546 TopTools_IndexedMapOfShape aResIndices;
547 TopExp::MapShapes(aRes, aResIndices);
549 Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
551 // history for all argument shapes
552 TDF_LabelSequence aLabelSeq;
553 aFunction->GetDependency(aLabelSeq);
554 Standard_Integer nbArg = aLabelSeq.Length();
556 for (Standard_Integer iarg = 1; iarg <= nbArg; iarg++) {
558 TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg);
560 Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
561 TopoDS_Shape anArgumentShape = anArgumentObject->GetValue();
563 TopTools_IndexedMapOfShape anArgumentIndices;
564 TopExp::MapShapes(anArgumentShape, anArgumentIndices);
565 Standard_Integer nbArgumentEntities = anArgumentIndices.Extent();
567 // Find corresponding label in history
568 TDF_Label anArgumentHistoryLabel =
569 aFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_True);
571 for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
572 TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie);
573 const TopTools_ListOfShape& aModified = aGA.Modified(anEntity);
574 Standard_Integer nbModified = aModified.Extent();
576 if (nbModified > 0) {
577 TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True);
578 Handle(TDataStd_IntegerArray) anAttr =
579 TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified);
581 TopTools_ListIteratorOfListOfShape itM (aModified);
582 for (int im = 1; itM.More(); itM.Next(), ++im) {
583 int id = aResIndices.FindIndex(itM.Value());
584 anAttr->SetValue(im, id);
593 //=======================================================================
594 //function : GlueByList
596 //=======================================================================
597 TopoDS_Shape GEOMImpl_GlueDriver::GlueByList (const TopoDS_Shape& theShape,
598 const Standard_Real theTolerance,
599 const Standard_Boolean doKeepNonSolids,
600 const TopTools_MapOfShape& theShapesList,
601 const Standard_Boolean doGlueAllEdges)
608 aGA.SetArgument(theShape);
609 aGA.SetTolerance(theTolerance);
610 aGA.SetKeepNonSolids(doKeepNonSolids);
612 // 2. Detect interfered shapes
615 //modified by NIZNHY-PKV Tue Mar 13 14:07:12 2012f
616 Standard_Integer iWrnDetect = aGA.WarningStatus();
617 if (iWrnDetect == 2) {
619 TopTools_ListIteratorOfListOfShape aItLS;
621 // Sticked shapes are detected
622 const TopTools_IndexedDataMapOfShapeListOfShape& aIDMSS = pGluer2->StickedShapes();
624 Standard_Integer i, aNb = aIDMSS.Extent();
625 for (i = 1; i <= aNb; ++i) {
626 // ancestor aSa (edge, wire face,..)
627 const TopoDS_Shape& aSa = aIDMSS.FindKey(i);
629 // successors aSs (vertex, edge, ...)
630 // of the ancestor that are sticked
631 // for given value of the tolerance
632 const TopTools_ListOfShape& aLSS = aIDMSS.FindFromIndex(i);
633 aItLS.Initialize(aLSS);
634 for (; aItLS.More(); aItLS.Next()) {
635 const TopoDS_Shape& aSs = aItLS.Value();
639 Standard_Failure::Raise("GLUE_ERROR_STICKED_SHAPES");
641 //modified by NIZNHY-PKV Tue Mar 13 14:07:14 2012t
643 Standard_Integer iErr = aGA.ErrorStatus();
647 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
651 Standard_Failure::Raise("PerformImagesToWork failed");
655 // description of all errors see in GEOMAlgo_Gluer2.cxx
656 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
657 aMsg += TCollection_AsciiString(iErr);
658 Standard_Failure::Raise(aMsg.ToCString());
665 // 3. Fill shapes to glue aMSG
666 TopTools_DataMapOfShapeListOfShape aMSG;
667 const TopTools_DataMapOfShapeListOfShape& aMSD = aGA.ShapesDetected();
668 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItMSD;
669 aItMSD.Initialize(aMSD);
670 for (; aItMSD.More(); aItMSD.Next()) {
671 const TopoDS_Shape& aSx = aItMSD.Key();
672 const TopTools_ListOfShape& aLSD = aItMSD.Value();
673 TopTools_ListIteratorOfListOfShape anItLSD (aLSD);
674 bool isToGlue = false;
675 if (doGlueAllEdges && aSx.ShapeType() == TopAbs_EDGE) {
679 for (; anItLSD.More() && !isToGlue; anItLSD.Next()) {
680 if (theShapesList.Contains(anItLSD.Value())) {
686 aMSG.Bind(aSx, aLSD);
690 // 4. Set shapes to glue. If the operator is absent, the whole gluing will be done
691 aGA.SetShapesToGlue(aMSG);
695 iErr = aGA.ErrorStatus();
699 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
703 Standard_Failure::Raise("PerformImagesToWork failed");
707 // description of all errors see in GEOMAlgo_Gluer2.cxx
708 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
709 aMsg += TCollection_AsciiString(iErr);
710 Standard_Failure::Raise(aMsg.ToCString());
717 Standard_Integer iWrn = aGA.WarningStatus();
721 MESSAGE("No shapes to glue");
724 // description of all warnings see in GEOMAlgo_Gluer2.cxx
725 MESSAGE("Warning in GEOMAlgo_Gluer2 with code " << iWrn);
736 //=======================================================================
739 //=======================================================================
740 Standard_Integer GEOMImpl_GlueDriver::Execute(Handle(TFunction_Logbook)& log) const
742 if (Label().IsNull()) return 0;
743 Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
745 GEOMImpl_IGlue aCI (aFunction);
746 Standard_Integer aType = aFunction->GetType();
749 TCollection_AsciiString aWrn;
751 TopoDS_Shape aShapeBase;
752 Handle(TColStd_HSequenceOfTransient) aRefBases = aCI.GetBase();
753 if ( aRefBases && !aRefBases->IsEmpty() )
755 if ( aRefBases->Length() == 1 )
757 Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aRefBases->Value(1));
758 if ( !aRefShape.IsNull() )
759 aShapeBase = aRefShape->GetValue();
763 TopoDS_Compound compound;
764 BRep_Builder builder;
765 builder.MakeCompound( compound );
767 for ( ; ind <= aRefBases->Length(); ind++)
769 Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aRefBases->Value(ind));
770 if ( aRefShape.IsNull() ) break;
771 TopoDS_Shape aShape = aRefShape->GetValue();
772 if (aShape.IsNull()) break;
773 builder.Add( compound, aShape );
775 if ( ind > aRefBases->Length() )
776 aShapeBase = compound;
778 aShapeBase.Nullify();
781 if (aShapeBase.IsNull()) {
782 Standard_NullObject::Raise("Shape for gluing is null");
785 Standard_Real tol3d = aCI.GetTolerance();
787 Standard_Boolean aKeepNonSolids = aCI.GetKeepNonSolids();
789 if (aType == GLUE_FACES) {
790 //aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aKeepNonSolids, aWrn);
791 aShape = GlueWithWarnings(aShapeBase, tol3d, TopAbs_FACE, aKeepNonSolids, aWrn);
793 else if (aType == GLUE_EDGES) {
794 aShape = GlueWithWarnings(aShapeBase, tol3d, TopAbs_EDGE, aKeepNonSolids, aWrn);
796 else if (aType == GLUE_FACES_BY_LIST || aType == GLUE_EDGES_BY_LIST) {
797 Handle(TColStd_HSequenceOfTransient) SF = aCI.GetFaces();
798 TopTools_MapOfShape aFaces;
800 for (; i <= SF->Length(); i++) {
801 Handle(Standard_Transient) anItem = SF->Value(i);
804 Handle(GEOM_Function) aRefSh = Handle(GEOM_Function)::DownCast(anItem);
807 TopoDS_Shape aFace = aRefSh->GetValue();
813 Standard_Boolean aGlueAllEdges = Standard_False;
814 if (aType == GLUE_FACES_BY_LIST)
815 aGlueAllEdges = aCI.GetGlueAllEdges();
817 //aShape = GlueFacesByList(aShapeBase, tol3d, aKeepNonSolids, aFaces);
818 aShape = GlueByList(aShapeBase, tol3d, aKeepNonSolids, aFaces, aGlueAllEdges);
821 if (aShape.IsNull()) return 0;
823 aFunction->SetValue(aShape);
825 log->SetTouched(Label());
827 if (!aWrn.IsEmpty()) {
828 Standard_Failure::Raise(aWrn.ToCString());
834 //================================================================================
836 * \brief Returns a name of creation operation and names and values of creation parameters
838 //================================================================================
840 bool GEOMImpl_GlueDriver::
841 GetCreationInformation(std::string& theOperationName,
842 std::vector<GEOM_Param>& theParams)
844 if (Label().IsNull()) return 0;
845 Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
847 GEOMImpl_IGlue aCI( function );
848 Standard_Integer aType = function->GetType();
852 theOperationName = "GLUE_FACES";
853 AddParam( theParams, "Selected shapes", aCI.GetBase() );
854 AddParam( theParams, "Tolerance", aCI.GetTolerance() );
855 AddParam( theParams, "To keep non solids", aCI.GetKeepNonSolids() );
858 theOperationName = "GLUE_EDGES";
859 AddParam( theParams, "Selected shapes", aCI.GetBase() );
860 AddParam( theParams, "Tolerance", aCI.GetTolerance() );
862 case GLUE_FACES_BY_LIST:
863 theOperationName = "GLUE_FACES";
864 AddParam( theParams, "Selected shapes", aCI.GetBase() );
865 AddParam( theParams, "Tolerance", aCI.GetTolerance() );
866 AddParam( theParams, "Faces", aCI.GetFaces() );
867 AddParam( theParams, "To keep non solids", aCI.GetKeepNonSolids() );
868 AddParam( theParams, "To glue all edges", aCI.GetGlueAllEdges() );
870 case GLUE_EDGES_BY_LIST:
871 theOperationName = "GLUE_EDGES";
872 AddParam( theParams, "Selected shapes", aCI.GetBase() );
873 AddParam( theParams, "Tolerance", aCI.GetTolerance() );
874 AddParam( theParams, "Edges", aCI.GetFaces() );
883 IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_GlueDriver,GEOM_BaseDriver)