Salome HOME
Modify creation of curves: 1) using QDockWidget instead of QDialog; 2) selection...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_PolylineOp.cxx
index 52c1509b4a3b757a3eb72cde43d92be385a4464a..2e3ad922dd59aa4fa5499485f1ca2010a5dfe494 100755 (executable)
@@ -39,6 +39,7 @@
 
 #include <OCCViewer_ViewManager.h>
 #include <OCCViewer_ViewModel.h>
+#include <OCCViewer_ViewWindow.h>
 
 #include <OCCViewer_AISSelector.h>
 
@@ -106,7 +107,7 @@ bool HYDROGUI_PolylineOp::processApply( int& theUpdateFlags,
   aPolylineObj->setPolylineData(aPolylineData);
 
   theUpdateFlags = UF_Model;
-  aPolylineObj->SetVisible( HYDROGUI_Tool::GetActiveGraphicsViewId( module() ), true );
+  module()->setObjectVisible( HYDROGUI_Tool::GetActiveGraphicsViewId( module() ), aPolylineObj, true );
   return true;
 }
 
@@ -120,13 +121,16 @@ void HYDROGUI_PolylineOp::onCreatePreview()
     dynamic_cast<OCCViewer_ViewManager*>( anApp->createViewManager( OCCViewer_Viewer::Type() ) );
   if( myPreviewViewManager )
   {
-    anApp->selectionMgr()->setEnabled(false);
-    myPreviewViewManager->setTitle( tr( "CREATE_CURVE" ) );
+    //anApp->selectionMgr()->setEnabled(false); // what the hell?!
+    myPreviewViewManager->setTitle( tr( "CREATE_POLYLINE" ) );
     OCCViewer_Viewer* aViewer = myPreviewViewManager->getOCCViewer();
     aViewer->enableSelection(true);
     aViewer->enableMultiselection(true);
     Handle_AIS_InteractiveContext aCtx = aViewer->getAISContext();
 
+    OCCViewer_ViewWindow* vw = (OCCViewer_ViewWindow*)myPreviewViewManager->getActiveView();
+    vw->onTopView();
+
     myAISCurve = new HYDROGUI_AISCurve(myCurve, aCtx);
 
     myAISCurve->Display();
@@ -171,9 +175,9 @@ void HYDROGUI_PolylineOp::startOperation()
 
   }
   else{
-    myCurve = new CurveCreator_Curve(CurveCreator::Dim3d);
+    myCurve = new CurveCreator_Curve(CurveCreator::Dim2d);
     aPanel->setCurve(myCurve);
-    QString aNewName = HYDROGUI_Tool::GenerateObjectName( module(), tr("POLYLINE_PREFIX") );
+    QString aNewName = HYDROGUI_Tool::GenerateObjectName( module(), "Polyline" );
     aPanel->setPolylineName(aNewName);
   }
   aPanel->setCurve(myCurve);