}
}
+//=======================================================================
+// 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
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 );
#include "GEOM_Swig_LocalSelector.h"
#include "GEOMGUI_OCCSelector.h"
#include "OCCViewer_ViewManager.h"
+#include "GEOMBase.h"
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
*/
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 ) );
}