aboutsummaryrefslogtreecommitdiff
path: root/generic/Map.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/Map.c')
-rw-r--r--generic/Map.c942
1 files changed, 471 insertions, 471 deletions
diff --git a/generic/Map.c b/generic/Map.c
index 7b1f8f5..a307f61 100644
--- a/generic/Map.c
+++ b/generic/Map.c
@@ -1,8 +1,8 @@
/*
* Map.c -- Implementation of Map item.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
@@ -53,36 +53,36 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
*/
typedef struct _MapItemStruct {
- ZnItemStruct header;
+ ZnItemStruct header;
/* Public data */
- ZnBool filled;
- ZnImage fill_pattern;
- ZnGradient *color;
- Tk_Font text_font; /* null value -> use zn_map_text_font */
- char *map_info_name;
- ZnList symbol_patterns;
+ ZnBool filled;
+ ZnImage fill_pattern;
+ ZnGradient *color;
+ Tk_Font text_font; /* null value -> use zn_map_text_font */
+ char *map_info_name;
+ ZnList symbol_patterns;
/* Private data */
- ZnMapInfoId map_info;
- ZnList vectors;
- ZnList dashed_vectors;
- ZnList dotted_vectors;
- ZnList mixed_vectors;
- ZnList arcs;
- ZnList dashed_arcs;
- ZnList dotted_arcs;
- ZnList mixed_arcs;
- ZnList marks;
- ZnList symbols;
- ZnList texts;
+ ZnMapInfoId map_info;
+ ZnList vectors;
+ ZnList dashed_vectors;
+ ZnList dotted_vectors;
+ ZnList mixed_vectors;
+ ZnList arcs;
+ ZnList dashed_arcs;
+ ZnList dotted_arcs;
+ ZnList mixed_arcs;
+ ZnList marks;
+ ZnList symbols;
+ ZnList texts;
#ifdef GL
- ZnTexFontInfo *tfi;
+ ZnTexFontInfo *tfi;
#endif
} MapItemStruct, *MapItem;
-static ZnAttrConfig map_attrs[] = {
+static ZnAttrConfig map_attrs[] = {
{ ZN_CONFIG_GRADIENT, "-color", NULL,
Tk_Offset(MapItemStruct, color), 0, ZN_DRAW_FLAG, False },
{ ZN_CONFIG_BOOL, "-composealpha", NULL,
@@ -122,10 +122,10 @@ static ZnAttrConfig map_attrs[] = {
void
-UpdateMapInfo(ClientData client_data,
- ZnMapInfoId map_info)
+UpdateMapInfo(ClientData client_data,
+ ZnMapInfoId map_info)
{
- ZnItem item = (ZnItem) client_data;
+ ZnItem item = (ZnItem) client_data;
/*printf("updating a map 'cause of a change in mapinfo\n");*/
ZnITEM.Invalidate(item, ZN_COORDS_FLAG);
@@ -133,7 +133,7 @@ UpdateMapInfo(ClientData client_data,
static void
-FreeLists(MapItem map)
+FreeLists(MapItem map)
{
if (map->vectors) {
ZnListFree(map->vectors);
@@ -194,12 +194,12 @@ FreeLists(MapItem map)
**********************************************************************************
*/
static int
-Init(ZnItem item,
- int *argc,
- Tcl_Obj *CONST *args[])
+Init(ZnItem item,
+ int *argc,
+ Tcl_Obj *CONST *args[])
{
- MapItem map = (MapItem) item;
- ZnWInfo *wi = item->wi;
+ MapItem map = (MapItem) item;
+ ZnWInfo *wi = item->wi;
SET(item->flags, ZN_VISIBLE_BIT);
CLEAR(item->flags, ZN_SENSITIVE_BIT);
@@ -213,7 +213,7 @@ Init(ZnItem item,
map->symbol_patterns = NULL;
map->color = ZnGetGradientByValue(wi->fore_color);
map->text_font = Tk_GetFont(wi->interp, wi->win,
- Tk_NameOfFont(wi->map_text_font));
+ Tk_NameOfFont(wi->map_text_font));
#ifdef GL
map->tfi = NULL;
#endif
@@ -246,10 +246,10 @@ Init(ZnItem item,
*/
static void
-Clone(ZnItem item)
+Clone(ZnItem item)
{
- MapItem map = (MapItem) item;
- ZnWInfo *wi = item->wi;
+ MapItem map = (MapItem) item;
+ ZnWInfo *wi = item->wi;
if (map->vectors) {
map->vectors = ZnListDuplicate(map->vectors);
@@ -295,7 +295,7 @@ Clone(ZnItem item)
strcpy(text, map->map_info_name);
map->map_info_name = text;
map->map_info = ZnGetMapInfo(wi->interp, map->map_info_name,
- UpdateMapInfo, (ClientData) map);
+ UpdateMapInfo, (ClientData) map);
}
map->color = ZnGetGradientByValue(map->color);
@@ -325,14 +325,14 @@ Clone(ZnItem item)
**********************************************************************************
*
* Destroy --
- * Free the Map storage.
+ * Free the Map storage.
*
**********************************************************************************
*/
static void
-Destroy(ZnItem item)
+Destroy(ZnItem item)
{
- MapItem map = (MapItem) item;
+ MapItem map = (MapItem) item;
FreeLists(map);
ZnFreeGradient(map->color);
@@ -348,13 +348,13 @@ Destroy(ZnItem item)
}
if (map->symbol_patterns) {
ZnImage *pats;
- int i, num_pats;
+ int i, num_pats;
pats = ZnListArray(map->symbol_patterns);
num_pats = ZnListSize(map->symbol_patterns);
for (i = 0; i < num_pats; i++) {
if (pats[i] != ZnUnspecifiedImage) {
- ZnFreeImage(pats[i], NULL, NULL);
+ ZnFreeImage(pats[i], NULL, NULL);
}
}
ZnListFree(map->symbol_patterns);
@@ -376,15 +376,15 @@ Destroy(ZnItem item)
**********************************************************************************
*/
static int
-Configure(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[],
- int *flags)
+Configure(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[],
+ int *flags)
{
- ZnWInfo *wi = item->wi;
- MapItem map = (MapItem) item;
+ ZnWInfo *wi = item->wi;
+ MapItem map = (MapItem) item;
#ifdef GL
- Tk_Font old_font = map->text_font;
+ Tk_Font old_font = map->text_font;
#endif
if (ZnConfigureAttributes(wi, item, item, map_attrs, argc, argv, flags) == TCL_ERROR) {
@@ -400,14 +400,14 @@ Configure(ZnItem item,
}
#endif
if (ISSET(*flags, ZN_MAP_INFO_FLAG)) {
- ZnMapInfoId map_info;
- ZnBool error = False;
+ ZnMapInfoId map_info;
+ ZnBool error = False;
if (map->map_info_name) {
map_info = ZnGetMapInfo(wi->interp, map->map_info_name,
- UpdateMapInfo, (ClientData) map);
+ UpdateMapInfo, (ClientData) map);
if (!map_info) {
- error = True;
+ error = True;
}
}
else {
@@ -415,7 +415,7 @@ Configure(ZnItem item,
}
if (!error) {
if (map->map_info != NULL) {
- ZnFreeMapInfo(map->map_info, UpdateMapInfo, (ClientData) map);
+ ZnFreeMapInfo(map->map_info, UpdateMapInfo, (ClientData) map);
}
map->map_info = map_info;
}
@@ -436,9 +436,9 @@ Configure(ZnItem item,
**********************************************************************************
*/
static int
-Query(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[])
+Query(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[])
{
if (ZnQueryAttribute(item->wi->interp, item, map_attrs, argv[0]) == TCL_ERROR) {
return TCL_ERROR;
@@ -457,42 +457,42 @@ Query(ZnItem item,
*/
static void
-ComputeCoordinates(ZnItem item,
- ZnBool force)
+ComputeCoordinates(ZnItem item,
+ ZnBool force)
{
- ZnWInfo *wi = item->wi;
- MapItem map = (MapItem) item;
- ZnMapInfoId map_info;
- ZnMapInfoLineStyle line_style;
- ZnMapInfoTextStyle text_style;
- char symbol;
- char *text;
- unsigned int i, j, cnt;
- unsigned int num_points;
- unsigned int num_dashed_points;
- unsigned int num_dotted_points;
- unsigned int num_mixed_points;
- unsigned int num_arcs;
- unsigned int num_dashed_arcs;
- unsigned int num_dotted_arcs;
- unsigned int num_mixed_arcs;
- unsigned int num_marks;
- ZnPoint *vectors, *dashed_vectors, *dotted_vectors;
- ZnPoint *mixed_vectors, *marks;
- XArc *arcs, *dashed_arcs, *dotted_arcs, *mixed_arcs;
- ZnPoint *symbols, *texts;
- ZnPoint from, to, center;
- ZnPoint tmp_from, tmp_to;
- XArc arc;
- ZnBBox bbox, bbox_inter, zn_bbox;
- ZnPos x_from_w, y_from_w, x_to_w, y_to_w;
- ZnPos start_angle, extend;
- ZnDim radius_w, line_width;
- int radius;
- ZnPoint *new_marks;
- unsigned int n_new_marks;
- Tk_Font text_font;
- int sym_w2=0, sym_h2=0;
+ ZnWInfo *wi = item->wi;
+ MapItem map = (MapItem) item;
+ ZnMapInfoId map_info;
+ ZnMapInfoLineStyle line_style;
+ ZnMapInfoTextStyle text_style;
+ char symbol;
+ char *text;
+ unsigned int i, j, cnt;
+ unsigned int num_points;
+ unsigned int num_dashed_points;
+ unsigned int num_dotted_points;
+ unsigned int num_mixed_points;
+ unsigned int num_arcs;
+ unsigned int num_dashed_arcs;
+ unsigned int num_dotted_arcs;
+ unsigned int num_mixed_arcs;
+ unsigned int num_marks;
+ ZnPoint *vectors, *dashed_vectors, *dotted_vectors;
+ ZnPoint *mixed_vectors, *marks;
+ XArc *arcs, *dashed_arcs, *dotted_arcs, *mixed_arcs;
+ ZnPoint *symbols, *texts;
+ ZnPoint from, to, center;
+ ZnPoint tmp_from, tmp_to;
+ XArc arc;
+ ZnBBox bbox, bbox_inter, zn_bbox;
+ ZnPos x_from_w, y_from_w, x_to_w, y_to_w;
+ ZnPos start_angle, extend;
+ ZnDim radius_w, line_width;
+ int radius;
+ ZnPoint *new_marks;
+ unsigned int n_new_marks;
+ Tk_Font text_font;
+ int sym_w2=0, sym_h2=0;
ZnResetBBox(&item->item_bounding_box);
@@ -506,15 +506,15 @@ ComputeCoordinates(ZnItem item,
map_info = map->map_info;
- num_points = 0;
- num_dashed_points = 0;
- num_dotted_points = 0;
- num_mixed_points = 0;
- num_marks = 0;
- num_arcs = 0;
- num_dashed_arcs = 0;
- num_dotted_arcs = 0;
- num_mixed_arcs = 0;
+ num_points = 0;
+ num_dashed_points = 0;
+ num_dotted_points = 0;
+ num_mixed_points = 0;
+ num_marks = 0;
+ num_arcs = 0;
+ num_dashed_arcs = 0;
+ num_dotted_arcs = 0;
+ num_mixed_arcs = 0;
/*
* Experimental code to help trap out of bounds
@@ -559,17 +559,17 @@ ComputeCoordinates(ZnItem item,
switch (line_style) {
case ZnMapInfoLineSimple:
case ZnMapInfoLineMarked:
- num_points += 2;
- break;
+ num_points += 2;
+ break;
case ZnMapInfoLineDotted:
- num_dotted_points += 2;
- break;
+ num_dotted_points += 2;
+ break;
case ZnMapInfoLineMixed:
- num_mixed_points += 2;
- break;
+ num_mixed_points += 2;
+ break;
case ZnMapInfoLineDashed:
- num_dashed_points += 2;
- break;
+ num_dashed_points += 2;
+ break;
}
}
}
@@ -648,17 +648,17 @@ ComputeCoordinates(ZnItem item,
/*
* Ask the pointers to the actual arrays.
*/
- vectors = (ZnPoint *) ZnListArray(map->vectors);
+ vectors = (ZnPoint *) ZnListArray(map->vectors);
dashed_vectors = (ZnPoint *) ZnListArray(map->dashed_vectors);
dotted_vectors = (ZnPoint *) ZnListArray(map->dotted_vectors);
- mixed_vectors = (ZnPoint *) ZnListArray(map->mixed_vectors);
- arcs = (XArc *) ZnListArray(map->arcs);
- dashed_arcs = (XArc *) ZnListArray(map->dashed_arcs);
- dotted_arcs = (XArc *) ZnListArray(map->dotted_arcs);
- mixed_arcs = (XArc *) ZnListArray(map->mixed_arcs);
- marks = (ZnPoint *) ZnListArray(map->marks);
- symbols = (ZnPoint *) ZnListArray(map->symbols);
- texts = (ZnPoint *) ZnListArray(map->texts);
+ mixed_vectors = (ZnPoint *) ZnListArray(map->mixed_vectors);
+ arcs = (XArc *) ZnListArray(map->arcs);
+ dashed_arcs = (XArc *) ZnListArray(map->dashed_arcs);
+ dotted_arcs = (XArc *) ZnListArray(map->dotted_arcs);
+ mixed_arcs = (XArc *) ZnListArray(map->mixed_arcs);
+ marks = (ZnPoint *) ZnListArray(map->marks);
+ symbols = (ZnPoint *) ZnListArray(map->symbols);
+ texts = (ZnPoint *) ZnListArray(map->texts);
if (num_marks && (wi->map_distance_symbol != ZnUnspecifiedImage)) {
ZnSizeOfImage(wi->map_distance_symbol, &sym_w2, &sym_h2);
@@ -666,26 +666,26 @@ ComputeCoordinates(ZnItem item,
sym_h2 = (sym_h2+1)/2;
}
/*printf("Map: %d %d %d %d %d, texts: %d, symbols: %d\n", num_points, num_dashed_points, num_dotted_points,
- num_mixed_points, num_marks, ZnMapInfoNumTexts(map_info), ZnMapInfoNumSymbols(map_info));*/
+ num_mixed_points, num_marks, ZnMapInfoNumTexts(map_info), ZnMapInfoNumSymbols(map_info));*/
/*
* Reset the counts of points to compute the actual
* counts taking into account the clipping and the
* filled attribute.
*/
- num_points = 0;
- num_dashed_points = 0;
- num_dotted_points = 0;
- num_mixed_points = 0;
- num_marks = 0;
- num_arcs = 0;
- num_dashed_arcs = 0;
- num_dotted_arcs = 0;
- num_mixed_arcs = 0;
+ num_points = 0;
+ num_dashed_points = 0;
+ num_dotted_points = 0;
+ num_mixed_points = 0;
+ num_marks = 0;
+ num_arcs = 0;
+ num_dashed_arcs = 0;
+ num_dotted_arcs = 0;
+ num_mixed_arcs = 0;
cnt = ZnMapInfoNumLines(map_info);
for (i = 0; i < cnt; i++) {
ZnMapInfoGetLine(map_info, i, NULL, &line_style, &line_width,
- &x_from_w, &y_from_w, &x_to_w, &y_to_w);
+ &x_from_w, &y_from_w, &x_to_w, &y_to_w);
tmp_from.x = x_from_w;
tmp_from.y = y_from_w;
@@ -703,7 +703,7 @@ ComputeCoordinates(ZnItem item,
if (!map->filled) {
if (ZnLineInBBox(&from, &to, &zn_bbox) < 0) {
- continue;
+ continue;
}
}
@@ -716,52 +716,52 @@ ComputeCoordinates(ZnItem item,
break;
case ZnMapInfoLineDashed:
if (!map->filled) {
- dashed_vectors[num_dashed_points] = from;
- num_dashed_points++;
- dashed_vectors[num_dashed_points] = to;
- num_dashed_points++;
+ dashed_vectors[num_dashed_points] = from;
+ num_dashed_points++;
+ dashed_vectors[num_dashed_points] = to;
+ num_dashed_points++;
}
break;
case ZnMapInfoLineDotted:
if (!map->filled) {
- dotted_vectors[num_dotted_points] = from;
- num_dotted_points++;
- dotted_vectors[num_dotted_points] = to;
- num_dotted_points++;
+ dotted_vectors[num_dotted_points] = from;
+ num_dotted_points++;
+ dotted_vectors[num_dotted_points] = to;
+ num_dotted_points++;
}
break;
case ZnMapInfoLineMixed:
if (!map->filled) {
- mixed_vectors[num_mixed_points] = from;
- num_mixed_points++;
- mixed_vectors[num_mixed_points] = to;
- num_mixed_points++;
+ mixed_vectors[num_mixed_points] = from;
+ num_mixed_points++;
+ mixed_vectors[num_mixed_points] = to;
+ num_mixed_points++;
}
break;
case ZnMapInfoLineMarked:
if (!map->filled) {
- vectors[num_points] = from;
- num_points++;
- vectors[num_points] = to;
- num_points++;
- if (wi->map_distance_symbol != ZnUnspecifiedImage) {
- ZnMapInfoGetMarks(map_info, i, &new_marks, &n_new_marks);
- for (j = 0; j < n_new_marks; j++) {
- /*
- * The transform can be put outside the loop when
- * MapInfo point type is modified to ZnPoint.
- * Will use then ZnTransformPoints.
- */
- tmp_from.x = new_marks[j].x;
- tmp_from.y = new_marks[j].y;
- ZnTransformPoint(wi->current_transfo, &tmp_from, &marks[num_marks]);
- ZnAddPointToBBox(&item->item_bounding_box,
- marks[num_marks].x-sym_w2, marks[num_marks].y-sym_h2);
- ZnAddPointToBBox(&item->item_bounding_box,
- marks[num_marks].x+sym_w2, marks[num_marks].x+sym_h2);
- num_marks++;
- }
- }
+ vectors[num_points] = from;
+ num_points++;
+ vectors[num_points] = to;
+ num_points++;
+ if (wi->map_distance_symbol != ZnUnspecifiedImage) {
+ ZnMapInfoGetMarks(map_info, i, &new_marks, &n_new_marks);
+ for (j = 0; j < n_new_marks; j++) {
+ /*
+ * The transform can be put outside the loop when
+ * MapInfo point type is modified to ZnPoint.
+ * Will use then ZnTransformPoints.
+ */
+ tmp_from.x = new_marks[j].x;
+ tmp_from.y = new_marks[j].y;
+ ZnTransformPoint(wi->current_transfo, &tmp_from, &marks[num_marks]);
+ ZnAddPointToBBox(&item->item_bounding_box,
+ marks[num_marks].x-sym_w2, marks[num_marks].y-sym_h2);
+ ZnAddPointToBBox(&item->item_bounding_box,
+ marks[num_marks].x+sym_w2, marks[num_marks].x+sym_h2);
+ num_marks++;
+ }
+ }
}
break;
}
@@ -772,7 +772,7 @@ ComputeCoordinates(ZnItem item,
ZnPoint xp;
ZnMapInfoGetArc(map_info, i, NULL, &line_style, &line_width,
- &x_from_w, &y_from_w, &radius_w, &start_angle, &extend);
+ &x_from_w, &y_from_w, &radius_w, &start_angle, &extend);
tmp_from.x = x_from_w;
tmp_from.y = y_from_w;
@@ -799,12 +799,12 @@ ComputeCoordinates(ZnItem item,
continue;
}
- arc.x = (int) (center.x - radius);
- arc.y = (int) (center.y - radius);
- arc.width = 2 * radius;
- arc.height = arc.width;
- arc.angle1 = ((unsigned short) start_angle) * 64;
- arc.angle2 = ((unsigned short) extend) * 64;
+ arc.x = (int) (center.x - radius);
+ arc.y = (int) (center.y - radius);
+ arc.width = 2 * radius;
+ arc.height = arc.width;
+ arc.angle1 = ((unsigned short) start_angle) * 64;
+ arc.angle2 = ((unsigned short) extend) * 64;
switch (line_style) {
case ZnMapInfoLineSimple:
@@ -820,38 +820,38 @@ ComputeCoordinates(ZnItem item,
break;
case ZnMapInfoLineDashed:
if (!map->filled) {
- dashed_arcs[num_dashed_arcs] = arc;
- num_dashed_arcs++;
-
- bbox.orig.x = arc.x;
- bbox.orig.y = arc.y;
- bbox.corner.x = bbox.orig.x + arc.width + 1;
- bbox.corner.y = bbox.orig.y + arc.height + 1;
- ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
+ dashed_arcs[num_dashed_arcs] = arc;
+ num_dashed_arcs++;
+
+ bbox.orig.x = arc.x;
+ bbox.orig.y = arc.y;
+ bbox.corner.x = bbox.orig.x + arc.width + 1;
+ bbox.corner.y = bbox.orig.y + arc.height + 1;
+ ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
}
break;
case ZnMapInfoLineDotted:
if (!map->filled) {
- dotted_arcs[num_dotted_arcs] = arc;
- num_dotted_arcs++;
-
- bbox.orig.x = arc.x;
- bbox.orig.y = arc.y;
- bbox.corner.x = bbox.orig.x + arc.width + 1;
- bbox.corner.y = bbox.orig.y + arc.height + 1;
- ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
+ dotted_arcs[num_dotted_arcs] = arc;
+ num_dotted_arcs++;
+
+ bbox.orig.x = arc.x;
+ bbox.orig.y = arc.y;
+ bbox.corner.x = bbox.orig.x + arc.width + 1;
+ bbox.corner.y = bbox.orig.y + arc.height + 1;
+ ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
}
break;
case ZnMapInfoLineMixed:
if (!map->filled) {
- mixed_arcs[num_mixed_arcs] = arc;
- num_mixed_arcs++;
-
- bbox.orig.x = arc.x;
- bbox.orig.y = arc.y;
- bbox.corner.x = bbox.orig.x + arc.width + 1;
- bbox.corner.y = bbox.orig.y + arc.height + 1;
- ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
+ mixed_arcs[num_mixed_arcs] = arc;
+ num_mixed_arcs++;
+
+ bbox.orig.x = arc.x;
+ bbox.orig.y = arc.y;
+ bbox.corner.x = bbox.orig.x + arc.width + 1;
+ bbox.corner.y = bbox.orig.y + arc.height + 1;
+ ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
}
break;
}
@@ -873,20 +873,20 @@ ComputeCoordinates(ZnItem item,
cnt = ZnMapInfoNumSymbols(map_info);
for (i = 0; i < cnt; i++) {
- ZnMapInfoGetSymbol(map_info, i, NULL, &x_from_w, &y_from_w, &symbol);
- tmp_from.x = x_from_w;
- tmp_from.y = y_from_w;
- ZnTransformPoint(wi->current_transfo, &tmp_from, &symbols[i]);
- sym = syms[symbol%num_syms];
- if (sym != ZnUnspecifiedImage) {
- ZnSizeOfImage(sym, &sym_w2, &sym_h2);
- sym_w2 = (sym_w2+1)/2;
- sym_h2 = (sym_h2+1)/2;
- ZnAddPointToBBox(&item->item_bounding_box,
- symbols[i].x-sym_w2, symbols[i].y-sym_h2);
- ZnAddPointToBBox(&item->item_bounding_box,
- symbols[i].x+sym_w2, symbols[i].y+sym_h2);
- }
+ ZnMapInfoGetSymbol(map_info, i, NULL, &x_from_w, &y_from_w, &symbol);
+ tmp_from.x = x_from_w;
+ tmp_from.y = y_from_w;
+ ZnTransformPoint(wi->current_transfo, &tmp_from, &symbols[i]);
+ sym = syms[symbol%num_syms];
+ if (sym != ZnUnspecifiedImage) {
+ ZnSizeOfImage(sym, &sym_w2, &sym_h2);
+ sym_w2 = (sym_w2+1)/2;
+ sym_h2 = (sym_h2+1)/2;
+ ZnAddPointToBBox(&item->item_bounding_box,
+ symbols[i].x-sym_w2, symbols[i].y-sym_h2);
+ ZnAddPointToBBox(&item->item_bounding_box,
+ symbols[i].x+sym_w2, symbols[i].y+sym_h2);
+ }
}
ZnListAssertSize(map->symbols, cnt);
}
@@ -895,48 +895,48 @@ ComputeCoordinates(ZnItem item,
text_font = map->text_font ? map->text_font : wi->map_text_font;
for (i = 0; i < cnt; i++) {
ZnMapInfoGetText(map_info, i, NULL,
- &text_style, &line_style, &x_from_w, &y_from_w, &text);
+ &text_style, &line_style, &x_from_w, &y_from_w, &text);
tmp_from.x = x_from_w;
tmp_from.y = y_from_w;
ZnTransformPoint(wi->current_transfo, &tmp_from, &texts[i]);
ZnAddStringToBBox(&item->item_bounding_box, text, text_font,
- texts[i].x, texts[i].y);
+ texts[i].x, texts[i].y);
if (text_style == ZnMapInfoUnderlinedText) {
- ZnGetStringBBox(text, text_font, texts[i].x, texts[i].y, &bbox);
-
- from.x = bbox.orig.x;
- from.y = bbox.corner.y;
- to.x = bbox.corner.x;
- to.y = bbox.corner.y;
-
- switch (line_style) {
- case ZnMapInfoLineSimple:
- case ZnMapInfoLineMarked:
- vectors[num_points] = from;
- num_points++;
- vectors[num_points] = to;
- num_points++;
- break;
- case ZnMapInfoLineDashed:
- dashed_vectors[num_dashed_points] = from;
- num_dashed_points++;
- dashed_vectors[num_dashed_points] = to;
- num_dashed_points++;
- break;
- case ZnMapInfoLineDotted:
- dotted_vectors[num_dotted_points] = from;
- num_dotted_points++;
- dotted_vectors[num_dotted_points] = to;
- num_dotted_points++;
- break;
- case ZnMapInfoLineMixed:
- mixed_vectors[num_mixed_points] = from;
- num_mixed_points++;
- mixed_vectors[num_mixed_points] = to;
- num_mixed_points++;
- break;
- }
+ ZnGetStringBBox(text, text_font, texts[i].x, texts[i].y, &bbox);
+
+ from.x = bbox.orig.x;
+ from.y = bbox.corner.y;
+ to.x = bbox.corner.x;
+ to.y = bbox.corner.y;
+
+ switch (line_style) {
+ case ZnMapInfoLineSimple:
+ case ZnMapInfoLineMarked:
+ vectors[num_points] = from;
+ num_points++;
+ vectors[num_points] = to;
+ num_points++;
+ break;
+ case ZnMapInfoLineDashed:
+ dashed_vectors[num_dashed_points] = from;
+ num_dashed_points++;
+ dashed_vectors[num_dashed_points] = to;
+ num_dashed_points++;
+ break;
+ case ZnMapInfoLineDotted:
+ dotted_vectors[num_dotted_points] = from;
+ num_dotted_points++;
+ dotted_vectors[num_dotted_points] = to;
+ num_dotted_points++;
+ break;
+ case ZnMapInfoLineMixed:
+ mixed_vectors[num_mixed_points] = from;
+ num_mixed_points++;
+ mixed_vectors[num_mixed_points] = to;
+ num_mixed_points++;
+ break;
+ }
}
}
ZnListAssertSize(map->texts, cnt);
@@ -952,13 +952,13 @@ ComputeCoordinates(ZnItem item,
ZnListAssertSize(map->marks, num_marks);
ZnAddPointsToBBox(&item->item_bounding_box,
- ZnListArray(map->vectors), ZnListSize(map->vectors));
+ ZnListArray(map->vectors), ZnListSize(map->vectors));
ZnAddPointsToBBox(&item->item_bounding_box,
- ZnListArray(map->dashed_vectors), ZnListSize(map->dashed_vectors));
+ ZnListArray(map->dashed_vectors), ZnListSize(map->dashed_vectors));
ZnAddPointsToBBox(&item->item_bounding_box,
- ZnListArray(map->dotted_vectors), ZnListSize(map->dotted_vectors));
+ ZnListArray(map->dotted_vectors), ZnListSize(map->dotted_vectors));
ZnAddPointsToBBox(&item->item_bounding_box,
- ZnListArray(map->mixed_vectors), ZnListSize(map->mixed_vectors));
+ ZnListArray(map->mixed_vectors), ZnListSize(map->mixed_vectors));
item->item_bounding_box.orig.x -= 0.5;
item->item_bounding_box.orig.y -= 0.5;
item->item_bounding_box.corner.x += 0.5;
@@ -970,15 +970,15 @@ ComputeCoordinates(ZnItem item,
**********************************************************************************
*
* ToArea --
- * Tell if the object is entirely outside (-1),
- * entirely inside (1) or in between (0).
+ * Tell if the object is entirely outside (-1),
+ * entirely inside (1) or in between (0).
*
**********************************************************************************
*/
static int
-ToArea(ZnItem item,
- ZnToArea ta)
+ToArea(ZnItem item,
+ ZnToArea ta)
{
return -1;
}
@@ -993,20 +993,20 @@ ToArea(ZnItem item,
*/
static void
-Draw(ZnItem item)
+Draw(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- MapItem map = (MapItem) item;
- ZnMapInfoId map_info;
- ZnPoint *points;
- XPoint *xpoints;
- XArc *arcs;
- char *text;
- char tmp_str[] = ".";
- XGCValues values;
- unsigned int i, cnt;
- ZnDim line_width_w;
- int line_width;
+ ZnWInfo *wi = item->wi;
+ MapItem map = (MapItem) item;
+ ZnMapInfoId map_info;
+ ZnPoint *points;
+ XPoint *xpoints;
+ XArc *arcs;
+ char *text;
+ char tmp_str[] = ".";
+ XGCValues values;
+ unsigned int i, cnt;
+ ZnDim line_width_w;
+ int line_width;
if (map->map_info == NULL) {
return;
@@ -1019,37 +1019,37 @@ Draw(ZnItem item)
if (map->filled) {
if (ZnListSize(map->vectors) || ZnListSize(map->arcs)) {
if (map->fill_pattern == ZnUnspecifiedImage) { /* Fill solid */
- values.fill_style = FillSolid;
- XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCForeground, &values);
+ values.fill_style = FillSolid;
+ XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCForeground, &values);
}
else { /* Fill stippled */
- values.fill_style = FillStippled;
- values.stipple = ZnImagePixmap(map->fill_pattern, wi->win);
- XChangeGC(wi->dpy, wi->gc,
- GCFillStyle | GCStipple | GCForeground, &values);
+ values.fill_style = FillStippled;
+ values.stipple = ZnImagePixmap(map->fill_pattern, wi->win);
+ XChangeGC(wi->dpy, wi->gc,
+ GCFillStyle | GCStipple | GCForeground, &values);
}
cnt = ZnListSize(map->vectors);
if (cnt) {
- ZnListAssertSize(ZnWorkXPoints, cnt);
- xpoints = (XPoint *) ZnListArray(ZnWorkXPoints);
- points = (ZnPoint *) ZnListArray(map->vectors);
- for (i = 0; i < cnt; i++) {
- xpoints[i].x = (int) points[i].x;
- xpoints[i].y = (int) points[i].y;
- }
- XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xpoints, (int) cnt,
- Nonconvex, CoordModeOrigin);
+ ZnListAssertSize(ZnWorkXPoints, cnt);
+ xpoints = (XPoint *) ZnListArray(ZnWorkXPoints);
+ points = (ZnPoint *) ZnListArray(map->vectors);
+ for (i = 0; i < cnt; i++) {
+ xpoints[i].x = (int) points[i].x;
+ xpoints[i].y = (int) points[i].y;
+ }
+ XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xpoints, (int) cnt,
+ Nonconvex, CoordModeOrigin);
}
if (ZnListSize(map->arcs)) {
- arcs = ZnListArray(map->arcs);
- cnt = ZnListSize(map->arcs);
- for (i = 0; i < cnt; i++, arcs++) {
- XFillArc(wi->dpy, wi->draw_buffer, wi->gc,
- arcs->x, arcs->y, arcs->width, arcs->height,
- arcs->angle1, arcs->angle2);
- }
+ arcs = ZnListArray(map->arcs);
+ cnt = ZnListSize(map->arcs);
+ for (i = 0; i < cnt; i++, arcs++) {
+ XFillArc(wi->dpy, wi->draw_buffer, wi->gc,
+ arcs->x, arcs->y, arcs->width, arcs->height,
+ arcs->angle1, arcs->angle2);
+ }
}
}
}
@@ -1060,33 +1060,33 @@ Draw(ZnItem item)
values.fill_style = FillSolid;
values.line_width = 0;
XChangeGC(wi->dpy, wi->gc,
- GCFillStyle | GCLineWidth | GCForeground, &values);
+ GCFillStyle | GCLineWidth | GCForeground, &values);
/* !! WARNING !! XDrawSegments can't handle an unlimited number of segments
- in releases R4 and older */
+ in releases R4 and older */
/* XDrawSegments(wi->dpy, wi->draw_buffer, wi->gc,
- (XSegment *) ZnListArray(map->vectors),
- ZnListSize(map->vectors)/2);*/
+ (XSegment *) ZnListArray(map->vectors),
+ ZnListSize(map->vectors)/2);*/
cnt = ZnListSize(map->vectors);
points = (ZnPoint *) ZnListArray(map->vectors);
for (i = 0; i < cnt; i += 2) {
- if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &line_width_w, NULL,
- NULL, NULL, NULL);
- line_width = (int) line_width_w;
+ NULL, NULL, NULL);
+ line_width = (int) line_width_w;
if (line_width != values.line_width) {
values.line_width = line_width;
XChangeGC(wi->dpy, wi->gc, GCLineWidth, &values);
}
- /*printf("Dessin d'une ligne de %d %d à %d %d\n",
- (int)points[i].x, (int)points[i].y,
- (int)points[i+1].x, (int)points[i+1].y);*/
- XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- (int) points[i].x,
- (int) points[i].y,
- (int) points[i+1].x,
- (int) points[i+1].y);
- }
+ /*printf("Dessin d'une ligne de %d %d à %d %d\n",
+ (int)points[i].x, (int)points[i].y,
+ (int)points[i+1].x, (int)points[i+1].y);*/
+ XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
+ (int) points[i].x,
+ (int) points[i].y,
+ (int) points[i+1].x,
+ (int) points[i+1].y);
+ }
}
}
@@ -1097,25 +1097,25 @@ Draw(ZnItem item)
XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCLineWidth | GCForeground, &values);
/* !! WARNING !! XDrawSegments can't handle an unlimited number of segments
- in releases R4 and older */
+ in releases R4 and older */
/* XDrawSegments(wi->dpy, wi->draw_buffer, wi->gc,
- (XSegment *) ZnListArray(map->dashed_vectors), ZnListSize(map->dashed_vectors)/2);*/
+ (XSegment *) ZnListArray(map->dashed_vectors), ZnListSize(map->dashed_vectors)/2);*/
cnt = ZnListSize(map->dashed_vectors);
points = (ZnPoint *) ZnListArray(map->dashed_vectors);
for (i = 0; i < cnt; i += 2) {
- if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &line_width_w, NULL, NULL, NULL, NULL);
- line_width = (int) line_width_w;
+ line_width = (int) line_width_w;
if (line_width != values.line_width) {
values.line_width = line_width;
XChangeGC(wi->dpy, wi->gc, GCLineWidth, &values);
}
- XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- (int) points[i].x,
- (int) points[i].y,
- (int) points[i+1].x,
- (int) points[i+1].y);
- }
+ XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
+ (int) points[i].x,
+ (int) points[i].y,
+ (int) points[i+1].x,
+ (int) points[i+1].y);
+ }
}
}
@@ -1124,28 +1124,28 @@ Draw(ZnItem item)
values.fill_style = FillSolid;
values.line_width = 0;
XChangeGC(wi->dpy, wi->gc,
- GCFillStyle | GCLineWidth | GCForeground, &values);
+ GCFillStyle | GCLineWidth | GCForeground, &values);
/* !! WARNING !! XDrawSegments can't handle an unlimited number of segments
- in releases R4 and older */
+ in releases R4 and older */
/* XDrawSegments(wi->dpy, wi->draw_buffer, wi->gc,
- (XSegment *) ZnListArray(map->dotted_vectors), ZnListSize(map->dotted_vectors)/2);*/
+ (XSegment *) ZnListArray(map->dotted_vectors), ZnListSize(map->dotted_vectors)/2);*/
cnt = ZnListSize(map->dotted_vectors);
points = (ZnPoint *) ZnListArray(map->dotted_vectors);
for (i = 0; i < cnt; i += 2) {
- if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &line_width_w, NULL, NULL, NULL, NULL);
- line_width = (int) line_width_w;
+ line_width = (int) line_width_w;
if (line_width != values.line_width) {
values.line_width = line_width;
XChangeGC(wi->dpy, wi->gc, GCLineWidth, &values);
}
- XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- (int) points[i].x,
- (int) points[i].y,
- (int) points[i+1].x,
- (int) points[i+1].y);
- }
+ XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
+ (int) points[i].x,
+ (int) points[i].y,
+ (int) points[i+1].x,
+ (int) points[i+1].y);
+ }
}
}
@@ -1156,25 +1156,25 @@ Draw(ZnItem item)
XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCLineWidth | GCForeground, &values);
/* !! WARNING !! XDrawSegments can't handle an unlimited number of segments
- in releases R4 and older */
+ in releases R4 and older */
/*XDrawSegments(wi->dpy, wi->draw_buffer, wi->gc,
- (XSegment *) ZnListArray(map->mixed_vectors), ZnListSize(map->mixed_vectors)/2);*/
+ (XSegment *) ZnListArray(map->mixed_vectors), ZnListSize(map->mixed_vectors)/2);*/
cnt = ZnListSize(map->mixed_vectors);
points = (ZnPoint *) ZnListArray(map->mixed_vectors);
for (i = 0; i < cnt; i += 2) {
- if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &line_width_w, NULL, NULL, NULL, NULL);
- line_width = (int) line_width_w;
+ line_width = (int) line_width_w;
if (line_width != values.line_width) {
values.line_width = line_width;
XChangeGC(wi->dpy, wi->gc, GCLineWidth, &values);
}
- XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- (int) points[i].x,
- (int) points[i].y,
- (int) points[i+1].x,
- (int) points[i+1].y);
- }
+ XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
+ (int) points[i].x,
+ (int) points[i].y,
+ (int) points[i+1].x,
+ (int) points[i+1].y);
+ }
}
}
@@ -1187,9 +1187,9 @@ Draw(ZnItem item)
arcs = ZnListArray(map->arcs);
cnt = ZnListSize(map->arcs);
for (i = 0; i < cnt; i++, arcs++) {
- XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
- arcs->x, arcs->y, arcs->width, arcs->height,
- arcs->angle1, arcs->angle2);
+ XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
+ arcs->x, arcs->y, arcs->width, arcs->height,
+ arcs->angle1, arcs->angle2);
}
}
@@ -1202,9 +1202,9 @@ Draw(ZnItem item)
arcs = ZnListArray(map->arcs);
cnt = ZnListSize(map->arcs);
for (i = 0; i < cnt; i++, arcs++) {
- XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
- arcs->x, arcs->y, arcs->width, arcs->height,
- arcs->angle1, arcs->angle2);
+ XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
+ arcs->x, arcs->y, arcs->width, arcs->height,
+ arcs->angle1, arcs->angle2);
}
}
@@ -1217,9 +1217,9 @@ Draw(ZnItem item)
arcs = ZnListArray(map->arcs);
cnt = ZnListSize(map->arcs);
for (i = 0; i < cnt; i++, arcs++) {
- XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
- arcs->x, arcs->y, arcs->width, arcs->height,
- arcs->angle1, arcs->angle2);
+ XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
+ arcs->x, arcs->y, arcs->width, arcs->height,
+ arcs->angle1, arcs->angle2);
}
}
@@ -1232,9 +1232,9 @@ Draw(ZnItem item)
arcs = ZnListArray(map->arcs);
cnt = ZnListSize(map->arcs);
for (i = 0; i < cnt; i++, arcs++) {
- XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
- arcs->x, arcs->y, arcs->width, arcs->height,
- arcs->angle1, arcs->angle2);
+ XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
+ arcs->x, arcs->y, arcs->width, arcs->height,
+ arcs->angle1, arcs->angle2);
}
}
@@ -1245,15 +1245,15 @@ Draw(ZnItem item)
values.font = Tk_FontId(map->text_font);
values.fill_style = FillSolid;
XChangeGC(wi->dpy, wi->gc,
- GCFillStyle | GCFont | GCForeground, &values);
+ GCFillStyle | GCFont | GCForeground, &values);
cnt = ZnListSize(map->texts);
points = (ZnPoint *) ZnListArray(map->texts);
for (i = 0; i < cnt; i++) {
- ZnMapInfoGetText(map_info, i, NULL, NULL, NULL, NULL, NULL, &text);
- Tk_DrawChars(wi->dpy, wi->draw_buffer, wi->gc,
- map->text_font, text, (int) strlen(text),
- (int) points[i].x, (int) points[i].y);
+ ZnMapInfoGetText(map_info, i, NULL, NULL, NULL, NULL, NULL, &text);
+ Tk_DrawChars(wi->dpy, wi->draw_buffer, wi->gc,
+ map->text_font, text, (int) strlen(text),
+ (int) points[i].x, (int) points[i].y);
}
}
@@ -1266,42 +1266,42 @@ Draw(ZnItem item)
XChangeGC(wi->dpy, wi->gc, GCFillStyle, &values);
if (map->symbol_patterns) {
- ZnImage *syms = ZnListArray(map->symbol_patterns);
- int num_syms = ZnListSize(map->symbol_patterns);
-
- cnt = ZnListSize(map->symbols);
- points = ZnListArray(map->symbols);
- for (i = 0; i < cnt; i++) {
- ZnMapInfoGetSymbol(map_info, i, NULL, NULL, NULL, &(tmp_str[0]));
- sym = syms[tmp_str[0]%num_syms];
- if (sym != ZnUnspecifiedImage) {
- ZnSizeOfImage(sym, &w ,&h);
- ox = ((int) points[i].x) - w/2;
- oy = ((int) points[i].y) - h/2;
- values.stipple = ZnImagePixmap(sym, wi->win);
- values.ts_x_origin = ox;
- values.ts_y_origin = oy;
- XChangeGC(wi->dpy, wi->gc,
- GCStipple|GCTileStipXOrigin|GCTileStipYOrigin, &values);
- XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc, ox, oy, w, h);
- }
- }
+ ZnImage *syms = ZnListArray(map->symbol_patterns);
+ int num_syms = ZnListSize(map->symbol_patterns);
+
+ cnt = ZnListSize(map->symbols);
+ points = ZnListArray(map->symbols);
+ for (i = 0; i < cnt; i++) {
+ ZnMapInfoGetSymbol(map_info, i, NULL, NULL, NULL, &(tmp_str[0]));
+ sym = syms[tmp_str[0]%num_syms];
+ if (sym != ZnUnspecifiedImage) {
+ ZnSizeOfImage(sym, &w ,&h);
+ ox = ((int) points[i].x) - w/2;
+ oy = ((int) points[i].y) - h/2;
+ values.stipple = ZnImagePixmap(sym, wi->win);
+ values.ts_x_origin = ox;
+ values.ts_y_origin = oy;
+ XChangeGC(wi->dpy, wi->gc,
+ GCStipple|GCTileStipXOrigin|GCTileStipYOrigin, &values);
+ XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc, ox, oy, w, h);
+ }
+ }
}
if (wi->map_distance_symbol != ZnUnspecifiedImage) {
- ZnSizeOfImage(wi->map_distance_symbol, &w, &h);
- cnt = ZnListSize(map->marks);
- points = ZnListArray(map->marks);
- values.stipple = ZnImagePixmap(wi->map_distance_symbol, wi->win);
- XChangeGC(wi->dpy, wi->gc, GCStipple, &values);
- for (i = 0; i < cnt; i++) {
- ox = ((int) points[i].x) - w/2;
- oy = ((int) points[i].y) - h/2;
- values.ts_x_origin = ox;
- values.ts_y_origin = oy;
- XChangeGC(wi->dpy, wi->gc, GCTileStipXOrigin|GCTileStipYOrigin, &values);
- XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc, ox, oy, w, h);
- }
+ ZnSizeOfImage(wi->map_distance_symbol, &w, &h);
+ cnt = ZnListSize(map->marks);
+ points = ZnListArray(map->marks);
+ values.stipple = ZnImagePixmap(wi->map_distance_symbol, wi->win);
+ XChangeGC(wi->dpy, wi->gc, GCStipple, &values);
+ for (i = 0; i < cnt; i++) {
+ ox = ((int) points[i].x) - w/2;
+ oy = ((int) points[i].y) - h/2;
+ values.ts_x_origin = ox;
+ values.ts_y_origin = oy;
+ XChangeGC(wi->dpy, wi->gc, GCTileStipXOrigin|GCTileStipYOrigin, &values);
+ XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc, ox, oy, w, h);
+ }
}
}
}
@@ -1317,19 +1317,19 @@ Draw(ZnItem item)
*/
#ifdef GL
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- MapItem map = (MapItem) item;
- ZnMapInfoId map_info;
- ZnPoint *points, p;
- char *text;
- char tmp_str[] = ".";
- unsigned int i, cnt;
- int w, h;
- XColor *color;
- GLfloat line_width;
- ZnDim new_width;
+ ZnWInfo *wi = item->wi;
+ MapItem map = (MapItem) item;
+ ZnMapInfoId map_info;
+ ZnPoint *points, p;
+ char *text;
+ char tmp_str[] = ".";
+ unsigned int i, cnt;
+ int w, h;
+ XColor *color;
+ GLfloat line_width;
+ ZnDim new_width;
unsigned short alpha;
if (!map->map_info) {
@@ -1342,11 +1342,11 @@ Render(ZnItem item)
glColor4us(color->red, color->green, color->blue, alpha);
if (map->filled) {
if (ZnListSize(map->vectors) || ZnListSize(map->arcs)) {
- /* TODO_GL: Need to have a tesselated polygon then
- * fill it either using ZnRenderTile or solid.
- */
+ /* TODO_GL: Need to have a tesselated polygon then
+ * fill it either using ZnRenderTile or solid.
+ */
if (map->fill_pattern != ZnUnspecifiedImage) {
- /* Fill stippled */
+ /* Fill stippled */
}
else {
}
@@ -1361,16 +1361,16 @@ Render(ZnItem item)
points = ZnListArray(map->vectors);
glBegin(GL_LINES);
for (i = 0; i < cnt; i += 2) {
- if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &new_width, NULL,
- NULL, NULL, NULL);
+ NULL, NULL, NULL);
if (new_width != line_width) {
- line_width = (GLfloat)new_width;
- glLineWidth(line_width);
+ line_width = (GLfloat)new_width;
+ glLineWidth(line_width);
}
- glVertex2d(points[i].x, points[i].y);
- glVertex2d(points[i+1].x, points[i+1].y);
- }
+ glVertex2d(points[i].x, points[i].y);
+ glVertex2d(points[i+1].x, points[i+1].y);
+ }
}
glEnd();
}
@@ -1382,16 +1382,16 @@ Render(ZnItem item)
points = ZnListArray(map->dashed_vectors);
glBegin(GL_LINES);
for (i = 0; i < cnt; i += 2) {
- if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &new_width, NULL,
- NULL, NULL, NULL);
+ NULL, NULL, NULL);
if (new_width != line_width) {
- line_width = (GLfloat)new_width;
- glLineWidth(line_width);
+ line_width = (GLfloat)new_width;
+ glLineWidth(line_width);
}
- glVertex2d(points[i].x, points[i].y);
- glVertex2d(points[i+1].x, points[i+1].y);
- }
+ glVertex2d(points[i].x, points[i].y);
+ glVertex2d(points[i+1].x, points[i+1].y);
+ }
}
glEnd();
glDisable(GL_LINE_STIPPLE);
@@ -1404,16 +1404,16 @@ Render(ZnItem item)
points = ZnListArray(map->dotted_vectors);
glBegin(GL_LINES);
for (i = 0; i < cnt; i += 2) {
- if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &new_width, NULL,
- NULL, NULL, NULL);
+ NULL, NULL, NULL);
if (new_width != line_width) {
- line_width = (GLfloat)new_width;
- glLineWidth(line_width);
+ line_width = (GLfloat)new_width;
+ glLineWidth(line_width);
}
- glVertex2d(points[i].x, points[i].y);
- glVertex2d(points[i+1].x, points[i+1].y);
- }
+ glVertex2d(points[i].x, points[i].y);
+ glVertex2d(points[i+1].x, points[i+1].y);
+ }
}
glEnd();
glDisable(GL_LINE_STIPPLE);
@@ -1426,16 +1426,16 @@ Render(ZnItem item)
points = ZnListArray(map->mixed_vectors);
glBegin(GL_LINES);
for (i = 0; i < cnt; i += 2) {
- if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &new_width, NULL,
- NULL, NULL, NULL);
+ NULL, NULL, NULL);
if (new_width != line_width) {
- line_width = (GLfloat)new_width;
- glLineWidth(line_width);
+ line_width = (GLfloat)new_width;
+ glLineWidth(line_width);
}
- glVertex2d(points[i].x, points[i].y);
- glVertex2d(points[i+1].x, points[i+1].y);
- }
+ glVertex2d(points[i].x, points[i].y);
+ glVertex2d(points[i+1].x, points[i+1].y);
+ }
}
glEnd();
glDisable(GL_LINE_STIPPLE);
@@ -1478,11 +1478,11 @@ Render(ZnItem item)
cnt = ZnListSize(map->texts);
points = ZnListArray(map->texts);
for (i = 0; i < cnt; i++, points++) {
- glPushMatrix();
- ZnMapInfoGetText(map_info, i, NULL, NULL, NULL, NULL, NULL, &text);
- glTranslated(points->x, points->y, 0.0);
- ZnRenderString(map->tfi, text, strlen(text));
- glPopMatrix();
+ glPushMatrix();
+ ZnMapInfoGetText(map_info, i, NULL, NULL, NULL, NULL, NULL, &text);
+ glTranslated(points->x, points->y, 0.0);
+ ZnRenderString(map->tfi, text, strlen(text));
+ glPopMatrix();
}
glDisable(GL_TEXTURE_2D);
}
@@ -1494,14 +1494,14 @@ Render(ZnItem item)
cnt = ZnListSize(map->symbols);
points = ZnListArray(map->symbols);
for (i = 0; i < cnt; i++) {
- ZnMapInfoGetSymbol(map_info, i, NULL, NULL, NULL, &(tmp_str[0]));
- sym = syms[tmp_str[0]%num_syms];
- if (sym != ZnUnspecifiedImage) {
- ZnSizeOfImage(sym, &w, &h);
- p.x = points[i].x-(w+1.0)/2.0;
- p.y = points[i].y-(h+1.0)/2.0;
- ZnRenderIcon(wi, sym, map->color, &p, True);
- }
+ ZnMapInfoGetSymbol(map_info, i, NULL, NULL, NULL, &(tmp_str[0]));
+ sym = syms[tmp_str[0]%num_syms];
+ if (sym != ZnUnspecifiedImage) {
+ ZnSizeOfImage(sym, &w, &h);
+ p.x = points[i].x-(w+1.0)/2.0;
+ p.y = points[i].y-(h+1.0)/2.0;
+ ZnRenderIcon(wi, sym, map->color, &p, True);
+ }
}
}
@@ -1510,16 +1510,16 @@ Render(ZnItem item)
cnt = ZnListSize(map->marks);
points = ZnListArray(map->marks);
for (i = 0; i < cnt; i++, points++) {
- p.x = points->x-(w+1)/2;
- p.y = points->y-(h+1)/2;
- ZnRenderIcon(wi, wi->map_distance_symbol, map->color, &p, True);
+ p.x = points->x-(w+1)/2;
+ p.y = points->y-(h+1)/2;
+ ZnRenderIcon(wi, wi->map_distance_symbol, map->color, &p, True);
}
}
}
}
#else
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
}
#endif
@@ -1533,11 +1533,11 @@ Render(ZnItem item)
**********************************************************************************
*/
static ZnBool
-IsSensitive(ZnItem item,
- int item_part)
+IsSensitive(ZnItem item,
+ int item_part)
{
return (ISSET(item->flags, ZN_SENSITIVE_BIT) &&
- item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
+ item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
}
@@ -1545,17 +1545,17 @@ IsSensitive(ZnItem item,
**********************************************************************************
*
* Pick --
- * This is *NOT* correct but for now we will tell that we are
- * transparent even if we are solid filled.
+ * This is *NOT* correct but for now we will tell that we are
+ * transparent even if we are solid filled.
*
- * !!!! We need to say we are opaque at least if we are solid
- * filled. !!!!
+ * !!!! We need to say we are opaque at least if we are solid
+ * filled. !!!!
*
**********************************************************************************
*/
static double
-Pick(ZnItem item,
- ZnPick ps)
+Pick(ZnItem item,
+ ZnPick ps)
{
return 1e40;
}
@@ -1569,8 +1569,8 @@ Pick(ZnItem item,
**********************************************************************************
*/
static void
-PostScript(ZnItem item,
- ZnBool prepass)
+PostScript(ZnItem item,
+ ZnBool prepass)
{
}
@@ -1587,33 +1587,33 @@ static ZnItemClassStruct MAP_ITEM_CLASS = {
"map",
sizeof(MapItemStruct),
map_attrs,
- 0, /* num_parts */
- 0, /* flags */
+ 0, /* num_parts */
+ 0, /* flags */
-1,
Init,
Clone,
Destroy,
Configure,
Query,
- NULL, /* GetFieldSet */
- NULL, /* GetAnchor */
- NULL, /* GetClipVertices */
- NULL, /* GetContours */
+ NULL, /* GetFieldSet */
+ NULL, /* GetAnchor */
+ NULL, /* GetClipVertices */
+ NULL, /* GetContours */
NULL,
- NULL, /* InsertChars */
- NULL, /* DeleteChars */
- NULL, /* Cursor */
- NULL, /* Index */
- NULL, /* Part */
- NULL, /* Selection */
- NULL, /* Contour */
+ NULL, /* InsertChars */
+ NULL, /* DeleteChars */
+ NULL, /* Cursor */
+ NULL, /* Index */
+ NULL, /* Part */
+ NULL, /* Selection */
+ NULL, /* Contour */
ComputeCoordinates,
ToArea,
Draw,
Render,
IsSensitive,
Pick,
- NULL, /* PickVertex */
+ NULL, /* PickVertex */
PostScript
};