1 // Copyright (C) 2007-2016 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, 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 <Basics_OCCTVersion.hxx>
39 #include "utilities.h"
41 #include <BRep_Builder.hxx>
42 #include <ShapeFix_Shape.hxx>
43 #include <TDataStd_IntegerArray.hxx>
45 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
46 #include <TopTools_IndexedMapOfShape.hxx>
47 #include <TopTools_ListIteratorOfListOfShape.hxx>
48 #include <TopTools_ListOfShape.hxx>
49 #include <TopoDS_Shape.hxx>
51 #include <Standard_NullObject.hxx>
52 #include <Standard_Failure.hxx>
54 #define MSG_BAD_TOLERANCE "Tolerance is too big"
55 #define MSG_BAD_ARG_SHAPE "Argument shape is not a compound of hexahedral solids"
57 //=======================================================================
58 //function : GEOMImpl_GlueDriver
60 //=======================================================================
61 GEOMImpl_GlueDriver::GEOMImpl_GlueDriver()
65 //=======================================================================
68 //=======================================================================
69 const Standard_GUID& GEOMImpl_GlueDriver::GetID()
71 static Standard_GUID aGlueDriver("FF1BBB63-5D14-4df2-980B-3A668264EA16");
75 //=======================================================================
76 //function : GlueFacesWithWarnings
78 //=======================================================================
80 TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& theShape,
81 const Standard_Real theTolerance,
82 const Standard_Boolean doKeepNonSolids,
83 TCollection_AsciiString& theWarning) const
85 Standard_Integer iErr, iWrn;
87 GEOMAlgo_Gluer aGluer;
89 aGluer.SetShape(theShape);
90 aGluer.SetTolerance(theTolerance);
91 aGluer.SetCheckGeometry(Standard_True);
92 aGluer.SetKeepNonSolids(doKeepNonSolids);
96 iErr = aGluer.ErrorStatus();
100 Standard_Failure::Raise("No vertices found in source shape");
104 Standard_Failure::Raise(MSG_BAD_TOLERANCE " or " MSG_BAD_ARG_SHAPE);
107 Standard_Failure::Raise("Source shape is Null");
110 Standard_Failure::Raise("Result shape is Null");
113 Standard_Failure::Raise(MSG_BAD_TOLERANCE);
117 Standard_Failure::Raise(MSG_BAD_ARG_SHAPE);
120 Standard_Failure::Raise("Error occured during check of geometric coincidence");
124 // description of all errors see in GEOMAlgo_Gluer.cxx
125 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer with code ");
126 aMsg += TCollection_AsciiString(iErr);
127 Standard_Failure::Raise(aMsg.ToCString());
134 iWrn = aGluer.WarningStatus();
139 Standard_Integer nbAlone = aGluer.AloneShapes();
140 theWarning = TCollection_AsciiString(nbAlone);
141 theWarning += " solid(s) can not be glued by faces";
145 // description of all warnings see in GEOMAlgo_Gluer.cxx
146 theWarning = "Warning in GEOMAlgo_Gluer with code ";
147 theWarning += TCollection_AsciiString(iWrn);
152 aRes = aGluer.Result();
154 // SKL 18.01.2010 - patch for 20662
155 Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aRes);
156 aSfs->SetPrecision(Precision::Confusion());
158 aRes = aSfs->Shape();
160 // Fill history to be used by GetInPlace functionality
161 TopTools_IndexedMapOfShape aResIndices;
162 TopExp::MapShapes(aRes, aResIndices);
164 Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
166 // history for all argument shapes
167 TDF_LabelSequence aLabelSeq;
168 aFunction->GetDependency(aLabelSeq);
169 Standard_Integer nbArg = aLabelSeq.Length();
171 for (Standard_Integer iarg = 1; iarg <= nbArg; iarg++) {
173 TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg);
175 Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
176 TopoDS_Shape anArgumentShape = anArgumentObject->GetValue();
178 TopTools_IndexedMapOfShape anArgumentIndices;
179 TopExp::MapShapes(anArgumentShape, anArgumentIndices);
180 Standard_Integer nbArgumentEntities = anArgumentIndices.Extent();
182 // Find corresponding label in history
183 TDF_Label anArgumentHistoryLabel =
184 aFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_True);
186 for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
187 TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie);
188 const TopTools_ListOfShape& aModified = aGluer.Modified(anEntity);
189 Standard_Integer nbModified = aModified.Extent();
191 if (nbModified > 0) {
192 TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True);
193 Handle(TDataStd_IntegerArray) anAttr =
194 TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified);
196 TopTools_ListIteratorOfListOfShape itM (aModified);
197 for (int im = 1; itM.More(); itM.Next(), ++im) {
198 int id = aResIndices.FindIndex(itM.Value());
199 anAttr->SetValue(im, id);
208 //=======================================================================
209 //function : GlueFaces
211 //=======================================================================
212 TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
213 const Standard_Real theTolerance,
214 const Standard_Boolean doKeepNonSolids)
217 GEOMAlgo_Gluer aGluer;
219 aGluer.SetShape(theShape);
220 aGluer.SetTolerance(theTolerance);
221 aGluer.SetCheckGeometry(Standard_True);
222 aGluer.SetKeepNonSolids(doKeepNonSolids);
226 Standard_Integer iErr = aGluer.ErrorStatus();
230 Standard_Failure::Raise("No vertices found in source shape");
233 Standard_Failure::Raise("Source shape is Null");
236 Standard_Failure::Raise("Result shape is Null");
239 Standard_Failure::Raise("Error occured during check of geometric coincidence");
243 // description of all errors see in GEOMAlgo_Gluer.cxx
244 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer with code ");
245 aMsg += TCollection_AsciiString(iErr);
246 Standard_Failure::Raise(aMsg.ToCString());
253 Standard_Integer iWrn = aGluer.WarningStatus();
257 MESSAGE("Some shapes can not be glued by faces");
260 // description of all warnings see in GEOMAlgo_Gluer.cxx
261 MESSAGE("Warning in GEOMAlgo_Gluer with code " << iWrn);
266 aRes = aGluer.Result();
271 //=======================================================================
272 //function : GlueFacesByList
274 //=======================================================================
275 TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape,
276 const Standard_Real theTolerance,
277 const Standard_Boolean doKeepNonSolids,
278 const TopTools_MapOfShape& aFaces)
282 GEOMAlgo_Gluer1 aGluer;
283 GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS;
284 GEOMAlgo_CoupleOfShapes aCS;
285 GEOMAlgo_ListOfCoupleOfShapes aLCS;
287 aGluer.SetShape(theShape);
288 aGluer.SetTolerance(theTolerance);
289 aGluer.SetKeepNonSolids(doKeepNonSolids);
291 Standard_Integer iErr = aGluer.ErrorStatus();
292 if (iErr) return aRes;
294 TopTools_ListOfShape listShape;
295 const GEOMAlgo_ListOfCoupleOfShapes& aLCSG = aGluer.GluedFaces();
297 aItCS.Initialize(aLCSG);
298 for (; aItCS.More(); aItCS.Next()) {
299 const GEOMAlgo_CoupleOfShapes& aCSG = aItCS.Value();
300 const TopoDS_Shape& aF1 = aCSG.Shape1();
301 const TopoDS_Shape& aF2 = aCSG.Shape2();
302 if (aFaces.Contains(aF1) || aFaces.Contains(aF2))
304 aCS.SetShapes(aF1,aF2);
308 //cout<<"aLCS.Extent() = "<<aLCS.Extent()<<endl;
309 if (aLCS.Extent()>0) {
310 aGluer.SetFacesToUnglue(aLCS);
311 aGluer.UnglueFaces();
312 iErr = aGluer.ErrorStatus();
313 if (iErr) return aRes;
316 aRes = aGluer.Result();
322 //=======================================================================
323 //function : GlueFaces
325 //=======================================================================
326 TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces
327 (const TopoDS_Shape &theShape,
328 const Standard_Real theTolerance,
329 const Standard_Boolean doKeepNonSolids,
330 TopTools_DataMapOfShapeListOfShape *pMapModif)
337 aGA.SetArgument(theShape);
338 aGA.SetTolerance(theTolerance);
339 aGA.SetKeepNonSolids(doKeepNonSolids);
341 // 2. Detect interferred shapes
344 //Standard_Integer iWrnDetect = aGA.WarningStatus();
345 //if (iWrnDetect == 2) {
346 // Standard_Failure::Raise("GLUE_ERROR_STICKED_SHAPES");
349 Standard_Integer iErr = aGA.ErrorStatus();
353 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
357 Standard_Failure::Raise("PerformImagesToWork failed");
361 // description of all errors see in GEOMAlgo_Gluer2.cxx
362 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
363 aMsg += TCollection_AsciiString(iErr);
364 Standard_Failure::Raise(aMsg.ToCString());
371 // 3. Set shapes to glue. If the operator is absent, the whole gluing will be done
372 //aGA.SetShapesToGlue(aMSG);
376 iErr = aGA.ErrorStatus();
380 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
384 Standard_Failure::Raise("PerformImagesToWork failed");
388 // description of all errors see in GEOMAlgo_Gluer2.cxx
389 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
390 aMsg += TCollection_AsciiString(iErr);
391 Standard_Failure::Raise(aMsg.ToCString());
398 Standard_Integer iWrn = aGA.WarningStatus();
402 MESSAGE("No shapes to glue");
405 // description of all warnings see in GEOMAlgo_Gluer2.cxx
406 MESSAGE("Warning in GEOMAlgo_Gluer2 with code " << iWrn);
415 // Fill the map of modified shapes.
416 TopTools_IndexedMapOfShape aMapSubShapes;
418 TopExp::MapShapes(theShape, aMapSubShapes);
421 const Standard_Integer aNbShapes = aMapSubShapes.Extent();
424 for (i = 1; i <= aNbShapes; ++i) {
425 const TopoDS_Shape &aSubShape = aMapSubShapes.FindKey(i);
426 const TopTools_ListOfShape &aModif = aGA.Modified(aSubShape);
428 if (!aModif.IsEmpty()) {
429 pMapModif->Bind(aSubShape, aModif);
437 //=======================================================================
438 //function : GlueWithWarnings
440 //=======================================================================
441 TopoDS_Shape GEOMImpl_GlueDriver::GlueWithWarnings (const TopoDS_Shape& theShape,
442 const Standard_Real theTolerance,
443 const TopAbs_ShapeEnum theShapeType,
444 const Standard_Boolean doKeepNonSolids,
445 TCollection_AsciiString& theWarning) const
452 aGA.SetArgument(theShape);
453 aGA.SetTolerance(theTolerance);
454 aGA.SetKeepNonSolids(doKeepNonSolids);
456 // 2. Detect interferred shapes
459 //modified by NIZNHY-PKV Tue Mar 13 14:07:12 2012f
460 Standard_Integer iWrnDetect = aGA.WarningStatus();
461 if (iWrnDetect == 2) {
462 Standard_Failure::Raise("GLUE_ERROR_STICKED_SHAPES");
464 //modified by NIZNHY-PKV Tue Mar 13 14:07:14 2012t
466 Standard_Integer iErr = aGA.ErrorStatus();
470 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
474 Standard_Failure::Raise("PerformImagesToWork failed");
478 // description of all errors see in GEOMAlgo_Gluer2.cxx
479 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
480 aMsg += TCollection_AsciiString(iErr);
481 Standard_Failure::Raise(aMsg.ToCString());
488 if (theShapeType != TopAbs_FACE) {
489 // 3. Fill shapes to glue aMSG
490 TopTools_DataMapOfShapeListOfShape aMSG;
491 const TopTools_DataMapOfShapeListOfShape& aMSD = aGA.ShapesDetected();
492 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItMSD;
493 aItMSD.Initialize(aMSD);
494 for (; aItMSD.More(); aItMSD.Next()) {
495 const TopoDS_Shape& aSx = aItMSD.Key();
496 const TopTools_ListOfShape& aLSD = aItMSD.Value();
497 if (aSx.ShapeType() == theShapeType) {
498 aMSG.Bind(aSx, aLSD);
502 // 4. Set shapes to glue. If the operator is absent, the whole gluing will be done
503 aGA.SetShapesToGlue(aMSG);
508 iErr = aGA.ErrorStatus();
512 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
516 Standard_Failure::Raise("PerformImagesToWork failed");
520 // description of all errors see in GEOMAlgo_Gluer2.cxx
521 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
522 aMsg += TCollection_AsciiString(iErr);
523 Standard_Failure::Raise(aMsg.ToCString());
530 Standard_Integer iWrn = aGA.WarningStatus();
534 theWarning = "No shapes to glue";
537 // description of all warnings see in GEOMAlgo_Gluer2.cxx
538 theWarning = "Warning in GEOMAlgo_Gluer2 with code ";
539 theWarning += TCollection_AsciiString(iWrn);
547 // 7. Fill history to be used by GetInPlace functionality
548 TopTools_IndexedMapOfShape aResIndices;
549 TopExp::MapShapes(aRes, aResIndices);
551 Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
553 // history for all argument shapes
554 TDF_LabelSequence aLabelSeq;
555 aFunction->GetDependency(aLabelSeq);
556 Standard_Integer nbArg = aLabelSeq.Length();
558 for (Standard_Integer iarg = 1; iarg <= nbArg; iarg++) {
560 TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg);
562 Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
563 TopoDS_Shape anArgumentShape = anArgumentObject->GetValue();
565 TopTools_IndexedMapOfShape anArgumentIndices;
566 TopExp::MapShapes(anArgumentShape, anArgumentIndices);
567 Standard_Integer nbArgumentEntities = anArgumentIndices.Extent();
569 // Find corresponding label in history
570 TDF_Label anArgumentHistoryLabel =
571 aFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_True);
573 for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
574 TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie);
575 const TopTools_ListOfShape& aModified = aGA.Modified(anEntity);
576 Standard_Integer nbModified = aModified.Extent();
578 if (nbModified > 0) {
579 TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True);
580 Handle(TDataStd_IntegerArray) anAttr =
581 TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified);
583 TopTools_ListIteratorOfListOfShape itM (aModified);
584 for (int im = 1; itM.More(); itM.Next(), ++im) {
585 int id = aResIndices.FindIndex(itM.Value());
586 anAttr->SetValue(im, id);
595 //=======================================================================
596 //function : GlueByList
598 //=======================================================================
599 TopoDS_Shape GEOMImpl_GlueDriver::GlueByList (const TopoDS_Shape& theShape,
600 const Standard_Real theTolerance,
601 const Standard_Boolean doKeepNonSolids,
602 const TopTools_MapOfShape& theShapesList,
603 const Standard_Boolean doGlueAllEdges)
610 aGA.SetArgument(theShape);
611 aGA.SetTolerance(theTolerance);
612 aGA.SetKeepNonSolids(doKeepNonSolids);
614 // 2. Detect interferred shapes
617 //modified by NIZNHY-PKV Tue Mar 13 14:07:12 2012f
618 Standard_Integer iWrnDetect = aGA.WarningStatus();
619 if (iWrnDetect == 2) {
621 TopTools_ListIteratorOfListOfShape aItLS;
623 // Sticked shapes are detected
624 const TopTools_IndexedDataMapOfShapeListOfShape& aIDMSS = pGluer2->StickedShapes();
626 Standard_Integer i, aNb = aIDMSS.Extent();
627 for (i = 1; i <= aNb; ++i) {
628 // ancestor aSa (edge, wire face,..)
629 const TopoDS_Shape& aSa = aIDMSS.FindKey(i);
631 // successors aSs (vertex, edge, ...)
632 // of the ancestor that are sticked
633 // for given value of the tolerance
634 const TopTools_ListOfShape& aLSS = aIDMSS.FindFromIndex(i);
635 aItLS.Initialize(aLSS);
636 for (; aItLS.More(); aItLS.Next()) {
637 const TopoDS_Shape& aSs = aItLS.Value();
641 Standard_Failure::Raise("GLUE_ERROR_STICKED_SHAPES");
643 //modified by NIZNHY-PKV Tue Mar 13 14:07:14 2012t
645 Standard_Integer iErr = aGA.ErrorStatus();
649 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
653 Standard_Failure::Raise("PerformImagesToWork failed");
657 // description of all errors see in GEOMAlgo_Gluer2.cxx
658 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
659 aMsg += TCollection_AsciiString(iErr);
660 Standard_Failure::Raise(aMsg.ToCString());
667 // 3. Fill shapes to glue aMSG
668 TopTools_DataMapOfShapeListOfShape aMSG;
669 const TopTools_DataMapOfShapeListOfShape& aMSD = aGA.ShapesDetected();
670 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItMSD;
671 aItMSD.Initialize(aMSD);
672 for (; aItMSD.More(); aItMSD.Next()) {
673 const TopoDS_Shape& aSx = aItMSD.Key();
674 const TopTools_ListOfShape& aLSD = aItMSD.Value();
675 TopTools_ListIteratorOfListOfShape anItLSD (aLSD);
676 bool isToGlue = false;
677 if (doGlueAllEdges && aSx.ShapeType() == TopAbs_EDGE) {
681 for (; anItLSD.More() && !isToGlue; anItLSD.Next()) {
682 if (theShapesList.Contains(anItLSD.Value())) {
688 aMSG.Bind(aSx, aLSD);
692 // 4. Set shapes to glue. If the operator is absent, the whole gluing will be done
693 aGA.SetShapesToGlue(aMSG);
697 iErr = aGA.ErrorStatus();
701 Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
705 Standard_Failure::Raise("PerformImagesToWork failed");
709 // description of all errors see in GEOMAlgo_Gluer2.cxx
710 TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
711 aMsg += TCollection_AsciiString(iErr);
712 Standard_Failure::Raise(aMsg.ToCString());
719 Standard_Integer iWrn = aGA.WarningStatus();
723 MESSAGE("No shapes to glue");
726 // description of all warnings see in GEOMAlgo_Gluer2.cxx
727 MESSAGE("Warning in GEOMAlgo_Gluer2 with code " << iWrn);
738 //=======================================================================
741 //=======================================================================
742 Standard_Integer GEOMImpl_GlueDriver::Execute(LOGBOOK& log) const
744 if (Label().IsNull()) return 0;
745 Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
747 GEOMImpl_IGlue aCI (aFunction);
748 Standard_Integer aType = aFunction->GetType();
751 TCollection_AsciiString aWrn;
753 TopoDS_Shape aShapeBase;
754 Handle(TColStd_HSequenceOfTransient) aRefBases = aCI.GetBase();
755 if ( aRefBases && !aRefBases->IsEmpty() )
757 if ( aRefBases->Length() == 1 )
759 Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aRefBases->Value(1));
760 if ( !aRefShape.IsNull() )
761 aShapeBase = aRefShape->GetValue();
765 TopoDS_Compound compound;
766 BRep_Builder builder;
767 builder.MakeCompound( compound );
769 for ( ; ind <= aRefBases->Length(); ind++)
771 Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aRefBases->Value(ind));
772 if ( aRefShape.IsNull() ) break;
773 TopoDS_Shape aShape = aRefShape->GetValue();
774 if (aShape.IsNull()) break;
775 builder.Add( compound, aShape );
777 if ( ind > aRefBases->Length() )
778 aShapeBase = compound;
780 aShapeBase.Nullify();
783 if (aShapeBase.IsNull()) {
784 Standard_NullObject::Raise("Shape for gluing is null");
787 Standard_Real tol3d = aCI.GetTolerance();
789 Standard_Boolean aKeepNonSolids = aCI.GetKeepNonSolids();
791 if (aType == GLUE_FACES) {
792 //aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aKeepNonSolids, aWrn);
793 aShape = GlueWithWarnings(aShapeBase, tol3d, TopAbs_FACE, aKeepNonSolids, aWrn);
795 else if (aType == GLUE_EDGES) {
796 aShape = GlueWithWarnings(aShapeBase, tol3d, TopAbs_EDGE, aKeepNonSolids, aWrn);
798 else if (aType == GLUE_FACES_BY_LIST || aType == GLUE_EDGES_BY_LIST) {
799 Handle(TColStd_HSequenceOfTransient) SF = aCI.GetFaces();
800 TopTools_MapOfShape aFaces;
802 for (; i <= SF->Length(); i++) {
803 Handle(Standard_Transient) anItem = SF->Value(i);
806 Handle(GEOM_Function) aRefSh = Handle(GEOM_Function)::DownCast(anItem);
809 TopoDS_Shape aFace = aRefSh->GetValue();
815 Standard_Boolean aGlueAllEdges = Standard_False;
816 if (aType == GLUE_FACES_BY_LIST)
817 aGlueAllEdges = aCI.GetGlueAllEdges();
819 //aShape = GlueFacesByList(aShapeBase, tol3d, aKeepNonSolids, aFaces);
820 aShape = GlueByList(aShapeBase, tol3d, aKeepNonSolids, aFaces, aGlueAllEdges);
823 if (aShape.IsNull()) return 0;
825 aFunction->SetValue(aShape);
827 #if OCC_VERSION_MAJOR < 7
828 log.SetTouched(Label());
830 log->SetTouched(Label());
833 if (!aWrn.IsEmpty()) {
834 Standard_Failure::Raise(aWrn.ToCString());
840 //================================================================================
842 * \brief Returns a name of creation operation and names and values of creation parameters
844 //================================================================================
846 bool GEOMImpl_GlueDriver::
847 GetCreationInformation(std::string& theOperationName,
848 std::vector<GEOM_Param>& theParams)
850 if (Label().IsNull()) return 0;
851 Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
853 GEOMImpl_IGlue aCI( function );
854 Standard_Integer aType = function->GetType();
858 theOperationName = "GLUE_FACES";
859 AddParam( theParams, "Selected shapes", aCI.GetBase() );
860 AddParam( theParams, "Tolerance", aCI.GetTolerance() );
861 AddParam( theParams, "To keep non solids", aCI.GetKeepNonSolids() );
864 theOperationName = "GLUE_EDGES";
865 AddParam( theParams, "Selected shapes", aCI.GetBase() );
866 AddParam( theParams, "Tolerance", aCI.GetTolerance() );
868 case GLUE_FACES_BY_LIST:
869 theOperationName = "GLUE_FACES";
870 AddParam( theParams, "Selected shapes", aCI.GetBase() );
871 AddParam( theParams, "Tolerance", aCI.GetTolerance() );
872 AddParam( theParams, "Faces", aCI.GetFaces() );
873 AddParam( theParams, "To keep non solids", aCI.GetKeepNonSolids() );
874 AddParam( theParams, "To glue all edges", aCI.GetGlueAllEdges() );
876 case GLUE_EDGES_BY_LIST:
877 theOperationName = "GLUE_EDGES";
878 AddParam( theParams, "Selected shapes", aCI.GetBase() );
879 AddParam( theParams, "Tolerance", aCI.GetTolerance() );
880 AddParam( theParams, "Edges", aCI.GetFaces() );
889 OCCT_IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_GlueDriver,GEOM_BaseDriver);