-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include "utilities.h"
+#include <BRep_Builder.hxx>
+#include <ShapeFix_Shape.hxx>
#include <TDataStd_IntegerArray.hxx>
-
#include <TopExp.hxx>
-#include <TopoDS_Shape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
-
-#include <ShapeFix_Shape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopoDS_Shape.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_Failure.hxx>
aGA.Detect();
//modified by NIZNHY-PKV Tue Mar 13 14:07:12 2012f
-#if OCC_VERSION_LARGE > 0x06050200
Standard_Integer iWrnDetect = aGA.WarningStatus();
if (iWrnDetect == 2) {
- /*
- TopTools_ListIteratorOfListOfShape aItLS;
-
- // Sticked shapes are detected
- const TopTools_IndexedDataMapOfShapeListOfShape& aIDMSS = pGluer2->StickedShapes();
-
- Standard_Integer i, aNb = aIDMSS.Extent();
- for (i = 1; i <= aNb; ++i) {
- // ancestor aSa (edge, wire face,..)
- const TopoDS_Shape& aSa = aIDMSS.FindKey(i);
-
- // successors aSs (vertex, edge, ...)
- // of the ancestor that are sticked
- // for given value of the tolerance
- const TopTools_ListOfShape& aLSS = aIDMSS.FindFromIndex(i);
- aItLS.Initialize(aLSS);
- for (; aItLS.More(); aItLS.Next()) {
- const TopoDS_Shape& aSs = aItLS.Value();
- }
- }
- */
Standard_Failure::Raise("GLUE_ERROR_STICKED_SHAPES");
- //Standard_Failure::Raise("Sticked shapes are detected. The tolerance value is too big.");
- //theWarning = "Sticked shapes are detected. The tolerance value is too big.";
}
-#endif
//modified by NIZNHY-PKV Tue Mar 13 14:07:14 2012t
Standard_Integer iErr = aGA.ErrorStatus();
// 2. Detect interferred shapes
aGA.Detect();
+
+ //modified by NIZNHY-PKV Tue Mar 13 14:07:12 2012f
+ Standard_Integer iWrnDetect = aGA.WarningStatus();
+ if (iWrnDetect == 2) {
+ /*
+ TopTools_ListIteratorOfListOfShape aItLS;
+
+ // Sticked shapes are detected
+ const TopTools_IndexedDataMapOfShapeListOfShape& aIDMSS = pGluer2->StickedShapes();
+
+ Standard_Integer i, aNb = aIDMSS.Extent();
+ for (i = 1; i <= aNb; ++i) {
+ // ancestor aSa (edge, wire face,..)
+ const TopoDS_Shape& aSa = aIDMSS.FindKey(i);
+
+ // successors aSs (vertex, edge, ...)
+ // of the ancestor that are sticked
+ // for given value of the tolerance
+ const TopTools_ListOfShape& aLSS = aIDMSS.FindFromIndex(i);
+ aItLS.Initialize(aLSS);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aSs = aItLS.Value();
+ }
+ }
+ */
+ Standard_Failure::Raise("GLUE_ERROR_STICKED_SHAPES");
+ }
+ //modified by NIZNHY-PKV Tue Mar 13 14:07:14 2012t
+
Standard_Integer iErr = aGA.ErrorStatus();
if (iErr) {
switch (iErr) {
TopoDS_Shape aShape;
TCollection_AsciiString aWrn;
- Handle(GEOM_Function) aRefBase = aCI.GetBase();
- TopoDS_Shape aShapeBase = aRefBase->GetValue();
+ TopoDS_Shape aShapeBase;
+ Handle(TColStd_HSequenceOfTransient) aRefBases = aCI.GetBase();
+ if ( aRefBases && !aRefBases->IsEmpty() )
+ {
+ if ( aRefBases->Length() == 1 )
+ {
+ Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aRefBases->Value(1));
+ if ( !aRefShape.IsNull() )
+ aShapeBase = aRefShape->GetValue();
+ }
+ else
+ {
+ TopoDS_Compound compound;
+ BRep_Builder builder;
+ builder.MakeCompound( compound );
+ int ind = 1;
+ for ( ; ind <= aRefBases->Length(); ind++)
+ {
+ Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aRefBases->Value(ind));
+ if ( aRefShape.IsNull() ) break;
+ TopoDS_Shape aShape = aRefShape->GetValue();
+ if (aShape.IsNull()) break;
+ builder.Add( compound, aShape );
+ }
+ if ( ind > aRefBases->Length() )
+ aShapeBase = compound;
+ else
+ aShapeBase.Nullify();
+ }
+ }
if (aShapeBase.IsNull()) {
Standard_NullObject::Raise("Shape for gluing is null");
}
TopoDS_Shape aFace = aRefSh->GetValue();
if (aFace.IsNull())
continue;
- if (!aFaces.Contains(aFace))
- aFaces.Add(aFace);
+ aFaces.Add(aFace);
}
Standard_Boolean aGlueAllEdges = Standard_False;
return 1;
}
-//=======================================================================
-//function : GEOMImpl_GlueDriver_Type_
-//purpose :
-//=======================================================================
-Standard_EXPORT Handle_Standard_Type& GEOMImpl_GlueDriver_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
- if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_GlueDriver",
- sizeof(GEOMImpl_GlueDriver),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
+//================================================================================
+/*!
+ * \brief Returns a name of creation operation and names and values of creation parameters
+ */
+//================================================================================
- return _aType;
-}
-
-//=======================================================================
-//function : DownCast
-//purpose :
-//=======================================================================
-const Handle(GEOMImpl_GlueDriver) Handle(GEOMImpl_GlueDriver)::DownCast(const Handle(Standard_Transient)& AnObject)
+bool GEOMImpl_GlueDriver::
+GetCreationInformation(std::string& theOperationName,
+ std::vector<GEOM_Param>& theParams)
{
- Handle(GEOMImpl_GlueDriver) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_GlueDriver))) {
- _anOtherObject = Handle(GEOMImpl_GlueDriver)((Handle(GEOMImpl_GlueDriver)&)AnObject);
- }
+ if (Label().IsNull()) return 0;
+ Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
+
+ GEOMImpl_IGlue aCI( function );
+ Standard_Integer aType = function->GetType();
+
+ switch ( aType ) {
+ case GLUE_FACES:
+ theOperationName = "GLUE_FACES";
+ AddParam( theParams, "Selected shapes", aCI.GetBase() );
+ AddParam( theParams, "Tolerance", aCI.GetTolerance() );
+ AddParam( theParams, "To keep non solids", aCI.GetKeepNonSolids() );
+ break;
+ case GLUE_EDGES:
+ theOperationName = "GLUE_EDGES";
+ AddParam( theParams, "Selected shapes", aCI.GetBase() );
+ AddParam( theParams, "Tolerance", aCI.GetTolerance() );
+ break;
+ case GLUE_FACES_BY_LIST:
+ theOperationName = "GLUE_FACES";
+ AddParam( theParams, "Selected shapes", aCI.GetBase() );
+ AddParam( theParams, "Tolerance", aCI.GetTolerance() );
+ AddParam( theParams, "Faces", aCI.GetFaces() );
+ AddParam( theParams, "To keep non solids", aCI.GetKeepNonSolids() );
+ AddParam( theParams, "To glue all edges", aCI.GetGlueAllEdges() );
+ break;
+ case GLUE_EDGES_BY_LIST:
+ theOperationName = "GLUE_EDGES";
+ AddParam( theParams, "Selected shapes", aCI.GetBase() );
+ AddParam( theParams, "Tolerance", aCI.GetTolerance() );
+ AddParam( theParams, "Edges", aCI.GetFaces() );
+ break;
+ default:
+ return false;
}
-
- return _anOtherObject;
+
+ return true;
}
+
+IMPLEMENT_STANDARD_HANDLE (GEOMImpl_GlueDriver,GEOM_BaseDriver);
+IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_GlueDriver,GEOM_BaseDriver);