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