From: apo Date: Fri, 13 Jul 2007 08:24:05 +0000 (+0000) Subject: To use SALOME::GenericObjPtr template class instead of bare pointer X-Git-Tag: T_MULTIPR_INDUS_Persistence~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=53d6d2955f7c295aabefb5bfdf013a6fa813f770;p=modules%2Fvisu.git To use SALOME::GenericObjPtr template class instead of bare pointer --- diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx index 21ae371b..a7fc9d93 100644 --- a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx @@ -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"<Destroy(); if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) vf->Repaint(); } @@ -314,7 +305,8 @@ void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool hasInit = true; myCutLines = VISU::TSameAsFactory().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(); 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(); 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(); 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(); 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(); 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(); 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()) { 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(); 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(); if (aView) { if (myPreviewCheck->isChecked()) { - //myCutLines->SetBasePlanePosition(theValue.toDouble()); - // myCutLines->GetPipeLine()->Update(); deletePlanes(); createPlanes(); - //aView->Repaint(); } } } diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.h b/src/VISUGUI/VisuGUI_CutLinesDlg.h index 9e7405e7..52142bdf 100644 --- a/src/VISUGUI/VisuGUI_CutLinesDlg.h +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.h @@ -104,7 +104,7 @@ private: bool hasInit; QDoubleValidator *mydvalidator; - VISU::CutLines_i* myCutLines; + SALOME::GenericObjPtr myCutLines; QTabWidget* myTabBox; VisuGUI_ScalarBarPane* myScalarPane;