mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-10 23:33:07 +05:00
0020744: EDF 1272 GEOM : Get(Real?)type of an object
This commit is contained in:
parent
f2f21ff294
commit
b26abc1ab5
@ -167,6 +167,15 @@ module GEOM
|
|||||||
*/
|
*/
|
||||||
shape_type GetShapeType();
|
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.
|
* Set name of the object.
|
||||||
* \param theName is a name which will be associated with this object.
|
* \param theName is a name which will be associated with this object.
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include <BRepTools_ShapeSet.hxx>
|
#include <BRepTools_ShapeSet.hxx>
|
||||||
#include <BRepTools.hxx>
|
#include <BRepTools.hxx>
|
||||||
#include <TopAbs.hxx>
|
#include <TopAbs.hxx>
|
||||||
|
#include <TopoDS_Iterator.hxx>
|
||||||
|
|
||||||
#ifdef WNT
|
#ifdef WNT
|
||||||
#pragma warning( disable:4786 )
|
#pragma warning( disable:4786 )
|
||||||
@ -116,6 +117,30 @@ GEOM::shape_type GEOM_Object_i::GetShapeType()
|
|||||||
return (GEOM::shape_type)_geom.ShapeType();
|
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
|
* 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 GetShapeType();
|
||||||
|
|
||||||
|
virtual GEOM::shape_type GetTopologyType();
|
||||||
|
|
||||||
virtual void SetName(const char* theName);
|
virtual void SetName(const char* theName);
|
||||||
|
|
||||||
virtual char* GetName();
|
virtual char* GetName();
|
||||||
|
Loading…
Reference in New Issue
Block a user