#include "VisuGUI.h"
#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
#include "VISU_ViewManager_i.hh"
#include "VISU_Plot3DPL.hxx"
-#include "SALOME_Actor.h"
#include "SVTK_ViewWindow.h"
+#include "SALOME_Actor.h"
+#include "SUIT_Desktop.h"
+
#include <qlayout.h>
#include <qvalidator.h>
#include <qtabwidget.h>
static void renderViewFrame (SVTK_ViewWindow* vw)
{
if (vw) {
-//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
- vw->getRenderer()->ResetCameraClippingRange();
- vw->Repaint();
-//}
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
}
}
//=======================================================================
VisuGUI_Plot3DPane::VisuGUI_Plot3DPane (QWidget* parent)
: QVBox(parent), myInitFromPrs(false), myPreviewActor(NULL),
- myViewWindow(VISU::GetViewWindow()), myPrs(NULL), myPipeCopy(NULL)
+ myViewWindow(VISU::GetActiveViewWindow<SVTK_ViewWindow>()), myPrs(NULL), myPipeCopy(NULL)
{
layout()->setAlignment(Qt::AlignTop);
setSpacing(6);
if (!myPipeCopy)
myPipeCopy = VISU_Plot3DPL::New();
if (myPrs) {
+ myPipeCopy->SetIDMapper(myPrs->GetPL()->GetIDMapper());
myPipeCopy->ShallowCopy(myPrs->GetPL());
storeToPrsObject(myPrs);
}
storePrsParams();
myPrs->GetPlot3DPL()->GetMinMaxPosition(minPos, maxPos);
restorePrsParams();
- if (isRelativePos) // absolute -> relative
- pos = (pos - minPos) / (maxPos - minPos);
- else // relative -> absolute
- pos = minPos * (1. - pos) + maxPos * pos;
+ if (-1e-7 < (maxPos - minPos) && (maxPos - minPos) < 1e-7) {
+ pos = 0;
+ } else {
+ if (isRelativePos) // absolute -> relative
+ pos = (pos - minPos) / (maxPos - minPos);
+ else // relative -> absolute
+ pos = minPos * (1. - pos) + maxPos * pos;
+ }
}
if (isRelativePos) {
minPos = 0.;
//function : Constructor
//purpose :
//=======================================================================
-VisuGUI_Plot3DDlg::VisuGUI_Plot3DDlg(QWidget* parent)
- : QDialog(parent, "VisuGUI_Plot3DDlg", false, WStyle_Customize |
+VisuGUI_Plot3DDlg::VisuGUI_Plot3DDlg (SalomeApp_Module* theModule)
+ : QDialog(VISU::GetDesktop(theModule), "VisuGUI_Plot3DDlg", false, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
setCaption(tr("TITLE"));
//=======================================================================
void VisuGUI_Plot3DDlg::accept()
{
-/*if (!VISU::CheckActiveStudyLock()) {
- return;
- }
- if (myIsoPane->check() && myScalarPane->check()) {
- if (!isModal()) {
- VISU::Plot3D_i* prs = myIsoPane->GetPrs();
- bool isCreation = !VISU::GetActor(prs, myViewWindow);
- if (storeToPrsObject(prs)) {
- if (isCreation) { // creation
- if (myViewWindow) {
- try {
- VISU::CreateActor(prs);
- }
- catch (...) {
- reject();
- return;
- }
- myViewWindow->onFitAll();
- }
- } else { // edition
- VISU::RecreateActor(prs);
- renderViewFrame(myViewWindow);
- }
- } else {
- if (isCreation) {
- prs->RemoveFromStudy();
- //study->updateObjBrowser();
- }
- }
-}*/
- QDialog::accept();
-//}
+ if (myIsoPane->check() && myScalarPane->check())
+ {
+ myScalarPane->deletePreview();
+ QDialog::accept();
+ }
}
//=======================================================================
void VisuGUI_Plot3DDlg::reject()
{
myIsoPane->check(); // hide preview
-
-/*if (!isModal() && myIsoPane->GetPrs() &&
- !VISU::GetActor(myIsoPane->GetPrs(), myViewWindow)) {
- _PTR(Study) aStudy = VISU::GetCStudy(VISU::GetAppStudy(myModule));
- if (!aStudy->GetProperties()->IsLocked()) {
- myIsoPane->GetPrs()->RemoveFromStudy();
- myIsoPane->GetStudyFrame()->getStudy()->updateObjBrowser();
- }
-}*/
+ myScalarPane->deletePreview();
+
QDialog::reject();
}