[cairo-commit] roadster/src db.c, 1.2, 1.3 import_tiger.c, 1.1.1.1, 1.2 importwindow.c, 1.1.1.1, 1.2 layers.c, 1.1.1.1, 1.2 map.c, 1.1.1.1, 1.2 search_road.c, 1.2, 1.3

Ian McIntosh commit at pdx.freedesktop.org
Sat Feb 19 06:18:34 PST 2005


Committed by: ian

Update of /cvs/cairo/roadster/src
In directory gabe:/tmp/cvs-serv25439/src

Modified Files:
	db.c import_tiger.c importwindow.c layers.c map.c 
	search_road.c 
Log Message:
db.c: Removed check for unused database table when determining if the DB is empty
import_tiger.c: Fixed coordinate parsing bug for the longest possible values (-100 or less)
map.c: Changed ratios to create new closer zoom level
layers.c: Changed some style settings to support new closer zoom level
search_road.c: Added proper check for glib 2.6 instead of using #if 0 or #if 1


Index: db.c
===================================================================
RCS file: /cvs/cairo/roadster/src/db.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- db.c	18 Feb 2005 21:44:33 -0000	1.2
+++ db.c	19 Feb 2005 14:18:32 -0000	1.3
@@ -20,7 +20,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
- 
+
 #include <mysql.h>
 
 #if HAVE_MYSQL_EMBED
@@ -43,7 +43,7 @@
 Notes on the database:
 	- MySQL uses an R-TREE to find the data we want, this is fast
 
-	For a query that matches 690 of 85840 rows: 
+	For a query that matches 690 of 85840 rows:
 	- The query takes about 0.03 seconds
 	- Clearing out previous query's data takes about 0.001 seconds
 	- Retrieving and storing rows takes about 0.07 seconds
