Minsky
|
a container item for a plot widget More...
#include <plotWidget.h>
Public Member Functions | |
void | labelPen (size_t pen, const std::string &label) |
PlotWidget () | |
void | addPorts () |
PlotWidget (const PlotWidget &x) | |
PlotWidget (PlotWidget &&x) | |
float | width () const |
float | height () const |
const PlotWidget * | plotWidgetCast () const override |
PlotWidget * | plotWidgetCast () override |
std::string const & | xlabel () const |
shadowed label commands to allow latex intepretation More... | |
std::string const & | xlabel (const std::string &x) |
std::string const & | ylabel () const |
std::string const & | ylabel (const std::string &x) |
std::string const & | y1label () const |
std::string const & | y1label (const std::string &x) |
void | addPlotPt (double t) |
add another plot point More... | |
void | updateIcon (double t) override |
update display after a step() More... | |
void | addConstantCurves () |
add vector/tensor curves to plot More... | |
void | connectVar (const std::shared_ptr< VariableValue > &var, unsigned port) |
connect variable var to port port. More... | |
void | disconnectAllVars () |
void | draw (cairo_t *cairo) const override |
draw this item into a cairo context More... | |
void | requestRedraw () |
redraw plot using current data to all open windows More... | |
void | redrawWithBounds () override |
void | makeDisplayPlot () |
add this as a display plot to its group More... | |
void | resize (const LassoBox &) override |
resize this item on the canvas More... | |
ClickType::Type | clickType (float x, float y) const override |
returns the clicktype given a mouse click at x, y. More... | |
bool | contains (float x, float y) const override |
void | autoScale () |
set autoscaling More... | |
void | scalePlot () |
sets the plot scale and pen labels More... | |
void | exportAsCSV (const string &filename) |
export the plotted data as a CSV file More... | |
void | destroyFrame () override |
destroy any popup windows associated with this More... | |
std::set< std::string > | availableMarkers () const |
return list of variables that could be attached to markers More... | |
virtual float | x () const |
virtual float | y () const |
size_t | numLines () const |
number of input ports along a side More... | |
size_t | numLines (size_t n) |
number of input ports along a side More... | |
double | barWidth () const |
bar chart bar width control More... | |
double | barWidth (double w) |
bar chart bar width control More... | |
void | mouseDown (float, float) override |
handle mouse events More... | |
void | mouseMove (float, float) override |
handle mouse events More... | |
void | mouseUp (float x, float y) override |
handle mouse events More... | |
bool | onMouseOver (float, float) override |
handle mouse events More... | |
void | onMouseLeave () override |
handle mouse events More... | |
![]() | |
std::string | classType () const override |
ItemT * | clone () const override |
void | TCL_obj (classdesc::TCL_obj_t &t, const std::string &d) override |
void | RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) override |
dummy template definition for use with gui executable More... | |
void | RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) const override |
void | json_pack (classdesc::json_pack_t &j) const override |
ItemT ()=default | |
ItemT (const ItemT &)=default | |
ItemT (ItemT &&)=delete | |
ItemT & | operator= (const ItemT &)=default |
ItemT & | operator= (ItemT &&)=delete |
![]() | |
Item () | |
virtual std::weak_ptr< Port > | ports (std::size_t i) const |
callback to be run when item deleted from group More... | |
std::size_t | portsSize () const |
number of ports More... | |
float | portX (std::size_t i) |
float | portY (std::size_t i) |
bool | contains (const Point &p) const |
void | updateBoundingBox () override |
void | throw_error (const std::string &) const |
mark item on canvas, then throw More... | |
virtual bool | ioVar () const |
indicates this is a group I/O variable More... | |
virtual double | value () const |
current value of output port More... | |
double | rotation () const |
double | rotation (const double &r) |
std::pair< double, bool > | rotationAsRadians () const |
return the rotation as radians, and whether rotation should have additional straight angle added for text that stays upright. More... | |
float | iWidth () const |
float | iWidth (const float &w) |
float | iHeight () const |
float | iHeight (const float &h) |
virtual void | flip () |
rotate icon though 180∘ More... | |
std::string | id () const |
return an id uniquely identifying this item More... | |
virtual float | x () const |
virtual float | y () const |
virtual float | zoomFactor () const |
void | ensureBBValid () const |
float | width () const |
float | height () const |
virtual std::vector< Point > | corners () const |
float | left () const |
float | right () const |
float | top () const |
float | bottom () const |
std::string | bookmarkId () const |
Id of bookmark associated with this. More... | |
void | adjustBookmark () const override |
adjust bookmark list to reflect current configuration More... | |
float | resizeHandleSize () const |
resize handles should be at least a percentage if the icon size (#1025) More... | |
virtual bool | onResizeHandle (float x, float y) const |
virtual bool | inItem (float x, float y) const |
virtual bool | onItem (float x, float y) const |
returns true if (x,y) is on the icon More... | |
virtual void | onMouseDown (float x, float y) |
respond to mouse down events More... | |
virtual void | onMouseUp (float x, float y) |
respond to mouse up events More... | |
virtual bool | onMouseMotion (float x, float y) |
respond to mouse motion events with button pressed More... | |
virtual bool | onKeyPress (int keySym, const std::string &utf8, int state) |
respond to key press events More... | |
virtual void | deleteAttachedWires () |
delete all attached wires More... | |
virtual bool | visible () const |
whether this item is visible on the canvas. More... | |
void | moveTo (float x, float y) |
virtual float | scaleFactor () const |
factor by which item has been resized More... | |
virtual float | scaleFactor (const float &sf) |
void | dummyDraw () const |
draw into a dummy cairo context, for purposes of calculating port positions More... | |
virtual void | displayTooltip (cairo_t *, const std::string &) const |
display tooltip text, eg on mouseover More... | |
Item (const Item &)=default | |
Item & | operator= (const Item &)=default |
virtual | ~Item () |
void | drawPorts (cairo_t *cairo) const |
virtual void | drawResizeHandles (cairo_t *cairo) const |
virtual std::shared_ptr< Port > | closestOutPort (float x, float y) const |
returns closest output port to x,y More... | |
virtual std::shared_ptr< Port > | closestInPort (float x, float y) const |
virtual std::shared_ptr< Item > | select (float x, float y) const |
returns the variable if point (x,y) is within a visible variable icon, null otherwise. More... | |
void | RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) override |
runs the RESTProcess descriptor suitable for this type More... | |
void | RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) const override |
virtual void | displayDelayedTooltip (float x, float y) |
enable extended tooltip help message appropriate for mouse at (x,y) More... | |
virtual void | disableDelayedTooltip () |
virtual bool | editorMode () const |
some items have an editor mode attribute More... | |
virtual void | toggleEditorMode () |
virtual Units | units (bool check=false) const |
compute the dimensional units More... | |
Units | checkUnits () const |
perform units consistency checks More... | |
ItemPtr | itemPtrFromThis () const |
return a shared_ptr to this More... | |
![]() | |
virtual std::string const & | detailedText () const |
virtual std::string const & | detailedText (const std::string &x) |
virtual std::string const & | tooltip () const |
virtual std::string const & | tooltip (const std::string &x) |
virtual | ~NoteBase ()=default |
![]() | |
const RenderFrameArgs & | frameArgs () const |
~RenderNativeWindow () override | |
virtual void | init () |
perform any initialisation of any subclasses of this More... | |
void | renderFrame (const RenderFrameArgs &args) |
void | destroyFrame () |
void | draw () |
void | requestRedraw () |
void | macOSXRedraw () |
RenderNativeWindow & | operator= (const RenderNativeWindow &x) |
RenderNativeWindow ()=default | |
RenderNativeWindow (const RenderNativeWindow &)=default | |
virtual bool | hasScrollBars () const |
return whether this window has scrollbars (needed for MacOSX). More... | |
![]() | |
virtual void | controlMouseDown (float x, float y) |
virtual void | zoom (double x, double y, double z) |
virtual void | moveTo (float x, float y) |
move this so that (x,y) is centred More... | |
virtual std::vector< float > | position () const |
current centre coordinates More... | |
virtual double | zoomFactor () const |
virtual bool | keyPress (const KeyPressArgs &) |
handle key press over current itemFocus, More... | |
virtual bool | getItemAt (float x, float y) |
item or wire obtained by get*At() calls More... | |
virtual bool | getWireAt (float x, float y) |
item or wire obtained by get*At() calls More... | |
Public Attributes | |
std::vector< std::vector< std::shared_ptr< VariableValue > > > | yvars |
variable port attached to (if any) More... | |
std::vector< std::shared_ptr< VariableValue > > | xvars |
std::vector< std::string > | penLabels |
std::shared_ptr< VariableValue > | xminVar |
variable ports specifying plot size More... | |
std::shared_ptr< VariableValue > | xmaxVar |
std::shared_ptr< VariableValue > | yminVar |
std::shared_ptr< VariableValue > | ymaxVar |
std::shared_ptr< VariableValue > | y1minVar |
std::shared_ptr< VariableValue > | y1maxVar |
double | xmin =nan("") |
Settable bounds values if above variables not connected NaN means autocalculate from data. More... | |
double | xmax =xmin |
double | ymin =xmin |
double | ymax =xmin |
double | y1min =xmin |
double | y1max =xmin |
unsigned | displayNTicks {3} |
number of ticks to show in canvas item More... | |
double | displayFontSize {3} |
std::vector< std::string > | horizontalMarkers |
markers at a position given by a named variable/parameter More... | |
std::vector< std::string > | verticalMarkers |
std::string | title |
PlotType | plotType =automatic |
automatic means choose line or bar depending on the x-vector type. More... | |
![]() | |
float | m_x =0 |
float | m_y =0 |
position in canvas, or within group More... | |
float | m_sf =1 |
scale factor of item on canvas, or within group More... | |
bool | onResizeHandles =false |
set to true to indicate mouse is ovcaler resize handles More... | |
bool | onBorder =false |
true to indicate mouse hovering over border More... | |
std::string | deleteCallback |
BoundingBox | bb |
canvas bounding box. More... | |
![]() | |
bool | mouseFocus =false |
true if target of a mouseover More... | |
bool | selected =false |
true if selected for cut, copy or group operation More... | |
bool | bookmark =false |
Is this item also a bookmark? More... | |
![]() | |
ItemPtr | item |
item or wire obtained by get*At() calls More... | |
WirePtr | wire |
item or wire obtained by get*At() calls More... | |
Static Public Attributes | |
static constexpr unsigned | nBoundsPorts =6 |
number of bounds (xmin/xmax, ymin/ymax, y1min/y1max) ports More... | |
![]() | |
static ecolab::cairo::Colour | backgroundColour {0.8,0.8,0.8,1} |
Private Member Functions | |
CLASSDESC_ACCESS (PlotWidget) | |
bool | redraw (int, int, int, int) override |
size_t | startPen (size_t port) const |
returns to starting pen number for input port More... | |
Private Attributes | |
double | clickX |
double | clickY |
double | oldLegendLeft |
double | oldLegendTop |
double | oldLegendFontSz |
ClickType::Type | ct |
classdesc::Exclude< boost::posix_time::ptime > | lastAdd {boost::posix_time::microsec_clock::local_time()} |
classdesc::Exclude< boost::posix_time::ptime > | lastAccumulatedBlitTime {boost::posix_time::microsec_clock::local_time()} |
bool | justDataChanged =false |
bool | xIsSecsSinceEpoch =false |
std::string | m_xlabel |
std::string | m_ylabel |
std::string | m_y1label |
double | yoffs =0 |
extra offset for titles More... | |
Formatter | formatter =defaultFormatter |
size_t | m_numLines =1 |
number of ports on the side More... | |
bool | clearPensOnLabelling =false |
Static Private Attributes | |
static constexpr double | portSpace =10 |
Friends | |
struct | SchemaHelper |
struct | PlotItem |
Additional Inherited Members | |
![]() | |
static void | drawSelected (cairo_t *cairo) |
![]() | |
static double | scaleFactor () |
![]() | |
static void | drawResizeHandle (cairo_t *cairo, double x, double y, double sf, double angle) |
![]() | |
double | m_width =10 |
double | m_height =10 |
ItemPortVector | m_ports |
minsky::Item::MemoisedRotator | memoisedRotator |
a container item for a plot widget
Definition at line 46 of file plotWidget.h.
minsky::PlotWidget::PlotWidget | ( | ) |
Definition at line 66 of file plotWidget.cc.
|
inline |
Definition at line 121 of file plotWidget.h.
|
inline |
Definition at line 122 of file plotWidget.h.
void minsky::PlotWidget::addConstantCurves | ( | ) |
add vector/tensor curves to plot
Definition at line 555 of file plotWidget.cc.
References minsky::cminsky(), minsky::defang(), minsky::anonymous_namespace{userFunction.cc}::isfinite(), minsky::maxNumTensorElementsToPlot, minsky::str(), minsky::valueId(), and minsky::yearToPTime().
void minsky::PlotWidget::addPlotPt | ( | double | t | ) |
add another plot point
Definition at line 458 of file plotWidget.cc.
References minsky::accumulatedBlitTime, minsky::cminsky(), minsky::anonymous_namespace{userFunction.cc}::isfinite(), minsky::maxNumTensorElementsToPlot, minsky::Simulation::timeUnit, minsky::timeUnit, minsky::to_string(), minsky::valueId(), and minsky::yearToPTime().
void minsky::PlotWidget::addPorts | ( | ) |
Definition at line 81 of file plotWidget.cc.
|
inline |
set autoscaling
Definition at line 180 of file plotWidget.h.
set< string > minsky::PlotWidget::availableMarkers | ( | ) | const |
return list of variables that could be attached to markers
Definition at line 837 of file plotWidget.cc.
References minsky::uqName().
double minsky::PlotWidget::barWidth | ( | ) | const |
bar chart bar width control
Definition at line 446 of file plotWidget.cc.
double minsky::PlotWidget::barWidth | ( | double | w | ) |
|
private |
|
overridevirtual |
returns the clicktype given a mouse click at x, y.
Reimplemented from minsky::Item.
Definition at line 399 of file plotWidget.cc.
References minsky::portRadius.
void minsky::PlotWidget::connectVar | ( | const std::shared_ptr< VariableValue > & | var, |
unsigned | port | ||
) |
connect variable var to port port.
Definition at line 801 of file plotWidget.cc.
References minsky::var.
|
inlineoverridevirtual |
Reimplemented from minsky::Item.
Definition at line 176 of file plotWidget.h.
References minsky::ClickType::outside.
|
inlineoverridevirtual |
destroy any popup windows associated with this
Reimplemented from minsky::Item.
Definition at line 199 of file plotWidget.h.
References minsky::RenderNativeWindow::destroyFrame().
void minsky::PlotWidget::disconnectAllVars | ( | ) |
Definition at line 830 of file plotWidget.cc.
|
overridevirtual |
draw this item into a cairo context
Reimplemented from minsky::Item.
Definition at line 93 of file plotWidget.cc.
References minsky::anonymous_namespace{plotWidget.cc}::boundX, minsky::anonymous_namespace{plotWidget.cc}::boundY, minsky::drawTriangle(), minsky::latexToPango(), M_PI, minsky::anonymous_namespace{plotWidget.cc}::orient, and minsky::anonymous_namespace{plotWidget.cc}::titleHeight.
|
inline |
export the plotted data as a CSV file
Definition at line 197 of file plotWidget.h.
|
inline |
Definition at line 131 of file plotWidget.h.
References minsky::Item::height().
|
inline |
Definition at line 95 of file plotWidget.h.
References minsky::latexToPango().
void minsky::PlotWidget::makeDisplayPlot | ( | ) |
add this as a display plot to its group
Definition at line 384 of file plotWidget.cc.
|
overridevirtual |
handle mouse events
Reimplemented from minsky::EventInterface.
Definition at line 305 of file plotWidget.cc.
References minsky::anonymous_namespace{plotWidget.cc}::titleHeight.
|
overridevirtual |
handle mouse events
Reimplemented from minsky::EventInterface.
Definition at line 319 of file plotWidget.cc.
References f, and minsky::anonymous_namespace{plotWidget.cc}::titleHeight.
|
inlineoverridevirtual |
handle mouse events
Reimplemented from minsky::EventInterface.
Definition at line 187 of file plotWidget.h.
References minsky::ClickType::outside.
|
inline |
number of input ports along a side
Definition at line 125 of file plotWidget.h.
size_t minsky::PlotWidget::numLines | ( | size_t | n | ) |
number of input ports along a side
Definition at line 435 of file plotWidget.cc.
|
inlineoverridevirtual |
|
overridevirtual |
|
inlineoverride |
Definition at line 133 of file plotWidget.h.
|
inlineoverride |
Definition at line 134 of file plotWidget.h.
|
overrideprivate |
Definition at line 372 of file plotWidget.cc.
|
inlineoverride |
Definition at line 169 of file plotWidget.h.
void minsky::PlotWidget::requestRedraw | ( | ) |
redraw plot using current data to all open windows
Definition at line 363 of file plotWidget.cc.
|
overridevirtual |
resize this item on the canvas
Reimplemented from minsky::Item.
Definition at line 389 of file plotWidget.cc.
References minsky::LassoBox::x0, minsky::LassoBox::x1, minsky::LassoBox::y0, and minsky::LassoBox::y1.
void minsky::PlotWidget::scalePlot | ( | ) |
sets the plot scale and pen labels
Definition at line 218 of file plotWidget.cc.
References minsky::cminsky(), minsky::anonymous_namespace{userFunction.cc}::isfinite(), minsky::Simulation::timeUnit, minsky::timeUnit, minsky::uqName(), minsky::wire, and minsky::yearToPTime().
|
private |
returns to starting pen number for input port
Definition at line 792 of file plotWidget.cc.
|
inlineoverridevirtual |
update display after a step()
Reimplemented from minsky::Item.
Definition at line 160 of file plotWidget.h.
|
inline |
Definition at line 130 of file plotWidget.h.
References minsky::Item::width().
float minsky::Item::x |
Definition at line 107 of file item.cc.
|
inline |
|
inline |
Definition at line 138 of file plotWidget.h.
References minsky::latexToPangoNonItalicised().
float minsky::Item::y |
Definition at line 114 of file item.cc.
|
inline |
Definition at line 147 of file plotWidget.h.
|
inline |
Definition at line 148 of file plotWidget.h.
References minsky::latexToPangoNonItalicised().
|
inline |
Definition at line 142 of file plotWidget.h.
|
inline |
Definition at line 143 of file plotWidget.h.
References minsky::latexToPangoNonItalicised().
|
friend |
Definition at line 62 of file plotWidget.h.
|
friend |
Definition at line 52 of file plotWidget.h.
|
private |
Definition at line 79 of file plotWidget.h.
|
private |
Definition at line 49 of file plotWidget.h.
|
private |
Definition at line 49 of file plotWidget.h.
|
private |
Definition at line 50 of file plotWidget.h.
double minsky::PlotWidget::displayFontSize {3} |
Definition at line 109 of file plotWidget.h.
unsigned minsky::PlotWidget::displayNTicks {3} |
number of ticks to show in canvas item
Definition at line 108 of file plotWidget.h.
|
private |
Definition at line 73 of file plotWidget.h.
std::vector<std::string> minsky::PlotWidget::horizontalMarkers |
markers at a position given by a named variable/parameter
Definition at line 111 of file plotWidget.h.
|
mutableprivate |
Definition at line 61 of file plotWidget.h.
|
private |
Definition at line 57 of file plotWidget.h.
|
private |
Definition at line 56 of file plotWidget.h.
|
private |
number of ports on the side
Definition at line 74 of file plotWidget.h.
|
private |
Definition at line 68 of file plotWidget.h.
|
private |
Definition at line 68 of file plotWidget.h.
|
private |
Definition at line 68 of file plotWidget.h.
|
static |
number of bounds (xmin/xmax, ymin/ymax, y1min/y1max) ports
Definition at line 87 of file plotWidget.h.
|
private |
Definition at line 49 of file plotWidget.h.
|
private |
Definition at line 49 of file plotWidget.h.
|
private |
Definition at line 49 of file plotWidget.h.
std::vector<std::string> minsky::PlotWidget::penLabels |
Definition at line 94 of file plotWidget.h.
PlotType minsky::PlotWidget::plotType =automatic |
automatic means choose line or bar depending on the x-vector type.
Definition at line 117 of file plotWidget.h.
|
staticprivate |
Definition at line 48 of file plotWidget.h.
std::string minsky::PlotWidget::title |
Definition at line 114 of file plotWidget.h.
std::vector<std::string> minsky::PlotWidget::verticalMarkers |
Definition at line 112 of file plotWidget.h.
|
private |
Definition at line 64 of file plotWidget.h.
double minsky::PlotWidget::xmax =xmin |
Definition at line 106 of file plotWidget.h.
std::shared_ptr<VariableValue> minsky::PlotWidget::xmaxVar |
Definition at line 103 of file plotWidget.h.
double minsky::PlotWidget::xmin =nan("") |
Settable bounds values if above variables not connected NaN means autocalculate from data.
Definition at line 106 of file plotWidget.h.
std::shared_ptr<VariableValue> minsky::PlotWidget::xminVar |
variable ports specifying plot size
Definition at line 103 of file plotWidget.h.
std::vector<std::shared_ptr<VariableValue> > minsky::PlotWidget::xvars |
Definition at line 91 of file plotWidget.h.
double minsky::PlotWidget::y1max =xmin |
Definition at line 106 of file plotWidget.h.
std::shared_ptr<VariableValue> minsky::PlotWidget::y1maxVar |
Definition at line 103 of file plotWidget.h.
double minsky::PlotWidget::y1min =xmin |
Definition at line 106 of file plotWidget.h.
std::shared_ptr<VariableValue> minsky::PlotWidget::y1minVar |
Definition at line 103 of file plotWidget.h.
double minsky::PlotWidget::ymax =xmin |
Definition at line 106 of file plotWidget.h.
std::shared_ptr<VariableValue> minsky::PlotWidget::ymaxVar |
Definition at line 103 of file plotWidget.h.
double minsky::PlotWidget::ymin =xmin |
Definition at line 106 of file plotWidget.h.
std::shared_ptr<VariableValue> minsky::PlotWidget::yminVar |
Definition at line 103 of file plotWidget.h.
|
mutableprivate |
extra offset for titles
Definition at line 71 of file plotWidget.h.
std::vector<std::vector<std::shared_ptr<VariableValue> > > minsky::PlotWidget::yvars |
variable port attached to (if any)
Definition at line 90 of file plotWidget.h.