src/ObjBrowser/Makefile \
src/Prs/Makefile \
src/OBJECT/Makefile \
+ src/ViewerTools/Makefile \
src/GLViewer/Makefile \
src/VTKViewer/Makefile \
src/SVTK/Makefile \
\image html occviewer_axialscale.png
\n <center><b>Scaling</b> - represents objects deformed (stretched or
stuffed) along the axes of coordinates.</center>
+<hr>
+
+\image html image109.png
+\n <center><b>Graduated axes</b> - allows to define parameters of axes
+and graduate them (available only with Open CASCADE 6.3 service pack 10)</center>
+
+\image html graduatedaxes2.png
+
+<ul>
+<li><b>Axis name</b></li>
+<ul>
+<li><b>Is visible</b> - if checked the axis name is displayed in the
+viewer.</li>
+<li><b>Name</b> - allows to redefine the name of the axis.</li>
+<li><b>Font</b> - allows to define color of the font of
+axis name.</li>
+</ul>
+<li><b>Labels</b></li>
+<ul>
+<li><b>Is visible</b> - if checked the labels are displayed in the
+viewer.</li>
+<li><b>Number</b> - allows to define the number of labels.</li>
+<li><b>Offset</b> - allows to define the distance between labels.</li>
+<li><b>Font</b> - allows to define color of the font of
+labels names.</li>
+</ul>
+<li><b>Tick marks</b></li>
+<ul>
+<li><b>Is visible</b> - if checked the tick marks are displayed in the
+viewer.</li>
+<li><b>Length</b> - allows to define the length of tick marks.</li>
+</ul>
+<li><b>Is visible</b> - if checked the axis is displayed in the
+viewer. </li>
+</ul>
+<hr>
<b>Note!</b> OCC Viewer features a special <b>Polyline Selection</b> mechanism, which allows selecting an arbitraty part of the graphic area using a polygon frame, instead of the usual selection with a rectangular frame.
<parameter name="Style" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
<parameter name="SUIT" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
<parameter name="STD" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
+ <parameter name="ViewerTools" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
<parameter name="Plot2d" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
<parameter name="SPlot2d" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
<parameter name="GLViewer" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
SUBDIRS_VTKVIEWER = VTKViewer
if ENABLE_SALOMEOBJECT
SUBDIRS_VTKVIEWER += SVTK
+ SUBDIRS_VIEWERTOOLS = ViewerTools
endif
endif
##
if ENABLE_OCCVIEWER
SUBDIRS_OCCVIEWER = OCCViewer
+ SUBDIRS_VIEWERTOOLS = ViewerTools
if ENABLE_SALOMEOBJECT
SUBDIRS_OCCVIEWER += SOCC
endif
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
OCCViewer_AxialScaleDlg.h \
OCCViewer_SetRotationPointDlg.h \
OCCViewer_Trihedron.h \
+ OCCViewer_FontWidget.h \
+ OCCViewer_CubeAxesDlg.h \
OCCViewer_ToolTip.h
dist_libOCCViewer_la_SOURCES = \
OCCViewer_ClippingDlg.cxx \
OCCViewer_AxialScaleDlg.cxx \
OCCViewer_Trihedron.cxx \
+ OCCViewer_FontWidget.cxx \
+ OCCViewer_CubeAxesDlg.cxx \
OCCViewer_ToolTip.cxx
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 = \
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 \
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
--- /dev/null
+// 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 <QCheckBox>
+#include <QGroupBox>
+#include <QLineEdit>
+
+#include <Standard_Version.hxx>
+
+#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<OCCViewer_AxisWidget*>( 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<OCCViewer_AxisWidget*>( 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<OCCViewer_AxisWidget*>( 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<OCCViewer_AxisWidget*>( 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
+}
--- /dev/null
+// 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 <ViewerTools_CubeAxesDlgBase.h>
+
+#include <V3d_View.hxx>
+
+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
--- /dev/null
+// 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 <QComboBox>
+
+//#include <vtkTextProperty.h>
+
+/*!
+ * 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;
+ */
+}
--- /dev/null
+// 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 <ViewerTools_FontWidgetBase.h>
+
+/*!
+ * 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
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<viewAspect> viewAspectList;
#include "OCCViewer_ClippingDlg.h"
#include "OCCViewer_SetRotationPointDlg.h"
#include "OCCViewer_AxialScaleDlg.h"
+#include "OCCViewer_CubeAxesDlg.h"
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <Graphic3d_Structure.hxx>
#include <Graphic3d_ExportFormat.hxx>
+#include <Standard_Version.hxx>
+
+#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
createActions();
createToolBar();
+
+ // Graduated axes dialog
+ QtxAction* anAction = dynamic_cast<QtxAction*>( toolMgr()->action( GraduatedAxesId ) );
+ myCubeAxesDlg = new OCCViewer_CubeAxesDlg( anAction, this, "OCCViewer_CubeAxesDlg" );
+ myCubeAxesDlg->initialize();
}
/*!
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);
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 );
}
myScalingDlg->show();
}
+/*!
+ Shows Graduated Axes dialog
+*/
+void OCCViewer_ViewWindow::onGraduatedAxes()
+{
+ myCubeAxesDlg->Update();
+ myCubeAxesDlg->show();
+}
+
void OCCViewer_ViewWindow::onAmbientToogle()
{
Handle(V3d_Viewer) viewer = myViewPort->getViewer();
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;
}
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;
}
{
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;
}
*/
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 );
}
/*!
class OCCViewer_AxialScaleDlg;
class OCCViewer_SetRotationPointDlg;
class OCCViewer_Viewer;
+class OCCViewer_CubeAxesDlg;
class viewAspect;
class QtxAction;
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,
void onCloneView();
void onClipping( bool on );
void onAxialScale();
+ void onGraduatedAxes();
void onAmbientToogle();
void onMemorizeView();
void onRestoreView();
OCCViewer_Viewer* myModel;
OCCViewer_ViewPort3d* myViewPort;
+ OCCViewer_CubeAxesDlg* myCubeAxesDlg;
+
RotationPointType myCurrPointType;
RotationPointType myPrevPointType;
gp_Pnt mySelectedPoint;
<source>ICON_OCCVIEWER_SCALING</source>
<translation>occ_view_scaling.png</translation>
</message>
+ <message>
+ <source>ICON_OCCVIEWER_GRADUATED_AXES</source>
+ <translation>occ_view_graduated_axes.png</translation>
+ </message>
<message>
<source>ICON_OCCVIEWER_AMBIENT</source>
<translation>occ_view_ambient.png</translation>
<source>MNU_SCALING</source>
<translation>Scaling</translation>
</message>
+ <message>
+ <source>DSC_GRADUATED_AXES</source>
+ <translation>Graduated axes</translation>
+ </message>
+ <message>
+ <source>MNU_GRADUATED_AXES</source>
+ <translation>Graduated axes</translation>
+ </message>
<message>
<source>DSC_AMBIENT</source>
<translation>Toogle keep only ambient light</translation>
SALOME_Actor.h \
SVTK_RectPicker.h \
SVTK_DeviceActor.h \
- SVTK_DialogBase.h \
SVTK_FontWidget.h \
SVTK_CubeAxesActor2D.h \
SVTK_Functor.h \
SVTK_NonIsometricDlg.cxx \
SVTK_UpdateRateDlg.cxx \
SVTK_CubeAxesDlg.cxx \
- SVTK_DialogBase.cxx \
SVTK_FontWidget.cxx \
SVTK_Trihedron.cxx \
SVTK_View.cxx \
SVTK_UpdateRateDlg_moc.cxx \
SVTK_CubeAxesDlg_moc.cxx \
SVTK_FontWidget_moc.cxx \
- SVTK_DialogBase_moc.cxx \
SVTK_ViewModelBase_moc.cxx \
SVTK_ViewManager_moc.cxx \
SVTK_ViewWindow_moc.cxx \
$(BOOST_CPPFLAGS) \
-I$(srcdir)/../Qtx \
-I$(srcdir)/../SUIT \
+ -I$(srcdir)/../ViewerTools \
-I$(srcdir)/../OBJECT \
-I$(srcdir)/../Prs \
-I$(srcdir)/../VTKViewer \
$(KERNEL_LDFLAGS)
-libSVTK_la_LIBADD = ../Qtx/libqtx.la ../SUIT/libsuit.la ../OBJECT/libSalomeObject.la \
- ../Prs/libSalomePrs.la ../VTKViewer/libVTKViewer.la \
- ../OpenGLUtils/libOpenGLUtils.la -lSALOMELocalTrace
+libSVTK_la_LIBADD = ../Qtx/libqtx.la ../SUIT/libsuit.la ../ViewerTools/libViewerTools.la \
+ ../OBJECT/libSalomeObject.la ../Prs/libSalomePrs.la \
+ ../VTKViewer/libVTKViewer.la ../OpenGLUtils/libOpenGLUtils.la \
+ -lSALOMELocalTrace
# Executable
bin_PROGRAMS = SVTK
#include "QtxAction.h"
#include "QtxIntSpinBox.h"
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QPushButton>
-#include <QTabWidget>
#include <QCheckBox>
#include <QGroupBox>
#include <QLineEdit>
-#include <QLabel>
#include <vtkAxisActor2D.h>
#include <vtkTextProperty.h>
\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;
return true;
}
-bool SVTK_CubeAxesDlg::AxisWidget::Apply(vtkAxisActor2D* theActor)
+bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor)
{
if (theActor == 0)
return false;
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;
}
/*!
*/
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
{
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
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();
-}
#ifndef SVTK_CubeAxesDlg_H
#define SVTK_CubeAxesDlg_H
-#include "SVTK_DialogBase.h"
+#include "SVTK.h"
-class QWidget;
-class QPushButton;
-class QTabWidget;
-class QCheckBox;
+#include <ViewerTools_CubeAxesDlgBase.h>
-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
//
#include "SVTK_FontWidget.h"
-#include <QToolButton>
#include <QComboBox>
-#include <QColorDialog>
-#include <QCheckBox>
-#include <QHBoxLayout>
#include <vtkTextProperty.h>
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() ) );
}
/*!
{
}
-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 );
myFamily->setCurrentIndex( 1 );
else
myFamily->setCurrentIndex( 2 );
-
- myBold->setChecked( theBold );
- myItalic->setChecked( theItalic );
- myShadow->setChecked( theShadow );
}
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();
}
#include "SVTK.h"
-#include <QWidget>
-
-class QToolButton;
-class QComboBox;
-class QCheckBox;
-class QColor;
-
+#include <ViewerTools_FontWidgetBase.h>
/*!
* 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
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
::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"));
#ifndef SVTK_NONISOMETRICDLG_H
#define SVTK_NONISOMETRICDLG_H
-#include "SVTK_DialogBase.h"
+#include <ViewerTools_DialogBase.h>
class SVTK_ViewWindow;
class QPushButton;
-class SVTK_NonIsometricDlg : public SVTK_DialogBase
+class SVTK_NonIsometricDlg : public ViewerTools_DialogBase
{
Q_OBJECT;
::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()),
#include "SVTK.h"
-#include "SVTK_DialogBase.h"
+#include <ViewerTools_DialogBase.h>
#include <vtkSmartPointer.h>
class vtkCallbackCommand;
class vtkObject;
-class SVTK_EXPORT SVTK_SetRotationPointDlg : public SVTK_DialogBase
+class SVTK_EXPORT SVTK_SetRotationPointDlg : public ViewerTools_DialogBase
{
Q_OBJECT;
::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()),
#ifndef SVTK_UPDATERATEDLG_H
#define SVTK_UPDATERATEDLG_H
-#include "SVTK_DialogBase.h"
+#include <ViewerTools_DialogBase.h>
#include <vtkSmartPointer.h>
class vtkObject;
-class SVTK_UpdateRateDlg : public SVTK_DialogBase
+class SVTK_UpdateRateDlg : public ViewerTools_DialogBase
{
Q_OBJECT;
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()),
#include "SVTK.h"
-#include "SVTK_DialogBase.h"
+#include <ViewerTools_DialogBase.h>
#include <vtkSmartPointer.h>
#include <vtkTimeStamp.h>
class vtkCallbackCommand;
class vtkObject;
-class SVTK_EXPORT SVTK_ViewParameterDlg : public SVTK_DialogBase
+class SVTK_EXPORT SVTK_ViewParameterDlg : public ViewerTools_DialogBase
{
Q_OBJECT;
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
<translation>Interaction Style Switch</translation>
</message>
</context>
-<context>
- <name>SVTK_CubeAxesDlg</name>
- <message>
- <source>X_AXIS</source>
- <translation>X axis</translation>
- </message>
- <message>
- <source>Y_AXIS</source>
- <translation>Y axis</translation>
- </message>
- <message>
- <source>Z_AXIS</source>
- <translation>Z axis</translation>
- </message>
- <message>
- <source>CAPTION</source>
- <translation>Graduated axes</translation>
- </message>
- <message>
- <source>IS_VISIBLE</source>
- <translation>Is visible</translation>
- </message>
- <message>
- <source>FONT</source>
- <translation>Font</translation>
- </message>
- <message>
- <source>NAME</source>
- <translation>Name</translation>
- </message>
- <message>
- <source>TICK_MARKS</source>
- <translation>Tick marks</translation>
- </message>
- <message>
- <source>LABELS</source>
- <translation>Labels</translation>
- </message>
- <message>
- <source>LENGTH</source>
- <translation>Length</translation>
- </message>
- <message>
- <source>NUMBER</source>
- <translation>Number</translation>
- </message>
- <message>
- <source>OFFSET</source>
- <translation>Offset</translation>
- </message>
- <message>
- <source>AXIS_NAME</source>
- <translation>Axis name</translation>
- </message>
-</context>
<context>
<name>SVTK_FontWidget</name>
- <message>
- <source>BOLD</source>
- <translation>Bold</translation>
- </message>
<message>
<source>ARIAL</source>
<translation>Arial</translation>
<source>TIMES</source>
<translation>Times</translation>
</message>
- <message>
- <source>ITALIC</source>
- <translation>Italic</translation>
- </message>
- <message>
- <source>SHADOW</source>
- <translation>Shadow</translation>
- </message>
<message>
<source>COURIER</source>
<translation>Courier</translation>
<parameter name="Style" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
<parameter name="SUIT" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
<parameter name="STD" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
+ <parameter name="ViewerTools" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
<parameter name="Plot2d" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
<parameter name="SPlot2d" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
<parameter name="GLViewer" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
--- /dev/null
+# 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
--- /dev/null
+// 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
--- /dev/null
+// 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 <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QPushButton>
+#include <QTabWidget>
+#include <QCheckBox>
+#include <QGroupBox>
+#include <QLineEdit>
+#include <QLabel>
+
+/*!
+ * 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();
+}
--- /dev/null
+// 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 <QFrame>
+
+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
--- /dev/null
+// 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 );
+}
--- /dev/null
+// 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 <QDialog>
+
+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
--- /dev/null
+// 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 <QToolButton>
+#include <QComboBox>
+#include <QColorDialog>
+#include <QCheckBox>
+#include <QHBoxLayout>
+
+/*!
+ * 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();
+}
--- /dev/null
+// 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 <QWidget>
+
+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
--- /dev/null
+<!DOCTYPE TS><TS>
+<!--
+ 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
+
+-->
+<context>
+ <name>ViewerTools_CubeAxesDlgBase</name>
+ <message>
+ <source>X_AXIS</source>
+ <translation>X axis</translation>
+ </message>
+ <message>
+ <source>Y_AXIS</source>
+ <translation>Y axis</translation>
+ </message>
+ <message>
+ <source>Z_AXIS</source>
+ <translation>Z axis</translation>
+ </message>
+ <message>
+ <source>CAPTION</source>
+ <translation>Graduated axes</translation>
+ </message>
+ <message>
+ <source>IS_VISIBLE</source>
+ <translation>Is visible</translation>
+ </message>
+ <message>
+ <source>FONT</source>
+ <translation>Font</translation>
+ </message>
+ <message>
+ <source>NAME</source>
+ <translation>Name</translation>
+ </message>
+ <message>
+ <source>TICK_MARKS</source>
+ <translation>Tick marks</translation>
+ </message>
+ <message>
+ <source>LABELS</source>
+ <translation>Labels</translation>
+ </message>
+ <message>
+ <source>LENGTH</source>
+ <translation>Length</translation>
+ </message>
+ <message>
+ <source>NUMBER</source>
+ <translation>Number</translation>
+ </message>
+ <message>
+ <source>OFFSET</source>
+ <translation>Offset</translation>
+ </message>
+ <message>
+ <source>AXIS_NAME</source>
+ <translation>Axis name</translation>
+ </message>
+</context>
+<context>
+ <name>ViewerTools_FontWidgetBase</name>
+ <message>
+ <source>BOLD</source>
+ <translation>Bold</translation>
+ </message>
+ <message>
+ <source>ITALIC</source>
+ <translation>Italic</translation>
+ </message>
+ <message>
+ <source>SHADOW</source>
+ <translation>Shadow</translation>
+ </message>
+</context>
+</TS>