]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To use SALOME::GenericObjPtr template class instead of bare pointer
authorapo <apo@opencascade.com>
Fri, 13 Jul 2007 08:24:05 +0000 (08:24 +0000)
committerapo <apo@opencascade.com>
Fri, 13 Jul 2007 08:24:05 +0000 (08:24 +0000)
src/VISUGUI/VisuGUI_CutLinesDlg.cxx
src/VISUGUI/VisuGUI_CutLinesDlg.h

index 21ae371b1ee23f64e4b3d1e8847a1a4b2296a6ff..a7fc9d93cc7b4235c3ff2a41f3ac4f4190e2344d 100644 (file)
@@ -250,8 +250,6 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule)
 
   aMainLayout->addWidget(aBtnBox);
 
-  myCutLines = NULL;
-
   // signals and slots connections
   connect(mySelPlane    , SIGNAL(clicked(int))          , this, SLOT(onPlaneSelect(int)));
   connect(myCBSetDef    , SIGNAL(toggled(bool))         , this, SLOT(setBaseDefault()));
@@ -273,10 +271,6 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule)
   connect(aOkBtn, SIGNAL(clicked()), this, SLOT(accept()));
   connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
   connect(aHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp()));
-  //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject()));
-  //connect(VisuGUI::application()->desktop(),
-  //        SIGNAL(windowActivated(SUIT_ViewWindow*)),
-  //        this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
 }
 
 /*!
@@ -284,10 +278,7 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule)
 */
 VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg()
 {
-  cout<<"### VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg"<<endl;
   deletePlanes();
-  if (myCutLines) //delete myCutLines;
-    myCutLines->Destroy();
   if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
     vf->Repaint();
 }
@@ -314,7 +305,8 @@ void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool
   hasInit = true;
   myCutLines = VISU::TSameAsFactory<VISU::TCUTLINES>().Create(myPrsCopy, VISU::ColoredPrs3d_i::EDoNotPublish);
   myCutLines->CopyCurvesInverted(myPrsCopy->GetCurvesInverted());
-  if (myCutLines->IsAllCurvesInverted()) myAllCurvesInvertedCheck->setChecked(true);
+  if (myCutLines->IsAllCurvesInverted()) 
+    myAllCurvesInvertedCheck->setChecked(true);
   myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
   myCBSetDef->setChecked(myPrsCopy->IsDefault());
   DrawTable();
@@ -373,7 +365,7 @@ void VisuGUI_CutLinesDlg::createPlanes()
 {
   SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
   if (aView == NULL) return;
-  if (myCutLines == NULL) return;
+  if (!myCutLines) return;
   if (myPreviewActor != 0) return;
 
   storeToPrsObject(myCutLines);
@@ -473,15 +465,9 @@ void VisuGUI_CutLinesDlg::onCutSelect (int theId, bool theUpdate)
   }
   SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
   if (aView) {
-    if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
-      /*myCutLines->SetOrientation2(getOrientaion(false),
-                                  myRotXSpn2->value()*PI/180.,
-                                  myRotYSpn2->value()*PI/180.);
-                                 myCutLines->SetDisplacement2(myPosSpn2->value());*/
-      //myCutLines->GetPipeLine()->Update();
+    if (theUpdate && myPreviewCheck->isChecked() && myCutLines) {
       deletePlanes();
       createPlanes();
-      //aView->Repaint();
     }
   }
 }
@@ -493,22 +479,12 @@ void VisuGUI_CutLinesDlg::setBaseDefault (bool theUpdate)
 
   if (myCBSetDef->isChecked()) {
     if (!myCutLines->IsDefault()) myCutLines->SetDefault();
-    /*myCutLines->SetOrientation(getOrientaion(),
-                               myRotXSpn->value()*PI/180.,
-                               myRotYSpn->value()*PI/180.);
-                              myCutLines->SetDisplacement(myPosSpn->value());*/
-    /*    float aPos = myCutLines->GetBasePlanePosition();
-    myBasePlanePos->setText( QString::number(aPos) );
-    myBasePlanePos->setEnabled(false);*/
     myCutLines->SetDisplacement(myPosSpn->value());
     SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
     if (aView) {
-      if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
-        //myCutLines->SetBasePlanePosition(aPos);
-       //        myCutLines->GetPipeLine()->Update();
+      if (theUpdate && myPreviewCheck->isChecked() && myCutLines) {
         deletePlanes();
         createPlanes();
-        //aView->Repaint();
       }
     }
     vtkFloatingPointType aPos = myCutLines->GetBasePlanePosition();
@@ -576,10 +552,8 @@ void VisuGUI_CutLinesDlg::DrawTable()
   SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
   if (aView) {
     if (myPreviewCheck->isChecked()) {
-      //      myCutLines->GetPipeLine()->Update();
       deletePlanes();
       createPlanes();
-      //aView->Repaint();
     }
   }
 }
