14 #include "msdevstudio/MSconfig.h"
34 : m_aspect_ratio ( 0.0 ),
39 m_parent_plotter( 0 ),
40 m_parent_datarep_index( -1 )
49 : m_aspect_ratio ( 0.0 ),
54 m_parent_plotter( 0 ),
55 m_parent_datarep_index( -1 )
65 m_aspect_ratio ( plotter.m_aspect_ratio ),
66 m_name ( plotter.m_name ),
67 m_title( plotter.m_title ),
68 m_parent_plotter( plotter.m_parent_plotter ),
69 m_parent_datarep_index( plotter.m_parent_datarep_index ),
70 m_views( plotter.m_views ),
71 m_currentView( plotter.m_currentView )
255 if ( title !=
"%t" ) {
260 if ( index == -1 ) index = 0;
263 if ( rep != 0 ) rep ->
setTitle ( title );
276 if ( index < 0 ) index = 0;
283 const std::string & label )
329 setRange (
const std::string & axis,
double low,
double high )
332 const Range range ( low, high );
334 setRange ( type, range,
true,
true );
385 index = std::max ( 0, index );
576 std::vector < double > & )
const
644 const std::vector < std::string > & labels )
646 unsigned int size = values.size ();
647 vector < AxisTick > ticks ( size );
649 for (
unsigned int i = 0; i <
size; i++ ) {
650 ticks[i].setValue ( values[i] );
651 ticks[i].setContent ( labels[i] );
660 const std::vector < double > & values,
661 const std::vector < std::string > & labels )
663 unsigned int size = values.size ();
664 vector < AxisTick > ticks ( size );
666 for (
unsigned int i = 0; i <
size; i++ ) {
667 ticks[i].setValue ( values[i] );
668 ticks[i].setContent ( labels[i] );
690 return range.
high ();
732 if ( to_select == number ) {
756 saveView (
const std::vector<double> & range_values )
758 if (range_values.size() != 4) {
760 "Invalid number of range values.");
762 m_views.push_back(range_values);
777 if (range_values.size() != 4) {
779 "Invalid number of range values.");
781 vector < vector < double > > :: iterator iter =
m_views.begin ();
783 m_views.insert( iter , range_values);
785 for (
unsigned int k =
m_views.size() - 1 ; k>i; k--) {
822 if (
m_views.size() == 0 || index < 0 ||
823 index >=
static_cast<int>(
m_views.size()) ) {
824 string what (
"PlotterBase::setView: Invalid plot view index " );
838 return static_cast<int>(
m_views.size());
845 std::vector< std::vector<double> > views;
846 for (
unsigned int i = 0; i <
m_views.size(); i++) {
847 if (static_cast<int>(i) != index) {
853 if (index > 0 &&
m_views.size() > 0) {
898 Range r = proj -> dataRangeOn ( axis );
902 const std::vector <double> &
910 const std::vector <unsigned int> &
virtual const std::string & getInternalTitle() const
Returns the internal title.
PlotterBase * m_parent_plotter
Parent plotter.
virtual void setAutoRanging(const std::string &axis, bool flag)
Sets the auto-ranging.
virtual double getBinWidth(Axes::Type axis) const
Returns the bin width.
virtual void setAutoTicks(Axes::Type axis, bool yes)
Sets automatic generation of axis ticks.
virtual void update()=0
Updates the plotter.
virtual const BinToColor * getValueRep() const
Returns the value to color representation.
The base class for the PlotterBase hierarchy.
virtual void setLowRange(Axes::Type axis, int parm, bool dragging)
Sets the low end of the Range of data displayed.
const std::string & getTitle() const
Gets the title to be displayed.
virtual void setZMargin(double z)
virtual bool isAutoRanging(Axes::Type axis) const
Returns true if auto-ranging is enabled, otherwise returns false.
virtual void setNumberOfBins(const std::string &axis, unsigned int number)
Sets the number of bins.
virtual double getScaleFactor(Axes::Type axis) const
Returns 1.0.
virtual void setOffsets(double xoffset, double yoffset)
Sets the offsets on the x and y axis.
virtual bool getShowGrid()
Gets the show-grid status to update the inspector.
virtual void setFitsTransform(const std::string &)
Set the fits transform object.
bool current_range_saved
Returns true if the current range on the axes have been saved.
virtual double getBottomMargin()
virtual void prepareToDraw()
Prepare the plotter for drawing.
const Rect & getRawRect() const
Returns the raw rectangle before transform.
PlotterBase()
Default constructor needed to ensure m_plotterId is set.
A abstract base class for font handling.
virtual Range getDataRange(Axes::Type axis)
Return the range of the raw data on the specified axis.
virtual int plotterId() const
The unique ID number of this plotter.
virtual void reset()
Resets the bins.
PlotterException class interface.
virtual bool isReverse() const
Return true if reverse is enabled, otherwise returns false.
AxisTick class interface.
virtual void setOffset(Axes::Type axis, double offset)
Sets the offset.
virtual AxisModelBase * getAxisModel(Axes::Type axis) const
Returns the AxisModelBase derived class for the specified axis.
virtual const std::vector< double > & getZValues()
Returns all Z values.
virtual void setCutRangeAt(const Range &range, unsigned int i)
Sets the Range of a TupleCut object.
virtual void fillCutList(std::vector< const TupleCut * > &cuts) const
Fills the cuts vector with the TupleCut objects contained by the DataRep objects, if any...
Part of an implementation of the Observable Observer pattern based on the example implementation in t...
void setCrossX(double val)
Set the crossX value.
virtual DataRep * getTarget() const
Returns the target DataRep contained by the plotter.
virtual double getZValue(double x, double y, bool scaled=true) const
Get the z value at the specified point (x,y).
virtual void setNeedUpdate(bool isChanged)
Set the m_need_update flag, called by inspector.
virtual bool hasZoomY() const
Returns true if the plotter has zoom feature on the Y axis, otherwise returns false.
virtual FontBase * labelFont(Axes::Type axes) const
What font is being used to override the default while drawing axis label.
virtual void matrixTranspose(bool yes)
Transpose the X and Y axis of matrix representation.
Type convert(const std::string &axis)
Converts from string representation ot Axes::Type representation.
virtual ~PlotterBase()
The virtual destructor.
virtual NTuple * createPickTuple()
Creates a DataSource for a PickTable.
virtual void autoScale()
Auto scales the Range of the axes using preferred Range from the points plotters. ...
virtual double getOffset(Axes::Type axis) const
Returns the offset on designated axis, similarly to getBinWidth.
The base class for the value to the color transformation.
int numViews() const
Return the number of stored views.
virtual void drawCrossHairs(ViewBase *view)
Draws cross-hairs.
virtual double getAspectRatio() const
Returns the aspect ratio.
virtual double getHighRangeOnX() const
Returns the high end of the X axis range.
virtual PlotterBase * getParentPlotter() const
Returns the parent plotter.
hippodraw::PlotterBase class interface.
virtual double getPosRange(Axes::Type axis) const
Returns the smallest positive number from the data.
void setTitle(const std::string &title)
Sets the title to be displayed.
A transform that transforms coordinates from one coordinate system to another.
virtual void setScaleFactor(Axes::Type axis, double factor)
Sets the scale factor on the specified axis.
virtual void notifyObservers() const
Notifies Observer objects of a change.
virtual const std::vector< unsigned int > & getShape()
virtual double getLeftMargin()
virtual bool getCurrentRangeSaved()
Returns current_range_saved member t.
virtual TransformBase * getTransform() const
Returns the transform object used by the plotter.
virtual void setActivePlot(int index, bool redraw)
Sets the active plot.
A DataSource class implemented with std::vector to store the column data. ...
virtual void addDataRep(DataRep *rep)
Adds a DataRep object to the plotter.
double low() const
Returns the minimum of the range object.
virtual void setHighRange(Axes::Type axis, int parm, bool dragging)
Sets the high end of the Range of data displayed.
virtual double getTopMargin()
int saveViewAtIndex(const std::vector< double > &range_values, unsigned int i)
Save the current set of plot ranges which define a "view" for this plot.at the position i...
intp size(numeric::array arr)
virtual const Range & getRange(Axes::Type axis, bool scaled) const
Returns the range on the specified axis.
virtual bool isImageConvertable() const
Returns true if contents of the plotter is convertable to an image.
std::string m_name
The name of the type of plotter.
virtual void removeDataRep(DataRep *)
Removes the DataRep from the plot.
virtual void setTicks(Axes::Type axis, const std::vector< AxisTick > &ticks)
Sets the ticks for the specified axis.
virtual bool getBoxEdge()
Get the box-edge status to update the inspector.
virtual ProjectorBase * getProjector(int i) const
Returns the projector at index i.
virtual int getMinEntries()
Get the minimum entries/bin.
An exception class that is thrown when attempting an illegal operation on a PlotterBase object...
virtual const FontBase * titleFont() const
What font is being used to override the default while drawing title of plot.
void deleteView(int index)
Delete a view by index.
PyArray_TYPES type(numeric::array arr)
virtual ProjectorBase * activeProjector() const
Returns the active projector.
string convert(int i)
Converts an integer to a string.
const std::string & name() const
Returns the name of the plotter.
void setAspectRatio(double ratio)
Sets the aspect ratio.
int saveView(const std::vector< double > &range_values)
Save the current set of plot ranges which define a "view" for this plot.
Rect m_raw_rect
The raw rectangle before transform.
virtual void setLabel(const std::string &axis, const std::string &label)
Sets the label of specified axis to label.
virtual const std::string & getInternalLabel(Axes::Type axis) const
Returns the internal label.
virtual int activePlotIndex() const
Returns the index of the active plotter.
virtual int getNumberOfEntries() const
Returns the number of entries in the contained DataRep.
virtual void setShowGrid(bool flag)
Sets the show-grid status to flag.
virtual void checkAxisScaling()
Check if Axis needs to be scaled or not.
virtual void setTransform(TransformBase *)
Sets the transform object.
Part of an implementation of the Observable-Observer pattern based on the example in the GOF Patterns...
const Rect & getUserRect() const
Returns the data space rectangle.
int m_plotterId
A unique plotter id.
int nextView(bool stepForward=true)
Cycle through each set of plot ranges, thereby changing the view with each call.
virtual void setBinWidth(Axes::Type axis, double width)
Sets the bin width.
virtual void setValueRep(BinToColor *rep)
Sets the object that will do the value to color transform, if any.
virtual void setBottomMargin(double bottom)
void setView(int index)
Set the view by index.
double m_aspect_ratio
The aspect ratio.
virtual void setCurrentRangeSaved(bool flag)
Sets current_range_saved member to flag.
virtual void setRange(Axes::Type axis, const Range &range, bool scaled=false, bool adjust_width=true)
Sets the range on the specified axis.
int m_parent_datarep_index
Parent DataRep index.
virtual bool wantsPixmap() const
Informs caller if the plotter prefers to use a pixmap or not.
void setCrossY(double val)
Set the crossY value.
virtual bool isTextPlotter() const
Return true if it's a text plotter.
static int s_plotters
Reference count for creating plotter ids.
virtual void setLeftMargin(double left)
double high() const
Returns the maximum of the range object.
virtual bool isTargetable() const
Returns true if receiving object is target-able.
double m_crossX
The x position of the cross hair.
virtual void setBoxEdge(bool flag)
Set the box-edge status to flag.
virtual void setParentPlotter(PlotterBase *plotter)
Sets the parent plotter.
Class representing a rectangle.
Rect m_user_rect
The abstract data space.
virtual DataRep * getDataRep(int index) const
Returns the specified DataRep or null pointer if it doesn't exits.
int currentView() const
Return the current view index.
The base class for data representations.
hippodraw::DataRep class interface.
virtual void setEnableZ(bool yes=true)
Enables the Z axis, if plotter has one.
virtual int getNumDataReps() const
Returns the number of DataRep objects contained in the plot.
virtual void setTicksOnX(const std::vector< double > &values, const std::vector< std::string > &labels)
Sets the ticks for the X axis.
virtual void setAutoTicksOnX(bool yes)
Sets automatic generation of axis ticks on X axis.
virtual void addValues(const std::vector< double > &v)
Adds data values to the plot.
virtual int getParentDataRepIndex() const
Returns the index of the parent DataRep.
virtual DataRep * selectedDataRep() const
Returns the selected DataRep.
std::vector< std::vector< double > > m_views
A vector of x and y ranges to be used as a circular buffer allowing one to cycle through the saved pl...
virtual TransformBase * getFitsTransform() const
Returns the fits transform object.
virtual void setMinEntries(int entries)
Set the minimum entries/bin.
virtual void setReverse(bool flag)
Set the reverse status to flag.
virtual void setScaling(Axes::Type axis, bool on=true)
Sets the scaling attribute of the AxisModelBase object.
virtual double getZMargin()
virtual void setTopMargin(double top)
Set and get additional margin on top,bottom,left of the plotter.
The AxisModelBase class maintains the Range and scaling of an axis.
virtual void fillPickedPointFrom(double mx, double my, std::vector< double > &picked) const
Fills the picked data point.
double m_crossY
The y position of the cross hair.
The namespace for conversion to string.
virtual bool hasAxis(Axes::Type axis) const
Returns true if the plotter has an axis of specified type.
bool hasAutoScaled() const
Returns true if the axes have already been auto-scaled.
virtual int indexOf(const DataRep *rep) const
Returns the index of the DataRep.
virtual bool isAxisScaled(Axes::Type axis) const
Returns false.
virtual double getLowRangeOnX() const
Returns the low end of the X axis range.
virtual void setParentDataRepIndex(int index)
Sets the index of the parent DataRep.
virtual void willDelete(const Observable *)
Notifies this Observer object that one of its Observable objects is about to be deleted.
int m_currentView
Index of the current view.
Expresses a range of values.
int getNumOfEntries() const
Returns the number of entries in the contained DataRep.
The base class for the Projector hierarchy.
virtual const std::string & getLabel(Axes::Type) const
Returns the label for the specified axis.
std::string m_title
The main label; the title of the plot.
void toggleActivePlot()
Toggles the active DataRep, if 2 or more are contained by the plotter.
hippodraw::ProjectorBase class interface.
The abstract base class for views.