14 #include "msdevstudio/MSconfig.h"
42 using namespace hippodraw;
46 m_axis_z_origin( 0.0 ),
53 m_axis_z_origin( axis_rep.m_axis_z_origin ),
54 m_axis_depth( axis_rep.m_axis_depth )
85 const std::string & z_label )
92 string tex_snippet = z_label.substr(4);
101 float mx = margin_rect.
getX ();
103 float my = margin_rect.
getY ();
106 float y_font_size = ( dh - mh ) / 2 * 0.20;
107 float x_font_size = ( mw * 2 ) / z_label.size() * 2 / 3;
111 float x = mx + 0.5 * mw;
120 view.
drawText ( z_label, x, y, 0.0, 0.0,
'c',
'b',
142 const vector< AxisTick > & ticks = axisModel.
getTicks ();
143 if ( ticks.empty() )
return;
148 unsigned int size = 2 * ticks.size ();
156 double tick_length = 5;
157 double y_base = view_rect.
getY() - 24;
159 for (
unsigned int i = 0; i < ticks.size(); i++ ) {
160 double user_z = ticks[i].value ();
167 xv.push_back ( view_x );
168 yv.push_back ( y_base );
169 xv.push_back ( view_x );
170 yv.push_back ( y_base + tick_length );
182 vector < double > xv;
183 vector < double > yv;
185 const vector< AxisTick > & ticks = axisModel.
getTicks ();
186 unsigned int size = ticks.size ();
187 if ( size == 0 )
return;
196 for ( ; i <
size; i++ ) {
197 double value = ticks[i].value ();
199 xv.push_back ( value );
200 yv.push_back ( 1.0 );
207 float y = margin.
getY() - 42;
210 for ( ; i <
size; i++ ) {
217 if ( !(axisModel.
isLog() ) ) {
219 float xx = margin_rect.
getX()
224 double mag = axisModel.
getPMag ();
225 int i = static_cast <
int > ( mag );
244 double y_base = margin.
getY() - 22;
247 double value = range.
low ();
252 for (
float i = 0; i <= margin.
getWidth() ; i++ ) {
254 const Color & rep_color = plotter->repColor();
256 Color color = rep_color;
261 margin.
getX() + i + 1.0,
double m_y_font_size
Font size for the Y axis label.
The base class for the axis representation hierarchy.
The abstract base class for views.
double getHeight() const
A shortcut to get size.height.
hippodraw::AxisRepColor class interface
virtual Rect getDrawRect() const =0
Returns the drawing Rectangle in the devices coordinate system.
hippodraw::AxisModelBase class interface
virtual bool needPMag() const
The following functions are used by the AxisRepBase * object.
virtual float userToDrawColor(double c) const =0
Converts a coordinate in user space to drawing space along the color (X) axis.
size_t ci_find(const string &str1, const string &str2)
Case insensitive find.
FontBase * m_zLabelFont
The font to be used to for the Z label overriding the default font.
void transformZ(double &z) const
Transforms the z coordinate.
FontBase * m_titleFont
The font to be used to for the Z label overriding the default font.
Expresses a range of values.
hippodraw::PlotterBase class interface.
double getY() const
A shortcut to get origin.Y.
const Rect & getMarginRect() const
Returns the rectangle area in which data points are drawn.
virtual void drawLatex(const std::string &eq, int position=0)
Draws a Latex equation.
const std::vector< AxisTick > & getTicks() const
Returns a reference of generated ticks.
void drawZTickLabels(const AxisModelBase &axisModel, const TransformBase &transform, ViewBase &view)
Draws the labels for the Z ticks.
PlotterBase * getPlotter() const
Returns the plotter used by this view.
double getWidth() const
A shortcut to get size.width.
virtual void doubleToColor(double value, Color &color) const =0
This function does the actual calculation that transforms the given value into a color using the curr...
virtual void drawColorScale(const BinToColor &, ViewBase &)
Draws the color scale bar.
hippodraw::BinaryTransform class interface
AxisTick class interface.
virtual void drawViewLines(const std::vector< double > &x, const std::vector< double > &y, Line::Style style, bool color, float size)=0
Draws multiple line segments.
void drawZLabels(const AxisModelBase &axis_model, ViewBase &view, const std::string &z_label)
Draws the labels of the z axis.
double m_z_font_size
Font size for the Z axis label.
void drawXTickLabel(const std::string &label, float x, float y, ViewBase &view)
Draws a tick label for X axis.
Range getRange() const
Get the Range of expected values.
The base class for the value to the color transformation.
double m_y_tick_font_size
Font size for the y tick labels.
AxisRepBase * clone()
The clone function returns an object of its own kind which is a copy of this object at this moment...
virtual void drawText(const std::string &s, float x, float y, float fontsize, float angle=0.0, char xp= 'l', char yp= 't', bool resize=false, const FontBase *font=0, const Color *color=0)=0
Draws a text string at a point in the view's coordinate system.
float YPADDING(ViewBase &view)
A transform that transforms coordinates from one 2D coordinate system to another. ...
float ZPADDING(ViewBase &view)
void drawZTickLines(const AxisModelBase &axisModel, const TransformBase &transform, ViewBase &view)
Draws the Z tick lines.
AxisLoc
The base class for the binner hierarchy.
intp size(numeric::array arr)
string convert(int i)
Converts an integer to a string.
The abstract base class for views that have a region for drawing data points with area around it for ...
The class for the 2D axes drawing with color.
virtual void drawViewSquare(float x1, float y1, float x2, float y2, int red, int green, int blue)=0
Draws a colored square in view space.
The base class for the PlotterBase hierarchy.
AxisRepColor()
The default constructor.
The namespace for conversion to string.
hippodraw::BinToColor class interface
A Color class for creating the color object following the standard RGB color space.
virtual bool isLog() const =0
Returns a boolean describing the type of the scale of the axis.
double length() const
Returns the length of the range object.
Class representing a rectangle.
double low() const
Returns the minimum of the range object.
void drawAllZTicks(const AxisModelBase &axis_model, const TransformBase &transform, ViewBase &view)
Takes care of the z ticks drawing (that is, the ticks on the top of the plot).
hippodraw::DataView class interface
virtual int pointSize() const =0
Get the pointsize of the font.
float XPADDING(ViewBase &view)
A transform that transforms coordinates from one coordinate system to another.
The AxisModelBase class maintains the Range and scaling of an axis.
double getPMag() const
Returns the magnitude of the power of ten for the tick labels.
double getX() const
A shortcut to get origin.X.
AxisLoc getLabelLocation() const