-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2013 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
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-
-#include <Standard_Stream.hxx>
+//
#include <GEOMImpl_PipeDriver.hxx>
-#include <GEOMImpl_IShapesOperations.hxx>
#include <GEOMImpl_IPipeDiffSect.hxx>
#include <GEOMImpl_IPipeShellSect.hxx>
#include <GEOMImpl_IPipeBiNormal.hxx>
#include <GEOMImpl_IPipe.hxx>
+#include <GEOMImpl_IPipePath.hxx>
#include <GEOMImpl_GlueDriver.hxx>
#include <GEOMImpl_Types.hxx>
+
#include <GEOM_Function.hxx>
+#include <GEOMUtils.hxx>
+
#include <ShapeAnalysis_FreeBounds.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeFix_Face.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
+#include <BRepBuilderAPI_Copy.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_Sewing.hxx>
#include <BRepCheck_Analyzer.hxx>
+#include <BRepGProp.hxx>
#include <BRepOffsetAPI_MakePipe.hxx>
#include <BRepOffsetAPI_MakePipeShell.hxx>
-#include <GProp_GProps.hxx>
-#include <BRepGProp.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <BRepBuilderAPI_Copy.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <GProp_GProps.hxx>
+
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <GeomAPI_Interpolate.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <Precision.hxx>
+
#include <Standard_NullObject.hxx>
#include <Standard_TypeMismatch.hxx>
#include <Standard_ConstructionError.hxx>
#include "utilities.h"
+
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
const Standard_GUID& GEOMImpl_PipeDriver::GetID()
{
- static Standard_GUID aPipeDriver("FF1BBB19-5D14-4df2-980B-3A668264EA16");
+ static Standard_GUID aPipeDriver ("FF1BBB19-5D14-4df2-980B-3A668264EA16");
return aPipeDriver;
}
//function : Execute
//purpose :
//=======================================================================
-Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const
+Standard_Integer GEOMImpl_PipeDriver::Execute (TFunction_Logbook& log) const
{
- //cout<<"PipeDriver::Execute"<<endl;
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
- GEOMImpl_IPipe* aCI= 0;
Standard_Integer aType = aFunction->GetType();
+
+ GEOMImpl_IPipe* aCI = 0;
if (aType == PIPE_BASE_PATH)
- aCI = new GEOMImpl_IPipe(aFunction);
+ aCI = new GEOMImpl_IPipe (aFunction);
else if (aType == PIPE_DIFFERENT_SECTIONS)
- aCI = new GEOMImpl_IPipeDiffSect(aFunction);
+ aCI = new GEOMImpl_IPipeDiffSect (aFunction);
else if (aType == PIPE_SHELL_SECTIONS)
- aCI = new GEOMImpl_IPipeShellSect(aFunction);
+ aCI = new GEOMImpl_IPipeShellSect (aFunction);
else if (aType == PIPE_SHELLS_WITHOUT_PATH)
- aCI = new GEOMImpl_IPipeShellSect(aFunction);
+ aCI = new GEOMImpl_IPipeShellSect (aFunction);
else if (aType == PIPE_BI_NORMAL_ALONG_VECTOR)
- aCI = new GEOMImpl_IPipeBiNormal(aFunction);
+ aCI = new GEOMImpl_IPipeBiNormal (aFunction);
else
return 0;
Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
}
- // Glue (for bug 0020207)
- TopExp_Explorer anExpV (aShape, TopAbs_VERTEX);
- if (anExpV.More()) {
- Standard_Real aVertMaxTol = -RealLast();
- for (; anExpV.More(); anExpV.Next()) {
- TopoDS_Vertex aVertex = TopoDS::Vertex(anExpV.Current());
- Standard_Real aTol = BRep_Tool::Tolerance(aVertex);
- if (aTol > aVertMaxTol)
- aVertMaxTol = aTol;
- }
- aVertMaxTol += Precision::Confusion();
- aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, aVertMaxTol, Standard_True);
- //aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, Precision::Confusion(), Standard_True);
+ if (aType != PIPE_BASE_PATH &&
+ aType != PIPE_SHELLS_WITHOUT_PATH) {
+ TopExp_Explorer anExpV (aShape, TopAbs_VERTEX);
+ if (anExpV.More()) {
+ Standard_Real aVertMaxTol = -RealLast();
+ for (; anExpV.More(); anExpV.Next()) {
+ TopoDS_Vertex aVertex = TopoDS::Vertex(anExpV.Current());
+ Standard_Real aTol = BRep_Tool::Tolerance(aVertex);
+ if (aTol > aVertMaxTol)
+ aVertMaxTol = aTol;
+ }
+ aVertMaxTol += Precision::Confusion();
+ aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, aVertMaxTol, Standard_True);
+ //aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, Precision::Confusion(), Standard_True);
+ }
}
- TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape);
+ TopoDS_Shape aRes = GEOMUtils::CompsolidToCompound(aShape);
aFunction->SetValue(aRes);
log.SetTouched(Label());
return 1;
}
-//=======================================================================
-//function : GEOMImpl_PipeDriver_Type_
-//purpose :
-//=======================================================================
-Standard_EXPORT Handle_Standard_Type& GEOMImpl_PipeDriver_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_PipeDriver",
- sizeof(GEOMImpl_PipeDriver),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
+//================================================================================
+/*!
+ * \brief Returns a name of creation operation and names and values of creation parameters
+ */
+//================================================================================
-//=======================================================================
-//function : DownCast
-//purpose :
-//=======================================================================
-const Handle(GEOMImpl_PipeDriver) Handle(GEOMImpl_PipeDriver)::DownCast(const Handle(Standard_Transient)& AnObject)
+bool GEOMImpl_PipeDriver::
+GetCreationInformation(std::string& theOperationName,
+ std::vector<GEOM_Param>& theParams)
{
- Handle(GEOMImpl_PipeDriver) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PipeDriver))) {
- _anOtherObject = Handle(GEOMImpl_PipeDriver)((Handle(GEOMImpl_PipeDriver)&)AnObject);
- }
+ if (Label().IsNull()) return 0;
+ Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
+ Standard_Integer aType = function->GetType();
+
+ switch ( aType ) {
+ case PIPE_BASE_PATH:
+ {
+ theOperationName = "PIPE";
+ GEOMImpl_IPipe aCI( function );
+ AddParam( theParams, "Base Object", aCI.GetBase() );
+ AddParam( theParams, "Path Object", aCI.GetPath() );
+ break;
}
-
- return _anOtherObject;
+ case PIPE_BI_NORMAL_ALONG_VECTOR:
+ {
+ theOperationName = "PIPE";
+ GEOMImpl_IPipeBiNormal aCI( function );
+ AddParam( theParams, "Base Object", aCI.GetBase() );
+ AddParam( theParams, "Path Object", aCI.GetPath() );
+ AddParam( theParams, "BiNormal", aCI.GetVector() );
+ break;
+ }
+ case PIPE_DIFFERENT_SECTIONS:
+ {
+ theOperationName = "PIPE";
+ GEOMImpl_IPipeDiffSect aCI( function );
+ AddParam( theParams, "Bases", aCI.GetBases() );
+ AddParam( theParams, "Locations", aCI.GetLocations() );
+ AddParam( theParams, "Path", aCI.GetPath() );
+ AddParam( theParams, "With contact", aCI.GetWithContactMode() );
+ AddParam( theParams, "With correction", aCI.GetWithCorrectionMode() );
+ break;
+ }
+ case PIPE_SHELL_SECTIONS:
+ {
+ theOperationName = "PIPE";
+ GEOMImpl_IPipeShellSect aCI( function );
+ AddParam( theParams, "Bases", aCI.GetBases() );
+ AddParam( theParams, "Sub-Bases", aCI.GetSubBases() );
+ AddParam( theParams, "Locations", aCI.GetLocations() );
+ AddParam( theParams, "Path", aCI.GetPath() );
+ AddParam( theParams, "With contact", aCI.GetWithContactMode() );
+ AddParam( theParams, "With correction", aCI.GetWithCorrectionMode() );
+ break;
+ }
+ case PIPE_SHELLS_WITHOUT_PATH:
+ {
+ theOperationName = "PIPE"; // MakePipeShellsWithoutPath
+ GEOMImpl_IPipeShellSect aCI( function );
+ AddParam( theParams, "Bases", aCI.GetBases() );
+ AddParam( theParams, "Locations", aCI.GetLocations() );
+ break;
+ }
+ default:
+ return false;
+ }
+
+ return true;
}
+
+IMPLEMENT_STANDARD_HANDLE (GEOMImpl_PipeDriver,GEOM_BaseDriver);
+IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PipeDriver,GEOM_BaseDriver);