Update of /cvsroot/roadmap/roadmap/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv9958 Modified Files: config.mk options.mk roadmap_canvas.h roadmap_label.c roadmap_label.h roadmap_landmark.c roadmap_layer.c roadmap_screen.c Log Message: from Alessandro Briosi: > > finally had some time to clean up and "reimplement" the ADVANCED_STYLE > patches. > > part 2. roadmap_advanced_style.patch which adds all the additional > definitions (based on patch 1) to be loaded. > The only implementation available right now is qt4, I have added all the > "stubs" functions as in previous patch. > Index: roadmap_landmark.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_landmark.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** roadmap_landmark.c 21 Mar 2008 23:09:00 -0000 1.16 --- roadmap_landmark.c 7 Oct 2008 00:42:20 -0000 1.17 *************** *** 100,105 **** --- 100,110 ---- * labels come out on "top" of other map features. */ + #if defined(ROADMAP_ADVANCED_STYLE) + roadmap_label_draw_text(waypointp->shortname, + &guipoint, 0, 0, pen); + #else roadmap_label_draw_text(waypointp->shortname, &guipoint, 0, 0, RoadMapLandmarkFontSize); + #endif } } *************** *** 135,140 **** --- 140,150 ---- * labels come out on "top" of other map features. */ + #if defined(ROADMAP_ADVANCED_STYLE) + roadmap_label_draw_text(weepointp->name, + &guipoint, 0, 0, pen); + #else roadmap_label_draw_text(weepointp->name, &guipoint, 0, 0, RoadMapLandmarkFontSize); + #endif } } Index: config.mk =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/config.mk,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** config.mk 13 May 2008 15:30:21 -0000 1.32 --- config.mk 7 Oct 2008 00:42:20 -0000 1.33 *************** *** 142,145 **** --- 142,149 ---- # LANGS = YES + # Advanced style (only qt4 supports this for now) + # # Adds support to more control on the map drawings + # ADVANCED_STYLE = YES + # Basic building mode MODE = # blank for "normal" build Index: options.mk =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/options.mk,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** options.mk 28 Jun 2008 16:49:27 -0000 1.28 --- options.mk 7 Oct 2008 00:42:20 -0000 1.29 *************** *** 119,122 **** --- 119,126 ---- endif + ifneq ($(strip $(ADVANCED_STYLE)),) + CFLAGS += -DROADMAP_ADVANCED_STYLE + endif + ifeq ($(strip $(MODE)),DEBUG) CFLAGS += -g Index: roadmap_layer.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_layer.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** roadmap_layer.c 7 Oct 2008 00:29:47 -0000 1.17 --- roadmap_layer.c 7 Oct 2008 00:42:20 -0000 1.18 *************** *** 164,167 **** --- 164,183 ---- {"Color", ROADMAP_STYLE_TYPE_STRING, "#000000", roadmap_canvas_set_foreground}, {"Style", ROADMAP_STYLE_TYPE_STRING, "", roadmap_canvas_set_linestyle}, + #if defined(ROADMAP_ADVANCED_STYLE) + {"LineCap", ROADMAP_STYLE_TYPE_STRING, "", roadmap_canvas_set_linecap }, + {"LineJoin", ROADMAP_STYLE_TYPE_STRING, "", roadmap_canvas_set_linejoin }, + {"Opacity", ROADMAP_STYLE_TYPE_INT, "", roadmap_canvas_set_opacity }, + {"BrushColor", ROADMAP_STYLE_TYPE_STRING, "", roadmap_canvas_set_brush_color }, + {"BrushStyle", ROADMAP_STYLE_TYPE_STRING, "", roadmap_canvas_set_brush_style }, + {"isBackground", ROADMAP_STYLE_TYPE_INT, "", roadmap_canvas_set_brush_isbackground }, + {"LabelFontName", ROADMAP_STYLE_TYPE_STRING, "", roadmap_canvas_set_label_font_name }, + {"LabelFontSize", ROADMAP_STYLE_TYPE_INT, "", roadmap_canvas_set_label_font_size }, + {"LabelFontStyle", ROADMAP_STYLE_TYPE_INT, "", roadmap_canvas_set_label_font_style }, + {"LabelFontColor", ROADMAP_STYLE_TYPE_STRING, "", roadmap_canvas_set_label_font_color }, + {"LabelFontWeight", ROADMAP_STYLE_TYPE_STRING, "", roadmap_canvas_set_label_font_weight }, + {"LabelFontSpacing", ROADMAP_STYLE_TYPE_INT, "", roadmap_canvas_set_label_font_spacing }, + {"LabelBufferColor", ROADMAP_STYLE_TYPE_STRING, "", roadmap_canvas_set_label_buffer_color }, + {"LabelBufferSize", ROADMAP_STYLE_TYPE_INT, "", roadmap_canvas_set_label_buffer_size }, + #endif /* ADVANCED STYLE */ }; *************** *** 660,664 **** const char *class_name; - if (class_config == NULL) { roadmap_log (ROADMAP_FATAL, "cannot access class file %s", class_file); --- 676,679 ---- *************** *** 741,745 **** static char *other_pen; int thickness; ! other_pen = realloc(other_pen, other_pen_length); --- 756,760 ---- static char *other_pen; int thickness; ! other_pen = realloc(other_pen, other_pen_length); *************** *** 748,752 **** layer->navigation_modes = 0; - /* Retrieve the layer's thickness & declutter. */ --- 763,766 ---- *************** *** 754,758 **** layer->thickness.name = "Thickness"; roadmap_config_declare (class_config, &layer->thickness, "1"); ! /* this value is not used here */ /* thickness = roadmap_config_get_integer (&layer->thickness); */ --- 768,772 ---- layer->thickness.name = "Thickness"; roadmap_config_declare (class_config, &layer->thickness, "1"); ! /* this value is not used here */ /* thickness = roadmap_config_get_integer (&layer->thickness); */ *************** *** 761,779 **** layer->declutter.name = "Declutter"; roadmap_config_declare (class_config, &layer->declutter, "20248000000"); ! for (pen_index = 0; pen_index < ROADMAP_MAX_LAYER_PENS; ++pen_index) { /* retrieve delta (thickness was taken above) */ if (pen_index > 0) { ! const char *image; ! snprintf (other_pen, other_pen_length, "Delta%d", pen_index); ! image = ! roadmap_config_get_from (class_config, layers[i], other_pen); ! if (image == NULL || image[0] == 0) break; ! layer->delta_thickness[pen_index] = atoi(image); } ! /* now retrieve other pen attribute values */ for (j = 0; j < n_of_callbacks; ++j) { --- 775,793 ---- layer->declutter.name = "Declutter"; roadmap_config_declare (class_config, &layer->declutter, "20248000000"); ! for (pen_index = 0; pen_index < ROADMAP_MAX_LAYER_PENS; ++pen_index) { /* retrieve delta (thickness was taken above) */ if (pen_index > 0) { ! const char *image; ! snprintf (other_pen, other_pen_length, "Delta%d", pen_index); ! image = ! roadmap_config_get_from (class_config, layers[i], other_pen); ! if (image == NULL || image[0] == 0) break; ! layer->delta_thickness[pen_index] = atoi(image); } ! /* now retrieve other pen attribute values */ for (j = 0; j < n_of_callbacks; ++j) { *************** *** 783,787 **** snprintf (other_pen, other_pen_length, "%s%d", RoadMapLayerPenSetupTable[j].name, pen_index); } ! descriptor.category = layers[i]; descriptor.name = other_pen; --- 797,801 ---- snprintf (other_pen, other_pen_length, "%s%d", RoadMapLayerPenSetupTable[j].name, pen_index); } ! descriptor.category = layers[i]; descriptor.name = other_pen; *************** *** 812,818 **** sprintf (other_pen, "%s", layers[i]); } else { ! snprintf (other_pen, other_pen_length, "%s%d", layers[i], pen_index); } ! layer->pen[pen_index] = roadmap_canvas_create_pen (other_pen); --- 826,832 ---- sprintf (other_pen, "%s", layers[i]); } else { ! snprintf (other_pen, other_pen_length, "%s%d", layers[i], pen_index); } ! layer->pen[pen_index] = roadmap_canvas_create_pen (other_pen); *************** *** 823,834 **** roadmap_canvas_set_thickness (thickness); } else { ! if (layer->delta_thickness[pen_index] < 0) { ! thickness += layer->delta_thickness[pen_index]; ! } else { ! thickness = layer->delta_thickness[pen_index]; ! } ! if (thickness > 0) { ! roadmap_canvas_set_thickness (thickness); ! } } --- 837,848 ---- roadmap_canvas_set_thickness (thickness); } else { ! if (layer->delta_thickness[pen_index] < 0) { ! thickness += layer->delta_thickness[pen_index]; ! } else { ! thickness = layer->delta_thickness[pen_index]; ! } ! if (thickness > 0) { ! roadmap_canvas_set_thickness (thickness); ! } } *************** *** 854,857 **** --- 868,872 ---- } } + /* Retrieve the navigation modes associated with each layer. */ Index: roadmap_canvas.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_canvas.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** roadmap_canvas.h 21 Mar 2008 23:09:00 -0000 1.11 --- roadmap_canvas.h 7 Oct 2008 00:42:20 -0000 1.12 *************** *** 95,98 **** --- 95,122 ---- void roadmap_canvas_set_linestyle (const char *style); + #if defined(ROADMAP_ADVANCED_STYLE) + + /* This is a set of functions which enable advanced display of the map + * and improves the overall map experience + */ + + void roadmap_canvas_set_linejoin(const char *join); + void roadmap_canvas_set_linecap(const char *cap); + + void roadmap_canvas_set_brush_color(const char *color); + void roadmap_canvas_set_brush_style(const char *style); + void roadmap_canvas_set_brush_isbackground(int isbackground); + + void roadmap_canvas_set_label_font_name(const char *name); + void roadmap_canvas_set_label_font_color(const char *color); + void roadmap_canvas_set_label_font_size(int size); + void roadmap_canvas_set_label_font_style(int style); + void roadmap_canvas_set_label_font_spacing(int style); + void roadmap_canvas_set_label_font_weight(const char *weight); + + void roadmap_canvas_set_label_buffer_color(const char *color); + void roadmap_canvas_set_label_buffer_size(int size); + + #endif /* The functions below draw in the selected buffer using the selected pen: */ Index: roadmap_screen.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_screen.c,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -d -r1.131 -r1.132 *** roadmap_screen.c 24 Jun 2008 20:40:42 -0000 1.131 --- roadmap_screen.c 7 Oct 2008 00:42:20 -0000 1.132 *************** *** 952,957 **** --- 952,963 ---- (&seg_middle, &loweredge, MATH_DIST_SQUARED)) ) { PluginLine l = {ROADMAP_PLUGIN_ID, line, layer, fips}; + #if defined(ROADMAP_ADVANCED_STYLE) + roadmap_label_add + (&seg_middle, angle_ptr ? *angle_ptr : 90, + *total_length_ptr, &l, pen); + #else roadmap_label_add (&seg_middle, angle_ptr ? *angle_ptr : 90, *total_length_ptr, &l); + #endif } Index: roadmap_label.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_label.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** roadmap_label.h 26 Apr 2008 17:19:05 -0000 1.9 --- roadmap_label.h 7 Oct 2008 00:42:20 -0000 1.10 *************** *** 32,37 **** --- 32,43 ---- + #if defined(ROADMAP_ADVANCED_STYLE) + int roadmap_label_add (const RoadMapGuiPoint *point, int angle, + int featuresize, const PluginLine *line, + RoadMapPen pen); + #else int roadmap_label_add (const RoadMapGuiPoint *point, int angle, int featuresize, const PluginLine *line); + #endif int roadmap_label_activate (void); *************** *** 42,48 **** --- 48,60 ---- void roadmap_label_start (void); + #if defined(ROADMAP_ADVANCED_STYLE) + void roadmap_label_draw_text(const char *text, + RoadMapGuiPoint *pos, + int doing_angles, int angle, RoadMapPen pen); + #else void roadmap_label_draw_text(const char *text, RoadMapGuiPoint *pos, int doing_angles, int angle, int size); + #endif void roadmap_label_cache_invalidate(void); Index: roadmap_label.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_label.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** roadmap_label.c 27 Apr 2008 15:06:40 -0000 1.31 --- roadmap_label.c 7 Oct 2008 00:42:20 -0000 1.32 *************** *** 94,97 **** --- 94,101 ---- RoadMapGuiPoint poly[4]; + #if defined(ROADMAP_ADVANCED_STYLE) + RoadMapPen pen; + #endif + unsigned short zoom; short angle; /* degrees */ *************** *** 212,220 **** } ! void roadmap_label_draw_text(const char *text, RoadMapGuiPoint *pos, int doing_angles, int angle, int size) { if (doing_angles) { --- 216,238 ---- } ! #if defined(ROADMAP_ADVANCED_STYLE) ! void roadmap_label_draw_text(const char *text, ! RoadMapGuiPoint *pos, ! int doing_angles, int angle, RoadMapPen pen) ! { ! int size; ! #else void roadmap_label_draw_text(const char *text, RoadMapGuiPoint *pos, int doing_angles, int angle, int size) { + #endif + + #if defined(ROADMAP_ADVANCED_STYLE) + if (pen!=0) + roadmap_canvas_select_pen (pen); + else + roadmap_canvas_select_pen (RoadMapLabelPen); + #endif if (doing_angles) { *************** *** 257,263 **** } ! int roadmap_label_add (const RoadMapGuiPoint *point, int angle, int featuresize_sq, const PluginLine *line) { roadmap_label *cPtr = 0; --- 275,286 ---- } ! #if defined(ROADMAP_ADVANCED_STYLE) ! int roadmap_label_add (const RoadMapGuiPoint *point, int angle, ! int featuresize_sq, const PluginLine *line, ! RoadMapPen pen) { ! #else int roadmap_label_add (const RoadMapGuiPoint *point, int angle, int featuresize_sq, const PluginLine *line) { + #endif roadmap_label *cPtr = 0; *************** *** 297,300 **** --- 320,326 ---- cPtr->center_point = *point; + #if defined(ROADMAP_ADVANCED_STYLE) + cPtr->pen = pen; + #endif /* The stored point is not screen oriented, rotate is needed */ *************** *** 612,619 **** --- 638,652 ---- cPtr, cPtr->text, width, cPtr->featuresize_sq, cPtr->angle); + #if defined(ROADMAP_ADVANCED_STYLE) + roadmap_label_draw_text + (cPtr->text, &cPtr->center_point, + angles, angles ? cPtr->angle : 0, + cPtr->pen ); + #else roadmap_label_draw_text (cPtr->text, &cPtr->center_point, angles, angles ? cPtr->angle : 0, RoadMapLabelFontSize ); + #endif if (whichlist == NEWLIST) { |