13 #include "msdevstudio/MSconfig.h"
31 using namespace hippodraw;
78 namespace dp = hippodraw::DataPoint3DTuple;
89 double high = range.
high();
90 double low = range.
low();
96 bt -> transformZ ( high );
97 bt -> transformZ ( low );
99 Range newrange ( low, high );
101 const Rect & user_rect = view -> getUserRect ();
103 const Rect & raw_rect = view -> getRawRect();
105 bool isLinear = bt -> isLinearInXY ();
106 bool surpress_zero = low == 0.0;
108 unsigned int size = ntuple -> rows ();
115 bool isPeriodic = bt -> isPeriodic();
125 beta = pbt -> xOffset ();
126 gamma = pbt -> yOffset ();
127 max_x = pbt -> limitX().high();
133 for (
unsigned int i = 0;
i <
size;
i++ ) {
134 const vector < double > & row = ntuple -> getRow (
i );
136 double value = row [
dp::Z ];
137 if ( surpress_zero && value == 0.0 )
continue;
139 double half_xwidth = row [
dp::XERR ];
140 double half_ywidth = row [
dp::YERR ];
142 double x = row [
dp::X ];
143 double y = row [
dp::Y ];
151 rotate ( x, y, 0.0, beta, gamma, (max_x==180) );
155 double x1 = x - half_xwidth;
156 double y1 = y - half_ywidth;
157 double x2 = x + half_xwidth;
158 double y2 = y + half_ywidth;
175 if ( isLinear ==
false ) {
176 bt -> transform ( xtl, ytl );
177 bt -> transform ( xbl, ybl );
178 bt -> transform ( xtr, ytr );
179 bt -> transform ( xbr, ybr );
184 if ( isLinear ==
false ) {
185 std::vector <double> xx;
190 std::vector <double> yy;
196 view -> drawPolygon ( xx, yy, black, black );
198 const int gray = 256;
199 view -> drawSquare ( x1, y1, x2, y2, gray, gray, gray );
205 bt -> transformZ ( value );
209 if ( value > user_rect.
getZ() ) {
222 if ( isLinear ==
false ) {
224 std::vector <double> xx;
229 std::vector <double> yy;
235 view -> drawPolygon ( xx, yy, color,
m_box_edge?black:color );
242 view -> drawSquare ( xtl, ytl, xbr, ybr,
247 std::vector<double> x;
254 std::vector<double> y;
281 double alpha,
double beta,
double gamma,
bool negative )
283 if ( !negative ) lat-=180.0;
286 lat = M_PI * lat / 180.0;
287 lon = M_PI * lon / 180.0;
288 alpha = M_PI * alpha / 180.0;
289 beta = M_PI * beta / 180.0;
290 gamma = M_PI * gamma / 180.0;
294 double x = cos( lat ) * cos( lon );
295 double y = sin( lat ) * cos( lon );
296 double z = sin( lon );
300 double ry = y * cos( alpha ) + z * sin( alpha );
301 double rz = - y * sin( alpha ) + z * cos( alpha );
303 x = rx; y = ry; z = rz;
306 rx = x * cos( beta ) - z * sin( beta );
308 rz = x * sin( beta ) + z * cos( beta );
310 x = rx; y = ry; z = rz;
313 rx = x * cos( gamma ) + y * sin( gamma );
314 ry = - x * sin( gamma ) + y * cos( gamma );
317 x = rx; y = ry; z = rz;
320 lon = ( 180.0 / M_PI ) * asin( z );
321 lat = ( 180.0 / M_PI ) * atan2( y, x );
323 if ( !negative ) lat+=180.0;
hippodraw::ColorBoxPointRep class interface
ColorBoxPointRep()
The default constructor.
A PointRep class that draws a colored box to represent the value.
bool m_desel
A flag to indicate the representation is de-selected.
virtual void setValueTransform(BinToColor *)
Sets the value transform.
static void rotate(double &lat, double &lon, double alpha, double beta, double gamma, bool negative=true)
The following function do a rotation for periodic transform.
double high() const
Returns the maximum of the range object.
void makeInBounds(double &x, double &y) const
Changes the coordinates so that they are inside or on the boundary of the rectangle.
A transform that transforms coordinates from one coordinate system to another.
The base class for the value to the color transformation.
bool isInDepth(double z1) const
Checks the value against the depth to see if it is in bounds.
static BinToColorFactory * instance()
Returns a pointer to the singleton instance.
hippodraw::PeriodicBinaryTransform class interface
virtual RepBase * clone()
The clone function returns an object of its own kind which is a copy of this object at this moment...
BinToColor * m_bin_to_color
The following function transforms the projected value to a color scale.
bool m_box_edge
Flag to indicated that box edge needs to be shown.
virtual void setBoxEdge(bool show)
Value
A few common colors.
A Color class for creating the color object following the standard RGB color space.
The base class for the PlotterBase hierarchy.
hippodraw::DataSource class interface.
static const Color s_desel_color
The color of the representation when it is de-selected.
A Periodic transform that transforms coordinates from one 2D coordinate system to another...
~ColorBoxPointRep()
The destructor.
error on X or half bin width
double getZ() const
A shortcut to get origin.Z.
virtual const BinToColor * getValueTransform() const
Returns the value transform.
hippodraw::BinToColor class interface
virtual const Color & color() const
Returns the representation's color.
Class representing a rectangle.
virtual void drawProjectedValues(const DataSource *ntuple, TransformBase *transform, ViewBase *view)
Draws the projected values.
virtual const Color & repColor() const =0
Returns the color used for the representation.
The abstract base class for views.
A transform that transforms coordinates from one 2D coordinate system to another. ...
A factory for creation of objects whose class is derived from BinToColor.
double low() const
Returns the minimum of the range object.
Expresses a range of values.
hippodraw::DataPointTuple namespace interface
virtual void drawPolyLine(const std::vector< double > &xpoints, const std::vector< double > &ypoints, Line::Style style, const Color &color, float size)=0
Draws a polyline.
hippodraw::ViewBase class interface
float size() const
Returns the size of the representation.
virtual bool uses(Color::Value) const
Returns false as this class represents a Z value in color.
The base class for the point representation hierarchy.
void setRange(const Range &r)
Sets the range of the values passed.
hippodraw::PlotterBase class interface.
BinToColorFactory class interface.
The base class for the point representation hierarchy.
Base class for DataSource.