<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9.00"
+ Version="9,00"
Name="Plot2d"
ProjectGUID="{D5E571BF-0C2E-4513-8BF0-A7A54E4EA973}"
TargetFrameworkVersion="131072"
/>
</FileConfiguration>
</File>
+ <File
+ RelativePath="..\..\src\Plot2d\Plot2d_SetupCommentsDlg.h"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generate moc_$(InputName).cxx..."
+ CommandLine="type $(InputPath) > $(GUI_SRC_DIR)\$(ConfigurationName)32\include\$(InputFileName)
$(QTDIR)\bin\moc.exe $(InputPath) -o ..\..\moc\moc_$(InputName).cxx
"
+ Outputs="$(GUI_SRC_DIR)\$(ConfigurationName)32\include\$(InputFileName);..\..\moc\moc_$(InputName).cxx"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generate moc_$(InputName).cxx..."
+ CommandLine="type $(InputPath) > $(GUI_SRC_DIR)\$(ConfigurationName)64\include\$(InputFileName)
$(QTDIR)\bin\moc.exe $(InputPath) -o ..\..\moc\moc_$(InputName).cxx
"
+ Outputs="$(GUI_SRC_DIR)\$(ConfigurationName)64\include\$(InputFileName);..\..\moc\moc_$(InputName).cxx"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generate moc_$(InputName).cxx..."
+ CommandLine="type $(InputPath) > $(GUI_SRC_DIR)\$(ConfigurationName)32\include\$(InputFileName)
$(QTDIR)\bin\moc.exe $(InputPath) -o ..\..\moc\moc_$(InputName).cxx
"
+ Outputs="$(GUI_SRC_DIR)\$(ConfigurationName)32\include\$(InputFileName);..\..\moc\moc_$(InputName).cxx"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generate moc_$(InputName).cxx..."
+ CommandLine="type $(InputPath) > $(GUI_SRC_DIR)\$(ConfigurationName)64\include\$(InputFileName)
$(QTDIR)\bin\moc.exe $(InputPath) -o ..\..\moc\moc_$(InputName).cxx
"
+ Outputs="$(GUI_SRC_DIR)\$(ConfigurationName)64\include\$(InputFileName);..\..\moc\moc_$(InputName).cxx"
+ />
+ </FileConfiguration>
+ </File>
<File
RelativePath="..\..\src\Plot2d\Plot2d_SetupCurveDlg.h"
>
/>
</FileConfiguration>
</File>
+ <File
+ RelativePath="..\..\src\Plot2d\Plot2d_TextMarker.h"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Update $(InputFileName)..."
+ CommandLine="type $(InputPath) > $(GUI_SRC_DIR)\$(ConfigurationName)32\include\$(InputFileName)
"
+ Outputs="$(GUI_SRC_DIR)\$(ConfigurationName)32\include\$(InputFileName)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="type $(InputPath) > $(GUI_SRC_DIR)\$(ConfigurationName)64\include\$(InputFileName)
"
+ Outputs="$(GUI_SRC_DIR)\$(ConfigurationName)64\include\$(InputFileName)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Update $(InputFileName)..."
+ CommandLine="type $(InputPath) > $(GUI_SRC_DIR)\$(ConfigurationName)32\include\$(InputFileName)
"
+ Outputs="$(GUI_SRC_DIR)\$(ConfigurationName)32\include\$(InputFileName)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="type $(InputPath) > $(GUI_SRC_DIR)\$(ConfigurationName)64\include\$(InputFileName)
"
+ Outputs="$(GUI_SRC_DIR)\$(ConfigurationName)64\include\$(InputFileName)"
+ />
+ </FileConfiguration>
+ </File>
<File
RelativePath="..\..\src\Plot2d\Plot2d_ToolTip.h"
>
>
<Tool
Name="VCCustomBuildTool"
- Description="Generate moc_$(InputName).cxx..."
+ Description="Update $(InputFileName)..."
CommandLine="type $(InputPath) > $(GUI_SRC_DIR)\$(ConfigurationName)64\include\$(InputFileName)
$(QTDIR)\bin\moc.exe $(InputPath) -o ..\..\moc\moc_$(InputName).cxx
"
Outputs="$(GUI_SRC_DIR)\$(ConfigurationName)64\include\$(InputFileName);..\..\moc\moc_$(InputName).cxx"
/>
>
<Tool
Name="VCCustomBuildTool"
- Description="Generate moc_$(InputName).cxx..."
+ Description="Update $(InputFileName)..."
CommandLine="type $(InputPath) > $(GUI_SRC_DIR)\$(ConfigurationName)64\include\$(InputFileName)
$(QTDIR)\bin\moc.exe $(InputPath) -o ..\..\moc\moc_$(InputName).cxx
"
Outputs="$(GUI_SRC_DIR)\$(ConfigurationName)64\include\$(InputFileName);..\..\moc\moc_$(InputName).cxx"
/>
RelativePath="..\..\src\Plot2d\Plot2d_Prs.cxx"
>
</File>
+ <File
+ RelativePath="..\..\src\Plot2d\Plot2d_SetupCommentsDlg.cxx"
+ >
+ </File>
<File
RelativePath="..\..\src\Plot2d\Plot2d_SetupCurveDlg.cxx"
>
RelativePath="..\..\src\Plot2d\Plot2d_SetupViewDlg.cxx"
>
</File>
+ <File
+ RelativePath="..\..\src\Plot2d\Plot2d_TextMarker.cxx"
+ >
+ </File>
<File
RelativePath="..\..\src\Plot2d\Plot2d_ToolTip.cxx"
>
/>
</FileConfiguration>
</File>
+ <File
+ RelativePath="..\..\src\Plot2d\resources\plot2d_comments_settings.png"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Update $(InputFileName)..."
+ CommandLine="type $(InputPath) > ..\..\$(ConfigurationName)32\share\salome\resources\gui\$(InputFileName)
"
+ Outputs="..\..\$(ConfigurationName)32\share\salome\resources\gui\$(InputFileName)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Update $(InputFileName)..."
+ CommandLine="type $(InputPath) > ..\..\$(ConfigurationName)64\share\salome\resources\gui\$(InputFileName)
"
+ Outputs="..\..\$(ConfigurationName)64\share\salome\resources\gui\$(InputFileName)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Update $(InputFileName)..."
+ CommandLine="type $(InputPath) > ..\..\$(ConfigurationName)32\share\salome\resources\gui\$(InputFileName)
"
+ Outputs="..\..\$(ConfigurationName)32\share\salome\resources\gui\$(InputFileName)"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Update $(InputFileName)..."
+ CommandLine="type $(InputPath) > ..\..\$(ConfigurationName)64\share\salome\resources\gui\$(InputFileName)
"
+ Outputs="..\..\$(ConfigurationName)64\share\salome\resources\gui\$(InputFileName)"
+ />
+ </FileConfiguration>
+ </File>
<File
RelativePath="..\..\src\Plot2d\resources\plot2d_curves_settings.png"
>
RelativePath="..\..\moc\moc_Plot2d_FitDataDlg.cxx"
>
</File>
+ <File
+ RelativePath="..\..\moc\moc_Plot2d_SetupCommentsDlg.cxx"
+ >
+ </File>
<File
RelativePath="..\..\moc\moc_Plot2d_SetupCurveDlg.cxx"
>
--- /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
+//
+// SALOME Plot2d : implementation of desktop and GUI kernel
+//
+#include "Plot2d_SetupCommentsDlg.h"
+
+#include <QtxGroupBox.h>
+
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+
+#include <QComboBox>
+#include <QHeaderView>
+#include <QItemDelegate>
+#include <QLayout>
+#include <QLineEdit>
+#include <QTableWidget>
+#include <QToolButton>
+
+#define TEXT_COL 0
+#define X_COL 1
+#define Y_COL 2
+#define ALIGNMENT_COL 3
+
+//=============================================================================
+// Class : Plot2d_SetupCommentsDlg::ItemDelegate
+// Purpose :
+//=============================================================================
+class Plot2d_SetupCommentsDlg::ItemDelegate : public QItemDelegate
+{
+public:
+ ItemDelegate( QObject* theParent, QValidator* theValidator )
+ : myValidator( theValidator ) {}
+
+public:
+ virtual QWidget* createEditor( QWidget* theParent,
+ const QStyleOptionViewItem& theOption,
+ const QModelIndex& ) const
+ {
+ QLineEdit* aLineEdit = new QLineEdit( theParent );
+ aLineEdit->setValidator( myValidator );
+ return aLineEdit;
+ }
+
+private:
+ QValidator* myValidator;
+};
+
+//=============================================================================
+// Function : Plot2d_SetupCommentsDlg
+// Purpose : Constructor
+//=============================================================================
+Plot2d_SetupCommentsDlg::Plot2d_SetupCommentsDlg( QWidget* theParent )
+: QtxDialog( theParent, true, false, QtxDialog::OKCancel )
+{
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ setWindowTitle( tr( "SETUP_COMMENTS" ) );
+
+ QValidator* aDoubleValidator = new QDoubleValidator( this );
+
+ QFrame* aMainFrame = mainFrame();
+
+ QtxGroupBox* aGrp = new QtxGroupBox( aMainFrame );
+ aGrp->setTitle( tr( "PARAMETERS" ) );
+
+ myTable = new QTableWidget( aGrp );
+ myTable->setSelectionMode( QTableWidget::ExtendedSelection );
+
+ myTable->setRowCount( 0 );
+ myTable->setColumnCount( 4 );
+
+ QStringList aLabels = QStringList() << tr( "TEXT" ) << tr( "X" ) << tr( "Y" ) << tr( "ALIGNMENT" );
+ myTable->setHorizontalHeaderLabels( aLabels );
+
+ myTable->horizontalHeader()->setResizeMode( TEXT_COL, QHeaderView::Stretch );
+ myTable->horizontalHeader()->setResizeMode( X_COL, QHeaderView::Fixed );
+ myTable->horizontalHeader()->setResizeMode( Y_COL, QHeaderView::Fixed );
+ myTable->horizontalHeader()->setResizeMode( ALIGNMENT_COL, QHeaderView::Fixed );
+ myTable->horizontalHeader()->setHighlightSections( false );
+
+ myTable->setColumnWidth( X_COL, 80 );
+ myTable->setColumnWidth( Y_COL, 80 );
+ myTable->setColumnWidth( ALIGNMENT_COL, 100 );
+
+ myTable->verticalHeader()->setDefaultSectionSize( 20 );
+ myTable->verticalHeader()->hide();
+
+ myTable->setItemDelegateForColumn( X_COL, new ItemDelegate( myTable, aDoubleValidator ) );
+ myTable->setItemDelegateForColumn( Y_COL, new ItemDelegate( myTable, aDoubleValidator ) );
+
+ QPixmap aRemovePixmap = aResMgr->loadPixmap( "Plot2d", tr( "ICON_MINUS" ) );
+ QToolButton* aRemoveBtn = new QToolButton( aGrp );
+ aRemoveBtn->setIcon( aRemovePixmap );
+ aRemoveBtn->setFixedSize( aRemovePixmap.size() );
+ aGrp->insertTitleWidget( aRemoveBtn );
+
+ QVBoxLayout* aGrpLayout = new QVBoxLayout( aGrp );
+ aGrpLayout->setMargin( 5 );
+ aGrpLayout->setSpacing( 5 );
+ aGrpLayout->addWidget( myTable );
+
+ QVBoxLayout* aMainLayout = new QVBoxLayout( aMainFrame );
+ aMainLayout->setMargin( 0 );
+ aMainLayout->setSpacing( 0 );
+ aMainLayout->addWidget( aGrp );
+
+ connect( myTable, SIGNAL( cellChanged( int, int ) ), SLOT( onValueChanged( int, int ) ) );
+ connect( aRemoveBtn, SIGNAL( clicked() ), SLOT( onRemove() ) );
+
+ setButtonPosition( Right, Cancel );
+
+ setMinimumSize( 500, 300 );
+}
+
+//=============================================================================
+// Function : Plot2d_SetupCommentsDlg
+// Purpose : Destructor
+//=============================================================================
+Plot2d_SetupCommentsDlg::~Plot2d_SetupCommentsDlg()
+{
+}
+
+//=============================================================================
+// Function : getAlignments
+// Purpose :
+//=============================================================================
+void Plot2d_SetupCommentsDlg::getAlignments( QStringList& theStrings,
+ QList< Qt::Alignment >& theValues ) const
+{
+ static QStringList aStrings;
+ static QList< Qt::Alignment > aValues;
+ if( aStrings.isEmpty() && aValues.isEmpty() )
+ {
+ aStrings.append( tr( "TOP_LEFT" ) );
+ aValues.append( Qt::AlignTop | Qt::AlignLeft );
+
+ aStrings.append( tr( "TOP_RIGHT" ) );
+ aValues.append( Qt::AlignTop | Qt::AlignRight );
+
+ aStrings.append( tr( "BOTTOM_LEFT" ) );
+ aValues.append( Qt::AlignBottom | Qt::AlignLeft );
+
+ aStrings.append( tr( "BOTTOM_RIGHT" ) );
+ aValues.append( Qt::AlignBottom | Qt::AlignRight );
+
+ aStrings.append( tr( "CENTER" ) );
+ aValues.append( Qt::AlignCenter );
+ }
+ theStrings = aStrings;
+ theValues = aValues;
+}
+
+//=============================================================================
+// Function : setCombo
+// Purpose :
+//=============================================================================
+void Plot2d_SetupCommentsDlg::setCombo( const int theRow,
+ const int theCol,
+ const QStringList& theStrings,
+ const QList< Qt::Alignment >& theValues,
+ const Qt::Alignment theCurrentValue )
+{
+ QComboBox* aCombo = new QComboBox( myTable );
+
+ int anIndex = 0;
+ QStringListIterator aStringIter( theStrings );
+ QListIterator< Qt::Alignment > aValueIter( theValues );
+ while( aStringIter.hasNext() && aValueIter.hasNext() )
+ {
+ const QString& aString = aStringIter.next();
+ Qt::Alignment aValue = aValueIter.next();
+ aCombo->addItem( aString, int( aValue ) );
+ if( aValue == theCurrentValue )
+ aCombo->setCurrentIndex( anIndex );
+ anIndex++;
+ }
+
+ myTable->setCellWidget( theRow, theCol, aCombo );
+}
+
+//=============================================================================
+// Function : setText
+// Purpose :
+//=============================================================================
+void Plot2d_SetupCommentsDlg::setText( const int theRow,
+ const int theCol,
+ const QString& theText )
+{
+ QTableWidgetItem* anItem = myTable->item( theRow, theCol );
+ if ( !anItem )
+ {
+ anItem = new QTableWidgetItem( theText );
+ myTable->setItem( theRow, theCol, anItem );
+ }
+ else
+ anItem->setText( theText );
+}
+
+//=============================================================================
+// Function : getText
+// Purpose :
+//=============================================================================
+QString Plot2d_SetupCommentsDlg::getText( const int theRow,
+ const int theCol ) const
+{
+ if( QTableWidgetItem* anItem = myTable->item( theRow, theCol ) )
+ return anItem->text();
+ return QString();
+}
+
+//=============================================================================
+// Function : SetParameters
+// Purpose :
+//=============================================================================
+void Plot2d_SetupCommentsDlg::SetParameters( const QVector< QString >& theTextList,
+ const QVector< double >& theXList,
+ const QVector< double >& theYList,
+ const QVector< Qt::Alignment >& theAlignmentList )
+{
+ int nbRows = qMax( qMax( theTextList.size(), theAlignmentList.size() ),
+ qMax( theXList.size(), theYList.size() ) );
+ myTable->setRowCount( nbRows );
+
+ QStringList anAlignmentStrings;
+ QList< Qt::Alignment > anAlignmentValues;
+ getAlignments( anAlignmentStrings, anAlignmentValues );
+
+ for ( int i = 0; i < nbRows; i++ )
+ {
+ setText( i, TEXT_COL, theTextList[ i ] );
+ setText( i, X_COL, QString( "%1" ).arg( theXList[ i ] ) );
+ setText( i, Y_COL, QString( "%1" ).arg( theYList[ i ] ) );
+ setCombo( i, ALIGNMENT_COL, anAlignmentStrings, anAlignmentValues, theAlignmentList[ i ] );
+ }
+
+ myRemovedIndexes.clear();
+}
+
+//=============================================================================
+// Function : GetParameters
+// Purpose :
+//=============================================================================
+void Plot2d_SetupCommentsDlg::GetParameters( QVector< QString >& theTextList,
+ QVector< double >& theXList,
+ QVector< double >& theYList,
+ QVector< Qt::Alignment >& theAlignmentList ) const
+{
+ int nbRows = myTable->rowCount();
+
+ theTextList.resize( nbRows );
+ theXList.resize( nbRows );
+ theYList.resize( nbRows );
+ theAlignmentList.resize( nbRows );
+
+ bool anIsOk;
+ for ( int i = 0; i < nbRows; i++ )
+ {
+ theTextList[ i ] = getText( i, TEXT_COL );
+
+ anIsOk = false;
+ double aX = getText( i, X_COL ).toDouble( &anIsOk );
+ theXList[ i ] = anIsOk ? aX : 0;
+
+ anIsOk = false;
+ double aY = getText( i, Y_COL ).toDouble( &anIsOk );
+ theYList[ i ] = anIsOk ? aY : 0;
+
+ anIsOk = false;
+ Qt::Alignment anAlignment = Qt::AlignTop | Qt::AlignLeft;
+ if( QComboBox* aCombo = dynamic_cast<QComboBox*>( myTable->cellWidget( i, ALIGNMENT_COL ) ) )
+ {
+ anAlignment = (Qt::Alignment)aCombo->itemData( aCombo->currentIndex() ).toInt( &anIsOk );
+ if( !anIsOk )
+ anAlignment = Qt::AlignTop | Qt::AlignLeft;
+ }
+ theAlignmentList[ i ] = anAlignment;
+ }
+}
+
+//=============================================================================
+// Function : GetRemovedIndexes
+// Purpose :
+//=============================================================================
+const QList< int >& Plot2d_SetupCommentsDlg::GetRemovedIndexes() const
+{
+ return myRemovedIndexes;
+}
+
+//=============================================================================
+// Function : onRemove
+// Purpose :
+//=============================================================================
+void Plot2d_SetupCommentsDlg::onRemove()
+{
+ QList< int > toRemove;
+
+ int aCurrRow = myTable->currentRow();
+ int aCurrCol = myTable->currentColumn();
+
+ // get selected rows
+ QSet< int > aSelRows;
+ QList<QTableWidgetSelectionRange> aRegs = myTable->selectedRanges();
+ QList<QTableWidgetSelectionRange>::iterator selIter;
+ for ( selIter = aRegs.begin(); selIter != aRegs.end(); ++selIter )
+ {
+ const QTableWidgetSelectionRange& aReg = *selIter;
+ for ( int i = aReg.topRow(), n = aReg.bottomRow(); i <= n; i++ )
+ aSelRows.insert( i );
+ }
+
+ int i, n;
+ for ( i = 0, n = myTable->rowCount(); i < n; i++ )
+ {
+ if ( aSelRows.contains( i ) || aCurrRow == i )
+ toRemove.append( i );
+ }
+
+ if ( !toRemove.count() )
+ return;
+
+ int nbRemoved = 0;
+ QList< int >::iterator anIter;
+ for ( anIter = toRemove.begin(); anIter != toRemove.end(); ++anIter )
+ {
+ int aRow = *anIter - nbRemoved;
+ myTable->removeRow( aRow );
+ myRemovedIndexes.append( aRow );
+ nbRemoved++;
+ }
+
+ int nbRows = myTable->rowCount();
+ if ( aCurrRow < nbRows && aCurrRow >= 0 && aCurrCol >= 0 )
+ myTable->setCurrentCell( aCurrRow, aCurrCol );
+ else if ( nbRows > 0 && aCurrCol >= 0 )
+ myTable->setCurrentCell( nbRows - 1, aCurrCol );
+}
--- /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 PLOT2D_SETUPCOMMENTSDLG_H
+#define PLOT2D_SETUPCOMMENTSDLG_H
+
+#include "Plot2d.h"
+
+#include <QtxDialog.h>
+
+#include <QVector>
+#include <QList>
+
+class QTableWidget;
+
+/*!
+ \class Plot2d_SetupCommentsDlg
+ Dialog box for setup Plot2d comments parameters
+*/
+
+class PLOT2D_EXPORT Plot2d_SetupCommentsDlg : public QtxDialog
+{
+ Q_OBJECT
+
+ class ItemDelegate;
+
+public:
+ Plot2d_SetupCommentsDlg( QWidget* theParent = 0 );
+ virtual ~Plot2d_SetupCommentsDlg();
+
+ void SetParameters( const QVector< QString >& theTextList,
+ const QVector< double >& theXList,
+ const QVector< double >& theYList,
+ const QVector< Qt::Alignment >& theAlignmentList );
+
+ void GetParameters( QVector< QString >& theTextList,
+ QVector< double >& theXList,
+ QVector< double >& theYList,
+ QVector< Qt::Alignment >& theAlignmentList ) const;
+
+ const QList< int >& GetRemovedIndexes() const;
+
+private slots:
+ void onRemove();
+
+private:
+ void getAlignments( QStringList& theStrings,
+ QList< Qt::Alignment >& theValues ) const;
+
+ void setCombo( const int theRow,
+ const int theCol,
+ const QStringList& theStrings,
+ const QList< Qt::Alignment >& theValues,
+ const Qt::Alignment theCurrentValue );
+
+ void setText( const int theRow,
+ const int theCol,
+ const QString& theText );
+
+ QString getText( const int theRow,
+ const int theCol ) const;
+
+private:
+ QTableWidget* myTable;
+ QList< int > myRemovedIndexes;
+};
+
+#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 "Plot2d_TextMarker.h"
+
+//=============================================================================
+// Function : Plot2d_TextMarker
+// Purpose : Constructor
+//=============================================================================
+Plot2d_TextMarker::Plot2d_TextMarker() : QwtPlotMarker()
+{
+}
+
+//=============================================================================
+// Function : Plot2d_TextMarker
+// Purpose : Destructor
+//=============================================================================
+Plot2d_TextMarker::~Plot2d_TextMarker()
+{
+}
+
+//=============================================================================
+// Function : setData
+// Purpose :
+//=============================================================================
+void Plot2d_TextMarker::setData( const QString& theText,
+ const double theX,
+ const double theY,
+ const Qt::Alignment theAlignment )
+{
+ QwtText aLabel = label();
+ aLabel.setText( theText );
+ setLabel( aLabel );
+
+ QwtSymbol aSymbol = symbol();
+ if( theAlignment == Qt::AlignCenter )
+ aSymbol.setStyle( QwtSymbol::NoSymbol );
+ else
+ {
+ aSymbol.setStyle( QwtSymbol::Ellipse );
+ aSymbol.setSize( QSize( 3, 3 ) );
+ }
+ setSymbol( aSymbol );
+
+ setLabelAlignment( theAlignment );
+
+ setValue( theX, theY );
+}
+
+//=============================================================================
+// Function : getData
+// Purpose :
+//=============================================================================
+void Plot2d_TextMarker::getData( QString& theText,
+ double& theX,
+ double& theY,
+ Qt::Alignment& theAlignment ) const
+{
+ theText = label().text();
+ theX = xValue();
+ theY = yValue();
+ theAlignment = labelAlignment();
+}
--- /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 PLOT2D_TEXTMARKER_H
+#define PLOT2D_TEXTMARKER_H
+
+#include "Plot2d.h"
+
+#include <qwt_plot_marker.h>
+
+class PLOT2D_EXPORT Plot2d_TextMarker : public QwtPlotMarker
+{
+public:
+ Plot2d_TextMarker();
+ virtual ~Plot2d_TextMarker();
+
+ void setData( const QString& theText,
+ const double theX,
+ const double theY,
+ const Qt::Alignment theAlignment );
+
+ void getData( QString& theText,
+ double& theX,
+ double& theY,
+ Qt::Alignment& theAlignment ) const;
+
+protected:
+};
+
+#endif
#include "Plot2d_Prs.h"
#include "Plot2d_Curve.h"
#include "Plot2d_SetupCurvesDlg.h"
+#include "Plot2d_SetupCommentsDlg.h"
#include "Plot2d_FitDataDlg.h"
#include "Plot2d_ViewWindow.h"
#include "Plot2d_SetupViewDlg.h"
}
/*!
- Gets lsit of displayed curves
+ Gets list of displayed curves
*/
int Plot2d_ViewFrame::getCurves( curveList& clist )
{
return clist.count();
}
+/*!
+ Gets list of displayed curves
+*/
const CurveDict& Plot2d_ViewFrame::getCurves()
{
return myPlot->getCurves();
}
+/*!
+ Displays comment
+*/
+void Plot2d_ViewFrame::displayComment( Plot2d_TextMarker* comment, bool update )
+{
+ comment->attach( myPlot );
+ myPlot->getComments().append( comment );
+ if( update )
+ myPlot->replot();
+}
+
+/*!
+ Erases comment
+*/
+void Plot2d_ViewFrame::eraseComment( Plot2d_TextMarker* comment, bool update )
+{
+ comment->hide();
+ comment->detach();
+ myPlot->getComments().removeAll( comment );
+ if( update )
+ myPlot->replot();
+}
+
+/*!
+ Gets list of displayed comments
+*/
+const CommentList& Plot2d_ViewFrame::getComments()
+{
+ return myPlot->getComments();
+}
+
/*!
Returns true if the curve is visible
*/
delete aDlg;
}
+/*!
+ "Comments settings" toolbar action slot
+*/
+void Plot2d_ViewFrame::onCommentsSettings()
+{
+ Plot2d_SetupCommentsDlg* aDlg = new Plot2d_SetupCommentsDlg( this );
+
+ int nbComments = myPlot->getComments().count();
+ if ( nbComments == 0 )
+ return;
+
+ QVector< QString > aTextList( nbComments );
+ QVector< double > aXList( nbComments );
+ QVector< double > aYList( nbComments );
+ QVector< Qt::Alignment > anAlignmentList( nbComments );
+
+ CommentList aComments;
+
+ CommentList::Iterator it = myPlot->getComments().begin();
+ int i = 0;
+ for ( i = 0; it != myPlot->getComments().end(); it++, i++ )
+ {
+ Plot2d_TextMarker* aComment = *it;
+ if ( !aComment )
+ return;
+
+ QString aText;
+ double aX = 0, aY = 0;
+ Qt::Alignment anAlignment = Qt::AlignTop | Qt::AlignLeft;
+ aComment->getData( aText, aX, aY, anAlignment );
+
+ aTextList[ i ] = aText;
+ aXList[ i ] = aX;
+ aYList[ i ] = aY;
+ anAlignmentList[ i ] = anAlignment;
+
+ aComments.append( aComment );
+ }
+
+ aDlg->SetParameters( aTextList, aXList, aYList, anAlignmentList );
+
+ if ( aDlg->exec() != QDialog::Accepted )
+ return;
+
+ const QList< int >& toRemove = aDlg->GetRemovedIndexes();
+ QList< int >::const_iterator aRemIter;
+ for ( aRemIter = toRemove.begin(); aRemIter != toRemove.end(); ++aRemIter )
+ {
+ int anIndex = *aRemIter;
+ if ( anIndex >= 0 && anIndex < (int)aComments.count() )
+ {
+ Plot2d_TextMarker* aComment = aComments[ anIndex ];
+ aComments.removeAt( anIndex );
+ eraseComment( aComment );
+ }
+ }
+
+ QMap< int, Plot2d_TextMarker* > anIndexToComment;
+ QList< Plot2d_TextMarker* >::iterator aCurvIter;
+ for ( i = 0, aCurvIter = aComments.begin(); aCurvIter != aComments.end(); ++aCurvIter, ++i )
+ anIndexToComment[ i ] = *aCurvIter;
+
+ aDlg->GetParameters( aTextList, aXList, aYList, anAlignmentList );
+
+ int n;
+ for ( i = 0, n = aTextList.size(); i < n; i++ )
+ {
+ QString aText = aTextList[ i ];
+ double aX = aXList[ i ];
+ double aY = aYList[ i ];
+ Qt::Alignment anAlignment = anAlignmentList[ i ];
+
+ if( Plot2d_TextMarker* aComment = anIndexToComment[ i ] )
+ aComment->setData( aText, aX, aY, anAlignment );
+ }
+
+ Repaint();
+
+ delete aDlg;
+}
+
/*!
"Fit Data" command slot
*/
#define PLOT2D_VIEWFRAME_H
#include "Plot2d_Curve.h"
+#include "Plot2d_TextMarker.h"
#include <QtxMap.h>
#include <QWidget>
typedef Plot2d_Curve* Plot2d_CurvePtr;
typedef QtxMap<QwtPlotCurvePtr, Plot2d_CurvePtr> CurveDict;
+typedef QList<Plot2d_TextMarker*> CommentList;
+
class PLOT2D_EXPORT Plot2d_ViewFrame : public QWidget
{
Q_OBJECT
void eraseCurves( const curveList& curves, bool update = false );
int getCurves( curveList& clist );
const CurveDict& getCurves();
+ void displayComment( Plot2d_TextMarker* comment, bool update = false );
+ void eraseComment( Plot2d_TextMarker* comment, bool update = false );
+ const CommentList& getComments();
bool isVisible( Plot2d_Curve* curve );
void updateCurve( Plot2d_Curve* curve, bool update = false );
void updateLegend( const Plot2d_Prs* prs );
void onViewGlobalPan();
void onSettings();
void onCurvesSettings();
+ void onCommentsSettings();
void onFitData();
void onChangeBackground();
void onPanLeft();
bool polished() const { return myIsPolished; }
QwtPlotGrid* grid() { return myGrid; };
- CurveDict& getCurves() { return myCurves; }
+ CurveDict& getCurves() { return myCurves; }
+ CommentList& getComments() { return myComments; }
Plot2d_Curve* getClosestCurve( QPoint p, double& distance, int& index );
QList<Plot2d_Curve*> getClosestPoints( QPoint thePoint, double theRadius, QList< QList< int > >& thePntIndex );
protected:
CurveDict myCurves;
+ CommentList myComments;
QwtPlotGrid* myGrid;
QList<QColor> myColors;
bool myIsPolished;
// settings
thePopup->addAction( mgr->action( CurvSettingsId ) );
thePopup->addAction( mgr->action( CurvesSettingsId ) );
+ thePopup->addAction( mgr->action( CommentsSettingsId ) );
}
/*!
connect( aAction, SIGNAL( triggered( bool ) ), myViewFrame, SLOT( onSettings() ) );
mgr->registerAction( aAction, CurvSettingsId );
- // 8. Curves Settings
+ // 9.1. Curves Settings
aAction = new QtxAction( tr( "TOT_CURVES_SETTINGS"),
aResMgr->loadPixmap("Plot2d", tr("ICON_CURVES_SETTINGS")),
tr("MEN_CURVES_SETTINGS"), 0, this);
aAction->setStatusTip( tr( "PRP_CURVES_SETTINGS") );
connect( aAction, SIGNAL( triggered( bool ) ), myViewFrame, SLOT( onCurvesSettings() ) );
mgr->registerAction( aAction, CurvesSettingsId );
-
- // 9. Clone
+
+ // 9.2. Comments Settings
+ aAction = new QtxAction( tr( "TOT_COMMENTS_SETTINGS"),
+ aResMgr->loadPixmap("Plot2d", tr("ICON_COMMENTS_SETTINGS")),
+ tr("MEN_COMMENTS_SETTINGS"), 0, this);
+ aAction->setStatusTip( tr( "PRP_COMMENTS_SETTINGS") );
+ connect( aAction, SIGNAL( triggered( bool ) ), myViewFrame, SLOT( onCommentsSettings() ) );
+ mgr->registerAction( aAction, CommentsSettingsId );
+
+ // 10. Clone
aAction = new QtxAction( tr( "MNU_CLONE_VIEW" ),
aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CLONE_VIEW" ) ),
tr( "MNU_CLONE_VIEW" ),
mgr->append( LegendId, myToolBar );
mgr->append( CurvSettingsId, myToolBar );
mgr->append( CurvesSettingsId, myToolBar );
+ mgr->append( CommentsSettingsId, myToolBar );
mgr->append( CloneId, myToolBar );
}
PModeYLinearId, PModeYLogarithmicId,
CurvPointsId, CurvLinesId, CurvSplinesId,
LegendId,
- CurvSettingsId, CurvesSettingsId,
+ CurvSettingsId, CurvesSettingsId, CommentsSettingsId,
CloneId };
public:
<source>ICON_CURVES_SETTINGS</source>
<translation>plot2d_curves_settings.png</translation>
</message>
+ <message>
+ <source>ICON_COMMENTS_SETTINGS</source>
+ <translation>plot2d_comments_settings.png</translation>
+ </message>
<message>
<source>ICON_MINUS</source>
<translation>plot2d_minus.png</translation>
<source>PRP_CURVES_SETTINGS</source>
<translation>Setups curves properties</translation>
</message>
+ <message>
+ <source>TOT_COMMENTS_SETTINGS</source>
+ <translation>Comments settings</translation>
+ </message>
+ <message>
+ <source>MEN_COMMENTS_SETTINGS</source>
+ <translation>Comments settings</translation>
+ </message>
+ <message>
+ <source>PRP_COMMENTS_SETTINGS</source>
+ <translation>Setups comments properties</translation>
+ </message>
<message>
<source>CIRCLE_MARKER_LBL</source>
<translation>Circle</translation>
<translation>Nb markers</translation>
</message>
</context>
+<context>
+ <name>Plot2d_SetupCommentsDlg</name>
+ <message>
+ <source>SETUP_COMMENTS</source>
+ <translation>Setup comments</translation>
+ </message>
+ <message>
+ <source>PARAMETERS</source>
+ <translation>Parameters</translation>
+ </message>
+ <message>
+ <source>TEXT</source>
+ <translation>Text</translation>
+ </message>
+ <message>
+ <source>X</source>
+ <translation>X</translation>
+ </message>
+ <message>
+ <source>Y</source>
+ <translation>Y</translation>
+ </message>
+ <message>
+ <source>ALIGNMENT</source>
+ <translation>Alignment</translation>
+ </message>
+ <message>
+ <source>TOP_LEFT</source>
+ <translation>Top left</translation>
+ </message>
+ <message>
+ <source>TOP_RIGHT</source>
+ <translation>Top right</translation>
+ </message>
+ <message>
+ <source>BOTTOM_LEFT</source>
+ <translation>Bottom left</translation>
+ </message>
+ <message>
+ <source>BOTTOM_RIGHT</source>
+ <translation>Bottom right</translation>
+ </message>
+ <message>
+ <source>CENTER</source>
+ <translation>Center</translation>
+ </message>
+</context>
</TS>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<source>PRP_CURVES_SETTINGS</source>
<translation type="unfinished">Définir les paramètres des courbes</translation>
</message>
+ <message>
+ <source>TOT_COMMENTS_SETTINGS</source>
+ <translation type="unfinished">Paramètres des commentaires</translation>
+ </message>
+ <message>
+ <source>MEN_COMMENTS_SETTINGS</source>
+ <translation type="unfinished">Paramètres des commentaires</translation>
+ </message>
+ <message>
+ <source>PRP_COMMENTS_SETTINGS</source>
+ <translation type="unfinished">Définir les paramètres des commentaires</translation>
+ </message>
<message>
<source>CIRCLE_MARKER_LBL</source>
<translation>Circle</translation>
<translation type="unfinished">Numéro de repères</translation>
</message>
</context>
+<context>
+ <name>Plot2d_SetupCommentsDlg</name>
+ <message>
+ <source>SETUP_COMMENTS</source>
+ <translation type="unfinished">Setup comments</translation>
+ </message>
+ <message>
+ <source>PARAMETERS</source>
+ <translation type="unfinished">Parameters</translation>
+ </message>
+ <message>
+ <source>TEXT</source>
+ <translation type="unfinished">Text</translation>
+ </message>
+ <message>
+ <source>X</source>
+ <translation type="unfinished">X</translation>
+ </message>
+ <message>
+ <source>Y</source>
+ <translation type="unfinished">Y</translation>
+ </message>
+ <message>
+ <source>ALIGNMENT</source>
+ <translation type="unfinished">Alignment</translation>
+ </message>
+ <message>
+ <source>TOP_LEFT</source>
+ <translation type="unfinished">Top left</translation>
+ </message>
+ <message>
+ <source>TOP_RIGHT</source>
+ <translation type="unfinished">Top right</translation>
+ </message>
+ <message>
+ <source>BOTTOM_LEFT</source>
+ <translation type="unfinished">Bottom left</translation>
+ </message>
+ <message>
+ <source>BOTTOM_RIGHT</source>
+ <translation type="unfinished">Bottom right</translation>
+ </message>
+ <message>
+ <source>CENTER</source>
+ <translation type="unfinished">Center</translation>
+ </message>
+</context>
</TS>