summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bltGrElem.h6
-rw-r--r--src/bltGrElemBar.C43
-rw-r--r--src/bltGrElemBar.h5
-rw-r--r--src/bltGrElemLine.C43
-rw-r--r--src/bltGrElemLine.h3
-rw-r--r--src/bltGrMarker.C10
-rw-r--r--src/bltGrMarker.h5
-rw-r--r--src/bltGrMarkerLine.C14
-rw-r--r--src/bltGrMarkerLine.h3
-rw-r--r--src/bltGrMarkerPolygon.C6
-rw-r--r--src/bltGrMarkerPolygon.h3
-rw-r--r--src/bltGrMarkerText.C6
-rw-r--r--src/bltGrMarkerText.h3
-rw-r--r--src/bltGraph.C24
-rw-r--r--src/bltGraph.h8
-rw-r--r--src/bltGraphBar.C15
-rw-r--r--src/bltGraphBar.h6
-rw-r--r--src/bltGraphOp.C14
18 files changed, 111 insertions, 106 deletions
diff --git a/src/bltGrElem.h b/src/bltGrElem.h
index e59ad72..4768457 100644
--- a/src/bltGrElem.h
+++ b/src/bltGrElem.h
@@ -43,6 +43,7 @@ extern "C" {
#include "bltGrMisc.h"
#include "bltGraph.h" // for Axis2d
+#include "bltGrPen.h"
#define SHOW_NONE 0
#define SHOW_X 1
@@ -102,7 +103,8 @@ typedef struct {
Element* elemPtr;
const char* label;
const char** tags;
- Axis2d axes;
+ Axis* xAxis;
+ Axis* yAxis;
ElemCoords coords;
ElemValues* w;
ElemValues* xError;
@@ -117,7 +119,7 @@ typedef struct {
Pen* builtinPenPtr;
Pen* activePenPtr;
Pen* normalPenPtr;
- void* builtinPen;
+ PenOptions builtinPen;
} ElementOptions;
class Element {
diff --git a/src/bltGrElemBar.C b/src/bltGrElemBar.C
index ea71727..a394e70 100644
--- a/src/bltGrElemBar.C
+++ b/src/bltGrElemBar.C
@@ -109,9 +109,9 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_RELIEF, "-legendrelief", "legendRelief", "LegendRelief",
"flat", -1, Tk_Offset(BarElementOptions, legendRelief), 0, NULL, 0},
{TK_OPTION_CUSTOM, "-mapx", "mapX", "MapX",
- "x", -1, Tk_Offset(BarElementOptions, axes.x), 0, &xAxisObjOption, MAP_ITEM},
+ "x", -1, Tk_Offset(BarElementOptions, xAxis), 0, &xAxisObjOption, MAP_ITEM},
{TK_OPTION_CUSTOM, "-mapy", "mapY", "MapY",
- "y", -1, Tk_Offset(BarElementOptions, axes.y), 0, &yAxisObjOption, MAP_ITEM},
+ "y", -1, Tk_Offset(BarElementOptions, yAxis), 0, &yAxisObjOption, MAP_ITEM},
{TK_OPTION_SYNONYM, "-outline", NULL, NULL, NULL, -1, 0, 0, "-foreground", 0},
{TK_OPTION_CUSTOM, "-pen", "pen", "Pen",
NULL, -1, Tk_Offset(BarElementOptions, normalPenPtr),
@@ -276,7 +276,7 @@ void BarElement::map()
// double barWidth = graphPtr->barWidth;
double barWidth = (ops->barWidth > 0.0f) ? ops->barWidth : gops->barWidth;
- AxisOptions* axisyops = (AxisOptions*)ops->axes.y->ops();
+ AxisOptions* axisyops = (AxisOptions*)ops->yAxis->ops();
double baseline = (axisyops->logScale) ? 0.0 : gops->baseline;
double barOffset = barWidth * 0.5;
@@ -298,8 +298,8 @@ void BarElement::map()
int height;
double right, left, top, bottom;
- if (((x[i] - barWidth) > ops->axes.x->axisRange_.max) ||
- ((x[i] + barWidth) < ops->axes.x->axisRange_.min)) {
+ if (((x[i] - barWidth) > ops->xAxis->axisRange_.max) ||
+ ((x[i] + barWidth) < ops->xAxis->axisRange_.min)) {
continue; /* Abscissa is out of range of the
* x-axis */
}
@@ -319,14 +319,14 @@ void BarElement::map()
BarSetKey key;
key.value = (float)x[i];
- key.axes = ops->axes;
- key.axes.y = NULL;
+ key.xAxis = ops->xAxis;
+ key.yAxis = NULL;
hPtr = Tcl_FindHashEntry(&barGraphPtr_->setTable_, (char *)&key);
if (hPtr) {
Tcl_HashTable *tablePtr = (Tcl_HashTable*)Tcl_GetHashValue(hPtr);
const char *name = (ops->groupName) ?
- ops->groupName : ops->axes.y->name_;
+ ops->groupName : ops->yAxis->name_;
hPtr = Tcl_FindHashEntry(tablePtr, name);
if (hPtr) {
double slice, width, offset;
@@ -382,8 +382,8 @@ void BarElement::map()
* Get the two corners of the bar segment and compute the rectangle
*/
double ybot = c2.y;
- c1 = graphPtr_->map2D(c1.x, c1.y, &ops->axes);
- c2 = graphPtr_->map2D(c2.x, c2.y, &ops->axes);
+ c1 = graphPtr_->map2D(c1.x, c1.y, ops->xAxis, ops->yAxis);
+ c2 = graphPtr_->map2D(c2.x, c2.y, ops->xAxis, ops->yAxis);
if ((ybot == 0.0) && (axisyops->logScale))
c2.y = graphPtr_->bottom_;
@@ -402,8 +402,8 @@ void BarElement::map()
/* Bound the bars horizontally by the width of the graph window */
/* Bound the bars vertically by the position of the axis. */
if (gops->stackAxes) {
- top = ops->axes.y->screenMin_;
- bottom = ops->axes.y->screenMin_ + ops->axes.y->screenRange_;
+ top = ops->yAxis->screenMin_;
+ bottom = ops->yAxis->screenMin_ + ops->yAxis->screenRange_;
left = graphPtr_->left_;
right = graphPtr_->right_;
} else {
@@ -517,11 +517,11 @@ void BarElement::extents(Region2d *regPtr)
// If element is stacked, the sum of its ordinates may be outside the
// minimum/maximum limits of the element's data points.
if ((gops->barMode == BARS_STACKED) && (barGraphPtr_->nBarGroups_ > 0))
- CheckBarStacks(&ops->axes, &regPtr->top, &regPtr->bottom);
+ CheckBarStacks(ops->xAxis, ops->yAxis, &regPtr->top, &regPtr->bottom);
// Warning: You get what you deserve if the x-axis is logScale
- AxisOptions* axisxops = (AxisOptions*)ops->axes.x->ops();
- AxisOptions* axisyops = (AxisOptions*)ops->axes.y->ops();
+ AxisOptions* axisxops = (AxisOptions*)ops->xAxis->ops();
+ AxisOptions* axisyops = (AxisOptions*)ops->yAxis->ops();
if (axisxops->logScale)
regPtr->left = FindElemValuesMinimum(ops->coords.x, DBL_MIN) + middle;
@@ -892,7 +892,8 @@ void BarElement::ResetStylePalette(Blt_Chain stylePalette)
}
}
-void BarElement::CheckBarStacks(Axis2d *pairPtr, double *minPtr, double *maxPtr)
+void BarElement::CheckBarStacks(Axis* xAxis, Axis* yAxis,
+ double *minPtr, double *maxPtr)
{
BarGraph* barGraphPtr_ = (BarGraph*)graphPtr_;
BarGraphOptions* gops = (BarGraphOptions*)graphPtr_->ops_;
@@ -902,7 +903,7 @@ void BarElement::CheckBarStacks(Axis2d *pairPtr, double *minPtr, double *maxPtr)
BarGroup *gp, *gend;
for (gp = barGraphPtr_->barGroups_, gend = gp + barGraphPtr_->nBarGroups_; gp < gend;
gp++) {
- if ((gp->axes.x == pairPtr->x) && (gp->axes.y == pairPtr->y)) {
+ if ((gp->xAxis == xAxis) && (gp->yAxis == yAxis)) {
// Check if any of the y-values (because of stacking) are greater
// than the current limits of the graph.
@@ -1128,8 +1129,8 @@ void BarElement::MapErrorBars(BarStyle **dataToStyle)
low = ops->xLow ? ops->xLow->values[ii] : 0;
}
if ((isfinite(high)) && (isfinite(low))) {
- Point2d p = graphPtr_->map2D(high, y, &ops->axes);
- Point2d q = graphPtr_->map2D(low, y, &ops->axes);
+ Point2d p = graphPtr_->map2D(high, y, ops->xAxis, ops->yAxis);
+ Point2d q = graphPtr_->map2D(low, y, ops->xAxis, ops->yAxis);
segPtr->p = p;
segPtr->q = q;
if (Blt_LineRectClip(&reg, &segPtr->p, &segPtr->q)) {
@@ -1190,8 +1191,8 @@ void BarElement::MapErrorBars(BarStyle **dataToStyle)
low = ops->yLow->values[ii];
}
if ((isfinite(high)) && (isfinite(low))) {
- Point2d p = graphPtr_->map2D(x, high, &ops->axes);
- Point2d q = graphPtr_->map2D(x, low, &ops->axes);
+ Point2d p = graphPtr_->map2D(x, high, ops->xAxis, ops->yAxis);
+ Point2d q = graphPtr_->map2D(x, low, ops->xAxis, ops->yAxis);
segPtr->p = p;
segPtr->q = q;
if (Blt_LineRectClip(&reg, &segPtr->p, &segPtr->q)) {
diff --git a/src/bltGrElemBar.h b/src/bltGrElemBar.h
index fc6143d..c5f609d 100644
--- a/src/bltGrElemBar.h
+++ b/src/bltGrElemBar.h
@@ -62,7 +62,8 @@ typedef struct {
Element* elemPtr;
const char *label;
char** tags;
- Axis2d axes;
+ Axis* xAxis;
+ Axis* yAxis;
ElemCoords coords;
ElemValues* w;
ElemValues* xError;
@@ -99,7 +100,7 @@ class BarElement : public Element {
protected:
void ResetStylePalette(Blt_Chain);
- void CheckBarStacks(Axis2d*, double*, double*);
+ void CheckBarStacks(Axis*, Axis*, double*, double*);
void MergePens(BarStyle**);
void MapActiveBars();
void ResetBar();
diff --git a/src/bltGrElemLine.C b/src/bltGrElemLine.C
index 82170fa..684cc80 100644
--- a/src/bltGrElemLine.C
+++ b/src/bltGrElemLine.C
@@ -138,11 +138,9 @@ static Tk_OptionSpec optionSpecs[] = {
"1", -1, Tk_Offset(LineElementOptions, builtinPen.traceWidth),
0, NULL, 0},
{TK_OPTION_CUSTOM, "-mapx", "mapX", "MapX",
- "x", -1, Tk_Offset(LineElementOptions, axes.x),
- 0, &xAxisObjOption, MAP_ITEM},
+ "x", -1, Tk_Offset(LineElementOptions, xAxis), 0, &xAxisObjOption, MAP_ITEM},
{TK_OPTION_CUSTOM, "-mapy", "mapY", "MapY",
- "y", -1, Tk_Offset(LineElementOptions, axes.y),
- 0, &yAxisObjOption, MAP_ITEM},
+ "y", -1, Tk_Offset(LineElementOptions, yAxis), 0, &yAxisObjOption, MAP_ITEM},
{TK_OPTION_INT, "-maxsymbols", "maxSymbols", "MaxSymbols",
"0", -1, Tk_Offset(LineElementOptions, reqMaxSymbols), 0, NULL, 0},
{TK_OPTION_COLOR, "-offdash", "offDash", "OffDash",
@@ -447,14 +445,14 @@ void LineElement::extents(Region2d *extsPtr)
int np = NUMBEROFPOINTS(ops);
extsPtr->right = ops->coords.x->max;
- AxisOptions* axisxops = (AxisOptions*)ops->axes.x->ops();
+ AxisOptions* axisxops = (AxisOptions*)ops->xAxis->ops();
if ((ops->coords.x->min <= 0.0) && (axisxops->logScale))
extsPtr->left = FindElemValuesMinimum(ops->coords.x, DBL_MIN);
else
extsPtr->left = ops->coords.x->min;
extsPtr->bottom = ops->coords.y->max;
- AxisOptions* axisyops = (AxisOptions*)ops->axes.y->ops();
+ AxisOptions* axisyops = (AxisOptions*)ops->yAxis->ops();
if ((ops->coords.y->min <= 0.0) && (axisyops->logScale))
extsPtr->top = FindElemValuesMinimum(ops->coords.y, DBL_MIN);
else
@@ -473,7 +471,7 @@ void LineElement::extents(Region2d *extsPtr)
extsPtr->right = x;
}
x = ops->coords.x->values[i] - ops->xError->values[i];
- AxisOptions* axisxops = (AxisOptions*)ops->axes.x->ops();
+ AxisOptions* axisxops = (AxisOptions*)ops->xAxis->ops();
if (axisxops->logScale) {
// Mirror negative values, instead of ignoring them
if (x < 0.0)
@@ -517,7 +515,7 @@ void LineElement::extents(Region2d *extsPtr)
extsPtr->bottom = y;
}
y = ops->coords.y->values[i] - ops->yError->values[i];
- AxisOptions* axisyops = (AxisOptions*)ops->axes.y->ops();
+ AxisOptions* axisyops = (AxisOptions*)ops->yAxis->ops();
if (axisyops->logScale) {
if (y < 0.0) {
y = -y; /* Mirror negative values, instead of
@@ -1032,8 +1030,8 @@ int LineElement::ScaleSymbol(int normalSize)
double scale = 1.0;
if (ops->scaleSymbols) {
- double xRange = (ops->axes.x->max_ - ops->axes.x->min_);
- double yRange = (ops->axes.y->max_ - ops->axes.y->min_);
+ double xRange = (ops->xAxis->max_ - ops->xAxis->min_);
+ double yRange = (ops->yAxis->max_ - ops->yAxis->min_);
// Save the ranges as a baseline for future scaling
if (flags & SCALE_SYMBOL) {
xRange_ = xRange;
@@ -1082,8 +1080,8 @@ void LineElement::GetScreenPoints(MapInfo *mapPtr)
if (gops->inverted) {
for (int i = 0; i < np; i++) {
if ((isfinite(x[i])) && (isfinite(y[i]))) {
- points[count].x = ops->axes.y->hMap(y[i]);
- points[count].y = ops->axes.x->vMap(x[i]);
+ points[count].x = ops->yAxis->hMap(y[i]);
+ points[count].y = ops->xAxis->vMap(x[i]);
map[count] = i;
count++;
}
@@ -1092,8 +1090,8 @@ void LineElement::GetScreenPoints(MapInfo *mapPtr)
else {
for (int i = 0; i < np; i++) {
if ((isfinite(x[i])) && (isfinite(y[i]))) {
- points[count].x = ops->axes.x->hMap(x[i]);
- points[count].y = ops->axes.y->vMap(y[i]);
+ points[count].x = ops->xAxis->hMap(x[i]);
+ points[count].y = ops->yAxis->vMap(y[i]);
map[count] = i;
count++;
}
@@ -1465,7 +1463,7 @@ void LineElement::MapActiveSymbols()
double x = ops->coords.x->values[iPoint];
double y = ops->coords.y->values[iPoint];
- points[count] = graphPtr_->map2D(x, y, &ops->axes);
+ points[count] = graphPtr_->map2D(x, y, ops->xAxis, ops->yAxis);
map[count] = iPoint;
if (PointInRegion(&exts, points[count].x, points[count].y)) {
count++;
@@ -1797,7 +1795,7 @@ void LineElement::MapFillArea(MapInfo *mapPtr)
double minX;
int i;
- minX = (double)ops->axes.y->screenMin_;
+ minX = (double)ops->yAxis->screenMin_;
for (i = 0; i < mapPtr->nScreenPts; i++) {
origPts[i].x = mapPtr->screenPts[i].x + 1;
origPts[i].y = mapPtr->screenPts[i].y;
@@ -1818,7 +1816,7 @@ void LineElement::MapFillArea(MapInfo *mapPtr)
else {
int i;
- double maxY = (double)ops->axes.y->bottom_;
+ double maxY = (double)ops->yAxis->bottom_;
for (i = 0; i < mapPtr->nScreenPts; i++) {
origPts[i].x = mapPtr->screenPts[i].x + 1;
origPts[i].y = mapPtr->screenPts[i].y;
@@ -1956,8 +1954,8 @@ void LineElement::MapErrorBars(LineStyle **styleMap)
if ((isfinite(high)) && (isfinite(low))) {
Point2d p, q;
- p = graphPtr_->map2D(high, y, &ops->axes);
- q = graphPtr_->map2D(low, y, &ops->axes);
+ p = graphPtr_->map2D(high, y, ops->xAxis, ops->yAxis);
+ q = graphPtr_->map2D(low, y, ops->xAxis, ops->yAxis);
segPtr->p = p;
segPtr->q = q;
if (Blt_LineRectClip(&exts, &segPtr->p, &segPtr->q)) {
@@ -2025,8 +2023,8 @@ void LineElement::MapErrorBars(LineStyle **styleMap)
if ((isfinite(high)) && (isfinite(low))) {
Point2d p, q;
- p = graphPtr_->map2D(x, high, &ops->axes);
- q = graphPtr_->map2D(x, low, &ops->axes);
+ p = graphPtr_->map2D(x, high, ops->xAxis, ops->yAxis);
+ q = graphPtr_->map2D(x, low, ops->xAxis, ops->yAxis);
segPtr->p = p;
segPtr->q = q;
if (Blt_LineRectClip(&exts, &segPtr->p, &segPtr->q)) {
@@ -2100,7 +2098,8 @@ int LineElement::ClosestTrace()
searchPtr->dist = dMin;
searchPtr->elemPtr = (Element*)this;
searchPtr->index = iClose;
- searchPtr->point = graphPtr_->invMap2D(closest.x, closest.y, &ops->axes);
+ searchPtr->point = graphPtr_->invMap2D(closest.x, closest.y,
+ ops->xAxis, ops->yAxis);
return 1;
}
diff --git a/src/bltGrElemLine.h b/src/bltGrElemLine.h
index b196825..0c6d3e6 100644
--- a/src/bltGrElemLine.h
+++ b/src/bltGrElemLine.h
@@ -77,7 +77,8 @@ typedef struct {
Element* elemPtr;
const char* label;
char** tags;
- Axis2d axes;
+ Axis* xAxis;
+ Axis* yAxis;
ElemCoords coords;
ElemValues* w;
ElemValues* xError;
diff --git a/src/bltGrMarker.C b/src/bltGrMarker.C
index ec611cc..b924d59 100644
--- a/src/bltGrMarker.C
+++ b/src/bltGrMarker.C
@@ -118,17 +118,17 @@ double Marker::VMap(Axis *axisPtr, double y)
return (((1.0 - y) * axisPtr->screenRange_) + axisPtr->screenMin_);
}
-Point2d Marker::mapPoint(Point2d* pointPtr, Axis2d* axesPtr)
+Point2d Marker::mapPoint(Point2d* pointPtr, Axis* xAxis, Axis* yAxis)
{
GraphOptions* gops = (GraphOptions*)graphPtr_->ops_;
Point2d result;
if (gops->inverted) {
- result.x = HMap(axesPtr->y, pointPtr->y);
- result.y = VMap(axesPtr->x, pointPtr->x);
+ result.x = HMap(yAxis, pointPtr->y);
+ result.y = VMap(xAxis, pointPtr->x);
}
else {
- result.x = HMap(axesPtr->x, pointPtr->x);
- result.y = VMap(axesPtr->y, pointPtr->y);
+ result.x = HMap(xAxis, pointPtr->x);
+ result.y = VMap(yAxis, pointPtr->y);
}
return result;
diff --git a/src/bltGrMarker.h b/src/bltGrMarker.h
index 0dae3e2..22f95d9 100644
--- a/src/bltGrMarker.h
+++ b/src/bltGrMarker.h
@@ -52,7 +52,8 @@ namespace Blt {
const char** tags;
Coords* worldPts;
const char* elemName;
- Axis2d axes;
+ Axis* xAxis;
+ Axis* yAxis;
int hide;
int state;
int drawUnder;
@@ -76,7 +77,7 @@ namespace Blt {
protected:
double HMap(Axis*, double);
double VMap(Axis*, double);
- Point2d mapPoint(Point2d*, Axis2d*);
+ Point2d mapPoint(Point2d*, Axis*, Axis*);
int boxesDontOverlap(Graph*, Region2d*);
int regionInPolygon(Region2d *extsPtr, Point2d *points,
int nPoints, int enclosed);
diff --git a/src/bltGrMarkerLine.C b/src/bltGrMarkerLine.C
index 7aa2eda..76d60bb 100644
--- a/src/bltGrMarkerLine.C
+++ b/src/bltGrMarkerLine.C
@@ -70,9 +70,9 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BOOLEAN, "-hide", "hide", "Hide",
"no", -1, Tk_Offset(LineMarkerOptions, hide), 0, NULL, 0},
{TK_OPTION_CUSTOM, "-mapx", "mapX", "MapX",
- "x", -1, Tk_Offset(LineMarkerOptions, axes.x), 0, &xAxisObjOption, 0},
+ "x", -1, Tk_Offset(LineMarkerOptions, xAxis), 0, &xAxisObjOption, 0},
{TK_OPTION_CUSTOM, "-mapy", "mapY", "MapY",
- "y", -1, Tk_Offset(LineMarkerOptions, axes.y), 0, &yAxisObjOption, 0},
+ "y", -1, Tk_Offset(LineMarkerOptions, yAxis), 0, &yAxisObjOption, 0},
{TK_OPTION_COLOR, "-outline", "outline", "Outline",
STD_NORMAL_FOREGROUND, -1, Tk_Offset(LineMarkerOptions, outlineColor),
TK_OPTION_NULL_OK, NULL, 0},
@@ -192,7 +192,7 @@ void LineMarker::map()
Segment2d* segments = new Segment2d[ops->worldPts->num];
Point2d* srcPtr = ops->worldPts->points;
- Point2d p = mapPoint(srcPtr, &ops->axes);
+ Point2d p = mapPoint(srcPtr, ops->xAxis, ops->yAxis);
p.x += ops->xOffset;
p.y += ops->yOffset;
@@ -200,7 +200,7 @@ void LineMarker::map()
Point2d* pend;
for (srcPtr++, pend = ops->worldPts->points + ops->worldPts->num;
srcPtr < pend; srcPtr++) {
- Point2d next = mapPoint(srcPtr, &ops->axes);
+ Point2d next = mapPoint(srcPtr, ops->xAxis, ops->yAxis);
next.x += ops->xOffset;
next.y += ops->yOffset;
Point2d q = next;
@@ -278,7 +278,7 @@ int LineMarker::regionIn(Region2d *extsPtr, int enclosed)
for (pp = ops->worldPts->points, pend = pp + ops->worldPts->num;
pp < pend; pp++) {
- Point2d p = mapPoint(pp, &ops->axes);
+ Point2d p = mapPoint(pp, ops->xAxis, ops->yAxis);
if ((p.x < extsPtr->left) && (p.x > extsPtr->right) &&
(p.y < extsPtr->top) && (p.y > extsPtr->bottom)) {
return 0;
@@ -291,8 +291,8 @@ int LineMarker::regionIn(Region2d *extsPtr, int enclosed)
int count = 0;
for (pp = ops->worldPts->points, pend = pp + (ops->worldPts->num - 1);
pp < pend; pp++) {
- Point2d p = mapPoint(pp, &ops->axes);
- Point2d q = mapPoint(pp + 1, &ops->axes);
+ Point2d p = mapPoint(pp, ops->xAxis, ops->yAxis);
+ Point2d q = mapPoint(pp + 1, ops->xAxis, ops->yAxis);
if (Blt_LineRectClip(extsPtr, &p, &q))
count++;
}
diff --git a/src/bltGrMarkerLine.h b/src/bltGrMarkerLine.h
index ab84a1a..32c4260 100644
--- a/src/bltGrMarkerLine.h
+++ b/src/bltGrMarkerLine.h
@@ -38,7 +38,8 @@ namespace Blt {
const char** tags;
Coords* worldPts;
const char* elemName;
- Axis2d axes;
+ Axis* xAxis;
+ Axis* yAxis;
int hide;
int state;
int drawUnder;
diff --git a/src/bltGrMarkerPolygon.C b/src/bltGrMarkerPolygon.C
index 3cb7f70..15f7272 100644
--- a/src/bltGrMarkerPolygon.C
+++ b/src/bltGrMarkerPolygon.C
@@ -66,9 +66,9 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BOOLEAN, "-hide", "hide", "Hide",
"no", -1, Tk_Offset(PolygonMarkerOptions, hide), 0, NULL, 0},
{TK_OPTION_CUSTOM, "-mapx", "mapX", "MapX",
- "x", -1, Tk_Offset(PolygonMarkerOptions, axes.x), 0, &xAxisObjOption, 0},
+ "x", -1, Tk_Offset(PolygonMarkerOptions, xAxis), 0, &xAxisObjOption, 0},
{TK_OPTION_CUSTOM, "-mapy", "mapY", "MapY",
- "y", -1, Tk_Offset(PolygonMarkerOptions, axes.y), 0, &yAxisObjOption, 0},
+ "y", -1, Tk_Offset(PolygonMarkerOptions, yAxis), 0, &yAxisObjOption, 0},
{TK_OPTION_COLOR, "-outline", "outline", "Outline",
STD_NORMAL_FOREGROUND, -1, Tk_Offset(PolygonMarkerOptions, outline),
TK_OPTION_NULL_OK, NULL, 0},
@@ -267,7 +267,7 @@ void PolygonMarker::map()
Point2d *sp, *send;
for (sp = ops->worldPts->points, send = sp + ops->worldPts->num;
sp < send; sp++) {
- *dp = mapPoint(sp, &ops->axes);
+ *dp = mapPoint(sp, ops->xAxis, ops->yAxis);
dp->x += ops->xOffset;
dp->y += ops->yOffset;
dp++;
diff --git a/src/bltGrMarkerPolygon.h b/src/bltGrMarkerPolygon.h
index a451995..3c09948 100644
--- a/src/bltGrMarkerPolygon.h
+++ b/src/bltGrMarkerPolygon.h
@@ -38,7 +38,8 @@ namespace Blt {
const char** tags;
Coords* worldPts;
const char* elemName;
- Axis2d axes;
+ Axis* xAxis;
+ Axis* yAxis;
int hide;
int state;
int drawUnder;
diff --git a/src/bltGrMarkerText.C b/src/bltGrMarkerText.C
index 8bf5b3b..8edd61c 100644
--- a/src/bltGrMarkerText.C
+++ b/src/bltGrMarkerText.C
@@ -66,9 +66,9 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BOOLEAN, "-hide", "hide", "Hide",
"no", -1, Tk_Offset(TextMarkerOptions, hide), 0, NULL, 0},
{TK_OPTION_CUSTOM, "-mapx", "mapX", "MapX",
- "x", -1, Tk_Offset(TextMarkerOptions, axes.x), 0, &xAxisObjOption, 0},
+ "x", -1, Tk_Offset(TextMarkerOptions, xAxis), 0, &xAxisObjOption, 0},
{TK_OPTION_CUSTOM, "-mapy", "mapY", "MapY",
- "y", -1, Tk_Offset(TextMarkerOptions, axes.y), 0, &yAxisObjOption, 0},
+ "y", -1, Tk_Offset(TextMarkerOptions, yAxis), 0, &yAxisObjOption, 0},
{TK_OPTION_SYNONYM, "-outline", NULL, NULL, NULL, -1, 0, 0, "-foreground", 0},
{TK_OPTION_DOUBLE, "-rotate", "rotate", "Rotate",
"0", -1, Tk_Offset(TextMarkerOptions, style.angle), 0, NULL, 0},
@@ -181,7 +181,7 @@ void TextMarker::map()
outline_[4].x = outline_[0].x;
outline_[4].y = outline_[0].y;
- Point2d anchorPtr = mapPoint(ops->worldPts->points, &ops->axes);
+ Point2d anchorPtr = mapPoint(ops->worldPts->points, ops->xAxis, ops->yAxis);
anchorPtr = Blt_AnchorPoint(anchorPtr.x, anchorPtr.y, width_,
height_, ops->anchor);
anchorPtr.x += ops->xOffset;
diff --git a/src/bltGrMarkerText.h b/src/bltGrMarkerText.h
index 9ce9418..9149f2b 100644
--- a/src/bltGrMarkerText.h
+++ b/src/bltGrMarkerText.h
@@ -40,7 +40,8 @@ namespace Blt {
const char** tags;
Coords* worldPts;
const char* elemName;
- Axis2d axes;
+ Axis* xAxis;
+ Axis* yAxis;
int hide;
int state;
int drawUnder;
diff --git a/src/bltGraph.C b/src/bltGraph.C
index 720b109..7df611c 100644
--- a/src/bltGraph.C
+++ b/src/bltGraph.C
@@ -1157,34 +1157,34 @@ void Graph::adjustAxes()
}
}
-Point2d Graph::map2D(double x, double y, Axis2d* axesPtr)
+Point2d Graph::map2D(double x, double y, Axis* xAxis, Axis* yAxis)
{
GraphOptions* ops = (GraphOptions*)ops_;
Point2d point;
if (ops->inverted) {
- point.x = axesPtr->y->hMap(y);
- point.y = axesPtr->x->vMap(x);
+ point.x = yAxis->hMap(y);
+ point.y = xAxis->vMap(x);
}
else {
- point.x = axesPtr->x->hMap(x);
- point.y = axesPtr->y->vMap(y);
+ point.x = xAxis->hMap(x);
+ point.y = yAxis->vMap(y);
}
return point;
}
-Point2d Graph::invMap2D(double x, double y, Axis2d* axesPtr)
+Point2d Graph::invMap2D(double x, double y, Axis* xAxis, Axis* yAxis)
{
GraphOptions* ops = (GraphOptions*)ops_;
Point2d point;
if (ops->inverted) {
- point.x = axesPtr->x->invVMap(y);
- point.y = axesPtr->y->invHMap(x);
+ point.x = xAxis->invVMap(y);
+ point.y = yAxis->invHMap(x);
}
else {
- point.x = axesPtr->x->invHMap(x);
- point.y = axesPtr->y->invVMap(y);
+ point.x = xAxis->invHMap(x);
+ point.y = yAxis->invVMap(y);
}
return point;
}
@@ -1216,8 +1216,8 @@ void Graph::resetAxes()
Element* elemPtr = (Element*)Blt_Chain_GetValue(link);
ElementOptions* elemops = (ElementOptions*)elemPtr->ops();
elemPtr->extents(&exts);
- elemops->axes.x->getDataLimits(exts.left, exts.right);
- elemops->axes.y->getDataLimits(exts.top, exts.bottom);
+ elemops->xAxis->getDataLimits(exts.left, exts.right);
+ elemops->yAxis->getDataLimits(exts.top, exts.bottom);
}
/*
* Step 3: Now that we know the range of data values for each axis,
diff --git a/src/bltGraph.h b/src/bltGraph.h
index 18280db..c6a56c9 100644
--- a/src/bltGraph.h
+++ b/src/bltGraph.h
@@ -55,10 +55,6 @@ class Marker;
};
typedef struct {
- Axis *x, *y;
-} Axis2d;
-
-typedef struct {
int halo;
int mode;
int x;
@@ -230,8 +226,8 @@ class Graph {
void printAxesLimits(Blt_Ps);
int getAxis(Tcl_Obj*, Axis**);
ClientData axisTag(const char*);
- Point2d map2D(double, double, Axis2d*);
- Point2d invMap2D(double, double, Axis2d*);
+ Point2d map2D(double, double, Axis*, Axis*);
+ Point2d invMap2D(double, double, Axis*, Axis*);
virtual void resetAxes();
Axis* nearestAxis(int, int);
diff --git a/src/bltGraphBar.C b/src/bltGraphBar.C
index 43bc286..7d65248 100644
--- a/src/bltGraphBar.C
+++ b/src/bltGraphBar.C
@@ -376,8 +376,8 @@ void BarGraph::initBarSetTable()
BarSetKey key;
key.value = *x;
- key.axes = ops->axes;
- key.axes.y = NULL;
+ key.xAxis = ops->xAxis;
+ key.yAxis = NULL;
int isNew;
Tcl_HashEntry* hPtr = Tcl_CreateHashEntry(&setTable, (char *)&key, &isNew);
Tcl_HashTable *tablePtr;
@@ -389,7 +389,7 @@ void BarGraph::initBarSetTable()
else
tablePtr = (Tcl_HashTable*)Tcl_GetHashValue(hPtr);
- name = (ops->groupName) ? ops->groupName : ops->axes.y->name_;
+ name = (ops->groupName) ? ops->groupName : ops->yAxis->name_;
hPtr = Tcl_CreateHashEntry(tablePtr, name, &isNew);
if (isNew)
count = 1;
@@ -441,7 +441,8 @@ void BarGraph::initBarSetTable()
count = (size_t)Tcl_GetHashValue(hPtr2);
groupPtr->nSegments = count;
- groupPtr->axes = keyPtr->axes;
+ groupPtr->xAxis = keyPtr->xAxis;
+ groupPtr->yAxis = keyPtr->yAxis;
Tcl_SetHashValue(hPtr2, groupPtr);
groupPtr->index = xcount++;
groupPtr++;
@@ -509,15 +510,15 @@ void BarGraph::computeBarStacks()
xend = x + ops->coords.x->nValues; x < xend; x++, y++) {
BarSetKey key;
key.value = *x;
- key.axes = ops->axes;
- key.axes.y = NULL;
+ key.xAxis = ops->xAxis;
+ key.yAxis = NULL;
Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&setTable_, (char *)&key);
if (!hPtr)
continue;
Tcl_HashTable *tablePtr = (Tcl_HashTable*)Tcl_GetHashValue(hPtr);
const char *name = (ops->groupName) ?
- ops->groupName : ops->axes.y->name_;
+ ops->groupName : ops->yAxis->name_;
hPtr = Tcl_FindHashEntry(tablePtr, name);
if (!hPtr)
continue;
diff --git a/src/bltGraphBar.h b/src/bltGraphBar.h
index 6ad846f..4c1479c 100644
--- a/src/bltGraphBar.h
+++ b/src/bltGraphBar.h
@@ -36,7 +36,8 @@
typedef struct {
int nSegments;
- Axis2d axes;
+ Axis* xAxis;
+ Axis* yAxis;
float sum;
int count;
float lastY;
@@ -45,7 +46,8 @@ typedef struct {
typedef struct {
float value;
- Axis2d axes;
+ Axis* xAxis;
+ Axis* yAxis;
} BarSetKey;
typedef enum {
diff --git a/src/bltGraphOp.C b/src/bltGraphOp.C
index b7f1beb..767add6 100644
--- a/src/bltGraphOp.C
+++ b/src/bltGraphOp.C
@@ -341,10 +341,9 @@ static int InvtransformOp(Graph* graphPtr, Tcl_Interp* interp, int objc,
* bottom and left axes (which may not be what the user wants). */
/* Pick the first pair of axes */
- Axis2d axes;
- axes.x = Blt_GetFirstAxis(graphPtr->axisChain_[0]);
- axes.y = Blt_GetFirstAxis(graphPtr->axisChain_[1]);
- Point2d point = graphPtr->invMap2D(x, y, &axes);
+ Axis* xAxis = Blt_GetFirstAxis(graphPtr->axisChain_[0]);
+ Axis* yAxis = Blt_GetFirstAxis(graphPtr->axisChain_[1]);
+ Point2d point = graphPtr->invMap2D(x, y, xAxis, yAxis);
Tcl_Obj* listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **)NULL);
Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewDoubleObj(point.x));
@@ -370,11 +369,10 @@ static int TransformOp(Graph* graphPtr, Tcl_Interp* interp, int objc,
* the points are always mapped onto the bottom and left axes (which may
* not be the what the user wants).
*/
- Axis2d axes;
- axes.x = Blt_GetFirstAxis(graphPtr->axisChain_[0]);
- axes.y = Blt_GetFirstAxis(graphPtr->axisChain_[1]);
+ Axis* xAxis = Blt_GetFirstAxis(graphPtr->axisChain_[0]);
+ Axis* yAxis = Blt_GetFirstAxis(graphPtr->axisChain_[1]);
- Point2d point = graphPtr->map2D(x, y, &axes);
+ Point2d point = graphPtr->map2D(x, y, xAxis, yAxis);
Tcl_Obj* listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **)NULL);
Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewIntObj(ROUND(point.x)));