@@ -192,9 +192,7 @@
 
 gboolean db_is_empty()
 {
-	return 	(db_count_table_rows(DB_ROADS_TABLENAME) == 0) &&
-			(db_count_table_rows(DB_FEATURES_TABLENAME) == 0);
-			//(db_count_table_rows(g_pDB, DB_LOCATIONS_TABLENAME) == 0) &&
+	return 	(db_count_table_rows(DB_ROADS_TABLENAME) == 0);
 }
 
 /******************************************************
@@ -392,7 +390,7 @@
 	gint nActiveLayerCount = 0;
 	gint i;
 	for(i=LAYER_FIRST ; i <= LAYER_LAST ;i++) {
-		if(g_aLayers[i].m_Style.m_aSubLayers[0].m_afLineWidths[nZoomLevel-1] != 0.0 || 
+		if(g_aLayers[i].m_Style.m_aSubLayers[0].m_afLineWidths[nZoomLevel-1] != 0.0 ||
 		   g_aLayers[i].m_Style.m_aSubLayers[1].m_afLineWidths[nZoomLevel-1] != 0.0)
 		{
 			gchar azLayerNumber[10];
@@ -605,7 +603,7 @@
 	//~ ID INT8 UNSIGNED NOT NULL AUTO_INCREMENT,
 	//~ SetID INT4 UNSIGNED NOT NULL,
 
-	//~ Coordinates POINT NOT NULL, 
+	//~ Coordinates POINT NOT NULL,
 	//~ PRIMARY KEY(ID),
 	//~ SPATIAL INDEX(Coordinates)
 //~ );
@@ -617,7 +615,7 @@
 
 	//~ // generate SQL
 	//~ gchar azQuery[MAX_SQLBUFFER_LEN];
-	//~ g_snprintf(azQuery, MAX_SQLBUFFER_LEN, "CREATE TABLE points_%s (ID INT8 UNSIGNED NOT NULL AUTO_INCREMENT, Coordinates POINT NOT NULL, PRIMARY KEY(ID, SPATIAL INDEX(Coordinates));", 
+	//~ g_snprintf(azQuery, MAX_SQLBUFFER_LEN, "CREATE TABLE points_%s (ID INT8 UNSIGNED NOT NULL AUTO_INCREMENT, Coordinates POINT NOT NULL, PRIMARY KEY(ID, SPATIAL INDEX(Coordinates));",
 		//~ szDatasetName);
 
 	//~ // execute and return status
@@ -678,8 +676,8 @@
 
 	// Road_RoadName
 	db_query("CREATE TABLE IF NOT EXISTS Road_RoadName("
-		" RoadID INT4 UNSIGNED NOT NULL," 
-		" RoadNameID INT4 UNSIGNED NOT NULL," 
+		" RoadID INT4 UNSIGNED NOT NULL,"
+		" RoadNameID INT4 UNSIGNED NOT NULL,"
 		" PRIMARY KEY (RoadID, RoadNameID),"
 		" INDEX(RoadNameID));", NULL);
 
@@ -689,7 +687,7 @@
 		" LocationSetID INT4 NOT NULL,"
 		" Coordinates point NOT NULL,"
 		" PRIMARY KEY (ID),"
-		" INDEX(LocationSetID)," 
+		" INDEX(LocationSetID),"
 		" SPATIAL KEY (Coordinates));", NULL);
 
 	// Location Attribute Name

Index: import_tiger.c
===================================================================
RCS file: /cvs/cairo/roadster/src/import_tiger.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- import_tiger.c	18 Feb 2005 04:22:51 -0000	1.1.1.1
+++ import_tiger.c	19 Feb 2005 14:18:32 -0000	1.2
@@ -23,13 +23,13 @@
  
 // See TGR2003.PDF page 208 for county list
 
+#include <string.h>
+#include <gnome-vfs-2.0/libgnomevfs/gnome-vfs.h>
+
 #include "../include/util.h"
 #include "../include/import_tiger.h"
 #include "../include/importwindow.h"
 
-#include <gnome-vfs-2.0/libgnomevfs/gnome-vfs.h>
-
-
 #define TIGER_RT1_LINE_LENGTH 				(230)
 #define TIGER_RT2_LINE_LENGTH				(210)
 #define TIGER_RT7_LINE_LENGTH				(76)
@@ -123,7 +123,15 @@
 	gint8 buffer[10];
 	memcpy(buffer, pBuffer, 9);
 	buffer[9] = '\0';
-	gdouble fVal = atof(buffer);
+
+	gint* pEnd;
+	gdouble fVal = strtod(buffer, &pEnd);
+	if(pEnd == buffer) {
+		// if the pointer hasn't moved, it's a parsing error
+		g_assert_not_reached();
+	}
+//	gdouble fVal = atof(buffer);
+	
 	fVal /= 1000000.0;
 	*pValue = fVal;
 	return TRUE;
@@ -416,7 +424,7 @@
 		import_tiger_read_string(&pLine[50-1], 4, &achType[0]);
 //		g_print("%30s is type %s\n", pRecord->m_achName, achType);	
 		map_road_suffix_atoi(achType, &pRecord->m_nRoadNameSuffixID);
-		
+
 if(achType[0] != '\0' && pRecord->m_nRoadNameSuffixID == ROAD_SUFFIX_NONE) {
 	g_print("type '%s' couldn't be looked up\n", achType);
 }
@@ -426,10 +434,10 @@
 		//~ g_print("name: '%s' (%d)\n", pRecord->m_achName, nFeatureType);
 
  		// lat/lon coordinates...
-		import_tiger_read_float(&pLine[191], &pRecord->m_PointA.m_fLongitude);
-		import_tiger_read_float(&pLine[201], &pRecord->m_PointA.m_fLatitude);
-		import_tiger_read_float(&pLine[210], &pRecord->m_PointB.m_fLongitude);
-		import_tiger_read_float(&pLine[220], &pRecord->m_PointB.m_fLatitude);
+		import_tiger_read_float(&pLine[191-1], &pRecord->m_PointA.m_fLongitude);
+		import_tiger_read_float(&pLine[201-1], &pRecord->m_PointA.m_fLatitude);
+		import_tiger_read_float(&pLine[210-1], &pRecord->m_PointB.m_fLongitude);
+		import_tiger_read_float(&pLine[220-1], &pRecord->m_PointB.m_fLatitude);
 
 		// add to table
 		g_hash_table_insert(pTable, &pRecord->m_nTLID, pRecord);
@@ -445,9 +453,6 @@
 
 		gchar* pLine = &pBuffer[i];
 
-		/*
-		** read fixed fields
-		*/
 		// columns 6 to 15 is the TLID - 
 		gint nTLID;
 		import_tiger_read_int(&pLine[6-1], TIGER_TLID_LENGTH, &nTLID);
