summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoye <joye>2014-03-19 20:40:38 (GMT)
committerjoye <joye>2014-03-19 20:40:38 (GMT)
commitae15b48311ab6c903ac2d0237ec48f3d6e4c76f4 (patch)
treee5521b7abb7512647e1525006fd4ce374f13882c /src
parentaad4b63a80f7461314e733de4f559d94f09246e9 (diff)
downloadblt-ae15b48311ab6c903ac2d0237ec48f3d6e4c76f4.zip
blt-ae15b48311ab6c903ac2d0237ec48f3d6e4c76f4.tar.gz
blt-ae15b48311ab6c903ac2d0237ec48f3d6e4c76f4.tar.bz2
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bltGrMarker.C118
-rw-r--r--src/bltGrMarker.h3
-rw-r--r--src/bltGrMarkerLine.C147
-rw-r--r--src/bltGrMarkerLine.h3
-rw-r--r--src/bltGrMarkerPolygon.C153
-rw-r--r--src/bltGrMarkerPolygon.h3
6 files changed, 138 insertions, 289 deletions
diff --git a/src/bltGrMarker.C b/src/bltGrMarker.C
index 3018efb..ef8e676 100644
--- a/src/bltGrMarker.C
+++ b/src/bltGrMarker.C
@@ -47,6 +47,9 @@ extern MarkerCreateProc Blt_CreateWindowProc;
// Defs
+static int GetCoordinate(Tcl_Interp* interp, Tcl_Obj *objPtr, double *valuePtr);
+static Tcl_Obj* PrintCoordinate(double x);
+
typedef int (GraphMarkerProc)(Graph* graphPtr, Tcl_Interp* interp, int objc,
Tcl_Obj* const objv[]);
@@ -69,6 +72,88 @@ extern "C" {
Marker* Blt_NearestMarker(Graph* graphPtr, int x, int y, int under);
};
+// OptionSpecs
+
+static Tk_CustomOptionSetProc CoordsSetProc;
+static Tk_CustomOptionGetProc CoordsGetProc;
+static Tk_CustomOptionFreeProc CoordsFreeProc;
+Tk_ObjCustomOption coordsObjOption =
+ {
+ "coords", CoordsSetProc, CoordsGetProc, RestoreProc, CoordsFreeProc, NULL
+ };
+
+static int CoordsSetProc(ClientData clientData, Tcl_Interp* interp,
+ Tk_Window tkwin, Tcl_Obj** objPtr, char* widgRec,
+ int offset, char* savePtr, int flags)
+{
+ Coords** coordsPtrPtr = (Coords**)(widgRec + offset);
+ *(double*)savePtr = *(double*)coordsPtrPtr;
+ *coordsPtrPtr = NULL;
+
+ int objc;
+ Tcl_Obj** objv;
+ if (Tcl_ListObjGetElements(interp, *objPtr, &objc, &objv) != TCL_OK)
+ return TCL_ERROR;
+
+ if (objc == 0)
+ return TCL_OK;
+
+ if (objc & 1) {
+ Tcl_AppendResult(interp, "odd number of marker coordinates specified",NULL);
+ return TCL_ERROR;
+ }
+
+ Coords* coordsPtr = (Coords*)calloc(1,sizeof(Coords));
+ coordsPtr->num = objc/2;
+ coordsPtr->points = (Point2d*)calloc(coordsPtr->num, sizeof(Point2d));
+
+ Point2d* pp = coordsPtr->points;
+ for (int ii=0; ii<objc; ii+=2) {
+ double x, y;
+ if ((GetCoordinate(interp, objv[ii], &x) != TCL_OK) ||
+ (GetCoordinate(interp, objv[ii+1], &y) != TCL_OK))
+ return TCL_ERROR;
+ pp->x = x;
+ pp->y = y;
+ pp++;
+ }
+
+ *coordsPtrPtr = coordsPtr;
+ return TCL_OK;
+}
+
+static Tcl_Obj* CoordsGetProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, int offset)
+{
+ Coords* coordsPtr = *(Coords**)(widgRec + offset);
+ if (!coordsPtr)
+ return Tcl_NewListObj(0, NULL);
+
+ int cnt = coordsPtr->num*2;
+ Tcl_Obj** ll = (Tcl_Obj**)calloc(cnt, sizeof(Tcl_Obj*));
+
+ Point2d* pp = coordsPtr->points;
+ for (int ii=0; ii<cnt; pp++) {
+ ll[ii++] = PrintCoordinate(pp->x);
+ ll[ii++] = PrintCoordinate(pp->y);
+ }
+
+ Tcl_Obj* listObjPtr = Tcl_NewListObj(cnt, ll);
+ free(ll);
+ return listObjPtr;
+}
+
+static void CoordsFreeProc(ClientData clientData, Tk_Window tkwin,
+ char *ptr)
+{
+ Coords* coordsPtr = *(Coords**)ptr;
+ if (coordsPtr) {
+ if (coordsPtr->points)
+ free(coordsPtr->points);
+ free(coordsPtr);
+ }
+}
+
static Tk_CustomOptionSetProc CapStyleSetProc;
static Tk_CustomOptionGetProc CapStyleGetProc;
Tk_ObjCustomOption capStyleObjOption =
@@ -635,9 +720,8 @@ static double VMap(Axis *axisPtr, double y)
}
y = NORMALIZE(axisPtr, y);
}
- if (axisPtr->descending) {
+ if (axisPtr->descending)
y = 1.0 - y;
- }
// Vertical transformation
return (((1.0 - y) * axisPtr->screenRange) + axisPtr->screenMin);
@@ -651,10 +735,12 @@ Point2d Blt_MapPoint(Point2d *pointPtr, Axis2d *axesPtr)
if (graphPtr->inverted) {
result.x = HMap(axesPtr->y, pointPtr->y);
result.y = VMap(axesPtr->x, pointPtr->x);
- } else {
+ }
+ else {
result.x = HMap(axesPtr->x, pointPtr->x);
result.y = VMap(axesPtr->y, pointPtr->y);
}
+
return result;
}
@@ -808,3 +894,29 @@ int Blt_BoxesDontOverlap(Graph* graphPtr, Region2d *extsPtr)
(extsPtr->bottom < (double)graphPtr->top));
}
+
+static Tcl_Obj* PrintCoordinate(double x)
+{
+ if (x == DBL_MAX)
+ return Tcl_NewStringObj("+Inf", -1);
+ else if (x == -DBL_MAX)
+ return Tcl_NewStringObj("-Inf", -1);
+ else
+ return Tcl_NewDoubleObj(x);
+}
+
+static int GetCoordinate(Tcl_Interp* interp, Tcl_Obj *objPtr, double *valuePtr)
+{
+ const char* expr = Tcl_GetString(objPtr);
+ char c = expr[0];
+ if ((c == 'I') && (strcmp(expr, "Inf") == 0))
+ *valuePtr = DBL_MAX; /* Elastic upper bound */
+ else if ((c == '-') && (expr[1] == 'I') && (strcmp(expr, "-Inf") == 0))
+ *valuePtr = -DBL_MAX; /* Elastic lower bound */
+ else if ((c == '+') && (expr[1] == 'I') && (strcmp(expr, "+Inf") == 0))
+ *valuePtr = DBL_MAX; /* Elastic upper bound */
+ else if (Blt_ExprDoubleFromObj(interp, objPtr, valuePtr) != TCL_OK)
+ return TCL_ERROR;
+
+ return TCL_OK;
+}
diff --git a/src/bltGrMarker.h b/src/bltGrMarker.h
index e065b94..63fe568 100644
--- a/src/bltGrMarker.h
+++ b/src/bltGrMarker.h
@@ -55,7 +55,7 @@ typedef struct {
typedef struct {
Point2d* points;
int num;
-} WorldPts;
+} Coords;
struct _Marker {
GraphObj obj;
@@ -78,6 +78,7 @@ Point2d Blt_MapPoint(Point2d *pointPtr, Axis2d *axesPtr);
void Blt_FreeMarker(char*);
int Blt_BoxesDontOverlap(Graph* graphPtr, Region2d *extsPtr);
+extern Tk_ObjCustomOption coordsObjOption;
extern Tk_ObjCustomOption capStyleObjOption;
extern Tk_ObjCustomOption joinStyleObjOption;
extern Tk_ObjCustomOption xAxisObjOption;
diff --git a/src/bltGrMarkerLine.C b/src/bltGrMarkerLine.C
index 68572b1..8fbc552 100644
--- a/src/bltGrMarkerLine.C
+++ b/src/bltGrMarkerLine.C
@@ -35,56 +35,8 @@ extern "C" {
// Defs
-static int GetCoordinate(Tcl_Interp* interp, Tcl_Obj *objPtr, double *valuePtr);
-static Tcl_Obj* PrintCoordinate(double x);
-static int ParseCoordinates(Tcl_Interp* interp, Marker *markerPtr,
- int objc, Tcl_Obj* const objv[]);
-
// OptionSpecs
-static Tk_CustomOptionSetProc CoordsSetProc;
-static Tk_CustomOptionGetProc CoordsGetProc;
-static Tk_ObjCustomOption coordsObjOption =
- {
- "coords", CoordsSetProc, CoordsGetProc, NULL, NULL, NULL
- };
-
-static int CoordsSetProc(ClientData clientData, Tcl_Interp* interp,
- Tk_Window tkwin, Tcl_Obj** objPtr, char* widgRec,
- int offset, char* save, int flags)
-{
- Marker* markerPtr = (Marker*)widgRec;
-
- int objc;
- Tcl_Obj** objv;
- if (Tcl_ListObjGetElements(interp, *objPtr, &objc, &objv) != TCL_OK)
- return TCL_ERROR;
-
- if (objc == 0)
- return TCL_OK;
-
- return ParseCoordinates(interp, markerPtr, objc, objv);
-}
-
-static Tcl_Obj* CoordsGetProc(ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset)
-{
- LineMarker* lmPtr = (LineMarker*)widgRec;
-
- int cnt = lmPtr->nWorldPts*2;
- Tcl_Obj** ll = (Tcl_Obj**)calloc(cnt, sizeof(Tcl_Obj*));
-
- Point2d* pp = lmPtr->worldPts;
- for (int ii=0; ii < lmPtr->nWorldPts*2; pp++) {
- ll[ii++] = PrintCoordinate(pp->x);
- ll[ii++] = PrintCoordinate(pp->y);
- }
-
- Tcl_Obj* listObjPtr = Tcl_NewListObj(cnt, ll);
- free(ll);
- return listObjPtr;
-}
-
static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_CUSTOM, "-bindtags", "bindTags", "BindTags",
"Line all", -1, Tk_Offset(LineMarker, obj.tags),
@@ -93,7 +45,7 @@ static Tk_OptionSpec optionSpecs[] = {
"butt", -1, Tk_Offset(LineMarker, capStyle), 0, &capStyleObjOption, 0},
{TK_OPTION_CUSTOM, "-coords", "coords", "Coords",
NULL, -1, Tk_Offset(LineMarker, worldPts),
- TK_OPTION_NULL_OK, &coordsObjOption, 0},
+ TK_OPTION_NULL_OK, &coordsObjOption, MAP_ITEM},
{TK_OPTION_CUSTOM, "-dashes", "dashes", "Dashes",
NULL, -1, Tk_Offset(LineMarker, dashes),
TK_OPTION_NULL_OK, &dashesObjOption, 0},
@@ -171,13 +123,13 @@ static int RegionInLineProc(Marker *markerPtr, Region2d *extsPtr, int enclosed)
{
LineMarker *lmPtr = (LineMarker*)markerPtr;
- if (lmPtr->nWorldPts < 2)
+ if (!lmPtr->worldPts || lmPtr->worldPts->num < 2)
return FALSE;
if (enclosed) {
Point2d *pp, *pend;
- for (pp = lmPtr->worldPts, pend = pp + lmPtr->nWorldPts;
+ for (pp = lmPtr->worldPts->points, pend = pp + lmPtr->worldPts->num;
pp < pend; pp++) {
Point2d p = Blt_MapPoint(pp, &markerPtr->axes);
if ((p.x < extsPtr->left) && (p.x > extsPtr->right) &&
@@ -190,7 +142,7 @@ static int RegionInLineProc(Marker *markerPtr, Region2d *extsPtr, int enclosed)
else {
Point2d *pp, *pend;
int count = 0;
- for (pp = lmPtr->worldPts, pend = pp + (lmPtr->nWorldPts - 1);
+ for (pp = lmPtr->worldPts->points, pend = pp + (lmPtr->worldPts->num - 1);
pp < pend; pp++) {
Point2d p = Blt_MapPoint(pp, &markerPtr->axes);
Point2d q = Blt_MapPoint(pp + 1, &markerPtr->axes);
@@ -322,7 +274,7 @@ static void MapLineProc(Marker *markerPtr)
if (lmPtr->segments)
free(lmPtr->segments);
- if (lmPtr->nWorldPts < 2)
+ if (!lmPtr->worldPts || (lmPtr->worldPts->num < 2))
return;
Region2d extents;
@@ -335,15 +287,15 @@ static void MapLineProc(Marker *markerPtr)
* disconnected segments.
*/
Segment2d* segments =
- (Segment2d*)malloc(lmPtr->nWorldPts * sizeof(Segment2d));
- Point2d* srcPtr = lmPtr->worldPts;
+ (Segment2d*)malloc(lmPtr->worldPts->num * sizeof(Segment2d));
+ Point2d* srcPtr = lmPtr->worldPts->points;
Point2d p = Blt_MapPoint(srcPtr, &markerPtr->axes);
p.x += markerPtr->xOffset;
p.y += markerPtr->yOffset;
Segment2d* segPtr = segments;
Point2d* pend;
- for (srcPtr++, pend = lmPtr->worldPts + lmPtr->nWorldPts;
+ for (srcPtr++, pend = lmPtr->worldPts->points + lmPtr->worldPts->num;
srcPtr < pend; srcPtr++) {
Point2d next = Blt_MapPoint(srcPtr, &markerPtr->axes);
next.x += lmPtr->xOffset;
@@ -362,86 +314,3 @@ static void MapLineProc(Marker *markerPtr)
lmPtr->clipped = (lmPtr->nSegments == 0);
}
-static int ParseCoordinates(Tcl_Interp* interp, Marker *markerPtr,
- int objc, Tcl_Obj* const objv[])
-{
- LineMarker* lmPtr = (LineMarker*)markerPtr;
-
- if (objc == 0)
- return TCL_OK;
-
- if (objc & 1) {
- Tcl_AppendResult(interp, "odd number of marker coordinates specified",
- (char*)NULL);
- return TCL_ERROR;
- }
-
- int minArgs = 4;
- int maxArgs = 0;
- if (objc < minArgs) {
- Tcl_AppendResult(interp, "too few marker coordinates specified",
- (char*)NULL);
- return TCL_ERROR;
- }
- if ((maxArgs > 0) && (objc > maxArgs)) {
- Tcl_AppendResult(interp, "too many marker coordinates specified",
- (char*)NULL);
- return TCL_ERROR;
- }
- int nWorldPts = objc / 2;
- Point2d* worldPts = (Point2d*)malloc(nWorldPts * sizeof(Point2d));
- if (worldPts == NULL) {
- Tcl_AppendResult(interp, "can't allocate new coordinate array",
- (char*)NULL);
- return TCL_ERROR;
- }
-
- Point2d* pp = worldPts;
- for (int ii=0; ii<objc; ii+=2) {
- double x, y;
- if ((GetCoordinate(interp, objv[ii], &x) != TCL_OK) ||
- (GetCoordinate(interp, objv[ii + 1], &y) != TCL_OK)) {
- free(worldPts);
- return TCL_ERROR;
- }
- pp->x = x, pp->y = y, pp++;
- }
-
- // Don't free the old coordinate array until we've parsed the new
- // coordinates without errors.
- if (lmPtr->worldPts)
- free(lmPtr->worldPts);
-
- lmPtr->worldPts = worldPts;
- lmPtr->nWorldPts = nWorldPts;
- markerPtr->flags |= MAP_ITEM;
-
- return TCL_OK;
-}
-
-static Tcl_Obj* PrintCoordinate(double x)
-{
- if (x == DBL_MAX)
- return Tcl_NewStringObj("+Inf", -1);
- else if (x == -DBL_MAX)
- return Tcl_NewStringObj("-Inf", -1);
- else
- return Tcl_NewDoubleObj(x);
-}
-
-static int GetCoordinate(Tcl_Interp* interp, Tcl_Obj *objPtr, double *valuePtr)
-{
- const char* expr = Tcl_GetString(objPtr);
- char c = expr[0];
- if ((c == 'I') && (strcmp(expr, "Inf") == 0))
- *valuePtr = DBL_MAX; /* Elastic upper bound */
- else if ((c == '-') && (expr[1] == 'I') && (strcmp(expr, "-Inf") == 0))
- *valuePtr = -DBL_MAX; /* Elastic lower bound */
- else if ((c == '+') && (expr[1] == 'I') && (strcmp(expr, "+Inf") == 0))
- *valuePtr = DBL_MAX; /* Elastic upper bound */
- else if (Blt_ExprDoubleFromObj(interp, objPtr, valuePtr) != TCL_OK)
- return TCL_ERROR;
-
- return TCL_OK;
-}
-
diff --git a/src/bltGrMarkerLine.h b/src/bltGrMarkerLine.h
index 5401a05..f2f28c3 100644
--- a/src/bltGrMarkerLine.h
+++ b/src/bltGrMarkerLine.h
@@ -51,8 +51,7 @@ class LineMarker {
// Fields specific to line
- Point2d *worldPts;
- int nWorldPts;
+ Coords* worldPts;
XColor* fillColor;
XColor* outlineColor;
int lineWidth;
diff --git a/src/bltGrMarkerPolygon.C b/src/bltGrMarkerPolygon.C
index fd07701..47c411e 100644
--- a/src/bltGrMarkerPolygon.C
+++ b/src/bltGrMarkerPolygon.C
@@ -33,55 +33,8 @@ extern "C" {
#include "bltGrMarkerPolygon.h"
-static int GetCoordinate(Tcl_Interp* interp, Tcl_Obj *objPtr, double *valuePtr);
-static Tcl_Obj* PrintCoordinate(double x);
-static int ParseCoordinates(Tcl_Interp* interp, Marker *markerPtr,
- int objc, Tcl_Obj* const objv[]);
// OptionSpecs
-static Tk_CustomOptionSetProc CoordsSetProc;
-static Tk_CustomOptionGetProc CoordsGetProc;
-static Tk_ObjCustomOption coordsObjOption =
- {
- "coords", CoordsSetProc, CoordsGetProc, NULL, NULL, NULL
- };
-
-static int CoordsSetProc(ClientData clientData, Tcl_Interp* interp,
- Tk_Window tkwin, Tcl_Obj** objPtr, char* widgRec,
- int offset, char* save, int flags)
-{
- Marker* markerPtr = (Marker*)widgRec;
-
- int objc;
- Tcl_Obj** objv;
- if (Tcl_ListObjGetElements(interp, *objPtr, &objc, &objv) != TCL_OK)
- return TCL_ERROR;
-
- if (objc == 0)
- return TCL_OK;
-
- return ParseCoordinates(interp, markerPtr, objc, objv);
-}
-
-static Tcl_Obj* CoordsGetProc(ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset)
-{
- PolygonMarker* pmPtr = (PolygonMarker*)widgRec;
-
- int cnt = pmPtr->nWorldPts*2;
- Tcl_Obj** ll = (Tcl_Obj**)calloc(cnt, sizeof(Tcl_Obj*));
-
- Point2d* pp = pmPtr->worldPts;
- for (int ii=0; ii < pmPtr->nWorldPts*2; pp++) {
- ll[ii++] = PrintCoordinate(pp->x);
- ll[ii++] = PrintCoordinate(pp->y);
- }
-
- Tcl_Obj* listObjPtr = Tcl_NewListObj(cnt, ll);
- free(ll);
- return listObjPtr;
-}
-
static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_CUSTOM, "-bindtags", "bindTags", "BindTags",
"Polygon all", -1, Tk_Offset(PolygonMarker, obj.tags),
@@ -164,10 +117,10 @@ static int PointInPolygonProc(Marker *markerPtr, Point2d *samplePtr)
{
PolygonMarker *pmPtr = (PolygonMarker *)markerPtr;
- if ((pmPtr->nWorldPts >= 3) && (pmPtr->screenPts)) {
+ if (pmPtr->worldPts && (pmPtr->worldPts->num >= 3) && (pmPtr->screenPts))
return Blt_PointInPolygon(samplePtr, pmPtr->screenPts,
- pmPtr->nWorldPts + 1);
- }
+ pmPtr->worldPts->num + 1);
+
return FALSE;
}
@@ -176,10 +129,10 @@ static int RegionInPolygonProc(Marker *markerPtr, Region2d *extsPtr,
{
PolygonMarker *pmPtr = (PolygonMarker *)markerPtr;
- if ((pmPtr->nWorldPts >= 3) && (pmPtr->screenPts)) {
+ if (pmPtr->worldPts && (pmPtr->worldPts->num >= 3) && (pmPtr->screenPts))
return Blt_RegionInPolygon(extsPtr, pmPtr->screenPts,
- pmPtr->nWorldPts, enclosed);
- }
+ pmPtr->worldPts->num, enclosed);
+
return FALSE;
}
@@ -406,21 +359,20 @@ static void MapPolygonProc(Marker *markerPtr)
free(pmPtr->screenPts);
pmPtr->screenPts = NULL;
}
- if (pmPtr->nWorldPts < 3) {
- return; /* Too few points */
- }
+ if (!pmPtr->worldPts || pmPtr->worldPts->num < 3)
+ return;
/*
* Allocate and fill a temporary array to hold the screen coordinates of
* the polygon.
*/
- int nScreenPts = pmPtr->nWorldPts + 1;
+ int nScreenPts = pmPtr->worldPts->num + 1;
Point2d* screenPts = (Point2d*)malloc((nScreenPts + 1) * sizeof(Point2d));
{
Point2d *sp, *dp, *send;
dp = screenPts;
- for (sp = pmPtr->worldPts, send = sp + pmPtr->nWorldPts;
+ for (sp = pmPtr->worldPts->points, send = sp + pmPtr->worldPts->num;
sp < send; sp++) {
*dp = Blt_MapPoint(sp, &pmPtr->axes);
dp->x += pmPtr->xOffset;
@@ -434,7 +386,7 @@ static void MapPolygonProc(Marker *markerPtr)
pmPtr->clipped = TRUE;
if (pmPtr->fill) { /* Polygon fill required. */
Point2d* fillPts = (Point2d*)malloc(sizeof(Point2d) * nScreenPts * 3);
- int n = Blt_PolyRectClip(&extents, screenPts, pmPtr->nWorldPts,fillPts);
+ int n = Blt_PolyRectClip(&extents, screenPts, pmPtr->worldPts->num,fillPts);
if (n < 3) {
free(fillPts);
} else {
@@ -476,86 +428,3 @@ static void MapPolygonProc(Marker *markerPtr)
pmPtr->screenPts = screenPts;
}
-static int ParseCoordinates(Tcl_Interp* interp, Marker *markerPtr,
- int objc, Tcl_Obj* const objv[])
-{
- PolygonMarker* pmPtr = (PolygonMarker*)markerPtr;
-
- if (objc == 0)
- return TCL_OK;
-
- if (objc & 1) {
- Tcl_AppendResult(interp, "odd number of marker coordinates specified",
- (char*)NULL);
- return TCL_ERROR;
- }
-
- int minArgs = 6;
- int maxArgs = 0;
- if (objc < minArgs) {
- Tcl_AppendResult(interp, "too few marker coordinates specified",
- (char*)NULL);
- return TCL_ERROR;
- }
- if ((maxArgs > 0) && (objc > maxArgs)) {
- Tcl_AppendResult(interp, "too many marker coordinates specified",
- (char*)NULL);
- return TCL_ERROR;
- }
- int nWorldPts = objc / 2;
- Point2d* worldPts = (Point2d*)malloc(nWorldPts * sizeof(Point2d));
- if (worldPts == NULL) {
- Tcl_AppendResult(interp, "can't allocate new coordinate array",
- (char*)NULL);
- return TCL_ERROR;
- }
-
- Point2d* pp = worldPts;
- for (int ii=0; ii<objc; ii+=2) {
- double x, y;
- if ((GetCoordinate(interp, objv[ii], &x) != TCL_OK) ||
- (GetCoordinate(interp, objv[ii + 1], &y) != TCL_OK)) {
- free(worldPts);
- return TCL_ERROR;
- }
- pp->x = x, pp->y = y, pp++;
- }
-
- // Don't free the old coordinate array until we've parsed the new
- // coordinates without errors.
- if (pmPtr->worldPts)
- free(pmPtr->worldPts);
-
- pmPtr->worldPts = worldPts;
- pmPtr->nWorldPts = nWorldPts;
- pmPtr->flags |= MAP_ITEM;
-
- return TCL_OK;
-}
-
-static Tcl_Obj* PrintCoordinate(double x)
-{
- if (x == DBL_MAX)
- return Tcl_NewStringObj("+Inf", -1);
- else if (x == -DBL_MAX)
- return Tcl_NewStringObj("-Inf", -1);
- else
- return Tcl_NewDoubleObj(x);
-}
-
-static int GetCoordinate(Tcl_Interp* interp, Tcl_Obj *objPtr, double *valuePtr)
-{
- const char* expr = Tcl_GetString(objPtr);
- char c = expr[0];
- if ((c == 'I') && (strcmp(expr, "Inf") == 0))
- *valuePtr = DBL_MAX; /* Elastic upper bound */
- else if ((c == '-') && (expr[1] == 'I') && (strcmp(expr, "-Inf") == 0))
- *valuePtr = -DBL_MAX; /* Elastic lower bound */
- else if ((c == '+') && (expr[1] == 'I') && (strcmp(expr, "+Inf") == 0))
- *valuePtr = DBL_MAX; /* Elastic upper bound */
- else if (Blt_ExprDoubleFromObj(interp, objPtr, valuePtr) != TCL_OK)
- return TCL_ERROR;
-
- return TCL_OK;
-}
-
diff --git a/src/bltGrMarkerPolygon.h b/src/bltGrMarkerPolygon.h
index 8b29075..7a29481 100644
--- a/src/bltGrMarkerPolygon.h
+++ b/src/bltGrMarkerPolygon.h
@@ -51,8 +51,7 @@ class PolygonMarker {
// Fields specific to polygon
- Point2d *worldPts;
- int nWorldPts;
+ Coords* worldPts;
Point2d *screenPts;
XColor* outline;
XColor* outlineBg;