[cairo-commit] roadster/src animator.c, 1.2, 1.3 databasewindow.c,
1.5, 1.6 datasetwindow.c, 1.5, 1.6 db.c, 1.19, 1.20 db.h, 1.8,
1.9 glyph.c, 1.4, 1.5 gotowindow.c, 1.8, 1.9 gpsclient.c, 1.8,
1.9 gui.c, 1.7, 1.8 history.c, 1.1, 1.2 import.c, 1.8,
1.9 import_tiger.c, 1.15, 1.16 importwindow.c, 1.6,
1.7 layers.c, 1.13, 1.14 location.c, 1.2, 1.3 locationset.c,
1.7, 1.8 main.c, 1.16, 1.17 main.h, NONE, 1.1 mainwindow.c,
1.32, 1.33 map.c, 1.34, 1.35 map.h, 1.13,
1.14 map_draw_cairo.c, 1.14, 1.15 map_draw_gdk.c, 1.10,
1.11 point.c, 1.3, 1.4 pointstring.c, 1.4, 1.5 prefs.c, 1.1,
1.2 road.c, 1.2, 1.3 road.h, 1.1, 1.2 scenemanager.c, 1.9,
1.10 search.c, 1.4, 1.5 search_location.c, 1.7,
1.8 search_road.c, 1.15, 1.16 searchwindow.c, 1.15,
1.16 tooltip.c, 1.1, 1.2 track.c, 1.5, 1.6 util.c, 1.4,
1.5 util.h, 1.6, 1.7 welcomewindow.c, 1.5, 1.6
Ian McIntosh
commit at pdx.freedesktop.org
Mon Mar 28 10:49:53 PST 2005
Committed by: ian
Update of /cvs/cairo/roadster/src
In directory gabe:/tmp/cvs-serv24258/src
Modified Files:
animator.c databasewindow.c datasetwindow.c db.c db.h glyph.c
gotowindow.c gpsclient.c gui.c history.c import.c
import_tiger.c importwindow.c layers.c location.c
locationset.c main.c mainwindow.c map.c map.h map_draw_cairo.c
map_draw_gdk.c point.c pointstring.c prefs.c road.c road.h
scenemanager.c search.c search_location.c search_road.c
searchwindow.c tooltip.c track.c util.c util.h welcomewindow.c
Added Files:
main.h
Log Message:
* src/main.h: Added this file for global flags.
* src/*: Added #include for main.h. Change from using pointstring_t to road_t for map geometry objects.
* src/map.c: Add map_side_test_line() to test which side of a line a point is.
* src/mainwindow.c: Tooltip now reports the address range of that part of the street.
* data/roadster.glade: Removed GPS tab temporarily.
* data/layers.xml: Minor style changes.
Index: animator.c
===================================================================
RCS file: /cvs/cairo/roadster/src/animator.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- animator.c 20 Mar 2005 03:37:09 -0000 1.2
+++ animator.c 28 Mar 2005 18:49:50 -0000 1.3
@@ -27,6 +27,7 @@
#include <gtk/gtk.h>
+#include "main.h"
#include "animator.h"
#include "util.h"
Index: databasewindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/databasewindow.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- databasewindow.c 4 Mar 2005 02:27:29 -0000 1.5
+++ databasewindow.c 28 Mar 2005 18:49:50 -0000 1.6
@@ -26,6 +26,7 @@
#include <gtk/gtk.h>
#include <glade/glade.h>
+#include "main.h"
#include "db.h"
#include "gui.h"
#include "databasewindow.h"
Index: datasetwindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/datasetwindow.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- datasetwindow.c 4 Mar 2005 09:27:26 -0000 1.5
+++ datasetwindow.c 28 Mar 2005 18:49:50 -0000 1.6
@@ -29,6 +29,7 @@
#include <gtk/gtk.h>
+#include "main.h"
#include "util.h"
#include "datasetwindow.h"
#include "mainwindow.h"
Index: db.c
===================================================================
RCS file: /cvs/cairo/roadster/src/db.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- db.c 26 Mar 2005 07:51:54 -0000 1.19
+++ db.c 28 Mar 2005 18:49:50 -0000 1.20
@@ -21,8 +21,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#define USE_GNOME_VFS
-
#include <mysql.h>
#define HAVE_MYSQL_EMBED
@@ -36,16 +34,17 @@
#include <stdio.h>
#include <string.h>
-#ifdef USE_GNOME_VFS
-#include <gnome-vfs-2.0/libgnomevfs/gnome-vfs.h>
-#endif
-
+#include "main.h"
#include "db.h"
#include "mainwindow.h"
#include "util.h"
#include "layers.h"
#include "locationset.h"
+#ifdef USE_GNOME_VFS
+#include <gnome-vfs-2.0/libgnomevfs/gnome-vfs.h>
+#endif
+
#define MYSQL_RESULT_SUCCESS (0) // for clearer code
#define MAX_SQLBUFFER_LEN (132000) // must be big for lists of coordinates
@@ -488,7 +487,7 @@
#define WKB_POINT 1 // only two we care about
#define WKB_LINESTRING 2
-void db_parse_wkb_pointstring(const gint8* data, pointstring_t* pPointString, gboolean (*callback_get_point)(mappoint_t**))
+void db_parse_wkb_linestring(const gint8* data, GPtrArray* pPointsArray, gboolean (*callback_alloc_point)(mappoint_t**))
{
g_assert(sizeof(double) == 8); // mysql gives us 8 bytes per point
@@ -502,12 +501,12 @@
while(nNumPoints > 0) {
mappoint_t* pPoint = NULL;
- if(!callback_get_point(&pPoint)) return;
+ if(!callback_alloc_point(&pPoint)) return;
pPoint->m_fLatitude = *((double*)data)++;
pPoint->m_fLongitude = *((double*)data)++;
- g_ptr_array_add(pPointString->m_pPointsArray, pPoint);
+ g_ptr_array_add(pPointsArray, pPoint);
nNumPoints--;
}
Index: db.h
===================================================================
RCS file: /cvs/cairo/roadster/src/db.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- db.h 10 Mar 2005 06:12:03 -0000 1.8
+++ db.h 28 Mar 2005 18:49:50 -0000 1.9
@@ -79,9 +79,7 @@
gchar* db_make_escaped_string(const gchar* pszString);
void db_free_escaped_string(gchar* pszString);
-void db_parse_point(const gchar* pszText, mappoint_t* pPoint);
-//void db_parse_pointstring(const gchar* pszText, pointstring_t* pPointString, gboolean (*callback_get_point)(mappoint_t**));
-void db_parse_wkb_pointstring(const gint8* data, pointstring_t* pPointString, gboolean (*callback_get_point)(mappoint_t**));
+void db_parse_wkb_linestring(const gint8* data, GPtrArray* pPointsArray, gboolean (*callback_alloc_point)(mappoint_t**));
void db_enable_keys(void);
void db_disable_keys(void);
Index: glyph.c
===================================================================
RCS file: /cvs/cairo/roadster/src/glyph.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- glyph.c 4 Mar 2005 09:27:26 -0000 1.4
+++ glyph.c 28 Mar 2005 18:49:50 -0000 1.5
@@ -22,7 +22,6 @@
*/
#include <gtk/gtk.h>
-
#include <cairo.h>
#ifdef HAVE_LIBSVG
Index: gotowindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/gotowindow.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- gotowindow.c 13 Mar 2005 23:31:21 -0000 1.8
+++ gotowindow.c 28 Mar 2005 18:49:50 -0000 1.9
@@ -23,6 +23,7 @@
#include <glade/glade.h>
#include <gtk/gtk.h>
+#include "main.h"
#include "mainwindow.h"
#include "gotowindow.h"
Index: gpsclient.c
===================================================================
RCS file: /cvs/cairo/roadster/src/gpsclient.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- gpsclient.c 20 Mar 2005 10:57:05 -0000 1.8
+++ gpsclient.c 28 Mar 2005 18:49:50 -0000 1.9
@@ -23,6 +23,7 @@
#include <gtk/gtk.h>
#include <gps.h> // gpslib
+#include "main.h"
#include "gpsclient.h"
struct {
Index: gui.c
===================================================================
RCS file: /cvs/cairo/roadster/src/gui.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- gui.c 20 Mar 2005 03:37:09 -0000 1.7
+++ gui.c 28 Mar 2005 18:49:50 -0000 1.8
@@ -28,9 +28,9 @@
#include <glade/glade.h>
#include <gtk/gtk.h>
+#include "main.h"
#include "gui.h"
#include "db.h"
-
#include "mainwindow.h"
#include "gotowindow.h"
#include "importwindow.h"
Index: history.c
===================================================================
RCS file: /cvs/cairo/roadster/src/history.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- history.c 20 Mar 2005 10:57:05 -0000 1.1
+++ history.c 28 Mar 2005 18:49:50 -0000 1.2
@@ -22,6 +22,7 @@
*/
#include <gtk/gtk.h>
+#include "main.h"
#include "history.h"
#include "map.h"
Index: import.c
===================================================================
RCS file: /cvs/cairo/roadster/src/import.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- import.c 20 Mar 2005 03:37:09 -0000 1.8
+++ import.c 28 Mar 2005 18:49:50 -0000 1.9
@@ -21,13 +21,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#define USE_GNOME_VFS
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
+#include "main.h"
#include "import.h"
#include "importwindow.h"
#include "import_tiger.h"
Index: import_tiger.c
===================================================================
RCS file: /cvs/cairo/roadster/src/import_tiger.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- import_tiger.c 23 Mar 2005 09:21:49 -0000 1.15
+++ import_tiger.c 28 Mar 2005 18:49:50 -0000 1.16
@@ -22,21 +22,20 @@
*/
// See TGR2003.PDF page 208 for county list
-#define USE_GNOME_VFS
-
#include <stdlib.h> // for strtod
#include <string.h>
-#ifdef USE_GNOME_VFS
-#include <gnome-vfs-2.0/libgnomevfs/gnome-vfs.h>
-#endif
-
+#include "main.h"
#include "util.h"
#include "import_tiger.h"
#include "importwindow.h"
#include "road.h"
+#ifdef USE_GNOME_VFS
+#include <gnome-vfs-2.0/libgnomevfs/gnome-vfs.h>
+#endif
+
#define TIGER_RT1_LINE_LENGTH (230)
#define TIGER_RT2_LINE_LENGTH (210)
#define TIGER_RT7_LINE_LENGTH (76)
Index: importwindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/importwindow.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- importwindow.c 13 Mar 2005 23:31:21 -0000 1.6
+++ importwindow.c 28 Mar 2005 18:49:50 -0000 1.7
@@ -23,6 +23,7 @@
#include <glade/glade.h>
#include <gtk/gtk.h>
+#include "main.h"
#include "db.h"
#include "import.h"
#include "mainwindow.h"
Index: layers.c
===================================================================
RCS file: /cvs/cairo/roadster/src/layers.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- layers.c 13 Mar 2005 23:31:21 -0000 1.13
+++ layers.c 28 Mar 2005 18:49:50 -0000 1.14
@@ -27,6 +27,7 @@
#include <cairo.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
+#include "main.h"
#include "layers.h"
layer_t * g_aLayers[NUM_LAYERS+1];
Index: location.c
===================================================================
RCS file: /cvs/cairo/roadster/src/location.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- location.c 13 Mar 2005 19:11:57 -0000 1.2
+++ location.c 28 Mar 2005 18:49:50 -0000 1.3
@@ -22,6 +22,7 @@
*/
#include <gtk/gtk.h>
+#include "main.h"
#include "map.h"
#include "location.h"
Index: locationset.c
===================================================================
RCS file: /cvs/cairo/roadster/src/locationset.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- locationset.c 13 Mar 2005 19:11:57 -0000 1.7
+++ locationset.c 28 Mar 2005 18:49:50 -0000 1.8
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <gtk/gtk.h>
+#include "main.h"
#include "location.h"
#include "locationset.h"
#include "db.h"
Index: main.c
===================================================================
RCS file: /cvs/cairo/roadster/src/main.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- main.c 20 Mar 2005 03:37:09 -0000 1.16
+++ main.c 28 Mar 2005 18:49:50 -0000 1.17
@@ -20,13 +20,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#define USE_GNOME_VFS
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
+#include "main.h"
#include "gui.h"
#include "db.h"
#include "map.h"
@@ -34,6 +34,7 @@
#include "scenemanager.h"
#include "prefs.h"
#include "animator.h"
+#include "road.h"
static gboolean main_init(void);
static void main_deinit(void);
@@ -80,6 +81,10 @@
point_init();
g_print("initializing pointstrings\n");
pointstring_init();
+
+ g_print("initializing roads\n");
+ road_init();
+
g_print("initializing tracks\n");
track_init();
g_print("initializing layers\n");
--- NEW FILE: main.h ---
/***************************************************************************
* main.h
*
* Copyright 2005 Ian McIntosh
* ian_mcintosh at linuxadvocate.org
****************************************************************************/
/*
* This program 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.
*
* This program 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 Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define USE_GNOME_VFS
//#define ENABLE_TIMING
#define USE_GFREELIST
Index: mainwindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/mainwindow.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- mainwindow.c 26 Mar 2005 07:51:54 -0000 1.32
+++ mainwindow.c 28 Mar 2005 18:49:50 -0000 1.33
@@ -28,6 +28,7 @@
#include <gtk/gtk.h>
#include <gtk/gtksignal.h>
+#include "main.h"
#include "search_road.h"
#include "gui.h"
#include "util.h"
@@ -66,7 +67,7 @@
#define DRAW_PRETTY_RESIZE_TIMEOUT_MS (180)
#define SCROLL_TIMEOUT_MS (80) // how often (in MS) to move
-#define SCROLL_DISTANCE_IN_PIXELS (120) // how far to move every (above) MS
+#define SCROLL_DISTANCE_IN_PIXELS (100) // how far to move every (above) MS
#define BORDER_SCROLL_CLICK_TARGET_SIZE (20) // the size of the click target (distance from edge of map view) to begin scrolling
#define SLIDE_TIMEOUT_MS (50) // time between frames (in MS) for smooth-sliding (on double click?)
@@ -81,7 +82,7 @@
#define MAX_SEARCH_TEXT_LENGTH (100)
#define SPEED_LABEL_FORMAT ("<span font_desc='32'>%.0f</span>")
-#define TOOLTIP_FORMAT (" %s ")
+#define TOOLTIP_FORMAT ("%s")
// Settings
#define TIMER_GPS_REDRAW_INTERVAL_MS (2500) // lower this (to 1000?) when it's faster to redraw track
Index: map.c
===================================================================
RCS file: /cvs/cairo/roadster/src/map.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- map.c 26 Mar 2005 07:51:54 -0000 1.34
+++ map.c 28 Mar 2005 18:49:50 -0000 1.35
@@ -26,15 +26,7 @@
#include <gtk/gtk.h>
#include <math.h>
-//#define THREADED_RENDERING
-//#define SCENEMANAGER_DEBUG_TEST
-
-#ifdef THREADED_RENDERING
-#define RENDERING_THREAD_YIELD g_thread_yield()
-#else
-#define RENDERING_THREAD_YIELD
-#endif
-
+#include "main.h"
#include "gui.h"
#include "map.h"
#include "mainwindow.h"
@@ -46,6 +38,12 @@
#include "locationset.h"
#include "scenemanager.h"
+#ifdef THREADED_RENDERING
+#define RENDERING_THREAD_YIELD g_thread_yield()
+#else
+#define RENDERING_THREAD_YIELD
+#endif
+
#define RENDERMODE_FAST 1 // Use 'fast' until Cairo catches up. :)
#define RENDERMODE_PRETTY 2
@@ -70,8 +68,10 @@
static gboolean map_data_load(map_t* pMap, maprect_t* pRect);
// hit testing
-static gboolean map_hit_test_layer_lines(GPtrArray* pPointStringsArray, gdouble fMaxDistance, mappoint_t* pHitPoint, gchar** ppReturnString);
-static gboolean map_hit_test_line(mappoint_t* pPoint1, mappoint_t* pPoint2, mappoint_t* pHitPoint, gdouble fDistance);
+static gboolean map_hit_test_layer_roads(GPtrArray* pPointStringsArray, gdouble fMaxDistance, mappoint_t* pHitPoint, gchar** ppReturnString);
+static gboolean map_hit_test_line(mappoint_t* pPoint1, mappoint_t* pPoint2, mappoint_t* pHitPoint, gdouble fDistance, mappoint_t* pReturnClosestPoint);
+
+static ESide map_side_test_line(mappoint_t* pPoint1, mappoint_t* pPoint2, mappoint_t* pClosestPointOnLine, mappoint_t* pHitPoint);
static void map_data_clear(map_t* pMap);
void map_get_render_metrics(map_t* pMap, rendermetrics_t* pMetrics);
@@ -165,7 +165,7 @@
gint i;
for(i=0 ; i<NUM_ELEMS(pMap->m_apLayerData) ; i++) {
maplayer_data_t* pLayer = g_new0(maplayer_data_t, 1);
- pLayer->m_pPointStringsArray = g_ptr_array_new();
+ pLayer->m_pRoadsArray = g_ptr_array_new();
pMap->m_apLayerData[i] = pLayer;
}
@@ -492,7 +492,7 @@
// generate SQL
gchar* pszSQL;
pszSQL = g_strdup_printf(
- "SELECT Road.ID, Road.TypeID, AsBinary(Road.Coordinates), RoadName.Name, RoadName.SuffixID"
+ "SELECT Road.ID, Road.TypeID, AsBinary(Road.Coordinates), RoadName.Name, RoadName.SuffixID, AddressLeftStart, AddressLeftEnd, AddressRightStart, AddressRightEnd"
" FROM Road "
" LEFT JOIN RoadName ON (Road.RoadNameID=RoadName.ID)"
" WHERE"
@@ -523,6 +523,10 @@
// aRow[2] is Coordinates in mysql's text format
// aRow[3] is road name
// aRow[4] is road name suffix id
+ // aRow[5] is road address left start
+ // aRow[6] is road address left end
+ // aRow[7] is road address right start
+ // aRow[8] is road address right end
// g_print("data: %s, %s, %s, %s, %s\n", aRow[0], aRow[1], aRow[2], aRow[3], aRow[4]);
// Get layer type that this belongs on
@@ -533,12 +537,15 @@
}
// Extract points
- pointstring_t* pNewPointString = NULL;
- if(!pointstring_alloc(&pNewPointString)) {
- g_warning("out of memory loading pointstrings\n");
- continue;
- }
- db_parse_wkb_pointstring(aRow[2], pNewPointString, point_alloc);
+ road_t* pNewRoad = NULL;
+ road_alloc(&pNewRoad);
+
+ //pointstring_t* pNewPointString = NULL;
+ //if(!pointstring_alloc(&pNewPointString)) {
+ // g_warning("out of memory loading pointstrings\n");
+ // continue;
+ //}
+ db_parse_wkb_linestring(aRow[2], pNewRoad->m_pPointsArray, point_alloc);
// Build name by adding suffix, if one is present
gchar azFullName[100] = "";
@@ -550,11 +557,15 @@
g_snprintf(azFullName, 100, "%s%s%s",
aRow[3], (pszSuffix[0] != '\0') ? " " : "", pszSuffix);
}
- pNewPointString->m_pszName = g_strdup(azFullName);
+ pNewRoad->m_nAddressLeftStart = atoi(aRow[5]);
+ pNewRoad->m_nAddressLeftEnd = atoi(aRow[6]);
+ pNewRoad->m_nAddressRightStart = atoi(aRow[7]);
+ pNewRoad->m_nAddressRightEnd = atoi(aRow[8]);
+
+ pNewRoad->m_pszName = g_strdup(azFullName);
// Add this item to layer's list of pointstrings
- g_ptr_array_add(
- pMap->m_apLayerData[nTypeID]->m_pPointStringsArray, pNewPointString);
+ g_ptr_array_add(pMap->m_apLayerData[nTypeID]->m_pRoadsArray, pNewRoad);
} // end while loop on rows
//g_print("[%d rows]\n", uRowCount);
TIMER_SHOW(mytimer, "after rows retrieved");
@@ -577,12 +588,12 @@
for(i=0 ; i<NUM_ELEMS(pMap->m_apLayerData) ; i++) {
maplayer_data_t* pLayerData = pMap->m_apLayerData[i];
- // Free each pointstring
- for(j = (pLayerData->m_pPointStringsArray->len - 1) ; j>=0 ; j--) {
- pointstring_t* pPointString = g_ptr_array_remove_index_fast(pLayerData->m_pPointStringsArray, j);
- pointstring_free(pPointString);
+ // Free each
+ for(j = (pLayerData->m_pRoadsArray->len - 1) ; j>=0 ; j--) {
+ road_t* pRoad = g_ptr_array_remove_index_fast(pLayerData->m_pRoadsArray, j);
+ road_free(pRoad);
}
- g_assert(pLayerData->m_pPointStringsArray->len == 0);
+ g_assert(pLayerData->m_pRoadsArray->len == 0);
}
}
@@ -654,20 +665,22 @@
gdouble fLineWidth = max(g_aLayers[nLayer]->m_Style.m_aSubLayers[0].m_afLineWidths[pMap->m_uZoomLevel-1],
g_aLayers[nLayer]->m_Style.m_aSubLayers[1].m_afLineWidths[pMap->m_uZoomLevel-1]);
+#define EXTRA_CLICKABLE_ROAD_IN_PIXELS (8)
+
// make thin roads a little easier to hit
fLineWidth = max(fLineWidth, MIN_ROAD_HIT_TARGET_WIDTH);
// XXX: hack, map_pixels should really take a floating point instead.
- gdouble fMaxDistance = map_pixels_to_degrees(pMap, 1, pMap->m_uZoomLevel) * (fLineWidth/2); // half width on each side
+ gdouble fMaxDistance = map_pixels_to_degrees(pMap, 1, pMap->m_uZoomLevel) * ((fLineWidth/2) + EXTRA_CLICKABLE_ROAD_IN_PIXELS); // half width on each side
- if(map_hit_test_layer_lines(pMap->m_apLayerData[nLayer]->m_pPointStringsArray, fMaxDistance, pMapPoint, ppReturnString)) {
+ if(map_hit_test_layer_roads(pMap->m_apLayerData[nLayer]->m_pRoadsArray, fMaxDistance, pMapPoint, ppReturnString)) {
return TRUE;
}
}
return FALSE;
}
-static gboolean map_hit_test_layer_lines(GPtrArray* pPointStringsArray, gdouble fMaxDistance, mappoint_t* pHitPoint, gchar** ppReturnString)
+static gboolean map_hit_test_layer_roads(GPtrArray* pRoadsArray, gdouble fMaxDistance, mappoint_t* pHitPoint, gchar** ppReturnString)
{
g_assert(ppReturnString != NULL);
g_assert(*ppReturnString == NULL); // pointer to null pointer
@@ -681,24 +694,47 @@
// Loop through line strings, order doesn't matter here since they're all on the same level.
gint iString;
- for(iString=0 ; iString<pPointStringsArray->len ; iString++) {
- pointstring_t* pPointString = g_ptr_array_index(pPointStringsArray, iString);
- if(pPointString->m_pPointsArray->len < 2) continue;
+ for(iString=0 ; iString<pRoadsArray->len ; iString++) {
+ road_t* pRoad = g_ptr_array_index(pRoadsArray, iString);
+ if(pRoad->m_pPointsArray->len < 2) continue;
// start on 1 so we can do -1 trick below
gint iPoint;
- for(iPoint=1 ; iPoint<pPointString->m_pPointsArray->len ; iPoint++) {
- mappoint_t* pPoint1 = g_ptr_array_index(pPointString->m_pPointsArray, iPoint-1);
- mappoint_t* pPoint2 = g_ptr_array_index(pPointString->m_pPointsArray, iPoint);
+ for(iPoint=1 ; iPoint<pRoad->m_pPointsArray->len ; iPoint++) {
+ mappoint_t* pPoint1 = g_ptr_array_index(pRoad->m_pPointsArray, iPoint-1);
+ mappoint_t* pPoint2 = g_ptr_array_index(pRoad->m_pPointsArray, iPoint);
+
+ mappoint_t pointClosest;
// hit test this line
- if(map_hit_test_line(pPoint1, pPoint2, pHitPoint, fMaxDistance)) {
+ if(map_hit_test_line(pPoint1, pPoint2, pHitPoint, fMaxDistance, &pointClosest)) {
// got a hit
- if(pPointString->m_pszName[0] == '\0') {
+ if(pRoad->m_pszName[0] == '\0') {
*ppReturnString = g_strdup("<i>unnamed road</i>");
}
else {
- *ppReturnString = g_strdup(pPointString->m_pszName);
+ ESide eSide = map_side_test_line(pPoint1, pPoint2, &pointClosest, pHitPoint);
+
+ gint nAddressStart;
+ gint nAddressEnd;
+ if(eSide == SIDE_LEFT) {
+ nAddressStart = pRoad->m_nAddressLeftStart;
+ nAddressEnd = pRoad->m_nAddressLeftEnd;
+ }
+ else {
+ nAddressStart = pRoad->m_nAddressRightStart;
+ nAddressEnd = pRoad->m_nAddressRightEnd;
+ }
+
+ if(nAddressStart == 0 || nAddressEnd == 0) {
+ *ppReturnString = g_strdup_printf("%s", pRoad->m_pszName);
+ }
+ else {
+ gint nMinAddres = min(nAddressStart, nAddressEnd);
+ gint nMaxAddres = max(nAddressStart, nAddressEnd);
+
+ *ppReturnString = g_strdup_printf("%s <b>#%d-%d</b>", pRoad->m_pszName, nMinAddres, nMaxAddres);
+ }
}
return TRUE;
}
@@ -708,7 +744,7 @@
}
// Does the given point come close enough to the line segment to be considered a hit?
-static gboolean map_hit_test_line(mappoint_t* pPoint1, mappoint_t* pPoint2, mappoint_t* pHitPoint, gdouble fMaxDistance)
+static gboolean map_hit_test_line(mappoint_t* pPoint1, mappoint_t* pPoint2, mappoint_t* pHitPoint, gdouble fMaxDistance, mappoint_t* pReturnClosestPoint)
{
// Some bad ASCII art demonstrating the situation:
//
@@ -728,7 +764,7 @@
v.m_fLatitude = pPoint2->m_fLatitude - pPoint1->m_fLatitude; // 10->90 becomes 0->80 (just store 80)
v.m_fLongitude = pPoint2->m_fLongitude - pPoint1->m_fLongitude;
- gdouble fLengthV = sqrt((v.m_fLatitude*v.m_fLatitude) + (v.m_fLongitude*v.m_fLongitude));
+ gdouble fLengthV = sqrt((v.m_fLatitude*v.m_fLatitude) + (v.m_fLongitude*v.m_fLongitude));
if(fLengthV == 0.0) return FALSE; // bad data: a line segment with no length?
//
@@ -776,12 +812,52 @@
/* g_print("fDotProduct = %f\n", fDotProduct); */
/* g_print("a (%f,%f)\n", a.m_fLatitude, a.m_fLongitude); */
/* g_print("fDistance = %f\n", sqrt(fDistanceSquared)); */
+ if(pReturnClosestPoint) {
+ pReturnClosestPoint->m_fLatitude = a.m_fLatitude + pPoint1->m_fLatitude;
+ pReturnClosestPoint->m_fLongitude = a.m_fLongitude + pPoint1->m_fLongitude;
+ }
+
return TRUE;
}
}
return FALSE;
}
+static ESide map_side_test_line(mappoint_t* pPoint1, mappoint_t* pPoint2, mappoint_t* pClosestPointOnLine, mappoint_t* pHitPoint)
+{
+ // make a translated-to-origin *perpendicular* vector of the line (points to the "left" of the line when walking from point 1 to 2)
+ mappoint_t v;
+ v.m_fLatitude = (pPoint2->m_fLongitude - pPoint1->m_fLongitude); // NOTE: swapping lat and lon to make perpendicular
+ v.m_fLongitude = -(pPoint2->m_fLatitude - pPoint1->m_fLatitude);
+
+ // make a translated-to-origin vector of the line from closest point to hitpoint
+ mappoint_t u;
+ u.m_fLatitude = pHitPoint->m_fLatitude - pClosestPointOnLine->m_fLatitude;
+ u.m_fLongitude = pHitPoint->m_fLongitude - pClosestPointOnLine->m_fLongitude;
+
+ // figure out the signs of the elements of the vectors
+ gboolean bULatPositive = (u.m_fLatitude >= 0);
+ gboolean bULonPositive = (u.m_fLongitude >= 0);
+ gboolean bVLatPositive = (v.m_fLatitude >= 0);
+ gboolean bVLonPositive = (v.m_fLongitude >= 0);
+
+ //g_print("%s,%s %s,%s\n", bVLonPositive?"Y":"N", bVLatPositive?"Y":"N", bULonPositive?"Y":"N", bULatPositive?"Y":"N");
+
+ // if the signs agree, it's to the left, otherwise to the right
+ if(bULatPositive == bVLatPositive && bULonPositive == bVLonPositive) {
+ return SIDE_LEFT;
+ }
+ else {
+ // let's check our algorithm: if the signs aren't both the same, they should be both opposite
+ // ...unless the vector from hitpoint to line center is 0, which doesn't have sign
+
+ //g_print("%f,%f %f,%f\n", u.m_fLatitude, u.m_fLongitude, v.m_fLatitude, v.m_fLongitude);
+ g_assert(bULatPositive != bVLatPositive || u.m_fLatitude == 0.0);
+ g_assert(bULonPositive != bVLonPositive || u.m_fLongitude == 0.0);
+ return SIDE_RIGHT;
+ }
+}
+
gboolean map_can_zoom_in(map_t* pMap)
{
// can we increase zoom level?
Index: map.h
===================================================================
RCS file: /cvs/cairo/roadster/src/map.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- map.h 26 Mar 2005 07:51:54 -0000 1.13
+++ map.h 28 Mar 2005 18:49:50 -0000 1.14
@@ -121,6 +121,11 @@
UNIT_LAST=3,
} EDistanceUnits;
+typedef enum {
+ SIDE_LEFT=1,
+ SIDE_RIGHT=2,
+} ESide;
+
#define DEFAULT_UNIT (UNIT_MILES)
extern gchar* g_aDistanceUnitNames[];
@@ -137,7 +142,7 @@
#define SCALE_Y(p, y) ((p)->m_nWindowHeight - ((((y) - (p)->m_rWorldBoundingBox.m_A.m_fLatitude) / (p)->m_fScreenLatitude) * (p)->m_nWindowHeight))
typedef struct {
- GPtrArray* m_pPointStringsArray; // this should probably change to an array of 'roads'
+ GPtrArray* m_pRoadsArray;
} maplayer_data_t;
typedef struct {
Index: map_draw_cairo.c
===================================================================
RCS file: /cvs/cairo/roadster/src/map_draw_cairo.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- map_draw_cairo.c 25 Mar 2005 22:02:11 -0000 1.14
+++ map_draw_cairo.c 28 Mar 2005 18:49:50 -0000 1.15
@@ -37,6 +37,7 @@
#include <gtk/gtk.h>
#include <math.h>
+#include "main.h"
#include "gui.h"
#include "map.h"
#include "mainwindow.h"
@@ -50,10 +51,10 @@
#include "scenemanager.h"
// Draw whole layers
-static void map_draw_cairo_layer_polygons(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pPointStringsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle);
-static void map_draw_cairo_layer_lines(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pPointStringsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle);
-static void map_draw_cairo_layer_line_labels(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pPointStringsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle);
-static void map_draw_cairo_layer_polygon_labels(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pPointStringsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle);
+static void map_draw_cairo_layer_polygons(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pRoadsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle);
+static void map_draw_cairo_layer_roads(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pRoadsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle);
+static void map_draw_cairo_layer_road_labels(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pRoadsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle);
+static void map_draw_cairo_layer_polygon_labels(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pRoadsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle);
static void map_draw_cairo_locations(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics);
// Draw a single line/polygon/point
@@ -61,8 +62,8 @@
static void map_draw_cairo_layer_points(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pLocationsArray);
// Draw a single line/polygon label
-static void map_draw_cairo_line_label(map_t* pMap, cairo_t *pCairo, textlabelstyle_t* pLabelStyle, rendermetrics_t* pRenderMetrics, pointstring_t* pPointString, gdouble fLineWidth, const gchar* pszLabel);
-static void map_draw_cairo_polygon_label(map_t* pMap, cairo_t *pCairo, textlabelstyle_t* pLabelStyle, rendermetrics_t* pRenderMetrics, pointstring_t* pPointString, const gchar* pszLabel);
+static void map_draw_cairo_road_label(map_t* pMap, cairo_t *pCairo, textlabelstyle_t* pLabelStyle, rendermetrics_t* pRenderMetrics, GPtrArray* pPointsArray, gdouble fLineWidth, const gchar* pszLabel);
+static void map_draw_cairo_polygon_label(map_t* pMap, cairo_t *pCairo, textlabelstyle_t* pLabelStyle, rendermetrics_t* pRenderMetrics, GPtrArray* pPointsArray, const gchar* pszLabel);
// static void map_draw_cairo_crosshair(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics);
@@ -98,9 +99,9 @@
gint nRenderType = layerdraworder[i].eSubLayerRenderType;
if(nRenderType == SUBLAYER_RENDERTYPE_LINES) {
if(nDrawFlags & DRAWFLAG_GEOMETRY) {
- map_draw_cairo_layer_lines(pMap, pCairo,
+ map_draw_cairo_layer_roads(pMap, pCairo,
pRenderMetrics,
- /* geometry */ pMap->m_apLayerData[nLayer]->m_pPointStringsArray,
+ /* geometry */ pMap->m_apLayerData[nLayer]->m_pRoadsArray,
/* style */ &(g_aLayers[nLayer]->m_Style.m_aSubLayers[nSubLayer]),
&(g_aLayers[nLayer]->m_TextLabelStyle));
}
@@ -109,16 +110,16 @@
if(nDrawFlags & DRAWFLAG_GEOMETRY) {
map_draw_cairo_layer_polygons(pMap, pCairo,
pRenderMetrics,
- /* geometry */ pMap->m_apLayerData[nLayer]->m_pPointStringsArray,
+ /* geometry */ pMap->m_apLayerData[nLayer]->m_pRoadsArray,
/* style */ &(g_aLayers[nLayer]->m_Style.m_aSubLayers[nSubLayer]),
&(g_aLayers[nLayer]->m_TextLabelStyle));
}
}
else if(nRenderType == SUBLAYER_RENDERTYPE_LINE_LABELS) {
if(nDrawFlags & DRAWFLAG_LABELS) {
- map_draw_cairo_layer_line_labels(pMap, pCairo,
+ map_draw_cairo_layer_road_labels(pMap, pCairo,
pRenderMetrics,
- /* geometry */ pMap->m_apLayerData[nLayer]->m_pPointStringsArray,
+ /* geometry */ pMap->m_apLayerData[nLayer]->m_pRoadsArray,
/* style */ &(g_aLayers[nLayer]->m_Style.m_aSubLayers[nSubLayer]),
&(g_aLayers[nLayer]->m_TextLabelStyle));
}
@@ -127,7 +128,7 @@
if(nDrawFlags & DRAWFLAG_LABELS) {
map_draw_cairo_layer_polygon_labels(pMap, pCairo,
pRenderMetrics,
- /* geometry */ pMap->m_apLayerData[nLayer]->m_pPointStringsArray,
+ /* geometry */ pMap->m_apLayerData[nLayer]->m_pRoadsArray,
/* style */ &(g_aLayers[nLayer]->m_Style.m_aSubLayers[nSubLayer]),
&(g_aLayers[nLayer]->m_TextLabelStyle));
}
@@ -159,7 +160,7 @@
//
// Draw a whole layer of line strings
//
-void map_draw_cairo_layer_line_labels(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pPointStringsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle)
+void map_draw_cairo_layer_road_labels(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pRoadsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle)
{
gint i;
gdouble fLineWidth = pSubLayerStyle->m_afLineWidths[pRenderMetrics->m_nZoomLevel-1];
@@ -175,10 +176,10 @@
cairo_select_font(pCairo, pszFontFamily, CAIRO_FONT_SLANT_NORMAL, pLabelStyle->m_abBoldAtZoomLevel[pRenderMetrics->m_nZoomLevel-1] ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL);
cairo_scale_font(pCairo, fFontSize);
- for(i=0 ; i<pPointStringsArray->len ; i++) {
- pointstring_t* pPointString = g_ptr_array_index(pPointStringsArray, i);
- if(pPointString->m_pszName[0] != '\0') {
- map_draw_cairo_line_label(pMap, pCairo, pLabelStyle, pRenderMetrics, pPointString, fLineWidth, pPointString->m_pszName);
+ for(i=0 ; i<pRoadsArray->len ; i++) {
+ road_t* pRoad = g_ptr_array_index(pRoadsArray, i);
+ if(pRoad->m_pszName[0] != '\0') {
+ map_draw_cairo_road_label(pMap, pCairo, pLabelStyle, pRenderMetrics, pRoad->m_pPointsArray, fLineWidth, pRoad->m_pszName);
}
}
cairo_restore(pCairo);
@@ -187,7 +188,7 @@
//
// Draw a whole layer of polygons
//
-void map_draw_cairo_layer_polygon_labels(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pPointStringsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle)
+void map_draw_cairo_layer_polygon_labels(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pRoadsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle)
{
gdouble fFontSize = pLabelStyle->m_afFontSizeAtZoomLevel[pRenderMetrics->m_nZoomLevel-1];
if(fFontSize == 0) return;
@@ -199,17 +200,19 @@
cairo_select_font(pCairo, pszFontFamily, CAIRO_FONT_SLANT_NORMAL, pLabelStyle->m_abBoldAtZoomLevel[pRenderMetrics->m_nZoomLevel-1] ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL);
cairo_scale_font(pCairo, fFontSize);
+ cairo_set_rgb_color(pCairo, pLabelStyle->m_clrColor.m_fRed, pLabelStyle->m_clrColor.m_fGreen, pLabelStyle->m_clrColor.m_fBlue);
+
gint i;
- for(i=0 ; i<pPointStringsArray->len ; i++) {
- pointstring_t* pPointString = g_ptr_array_index(pPointStringsArray, i);
- if(pPointString->m_pszName[0] != '\0') {
- map_draw_cairo_polygon_label(pMap, pCairo, pLabelStyle, pRenderMetrics, pPointString, pPointString->m_pszName);
+ for(i=0 ; i<pRoadsArray->len ; i++) {
+ road_t* pRoad = g_ptr_array_index(pRoadsArray, i);
+ if(pRoad->m_pszName[0] != '\0') {
+ map_draw_cairo_polygon_label(pMap, pCairo, pLabelStyle, pRenderMetrics, pRoad->m_pPointsArray, pRoad->m_pszName);
}
}
cairo_restore(pCairo);
}
-void map_draw_cairo_layer_lines(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pPointStringsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle)
+void map_draw_cairo_layer_roads(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pRoadsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle)
{
mappoint_t* pPoint;
pointstring_t* pPointString;
@@ -260,10 +263,10 @@
cairo_set_alpha(pCairo, pSubLayerStyle->m_clrColor.m_fAlpha);
cairo_set_line_width(pCairo, fLineWidth);
- for(iString=0 ; iString<pPointStringsArray->len ; iString++) {
+ for(iString=0 ; iString<pRoadsArray->len ; iString++) {
RENDERING_THREAD_YIELD;
- pPointString = g_ptr_array_index(pPointStringsArray, iString);
+ pPointString = g_ptr_array_index(pRoadsArray, iString);
if(pPointString->m_pPointsArray->len >= 2) {
pPoint = g_ptr_array_index(pPointString->m_pPointsArray, 0);
@@ -291,10 +294,10 @@
cairo_restore(pCairo);
}
-void map_draw_cairo_layer_polygons(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pPointStringsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle)
+void map_draw_cairo_layer_polygons(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pRoadsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle)
{
+ road_t* pRoad;
mappoint_t* pPoint;
- pointstring_t* pPointString;
gdouble fLineWidth = pSubLayerStyle->m_afLineWidths[pRenderMetrics->m_nZoomLevel-1];
if(fLineWidth == 0.0) return; // Don't both drawing with line width 0
@@ -311,21 +314,21 @@
// cairo_set_dash(pCairo, g_aDashStyles[pSubLayerStyle->m_nDashStyle].m_pfList, g_aDashStyles[pSubLayerStyle->m_nDashStyle].m_nCount, 0.0);
gint iString;
- for(iString=0 ; iString<pPointStringsArray->len ; iString++) {
+ for(iString=0 ; iString<pRoadsArray->len ; iString++) {
RENDERING_THREAD_YIELD;
- pPointString = g_ptr_array_index(pPointStringsArray, iString);
+ pRoad = g_ptr_array_index(pRoadsArray, iString);
- if(pPointString->m_pPointsArray->len >= 3) {
- pPoint = g_ptr_array_index(pPointString->m_pPointsArray, 0);
+ if(pRoad->m_pPointsArray->len >= 3) {
+ pPoint = g_ptr_array_index(pRoad->m_pPointsArray, 0);
// move to index 0
cairo_move_to(pCairo, SCALE_X(pRenderMetrics, pPoint->m_fLongitude), SCALE_Y(pRenderMetrics, pPoint->m_fLatitude));
// start at index 1 (0 was used above)
gint iPoint;
- for(iPoint=1 ; iPoint<pPointString->m_pPointsArray->len ; iPoint++) {
- pPoint = g_ptr_array_index(pPointString->m_pPointsArray, iPoint);
+ for(iPoint=1 ; iPoint<pRoad->m_pPointsArray->len ; iPoint++) {
+ pPoint = g_ptr_array_index(pRoad->m_pPointsArray, iPoint);
cairo_line_to(pCairo, SCALE_X(pRenderMetrics, pPoint->m_fLongitude), SCALE_Y(pRenderMetrics, pPoint->m_fLatitude));
}
//cairo_close_path(pCairo);
@@ -459,15 +462,15 @@
//
// Draw a label along a 2-point line
//
-static void map_draw_cairo_line_label_one_segment(map_t* pMap, cairo_t *pCairo, textlabelstyle_t* pLabelStyle, rendermetrics_t* pRenderMetrics, pointstring_t* pPointString, gdouble fLineWidth, const gchar* pszLabel)
+static void map_draw_cairo_road_label_one_segment(map_t* pMap, cairo_t *pCairo, textlabelstyle_t* pLabelStyle, rendermetrics_t* pRenderMetrics, GPtrArray* pPointsArray, gdouble fLineWidth, const gchar* pszLabel)
{
// get permission to draw this label
if(FALSE == scenemanager_can_draw_label_at(pMap->m_pSceneManager, pszLabel, NULL)) {
return;
}
- mappoint_t* pMapPoint1 = g_ptr_array_index(pPointString->m_pPointsArray, 0);
- mappoint_t* pMapPoint2 = g_ptr_array_index(pPointString->m_pPointsArray, 1);
+ mappoint_t* pMapPoint1 = g_ptr_array_index(pPointsArray, 0);
+ mappoint_t* pMapPoint2 = g_ptr_array_index(pPointsArray, 1);
// swap first and second points such that the line goes left-to-right
if(pMapPoint2->m_fLongitude < pMapPoint1->m_fLongitude) {
@@ -605,7 +608,7 @@
//
// Draw a label along a multi-point line
//
-static gint map_draw_cairo_line_label_position_sort(gconstpointer pA, gconstpointer pB)
+static gint map_draw_cairo_road_label_position_sort(gconstpointer pA, gconstpointer pB)
{
labelposition_t *pPosA = *(labelposition_t **)pA;
labelposition_t *pPosB = *(labelposition_t **)pB;
@@ -614,20 +617,20 @@
return 1;
}
-static void map_draw_cairo_line_label(map_t* pMap, cairo_t *pCairo, textlabelstyle_t* pLabelStyle, rendermetrics_t* pRenderMetrics, pointstring_t* pPointString, gdouble fLineWidth, const gchar* pszLabel)
+static void map_draw_cairo_road_label(map_t* pMap, cairo_t *pCairo, textlabelstyle_t* pLabelStyle, rendermetrics_t* pRenderMetrics, GPtrArray* pPointsArray, gdouble fLineWidth, const gchar* pszLabel)
{
- if(pPointString->m_pPointsArray->len < 2) return;
+ if(pPointsArray->len < 2) return;
// pass off single segments to a specialized function
- if(pPointString->m_pPointsArray->len == 2) {
- map_draw_cairo_line_label_one_segment(pMap, pCairo, pLabelStyle, pRenderMetrics, pPointString, fLineWidth, pszLabel);
+ if(pPointsArray->len == 2) {
+ map_draw_cairo_road_label_one_segment(pMap, pCairo, pLabelStyle, pRenderMetrics, pPointsArray, fLineWidth, pszLabel);
return;
}
// XXX
return;
- if(pPointString->m_pPointsArray->len > ROAD_MAX_SEGMENTS) {
+ if(pPointsArray->len > ROAD_MAX_SEGMENTS) {
g_warning("not drawing label for road '%s' with > %d segments.\n", pszLabel, ROAD_MAX_SEGMENTS);
return;
}
@@ -654,7 +657,7 @@
gdouble aSlopes[ROAD_MAX_SEGMENTS];
mappoint_t* apPoints[ROAD_MAX_SEGMENTS];
- gint nNumPoints = pPointString->m_pPointsArray->len;
+ gint nNumPoints = pPointsArray->len;
mappoint_t* pMapPoint1;
mappoint_t* pMapPoint2;
@@ -662,7 +665,7 @@
// load point string into an array
gint iRead;
for(iRead=0 ; iRead<nNumPoints ; iRead++) {
- apPoints[iRead] = g_ptr_array_index(pPointString->m_pPointsArray, iRead);
+ apPoints[iRead] = g_ptr_array_index(pPointsArray, iRead);
}
// measure total line length
@@ -755,7 +758,7 @@
// sort postions by score
//if(nPositions > 1)
- // g_ptr_array_sort(pPositionsPtrArray, map_draw_cairo_line_label_position_sort);
+ // g_ptr_array_sort(pPositionsPtrArray, map_draw_cairo_road_label_position_sort);
/*
for(iPosition = 1 ; iPosition < nPositions ; iPosition++) {
@@ -795,7 +798,7 @@
// reverse the array
gint iRead,iWrite;
for(iWrite=0, iRead=nNumPoints-1 ; iRead>= 0 ; iWrite++, iRead--) {
- apPoints[iWrite] = g_ptr_array_index(pPointString->m_pPointsArray, iRead);
+ apPoints[iWrite] = g_ptr_array_index(pPointsArray, iRead);
}
}
@@ -1120,9 +1123,9 @@
//
// Draw a single polygon label
//
-void map_draw_cairo_polygon_label(map_t* pMap, cairo_t *pCairo, textlabelstyle_t* pLabelStyle, rendermetrics_t* pRenderMetrics, pointstring_t* pPointString, const gchar* pszLabel)
+void map_draw_cairo_polygon_label(map_t* pMap, cairo_t *pCairo, textlabelstyle_t* pLabelStyle, rendermetrics_t* pRenderMetrics, GPtrArray* pPointsArray, const gchar* pszLabel)
{
- if(pPointString->m_pPointsArray->len < 3) return;
+ if(pPointsArray->len < 3) return;
if(FALSE == scenemanager_can_draw_label_at(pMap->m_pSceneManager, pszLabel, NULL)) {
return; // duplicate label or whatever other rule scenemanager uses
@@ -1140,8 +1143,8 @@
gdouble fX;
gdouble fY;
gint i;
- for(i=0 ; i<pPointString->m_pPointsArray->len ; i++) {
- pMapPoint = g_ptr_array_index(pPointString->m_pPointsArray, i);
+ for(i=0 ; i<pPointsArray->len ; i++) {
+ pMapPoint = g_ptr_array_index(pPointsArray, i);
// find extents
fMaxLat = max(pMapPoint->m_fLatitude,fMaxLat);
Index: map_draw_gdk.c
===================================================================
RCS file: /cvs/cairo/roadster/src/map_draw_gdk.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- map_draw_gdk.c 25 Mar 2005 22:02:11 -0000 1.10
+++ map_draw_gdk.c 28 Mar 2005 18:49:50 -0000 1.11
@@ -28,6 +28,7 @@
#include <gtk/gtk.h>
#include <math.h>
+#include "main.h"
#include "gui.h"
#include "map.h"
#include "mainwindow.h"
@@ -36,12 +37,13 @@
#include "road.h"
#include "point.h"
#include "layers.h"
+#include "track.h"
#include "locationset.h"
#include "scenemanager.h"
static void map_draw_gdk_background(map_t* pMap, GdkPixmap* pPixmap);
-static void map_draw_gdk_layer_polygons(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics, GPtrArray* pPointStringsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle);
-static void map_draw_gdk_layer_lines(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics, GPtrArray* pPointStringsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle);
+static void map_draw_gdk_layer_polygons(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics, GPtrArray* pRoadsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle);
+static void map_draw_gdk_layer_roads(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics, GPtrArray* pRoadsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle);
static void map_draw_gdk_tracks(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics);
void map_draw_gdk(map_t* pMap, rendermetrics_t* pRenderMetrics, GdkPixmap* pPixmap, gint nDrawFlags)
@@ -67,16 +69,16 @@
gint nSubLayer = layerdraworder[i].nSubLayer;
if(layerdraworder[i].eSubLayerRenderType == SUBLAYER_RENDERTYPE_LINES) {
- map_draw_gdk_layer_lines(pMap, pPixmap,
+ map_draw_gdk_layer_roads(pMap, pPixmap,
pRenderMetrics,
- /* geometry */ pMap->m_apLayerData[nLayer]->m_pPointStringsArray,
+ /* geometry */ pMap->m_apLayerData[nLayer]->m_pRoadsArray,
/* style */ &(g_aLayers[nLayer]->m_Style.m_aSubLayers[nSubLayer]),
&(g_aLayers[nLayer]->m_TextLabelStyle));
}
else if(layerdraworder[i].eSubLayerRenderType == SUBLAYER_RENDERTYPE_POLYGONS) {
map_draw_gdk_layer_polygons(pMap, pPixmap,
pRenderMetrics,
- /* geometry */ pMap->m_apLayerData[nLayer]->m_pPointStringsArray,
+ /* geometry */ pMap->m_apLayerData[nLayer]->m_pRoadsArray,
/* style */ &(g_aLayers[nLayer]->m_Style.m_aSubLayers[nSubLayer]),
&(g_aLayers[nLayer]->m_TextLabelStyle));
}
@@ -105,10 +107,10 @@
TRUE, 0,0, pMap->m_MapDimensions.m_uWidth, pMap->m_MapDimensions.m_uHeight);
}
-static void map_draw_gdk_layer_polygons(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics, GPtrArray* pPointStringsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle)
+static void map_draw_gdk_layer_polygons(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics, GPtrArray* pRoadsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle)
{
mappoint_t* pPoint;
- pointstring_t* pPointString;
+ road_t* pRoad;
gint iString;
gint iPoint;
@@ -131,24 +133,24 @@
clr.blue = pSubLayerStyle->m_clrColor.m_fBlue * 65535;
gdk_gc_set_rgb_fg_color(pMap->m_pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->m_pTargetWidget)], &clr);
- for(iString=0 ; iString<pPointStringsArray->len ; iString++) {
- pPointString = g_ptr_array_index(pPointStringsArray, iString);
+ for(iString=0 ; iString<pRoadsArray->len ; iString++) {
+ pRoad = g_ptr_array_index(pRoadsArray, iString);
gdouble fMaxLat = MIN_LATITUDE; // init to the worst possible value so first point will override
gdouble fMinLat = MAX_LATITUDE;
gdouble fMaxLon = MIN_LONGITUDE;
gdouble fMinLon = MAX_LONGITUDE;
- if(pPointString->m_pPointsArray->len >= 2) {
+ if(pRoad->m_pPointsArray->len >= 2) {
GdkPoint aPoints[MAX_GDK_LINE_SEGMENTS];
- if(pPointString->m_pPointsArray->len > MAX_GDK_LINE_SEGMENTS) {
- g_warning("not drawing line with > %d segments\n", MAX_GDK_LINE_SEGMENTS);
+ if(pRoad->m_pPointsArray->len > MAX_GDK_LINE_SEGMENTS) {
+ //g_warning("not drawing line with > %d segments\n", MAX_GDK_LINE_SEGMENTS);
continue;
}
- for(iPoint=0 ; iPoint<pPointString->m_pPointsArray->len ; iPoint++) {
- pPoint = g_ptr_array_index(pPointString->m_pPointsArray, iPoint);
+ for(iPoint=0 ; iPoint<pRoad->m_pPointsArray->len ; iPoint++) {
+ pPoint = g_ptr_array_index(pRoad->m_pPointsArray, iPoint);
// find extents
fMaxLat = max(pPoint->m_fLatitude,fMaxLat);
@@ -169,15 +171,15 @@
continue; // not visible
}
gdk_draw_polygon(pPixmap, pMap->m_pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->m_pTargetWidget)],
- TRUE, aPoints, pPointString->m_pPointsArray->len);
+ TRUE, aPoints, pRoad->m_pPointsArray->len);
}
}
}
-static void map_draw_gdk_layer_lines(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics, GPtrArray* pPointStringsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle)
+static void map_draw_gdk_layer_roads(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics, GPtrArray* pRoadsArray, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle)
{
+ road_t* pRoad;
mappoint_t* pPoint;
- pointstring_t* pPointString;
gint iString;
gint iPoint;
@@ -215,24 +217,24 @@
clr.blue = pSubLayerStyle->m_clrColor.m_fBlue * 65535;
gdk_gc_set_rgb_fg_color(pMap->m_pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->m_pTargetWidget)], &clr);
- for(iString=0 ; iString<pPointStringsArray->len ; iString++) {
- pPointString = g_ptr_array_index(pPointStringsArray, iString);
+ for(iString=0 ; iString<pRoadsArray->len ; iString++) {
+ pRoad = g_ptr_array_index(pRoadsArray, iString);
gdouble fMaxLat = MIN_LATITUDE; // init to the worst possible value so first point will override
gdouble fMinLat = MAX_LATITUDE;
gdouble fMaxLon = MIN_LONGITUDE;
gdouble fMinLon = MAX_LONGITUDE;
- if(pPointString->m_pPointsArray->len >= 2) {
+ if(pRoad->m_pPointsArray->len >= 2) {
GdkPoint aPoints[MAX_GDK_LINE_SEGMENTS];
- if(pPointString->m_pPointsArray->len > MAX_GDK_LINE_SEGMENTS) {
- g_warning("not drawing line with > %d segments\n", MAX_GDK_LINE_SEGMENTS);
+ if(pRoad->m_pPointsArray->len > MAX_GDK_LINE_SEGMENTS) {
+ //g_warning("not drawing line with > %d segments\n", MAX_GDK_LINE_SEGMENTS);
continue;
}
- for(iPoint=0 ; iPoint<pPointString->m_pPointsArray->len ; iPoint++) {
- pPoint = g_ptr_array_index(pPointString->m_pPointsArray, iPoint);
+ for(iPoint=0 ; iPoint<pRoad->m_pPointsArray->len ; iPoint++) {
+ pPoint = g_ptr_array_index(pRoad->m_pPointsArray, iPoint);
// find extents
fMaxLat = max(pPoint->m_fLatitude,fMaxLat);
@@ -253,7 +255,7 @@
continue; // not visible
}
- gdk_draw_lines(pPixmap, pMap->m_pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->m_pTargetWidget)], aPoints, pPointString->m_pPointsArray->len);
+ gdk_draw_lines(pPixmap, pMap->m_pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->m_pTargetWidget)], aPoints, pRoad->m_pPointsArray->len);
}
}
}
@@ -276,7 +278,7 @@
if(pPointString->m_pPointsArray->len >= 2) {
if(pPointString->m_pPointsArray->len > MAX_GDK_LINE_SEGMENTS) {
- g_warning("not drawing track with > %d segments\n", MAX_GDK_LINE_SEGMENTS);
+ //g_warning("not drawing track with > %d segments\n", MAX_GDK_LINE_SEGMENTS);
continue;
}
Index: point.c
===================================================================
RCS file: /cvs/cairo/roadster/src/point.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- point.c 20 Mar 2005 03:37:09 -0000 1.3
+++ point.c 28 Mar 2005 18:49:50 -0000 1.4
@@ -22,11 +22,10 @@
*/
#include <gtk/gtk.h>
+#include "main.h"
#include "map.h"
#include "point.h"
-#define USE_GFREELIST
-
#ifdef USE_GFREELIST
#include "gfreelist.h"
GFreeList* g_pPointFreeList;
Index: pointstring.c
===================================================================
RCS file: /cvs/cairo/roadster/src/pointstring.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pointstring.c 20 Mar 2005 03:37:09 -0000 1.4
+++ pointstring.c 28 Mar 2005 18:49:50 -0000 1.5
@@ -22,12 +22,11 @@
*/
#include <gtk/gtk.h>
+#include "main.h"
#include "map.h"
#include "point.h"
#include "pointstring.h"
-#define USE_GFREELIST
-
#ifdef USE_GFREELIST
#include "gfreelist.h"
GFreeList* g_pPointStringFreeList = NULL;
Index: prefs.c
===================================================================
RCS file: /cvs/cairo/roadster/src/prefs.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- prefs.c 7 Mar 2005 23:31:41 -0000 1.1
+++ prefs.c 28 Mar 2005 18:49:50 -0000 1.2
@@ -21,6 +21,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include "main.h"
+
void prefs_init() {}
void pref_deinit() {}
void prefs_read() {}
Index: road.c
===================================================================
RCS file: /cvs/cairo/roadster/src/road.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- road.c 4 Mar 2005 09:27:26 -0000 1.2
+++ road.c 28 Mar 2005 18:49:50 -0000 1.3
@@ -22,8 +22,50 @@
*/
#include <gtk/gtk.h>
+#include "main.h"
#include "road.h"
#include "util.h"
+#include "map.h"
+#include "gfreelist.h"
+
+GFreeList* g_pRoadFreeList = NULL;
+
+void road_init(void)
+{
+ g_pRoadFreeList = g_free_list_new(sizeof(road_t), 1000);
+}
+
+gboolean road_alloc(road_t** ppReturnRoad)
+{
+ g_return_val_if_fail(ppReturnRoad != NULL, FALSE);
+ g_return_val_if_fail(*ppReturnRoad == NULL, FALSE); // must be a pointer to a NULL pointer
+
+ road_t* pNew = g_free_list_alloc(g_pRoadFreeList);
+ memset(pNew, 0, sizeof(road_t));
+
+ pNew->m_pPointsArray = g_ptr_array_new();
+
+ // return it
+ *ppReturnRoad = pNew;
+ return TRUE;
+}
+
+void road_free(road_t* pRoad)
+{
+ g_return_if_fail(pRoad != NULL);
+
+ int i;
+ for(i = (pRoad->m_pPointsArray->len - 1) ; i>=0 ; i--) {
+ mappoint_t* pPoint = g_ptr_array_remove_index_fast(pRoad->m_pPointsArray, i);
+ point_free(pPoint);
+ }
+ g_assert(pRoad->m_pPointsArray->len == 0);
+
+ g_ptr_array_free(pRoad->m_pPointsArray, TRUE);
+
+ // give back to allocator
+ g_free_list_free(g_pRoadFreeList, pRoad);
+}
struct {
gchar* m_pszLong;
Index: road.h
===================================================================
RCS file: /cvs/cairo/roadster/src/road.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- road.h 1 Mar 2005 19:48:21 -0000 1.1
+++ road.h 28 Mar 2005 18:49:50 -0000 1.2
@@ -24,6 +24,20 @@
#ifndef _ROAD_H_
#define _ROAD_H_
+typedef struct {
+ GPtrArray* m_pPointsArray;
+ gchar* m_pszName;
+ gint m_nAddressLeftStart;
+ gint m_nAddressLeftEnd;
+ gint m_nAddressRightStart;
+ gint m_nAddressRightEnd;
+} road_t;
+
+void road_init(void);
+gboolean road_alloc(road_t** ppReturnRoad);
+void road_free(road_t* pRoad);
+
+
// ESuffixLength
typedef enum {
ROAD_SUFFIX_LENGTH_SHORT,
Index: scenemanager.c
===================================================================
RCS file: /cvs/cairo/roadster/src/scenemanager.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- scenemanager.c 10 Mar 2005 11:01:05 -0000 1.9
+++ scenemanager.c 28 Mar 2005 18:49:50 -0000 1.10
@@ -22,6 +22,8 @@
*/
#include <gtk/gtk.h>
+
+#include "main.h"
#include "scenemanager.h"
/*
Index: search.c
===================================================================
RCS file: /cvs/cairo/roadster/src/search.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- search.c 1 Mar 2005 19:48:21 -0000 1.4
+++ search.c 28 Mar 2005 18:49:50 -0000 1.5
@@ -22,6 +22,8 @@
*/
#include <gtk/gtk.h>
+
+#include "main.h"
#include "search.h"
// functions common to all searches
Index: search_location.c
===================================================================
RCS file: /cvs/cairo/roadster/src/search_location.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- search_location.c 14 Mar 2005 02:04:30 -0000 1.7
+++ search_location.c 28 Mar 2005 18:49:50 -0000 1.8
@@ -23,6 +23,8 @@
#include <stdlib.h>
#include <gtk/gtk.h>
+
+#include "main.h"
#include "db.h"
#include "util.h"
#include "search.h"
Index: search_road.c
===================================================================
RCS file: /cvs/cairo/roadster/src/search_road.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- search_road.c 20 Mar 2005 10:57:05 -0000 1.15
+++ search_road.c 28 Mar 2005 18:49:50 -0000 1.16
@@ -25,6 +25,7 @@
#include <math.h>
#include <stdlib.h>
+#include "main.h"
#include "db.h"
#include "util.h"
#include "pointstring.h"
@@ -392,8 +393,8 @@
if(nCount <= SEARCH_RESULT_COUNT_LIMIT) {
pointstring_t* pPointString = NULL;
pointstring_alloc(&pPointString);
-
- db_parse_wkb_pointstring(aRow[3], pPointString, point_alloc);
+
+ db_parse_wkb_linestring(aRow[3], pPointString->m_pPointsArray, point_alloc);
// g_print("raw: %s\n", aRow[3]);
search_road_filter_result(aRow[1], pRoadSearch->m_nNumber, atoi(aRow[2]), atoi(aRow[4]), atoi(aRow[5]), atoi(aRow[6]), atoi(aRow[7]), aRow[8], aRow[9], aRow[10], aRow[11], aRow[12], aRow[13], pPointString);
Index: searchwindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/searchwindow.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- searchwindow.c 26 Mar 2005 07:51:54 -0000 1.15
+++ searchwindow.c 28 Mar 2005 18:49:50 -0000 1.16
@@ -28,6 +28,7 @@
# include <config.h>
#endif
+#include "main.h"
#include "search_road.h"
#include "search_location.h"
#include "mainwindow.h"
@@ -110,7 +111,7 @@
if(g_SearchWindow.m_nNumResults == 0) {
// insert a "no results" message
- gchar* pszBuffer = g_strdup_printf("<span size='small'><i>Your search did not match any\nstreets or Points of Interest.</i></span>", pszSearch);
+ gchar* pszBuffer = g_strdup_printf("<span size='small'><i>No results.</i></span>", pszSearch);
GtkTreeIter iter;
gtk_list_store_append(g_SearchWindow.m_pResultsListStore, &iter);
gtk_list_store_set(g_SearchWindow.m_pResultsListStore, &iter,
@@ -174,7 +175,7 @@
if(!bClickable) return; // XXX: is this the right way to make a treeview item not clickable?
mainwindow_map_slide_to_mappoint(&pt);
- mainwindow_set_zoomlevel(nZoomLevel);
+ //mainwindow_set_zoomlevel(nZoomLevel);
mainwindow_draw_map(DRAWFLAG_ALL);
}
}
Index: tooltip.c
===================================================================
RCS file: /cvs/cairo/roadster/src/tooltip.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- tooltip.c 23 Mar 2005 09:21:49 -0000 1.1
+++ tooltip.c 28 Mar 2005 18:49:50 -0000 1.2
@@ -22,6 +22,8 @@
*/
#include <gtk/gtk.h>
+
+#include "main.h"
#include "tooltip.h"
void tooltip_init()
Index: track.c
===================================================================
RCS file: /cvs/cairo/roadster/src/track.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- track.c 20 Mar 2005 10:57:05 -0000 1.5
+++ track.c 28 Mar 2005 18:49:50 -0000 1.6
@@ -22,6 +22,7 @@
*/
#include <gtk/gtk.h>
+#include "main.h"
#include "map.h"
#include "pointstring.h"
#include "point.h"
Index: util.c
===================================================================
RCS file: /cvs/cairo/roadster/src/util.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- util.c 4 Mar 2005 09:27:26 -0000 1.4
+++ util.c 28 Mar 2005 18:49:50 -0000 1.5
@@ -21,6 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include "main.h"
#include "util.h"
void util_close_parent_window(GtkWidget* pWidget, gpointer data)
Index: util.h
===================================================================
RCS file: /cvs/cairo/roadster/src/util.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- util.h 13 Mar 2005 23:31:21 -0000 1.6
+++ util.h 28 Mar 2005 18:49:50 -0000 1.7
@@ -34,7 +34,6 @@
void util_random_color(void* pColor);
-//#define ENABLE_TIMING
#ifdef ENABLE_TIMING
#define TIMER_BEGIN(name, str) GTimer* name = g_timer_new(); g_print("\n%s (%f)\n", str, g_timer_elapsed(name, NULL))
Index: welcomewindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/welcomewindow.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- welcomewindow.c 18 Mar 2005 08:37:35 -0000 1.5
+++ welcomewindow.c 28 Mar 2005 18:49:50 -0000 1.6
@@ -28,6 +28,8 @@
#endif
#include <gtk/gtk.h>
+
+#include "main.h"
#include "mainwindow.h"
#include "welcomewindow.h"
More information about the cairo-commit
mailing list