Salome HOME
Porting to Qt4.
[modules/geom.git] / src / GEOMGUI / GeometryGUI_Swig.cxx
index 4f563eb131f178fdddefd48b55304b0b339b4205..4635b10a33637ae38b2a30aa732b5f22705b960b 100644 (file)
 //  $Header$
 
 #include "GeometryGUI_Swig.hxx"
-#include "SALOMEGUI_Swig.hxx"
 
 #include "GeometryGUI.h"
 
+#include "SUIT_Desktop.h"
 #include "SUIT_Session.h"
 #include "SalomeApp_Application.h"
 #include "SalomeApp_Study.h"
-#include "SalomeApp_ImportOperation.h"
+//#include "SalomeApp_ImportOperation.h"
 
-#include "OB_Browser.h"
+// temporary commented
+//#include "OB_Browser.h"
 
 #include "OCCViewer_ViewWindow.h"
 #include "OCCViewer_ViewManager.h"
 #include "GEOM_Actor.h"
 #include "GEOM_Client.hxx"
 #include "GEOM_AISShape.hxx"
-#include "GEOM_AssemblyBuilder.h"
+//#include "GEOM_AssemblyBuilder.h"
 #include "GEOM_InteractiveObject.hxx"
 #include "GEOM_Displayer.h"
 
 #include "SALOME_Event.hxx"
 
-#include "utilities.h"
-
-#include "SALOMEDSClient.hxx"
+//#include "utilities.h"
 
 // OCCT Includes
 #include <TopAbs.hxx>
@@ -66,6 +65,7 @@
 #include <AIS_ListOfInteractive.hxx>
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
 #include <AIS_Drawer.hxx>
+#include <BRepTools.hxx>
 
 // IDL Headers
 #include <SALOMEconfig.h>
@@ -145,7 +145,8 @@ void GEOM_Swig::createAndDisplayGO (const char* Entry, bool isUpdated)
       if (!father)
         return;
       if (!father->ComponentIOR(aFatherIOR)) {
-        aStudyBuilder->LoadWith(father, SalomeApp_Application::orb()->object_to_string(Geom));
+        CORBA::String_var objStr = SalomeApp_Application::orb()->object_to_string(Geom);
+        aStudyBuilder->LoadWith(father, objStr.in());
         father->ComponentIOR(aFatherIOR);
       }
 
@@ -269,6 +270,25 @@ void GEOM_Swig::createAndDisplayFitAllGO (const char* Entry)
   ProcessVoidEvent(new TEventFitAll());
 }
 
+void GEOM_Swig::UpdateViewer()
+{
+  class TEventUpdateViewer: public SALOME_Event
+  {
+    public:
+      TEventUpdateViewer() {}
+      virtual void Execute() {
+       SUIT_Application* app = SUIT_Session::session()->activeApplication();
+       if (!app) return;
+       SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
+       if (!ActiveStudy) return;
+       
+       GEOM_Displayer(ActiveStudy).UpdateViewer();
+      }
+  };
+  
+  ProcessVoidEvent(new TEventUpdateViewer());
+}
+
 int GEOM_Swig::getIndexTopology(const char* SubIOR, const char* IOR)
 {
   GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
@@ -420,7 +440,7 @@ void GEOM_Swig::setColor(const char* theEntry, int red, int green, int blue, boo
            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);
+           ic->Redisplay(ite.Value(), true, true);
            if (myUpdateViewer)
              occViewer->update();
            break;
@@ -594,13 +614,13 @@ void GEOM_Swig::setDeflection(const char* theEntry, float theDeflect)
          if ((!aObj.IsNull()) && aObj->hasEntry() && aObj->isSame(anIO)) {
            Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(it.Value());
            if (!aShape.IsNull()) {
-             Handle(AIS_Drawer) aDrawer = aShape->Attributes();
-             if (aDrawer.IsNull())
-               aDrawer = new AIS_Drawer();
-             aDrawer->SetDeviationCoefficient(myParam);
-             aShape->SetAttributes(aDrawer);
-             aContext->Redisplay(aShape, true, true);
-             aContext->UpdateCurrentViewer();
+             TopoDS_Shape aSh = aShape->Shape();
+             if (!aSh.IsNull())
+               BRepTools::Clean(aSh);
+
+             aShape->SetOwnDeviationCoefficient( myParam );
+             aShape->SetOwnHLRDeviationAngle( 1.57 );
+             aContext->Redisplay(aShape);
              return;
            }
          }