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