You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(92) |
Dec
(141) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(126) |
Feb
(72) |
Mar
(31) |
Apr
(200) |
May
(81) |
Jun
(130) |
Jul
(112) |
Aug
(134) |
Sep
(76) |
Oct
(89) |
Nov
(153) |
Dec
(9) |
2007 |
Jan
(59) |
Feb
(82) |
Mar
(50) |
Apr
(20) |
May
(9) |
Jun
(81) |
Jul
(41) |
Aug
(109) |
Sep
(91) |
Oct
(87) |
Nov
(33) |
Dec
(60) |
2008 |
Jan
(21) |
Feb
(15) |
Mar
(38) |
Apr
(75) |
May
(59) |
Jun
(46) |
Jul
(30) |
Aug
(20) |
Sep
(35) |
Oct
(32) |
Nov
(34) |
Dec
(19) |
2009 |
Jan
(29) |
Feb
(71) |
Mar
(54) |
Apr
(17) |
May
(4) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(58) |
Sep
(7) |
Oct
(7) |
Nov
(12) |
Dec
(18) |
2011 |
Jan
(17) |
Feb
(29) |
Mar
(11) |
Apr
(5) |
May
(1) |
Jun
|
Jul
|
Aug
(11) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(87) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(44) |
Jun
(79) |
Jul
(16) |
Aug
(31) |
Sep
|
Oct
(51) |
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Paul F. <pg...@us...> - 2006-06-28 23:25:11
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv17629 Modified Files: Makefile Log Message: get tools to build with CFLAGS and LDFLAGS Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/Makefile,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** Makefile 26 Jun 2006 19:47:49 -0000 1.79 --- Makefile 28 Jun 2006 23:25:06 -0000 1.80 *************** *** 312,337 **** sunrise: roadmap_sunrise.c ! $(CC) -g -DSUNRISE_PROGRAM roadmap_sunrise.c -o sunrise -lm ! sqliteload: sqliteload.c ! $(CC) -g sqliteload.c $(SQLCFLAGS) $(SQLLDFLAGS) -o sqliteload -lm ! rdmindex : rdmindex_main.c libbuildmap.a $(RDMLIBS) ! $(CC) -g rdmindex_main.c -o rdmindex libbuildmap.a $(RDMLIBS) $(LIBS) rdmxchange : $(XCHGOBJS) $(RDMLIBS) ! $(CC) -g -o rdmxchange $(XCHGOBJS) $(RDMLIBS) $(LIBS) ! rdmkismet: roadmap_kismet.c $(RDMLIBS) ! $(CC) -g roadmap_kismet.c -o rdmkismet $(RDMLIBS) $(RDMLIBS) -lm ! rdmghost: roadmap_ghost.c $(RDMLIBS) ! $(CC) -g roadmap_ghost.c -o rdmghost $(RDMLIBS) -lm ! rdmfriends: roadmap_friends.c $(RDMLIBS) ! $(CC) -g roadmap_friends.c -o rdmfriends $(RDMLIBS) $(RDMLIBS) -lm ! rdmtrace: roadmap_trace.c $(RDMLIBS) ! $(CC) -g roadmap_trace.c -o rdmtrace $(RDMLIBS) -lm dumpmap: $(DMOBJS) $(RDMLIBS) --- 312,337 ---- sunrise: roadmap_sunrise.c ! $(CC) $(LDFLAGS) $(CFLAGS) -DSUNRISE_PROGRAM roadmap_sunrise.c -o sunrise -lm ! sqliteload: sqliteload.o ! $(CC) sqliteload.o $(SQLCFLAGS) $(SQLLDFLAGS) -o sqliteload -lm ! rdmindex : rdmindex_main.o libbuildmap.a $(RDMLIBS) ! $(CC) $(LDFLAGS) rdmindex_main.o -o rdmindex libbuildmap.a $(RDMLIBS) $(LIBS) rdmxchange : $(XCHGOBJS) $(RDMLIBS) ! $(CC) $(LDFLAGS) -o rdmxchange $(XCHGOBJS) $(RDMLIBS) $(LIBS) ! rdmkismet: roadmap_kismet.o $(RDMLIBS) ! $(CC) $(LDFLAGS) roadmap_kismet.o -o rdmkismet $(RDMLIBS) $(RDMLIBS) -lm ! rdmghost: roadmap_ghost.o $(RDMLIBS) ! $(CC) $(LDFLAGS) roadmap_ghost.o -o rdmghost $(RDMLIBS) -lm ! rdmfriends: roadmap_friends.o $(RDMLIBS) ! $(CC) $(LDFLAGS) roadmap_friends.o -o rdmfriends $(RDMLIBS) $(RDMLIBS) -lm ! rdmtrace: roadmap_trace.o $(RDMLIBS) ! $(CC) $(LDFLAGS) roadmap_trace.o -o rdmtrace $(RDMLIBS) -lm dumpmap: $(DMOBJS) $(RDMLIBS) |
From: Paul F. <pg...@us...> - 2006-06-28 13:46:44
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv25173 Modified Files: rdmindex_main.c roadmap_friends.c roadmap_ghost.c roadmap_kismet.c roadmap_trace.c Log Message: fix compiler warnings Index: roadmap_kismet.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_kismet.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** roadmap_kismet.c 26 Jun 2005 01:19:28 -0000 1.9 --- roadmap_kismet.c 28 Jun 2006 13:46:41 -0000 1.10 *************** *** 44,48 **** struct knetlist { ! int btop, bbot; }; --- 44,48 ---- struct knetlist { ! unsigned int btop, bbot; }; *************** *** 127,131 **** FILE *sfp; int knet = -1; ! int i, kfd; int fdcount = 1; --- 127,131 ---- FILE *sfp; int knet = -1; ! int i; int fdcount = 1; *************** *** 144,148 **** "usage: %s [--help] [--gps]\n" " --gps: simulate GPS position information.\n" ! " --driver=name: use the specified driver name.\n"); exit(0); } --- 144,148 ---- "usage: %s [--help] [--gps]\n" " --gps: simulate GPS position information.\n" ! " --driver=name: use the specified driver name.\n", argv[0]); exit(0); } *************** *** 279,284 **** la_ddmm, la_mmmm, la_hemi, lo_ddmm, lo_mmmm, lo_hemi, ! sig - 170, /* Why "170"? */ ! chan + (wep << 8)); if (gps_mode) { --- 279,284 ---- la_ddmm, la_mmmm, la_hemi, lo_ddmm, lo_mmmm, lo_hemi, ! sig - 170 /* Why "170"? */ ! /* , chan + (wep << 8) */); if (gps_mode) { Index: roadmap_trace.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_trace.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_trace.c 16 Jul 2005 02:16:58 -0000 1.1 --- roadmap_trace.c 28 Jun 2006 13:46:41 -0000 1.2 *************** *** 35,38 **** --- 35,39 ---- #include <string.h> #include <stdio.h> + #include <unistd.h> #include <stdlib.h> *************** *** 47,62 **** int main(int argc, char *argv[]) { - char config[256]; - int config_length; - - char buffer[256]; int received; ! ! int previous = -1; ! int delay_cursor = 0; ! int delay_length = 0; ! ! struct delay_buffer *delay_line = NULL; ! printf ("$PXRMSUB,NMEA\n"); --- 48,53 ---- int main(int argc, char *argv[]) { int received; ! char buffer[256]; printf ("$PXRMSUB,NMEA\n"); Index: roadmap_friends.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_friends.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** roadmap_friends.c 26 Jun 2005 01:26:09 -0000 1.3 --- roadmap_friends.c 28 Jun 2006 13:46:41 -0000 1.4 *************** *** 124,131 **** --- 124,133 ---- #include <stdlib.h> #include <unistd.h> + #include <time.h> #include <sys/select.h> #include "roadmap.h" + #include "roadmap_net.h" *************** *** 204,208 **** } ! snprintf (buffer, sizeof(buffer), "POS: %s %s %.6f %.6f %d %d %d", friends_local_name, friends_local_name, coordinate_to_friends (argv[3], argv[4]), --- 206,210 ---- } ! snprintf (buffer, sizeof(buffer), "POS: %s %s %.6f %.6f %ld %d %d", friends_local_name, friends_local_name, coordinate_to_friends (argv[3], argv[4]), *************** *** 235,239 **** char id[30]; char name[40]; - char lat[40]; double latitude; double longitude; --- 237,240 ---- Index: roadmap_ghost.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_ghost.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** roadmap_ghost.c 26 Jun 2005 01:27:49 -0000 1.7 --- roadmap_ghost.c 28 Jun 2006 13:46:41 -0000 1.8 *************** *** 37,40 **** --- 37,41 ---- #include <stdio.h> #include <stdlib.h> + #include <unistd.h> #include "roadmap.h" *************** *** 71,75 **** printf ("$PXRMADD,%s,%s,Friend\n", driver, driver); printf ("$PXRMSUB,RMC\n"); ! printf ("%s10\n", config, driver); fflush(stdout); --- 72,76 ---- printf ("$PXRMADD,%s,%s,Friend\n", driver, driver); printf ("$PXRMSUB,RMC\n"); ! printf ("%s10\n", config); fflush(stdout); Index: rdmindex_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/rdmindex_main.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** rdmindex_main.c 16 Jan 2006 20:57:33 -0000 1.3 --- rdmindex_main.c 28 Jun 2006 13:46:41 -0000 1.4 *************** *** 37,40 **** --- 37,41 ---- #include "roadmap_square.h" #include "roadmap_metadata.h" + #include "roadmap_file.h" #include "buildmap.h" *************** *** 122,128 **** char **cursor; - char *extension; - int extension_index; - char *name; char *fullname; --- 123,126 ---- *************** *** 287,291 **** if (! roadmap_path_is_directory (RdmIndexPath)) { ! if (roadmap_file_exists (RdmIndexPath)) { buildmap_fatal (-1, "path %s is not a directory", RdmIndexPath); } else { --- 285,289 ---- if (! roadmap_path_is_directory (RdmIndexPath)) { ! if (roadmap_file_exists (NULL, RdmIndexPath)) { buildmap_fatal (-1, "path %s is not a directory", RdmIndexPath); } else { |
From: Paul F. <pg...@us...> - 2006-06-28 12:24:00
|
Update of /cvsroot/roadmap/roadmap/src/qt In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22160/qt Modified Files: Makefile Log Message: "all" should be the first target Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/qt/Makefile,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Makefile 26 Jun 2006 19:47:49 -0000 1.21 --- Makefile 28 Jun 2006 12:23:57 -0000 1.22 *************** *** 39,49 **** roadmap_messagebox.c - # temporary - roadmap_canvas_agg.o: - @echo - @echo "*** Sorry! We still need a roadmap_canvas_agg.cc for QT." - @echo - false - RMLIBOBJS1 = $(RMLIBSRCS:.cc=.o) RMLIBOBJS = $(CANVAS_OBJS) $(RMLIBOBJS1:.c=.o) --- 39,42 ---- *************** *** 85,88 **** --- 78,88 ---- cd $(bindir) && rm -f $(TARGETS) roadmap roadgps + # temporary + roadmap_canvas_agg.o: + @echo + @echo "*** Sorry! We still need a roadmap_canvas_agg.cc for QT." + @echo + false + # --- The real targets -------------------------------------------- |
From: Paul F. <pg...@us...> - 2006-06-28 12:24:00
|
Update of /cvsroot/roadmap/roadmap/src/gtk In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22160/gtk Modified Files: Makefile Log Message: "all" should be the first target Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk/Makefile,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Makefile 27 Jun 2006 20:16:44 -0000 1.20 --- Makefile 28 Jun 2006 12:23:57 -0000 1.21 *************** *** 17,27 **** roadmap_signals.c - # hopefully temporary - roadmap_canvas_agg.o: - @echo - @echo "*** Sorry! We still need a roadmap_canvas_agg.cpp for GTK." - @echo - false - RMLIBOBJS = $(CANVAS_OBJS) $(RMLIBSRCS:.c=.o) --- 17,20 ---- *************** *** 51,54 **** --- 44,54 ---- cd $(DESTDIR)$(bindir) && rm -f $(TARGETS) roadmap roadgps + # hopefully temporary + roadmap_canvas_agg.o: + @echo + @echo "*** Sorry! We still need a roadmap_canvas_agg.cpp for GTK." + @echo + false + # --- The real targets -------------------------------------------- |
From: Paul F. <pg...@us...> - 2006-06-28 12:22:35
|
Update of /cvsroot/roadmap/roadmap/src/gtk2 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv21674/gtk2 Modified Files: roadmap_canvas_agg.cpp Log Message: scroll wheel support got lost in the shuffle. this puts it back. Index: roadmap_canvas_agg.cpp =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk2/roadmap_canvas_agg.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_canvas_agg.cpp 26 Jun 2006 19:54:23 -0000 1.1 --- roadmap_canvas_agg.cpp 28 Jun 2006 12:22:32 -0000 1.2 *************** *** 219,222 **** --- 219,243 ---- } + static gboolean roadmap_canvas_scroll_event + (GtkWidget *w, GdkEventScroll *event, gpointer data) { + + int direction = 0; + RoadMapGuiPoint point; + + point.x = (short)event->x; + point.y = (short)event->y; + + switch (event->direction) { + case GDK_SCROLL_UP: direction = 1; break; + case GDK_SCROLL_DOWN: direction = -1; break; + case GDK_SCROLL_LEFT: direction = 2; break; + case GDK_SCROLL_RIGHT: direction = -2; break; + } + + (*RoadMapCanvasMouseScroll) (direction, &point); + + return FALSE; + } + void roadmap_canvas_refresh (void) { *************** *** 242,248 **** gtk_widget_set_double_buffered (RoadMapDrawingArea, FALSE); ! gtk_widget_set_events ! (RoadMapDrawingArea, ! GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK|GDK_POINTER_MOTION_MASK); --- 263,271 ---- gtk_widget_set_double_buffered (RoadMapDrawingArea, FALSE); ! gtk_widget_set_events (RoadMapDrawingArea, ! GDK_BUTTON_PRESS_MASK | ! GDK_BUTTON_RELEASE_MASK | ! GDK_POINTER_MOTION_MASK | ! GDK_SCROLL_MASK); *************** *** 272,275 **** --- 295,303 ---- (gpointer)3); + g_signal_connect (RoadMapDrawingArea, + "scroll_event", + (GCallback) roadmap_canvas_scroll_event, + (gpointer)0); + return RoadMapDrawingArea; } |
From: Paul F. <pg...@us...> - 2006-06-28 12:22:35
|
Update of /cvsroot/roadmap/roadmap/src/agg_support In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv21674/agg_support Modified Files: roadmap_canvas_agg.h Log Message: scroll wheel support got lost in the shuffle. this puts it back. Index: roadmap_canvas_agg.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/agg_support/roadmap_canvas_agg.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_canvas_agg.h 26 Jun 2006 19:51:57 -0000 1.1 --- roadmap_canvas_agg.h 28 Jun 2006 12:22:31 -0000 1.2 *************** *** 42,45 **** --- 42,47 ---- extern RoadMapCanvasMouseHandler RoadMapCanvasMouseMoved; + extern RoadMapCanvasMouseHandler RoadMapCanvasMouseScroll; + extern RoadMapCanvasConfigureHandler RoadMapCanvasConfigure; |
From: Paul F. <pg...@us...> - 2006-06-28 01:23:30
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv21152 Modified Files: roadmap_start.c Log Message: give track menu items better names. today i couldn't figure out how to turn my current track into a route, in order to follow it backwards. and i wrote it! Index: roadmap_start.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_start.c,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** roadmap_start.c 28 Jun 2006 01:16:31 -0000 1.97 --- roadmap_start.c 28 Jun 2006 01:23:27 -0000 1.98 *************** *** 457,467 **** "Show or Hide the GPS breadcrumb track", roadmap_track_toggle_display}, ! {"tracksave", "Save Track", "Save Track", NULL, "Save the current GPS breadcrumb track", roadmap_start_save_track}, ! {"trackclear", "Clear Track", "Clear Track", NULL, "Clear the current GPS breadcrumb track", roadmap_track_clear}, ! {"tracktoroute", "Convert Track", NULL, NULL, "Convert the current GPS track to a new route", roadmap_trip_track_convert }, --- 457,467 ---- "Show or Hide the GPS breadcrumb track", roadmap_track_toggle_display}, ! {"tracksave", "Save Current Track", "Save Track", NULL, "Save the current GPS breadcrumb track", roadmap_start_save_track}, ! {"trackclear", "Clear Current Track", "Clear Track", NULL, "Clear the current GPS breadcrumb track", roadmap_track_clear}, ! {"tracktoroute", "Make route from current track", "Track Back", NULL, "Convert the current GPS track to a new route", roadmap_trip_track_convert }, |
From: Paul F. <pg...@us...> - 2006-06-28 01:16:34
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv18921 Modified Files: roadmap_start.c Log Message: add missing menu entry for "add gps location as new waypoing" action. ("gpsaswaypoint") Index: roadmap_start.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_start.c,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** roadmap_start.c 26 Jun 2006 19:51:14 -0000 1.96 --- roadmap_start.c 28 Jun 2006 01:16:31 -0000 1.97 *************** *** 493,500 **** "Select, rename, or delete routes", roadmap_trip_route_manage_dialog}, ! {"gpsaswaypoint", "GPS as new place...", "GPS Place", "GW", "Create new place using current GPS position", roadmap_start_create_gps_waypoint}, ! {"addaswaypoint", "Add as new place...", "Place", "W", "Create new place using last selected street or place", roadmap_start_create_waypoint}, --- 493,500 ---- "Select, rename, or delete routes", roadmap_trip_route_manage_dialog}, ! {"gpsaswaypoint", "New place from GPS...", "GPS Place", "GW", "Create new place using current GPS position", roadmap_start_create_gps_waypoint}, ! {"addaswaypoint", "New place from selected...", "Place", "W", "Create new place using last selected street or place", roadmap_start_create_waypoint}, *************** *** 508,512 **** "Edit personal landmarks", roadmap_trip_personal_waypoint_manage_dialog }, ! {"mergepersonalwaypoints", "Load More Personal Landmarks...", NULL, NULL, "Merge personal landmarks from file", roadmap_start_merge_landmark }, --- 508,512 ---- "Edit personal landmarks", roadmap_trip_personal_waypoint_manage_dialog }, ! {"mergepersonalwaypoints", "Load more Personal Landmarks...", NULL, NULL, "Merge personal landmarks from file", roadmap_start_merge_landmark }, *************** *** 617,620 **** --- 617,621 ---- "addaswaypoint", + "gpsaswaypoint", "editroutewaypoints", "edittripwaypoints", |
From: Paul F. <pg...@us...> - 2006-06-27 20:16:49
|
Update of /cvsroot/roadmap/roadmap/src/gtk In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv17698/gtk Modified Files: Makefile Log Message: prevent make install and make uninstall from being recursive. subdir makes should never re-invoke topdir makes. Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk/Makefile,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Makefile 26 Jun 2006 19:47:49 -0000 1.19 --- Makefile 27 Jun 2006 20:16:44 -0000 1.20 *************** *** 41,45 **** install: - $(MAKE) -C $(TOP) install $(STRIP) $(TARGETS) mkdir -p $(DESTDIR)$(bindir) --- 41,44 ---- *************** *** 51,55 **** uninstall: cd $(DESTDIR)$(bindir) && rm -f $(TARGETS) roadmap roadgps - $(MAKE) -C $(TOP) uninstall # --- The real targets -------------------------------------------- --- 50,53 ---- |
From: Paul F. <pg...@us...> - 2006-06-27 20:16:47
|
Update of /cvsroot/roadmap/roadmap/src/gtk2 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv17698/gtk2 Modified Files: Makefile Log Message: prevent make install and make uninstall from being recursive. subdir makes should never re-invoke topdir makes. Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk2/Makefile,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Makefile 26 Jun 2006 19:47:49 -0000 1.25 --- Makefile 27 Jun 2006 20:16:45 -0000 1.26 *************** *** 40,44 **** install: - $(MAKE) -C $(TOP) install $(STRIP) $(TARGETS) mkdir -p $(DESTDIR)$(bindir) --- 40,43 ---- *************** *** 50,54 **** uninstall: cd $(DESTDIR)$(bindir) && rm -f $(TARGETS) roadmap roadgps - $(MAKE) -C $(TOP) uninstall # --- The real targets -------------------------------------------- --- 49,52 ---- |
From: Paul F. <pg...@us...> - 2006-06-27 17:44:09
|
Update of /cvsroot/roadmap/roadmap/src/qt In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15729/src/qt Modified Files: qt_canvas.cc qt_canvas.h roadmap_canvas.cc Log Message: angled label support for QT, courtesy of Oleg Gusev Index: roadmap_canvas.cc =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/qt/roadmap_canvas.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** roadmap_canvas.cc 26 Jun 2006 19:54:02 -0000 1.8 --- roadmap_canvas.cc 27 Jun 2006 17:43:58 -0000 1.9 *************** *** 125,130 **** int angle, const char *text) { ! /* no angle possible, currently. at least try and center the text */ ! roadmap_canvas_draw_string (center, ROADMAP_CANVAS_CENTER, text); } --- 125,129 ---- int angle, const char *text) { ! roadMapCanvas->drawStringAngle(position, 0, text, angle); } Index: qt_canvas.cc =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/qt/qt_canvas.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** qt_canvas.cc 20 Nov 2005 00:07:32 -0000 1.7 --- qt_canvas.cc 27 Jun 2006 17:43:58 -0000 1.8 *************** *** 105,115 **** int* descent) { ! QFont defaultFont; ! QFontMetrics fm(defaultFont); ! ! QRect r = fm.boundingRect(text); *w = r.width(); *ascent = fm.ascent(); *descent = fm.descent(); } --- 105,116 ---- int* descent) { ! QFont f("Arial Bold",12); ! QFontMetrics fm(f); ! ! QRect r = fm.boundingRect(QString::fromUtf8(text)); *w = r.width(); *ascent = fm.ascent(); *descent = fm.descent(); + } *************** *** 165,168 **** --- 166,188 ---- } + void RMapCanvas::drawStringAngle(RoadMapGuiPoint* position, + int center, const char* text, int angle) { + if (!pixmap) { + return; + } + + QPainter p(pixmap); + if (currentPen != 0) { + p.setPen(*currentPen); + } + + QFont f("Arial Bold",12); + + p.setFont(f); + p.translate(position->x,position->y); + p.rotate((double)angle); + p.drawText(0, 0, QString::fromUtf8(text)); + } + void RMapCanvas::drawMultiplePoints(int count, RoadMapGuiPoint* points) { QPainter p(pixmap); Index: qt_canvas.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/qt/qt_canvas.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** qt_canvas.h 20 Nov 2005 00:07:03 -0000 1.5 --- qt_canvas.h 27 Jun 2006 17:43:58 -0000 1.6 *************** *** 57,61 **** void setPenThickness(int thickness); void erase(void); ! void drawString(RoadMapGuiPoint* position, int corner, const char* text); void drawMultiplePoints(int count, RoadMapGuiPoint* points); void drawMultipleLines(int count, int* lines, RoadMapGuiPoint* points); --- 57,64 ---- void setPenThickness(int thickness); void erase(void); ! void drawString(RoadMapGuiPoint* position, int corner, ! const char* text); ! void drawStringAngle(RoadMapGuiPoint* position, ! int center, const char* text, int angle); void drawMultiplePoints(int count, RoadMapGuiPoint* points); void drawMultipleLines(int count, int* lines, RoadMapGuiPoint* points); |
From: Paul F. <pg...@us...> - 2006-06-27 17:44:04
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15729/src Modified Files: config.mk options.mk roadmap_label.c Log Message: angled label support for QT, courtesy of Oleg Gusev Index: roadmap_label.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_label.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** roadmap_label.c 27 Jun 2006 03:59:57 -0000 1.2 --- roadmap_label.c 27 Jun 2006 17:43:57 -0000 1.3 *************** *** 200,204 **** /* text is too long for this feature */ ! if ((width >> 2)> cachePtr->featuresize) { continue; } --- 200,204 ---- /* text is too long for this feature */ ! if ((width >> 2) > cachePtr->featuresize) { continue; } Index: options.mk =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/options.mk,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** options.mk 26 Jun 2006 19:47:49 -0000 1.1 --- options.mk 27 Jun 2006 17:43:57 -0000 1.2 *************** *** 96,99 **** --- 96,107 ---- endif + # rotation support in QT/QPE + ifeq ($(strip $(DESKTOP)),QT) + CFLAGS += -DANGLED_LABELS=1 + endif + ifeq ($(strip $(DESKTOP)),QPE) + CFLAGS += -DANGLED_LABELS=1 + endif + # later... Index: config.mk =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/config.mk,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** config.mk 26 Jun 2006 19:47:49 -0000 1.1 --- config.mk 27 Jun 2006 17:43:57 -0000 1.2 *************** *** 20,23 **** --- 20,28 ---- CFLAGS = + # if you know you need other libraries for your build, you can + # add those here as well. for example: + # LIBS += -L$(QTDIR)/lib64 + LIBS = + # Choose a desktop # DESKTOP = GTK *************** *** 31,35 **** QTDIR=/usr - # RoadMap uses the "expat" library in order to read and write xml # for the GPX format route/track/waypoint files. If you don't --- 36,39 ---- |
From: Paul F. <pg...@us...> - 2006-06-27 17:44:01
|
Update of /cvsroot/roadmap/roadmap In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15729 Modified Files: README Log Message: angled label support for QT, courtesy of Oleg Gusev Index: README =================================================================== RCS file: /cvsroot/roadmap/roadmap/README,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** README 26 Jun 2006 20:14:46 -0000 1.92 --- README 27 Jun 2006 17:43:57 -0000 1.93 *************** *** 580,585 **** [AGG=NO] Do not try to link roadmap with the agg library. ! The side effect is that street labels will be written ! horizontally, rather than "along" their street. ---- --- 580,586 ---- [AGG=NO] Do not try to link roadmap with the agg library. ! The side effect is that street labels may be written ! horizontally, rather than "along" their street. (QT and QPE ! builds can do angled labels without the agg library.) ---- |
From: Paul F. <pg...@us...> - 2006-06-27 04:03:20
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv2410 Modified Files: roadmap_math.c roadmap_math.h roadmap_navigate.c roadmap_screen.c Log Message: sync the rest of 3D mode from the editor branch. Index: roadmap_navigate.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_navigate.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** roadmap_navigate.c 6 Feb 2006 06:40:12 -0000 1.23 --- roadmap_navigate.c 27 Jun 2006 04:03:17 -0000 1.24 *************** *** 127,131 **** RoadMapPosition focus_position; ! roadmap_math_to_position (focused_point, &focus_position); if (focus_position.longitude < focus->west) { --- 127,131 ---- RoadMapPosition focus_position; ! roadmap_math_to_position (focused_point, &focus_position, 1); if (focus_position.longitude < focus->west) { *************** *** 164,168 **** focus_point.x += accuracy; focus_point.y += accuracy; ! roadmap_math_to_position (&focus_point, &focus_position); focus.west = focus_position.longitude; --- 164,168 ---- focus_point.x += accuracy; focus_point.y += accuracy; ! roadmap_math_to_position (&focus_point, &focus_position, 1); focus.west = focus_position.longitude; Index: roadmap_math.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_math.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** roadmap_math.h 26 Jun 2006 19:59:53 -0000 1.25 --- roadmap_math.h 27 Jun 2006 04:03:17 -0000 1.26 *************** *** 72,76 **** RoadMapGuiPoint *point); void roadmap_math_to_position (const RoadMapGuiPoint *point, ! RoadMapPosition *position); void roadmap_math_rotate_coordinates (int count, RoadMapGuiPoint *points); --- 72,78 ---- RoadMapGuiPoint *point); void roadmap_math_to_position (const RoadMapGuiPoint *point, ! RoadMapPosition *position, ! int projected); ! void roadmap_math_unproject (RoadMapGuiPoint *point); void roadmap_math_rotate_coordinates (int count, RoadMapGuiPoint *points); *************** *** 85,88 **** --- 87,92 ---- int roadmap_math_azymuth (const RoadMapPosition *point1, const RoadMapPosition *point2); + int roadmap_math_angle + (const RoadMapGuiPoint *point1, const RoadMapGuiPoint *point2); char *roadmap_math_distance_unit (void); *************** *** 125,128 **** --- 129,136 ---- int roadmap_math_delta_direction (int direction1, int direction2); + void roadmap_math_set_context (RoadMapPosition *position, int zoom); + + void roadmap_math_get_context (RoadMapPosition *position, int *zoom); + #endif // INCLUDED__ROADMAP_MATH__H Index: roadmap_screen.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_screen.c,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** roadmap_screen.c 26 Jun 2006 19:59:53 -0000 1.62 --- roadmap_screen.c 27 Jun 2006 04:03:17 -0000 1.63 *************** *** 1058,1062 **** ! roadmap_math_to_position (point, &position); if (roadmap_navigate_retrieve_line --- 1058,1062 ---- ! roadmap_math_to_position (point, &position, 1); if (roadmap_navigate_retrieve_line *************** *** 1106,1110 **** center.y = (RoadMapScreenHeight / 2) + dy; ! roadmap_math_to_position (¢er, &RoadMapScreenCenter); roadmap_math_set_center (&RoadMapScreenCenter); } --- 1106,1110 ---- center.y = (RoadMapScreenHeight / 2) + dy; ! roadmap_math_to_position (¢er, &RoadMapScreenCenter, 0); roadmap_math_set_center (&RoadMapScreenCenter); } *************** *** 1133,1137 **** if (RoadMapScreenViewMode == VIEW_MODE_3D) { - #if HAVE_3D_MODE RoadMapGuiPoint p = *point; RoadMapGuiPoint p2 = RoadMapScreenPointerLocation; --- 1133,1136 ---- *************** *** 1140,1148 **** roadmap_math_unproject (&p2); ! roadmap_screen_record_move ! (p2.x - p.x, p2.y - p.y); ! #else ! ; ! #endif } else { --- 1139,1143 ---- roadmap_math_unproject (&p2); ! roadmap_screen_record_move (p2.x - p.x, p2.y - p.y); } else { *************** *** 1291,1301 **** if (RoadMapScreenViewMode == VIEW_MODE_2D) { - #if HAVE_3D_MODE RoadMapScreenViewMode = VIEW_MODE_3D; RoadMapScreen3dHorizon = -100; - #else - roadmap_log (ROADMAP_ERROR, - "No 3D mode yet"); - #endif } else { RoadMapScreenViewMode = VIEW_MODE_2D; --- 1286,1291 ---- Index: roadmap_math.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_math.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** roadmap_math.c 26 Jun 2006 19:59:53 -0000 1.30 --- roadmap_math.c 27 Jun 2006 04:03:17 -0000 1.31 *************** *** 3,8 **** * LICENSE: * ! * Copyright 2002, 2005 Pascal F. Martin ! * Copyright 2005 Ehud Shabtai * * This file is part of RoadMap. --- 3,11 ---- * LICENSE: * ! * Copyright 2002 Pascal F. Martin ! * Copyright 2005,2006 Ehud Shabtai ! * ! * 3D perspective support was integrated from the RoadNav project ! * Copyright (c) 2004 - 2006 Richard L. Lynch <rl...@us...> * * This file is part of RoadMap. *************** *** 32,42 **** #include <stdio.h> #include <string.h> - #include <ctype.h> #include <stdlib.h> #include <math.h> #include "roadmap.h" #include "roadmap_math.h" #include "roadmap_square.h" #include "roadmap_config.h" --- 35,46 ---- #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> + #include <ctype.h> #include "roadmap.h" #include "roadmap_math.h" #include "roadmap_square.h" + #include "roadmap_state.h" #include "roadmap_config.h" *************** *** 133,137 **** --- 137,143 ---- RoadMapUnits *units; + int _3D_horizon; + } RoadMapContext; *************** *** 296,300 **** point.x = RoadMapContext.width; point.y = RoadMapContext.height; ! roadmap_math_to_position (&point, &position); RoadMapContext.upright_screen.south = position.latitude; RoadMapContext.upright_screen.east = position.longitude; --- 302,306 ---- point.x = RoadMapContext.width; point.y = RoadMapContext.height; ! roadmap_math_to_position (&point, &position, 1); RoadMapContext.upright_screen.south = position.latitude; RoadMapContext.upright_screen.east = position.longitude; *************** *** 419,423 **** - static void roadmap_math_counter_rotate_coordinate (RoadMapGuiPoint *point) { --- 425,428 ---- *************** *** 436,439 **** --- 441,445 ---- } + static void roadmap_math_project (RoadMapGuiPoint *point) { *************** *** 452,455 **** --- 458,474 ---- + static int roadmap_math_zoom_state (void) { + + if (RoadMapContext.zoom == + roadmap_config_get_integer (&RoadMapConfigGeneralDefaultZoom)) { + + return MATH_ZOOM_RESET; + } else { + + return MATH_ZOOM_NO_RESET; + } + } + + /* Rotation of the screen: * rotate the coordinates of a point on the screen, the center of *************** *** 463,482 **** ! if (RoadMapContext.orientation == 0) return; for (i = count; i > 0; --i) { ! x = points->x - RoadMapContext.center_x; ! y = RoadMapContext.center_y - points->y; ! points->x = ! RoadMapContext.center_x + ! (((x * RoadMapContext.cos_orientation) ! + (y * RoadMapContext.sin_orientation) + 16383) / 32768); ! points->y = ! RoadMapContext.center_y - ! (((y * RoadMapContext.cos_orientation) ! - (x * RoadMapContext.sin_orientation) + 16383) / 32768); points += 1; --- 482,508 ---- ! if (!RoadMapContext.orientation && !RoadMapContext._3D_horizon) return; for (i = count; i > 0; --i) { ! if (RoadMapContext.orientation) { ! x = points->x - RoadMapContext.center_x; ! y = RoadMapContext.center_y - points->y; ! points->x = ! RoadMapContext.center_x + ! (((x * RoadMapContext.cos_orientation) ! + (y * RoadMapContext.sin_orientation) + 16383) / 32768); ! points->y = ! RoadMapContext.center_y - ! (((y * RoadMapContext.cos_orientation) ! - (x * RoadMapContext.sin_orientation) + 16383) / 32768); ! } ! ! if (RoadMapContext._3D_horizon) { ! ! roadmap_math_project (points); ! } points += 1; *************** *** 525,528 **** --- 551,555 ---- } + /* Rotate a specific object: * rotate the coordinates of the object's points according to the provided *************** *** 541,555 **** ! if (total == 0) return; ! roadmap_math_trigonometry (total, &sin_o, &cos_o); for (i = count; i > 0; --i) { ! x = points->x - center->x; ! y = center->y - points->y; ! points->x = center->x + (((x * cos_o) + (y * sin_o) + 16383) / 32768); ! points->y = center->y - (((y * cos_o) - (x * sin_o) + 16383) / 32768); points += 1; --- 568,586 ---- ! if ((total == 0) && !RoadMapContext._3D_horizon) return; ! if (total) { ! roadmap_math_trigonometry (total, &sin_o, &cos_o); ! } for (i = count; i > 0; --i) { ! if (total) { ! x = points->x - center->x; ! y = center->y - points->y; ! points->x = center->x + (((x * cos_o) + (y * sin_o) + 16383) / 32768); ! points->y = center->y - (((y * cos_o) - (x * sin_o) + 16383) / 32768); ! } points += 1; *************** *** 563,572 **** --- 594,609 ---- roadmap_config_declare ("preferences", &RoadMapConfigGeneralDefaultZoom, "20"); + + roadmap_state_add ("zoom_reset", &roadmap_math_zoom_state); + RoadMapContext.orientation = 0; + RoadMapContext._3D_horizon = 0; + roadmap_math_use_imperial (); roadmap_math_compute_scale (); } + void roadmap_math_use_metric (void) { *************** *** 838,841 **** --- 875,879 ---- } + void roadmap_math_set_horizon (int horizon) { *************** *** 882,886 **** RoadMapContext.current_screen = RoadMapContext.upright_screen; ! if (direction != 0) { int i; --- 920,924 ---- RoadMapContext.current_screen = RoadMapContext.upright_screen; ! if ((direction != 0) || RoadMapContext._3D_horizon) { int i; *************** *** 890,903 **** point.x = 0; point.y = 0; ! roadmap_math_to_position (&point, position); point.x = RoadMapContext.width; ! roadmap_math_to_position (&point, position+1); point.y = RoadMapContext.height; ! roadmap_math_to_position (&point, position+2); point.x = 0; ! roadmap_math_to_position (&point, position+3); for (i = 0; i < 4; ++i) { --- 928,941 ---- point.x = 0; point.y = 0; ! roadmap_math_to_position (&point, position, 1); point.x = RoadMapContext.width; ! roadmap_math_to_position (&point, position+1, 1); point.y = RoadMapContext.height; ! roadmap_math_to_position (&point, position+2, 1); point.x = 0; ! roadmap_math_to_position (&point, position+3, 1); for (i = 0; i < 4; ++i) { *************** *** 940,951 **** void roadmap_math_to_position (const RoadMapGuiPoint *point, ! RoadMapPosition *position) { RoadMapGuiPoint point2; ! if (RoadMapContext.orientation) { point2 = *point; roadmap_math_counter_rotate_coordinate (&point2); point = &point2; --- 978,1025 ---- + void roadmap_math_unproject (RoadMapGuiPoint *point) { + + if (RoadMapContext._3D_horizon) { + + RoadMapGuiPoint point2; + + double fDistFromCenterX = point->x - RoadMapContext.width / 2; // X distance from center of screen + double fDistFromHorizon = point->y - RoadMapContext._3D_horizon; // Y distance from horizon + double fVisibleRange = RoadMapContext.height - RoadMapContext._3D_horizon; // distance from bottom of screen to horizon + double fDistFromBottom; + double fD; + + point2.x = (int) (fDistFromCenterX / ( fDistFromHorizon / fVisibleRange ) + RoadMapContext.width / 2); // unsqueeze the X axis + + fDistFromBottom = RoadMapContext.height - point->y; // distance from bottom of screen + fD = fDistFromBottom / ( 1.0 - fDistFromBottom / fVisibleRange); // inverse Y squeezing formula + + point2.y = (int) (RoadMapContext.height - fD); // center on screen + + *point = point2; + } + } + + void roadmap_math_to_position (const RoadMapGuiPoint *point, ! RoadMapPosition *position, ! int projected) { RoadMapGuiPoint point2; ! if (projected && RoadMapContext._3D_horizon) { point2 = *point; + roadmap_math_unproject (&point2); + + point = &point2; + } + + if (RoadMapContext.orientation) { + + if (!projected || !RoadMapContext._3D_horizon) { + point2 = *point; + } + roadmap_math_counter_rotate_coordinate (&point2); point = &point2; *************** *** 965,975 **** RoadMapGuiPoint *point) { point->x = ((position->longitude - RoadMapContext.upright_screen.west) ! / RoadMapContext.zoom_x); point->y = ((RoadMapContext.upright_screen.north - position->latitude) ! / RoadMapContext.zoom_y); } --- 1039,1051 ---- RoadMapGuiPoint *point) { + int scale = 1; + point->x = ((position->longitude - RoadMapContext.upright_screen.west) ! / (RoadMapContext.zoom_x / scale)); point->y = ((RoadMapContext.upright_screen.north - position->latitude) ! / (RoadMapContext.zoom_y / scale)); } *************** *** 1005,1008 **** --- 1081,1108 ---- + int roadmap_math_angle + (const RoadMapGuiPoint *point1, const RoadMapGuiPoint *point2) { + + int result; + int x; + int y; + double d; + + x = point2->x - point1->x; + y = point2->y - point1->y; + + d = sqrt ((x * x) + (y * y)); + + if (d > 0.0001 || d < -0.0001) { + result = roadmap_math_arccosine + ((int) ((32768 * y) / d), (x > 0)?1:-1); + } else { + result = 0; + } + + return result; + } + + int roadmap_math_distance (const RoadMapPosition *position1, const RoadMapPosition *position2) { *************** *** 1066,1069 **** --- 1166,1170 ---- } + char *roadmap_math_distance_unit (void) { *************** *** 1255,1314 **** - int roadmap_math_intersection (RoadMapPosition *from1, - RoadMapPosition *to1, - RoadMapPosition *from2, - RoadMapPosition *to2, - RoadMapPosition *intersection) { - - double a1,b1; - double a2,b2; - - if (from1->longitude == to1->longitude) { - - a1 = 0; - b1 = from1->latitude; - } else { - a1 = 1.0 * (from1->latitude - to1->latitude) / - (from1->longitude - to1->longitude); - b1 = from1->latitude - 1.0 * a1 * from1->longitude; - } - - if ((from2->longitude - to2->longitude) == 0) { - - a2 = 0; - b2 = from2->latitude; - } else { - a2 = 1.0 * (from2->latitude - to2->latitude) / - (from2->longitude - to2->longitude); - b2 = from2->latitude - 1.0 * a2 * from2->longitude; - } - - if (a1 == a2) return 0; - - intersection->longitude = (int) ((b1 - b2) / (a2 - a1)); - intersection->latitude = (int) (b1 + intersection->longitude * a1); - - return 1; - } - - - int roadmap_math_compare_points (const RoadMapPosition *p1, - const RoadMapPosition *p2) { - - if ((p1->longitude == p2->longitude) && - (p1->latitude == p2->latitude)) - return 0; - - if (p1->longitude < p2->longitude) return -1; - if (p2->longitude > p1->longitude) return 1; - - if (p1->latitude < p2->latitude) { - return -1; - } else { - return 1; - } - } - - unsigned int roadmap_math_street_address (const char *image, int length) { --- 1356,1359 ---- *************** *** 1386,1389 **** --- 1431,1490 ---- + int roadmap_math_intersection (RoadMapPosition *from1, + RoadMapPosition *to1, + RoadMapPosition *from2, + RoadMapPosition *to2, + RoadMapPosition *intersection) { + + double a1,b1; + double a2,b2; + + if (from1->longitude == to1->longitude) { + + a1 = 0; + b1 = from1->latitude; + } else { + a1 = 1.0 * (from1->latitude - to1->latitude) / + (from1->longitude - to1->longitude); + b1 = from1->latitude - 1.0 * a1 * from1->longitude; + } + + if ((from2->longitude - to2->longitude) == 0) { + + a2 = 0; + b2 = from2->latitude; + } else { + a2 = 1.0 * (from2->latitude - to2->latitude) / + (from2->longitude - to2->longitude); + b2 = from2->latitude - 1.0 * a2 * from2->longitude; + } + + if (a1 == a2) return 0; + + intersection->longitude = (int) ((b1 - b2) / (a2 - a1)); + intersection->latitude = (int) (b1 + intersection->longitude * a1); + + return 1; + } + + + int roadmap_math_compare_points (const RoadMapPosition *p1, + const RoadMapPosition *p2) { + + if ((p1->longitude == p2->longitude) && + (p1->latitude == p2->latitude)) + return 0; + + if (p1->longitude < p2->longitude) return -1; + if (p2->longitude > p1->longitude) return 1; + + if (p1->latitude < p2->latitude) { + return -1; + } else { + return 1; + } + } + + int roadmap_math_delta_direction (int direction1, int direction2) { *************** *** 1400,1401 **** --- 1501,1525 ---- } + + void roadmap_math_set_context (RoadMapPosition *position, int zoom) { + + RoadMapContext.center = *position; + + if (zoom < 0x10000) { + RoadMapContext.zoom = (unsigned short) zoom; + } + + if (RoadMapContext.zoom <= 1) { + RoadMapContext.zoom = 2; + } + + roadmap_math_compute_scale (); + } + + + void roadmap_math_get_context (RoadMapPosition *position, int *zoom) { + + *position = RoadMapContext.center; + *zoom = RoadMapContext.zoom; + } + |
From: Paul F. <pg...@us...> - 2006-06-27 04:00:00
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv1040 Modified Files: roadmap_label.c Log Message: fix odd whitespace Index: roadmap_label.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_label.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_label.c 26 Jun 2006 19:59:53 -0000 1.1 --- roadmap_label.c 27 Jun 2006 03:59:57 -0000 1.2 *************** *** 255,260 **** continue; /* next label */ ! roadmap_canvas_draw_string_angle (&p, &cachePtr->point, ! cachePtr->angle, text); } /* next label */ --- 255,260 ---- continue; /* next label */ ! roadmap_canvas_draw_string_angle ! (&p, &cachePtr->point, cachePtr->angle, text); } /* next label */ |
From: Paul F. <pg...@us...> - 2006-06-26 20:14:53
|
Update of /cvsroot/roadmap/roadmap In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv21992 Modified Files: README Log Message: makefile refactoring, street labelling, agg library Index: README =================================================================== RCS file: /cvsroot/roadmap/roadmap/README,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** README 16 Jun 2006 18:32:55 -0000 1.91 --- README 26 Jun 2006 20:14:46 -0000 1.92 *************** *** 127,130 **** --- 127,134 ---- files. RoadMap can be built without expat using the make option: EXPAT=NO. + Likewise, RoadMap will use the agg library to render angled text + when labeling streets. If you don't have agg, RoadMap will label + with horizontal strings. Use: AGG=NO. + * WINDOWS SPECIFIC DEPENDENCIES AND LIMITATIONS *************** *** 535,554 **** ---- ! [[4]] Compile roadmap for the GTK, GTK2 or the QT toolkit: ! ! ---- ! make DESKTOP=GTK -- if using the GTK 1.2 toolkit ! ! make DESKTOP=GTK2 -- if using the GTK 2.0 toolkit ! ! make DESKTOP=GPE -- if using GPE with the GTK 2.0 toolkit ! ! make DESKTOP=QT -- if using the QT toolkit ! ! make DESKTOP=QPE -- if using the QT/QPE toolkit ! ---- ! ! The following commands are convenient shortcuts that cover the most ! frequent cases: ---- --- 539,548 ---- ---- ! [[4]] Edit the config.mk file found in the src directory, and ! choose one of GTK, GTK2 or QT toolkit. ! ! Other build options are described in the comments of that ! file. As a shortcut, you can just type one of the following, ! but editing config.mk is recommended. ---- *************** *** 558,567 **** ---- ! If you want to build all three versions of RoadMap (GTK, GTK2 ! and QT), just type: ! ! ---- ! make -- This actually replaces steps 3 and 4. ! ---- <<Note for QT users>>: the RoadMap QT module is built with QT3 by --- 552,556 ---- ---- ! Simply typing "make" will build the default selection in config.mk. <<Note for QT users>>: the RoadMap QT module is built with QT3 by *************** *** 569,576 **** been tested with QT4. ! The complete list of options for building RoadMap is as follow: [MODE=DEBUG|PROFILE] Compiles RoadMap in debug mode. The PROFILE option ! also generates the necessary information & code for profiling. [SQL=SQLITE] Use the sqlite library. This option has no practical effect --- 558,566 ---- been tested with QT4. ! The complete list of options for building RoadMap is as follow. ! These can all be modified by editing config.mk. [MODE=DEBUG|PROFILE] Compiles RoadMap in debug mode. The PROFILE option ! also generates the necessary information and code for profiling. [SQL=SQLITE] Use the sqlite library. This option has no practical effect *************** *** 586,594 **** when the shapelib library is not available. ! [EXPAT=NO] Do not link roadmap with the expat library. The side effect ! is that you cannot load or save trips or landmarks anymore. ! [HOST=Darwin] Assume the compiler tools accept the Mac OS X (Darwin) ! command line options. ---- --- 576,585 ---- when the shapelib library is not available. ! [EXPAT=NO] Do not link roadmap with the expat library. The side ! effect is that you cannot load or save trips or landmarks anymore. ! [AGG=NO] Do not try to link roadmap with the agg library. ! The side effect is that street labels will be written ! horizontally, rather than "along" their street. ---- *************** *** 2171,2174 **** --- 2162,2174 ---- <<Default:>> LightYellow + [Map.Labels] Enable/disable the initial display of street names. + + <<Format:>> boolean + + <<Default:>> yes + + <<Comment:>> chooses whether streets are labelled at startup. + They can still be toggled by command. + [Map.Signs] Enable/disable the map sprites and street signs. |
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv14877 Modified Files: roadgps_screen.c roadmap_canvas.h roadmap_display.c roadmap_gui.h roadmap_math.c roadmap_math.h roadmap_plugin.c roadmap_plugin.h roadmap_preferences.c roadmap_screen.c roadmap_screen.h roadmap_sprite.c Added Files: roadmap_label.c roadmap_label.h roadmap_state.c roadmap_state.h Log Message: bring over street labelling code from the editor branch, and api changes needed due to introduction of agg. Index: roadmap_display.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_display.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** roadmap_display.c 26 Jun 2006 17:35:36 -0000 1.24 --- roadmap_display.c 26 Jun 2006 19:59:53 -0000 1.25 *************** *** 283,287 **** roadmap_canvas_get_text_extents ! (sign->content, &width, &ascent, &descent); width += 8; /* Keep some room around the text. */ --- 283,287 ---- roadmap_canvas_get_text_extents ! (sign->content, -1, &width, &ascent, &descent); width += 8; /* Keep some room around the text. */ *************** *** 408,415 **** roadmap_canvas_select_pen (sign->background); ! roadmap_canvas_draw_multiple_polygons (1, &count, points, 1); roadmap_canvas_select_pen (RoadMapMessageContour); ! roadmap_canvas_draw_multiple_polygons (1, &count, points, 0); roadmap_canvas_select_pen (sign->foreground); --- 408,415 ---- roadmap_canvas_select_pen (sign->background); ! roadmap_canvas_draw_multiple_polygons (1, &count, points, 1, 0); roadmap_canvas_select_pen (RoadMapMessageContour); ! roadmap_canvas_draw_multiple_polygons (1, &count, points, 0, 0); roadmap_canvas_select_pen (sign->foreground); *************** *** 582,586 **** } ! roadmap_canvas_get_text_extents (text, &width, &ascent, &descent); if (corner & ROADMAP_CANVAS_RIGHT) { --- 582,586 ---- } ! roadmap_canvas_get_text_extents (text, -1, &width, &ascent, &descent); if (corner & ROADMAP_CANVAS_RIGHT) { *************** *** 606,613 **** count = 4; roadmap_canvas_select_pen (RoadMapConsoleBackground); ! roadmap_canvas_draw_multiple_polygons (1, &count, frame, 1); roadmap_canvas_select_pen (RoadMapConsoleForeground); ! roadmap_canvas_draw_multiple_polygons (1, &count, frame, 0); frame[0].x = frame[3].x - 3; --- 606,613 ---- count = 4; roadmap_canvas_select_pen (RoadMapConsoleBackground); ! roadmap_canvas_draw_multiple_polygons (1, &count, frame, 1, 0); roadmap_canvas_select_pen (RoadMapConsoleForeground); ! roadmap_canvas_draw_multiple_polygons (1, &count, frame, 0, 0); frame[0].x = frame[3].x - 3; Index: roadmap_plugin.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_plugin.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_plugin.h 27 Nov 2005 05:56:23 -0000 1.1 --- roadmap_plugin.h 26 Jun 2006 19:59:53 -0000 1.2 *************** *** 70,73 **** --- 70,74 ---- const char *street; const char *city; + PluginStreet plugin_street; } PluginStreetProperties; Index: roadmap_plugin.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_plugin.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_plugin.c 27 Nov 2005 05:56:22 -0000 1.1 --- roadmap_plugin.c 26 Jun 2006 19:59:53 -0000 1.2 *************** *** 179,183 **** } ! if (hooks->activate_db != NULL) { return (*hooks->get_distance) (point, line, result); } --- 179,183 ---- } ! if (hooks->get_distance != NULL) { return (*hooks->get_distance) (point, line, result); } *************** *** 357,361 **** } ! if (hooks->get_street != NULL) { return (*hooks->get_street_full_name) (line); } --- 357,361 ---- } ! if (hooks->get_street_full_name != NULL) { return (*hooks->get_street_full_name) (line); } *************** *** 377,380 **** --- 377,383 ---- props->street = roadmap_street_get_street_name (&rm_properties); props->city = roadmap_street_get_city_name (&rm_properties); + props->plugin_street.plugin_id = ROADMAP_PLUGIN_ID; + props->plugin_street.street_id = rm_properties.street; + return; *************** *** 393,397 **** } ! if (hooks->get_street != NULL) { (*hooks->get_street_properties) (line, props); } --- 396,400 ---- } ! if (hooks->get_street_properties != NULL) { (*hooks->get_street_properties) (line, props); } Index: roadgps_screen.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadgps_screen.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** roadgps_screen.c 13 Nov 2005 23:46:40 -0000 1.8 --- roadgps_screen.c 26 Jun 2006 19:59:53 -0000 1.9 *************** *** 169,173 **** roadmap_canvas_select_pen (RoadGpsForeground); roadmap_canvas_draw_multiple_polygons ! (1, &count, satellite->points, !!reverse); } } --- 169,174 ---- roadmap_canvas_select_pen (RoadGpsForeground); roadmap_canvas_draw_multiple_polygons ! (1, &count, satellite->points, !!reverse, 0); ! } } *************** *** 222,226 **** count = 4; ! roadmap_canvas_draw_multiple_polygons (1, &count, points, filled); } --- 223,227 ---- count = 4; ! roadmap_canvas_draw_multiple_polygons (1, &count, points, filled, 0); } *************** *** 231,238 **** roadmap_canvas_draw_multiple_circles ! (3, RoadGpsFrame.centers, RoadGpsFrame.radius, 0); roadmap_canvas_draw_multiple_lines ! (5, RoadGpsFrame.scale_line_counts, RoadGpsFrame.scale_line_points); } --- 232,239 ---- roadmap_canvas_draw_multiple_circles ! (3, RoadGpsFrame.centers, RoadGpsFrame.radius, 0, 0); roadmap_canvas_draw_multiple_lines ! (5, RoadGpsFrame.scale_line_counts, RoadGpsFrame.scale_line_points, 0); } *************** *** 368,372 **** roadmap_canvas_get_text_extents ! ("09", &text_width, &text_ascent, &text_descent); text_height = text_ascent + text_descent + 2; --- 369,373 ---- roadmap_canvas_get_text_extents ! ("09", -1, &text_width, &text_ascent, &text_descent); text_height = text_ascent + text_descent + 2; --- NEW FILE: roadmap_label.h --- /* roadmap_label.h - Manage map labels. * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This code was mostly taken from UMN Mapserver * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __ROADMAP_LABEL__H #define __ROADMAP_LABEL__H #include "roadmap.h" #include "roadmap_gui.h" #define MAX_LABELS 500 typedef struct { int featuresize; PluginLine line; PluginStreet street; int angle; /* degrees */ RoadMapGuiPoint point; /* label point */ RoadMapGuiRect bbox; /* label bounding box */ int status; /* has this label been drawn or not */ } labelCacheMemberObj; typedef struct { labelCacheMemberObj labels[MAX_LABELS]; int numlabels; } labelCacheObj; int roadmap_label_add (const RoadMapGuiPoint *point, int angle, int featuresize, const PluginLine *line); int roadmap_label_activate (void); int roadmap_label_initialize (void); int roadmap_label_draw_cache (int angles); #endif // __ROADMAP_LABEL__H Index: roadmap_gui.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_gui.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** roadmap_gui.h 18 Nov 2005 20:10:52 -0000 1.3 --- roadmap_gui.h 26 Jun 2006 19:59:53 -0000 1.4 *************** *** 35,38 **** --- 35,47 ---- } RoadMapGuiPoint; + typedef struct { + + short minx; + short miny; + short maxx; + short maxy; + + } RoadMapGuiRect; + struct roadmap_menu_descriptor; typedef struct roadmap_menu_descriptor *RoadMapMenu; Index: roadmap_math.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_math.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** roadmap_math.c 6 Feb 2006 06:38:53 -0000 1.29 --- roadmap_math.c 26 Jun 2006 19:59:53 -0000 1.30 *************** *** 46,49 **** --- 46,52 ---- #define ROADMAP_BASE_METRIC 1 + #define MIN_ZOOM_IN 2 + #define MAX_ZOOM_OUT 0x10000 + static RoadMapConfigDescriptor RoadMapConfigGeneralDefaultZoom = *************** *** 130,134 **** RoadMapUnits *units; ! } RoadMapContext; --- 133,137 ---- RoadMapUnits *units; ! int _3D_horizon; } RoadMapContext; *************** *** 433,436 **** --- 436,455 ---- } + static void roadmap_math_project (RoadMapGuiPoint *point) { + + double fDistFromCenterY = RoadMapContext.height - point->y; // how far away is this point along the Y axis + double fVisibleRange = RoadMapContext.height - RoadMapContext._3D_horizon; // how far from the bottom of the screen is the horizon + double fDistFromCenterX; + double fDistFromHorizon; + + point->y = (int) (RoadMapContext.height - fDistFromCenterY / ( fabs(fDistFromCenterY / fVisibleRange) + 1 )); // make the Y coordinate converge on the horizon as the distance from the center goes to infinity + + fDistFromCenterX = point->x - RoadMapContext.width / 2; // X distance from center of the screen + fDistFromHorizon = point->y - RoadMapContext._3D_horizon; // distance from the horizon after adjusting for perspective + + point->x = (int) (fDistFromCenterX * ( fDistFromHorizon / fVisibleRange ) + RoadMapContext.width / 2); // squeeze the X axis, make it a point at the horizon and normal sized at the bottom of the screen + } + + /* Rotation of the screen: * rotate the coordinates of a point on the screen, the center of *************** *** 466,469 **** --- 485,528 ---- + /* + * rotate the coordinates of a point to an arbitrary angle + */ + void roadmap_math_rotate_point (RoadMapGuiPoint *points, + RoadMapGuiPoint *center, int angle) { + + static int cached_angle = 0; + static int sin_orientation; + static int cos_orientation; + + int x; + int y; + + if (angle == 0) return; + + if (angle != cached_angle) { + cached_angle = angle; + roadmap_math_trigonometry (cached_angle, + &sin_orientation, + &cos_orientation); + } + + x = points->x; + y = points->y; + + points->x = + center->x + + (((x * cos_orientation) + + (y * sin_orientation) + 16383) / 32768); + + points->y = + center->y - + (((y * cos_orientation) + - (x * sin_orientation) + 16383) / 32768); + + if (RoadMapContext._3D_horizon) { + roadmap_math_project (points); + } + } + /* Rotate a specific object: * rotate the coordinates of the object's points according to the provided *************** *** 686,690 **** zoom = (3 * RoadMapContext.zoom) / 2; ! if (zoom < 0x10000) { RoadMapContext.zoom = (unsigned short) zoom; } --- 745,749 ---- zoom = (3 * RoadMapContext.zoom) / 2; ! if (zoom < MAX_ZOOM_OUT) { RoadMapContext.zoom = (unsigned short) zoom; } *************** *** 697,703 **** RoadMapContext.zoom = (2 * RoadMapContext.zoom) / 3; ! if (RoadMapContext.zoom <= 1) { ! RoadMapContext.zoom = 2; } roadmap_config_set_integer (&RoadMapConfigGeneralZoom, RoadMapContext.zoom); roadmap_math_compute_scale (); --- 756,763 ---- RoadMapContext.zoom = (2 * RoadMapContext.zoom) / 3; ! if (RoadMapContext.zoom < MIN_ZOOM_IN) { ! RoadMapContext.zoom = MIN_ZOOM_IN; } + roadmap_config_set_integer (&RoadMapConfigGeneralZoom, RoadMapContext.zoom); roadmap_math_compute_scale (); *************** *** 778,781 **** --- 838,848 ---- } + void roadmap_math_set_horizon (int horizon) { + + RoadMapContext._3D_horizon = horizon; + + roadmap_math_compute_scale (); + } + int roadmap_math_set_orientation (int direction) { *************** *** 955,959 **** /* Take a number followed by ft/mi/m/km, and converts it to current units. */ ! int roadmap_math_distance_convert(const char *string, int *explicit) { char *suffix; --- 1022,1026 ---- /* Take a number followed by ft/mi/m/km, and converts it to current units. */ ! int roadmap_math_distance_convert(const char *string, int *was_explicit) { char *suffix; *************** *** 994,998 **** } ! if (explicit) *explicit = had_units; return (int)distance; --- 1061,1065 ---- } ! if (was_explicit) *was_explicit = had_units; return (int)distance; Index: roadmap_sprite.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_sprite.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** roadmap_sprite.c 2 Jan 2006 09:01:34 -0000 1.11 --- roadmap_sprite.c 26 Jun 2006 19:59:53 -0000 1.12 *************** *** 551,555 **** roadmap_canvas_draw_multiple_polygons (plane->polygons.object_count, ! plane->polygons.objects, RoadMapSpritePoints, 1); } --- 551,555 ---- roadmap_canvas_draw_multiple_polygons (plane->polygons.object_count, ! plane->polygons.objects, RoadMapSpritePoints, 1, 0); } *************** *** 560,564 **** roadmap_canvas_draw_multiple_circles (plane->disks.object_count, ! RoadMapSpritePoints, plane->disks.objects, 1); } --- 560,564 ---- roadmap_canvas_draw_multiple_circles (plane->disks.object_count, ! RoadMapSpritePoints, plane->disks.objects, 1, 0); } *************** *** 569,573 **** roadmap_canvas_draw_multiple_lines (plane->lines.object_count, ! plane->lines.objects, RoadMapSpritePoints); } --- 569,573 ---- roadmap_canvas_draw_multiple_lines (plane->lines.object_count, ! plane->lines.objects, RoadMapSpritePoints, 0); } *************** *** 578,582 **** roadmap_canvas_draw_multiple_circles (plane->circles.object_count, ! RoadMapSpritePoints, plane->circles.objects, 0); } } --- 578,582 ---- roadmap_canvas_draw_multiple_circles (plane->circles.object_count, ! RoadMapSpritePoints, plane->circles.objects, 0, 0); } } Index: roadmap_canvas.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_canvas.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** roadmap_canvas.h 20 Nov 2005 00:10:30 -0000 1.6 --- roadmap_canvas.h 26 Jun 2006 19:59:53 -0000 1.7 *************** *** 33,40 **** --- 33,46 ---- #include "roadmap_gui.h" + enum { IMAGE_NORMAL, + IMAGE_SELECTED + }; struct roadmap_canvas_pen; typedef struct roadmap_canvas_pen *RoadMapPen; + struct roadmap_canvas_image; + typedef struct roadmap_canvas_image *RoadMapImage; + typedef void (*RoadMapCanvasMouseHandler) (int button, RoadMapGuiPoint *point); typedef void (*RoadMapCanvasConfigureHandler) (void); *************** *** 62,66 **** */ void roadmap_canvas_get_text_extents ! (const char *text, int *width, int *ascent, int *descent); --- 68,72 ---- */ void roadmap_canvas_get_text_extents ! (const char *text, int size, int *width, int *ascent, int *descent); *************** *** 75,79 **** * on the canvas. */ ! void roadmap_canvas_select_pen (RoadMapPen pen); --- 81,85 ---- * on the canvas. */ ! RoadMapPen roadmap_canvas_select_pen (RoadMapPen pen); *************** *** 84,87 **** --- 90,95 ---- void roadmap_canvas_set_foreground (const char *color); void roadmap_canvas_set_thickness (int thickness); + int roadmap_canvas_get_thickness (RoadMapPen pen); + void roadmap_canvas_set_opacity (int opacity); *************** *** 108,126 **** #define ROADMAP_CANVAS_BOTTOMLEFT (ROADMAP_CANVAS_BOTTOM|ROADMAP_CANVAS_LEFT) void roadmap_canvas_draw_string (RoadMapGuiPoint *position, int corner, const char *text); void roadmap_canvas_draw_multiple_points (int count, RoadMapGuiPoint *points); void roadmap_canvas_draw_multiple_lines ! (int count, int *lines, RoadMapGuiPoint *points); void roadmap_canvas_draw_multiple_polygons ! (int count, int *polygons, RoadMapGuiPoint *points, int filled); void roadmap_canvas_draw_multiple_circles ! (int count, RoadMapGuiPoint *centers, int *radius, int filled); --- 116,145 ---- #define ROADMAP_CANVAS_BOTTOMLEFT (ROADMAP_CANVAS_BOTTOM|ROADMAP_CANVAS_LEFT) + #define CANVAS_DRAW_FAST 0x1 + #define CANVAS_NO_ROTATE 0x2 + + #define CANVAS_COPY_NORMAL 0x1 + #define CANVAS_COPY_BLEND 0x2 + void roadmap_canvas_draw_string (RoadMapGuiPoint *position, int corner, const char *text); + void roadmap_canvas_draw_string_angle (RoadMapGuiPoint *position, + RoadMapGuiPoint *center, int angle, + const char *text); void roadmap_canvas_draw_multiple_points (int count, RoadMapGuiPoint *points); void roadmap_canvas_draw_multiple_lines ! (int count, int *lines, RoadMapGuiPoint *points, int fast_draw); void roadmap_canvas_draw_multiple_polygons ! (int count, int *polygons, RoadMapGuiPoint *points, int filled, ! int fast_draw); void roadmap_canvas_draw_multiple_circles ! (int count, RoadMapGuiPoint *centers, int *radius, int filled, ! int fast_draw); *************** *** 135,138 **** --- 154,175 ---- void roadmap_canvas_save_screenshot (const char* filename); + int roadmap_canvas_image_width (const RoadMapImage image); + int roadmap_canvas_image_height (const RoadMapImage image); + + RoadMapImage roadmap_canvas_load_image (const char *path, + const char* file_name); + + void roadmap_canvas_draw_image (RoadMapImage image, RoadMapGuiPoint *pos, + int opacity, int mode); + + void roadmap_canvas_copy_image (RoadMapImage dst_image, + const RoadMapGuiPoint *pos, + const RoadMapGuiRect *rect, + RoadMapImage src_image, int mode); + + void roadmap_canvas_draw_image_text (RoadMapImage image, + const RoadMapGuiPoint *position, + int size, const char *text); + #endif // INCLUDE__ROADMAP_CANVAS__H Index: roadmap_math.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_math.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** roadmap_math.h 6 Feb 2006 06:39:13 -0000 1.24 --- roadmap_math.h 26 Jun 2006 19:59:53 -0000 1.25 *************** *** 29,32 **** --- 29,35 ---- #include "roadmap_gui.h" + enum { MATH_ZOOM_RESET = -1, + MATH_ZOOM_NO_RESET = 0 + }; void roadmap_math_initialize (void); *************** *** 44,47 **** --- 47,51 ---- int roadmap_math_set_orientation (int direction); int roadmap_math_get_orientation (void); + void roadmap_math_set_horizon (int horizon); void roadmap_math_set_focus (const RoadMapArea *focus); *************** *** 72,75 **** --- 76,82 ---- void roadmap_math_rotate_coordinates (int count, RoadMapGuiPoint *points); + void roadmap_math_rotate_point (RoadMapGuiPoint *points, + RoadMapGuiPoint *center, int angle); + void roadmap_math_rotate_object (int count, RoadMapGuiPoint *points, *************** *** 86,90 **** (const RoadMapPosition *position1, const RoadMapPosition *position2); ! int roadmap_math_distance_convert (const char *string, int *explicit); int roadmap_math_to_trip_distance (int distance); int roadmap_math_to_trip_distance_tenths (int distance); --- 93,97 ---- (const RoadMapPosition *position1, const RoadMapPosition *position2); ! int roadmap_math_distance_convert (const char *string, int *was_explicit); int roadmap_math_to_trip_distance (int distance); int roadmap_math_to_trip_distance_tenths (int distance); --- NEW FILE: roadmap_state.c --- /* roadmap_state.c - manage states of different objects. * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * DESCRIPTION: * * This module manages a dynamic list of states of different items / objects * in RoadMap. This is mainly used to display different icons on screen * according to the states. */ #include <stdlib.h> #include <string.h> #include "roadmap.h" #include "roadmap_types.h" #include "roadmap_state.h" struct RoadMapStateDescriptor { char *name; /* Unique name of the state indicator. */ RoadMapStateFn state_fn; struct RoadMapStateDescriptor *next; }; typedef struct RoadMapStateDescriptor *RoadMapState; static RoadMapState RoadMapStateList = NULL; #define ROADMAP_STATE_CLIENTS 5 static RoadMapCallback RoadMapStateMonitors[ROADMAP_STATE_CLIENTS] = {NULL}; void roadmap_state_add (const char *name, RoadMapStateFn state_fn) { RoadMapState object = malloc(sizeof(*object)); roadmap_check_allocated(object); object->name = strdup (name); object->state_fn = state_fn; object->next = RoadMapStateList; RoadMapStateList = object; } RoadMapStateFn roadmap_state_find (const char *name) { RoadMapState cursor; for (cursor = RoadMapStateList; cursor != NULL; cursor = cursor->next) { if (!strcmp (cursor->name, name)) { return cursor->state_fn; } } return NULL; } void roadmap_state_refresh (void) { int i; for (i = 0; i < ROADMAP_STATE_CLIENTS; ++i) { if (RoadMapStateMonitors[i] == NULL) break; (RoadMapStateMonitors[i]) (); } } void roadmap_state_monitor (RoadMapCallback monitor) { int i; for (i = 0; i < ROADMAP_STATE_CLIENTS; ++i) { if (RoadMapStateMonitors[i] == NULL) { RoadMapStateMonitors[i] = monitor; break; } } } Index: roadmap_screen.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_screen.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** roadmap_screen.h 19 Nov 2005 06:08:08 -0000 1.9 --- roadmap_screen.h 26 Jun 2006 19:59:53 -0000 1.10 *************** *** 28,31 **** --- 28,39 ---- #include "roadmap_canvas.h" + enum { VIEW_MODE_2D = 0, + VIEW_MODE_3D + }; + + enum { ORIENTATION_DYNAMIC = 0, + ORIENTATION_FIXED + }; + void roadmap_screen_initialize (void); *************** *** 41,44 **** --- 49,58 ---- void roadmap_screen_move_left (void); + void roadmap_screen_toggle_view_mode (void); + void roadmap_screen_toggle_labels (void); + void roadmap_screen_toggle_orientation_mode (void); + void roadmap_screen_increase_horizon (void); + void roadmap_screen_decrease_horizon (void); + void roadmap_screen_rotate (int delta); *************** *** 64,77 **** int last_shape, RoadMapShapeIterator shape_next, ! RoadMapPen pen); ! void roadmap_screen_draw_line_direction (const RoadMapPosition *from, ! const RoadMapPosition *to, ! const RoadMapPosition *shape_start, ! int first_shape, ! int last_shape, ! RoadMapShapeIterator shape_next, ! int width, ! int direction); #endif // INCLUDE__ROADMAP_SCREEN__H --- 78,87 ---- int last_shape, RoadMapShapeIterator shape_next, ! RoadMapPen pen, ! int *total_length, ! RoadMapGuiPoint *middle, ! int *angle); ! int roadmap_screen_is_dragging (void); #endif // INCLUDE__ROADMAP_SCREEN__H --- NEW FILE: roadmap_state.h --- /* roadmap_state.h - manage object states. * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef INCLUDE__ROADMAP_STATE__H #define INCLUDE__ROADMAP_STATE__H typedef int (*RoadMapStateFn) (void); void roadmap_state_add (const char *name, RoadMapStateFn state_fn); RoadMapStateFn roadmap_state_find (const char *name); void roadmap_state_monitor (RoadMapCallback monitor); void roadmap_state_refresh (void); #endif // INCLUDE__ROADMAP_STATE__H --- NEW FILE: roadmap_label.c --- /* roadmap_label.c - Manage map labels. * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This code was mostly taken from UMN Mapserver * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * See roadmap_label.h. */ #include "roadmap_config.h" #include "roadmap_math.h" #include "roadmap_plugin.h" #include "roadmap_canvas.h" #include "roadmap_label.h" #define MIN(a, b) (a) < (b) ? (a) : (b) #define MAX(a, b) (a) > (b) ? (a) : (b) static RoadMapConfigDescriptor RoadMapConfigMinFeatureSize = ROADMAP_CONFIG_ITEM("Labels", "MinFeatureSize"); static RoadMapConfigDescriptor RoadMapConfigLabelsColor = ROADMAP_CONFIG_ITEM("Labels", "Color"); static labelCacheObj RoadMapLabelCache; static int RoadMapLabelCacheFull = 0; static RoadMapPen RoadMapLabelPen; static int rect_overlap (RoadMapGuiRect *a, RoadMapGuiRect *b) { if(a->minx > b->maxx) return 0; if(a->maxx < b->minx) return 0; if(a->miny > b->maxy) return 0; if(a->maxy < b->miny) return 0; return 1; } static void compute_bbox(RoadMapGuiPoint *poly, RoadMapGuiRect *bbox) { int i; bbox->minx = bbox->maxx = poly[0].x; bbox->miny = bbox->maxy = poly[0].y; for(i=1; i<4; i++) { bbox->minx = MIN(bbox->minx, poly[i].x); bbox->maxx = MAX(bbox->maxx, poly[i].x); bbox->miny = MIN(bbox->miny, poly[i].y); bbox->maxy = MAX(bbox->maxy, poly[i].y); } } static RoadMapGuiPoint get_metrics(RoadMapGuiPoint *p, RoadMapGuiRect *rect, int ox, int oy, int angle, RoadMapGuiRect *bbox) { RoadMapGuiPoint q; int x1=0, y1=0; RoadMapGuiPoint poly[4]; int w, h; int buffer = 0; int lines = 2; w = rect->maxx - rect->minx; h = rect->maxy - rect->miny; /* position CC */ x1 = -(int)(w/2.0) + ox; y1 = (int)(h/2.0) + oy; q.x = x1 - rect->minx; q.y = rect->miny - y1; roadmap_math_rotate_point (&q, p, angle); poly[0].x = x1 - buffer; /* ll */ poly[0].y = -(y1 + buffer); roadmap_math_rotate_point (&poly[0], p, angle); poly[1].x = x1 - buffer; /* ul */ poly[1].y = -(y1 -h - buffer); roadmap_math_rotate_point (&poly[1], p, angle); poly[2].x = x1 + w + buffer; /* ur */ poly[2].y = -(y1 -h - buffer); roadmap_math_rotate_point (&poly[2], p, angle); poly[3].x = x1 + w + buffer; /* lr */ poly[3].y = -(y1 + buffer); roadmap_math_rotate_point (&poly[3], p, angle); lines = 4; /* roadmap_canvas_draw_multiple_lines(1, &lines, poly); */ compute_bbox(poly, bbox); return q; } int roadmap_label_add (const RoadMapGuiPoint *point, int angle, int featuresize, const PluginLine *line) { labelCacheMemberObj *cachePtr; if (RoadMapLabelCacheFull) return -1; if (featuresize < roadmap_config_get_integer (&RoadMapConfigMinFeatureSize)) { return -1; } if(RoadMapLabelCache.numlabels == MAX_LABELS) { roadmap_log (ROADMAP_WARNING, "Too many labels on screen."); RoadMapLabelCacheFull = 1; return -1; } cachePtr = &(RoadMapLabelCache.labels[RoadMapLabelCache.numlabels]); cachePtr->featuresize = featuresize; cachePtr->line = *line; cachePtr->angle = angle; cachePtr->point = *point; cachePtr->status = 0; RoadMapLabelCache.numlabels++; return 0; } int roadmap_label_draw_cache (int angles) { int l; int i; int width; int ascent; int descent; RoadMapGuiPoint p; RoadMapGuiRect r; int label_offsetx = 0; int label_offsety = 0; const char *text; labelCacheMemberObj *cachePtr=NULL; roadmap_canvas_select_pen (RoadMapLabelPen); for(l=0; l<RoadMapLabelCache.numlabels; l++) { PluginStreetProperties properties; cachePtr = &(RoadMapLabelCache.labels[l]); roadmap_plugin_get_street_properties (&cachePtr->line, &properties); if (!properties.street || !*properties.street) { continue; } text = properties.street; cachePtr->street = properties.plugin_street; roadmap_canvas_get_text_extents(text, -1, &width, &ascent, &descent); r.minx = 0; r.maxx=width+1; r.miny = 0; r.maxy = ascent + descent + 1; /* label_offsety += MS_NINT(((bbox[5] + bbox[1]) + size) / 2); label_offsetx += MS_NINT(bbox[0] / 2); */ /* text is too long for this feature */ if ((width >> 2)> cachePtr->featuresize) { continue; } cachePtr->status = 1; /* assume label *can* be drawn */ /* The stored point is not screen orieneted, rotate is needed */ roadmap_math_rotate_coordinates (1, &cachePtr->point); if (angles) { cachePtr->angle += roadmap_math_get_orientation (); while (cachePtr->angle > 360) cachePtr->angle -= 360; while (cachePtr->angle < 0) cachePtr->angle += 360; if (cachePtr->angle >= 180) cachePtr->angle -= 180; cachePtr->angle -= 90; p = get_metrics (&(cachePtr->point), &r, label_offsetx, label_offsety, cachePtr->angle, &cachePtr->bbox); } else { /* Text will be horizontal, so bypass a lot of math. * Compensate for eventual centering of text. */ p = cachePtr->point; cachePtr->bbox.minx = r.minx + p.x - (r.maxx - r.minx)/2; cachePtr->bbox.maxx = r.maxx + p.x - (r.maxx - r.minx)/2; cachePtr->bbox.miny = r.miny + p.y - (r.maxy - r.miny)/2; cachePtr->bbox.maxy = r.maxy + p.y - (r.maxy - r.miny)/2; } for(i=0; i<l; i++) { /* compare against rendered label */ if(RoadMapLabelCache.labels[i].status == 1) { /* compare bounding polygons and check for duplicates */ /* MIN_DISTANCE */ if(roadmap_plugin_same_street(&cachePtr->street, &RoadMapLabelCache.labels[i].street)) { /* label is a duplicate */ cachePtr->status = 0; break; } if(rect_overlap (&RoadMapLabelCache.labels[i].bbox, &cachePtr->bbox)) { cachePtr->status = 0; break; } } } /* imagePolyline(img, cachePtr->poly, 1, 0, 0); */ if(!cachePtr->status) continue; /* next label */ roadmap_canvas_draw_string_angle (&p, &cachePtr->point, cachePtr->angle, text); } /* next label */ RoadMapLabelCache.numlabels = 0; RoadMapLabelCacheFull = 0; return 0; } int roadmap_label_activate (void) { RoadMapLabelPen = roadmap_canvas_create_pen ("labels.main"); roadmap_canvas_set_foreground (roadmap_config_get (&RoadMapConfigLabelsColor)); return 0; } int roadmap_label_initialize (void) { roadmap_config_declare ("preferences", &RoadMapConfigMinFeatureSize, "25"); roadmap_config_declare ("preferences", &RoadMapConfigLabelsColor, "#000000"); return 0; } Index: roadmap_screen.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_screen.c,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** roadmap_screen.c 20 Jun 2006 16:17:36 -0000 1.61 --- roadmap_screen.c 26 Jun 2006 19:59:53 -0000 1.62 *************** *** 53,63 **** --- 53,71 ---- #include "roadmap_landmark.h" #include "roadmap_canvas.h" + #include "roadmap_state.h" #include "roadmap_pointer.h" #include "roadmap_display.h" + #include "roadmap_label.h" #include "roadmap_plugin.h" #include "roadmap_factory.h" [...1041 lines suppressed...] + roadmap_state_add ("orientation_mode", + &roadmap_screen_get_orientation_mode); + roadmap_state_monitor (&roadmap_screen_repaint); } *************** *** 1395,1398 **** --- 1469,1474 ---- RoadMapScreenInitialized = 1; + roadmap_layer_initialize(); + RoadMapScreenDeltaX = roadmap_config_get_integer (&RoadMapConfigDeltaX); RoadMapScreenDeltaY = roadmap_config_get_integer (&RoadMapConfigDeltaY); *************** *** 1428,1430 **** } } - --- 1504,1505 ---- Index: roadmap_preferences.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_preferences.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** roadmap_preferences.c 3 Dec 2005 03:28:39 -0000 1.9 --- roadmap_preferences.c 26 Jun 2006 19:59:53 -0000 1.10 *************** *** 75,78 **** --- 75,79 ---- roadmap_dialog_hide (name); + roadmap_screen_redraw (); } *************** *** 96,101 **** } ! roadmap_dialog_hide (name); ! roadmap_screen_redraw (); } --- 97,101 ---- } ! roadmap_preferences_cancel (name, data); } |
From: Paul F. <pg...@us...> - 2006-06-26 19:58:24
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13711 Modified Files: roadmap_pointer.c Log Message: trim trailing whitespace Index: roadmap_pointer.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_pointer.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** roadmap_pointer.c 20 Nov 2005 00:11:15 -0000 1.7 --- roadmap_pointer.c 26 Jun 2006 19:58:09 -0000 1.8 *************** *** 98,106 **** is_drag_flow_control_on = 0; } ! static void roadmap_pointer_button_pressed (int button, RoadMapGuiPoint *point) { ! is_button_down = 1; last_pointer_point = *point; if (button == 1) { --- 98,106 ---- is_drag_flow_control_on = 0; } ! static void roadmap_pointer_button_pressed (int button, RoadMapGuiPoint *point) { ! is_button_down = 1; last_pointer_point = *point; if (button == 1) { *************** *** 113,117 **** static void roadmap_pointer_button_released (int button, RoadMapGuiPoint *point) { ! if (is_dragging) { --- 113,117 ---- static void roadmap_pointer_button_released (int button, RoadMapGuiPoint *point) { ! if (is_dragging) { *************** *** 148,151 **** --- 148,152 ---- (abs(point->y - last_pointer_point.y) <= mindrag)) return; + roadmap_main_remove_periodic(roadmap_pointer_button_timeout); RoadMapPointerDragStart(&last_pointer_point); |
From: Paul F. <pg...@us...> - 2006-06-26 19:55:37
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv12237 Modified Files: roadmap_trip.c Log Message: avoid floating declarations for older compilers, for now. Index: roadmap_trip.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_trip.c,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** roadmap_trip.c 5 May 2006 19:45:53 -0000 1.46 --- roadmap_trip.c 26 Jun 2006 19:55:33 -0000 1.47 *************** *** 1254,1258 **** RoadMapPosition position; ! roadmap_adjust_position (gps_position, &position); --- 1254,1259 ---- RoadMapPosition position; ! RoadMapGuiPoint guipoint1; ! RoadMapGuiPoint guipoint2; roadmap_adjust_position (gps_position, &position); *************** *** 1260,1265 **** * moved in a visible fashion. */ ! RoadMapGuiPoint guipoint1; ! RoadMapGuiPoint guipoint2; if (RoadMapTripGps->map.latitude != position.latitude || --- 1261,1265 ---- * moved in a visible fashion. */ ! if (RoadMapTripGps->map.latitude != position.latitude || |
From: Paul F. <pg...@us...> - 2006-06-26 19:54:27
|
Update of /cvsroot/roadmap/roadmap/src/gtk2 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11538/gtk2 Added Files: roadmap_canvas_agg.cpp Log Message: gtk2 interface to agg --- NEW FILE: roadmap_canvas_agg.cpp --- /* roadmap_canvas.c - manage the canvas that is used to draw the map. * * LICENSE: * * Copyright 2002 Pascal F. Martin * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * See roadmap_canvas.h. */ #include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <wchar.h> #include <agg_rendering_buffer.h> #include <agg_curves.h> #include <agg_conv_stroke.h> #include "util/agg_color_conv_rgb8.h" #include <agg_conv_contour.h> #include <agg_conv_transform.h> #include <agg_rasterizer_scanline_aa.h> #include <agg_rasterizer_outline_aa.h> #include <agg_rasterizer_outline.h> #include <agg_renderer_primitives.h> #include <agg_renderer_scanline.h> #include <agg_scanline_p.h> #include <agg_renderer_outline_aa.h> #include <agg_pixfmt_rgb.h> #include <agg_pixfmt_rgb_packed.h> #include "agg_font_freetype.h" #ifdef USE_FRIBIDI #include <fribidi.h> #define MAX_STR_LEN 65000 #endif extern "C" { #include "roadmap.h" #include "roadmap_config.h" #include "roadmap_messagebox.h" #include "roadmap_path.h" #include "roadmap_canvas.h" #include "roadmap_gtkcanvas.h" } #include "roadmap_canvas_agg.h" #define GetRValue(x) x.red #define GetGValue(x) x.green #define GetBValue(x) x.blue static GtkWidget *RoadMapDrawingArea; static GdkImage *RoadMapDrawingBuffer; int roadmap_canvas_agg_to_wchar (const char *text, wchar_t *output, int size) { int length = mbstowcs(output, text, size - 1); output[length] = 0; return length; } agg::rgba8 roadmap_canvas_agg_parse_color (const char *color) { GdkColor native_color; if (*color == '#') { int r, g, b, a; int count; count = sscanf(color, "#%2x%2x%2x%2x", &r, &g, &b, &a); if (count == 4) { return agg::rgba8(r, g, b, a); } else { return agg::rgba8(r, g, b); } } gdk_color_parse (color, &native_color); gdk_color_alloc (gdk_colormap_get_system(), &native_color); return agg::rgba8(GetRValue(native_color), GetGValue(native_color), GetBValue(native_color)); } RoadMapImage roadmap_canvas_agg_load_image (const char *path, const char *file_name) { char *full_name = roadmap_path_join (path, file_name); GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file(full_name, NULL); free (full_name); if (pixbuf == NULL) { return NULL; } if (gdk_pixbuf_get_colorspace (pixbuf) != GDK_COLORSPACE_RGB) { g_object_unref (pixbuf); return NULL; } // int n_channels = gdk_pixbuf_get_n_channels (pixbuf); // int bbs = gdk_pixbuf_get_bits_per_sample (pixbuf); int width = gdk_pixbuf_get_width (pixbuf); int height = gdk_pixbuf_get_height (pixbuf); unsigned char *buf = (unsigned char *)malloc (width*height*4); agg::rendering_buffer tmp_rbuf (gdk_pixbuf_get_pixels (pixbuf), width, height, gdk_pixbuf_get_rowstride (pixbuf)); agg::pixfmt_rgb24 tmp_pixfmt (tmp_rbuf); RoadMapImage image = new roadmap_canvas_image(); image->rbuf.attach (buf, width, height, width * 4); agg::color_conv(&image->rbuf, &tmp_rbuf, agg::color_conv_rgb24_to_rgba32()); g_object_unref (pixbuf); return image; } static gint roadmap_canvas_configure (GtkWidget *widget, GdkEventConfigure *event) { static GdkPixmap *tmp_buf; if (tmp_buf != NULL) { gdk_pixmap_unref (tmp_buf); } tmp_buf = gdk_pixmap_new (widget->window, widget->allocation.width, widget->allocation.height, -1); if (RoadMapDrawingBuffer != NULL) { gdk_image_unref (RoadMapDrawingBuffer); } RoadMapDrawingBuffer = gdk_drawable_get_image (tmp_buf, 0, 0, widget->allocation.width, widget->allocation.height); if (RoadMapDrawingBuffer->visual->type != GDK_VISUAL_TRUE_COLOR) { exit(-1); } roadmap_canvas_agg_configure ((unsigned char*)RoadMapDrawingBuffer->mem, RoadMapDrawingBuffer->width, RoadMapDrawingBuffer->height, RoadMapDrawingBuffer->bpl); (*RoadMapCanvasConfigure) (); return TRUE; } static gint roadmap_canvas_expose (GtkWidget *widget, GdkEventExpose *event) { gdk_draw_image (widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], RoadMapDrawingBuffer, event->area.x, event->area.y, event->area.x, event->area.y, event->area.width, event->area.height); return FALSE; } static gint roadmap_canvas_mouse_event (GtkWidget *w, GdkEventButton *event, gpointer data) { RoadMapGuiPoint point; point.x = (short)event->x; point.y = (short)event->y; switch ((int) data) { case 1: (*RoadMapCanvasMouseButtonPressed) (event->button, &point); break; case 2: (*RoadMapCanvasMouseButtonReleased) (event->button, &point); break; case 3: (*RoadMapCanvasMouseMoved) (event->button, &point); break; } return FALSE; } void roadmap_canvas_refresh (void) { GdkRectangle update; update.x = 0; update.y = 0; update.width = RoadMapDrawingArea->allocation.width; update.height = RoadMapDrawingArea->allocation.height; gtk_widget_queue_draw_area (RoadMapDrawingArea, 0, 0, RoadMapDrawingArea->allocation.width, RoadMapDrawingArea->allocation.height); } GtkWidget *roadmap_canvas_new (void) { RoadMapDrawingArea = gtk_drawing_area_new (); gtk_widget_set_double_buffered (RoadMapDrawingArea, FALSE); gtk_widget_set_events (RoadMapDrawingArea, GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK|GDK_POINTER_MOTION_MASK); g_signal_connect (RoadMapDrawingArea, "expose_event", (GCallback) roadmap_canvas_expose, NULL); g_signal_connect (RoadMapDrawingArea, "configure_event", (GCallback) roadmap_canvas_configure, NULL); g_signal_connect (RoadMapDrawingArea, "button_press_event", (GCallback) roadmap_canvas_mouse_event, (gpointer)1); g_signal_connect (RoadMapDrawingArea, "button_release_event", (GCallback) roadmap_canvas_mouse_event, (gpointer)2); g_signal_connect (RoadMapDrawingArea, "motion_notify_event", (GCallback) roadmap_canvas_mouse_event, (gpointer)3); return RoadMapDrawingArea; } |
From: Paul F. <pg...@us...> - 2006-06-26 19:54:14
|
Update of /cvsroot/roadmap/roadmap/src/win32 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11035/win32 Modified Files: roadmap_canvas.c Log Message: api changes due to introduction of agg (though these files don't use agg) Index: roadmap_canvas.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/win32/roadmap_canvas.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** roadmap_canvas.c 20 Nov 2005 00:09:25 -0000 1.5 --- roadmap_canvas.c 26 Jun 2006 19:54:01 -0000 1.6 *************** *** 83,88 **** ! void roadmap_canvas_get_text_extents (const char *text, int *width, ! int *ascent, int *descent) { TEXTMETRIC metric; --- 83,88 ---- ! void roadmap_canvas_get_text_extents (const char *text, int size, ! int *width, int *ascent, int *descent) { TEXTMETRIC metric; *************** *** 98,104 **** ! void roadmap_canvas_select_pen (RoadMapPen pen) { HPEN old; CurrentPen = pen; --- 98,105 ---- ! RoadMapPen roadmap_canvas_select_pen (RoadMapPen pen) { { HPEN old; + RoadMapPen old_pen = CurrentPen; CurrentPen = pen; *************** *** 109,113 **** if (OldHPen == NULL) OldHPen = old; else DeleteObject(old); ! } --- 110,115 ---- if (OldHPen == NULL) OldHPen = old; else DeleteObject(old); ! ! return old_pen; } *************** *** 207,211 **** roadmap_canvas_get_text_extents ! (text, &text_width, &text_ascent, &text_descent); text_height = text_ascent + text_descent; --- 209,213 ---- roadmap_canvas_get_text_extents ! (text, -1, &text_width, &text_ascent, &text_descent); text_height = text_ascent + text_descent; *************** *** 253,256 **** --- 255,266 ---- } + void roadmap_canvas_draw_string_angle (RoadMapGuiPoint *position, + RoadMapGuiPoint *center, + int angle, const char *text) + { + /* no angle possible, currently. at least try and center the text */ + roadmap_canvas_draw_string (center, ROADMAP_CANVAS_CENTER, text); + } + void roadmap_canvas_draw_multiple_points (int count, RoadMapGuiPoint *points) *************** *** 266,270 **** void roadmap_canvas_draw_multiple_lines (int count, int *lines, ! RoadMapGuiPoint *points) { int i; --- 276,280 ---- void roadmap_canvas_draw_multiple_lines (int count, int *lines, ! RoadMapGuiPoint *points, int fast_draw) { int i; *************** *** 295,299 **** void roadmap_canvas_draw_multiple_polygons (int count, int *polygons, ! RoadMapGuiPoint *points, int filled) { int i; --- 305,309 ---- void roadmap_canvas_draw_multiple_polygons (int count, int *polygons, ! RoadMapGuiPoint *points, int filled, int fast_draw) { int i; *************** *** 333,337 **** void roadmap_canvas_draw_multiple_circles (int count, ! RoadMapGuiPoint *centers, int *radius, int filled) { int i; --- 343,348 ---- void roadmap_canvas_draw_multiple_circles (int count, ! RoadMapGuiPoint *centers, int *radius, ! int filled, int fast_draw) { int i; |
From: Paul F. <pg...@us...> - 2006-06-26 19:54:07
|
Update of /cvsroot/roadmap/roadmap/src/gtk In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11035/gtk Modified Files: roadmap_canvas.c Log Message: api changes due to introduction of agg (though these files don't use agg) Index: roadmap_canvas.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk/roadmap_canvas.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** roadmap_canvas.c 19 Nov 2005 23:08:19 -0000 1.8 --- roadmap_canvas.c 26 Jun 2006 19:54:01 -0000 1.9 *************** *** 81,85 **** void roadmap_canvas_get_text_extents ! (const char *text, int *width, int *ascent, int *descent) { static int RoadMapCanvasAscent = 0; --- 81,85 ---- void roadmap_canvas_get_text_extents ! (const char *text, int size, int *width, int *ascent, int *descent) { static int RoadMapCanvasAscent = 0; *************** *** 116,122 **** ! void roadmap_canvas_select_pen (RoadMapPen pen) { RoadMapGc = pen->gc; } --- 116,127 ---- ! RoadMapPen roadmap_canvas_select_pen (RoadMapPen pen) { + static RoadMapPen CurrentPen; + + RoadMapPen old_pen = CurrentPen; + CurrentPen = pen; RoadMapGc = pen->gc; + return old_pen; } *************** *** 201,205 **** roadmap_canvas_get_text_extents ! (text, &text_width, &text_ascent, &text_descent); switch (corner) { --- 206,210 ---- roadmap_canvas_get_text_extents ! (text, -1, &text_width, &text_ascent, &text_descent); switch (corner) { *************** *** 238,241 **** --- 243,254 ---- } + void roadmap_canvas_draw_string_angle (RoadMapGuiPoint *position, + RoadMapGuiPoint *center, + int angle, const char *text) + { + /* no angle possible, currently. at least try and center the text */ + roadmap_canvas_draw_string (center, ROADMAP_CANVAS_CENTER, text); + } + void roadmap_canvas_draw_multiple_points (int count, RoadMapGuiPoint *points) { *************** *** 247,251 **** void roadmap_canvas_draw_multiple_lines ! (int count, int *lines, RoadMapGuiPoint *points) { int i; --- 260,264 ---- void roadmap_canvas_draw_multiple_lines ! (int count, int *lines, RoadMapGuiPoint *points, int fast_draw) { int i; *************** *** 265,269 **** void roadmap_canvas_draw_multiple_polygons ! (int count, int *polygons, RoadMapGuiPoint *points, int filled) { int i; --- 278,283 ---- void roadmap_canvas_draw_multiple_polygons ! (int count, int *polygons, RoadMapGuiPoint *points, int filled, ! int fast_draw) { int i; *************** *** 283,287 **** void roadmap_canvas_draw_multiple_circles ! (int count, RoadMapGuiPoint *centers, int *radius, int filled) { int i; --- 297,302 ---- void roadmap_canvas_draw_multiple_circles ! (int count, RoadMapGuiPoint *centers, int *radius, int filled, ! int fast_draw) { int i; |
From: Paul F. <pg...@us...> - 2006-06-26 19:54:07
|
Update of /cvsroot/roadmap/roadmap/src/qt In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11035/qt Modified Files: roadmap_canvas.cc Log Message: api changes due to introduction of agg (though these files don't use agg) Index: roadmap_canvas.cc =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/qt/roadmap_canvas.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** roadmap_canvas.cc 20 Nov 2005 00:06:26 -0000 1.7 --- roadmap_canvas.cc 26 Jun 2006 19:54:02 -0000 1.8 *************** *** 83,88 **** } ! void roadmap_canvas_get_text_extents(const char *text, int *width, ! int *ascent, int *descent) { roadMapCanvas->getTextExtents(text, width, ascent, descent); --- 83,88 ---- } ! void roadmap_canvas_get_text_extents(const char *text, int size, ! int *width, int *ascent, int *descent) { roadMapCanvas->getTextExtents(text, width, ascent, descent); *************** *** 93,98 **** } ! void roadmap_canvas_select_pen (RoadMapPen pen) { roadMapCanvas->selectPen(pen); } --- 93,104 ---- } ! RoadMapPen roadmap_canvas_select_pen (RoadMapPen pen) { ! ! static RoadMapPen CurrentPen; ! ! RoadMapPen old_pen = CurrentPen; ! CurrentPen = pen; roadMapCanvas->selectPen(pen); + return old_pen; } *************** *** 115,118 **** --- 121,132 ---- } + void roadmap_canvas_draw_string_angle (RoadMapGuiPoint *position, + RoadMapGuiPoint *center, + int angle, const char *text) + { + /* no angle possible, currently. at least try and center the text */ + roadmap_canvas_draw_string (center, ROADMAP_CANVAS_CENTER, text); + } + void roadmap_canvas_draw_multiple_points (int count, RoadMapGuiPoint *points) { roadMapCanvas->drawMultiplePoints(count, points); *************** *** 120,124 **** void roadmap_canvas_draw_multiple_lines(int count, int *lines, ! RoadMapGuiPoint *points) { roadMapCanvas->drawMultipleLines(count, lines, points); --- 134,138 ---- void roadmap_canvas_draw_multiple_lines(int count, int *lines, ! RoadMapGuiPoint *points, int fast_draw) { roadMapCanvas->drawMultipleLines(count, lines, points); *************** *** 126,130 **** void roadmap_canvas_draw_multiple_polygons(int count, int *polygons, ! RoadMapGuiPoint *points, int filled) { roadMapCanvas->drawMultiplePolygons(count, polygons, points, filled); --- 140,144 ---- void roadmap_canvas_draw_multiple_polygons(int count, int *polygons, ! RoadMapGuiPoint *points, int filled, int fast_draw) { roadMapCanvas->drawMultiplePolygons(count, polygons, points, filled); *************** *** 132,136 **** void roadmap_canvas_draw_multiple_circles(int count, RoadMapGuiPoint *centers, ! int *radius, int filled) { roadMapCanvas->drawMultipleCircles(count, centers, radius, filled); --- 146,150 ---- void roadmap_canvas_draw_multiple_circles(int count, RoadMapGuiPoint *centers, ! int *radius, int filled, int fast_draw) { roadMapCanvas->drawMultipleCircles(count, centers, radius, filled); |
From: Paul F. <pg...@us...> - 2006-06-26 19:54:07
|
Update of /cvsroot/roadmap/roadmap/src/gtk2 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11035/gtk2 Modified Files: roadmap_canvas.c Log Message: api changes due to introduction of agg (though these files don't use agg) Index: roadmap_canvas.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk2/roadmap_canvas.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** roadmap_canvas.c 19 Nov 2005 23:07:45 -0000 1.11 --- roadmap_canvas.c 26 Jun 2006 19:54:01 -0000 1.12 *************** *** 99,103 **** void roadmap_canvas_get_text_extents ! (const char *text, int *width, int *ascent, int *descent) { PangoRectangle rectangle; --- 99,103 ---- void roadmap_canvas_get_text_extents ! (const char *text, int size, int *width, int *ascent, int *descent) { PangoRectangle rectangle; *************** *** 118,124 **** ! void roadmap_canvas_select_pen (RoadMapPen pen) { RoadMapGc = pen->gc; } --- 118,129 ---- ! RoadMapPen roadmap_canvas_select_pen (RoadMapPen pen) { + static RoadMapPen CurrentPen; + + RoadMapPen old_pen = CurrentPen; + CurrentPen = pen; RoadMapGc = pen->gc; + return old_pen; } *************** *** 203,207 **** roadmap_canvas_get_text_extents ! (text, &text_width, &text_ascent, &text_descent); text_height = text_ascent + text_descent; --- 208,212 ---- roadmap_canvas_get_text_extents ! (text, -1, &text_width, &text_ascent, &text_descent); text_height = text_ascent + text_descent; *************** *** 241,244 **** --- 246,256 ---- } + void roadmap_canvas_draw_string_angle (RoadMapGuiPoint *position, + RoadMapGuiPoint *center, + int angle, const char *text) + { + /* no angle possible, currently. at least try and center the text */ + roadmap_canvas_draw_string (center, ROADMAP_CANVAS_CENTER, text); + } void roadmap_canvas_draw_multiple_points (int count, RoadMapGuiPoint *points) { *************** *** 258,262 **** void roadmap_canvas_draw_multiple_lines ! (int count, int *lines, RoadMapGuiPoint *points) { int i; --- 270,274 ---- void roadmap_canvas_draw_multiple_lines ! (int count, int *lines, RoadMapGuiPoint *points, int fast_draw) { int i; *************** *** 288,292 **** void roadmap_canvas_draw_multiple_polygons ! (int count, int *polygons, RoadMapGuiPoint *points, int filled) { int i; --- 300,305 ---- void roadmap_canvas_draw_multiple_polygons ! (int count, int *polygons, RoadMapGuiPoint *points, int filled, ! int fast_draw) { int i; *************** *** 319,323 **** void roadmap_canvas_draw_multiple_circles ! (int count, RoadMapGuiPoint *centers, int *radius, int filled) { int i; --- 332,337 ---- void roadmap_canvas_draw_multiple_circles ! (int count, RoadMapGuiPoint *centers, int *radius, int filled, ! int fast_draw) { int i; |
From: Paul F. <pg...@us...> - 2006-06-26 19:52:10
|
Update of /cvsroot/roadmap/roadmap/src/agg_support In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv9539/agg_support Added Files: agg_font_freetype.cpp agg_font_freetype.h roadmap_canvas.cpp roadmap_canvas_agg.h Log Message: interfaces to the agg library, when its in use --- NEW FILE: agg_font_freetype.cpp --- //---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mc...@an... // mcs...@ya... // http://www.antigrain.com //---------------------------------------------------------------------------- #include <stdio.h> #include "agg_font_freetype.h" #include "agg_bitset_iterator.h" [...1108 lines suppressed...] double dy = int26p6_to_dbl(delta.y); if(m_glyph_rendering == glyph_ren_outline || m_glyph_rendering == glyph_ren_agg_mono || m_glyph_rendering == glyph_ren_agg_gray8) { m_affine.transform_2x2(&dx, &dy); } *x += dx; *y += dy; return true; } return false; } } --- NEW FILE: agg_font_freetype.h --- //---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mc...@an... // mcs...@ya... // http://www.antigrain.com //---------------------------------------------------------------------------- // // See implementation agg_font_freetype.cpp // //---------------------------------------------------------------------------- #ifndef AGG_FONT_FREETYPE_INCLUDED #define AGG_FONT_FREETYPE_INCLUDED #include <ft2build.h> #include FT_FREETYPE_H #include "agg_scanline_storage_aa.h" #include "agg_scanline_storage_bin.h" #include "agg_scanline_u.h" #include "agg_scanline_bin.h" #include "agg_path_storage_integer.h" #include "agg_rasterizer_scanline_aa.h" #include "agg_conv_curve.h" #include "agg_font_cache_manager.h" #include "agg_trans_affine.h" namespace agg { //-----------------------------------------------font_engine_freetype_base class font_engine_freetype_base { public: //-------------------------------------------------------------------- typedef serialized_scanlines_adaptor_aa<int8u> gray8_adaptor_type; typedef serialized_scanlines_adaptor_bin mono_adaptor_type; typedef scanline_storage_aa8 scanlines_aa_type; typedef scanline_storage_bin scanlines_bin_type; //-------------------------------------------------------------------- ~font_engine_freetype_base(); font_engine_freetype_base(bool flag32, unsigned max_faces = 32); // Set font parameters //-------------------------------------------------------------------- void resolution(unsigned dpi); bool load_font(const char* font_name, unsigned face_index, glyph_rendering ren_type, const char* font_mem = 0, const long font_mem_size = 0); bool attach(const char* file_name); bool char_map(FT_Encoding map); bool height(double h); bool width(double w); void hinting(bool h); void flip_y(bool f); void transform(const trans_affine& affine); // Set Gamma //-------------------------------------------------------------------- template<class GammaF> void gamma(const GammaF& f) { m_rasterizer.gamma(f); } // Accessors //-------------------------------------------------------------------- int last_error() const { return m_last_error; } unsigned resolution() const { return m_resolution; } const char* name() const { return m_name; } unsigned num_faces() const; FT_Encoding char_map() const { return m_char_map; } double height() const { return double(m_height) / 64.0; } double width() const { return double(m_width) / 64.0; } double ascender() const; double descender() const; bool hinting() const { return m_hinting; } bool flip_y() const { return m_flip_y; } // Interface mandatory to implement for font_cache_manager //-------------------------------------------------------------------- const char* font_signature() const { return m_signature; } int change_stamp() const { return m_change_stamp; } bool prepare_glyph(unsigned glyph_code); unsigned glyph_index() const { return m_glyph_index; } unsigned data_size() const { return m_data_size; } glyph_data_type data_type() const { return m_data_type; } const rect_i& bounds() const { return m_bounds; } double advance_x() const { return m_advance_x; } double advance_y() const { return m_advance_y; } void write_glyph_to(int8u* data) const; bool add_kerning(unsigned first, unsigned second, double* x, double* y); private: font_engine_freetype_base(const font_engine_freetype_base&); const font_engine_freetype_base& operator = (const font_engine_freetype_base&); void update_char_size(); void update_signature(); int find_face(const char* face_name) const; bool m_flag32; int m_change_stamp; int m_last_error; char* m_name; unsigned m_name_len; unsigned m_face_index; FT_Encoding m_char_map; char* m_signature; unsigned m_height; unsigned m_width; bool m_hinting; bool m_flip_y; bool m_library_initialized; FT_Library m_library; // handle to library FT_Face* m_faces; // A pool of font faces char** m_face_names; unsigned m_num_faces; unsigned m_max_faces; FT_Face m_cur_face; // handle to the current face object int m_resolution; glyph_rendering m_glyph_rendering; unsigned m_glyph_index; unsigned m_data_size; glyph_data_type m_data_type; rect_i m_bounds; double m_advance_x; double m_advance_y; trans_affine m_affine; path_storage_integer<int16, 6> m_path16; path_storage_integer<int32, 6> m_path32; conv_curve<path_storage_integer<int16, 6> > m_curves16; conv_curve<path_storage_integer<int32, 6> > m_curves32; scanline_u8 m_scanline_aa; scanline_bin m_scanline_bin; scanlines_aa_type m_scanlines_aa; scanlines_bin_type m_scanlines_bin; rasterizer_scanline_aa<> m_rasterizer; }; //------------------------------------------------font_engine_freetype_int16 // This class uses values of type int16 (10.6 format) for the vector cache. // The vector cache is compact, but when rendering glyphs of height // more that 200 there integer overflow can occur. // class font_engine_freetype_int16 : public font_engine_freetype_base { public: typedef serialized_integer_path_adaptor<int16, 6> path_adaptor_type; typedef font_engine_freetype_base::gray8_adaptor_type gray8_adaptor_type; typedef font_engine_freetype_base::mono_adaptor_type mono_adaptor_type; typedef font_engine_freetype_base::scanlines_aa_type scanlines_aa_type; typedef font_engine_freetype_base::scanlines_bin_type scanlines_bin_type; font_engine_freetype_int16(unsigned max_faces = 32) : font_engine_freetype_base(false, max_faces) {} }; //------------------------------------------------font_engine_freetype_int32 // This class uses values of type int32 (26.6 format) for the vector cache. // The vector cache is twice larger than in font_engine_freetype_int16, // but it allows you to render glyphs of very large sizes. // class font_engine_freetype_int32 : public font_engine_freetype_base { public: typedef serialized_integer_path_adaptor<int32, 6> path_adaptor_type; typedef font_engine_freetype_base::gray8_adaptor_type gray8_adaptor_type; typedef font_engine_freetype_base::mono_adaptor_type mono_adaptor_type; typedef font_engine_freetype_base::scanlines_aa_type scanlines_aa_type; typedef font_engine_freetype_base::scanlines_bin_type scanlines_bin_type; font_engine_freetype_int32(unsigned max_faces = 32) : font_engine_freetype_base(true, max_faces) {} }; } #endif --- NEW FILE: roadmap_canvas.cpp --- /* roadmap_canvas.cpp - manage the canvas that is used to draw the map with agg * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * See roadmap_canvas.h. */ #ifdef WIN32_PROFILE #include <C:\Program Files\Windows CE Tools\Common\Platman\sdk\wce500\include\cecap.h> #endif #include <wchar.h> #include "agg_rendering_buffer.h" #include "agg_curves.h" #include "agg_conv_stroke.h" #include "agg_conv_contour.h" #include "agg_conv_transform.h" #include "agg_rasterizer_scanline_aa.h" #include "agg_rasterizer_outline_aa.h" #include "agg_rasterizer_outline.h" #include "agg_renderer_primitives.h" #include "agg_ellipse.h" #include "agg_renderer_scanline.h" #include "agg_scanline_p.h" #include "agg_renderer_outline_aa.h" #include "agg_pixfmt_rgb_packed.h" #include "agg_path_storage.h" #include "agg_font_freetype.h" #ifdef USE_FRIBIDI #include <fribidi.h> #define MAX_STR_LEN 65000 #endif extern "C" { #include "roadmap.h" #include "roadmap_types.h" #include "roadmap_gui.h" #include "roadmap_screen.h" #include "roadmap_canvas.h" #include "roadmap_messagebox.h" #include "roadmap_math.h" #include "roadmap_config.h" #include "roadmap_path.h" } #include "roadmap_canvas_agg.h" typedef agg::pixfmt_rgb565 pixfmt; typedef agg::renderer_base<pixfmt> renbase_type; typedef agg::renderer_primitives<renbase_type> renderer_pr; typedef agg::font_engine_freetype_int32 font_engine_type; typedef agg::font_cache_manager<font_engine_type> font_manager_type; agg::rendering_buffer agg_rbuf; static pixfmt agg_pixf(agg_rbuf); static agg::renderer_base<pixfmt> agg_renb; static agg::line_profile_aa profile(2, agg::gamma_none()); static agg::renderer_outline_aa<renbase_type> reno(agg_renb, profile); static agg::rasterizer_outline_aa< agg::renderer_outline_aa<renbase_type> > raso(reno); static agg::rasterizer_scanline_aa<> ras; static agg::scanline_p8 sl; static agg::renderer_scanline_aa_solid<agg::renderer_base<pixfmt> > ren_solid(agg_renb); static font_engine_type m_feng; static font_manager_type m_fman(m_feng); static font_engine_type m_image_feng; static font_manager_type m_image_fman(m_image_feng); static RoadMapConfigDescriptor RoadMapConfigFont = ROADMAP_CONFIG_ITEM("Labels", "FontName"); struct roadmap_canvas_pen { struct roadmap_canvas_pen *next; char *name; agg::rgba8 color; int thickness; }; static struct roadmap_canvas_pen *RoadMapPenList = NULL; static RoadMapPen CurrentPen; static int RoadMapCanvasFontLoaded = 0; /* The canvas callbacks: all callbacks are initialized to do-nothing * functions, so that we don't care checking if one has been setup. */ static void roadmap_canvas_ignore_mouse (int button, RoadMapGuiPoint *point) {} RoadMapCanvasMouseHandler RoadMapCanvasMouseButtonPressed = roadmap_canvas_ignore_mouse; RoadMapCanvasMouseHandler RoadMapCanvasMouseButtonReleased = roadmap_canvas_ignore_mouse; RoadMapCanvasMouseHandler RoadMapCanvasMouseMoved = roadmap_canvas_ignore_mouse; RoadMapCanvasMouseHandler RoadMapCanvasMouseScroll = roadmap_canvas_ignore_mouse; static void roadmap_canvas_ignore_configure (void) {} RoadMapCanvasConfigureHandler RoadMapCanvasConfigure = roadmap_canvas_ignore_configure; void roadmap_canvas_get_text_extents (const char *text, int size, int *width, int *ascent, int *descent) { *ascent = 0; *descent = 0; wchar_t wstr[255]; int length = roadmap_canvas_agg_to_wchar (text, wstr, 255); if (length <=0) { *width = 0; return; } double x = 0; double y = 0; const wchar_t* p = wstr; font_manager_type *fman; if (size == -1) { /* Use the regular font */ fman = &m_fman; } else { m_image_feng.height(size); m_image_feng.width(size); fman = &m_image_fman; } while(*p) { const agg::glyph_cache* glyph = fman->glyph(*p); if(glyph) { x += glyph->advance_x; y += glyph->advance_y; if (-glyph->bounds.y1 > *descent) *descent=-glyph->bounds.y1 - 1; } ++p; } *width = (int)x; } RoadMapPen roadmap_canvas_select_pen (RoadMapPen pen) { RoadMapPen old_pen = CurrentPen; dbg_time_start(DBG_TIME_SELECT_PEN); if (!CurrentPen || (pen->thickness != CurrentPen->thickness)) { profile.width(pen->thickness); } CurrentPen = pen; reno.color(pen->color); dbg_time_end(DBG_TIME_SELECT_PEN); return old_pen; } RoadMapPen roadmap_canvas_create_pen (const char *name) { struct roadmap_canvas_pen *pen; for (pen = RoadMapPenList; pen != NULL; pen = pen->next) { if (strcmp(pen->name, name) == 0) break; } if (pen == NULL) { pen = (struct roadmap_canvas_pen *) malloc (sizeof(struct roadmap_canvas_pen)); roadmap_check_allocated(pen); pen->name = strdup (name); pen->color = agg::rgba8(0, 0, 0); pen->thickness = 1; pen->next = RoadMapPenList; RoadMapPenList = pen; } roadmap_canvas_select_pen (pen); return pen; } void roadmap_canvas_set_foreground (const char *color) { if (!CurrentPen) return; CurrentPen->color = roadmap_canvas_agg_parse_color(color); roadmap_canvas_select_pen(CurrentPen); } int roadmap_canvas_get_thickness (RoadMapPen pen) { if (pen == NULL) return 0; return pen->thickness; } void roadmap_canvas_set_thickness (int thickness) { if (CurrentPen && (CurrentPen->thickness != thickness)) { CurrentPen->thickness = thickness; profile.width(thickness); } } void roadmap_canvas_set_opacity (int opacity) { if (!CurrentPen) return; CurrentPen->color.a = opacity; roadmap_canvas_select_pen(CurrentPen); } void roadmap_canvas_erase (void) { agg_renb.clear(CurrentPen->color); } void roadmap_canvas_draw_string (RoadMapGuiPoint *position, int corner, const char *text) { int x; int y; int text_width; int text_ascent; int text_descent; int text_height; roadmap_canvas_get_text_extents (text, -1, &text_width, &text_ascent, &text_descent); text_height = text_ascent + text_descent; switch (corner) { case ROADMAP_CANVAS_TOPLEFT: y = position->y; x = position->x; break; case ROADMAP_CANVAS_TOPRIGHT: y = position->y; x = position->x - text_width; break; case ROADMAP_CANVAS_BOTTOMRIGHT: y = position->y - text_height; x = position->x - text_width; break; case ROADMAP_CANVAS_BOTTOMLEFT: y = position->y - text_height; x = position->x; break; case ROADMAP_CANVAS_CENTER: y = position->y - (text_height / 2); x = position->x - (text_width / 2); break; default: return; } RoadMapGuiPoint start = {x, y+text_height}; roadmap_canvas_draw_string_angle (&start, position, 0, text); } void roadmap_canvas_draw_multiple_points (int count, RoadMapGuiPoint *points) { int i; for (i=0; i<count; i++) { agg_renb.copy_pixel(points[i].x, points[i].y, CurrentPen->color); } } void roadmap_canvas_draw_multiple_lines (int count, int *lines, RoadMapGuiPoint *points, int fast_draw) { int i; int count_of_points; dbg_time_start(DBG_TIME_DRAW_LINES); #ifdef WIN32_PROFILE ResumeCAPAll(); #endif //pgf fast_draw = 1; raso.round_cap(true); if (!fast_draw) { raso.line_join(agg::outline_miter_accurate_join); } // raso.accurate_join(true); agg::path_storage path; for (i = 0; i < count; ++i) { int first = 1; count_of_points = *lines; if (count_of_points < 2) continue; dbg_time_start(DBG_TIME_CREATE_PATH); for (int j=0; j<count_of_points; j++) { if (first) { first = 0; path.move_to(points->x, points->y); } else { path.line_to(points->x, points->y); } points++; } dbg_time_end(DBG_TIME_CREATE_PATH); dbg_time_start(DBG_TIME_ADD_PATH); if (fast_draw) { renderer_pr ren_pr(agg_renb); agg::rasterizer_outline<renderer_pr> ras_line(ren_pr); ren_pr.line_color(CurrentPen->color); ras_line.add_path(path); } else { raso.add_path(path); } path.remove_all (); dbg_time_end(DBG_TIME_ADD_PATH); lines += 1; } #ifdef WIN32_PROFILE SuspendCAPAll(); #endif dbg_time_end(DBG_TIME_DRAW_LINES); } void roadmap_canvas_draw_multiple_polygons (int count, int *polygons, RoadMapGuiPoint *points, int filled, int fast_draw) { int i; int count_of_points; agg::path_storage path; for (i = 0; i < count; ++i) { count_of_points = *polygons; int first = 1; for (int j=0; j<count_of_points; j++) { if (first) { first = 0; path.move_to(points->x, points->y); } else { path.line_to(points->x, points->y); } points++; } path.close_polygon(); if (filled) { ras.reset(); ras.add_path(path); ren_solid.color(CurrentPen->color); agg::render_scanlines( ras, sl, ren_solid); } else if (fast_draw) { renderer_pr ren_pr(agg_renb); agg::rasterizer_outline<renderer_pr> ras_line(ren_pr); ren_pr.line_color(CurrentPen->color); ras_line.add_path(path); } else { raso.add_path(path); } path.remove_all (); polygons += 1; } } void roadmap_canvas_draw_multiple_circles (int count, RoadMapGuiPoint *centers, int *radius, int filled, int fast_draw) { int i; agg::path_storage path; for (i = 0; i < count; ++i) { int r = radius[i]; int x = centers[i].x; int y = centers[i].y; agg::ellipse e( x, y, r, r); path.concat_path(e); if (filled) { ras.reset(); ras.add_path(path); ren_solid.color(CurrentPen->color); agg::render_scanlines( ras, sl, ren_solid); } else if (fast_draw) { renderer_pr ren_pr(agg_renb); agg::rasterizer_outline<renderer_pr> ras_line(ren_pr); ren_pr.line_color(CurrentPen->color); ras_line.add_path(path); } else { raso.add_path(path); } path.remove_all (); } } void roadmap_canvas_register_button_pressed_handler (RoadMapCanvasMouseHandler handler) { RoadMapCanvasMouseButtonPressed = handler; } void roadmap_canvas_register_button_released_handler (RoadMapCanvasMouseHandler handler) { RoadMapCanvasMouseButtonReleased = handler; } void roadmap_canvas_register_mouse_move_handler (RoadMapCanvasMouseHandler handler) { RoadMapCanvasMouseMoved = handler; } void roadmap_canvas_register_mouse_scroll_handler (RoadMapCanvasMouseHandler handler) { RoadMapCanvasMouseScroll = handler; } void roadmap_canvas_register_configure_handler (RoadMapCanvasConfigureHandler handler) { RoadMapCanvasConfigure = handler; } int roadmap_canvas_width (void) { return agg_renb.width(); } int roadmap_canvas_height (void) { return agg_renb.height(); } void roadmap_canvas_save_screenshot (const char* filename) { /* NOT IMPLEMENTED. */ } /* ** Use FRIBIDI to encode the string. ** The return value must be freed by the caller. */ #ifdef USE_FRIBIDI static wchar_t* bidi_string(wchar_t *logical) { FriBidiCharType base = FRIBIDI_TYPE_ON; size_t len; len = wcslen(logical); FriBidiChar *visual; FriBidiStrIndex *ltov, *vtol; FriBidiLevel *levels; FriBidiStrIndex new_len; fribidi_boolean log2vis; visual = (FriBidiChar *) malloc (sizeof (FriBidiChar) * (len + 1)); ltov = NULL; vtol = NULL; levels = NULL; /* Create a bidi string. */ log2vis = fribidi_log2vis ((FriBidiChar *)logical, len, &base, /* output */ visual, ltov, vtol, levels); if (!log2vis) { //msSetError(MS_IDENTERR, "Failed to create bidi string.", //"msGetFriBidiEncodedString()"); return NULL; } new_len = len; return (wchar_t *)visual; } #endif void roadmap_canvas_draw_string_angle (RoadMapGuiPoint *position, RoadMapGuiPoint *center, int angle, const char *text) { if (RoadMapCanvasFontLoaded != 1) return; dbg_time_start(DBG_TIME_TEXT_FULL); dbg_time_start(DBG_TIME_TEXT_CNV); wchar_t wstr[255]; int length = roadmap_canvas_agg_to_wchar (text, wstr, 255); if (length <=0) return; #ifdef USE_FRIBIDI wchar_t *bidi_text = bidi_string(wstr); const wchar_t* p = bidi_text; #else const wchar_t* p = wstr; #endif ren_solid.color(CurrentPen->color); dbg_time_end(DBG_TIME_TEXT_CNV); dbg_time_start(DBG_TIME_TEXT_LOAD); double x = 0; double y = 0; dbg_time_end(DBG_TIME_TEXT_LOAD); while(*p) { dbg_time_start(DBG_TIME_TEXT_ONE_LETTER); dbg_time_start(DBG_TIME_TEXT_GET_GLYPH); const agg::glyph_cache* glyph = m_fman.glyph(*p); dbg_time_end(DBG_TIME_TEXT_GET_GLYPH); if(glyph) { m_fman.init_embedded_adaptors(glyph, x, y); //agg::conv_curve<font_manager_type::path_adaptor_type> stroke(m_fman.path_adaptor()); agg::trans_affine mtx; if (abs(angle) > 5) { mtx *= agg::trans_affine_rotation(agg::deg2rad(angle)); } mtx *= agg::trans_affine_translation(position->x, position->y); agg::conv_transform<font_manager_type::path_adaptor_type> tr(m_fman.path_adaptor(), mtx); agg::conv_curve<agg::conv_transform<font_manager_type::path_adaptor_type> > fill(tr); //agg::conv_stroke< //agg::conv_curve<agg::conv_transform<font_manager_type::path_adaptor_type> > > //stroke(fill); //agg::conv_contour<agg::conv_transform<font_manager_type::path_adaptor_type> >contour(tr); //contour.width(2); //agg::conv_stroke< agg::conv_contour<agg::conv_transform<font_manager_type::path_adaptor_type> > > stroke(contour); //agg::conv_stroke< agg::conv_transform<font_manager_type::path_adaptor_type> > stroke(tr); dbg_time_start(DBG_TIME_TEXT_ONE_RAS); #ifdef WIN32_PROFILE ResumeCAPAll(); #endif ras.reset(); ras.add_path(tr); agg::render_scanlines(ras, sl, ren_solid); //ras.add_path(fill); //ras.add_path(stroke); //ren_solid.color(agg::rgba8(255, 255, 255)); //agg::render_scanlines(ras, sl, ren_solid); //ras.add_path(tr); //ren_solid.color(agg::rgba8(0, 0, 0)); //agg::render_scanlines(ras, sl, ren_solid); #ifdef WIN32_PROFILE SuspendCAPAll(); #endif dbg_time_end(DBG_TIME_TEXT_ONE_RAS); // increment pen position x += glyph->advance_x; y += glyph->advance_y; dbg_time_end(DBG_TIME_TEXT_ONE_LETTER); } ++p; } #ifdef USE_FRIBIDI free(bidi_text); #endif dbg_time_end(DBG_TIME_TEXT_FULL); } void roadmap_canvas_agg_configure (unsigned char *buf, int width, int height, int stride) { agg_rbuf.attach(buf, width, height, stride); agg_renb.attach(agg_pixf); agg_renb.reset_clipping(true); ras.clip_box(0, 0, agg_renb.width(), agg_renb.height()); agg::glyph_rendering gren = agg::glyph_ren_outline; agg::glyph_rendering image_gren = agg::glyph_ren_agg_gray8; roadmap_config_declare ("preferences", &RoadMapConfigFont, "font.ttf"); char font_file[255]; snprintf(font_file, sizeof(font_file), "%s/%s", roadmap_path_user(), roadmap_config_get (&RoadMapConfigFont)); if (!RoadMapCanvasFontLoaded) { if(m_feng.load_font(font_file, 0, gren) && m_image_feng.load_font(font_file, 0, image_gren)) { m_feng.hinting(true); m_feng.height(15); m_feng.width(15); m_feng.flip_y(true); m_image_feng.hinting(true); m_image_feng.flip_y(true); RoadMapCanvasFontLoaded = 1; } else { RoadMapCanvasFontLoaded = -1; char message[300]; snprintf(message, sizeof(message), "Can't load font: %s\n", font_file); roadmap_messagebox("Error", message); } } } RoadMapImage roadmap_canvas_load_image (const char *path, const char* file_name) { return roadmap_canvas_agg_load_image (path, file_name); } void roadmap_canvas_draw_image (RoadMapImage image, RoadMapGuiPoint *pos, int opacity, int mode) { if ((mode == IMAGE_SELECTED) || (opacity <= 0) || (opacity >= 255)) { opacity = 255; } agg_renb.blend_from(image->pixfmt, 0, pos->x, pos->y, opacity); if (mode == IMAGE_SELECTED) { RoadMapGuiPoint points[5] = { {pos->x, pos->y}, {pos->x + image->rbuf.width(), pos->y}, {pos->x + image->rbuf.width(), pos->y + image->rbuf.height()}, {pos->x, pos->y + image->rbuf.height()}, {pos->x, pos->y}}; int num_points = 5; roadmap_canvas_draw_multiple_lines (1, &num_points, points, 0); } } void roadmap_canvas_copy_image (RoadMapImage dst_image, const RoadMapGuiPoint *pos, const RoadMapGuiRect *rect, RoadMapImage src_image, int mode) { agg::renderer_base<agg::pixfmt_rgba32> renb(dst_image->pixfmt); agg::rect_i agg_rect; agg::rect_i *agg_rect_p = NULL; if (rect) { agg_rect.x1 = rect->minx; agg_rect.y1 = rect->miny; agg_rect.x2 = rect->maxx; agg_rect.y2 = rect->maxy; agg_rect_p = &agg_rect; } if (mode == CANVAS_COPY_NORMAL) { renb.copy_from(src_image->rbuf, agg_rect_p, pos->x, pos->y); } else { renb.blend_from(src_image->pixfmt, agg_rect_p, pos->x, pos->y, 255); } } int roadmap_canvas_image_width (const RoadMapImage image) { if (!image) return 0; return image->rbuf.width(); } int roadmap_canvas_image_height (const RoadMapImage image) { if (!image) return 0; return image->rbuf.height(); } void roadmap_canvas_draw_image_text (RoadMapImage image, const RoadMapGuiPoint *position, int size, const char *text) { if (RoadMapCanvasFontLoaded != 1) return; wchar_t wstr[255]; int length = roadmap_canvas_agg_to_wchar (text, wstr, 255); if (length <=0) return; #ifdef USE_FRIBIDI wchar_t *bidi_text = bidi_string(wstr); const wchar_t* p = bidi_text; #else const wchar_t* p = wstr; #endif ren_solid.color(CurrentPen->color); double x = position->x; double y = position->y + size - 7; agg::renderer_base<agg::pixfmt_rgba32> renb(image->pixfmt); agg::renderer_scanline_aa_solid< agg::renderer_base<agg::pixfmt_rgba32> > ren_solid (renb); ren_solid.color(agg::rgba8(0, 0, 0)); m_image_feng.height(size); m_image_feng.width(size); while(*p) { const agg::glyph_cache* glyph = m_image_fman.glyph(*p); if(glyph) { m_image_fman.init_embedded_adaptors(glyph, x, y); agg::render_scanlines(m_image_fman.gray8_adaptor(), m_image_fman.gray8_scanline(), ren_solid); // increment pen position x += glyph->advance_x; y += glyph->advance_y; } ++p; } #ifdef USE_FRIBIDI free(bidi_text); #endif } --- NEW FILE: roadmap_canvas_agg.h --- /* roadmap_canvas_agg.h - manage the roadmap canvas using agg * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef INCLUDE__ROADMAP_CANVAS_AGG__H #define INCLUDE__ROADMAP_CANVAS_AGG__H #include "roadmap_gui.h" #include "agg_pixfmt_rgba.h" #include "agg_pixfmt_rgb_packed.h" struct roadmap_canvas_image { agg::rendering_buffer rbuf; agg::pixfmt_rgba32 pixfmt; roadmap_canvas_image():pixfmt(rbuf) {} }; extern RoadMapCanvasMouseHandler RoadMapCanvasMouseButtonPressed; extern RoadMapCanvasMouseHandler RoadMapCanvasMouseButtonReleased; extern RoadMapCanvasMouseHandler RoadMapCanvasMouseMoved; extern RoadMapCanvasConfigureHandler RoadMapCanvasConfigure; void roadmap_canvas_agg_configure (unsigned char *buf, int width, int height, int stride); /* GUI specific implementation */ int roadmap_canvas_agg_to_wchar (const char *text, wchar_t *output, int size); agg::rgba8 roadmap_canvas_agg_parse_color (const char *color); RoadMapImage roadmap_canvas_agg_load_image (const char *path, const char *file_name); #endif // INCLUDE__ROADMAP_CANVAS_AGG__H |