@@ -744,27 +718,18 @@ void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol)
     SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
     if (aView) {
       if (myPreviewCheck->isChecked()) {
-       //Update Preview
-       //myCutLines->SetLinePosition( theRow, aTxt.toDouble());
-       //      myCutLines->GetPipeLine()->Update();
        deletePlanes();
        createPlanes();
-       //aView->Repaint();
       }
     }
   } else if (theCol == 1){
     bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
     if (isDefault) {
-      //myCutLines->SetDefaultPosition(theRow);
-      // myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
       SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
       if (aView) {
        if (myPreviewCheck->isChecked()) {
-         //Update Preview
-         //      myCutLines->GetPipeLine()->Update();
          deletePlanes();
          createPlanes();
-         //aView->Repaint();
        }
       }
       myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
@@ -775,87 +740,6 @@ void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol)
 
 void VisuGUI_CutLinesDlg::accept()
 {
-  //if ( !VisuGUI::CheckActiveStudyLock() ) {
-  //  reject();
-  //  return;
-  //}
-  //  if (myScalarPane->check()) {
-    /*jfa tmp:((QWidget*)sender())->setDisabled(true);
-    storeToPrsObject(myPrsCopy);
-    if (myIsCreation) {
-      if (isGenerateTable()) {
-       visuGUI->GetVisuGen()->CreateTable(myPrsCopy->GetEntry());
-       if (isGenerateCurves()) {
-         SALOMEDSClient_Study* aStudy = study()->studyDS();
-         SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrsCopy->GetEntry());
-         if( aSObject ) {
-           SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
-           SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
-           for ( ;aIter->More(); aIter->Next()) {
-             SALOMEDSClient_SObject* aTblObj = aIter->Value();
-             if ( aTblObj ) {
-               SALOMEDSClient_GenericAttribute* anAttr;
-               if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
-                 visuGUI->CreatePlot(aTblObj);
-               }
-             }
-           }
-         }
-       }
-      }
-      if (GET_VTK_VIEWWINDOW(myMgr)) {
-       try {
-         visuGUI->CreateActor(myPrsCopy);
-       } catch (...) {
-         reject();
-         return;
-       }
-       GET_VTK_VIEWWINDOW(myMgr)->onFitAll();
-      }
-    } else {
-      visuGUI->RecreateActor(myPrsCopy);
-      if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
-       if (vf->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
-         vf->getRenderer()->ResetCameraClippingRange();
-         vf->Repaint();
-       }
-      }
-      // Remove old Table
-      SALOMEDSClient_Study* aStudy = study()->studyDS();
-      SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrsCopy->GetEntry());
-      if( aSObject ) {
-       SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
-       SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
-       for ( ;aIter->More(); aIter->Next()) {
-         SALOMEDSClient_SObject* aTblObj = aIter->Value();
-         if ( aTblObj ) {
-           SALOMEDSClient_GenericAttribute* anAttr;
-           if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
-             aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
-             break;
-           }
-         }
-       }
-       if (isGenerateTable()) {
-         visuGUI->GetVisuGen()->CreateTable(aSObject->GetID().c_str());
-         if (isGenerateCurves()) {
-           SALOMEDSClient_Study* aStudy = study()->studyDS();
-           SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
-           SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
-           for ( ;aIter->More(); aIter->Next()) {
-             SALOMEDSClient_SObject* aTblObj = aIter->Value();
-             if ( aTblObj ) {
-               SALOMEDSClient_GenericAttribute* anAttr;
-               if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
-                 visuGUI->CreatePlot(aTblObj);
-               }
-             }
-           }
-         }
-       }
-      }
-    }
-    VisuGUI::application()->objectBrowser()->updateTree();*/
     myScalarPane->deletePreview();
     deletePlanes();
     QDialog::accept();
@@ -863,10 +747,6 @@ void VisuGUI_CutLinesDlg::accept()
 
 void VisuGUI_CutLinesDlg::reject()
 {
-  /*jfa tmp:if (myIsCreation) {
-    myPrsCopy->RemoveFromStudy();
-    VisuGUI::application()->objectBrowser()->updateTree();
-  }*/
   myScalarPane->deletePreview();
   deletePlanes();
   QDialog::reject();
@@ -876,10 +756,7 @@ void VisuGUI_CutLinesDlg::onPreviewCheck (bool thePreview)
 {
   if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
     if (thePreview) {
-      //storeToPrsObject(myCutLines);
-      //      myCutLines->GetPipeLine()->Update();
       createPlanes();
-      //vf->onFitAll();
     } else {
       deletePlanes();
       vf->Repaint();
@@ -904,36 +781,24 @@ void VisuGUI_CutLinesDlg::onAllCurvesInvertedCheck(bool theInvert)
 
 void VisuGUI_CutLinesDlg::onRotation (double theValue)
 {
-  if (myCutLines == NULL) return;
+  if (!myCutLines) return;
   SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
   if (aView) {
     if (myPreviewCheck->isChecked()) {
-
-      /*myCutLines->SetOrientation(getOrientaion(),
-                                 myRotXSpn->value()*PI/180.,
-                                 myRotYSpn->value()*PI/180.);
-      myCutLines->SetOrientation2(getOrientaion(false),
-                                  myRotXSpn2->value()*PI/180.,
-                                  myRotYSpn2->value()*PI/180.);*/
-      //      myCutLines->GetPipeLine()->Update();
       deletePlanes();
       createPlanes();
-      //aView->Repaint();
     }
   }
 }
 
 void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue)
 {
-  if (myCutLines == NULL) return;
+  if (!myCutLines) return;
   SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
   if (aView) {
     if (myPreviewCheck->isChecked()) {
-      //myCutLines->SetBasePlanePosition(theValue.toDouble());
-      //      myCutLines->GetPipeLine()->Update();
       deletePlanes();
       createPlanes();
-      //aView->Repaint();
     }
   }
 }
index 9e7405e77d15ffc7cbfbba1fd8059ae6fa9dae83..52142bdfbf04864bf8126a5c6144bfa7267553df 100644 (file)
@@ -104,7 +104,7 @@ private:
   bool hasInit;
 
   QDoubleValidator *mydvalidator;
-  VISU::CutLines_i* myCutLines;
+  SALOME::GenericObjPtr<VISU::CutLines_i> myCutLines;
 
   QTabWidget*            myTabBox;
   VisuGUI_ScalarBarPane* myScalarPane;