Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Now supports interactive simulation as well. - Added a namespace OMPlot, so that if one is using a lib the classes don't conflict. - Created classes for each Plot feature. - More work on the structure of the code is required. git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@8208 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
- Loading branch information
Showing
20 changed files
with
1,163 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* This file is part of OpenModelica. | ||
* | ||
* Copyright (c) 1998-CurrentYear, Linkoping University, | ||
* Department of Computer and Information Science, | ||
* SE-58183 Linkoping, Sweden. | ||
* | ||
* All rights reserved. | ||
* | ||
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 | ||
* AND THIS OSMC PUBLIC LICENSE (OSMC-PL). | ||
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S | ||
* ACCEPTANCE OF THE OSMC PUBLIC LICENSE. | ||
* | ||
* The OpenModelica software and the Open Source Modelica | ||
* Consortium (OSMC) Public License (OSMC-PL) are obtained | ||
* from Linkoping University, either from the above address, | ||
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or | ||
* http://www.openmodelica.org, and in the OpenModelica distribution. | ||
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This program is distributed WITHOUT ANY WARRANTY; without | ||
* even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH | ||
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS | ||
* OF OSMC-PL. | ||
* | ||
* See the full OSMC Public License conditions for more details. | ||
* | ||
* Main Author 2011: Adeel Asghar | ||
* | ||
*/ | ||
|
||
#include "Legend.h" | ||
|
||
using namespace OMPlot; | ||
|
||
Legend::Legend(Plot *pParent) | ||
{ | ||
|
||
} | ||
|
||
Legend::~Legend() | ||
{ | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* This file is part of OpenModelica. | ||
* | ||
* Copyright (c) 1998-CurrentYear, Linkoping University, | ||
* Department of Computer and Information Science, | ||
* SE-58183 Linkoping, Sweden. | ||
* | ||
* All rights reserved. | ||
* | ||
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 | ||
* AND THIS OSMC PUBLIC LICENSE (OSMC-PL). | ||
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S | ||
* ACCEPTANCE OF THE OSMC PUBLIC LICENSE. | ||
* | ||
* The OpenModelica software and the Open Source Modelica | ||
* Consortium (OSMC) Public License (OSMC-PL) are obtained | ||
* from Linkoping University, either from the above address, | ||
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or | ||
* http://www.openmodelica.org, and in the OpenModelica distribution. | ||
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This program is distributed WITHOUT ANY WARRANTY; without | ||
* even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH | ||
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS | ||
* OF OSMC-PL. | ||
* | ||
* See the full OSMC Public License conditions for more details. | ||
* | ||
* Main Author 2011: Adeel Asghar | ||
* | ||
*/ | ||
|
||
#ifndef LEGEND_H | ||
#define LEGEND_H | ||
|
||
#include "Plot.h" | ||
|
||
namespace OMPlot | ||
{ | ||
class Plot; | ||
|
||
class Legend : public QwtLegend | ||
{ | ||
public: | ||
Legend(Plot *pParent); | ||
~Legend(); | ||
}; | ||
} | ||
|
||
#endif // LEGEND_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/* | ||
* This file is part of OpenModelica. | ||
* | ||
* Copyright (c) 1998-CurrentYear, Linkoping University, | ||
* Department of Computer and Information Science, | ||
* SE-58183 Linkoping, Sweden. | ||
* | ||
* All rights reserved. | ||
* | ||
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 | ||
* AND THIS OSMC PUBLIC LICENSE (OSMC-PL). | ||
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S | ||
* ACCEPTANCE OF THE OSMC PUBLIC LICENSE. | ||
* | ||
* The OpenModelica software and the Open Source Modelica | ||
* Consortium (OSMC) Public License (OSMC-PL) are obtained | ||
* from Linkoping University, either from the above address, | ||
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or | ||
* http://www.openmodelica.org, and in the OpenModelica distribution. | ||
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This program is distributed WITHOUT ANY WARRANTY; without | ||
* even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH | ||
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS | ||
* OF OSMC-PL. | ||
* | ||
* See the full OSMC Public License conditions for more details. | ||
* | ||
* Main Author 2011: Adeel Asghar | ||
* | ||
*/ | ||
|
||
#include "PlotWindow.h" | ||
|
||
using namespace OMPlot; | ||
|
||
Plot::Plot(PlotWindow *pParent) | ||
: QwtPlot(pParent) | ||
{ | ||
mpParentPlotWindow = pParent; | ||
|
||
setTitle(tr("Plot by OpenModelica")); | ||
setCanvasBackground(Qt::white); | ||
// create an instance of legend | ||
mpLegend = new Legend(this); | ||
insertLegend(mpLegend, QwtPlot::RightLegend); | ||
// create an instance of picker | ||
mpPlotPicker = new PlotPicker(QwtPlot::xBottom, QwtPlot::yLeft, canvas()); | ||
// create an instance of grid | ||
mpPlotGrid = new PlotGrid(this); | ||
// create an instance of zoomer | ||
mpPlotZoomer = new PlotZoomer(QwtPlot::xBottom, QwtPlot::yLeft, canvas()); | ||
// create an instance of panner | ||
mpPlotPanner = new PlotPanner(canvas()); | ||
// create an instance of canvas we use it to capture events of canvas() | ||
mpPlotCanvas = new PlotCanvas(this); | ||
canvas()->installEventFilter(mpPlotCanvas); | ||
} | ||
|
||
Plot::~Plot() | ||
{ | ||
|
||
} | ||
|
||
PlotWindow* Plot::getParentPlotWindow() | ||
{ | ||
return mpParentPlotWindow; | ||
} | ||
|
||
Legend* Plot::getLegend() | ||
{ | ||
return mpLegend; | ||
} | ||
|
||
PlotPicker* Plot::getPlotPicker() | ||
{ | ||
return mpPlotPicker; | ||
} | ||
|
||
PlotGrid* Plot::getPlotGrid() | ||
{ | ||
return mpPlotGrid; | ||
} | ||
|
||
PlotZoomer* Plot::getPlotZoomer() | ||
{ | ||
return mpPlotZoomer; | ||
} | ||
|
||
PlotPanner* Plot::getPlotPanner() | ||
{ | ||
return mpPlotPanner; | ||
} | ||
|
||
QList<PlotCurve*> Plot::getPlotCurvesList() | ||
{ | ||
return mPlotCurvesList; | ||
} | ||
|
||
PlotCanvas* Plot::getPlotCanvas() | ||
{ | ||
return mpPlotCanvas; | ||
} | ||
|
||
void Plot::addPlotCurve(PlotCurve *pCurve) | ||
{ | ||
mPlotCurvesList.append(pCurve); | ||
} | ||
|
||
void Plot::removeCurve(PlotCurve *pCurve) | ||
{ | ||
mPlotCurvesList.removeOne(pCurve); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* This file is part of OpenModelica. | ||
* | ||
* Copyright (c) 1998-CurrentYear, Linkoping University, | ||
* Department of Computer and Information Science, | ||
* SE-58183 Linkoping, Sweden. | ||
* | ||
* All rights reserved. | ||
* | ||
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 | ||
* AND THIS OSMC PUBLIC LICENSE (OSMC-PL). | ||
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S | ||
* ACCEPTANCE OF THE OSMC PUBLIC LICENSE. | ||
* | ||
* The OpenModelica software and the Open Source Modelica | ||
* Consortium (OSMC) Public License (OSMC-PL) are obtained | ||
* from Linkoping University, either from the above address, | ||
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or | ||
* http://www.openmodelica.org, and in the OpenModelica distribution. | ||
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This program is distributed WITHOUT ANY WARRANTY; without | ||
* even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH | ||
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS | ||
* OF OSMC-PL. | ||
* | ||
* See the full OSMC Public License conditions for more details. | ||
* | ||
* Main Author 2011: Adeel Asghar | ||
* | ||
*/ | ||
|
||
#ifndef PLOT_H | ||
#define PLOT_H | ||
|
||
#include "PlotWindow.h" | ||
#include "Legend.h" | ||
#include "PlotPicker.h" | ||
#include "PlotGrid.h" | ||
#include "PlotZoomer.h" | ||
#include "PlotPanner.h" | ||
#include "PlotCurve.h" | ||
#include "PlotCanvas.h" | ||
|
||
namespace OMPlot | ||
{ | ||
class PlotWindow; | ||
class Legend; | ||
class PlotPicker; | ||
class PlotGrid; | ||
class PlotZoomer; | ||
class PlotPanner; | ||
class PlotCurve; | ||
class PlotCanvas; | ||
|
||
class Plot : public QwtPlot | ||
{ | ||
Q_OBJECT | ||
private: | ||
PlotWindow *mpParentPlotWindow; | ||
Legend *mpLegend; | ||
PlotPicker *mpPlotPicker; | ||
PlotGrid *mpPlotGrid; | ||
PlotZoomer *mpPlotZoomer; | ||
PlotPanner *mpPlotPanner; | ||
QList<PlotCurve*> mPlotCurvesList; | ||
PlotCanvas *mpPlotCanvas; | ||
public: | ||
Plot(PlotWindow *pParent); | ||
~Plot(); | ||
|
||
PlotWindow* getParentPlotWindow(); | ||
Legend* getLegend(); | ||
PlotPicker* getPlotPicker(); | ||
PlotGrid* getPlotGrid(); | ||
PlotZoomer* getPlotZoomer(); | ||
PlotPanner* getPlotPanner(); | ||
QList<PlotCurve*> getPlotCurvesList(); | ||
PlotCanvas* getPlotCanvas(); | ||
void addPlotCurve(PlotCurve *pCurve); | ||
void removeCurve(PlotCurve *pCurve); | ||
}; | ||
} | ||
|
||
#endif // PLOT_H |
Oops, something went wrong.