@@ -884,7 +889,7 @@
 	gint i;
 	gboolean bSuccess = TRUE;
 	for(i=0 ; i<NUM_ELEMS(apszExtensions) ; i++) {
-		pszFilePath = g_strdup_printf("file://%s/TGR%d.%s", pszDirectoryPath, nTigerSetNumber, apszExtensions[i]);
+		pszFilePath = g_strdup_printf("file://%s/TGR%05d.%s", pszDirectoryPath, nTigerSetNumber, apszExtensions[i]);
 		if(GNOME_VFS_OK != gnome_vfs_read_entire_file(pszFilePath, &nSizes[i], (char**)&apBuffers[i])) {
 			bSuccess = FALSE;
 		}

Index: importwindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/importwindow.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- importwindow.c	18 Feb 2005 04:22:52 -0000	1.1.1.1
+++ importwindow.c	19 Feb 2005 14:18:32 -0000	1.2
@@ -20,7 +20,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
- 
+
 #include <glade/glade.h>
 #include <gnome.h>
 #include "../include/db.h"
@@ -129,8 +129,8 @@
 	GTK_PROCESS_MAINLOOP;
 
 	// redraw map to show any potential new data (?)
-	
-	map_set_zoomlevel(7);
+
+//	map_set_zoomlevel(7);
 	mainwindow_draw_map();
 }
 

Index: layers.c
===================================================================
RCS file: /cvs/cairo/roadster/src/layers.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- layers.c	18 Feb 2005 04:22:52 -0000	1.1.1.1
+++ layers.c	19 Feb 2005 14:18:32 -0000	1.2
@@ -20,7 +20,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
- 
+
 #include <cairo.h>
 #include "../include/layers.h"
 
