From e6f2c3d6970727bebc8a54a7039880c8550248fa Mon Sep 17 00:00:00 2001 From: ouv Date: Thu, 30 Sep 2010 14:49:34 +0000 Subject: [PATCH] Issue 0020874: [CEA] Graduated axes in GEOM --- configure.ac | 1 + doc/salome/gui/images/graduatedaxes2.png | Bin 0 -> 16385 bytes doc/salome/gui/input/occ_3d_viewer.doc | 36 ++ src/LightApp/resources/LightApp.xml | 1 + src/Makefile.am | 10 +- src/OCCViewer/Makefile.am | 15 +- src/OCCViewer/OCCViewer_CubeAxesDlg.cxx | 321 +++++++++++++++++ src/OCCViewer/OCCViewer_CubeAxesDlg.h | 99 ++++++ src/OCCViewer/OCCViewer_FontWidget.cxx | 99 ++++++ src/OCCViewer/OCCViewer_FontWidget.h | 50 +++ src/OCCViewer/OCCViewer_ViewModel.h | 41 +++ src/OCCViewer/OCCViewer_ViewWindow.cxx | 326 ++++++++++++++++-- src/OCCViewer/OCCViewer_ViewWindow.h | 6 +- src/OCCViewer/resources/OCCViewer_images.ts | 4 + src/OCCViewer/resources/OCCViewer_msg_en.ts | 8 + .../resources/occ_view_graduated_axes.png | Bin 0 -> 650 bytes src/SVTK/Makefile.am | 11 +- src/SVTK/SVTK_CubeAxesDlg.cxx | 298 ++-------------- src/SVTK/SVTK_CubeAxesDlg.h | 55 ++- src/SVTK/SVTK_FontWidget.cxx | 78 ++--- src/SVTK/SVTK_FontWidget.h | 28 +- src/SVTK/SVTK_NonIsometricDlg.cxx | 6 +- src/SVTK/SVTK_NonIsometricDlg.h | 4 +- src/SVTK/SVTK_SetRotationPointDlg.cxx | 6 +- src/SVTK/SVTK_SetRotationPointDlg.h | 4 +- src/SVTK/SVTK_UpdateRateDlg.cxx | 6 +- src/SVTK/SVTK_UpdateRateDlg.h | 4 +- src/SVTK/SVTK_ViewParameterDlg.cxx | 2 +- src/SVTK/SVTK_ViewParameterDlg.h | 4 +- src/SVTK/SVTK_ViewWindow.cxx | 1 + src/SVTK/resources/SVTK_msg_en.ts | 67 ---- src/SalomeApp/resources/SalomeApp.xml | 1 + src/ViewerTools/Makefile.am | 55 +++ src/ViewerTools/ViewerTools.h | 41 +++ .../ViewerTools_CubeAxesDlgBase.cxx | 322 +++++++++++++++++ src/ViewerTools/ViewerTools_CubeAxesDlgBase.h | 119 +++++++ src/ViewerTools/ViewerTools_DialogBase.cxx | 79 +++++ src/ViewerTools/ViewerTools_DialogBase.h | 54 +++ .../ViewerTools_FontWidgetBase.cxx | 128 +++++++ src/ViewerTools/ViewerTools_FontWidgetBase.h | 71 ++++ .../resources/ViewerTools_msg_en.ts | 95 +++++ 41 files changed, 2051 insertions(+), 505 deletions(-) create mode 100644 doc/salome/gui/images/graduatedaxes2.png create mode 100644 src/OCCViewer/OCCViewer_CubeAxesDlg.cxx create mode 100644 src/OCCViewer/OCCViewer_CubeAxesDlg.h create mode 100644 src/OCCViewer/OCCViewer_FontWidget.cxx create mode 100644 src/OCCViewer/OCCViewer_FontWidget.h create mode 100755 src/OCCViewer/resources/occ_view_graduated_axes.png create mode 100755 src/ViewerTools/Makefile.am create mode 100644 src/ViewerTools/ViewerTools.h create mode 100644 src/ViewerTools/ViewerTools_CubeAxesDlgBase.cxx create mode 100644 src/ViewerTools/ViewerTools_CubeAxesDlgBase.h create mode 100644 src/ViewerTools/ViewerTools_DialogBase.cxx create mode 100644 src/ViewerTools/ViewerTools_DialogBase.h create mode 100644 src/ViewerTools/ViewerTools_FontWidgetBase.cxx create mode 100644 src/ViewerTools/ViewerTools_FontWidgetBase.h create mode 100644 src/ViewerTools/resources/ViewerTools_msg_en.ts diff --git a/configure.ac b/configure.ac index bc7d43df9..2ccf2effd 100644 --- a/configure.ac +++ b/configure.ac @@ -625,6 +625,7 @@ AC_OUTPUT([ \ src/ObjBrowser/Makefile \ src/Prs/Makefile \ src/OBJECT/Makefile \ + src/ViewerTools/Makefile \ src/GLViewer/Makefile \ src/VTKViewer/Makefile \ src/SVTK/Makefile \ diff --git a/doc/salome/gui/images/graduatedaxes2.png b/doc/salome/gui/images/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%(&m3LcB0#pToA47j=N@b5O=4%g) zu$FPm4$nHH7cyWx0V3Zl?LOzp#y+`6u@F4bVp0>}R^2vIbbfgO5eF4tHjW%%bmdRG z#q;H2bC|C2C_+7E*47xA&oO5_Y;V6!|MV<(6$Vyn1j}NzSazN&1&RE zI48^0uHP0Q+AG@Inqxfe0^zp2iNBV(cOUv7g5tR7pJ~Rsc97`;?wx*veffx2o>Kqf z{mVHw-x1D}4~;aKh+i&rI(-dXBkG?0GnfsbuAR%Rvl9{&G!e0Su>3ib4`WkUd**EK z0O6xQcy@tLUjV-=Bj8Ic2kca0Kh#|Jlv>6u!vean->B* zJV%>Dm0Dl4q9VjpdvXqZs~<0MxV|n|tvHL=$AW+tF#4AIO6nX0;=Z_CYb)7~-WVy` zg$1l5k@1Vhzt!(%mmI-*_~pVa&&%(;UAFwwt|?YA+l>e%Kn`ga>7|Abpa?EPw%~mv zm|G?=h*;E;2$>~?e!a \image html occviewer_axialscale.png \n
Scaling - represents objects deformed (stretched or stuffed) along the axes of coordinates.
+
+ +\image html image109.png +\n
Graduated axes - allows to define parameters of axes +and graduate them (available only with Open CASCADE 6.3 service pack 10)
+ +\image html graduatedaxes2.png + +
    +
  • Axis name
  • +
      +
    • Is visible - if checked the axis name is displayed in the +viewer.
    • +
    • Name - allows to redefine the name of the axis.
    • +
    • Font - allows to define color of the font of +axis name.
    • +
    +
  • Labels
  • +
      +
    • Is visible - if checked the labels are displayed in the +viewer.
    • +
    • Number - allows to define the number of labels.
    • +
    • Offset - allows to define the distance between labels.
    • +
    • Font - allows to define color of the font of +labels names.
    • +
    +
  • Tick marks
  • +
      +
    • Is visible - if checked the tick marks are displayed in the +viewer.
    • +
    • Length - allows to define the length of tick marks.
    • +
    +
  • Is visible - if checked the axis is displayed in the +viewer.
  • +
+
Note! OCC Viewer features a special Polyline Selection mechanism, which allows selecting an arbitraty part of the graphic area using a polygon frame, instead of the usual selection with a rectangular frame. diff --git a/src/LightApp/resources/LightApp.xml b/src/LightApp/resources/LightApp.xml index bdfbfae04..ba6c4c54e 100644 --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@ -60,6 +60,7 @@ + diff --git a/src/Makefile.am b/src/Makefile.am index 8b684ec2e..7d4de20d2 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -49,6 +49,7 @@ if ENABLE_VTKVIEWER SUBDIRS_VTKVIEWER = VTKViewer if ENABLE_SALOMEOBJECT SUBDIRS_VTKVIEWER += SVTK + SUBDIRS_VIEWERTOOLS = ViewerTools endif endif @@ -57,6 +58,7 @@ endif ## if ENABLE_OCCVIEWER SUBDIRS_OCCVIEWER = OCCViewer + SUBDIRS_VIEWERTOOLS = ViewerTools if ENABLE_SALOMEOBJECT SUBDIRS_OCCVIEWER += SOCC endif @@ -114,10 +116,10 @@ if ENABLE_PYCONSOLE SUBDIRS_PY_LIGHT = SALOME_SWIG SALOME_PY SALOME_PYQT endif -SUBDIRS = $(SUBDIRS_COMMON) $(SUBDIRS_OBJECT) $(SUBDIRS_GLVIEWER) $(SUBDIRS_VTKVIEWER) $(SUBDIRS_OCCVIEWER) \ - $(SUBDIRS_PLOT2DVIEWER) $(SUBDIRS_SUPERVGRAPHVIEWER) $(SUBDIRS_QXGRAPHVIEWER) $(SUBDIRS_PYCONSOLE) \ - $(SUBDIRS_LIGHT) $(SUBDIRS_CORBA) $(SUBDIRS_PY_LIGHT) +SUBDIRS = $(SUBDIRS_COMMON) $(SUBDIRS_OBJECT) $(SUBDIRS_VIEWERTOOLS) $(SUBDIRS_GLVIEWER) $(SUBDIRS_VTKVIEWER) \ + $(SUBDIRS_OCCVIEWER) $(SUBDIRS_PLOT2DVIEWER) $(SUBDIRS_SUPERVGRAPHVIEWER) $(SUBDIRS_QXGRAPHVIEWER) \ + $(SUBDIRS_PYCONSOLE) $(SUBDIRS_LIGHT) $(SUBDIRS_CORBA) $(SUBDIRS_PY_LIGHT) DIST_SUBDIRS = CASCatch Qtx Style DDS QDS ObjBrowser SUIT SUITApp STD CAF CAM LogWindow Prs Event OpenGLUtils \ - OBJECT GLViewer VTKViewer SVTK OCCViewer SOCC Plot2d SPlot2d SUPERVGraph QxGraph QxScene \ + OBJECT ViewerTools GLViewer VTKViewer SVTK OCCViewer SOCC Plot2d SPlot2d SUPERVGraph QxGraph QxScene \ PyInterp PyConsole LightApp ResExporter TOOLSGUI Session SalomeApp SALOME_SWIG SALOME_PY SALOME_PYQT diff --git a/src/OCCViewer/Makefile.am b/src/OCCViewer/Makefile.am index a9ab7c7c7..4d56e731b 100755 --- a/src/OCCViewer/Makefile.am +++ b/src/OCCViewer/Makefile.am @@ -44,6 +44,8 @@ salomeinclude_HEADERS = \ OCCViewer_AxialScaleDlg.h \ OCCViewer_SetRotationPointDlg.h \ OCCViewer_Trihedron.h \ + OCCViewer_FontWidget.h \ + OCCViewer_CubeAxesDlg.h \ OCCViewer_ToolTip.h dist_libOCCViewer_la_SOURCES = \ @@ -60,6 +62,8 @@ dist_libOCCViewer_la_SOURCES = \ OCCViewer_ClippingDlg.cxx \ OCCViewer_AxialScaleDlg.cxx \ OCCViewer_Trihedron.cxx \ + OCCViewer_FontWidget.cxx \ + OCCViewer_CubeAxesDlg.cxx \ OCCViewer_ToolTip.cxx MOC_FILES = \ @@ -74,8 +78,10 @@ MOC_FILES = \ OCCViewer_SetRotationPointDlg_moc.cxx \ OCCViewer_ClippingDlg_moc.cxx \ OCCViewer_AxialScaleDlg_moc.cxx \ + OCCViewer_FontWidget_moc.cxx \ + OCCViewer_CubeAxesDlg_moc.cxx \ OCCViewer_ToolTip_moc.cxx - + nodist_libOCCViewer_la_SOURCES = $(MOC_FILES) dist_salomeres_DATA = \ @@ -86,6 +92,7 @@ dist_salomeres_DATA = \ resources/occ_view_clipping.png \ resources/occ_view_clipping_pressed.png \ resources/occ_view_scaling.png \ + resources/occ_view_graduated_axes.png \ resources/occ_view_ambient.png \ resources/occ_view_fitall.png \ resources/occ_view_fitarea.png \ @@ -109,7 +116,9 @@ nodist_salomeres_DATA = \ OCCViewer_msg_fr.qm libOCCViewer_la_CPPFLAGS = $(QT_INCLUDES) $(OGL_INCLUDES) $(CAS_CPPFLAGS) \ - -I$(srcdir)/../SUIT -I$(srcdir)/../Qtx -I$(srcdir)/../OpenGLUtils + -I$(srcdir)/../SUIT -I$(srcdir)/../ViewerTools -I$(srcdir)/../Qtx \ + -I$(srcdir)/../OpenGLUtils libOCCViewer_la_LDFLAGS = $(OGL_LIBS) $(QT_MT_LIBS) $(CAS_KERNEL) $(CAS_VIEWER) -libOCCViewer_la_LIBADD = ../Qtx/libqtx.la ../SUIT/libsuit.la ../OpenGLUtils/libOpenGLUtils.la +libOCCViewer_la_LIBADD = ../Qtx/libqtx.la ../SUIT/libsuit.la \ + ../ViewerTools/libViewerTools.la ../OpenGLUtils/libOpenGLUtils.la diff --git a/src/OCCViewer/OCCViewer_CubeAxesDlg.cxx b/src/OCCViewer/OCCViewer_CubeAxesDlg.cxx new file mode 100644 index 000000000..198b0f57a --- /dev/null +++ b/src/OCCViewer/OCCViewer_CubeAxesDlg.cxx @@ -0,0 +1,321 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "OCCViewer_CubeAxesDlg.h" + +#include "OCCViewer_FontWidget.h" +#include "OCCViewer_ViewPort3d.h" +#include "OCCViewer_ViewWindow.h" + +#include "QtxAction.h" +#include "QtxIntSpinBox.h" + +#include +#include +#include + +#include + +#ifdef OCC_VERSION_SERVICEPACK +#define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8 | OCC_VERSION_SERVICEPACK) +#else +#define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8) +#endif + +/*! + \class OCCViewer_CubeAxesDlg::AxisWidget + \brief Axis tab widget of the "Graduated axis" dialog box + \internal +*/ + +/*! + Constructor +*/ +OCCViewer_AxisWidget::OCCViewer_AxisWidget (QWidget* theParent) +: ViewerTools_AxisWidgetBase(theParent) +{ +} + +/*! + Destructor +*/ +OCCViewer_AxisWidget::~OCCViewer_AxisWidget() +{ +} + +/*! + Create font widget +*/ +ViewerTools_FontWidgetBase* OCCViewer_AxisWidget::createFontWidget( QWidget* theParent ) +{ + OCCViewer_FontWidget* aFontWidget = new OCCViewer_FontWidget( theParent ); + aFontWidget->Initialize(); + return aFontWidget; +} + +/*! + Set axis data +*/ +void OCCViewer_AxisWidget::SetData( const AxisData& theAxisData ) +{ + myNameGrp->setChecked( theAxisData.DrawName ); + myAxisName->setText( theAxisData.Name ); + myNameFont->SetData( theAxisData.NameColor, 0, false, false, false ); + + myLabelsGrp->setChecked( theAxisData.DrawValues ); + myLabelNumber->setValue( theAxisData.NbValues ); + myLabelOffset->setValue( theAxisData.Offset ); + myLabelsFont->SetData( theAxisData.Color, 0, false, false, false ); + + myTicksGrp->setChecked( theAxisData.DrawTickmarks ); + myTickLength->setValue( theAxisData.TickmarkLength ); +} + +/*! + Get axis data +*/ +void OCCViewer_AxisWidget::GetData( AxisData& theAxisData ) +{ + theAxisData.DrawName = myNameGrp->isChecked(); + theAxisData.Name = myAxisName->text(); + + int aNameFamily; + bool aNameBold, aNameItalic, aNameShadow; + myNameFont->GetData( theAxisData.NameColor, aNameFamily, aNameBold, aNameItalic, aNameShadow ); + + theAxisData.DrawValues = myLabelsGrp->isChecked(); + theAxisData.NbValues = myLabelNumber->value(); + theAxisData.Offset = myLabelOffset->value(); + + int aLabelFamily; + bool aLabelBold, aLabelItalic, aLabelShadow; + myLabelsFont->GetData( theAxisData.Color, aLabelFamily, aLabelBold, aLabelItalic, aLabelShadow ); + + theAxisData.DrawTickmarks = myTicksGrp->isChecked(); + theAxisData.TickmarkLength = myTickLength->value(); +} + +/* + Class : OCCViewer_CubeAxesDlg + Description : Dialog for specifying cube axes properties +*/ + +/*! + Constructor +*/ +OCCViewer_CubeAxesDlg::OCCViewer_CubeAxesDlg(QtxAction* theAction, + OCCViewer_ViewWindow* theParent, + const char* theName): + ViewerTools_CubeAxesDlgBase(theAction, + theParent, + theName), + myMainWindow(theParent) +{ +} + +/*! + Destructor +*/ +OCCViewer_CubeAxesDlg::~OCCViewer_CubeAxesDlg() +{ +} + +/*! + Create axis widget +*/ +ViewerTools_AxisWidgetBase* OCCViewer_CubeAxesDlg::createAxisWidget( QWidget* theParent ) +{ + OCCViewer_AxisWidget* anAxisWidget = new OCCViewer_AxisWidget( theParent ); + anAxisWidget->initialize(); + return anAxisWidget; +} + +/*! + Update dialog fields, connect signals and slots, show dialog +*/ +void OCCViewer_CubeAxesDlg::initialize() +{ + ViewerTools_CubeAxesDlgBase::initialize(); + + for( int i = 0; i < 3; i++ ) + { + if( OCCViewer_AxisWidget* anAxisWidget = dynamic_cast( myAxes[ i ] ) ) + { + OCCViewer_AxisWidget::AxisData anAxisData; + switch( i ) + { + case 0: + anAxisData.Name = "X"; + anAxisData.NameColor = anAxisData.Color = Qt::red; + break; + case 1: + anAxisData.Name = "Y"; + anAxisData.NameColor = anAxisData.Color = Qt::green; + break; + case 2: + anAxisData.Name = "Z"; + anAxisData.NameColor = anAxisData.Color = Qt::blue; + break; + } + anAxisData.DrawName = true; + anAxisData.DrawValues = true; + anAxisData.NbValues = 3; + anAxisData.Offset = 2; + anAxisData.DrawTickmarks = true; + anAxisData.TickmarkLength = 5; + anAxisWidget->SetData( anAxisData ); + } + } +} + +/*! + Update dialog fields, connect signals and slots, show dialog +*/ +void OCCViewer_CubeAxesDlg::Update() +{ + ViewerTools_CubeAxesDlgBase::Update(); +} + +/*! + Verify validity of entry data +*/ +bool OCCViewer_CubeAxesDlg::onApply() +{ + bool isOk = ViewerTools_CubeAxesDlgBase::onApply(); + + try + { + QWidget *aCurrWid = this->focusWidget(); + aCurrWid->clearFocus(); + aCurrWid->setFocus(); + + if( OCCViewer_ViewPort3d* aViewPort = myMainWindow->getViewPort() ) + { + Handle(V3d_View) aView = aViewPort->getView(); + if( !aView.IsNull() ) + ApplyData( aView ); + } + } + catch(...) + { + isOk = false; + } + + return isOk; +} + +/*! + Get graduated trihedron parameters +*/ +void OCCViewer_CubeAxesDlg::GetData( bool& theIsVisible, OCCViewer_AxisWidget::AxisData theAxisData[3] ) +{ + theIsVisible = myIsVisible->isChecked(); + for( int i = 0; i < 3; i++ ) + if( OCCViewer_AxisWidget* anAxisWidget = dynamic_cast( myAxes[ i ] ) ) + anAxisWidget->GetData( theAxisData[i] ); +} + +/*! + Set graduated trihedron parameters +*/ +void OCCViewer_CubeAxesDlg::SetData( bool theIsVisible, OCCViewer_AxisWidget::AxisData theAxisData[3] ) +{ + myIsVisible->setChecked( theIsVisible ); + for( int i = 0; i < 3; i++ ) + if( OCCViewer_AxisWidget* anAxisWidget = dynamic_cast( myAxes[ i ] ) ) + anAxisWidget->SetData( theAxisData[i] ); +} + +/*! + Apply graduated trihedron parameters +*/ +void OCCViewer_CubeAxesDlg::ApplyData( const Handle(V3d_View)& theView ) +{ +#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version + if( theView.IsNull() ) + return; + + if( myIsVisible->isChecked() ) + { + OCCViewer_AxisWidget::AxisData anAxisData[3]; + for( int i = 0; i < 3; i++ ) + if( OCCViewer_AxisWidget* anAxisWidget = dynamic_cast( myAxes[ i ] ) ) + anAxisWidget->GetData( anAxisData[i] ); + + theView->GraduatedTrihedronDisplay( + anAxisData[0].Name.toLatin1().constData(), + anAxisData[1].Name.toLatin1().constData(), + anAxisData[2].Name.toLatin1().constData(), + anAxisData[0].DrawName, + anAxisData[1].DrawName, + anAxisData[2].DrawName, + anAxisData[0].DrawValues, + anAxisData[1].DrawValues, + anAxisData[2].DrawValues, + Standard_True, // draw grid + anAxisData[0].NbValues - 1, + anAxisData[1].NbValues - 1, + anAxisData[2].NbValues - 1, + anAxisData[0].Offset, + anAxisData[1].Offset, + anAxisData[2].Offset, + anAxisData[0].Offset + 20, // tmp + anAxisData[1].Offset + 20, // tmp + anAxisData[2].Offset + 20, // tmp + anAxisData[0].DrawTickmarks, + anAxisData[1].DrawTickmarks, + anAxisData[2].DrawTickmarks, + anAxisData[0].TickmarkLength, + anAxisData[1].TickmarkLength, + anAxisData[2].TickmarkLength, + Quantity_NOC_WHITE, // grid color + Quantity_Color( anAxisData[0].NameColor.redF(), + anAxisData[0].NameColor.greenF(), + anAxisData[0].NameColor.blueF(), + Quantity_TOC_RGB ), + Quantity_Color( anAxisData[1].NameColor.redF(), + anAxisData[1].NameColor.greenF(), + anAxisData[1].NameColor.blueF(), + Quantity_TOC_RGB ), + Quantity_Color( anAxisData[2].NameColor.redF(), + anAxisData[2].NameColor.greenF(), + anAxisData[2].NameColor.blueF(), + Quantity_TOC_RGB ), + Quantity_Color( anAxisData[0].Color.redF(), + anAxisData[0].Color.greenF(), + anAxisData[0].Color.blueF(), + Quantity_TOC_RGB ), + Quantity_Color( anAxisData[1].Color.redF(), + anAxisData[1].Color.greenF(), + anAxisData[1].Color.blueF(), + Quantity_TOC_RGB ), + Quantity_Color( anAxisData[2].Color.redF(), + anAxisData[2].Color.greenF(), + anAxisData[2].Color.blueF(), + Quantity_TOC_RGB ) ); + } + else + theView->GraduatedTrihedronErase(); + + theView->Redraw(); +#endif +} diff --git a/src/OCCViewer/OCCViewer_CubeAxesDlg.h b/src/OCCViewer/OCCViewer_CubeAxesDlg.h new file mode 100644 index 000000000..b570d380c --- /dev/null +++ b/src/OCCViewer/OCCViewer_CubeAxesDlg.h @@ -0,0 +1,99 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef OCCVIEWER_CUBEAXESDLG_H +#define OCCVIEWER_CUBEAXESDLG_H + +#include "OCCViewer.h" + +#include + +#include + +class OCCViewer_ViewWindow; + +/*! + * Class : OCCViewer_AxisWidget + * Description : Axis tab widget of the "Graduated axis" dialog box +*/ +class OCCVIEWER_EXPORT OCCViewer_AxisWidget : public ViewerTools_AxisWidgetBase +{ +public: + struct AxisData + { + bool DrawName; + QString Name; + QColor NameColor; + bool DrawValues; + int NbValues; + int Offset; + QColor Color; + bool DrawTickmarks; + int TickmarkLength; + }; + +public: + OCCViewer_AxisWidget( QWidget* ); + ~OCCViewer_AxisWidget(); + +public: + void SetData( const AxisData& ); + void GetData( AxisData& ); + +protected: + virtual ViewerTools_FontWidgetBase* createFontWidget( QWidget* ); +}; + +/*! + * Class : OCCViewer_CubeAxesDlg + * Description : Dialog for specifynig cube axes properties + */ +class OCCVIEWER_EXPORT OCCViewer_CubeAxesDlg : public ViewerTools_CubeAxesDlgBase +{ + Q_OBJECT + +public: + OCCViewer_CubeAxesDlg(QtxAction* theAction, + OCCViewer_ViewWindow* theParent, + const char* theName); + virtual ~OCCViewer_CubeAxesDlg(); + + virtual void initialize(); + + void GetData( bool& theIsVisible, OCCViewer_AxisWidget::AxisData theAxisData[3] ); + void SetData( bool theIsVisible, OCCViewer_AxisWidget::AxisData theAxisData[3] ); + + void ApplyData( const Handle(V3d_View)& theView ); + + virtual void Update(); + +private slots: + virtual bool onApply(); + +private: + virtual ViewerTools_AxisWidgetBase* createAxisWidget( QWidget* ); + +private: + OCCViewer_ViewWindow* myMainWindow; +}; + +#endif diff --git a/src/OCCViewer/OCCViewer_FontWidget.cxx b/src/OCCViewer/OCCViewer_FontWidget.cxx new file mode 100644 index 000000000..d0a61ae6c --- /dev/null +++ b/src/OCCViewer/OCCViewer_FontWidget.cxx @@ -0,0 +1,99 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "OCCViewer_FontWidget.h" + +#include + +//#include + +/*! + * Class : OCCViewer_FontWidget + * Description : Dialog for specifynig font + */ + +/*! + Constructor +*/ +OCCViewer_FontWidget::OCCViewer_FontWidget( QWidget* theParent ) +: ViewerTools_FontWidgetBase( theParent ) +{ +} + +/*! + Destructor +*/ +OCCViewer_FontWidget::~OCCViewer_FontWidget() +{ +} + +void OCCViewer_FontWidget::InitializeFamilies() +{ + //myFamily->insertItem( myFamily->count(), tr( "ARIAL" ) ); + //myFamily->insertItem( myFamily->count(), tr( "COURIER" ) ); + //myFamily->insertItem( myFamily->count(), tr( "TIMES" ) ); +} + +void OCCViewer_FontWidget::SetData( const QColor& theColor, + const int theFamily, + const bool theBold, + const bool theItalic, + const bool theShadow ) +{ + ViewerTools_FontWidgetBase::SetData( theColor, + theFamily, + theBold, + theItalic, + theShadow ); + + /* + if ( theFamily == VTK_ARIAL ) + myFamily->setCurrentIndex( 0 ); + else if ( theFamily == VTK_COURIER ) + myFamily->setCurrentIndex( 1 ); + else + myFamily->setCurrentIndex( 2 ); + */ +} + +void OCCViewer_FontWidget::GetData( QColor& theColor, + int& theFamily, + bool& theBold, + bool& theItalic, + bool& theShadow ) const +{ + ViewerTools_FontWidgetBase::GetData( theColor, + theFamily, + theBold, + theItalic, + theShadow ); + + /* + int anItem = myFamily->currentIndex(); + if ( anItem == 0 ) + theFamily = VTK_ARIAL; + else if ( anItem == 1 ) + theFamily = VTK_COURIER; + else + theFamily = VTK_TIMES; + */ +} diff --git a/src/OCCViewer/OCCViewer_FontWidget.h b/src/OCCViewer/OCCViewer_FontWidget.h new file mode 100644 index 000000000..506d583dd --- /dev/null +++ b/src/OCCViewer/OCCViewer_FontWidget.h @@ -0,0 +1,50 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef OCCVIEWER_FONTWIDGET_H +#define OCCVIEWER_FONTWIDGET_H + +#include "OCCViewer.h" + +#include + +/*! + * Class : OCCViewer_FontWidget + * Description : Dialog for specifynig font + */ +class OCCVIEWER_EXPORT OCCViewer_FontWidget : public ViewerTools_FontWidgetBase +{ + Q_OBJECT + +public: + OCCViewer_FontWidget( QWidget* ); + virtual ~OCCViewer_FontWidget(); + + virtual void SetData( const QColor&, const int, const bool, const bool, const bool ); + + virtual void GetData( QColor&, int&, bool&, bool&, bool& ) const; + +protected: + virtual void InitializeFamilies(); +}; + +#endif diff --git a/src/OCCViewer/OCCViewer_ViewModel.h b/src/OCCViewer/OCCViewer_ViewModel.h index 925b2dc05..fc0463e79 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.h +++ b/src/OCCViewer/OCCViewer_ViewModel.h @@ -65,6 +65,47 @@ public: QString name; bool isVisible; double size; + // graduated trihedron + bool gtIsVisible; + bool gtDrawNameX; + bool gtDrawNameY; + bool gtDrawNameZ; + QString gtNameX; + QString gtNameY; + QString gtNameZ; + int gtNameColorRX; + int gtNameColorGX; + int gtNameColorBX; + int gtNameColorRY; + int gtNameColorGY; + int gtNameColorBY; + int gtNameColorRZ; + int gtNameColorGZ; + int gtNameColorBZ; + bool gtDrawValuesX; + bool gtDrawValuesY; + bool gtDrawValuesZ; + int gtNbValuesX; + int gtNbValuesY; + int gtNbValuesZ; + int gtOffsetX; + int gtOffsetY; + int gtOffsetZ; + int gtColorRX; + int gtColorGX; + int gtColorBX; + int gtColorRY; + int gtColorGY; + int gtColorBY; + int gtColorRZ; + int gtColorGZ; + int gtColorBZ; + bool gtDrawTickmarksX; + bool gtDrawTickmarksY; + bool gtDrawTickmarksZ; + int gtTickmarkLengthX; + int gtTickmarkLengthY; + int gtTickmarkLengthZ; }; typedef QList viewAspectList; diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index fd0992fba..9ac36b842 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -32,6 +32,7 @@ #include "OCCViewer_ClippingDlg.h" #include "OCCViewer_SetRotationPointDlg.h" #include "OCCViewer_AxialScaleDlg.h" +#include "OCCViewer_CubeAxesDlg.h" #include #include @@ -73,6 +74,14 @@ #include #include +#include + +#ifdef OCC_VERSION_SERVICEPACK +#define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8 | OCC_VERSION_SERVICEPACK) +#else +#define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8) +#endif + static QEvent* l_mbPressEvent = 0; #ifdef WIN32 @@ -250,6 +259,11 @@ void OCCViewer_ViewWindow::initLayout() createActions(); createToolBar(); + + // Graduated axes dialog + QtxAction* anAction = dynamic_cast( toolMgr()->action( GraduatedAxesId ) ); + myCubeAxesDlg = new OCCViewer_CubeAxesDlg( anAction, this, "OCCViewer_CubeAxesDlg" ); + myCubeAxesDlg->initialize(); } /*! @@ -1131,6 +1145,13 @@ void OCCViewer_ViewWindow::createActions() connect(aAction, SIGNAL(triggered()), this, SLOT(onAxialScale())); toolMgr()->registerAction( aAction, AxialScaleId ); + // Graduated axes + aAction = new QtxAction(tr("MNU_GRADUATED_AXES"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_GRADUATED_AXES" ) ), + tr( "MNU_GRADUATED_AXES" ), 0, this); + aAction->setStatusTip(tr("DSC_GRADUATED_AXES")); + connect(aAction, SIGNAL(triggered()), this, SLOT(onGraduatedAxes())); + toolMgr()->registerAction( aAction, GraduatedAxesId ); + // Active only ambient light or not aAction = new QtxAction(tr("MNU_AMBIENT"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_AMBIENT" ) ), tr( "MNU_AMBIENT" ), 0, this); @@ -1195,6 +1216,9 @@ void OCCViewer_ViewWindow::createToolBar() toolMgr()->append( toolMgr()->separator(), tid ); toolMgr()->append( ClippingId, tid ); toolMgr()->append( AxialScaleId, tid ); +#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version + toolMgr()->append( GraduatedAxesId, tid ); +#endif toolMgr()->append( AmbientId, tid ); } @@ -1394,6 +1418,15 @@ void OCCViewer_ViewWindow::onAxialScale() myScalingDlg->show(); } +/*! + Shows Graduated Axes dialog +*/ +void OCCViewer_ViewWindow::onGraduatedAxes() +{ + myCubeAxesDlg->Update(); + myCubeAxesDlg->show(); +} + void OCCViewer_ViewWindow::onAmbientToogle() { Handle(V3d_Viewer) viewer = myViewPort->getViewer(); @@ -1453,6 +1486,54 @@ void OCCViewer_ViewWindow::performRestoring( const viewAspect& anItem ) myModel->setTrihedronShown( anItem.isVisible ); myModel->setTrihedronSize( anItem.size ); +#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version + // graduated trihedron + bool anIsVisible = anItem.gtIsVisible; + OCCViewer_AxisWidget::AxisData anAxisData[3]; + anAxisData[0].DrawName = anItem.gtDrawNameX; + anAxisData[1].DrawName = anItem.gtDrawNameZ; + anAxisData[2].DrawName = anItem.gtDrawNameZ; + anAxisData[0].Name = anItem.gtNameX; + anAxisData[1].Name = anItem.gtNameZ; + anAxisData[2].Name = anItem.gtNameZ; + anAxisData[0].NameColor = QColor( anItem.gtNameColorRX, + anItem.gtNameColorGX, + anItem.gtNameColorBX ); + anAxisData[1].NameColor = QColor( anItem.gtNameColorRY, + anItem.gtNameColorGY, + anItem.gtNameColorBY ); + anAxisData[2].NameColor = QColor( anItem.gtNameColorRZ, + anItem.gtNameColorGZ, + anItem.gtNameColorBZ ); + anAxisData[0].DrawValues = anItem.gtDrawValuesX; + anAxisData[1].DrawValues = anItem.gtDrawValuesY; + anAxisData[2].DrawValues = anItem.gtDrawValuesZ; + anAxisData[0].NbValues = anItem.gtNbValuesX; + anAxisData[1].NbValues = anItem.gtNbValuesY; + anAxisData[2].NbValues = anItem.gtNbValuesZ; + anAxisData[0].Offset = anItem.gtOffsetX; + anAxisData[1].Offset = anItem.gtOffsetY; + anAxisData[2].Offset = anItem.gtOffsetZ; + anAxisData[0].Color = QColor( anItem.gtColorRX, + anItem.gtColorGX, + anItem.gtColorBX ); + anAxisData[1].Color = QColor( anItem.gtColorRY, + anItem.gtColorGY, + anItem.gtColorBY ); + anAxisData[2].Color = QColor( anItem.gtColorRZ, + anItem.gtColorGZ, + anItem.gtColorBZ ); + anAxisData[0].DrawTickmarks = anItem.gtDrawTickmarksX; + anAxisData[1].DrawTickmarks = anItem.gtDrawTickmarksY; + anAxisData[2].DrawTickmarks = anItem.gtDrawTickmarksZ; + anAxisData[0].TickmarkLength = anItem.gtTickmarkLengthX; + anAxisData[1].TickmarkLength = anItem.gtTickmarkLengthY; + anAxisData[2].TickmarkLength = anItem.gtTickmarkLengthZ; + + myCubeAxesDlg->SetData( anIsVisible, anAxisData ); + myCubeAxesDlg->ApplyData( aView3d ); +#endif + myRestoreFlag = 0; } @@ -1681,6 +1762,54 @@ viewAspect OCCViewer_ViewWindow::getViewParams() const params.isVisible= isShown; params.size = size; +#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version + // graduated trihedron + bool anIsVisible = false; + OCCViewer_AxisWidget::AxisData anAxisData[3]; + myCubeAxesDlg->GetData( anIsVisible, anAxisData ); + + params.gtIsVisible = anIsVisible; + params.gtDrawNameX = anAxisData[0].DrawName; + params.gtDrawNameY = anAxisData[1].DrawName; + params.gtDrawNameZ = anAxisData[2].DrawName; + params.gtNameX = anAxisData[0].Name; + params.gtNameY = anAxisData[1].Name; + params.gtNameZ = anAxisData[2].Name; + params.gtNameColorRX = anAxisData[0].NameColor.red(); + params.gtNameColorGX = anAxisData[0].NameColor.green(); + params.gtNameColorBX = anAxisData[0].NameColor.blue(); + params.gtNameColorRY = anAxisData[1].NameColor.red(); + params.gtNameColorGY = anAxisData[1].NameColor.green(); + params.gtNameColorBY = anAxisData[1].NameColor.blue(); + params.gtNameColorRZ = anAxisData[2].NameColor.red(); + params.gtNameColorGZ = anAxisData[2].NameColor.green(); + params.gtNameColorBZ = anAxisData[2].NameColor.blue(); + params.gtDrawValuesX = anAxisData[0].DrawValues; + params.gtDrawValuesY = anAxisData[1].DrawValues; + params.gtDrawValuesZ = anAxisData[2].DrawValues; + params.gtNbValuesX = anAxisData[0].NbValues; + params.gtNbValuesY = anAxisData[1].NbValues; + params.gtNbValuesZ = anAxisData[2].NbValues; + params.gtOffsetX = anAxisData[0].Offset; + params.gtOffsetY = anAxisData[1].Offset; + params.gtOffsetZ = anAxisData[2].Offset; + params.gtColorRX = anAxisData[0].Color.red(); + params.gtColorGX = anAxisData[0].Color.green(); + params.gtColorBX = anAxisData[0].Color.blue(); + params.gtColorRY = anAxisData[1].Color.red(); + params.gtColorGY = anAxisData[1].Color.green(); + params.gtColorBY = anAxisData[1].Color.blue(); + params.gtColorRZ = anAxisData[2].Color.red(); + params.gtColorGZ = anAxisData[2].Color.green(); + params.gtColorBZ = anAxisData[2].Color.blue(); + params.gtDrawTickmarksX = anAxisData[0].DrawTickmarks; + params.gtDrawTickmarksY = anAxisData[1].DrawTickmarks; + params.gtDrawTickmarksZ = anAxisData[2].DrawTickmarks; + params.gtTickmarkLengthX = anAxisData[0].TickmarkLength; + params.gtTickmarkLengthY = anAxisData[1].TickmarkLength; + params.gtTickmarkLengthZ = anAxisData[2].TickmarkLength; +#endif + return params; } @@ -1693,11 +1822,71 @@ QString OCCViewer_ViewWindow::getVisualParameters() { viewAspect params = getViewParams(); QString retStr; - retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e", params.scale, - params.centerX, params.centerY, params.projX, params.projY, params.projZ, params.twist, - params.atX, params.atY, params.atZ, params.eyeX, params.eyeY, params.eyeZ, - params.scaleX, params.scaleY, params.scaleZ ); - retStr += QString().sprintf("*%u*%.2f", params.isVisible, params.size ); + + retStr += QString().sprintf( "scale=%.12e*", params.scale ); + retStr += QString().sprintf( "centerX=%.12e*", params.centerX ); + retStr += QString().sprintf( "centerY=%.12e*", params.centerY ); + retStr += QString().sprintf( "projX=%.12e*", params.projX ); + retStr += QString().sprintf( "projY=%.12e*", params.projY ); + retStr += QString().sprintf( "projZ=%.12e*", params.projZ ); + retStr += QString().sprintf( "twist=%.12e*", params.twist ); + retStr += QString().sprintf( "atX=%.12e*", params.atX ); + retStr += QString().sprintf( "atY=%.12e*", params.atY ); + retStr += QString().sprintf( "atZ=%.12e*", params.atZ ); + retStr += QString().sprintf( "eyeX=%.12e*", params.eyeX ); + retStr += QString().sprintf( "eyeY=%.12e*", params.eyeY ); + retStr += QString().sprintf( "eyeZ=%.12e*", params.eyeZ ); + retStr += QString().sprintf( "scaleX=%.12e*", params.scaleX ); + retStr += QString().sprintf( "scaleY=%.12e*", params.scaleY ); + retStr += QString().sprintf( "scaleZ=%.12e*", params.scaleZ ); + + retStr += QString().sprintf( "isVisible=%.u*", params.isVisible ); + retStr += QString().sprintf( "size=%.2f", params.size ); + +#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version + // graduated trihedron + retStr += QString().sprintf( "*gtIsVisible=%u*", params.gtIsVisible ); + retStr += QString().sprintf( "gtDrawNameX=%u*", params.gtDrawNameX ); + retStr += QString().sprintf( "gtDrawNameY=%u*", params.gtDrawNameY ); + retStr += QString().sprintf( "gtDrawNameZ=%u*", params.gtDrawNameZ ); + retStr += QString().sprintf( "gtNameX=%s*", params.gtNameX.toLatin1().constData() ); + retStr += QString().sprintf( "gtNameY=%s*", params.gtNameY.toLatin1().constData() ); + retStr += QString().sprintf( "gtNameZ=%s*", params.gtNameZ.toLatin1().constData() ); + retStr += QString().sprintf( "gtNameColorRX=%u*", params.gtNameColorRX ); + retStr += QString().sprintf( "gtNameColorGX=%u*", params.gtNameColorGX ); + retStr += QString().sprintf( "gtNameColorBX=%u*", params.gtNameColorBX ); + retStr += QString().sprintf( "gtNameColorRY=%u*", params.gtNameColorRY ); + retStr += QString().sprintf( "gtNameColorGY=%u*", params.gtNameColorGY ); + retStr += QString().sprintf( "gtNameColorBY=%u*", params.gtNameColorBY ); + retStr += QString().sprintf( "gtNameColorRZ=%u*", params.gtNameColorRZ ); + retStr += QString().sprintf( "gtNameColorGZ=%u*", params.gtNameColorGZ ); + retStr += QString().sprintf( "gtNameColorBZ=%u*", params.gtNameColorBZ ); + retStr += QString().sprintf( "gtDrawValuesX=%u*", params.gtDrawValuesX ); + retStr += QString().sprintf( "gtDrawValuesY=%u*", params.gtDrawValuesY ); + retStr += QString().sprintf( "gtDrawValuesZ=%u*", params.gtDrawValuesZ ); + retStr += QString().sprintf( "gtNbValuesX=%u*", params.gtNbValuesX ); + retStr += QString().sprintf( "gtNbValuesY=%u*", params.gtNbValuesY ); + retStr += QString().sprintf( "gtNbValuesZ=%u*", params.gtNbValuesZ ); + retStr += QString().sprintf( "gtOffsetX=%u*", params.gtOffsetX ); + retStr += QString().sprintf( "gtOffsetY=%u*", params.gtOffsetY ); + retStr += QString().sprintf( "gtOffsetZ=%u*", params.gtOffsetZ ); + retStr += QString().sprintf( "gtColorRX=%u*", params.gtColorRX ); + retStr += QString().sprintf( "gtColorGX=%u*", params.gtColorGX ); + retStr += QString().sprintf( "gtColorBX=%u*", params.gtColorBX ); + retStr += QString().sprintf( "gtColorRY=%u*", params.gtColorRY ); + retStr += QString().sprintf( "gtColorGY=%u*", params.gtColorGY ); + retStr += QString().sprintf( "gtColorBY=%u*", params.gtColorBY ); + retStr += QString().sprintf( "gtColorRZ=%u*", params.gtColorRZ ); + retStr += QString().sprintf( "gtColorGZ=%u*", params.gtColorGZ ); + retStr += QString().sprintf( "gtColorBZ=%u*", params.gtColorBZ ); + retStr += QString().sprintf( "gtDrawTickmarksX=%u*", params.gtDrawTickmarksX ); + retStr += QString().sprintf( "gtDrawTickmarksY=%u*", params.gtDrawTickmarksY ); + retStr += QString().sprintf( "gtDrawTickmarksZ=%u*", params.gtDrawTickmarksZ ); + retStr += QString().sprintf( "gtTickmarkLengthX=%u*", params.gtTickmarkLengthX ); + retStr += QString().sprintf( "gtTickmarkLengthY=%u*", params.gtTickmarkLengthY ); + retStr += QString().sprintf( "gtTickmarkLengthZ=%u", params.gtTickmarkLengthZ ); +#endif + return retStr; } @@ -1707,36 +1896,109 @@ QString OCCViewer_ViewWindow::getVisualParameters() */ void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters ) { + viewAspect params; QStringList paramsLst = parameters.split( '*' ); - if ( paramsLst.size() >= 15 ) { - viewAspect params; - params.scale = paramsLst[0].toDouble(); - params.centerX = paramsLst[1].toDouble(); - params.centerY = paramsLst[2].toDouble(); - params.projX = paramsLst[3].toDouble(); - params.projY = paramsLst[4].toDouble(); - params.projZ = paramsLst[5].toDouble(); - params.twist = paramsLst[6].toDouble(); - params.atX = paramsLst[7].toDouble(); - params.atY = paramsLst[8].toDouble(); - params.atZ = paramsLst[9].toDouble(); - params.eyeX = paramsLst[10].toDouble(); - params.eyeY = paramsLst[11].toDouble(); - params.eyeZ = paramsLst[12].toDouble(); - if ( paramsLst.size() == 18 ) { - params.scaleX = paramsLst[13].toDouble(); - params.scaleY = paramsLst[14].toDouble(); - params.scaleZ = paramsLst[15].toDouble(); - params.isVisible = paramsLst[16].toDouble(); - params.size = paramsLst[17].toDouble(); - } - else { - params.scaleX = 1.; - params.scaleY = 1.; - params.scaleZ = 1.; + if( parameters.contains( '=' ) ) // new format - "scale=1.000e+00*centerX=0.000e+00..." + { + QStringList::const_iterator it = paramsLst.begin(), itEnd = paramsLst.end(); + for( ; it != itEnd; it++ ) { + QString param = *it; + QString paramName = param.section( '=', 0, 0 ); + QString paramStr = param.section( '=', 1, 1 ); + double paramDouble = paramStr.toDouble(); + int paramInt = paramStr.toInt(); + if( paramName == "scale" ) params.scale = paramDouble; + else if( paramName == "centerX" ) params.centerX = paramDouble; + else if( paramName == "centerY" ) params.centerY = paramDouble; + else if( paramName == "projX" ) params.projX = paramDouble; + else if( paramName == "projY" ) params.projY = paramDouble; + else if( paramName == "projZ" ) params.projZ = paramDouble; + else if( paramName == "twist" ) params.twist = paramDouble; + else if( paramName == "atX" ) params.atX = paramDouble; + else if( paramName == "atY" ) params.atY = paramDouble; + else if( paramName == "atZ" ) params.atZ = paramDouble; + else if( paramName == "eyeX" ) params.eyeX = paramDouble; + else if( paramName == "eyeY" ) params.eyeY = paramDouble; + else if( paramName == "eyeZ" ) params.eyeZ = paramDouble; + else if( paramName == "scaleX" ) params.scaleX = paramDouble; + else if( paramName == "scaleY" ) params.scaleY = paramDouble; + else if( paramName == "scaleZ" ) params.scaleZ = paramDouble; + else if( paramName == "isVisible" ) params.isVisible = paramInt; + else if( paramName == "size" ) params.size = paramDouble; + // graduated trihedron + else if( paramName == "gtIsVisible" ) params.gtIsVisible = paramInt; + else if( paramName == "gtDrawNameX" ) params.gtDrawNameX = paramInt; + else if( paramName == "gtDrawNameY" ) params.gtDrawNameY = paramInt; + else if( paramName == "gtDrawNameZ" ) params.gtDrawNameZ = paramInt; + else if( paramName == "gtNameX" ) params.gtNameX = paramStr; + else if( paramName == "gtNameY" ) params.gtNameY = paramStr; + else if( paramName == "gtNameZ" ) params.gtNameZ = paramStr; + else if( paramName == "gtNameColorRX" ) params.gtNameColorRX = paramInt; + else if( paramName == "gtNameColorGX" ) params.gtNameColorGX = paramInt; + else if( paramName == "gtNameColorBX" ) params.gtNameColorBX = paramInt; + else if( paramName == "gtNameColorRY" ) params.gtNameColorRY = paramInt; + else if( paramName == "gtNameColorGY" ) params.gtNameColorGY = paramInt; + else if( paramName == "gtNameColorBY" ) params.gtNameColorBY = paramInt; + else if( paramName == "gtNameColorRZ" ) params.gtNameColorRZ = paramInt; + else if( paramName == "gtNameColorGZ" ) params.gtNameColorGZ = paramInt; + else if( paramName == "gtNameColorBZ" ) params.gtNameColorBZ = paramInt; + else if( paramName == "gtDrawValuesX" ) params.gtDrawValuesX = paramInt; + else if( paramName == "gtDrawValuesY" ) params.gtDrawValuesY = paramInt; + else if( paramName == "gtDrawValuesZ" ) params.gtDrawValuesZ = paramInt; + else if( paramName == "gtNbValuesX" ) params.gtNbValuesX = paramInt; + else if( paramName == "gtNbValuesY" ) params.gtNbValuesY = paramInt; + else if( paramName == "gtNbValuesZ" ) params.gtNbValuesZ = paramInt; + else if( paramName == "gtOffsetX" ) params.gtOffsetX = paramInt; + else if( paramName == "gtOffsetY" ) params.gtOffsetY = paramInt; + else if( paramName == "gtOffsetZ" ) params.gtOffsetZ = paramInt; + else if( paramName == "gtColorRX" ) params.gtColorRX = paramInt; + else if( paramName == "gtColorGX" ) params.gtColorGX = paramInt; + else if( paramName == "gtColorBX" ) params.gtColorBX = paramInt; + else if( paramName == "gtColorRY" ) params.gtColorRY = paramInt; + else if( paramName == "gtColorGY" ) params.gtColorGY = paramInt; + else if( paramName == "gtColorBY" ) params.gtColorBY = paramInt; + else if( paramName == "gtColorRZ" ) params.gtColorRZ = paramInt; + else if( paramName == "gtColorGZ" ) params.gtColorGZ = paramInt; + else if( paramName == "gtColorBZ" ) params.gtColorBZ = paramInt; + else if( paramName == "gtDrawTickmarksX" ) params.gtDrawTickmarksX = paramInt; + else if( paramName == "gtDrawTickmarksY" ) params.gtDrawTickmarksY = paramInt; + else if( paramName == "gtDrawTickmarksZ" ) params.gtDrawTickmarksZ = paramInt; + else if( paramName == "gtTickmarkLengthX" ) params.gtTickmarkLengthX = paramInt; + else if( paramName == "gtTickmarkLengthY" ) params.gtTickmarkLengthY = paramInt; + else if( paramName == "gtTickmarkLengthZ" ) params.gtTickmarkLengthZ = paramInt; + } + } + else // old format - "1.000e+00*0.000e+00..." + { + if ( paramsLst.size() >= 15 ) { + params.scale = paramsLst[0].toDouble(); + params.centerX = paramsLst[1].toDouble(); + params.centerY = paramsLst[2].toDouble(); + params.projX = paramsLst[3].toDouble(); + params.projY = paramsLst[4].toDouble(); + params.projZ = paramsLst[5].toDouble(); + params.twist = paramsLst[6].toDouble(); + params.atX = paramsLst[7].toDouble(); + params.atY = paramsLst[8].toDouble(); + params.atZ = paramsLst[9].toDouble(); + params.eyeX = paramsLst[10].toDouble(); + params.eyeY = paramsLst[11].toDouble(); + params.eyeZ = paramsLst[12].toDouble(); + if ( paramsLst.size() == 18 ) { + params.scaleX = paramsLst[13].toDouble(); + params.scaleY = paramsLst[14].toDouble(); + params.scaleZ = paramsLst[15].toDouble(); + params.isVisible = paramsLst[16].toDouble(); + params.size = paramsLst[17].toDouble(); + } + else { + params.scaleX = 1.; + params.scaleY = 1.; + params.scaleZ = 1.; + } } - performRestoring( params ); } + performRestoring( params ); } /*! diff --git a/src/OCCViewer/OCCViewer_ViewWindow.h b/src/OCCViewer/OCCViewer_ViewWindow.h index 56558b5b7..02300ef18 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.h +++ b/src/OCCViewer/OCCViewer_ViewWindow.h @@ -35,6 +35,7 @@ class OCCViewer_ClippingDlg; class OCCViewer_AxialScaleDlg; class OCCViewer_SetRotationPointDlg; class OCCViewer_Viewer; +class OCCViewer_CubeAxesDlg; class viewAspect; class QtxAction; @@ -50,7 +51,7 @@ public: enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, ChangeRotationPointId, RotationId, FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, CloneId, ClippingId, MemId, RestoreId, - TrihedronShowId, AxialScaleId, AmbientId, SwitchInteractionStyleId }; + TrihedronShowId, AxialScaleId, GraduatedAxesId, AmbientId, SwitchInteractionStyleId }; enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE, PANGLOBAL, WINDOWFIT, FITALLVIEW, RESETVIEW, @@ -111,6 +112,7 @@ public slots: void onCloneView(); void onClipping( bool on ); void onAxialScale(); + void onGraduatedAxes(); void onAmbientToogle(); void onMemorizeView(); void onRestoreView(); @@ -179,6 +181,8 @@ protected: OCCViewer_Viewer* myModel; OCCViewer_ViewPort3d* myViewPort; + OCCViewer_CubeAxesDlg* myCubeAxesDlg; + RotationPointType myCurrPointType; RotationPointType myPrevPointType; gp_Pnt mySelectedPoint; diff --git a/src/OCCViewer/resources/OCCViewer_images.ts b/src/OCCViewer/resources/OCCViewer_images.ts index bdd523e49..bcc888b20 100644 --- a/src/OCCViewer/resources/OCCViewer_images.ts +++ b/src/OCCViewer/resources/OCCViewer_images.ts @@ -112,6 +112,10 @@ ICON_OCCVIEWER_SCALING occ_view_scaling.png + + ICON_OCCVIEWER_GRADUATED_AXES + occ_view_graduated_axes.png + ICON_OCCVIEWER_AMBIENT occ_view_ambient.png diff --git a/src/OCCViewer/resources/OCCViewer_msg_en.ts b/src/OCCViewer/resources/OCCViewer_msg_en.ts index 8b19e4c5b..aea134ee6 100644 --- a/src/OCCViewer/resources/OCCViewer_msg_en.ts +++ b/src/OCCViewer/resources/OCCViewer_msg_en.ts @@ -207,6 +207,14 @@ MNU_SCALING Scaling + + DSC_GRADUATED_AXES + Graduated axes + + + MNU_GRADUATED_AXES + Graduated axes + DSC_AMBIENT Toogle keep only ambient light diff --git a/src/OCCViewer/resources/occ_view_graduated_axes.png b/src/OCCViewer/resources/occ_view_graduated_axes.png new file mode 100755 index 0000000000000000000000000000000000000000..2b44c06fe8f81517d47267c43b62963b1a40ace5 GIT binary patch literal 650 zcmV;50(Jd~P)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;07*naRCwBA`2YVu13vJ;#00+rGyo7lOhl>^2V!nw z6aoYg6EUs>(l3CN1Th8z1P}uOFY`hTtpZ{%5TB5F00G1ZGLVsx5tqD-v9a-EdQCNfLQPa2gtCsK+A5ow_`|FR8+v2prCjU#9x5;7eD|p;W6xQM@I)% zNswVkaw;im)@h0~(eq!v4A!D0vqkfUqTOAz&=O z72}z~P*n2)XZiygwjW4+hNeGeXkLE?5I{H$B#=8+11XSg&w&`EmJON~p8y09x`9ld z_NV`DKWORzWII9=Edx~ZZzvm-#Xf;F1Mxj*8Uz`@1_t3dn`h<~8@7^L|d)KHL1 ze}W8xNdg2A*vnoHXZ{0SrUEUZ_(8!0HSim -#include -#include -#include #include #include #include -#include #include #include @@ -53,176 +48,29 @@ \internal */ -class SVTK_CubeAxesDlg::AxisWidget : public QFrame -{ -public: - AxisWidget( QWidget* ); - ~AxisWidget(); - - void UseName( const bool ); - void SetName( const QString& ); - void SetNameFont( const QColor&, const int, const bool, const bool, const bool ); - bool ReadData( vtkAxisActor2D* ); - bool Apply( vtkAxisActor2D* ); - -private: - // name - QGroupBox* myNameGrp; - QLineEdit* myAxisName; - SVTK_FontWidget* myNameFont; - - // labels - QGroupBox* myLabelsGrp; - QtxIntSpinBox* myLabelNumber; - QtxIntSpinBox* myLabelOffset; - SVTK_FontWidget* myLabelsFont; - - // tick marks - QGroupBox* myTicksGrp; - QtxIntSpinBox* myTickLength; - - friend class SVTK_CubeAxesDlg; -}; - /*! Constructor */ -SVTK_CubeAxesDlg::AxisWidget::AxisWidget (QWidget* theParent) -: QFrame(theParent) +SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) +: ViewerTools_AxisWidgetBase(theParent) { - QList< QLabel* > aLabels; - - // "Name" grp - - myNameGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("AXIS_NAME"), this); - myNameGrp->setCheckable( true ); - - QVBoxLayout* aVBox = new QVBoxLayout; - - QHBoxLayout* aHBox = new QHBoxLayout; - aHBox->setSpacing(5); - QLabel* aLabel = new QLabel(SVTK_CubeAxesDlg::tr("NAME")); - aHBox->addWidget(aLabel); - myAxisName = new QLineEdit; - aHBox->addWidget(myAxisName); - aLabels.append(aLabel); - aVBox->addLayout(aHBox); - - aHBox = new QHBoxLayout; - aHBox->setSpacing(5); - aLabel = new QLabel(SVTK_CubeAxesDlg::tr("FONT")); - aHBox->addWidget(aLabel); - myNameFont = new SVTK_FontWidget(myNameGrp); - aHBox->addWidget(myNameFont); - aLabels.append(aLabel); - aVBox->addLayout(aHBox); - - myNameGrp->setLayout(aVBox); - - // "Labels" grp - - myLabelsGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("LABELS"), this); - myLabelsGrp->setCheckable( true ); - - aVBox = new QVBoxLayout; - - aHBox = new QHBoxLayout; - aHBox->setSpacing(5); - aLabel = new QLabel(SVTK_CubeAxesDlg::tr("NUMBER")); - aHBox->addWidget(aLabel); - myLabelNumber = new QtxIntSpinBox(0,25,1,myLabelsGrp); - aHBox->addWidget(myLabelNumber); - aLabels.append(aLabel); - aVBox->addLayout(aHBox); - - aHBox = new QHBoxLayout; - aHBox->setSpacing(5); - aLabel = new QLabel(SVTK_CubeAxesDlg::tr("OFFSET")); - aHBox->addWidget(aLabel); - myLabelOffset = new QtxIntSpinBox(0,100,1,myLabelsGrp); - aHBox->addWidget(myLabelOffset); - aLabels.append(aLabel); - aVBox->addLayout(aHBox); - - aHBox = new QHBoxLayout; - aHBox->setSpacing(5); - aLabel = new QLabel(SVTK_CubeAxesDlg::tr("FONT")); - aHBox->addWidget(aLabel); - myLabelsFont = new SVTK_FontWidget(myLabelsGrp); - aHBox->addWidget(myLabelsFont); - aLabels.append(aLabel); - aVBox->addLayout(aHBox); - - myLabelsGrp->setLayout(aVBox); - - // "Tick marks" grp - - myTicksGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("TICK_MARKS"), this); - myTicksGrp->setCheckable( true ); - - aVBox = new QVBoxLayout; - - aHBox = new QHBoxLayout; - aHBox->setSpacing(5); - aLabel = new QLabel(SVTK_CubeAxesDlg::tr("LENGTH")); - aHBox->addWidget(aLabel); - myTickLength = new QtxIntSpinBox(0,100,1,myTicksGrp); - aHBox->addWidget(myTickLength); - aLabels.append(aLabel); - aVBox->addLayout(aHBox); - - myTicksGrp->setLayout(aVBox); - - // Layout - - QVBoxLayout* aLay = new QVBoxLayout(this); - aLay->setMargin(5); - aLay->setSpacing(5); - aLay->addWidget(myNameGrp); - aLay->addWidget(myLabelsGrp); - aLay->addWidget(myTicksGrp); - - // init - myNameGrp->setChecked( true ); - myLabelsGrp->setChecked( true ); - myTicksGrp->setChecked( true ); - - // Adjust label widths - QList< QLabel* >::iterator anIter; - int aMaxWidth = 0; - for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++) - aMaxWidth = qMax(aMaxWidth, (*anIter)->sizeHint().width()); - for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++) - (*anIter)->setFixedWidth(aMaxWidth); } /*! Destructor */ -SVTK_CubeAxesDlg::AxisWidget::~AxisWidget() +SVTK_AxisWidget::~SVTK_AxisWidget() { } -void SVTK_CubeAxesDlg::AxisWidget::UseName(const bool toUse) +ViewerTools_FontWidgetBase* SVTK_AxisWidget::createFontWidget( QWidget* theParent ) { - myNameGrp->setChecked(toUse); + SVTK_FontWidget* aFontWidget = new SVTK_FontWidget( theParent ); + aFontWidget->Initialize(); + return aFontWidget; } -void SVTK_CubeAxesDlg::AxisWidget::SetName(const QString& theName) -{ - myAxisName->setText(theName); -} - -void SVTK_CubeAxesDlg::AxisWidget::SetNameFont(const QColor& theColor, - const int theFont, - const bool theIsBold, - const bool theIsItalic, - const bool theIsShadow) -{ - myNameFont->SetData(theColor, theFont, theIsBold, theIsItalic, theIsShadow); -} - -bool SVTK_CubeAxesDlg::AxisWidget::ReadData(vtkAxisActor2D* theActor) +bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor) { if (theActor == 0) return false; @@ -293,7 +141,7 @@ bool SVTK_CubeAxesDlg::AxisWidget::ReadData(vtkAxisActor2D* theActor) return true; } -bool SVTK_CubeAxesDlg::AxisWidget::Apply(vtkAxisActor2D* theActor) +bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor) { if (theActor == 0) return false; @@ -378,86 +226,28 @@ bool SVTK_CubeAxesDlg::AxisWidget::Apply(vtkAxisActor2D* theActor) SVTK_CubeAxesDlg::SVTK_CubeAxesDlg(QtxAction* theAction, SVTK_ViewWindow* theParent, const char* theName): - SVTK_DialogBase(theAction, - theParent, - theName), + ViewerTools_CubeAxesDlgBase(theAction, + theParent, + theName), myMainWindow(theParent) { - setWindowTitle(tr("CAPTION")); - - QVBoxLayout* aLay = new QVBoxLayout(this); - aLay->setMargin(5); - aLay->setSpacing(5); - aLay->addWidget(createMainFrame(this)); - aLay->addWidget(createButtonFrame(this)); - - connect(theParent, SIGNAL(Show( QShowEvent * )), this, SLOT(onParentShow())); - connect(theParent, SIGNAL(Hide( QHideEvent * )), this, SLOT(onParentHide())); } /*! - Create frame containing dialog's input fields -*/ -QWidget* SVTK_CubeAxesDlg::createMainFrame(QWidget* theParent) -{ - QFrame* aFrame = new QFrame(theParent); - - myTabWg = new QTabWidget(aFrame); - - myAxes[ 0 ] = new AxisWidget(myTabWg); - myAxes[ 1 ] = new AxisWidget(myTabWg); - myAxes[ 2 ] = new AxisWidget(myTabWg); - - myTabWg->addTab(myAxes[ 0 ], tr("X_AXIS")); - myTabWg->addTab(myAxes[ 1 ], tr("Y_AXIS")); - myTabWg->addTab(myAxes[ 2 ], tr("Z_AXIS")); - - myIsVisible = new QCheckBox(tr("IS_VISIBLE"), aFrame); - - QVBoxLayout* aLay = new QVBoxLayout(aFrame); - aLay->setMargin(0); - aLay->setSpacing(5); - aLay->addWidget(myTabWg); - aLay->addWidget(myIsVisible); - - return aFrame; -} - -/*! - Create frame containing buttons + Destructor */ -QWidget* SVTK_CubeAxesDlg::createButtonFrame(QWidget* theParent) +SVTK_CubeAxesDlg::~SVTK_CubeAxesDlg() { - QFrame* aFrame = new QFrame(theParent); - aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken); - - myOkBtn = new QPushButton(tr("BUT_OK"), aFrame); - myApplyBtn = new QPushButton(tr("BUT_APPLY"), aFrame); - myCloseBtn = new QPushButton(tr("BUT_CLOSE"), aFrame); - - QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); - - QHBoxLayout* aLay = new QHBoxLayout(aFrame); - aLay->setMargin(5); - aLay->setSpacing(5); - - aLay->addWidget(myOkBtn); - aLay->addWidget(myApplyBtn); - aLay->addItem(aSpacer); - aLay->addWidget(myCloseBtn); - - connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk())); - connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply())); - connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose())); - - return aFrame; } /*! - Destructor + Create axis widget */ -SVTK_CubeAxesDlg::~SVTK_CubeAxesDlg() +ViewerTools_AxisWidgetBase* SVTK_CubeAxesDlg::createAxisWidget( QWidget* theParent ) { + SVTK_AxisWidget* anAxisWidget = new SVTK_AxisWidget( theParent ); + anAxisWidget->initialize(); + return anAxisWidget; } /*! @@ -465,29 +255,23 @@ SVTK_CubeAxesDlg::~SVTK_CubeAxesDlg() */ void SVTK_CubeAxesDlg::Update() { + ViewerTools_CubeAxesDlgBase::Update(); + myActor = myMainWindow->GetCubeAxes(); - myAxes[ 0 ]->ReadData(myActor->GetXAxisActor2D()); - myAxes[ 1 ]->ReadData(myActor->GetYAxisActor2D()); - myAxes[ 2 ]->ReadData(myActor->GetZAxisActor2D()); + ((SVTK_AxisWidget*)myAxes[ 0 ])->ReadData(myActor->GetXAxisActor2D()); + ((SVTK_AxisWidget*)myAxes[ 1 ])->ReadData(myActor->GetYAxisActor2D()); + ((SVTK_AxisWidget*)myAxes[ 2 ])->ReadData(myActor->GetZAxisActor2D()); myIsVisible->setChecked(myActor->GetVisibility() ? true : false); } -/*! - Verify validity of entry data -*/ -bool SVTK_CubeAxesDlg::isValid() const -{ - return true; -} - /*! Verify validity of entry data */ bool SVTK_CubeAxesDlg::onApply() { - bool isOk = true; + bool isOk = ViewerTools_CubeAxesDlgBase::onApply(); try { @@ -495,16 +279,15 @@ bool SVTK_CubeAxesDlg::onApply() aCurrWid->clearFocus(); aCurrWid->setFocus(); - isOk = isOk && myAxes[ 0 ]->Apply(myActor->GetXAxisActor2D()); - isOk = isOk && myAxes[ 1 ]->Apply(myActor->GetYAxisActor2D()); - isOk = isOk && myAxes[ 2 ]->Apply(myActor->GetZAxisActor2D()); - + isOk = isOk && ((SVTK_AxisWidget*)myAxes[ 0 ])->Apply(myActor->GetXAxisActor2D()); + isOk = isOk && ((SVTK_AxisWidget*)myAxes[ 1 ])->Apply(myActor->GetYAxisActor2D()); + isOk = isOk && ((SVTK_AxisWidget*)myAxes[ 2 ])->Apply(myActor->GetZAxisActor2D()); - //myActor->SetXLabel(myAxes[ 0 ]->myAxisName->text()); - //myActor->SetYLabel(myAxes[ 1 ]->myAxisName->text()); - //myActor->SetZLabel(myAxes[ 2 ]->myAxisName->text()); + //myActor->SetXLabel(myAxes[ 0 ]->myAxisName->text()); // to remove? + //myActor->SetYLabel(myAxes[ 1 ]->myAxisName->text()); // to remove? + //myActor->SetZLabel(myAxes[ 2 ]->myAxisName->text()); // to remove? - //myActor->SetNumberOfLabels(myActor->GetXAxisActor2D()->GetNumberOfLabels()); + //myActor->SetNumberOfLabels(myActor->GetXAxisActor2D()->GetNumberOfLabels()); // to remove? if (myIsVisible->isChecked()) myActor->VisibilityOn(); else @@ -520,20 +303,3 @@ bool SVTK_CubeAxesDlg::onApply() return isOk; } - -/*! - SLOT called when "Ok" button pressed. -*/ -void SVTK_CubeAxesDlg::onOk() -{ - if (onApply()) - onClose(); -} - -/*! - SLOT: called when "Close" button pressed. Close dialog -*/ -void SVTK_CubeAxesDlg::onClose() -{ - reject(); -} diff --git a/src/SVTK/SVTK_CubeAxesDlg.h b/src/SVTK/SVTK_CubeAxesDlg.h index 6d615b8c6..57efc3b02 100644 --- a/src/SVTK/SVTK_CubeAxesDlg.h +++ b/src/SVTK/SVTK_CubeAxesDlg.h @@ -27,59 +27,58 @@ #ifndef SVTK_CubeAxesDlg_H #define SVTK_CubeAxesDlg_H -#include "SVTK_DialogBase.h" +#include "SVTK.h" -class QWidget; -class QPushButton; -class QTabWidget; -class QCheckBox; +#include -class QtxAction; +class SVTK_ViewWindow; class SVTK_CubeAxesActor2D; -class SVTK_FontWidget; -class SVTK_AxisWidget; -class SVTK_ViewWindow; +class vtkAxisActor2D; + +/*! + * Class : SVTK_AxisWidget + * Description : Axis tab widget of the "Graduated axis" dialog box +*/ +class SVTK_EXPORT SVTK_AxisWidget : public ViewerTools_AxisWidgetBase +{ +public: + SVTK_AxisWidget( QWidget* ); + ~SVTK_AxisWidget(); + +public: + bool ReadData( vtkAxisActor2D* ); + bool Apply( vtkAxisActor2D* ); + +protected: + virtual ViewerTools_FontWidgetBase* createFontWidget( QWidget* ); +}; /*! * Class : SVTK_CubeAxesDlg * Description : Dialog for specifynig cube axes properties */ -class SVTK_CubeAxesDlg : public SVTK_DialogBase +class SVTK_EXPORT SVTK_CubeAxesDlg : public ViewerTools_CubeAxesDlgBase { Q_OBJECT - class AxisWidget; - public: SVTK_CubeAxesDlg(QtxAction* theAction, SVTK_ViewWindow* theParent, const char* theName); virtual ~SVTK_CubeAxesDlg(); - void Update(); + virtual void Update(); private slots: - void onOk(); - bool onApply(); - void onClose(); + virtual bool onApply(); private: - QWidget* createButtonFrame( QWidget* ); - QWidget* createMainFrame ( QWidget* ); - bool isValid() const; + virtual ViewerTools_AxisWidgetBase* createAxisWidget( QWidget* ); private: - SVTK_ViewWindow *myMainWindow; + SVTK_ViewWindow* myMainWindow; SVTK_CubeAxesActor2D* myActor; - - QTabWidget* myTabWg; - QCheckBox* myIsVisible; - - QPushButton* myOkBtn; - QPushButton* myApplyBtn; - QPushButton* myCloseBtn; - AxisWidget* myAxes[ 3 ]; }; #endif diff --git a/src/SVTK/SVTK_FontWidget.cxx b/src/SVTK/SVTK_FontWidget.cxx index b8e3b28a8..fdbb838ba 100644 --- a/src/SVTK/SVTK_FontWidget.cxx +++ b/src/SVTK/SVTK_FontWidget.cxx @@ -27,11 +27,7 @@ // #include "SVTK_FontWidget.h" -#include #include -#include -#include -#include #include @@ -44,30 +40,8 @@ Constructor */ SVTK_FontWidget::SVTK_FontWidget( QWidget* theParent ) -: QWidget( theParent ) +: ViewerTools_FontWidgetBase( theParent ) { - myColorBtn = new QToolButton( this ); - myColorBtn->setMinimumWidth( 20 ); - - myFamily = new QComboBox( this ); - myFamily->insertItem( myFamily->count(), tr( "ARIAL" ) ); - myFamily->insertItem( myFamily->count(), tr( "COURIER" ) ); - myFamily->insertItem( myFamily->count(), tr( "TIMES" ) ); - - myBold = new QCheckBox( tr( "BOLD" ), this ); - myItalic = new QCheckBox( tr( "ITALIC" ), this ); - myShadow = new QCheckBox( tr( "SHADOW" ), this ); - - QHBoxLayout* aHBLayout = new QHBoxLayout; - aHBLayout->setSpacing( 5 ); - aHBLayout->addWidget(myColorBtn); - aHBLayout->addWidget(myFamily); - aHBLayout->addWidget(myBold); - aHBLayout->addWidget(myItalic); - aHBLayout->addWidget(myShadow); - this->setLayout(aHBLayout); - - connect( myColorBtn, SIGNAL( clicked() ), SLOT( onColor() ) ); } /*! @@ -77,32 +51,24 @@ SVTK_FontWidget::~SVTK_FontWidget() { } -void SVTK_FontWidget::SetColor( const QColor& theColor ) -{ - QPalette palette; - palette.setColor(myColorBtn->backgroundRole(), theColor); - myColorBtn->setPalette(palette); -} - -QColor SVTK_FontWidget::GetColor() const +void SVTK_FontWidget::InitializeFamilies() { - return myColorBtn->palette().color( myColorBtn->backgroundRole() ); -} - -void SVTK_FontWidget::onColor() -{ - QColor aColor = QColorDialog::getColor( GetColor(), this ); - if ( aColor.isValid() ) - SetColor( aColor ); + myFamily->insertItem( myFamily->count(), tr( "ARIAL" ) ); + myFamily->insertItem( myFamily->count(), tr( "COURIER" ) ); + myFamily->insertItem( myFamily->count(), tr( "TIMES" ) ); } void SVTK_FontWidget::SetData( const QColor& theColor, - const int theFamily, - const bool theBold, - const bool theItalic, - const bool theShadow ) + const int theFamily, + const bool theBold, + const bool theItalic, + const bool theShadow ) { - SetColor( theColor ); + ViewerTools_FontWidgetBase::SetData( theColor, + theFamily, + theBold, + theItalic, + theShadow ); if ( theFamily == VTK_ARIAL ) myFamily->setCurrentIndex( 0 ); @@ -110,10 +76,6 @@ void SVTK_FontWidget::SetData( const QColor& theColor, myFamily->setCurrentIndex( 1 ); else myFamily->setCurrentIndex( 2 ); - - myBold->setChecked( theBold ); - myItalic->setChecked( theItalic ); - myShadow->setChecked( theShadow ); } void SVTK_FontWidget::GetData( QColor& theColor, @@ -122,17 +84,17 @@ void SVTK_FontWidget::GetData( QColor& theColor, bool& theItalic, bool& theShadow ) const { - theColor = GetColor(); + ViewerTools_FontWidgetBase::GetData( theColor, + theFamily, + theBold, + theItalic, + theShadow ); - int anItem =myFamily->currentIndex(); + int anItem = myFamily->currentIndex(); if ( anItem == 0 ) theFamily = VTK_ARIAL; else if ( anItem == 1 ) theFamily = VTK_COURIER; else theFamily = VTK_TIMES; - - theBold = myBold->isChecked(); - theItalic = myItalic->isChecked(); - theShadow = myShadow->isChecked(); } diff --git a/src/SVTK/SVTK_FontWidget.h b/src/SVTK/SVTK_FontWidget.h index 6150dfe5f..dde1e4be7 100644 --- a/src/SVTK/SVTK_FontWidget.h +++ b/src/SVTK/SVTK_FontWidget.h @@ -29,19 +29,13 @@ #include "SVTK.h" -#include - -class QToolButton; -class QComboBox; -class QCheckBox; -class QColor; - +#include /*! * Class : SVTK_FontWidget * Description : Dialog for specifynig font */ -class SVTK_EXPORT SVTK_FontWidget : public QWidget +class SVTK_EXPORT SVTK_FontWidget : public ViewerTools_FontWidgetBase { Q_OBJECT @@ -49,22 +43,12 @@ public: SVTK_FontWidget( QWidget* ); virtual ~SVTK_FontWidget(); - void SetColor( const QColor& ); - QColor GetColor() const; - - void SetData( const QColor&, const int, const bool, const bool, const bool ); - - void GetData( QColor&, int&, bool&, bool&, bool& ) const; + virtual void SetData( const QColor&, const int, const bool, const bool, const bool ); -private slots: - void onColor(); + virtual void GetData( QColor&, int&, bool&, bool&, bool& ) const; -private: - QToolButton* myColorBtn; - QComboBox* myFamily; - QCheckBox* myBold; - QCheckBox* myItalic; - QCheckBox* myShadow; +protected: + virtual void InitializeFamilies(); }; #endif diff --git a/src/SVTK/SVTK_NonIsometricDlg.cxx b/src/SVTK/SVTK_NonIsometricDlg.cxx index a1c5c6da0..ac35cdc10 100644 --- a/src/SVTK/SVTK_NonIsometricDlg.cxx +++ b/src/SVTK/SVTK_NonIsometricDlg.cxx @@ -47,9 +47,9 @@ SVTK_NonIsometricDlg ::SVTK_NonIsometricDlg(QtxAction* theAction, SVTK_ViewWindow* theParent, const char* theName): - SVTK_DialogBase(theAction, - theParent, - theName), + ViewerTools_DialogBase(theAction, + theParent, + theName), m_MainWindow(theParent) { setWindowTitle(tr("DLG_TITLE")); diff --git a/src/SVTK/SVTK_NonIsometricDlg.h b/src/SVTK/SVTK_NonIsometricDlg.h index 1e2573d1d..dced659d9 100644 --- a/src/SVTK/SVTK_NonIsometricDlg.h +++ b/src/SVTK/SVTK_NonIsometricDlg.h @@ -29,7 +29,7 @@ #ifndef SVTK_NONISOMETRICDLG_H #define SVTK_NONISOMETRICDLG_H -#include "SVTK_DialogBase.h" +#include class SVTK_ViewWindow; @@ -39,7 +39,7 @@ class QtxAction; class QPushButton; -class SVTK_NonIsometricDlg : public SVTK_DialogBase +class SVTK_NonIsometricDlg : public ViewerTools_DialogBase { Q_OBJECT; diff --git a/src/SVTK/SVTK_SetRotationPointDlg.cxx b/src/SVTK/SVTK_SetRotationPointDlg.cxx index 28ac37ec7..eec869920 100755 --- a/src/SVTK/SVTK_SetRotationPointDlg.cxx +++ b/src/SVTK/SVTK_SetRotationPointDlg.cxx @@ -55,9 +55,9 @@ SVTK_SetRotationPointDlg ::SVTK_SetRotationPointDlg(QtxAction* theAction, SVTK_ViewWindow* theParent, const char* theName): - SVTK_DialogBase(theAction, - theParent, - theName), + ViewerTools_DialogBase(theAction, + theParent, + theName), myMainWindow(theParent), myPriority(0.0), myEventCallbackCommand(vtkCallbackCommand::New()), diff --git a/src/SVTK/SVTK_SetRotationPointDlg.h b/src/SVTK/SVTK_SetRotationPointDlg.h index e87335e3f..ed807b66c 100755 --- a/src/SVTK/SVTK_SetRotationPointDlg.h +++ b/src/SVTK/SVTK_SetRotationPointDlg.h @@ -31,7 +31,7 @@ #include "SVTK.h" -#include "SVTK_DialogBase.h" +#include #include @@ -48,7 +48,7 @@ class QCheckBox; class vtkCallbackCommand; class vtkObject; -class SVTK_EXPORT SVTK_SetRotationPointDlg : public SVTK_DialogBase +class SVTK_EXPORT SVTK_SetRotationPointDlg : public ViewerTools_DialogBase { Q_OBJECT; diff --git a/src/SVTK/SVTK_UpdateRateDlg.cxx b/src/SVTK/SVTK_UpdateRateDlg.cxx index 373471ffe..d73408be7 100644 --- a/src/SVTK/SVTK_UpdateRateDlg.cxx +++ b/src/SVTK/SVTK_UpdateRateDlg.cxx @@ -169,9 +169,9 @@ SVTK_UpdateRateDlg ::SVTK_UpdateRateDlg(QtxAction* theAction, SVTK_ViewWindow* theParent, const char* theName): - SVTK_DialogBase(theAction, - theParent, - theName), + ViewerTools_DialogBase(theAction, + theParent, + theName), myPriority(0.0), myEventCallbackCommand(vtkCallbackCommand::New()), myRWInteractor(theParent->GetInteractor()), diff --git a/src/SVTK/SVTK_UpdateRateDlg.h b/src/SVTK/SVTK_UpdateRateDlg.h index 045c2d35a..61ec0a622 100644 --- a/src/SVTK/SVTK_UpdateRateDlg.h +++ b/src/SVTK/SVTK_UpdateRateDlg.h @@ -29,7 +29,7 @@ #ifndef SVTK_UPDATERATEDLG_H #define SVTK_UPDATERATEDLG_H -#include "SVTK_DialogBase.h" +#include #include @@ -46,7 +46,7 @@ class vtkCallbackCommand; class vtkObject; -class SVTK_UpdateRateDlg : public SVTK_DialogBase +class SVTK_UpdateRateDlg : public ViewerTools_DialogBase { Q_OBJECT; diff --git a/src/SVTK/SVTK_ViewParameterDlg.cxx b/src/SVTK/SVTK_ViewParameterDlg.cxx index 600250b4d..b4400f558 100755 --- a/src/SVTK/SVTK_ViewParameterDlg.cxx +++ b/src/SVTK/SVTK_ViewParameterDlg.cxx @@ -56,7 +56,7 @@ using namespace std; SVTK_ViewParameterDlg::SVTK_ViewParameterDlg(QtxAction* theAction, SVTK_ViewWindow* theParent, const char* theName): - SVTK_DialogBase(theAction, theParent, theName), + ViewerTools_DialogBase(theAction, theParent, theName), myMainWindow(theParent), myPriority(0.0), myEventCallbackCommand(vtkCallbackCommand::New()), diff --git a/src/SVTK/SVTK_ViewParameterDlg.h b/src/SVTK/SVTK_ViewParameterDlg.h index b98770063..acef99e54 100755 --- a/src/SVTK/SVTK_ViewParameterDlg.h +++ b/src/SVTK/SVTK_ViewParameterDlg.h @@ -28,7 +28,7 @@ #include "SVTK.h" -#include "SVTK_DialogBase.h" +#include #include #include @@ -47,7 +47,7 @@ class QButtonGroup; class vtkCallbackCommand; class vtkObject; -class SVTK_EXPORT SVTK_ViewParameterDlg : public SVTK_DialogBase +class SVTK_EXPORT SVTK_ViewParameterDlg : public ViewerTools_DialogBase { Q_OBJECT; diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index a8fa48f19..440bf08ce 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -165,6 +165,7 @@ void SVTK_ViewWindow::Initialize(SVTK_ViewModelBase* theModel) myUpdateRateDlg = new SVTK_UpdateRateDlg( getAction( UpdateRate ), this, "SVTK_UpdateRateDlg" ); myNonIsometricDlg = new SVTK_NonIsometricDlg( getAction( NonIsometric ), this, "SVTK_NonIsometricDlg" ); myCubeAxesDlg = new SVTK_CubeAxesDlg( getAction( GraduatedAxes ), this, "SVTK_CubeAxesDlg" ); + myCubeAxesDlg->initialize(); mySetRotationPointDlg = new SVTK_SetRotationPointDlg ( getAction( ChangeRotationPointId ), this, "SVTK_SetRotationPointDlg" ); myViewParameterDlg = new SVTK_ViewParameterDlg diff --git a/src/SVTK/resources/SVTK_msg_en.ts b/src/SVTK/resources/SVTK_msg_en.ts index 3663ce51e..8593ed6fa 100644 --- a/src/SVTK/resources/SVTK_msg_en.ts +++ b/src/SVTK/resources/SVTK_msg_en.ts @@ -188,67 +188,8 @@ Interaction Style Switch - - SVTK_CubeAxesDlg - - X_AXIS - X axis - - - Y_AXIS - Y axis - - - Z_AXIS - Z axis - - - CAPTION - Graduated axes - - - IS_VISIBLE - Is visible - - - FONT - Font - - - NAME - Name - - - TICK_MARKS - Tick marks - - - LABELS - Labels - - - LENGTH - Length - - - NUMBER - Number - - - OFFSET - Offset - - - AXIS_NAME - Axis name - - SVTK_FontWidget - - BOLD - Bold - ARIAL Arial @@ -257,14 +198,6 @@ TIMES Times - - ITALIC - Italic - - - SHADOW - Shadow - COURIER Courier diff --git a/src/SalomeApp/resources/SalomeApp.xml b/src/SalomeApp/resources/SalomeApp.xml index 542811fc7..0a037a064 100644 --- a/src/SalomeApp/resources/SalomeApp.xml +++ b/src/SalomeApp/resources/SalomeApp.xml @@ -69,6 +69,7 @@ + diff --git a/src/ViewerTools/Makefile.am b/src/ViewerTools/Makefile.am new file mode 100755 index 000000000..eefbd3a19 --- /dev/null +++ b/src/ViewerTools/Makefile.am @@ -0,0 +1,55 @@ +# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +lib_LTLIBRARIES = libViewerTools.la + +salomeinclude_HEADERS= \ + ViewerTools.h \ + ViewerTools_CubeAxesDlgBase.h \ + ViewerTools_DialogBase.h \ + ViewerTools_FontWidgetBase.h + +dist_libViewerTools_la_SOURCES= \ + ViewerTools_CubeAxesDlgBase.cxx \ + ViewerTools_DialogBase.cxx \ + ViewerTools_FontWidgetBase.cxx + +MOC_FILES= \ + ViewerTools_CubeAxesDlgBase_moc.cxx \ + ViewerTools_DialogBase_moc.cxx \ + ViewerTools_FontWidgetBase_moc.cxx + +nodist_libViewerTools_la_SOURCES= $(MOC_FILES) + +nodist_salomeres_DATA = \ + ViewerTools_msg_en.qm + +libViewerTools_la_CPPFLAGS = \ + $(QT_INCLUDES) \ + -I$(srcdir)/../Qtx + +libViewerTools_la_LDFLAGS = \ + $(QT_MT_LIBS) + +libViewerTools_la_LIBADD = ../Qtx/libqtx.la diff --git a/src/ViewerTools/ViewerTools.h b/src/ViewerTools/ViewerTools.h new file mode 100644 index 000000000..f79e2c23d --- /dev/null +++ b/src/ViewerTools/ViewerTools.h @@ -0,0 +1,41 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef VIEWERTOOLS_H +#define VIEWERTOOLS_H + +#ifdef WIN32 +# if defined VIEWERTOOLS_EXPORTS +# define VIEWERTOOLS_EXPORT __declspec(dllexport) +# else +# define VIEWERTOOLS_EXPORT __declspec(dllimport) +# endif +#else +# define VIEWERTOOLS_EXPORT +#endif + +#if defined WIN32 +#pragma warning ( disable: 4251 ) +#pragma warning ( disable: 4786 ) +#endif + +#endif diff --git a/src/ViewerTools/ViewerTools_CubeAxesDlgBase.cxx b/src/ViewerTools/ViewerTools_CubeAxesDlgBase.cxx new file mode 100644 index 000000000..f3f1e0e08 --- /dev/null +++ b/src/ViewerTools/ViewerTools_CubeAxesDlgBase.cxx @@ -0,0 +1,322 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "ViewerTools_CubeAxesDlgBase.h" + +#include "ViewerTools_FontWidgetBase.h" + +#include "QtxAction.h" +#include "QtxIntSpinBox.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/*! + * Class : ViewerTools_AxisWidgetBase + * Description : Axis tab widget of the "Graduated axis" dialog box +*/ + +/*! + Constructor +*/ +ViewerTools_AxisWidgetBase::ViewerTools_AxisWidgetBase (QWidget* theParent) +: QFrame(theParent) +{ +} + +/*! + Destructor +*/ +ViewerTools_AxisWidgetBase::~ViewerTools_AxisWidgetBase() +{ +} + +/*! + Initialize controls +*/ +void ViewerTools_AxisWidgetBase::initialize() +{ + QList< QLabel* > aLabels; + + // "Name" grp + + myNameGrp = new QGroupBox(ViewerTools_CubeAxesDlgBase::tr("AXIS_NAME"), this); + myNameGrp->setCheckable( true ); + + QVBoxLayout* aVBox = new QVBoxLayout; + + QHBoxLayout* aHBox = new QHBoxLayout; + aHBox->setSpacing(5); + QLabel* aLabel = new QLabel(ViewerTools_CubeAxesDlgBase::tr("NAME")); + aHBox->addWidget(aLabel); + myAxisName = new QLineEdit; + aHBox->addWidget(myAxisName); + aLabels.append(aLabel); + aVBox->addLayout(aHBox); + + aHBox = new QHBoxLayout; + aHBox->setSpacing(5); + aLabel = new QLabel(ViewerTools_CubeAxesDlgBase::tr("FONT")); + aHBox->addWidget(aLabel); + myNameFont = createFontWidget(myNameGrp); + aHBox->addWidget(myNameFont); + aLabels.append(aLabel); + aVBox->addLayout(aHBox); + + myNameGrp->setLayout(aVBox); + + // "Labels" grp + + myLabelsGrp = new QGroupBox(ViewerTools_CubeAxesDlgBase::tr("LABELS"), this); + myLabelsGrp->setCheckable( true ); + + aVBox = new QVBoxLayout; + + aHBox = new QHBoxLayout; + aHBox->setSpacing(5); + aLabel = new QLabel(ViewerTools_CubeAxesDlgBase::tr("NUMBER")); + aHBox->addWidget(aLabel); + myLabelNumber = new QtxIntSpinBox(2,25,1,myLabelsGrp); + aHBox->addWidget(myLabelNumber); + aLabels.append(aLabel); + aVBox->addLayout(aHBox); + + aHBox = new QHBoxLayout; + aHBox->setSpacing(5); + aLabel = new QLabel(ViewerTools_CubeAxesDlgBase::tr("OFFSET")); + aHBox->addWidget(aLabel); + myLabelOffset = new QtxIntSpinBox(0,100,1,myLabelsGrp); + aHBox->addWidget(myLabelOffset); + aLabels.append(aLabel); + aVBox->addLayout(aHBox); + + aHBox = new QHBoxLayout; + aHBox->setSpacing(5); + aLabel = new QLabel(ViewerTools_CubeAxesDlgBase::tr("FONT")); + aHBox->addWidget(aLabel); + myLabelsFont = createFontWidget(myLabelsGrp); + aHBox->addWidget(myLabelsFont); + aLabels.append(aLabel); + aVBox->addLayout(aHBox); + + myLabelsGrp->setLayout(aVBox); + + // "Tick marks" grp + + myTicksGrp = new QGroupBox(ViewerTools_CubeAxesDlgBase::tr("TICK_MARKS"), this); + myTicksGrp->setCheckable( true ); + + aVBox = new QVBoxLayout; + + aHBox = new QHBoxLayout; + aHBox->setSpacing(5); + aLabel = new QLabel(ViewerTools_CubeAxesDlgBase::tr("LENGTH")); + aHBox->addWidget(aLabel); + myTickLength = new QtxIntSpinBox(0,100,1,myTicksGrp); + aHBox->addWidget(myTickLength); + aLabels.append(aLabel); + aVBox->addLayout(aHBox); + + myTicksGrp->setLayout(aVBox); + + // Layout + + QVBoxLayout* aLay = new QVBoxLayout(this); + aLay->setMargin(5); + aLay->setSpacing(5); + aLay->addWidget(myNameGrp); + aLay->addWidget(myLabelsGrp); + aLay->addWidget(myTicksGrp); + + // init + myNameGrp->setChecked( true ); + myLabelsGrp->setChecked( true ); + myTicksGrp->setChecked( true ); + + // Adjust label widths + QList< QLabel* >::iterator anIter; + int aMaxWidth = 0; + for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++) + aMaxWidth = qMax(aMaxWidth, (*anIter)->sizeHint().width()); + for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++) + (*anIter)->setFixedWidth(aMaxWidth); +} + +void ViewerTools_AxisWidgetBase::UseName(const bool toUse) +{ + myNameGrp->setChecked(toUse); +} + +void ViewerTools_AxisWidgetBase::SetName(const QString& theName) +{ + myAxisName->setText(theName); +} + +void ViewerTools_AxisWidgetBase::SetNameFont(const QColor& theColor, + const int theFont, + const bool theIsBold, + const bool theIsItalic, + const bool theIsShadow) +{ + myNameFont->SetData(theColor, theFont, theIsBold, theIsItalic, theIsShadow); +} + +/* + Class : ViewerTools_CubeAxesDlgBase + Description : Dialog for specifying cube axes properties +*/ + +/*! + Constructor +*/ +ViewerTools_CubeAxesDlgBase::ViewerTools_CubeAxesDlgBase(QtxAction* theAction, + QWidget* theParent, + const char* theName): + ViewerTools_DialogBase(theAction, + theParent, + theName) +{ + setWindowTitle(tr("CAPTION")); +} + +/*! + Initialize controls +*/ +void ViewerTools_CubeAxesDlgBase::initialize() +{ + QVBoxLayout* aLay = new QVBoxLayout(this); + aLay->setMargin(5); + aLay->setSpacing(5); + aLay->addWidget(createMainFrame(this)); + aLay->addWidget(createButtonFrame(this)); +} + +/*! + Create frame containing dialog's input fields +*/ +QWidget* ViewerTools_CubeAxesDlgBase::createMainFrame(QWidget* theParent) +{ + QFrame* aFrame = new QFrame(theParent); + + myTabWg = new QTabWidget(aFrame); + + myAxes[ 0 ] = createAxisWidget(myTabWg); + myAxes[ 1 ] = createAxisWidget(myTabWg); + myAxes[ 2 ] = createAxisWidget(myTabWg); + + myTabWg->addTab(myAxes[ 0 ], tr("X_AXIS")); + myTabWg->addTab(myAxes[ 1 ], tr("Y_AXIS")); + myTabWg->addTab(myAxes[ 2 ], tr("Z_AXIS")); + + myIsVisible = new QCheckBox(tr("IS_VISIBLE"), aFrame); + + QVBoxLayout* aLay = new QVBoxLayout(aFrame); + aLay->setMargin(0); + aLay->setSpacing(5); + aLay->addWidget(myTabWg); + aLay->addWidget(myIsVisible); + + return aFrame; +} + +/*! + Create frame containing buttons +*/ +QWidget* ViewerTools_CubeAxesDlgBase::createButtonFrame(QWidget* theParent) +{ + QFrame* aFrame = new QFrame(theParent); + aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken); + + myOkBtn = new QPushButton(tr("BUT_OK"), aFrame); + myApplyBtn = new QPushButton(tr("BUT_APPLY"), aFrame); + myCloseBtn = new QPushButton(tr("BUT_CLOSE"), aFrame); + + QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); + + QHBoxLayout* aLay = new QHBoxLayout(aFrame); + aLay->setMargin(5); + aLay->setSpacing(5); + + aLay->addWidget(myOkBtn); + aLay->addWidget(myApplyBtn); + aLay->addItem(aSpacer); + aLay->addWidget(myCloseBtn); + + connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk())); + connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply())); + connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose())); + + return aFrame; +} + +/*! + Destructor +*/ +ViewerTools_CubeAxesDlgBase::~ViewerTools_CubeAxesDlgBase() +{ +} + +/*! + Update dialog fields, connect signals and slots, show dialog +*/ +void ViewerTools_CubeAxesDlgBase::Update() +{ +} + +/*! + Verify validity of entry data +*/ +bool ViewerTools_CubeAxesDlgBase::isValid() const +{ + return true; +} + +/*! + Verify validity of entry data +*/ +bool ViewerTools_CubeAxesDlgBase::onApply() +{ + return true; +} + +/*! + SLOT called when "Ok" button pressed. +*/ +void ViewerTools_CubeAxesDlgBase::onOk() +{ + if (onApply()) + onClose(); +} + +/*! + SLOT: called when "Close" button pressed. Close dialog +*/ +void ViewerTools_CubeAxesDlgBase::onClose() +{ + reject(); +} diff --git a/src/ViewerTools/ViewerTools_CubeAxesDlgBase.h b/src/ViewerTools/ViewerTools_CubeAxesDlgBase.h new file mode 100644 index 000000000..d7e7b8539 --- /dev/null +++ b/src/ViewerTools/ViewerTools_CubeAxesDlgBase.h @@ -0,0 +1,119 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef VIEWERTOOLS_CUBEAXESDLGBASE_H +#define VIEWERTOOLS_CUBEAXESDLGBASE_H + +#include "ViewerTools_DialogBase.h" + +#include + +class QWidget; +class QPushButton; +class QTabWidget; +class QCheckBox; +class QGroupBox; +class QLineEdit; + +class QtxAction; +class QtxIntSpinBox; + +class ViewerTools_FontWidgetBase; + +/*! + * Class : ViewerTools_AxisWidgetBase + * Description : Axis tab widget of the "Graduated axis" dialog box +*/ +class VIEWERTOOLS_EXPORT ViewerTools_AxisWidgetBase : public QFrame +{ +public: + ViewerTools_AxisWidgetBase( QWidget* ); + ~ViewerTools_AxisWidgetBase(); + + void UseName( const bool ); + void SetName( const QString& ); + void SetNameFont( const QColor&, const int, const bool, const bool, const bool ); + +public: + virtual void initialize(); + +protected: + virtual ViewerTools_FontWidgetBase* createFontWidget( QWidget* ) = 0; + +protected: + // name + QGroupBox* myNameGrp; + QLineEdit* myAxisName; + ViewerTools_FontWidgetBase* myNameFont; + + // labels + QGroupBox* myLabelsGrp; + QtxIntSpinBox* myLabelNumber; + QtxIntSpinBox* myLabelOffset; + ViewerTools_FontWidgetBase* myLabelsFont; + + // tick marks + QGroupBox* myTicksGrp; + QtxIntSpinBox* myTickLength; +}; + +/*! + * Class : ViewerTools_CubeAxesDlgBase + * Description : Dialog for specifying cube axes properties + */ +class VIEWERTOOLS_EXPORT ViewerTools_CubeAxesDlgBase : public ViewerTools_DialogBase +{ + Q_OBJECT + +public: + ViewerTools_CubeAxesDlgBase(QtxAction* theAction, + QWidget* theParent, + const char* theName); + virtual ~ViewerTools_CubeAxesDlgBase(); + + virtual void initialize(); + + virtual void Update(); + +protected slots: + virtual void onOk(); + virtual bool onApply(); + virtual void onClose(); + +protected: + virtual QWidget* createButtonFrame( QWidget* ); + virtual QWidget* createMainFrame ( QWidget* ); + virtual bool isValid() const; + + virtual ViewerTools_AxisWidgetBase* createAxisWidget( QWidget* ) = 0; + +protected: + QTabWidget* myTabWg; + QCheckBox* myIsVisible; + + QPushButton* myOkBtn; + QPushButton* myApplyBtn; + QPushButton* myCloseBtn; + ViewerTools_AxisWidgetBase* myAxes[ 3 ]; +}; + +#endif diff --git a/src/ViewerTools/ViewerTools_DialogBase.cxx b/src/ViewerTools/ViewerTools_DialogBase.cxx new file mode 100644 index 000000000..2fc0e407b --- /dev/null +++ b/src/ViewerTools/ViewerTools_DialogBase.cxx @@ -0,0 +1,79 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "ViewerTools_DialogBase.h" + +#include "QtxAction.h" + +/*! + Constructor +*/ +ViewerTools_DialogBase +::ViewerTools_DialogBase(QtxAction* theAction, + QWidget* theParent, + const char* theName, + bool theModal, + Qt::WindowFlags theWFalgs): + QDialog(theParent, + theWFalgs | Qt::WindowTitleHint | Qt::WindowSystemMenuHint), + myAction(theAction) +{ + setObjectName(theName); + setModal(theModal); + + connect(theParent, SIGNAL(Show( QShowEvent * )), this, SLOT(onParentShow())); + connect(theParent, SIGNAL(Hide( QHideEvent * )), this, SLOT(onParentHide())); +} + +/* + * Destroys the object and frees any allocated resources + */ +ViewerTools_DialogBase +::~ViewerTools_DialogBase() +{ + // no need to delete child widgets, Qt does it all for us +} + +void +ViewerTools_DialogBase +::onParentShow() +{ + if(myAction->isChecked()) + show(); + else + hide(); +} + +void +ViewerTools_DialogBase +::onParentHide() +{ + hide(); +} + +void +ViewerTools_DialogBase +::done( int r ) +{ + myAction->setChecked( false ); + QDialog::done( r ); +} diff --git a/src/ViewerTools/ViewerTools_DialogBase.h b/src/ViewerTools/ViewerTools_DialogBase.h new file mode 100644 index 000000000..e9fcd56c3 --- /dev/null +++ b/src/ViewerTools/ViewerTools_DialogBase.h @@ -0,0 +1,54 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef VIEWERTOOLS_DIALOGBASE_H +#define VIEWERTOOLS_DIALOGBASE_H + +#include "ViewerTools.h" + +#include + +class QtxAction; + +class VIEWERTOOLS_EXPORT ViewerTools_DialogBase : public QDialog +{ + Q_OBJECT; + +public: + ViewerTools_DialogBase(QtxAction* theAction, + QWidget* theParent, + const char* theName = "", + bool theModal = FALSE, + Qt::WindowFlags theWFalgs = 0); + + ~ViewerTools_DialogBase(); + +protected slots: + void onParentShow(); + void onParentHide(); + virtual void done( int ); + +protected: + QtxAction* myAction; +}; + +#endif // VIEWERTOOLS_DIALOGBASE_H diff --git a/src/ViewerTools/ViewerTools_FontWidgetBase.cxx b/src/ViewerTools/ViewerTools_FontWidgetBase.cxx new file mode 100644 index 000000000..2558546f2 --- /dev/null +++ b/src/ViewerTools/ViewerTools_FontWidgetBase.cxx @@ -0,0 +1,128 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "ViewerTools_FontWidgetBase.h" + +#include +#include +#include +#include +#include + +/*! + * Class : ViewerTools_FontWidgetBase + * Description : Dialog for specifynig font + */ + +/*! + Constructor +*/ +ViewerTools_FontWidgetBase::ViewerTools_FontWidgetBase( QWidget* theParent ) +: QWidget( theParent ) +{ +} + +/*! + Destructor +*/ +ViewerTools_FontWidgetBase::~ViewerTools_FontWidgetBase() +{ +} + +void ViewerTools_FontWidgetBase::Initialize() +{ + myColorBtn = new QToolButton( this ); + myColorBtn->setMinimumWidth( 20 ); + + myFamily = new QComboBox( this ); + InitializeFamilies(); + + myBold = new QCheckBox( tr( "BOLD" ), this ); + myItalic = new QCheckBox( tr( "ITALIC" ), this ); + myShadow = new QCheckBox( tr( "SHADOW" ), this ); + + QHBoxLayout* aHBLayout = new QHBoxLayout; + aHBLayout->setMargin( 0 ); + aHBLayout->setSpacing( 5 ); + aHBLayout->addWidget(myColorBtn); + aHBLayout->addWidget(myFamily); + aHBLayout->addWidget(myBold); + aHBLayout->addWidget(myItalic); + aHBLayout->addWidget(myShadow); + aHBLayout->addStretch(); + this->setLayout(aHBLayout); + + connect( myColorBtn, SIGNAL( clicked() ), SLOT( onColor() ) ); + + if( myFamily->count() == 0 ) + { + myFamily->hide(); + myBold->hide(); + myItalic->hide(); + myShadow->hide(); + } +} + +void ViewerTools_FontWidgetBase::SetColor( const QColor& theColor ) +{ + QPalette palette; + palette.setColor(myColorBtn->backgroundRole(), theColor); + myColorBtn->setPalette(palette); +} + +QColor ViewerTools_FontWidgetBase::GetColor() const +{ + return myColorBtn->palette().color( myColorBtn->backgroundRole() ); +} + +void ViewerTools_FontWidgetBase::onColor() +{ + QColor aColor = QColorDialog::getColor( GetColor(), this ); + if ( aColor.isValid() ) + SetColor( aColor ); +} + +void ViewerTools_FontWidgetBase::SetData( const QColor& theColor, + const int theFamily, + const bool theBold, + const bool theItalic, + const bool theShadow ) +{ + SetColor( theColor ); + + myBold->setChecked( theBold ); + myItalic->setChecked( theItalic ); + myShadow->setChecked( theShadow ); +} + +void ViewerTools_FontWidgetBase::GetData( QColor& theColor, + int& theFamily, + bool& theBold, + bool& theItalic, + bool& theShadow ) const +{ + theColor = GetColor(); + + theBold = myBold->isChecked(); + theItalic = myItalic->isChecked(); + theShadow = myShadow->isChecked(); +} diff --git a/src/ViewerTools/ViewerTools_FontWidgetBase.h b/src/ViewerTools/ViewerTools_FontWidgetBase.h new file mode 100644 index 000000000..9ade57abc --- /dev/null +++ b/src/ViewerTools/ViewerTools_FontWidgetBase.h @@ -0,0 +1,71 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef VIEWERTOOLS_FONTWIDGETBASE_H +#define VIEWERTOOLS_FONTWIDGETBASE_H + +#include "ViewerTools.h" + +#include + +class QToolButton; +class QComboBox; +class QCheckBox; +class QColor; + +/*! + * Class : ViewerTools_FontWidgetBase + * Description : Dialog for specifying font + */ +class VIEWERTOOLS_EXPORT ViewerTools_FontWidgetBase : public QWidget +{ + Q_OBJECT + +public: + ViewerTools_FontWidgetBase( QWidget* ); + virtual ~ViewerTools_FontWidgetBase(); + + void SetColor( const QColor& ); + QColor GetColor() const; + + virtual void SetData( const QColor&, const int, const bool, const bool, const bool ); + + virtual void GetData( QColor&, int&, bool&, bool&, bool& ) const; + +public: + virtual void Initialize(); + +protected: + virtual void InitializeFamilies() = 0; + +protected slots: + void onColor(); + +protected: + QToolButton* myColorBtn; + QComboBox* myFamily; + QCheckBox* myBold; + QCheckBox* myItalic; + QCheckBox* myShadow; +}; + +#endif diff --git a/src/ViewerTools/resources/ViewerTools_msg_en.ts b/src/ViewerTools/resources/ViewerTools_msg_en.ts new file mode 100644 index 000000000..fe8c8598d --- /dev/null +++ b/src/ViewerTools/resources/ViewerTools_msg_en.ts @@ -0,0 +1,95 @@ + + + + ViewerTools_CubeAxesDlgBase + + X_AXIS + X axis + + + Y_AXIS + Y axis + + + Z_AXIS + Z axis + + + CAPTION + Graduated axes + + + IS_VISIBLE + Is visible + + + FONT + Font + + + NAME + Name + + + TICK_MARKS + Tick marks + + + LABELS + Labels + + + LENGTH + Length + + + NUMBER + Number + + + OFFSET + Offset + + + AXIS_NAME + Axis name + + + + ViewerTools_FontWidgetBase + + BOLD + Bold + + + ITALIC + Italic + + + SHADOW + Shadow + + + -- 2.39.2