mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-06 07:34:18 +05:00
+ string GetSubName(in long subID);
This commit is contained in:
parent
c85f63b521
commit
bbfb027225
@ -390,6 +390,17 @@ module GEOM
|
|||||||
*/
|
*/
|
||||||
shape_type GetMaxShapeType();
|
shape_type GetMaxShapeType();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Returns a name of a sub-shape if the sub-shape is published in the study
|
||||||
|
* \param subID - sub-shape ID
|
||||||
|
* \return string - the found name or an empty string if the sub-shape does not
|
||||||
|
* exits or is not published
|
||||||
|
*
|
||||||
|
* \note Only sub-shapes directly retirieved (using e.g. ExtractSubShapes() or
|
||||||
|
* via group creation) can be found.
|
||||||
|
*/
|
||||||
|
string GetSubName(in long subID);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set color of the object.
|
* \brief Set color of the object.
|
||||||
*
|
*
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <TCollection_AsciiString.hxx>
|
#include <TCollection_AsciiString.hxx>
|
||||||
#include <TDF_Label.hxx>
|
#include <TDF_Label.hxx>
|
||||||
#include <TDF_Tool.hxx>
|
#include <TDF_Tool.hxx>
|
||||||
|
#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
|
||||||
#include <TopAbs.hxx>
|
#include <TopAbs.hxx>
|
||||||
#include <TopoDS_Iterator.hxx>
|
#include <TopoDS_Iterator.hxx>
|
||||||
|
|
||||||
@ -158,6 +159,47 @@ GEOM::shape_type GEOM_Object_i::GetMaxShapeType()
|
|||||||
return getMinMaxShapeType( _impl->GetValue(), false );
|
return getMinMaxShapeType( _impl->GetValue(), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* GetSubName
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
char* GEOM_Object_i::GetSubName(CORBA::Long subID)
|
||||||
|
{
|
||||||
|
CORBA::String_var name("");
|
||||||
|
|
||||||
|
Handle(GEOM_Function) aMainFun = _impl->GetLastFunction();
|
||||||
|
if ( aMainFun.IsNull() ) return name._retn();
|
||||||
|
|
||||||
|
const TDataStd_ListOfExtendedString& aListEntries = aMainFun->GetSubShapeReferences();
|
||||||
|
TDataStd_ListIteratorOfListOfExtendedString anIt( aListEntries );
|
||||||
|
for (; anIt.More(); anIt.Next())
|
||||||
|
{
|
||||||
|
TCollection_AsciiString anEntry = anIt.Value();
|
||||||
|
Handle(GEOM_BaseObject) anObj =
|
||||||
|
GEOM_Engine::GetEngine()->GetObject( _impl->GetDocID(), anEntry.ToCString(), false );
|
||||||
|
if ( anObj.IsNull() ) continue;
|
||||||
|
|
||||||
|
TCollection_AsciiString aSubName = anObj->GetName();
|
||||||
|
if ( aSubName.IsEmpty() ) continue;
|
||||||
|
|
||||||
|
Handle(GEOM_Function) aFun = anObj->GetLastFunction();
|
||||||
|
if ( aFun.IsNull() ) continue;
|
||||||
|
|
||||||
|
GEOM_ISubShape ISS( aFun );
|
||||||
|
Handle(TColStd_HArray1OfInteger) subIDs = ISS.GetIndices();
|
||||||
|
if ( subIDs.IsNull() || subIDs->Length() != 1 ) continue;
|
||||||
|
|
||||||
|
if ( subIDs->Value( subIDs->Lower() ) == subID )
|
||||||
|
{
|
||||||
|
name = aSubName.ToCString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return name._retn();
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* SetColor
|
* SetColor
|
||||||
|
@ -47,6 +47,8 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public
|
|||||||
|
|
||||||
virtual GEOM::shape_type GetMaxShapeType();
|
virtual GEOM::shape_type GetMaxShapeType();
|
||||||
|
|
||||||
|
virtual char* GetSubName(CORBA::Long subID);
|
||||||
|
|
||||||
virtual void SetColor(const SALOMEDS::Color& theColor);
|
virtual void SetColor(const SALOMEDS::Color& theColor);
|
||||||
|
|
||||||
virtual SALOMEDS::Color GetColor();
|
virtual SALOMEDS::Color GetColor();
|
||||||
|
Loading…
Reference in New Issue
Block a user