From 6fad14e92dfda30c10dd3fe34b592d521d2ead63 Mon Sep 17 00:00:00 2001 From: rnv Date: Tue, 17 Jan 2012 09:33:05 +0000 Subject: [PATCH] Fix remarks for the "0021383: [CEA 507] Plot2d Add analytic functions on curves" issue. --- .../gui/images/analytical_curves_dlg.png | Bin 0 -> 17057 bytes doc/salome/gui/input/plot2d_viewer.doc | 29 ++ src/LightApp/LightApp_Plot2dSelector.cxx | 8 + src/LightApp/LightApp_Plot2dSelector.h | 1 + src/Plot2d/Plot2d_AnalyticalCurveDlg.cxx | 2 +- src/Plot2d/Plot2d_AnalyticalCurveDlg.h | 129 ++++++++ src/Plot2d/Plot2d_AnalyticalParser.cxx | 276 ++++++++++++++++++ src/Plot2d/Plot2d_AnalyticalParser.h | 52 ++++ src/Plot2d/Plot2d_ViewFrame.cxx | 169 ++++++----- src/Plot2d/Plot2d_ViewFrame.h | 32 +- src/Plot2d/Plot2d_ViewWindow.cxx | 19 +- src/Plot2d/Plot2d_ViewWindow.h | 2 +- src/Plot2d/resources/Plot2d_images.ts | 4 +- src/Plot2d/resources/Plot2d_msg_en.ts | 31 +- src/Plot2d/resources/Plot2d_msg_fr.ts | 10 +- ..._curve.png => plot2d_analytical_curve.png} | Bin src/SPlot2d/SPlot2d_ViewModel.cxx | 28 +- src/SPlot2d/SPlot2d_ViewModel.h | 3 + 18 files changed, 680 insertions(+), 115 deletions(-) create mode 100755 doc/salome/gui/images/analytical_curves_dlg.png create mode 100755 src/Plot2d/Plot2d_AnalyticalCurveDlg.h create mode 100755 src/Plot2d/Plot2d_AnalyticalParser.cxx create mode 100755 src/Plot2d/Plot2d_AnalyticalParser.h rename src/Plot2d/resources/{plot2d_analitic_curve.png => plot2d_analytical_curve.png} (100%) diff --git a/doc/salome/gui/images/analytical_curves_dlg.png b/doc/salome/gui/images/analytical_curves_dlg.png new file mode 100755 index 0000000000000000000000000000000000000000..6bddc84cc03a4fe216828446993d2dc58ea22c12 GIT binary patch literal 17057 zcmch3eq4ch-|u%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X2W}gl2tDgKEMlQfJx@jO_HXoKafSPHi-N13X;PiIp4!>C~LT!}*)b)u# zUcuNHt9uvq#jDwPH-#R2#%Y|kZ?8MJnw6ZCa_wr?bE*en11nkE-K?M{aT;8#v+Uxq zIn4I(-~L#Eiix*ZHwGKsR2f-quGpyHa5jJZ4}u7uMc^I&*I#AJas~u2d!MUh&;ax6 z4a9+PWz$SYXN7x2q7)|lb*kTxp*D{4Gxnbo{Ma&|@i{$t4sh)-&&+;SOS^{1y;k!N z2Cb}&?IMJ!kIq8NbvOCWUuH$+9A;u5Y7wogWo+od4PqgbA0T#ECN75?*XOjf8K}?x zyZ|)K^YkQzIn<_ygI6m*-}RxYi?oIsG@szg{Caj+AN<<^>pH&M;s{snj1VzENH%g5ZX_e$-NZ!`uTtn{QCln?qC~OS3-A8}2E~C| literal 0 HcmV?d00001 diff --git a/doc/salome/gui/input/plot2d_viewer.doc b/doc/salome/gui/input/plot2d_viewer.doc index 17efc2c4c..1c664f75e 100644 --- a/doc/salome/gui/input/plot2d_viewer.doc +++ b/doc/salome/gui/input/plot2d_viewer.doc @@ -144,8 +144,37 @@ or ordinate) of all points displayed in the viewer is greater than zero. XY plots will be displayed with these defined properties.
+\anchor analytical_curve +\image html plot2d_analytical_curve.png +
Analytical curves - provides an access to the analytical curves dialog box, +that allows to add, remove and modify analytical curves for the Plot 2d Viewer.
+ +
+ +\image html analytical_curves_dlg.png + +The options are as follows:
+Curve parameters: +
    +
  • y(x)= allows to specify python expression, which used to calculate coordinates of the points of the curve.
  • +
  • Nb. itervals allows to specify number of the points of the curve.
  • +
+Curve properties: +
    +
  • Auto assign if it is checked, properties of the curves (Line type, Line width, Marker type and Color) +assigned automatically.To define the properties of the curve manually remove the checkmark from this control.
  • +
  • Line type allows to choose curve's line type from (None, Solid, Dash, Dot, Dash - Dot, Dash - Dot - Dot).
  • +
  • Line width allows to specify line width of the curve.
  • +
  • Marker type allows to choose curve's marker type from (Circle, Rectangle, Diamond, Rightward, +Leftward, Downward & Upward Triangle, Cross or Diagonal Cross).
  • +
  • Color allows to specify color of the curve.
  • +
