mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-25 17:00:35 +05:00
[bos #43299][FORUM] geom.GetColor() does not give the good result. Fixed set color for geom object.
This commit is contained in:
parent
55b640ee17
commit
c4da8107c8
@ -488,6 +488,32 @@ void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& IObjects,
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : GetObjectFromEntry()
|
||||
// purpose : Get the GEOM_Object from the study entry.
|
||||
//=======================================================================
|
||||
GEOM::GEOM_Object_ptr GEOMBase::GetObjectFromEntry(const char* entry)
|
||||
{
|
||||
GEOM::GEOM_Object_var object;
|
||||
|
||||
if (entry)
|
||||
{
|
||||
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(SUIT_Session::session()->activeApplication()->activeStudy());
|
||||
if (study)
|
||||
{
|
||||
_PTR(Study) studyDS = study->studyDS();
|
||||
_PTR(SObject) obj = studyDS->FindObjectID(entry);
|
||||
if (GeometryGUI::IsInGeomComponent(obj))
|
||||
{
|
||||
CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(obj);
|
||||
object = GEOM::GEOM_Object::_narrow(corbaObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return object._retn();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : CreateArrowForLinearEdge()
|
||||
// purpose : Create a cone topology to be used to display an arrow in the middle
|
||||
|
@ -95,6 +95,8 @@ public :
|
||||
|
||||
static QString GetIORFromObject( GEOM::GEOM_Object_ptr object );
|
||||
|
||||
static GEOM::GEOM_Object_ptr GetObjectFromEntry(const char* entry);
|
||||
|
||||
/* Geometry */
|
||||
static bool VertexToPoint( const TopoDS_Shape& shape, gp_Pnt& point );
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "GEOM_Swig_LocalSelector.h"
|
||||
#include "GEOMGUI_OCCSelector.h"
|
||||
#include "OCCViewer_ViewManager.h"
|
||||
#include "GEOMBase.h"
|
||||
|
||||
#include <SUIT_Desktop.h>
|
||||
#include <SUIT_Session.h>
|
||||
@ -430,6 +431,19 @@ void GEOM_Swig::setNameMode( const char* theEntry, bool theOn, bool theUpdateVie
|
||||
*/
|
||||
void GEOM_Swig::setColor( const char* theEntry, int theRed, int theGreen, int theBlue, bool theUpdateViewer )
|
||||
{
|
||||
// Update geom object color
|
||||
GEOM::GEOM_Object_var GeomObject = GEOMBase::GetObjectFromEntry(theEntry);
|
||||
if (!CORBA::is_nil(GeomObject))
|
||||
{
|
||||
SALOMEDS::Color aSColor;
|
||||
aSColor.R = theRed / 255.0;
|
||||
aSColor.G = theGreen / 255.0;
|
||||
aSColor.B = theBlue / 255.0;
|
||||
|
||||
GeomObject->SetColor(aSColor);
|
||||
}
|
||||
|
||||
// Update a color property stored in LightApp_Study view manager map
|
||||
ProcessVoidEvent( new TSetPropertyEvent( theEntry, GEOM::propertyName( GEOM::Color ),
|
||||
QColor( theRed, theGreen, theBlue ), theUpdateViewer ) );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user