--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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
+//
+// File : Plot2d.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+
+#include "Plot2d.h"
+
+#include <QPainter>
+
+/*!
+ \brief Convert Plot2d marker type to Qwt marker type.
+ \param m Plot2d marker type
+ \return Qwt marker type
+*/
+QwtSymbol::Style Plot2d::plot2qwtMarker( Plot2d::MarkerType m )
+{
+ QwtSymbol::Style ms = QwtSymbol::NoSymbol;
+ switch ( m ) {
+ case Plot2d::Circle:
+ ms = QwtSymbol::Ellipse; break;
+ case Plot2d::Rectangle:
+ ms = QwtSymbol::Rect; break;
+ case Plot2d::Diamond:
+ ms = QwtSymbol::Diamond; break;
+ case Plot2d::DTriangle:
+ ms = QwtSymbol::DTriangle; break;
+ case Plot2d::UTriangle:
+ ms = QwtSymbol::UTriangle; break;
+ case Plot2d::LTriangle:
+ ms = QwtSymbol::LTriangle; break;
+ case Plot2d::RTriangle:
+ ms = QwtSymbol::RTriangle; break;
+ case Plot2d::Cross:
+ ms = QwtSymbol::Cross; break;
+ case Plot2d::XCross:
+ ms = QwtSymbol::XCross; break;
+ case Plot2d::None:
+ default:
+ ms = QwtSymbol::NoSymbol; break;
+ }
+ return ms;
+}
+
+/*!
+ \brief Convert Qwt marker type to Plot2d marker type.
+ \param m Qwt marker type
+ \return Plot2d marker type
+*/
+Plot2d::MarkerType Plot2d::qwt2plotMarker( QwtSymbol::Style m )
+{
+ Plot2d::MarkerType ms = Plot2d::None;
+ switch ( m ) {
+ case QwtSymbol::Ellipse:
+ ms = Plot2d::Circle; break;
+ case QwtSymbol::Rect:
+ ms = Plot2d::Rectangle; break;
+ case QwtSymbol::Diamond:
+ ms = Plot2d::Diamond; break;
+ case QwtSymbol::DTriangle:
+ ms = Plot2d::DTriangle; break;
+ case QwtSymbol::UTriangle:
+ ms = Plot2d::UTriangle; break;
+ case QwtSymbol::RTriangle:
+ ms = Plot2d::RTriangle; break;
+ case QwtSymbol::LTriangle:
+ ms = Plot2d::LTriangle; break;
+ case QwtSymbol::Cross:
+ ms = Plot2d::Cross; break;
+ case QwtSymbol::XCross:
+ ms = Plot2d::XCross; break;
+ case QwtSymbol::NoSymbol:
+ default:
+ ms = Plot2d::None; break;
+ }
+ return ms;
+}
+
+/*!
+ \brief Convert Plot2d line type to Qt/Qwt line type.
+ \param p Plot2d line type
+ \return Qt/Qwt line type
+*/
+Qt::PenStyle Plot2d::plot2qwtLine( Plot2d::LineType p )
+{
+ Qt::PenStyle ps = Qt::NoPen;
+ switch ( p ) {
+ case Plot2d::Solid:
+ ps = Qt::SolidLine; break;
+ case Plot2d::Dash:
+ ps = Qt::DashLine; break;
+ case Plot2d::Dot:
+ ps = Qt::DotLine; break;
+ case Plot2d::DashDot:
+ ps = Qt::DashDotLine; break;
+ case Plot2d::DashDotDot:
+ ps = Qt::DashDotDotLine; break;
+ case Plot2d::NoPen:
+ default:
+ ps = Qt::NoPen; break;
+ }
+ return ps;
+}
+
+/*!
+ \brief Convert Qt/Qwt line type to Plot2d line type.
+ \param p Qt/Qwt line type
+ \return Plot2d line type
+*/
+Plot2d::LineType Plot2d::qwt2plotLine( Qt::PenStyle p )
+{
+ Plot2d::LineType ps = Plot2d::NoPen;
+ switch ( p ) {
+ case Qt::SolidLine:
+ ps = Plot2d::Solid; break;
+ case Qt::DashLine:
+ ps = Plot2d::Dash; break;
+ case Qt::DotLine:
+ ps = Plot2d::Dot; break;
+ case Qt::DashDotLine:
+ ps = Plot2d::DashDot; break;
+ case Qt::DashDotDotLine:
+ ps = Plot2d::DashDotDot; break;
+ case Qt::NoPen:
+ default:
+ ps = Plot2d::NoPen; break;
+ }
+ return ps;
+}
+
+/*!
+ \brief Draw line.
+ \param painter painter
+ \param p1 starting point
+ \param p2 ending point
+ \param type line type
+ \param color line color
+ \param width line width
+*/
+void Plot2d::drawLine( QPainter* painter, const QPoint& p1, const QPoint& p2,
+ Qt::PenStyle type, const QColor& color, int width )
+{
+ painter->save();
+ QPen pen( type );
+ pen.setColor( color );
+ pen.setWidth( width );
+ painter->setPen( pen );
+ painter->drawLine( p1, p2 );
+ painter->restore();
+}
+
+/*!
+ \brief Draw line.
+ \param painter painter
+ \param p1 starting point
+ \param p2 ending point
+ \param type line type
+ \param color line color
+ \param width line width
+*/
+void Plot2d::drawLine( QPainter* painter, const QPoint& p1, const QPoint& p2,
+ Plot2d::LineType type, const QColor& color, int width )
+{
+ drawLine( painter, p1, p2, plot2qwtLine( type ), color, width );
+}
+
+/*!
+ \brief Draw line.
+ \param painter painter
+ \param x1 X coordinate of the starting point
+ \param y1 Y coordinate of the starting point
+ \param x2 X coordinate of the ending point
+ \param y2 Y coordinate of the ending point
+ \param type line type
+ \param color line color
+ \param width line width
+*/
+void Plot2d::drawLine( QPainter* painter, int x1, int y1, int x2, int y2,
+ Qt::PenStyle type, const QColor& color, int width )
+{
+ drawLine( painter, QPoint( x1, y1 ), QPoint( x2, y2 ), type, color, width );
+}
+
+/*!
+ \brief Draw line.
+ \param painter painter
+ \param x1 X coordinate of the starting point
+ \param y1 Y coordinate of the starting point
+ \param x2 X coordinate of the ending point
+ \param y2 Y coordinate of the ending point
+ \param type line type
+ \param color line color
+ \param width line width
+*/
+void Plot2d::drawLine( QPainter* painter, int x1, int y1, int x2, int y2,
+ Plot2d::LineType type, const QColor& color, int width )
+{
+ drawLine( painter, QPoint( x1, y1 ), QPoint( x2, y2 ),
+ plot2qwtLine( type), color, width );
+}
+
+/*!
+ \brief Draw marker.
+ \param painter painter
+ \param p central point
+ \param r marker rectangle
+ \param type marker type
+ \param color marker color
+*/
+void Plot2d::drawMarker( QPainter* painter, const QPoint& p, const QRect& r,
+ QwtSymbol::Style type, const QColor& color )
+{
+ painter->save();
+ painter->setPen( color );
+ painter->setBrush( color );
+
+ QRect ar = r;
+ ar.moveCenter( p );
+ const int w2 = ar.width() / 2;
+ const int h2 = ar.height() / 2;
+
+ switch( type ) {
+ case QwtSymbol::Ellipse:
+ painter->drawEllipse( ar );
+ break;
+ case QwtSymbol::Rect:
+ painter->drawRect( ar );
+ painter->fillRect( ar, QBrush( color ) );
+ break;
+ case QwtSymbol::Diamond:
+ {
+ QPolygon polygon;
+ polygon << QPoint( ar.x() + w2, ar.y() );
+ polygon << QPoint( ar.right(), ar.y() + h2 );
+ polygon << QPoint( ar.x() + w2, ar.bottom() );
+ polygon << QPoint( ar.x(), ar.y() + h2 );
+ painter->drawPolygon( polygon );
+ break;
+ }
+ case QwtSymbol::Cross:
+ painter->drawLine( ar.left() + w2, ar.top(), ar.left() + w2, ar.bottom() );
+ painter->drawLine( ar.left(), ar.top() + h2, ar.right(), ar.top() + h2 );
+ break;
+ case QwtSymbol::XCross:
+ painter->drawLine( ar.left(), ar.top(), ar.right(), ar.bottom() );
+ painter->drawLine( ar.left(), ar.bottom(), ar.right(), ar.top() );
+ break;
+ case QwtSymbol::UTriangle:
+ {
+ QPolygon polygon;
+ polygon << QPoint( ar.left() + w2, ar.top() );
+ polygon << QPoint( ar.right(), ar.bottom() );
+ polygon << QPoint( ar.left(), ar.bottom() );
+ painter->drawPolygon( polygon );
+ break;
+ }
+ case QwtSymbol::DTriangle:
+ {
+ QPolygon polygon;
+ polygon << QPoint( ar.left() + w2, ar.bottom() );
+ polygon << QPoint( ar.right(), ar.top() );
+ polygon << QPoint( ar.left(), ar.top() );
+ painter->drawPolygon( polygon );
+ break;
+ }
+ case QwtSymbol::RTriangle:
+ {
+ QPolygon polygon;
+ polygon << QPoint( ar.left(), ar.top() );
+ polygon << QPoint( ar.right(), ar.top() + h2 );
+ polygon << QPoint( ar.left(), ar.bottom() );
+ painter->drawPolygon( polygon );
+ break;
+ }
+ case QwtSymbol::LTriangle:
+ {
+ QPolygon polygon;
+ polygon << QPoint( ar.left(), ar.top() + h2 );
+ polygon << QPoint( ar.right(), ar.top() );
+ polygon << QPoint( ar.right(), ar.bottom() );
+ painter->drawPolygon( polygon );
+ break;
+ }
+ default:
+ break;
+ }
+ painter->restore();
+}
+
+/*!
+ \brief Draw marker.
+ \param painter painter
+ \param p central point
+ \param r marker rectangle
+ \param type marker type
+ \param color marker color
+*/
+void Plot2d::drawMarker( QPainter* painter, const QPoint& p, const QRect& r,
+ Plot2d::MarkerType type, const QColor& color )
+{
+ drawMarker( painter, p, r, plot2qwtMarker( type ), color );
+}
+
+/*!
+ \brief Draw marker.
+ \param painter painter
+ \param x X coordinate of the central point
+ \param y Y coordinate of the central point
+ \param w marker rectangle width
+ \param h marker rectangle height
+ \param type marker type
+ \param color marker color
+*/
+void Plot2d::drawMarker( QPainter* painter, int x, int y, int w, int h,
+ QwtSymbol::Style type, const QColor& color )
+{
+ drawMarker( painter, QPoint( x, y ), QRect( 0, 0, w, h ), type, color );
+}
+
+/*!
+ \brief Draw marker.
+ \param painter painter
+ \param x X coordinate of the central point
+ \param y Y coordinate of the central point
+ \param w marker rectangle width
+ \param h marker rectangle height
+ \param type marker type
+ \param color marker color
+*/
+void Plot2d::drawMarker( QPainter* painter, int x, int y, int w, int h,
+ Plot2d::MarkerType type, const QColor& color )
+{
+ drawMarker( painter, QPoint( x, y ), QRect( 0, 0, w, h ), plot2qwtMarker( type ), color );
+}
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#ifdef WNT
-#ifdef PLOT2D_EXPORTS
-#define PLOT2D_EXPORT __declspec(dllexport)
-#else
-#define PLOT2D_EXPORT __declspec(dllimport)
-#endif
+// File : Plot2d.h
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+
+#ifndef PLOT2D_H
+#define PLOT2D_H
+
+#ifdef WIN32
+# ifdef PLOT2D_EXPORTS
+# define PLOT2D_EXPORT __declspec(dllexport)
+# else
+# define PLOT2D_EXPORT __declspec(dllimport)
+# endif
#else
-#define PLOT2D_EXPORT
+# define PLOT2D_EXPORT
#endif
-#if defined WNT
-#pragma warning ( disable: 4251 )
+#include <qwt_symbol.h>
+#include <Qt>
+
+class QPainter;
+
+namespace Plot2d
+{
+ typedef enum { None,
+ Circle,
+ Rectangle,
+ Diamond,
+ DTriangle,
+ UTriangle,
+ LTriangle,
+ RTriangle,
+ Cross,
+ XCross
+ } MarkerType;
+
+ typedef enum {
+ NoPen,
+ Solid,
+ Dash,
+ Dot,
+ DashDot,
+ DashDotDot
+ } LineType;
+
+ QwtSymbol::Style plot2qwtMarker( MarkerType );
+ MarkerType qwt2plotMarker( QwtSymbol::Style );
+
+ Qt::PenStyle plot2qwtLine( LineType );
+ LineType qwt2plotLine( Qt::PenStyle );
+
+ void drawLine( QPainter*, const QPoint&, const QPoint&,
+ Qt::PenStyle = Qt::SolidLine,
+ const QColor& = Qt::black, int = 0 );
+ void drawLine( QPainter*, const QPoint&, const QPoint&,
+ LineType = Solid,
+ const QColor& = Qt::black, int = 0 );
+ void drawLine( QPainter*, int, int, int, int,
+ Qt::PenStyle = Qt::SolidLine,
+ const QColor& = Qt::black, int = 0 );
+ void drawLine( QPainter*, int, int, int, int,
+ LineType = Solid,
+ const QColor& = Qt::black, int = 0 );
+
+ void drawMarker( QPainter*, const QPoint&, const QRect&,
+ QwtSymbol::Style = QwtSymbol::Ellipse,
+ const QColor& = Qt::black );
+ void drawMarker( QPainter*, const QPoint&, const QRect&,
+ MarkerType = Circle,
+ const QColor& = Qt::black );
+ void drawMarker( QPainter*, int, int, int, int,
+ QwtSymbol::Style = QwtSymbol::Ellipse,
+ const QColor& = Qt::black );
+ void drawMarker( QPainter*, int, int, int, int,
+ MarkerType = Circle,
+ const QColor& = Qt::black );
+}
+
+#if defined WIN32
+# pragma warning ( disable: 4251 )
#endif
+
+#endif // PLOT2D_H
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// File : Plot2d_Curve.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+
#include "Plot2d_Curve.h"
-#include <qcolor.h>
+#include <QColor>
/*!
Constructor
*/
Plot2d_Curve::Plot2d_Curve()
: myHorTitle( "" ), myVerTitle( "" ),
-myHorUnits( "" ), myVerUnits( "" ),
-myAutoAssign( true ), myColor( 0,0,0 ), myMarker( Circle ), myLine( Solid ), myLineWidth( 0 ),
-myYAxis( QwtPlot::yLeft )
+ myHorUnits( "" ), myVerUnits( "" ),
+ myAutoAssign( true ),
+ myColor( 0,0,0 ),
+ myMarker( Plot2d::Circle ),
+ myLine( Plot2d::Solid ),
+ myLineWidth( 0 ),
+ myYAxis( QwtPlot::yLeft )
{
}
aPoint.y = theY;
aPoint.text = txt;
- QValueList<Plot2d_Point>::iterator aIt;
+ QList<Plot2d_Point>::iterator aIt;
int aCurrent = 0;
for(aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) {
if (thePos == aCurrent) {
*/
void Plot2d_Curve::deletePoint(int thePos)
{
- QValueList<Plot2d_Point>::iterator aIt;
- int aCurrent = 0;
- for(aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) {
- if (thePos == aCurrent) {
- myPoints.remove(aIt);
- return;
- }
- aCurrent++;
- }
+ if ( thePos >= 0 && thePos < myPoints.count() )
+ myPoints.removeAt( thePos );
}
/*!
clearAllPoints();
QStringList::const_iterator anIt = lst.begin(), aLast = lst.end();
for( long i = 0; i < size; i++, anIt++ )
- addPoint( hData[i], vData[i], anIt==aLast ? QString::null : *anIt );
+ addPoint( hData[i], vData[i], anIt==aLast ? QString() : *anIt );
}
/*!
/*!
Sets curve's marker ( and resets AutoAssign flag )
*/
-void Plot2d_Curve::setMarker( MarkerType marker )
+void Plot2d_Curve::setMarker( Plot2d::MarkerType marker )
{
myMarker = marker;
myAutoAssign = false;
/*!
Gets curve's marker
*/
-Plot2d_Curve::MarkerType Plot2d_Curve::getMarker() const
+Plot2d::MarkerType Plot2d_Curve::getMarker() const
{
return myMarker;
}
algorithm for diagonals.
For horizontal and vertical lines a line width of 0 is the same as a line width of 1.
*/
-void Plot2d_Curve::setLine( LineType line, const int lineWidth )
+void Plot2d_Curve::setLine( Plot2d::LineType line, const int lineWidth )
{
myLine = line;
myLineWidth = lineWidth;
/*!
Gets curve's line type
*/
-Plot2d_Curve::LineType Plot2d_Curve::getLine() const
+Plot2d::LineType Plot2d_Curve::getLine() const
{
return myLine;
}
*/
double Plot2d_Curve::getMinX() const
{
- QValueList<Plot2d_Point>::const_iterator aIt;
+ QList<Plot2d_Point>::const_iterator aIt;
double aMinX = 1e150;
//int aCurrent = 0;
for(aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) {
*/
double Plot2d_Curve::getMinY() const
{
- QValueList<Plot2d_Point>::const_iterator aIt;
+ QList<Plot2d_Point>::const_iterator aIt;
double aMinY = 1e150;
//int aCurrent = 0;
for(aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) {
QString Plot2d_Curve::text( const int ind ) const
{
if( ind<0 || ind>=myPoints.count() )
- return QString::null;
+ return QString();
else
return myPoints[ind].text;
}
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// File : Plot2d_Curve.h
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+
#ifndef PLOT2D_CURVE_H
#define PLOT2D_CURVE_H
#include "Plot2d.h"
-#include <qvaluelist.h>
-#include <qptrlist.h>
+
+#include <QList>
#include <qwt_plot.h>
class QColor;
QString text;
} Plot2d_Point;
-typedef QValueList<Plot2d_Point> pointList;
+typedef QList<Plot2d_Point> pointList;
class PLOT2D_EXPORT Plot2d_Curve
{
public:
- enum MarkerType { None, Circle, Rectangle, Diamond,
- DTriangle, UTriangle, LTriangle, RTriangle,
- Cross, XCross };
- enum LineType { NoPen, Solid, Dash, Dot, DashDot, DashDotDot };
-
Plot2d_Curve();
virtual ~Plot2d_Curve();
- Plot2d_Curve( const Plot2d_Curve& curve );
- Plot2d_Curve& operator= ( const Plot2d_Curve& curve );
+ Plot2d_Curve( const Plot2d_Curve& );
+ Plot2d_Curve& operator= ( const Plot2d_Curve& );
- virtual QString getTableTitle() const;
+ virtual QString getTableTitle() const;
- void setHorTitle( const QString& title );
- QString getHorTitle() const;
- void setVerTitle( const QString& title );
- QString getVerTitle() const;
- void setHorUnits( const QString& units );
- QString getHorUnits() const;
- void setVerUnits( const QString& units );
- QString getVerUnits() const;
- void addPoint(double theX, double theY, const QString& = QString::null );
- void insertPoint(int thePos, double theX, double theY, const QString& = QString::null );
- void deletePoint(int thePos);
- void clearAllPoints();
- pointList getPointList() const;
-
- void setData( const double* hData, const double* vData, long size, const QStringList& = QStringList() );
- double* horData() const;
- double* verData() const;
-
- void setText( const int, const QString& );
- QString text( const int ) const;
-
- int nbPoints() const;
- bool isEmpty() const;
-
- void setAutoAssign( bool on );
- bool isAutoAssign() const;
- void setColor( const QColor& color );
- QColor getColor() const;
- void setMarker( MarkerType marker );
- MarkerType getMarker() const;
- void setLine( LineType line, const int lineWidth = 0 );
- LineType getLine() const;
- int getLineWidth() const;
- void setYAxis(QwtPlot::Axis theYAxis);
- QwtPlot::Axis getYAxis() const;
+ void setHorTitle( const QString& );
+ QString getHorTitle() const;
+ void setVerTitle( const QString& );
+ QString getVerTitle() const;
+
+ void setHorUnits( const QString& );
+ QString getHorUnits() const;
+ void setVerUnits( const QString& );
+ QString getVerUnits() const;
+
+ void addPoint( double, double, const QString& = QString() );
+ void insertPoint( int, double, double, const QString& = QString() );
+ void deletePoint( int );
+ void clearAllPoints();
+ pointList getPointList() const;
+
+ void setData( const double*, const double*,
+ long, const QStringList& = QStringList() );
+ double* horData() const;
+ double* verData() const;
+
+ void setText( const int, const QString& );
+ QString text( const int ) const;
+
+ int nbPoints() const;
+ bool isEmpty() const;
+
+ void setAutoAssign( bool );
+ bool isAutoAssign() const;
+
+ void setColor( const QColor& );
+ QColor getColor() const;
+
+ void setMarker( Plot2d::MarkerType );
+ Plot2d::MarkerType getMarker() const;
+
+ void setLine( Plot2d::LineType, const int = 0 );
+ Plot2d::LineType getLine() const;
+ int getLineWidth() const;
+
+ void setYAxis( QwtPlot::Axis );
+ QwtPlot::Axis getYAxis() const;
// Protection against QwtCurve::drawLines() bug in Qwt 0.4.x:
// it crashes if switched to X/Y logarithmic mode, when one or more points have
// non-positive X/Y coordinate
- double getMinX() const;
- double getMinY() const;
+ double getMinX() const;
+ double getMinY() const;
protected:
- bool myAutoAssign;
- QString myHorTitle;
- QString myVerTitle;
- QString myHorUnits;
- QString myVerUnits;
- QColor myColor;
- MarkerType myMarker;
- LineType myLine;
- int myLineWidth;
- QwtPlot::Axis myYAxis;
-
- pointList myPoints;
+ bool myAutoAssign;
+ QString myHorTitle;
+ QString myVerTitle;
+ QString myHorUnits;
+ QString myVerUnits;
+ QColor myColor;
+ Plot2d::MarkerType myMarker;
+ Plot2d::LineType myLine;
+ int myLineWidth;
+ QwtPlot::Axis myYAxis;
+
+ pointList myPoints;
};
-typedef QPtrList<Plot2d_Curve> curveList;
+typedef QList<Plot2d_Curve*> curveList;
#endif
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// File : Plot2d_FitDataDlg.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
+// File : Plot2d_FitDataDlg.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
#include "Plot2d_FitDataDlg.h"
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qvalidator.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qbuttongroup.h>
-#include <qlineedit.h>
+#include <QLabel>
+#include <QLayout>
+#include <QValidator>
+#include <QPushButton>
+#include <QRadioButton>
+#include <QGroupBox>
+#include <QLineEdit>
#define SPACING_SIZE 6
#define MARGIN_SIZE 11
*/
Plot2d_FitDataDlg::Plot2d_FitDataDlg( QWidget* parent, bool secondAxisY )
: QDialog( parent ? parent : 0,
- "Plot2d_FitDataDlg",
- true,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
- myY2MinEdit( 0 ), myY2MaxEdit( 0 ), mySecondAxisY( secondAxisY )
+ Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
+ myY2MinEdit( 0 ), myY2MaxEdit( 0 ), mySecondAxisY( secondAxisY )
{
- setCaption( tr( "FIT_DATA_TLT" ) );
+ setObjectName( "Plot2d_FitDataDlg" );
+ setModal( true );
+ setWindowTitle( tr( "FIT_DATA_TLT" ) );
setSizeGripEnabled( TRUE );
QGridLayout* topLayout = new QGridLayout( this );
topLayout->setSpacing( SPACING_SIZE );
topLayout->setMargin( MARGIN_SIZE );
// 'Range' group
- myRangeGrp = new QButtonGroup( this );
- myRangeGrp->setColumnLayout( 0, Qt::Vertical );
- myRangeGrp->layout()->setSpacing( 0 );
- myRangeGrp->layout()->setMargin( 0 );
- QGridLayout* aGridLayout = new QGridLayout( myRangeGrp->layout() );
+ myRangeGrp = new QGroupBox( this );
+ QGridLayout* aGridLayout = new QGridLayout( myRangeGrp );
+ myRangeGrp->setLayout( aGridLayout );
aGridLayout->setAlignment( Qt::AlignTop );
aGridLayout->setMargin( MARGIN_SIZE );
aGridLayout->setSpacing( SPACING_SIZE );
QFont font = horLab->font(); font.setBold( true );
horLab->setFont( font ); verLab->setFont( font );
- aGridLayout->addMultiCellLayout( aModeLayout, 0, 0, 0, 4 );
- aGridLayout->addMultiCellWidget( aHLine, 1, 1, 0, 4 );
- aGridLayout->addWidget ( horLab, 2, 0 );
- aGridLayout->addWidget ( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
- 2, 1 );
- aGridLayout->addWidget ( myXMinEdit, 2, 2 );
- aGridLayout->addWidget ( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
- 2, 3 );
- aGridLayout->addWidget ( myXMaxEdit, 2, 4 );
- aGridLayout->addWidget ( verLab, 3, 0 );
- aGridLayout->addWidget ( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
- 3, 1 );
- aGridLayout->addWidget ( myYMinEdit, 3, 2 );
- aGridLayout->addWidget ( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
- 3, 3 );
- aGridLayout->addWidget ( myYMaxEdit, 3, 4 );
+ aGridLayout->addLayout( aModeLayout, 0, 0, 1, 5 );
+ aGridLayout->addWidget( aHLine, 1, 0, 1, 5 );
+ aGridLayout->addWidget( horLab, 2, 0 );
+ aGridLayout->addWidget( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
+ 2, 1 );
+ aGridLayout->addWidget( myXMinEdit, 2, 2 );
+ aGridLayout->addWidget( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
+ 2, 3 );
+ aGridLayout->addWidget( myXMaxEdit, 2, 4 );
+ aGridLayout->addWidget( verLab, 3, 0 );
+ aGridLayout->addWidget( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
+ 3, 1 );
+ aGridLayout->addWidget( myYMinEdit, 3, 2 );
+ aGridLayout->addWidget( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
+ 3, 3 );
+ aGridLayout->addWidget( myYMaxEdit, 3, 4 );
if (mySecondAxisY) {
QLabel* ver2Lab = new QLabel(tr( "VERTICAL_RIGHT_AXIS" ), myRangeGrp );
ver2Lab->setFont( font );
- aGridLayout->addWidget ( ver2Lab, 4, 0 );
- aGridLayout->addWidget ( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
- 4, 1 );
- aGridLayout->addWidget ( myY2MinEdit, 4, 2 );
- aGridLayout->addWidget ( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
- 4, 3 );
- aGridLayout->addWidget ( myY2MaxEdit, 4, 4 );
+ aGridLayout->addWidget( ver2Lab, 4, 0 );
+ aGridLayout->addWidget( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
+ 4, 1 );
+ aGridLayout->addWidget( myY2MinEdit, 4, 2 );
+ aGridLayout->addWidget( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
+ 4, 3 );
+ aGridLayout->addWidget( myY2MaxEdit, 4, 4 );
}
// OK/Cancel buttons
- myOkBtn = new QPushButton( tr( "BUT_OK" ), this, "buttonOk" );
+ myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
+ myOkBtn->setObjectName( "buttonOk" );
myOkBtn->setAutoDefault( TRUE );
myOkBtn->setDefault( TRUE );
- myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this, "buttonCancel" );
+ myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
+ myCancelBtn->setObjectName( "buttonCancel" );
myCancelBtn->setAutoDefault( TRUE );
- topLayout->addMultiCellWidget( myRangeGrp, 0, 0, 0, 2 );
+ topLayout->addWidget( myRangeGrp, 0, 0, 1, 3 );
topLayout->addWidget( myOkBtn, 1, 0 );
- topLayout->setColStretch( 1, 5 );
+ topLayout->setColumnStretch( 1, 5 );
topLayout->addWidget( myCancelBtn, 1, 2 );
// connect signals
#define PLOT2D_FITDATADLG_H
#include "Plot2d.h"
-#include <qdialog.h>
+#include <QDialog>
-class QButtonGroup;
+class QGroupBox;
class QRadioButton;
class QLineEdit;
class QPushButton;
void onModeChanged(int);
private:
- QButtonGroup* myRangeGrp;
+ QGroupBox* myRangeGrp;
QRadioButton* myModeAllRB;
QRadioButton* myModeHorRB;
QRadioButton* myModeVerRB;
Default constructor
*/
Plot2d_Prs::Plot2d_Prs( bool theDelete )
-: mySecondY( false)
+: mySecondY( false), myIsAutoDel( theDelete )
{
- setAutoDel(theDelete);
}
/*!
Standard constructor
*/
Plot2d_Prs::Plot2d_Prs( const Plot2d_Curve* obj, bool theDelete )
-: mySecondY( false)
+: mySecondY( false), myIsAutoDel( theDelete )
{
- setAutoDel(theDelete);
AddObject( obj );
}
*/
Plot2d_Prs::~Plot2d_Prs()
{
+ if ( myIsAutoDel )
+ qDeleteAll( myCurves );
}
/*!
*/
void Plot2d_Prs::setAutoDel(bool theDel)
{
- myCurves.setAutoDelete(theDel);
+ myIsAutoDel = theDel;
}
protected:
curveList myCurves;
bool mySecondY;
+ bool myIsAutoDel;
};
#endif
// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-//
+//
// 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
+// 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
+//
+// 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
+// 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
//
-// SALOME Plot2d : implementation of desktop and GUI kernel
+// File : Plot2d_SetupCurveDlg.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
-// File : Plot2d_SetupCurveDlg.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
#include "Plot2d_SetupCurveDlg.h"
-#include "SUIT_Tools.h"
-#include <qlayout.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qcombobox.h>
-#include <qspinbox.h>
-#include <qtoolbutton.h>
-#include <qgroupbox.h>
-#include <qcolordialog.h>
-
-#ifndef WNT
-using namespace std;
-#endif
-
-#define MARGIN_SIZE 11
-#define SPACING_SIZE 6
-#define MIN_COMBO_WIDTH 100
-#define MIN_SPIN_WIDTH 50
-#define MAX_LINE_WIDTH 100
+
+#include <QtxColorButton.h>
+#include <SUIT_Tools.h>
+
+#include <QGridLayout>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QPushButton>
+#include <QComboBox>
+#include <QSpinBox>
+#include <QPainter>
+
+const int MARGIN_SIZE = 11;
+const int SPACING_SIZE = 6;
+const int MIN_COMBO_WIDTH = 100;
+const int MIN_SPIN_WIDTH = 50;
+const int MAX_LINE_WIDTH = 10;
+const int MSIZE = 9;
/*!
- Constructor
+ \class Plot2d_SetupCurveDlg
+ \brief Dialog box for modifying 2d curve settings.
+*/
+
+/*!
+ \brief Constructor.
+ \param parent parent widget
*/
Plot2d_SetupCurveDlg::Plot2d_SetupCurveDlg( QWidget* parent )
- : QDialog( parent, "Plot2d_SetupCurveDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+: QDialog( parent )
{
- setCaption( tr("TLT_SETUP_CURVE") );
- setSizeGripEnabled( TRUE );
- QGridLayout* topLayout = new QGridLayout( this );
- topLayout->setSpacing( SPACING_SIZE );
- topLayout->setMargin( MARGIN_SIZE );
-
- QGroupBox* TopGroup = new QGroupBox( this );
- TopGroup->setColumnLayout( 0, Qt::Vertical );
- TopGroup->layout()->setSpacing( 0 ); TopGroup->layout()->setMargin( 0 );
- QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
- TopGroupLayout->setAlignment( Qt::AlignTop );
- TopGroupLayout->setSpacing( SPACING_SIZE ); TopGroupLayout->setMargin( MARGIN_SIZE );
+ setModal( true );
+ setWindowTitle( tr("TLT_SETUP_CURVE") );
+ setSizeGripEnabled( true );
- QLabel* aLineTypeLab = new QLabel( tr( "CURVE_LINE_TYPE_LAB" ), TopGroup );
- myLineCombo = new QComboBox( false, TopGroup );
+ // curve type
+ QLabel* aLineTypeLab = new QLabel( tr( "CURVE_LINE_TYPE_LAB" ), this );
+ myLineCombo = new QComboBox( this );
myLineCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myLineCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myLineCombo->insertItem( tr( "NONE_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "SOLID_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "DASH_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "DOT_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "DASHDOT_LINE_LBL" ) );
- myLineCombo->insertItem( tr( "DAHSDOTDOT_LINE_LBL" ) );
- myLineCombo->setCurrentItem( 1 ); // SOLID by default
-
- QLabel* aLineWidthLab = new QLabel( tr( "CURVE_LINE_WIDTH_LAB" ), TopGroup );
- myLineSpin = new QSpinBox( 0, MAX_LINE_WIDTH, 1, TopGroup );
+ myLineCombo->setIconSize( QSize( 40, 16 ) );
+
+ // curve width
+ QLabel* aLineWidthLab = new QLabel( tr( "CURVE_LINE_WIDTH_LAB" ), this );
+ myLineSpin = new QSpinBox( this );
+ myLineSpin->setMinimum( 0 );
+ myLineSpin->setMaximum( MAX_LINE_WIDTH );
+ myLineSpin->setSingleStep( 1 );
myLineSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myLineSpin->setMinimumWidth( MIN_SPIN_WIDTH );
- myLineSpin->setValue( 0 ); // default width is 0
- QLabel* aMarkerLab = new QLabel( tr( "CURVE_MARKER_TYPE_LAB" ), TopGroup );
- myMarkerCombo = new QComboBox( false, TopGroup );
+ // marker type
+ QLabel* aMarkerLab = new QLabel( tr( "CURVE_MARKER_TYPE_LAB" ), this );
+ myMarkerCombo = new QComboBox( this );
myMarkerCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myMarkerCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myMarkerCombo->insertItem( tr( "NONE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "CIRCLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "RECTANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "DIAMOND_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "DTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "UTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "LTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "RTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "CROSS_MARKER_LBL" ) );
- myMarkerCombo->insertItem( tr( "XCROSS_MARKER_LBL" ) );
- myMarkerCombo->setCurrentItem( 1 ); // CIRCLE by default
-
- QLabel* aColorLab = new QLabel( tr( "CURVE_COLOR_LAB" ), TopGroup );
- myColorBtn = new QToolButton( TopGroup );
- myColorBtn->setMinimumSize(25, 25);
-
- TopGroupLayout->addWidget( aLineTypeLab, 0, 0 );
- TopGroupLayout->addMultiCellWidget( myLineCombo, 0, 0, 1, 2 );
- TopGroupLayout->addWidget( aLineWidthLab, 1, 0 );
- TopGroupLayout->addMultiCellWidget( myLineSpin, 1, 1, 1, 2 );
- TopGroupLayout->addWidget( aMarkerLab, 2, 0 );
- TopGroupLayout->addMultiCellWidget( myMarkerCombo, 2, 2, 1, 2 );
- TopGroupLayout->addWidget( aColorLab, 3, 0 );
- TopGroupLayout->addWidget( myColorBtn, 3, 1 );
- TopGroupLayout->setColStretch( 2, 5 );
-
- QGroupBox* GroupButtons = new QGroupBox( this );
- GroupButtons->setColumnLayout( 0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 ); GroupButtons->layout()->setMargin( 0 );
- QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( SPACING_SIZE ); GroupButtonsLayout->setMargin( MARGIN_SIZE );
-
- myOkBtn = new QPushButton( tr( "BUT_OK" ), GroupButtons );
- myOkBtn->setAutoDefault( true ); myOkBtn->setDefault( true );
- myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ) , GroupButtons );
- myCancelBtn->setAutoDefault( true );
-
- GroupButtonsLayout->addWidget( myOkBtn );
- GroupButtonsLayout->addStretch();
- GroupButtonsLayout->addWidget( myCancelBtn );
-
- connect( myColorBtn, SIGNAL( clicked() ), this, SLOT( onColorChanged() ) );
- connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
- setColor( QColor( 0, 0, 0 ) );
-
- topLayout->addWidget( TopGroup, 0, 0 );
- topLayout->addWidget( GroupButtons, 1, 0 );
+ myMarkerCombo->setIconSize( QSize( 16, 16 ) );
+
+ // curve color
+ QLabel* aColorLab = new QLabel( tr( "CURVE_COLOR_LAB" ), this );
+ myColorBtn = new QtxColorButton( this );
+
+ // preview
+ QLabel* aPreviewLab = new QLabel( tr( "CURVE_PREVIEW_LAB" ), this );
+ myPreview = new QLabel( this );
+ myPreview->setFrameStyle( QLabel::Box | QLabel::Sunken );
+ myPreview->setAlignment( Qt::AlignCenter );
+ myPreview->setScaledContents( false );
+
+ myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
+ myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
+
+ // layouting widgets
+ QGridLayout* topLayout = new QGridLayout( this );
+ topLayout->setSpacing( SPACING_SIZE );
+ topLayout->setMargin( MARGIN_SIZE );
+
+ topLayout->addWidget( aLineTypeLab, 0, 0 );
+ topLayout->addWidget( myLineCombo, 0, 1, 1, 2 );
+ topLayout->addWidget( aLineWidthLab, 1, 0 );
+ topLayout->addWidget( myLineSpin, 1, 1, 1, 2 );
+ topLayout->addWidget( aMarkerLab, 2, 0 );
+ topLayout->addWidget( myMarkerCombo, 2, 1, 1, 2 );
+ topLayout->addWidget( aColorLab, 3, 0 );
+ topLayout->addWidget( myColorBtn, 3, 1 );
+ topLayout->addWidget( aPreviewLab, 4, 0 );
+ topLayout->addWidget( myPreview, 4, 1, 1, 2 );
+ topLayout->setColumnStretch( 2, 5 );
+
+ QHBoxLayout* btnLayout = new QHBoxLayout;
+ btnLayout->setSpacing( SPACING_SIZE );
+ btnLayout->setMargin( 0 );
+
+ btnLayout->addWidget( myOkBtn );
+ btnLayout->addSpacing( 20 );
+ btnLayout->addStretch();
+ btnLayout->addWidget( myCancelBtn );
+
+ topLayout->addLayout( btnLayout, 5, 0, 1, 3 );
+
+ // fill then combo boxes
+ myLineCombo->addItem( lineIcon( Plot2d::NoPen ), tr( "NONE_LINE_LBL" ) );
+ myLineCombo->addItem( lineIcon( Plot2d::Solid ), tr( "SOLID_LINE_LBL" ) );
+ myLineCombo->addItem( lineIcon( Plot2d::Dash ), tr( "DASH_LINE_LBL" ) );
+ myLineCombo->addItem( lineIcon( Plot2d::Dot ), tr( "DOT_LINE_LBL" ) );
+ myLineCombo->addItem( lineIcon( Plot2d::DashDot ), tr( "DASHDOT_LINE_LBL" ) );
+ myLineCombo->addItem( lineIcon( Plot2d::DashDotDot ), tr( "DAHSDOTDOT_LINE_LBL" ) );
+
+ myMarkerCombo->addItem( markerIcon( Plot2d::None ), tr( "NONE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( markerIcon( Plot2d::Circle ), tr( "CIRCLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( markerIcon( Plot2d::Rectangle ), tr( "RECTANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( markerIcon( Plot2d::Diamond ), tr( "DIAMOND_MARKER_LBL" ) );
+ myMarkerCombo->addItem( markerIcon( Plot2d::DTriangle ), tr( "DTRIANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( markerIcon( Plot2d::UTriangle ), tr( "UTRIANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( markerIcon( Plot2d::LTriangle ), tr( "LTRIANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( markerIcon( Plot2d::RTriangle ), tr( "RTRIANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( markerIcon( Plot2d::Cross ), tr( "CROSS_MARKER_LBL" ) );
+ myMarkerCombo->addItem( markerIcon( Plot2d::XCross ), tr( "XCROSS_MARKER_LBL" ) );
+
+ // default settings
+ setLine( Plot2d::Solid, 0 ); // solid line, width = 0
+ setMarker( Plot2d::Circle ); // circle
+ setColor( QColor( 0, 0, 0 ) ); // black
+
+ // connections
+ connect( myLineCombo, SIGNAL( activated( int ) ), this, SLOT( updatePreview() ) );
+ connect( myLineSpin, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ) );
+ connect( myMarkerCombo, SIGNAL( activated( int ) ), this, SLOT( updatePreview() ) );
+ connect( myColorBtn, SIGNAL( changed( QColor ) ), this, SLOT( updatePreview() ) );
+ connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
SUIT_Tools::centerWidget( this, parent );
+ updatePreview();
}
+
/*!
- Destructor
+ \brief Destructor.
*/
Plot2d_SetupCurveDlg::~Plot2d_SetupCurveDlg()
{
}
+
/*!
- Sets line style and width
+ \brief Set curve line type and width.
+ \param type curve line type
+ \param width curve line width
+ \sa getLine(), getLineWidth()
*/
-void Plot2d_SetupCurveDlg::setLine( const int line, const int width )
+void Plot2d_SetupCurveDlg::setLine( Plot2d::LineType type, const int width )
{
- myLineCombo->setCurrentItem( line );
+ myLineCombo->setCurrentIndex( (int)type );
+ if ( width > myLineSpin->maximum() )
+ myLineSpin->setMaximum( width );
myLineSpin->setValue( width );
+ updatePreview();
}
+
/*!
- Gets line style
+ \brief Get curve line type.
+ \return chosen curve line type
+ \sa setLine(), getLineWidth()
*/
-int Plot2d_SetupCurveDlg::getLine() const
+Plot2d::LineType Plot2d_SetupCurveDlg::getLine() const
{
- return myLineCombo->currentItem();
+ return (Plot2d::LineType)myLineCombo->currentIndex();
}
+
/*!
- Gets line width
+ \brief Get curve line width.
+ \return chosen curve line width
+ \sa setLine(), getLine()
*/
int Plot2d_SetupCurveDlg::getLineWidth() const
{
return myLineSpin->value();
}
+
/*!
- Sets marker style
+ \brief Set curve marker type.
+ \param type curve marker type
+ \sa getMarker()
*/
-void Plot2d_SetupCurveDlg::setMarker( const int marker )
+void Plot2d_SetupCurveDlg::setMarker( Plot2d::MarkerType type )
{
- myMarkerCombo->setCurrentItem( marker );
+ myMarkerCombo->setCurrentIndex( (int)type );
+ updatePreview();
}
+
/*!
- Gets marker style
+ \brief Get curve marker type.
+ \return chosen curve marker type
+ \sa setMarker()
*/
-int Plot2d_SetupCurveDlg::getMarker() const
+Plot2d::MarkerType Plot2d_SetupCurveDlg::getMarker() const
{
- return myMarkerCombo->currentItem();
+ return (Plot2d::MarkerType)myMarkerCombo->currentIndex();
}
+
/*!
- Sets color
+ \brief Set curve color.
+ \param color curve color
+ \sa getColor()
*/
void Plot2d_SetupCurveDlg::setColor( const QColor& color )
{
- QPalette pal = myColorBtn->palette();
- QColorGroup ca = pal.active();
- ca.setColor( QColorGroup::Button, color );
- QColorGroup ci = pal.inactive();
- ci.setColor( QColorGroup::Button, color );
- pal.setActive( ca );
- pal.setInactive( ci );
- myColorBtn->setPalette( pal );
+ myColorBtn->setColor( color );
+ updatePreview();
}
+
/*!
- Gets color
+ \brief Get curve color.
+ \return curve color
+ \sa setColor()
*/
-QColor Plot2d_SetupCurveDlg::getColor() const
+QColor Plot2d_SetupCurveDlg::getColor() const
{
- return myColorBtn->palette().active().button();
+ return myColorBtn->color();
}
+
/*!
- <Color> button slot, invokes color selection dialog box
+ \brief Create icon pixmap according to the line type.
+ \param type line type
+ \return icon
*/
-void Plot2d_SetupCurveDlg::onColorChanged()
+QPixmap Plot2d_SetupCurveDlg::lineIcon( Plot2d::LineType type ) const
{
- QColor color = QColorDialog::getColor( getColor() );
- if ( color.isValid() ) {
- setColor( color );
- }
+ QSize sz = myLineCombo->iconSize();
+ QPixmap px( sz );
+ px.fill( QColor( 255, 255, 255, 0 ) );
+ QPainter p( &px );
+ Plot2d::drawLine( &p, 5, sz.height()/2, sz.width()-5, sz.height()/2, type,
+ myLineCombo->palette().color( QPalette::Text ), 1 );
+ return px;
}
+/*!
+ \brief Create icon pixmap according to the marker type.
+ \param type marker type
+ \return icon
+*/
+QPixmap Plot2d_SetupCurveDlg::markerIcon( Plot2d::MarkerType type ) const
+{
+ QSize sz = myMarkerCombo->iconSize();
+ QPixmap px( sz );
+ px.fill( QColor( 255, 255, 255, 0 ) );
+ QPainter p( &px );
+ Plot2d::drawMarker( &p, sz.width()/2, sz.height()/2, MSIZE, MSIZE, type,
+ myMarkerCombo->palette().color( QPalette::Text ) );
+ return px;
+}
+/*
+ \brief Update preview widget.
+*/
+void Plot2d_SetupCurveDlg::updatePreview()
+{
+ QSize sz( 150, 20 );
+ QPixmap px( sz );
+ px.fill( palette().color( QPalette::Background ) );
+ QPainter p( &px );
+ Plot2d::drawLine( &p, 5+MSIZE/2, sz.height()/2, sz.width()-5-MSIZE/2, sz.height()/2,
+ getLine(), getColor(), getLineWidth() );
+ Plot2d::drawMarker( &p, 5+MSIZE/2, sz.height()/2, MSIZE, MSIZE,
+ getMarker(), getColor() );
+ Plot2d::drawMarker( &p, sz.width()-5-MSIZE/2, sz.height()/2, MSIZE, MSIZE,
+ getMarker(), getColor() );
+ myPreview->setPixmap( px );
+}
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// SALOME Plot2d : implementation of desktop and GUI kernel
+// File : Plot2d_SetupCurveDlg.h
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
-// File : Plot2d_SetupCurveDlg.h
-// Author : Vadim SANDLER
-// Module : SALOME
-#ifndef Plot2d_SetupCurveDlg_H
-#define Plot2d_SetupCurveDlg_H
+#ifndef PLOT2D_SETUPCURVEDLG_H
+#define PLOT2D_SETUPCURVEDLG_H
#include "Plot2d.h"
-#include <qdialog.h>
-
-/*!
- \class Plot2d_SetupCurveDlg
- Dialog box for setup Plot2d curve
-*/
+#include <QDialog>
class QPushButton;
class QComboBox;
class QSpinBox;
-class QToolButton;
+class QLabel;
+class QtxColorButton;
class PLOT2D_EXPORT Plot2d_SetupCurveDlg : public QDialog
{
Q_OBJECT
public:
- Plot2d_SetupCurveDlg( QWidget* parent = 0 );
+ Plot2d_SetupCurveDlg( QWidget* = 0 );
~Plot2d_SetupCurveDlg();
public:
- void setLine( const int line, const int width );
- int getLine() const;
- int getLineWidth() const;
- void setMarker( const int marker );
- int getMarker() const ;
- void setColor( const QColor& color );
- QColor getColor() const;
-
-protected slots:
- void onColorChanged();
+ void setLine( Plot2d::LineType, const int );
+ Plot2d::LineType getLine() const;
+ int getLineWidth() const;
+
+ void setMarker( Plot2d::MarkerType );
+ Plot2d::MarkerType getMarker() const ;
+
+ void setColor( const QColor& );
+ QColor getColor() const;
+
+private:
+ QPixmap lineIcon( Plot2d::LineType ) const;
+ QPixmap markerIcon( Plot2d::MarkerType ) const;
+
+private slots:
+ void updatePreview();
private:
- QPushButton* myOkBtn;
- QPushButton* myCancelBtn;
- QComboBox* myLineCombo;
- QSpinBox* myLineSpin;
- QComboBox* myMarkerCombo;
- QToolButton* myColorBtn;
+ QPushButton* myOkBtn;
+ QPushButton* myCancelBtn;
+ QComboBox* myLineCombo;
+ QSpinBox* myLineSpin;
+ QComboBox* myMarkerCombo;
+ QtxColorButton* myColorBtn;
+ QLabel* myPreview;
};
-#endif // Plot2d_SetupCurveDlg_H
+#endif // PLOT2D_SETUPCURVEDLG_H
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// File : Plot2d_SetupViewDlg.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
+// File : Plot2d_SetupViewDlg.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
#include "Plot2d_SetupViewDlg.h"
-#include <qcheckbox.h>
-#include <qlineedit.h>
-#include <qcombobox.h>
-#include <qspinbox.h>
-#include <qtoolbutton.h>
-#include <qlayout.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qcolordialog.h>
-#include <qtabwidget.h>
-
-#define MARGIN_SIZE 11
-#define SPACING_SIZE 6
-#define MIN_EDIT_WIDTH 200
-#define MIN_COMBO_WIDTH 100
-#define MIN_SPIN_WIDTH 70
-
-/*!
- Constructor
-*/
-Plot2d_SetupViewDlg::Plot2d_SetupViewDlg( QWidget* parent, bool showDefCheck, bool secondAxisY )
- : QDialog( parent, "Plot2d_SetupViewDlg", true,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- mySecondAxisY = secondAxisY;
- setCaption( tr("TLT_SETUP_PLOT2D_VIEW") );
+#include <QtxColorButton.h>
+
+#include <QCheckBox>
+#include <QLineEdit>
+#include <QComboBox>
+#include <QSpinBox>
+#include <QGridLayout>
+#include <QHBoxLayout>
+#include <QGroupBox>
+#include <QLabel>
+#include <QPushButton>
+#include <QTabWidget>
+
+const int MARGIN_SIZE = 11;
+const int SPACING_SIZE = 6;
+const int MIN_EDIT_WIDTH = 200;
+const int MIN_COMBO_WIDTH = 100;
+const int MIN_SPIN_WIDTH = 70;
+
+/*!
+ \class Plot2d_SetupViewDlg
+ \brief Dialog box to setup Plot2d view window.
+*/
+
+/*!
+ \brief Constructor.
+ \param parent parent widget
+ \param showDefCheck if \c true, show "Set settings as default" check box
+ \param secondAxisY if \c true, show widgets for the second (right) vertical axis
+*/
+Plot2d_SetupViewDlg::Plot2d_SetupViewDlg( QWidget* parent,
+ bool showDefCheck,
+ bool secondAxisY )
+: QDialog( parent ),
+ mySecondAxisY( secondAxisY )
+{
+ setModal( true );
+ setWindowTitle( tr("TLT_SETUP_PLOT2D_VIEW") );
setSizeGripEnabled( TRUE );
+
QGridLayout* topLayout = new QGridLayout( this );
topLayout->setSpacing( SPACING_SIZE );
topLayout->setMargin( MARGIN_SIZE );
myTitleEdit = new QLineEdit( this );
myTitleEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myTitleEdit->setMinimumWidth( MIN_EDIT_WIDTH );
+
// curve type : points, lines, spline
QLabel* aCurveLab = new QLabel( tr( "PLOT2D_CURVE_TYPE_LBL" ), this );
- myCurveCombo = new QComboBox( false, this );
+ myCurveCombo = new QComboBox( this );
myCurveCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myCurveCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myCurveCombo->insertItem( tr( "PLOT2D_CURVE_TYPE_POINTS" ) );
- myCurveCombo->insertItem( tr( "PLOT2D_CURVE_TYPE_LINES" ) );
- myCurveCombo->insertItem( tr( "PLOT2D_CURVE_TYPE_SPLINE" ) );
+ myCurveCombo->addItem( tr( "PLOT2D_CURVE_TYPE_POINTS" ) );
+ myCurveCombo->addItem( tr( "PLOT2D_CURVE_TYPE_LINES" ) );
+ myCurveCombo->addItem( tr( "PLOT2D_CURVE_TYPE_SPLINE" ) );
+
// legend
myLegendCheck = new QCheckBox( tr( "PLOT2D_ENABLE_LEGEND" ), this );
- myLegendCombo = new QComboBox( false, this );
+ myLegendCombo = new QComboBox( this );
myLegendCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myLegendCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_LEFT" ) );
- myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_RIGHT" ) );
- myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_TOP" ) );
- myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_BOTTOM" ) );
+ myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_LEFT" ) );
+ myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_RIGHT" ) );
+ myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_TOP" ) );
+ myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_BOTTOM" ) );
+
// marker size
QLabel* aMarkerLab = new QLabel( tr( "PLOT2D_MARKER_SIZE_LBL" ), this );
- myMarkerSpin = new QSpinBox( 0, 100, 1, this );
+ myMarkerSpin = new QSpinBox( this );
+ myMarkerSpin->setMinimum( 0 );
+ myMarkerSpin->setMaximum( 100 );
+ myMarkerSpin->setSingleStep( 1 );
myMarkerSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myMarkerSpin->setMinimumWidth( MIN_SPIN_WIDTH );
// background color
QLabel* aBGLab = new QLabel( tr( "PLOT2D_BACKGROUND_COLOR_LBL" ), this );
- myBackgroundBtn = new QToolButton( this );
- myBackgroundBtn->setMinimumWidth(20);
+ myBackgroundBtn = new QtxColorButton( this );
// scale mode
QGroupBox* aScaleGrp = new QGroupBox( tr( "PLOT2D_SCALE_TLT" ), this );
- aScaleGrp->setColumnLayout(0, Qt::Vertical );
- aScaleGrp->layout()->setSpacing( 0 ); aScaleGrp->layout()->setMargin( 0 );
- QGridLayout* aScaleLayout = new QGridLayout( aScaleGrp->layout() );
+ QGridLayout* aScaleLayout = new QGridLayout( aScaleGrp );
aScaleLayout->setMargin( MARGIN_SIZE ); aScaleLayout->setSpacing( SPACING_SIZE );
+ aScaleGrp->setLayout( aScaleLayout );
QLabel* xScaleLab = new QLabel( tr( "PLOT2D_SCALE_MODE_HOR" ), aScaleGrp );
- myXModeCombo = new QComboBox( false, aScaleGrp );
+ myXModeCombo = new QComboBox( aScaleGrp );
myXModeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myXModeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myXModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
- myXModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
+ myXModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
+ myXModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
+
QLabel* yScaleLab = new QLabel( tr( "PLOT2D_SCALE_MODE_VER" ), aScaleGrp );
- myYModeCombo = new QComboBox( false, aScaleGrp );
+ myYModeCombo = new QComboBox( aScaleGrp );
myYModeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myYModeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myYModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
- myYModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
+ myYModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
+ myYModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
aScaleLayout->addWidget( xScaleLab, 0, 0 );
aScaleLayout->addWidget( myXModeCombo, 0, 1 );
aScaleLayout->addWidget( myYModeCombo, 0, 3 );
// tab widget for choose properties of axis
- QTabWidget* aTabWidget = new QTabWidget( this, "tabWidget" );
+ QTabWidget* aTabWidget = new QTabWidget( this );
// widget for parameters on Ox
QWidget* aXWidget = new QWidget(aTabWidget);
QGridLayout* aXLayout = new QGridLayout( aXWidget );
aXLayout->setSpacing( SPACING_SIZE );
aXLayout->setMargin( MARGIN_SIZE );
+
// axis title
myTitleXCheck = new QCheckBox( tr( "PLOT2D_ENABLE_HOR_TITLE" ), aXWidget );
myTitleXEdit = new QLineEdit( aXWidget );
myTitleXEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myTitleXEdit->setMinimumWidth( MIN_EDIT_WIDTH );
- aXLayout->addWidget( myTitleXCheck, 1, 0 );
- aXLayout->addMultiCellWidget( myTitleXEdit, 1, 1, 1, 3 );
+ aXLayout->addWidget( myTitleXCheck,1, 0 );
+ aXLayout->addWidget( myTitleXEdit, 1, 1, 1, 3 );
+
// grid
QGroupBox* aGridGrpX = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aXWidget );
- aGridGrpX->setColumnLayout(0, Qt::Vertical );
- aGridGrpX->layout()->setSpacing( 0 ); aGridGrpX->layout()->setMargin( 0 );
- QGridLayout* aGridLayoutX = new QGridLayout( aGridGrpX->layout() );
- aGridLayoutX->setMargin( MARGIN_SIZE ); aGridLayoutX->setSpacing( SPACING_SIZE );
+ QGridLayout* aGridLayoutX = new QGridLayout( aGridGrpX );
+ aGridLayoutX->setMargin( MARGIN_SIZE );
+ aGridLayoutX->setSpacing( SPACING_SIZE );
+
myXGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MAJOR" ), aGridGrpX );
+
QLabel* aXMajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpX);
- myXGridSpin = new QSpinBox( 1, 100, 1, aGridGrpX );
+ myXGridSpin = new QSpinBox( aGridGrpX );
+ myXGridSpin->setMinimum( 1 );
+ myXGridSpin->setMaximum( 100 );
+ myXGridSpin->setSingleStep( 1 );
myXGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myXGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
+
myXMinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MINOR" ), aGridGrpX );
+
QLabel* aXMinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpX);
- myXMinGridSpin = new QSpinBox( 1, 100, 1, aGridGrpX );
+ myXMinGridSpin = new QSpinBox( aGridGrpX );
+ myXMinGridSpin->setMinimum( 1 );
+ myXMinGridSpin->setMaximum( 100 );
+ myXMinGridSpin->setSingleStep( 1 );
myXMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myXMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
aGridLayoutX->addWidget( myXMinGridCheck, 1, 0 );
aGridLayoutX->addWidget( aXMinLbl, 1, 1 );
aGridLayoutX->addWidget( myXMinGridSpin, 1, 2 );
- aXLayout->addMultiCellWidget( aGridGrpX, 3, 3, 0, 3 );
+ aXLayout->addWidget( aGridGrpX, 3, 0, 1, 4 );
aTabWidget->addTab( aXWidget, tr( "INF_AXES_X" ) );
QGridLayout* aYLayout = new QGridLayout( aYWidget );
aYLayout->setSpacing( SPACING_SIZE );
aYLayout->setMargin( MARGIN_SIZE );
+
// axis title
myTitleYCheck = new QCheckBox( tr( "PLOT2D_ENABLE_VER_TITLE" ), aYWidget );
myTitleYEdit = new QLineEdit( aYWidget );
myTitleYEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myTitleYEdit->setMinimumWidth( MIN_EDIT_WIDTH );
- aYLayout->addWidget( myTitleYCheck, 1, 0 );
- aYLayout->addMultiCellWidget( myTitleYEdit, 1, 1, 1, 3 );
+ aYLayout->addWidget( myTitleYCheck,1, 0 );
+ aYLayout->addWidget( myTitleYEdit, 1, 1, 1, 3 );
+
// grid
QGroupBox* aGridGrpY = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aYWidget );
- aGridGrpY->setColumnLayout(0, Qt::Vertical );
- aGridGrpY->layout()->setSpacing( 0 ); aGridGrpY->layout()->setMargin( 0 );
- QGridLayout* aGridLayoutY = new QGridLayout( aGridGrpY->layout() );
+ QGridLayout* aGridLayoutY = new QGridLayout( aGridGrpY );
+ aGridGrpY->setLayout( aGridLayoutY );
aGridLayoutY->setMargin( MARGIN_SIZE ); aGridLayoutY->setSpacing( SPACING_SIZE );
+
myYGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrpY );
+
QLabel* aYMajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY);
- myYGridSpin = new QSpinBox( 1, 100, 1, aGridGrpY );
+ myYGridSpin = new QSpinBox( aGridGrpY );
+ myYGridSpin->setMinimum( 1 );
+ myYGridSpin->setMaximum( 100 );
+ myYGridSpin->setSingleStep( 1 );
myYGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myYGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
+
myYMinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrpY );
+
QLabel* aYMinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY);
- myYMinGridSpin = new QSpinBox( 1, 100, 1, aGridGrpY );
+ myYMinGridSpin = new QSpinBox( aGridGrpY );
+ myYMinGridSpin->setMinimum( 1 );
+ myYMinGridSpin->setMaximum( 100 );
+ myYMinGridSpin->setSingleStep( 1 );
myYMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myYMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
aGridLayoutY->addWidget( myYMinGridCheck, 1, 0 );
aGridLayoutY->addWidget( aYMinLbl, 1, 1 );
aGridLayoutY->addWidget( myYMinGridSpin, 1, 2 );
- aYLayout->addMultiCellWidget( aGridGrpY, 3, 3, 0, 3 );
+ aYLayout->addWidget( aGridGrpY, 3, 0, 1, 4 );
aTabWidget->addTab( aYWidget, tr( "INF_AXES_Y_LEFT" ) );
// if exist second axis Oy, addition new tab widget for right axis
- if (mySecondAxisY) {
+ if ( mySecondAxisY ) {
// widget for parameters on Oy
- QWidget* aYWidget2 = new QWidget(aTabWidget);
+ QWidget* aYWidget2 = new QWidget( aTabWidget );
QGridLayout* aYLayout2 = new QGridLayout( aYWidget2 );
aYLayout2->setSpacing( SPACING_SIZE );
aYLayout2->setMargin( MARGIN_SIZE );
+
// axis title
myTitleY2Check = new QCheckBox( tr( "PLOT2D_ENABLE_VER_TITLE" ), aYWidget2 );
myTitleY2Edit = new QLineEdit( aYWidget2 );
myTitleY2Edit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myTitleY2Edit->setMinimumWidth( MIN_EDIT_WIDTH );
- aYLayout2->addWidget( myTitleY2Check, 1, 0 );
- aYLayout2->addMultiCellWidget( myTitleY2Edit, 1, 1, 1, 3 );
+ aYLayout2->addWidget( myTitleY2Check,1, 0 );
+ aYLayout2->addWidget( myTitleY2Edit, 1, 1, 1, 3 );
+
// grid
QGroupBox* aGridGrpY2 = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aYWidget2 );
- aGridGrpY2->setColumnLayout(0, Qt::Vertical );
- aGridGrpY2->layout()->setSpacing( 0 ); aGridGrpY2->layout()->setMargin( 0 );
- QGridLayout* aGridLayoutY2 = new QGridLayout( aGridGrpY2->layout() );
+ QGridLayout* aGridLayoutY2 = new QGridLayout( aGridGrpY2 );
+ aGridGrpY2->setLayout( aGridLayoutY2 );
aGridLayoutY2->setMargin( MARGIN_SIZE ); aGridLayoutY2->setSpacing( SPACING_SIZE );
+
myY2GridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrpY2 );
+
QLabel* aY2MajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY2);
- myY2GridSpin = new QSpinBox( 1, 100, 1, aGridGrpY2 );
+ myY2GridSpin = new QSpinBox( aGridGrpY2 );
+ myY2GridSpin->setMinimum( 1 );
+ myY2GridSpin->setMaximum( 100 );
+ myY2GridSpin->setSingleStep( 1 );
myY2GridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myY2GridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
+
myY2MinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrpY2 );
+
QLabel* aY2MinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY2);
- myY2MinGridSpin = new QSpinBox( 1, 100, 1, aGridGrpY2 );
+ myY2MinGridSpin = new QSpinBox( aGridGrpY2 );
+ myY2MinGridSpin->setMinimum( 1 );
+ myY2MinGridSpin->setMaximum( 100 );
+ myY2MinGridSpin->setSingleStep( 1 );
myY2MinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myY2MinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
aGridLayoutY2->addWidget( myY2MinGridCheck, 1, 0 );
aGridLayoutY2->addWidget( aY2MinLbl, 1, 1 );
aGridLayoutY2->addWidget( myY2MinGridSpin, 1, 2 );
- aYLayout2->addMultiCellWidget( aGridGrpY2, 3, 3, 0, 3 );
+ aYLayout2->addWidget( aGridGrpY2, 3, 0, 1, 4 );
aTabWidget->addTab( aYWidget2, tr( "INF_AXES_Y_RIGHT" ) );
}
myY2MinGridSpin = 0;
myY2ModeCombo = 0;
}
- aTabWidget->setCurrentPage( 0 );
+
+ aTabWidget->setCurrentIndex( 0 );
/* "Set as default" check box */
+
myDefCheck = new QCheckBox( tr( "PLOT2D_SET_AS_DEFAULT_CHECK" ), this );
+
/* OK/Cancel buttons */
myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
myOkBtn->setAutoDefault( TRUE );
btnLayout->addWidget( myCancelBtn );
// layout widgets
- topLayout->addWidget( myTitleCheck, 0, 0 );
- topLayout->addMultiCellWidget( myTitleEdit, 0, 0, 1, 3 );
- topLayout->addWidget( aCurveLab, 1, 0 );
- topLayout->addWidget( myCurveCombo, 1, 1 );
- topLayout->addWidget( myLegendCheck, 1, 2 );
- topLayout->addWidget( myLegendCombo, 1, 3 );
- topLayout->addWidget( aMarkerLab, 2, 0 );
- topLayout->addWidget( myMarkerSpin, 2, 1 );
+ topLayout->addWidget( myTitleCheck, 0, 0 );
+ topLayout->addWidget( myTitleEdit, 0, 1, 1, 3 );
+ topLayout->addWidget( aCurveLab, 1, 0 );
+ topLayout->addWidget( myCurveCombo, 1, 1 );
+ topLayout->addWidget( myLegendCheck, 1, 2 );
+ topLayout->addWidget( myLegendCombo, 1, 3 );
+ topLayout->addWidget( aMarkerLab, 2, 0 );
+ topLayout->addWidget( myMarkerSpin, 2, 1 );
QHBoxLayout* bgLayout = new QHBoxLayout;
bgLayout->addWidget( myBackgroundBtn ); bgLayout->addStretch();
- topLayout->addWidget( aBGLab, 2, 2 );
- topLayout->addLayout( bgLayout, 2, 3 );
- topLayout->addMultiCellWidget( aScaleGrp, 3, 3, 0, 3 );
- topLayout->addMultiCellWidget( aTabWidget, 4, 4, 0, 3 );
- topLayout->addMultiCellWidget( myDefCheck, 5, 5, 0, 3 );
+ topLayout->addWidget( aBGLab, 2, 2 );
+ topLayout->addLayout( bgLayout, 2, 3 );
+ topLayout->addWidget( aScaleGrp, 3, 0, 1, 4 );
+ topLayout->addWidget( aTabWidget, 4, 0, 1, 4 );
+ topLayout->addWidget( myDefCheck, 5, 0, 1, 4 );
topLayout->setRowStretch( 5, 5 );
- topLayout->addMultiCellLayout( btnLayout, 6, 6, 0, 3 );
+ topLayout->addLayout( btnLayout, 6, 0, 1, 4 );
if ( !showDefCheck )
myDefCheck->hide();
connect( myTitleCheck, SIGNAL( clicked() ), this, SLOT( onMainTitleChecked() ) );
connect( myTitleXCheck, SIGNAL( clicked() ), this, SLOT( onXTitleChecked() ) );
connect( myTitleYCheck, SIGNAL( clicked() ), this, SLOT( onYTitleChecked() ) );
- connect( myBackgroundBtn, SIGNAL( clicked() ), this, SLOT( onBackgroundClicked() ) );
connect( myLegendCheck, SIGNAL( clicked() ), this, SLOT( onLegendChecked() ) );
connect( myXGridCheck, SIGNAL( clicked() ), this, SLOT( onXGridMajorChecked() ) );
connect( myYGridCheck, SIGNAL( clicked() ), this, SLOT( onYGridMajorChecked() ) );
connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
- if (mySecondAxisY) {
+ if ( mySecondAxisY ) {
connect( myTitleY2Check, SIGNAL( clicked() ), this, SLOT( onY2TitleChecked() ) );
connect( myY2GridCheck, SIGNAL( clicked() ), this, SLOT( onY2GridMajorChecked() ) );
connect( myY2MinGridCheck, SIGNAL( clicked() ), this, SLOT( onY2GridMinorChecked() ) );
onXGridMajorChecked();
onYGridMajorChecked();
onXGridMinorChecked();
- if (mySecondAxisY) {
+ if ( mySecondAxisY ) {
onY2TitleChecked();
onY2GridMajorChecked();
onY2GridMinorChecked();
}
/*!
- Destructor
+ \brief Destructor.
*/
Plot2d_SetupViewDlg::~Plot2d_SetupViewDlg()
{
}
+
/*!
- Sets main title attributes
+ \brief Set main title attributes.
+ \param enable if \c true main title is enabled
+ \param title main title
+ \sa isMainTitleEnabled(), getMainTitle()
*/
void Plot2d_SetupViewDlg::setMainTitle( bool enable, const QString& title )
{
myTitleEdit->setText( title );
onMainTitleChecked();
}
+
/*!
- Returns TRUE if main title is enabled
+ \brief Check if main title is enabled.
+ \return \c true if main title is enabled
+ \sa setMainTitle()
*/
bool Plot2d_SetupViewDlg::isMainTitleEnabled()
{
return myTitleCheck->isChecked();
}
+
/*!
- Gets main title
+ \brief Get main title.
+ \return main title
+ \sa setMainTitle()
*/
QString Plot2d_SetupViewDlg::getMainTitle()
{
return myTitleEdit->text();
}
+
/*!
- Sets horizontal axis title attributes
+ \brief Set horizontal axis title attributes.
+ \param enable if \c true horizontal axis title is enabled
+ \param title horizontal axis title
+ \sa isXTitleEnabled(), getXTitle()
*/
void Plot2d_SetupViewDlg::setXTitle( bool enable, const QString& title )
{
myTitleXEdit->setText( title );
onXTitleChecked();
}
+
/*!
- Returns TRUE if horizontal axis title is enabled
+ \brief Check if main title is enabled.
+ \return \c true if horizontal axis title is enabled
+ \sa setXTitle()
*/
bool Plot2d_SetupViewDlg::isXTitleEnabled()
{
return myTitleXCheck->isChecked();
}
+
/*!
- Gets horizontal axis title
+ \brief Get horizontal axis title.
+ \return horizontal axis title
+ \sa setXTitle()
*/
QString Plot2d_SetupViewDlg::getXTitle()
{
return myTitleXEdit->text();
}
+
/*!
- Sets vertical left axis title attributes
+ \brief Set left vertical axis title attributes.
+ \param enable if \c true left vertical axis title is enabled
+ \param title left vertical axis title
+ \sa setY2Title(), isYTitleEnabled(), getYTitle()
*/
void Plot2d_SetupViewDlg::setYTitle( bool enable, const QString& title )
{
myTitleYEdit->setText( title );
onYTitleChecked();
}
+
/*!
- Sets vertical right axis title attributes
+ \brief Set right vertical axis title attributes.
+ \param enable if \c true right vertical axis title is enabled
+ \param title right vertical axis title
+ \sa setYTitle(), isY2TitleEnabled(), getY2Title()
*/
void Plot2d_SetupViewDlg::setY2Title( bool enable, const QString& title )
{
myTitleY2Edit->setText( title );
onY2TitleChecked();
}
+
/*!
- Returns TRUE if vertical left axis title is enabled
+ \brief Check if left vertical axis title is enabled.
+ \return \c true if right vertical axis title is enabled
+ \sa setYTitle()
*/
bool Plot2d_SetupViewDlg::isYTitleEnabled()
{
return myTitleYCheck->isChecked();
}
+
/*!
- Returns TRUE if vertical right axis title is enabled
+ \brief Check if right vertical axis title is enabled.
+ \return \c true if right vertical axis title is enabled
+ \sa setY2Title()
*/
bool Plot2d_SetupViewDlg::isY2TitleEnabled()
{
return myTitleY2Check->isChecked();
}
+
/*!
- Gets vertical left axis title
+ \brief Get left vertical axis title.
+ \return left vertical axis title
+ \sa setYTitle()
*/
QString Plot2d_SetupViewDlg::getYTitle()
{
return myTitleYEdit->text();
}
+
/*!
- Gets vertical right axis title
+ \brief Get right vertical axis title.
+ \return right vertical axis title
+ \sa setY2Title()
*/
QString Plot2d_SetupViewDlg::getY2Title()
{
return myTitleY2Edit->text();
}
+
/*!
- Sets curve type : 0 - points, 1 - lines, 2 - splines
+ \brief Set curve type.
+ \param type curve type: 0 (points), 1 (lines) or 2 (splines)
+ \sa getCurveType()
*/
void Plot2d_SetupViewDlg::setCurveType( const int type )
{
- myCurveCombo->setCurrentItem( type );
+ myCurveCombo->setCurrentIndex( type );
}
+
/*!
- Gets curve type : 0 - points, 1 - lines, 2 - splines
+ \brief Get curve type.
+ \return curve type: 0 (points), 1 (lines) or 2 (splines)
+ \sa setCurveType()
*/
int Plot2d_SetupViewDlg::getCurveType()
{
- return myCurveCombo->currentItem();
+ return myCurveCombo->currentIndex();
}
+
/*!
- Sets legend attributes : pos = 0 - left, 1 - right, 2 - top, 3 - bottom
+ \brief Set legend attribute.
+ \param if \c true legend is shown
+ \param pos legend position: 0 (left), 1 (right), 2 (top), 3 (bottom)
+ \sa isLegendEnabled(), getLegendPos()
*/
void Plot2d_SetupViewDlg::setLegend( bool enable, int pos )
{
myLegendCheck->setChecked( enable );
- myLegendCombo->setCurrentItem( pos );
+ myLegendCombo->setCurrentIndex( pos );
onLegendChecked();
}
+
/*!
- Returns TRUE if legend is enabled
+ \brief Check if legend is enabled.
+ \return \c true if legend is enabled
+ \sa setLegend()
*/
bool Plot2d_SetupViewDlg::isLegendEnabled()
{
return myLegendCheck->isChecked();
}
+
/*!
- Returns legend position
+ \brief Get legend position.
+ \return legend position: 0 (left), 1 (right), 2 (top), 3 (bottom)
+ \sa setLegend()
*/
int Plot2d_SetupViewDlg::getLegendPos()
{
- return myLegendCombo->currentItem();
+ return myLegendCombo->currentIndex();
}
+
/*!
- Sets marker size
+ \brief Set marker size.
+ \param size marker size
+ \sa getMarkerSize()
*/
void Plot2d_SetupViewDlg::setMarkerSize( const int size )
{
myMarkerSpin->setValue( size );
}
+
/*!
- Gets marker size
+ \brief Get marker size.
+ \return marker size
+ \sa setMarkerSize()
*/
int Plot2d_SetupViewDlg::getMarkerSize()
{
return myMarkerSpin->value();
}
+
/*!
- Sets background color
+ \brief Set background color.
+ \param color background color
+ \sa getBackgroundColor()
*/
void Plot2d_SetupViewDlg::setBackgroundColor( const QColor& color )
{
- QPalette pal = myBackgroundBtn->palette();
- QColorGroup ca = pal.active();
- ca.setColor( QColorGroup::Button, color );
- QColorGroup ci = pal.inactive();
- ci.setColor( QColorGroup::Button, color );
- pal.setActive( ca );
- pal.setInactive( ci );
- myBackgroundBtn->setPalette( pal );
+ myBackgroundBtn->setColor( color );
}
+
/*!
- Gets background color
+ \brief Get background color.
+ \return background color
+ \sa setBackgroundColor()
*/
QColor Plot2d_SetupViewDlg::getBackgroundColor()
{
- return myBackgroundBtn->palette().active().button();
+ return myBackgroundBtn->color();
}
+
/*!
- Sets major grid parameters
+ \brief Set major grid parameters.
+ \param enableX if \c true, horizontal major grid is enabled
+ \param divX maximum number of ticks for horizontal major grid
+ \param enableY if \c true, left vertical major grid is enabled
+ \param divY maximum number of ticks for left vertical major grid
+ \param enableY2 if \c true, right vertical major grid is enabled
+ \param divY2 maximum number of ticks for right vertical major grid
+ \sa getMajorGrid()
*/
void Plot2d_SetupViewDlg::setMajorGrid( bool enableX, const int divX,
bool enableY, const int divY,
- bool enableY2, const int divY2 )
+ bool enableY2, const int divY2 )
{
myXGridCheck->setChecked( enableX );
myXGridSpin->setValue( divX );
onY2GridMajorChecked();
}
}
+
/*!
- Gets major grid parameters
+ \brief Get major grid parameters.
+ \param enableX \c true if horizontal major grid is enabled
+ \param divX maximum number of ticks for horizontal major grid
+ \param enableY \c true if left vertical major grid is enabled
+ \param divY maximum number of ticks for left vertical major grid
+ \param enableY2 \c true if right vertical major grid is enabled
+ \param divY2 maximum number of ticks for right vertical major grid
+ \sa setMajorGrid()
*/
void Plot2d_SetupViewDlg::getMajorGrid( bool& enableX, int& divX,
bool& enableY, int& divY,
- bool& enableY2, int& divY2)
+ bool& enableY2, int& divY2 )
{
enableX = myXGridCheck->isChecked();
divX = myXGridSpin->value();
divY2 = 1;
}
}
+
/*!
- Sets minor grid parameters
+ \brief Set minor grid parameters.
+ \param enableX if \c true, horizontal minor grid is enabled
+ \param divX maximum number of ticks for horizontal minor grid
+ \param enableY if \c true, left vertical minor grid is enabled
+ \param divY maximum number of ticks for left vertical minor grid
+ \param enableY2 if \c true, right vertical minor grid is enabled
+ \param divY2 maximum number of ticks for right vertical minor grid
+ \sa getMinorGrid()
*/
void Plot2d_SetupViewDlg::setMinorGrid( bool enableX, const int divX,
bool enableY, const int divY,
- bool enableY2, const int divY2)
+ bool enableY2, const int divY2 )
{
myXMinGridCheck->setChecked( enableX );
myXMinGridSpin->setValue( divX );
onY2GridMinorChecked();
}
}
+
/*!
- Gets minor grid parameters
+ \brief Get minor grid parameters.
+ \param enableX \c true if horizontal minor grid is enabled
+ \param divX maximum number of ticks for horizontal minor grid
+ \param enableY \c true if left vertical minor grid is enabled
+ \param divY maximum number of ticks for left vertical minor grid
+ \param enableY2 \c true if right vertical minor grid is enabled
+ \param divY2 maximum number of ticks for right vertical minor grid
+ \sa setMinorGrid()
*/
void Plot2d_SetupViewDlg::getMinorGrid( bool& enableX, int& divX,
bool& enableY, int& divY,
- bool& enableY2, int& divY2)
+ bool& enableY2, int& divY2 )
{
enableX = myXMinGridCheck->isChecked();
divX = myXMinGridSpin->value();
enableY = myYMinGridCheck->isChecked();
divY = myYMinGridSpin->value();
- if (mySecondAxisY) {
+ if ( mySecondAxisY ) {
enableY2 = myY2MinGridCheck->isChecked();
divY2 = myY2MinGridSpin->value();
}
divY2 = 1;
}
}
+
/*!
- Sets scale mode for hor. and ver. axes : 0 - linear, 1 - logarithmic
+ \brief Set scale mode for horizontal and vertical axes.
+ \param xMode horizontal axis scale mode: 0 (linear), 1 (logarithmic)
+ \param yMode vertical axis scale mode: 0 (linear), 1 (logarithmic)
+ \sa getXScaleMode(), getYScaleMode()
*/
void Plot2d_SetupViewDlg::setScaleMode( const int xMode, const int yMode )
{
- myXModeCombo->setCurrentItem( xMode );
- myYModeCombo->setCurrentItem( yMode );
+ myXModeCombo->setCurrentIndex( xMode );
+ myYModeCombo->setCurrentIndex( yMode );
}
+
/*!
- Gets scale mode for hor. axis : 0 - linear, 1 - logarithmic
+ \brief Get scale mode for horizontal axis.
+ \return horizontal axis scale mode: 0 (linear), 1 (logarithmic)
+ \sa setScaleMode()
*/
-int Plot2d_SetupViewDlg::getXScaleMode()
+int Plot2d_SetupViewDlg::getXScaleMode()
{
- return myXModeCombo->currentItem();
+ return myXModeCombo->currentIndex();
}
+
/*!
- Gets scale mode for hor. axis : 0 - linear, 1 - logarithmic
+ \brief Get scale mode for vertical axis.
+ \return vertical axis scale mode: 0 (linear), 1 (logarithmic)
+ \sa setScaleMode()
*/
int Plot2d_SetupViewDlg::getYScaleMode()
{
- return myYModeCombo->currentItem();
+ return myYModeCombo->currentIndex();
}
+
/*!
- Slot, called when user clicks "Show main title" check box
+ \brief Called when user clicks "Show main title" check box.
*/
void Plot2d_SetupViewDlg::onMainTitleChecked()
{
myTitleEdit->setEnabled( myTitleCheck->isChecked() );
}
+
/*!
- Slot, called when user clicks "Show horizontal axis title" check box
+ \brief Called when user clicks "Show horizontal axis title" check box.
*/
void Plot2d_SetupViewDlg::onXTitleChecked()
{
myTitleXEdit->setEnabled( myTitleXCheck->isChecked() );
}
+
/*!
- Slot, called when user clicks "Show vertical left axis title" check box
+ \brief Called when user clicks "Show vertical left axis title" check box.
*/
void Plot2d_SetupViewDlg::onYTitleChecked()
{
myTitleYEdit->setEnabled( myTitleYCheck->isChecked() );
}
+
/*!
- Slot, called when user clicks "Show vertical right axis title" check box
+ \brief Called when user clicks "Show vertical right axis title" check box.
*/
void Plot2d_SetupViewDlg::onY2TitleChecked()
{
myTitleY2Edit->setEnabled( myTitleY2Check->isChecked() );
}
+
/*!
- Slot, called when user clicks "Change bacground color" button
-*/
-void Plot2d_SetupViewDlg::onBackgroundClicked()
-{
- QColor color = QColorDialog::getColor( getBackgroundColor() );
- if ( color.isValid() ) {
- setBackgroundColor( color );
- }
-}
-/*!
- Slot, called when user clicks "Show Legend" check box
+ \brief Called when user clicks "Show Legend" check box.
*/
void Plot2d_SetupViewDlg::onLegendChecked()
{
myLegendCombo->setEnabled( myLegendCheck->isChecked() );
}
+
/*!
- Slot, called when user clicks "Enable hor. major grid" check box
+ \brief Called when user clicks "Enable horizontal major grid" check box.
*/
void Plot2d_SetupViewDlg::onXGridMajorChecked()
{
myXMinGridCheck->setEnabled( myXGridCheck->isChecked() );
}
+
/*!
- Slot, called when user clicks "Enable ver. major grid" check box
+ \brief Called when user clicks "Enable left vertical major grid" check box.
*/
void Plot2d_SetupViewDlg::onYGridMajorChecked()
{
myYMinGridCheck->setEnabled( myYGridCheck->isChecked() );
}
+
/*!
- Slot, called when user clicks "Enable ver. major grid" check box
+ \brief Called when user clicks "Enable right vertical major grid" check box.
*/
void Plot2d_SetupViewDlg::onY2GridMajorChecked()
{
myY2MinGridCheck->setEnabled( myY2GridCheck->isChecked() );
}
+
/*!
- Slot, called when user clicks "Enable hor. minor grid" check box
+ \brief Called when user clicks "Enable horizontal minor grid" check box.
*/
void Plot2d_SetupViewDlg::onXGridMinorChecked()
{
}
+
/*!
- Slot, called when user clicks "Enable ver. minor grid" check box
+ \brief Called when user clicks "Enable left vertical minor grid" check box.
*/
void Plot2d_SetupViewDlg::onYGridMinorChecked()
{
}
+
/*!
- Slot, called when user clicks "Enable ver. minor grid" check box
+ \brief Called when user clicks "Enable right vertical minor grid" check box.
*/
void Plot2d_SetupViewDlg::onY2GridMinorChecked()
{
}
+
/*!
- Retursns true if "Set as default" check box is on
+ \brief Get "Set settings as default" check box value.
+ \return \c true if "Set settings as default" check box is on
*/
bool Plot2d_SetupViewDlg::isSetAsDefault()
{
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// File : Plot2d_SetupViewDlg.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+
#ifndef PLOT2D_SETUPVIEWDLG_H
#define PLOT2D_SETUPVIEWDLG_H
#include "Plot2d.h"
-#include <qdialog.h>
+
+#include <QDialog>
class QSpinBox;
class QCheckBox;
class QLineEdit;
class QComboBox;
-class QToolButton;
class QPushButton;
+class QtxColorButton;
class PLOT2D_EXPORT Plot2d_SetupViewDlg : public QDialog
{
Q_OBJECT
public:
- Plot2d_SetupViewDlg( QWidget* parent = 0, bool showDefCheck = false, bool secondAxisY = false );
+ Plot2d_SetupViewDlg( QWidget* = 0, bool = false, bool = false );
~Plot2d_SetupViewDlg();
- void setMainTitle( bool enable, const QString& title = QString::null );
- bool isMainTitleEnabled();
- QString getMainTitle();
- void setXTitle( bool enable, const QString& title = QString::null );
- bool isXTitleEnabled();
- QString getXTitle();
- void setYTitle( bool enable, const QString& title = QString::null );
- void setY2Title( bool enable, const QString& title = QString::null );
- bool isYTitleEnabled();
- bool isY2TitleEnabled();
- QString getYTitle();
- QString getY2Title();
- void setCurveType( const int type );
- int getCurveType();
- void setLegend( bool enable, int pos );
- bool isLegendEnabled();
- int getLegendPos();
- void setMarkerSize( const int size );
- int getMarkerSize();
- void setBackgroundColor( const QColor& color );
- QColor getBackgroundColor();
- void setMajorGrid( bool enableX, const int xdiv, bool enableY, const int divY,
- bool enableY2, const int divY2 );
- void getMajorGrid( bool& enableX, int& xdiv, bool& enableY, int& divY,
- bool& enableY2, int& divY2);
- void setMinorGrid( bool enableX, const int xdiv, bool enableY, const int divY,
- bool enableY2, const int divY2);
- void getMinorGrid( bool& enableX, int& xdiv, bool& enableY, int& divY,
- bool& enableY2, int& divY2);
- void setScaleMode( const int xMode, const int yMode );
- int getXScaleMode();
- int getYScaleMode();
- bool isSetAsDefault();
+ void setMainTitle( bool, const QString& = QString() );
+ bool isMainTitleEnabled();
+ QString getMainTitle();
+
+ void setXTitle( bool, const QString& = QString() );
+ bool isXTitleEnabled();
+ QString getXTitle();
+
+ void setYTitle( bool, const QString& = QString() );
+ void setY2Title( bool, const QString& = QString() );
+ bool isYTitleEnabled();
+ bool isY2TitleEnabled();
+ QString getYTitle();
+ QString getY2Title();
+
+ void setCurveType( const int );
+ int getCurveType();
+
+ void setLegend( bool, int );
+ bool isLegendEnabled();
+ int getLegendPos();
+
+ void setMarkerSize( const int );
+ int getMarkerSize();
+
+ void setBackgroundColor( const QColor& );
+ QColor getBackgroundColor();
+
+ void setMajorGrid( bool, const int, bool, const int, bool, const int );
+ void getMajorGrid( bool&, int&, bool&, int&, bool&, int& );
+ void setMinorGrid( bool, const int, bool, const int, bool, const int );
+ void getMinorGrid( bool&, int&, bool&, int&, bool&, int& );
+
+ void setScaleMode( const int, const int );
+ int getXScaleMode();
+ int getYScaleMode();
+
+ bool isSetAsDefault();
protected slots:
- void onMainTitleChecked();
- void onXTitleChecked();
- void onYTitleChecked();
- void onY2TitleChecked();
- void onBackgroundClicked();
- void onLegendChecked();
- void onXGridMajorChecked();
- void onYGridMajorChecked();
- void onY2GridMajorChecked();
- void onXGridMinorChecked();
- void onYGridMinorChecked();
- void onY2GridMinorChecked();
+ void onMainTitleChecked();
+ void onXTitleChecked();
+ void onYTitleChecked();
+ void onY2TitleChecked();
+ void onLegendChecked();
+ void onXGridMajorChecked();
+ void onYGridMajorChecked();
+ void onY2GridMajorChecked();
+ void onXGridMinorChecked();
+ void onYGridMinorChecked();
+ void onY2GridMinorChecked();
private:
- QCheckBox* myTitleCheck;
- QLineEdit* myTitleEdit;
- QCheckBox* myTitleXCheck;
- QLineEdit* myTitleXEdit;
- QCheckBox* myTitleYCheck;
- QCheckBox* myTitleY2Check;
- QLineEdit* myTitleYEdit;
- QLineEdit* myTitleY2Edit;
- QToolButton* myBackgroundBtn;
- QCheckBox* myXGridCheck;
- QSpinBox* myXGridSpin;
- QCheckBox* myYGridCheck;
- QCheckBox* myY2GridCheck;
- QSpinBox* myYGridSpin;
- QSpinBox* myY2GridSpin;
- QCheckBox* myXMinGridCheck;
- QSpinBox* myXMinGridSpin;
- QCheckBox* myYMinGridCheck;
- QCheckBox* myY2MinGridCheck;
- QSpinBox* myYMinGridSpin;
- QSpinBox* myY2MinGridSpin;
- QComboBox* myCurveCombo;
- QCheckBox* myLegendCheck;
- QComboBox* myLegendCombo;
- QSpinBox* myMarkerSpin;
- QComboBox* myXModeCombo;
- QComboBox* myYModeCombo;
- QComboBox* myY2ModeCombo;
- QCheckBox* myDefCheck;
-
- QPushButton* myOkBtn;
- QPushButton* myCancelBtn;
- bool mySecondAxisY;
+ QCheckBox* myTitleCheck;
+ QLineEdit* myTitleEdit;
+ QCheckBox* myTitleXCheck;
+ QLineEdit* myTitleXEdit;
+ QCheckBox* myTitleYCheck;
+ QCheckBox* myTitleY2Check;
+ QLineEdit* myTitleYEdit;
+ QLineEdit* myTitleY2Edit;
+ QtxColorButton* myBackgroundBtn;
+ QCheckBox* myXGridCheck;
+ QSpinBox* myXGridSpin;
+ QCheckBox* myYGridCheck;
+ QCheckBox* myY2GridCheck;
+ QSpinBox* myYGridSpin;
+ QSpinBox* myY2GridSpin;
+ QCheckBox* myXMinGridCheck;
+ QSpinBox* myXMinGridSpin;
+ QCheckBox* myYMinGridCheck;
+ QCheckBox* myY2MinGridCheck;
+ QSpinBox* myYMinGridSpin;
+ QSpinBox* myY2MinGridSpin;
+ QComboBox* myCurveCombo;
+ QCheckBox* myLegendCheck;
+ QComboBox* myLegendCombo;
+ QSpinBox* myMarkerSpin;
+ QComboBox* myXModeCombo;
+ QComboBox* myYModeCombo;
+ QComboBox* myY2ModeCombo;
+ QCheckBox* myDefCheck;
+ QPushButton* myOkBtn;
+ QPushButton* myCancelBtn;
+ bool mySecondAxisY;
};
-#endif
+#endif // PLOT2D_SETUPVIEWDLG_H
#include <Plot2d_ViewFrame.h>
#include <Plot2d_Curve.h>
-#include <qfontmetrics.h>
+#include <QFontMetrics>
+#include <QEvent>
+#include <QMouseEvent>
#include <qwt_plot.h>
#include <qwt_plot_canvas.h>
void Plot2d_ToolTip::onToolTip( QPoint p, QString& str, QFont& f, QRect& txtRect, QRect& rect )
{
- int curInd, pInd, dist;
- double x, y;
- curInd = myPlot->closestCurve( p.x(), p.y(), dist, x, y, pInd );
+ int pInd;
+ double dist;
- if( dist>maxDist )
- return;
-
- Plot2d_Curve* c = myFrame->getCurves().find( curInd );
- if( !c )
+ Plot2d_Curve* c = myPlot->getClosestCurve( p, dist, pInd );
+ if( !c || dist>maxDist )
return;
str = c->text( pInd );
- if( !str )
+ if( str.isEmpty() )
return;
QFontMetrics m( f );
- QStringList lst = QStringList::split( "\n", str );
+ QStringList lst = str.split( "\n", QString::SkipEmptyParts );
QStringList::const_iterator anIt = lst.begin(), aLast = lst.end();
int w = 0, h = 0;
for( ; anIt!=aLast; anIt++ )
if( e && e->type() == QEvent::MouseMove )
{
QMouseEvent* me = ( QMouseEvent* )e;
- if( me->state()==0 )
+ if( me->modifiers()==0 )
return true;
}
return res;
Plot2d_ToolTip( Plot2d_ViewFrame*, Plot2d_Plot2d* );
virtual ~Plot2d_ToolTip();
+ virtual bool eventFilter( QObject*, QEvent* );
+
public slots:
void onToolTip( QPoint, QString&, QFont&, QRect&, QRect& );
-protected:
- virtual bool eventFilter( QObject*, QEvent* );
-
private:
Plot2d_ViewFrame* myFrame;
Plot2d_Plot2d* myPlot;
#include "SUIT_ResourceMgr.h"
#include "SUIT_Application.h"
-#include "qapplication.h"
-#include <qtoolbar.h>
-#include <qtoolbutton.h>
-#include <qcursor.h>
-#include <qcolordialog.h>
-#include <qptrlist.h>
-#include <qlayout.h>
-#include <qmap.h>
-#include <qpainter.h>
-#include <qpaintdevicemetrics.h>
+#include <QApplication>
+#include <QToolBar>
+#include <QToolButton>
+#include <QCursor>
+#include <QColorDialog>
+#include <QLayout>
+#include <QMap>
+#include <QPainter>
+#include <QPaintDevice>
+#include <QEvent>
+#include <QMouseEvent>
+#include <QContextMenuEvent>
+#include <QPrinter>
+#include <QPalette>
#include <qwt_math.h>
#include <qwt_plot_canvas.h>
+#include <qwt_scale_div.h>
+#include <qwt_plot_curve.h>
+#include <qwt_plot_grid.h>
+#include <qwt_scale_engine.h>
+#include <qwt_plot_zoomer.h>
+#include <qwt_curve_fitter.h>
+
#include <iostream>
#include <stdlib.h>
#include <qprinter.h>
#define DEFAULT_MARKER_SIZE 9 // default marker size
#define MIN_RECT_SIZE 11 // min sensibility area size
+#define FITALL_EVENT ( QEvent::User + 9999 )
+
const char* imageZoomCursor[] = {
"32 32 3 1",
". c None",
Constructor
*/
Plot2d_ViewFrame::Plot2d_ViewFrame( QWidget* parent, const QString& title )
- : QWidget (parent, title, 0),
+ : QWidget (parent, 0),
myOperation( NoOpId ),
myCurveType( 1 ),
myShowLegend( true ), myLegendPos( 1 ),
myMarkerSize( DEFAULT_MARKER_SIZE ),
myTitle( "" ), myXTitle( "" ), myYTitle( "" ), myY2Title( "" ),
- myBackground( white ),
+ myBackground( Qt::white ),
myTitleEnabled( true ), myXTitleEnabled( true ),
myYTitleEnabled( true ), myY2TitleEnabled (true),
myXGridMajorEnabled( true ), myYGridMajorEnabled( true ), myY2GridMajorEnabled( true ),
myXGridMaxMinor( 5 ), myYGridMaxMinor( 5 ), myY2GridMaxMinor( 5 ),
myXMode( 0 ), myYMode( 0 ), mySecondY( false )
{
+ setObjectName( title );
/* Plot 2d View */
QVBoxLayout* aLayout = new QVBoxLayout( this );
myPlot = new Plot2d_Plot2d( this );
aLayout->addWidget( myPlot );
// createActions();
-
- connect( myPlot, SIGNAL( plotMouseMoved( const QMouseEvent& ) ),
- this, SLOT( plotMouseMoved( const QMouseEvent& ) ) );
- connect( myPlot, SIGNAL( plotMousePressed( const QMouseEvent& ) ),
- this, SLOT( plotMousePressed( const QMouseEvent& ) ) );
- connect( myPlot, SIGNAL( plotMouseReleased( const QMouseEvent& ) ),
- this, SLOT( plotMouseReleased( const QMouseEvent& ) ) );
//connect( myPlot, SIGNAL( legendClicked( long ) ),
// this, SLOT( onLegendClicked( long ) ) );
if ( parent ) {
resize( (int)(0.8 * parent->width()), (int)(0.8 * parent->height()) );
}
- QwtDiMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
- QwtDiMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
- myXDistance = xMap.d2() - xMap.d1();
- myYDistance = yMap.d2() - yMap.d1();
+ QwtScaleMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
+ QwtScaleMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
+ myXDistance = xMap.s2() - xMap.s1();
+ myYDistance = yMap.s2() - yMap.s1();
myYDistance2 = 0;
if (mySecondY) {
- QwtDiMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
- myYDistance2 = yMap2.d2() - yMap2.d1();
+ QwtScaleMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
+ myYDistance2 = yMap2.s2() - yMap2.s1();
}
+ myPlot->canvas()->installEventFilter( this );
}
/*!
Destructor
*/
void Plot2d_ViewFrame::DisplayAll()
{
- QList<Plot2d_Curve> clist;
+ QList<Plot2d_Curve*> clist;
getCurves( clist );
for ( int i = 0; i < (int)clist.count(); i++ ) {
updateCurve( clist.at( i ), false );
void Plot2d_ViewFrame::EraseAll()
{
myPlot->clear();
- myCurves.clear();
+ myPlot->getCurves().clear();
myPlot->replot();
}
/*!
eraseCurves( aCurves );
}
+bool Plot2d_ViewFrame::eventFilter( QObject* watched, QEvent* e )
+{
+ if ( watched == myPlot->canvas() ) {
+ int aType = e->type();
+ switch( aType ) {
+ case QEvent::MouseMove: {
+ QMouseEvent* me = (QMouseEvent*)e;
+ if ( me && ( me->buttons() != 0 || me->button() != 0 ) ) {
+ QMouseEvent m( QEvent::MouseMove, me->pos(), me->button(),
+ me->buttons(), me->modifiers() );
+ if ( plotMouseMoved( m ) )
+ return true;
+ }
+ break;
+ }
+ case QEvent::MouseButtonPress: {
+ QMouseEvent* me = (QMouseEvent*)e;
+ if ( me && ( me->buttons() != 0 || me->button() != 0 ) ) {
+ QMouseEvent m( QEvent::MouseButtonPress, me->pos(), me->button(),
+ me->buttons(), me->modifiers() );
+ plotMousePressed( m );
+ }
+ break;
+ }
+ case QEvent::MouseButtonRelease: {
+ QMouseEvent* me = (QMouseEvent*)e;
+ if ( me && ( me->buttons() != 0 || me->button() != 0 ) ) {
+ QMouseEvent m( QEvent::MouseButtonRelease, me->pos(), me->button(),
+ me->buttons(), me->modifiers() );
+ plotMouseReleased( m );
+ }
+ break;
+ }
+ }
+ }
+ return QWidget::eventFilter( watched, e );
+}
+
/*!
Sets title
*/
myY2GridMaxMinor = resMgr->integerValue( "Plot2d", "VerMinorGridMax", myY2GridMaxMinor );
myXMode = resMgr->integerValue( "Plot2d", "HorScaleMode", myXMode );
- myXMode = QMAX( 0, QMIN( 1, myXMode ) );
+ myXMode = qMax( 0, qMin( 1, myXMode ) );
myYMode = resMgr->integerValue( "Plot2d", "VerScaleMode", myYMode );
- myYMode = QMAX( 0, QMIN( 1, myYMode ) );
+ myYMode = qMax( 0, qMin( 1, myYMode ) );
}
/*!
QString Plot2d_ViewFrame::getInfo( const QPoint& pnt )
{
int i;
+ QwtValueList aTicks;
bool xFound = false, yFound = false;
double xCoord, yCoord;
- const QwtScaleDiv* aXscale = myPlot->axisScale( QwtPlot::xBottom );
- for ( i = 0; i < aXscale->majCnt(); i++ ) {
- double majXmark = aXscale->majMark( i );
+ const QwtScaleDiv* aXscale = myPlot->axisScaleDiv( QwtPlot::xBottom );
+ aTicks = aXscale->ticks( QwtScaleDiv::MajorTick );
+ for ( i = 0; i < aTicks.count(); i++ ) {
+ double majXmark = aTicks[i];
int xmark = myPlot->transform( QwtPlot::xBottom, majXmark );
if ( xmark-2 == pnt.x() ) {
xCoord = majXmark;
}
}
if ( !xFound ) {
- for ( i = 0; i < aXscale->minCnt(); i++ ) {
- double minXmark = aXscale->minMark( i );
+ aTicks = aXscale->ticks( QwtScaleDiv::MinorTick );
+ for ( i = 0; i < aTicks.count(); i++ ) {
+ double minXmark = aTicks[i];
int xmark = myPlot->transform( QwtPlot::xBottom, minXmark );
if ( xmark-2 == pnt.x() ) {
xCoord = minXmark;
}
}
}
- const QwtScaleDiv* aYscale = myPlot->axisScale( QwtPlot::yLeft );
- for ( i = 0; i < aYscale->majCnt(); i++ ) {
- double majYmark = aYscale->majMark( i );
+ const QwtScaleDiv* aYscale = myPlot->axisScaleDiv( QwtPlot::yLeft );
+ aTicks = aYscale->ticks( QwtScaleDiv::MajorTick );
+ for ( i = 0; i < aTicks.count(); i++ ) {
+ double majYmark = aTicks[i];
int ymark = myPlot->transform( QwtPlot::yLeft, majYmark );
if ( ymark-2 == pnt.y() ) {
yCoord = majYmark;
}
}
if ( !yFound ) {
- for ( i = 0; i < aYscale->minCnt(); i++ ) {
- double minYmark = aYscale->minMark( i );
+ aTicks = aYscale->ticks( QwtScaleDiv::MinorTick );
+ for ( i = 0; i < aTicks.count(); i++ ) {
+ double minYmark = aTicks[i];
int ymark = myPlot->transform( QwtPlot::yLeft, minYmark );
if ( ymark-2 == pnt.y() ) {
yCoord = minYmark;
}
}
- QString strX = QString::number( xFound ? xCoord : myPlot->invTransform( QwtPlot::xBottom, pnt.x() ) ).stripWhiteSpace();
+ QString strX = QString::number( xFound ? xCoord : myPlot->invTransform( QwtPlot::xBottom, pnt.x() ) ).trimmed();
if ( strX == "-0" )
strX = "0";
- QString strY = QString::number( yFound ? yCoord : myPlot->invTransform( QwtPlot::yLeft, pnt.y() ) ).stripWhiteSpace();
+ QString strY = QString::number( yFound ? yCoord : myPlot->invTransform( QwtPlot::yLeft, pnt.y() ) ).trimmed();
if ( strY == "-0" )
strY = "0";
QString info = "";
bool yFound2 = false;
double yCoord2;
- const QwtScaleDiv* aYscale2 = myPlot->axisScale( QwtPlot::yRight );
- for ( i = 0; i < aYscale2->majCnt(); i++ ) {
- double majYmark = aYscale2->majMark( i );
+ const QwtScaleDiv* aYscale2 = myPlot->axisScaleDiv( QwtPlot::yRight );
+ aTicks = aYscale2->ticks( QwtScaleDiv::MajorTick );
+ for ( i = 0; i < aTicks.count(); i++ ) {
+ double majYmark = aTicks[i];
int ymark = myPlot->transform( QwtPlot::yRight, majYmark );
if ( ymark-2 == pnt.y() ) {
yCoord2 = majYmark;
}
}
if ( !yFound2 ) {
- for ( i = 0; i < aYscale2->minCnt(); i++ ) {
- double minYmark = aYscale2->minMark( i );
+ aTicks = aYscale2->ticks( QwtScaleDiv::MinorTick );
+ for ( i = 0; i < aTicks.count(); i++ ) {
+ double minYmark = aTicks[i];
int ymark = myPlot->transform( QwtPlot::yRight, minYmark );
if ( ymark-2 == pnt.y() ) {
yCoord2 = minYmark;
}
}
QString strY2 = QString::number( yFound2 ? yCoord2 :
- myPlot->invTransform( QwtPlot::yRight, pnt.y() ) ).stripWhiteSpace();
+ myPlot->invTransform( QwtPlot::yRight, pnt.y() ) ).trimmed();
if ( strY2 == "-0" )
strY2 = "0";
info = tr("INF_COORDINATES_SOME_Y").arg( strX ).arg( strY ).arg( strY2 );
return info;
}
-/*!
- Converts Plot2d_Curve's marker style to Qwt marker style [ static ]
-*/
-static QwtSymbol::Style plot2qwtMarker( Plot2d_Curve::MarkerType m )
-{
- QwtSymbol::Style ms = QwtSymbol::None;
- switch ( m ) {
- case Plot2d_Curve::Circle:
- ms = QwtSymbol::Ellipse; break;
- case Plot2d_Curve::Rectangle:
- ms = QwtSymbol::Rect; break;
- case Plot2d_Curve::Diamond:
- ms = QwtSymbol::Diamond; break;
- case Plot2d_Curve::DTriangle:
- ms = QwtSymbol::DTriangle; break;
- case Plot2d_Curve::UTriangle:
- ms = QwtSymbol::UTriangle; break;
- case Plot2d_Curve::LTriangle: // Qwt confuses LTriangle and RTriangle :(((
- ms = QwtSymbol::RTriangle; break;
- case Plot2d_Curve::RTriangle: // Qwt confuses LTriangle and RTriangle :(((
- ms = QwtSymbol::LTriangle; break;
- case Plot2d_Curve::Cross:
- ms = QwtSymbol::Cross; break;
- case Plot2d_Curve::XCross:
- ms = QwtSymbol::XCross; break;
- case Plot2d_Curve::None:
- default:
- ms = QwtSymbol::None; break;
- }
- return ms;
-}
-
-/*!
- Converts Qwt marker style to Plot2d_Curve's marker style [ static ]
-*/
-static Plot2d_Curve::MarkerType qwt2plotMarker( QwtSymbol::Style m )
-{
- Plot2d_Curve::MarkerType ms = Plot2d_Curve::None;
- switch ( m ) {
- case QwtSymbol::Ellipse:
- ms = Plot2d_Curve::Circle; break;
- case QwtSymbol::Rect:
- ms = Plot2d_Curve::Rectangle; break;
- case QwtSymbol::Diamond:
- ms = Plot2d_Curve::Diamond; break;
- case QwtSymbol::DTriangle:
- ms = Plot2d_Curve::DTriangle; break;
- case QwtSymbol::UTriangle:
- ms = Plot2d_Curve::UTriangle; break;
- case QwtSymbol::RTriangle: // Qwt confuses LTriangle and RTriangle :(((
- ms = Plot2d_Curve::LTriangle; break;
- case QwtSymbol::LTriangle: // Qwt confuses LTriangle and RTriangle :(((
- ms = Plot2d_Curve::RTriangle; break;
- case QwtSymbol::Cross:
- ms = Plot2d_Curve::Cross; break;
- case QwtSymbol::XCross:
- ms = Plot2d_Curve::XCross; break;
- case QwtSymbol::None:
- default:
- ms = Plot2d_Curve::None; break;
- }
- return ms;
-}
-
-/*!
- Converts Plot2d_Curve's line style to Qwt line style [ static ]
-*/
-static Qt::PenStyle plot2qwtLine( Plot2d_Curve::LineType p )
-{
- Qt::PenStyle ps = Qt::NoPen;
- switch ( p ) {
- case Plot2d_Curve::Solid:
- ps = Qt::SolidLine; break;
- case Plot2d_Curve::Dash:
- ps = Qt::DashLine; break;
- case Plot2d_Curve::Dot:
- ps = Qt::DotLine; break;
- case Plot2d_Curve::DashDot:
- ps = Qt::DashDotLine; break;
- case Plot2d_Curve::DashDotDot:
- ps = Qt::DashDotDotLine; break;
- case Plot2d_Curve::NoPen:
- default:
- ps = Qt::NoPen; break;
- }
- return ps;
-}
-
-/*!
- Converts Qwt line style to Plot2d_Curve's line style [ static ]
-*/
-static Plot2d_Curve::LineType qwt2plotLine( Qt::PenStyle p )
-{
- Plot2d_Curve::LineType ps = Plot2d_Curve::NoPen;
- switch ( p ) {
- case Qt::SolidLine:
- ps = Plot2d_Curve::Solid; break;
- case Qt::DashLine:
- ps = Plot2d_Curve::Dash; break;
- case Qt::DotLine:
- ps = Plot2d_Curve::Dot; break;
- case Qt::DashDotLine:
- ps = Plot2d_Curve::DashDot; break;
- case Qt::DashDotDotLine:
- ps = Plot2d_Curve::DashDotDot; break;
- case Qt::NoPen:
- default:
- ps = Plot2d_Curve::NoPen; break;
- }
- return ps;
-}
-
/*!
Adds curve into view
*/
if ( myYMode && curve->getMinY() <= 0. )
setVerScaleMode( 0, false );
- if ( hasCurve( curve ) ) {
+ if ( hasPlotCurve( curve ) ) {
updateCurve( curve, update );
}
else {
- long curveKey = myPlot->insertCurve( curve->getVerTitle() );
- myPlot->setCurveYAxis(curveKey, curve->getYAxis());
+ QwtPlotCurve* aPCurve = new QwtPlotCurve( curve->getVerTitle() );
+ aPCurve->attach( myPlot );
+ //myPlot->setCurveYAxis(curveKey, curve->getYAxis());
- myCurves.insert( curveKey, curve );
+ myPlot->getCurves().insert( aPCurve, curve );
if ( curve->isAutoAssign() ) {
QwtSymbol::Style typeMarker;
QColor color;
Qt::PenStyle typeLine;
+
myPlot->getNextMarker( typeMarker, color, typeLine );
- myPlot->setCurvePen( curveKey, QPen( color, DEFAULT_LINE_WIDTH, typeLine ) );
- myPlot->setCurveSymbol( curveKey, QwtSymbol( typeMarker,
+ aPCurve->setPen( QPen( color, DEFAULT_LINE_WIDTH, typeLine ) );
+ aPCurve->setSymbol( QwtSymbol( typeMarker,
QBrush( color ),
QPen( color ),
QSize( myMarkerSize, myMarkerSize ) ) );
curve->setColor( color );
- curve->setLine( qwt2plotLine( typeLine ) );
- curve->setMarker( qwt2plotMarker( typeMarker ) );
+ curve->setLine( Plot2d::qwt2plotLine( typeLine ) );
+ curve->setMarker( Plot2d::qwt2plotMarker( typeMarker ) );
}
else {
- Qt::PenStyle ps = plot2qwtLine( curve->getLine() );
- QwtSymbol::Style ms = plot2qwtMarker( curve->getMarker() );
- myPlot->setCurvePen( curveKey, QPen( curve->getColor(), curve->getLineWidth(), ps ) );
- myPlot->setCurveSymbol( curveKey, QwtSymbol( ms,
+ Qt::PenStyle ps = Plot2d::plot2qwtLine( curve->getLine() );
+ QwtSymbol::Style ms = Plot2d::plot2qwtMarker( curve->getMarker() );
+ aPCurve->setPen( QPen( curve->getColor(), curve->getLineWidth(), ps ) );
+ aPCurve->setSymbol( QwtSymbol( ms,
QBrush( curve->getColor() ),
QPen( curve->getColor() ),
QSize( myMarkerSize, myMarkerSize ) ) );
}
- if ( myCurveType == 0 )
- myPlot->setCurveStyle( curveKey, QwtCurve::NoCurve );
- else if ( myCurveType == 1 )
- myPlot->setCurveStyle( curveKey, QwtCurve::Lines );
- else if ( myCurveType == 2 )
- myPlot->setCurveStyle( curveKey, QwtCurve::Spline );
- myPlot->setCurveData( curveKey, curve->horData(), curve->verData(), curve->nbPoints() );
+ setCurveType( aPCurve, myCurveType );
+ aPCurve->setData( curve->horData(), curve->verData(), curve->nbPoints() );
}
updateTitles();
if ( update )
*/
void Plot2d_ViewFrame::displayCurves( const curveList& curves, bool update )
{
- myPlot->setUpdatesEnabled( false );
- QPtrListIterator<Plot2d_Curve> it(curves);
+ //myPlot->setUpdatesEnabled( false ); // call this function deprecate update of legend
+ QList<Plot2d_Curve*>::const_iterator it = curves.begin();
Plot2d_Curve* aCurve;
- while( (aCurve = it.current()) ) {
+ for (; it != curves.end(); ++it ) {
+ aCurve = *it;
displayCurve( aCurve, false );
- ++it;
}
-
fitAll();
- myPlot->setUpdatesEnabled( true );
+ //myPlot->setUpdatesEnabled( true );
+// update legend
if ( update )
myPlot->replot();
}
{
if ( !curve )
return;
- int curveKey = hasCurve( curve );
- if ( curveKey ) {
- myPlot->removeCurve( curveKey );
- myCurves.remove( curveKey );
+ if ( hasPlotCurve( curve ) ) {
+ QwtPlotCurve* aPCurve = getPlotCurve( curve );
+ aPCurve->hide();
+ aPCurve->detach();
+ myPlot->getCurves().remove( aPCurve );
updateTitles();
if ( update )
myPlot->replot();
*/
void Plot2d_ViewFrame::eraseCurves( const curveList& curves, bool update )
{
- QPtrListIterator<Plot2d_Curve> it(curves);
+ QList<Plot2d_Curve*>::const_iterator it = curves.begin();
Plot2d_Curve* aCurve;
- while( (aCurve = it.current()) ) {
+ for (; it != curves.end(); ++it ) {
+ aCurve = *it;
eraseCurve( aCurve, false );
- ++it;
}
// fitAll();
if ( update )
{
if ( !curve )
return;
- int curveKey = hasCurve( curve );
- if ( curveKey ) {
+ if ( hasPlotCurve( curve ) ) {
+ QwtPlotCurve* aPCurve = getPlotCurve( curve );
if ( !curve->isAutoAssign() ) {
- Qt::PenStyle ps = plot2qwtLine( curve->getLine() );
- QwtSymbol::Style ms = plot2qwtMarker( curve->getMarker() );
- myPlot->setCurvePen( curveKey, QPen( curve->getColor(), curve->getLineWidth(), ps ) );
- myPlot->setCurveSymbol( curveKey, QwtSymbol( ms,
+ Qt::PenStyle ps = Plot2d::plot2qwtLine( curve->getLine() );
+ QwtSymbol::Style ms = Plot2d::plot2qwtMarker( curve->getMarker() );
+ aPCurve->setPen ( QPen( curve->getColor(), curve->getLineWidth(), ps ) );
+ aPCurve->setSymbol( QwtSymbol( ms,
QBrush( curve->getColor() ),
QPen( curve->getColor() ),
QSize( myMarkerSize, myMarkerSize ) ) );
- myPlot->setCurveData( curveKey, curve->horData(), curve->verData(), curve->nbPoints() );
+ aPCurve->setData( curve->horData(), curve->verData(), curve->nbPoints() );
}
- myPlot->setCurveTitle( curveKey, curve->getVerTitle() );
- myPlot->curve( curveKey )->setEnabled( true );
+ aPCurve->setTitle( curve->getVerTitle() );
+ aPCurve->setVisible( true );
if ( update )
myPlot->replot();
}
}
-/*!
- Returns curve key if is is displayed in the viewer and 0 otherwise
-*/
-int Plot2d_ViewFrame::hasCurve( Plot2d_Curve* curve )
-{
- QIntDictIterator<Plot2d_Curve> it( myCurves );
- for ( ; it.current(); ++it ) {
- if ( it.current() == curve )
- return it.currentKey();
- }
- return 0;
-}
-
/*!
Gets lsit of displayed curves
*/
-int Plot2d_ViewFrame::getCurves( QList<Plot2d_Curve>& clist )
+int Plot2d_ViewFrame::getCurves( curveList& clist )
{
clist.clear();
- clist.setAutoDelete( false );
- QIntDictIterator<Plot2d_Curve> it( myCurves );
- for ( ; it.current(); ++it ) {
- clist.append( it.current() );
- }
+
+ CurveDict::iterator it = myPlot->getCurves().begin();
+ for ( ; it != myPlot->getCurves().end(); it++ )
+ clist.append( it.value() );
return clist.count();
}
+const CurveDict& Plot2d_ViewFrame::getCurves()
+{
+ return myPlot->getCurves();
+}
+
/*!
Returns true if the curve is visible
*/
bool Plot2d_ViewFrame::isVisible( Plot2d_Curve* curve )
{
if(curve) {
- int key = hasCurve( curve );
- if ( key )
- return myPlot->curve( key )->enabled();
+ if ( hasPlotCurve( curve ) ) {
+ return getPlotCurve( curve )->isVisible();
+ }
}
return false;
}
return;
curveList aCurves = prs->getCurves();
- QPtrListIterator<Plot2d_Curve> it(aCurves);
+ QList<Plot2d_Curve*>::iterator it = aCurves.begin();
Plot2d_Curve* aCurve;
- while( (aCurve = it.current()) ) {
- int curveKey = hasCurve( aCurve );
- if ( curveKey )
- myPlot->setCurveTitle( curveKey, aCurve->getVerTitle() );
- ++it;
+ for (; it != aCurves.end(); ++it ) {
+ aCurve = *it;
+ if ( hasPlotCurve( aCurve ) )
+ getPlotCurve( aCurve )->setTitle( aCurve->getVerTitle() );
}
}
*/
void Plot2d_ViewFrame::fitAll()
{
- QwtDiMap xMap1 = myPlot->canvasMap( QwtPlot::xBottom );
+ // Postpone fitAll operation until QwtPlot geometry
+ // has been fully defined
+ if ( !myPlot->polished() ){
+ QApplication::postEvent( this, new QEvent( (QEvent::Type)FITALL_EVENT ) );
+ return;
+ }
myPlot->setAxisAutoScale( QwtPlot::yLeft );
myPlot->setAxisAutoScale( QwtPlot::xBottom );
myPlot->replot();
// for existing grid
- QwtDiMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
- QwtDiMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
+ QwtScaleMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
+ QwtScaleMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
- myPlot->setAxisScale( QwtPlot::xBottom,
- myPlot->invTransform( QwtPlot::xBottom, xMap.i1() ),
- myPlot->invTransform( QwtPlot::xBottom, xMap.i2() ) );
- myPlot->setAxisScale( QwtPlot::yLeft,
- myPlot->invTransform( QwtPlot::yLeft, yMap.i1() ),
- myPlot->invTransform( QwtPlot::yLeft, yMap.i2() ) );
+ myPlot->setAxisScale( QwtPlot::xBottom, xMap.s1(), xMap.s2() );
+ myPlot->setAxisScale( QwtPlot::yLeft, yMap.s1(), yMap.s2() );
if (mySecondY) {
myPlot->setAxisAutoScale( QwtPlot::yRight );
myPlot->replot();
- QwtDiMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
- myPlot->setAxisScale( QwtPlot::yRight,
- myPlot->invTransform( QwtPlot::yRight, yMap2.i1() ),
- myPlot->invTransform( QwtPlot::yRight, yMap2.i2() ) );
+ QwtScaleMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
+ myPlot->setAxisScale( QwtPlot::yRight, yMap2.s1(), yMap2.s2() );
}
myPlot->replot();
}
*/
void Plot2d_ViewFrame::fitArea( const QRect& area )
{
- QRect rect = area.normalize();
+ QRect rect = area.normalized();
if ( rect.width() < MIN_RECT_SIZE ) {
rect.setWidth( MIN_RECT_SIZE );
rect.setLeft( rect.left() - MIN_RECT_SIZE/2 );
double y2Min, double y2Max)
{
if ( mode == 0 || mode == 2 ) {
- myPlot->setAxisScale( QwtPlot::yLeft, yMax, yMin );
+ myPlot->setAxisScale( QwtPlot::yLeft, yMin, yMax );
if (mySecondY)
- myPlot->setAxisScale( QwtPlot::yRight, y2Max, y2Min );
+ myPlot->setAxisScale( QwtPlot::yRight, y2Min, y2Max );
}
if ( mode == 0 || mode == 1 )
myPlot->setAxisScale( QwtPlot::xBottom, xMin, xMax );
double& yMin, double& yMax,
double& y2Min, double& y2Max)
{
- int ixMin = myPlot->canvasMap( QwtPlot::xBottom ).i1();
- int ixMax = myPlot->canvasMap( QwtPlot::xBottom ).i2();
- int iyMin = myPlot->canvasMap( QwtPlot::yLeft ).i1();
- int iyMax = myPlot->canvasMap( QwtPlot::yLeft ).i2();
+ int ixMin = myPlot->canvasMap( QwtPlot::xBottom ).transform( myPlot->canvasMap( QwtPlot::xBottom ).s1() );
+ int ixMax = myPlot->canvasMap( QwtPlot::xBottom ).transform( myPlot->canvasMap( QwtPlot::xBottom ).s2() );
+ int iyMin = myPlot->canvasMap( QwtPlot::yLeft ).transform( myPlot->canvasMap( QwtPlot::yLeft ).s1() );
+ int iyMax = myPlot->canvasMap( QwtPlot::yLeft ).transform( myPlot->canvasMap( QwtPlot::yLeft ).s2() );
xMin = myPlot->invTransform(QwtPlot::xBottom, ixMin);
xMax = myPlot->invTransform(QwtPlot::xBottom, ixMax);
yMin = myPlot->invTransform(QwtPlot::yLeft, iyMin);
y2Min = 0;
y2Max = 0;
if (mySecondY) {
- int iyMin = myPlot->canvasMap( QwtPlot::yRight ).i1();
- int iyMax = myPlot->canvasMap( QwtPlot::yRight ).i2();
+ int iyMin = myPlot->canvasMap( QwtPlot::yRight ).transform( myPlot->canvasMap( QwtPlot::yRight ).s1() );
+ int iyMax = myPlot->canvasMap( QwtPlot::yRight ).transform( myPlot->canvasMap( QwtPlot::yRight ).s2() );
y2Min = myPlot->invTransform(QwtPlot::yRight, iyMin);
y2Max = myPlot->invTransform(QwtPlot::yRight, iyMax);
}
*/
int Plot2d_ViewFrame::testOperation( const QMouseEvent& me )
{
- int btn = me.button() | me.state();
- const int zoomBtn = ControlButton | LeftButton;
- const int panBtn = ControlButton | MidButton;
- const int fitBtn = ControlButton | RightButton;
+ int btn = me.button() | me.modifiers();
+ const int zoomBtn = Qt::ControlModifier | Qt::LeftButton;
+ const int panBtn = Qt::ControlModifier | Qt::MidButton;
+ const int fitBtn = Qt::ControlModifier | Qt::RightButton;
switch (btn)
{
void Plot2d_ViewFrame::setCurveType( int curveType, bool update )
{
myCurveType = curveType;
- QArray<long> keys = myPlot->curveKeys();
- for ( int i = 0; i < (int)keys.count(); i++ ) {
- if ( myCurveType == 0 )
- myPlot->setCurveStyle( keys[i], QwtCurve::Dots );//QwtCurve::NoCurve
- else if ( myCurveType == 1 )
- myPlot->setCurveStyle( keys[i], QwtCurve::Lines );
- else if ( myCurveType == 2 )
- myPlot->setCurveStyle( keys[i], QwtCurve::Spline );
+ CurveDict::iterator it = myPlot->getCurves().begin();
+ for ( ; it != myPlot->getCurves().end(); it++ ) {
+ QwtPlotCurve* crv = it.key();
+ if ( crv )
+ setCurveType( crv, myCurveType );
}
if ( update )
myPlot->replot();
\param curveKey - curve id
\param title - new title
*/
-void Plot2d_ViewFrame::setCurveTitle( int curveKey, const QString& title )
+void Plot2d_ViewFrame::setCurveTitle( Plot2d_Curve* curve, const QString& title )
{
- if(myPlot) myPlot->setCurveTitle(curveKey, title);
+ if ( curve && hasPlotCurve( curve ) )
+ getPlotCurve( curve )->setTitle( title );
}
/*!
void Plot2d_ViewFrame::showLegend( bool show, bool update )
{
myShowLegend = show;
- myPlot->setAutoLegend( myShowLegend );
- myPlot->enableLegend( myShowLegend );
+ if ( myShowLegend ) {
+ QwtLegend* legend = myPlot->legend();
+ if ( !legend ) {
+ legend = new QwtLegend( myPlot );
+ legend->setFrameStyle( QFrame::Box | QFrame::Sunken );
+ }
+ myPlot->insertLegend( legend );
+ setLegendPos( myLegendPos );
+ }
+ else
+ myPlot->insertLegend( 0 );
if ( update )
myPlot->replot();
}
void Plot2d_ViewFrame::setLegendPos( int pos )
{
myLegendPos = pos;
+ QwtLegend* legend = myPlot->legend();
switch( pos ) {
case 0:
- myPlot->setLegendPos( Qwt::Left );
+ myPlot->insertLegend( legend, QwtPlot::LeftLegend );
break;
case 1:
- myPlot->setLegendPos( Qwt::Right );
+ myPlot->insertLegend( legend, QwtPlot::RightLegend );
break;
case 2:
- myPlot->setLegendPos( Qwt::Top );
+ myPlot->insertLegend( legend, QwtPlot::TopLegend );
break;
case 3:
- myPlot->setLegendPos( Qwt::Bottom );
+ myPlot->insertLegend( legend, QwtPlot::BottomLegend );
break;
}
}
if ( myMarkerSize != size )
{
myMarkerSize = size;
- QArray<long> keys = myPlot->curveKeys();
- for ( int i = 0; i < (int)keys.count(); i++ )
- {
- QwtPlotCurve* crv = myPlot->curve( keys[i] );
+ CurveDict::iterator it = myPlot->getCurves().begin();
+ for ( ; it != myPlot->getCurves().end(); it++ ) {
+ QwtPlotCurve* crv = it.key();
if ( crv )
{
QwtSymbol aSymbol = crv->symbol();
aSymbol.setSize( myMarkerSize, myMarkerSize );
- myPlot->setCurveSymbol( keys[i], aSymbol );
+ crv->setSymbol( aSymbol );
}
}
if ( update )
void Plot2d_ViewFrame::setBackgroundColor( const QColor& color )
{
myBackground = color;
- //myPlot->setCanvasBackground( myBackground );
myPlot->canvas()->setPalette( myBackground );
myPlot->setPalette( myBackground );
- QPalette aPal = myPlot->getLegend()->palette();
- for ( int i = 0; i < QPalette::NColorGroups; i++ ) {
- QPalette::ColorGroup cg = (QPalette::ColorGroup)i;
- aPal.setColor( cg, QColorGroup::Base, myBackground );
- aPal.setColor( cg, QColorGroup::Background, myBackground );
+ if ( myPlot->getLegend() ) {
+ QPalette aPal = myPlot->getLegend()->palette();
+ for ( int i = 0; i < QPalette::NColorGroups; i++ ) {
+ aPal.setColor( QPalette::Base, myBackground );
+ aPal.setColor( QPalette::Background, myBackground );
+ }
+ myPlot->getLegend()->setPalette( aPal );
}
- myPlot->getLegend()->setPalette( aPal );
Repaint();
}
/*!
myXGridMinorEnabled = xMinorEnabled;
myXGridMaxMajor = xMajorMax;
myXGridMaxMinor = xMinorMax;
+
myPlot->setAxisMaxMajor( QwtPlot::xBottom, myXGridMaxMajor );
myPlot->setAxisMaxMinor( QwtPlot::xBottom, myXGridMaxMinor );
- myPlot->setGridXAxis(QwtPlot::xBottom);
- myPlot->enableGridX( myXGridMajorEnabled );
- myPlot->enableGridXMin( myXGridMinorEnabled );
+
+ QwtPlotGrid* grid = myPlot->grid();
+ if ( myPlot->axisScaleDiv( QwtPlot::xBottom ) )
+ grid->setXDiv( *myPlot->axisScaleDiv( QwtPlot::xBottom ) );
+ grid->enableX( myXGridMajorEnabled );
+ grid->enableXMin( myXGridMinorEnabled );
+
if ( update )
myPlot->replot();
}
myPlot->setAxisMaxMinor( QwtPlot::yRight, myY2GridMaxMinor );
}
- myPlot->setGridYAxis(QwtPlot::yLeft);
+ QwtPlotGrid* grid = myPlot->grid();
+ if ( myPlot->axisScaleDiv( QwtPlot::yLeft ) )
+ grid->setYDiv( *myPlot->axisScaleDiv( QwtPlot::yLeft ) );
if (mySecondY) {
if (myYGridMajorEnabled) {
- myPlot->enableGridYMin(myYGridMinorEnabled);
- myPlot->enableGridY( myYGridMajorEnabled);
+ grid->enableY( myYGridMajorEnabled );
+ grid->enableYMin( myYGridMinorEnabled );
}
else if (myY2GridMajorEnabled) {
- myPlot->setGridYAxis(QwtPlot::yRight);
- myPlot->enableGridYMin(myY2GridMinorEnabled);
- myPlot->enableGridY(myY2GridMajorEnabled);
+ if ( myPlot->axisScaleDiv( QwtPlot::yRight ) )
+ grid->setYDiv( *myPlot->axisScaleDiv( QwtPlot::yRight ) );
+ grid->enableY( myY2GridMajorEnabled );
+ grid->enableYMin( myY2GridMinorEnabled );
}
else {
- myPlot->enableGridYMin(false);
- myPlot->enableGridY(false);
+ grid->enableY( false );
+ grid->enableYMin( false );
}
}
else {
- myPlot->enableGridY( myYGridMajorEnabled );
- myPlot->enableGridYMin( myYGridMinorEnabled );
+ grid->enableY( myYGridMajorEnabled );
+ grid->enableYMin( myYGridMinorEnabled );
}
if ( update )
myPlot->replot();
case MainTitle:
myTitleEnabled = enabled;
myTitle = title;
- myPlot->setTitle( myTitleEnabled ? myTitle : QString::null );
+ myPlot->setTitle( myTitleEnabled ? myTitle : QString() );
break;
case XTitle:
myXTitleEnabled = enabled;
myXTitle = title;
- myPlot->setAxisTitle( QwtPlot::xBottom, myXTitleEnabled ? myXTitle : QString::null );
+ myPlot->setAxisTitle( QwtPlot::xBottom, myXTitleEnabled ? myXTitle : QString() );
break;
case YTitle:
myYTitleEnabled = enabled;
myYTitle = title;
- myPlot->setAxisTitle( QwtPlot::yLeft, myYTitleEnabled ? myYTitle : QString::null );
+ myPlot->setAxisTitle( QwtPlot::yLeft, myYTitleEnabled ? myYTitle : QString() );
break;
case Y2Title:
myY2TitleEnabled = enabled;
myY2Title = title;
- myPlot->setAxisTitle( QwtPlot::yRight, myY2TitleEnabled ? myY2Title : QString::null );
+ myPlot->setAxisTitle( QwtPlot::yRight, myY2TitleEnabled ? myY2Title : QString() );
break;
}
if ( update )
{
switch (type) {
case MainTitle:
- myPlot->setTitleFont(font);
+ myPlot->title().setFont(font);
break;
case XTitle:
- myPlot->setAxisTitleFont(QwtPlot::xBottom, font); break;
+ myPlot->axisTitle(QwtPlot::xBottom).setFont(font); break;
case YTitle:
- myPlot->setAxisTitleFont(QwtPlot::yLeft, font); break;
+ myPlot->axisTitle(QwtPlot::yLeft).setFont(font); break;
case Y2Title:
- myPlot->setAxisTitleFont(QwtPlot::yRight, font); break;
+ myPlot->axisTitle(QwtPlot::yRight).setFont(font); break;
case XAxis:
- myPlot->setAxisFont(QwtPlot::xBottom, font); break;
+ myPlot->setAxisFont(QwtPlot::xBottom, font); break;
case YAxis:
- myPlot->setAxisFont(QwtPlot::yLeft, font); break;
+ myPlot->setAxisFont(QwtPlot::yLeft, font); break;
case Y2Axis:
- myPlot->setAxisFont(QwtPlot::yRight, font); break;
+ myPlot->setAxisFont(QwtPlot::yRight, font); break;
}
if ( update )
myPlot->replot();
*/
void Plot2d_ViewFrame::setHorScaleMode( const int mode, bool update )
{
+ if ( myXMode == mode )
+ return;
+
// san -- Protection against QwtCurve bug in Qwt 0.4.x:
// it crashes if switched to X/Y logarithmic mode, when one or more points have
// non-positive X/Y coordinate
if ( mode && !isXLogEnabled() ){
- SUIT_MessageBox::warn1(this, tr("WARNING"), tr("WRN_XLOG_NOT_ALLOWED"), tr("BUT_OK"));
+ SUIT_MessageBox::warning(this, tr("WARNING"), tr("WRN_XLOG_NOT_ALLOWED"));
return;
}
myXMode = mode;
- myPlot->changeAxisOptions( QwtPlot::xBottom, QwtAutoScale::Logarithmic, myXMode != 0 );
+ myPlot->setLogScale(QwtPlot::xBottom, myXMode != 0);
if ( update )
fitAll();
*/
void Plot2d_ViewFrame::setVerScaleMode( const int mode, bool update )
{
+ if ( myYMode == mode )
+ return;
+
// san -- Protection against QwtCurve bug in Qwt 0.4.x:
// it crashes if switched to X/Y logarithmic mode, when one or more points have
// non-positive X/Y coordinate
if ( mode && !isYLogEnabled() ){
- SUIT_MessageBox::warn1(this, tr("WARNING"), tr("WRN_YLOG_NOT_ALLOWED"), tr("BUT_OK"));
+ SUIT_MessageBox::warning(this, tr("WARNING"), tr("WRN_YLOG_NOT_ALLOWED"));
return;
}
myYMode = mode;
- myPlot->changeAxisOptions( QwtPlot::yLeft, QwtAutoScale::Logarithmic, myYMode != 0 );
+ myPlot->setLogScale(QwtPlot::yLeft, myYMode != 0);
if (mySecondY)
- myPlot->changeAxisOptions( QwtPlot::yRight, QwtAutoScale::Logarithmic, myYMode != 0 );
+ myPlot->setLogScale( QwtPlot::yRight, myYMode != 0 );
if ( update )
fitAll();
/*!
Slot, called when user presses mouse button
*/
-void Plot2d_ViewFrame::plotMousePressed(const QMouseEvent& me )
+void Plot2d_ViewFrame::plotMousePressed( const QMouseEvent& me )
{
Plot2d_ViewWindow* aParent = dynamic_cast<Plot2d_ViewWindow*>(parent());
- if (aParent)
+ if (aParent)
aParent->putInfo(getInfo(me.pos()));
if ( myOperation == NoOpId )
myOperation = testOperation( me );
if ( myOperation != NoOpId ) {
myPnt = me.pos();
- if ( myOperation == FitAreaId ) {
- myPlot->setOutlineStyle( Qwt::Rect );
- }
- else if ( myOperation == GlPanId ) {
+ if ( myOperation == GlPanId ) {
myPlot->setAxisScale( QwtPlot::yLeft,
- myPlot->invTransform( QwtPlot::yLeft, myPnt.y() ) + myYDistance/2,
- myPlot->invTransform( QwtPlot::yLeft, myPnt.y() ) - myYDistance/2 );
+ myPlot->invTransform( QwtPlot::yLeft, myPnt.y() ) - myYDistance/2,
+ myPlot->invTransform( QwtPlot::yLeft, myPnt.y() ) + myYDistance/2 );
myPlot->setAxisScale( QwtPlot::xBottom,
myPlot->invTransform( QwtPlot::xBottom, myPnt.x() ) - myXDistance/2,
myPlot->invTransform( QwtPlot::xBottom, myPnt.x() ) + myXDistance/2 );
if (mySecondY)
myPlot->setAxisScale( QwtPlot::yRight,
- myPlot->invTransform( QwtPlot::yRight, myPnt.y() ) + myYDistance2/2,
- myPlot->invTransform( QwtPlot::yRight, myPnt.y() ) - myYDistance2/2 );
+ myPlot->invTransform( QwtPlot::yRight, myPnt.y() ) - myYDistance2/2,
+ myPlot->invTransform( QwtPlot::yRight, myPnt.y() ) + myYDistance2/2 );
myPlot->replot();
}
}
else {
- int btn = me.button() | me.state();
- if (btn == RightButton) {
+ int btn = me.button() | me.modifiers();
+ if (btn == Qt::RightButton) {
QMouseEvent* aEvent = new QMouseEvent(QEvent::MouseButtonPress,
- me.pos(), btn, me.state());
+ me.pos(), me.button(), me.buttons(), me.modifiers() );
// QMouseEvent 'me' has the 'MouseButtonDblClick' type. In this case we create new event 'aEvent'.
parent()->eventFilter(this, aEvent);
}
/*!
Slot, called when user moves mouse
*/
-void Plot2d_ViewFrame::plotMouseMoved( const QMouseEvent& me )
+bool Plot2d_ViewFrame::plotMouseMoved( const QMouseEvent& me )
{
int dx = me.pos().x() - myPnt.x();
int dy = me.pos().y() - myPnt.y();
+ bool aRes = false;
if ( myOperation != NoOpId) {
if ( myOperation == ZoomId ) {
this->incrementalZoom( dx, dy );
myPnt = me.pos();
+ aRes = true;
}
else if ( myOperation == PanId ) {
this->incrementalPan( dx, dy );
myPnt = me.pos();
+ aRes = true;
}
}
else {
if (aParent)
aParent->putInfo(getInfo(me.pos()));
}
+ return aRes;
}
/*!
Slot, called when user releases mouse
*/
void Plot2d_ViewFrame::plotMouseReleased( const QMouseEvent& me )
{
- if ( myOperation == NoOpId && me.button() == RightButton )
+ if ( myOperation == NoOpId && me.button() == Qt::RightButton && me.modifiers() != Qt::ControlModifier )
{
QContextMenuEvent aEvent( QContextMenuEvent::Mouse,
- me.pos(), me.globalPos(),
- me.state() );
+ me.pos(), me.globalPos() );
emit contextMenuRequested( &aEvent );
}
- if ( myOperation == FitAreaId ) {
- QRect rect( myPnt, me.pos() );
- fitArea( rect );
- }
myPlot->canvas()->setCursor( QCursor( Qt::CrossCursor ) );
- myPlot->setOutlineStyle( Qwt::Triangle );
+ myPlot->defaultPicker();
Plot2d_ViewWindow* aParent = dynamic_cast<Plot2d_ViewWindow*>(parent());
if (aParent)
double aDelta = event->delta();
double aScale = (aDelta < 0) ? 100./(-aDelta) : aDelta/100.;
- QwtDiMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
- QwtDiMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
+ QwtScaleMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
+ QwtScaleMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
- myPlot->setAxisScale( QwtPlot::yLeft,
- myPlot->invTransform( QwtPlot::yLeft, yMap.i1() ),
- myPlot->invTransform( QwtPlot::yLeft, yMap.i2() )*aScale );
- myPlot->setAxisScale( QwtPlot::xBottom,
- myPlot->invTransform( QwtPlot::xBottom, xMap.i1() ),
- myPlot->invTransform( QwtPlot::xBottom, xMap.i2() )*aScale );
+ myPlot->setAxisScale( QwtPlot::yLeft, yMap.s1(), yMap.s2()*aScale );
+ myPlot->setAxisScale( QwtPlot::xBottom, xMap.s1(), xMap.s2()*aScale );
if (mySecondY) {
- QwtDiMap y2Map = myPlot->canvasMap( QwtPlot::yRight );
- myPlot->setAxisScale( QwtPlot::yRight,
- myPlot->invTransform( QwtPlot::yRight, y2Map.i1() ),
- myPlot->invTransform( QwtPlot::yRight, y2Map.i2() )*aScale );
+ QwtScaleMap y2Map = myPlot->canvasMap( QwtPlot::yRight );
+ myPlot->setAxisScale( QwtPlot::yRight, y2Map.s1(), y2Map.s2()*aScale );
}
myPlot->replot();
myPnt = event->pos();
}
+
+/*!
+ Returns qwt plot curve if it is existed in map of curves and 0 otherwise
+*/
+QwtPlotCurve* Plot2d_ViewFrame::getPlotCurve( Plot2d_Curve* curve )
+{
+ CurveDict::iterator it = myPlot->getCurves().begin();
+ for ( ; it != myPlot->getCurves().end(); it++ ) {
+ if ( it.value() == curve )
+ return it.key();
+ }
+ return 0;
+}
+/*!
+ Returns true if qwt plot curve is existed in map of curves and false otherwise
+*/
+bool Plot2d_ViewFrame::hasPlotCurve( Plot2d_Curve* curve )
+{
+ CurveDict::iterator it = myPlot->getCurves().begin();
+ for ( ; it != myPlot->getCurves().end(); it++ ) {
+ if ( it.value() == curve )
+ return true;
+ }
+ return false;
+}
+
+/*!
+ Sets curve type
+*/
+void Plot2d_ViewFrame::setCurveType( QwtPlotCurve* curve, int curveType )
+{
+ if ( !curve )
+ return;
+ if ( myCurveType == 0 )
+ curve->setStyle( QwtPlotCurve::Dots );//QwtCurve::NoCurve
+ else if ( myCurveType == 1 ) {
+ curve->setStyle( QwtPlotCurve::Lines );
+ curve->setCurveAttribute( QwtPlotCurve::Fitted, false );
+ }
+ else if ( myCurveType == 2 ) {
+ curve->setStyle( QwtPlotCurve::Lines );
+ QwtSplineCurveFitter* fitter = new QwtSplineCurveFitter();
+ fitter->setSplineSize( 250 );
+ curve->setCurveAttribute( QwtPlotCurve::Fitted, true );
+ curve->setCurveFitter( fitter );
+ }
+}
+
/*!
View operations : Pan view
*/
QCursor panCursor (Qt::SizeAllCursor);
myPlot->canvas()->setCursor( panCursor );
myOperation = PanId;
- qApp->installEventFilter( this );
}
/*!
View operations : Zoom view
QCursor zoomCursor (zoomPixmap);
myPlot->canvas()->setCursor( zoomCursor );
myOperation = ZoomId;
- qApp->installEventFilter( this );
}
/*!
View operations : Fot All
{
myPlot->canvas()->setCursor( QCursor( Qt::PointingHandCursor ) );
myOperation = FitAreaId;
- qApp->installEventFilter( this );
+ myPlot->setPickerMousePattern( Qt::LeftButton );
}
/*!
View operations : Global panning
QPixmap globalPanPixmap (imageCrossCursor);
QCursor glPanCursor (globalPanPixmap);
myPlot->canvas()->setCursor( glPanCursor );
- myPlot->changeAxisOptions( QwtPlot::xBottom, QwtAutoScale::Logarithmic, false );
- myPlot->changeAxisOptions( QwtPlot::yLeft, QwtAutoScale::Logarithmic, false );
+ myPlot->setLogScale(QwtPlot::xBottom, false);
+ myPlot->setLogScale(QwtPlot::yLeft, false);
if (mySecondY)
- myPlot->changeAxisOptions( QwtPlot::yRight, QwtAutoScale::Logarithmic, false );
+ myPlot->setLogScale(QwtPlot::yRight, false);
myPlot->replot();
- QwtDiMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
- QwtDiMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
+ QwtScaleMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
+ QwtScaleMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
- myXDistance = xMap.d2() - xMap.d1();
- myYDistance = yMap.d2() - yMap.d1();
+ myXDistance = xMap.s2() - xMap.s1();
+ myYDistance = yMap.s2() - yMap.s1();
if (mySecondY) {
- QwtDiMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
- myYDistance2 = yMap2.d2() - yMap2.d1();
+ QwtScaleMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
+ myYDistance2 = yMap2.s2() - yMap2.s1();
}
fitAll();
myOperation = GlPanId;
- qApp->installEventFilter( this );
}
/*!
bool Plot2d_ViewFrame::isXLogEnabled() const
{
bool allPositive = true;
- QIntDictIterator<Plot2d_Curve> it( myCurves );
- for ( ; allPositive && it.current(); ++it ) {
- allPositive = ( it.current()->getMinX() > 0. );
- }
+ CurveDict::const_iterator it = myPlot->getCurves().begin();
+ for ( ; allPositive && it != myPlot->getCurves().end(); it++ )
+ allPositive = ( it.value()->getMinX() > 0. );
return allPositive;
}
bool Plot2d_ViewFrame::isYLogEnabled() const
{
bool allPositive = true;
- QIntDictIterator<Plot2d_Curve> it( myCurves );
- for ( ; allPositive && it.current(); ++it ) {
- allPositive = ( it.current()->getMinY() > 0. );
- }
+ CurveDict::const_iterator it = myPlot->getCurves().begin();
+ for ( ; allPositive && it != myPlot->getCurves().end(); it++ )
+ allPositive = ( it.value()->getMinY() > 0. );
return allPositive;
}
+class Plot2d_QwtPlotZoomer : public QwtPlotZoomer
+{
+public:
+ Plot2d_QwtPlotZoomer( int xAxis, int yAxis, QwtPlotCanvas* canvas )
+ : QwtPlotZoomer( xAxis, yAxis, canvas )
+ {
+ qApp->installEventFilter( this );
+ // now picker working after only a button pick.
+ // after click on button FitArea in toolbar of the ViewFrame.
+ };
+ ~Plot2d_QwtPlotZoomer() {};
+};
+
/*!
Constructor
*/
Plot2d_Plot2d::Plot2d_Plot2d( QWidget* parent )
- : QwtPlot( parent )
-{
- // outline
- enableOutline( true );
- setOutlineStyle( Qwt::Triangle );
- setOutlinePen( green );
- // legend
- setAutoLegend( false );
- setLegendFrameStyle( QFrame::Box | QFrame::Sunken );
- enableLegend( false );
- // grid
- enableGridX( false );
- enableGridXMin( false );
- enableGridY( false );
- enableGridYMin( false );
+ : QwtPlot( parent ),
+ myIsPolished( false )
+{
+ myPlotZoomer = new Plot2d_QwtPlotZoomer( QwtPlot::xBottom, QwtPlot::yLeft, canvas() );
+ myPlotZoomer->setSelectionFlags( QwtPicker::DragSelection | QwtPicker::CornerToCorner );
+ myPlotZoomer->setTrackerMode( QwtPicker::AlwaysOff );
+ myPlotZoomer->setRubberBand( QwtPicker::RectRubberBand );
+ myPlotZoomer->setRubberBandPen( QColor( Qt::green ) );
+
+ defaultPicker();
+
// auto scaling by default
setAxisAutoScale( QwtPlot::yLeft );
setAxisAutoScale( QwtPlot::yRight );
setAxisAutoScale( QwtPlot::xBottom );
+
+// grid
+ myGrid = new QwtPlotGrid();
+ QPen aMajPen = myGrid->majPen();
+ aMajPen.setStyle( Qt::DashLine );
+ myGrid->setPen( aMajPen );
+
+ myGrid->enableX( false );
+ myGrid->enableXMin( false );
+ myGrid->enableY( false );
+ myGrid->enableYMin( false );
+
+ myGrid->attach( this );
+
+ setMouseTracking( false );
+ canvas()->setMouseTracking( true );
+
+ myPlotZoomer->setEnabled( true );
}
+
+/*!
+ \set axis scale engine - linear or log10
+*/
+void Plot2d_Plot2d::setLogScale( int axisId, bool log10 )
+{
+ if ( log10 )
+ setAxisScaleEngine( axisId, new QwtLog10ScaleEngine() );
+ else
+ setAxisScaleEngine( axisId, new QwtLinearScaleEngine() );
+}
+
/*!
Recalculates and redraws Plot 2d view
*/
// QSize aSize = QwtPlot::minimumSizeHint();
// return QSize(aSize.width()*3/4, aSize.height());
}
+
+void Plot2d_Plot2d::defaultPicker()
+{
+ myPlotZoomer->setMousePattern( QwtEventPattern::MouseSelect1,
+ Qt::RightButton, Qt::ControlModifier ); // zooming button
+ for ( int i = QwtEventPattern::MouseSelect2; i < QwtEventPattern::MouseSelect6; i++ )
+ myPlotZoomer->setMousePattern( i, Qt::NoButton, Qt::NoButton );
+}
+
+void Plot2d_Plot2d::setPickerMousePattern( int button, int state )
+{
+ myPlotZoomer->setMousePattern( QwtEventPattern::MouseSelect1, button, state );
+}
+
+/*!
+ return closest curve if it exist, else 0
+*/
+Plot2d_Curve* Plot2d_Plot2d::getClosestCurve( QPoint p, double& distance, int& index )
+{
+ CurveDict::iterator it = getCurves().begin();
+ QwtPlotCurve* aCurve;
+ for ( ; it != getCurves().end(); it++ ) {
+ aCurve = it.key();
+ if ( !aCurve )
+ continue;
+ index = aCurve->closestPoint( p, &distance );
+ if ( index > -1 )
+ return it.value();
+ }
+ return 0;
+}
+
/*!
Checks if marker belongs to any enitity
*/
bool Plot2d_Plot2d::existMarker( const QwtSymbol::Style typeMarker, const QColor& color, const Qt::PenStyle typeLine )
{
- // getting all curves
- QArray<long> keys = curveKeys();
- //QColor aRgbColor;
-
- if ( closeColors( color, backgroundColor() ) )
+ QColor aColor = palette().color( QPalette::Background );
+ if ( closeColors( color, aColor ) )
return true;
- for ( int i = 0; i < (int)keys.count(); i++ )
- {
- QwtPlotCurve* crv = curve( keys[i] );
+
+ CurveDict::iterator it = myCurves.begin();
+ for ( ; it != myCurves.end(); it++ ) {
+ QwtPlotCurve* crv = it.key();
if ( crv ) {
QwtSymbol::Style aStyle = crv->symbol().style();
QColor aColor = crv->pen().color();
Qt::PenStyle aLine = crv->pen().style();
// if ( aStyle == typeMarker && aColor == color && aLine == typeLine )
if ( aStyle == typeMarker && closeColors( aColor,color ) && aLine == typeLine )
- return true;
+ return true;
}
}
return false;
}
+/*!
+ Sets the flag saying that QwtPlot geometry has been fully defined.
+*/
+void Plot2d_Plot2d::polish()
+{
+ QwtPlot::polish();
+ myIsPolished = true;
+}
+
+
/*!
Creates presentation of object
Default implementation is empty
#define BRACKETIZE(x) QString( "[ " ) + x + QString( " ]" )
void Plot2d_ViewFrame::updateTitles()
{
- QIntDictIterator<Plot2d_Curve> it( myCurves );
+ CurveDict::iterator it = myPlot->getCurves().begin();
+ //QIntDictIterator<Plot2d_Curve> it( myCurves );
QStringList aXTitles;
QStringList aYTitles;
QStringList aXUnits;
QStringList aYUnits;
QStringList aTables;
int i = 0;
- while ( it.current() ) {
+
+ Plot2d_Curve* aCurve;
+ for ( ; it != myPlot->getCurves().end(); it++ ) {
// collect titles and units from all curves...
- QString xTitle = it.current()->getHorTitle().stripWhiteSpace();
- QString yTitle = it.current()->getVerTitle().stripWhiteSpace();
- QString xUnits = it.current()->getHorUnits().stripWhiteSpace();
- QString yUnits = it.current()->getVerUnits().stripWhiteSpace();
+ aCurve = it.value();
+ QString xTitle = aCurve->getHorTitle().trimmed();
+ QString yTitle = aCurve->getVerTitle().trimmed();
+ QString xUnits = aCurve->getHorUnits().trimmed();
+ QString yUnits = aCurve->getVerUnits().trimmed();
aYTitles.append( yTitle );
- if ( aXTitles.find( xTitle ) == aXTitles.end() )
+ if ( !aXTitles.contains( xTitle ) )
aXTitles.append( xTitle );
- if ( aXUnits.find( xUnits ) == aXUnits.end() )
+ if ( !aXUnits.contains( xUnits ) )
aXUnits.append( xUnits );
- if ( aYUnits.find( yUnits ) == aYUnits.end() )
+ if ( !aYUnits.contains( yUnits ) )
aYUnits.append( yUnits );
- QString aName = it.current()->getTableTitle();
- if( !aName.isEmpty() && aTables.find( aName ) == aTables.end() )
+ QString aName = aCurve->getTableTitle();
+ if( !aName.isEmpty() && !aTables.contains( aName ) )
aTables.append( aName );
-
- ++it;
++i;
}
// ... and update plot 2d view
{
QPrinter* pr = new QPrinter( QPrinter::HighResolution );
pr->setPageSize( QPrinter::A4 );
- pr->setOutputToFile( true );
pr->setOutputFileName( file );
pr->setPrintProgram( "" );
pd = pr;
*/
void Plot2d_ViewFrame::setVisualParameters( const QString& parameters )
{
- QStringList paramsLst = QStringList::split( '*', parameters, true );
+ QStringList paramsLst = parameters.split( '*' );
if ( paramsLst.size() == 9 ) {
double xmin, xmax, ymin, ymax, y2min, y2max;
myXMode = paramsLst[0].toInt();
setVerScaleMode( myYMode, /*update=*/false );
if (mySecondY) {
- QwtDiMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
- myYDistance2 = yMap2.d2() - yMap2.d1();
+ QwtScaleMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
+ myYDistance2 = yMap2.s2() - yMap2.s1();
}
fitData( 0, xmin, xmax, ymin, ymax, y2min, y2max );
Incremental zooming operation
*/
void Plot2d_ViewFrame::incrementalPan( const int incrX, const int incrY ) {
- QwtDiMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
- QwtDiMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
+ QwtScaleMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
+ QwtScaleMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
myPlot->setAxisScale( QwtPlot::yLeft,
- myPlot->invTransform( QwtPlot::yLeft, yMap.i1()-incrY ),
- myPlot->invTransform( QwtPlot::yLeft, yMap.i2()-incrY ) );
+ myPlot->invTransform( QwtPlot::yLeft, yMap.transform( yMap.s1() )-incrY ),
+ myPlot->invTransform( QwtPlot::yLeft, yMap.transform( yMap.s2() )-incrY ) );
myPlot->setAxisScale( QwtPlot::xBottom,
- myPlot->invTransform( QwtPlot::xBottom, xMap.i1()-incrX ),
- myPlot->invTransform( QwtPlot::xBottom, xMap.i2()-incrX ) );
+ myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.s1() )-incrX ),
+ myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.s2() )-incrX ) );
if (mySecondY) {
- QwtDiMap y2Map = myPlot->canvasMap( QwtPlot::yRight );
+ QwtScaleMap y2Map = myPlot->canvasMap( QwtPlot::yRight );
myPlot->setAxisScale( QwtPlot::yRight,
- myPlot->invTransform( QwtPlot::yRight, y2Map.i1()-incrY ),
- myPlot->invTransform( QwtPlot::yRight, y2Map.i2()-incrY ) );
+ myPlot->invTransform( QwtPlot::yRight, y2Map.transform( y2Map.s1() )-incrY ),
+ myPlot->invTransform( QwtPlot::yRight, y2Map.transform( y2Map.s2() )-incrY ) );
}
myPlot->replot();
}
Incremental panning operation
*/
void Plot2d_ViewFrame::incrementalZoom( const int incrX, const int incrY ) {
- QwtDiMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
- QwtDiMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
+ QwtScaleMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
+ QwtScaleMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
- myPlot->setAxisScale( QwtPlot::yLeft,
- myPlot->invTransform( QwtPlot::yLeft, yMap.i1() ),
- myPlot->invTransform( QwtPlot::yLeft, yMap.i2() + incrY ) );
- myPlot->setAxisScale( QwtPlot::xBottom,
- myPlot->invTransform( QwtPlot::xBottom, xMap.i1() ),
- myPlot->invTransform( QwtPlot::xBottom, xMap.i2() - incrX ) );
+ myPlot->setAxisScale( QwtPlot::yLeft, yMap.s1(),
+ myPlot->invTransform( QwtPlot::yLeft, yMap.transform( yMap.s2() ) + incrY ) );
+ myPlot->setAxisScale( QwtPlot::xBottom, xMap.s1(),
+ myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.s2() ) - incrX ) );
if (mySecondY) {
- QwtDiMap y2Map = myPlot->canvasMap( QwtPlot::yRight );
- myPlot->setAxisScale( QwtPlot::yRight,
- myPlot->invTransform( QwtPlot::yRight, y2Map.i1() ),
- myPlot->invTransform( QwtPlot::yRight, y2Map.i2() + incrY ) );
+ QwtScaleMap y2Map = myPlot->canvasMap( QwtPlot::yRight );
+ myPlot->setAxisScale( QwtPlot::yRight, y2Map.s1(),
+ myPlot->invTransform( QwtPlot::yRight, y2Map.transform( y2Map.s2() ) + incrY ) );
}
myPlot->replot();
}
{
this->incrementalZoom( -INCREMENT_FOR_OP, -INCREMENT_FOR_OP );
}
+
+/*!
+ Schedules a FitAll operation by putting it to the application's
+ event queue. This ensures that other important events (show, resize, etc.)
+ are processed first.
+*/
+void Plot2d_ViewFrame::customEvent( QEvent* ce )
+{
+ if ( ce->type() == FITALL_EVENT )
+ fitAll();
+}
#define PLOT2D_VIEWFRAME_H
#include "Plot2d_Curve.h"
-#include <qwidget.h>
-#include <qintdict.h>
+#include <QWidget>
+#include <QMultiHash>
+#include <QList>
+#include <qwt_symbol.h>
class Plot2d_Plot2d;
class Plot2d_Prs;
+class QCustomEvent;
+class QwtPlotCurve;
+class QwtPlotGrid;
+class QwtPlotZoomer;
-typedef QIntDict<Plot2d_Curve> CurveDict;
+typedef QMultiHash<QwtPlotCurve*, Plot2d_Curve*> CurveDict;
class PLOT2D_EXPORT Plot2d_ViewFrame : public QWidget
{
void Erase( const Plot2d_Prs*, const bool = false );
Plot2d_Prs* CreatePrs( const char* entry = 0 );
+ virtual bool eventFilter(QObject* watched, QEvent* e);
+
/* operations */
void updateTitles();
void setTitle( const QString& title );
void eraseCurve( Plot2d_Curve* curve, bool update = false );
void eraseCurves( const curveList& curves, bool update = false );
int getCurves( curveList& clist );
- const CurveDict& getCurves() { return myCurves; }
- int hasCurve( Plot2d_Curve* curve );
+ const CurveDict& getCurves();
bool isVisible( Plot2d_Curve* curve );
void updateCurve( Plot2d_Curve* curve, bool update = false );
void updateLegend( const Plot2d_Prs* prs );
void copyPreferences( Plot2d_ViewFrame* );
void setCurveType( int curveType, bool update = true );
int getCurveType() const { return myCurveType; }
- void setCurveTitle( int curveKey, const QString& title );
+ void setCurveTitle( Plot2d_Curve* curve, const QString& title );
void showLegend( bool show, bool update = true );
void setLegendPos( int pos );
int getLegendPos() const { return myLegendPos; }
void writePreferences();
QString getInfo( const QPoint& pnt );
virtual void wheelEvent( QWheelEvent* );
+ QwtPlotCurve* getPlotCurve( Plot2d_Curve* curve );
+ bool hasPlotCurve( Plot2d_Curve* curve );
+ void setCurveType( QwtPlotCurve* curve, int curveType );
public slots:
void onViewPan();
void onZoomIn();
void onZoomOut();
-protected slots:
+protected:
+ virtual void customEvent( QEvent* );
void plotMousePressed( const QMouseEvent& );
- void plotMouseMoved( const QMouseEvent& );
+ bool plotMouseMoved( const QMouseEvent& );
void plotMouseReleased( const QMouseEvent& );
signals:
Plot2d_Plot2d* myPlot;
int myOperation;
QPoint myPnt;
- CurveDict myCurves;
int myCurveType;
bool myShowLegend;
class Plot2d_Plot2d : public QwtPlot
{
+ Q_OBJECT
public:
Plot2d_Plot2d( QWidget* parent );
+ void setLogScale( int axisId, bool log10 );
+
void replot();
void getNextMarker( QwtSymbol::Style& typeMarker, QColor& color, Qt::PenStyle& typeLine );
QwtLegend* getLegend() {
virtual QSize sizeHint() const;
virtual QSizePolicy sizePolicy() const;
virtual QSize minimumSizeHint() const;
+ void defaultPicker();
+ void setPickerMousePattern( int button, int state = Qt::NoButton );
+
+ bool polished() const { return myIsPolished; }
+ QwtPlotGrid* grid() { return myGrid; };
+ CurveDict& getCurves() { return myCurves; }
+ Plot2d_Curve* getClosestCurve( QPoint p, double& distance, int& index );
+
+public slots:
+ virtual void polish();
protected:
bool existMarker( const QwtSymbol::Style typeMarker, const QColor& color, const Qt::PenStyle typeLine );
protected:
- QValueList<QColor> myColors;
+ CurveDict myCurves;
+ QwtPlotGrid* myGrid;
+ QList<QColor> myColors;
+ bool myIsPolished;
+ QwtPlotZoomer* myPlotZoomer;
};
#endif
#include "Plot2d_ViewFrame.h"
#include "Plot2d_Prs.h"
-#include <qpopupmenu.h>
+#include <QMenu>
+#include <QToolBar>
+#include <QVector>
/*!
Constructor
Adds custom items to popup menu
\param thePopup - popup menu
*/
-void Plot2d_Viewer::contextMenuPopup(QPopupMenu* thePopup)
+void Plot2d_Viewer::contextMenuPopup(QMenu* thePopup)
{
Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)(myViewManager->getActiveView());
if ( aView )
aView->contextMenuPopup(thePopup);
- if (thePopup->count() > 0) thePopup->insertSeparator();
- thePopup->insertItem( tr( "MNU_DUMP_VIEW" ), this, SLOT(onDumpView()));
- thePopup->insertItem( tr( "MEN_PLOT2D_CHANGE_BACKGROUND" ), this, SLOT(onChangeBgColor()));
+ if (!thePopup->isEmpty())
+ thePopup->addSeparator();
+ thePopup->addAction( tr( "MNU_DUMP_VIEW" ), this, SLOT(onDumpView()));
+ thePopup->addAction( tr( "MEN_PLOT2D_CHANGE_BACKGROUND" ), this, SLOT(onChangeBgColor()));
if ( aView ) {
if ( !aView->getToolBar()->isVisible() ) {
- if (thePopup->count() > 0) thePopup->insertSeparator();
- thePopup->insertItem("Show toolbar", this, SLOT(onShowToolbar()));
+ if (!thePopup->isEmpty())
+ thePopup->addSeparator();
+ thePopup->addAction("Show toolbar", this, SLOT(onShowToolbar()));
}
aView->RefreshDumpImage();
}
void Plot2d_Viewer::update()
{
SUIT_ViewManager* aMgr = getViewManager();
- QPtrVector<SUIT_ViewWindow> aViews = aMgr->getViews();
+ QVector<SUIT_ViewWindow*> aViews = aMgr->getViews();
unsigned int aSize = aViews.size();
for (uint i = 0; i < aSize; i++) {
Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)aViews[i];
void Plot2d_Viewer::clearPrs()
{
SUIT_ViewManager* aMgr = getViewManager();
- QPtrVector<SUIT_ViewWindow> aViews = aMgr->getViews();
+ QVector<SUIT_ViewWindow*> aViews = aMgr->getViews();
unsigned int aSize = aViews.size();
for (uint i = 0; i < aSize; i++) {
Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)aViews[i];
class Plot2d_ViewFrame;
class Plot2d_Prs;
class QString;
-class QPopupMenu;
+class QMenu;
class PLOT2D_EXPORT Plot2d_Viewer: public SUIT_ViewModel
{
virtual void setViewManager( SUIT_ViewManager* );
virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
virtual QString getType() const { return Type(); }
- virtual void contextMenuPopup(QPopupMenu*);
+ virtual void contextMenuPopup(QMenu*);
Plot2d_Prs* getPrs() const { return myPrs; };
void setPrs(Plot2d_Prs* thePrs);
void update();
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// Plot2d_ViewWindow.cxx: implementation of the Plot2d_ViewWindow class.
+// File : Plot2d_ViewWindow.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
#include "Plot2d_ViewWindow.h"
#include "Plot2d_ViewFrame.h"
-#include "SUIT_ViewManager.h"
-#include "SUIT_ResourceMgr.h"
-#include "SUIT_Session.h"
-#include "SUIT_ToolButton.h"
-#include "SUIT_Desktop.h"
+#include <SUIT_ViewManager.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+#include <SUIT_Desktop.h>
+
+#include <QtxAction.h>
+#include <QtxMultiAction.h>
-#include "QtxAction.h"
+#include <QStatusBar>
+#include <QLayout>
+#include <QApplication>
+#include <QMenu>
+#include <QImage>
+#include <QToolBar>
+#include <QPaintEvent>
+#include <QActionGroup>
-#include <qstatusbar.h>
-#include <qlayout.h>
-#include <qapplication.h>
-#include <qpopupmenu.h>
+/*!
+ \class Plot2d_ViewWindow
+ \brief Plot2d view window.
+*/
/*!
- Constructor
+ \brief Constructor.
+ \param theDesktop parent desktop window
+ \param theModel plt2d view model
*/
-Plot2d_ViewWindow::Plot2d_ViewWindow(SUIT_Desktop* theDesktop, Plot2d_Viewer* theModel)
-: SUIT_ViewWindow(theDesktop)
+Plot2d_ViewWindow::Plot2d_ViewWindow( SUIT_Desktop* theDesktop, Plot2d_Viewer* theModel )
+: SUIT_ViewWindow( theDesktop )
{
myModel = theModel;
-
myDumpImage = QImage();
- myViewFrame = new Plot2d_ViewFrame(this, "plotView");
- setCentralWidget(myViewFrame);
+ myViewFrame = new Plot2d_ViewFrame( this, "plotView" );
+ setCentralWidget( myViewFrame );
+
+ myToolBar = addToolBar( tr("LBL_TOOLBAR_LABEL") );
- myToolBar = new QToolBar(this);
- myToolBar->setCloseMode(QDockWindow::Undocked);
- myToolBar->setLabel(tr("LBL_TOOLBAR_LABEL"));
createActions();
createToolBar();
- connect(myViewFrame, SIGNAL(vpModeHorChanged()), this, SLOT(onChangeHorMode()));
- connect(myViewFrame, SIGNAL(vpModeVerChanged()), this, SLOT(onChangeVerMode()));
- connect(myViewFrame, SIGNAL(vpCurveChanged()), this, SLOT(onChangeCurveMode()));
- connect(myViewFrame, SIGNAL(contextMenuRequested( QContextMenuEvent * )),
- this, SIGNAL(contextMenuRequested( QContextMenuEvent * )) );
+ connect( myViewFrame, SIGNAL( vpModeHorChanged() ), this, SLOT( onChangeHorMode() ) );
+ connect( myViewFrame, SIGNAL( vpModeVerChanged() ), this, SLOT( onChangeVerMode() ) );
+ connect( myViewFrame, SIGNAL( vpCurveChanged() ), this, SLOT( onChangeCurveMode() ) );
+ connect( myViewFrame, SIGNAL( contextMenuRequested( QContextMenuEvent* ) ),
+ this, SIGNAL( contextMenuRequested( QContextMenuEvent* ) ) );
+ myViewFrame->installEventFilter( this );
}
/*!
- Destructor
+ \brief Destructor.
*/
Plot2d_ViewWindow::~Plot2d_ViewWindow()
{
}
/*!
- Puts message to status bar
- \param theMsg - message text
+ \brief Get view model.
+ \return Plot2d view model
+*/
+Plot2d_Viewer* Plot2d_ViewWindow::getModel()
+{
+ return myModel;
+}
+
+/*!
+ \brief Put message to the status bar.
+ \param theMsg message text
*/
-void Plot2d_ViewWindow::putInfo(QString theMsg)
+void Plot2d_ViewWindow::putInfo( const QString& theMsg )
{
- QStatusBar* aStatusBar = myDesktop->statusBar();
- aStatusBar->message(theMsg/*, 3000*/);
+ QStatusBar* aStatusBar = myDesktop->statusBar();
+ aStatusBar->showMessage( theMsg/*, 3000*/ );
}
/*!
- Fills popup menu with custom actions
- \param popup - popup menu to be filled with
+ \brief Get view frame window.
+ \return view frame window
*/
-void Plot2d_ViewWindow::contextMenuPopup( QPopupMenu* thePopup )
+Plot2d_ViewFrame* Plot2d_ViewWindow::getViewFrame()
+{
+ return myViewFrame;
+}
+
+/*!
+ \brief Get view window's toolbar.
+ \return toolbar
+*/
+QToolBar* Plot2d_ViewWindow::getToolBar()
+{
+ return myToolBar;
+}
+
+/*!
+ \brief Fill popup menu with the actions,
+ \param thePopup popup menu
+*/
+void Plot2d_ViewWindow::contextMenuPopup( QMenu* thePopup )
{
// scaling
- QPopupMenu* scalingPopup = new QPopupMenu( thePopup );
- myActionsMap[ PModeXLinearId ]->addTo( scalingPopup );
- myActionsMap[ PModeXLogarithmicId ]->addTo( scalingPopup );
- onChangeHorMode();
- scalingPopup->insertSeparator();
- myActionsMap[ PModeYLinearId ]->addTo( scalingPopup );
- myActionsMap[ PModeYLogarithmicId ]->addTo( scalingPopup );
- thePopup->insertItem( tr( "SCALING_POPUP" ), scalingPopup );
- onChangeVerMode();
+ QMenu* scalingPopup = thePopup->addMenu( tr( "SCALING_POPUP" ) );
+ scalingPopup->addAction( myActionsMap[ PModeXLinearId ] );
+ scalingPopup->addAction( myActionsMap[ PModeXLogarithmicId ] );
+ scalingPopup->addSeparator();
+ scalingPopup->addAction( myActionsMap[ PModeYLinearId ] );
+ scalingPopup->addAction( myActionsMap[ PModeYLogarithmicId ] );
+
+ // fit data
+ thePopup->addAction( tr( "TOT_PLOT2D_FITDATA" ), myViewFrame, SLOT( onFitData() ) );
- thePopup->insertItem(tr("TOT_PLOT2D_FITDATA"), myViewFrame, SLOT(onFitData()));
// curve type
- QPopupMenu* curTypePopup = new QPopupMenu( thePopup );
- myActionsMap[ CurvPointsId ]->addTo( curTypePopup );
- myActionsMap[ CurvLinesId ]->addTo( curTypePopup );
- myActionsMap[ CurvSplinesId ]->addTo( curTypePopup );
- thePopup->insertItem( tr( "CURVE_TYPE_POPUP" ), curTypePopup );
+ QMenu* curTypePopup = thePopup->addMenu( tr( "CURVE_TYPE_POPUP" ) );
+ curTypePopup->addAction( myActionsMap[ CurvPointsId ] );
+ curTypePopup->addAction( myActionsMap[ CurvLinesId ] );
+ curTypePopup->addAction( myActionsMap[ CurvSplinesId ] );
// legend
- myActionsMap[ LegendId ]->addTo(thePopup);
+ thePopup->addAction( myActionsMap[ LegendId ] );
+
// settings
- myActionsMap[ CurvSettingsId ]->addTo(thePopup);
+ thePopup->addAction( myActionsMap[ CurvSettingsId ] );
}
/*!
- Custom event filter
+ \brief Custom event filter.
+ \param watched event receiver object
+ \param e event
+ \return \c true if further event processing should be stopped
*/
-bool Plot2d_ViewWindow::eventFilter(QObject* watched, QEvent* e)
+bool Plot2d_ViewWindow::eventFilter( QObject* watched, QEvent* e )
{
- if (watched == myViewFrame) {
- int aType = e->type();
- switch(aType) {
+ if ( watched == myViewFrame ) {
+ switch( e->type() ) {
case QEvent::MouseButtonPress:
- emit mousePressed(this, (QMouseEvent*) e);
+ emit mousePressed( this, (QMouseEvent*)e );
return true;
-
case QEvent::MouseButtonRelease:
- emit mouseReleased(this, (QMouseEvent*) e);
+ emit mouseReleased( this, (QMouseEvent*)e );
return true;
-
case QEvent::MouseMove:
- emit mouseMoving(this, (QMouseEvent*) e);
+ emit mouseMoving( this, (QMouseEvent*)e );
return true;
-
default:
break;
}
}
- return SUIT_ViewWindow::eventFilter(watched, e);
+ return SUIT_ViewWindow::eventFilter( watched, e );
}
/*!
- Create actions for Plot2d view window
+ \brief Create actions for the view window.
*/
void Plot2d_ViewWindow::createActions()
{
QtxAction* aAction;
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- // Dump view
- aAction = new QtxAction(tr("MNU_DUMP_VIEW"), aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_DUMP" ) ),
- tr( "MNU_DUMP_VIEW" ), 0, this);
- aAction->setStatusTip(tr("DSC_DUMP_VIEW"));
- connect(aAction, SIGNAL(activated()), this, SLOT(onDumpView()));
+ // 1. Dump View
+ aAction = new QtxAction( tr( "MNU_DUMP_VIEW" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_DUMP" ) ),
+ tr( "MNU_DUMP_VIEW" ),
+ 0, this);
+ aAction->setStatusTip( tr( "DSC_DUMP_VIEW" ) );
+ connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onDumpView() ) );
myActionsMap[ DumpId ] = aAction;
- // FitAll
- aAction = new QtxAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_FIT_ALL" ) ),
- tr( "MNU_FITALL" ), 0, this);
- aAction->setStatusTip(tr("DSC_FITALL"));
- connect(aAction, SIGNAL(activated()), this, SLOT(onFitAll()));
+ // 2. Scaling operations
+
+ // 2.1. Fit All
+ aAction = new QtxAction( tr( "MNU_FITALL" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_FIT_ALL" ) ),
+ tr( "MNU_FITALL" ),
+ 0, this);
+ aAction->setStatusTip( tr( "DSC_FITALL" ) );
+ connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onFitAll() ) );
myActionsMap[ FitAllId ] = aAction;
- // FitRect
- aAction = new QtxAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_FIT_AREA" ) ),
- tr( "MNU_FITRECT" ), 0, this);
- aAction->setStatusTip(tr("DSC_FITRECT"));
- connect(aAction, SIGNAL(activated()), this, SLOT(onFitRect()));
+ // 2.2. Fit Rect
+ aAction = new QtxAction( tr( "MNU_FITRECT" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_FIT_AREA" ) ),
+ tr( "MNU_FITRECT" ),
+ 0, this);
+ aAction->setStatusTip( tr( "DSC_FITRECT" ) );
+ connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onFitRect() ) );
myActionsMap[ FitRectId ] = aAction;
- // Zoom
- aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_ZOOM" ) ),
- tr( "MNU_ZOOM_VIEW" ), 0, this);
- aAction->setStatusTip(tr("DSC_ZOOM_VIEW"));
- connect(aAction, SIGNAL(activated()), this, SLOT(onZoom()));
+ // 2.3. Zoom
+ aAction = new QtxAction( tr( "MNU_ZOOM_VIEW" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_ZOOM" ) ),
+ tr( "MNU_ZOOM_VIEW" ),
+ 0, this);
+ aAction->setStatusTip( tr( "DSC_ZOOM_VIEW" ) );
+ connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onZoom() ) );
myActionsMap[ ZoomId ] = aAction;
- // Panning
- aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_PAN" ) ),
- tr( "MNU_PAN_VIEW" ), 0, this);
- aAction->setStatusTip(tr("DSC_PAN_VIEW"));
- connect(aAction, SIGNAL(activated()), this, SLOT(onPanning()));
+ // 2.4. Create multi-action for scaling operations
+ QtxMultiAction* aScaleAction = new QtxMultiAction( this );
+ aScaleAction->insertAction( myActionsMap[ FitAllId ] );
+ aScaleAction->insertAction( myActionsMap[ FitRectId ] );
+ aScaleAction->insertAction( myActionsMap[ ZoomId ] );
+ myActionsMap[ ScaleOpId ] = aScaleAction;
+
+ // 3. Moving operations
+
+ // 3.1. Panning
+ aAction = new QtxAction( tr( "MNU_PAN_VIEW" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_PAN" ) ),
+ tr( "MNU_PAN_VIEW" ),
+ 0, this);
+ aAction->setStatusTip( tr( "DSC_PAN_VIEW" ) );
+ connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onPanning() ) );
myActionsMap[ PanId ] = aAction;
- // Global Panning
- aAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_GLOBALPAN" ) ),
- tr( "MNU_GLOBALPAN_VIEW" ), 0, this);
- aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW"));
- connect(aAction, SIGNAL(activated()), this, SLOT(onGlobalPanning()));
+ // 3.2. Global Panning
+ aAction = new QtxAction( tr( "MNU_GLOBALPAN_VIEW" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_GLOBALPAN" ) ),
+ tr( "MNU_GLOBALPAN_VIEW" ),
+ 0, this);
+ aAction->setStatusTip( tr( "DSC_GLOBALPAN_VIEW" ) );
+ connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onGlobalPanning() ) );
myActionsMap[ GlobalPanId ] = aAction;
- // Curve type - points
- aAction = new QtxAction(tr("TOT_PLOT2D_CURVES_POINTS"),
- aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_CURVES_POINTS")),
- tr("MEN_PLOT2D_CURVES_POINTS"), 0, this);
- aAction->setStatusTip(tr("PRP_PLOT2D_CURVES_POINTS"));
- connect(aAction, SIGNAL(activated()), this, SLOT(onCurves()));
- aAction->setToggleAction(true);
+ // 3.3. Create multi-action for moving operations
+ QtxMultiAction* aPanAction = new QtxMultiAction( this );
+ aPanAction->insertAction( myActionsMap[ PanId ] );
+ aPanAction->insertAction( myActionsMap[ GlobalPanId ] );
+ myActionsMap[ MoveOpId ] = aPanAction;
+
+ // 4. Curve type operations
+
+ // 4.1. Points
+ aAction = new QtxAction( tr( "TOT_PLOT2D_CURVES_POINTS" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CURVES_POINTS" ) ),
+ tr( "MEN_PLOT2D_CURVES_POINTS" ),
+ 0, this );
+ aAction->setStatusTip( tr( "PRP_PLOT2D_CURVES_POINTS" ) );
+ aAction->setCheckable( true );
myActionsMap[ CurvPointsId ] = aAction;
- // Curve type - lines
- aAction = new QtxAction(tr("TOT_PLOT2D_CURVES_LINES"),
- aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_CURVES_LINES")),
- tr("MEN_PLOT2D_CURVES_LINES"), 0, this);
- aAction->setStatusTip(tr("PRP_PLOT2D_CURVES_LINES"));
- connect(aAction, SIGNAL(activated()), this, SLOT(onCurves()));
- aAction->setToggleAction(true);
+ // 4.2. Lines
+ aAction = new QtxAction( tr( "TOT_PLOT2D_CURVES_LINES" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CURVES_LINES" ) ),
+ tr( "MEN_PLOT2D_CURVES_LINES" ),
+ 0, this );
+ aAction->setStatusTip( tr( "PRP_PLOT2D_CURVES_LINES" ) );
+ aAction->setCheckable( true );
myActionsMap[ CurvLinesId ] = aAction;
- // Curve type - splines
- aAction = new QtxAction(tr("TOT_PLOT2D_CURVES_SPLINES"),
- aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_CURVES_SPLINES")),
- tr("MEN_PLOT2D_CURVES_SPLINES"), 0, this);
- aAction->setStatusTip(tr("PRP_PLOT2D_CURVES_SPLINES"));
- connect(aAction, SIGNAL(activated()), this, SLOT(onCurves()));
- aAction->setToggleAction(true);
+ // 4.3. Splines
+ aAction = new QtxAction( tr( "TOT_PLOT2D_CURVES_SPLINES" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CURVES_SPLINES" ) ),
+ tr( "MEN_PLOT2D_CURVES_SPLINES" ),
+ 0, this );
+ aAction->setStatusTip( tr( "PRP_PLOT2D_CURVES_SPLINES" ) );
+ aAction->setCheckable( true );
myActionsMap[ CurvSplinesId ] = aAction;
- // Mode for X (linear or logarithmic)
- aAction = new QtxAction(tr("TOT_PLOT2D_MODE_LINEAR_HOR"),
- aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_MODE_LINEAR_HOR")),
- tr("MEN_PLOT2D_MODE_LINEAR_HOR"), 0, this);
- aAction->setStatusTip (tr("PRP_PLOT2D_MODE_LINEAR_HOR"));
- connect(aAction, SIGNAL(activated()), this, SLOT(onViewHorMode()));
- myActionsMap[ HorId ] = aAction;
-
- // Mode for Y (linear or logarithmic)
- aAction = new QtxAction(tr("TOT_PLOT2D_MODE_LINEAR_VER"),
- aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_MODE_LINEAR_VER")),
- tr("MEN_PLOT2D_MODE_LINEAR_VER" ), 0, this);
- aAction->setStatusTip(tr("PRP_PLOT2D_MODE_LINEAR_VER"));
- connect(aAction, SIGNAL(activated()), this, SLOT(onViewVerMode()));
- myActionsMap[ VerId ] = aAction;
-
- // Legend
- aAction = new QtxAction(tr("TOT_PLOT2D_SHOW_LEGEND"),
- aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_SHOW_LEGEND")),
- tr("MEN_PLOT2D_SHOW_LEGEND"), 0, this);
- aAction->setStatusTip(tr("PRP_PLOT2D_SHOW_LEGEND"));
- connect(aAction, SIGNAL(activated()), this, SLOT(onLegend()));
- aAction->setToggleAction(true);
+ // 4.4. Create action group for curve type operations
+ QActionGroup* aCurveGroup = new QActionGroup( this );
+ aCurveGroup->addAction( myActionsMap[ CurvPointsId ] );
+ aCurveGroup->addAction( myActionsMap[ CurvLinesId ] );
+ aCurveGroup->addAction( myActionsMap[ CurvSplinesId ] );
+ connect( aCurveGroup, SIGNAL( triggered( QAction* ) ), this, SLOT( onCurves() ) );
+
+ // 5. Horizontal scaling mode operations
+
+ // 5.1. Linear
+ aAction = new QtxAction( tr( "TOT_PLOT2D_MODE_LINEAR_HOR" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_MODE_LINEAR_HOR" ) ),
+ tr( "MEN_PLOT2D_MODE_LINEAR_HOR" ),
+ 0, this );
+ aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LINEAR_HOR" ) );
+ connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewHorMode() ) );
+ aAction->setCheckable( true );
+ myActionsMap[ PModeXLinearId ] = aAction;
+
+ // 5.2. Logarithmic
+ aAction = new QtxAction( tr( "TOT_PLOT2D_MODE_LOGARITHMIC_HOR" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_MODE_LOGARITHMIC_HOR" ) ),
+ tr( "MEN_PLOT2D_MODE_LOGARITHMIC_HOR" ),
+ 0, this );
+ aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LOGARITHMIC_HOR" ) );
+ connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewHorMode() ) );
+ aAction->setCheckable( true );
+ myActionsMap[ PModeXLogarithmicId ] = aAction;
+
+ // 5.3. Create action group for horizontal scaling mode operations
+ QActionGroup* aHorGroup = new QActionGroup( this );
+ aHorGroup->addAction( myActionsMap[ PModeXLinearId ] );
+ aHorGroup->addAction( myActionsMap[ PModeXLogarithmicId ] );
+
+ // 6. Vertical scaling mode operations
+
+ // 6.1. Linear
+ aAction = new QtxAction( tr( "TOT_PLOT2D_MODE_LINEAR_VER" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_MODE_LINEAR_VER" ) ),
+ tr( "MEN_PLOT2D_MODE_LINEAR_VER" ),
+ 0, this );
+ aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LINEAR_VER" ) );
+ connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewVerMode() ) );
+ aAction->setCheckable( true );
+ myActionsMap[ PModeYLinearId ] = aAction;
+
+ // 6.2. Logarithmic
+ aAction = new QtxAction( tr( "TOT_PLOT2D_MODE_LOGARITHMIC_VER" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_MODE_LOGARITHMIC_VER" ) ),
+ tr( "MEN_PLOT2D_MODE_LOGARITHMIC_VER" ),
+ 0, this );
+ aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LOGARITHMIC_VER" ) );
+ connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewVerMode() ) );
+ aAction->setCheckable( true );
+ myActionsMap[ PModeYLogarithmicId ] = aAction;
+
+ // 6.3. Create action group for vertical scaling mode operations
+ QActionGroup* aVerGroup = new QActionGroup( this );
+ aVerGroup->addAction( myActionsMap[ PModeYLinearId ] );
+ aVerGroup->addAction( myActionsMap[ PModeYLogarithmicId ] );
+
+ // 7. Legend
+ aAction = new QtxAction( tr( "TOT_PLOT2D_SHOW_LEGEND" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_SHOW_LEGEND" ) ),
+ tr( "MEN_PLOT2D_SHOW_LEGEND" ),
+ 0, this );
+ aAction->setStatusTip( tr( "PRP_PLOT2D_SHOW_LEGEND" ) );
+ connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onLegend() ) );
+ aAction->setCheckable( true );
myActionsMap[ LegendId ] = aAction;
- // Settings
- aAction = new QtxAction(tr( "TOT_PLOT2D_SETTINGS"),
- aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_SETTINGS")),
- tr("MEN_PLOT2D_SETTINGS"), 0, this);
- aAction->setStatusTip(tr( "PRP_PLOT2D_SETTINGS"));
- connect(aAction, SIGNAL(activated()), myViewFrame, SLOT(onSettings()));
+ // 8. Settings
+ aAction = new QtxAction( tr( "TOT_PLOT2D_SETTINGS" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_SETTINGS" ) ),
+ tr( "MEN_PLOT2D_SETTINGS" ),
+ 0, this );
+ aAction->setStatusTip( tr( "PRP_PLOT2D_SETTINGS" ) );
+ connect( aAction, SIGNAL( triggered( bool ) ), myViewFrame, SLOT( onSettings() ) );
myActionsMap[ CurvSettingsId ] = aAction;
- // Clone
- aAction = new QtxAction(tr("MNU_CLONE_VIEW"), aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CLONE_VIEW" ) ),
- tr( "MNU_CLONE_VIEW" ), 0, this);
- aAction->setStatusTip(tr("DSC_CLONE_VIEW"));
- connect(aAction, SIGNAL(activated()), this, SIGNAL(cloneView()));
+ // 9. Clone
+ aAction = new QtxAction( tr( "MNU_CLONE_VIEW" ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CLONE_VIEW" ) ),
+ tr( "MNU_CLONE_VIEW" ),
+ 0, this);
+ aAction->setStatusTip( tr( "DSC_CLONE_VIEW" ) );
+ connect( aAction, SIGNAL( triggered( bool ) ), this, SIGNAL( cloneView() ) );
myActionsMap[ CloneId ] = aAction;
- /* Popup Actions */
- /* Linear/logarithmic mode */
- // Horizontal axis
- aAction = new QtxAction(tr("TOT_PLOT2D_MODE_LINEAR_HOR"),
- aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_MODE_LINEAR_HOR")),
- tr("MEN_PLOT2D_MODE_LINEAR_HOR"), 0, this);
- aAction->setStatusTip (tr("PRP_PLOT2D_MODE_LINEAR_HOR"));
- aAction->setToggleAction(true);
- myActionsMap[PModeXLinearId] = aAction;
- connect(aAction, SIGNAL(activated()), this, SLOT(onViewHorMode()));
-
- aAction = new QtxAction(tr("TOT_PLOT2D_MODE_LOGARITHMIC_HOR"),
- aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_MODE_LOGARITHMIC_HOR")),
- tr("MEN_PLOT2D_MODE_LOGARITHMIC_HOR"), 0, this);
- aAction->setStatusTip(tr("PRP_PLOT2D_MODE_LOGARITHMIC_HOR"));
- aAction->setToggleAction(true);
- myActionsMap[PModeXLogarithmicId] = aAction;
- connect(aAction, SIGNAL(activated()), this, SLOT(onViewHorMode()));
-
- // Vertical axis
- aAction = new QtxAction(tr("TOT_PLOT2D_MODE_LINEAR_VER"),
- aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_MODE_LINEAR_VER")),
- tr("MEN_PLOT2D_MODE_LINEAR_VER" ), 0, this);
- aAction->setStatusTip(tr("PRP_PLOT2D_MODE_LINEAR_VER"));
- aAction->setToggleAction(true);
- myActionsMap[PModeYLinearId] = aAction;
- connect(aAction, SIGNAL(activated()), this, SLOT(onViewVerMode()));
-
- aAction = new QtxAction(tr("TOT_PLOT2D_MODE_LOGARITHMIC_VER"),
- aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_MODE_LOGARITHMIC_VER")),
- tr("MEN_PLOT2D_MODE_LOGARITHMIC_VER" ), 0, this);
- aAction->setStatusTip(tr("PRP_PLOT2D_MODE_LOGARITHMIC_VER"));
- aAction->setToggleAction(true);
- myActionsMap[PModeYLogarithmicId] = aAction;
- connect(aAction, SIGNAL(activated()), this, SLOT(onViewVerMode()));
-
+ // Set initial values
+ onChangeCurveMode();
+ onChangeHorMode();
+ onChangeVerMode();
+ onChangeLegendMode();
}
/*!
- Create toolbar for Plot2d view window
+ \brief Create toolbar for the view window.
*/
void Plot2d_ViewWindow::createToolBar()
{
- myActionsMap[DumpId]->addTo(myToolBar);
-
- SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar);
- aScaleBtn->AddAction(myActionsMap[FitAllId]);
- aScaleBtn->AddAction(myActionsMap[FitRectId]);
- aScaleBtn->AddAction(myActionsMap[ZoomId]);
-
- SUIT_ToolButton* aPanBtn = new SUIT_ToolButton(myToolBar);
- aPanBtn->AddAction(myActionsMap[PanId]);
- aPanBtn->AddAction(myActionsMap[GlobalPanId]);
-
- myCurveBtn = new SUIT_ToolButton(myToolBar);
- myCurveBtn->AddAction(myActionsMap[CurvPointsId]);
- myCurveBtn->AddAction(myActionsMap[CurvLinesId]);
- myCurveBtn->AddAction(myActionsMap[CurvSplinesId]);
- myActionsMap[CurvLinesId]->setOn(true);
- onChangeCurveMode();
+ myToolBar->addAction( myActionsMap[ DumpId ] );
+ myToolBar->addAction( myActionsMap[ ScaleOpId ] );
+ myToolBar->addAction( myActionsMap[ MoveOpId ] );
+ myToolBar->addSeparator();
+ myToolBar->addAction( myActionsMap[ CurvPointsId ] );
+ myToolBar->addAction( myActionsMap[ CurvLinesId ] );
+ myToolBar->addAction( myActionsMap[ CurvSplinesId ] );
+ myToolBar->addSeparator();
+ myToolBar->addAction( myActionsMap[ PModeXLinearId ] );
+ myToolBar->addAction( myActionsMap[ PModeXLogarithmicId ] );
+ myToolBar->addSeparator();
+ myToolBar->addAction( myActionsMap[ PModeYLinearId ] );
+ myToolBar->addAction( myActionsMap[ PModeYLogarithmicId ] );
+ myToolBar->addSeparator();
+ myToolBar->addAction( myActionsMap[ LegendId ] );
+ myToolBar->addAction( myActionsMap[ CurvSettingsId ] );
+ myToolBar->addAction( myActionsMap[ CloneId ] );
+}
- myActionsMap[HorId]->addTo(myToolBar);
- onChangeHorMode();
- myActionsMap[VerId]->addTo(myToolBar);
- onChangeVerMode();
+/*!
+ \brief Get the visual parameters of the view window.
+ \return visual parameters of this view window formatted to the string
+*/
+QString Plot2d_ViewWindow::getVisualParameters()
+{
+ return myViewFrame->getVisualParameters();
+}
- myActionsMap[LegendId]->addTo(myToolBar);
- myActionsMap[CurvSettingsId]->addTo(myToolBar);
- myActionsMap[CloneId]->addTo(myToolBar);
- onChangeLegendMode();
+/*!
+ \brief Restore visual parameters of the view window from the formated string
+ \param parameters view window visual parameters
+*/
+void Plot2d_ViewWindow::setVisualParameters( const QString& parameters )
+{
+ myViewFrame->setVisualParameters( parameters );
}
/*!
- SLOT: called if scale mode for horizontal axis is changed
+ \brief Grab the view window to the internal image.
*/
-void Plot2d_ViewWindow::onChangeHorMode()
+void Plot2d_ViewWindow::RefreshDumpImage()
{
- bool aLinear = myViewFrame->isModeHorLinear();
- SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ QPixmap px = QPixmap::grabWindow( myViewFrame->winId() );
+ myDumpImage = px.toImage();
+}
- myActionsMap[PModeXLinearId]->setOn( aLinear );
- myActionsMap[PModeXLogarithmicId]->setOn( !aLinear );
+/*!
+ \brief Called when the scale mode for the horizontal axis is changed.
+*/
+void Plot2d_ViewWindow::onChangeHorMode()
+{
+ bool aHorLinear = myViewFrame->isModeHorLinear();
+ bool aVerLinear = myViewFrame->isModeVerLinear();
- QPixmap pix = aResMgr->loadPixmap( "Plot2d", tr( aLinear ? "ICON_PLOT2D_MODE_LOGARITHMIC_HOR" :
- "ICON_PLOT2D_MODE_LINEAR_HOR" ) );
- myActionsMap[HorId]->setIconSet( pix );
- myActionsMap[HorId]->setToolTip( tr( aLinear ? "TOT_PLOT2D_MODE_LOGARITHMIC_HOR" :
- "TOT_PLOT2D_MODE_LINEAR_HOR" ) );
- myActionsMap[HorId]->setStatusTip( tr( aLinear ? "PRP_PLOT2D_MODE_LOGARITHMIC_HOR" :
- "PRP_PLOT2D_MODE_LINEAR_HOR" ) );
+ if ( aHorLinear )
+ myActionsMap[ PModeXLinearId ]->setChecked( true );
+ else
+ myActionsMap[ PModeXLogarithmicId ]->setChecked( true );
- myActionsMap[GlobalPanId]->setEnabled( myViewFrame->isModeVerLinear() && myViewFrame->isModeHorLinear() );
+ myActionsMap[ GlobalPanId ]->setEnabled( aHorLinear && aVerLinear );
}
/*!
- SLOT: called if scale mode for vertical axis is changed
+ \brief Called when the scale mode for the vertical axis is changed.
*/
void Plot2d_ViewWindow::onChangeVerMode()
{
- bool aLinear = myViewFrame->isModeVerLinear();
- SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
-
- myActionsMap[PModeYLinearId]->setOn( aLinear );
- myActionsMap[PModeYLogarithmicId]->setOn( !aLinear );
+ bool aHorLinear = myViewFrame->isModeHorLinear();
+ bool aVerLinear = myViewFrame->isModeVerLinear();
- QPixmap pix = aResMgr->loadPixmap( "Plot2d", tr( aLinear ? "ICON_PLOT2D_MODE_LOGARITHMIC_VER" :
- "ICON_PLOT2D_MODE_LINEAR_VER" ) );
- myActionsMap[VerId]->setIconSet( pix );
- myActionsMap[VerId]->setToolTip( tr( aLinear ? "TOT_PLOT2D_MODE_LOGARITHMIC_VER" :
- "TOT_PLOT2D_MODE_LINEAR_VER" ) );
- myActionsMap[VerId]->setStatusTip( tr( aLinear ? "PRP_PLOT2D_MODE_LOGARITHMIC_VER" :
- "PRP_PLOT2D_MODE_LINEAR_VER" ) );
+ if ( aVerLinear )
+ myActionsMap[ PModeYLinearId ]->setChecked( true );
+ else
+ myActionsMap[ PModeYLogarithmicId ]->setChecked( true );
- myActionsMap[GlobalPanId]->setEnabled( myViewFrame->isModeVerLinear() && myViewFrame->isModeHorLinear() );
+ myActionsMap[ GlobalPanId ]->setEnabled( aHorLinear && aVerLinear );
}
/*!
- SLOT: called if curve type is changed
+ \brief Called when the curve type is changed.
*/
void Plot2d_ViewWindow::onChangeCurveMode()
{
- int aCurveType = myViewFrame->getCurveType();
- myCurveBtn->SetItem(aCurveType);
-
- myActionsMap[CurvPointsId]->setOn(aCurveType == 0);
- myActionsMap[CurvLinesId]->setOn(aCurveType == 1);
- myActionsMap[CurvSplinesId]->setOn(aCurveType == 2);
+ switch ( myViewFrame->getCurveType() ) {
+ case 0:
+ myActionsMap[ CurvPointsId ]->setChecked( true );
+ break;
+ case 1:
+ myActionsMap[ CurvLinesId ]->setChecked( true );
+ break;
+ case 2:
+ myActionsMap[ CurvSplinesId ]->setChecked( true );
+ break;
+ default:
+ break;
+ }
}
/*!
- SLOT: called if legend mode is changed
+ \brief Called when the legend mode is changed.
*/
void Plot2d_ViewWindow::onChangeLegendMode()
{
- myActionsMap[ LegendId ]->setOn(myViewFrame->isLegendShow());
+ myActionsMap[ LegendId ]->setChecked( myViewFrame->isLegendShow() );
}
/*!
- SLOT: called if action "Fit all" is activated
+ \brief Called when the "Fit all" action is activated.
*/
void Plot2d_ViewWindow::onFitAll()
{
}
/*!
- SLOT: called if action "Fit rect" is activated
+ \brief Called when the "Fit rect" action is activated.
*/
void Plot2d_ViewWindow::onFitRect()
{
}
/*!
- SLOT: called if action "Zoom" is activated
+ \brief Called when the "Zoom" action is activated.
*/
void Plot2d_ViewWindow::onZoom()
{
}
/*!
- SLOT: called if action "Panning" is activated
+ \brief Called when the "Panning" action is activated.
*/
void Plot2d_ViewWindow::onPanning()
{
}
/*!
- SLOT: called if action "Global panning" is activated
+ \brief Called when the "Global panning" action is activated.
*/
void Plot2d_ViewWindow::onGlobalPanning()
{
}
/*!
- SLOT: called if action of scale mode for horizontal axis changing is activated
+ \brief Called when horizontal axis scale mode action is activated.
*/
void Plot2d_ViewWindow::onViewHorMode()
{
- if (myViewFrame->isModeHorLinear())
- myViewFrame->setHorScaleMode(1);
- else
- myViewFrame->setHorScaleMode(0);
+ myViewFrame->setHorScaleMode( myActionsMap[ PModeXLinearId ]->isChecked() ? 0 : 1 );
}
/*!
- SLOT: called if action of scale mode for vertical axis changing is activated
+ \brief Called when vertical axis scale mode action is activated.
*/
void Plot2d_ViewWindow::onViewVerMode()
{
- if (myViewFrame->isModeVerLinear())
- myViewFrame->setVerScaleMode(1);
- else
- myViewFrame->setVerScaleMode(0);
+ myViewFrame->setVerScaleMode( myActionsMap[ PModeYLinearId ]->isChecked() ? 0 : 1 );
}
/*!
- SLOT: called if action "Show legend" is activated
+ \brief Called when the "Show legend" action is activated.
*/
void Plot2d_ViewWindow::onLegend()
{
- myViewFrame->showLegend(!myViewFrame->isLegendShow());
+ myViewFrame->showLegend( !myViewFrame->isLegendShow() );
onChangeLegendMode();
}
/*!
- SLOT: called if action "Change curve type" is activated
+ \brief Called when the "Change curve type" action is activated.
*/
void Plot2d_ViewWindow::onCurves()
{
- QtxAction* aSender = (QtxAction*) sender();
- if(aSender == myActionsMap[CurvPointsId])
- myViewFrame->setCurveType(0);
- else if(aSender == myActionsMap[CurvLinesId])
- myViewFrame->setCurveType(1);
- else if(aSender == myActionsMap[CurvSplinesId])
- myViewFrame->setCurveType(2);
+ if( myActionsMap[ CurvPointsId ]->isChecked() )
+ myViewFrame->setCurveType( 0 );
+ else if ( myActionsMap[ CurvLinesId ]->isChecked() )
+ myViewFrame->setCurveType( 1 );
+ else if ( myActionsMap[ CurvSplinesId ]->isChecked() )
+ myViewFrame->setCurveType( 2 );
}
/*!
- SLOT: called if action "Dump view" is activated
+ \brief Called when the "Dump view" action is activated.
*/
void Plot2d_ViewWindow::onDumpView()
{
- qApp->postEvent( myViewFrame, new QPaintEvent( QRect( 0, 0, myViewFrame->width(), myViewFrame->height() ), TRUE ) );
+ qApp->postEvent( myViewFrame, new QPaintEvent( QRect( 0, 0, myViewFrame->width(), myViewFrame->height() ) ) );
SUIT_ViewWindow::onDumpView();
}
/*!
- \return QImage, containing all scene rendering in window
+ \brief Dump the contents of the view window to the image.
+ \return image, containing all scene rendered in the window
*/
QImage Plot2d_ViewWindow::dumpView()
{
- if ( getToolBar()->hasMouse() || myDumpImage.isNull() )
- {
- QPixmap px = QPixmap::grabWindow( myViewFrame->winId() );
- return px.convertToImage();
- }
+ if ( getToolBar()->underMouse() || myDumpImage.isNull() ) {
+ QPixmap px = QPixmap::grabWindow( myViewFrame->winId() );
+ return px.toImage();
+ }
return myDumpImage;
}
/*!
- Saves scene rendering in window to file
- \param fileName - name of file
- \param format - string contains name of format (for example, "BMP"(default) or "JPEG", "JPG")
+ \brief Dump scene rendered in the view window to the file.
+ \param img image
+ \param fileName name of file
+ \param format image format ("BMP" [default], "JPEG", "JPG", "PNG")
*/
-bool Plot2d_ViewWindow::dumpViewToFormat( const QImage& img, const QString& fileName, const QString& format )
+bool Plot2d_ViewWindow::dumpViewToFormat( const QImage& img,
+ const QString& fileName,
+ const QString& format )
{
bool res = myViewFrame ? myViewFrame->print( fileName, format ) : false;
if( !res )
}
/*!
- \return filter of image files
+ \brief Get supported image files wildcards.
+ \return image files wildcards (list of wildcards, separated by ";;")
*/
QString Plot2d_ViewWindow::filter() const
{
- return SUIT_ViewWindow::filter() + ";;" + tr( "POSTSCRIPT_FILES" );
-}
-
-/*!
- \return the visual parameters of this view as a formated string
- */
-QString Plot2d_ViewWindow::getVisualParameters()
-{
- return myViewFrame->getVisualParameters();
-}
-
-/*!
- The method restors visual parameters of this view from a formated string
-*/
-void Plot2d_ViewWindow::setVisualParameters( const QString& parameters )
-{
- myViewFrame->setVisualParameters( parameters );
+ QStringList filters = SUIT_ViewWindow::filter().split( ";;", QString::SkipEmptyParts );
+ filters << tr( "POSTSCRIPT_FILES" );
+ return filters.join( ";;" );
}
/*!
- \refresh QImage, containing all scene rendering in window
+ \fn void Plot2d_ViewWindow::cloneView();
+ \brief Emitted when the "Clone View" action is activated.
*/
-void Plot2d_ViewWindow::RefreshDumpImage()
-{
- QPixmap px = QPixmap::grabWindow( myViewFrame->winId() );
- myDumpImage = px.convertToImage();
-}
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// File : Plot2d_ViewWindow.h
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+
#ifndef PLOT2D_VIEWWINDOW_H
#define PLOT2D_VIEWWINDOW_H
#include "Plot2d.h"
#include <SUIT_ViewWindow.h>
+#include <QMap>
-#include <qimage.h>
#ifdef WIN32
#pragma warning( disable:4251 )
class Plot2d_Viewer;
class Plot2d_ViewFrame;
class QtxAction;
-class SUIT_ToolButton;
+class QImage;
+class QMenu;
+class QToolBar;
class PLOT2D_EXPORT Plot2d_ViewWindow : public SUIT_ViewWindow
{
Q_OBJECT
public:
- Plot2d_ViewWindow( SUIT_Desktop* theDesktop, Plot2d_Viewer* theModel );
+ Plot2d_ViewWindow( SUIT_Desktop*, Plot2d_Viewer* );
virtual ~Plot2d_ViewWindow();
- Plot2d_Viewer* getModel() { return myModel; }
- void putInfo(QString theMsg);
- Plot2d_ViewFrame* getViewFrame() { return myViewFrame; };
- QToolBar* getToolBar() { return myToolBar; };
- void contextMenuPopup( QPopupMenu* thePopup );
+ Plot2d_Viewer* getModel();
+ void putInfo( const QString&);
+ Plot2d_ViewFrame* getViewFrame();
+ QToolBar* getToolBar();
+ void contextMenuPopup( QMenu* );
+
+ virtual bool eventFilter( QObject*, QEvent* );
+
+ void createActions();
+ void createToolBar();
virtual QString getVisualParameters();
- virtual void setVisualParameters( const QString& parameters );
+ virtual void setVisualParameters( const QString& );
virtual void RefreshDumpImage();
-protected:
- virtual QImage dumpView();
- virtual QString filter() const;
- virtual bool dumpViewToFormat( const QImage&, const QString& fileName, const QString& format );
-
-private:
- bool eventFilter(QObject* watched, QEvent* e);
-
- void createActions();
- void createToolBar();
-
public slots:
- void onChangeHorMode();
- void onChangeVerMode();
- void onChangeCurveMode();
- void onChangeLegendMode();
+ void onChangeHorMode();
+ void onChangeVerMode();
+ void onChangeCurveMode();
+ void onChangeLegendMode();
- void onFitAll();
- void onFitRect();
- void onZoom();
- void onPanning();
- void onGlobalPanning();
- void onViewHorMode();
- void onViewVerMode();
- void onLegend();
- void onCurves();
-
- void onDumpView();
-
-signals:
- void cloneView();
+ void onFitAll();
+ void onFitRect();
+ void onZoom();
+ void onPanning();
+ void onGlobalPanning();
+ void onViewHorMode();
+ void onViewVerMode();
+ void onLegend();
+ void onCurves();
+
+ void onDumpView();
protected:
- enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, HorId,
- VerId, LegendId, CurvPointsId, CurvLinesId, CurvSplinesId, CurvSettingsId, CloneId,
- PModeXLinearId, PModeXLogarithmicId, PModeYLinearId, PModeYLogarithmicId };
+ enum { DumpId,
+ ScaleOpId, FitAllId, FitRectId, ZoomId,
+ MoveOpId, PanId, GlobalPanId,
+ PModeXLinearId, PModeXLogarithmicId,
+ PModeYLinearId, PModeYLogarithmicId,
+ CurvPointsId, CurvLinesId, CurvSplinesId,
+ LegendId,
+ CurvSettingsId,
+ CloneId };
+
typedef QMap<int, QtxAction*> ActionsMap;
ActionsMap myActionsMap;
+protected:
+ virtual QImage dumpView();
+ virtual bool dumpViewToFormat( const QImage&,
+ const QString&,
+ const QString& );
+ virtual QString filter() const;
+
+signals:
+ void cloneView();
+
private:
Plot2d_Viewer* myModel;
Plot2d_ViewFrame* myViewFrame;
QToolBar* myToolBar;
-
- SUIT_ToolButton* myCurveBtn;
-
- QImage myDumpImage;
+ QImage myDumpImage;
};
#ifdef WIN32
#pragma warning( default:4251 )
#endif
-#endif
+#endif // PLOT2D_VIEWWINDOW_H
--- /dev/null
+// SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+// Copyright (C) 2003 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
+//
+//
+//
+// File :
+// Author :
+// Module :
+// $Header$
+
+#include "VTKViewer_Actor.h"
+#include "VTKViewer_ExtractUnstructuredGrid.h"
+#include "VTKViewer_ConvexTool.h"
+#include "VTKViewer_Filter.h"
+#include "VTKViewer_GeometryFilter.h"
+#include "VTKViewer_AppendFilter.h"
+#include "VTKViewer_Algorithm.h"
+#include "VTKViewer_InteractorStyle.h"
+#include "VTKViewer_RenderWindow.h"
+#include "VTKViewer_RenderWindowInteractor.h"
+#include "VTKViewer_ShrinkFilter.h"
+#include "VTKViewer_TransformFilter.h"
+#include "VTKViewer_Transform.h"
+#include "VTKViewer_Trihedron.h"
+#include "VTKViewer_Utilities.h"
+#include "VTKViewer_ViewManager.h"
+#include "VTKViewer_ViewModel.h"
+#include "VTKViewer_ViewWindow.h"
+#include "VTKViewer_Functor.h"
+
+int
+main(int argc, char** argv)
+{
+ return 0;
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 VTKVIEWER_H
+#define VTKVIEWER_H
+
+#ifdef WIN32
+# ifdef VTKVIEWER_EXPORTS
+# define VTKVIEWER_EXPORT __declspec( dllexport )
+# else
+# define VTKVIEWER_EXPORT __declspec( dllimport )
+# endif
+#else
+# define VTKVIEWER_EXPORT
+#endif
+
+#include <vtkSystemIncludes.h>
+
+#if !defined(vtkFloatingPointType)
+# define vtkFloatingPointType vtkFloatingPointType
+ typedef float vtkFloatingPointType;
+#endif
+
+#endif
--- /dev/null
+TEMPLATE = lib
+
+DESTDIR = ../../${CONFIG_ID}/lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../${CONFIG_ID}/obj/$$TARGET
+
+VTKHOME = $$(VTKHOME)
+VTK_INCLUDES = $${VTKHOME}/include/vtk
+
+VTK_LIBS = -L$${VTKHOME}/lib/vtk -L$${VTKHOME}/lib/vtk/python -lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid -lvtkParallel -lvtkWidgets -lGL -L/usr/X11R6/lib -lGLU -L/usr/X11R6/lib -lX11 -lXt
+
+CASROOT = $$(CASROOT)
+CAS_CPPFLAGS = $${CASROOT}/inc
+
+CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
+
+INCLUDEPATH += ../../include $${VTK_INCLUDES} $${CAS_CPPFLAGS} ../Qtx ../SUIT
+LIBS += -L../../${CONFIG_ID}/lib -lqtx -lsuit $${VTK_LIBS} $${CAS_KERNEL}
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32
+DEFINES += VTKVIEWER_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
+
+HEADERS = *.h
+
+SOURCES = *.cxx
+
+TRANSLATIONS = resources/VTKViewer_images.ts \
+ resources/VTKViewer_msg_en.ts
+
+ICONS = resources/*.png
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+resources.files = $$ICONS resources/*.qm
+resources.path = ../../resources
+
+INSTALLS += includes resources
--- /dev/null
+// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+// Copyright (C) 2003 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
+//
+//
+//
+// File : SALOME_Actor.cxx
+// Author : Nicolas REJNERI
+// Module : SALOME
+// $Header$
+
+/*!
+ \class SALOME_Actor SALOME_Actor.h
+ \brief Abstract class of SALOME Objects in VTK.
+*/
+
+
+#include "VTKViewer_Actor.h"
+
+#include "VTKViewer_Transform.h"
+#include "VTKViewer_TransformFilter.h"
+#include "VTKViewer_GeometryFilter.h"
+
+// VTK Includes
+#include <vtkCell.h>
+#include <vtkPolyData.h>
+#include <vtkObjectFactory.h>
+#include <vtkDataSetMapper.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkProperty.h>
+#include <vtkRenderer.h>
+#include <vtkPassThroughFilter.h>
+
+using namespace std;
+
+#if defined __GNUC__
+ #if __GNUC__ == 2
+ #define __GNUC_2__
+ #endif
+#endif
+
+int VTKViewer_POINT_SIZE = 5;
+int VTKViewer_LINE_WIDTH = 3;
+
+
+vtkStandardNewMacro(VTKViewer_Actor);
+
+/*!
+ Constructor
+*/
+VTKViewer_Actor
+::VTKViewer_Actor():
+ myIsHighlighted(false),
+ myIsPreselected(false),
+ myRepresentation(VTK_SURFACE),
+ myDisplayMode(1),
+ myProperty(vtkProperty::New()),
+ PreviewProperty(NULL),
+ myIsInfinite(false),
+ myIsResolveCoincidentTopology(true),
+ myStoreMapping(false),
+ myGeomFilter(VTKViewer_GeometryFilter::New()),
+ myTransformFilter(VTKViewer_TransformFilter::New())
+{
+ vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
+ myPolygonOffsetUnits);
+
+ for(int i = 0; i < 6; i++)
+ myPassFilter.push_back(vtkPassThroughFilter::New());
+}
+
+/*!
+ Destructor
+*/
+VTKViewer_Actor
+::~VTKViewer_Actor()
+{
+ SetPreviewProperty(NULL);
+
+ myGeomFilter->Delete();
+
+ myTransformFilter->Delete();
+
+ for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++)
+ if(myPassFilter[i])
+ myPassFilter[i]->Delete();
+
+ myProperty->Delete();
+}
+
+/*!
+ \return name
+*/
+const char*
+VTKViewer_Actor
+::getName()
+{
+ return myName.c_str();
+}
+
+/*!
+ Sets name
+ \param theName - new name
+*/
+void
+VTKViewer_Actor
+::setName(const char* theName)
+{
+ myName = theName;
+}
+
+/*!
+ To publish the actor an all its internal devices
+*/
+void
+VTKViewer_Actor
+::AddToRender(vtkRenderer* theRenderer)
+{
+ theRenderer->AddActor(this);
+}
+
+/*!
+ To remove the actor an all its internal devices
+*/
+void
+VTKViewer_Actor
+::RemoveFromRender(vtkRenderer* theRenderer)
+{
+ theRenderer->RemoveActor(this);
+}
+
+/*!
+ Used to obtain all dependent actors
+*/
+void
+VTKViewer_Actor
+::GetChildActors(vtkActorCollection*)
+{}
+
+/*!
+ Apply view transformation
+ \param theTransform - view transformation
+*/
+void
+VTKViewer_Actor
+::SetTransform(VTKViewer_Transform* theTransform)
+{
+ myTransformFilter->SetTransform(theTransform);
+}
+
+
+/*!
+ To insert some additional filters and then sets the given #vtkMapper
+*/
+void
+VTKViewer_Actor
+::SetMapper(vtkMapper* theMapper)
+{
+ InitPipeLine(theMapper);
+}
+
+/*!
+ Initialization
+*/
+void
+VTKViewer_Actor
+::InitPipeLine(vtkMapper* theMapper)
+{
+ if(theMapper){
+ int anId = 0;
+ myPassFilter[ anId ]->SetInput( theMapper->GetInput() );
+ myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() );
+
+ anId++; // 1
+ myGeomFilter->SetStoreMapping( myStoreMapping );
+ myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
+
+ anId++; // 2
+ myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() );
+ myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
+
+ anId++; // 3
+ myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
+
+ anId++; // 4
+ myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
+ myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
+
+ anId++; // 5
+ if(vtkDataSetMapper* aMapper = dynamic_cast<vtkDataSetMapper*>(theMapper)){
+ aMapper->SetInput(myPassFilter[anId]->GetOutput());
+ }else if(vtkPolyDataMapper* aMapper = dynamic_cast<vtkPolyDataMapper*>(theMapper)){
+ aMapper->SetInput(myPassFilter[anId]->GetPolyDataOutput());
+ }
+ }
+ Superclass::SetMapper(theMapper);
+}
+
+/*!
+ Renders actor
+*/
+void
+VTKViewer_Actor
+::Render(vtkRenderer *ren, vtkMapper* m)
+{
+ if(vtkDataSet* aDataSet = GetInput()){
+ static vtkFloatingPointType PERCENTS_OF_DETAILS = 0.50;
+ vtkIdType aNbOfPoints = vtkIdType(aDataSet->GetNumberOfPoints()*PERCENTS_OF_DETAILS);
+ if(aNbOfPoints > 0)
+ SetNumberOfCloudPoints(aNbOfPoints);
+ }
+
+ if(myIsResolveCoincidentTopology){
+ int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology();
+ vtkFloatingPointType aFactor, aUnit;
+ vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
+
+ vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
+ vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
+ myPolygonOffsetUnits);
+ Superclass::Render(ren,m);
+
+ vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
+ vtkMapper::SetResolveCoincidentTopology(aResolveCoincidentTopology);
+ }else{
+ Superclass::Render(ren,m);
+ }
+}
+
+/*!
+ Set ResolveCoincidentTopology flag
+ \param theIsResolve - new flag value
+*/
+void
+VTKViewer_Actor
+::SetResolveCoincidentTopology(bool theIsResolve)
+{
+ myIsResolveCoincidentTopology = theIsResolve;
+}
+
+/*!
+ Set polygon offset parameters
+ \param factor, units - Opengl polygon offset parameters
+*/
+void
+VTKViewer_Actor
+::SetPolygonOffsetParameters(vtkFloatingPointType factor,
+ vtkFloatingPointType units)
+{
+ myPolygonOffsetFactor = factor;
+ myPolygonOffsetUnits = units;
+}
+
+/*!
+ Get polygon offset parameters
+ \param factor, units - Opengl polygon offset parameters
+*/
+void
+VTKViewer_Actor
+::GetPolygonOffsetParameters(vtkFloatingPointType& factor,
+ vtkFloatingPointType& units)
+{
+ factor = myPolygonOffsetFactor;
+ units = myPolygonOffsetUnits;
+}
+
+/*!
+ \return shrink factor
+*/
+vtkFloatingPointType
+VTKViewer_Actor
+::GetShrinkFactor()
+{
+ return 1.0;
+}
+
+/*!
+ \return true if the actor is shrunkable
+*/
+bool
+VTKViewer_Actor
+::IsShrunkable()
+{
+ return false;
+}
+
+/*!
+ \return true if the actor is shrunk
+*/
+bool
+VTKViewer_Actor
+::IsShrunk()
+{
+ return false;
+}
+
+/*!
+ Insert shrink filter into pipeline
+*/
+void
+VTKViewer_Actor
+::SetShrink()
+{}
+
+/*!
+ Remove shrink filter from pipeline
+*/
+void
+VTKViewer_Actor
+::UnShrink()
+{}
+
+/*!
+ Allows to get initial #vtkDataSet
+*/
+vtkDataSet*
+VTKViewer_Actor
+::GetInput()
+{
+ return myPassFilter.front()->GetOutput();
+}
+
+/*!
+ To calculatate last modified time
+*/
+unsigned long int
+VTKViewer_Actor
+::GetMTime()
+{
+ unsigned long mTime = this->Superclass::GetMTime();
+ unsigned long time = myTransformFilter->GetMTime();
+ mTime = ( time > mTime ? time : mTime );
+ if(vtkDataSet *aDataSet = dynamic_cast<vtkDataSet*>(myPassFilter[0]->GetInput())){ // bad usage of GetInput
+ time = aDataSet->GetMTime();
+ mTime = ( time > mTime ? time : mTime );
+ }
+ return mTime;
+}
+
+/*!
+ Set representation (VTK_SURFACE, VTK_POINTS, VTK_WIREFRAME and so on)
+ param theMode - new mode
+*/
+void
+VTKViewer_Actor
+::SetRepresentation(int theMode)
+{
+ switch(myRepresentation){
+ case VTK_POINTS :
+ case VTK_SURFACE :
+ myProperty->SetAmbient(GetProperty()->GetAmbient());
+ myProperty->SetDiffuse(GetProperty()->GetDiffuse());
+ myProperty->SetSpecular(GetProperty()->GetSpecular());
+ break;
+ }
+
+ switch(theMode){
+ case VTK_POINTS :
+ case VTK_SURFACE :
+ GetProperty()->SetAmbient(myProperty->GetAmbient());
+ GetProperty()->SetDiffuse(myProperty->GetDiffuse());
+ GetProperty()->SetSpecular(myProperty->GetSpecular());
+ break;
+ default:
+ GetProperty()->SetAmbient(1.0);
+ GetProperty()->SetDiffuse(0.0);
+ GetProperty()->SetSpecular(0.0);
+ }
+
+ switch(theMode){
+ case 3 :
+ myGeomFilter->SetInside(true);
+ myGeomFilter->SetWireframeMode(true);
+ GetProperty()->SetRepresentation(VTK_WIREFRAME);
+ break;
+ case VTK_POINTS :
+ GetProperty()->SetPointSize(VTKViewer_POINT_SIZE);
+ GetProperty()->SetRepresentation(theMode);
+ myGeomFilter->SetWireframeMode(false);
+ myGeomFilter->SetInside(false);
+ break;
+ case VTK_WIREFRAME :
+ GetProperty()->SetRepresentation(theMode);
+ myGeomFilter->SetWireframeMode(true);
+ myGeomFilter->SetInside(false);
+ break;
+ case VTK_SURFACE :
+ GetProperty()->SetRepresentation(theMode);
+ myGeomFilter->SetWireframeMode(false);
+ myGeomFilter->SetInside(false);
+ break;
+ }
+
+ myRepresentation = theMode;
+}
+
+/*!
+ \return current representation mode
+*/
+int
+VTKViewer_Actor
+::GetRepresentation()
+{
+ return myRepresentation;
+}
+
+/*!
+ Maps VTK index of a node to corresponding object index
+*/
+int
+VTKViewer_Actor
+::GetNodeObjId(int theVtkID)
+{
+ return theVtkID;
+}
+
+/*!
+ Get coordinates of a node for given object index
+*/
+vtkFloatingPointType*
+VTKViewer_Actor
+::GetNodeCoord(int theObjID)
+{
+ return GetInput()->GetPoint(theObjID);
+}
+
+/*!
+ Get corresponding #vtkCell for given object index
+*/
+vtkCell*
+VTKViewer_Actor
+::GetElemCell(int theObjID)
+{
+ return GetInput()->GetCell(theObjID);
+}
+
+/*!
+ Maps VTK index of a cell to corresponding object index
+*/
+int
+VTKViewer_Actor
+::GetElemObjId(int theVtkID)
+{
+ return theVtkID;
+}
+
+
+/*!
+ \return object dimension. Virtual method should be redifined by derived classes
+*/
+int
+VTKViewer_Actor
+::GetObjDimension( const int theObjId )
+{
+ if ( vtkCell* aCell = GetElemCell(theObjId) )
+ return aCell->GetCellDimension();
+ return 0;
+}
+
+/*!
+ Infinitive means actor without size (point for example),
+ which is not taken into account in calculation of boundaries of the scene
+*/
+void
+VTKViewer_Actor
+::SetInfinitive(bool theIsInfinite)
+{
+ myIsInfinite = theIsInfinite;
+}
+
+/*!
+ \return infinive flag
+*/
+bool
+VTKViewer_Actor
+::IsInfinitive()
+{
+ if(myIsInfinite)
+ return true;
+
+ static vtkFloatingPointType MAX_DISTANCE = 0.9*VTK_LARGE_FLOAT;
+ vtkFloatingPointType aBounds[6];
+ GetBounds(aBounds);
+ for(int i = 0; i < 6; i++)
+ if(fabs(aBounds[i]) > MAX_DISTANCE)
+ return true;
+
+ static vtkFloatingPointType MIN_DISTANCE = 1.0/VTK_LARGE_FLOAT;
+ if(GetLength() < MIN_DISTANCE)
+ return true;
+
+ return false;
+}
+
+/*!
+ \return current bounding box
+*/
+vtkFloatingPointType*
+VTKViewer_Actor
+::GetBounds()
+{
+ return Superclass::GetBounds();
+}
+
+
+/*!
+ \return current bounding box
+*/
+void
+VTKViewer_Actor
+::GetBounds(vtkFloatingPointType theBounds[6])
+{
+ Superclass::GetBounds(theBounds);
+}
+
+
+bool
+VTKViewer_Actor
+::IsSetCamera() const
+{
+ return false;
+}
+
+bool
+VTKViewer_Actor
+::IsResizable() const
+{
+ return false;
+}
+
+void
+VTKViewer_Actor
+::SetSize( const vtkFloatingPointType )
+{}
+
+
+void
+VTKViewer_Actor
+::SetCamera( vtkCamera* )
+{}
+
+
+void
+VTKViewer_Actor
+::SetOpacity(vtkFloatingPointType theOpacity)
+{
+ myOpacity = theOpacity;
+ GetProperty()->SetOpacity(theOpacity);
+}
+
+vtkFloatingPointType
+VTKViewer_Actor
+::GetOpacity()
+{
+ return myOpacity;
+}
+
+
+/*!
+ Change color
+*/
+void
+VTKViewer_Actor
+::SetColor(vtkFloatingPointType r,
+ vtkFloatingPointType g,
+ vtkFloatingPointType b)
+{
+ GetProperty()->SetColor(r,g,b);
+}
+
+/*!
+ Change color
+*/
+void
+VTKViewer_Actor
+::SetColor(const vtkFloatingPointType theRGB[3])
+{
+ SetColor(theRGB[0],theRGB[1],theRGB[2]);
+}
+
+/*!
+ Get color
+*/
+void
+VTKViewer_Actor
+::GetColor(vtkFloatingPointType& r,
+ vtkFloatingPointType& g,
+ vtkFloatingPointType& b)
+{
+ vtkFloatingPointType aColor[3];
+ GetProperty()->GetColor(aColor);
+ r = aColor[0];
+ g = aColor[1];
+ b = aColor[2];
+}
+
+
+/*!
+ \return display mode
+*/
+int
+VTKViewer_Actor
+::getDisplayMode()
+{
+ return myDisplayMode;
+}
+
+/*!
+ Change display mode
+*/
+void
+VTKViewer_Actor
+::setDisplayMode(int theMode)
+{
+ SetRepresentation(theMode + 1);
+ myDisplayMode = GetRepresentation() - 1;
+}
+
+
+/*!
+ \return true if the descendant of the VTKViewer_Actor will implement its own highlight or not
+*/
+bool
+VTKViewer_Actor
+::hasHighlight()
+{
+ return false;
+}
+
+/*!
+ \return true if the VTKViewer_Actor is already highlighted
+*/
+bool
+VTKViewer_Actor
+::isHighlighted()
+{
+ return myIsHighlighted;
+}
+
+/*!
+ Set preselection mode
+*/
+void
+VTKViewer_Actor
+::SetPreSelected(bool thePreselect)
+{
+ myIsPreselected = thePreselect;
+}
+
+/*!
+ Just to update visibility of the highlight devices
+*/
+void
+VTKViewer_Actor
+::highlight(bool theIsHighlight)
+{
+ myIsHighlighted = theIsHighlight;
+}
+
+vtkCxxSetObjectMacro(VTKViewer_Actor,PreviewProperty,vtkProperty);
--- /dev/null
+// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+// Copyright (C) 2003 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
+//
+//
+//
+// File : SALOME_Actor.h
+// Author : Nicolas REJNERI
+// Module : SALOME
+// $Header$
+
+#ifndef VTKVIEVER_ACTOR_H
+#define VTKVIEVER_ACTOR_H
+
+#include "VTKViewer.h"
+
+#include <string>
+#include <vector>
+
+#include <vtkLODActor.h>
+
+class vtkCell;
+class vtkPointPicker;
+class vtkCellPicker;
+class vtkDataSet;
+class vtkCamera;
+class vtkProperty;
+class vtkRenderer;
+class vtkPassThroughFilter;
+
+class VTKViewer_Transform;
+class VTKViewer_GeometryFilter;
+class VTKViewer_TransformFilter;
+
+extern int VTKViewer_POINT_SIZE;
+extern int VTKViewer_LINE_WIDTH;
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+/*! \class vtkLODActor
+ * \brief For more information see <a href="http://www.vtk.org/">VTK documentation</a>
+ */
+class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
+{
+ public:
+ static VTKViewer_Actor* New();
+
+ vtkTypeMacro(VTKViewer_Actor,vtkLODActor);
+
+ //----------------------------------------------------------------------------
+ //! Get its name
+ virtual
+ const char*
+ getName();
+
+ //! Name the #VTKViewer_Actor
+ virtual
+ void
+ setName(const char* theName);
+
+ //----------------------------------------------------------------------------
+ //! Change opacity
+ virtual
+ void
+ SetOpacity(vtkFloatingPointType theOpacity);
+
+ //! Get current opacity
+ virtual
+ vtkFloatingPointType
+ GetOpacity();
+
+ //! Change color
+ virtual
+ void
+ SetColor(vtkFloatingPointType r,
+ vtkFloatingPointType g,
+ vtkFloatingPointType b);
+
+ //! Get current color
+ virtual
+ void
+ GetColor(vtkFloatingPointType& r,
+ vtkFloatingPointType& g,
+ vtkFloatingPointType& b);
+
+ //! Change color
+ virtual
+ void
+ SetColor(const vtkFloatingPointType theRGB[3]);
+
+ //----------------------------------------------------------------------------
+ // For selection mapping purpose
+ //! Maps VTK index of a node to corresponding object index
+ virtual
+ int
+ GetNodeObjId(int theVtkID);
+
+ //! Get coordinates of a node for given object index
+ virtual
+ vtkFloatingPointType*
+ GetNodeCoord(int theObjID);
+
+ //! Maps VTK index of a cell to corresponding object index
+ virtual
+ int
+ GetElemObjId(int theVtkID);
+
+ //! Get corresponding #vtkCell for given object index
+ virtual
+ vtkCell*
+ GetElemCell(int theObjID);
+
+ //----------------------------------------------------------------------------
+ //! Get dimension of corresponding mesh element
+ virtual
+ int
+ GetObjDimension( const int theObjId );
+
+ //! To insert some additional filters and then sets the given #vtkMapper
+ virtual
+ void
+ SetMapper(vtkMapper* theMapper);
+
+ //! Allows to get initial #vtkDataSet
+ virtual
+ vtkDataSet*
+ GetInput();
+
+ //! Apply view transformation
+ virtual
+ void
+ SetTransform(VTKViewer_Transform* theTransform);
+
+ //! To calculatate last modified time
+ virtual
+ unsigned long int
+ GetMTime();
+
+ //----------------------------------------------------------------------------
+ //! Set representation (VTK_SURFACE, VTK_POINTS, VTK_WIREFRAME and so on)
+ virtual
+ void
+ SetRepresentation(int theMode);
+
+ //! Get current representation mode
+ virtual
+ int
+ GetRepresentation();
+
+ //! Get current display mode (obsolete)
+ virtual
+ int
+ getDisplayMode();
+
+ //! Set display mode (obsolete)
+ virtual
+ void
+ setDisplayMode(int theMode);
+
+ //----------------------------------------------------------------------------
+ //! Set infinive flag
+ /*!
+ Infinitive means actor without size (point for example),
+ which is not taken into account in calculation of boundaries of the scene
+ */
+ void
+ SetInfinitive(bool theIsInfinite);
+
+ //! Get infinive flag
+ virtual
+ bool
+ IsInfinitive();
+
+ //! To calcualte current bounding box
+ virtual
+ vtkFloatingPointType*
+ GetBounds();
+
+ //! To calcualte current bounding box
+ void
+ GetBounds(vtkFloatingPointType bounds[6]);
+
+ //----------------------------------------------------------------------------
+ virtual
+ bool
+ IsSetCamera() const;
+
+ virtual
+ bool
+ IsResizable() const;
+
+ virtual
+ void
+ SetSize( const vtkFloatingPointType );
+
+ virtual
+ void
+ SetCamera( vtkCamera* );
+
+ //----------------------------------------------------------------------------
+ //! Set ResolveCoincidentTopology flag
+ void
+ SetResolveCoincidentTopology(bool theIsResolve);
+
+ //! Set ResolveCoincidentTopology parameters
+ void
+ SetPolygonOffsetParameters(vtkFloatingPointType factor,
+ vtkFloatingPointType units);
+
+ //! Get current ResolveCoincidentTopology parameters
+ void
+ GetPolygonOffsetParameters(vtkFloatingPointType& factor,
+ vtkFloatingPointType& units);
+
+ virtual
+ void
+ Render(vtkRenderer *, vtkMapper *);
+
+ //----------------------------------------------------------------------------
+ //! Get current shrink factor
+ virtual
+ vtkFloatingPointType
+ GetShrinkFactor();
+
+ //! Is the actor is shrunkable
+ virtual
+ bool
+ IsShrunkable();
+
+ //! Is the actor is shrunk
+ virtual
+ bool
+ IsShrunk();
+
+ //! Insert shrink filter into pipeline
+ virtual
+ void
+ SetShrink();
+
+ //! Remove shrink filter from pipeline
+ virtual
+ void
+ UnShrink();
+
+ //----------------------------------------------------------------------------
+ //! To publish the actor an all its internal devices
+ virtual
+ void
+ AddToRender(vtkRenderer* theRendere);
+
+ //! To remove the actor an all its internal devices
+ virtual
+ void
+ RemoveFromRender(vtkRenderer* theRendere);
+
+ //! Used to obtain all dependent actors
+ virtual
+ void
+ GetChildActors(vtkActorCollection*);
+
+ //----------------------------------------------------------------------------
+ //! Ask, if the descendant of the VTKViewer_Actor will implement its own highlight or not
+ virtual
+ bool
+ hasHighlight();
+
+ //! Ask, if the VTKViewer_Actor is already highlighted
+ virtual
+ bool
+ isHighlighted();
+
+ //! Set preselection mode
+ virtual
+ void
+ SetPreSelected(bool thePreselect = false);
+
+ //----------------------------------------------------------------------------
+ //! Just to update visibility of the highlight devices
+ virtual
+ void
+ highlight(bool theHighlight);
+
+ void
+ SetPreviewProperty(vtkProperty* theProperty);
+
+ protected:
+ //----------------------------------------------------------------------------
+ bool myIsResolveCoincidentTopology;
+ vtkFloatingPointType myPolygonOffsetFactor;
+ vtkFloatingPointType myPolygonOffsetUnits;
+
+ std::string myName;
+
+ vtkFloatingPointType myOpacity;
+ int myDisplayMode;
+ bool myIsInfinite;
+
+ bool myStoreMapping;
+ VTKViewer_GeometryFilter *myGeomFilter;
+ VTKViewer_TransformFilter *myTransformFilter;
+ std::vector<vtkPassThroughFilter*> myPassFilter;
+
+ int myRepresentation;
+ vtkProperty *myProperty;
+
+ void
+ InitPipeLine(vtkMapper* theMapper);
+
+ VTKViewer_Actor();
+ ~VTKViewer_Actor();
+
+ protected:
+ vtkProperty *PreviewProperty;
+ bool myIsPreselected;
+ bool myIsHighlighted;
+};
+
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
+#endif // VTKVIEVER_ACTOR_H
--- /dev/null
+// SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+// Copyright (C) 2003 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
+//
+//
+//
+// File : VTKViewer_ViewFrame.h
+// Author : Nicolas REJNERI
+// Module : SALOME
+// $Header$
+
+#ifndef VTKViewer_Algorithm_H
+#define VTKViewer_Algorithm_H
+
+#include <vtkActorCollection.h>
+
+class vtkActor;
+
+namespace VTK
+{
+ /*!For each actor(for ex: someActor) from \a theCollection(that can be dynamic cast to type TActor)\n
+ * Call method \a theFun(someActor)
+ */
+ template<typename TActor, typename TFunction>
+ TFunction ForEach(vtkActorCollection *theCollection, TFunction theFun)
+ {
+ if(theCollection){
+ theCollection->InitTraversal();
+ while(vtkActor *anAct = theCollection->GetNextActor())
+ if(TActor *anActor = dynamic_cast<TActor*>(anAct))
+ theFun(anActor);
+ }
+ return theFun;
+ }
+
+ /*!For each actor(for ex: someActor) from \a theCollection(that can be dynamic cast to type TActor and \n
+ * method \a thePredicate(someActor) return true) \n
+ * Call method \a theFun(someActor)
+ */
+ template<typename TActor, typename TPredicate, typename TFunction>
+ TFunction ForEachIf(vtkActorCollection *theCollection,
+ TPredicate thePredicate,
+ TFunction theFun)
+ {
+ if(theCollection){
+ theCollection->InitTraversal();
+ while(vtkActor *anAct = theCollection->GetNextActor())
+ if(TActor *anActor = dynamic_cast<TActor*>(anAct))
+ if(thePredicate(anActor))
+ theFun(anActor);
+ }
+ return theFun;
+ }
+
+ /*!Find actor from collection, that can be dynamicaly cast to \a TActor, \n
+ *and method \a thePredicate(someActor) return true) \n
+ *\retval someActor
+ */
+ template<typename TActor, typename TPredicate>
+ TActor* Find(vtkActorCollection *theCollection, TPredicate thePredicate)
+ {
+ if(theCollection){
+ theCollection->InitTraversal();
+ while(vtkActor *anAct = theCollection->GetNextActor())
+ if(TActor *anActor = dynamic_cast<TActor*>(anAct))
+ if(thePredicate(anActor))
+ return anActor;
+ }
+ return NULL;
+ }
+
+}
+
+#endif
--- /dev/null
+// SALOME OBJECT : kernel of SALOME component
+//
+// Copyright (C) 2003 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
+//
+//
+//
+// File : VTKViewer_GeometryFilter.cxx
+// Author :
+// Module : SALOME
+// $Header$
+
+#include "VTKViewer_AppendFilter.h"
+
+#include <vtkCell.h>
+#include <vtkCellData.h>
+#include <vtkDataSetAttributes.h>
+#include <vtkDataSetCollection.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+
+#include <vtkPoints.h>
+
+#if defined __GNUC__
+ #if __GNUC__ == 2
+ #define __GNUC_2__
+ #endif
+#endif
+
+vtkCxxRevisionMacro(VTKViewer_AppendFilter, "$Revision$");
+vtkStandardNewMacro(VTKViewer_AppendFilter);
+
+VTKViewer_AppendFilter
+::VTKViewer_AppendFilter()
+{
+ myDoMappingFlag = false;
+}
+
+VTKViewer_AppendFilter
+::~VTKViewer_AppendFilter()
+{}
+
+void
+VTKViewer_AppendFilter
+::SetDoMappingFlag(const bool theFlag)
+{
+ if(myDoMappingFlag == theFlag)
+ return;
+
+ myDoMappingFlag = theFlag;
+
+ this->Modified();
+}
+
+bool
+VTKViewer_AppendFilter
+::DoMappingFlag() const
+{
+ return myDoMappingFlag;
+}
+
+void
+VTKViewer_AppendFilter
+::SetSharedPointsDataSet(vtkPointSet* thePointsDataSet)
+{
+ if(GetSharedPointsDataSet() == thePointsDataSet)
+ return;
+
+ mySharedPointsDataSet = thePointsDataSet;
+
+ Modified();
+}
+
+vtkPointSet*
+VTKViewer_AppendFilter
+::GetSharedPointsDataSet()
+{
+ return mySharedPointsDataSet.GetPointer();
+}
+
+int
+VTKViewer_AppendFilter
+::RequestData(
+ vtkInformation *request,
+ vtkInformationVector **inputVector,
+ vtkInformationVector *outputVector)
+{
+ int aRet = 0;
+ if(GetSharedPointsDataSet())
+ aRet = MakeOutput(request,inputVector,outputVector);
+ else
+ aRet = Superclass::RequestData(request,inputVector,outputVector);
+
+ if(myDoMappingFlag)
+ DoMapping();
+
+ return aRet;
+}
+
+
+void
+VTKViewer_AppendFilter
+::DoMapping()
+{
+ myNodeRanges.clear();
+ myCellRanges.clear();
+
+ vtkIdType aPntStartId = 0;
+ vtkIdType aCellStartId = 0;
+
+ for(vtkIdType aDataSetId = 0; aDataSetId < this->GetNumberOfInputPorts(); ++aDataSetId){
+ vtkDataSet* aDataSet = (vtkDataSet *)(this->GetInput(aDataSetId));
+ // Do mapping of the nodes
+ if(!GetSharedPointsDataSet()){
+ vtkIdType aNbPnts = aDataSet->GetNumberOfPoints();
+ myNodeRanges.push_back(aPntStartId + aNbPnts);
+ aPntStartId += aNbPnts;
+ }
+ // Do mapping of the cells
+ vtkIdType aNbCells = aDataSet->GetNumberOfCells();
+ myCellRanges.push_back(aCellStartId + aNbCells);
+ aCellStartId += aNbCells;
+ }
+}
+
+namespace
+{
+ inline
+ vtkIdType
+ GetOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID,
+ const VTKViewer_AppendFilter::TVectorIds& theRanges)
+ {
+ theInputID = theInputDataSetID = -1;
+
+ vtkIdType aNbInputs = theRanges.size();
+ if(theInputDataSetID < 0 || theInputDataSetID >= aNbInputs)
+ return -1;
+
+ vtkIdType aStartId = theRanges[theInputDataSetID];
+ return aStartId + theInputID;
+ }
+}
+
+vtkIdType
+VTKViewer_AppendFilter
+::GetPointOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID)
+{
+ if(GetSharedPointsDataSet())
+ return theInputID;
+
+ return GetOutputID(theInputID,theInputDataSetID,myNodeRanges);
+}
+
+
+vtkIdType
+VTKViewer_AppendFilter
+::GetCellOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID)
+{
+ if(GetSharedPointsDataSet())
+ return theInputID;
+
+ return GetOutputID(theInputID,theInputDataSetID,myCellRanges);
+}
+
+
+namespace
+{
+ void
+ GetInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID,
+ const VTKViewer_AppendFilter::TVectorIds& theRanges)
+ {
+ theInputID = theStartID = theInputDataSetID = -1;
+
+ if(theRanges.empty())
+ return;
+
+ const vtkIdType& aRangeEnd = theRanges.back();
+ if(theOutputID < 0 || theOutputID >= aRangeEnd)
+ return;
+
+ vtkIdType aStartId = 0;
+ vtkIdType aNbInputs = theRanges.size();
+ for(vtkIdType aDataSetId = 0; aDataSetId < aNbInputs; ++aDataSetId){
+ vtkIdType aRange = theRanges[aDataSetId];
+ if(aRange > theOutputID){
+ theInputID = theOutputID - aStartId;
+ theInputDataSetID = aDataSetId;
+ theStartID = aStartId;
+ break;
+ }
+ aStartId = aRange;
+ }
+ }
+}
+
+void
+VTKViewer_AppendFilter
+::GetPointInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID)
+{
+ if(GetSharedPointsDataSet()) {
+ theStartID = theInputDataSetID = 0;
+ theInputID = theOutputID;
+ return;
+ }
+
+ ::GetInputID(theOutputID,
+ theInputID,
+ theStartID,
+ theInputDataSetID,
+ myNodeRanges);
+}
+
+
+void
+VTKViewer_AppendFilter
+::GetCellInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID)
+{
+ ::GetInputID(theOutputID,
+ theInputID,
+ theStartID,
+ theInputDataSetID,
+ myCellRanges);
+}
+
+
+int
+VTKViewer_AppendFilter
+::MakeOutput(
+ vtkInformation *vtkNotUsed(request),
+ vtkInformationVector **inputVector,
+ vtkInformationVector *outputVector)
+{
+ int idx;
+ vtkIdType numPts, numCells, newCellId, cellId;
+ vtkCellData *cd;
+ vtkIdList *ptIds;
+ vtkDataSet *ds;
+ int numInputs = this->GetNumberOfInputConnections(0);
+
+ // get the output info object
+ vtkInformation *outInfo = outputVector->GetInformationObject(0);
+
+ // get the ouptut
+ vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast(
+ outInfo->Get(vtkDataObject::DATA_OBJECT()));
+ //
+ numPts = mySharedPointsDataSet->GetNumberOfPoints();
+ if (numPts < 1) {
+ return 0;
+ }
+ //
+ numCells = 0;
+ vtkInformation *inInfo = 0;
+ for (idx = 0; idx < numInputs;++idx) {
+ inInfo = inputVector[0]->GetInformationObject(idx);
+ ds = 0;
+ if (inInfo)
+ {
+ ds = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
+ }
+ if (ds != NULL) {
+ if ( ds->GetNumberOfPoints() <= 0 && ds->GetNumberOfCells() <= 0 ) {
+ continue; //no input, just skip
+ }
+ numCells += ds->GetNumberOfCells();
+ }//if non-empty dataset
+ }//for all inputs
+ if (numCells < 1) {
+ return 0;
+ }
+ //
+ // Now can allocate memory
+ output->Allocate(numCells);
+ ptIds = vtkIdList::New();
+ ptIds->Allocate(VTK_CELL_SIZE);
+ //
+ // Append each input dataset together
+ //
+ // 1.points
+ output->SetPoints(GetSharedPointsDataSet()->GetPoints());
+ output->GetPointData()->PassData(GetSharedPointsDataSet()->GetPointData());
+ // 2.cells
+ for (idx = 0; idx < numInputs; ++idx) {
+ inInfo = inputVector[0]->GetInformationObject(idx);
+ ds = 0;
+ if (inInfo)
+ {
+ ds = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
+ }
+ if (ds != NULL) {
+
+ numCells = ds->GetNumberOfCells();
+ cd = ds->GetCellData();
+ // copy cell and cell data
+ for (cellId=0; cellId<numCells; cellId++) {
+ ds->GetCellPoints(cellId, ptIds);
+ newCellId = output->InsertNextCell(ds->GetCellType(cellId), ptIds);
+ }
+ }
+ }
+ //
+ ptIds->Delete();
+ return 1;
+}
+
+int VTKViewer_AppendFilter::FillInputPortInformation(int, vtkInformation *info)
+{
+ info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataSet");
+ info->Set(vtkAlgorithm::INPUT_IS_REPEATABLE(), 1);
+ return 1;
+}
--- /dev/null
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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 VTKVIEWER_APPENDFILTER_H
+#define VTKVIEWER_APPENDFILTER_H
+
+#include "VTKViewer.h"
+
+#include <vtkAppendFilter.h>
+#include <vtkSmartPointer.h>
+
+#include <vector>
+#include <map>
+
+class vtkPointSet;
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+/*! \brief This class used same as vtkAppendFilter. See documentation on VTK for more information.
+ */
+class VTKVIEWER_EXPORT VTKViewer_AppendFilter : public vtkAppendFilter
+{
+public:
+ /*! \fn static VTKViewer_AppendFilter *New()
+ */
+ static VTKViewer_AppendFilter *New();
+
+ /*! \fn vtkTypeRevisionMacro(VTKViewer_AppendFilter, vtkAppendFilter)
+ * \brief VTK type revision macros.
+ */
+ vtkTypeRevisionMacro(VTKViewer_AppendFilter, vtkAppendFilter);
+
+ void SetDoMappingFlag(const bool theFlag);
+
+ bool DoMappingFlag() const;
+
+ void
+ SetSharedPointsDataSet(vtkPointSet* thePointsDataSet);
+
+ vtkPointSet*
+ GetSharedPointsDataSet();
+
+ vtkIdType
+ GetPointOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID);
+
+ vtkIdType
+ GetCellOutputID(vtkIdType theInputID,
+ vtkIdType theInputDataSetID);
+
+ void
+ GetPointInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID);
+
+ void
+ GetCellInputID(vtkIdType theOutputID,
+ vtkIdType& theInputID,
+ vtkIdType& theStartID,
+ vtkIdType& theInputDataSetID);
+
+ typedef std::vector<vtkIdType> TVectorIds;
+
+protected:
+ /*! \fn VTKViewer_AppendFilter();
+ * \brief Constructor
+ */
+ VTKViewer_AppendFilter();
+ /*! \fn ~VTKViewer_AppendFilter();
+ * \brief Destructor.
+ */
+ ~VTKViewer_AppendFilter();
+
+ // Usual data generation method
+ virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+
+ virtual int FillInputPortInformation(int port, vtkInformation *info);
+
+ void DoMapping();
+
+ void Reset();
+
+ int MakeOutput(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+
+ bool myDoMappingFlag;
+ TVectorIds myNodeRanges;
+ TVectorIds myCellRanges;
+ vtkSmartPointer<vtkPointSet> mySharedPointsDataSet;
+};
+
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
+#endif
--- /dev/null
+// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+// Copyright (C) 2003 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
+//
+//
+//
+// File :
+// Author :
+// Module :
+// $Header$
+
+#include "VTKViewer_CellLocationsArray.h"
+
+#include <vtkObjectFactory.h>
+
+vtkStandardNewMacro(VTKViewer_CellLocationsArray);
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 VTKVIEWER_CELLLOCATIONS_H
+#define VTKVIEWER_CELLLOCATIONS_H
+
+#include "VTKViewer.h"
+
+#if ((VTK_MAJOR_VERSION == 4) && (VTK_MINOR_VERSION >= 4)) || (VTK_MAJOR_VERSION > 4)
+# include <vtkIdTypeArray.h>
+# define TCellLocationsArray vtkIdTypeArray
+#else
+# include <vtkIntArray.h>
+# define TCellLocationsArray vtkIntArray
+#endif
+
+struct VTKVIEWER_EXPORT VTKViewer_CellLocationsArray : TCellLocationsArray
+{
+ static VTKViewer_CellLocationsArray* New();
+
+ vtkTypeMacro(VTKViewer_CellLocationsArray,TCellLocationsArray);
+};
+
+#undef TCellLocationsArray
+
+#endif
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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
+//
+// 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 "VTKViewer_ConvexTool.h"
+
+#include <set>
+#include <map>
+
+#ifdef WIN32
+#include <algorithm>
+#endif
+
+#include <vtkUnstructuredGrid.h>
+#include <vtkGeometryFilter.h>
+#include <vtkDelaunay3D.h>
+#include <vtkGenericCell.h>
+#include <vtkPolyData.h>
+#include <vtkCellData.h>
+#include <vtkPoints.h>
+#include <vtkIdList.h>
+#include <vtkCell.h>
+#include <vtkPlane.h>
+#include <vtkMath.h>
+
+#ifdef _DEBUG_
+static int DEBUG_TRIA_EXECUTE = 0;
+#else
+static int DEBUG_TRIA_EXECUTE = 0;
+#endif
+
+namespace
+{
+ typedef std::vector<vtkIdType> TConnectivities;
+
+ struct TPolygon
+ {
+ TConnectivities myConnectivities;
+ vtkFloatingPointType myOrigin[3];
+ vtkFloatingPointType myNormal[3];
+ TPolygon(const TConnectivities& theConnectivities,
+ vtkFloatingPointType theOrigin[3],
+ vtkFloatingPointType theNormal[3]):
+ myConnectivities(theConnectivities)
+ {
+ myOrigin[0] = theOrigin[0];
+ myOrigin[1] = theOrigin[1];
+ myOrigin[2] = theOrigin[2];
+
+ myNormal[0] = theNormal[0];
+ myNormal[1] = theNormal[1];
+ myNormal[2] = theNormal[2];
+ }
+ };
+
+ typedef std::vector<TPolygon> TPolygons;
+}
+
+/*!
+ Constructor
+*/
+VTKViewer_Triangulator
+::VTKViewer_Triangulator():
+ myInput(NULL),
+ myCellId(-1),
+ myShowInside(-1),
+ myAllVisible(-1),
+ myCellsVisibility(NULL),
+ myCellIds(vtkIdList::New())
+{}
+
+
+/*!
+ Destructor
+*/
+VTKViewer_Triangulator
+::~VTKViewer_Triangulator()
+{
+ myCellIds->Delete();
+}
+
+
+
+bool
+VTKViewer_Triangulator
+::Execute(vtkUnstructuredGrid *theInput,
+ vtkCellData* thInputCD,
+ vtkIdType theCellId,
+ int theShowInside,
+ int theAllVisible,
+ const char* theCellsVisibility,
+ vtkPolyData *theOutput,
+ vtkCellData* theOutputCD,
+ int theStoreMapping,
+ std::vector<vtkIdType>& theVTK2ObjIds,
+ bool theIsCheckConvex)
+{
+ myInput = theInput;
+ myCellId = theCellId;
+ myShowInside = theShowInside;
+ myAllVisible = theAllVisible;
+ myCellsVisibility = theCellsVisibility;
+
+ vtkPoints *aPoints = InitPoints();
+ vtkIdType aNumPts = GetNbOfPoints();
+ if(DEBUG_TRIA_EXECUTE) cout<<"Triangulator - aNumPts = "<<aNumPts<<"\n";
+
+ if(aNumPts == 0)
+ return true;
+
+ // To calculate the bary center of the cell
+ vtkFloatingPointType aCellCenter[3] = {0.0, 0.0, 0.0};
+ {
+ vtkFloatingPointType aPntCoord[3];
+ for (int aPntId = 0; aPntId < aNumPts; aPntId++) {
+ aPoints->GetPoint(GetPointId(aPntId),aPntCoord);
+ if(DEBUG_TRIA_EXECUTE) cout<<"\taPntId = "<<GetPointId(aPntId)<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"}\n";
+ aCellCenter[0] += aPntCoord[0];
+ aCellCenter[1] += aPntCoord[1];
+ aCellCenter[2] += aPntCoord[2];
+ }
+ aCellCenter[0] /= aNumPts;
+ aCellCenter[1] /= aNumPts;
+ aCellCenter[2] /= aNumPts;
+ }
+
+ vtkFloatingPointType aCellLength = GetCellLength();
+ int aNumFaces = GetNumFaces();
+
+ static vtkFloatingPointType EPS = 1.0E-2;
+ vtkFloatingPointType aDistEps = aCellLength/3.0 * EPS;
+ if(DEBUG_TRIA_EXECUTE) cout<<"\taCellLength = "<<aCellLength<<"; aDistEps = "<<aDistEps<<"\n";
+
+ // To initialize set of points that belong to the cell
+ typedef std::set<vtkIdType> TPointIds;
+ TPointIds anInitialPointIds;
+ for(vtkIdType aPntId = 0; aPntId < aNumPts; aPntId++)
+ anInitialPointIds.insert(GetPointId(aPntId));
+
+ // To initialize set of points by face that belong to the cell and backward
+ typedef std::set<vtkIdType> TFace2Visibility;
+ TFace2Visibility aFace2Visibility;
+
+ typedef std::set<TPointIds> TFace2PointIds;
+ TFace2PointIds aFace2PointIds;
+
+ for (int aFaceId = 0; aFaceId < aNumFaces; aFaceId++) {
+ vtkCell* aFace = GetFace(aFaceId);
+
+ GetCellNeighbors(theCellId, aFace, myCellIds);
+ if((!myAllVisible && !myCellsVisibility[myCellIds->GetId(0)]) ||
+ myCellIds->GetNumberOfIds() <= 0 || myShowInside)
+ {
+ TPointIds aPointIds;
+ vtkIdList *anIdList = aFace->PointIds;
+ aPointIds.insert(anIdList->GetId(0));
+ aPointIds.insert(anIdList->GetId(1));
+ aPointIds.insert(anIdList->GetId(2));
+
+ aFace2PointIds.insert(aPointIds);
+ aFace2Visibility.insert(aFaceId);
+ }
+ }
+
+
+ ::TPolygons aPolygons;
+
+ for (int aFaceId = 0; aFaceId < aNumFaces; aFaceId++) {
+ if(aFace2Visibility.find(aFaceId) == aFace2Visibility.end())
+ continue;
+
+ vtkCell* aFace = GetFace(aFaceId);
+
+ vtkIdList *anIdList = aFace->PointIds;
+ vtkIdType aNewPts[3] = {anIdList->GetId(0), anIdList->GetId(1), anIdList->GetId(2)};
+
+ // To initialize set of points for the plane where the trinangle face belong to
+ TPointIds aPointIds;
+ aPointIds.insert(aNewPts[0]);
+ aPointIds.insert(aNewPts[1]);
+ aPointIds.insert(aNewPts[2]);
+
+ // To get know, if the points of the trinagle were already observed
+ bool anIsObserved = aFace2PointIds.find(aPointIds) == aFace2PointIds.end();
+ if(DEBUG_TRIA_EXECUTE) {
+ cout<<"\taFaceId = "<<aFaceId<<"; anIsObserved = "<<anIsObserved;
+ cout<<"; aNewPts = {"<<aNewPts[0]<<", "<<aNewPts[1]<<", "<<aNewPts[2]<<"}\n";
+ }
+
+ if(!anIsObserved){
+ // To get coordinates of the points of the traingle face
+ vtkFloatingPointType aCoord[3][3];
+ aPoints->GetPoint(aNewPts[0],aCoord[0]);
+ aPoints->GetPoint(aNewPts[1],aCoord[1]);
+ aPoints->GetPoint(aNewPts[2],aCoord[2]);
+
+ /* To calculate plane normal for face (aFace)
+
+
+ ^ aNormal
+ |
+ | ^ aVector01
+ | /
+ /_________> aVector02
+
+
+ */
+ vtkFloatingPointType aVector01[3] = { aCoord[1][0] - aCoord[0][0],
+ aCoord[1][1] - aCoord[0][1],
+ aCoord[1][2] - aCoord[0][2] };
+
+ vtkFloatingPointType aVector02[3] = { aCoord[2][0] - aCoord[0][0],
+ aCoord[2][1] - aCoord[0][1],
+ aCoord[2][2] - aCoord[0][2] };
+
+ vtkMath::Normalize(aVector01);
+ vtkMath::Normalize(aVector02);
+
+ // To calculate the normal for the triangle
+ vtkFloatingPointType aNormal[3];
+ vtkMath::Cross(aVector02,aVector01,aNormal);
+
+ vtkMath::Normalize(aNormal);
+
+ // To calculate what points belong to the plane
+ // To calculate bounds of the point set
+ vtkFloatingPointType aCenter[3] = {0.0, 0.0, 0.0};
+ {
+ TPointIds::const_iterator anIter = anInitialPointIds.begin();
+ TPointIds::const_iterator anEndIter = anInitialPointIds.end();
+ for(; anIter != anEndIter; anIter++){
+ vtkFloatingPointType aPntCoord[3];
+ vtkIdType aPntId = *anIter;
+ aPoints->GetPoint(aPntId,aPntCoord);
+
+ vtkFloatingPointType aVector0Pnt[3] = { aPntCoord[0] - aCoord[0][0],
+ aPntCoord[1] - aCoord[0][1],
+ aPntCoord[2] - aCoord[0][2] };
+
+
+ vtkMath::Normalize(aVector0Pnt);
+
+ vtkFloatingPointType aNormalPnt[3];
+ // calculate aNormalPnt
+ {
+ vtkFloatingPointType aCosPnt01 = vtkMath::Dot(aVector0Pnt,aVector01);
+ vtkFloatingPointType aCosPnt02 = vtkMath::Dot(aVector0Pnt,aVector02);
+ if(aCosPnt01<-1)
+ aCosPnt01 = -1;
+ if(aCosPnt01>1)
+ aCosPnt01 = 1;
+ if(aCosPnt02<-1)
+ aCosPnt02 = -1;
+ if(aCosPnt02>1)
+ aCosPnt02 = 1;
+
+ vtkFloatingPointType aDist01,aDist02;// deflection from Pi/3 angle (equilateral triangle)
+ vtkFloatingPointType aAngPnt01 = fabs(acos(aCosPnt01));
+ vtkFloatingPointType aAngPnt02 = fabs(acos(aCosPnt02));
+
+ /* check that triangle similar to equilateral triangle
+ AOC or COB ?
+ aVector0Pnt = (OC)
+ aVector01 = (OB)
+ aVector02 = (OA)
+
+ B
+ ^ aVector01 C
+ | ^ aVector0Pnt
+ | _____/
+ | ___/
+ |/________> aVector02
+ O A
+ */
+ aDist01 = fabs(aAngPnt01-(vtkMath::Pi())/3.0);
+ aDist02 = fabs(aAngPnt02-(vtkMath::Pi())/3.0);
+
+ // caculate a normal for best triangle
+ if(aDist01 <= aDist02)
+ vtkMath::Cross(aVector0Pnt,aVector01,aNormalPnt);
+ else
+ vtkMath::Cross(aVector0Pnt,aVector02,aNormalPnt);
+
+ }
+
+ vtkMath::Normalize(aNormalPnt);
+
+ if(DEBUG_TRIA_EXECUTE)
+ cout<<"\t\taPntId = "<<aPntId<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"};";
+
+ vtkFloatingPointType aDist = vtkPlane::DistanceToPlane(aPntCoord,aNormal,aCoord[0]);
+ if(DEBUG_TRIA_EXECUTE) cout<<": aDist = "<<aDist;
+ if(fabs(aDist) < aDistEps){
+ aPointIds.insert(aPntId);
+ aCenter[0] += aPntCoord[0];
+ aCenter[1] += aPntCoord[1];
+ aCenter[2] += aPntCoord[2];
+ if(DEBUG_TRIA_EXECUTE) cout << "Added = TRUE" << endl;
+ } else {
+ if(DEBUG_TRIA_EXECUTE) cout << "Added = FALSE" << endl;
+ }
+ }
+ int aNbPoints = aPointIds.size();
+ aCenter[0] /= aNbPoints;
+ aCenter[1] /= aNbPoints;
+ aCenter[2] /= aNbPoints;
+ }
+
+ //To sinchronize orientation of the cell and its face
+ vtkFloatingPointType aVectorC[3] = { aCenter[0] - aCellCenter[0],
+ aCenter[1] - aCellCenter[1],
+ aCenter[2] - aCellCenter[2] };
+ vtkMath::Normalize(aVectorC);
+
+ vtkFloatingPointType aDot = vtkMath::Dot(aNormal,aVectorC);
+ if(DEBUG_TRIA_EXECUTE) {
+ cout<<"\t\taNormal = {"<<aNormal[0]<<", "<<aNormal[1]<<", "<<aNormal[2]<<"}";
+ cout<<"; aVectorC = {"<<aVectorC[0]<<", "<<aVectorC[1]<<", "<<aVectorC[2]<<"}\n";
+ cout<<"\t\taDot = "<<aDot<<"\n";
+ }
+ if(aDot > 0){
+ aNormal[0] = -aNormal[0];
+ aNormal[1] = -aNormal[1];
+ aNormal[2] = -aNormal[2];
+ }
+
+ // To calculate the primary direction for point set
+ vtkFloatingPointType aVector0[3] = { aCoord[0][0] - aCenter[0],
+ aCoord[0][1] - aCenter[1],
+ aCoord[0][2] - aCenter[2] };
+ vtkMath::Normalize(aVector0);
+
+ if(DEBUG_TRIA_EXECUTE) {
+ cout<<"\t\taCenter = {"<<aCenter[0]<<", "<<aCenter[1]<<", "<<aCenter[2]<<"}";
+ cout<<"; aVector0 = {"<<aVector0[0]<<", "<<aVector0[1]<<", "<<aVector0[2]<<"}\n";
+ }
+
+ // To calculate the set of points by face those that belong to the plane
+ TFace2PointIds aRemoveFace2PointIds;
+ {
+ TFace2PointIds::const_iterator anIter = aFace2PointIds.begin();
+ TFace2PointIds::const_iterator anEndIter = aFace2PointIds.end();
+ for(; anIter != anEndIter; anIter++){
+ const TPointIds& anIds = *anIter;
+ TPointIds anIntersection;
+ std::set_intersection(aPointIds.begin(),aPointIds.end(),
+ anIds.begin(),anIds.end(),
+ std::inserter(anIntersection,anIntersection.begin()));
+
+
+ if(DEBUG_TRIA_EXECUTE) {
+ cout << "anIntersection:";
+ TPointIds::iterator aII = anIntersection.begin();
+ for(;aII!=anIntersection.end();aII++)
+ cout << *aII << ",";
+ cout << endl;
+ cout << "anIds :";
+ TPointIds::const_iterator aIIds = anIds.begin();
+ for(;aIIds!=anIds.end();aIIds++)
+ cout << *aIIds << ",";
+ cout << endl;
+ }
+ if(anIntersection == anIds){
+ aRemoveFace2PointIds.insert(anIds);
+ }
+ }
+ }
+
+ // To remove from the set of points by face those that belong to the plane
+ {
+ TFace2PointIds::const_iterator anIter = aRemoveFace2PointIds.begin();
+ TFace2PointIds::const_iterator anEndIter = aRemoveFace2PointIds.end();
+ for(; anIter != anEndIter; anIter++){
+ const TPointIds& anIds = *anIter;
+ aFace2PointIds.erase(anIds);
+ }
+ }
+
+ // To sort the planar set of the points accrding to the angle
+ {
+ typedef std::map<vtkFloatingPointType,vtkIdType> TSortedPointIds;
+ TSortedPointIds aSortedPointIds;
+
+ TPointIds::const_iterator anIter = aPointIds.begin();
+ TPointIds::const_iterator anEndIter = aPointIds.end();
+ for(; anIter != anEndIter; anIter++){
+ vtkFloatingPointType aPntCoord[3];
+ vtkIdType aPntId = *anIter;
+ aPoints->GetPoint(aPntId,aPntCoord);
+ vtkFloatingPointType aVector[3] = { aPntCoord[0] - aCenter[0],
+ aPntCoord[1] - aCenter[1],
+ aPntCoord[2] - aCenter[2] };
+ vtkMath::Normalize(aVector);
+
+ vtkFloatingPointType aCross[3];
+ vtkMath::Cross(aVector,aVector0,aCross);
+ vtkFloatingPointType aCr = vtkMath::Dot(aCross,aNormal);
+ bool aGreaterThanPi = aCr < 0;
+ vtkFloatingPointType aCosinus = vtkMath::Dot(aVector,aVector0);
+ vtkFloatingPointType anAngle = 0.0;
+ if(aCosinus >= 1.0){
+ aCosinus = 1.0;
+ } else if (aCosinus <= -1.0){
+ aCosinus = -1.0;
+ anAngle = vtkMath::Pi();
+ } else {
+ anAngle = acos(aCosinus);
+ if(aGreaterThanPi)
+ anAngle = 2*vtkMath::Pi() - anAngle;
+ }
+
+ if(DEBUG_TRIA_EXECUTE) {
+ cout << "\t\t\t vtkMath::Dot(aCross,aNormal)="<<aCr<<endl;
+ cout<<"\t\t\taPntId = "<<aPntId<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"}";
+ cout<<"; aGreaterThanPi = "<<aGreaterThanPi<<"; aCosinus = "<<aCosinus<<"; anAngle = "<<anAngle<<"\n";
+ }
+ aSortedPointIds[anAngle] = aPntId;
+ }
+
+ if(!aSortedPointIds.empty()){
+ int aNumFacePts = aSortedPointIds.size();
+ ::TConnectivities aConnectivities(aNumFacePts);
+ TSortedPointIds::const_iterator anIter = aSortedPointIds.begin();
+ TSortedPointIds::const_iterator anEndIter = aSortedPointIds.end();
+ if(DEBUG_TRIA_EXECUTE) cout << "Polygon:";
+ for(vtkIdType anId = 0; anIter != anEndIter; anIter++, anId++){
+ vtkIdType aPntId = anIter->second;
+ aConnectivities[anId] = GetConnectivity(aPntId);
+ if(DEBUG_TRIA_EXECUTE) cout << aPntId << ",";
+ }
+ if(DEBUG_TRIA_EXECUTE) cout << endl;
+ aPolygons.push_back(::TPolygon(aConnectivities,aCenter,aNormal));
+ }
+ }
+ }
+ }
+ if(aPolygons.empty())
+ return true;
+
+ // To check, whether the polygons give a convex polyhedron or not
+ if(theIsCheckConvex){
+ int aNbPolygons = aPolygons.size();
+ for (int aPolygonId = 0; aPolygonId < aNbPolygons; aPolygonId++) {
+ ::TPolygon& aPolygon = aPolygons[aPolygonId];
+ vtkFloatingPointType* aNormal = aPolygon.myNormal;
+ vtkFloatingPointType* anOrigin = aPolygon.myOrigin;
+ if(DEBUG_TRIA_EXECUTE) {
+ cout<<"\taPolygonId = "<<aPolygonId<<"\n";
+ cout<<"\t\taNormal = {"<<aNormal[0]<<", "<<aNormal[1]<<", "<<aNormal[2]<<"}";
+ cout<<"; anOrigin = {"<<anOrigin[0]<<", "<<anOrigin[1]<<", "<<anOrigin[2]<<"}\n";
+ }
+ for(vtkIdType aPntId = 0; aPntId < aNumPts; aPntId++){
+ vtkFloatingPointType aPntCoord[3];
+ vtkIdType anId = GetPointId(aPntId);
+ aPoints->GetPoint(anId,aPntCoord);
+ vtkFloatingPointType aDist = vtkPlane::Evaluate(aNormal,anOrigin,aPntCoord);
+ if(DEBUG_TRIA_EXECUTE) cout<<"\t\taPntId = "<<anId<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"}; aDist = "<<aDist<<"\n";
+ if(aDist < -aDistEps)
+ return false;
+ }
+ }
+ }
+
+
+ // To pass resulting set of the polygons to the output
+ {
+ int aNbPolygons = aPolygons.size();
+ for (int aPolygonId = 0; aPolygonId < aNbPolygons; aPolygonId++) {
+ ::TPolygon& aPolygon = aPolygons[aPolygonId];
+ if(DEBUG_TRIA_EXECUTE) cout << "PoilygonId="<<aPolygonId<<" | ";
+ TConnectivities& aConnectivities = aPolygon.myConnectivities;
+ if(DEBUG_TRIA_EXECUTE) {
+ for(int i=0;i<aConnectivities.size();i++)
+ cout << aConnectivities[i] << ",";
+ cout << endl;
+ }
+ int aNbPoints = aConnectivities.size();
+ vtkIdType aNewCellId = theOutput->InsertNextCell(VTK_POLYGON,aNbPoints,&aConnectivities[0]);
+ if(theStoreMapping)
+ theVTK2ObjIds.push_back(theCellId);
+ theOutputCD->CopyData(thInputCD,theCellId,aNewCellId);
+ }
+ }
+
+ if(DEBUG_TRIA_EXECUTE) cout<<"\tTriangulator - Ok\n";
+
+ return true;
+}
+
+/*!
+ Constructor
+*/
+VTKViewer_OrderedTriangulator
+::VTKViewer_OrderedTriangulator():
+ myCell(vtkGenericCell::New())
+{}
+
+/*!
+ Destructor
+*/
+VTKViewer_OrderedTriangulator
+::~VTKViewer_OrderedTriangulator()
+{
+ myCell->Delete();
+}
+
+vtkPoints*
+VTKViewer_OrderedTriangulator
+::InitPoints()
+{
+ myInput->GetCell(myCellId,myCell);
+ return myInput->GetPoints();
+}
+
+vtkIdType
+VTKViewer_OrderedTriangulator
+::GetNbOfPoints()
+{
+ return myCell->GetNumberOfPoints();
+}
+
+vtkIdType
+VTKViewer_OrderedTriangulator
+::GetPointId(vtkIdType thePointId)
+{
+ return myCell->GetPointId(thePointId);
+}
+
+vtkFloatingPointType
+VTKViewer_OrderedTriangulator
+::GetCellLength()
+{
+ return sqrt(myCell->GetLength2());
+}
+
+vtkIdType
+VTKViewer_OrderedTriangulator
+::GetNumFaces()
+{
+ return myCell->GetNumberOfFaces();
+}
+
+vtkCell*
+VTKViewer_OrderedTriangulator
+::GetFace(vtkIdType theFaceId)
+{
+ return myCell->GetFace(theFaceId);
+}
+
+void
+VTKViewer_OrderedTriangulator
+::GetCellNeighbors(vtkIdType theCellId,
+ vtkCell* theFace,
+ vtkIdList* theCellIds)
+{
+ vtkIdList *anIdList = theFace->PointIds;
+ myInput->GetCellNeighbors(theCellId, anIdList, theCellIds);
+}
+
+vtkIdType
+VTKViewer_OrderedTriangulator
+::GetConnectivity(vtkIdType thePntId)
+{
+ return thePntId;
+}
+
+/*!
+ Constructor
+*/
+VTKViewer_DelaunayTriangulator
+::VTKViewer_DelaunayTriangulator():
+ myUnstructuredGrid(vtkUnstructuredGrid::New()),
+ myGeometryFilter(vtkGeometryFilter::New()),
+ myDelaunay3D(vtkDelaunay3D::New()),
+ myFaceIds(vtkIdList::New()),
+ myPoints(vtkPoints::New()),
+ myPolyData(NULL),
+ myPointIds(NULL)
+{
+ myDelaunay3D->SetInput(myUnstructuredGrid);
+ myGeometryFilter->SetInput(myDelaunay3D->GetOutput());
+}
+
+
+
+/*!
+ Destructor
+*/
+VTKViewer_DelaunayTriangulator
+::~VTKViewer_DelaunayTriangulator()
+{
+ myUnstructuredGrid->Delete();
+ myGeometryFilter->Delete();
+ myDelaunay3D->Delete();
+ myFaceIds->Delete();
+ myPoints->Delete();
+}
+
+
+vtkPoints*
+VTKViewer_DelaunayTriangulator
+::InitPoints()
+{
+ myPoints->Reset();
+ myUnstructuredGrid->Initialize();
+ myUnstructuredGrid->Allocate();
+ myUnstructuredGrid->SetPoints(myPoints);
+
+ vtkIdType aNumPts;
+ myInput->GetCellPoints(myCellId,aNumPts,myPointIds);
+
+ if ( aNumPts < myPoints->GetNumberOfPoints() )
+ myPoints->Reset();
+
+ {
+ vtkFloatingPointType aPntCoord[3];
+ myPoints->SetNumberOfPoints(aNumPts);
+ vtkPoints *anInputPoints = myInput->GetPoints();
+ for (int aPntId = 0; aPntId < aNumPts; aPntId++) {
+ anInputPoints->GetPoint(myPointIds[aPntId],aPntCoord);
+ myPoints->SetPoint(aPntId,aPntCoord);
+ }
+ }
+
+ myPoints->Modified();
+ myUnstructuredGrid->Modified();
+
+ myGeometryFilter->Update();
+ myPolyData = myGeometryFilter->GetOutput();
+
+ return myPoints;
+}
+
+vtkIdType
+VTKViewer_DelaunayTriangulator
+::GetNbOfPoints()
+{
+ return myPoints->GetNumberOfPoints();
+}
+
+vtkIdType
+VTKViewer_DelaunayTriangulator
+::GetPointId(vtkIdType thePointId)
+{
+ return thePointId;
+}
+
+vtkFloatingPointType
+VTKViewer_DelaunayTriangulator
+::GetCellLength()
+{
+ return myPolyData->GetLength();
+}
+
+vtkIdType
+VTKViewer_DelaunayTriangulator
+::GetNumFaces()
+{
+ return myPolyData->GetNumberOfCells();
+}
+
+vtkCell*
+VTKViewer_DelaunayTriangulator
+::GetFace(vtkIdType theFaceId)
+{
+ return myPolyData->GetCell(theFaceId);
+}
+
+void
+VTKViewer_DelaunayTriangulator
+::GetCellNeighbors(vtkIdType theCellId,
+ vtkCell* theFace,
+ vtkIdList* theCellIds)
+{
+ myFaceIds->Reset();
+ vtkIdList *anIdList = theFace->PointIds;
+ myFaceIds->InsertNextId(myPointIds[anIdList->GetId(0)]);
+ myFaceIds->InsertNextId(myPointIds[anIdList->GetId(1)]);
+ myFaceIds->InsertNextId(myPointIds[anIdList->GetId(2)]);
+
+ myInput->GetCellNeighbors(theCellId, myFaceIds, theCellIds);
+}
+
+
+vtkIdType
+VTKViewer_DelaunayTriangulator
+::GetConnectivity(vtkIdType thePntId)
+{
+ return myPointIds[thePntId];
+}
--- /dev/null
+// Copyright (C) 2003 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 _VTKViewer_ConvexTool_H
+#define _VTKViewer_ConvexTool_H
+
+#include "VTKViewer.h"
+
+#include <vector>
+
+#include <vtkSystemIncludes.h>
+
+class vtkUnstructuredGrid;
+class vtkGeometryFilter;
+class vtkGenericCell;
+class vtkDelaunay3D;
+class vtkPolyData;
+class vtkCellData;
+class vtkPoints;
+class vtkIdList;
+class vtkCell;
+
+class VTKVIEWER_EXPORT VTKViewer_Triangulator
+{
+ public:
+ VTKViewer_Triangulator();
+
+ ~VTKViewer_Triangulator();
+
+ bool
+ Execute(vtkUnstructuredGrid *theInput,
+ vtkCellData* thInputCD,
+ vtkIdType theCellId,
+ int theShowInside,
+ int theAllVisible,
+ const char* theCellsVisibility,
+ vtkPolyData *theOutput,
+ vtkCellData* theOutputCD,
+ int theStoreMapping,
+ std::vector<vtkIdType>& theVTK2ObjIds,
+ bool theIsCheckConvex);
+
+ protected:
+ vtkIdList* myCellIds;
+
+ vtkUnstructuredGrid *myInput;
+ vtkIdType myCellId;
+ int myShowInside;
+ int myAllVisible;
+ const char* myCellsVisibility;
+
+ virtual
+ vtkPoints*
+ InitPoints() = 0;
+
+ virtual
+ vtkIdType
+ GetNbOfPoints() = 0;
+
+ virtual
+ vtkIdType
+ GetPointId(vtkIdType thePointId) = 0;
+
+ virtual
+ vtkFloatingPointType
+ GetCellLength() = 0;
+
+ virtual
+ vtkIdType
+ GetNumFaces() = 0;
+
+ virtual
+ vtkCell*
+ GetFace(vtkIdType theFaceId) = 0;
+
+ virtual
+ void
+ GetCellNeighbors(vtkIdType theCellId,
+ vtkCell* theFace,
+ vtkIdList* theCellIds) = 0;
+
+ virtual
+ vtkIdType
+ GetConnectivity(vtkIdType thePntId) = 0;
+};
+
+
+class VTKVIEWER_EXPORT VTKViewer_OrderedTriangulator : public VTKViewer_Triangulator
+{
+ public:
+
+ VTKViewer_OrderedTriangulator();
+
+ ~VTKViewer_OrderedTriangulator();
+
+ protected:
+ vtkGenericCell *myCell;
+
+ virtual
+ vtkPoints*
+ InitPoints();
+
+ virtual
+ vtkIdType
+ GetNbOfPoints();
+
+ vtkIdType
+ GetPointId(vtkIdType thePointId);
+
+ virtual
+ vtkFloatingPointType
+ GetCellLength();
+
+ virtual
+ vtkIdType
+ GetNumFaces();
+
+ virtual
+ vtkCell*
+ GetFace(vtkIdType theFaceId);
+
+ virtual
+ void
+ GetCellNeighbors(vtkIdType theCellId,
+ vtkCell* theFace,
+ vtkIdList* theCellIds);
+
+ virtual
+ vtkIdType
+ GetConnectivity(vtkIdType thePntId);
+};
+
+
+class VTKVIEWER_EXPORT VTKViewer_DelaunayTriangulator : public VTKViewer_Triangulator
+{
+ public:
+
+ VTKViewer_DelaunayTriangulator();
+
+ ~VTKViewer_DelaunayTriangulator();
+
+ protected:
+ vtkUnstructuredGrid* myUnstructuredGrid;
+ vtkGeometryFilter* myGeometryFilter;
+ vtkDelaunay3D* myDelaunay3D;
+ vtkPolyData* myPolyData;
+ vtkIdType *myPointIds;
+ vtkIdList* myFaceIds;
+ vtkPoints* myPoints;
+
+ virtual
+ vtkPoints*
+ InitPoints();
+
+ virtual
+ vtkIdType
+ GetNbOfPoints();
+
+ vtkIdType
+ GetPointId(vtkIdType thePointId);
+
+ virtual
+ vtkFloatingPointType
+ GetCellLength();
+
+ virtual
+ vtkIdType
+ GetNumFaces();
+
+ virtual
+ vtkCell*
+ GetFace(vtkIdType theFaceId);
+
+ virtual
+ void
+ GetCellNeighbors(vtkIdType theCellId,
+ vtkCell* theFace,
+ vtkIdList* theCellIds);
+
+ virtual
+ vtkIdType
+ GetConnectivity(vtkIdType thePntId);
+};
+
+
+#endif // _VTKViewer_ConvexTool_H
--- /dev/null
+// VISU CONVERTOR :
+//
+// Copyright (C) 2003 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
+//
+//
+// File: VISU_ExtractUnstructuredGrid.cxx
+// Author: Alexey PETROV
+// Module : VISU
+
+
+#include "VTKViewer_ExtractUnstructuredGrid.h"
+#include "VTKViewer_CellLocationsArray.h"
+
+#include <vtkUnsignedCharArray.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkObjectFactory.h>
+#include <vtkCellArray.h>
+#include <vtkIdList.h>
+#include <vtkCell.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+#if defined __GNUC__
+ #if __GNUC__ == 2
+ #define __GNUC_2__
+ #endif
+#endif
+
+vtkStandardNewMacro(VTKViewer_ExtractUnstructuredGrid);
+
+
+VTKViewer_ExtractUnstructuredGrid::VTKViewer_ExtractUnstructuredGrid():
+ myExtractionMode(eCells), myChangeMode(ePassAll)
+{}
+
+
+VTKViewer_ExtractUnstructuredGrid::~VTKViewer_ExtractUnstructuredGrid(){}
+
+
+void VTKViewer_ExtractUnstructuredGrid::RegisterCell(vtkIdType theCellId){
+// if(0 && MYDEBUG) MESSAGE("RegisterCell - theCellId = "<<theCellId);
+ myCellIds.insert(theCellId);
+ Modified();
+}
+
+
+void VTKViewer_ExtractUnstructuredGrid::RegisterCellsWithType(vtkIdType theCellType){
+// if(0 && MYDEBUG) MESSAGE("RegisterCellsWithType - theCellType = "<<theCellType);
+ myCellTypes.insert(theCellType);
+ Modified();
+}
+
+
+void VTKViewer_ExtractUnstructuredGrid::SetStoreMapping(int theStoreMapping){
+ myStoreMapping = theStoreMapping != 0;
+ this->Modified();
+}
+
+vtkIdType VTKViewer_ExtractUnstructuredGrid::GetInputId(int theOutId) const
+{
+ if ( myCellIds.empty() && myCellTypes.empty() )
+ return theOutId;
+
+ if ( myOut2InId.empty() || theOutId > (int)myOut2InId.size() )
+ return -1;
+#if defined __GNUC_2__
+ return myOut2InId[theOutId];
+#else
+ return myOut2InId.at(theOutId);
+#endif
+}
+
+vtkIdType VTKViewer_ExtractUnstructuredGrid::GetOutputId(int theInId) const{
+ if(myCellIds.empty() && myCellTypes.empty()) return theInId;
+ TMapId::const_iterator anIter = myIn2OutId.find(theInId);
+ if(anIter == myIn2OutId.end()) return -1;
+ return anIter->second;
+}
+
+
+inline void InsertCell(vtkUnstructuredGrid *theInput,
+ vtkCellArray *theConnectivity,
+ vtkUnsignedCharArray* theCellTypesArray,
+ vtkIdType theCellId,
+ vtkIdList *theIdList,
+ bool theStoreMapping,
+ vtkIdType theOutId,
+ VTKViewer_ExtractUnstructuredGrid::TVectorId& theOut2InId,
+ VTKViewer_ExtractUnstructuredGrid::TMapId& theIn2OutId)
+{
+ vtkCell *aCell = theInput->GetCell(theCellId);
+ vtkIdList *aPntIds = aCell->GetPointIds();
+ vtkIdType aNbIds = aPntIds->GetNumberOfIds();
+ theIdList->SetNumberOfIds(aNbIds);
+ for(vtkIdType i = 0; i < aNbIds; i++){
+ theIdList->SetId(i,aPntIds->GetId(i));
+ }
+ theConnectivity->InsertNextCell(theIdList);
+
+ vtkIdType aCellType = aCell->GetCellType();
+ theCellTypesArray->InsertNextValue(aCellType);
+ if(theStoreMapping){
+ theOut2InId.push_back(theCellId);
+ theIn2OutId[theCellId] = theOutId;
+ }
+}
+
+inline void InsertPointCell(vtkCellArray *theConnectivity,
+ vtkUnsignedCharArray* theCellTypesArray,
+ vtkIdType theCellId,
+ vtkIdList *theIdList,
+ bool theStoreMapping,
+ vtkIdType theOutId,
+ VTKViewer_ExtractUnstructuredGrid::TVectorId& theOut2InId,
+ VTKViewer_ExtractUnstructuredGrid::TMapId& theIn2OutId)
+{
+ theIdList->SetId(0,theCellId);
+ theConnectivity->InsertNextCell(theIdList);
+ theCellTypesArray->InsertNextValue(VTK_VERTEX);
+ if(theStoreMapping){
+ theOut2InId.push_back(theCellId);
+ theIn2OutId[theCellId] = theOutId;
+ }
+}
+
+
+// int VTKViewer_ExtractUnstructuredGrid::RequestData(
+// vtkInformation *vtkNotUsed(request),
+// vtkInformationVector **inputVector,
+// vtkInformationVector *outputVector)
+void VTKViewer_ExtractUnstructuredGrid::Execute()
+{
+ /*
+ not ported yet to the new executive-based pipeline architecture.
+
+ // get the info objects
+ vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
+ vtkInformation *outInfo = outputVector->GetInformationObject(0);
+
+ // get the input and ouptut
+ vtkUnstructuredGrid *anInput = vtkUnstructuredGrid::SafeDownCast(
+ inInfo->Get(vtkDataObject::DATA_OBJECT()));
+ vtkUnstructuredGrid *anOutput = vtkUnstructuredGrid::SafeDownCast(
+ outInfo->Get(vtkDataObject::DATA_OBJECT()));
+ */
+ vtkUnstructuredGrid *anInput = this->GetInput();
+ vtkUnstructuredGrid *anOutput = this->GetOutput();
+
+ myOut2InId.clear(); myIn2OutId.clear();
+
+/* if(MYDEBUG){
+ MESSAGE("Execute - anInput->GetNumberOfCells() = "<<anInput->GetNumberOfCells());
+ MESSAGE("Execute - myCellTypes.size() = "<<myCellTypes.size());
+ MESSAGE("Execute - myCellIds.size() = "<<myCellIds.size());
+ MESSAGE("Execute - myExtractionMode = "<<myExtractionMode);
+ MESSAGE("Execute - myChangeMode = "<<myChangeMode);
+ }*/
+ if(myExtractionMode == eCells){
+ if(myChangeMode == ePassAll || myCellIds.empty() && myCellTypes.empty() && myChangeMode == eRemoving){
+ if(vtkIdType aNbElems = anInput->GetNumberOfCells()){
+ if(myStoreMapping) myOut2InId.reserve(aNbElems);
+ anOutput->ShallowCopy(anInput);
+ for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
+ if(myStoreMapping){
+ myOut2InId.push_back(aCellId);
+ myIn2OutId[aCellId] = anOutId;
+ }
+ }
+ }
+ }else{
+ vtkIdList *anIdList = vtkIdList::New();
+ vtkCellArray *aConnectivity = vtkCellArray::New();
+ vtkIdType aNbElems = anInput->GetNumberOfCells();
+ aConnectivity->Allocate(2*aNbElems,0);
+ vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+ aCellTypesArray->SetNumberOfComponents(1);
+ aCellTypesArray->Allocate(aNbElems*aCellTypesArray->GetNumberOfComponents());
+ if(!myCellIds.empty() && myCellTypes.empty()){
+ if(myStoreMapping) myOut2InId.reserve(myCellIds.size());
+ if(myChangeMode == eAdding){
+ for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
+ if(myCellIds.find(aCellId) != myCellIds.end()){
+ InsertCell(anInput,aConnectivity,aCellTypesArray,aCellId,anIdList,
+ myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ }
+ }
+ }else{
+ for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
+ if(myCellIds.find(aCellId) == myCellIds.end()){
+ InsertCell(anInput,aConnectivity,aCellTypesArray,aCellId,anIdList,
+ myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ }
+ }
+ }
+ }else if(myCellIds.empty() && !myCellTypes.empty()){
+ if(myChangeMode == eAdding){
+ for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
+ vtkIdType aType = anInput->GetCellType(aCellId);
+ if(myCellTypes.find(aType) != myCellTypes.end()){
+ InsertCell(anInput,aConnectivity,aCellTypesArray,aCellId,anIdList,
+ myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ }
+ }
+ }else{
+ for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
+ vtkIdType aType = anInput->GetCellType(aCellId);
+ if(myCellTypes.find(aType) == myCellTypes.end()){
+ InsertCell(anInput,aConnectivity,aCellTypesArray,aCellId,anIdList,
+ myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ }
+ }
+ }
+ }else if(!myCellIds.empty() && !myCellTypes.empty()){
+ if(myChangeMode == eAdding){
+ for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
+ vtkIdType aType = anInput->GetCellType(aCellId);
+ if(myCellTypes.find(aType) != myCellTypes.end()){
+ if(myCellIds.find(aCellId) != myCellIds.end()){
+ InsertCell(anInput,aConnectivity,aCellTypesArray,aCellId,anIdList,
+ myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ }
+ }
+ }
+ }else{
+ for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
+ vtkIdType aType = anInput->GetCellType(aCellId);
+ if(myCellTypes.find(aType) == myCellTypes.end()){
+ if(myCellIds.find(aCellId) == myCellIds.end()){
+ InsertCell(anInput,aConnectivity,aCellTypesArray,aCellId,anIdList,
+ myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ }
+ }
+ }
+ }
+ }
+ if((aNbElems = aConnectivity->GetNumberOfCells())){
+ VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
+ aCellLocationsArray->SetNumberOfComponents(1);
+ aCellLocationsArray->SetNumberOfTuples(aNbElems);
+ aConnectivity->InitTraversal();
+ for(vtkIdType i = 0, *pts, npts; aConnectivity->GetNextCell(npts,pts); i++){
+ aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
+ }
+ anOutput->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+ anOutput->SetPoints(anInput->GetPoints());
+ aCellLocationsArray->Delete();
+ }
+ aCellTypesArray->Delete();
+ aConnectivity->Delete();
+ anIdList->Delete();
+ }
+ }else{
+ vtkIdList *anIdList = vtkIdList::New();
+ anIdList->SetNumberOfIds(1);
+ vtkCellArray *aConnectivity = vtkCellArray::New();
+ vtkIdType aNbElems = anInput->GetNumberOfPoints();
+ aConnectivity->Allocate(2*aNbElems,0);
+ vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+ aCellTypesArray->SetNumberOfComponents(1);
+ aCellTypesArray->Allocate(aNbElems*aCellTypesArray->GetNumberOfComponents());
+ if(myChangeMode == ePassAll || myCellIds.empty() && myCellTypes.empty() && myChangeMode == eRemoving){
+ if(myStoreMapping) myOut2InId.reserve(aNbElems);
+ for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
+ InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
+ myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ }
+ }else if(!myCellIds.empty() && myCellTypes.empty()){
+ if(myStoreMapping) myOut2InId.reserve(myCellIds.size());
+ if(myChangeMode == eAdding){
+ for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
+ if(myCellIds.find(aCellId) != myCellIds.end()){
+ InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
+ myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ }
+ }
+ }else{
+ for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
+ if(myCellIds.find(aCellId) == myCellIds.end()){
+ InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
+ myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ }
+ }
+ }
+ }else if(myCellIds.empty() && !myCellTypes.empty()){
+ if(myChangeMode == eAdding){
+ for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
+ vtkIdType aType = anInput->GetCellType(aCellId);
+ if(myCellTypes.find(aType) != myCellTypes.end()){
+ InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
+ myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ }
+ }
+ }else{
+ for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
+ vtkIdType aType = anInput->GetCellType(aCellId);
+ if(myCellTypes.find(aType) == myCellTypes.end()){
+ InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
+ myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ }
+ }
+ }
+ }else if(!myCellIds.empty() && !myCellTypes.empty()){
+ if(myChangeMode == eAdding){
+ for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
+ vtkIdType aType = anInput->GetCellType(aCellId);
+ if(myCellTypes.find(aType) != myCellTypes.end()){
+ if(myCellIds.find(aCellId) != myCellIds.end()){
+ InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
+ myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ }
+ }
+ }
+ }else{
+ for(vtkIdType aCellId = 0, anOutId = 0; aCellId < aNbElems; aCellId++,anOutId++){
+ vtkIdType aType = anInput->GetCellType(aCellId);
+ if(myCellTypes.find(aType) == myCellTypes.end()){
+ if(myCellIds.find(aCellId) == myCellIds.end()){
+ InsertPointCell(aConnectivity,aCellTypesArray,aCellId,anIdList,
+ myStoreMapping,anOutId,myOut2InId,myIn2OutId);
+ }
+ }
+ }
+ }
+ }
+ if((aNbElems = aConnectivity->GetNumberOfCells())){
+ VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
+ aCellLocationsArray->SetNumberOfComponents(1);
+ aCellLocationsArray->SetNumberOfTuples(aNbElems);
+ aConnectivity->InitTraversal();
+ for(vtkIdType i = 0, *pts, npts; aConnectivity->GetNextCell(npts,pts); i++){
+ aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
+ }
+ anOutput->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+ anOutput->SetPoints(anInput->GetPoints());
+ aCellLocationsArray->Delete();
+ }
+ aCellTypesArray->Delete();
+ aConnectivity->Delete();
+ anIdList->Delete();
+ }
+/* if(MYDEBUG){
+ MESSAGE("Execute - anOutput->GetNumberOfCells() = "<<anOutput->GetNumberOfCells());
+ if(myStoreMapping){
+ MESSAGE("Execute - myOut2InId.size() = "<<myOut2InId.size());
+ MESSAGE("Execute - myIn2OutId.size() = "<<myIn2OutId.size());
+ }
+ }*/
+// return 1;
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 VTKVIEWER_EXTRACTUNSTRUCTUREDGRID_H
+#define VTKVIEWER_EXTRACTUNSTRUCTUREDGRID_H
+
+#include "VTKViewer.h"
+
+#include <vtkUnstructuredGridToUnstructuredGridFilter.h>
+
+#include <set>
+#include <map>
+#include <vector>
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+/*! \class vtkUnstructuredGridToUnstructuredGridFilter
+ * \brief For more information see <a href="http://www.vtk.org/">VTK documentation</a>
+ */
+/*! \class vtkUnstructuredGridToUnstructuredGridFilter
+ * \brief For more information see VTK documentation.
+ */
+class VTKVIEWER_EXPORT VTKViewer_ExtractUnstructuredGrid : public vtkUnstructuredGridToUnstructuredGridFilter
+{
+public:
+ //! VTK type macros.
+ vtkTypeMacro( VTKViewer_ExtractUnstructuredGrid, vtkUnstructuredGridToUnstructuredGridFilter );
+
+ //! \brief Construct with all types of clipping turned off.
+ static VTKViewer_ExtractUnstructuredGrid *New();
+
+ enum EExtraction{ eCells, ePoints};
+ //! Sets mode of extraction to \a theExtractionMode
+ void SetModeOfExtraction(EExtraction theExtractionMode){
+ myExtractionMode = theExtractionMode; Modified();
+ }
+ //! Get Extraction mode (Return: \a myExtractionMode field)
+ EExtraction GetModeOfExtraction(){ return myExtractionMode;}
+
+ enum EChanging{ ePassAll, eAdding, eRemoving};
+ //! Sets mode of changing to \a theChangeMode
+ void SetModeOfChanging(EChanging theChangeMode){
+ myChangeMode = theChangeMode;
+ Modified();
+ }
+ //! Return \a myChangeMode field
+ EChanging GetModeOfChanging(){ return myChangeMode;}
+
+ //! Add cell id to \a myCellIds std::set
+ void RegisterCell(vtkIdType theCellId);
+ //! Check if myCellIds is empty.
+ int IsCellsRegistered() { return !myCellIds.empty();}
+ //! Remove the cell from the output
+ void ClearRegisteredCells() {
+ myCellIds.clear();
+ Modified();
+ }
+
+ //! Add cell type to \a myCellTypes std::set
+ void RegisterCellsWithType(vtkIdType theCellType);
+ //! Check if myCellTypes is empty.
+ int IsCellsWithTypeRegistered() { return !myCellTypes.empty();}
+ //! Remove every cells with the type from the output
+ void ClearRegisteredCellsWithType() {
+ myCellTypes.clear();
+ Modified();
+ }
+
+ //! \brief Do the filter do some real work
+ int IsChanging() { return IsCellsRegistered() || IsCellsWithTypeRegistered();}
+
+ //! \brief Do it keep the mapping between input's and output's UnstructuredGrid
+ void SetStoreMapping(int theStoreMapping);
+ //! Get \a myStoreMapping
+ int GetStoreMapping(){ return myStoreMapping;}
+
+ //! Gets the input id by output id.
+ vtkIdType GetInputId(int theOutId) const;
+ //! Gets the output id by input id.
+ vtkIdType GetOutputId(int theInId) const;
+
+ typedef std::vector<vtkIdType> TVectorId;
+ typedef std::map<vtkIdType,vtkIdType> TMapId;
+
+protected:
+ VTKViewer_ExtractUnstructuredGrid();
+ ~VTKViewer_ExtractUnstructuredGrid();
+
+ //! Main method, which calculate output
+ // not ported yet to the new executive-based pipeline architecture.
+ // see http://www.vtk.org/cgi-bin/viewcvs.cgi/Filtering/vtkUnstructuredGridToUnstructuredGridFilter.h?rev=1.19&view=log
+ // virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+ virtual void Execute();
+
+ EExtraction myExtractionMode;
+
+ EChanging myChangeMode;
+ typedef std::set<vtkIdType> TSetId;
+ TSetId myCellIds;
+ TSetId myCellTypes;
+
+ bool myStoreMapping;
+ TVectorId myOut2InId;
+ TMapId myIn2OutId;
+
+private:
+ //! Not implemented.
+ VTKViewer_ExtractUnstructuredGrid(const VTKViewer_ExtractUnstructuredGrid&);
+ //! Not implemented.
+ void operator=(const VTKViewer_ExtractUnstructuredGrid&);
+};
+
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
+#endif
--- /dev/null
+// VTKViewer_Filter : Filter for VTK viewer
+//
+// Copyright (C) 2003 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
+//
+//
+//
+// File : VTKViewer_Filter.cxx
+// Author : Sergey LITONIN
+// Module : SALOME
+
+#include "VTKViewer_Filter.h"
+using namespace std;
+
+IMPLEMENT_STANDARD_HANDLE(VTKViewer_Filter, MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(VTKViewer_Filter, MMgt_TShared)
+
+/*!
+ * \class VTKViewer_Filter
+ * Description : Base class of filters of for <a href="http://www.vtk.org/">VTK</a> viewer. Method IsValid \n
+ * should be redefined in derived classes
+ */
+
+/*!Constructor.*/
+VTKViewer_Filter::VTKViewer_Filter()
+{
+ myActor = 0;
+}
+
+/*!Virtual Destructor.*/
+VTKViewer_Filter::~VTKViewer_Filter()
+{
+}
+
+/*!Check correctness of \a theCellId for actor \a theActor by
+ * call virtual method IsValid( const int theId ).
+ * \param theActor - actor
+ * \param theCellId - cell id.
+ * \retval TRUE - if cell id is valid, else false.
+ */
+bool VTKViewer_Filter::IsValid( VTKViewer_Actor* theActor, const int theCellId )
+{
+ SetActor( theActor );
+ return IsValid( theCellId );
+}
+
+/*!Virtual method.Set actor to \a theActor.
+ * \param theActor - actor.
+ */
+void VTKViewer_Filter::SetActor( VTKViewer_Actor* theActor )
+{
+ myActor = theActor;
+}
--- /dev/null
+// SMESHGUI_Filter : Filter for VTK viewer
+//
+// Copyright (C) 2003 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
+//
+//
+//
+// File : VTKViewer_Filter.h
+// Author : Sergey LITONIN
+// Module : SALOME
+
+#ifndef VTKViewer_Filter_HeaderFile
+#define VTKViewer_Filter_HeaderFile
+
+#include "VTKViewer.h"
+
+#include <MMgt_TShared.hxx>
+#include <Standard_DefineHandle.hxx>
+
+class VTKViewer_Actor;
+
+DEFINE_STANDARD_HANDLE(VTKViewer_Filter, MMgt_TShared);
+
+/*
+ Class : VTKViewer_Filter
+ Description : Base class of filters of for <a href="http://www.vtk.org/">VTK</a> viewer. Method IsValid
+ should be redefined in derived classes
+*/
+
+class VTKViewer_Filter : public MMgt_TShared
+{
+
+public:
+ VTKVIEWER_EXPORT VTKViewer_Filter();
+ VTKVIEWER_EXPORT virtual ~VTKViewer_Filter();
+
+ VTKVIEWER_EXPORT bool IsValid( VTKViewer_Actor*, const int theId );
+ VTKVIEWER_EXPORT virtual bool IsValid( const int theId ) const = 0;
+ VTKVIEWER_EXPORT virtual int GetId() const = 0;
+ VTKVIEWER_EXPORT virtual bool IsNodeFilter() const = 0;
+
+ VTKVIEWER_EXPORT virtual void SetActor( VTKViewer_Actor* );
+
+protected:
+ VTKViewer_Actor* myActor;
+
+public:
+ DEFINE_STANDARD_RTTI(VTKViewer_Filter)
+};
+
+#endif
--- /dev/null
+// SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+// Copyright (C) 2003 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
+//
+//
+//
+// File : VTKViewer_ViewFrame.h
+// Author : Nicolas REJNERI
+// Module : SALOME
+// $Header$
+
+#ifndef VTKViewer_Functor_H
+#define VTKViewer_Functor_H
+
+#include <functional>
+
+#include <string>
+
+namespace VTK
+{
+ template<class TActor, class TArg, class TStoreArg = TArg> struct TSetFunction
+ {
+ typedef void (TActor::* TAction)(TArg);
+ TAction myAction;
+ TStoreArg myArg;
+ TSetFunction(TAction theAction, TArg theArg) : myAction(theAction), myArg(theArg)
+ {}
+ void operator()(TActor* theActor)
+ {
+ (theActor->*myAction)(myArg);
+ }
+ };
+
+ template<class TActor, class TArg = int> struct TSetVisibility: TSetFunction<TActor,TArg>
+ {
+ TSetVisibility(TArg theArg):
+ TSetFunction<TActor,TArg>(&TActor::SetVisibility,theArg)
+ {}
+ };
+}
+
+#endif
--- /dev/null
+// SALOME OBJECT : kernel of SALOME component
+//
+// Copyright (C) 2003 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
+//
+//
+//
+// File : VTKViewer_GeometryFilter.cxx
+// Author : Michael ZORIN
+// Module : SALOME
+// $Header$
+
+#include "VTKViewer_GeometryFilter.h"
+#include "VTKViewer_ConvexTool.h"
+
+#include <vtkSmartPointer.h>
+#include <vtkCellArray.h>
+#include <vtkCellData.h>
+#include <vtkGenericCell.h>
+#include <vtkHexahedron.h>
+#include <vtkMergePoints.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+#include <vtkPolyData.h>
+#include <vtkPyramid.h>
+#include <vtkStructuredGrid.h>
+#include <vtkTetra.h>
+#include <vtkUnsignedCharArray.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkVoxel.h>
+#include <vtkWedge.h>
+#include <vtkInformationVector.h>
+#include <vtkInformation.h>
+
+#include <algorithm>
+#include <iterator>
+#include <vector>
+#include <map>
+#include <set>
+
+#if defined __GNUC__
+ #if __GNUC__ == 2
+ #define __GNUC_2__
+ #endif
+#endif
+
+//#define USE_ROBUST_TRIANGULATION
+
+vtkCxxRevisionMacro(VTKViewer_GeometryFilter, "$Revision$");
+vtkStandardNewMacro(VTKViewer_GeometryFilter);
+
+VTKViewer_GeometryFilter
+::VTKViewer_GeometryFilter():
+ myShowInside(0),
+ myStoreMapping(0),
+ myIsWireframeMode(0)
+{}
+
+
+VTKViewer_GeometryFilter
+::~VTKViewer_GeometryFilter()
+{}
+
+
+int
+VTKViewer_GeometryFilter
+::RequestData(
+ vtkInformation *request,
+ vtkInformationVector **inputVector,
+ vtkInformationVector *outputVector)
+{
+ // get the info objects
+ vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
+ vtkInformation *outInfo = outputVector->GetInformationObject(0);
+
+ // get the input and ouptut
+ vtkDataSet *input = vtkDataSet::SafeDownCast(
+ inInfo->Get(vtkDataObject::DATA_OBJECT()));
+ vtkPolyData *output = vtkPolyData::SafeDownCast(
+ outInfo->Get(vtkDataObject::DATA_OBJECT()));
+
+ vtkIdType numCells=input->GetNumberOfCells();
+
+ if (numCells == 0)
+ {
+ return 0;
+ }
+
+ if (input->GetDataObjectType() == VTK_UNSTRUCTURED_GRID){
+ return this->UnstructuredGridExecute(input, output, outInfo);
+ }else
+ return Superclass::RequestData(request,inputVector,outputVector);
+
+ return 1;
+}
+
+
+int
+VTKViewer_GeometryFilter
+::UnstructuredGridExecute(
+ vtkDataSet *dataSetInput,
+ vtkPolyData *output,
+ vtkInformation *outInfo)
+{
+
+ vtkUnstructuredGrid *input= (vtkUnstructuredGrid *)dataSetInput;
+ vtkCellArray *Connectivity = input->GetCells();
+ // Check input
+ if ( Connectivity == NULL )
+ {
+ vtkDebugMacro(<<"Nothing to extract");
+ return 0;
+ }
+
+ vtkIdType cellId;
+ int i;
+ int allVisible;
+ vtkIdType npts = 0;
+ vtkIdType *pts = 0;
+ vtkPoints *p = input->GetPoints();
+ vtkIdType numCells=input->GetNumberOfCells();
+ vtkPointData *pd = input->GetPointData();
+ vtkCellData *cd = input->GetCellData();
+ vtkPointData *outputPD = output->GetPointData();
+
+ VTKViewer_OrderedTriangulator anOrderedTriangulator;
+ VTKViewer_DelaunayTriangulator aDelaunayTriangulator;
+
+ vtkCellData *outputCD = output->GetCellData();
+ vtkGenericCell *cell = vtkGenericCell::New();
+
+ vtkIdList *cellIds = vtkIdList::New();
+ vtkIdList *faceIds = vtkIdList::New();
+
+ char *cellVis;
+ vtkIdType newCellId;
+ int faceId, *faceVerts, numFacePts;
+ vtkFloatingPointType *x;
+ int PixelConvert[4], aNewPts[VTK_CELL_SIZE];
+ // ghost cell stuff
+ unsigned char updateLevel = (unsigned char)(output->GetUpdateGhostLevel());
+ unsigned char *cellGhostLevels = 0;
+
+ PixelConvert[0] = 0;
+ PixelConvert[1] = 1;
+ PixelConvert[2] = 3;
+ PixelConvert[3] = 2;
+
+ vtkDebugMacro(<<"Executing geometry filter for unstructured grid input");
+
+ vtkDataArray* temp = 0;
+ if (cd)
+ {
+ temp = cd->GetArray("vtkGhostLevels");
+ }
+ if ( (!temp) || (temp->GetDataType() != VTK_UNSIGNED_CHAR)
+ || (temp->GetNumberOfComponents() != 1))
+ {
+ vtkDebugMacro("No appropriate ghost levels field available.");
+ }
+ else
+ {
+ cellGhostLevels = ((vtkUnsignedCharArray*)temp)->GetPointer(0);
+ }
+
+ // Determine nature of what we have to do
+ if ( (!this->CellClipping) && (!this->PointClipping) &&
+ (!this->ExtentClipping) )
+ {
+ allVisible = 1;
+ cellVis = NULL;
+ }
+ else
+ {
+ allVisible = 0;
+ cellVis = new char[numCells];
+ }
+
+ // Just pass points through, never merge
+ output->SetPoints(input->GetPoints());
+ outputPD->PassData(pd);
+
+ outputCD->CopyAllocate(cd,numCells,numCells/2);
+
+ output->Allocate(numCells/4+1,numCells);
+
+ // Loop over the cells determining what's visible
+ if (!allVisible)
+ {
+ for (cellId=0, Connectivity->InitTraversal();
+ Connectivity->GetNextCell(npts,pts);
+ cellId++)
+ {
+ cellVis[cellId] = 1;
+ if ( this->CellClipping && cellId < this->CellMinimum ||
+ cellId > this->CellMaximum )
+ {
+ cellVis[cellId] = 0;
+ }
+ else
+ {
+ for (i=0; i < npts; i++)
+ {
+ x = p->GetPoint(pts[i]);
+ if ( (this->PointClipping && (pts[i] < this->PointMinimum ||
+ pts[i] > this->PointMaximum) ) ||
+ (this->ExtentClipping &&
+ (x[0] < this->Extent[0] || x[0] > this->Extent[1] ||
+ x[1] < this->Extent[2] || x[1] > this->Extent[3] ||
+ x[2] < this->Extent[4] || x[2] > this->Extent[5] )) )
+ {
+ cellVis[cellId] = 0;
+ break;
+ }//point/extent clipping
+ }//for each point
+ }//if point clipping needs checking
+ }//for all cells
+ }//if not all visible
+
+ // Loop over all cells now that visibility is known
+ // (Have to compute visibility first for 3D cell boundarys)
+ int progressInterval = numCells/20 + 1;
+ if(myStoreMapping){
+ myVTK2ObjIds.clear();
+ myVTK2ObjIds.reserve(numCells);
+ }
+ for (cellId=0, Connectivity->InitTraversal();
+ Connectivity->GetNextCell(npts,pts);
+ cellId++)
+ {
+ //Progress and abort method support
+ if ( !(cellId % progressInterval) )
+ {
+ vtkDebugMacro(<<"Process cell #" << cellId);
+ this->UpdateProgress ((float)cellId/numCells);
+ }
+
+ // Handle ghost cells here. Another option was used cellVis array.
+ if (cellGhostLevels && cellGhostLevels[cellId] > updateLevel)
+ { // Do not create surfaces in outer ghost cells.
+ continue;
+ }
+
+ if (allVisible || cellVis[cellId]) //now if visible extract geometry
+ {
+ //special code for nonlinear cells - rarely occurs, so right now it
+ //is slow.
+ vtkIdType aCellType = input->GetCellType(cellId);
+ switch (aCellType)
+ {
+ case VTK_EMPTY_CELL:
+ break;
+
+ case VTK_VERTEX:
+ case VTK_POLY_VERTEX:
+ newCellId = output->InsertNextCell(aCellType,npts,pts);
+ if(myStoreMapping){
+ myVTK2ObjIds.push_back(cellId); //apo
+ }
+ outputCD->CopyData(cd,cellId,newCellId);
+ break;
+
+ case VTK_LINE:
+ case VTK_POLY_LINE:
+ newCellId = output->InsertNextCell(aCellType,npts,pts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
+ break;
+
+ case VTK_TRIANGLE:
+ case VTK_QUAD:
+ case VTK_POLYGON:
+ newCellId = output->InsertNextCell(aCellType,npts,pts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
+ break;
+
+ case VTK_TRIANGLE_STRIP:
+ newCellId = output->InsertNextCell(aCellType,npts,pts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
+ break;
+
+ case VTK_PIXEL:
+ newCellId = output->InsertNextCell(aCellType,npts,pts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
+ break;
+
+ case VTK_CONVEX_POINT_SET: {
+ bool anIsOk = anOrderedTriangulator.Execute(input,
+ cd,
+ cellId,
+ myShowInside,
+ allVisible,
+ cellVis,
+ output,
+ outputCD,
+ myStoreMapping,
+ myVTK2ObjIds,
+ true);
+ if(!anIsOk)
+ aDelaunayTriangulator.Execute(input,
+ cd,
+ cellId,
+ myShowInside,
+ allVisible,
+ cellVis,
+ output,
+ outputCD,
+ myStoreMapping,
+ myVTK2ObjIds,
+ false);
+
+ break;
+ }
+ case VTK_TETRA: {
+ for (faceId = 0; faceId < 4; faceId++)
+ {
+ faceIds->Reset();
+ faceVerts = vtkTetra::GetFaceArray(faceId);
+ faceIds->InsertNextId(pts[faceVerts[0]]);
+ faceIds->InsertNextId(pts[faceVerts[1]]);
+ faceIds->InsertNextId(pts[faceVerts[2]]);
+ aCellType = VTK_TRIANGLE;
+ numFacePts = 3;
+ input->GetCellNeighbors(cellId, faceIds, cellIds);
+ if ( cellIds->GetNumberOfIds() <= 0 || myShowInside ||
+ (!allVisible && !cellVis[cellIds->GetId(0)]) )
+ {
+ for ( i=0; i < numFacePts; i++)
+ aNewPts[i] = pts[faceVerts[i]];
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ }
+ break;
+ }
+ case VTK_VOXEL: {
+ for (faceId = 0; faceId < 6; faceId++)
+ {
+ faceIds->Reset();
+ faceVerts = vtkVoxel::GetFaceArray(faceId);
+ faceIds->InsertNextId(pts[faceVerts[0]]);
+ faceIds->InsertNextId(pts[faceVerts[1]]);
+ faceIds->InsertNextId(pts[faceVerts[2]]);
+ faceIds->InsertNextId(pts[faceVerts[3]]);
+ aCellType = VTK_QUAD;
+ numFacePts = 4;
+ input->GetCellNeighbors(cellId, faceIds, cellIds);
+ if ( cellIds->GetNumberOfIds() <= 0 || myShowInside ||
+ (!allVisible && !cellVis[cellIds->GetId(0)]) )
+ {
+ for ( i=0; i < numFacePts; i++)
+ aNewPts[i] = pts[faceVerts[PixelConvert[i]]];
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ }
+ break;
+ }
+ case VTK_HEXAHEDRON: {
+ for (faceId = 0; faceId < 6; faceId++)
+ {
+ faceIds->Reset();
+ faceVerts = vtkHexahedron::GetFaceArray(faceId);
+ faceIds->InsertNextId(pts[faceVerts[0]]);
+ faceIds->InsertNextId(pts[faceVerts[1]]);
+ faceIds->InsertNextId(pts[faceVerts[2]]);
+ faceIds->InsertNextId(pts[faceVerts[3]]);
+ aCellType = VTK_QUAD;
+ numFacePts = 4;
+ input->GetCellNeighbors(cellId, faceIds, cellIds);
+ if ( cellIds->GetNumberOfIds() <= 0 || myShowInside ||
+ (!allVisible && !cellVis[cellIds->GetId(0)]) )
+ {
+ for ( i=0; i < numFacePts; i++)
+ aNewPts[i] = pts[faceVerts[i]];
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ }
+ break;
+ }
+ case VTK_WEDGE: {
+ for (faceId = 0; faceId < 5; faceId++)
+ {
+ faceIds->Reset();
+ faceVerts = vtkWedge::GetFaceArray(faceId);
+ faceIds->InsertNextId(pts[faceVerts[0]]);
+ faceIds->InsertNextId(pts[faceVerts[1]]);
+ faceIds->InsertNextId(pts[faceVerts[2]]);
+ aCellType = VTK_TRIANGLE;
+ numFacePts = 3;
+ if (faceVerts[3] >= 0)
+ {
+ faceIds->InsertNextId(pts[faceVerts[3]]);
+ aCellType = VTK_QUAD;
+ numFacePts = 4;
+ }
+ input->GetCellNeighbors(cellId, faceIds, cellIds);
+ if ( cellIds->GetNumberOfIds() <= 0 || myShowInside ||
+ (!allVisible && !cellVis[cellIds->GetId(0)]) )
+ {
+ for ( i=0; i < numFacePts; i++)
+ aNewPts[i] = pts[faceVerts[i]];
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ }
+ break;
+ }
+ case VTK_PYRAMID: {
+ for (faceId = 0; faceId < 5; faceId++)
+ {
+ faceIds->Reset();
+ faceVerts = vtkPyramid::GetFaceArray(faceId);
+ faceIds->InsertNextId(pts[faceVerts[0]]);
+ faceIds->InsertNextId(pts[faceVerts[1]]);
+ faceIds->InsertNextId(pts[faceVerts[2]]);
+ aCellType = VTK_TRIANGLE;
+ numFacePts = 3;
+ if (faceVerts[3] >= 0)
+ {
+ faceIds->InsertNextId(pts[faceVerts[3]]);
+ aCellType = VTK_QUAD;
+ numFacePts = 4;
+ }
+ input->GetCellNeighbors(cellId, faceIds, cellIds);
+ if ( cellIds->GetNumberOfIds() <= 0 || myShowInside ||
+ (!allVisible && !cellVis[cellIds->GetId(0)]) )
+ {
+ for ( i=0; i < numFacePts; i++)
+ aNewPts[i] = pts[faceVerts[i]];
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ }
+ break;
+ }
+ //Quadratic cells
+ case VTK_QUADRATIC_EDGE:
+ case VTK_QUADRATIC_TRIANGLE:
+ case VTK_QUADRATIC_QUAD:
+ case VTK_QUADRATIC_TETRA:
+ case VTK_QUADRATIC_HEXAHEDRON:
+ if(!myIsWireframeMode){
+ input->GetCell(cellId,cell);
+ vtkIdList *pts = vtkIdList::New();
+ vtkPoints *coords = vtkPoints::New();
+ vtkIdList *cellIds = vtkIdList::New();
+ vtkIdType newCellId;
+
+ if ( cell->GetCellDimension() == 1 ) {
+ aCellType = VTK_LINE;
+ numFacePts = 2;
+ cell->Triangulate(0,pts,coords);
+ for (i=0; i < pts->GetNumberOfIds(); i+=2) {
+ aNewPts[0] = pts->GetId(i);
+ aNewPts[1] = pts->GetId(i+1);
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ }
+ else if ( cell->GetCellDimension() == 2 ) {
+ aCellType = VTK_TRIANGLE;
+ numFacePts = 3;
+ cell->Triangulate(0,pts,coords);
+ for (i=0; i < pts->GetNumberOfIds(); i+=3) {
+ aNewPts[0] = pts->GetId(i);
+ aNewPts[1] = pts->GetId(i+1);
+ aNewPts[2] = pts->GetId(i+2);
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ }
+ else //3D nonlinear cell
+ {
+ aCellType = VTK_TRIANGLE;
+ numFacePts = 3;
+ for (int j=0; j < cell->GetNumberOfFaces(); j++){
+ vtkCell *face = cell->GetFace(j);
+ input->GetCellNeighbors(cellId, face->PointIds, cellIds);
+ if ( cellIds->GetNumberOfIds() <= 0 || myShowInside ) {
+ face->Triangulate(0,pts,coords);
+ for (i=0; i < pts->GetNumberOfIds(); i+=3) {
+ aNewPts[0] = pts->GetId(i);
+ aNewPts[1] = pts->GetId(i+1);
+ aNewPts[2] = pts->GetId(i+2);
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+ outputCD->CopyData(cd,cellId,newCellId);
+ }
+ }
+ }
+ } //3d cell
+ cellIds->Delete();
+ coords->Delete();
+ pts->Delete();
+ break;
+ }else{
+ switch(aCellType){
+ case VTK_QUADRATIC_EDGE: {
+ aCellType = VTK_POLY_LINE;
+ numFacePts = 3;
+
+ aNewPts[0] = pts[0];
+ aNewPts[2] = pts[1];
+ aNewPts[1] = pts[2];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+ break;
+ }
+ case VTK_QUADRATIC_TRIANGLE: {
+ aCellType = VTK_POLYGON;
+ numFacePts = 6;
+
+ aNewPts[0] = pts[0];
+ aNewPts[1] = pts[3];
+ aNewPts[2] = pts[1];
+ aNewPts[3] = pts[4];
+ aNewPts[4] = pts[2];
+ aNewPts[5] = pts[5];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+ break;
+ }
+ case VTK_QUADRATIC_QUAD: {
+ aCellType = VTK_POLYGON;
+ numFacePts = 8;
+
+ aNewPts[0] = pts[0];
+ aNewPts[1] = pts[4];
+ aNewPts[2] = pts[1];
+ aNewPts[3] = pts[5];
+ aNewPts[4] = pts[2];
+ aNewPts[5] = pts[6];
+ aNewPts[6] = pts[3];
+ aNewPts[7] = pts[7];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+ break;
+ }
+ case VTK_QUADRATIC_TETRA: {
+ aCellType = VTK_POLYGON;
+ numFacePts = 6;
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[0];
+ aNewPts[1] = pts[4];
+ aNewPts[2] = pts[1];
+ aNewPts[3] = pts[5];
+ aNewPts[4] = pts[2];
+ aNewPts[5] = pts[6];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[0];
+ aNewPts[1] = pts[7];
+ aNewPts[2] = pts[3];
+ aNewPts[3] = pts[8];
+ aNewPts[4] = pts[1];
+ aNewPts[5] = pts[4];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[1];
+ aNewPts[1] = pts[8];
+ aNewPts[2] = pts[3];
+ aNewPts[3] = pts[9];
+ aNewPts[4] = pts[2];
+ aNewPts[5] = pts[5];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[2];
+ aNewPts[1] = pts[9];
+ aNewPts[2] = pts[3];
+ aNewPts[3] = pts[7];
+ aNewPts[4] = pts[0];
+ aNewPts[5] = pts[6];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ break;
+ }
+ case VTK_QUADRATIC_HEXAHEDRON: {
+ aCellType = VTK_POLYGON;
+ numFacePts = 8;
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[0];
+ aNewPts[1] = pts[8];
+ aNewPts[2] = pts[1];
+ aNewPts[3] = pts[17];
+ aNewPts[4] = pts[5];
+ aNewPts[5] = pts[12];
+ aNewPts[6] = pts[4];
+ aNewPts[7] = pts[16];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[1];
+ aNewPts[1] = pts[9];
+ aNewPts[2] = pts[2];
+ aNewPts[3] = pts[18];
+ aNewPts[4] = pts[6];
+ aNewPts[5] = pts[13];
+ aNewPts[6] = pts[5];
+ aNewPts[7] = pts[17];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[2];
+ aNewPts[1] = pts[10];
+ aNewPts[2] = pts[3];
+ aNewPts[3] = pts[19];
+ aNewPts[4] = pts[7];
+ aNewPts[5] = pts[14];
+ aNewPts[6] = pts[6];
+ aNewPts[7] = pts[18];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[3];
+ aNewPts[1] = pts[11];
+ aNewPts[2] = pts[0];
+ aNewPts[3] = pts[16];
+ aNewPts[4] = pts[4];
+ aNewPts[5] = pts[15];
+ aNewPts[6] = pts[7];
+ aNewPts[7] = pts[19];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[0];
+ aNewPts[1] = pts[8];
+ aNewPts[2] = pts[1];
+ aNewPts[3] = pts[9];
+ aNewPts[4] = pts[2];
+ aNewPts[5] = pts[10];
+ aNewPts[6] = pts[3];
+ aNewPts[7] = pts[11];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ //---------------------------------------------------------------
+ aNewPts[0] = pts[4];
+ aNewPts[1] = pts[12];
+ aNewPts[2] = pts[5];
+ aNewPts[3] = pts[13];
+ aNewPts[4] = pts[6];
+ aNewPts[5] = pts[14];
+ aNewPts[6] = pts[7];
+ aNewPts[7] = pts[15];
+
+ newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(cellId);
+
+ outputCD->CopyData(cd,cellId,newCellId);
+
+ break;
+ }}
+ }
+ } //switch
+ } //if visible
+ } //for all cells
+
+ output->Squeeze();
+
+ vtkDebugMacro(<<"Extracted " << input->GetNumberOfPoints() << " points,"
+ << output->GetNumberOfCells() << " cells.");
+
+ cell->Delete();
+
+ cellIds->Delete();
+ faceIds->Delete();
+
+ if ( cellVis )
+ {
+ delete [] cellVis;
+ }
+}
+
+
+void
+VTKViewer_GeometryFilter
+::SetInside(int theShowInside)
+{
+ if(myShowInside == theShowInside)
+ return;
+
+ myShowInside = theShowInside;
+ this->Modified();
+}
+
+int
+VTKViewer_GeometryFilter
+::GetInside()
+{
+ return myShowInside;
+}
+
+
+void
+VTKViewer_GeometryFilter
+::SetWireframeMode(int theIsWireframeMode)
+{
+ if(myIsWireframeMode == theIsWireframeMode)
+ return;
+
+ myIsWireframeMode = theIsWireframeMode;
+ this->Modified();
+}
+
+int
+VTKViewer_GeometryFilter
+::GetWireframeMode()
+{
+ return myIsWireframeMode;
+}
+
+
+void
+VTKViewer_GeometryFilter
+::SetStoreMapping(int theStoreMapping)
+{
+ if(myStoreMapping == theStoreMapping)
+ return;
+
+ myStoreMapping = theStoreMapping;
+ this->Modified();
+}
+
+int
+VTKViewer_GeometryFilter
+::GetStoreMapping()
+{
+ return myStoreMapping;
+}
+
+
+vtkIdType VTKViewer_GeometryFilter::GetElemObjId( int theVtkID )
+{
+ if( myVTK2ObjIds.empty() || theVtkID > (int)myVTK2ObjIds.size() )
+ return -1;
+#if defined __GNUC_2__
+ return myVTK2ObjIds[theVtkID];
+#else
+ return myVTK2ObjIds.at(theVtkID);
+#endif
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 VTKVIEWER_GEOMETRYFILTER_H
+#define VTKVIEWER_GEOMETRYFILTER_H
+
+#include "VTKViewer.h"
+
+#include <vtkGeometryFilter.h>
+
+#include <vector>
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+/*! \brief This class used same as vtkGeometryFilter. See documentation on VTK for more information.
+ */
+class VTKVIEWER_EXPORT VTKViewer_GeometryFilter : public vtkGeometryFilter
+{
+public:
+ /*! \fn static VTKViewer_GeometryFilter *New()
+ */
+ static VTKViewer_GeometryFilter *New();
+
+ /*! \fn vtkTypeRevisionMacro(VTKViewer_GeometryFilter, vtkGeometryFilter)
+ * \brief VTK type revision macros.
+ */
+ vtkTypeRevisionMacro(VTKViewer_GeometryFilter, vtkGeometryFilter);
+ /*! \fn void SetInside(int theShowInside)
+ * \brief Sets \a myShowInside flag. \a myShowInside is changed, call this->Modified().
+ * \param theShowInside - used for changing value of \a myShowInside variable.
+ */
+ void SetInside(int theShowInside);
+ /*! \fn int GetInside()
+ * \brief Return value of \a myShowInside
+ * \retval myShowInside
+ */
+ int GetInside();
+ /*! \fn void SetWireframeMode(int theIsWireframeMode)
+ * \brief Sets \a myIsWireframeMode flag. \a myIsWireframeMode is changed, call this->Modified().
+ * \param theIsWireframeMode - used for changing value of \a myIsWireframeMode variable.
+ */
+ void SetWireframeMode(int theIsWireframeMode);
+ /*! \fn int GetWireframeMode()
+ * \brief Return value of \a myIsWireframeMode
+ * \retval myIsWireframeMode
+ */
+ int GetWireframeMode();
+ /*! \fn void SetStoreMapping(int theStoreMapping);
+ * \brief Sets \a myStoreMapping flag and call this->Modified()
+ * \param theStoreMapping - used for changing value of \a myStoreMapping variable.
+ */
+ void SetStoreMapping(int theStoreMapping);
+ /*! \fn int GetStoreMapping()
+ * \brief Return value of \a myStoreMapping
+ * \retval myStoreMapping
+ */
+ int GetStoreMapping();
+ /*! \fn virtual vtkIdType GetNodeObjId(int theVtkID)
+ * \brief Return input value theVtkID
+ * \retval theVtkID
+ */
+ virtual vtkIdType GetNodeObjId(int theVtkID) { return theVtkID;}
+ /*! \fn virtual vtkIdType GetElemObjId(int theVtkID);
+ * \brief Return object ID by VTK ID cell
+ * \retval myVTK2ObjIds[theVtkID]
+ */
+ virtual vtkIdType GetElemObjId(int theVtkID);
+
+protected:
+ /*! \fn VTKViewer_GeometryFilter();
+ * \brief Constructor which sets \a myShowInside = 0 and \a myStoreMapping = 0
+ */
+ VTKViewer_GeometryFilter();
+ /*! \fn ~VTKViewer_GeometryFilter();
+ * \brief Destructor.
+ */
+ ~VTKViewer_GeometryFilter();
+
+ virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+
+ //special cases for performance
+
+ /*! \fn void UnstructuredGridExecute();
+ * \brief Filter culculation method for data object type is VTK_UNSTRUCTURED_GRID.
+ */
+ int UnstructuredGridExecute (vtkDataSet *, vtkPolyData *, vtkInformation *);
+
+private:
+ typedef std::vector<vtkIdType> TVectorId;
+
+private:
+ TVectorId myVTK2ObjIds;
+ int myShowInside;
+ int myStoreMapping;
+ int myIsWireframeMode;
+};
+
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
+#endif
--- /dev/null
+// SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+// Copyright (C) 2003 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
+//
+//
+//
+// File : VTKViewer_InteractorStyle.cxx
+// Author : Christophe ATTANASIO
+// Module : SALOME
+
+#include "VTKViewer_InteractorStyle.h"
+
+#include "VTKViewer_Actor.h"
+#include "VTKViewer_Utilities.h"
+#include "VTKViewer_Trihedron.h"
+#include "VTKViewer_ViewWindow.h"
+#include "VTKViewer_RenderWindow.h"
+#include "VTKViewer_RenderWindowInteractor.h"
+
+//#include "SALOME_Actor.h"
+
+#include <vtkObjectFactory.h>
+#include <vtkMath.h>
+#include <vtkCommand.h>
+#include <vtkCamera.h>
+#include <vtkRenderer.h>
+#include <vtkPicker.h>
+#include <vtkPointPicker.h>
+#include <vtkCellPicker.h>
+#include <vtkLine.h>
+#include <vtkMapper.h>
+#include <vtkDataSet.h>
+#include <vtkSmartPointer.h>
+#include <vtkProperty.h>
+
+#include <QApplication>
+#include <QRubberBand>
+
+#include <algorithm>
+
+//#include "utilities.h"
+
+using namespace std;
+
+
+/*
+static int GetEdgeId(vtkPicker *thePicker, SALOME_Actor *theActor, int theObjId){
+ int anEdgeId = -1;
+ if (vtkCell* aPickedCell = theActor->GetElemCell(theObjId)) {
+ float aPickPosition[3];
+ thePicker->GetPickPosition(aPickPosition);
+ float aMinDist = 1000000.0, aDist = 0;
+ for (int i = 0, iEnd = aPickedCell->GetNumberOfEdges(); i < iEnd; i++){
+ if(vtkLine* aLine = vtkLine::SafeDownCast(aPickedCell->GetEdge(i))){
+ int subId; float pcoords[3], closestPoint[3], weights[3];
+ aLine->EvaluatePosition(aPickPosition,closestPoint,subId,pcoords,aDist,weights);
+ if (aDist < aMinDist) {
+ aMinDist = aDist;
+ anEdgeId = i;
+ }
+ }
+ }
+ }
+ return anEdgeId;
+}
+*/
+
+vtkStandardNewMacro(VTKViewer_InteractorStyle);
+
+
+/*!Constructor.*/
+VTKViewer_InteractorStyle::VTKViewer_InteractorStyle()
+{
+ m_Trihedron = 0;
+ this->MotionFactor = 10.0;
+ this->State = VTK_INTERACTOR_STYLE_CAMERA_NONE;
+ this->RadianToDegree = 180.0 / vtkMath::Pi();
+ this->ForcedState = VTK_INTERACTOR_STYLE_CAMERA_NONE;
+ loadCursors();
+
+ myPreSelectionActor = VTKViewer_Actor::New();
+ myPreSelectionActor->GetProperty()->SetColor(0,1,1);
+ myPreSelectionActor->GetProperty()->SetLineWidth(5);
+ myPreSelectionActor->GetProperty()->SetPointSize(5);
+
+ myRectBand = 0;
+
+ OnSelectionModeChanged();
+}
+
+
+/*!Destructor.*/
+VTKViewer_InteractorStyle::~VTKViewer_InteractorStyle()
+{
+ m_ViewWnd->RemoveActor(myPreSelectionActor);
+ endDrawRect();
+}
+
+
+/*!Set preselection properties.
+ *\param theRed - red color.
+ *\param theGreen - green color.
+ *\param theBlue - blue color.
+ *\param theWidth - width..
+ */
+void VTKViewer_InteractorStyle::setPreselectionProp(const double& theRed, const double& theGreen,
+ const double& theBlue, const int& theWidth)
+{
+ if ( myPreSelectionActor->GetProperty() == 0 )
+ return;
+ myPreSelectionActor->GetProperty()->SetColor(theRed, theGreen, theBlue);
+ myPreSelectionActor->GetProperty()->SetLineWidth(theWidth);
+ myPreSelectionActor->GetProperty()->SetPointSize(theWidth);
+}
+
+
+/*!Set render window interactor
+ *\param theInteractor - interactor.
+ */
+void VTKViewer_InteractorStyle::SetInteractor(vtkRenderWindowInteractor *theInteractor){
+ m_Interactor = dynamic_cast<VTKViewer_RenderWindowInteractor*>(theInteractor);
+ Superclass::SetInteractor(theInteractor);
+}
+
+
+/*!Set view window.
+ *\param theViewWnd - SALOME VTKViewer_ViewWindow
+ */
+void VTKViewer_InteractorStyle::setViewWnd(VTKViewer_ViewWindow* theViewWnd ){
+ m_ViewWnd = theViewWnd;
+ m_ViewWnd->AddActor(myPreSelectionActor);
+ myPreSelectionActor->Delete();
+}
+
+
+/*!Set GUI window.
+ *\param theWindow - QWidget window.
+ */
+void VTKViewer_InteractorStyle::setGUIWindow(QWidget* theWindow){
+ myGUIWindow = theWindow;
+}
+
+
+/*!Set trihedron.
+ *\param theTrihedron - SALOME VTKViewer_Trihedron
+ */
+void VTKViewer_InteractorStyle::setTriedron(VTKViewer_Trihedron* theTrihedron){
+ m_Trihedron = theTrihedron;
+}
+
+/*!Rotate camera.
+ *\param dx -
+ *\param dy -
+ */
+void VTKViewer_InteractorStyle::RotateXY(int dx, int dy)
+{
+ double rxf;
+ double ryf;
+ vtkCamera *cam;
+
+ if (this->CurrentRenderer == NULL)
+ {
+ return;
+ }
+
+ int *size = this->CurrentRenderer->GetRenderWindow()->GetSize();
+ this->DeltaElevation = -20.0 / size[1];
+ this->DeltaAzimuth = -20.0 / size[0];
+
+ rxf = (double)dx * this->DeltaAzimuth * this->MotionFactor;
+ ryf = (double)dy * this->DeltaElevation * this->MotionFactor;
+
+ cam = this->CurrentRenderer->GetActiveCamera();
+ cam->Azimuth(rxf);
+ cam->Elevation(ryf);
+ cam->OrthogonalizeViewUp();
+ ::ResetCameraClippingRange(this->CurrentRenderer);
+ //this->Interactor->Render();
+ myGUIWindow->update();
+}
+
+void VTKViewer_InteractorStyle::PanXY(int x, int y, int oldX, int oldY)
+{
+ TranslateView(x, y, oldX, oldY);
+ //this->Interactor->Render();
+ myGUIWindow->update();
+}
+
+
+/*! Move the position of the camera along the direction of projection. (dx,dy)*/
+void VTKViewer_InteractorStyle::DollyXY(int dx, int dy)
+{
+ if (this->CurrentRenderer == NULL) return;
+
+ double dxf = this->MotionFactor * (double)(dx) / (double)(this->CurrentRenderer->GetCenter()[1]);
+ double dyf = this->MotionFactor * (double)(dy) / (double)(this->CurrentRenderer->GetCenter()[1]);
+
+ double zoomFactor = pow((double)1.1, dxf + dyf);
+
+ vtkCamera *aCam = this->CurrentRenderer->GetActiveCamera();
+ if (aCam->GetParallelProjection())
+ aCam->SetParallelScale(aCam->GetParallelScale()/zoomFactor);
+ else{
+ aCam->Dolly(zoomFactor);
+ ::ResetCameraClippingRange(this->CurrentRenderer);
+ }
+
+ //this->Interactor->Render();
+ myGUIWindow->update();
+}
+
+void VTKViewer_InteractorStyle::SpinXY(int x, int y, int oldX, int oldY)
+{
+ vtkCamera *cam;
+
+ if (this->CurrentRenderer == NULL)
+ {
+ return;
+ }
+
+ double newAngle = atan2((double)(y - this->CurrentRenderer->GetCenter()[1]),
+ (double)(x - this->CurrentRenderer->GetCenter()[0]));
+ double oldAngle = atan2((double)(oldY -this->CurrentRenderer->GetCenter()[1]),
+ (double)(oldX - this->CurrentRenderer->GetCenter()[0]));
+
+ newAngle *= this->RadianToDegree;
+ oldAngle *= this->RadianToDegree;
+
+ cam = this->CurrentRenderer->GetActiveCamera();
+ cam->Roll(newAngle - oldAngle);
+ cam->OrthogonalizeViewUp();
+
+ //this->Interactor->Render();
+ myGUIWindow->update();
+}
+
+
+/*!On mouse move event.
+ *\param ctrl - CTRL (not used)
+ *\param shift - SHIFT (on/off - integer 0/1)
+ *\param x - x coordinate
+ *\param y - y coordinate
+ */
+void VTKViewer_InteractorStyle::OnMouseMove(int vtkNotUsed(ctrl),
+ int shift,
+ int x, int y)
+{
+ myShiftState = shift;
+ if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+ onOperation(QPoint(x, y));
+ else if (ForcedState == VTK_INTERACTOR_STYLE_CAMERA_NONE)
+ onCursorMove(QPoint(x, y));
+}
+
+
+/*!On Left button down event.
+ *\param ctrl - CTRL (on/off - integer 0/1)
+ *\param shift - SHIFT (on/off - integer 0/1)
+ *\param x - x coordinate
+ *\param y - y coordinate
+ */
+void VTKViewer_InteractorStyle::OnLeftButtonDown(int ctrl, int shift,
+ int x, int y)
+{
+ if (this->HasObserver(vtkCommand::LeftButtonPressEvent)) {
+ this->InvokeEvent(vtkCommand::LeftButtonPressEvent,NULL);
+ return;
+ }
+ this->FindPokedRenderer(x, y);
+ if (this->CurrentRenderer == NULL) {
+ return;
+ }
+ myShiftState = shift;
+ // finishing current viewer operation
+ if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+ onFinishOperation();
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+ }
+ myOtherPoint = myPoint = QPoint(x, y);
+ if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+ startOperation(ForcedState);
+ } else {
+ if (ctrl)
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_ZOOM);
+ else
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_SELECT);
+ }
+ return;
+}
+
+
+/*!On left button up event.
+ *\param ctrl - CTRL (not used)
+ *\param shift - SHIFT (on/off - integer 0/1)
+ *\param x - x coordinate (not used)
+ *\param y - y coordinate (not used)
+ */
+void VTKViewer_InteractorStyle::OnLeftButtonUp(int vtkNotUsed(ctrl),
+ int shift,
+ int vtkNotUsed(x),
+ int vtkNotUsed(y))
+{
+ myShiftState = shift;
+ // finishing current viewer operation
+ if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+ onFinishOperation();
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+ }
+}
+
+
+/*!On left button up event.
+ *\param ctrl - CTRL (on/off - integer 0/1)
+ *\param shift - SHIFT (on/off - integer 0/1)
+ *\param x - x coordinate
+ *\param y - y coordinate
+ */
+void VTKViewer_InteractorStyle::OnMiddleButtonDown(int ctrl,
+ int shift,
+ int x, int y)
+{
+ if (this->HasObserver(vtkCommand::MiddleButtonPressEvent))
+ {
+ this->InvokeEvent(vtkCommand::MiddleButtonPressEvent,NULL);
+ return;
+ }
+ this->FindPokedRenderer(x, y);
+ if (this->CurrentRenderer == NULL)
+ {
+ return;
+ }
+ myShiftState = shift;
+ // finishing current viewer operation
+ if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+ onFinishOperation();
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+ }
+ myOtherPoint = myPoint = QPoint(x, y);
+ if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+ startOperation(ForcedState);
+ }
+ else {
+ if (ctrl)
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_PAN);
+ }
+}
+
+
+/*!On middle button up event.
+ *\param ctrl - CTRL (not used)
+ *\param shift - SHIFT (on/off - integer 0/1)
+ *\param x - x coordinate (not used)
+ *\param y - y coordinate (not used)
+ */
+void VTKViewer_InteractorStyle::OnMiddleButtonUp(int vtkNotUsed(ctrl),
+ int shift,
+ int vtkNotUsed(x),
+ int vtkNotUsed(y))
+{
+ myShiftState = shift;
+ // finishing current viewer operation
+ if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+ onFinishOperation();
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+ }
+}
+
+
+/*!On right button down event.
+ *\param ctrl - CTRL (on/off - integer 0/1)
+ *\param shift - SHIFT (on/off - integer 0/1)
+ *\param x - x coordinate
+ *\param y - y coordinate
+ */
+void VTKViewer_InteractorStyle::OnRightButtonDown(int ctrl,
+ int shift,
+ int x, int y)
+{
+ if (this->HasObserver(vtkCommand::RightButtonPressEvent))
+ {
+ this->InvokeEvent(vtkCommand::RightButtonPressEvent,NULL);
+ return;
+ }
+ this->FindPokedRenderer(x, y);
+ if (this->CurrentRenderer == NULL)
+ {
+ return;
+ }
+ myShiftState = shift;
+ // finishing current viewer operation
+ if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+ onFinishOperation();
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+ }
+ myOtherPoint = myPoint = QPoint(x, y);
+ if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+ startOperation(ForcedState);
+ }
+ else {
+ if (ctrl)
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_ROTATE);
+ }
+}
+
+/*!On right button up event.
+ *\param ctrl - CTRL (not used)
+ *\param shift - SHIFT (on/off - integer 0/1)
+ *\param x - x coordinate (not used)
+ *\param y - y coordinate (not used)
+ */
+void VTKViewer_InteractorStyle::OnRightButtonUp(int vtkNotUsed(ctrl),
+ int shift,
+ int vtkNotUsed(x),
+ int vtkNotUsed(y))
+{
+ myShiftState = shift;
+ // finishing current viewer operation
+ if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+ onFinishOperation();
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+ }
+}
+
+/*! @name XPM - x pixmaps. */
+//@{
+/*!Image Zoom cursor*/
+const char* imageZoomCursor[] = {
+"32 32 3 1",
+". c None",
+"a c #000000",
+"# c #ffffff",
+"................................",
+"................................",
+".#######........................",
+"..aaaaaaa.......................",
+"................................",
+".............#####..............",
+"...........##.aaaa##............",
+"..........#.aa.....a#...........",
+".........#.a.........#..........",
+".........#a..........#a.........",
+"........#.a...........#.........",
+"........#a............#a........",
+"........#a............#a........",
+"........#a............#a........",
+"........#a............#a........",
+".........#...........#.a........",
+".........#a..........#a.........",
+".........##.........#.a.........",
+"........#####.....##.a..........",
+".......###aaa#####.aa...........",
+"......###aa...aaaaa.......#.....",
+".....###aa................#a....",
+"....###aa.................#a....",
+"...###aa...............#######..",
+"....#aa.................aa#aaaa.",
+".....a....................#a....",
+"..........................#a....",
+"...........................a....",
+"................................",
+"................................",
+"................................",
+"................................"};
+
+/*!Image rotate cursor*/
+const char* imageRotateCursor[] = {
+"32 32 3 1",
+". c None",
+"a c #000000",
+"# c #ffffff",
+"................................",
+"................................",
+"................................",
+"................................",
+"........#.......................",
+".......#.a......................",
+"......#######...................",
+".......#aaaaa#####..............",
+"........#..##.a#aa##........##..",
+".........a#.aa..#..a#.....##.aa.",
+".........#.a.....#...#..##.aa...",
+".........#a.......#..###.aa.....",
+"........#.a.......#a..#aa.......",
+"........#a.........#..#a........",
+"........#a.........#a.#a........",
+"........#a.........#a.#a........",
+"........#a.........#a.#a........",
+".........#.........#a#.a........",
+"........##a........#a#a.........",
+"......##.a#.......#.#.a.........",
+"....##.aa..##.....##.a..........",
+"..##.aa.....a#####.aa...........",
+"...aa.........aaa#a.............",
+"................#.a.............",
+"...............#.a..............",
+"..............#.a...............",
+"...............a................",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................"};
+//@}
+
+/*! Loads cursors for viewer operations - zoom, pan, etc...*/
+void VTKViewer_InteractorStyle::loadCursors()
+{
+ myDefCursor = QCursor(Qt::ArrowCursor);
+ myHandCursor = QCursor(Qt::PointingHandCursor);
+ myPanCursor = QCursor(Qt::SizeAllCursor);
+ myZoomCursor = QCursor(QPixmap(imageZoomCursor));
+ myRotateCursor = QCursor(QPixmap(imageRotateCursor));
+ mySpinCursor = QCursor(QPixmap(imageRotateCursor)); // temporarly !!!!!!
+ myGlobalPanCursor = QCursor(Qt::CrossCursor);
+ myCursorState = false;
+}
+
+
+/*! event filter - controls mouse and keyboard events during viewer operations*/
+bool VTKViewer_InteractorStyle::eventFilter(QObject* object, QEvent* event)
+{
+ if (!myGUIWindow) return false;
+ if ( (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::KeyPress) && object != myGUIWindow)
+ {
+ qApp->removeEventFilter(this);
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+ }
+ return QObject::eventFilter(object, event);
+}
+
+
+/*! starts Zoom operation (e.g. through menu command)*/
+void VTKViewer_InteractorStyle::startZoom()
+{
+ if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+ {
+ onFinishOperation();
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+ }
+ setCursor(VTK_INTERACTOR_STYLE_CAMERA_ZOOM);
+ ForcedState = VTK_INTERACTOR_STYLE_CAMERA_ZOOM;
+ qApp->installEventFilter(this);
+}
+
+
+/*! starts Pan operation (e.g. through menu command)*/
+void VTKViewer_InteractorStyle::startPan()
+{
+ if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+ {
+ onFinishOperation();
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+ }
+ setCursor(VTK_INTERACTOR_STYLE_CAMERA_PAN);
+ ForcedState = VTK_INTERACTOR_STYLE_CAMERA_PAN;
+ qApp->installEventFilter(this);
+}
+
+/*! starts Rotate operation (e.g. through menu command)*/
+void VTKViewer_InteractorStyle::startRotate()
+{
+ if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+ {
+ onFinishOperation();
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+ }
+ setCursor(VTK_INTERACTOR_STYLE_CAMERA_ROTATE);
+ ForcedState = VTK_INTERACTOR_STYLE_CAMERA_ROTATE;
+ qApp->installEventFilter(this);
+}
+
+
+/*! starts Spin operation (e.g. through menu command)*/
+void VTKViewer_InteractorStyle::startSpin()
+{
+ if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+ {
+ onFinishOperation();
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+ }
+ setCursor(VTK_INTERACTOR_STYLE_CAMERA_SPIN);
+ ForcedState = VTK_INTERACTOR_STYLE_CAMERA_SPIN;
+ qApp->installEventFilter(this);
+}
+
+
+
+/*! starts Fit Area operation (e.g. through menu command)*/
+void VTKViewer_InteractorStyle::startFitArea()
+{
+ if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+ {
+ onFinishOperation();
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+ }
+ setCursor(VTK_INTERACTOR_STYLE_CAMERA_FIT);
+ ForcedState = VTK_INTERACTOR_STYLE_CAMERA_FIT;
+ qApp->installEventFilter(this);
+}
+
+
+/*!View fit all.*/
+void VTKViewer_InteractorStyle::ViewFitAll() {
+ int aTriedronWasVisible = false;
+ if(m_Trihedron){
+ aTriedronWasVisible = m_Trihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
+ if(aTriedronWasVisible) m_Trihedron->VisibilityOff();
+ }
+
+ if(m_Trihedron->GetVisibleActorCount(CurrentRenderer)){
+ m_Trihedron->VisibilityOff();
+ ::ResetCamera(CurrentRenderer);
+ }else{
+ m_Trihedron->SetVisibility(VTKViewer_Trihedron::eOnlyLineOn);
+ ::ResetCamera(CurrentRenderer,true);
+ }
+ if(aTriedronWasVisible) m_Trihedron->VisibilityOn();
+ else m_Trihedron->VisibilityOff();
+ ::ResetCameraClippingRange(CurrentRenderer);
+}
+
+
+/*! starts Global Panning operation (e.g. through menu command)*/
+void VTKViewer_InteractorStyle::startGlobalPan()
+{
+ if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+ {
+ onFinishOperation();
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+ }
+ setCursor(VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN);
+ ForcedState = VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN;
+
+ // store current zoom scale
+ vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
+ myScale = cam->GetParallelScale();
+
+ ViewFitAll();
+
+ if (myGUIWindow) myGUIWindow->update();
+
+ qApp->installEventFilter(this);
+}
+
+
+/*!\retval TRUE if needs redrawing*/
+bool VTKViewer_InteractorStyle::needsRedrawing()
+{
+ return State == VTK_INTERACTOR_STYLE_CAMERA_ZOOM ||
+ State == VTK_INTERACTOR_STYLE_CAMERA_PAN ||
+ State == VTK_INTERACTOR_STYLE_CAMERA_ROTATE ||
+ State == VTK_INTERACTOR_STYLE_CAMERA_SPIN ||
+ State == VTK_INTERACTOR_STYLE_CAMERA_NONE;
+}
+
+
+/*! fits viewer contents to rectangle
+ *\param left - left side
+ *\param top - top side
+ *\param right - right side
+ *\param bottom - bottom side
+ */
+void VTKViewer_InteractorStyle::fitRect(const int left,
+ const int top,
+ const int right,
+ const int bottom)
+{
+ if (this->CurrentRenderer == NULL) return;
+
+ // move camera
+ int x = (left + right)/2;
+ int y = (top + bottom)/2;
+ int *aSize = this->CurrentRenderer->GetRenderWindow()->GetSize();
+ int oldX = aSize[0]/2;
+ int oldY = aSize[1]/2;
+ TranslateView(oldX, oldY, x, y);
+
+ // zoom camera
+ double dxf = (double)(aSize[0]) / (double)(abs(right - left));
+ double dyf = (double)(aSize[1]) / (double)(abs(bottom - top));
+ double zoomFactor = (dxf + dyf)/2 ;
+
+ vtkCamera *aCam = this->CurrentRenderer->GetActiveCamera();
+ if(aCam->GetParallelProjection())
+ aCam->SetParallelScale(aCam->GetParallelScale()/zoomFactor);
+ else{
+ aCam->Dolly(zoomFactor);
+ ::ResetCameraClippingRange(this->CurrentRenderer);
+ }
+
+ myGUIWindow->update();
+}
+
+
+/*! starts viewer operation (!internal usage!)*/
+void VTKViewer_InteractorStyle::startOperation(int operation)
+{
+ switch(operation)
+ {
+ case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN:
+ case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
+ case VTK_INTERACTOR_STYLE_CAMERA_PAN:
+ case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
+ case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
+ case VTK_INTERACTOR_STYLE_CAMERA_FIT:
+ case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
+ if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+ State = operation;
+ if (State != VTK_INTERACTOR_STYLE_CAMERA_SELECT)
+ setCursor(operation);
+ onStartOperation();
+ break;
+ case VTK_INTERACTOR_STYLE_CAMERA_NONE:
+ default:
+ setCursor(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+ State = ForcedState = VTK_INTERACTOR_STYLE_CAMERA_NONE;
+ break;
+ }
+}
+
+
+/*! sets proper cursor for window when viewer operation is activated*/
+void VTKViewer_InteractorStyle::setCursor(const int operation)
+{
+ if (!myGUIWindow) return;
+ switch (operation)
+ {
+ case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
+ myGUIWindow->setCursor(myZoomCursor);
+ myCursorState = true;
+ break;
+ case VTK_INTERACTOR_STYLE_CAMERA_PAN:
+ myGUIWindow->setCursor(myPanCursor);
+ myCursorState = true;
+ break;
+ case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
+ myGUIWindow->setCursor(myRotateCursor);
+ myCursorState = true;
+ break;
+ case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
+ myGUIWindow->setCursor(mySpinCursor);
+ myCursorState = true;
+ break;
+ case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN:
+ myGUIWindow->setCursor(myGlobalPanCursor);
+ myCursorState = true;
+ break;
+ case VTK_INTERACTOR_STYLE_CAMERA_FIT:
+ case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
+ myGUIWindow->setCursor(myHandCursor);
+ myCursorState = true;
+ break;
+ case VTK_INTERACTOR_STYLE_CAMERA_NONE:
+ default:
+ myGUIWindow->setCursor(myDefCursor);
+ myCursorState = false;
+ break;
+ }
+}
+
+/*!
+ Draws rectangle by starting and current points
+*/
+void VTKViewer_InteractorStyle::drawRect()
+{
+ if ( !myRectBand ) {
+ myRectBand = new QRubberBand( QRubberBand::Rectangle, myGUIWindow );
+ QPalette palette;
+ palette.setColor(myRectBand->foregroundRole(), Qt::white);
+ myRectBand->setPalette(palette);
+ }
+ myRectBand->hide();
+
+ QRect aRect(myPoint, myOtherPoint);
+ myRectBand->setGeometry( aRect );
+ myRectBand->setVisible( aRect.isValid() );
+}
+
+/*!
+ \brief Delete rubber band on the end on the dragging operation.
+*/
+void VTKViewer_InteractorStyle::endDrawRect()
+{
+ delete myRectBand;
+ myRectBand = 0;
+}
+
+/*! called when viewer operation started (!put necessary initialization here!)*/
+void VTKViewer_InteractorStyle::onStartOperation()
+{
+ if (!myGUIWindow) return;
+ // VSV: LOD actor activisation
+ // this->Interactor->GetRenderWindow()->SetDesiredUpdateRate(this->Interactor->GetDesiredUpdateRate());
+ switch (State) {
+ case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
+ case VTK_INTERACTOR_STYLE_CAMERA_FIT:
+ {
+ drawRect();
+ break;
+ }
+ case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
+ case VTK_INTERACTOR_STYLE_CAMERA_PAN:
+ case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
+ case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN:
+ case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
+ break;
+ }
+}
+
+
+/*! called when viewer operation finished (!put necessary post-processing here!)*/
+void VTKViewer_InteractorStyle::onFinishOperation()
+{
+ if (!myGUIWindow) return;
+
+
+// SUIT_Study* aActiveStudy = SUIT_Application::getDesktop()->getActiveStudy();
+// SALOME_Selection* aSel = SALOME_Selection::Selection( aActiveStudy->getSelection() );
+
+ // VSV: LOD actor activisation
+ // rwi->GetRenderWindow()->SetDesiredUpdateRate(rwi->GetStillUpdateRate());
+
+// Selection_Mode aSelectionMode = aSel->SelectionMode();
+// bool aSelActiveCompOnly = aSel->IsSelectActiveCompOnly();
+
+/* switch (State) {
+ case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
+ case VTK_INTERACTOR_STYLE_CAMERA_FIT:
+ {
+ QPainter p(myGUIWindow);
+ p.setPen(Qt::lightGray);
+ p.setRasterOp(Qt::XorROP);
+ QRect rect(myPoint, myOtherPoint);
+ p.drawRect(rect);
+ rect = rect.normalize();
+ if (State == VTK_INTERACTOR_STYLE_CAMERA_FIT) {
+ // making fit rect opeation
+ int w, h;
+ m_Interactor->GetSize(w, h);
+ int x1, y1, x2, y2;
+ x1 = rect.left();
+ y1 = h - rect.top() - 1;
+ x2 = rect.right();
+ y2 = h - rect.bottom() - 1;
+ fitRect(x1, y1, x2, y2);
+ }
+ else {
+ if (myPoint == myOtherPoint) {
+ // process point selection
+ int w, h, x, y;
+ m_Interactor->GetSize(w, h);
+ x = myPoint.x();
+ y = h - myPoint.y() - 1;
+
+ this->FindPokedRenderer(x, y);
+ m_Interactor->StartPickCallback();
+
+ vtkPicker* aPicker = vtkPicker::SafeDownCast(m_Interactor->GetPicker());
+ aPicker->Pick(x, y, 0.0, this->CurrentRenderer);
+
+ SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aPicker->GetActor());
+
+ if (vtkCellPicker* picker = vtkCellPicker::SafeDownCast(aPicker)) {
+ int aVtkId = picker->GetCellId();
+ if ( aVtkId >= 0 && SActor && SActor->hasIO() && IsValid( SActor, aVtkId ) ) {
+ int anObjId = SActor->GetElemObjId(aVtkId);
+ if(anObjId >= 0){
+ Handle(SALOME_InteractiveObject) IO = SActor->getIO();
+ if(aSelectionMode != EdgeOfCellSelection) {
+ if(CheckDimensionId(aSelectionMode,SActor,anObjId)){
+ if (IsSelected(IO,aSel)) {
+ // This IO is already in the selection
+ aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
+ } else {
+ if (!myShiftState) {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
+ aSel->AddIObject( IO, false );
+ }
+ }
+ }else{
+ if (!myShiftState) {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ int anEdgeId = GetEdgeId(picker,SActor,anObjId);
+ if (anEdgeId >= 0) {
+ aSel->AddOrRemoveIndex( IO, anObjId, true, false);
+ aSel->AddOrRemoveIndex( IO, -anEdgeId-1, true, true );
+ aSel->AddIObject( IO, false );
+ }
+ }
+ }
+ } else {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ } else if ( vtkPointPicker* picker = vtkPointPicker::SafeDownCast(aPicker) ) {
+ int aVtkId = picker->GetPointId();
+ if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ) {
+ if ( SActor && SActor->hasIO() ) {
+ int anObjId = SActor->GetNodeObjId(aVtkId);
+ if(anObjId >= 0){
+ Handle(SALOME_InteractiveObject) IO = SActor->getIO();
+ if(IsSelected(IO,aSel)) {
+ // This IO is already in the selection
+ aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
+ } else {
+ if(!myShiftState) {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false );
+ aSel->AddIObject( IO, false );
+ }
+ }
+ }
+ } else {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ } else {
+ if ( SActor && SActor->hasIO() ) {
+ this->PropPicked++;
+ Handle(SALOME_InteractiveObject) IO = SActor->getIO();
+ if(IsSelected(IO,aSel)) {
+ // This IO is already in the selection
+ if(myShiftState) {
+ aSel->RemoveIObject(IO);
+ }
+ }
+ else {
+ if(!myShiftState) {
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ aSel->AddIObject( IO, false );
+ }
+ }else{
+ // No selection clear all
+ this->PropPicked = 0;
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+ }
+ m_Interactor->EndPickCallback();
+ } else {
+ //processing rectangle selection
+ QString aComponentDataType = SUIT_Application::getDesktop()->getComponentDataType();
+ if(aSelActiveCompOnly && aComponentDataType.isEmpty()) return;
+ m_Interactor->StartPickCallback();
+
+ if (!myShiftState) {
+ this->PropPicked = 0;
+ this->HighlightProp( NULL );
+ aSel->ClearIObjects();
+ }
+
+ // Compute bounds
+ // vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
+ QRect rect(myPoint, myOtherPoint);
+ rect = rect.normalize();
+ int w, h;
+ m_Interactor->GetSize(w, h);
+ int x1, y1, x2, y2;
+ x1 = rect.left();
+ y1 = h - rect.top() - 1;
+ x2 = rect.right();
+ y2 = h - rect.bottom() - 1;
+
+ switch (aSelectionMode) {
+ case NodeSelection: {
+ if ( vtkPointPicker* aPointPicker = vtkPointPicker::SafeDownCast(m_Interactor->GetPicker()) ) {
+ vtkActorCollection* aListActors = this->CurrentRenderer->GetActors();
+ aListActors->InitTraversal();
+ while (vtkActor* aActor = aListActors->GetNextActor()) {
+ if (!aActor->GetVisibility())
+ continue;
+ if(SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aActor)) {
+ if (SActor->hasIO()) {
+ Handle(SALOME_InteractiveObject) IO = SActor->getIO();
+ if (IO.IsNull())
+ continue;
+ if (aSelActiveCompOnly && aComponentDataType != IO->getComponentDataType())
+ continue;
+ if (vtkDataSet* aDataSet = SActor->GetInput()) {
+ SALOME_Selection::TContainerOfId anIndices;
+ for(int i = 0; i < aDataSet->GetNumberOfPoints(); i++) {
+ float aPoint[3];
+ aDataSet->GetPoint(i,aPoint);
+ if (IsInRect(aPoint,x1,y1,x2,y2)){
+ float aDisp[3];
+ ComputeWorldToDisplay(aPoint[0],aPoint[1],aPoint[2],aDisp);
+ if(aPointPicker->Pick(aDisp[0],aDisp[1],0.0,CurrentRenderer)){
+ if(vtkActorCollection *anActorCollection = aPointPicker->GetActors()){
+ if(anActorCollection->IsItemPresent(SActor)){
+ float aPickedPoint[3];
+ aPointPicker->GetMapperPosition(aPickedPoint);
+ vtkIdType aVtkId = aDataSet->FindPoint(aPickedPoint);
+ if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ){
+ int anObjId = SActor->GetNodeObjId(aVtkId);
+ anIndices.insert(anObjId);
+ }
+ }
+ }
+ }
+ }
+ }
+ if (!anIndices.empty()) {
+ aSel->AddOrRemoveIndex(IO, anIndices, true, false);
+ aSel->AddIObject(IO, false);
+ anIndices.clear();
+ }else{
+ aSel->RemoveIObject(IO, false);
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+ }
+ case CellSelection:
+ case EdgeOfCellSelection:
+ case EdgeSelection:
+ case FaceSelection:
+ case VolumeSelection:
+ {
+ vtkSmartPointer<VTKViewer_CellRectPicker> picker = VTKViewer_CellRectPicker::New();
+ picker->SetTolerance(0.001);
+ picker->Pick(x1, y1, 0.0, x2, y2, 0.0, this->CurrentRenderer);
+
+ vtkActorCollection* aListActors = picker->GetActors();
+ aListActors->InitTraversal();
+ while(vtkActor* aActor = aListActors->GetNextActor()) {
+ if (SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) {
+ if (aSActor->hasIO()) {
+ Handle(SALOME_InteractiveObject) aIO = aSActor->getIO();
+ if (aSelActiveCompOnly && aComponentDataType != aIO->getComponentDataType())
+ continue;
+ VTKViewer_CellDataSet cellList = picker->GetCellData(aActor);
+ if ( !cellList.empty() ) {
+ SALOME_Selection::TContainerOfId anIndexes;
+ VTKViewer_CellDataSet::iterator it;
+ for ( it = cellList.begin(); it != cellList.end(); ++it ) {
+ int aCellId = (*it).cellId;
+
+ if ( !IsValid( aSActor, aCellId ) )
+ continue;
+
+ int anObjId = aSActor->GetElemObjId(aCellId);
+ if (anObjId != -1){
+ if ( CheckDimensionId(aSelectionMode,aSActor,anObjId) ) {
+ anIndexes.insert(anObjId);
+ }
+ }
+ }
+ aSel->AddOrRemoveIndex(aIO, anIndexes, true, false);
+ aSel->AddIObject(aIO, false);
+ }
+ }
+ }
+ }
+ }
+ break;
+ case ActorSelection: // objects selection
+ {
+ vtkSmartPointer<VTKViewer_RectPicker> picker = VTKViewer_RectPicker::New();
+ picker->SetTolerance(0.001);
+ picker->Pick(x1, y1, 0.0, x2, y2, 0.0, this->CurrentRenderer);
+
+ vtkActorCollection* aListActors = picker->GetActors();
+ SALOME_ListIO aListIO;
+ aListActors->InitTraversal();
+ while(vtkActor* aActor = aListActors->GetNextActor()) {
+ if (SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) {
+ if (aSActor->hasIO()) {
+ Handle(SALOME_InteractiveObject) aIO = aSActor->getIO();
+ if (!IsStored(aIO,aListIO))
+ aListIO.Append(aIO);
+ }
+ }
+ }
+ if (!aListIO.IsEmpty()) {
+ SALOME_ListIteratorOfListIO It(aListIO);
+ for(;It.More();It.Next()) {
+ Handle(SALOME_InteractiveObject) IOS = It.Value();
+ this->PropPicked++;
+ aSel->AddIObject( IOS, false );
+ }
+ }
+ } // end case 4
+ } //end switch
+ m_Interactor->EndPickCallback();
+ }
+ aActiveStudy->update3dViewers();
+ }
+ }
+ break;
+ case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
+ case VTK_INTERACTOR_STYLE_CAMERA_PAN:
+ case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
+ case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
+ break;
+ case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN:
+ {
+ int w, h, x, y;
+ m_Interactor->GetSize(w, h);
+ x = myPoint.x();
+ y = h - myPoint.y() - 1;
+ Place(x, y);
+ }
+ break;
+ }
+ if (myGUIWindow) myGUIWindow->update();
+*/
+}
+
+/*! called during viewer operation when user moves mouse (!put necessary processing here!)*/
+void VTKViewer_InteractorStyle::onOperation(QPoint mousePos)
+{
+ if (!myGUIWindow) return;
+ int w, h;
+ GetInteractor()->GetSize(w, h);
+ switch (State) {
+ case VTK_INTERACTOR_STYLE_CAMERA_PAN:
+ {
+ // processing panning
+ //this->FindPokedCamera(mousePos.x(), mousePos.y());
+ this->PanXY(mousePos.x(), myPoint.y(), myPoint.x(), mousePos.y());
+ myPoint = mousePos;
+ break;
+ }
+ case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
+ {
+ // processing zooming
+ //this->FindPokedCamera(mousePos.x(), mousePos.y());
+ this->DollyXY(mousePos.x() - myPoint.x(), mousePos.y() - myPoint.y());
+ myPoint = mousePos;
+ break;
+ }
+ case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
+ {
+ // processing rotation
+ //this->FindPokedCamera(mousePos.x(), mousePos.y());
+ this->RotateXY(mousePos.x() - myPoint.x(), myPoint.y() - mousePos.y());
+ myPoint = mousePos;
+ break;
+ }
+ case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
+ {
+ // processing spinning
+ //this->FindPokedCamera(mousePos.x(), mousePos.y());
+ this->SpinXY(mousePos.x(), mousePos.y(), myPoint.x(), myPoint.y());
+ myPoint = mousePos;
+ break;
+ }
+ case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN:
+ {
+ break;
+ }
+ case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
+ {
+ if (!myCursorState)
+ setCursor(VTK_INTERACTOR_STYLE_CAMERA_SELECT);
+ }
+ case VTK_INTERACTOR_STYLE_CAMERA_FIT:
+ {
+ myOtherPoint = mousePos;
+ drawRect();
+ break;
+ }
+ }
+ this->LastPos[0] = mousePos.x();
+ this->LastPos[1] = h - mousePos.y() - 1;
+}
+
+/*! called when selection mode changed (!put necessary initialization here!)*/
+void VTKViewer_InteractorStyle::OnSelectionModeChanged()
+{
+
+ myPreSelectionActor->SetVisibility(false);
+ myElemId = myEdgeId = myNodeId = -1;
+ mySelectedActor = NULL;
+}
+
+/*! called when user moves mouse inside viewer window and there is no active viewer operation \n
+ * (!put necessary processing here!)
+ */
+void VTKViewer_InteractorStyle::onCursorMove(QPoint mousePos) {
+ // processing highlighting
+// SUIT_Study* anActiveStudy = SUIT_Application::getDesktop()->getActiveStudy();
+// SALOME_Selection* Sel = SALOME_Selection::Selection( anActiveStudy->getSelection() );
+// Selection_Mode aSelectionMode = Sel->SelectionMode();
+
+/* int w, h, x, y;
+ m_Interactor->GetSize(w, h);
+ x = mousePos.x(); y = h - mousePos.y() - 1;
+
+ this->FindPokedRenderer(x,y);
+ m_Interactor->StartPickCallback();
+ myPreSelectionActor->SetVisibility(false);
+
+ vtkPicker* aPicker = vtkPicker::SafeDownCast(m_Interactor->GetPicker());
+ aPicker->Pick(x, y, 0.0, this->CurrentRenderer);
+
+ SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aPicker->GetActor());
+
+ if (vtkCellPicker* picker = vtkCellPicker::SafeDownCast(aPicker)) {
+ int aVtkId = picker->GetCellId();
+ if ( aVtkId >= 0 ) {
+ int anObjId = SActor->GetElemObjId(aVtkId);
+ if ( SActor && SActor->hasIO() && IsValid( SActor, aVtkId ) ) {
+ bool anIsSameObjId = (mySelectedActor == SActor && myElemId == anObjId);
+ bool aResult = anIsSameObjId;
+ if(!anIsSameObjId) {
+ if(aSelectionMode != EdgeOfCellSelection) {
+ aResult = CheckDimensionId(aSelectionMode,SActor,anObjId);
+ if(aResult){
+ mySelectedActor = SActor;
+ myElemId = anObjId;
+ m_Interactor->setCellData(anObjId,SActor,myPreSelectionActor);
+ }
+ }
+ }
+ if(aSelectionMode == EdgeOfCellSelection){
+ int anEdgeId = GetEdgeId(picker,SActor,anObjId);
+ bool anIsSameEdgeId = (myEdgeId != anEdgeId) && anIsSameObjId;
+ aResult = anIsSameEdgeId;
+ if(!anIsSameEdgeId) {
+ aResult = (anEdgeId >= 0);
+ if (aResult) {
+ mySelectedActor = SActor;
+ myEdgeId = anEdgeId;
+ myElemId = anObjId;
+ m_Interactor->setEdgeData(anObjId,SActor,-anEdgeId-1,myPreSelectionActor);
+ }
+ }
+ }
+ if(aResult) {
+ myPreSelectionActor->GetProperty()->SetRepresentationToSurface();
+ myPreSelectionActor->SetVisibility(true);
+ }
+ }
+ }
+ }
+ else if (vtkPointPicker* picker = vtkPointPicker::SafeDownCast(aPicker)) {
+ int aVtkId = picker->GetPointId();
+ if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ) {
+ if ( SActor && SActor->hasIO() ) {
+ int anObjId = SActor->GetNodeObjId(aVtkId);
+ bool anIsSameObjId = (mySelectedActor == SActor && myNodeId == anObjId);
+ if(!anIsSameObjId) {
+ mySelectedActor = SActor;
+ myNodeId = anObjId;
+ m_Interactor->setPointData(anObjId,SActor,myPreSelectionActor);
+ }
+ myPreSelectionActor->GetProperty()->SetRepresentationToSurface();
+ myPreSelectionActor->SetVisibility(true);
+ }
+ }
+ }
+ else if ( vtkPicker::SafeDownCast(aPicker) ) {
+ if ( SActor ) {
+ if ( myPreViewActor != SActor ) {
+ if ( myPreViewActor != NULL ) {
+ myPreViewActor->SetPreSelected( false );
+ }
+ myPreViewActor = SActor;
+
+ if ( SActor->hasIO() ) {
+ Handle( SALOME_InteractiveObject) IO = SActor->getIO();
+ if ( !IsSelected(IO,Sel) ) {
+ // Find All actors with same IO
+ vtkActorCollection* theActors = this->CurrentRenderer->GetActors();
+ theActors->InitTraversal();
+ while( vtkActor *ac = theActors->GetNextActor() ) {
+ if ( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac ) ) {
+ if ( anActor->hasIO() ) {
+ Handle(SALOME_InteractiveObject) IOS = anActor->getIO();
+ if(IO->isSame(IOS)) {
+ anActor->SetPreSelected( true );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ } else {
+ myPreViewActor = NULL;
+ vtkActorCollection* theActors = this->CurrentRenderer->GetActors();
+ theActors->InitTraversal();
+ while( vtkActor *ac = theActors->GetNextActor() ) {
+ if ( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac ) ) {
+ anActor->SetPreSelected( false );
+ }
+ }
+ }
+ }
+ m_Interactor->EndPickCallback();
+ //m_Interactor->Render();
+ myGUIWindow->update();
+
+ this->LastPos[0] = x;
+ this->LastPos[1] = y;*/
+}
+
+/*! called on finsh GlobalPan operation */
+void VTKViewer_InteractorStyle::Place(const int theX, const int theY)
+{
+ if (this->CurrentRenderer == NULL) {
+ return;
+ }
+
+ //translate view
+ int *aSize = this->CurrentRenderer->GetRenderWindow()->GetSize();
+ int centerX = aSize[0]/2;
+ int centerY = aSize[1]/2;
+
+ TranslateView(centerX, centerY, theX, theY);
+
+ // restore zoom scale
+ vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
+ cam->SetParallelScale(myScale);
+ ::ResetCameraClippingRange(this->CurrentRenderer);
+
+ if (myGUIWindow) myGUIWindow->update();
+
+}
+
+
+
+/*! Translates view from Point to Point*/
+void VTKViewer_InteractorStyle::TranslateView(int toX, int toY, int fromX, int fromY)
+{
+ vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
+ vtkFloatingPointType viewFocus[4], focalDepth, viewPoint[3];
+ vtkFloatingPointType newPickPoint[4], oldPickPoint[4], motionVector[3];
+ cam->GetFocalPoint(viewFocus);
+
+ this->ComputeWorldToDisplay(viewFocus[0], viewFocus[1],
+ viewFocus[2], viewFocus);
+ focalDepth = viewFocus[2];
+
+ this->ComputeDisplayToWorld(vtkFloatingPointType(toX), vtkFloatingPointType(toY),
+ focalDepth, newPickPoint);
+ this->ComputeDisplayToWorld(vtkFloatingPointType(fromX),vtkFloatingPointType(fromY),
+ focalDepth, oldPickPoint);
+
+ // camera motion is reversed
+ motionVector[0] = oldPickPoint[0] - newPickPoint[0];
+ motionVector[1] = oldPickPoint[1] - newPickPoint[1];
+ motionVector[2] = oldPickPoint[2] - newPickPoint[2];
+
+ cam->GetFocalPoint(viewFocus);
+ cam->GetPosition(viewPoint);
+ cam->SetFocalPoint(motionVector[0] + viewFocus[0],
+ motionVector[1] + viewFocus[1],
+ motionVector[2] + viewFocus[2]);
+ cam->SetPosition(motionVector[0] + viewPoint[0],
+ motionVector[1] + viewPoint[1],
+ motionVector[2] + viewPoint[2]);
+}
+
+
+/*! Checks: is the given Actor within display coordinates?*/
+bool VTKViewer_InteractorStyle::IsInRect(vtkActor* theActor,
+ const int left, const int top,
+ const int right, const int bottom)
+{
+ vtkFloatingPointType* aBounds = theActor->GetBounds();
+ vtkFloatingPointType aMin[3], aMax[3];
+ ComputeWorldToDisplay(aBounds[0], aBounds[2], aBounds[4], aMin);
+ ComputeWorldToDisplay(aBounds[1], aBounds[3], aBounds[5], aMax);
+ if (aMin[0] > aMax[0]) {
+ vtkFloatingPointType aBuf = aMin[0];
+ aMin[0] = aMax[0];
+ aMax[0] = aBuf;
+ }
+ if (aMin[1] > aMax[1]) {
+ vtkFloatingPointType aBuf = aMin[1];
+ aMin[1] = aMax[1];
+ aMax[1] = aBuf;
+ }
+
+ return ((aMin[0]>left) && (aMax[0]<right) && (aMin[1]>bottom) && (aMax[1]<top));
+}
+
+
+/*! Checks: is the given Cell within display coordinates?*/
+bool VTKViewer_InteractorStyle::IsInRect(vtkCell* theCell,
+ const int left, const int top,
+ const int right, const int bottom)
+{
+ vtkFloatingPointType* aBounds = theCell->GetBounds();
+ vtkFloatingPointType aMin[3], aMax[3];
+ ComputeWorldToDisplay(aBounds[0], aBounds[2], aBounds[4], aMin);
+ ComputeWorldToDisplay(aBounds[1], aBounds[3], aBounds[5], aMax);
+ if (aMin[0] > aMax[0]) {
+ vtkFloatingPointType aBuf = aMin[0];
+ aMin[0] = aMax[0];
+ aMax[0] = aBuf;
+ }
+ if (aMin[1] > aMax[1]) {
+ vtkFloatingPointType aBuf = aMin[1];
+ aMin[1] = aMax[1];
+ aMax[1] = aBuf;
+ }
+
+ return ((aMin[0]>left) && (aMax[0]<right) && (aMin[1]>bottom) && (aMax[1]<top));
+}
+
+/*!Checks: is given point \a thePoint in rectangle*/
+bool VTKViewer_InteractorStyle::IsInRect(vtkFloatingPointType* thePoint,
+ const int left, const int top,
+ const int right, const int bottom)
+{
+ vtkFloatingPointType aPnt[3];
+ ComputeWorldToDisplay(thePoint[0], thePoint[1], thePoint[2], aPnt);
+
+ return ((aPnt[0]>left) && (aPnt[0]<right) && (aPnt[1]>bottom) && (aPnt[1]<top));
+}
+
+/*!Set filter \a theFilter*/
+void VTKViewer_InteractorStyle::SetFilter( const Handle(VTKViewer_Filter)& theFilter )
+{
+ myFilters[ theFilter->GetId() ] = theFilter;
+}
+
+/*!Checks: is filter present (with id \a theId)
+ *\param theId - filter id.
+ */
+bool VTKViewer_InteractorStyle::IsFilterPresent( const int theId )
+{
+ return myFilters.find( theId ) != myFilters.end();
+}
+
+/*!Remove filter with id \a theId.
+ *\param theId - filter id.
+ */
+void VTKViewer_InteractorStyle::RemoveFilter( const int theId )
+{
+ if ( IsFilterPresent( theId ) )
+ myFilters.erase( theId );
+}
+
+/*!Checks: is valid cell(node) with id \a theId in actor \a theActor.
+ *\param theActor - VTKViewer_Actor pointer.
+ *\param theId - cell id.
+ *\param theIsNode - boolean flag, if true - node, else - cell.
+ */
+bool VTKViewer_InteractorStyle::IsValid( VTKViewer_Actor* theActor,
+ const int theId,
+ const bool theIsNode )
+{
+ std::map<int, Handle(VTKViewer_Filter)>::const_iterator anIter;
+ for ( anIter = myFilters.begin(); anIter != myFilters.end(); ++anIter )
+ {
+ const Handle(VTKViewer_Filter)& aFilter = anIter->second;
+ if ( theIsNode == aFilter->IsNodeFilter() &&
+ !aFilter->IsValid( theActor, theId ) )
+ return false;
+ }
+ return true;
+}
+
+/*!Gets filter handle by filter id \a theId.*/
+Handle(VTKViewer_Filter) VTKViewer_InteractorStyle::GetFilter( const int theId )
+{
+ return IsFilterPresent( theId ) ? myFilters[ theId ] : Handle(VTKViewer_Filter)();
+}
+
+/*!Increment pan.
+ *\param incrX - X coordinate increment.
+ *\param incrY - Y coordinate increment.
+ */
+void VTKViewer_InteractorStyle::IncrementalPan( const int incrX, const int incrY )
+{
+ this->PanXY( incrX, incrY, 0, 0 );
+}
+
+/*!Increment zoom.
+ *\param incr - zoom increment.
+ */
+void VTKViewer_InteractorStyle::IncrementalZoom( const int incr )
+{
+ this->DollyXY( incr, incr );
+}
+
+/*!Increment rotate.
+ *\param incrX - X coordinate increment.
+ *\param incrY - Y coordinate increment.
+ */
+void VTKViewer_InteractorStyle::IncrementalRotate( const int incrX, const int incrY )
+{
+ this->RotateXY( incrX, -incrY );
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+// SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+// Copyright (C) 2003 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
+//
+//
+//
+// File : VTKViewer_InteractorStyle.h
+// Author : Christophe ATTANASIO
+// Module : SALOME
+
+#ifndef __VTKViewer_InteractorStyle_h
+#define __VTKViewer_InteractorStyle_h
+
+#include <vtkInteractorStyle.h>
+
+class vtkCell;
+class vtkRenderWindowInteractor;
+
+#include <QObject>
+#include <QCursor>
+
+class QRubberBand;
+
+#include <map>
+
+#include "VTKViewer.h"
+
+#include "VTKViewer_Filter.h"
+
+class VTKViewer_Actor;
+class VTKViewer_Trihedron;
+class VTKViewer_ViewWindow;
+class VTKViewer_RenderWindowInteractor;
+
+#define VTK_INTERACTOR_STYLE_CAMERA_NONE 0
+#define VTK_INTERACTOR_STYLE_CAMERA_ROTATE 1
+#define VTK_INTERACTOR_STYLE_CAMERA_PAN 2
+#define VTK_INTERACTOR_STYLE_CAMERA_ZOOM 3
+#define VTK_INTERACTOR_STYLE_CAMERA_SPIN 4
+#define VTK_INTERACTOR_STYLE_CAMERA_FIT 5
+#define VTK_INTERACTOR_STYLE_CAMERA_SELECT 6
+#define VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN 7
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+/*! Description:\n
+ * This class must be supplied with a vtkRenderWindowInteractor wrapper or\n
+ * parent. This class should not normally be instantiated by application\n
+ * programmers.
+ */
+class VTKVIEWER_EXPORT VTKViewer_InteractorStyle : public QObject, public vtkInteractorStyle
+{
+ public:
+ static VTKViewer_InteractorStyle *New();
+ vtkTypeMacro(VTKViewer_InteractorStyle, vtkInteractorStyle);
+
+ virtual void SetInteractor(vtkRenderWindowInteractor *theInteractor);
+ void setViewWnd(VTKViewer_ViewWindow* theViewWnd);
+ void setGUIWindow(QWidget* theWindow);
+
+ void setTriedron(VTKViewer_Trihedron* theTrihedron);
+ void setPreselectionProp(const double& theRed = 0, const double& theGreen = 1,
+ const double& theBlue = 1, const int& theWidth = 5);
+
+ // Generic event bindings must be overridden in subclasses
+ void OnMouseMove (int ctrl, int shift, int x, int y);
+ void OnLeftButtonDown(int ctrl, int shift, int x, int y);
+ void OnLeftButtonUp (int ctrl, int shift, int x, int y);
+ void OnMiddleButtonDown(int ctrl, int shift, int x, int y);
+ void OnMiddleButtonUp (int ctrl, int shift, int x, int y);
+ void OnRightButtonDown(int ctrl, int shift, int x, int y);
+ void OnRightButtonUp (int ctrl, int shift, int x, int y);
+
+ void OnSelectionModeChanged();
+
+ void ViewFitAll();
+
+ void SetFilter( const Handle( VTKViewer_Filter)& );
+ Handle(VTKViewer_Filter) GetFilter( const int );
+ bool IsFilterPresent( const int );
+ void RemoveFilter( const int );
+ bool IsValid( VTKViewer_Actor* theActor,
+ const int theId,
+ const bool theIsNode = false );
+
+ void IncrementalPan ( const int incrX, const int incrY );
+ void IncrementalZoom ( const int incr );
+ void IncrementalRotate( const int incrX, const int incrY );
+
+ int CurrentState() const { return State; }
+
+ protected:
+ VTKViewer_InteractorStyle();
+ ~VTKViewer_InteractorStyle();
+ VTKViewer_InteractorStyle(const VTKViewer_InteractorStyle&) {};
+ void operator=(const VTKViewer_InteractorStyle&) {};
+
+ void RotateXY(int dx, int dy);
+ void PanXY(int x, int y, int oldX, int oldY);
+ void DollyXY(int dx, int dy);
+ void SpinXY(int dx, int dy, int oldX, int oldY);
+ void fitRect(const int left, const int top, const int right, const int bottom);
+ void Place(const int theX, const int theY);
+ void TranslateView(int toX, int toY, int fromX, int fromY);
+ bool IsInRect(vtkActor* theActor,
+ const int left, const int top,
+ const int right, const int bottom);
+ bool IsInRect(vtkCell* theCell,
+ const int left, const int top,
+ const int right, const int bottom);
+ bool IsInRect(vtkFloatingPointType* thePoint,
+ const int left, const int top,
+ const int right, const int bottom);
+
+ int State;
+ vtkFloatingPointType MotionFactor;
+ vtkFloatingPointType RadianToDegree; // constant: for conv from deg to rad
+ double myScale;
+
+ VTKViewer_Actor *myPreViewActor, *myPreSelectionActor, *mySelectedActor;
+
+ int myElemId;
+ int myEdgeId;
+ int myNodeId;
+
+ public:
+ bool eventFilter(QObject* object, QEvent* event);
+ void startZoom();
+ void startPan();
+ void startGlobalPan();
+ void startRotate();
+ void startFitArea();
+ void startSpin();
+ bool needsRedrawing();
+
+ protected:
+ void loadCursors();
+ void startOperation(int operation);
+ virtual void onStartOperation();
+ virtual void onFinishOperation();
+ virtual void onOperation(QPoint mousePos);
+ virtual void onCursorMove(QPoint mousePos);
+ virtual void setCursor(const int operation);
+
+ void drawRect();
+ void endDrawRect();
+
+ protected:
+ QCursor myDefCursor;
+ QCursor myPanCursor;
+ QCursor myZoomCursor;
+ QCursor myRotateCursor;
+ QCursor mySpinCursor;
+ QCursor myHandCursor;
+ QCursor myGlobalPanCursor;
+ QPoint myPoint;
+ QPoint myOtherPoint;
+ bool myCursorState;
+ bool myShiftState;
+ int ForcedState;
+
+ VTKViewer_RenderWindowInteractor* m_Interactor;
+ VTKViewer_ViewWindow* m_ViewWnd;
+ VTKViewer_Trihedron* m_Trihedron;
+ QWidget* myGUIWindow;
+
+ std::map<int, Handle(VTKViewer_Filter) > myFilters;
+
+ QRubberBand* myRectBand; //!< selection rectangle rubber band
+
+ /** @name members from old version*/
+ //@{
+ double DeltaElevation;
+ double DeltaAzimuth;
+ int LastPos[2];
+ //@}
+};
+
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
+#endif
--- /dev/null
+// SALOME FILTER : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 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
+//
+//
+//
+// File : SALOME_PassThroughFilter.cxx
+// Author : Laurent CORNABE with help of Nicolas REJNERI
+// Module : SALOME
+
+
+#include "VTKViewer_PassThroughFilter.h"
+
+#include <vtkCellData.h>
+#include <vtkDataSet.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+
+vtkCxxRevisionMacro(VTKViewer_PassThroughFilter, "$Revision$");
+vtkStandardNewMacro(VTKViewer_PassThroughFilter);
+
+/*! \class VTKViewer_PassThroughFilter
+ * Passive filter take a dataset as input and create a dataset as output.\n
+ * The form of the input geometry is not changed in these filters, \n
+ * only the point attributes (e.g. scalars, vectors, etc.).
+ */
+
+/*!Execute method.Output calculation.*/
+int VTKViewer_PassThroughFilter::RequestData(
+ vtkInformation *,
+ vtkInformationVector **inputVector,
+ vtkInformationVector *outputVector)
+{
+ // get the info objects
+ vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
+ vtkInformation *outInfo = outputVector->GetInformationObject(0);
+
+ // get the input and ouptut
+ vtkDataSet *input = vtkDataSet::SafeDownCast(
+ inInfo->Get(vtkDataObject::DATA_OBJECT()));
+ vtkDataSet *output = vtkDataSet::SafeDownCast(
+ outInfo->Get(vtkDataObject::DATA_OBJECT()));
+
+ // This has to be here because it initialized all field datas.
+ output->CopyStructure( input );
+
+ //! Pass all. (data object's field data is passed by the
+ //! superclass after this method)
+ output->GetPointData()->PassData( input->GetPointData() );
+ output->GetCellData()->PassData( input->GetCellData() );
+
+ return 1;
+}
+
+/*!Methods invoked by print to print information about the object including superclasses.\n
+ * Typically not called by the user (use Print() instead) but used in the hierarchical \n
+ * print process to combine the output of several classes.
+ *\param os - output stream.
+ */
+void VTKViewer_PassThroughFilter::PrintSelf(ostream& os, vtkIndent indent)
+{
+ this->Superclass::PrintSelf(os,indent);
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 VTKVIEWER_PASSTHROUGHFILTER_H
+#define VTKVIEWER_PASSTHROUGHFILTER_H
+
+#include "VTKViewer.h"
+
+#include <vtkDataSetToDataSetFilter.h>
+
+class VTKVIEWER_EXPORT VTKViewer_PassThroughFilter : public vtkDataSetToDataSetFilter
+{
+public:
+ vtkTypeRevisionMacro( VTKViewer_PassThroughFilter, vtkDataSetToDataSetFilter );
+ void PrintSelf( ostream& os, vtkIndent indent );
+
+ /*!Create a new VTKViewer_PassThroughFilter.*/
+ static VTKViewer_PassThroughFilter *New();
+
+protected:
+ VTKViewer_PassThroughFilter() {};//!< Null body.
+ virtual ~VTKViewer_PassThroughFilter() {};//!< Null body.
+
+ virtual int RequestData(vtkInformation *, vtkInformationVector **,
+ vtkInformationVector *); //generate output data
+
+private:
+ VTKViewer_PassThroughFilter( const VTKViewer_PassThroughFilter& ); //!< Not implemented.
+ void operator=( const VTKViewer_PassThroughFilter& ); //!< Not implemented.
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 "VTKViewer_RenderWindow.h"
+
+#include <QColorDialog>
+#include <QContextMenuEvent>
+
+#include <stdlib.h>
+#include <math.h>
+
+#include <vtkRenderWindowInteractor.h>
+#include <vtkRendererCollection.h>
+#include <vtkCamera.h>
+#ifndef WIN32
+#include <QX11Info>
+#include <vtkXOpenGLRenderWindow.h>
+//#include <GL/gl.h>
+//#include <GL/glu.h>
+//#include <qgl.h>
+#endif
+
+/*!Constructor. Create render window with parant \a parent and name \a name.
+ *\param parent - parent window
+ *\param name - render window name.
+ */
+VTKViewer_RenderWindow::VTKViewer_RenderWindow(QWidget* parent, const char* name) :
+QWidget(parent, Qt::FramelessWindowHint )
+{
+ setObjectName( name );
+ setAttribute( Qt::WA_DeleteOnClose );
+
+ myRW = vtkRenderWindow::New();
+#ifndef WIN32
+ myRW->SetDisplayId((void*)(QX11Info::display()));
+#endif
+ myRW->SetWindowId((void*)winId());
+ myRW->DoubleBufferOn();
+ setMouseTracking(true);
+}
+
+/*!Destructor.*/
+VTKViewer_RenderWindow::~VTKViewer_RenderWindow()
+{
+ myRW->Delete();
+}
+
+/*!Call Render method for render window field.*/
+void VTKViewer_RenderWindow::paintEvent(QPaintEvent* theEvent)
+{
+ myRW->Render();
+}
+
+/*!Resize render window.*/
+void VTKViewer_RenderWindow::resizeEvent(QResizeEvent* theEvent)
+{
+ int aWidth = myRW->GetSize()[0], aHeight = myRW->GetSize()[1];
+ if(vtkRenderWindowInteractor* aRWI = myRW->GetInteractor())
+ aRWI->UpdateSize(width(), height());
+ if(aWidth != width() || aHeight != height()){
+ vtkRendererCollection * aRenderers = myRW->GetRenderers();
+ aRenderers->InitTraversal();
+ double aCoeff = 1.0;
+ if(vtkRenderer *aRenderer = aRenderers->GetNextItem()){
+ vtkCamera *aCamera = aRenderer->GetActiveCamera();
+ double aScale = aCamera->GetParallelScale();
+ if((aWidth - width())*(aHeight - height()) > 0)
+ aCoeff = sqrt(double(aWidth)/double(width())*double(height())/double(aHeight));
+ else
+ aCoeff = double(aWidth)/double(width());
+ aCamera->SetParallelScale(aScale*aCoeff);
+ }
+ }
+}
+
+/*!Emit mouse move event.*/
+void VTKViewer_RenderWindow::mouseMoveEvent(QMouseEvent* event)
+{
+ emit MouseMove(event) ;
+}
+
+/*!Emit mouse button press event.*/
+void VTKViewer_RenderWindow::mousePressEvent(QMouseEvent* event)
+{
+ emit MouseButtonPressed( event );
+}
+
+/*!Emit mouse button release event.*/
+void VTKViewer_RenderWindow::mouseReleaseEvent( QMouseEvent *event )
+{
+ emit MouseButtonReleased( event );
+}
+
+/*!Emit mouse button double click event.*/
+void VTKViewer_RenderWindow::mouseDoubleClickEvent( QMouseEvent* event )
+{
+ emit MouseDoubleClicked( event );
+}
+
+/*!Emit key pressed event.*/
+void VTKViewer_RenderWindow::keyPressEvent (QKeyEvent* event)
+{
+ emit KeyPressed(event) ;
+}
+
+/*!Emit key release event.*/
+void VTKViewer_RenderWindow::keyReleaseEvent (QKeyEvent * event)
+{
+ emit KeyReleased(event) ;
+}
+
+/*!Emit wheel move event.*/
+void VTKViewer_RenderWindow::wheelEvent(QWheelEvent* event)
+{
+ emit WheelMoved(event) ;
+}
+
+/*!Reaction on change background color.*/
+void VTKViewer_RenderWindow::onChangeBackgroundColor()
+{
+ //float red, green, blue;
+ vtkFloatingPointType backint[3];
+
+ vtkRendererCollection * theRenderers = myRW->GetRenderers();
+ theRenderers->InitTraversal();
+ vtkRenderer * theRenderer = theRenderers->GetNextItem();
+ theRenderer->GetBackground(backint);
+
+ QColor selColor = QColorDialog::getColor ( QColor(int(backint[0]*255), int(backint[1]*255), int(backint[2]*255)), NULL );
+ if ( selColor.isValid() ) {
+ theRenderer->SetBackground( selColor.red()/255., selColor.green()/255., selColor.blue()/255. );
+ /* VSR : PAL5420 ---------------------------------------------------
+ SUIT_CONFIG->addSetting( "VTKViewer:BackgroundColorRed", selColor.red() );
+ SUIT_CONFIG->addSetting( "VTKViewer:BackgroundColorGreen", selColor.green() );
+ SUIT_CONFIG->addSetting( "VTKViewer:BackgroundColorBlue", selColor.blue() );
+ VSR : PAL5420 --------------------------------------------------- */
+ }
+}
+
+/*!Emit content menu requested.*/
+void VTKViewer_RenderWindow::contextMenuEvent ( QContextMenuEvent * e )
+{
+ if ( e->reason() != QContextMenuEvent::Mouse )
+ emit contextMenuRequested( e );
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 VTKVIEWER_RENDERWINDOW_H
+#define VTKVIEWER_RENDERWINDOW_H
+
+#include "VTKViewer.h"
+
+#include <vtkRenderWindow.h>
+
+#include <QWidget>
+
+class VTKVIEWER_EXPORT VTKViewer_RenderWindow : public QWidget
+{
+ Q_OBJECT
+
+public:
+ /* popup management */
+ //void onCreatePopup();
+
+// const char *GetClassName() {return "VTKViewer_RenderWindow";};
+
+public:
+ VTKViewer_RenderWindow(QWidget *parent, const char *name);
+ virtual ~VTKViewer_RenderWindow() ;
+
+ /*!Get render window pointer.*/
+ vtkRenderWindow* getRenderWindow() { return myRW; }
+
+ protected:
+ virtual void mouseMoveEvent( QMouseEvent* );
+ virtual void mousePressEvent( QMouseEvent* );
+ virtual void mouseReleaseEvent( QMouseEvent* );
+ virtual void mouseDoubleClickEvent( QMouseEvent* );
+ virtual void wheelEvent( QWheelEvent* );
+ virtual void keyPressEvent( QKeyEvent* );
+ virtual void keyReleaseEvent( QKeyEvent* );
+ virtual void paintEvent( QPaintEvent* );
+ virtual void resizeEvent( QResizeEvent* );
+ virtual void onChangeBackgroundColor();
+ virtual void contextMenuEvent( QContextMenuEvent * e );
+
+ signals:
+ /*!On mouse move signal.*/
+ void MouseMove( QMouseEvent* );
+ /*!On mouse button pressed signal.*/
+ void MouseButtonPressed( QMouseEvent* );
+ /*!On mouse button released signal.*/
+ void MouseButtonReleased( QMouseEvent* );
+ /*!On mouse double click signal.*/
+ void MouseDoubleClicked( QMouseEvent* );
+ /*!On wheel moved signal.*/
+ void WheelMoved( QWheelEvent* );
+ /*!On left button pressed signal.*/
+ void LeftButtonPressed(const QMouseEvent *event) ;
+ /*!On left button released signal.*/
+ void LeftButtonReleased(const QMouseEvent *event) ;
+ /*!On middle button pressed signal.*/
+ void MiddleButtonPressed(const QMouseEvent *event) ;
+ /*!On middle button released signal.*/
+ void MiddleButtonReleased(const QMouseEvent *event) ;
+ /*!On right button pressed signal.*/
+ void RightButtonPressed(const QMouseEvent *event) ;
+ /*!On right button released signal.*/
+ void RightButtonReleased(const QMouseEvent *event) ;
+
+ /*!On button pressed signal.*/
+ void ButtonPressed(const QMouseEvent *event);
+ /*!On button released signal.*/
+ void ButtonReleased(const QMouseEvent *event);
+ /*!On key pressed signal.*/
+ void KeyPressed( QKeyEvent* );
+ /*!On key released signal.*/
+ void KeyReleased( QKeyEvent* );
+ /*!On content menu requested signal.*/
+ void contextMenuRequested( QContextMenuEvent *e );
+
+ protected:
+ vtkRenderWindow* myRW;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 "VTKViewer_RenderWindowInteractor.h"
+#include "VTKViewer_RenderWindow.h"
+#include "VTKViewer_InteractorStyle.h"
+#include "SUIT_ViewModel.h"
+#include "VTKViewer_ViewWindow.h"
+
+//#include "SUIT_Application.h"
+//#include "SUIT_Desktop.h"
+
+//#include "SALOME_Selection.h"
+#include "VTKViewer_Actor.h"
+#include "VTKViewer_Algorithm.h"
+#include "VTKViewer_Functor.h"
+
+//#include <stdio.h>
+//#include <stdlib.h>
+//#include <string.h>
+//#include <math.h>
+
+// VTK Includes
+#include <vtkAssemblyNode.h>
+#include <vtkActor.h>
+#include <vtkInteractorStyle.h>
+#include <vtkObjectFactory.h>
+#include <vtkPicker.h>
+#include <vtkCellPicker.h>
+#include <vtkPointPicker.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkSphereSource.h>
+#include <vtkDataSet.h>
+#include <vtkMaskPoints.h>
+#include <vtkVertex.h>
+#include <vtkRendererCollection.h>
+#include <vtkPolyDataWriter.h>
+#include <vtkProperty.h>
+
+// QT Includes
+#include <QTimer>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QContextMenuEvent>
+
+/*! Create new instance of VTKViewer_RenderWindowInteractor*/
+VTKViewer_RenderWindowInteractor* VTKViewer_RenderWindowInteractor::New()
+{
+ vtkObject *ret = vtkObjectFactory::CreateInstance("VTKViewer_RenderWindowInteractor") ;
+ if( ret ) {
+ return dynamic_cast<VTKViewer_RenderWindowInteractor *>(ret) ;
+ }
+ return new VTKViewer_RenderWindowInteractor;
+}
+
+/*!Constructor.*/
+VTKViewer_RenderWindowInteractor::VTKViewer_RenderWindowInteractor()
+{
+ this->Enabled = 0 ;
+ this->mTimer = new QTimer( this ) ;
+ myDisplayMode = 0;
+
+ myBasicPicker = vtkPicker::New();
+ myCellPicker = vtkCellPicker::New();
+ myPointPicker = vtkPointPicker::New();
+
+ myCellActor = VTKViewer_Actor::New();
+ myCellActor->PickableOff();
+ myCellActor->GetProperty()->SetColor(1,1,0);
+ myCellActor->GetProperty()->SetLineWidth(5);
+ myCellActor->GetProperty()->SetRepresentationToSurface();
+
+ myEdgeActor = VTKViewer_Actor::New();
+ myEdgeActor->PickableOff();
+ myEdgeActor->GetProperty()->SetColor(1,0,0);
+ myEdgeActor->GetProperty()->SetLineWidth(5);
+ myEdgeActor->GetProperty()->SetRepresentationToWireframe();
+
+ myPointActor = VTKViewer_Actor::New();
+ myPointActor->PickableOff();
+ myPointActor->GetProperty()->SetColor(1,1,0);
+ myPointActor->GetProperty()->SetPointSize(5);
+ myPointActor->GetProperty()->SetRepresentationToPoints();
+
+ connect(mTimer, SIGNAL(timeout()), this, SLOT(TimerFunc())) ;
+}
+
+/*!Destructor.*/
+VTKViewer_RenderWindowInteractor::~VTKViewer_RenderWindowInteractor()
+{
+ delete mTimer ;
+
+ if ( GetRenderWindow() ) {
+ myViewWnd->RemoveActor(myCellActor);
+ myViewWnd->RemoveActor(myEdgeActor);
+ myViewWnd->RemoveActor(myPointActor);
+ }
+
+ myCellActor->Delete();
+ myEdgeActor->Delete();
+ myPointActor->Delete();
+
+ myBasicPicker->Delete();
+ myCellPicker->Delete();
+ myPointPicker->Delete();
+}
+
+/*!
+ Print interactor to stream
+ \param os - stream
+ \param indent
+*/
+void VTKViewer_RenderWindowInteractor::PrintSelf(ostream& os, vtkIndent indent)
+{
+ vtkRenderWindowInteractor::PrintSelf(os, indent) ;
+ //
+ // :NOTE: Fri Apr 21 21:51:05 2000 Pagey
+ // QGL specific stuff goes here. One should add output
+ // lines here if any protected members are added to
+ // the class.
+ //
+}
+
+/*!Description:\n
+ * Initializes the event handlers without an XtAppContext. This is \n
+ * good for when you don`t have a user interface, but you still \n
+ * want to have mouse interaction.\n
+ * We never allow the VTKViewer_RenderWindowInteractor to control \n
+ * the event loop. The application always has the control.
+ */
+void VTKViewer_RenderWindowInteractor::Initialize()
+{
+ //
+ // We cannot do much unless there is a render window
+ // associated with this interactor.
+ //
+ if( ! RenderWindow ) {
+ vtkErrorMacro(<< "VTKViewer_RenderWindowInteractor::Initialize(): No render window attached!") ;
+ return ;
+ }
+
+ //
+ // We cannot hand a render window which is not a VTKViewer_RenderWindow.
+ // One way to force this is to use dynamic_cast and hope that
+ // it works. If the dynamic_cast does not work, we flag an error
+ // and get the hell out.
+ //
+ vtkRenderWindow *my_render_win = dynamic_cast<vtkRenderWindow *>(RenderWindow) ;
+ if( !my_render_win ) {
+ vtkErrorMacro(<< "VTKViewer_RenderWindowInteractor::Initialize() can only handle VTKViewer_RenderWindow.") ;
+ return ;
+ }
+
+ //
+ // If the render window has zero size, then set it to a default
+ // value of 300x300.
+ //
+ int* aSize = my_render_win->GetSize();
+ this->Size[0] = ((aSize[0] > 0) ? aSize[0] : 300);
+ this->Size[1] = ((aSize[1] > 0) ? aSize[1] : 300);
+
+ this->SetPicker(myBasicPicker);
+
+ SetSelectionTolerance();
+
+ //
+ // Enable the interactor.
+ //
+ this->Enable() ;
+
+ //
+ // Start the rendering of the window.
+ //
+ my_render_win->Start() ;
+
+ //
+ // The interactor has been initialized.
+ //
+ this->Initialized = 1 ;
+
+ return ;
+}
+
+/*!Sets view window and add to it selection actors.*/
+void VTKViewer_RenderWindowInteractor::setViewWindow(VTKViewer_ViewWindow* theViewWnd){
+ myViewWnd = theViewWnd;
+
+ if ( myViewWnd ) {
+ myViewWnd->InsertActor(myCellActor);
+ myViewWnd->InsertActor(myEdgeActor);
+ myViewWnd->InsertActor(myPointActor);
+ }
+}
+
+/*!Move selection actors to view window.*/
+void VTKViewer_RenderWindowInteractor::MoveInternalActors()
+{
+ myViewWnd->MoveActor(myCellActor);
+ myViewWnd->MoveActor(myEdgeActor);
+ myViewWnd->MoveActor(myPointActor);
+}
+
+/*!Sets interactor style.*/
+void VTKViewer_RenderWindowInteractor::SetInteractorStyle(vtkInteractorObserver *theInteractor){
+ myInteractorStyle = dynamic_cast<VTKViewer_InteractorStyle*>(theInteractor);
+ vtkRenderWindowInteractor::SetInteractorStyle(theInteractor);
+}
+
+/*!Sets selection properties.
+ *\param theRed - red component of color
+ *\param theGreen - green component of color
+ *\param theBlue - blue component of color
+ *\param theWidth - point size and line width
+ */
+void VTKViewer_RenderWindowInteractor::SetSelectionProp(const double& theRed, const double& theGreen,
+ const double& theBlue, const int& theWidth)
+{
+ myCellActor->GetProperty()->SetColor(theRed, theGreen, theBlue);
+ myCellActor->GetProperty()->SetLineWidth(theWidth);
+
+ myPointActor->GetProperty()->SetColor(theRed, theGreen, theBlue);
+ myPointActor->GetProperty()->SetPointSize(theWidth);
+}
+
+/*!Sets selection tolerance
+ *\param theTolNodes - nodes selection tolerance
+ *\param theTolItems - selection tolerance for basic and cell pickers.
+ */
+void VTKViewer_RenderWindowInteractor::SetSelectionTolerance(const double& theTolNodes, const double& theTolItems)
+{
+ myTolNodes = theTolNodes;
+ myTolItems = theTolItems;
+
+ myBasicPicker->SetTolerance(myTolItems);
+ myCellPicker->SetTolerance(myTolItems);
+ myPointPicker->SetTolerance(myTolNodes);
+
+}
+
+/*! Description:\n
+ * Enable/Disable interactions. By default interactors are enabled when \n
+ * initialized. Initialize() must be called prior to enabling/disabling \n
+ * interaction. These methods are used when a window/widget is being \n
+ * shared by multiple renderers and interactors. This allows a "modal" \n
+ * display where one interactor is active when its data is to be displayed \n
+ * and all other interactors associated with the widget are disabled \n
+ * when their data is not displayed.
+ */
+void VTKViewer_RenderWindowInteractor::Enable()
+{
+ //
+ // Do not need to do anything if already enabled.
+ //
+ if( this->Enabled ) {
+ return ;
+ }
+
+ this->Enabled = 1 ;
+ this->Modified() ;
+}
+
+/*!See Enable().*/
+void VTKViewer_RenderWindowInteractor::Disable()
+{
+ if( ! this->Enabled ) {
+ return ;
+ }
+
+ this->Enabled = 0 ;
+ this->Modified() ;
+}
+
+/*!Description:\n
+ * This will start up the X event loop and never return. If you \n
+ * call this method it will loop processing X events until the \n
+ * application is exited.
+ */
+void VTKViewer_RenderWindowInteractor::Start()
+{
+ //
+ // We do not allow this interactor to control the
+ // event loop. Only the QtApplication objects are
+ // allowed to do that.
+ //
+ vtkErrorMacro(<<"VTKViewer_RenderWindowInteractor::Start() not allowed to start event loop.") ;
+}
+
+/*! Description:\n
+ * Event loop notification member for Window size change
+ */
+void VTKViewer_RenderWindowInteractor::UpdateSize(int w, int h)
+{
+ // if the size changed send this on to the RenderWindow
+ if ((w != this->Size[0])||(h != this->Size[1])) {
+ this->Size[0] = w;
+ this->Size[1] = h;
+ this->RenderWindow->SetSize(w,h);
+ }
+}
+
+/*! Description:
+ * Timer methods must be overridden by platform dependent subclasses.
+ * flag is passed to indicate if this is first timer set or an update
+ * as Win32 uses repeating timers, whereas X uses One shot more timer
+ * if flag == VTKXI_TIMER_FIRST Win32 and X should createtimer
+ * otherwise Win32 should exit and X should perform AddTimeOut
+ * \retval 1
+ */
+int VTKViewer_RenderWindowInteractor::CreateTimer(int vtkNotUsed(timertype))
+{
+ ///
+ /// Start a one-shot timer for 10ms.
+ ///
+ mTimer->setSingleShot(TRUE) ;
+ mTimer->start(10) ;
+ return 1 ;
+}
+
+/*!
+ \sa CreateTimer(int )
+ \retval 1
+ */
+int VTKViewer_RenderWindowInteractor::DestroyTimer(void)
+{
+ //
+ // :TRICKY: Tue May 2 00:17:32 2000 Pagey
+ //
+ /*! QTimer will automatically expire after 10ms. So
+ * we do not need to do anything here. In fact, we
+ * should not even Stop() the QTimer here because doing
+ * this will skip some of the processing that the TimerFunc()
+ * does and will result in undesirable effects. For
+ * example, this will result in vtkLODActor to leave
+ * the models in low-res mode after the mouse stops
+ * moving.
+ */
+ return 1 ;
+}
+
+/*! Not all of these slots are needed in VTK_MAJOR_VERSION=3,\n
+ * but moc does not understand "#if VTK_MAJOR_VERSION". Hence, \n
+ * we have to include all of these for the time being. Once,\n
+ * this bug in MOC is fixed, we can separate these.
+ */
+void VTKViewer_RenderWindowInteractor::TimerFunc()
+{
+ if( ! this->Enabled ) {
+ return ;
+ }
+
+ ((vtkInteractorStyle*)this->InteractorStyle)->OnTimer() ;
+ emit RenderWindowModified() ;
+}
+
+/*!Emit render window modified on mouse move,\n
+ *if interactor style needs redrawing and render window enabled.*/
+void VTKViewer_RenderWindowInteractor::MouseMove(QMouseEvent *event) {
+ if( ! this->Enabled ) {
+ return ;
+ }
+ myInteractorStyle->OnMouseMove(0, 0, event->x(), event->y()/*this->Size[1] - event->y() - 1*/) ;
+ if (myInteractorStyle->needsRedrawing() )
+ emit RenderWindowModified() ;
+}
+
+/*!Reaction on left button pressed.\n
+ *Same as left button down for interactor style.\n
+ *If render window enabled.
+ */
+void VTKViewer_RenderWindowInteractor::LeftButtonPressed(const QMouseEvent *event) {
+ if( ! this->Enabled ) {
+ return ;
+ }
+ myInteractorStyle->OnLeftButtonDown((event->modifiers() & Qt::ControlModifier),
+ (event->modifiers() & Qt::ShiftModifier),
+ event->x(), event->y());
+}
+
+/*!Reaction on left button releases.\n
+ *Same as left button up for interactor style.\n
+ *If render window enabled.
+ */
+void VTKViewer_RenderWindowInteractor::LeftButtonReleased(const QMouseEvent *event) {
+ if( ! this->Enabled ) {
+ return ;
+ }
+ myInteractorStyle->OnLeftButtonUp( (event->modifiers() & Qt::ControlModifier),
+ (event->modifiers() & Qt::ShiftModifier),
+ event->x(), event->y() ) ;
+}
+
+/*!Reaction on middle button pressed.\n
+ *Same as middle button down for interactor style.\n
+ *If render window enabled.
+ */
+void VTKViewer_RenderWindowInteractor::MiddleButtonPressed(const QMouseEvent *event) {
+ if( ! this->Enabled ) {
+ return ;
+ }
+ myInteractorStyle->OnMiddleButtonDown((event->modifiers() & Qt::ControlModifier),
+ (event->modifiers() & Qt::ShiftModifier),
+ event->x(), event->y() ) ;
+}
+
+/*!Reaction on middle button released.\n
+ *Same as middle button up for interactor style.\n
+ *If render window enabled.
+ */
+void VTKViewer_RenderWindowInteractor::MiddleButtonReleased(const QMouseEvent *event) {
+ if( ! this->Enabled ) {
+ return ;
+ }
+ myInteractorStyle->OnMiddleButtonUp( (event->modifiers() & Qt::ControlModifier),
+ (event->modifiers() & Qt::ShiftModifier),
+ event->x(), event->y() ) ;
+}
+
+/*!Reaction on right button pressed.\n
+ *Same as right button down for interactor style.\n
+ *If render window enabled.
+ */
+void VTKViewer_RenderWindowInteractor::RightButtonPressed(const QMouseEvent *event) {
+ if( ! this->Enabled ) {
+ return ;
+ }
+ myInteractorStyle->OnRightButtonDown( (event->modifiers() & Qt::ControlModifier),
+ (event->modifiers() & Qt::ShiftModifier),
+ event->x(), event->y() ) ;
+}
+
+/*!Reaction on right button released.\n
+ *Same as right button up for interactor style.If render window enabled.\n
+ *Emit context menu requested, if interactor style state equal VTK_INTERACTOR_STYLE_CAMERA_NONE.
+ */
+void VTKViewer_RenderWindowInteractor::RightButtonReleased(const QMouseEvent *event) {
+ if( ! this->Enabled ) {
+ return ;
+ }
+ bool isOperation = myInteractorStyle->CurrentState() != VTK_INTERACTOR_STYLE_CAMERA_NONE;
+ myInteractorStyle->OnRightButtonUp( (event->modifiers() & Qt::ControlModifier),
+ (event->modifiers() & Qt::ShiftModifier),
+ event->x(), event->y() );
+ if ( !isOperation )
+ {
+ QContextMenuEvent aEvent( QContextMenuEvent::Mouse,
+ event->pos(), event->globalPos() );
+ emit contextMenuRequested( &aEvent );
+ }
+}
+
+/*!Reaction on button pressed.
+ *\warning Do nothing.
+ */
+void VTKViewer_RenderWindowInteractor::ButtonPressed(const QMouseEvent *event) {
+ return ;
+}
+
+/*!Reaction on button released..
+ *\warning Do nothing.
+ */
+void VTKViewer_RenderWindowInteractor::ButtonReleased(const QMouseEvent *event) {
+ return ;
+}
+
+/*!Gets display mode.*/
+int VTKViewer_RenderWindowInteractor::GetDisplayMode() {
+ return myDisplayMode;
+}
+
+/*!Sets display mode.*/
+void VTKViewer_RenderWindowInteractor::SetDisplayMode(int theMode) {
+ if(theMode == 0)
+ ChangeRepresentationToWireframe();
+ else
+ ChangeRepresentationToSurface();
+ myDisplayMode = theMode;
+}
+
+/*!Change all actors to wireframe*/
+void VTKViewer_RenderWindowInteractor::ChangeRepresentationToWireframe()
+{
+ ChangeRepresentationToWireframe(GetRenderer()->GetActors());
+}
+
+/*!Change all actors to surface*/
+void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface()
+{
+ ChangeRepresentationToSurface(GetRenderer()->GetActors());
+}
+
+/*!Change all actors from \a theCollection to wireframe and
+ * emit render window modified.
+ */
+void VTKViewer_RenderWindowInteractor::ChangeRepresentationToWireframe(vtkActorCollection* theCollection)
+{
+ using namespace VTK;
+ ForEach<VTKViewer_Actor>(theCollection,
+ TSetFunction<VTKViewer_Actor,int>
+ (&VTKViewer_Actor::setDisplayMode,0));
+ emit RenderWindowModified();
+}
+
+/*!Change all actors from \a theCollection to surface and
+ * emit render window modified.
+ */
+void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface(vtkActorCollection* theCollection)
+{
+ using namespace VTK;
+ ForEach<VTKViewer_Actor>(theCollection,
+ TSetFunction<VTKViewer_Actor,int>
+ (&VTKViewer_Actor::setDisplayMode,1));
+ emit RenderWindowModified();
+}
+
+/*!Gets renderer.*/
+vtkRenderer* VTKViewer_RenderWindowInteractor::GetRenderer()
+{
+ vtkRendererCollection * theRenderers = this->RenderWindow->GetRenderers();
+ theRenderers->InitTraversal();
+ return theRenderers->GetNextItem();
+}
+
+/*!Do nothing*/
+void VTKViewer_RenderWindowInteractor::EraseAll()
+{
+}
+
+/*!Display all actors.
+ *Sets visible for all actors from renderer collection and emit render window modified.
+ */
+void VTKViewer_RenderWindowInteractor::DisplayAll()
+{
+ using namespace VTK;
+ vtkActorCollection* aCollection = GetRenderer()->GetActors();
+ ForEach<VTKViewer_Actor>(aCollection,TSetVisibility<VTKViewer_Actor>(true));
+
+ emit RenderWindowModified() ;
+}
+
+/*!Do nothing*/
+void VTKViewer_RenderWindowInteractor::Erase( VTKViewer_Actor* SActor, bool update)
+{
+}
+
+/*!Remove \a SActor from renderer and emit update window, if \a updateViewer - true*/
+void VTKViewer_RenderWindowInteractor::Remove( VTKViewer_Actor* SActor, bool updateViewer )
+{
+ if ( SActor != 0 )
+ {
+ GetRenderer()->RemoveProp( SActor );
+ if ( updateViewer )
+ emit RenderWindowModified();
+ }
+}
+
+/*!Remove actors from render window collection(not implemented).
+ *Emit render window modified, if \a updateViewer - true.
+ */
+void VTKViewer_RenderWindowInteractor::RemoveAll( const bool updateViewer )
+{
+ vtkRenderer* aRenderer = GetRenderer();
+ vtkActorCollection* anActors = aRenderer->GetActors();
+ if ( anActors )
+ {
+ anActors->InitTraversal();
+ while ( vtkActor *anAct = anActors->GetNextActor() )
+ {
+ if ( anAct->IsA( "VTKViewer_Actor" ) )
+ {
+ }
+ }
+
+ if ( updateViewer )
+ emit RenderWindowModified();
+ }
+}
+
+/*!\brief Display the \a theActor.*/
+/*! Add actor to renderer and set visibility to true.
+ * Emit render window modified, if \a update - true.
+ */
+void VTKViewer_RenderWindowInteractor::Display( VTKViewer_Actor* theActor, bool update)
+{
+ GetRenderer()->AddActor(theActor);
+ theActor->SetVisibility(true);
+
+ if(update)
+ emit RenderWindowModified();
+}
+
+/*!
+ default key press event (empty implementation)
+*/
+void VTKViewer_RenderWindowInteractor::KeyPressed(QKeyEvent *event)
+{
+ /// NOT_IMPLEMENTED
+}
+
+/*!Structure with one function "operator()", which call apply properties for actor.*/
+struct TUpdateAction{
+ /*!Apply properties for \a theActor.*/
+ void operator()(vtkActor* theActor){
+ theActor->ApplyProperties();
+ }
+};
+
+/*!Update all actors from renderer and emit render window modified.*/
+void VTKViewer_RenderWindowInteractor::Update() {
+ using namespace VTK;
+ vtkRenderer* aRen = GetRenderer();
+ ForEach<vtkActor>(aRen->GetActors(),TUpdateAction());
+
+ aRen->ResetCamera();
+
+ emit RenderWindowModified();
+}
+
+/*!Unhighlight all selection actors.*/
+void VTKViewer_RenderWindowInteractor::unHighlightSubSelection(){
+ myPointActor->SetVisibility(false);
+ myEdgeActor->SetVisibility(false);
+ myCellActor->SetVisibility(false);
+}
+
+/*!@see unHighlightSubSelection()
+ * Also emit render window modified.
+ */
+bool VTKViewer_RenderWindowInteractor::unHighlightAll(){
+ unHighlightSubSelection();
+
+ emit RenderWindowModified() ;
+ return false;
+}
+
+
+/*! \li Sets actors data and sets visibility to true, if flag \a hilight - true,
+ * else sets visibility to false.
+ * \li Emit render window modified, if flag \a update - true.
+ */
+bool VTKViewer_RenderWindowInteractor::highlight(const TColStd_IndexedMapOfInteger& theMapIndex,
+ VTKViewer_Actor* theMapActor, VTKViewer_Actor* theActor,
+ TUpdateActor theFun, bool hilight, bool update)
+{
+ if(theMapIndex.Extent() == 0) return false;
+
+ if (hilight) {
+ setActorData(theMapIndex,theMapActor,theActor,theFun);
+ theActor->SetVisibility(true);
+ }
+ else {
+ theActor->SetVisibility(false);
+ }
+
+ if(update){
+ this->RenderWindow->Render();
+ emit RenderWindowModified() ;
+ }
+
+ return false;
+}
+
+/*!Sets actors data.*/
+void VTKViewer_RenderWindowInteractor::setActorData(const TColStd_IndexedMapOfInteger& theMapIndex,
+ VTKViewer_Actor * theMapActor,
+ VTKViewer_Actor * theActor,
+ TUpdateActor theFun)
+{
+ (*theFun)(theMapIndex,theMapActor,theActor);
+ vtkFloatingPointType aPos[3];
+ theMapActor->GetPosition(aPos);
+ theActor->SetPosition(aPos);
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 VTKVIEWER_RENDERWINDOWINTERACTOR_H
+#define VTKVIEWER_RENDERWINDOWINTERACTOR_H
+
+#include "VTKViewer.h"
+#include "VTKViewer_Actor.h"
+
+#include <QObject>
+
+class QTimer;
+class QMouseEvent;
+class QKeyEvent;
+class QContextMenuEvent;
+
+// Open CASCADE Includes
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
+class vtkPicker;
+class vtkCellPicker;
+class vtkPointPicker;
+class vtkActorCollection;
+
+class VTKViewer_Actor;
+class VTKViewer_ViewWindow;
+class VTKViewer_RenderWindow;
+class VTKViewer_InteractorStyle;
+
+#include "VTKViewer_Algorithm.h"
+
+#include <vtkActor.h>
+#include <vtkVersion.h>
+#include <vtkRenderWindowInteractor.h>
+
+class VTKVIEWER_EXPORT VTKViewer_RenderWindowInteractor : public QObject, public vtkRenderWindowInteractor
+{
+ Q_OBJECT
+
+public:
+ static VTKViewer_RenderWindowInteractor *New();
+
+ vtkTypeMacro(VTKViewer_RenderWindowInteractor,vtkRenderWindowInteractor);
+
+ void PrintSelf(ostream& os, vtkIndent indent);
+
+ virtual void Initialize();
+
+ virtual void SetInteractorStyle(vtkInteractorObserver *);
+ /*!Return interactor style pointer.*/
+ VTKViewer_InteractorStyle* GetInteractorStyle() const
+ {
+ return myInteractorStyle;
+ }
+
+ virtual void Start();
+
+ virtual void Enable();
+ virtual void Disable();
+
+ virtual void UpdateSize(int x,int y);
+
+ /** @name Timer options*/
+ //@{
+ virtual int CreateTimer(int ) ;
+ virtual int DestroyTimer() ;
+ //@}
+
+ /*! Description:\n
+ * This function is called on 'q','e' keypress if exitmethod is not\n
+ * specified and should be overidden by platform dependent subclasses\n
+ * to provide a termination procedure if one is required.
+ */
+ virtual void TerminateApp(void) { /* empty */ }
+
+ // Description:
+ // These methods correspond to the the Exit, User and Pick
+ // callbacks. They allow for the Style to invoke them.
+ //virtual void ExitCallback();
+ //virtual void UserCallback();
+ //virtual void StartPickCallback();
+ //virtual void EndPickCallback();
+
+ /** @name Selection Management */
+ //@{
+ bool highlightCell(const TColStd_IndexedMapOfInteger& MapIndex,
+ VTKViewer_Actor* theMapActor,
+ bool hilight,
+ bool update = true );
+ bool highlightEdge(const TColStd_IndexedMapOfInteger& MapIndex,
+ VTKViewer_Actor* theMapActor,
+ bool hilight,
+ bool update = true );
+ bool highlightPoint(const TColStd_IndexedMapOfInteger& MapIndex,
+ VTKViewer_Actor* theMapActor,
+ bool hilight,
+ bool update = true );
+
+ void unHighlightSubSelection();
+ bool unHighlightAll();
+
+ //void SetSelectionMode(Selection_Mode mode);
+ void SetSelectionProp(const double& theRed = 1, const double& theGreen = 1,
+ const double& theBlue = 0, const int& theWidth = 5);
+ void SetSelectionTolerance(const double& theTolNodes = 0.025, const double& theTolCell = 0.001);
+ //@}
+
+ /** @name Displaymode management*/
+ //@{
+ int GetDisplayMode();
+ void SetDisplayMode(int);
+ //@}
+
+ /** @name Change all actors to wireframe or surface*/
+ //@{
+ void ChangeRepresentationToWireframe();
+ void ChangeRepresentationToSurface();
+ //@}
+
+ /** @name Change to wireframe or surface a list of vtkactor*/
+ //@{
+ void ChangeRepresentationToWireframe(vtkActorCollection* ListofActors);
+ void ChangeRepresentationToSurface(vtkActorCollection* ListofActors);
+ //@}
+
+ /** @name Erase Display functions*/
+ //@{
+ void EraseAll();
+ void DisplayAll();
+ void RemoveAll( const bool immediatly );
+
+ void Display( VTKViewer_Actor* SActor, bool immediatly = true );
+ void Erase( VTKViewer_Actor* SActor, bool immediatly = true );
+ void Remove( VTKViewer_Actor* SActor, bool updateViewer = true );
+ //@}
+
+ void Update();
+
+ vtkRenderer* GetRenderer();
+
+ void setViewWindow( VTKViewer_ViewWindow* theViewWnd );
+
+ void setCellData(const int& theIndex,
+ VTKViewer_Actor* theMapActor,
+ VTKViewer_Actor* theActor) {}
+ void setEdgeData(const int& theCellIndex,
+ VTKViewer_Actor* theMapActor,
+ const int& theEdgeIndex,
+ VTKViewer_Actor* theActor ) {} //NB
+ void setPointData(const int& theIndex,
+ VTKViewer_Actor* theMapActor,
+ VTKViewer_Actor* theActor) {}
+
+ typedef void (*TUpdateActor)(const TColStd_IndexedMapOfInteger& theMapIndex,
+ VTKViewer_Actor* theMapActor,
+ VTKViewer_Actor* theActor);
+ protected:
+
+ VTKViewer_RenderWindowInteractor();
+ ~VTKViewer_RenderWindowInteractor();
+
+ VTKViewer_InteractorStyle* myInteractorStyle;
+
+ bool highlight(const TColStd_IndexedMapOfInteger& theMapIndex,
+ VTKViewer_Actor* theMapActor, VTKViewer_Actor* theActor,
+ TUpdateActor theFun, bool hilight, bool update);
+ void setActorData(const TColStd_IndexedMapOfInteger& theMapIndex,
+ VTKViewer_Actor* theMapActor,
+ VTKViewer_Actor *theActor,
+ TUpdateActor theFun);
+
+ /*! Timer used during various mouse events to figure
+ * out mouse movements.
+ */
+ QTimer *mTimer ;
+
+ int myDisplayMode;
+
+ //NRI: Selection mode
+ VTKViewer_Actor* myPointActor;
+ VTKViewer_Actor* myEdgeActor;
+ VTKViewer_Actor* myCellActor;
+ void MoveInternalActors();
+
+ vtkPicker* myBasicPicker;
+ vtkCellPicker* myCellPicker;
+ vtkPointPicker* myPointPicker;
+
+ /*! User for switching to stereo mode.*/
+ int PositionBeforeStereo[2];
+
+ public slots:
+ void MouseMove(QMouseEvent *event) ;
+ void LeftButtonPressed(const QMouseEvent *event) ;
+ void LeftButtonReleased(const QMouseEvent *event) ;
+ void MiddleButtonPressed(const QMouseEvent *event) ;
+ void MiddleButtonReleased(const QMouseEvent *event) ;
+ void RightButtonPressed(const QMouseEvent *event) ;
+ void RightButtonReleased(const QMouseEvent *event) ;
+ void ButtonPressed(const QMouseEvent *event) ;
+ void ButtonReleased(const QMouseEvent *event) ;
+ void KeyPressed(QKeyEvent *event) ;
+
+ private slots:
+ void TimerFunc() ;
+
+signals:
+ void RenderWindowModified() ;
+ void contextMenuRequested( QContextMenuEvent *e );
+
+private:
+ friend class VTKViewer_ViewWindow;
+
+ VTKViewer_ViewWindow* myViewWnd;
+ /** Selection node tolerance.*/
+ double myTolNodes;
+ /** Selection cell tolerance.*/
+ double myTolItems;
+};
+
+#endif
--- /dev/null
+// SALOME OBJECT : kernel of SALOME component
+//
+// Copyright (C) 2003 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
+//
+//
+//
+// File : SALOME_GeometryFilter.cxx
+// Author : Michael ZORIN
+// Module : SALOME
+// $Header$
+
+#include "VTKViewer_ShrinkFilter.h"
+
+#include <vtkCell.h>
+#include <vtkCellData.h>
+#include <vtkIdList.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+
+vtkCxxRevisionMacro(VTKViewer_ShrinkFilter, "$Revision$");
+vtkStandardNewMacro(VTKViewer_ShrinkFilter);
+
+/*!Constructor. Sets store mapping to zero.*/
+VTKViewer_ShrinkFilter::VTKViewer_ShrinkFilter():
+ myStoreMapping(0)
+{}
+
+/*!Destructor.*/
+VTKViewer_ShrinkFilter::~VTKViewer_ShrinkFilter()
+{}
+
+
+/*!Execute method. Calculate output.*/
+int VTKViewer_ShrinkFilter::RequestData(
+ vtkInformation *vtkNotUsed(request),
+ vtkInformationVector **inputVector,
+ vtkInformationVector *outputVector)
+{
+ // get the info objects
+ vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
+ vtkInformation *outInfo = outputVector->GetInformationObject(0);
+
+ // get the input and ouptut
+ vtkDataSet *input = vtkDataSet::SafeDownCast(
+ inInfo->Get(vtkDataObject::DATA_OBJECT()));
+ vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast(
+ outInfo->Get(vtkDataObject::DATA_OBJECT()));
+
+ vtkPoints *newPts;
+ int i, j, numIds, abort=0;
+ vtkIdType cellId, numCells, numPts;
+ vtkIdType oldId, newId;
+ vtkFloatingPointType center[3], *p, pt[3];
+ vtkPointData *pd, *outPD;;
+ vtkIdList *ptIds, *newPtIds;
+ vtkIdType tenth;
+ vtkFloatingPointType decimal;
+
+ vtkDebugMacro(<<"Shrinking cells");
+
+ numCells=input->GetNumberOfCells();
+ numPts = input->GetNumberOfPoints();
+ if (numCells < 1 || numPts < 1)
+ {
+ vtkErrorMacro(<<"No data to shrink!");
+ return 0;
+ }
+
+ ptIds = vtkIdList::New();
+ ptIds->Allocate(VTK_CELL_SIZE);
+ newPtIds = vtkIdList::New();
+ newPtIds->Allocate(VTK_CELL_SIZE);
+
+ output->Allocate(numCells);
+ newPts = vtkPoints::New();
+ newPts->Allocate(numPts*8,numPts);
+ pd = input->GetPointData();
+ outPD = output->GetPointData();
+ outPD->CopyAllocate(pd,numPts*8,numPts);
+
+ // Traverse all cells, obtaining node coordinates. Compute "center" of cell,
+ // then create new vertices shrunk towards center.
+ //
+ tenth = numCells/10 + 1;
+ decimal = 0.0;
+ if(myStoreMapping){
+ myVTK2ObjIds.clear();
+ myVTK2ObjIds.reserve(numCells);
+ }
+
+ for (cellId=0; cellId < numCells && !abort; cellId++)
+ {
+ input->GetCellPoints(cellId, ptIds);
+ numIds = ptIds->GetNumberOfIds();
+
+ //abort/progress methods
+ if (cellId % tenth == 0)
+ {
+ decimal += 0.1;
+ this->UpdateProgress (decimal);
+ abort = this->GetAbortExecute();
+ }
+
+ // get the center of the cell
+ center[0] = center[1] = center[2] = 0.0;
+ for (i=0; i < numIds; i++)
+ {
+ p = input->GetPoint(ptIds->GetId(i));
+ for (j=0; j < 3; j++)
+ {
+ center[j] += p[j];
+ }
+ }
+ for (j=0; j<3; j++)
+ {
+ center[j] /= numIds;
+ }
+
+ // Create new points and cells
+ newPtIds->Reset();
+ for (i=0; i < numIds; i++)
+ {
+ p = input->GetPoint(ptIds->GetId(i));
+ for (j=0; j < 3; j++)
+ {
+ pt[j] = center[j] + this->ShrinkFactor*(p[j] - center[j]);
+ }
+
+ oldId = ptIds->GetId(i);
+ newId = newPts->InsertNextPoint(pt);
+ if(myStoreMapping)
+ myVTK2ObjIds.push_back(oldId);
+ newPtIds->InsertId(i,newId);
+
+ outPD->CopyData(pd, oldId, newId);
+ }
+ output->InsertNextCell(input->GetCellType(cellId), newPtIds);
+ }//for all cells
+
+ // Update ourselves and release memory
+ //
+ output->GetCellData()->PassData(input->GetCellData());
+
+ output->SetPoints(newPts);
+ output->Squeeze();
+
+ ptIds->Delete();
+ newPtIds->Delete();
+ newPts->Delete();
+
+ return 1;
+}
+
+/*!Sets store mapping.*/
+void VTKViewer_ShrinkFilter::SetStoreMapping(int theStoreMapping){
+ myStoreMapping = theStoreMapping;
+ this->Modified();
+}
+
+
+/*!Return node object id by vtk node id.
+ *\retval -1 - if no object, else return id.
+ */
+vtkIdType VTKViewer_ShrinkFilter::GetNodeObjId(int theVtkID)
+{
+ if ( myVTK2ObjIds.empty() || theVtkID > (int)myVTK2ObjIds.size() )
+ return -1;
+ return myVTK2ObjIds.at(theVtkID);
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 VTKVIEWER_SHRINKFILTER_H
+#define VTKVIEWER_SHRINKFILTER_H
+
+#include "VTKViewer.h"
+
+#include <vtkShrinkFilter.h>
+
+#include <vector>
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+/*!Shrink cells composing an arbitrary data set.
+ *\warning It is possible to turn cells inside out or cause self intersection in special cases.
+ */
+class VTKVIEWER_EXPORT VTKViewer_ShrinkFilter : public vtkShrinkFilter
+{
+public:
+ /*!Create new instance of VTKViewer_ShrinkFilter.*/
+ static VTKViewer_ShrinkFilter *New();
+ vtkTypeRevisionMacro(VTKViewer_ShrinkFilter, vtkShrinkFilter);
+
+ void SetStoreMapping(int theStoreMapping);
+ /*!Gets store mapping flag.*/
+ int GetStoreMapping(){ return myStoreMapping;}
+
+ virtual vtkIdType GetNodeObjId(int theVtkID);
+ /*!Return element id by vtk id.*/
+ virtual vtkIdType GetElemObjId(int theVtkID) { return theVtkID;}
+
+protected:
+ VTKViewer_ShrinkFilter();
+ ~VTKViewer_ShrinkFilter();
+
+ virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+ /*!Not implemented.*/
+ void UnstructuredGridExecute();
+
+private:
+ int myStoreMapping;
+ typedef std::vector<vtkIdType> TVectorId;
+ TVectorId myVTK2ObjIds;
+};
+
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
+#endif
--- /dev/null
+// SALOME FILTER : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 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
+//
+//
+//
+// File : SALOME_Transform.cxx
+// Author : Laurent CORNABE with help of Nicolas REJNERI
+// Module : SALOME
+
+
+#include "VTKViewer_Transform.h"
+
+#include <vtkObjectFactory.h>
+#include <vtkMatrix4x4.h>
+
+static double EPS = 10e-4;
+
+
+vtkStandardNewMacro(VTKViewer_Transform);
+
+/*!Sets matrix scale.*/
+void VTKViewer_Transform::SetMatrixScale(double theScaleX, double theScaleY, double theScaleZ){
+ double aMatrix[16] = {theScaleX,0,0,0,
+ 0,theScaleY,0,0,
+ 0,0,theScaleZ,0,
+ 0,0,0,1.0000000};
+ this->SetMatrix(aMatrix);
+}
+
+/*!Gets matrix scale.*/
+void VTKViewer_Transform::GetMatrixScale(double theScale[3]){
+ vtkMatrix4x4 *aTMatrix=this->GetMatrix();
+ const double aScaleX = aTMatrix->GetElement(0,0);
+ const double aScaleY = aTMatrix->GetElement(1,1);
+ const double aScaleZ = aTMatrix->GetElement(2,2);
+ theScale[0] = aScaleX;
+ theScale[1] = aScaleY;
+ theScale[2] = aScaleZ;
+}
+
+/*!Checks: Is matrix identity, where used EPS value.
+ *If |aScaleX-1|<EPS && |aScaleY-1|<EPS && |aScaleY-1|<EPS return 1, esle 0.
+ */
+int VTKViewer_Transform::IsIdentity(){
+ double aScale[3];
+ this->GetMatrixScale(aScale);
+ return (fabs(aScale[0] - 1.0) < EPS &&
+ fabs(aScale[1] - 1.0) < EPS &&
+ fabs(aScale[2] - 1.0) < EPS);
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 VTKVIEWER_TRANSFORM_H
+#define VTKVIEWER_TRANSFORM_H
+
+#include "VTKViewer.h"
+
+#include <vtkTransform.h>
+
+/*!\brief Describes linear transformations via a 4x4 matrix.
+ *@see vtkTransform class
+ */
+class VTKVIEWER_EXPORT VTKViewer_Transform : public vtkTransform
+{
+public:
+ /*!Create new instance of VTKViewer_Transform.*/
+ static VTKViewer_Transform *New();
+ vtkTypeMacro( VTKViewer_Transform, vtkTransform );
+
+ int IsIdentity();
+ //merge with V2_2_0_VISU_improvements:void SetScale( float theScaleX, float theScaleY, float theScaleZ );
+ void SetMatrixScale(double theScaleX, double theScaleY, double theScaleZ);
+ void GetMatrixScale(double theScale[3]);
+
+protected:
+ /*!Constructor.*/
+ VTKViewer_Transform() {/*!Do nothing*/}
+ /*!Copy contructor.*/
+ VTKViewer_Transform(const VTKViewer_Transform&) {/*!Do nothing*/}
+ /*!Destructor.*/
+ ~VTKViewer_Transform() {/*!Do nothing*/}
+
+ /*!Operator = */
+ void operator=( const VTKViewer_Transform& ) {/*!Do nothing*/}
+};
+
+#endif
--- /dev/null
+// SALOME FILTER : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 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
+//
+//
+//
+// File : SALOME_TransformFilter.h
+// Author : Laurent CORNABE with help of Nicolas REJNERI
+// Module : SALOME
+
+
+#include "VTKViewer_TransformFilter.h"
+#include "VTKViewer_Transform.h"
+
+#include <vtkObjectFactory.h>
+#include <vtkPointSet.h>
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+#include <vtkPoints.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+
+vtkStandardNewMacro(VTKViewer_TransformFilter);
+
+/*!Execution method. Calculate output.*/
+int VTKViewer_TransformFilter::RequestData(
+ vtkInformation *vtkNotUsed(request),
+ vtkInformationVector **inputVector,
+ vtkInformationVector *outputVector)
+{
+ // get the info objects
+ vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
+ vtkInformation *outInfo = outputVector->GetInformationObject(0);
+
+ // get the input and ouptut
+ vtkPointSet *input = vtkPointSet::SafeDownCast(
+ inInfo->Get(vtkDataObject::DATA_OBJECT()));
+ vtkPointSet *output = vtkPointSet::SafeDownCast(
+ outInfo->Get(vtkDataObject::DATA_OBJECT()));
+
+ vtkPoints *inPts;
+ vtkPoints *newPts;
+ int numPts, numCells;
+ vtkPointData *pd=input->GetPointData(), *outPD=output->GetPointData();
+ vtkCellData *cd=input->GetCellData(), *outCD=output->GetCellData();
+ output->CopyStructure( input );
+ if(Transform){
+ bool anIsIdentity = true;
+ if(VTKViewer_Transform* aTransform = dynamic_cast<VTKViewer_Transform*>(Transform))
+ anIsIdentity = aTransform->IsIdentity() != 0;
+ inPts = input->GetPoints();
+ if(!anIsIdentity && inPts){
+ numPts = inPts->GetNumberOfPoints();
+ numCells = input->GetNumberOfCells();
+ newPts = vtkPoints::New();
+ newPts->Allocate(numPts);
+ this->UpdateProgress(.2);
+ this->Transform->TransformPoints(inPts,newPts);
+ this->UpdateProgress(.8);
+ output->SetPoints(newPts);
+ newPts->Delete();
+ }
+ }
+ outPD->PassData(pd);
+ outCD->PassData(cd);
+
+ return 1;
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 VTKVIEWER_TRANSFORMFILTER_H
+#define VTKVIEWER_TRANSFORMFILTER_H
+
+#include "VTKViewer.h"
+
+#include <vtkTransformFilter.h>
+
+/*!Transform points and associated normals and vectors
+ *@see vtkTransformFilter
+ */
+class VTKVIEWER_EXPORT VTKViewer_TransformFilter : public vtkTransformFilter
+{
+public:
+ /*!Create new instance of VTKViewer_TransformFilter.*/
+ static VTKViewer_TransformFilter *New();
+ vtkTypeMacro(VTKViewer_TransformFilter,vtkTransformFilter);
+
+protected:
+ /*!Constructor.*/
+ VTKViewer_TransformFilter() {/*!Do nothing*/}
+ /*!Destructor.*/
+ ~VTKViewer_TransformFilter() {/*!Do nothing*/}
+ /*!Copy constructor.*/
+ VTKViewer_TransformFilter(const VTKViewer_TransformFilter&) {/*!Do nothing*/}
+ /*!Operator = */
+ void operator=(const VTKViewer_TransformFilter&) {/*!Do nothing*/}
+
+ int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 "VTKViewer_Trihedron.h"
+#include "VTKViewer_Actor.h"
+
+// VTK Includes
+#include <vtkMath.h>
+#include <vtkMapper.h>
+#include <vtkDataSet.h>
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
+#include <vtkObjectFactory.h>
+
+#include <vtkActor.h>
+#include <vtkProperty.h>
+#include <vtkLineSource.h>
+#include <vtkConeSource.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkVectorText.h>
+
+vtkStandardNewMacro(VTKViewer_UnScaledActor);
+
+/*!Constructor*/
+VTKViewer_UnScaledActor::VTKViewer_UnScaledActor()
+{
+ Bounds[0] = Bounds[2] = Bounds[4] = VTK_LARGE_FLOAT;
+ Bounds[1] = Bounds[3] = Bounds[5] = -VTK_LARGE_FLOAT;
+}
+
+/*!
+ \return bounding box
+*/
+vtkFloatingPointType*
+VTKViewer_UnScaledActor
+::GetBounds()
+{
+ return Bounds;
+}
+
+/*! Sets \a mySize= \a theSize variable.
+ * \param theSize - integer size
+ */
+void VTKViewer_UnScaledActor::SetSize(int theSize)
+{
+ mySize = theSize;
+}
+
+/*!This causes the actor to be rendered.
+ * Set new scale for actor.
+ */
+void VTKViewer_UnScaledActor::Render(vtkRenderer *theRenderer)
+{
+ if(theRenderer){
+ vtkFloatingPointType P[2][3] = {{-1.0, -1.0, 0.0},{+1.0, +1.0, 0.0}};
+ theRenderer->ViewToWorld(P[0][0],P[0][1],P[0][2]);
+ theRenderer->ViewToWorld(P[1][0],P[1][1],P[1][2]);
+ vtkFloatingPointType aWorldDiag = sqrt((P[1][0]-P[0][0])*(P[1][0]-P[0][0])+
+ (P[1][1]-P[0][1])*(P[1][1]-P[0][1])+
+ (P[1][2]-P[0][2])*(P[1][2]-P[0][2]));
+ int* aSize = theRenderer->GetRenderWindow()->GetSize();
+ vtkFloatingPointType aWinDiag = sqrt(vtkFloatingPointType(aSize[0]*aSize[0]+aSize[1]*aSize[1]));
+ vtkDataSet* aDataSet = GetMapper()->GetInput();
+ aDataSet->Update();
+ vtkFloatingPointType aLength = aDataSet->GetLength();
+ vtkFloatingPointType aPrecision = 1.0E-3;
+ vtkFloatingPointType anOldScale = GetScale()[0];
+ vtkFloatingPointType aScale = mySize*aWorldDiag/aWinDiag/aLength*sqrt(vtkFloatingPointType(aSize[0])/vtkFloatingPointType(aSize[1]));
+ if(fabs(aScale - anOldScale)/aScale > aPrecision){
+ SetScale(aScale);
+ }
+ }
+ vtkFollower::Render(theRenderer);
+}
+
+vtkStandardNewMacro(VTKViewer_LineActor);
+
+vtkCxxSetObjectMacro(VTKViewer_LineActor,LabelActor,VTKViewer_UnScaledActor);
+vtkCxxSetObjectMacro(VTKViewer_LineActor,ArrowActor,VTKViewer_UnScaledActor);
+
+/*!Adds Label and Arrow actors to \a theRenderer.*/
+void VTKViewer_LineActor::Render(vtkRenderer *theRenderer)
+{
+ if(LabelActor && LabelActor->GetVisibility()){
+ LabelActor->Modified();
+ LabelActor->Render(theRenderer);
+ }
+ if(ArrowActor && ArrowActor->GetVisibility()){
+ ArrowActor->Modified();
+ ArrowActor->Render(theRenderer);
+ }
+ vtkFollower::Render(theRenderer);
+}
+
+/*!
+ Constructor
+*/
+VTKViewer_Axis::VTKViewer_Axis()
+{
+ /*! \li Initialize the Line pipe-line representation*/
+ myLineSource = vtkLineSource::New();
+ myLineSource->SetPoint1(0.0,0.0,0.0);
+
+ myMapper[0] = vtkPolyDataMapper::New();
+ myMapper[0]->SetInput(myLineSource->GetOutput());
+
+ myLineActor = VTKViewer_LineActor::New();
+ myLineActor->SetMapper(myMapper[0]);
+ myLineActor->PickableOff();
+
+ /*! \li Initialize the Arrow pipe-line representation*/
+ myConeSource = vtkConeSource::New();
+ myConeSource->SetResolution(2);
+ myConeSource->SetAngle(10);
+
+ myMapper[1] = vtkPolyDataMapper::New();
+ myMapper[1]->SetInput(myConeSource->GetOutput());
+
+ myArrowActor = VTKViewer_UnScaledActor::New();
+ myArrowActor->SetMapper(myMapper[1]);
+ static int aArrowActorSize = 24;
+ myArrowActor->SetSize(aArrowActorSize);
+ myArrowActor->PickableOff();
+
+ myLineActor->SetArrowActor(myArrowActor);
+
+ /*! \li Initialize the Label pipe-line representation */
+ myVectorText = vtkVectorText::New();
+
+ myMapper[2] = vtkPolyDataMapper::New();
+ myMapper[2]->SetInput(myVectorText->GetOutput());
+
+ myLabelActor = VTKViewer_UnScaledActor::New();
+ myLabelActor->SetMapper(myMapper[2]);
+ static int aLabelActorSize = 12;
+ myLabelActor->SetSize(aLabelActorSize);
+ myLabelActor->PickableOff();
+ //myLabelActor->DebugOn();
+
+ myLineActor->SetLabelActor(myLabelActor);
+
+ /*! \li Initialise visibility param.*/
+ myVisibility = VTKViewer_Trihedron::eOn;
+}
+
+/*!
+ Destructor
+*/
+VTKViewer_Axis::~VTKViewer_Axis()
+{
+ /*! \li Destroy of the Label pipe-line representation */
+ myLabelActor->Delete();
+
+ myMapper[0]->RemoveAllInputs();
+ myMapper[0]->Delete();
+
+ myVectorText->Delete();
+
+ /*! \li Destroy of the Arrow pipe-line representation */
+ myArrowActor->Delete();
+
+ myMapper[1]->RemoveAllInputs();
+ myMapper[1]->Delete();
+
+ myConeSource->Delete();
+
+ /*! \li Destroy of the Line pipe-line representation */
+ myLineActor->Delete();
+
+ myMapper[2]->RemoveAllInputs();
+ myMapper[2]->Delete();
+
+ myLineSource->Delete();
+}
+
+/*! Add to renderer
+ * \param theRenderer - vtkRenderer pointer
+ */
+void VTKViewer_Axis::AddToRender(vtkRenderer* theRenderer){
+ /*! \li Order of the calls are important*/
+ theRenderer->AddActor(myLineActor);
+ theRenderer->AddActor(myLabelActor);
+ theRenderer->AddActor(myArrowActor);
+}
+
+/*! Remove actor of acis from \a theRenderer which are in myPresent.
+ * \param theRenderer - vtkRenderer pointer
+ */
+void VTKViewer_Axis::RemoveFromRender(vtkRenderer* theRenderer){
+ /*! \li Order of the calls are important*/
+ theRenderer->RemoveActor(myLineActor);
+ theRenderer->RemoveActor(myLabelActor);
+ theRenderer->RemoveActor(myArrowActor);
+}
+
+/*! Sets visibility for all Axis to \a theVis*/
+void VTKViewer_Axis::SetVisibility(VTKViewer_Trihedron::TVisibility theVis)
+{
+ switch(theVis){
+ case VTKViewer_Trihedron::eOff:
+ case VTKViewer_Trihedron::eOn:
+ myLabelActor->SetVisibility(theVis);
+ myArrowActor->SetVisibility(theVis);
+ myLineActor->SetVisibility(theVis);
+ break;
+ case VTKViewer_Trihedron::eOnlyLineOn:
+ myLabelActor->VisibilityOff();
+ myArrowActor->VisibilityOff();
+ myLineActor->VisibilityOn();
+ break;
+ default:
+ return;
+ }
+ myVisibility = theVis;
+}
+
+/*! Set camera for myLabelActor
+ */
+void VTKViewer_Axis::SetCamera(vtkCamera* theCamera){
+ myLabelActor->SetCamera(theCamera);
+}
+
+/*! Sets \a theProperty for actors: myLineActor,myLabelActor,myArrowActor
+ */
+void VTKViewer_Axis::SetProperty(vtkProperty* theProperty){
+ myLabelActor->SetProperty(theProperty);
+ myArrowActor->SetProperty(theProperty);
+ myLineActor->SetProperty(theProperty);
+}
+
+/*! Set size of VTKViewer_Axis
+ */
+void VTKViewer_Axis::SetSize(vtkFloatingPointType theSize)
+{
+ vtkFloatingPointType aPosition[3] = {myDir[0]*theSize, myDir[1]*theSize, myDir[2]*theSize};
+ myLineSource->SetPoint2(aPosition);
+
+ myArrowActor->SetPosition(0.0,0.0,0.0);
+ myArrowActor->AddPosition(aPosition);
+ myArrowActor->SetOrientation(myRot);
+
+ myLabelActor->SetPosition(0.0,0.0,0.0);
+ myLabelActor->AddPosition(aPosition);
+}
+
+/*! Check if actor belongs to the axis object
+ * \param theActor - vtkActor pointer
+ * \retval Return true if the actor belongs to the axis object
+ */
+bool VTKViewer_Axis::OwnActor(const vtkActor* theActor)
+{
+ return theActor == myLineActor ||
+ theActor == myArrowActor ||
+ theActor == myLabelActor;
+}
+
+/*! \class VTKViewer_XAxis
+ * \brief X Axis actor
+ */
+class VTKViewer_XAxis : public VTKViewer_Axis
+{
+protected:
+ VTKViewer_XAxis();
+ VTKViewer_XAxis(const VTKViewer_XAxis&);
+public:
+ vtkTypeMacro(VTKViewer_XAxis,VTKViewer_Axis);
+ static VTKViewer_XAxis *New();
+};
+
+vtkStandardNewMacro(VTKViewer_XAxis);
+
+/*!Initialize X Axis*/
+VTKViewer_XAxis::VTKViewer_XAxis(){
+ myDir[0] = 1.0; myDir[1] = 0.0; myDir[2] = 0.0;
+ myRot[0] = 0.0; myRot[1] = 0.0; myRot[2] = 0.0;
+ myVectorText->SetText("X");
+ vtkProperty* aProperty = vtkProperty::New();
+ aProperty->SetColor(1.0,0.0,0.0);
+ SetProperty(aProperty);
+ aProperty->Delete();
+}
+
+/*! \class VTKViewer_YAxis
+ * \brief Y Axis actor
+ */
+class VTKViewer_YAxis : public VTKViewer_Axis{
+protected:
+ VTKViewer_YAxis();
+ VTKViewer_YAxis(const VTKViewer_YAxis&);
+public:
+ vtkTypeMacro(VTKViewer_YAxis,VTKViewer_Axis);
+ static VTKViewer_YAxis *New();
+};
+
+vtkStandardNewMacro(VTKViewer_YAxis);
+
+/*!Initialize Y Axis*/
+VTKViewer_YAxis::VTKViewer_YAxis()
+{
+ myDir[0] = 0.0; myDir[1] = 1.0; myDir[2] = 0.0;
+ myRot[0] = 0.0; myRot[1] = 0.0; myRot[2] = 90.;
+ myVectorText->SetText("Y");
+ vtkProperty* aProperty = vtkProperty::New();
+ aProperty->SetColor(0.0,1.0,0.0);
+ SetProperty(aProperty);
+ aProperty->Delete();
+}
+
+/*! \class VTKViewer_ZAxis
+ * \brief Z Axis actor
+ */
+class VTKViewer_ZAxis : public VTKViewer_Axis
+{
+protected:
+ VTKViewer_ZAxis();
+ VTKViewer_ZAxis(const VTKViewer_ZAxis&);
+public:
+ vtkTypeMacro(VTKViewer_ZAxis,VTKViewer_Axis);
+ static VTKViewer_ZAxis *New();
+};
+
+vtkStandardNewMacro(VTKViewer_ZAxis);
+
+/*!Initialize Z Axis*/
+VTKViewer_ZAxis::VTKViewer_ZAxis()
+{
+ myDir[0] = 0.0; myDir[1] = 0.0; myDir[2] = 1.0;
+ myRot[0] = 0.0; myRot[1] = -90; myRot[2] = 0.0;
+ myVectorText->SetText("Z");
+ vtkProperty* aProperty = vtkProperty::New();
+ aProperty->SetColor(0.0,0.0,1.0);
+ SetProperty(aProperty);
+ aProperty->Delete();
+}
+
+vtkStandardNewMacro(VTKViewer_Trihedron);
+
+/*!
+ Constructor
+*/
+VTKViewer_Trihedron::VTKViewer_Trihedron()
+{
+ myPresent = vtkActorCollection::New();
+ myAxis[0] = VTKViewer_XAxis::New();
+ myAxis[1] = VTKViewer_YAxis::New();
+ myAxis[2] = VTKViewer_ZAxis::New();
+ static vtkFloatingPointType aSize = 100;
+ SetSize(aSize);
+}
+
+/*!
+ Destructor
+*/
+VTKViewer_Trihedron::~VTKViewer_Trihedron()
+{
+ myPresent->RemoveAllItems();
+ myPresent->Delete();
+ for(int i = 0; i < 3; i++)
+ myAxis[i]->Delete();
+}
+
+/*! Set size of axes
+ */
+void VTKViewer_Trihedron::SetSize(vtkFloatingPointType theSize)
+{
+ mySize = theSize;
+ for(int i = 0; i < 3; i++)
+ myAxis[i]->SetSize(theSize);
+}
+
+/*! Set visibility of axes
+ */
+void VTKViewer_Trihedron::SetVisibility(TVisibility theVis)
+{
+ for(int i = 0; i < 3; i++)
+ myAxis[i]->SetVisibility(theVis);
+}
+
+/*!
+ \return visibility of first axis
+*/
+VTKViewer_Trihedron::TVisibility VTKViewer_Trihedron::GetVisibility()
+{
+ return myAxis[0]->GetVisibility();
+}
+
+/*! Add to render all Axis
+ * \param theRenderer - vtkRenderer pointer
+ */
+void VTKViewer_Trihedron::AddToRender(vtkRenderer* theRenderer)
+{
+ vtkCamera* aCamera = theRenderer->GetActiveCamera();
+ for(int i = 0; i < 3; i++){
+ myAxis[i]->AddToRender(theRenderer);
+ myAxis[i]->SetCamera(aCamera);
+ }
+}
+
+/*! Remove all actors from \a theRenderer which are in myPresent.
+ * \param theRenderer - vtkRenderer pointer
+ */
+void VTKViewer_Trihedron::RemoveFromRender(vtkRenderer* theRenderer)
+{
+ myPresent->InitTraversal();
+ while(vtkActor* anActor = myPresent->GetNextActor())
+ theRenderer->RemoveActor(anActor);
+ for(int i = 0; i < 3; i++)
+ myAxis[i]->RemoveFromRender(theRenderer);
+}
+
+/*! Return count of visible actors.
+ * \param theRenderer - vtkRenderer pointer
+ */
+int VTKViewer_Trihedron::GetVisibleActorCount(vtkRenderer* theRenderer)
+{
+ //TVisibility aVis = GetVisibility();
+ //SetVisibility(eOff);
+ vtkActorCollection* aCollection = theRenderer->GetActors();
+ aCollection->InitTraversal();
+ int aCount = 0;
+ while(vtkActor* prop = aCollection->GetNextActor()) {
+ if( prop->GetVisibility())
+ if(VTKViewer_Actor* anActor = VTKViewer_Actor::SafeDownCast(prop)) {
+ if(!anActor->IsInfinitive())
+ aCount++;
+ }
+ else if ( !OwnActor( anActor ) ) {
+ aCount++;
+ }
+ //int aCount = theRenderer->VisibleActorCount();
+ //SetVisibility(aVis);
+ }
+ return aCount;
+}
+
+/*! Check if actor belongs to the axis object
+ * \param theActor - vtkActor pointer
+ * \retval Return true if the actor belongs to the axis object
+ */
+bool VTKViewer_Trihedron::OwnActor(const vtkActor* theActor)
+{
+ myPresent->InitTraversal();
+ while(vtkActor* anActor = myPresent->GetNextActor()) {
+ if ( anActor == theActor ) return true;
+ }
+ for(int i = 0; i < 3; i++) {
+ if ( myAxis[i]->OwnActor(theActor) ) return true;
+ }
+ return false;
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 VTKVIEWER_TRIHEDRON_H
+#define VTKVIEWER_TRIHEDRON_H
+
+#include "VTKViewer.h"
+
+#include <vtkObject.h>
+#include <vtkFollower.h>
+
+class vtkRenderer;
+class vtkActorCollection;
+class vtkCamera;
+class vtkProperty;
+class vtkPolyDataMapper;
+class vtkLineSource;
+class vtkConeSource;
+class vtkVectorText;
+
+class VTKViewer_Axis;
+
+/*! \class vtkFollower
+ * See <a href="http://www.vtk.org/">vtk documentation</a>
+ */
+/*!a subclass of actor that always faces the camera
+ *@see vtkFollower
+ */
+class VTKVIEWER_EXPORT VTKViewer_UnScaledActor: public vtkFollower
+{
+ VTKViewer_UnScaledActor(const VTKViewer_UnScaledActor&);
+
+public:
+
+ vtkTypeMacro(VTKViewer_UnScaledActor,vtkFollower);
+
+ /*!Create new instance of VTKViewer_UnScaledActor.*/
+ static VTKViewer_UnScaledActor *New();
+
+ virtual vtkFloatingPointType* GetBounds();
+ virtual void SetSize(int theSize);
+ virtual void Render(vtkRenderer *theRenderer);
+
+protected:
+ VTKViewer_UnScaledActor();
+ /*!Destructor. Do nothing.*/
+ ~VTKViewer_UnScaledActor(){}
+
+ int mySize;
+};
+
+/*!a subclass of actor that always faces the camera
+ *@see vtkFollower
+ */
+class VTKVIEWER_EXPORT VTKViewer_LineActor: public vtkFollower
+{
+ VTKViewer_LineActor(const VTKViewer_LineActor&);
+
+public:
+ /*!vtk type macros.*/
+ vtkTypeMacro(VTKViewer_LineActor,vtkFollower);
+
+ /*!Create new instance of VTKViewer_LineActor.*/
+ static VTKViewer_LineActor *New();
+
+ /*! Sets Lable actor.
+ * \param theLabelActor - VTKViewer_UnScaledActor
+ */
+ void SetLabelActor(VTKViewer_UnScaledActor* theLabelActor);
+
+ /*! Sets Arrow actor.
+ * \param theLabelActor - VTKViewer_UnScaledActor
+ */
+ void SetArrowActor(VTKViewer_UnScaledActor* theLabelActor);
+
+ virtual void Render(vtkRenderer *theRenderer);
+
+protected:
+
+ /*! Constructor which sets \a LabelActor and \a ArrowActor to NULL*/
+ VTKViewer_LineActor(){
+ LabelActor = NULL;
+ ArrowActor = NULL;
+ }
+
+ /*!Destructor which call SetLabelActor(NULL) and SetArrowActor(NULL)*/
+ ~VTKViewer_LineActor(){
+ SetLabelActor(NULL);
+ SetArrowActor(NULL);
+ }
+
+ /*!Label actor pointer*/
+ VTKViewer_UnScaledActor* LabelActor;
+
+ /*!Arrow actor pointer*/
+ VTKViewer_UnScaledActor* ArrowActor;
+};
+
+/*!This class provide support trihedron object in vtk viewer.*/
+class VTKVIEWER_EXPORT VTKViewer_Trihedron : public vtkObject
+{
+protected:
+ /*!Initialize fields by default values.*/
+ VTKViewer_Trihedron();
+
+ /*!Const copy constructor.*/
+ VTKViewer_Trihedron(const VTKViewer_Trihedron&);
+
+ /*!Destructor. Remove all fileds.*/
+ virtual ~VTKViewer_Trihedron();
+
+public:
+ /*!vtk type macros.*/
+ vtkTypeMacro(VTKViewer_Trihedron,vtkObject);
+
+ /*!Create new instance of VTKViewer_Trihedron.*/
+ static VTKViewer_Trihedron *New();
+
+ /*!Sets size of trihedron.
+ * \param theSize - vtkFloatingPointType value
+ */
+ virtual void SetSize(vtkFloatingPointType theSize);
+
+ /*! Get size of trihedron.
+ * \retval mySize - vtkFloatingPointType value
+ */
+ virtual vtkFloatingPointType GetSize() { return mySize;}
+
+ enum TVisibility{eOff, eOn, eOnlyLineOn};
+
+ /*! Sets visibility for all Axis to \a theVis*/
+ virtual void SetVisibility(TVisibility theVis);
+
+ /*! OFF visibility for all Axis.*/
+ virtual void VisibilityOff() { SetVisibility(eOff);}
+
+ /*! ON visibility for all Axis.*/
+ virtual void VisibilityOn() { SetVisibility(eOn);}
+
+ /*! Gets visibility of myAxis[0] actor.*/
+ virtual TVisibility GetVisibility();
+
+ /*! Add to render all Axis
+ * \param theRenderer - vtkRenderer pointer
+ */
+ virtual void AddToRender(vtkRenderer* theRenderer);
+
+ /*! Remove all actors from \a theRenderer which are in myPresent.
+ * \param theRenderer - vtkRenderer pointer
+ */
+ virtual void RemoveFromRender(vtkRenderer* theRenderer);
+
+ /*! Return count of visible actors.
+ * \param theRenderer - vtkRenderer pointer
+ */
+ virtual int GetVisibleActorCount(vtkRenderer* theRenderer);
+
+ /*! Check if actor belongs to the trihedron object
+ * \param theActor - vtkActor pointer
+ * \retval Return true if the actor belongs to the trihedron object
+ */
+ virtual bool OwnActor(const vtkActor* theActor);
+
+protected:
+ /*! Actor collection*/
+ vtkActorCollection* myPresent;
+
+ /*! \li myAxis[0] - X Axis actor
+ * \li myAxis[1] - Y Axis actor
+ * \li myAxis[2] - Z Axis actor
+ */
+ VTKViewer_Axis* myAxis[3];
+
+ /*! Common size for trihedron, for each axis.*/
+ vtkFloatingPointType mySize;
+};
+
+/*!The base class for concreate Axis.
+ * Its only duty is to give correct initialization and destruction
+ * of its pipe-lines
+ */
+class VTKVIEWER_EXPORT VTKViewer_Axis : public vtkObject
+{
+protected:
+ VTKViewer_Axis();
+ VTKViewer_Axis(const VTKViewer_Axis&);
+ virtual ~VTKViewer_Axis();
+
+public:
+ /*!vtk type macros.*/
+ vtkTypeMacro(VTKViewer_Axis,vtkObject);
+
+ /*! Add to \a theRenderer actors: myLineActor,myLabelActor,myArrowActor
+ */
+ virtual void AddToRender(vtkRenderer* theRenderer);
+ virtual void RemoveFromRender(vtkRenderer* theRenderer);
+
+ /*! Sets visibility for actors: myLineActor,myLabelActor,myArrowActor
+ */
+ virtual void SetVisibility(VTKViewer_Trihedron::TVisibility theVis);
+
+ /*! Return visibility of VTKViewer_Axis
+ * \retval myVisibility
+ */
+ virtual VTKViewer_Trihedron::TVisibility GetVisibility() { return myVisibility; }
+
+ /*! Set camera for myLabelActor
+ */
+ virtual void SetCamera(vtkCamera* theCamera);
+
+ /*! Sets \a theProperty for actors: myLineActor,myLabelActor,myArrowActor
+ */
+ virtual void SetProperty(vtkProperty* theProperty);
+
+ /*! Set size of VTKViewer_Axis
+ */
+ virtual void SetSize(vtkFloatingPointType theSize);
+
+ /*! Get label actor.
+ * \retval Return myLabelActor.
+ */
+ virtual VTKViewer_UnScaledActor* GetLabel() { return myLabelActor; }
+
+ /*! Get arrow actor.
+ * \retval Return myArrowActor
+ */
+ virtual VTKViewer_UnScaledActor* GetArrow() { return myArrowActor; }
+
+ /*! Check if actor belongs to the axis object
+ * \param theActor - vtkActor pointer
+ * \retval Return true if the actor belongs to the axis object
+ */
+ virtual bool OwnActor(const vtkActor* theActor);
+
+protected:
+ /*! Visibility flag.
+ */
+ VTKViewer_Trihedron::TVisibility myVisibility;
+
+ /*! \var myDir[3]
+ * Direction vector
+ */
+ /*! \var myRot[3]
+ * Orientation vector
+ */
+ vtkFloatingPointType myDir[3], myRot[3];
+
+ /*! VTKViewer_LineActor actor pointer
+ */
+ VTKViewer_LineActor *myLineActor;
+
+ /*! VTKViewer_UnScaledActor actor pointer
+ */
+ VTKViewer_UnScaledActor *myArrowActor;
+
+ /*! VTKViewer_UnScaledActor actor pointer
+ */
+ VTKViewer_UnScaledActor *myLabelActor;
+
+ /*! \li myMapper[0] - for the Line pipe-line representation
+ * \li myMapper[1] - for the Arrow pipe-line representation
+ * \li myMapper[2] - for the Label pipe-line representation
+ */
+ vtkPolyDataMapper *myMapper[3];
+
+ /*! vtkLineSource pointer (Line)
+ */
+ vtkLineSource *myLineSource;
+
+ /*! vtkConeSource pointer (Arrow)
+ */
+ vtkConeSource *myConeSource;
+
+ /*! VTKViewer_VectorText pointer (Label)
+ */
+ vtkVectorText* myVectorText;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 "VTKViewer_Utilities.h"
+#include "VTKViewer_Actor.h"
+
+#include <algorithm>
+
+// VTK Includes
+#include <vtkMath.h>
+#include <vtkCamera.h>
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
+
+using namespace std;
+
+/*!@see vtkRenderer::ResetCamera(vtkFloatingPointType bounds[6]) method*/
+void
+ResetCamera(vtkRenderer* theRenderer,
+ int theUsingZeroFocalPoint)
+{
+ if(!theRenderer)
+ return;
+
+ vtkCamera* aCamera = theRenderer->GetActiveCamera();
+ if(!aCamera)
+ return;
+
+ vtkFloatingPointType aBounds[6];
+ int aCount = ComputeVisiblePropBounds(theRenderer,aBounds);
+
+ if(theUsingZeroFocalPoint || aCount){
+ static vtkFloatingPointType MIN_DISTANCE = 1.0 / VTK_LARGE_FLOAT;
+
+ vtkFloatingPointType aLength = aBounds[1]-aBounds[0];
+ aLength = max((aBounds[3]-aBounds[2]),aLength);
+ aLength = max((aBounds[5]-aBounds[4]),aLength);
+
+ if(aLength < MIN_DISTANCE)
+ return;
+
+ vtkFloatingPointType aWidth =
+ sqrt((aBounds[1]-aBounds[0])*(aBounds[1]-aBounds[0]) +
+ (aBounds[3]-aBounds[2])*(aBounds[3]-aBounds[2]) +
+ (aBounds[5]-aBounds[4])*(aBounds[5]-aBounds[4]));
+
+ if(aWidth < MIN_DISTANCE)
+ return;
+
+ vtkFloatingPointType aViewPlaneNormal[3];
+ aCamera->GetViewPlaneNormal(aViewPlaneNormal);
+
+ vtkFloatingPointType aCenter[3] = {0.0, 0.0, 0.0};
+ if(!theUsingZeroFocalPoint){
+ aCenter[0] = (aBounds[0] + aBounds[1])/2.0;
+ aCenter[1] = (aBounds[2] + aBounds[3])/2.0;
+ aCenter[2] = (aBounds[4] + aBounds[5])/2.0;
+ }
+ aCamera->SetFocalPoint(aCenter[0],aCenter[1],aCenter[2]);
+
+ vtkFloatingPointType aViewAngle = aCamera->GetViewAngle();
+ vtkFloatingPointType aDistance = 2.0*aWidth/tan(aViewAngle*vtkMath::Pi()/360.0);
+
+ // check view-up vector against view plane normal
+ vtkFloatingPointType aViewUp[3];
+ aCamera->GetViewUp(aViewUp);
+ if(fabs(vtkMath::Dot(aViewUp,aViewPlaneNormal)) > 0.999)
+ aCamera->SetViewUp(-aViewUp[2], aViewUp[0], aViewUp[1]);
+
+ // update the camera
+ aCamera->SetPosition(aCenter[0]+aDistance*aViewPlaneNormal[0],
+ aCenter[1]+aDistance*aViewPlaneNormal[1],
+ aCenter[2]+aDistance*aViewPlaneNormal[2]);
+
+ // find size of the window
+ int* aWinSize = theRenderer->GetSize();
+ if(aWinSize[0] < aWinSize[1])
+ aWidth *= vtkFloatingPointType(aWinSize[1])/vtkFloatingPointType(aWinSize[0]);
+
+ if(theUsingZeroFocalPoint)
+ aWidth *= sqrt(2.0);
+
+ aCamera->SetParallelScale(aWidth/2.0);
+ }
+
+ ResetCameraClippingRange(theRenderer);
+}
+
+/*! Compute the bounds of the visible props*/
+int
+ComputeVisiblePropBounds(vtkRenderer* theRenderer,
+ vtkFloatingPointType theBounds[6])
+{
+ int aCount = 0;
+
+ theBounds[0] = theBounds[2] = theBounds[4] = VTK_LARGE_FLOAT;
+ theBounds[1] = theBounds[3] = theBounds[5] = -VTK_LARGE_FLOAT;
+
+ // loop through all props
+ vtkActorCollection* aCollection = theRenderer->GetActors();
+ aCollection->InitTraversal();
+ while (vtkActor* aProp = aCollection->GetNextActor()) {
+ // if it's invisible, or has no geometry, we can skip the rest
+ if(aProp->GetVisibility() && aProp->GetMapper()){
+ if(VTKViewer_Actor* anActor = VTKViewer_Actor::SafeDownCast(aProp))
+ if(anActor->IsInfinitive())
+ continue;
+
+ vtkFloatingPointType *aBounds = aProp->GetBounds();
+ static vtkFloatingPointType MAX_DISTANCE = 0.9*VTK_LARGE_FLOAT;
+ // make sure we haven't got bogus bounds
+ if ( aBounds != NULL &&
+ aBounds[0] > -MAX_DISTANCE && aBounds[1] < MAX_DISTANCE &&
+ aBounds[2] > -MAX_DISTANCE && aBounds[3] < MAX_DISTANCE &&
+ aBounds[4] > -MAX_DISTANCE && aBounds[5] < MAX_DISTANCE )
+ {
+ aCount++;
+
+ theBounds[0] = min(aBounds[0],theBounds[0]);
+ theBounds[2] = min(aBounds[2],theBounds[2]);
+ theBounds[4] = min(aBounds[4],theBounds[4]);
+
+ theBounds[1] = max(aBounds[1],theBounds[1]);
+ theBounds[3] = max(aBounds[3],theBounds[3]);
+ theBounds[5] = max(aBounds[5],theBounds[5]);
+
+ }//not bogus
+ }
+ }
+ return aCount;
+}
+
+/*!@see vtkRenderer::ResetCameraClippingRange(vtkFloatingPointType bounds[6]) method*/
+void
+ResetCameraClippingRange(vtkRenderer* theRenderer)
+{
+ if(!theRenderer || !theRenderer->VisibleActorCount()) return;
+
+ vtkCamera* anActiveCamera = theRenderer->GetActiveCamera();
+ if( anActiveCamera == NULL ){
+ return;
+ }
+
+ // Find the plane equation for the camera view plane
+ vtkFloatingPointType vn[3];
+ anActiveCamera->GetViewPlaneNormal(vn);
+ vtkFloatingPointType position[3];
+ anActiveCamera->GetPosition(position);
+
+ vtkFloatingPointType bounds[6];
+ theRenderer->ComputeVisiblePropBounds(bounds);
+
+ vtkFloatingPointType center[3];
+ center[0] = (bounds[0] + bounds[1])/2.0;
+ center[1] = (bounds[2] + bounds[3])/2.0;
+ center[2] = (bounds[4] + bounds[5])/2.0;
+
+ vtkFloatingPointType width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) +
+ (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) +
+ (bounds[5]-bounds[4])*(bounds[5]-bounds[4]));
+
+ vtkFloatingPointType distance = sqrt((position[0]-center[0])*(position[0]-center[0]) +
+ (position[1]-center[1])*(position[1]-center[1]) +
+ (position[2]-center[2])*(position[2]-center[2]));
+
+ vtkFloatingPointType range[2] = {distance - width/2.0, distance + width/2.0};
+
+ // Do not let the range behind the camera throw off the calculation.
+ if (range[0] < 0.0) range[0] = 0.0;
+
+ anActiveCamera->SetClippingRange( range );
+}
+
+/*!Compute trihedron size.*/
+bool
+ComputeTrihedronSize( vtkRenderer* theRenderer,
+ vtkFloatingPointType& theNewSize,
+ const vtkFloatingPointType theSize,
+ const vtkFloatingPointType theSizeInPercents )
+{
+ // calculating diagonal of visible props of the renderer
+ vtkFloatingPointType bnd[ 6 ];
+ if ( ComputeVisiblePropBounds( theRenderer, bnd ) == 0 )
+ {
+ bnd[ 1 ] = bnd[ 3 ] = bnd[ 5 ] = 100;
+ bnd[ 0 ] = bnd[ 2 ] = bnd[ 4 ] = 0;
+ }
+ vtkFloatingPointType aLength = 0;
+
+ aLength = bnd[ 1 ]-bnd[ 0 ];
+ aLength = max( ( bnd[ 3 ] - bnd[ 2 ] ),aLength );
+ aLength = max( ( bnd[ 5 ] - bnd[ 4 ] ),aLength );
+
+ static vtkFloatingPointType EPS_SIZE = 5.0E-3;
+ theNewSize = aLength * theSizeInPercents / 100.0;
+
+ // if the new trihedron size have sufficient difference, then apply the value
+ return fabs( theNewSize - theSize) > theSize * EPS_SIZE ||
+ fabs( theNewSize-theSize ) > theNewSize * EPS_SIZE;
+}
+
+bool IsBBEmpty(vtkRenderer* theRenderer)
+{
+ if(!theRenderer)
+ return false;
+
+ vtkFloatingPointType aNewBndBox[6];
+ aNewBndBox[ 0 ] = aNewBndBox[ 2 ] = aNewBndBox[ 4 ] = VTK_LARGE_FLOAT;
+ aNewBndBox[ 1 ] = aNewBndBox[ 3 ] = aNewBndBox[ 5 ] = -VTK_LARGE_FLOAT;
+
+ // iterate through displayed objects and set size if necessary
+ vtkActorCollection* anActors = theRenderer->GetActors();
+ anActors->InitTraversal();
+ bool isAny = false;
+ while(vtkActor* anAct = anActors->GetNextActor())
+ //if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(anAct))
+ if(VTKViewer_Actor* anActor = VTKViewer_Actor::SafeDownCast(anAct))
+ if(anActor->GetVisibility() && !anActor->IsInfinitive())
+ {
+ vtkFloatingPointType *aBounds = anActor->GetBounds();
+ if(aBounds[0] > -VTK_LARGE_FLOAT && aBounds[1] < VTK_LARGE_FLOAT &&
+ aBounds[2] > -VTK_LARGE_FLOAT && aBounds[3] < VTK_LARGE_FLOAT &&
+ aBounds[4] > -VTK_LARGE_FLOAT && aBounds[5] < VTK_LARGE_FLOAT)
+ isAny = true;
+ }
+
+ return !isAny;
+}
+
+bool ComputeBBCenter(vtkRenderer* theRenderer, vtkFloatingPointType theCenter[3])
+{
+ theCenter[0] = theCenter[1] = theCenter[2] = 0.0;
+
+ if(!theRenderer)
+ return false;
+
+ vtkFloatingPointType aNewBndBox[6];
+ aNewBndBox[ 0 ] = aNewBndBox[ 2 ] = aNewBndBox[ 4 ] = VTK_LARGE_FLOAT;
+ aNewBndBox[ 1 ] = aNewBndBox[ 3 ] = aNewBndBox[ 5 ] = -VTK_LARGE_FLOAT;
+
+ // iterate through displayed objects and set size if necessary
+ vtkActorCollection* anActors = theRenderer->GetActors();
+ anActors->InitTraversal();
+ bool isAny = false;
+ while(vtkActor* anAct = anActors->GetNextActor())
+ {
+ //if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(anAct))
+ if(VTKViewer_Actor* anActor = VTKViewer_Actor::SafeDownCast(anAct))
+ {
+ if(anActor->GetVisibility() && !anActor->IsInfinitive())
+ {
+ vtkFloatingPointType *aBounds = anActor->GetBounds();
+ if(aBounds[0] > -VTK_LARGE_FLOAT && aBounds[1] < VTK_LARGE_FLOAT &&
+ aBounds[2] > -VTK_LARGE_FLOAT && aBounds[3] < VTK_LARGE_FLOAT &&
+ aBounds[4] > -VTK_LARGE_FLOAT && aBounds[5] < VTK_LARGE_FLOAT)
+ {
+ for(int i = 0; i < 5; i = i + 2){
+ if(aBounds[i] < aNewBndBox[i])
+ aNewBndBox[i] = aBounds[i];
+ if(aBounds[i+1] > aNewBndBox[i+1])
+ aNewBndBox[i+1] = aBounds[i+1];
+ }
+ isAny = true;
+ }
+ }
+ }
+ }
+
+ if ( !isAny )
+ {
+ // null bounding box => the center is (0,0,0)
+ return true;
+ }
+
+ if(aNewBndBox[0] > -VTK_LARGE_FLOAT && aNewBndBox[1] < VTK_LARGE_FLOAT &&
+ aNewBndBox[2] > -VTK_LARGE_FLOAT && aNewBndBox[3] < VTK_LARGE_FLOAT &&
+ aNewBndBox[4] > -VTK_LARGE_FLOAT && aNewBndBox[5] < VTK_LARGE_FLOAT)
+ {
+ static vtkFloatingPointType MIN_DISTANCE = 1.0 / VTK_LARGE_FLOAT;
+
+ vtkFloatingPointType aLength = aNewBndBox[1]-aNewBndBox[0];
+ aLength = max((aNewBndBox[3]-aNewBndBox[2]),aLength);
+ aLength = max((aNewBndBox[5]-aNewBndBox[4]),aLength);
+
+ if(aLength < MIN_DISTANCE)
+ return false;
+
+ vtkFloatingPointType aWidth =
+ sqrt((aNewBndBox[1]-aNewBndBox[0])*(aNewBndBox[1]-aNewBndBox[0]) +
+ (aNewBndBox[3]-aNewBndBox[2])*(aNewBndBox[3]-aNewBndBox[2]) +
+ (aNewBndBox[5]-aNewBndBox[4])*(aNewBndBox[5]-aNewBndBox[4]));
+
+ if(aWidth < MIN_DISTANCE)
+ return false;
+
+ theCenter[0] = (aNewBndBox[0] + aNewBndBox[1])/2.0;
+ theCenter[1] = (aNewBndBox[2] + aNewBndBox[3])/2.0;
+ theCenter[2] = (aNewBndBox[4] + aNewBndBox[5])/2.0;
+ return true;
+ }
+
+ return false;
+
+ /*
+ vtkFloatingPointType aBounds[6];
+ int aCount = ComputeVisiblePropBounds(theRenderer,aBounds);
+ printf("aNewBndBox[0] = %f, aNewBndBox[1] = %f,\naNewBndBox[2] = %f, aNewBndBox[3] = %f,\naNewBndBox[4] = %f, aNewBndBox[5] = %f\n",
+ aBounds[0],aBounds[1],aBounds[2],aBounds[3],aBounds[4],aBounds[5]);
+ printf("aCount = %d\n",aCount);
+
+ if(aCount){
+ static vtkFloatingPointType MIN_DISTANCE = 1.0 / VTK_LARGE_FLOAT;
+
+ vtkFloatingPointType aLength = aBounds[1]-aBounds[0];
+ aLength = max((aBounds[3]-aBounds[2]),aLength);
+ aLength = max((aBounds[5]-aBounds[4]),aLength);
+
+ if(aLength < MIN_DISTANCE)
+ return false;
+
+ vtkFloatingPointType aWidth =
+ sqrt((aBounds[1]-aBounds[0])*(aBounds[1]-aBounds[0]) +
+ (aBounds[3]-aBounds[2])*(aBounds[3]-aBounds[2]) +
+ (aBounds[5]-aBounds[4])*(aBounds[5]-aBounds[4]));
+
+ if(aWidth < MIN_DISTANCE)
+ return false;
+
+ theCenter[0] = (aBounds[0] + aBounds[1])/2.0;
+ theCenter[1] = (aBounds[2] + aBounds[3])/2.0;
+ theCenter[2] = (aBounds[4] + aBounds[5])/2.0;
+ return true;
+ }
+ return false;*/
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 VTKVIEWER_UTILITIES_H
+#define VTKVIEWER_UTILITIES_H
+
+#include "VTKViewer.h"
+
+class vtkRenderer;
+
+VTKVIEWER_EXPORT
+extern
+void
+ResetCamera(vtkRenderer* theRenderer,
+ int theUsingZeroFocalPoint = false);
+
+VTKVIEWER_EXPORT
+extern
+int
+ComputeVisiblePropBounds(vtkRenderer* theRenderer,
+ vtkFloatingPointType theBounds[6]);
+
+VTKVIEWER_EXPORT
+extern
+void
+ResetCameraClippingRange(vtkRenderer* theRenderer);
+VTKVIEWER_EXPORT
+extern
+bool
+ComputeTrihedronSize(vtkRenderer* theRenderer,
+ vtkFloatingPointType& theNewSize,
+ const vtkFloatingPointType theSize,
+ const vtkFloatingPointType theSizeInPercents);
+
+VTKVIEWER_EXPORT
+extern
+bool IsBBEmpty(vtkRenderer* theRenderer);
+VTKVIEWER_EXPORT
+extern
+bool ComputeBBCenter(vtkRenderer* theRenderer,
+ vtkFloatingPointType theCenter[3]);
+#endif
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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
+//
+/*=========================================================================
+
+ Program: Visualization Toolkit
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
+ All rights reserved.
+ See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notice for more information.*/
+
+// VTKViewer_VectorText.cxx is a copy of vtkVectorText.cxx file.
+// Purpose of copying: to remove linking to libHybrid.so VTK library
+
+#include "VTKViewer_VectorText.h"
+
+#include "vtkCellArray.h"
+#include "vtkObjectFactory.h"
+#include "vtkPoints.h"
+#include "vtkPolyData.h"
+using namespace std;
+
+vtkCxxRevisionMacro(VTKViewer_VectorText, "$Revision$");
+vtkStandardNewMacro(VTKViewer_VectorText);
+
+char *VTK_VECTOR_TEXT_33 = (char *) "11 0.438482 "
+"0.28000 -0.07186 0.43164 -0.07143 0.27689 0.07714 0.43472 0.07714 0.32000 0.20134 "
+"0.40000 0.20243 0.31429 0.20550 0.27277 0.76857 0.43848 0.76857 0.27693 1.02571 "
+"0.43429 1.02615 7 2 1 3 2 0 1 7 6 5 6 4 5 8 "
+"7 5 7 8 9 10 9 8 "
+;
+
+char *VTK_VECTOR_TEXT_34 = (char *) "21 0.615625 "
+"0.25714 0.63563 0.32571 0.63563 0.50286 0.63642 0.25143 0.63946 0.33143 0.63840 "
+"0.33462 0.64286 0.49673 0.64286 0.57714 0.63757 0.58093 0.64286 0.21335 0.84286 "
+"0.36680 0.84286 0.46177 0.84286 0.61522 0.84286 0.21295 1.02000 0.46134 1.02000 "
+"0.61563 1.02000 0.36571 1.02307 0.46550 1.02571 0.21714 1.02615 0.36000 1.02723 "
+"0.61143 1.02615 17 3 5 9 7 6 2 4 5 1 6 8 12 0 1 5 6 "
+"12 11 3 0 5 7 8 6 11 12 14 13 9 10 10 9 5 15 14 12 19 "
+"18 10 18 13 10 17 14 20 14 15 20 16 19 10 "
+;
+
+char *VTK_VECTOR_TEXT_35 = (char *) "43 0.974539 "
+"0.22286 -0.09100 0.32571 -0.09236 0.56832 -0.08857 0.67429 -0.09201 0.28193 0.22000 "
+"0.39470 0.22000 0.63009 0.22000 0.15385 0.23143 0.27429 0.22723 0.40571 0.22723 "
+"0.62286 0.22723 0.74857 0.22680 0.97454 0.23143 0.15385 0.33429 0.97454 0.33429 "
+"0.30344 0.34000 0.65201 0.34000 0.77084 0.34000 0.42286 0.34010 0.42034 0.34571 "
+"0.36041 0.60286 0.70748 0.60286 0.82034 0.60286 0.47429 0.60626 0.15385 0.61429 "
+"0.35429 0.61009 0.70286 0.60951 0.82857 0.61009 0.97454 0.61429 0.15385 0.71714 "
+"0.37714 0.72134 0.50286 0.72191 0.72571 0.72134 0.85143 0.72156 0.97143 0.72025 "
+"0.38605 0.72857 0.49823 0.72857 0.73335 0.72857 0.84613 0.72857 0.45143 1.04160 "
+"0.55735 1.04286 0.80000 1.04243 0.90521 1.04286 43 6 2 3 5 0 1 0 5 4 18 "
+"9 10 11 6 3 4 9 8 13 8 15 17 6 11 9 4 5 13 7 8 17 "
+"12 14 8 9 15 15 19 20 16 6 17 12 17 11 18 10 16 10 6 16 21 "
+"16 17 18 19 9 15 9 19 20 30 25 23 20 19 34 33 28 29 24 25 29 "
+"25 30 27 21 22 33 21 27 20 23 30 22 21 17 33 27 28 31 26 32 35 "
+"30 23 32 38 37 31 35 23 21 32 26 26 31 23 32 21 38 41 37 38 36 "
+"35 31 38 21 33 40 39 36 42 41 38 39 35 36 "
+;
+
+char *VTK_VECTOR_TEXT_36 = (char *) "73 0.921518 "
+"0.52571 -0.22882 0.59429 -0.22991 0.52000 -0.09942 0.60571 -0.09385 0.40571 -0.07057 "
+"0.72730 -0.06571 0.33143 -0.03465 0.80571 -0.01813 0.51429 0.01891 0.52152 0.02571 "
+"0.60571 0.02014 0.84571 0.02168 0.25669 0.04286 0.66857 0.03800 0.44571 0.04535 "
+"0.70984 0.06571 0.74535 0.10571 0.74857 0.11079 0.74902 0.11143 0.37057 0.12857 "
+"0.90538 0.12857 0.20823 0.15143 0.35748 0.16286 0.77395 0.16857 0.35429 0.17310 "
+"0.35177 0.18000 0.78134 0.21429 0.92152 0.21429 0.19580 0.22571 0.33480 0.25429 "
+"0.77395 0.29429 0.91177 0.32286 0.76000 0.32921 0.72571 0.36972 0.89355 0.37429 "
+"0.64690 0.40857 0.65143 0.40706 0.64000 0.41109 0.60571 0.41986 0.52109 0.43714 "
+"0.85714 0.43270 0.38857 0.49216 0.79429 0.48902 0.72571 0.52437 0.30454 0.54571 "
+"0.60260 0.56286 0.52043 0.58571 0.26286 0.59570 0.46857 0.59800 0.39429 0.65095 "
+"0.22857 0.67295 0.36823 0.70000 0.75429 0.77624 0.21907 0.78571 0.35891 0.78571 "
+"0.89184 0.79714 0.37714 0.85001 0.72571 0.86144 0.87470 0.86571 0.24571 0.89016 "
+"0.68571 0.90956 0.44000 0.92036 0.60571 0.94469 0.83179 0.94571 0.28000 0.94629 "
+"0.51429 0.94891 0.34286 1.00607 0.75429 1.01579 0.38286 1.02784 0.52043 1.06571 "
+"0.60260 1.06571 0.52260 1.12286 0.60043 1.12286 75 3 8 2 2 8 4 19 12 6 13 11 15 9 8 10 3 2 1 8 "
+"3 10 5 13 10 15 11 16 7 13 5 4 14 6 2 0 1 5 10 3 12 "
+"22 21 14 4 8 13 7 11 11 18 16 20 23 18 18 17 16 20 18 11 19 "
+"6 14 28 21 29 26 23 20 12 19 22 25 22 24 21 22 25 21 25 29 26 "
+"27 30 27 26 20 31 32 30 31 30 27 40 33 32 37 43 38 34 32 31 38 "
+"39 9 40 32 34 38 9 10 43 33 42 37 36 43 39 38 43 42 33 40 35 "
+"36 37 33 43 36 39 45 46 48 41 39 45 39 43 41 48 44 47 51 50 46 "
+"62 65 48 39 46 44 49 47 49 44 48 54 53 50 51 47 49 53 56 59 53 "
+"54 56 66 64 56 55 58 52 58 57 52 54 50 51 59 56 64 67 60 63 60 "
+"57 63 66 61 68 61 66 56 68 65 69 65 62 69 62 46 45 63 57 58 62 "
+"60 67 68 61 65 71 70 72 70 62 67 62 70 69 71 69 70 "
+;
+
+char *VTK_VECTOR_TEXT_37 = (char *) "81 1.409911 "
+"0.46713 -0.11143 0.57143 -0.11215 1.19429 -0.11252 1.10286 -0.10252 1.26444 -0.09429 "
+"1.05143 -0.07759 1.31429 -0.06384 1.14857 -0.01538 1.18857 -0.01807 0.98857 -0.01364 "
+"1.22286 -0.00771 1.36784 -0.00286 1.11302 0.00286 1.26436 0.03143 1.07787 0.04857 "
+"0.95748 0.05429 1.39681 0.06571 1.28680 0.09429 1.05866 0.14000 1.40991 0.14571 "
+"0.94134 0.15143 0.94134 0.21429 1.29295 0.21429 1.06134 0.23714 1.40723 0.23714 "
+"0.95748 0.30000 1.39387 0.30000 1.07787 0.30571 1.27429 0.30371 1.09561 0.33429 "
+"1.23429 0.35465 1.36616 0.36286 1.13143 0.36327 1.16571 0.37277 1.20571 0.36899 "
+"1.00045 0.38571 1.32000 0.41543 1.06857 0.44498 1.24571 0.45681 0.48000 0.46420 "
+"1.15429 0.46723 0.38857 0.47462 0.55016 0.48286 0.60000 0.51330 0.30286 0.52704 "
+"0.43429 0.56177 0.47429 0.55907 0.26857 0.57284 0.50857 0.56943 0.65355 0.57429 "
+"0.39873 0.58000 0.55007 0.60857 0.24530 0.62571 0.36359 0.62571 0.68252 0.64286 "
+"0.56680 0.64857 0.23050 0.69429 0.34437 0.71714 0.57866 0.72286 0.69563 0.72286 "
+"0.22705 0.79143 0.34705 0.81429 0.69295 0.81429 0.56891 0.85429 0.67959 0.87714 "
+"0.24530 0.88286 0.36359 0.88286 0.38132 0.91143 0.54286 0.90975 0.52000 0.93179 "
+"0.65465 0.93429 0.41714 0.94041 0.47429 0.94950 0.29143 0.96914 0.60571 0.99258 "
+"0.32000 0.99868 0.38286 1.03395 0.53714 1.03184 1.06857 1.04249 1.17287 1.04286 "
+"0.48000 1.04395 79 0 1 78 10 4 6 2 8 3 9 14 15 4 "
+"10 8 3 7 5 7 3 8 10 6 13 12 5 7 5 12 9 4 8 2 13 "
+"16 17 17 19 22 14 9 12 15 18 20 11 13 6 13 11 16 17 16 19 18 "
+"15 14 21 20 18 21 23 25 22 26 28 23 21 18 24 22 19 25 27 35 35 "
+"29 37 22 24 26 28 31 30 27 25 23 31 28 26 27 29 35 36 30 31 38 "
+"34 30 38 33 34 37 32 40 32 33 40 38 30 36 32 37 29 40 33 38 42 "
+"46 39 47 53 52 48 43 51 39 46 41 41 50 44 56 57 60 45 41 46 42 "
+"48 46 48 42 43 50 41 45 53 47 44 51 49 55 54 55 49 53 44 50 49 "
+"51 43 55 54 58 59 58 54 57 56 52 57 52 53 60 61 65 58 62 63 57 "
+"61 60 62 64 63 65 66 73 66 65 61 73 66 75 58 59 62 63 64 68 70 "
+"69 68 67 75 66 70 68 64 76 71 72 75 67 76 74 69 70 71 76 67 69 "
+"77 72 72 77 80 77 69 74 76 72 80 79 78 1 "
+;
+
+char *VTK_VECTOR_TEXT_38 = (char *) "76 1.126291 "
+"0.58857 -0.08966 1.03429 -0.09235 0.48000 -0.08395 0.66286 -0.07673 0.40000 -0.05914 "
+"0.72000 -0.05641 0.98286 -0.05473 0.35429 -0.03393 0.78857 -0.01678 1.12629 0.00857 "
+"0.29143 0.02168 0.52571 0.02991 0.57714 0.02764 0.62286 0.03756 0.46857 0.04645 "
+"0.87429 0.05495 0.69714 0.07393 0.42132 0.08286 1.04571 0.07868 0.24486 0.08857 "
+"0.75011 0.11714 0.22327 0.14000 0.37927 0.14571 0.78349 0.16286 0.96893 0.16286 "
+"0.96571 0.16717 0.96457 0.16857 0.95937 0.18000 0.35580 0.22571 0.20991 0.25429 "
+"0.36319 0.28857 0.86286 0.29600 1.02437 0.31143 0.22645 0.32857 0.40418 0.36286 "
+"0.40571 0.36454 0.41330 0.37429 1.05421 0.40857 0.28418 0.42571 0.92000 0.44119 "
+"0.53714 0.46770 0.37143 0.50250 0.66758 0.54000 0.46406 0.55714 0.78704 0.62571 "
+"0.59429 0.63146 0.37714 0.68444 0.69296 0.70000 0.85355 0.71714 0.35681 0.73429 "
+"0.50200 0.75143 0.49756 0.76286 0.49502 0.76857 0.72891 0.76857 0.86966 0.76857 "
+"0.34748 0.82000 0.73295 0.82000 0.48764 0.82571 0.87236 0.83143 0.49714 0.86089 "
+"0.35849 0.87143 0.71429 0.87650 0.52000 0.89555 0.69714 0.89846 0.37964 0.91714 "
+"0.84657 0.91714 0.55429 0.92073 0.65714 0.92498 0.60000 0.93277 0.81868 0.95714 "
+"0.42857 0.97582 0.76571 1.00436 0.51429 1.02723 0.72000 1.02723 0.59429 1.04437 "
+"0.64571 1.04395 78 7 17 10 3 13 0 "
+"2 14 4 6 18 15 17 7 4 9 18 "
+"6 9 6 1 8 16 5 0 12 2 "
+"17 4 14 2 11 14 12 0 13 13 5 "
+"16 15 24 20 16 8 20 13 3 5 "
+"2 12 11 10 17 19 21 28 29 15 20 "
+"8 20 24 23 40 23 31 24 25 26 "
+"19 22 21 31 23 27 22 19 17 18 24 "
+"15 28 21 22 29 30 33 31 32 39 "
+"23 24 26 30 29 28 23 26 27 33 30 "
+"38 32 31 27 38 36 41 38 34 36 "
+"34 38 30 36 34 35 39 32 37 42 40 "
+"31 40 41 36 42 44 47 45 43 40 "
+"40 43 41 50 46 43 50 49 46 45 40 "
+"42 48 53 47 45 42 47 49 52 55 "
+"53 48 56 50 43 45 57 60 55 52 50 "
+"51 49 50 52 48 47 44 54 56 48 "
+"56 65 61 60 59 64 59 60 57 65 56 "
+"58 52 57 55 64 59 70 58 56 54 "
+"59 62 70 68 74 72 65 69 61 70 66 "
+"72 63 71 67 63 61 69 70 62 66 "
+"67 73 68 71 63 69 73 67 71 68 72 "
+"66 74 68 75 75 68 73 "
+;
+
+char *VTK_VECTOR_TEXT_39 = (char *) "10 0.364197 "
+"0.25143 0.63563 0.24571 0.63946 0.32571 0.63757 0.32950 0.64286 0.21034 0.83714 "
+"0.36379 0.83714 0.20991 1.02000 0.36420 1.02000 0.21408 1.02571 0.36000 1.02615 8 1 0 3 "
+"2 3 0 1 3 4 7 6 4 5 4 "
+"3 7 4 5 8 6 9 6 7 9 "
+;
+
+char *VTK_VECTOR_TEXT_40 = (char *) "19 0.595731 "
+"0.50857 -0.39522 0.59429 -0.39447 0.44000 -0.30784 0.51787 -0.24857 0.32530 -0.09429 "
+"0.43748 -0.05429 0.26899 0.06571 0.38134 0.20286 0.23580 0.27714 0.37605 0.38000 "
+"0.23848 0.41429 0.39320 0.53429 0.27177 0.59714 0.43748 0.71143 0.47216 0.80286 "
+"0.36086 0.82000 0.45714 0.97936 0.59573 1.04286 0.50857 1.04395 17 2 3 4 0 3 2 3 "
+"0 1 6 4 5 3 5 4 6 7 8 7 6 5 9 10 8 9 8 7 10 "
+"11 12 10 9 11 12 13 15 12 11 13 14 15 13 16 15 14 17 18 16 17 "
+"16 14 "
+;
+
+char *VTK_VECTOR_TEXT_41 = (char *) "19 0.598482 "
+"0.24000 -0.39447 0.33143 -0.39258 0.40616 -0.28857 0.31641 -0.24857 0.48784 -0.14000 "
+"0.39681 -0.05429 0.55538 0.03143 0.45295 0.20286 0.59580 0.23714 0.59848 0.37429 "
+"0.45823 0.38000 0.44723 0.49429 0.56252 0.59714 0.41714 0.64134 0.47343 0.82000 "
+"0.34857 0.83301 0.37714 0.97936 0.23855 1.04286 0.32571 1.04395 17 0 1 3 2 3 1 3 "
+"4 5 3 2 4 5 6 7 6 5 4 7 8 10 8 9 10 11 10 9 8 "
+"7 6 11 12 13 13 14 15 12 11 9 14 13 12 15 16 17 16 15 14 16 "
+"18 17 "
+;
+
+char *VTK_VECTOR_TEXT_42 = (char *) "34 0.685300 "
+"0.33143 0.58250 0.33714 0.58223 0.53714 0.58250 0.54286 0.58194 0.36213 0.61429 "
+"0.25587 0.63714 0.25266 0.64286 0.62655 0.64286 0.25393 0.64857 0.43429 0.73293 "
+"0.44000 0.73049 0.36715 0.78000 0.50714 0.78000 0.35429 0.78613 0.63429 0.80816 "
+"0.19309 0.82571 0.68389 0.82571 0.19177 0.83143 0.68530 0.83143 0.38857 0.86213 "
+"0.39523 0.86571 0.48000 0.86242 0.47660 0.86571 0.34657 0.88286 0.58857 0.90823 "
+"0.22286 0.92522 0.22857 0.92848 0.64571 0.92816 0.65143 0.92675 0.49295 1.02000 "
+"0.38134 1.03714 0.38550 1.04286 0.49143 1.04021 0.48571 1.04437 32 2 12 10 8 4 11 "
+"8 5 4 8 6 5 4 0 1 2 3 "
+"12 0 4 5 12 9 10 9 11 4 "
+"19 11 21 14 24 12 26 25 17 16 18 "
+"14 13 23 15 19 21 20 11 19 13 "
+"33 31 30 24 21 12 12 21 9 21 11 "
+"9 26 17 23 12 3 7 27 24 18 "
+"13 19 23 23 17 15 20 21 22 18 24 "
+"14 28 27 18 33 30 20 29 20 22 "
+"29 33 20 32 33 29 "
+;
+
+char *VTK_VECTOR_TEXT_43 = (char *) "20 0.952768 "
+"0.52836 0.10571 0.64878 0.10571 0.52420 0.11143 0.65295 0.11143 0.52420 0.39714 "
+"0.65295 0.39714 0.22857 0.40546 0.52000 0.40329 0.66286 0.40437 0.95168 0.40857 "
+"0.22437 0.52286 0.95277 0.52286 0.22857 0.52900 0.52311 0.53429 0.65403 0.53429 "
+"0.94857 0.52900 0.52528 0.82571 0.65186 0.82571 0.53143 0.82991 0.64571 0.82991 18 1 2 0 1 3 2 "
+"4 2 3 5 4 3 12 6 7 14 4 "
+"8 9 15 8 8 4 5 9 11 15 "
+"12 7 13 6 12 10 7 4 13 14 8 "
+"15 17 19 18 14 13 4 17 18 16 "
+"17 16 13 17 13 14 "
+;
+
+char *VTK_VECTOR_TEXT_44 = (char *) "23 0.432768 "
+"0.30286 -0.28607 0.30857 -0.28726 0.33714 -0.27355 0.36571 -0.25275 0.27329 -0.23714 "
+"0.38670 -0.23143 0.30286 -0.21582 0.39914 -0.21429 0.32115 -0.19714 0.41355 -0.18571 "
+"0.33800 -0.16857 0.42327 -0.15714 0.34605 -0.14571 0.43277 -0.10000 0.35580 -0.08286 "
+"0.35472 -0.07714 0.28571 -0.07295 0.34857 -0.07295 0.28000 -0.06878 0.27957 0.07714 "
+"0.43168 0.07714 0.28571 0.08134 0.42857 0.08025 21 0 6 4 0 "
+"1 2 0 2 6 3 6 2 8 5 10 5 7 10 6 5 8 5 6 3 10 "
+"7 12 9 12 7 12 13 14 11 12 9 12 11 13 18 17 19 17 21 19 15 "
+"14 13 15 13 17 21 17 22 17 20 22 18 16 17 20 17 13 "
+;
+
+char *VTK_VECTOR_TEXT_45 = (char *) "8 0.606146 "
+"0.19118 0.26000 0.19429 0.25689 0.60000 0.25580 0.60615 0.26000 0.19118 0.38571 "
+"0.60615 0.38571 0.19429 0.38882 0.60000 0.38991 6 6 1 2 6 0 "
+"1 6 2 7 6 4 0 7 2 3 "
+"5 7 3 "
+;
+
+char *VTK_VECTOR_TEXT_46 = (char *) "13 0.432768 "
+"0.28571 -0.07295 0.42286 -0.07295 0.42857 -0.07186 0.27848 -0.06571 0.28000 -0.06878 "
+"0.43277 -0.06571 0.27848 0.07143 0.43277 0.07143 0.27957 0.07714 0.43168 0.07714 "
+"0.28571 0.08134 0.42286 0.08134 0.42857 0.08025 11 0 "
+"3 4 3 0 1 8 6 10 5 1 2 3 1 5 6 3 5 6 7 11 6 "
+"5 7 10 6 11 9 12 11 9 11 7 "
+;
+
+char *VTK_VECTOR_TEXT_47 = (char *) "5 0.562348 "
+"0.14389 -0.08857 0.14857 -0.09256 0.25004 -0.08857 0.56235 1.04286 0.46286 1.04358 3 2 0 1 4 0 2 3 "
+"4 2 "
+;
+
+char *VTK_VECTOR_TEXT_48 = (char *) "53 0.926804 "
+"0.53714 -0.09009 0.59429 -0.09009 0.66857 -0.07673 0.43429 -0.06723 0.73143 -0.05070 "
+"0.34286 -0.00972 0.80571 0.01025 0.54857 0.02152 0.61714 0.02891 0.30241 0.03714 "
+"0.65714 0.04645 0.46857 0.05007 0.42473 0.08857 0.70286 0.08454 0.26645 0.10000 "
+"0.86943 0.11143 0.39955 0.12286 0.73800 0.13429 0.23748 0.18000 0.37034 0.19714 "
+"0.76252 0.20286 0.91236 0.26000 0.21866 0.26571 0.35621 0.26571 0.77823 0.28857 "
+"0.34437 0.40286 0.92680 0.40286 0.20420 0.40857 0.78705 0.54000 0.20723 0.58000 "
+"0.92420 0.58571 0.35277 0.64286 0.22177 0.69429 0.76571 0.72437 0.89966 0.74000 "
+"0.37756 0.76286 0.74498 0.79143 0.26073 0.82571 0.85927 0.84857 0.42473 0.85429 "
+"0.70439 0.85429 0.46286 0.88902 0.66286 0.89007 0.30241 0.90000 0.51009 0.91143 "
+"0.58286 0.91823 0.80725 0.92857 0.77714 0.95829 0.38350 0.98000 0.71429 0.99927 "
+"0.46286 1.01681 0.65714 1.01959 0.53714 1.02991 53 2 8 1 0 7 3 5 16 9 2 10 8 0 "
+"1 8 7 0 8 12 16 5 11 3 7 3 12 5 15 20 17 11 12 3 13 "
+"6 17 6 13 4 9 16 14 10 4 13 14 19 18 4 10 2 15 17 6 19 "
+"14 16 21 24 20 23 18 19 22 25 27 24 26 28 23 22 18 21 20 15 26 "
+"24 21 22 23 25 29 27 25 29 31 32 28 30 33 31 29 25 30 28 26 32 "
+"35 37 46 40 36 30 34 33 32 31 35 43 39 48 43 37 35 38 36 33 38 "
+"33 34 42 40 49 48 41 50 39 43 35 47 40 46 46 36 38 41 44 50 45 "
+"52 44 42 51 45 41 48 39 49 40 47 50 44 52 52 45 51 42 49 51 "
+;
+
+char *VTK_VECTOR_TEXT_49 = (char *) "11 0.708571 "
+"0.58286 -0.07186 0.70857 -0.07186 0.30857 0.62908 0.31429 0.62657 0.38286 0.65641 "
+"0.30785 0.75143 0.57714 0.77731 0.47429 0.85616 0.56384 0.94000 0.62857 1.02915 "
+"0.70857 1.02882 9 6 0 1 2 4 5 7 5 4 2 3 4 6 "
+"8 7 6 7 4 10 8 6 10 6 1 10 9 8 "
+;
+
+char *VTK_VECTOR_TEXT_50 = (char *) "43 0.914286 "
+"0.18857 -0.06878 0.91429 -0.06878 0.18748 -0.04286 0.19849 0.00857 0.91429 0.05164 "
+"0.38142 0.06000 0.22943 0.07714 0.46286 0.15868 0.30286 0.17832 0.38286 0.25813 "
+"0.58413 0.43143 0.78286 0.44454 0.67543 0.52286 0.85355 0.53429 0.72045 0.58000 "
+"0.89756 0.62571 0.75470 0.64286 0.35168 0.70000 0.91236 0.70000 0.77295 0.71143 "
+"0.21403 0.71714 0.77295 0.74571 0.22605 0.79143 0.37143 0.79804 0.90244 0.80857 "
+"0.75429 0.81228 0.38902 0.83143 0.24359 0.84286 0.73143 0.84689 0.42454 0.87143 "
+"0.86607 0.88857 0.68000 0.89070 0.28000 0.90629 0.49143 0.90823 0.58857 0.91866 "
+"0.82857 0.93555 0.31597 0.94571 0.37714 0.98784 0.76000 0.98657 0.44571 1.01470 "
+"0.69143 1.01470 0.53714 1.02991 0.62857 1.02723 41 3 2 0 3 5 6 1 5 0 5 "
+"3 0 1 4 5 6 5 8 7 8 5 9 8 7 9 7 10 11 10 7 10 "
+"11 12 12 11 14 16 15 18 16 18 19 13 14 11 14 13 16 21 24 25 15 "
+"16 13 21 19 18 23 27 22 17 23 22 24 21 18 27 23 32 17 22 20 31 "
+"42 34 30 28 25 26 32 23 40 31 38 35 28 30 36 32 26 29 36 26 34 "
+"41 33 33 37 29 36 29 37 33 39 37 30 25 24 28 38 31 38 28 35 39 "
+"33 41 31 40 42 41 34 42 "
+;
+
+char *VTK_VECTOR_TEXT_51 = (char *) "68 0.927232 "
+"0.52571 -0.09009 0.63429 -0.08395 0.45143 -0.07756 0.37143 -0.04498 0.74286 -0.04771 "
+"0.30857 0.00132 0.81714 0.00439 0.54286 0.02152 0.60000 0.02420 0.64661 0.03714 "
+"0.27429 0.03952 0.46857 0.04073 0.42857 0.06759 0.70857 0.07561 0.88213 0.08286 "
+"0.23429 0.10772 0.38812 0.11714 0.74535 0.11714 0.91109 0.14571 0.77823 0.19143 "
+"0.20764 0.20857 0.92723 0.22571 0.34286 0.23215 0.78437 0.27143 0.92723 0.27714 "
+"0.75429 0.36430 0.89927 0.38571 0.72571 0.40132 0.86857 0.43270 0.67429 0.43927 "
+"0.48000 0.45284 0.48571 0.44966 0.54857 0.46152 0.60000 0.46109 0.83429 0.46686 "
+"0.72693 0.52286 0.49034 0.55714 0.49714 0.56395 0.78857 0.56473 0.58286 0.57109 "
+"0.82857 0.60921 0.67429 0.61616 0.70400 0.64857 0.85294 0.65429 0.72680 0.70571 "
+"0.87009 0.72286 0.35429 0.72298 0.22175 0.74571 0.72991 0.76286 0.72151 0.80286 "
+"0.86244 0.80857 0.38857 0.82064 0.69143 0.85832 0.84571 0.85587 0.26241 0.87143 "
+"0.43429 0.87829 0.64571 0.89641 0.48571 0.90723 0.29330 0.91714 0.60571 0.91252 "
+"0.53143 0.91823 0.80384 0.92286 0.36000 0.97750 0.73143 0.98213 0.44571 1.01681 "
+"0.65714 1.01470 0.52000 1.02991 0.60000 1.02723 66 3 11 "
+"5 9 8 1 1 8 0 4 9 1 "
+"9 4 13 7 0 8 6 13 4 17 13 "
+"6 2 11 3 2 0 7 5 16 10 "
+"12 5 11 10 16 15 11 2 7 16 5 "
+"12 17 14 19 14 17 6 20 15 22 "
+"19 18 23 22 15 16 14 18 19 21 23 "
+"18 23 26 25 23 21 24 26 28 25 "
+"30 32 36 25 34 27 35 32 33 35 29 "
+"27 25 28 34 29 35 33 26 23 24 "
+"37 36 32 39 32 35 35 27 34 37 32 "
+"39 30 31 32 39 35 41 38 41 35 "
+"38 42 41 40 42 38 42 40 44 40 43 "
+"44 44 43 48 45 48 43 47 46 54 "
+"49 48 50 50 48 45 49 53 52 63 52 "
+"61 53 49 50 46 51 54 58 54 51 "
+"58 55 62 62 55 64 66 57 60 61 52 "
+"53 55 58 51 59 67 60 52 63 56 "
+"56 65 59 55 57 64 64 57 66 65 56 "
+"63 67 66 60 67 59 65 "
+;
+
+char *VTK_VECTOR_TEXT_52 = (char *) "18 0.920000 "
+"0.64571 -0.07295 0.64000 -0.06878 0.77143 -0.06878 0.77403 0.18571 0.16265 0.19143 "
+"0.63429 0.18882 0.92000 0.19408 0.15891 0.31143 0.91735 0.31143 0.29653 0.31714 "
+"0.63740 0.31714 0.77714 0.31403 0.16571 0.32228 0.16616 0.32286 0.63429 0.79380 "
+"0.77186 1.02000 0.66857 1.02282 0.76571 1.02420 18 2 1 0 1 3 5 1 2 "
+"3 3 10 5 9 4 5 4 9 7 "
+"6 11 3 8 11 6 7 9 13 15 16 "
+"14 9 5 10 7 13 12 13 14 16 "
+"11 10 3 14 13 9 14 10 11 15 17 "
+"16 15 14 11 "
+;
+
+char *VTK_VECTOR_TEXT_53 = (char *) "54 0.932946 "
+"0.52571 -0.09009 0.61714 -0.08665 0.44571 -0.07673 0.73143 -0.05179 0.35429 -0.03759 "
+"0.78914 -0.01429 0.30286 0.00241 0.53714 0.02152 0.62857 0.03184 0.84115 0.03714 "
+"0.46857 0.03927 0.66286 0.04645 0.26286 0.04921 0.42286 0.06759 0.71429 0.08439 "
+"0.88045 0.09429 0.23343 0.10000 0.38812 0.10571 0.74535 0.12286 0.35748 0.16857 "
+"0.77294 0.18000 0.91681 0.18000 0.20420 0.20857 0.34286 0.22376 0.78705 0.23714 "
+"0.93295 0.27143 0.79009 0.31714 0.93252 0.33429 0.77714 0.38420 0.91681 0.42000 "
+"0.34857 0.43034 0.75641 0.43143 0.23088 0.44857 0.72000 0.47868 0.40000 0.48400 "
+"0.68000 0.50784 0.86902 0.51714 0.46857 0.52437 0.53143 0.53848 0.57714 0.53848 "
+"0.58857 0.53621 0.60000 0.53580 0.82286 0.56972 0.38494 0.59714 0.77714 0.60535 "
+"0.48571 0.64244 0.69714 0.64327 0.56571 0.65848 0.61714 0.65848 0.43891 0.87714 "
+"0.44571 0.88395 0.88043 0.88857 0.88043 1.00857 0.33714 1.01182 52 7 1 "
+"8 7 0 1 7 2 0 2 10 4 "
+"6 13 12 3 8 1 3 11 8 10 2 "
+"7 4 13 6 11 3 14 19 16 12 "
+"3 5 14 9 14 5 10 13 4 22 19 "
+"23 18 15 20 17 12 13 15 14 9 "
+"14 15 18 19 12 17 25 26 24 20 21 "
+"24 21 20 15 22 16 19 25 24 21 "
+"26 25 27 29 28 26 29 26 27 43 37 "
+"45 36 31 29 34 32 30 31 36 33 "
+"31 28 29 32 34 43 48 47 41 45 38 "
+"47 42 33 36 41 39 40 38 39 47 "
+"37 38 45 47 39 41 44 33 42 43 34 "
+"37 46 33 44 35 46 41 33 46 35 "
+"46 48 41 32 43 53 43 49 53 49 50 "
+"53 53 50 52 50 51 52 "
+;
+
+char *VTK_VECTOR_TEXT_54 = (char *) "70 0.927232 "
+"0.55429 -0.09009 0.66857 -0.08034 0.43429 -0.06213 0.75429 -0.04607 0.34857 -0.00972 "
+"0.81143 -0.00439 0.59429 0.02152 0.51339 0.03143 0.85188 0.04286 0.67429 0.04645 "
+"0.46286 0.05579 0.27384 0.07714 0.41714 0.09597 0.73143 0.09597 0.89355 0.11714 "
+"0.38771 0.14000 0.91177 0.16857 0.77294 0.17429 0.22816 0.18571 0.36530 0.19714 "
+"0.78705 0.24857 0.92680 0.25429 0.35320 0.26000 0.78665 0.30571 0.20420 0.31143 "
+"0.35320 0.31143 0.92723 0.31714 0.36657 0.37429 0.77395 0.37429 0.75429 0.41841 "
+"0.39179 0.42571 0.89756 0.44286 0.72000 0.46418 0.43429 0.47258 0.19891 0.50571 "
+"0.33714 0.50495 0.48000 0.50213 0.66857 0.50086 0.86241 0.50571 0.55429 0.52134 "
+"0.61143 0.51866 0.80403 0.56857 0.42286 0.58821 0.74286 0.60943 0.34134 0.63143 "
+"0.50857 0.62823 0.68000 0.63252 0.57714 0.64134 0.21563 0.66000 0.77714 0.74697 "
+"0.37502 0.75714 0.90966 0.76286 0.25673 0.80286 0.41901 0.83143 0.73143 0.85191 "
+"0.45143 0.86686 0.87343 0.87714 0.30036 0.88286 0.68000 0.89514 0.50286 0.90086 "
+"0.51429 0.90530 0.52000 0.90784 0.60571 0.91866 0.83846 0.92857 0.35429 0.94384 "
+"0.40571 0.98150 0.76000 0.99229 0.49143 1.01748 0.68571 1.02041 0.56571 1.02991 70 "
+"2 10 4 6 1 9 3 5 13 0 7 "
+"2 3 9 1 1 6 0 9 3 13 "
+"7 0 6 10 2 7 20 26 23 4 12 "
+"11 13 8 17 4 10 12 11 19 18 "
+"17 21 20 15 11 12 11 15 19 16 17 "
+"14 18 22 24 8 14 17 8 13 5 "
+"24 35 34 22 18 19 20 21 26 28 23 "
+"26 21 17 16 24 27 35 24 22 25 "
+"28 31 29 31 28 26 24 25 27 32 41 "
+"37 30 35 27 34 44 48 35 33 42 "
+"43 37 41 46 39 40 32 29 38 38 29 "
+"31 33 35 30 33 36 42 42 36 45 "
+"45 39 47 36 39 45 37 46 40 41 32 "
+"38 46 37 43 47 39 46 44 34 35 "
+"48 50 52 48 44 50 49 56 54 57 53 "
+"64 57 52 50 54 66 58 51 56 49 "
+"62 69 61 53 57 50 61 59 60 59 65 "
+"55 65 64 55 58 68 62 55 64 53 "
+"66 54 63 63 54 56 65 59 67 69 62 "
+"68 67 59 61 69 67 61 68 58 66 "
+;
+
+char *VTK_VECTOR_TEXT_55 = (char *) "17 0.923788 "
+"0.37143 -0.07186 0.50286 -0.07186 0.36723 -0.06571 0.37335 0.02000 0.52991 0.11143 "
+"0.40379 0.18571 0.59787 0.35143 0.47387 0.41429 0.66857 0.51873 0.53355 0.55143 "
+"0.63384 0.72857 0.80893 0.76286 0.74359 0.88286 0.21714 0.88546 0.92379 0.91143 "
+"0.21403 1.00857 0.92311 1.00857 15 3 0 1 2 0 3 3 4 5 4 3 1 6 7 5 6 5 4 9 "
+"7 6 10 9 8 8 9 6 10 11 12 11 10 8 15 13 12 12 14 16 15 "
+"12 16 11 14 12 "
+;
+
+char *VTK_VECTOR_TEXT_56 = (char *) "83 0.926804 "
+"0.53143 -0.08966 0.62857 -0.08665 0.45143 -0.07605 0.73714 -0.05641 0.38857 -0.05343 "
+"0.34286 -0.02616 0.79429 -0.02250 0.28571 0.02445 0.58857 0.02152 0.50857 0.02823 "
+"0.85258 0.03143 0.66937 0.04286 0.45143 0.05070 0.71429 0.07296 0.41143 0.07868 "
+"0.24000 0.09016 0.89927 0.10571 0.37669 0.12286 0.76613 0.14000 0.21462 0.15714 "
+"0.35849 0.16286 0.92109 0.17429 0.78705 0.22000 0.34437 0.22571 0.20420 0.27143 "
+"0.92680 0.27143 0.78437 0.28286 0.34748 0.28857 0.77143 0.32947 0.91470 0.33429 "
+"0.21714 0.34118 0.37502 0.36286 0.73296 0.39143 0.89057 0.39143 0.24359 0.40286 "
+"0.41883 0.41429 0.69143 0.42722 0.27275 0.44286 0.85714 0.43841 0.46286 0.44371 "
+"0.50286 0.45748 0.63429 0.45470 0.58286 0.46420 0.80507 0.48286 0.33143 0.49007 "
+"0.40456 0.52286 0.72693 0.52286 0.32000 0.57616 0.54857 0.57580 0.62286 0.58319 "
+"0.82082 0.58571 0.49714 0.58657 0.66286 0.60073 0.28527 0.61429 0.44571 0.61582 "
+"0.70439 0.63714 0.85759 0.63714 0.25756 0.67143 0.72657 0.67143 0.39849 0.68286 "
+"0.87470 0.68286 0.74134 0.72857 0.38705 0.73429 0.88109 0.76857 0.24764 0.77429 "
+"0.73395 0.79714 0.39470 0.80286 0.87177 0.82000 0.71641 0.83714 0.27216 0.86571 "
+"0.44000 0.87296 0.84486 0.88286 0.66286 0.89179 0.48000 0.90086 0.61714 0.91184 "
+"0.54286 0.91823 0.31846 0.93429 0.80571 0.93555 0.38286 0.98616 0.72000 0.99800 "
+"0.43429 1.01008 0.53143 1.02991 0.61714 1.02723 85 0 "
+"9 2 12 4 2 1 8 0 6 11 3 5 14 7 9 0 8 8 1 11 4 "
+"12 5 13 11 6 1 3 11 12 2 9 5 12 14 13 10 18 7 17 15 10 "
+"13 6 15 20 19 7 14 17 18 16 22 16 18 10 20 15 17 19 23 24 16 "
+"21 22 22 25 26 23 19 20 24 27 30 25 22 21 27 24 23 31 34 30 31 "
+"37 34 29 28 26 31 30 27 29 26 25 33 28 29 28 33 32 36 32 43 37 "
+"31 44 40 45 39 44 39 45 43 32 38 35 44 31 42 48 40 44 35 39 41 "
+"46 42 36 46 41 32 33 38 48 42 49 46 36 43 48 45 40 42 46 49 51 "
+"45 48 49 46 52 47 54 53 52 46 55 53 59 57 45 54 47 45 51 54 50 "
+"55 46 59 53 54 50 58 55 58 50 61 57 62 64 61 63 65 56 61 50 57 "
+"59 62 60 61 56 64 66 69 63 67 65 64 62 66 63 61 60 71 68 65 76 "
+"69 66 72 68 77 71 65 67 76 70 78 70 76 66 74 82 75 80 78 70 79 "
+"72 77 74 72 79 80 73 75 80 75 81 68 71 77 73 80 70 82 81 75 82 "
+"74 79 "
+;
+
+char *VTK_VECTOR_TEXT_57 = (char *) "72 0.927232 "
+"0.50286 -0.09009 0.56000 -0.09009 0.42857 -0.07673 0.64571 -0.07395 0.36000 -0.04771 "
+"0.74286 -0.02616 0.28759 0.01429 0.51429 0.02152 0.57143 0.02420 0.80115 0.02571 "
+"0.47429 0.02891 0.42857 0.05007 0.64000 0.04943 0.24930 0.07714 0.39314 0.08286 "
+"0.85229 0.10000 0.70902 0.11143 0.37057 0.12286 0.22177 0.17429 0.34857 0.18947 "
+"0.75109 0.19714 0.89395 0.20286 0.75429 0.20739 0.75681 0.21429 0.90966 0.27143 "
+"0.50286 0.30152 0.42857 0.31605 0.61714 0.31462 0.37714 0.33787 0.70286 0.35759 "
+"0.78705 0.37429 0.32000 0.37846 0.58286 0.42152 0.50286 0.42891 0.63429 0.43184 "
+"0.78286 0.43630 0.92723 0.43714 0.26286 0.44350 0.45143 0.45107 0.68571 0.45750 "
+"0.41587 0.47714 0.23787 0.48857 0.74498 0.52286 0.36359 0.55143 0.21522 0.55714 "
+"0.92680 0.56286 0.76571 0.57009 0.34437 0.63143 0.77823 0.63714 0.20462 0.69429 "
+"0.77866 0.69429 0.91236 0.70000 0.35429 0.74118 0.76571 0.76404 0.21756 0.77429 "
+"0.38286 0.80921 0.87343 0.82571 0.40759 0.84286 0.72571 0.84118 0.24527 0.84857 "
+"0.69143 0.87527 0.84000 0.88221 0.47429 0.89641 0.28571 0.90975 0.63429 0.90784 "
+"0.54857 0.91866 0.33143 0.95527 0.76000 0.96331 0.39629 0.99714 0.68571 1.00437 "
+"0.49714 1.02723 0.57714 1.02991 72 3 8 1 2 11 4 0 7 2 "
+"8 3 12 4 14 6 0 1 8 6 17 "
+"13 10 2 7 7 0 8 5 12 3 "
+"12 5 16 2 10 11 4 11 14 5 9 "
+"16 18 13 19 16 15 20 15 23 20 "
+"6 14 17 13 17 19 21 23 15 22 20 "
+"23 23 24 30 16 9 15 23 21 24 "
+"25 32 26 27 32 25 38 28 26 43 41 "
+"37 34 29 39 33 26 32 29 34 27 "
+"30 36 35 34 32 27 36 30 24 28 38 "
+"31 31 38 37 35 39 29 38 26 33 "
+"39 35 42 42 35 36 40 37 38 44 41 "
+"43 42 36 46 44 47 49 43 37 40 "
+"48 46 45 36 45 46 51 50 48 52 54 "
+"49 47 44 43 50 51 53 51 48 45 "
+"59 54 52 59 55 63 52 49 47 53 61 "
+"58 56 53 51 55 59 52 53 56 61 "
+"66 63 57 55 57 63 62 68 57 58 67 "
+"60 67 58 61 68 66 57 60 69 64 "
+"68 62 70 60 67 69 64 71 65 65 70 "
+"62 70 65 71 64 69 71 "
+;
+
+char *VTK_VECTOR_TEXT_58 = (char *) "14 0.432768 "
+"0.28571 -0.07295 0.42857 -0.07186 0.28000 -0.06878 0.43277 -0.06571 0.27957 0.07714 "
+"0.28571 0.08134 0.42857 0.08025 0.27957 0.57429 0.28571 0.57009 0.43168 0.57429 "
+"0.27848 0.71714 0.43277 0.71714 0.28265 0.72286 0.42857 0.72329 10 "
+"2 5 4 2 0 5 0 3 5 6 5 "
+"3 0 1 3 7 8 10 10 11 13 "
+"9 10 8 12 10 13 11 10 9 "
+;
+
+char *VTK_VECTOR_TEXT_59 = (char *) "18 0.432768 "
+"0.30857 -0.28726 0.36571 -0.25275 0.27323 -0.23714 0.39543 -0.22000 0.32384 -0.19143 "
+"0.33756 -0.16857 0.42327 -0.15714 0.43277 -0.10000 0.35472 -0.07714 0.28571 -0.07295 "
+"0.34857 -0.07295 0.28000 -0.06878 0.27957 0.07714 0.43168 0.07714 0.27957 0.57429 "
+"0.43168 0.57429 0.28265 0.72286 0.42857 0.72329 14 2 1 4 5 4 3 0 1 "
+"2 5 6 8 3 4 1 6 5 3 "
+"6 7 8 11 10 12 12 10 13 8 7 "
+"10 11 9 10 13 10 7 17 16 15 "
+"15 16 14 "
+;
+
+char *VTK_VECTOR_TEXT_60 = (char *) "11 0.952690 "
+"0.94857 0.09939 0.95269 0.10571 0.95236 0.22571 0.22894 0.40857 0.38919 0.46571 "
+"0.38919 0.47143 0.22748 0.52857 0.23192 0.53429 0.95098 0.70571 0.95216 0.83143 "
+"0.94857 0.83523 9 4 0 2 5 7 6 4 3 0 0 1 2 7 "
+"8 10 4 5 3 5 6 3 8 9 10 7 5 8 "
+;
+
+char *VTK_VECTOR_TEXT_61 = (char *) "12 0.952768 "
+"0.22857 0.23975 0.94857 0.23975 0.22437 0.35714 0.95277 0.35714 0.22857 0.36329 "
+"0.94857 0.36329 0.22857 0.57385 0.94857 0.57385 0.22437 0.58000 0.95277 0.58000 "
+"0.22857 0.69740 0.94857 0.69740 8 0 4 "
+"2 0 1 5 4 0 5 3 5 1 "
+"11 7 9 10 6 7 10 7 11 8 6 "
+"10 "
+;
+
+char *VTK_VECTOR_TEXT_62 = (char *) "11 0.952360 "
+"0.23429 0.09914 0.22857 0.10169 0.22748 0.22571 0.23192 0.23143 0.95116 0.40857 "
+"0.79073 0.46571 0.79073 0.47143 0.95236 0.52857 0.22897 0.70571 0.22857 0.83287 "
+"0.23429 0.83563 9 1 0 2 3 2 0 3 0 5 4 7 5 4 "
+"5 0 6 5 7 6 10 8 8 10 9 10 6 7 "
+;
+
+char *VTK_VECTOR_TEXT_63 = (char *) "45 0.918074 "
+"0.47429 -0.07186 0.62021 -0.07143 0.47118 0.07714 0.62329 0.07714 0.49979 0.19714 "
+"0.62021 0.19714 0.49563 0.20286 0.49563 0.27714 0.63681 0.31714 0.50816 0.34571 "
+"0.65714 0.36350 0.53669 0.41429 0.70857 0.42384 0.57868 0.47143 0.82857 0.53597 "
+"0.86902 0.58571 0.73258 0.62000 0.90437 0.65429 0.76086 0.66000 0.77522 0.70000 "
+"0.91580 0.70000 0.34857 0.71338 0.21034 0.73429 0.77866 0.75143 0.91807 0.76857 "
+"0.22605 0.80857 0.76571 0.80375 0.38286 0.82144 0.73714 0.85191 0.25098 0.87143 "
+"0.89143 0.86730 0.43597 0.88857 0.86812 0.90571 0.67429 0.90616 0.48571 0.91800 "
+"0.62857 0.92538 0.29296 0.93429 0.54857 0.93277 0.81143 0.96670 0.35429 0.98821 "
+"0.76571 0.99800 0.44571 1.02891 0.69714 1.02680 0.53143 1.04395 0.60000 1.04437 41 2 1 3 2 0 1 7 6 4 7 4 5 8 9 7 11 10 13 8 "
+"7 5 8 10 11 9 8 11 13 12 16 12 13 10 14 16 12 14 15 16 16 "
+"15 18 17 18 15 17 23 19 17 19 18 20 23 17 29 27 36 26 32 28 21 "
+"25 22 26 23 24 27 29 25 24 23 20 36 31 39 28 40 33 30 26 24 35 "
+"44 37 31 36 27 27 25 21 31 34 41 42 33 40 28 38 40 39 31 41 38 "
+"28 32 26 30 32 42 35 33 41 34 43 43 37 44 34 37 43 44 35 42 "
+;
+
+char *VTK_VECTOR_TEXT_64 = (char *) "114 1.632597 "
+"0.92571 -0.39563 1.16571 -0.38109 0.74857 -0.37236 0.65143 -0.34613 1.33143 -0.33070 "
+"0.54286 -0.29914 0.86286 -0.27866 1.06286 -0.28134 1.45650 -0.26000 0.73714 -0.25387 "
+"1.21143 -0.25387 0.43429 -0.22384 0.62286 -0.21216 1.32144 -0.20857 1.55582 -0.17429 "
+"0.53714 -0.16099 0.52571 -0.15258 0.53143 -0.15669 0.33714 -0.11650 1.45143 -0.11561 "
+"0.46286 -0.09260 0.80000 -0.07295 1.20571 -0.07252 1.09714 -0.06891 0.71429 -0.06252 "
+"1.49714 -0.06187 1.63260 -0.06000 0.29629 -0.04857 1.29714 -0.04498 0.90857 -0.03629 "
+"1.03384 -0.02571 0.62857 -0.01582 0.40486 -0.00857 0.59429 0.01873 1.41143 0.03296 "
+"0.82857 0.03907 0.77714 0.04327 1.01143 0.04414 1.20000 0.05050 1.16989 0.06571 "
+"1.25143 0.06086 0.90857 0.06821 0.72000 0.07561 0.54771 0.09429 1.15580 0.09429 "
+"0.24420 0.10000 0.35748 0.11143 0.96000 0.10725 0.68527 0.11714 1.33841 0.11714 "
+"1.51579 0.15714 0.66177 0.17429 1.41355 0.20286 1.03514 0.20857 0.65295 0.23143 "
+"0.22437 0.23714 0.51277 0.23714 0.33563 0.24857 1.45355 0.27714 1.07177 0.31143 "
+"1.58478 0.31143 0.65966 0.32857 1.48319 0.36857 0.53184 0.39714 0.23277 0.40286 "
+"0.34478 0.40857 1.60420 0.42571 1.08420 0.44286 0.71514 0.48857 0.25184 0.49429 "
+"1.49295 0.49429 0.57229 0.50000 1.60109 0.52857 1.05714 0.54144 0.75846 0.55143 "
+"0.38645 0.55714 1.47681 0.58571 1.01143 0.59527 0.81714 0.60331 1.58605 0.60857 "
+"1.12878 0.61429 0.65714 0.62418 0.86286 0.62319 0.96571 0.62151 0.92571 0.62991 "
+"0.42857 0.64350 1.44571 0.66730 0.32359 0.67714 1.06048 0.68286 0.74857 0.69641 "
+"1.15429 0.71588 1.28235 0.71714 1.00571 0.71800 0.82857 0.73109 0.92000 0.74152 "
+"1.52657 0.75143 0.51275 0.75714 0.37669 0.76286 1.38286 0.76132 0.59493 0.82571 "
+"1.30857 0.82821 1.45561 0.84857 0.47429 0.87296 0.73143 0.89681 1.18286 0.89580 "
+"1.08571 0.92395 1.37143 0.92400 0.92000 0.93580 0.58286 0.95188 1.30857 0.96371 "
+"0.71429 1.00899 1.18286 1.01470 0.92000 1.04437 1.01143 1.04395 114 0 6 2 1 7 0 6 0 7 "
+"7 1 10 2 9 3 3 12 5 9 2 "
+"6 10 4 13 4 10 1 15 5 12 "
+"5 15 11 13 8 19 12 3 9 8 13 "
+"4 11 20 18 11 15 16 17 16 15 "
+"14 19 8 26 25 14 20 11 16 22 38 "
+"23 25 19 14 23 39 30 30 39 37 "
+"27 46 45 18 32 27 32 18 20 21 36 "
+"24 35 29 41 24 42 31 29 35 21 "
+"22 28 40 38 22 40 34 49 40 33 31 "
+"48 36 21 35 37 47 41 33 48 43 "
+"43 51 56 44 37 39 34 40 28 47 37 "
+"53 50 52 34 38 39 23 52 49 34 "
+"37 44 53 27 32 46 42 24 36 48 31 "
+"42 37 41 29 45 57 55 53 44 59 "
+"51 54 56 52 50 58 58 60 62 43 48 "
+"51 45 46 57 56 61 63 64 55 57 "
+"91 80 44 60 58 50 62 66 70 56 54 "
+"61 44 80 67 59 44 67 71 63 61 "
+"64 65 69 67 80 73 65 64 57 66 62 "
+"60 68 71 61 71 68 81 69 75 87 "
+"72 70 66 74 81 68 77 73 80 70 79 "
+"76 75 69 65 83 77 88 87 85 97 "
+"81 74 89 89 78 93 86 76 79 70 72 "
+"79 74 78 89 88 77 80 75 85 87 "
+"82 84 94 91 90 80 86 95 98 78 82 "
+"93 92 83 88 93 82 94 84 83 92 "
+"94 84 92 97 96 102 95 86 79 102 99 "
+"108 95 101 98 96 97 85 96 99 102 "
+"98 101 100 103 108 99 100 109 104 106 100 "
+"101 108 103 110 105 113 107 100 106 109 "
+"104 111 105 107 112 110 111 104 109 113 105 "
+"111 112 107 113 107 110 103 "
+;
+
+char *VTK_VECTOR_TEXT_65 = (char *) "13 1.155731 "
+"0.14455 -0.07143 1.00000 -0.07252 1.15573 -0.07143 0.29143 -0.07103 0.40981 0.25429 "
+"0.86857 0.25754 0.45714 0.37713 0.82478 0.38000 0.45462 0.38571 0.58538 0.73429 "
+"0.63429 0.90068 0.56000 1.02454 0.71429 1.02644 13 5 "
+"1 2 0 8 11 6 4 5 12 10 7 0 3 4 0 4 8 6 5 7 6 "
+"8 4 7 5 2 8 9 11 9 10 11 12 7 2 11 10 12 "
+;
+
+char *VTK_VECTOR_TEXT_66 = (char *) "48 1.081090 "
+"0.25714 -0.07186 0.78286 -0.06723 0.86857 -0.04899 0.93714 -0.02045 1.00725 0.03714 "
+"0.39957 0.06000 0.73143 0.05621 0.80571 0.06891 1.04213 0.08857 0.87555 0.10571 "
+"1.06437 0.14000 0.91070 0.15143 1.08109 0.22000 0.93295 0.22571 0.93252 0.26571 "
+"1.07177 0.32286 0.90857 0.34064 1.04616 0.38571 0.86857 0.38686 0.79429 0.42252 "
+"0.39957 0.43143 1.01296 0.43143 0.69714 0.43563 0.97143 0.46686 0.88197 0.51143 "
+"0.40571 0.56437 0.72000 0.56705 0.39848 0.57429 0.96956 0.58571 0.80571 0.58930 "
+"0.84686 0.62000 0.99641 0.62571 0.86943 0.65429 1.02437 0.70571 0.88420 0.71143 "
+"1.02665 0.76857 0.87429 0.79232 1.01673 0.82000 0.84000 0.84984 0.77714 0.88538 "
+"0.98607 0.88857 0.39957 0.89429 0.71429 0.89580 0.93143 0.95296 0.85714 0.99756 "
+"0.80000 1.01470 0.25714 1.02615 0.70857 1.02680 50 1 6 0 2 7 1 "
+"0 20 46 7 2 9 1 7 6 20 27 "
+"46 9 4 11 4 9 3 2 3 9 "
+"11 10 13 8 11 4 10 11 8 12 13 "
+"10 14 17 16 14 15 17 16 21 18 "
+"14 13 12 15 14 12 23 18 21 5 0 "
+"6 19 26 22 18 24 19 16 17 21 "
+"24 18 23 26 19 29 19 24 29 25 22 "
+"26 22 25 20 30 29 24 32 28 31 "
+"28 32 30 32 31 34 0 5 20 34 35 "
+"36 33 34 31 28 30 24 36 40 38 "
+"38 44 39 35 37 36 34 33 35 25 27 "
+"20 27 41 46 40 36 37 43 38 40 "
+"39 45 42 42 47 41 38 43 44 45 39 "
+"44 47 46 41 47 42 45 "
+;
+
+char *VTK_VECTOR_TEXT_67 = (char *) "56 1.186046 "
+"0.69143 -0.08966 0.80000 -0.08705 0.60000 -0.07823 0.50857 -0.05070 0.93143 -0.05216 "
+"0.45714 -0.02486 1.00000 -0.01473 0.39597 0.02000 0.69714 0.03563 0.74857 0.03563 "
+"0.62286 0.04899 0.82286 0.04899 1.08000 0.05597 0.57143 0.06784 0.88000 0.07229 "
+"0.32571 0.10064 0.93143 0.10759 0.49143 0.11901 1.13800 0.14000 0.45600 0.15714 "
+"0.28930 0.16286 0.99641 0.18571 0.41502 0.22571 1.18605 0.27714 0.24319 0.28857 "
+"1.04571 0.31105 0.38244 0.32857 0.22748 0.36286 0.36723 0.44286 0.21866 0.52857 "
+"0.36991 0.55714 0.22705 0.60857 1.02857 0.69469 0.40657 0.71143 1.16694 0.72857 "
+"0.26286 0.74089 0.44187 0.78000 1.13927 0.80857 0.97143 0.80914 0.48000 0.82725 "
+"0.31750 0.84286 0.93714 0.85011 0.53143 0.86784 0.89143 0.88331 1.07582 0.90571 "
+"0.64000 0.91252 0.64571 0.91335 0.65714 0.91563 0.38286 0.91868 0.78857 0.91823 "
+"1.00571 0.96902 0.50286 0.99756 0.93143 1.01070 0.58286 1.02680 0.70286 1.04705 "
+"0.80000 1.04437 54 "
+"1 9 0 0 8 2 14 6 16 4 14 "
+"11 24 20 22 7 17 15 2 10 3 "
+"8 10 2 9 1 11 0 9 8 4 11 "
+"1 3 13 5 12 16 6 10 13 3 "
+"5 13 7 7 13 17 22 20 15 16 12 "
+"21 14 4 6 19 15 17 23 25 18 "
+"22 15 19 25 21 18 18 21 12 27 28 "
+"29 27 24 26 26 24 22 28 27 26 "
+"29 30 31 30 29 28 33 35 31 35 33 "
+"40 33 31 30 34 37 32 48 42 51 "
+"36 40 33 40 36 48 38 44 41 44 38 "
+"37 32 37 38 48 39 42 36 39 48 "
+"54 53 47 45 51 42 49 43 52 50 41 "
+"44 47 45 46 41 50 43 45 53 51 "
+"49 54 47 53 45 47 49 55 54 55 49 "
+"52 52 43 50 "
+;
+
+char *VTK_VECTOR_TEXT_68 = (char *) "34 1.167232 "
+"0.26286 -0.07186 0.70286 -0.07252 0.80000 -0.06109 0.89714 -0.03355 0.99555 0.02571 "
+"0.40528 0.06000 0.72571 0.05891 1.03582 0.06571 0.79547 0.07143 0.88000 0.10893 "
+"1.08150 0.12857 0.92115 0.14571 0.96657 0.21429 1.13966 0.26571 0.99470 0.28857 "
+"1.16420 0.39714 1.01823 0.43714 1.16723 0.52857 1.01823 0.53429 1.15277 0.64286 "
+"1.00000 0.65848 0.97714 0.72375 1.11216 0.77429 0.94286 0.78057 0.87429 0.84902 "
+"1.06607 0.85429 0.81714 0.87865 0.40528 0.89429 0.69143 0.89807 0.97714 0.94616 "
+"0.90857 0.98657 0.81143 1.01580 0.26286 1.02615 0.70286 1.02680 34 2 6 1 5 0 1 "
+"8 3 9 3 8 2 0 27 32 6 2 "
+"8 5 1 6 4 7 11 4 9 3 "
+"9 4 11 11 10 12 11 7 10 13 14 "
+"12 14 15 16 13 12 10 16 17 18 "
+"14 13 15 18 19 20 17 16 15 18 17 "
+"19 22 21 20 21 22 23 29 24 23 "
+"22 20 19 26 24 30 0 5 27 25 23 "
+"22 29 23 25 30 24 29 26 31 28 "
+"31 26 30 33 32 27 28 33 27 33 28 "
+"31 "
+;
+
+char *VTK_VECTOR_TEXT_69 = (char *) "15 1.080000 "
+"0.26857 -0.07186 1.08000 -0.06878 1.08000 0.05164 0.41100 0.06000 0.41100 0.42571 "
+"1.01143 0.43100 1.01563 0.55143 0.41714 0.55866 1.01143 0.55757 0.40991 0.56857 "
+"0.41100 0.89429 1.05143 0.89957 1.05563 1.02000 0.26857 1.02615 1.05143 1.02615 13 0 4 13 1 3 0 1 2 3 0 "
+"3 4 7 5 8 5 7 4 6 8 5 4 9 13 7 9 4 9 10 13 11 "
+"14 10 14 13 10 12 14 11 "
+;
+
+char *VTK_VECTOR_TEXT_70 = (char *) "12 1.005714 "
+"0.26857 -0.07186 0.40571 -0.07186 0.40991 0.42000 0.41714 0.42723 0.92615 0.43143 "
+"0.92615 0.55143 0.41714 0.55563 0.40991 0.56286 0.41100 0.89429 1.00571 0.90265 "
+"1.00571 1.02307 0.26857 1.02615 10 0 2 "
+"11 2 7 11 2 0 1 6 4 5 "
+"4 6 3 3 6 2 7 2 6 7 8 "
+"11 11 8 10 8 9 10 "
+;
+
+char *VTK_VECTOR_TEXT_71 = (char *) "60 1.234286 "
+"0.82286 -0.08966 0.65714 -0.07866 0.93143 -0.07335 0.56571 -0.05387 1.05143 -0.03355 "
+"0.48000 -0.01514 1.12000 0.00073 0.74286 0.03866 0.83429 0.04177 0.38857 0.05044 "
+"0.65143 0.05470 0.92571 0.06319 1.23260 0.07714 0.34857 0.09302 0.54286 0.10150 "
+"1.03429 0.11229 0.50286 0.13044 1.09252 0.15714 0.44421 0.19714 0.27429 0.21629 "
+"0.24252 0.31143 0.39320 0.31143 0.77714 0.36243 1.09143 0.35773 0.22748 0.39714 "
+"0.37605 0.40286 0.77295 0.48286 0.77714 0.48900 1.23429 0.48900 0.22437 0.51143 "
+"0.37295 0.51714 0.23320 0.59143 0.39748 0.65429 1.09143 0.68617 1.08571 0.69099 "
+"0.42073 0.71714 1.21977 0.72286 0.27387 0.73429 1.06286 0.75301 0.30645 0.80286 "
+"0.47616 0.80286 1.02286 0.82127 1.18498 0.82571 0.54286 0.86150 0.34857 0.86629 "
+"0.94286 0.88371 1.14857 0.88793 0.61143 0.89580 0.86286 0.91184 0.40168 0.92286 "
+"0.70857 0.91866 0.80000 0.92134 1.09714 0.94384 0.45714 0.96436 0.53714 1.00498 "
+"1.00000 1.00371 0.93714 1.02613 0.62857 1.03252 0.73714 1.04705 0.84571 1.04395 58 0 7 1 14 5 3 5 14 "
+"9 2 8 0 1 10 3 0 8 7 "
+"8 2 11 18 13 9 17 6 12 10 1 "
+"7 4 11 2 13 18 19 23 17 12 "
+"15 6 17 4 6 15 16 9 14 11 4 "
+"15 14 3 10 19 21 20 18 9 16 "
+"30 31 29 23 27 22 25 24 20 22 27 "
+"26 21 19 18 25 20 21 23 28 27 "
+"28 23 12 29 24 25 30 29 25 31 32 "
+"37 38 33 36 37 32 39 32 31 30 "
+"35 39 32 34 33 38 39 40 44 38 46 "
+"41 38 42 46 40 39 35 44 40 49 "
+"53 43 54 43 49 40 42 38 36 43 47 "
+"54 52 41 46 41 52 45 43 53 49 "
+"54 47 57 50 57 47 45 56 48 55 45 "
+"52 48 59 51 57 50 58 50 51 58 "
+"56 45 55 58 51 59 59 48 56 "
+;
+
+char *VTK_VECTOR_TEXT_72 = (char *) "16 1.125714 "
+"0.26857 -0.07186 0.40571 -0.07186 0.98857 -0.07295 0.98286 -0.06878 1.12571 -0.06878 "
+"0.40991 0.43714 0.41714 0.44437 0.97714 0.44329 0.41714 0.57277 0.97714 0.57385 "
+"0.40991 0.58000 0.98550 1.02571 1.12571 1.02307 0.26857 1.02615 0.40571 1.02615 "
+"1.12000 1.02723 14 4 9 7 0 5 13 5 10 13 "
+"5 0 1 8 7 9 9 4 11 10 5 "
+"8 6 8 5 4 3 2 7 8 6 "
+"14 13 10 12 15 11 3 4 7 4 12 "
+"11 "
+;
+
+char *VTK_VECTOR_TEXT_73 = (char *) "4 0.428571 "
+"0.42592 -0.07143 0.28571 -0.06878 0.28836 1.02571 0.42857 1.02307 2 1 3 2 3 1 0 "
+;
+
+char *VTK_VECTOR_TEXT_74 = (char *) "27 0.790089 "
+"0.45143 -0.09009 0.50857 -0.09009 0.37714 -0.07756 0.58404 -0.07714 0.33143 -0.06086 "
+"0.64000 -0.05641 0.26489 -0.01429 0.71429 -0.00117 0.46286 0.03866 0.53714 0.04706 "
+"0.74902 0.04857 0.41714 0.04899 0.57772 0.06571 0.21143 0.06772 0.37016 0.07714 "
+"0.34498 0.11143 0.77252 0.11143 0.62371 0.11714 0.18705 0.16286 0.32462 0.17429 "
+"0.64420 0.22571 0.79009 0.23143 0.18546 0.23714 0.31472 0.25429 0.64836 1.02571 "
+"0.78857 1.02307 0.78286 1.02723 25 10 "
+"12 7 4 2 11 0 1 8 3 8 1 11 2 8 0 8 2 8 3 9 9 "
+"3 12 4 14 6 7 12 5 3 5 12 6 15 13 12 10 17 14 4 11 13 "
+"19 18 6 14 15 22 19 23 17 16 20 13 15 19 16 17 10 22 18 19 21 "
+"20 16 20 21 24 25 26 24 21 25 24 "
+;
+
+char *VTK_VECTOR_TEXT_75 = (char *) "17 1.155019 "
+"0.25714 -0.07186 0.39429 -0.07186 1.15502 -0.07143 0.97143 -0.07140 0.89527 0.28857 "
+"0.89143 0.29371 0.89098 0.29429 0.39848 0.30000 0.57714 0.47913 0.40000 0.49126 "
+"0.68956 0.56857 0.68571 0.57371 0.68527 0.57429 1.13216 1.02571 0.25714 1.02615 "
+"0.39429 1.02615 0.94857 1.02680 15 0 9 14 0 7 9 3 10 8 3 6 10 9 8 16 4 5 6 7 "
+"0 1 3 4 6 16 8 12 10 11 12 4 3 2 8 10 12 9 7 8 13 "
+"16 12 15 14 9 "
+;
+
+char *VTK_VECTOR_TEXT_76 = (char *) "7 0.941339 "
+"0.25714 -0.07186 0.93714 -0.07186 0.94134 0.04857 0.39957 0.06000 0.93714 0.05472 "
+"0.25714 1.02615 0.39429 1.02615 5 3 0 1 0 3 5 2 4 1 3 1 4 6 5 3 "
+;
+
+char *VTK_VECTOR_TEXT_77 = (char *) "19 1.302857 "
+"0.39164 -0.07143 0.71429 -0.07186 1.17143 -0.07295 0.25714 -0.06878 0.84000 -0.06947 "
+"1.16571 -0.06878 1.30286 -0.06878 0.78286 0.09751 0.78857 0.09751 1.16000 0.83018 "
+"0.40000 0.84467 0.52151 0.88286 0.52000 0.88739 0.51748 0.89429 0.47580 1.02000 "
+"0.25979 1.02571 1.11429 1.02285 1.30286 1.02307 0.46857 1.02680 17 3 10 15 5 6 9 6 "
+"5 2 1 11 10 4 8 1 1 7 11 9 16 8 1 8 7 9 8 4 10 "
+"18 15 13 11 12 10 3 0 10 13 18 16 9 17 10 11 13 13 14 18 6 "
+"17 9 "
+;
+
+char *VTK_VECTOR_TEXT_78 = (char *) "14 1.125714 "
+"0.26286 -0.07186 0.39429 -0.07186 0.98286 -0.07295 1.12571 -0.06878 0.98286 0.17231 "
+"0.72045 0.31143 0.71678 0.31714 0.72000 0.31207 0.40000 0.78092 0.99122 1.02571 "
+"1.12571 1.02307 0.26286 1.02615 0.40571 1.02644 1.12000 1.02723 12 "
+"0 8 11 8 0 1 4 3 9 3 4 "
+"2 4 5 2 6 7 5 12 6 4 "
+"4 6 5 6 12 8 10 13 9 8 12 "
+"11 3 10 9 "
+;
+
+char *VTK_VECTOR_TEXT_79 = (char *) "63 1.267054 "
+"0.70286 -0.08966 0.77714 -0.08966 0.61143 -0.07605 0.89714 -0.06823 0.97143 -0.04073 "
+"0.49143 -0.03229 1.05650 0.00857 0.42286 0.01107 0.70857 0.03605 0.77143 0.03605 "
+"0.63429 0.04899 0.84571 0.04899 1.12725 0.07143 0.35044 0.07714 0.92716 0.08286 "
+"0.54857 0.08535 0.49143 0.12704 1.17465 0.13429 1.01296 0.15143 0.28571 0.17016 "
+"0.43955 0.18571 1.21184 0.20286 0.40784 0.23714 1.08086 0.26000 1.24613 0.30000 "
+"0.23109 0.31143 1.10665 0.34571 0.36764 0.36857 0.21295 0.43143 1.11848 0.43714 "
+"1.26705 0.43714 0.36193 0.51143 1.11848 0.51714 0.21563 0.54571 0.36991 0.59143 "
+"1.25522 0.61429 1.09966 0.63714 0.23236 0.64857 1.23681 0.68857 1.07070 0.71714 "
+"0.41143 0.73016 0.26645 0.75143 1.20486 0.76857 0.45561 0.79714 1.02286 0.79270 "
+"0.98857 0.82956 0.31429 0.83650 1.16045 0.84286 0.53143 0.86150 0.92000 0.87800 "
+"0.35582 0.88857 0.63429 0.90764 0.85143 0.90613 1.10286 0.90956 0.71429 0.92134 "
+"0.79429 0.91866 0.43493 0.95714 1.04000 0.95964 0.52000 1.00498 0.96000 1.00327 "
+"0.89714 1.02613 0.63429 1.03866 0.77714 1.04705 63 0 8 2 1 9 0 8 10 2 2 10 5 9 1 11 5 "
+"16 7 11 3 14 3 11 1 3 4 14 6 14 4 7 16 13 10 15 5 0 "
+"9 8 16 5 15 14 6 18 13 20 19 12 18 6 18 17 23 17 21 23 20 "
+"22 19 18 12 17 23 21 26 25 19 22 13 16 20 25 27 28 27 25 22 21 "
+"24 26 30 29 26 32 35 36 30 26 24 33 34 37 32 29 30 28 31 33 31 "
+"28 27 34 33 31 36 38 39 35 32 30 41 37 34 38 42 39 41 40 46 35 "
+"38 36 39 47 44 40 43 46 53 45 44 46 43 50 45 57 49 40 41 34 56 "
+"50 43 49 59 52 48 56 43 57 45 53 53 44 47 56 48 58 39 42 47 58 "
+"51 61 59 49 57 51 58 48 55 52 60 62 54 55 59 60 52 61 54 62 54 "
+"61 51 62 55 60 "
+;
+
+char *VTK_VECTOR_TEXT_80 = (char *) "31 1.098661 "
+"0.26286 -0.07186 0.40000 -0.07186 0.40420 0.36857 0.41143 0.37580 0.73714 0.37621 "
+"0.88571 0.40034 0.98343 0.44857 0.41143 0.50420 0.72571 0.50420 0.40420 0.51143 "
+"1.04045 0.51143 0.82947 0.52286 0.88571 0.55296 0.91678 0.58571 1.08252 0.59714 "
+"0.93966 0.63143 1.09866 0.68286 0.94966 0.72857 0.93355 0.79143 1.08530 0.80857 "
+"0.90857 0.83270 0.86857 0.86893 1.05927 0.87143 0.40528 0.89429 0.82286 0.88899 "
+"0.74857 0.89807 1.02439 0.92286 0.96000 0.97641 0.89143 1.00538 0.26286 1.02615 "
+"0.74286 1.02680 31 0 9 29 0 2 9 2 7 9 7 3 8 12 11 5 5 11 4 4 "
+"8 3 3 7 2 2 0 1 11 8 4 13 12 6 10 13 6 6 12 5 14 "
+"15 10 15 14 17 13 10 15 16 17 14 17 19 18 19 17 16 18 19 20 20 "
+"27 21 22 20 19 9 23 29 30 25 24 25 30 23 27 20 26 20 22 26 28 "
+"24 21 28 21 27 30 29 23 30 24 28 "
+;
+
+char *VTK_VECTOR_TEXT_81 = (char *) "66 1.276398 "
+"1.23429 -0.15444 1.13714 -0.11188 0.76571 -0.09009 0.64571 -0.08437 0.84000 -0.08034 "
+"0.58286 -0.07034 1.27640 -0.06000 0.93143 -0.05470 0.46857 -0.02322 1.00000 -0.02293 "
+"0.38857 0.03330 0.76000 0.03563 0.68000 0.03866 0.83547 0.04857 1.09814 0.04857 "
+"0.61714 0.05177 0.87591 0.06571 0.55429 0.07800 0.80000 0.10784 0.49143 0.12132 "
+"0.30857 0.12350 0.74115 0.12857 0.98286 0.13189 1.17355 0.14571 0.42857 0.19207 "
+"0.86857 0.19927 0.26286 0.20486 1.05355 0.22000 0.77714 0.23134 0.39277 0.26000 "
+"1.23177 0.27714 0.23387 0.28286 1.08823 0.30571 0.36420 0.36286 0.20991 0.40286 "
+"0.35580 0.43714 1.25866 0.43714 1.11009 0.44286 0.20723 0.51714 1.25252 0.58000 "
+"0.36420 0.59714 1.09823 0.60857 0.23470 0.67714 0.38857 0.68947 1.21184 0.73429 "
+"1.05143 0.73841 0.42902 0.76857 0.28821 0.80286 1.00571 0.80413 1.17188 0.81429 "
+"0.96000 0.84670 0.51429 0.85473 0.34473 0.88286 1.12000 0.88413 0.57714 0.89070 "
+"0.88571 0.89070 0.64571 0.91252 0.76571 0.92093 0.42857 0.95759 1.03429 0.95864 "
+"0.50286 0.99927 0.96571 0.99800 0.60000 1.03252 0.86857 1.03184 0.69714 1.04705 "
+"0.77143 1.04665 66 0 6 1 "
+"13 7 16 14 9 1 9 16 7 3 15 "
+"5 16 9 14 11 4 13 11 2 4 "
+"7 13 4 12 3 11 2 11 3 15 3 "
+"12 5 17 8 8 19 10 10 19 20 "
+"14 1 6 5 15 17 20 29 26 19 8 "
+"17 21 18 28 22 16 14 16 25 18 "
+"22 14 27 24 20 19 16 22 25 26 29 "
+"31 18 25 28 14 23 27 27 30 32 "
+"30 27 23 31 33 34 20 24 29 37 32 "
+"30 33 31 29 34 33 38 36 37 30 "
+"35 38 33 37 39 41 38 40 42 37 36 "
+"39 41 44 45 40 38 35 42 43 47 "
+"44 41 39 46 47 43 43 42 40 47 46 "
+"52 45 49 48 59 50 48 52 51 58 "
+"53 48 49 61 50 59 50 61 55 58 51 "
+"60 51 52 46 49 45 44 59 48 53 "
+"57 64 56 60 54 62 55 63 57 51 54 "
+"60 54 56 62 62 56 64 63 55 61 "
+"63 65 57 57 65 64 "
+;
+
+char *VTK_VECTOR_TEXT_82 = (char *) "46 1.225355 "
+"0.26857 -0.07186 0.40571 -0.07186 1.05143 -0.07215 1.22359 -0.07143 1.22535 -0.06571 "
+"1.17465 0.01429 1.17143 0.01936 1.17098 0.02000 0.84571 0.24343 1.00571 0.27650 "
+"0.76571 0.34698 0.91832 0.37429 0.73143 0.37678 0.40991 0.40857 0.68000 0.40437 "
+"0.41714 0.41580 0.62286 0.41538 0.84226 0.42571 0.92571 0.44706 0.99429 0.47502 "
+"1.07582 0.54000 0.41714 0.54420 0.40991 0.55143 0.80000 0.54764 0.88000 0.56538 "
+"1.11641 0.60286 0.94286 0.60439 0.96784 0.63714 1.13823 0.67714 0.98966 0.69429 "
+"0.99277 0.74571 1.14134 0.75143 0.97143 0.81493 1.12823 0.82000 0.93143 0.86115 "
+"1.10498 0.87714 0.89143 0.88498 0.40991 0.90000 0.41714 0.90723 0.78857 0.90723 "
+"1.07011 0.92857 1.01714 0.97579 0.97143 0.99865 0.87429 1.02109 0.26857 1.02615 "
+"0.80571 1.02723 46 2 9 8 3 5 2 0 37 "
+"44 5 7 2 5 6 7 3 4 5 "
+"2 7 9 18 23 17 11 8 9 8 11 "
+"10 0 22 37 11 17 10 21 16 23 "
+"21 15 16 23 10 17 19 24 18 23 18 "
+"24 23 12 10 15 21 13 0 21 22 "
+"16 14 23 23 14 12 20 26 19 26 20 "
+"27 24 19 26 27 25 29 28 30 29 "
+"31 30 28 25 27 20 30 33 32 28 29 "
+"25 33 30 31 32 40 34 35 32 33 "
+"0 1 13 0 13 21 41 34 40 43 36 "
+"42 38 39 45 32 35 40 42 34 41 "
+"34 42 36 36 43 39 44 38 45 43 45 "
+"39 37 38 44 "
+;
+
+char *VTK_VECTOR_TEXT_83 = (char *) "69 1.081090 "
+"0.71429 -0.08966 0.53714 -0.07866 0.82286 -0.07101 0.46286 -0.05959 0.38857 -0.02616 "
+"0.94286 -0.01678 0.33714 0.01044 0.64000 0.03866 0.73143 0.04177 1.00571 0.03883 "
+"0.56000 0.05177 0.28527 0.06571 0.50857 0.06930 0.83587 0.07143 1.04086 0.08857 "
+"0.88127 0.10000 0.43429 0.11330 0.24486 0.13429 0.92613 0.15714 1.07177 0.16286 "
+"0.38771 0.16857 0.94134 0.21429 0.36319 0.22571 0.21563 0.23714 1.08109 0.26571 "
+"0.21403 0.27714 0.93294 0.27714 0.34857 0.28916 0.91011 0.31714 1.06816 0.32857 "
+"0.84000 0.36943 1.04486 0.38000 0.76571 0.39673 0.98286 0.45241 0.53143 0.45748 "
+"0.42857 0.49343 0.92571 0.49070 0.37143 0.52535 0.82857 0.53109 0.31044 0.58000 "
+"0.53143 0.60899 0.43429 0.65616 0.26244 0.67143 0.39891 0.71143 0.90857 0.71084 "
+"0.25295 0.72286 1.04615 0.72286 0.39320 0.76857 0.40359 0.80857 1.03109 0.81429 "
+"0.26327 0.82000 0.87429 0.81493 0.45143 0.86956 0.82286 0.87258 0.28930 0.88286 "
+"0.98812 0.90000 0.50857 0.90041 0.76571 0.90151 0.57714 0.91563 0.67429 0.91866 "
+"0.95443 0.94000 0.35429 0.96099 0.89143 0.98784 0.40000 0.99188 0.83429 1.01470 "
+"0.50286 1.03184 0.74857 1.03823 0.57143 1.04437 0.67429 1.04705 67 2 "
+"8 0 0 7 1 6 4 16 6 16 11 0 8 7 7 10 1 8 2 13 5 "
+"15 13 1 10 3 10 12 3 9 15 5 4 3 12 15 14 18 5 13 2 14 "
+"15 9 16 4 12 21 24 26 18 19 21 11 20 17 20 11 16 17 22 23 19 "
+"18 14 22 17 20 25 23 27 23 22 27 24 21 19 26 31 28 28 33 30 24 "
+"29 26 30 38 32 26 29 31 34 32 38 33 28 31 34 40 35 33 36 30 39 "
+"43 42 38 30 36 41 37 35 40 34 38 37 41 39 41 35 40 50 48 54 39 "
+"41 43 44 46 49 45 42 43 45 47 50 48 50 47 60 51 55 47 45 43 51 "
+"60 53 54 48 61 44 49 51 55 51 49 48 52 61 56 63 52 57 66 59 61 "
+"52 63 63 56 65 62 53 60 53 64 57 53 62 64 59 66 58 65 58 67 58 "
+"65 56 66 57 64 67 58 68 68 58 66 "
+;
+
+char *VTK_VECTOR_TEXT_84 = (char *) "8 1.045714 "
+"0.54286 -0.07186 0.68000 -0.07186 0.53757 0.89429 0.68528 0.89429 0.17714 0.90265 "
+"1.04571 0.90265 0.17979 1.02571 1.04571 1.02307 6 0 3 2 3 0 "
+"1 6 4 2 6 3 7 6 2 3 "
+"3 5 7 "
+;
+
+char *VTK_VECTOR_TEXT_85 = (char *) "32 1.126804 "
+"0.65714 -0.09009 0.77143 -0.08705 0.53143 -0.07034 0.85714 -0.07101 0.47429 -0.05070 "
+"0.94286 -0.03629 0.38286 0.00704 1.02286 0.02445 0.65714 0.04437 0.78857 0.05320 "
+"0.33669 0.06000 0.58286 0.05748 0.84000 0.06823 0.52000 0.08535 1.07070 0.08857 "
+"0.89714 0.10154 0.46857 0.13025 1.09966 0.15714 0.29143 0.15866 0.94899 0.17429 "
+"0.43177 0.19714 0.27320 0.24286 0.97252 0.26000 1.12680 0.33429 0.26437 0.34000 "
+"0.40991 0.34000 0.98134 0.34571 0.98550 1.02571 1.12571 1.02307 0.26857 1.02615 "
+"0.40571 1.02615 1.12000 1.02723 30 3 9 1 10 20 18 8 0 "
+"1 0 11 2 7 15 5 0 8 11 "
+"8 1 9 9 3 12 13 4 2 5 12 "
+"3 15 7 19 16 10 6 12 5 15 "
+"4 13 6 13 2 11 21 18 20 13 16 "
+"6 19 17 22 17 19 14 7 14 19 "
+"10 16 20 25 24 21 23 26 22 23 22 "
+"17 25 21 20 24 25 29 30 29 25 "
+"28 31 27 26 23 27 23 28 27 "
+;
+
+char *VTK_VECTOR_TEXT_86 = (char *) "8 1.148571 "
+"0.57714 -0.07025 0.72571 -0.06947 0.64571 0.06079 0.65143 0.06062 0.15429 1.02560 "
+"0.30286 1.02531 1.00571 1.02531 1.14857 1.02560 6 0 2 4 3 2 "
+"0 3 7 6 1 3 0 3 1 7 "
+"2 5 4 "
+;
+
+char *VTK_VECTOR_TEXT_87 = (char *) "14 1.568063 "
+"0.45143 -0.07186 0.60000 -0.07017 1.13143 -0.06912 1.27429 -0.06912 0.52571 0.09707 "
+"1.20000 0.09787 1.13673 0.38000 0.86857 0.88103 0.16571 1.02562 0.78286 1.02446 "
+"1.42857 1.02446 1.56806 1.02571 0.30857 1.02615 0.95429 1.02615 12 "
+"2 6 7 6 2 5 1 4 0 7 9 "
+"4 11 10 5 3 5 2 8 0 4 "
+"13 7 6 9 7 13 7 4 1 11 5 "
+"3 12 8 4 "
+;
+
+char *VTK_VECTOR_TEXT_88 = (char *) "14 1.141168 "
+"0.15194 -0.07143 1.14117 -0.07143 0.32000 -0.07106 0.97143 -0.07140 0.65143 0.37795 "
+"0.74607 0.49429 0.56517 0.50000 0.74286 0.49909 0.74219 0.50000 0.65714 0.61727 "
+"0.20016 1.02571 0.96000 1.02568 1.11260 1.02571 0.36571 1.02644 12 "
+"0 2 6 3 5 4 5 6 4 5 8 "
+"6 5 3 1 5 7 8 4 6 2 "
+"9 6 8 12 11 8 6 13 10 13 6 "
+"9 11 9 8 "
+;
+
+char *VTK_VECTOR_TEXT_89 = (char *) "12 1.145205 "
+"0.71164 -0.07143 0.57143 -0.06878 0.56891 0.39143 0.71787 0.39714 0.65143 0.51441 "
+"0.43179 0.85429 0.42857 0.85936 0.42812 0.86000 0.15284 1.02571 0.32000 1.02535 "
+"0.98286 1.02464 1.14521 1.02571 10 3 2 "
+"1 3 1 0 4 2 3 2 9 8 "
+"11 10 4 5 2 4 5 6 7 2 7 "
+"9 2 5 7 11 4 3 "
+;
+
+char *VTK_VECTOR_TEXT_90 = (char *) "11 1.040000 "
+"0.17714 -0.07186 1.04000 -0.06878 1.04000 0.05164 0.17395 0.06000 0.34602 0.06000 "
+"0.84777 0.89429 0.24000 0.89957 1.02395 0.90000 0.23580 1.02000 1.02286 1.02307 "
+"0.24000 1.02615 9 0 4 3 1 4 0 1 2 4 3 4 5 5 "
+"7 9 4 7 5 5 10 6 10 5 9 6 10 8 "
+;
+
+char *VTK_VECTOR_TEXT_91 = (char *) "8 0.541339 "
+"0.24528 -0.37429 0.54025 -0.37429 0.54025 -0.27143 0.38227 -0.26571 0.38286 0.91454 "
+"0.54134 0.92286 0.24836 1.02571 0.53714 1.02615 6 0 4 6 3 1 "
+"2 1 3 0 0 3 4 5 7 4 "
+"6 4 7 "
+;
+
+char *VTK_VECTOR_TEXT_92 = (char *) "5 0.564685 "
+"0.46286 -0.09182 0.56000 -0.09256 0.56469 -0.08857 0.14713 1.04286 0.24571 1.04358 3 0 4 3 0 2 4 0 "
+"1 2 "
+;
+
+char *VTK_VECTOR_TEXT_93 = (char *) "9 0.465968 "
+"0.17100 -0.37429 0.46597 -0.37429 0.17100 -0.27143 0.32571 -0.26723 0.33295 -0.26000 "
+"0.33143 0.91201 0.17143 0.91979 0.16991 1.02000 0.46286 1.02615 7 2 0 3 1 "
+"3 0 1 4 3 5 4 1 7 6 8 5 8 6 8 5 1 "
+;
+
+char *VTK_VECTOR_TEXT_94 = (char *) "11 0.817005 "
+"0.18389 0.44857 0.18857 0.44458 0.32000 0.44686 0.68571 0.44746 0.81143 0.44445 "
+"0.81700 0.44857 0.49714 0.88224 0.50286 0.88224 0.44571 1.04090 0.55429 1.04168 "
+"0.45143 1.04437 9 0 2 6 0 6 8 7 3 5 4 5 3 2 "
+"0 1 10 7 9 10 8 6 10 6 7 9 7 5 "
+;
+
+char *VTK_VECTOR_TEXT_95 = (char *) "4 1.011860 "
+"0.11957 -0.37429 1.01186 -0.37429 0.11957 -0.28857 1.01186 -0.28857 2 2 1 3 2 0 1 "
+;
+
+char *VTK_VECTOR_TEXT_96 = (char *) "11 0.486571 "
+"0.38857 0.82420 0.48000 0.82420 0.48403 0.82571 0.37714 0.82989 0.38286 0.82575 "
+"0.48657 0.83143 0.21296 1.02571 0.38771 1.02571 0.21412 1.03143 0.38286 1.03106 "
+"0.37714 1.03295 9 5 1 2 0 3 4 3 10 6 0 1 5 7 "
+"3 0 8 6 10 7 0 5 3 7 10 10 7 9 "
+;
+
+char *VTK_VECTOR_TEXT_97 = (char *) "70 0.929303 "
+"0.44000 -0.09009 0.50286 -0.08966 0.36571 -0.07756 0.57143 -0.07907 0.92716 -0.07143 "
+"0.79429 -0.07106 0.92930 -0.06571 0.62857 -0.06151 0.30857 -0.05514 0.27429 -0.03258 "
+"0.68000 -0.03629 0.90748 -0.00857 0.48000 0.01580 0.53143 0.01621 0.42768 0.02571 "
+"0.76571 0.02129 0.22073 0.03143 0.61804 0.03714 0.89866 0.03714 0.37130 0.06000 "
+"0.20613 0.06571 0.68000 0.07330 0.34538 0.10000 0.71429 0.10809 0.19580 0.11714 "
+"0.89295 0.13429 0.33907 0.15714 0.74538 0.16857 0.20319 0.19714 0.36000 0.20914 "
+"0.75580 0.22000 0.40000 0.24371 0.22812 0.25429 0.44571 0.26041 0.66286 0.29891 "
+"0.28000 0.31258 0.75848 0.31714 0.75429 0.32399 0.33714 0.34657 0.38857 0.36538 "
+"0.68571 0.41320 0.75772 0.43714 0.35289 0.48286 0.22093 0.50000 0.22857 0.49470 "
+"0.89252 0.50571 0.75580 0.51143 0.22857 0.53547 0.37800 0.54571 0.74286 0.55301 "
+"0.88680 0.56286 0.71429 0.58893 0.41714 0.59330 0.42228 0.59714 0.25800 0.60286 "
+"0.42286 0.59759 0.65143 0.61959 0.48000 0.62193 0.86498 0.62571 0.53143 0.62950 "
+"0.59429 0.62950 0.28187 0.63714 0.84571 0.65486 0.33714 0.68436 0.80571 0.69007 "
+"0.37915 0.70571 0.72571 0.72538 0.45714 0.72966 0.54286 0.74152 0.62286 0.74152 70 "
+"3 13 1 5 4 15 4 11 15 19 8 "
+"2 13 3 7 13 0 1 14 0 12 "
+"20 22 24 0 14 2 12 0 13 13 7 "
+"17 11 4 6 19 2 14 17 10 21 "
+"7 10 17 11 18 15 16 22 20 8 19 "
+"9 15 23 21 15 21 10 23 25 27 "
+"9 19 16 19 22 16 23 15 25 24 26 "
+"28 27 25 30 25 15 18 30 25 36 "
+"32 28 26 26 24 22 29 32 26 39 38 "
+"31 38 35 29 32 29 35 31 38 29 "
+"39 34 40 33 39 31 39 33 34 36 41 "
+"37 40 37 41 37 40 34 41 36 25 "
+"41 45 46 43 44 47 47 48 54 48 47 "
+"44 50 49 46 41 25 45 50 46 45 "
+"42 48 44 49 64 51 52 53 55 52 65 "
+"63 65 52 55 52 61 48 52 63 61 "
+"58 49 50 49 58 62 69 60 56 49 62 "
+"64 54 48 61 57 67 65 57 65 55 "
+"51 66 56 69 59 60 66 51 64 68 67 "
+"57 59 69 57 69 68 57 69 56 66 "
+;
+
+char *VTK_VECTOR_TEXT_98 = (char *) "49 0.932518 "
+"0.61143 -0.09009 0.50286 -0.07823 0.36000 -0.07186 0.24000 -0.06878 0.72000 -0.06213 "
+"0.45714 -0.05914 0.77143 -0.03188 0.36571 0.01806 0.59429 0.02193 0.83543 0.02571 "
+"0.52000 0.02823 0.66857 0.04645 0.46857 0.05179 0.42704 0.08857 0.72956 0.10000 "
+"0.88784 0.10571 0.39216 0.14000 0.75641 0.14000 0.91470 0.18000 0.37462 0.19143 "
+"0.78665 0.23714 0.36152 0.28857 0.93252 0.29429 0.79236 0.36857 0.93252 0.37429 "
+"0.36420 0.38000 0.77294 0.47714 0.39216 0.50000 0.90899 0.50000 0.42473 0.55143 "
+"0.73143 0.55546 0.88657 0.55714 0.45883 0.58571 0.67429 0.60498 0.50857 0.61641 "
+"0.63429 0.62252 0.56571 0.62991 0.37714 0.64118 0.83429 0.63841 0.37315 0.64857 "
+"0.80571 0.66686 0.74286 0.70784 0.46857 0.71355 0.68571 0.72899 0.56571 0.74109 "
+"0.61714 0.74152 0.24265 1.02571 0.37143 1.02307 0.36571 1.02723 49 3 25 46 5 1 10 5 12 7 8 0 4 11 6 14 11 "
+"4 6 0 8 1 2 7 3 8 4 11 10 1 8 21 3 19 12 13 7 12 "
+"5 10 14 9 17 9 14 6 17 15 20 16 7 13 15 18 20 15 17 9 3 "
+"7 19 22 20 18 20 22 23 28 26 23 22 24 23 25 3 21 30 43 33 39 "
+"46 25 28 23 24 27 39 25 26 31 30 7 16 19 31 26 28 37 32 42 39 "
+"27 37 40 30 38 29 37 27 38 30 31 35 33 43 32 34 42 35 45 36 37 "
+"29 32 42 34 36 45 35 43 43 30 41 41 30 40 36 45 44 42 36 44 47 "
+"48 46 39 47 46 "
+;
+
+char *VTK_VECTOR_TEXT_99 = (char *) "58 0.894057 "
+"0.53143 -0.08966 0.59429 -0.08966 0.45714 -0.07673 0.68000 -0.07294 0.72571 -0.05343 "
+"0.37714 -0.04331 0.33714 -0.01543 0.78857 -0.01011 0.58286 0.02152 0.29143 0.03016 "
+"0.49625 0.03143 0.62857 0.03034 0.83107 0.03714 0.45714 0.04943 0.69270 0.06571 "
+"0.26241 0.07143 0.85714 0.07873 0.40457 0.09429 0.72722 0.10571 0.37629 0.14000 "
+"0.74437 0.14000 0.22899 0.14571 0.37184 0.15143 0.36930 0.15714 0.88571 0.15295 "
+"0.89406 0.19714 0.76571 0.21540 0.21034 0.22571 0.34705 0.25429 0.20420 0.36286 "
+"0.34478 0.36857 0.21673 0.45429 0.36252 0.47143 0.75429 0.47269 0.88058 0.48857 "
+"0.88319 0.49429 0.38371 0.52286 0.23849 0.52857 0.72000 0.55200 0.86437 0.55714 "
+"0.43025 0.58000 0.69714 0.58127 0.28527 0.61429 0.47429 0.60943 0.48571 0.61387 "
+"0.83473 0.61429 0.49143 0.61641 0.63429 0.62041 0.54857 0.62950 0.58857 0.62991 "
+"0.81296 0.64286 0.32168 0.65429 0.35429 0.67964 0.76571 0.68535 0.44571 0.72327 "
+"0.67429 0.72816 0.53714 0.74109 0.60000 0.74109 56 2 13 5 0 8 2 11 4 14 "
+"1 8 0 3 11 1 15 23 21 2 10 "
+"13 11 8 1 11 3 4 7 14 4 "
+"10 2 8 14 7 18 17 6 13 6 5 "
+"13 17 15 9 18 12 20 7 12 18 "
+"17 9 6 16 20 12 24 20 16 19 15 "
+"17 15 19 23 23 19 22 27 28 29 "
+"26 20 24 26 24 25 21 28 27 28 21 "
+"23 29 30 31 28 30 29 31 32 37 "
+"39 38 33 34 39 33 32 31 30 37 32 "
+"36 55 49 47 37 36 42 51 42 36 "
+"34 35 39 45 41 38 52 40 43 46 43 "
+"44 50 41 45 56 49 57 40 51 36 "
+"51 40 52 45 38 39 52 43 54 47 41 "
+"53 54 46 48 56 48 49 53 41 50 "
+"54 48 56 54 43 46 57 49 55 55 47 "
+"53 "
+;
+
+char *VTK_VECTOR_TEXT_100 = (char *) "48 0.885714 "
+"0.51429 -0.09009 0.56571 -0.08966 0.62857 -0.07673 0.76571 -0.07186 0.88571 -0.06878 "
+"0.41143 -0.06486 0.67429 -0.05641 0.36000 -0.03669 0.30286 0.01025 0.76000 0.01806 "
+"0.53714 0.02152 0.49714 0.02891 0.60571 0.02891 0.68127 0.07143 0.41714 0.07561 "
+"0.23787 0.10571 0.71579 0.11143 0.38241 0.11714 0.74135 0.16286 0.21395 0.16857 "
+"0.74286 0.16739 0.74538 0.17429 0.34605 0.20286 0.76420 0.27714 0.19277 0.28857 "
+"0.33295 0.28857 0.19277 0.36286 0.76152 0.38571 0.33563 0.39714 0.73355 0.50000 "
+"0.22135 0.51143 0.36784 0.51714 0.69714 0.55841 0.42286 0.58686 0.26857 0.60793 "
+"0.63429 0.60943 0.48571 0.62151 0.56571 0.62950 0.74857 0.64048 0.75269 0.64857 "
+"0.30857 0.65582 0.65714 0.71355 0.40571 0.71756 0.50286 0.74109 0.55429 0.74152 "
+"0.75693 1.02571 0.88571 1.02307 0.88000 1.02723 48 0 11 5 12 6 13 "
+"1 2 12 7 14 8 10 0 1 14 7 "
+"5 10 1 12 6 12 2 0 10 11 "
+"8 17 15 9 16 13 14 5 11 4 9 "
+"3 6 9 13 9 4 18 16 9 18 "
+"15 22 19 17 8 14 22 15 17 20 18 "
+"21 21 18 4 19 25 24 21 4 23 "
+"25 19 22 26 24 25 26 28 30 39 27 "
+"4 26 25 28 39 38 29 29 38 32 "
+"27 39 29 30 31 34 32 38 35 31 30 "
+"28 40 34 31 36 42 33 23 4 27 "
+"35 41 37 33 40 31 40 33 42 41 35 "
+"38 42 36 43 37 43 36 44 37 41 "
+"37 44 43 46 47 45 39 4 45 4 46 "
+"45 "
+;
+
+char *VTK_VECTOR_TEXT_101 = (char *) "65 0.934539 "
+"0.54857 -0.09009 0.61143 -0.09009 0.45714 -0.07462 0.71429 -0.07101 0.40571 -0.05641 "
+"0.77714 -0.04331 0.33714 -0.01543 0.82857 -0.00670 0.29714 0.02154 0.56000 0.02152 "
+"0.60571 0.02193 0.49714 0.03563 0.68159 0.04286 0.88150 0.05429 0.45714 0.05514 "
+"0.26286 0.06636 0.72000 0.06759 0.40457 0.10000 0.91216 0.11143 0.77229 0.13429 "
+"0.37057 0.15143 0.22034 0.15714 0.36613 0.16286 0.92834 0.16286 0.36359 0.16857 "
+"0.91429 0.16966 0.79429 0.18111 0.35177 0.20286 0.20462 0.22571 0.33866 0.28286 "
+"0.34286 0.28900 0.93454 0.29429 0.19848 0.35714 0.93295 0.39714 0.34857 0.40134 "
+"0.78857 0.40134 0.34134 0.40857 0.79580 0.40857 0.20462 0.41429 0.35429 0.47261 "
+"0.22327 0.49429 0.91429 0.48975 0.77143 0.50661 0.38857 0.54057 0.74857 0.54629 "
+"0.40725 0.56286 0.25714 0.57001 0.71429 0.58154 0.87070 0.58571 0.45143 0.59759 "
+"0.68000 0.60498 0.29296 0.62000 0.49143 0.61681 0.63429 0.62252 0.54857 0.62950 "
+"0.59429 0.62991 0.33311 0.66000 0.81143 0.65543 0.77143 0.68607 0.41143 0.70930 "
+"0.72000 0.71355 0.45714 0.72605 0.66857 0.73050 0.54286 0.74152 0.60000 0.74152 65 0 9 11 10 "
+"1 3 10 3 12 5 12 3 17 8 6 10 0 1 0 11 2 4 14 6 0 "
+"10 9 7 16 5 5 16 12 14 2 11 16 7 19 14 4 2 15 8 17 26 "
+"18 25 17 6 14 15 27 21 7 13 19 23 25 18 20 15 17 26 19 18 18 "
+"19 13 24 20 22 15 20 24 15 24 27 21 27 28 28 29 32 33 37 35 29 "
+"28 27 32 29 38 35 34 30 40 39 46 33 35 30 31 33 30 36 38 29 36 "
+"29 34 37 41 42 40 38 36 30 34 29 39 40 36 41 37 33 46 43 51 51 "
+"49 56 42 48 44 48 42 41 44 48 47 49 51 45 43 46 39 56 49 59 50 "
+"62 53 57 47 48 64 55 53 45 51 43 55 63 54 58 47 57 62 50 60 59 "
+"52 61 59 49 52 47 60 50 61 54 63 60 47 58 61 52 54 64 53 62 55 "
+"64 63 "
+;
+
+char *VTK_VECTOR_TEXT_102 = (char *) "24 0.617143 "
+"0.28000 -0.07186 0.40571 -0.07186 0.27472 0.61429 0.41100 0.61429 0.16571 0.61957 "
+"0.56000 0.61957 0.56420 0.71714 0.16571 0.72329 0.27472 0.72857 0.41100 0.72857 "
+"0.56000 0.72329 0.41034 0.83143 0.27580 0.86000 0.43429 0.89555 0.28613 0.91714 "
+"0.46286 0.91294 0.50286 0.92134 0.60000 0.91830 0.31107 0.96857 0.34286 1.00099 "
+"0.38857 1.02784 0.61714 1.03086 0.46286 1.04395 0.52571 1.04437 22 0 3 2 "
+"3 0 1 4 8 7 9 3 5 2 3 "
+"8 5 6 10 4 2 8 9 8 3 "
+"8 11 12 11 8 9 12 11 14 9 5 "
+"10 13 19 18 13 18 14 13 14 11 "
+"23 15 16 15 23 22 21 23 17 15 20 "
+"13 19 13 20 20 15 22 23 16 17 "
+;
+
+char *VTK_VECTOR_TEXT_103 = (char *) "71 0.892518 "
+"0.46857 -0.39295 0.56571 -0.39563 0.66286 -0.37959 0.35429 -0.36200 0.74286 -0.34616 "
+"0.28571 -0.31868 0.80368 -0.30000 0.50857 -0.28437 0.62286 -0.27395 0.44571 -0.27101 "
+"0.23387 -0.24286 0.84657 -0.24286 0.69200 -0.23714 0.38171 -0.23143 0.72150 -0.20286 "
+"0.87177 -0.18000 0.34916 -0.15714 0.74899 -0.14000 0.22286 -0.13957 0.50857 -0.07295 "
+"0.56000 -0.07295 0.43429 -0.05959 0.65143 -0.05070 0.37143 -0.03355 0.69714 -0.02527 "
+"0.89252 -0.00857 0.74857 0.01873 0.75042 0.02000 0.75756 0.02000 0.75429 0.02333 "
+"0.29143 0.03381 0.53143 0.03866 0.57143 0.03907 0.47429 0.05216 0.64000 0.05787 "
+"0.41714 0.08704 0.68000 0.08439 0.23216 0.12857 0.38036 0.12857 0.72784 0.14000 "
+"0.35277 0.18571 0.20530 0.20857 0.75538 0.20857 0.19320 0.28286 0.33295 0.29429 "
+"0.76991 0.35714 0.19277 0.37429 0.33563 0.40857 0.75109 0.47143 0.35109 0.47714 "
+"0.21143 0.47832 0.72784 0.52286 0.23787 0.55143 0.39044 0.55143 0.69868 0.56286 "
+"0.66286 0.59393 0.27107 0.60857 0.45143 0.60498 0.48571 0.62041 0.56571 0.62991 "
+"0.57714 0.62764 0.58286 0.62723 0.76571 0.63477 0.32000 0.66384 0.68571 0.70213 "
+"0.39429 0.71229 0.77408 0.72286 0.88878 0.72286 0.62857 0.72816 0.46857 0.73580 "
+"0.56000 0.74152 71 1 7 0 8 4 12 2 8 1 0 "
+"9 3 7 1 8 5 13 10 9 0 7 13 5 3 8 2 4 6 14 12 6 "
+"12 4 11 15 17 11 14 6 13 3 9 14 11 17 10 16 18 16 10 13 17 "
+"25 28 23 21 33 22 32 20 32 19 20 35 23 33 19 31 21 23 35 30 31 "
+"19 32 32 22 34 26 29 36 17 15 25 33 21 31 26 36 24 24 34 22 26 "
+"27 29 36 34 24 36 29 39 30 38 37 39 28 25 39 29 28 37 40 41 38 "
+"40 37 30 35 38 39 25 42 44 46 43 44 43 41 44 41 40 42 25 45 67 "
+"51 48 46 47 50 67 48 45 47 46 44 50 49 52 49 50 47 67 62 51 62 "
+"54 51 56 52 49 54 62 55 55 64 61 60 61 59 53 56 49 56 53 63 63 "
+"57 65 65 58 69 65 57 58 70 59 61 59 69 58 64 55 62 67 45 25 67 "
+"66 62 63 53 57 68 70 61 59 70 69 64 68 61 "
+;
+
+char *VTK_VECTOR_TEXT_104 = (char *) "27 0.889502 "
+"0.24571 -0.07186 0.37143 -0.07186 0.76000 -0.07186 0.88571 -0.07186 0.37605 0.40286 "
+"0.37756 0.40857 0.75538 0.46000 0.88950 0.47714 0.38899 0.48286 0.74538 0.51714 "
+"0.88152 0.54571 0.42439 0.55143 0.72000 0.56914 0.47429 0.59355 0.68000 0.60331 "
+"0.85996 0.61429 0.53143 0.61748 0.61143 0.62379 0.37714 0.63983 0.81714 0.67296 "
+"0.45714 0.70045 0.77714 0.70213 0.50857 0.72437 0.68571 0.73538 0.58857 0.74152 "
+"0.24571 1.02615 0.37143 1.02615 25 0 "
+"4 25 4 18 25 6 2 3 9 6 7 7 6 3 18 8 11 18 11 13 9 "
+"15 12 12 19 14 10 9 7 18 13 20 8 4 5 15 9 10 4 0 1 18 "
+"4 8 17 24 16 19 21 14 14 23 17 20 16 22 16 20 13 19 12 15 17 "
+"23 24 23 14 21 24 22 16 18 26 25 "
+;
+
+char *VTK_VECTOR_TEXT_105 = (char *) "8 0.377143 "
+"0.25143 -0.07186 0.37714 -0.07186 0.25143 0.72329 0.37714 0.72329 0.25143 0.87403 "
+"0.37714 0.87403 0.25143 1.02615 0.37714 1.02615 4 3 2 0 3 0 "
+"1 4 5 6 7 6 5 "
+;
+
+char *VTK_VECTOR_TEXT_106 = (char *) "18 0.375625 "
+"0.14857 -0.39563 0.22286 -0.39252 0.07383 -0.38000 0.26857 -0.37914 0.31429 -0.34989 "
+"0.34036 -0.31714 0.18857 -0.27462 0.10286 -0.26950 0.36109 -0.26571 0.22331 -0.24857 "
+"0.37563 -0.16857 0.24152 -0.16286 0.24571 0.72329 0.37143 0.72329 0.24571 0.87403 "
+"0.37143 0.87403 0.24571 1.02615 0.37143 1.02615 14 1 6 0 3 6 1 4 6 "
+"3 9 10 11 7 0 6 7 2 0 "
+"9 5 8 5 9 4 6 4 9 9 8 "
+"10 11 10 12 13 12 10 14 15 16 "
+"17 16 15 "
+;
+
+char *VTK_VECTOR_TEXT_107 = (char *) "15 0.897876 "
+"0.37450 -0.07143 0.89788 -0.07143 0.24571 -0.06878 0.73714 -0.07035 0.38004 0.24286 "
+"0.68421 0.25429 0.68045 0.26000 0.68000 0.26064 0.46857 0.32924 0.38286 0.40888 "
+"0.57152 0.42571 0.69714 0.72283 0.86359 0.72286 0.24836 1.02571 0.37714 1.02307 13 2 9 13 4 2 0 5 8 3 5 "
+"3 1 5 6 7 9 14 13 11 9 10 5 7 8 7 10 8 8 9 4 12 "
+"11 10 9 8 10 2 4 9 "
+;
+
+char *VTK_VECTOR_TEXT_108 = (char *) "4 0.371429 "
+"0.36878 -0.07143 0.24000 -0.06878 0.24265 1.02571 0.37143 1.02307 2 1 3 2 3 1 0 "
+;
+
+char *VTK_VECTOR_TEXT_109 = (char *) "45 1.318074 "
+"0.24571 -0.07186 0.37143 -0.07186 0.72000 -0.07295 1.18857 -0.07186 1.31429 -0.07186 "
+"0.71429 -0.06878 0.84571 -0.06878 0.37866 0.37429 0.84723 0.40286 0.85335 0.46000 "
+"0.39109 0.48286 0.71277 0.48286 1.18437 0.48286 1.31807 0.52286 0.87787 0.53429 "
+"0.41143 0.53493 1.17395 0.54000 0.43582 0.56857 0.68784 0.56857 1.14857 0.58403 "
+"0.93143 0.59188 0.66286 0.59829 0.82857 0.60801 0.51009 0.61429 0.36571 0.61924 "
+"0.63429 0.61470 1.09714 0.61580 1.29355 0.62000 0.56000 0.62420 1.00571 0.62152 "
+"1.06286 0.62379 0.41311 0.67143 0.78857 0.66975 1.25561 0.67714 0.90857 0.68902 "
+"0.74286 0.70784 1.20571 0.71355 0.35735 0.72286 0.24571 0.72329 0.50286 0.72498 "
+"0.99429 0.73109 1.16000 0.73109 0.67429 0.73470 0.57714 0.74109 1.05143 0.74152 43 6 5 2 0 7 38 8 11 5 7 0 1 8 5 6 12 3 4 12 "
+"13 16 9 11 8 15 17 24 11 22 18 22 20 34 11 9 22 14 22 9 13 "
+"12 4 24 17 31 7 10 38 10 15 24 16 27 19 32 21 18 24 37 38 20 "
+"22 14 10 24 38 27 16 13 31 23 39 26 41 30 30 40 29 32 18 22 41 "
+"19 36 34 29 40 19 41 26 36 19 33 23 31 17 35 21 32 29 34 20 39 "
+"28 43 33 19 27 43 28 42 25 42 28 28 39 23 42 25 21 42 21 35 44 "
+"30 41 30 44 40 "
+;
+
+char *VTK_VECTOR_TEXT_110 = (char *) "38 0.889911 "
+"0.24571 -0.07186 0.37143 -0.07186 0.75429 -0.07186 0.88571 -0.07186 0.24152 -0.06571 "
+"0.37563 -0.06571 0.75009 -0.06571 0.88991 -0.06571 0.37605 0.40286 0.37866 0.41429 "
+"0.38134 0.44857 0.74665 0.48286 0.88950 0.48286 0.39849 0.51143 0.73229 0.54000 "
+"0.88420 0.54000 0.43011 0.56286 0.46286 0.58893 0.69714 0.58725 0.87008 0.59143 "
+"0.51580 0.61429 0.65143 0.61343 0.36571 0.62031 0.56571 0.62420 0.60571 0.62379 "
+"0.61714 0.62152 0.62286 0.62109 0.83955 0.64857 0.40725 0.66571 0.79429 0.69179 "
+"0.45714 0.70213 0.24152 0.71714 0.75429 0.71355 0.35735 0.72286 0.24571 0.72329 "
+"0.52571 0.73050 0.68571 0.73538 0.58857 0.74152 36 1 4 0 "
+"3 6 2 1 5 4 3 7 6 6 12 "
+"11 11 15 14 6 7 12 22 16 28 "
+"10 8 9 13 22 10 10 22 8 8 4 "
+"5 15 11 12 8 22 4 14 15 19 "
+"14 19 18 25 26 24 16 22 13 16 17 "
+"28 30 28 17 27 18 19 32 23 24 "
+"29 18 27 30 20 35 18 32 21 31 4 "
+"22 20 30 17 32 26 21 32 24 26 "
+"32 18 29 34 31 33 33 31 22 35 23 "
+"37 23 35 20 36 23 32 37 23 36 "
+;
+
+char *VTK_VECTOR_TEXT_111 = (char *) "65 0.938661 "
+"0.53143 -0.08966 0.59429 -0.09009 0.69143 -0.07101 0.41143 -0.06213 0.76571 -0.03759 "
+"0.34857 -0.02821 0.81714 -0.00099 0.29143 0.02154 0.54286 0.02193 0.60571 0.02420 "
+"0.50857 0.02823 0.64571 0.03563 0.86331 0.04857 0.45143 0.05216 0.25714 0.06636 "
+"0.70857 0.07330 0.89229 0.09429 0.40000 0.09597 0.22771 0.12286 0.38036 0.12286 "
+"0.37714 0.12793 0.37669 0.12857 0.75473 0.12857 0.76657 0.15143 0.77101 0.16286 "
+"0.77355 0.16857 0.92319 0.18000 0.20764 0.18571 0.34816 0.19714 0.78605 0.20857 "
+"0.33563 0.26000 0.19320 0.28286 0.93823 0.28857 0.79848 0.29429 0.33295 0.36286 "
+"0.93866 0.37429 0.19580 0.39714 0.79538 0.39714 0.35277 0.47143 0.92319 0.47143 "
+"0.21184 0.48286 0.77143 0.48947 0.23216 0.54000 0.38742 0.54000 0.89927 0.54000 "
+"0.74286 0.54057 0.71429 0.57275 0.42286 0.57813 0.87678 0.58000 0.27429 0.60984 "
+"0.48571 0.61580 0.64571 0.61580 0.54286 0.62950 0.58857 0.62950 0.60000 0.62723 "
+"0.60571 0.62680 0.83225 0.63714 0.31025 0.64857 0.34857 0.67864 0.75429 0.69641 "
+"0.40000 0.70784 0.45143 0.72605 0.68571 0.72538 0.53714 0.74152 0.60000 0.74109 65 11 4 15 8 "
+"0 1 17 7 5 11 2 4 2 9 1 8 1 9 0 8 10 0 10 3 2 "
+"11 9 3 13 5 10 13 3 6 12 22 6 15 4 15 6 22 18 28 27 17 "
+"5 13 14 19 18 16 23 22 19 7 17 7 19 14 18 19 21 24 23 25 25 "
+"23 16 19 20 21 16 22 12 26 29 25 27 30 31 26 25 16 28 18 21 29 "
+"26 33 30 27 28 31 34 36 33 32 35 26 32 33 34 31 30 33 35 37 40 "
+"36 34 37 39 41 40 38 42 39 37 35 47 57 43 38 40 34 43 49 42 46 "
+"45 56 39 44 41 41 48 45 43 57 49 41 44 48 43 42 38 57 47 58 54 "
+"55 53 56 45 48 50 60 47 64 63 53 64 55 62 53 63 52 59 62 51 61 "
+"60 50 64 53 55 51 62 55 52 61 50 59 46 56 61 52 63 46 59 51 58 "
+"47 60 "
+;
+
+char *VTK_VECTOR_TEXT_112 = (char *) "49 0.935625 "
+"0.24571 -0.37740 0.37454 -0.37429 0.56000 -0.08966 0.66857 -0.07966 0.47429 -0.06657 "
+"0.75429 -0.04331 0.37584 -0.00286 0.80571 -0.00704 0.38286 0.00159 0.59429 0.02152 "
+"0.52000 0.02891 0.63429 0.02992 0.85964 0.05429 0.45143 0.06725 0.70857 0.07330 "
+"0.39787 0.13429 0.39514 0.14000 0.39216 0.14571 0.76213 0.14571 0.90538 0.14571 "
+"0.37462 0.19714 0.78327 0.20857 0.92680 0.22571 0.36379 0.27143 0.36152 0.28286 "
+"0.79580 0.29429 0.93563 0.30000 0.36379 0.36857 0.79580 0.36857 0.92680 0.43714 "
+"0.78286 0.45547 0.38286 0.47232 0.75429 0.52921 0.41714 0.54057 0.88571 0.56444 "
+"0.44571 0.57582 0.69143 0.59964 0.51429 0.62213 0.65143 0.62213 0.36571 0.63051 "
+"0.56571 0.63563 0.82704 0.64857 0.45714 0.70784 0.74857 0.70657 0.24571 0.72329 "
+"0.36000 0.72329 0.51429 0.73177 0.69143 0.72899 0.62286 0.74152 49 0 1 6 0 24 44 3 9 2 2 10 4 3 11 9 4 "
+"13 8 10 2 9 11 5 14 11 3 5 7 14 5 4 10 13 14 12 18 14 "
+"7 12 0 20 24 15 8 13 8 15 6 19 18 12 18 19 21 21 22 25 24 "
+"27 44 17 15 16 22 21 19 28 25 26 22 26 25 6 15 17 29 30 28 23 "
+"24 20 20 6 17 29 28 26 30 34 32 27 31 44 0 6 20 31 39 44 32 "
+"41 36 41 32 34 31 33 39 42 37 46 39 35 42 34 30 29 39 33 35 38 "
+"47 40 35 37 42 47 38 43 40 46 37 43 36 41 39 45 44 46 40 48 48 "
+"40 47 38 36 43 "
+;
+
+char *VTK_VECTOR_TEXT_113 = (char *) "52 0.885714 "
+"0.76000 -0.37740 0.88571 -0.37740 0.56571 -0.09009 0.45143 -0.07673 0.65143 -0.06784 "
+"0.36000 -0.03188 0.70857 -0.03465 0.75580 -0.00286 0.74857 0.00454 0.29714 0.02418 "
+"0.54286 0.02152 0.57714 0.02193 0.58857 0.02420 0.59429 0.02462 0.47429 0.03927 "
+"0.64571 0.04371 0.43302 0.06571 0.70670 0.09429 0.23914 0.11143 0.38607 0.11714 "
+"0.38286 0.12221 0.38241 0.12286 0.75008 0.17429 0.21101 0.19143 0.34748 0.20857 "
+"0.76723 0.25429 0.19848 0.26000 0.76723 0.27143 0.33605 0.28286 0.76991 0.28857 "
+"0.19580 0.37429 0.33866 0.40286 0.75429 0.45277 0.21101 0.47143 0.35429 0.47832 "
+"0.73143 0.51301 0.39846 0.56286 0.69296 0.56857 0.25669 0.58571 0.45143 0.60902 "
+"0.61714 0.62213 0.49143 0.62723 0.76571 0.62602 0.29330 0.63714 0.56571 0.63522 "
+"0.72403 0.67143 0.36571 0.69641 0.66286 0.71355 0.77408 0.72286 0.88571 0.72329 "
+"0.44571 0.72966 0.56000 0.74152 52 29 27 25 "
+"49 42 32 22 7 25 3 13 11 2 13 "
+"3 4 13 2 6 15 4 11 13 12 "
+"3 14 5 13 4 15 10 3 11 15 6 "
+"8 14 3 10 15 8 17 24 23 18 "
+"5 16 9 17 8 22 14 16 5 9 19 "
+"18 19 20 21 18 19 21 42 35 32 "
+"7 22 8 16 19 9 49 48 42 7 0 "
+"1 24 18 21 23 24 26 26 28 30 "
+"28 26 24 30 31 33 34 33 31 31 30 "
+"28 33 34 38 49 29 25 36 43 38 "
+"49 25 7 35 42 37 37 45 40 45 37 "
+"42 29 49 32 45 47 40 39 43 36 "
+"46 39 50 40 47 44 43 39 46 36 38 "
+"34 41 44 51 41 50 39 49 7 1 "
+"50 41 51 51 44 47 "
+;
+
+char *VTK_VECTOR_TEXT_114 = (char *) "24 0.667686 "
+"0.24571 -0.07186 0.37143 -0.07186 0.24152 -0.06571 0.37563 -0.06571 0.37563 0.38000 "
+"0.39748 0.50000 0.41964 0.54571 0.44740 0.57429 0.61714 0.57787 0.62286 0.57880 "
+"0.48000 0.59294 0.57714 0.59395 0.51429 0.60134 0.36571 0.61385 0.41868 0.68857 "
+"0.66769 0.69429 0.66542 0.70000 0.24152 0.71714 0.35735 0.72286 0.24571 0.72329 "
+"0.46286 0.72436 0.60000 0.73109 0.51429 0.74109 0.55429 0.74109 22 1 2 0 "
+"1 3 2 4 2 3 5 6 13 5 13 "
+"17 21 11 15 2 4 17 4 5 17 "
+"6 7 13 18 17 13 7 10 14 13 7 "
+"14 14 12 20 11 21 12 9 15 11 "
+"12 14 10 19 17 18 20 12 22 8 9 "
+"11 21 15 16 22 12 23 23 12 21 "
+;
+
+char *VTK_VECTOR_TEXT_115 = (char *) "63 0.849502 "
+"0.56000 -0.09009 0.46286 -0.08705 0.65143 -0.07395 0.37143 -0.06723 0.70444 -0.05429 "
+"0.33143 -0.04943 0.76057 -0.02000 0.28571 -0.01813 0.79582 0.01429 0.50286 0.02152 "
+"0.55429 0.02152 0.56571 0.02379 0.57714 0.02420 0.24571 0.02636 0.64000 0.04200 "
+"0.41714 0.04371 0.22200 0.06571 0.38286 0.06725 0.68384 0.07714 0.83580 0.08286 "
+"0.69927 0.10000 0.34200 0.12286 0.84950 0.14000 0.71009 0.15714 0.19109 0.16286 "
+"0.19370 0.16857 0.32000 0.18615 0.69864 0.19143 0.84723 0.20286 0.65714 0.22784 "
+"0.83641 0.24286 0.80956 0.28857 0.34286 0.32371 0.75429 0.33641 0.30286 0.34421 "
+"0.69143 0.36327 0.25714 0.38445 0.22645 0.43714 0.41143 0.44538 0.37587 0.46571 "
+"0.35885 0.48286 0.21295 0.49429 0.69143 0.50460 0.34478 0.51714 0.81977 0.52286 "
+"0.67514 0.55143 0.35216 0.56286 0.22034 0.56857 0.64000 0.59465 0.38286 0.59829 "
+"0.79429 0.61016 0.24000 0.61573 0.42857 0.62041 0.58286 0.62252 0.48571 0.62991 "
+"0.74689 0.67143 0.28571 0.67258 0.70286 0.70045 0.33714 0.70613 0.38857 0.72538 "
+"0.61714 0.73050 0.47429 0.74109 0.54286 0.74109 61 2 12 0 10 1 12 12 2 14 14 4 6 7 17 13 0 "
+"12 1 4 14 2 11 10 12 15 3 1 3 15 5 9 1 10 14 6 18 15 "
+"1 9 17 5 15 6 8 18 5 17 7 21 16 13 16 21 24 18 8 20 23 "
+"28 27 21 13 17 19 22 23 26 25 21 21 25 24 20 19 23 19 20 8 28 "
+"23 22 27 33 29 28 30 27 31 27 30 27 31 33 29 38 32 35 29 33 29 "
+"35 38 34 38 36 32 38 34 36 40 37 39 36 38 41 43 47 43 41 37 36 "
+"39 40 50 45 42 43 37 40 47 46 51 46 47 43 53 60 54 45 57 48 52 "
+"58 49 45 55 57 51 49 56 49 51 46 50 42 44 48 57 53 56 49 58 55 "
+"45 50 52 59 58 59 52 61 52 54 61 60 53 57 61 54 62 62 54 60 "
+;
+
+char *VTK_VECTOR_TEXT_116 = (char *) "24 0.551972 "
+"0.42286 -0.08395 0.48000 -0.08437 0.55197 -0.07143 0.33714 -0.05914 0.29901 -0.02571 "
+"0.28041 0.00857 0.44571 0.04816 0.44453 0.04857 0.53714 0.04344 0.44000 0.05008 "
+"0.41057 0.07714 0.26748 0.10000 0.40152 0.11714 0.26597 0.61429 0.40260 0.61429 "
+"0.17143 0.61957 0.53450 0.62000 0.53866 0.71714 0.53450 0.72286 0.17143 0.72329 "
+"0.26597 0.72857 0.40260 0.72857 0.26748 0.91714 0.40000 0.99545 22 10 5 4 "
+"6 7 9 10 4 3 10 3 9 8 6 "
+"1 6 9 1 5 10 11 8 1 2 "
+"0 9 3 11 12 13 0 1 9 10 12 "
+"11 17 18 16 14 13 12 21 14 16 "
+"18 21 16 22 20 23 20 13 14 15 20 "
+"19 15 13 20 20 14 21 23 20 21 "
+;
+
+char *VTK_VECTOR_TEXT_117 = (char *) "38 0.884197 "
+"0.48571 -0.09009 0.53714 -0.09009 0.41714 -0.07673 0.77143 -0.07295 0.88000 -0.07186 "
+"0.63518 -0.06571 0.76571 -0.06878 0.88420 -0.06571 0.34857 -0.04771 0.70857 -0.01846 "
+"0.29901 -0.00857 0.27429 0.02730 0.52000 0.02723 0.56000 0.02764 0.47339 0.03714 "
+"0.76000 0.03684 0.61714 0.04135 0.43943 0.05429 0.65143 0.05787 0.41330 0.07714 "
+"0.25143 0.08437 0.69143 0.08704 0.39343 0.10571 0.38899 0.11714 0.71473 0.11714 "
+"0.38645 0.12286 0.73294 0.15714 0.23848 0.17429 0.37563 0.17429 0.75009 0.26000 "
+"0.23848 0.71714 0.37295 0.71714 0.75009 0.71714 0.88420 0.71714 0.24265 0.72286 "
+"0.36878 0.72286 0.75429 0.72329 0.88000 0.72329 36 6 3 15 "
+"3 7 15 3 4 7 8 17 10 2 14 "
+"17 2 17 8 5 13 1 19 11 10 "
+"9 16 5 12 1 13 0 12 2 12 0 "
+"1 9 18 16 13 5 16 14 2 12 "
+"11 22 20 21 18 9 15 21 9 21 15 "
+"24 20 28 27 11 19 22 24 7 26 "
+"19 10 17 24 15 7 25 22 23 20 22 "
+"25 20 25 28 26 7 29 31 30 27 "
+"33 29 7 34 31 35 34 30 31 31 27 "
+"28 36 33 37 32 29 33 36 32 33 "
+;
+
+char *VTK_VECTOR_TEXT_118 = (char *) "12 0.884203 "
+"0.45714 -0.06947 0.58857 -0.07103 0.52000 0.09808 0.52571 0.09808 0.47580 0.23714 "
+"0.16151 0.71714 0.88420 0.71714 0.16427 0.72286 0.30286 0.71951 0.74857 0.72090 "
+"0.88145 0.72286 0.29714 0.72395 10 4 0 "
+"2 0 4 5 3 2 0 1 3 0 "
+"3 6 9 8 11 5 9 6 10 7 5 "
+"11 8 5 4 3 1 6 "
+;
+
+char *VTK_VECTOR_TEXT_119 = (char *) "14 1.231638 "
+"0.39429 -0.07215 0.52571 -0.07215 0.97714 -0.07252 0.84571 -0.06947 0.45714 0.10650 "
+"0.46286 0.10650 0.92000 0.12073 0.69143 0.52785 0.15122 0.72286 0.28571 0.72090 "
+"0.62857 0.72243 0.76193 0.72286 1.23164 0.72286 1.10857 0.72329 12 "
+"2 6 3 0 4 8 3 6 7 5 0 "
+"1 12 13 6 5 4 0 7 10 5 "
+"11 10 7 7 5 1 11 7 6 4 9 "
+"8 12 6 2 "
+;
+
+char *VTK_VECTOR_TEXT_120 = (char *) "17 0.882498 "
+"0.15697 -0.07143 0.88073 -0.07143 0.15473 -0.06571 0.31429 -0.07035 0.72571 -0.07140 "
+"0.88250 -0.06571 0.52000 0.22529 0.52571 0.22529 0.60332 0.33429 0.43534 0.34000 "
+"0.51429 0.45005 0.17188 0.71714 0.86812 0.71714 0.17412 0.72286 0.86588 0.72286 "
+"0.32571 0.72395 0.71429 0.72395 15 1 5 4 2 6 9 8 6 7 3 2 0 4 8 7 6 2 3 4 "
+"5 8 8 10 6 10 9 6 15 11 9 16 10 8 15 9 10 12 16 8 13 "
+"11 15 16 12 14 "
+;
+
+char *VTK_VECTOR_TEXT_121 = (char *) "16 0.888063 "
+"0.34286 -0.39563 0.24000 -0.38043 0.41714 -0.37641 0.45714 -0.34956 0.50436 -0.29429 "
+"0.32000 -0.26680 0.22286 -0.25766 0.36652 -0.25429 0.54371 -0.22000 0.41293 -0.21429 "
+"0.46848 -0.07714 0.53714 0.09292 0.16998 0.72286 0.30857 0.71999 0.76000 0.72246 "
+"0.88806 0.72286 14 2 7 0 0 5 1 5 0 7 "
+"6 1 5 3 7 2 7 3 9 3 4 "
+"9 9 8 10 9 4 8 10 11 12 "
+"11 15 14 11 8 15 11 10 8 11 13 "
+"12 "
+;
+
+char *VTK_VECTOR_TEXT_122 = (char *) "17 0.872768 "
+"0.17714 -0.07295 0.86857 -0.07186 0.17143 -0.06878 0.87277 -0.06571 0.17146 0.03714 "
+"0.34212 0.03714 0.87277 0.03714 0.34132 0.04286 0.44000 0.04327 0.86857 0.04329 "
+"0.20571 0.61689 0.67062 0.62000 0.84991 0.64286 0.20152 0.71714 0.84991 0.71714 "
+"0.20571 0.72329 0.84571 0.72329 15 2 0 4 0 1 9 0 5 4 1 3 9 5 0 8 5 7 4 0 "
+"9 8 3 6 9 12 14 11 11 14 16 11 16 10 12 11 7 11 4 7 10 "
+"15 13 15 10 16 "
+;
+
+char *VTK_VECTOR_TEXT_123 = (char *) "39 0.611429 "
+"0.61143 -0.39454 0.46857 -0.38420 0.40000 -0.34154 0.61143 -0.27975 0.35748 -0.27143 "
+"0.52000 -0.26992 0.47787 -0.23143 0.46748 -0.19143 0.34134 -0.18000 0.46395 0.04286 "
+"0.33563 0.05429 0.45184 0.14571 0.32109 0.16286 0.29143 0.21832 0.42286 0.22716 "
+"0.25143 0.24943 0.18857 0.26528 0.39429 0.26698 0.31413 0.32286 0.18857 0.38615 "
+"0.25143 0.40073 0.41188 0.40286 0.29143 0.42775 0.43514 0.44286 0.32823 0.49429 "
+"0.45866 0.52286 0.34134 0.60286 0.46705 0.80857 0.34478 0.84857 0.47748 0.87143 "
+"0.35748 0.91143 0.50286 0.90821 0.50793 0.91143 0.50857 0.91188 0.61143 0.92814 "
+"0.40571 0.99511 0.46857 1.03294 0.53143 1.04437 0.61143 1.04329 37 0 3 5 6 2 5 2 6 4 0 5 1 2 "
+"1 5 4 7 8 7 4 6 8 9 10 10 11 12 9 8 7 11 10 9 12 "
+"17 13 12 14 17 14 12 11 18 15 13 16 15 20 18 13 17 16 20 19 15 "
+"18 20 21 22 18 22 21 24 22 20 18 24 25 26 23 24 21 25 24 23 26 "
+"27 28 27 26 25 28 29 30 29 28 27 30 29 35 31 32 33 36 31 33 31 "
+"36 29 36 33 37 34 38 37 35 29 36 34 37 33 "
+;
+
+char *VTK_VECTOR_TEXT_124 = (char *) "4 0.388571 "
+"0.28571 -0.39454 0.38857 -0.39563 0.28571 1.04329 0.38857 1.04437 2 3 2 0 3 0 1 "
+;
+
+char *VTK_VECTOR_TEXT_125 = (char *) "35 0.606299 "
+"0.17714 -0.39454 0.31429 -0.38613 0.39429 -0.33832 0.17714 -0.27975 0.27429 -0.26784 "
+"0.43681 -0.26000 0.31070 -0.23714 0.44950 -0.19714 0.32723 -0.15714 0.45295 0.04857 "
+"0.33295 0.11714 0.46857 0.16404 0.35387 0.19714 0.51429 0.23258 0.56000 0.25681 "
+"0.39429 0.26403 0.60630 0.26571 0.47702 0.32857 0.41714 0.36742 0.60571 0.38615 "
+"0.54857 0.39927 0.50171 0.43143 0.36086 0.43714 0.46748 0.50000 0.32991 0.56857 "
+"0.45252 0.78571 0.32723 0.80286 0.31748 0.87143 0.29143 0.90893 0.43470 0.91714 "
+"0.17714 0.92814 0.41629 0.95714 0.36571 1.01107 0.32000 1.03294 0.17714 1.04329 33 4 3 0 2 4 1 6 7 8 1 4 0 2 6 4 5 "
+"6 2 6 5 7 8 9 10 9 8 7 10 11 12 15 13 17 11 10 9 12 "
+"11 15 13 14 17 13 15 11 20 17 14 20 14 16 19 20 16 21 17 20 17 "
+"21 18 22 23 24 22 18 21 23 22 21 25 26 24 25 24 23 29 27 26 29 "
+"26 25 27 31 28 31 27 29 32 28 31 28 33 30 33 34 30 33 28 32 "
+;
+
+char *VTK_VECTOR_TEXT_126 = (char *) "25 0.971429 "
+"0.73714 0.34462 0.20759 0.35143 0.21143 0.34662 0.81143 0.34723 0.66857 0.35756 "
+"0.86857 0.36135 0.25143 0.38115 0.90857 0.38086 0.52000 0.41580 0.32571 0.42723 "
+"0.97140 0.43143 0.37143 0.43866 0.42286 0.44093 0.79429 0.49009 0.21028 0.50000 "
+"0.72571 0.49681 0.86286 0.50930 0.25714 0.54115 0.92571 0.54759 0.32571 0.57470 "
+"0.50286 0.57621 0.96571 0.58154 0.97143 0.58073 0.38857 0.58680 0.44000 0.58723 23 1 17 14 8 4 15 13 5 7 6 1 2 5 "
+"13 3 1 6 17 3 13 0 16 10 18 15 4 0 13 7 16 15 0 13 8 "
+"20 12 12 20 11 9 17 6 10 16 7 17 9 19 22 21 18 11 20 24 11 "
+"19 9 20 8 15 11 24 23 22 18 10 11 23 19 "
+;
+
+
+/*! Construct object with no string set and backing enabled.*/
+VTKViewer_VectorText::VTKViewer_VectorText()
+{
+ this->Text = NULL;
+
+ this->Letters[33] = VTK_VECTOR_TEXT_33;
+ this->Letters[34] = VTK_VECTOR_TEXT_34;
+ this->Letters[35] = VTK_VECTOR_TEXT_35;
+ this->Letters[36] = VTK_VECTOR_TEXT_36;
+ this->Letters[37] = VTK_VECTOR_TEXT_37;
+ this->Letters[38] = VTK_VECTOR_TEXT_38;
+ this->Letters[39] = VTK_VECTOR_TEXT_39;
+ this->Letters[40] = VTK_VECTOR_TEXT_40;
+ this->Letters[41] = VTK_VECTOR_TEXT_41;
+ this->Letters[42] = VTK_VECTOR_TEXT_42;
+ this->Letters[43] = VTK_VECTOR_TEXT_43;
+ this->Letters[44] = VTK_VECTOR_TEXT_44;
+ this->Letters[45] = VTK_VECTOR_TEXT_45;
+ this->Letters[46] = VTK_VECTOR_TEXT_46;
+ this->Letters[47] = VTK_VECTOR_TEXT_47;
+ this->Letters[48] = VTK_VECTOR_TEXT_48;
+ this->Letters[49] = VTK_VECTOR_TEXT_49;
+ this->Letters[50] = VTK_VECTOR_TEXT_50;
+ this->Letters[51] = VTK_VECTOR_TEXT_51;
+ this->Letters[52] = VTK_VECTOR_TEXT_52;
+ this->Letters[53] = VTK_VECTOR_TEXT_53;
+ this->Letters[54] = VTK_VECTOR_TEXT_54;
+ this->Letters[55] = VTK_VECTOR_TEXT_55;
+ this->Letters[56] = VTK_VECTOR_TEXT_56;
+ this->Letters[57] = VTK_VECTOR_TEXT_57;
+ this->Letters[58] = VTK_VECTOR_TEXT_58;
+ this->Letters[59] = VTK_VECTOR_TEXT_59;
+ this->Letters[60] = VTK_VECTOR_TEXT_60;
+ this->Letters[61] = VTK_VECTOR_TEXT_61;
+ this->Letters[62] = VTK_VECTOR_TEXT_62;
+ this->Letters[63] = VTK_VECTOR_TEXT_63;
+ this->Letters[64] = VTK_VECTOR_TEXT_64;
+ this->Letters[65] = VTK_VECTOR_TEXT_65;
+ this->Letters[66] = VTK_VECTOR_TEXT_66;
+ this->Letters[67] = VTK_VECTOR_TEXT_67;
+ this->Letters[68] = VTK_VECTOR_TEXT_68;
+ this->Letters[69] = VTK_VECTOR_TEXT_69;
+ this->Letters[70] = VTK_VECTOR_TEXT_70;
+ this->Letters[71] = VTK_VECTOR_TEXT_71;
+ this->Letters[72] = VTK_VECTOR_TEXT_72;
+ this->Letters[73] = VTK_VECTOR_TEXT_73;
+ this->Letters[74] = VTK_VECTOR_TEXT_74;
+ this->Letters[75] = VTK_VECTOR_TEXT_75;
+ this->Letters[76] = VTK_VECTOR_TEXT_76;
+ this->Letters[77] = VTK_VECTOR_TEXT_77;
+ this->Letters[78] = VTK_VECTOR_TEXT_78;
+ this->Letters[79] = VTK_VECTOR_TEXT_79;
+ this->Letters[80] = VTK_VECTOR_TEXT_80;
+ this->Letters[81] = VTK_VECTOR_TEXT_81;
+ this->Letters[82] = VTK_VECTOR_TEXT_82;
+ this->Letters[83] = VTK_VECTOR_TEXT_83;
+ this->Letters[84] = VTK_VECTOR_TEXT_84;
+ this->Letters[85] = VTK_VECTOR_TEXT_85;
+ this->Letters[86] = VTK_VECTOR_TEXT_86;
+ this->Letters[87] = VTK_VECTOR_TEXT_87;
+ this->Letters[88] = VTK_VECTOR_TEXT_88;
+ this->Letters[89] = VTK_VECTOR_TEXT_89;
+ this->Letters[90] = VTK_VECTOR_TEXT_90;
+ this->Letters[91] = VTK_VECTOR_TEXT_91;
+ this->Letters[92] = VTK_VECTOR_TEXT_92;
+ this->Letters[93] = VTK_VECTOR_TEXT_93;
+ this->Letters[94] = VTK_VECTOR_TEXT_94;
+ this->Letters[95] = VTK_VECTOR_TEXT_95;
+ this->Letters[96] = VTK_VECTOR_TEXT_96;
+ this->Letters[97] = VTK_VECTOR_TEXT_97;
+ this->Letters[98] = VTK_VECTOR_TEXT_98;
+ this->Letters[99] = VTK_VECTOR_TEXT_99;
+ this->Letters[100] = VTK_VECTOR_TEXT_100;
+ this->Letters[101] = VTK_VECTOR_TEXT_101;
+ this->Letters[102] = VTK_VECTOR_TEXT_102;
+ this->Letters[103] = VTK_VECTOR_TEXT_103;
+ this->Letters[104] = VTK_VECTOR_TEXT_104;
+ this->Letters[105] = VTK_VECTOR_TEXT_105;
+ this->Letters[106] = VTK_VECTOR_TEXT_106;
+ this->Letters[107] = VTK_VECTOR_TEXT_107;
+ this->Letters[108] = VTK_VECTOR_TEXT_108;
+ this->Letters[109] = VTK_VECTOR_TEXT_109;
+ this->Letters[110] = VTK_VECTOR_TEXT_110;
+ this->Letters[111] = VTK_VECTOR_TEXT_111;
+ this->Letters[112] = VTK_VECTOR_TEXT_112;
+ this->Letters[113] = VTK_VECTOR_TEXT_113;
+ this->Letters[114] = VTK_VECTOR_TEXT_114;
+ this->Letters[115] = VTK_VECTOR_TEXT_115;
+ this->Letters[116] = VTK_VECTOR_TEXT_116;
+ this->Letters[117] = VTK_VECTOR_TEXT_117;
+ this->Letters[118] = VTK_VECTOR_TEXT_118;
+ this->Letters[119] = VTK_VECTOR_TEXT_119;
+ this->Letters[120] = VTK_VECTOR_TEXT_120;
+ this->Letters[121] = VTK_VECTOR_TEXT_121;
+ this->Letters[122] = VTK_VECTOR_TEXT_122;
+ this->Letters[123] = VTK_VECTOR_TEXT_123;
+ this->Letters[124] = VTK_VECTOR_TEXT_124;
+ this->Letters[125] = VTK_VECTOR_TEXT_125;
+ this->Letters[126] = VTK_VECTOR_TEXT_126;
+
+}
+
+/*!Calculate output.*/
+void VTKViewer_VectorText::Execute()
+{
+ vtkPolyData *output = this->GetOutput();
+ vtkPoints *newPoints;
+ vtkCellArray *newPolys;
+ int ptOffset = 0;
+ int aPoint, i;
+ int pos = 0;
+ float xpos = 0;
+ float ypos = 0;
+ int ptCount, triCount;
+ char *aLetter;
+ float width;
+ float ftmp[3];
+
+ if (this->Text == NULL)
+ {
+ vtkErrorMacro (<< "Text is not set!");
+ return;
+ }
+
+ // Set things up; allocate memory
+ newPoints = vtkPoints::New();
+ newPolys = vtkCellArray::New();
+ ftmp[2] = 0.0;
+
+ // Create Text
+ while (this->Text[pos])
+ {
+ switch (this->Text[pos])
+ {
+ case 32:
+ xpos += 0.4;
+ break;
+
+ case 10:
+ ypos -= 1.4;
+ xpos = 0;
+ break;
+
+ default:
+ // if we have a valid character
+ if ((this->Text[pos] > 32)&&(this->Text[pos] < 127))
+ {
+ // add the result to our output
+ aLetter = this->Letters[this->Text[pos]];
+ ptCount = strtol(aLetter,&aLetter,10);
+ width = strtod(aLetter,&aLetter);
+ for (i = 0; i < ptCount; i++)
+ {
+ ftmp[0] = strtod(aLetter,&aLetter);
+ ftmp[1] = strtod(aLetter,&aLetter);
+ ftmp[0] += xpos;
+ ftmp[1] += ypos;
+ newPoints->InsertNextPoint(ftmp);
+ }
+ triCount = strtol(aLetter,&aLetter,10);
+ for (i = 0; i < triCount; i++)
+ {
+ newPolys->InsertNextCell(3);
+ aPoint = strtol(aLetter,&aLetter,10);
+ newPolys->InsertCellPoint(aPoint + ptOffset);
+ aPoint = strtol(aLetter,&aLetter,10);
+ newPolys->InsertCellPoint(aPoint + ptOffset);
+ aPoint = strtol(aLetter,&aLetter,10);
+ newPolys->InsertCellPoint(aPoint + ptOffset);
+ }
+ ptOffset += ptCount;
+ xpos += width;
+ }
+ break;
+ }
+ pos++;
+ }
+
+ //
+ // Update ourselves and release memory
+ //
+ output->SetPoints(newPoints);
+ newPoints->Delete();
+
+ output->SetPolys(newPolys);
+ newPolys->Delete();
+}
+
+/*!
+ Print text to stream
+ \param os - stream
+ \param indent
+*/
+void VTKViewer_VectorText::PrintSelf(ostream& os, vtkIndent indent)
+{
+ this->Superclass::PrintSelf(os,indent);
+
+ os << indent << "Text: " << (this->Text ? this->Text : "(none)") << "\n";
+}
+
+/*!Destructor.*/
+VTKViewer_VectorText::~VTKViewer_VectorText()
+{
+ if (this->Text)
+ {
+ delete [] this->Text;
+ }
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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
+//
+/*=========================================================================
+
+ Program: Visualization Toolkit
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
+ All rights reserved.
+ See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notice for more information.*/
+
+// .NAME vtkVectorText - create polygonal text
+// .SECTION Description
+
+// vtkVectorText generates vtkPolyData from an input text string. Besides the
+// ASCII alphanumeric characters a-z, A-Z, 0-9, vtkVectorText also supports
+// ASCII punctuation marks. (The supported ASCII character set are the codes
+// (33-126) inclusive.) The only control character supported is the line feed
+// character "\n", which advances to a new line.
+//
+// To use thie class, you normally couple it with a vtkPolyDataMapper and a
+// vtkActor. In this case you would use the vtkActor's transformation methods
+// to position, orient, and scale the text. You may also wish to use a
+// vtkFollower to orient the text so that it always faces the camera.
+
+// .SECTION See Also
+// vtkTextMapper vtkCaptionActor2D
+
+// VTKViewer_VectorText.h is a copy of vtkVectorText.h file.
+// Purpose of copying: to remove linking to libHybrid.so VTK library
+
+#ifndef __VTKViewer_VectorText_h
+#define __VTKViewer_VectorText_h
+
+#include "vtkPolyDataSource.h"
+/*!Generates vtkPolyData from an input text string.
+ *@see vtkVectorText
+ */
+class VTKViewer_VectorText : public vtkPolyDataSource
+{
+public:
+ static VTKViewer_VectorText *New();
+ vtkTypeRevisionMacro(VTKViewer_VectorText,vtkPolyDataSource);
+ void PrintSelf(ostream& os, vtkIndent indent);
+
+ // Description:
+ // Set/Get the text to be drawn.
+ vtkSetStringMacro(Text);
+ vtkGetStringMacro(Text);
+
+protected:
+ VTKViewer_VectorText();
+ ~VTKViewer_VectorText();
+
+ //! Main method, which calculate output
+ virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+
+ char *Text;
+ char *Letters[127];
+
+};
+
+#endif
+
+
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 "VTKViewer_ViewManager.h"
+#include "VTKViewer_ViewModel.h"
+
+/*!Constructor.Initialize SIUT_ViewManager by \a study and \a theDesktop.
+ * Create new instance of VTKViewer_Viewer and set view model by it.
+ */
+VTKViewer_ViewManager::VTKViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* theDesktop )
+: SUIT_ViewManager( study, theDesktop, new VTKViewer_Viewer() )
+{
+ setTitle( tr( "VTK_VIEW_TITLE" ) );
+}
+
+/*!Destructor.*/
+VTKViewer_ViewManager::~VTKViewer_ViewManager()
+{
+ /*!Do nothing.*/
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 VTKVIEWER_VIEWMANAGER_H
+#define VTKVIEWER_VIEWMANAGER_H
+
+#include "VTKViewer.h"
+
+#include <SUIT_ViewManager.h>
+
+class SUIT_Desktop;
+
+/*!View manager.*/
+class VTKVIEWER_EXPORT VTKViewer_ViewManager : public SUIT_ViewManager
+{
+ Q_OBJECT
+
+public:
+ VTKViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* );
+ virtual ~VTKViewer_ViewManager();
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 "VTKViewer_ViewModel.h"
+#include "VTKViewer_ViewWindow.h"
+#include "VTKViewer_ViewManager.h"
+#include "VTKViewer_RenderWindowInteractor.h"
+
+#include "SUIT_ViewWindow.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
+
+#include <QColorDialog>
+#include <QMenu>
+#include <QMouseEvent>
+#include <QToolBar>
+
+bool _InitializeVtkWarningsCall()
+{
+ char* isOn = getenv( "VTK_WARNINGS_IS_ON" );
+ if ( !isOn || strcmp( isOn, "1" ) )
+ vtkObject::GlobalWarningDisplayOff();
+
+ delete isOn;
+ return vtkObject::GetGlobalWarningDisplay();
+}
+static bool _InitializeVtkWarnings = _InitializeVtkWarningsCall();
+
+/*!Constructor.Sets background color to black.*/
+VTKViewer_Viewer::VTKViewer_Viewer()
+: SUIT_ViewModel(),
+myBgColor( Qt::black )
+{
+}
+
+/*!Destructor.*/
+VTKViewer_Viewer::~VTKViewer_Viewer()
+{
+}
+
+/*!Gets background color.*/
+QColor VTKViewer_Viewer::backgroundColor() const
+{
+ return myBgColor;
+}
+
+/*!Sets background color.*/
+void VTKViewer_Viewer::setBackgroundColor( const QColor& c )
+{
+ if ( c.isValid() )
+ myBgColor = c;
+}
+
+/*!Create new instance of VTKViewer_ViewWindow, sets background color and return pointer to it.*/
+SUIT_ViewWindow* VTKViewer_Viewer::createView( SUIT_Desktop* theDesktop )
+{
+ VTKViewer_ViewWindow* vw = new VTKViewer_ViewWindow( theDesktop, this );
+ vw->setBackgroundColor( myBgColor );
+ return vw;
+}
+
+/*!Sets view manager and connect slots.*/
+void VTKViewer_Viewer::setViewManager(SUIT_ViewManager* theViewManager)
+{
+ SUIT_ViewModel::setViewManager(theViewManager);
+ connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)),
+ this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
+
+ connect(theViewManager, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)),
+ this, SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*)));
+
+ connect(theViewManager, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)),
+ this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
+}
+
+/*!Insert context into popup menu.*/
+void VTKViewer_Viewer::contextMenuPopup(QMenu* thePopup)
+{
+ thePopup->addAction( tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
+ thePopup->addAction( tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) );
+
+ thePopup->addSeparator();
+
+ VTKViewer_ViewWindow* aView = (VTKViewer_ViewWindow*)(myViewManager->getActiveView());
+ if ( aView && !aView->getToolBar()->isVisible() )
+ thePopup->addAction( tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
+}
+
+/*!On mouse press event.*/
+void VTKViewer_Viewer::onMousePress(SUIT_ViewWindow* vw, QMouseEvent* event)
+{
+ VTKViewer_RenderWindowInteractor* rwi = 0;
+ if ( vw && vw->inherits( "VTKViewer_ViewWindow" ) )
+ rwi = ((VTKViewer_ViewWindow*)vw)->getRWInteractor();
+ if ( !rwi )
+ return;
+
+ switch(event->buttons()) {
+ case Qt::LeftButton:
+ rwi->LeftButtonPressed(event) ;
+ break ;
+ case Qt::MidButton:
+ rwi->MiddleButtonPressed(event) ;
+ break ;
+ case Qt::RightButton:
+ rwi->RightButtonPressed(event) ;
+ break;
+ default:
+ break ;
+ }
+}
+
+/*!On mouse move event.*/
+void VTKViewer_Viewer::onMouseMove(SUIT_ViewWindow* vw, QMouseEvent* event)
+{
+ VTKViewer_RenderWindowInteractor* rwi = 0;
+ if ( vw && vw->inherits( "VTKViewer_ViewWindow" ) )
+ rwi = ((VTKViewer_ViewWindow*)vw)->getRWInteractor();
+ if ( rwi )
+ rwi->MouseMove( event );
+}
+
+/*!On mouse release event.*/
+void VTKViewer_Viewer::onMouseRelease(SUIT_ViewWindow* vw, QMouseEvent* event)
+{
+ VTKViewer_RenderWindowInteractor* rwi = 0;
+ if ( vw && vw->inherits( "VTKViewer_ViewWindow" ) )
+ rwi = ((VTKViewer_ViewWindow*)vw)->getRWInteractor();
+ if ( !rwi )
+ return;
+
+ switch(event->buttons()) {
+ case Qt::LeftButton:
+ rwi->LeftButtonReleased(event) ;
+ break ;
+ case Qt::MidButton:
+ rwi->MiddleButtonReleased(event) ;
+ break ;
+ case Qt::RightButton:
+ rwi->RightButtonReleased(event) ;
+ break;
+ default:
+ break ;
+ }
+}
+
+/*!Sets flag to enable selection \a isEnable.*/
+void VTKViewer_Viewer::enableSelection(bool isEnabled)
+{
+ mySelectionEnabled = isEnabled;
+ //!! To be done for view windows
+}
+
+/*!Sets flag to multi selection enable \a isEnable.*/
+void VTKViewer_Viewer::enableMultiselection(bool isEnable)
+{
+ myMultiSelectionEnabled = isEnable;
+ //!! To be done for view windows
+}
+
+/*!On dump view event.*/
+void VTKViewer_Viewer::onDumpView()
+{
+ VTKViewer_ViewWindow* aView = (VTKViewer_ViewWindow*)(myViewManager->getActiveView());
+ if ( aView )
+ aView->onDumpView();
+}
+
+/*!On change back ground color event.*/
+void VTKViewer_Viewer::onChangeBgColor()
+{
+ VTKViewer_ViewWindow* aView = (VTKViewer_ViewWindow*)(myViewManager->getActiveView());
+ if ( !aView )
+ return;
+
+ QColor aColor = QColorDialog::getColor( aView->backgroundColor(), aView);
+ if ( aColor.isValid() )
+ aView->setBackgroundColor(aColor);
+}
+
+/*!On show tool bar event.*/
+void VTKViewer_Viewer::onShowToolbar() {
+ VTKViewer_ViewWindow* aView = (VTKViewer_ViewWindow*)(myViewManager->getActiveView());
+ if ( aView )
+ aView->getToolBar()->show();
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 VTKVIEWER_VIEWMODEL_H
+#define VTKVIEWER_VIEWMODEL_H
+
+#include "VTKViewer.h"
+#include "SUIT_ViewModel.h"
+
+#include <QColor>
+
+class QMouseEvent;
+
+class SUIT_ViewWindow;
+class SUIT_Desktop;
+
+class VTKVIEWER_EXPORT VTKViewer_Viewer: public SUIT_ViewModel
+{
+ Q_OBJECT
+
+public:
+ /*!Initialize type of viewer.*/
+ static QString Type() { return "VTKViewer"; }
+
+ VTKViewer_Viewer();
+ virtual ~VTKViewer_Viewer();
+
+ virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
+
+ virtual void setViewManager(SUIT_ViewManager* theViewManager);
+ virtual void contextMenuPopup( QMenu* );
+ /*!Gets type of viewer.*/
+ virtual QString getType() const { return Type(); }
+
+public:
+ void enableSelection(bool isEnabled);
+ /*!Checks: is selection enabled*/
+ bool isSelectionEnabled() const { return mySelectionEnabled; }
+
+ void enableMultiselection(bool isEnable);
+ /*!Checks: is multi selection enabled*/
+ bool isMultiSelectionEnabled() const { return myMultiSelectionEnabled; }
+
+ int getSelectionCount() const;
+
+ QColor backgroundColor() const;
+ void setBackgroundColor( const QColor& );
+
+signals:
+ void selectionChanged();
+
+protected slots:
+ void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
+ void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
+ void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
+
+ void onDumpView();
+ void onShowToolbar();
+ void onChangeBgColor();
+
+private:
+ QColor myBgColor;
+ bool mySelectionEnabled;
+ bool myMultiSelectionEnabled;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 "VTKViewer_ViewWindow.h"
+#include "VTKViewer_ViewModel.h"
+#include "VTKViewer_RenderWindow.h"
+#include "VTKViewer_RenderWindowInteractor.h"
+#include "VTKViewer_InteractorStyle.h"
+#include "VTKViewer_Trihedron.h"
+#include "VTKViewer_Transform.h"
+#include "VTKViewer_Utilities.h"
+
+#include <SUIT_Session.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_Tools.h>
+#include <SUIT_ResourceMgr.h>
+
+#include <QImage>
+
+#include <vtkRenderer.h>
+#include <vtkCamera.h>
+
+#include <QtxToolBar.h>
+#include <QtxMultiAction.h>
+
+/*! Construction*/
+VTKViewer_ViewWindow::VTKViewer_ViewWindow( SUIT_Desktop* theDesktop,
+ VTKViewer_Viewer* theModel,
+ VTKViewer_InteractorStyle* iStyle,
+ VTKViewer_RenderWindowInteractor* rw )
+: SUIT_ViewWindow( theDesktop )
+{
+ myModel = theModel;
+
+ myTrihedron = VTKViewer_Trihedron::New();
+ myTransform = VTKViewer_Transform::New();
+ myRenderer = vtkRenderer::New() ;
+
+ myTrihedron->AddToRender( myRenderer );
+
+ myRenderWindow = new VTKViewer_RenderWindow( this, "RenderWindow" );
+ setCentralWidget(myRenderWindow);
+ myRenderWindow->setFocusPolicy( Qt::StrongFocus );
+ myRenderWindow->setFocus();
+
+ myRenderWindow->getRenderWindow()->AddRenderer( myRenderer );
+
+ myRenderer->GetActiveCamera()->ParallelProjectionOn();
+ myRenderer->LightFollowCameraOn();
+ myRenderer->TwoSidedLightingOn();
+
+ // Set BackgroundColor
+ QString BgrColorRed = "0";//SUIT_CONFIG->getSetting("VTKViewer:BackgroundColorRed");
+ QString BgrColorGreen = "0";//SUIT_CONFIG->getSetting("VTKViewer:BackgroundColorGreen");
+ QString BgrColorBlue = "0";//SUIT_CONFIG->getSetting("VTKViewer:BackgroundColorBlue");
+
+ if( !BgrColorRed.isEmpty() && !BgrColorGreen.isEmpty() && !BgrColorBlue.isEmpty() )
+ myRenderer->SetBackground( BgrColorRed.toInt()/255., BgrColorGreen.toInt()/255., BgrColorBlue.toInt()/255. );
+ else
+ myRenderer->SetBackground( 0, 0, 0 );
+
+ // Create an interactor.
+ myRWInteractor = rw ? rw : VTKViewer_RenderWindowInteractor::New();
+ myRWInteractor->SetRenderWindow( myRenderWindow->getRenderWindow() );
+
+ VTKViewer_InteractorStyle* RWS = iStyle ? iStyle : VTKViewer_InteractorStyle::New();
+ RWS->setGUIWindow( myRenderWindow );
+ myRWInteractor->SetInteractorStyle( RWS );
+
+ myRWInteractor->Initialize();
+ RWS->setTriedron( myTrihedron );
+ RWS->FindPokedRenderer( 0, 0 );
+
+ setCentralWidget( myRenderWindow );
+
+ myToolBar = new QtxToolBar( true, tr("LBL_TOOLBAR_LABEL"), this );
+
+ createActions();
+ createToolBar();
+
+ connect( myRenderWindow, SIGNAL(KeyPressed( QKeyEvent* )),
+ this, SLOT(onKeyPressed( QKeyEvent* )) );
+ connect( myRenderWindow, SIGNAL(KeyReleased( QKeyEvent* )),
+ this, SLOT(onKeyReleased( QKeyEvent* )) );
+ connect( myRenderWindow, SIGNAL(MouseButtonPressed( QMouseEvent* )),
+ this, SLOT(onMousePressed( QMouseEvent* )) );
+ connect( myRenderWindow, SIGNAL(MouseButtonReleased( QMouseEvent* )),
+ this, SLOT(onMouseReleased( QMouseEvent* )) );
+ connect( myRenderWindow, SIGNAL(MouseDoubleClicked( QMouseEvent* )),
+ this, SLOT(onMouseDoubleClicked( QMouseEvent* )) );
+ connect( myRenderWindow, SIGNAL(MouseMove( QMouseEvent* )),
+ this, SLOT(onMouseMoving( QMouseEvent* )) );
+ connect( myRWInteractor, SIGNAL(RenderWindowModified()),
+ myRenderWindow, SLOT(update()) );
+
+ connect( myRenderWindow, SIGNAL(contextMenuRequested( QContextMenuEvent * )),
+ this, SIGNAL(contextMenuRequested( QContextMenuEvent * )) );
+
+ connect( myRWInteractor, SIGNAL(contextMenuRequested( QContextMenuEvent * )),
+ this, SIGNAL(contextMenuRequested( QContextMenuEvent * )) );
+
+
+ onResetView();
+}
+
+/*!Destructor.*/
+VTKViewer_ViewWindow::~VTKViewer_ViewWindow()
+{
+ myTransform->Delete();
+ // In order to ensure that the interactor unregisters
+ // this RenderWindow, we assign a NULL RenderWindow to
+ // it before deleting it.
+ myRWInteractor->SetRenderWindow( NULL );
+ myRWInteractor->Delete();
+
+ //m_RW->Delete() ;
+ myRenderer->RemoveAllViewProps();
+ //m_Renderer->Delete() ;
+ myTrihedron->Delete();
+}
+
+/*!Checks: is trihedron displayed.*/
+bool VTKViewer_ViewWindow::isTrihedronDisplayed(){
+ return myTrihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
+}
+
+/*!Activates 'zooming' transformation*/
+void VTKViewer_ViewWindow::activateZoom()
+{
+ myRWInteractor->GetInteractorStyle()->startZoom();
+}
+
+/*!Activates 'panning' transformation*/
+void VTKViewer_ViewWindow::activatePanning()
+{
+ myRWInteractor->GetInteractorStyle()->startPan();
+}
+
+/*!Activates 'rotation' transformation*/
+void VTKViewer_ViewWindow::activateRotation()
+{
+ myRWInteractor->GetInteractorStyle()->startRotate();
+}
+
+/*!Activate global panning.*/
+void VTKViewer_ViewWindow::activateGlobalPanning()
+{
+ //if(myTrihedron->GetVisibleActorCount(myRenderer))
+ myRWInteractor->GetInteractorStyle()->startGlobalPan();
+}
+
+/*!Activates 'fit area' transformation*/
+void VTKViewer_ViewWindow::activateWindowFit()
+{
+ myRWInteractor->GetInteractorStyle()->startFitArea();
+}
+
+/*!Create actions:*/
+void VTKViewer_ViewWindow::createActions()
+{
+ if (!myActionsMap.isEmpty()) return;
+
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+
+ QtxAction* aAction;
+
+ //! \li Dump view
+ aAction = new QtxAction(tr("MNU_DUMP_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_DUMP" ) ),
+ tr( "MNU_DUMP_VIEW" ), 0, this);
+ aAction->setStatusTip(tr("DSC_DUMP_VIEW"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(onDumpView()));
+ myActionsMap[ DumpId ] = aAction;
+
+ //! \li FitAll
+ aAction = new QtxAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITALL" ) ),
+ tr( "MNU_FITALL" ), 0, this);
+ aAction->setStatusTip(tr("DSC_FITALL"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(onFitAll()));
+ myActionsMap[ FitAllId ] = aAction;
+
+ //! \li FitRect
+ aAction = new QtxAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITAREA" ) ),
+ tr( "MNU_FITRECT" ), 0, this);
+ aAction->setStatusTip(tr("DSC_FITRECT"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(activateWindowFit()));
+ myActionsMap[ FitRectId ] = aAction;
+
+ //! \li Zoom
+ aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ZOOM" ) ),
+ tr( "MNU_ZOOM_VIEW" ), 0, this);
+ aAction->setStatusTip(tr("DSC_ZOOM_VIEW"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(activateZoom()));
+ myActionsMap[ ZoomId ] = aAction;
+
+ //! \li Panning
+ aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_PAN" ) ),
+ tr( "MNU_PAN_VIEW" ), 0, this);
+ aAction->setStatusTip(tr("DSC_PAN_VIEW"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(activatePanning()));
+ myActionsMap[ PanId ] = aAction;
+
+ //! \li Global Panning
+ aAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_GLOBALPAN" ) ),
+ tr( "MNU_GLOBALPAN_VIEW" ), 0, this);
+ aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(activateGlobalPanning()));
+ myActionsMap[ GlobalPanId ] = aAction;
+
+ //! \li Rotation
+ aAction = new QtxAction(tr("MNU_ROTATE_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ROTATE" ) ),
+ tr( "MNU_ROTATE_VIEW" ), 0, this);
+ aAction->setStatusTip(tr("DSC_ROTATE_VIEW"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(activateRotation()));
+ myActionsMap[ RotationId ] = aAction;
+
+ //! \li Projections
+ aAction = new QtxAction(tr("MNU_FRONT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FRONT" ) ),
+ tr( "MNU_FRONT_VIEW" ), 0, this);
+ aAction->setStatusTip(tr("DSC_FRONT_VIEW"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(onFrontView()));
+ myActionsMap[ FrontId ] = aAction;
+
+ //! \li Back view
+ aAction = new QtxAction(tr("MNU_BACK_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BACK" ) ),
+ tr( "MNU_BACK_VIEW" ), 0, this);
+ aAction->setStatusTip(tr("DSC_BACK_VIEW"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(onBackView()));
+ myActionsMap[ BackId ] = aAction;
+
+ //! \li Top view
+ aAction = new QtxAction(tr("MNU_TOP_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TOP" ) ),
+ tr( "MNU_TOP_VIEW" ), 0, this);
+ aAction->setStatusTip(tr("DSC_TOP_VIEW"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(onTopView()));
+ myActionsMap[ TopId ] = aAction;
+
+ //! \li Bottom view
+ aAction = new QtxAction(tr("MNU_BOTTOM_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BOTTOM" ) ),
+ tr( "MNU_BOTTOM_VIEW" ), 0, this);
+ aAction->setStatusTip(tr("DSC_BOTTOM_VIEW"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(onBottomView()));
+ myActionsMap[ BottomId ] = aAction;
+
+ //! \li Left view
+ aAction = new QtxAction(tr("MNU_LEFT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_LEFT" ) ),
+ tr( "MNU_LEFT_VIEW" ), 0, this);
+ aAction->setStatusTip(tr("DSC_LEFT_VIEW"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(onLeftView()));
+ myActionsMap[ LeftId ] = aAction;
+
+ //! \li Right view
+ aAction = new QtxAction(tr("MNU_RIGHT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RIGHT" ) ),
+ tr( "MNU_RIGHT_VIEW" ), 0, this);
+ aAction->setStatusTip(tr("DSC_RIGHT_VIEW"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(onRightView()));
+ myActionsMap[ RightId ] = aAction;
+
+ //! \li Reset
+ aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RESET" ) ),
+ tr( "MNU_RESET_VIEW" ), 0, this);
+ aAction->setStatusTip(tr("DSC_RESET_VIEW"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(onResetView()));
+ myActionsMap[ ResetId ] = aAction;
+
+ //! \li Trihedron shown
+ aAction = new QtxAction(tr("MNU_SHOW_TRIHEDRON"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TRIHEDRON" ) ),
+ tr( "MNU_SHOW_TRIHEDRON" ), 0, this);
+ aAction->setStatusTip(tr("DSC_SHOW_TRIHEDRON"));
+ connect(aAction, SIGNAL(activated()), this, SLOT(onTrihedronShow()));
+ myActionsMap[ TrihedronShowId ] = aAction;
+}
+
+/*!Create tool bar.*/
+void VTKViewer_ViewWindow::createToolBar()
+{
+ myToolBar->addAction( myActionsMap[DumpId] );
+ myToolBar->addAction( myActionsMap[TrihedronShowId] );
+
+ QtxMultiAction* aScaleAction = new QtxMultiAction( this );
+ aScaleAction->insertAction( myActionsMap[FitAllId] );
+ aScaleAction->insertAction( myActionsMap[FitRectId] );
+ aScaleAction->insertAction( myActionsMap[ZoomId] );
+ myToolBar->addAction( aScaleAction );
+
+ QtxMultiAction* aPanningAction = new QtxMultiAction( this );
+ aPanningAction->insertAction( myActionsMap[PanId] );
+ aPanningAction->insertAction( myActionsMap[GlobalPanId] );
+ myToolBar->addAction( aPanningAction );
+
+ myToolBar->addAction( myActionsMap[RotationId] );
+
+ QtxMultiAction* aViewsAction = new QtxMultiAction(myToolBar);
+ aViewsAction->insertAction( myActionsMap[FrontId] );
+ aViewsAction->insertAction( myActionsMap[BackId] );
+ aViewsAction->insertAction( myActionsMap[TopId] );
+ aViewsAction->insertAction( myActionsMap[BottomId] );
+ aViewsAction->insertAction( myActionsMap[LeftId] );
+ aViewsAction->insertAction( myActionsMap[RightId] );
+ myToolBar->addAction( aViewsAction );
+
+ myToolBar->addAction( myActionsMap[ResetId] );
+}
+
+/*!On front view event.*/
+void VTKViewer_ViewWindow::onFrontView()
+{
+ vtkCamera* camera = myRenderer->GetActiveCamera();
+ camera->SetPosition(1,0,0);
+ camera->SetViewUp(0,0,1);
+ camera->SetFocalPoint(0,0,0);
+ onFitAll();
+}
+
+/*!On back view slot.*/
+void VTKViewer_ViewWindow::onBackView()
+{
+ vtkCamera* camera = myRenderer->GetActiveCamera();
+ camera->SetPosition(-1,0,0);
+ camera->SetViewUp(0,0,1);
+ camera->SetFocalPoint(0,0,0);
+ onFitAll();
+}
+
+/*!On back view slot.*/
+void VTKViewer_ViewWindow::onTopView()
+{
+ vtkCamera* camera = myRenderer->GetActiveCamera();
+ camera->SetPosition(0,0,1);
+ camera->SetViewUp(0,1,0);
+ camera->SetFocalPoint(0,0,0);
+ onFitAll();
+}
+
+/*!On bottom view slot.*/
+void VTKViewer_ViewWindow::onBottomView()
+{
+ vtkCamera* camera = myRenderer->GetActiveCamera();
+ camera->SetPosition(0,0,-1);
+ camera->SetViewUp(0,1,0);
+ camera->SetFocalPoint(0,0,0);
+ onFitAll();
+}
+
+/*!On left view slot.*/
+void VTKViewer_ViewWindow::onLeftView()
+{
+ vtkCamera* camera = myRenderer->GetActiveCamera();
+ camera->SetPosition(0,-1,0);
+ camera->SetViewUp(0,0,1);
+ camera->SetFocalPoint(0,0,0);
+ onFitAll();
+}
+
+/*!On right view slot.*/
+void VTKViewer_ViewWindow::onRightView()
+{
+ vtkCamera* camera = myRenderer->GetActiveCamera();
+ camera->SetPosition(0,1,0);
+ camera->SetViewUp(0,0,1);
+ camera->SetFocalPoint(0,0,0);
+ onFitAll();
+}
+
+/*!On reset view slot.*/
+void VTKViewer_ViewWindow::onResetView()
+{
+ int aTriedronIsVisible = isTrihedronDisplayed();
+ myTrihedron->SetVisibility( VTKViewer_Trihedron::eOnlyLineOn );
+ ::ResetCamera(myRenderer,true);
+ vtkCamera* aCamera = myRenderer->GetActiveCamera();
+ aCamera->SetPosition(1,-1,1);
+ aCamera->SetViewUp(0,0,1);
+ ::ResetCamera(myRenderer,true);
+ if(aTriedronIsVisible) myTrihedron->VisibilityOn();
+ else myTrihedron->VisibilityOff();
+ static vtkFloatingPointType aCoeff = 3.0;
+ aCamera->SetParallelScale(aCoeff*aCamera->GetParallelScale());
+ Repaint();
+}
+
+/*!On fit all slot.*/
+void VTKViewer_ViewWindow::onFitAll()
+{
+ myRWInteractor->GetInteractorStyle()->ViewFitAll();
+ Repaint();
+}
+
+/*!Set background of the viewport*/
+void VTKViewer_ViewWindow::setBackgroundColor( const QColor& color )
+{
+ if ( myRenderer )
+ myRenderer->SetBackground( color.red()/255., color.green()/255., color.blue()/255. );
+}
+
+/*!Returns background of the viewport*/
+QColor VTKViewer_ViewWindow::backgroundColor() const
+{
+ vtkFloatingPointType backint[3];
+ if ( myRenderer ) {
+ myRenderer->GetBackground( backint );
+ return QColor(int(backint[0]*255), int(backint[1]*255), int(backint[2]*255));
+ }
+ return palette().color( backgroundRole() );
+}
+
+/*!Repaint window. If \a theUpdateTrihedron is true - recalculate trihedron.*/
+void VTKViewer_ViewWindow::Repaint(bool theUpdateTrihedron)
+{
+ if (theUpdateTrihedron) onAdjustTrihedron();
+ myRenderWindow->update();
+}
+
+/*!Get scale of transformation filter.*/
+void VTKViewer_ViewWindow::GetScale( double theScale[3] ) {
+ myTransform->GetScale( theScale );
+}
+
+/*!Set scale of transformation filter and repaint window.*/
+void VTKViewer_ViewWindow::SetScale( double theScale[3] ) {
+ myTransform->SetMatrixScale( theScale[0], theScale[1], theScale[2] );
+ myRWInteractor->Render();
+ Repaint();
+}
+
+/*!Calculation trihedron size.*/
+void VTKViewer_ViewWindow::onAdjustTrihedron(){
+ if( !isTrihedronDisplayed() )
+ return;
+ int aVisibleNum = myTrihedron->GetVisibleActorCount(myRenderer);
+ if(aVisibleNum){
+ // calculating diagonal of visible props of the renderer
+ vtkFloatingPointType bnd[6];
+ myTrihedron->VisibilityOff();
+ ::ComputeVisiblePropBounds(myRenderer,bnd);
+ myTrihedron->VisibilityOn();
+ vtkFloatingPointType aLength = 0;
+ static bool CalcByDiag = false;
+ if(CalcByDiag){
+ aLength = sqrt((bnd[1]-bnd[0])*(bnd[1]-bnd[0])+
+ (bnd[3]-bnd[2])*(bnd[3]-bnd[2])+
+ (bnd[5]-bnd[4])*(bnd[5]-bnd[4]));
+ }else{
+ aLength = bnd[1]-bnd[0];
+ aLength = max((bnd[3]-bnd[2]),aLength);
+ aLength = max((bnd[5]-bnd[4]),aLength);
+ }
+
+ static vtkFloatingPointType aSizeInPercents = 105;
+ QString aSetting;// = SUIT_CONFIG->getSetting("Viewer:TrihedronSize");
+ if(!aSetting.isEmpty()) aSizeInPercents = aSetting.toFloat();
+
+ static vtkFloatingPointType EPS_SIZE = 5.0E-3;
+ vtkFloatingPointType aSize = myTrihedron->GetSize();
+ vtkFloatingPointType aNewSize = aLength*aSizeInPercents/100.0;
+ // if the new trihedron size have sufficient difference, then apply the value
+ if(fabs(aNewSize-aSize) > aSize*EPS_SIZE || fabs(aNewSize-aSize) > aNewSize*EPS_SIZE){
+ myTrihedron->SetSize(aNewSize);
+ }
+ }
+ ::ResetCameraClippingRange(myRenderer);
+}
+
+/*!Emit key pressed.*/
+void VTKViewer_ViewWindow::onKeyPressed(QKeyEvent* event)
+{
+ emit keyPressed( this, event );
+}
+
+/*!Emit key released.*/
+void VTKViewer_ViewWindow::onKeyReleased(QKeyEvent* event)
+{
+ emit keyReleased( this, event );
+}
+
+/*!Emit key pressed.*/
+void VTKViewer_ViewWindow::onMousePressed(QMouseEvent* event)
+{
+ emit mousePressed(this, event);
+}
+
+/*!Emit mouse released.*/
+void VTKViewer_ViewWindow::onMouseReleased(QMouseEvent* event)
+{
+ emit mouseReleased( this, event );
+}
+
+/*!Emit mouse moving.*/
+void VTKViewer_ViewWindow::onMouseMoving(QMouseEvent* event)
+{
+ emit mouseMoving( this, event );
+}
+
+/*!Emit mouse double clicked.*/
+void VTKViewer_ViewWindow::onMouseDoubleClicked( QMouseEvent* event )
+{
+ emit mouseDoubleClicked( this, event );
+}
+
+/*!Insert actor to renderer and transformation filter.
+ *Move Internal actors, if \a theMoveInternalActors is true.
+ */
+void VTKViewer_ViewWindow::InsertActor( VTKViewer_Actor* theActor, bool theMoveInternalActors ){
+ theActor->AddToRender(myRenderer);
+ theActor->SetTransform(myTransform);
+ if(theMoveInternalActors)
+ myRWInteractor->MoveInternalActors();
+}
+
+/*!Add actor.Repaint window if \a theUpdate is true.
+ *@see InsertActor( VTKViewer_Actor* theActor, bool theMoveInternalActors )
+ */
+void VTKViewer_ViewWindow::AddActor( VTKViewer_Actor* theActor, bool theUpdate /*=false*/ ){
+ InsertActor(theActor);
+ if(theUpdate)
+ Repaint();
+}
+
+/*!Remove \a theActor from renderer and pepaint, if \a theUpdate is true.*/
+void VTKViewer_ViewWindow::RemoveActor( VTKViewer_Actor* theActor, bool theUpdate /*=false*/ ){
+ theActor->RemoveFromRender(myRenderer);
+ if(theUpdate)
+ Repaint();
+}
+
+/*!@see RemoveActor() and InsertActor().*/
+void VTKViewer_ViewWindow::MoveActor( VTKViewer_Actor* theActor)
+{
+ RemoveActor(theActor);
+ InsertActor(theActor,true);
+}
+
+/*!On trihedron show slot.*/
+void VTKViewer_ViewWindow::onTrihedronShow()
+{
+ if (isTrihedronDisplayed())
+ myTrihedron->VisibilityOff();
+ else
+ myTrihedron->VisibilityOn();
+ myRenderWindow->update();
+}
+
+/*!Dump view.*/
+QImage VTKViewer_ViewWindow::dumpView()
+{
+ QPixmap px = QPixmap::grabWindow( myRenderWindow->winId() );
+ return px.toImage();
+}
+
+/*! The method returns the visual parameters of this view as a formated string
+ */
+QString VTKViewer_ViewWindow::getVisualParameters()
+{
+ double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];
+
+ vtkCamera* camera = myRenderer->GetActiveCamera();
+ camera->GetPosition( pos );
+ camera->GetFocalPoint( focalPnt );
+ camera->GetViewUp( viewUp );
+ parScale = camera->GetParallelScale();
+ GetScale( scale );
+
+ QString retStr;
+ retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e",
+ pos[0], pos[1], pos[2], focalPnt[0], focalPnt[1], focalPnt[2], viewUp[0], viewUp[1],
+ viewUp[2], parScale, scale[0], scale[1], scale[2] );
+ return retStr;
+}
+
+/*! The method restors visual parameters of this view from a formated string
+ */
+void VTKViewer_ViewWindow::setVisualParameters( const QString& parameters )
+{
+ QStringList paramsLst = parameters.split( '*' );
+ if ( paramsLst.size() == 13 ) {
+ double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];
+ pos[0] = paramsLst[0].toDouble();
+ pos[1] = paramsLst[1].toDouble();
+ pos[2] = paramsLst[2].toDouble();
+ focalPnt[0] = paramsLst[3].toDouble();
+ focalPnt[1] = paramsLst[4].toDouble();
+ focalPnt[2] = paramsLst[5].toDouble();
+ viewUp[0] = paramsLst[6].toDouble();
+ viewUp[1] = paramsLst[7].toDouble();
+ viewUp[2] = paramsLst[8].toDouble();
+ parScale = paramsLst[9].toDouble();
+ scale[0] = paramsLst[10].toDouble();
+ scale[1] = paramsLst[11].toDouble();
+ scale[2] = paramsLst[12].toDouble();
+
+ vtkCamera* camera = myRenderer->GetActiveCamera();
+ camera->SetPosition( pos );
+ camera->SetFocalPoint( focalPnt );
+ camera->SetViewUp( viewUp );
+ camera->SetParallelScale( parScale );
+ myTransform->SetMatrixScale( scale[0], scale[1], scale[2] );
+ myRWInteractor->Render();
+ }
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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 VTKVIEWER_VIEWWINDOW_H
+#define VTKVIEWER_VIEWWINDOW_H
+
+#include "VTKViewer.h"
+
+#include "SUIT_ViewWindow.h"
+
+#include "QtxAction.h"
+
+class vtkRenderer;
+class SUIT_Desktop;
+class VTKViewer_Viewer;
+class VTKViewer_Trihedron;
+class VTKViewer_Transform;
+class VTKViewer_RenderWindow;
+class VTKViewer_InteractorStyle;
+class VTKViewer_RenderWindowInteractor;
+class VTKViewer_Actor;
+
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
+class VTKVIEWER_EXPORT VTKViewer_ViewWindow : public SUIT_ViewWindow
+{
+ Q_OBJECT
+
+public:
+ VTKViewer_ViewWindow( SUIT_Desktop*, VTKViewer_Viewer*,
+ VTKViewer_InteractorStyle* = 0,
+ VTKViewer_RenderWindowInteractor* = 0 );
+ virtual ~VTKViewer_ViewWindow();
+
+ /*!Gets tool bar.*/
+ QToolBar* getToolBar() { return myToolBar; }
+
+ void setBackgroundColor( const QColor& );
+ QColor backgroundColor() const;
+
+ /*!Gets renderer.*/
+ vtkRenderer* getRenderer() { return myRenderer; }
+ /*!Gets render window.*/
+ VTKViewer_RenderWindow* getRenderWindow() { return myRenderWindow; }
+ /*!Gets render window interactor.*/
+ VTKViewer_RenderWindowInteractor* getRWInteractor() { return myRWInteractor; }
+ bool isTrihedronDisplayed();
+
+ void Repaint( bool theUpdateTrihedron = true );
+ void onAdjustTrihedron();
+ void GetScale( double theScale[3] );
+ void SetScale( double theScale[3] );
+ void AddActor( VTKViewer_Actor*, bool update = false );
+ void RemoveActor( VTKViewer_Actor*, bool update = false);
+
+ virtual QString getVisualParameters();
+ virtual void setVisualParameters( const QString& parameters );
+
+public slots:
+ void onFrontView();
+ void onBackView();
+ void onTopView();
+ void onBottomView();
+ void onLeftView();
+ void onRightView();
+ void onResetView();
+ void onFitAll();
+ void activateZoom();
+ void activateWindowFit();
+ void activateRotation();
+ void activatePanning();
+ void activateGlobalPanning();
+ void onTrihedronShow();
+
+protected:
+ QImage dumpView();
+
+protected slots:
+ void onKeyPressed(QKeyEvent* event);
+ void onKeyReleased(QKeyEvent* event);
+ void onMousePressed(QMouseEvent* event);
+ void onMouseDoubleClicked(QMouseEvent* event);
+ void onMouseReleased(QMouseEvent* event);
+ void onMouseMoving(QMouseEvent* event);
+
+private:
+ void InsertActor( VTKViewer_Actor* theActor,
+ bool theMoveInternalActors = false );
+ void MoveActor( VTKViewer_Actor* theActor );
+
+private:
+ enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId,
+ FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, TrihedronShowId };
+ typedef QMap<int, QtxAction*> ActionsMap;
+
+ void createActions();
+ void createToolBar();
+
+ VTKViewer_Viewer* myModel;
+
+ vtkRenderer* myRenderer;
+ VTKViewer_RenderWindow* myRenderWindow;
+ VTKViewer_RenderWindowInteractor* myRWInteractor;
+
+ VTKViewer_Trihedron* myTrihedron;
+ VTKViewer_Transform* myTransform;
+
+ QToolBar* myToolBar;
+ ActionsMap myActionsMap;
+
+ double myCurScale;
+
+ friend class VTKViewer_RenderWindowInteractor;
+};
+
+#ifdef WIN32
+#pragma warning( default:4251 )
+#endif
+
+#endif
msgid "ICON_VTKVIEWER_VIEW_RIGHT"
msgstr "view_right.png"
+msgid "ICON_VTKVIEWER_VIEW_ROTATION_POINT"
+msgstr "view_rotation_point.png"
+
msgid "ICON_VTKVIEWER_VIEW_ROTATE"
msgstr "view_rotate.png"
--- /dev/null
+<!DOCTYPE TS><TS>
+<context>
+ <name>@default</name>
+ <message>
+ <source>ICON_VTKVIEWER_VIEW_GLOBALPAN</source>
+ <translation>view_glpan.png</translation>
+ </message>
+ <message>
+ <source>ICON_VTKVIEWER_VIEW_FITAREA</source>
+ <translation>view_fitarea.png</translation>
+ </message>
+ <message>
+ <source>ICON_VTKVIEWER_VIEW_FRONT</source>
+ <translation>view_front.png</translation>
+ </message>
+ <message>
+ <source>ICON_VTKVIEWER_VIEW_RESET</source>
+ <translation>view_reset.png</translation>
+ </message>
+ <message>
+ <source>ICON_VTKVIEWER_VIEW_RIGHT</source>
+ <translation>view_right.png</translation>
+ </message>
+ <message>
+ <source>ICON_VTKVIEWER_VIEW_FITALL</source>
+ <translation>view_fitall.png</translation>
+ </message>
+ <message>
+ <source>ICON_VTKVIEWER_VIEW_BOTTOM</source>
+ <translation>view_bottom.png</translation>
+ </message>
+ <message>
+ <source>ICON_VTKVIEWER_VIEW_TOP</source>
+ <translation>view_top.png</translation>
+ </message>
+ <message>
+ <source>ICON_VTKVIEWER_VIEW_PAN</source>
+ <translation>view_pan.png</translation>
+ </message>
+ <message>
+ <source>ICON_VTKVIEWER_VIEW_ROTATE</source>
+ <translation>view_rotate.png</translation>
+ </message>
+ <message>
+ <source>ICON_VTKVIEWER_VIEW_ROTATION_POINT</source>
+ <translation>view_rotation_point.png</translation>
+ </message>
+ <message>
+ <source>ICON_VTKVIEWER_VIEW_DUMP</source>
+ <translation>view_camera_dump.png</translation>
+ </message>
+ <message>
+ <source>ICON_VTKVIEWER_VIEW_BACK</source>
+ <translation>view_back.png</translation>
+ </message>
+ <message>
+ <source>ICON_VTKVIEWER_VIEW_ZOOM</source>
+ <translation>view_zoom.png</translation>
+ </message>
+ <message>
+ <source>ICON_VTKVIEWER_VIEW_LEFT</source>
+ <translation>view_left.png</translation>
+ </message>
+ <message>
+ <source>ICON_VTKVIEWER_VIEW_TRIHEDRON</source>
+ <translation>view_triedre.png</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<!DOCTYPE TS><TS>
+<context>
+ <name>@default</name>
+ <message>
+ <source>MNU_FRONT_VIEW</source>
+ <translation>Front</translation>
+ </message>
+ <message>
+ <source>ERROR</source>
+ <translation>Error</translation>
+ </message>
+ <message>
+ <source>MNU_DUMP_VIEW</source>
+ <translation>Dump view...</translation>
+ </message>
+ <message>
+ <source>DSC_TOP_VIEW</source>
+ <translation>Top View</translation>
+ </message>
+ <message>
+ <source>MNU_PAN_VIEW</source>
+ <translation>Panning</translation>
+ </message>
+ <message>
+ <source>MNU_TOP_VIEW</source>
+ <translation>Top</translation>
+ </message>
+ <message>
+ <source>DSC_GLOBALPAN_VIEW</source>
+ <translation>Selection of a new center of the view</translation>
+ </message>
+ <message>
+ <source>DSC_ROTATE_VIEW</source>
+ <translation>Rotation of the point of view around the scene center</translation>
+ </message>
+ <message>
+ <source>MNU_ZOOM_VIEW</source>
+ <translation>Zoom</translation>
+ </message>
+ <message>
+ <source>DSC_PAN_VIEW</source>
+ <translation>Panning the view</translation>
+ </message>
+ <message>
+ <source>DSC_LEFT_VIEW</source>
+ <translation>Left View</translation>
+ </message>
+ <message>
+ <source>DSC_FITALL</source>
+ <translation>Fit all objects inside the view frame</translation>
+ </message>
+ <message>
+ <source>MNU_FITALL</source>
+ <translation>Fit All</translation>
+ </message>
+ <message>
+ <source>MNU_ROTATE_VIEW</source>
+ <translation>Rotation</translation>
+ </message>
+ <message>
+ <source>DSC_SHOW_TRIHEDRON</source>
+ <translation>Show/Hide trihedron in the current view</translation>
+ </message>
+ <message>
+ <source>DSC_FRONT_VIEW</source>
+ <translation>Front View</translation>
+ </message>
+ <message>
+ <source>MNU_GLOBALPAN_VIEW</source>
+ <translation>Global Panning</translation>
+ </message>
+ <message>
+ <source>INF_APP_DUMP_VIEW</source>
+ <translation>Dump view</translation>
+ </message>
+ <message>
+ <source>MNU_BACK_VIEW</source>
+ <translation>Back</translation>
+ </message>
+ <message>
+ <source>MNU_SHOW_TRIHEDRON</source>
+ <translation>Show/Hide trihedron</translation>
+ </message>
+ <message>
+ <source>MNU_BOTTOM_VIEW</source>
+ <translation>Bottom</translation>
+ </message>
+ <message>
+ <source>MNU_RESET_VIEW</source>
+ <translation>Reset</translation>
+ </message>
+ <message>
+ <source>MNU_LEFT_VIEW</source>
+ <translation>Left</translation>
+ </message>
+ <message>
+ <source>DSC_RIGHT_VIEW</source>
+ <translation>Right View</translation>
+ </message>
+ <message>
+ <source>DSC_FITRECT</source>
+ <translation>Fit area within the view frame</translation>
+ </message>
+ <message>
+ <source>MNU_FITRECT</source>
+ <translation>Fit Area</translation>
+ </message>
+ <message>
+ <source>DSC_BOTTOM_VIEW</source>
+ <translation>Bottom View</translation>
+ </message>
+ <message>
+ <source>DSC_DUMP_VIEW</source>
+ <translation>Saves the active view in the image file</translation>
+ </message>
+ <message>
+ <source>DSC_ZOOM_VIEW</source>
+ <translation>Zoom the view</translation>
+ </message>
+ <message>
+ <source>VTK_IMAGE_FILES</source>
+ <translation>Images Files (*.bmp *.png *.jpg *.jpeg)</translation>
+ </message>
+ <message>
+ <source>DSC_RESET_VIEW</source>
+ <translation>Reset View Point</translation>
+ </message>
+ <message>
+ <source>ERR_DOC_CANT_SAVE_FILE</source>
+ <translation>Cannot save file</translation>
+ </message>
+ <message>
+ <source>MNU_RIGHT_VIEW</source>
+ <translation>Right</translation>
+ </message>
+ <message>
+ <source>LBL_TOOLBAR_LABEL</source>
+ <translation>View Operations</translation>
+ </message>
+ <message>
+ <source>DSC_BACK_VIEW</source>
+ <translation>Back View</translation>
+ </message>
+</context>
+<context>
+ <name>VTKViewer_ViewManager</name>
+ <message>
+ <source>VTK_VIEW_TITLE</source>
+ <translation>VTK scene:%M - viewer:%V</translation>
+ </message>
+</context>
+<context>
+ <name>VTKViewer_Viewer</name>
+ <message>
+ <source>MEN_DUMP_VIEW</source>
+ <translation>Dump view...</translation>
+ </message>
+ <message>
+ <source>MEN_SHOW_TOOLBAR</source>
+ <translation>Show toolbar</translation>
+ </message>
+ <message>
+ <source>MEN_CHANGE_BACKGROUD</source>
+ <translation>Change background...</translation>
+ </message>
+</context>
+</TS>