14 #include "msdevstudio/MSconfig.h"
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,
The class for the 2D axes drawing with color.
double getY() const
A shortcut to get origin.Y.
The base class for the PlotterBase hierarchy.
const Rect & getMarginRect() const
Returns the rectangle area in which data points are drawn.
float YPADDING(ViewBase &view)
hippodraw::BinToColor class interface
double m_z_font_size
Font size for the Z axis label.
AxisLoc getLabelLocation() const
const std::vector< AxisTick > & getTicks() const
Returns a reference of generated ticks.
hippodraw::DataView class interface
hippodraw::BinaryTransform class interface
virtual Rect getDrawRect() const =0
Returns the drawing Rectangle in the devices coordinate system.
AxisTick class interface.
size_t ci_find(const string &str1, const string &str2)
Case insensitive find.
hippodraw::AxisRepColor class interface
double length() const
Returns the length of the range object.
The base class for the axis representation hierarchy.
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.
hippodraw::AxisModelBase class interface
PlotterBase * getPlotter() const
Returns the plotter used by this view.
double getX() const
A shortcut to get origin.X.
void drawZTickLines(const AxisModelBase &axisModel, const TransformBase &transform, ViewBase &view)
Draws the Z tick lines.
The base class for the value to the color transformation.
double getWidth() const
A shortcut to get size.width.
virtual bool needPMag() const
The following functions are used by the AxisRepBase * object.
FontBase * m_titleFont
The font to be used to for the Z label overriding the default font.
virtual float userToDrawColor(double c) const =0
Converts a coordinate in user space to drawing space along the color (X) axis.
hippodraw::PlotterBase class interface.
float XPADDING(ViewBase &view)
virtual void drawLatex(const std::string &eq, int position=0)
Draws a Latex equation.
A transform that transforms coordinates from one coordinate system to another.
FontBase * m_zLabelFont
The font to be used to for the Z label overriding the default font.
void drawZLabels(const AxisModelBase &axis_model, ViewBase &view, const std::string &z_label)
Draws the labels of the z axis.
void transformZ(double &z) const
Transforms the z coordinate.
double low() const
Returns the minimum of the range object.
double m_y_font_size
Font size for the Y axis label.
intp size(numeric::array arr)
float ZPADDING(ViewBase &view)
A transform that transforms coordinates from one 2D coordinate system to another. ...
string convert(int i)
Converts an integer to a string.
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.
The abstract base class for views that have a region for drawing data points with area around it for ...
A Color class for creating the color object following the standard RGB color space.
double m_y_tick_font_size
Font size for the y tick labels.
void drawXTickLabel(const std::string &label, float x, float y, ViewBase &view)
Draws a tick label for X axis.
virtual int pointSize() const =0
Get the pointsize of the font.
void drawZTickLabels(const AxisModelBase &axisModel, const TransformBase &transform, ViewBase &view)
Draws the labels for the Z ticks.
double getHeight() const
A shortcut to get size.height.
Class representing a rectangle.
double getPMag() const
Returns the magnitude of the power of ten for the tick labels.
virtual void drawColorScale(const BinToColor &, ViewBase &)
Draws the color scale bar.
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).
AxisRepColor()
The default constructor.
AxisRepBase * clone()
The clone function returns an object of its own kind which is a copy of this object at this moment...
virtual bool isLog() const =0
Returns a boolean describing the type of the scale of the axis.
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.
AxisLoc
The base class for the binner hierarchy.
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...
The AxisModelBase class maintains the Range and scaling of an axis.
The namespace for conversion to string.
Range getRange() const
Get the Range of expected values.
Expresses a range of values.
The abstract base class for views.