-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 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
// 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 <ShHealOper_ShapeProcess.hxx>
//#include <GEOMAlgo_Gluer.hxx>
#include <BlockFix_BlockFixAPI.hxx>
+#include <BlockFix_UnionFaces.hxx>
#include "utilities.h"
// Glue faces of the multi-block
aShape = GEOMImpl_GlueDriver::GlueFaces(aMulti, aTol, Standard_False);
+ } else if (aType == BLOCK_UNION_FACES) {
+ GEOMImpl_IBlockTrsf aCI (aFunction);
+ Handle(GEOM_Function) aRefShape = aCI.GetOriginal();
+ TopoDS_Shape aBlockOrComp = aRefShape->GetValue();
+ if (aBlockOrComp.IsNull()) {
+ Standard_NullObject::Raise("Null Shape given");
+ }
+
+ BlockFix_UnionFaces aFaceUnifier;
+
+ aFaceUnifier.GetOptimumNbFaces() = 0; // To force union faces.
+ aShape = aFaceUnifier.Perform(aBlockOrComp);
} else { // unknown function type
return 0;
}
theResult = aCompound;
}
-//=======================================================================
-//function : GEOMImpl_BlockDriver_Type_
-//purpose :
-//=======================================================================
-Standard_EXPORT Handle_Standard_Type& GEOMImpl_BlockDriver_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_BlockDriver",
- sizeof(GEOMImpl_BlockDriver),
- 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_BlockDriver) Handle(GEOMImpl_BlockDriver)::DownCast
- (const Handle(Standard_Transient)& AnObject)
+bool GEOMImpl_BlockDriver::
+GetCreationInformation(std::string& theOperationName,
+ std::vector<GEOM_Param>& theParams)
{
- Handle(GEOMImpl_BlockDriver) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_BlockDriver))) {
- _anOtherObject = Handle(GEOMImpl_BlockDriver)((Handle(GEOMImpl_BlockDriver)&)AnObject);
- }
+ if (Label().IsNull()) return 0;
+ Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
+
+ Standard_Integer aType = function->GetType();
+ GEOMImpl_IBlocks aCI1 (function);
+ GEOMImpl_IBlockTrsf aCI2 (function);
+ Handle(TColStd_HSequenceOfTransient) aShapes = aCI1.GetShapes();
+
+ switch ( aType ) {
+ case BLOCK_FACE_FOUR_EDGES:
+ theOperationName = "Q_FACE";
+ AddParam( theParams, "Edge 1", aShapes->Value(1) );
+ AddParam( theParams, "Edge 2", aShapes->Value(2) );
+ AddParam( theParams, "Edge 3", aShapes->Value(3) );
+ AddParam( theParams, "Edge 4", aShapes->Value(4) );
+ break;
+ case BLOCK_FACE_TWO_EDGES:
+ theOperationName = "Q_FACE";
+ AddParam( theParams, "Edge 1", aShapes->Value(1) );
+ AddParam( theParams, "Edge 2", aShapes->Value(2) );
+ break;
+ case BLOCK_FACE_FOUR_PNT:
+ theOperationName = "Q_FACE";
+ AddParam( theParams, "Point 1", aShapes->Value(1) );
+ AddParam( theParams, "Point 2", aShapes->Value(2) );
+ AddParam( theParams, "Point 3", aShapes->Value(3) );
+ AddParam( theParams, "Point 4", aShapes->Value(4) );
+ break;
+ case BLOCK_SIX_FACES:
+ theOperationName = "HEX_SOLID";
+ AddParam( theParams, "Face 1", aShapes->Value(1) );
+ AddParam( theParams, "Face 2", aShapes->Value(2) );
+ AddParam( theParams, "Face 3", aShapes->Value(3) );
+ AddParam( theParams, "Face 4", aShapes->Value(4) );
+ AddParam( theParams, "Face 5", aShapes->Value(5) );
+ AddParam( theParams, "Face 6", aShapes->Value(6) );
+ break;
+ case BLOCK_TWO_FACES:
+ theOperationName = "HEX_SOLID";
+ AddParam( theParams, "Face 1", aShapes->Value(1) );
+ AddParam( theParams, "Face 2", aShapes->Value(2) );
+ break;
+ case BLOCK_COMPOUND_GLUE:
+ theOperationName = "MakeBlockCompound";
+ AddParam( theParams, "Compound", aShapes->Value(1) );
+ break;
+ case BLOCK_REMOVE_EXTRA:
+ theOperationName = "REMOVE_EXTRA_EDGES";
+ AddParam( theParams, "Selected shape", aCI2.GetOriginal() );
+ AddParam( theParams, "Union faces", aCI2.GetOptimumNbFaces() == 0);
+ break;
+ case BLOCK_COMPOUND_IMPROVE:
+ theOperationName = "CHECK_COMPOUND";
+ AddParam( theParams, "Selected shape", aCI2.GetOriginal() );
+ break;
+ case BLOCK_MULTI_TRANSFORM_1D:
+ theOperationName = "MUL_TRANSFORM";
+ AddParam( theParams, "Main Object", aCI2.GetOriginal() );
+ AddParam( theParams, "Face 1", aCI2.GetFace1U() );
+ AddParam( theParams, "Face 2", aCI2.GetFace2U() );
+ AddParam( theParams, "Nb. Times", aCI2.GetNbIterU() );
+ break;
+ case BLOCK_MULTI_TRANSFORM_2D:
+ theOperationName = "MUL_TRANSFORM";
+ AddParam( theParams, "Main Object", aCI2.GetOriginal() );
+ AddParam( theParams, "Face 1 U", aCI2.GetFace1U() );
+ AddParam( theParams, "Face 2 U", aCI2.GetFace2U() );
+ AddParam( theParams, "Nb. Times V", aCI2.GetNbIterV() );
+ AddParam( theParams, "Face 1 V", aCI2.GetFace1V() );
+ AddParam( theParams, "Face 2 V", aCI2.GetFace2V() );
+ AddParam( theParams, "Nb. Times V", aCI2.GetNbIterV() );
+ break;
+ case BLOCK_UNION_FACES:
+ theOperationName = "UNION_FACES";
+ AddParam( theParams, "Selected shape", aCI2.GetOriginal() );
+ break;
+ default:
+ return false;
}
- return _anOtherObject;
+ return true;
}
+
+IMPLEMENT_STANDARD_HANDLE (GEOMImpl_BlockDriver,GEOM_BaseDriver);
+
+IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_BlockDriver,GEOM_BaseDriver);