#include "VISU_Prs3d_i.hh"
#include "VISU_Result_i.hh"
-#include "SalomeApp_SelectionMgr.h"
+#include "VISU_PipeLine.hxx"
+
+#include "LightApp_SelectionMgr.h"
#include "SVTK_ViewWindow.h"
#include "SUIT_Session.h"
#include "SUIT_Desktop.h"
+#include "SUIT_MessageBox.h"
#include "SUIT_ResourceMgr.h"
#include "SUIT_OverrideCursor.h"
{
if (theValue.isEmpty()) return theDefault;
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
- QString aValue = aResourceMgr->stringValue(theValue);
+ QString aValue = aResourceMgr->stringValue("VISU",theValue);
if (aValue.isEmpty()) return theDefault;
return aValue.toFloat();
}
void RenderViewWindow (SVTK_ViewWindow* vw)
{
if (vw) {
-//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
- vw->getRenderer()->ResetCameraClippingRange();
- vw->Repaint();
-//}
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
}
}
vtkProperty* aProp = vtkProperty::New();
float anRGB[3];
- anRGB[0] = VISU::GetFloat("SMESH:SettingsFillColorRed", 0)/255.;
- anRGB[1] = VISU::GetFloat("SMESH:SettingsFillColorGreen", 170)/255.;
- anRGB[2] = VISU::GetFloat("SMESH:SettingsFillColorBlue", 255)/255.;
+
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ QColor aFillColor = aResourceMgr->colorValue("SMESH", "fill_color", QColor(0, 170, 255));
+ anRGB[0] = aFillColor.red()/255.;
+ anRGB[1] = aFillColor.green()/255.;
+ anRGB[2] = aFillColor.blue()/255.;
aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
aProp->SetOpacity(0.75);
myActor->SetProperty(aProp);
aProp->Delete();
vtkProperty* aBackProp = vtkProperty::New();
- anRGB[0] = VISU::GetFloat("SMESH:SettingsBackFaceColorRed", 0)/255.;
- anRGB[1] = VISU::GetFloat("SMESH:SettingsBackFaceColorGreen", 0)/255.;
- anRGB[2] = VISU::GetFloat("SMESH:SettingsBackFaceColorBlue", 255)/255.;
+ QColor aBackFaceColor = aResourceMgr->colorValue("SMESH", "backface_color", QColor(0, 0, 255));//@
+ anRGB[0] = aBackFaceColor.red()/255.;
+ anRGB[1] = aBackFaceColor.green()/255.;
+ anRGB[2] = aBackFaceColor.blue()/255.;
aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
aBackProp->SetOpacity(0.75);
myActor->SetBackfaceProperty(aBackProp);
onSelectionChanged();
// signals and slots connections :
- connect(ComboBoxPlanes, SIGNAL(activated(int)), this, SLOT(onSelectPlane(int)));
- connect(buttonNew, SIGNAL(clicked()), this, SLOT(ClickOnNew()));
- connect(buttonDelete, SIGNAL(clicked()), this, SLOT(ClickOnDelete()));
- connect(ComboBoxOrientation, SIGNAL(activated(int)), this, SLOT(onSelectOrientation(int)));
- connect(SpinBoxDistance, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
- connect(SpinBoxRot1, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
- connect(SpinBoxRot2, SIGNAL(valueChanged(double)), this, SLOT(SetCurrentPlaneParam()));
- connect(ButtonGroupIJKAxis, SIGNAL(clicked(int)), this, SLOT(onIJKAxisChanged(int)));
- connect(SpinBoxIJKIndex, SIGNAL(valueChanged(int)), this, SLOT(SetCurrentPlaneIJKParam()));
- connect(CheckBoxIJKPlaneReverse, SIGNAL(toggled(bool)), this, SLOT(SetCurrentPlaneIJKParam()));
- connect(TabPane, SIGNAL(currentChanged (QWidget*)), this, SLOT(onTabChanged(QWidget*)));
-
- connect(PreviewCheckBox, SIGNAL(toggled(bool)), this, SLOT(OnPreviewToggle(bool)));
+ connect(ComboBoxPlanes , SIGNAL(activated(int)) , this, SLOT(onSelectPlane(int)));
+ connect(buttonNew , SIGNAL(clicked()) , this, SLOT(ClickOnNew()));
+ connect(buttonDelete , SIGNAL(clicked()) , this, SLOT(ClickOnDelete()));
+ connect(ComboBoxOrientation , SIGNAL(activated(int)) , this, SLOT(onSelectOrientation(int)));
+ connect(SpinBoxDistance , SIGNAL(valueChanged(double)) , this, SLOT(SetCurrentPlaneParam()));
+ connect(SpinBoxRot1 , SIGNAL(valueChanged(double)) , this, SLOT(SetCurrentPlaneParam()));
+ connect(SpinBoxRot2 , SIGNAL(valueChanged(double)) , this, SLOT(SetCurrentPlaneParam()));
+ connect(ButtonGroupIJKAxis , SIGNAL(clicked(int)) , this, SLOT(onIJKAxisChanged(int)));
+ connect(SpinBoxIJKIndex , SIGNAL(valueChanged(int)) , this, SLOT(SetCurrentPlaneIJKParam()));
+ connect(CheckBoxIJKPlaneReverse, SIGNAL(toggled(bool)) , this, SLOT(SetCurrentPlaneIJKParam()));
+ connect(TabPane , SIGNAL(currentChanged (QWidget*)), this, SLOT(onTabChanged(QWidget*)));
+
+ connect(PreviewCheckBox , SIGNAL(toggled(bool)), this, SLOT(OnPreviewToggle(bool)));
connect(AutoApplyCheckBox, SIGNAL(toggled(bool)), this, SLOT(ClickOnApply()));
- connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+
+ connect(buttonOk , SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply , SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
- connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
- connect(myVisuGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnOk()));
+
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
- /* to close dialog if study frame change */
- connect(myVisuGUI, SIGNAL(SignalStudyFrameChanged()), this, SLOT(ClickOnCancel()));
this->show();
}
if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI)) {
SUIT_OverrideCursor wc;
+ // Save clipping planes, currently applied to the presentation
+ // to enable restoring this state in case of failure.
+ // Refer to bugs IPAL8849, IPAL8850 for more information.
+ typedef vtkSmartPointer<vtkPlane> TPln;
+ typedef std::vector<TPln> TPlns;
+ bool isFailed = false;
+ TPlns anOldPlanes;
+ int iopl = 0, nbOldPlanes = myPrs3d->GetNumberOfClippingPlanes();
+ for (; iopl < nbOldPlanes; iopl++) {
+ anOldPlanes.push_back(myPrs3d->GetClippingPlane(iopl));
+ }
+
+ // Try to apply new clipping
myPrs3d->RemoveAllClippingPlanes();
VISU::TPlanes::iterator anIter = myPlanes.begin();
- for (;anIter != myPlanes.end();anIter++) {
+ for (; anIter != myPlanes.end(); anIter++) {
OrientedPlane* anOrientedPlane = OrientedPlane::New(aViewWindow);
anOrientedPlane->ShallowCopy(anIter->GetPointer());
- myPrs3d->AddClippingPlane(anOrientedPlane);
+ if (!myPrs3d->AddClippingPlane(anOrientedPlane)) {
+ isFailed = true;
+ }
anOrientedPlane->Delete();
}
- VISU::RenderViewWindow(aViewWindow);
+ // Check contents of the resulting (clipped) presentation data
+ if (!isFailed) {
+ VISU_PipeLine* aPL = myPrs3d->GetPL();
+ VISU_PipeLine::TMapper* aM = aPL->GetMapper();
+ vtkDataSet* aPrsData = aM->GetInput();
+ aPrsData->Update();
+ if (aPrsData->GetNumberOfCells() < 1) {
+ isFailed = true;
+ }
+ }
+
+ if (isFailed) {
+ // Restore previous clipping state because of failure.
+ myPrs3d->RemoveAllClippingPlanes();
+
+ TPlns::iterator anOldIter = anOldPlanes.begin();
+ for (; anOldIter != anOldPlanes.end(); anOldIter++) {
+ myPrs3d->AddClippingPlane(anOldIter->GetPointer());
+ }
+
+ SUIT_MessageBox::warn1(VISU::GetDesktop(myVisuGUI),
+ tr("WRN_VISU"),
+ tr("WRN_EMPTY_RESULTING_PRS"),
+ tr("BUT_OK") );
+ }
+
+ //VISU::RenderViewWindow(aViewWindow);
+ VISU::RepaintViewWindows(myVisuGUI, myIO);
}
}
if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI)) {
Handle(SALOME_InteractiveObject) anIO;
CORBA::Object_var anObject = VISU::GetSelectedObj(myVisuGUI, &anIO);
+ myIO = anIO;
if (CORBA::is_nil(anObject)) return;
PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
if (!aServant.in()) return;