1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, 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.
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
22 #include <Standard_Stream.hxx>
24 #include <GEOMImpl_GlueDriver.hxx>
25 #include <GEOMImpl_IGlue.hxx>
26 #include <GEOMImpl_Types.hxx>
28 #include <GEOM_Object.hxx>
29 #include <GEOM_Function.hxx>
31 #include "GEOMAlgo_Gluer2.hxx"
32 #include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
33 #include "GEOMAlgo_CoupleOfShapes.hxx"
34 #include "GEOMAlgo_ListOfCoupleOfShapes.hxx"
36 #include <Basics_OCCTVersion.hxx>
38 #include "utilities.h"
40 #include <TDataStd_IntegerArray.hxx>
41 #include <TNaming_CopyShape.hxx>
44 #include <TopoDS_Shape.hxx>
45 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
46 #include <TopTools_IndexedMapOfShape.hxx>
47 #include <TopTools_ListOfShape.hxx>
48 #include <TopTools_ListIteratorOfListOfShape.hxx>
50 #include <TColStd_IndexedDataMapOfTransientTransient.hxx>
52 #include <ShapeFix_Shape.hxx>
54 #include <Standard_NullObject.hxx>
55 #include <Standard_Failure.hxx>
57 #define MSG_BAD_TOLERANCE "Tolerance is too big"
58 #define MSG_BAD_ARG_SHAPE "Argument shape is not a compound of hexahedral solids"
60 //=======================================================================
61 //function : GEOMImpl_GlueDriver
63 //=======================================================================
64 GEOMImpl_GlueDriver::GEOMImpl_GlueDriver()
68 //=======================================================================
71 //=======================================================================
72 const Standard_GUID& GEOMImpl_GlueDriver::GetID()
74 static Standard_GUID aGlueDriver("FF1BBB63-5D14-4df2-980B-3A668264EA16");
78 //=======================================================================
79 //function : GlueFacesWithWarnings
81 //=======================================================================
83 TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& theShape,
84 const Standard_Real theTolerance,
85 const Standard_Boolean doKeepNonSolids,
86 TCollection_AsciiString& theWarning) const
88 Standard_Integer iErr, iWrn;
90 GEOMAlgo_Gluer aGluer;
92 aGluer.SetShape(theShape);
93 aGluer.SetTolerance(theTolerance);
94 aGluer.SetCheckGeometry(Standard_True);
95 aGluer.SetKeepNonSolids(doKeepNonSolids);
99 iErr = aGluer.ErrorStatus();
103 Standard_Failure::Raise("No vertices found in source shape");
107 Standard_Failure::Raise(MSG_BAD_TOLERANCE " or " MSG_BAD_ARG_SHAPE);
110 Standard_Failure::Raise("Source shape is Null");
113 Standard_Failure::Raise("Result shape is Null");
116 Standard_Failure::Raise(MSG_BAD_TOLERANCE);
120 Standard_Failure::Raise(MSG_BAD_ARG_SHAPE);
123 Standard_Failure::Raise("Error occured during check of geometric coincidence");
127 // description of all errors see in GEOMAlgo_Gluer.cxx
128 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer with code ");
129 aMsg += TCollection_AsciiString(iErr);
130 Standard_Failure::Raise(aMsg.ToCString());
137 iWrn = aGluer.WarningStatus();
142 Standard_Integer nbAlone = aGluer.AloneShapes();
143 theWarning = TCollection_AsciiString(nbAlone);
144 theWarning += " solid(s) can not be glued by faces";
148 // description of all warnings see in GEOMAlgo_Gluer.cxx
149 theWarning = "Warning in GEOMAlgo_Gluer with code ";
150 theWarning += TCollection_AsciiString(iWrn);
155 aRes = aGluer.Result();
157 // SKL 18.01.2010 - patch for 20662
158 Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aRes);
159 aSfs->SetPrecision(Precision::Confusion());
161 aRes = aSfs->Shape();
163 // Fill history to be used by GetInPlace functionality
164 TopTools_IndexedMapOfShape aResIndices;
165 TopExp::MapShapes(aRes, aResIndices);
167 Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
169 // history for all argument shapes
170 TDF_LabelSequence aLabelSeq;
171 aFunction->GetDependency(aLabelSeq);
172 Standard_Integer nbArg = aLabelSeq.Length();
174 for (Standard_Integer iarg = 1; iarg <= nbArg; iarg++) {
176 TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg);
178 Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
179 TopoDS_Shape anArgumentShape = anArgumentObject->GetValue();
181 TopTools_IndexedMapOfShape anArgumentIndices;
182 TopExp::MapShapes(anArgumentShape, anArgumentIndices);
183 Standard_Integer nbArgumentEntities = anArgumentIndices.Extent();
185 // Find corresponding label in history
186 TDF_Label anArgumentHistoryLabel =
187 aFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_True);
189 for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
190 TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie);
191 const TopTools_ListOfShape& aModified = aGluer.Modified(anEntity);
192 Standard_Integer nbModified = aModified.Extent();
194 if (nbModified > 0) {
195 TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True);
196 Handle(TDataStd_IntegerArray) anAttr =
197 TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified);
199 TopTools_ListIteratorOfListOfShape itM (aModified);
200 for (int im = 1; itM.More(); itM.Next(), ++im) {
201 int id = aResIndices.FindIndex(itM.Value());
202 anAttr->SetValue(im, id);
211 //=======================================================================
212 //function : GlueFaces
214 //=======================================================================
215 TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
216 const Standard_Real theTolerance,
217 const Standard_Boolean doKeepNonSolids)
220 GEOMAlgo_Gluer aGluer;
222 aGluer.SetShape(theShape);
223 aGluer.SetTolerance(theTolerance);
224 aGluer.SetCheckGeometry(Standard_True);
225 aGluer.SetKeepNonSolids(doKeepNonSolids);
229 Standard_Integer iErr = aGluer.ErrorStatus();
233 Standard_Failure::Raise("No vertices found in source shape");
236 Standard_Failure::Raise("Source shape is Null");
239 Standard_Failure::Raise("Result shape is Null");
242 Standard_Failure::Raise("Error occured during check of geometric coincidence");
246 // description of all errors see in GEOMAlgo_Gluer.cxx
247 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer with code ");
248 aMsg += TCollection_AsciiString(iErr);
249 Standard_Failure::Raise(aMsg.ToCString());
256 Standard_Integer iWrn = aGluer.WarningStatus();
260 MESSAGE("Some shapes can not be glued by faces");
263 // description of all warnings see in GEOMAlgo_Gluer.cxx
264 MESSAGE("Warning in GEOMAlgo_Gluer with code " << iWrn);
269 aRes = aGluer.Result();
274 //=======================================================================
275 //function : GlueFacesByList
277 //=======================================================================
278 TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape,
279 const Standard_Real theTolerance,
280 const Standard_Boolean doKeepNonSolids,
281 const TopTools_MapOfShape& aFaces)
285 GEOMAlgo_Gluer1 aGluer;
286 GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS;
287 GEOMAlgo_CoupleOfShapes aCS;
288 GEOMAlgo_ListOfCoupleOfShapes aLCS;
290 aGluer.SetShape(theShape);
291 aGluer.SetTolerance(theTolerance);
292 aGluer.SetKeepNonSolids(doKeepNonSolids);
294 Standard_Integer iErr = aGluer.ErrorStatus();
295 if (iErr) return aRes;
297 TopTools_ListOfShape listShape;
298 const GEOMAlgo_ListOfCoupleOfShapes& aLCSG = aGluer.GluedFaces();
300 aItCS.Initialize(aLCSG);
301 for (; aItCS.More(); aItCS.Next()) {
302 const GEOMAlgo_CoupleOfShapes& aCSG = aItCS.Value();
303 const TopoDS_Shape& aF1 = aCSG.Shape1();
304 const TopoDS_Shape& aF2 = aCSG.Shape2();
305 if (aFaces.Contains(aF1) || aFaces.Contains(aF2))
307 aCS.SetShapes(aF1,aF2);
311 //cout<<"aLCS.Extent() = "<<aLCS.Extent()<<endl;
312 if (aLCS.Extent()>0) {
313 aGluer.SetFacesToUnglue(aLCS);
314 aGluer.UnglueFaces();
315 iErr = aGluer.ErrorStatus();
316 if (iErr) return aRes;
319 aRes = aGluer.Result();
325 //=======================================================================
326 //function : GlueFaces
328 //=======================================================================
329 TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
330 const Standard_Real theTolerance,
331 const Standard_Boolean doKeepNonSolids)
338 aGA.SetArgument(theShape);
339 aGA.SetTolerance(theTolerance);
340 aGA.SetKeepNonSolids(doKeepNonSolids);
342 // 2. Detect interferred shapes
345 //Standard_Integer iWrnDetect = aGA.WarningStatus();
346 //if (iWrnDetect == 2) {
347 // Standard_Failure::Raise("GLUE_ERROR_STICKED_SHAPES");
350 Standard_Integer iErr = aGA.ErrorStatus();
354 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
358 Standard_Failure::Raise("PerformImagesToWork failed");
362 // description of all errors see in GEOMAlgo_Gluer2.cxx
363 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
364 aMsg += TCollection_AsciiString(iErr);
365 Standard_Failure::Raise(aMsg.ToCString());
372 // 3. Set shapes to glue. If the operator is absent, the whole gluing will be done
373 //aGA.SetShapesToGlue(aMSG);
377 iErr = aGA.ErrorStatus();
381 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
385 Standard_Failure::Raise("PerformImagesToWork failed");
389 // description of all errors see in GEOMAlgo_Gluer2.cxx
390 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
391 aMsg += TCollection_AsciiString(iErr);
392 Standard_Failure::Raise(aMsg.ToCString());
399 Standard_Integer iWrn = aGA.WarningStatus();
403 MESSAGE("No shapes to glue");
406 // description of all warnings see in GEOMAlgo_Gluer2.cxx
407 MESSAGE("Warning in GEOMAlgo_Gluer2 with code " << iWrn);
418 //=======================================================================
419 //function : GlueWithWarnings
421 //=======================================================================
422 TopoDS_Shape GEOMImpl_GlueDriver::GlueWithWarnings (const TopoDS_Shape& theShape,
423 const Standard_Real theTolerance,
424 const TopAbs_ShapeEnum theShapeType,
425 const Standard_Boolean doKeepNonSolids,
426 TCollection_AsciiString& theWarning,
427 const TopTools_DataMapOfShapeShape& aCopyMap) const
434 aGA.SetArgument(theShape);
435 aGA.SetTolerance(theTolerance);
436 aGA.SetKeepNonSolids(doKeepNonSolids);
438 // 2. Detect interferred shapes
441 //modified by NIZNHY-PKV Tue Mar 13 14:07:12 2012f
442 #if OCC_VERSION_LARGE > 0x06050200
443 Standard_Integer iWrnDetect = aGA.WarningStatus();
444 if (iWrnDetect == 2) {
445 Standard_Failure::Raise("GLUE_ERROR_STICKED_SHAPES");
448 //modified by NIZNHY-PKV Tue Mar 13 14:07:14 2012t
450 Standard_Integer iErr = aGA.ErrorStatus();
454 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
458 Standard_Failure::Raise("PerformImagesToWork failed");
462 // description of all errors see in GEOMAlgo_Gluer2.cxx
463 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
464 aMsg += TCollection_AsciiString(iErr);
465 Standard_Failure::Raise(aMsg.ToCString());
472 if (theShapeType != TopAbs_FACE) {
473 // 3. Fill shapes to glue aMSG
474 TopTools_DataMapOfShapeListOfShape aMSG;
475 const TopTools_DataMapOfShapeListOfShape& aMSD = aGA.ShapesDetected();
476 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItMSD;
477 aItMSD.Initialize(aMSD);
478 for (; aItMSD.More(); aItMSD.Next()) {
479 const TopoDS_Shape& aSx = aItMSD.Key();
480 const TopTools_ListOfShape& aLSD = aItMSD.Value();
481 if (aSx.ShapeType() == theShapeType) {
482 aMSG.Bind(aSx, aLSD);
486 // 4. Set shapes to glue. If the operator is absent, the whole gluing will be done
487 aGA.SetShapesToGlue(aMSG);
492 iErr = aGA.ErrorStatus();
496 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
500 Standard_Failure::Raise("PerformImagesToWork failed");
504 // description of all errors see in GEOMAlgo_Gluer2.cxx
505 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
506 aMsg += TCollection_AsciiString(iErr);
507 Standard_Failure::Raise(aMsg.ToCString());
514 Standard_Integer iWrn = aGA.WarningStatus();
518 theWarning = "No shapes to glue";
521 // description of all warnings see in GEOMAlgo_Gluer2.cxx
522 theWarning = "Warning in GEOMAlgo_Gluer2 with code ";
523 theWarning += TCollection_AsciiString(iWrn);
531 // 7. Fill history to be used by GetInPlace functionality
532 TopTools_IndexedMapOfShape aResIndices;
533 TopExp::MapShapes(aRes, aResIndices);
535 Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
537 // history for all argument shapes
538 TDF_LabelSequence aLabelSeq;
539 aFunction->GetDependency(aLabelSeq);
540 Standard_Integer nbArg = aLabelSeq.Length();
542 for (Standard_Integer iarg = 1; iarg <= nbArg; iarg++) {
544 TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg);
546 Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
547 TopoDS_Shape anArgumentShape = anArgumentObject->GetValue();
549 TopTools_IndexedMapOfShape anArgumentIndices;
550 TopExp::MapShapes(anArgumentShape, anArgumentIndices);
551 Standard_Integer nbArgumentEntities = anArgumentIndices.Extent();
553 // Find corresponding label in history
554 TDF_Label anArgumentHistoryLabel =
555 aFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_True);
557 TopTools_ListOfShape aModified;
558 for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
559 TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie);
560 if (aCopyMap.IsBound(anEntity)) {
561 anEntity = aCopyMap.Find(anEntity);
563 aModified = aGA.Modified(anEntity);
564 Standard_Integer nbModified = aModified.Extent();
565 if (!nbModified && aResIndices.Contains(anEntity)) {
566 aModified.Append(anEntity);
570 if (nbModified > 0) {
571 TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True);
572 Handle(TDataStd_IntegerArray) anAttr =
573 TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified);
575 TopTools_ListIteratorOfListOfShape itM (aModified);
576 for (int im = 1; itM.More(); itM.Next(), ++im) {
577 int id = aResIndices.FindIndex(itM.Value());
578 anAttr->SetValue(im, id);
587 //=======================================================================
588 //function : GlueByList
590 //=======================================================================
591 TopoDS_Shape GEOMImpl_GlueDriver::GlueByList (const TopoDS_Shape& theShape,
592 const Standard_Real theTolerance,
593 const Standard_Boolean doKeepNonSolids,
594 const TopTools_MapOfShape& theShapesList,
595 const Standard_Boolean doGlueAllEdges)
602 aGA.SetArgument(theShape);
603 aGA.SetTolerance(theTolerance);
604 aGA.SetKeepNonSolids(doKeepNonSolids);
606 // 2. Detect interferred shapes
609 //modified by NIZNHY-PKV Tue Mar 13 14:07:12 2012f
610 #if OCC_VERSION_LARGE > 0x06050200
611 Standard_Integer iWrnDetect = aGA.WarningStatus();
612 if (iWrnDetect == 2) {
614 TopTools_ListIteratorOfListOfShape aItLS;
616 // Sticked shapes are detected
617 const TopTools_IndexedDataMapOfShapeListOfShape& aIDMSS = pGluer2->StickedShapes();
619 Standard_Integer i, aNb = aIDMSS.Extent();
620 for (i = 1; i <= aNb; ++i) {
621 // ancestor aSa (edge, wire face,..)
622 const TopoDS_Shape& aSa = aIDMSS.FindKey(i);
624 // successors aSs (vertex, edge, ...)
625 // of the ancestor that are sticked
626 // for given value of the tolerance
627 const TopTools_ListOfShape& aLSS = aIDMSS.FindFromIndex(i);
628 aItLS.Initialize(aLSS);
629 for (; aItLS.More(); aItLS.Next()) {
630 const TopoDS_Shape& aSs = aItLS.Value();
634 Standard_Failure::Raise("GLUE_ERROR_STICKED_SHAPES");
637 //modified by NIZNHY-PKV Tue Mar 13 14:07:14 2012t
639 Standard_Integer iErr = aGA.ErrorStatus();
643 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
647 Standard_Failure::Raise("PerformImagesToWork failed");
651 // description of all errors see in GEOMAlgo_Gluer2.cxx
652 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
653 aMsg += TCollection_AsciiString(iErr);
654 Standard_Failure::Raise(aMsg.ToCString());
661 // 3. Fill shapes to glue aMSG
662 TopTools_DataMapOfShapeListOfShape aMSG;
663 const TopTools_DataMapOfShapeListOfShape& aMSD = aGA.ShapesDetected();
664 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItMSD;
665 aItMSD.Initialize(aMSD);
666 for (; aItMSD.More(); aItMSD.Next()) {
667 const TopoDS_Shape& aSx = aItMSD.Key();
668 const TopTools_ListOfShape& aLSD = aItMSD.Value();
669 TopTools_ListIteratorOfListOfShape anItLSD (aLSD);
670 bool isToGlue = false;
671 if (doGlueAllEdges && aSx.ShapeType() == TopAbs_EDGE) {
675 for (; anItLSD.More() && !isToGlue; anItLSD.Next()) {
676 if (theShapesList.Contains(anItLSD.Value())) {
682 aMSG.Bind(aSx, aLSD);
686 // 4. Set shapes to glue. If the operator is absent, the whole gluing will be done
687 aGA.SetShapesToGlue(aMSG);
691 iErr = aGA.ErrorStatus();
695 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
699 Standard_Failure::Raise("PerformImagesToWork failed");
703 // description of all errors see in GEOMAlgo_Gluer2.cxx
704 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
705 aMsg += TCollection_AsciiString(iErr);
706 Standard_Failure::Raise(aMsg.ToCString());
713 Standard_Integer iWrn = aGA.WarningStatus();
717 MESSAGE("No shapes to glue");
720 // description of all warnings see in GEOMAlgo_Gluer2.cxx
721 MESSAGE("Warning in GEOMAlgo_Gluer2 with code " << iWrn);
732 //=======================================================================
735 //=======================================================================
736 Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const
738 if (Label().IsNull()) return 0;
739 Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
741 GEOMImpl_IGlue aCI (aFunction);
742 Standard_Integer aType = aFunction->GetType();
745 TCollection_AsciiString aWrn;
747 Handle(GEOM_Function) aRefBase = aCI.GetBase();
748 TopoDS_Shape aShapeBase = aRefBase->GetValue();
749 if (aShapeBase.IsNull()) {
750 Standard_NullObject::Raise("Shape for gluing is null");
753 Standard_Real tol3d = aCI.GetTolerance();
755 Standard_Boolean aKeepNonSolids = aCI.GetKeepNonSolids();
757 // Copy initial shape to prevent its modification by gluing algorithm
758 TopoDS_Shape aShapeCopy;
759 TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
760 TNaming_CopyShape::CopyTool(aShapeBase, aMapTShapes, aShapeCopy);
763 TopTools_IndexedMapOfShape aShapeBase_inds, aShapeCopy_inds;
764 TopTools_DataMapOfShapeShape aCopyMap;
765 Standard_Integer aNbInd, i;
767 TopExp::MapShapes(aShapeBase, aShapeBase_inds);
768 TopExp::MapShapes(aShapeCopy, aShapeCopy_inds);
770 aNbInd = aShapeBase_inds.Extent();
771 for (i = 1; i <= aNbInd; ++i) {
772 aCopyMap.Bind(aShapeBase_inds(i), aShapeCopy_inds(i));
775 if (aType == GLUE_FACES) {
776 aShape = GlueWithWarnings(aShapeCopy, tol3d, TopAbs_FACE, aKeepNonSolids, aWrn, aCopyMap);
778 else if (aType == GLUE_EDGES) {
779 aShape = GlueWithWarnings(aShapeCopy, tol3d, TopAbs_EDGE, aKeepNonSolids, aWrn, aCopyMap);
781 else if (aType == GLUE_FACES_BY_LIST || aType == GLUE_EDGES_BY_LIST) {
782 Handle(TColStd_HSequenceOfTransient) SF = aCI.GetFaces();
783 TopTools_MapOfShape aFaces;
785 for (i = 1; i <= SF->Length(); i++) {
786 Handle(Standard_Transient) anItem = SF->Value(i);
789 Handle(GEOM_Function) aRefSh = Handle(GEOM_Function)::DownCast(anItem);
792 TopoDS_Shape aFace = aRefSh->GetValue();
796 // get copy of face to correspond to aShapeCopy
797 if (aShapeBase_inds.Contains(aFace)) {
798 int ind = aShapeBase_inds.FindIndex(aFace);
799 aFace = aShapeCopy_inds.FindKey(ind);
805 Standard_Boolean aGlueAllEdges = Standard_False;
806 if (aType == GLUE_FACES_BY_LIST)
807 aGlueAllEdges = aCI.GetGlueAllEdges();
809 //aShape = GlueFacesByList(aShapeBase, tol3d, aKeepNonSolids, aFaces);
810 aShape = GlueByList(aShapeCopy, tol3d, aKeepNonSolids, aFaces, aGlueAllEdges);
813 if (aShape.IsNull()) return 0;
815 aFunction->SetValue(aShape);
817 log.SetTouched(Label());
819 if (!aWrn.IsEmpty()) {
820 Standard_Failure::Raise(aWrn.ToCString());
826 //================================================================================
828 * \brief Returns a name of creation operation and names and values of creation parameters
830 //================================================================================
832 bool GEOMImpl_GlueDriver::
833 GetCreationInformation(std::string& theOperationName,
834 std::vector<GEOM_Param>& theParams)
836 if (Label().IsNull()) return 0;
837 Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
839 GEOMImpl_IGlue aCI( function );
840 Standard_Integer aType = function->GetType();
844 theOperationName = "GLUE_FACES";
845 AddParam( theParams, "Selected shape", aCI.GetBase() );
846 AddParam( theParams, "Tolerance", aCI.GetTolerance() );
847 AddParam( theParams, "To keep non solids", aCI.GetKeepNonSolids() );
850 theOperationName = "GLUE_EDGES";
851 AddParam( theParams, "Selected shape", aCI.GetBase() );
852 AddParam( theParams, "Tolerance", aCI.GetTolerance() );
854 case GLUE_FACES_BY_LIST:
855 theOperationName = "GLUE_FACES";
856 AddParam( theParams, "Selected shape", aCI.GetBase() );
857 AddParam( theParams, "Tolerance", aCI.GetTolerance() );
858 AddParam( theParams, "Faces", aCI.GetFaces() );
859 AddParam( theParams, "To keep non solids", aCI.GetKeepNonSolids() );
860 AddParam( theParams, "To glue all edges", aCI.GetGlueAllEdges() );
862 case GLUE_EDGES_BY_LIST:
863 theOperationName = "GLUE_EDGES";
864 AddParam( theParams, "Selected shape", aCI.GetBase() );
865 AddParam( theParams, "Tolerance", aCI.GetTolerance() );
866 AddParam( theParams, "Edges", aCI.GetFaces() );
875 IMPLEMENT_STANDARD_HANDLE (GEOMImpl_GlueDriver,GEOM_BaseDriver);
876 IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_GlueDriver,GEOM_BaseDriver);