summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoye <joye>2014-04-16 19:16:35 (GMT)
committerjoye <joye>2014-04-16 19:16:35 (GMT)
commit8de9835650ca47d192f7976c4d02105fe15aeff7 (patch)
tree89ac598b68c04c8733df558700920e414dada116 /src
parentecfd4bf4389606427b373f412c6028c6a03b33eb (diff)
downloadblt-8de9835650ca47d192f7976c4d02105fe15aeff7.zip
blt-8de9835650ca47d192f7976c4d02105fe15aeff7.tar.gz
blt-8de9835650ca47d192f7976c4d02105fe15aeff7.tar.bz2
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bltGrElemBar.C2
-rw-r--r--src/bltGrElemLine.C24
-rw-r--r--src/bltGrMarkerLine.C2
-rw-r--r--src/bltGrMarkerPolygon.C3
-rw-r--r--src/bltGrPSOutput.h4
-rw-r--r--src/bltGraph.C35
-rw-r--r--src/bltGraph.h2
-rw-r--r--src/bltGraphOp.C3
8 files changed, 31 insertions, 44 deletions
diff --git a/src/bltGrElemBar.C b/src/bltGrElemBar.C
index e24191f..336bcc4 100644
--- a/src/bltGrElemBar.C
+++ b/src/bltGrElemBar.C
@@ -1066,7 +1066,7 @@ void BarElement::MapErrorBars(BarStyle **dataToStyle)
BarElementOptions* ops = (BarElementOptions*)ops_;
Region2d reg;
- Blt_GraphExtents(graphPtr_, &reg);
+ graphPtr_->extents(&reg);
int nPoints = NUMBEROFPOINTS(ops);
int n =0;
diff --git a/src/bltGrElemLine.C b/src/bltGrElemLine.C
index 5aed37d..d74f275 100644
--- a/src/bltGrElemLine.C
+++ b/src/bltGrElemLine.C
@@ -1292,22 +1292,23 @@ void LineElement::GenerateSpline(MapInfo *mapPtr)
void LineElement::GenerateParametricSpline(MapInfo *mapPtr)
{
- Region2d exts;
Point2d *origPts, *iPts;
int *map;
int niPts, nOrigPts;
int result;
- int i, j, count;
+ int i, j;
nOrigPts = mapPtr->nScreenPts;
origPts = mapPtr->screenPts;
- Blt_GraphExtents(graphPtr_, &exts);
+
+ Region2d exts;
+ graphPtr_->extents(&exts);
/*
* Populate the x2 array with both the original X-coordinates and extra
* X-coordinates for each horizontal pixel that the line segment contains.
*/
- count = 1;
+ int count = 1;
for (i = 0, j = 1; j < nOrigPts; i++, j++) {
Point2d p, q;
@@ -1400,16 +1401,16 @@ void LineElement::GenerateParametricSpline(MapInfo *mapPtr)
void LineElement::MapSymbols(MapInfo *mapPtr)
{
- Region2d exts;
Point2d *pp;
int i;
Point2d* points = (Point2d*)malloc(sizeof(Point2d) * mapPtr->nScreenPts);
int *map = (int*)malloc(sizeof(int) * mapPtr->nScreenPts);
- Blt_GraphExtents(graphPtr_, &exts);
- int count = 0;
+ Region2d exts;
+ graphPtr_->extents(&exts);
+ int count = 0;
for (pp = mapPtr->screenPts, i = 0; i < mapPtr->nScreenPts; i++, pp++) {
if (PointInRegion(&exts, pp->x, pp->y)) {
points[count].x = pp->x;
@@ -1437,7 +1438,7 @@ void LineElement::MapActiveSymbols()
}
Region2d exts;
- Blt_GraphExtents(graphPtr_, &exts);
+ graphPtr_->extents(&exts);
Point2d *points = (Point2d*)malloc(sizeof(Point2d) * nActiveIndices_);
int* map = (int*)malloc(sizeof(int) * nActiveIndices_);
@@ -1702,7 +1703,8 @@ void LineElement::MapTraces(MapInfo *mapPtr)
LineElementOptions* ops = (LineElementOptions*)ops_;
Region2d exts;
- Blt_GraphExtents(graphPtr_, &exts);
+ graphPtr_->extents(&exts);
+
int count = 1;
int code1 = OutCode(&exts, mapPtr->screenPts);
Point2d* p = mapPtr->screenPts;
@@ -1775,7 +1777,7 @@ void LineElement::MapFillArea(MapInfo *mapPtr)
int np = mapPtr->nScreenPts + 3;
Region2d exts;
- Blt_GraphExtents(graphPtr_, &exts);
+ graphPtr_->extents(&exts);
Point2d* origPts = (Point2d*)malloc(sizeof(Point2d) * np);
if (gops->inverted) {
@@ -1901,7 +1903,7 @@ void LineElement::MapErrorBars(LineStyle **styleMap)
LineElementOptions* ops = (LineElementOptions*)ops_;
Region2d exts;
- Blt_GraphExtents(graphPtr_, &exts);
+ graphPtr_->extents(&exts);
int n =0;
int np = NUMBEROFPOINTS(ops);
diff --git a/src/bltGrMarkerLine.C b/src/bltGrMarkerLine.C
index 718a40d..0a4b2eb 100644
--- a/src/bltGrMarkerLine.C
+++ b/src/bltGrMarkerLine.C
@@ -178,7 +178,7 @@ void LineMarker::map()
return;
Region2d extents;
- Blt_GraphExtents(graphPtr_, &extents);
+ graphPtr_->extents(&extents);
// Allow twice the number of world coordinates. The line will represented
// as series of line segments, not one continous polyline. This is
diff --git a/src/bltGrMarkerPolygon.C b/src/bltGrMarkerPolygon.C
index bfa4196..5771d35 100644
--- a/src/bltGrMarkerPolygon.C
+++ b/src/bltGrMarkerPolygon.C
@@ -273,7 +273,8 @@ void PolygonMarker::map()
*dp = screenPts[0];
}
Region2d extents;
- Blt_GraphExtents(graphPtr_, &extents);
+ graphPtr_->extents(&extents);
+
clipped_ = 1;
if (ops->fill) {
Point2d* lfillPts = new Point2d[nScreenPts * 3];
diff --git a/src/bltGrPSOutput.h b/src/bltGrPSOutput.h
index b853a9b..fc14b7c 100644
--- a/src/bltGrPSOutput.h
+++ b/src/bltGrPSOutput.h
@@ -187,10 +187,6 @@ extern void Blt_Ps_Polygon(Blt_Ps ps, Point2d *screenPts, int nScreenPts);
extern void Blt_Ps_SetPrinting(Blt_Ps ps, int value);
extern int Blt_Ps_IsPrinting(void);
-extern int Blt_Ps_TextWidth(Tk_Font font, const char *string, int nBytes);
-
-extern int Blt_Ps_GetFontMetrics(Tk_Font font, Tk_FontMetrics *fmPtr);
-
extern void Blt_Ps_FontName(const char *family, int flags,
Tcl_DString *resultPtr);
diff --git a/src/bltGraph.C b/src/bltGraph.C
index dcc39a5..db16f6b 100644
--- a/src/bltGraph.C
+++ b/src/bltGraph.C
@@ -701,6 +701,16 @@ static void AdjustAxisPointers(Graph* graphPtr)
}
}
+void Graph::extents(Region2d* regionPtr)
+{
+ GraphOptions* ops = (GraphOptions*)ops_;
+
+ regionPtr->left = (double)(hOffset_ - ops->xPad);
+ regionPtr->top = (double)(vOffset_ - ops->yPad);
+ regionPtr->right = (double)(hOffset_ + hRange_ + ops->xPad);
+ regionPtr->bottom = (double)(vOffset_ + vRange_ + ops->yPad);
+}
+
// Support
static void UpdateMarginTraces(Graph* graphPtr)
@@ -726,29 +736,6 @@ static void UpdateMarginTraces(Graph* graphPtr)
}
}
-/*
- *---------------------------------------------------------------------------
- * Generates a bounding box representing the plotting area of the
- * graph. This data structure is used to clip the points and line
- * segments of the line element.
- * The clip region is the plotting area plus such arbitrary extra space.
- * The reason we clip with a bounding box larger than the plot area is so
- * that symbols will be drawn even if their center point isn't in the
- * plotting area.
- *---------------------------------------------------------------------------
- */
-
-void Blt_GraphExtents(Graph* graphPtr, Region2d *regionPtr)
-{
- GraphOptions* ops = (GraphOptions*)graphPtr->ops_;
- regionPtr->left = (double)(graphPtr->hOffset_ - ops->xPad);
- regionPtr->top = (double)(graphPtr->vOffset_ - ops->yPad);
- regionPtr->right = (double)(graphPtr->hOffset_ + graphPtr->hRange_ +
- ops->xPad);
- regionPtr->bottom = (double)(graphPtr->vOffset_ + graphPtr->vRange_ +
- ops->yPad);
-}
-
void Blt_ReconfigureGraph(Graph* graphPtr)
{
graphPtr->configure();
@@ -829,7 +816,7 @@ static ClientData PickEntry(ClientData clientData, int x, int y,
}
Region2d exts;
- Blt_GraphExtents(graphPtr, &exts);
+ graphPtr->extents(&exts);
// Sample coordinate is in one of the graph margins. Can only pick an axis.
if ((x >= exts.right) || (x < exts.left) ||
diff --git a/src/bltGraph.h b/src/bltGraph.h
index 211db66..865032f 100644
--- a/src/bltGraph.h
+++ b/src/bltGraph.h
@@ -206,10 +206,10 @@ class Graph {
void display();
void map();
void eventuallyRedraw();
+ void extents(Region2d*);
};
extern void Blt_ReconfigureGraph(Graph* graphPtr);
-extern void Blt_GraphExtents(Graph* graphPtr, Region2d *extsPtr);
typedef ClientData (MakeTagProc)(Graph* graphPtr, const char *tagName);
extern MakeTagProc Blt_MakeElementTag;
diff --git a/src/bltGraphOp.C b/src/bltGraphOp.C
index a901a3d..f70950d 100644
--- a/src/bltGraphOp.C
+++ b/src/bltGraphOp.C
@@ -329,7 +329,8 @@ static int InsideOp(Graph* graphPtr, Tcl_Interp* interp, int objc,
return TCL_ERROR;
Region2d exts;
- Blt_GraphExtents(graphPtr, &exts);
+ graphPtr->extents(&exts);
+
int result = PointInRegion(&exts, x, y);
Tcl_SetBooleanObj(Tcl_GetObjResult(interp), result);