#include "SALOMEDSClient.hxx"
// OCCT Includes
-//#include <TopExp_Explorer.hxx>
-//#include <TopTools_MapOfShape.hxx>
-//#include <TopTools_ListOfShape.hxx>
-//#include <TopTools_ListIteratorOfListOfShape.hxx>
-//#include <GeomAbs_CurveType.hxx>
-//#include <GeomAbs_SurfaceType.hxx>
-//#include <TopoDS.hxx>
#include <TopAbs.hxx>
#include <TopoDS_Shape.hxx>
-//#include <TopoDS_Edge.hxx>
-//#include <TopoDS_Face.hxx>
-//#include <TopoDS_Iterator.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
-//#include <V3d_Viewer.hxx>
// IDL Headers
#include <SALOMEconfig.h>
const char* GEOM_Swig::getShapeTypeIcon(const char* IOR)
{
- GEOM::GEOM_Gen_var Geom = GeometryGUI::GetGeomGen();
+ GEOM::GEOM_Gen_var Geom = GeometryGUI::GetGeomGen();
if ( CORBA::is_nil( Geom ) )
return "None";
void GEOM_Swig::setDisplayMode(const char* theEntry, int theMode)
{
- SUIT_Application* app = SUIT_Session::session()->activeApplication();
- if ( !app ) return;
-
- Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry, "GEOM", "");
-
- class TEvent: public SALOME_Event{
- SUIT_Application* myApp;
- Handle(SALOME_InteractiveObject) myIO;
- int myParam;
+ class TEvent: public SALOME_Event {
+ std::string myEntry;
+ int myMode;
public:
- TEvent(SUIT_Application* theApp, const Handle(SALOME_InteractiveObject)& theIO, int theParam):
- myApp(theApp), myIO(theIO), myParam(theParam)
+ TEvent(const char* theEntryArg, int theModeArg):
+ myEntry(theEntryArg), myMode(theModeArg)
{}
- virtual void Execute(){
- if(SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(myApp)){
+ virtual void Execute() {
+ SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
+ if (!anApp) return;
+
+ Handle(SALOME_InteractiveObject) anIO =
+ new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
+
+ if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
SVTK_View* aView = aViewWindow->getView();
- aView->SetDisplayMode(myIO,myParam);
+ aView->SetDisplayMode(anIO, myMode);
aView->Repaint();
}
- else if(OCCViewer_Viewer* occViewer = GetOCCViewer(myApp)) {
- SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>( occViewer );
+ else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
+ SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
if (soccViewer)
- soccViewer->switchRepresentation(myIO,myParam);
+ soccViewer->switchRepresentation(anIO, myMode);
}
}
};
- ProcessVoidEvent(new TEvent(app,anIO,theMode));
+ ProcessVoidEvent(new TEvent (theEntry, theMode));
}
void GEOM_Swig::setColor(const char* theEntry, int red, int green, int blue)
{
- SUIT_Application* app = SUIT_Session::session()->activeApplication();
- if ( !app ) return;
-
- Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry, "GEOM", "");
-
- QColor aColor(red,green,blue);
-
- class TEvent: public SALOME_Event{
- SUIT_Application* myApp;
- Handle(SALOME_InteractiveObject) myIO;
- QColor myParam;
+ class TEvent: public SALOME_Event {
+ std::string myEntry;
+ int myRed;
+ int myGreen;
+ int myBlue;
public:
- TEvent(SUIT_Application* theApp, const Handle(SALOME_InteractiveObject)& theIO, const QColor& theParam):
- myApp(theApp), myIO(theIO), myParam(theParam)
+ TEvent(const char* theEntryArg, int theR, int theG, int theB):
+ myEntry(theEntryArg), myRed(theR), myGreen(theG), myBlue(theB)
{}
- virtual void Execute(){
- if(SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(myApp)){
+ virtual void Execute() {
+ SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
+ if (!anApp) return;
+
+ Handle(SALOME_InteractiveObject) anIO =
+ new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
+
+ if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)){
SVTK_View* aView = aViewWindow->getView();
- aView->SetColor(myIO,myParam);
+ QColor aColor (myRed, myGreen, myBlue);
+ aView->SetColor(anIO, aColor);
aView->Repaint();
- }else if(OCCViewer_Viewer* occViewer = GetOCCViewer(myApp)){
+ } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
AIS_ListOfInteractive List;
ic->DisplayedObjects(List);
- AIS_ListIteratorOfListOfInteractive ite(List);
- for ( ; ite.More(); ite.Next() ) {
+ AIS_ListIteratorOfListOfInteractive ite (List);
+ for (; ite.More(); ite.Next()) {
Handle(SALOME_InteractiveObject) anObj =
- Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
- if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( myIO ) ) {
- Quantity_Color CSFColor = Quantity_Color ( myParam.red() / 255.,
- myParam.green() / 255.,
- myParam.blue() / 255.,
- Quantity_TOC_RGB );
- ite.Value()->SetColor( CSFColor );
- if ( ite.Value()->IsKind( STANDARD_TYPE(GEOM_AISShape) ) )
- Handle(GEOM_AISShape)::DownCast( ite.Value() )->SetShadingColor( CSFColor );
- ite.Value()->Redisplay( Standard_True );
+ Handle(SALOME_InteractiveObject)::DownCast(ite.Value()->GetOwner());
+ if (!anObj.IsNull() && anObj->hasEntry() && anObj->isSame(anIO)) {
+ Quantity_Color CSFColor =
+ Quantity_Color(myRed/255., myGreen/255., myBlue/255., Quantity_TOC_RGB);
+ ite.Value()->SetColor(CSFColor);
+ if (ite.Value()->IsKind(STANDARD_TYPE(GEOM_AISShape)))
+ Handle(GEOM_AISShape)::DownCast(ite.Value())->SetShadingColor(CSFColor);
+ ite.Value()->Redisplay(Standard_True);
occViewer->update();
break;
}
}
}
};
- ProcessVoidEvent(new TEvent(app,anIO,aColor));
+ ProcessVoidEvent(new TEvent(theEntry, red, green, blue));
}
void GEOM_Swig::setTransparency(const char* theEntry, float transp)
{
- SUIT_Application* app = SUIT_Session::session()->activeApplication();
- if ( !app ) return;
-
- Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry, "GEOM", "");
-
- class TEvent: public SALOME_Event{
- SUIT_Application* myApp;
- Handle(SALOME_InteractiveObject) myIO;
+ class TEvent: public SALOME_Event {
+ std::string myEntry;
float myParam;
public:
- TEvent(SUIT_Application* theApp, const Handle(SALOME_InteractiveObject)& theIO, float theParam):
- myApp(theApp), myIO(theIO), myParam(theParam)
+ TEvent(const char* theEntryArg, float theParam):
+ myEntry(theEntryArg), myParam(theParam)
{}
- virtual void Execute(){
- if(SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(myApp)){
+ virtual void Execute() {
+ SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
+ if (!anApp) return;
+
+ Handle(SALOME_InteractiveObject) anIO =
+ new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
+
+ if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
SVTK_View* aView = aViewWindow->getView();
- aView->SetTransparency(myIO,myParam);
+ aView->SetTransparency(anIO, myParam);
aView->Repaint();
- }else if(OCCViewer_Viewer* occViewer = GetOCCViewer(myApp)) {
- SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>( occViewer );
+ } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
+ SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
if (soccViewer)
- soccViewer->setTransparency(myIO,myParam);
+ soccViewer->setTransparency(anIO, myParam);
}
}
};
- ProcessVoidEvent(new TEvent(app,anIO,transp));
+ ProcessVoidEvent(new TEvent (theEntry, transp));
}
+class TInitGeomGenEvent: public SALOME_Event {
+public:
+ typedef bool TResult;
+ TResult myResult;
+ TInitGeomGenEvent() : myResult(false) {}
+ virtual void Execute() {
+ myResult = GeometryGUI::InitGeomGen();
+ }
+};
bool GEOM_Swig::initGeomGen()
{
- return GeometryGUI::InitGeomGen();
+ return ProcessEvent(new TInitGeomGenEvent());
}