mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-15 23:31:27 +05:00
bos #29484 Add a test service to build tesselation on a shape
This commit is contained in:
parent
736d34a14f
commit
84efe00706
@ -4890,7 +4890,25 @@ module GEOM
|
|||||||
long GetNbSubShapes(in GEOM_Object shape, in short fieldDim);
|
long GetNbSubShapes(in GEOM_Object shape, in short fieldDim);
|
||||||
};
|
};
|
||||||
|
|
||||||
// # GEOM_Gen:
|
// # GEOM_ITestOperations:
|
||||||
|
/*!
|
||||||
|
* \brief Interface for testing operations.
|
||||||
|
*/
|
||||||
|
interface GEOM_ITestOperations : GEOM_IOperations
|
||||||
|
{
|
||||||
|
/*!
|
||||||
|
* \brief Build a mesh on the given shape.
|
||||||
|
* \param shape is a source object
|
||||||
|
* \param linearDeflection is a linear deflection
|
||||||
|
* \param isRelative says if given value of deflection is relative to shape's bounding box
|
||||||
|
* \param angularDeflection is an angular deflection for edges in radians
|
||||||
|
* \return true in case of success; otherwise false.
|
||||||
|
*/
|
||||||
|
boolean Tesselate(in GEOM_Object shape, in double linearDeflection,
|
||||||
|
in boolean isRelative, in double angularDeflection);
|
||||||
|
};
|
||||||
|
|
||||||
|
// # GEOM_Gen:
|
||||||
/*!
|
/*!
|
||||||
* \brief Interface to access other GEOM interfaces.
|
* \brief Interface to access other GEOM interfaces.
|
||||||
*
|
*
|
||||||
@ -5016,6 +5034,7 @@ module GEOM
|
|||||||
GEOM_IBlocksOperations GetIBlocksOperations () raises (SALOME::SALOME_Exception);
|
GEOM_IBlocksOperations GetIBlocksOperations () raises (SALOME::SALOME_Exception);
|
||||||
GEOM_IGroupOperations GetIGroupOperations () raises (SALOME::SALOME_Exception);
|
GEOM_IGroupOperations GetIGroupOperations () raises (SALOME::SALOME_Exception);
|
||||||
GEOM_IFieldOperations GetIFieldOperations () raises (SALOME::SALOME_Exception);
|
GEOM_IFieldOperations GetIFieldOperations () raises (SALOME::SALOME_Exception);
|
||||||
|
GEOM_ITestOperations GetITestOperations () raises (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
GEOM_IOperations GetPluginOperations (in string theLibName) raises (SALOME::SALOME_Exception);
|
GEOM_IOperations GetPluginOperations (in string theLibName) raises (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ SET(GEOMImpl_HEADERS
|
|||||||
GEOMImpl_IGroupOperations.hxx
|
GEOMImpl_IGroupOperations.hxx
|
||||||
GEOMImpl_IFieldOperations.hxx
|
GEOMImpl_IFieldOperations.hxx
|
||||||
GEOMImpl_IBaseIEOperations.hxx
|
GEOMImpl_IBaseIEOperations.hxx
|
||||||
|
GEOMImpl_ITestOperations.hxx
|
||||||
GEOMImpl_IGlue.hxx
|
GEOMImpl_IGlue.hxx
|
||||||
GEOMImpl_PointDriver.hxx
|
GEOMImpl_PointDriver.hxx
|
||||||
GEOMImpl_IPoint.hxx
|
GEOMImpl_IPoint.hxx
|
||||||
@ -198,6 +199,7 @@ SET(GEOMImpl_SOURCES
|
|||||||
GEOMImpl_IGroupOperations.cxx
|
GEOMImpl_IGroupOperations.cxx
|
||||||
GEOMImpl_IFieldOperations.cxx
|
GEOMImpl_IFieldOperations.cxx
|
||||||
GEOMImpl_IBaseIEOperations.cxx
|
GEOMImpl_IBaseIEOperations.cxx
|
||||||
|
GEOMImpl_ITestOperations.cxx
|
||||||
GEOMImpl_IPolyline2D.cxx
|
GEOMImpl_IPolyline2D.cxx
|
||||||
GEOMImpl_ITransferData.cxx
|
GEOMImpl_ITransferData.cxx
|
||||||
GEOMImpl_Gen.cxx
|
GEOMImpl_Gen.cxx
|
||||||
|
@ -182,6 +182,7 @@ GEOMImpl_Gen::GEOMImpl_Gen()
|
|||||||
_MeasureOperations = new GEOMImpl_IMeasureOperations( this );
|
_MeasureOperations = new GEOMImpl_IMeasureOperations( this );
|
||||||
_GroupOperations = new GEOMImpl_IGroupOperations( this );
|
_GroupOperations = new GEOMImpl_IGroupOperations( this );
|
||||||
_FieldOperations = new GEOMImpl_IFieldOperations( this );
|
_FieldOperations = new GEOMImpl_IFieldOperations( this );
|
||||||
|
_TestOperations = new GEOMImpl_ITestOperations( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -338,3 +339,13 @@ GEOMImpl_IFieldOperations* GEOMImpl_Gen::GetIFieldOperations()
|
|||||||
{
|
{
|
||||||
return _FieldOperations;
|
return _FieldOperations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* GetITestOperations
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
GEOMImpl_ITestOperations* GEOMImpl_Gen::GetITestOperations()
|
||||||
|
{
|
||||||
|
return _TestOperations;
|
||||||
|
}
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include "GEOMImpl_IMeasureOperations.hxx"
|
#include "GEOMImpl_IMeasureOperations.hxx"
|
||||||
#include "GEOMImpl_IGroupOperations.hxx"
|
#include "GEOMImpl_IGroupOperations.hxx"
|
||||||
#include "GEOMImpl_IFieldOperations.hxx"
|
#include "GEOMImpl_IFieldOperations.hxx"
|
||||||
|
#include "GEOMImpl_ITestOperations.hxx"
|
||||||
#include "GEOM_Engine.hxx"
|
#include "GEOM_Engine.hxx"
|
||||||
|
|
||||||
class GEOMIMPL_EXPORT GEOMImpl_Gen : public GEOM_Engine
|
class GEOMIMPL_EXPORT GEOMImpl_Gen : public GEOM_Engine
|
||||||
@ -74,6 +75,8 @@ class GEOMIMPL_EXPORT GEOMImpl_Gen : public GEOM_Engine
|
|||||||
|
|
||||||
GEOMImpl_IFieldOperations* GetIFieldOperations();
|
GEOMImpl_IFieldOperations* GetIFieldOperations();
|
||||||
|
|
||||||
|
GEOMImpl_ITestOperations* GetITestOperations();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
GEOMImpl_IBasicOperations* _BasicOperations;
|
GEOMImpl_IBasicOperations* _BasicOperations;
|
||||||
@ -89,6 +92,7 @@ class GEOMIMPL_EXPORT GEOMImpl_Gen : public GEOM_Engine
|
|||||||
GEOMImpl_IMeasureOperations* _MeasureOperations;
|
GEOMImpl_IMeasureOperations* _MeasureOperations;
|
||||||
GEOMImpl_IGroupOperations* _GroupOperations;
|
GEOMImpl_IGroupOperations* _GroupOperations;
|
||||||
GEOMImpl_IFieldOperations* _FieldOperations;
|
GEOMImpl_IFieldOperations* _FieldOperations;
|
||||||
|
GEOMImpl_ITestOperations* _TestOperations;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
108
src/GEOMImpl/GEOMImpl_ITestOperations.cxx
Normal file
108
src/GEOMImpl/GEOMImpl_ITestOperations.cxx
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
// Copyright (C) 2007-2021 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, 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
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// 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 <GEOMImpl_ITestOperations.hxx>
|
||||||
|
|
||||||
|
#include <BRepBndLib.hxx>
|
||||||
|
#include <BRepBuilderAPI_Copy.hxx>
|
||||||
|
#include <BRepMesh_IncrementalMesh.hxx>
|
||||||
|
#include <BRepTools.hxx>
|
||||||
|
#include <Bnd_Box.hxx>
|
||||||
|
#include <utilities.h>
|
||||||
|
|
||||||
|
#ifndef MAX2
|
||||||
|
#define MAX2(X, Y) (Abs(X) > Abs(Y) ? Abs(X) : Abs(Y))
|
||||||
|
#endif
|
||||||
|
#ifndef MAX3
|
||||||
|
#define MAX3(X, Y, Z) (MAX2(MAX2(X, Y), Z))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* constructor:
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
GEOMImpl_ITestOperations::GEOMImpl_ITestOperations(GEOM_Engine* theEngine)
|
||||||
|
: GEOM_IOperations(theEngine)
|
||||||
|
{
|
||||||
|
MESSAGE("GEOMImpl_ITestOperations::GEOMImpl_ITestOperations");
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* destructor
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
GEOMImpl_ITestOperations::~GEOMImpl_ITestOperations()
|
||||||
|
{
|
||||||
|
MESSAGE("GEOMImpl_ITestOperations::~GEOMImpl_ITestOperations");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Build a mesh on (a copy of ) the given shape.
|
||||||
|
*
|
||||||
|
* This test function is aimed for checking performance of OCCT tesselation
|
||||||
|
* algorithm on particlar geometrical shapes.
|
||||||
|
*
|
||||||
|
* \param theShape is a source object
|
||||||
|
* \param theLinearDeflection is a value of deflection coefficient
|
||||||
|
* \param theIsRelative says if given value of deflection is relative to shape's bounding box
|
||||||
|
* \param theAngularDeflection is a angular deflection for edges in radians
|
||||||
|
* \return \c true in case of success; otherwise \c false.
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
bool GEOMImpl_ITestOperations::Tesselate(Handle(GEOM_Object) theShape,
|
||||||
|
double theLinearDeflection,
|
||||||
|
bool theIsRelative,
|
||||||
|
double theAngularDeflection)
|
||||||
|
{
|
||||||
|
// ATTENTION!
|
||||||
|
// We don't need results of this method to be present in the data tree;
|
||||||
|
// so we don't need a driver for it.
|
||||||
|
|
||||||
|
// reset error code
|
||||||
|
SetErrorCode(KO);
|
||||||
|
// create a copy of the source shape
|
||||||
|
TopoDS_Shape aShape = BRepBuilderAPI_Copy(theShape->GetValue()).Shape();
|
||||||
|
// use default deflection if necessary
|
||||||
|
if (theLinearDeflection <= 0)
|
||||||
|
theLinearDeflection = 0.001;
|
||||||
|
// compute absolute deflection if necessary: 0.001
|
||||||
|
if (theIsRelative) {
|
||||||
|
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
|
||||||
|
Bnd_Box bndBox;
|
||||||
|
BRepBndLib::Add(aShape, bndBox);
|
||||||
|
bndBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
||||||
|
theLinearDeflection = MAX3(aXmax-aXmin, aYmax-aYmin, aZmax-aZmin) * theLinearDeflection * 4;
|
||||||
|
}
|
||||||
|
// use default deviation angle if necessary: 20 degrees
|
||||||
|
if (theAngularDeflection <= 0)
|
||||||
|
theAngularDeflection = 20. * M_PI / 180.;
|
||||||
|
// compute triangulation
|
||||||
|
BRepTools::Clean(aShape);
|
||||||
|
BRepMesh_IncrementalMesh aMesh(aShape, theLinearDeflection, Standard_False, theAngularDeflection);
|
||||||
|
// set OK status and return
|
||||||
|
SetErrorCode(OK);
|
||||||
|
return true;
|
||||||
|
}
|
42
src/GEOMImpl/GEOMImpl_ITestOperations.hxx
Normal file
42
src/GEOMImpl/GEOMImpl_ITestOperations.hxx
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// Copyright (C) 2007-2021 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, 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
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef _GEOMImpl_ITestOperations_HXX_
|
||||||
|
#define _GEOMImpl_ITestOperations_HXX_
|
||||||
|
|
||||||
|
#include "Utils_SALOME_Exception.hxx"
|
||||||
|
#include "GEOM_IOperations.hxx"
|
||||||
|
#include "GEOM_Engine.hxx"
|
||||||
|
#include "GEOM_Object.hxx"
|
||||||
|
|
||||||
|
class GEOMImpl_ITestOperations : public GEOM_IOperations {
|
||||||
|
public:
|
||||||
|
Standard_EXPORT GEOMImpl_ITestOperations(GEOM_Engine* theEngine);
|
||||||
|
Standard_EXPORT ~GEOMImpl_ITestOperations();
|
||||||
|
|
||||||
|
Standard_EXPORT bool Tesselate(Handle(GEOM_Object) theShape,
|
||||||
|
double theLinearDeflection,
|
||||||
|
bool theIsRelative,
|
||||||
|
double theAngularDeflection);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _GEOMImpl_ITestOperations_HXX_
|
@ -77,6 +77,7 @@ SET(GEOMEngine_HEADERS
|
|||||||
GEOM_ITransformOperations_i.hh
|
GEOM_ITransformOperations_i.hh
|
||||||
GEOM_IMeasureOperations_i.hh
|
GEOM_IMeasureOperations_i.hh
|
||||||
GEOM_IGroupOperations_i.hh
|
GEOM_IGroupOperations_i.hh
|
||||||
|
GEOM_ITestOperations_i.hh
|
||||||
GEOM_Gen_i.hh
|
GEOM_Gen_i.hh
|
||||||
GEOM_Gen_Session_i.hh
|
GEOM_Gen_Session_i.hh
|
||||||
GEOM_Gen_No_Session_i.hh
|
GEOM_Gen_No_Session_i.hh
|
||||||
@ -104,6 +105,7 @@ SET(GEOMEngine_SOURCES
|
|||||||
GEOM_IMeasureOperations_i.cc
|
GEOM_IMeasureOperations_i.cc
|
||||||
GEOM_IGroupOperations_i.cc
|
GEOM_IGroupOperations_i.cc
|
||||||
GEOM_IFieldOperations_i.cc
|
GEOM_IFieldOperations_i.cc
|
||||||
|
GEOM_ITestOperations_i.cc
|
||||||
GEOM_Gen_i.cc
|
GEOM_Gen_i.cc
|
||||||
GEOM_Gen_Session_i.cc
|
GEOM_Gen_Session_i.cc
|
||||||
GEOM_Gen_No_Session_i.cc
|
GEOM_Gen_No_Session_i.cc
|
||||||
|
@ -2466,6 +2466,25 @@ GEOM::GEOM_IFieldOperations_ptr GEOM_Gen_i::GetIFieldOperations()
|
|||||||
return operations._retn();
|
return operations._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
// function : GetITestOperations
|
||||||
|
// purpose :
|
||||||
|
//============================================================================
|
||||||
|
GEOM::GEOM_ITestOperations_ptr GEOM_Gen_i::GetITestOperations()
|
||||||
|
{
|
||||||
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
|
MESSAGE( "GEOM_Gen_i::GetITestOperations" );
|
||||||
|
|
||||||
|
GEOM::GEOM_Gen_ptr engine = _this();
|
||||||
|
|
||||||
|
GEOM_ITestOperations_i* aServant =
|
||||||
|
new GEOM_ITestOperations_i(_poa, engine, _impl->GetITestOperations());
|
||||||
|
|
||||||
|
// activate the CORBA servant
|
||||||
|
GEOM::GEOM_ITestOperations_var operations = aServant->_this();
|
||||||
|
return operations._retn();
|
||||||
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
// function : GetPluginOperations
|
// function : GetPluginOperations
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#include "GEOM_IMeasureOperations_i.hh"
|
#include "GEOM_IMeasureOperations_i.hh"
|
||||||
#include "GEOM_IGroupOperations_i.hh"
|
#include "GEOM_IGroupOperations_i.hh"
|
||||||
#include "GEOM_IFieldOperations_i.hh"
|
#include "GEOM_IFieldOperations_i.hh"
|
||||||
|
#include "GEOM_ITestOperations_i.hh"
|
||||||
#include "GEOMUtils.hxx"
|
#include "GEOMUtils.hxx"
|
||||||
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
@ -254,6 +255,10 @@ class GEOM_I_EXPORT GEOM_Gen_i : public POA_GEOM::GEOM_Gen, public Engines_Compo
|
|||||||
virtual GEOM::GEOM_IFieldOperations_ptr GetIFieldOperations()
|
virtual GEOM::GEOM_IFieldOperations_ptr GetIFieldOperations()
|
||||||
;
|
;
|
||||||
|
|
||||||
|
//Returns a pointer to TestOperations interface
|
||||||
|
virtual GEOM::GEOM_ITestOperations_ptr GetITestOperations()
|
||||||
|
;
|
||||||
|
|
||||||
//Returns a pointer to corresponding plugin operations interface
|
//Returns a pointer to corresponding plugin operations interface
|
||||||
virtual GEOM::GEOM_IOperations_ptr GetPluginOperations (const char* theLibName)
|
virtual GEOM::GEOM_IOperations_ptr GetPluginOperations (const char* theLibName)
|
||||||
;
|
;
|
||||||
|
75
src/GEOM_I/GEOM_ITestOperations_i.cc
Normal file
75
src/GEOM_I/GEOM_ITestOperations_i.cc
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
// Copyright (C) 2007-2021 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, 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
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// 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 "GEOM_ITestOperations_i.hh"
|
||||||
|
|
||||||
|
#include "utilities.h"
|
||||||
|
#include "OpUtil.hxx"
|
||||||
|
#include "Utils_ExceptHandlers.hxx"
|
||||||
|
|
||||||
|
#include "GEOM_Engine.hxx"
|
||||||
|
#include "GEOM_Object.hxx"
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* constructor:
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
GEOM_ITestOperations_i::GEOM_ITestOperations_i (PortableServer::POA_ptr thePOA,
|
||||||
|
GEOM::GEOM_Gen_ptr theEngine,
|
||||||
|
::GEOMImpl_ITestOperations* theImpl)
|
||||||
|
:GEOM_IOperations_i(thePOA, theEngine, theImpl)
|
||||||
|
{
|
||||||
|
MESSAGE("GEOM_ITestOperations_i::GEOM_ITestOperations_i");
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* destructor
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
GEOM_ITestOperations_i::~GEOM_ITestOperations_i()
|
||||||
|
{
|
||||||
|
MESSAGE("GEOM_ITestOperations_i::~GEOM_ITestOperations_i");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* Tesselate
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
CORBA::Boolean GEOM_ITestOperations_i::Tesselate(GEOM::GEOM_Object_ptr theShape,
|
||||||
|
CORBA::Double theLinearDeflection,
|
||||||
|
CORBA::Boolean theIsRelative,
|
||||||
|
CORBA::Double theAngularDeflection)
|
||||||
|
{
|
||||||
|
// Set a not done flag
|
||||||
|
GetOperations()->SetNotDone();
|
||||||
|
|
||||||
|
// Get the source object
|
||||||
|
Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
|
||||||
|
if (aShape.IsNull()) return false;
|
||||||
|
|
||||||
|
// Tesselate
|
||||||
|
return GetOperations()->Tesselate(aShape, theLinearDeflection, theIsRelative, theAngularDeflection);
|
||||||
|
}
|
54
src/GEOM_I/GEOM_ITestOperations_i.hh
Normal file
54
src/GEOM_I/GEOM_ITestOperations_i.hh
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
// Copyright (C) 2007-2021 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, 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
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef _GEOM_ITestOperations_i_HeaderFile
|
||||||
|
#define _GEOM_ITestOperations_i_HeaderFile
|
||||||
|
|
||||||
|
#include "GEOMImpl_Gen.hxx"
|
||||||
|
|
||||||
|
#include <SALOMEconfig.h>
|
||||||
|
|
||||||
|
#include CORBA_SERVER_HEADER(GEOM_Gen)
|
||||||
|
#include "GEOM_IOperations_i.hh"
|
||||||
|
#include "GEOM_Object_i.hh"
|
||||||
|
|
||||||
|
#include "GEOMImpl_ITestOperations.hxx"
|
||||||
|
|
||||||
|
class GEOM_I_EXPORT GEOM_ITestOperations_i :
|
||||||
|
public virtual POA_GEOM::GEOM_ITestOperations,
|
||||||
|
public virtual GEOM_IOperations_i
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GEOM_ITestOperations_i(PortableServer::POA_ptr thePOA,
|
||||||
|
GEOM::GEOM_Gen_ptr theEngine,
|
||||||
|
::GEOMImpl_ITestOperations* theImpl);
|
||||||
|
~GEOM_ITestOperations_i();
|
||||||
|
|
||||||
|
CORBA::Boolean Tesselate(GEOM::GEOM_Object_ptr theShape,
|
||||||
|
CORBA::Double theLinearDeflection,
|
||||||
|
CORBA::Boolean theIsRelative,
|
||||||
|
CORBA::Double theAngularDeflection);
|
||||||
|
|
||||||
|
::GEOMImpl_ITestOperations* GetOperations() { return (::GEOMImpl_ITestOperations*)GetImpl(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _GEOM_ITestOperations_i_HeaderFile
|
@ -237,6 +237,7 @@
|
|||||||
## @}
|
## @}
|
||||||
## @defgroup l2_measure Using measurement tools
|
## @defgroup l2_measure Using measurement tools
|
||||||
## @defgroup l2_field Field on Geometry
|
## @defgroup l2_field Field on Geometry
|
||||||
|
## @defgroup l2_testing Testing
|
||||||
|
|
||||||
## @}
|
## @}
|
||||||
|
|
||||||
@ -745,6 +746,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
|
|||||||
self.BlocksOp = None
|
self.BlocksOp = None
|
||||||
self.GroupOp = None
|
self.GroupOp = None
|
||||||
self.FieldOp = None
|
self.FieldOp = None
|
||||||
|
self.TestOp = None
|
||||||
pass
|
pass
|
||||||
|
|
||||||
## Process object publication in the study, as follows:
|
## Process object publication in the study, as follows:
|
||||||
@ -852,6 +854,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
|
|||||||
self.BlocksOp = self.GetIBlocksOperations ()
|
self.BlocksOp = self.GetIBlocksOperations ()
|
||||||
self.GroupOp = self.GetIGroupOperations ()
|
self.GroupOp = self.GetIGroupOperations ()
|
||||||
self.FieldOp = self.GetIFieldOperations ()
|
self.FieldOp = self.GetIFieldOperations ()
|
||||||
|
self.TestOp = self.GetITestOperations ()
|
||||||
|
|
||||||
notebook.myStudy = self.myStudy
|
notebook.myStudy = self.myStudy
|
||||||
pass
|
pass
|
||||||
@ -13898,6 +13901,37 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
|
|||||||
# end of l2_field
|
# end of l2_field
|
||||||
## @}
|
## @}
|
||||||
|
|
||||||
|
## @addtogroup l2_testing
|
||||||
|
## @{
|
||||||
|
|
||||||
|
## Build a mesh on the given shape.
|
||||||
|
# @param shape the source shape
|
||||||
|
# @param linear_deflection linear deflection coefficient
|
||||||
|
# @param is_relative says if given value of deflection is relative to shape's bounding box
|
||||||
|
# @param angular_deflection angular deflection for edges in degrees
|
||||||
|
# @return True in case of success; otherwise False.
|
||||||
|
@ManageTransactions("TestOp")
|
||||||
|
def Tesselate(self, shape, linear_deflection=0, is_relative=True, angular_deflection=0):
|
||||||
|
"""Build a mesh on the given shape.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
shape the source shape
|
||||||
|
linear_deflection linear deflection coefficient
|
||||||
|
is_relative says if given value of deflection is relative to shape's bounding box
|
||||||
|
angular_deflection angular deflection for edges in degrees
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
True in case of success; otherwise False.
|
||||||
|
"""
|
||||||
|
if angular_deflection > 0:
|
||||||
|
angular_deflection = angular_deflection * math.pi / 180.
|
||||||
|
r = self.TestOp.Tesselate(shape, linear_deflection, is_relative, angular_deflection)
|
||||||
|
RaiseIfFailed("Tesselate", self.TestOp)
|
||||||
|
return r
|
||||||
|
|
||||||
|
# end of l2_testing
|
||||||
|
## @}
|
||||||
|
|
||||||
|
|
||||||
# Register the new proxy for GEOM_Gen
|
# Register the new proxy for GEOM_Gen
|
||||||
omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geomBuilder)
|
omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geomBuilder)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user