@@ -48,10 +48,10 @@
 /* 1 */	{LAYER_MINORSTREET, "Minor Roads",
 			{{
 			/* line widths @ zooms	  	  						 color 									  dash, join, cap	*/
-			{{0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 3.0, 6.0, 10.0,16.0}, {159/255.0, 149/255.0, 127/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND},
-			{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.0, 4.5, 8.5,14.0}, {255/255.0, 251/255.0, 255/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND}
+			{{0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 6.0, 10.0, 16.0,28.0}, {159/255.0, 149/255.0, 127/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND},
+			{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.5,  8.5, 14.5,26.5}, {255/255.0, 251/255.0, 255/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND}
 			}},
-			
+
 			{{0,0,0,0,0,0,0,6,8,10},
 			 {0,0,0,0,0,0,0,1,0,0},
 			 {0,0,0,0}},
@@ -59,19 +59,19 @@
 
 /* 2 */	{LAYER_MAJORSTREET, "Major Roads",
 			{{
-			{{0.0, 0.0, 0.0, 2.0, 3.0, 5.0, 10.0, 14.0, 16.0,18.0}, {173/255.0, 162/255.0, 140/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND},
-			{{0.0, 0.0, 0.0, 1.0, 1.5, 3.7, 8.0, 12.0, 14.0,16.0}, {255/255.0, 251/255.0, 115/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND}
+			{{0.0, 0.0, 2.0, 3.0, 5.0, 10.0, 18.0, 22.0,24.0,32.0}, {173/255.0, 162/255.0, 140/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND},
+			{{0.0, 0.0, 1.0, 1.5, 3.7, 8.0,  16.0, 20.0, 22.0,30.0}, {255/255.0, 251/255.0, 115/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND}
 			}},
-			
+
 			{{0,0,0,0,0,0,0,6,8,10},
 			 {0,0,0,0,0,0,0,1,0,0},
 			 {0,0,0,0}},
 			NULL},
 
-/* 3 */	{LAYER_MINORHIGHWAY, "Minor Highways", 
+/* 3 */	{LAYER_MINORHIGHWAY, "Minor Highways",
 			{{
-			{{0.0, 0.0, 0.0, 4.0, 5.0, 8.0, 9.0, 12.0,18.0,27.0}, {173/255.0, 162/255.0, 140/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND},
-			{{0.0, 0.0, 0.0, 3.5, 4.1, 6.8, 7.5, 10.0, 16.0,25.0}, {255/255.0, 202/255.0, 58/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND}
+			{{0.0, 0.0, 4.0, 5.0, 8.0, 9.0, 17.0,22.0,28.0,36.0}, {173/255.0, 162/255.0, 140/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND},
+			{{0.0, 0.0, 3.5, 4.1, 6.8, 7.5, 15.0,20.0,26.0,34.0}, {255/255.0, 202/255.0, 58/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND}
 			}},
 			
 			{{0,0,0,0,0,0,0,6,8,10},
@@ -79,10 +79,10 @@
 			 {0,0,0,0}},
 			NULL},
 
-/* 4 */	{LAYER_MINORHIGHWAY_RAMP, "Minor Highway Ramps", 
+/* 4 */	{LAYER_MINORHIGHWAY_RAMP, "Minor Highway Ramps",
 			{{
-			{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 5.0,8.0}, {173/255.0, 142/255.0, 33/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND},
-			{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.5, 3.5,6.0}, {247/255.0, 223/255.0, 74/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND}
+			{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 5.0,8.0,10.0}, {173/255.0, 142/255.0, 33/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND},
+			{{0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.5, 3.5,6.0,8.0}, {247/255.0, 223/255.0, 74/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND}
 			}},
 			
 			{{0,0,0,0,0,0,0,6,8,10},
@@ -90,10 +90,10 @@
 			 {0,0,0,0}},
 			NULL},
 
-/* 5 */	{LAYER_MAJORHIGHWAY, "Major Highways", 
+/* 5 */	{LAYER_MAJORHIGHWAY, "Major Highways",
 			{{
-			{{0.0, 0.0, 0.0, 4.0, 10.0, 12.0, 12.0, 12.0,18.0,27.0}, {173/255.0, 162/255.0, 140/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND},
-			{{0.0, 0.0, 0.0, 2.0, 8.5,  10.0,  10.0, 10.0, 16.0,25.0}, {239/255.0, 190/255.0, 33/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND}
+			{{0.0, 0.0, 4.0, 10.0, 12.0, 16.0, 22.0,28.0,34.0,38.0}, {173/255.0, 162/255.0, 140/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND},
+			{{0.0, 0.0, 2.0, 8.5,  10.0, 14.0, 20.0,26.0,32.0,36.0}, {239/255.0, 190/255.0, 33/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND}
 			}},
 			
 			{{0,0,0,0,0,0,0,6,8,10},
@@ -101,10 +101,10 @@
 			 {0,0,0,0}},
 			NULL},
 
-/* 6 */	{LAYER_MAJORHIGHWAY_RAMP, "Major Highway Ramps", 
+/* 6 */	{LAYER_MAJORHIGHWAY_RAMP, "Major Highway Ramps",
 			{{
 			{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0,16.0}, {173/255.0, 162/255.0, 140/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND},
-			{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 5.5,13.0}, {0/255.0, 190/255.0, 0/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND}
+			{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 5.5,14.0}, {0/255.0, 190/255.0, 0/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND}
 			}},
 			
 			{{0,0,0,0,0,0,0,6,8,10},

Index: map.c
===================================================================
RCS file: /cvs/cairo/roadster/src/map.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- map.c	18 Feb 2005 04:22:51 -0000	1.1.1.1
+++ map.c	19 Feb 2005 14:18:32 -0000	1.2
@@ -2,7 +2,7 @@
  *            map.c
  *
  *  Copyright  2005  Ian McIntosh
- *  ian_mcintosh at linuxadvocate.org 
+ *  ian_mcintosh at linuxadvocate.org
  ****************************************************************************/
 
 /*
@@ -20,7 +20,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
- 
+
 #include <gdk/gdkx.h>
 #include <cairo.h>
 #include <gnome.h>
@@ -43,7 +43,7 @@
 	windowdimensions_t 	m_WindowDimensions;					// XXX
 	guint16 			m_uZoomLevel;							// XXX
 	gboolean 			m_bRedrawNeeded;
-} g_Map = 
+} g_Map =
 {
 	{42.29886, -73.24393},
 	{0,0},
@@ -209,24 +209,23 @@
 #define DEG2RAD(x)	((x) * (M_PI / 180.0))
 #define RAD2DEG(x)	((x) * (180.0 / M_PI))
 
-// Each zoomlevel has a scale and an optional name
+// Each zoomlevel has a scale and an optional name (name isn't used for anything)
 zoomlevel_t g_sZoomLevels[NUM_ZOOMLEVELS+1] = {
 	{1,"undefined"}, 	// no zoom level 0
 
-	{ 3200000, "continent"},		// 1, zoomed way out
-	{ 1600000, "country"},			// 2
-	{  800000, ""},					// 3
-	{  400000, "state"},			// 4 
-	{  200000, ""},					// 5
-	{  100000, "region"},			// 6
-	{   50000, ""},					// 7
-	{   25000, "city"}, 			// 8
-	{   10000, ""},					// 9
-	{    4000, "street"},			//10
+	{18000000, "country"},			// 1
+	{ 6000000, ""},					// 2
+	{ 1800000, "state"},			// 3
+	{  600000, ""},					// 4
+	{  200000, "region"},			// 5
+	{   70000, ""},					// 6
+	{   25000, "city"}, 			// 7
+	{   10000, ""},					// 8
+	{    4000, ""},					// 9
+	{    1000, "street"},			//10
 };
 
-
-struct gaga {
+struct {
 	gint nLayer;
 	gint nSubLayer;
 	void (*pFunc)(cairo_t*, rendermetrics_t*, geometryset_t*, sublayerstyle_t*);
@@ -519,7 +518,7 @@
 		fTotalLineLength += fLineLength;
 	}
 
-	gfloat fFontSize = 10.0;
+	gfloat fFontSize = 14.0;
 
 	cairo_save(pCairo);
 	cairo_select_font(pCairo, "Monospace", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
@@ -586,7 +585,7 @@
 		gchar azLabelSegment[DRAW_LABEL_BUFFER_LEN];
 
 		//
-		// Figure out how much of the string we can put in this line segment 
+		// Figure out how much of the string we can put in this line segment
 		//
 		gboolean bFoundWorkableStringLength = FALSE;
 		gint nWorkableStringLength;
@@ -691,7 +690,7 @@
 		//~ cairo_arc(pCairo, fX2, fY2, 3, 0, 2*M_PI);
 		//~ cairo_fill(pCairo);
 
-		// 
+		//
 		cairo_save(pCairo);
 			cairo_move_to(pCairo, fDrawX, fDrawY);
 			cairo_set_rgb_color(pCairo, 0.1,0.1,0.1);
@@ -875,7 +874,9 @@
 		// Render Layers
 		gint iLayerDraw;
 		for(iLayerDraw=0 ; iLayerDraw<NUM_ELEMS(layerdraworder) ; iLayerDraw++) {
-			layerdraworder[iLayerDraw].pFunc(pCairo, pRenderMetrics, g_aLayers[layerdraworder[iLayerDraw].nLayer].m_pGeometrySet, &g_aLayers[layerdraworder[iLayerDraw].nLayer].m_Style.m_aSubLayers[layerdraworder[iLayerDraw].nSubLayer]);
+			layerdraworder[iLayerDraw].pFunc(pCairo, pRenderMetrics,
+				/* geometry */ 	g_aLayers[layerdraworder[iLayerDraw].nLayer].m_pGeometrySet,
+				/* style */ 	&g_aLayers[layerdraworder[iLayerDraw].nLayer].m_Style.m_aSubLayers[layerdraworder[iLayerDraw].nSubLayer]);
 		}
 	TIMER_END(maptimer, "END RENDER MAP");
 
@@ -887,11 +888,12 @@
 			map_draw_layer_points(pCairo, pRenderMetrics, pLocationSet->m_pLocationsArray);
 		}			
 
-#define CROSSHAIR_LINE_RELIEF	(7)
-#define CROSSHAIR_LINE_LENGTH	(15)
+#define CROSSHAIR_LINE_RELIEF	(6)
+#define CROSSHAIR_LINE_LENGTH	(12)
+#define CROSSHAIR_CIRCLE_RADIUS (12)
 
-		cairo_set_line_width(pCairo, 2.5);
-		cairo_set_rgb_color(pCairo, 1.0, 0.0, 0.0);
+		cairo_set_line_width(pCairo, 1.0);
+		cairo_set_rgb_color(pCairo, 0.1, 0.1, 0.1);
 		cairo_set_alpha(pCairo, 1.0);
 
 		// left line
@@ -906,25 +908,10 @@
 		// bottom line
 		cairo_move_to(pCairo, (pRenderMetrics->m_nWindowWidth/2), (pRenderMetrics->m_nWindowHeight/2) + (CROSSHAIR_LINE_RELIEF + CROSSHAIR_LINE_LENGTH));
 		cairo_line_to(pCairo, (pRenderMetrics->m_nWindowWidth/2), (pRenderMetrics->m_nWindowHeight/2) + (CROSSHAIR_LINE_RELIEF));
-		
-		cairo_move_to(pCairo, (pRenderMetrics->m_nWindowWidth/2), 0);
-		cairo_line_to(pCairo, (pRenderMetrics->m_nWindowWidth/2), CROSSHAIR_LINE_LENGTH);
-		cairo_move_to(pCairo, (pRenderMetrics->m_nWindowWidth/2), pRenderMetrics->m_nWindowHeight);
-		cairo_line_to(pCairo, (pRenderMetrics->m_nWindowWidth/2), pRenderMetrics->m_nWindowHeight-CROSSHAIR_LINE_LENGTH);
-		cairo_move_to(pCairo, 0, (pRenderMetrics->m_nWindowHeight/2));
-		cairo_line_to(pCairo, CROSSHAIR_LINE_LENGTH, (pRenderMetrics->m_nWindowHeight/2));
-		cairo_move_to(pCairo, (pRenderMetrics->m_nWindowWidth), (pRenderMetrics->m_nWindowHeight/2));
-		cairo_line_to(pCairo, (pRenderMetrics->m_nWindowWidth-CROSSHAIR_LINE_LENGTH), (pRenderMetrics->m_nWindowHeight/2));
-		
 		cairo_stroke(pCairo);
 
-	//~ // draw map center
-	//~ gfloat fRadius = 10.0;
-	//~ cairo_arc(pCairo, pRenderMetrics->m_nWindowWidth/2, pRenderMetrics->m_nWindowHeight/2, fRadius, 0, 2*M_PI);
-	//~ cairo_set_line_width(pCairo, 3.5);
-	//~ cairo_set_rgb_color(pCairo, 1.0, 0.0, 0.0);
-	//~ cairo_stroke(pCairo);
-		
+		cairo_arc(pCairo, pRenderMetrics->m_nWindowWidth/2, pRenderMetrics->m_nWindowHeight/2, CROSSHAIR_CIRCLE_RADIUS, 0, 2*M_PI);		
+		cairo_stroke(pCairo);
 	cairo_restore(pCairo);
 	TIMER_END(loctimer, "END RENDER LOCATIONS");
 
@@ -1010,7 +997,6 @@
 				cairo_line_to(pCairo, SCALE_X(pRenderMetrics, pPoint->m_fLongitude), SCALE_Y(pRenderMetrics, pPoint->m_fLatitude));
 			}
 			//cairo_close_path(pCairo);
-			cairo_fill(pCairo);
 		}
 		else {
 //			g_print("pPointString->m_pPointsArray->len = %d\n", pPointString->m_pPointsArray->len);
@@ -1043,6 +1029,7 @@
 		//~ }
 		//~ cairo_restore(pCairo);
 	}
+	cairo_fill(pCairo);
 }
 
 void map_draw_layer_lines(cairo_t* pCairo, rendermetrics_t* pRenderMetrics, geometryset_t* pGeometry, sublayerstyle_t* pSubLayerStyle)
@@ -1099,9 +1086,9 @@
 				pPoint = g_ptr_array_index(pPointString->m_pPointsArray, iPoint);//~ g_print("  point (%.05f,%.05f)\n", ScaleX(pPoint->m_fLongitude), ScaleY(pPoint->m_fLatitude));
 				cairo_line_to(pCairo, SCALE_X(pRenderMetrics, pPoint->m_fLongitude), SCALE_Y(pRenderMetrics, pPoint->m_fLatitude));
 			}
-			cairo_stroke(pCairo);
 		}
 	}
+	cairo_stroke(pCairo);
 }
 
 void map_draw_layer_labels(cairo_t* pCairo, rendermetrics_t* pRenderMetrics, geometryset_t* pGeometry, sublayerstyle_t* pSubLayerStyle)

Index: search_road.c
===================================================================
RCS file: /cvs/cairo/roadster/src/search_road.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- search_road.c	18 Feb 2005 21:42:28 -0000	1.2
+++ search_road.c	19 Feb 2005 14:18:32 -0000	1.3
@@ -20,7 +20,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
- 
+
 #include <gtk/gtk.h>
 #include <math.h>
 #include <stdlib.h>
@@ -42,7 +42,8 @@
 #define SEARCH_RESULT_COUNT_LIMIT	(200)		// how many rows to get from DB
 #define MAX_QUERY 	(4000)
 
-#if 0 		// glib < 2.6
+// if glib < 2.6
+#if ((GLIB_MAJOR_VERSION <= 2) || ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 6)))
 gint g_strv_length(const gchar** a)
 {
 	gint nCount=0;
@@ -55,7 +56,6 @@
 }
 #endif
 
-
 // prototypes
 
 void search_road_on_cleaned_sentence(const gchar* pszCleanedSentence);
@@ -155,7 +155,7 @@
 			" OR (%d BETWEEN Road.AddressLeftEnd AND Road.AddressLeftStart)"
 			" OR (%d BETWEEN Road.AddressRightStart AND Road.AddressRightEnd)"
 			" OR (%d BETWEEN Road.AddressRightEnd AND Road.AddressRightStart)"
-			")", pRoadSearch->m_nNumber, pRoadSearch->m_nNumber, 
+			")", pRoadSearch->m_nNumber, pRoadSearch->m_nNumber,
 				 pRoadSearch->m_nNumber, pRoadSearch->m_nNumber);
 	}
 	else {
@@ -196,8 +196,8 @@
 		" %s"
 //		" %s"
 		" ORDER BY RoadName.Name"
-		" LIMIT %d;", pszAddressClause, pszSafeRoadName, pszSuffixClause, 
-			// pszGroupClause, 
+		" LIMIT %d;", pszAddressClause, pszSafeRoadName, pszSuffixClause,
+			// pszGroupClause,
 			SEARCH_RESULT_COUNT_LIMIT + 1);
 	
 	// free strings
@@ -339,9 +339,9 @@
 	if(nRoadNumber == ROADSEARCH_NUMBER_NONE) {
 		pointstring_walk_percentage(pPointString, 0.5, ROADSIDE_CENTER, &ptAddress);
 
-		//~ g_snprintf(azBuffer, BUFFER_SIZE, "(%d-%d,%d-%d) %s %s", 
+		//~ g_snprintf(azBuffer, BUFFER_SIZE, "(%d-%d,%d-%d) %s %s",
 			//~ nAddressLeftStart, nAddressLeftEnd,
-			//~ nAddressRightStart, nAddressRightEnd, 
+			//~ nAddressRightStart, nAddressRightEnd,
 			//~ pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG));
 
 		if(nAddressRightStart == 0 && nAddressRightEnd == 0) {




More information about the cairo-commit mailing list