#include <qptrlist.h>
#include <qptrvector.h>
+#include <qcolordialog.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include "VisuGUI_Selection.h"
#include "VisuGUI_TimeAnimation.h"
#include "VisuGUI_EditContainerDlg.h"
+#include "VisuGUI_NonIsometricDlg.h"
#include "VISU_ScalarMap_i.hh"
#include "VisuGUI_ScalarBarDlg.h"
aView->onFitAll();
}
-void
-VisuGUI::
-OnCreateMesh()
+void VisuGUI::CreateMesh (const Handle(SALOME_InteractiveObject)& theIO)
{
_PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
- if (CheckLock(aStudy))
- return;
+ //if (CheckLock(aStudy))
+ // return;
- // Get selected SObject
- SALOMEDS::SObject_var aResultSObj;
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
- if (anIO.IsNull() || !anIO->hasEntry())
- return;
-
- aResultSObj = GetDSStudy(aStudy)->FindObjectID(anIO->getEntry());
+ SALOMEDS::SObject_var aResultSObj =
+ GetDSStudy(aStudy)->FindObjectID(theIO->getEntry());
// Get VISU::Result
VISU::Result_var aResult;
}
}
+void
+VisuGUI::
+OnCreateMesh()
+{
+ _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aStudy))
+ return;
+
+ // Get selected SObject
+ SALOMEDS::SObject_var aResultSObj;
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (anIO.IsNull() || !anIO->hasEntry())
+ return;
+
+ CreateMesh(anIO);
+}
+
+void
+VisuGUI::
+OnCreateManyMesh()
+{
+ _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aStudy))
+ return;
+
+ // Get selected SObject
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+ SALOME_ListIteratorOfListIO anIter (aListIO);
+ for (; anIter.More(); anIter.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ if (anIO.IsNull() || !anIO->hasEntry())
+ return;
+
+ CreateMesh(anIO);
+ }
+}
+
void
VisuGUI::
OnCreateScalarMap()
CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
}
-void
-VisuGUI::
-OnCreateManyMesh()
-{
-}
-
void
VisuGUI::
OnCreatePlot2dView()
ErasePrs(anObject);
}
+template<class TPrs3d_i, class TDlg>
+void
+EditPrs3d (SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs3d)
+{
+ TPrs3d_i* aPrsObject = dynamic_cast<TPrs3d_i*>(thePrs3d);
+ if (aPrsObject) {
+ //TDlg* aDlg = new TDlg (GetDesktop(theModule), false, true);
+ TDlg* aDlg = new TDlg (GetDesktop(theModule));
+ aDlg->initFromPrsObject(aPrsObject);
+ if (aDlg->exec()) {
+ if (!(aDlg->storeToPrsObject(aPrsObject))) {
+ delete aDlg;
+ return;
+ }
+ RecreateActor(theModule, aPrsObject);
+ if (SVTK_ViewWindow* vw = GetViewWindow(theModule)) {
+ //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
+ //}
+ }
+ }
+ delete aDlg;
+ }
+}
+
void
VisuGUI::
OnEditPrs()
{
+ if (CheckLock(GetCStudy(GetAppStudy(this))))
+ return;
+
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
+
+ VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+ if (!aPrs3d) return;
+
+ switch (aPrs3d->GetType()) {
+ case VISU::TMESH:
+ break;
+ case VISU::TSCALARMAP:
+ EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg>(this, aPrs3d);
+ break;
+ case VISU::TDEFORMEDSHAPE:
+ EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg>(this, aPrs3d);
+ break;
+ case VISU::TCUTPLANES:
+ EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg>(this, aPrs3d);
+ /*{
+ VISU::CutPlanes_i* aPrsObject = dynamic_cast<VISU::CutPlanes_i*>(aPrs3d);
+ if (aPrsObject) {
+ VisuGUI_CutPlanesDlg* aDlg =
+ new VisuGUI_CutPlanesDlg (GetDesktop(this), false, false);
+ aDlg->initFromPrsObject(aPrsObject);
+ aDlg->show();
+ }
+ }*/
+ break;
+ case VISU::TCUTLINES:
+ EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg>(this, aPrs3d);
+ /*{
+ VISU::CutLines_i* aPrsObject = dynamic_cast<VISU::CutLines_i*>(aPrs3d);
+ if (aPrsObject) {
+ VisuGUI_CutLinesDlg* aDlg =
+ new VisuGUI_CutLinesDlg (GetDesktop(this), false, false);
+ aDlg->initFromPrsObject(aPrsObject);
+ aDlg->show();
+ }
+ }*/
+ break;
+ case VISU::TISOSURFACE:
+ EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg>(this, aPrs3d);
+ break;
+ case VISU::TVECTORS:
+ EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg>(this, aPrs3d);
+ break;
+ case VISU::TSTREAMLINES:
+ EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg>(this, aPrs3d);
+ break;
+ default:
+ return;
+ }
+
+ if (SVTK_ViewWindow* vw = GetViewWindow())
+ vw->highlight(anIO, 1);
}
void
// is it Prs3d object ?
VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
if (aPrsObject) {
- //jfa tmp:DeletePresentation(aPrsObject);
DeletePrs3d(this, aPrsObject, anIO);
}
// is it Curve object ?
VISU::Curve_i* aCurveObject = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
if (aCurveObject) {
- //jfa tmp:DeletePresentation(aCurveObject);
- //DeleteCurve(this, aCurveObject, anIO);
+ //jfa tmp:DeleteCurve(this, aCurveObject, anIO);
}
aStudyBuilder->CommitCommand();
{
}
+void
+VisuGUI::
+OnEraseAll()
+{
+ SVTK_ViewWindow* vw = GetViewWindow();
+ if (!vw) return;
+
+ /*jfa tmp:GetActiveStudy()->unHighlightAll();
+ if (vtkRenderer *aRen = GetRenderer()) {
+ vtkActor *anActor;
+ vtkActorCollection *anActColl = aRen->GetActors();
+ for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
+ if (anActor->GetVisibility() > 0)
+ if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
+ anVISUActor = anVISUActor->GetParent();
+ anVISUActor->VisibilityOff();
+ }
+ }
+ vw->Repaint();
+ }*/
+}
+
+void VisuGUI::ChangeRepresentation (VISU::PresentationType theType)
+{
+ SVTK_ViewWindow* vw = GetViewWindow();
+ if (!vw) return;
+
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
+
+ VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+ if (aPrs3d) {
+ if (VISU_Actor* anActor = GetActor(aPrs3d, vw)) {
+ switch (theType) {
+ case VISU::SHRINK:
+ if (anActor->IsShrunk())
+ anActor->UnShrink();
+ else
+ anActor->SetShrink();
+ break;
+ default:
+ if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
+ aMesh->SetPresentationType(theType);
+ RecreateActor(this, aMesh);
+ } else {
+ anActor->SetRepresentation(theType);
+ }
+ }
+ vw->Repaint();
+ }
+ }
+}
+
void
VisuGUI::
OnMakeSurfaceframe()
{
+ ChangeRepresentation(VISU::SURFACEFRAME);
}
void
VisuGUI::
OnMakeInsideframe()
{
+ ChangeRepresentation(VISU::INSIDEFRAME);
}
void
VisuGUI::
OnMakeWireframe()
{
+ ChangeRepresentation(VISU::WIREFRAME);
}
void
VisuGUI::
OnMakeSurface()
{
+ ChangeRepresentation(VISU::SHADED);
}
void
VisuGUI::
OnMakePoints()
{
+ ChangeRepresentation(VISU::POINT);
}
void
VisuGUI::
OnMakeShrink()
{
+ ChangeRepresentation(VISU::SHRINK);
}
void
VisuGUI::
OnChangeColor()
{
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
+
+ VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+ if (!aPrs3d) return;
+
+ SVTK_ViewWindow* vw = GetViewWindow();
+ if (!vw) return;
+
+ VISU_Actor* anActor = GetActor(aPrs3d, vw);
+ if (!anActor) return;
+
+ VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
+ VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
+ SALOMEDS::Color anOldColor, aNewColor;
+ int aRepresent = anActor->GetRepresentation();
+ if (aMesh) {
+ switch (aRepresent) {
+ case VISU::POINT :
+ anOldColor = aMesh->GetNodeColor();
+ break;
+ case VISU::WIREFRAME :
+ case VISU::INSIDEFRAME :
+ anOldColor = aMesh->GetLinkColor();
+ break;
+ case VISU::SHADED :
+ case VISU::SURFACEFRAME :
+ anOldColor = aMesh->GetCellColor();
+ break;
+ }
+ } else if (aDeformedShape) {
+ anOldColor = aDeformedShape->GetColor();
+ } else {
+ return;
+ }
+
+ QColor aColor (int(255*anOldColor.R),
+ int(255*anOldColor.G),
+ int(255*anOldColor.B));
+ QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
+ if (aColorNew.isValid()) {
+ aNewColor.R = aColorNew.red()/255.;
+ aNewColor.G = aColorNew.green()/255.;
+ aNewColor.B = aColorNew.blue()/255.;
+ if (aMesh) {
+ switch (aRepresent) {
+ case VISU::POINT :
+ aMesh->SetNodeColor(aNewColor);
+ break;
+ case VISU::WIREFRAME :
+ case VISU::INSIDEFRAME :
+ aMesh->SetLinkColor(aNewColor);
+ break;
+ case VISU::SHADED :
+ case VISU::SURFACEFRAME :
+ aMesh->SetCellColor(aNewColor);
+ break;
+ }
+ } else {
+ aDeformedShape->SetColor(aNewColor);
+ }
+ RecreateActor(this, aPrs3d);
+ }
}
void
VisuGUI::
OnChangeWireframeColor()
{
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
+
+ VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+ if (!aPrs3d) return;
+
+ SVTK_ViewWindow* vw = GetViewWindow();
+ if (!vw) return;
+
+ VISU_Actor* anActor = GetActor(aPrs3d, vw);
+ if (!anActor) return;
+
+ if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
+ SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
+ QColor aColor (int(255*anOldColor.R),
+ int(255*anOldColor.G),
+ int(255*anOldColor.B));
+ QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
+ if (aColorNew.isValid()) {
+ aNewColor.R = aColorNew.red()/255.;
+ aNewColor.G = aColorNew.green()/255.;
+ aNewColor.B = aColorNew.blue()/255.;
+ aMesh->SetLinkColor(aNewColor);
+ RecreateActor(this, aMesh);
+ }
+ }
}
void
PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
if (!aServant.in()) return;
- VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
if (!aPrsObject) return;
SVTK_ViewWindow* vw = GetViewWindow();
if (!anActor) return;
VisuGUI_CursorDlg* CursorDlg =
- new VisuGUI_CursorDlg (GetDesktop(this), tr("Opacity"), TRUE);
+ new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_OPACITY_TITLE"), TRUE);
- CursorDlg->Comment1->setText(tr("Set value between"));
- CursorDlg->Comment2->setText(tr("0 (transparent) and 100 (opaque)"));
+ CursorDlg->Comment1->setText(tr("DLG_OPACITY_CMT1"));
+ CursorDlg->Comment2->setText(tr("DLG_OPACITY_CMT2"));
CursorDlg->SpinBox1->setMinValue(0);
CursorDlg->SpinBox1->setMaxValue(100);
PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
if (!aServant.in()) return;
- VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
if (!aPrsObject) return;
SVTK_ViewWindow* vw = GetViewWindow();
if (!anActor) return;
VisuGUI_CursorDlg* CursorDlg =
- new VisuGUI_CursorDlg (GetDesktop(this), tr("Line Width"), TRUE);
+ new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
- CursorDlg->Comment1->setText("Set value between");
- CursorDlg->Comment2->setText("1 (thin) and 10 (thick)");
+ CursorDlg->Comment1->setText("DLG_LINEWIDTH_CMT1");
+ CursorDlg->Comment2->setText("DLG_LINEWIDTH_CMT2");
CursorDlg->SpinBox1->setMinValue(1);
CursorDlg->SpinBox1->setMaxValue(10);
OnCreateTable()
{
Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
+ CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
_PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
_PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
if (CORBA::is_nil(aPrs3d)) continue;
VISU::Prs3d_i* pPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
- //jfa tmp:DeletePresentation(pPrs3d);
DeletePrs3d(this, pPrs3d, NULL);
}
break;
CORBA::Object_ptr aCurve = VISU::Curve::_narrow(aChildObj);
if (CORBA::is_nil(aCurve)) continue;
VISU::Curve_i* pCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
- //jfa tmp:DeletePresentation(pCurve);
+ //jfa tmp:DeleteCurve(this, pCurve, NULL);
}
break;
}
int horIndex;
QValueList<int> verIndices;
dlg->getCurvesSource( horIndex, verIndices );
- if ( horIndex >= 0 && verIndices.count() > 0 ) {
+ if ( horIndex >= 0 && verIndices.count() > 0 ) {
CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
if( !CORBA::is_nil( aContainer ) ) {
VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
int horIndex;
QValueList<int> verIndices;
dlg->getCurvesSource( horIndex, verIndices );
- if ( horIndex >= 0 && verIndices.count() > 0 ) {
+ if ( horIndex >= 0 && verIndices.count() > 0 ) {
CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
-
+
if ( pContainer && pTable ) {
for ( int i = 0; i < verIndices.count(); i++ ) {
CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( pTable->_this(), horIndex+1, verIndices[i]+1 );
}
}
delete dlg;
- }
+ }
}
}
if (!aSObj) return;
//TEST DU PARENT == VISU
- _PTR(GenericAttribute) anAttr;
+ _PTR(GenericAttribute) anAttr;
if (aSObj->FindAttribute(anAttr, "AttributeName")) {
_PTR(AttributeName) aName (anAttr);
QString Name = VisuGUI_NameDlg::getName(GetDesktop(this), aName->Value());
}
}
-/*void
-VisuGUI::
-OnRenameTable()
-{
- _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
- if (CheckLock(aCStudy))
- return;
-
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-
- _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
- if (!aSObject) return;
-
- VISU::Table_i* table = 0;
- if (!CORBA::is_nil(anObject)) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
- // Table object
- CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
- if (!CORBA::is_nil(aTable)) {
- table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
- }
- }
- }
-
- //TEST DU PARENT == VISU
- _PTR(GenericAttribute) anAttr;
- if (aSObj->FindAttribute(anAttr, "AttributeName")) {
- _PTR(AttributeName) aName (anAttr);
- QString Name = SALOMEGUI_NameDlg::getName(GetDesktop(), aName->Value());
- if (!Name.isEmpty()) {
- QApplication::setOverrideCursor(Qt::waitCursor);
- if (table)
- table->SetName(Name.latin1());
- //getApp()->activeStudy()->renameIObject(anIO, Name);
- anIO->setName(Name.latin1()); // rename the InteractiveObject
- updateObjBrowser(false);
- QApplication::restoreOverrideCursor();
- }
- }
-}
-
-void
-VisuGUI::
-OnRenameContainer()
-{
- _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
- if (CheckLock(aCStudy))
- return;
-
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-
- _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
- if (!aSObject) return;
-
- VISU::Container_i* container = 0;
- if (!CORBA::is_nil(anObject)) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
- // Container object
- CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
- if (!CORBA::is_nil(aContainer)) {
- container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
- }
- }
- }
-
- //TEST DU PARENT == VISU
- _PTR(GenericAttribute) anAttr;
- if (aSObj->FindAttribute(anAttr, "AttributeName")) {
- _PTR(AttributeName) aName (anAttr);
- QString Name = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), aName->Value());
- if (!Name.isEmpty()) {
- QApplication::setOverrideCursor(Qt::waitCursor);
- if (container)
- container->SetName(Name.latin1());
- //getApp()->activeStudy()->renameIObject(anIO, Name);
- anIO->setName(Name.latin1()); // rename the InteractiveObject
- updateObjBrowser(false);
- QApplication::restoreOverrideCursor();
- }
- }
-}*/
-
void
VisuGUI::
OnSweep()
VisuGUI::
OnSelectionInfo()
{
- //mySelectionDlg = new VisuGUI_SelectionDlg();
- //mySelectionDlg->show();
(new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
}
+void
+VisuGUI::
+OnScaling()
+{
+ VisuGUI_NonIsometricDlg* m_NonIsoDlg =
+ new VisuGUI_NonIsometricDlg (GetDesktop(this), "m_NonIsoDlg",
+ false, Qt::WDestructiveClose);
+ m_NonIsoDlg->show();
+}
+
void
VisuGUI::
initialize( CAM_Application* theApp )
aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
createAction( 4066, tr("MEN_ANIMATION"), QIconSet(aPixmap), tr("MEN_ANIMATION"), "", 0, aParent, false,
this, SLOT(OnTimeAnimation()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4070, tr("MEN_ERASE_ALL"), QIconSet(aPixmap),
+ tr("MEN_ERASE_ALL"), "", 0, aParent, false,
+ this, SLOT(OnEraseAll()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4071, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap),
+ tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
+ //this, SLOT(OnEraseAll()));
+ this);
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4072, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap),
+ tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
+ //this, SLOT(OnEraseAll()));
+ this);
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+ createAction( 4073, tr("MEN_SCALING"), QIconSet(aPixmap),
+ tr("MEN_SCALING"), "", 0, aParent, false,
+ this, SLOT(OnScaling()));
}
void
int aMenuId;
aMenuId = createMenu( tr( "MEN_FILE" ), -1 );
createMenu( separator(), aMenuId, 10 );
- createMenu( 112, aMenuId, 10 );
- createMenu( 113, aMenuId, 10 );
- createMenu( 199, aMenuId, 10 );
+ createMenu( 112, aMenuId, 10 ); // import from file
+ createMenu( 113, aMenuId, 10 ); // explore MED file
+ createMenu( 199, aMenuId, 10 ); // import table
aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
- //aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, 90 );
- createMenu( 4011, aMenuId, 10 );
- createMenu( 4012, aMenuId, 10 );
- createMenu( 4013, aMenuId, 10 );
- createMenu( 4014, aMenuId, 10 );
- createMenu( 4015, aMenuId, 10 );
- createMenu( 4016, aMenuId, 10 );
- createMenu( 4018, aMenuId, 10 );
- createMenu( 4065, aMenuId, 10 );
+ createMenu( 4011, aMenuId, 10 ); // scalar map
+ createMenu( 4012, aMenuId, 10 ); // deformed shape
+ createMenu( 4013, aMenuId, 10 ); // vectors
+ createMenu( 4014, aMenuId, 10 ); // iso surfaces
+ createMenu( 4015, aMenuId, 10 ); // cut planes
+ createMenu( 4016, aMenuId, 10 ); // stream lines
+ createMenu( 4018, aMenuId, 10 ); // cut lines
+
+ aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
+ createMenu( 4065, aMenuId, 10 ); // selection info
+
+ aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
+ int parentId =
+ createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
+ createMenu( 4050, parentId, 10 ); // points
+ createMenu( 4051, parentId, 10 ); // wireframe
+ createMenu( 4052, parentId, 10 ); // surface
+ createMenu( 4070, aMenuId, 10 ); // erase all
+ createMenu( 4071, aMenuId, 10 ); // global selection
+ createMenu( 4072, aMenuId, 10 ); // partial selection
+ createMenu( 4073, aMenuId, 10 ); // scaling
}
void
mgr->setRule( action( 4037 ), aRule, true );
// curve commands
- aPrsType = "$type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
- "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
aRule = "selcount=1 and type='VISU::TCURVE'";
mgr->insert( action( 4040 ), -1, -1, -1 ); // curve properties
mgr->setRule( action( 4040 ), aRule, true );
+
+ aPrsType = "$type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
+ "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
aRule = "client='ObjectBrowser' and selcount>1";
mgr->insert( action( 4034 ), -1, -1, -1 ); // display many
mgr->setRule( action( 4034 ), aRule + " and (" + aCurveType + " or " + aPrsType + ")", true );
mgr->insert( action( 4044 ), -1, -1, -1 ); // clear container
mgr->setRule( action( 4044 ), aRule, true );
+ aRule = "selcount=1 and ";
+ mgr->insert( action( 4062 ), -1, -1, -1 ); // edit prs
+ mgr->setRule( action( 4062 ), aRule + aPrsType, true );
+
aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
mgr->insert( action( 4063 ), -1, -1, -1 ); // create table
mgr->setRule( action( 4063 ), aRule, true );
//
//
// File : SALOMEGUI_NonIsometricDlg.cxx
-// Author : Vasily Rusyaev
+// Author : Vasily Rusyaev
// Module : VISU
-// $Header$
+// $Header$
#include "VisuGUI_NonIsometricDlg.h"
-#include "VisuGUI_Selection.h"
-#include "VisuGUI.h"
+
+#include "VisuGUI_Tools.h"
+
#include "VISU_Actor.h"
#include "VISU_PipeLine.hxx"
-#include "QtxDblSpinBox.h"
-
#include "SalomeApp_Application.h"
#include "SalomeApp_SelectionMgr.h"
+#include "SVTK_ViewWindow.h"
#include "SVTK_RenderWindowInteractor.h"
#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
#include "SUIT_ViewWindow.h"
-#include "VTKViewer_ViewWindow.h"
-#include "utilities.h"
-#include "SALOME_Selection.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SALOME_ListIO.hxx"
+#include "QtxDblSpinBox.h"
+
+#include "utilities.h"
+
#include <qgroupbox.h>
#include <qlabel.h>
#include <qpushbutton.h>
setName("NonIsometricDlg");
setCaption(tr("DLG_TITLE"));
setSizeGripEnabled(TRUE);
-
- SUIT_ViewWindow* sf = VisuGUI::application()->activeViewManager()->getActiveView();
- VTKViewer_ViewWindow* aViewWnd = dynamic_cast<VTKViewer_ViewWindow*>(sf);
+
+ SVTK_ViewWindow* aViewWnd = VISU::GetViewWindow();
// Create layout for this dialog
- QGridLayout* layoutDlg = new QGridLayout( this );
+ QGridLayout* layoutDlg = new QGridLayout (this);
layoutDlg->setSpacing(6);
layoutDlg->setMargin(11);
-
+
// Create croup box with grid layout
- QGroupBox* GroupBox = new QGroupBox( this, "GroupBox" );
- QGridLayout* glGroupBox = new QGridLayout( GroupBox );
+ QGroupBox* GroupBox = new QGroupBox(this, "GroupBox");
+ QGridLayout* glGroupBox = new QGridLayout(GroupBox);
glGroupBox->setMargin(11);
glGroupBox->setSpacing(6);
-
+
// "X" scaling
QLabel* TextLabelX = new QLabel (tr("LBL_X"), GroupBox, "TextLabelX");
- m_sbXcoeff = new QtxDblSpinBox( -DBL_MAX, DBL_MAX, 0.1, GroupBox );
-//m_sbXcoeff->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
- m_sbXcoeff->setMinimumWidth( 80 );
- m_sbXcoeff->setValue( 1.0 );
-
+ m_sbXcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox);
+ m_sbXcoeff->setMinimumWidth(80);
+ m_sbXcoeff->setValue(1.0);
+
// "Y" scaling
QLabel* TextLabelY = new QLabel (tr("LBL_Y"), GroupBox, "TextLabelY");
- m_sbYcoeff = new QtxDblSpinBox( -DBL_MAX, DBL_MAX, 0.1, GroupBox );
-//m_sbYcoeff->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
- m_sbYcoeff->setMinimumWidth( 80 );
- m_sbYcoeff->setValue( 1.0 );
-
+ m_sbYcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox);
+ m_sbYcoeff->setMinimumWidth(80);
+ m_sbYcoeff->setValue(1.0);
+
// "Z" scaling
QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), GroupBox, "TextLabelZ");
- m_sbZcoeff = new QtxDblSpinBox( -DBL_MAX, DBL_MAX, 0.1, GroupBox );
-//m_sbZcoeff->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
- m_sbZcoeff->setMinimumWidth( 80 );
- m_sbZcoeff->setValue( 1.0 );
+ m_sbZcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox);
+ m_sbZcoeff->setMinimumWidth(80);
+ m_sbZcoeff->setValue(1.0);
// Get initial values from the current VTK viewer
- if ( aViewWnd ) {
+ if (aViewWnd) {
double aScaleFactor[3];
aViewWnd->GetScale(aScaleFactor);
m_sbXcoeff -> setValue(aScaleFactor[0]);
}
// Create <Reset> button
- m_bReset = new QPushButton( tr( "&Reset" ), GroupBox, "m_bReset" );
+ m_bReset = new QPushButton(tr("&Reset"), GroupBox, "m_bReset");
// Layout widgets in the group box
- glGroupBox->addWidget( TextLabelX, 0, 0 );
- glGroupBox->addWidget( m_sbXcoeff, 0, 1 );
- glGroupBox->addWidget( TextLabelY, 0, 2 );
- glGroupBox->addWidget( m_sbYcoeff, 0, 3 );
- glGroupBox->addWidget( TextLabelZ, 0, 4 );
- glGroupBox->addWidget( m_sbZcoeff, 0, 5 );
- glGroupBox->addWidget( m_bReset, 0, 6 );
-
+ glGroupBox->addWidget(TextLabelX, 0, 0);
+ glGroupBox->addWidget(m_sbXcoeff, 0, 1);
+ glGroupBox->addWidget(TextLabelY, 0, 2);
+ glGroupBox->addWidget(m_sbYcoeff, 0, 3);
+ glGroupBox->addWidget(TextLabelZ, 0, 4);
+ glGroupBox->addWidget(m_sbZcoeff, 0, 5);
+ glGroupBox->addWidget(m_bReset, 0, 6);
+
// OK, CANCEL, Apply button
- QGroupBox* aWgt = new QGroupBox( this );
- QHBoxLayout* aHBoxLayout = new QHBoxLayout( aWgt );
+ QGroupBox* aWgt = new QGroupBox(this);
+ QHBoxLayout* aHBoxLayout = new QHBoxLayout(aWgt);
aHBoxLayout->setMargin(11);
aHBoxLayout->setSpacing(6);
// Create <OK> button
- QPushButton* m_bOk = new QPushButton( tr( "O&K" ), aWgt, "m_bOk" );
- m_bOk->setDefault( TRUE );
- m_bOk->setAutoDefault( TRUE );
+ QPushButton* m_bOk = new QPushButton(tr("O&K"), aWgt, "m_bOk");
+ m_bOk->setDefault(TRUE);
+ m_bOk->setAutoDefault(TRUE);
// Create <Apply> button
- QPushButton* m_bApply = new QPushButton( tr( "&Apply" ), aWgt, "m_bApply" );
- m_bApply->setAutoDefault( TRUE );
+ QPushButton* m_bApply = new QPushButton(tr("&Apply"), aWgt, "m_bApply");
+ m_bApply->setAutoDefault(TRUE);
// Create <Cancel> button
- QPushButton* m_bCancel = new QPushButton( tr( "&Cancel" ), aWgt, "m_bCancel" );
- m_bCancel->setAutoDefault( TRUE );
+ QPushButton* m_bCancel = new QPushButton(tr("&Cancel"), aWgt, "m_bCancel");
+ m_bCancel->setAutoDefault(TRUE);
// Layout buttons
- aHBoxLayout->addWidget( m_bOk );
- aHBoxLayout->addWidget( m_bApply );
+ aHBoxLayout->addWidget(m_bOk);
+ aHBoxLayout->addWidget(m_bApply);
aHBoxLayout->addStretch();
- aHBoxLayout->addWidget( m_bCancel );
+ aHBoxLayout->addWidget(m_bCancel);
// Layout top level widgets
layoutDlg->addWidget(GroupBox,0,0);
layoutDlg->addWidget(aWgt,1,0);
// signals and slots connections
- connect( m_bCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
- connect( m_bOk, SIGNAL( clicked() ), this, SLOT( onClickOk( ) ) );
- connect( m_bApply, SIGNAL( clicked() ), this, SLOT( onClickApply( ) ) );
- connect( m_bReset, SIGNAL( clicked() ), this, SLOT( onClickReset( ) ) );
-
- this->resize( 100, this->sizeHint().height() );
+ connect(m_bCancel, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(m_bOk, SIGNAL(clicked()), this, SLOT(onClickOk()));
+ connect(m_bApply, SIGNAL(clicked()), this, SLOT(onClickApply()));
+ connect(m_bReset, SIGNAL(clicked()), this, SLOT(onClickReset()));
+
+ this->resize(100, this->sizeHint().height());
}
-/*
+/*
* Destroys the object and frees any allocated resources
*/
VisuGUI_NonIsometricDlg::~VisuGUI_NonIsometricDlg()
{
- // no need to delete child widgets, Qt does it all for us
+ // no need to delete child widgets, Qt does it all for us
}
void VisuGUI_NonIsometricDlg::onClickOk()
accept();
}
-void VisuGUI_NonIsometricDlg::onClickApply(){
- SUIT_ViewWindow* sf = VisuGUI::application()->activeViewManager()->getActiveView();
- SalomeApp_SelectionMgr* mgr = VisuGUI::application()->selectionMgr();
-
+void VisuGUI_NonIsometricDlg::onClickApply()
+{
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
+ (SUIT_Session::session()->activeApplication());
+ SalomeApp_SelectionMgr* mgr = anApp->selectionMgr();
- VTKViewer_ViewWindow* vf = dynamic_cast<VTKViewer_ViewWindow*>(sf);
- if( !vf )
+ SVTK_ViewWindow* vf = VISU::GetViewWindow();
+ if (!vf)
return;
-
+
double aScale[3] = {m_sbXcoeff->value(), m_sbYcoeff->value(), m_sbZcoeff->value()};
vf->SetScale(aScale);
SALOME_ListIO selected;
- mgr->selectedObjects( selected );
- SALOME_ListIteratorOfListIO Itinit( selected );
- SVTK_RenderWindowInteractor* rw = dynamic_cast<SVTK_RenderWindowInteractor*>( vf->getRWInteractor() );
+ mgr->selectedObjects(selected);
+ SALOME_ListIteratorOfListIO Itinit(selected);
+ SVTK_RenderWindowInteractor* rw = dynamic_cast<SVTK_RenderWindowInteractor*>(vf->getRWInteractor());
- if( rw )
+ if (rw)
for (; Itinit.More(); Itinit.Next()) {
rw->highlight(Itinit.Value(), true);
}
void VisuGUI_NonIsometricDlg::onClickReset()
{
m_bReset->setFocus();
- m_sbXcoeff->setValue( 1.0 );
- m_sbYcoeff->setValue( 1.0 );
- m_sbZcoeff->setValue( 1.0 );
+ m_sbXcoeff->setValue(1.0);
+ m_sbYcoeff->setValue(1.0);
+ m_sbZcoeff->setValue(1.0);
}
-