+ +
+ \image html plot2d_clone.png
Clone view - opens a new duplicate scene.
+
\image html plot2d_print.png diff --git a/src/LightApp/LightApp_Plot2dSelector.cxx b/src/LightApp/LightApp_Plot2dSelector.cxx index 05b7c514d..88f4f9327 100755 --- a/src/LightApp/LightApp_Plot2dSelector.cxx +++ b/src/LightApp/LightApp_Plot2dSelector.cxx @@ -22,6 +22,7 @@ #include "LightApp_DataOwner.h" #include "LightApp_DataObject.h" #include "LightApp_Application.h" +#include "SUIT_SelectionMgr.h" #include @@ -36,6 +37,7 @@ LightApp_Plot2dSelector::LightApp_Plot2dSelector( Plot2d_Viewer* v, SUIT_Selecti { if ( v ) connect( v, SIGNAL( legendSelected( const QString& ) ), this, SLOT( onSelectionChanged( const QString& ) ) ); + connect( v, SIGNAL( clearSelected() ), this, SLOT( onClearSelected( ) ) ); } /*! @@ -81,3 +83,9 @@ void LightApp_Plot2dSelector::onSelectionChanged( const QString& entry ) selectionChanged(); myCurEntry = QString(); } + +/*!On clear selected.*/ +void LightApp_Plot2dSelector::onClearSelected( ) +{ + selectionMgr()->clearSelected(); +} \ No newline at end of file diff --git a/src/LightApp/LightApp_Plot2dSelector.h b/src/LightApp/LightApp_Plot2dSelector.h index 4032fa8ed..7a39fa04b 100755 --- a/src/LightApp/LightApp_Plot2dSelector.h +++ b/src/LightApp/LightApp_Plot2dSelector.h @@ -45,6 +45,7 @@ public: private slots: void onSelectionChanged( const QString& ); + void onClearSelected(); protected: virtual void getSelection( SUIT_DataOwnerPtrList& ) const; diff --git a/src/Plot2d/Plot2d_AnalyticalCurveDlg.cxx b/src/Plot2d/Plot2d_AnalyticalCurveDlg.cxx index a57dd27a7..580d5d68d 100755 --- a/src/Plot2d/Plot2d_AnalyticalCurveDlg.cxx +++ b/src/Plot2d/Plot2d_AnalyticalCurveDlg.cxx @@ -499,7 +499,7 @@ void Plot2d_AnalyticalCurveDlg::help() { SUIT_Application* app = SUIT_Session::session()->activeApplication(); if ( app ) - app->onHelpContextModule( "GUI", "plot2d_analytical_curves.html" ); + app->onHelpContextModule( "GUI", "plot2d_viewer_page.html", "analytical_curve" ); } /*! diff --git a/src/Plot2d/Plot2d_AnalyticalCurveDlg.h b/src/Plot2d/Plot2d_AnalyticalCurveDlg.h new file mode 100755 index 000000000..d49ff754d --- /dev/null +++ b/src/Plot2d/Plot2d_AnalyticalCurveDlg.h @@ -0,0 +1,129 @@ +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : Plot2d_AnalyticalCurveDlg.h +// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com) + + +#ifndef PLOT2D_ANALYTICAL_CURVE_DLG_H +#define PLOT2D_ANALYTICAL_CURVE_DLG_H + +#include "Plot2d.h" +#include "Plot2d_AnalyticalCurve.h" + +#include +#include + +class QListWidget; +class QListWidgetItem; +class QGroupBox; +class QLineEdit; +class QCheckBox; +class QComboBox; +class QPushButton; + +class QtxIntSpinBox; +class QtxColorButton; +class QwtPlot; + +class Plot2d_AnalyticalCurve; +class Plot2d_CurveContainer; +class Plot2d_ViewFrame; + +class PLOT2D_EXPORT Plot2d_AnalyticalCurveDlg : public QDialog +{ + Q_OBJECT + + class Updater; + class UpdateLocker; + + enum { ItemExisting, ItemAdded, ItemRemoved }; + +public: + Plot2d_AnalyticalCurveDlg( Plot2d_CurveContainer*, QWidget* ); + ~Plot2d_AnalyticalCurveDlg(); + + void accept(); + void reject(); + +private: + + void init(); + void initPropsFromCurve(Plot2d_AnalyticalCurve*); + QListWidgetItem* selected() const; + Plot2d_AnalyticalCurve* selectedCurve() const; + QListWidgetItem* getItem(Plot2d_AnalyticalCurve*) const; + bool processCurves(); + QwtPlot* getPlot(); + int propStatus( Plot2d_AnalyticalCurve* = 0, const int def = ItemExisting ); + QString propTitle( Plot2d_AnalyticalCurve* = 0, const QString& def = "" ); + bool propVisible( Plot2d_AnalyticalCurve* = 0, bool def = true ); + QString propFormula( Plot2d_AnalyticalCurve* = 0, const QString& def = "" ); + int propIntervals( Plot2d_AnalyticalCurve* = 0, int def = 100 ); + Plot2d::MarkerType propMarkerType( Plot2d_AnalyticalCurve* = 0, Plot2d::MarkerType def = Plot2d::None ); + Plot2d::LineType propLineType( Plot2d_AnalyticalCurve* = 0, Plot2d::LineType def = Plot2d::NoPen ); + int propLineWidth( Plot2d_AnalyticalCurve* = 0, int def = 0 ); + QColor propColor( Plot2d_AnalyticalCurve* = 0, const QColor& def = QColor() ); + bool propAutoAssign( Plot2d_AnalyticalCurve* = 0, bool def = true ); + +private slots: + void addCurve(); + void removeCurve(); + void updateCurve(); + void updateState(); + void selectionChanged(); + void help(); + void apply(); + +private: + typedef QMap CurveProps; + typedef QMap PropMap; + + Plot2d_CurveContainer* myContainer; + PropMap myProperties; + Updater* myUpdater; + + QListWidget* myCurvesList; + QGroupBox* myCurveParams; + QLineEdit* myFormula; + QtxIntSpinBox* myNbIntervals; + QGroupBox* myCurveProps; + QCheckBox* myAutoAssign; + QWidget* myPropsGrp; + QComboBox* myMarkerType; + QComboBox* myLineType; + QtxIntSpinBox* myLineWidth; + QtxColorButton* myColor; + QPushButton* myAddButton; + QPushButton* myRemoveButton; +}; + +class Plot2d_AnalyticalCurveDlg::Updater : public QObject +{ + Q_OBJECT +public: + Updater( QWidget* parent ); + ~Updater(); +signals: + void update(); +}; + +#endif //PLOT2D_ANALYTICAL_CURVE_DLG_H diff --git a/src/Plot2d/Plot2d_AnalyticalParser.cxx b/src/Plot2d/Plot2d_AnalyticalParser.cxx new file mode 100755 index 000000000..f10a562f0 --- /dev/null +++ b/src/Plot2d/Plot2d_AnalyticalParser.cxx @@ -0,0 +1,276 @@ +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : Plot2d_AnalyticalParser.cxx +// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com) +#include "Plot2d_AnalyticalParser.h" +#include + + +/* ================================== + * =========== PYTHON ============== + * ==================================*/ + +typedef struct { + PyObject_HEAD + int softspace; + std::string *out; + } PyStdOut; + +static void +PyStdOut_dealloc(PyStdOut *self) +{ + PyObject_Del(self); +} + +static PyObject * +PyStdOut_write(PyStdOut *self, PyObject *args) +{ + char *c; + int l; + if (!PyArg_ParseTuple(args, "t#:write",&c, &l)) + return NULL; + + //std::cerr << c ; + *(self->out)=*(self->out)+c; + + Py_INCREF(Py_None); + return Py_None; +} + +static PyMethodDef PyStdOut_methods[] = { + {"write", (PyCFunction)PyStdOut_write, METH_VARARGS, + PyDoc_STR("write(string) -> None")}, + {NULL, NULL} /* sentinel */ +}; + +static PyMemberDef PyStdOut_memberlist[] = { + {(char*)"softspace", T_INT, offsetof(PyStdOut, softspace), 0, + (char*)"flag indicating that a space needs to be printed; used by print"}, + {NULL} /* Sentinel */ +}; + +static PyTypeObject PyStdOut_Type = { + /* The ob_type field must be initialized in the module init function + * to be portable to Windows without using C++. */ + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "PyOut", /*tp_name*/ + sizeof(PyStdOut), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor)PyStdOut_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + /* softspace is writable: we must supply tp_setattro */ + PyObject_GenericSetAttr, /* tp_setattro */ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + PyStdOut_methods, /*tp_methods*/ + PyStdOut_memberlist, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ +}; + +PyObject * newPyStdOut( std::string& out ) +{ + PyStdOut *self; + self = PyObject_New(PyStdOut, &PyStdOut_Type); + if (self == NULL) + return NULL; + self->softspace = 0; + self->out=&out; + return (PyObject*)self; +} + + +////////////////////////END PYTHON/////////////////////////// + + +//! The only one instance of Parser +Plot2d_AnalyticalParser* Plot2d_AnalyticalParser::myParser = 0; + +//Define the script +QString Plot2d_AnalyticalParser::myScript = QString(""); + +/*! + \brief Return the only instance of the Plot2d_AnalyticalParser + \return instance of the Plot2d_AnalyticalParser +*/ +Plot2d_AnalyticalParser* Plot2d_AnalyticalParser::parser() +{ + if ( !myParser ) + myParser = new Plot2d_AnalyticalParser(); + return myParser; +} + +/*! + \brief Constructor. + + Construct the Parser and initialize python interpritator. +*/ +Plot2d_AnalyticalParser::Plot2d_AnalyticalParser() +{ + /* Initialize the Python interpreter */ + if (Py_IsInitialized()) { + PyGILState_STATE gstate = PyGILState_Ensure(); + myMainMod = PyImport_AddModule("__main__"); + myMainDict = PyModule_GetDict(myMainMod); + PyGILState_Release(gstate); + initScript(); + } +} + +int Plot2d_AnalyticalParser::calculate( const QString& theExpr, + const double theMin, + const double theMax, + const int theNbStep, + double** theX, + double** theY) { + + QString aPyScript = myScript; + aPyScript = aPyScript.arg(theExpr); + int result = -1; + PyGILState_STATE gstate = PyGILState_Ensure(); + PyObject* obj = PyRun_String(qPrintable(aPyScript), Py_file_input, myMainDict, NULL); + + if(obj == NULL) { + PyErr_Print(); + PyGILState_Release(gstate); + return result; + + } else { + Py_DECREF(obj); + } + + PyObject* func = NULL; + PyObject* f_y = NULL; + + if(PyObject_HasAttrString(myMainMod, "Y")) { + f_y = PyObject_GetAttrString(myMainMod, "Y"); + } + + if(PyObject_HasAttrString(myMainMod, "coordCalculator")) { + func = PyObject_GetAttrString(myMainMod, "coordCalculator"); + } + + PyObject* new_stderr = NULL; + + if( f_y == NULL || func == NULL ) { + fflush(stderr); + std::string err_description=""; + new_stderr = newPyStdOut(err_description); + PySys_SetObject((char*)"stderr", new_stderr); + PyErr_Print(); + PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__")); + Py_DECREF(new_stderr); + PyGILState_Release(gstate); + return result; + } + + PyObject* coords; + coords = PyObject_CallFunction(func,(char*)"(d, d, i)", theMin, theMax, theNbStep ); + + new_stderr = NULL; + + if (coords == NULL){ + fflush(stderr); + std::string err_description=""; + new_stderr = newPyStdOut(err_description); + PySys_SetObject((char*)"stderr", new_stderr); + PyErr_Print(); + PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__")); + Py_DECREF(new_stderr); + PyGILState_Release(gstate); + return result; + } + + Py_ssize_t size = PyList_Size( coords ); + if( size <= 0 ) { + Py_DECREF(coords); + return result; + } + + result = size; + + *theX = new double[size]; + *theY = new double[size]; + + for ( Py_ssize_t i = 0; i< size; ++i ) { + PyObject* coord = PyList_GetItem( coords, i ); + (*theX)[i] = PyFloat_AsDouble(PyList_GetItem(coord, 0)); + (*theY)[i] = PyFloat_AsDouble(PyList_GetItem(coord, 1)); + } + + PyGILState_Release(gstate); + return result; +} + +/*! + \brief Initialize python script. +*/ +void Plot2d_AnalyticalParser::initScript() { + myScript.clear(); + myScript += "from math import * \n"; + myScript += "def Y(x): \n"; + myScript += " return "; + myScript += "%1\n"; + + myScript += "def coordCalculator(xmin, xmax, nstep): \n"; + myScript += " coords = [] \n"; + myScript += " xstep = (xmax - xmin) / nstep \n"; + myScript += " n = 0 \n"; + myScript += " while n <= nstep : \n"; + myScript += " x = xmin + n*xstep \n"; + myScript += " try: \n"; + myScript += " y = Y(x) \n"; + myScript += " coords.append([x,y]) \n"; + myScript += " except ValueError, ZeroDivisionError: \n"; + myScript += " pass \n"; + myScript += " n = n+1 \n"; + myScript += " return coords \n"; +} diff --git a/src/Plot2d/Plot2d_AnalyticalParser.h b/src/Plot2d/Plot2d_AnalyticalParser.h new file mode 100755 index 000000000..37b55d981 --- /dev/null +++ b/src/Plot2d/Plot2d_AnalyticalParser.h @@ -0,0 +1,52 @@ +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : Plot2d_AnalyticalParser.h +// Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com) + +#ifndef PLOT2D_ANALYTICAL_Parser_H +#define PLOT2D_ANALYTICAL_Parser_H +#include + +#include "Plot2d.h" + +class PLOT2D_EXPORT Plot2d_AnalyticalParser { +public: + ~Plot2d_AnalyticalParser(); + + + static Plot2d_AnalyticalParser* parser(); + int calculate( const QString&, const double, + const double, const int, + double**, double**); + +private: + Plot2d_AnalyticalParser(); + void initScript(); + +private: + static Plot2d_AnalyticalParser* myParser; //!< instance of the Parser + PyObject* myMainMod; //!< main python module + PyObject* myMainDict; //!< main python dictionary + static QString myScript; //!< python script +}; + +#endif //PLOT2D_ANALYTICAL_Parser_H diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index ff36d6b5d..3bb45f3de 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -28,10 +28,8 @@ #include "Plot2d_FitDataDlg.h" #include "Plot2d_ViewWindow.h" #include "Plot2d_SetupViewDlg.h" -#ifndef DISABLE_PYCONSOLE -#include "Plot2d_AnaliticCurveDlg.h" -#include "Plot2d_AnaliticCurve.h" -#endif +#include "Plot2d_AnalyticalCurveDlg.h" +#include "Plot2d_AnalyticalCurve.h" #include "Plot2d_ToolTip.h" #include "SUIT_Tools.h" @@ -66,7 +64,6 @@ #include #include -#include #include #include @@ -1602,24 +1599,38 @@ void Plot2d_ViewFrame::onSettings() delete dlg; } -#ifndef DISABLE_PYCONSOLE /*! - "Analitic Curves" toolbar action slot + "Analytical Curves" toolbar action slot */ -void Plot2d_ViewFrame::onAnaliticCurve() { - Plot2d_AnaliticCurveDlg* dlg = new Plot2d_AnaliticCurveDlg(this, myPlot); - dlg->setCurveList(myAnaliticCurves); - dlg->exec(); - delete dlg; -} +void Plot2d_ViewFrame::onAnalyticalCurve() +{ +#ifndef DISABLE_PYCONSOLE + Plot2d_AnalyticalCurveDlg dlg( this, this ); + dlg.exec(); + updateAnalyticalCurves(); #endif +} +void Plot2d_ViewFrame::addAnalyticalCurve( Plot2d_AnalyticalCurve* theCurve) +{ +#ifndef DISABLE_PYCONSOLE + myAnalyticalCurves.append(theCurve); +#endif +} +void Plot2d_ViewFrame::removeAnalyticalCurve( Plot2d_AnalyticalCurve* theCurve) +{ #ifndef DISABLE_PYCONSOLE + theCurve->setAction(Plot2d_AnalyticalCurve::ActRemoveFromView); +#endif +} + /* - Update analitic curve + Update Analytical curve */ -void Plot2d_ViewFrame::updateAnaliticCurve(Plot2d_AnaliticCurve* c, bool updateView){ +void Plot2d_ViewFrame::updateAnalyticalCurve(Plot2d_AnalyticalCurve* c, bool updateView) +{ +#ifndef DISABLE_PYCONSOLE if(!c) return; QwtScaleDiv* div = myPlot->axisScaleDiv(QwtPlot::xBottom); c->setRangeBegin(div->lowerBound()); @@ -1629,17 +1640,17 @@ void Plot2d_ViewFrame::updateAnaliticCurve(Plot2d_AnaliticCurve* c, bool updateV QwtPlotItem* item = c->plotItem(); switch( c->getAction() ) { - case Plot2d_AnaliticCurve::ActAddInView: + case Plot2d_AnalyticalCurve::ActAddInView: if( c->isActive() ) { + c->updatePlotItem(); item->attach( myPlot ); + item->show(); } - myAnaliticCurves.append(c); - c->setAction(Plot2d_AnaliticCurve::ActNothing); + c->setAction(Plot2d_AnalyticalCurve::ActNothing); break; - case Plot2d_AnaliticCurve::ActUpdateInView: + case Plot2d_AnalyticalCurve::ActUpdateInView: if(c->isActive()) { - item->attach( myPlot ); c->updatePlotItem(); item->show(); } else { @@ -1647,33 +1658,56 @@ void Plot2d_ViewFrame::updateAnaliticCurve(Plot2d_AnaliticCurve* c, bool updateV item->detach(); } - c->setAction(Plot2d_AnaliticCurve::ActNothing); + c->setAction(Plot2d_AnalyticalCurve::ActNothing); break; - case Plot2d_AnaliticCurve::ActRemoveFromView: + case Plot2d_AnalyticalCurve::ActRemoveFromView: item->hide(); item->detach(); - myAnaliticCurves.removeAll(c); + myAnalyticalCurves.removeAll(c); delete c; break; } if(updateView) myPlot->replot(); -} #endif +} -#ifndef DISABLE_PYCONSOLE /* - Update analitic curves + Update Analytical curves */ -void Plot2d_ViewFrame::updateAnaliticCurves() { - AnaliticCurveList::iterator it = myAnaliticCurves.begin(); - for( ; it != myAnaliticCurves.end(); it++) { - updateAnaliticCurve(*it); +void Plot2d_ViewFrame::updateAnalyticalCurves() +{ +#ifndef DISABLE_PYCONSOLE + AnalyticalCurveList::iterator it = myAnalyticalCurves.begin(); + for( ; it != myAnalyticalCurves.end(); it++) { + updateAnalyticalCurve(*it); } myPlot->replot(); +#endif } + +/*! + Return list of the alalytical curves. +*/ +AnalyticalCurveList Plot2d_ViewFrame::getAnalyticalCurves() const +{ + return myAnalyticalCurves; +} + +/*! + Get analytical curve by plot item. +*/ +Plot2d_AnalyticalCurve* Plot2d_ViewFrame::getAnalyticalCurve(QwtPlotItem * theItem) { +#ifndef DISABLE_PYCONSOLE + AnalyticalCurveList::iterator it = myAnalyticalCurves.begin(); + for( ; it != myAnalyticalCurves.end(); it++) { + if((*it)->plotItem() == theItem); + return (*it); + } + return 0; #endif +} /*! "Fit Data" command slot @@ -1690,9 +1724,7 @@ void Plot2d_ViewFrame::onFitData() fitData(mode,xMin,xMax,yMin,yMax,y2Min,y2Max); } delete dlg; -#ifndef DISABLE_PYCONSOLE - updateAnaliticCurves(); -#endif + updateAnalyticalCurves(); } /*! @@ -2362,11 +2394,9 @@ void Plot2d_ViewFrame::plotMouseReleased( const QMouseEvent& me ) me.pos(), me.globalPos() ); emit contextMenuRequested( &aEvent ); } -#ifndef DISABLE_PYCONSOLE else { - updateAnaliticCurves(); + updateAnalyticalCurves(); } -#endif myPlot->canvas()->setCursor( QCursor( Qt::CrossCursor ) ); myPlot->defaultPicker(); @@ -2399,9 +2429,7 @@ void Plot2d_ViewFrame::wheelEvent(QWheelEvent* event) myPlot->replot(); if ( myPlot->zoomer() ) myPlot->zoomer()->setZoomBase(); myPnt = event->pos(); -#ifndef DISABLE_PYCONSOLE - updateAnaliticCurves(); -#endif + updateAnalyticalCurves(); } /*! @@ -3217,15 +3245,14 @@ QString Plot2d_ViewFrame::getVisualParameters() myLegendFont.italic(), myLegendFont.underline(),myLegendColor.red(), myLegendColor.green(), myLegendColor.blue()); -#ifndef DISABLE_PYCONSOLE - //store all analitic curves + //store all Analytical curves //store each curve in the following format // ...*Name|isActive|Expresion|NbInervals|isAutoAssign[|MarkerType|LineType|LineWidth|r:g:b] // parameters in the [ ] is optional in case if isAutoAssign == true - AnaliticCurveList::iterator it = myAnaliticCurves.begin(); - Plot2d_AnaliticCurve* c = 0; + AnalyticalCurveList::iterator it = myAnalyticalCurves.begin(); + Plot2d_AnalyticalCurve* c = 0; bool isAuto; - for( ; it != myAnaliticCurves.end(); it++) { + for( ; it != myAnalyticalCurves.end(); it++) { c = (*it); if(!c) continue; QString curveString(""); @@ -3250,7 +3277,6 @@ QString Plot2d_ViewFrame::getVisualParameters() retStr+=optCurveString; } } -#endif return retStr; } @@ -3308,14 +3334,13 @@ void Plot2d_ViewFrame::setVisualParameters( const QString& parameters ) } } -#ifndef DISABLE_PYCONSOLE - //Restore all analitical curves + //Restore all Analyticalal curves int startCurveIndex = 10; if( paramsLst.size() >= startCurveIndex+1 ) { for( int i=startCurveIndex; isetName(curveLst[0]); c->setActive(curveLst[1].toInt()); c->setExpression(curveLst[2]); @@ -3334,13 +3359,12 @@ void Plot2d_ViewFrame::setVisualParameters( const QString& parameters ) } else { c->autoFill( myPlot ); } - c->setAction(Plot2d_AnaliticCurve::ActAddInView); - updateAnaliticCurve(c); + addAnalyticalCurve(c); + updateAnalyticalCurve(c); } } myPlot->replot(); } -#endif } /*! @@ -3449,6 +3473,25 @@ Plot2d_Curve* Plot2d_ViewFrame::getClosestCurve( QPoint p, double& distance, int return 0; } +/*! + \brief Deselect all analytical curves. +*/ +void Plot2d_ViewFrame::deselectAnalyticalCurves() { + foreach(Plot2d_AnalyticalCurve* c, myAnalyticalCurves) { + c->setSelected(false); + } +} + +/*! + \brief Deselect all objects, except analytical curves. +*/ +void Plot2d_ViewFrame::deselectObjects() { + ObjectDict::const_iterator it = myObjects.begin(), aLast = myObjects.end(); + for ( ; it != aLast; it++ ) { + it.value()->setSelected(false); + } +} + #define INCREMENT_FOR_OP 10 /*! @@ -3457,9 +3500,7 @@ Plot2d_Curve* Plot2d_ViewFrame::getClosestCurve( QPoint p, double& distance, int void Plot2d_ViewFrame::onPanLeft() { this->incrementalPan( -INCREMENT_FOR_OP, 0 ); -#ifndef DISABLE_PYCONSOLE - updateAnaliticCurves(); -#endif + updateAnalyticalCurves(); } /*! @@ -3468,9 +3509,7 @@ void Plot2d_ViewFrame::onPanLeft() void Plot2d_ViewFrame::onPanRight() { this->incrementalPan( INCREMENT_FOR_OP, 0 ); -#ifndef DISABLE_PYCONSOLE - updateAnaliticCurves(); -#endif + updateAnalyticalCurves(); } /*! @@ -3479,9 +3518,7 @@ void Plot2d_ViewFrame::onPanRight() void Plot2d_ViewFrame::onPanUp() { this->incrementalPan( 0, -INCREMENT_FOR_OP ); -#ifndef DISABLE_PYCONSOLE - updateAnaliticCurves(); -#endif + updateAnalyticalCurves(); } /*! @@ -3490,9 +3527,7 @@ void Plot2d_ViewFrame::onPanUp() void Plot2d_ViewFrame::onPanDown() { this->incrementalPan( 0, INCREMENT_FOR_OP ); -#ifndef DISABLE_PYCONSOLE - updateAnaliticCurves(); -#endif + updateAnalyticalCurves(); } /*! @@ -3501,9 +3536,7 @@ void Plot2d_ViewFrame::onPanDown() void Plot2d_ViewFrame::onZoomIn() { this->incrementalZoom( INCREMENT_FOR_OP, INCREMENT_FOR_OP ); -#ifndef DISABLE_PYCONSOLE - updateAnaliticCurves(); -#endif + updateAnalyticalCurves(); } /*! @@ -3512,9 +3545,7 @@ void Plot2d_ViewFrame::onZoomIn() void Plot2d_ViewFrame::onZoomOut() { this->incrementalZoom( -INCREMENT_FOR_OP, -INCREMENT_FOR_OP ); -#ifndef DISABLE_PYCONSOLE - updateAnaliticCurves(); -#endif + updateAnalyticalCurves(); } /*! diff --git a/src/Plot2d/Plot2d_ViewFrame.h b/src/Plot2d/Plot2d_ViewFrame.h index 69eb8bfdd..63a10e25c 100755 --- a/src/Plot2d/Plot2d_ViewFrame.h +++ b/src/Plot2d/Plot2d_ViewFrame.h @@ -25,9 +25,7 @@ #include "Plot2d.h" #include "Plot2d_Curve.h" -#ifndef DISABLE_PYCONSOLE -#include "Plot2d_AnaliticCurve.h" -#endif +#include "Plot2d_AnalyticalCurve.h" #include "Plot2d_NormalizeAlgorithm.h" #include @@ -58,7 +56,7 @@ class Plot2d_QwtPlotPicker; typedef QMultiHash CurveDict; typedef QMultiHash ObjectDict; -class PLOT2D_EXPORT Plot2d_ViewFrame : public QWidget +class PLOT2D_EXPORT Plot2d_ViewFrame : public QWidget, public Plot2d_CurveContainer { Q_OBJECT @@ -153,10 +151,16 @@ public: void getFitRangeByCurves( double&, double&, double&, double&, double&, double& ); -#ifndef DISABLE_PYCONSOLE - void updateAnaliticCurves(); - void updateAnaliticCurve( Plot2d_AnaliticCurve*, bool = false ); -#endif + + void addAnalyticalCurve( Plot2d_AnalyticalCurve* ); + void removeAnalyticalCurve( Plot2d_AnalyticalCurve* ); + void updateAnalyticalCurve( Plot2d_AnalyticalCurve*, bool = false ); + void updateAnalyticalCurves(); + void deselectAnalyticalCurves(); + void deselectObjects(); + + AnalyticalCurveList getAnalyticalCurves() const; + Plot2d_AnalyticalCurve* getAnalyticalCurve(QwtPlotItem *); /* view parameters */ void copyPreferences( Plot2d_ViewFrame* ); @@ -241,6 +245,10 @@ protected: void setCurveType( QwtPlotCurve*, int ); bool hasPlotObject( Plot2d_Object* ) const; + + + + public slots: void onViewPan(); void onViewZoom(); @@ -248,9 +256,7 @@ public slots: void onViewFitArea(); void onViewGlobalPan(); void onSettings(); -#ifndef DISABLE_PYCONSOLE - void onAnaliticCurve(); -#endif + void onAnalyticalCurve(); void onFitData(); void onChangeBackground(); void onPanLeft(); @@ -298,9 +304,7 @@ protected: double myXDistance, myYDistance, myYDistance2; bool mySecondY; ObjectDict myObjects; -#ifndef DISABLE_PYCONSOLE - AnaliticCurveList myAnaliticCurves; -#endif + AnalyticalCurveList myAnalyticalCurves; Plot2d_NormalizeAlgorithm* myLNormAlgo; Plot2d_NormalizeAlgorithm* myRNormAlgo; bool myIsDefTitle; diff --git a/src/Plot2d/Plot2d_ViewWindow.cxx b/src/Plot2d/Plot2d_ViewWindow.cxx index a9cfe63b7..1dfa2d22a 100755 --- a/src/Plot2d/Plot2d_ViewWindow.cxx +++ b/src/Plot2d/Plot2d_ViewWindow.cxx @@ -432,16 +432,17 @@ void Plot2d_ViewWindow::createActions() connect( aAction, SIGNAL( triggered( bool ) ), myViewFrame, SLOT( onSettings() ) ); mgr->registerAction( aAction, CurvSettingsId ); - // 9. Analitic curves - aAction = new QtxAction( tr( "TOT_PLOT2D_ANALITIC_CURVES" ), - aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_ANALITIC_CURVES" ) ), - tr( "MEN_PLOT2D_ANALITIC_CURVES" ), + // 9. Analytical curves +#ifndef DISABLE_PYCONSOLE + aAction = new QtxAction( tr( "TOT_PLOT2D_ANALYTICAL_CURVES" ), + aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_ANALYTICAL_CURVES" ) ), + tr( "MEN_PLOT2D_ANALYTICAL_CURVES" ), 0, this ); - aAction->setStatusTip( tr( "PRP_PLOT2D_ANALITIC_CURVES" ) ); - connect( aAction, SIGNAL( triggered( bool ) ), myViewFrame, SLOT( onAnaliticCurve() ) ); - mgr->registerAction( aAction, AnaliticCurveId ); - + aAction->setStatusTip( tr( "PRP_PLOT2D_ANALYTICAL_CURVES" ) ); + connect( aAction, SIGNAL( triggered( bool ) ), myViewFrame, SLOT( onAnalyticalCurve() ) ); + mgr->registerAction( aAction, AnalyticalCurveId ); +#endif // 10. Clone aAction = new QtxAction( tr( "MNU_CLONE_VIEW" ), @@ -499,7 +500,7 @@ void Plot2d_ViewWindow::createToolBar() mgr->append( toolMgr()->separator(), myToolBar ); mgr->append( LegendId, myToolBar ); mgr->append( CurvSettingsId, myToolBar ); - mgr->append( AnaliticCurveId, myToolBar ); + mgr->append( AnalyticalCurveId, myToolBar ); mgr->append( CloneId, myToolBar ); mgr->append( PrintId, myToolBar ); } diff --git a/src/Plot2d/Plot2d_ViewWindow.h b/src/Plot2d/Plot2d_ViewWindow.h index 66975732d..ffa44da2c 100755 --- a/src/Plot2d/Plot2d_ViewWindow.h +++ b/src/Plot2d/Plot2d_ViewWindow.h @@ -59,7 +59,7 @@ public: LegendId, CurvSettingsId, CloneId, PrintId, - AnaliticCurveId }; + AnalyticalCurveId }; public: Plot2d_ViewWindow( SUIT_Desktop*, Plot2d_Viewer* ); diff --git a/src/Plot2d/resources/Plot2d_images.ts b/src/Plot2d/resources/Plot2d_images.ts index 5841ec8a0..33028818f 100644 --- a/src/Plot2d/resources/Plot2d_images.ts +++ b/src/Plot2d/resources/Plot2d_images.ts @@ -72,8 +72,8 @@ plot2d_settings.png - ICON_PLOT2D_ANALITIC_CURVES - plot2d_analitic_curve.png + ICON_PLOT2D_ANALYTICAL_CURVES + plot2d_analytical_curve.png ICON_PLOT2D_CURVES_LINES diff --git a/src/Plot2d/resources/Plot2d_msg_en.ts b/src/Plot2d/resources/Plot2d_msg_en.ts index d312ff17d..b363b48e8 100644 --- a/src/Plot2d/resources/Plot2d_msg_en.ts +++ b/src/Plot2d/resources/Plot2d_msg_en.ts @@ -228,8 +228,8 @@ Settings - TOT_PLOT2D_ANALITIC_CURVES - Analytic curves + TOT_PLOT2D_ANALYTICAL_CURVES + Analytical curves TOT_PLOT2D_NORMALIZE_MODE_LMAX @@ -394,8 +394,8 @@ Logarithmic scale for ordinate axis is not allowed. Zoom the view - PRP_PLOT2D_ANALITIC_CURVES - Setups analytic curves properties + PRP_PLOT2D_ANALYTICAL_CURVES + Setups analytical curves properties PRP_PLOT2D_NORMALIZE_MODE_LMAX @@ -522,8 +522,8 @@ Logarithmic scale for ordinate axis is not allowed. &Settings - MEN_PLOT2D_ANALITIC_CURVES - Analytic curves + MEN_PLOT2D_ANALYTICAL_CURVES + Analytical curves CIRCLE_MARKER_LBL @@ -673,10 +673,10 @@ Logarithmic scale for ordinate axis is not allowed. - Plot2d_AnaliticCurveDlg + Plot2d_AnalyticalCurveDlg - ANALITIC_CURVE_TLT - Analitic curves properties + ANALYTICAL_CURVE_TLT + Analytical curves properties AC_CURVE_PARAMS @@ -723,9 +723,13 @@ Logarithmic scale for ordinate axis is not allowed. Remove curve - AC_UPD_BTN - Update Curve + AC_OK_BTN + Ok + + AC_APPLY_BTN + Apply + AC_CANT_CALCULATE Can't calculate curve. @@ -735,6 +739,11 @@ Please, check input parameters!!! AC_CLOSE_BTN &Close + + AC_HELP_BTN + Help + + Plot2d_SetupCurveScaleDlg diff --git a/src/Plot2d/resources/Plot2d_msg_fr.ts b/src/Plot2d/resources/Plot2d_msg_fr.ts index 53be6d0ac..8ba2de9b1 100755 --- a/src/Plot2d/resources/Plot2d_msg_fr.ts +++ b/src/Plot2d/resources/Plot2d_msg_fr.ts @@ -204,7 +204,7 @@ Paramètres - TOT_PLOT2D_ANALITIC_CURVES + TOT_PLOT2D_ANALYTICAL_CURVES Courbes analytiques @@ -354,7 +354,7 @@ L'échelle logarithmique de l'ordonnée n'est pas permise.Zoomer la vue - PRP_PLOT2D_ANALITIC_CURVES + PRP_PLOT2D_ANALYTICAL_CURVES Réglage des propriétés des courbes analytiques @@ -450,7 +450,7 @@ L'échelle logarithmique de l'ordonnée n'est pas permise.&Paramètres - MEN_PLOT2D_ANALITIC_CURVES + MEN_PLOT2D_ANALYTICAL_CURVES Courbes analytiques @@ -601,9 +601,9 @@ L'échelle logarithmique de l'ordonnée n'est pas permise. - Plot2d_AnaliticCurveDlg + Plot2d_AnalyticalCurveDlg - ANALITIC_CURVE_TLT + ANALYTICAL_CURVE_TLT Propriétés des courbes analytiques diff --git a/src/Plot2d/resources/plot2d_analitic_curve.png b/src/Plot2d/resources/plot2d_analytical_curve.png similarity index 100% rename from src/Plot2d/resources/plot2d_analitic_curve.png rename to src/Plot2d/resources/plot2d_analytical_curve.png diff --git a/src/SPlot2d/SPlot2d_ViewModel.cxx b/src/SPlot2d/SPlot2d_ViewModel.cxx index 0c4d53a9b..c1e8b6cce 100644 --- a/src/SPlot2d/SPlot2d_ViewModel.cxx +++ b/src/SPlot2d/SPlot2d_ViewModel.cxx @@ -79,7 +79,8 @@ using namespace std; Constructor */ SPlot2d_Viewer::SPlot2d_Viewer( bool theAutoDel ) -: Plot2d_Viewer( theAutoDel ) +: Plot2d_Viewer( theAutoDel ), + myDeselectAnalytical(true) { } @@ -406,6 +407,23 @@ void SPlot2d_Viewer::onLegendClicked( QwtPlotItem* plotItem ) Plot2d_ViewFrame* aViewFrame = getActiveViewFrame(); if(aViewFrame == NULL) return; + bool isAnalytical = false; + AnalyticalCurveList curves = aViewFrame->getAnalyticalCurves(); + foreach ( Plot2d_AnalyticalCurve* curve, curves ) { + if(plotItem == curve->plotItem()) { + isAnalytical = true; + curve->setSelected(true); + } else { + curve->setSelected(false); + } + } + if(isAnalytical) { + myDeselectAnalytical = false; + emit clearSelected(); + aViewFrame->updateAnalyticalCurves(); + myDeselectAnalytical = true; + return; + } Plot2d_Object* anObject = aViewFrame->getPlotObject(plotItem); @@ -423,7 +441,7 @@ void SPlot2d_Viewer::onLegendClicked( QwtPlotItem* plotItem ) if(!anEntry.isEmpty()) emit legendSelected( anEntry ); - } + } } /*! @@ -473,7 +491,11 @@ void SPlot2d_Viewer::setObjectsSelected( SALOME_ListIO& theList ) { o->setSelected(false); aViewFrame->updateObject(o); } - } + } + if( myDeselectAnalytical ) { + aViewFrame->deselectAnalyticalCurves(); + aViewFrame->updateAnalyticalCurves(); + } aViewFrame->Repaint(); } } diff --git a/src/SPlot2d/SPlot2d_ViewModel.h b/src/SPlot2d/SPlot2d_ViewModel.h index f29904fd8..8a31b3da1 100644 --- a/src/SPlot2d/SPlot2d_ViewModel.h +++ b/src/SPlot2d/SPlot2d_ViewModel.h @@ -88,6 +88,9 @@ protected slots: signals: void legendSelected( const QString& ); + void clearSelected(); +private: + bool myDeselectAnalytical; }; -- 2.39.2