mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-05 05:34:17 +05:00
0020744: EDF 1272 GEOM : Get(Real?)type of an object
This commit is contained in:
parent
f2f21ff294
commit
b26abc1ab5
@ -166,6 +166,15 @@ module GEOM
|
||||
* Get a <VAR>shape_type</VAR> of the object value.
|
||||
*/
|
||||
shape_type GetShapeType();
|
||||
|
||||
/*!
|
||||
* Get the topology type of the object value.
|
||||
* In contrast to the shape type, this function returns type of the most
|
||||
* top-level sub-shape of the COMPOUND or COMPSOLID, if there is only one
|
||||
* sub-shape there.
|
||||
* \sa GetShapeType()
|
||||
*/
|
||||
shape_type GetTopologyType();
|
||||
|
||||
/*!
|
||||
* Set name of the object.
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <BRepTools_ShapeSet.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <TopAbs.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
|
||||
#ifdef WNT
|
||||
#pragma warning( disable:4786 )
|
||||
@ -116,6 +117,30 @@ GEOM::shape_type GEOM_Object_i::GetShapeType()
|
||||
return (GEOM::shape_type)_geom.ShapeType();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetTopologyType
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::shape_type GEOM_Object_i::GetTopologyType()
|
||||
{
|
||||
TopoDS_Shape shape = _impl->GetValue();
|
||||
if(shape.IsNull()) return GEOM::SHAPE;
|
||||
|
||||
if ( shape.ShapeType() == TopAbs_COMPOUND || shape.ShapeType() == TopAbs_COMPSOLID ) {
|
||||
TopoDS_Shape shape_i;
|
||||
TopoDS_Iterator It (shape, Standard_True, Standard_False);
|
||||
for (; It.More(); It.Next()) {
|
||||
if ( !shape_i.IsNull() ) return (GEOM::shape_type)shape.ShapeType();
|
||||
shape_i = It.Value();
|
||||
}
|
||||
if ( !shape_i.IsNull() )
|
||||
return (GEOM::shape_type) shape_i.ShapeType();
|
||||
}
|
||||
|
||||
return (GEOM::shape_type)shape.ShapeType();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SetName
|
||||
|
@ -51,6 +51,8 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public
|
||||
|
||||
virtual GEOM::shape_type GetShapeType();
|
||||
|
||||
virtual GEOM::shape_type GetTopologyType();
|
||||
|
||||
virtual void SetName(const char* theName);
|
||||
|
||||
virtual char* GetName();
|
||||
|
Loading…
Reference in New Issue
Block a user