[cairo-commit] roadster/src geometryset.c, 1.2, 1.3 import.c, 1.2,
1.3 import_tiger.c, 1.3, 1.4 layers.c, 1.2, 1.3 locationset.c,
1.1.1.1, 1.2 mainwindow.c, 1.2, 1.3 map.c, 1.3,
1.4 scenemanager.c, 1.1.1.1, 1.2 search_location.c, 1.1.1.1,
1.2 search_road.c, 1.3, 1.4 searchwindow.c, 1.1.1.1, 1.2
Ian McIntosh
commit at pdx.freedesktop.org
Mon Feb 21 20:47:27 PST 2005
- Previous message: [cairo-commit] roadster/include layers.h, 1.1.1.1,
1.2 scenemanager.h, 1.1.1.1, 1.2 util.h, 1.1.1.1, 1.2
- Next message: [cairo-commit] roadster ChangeLog,1.10,1.11 configure.in,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: ian
Update of /cvs/cairo/roadster/src
In directory gabe:/tmp/cvs-serv30300/src
Modified Files:
geometryset.c import.c import_tiger.c layers.c locationset.c
mainwindow.c map.c scenemanager.c search_location.c
search_road.c searchwindow.c
Log Message:
roadster.glade: Removed sidebar search, put search field in toolbar.
search_road.c: Added room for city, state, zip to search results.
layers.h: Added LAYER_MISC_AREA for schools, hospitals, etc. Added "bold" setting for layer font style.
scenemanager.c: Added beginning of a scenemanager to handle font layout.
import.c: Don't disable database indexes during import (may be causing flaky behavior)
import_tiger.c: Fixed 'nan' import bug. Fixed bug in polygon stitching. Added check for county boundaries (currently unused). Added check for LAYER_MISC_AREA type. Added support for LAYER_RIVER.
layers.c: Added LAYER_MISC_AREA style. Added font styles to all layers.
mainwindow.c: Changed cairo include path from <cairo/cairo.h> to <cairo.h>
map.c: Added #define to hack around Cairo line cap bug. Tweaked zoom level. Added support for label styles.
Index: geometryset.c
===================================================================
RCS file: /cvs/cairo/roadster/src/geometryset.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- geometryset.c 20 Feb 2005 14:58:46 -0000 1.2
+++ geometryset.c 22 Feb 2005 04:47:24 -0000 1.3
@@ -26,6 +26,7 @@
*/
#include <gtk/gtk.h>
+#include <string.h>
#include "../include/geometryset.h"
#include "../include/map.h"
#include "../include/util.h"
@@ -162,7 +163,7 @@
gint nZoomLevel = map_get_zoomlevel();
- TIMER_BEGIN(mytimer, "BEGIN DB LOAD");
+ TIMER_BEGIN(mytimer, "BEGIN Geometry LOAD");
// HACKY: make a list of layer IDs "2,3,5,6"
gchar azLayerNumberList[200] = {0};
@@ -201,7 +202,6 @@
pRect->m_B.m_fLatitude, pRect->m_A.m_fLongitude, // bottom left
pRect->m_A.m_fLatitude, pRect->m_A.m_fLongitude // upper left again
);
- TIMER_SHOW(mytimer, "after SQL generation");
//g_print("sql: %s\n", pszSQL);
db_query(pszSQL, &pResultSet);
@@ -259,7 +259,7 @@
db_free_result(pResultSet);
TIMER_SHOW(mytimer, "after free results");
- TIMER_END(mytimer, "END DB LOAD");
+ TIMER_END(mytimer, "END Geometry LOAD");
return TRUE;
}
Index: import.c
===================================================================
RCS file: /cvs/cairo/roadster/src/import.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- import.c 20 Feb 2005 14:58:46 -0000 1.2
+++ import.c 22 Feb 2005 04:47:24 -0000 1.3
@@ -21,6 +21,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include <stdlib.h>
+#include <stdio.h>
#include <gtk/gtk.h>
#include "../include/importwindow.h"
#include "../include/import_tiger.h"
@@ -60,9 +62,9 @@
gint nTigerSetNumber = atoi(buf);
// just assume it's a TIGER file for now since it's all we support
- db_disable_keys();
+// db_disable_keys();
bResult = import_tiger_from_uri(pszURI, nTigerSetNumber);
- db_enable_keys();
+// db_enable_keys();
if(bResult) {
importwindow_log_append("success.\n\n");
Index: import_tiger.c
===================================================================
RCS file: /cvs/cairo/roadster/src/import_tiger.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- import_tiger.c 20 Feb 2005 14:58:46 -0000 1.3
+++ import_tiger.c 22 Feb 2005 04:47:24 -0000 1.4
@@ -69,6 +69,9 @@
gint m_nAddressRightEnd;
char m_achName[TIGER_CHAIN_NAME_LEN + 1];
gint m_nRoadNameSuffixID;
+
+ gint m_nCountyIDLeft; // if left and right are in diff counties, we've found a boundary line!
+ gint m_nCountyIDRight;
} tiger_record_rt1_t;
#define TIGER_RT2_MAX_POINTS (10)
@@ -109,6 +112,8 @@
GHashTable* m_pTableRTi;
GHashTable* m_pTableRT7;
GHashTable* m_pTableRT8;
+
+ GPtrArray* m_pBoundaryRT1s;
} tiger_import_process_t;
// indexed by POLYID
@@ -288,10 +293,24 @@
//~ return TRUE;
//~ }
//~ else
+ /*
+ D8* open spaces
+ D81 golf courses
+ D82 Cemetery
+ D83 National Park
+ D84 National forest
+ D85 State or local park or forest
+ */
if(chCode == '8') {
*pValue = LAYER_PARK;
return TRUE;
}
+ else {
+ *pValue = LAYER_MISC_AREA;
+ return TRUE;
+ }
+
+ // TODO: Add 'misc areas' to get all this stuff?
/*
D21 Apartment building
D24 Marina
@@ -310,13 +329,7 @@
D52 train station
D53 bus terminal
D54 marine terminal
-
- D8* open spaces
- D81 golf courses
- D82 Cemetery
- D83 National Park
- D84 National forest
- D85 State or local park or forest
+
*/
}
else if(chFeatureClass == 'E') { // topographic
@@ -328,9 +341,19 @@
// g_print("found topographic (E%c%c)\n", chCode, chSubCode);
}
else if(chFeatureClass == 'H') { // water
+
if(chCode == '0') {
- *pValue = LAYER_LAKE;
- return TRUE;
+ // generic unknown water ...
+ // this includes charles river (cambridge/boston ma)
+ // but they are badly formed for some reason?
+// *pValue = LAYER_LAKE;
+// return TRUE;
+// return FALSE;
+ if(chSubCode == '1') {
+ // these need to be stitched by lat/lon
+ //*pValue = LAYER_LAKE; // shoreline of perennial water feature
+ //return TRUE;
+ }
}
else if(chCode == '1') { // streams
*pValue = LAYER_RIVER;
@@ -418,7 +441,7 @@
// See TGR2003.PDF page 186 for field description
-gboolean import_tiger_parse_table_1(gchar* pBuffer, gint nLength, GHashTable* pTable)
+gboolean import_tiger_parse_table_1(gchar* pBuffer, gint nLength, GHashTable* pTable, GPtrArray* pBoundaryRT1s)
{
gint i;
for(i=0 ; i<(nLength-TIGER_RT1_LINE_LENGTH) ; i+=TIGER_RT1_LINE_LENGTH) {
@@ -453,6 +476,13 @@
g_print("type '%s' couldn't be looked up\n", achType);
}
+ import_tiger_read_int(&pLine[135-1], 3, &pRecord->m_nCountyIDLeft);
+ import_tiger_read_int(&pLine[138-1], 3, &pRecord->m_nCountyIDRight);
+
+ if(pRecord->m_nCountyIDLeft != pRecord->m_nCountyIDRight) {
+ g_ptr_array_add(pBoundaryRT1s, pRecord);
+ // g_print("county boundary\n");
+ }
//~ gint nFeatureType;
//~ import_tiger_read_int(&pLine[50-1], 4, &nFeatureType);
//~ g_print("name: '%s' (%d)\n", pRecord->m_achName, nFeatureType);
@@ -528,9 +558,8 @@
// 22-24 is a CFCC (
gint nRecordType;
- if(!import_tiger_read_layer_type(&pLine[22-1], &nRecordType)) {
- continue;
- }
+
+ import_tiger_read_layer_type(&pLine[22-1], &nRecordType);
pRecord = g_new0(tiger_record_rt7_t, 1);
pRecord->m_nRecordType = nRecordType;
@@ -538,6 +567,10 @@
import_tiger_read_int(&pLine[11-1], TIGER_LANDID_LENGTH, &pRecord->m_nLANDID);
import_tiger_read_string(&pLine[25-1], TIGER_LANDMARK_NAME_LEN, &pRecord->m_achName[0]);
+
+ if(nRecordType == LAYER_MISC_AREA) {
+ g_print("misc area: %s\n", pRecord->m_achName);
+ }
// g_print("record 7: TypeID=%d LANDID=%d\n", pRecord->m_nRecordType, pRecord->m_nLANDID);
//g_print("name: '%s'\n", pRecord->m_achName);
@@ -558,10 +591,10 @@
tiger_record_rt8_t* pRecord;
pRecord = g_new0(tiger_record_rt8_t, 1);
- // columns 16 to 25 is the TLID -
+ // columns 16 to 25 is the POLYGON ID -
import_tiger_read_int(&pLine[16-1], TIGER_POLYID_LENGTH, &pRecord->m_nPOLYID);
-
- // columns 26 to 35 is the TLID -
+
+ // columns 26 to 35 is the LANDMARK ID -
import_tiger_read_int(&pLine[26-1], TIGER_LANDID_LENGTH, &pRecord->m_nLANDID);
// g_print("record 8: POLYID=%d LANDID=%d\n", pRecord->m_nPOLYID, pRecord->m_nLANDID);
@@ -575,7 +608,9 @@
gboolean import_tiger_parse_table_i(gint8* pBuffer, gint nLength, GHashTable *pTable)
{
- g_print("nLength = %d, TIGER_RTi_LINE_LENGTH = %d\n", nLength, TIGER_RTi_LINE_LENGTH);
+ //
+ // Gather RTi records (chainID,TZID-A,TZID-B) and index them by POLYGON ID in the given hash table
+ //
gint i;
for(i=0 ; i<(nLength-TIGER_RTi_LINE_LENGTH) ; i+=TIGER_RTi_LINE_LENGTH) {
gchar* pLine = &pBuffer[i];
@@ -600,6 +635,12 @@
gint nZeroCellB;
import_tiger_read_int(&pLine[31-1], TIGER_ZEROCELL_LENGTH, &nZeroCellB);
+ if(nZeroCellA == nZeroCellB) {
+ // we can't link this with anything..?
+ g_print("nZeroCellA == nZeroCellB\n");
+ continue;
+ }
+
if(nLeftPolygonID != 0) {
// is there an existing RTi for this POLYID?
pRecord = g_hash_table_lookup(pTable, &nLeftPolygonID); // RTi is indexed by polygon ID
@@ -622,7 +663,6 @@
pNewRT1Link->m_nPointATZID = nZeroCellA;
pNewRT1Link->m_nPointBTZID = nZeroCellB;
g_ptr_array_add(pRecord->m_pRT1LinksArray, pNewRT1Link);
- //g_print("length: %d\n", pRecord->m_pTLIDArray->len);
}
if(nRightPolygonID != 0) {
pRecord = g_hash_table_lookup(pTable, &nRightPolygonID);
@@ -737,26 +777,35 @@
{
static int nCallCount=0; nCallCount++;
if((nCallCount%CALLBACKS_PER_PULSE) == 0) importwindow_progress_pulse();
-
+
tiger_import_process_t* pImportProcess = (tiger_import_process_t*)user_data;
g_assert(pImportProcess != NULL);
+
+ //
+ // pRecordRTi has an array of RT1 chains that make up this polygon.
+ // our job here is to stitch them together.
+ //
tiger_record_rti_t* pRecordRTi = (tiger_record_rti_t*)value;
g_assert(pRecordRTi != NULL);
- // lookup table8 record by TLID
+ // lookup table8 (polygon-landmark link) record by POLYID
tiger_record_rt8_t* pRecordRT8 = g_hash_table_lookup(pImportProcess->m_pTableRT8, &pRecordRTi->m_nPOLYID);
if(pRecordRT8 == NULL) return; // allowed to be null(?)
- // lookup table7 record by LANDID
+ // lookup table7 (landmark) record by LANDID
tiger_record_rt7_t* pRecordRT7 = g_hash_table_lookup(pImportProcess->m_pTableRT7, &pRecordRT8->m_nLANDID);
if(pRecordRT7 == NULL) return; // allowed to be null(?)
- // create a temp array to hold the points for this polygon (in order)
- GPtrArray* pTempPointsArray = g_ptr_array_new();
+ // now we have landmark data (name, type)
g_assert(pRecordRTi->m_pRT1LinksArray != NULL);
g_assert(pRecordRTi->m_pRT1LinksArray->len >= 1);
+ GPtrArray* pTempPointsArray = NULL;
+ // create a temp array to hold the points for this polygon (in order)
+ g_assert(pTempPointsArray == NULL);
+ pTempPointsArray = g_ptr_array_new();
+
// start with the RT1Link at index 0 (and remove it)
tiger_rt1_link_t* pCurrentRT1Link = g_ptr_array_index(pRecordRTi->m_pRT1LinksArray, 0);
g_ptr_array_remove_index(pRecordRTi->m_pRT1LinksArray, 0); // TODO: should maybe choose the last one instead? :) easier to remove and arbitrary anyway!
@@ -779,12 +828,14 @@
gint iRT1Link;
for(iRT1Link=0 ; iRT1Link < pRecordRTi->m_pRT1LinksArray->len ; iRT1Link++) {
tiger_rt1_link_t* pNextRT1Link = g_ptr_array_index(pRecordRTi->m_pRT1LinksArray, iRT1Link);
+
if(nLastTZID == pNextRT1Link->m_nPointATZID) {
// add pNextRT1Link's points in order (A->B)
-
// this (pNextRT1Link) RT1Link becomes the new "current"
// remove it from the array!
g_ptr_array_remove_index(pRecordRTi->m_pRT1LinksArray, iRT1Link);
+ iRT1Link--; // undo the next ++ in the for loop
+
// we're done forever with the old 'current'
// (the RT1 it links to has already had its points copied to the list!)
g_free(pCurrentRT1Link);
@@ -801,8 +852,10 @@
else if(nLastTZID == pNextRT1Link->m_nPointBTZID) {
// add pNextRT1Link's points in REVERSE order (B->A)
// (otherwise same as above)
-
+
g_ptr_array_remove_index(pRecordRTi->m_pRT1LinksArray, iRT1Link);
+ iRT1Link--; // undo the next ++ in the for loop
+
g_free(pCurrentRT1Link);
pCurrentRT1Link = pNextRT1Link;
@@ -816,15 +869,25 @@
}
}
if(bFound == FALSE) {
- break; // out of while() loop
+ // no next domino-match
+ break; // inner while() loop
}
// else loop and attempt to find next RT1 whose points we should append
}
- // leftovers
g_assert(pCurrentRT1Link != NULL);
g_free(pCurrentRT1Link);
+ // save this polygon
if(pTempPointsArray->len > 3) { // takes 3 to make a polygon
+ g_print("inserting polygon of len %d type %s\n", pTempPointsArray->len, g_aLayers[pRecordRT7->m_nRecordType].m_pszName);
+
+ mappoint_t* p1 = g_ptr_array_index(pTempPointsArray, 0);
+ mappoint_t* p2 = g_ptr_array_index(pTempPointsArray, pTempPointsArray->len-1);
+
+ if(p1->m_fLatitude != p2->m_fLatitude || p1->m_fLongitude != p2->m_fLongitude) {
+ g_print("doesn't loop\n");
+ }
+
// insert record
if(pRecordRT7->m_nRecordType != LAYER_NONE) {
gint nRoadID;
@@ -833,14 +896,17 @@
pTempPointsArray, &nRoadID);
}
}
+ g_ptr_array_free(pTempPointsArray, FALSE);
- // we SHOULD have used all RT1 links up! (no?)
- while(pRecordRTi->m_pRT1LinksArray->len > 0) {
- tiger_rt1_link_t* pTemp = g_ptr_array_remove_index(pRecordRTi->m_pRT1LinksArray, 0);
-// g_print("couldn't link RT1Link (A-TZID:%d B-TZID:%d)\n", pTemp->m_nPointATZID, pTemp->m_nPointBTZID);
- g_free( pTemp );
+ // we SHOULD have used all RT1 links up!
+ if(pRecordRTi->m_pRT1LinksArray->len > 0) {
+ g_warning("RT1 Links remain:\n");
+ while(pRecordRTi->m_pRT1LinksArray->len > 0) {
+ tiger_rt1_link_t* pTemp = g_ptr_array_remove_index(pRecordRTi->m_pRT1LinksArray, 0);
+ g_print(" (A-TZID:%d B-TZID:%d)\n", pTemp->m_nPointATZID, pTemp->m_nPointBTZID);
+ g_free( pTemp );
+ }
}
- g_ptr_array_free(pTempPointsArray, FALSE);
}
//
@@ -966,10 +1032,13 @@
importwindow_log_append(".");
importwindow_progress_pulse();
-
+
+ // a list of RT1 records that make up the boundary of this county
+ importProcess.m_pBoundaryRT1s = g_ptr_array_new();
+
g_print("parsing RT1\n");
importProcess.m_pTableRT1 = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, NULL);
- import_tiger_parse_table_1(pBufferRT1, nLengthRT1, importProcess.m_pTableRT1);
+ import_tiger_parse_table_1(pBufferRT1, nLengthRT1, importProcess.m_pTableRT1, importProcess.m_pBoundaryRT1s);
g_print("RT1: %d records\n", g_hash_table_size(importProcess.m_pTableRT1));
importwindow_log_append(".");
Index: layers.c
===================================================================
RCS file: /cvs/cairo/roadster/src/layers.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- layers.c 19 Feb 2005 14:18:32 -0000 1.2
+++ layers.c 22 Feb 2005 04:47:24 -0000 1.3
@@ -36,123 +36,146 @@
/* 0 */ {0, "UNUSED LAYER",
{{
/* line widths @ zooms color dash, join, cap */
- {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {0/255.0, 0/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, 0.0, 0.0, 0.0, 0.0}, {0/255.0, 0/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, 0.0, 0.0, 0.0, 0.0}, {0/255.0, 0/255.0, 0/255.0, 1.00}, 0, CAIRO_LINE_JOIN_MITER, CAIRO_LINE_CAP_BUTT},
+ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {0/255.0, 0/255.0, 0/255.0, 1.00}, 0, CAIRO_LINE_JOIN_MITER, CAIRO_LINE_CAP_BUTT}
}},
-
- {{0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0},
+
+ {{0,0,0,0,0,0,0,0,0,0}, /* font size */
+ {0,0,0,0,0,0,0,0,0,0}, /* bold */
+ {0,0,0,0,0,0,0,0,0,0}, /* halo */
{0,0,0,0}},
NULL},
/* 1 */ {LAYER_MINORSTREET, "Minor Roads",
{{
/* line widths @ zooms color dash, join, cap */
- {{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.0, 0.0, 0.0, 6.0, 12.0, 18.0,36.0}, {159/255.0, 149/255.0, 127/255.0, 1.00}, 0, CAIRO_LINE_JOIN_MITER, CAIRO_LINE_CAP_ROUND},
+ {{0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 4.5, 10.5, 16.5,34.5}, {255/255.0, 251/255.0, 255/255.0, 1.00}, 0, CAIRO_LINE_JOIN_MITER, 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,0,0,0,8,14,25}, /* font size */
+ {0,0,0,0,0,0,0,0,0,0}, /* bold */
+ {0,0,0,0,0,0,0,0,0,0}, /* halo */
{0,0,0,0}},
NULL},
/* 2 */ {LAYER_MAJORSTREET, "Major Roads",
{{
- {{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, 2.0, 3.0, 5.0, 10.0, 14.0, 17.0, 24.0,32.0}, {173/255.0, 162/255.0, 140/255.0, 1.00}, 0, CAIRO_LINE_JOIN_MITER, CAIRO_LINE_CAP_BUTT},
+ {{0.0, 0.0, 1.8, 2.5, 4.3, 9.0, 13.0, 15.5, 22.0,30.0}, {255/255.0, 251/255.0, 115/255.0, 1.00}, 0, CAIRO_LINE_JOIN_MITER, CAIRO_LINE_CAP_BUTT}
}},
- {{0,0,0,0,0,0,0,6,8,10},
- {0,0,0,0,0,0,0,1,0,0},
+ {{0,0,0,0,0,6,8,10,16,26}, /* font size */
+ {0,0,0,0,0,1,1,1,1,1}, /* bold */
+ {0,0,0,0,0,0,0,0,0,0}, /* halo */
{0,0,0,0}},
NULL},
/* 3 */ {LAYER_MINORHIGHWAY, "Minor Highways",
{{
- {{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, 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_MITER, CAIRO_LINE_CAP_BUTT},
+ {{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_MITER, CAIRO_LINE_CAP_BUTT}
}},
- {{0,0,0,0,0,0,0,6,8,10},
- {0,0,0,0,0,0,0,1,0,0},
+ {{0,0,0,0,0,0,8,8,10,18}, /* font size */
+ {0,0,0,0,0,0,0,0,0,0}, /* bold */
+ {0,0,0,0,0,0,0,0,0,0}, /* halo */
{0,0,0,0}},
NULL},
/* 4 */ {LAYER_MINORHIGHWAY_RAMP, "Minor Highway Ramps",
{{
- {{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.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_MITER, CAIRO_LINE_CAP_BUTT},
+ {{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_MITER, CAIRO_LINE_CAP_BUTT}
}},
- {{0,0,0,0,0,0,0,6,8,10},
- {0,0,0,0,0,0,0,1,0,0},
+ {{0,0,0,0,0,0,8,8,10,18}, /* font size */
+ {0,0,0,0,0,0,0,0,0,0}, /* bold */
+ {0,0,0,0,0,0,0,0,0,0}, /* halo */
{0,0,0,0}},
NULL},
/* 5 */ {LAYER_MAJORHIGHWAY, "Major Highways",
{{
- {{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, 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_MITER, CAIRO_LINE_CAP_BUTT},
+ {{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_MITER, CAIRO_LINE_CAP_BUTT}
}},
- {{0,0,0,0,0,0,0,6,8,10},
- {0,0,0,0,0,0,0,1,0,0},
+ {{0,0,0,0,0,0,8,8,10,18}, /* font size */
+ {0,0,0,0,0,0,0,0,0,0}, /* bold */
+ {0,0,0,0,0,0,0,0,0,0}, /* halo */
{0,0,0,0}},
NULL},
/* 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,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.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_MITER, CAIRO_LINE_CAP_BUTT},
+ {{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_MITER, CAIRO_LINE_CAP_BUTT}
}},
-
- {{0,0,0,0,0,0,0,6,8,10},
- {0,0,0,0,0,0,0,1,0,0},
+
+ {{0,0,0,0,0,0,0,0,0,0}, /* font size */
+ {0,0,0,0,0,0,0,0,0,0}, /* bold */
+ {0,0,0,0,0,0,0,0,0,0}, /* halo */
{0,0,0,0}},
NULL},
/* 7 */ {LAYER_RAILROAD, "Railroads",
{{
- {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.6, 0.6, 0.6, 1.2}, {80/255.0, 80/255.0, 110/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_BUTT},
- {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 3.0, 4.0, 7.0}, {80/255.0, 80/255.0, 110/255.0, 1.00}, 1, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_BUTT}
+ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.6, 0.6, 0.6, 1.2}, {80/255.0, 80/255.0, 110/255.0, 1.00}, 0, CAIRO_LINE_JOIN_MITER, CAIRO_LINE_CAP_BUTT},
+ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 3.0, 4.0, 7.0}, {80/255.0, 80/255.0, 110/255.0, 1.00}, 1, CAIRO_LINE_JOIN_MITER, CAIRO_LINE_CAP_BUTT}
}},
- {{0,0,0,0,0,0,0,6,8,10},
- {0,0,0,0,0,0,0,1,0,0},
+ {{0,0,0,0,0,0,8,10,12,12}, /* font size */
+ {0,0,0,0,0,0,0,0,0,0}, /* bold */
+ {0,0,0,0,0,0,1,1,1,1}, /* halo */
{0,0,0,0}},
NULL},
/* 8 */ {LAYER_PARK, "Parks",
{{
- {{0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, {173/255.0, 202/255.0, 148/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, 0.0, 0.0, 0.0, 0.0}, {135/255.0, 172/255.0, 126/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND}
+ {{0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, {173/255.0, 202/255.0, 148/255.0, 1.00}, 0, CAIRO_LINE_JOIN_MITER, CAIRO_LINE_CAP_BUTT},
+ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {135/255.0, 172/255.0, 126/255.0, 1.00}, 0, CAIRO_LINE_JOIN_MITER, CAIRO_LINE_CAP_BUTT}
}},
- {{0,0,0,0,0,0,0,6,8,10},
- {0,0,0,0,0,0,0,1,0,0},
+ {{0,0,0,0,0,0,0,6,8,10}, /* font size */
+ {0,0,0,0,0,0,0,0,0,0}, /* bold */
+ {0,0,0,0,0,0,0,0,0,0}, /* halo */
{0,0,0,0}},
NULL},
/* 9 */{LAYER_RIVER, "Rivers",
{{
- {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {32/255.0, 32/255.0, 128/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, 0.0, 0.0, 0.0, 0.0}, {0/255.0, 0/255.0, 0/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND}
+ {{0.0, 0.0, 0.0, 0.0, 1.0, 4.0, 6.0, 10.0, 14.0, 18.0}, {148/255.0, 178/255.0, 197/255.0, 1.00}, 0, CAIRO_LINE_JOIN_MITER, CAIRO_LINE_CAP_BUTT},
+ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {0/255.0, 0/255.0, 0/255.0, 1.00}, 0, CAIRO_LINE_JOIN_MITER, CAIRO_LINE_CAP_BUTT}
}},
- {{0,0,0,0,0,0,0,6,8,10},
- {0,0,0,0,0,0,0,1,0,0},
+ {{0,0,0,0,0,0,0,6,8,10}, /* font size */
+ {0,0,0,0,0,0,0,0,0,0}, /* bold */
+ {0,0,0,0,0,0,0,0,0,0}, /* halo */
{0,0,0,0}},
NULL},
/* 10 */{LAYER_LAKE, "Lakes",
{{
- {{0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, {148/255.0, 178/255.0, 197/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, 0.0, 0.0, 0.0, 0.0}, {0/255.0, 0/255.0, 0/255.0, 1.00}, 0, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_CAP_ROUND}
+ {{0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, {148/255.0, 178/255.0, 197/255.0, 1.00}, 0, CAIRO_LINE_JOIN_MITER, CAIRO_LINE_CAP_BUTT},
+ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {0/255.0, 0/255.0, 0/255.0, 1.00}, 0, CAIRO_LINE_JOIN_MITER, CAIRO_LINE_CAP_BUTT}
}},
- {{0,0,0,0,0,0,0,6,8,10},
- {0,0,0,0,0,0,0,1,0,0},
+ {{0,0,0,0,0,0,0,6,8,10}, /* font size */
+ {0,0,0,0,0,0,0,0,0,0}, /* bold */
+ {0,0,0,0,0,0,0,0,0,0}, /* halo */
+ {0,0,0,0}},
+ NULL},
+
+/* 11 */{LAYER_MISC_AREA, "Misc Areas",
+ {{
+ {{0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, {155/255.0, 155/255.0, 155/255.0, 1.00}, 0, CAIRO_LINE_JOIN_MITER, CAIRO_LINE_CAP_BUTT},
+ {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {0/255.0, 0/255.0, 0/255.0, 1.00}, 0, CAIRO_LINE_JOIN_MITER, CAIRO_LINE_CAP_BUTT}
+ }},
+
+ {{0,0,0,0,0,0,0,0,0,0}, /* font size */
+ {0,0,0,0,0,0,0,0,0,0}, /* bold */
+ {0,0,0,0,0,0,0,0,0,0}, /* halo */
{0,0,0,0}},
NULL},
};
Index: locationset.c
===================================================================
RCS file: /cvs/cairo/roadster/src/locationset.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- locationset.c 18 Feb 2005 04:22:56 -0000 1.1.1.1
+++ locationset.c 22 Feb 2005 04:47:24 -0000 1.2
@@ -2,7 +2,7 @@
* locationset.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 <gtk/gtk.h>
#include "../include/locationset.h"
#include "../include/db.h"
@@ -235,7 +235,7 @@
// reads points in given rect into memory
gboolean locationset_load_locations(maprect_t* pRect)
{
- TIMER_BEGIN(mytimer, "BEGIN POINT LOAD");
+// TIMER_BEGIN(mytimer, "BEGIN POINT LOAD");
//~ // g_return_val_if_fail(pGeometrySet != NULL, FALSE);
//~ // gint nZoomLevel = map_get_zoomlevel();
@@ -276,12 +276,12 @@
pRect->m_B.m_fLatitude - LC_EXTRALOAD, pRect->m_A.m_fLongitude - LC_EXTRALOAD, // bottom left
pRect->m_A.m_fLatitude + LC_EXTRALOAD, pRect->m_A.m_fLongitude - LC_EXTRALOAD // upper left again
);
- TIMER_SHOW(mytimer, "after SQL generation");
+// TIMER_SHOW(mytimer, "after SQL generation");
//~ g_print("sql: %s\n", azQuery);
db_resultset_t* pResultSet = NULL;
if(db_query(azQuery, &pResultSet)) {
- TIMER_SHOW(mytimer, "after query");
+// TIMER_SHOW(mytimer, "after query");
guint32 uRowCount = 0;
locationset_clear_all_locations();
@@ -315,11 +315,11 @@
}
} // end while loop on rows
// g_print(" -- got %d location(s)\n", uRowCount);
- TIMER_SHOW(mytimer, "after rows retrieved");
+// TIMER_SHOW(mytimer, "after rows retrieved");
db_free_result(pResultSet);
- TIMER_SHOW(mytimer, "after free results");
- TIMER_END(mytimer, "END DB LOAD");
+// TIMER_SHOW(mytimer, "after free results");
+// TIMER_END(mytimer, "END DB LOAD");
return TRUE;
}
return FALSE;
Index: mainwindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/mainwindow.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mainwindow.c 20 Feb 2005 14:58:46 -0000 1.2
+++ mainwindow.c 22 Feb 2005 04:47:24 -0000 1.3
@@ -43,8 +43,8 @@
#include "../include/databasewindow.h"
#include <gdk/gdkx.h>
-#include <cairo/cairo.h>
-#include <cairo/cairo-xlib.h>
+#include <cairo.h>
+#include <cairo-xlib.h>
#define PROGRAM_NAME "Roadster"
#define PROGRAM_COPYRIGHT "Copyright (c) 2005 Ian McIntosh"
Index: map.c
===================================================================
RCS file: /cvs/cairo/roadster/src/map.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- map.c 20 Feb 2005 14:58:46 -0000 1.3
+++ map.c 22 Feb 2005 04:47:24 -0000 1.4
@@ -26,6 +26,8 @@
#include <gnome.h>
#include <math.h>
+#define HACK_AROUND_CAIRO_LINE_CAP_BUG
+
#include "../include/gui.h"
#include "../include/map.h"
#include "../include/geometryset.h"
@@ -171,9 +173,10 @@
/* Prototypes */
-void map_draw_layer_polygons(cairo_t* pCairo, rendermetrics_t* pRenderMetrics, geometryset_t* pGeometry, sublayerstyle_t* pSubLayerStyle);
-void map_draw_layer_lines(cairo_t* pCairo, rendermetrics_t* pRenderMetrics, geometryset_t* pGeometry, sublayerstyle_t* pSubLayerStyle);
-void map_draw_layer_labels(cairo_t* pCairo, rendermetrics_t* pRenderMetrics, geometryset_t* pGeometry, sublayerstyle_t* pSubLayerStyle);
+void map_draw_layer_polygons(cairo_t* pCairo, rendermetrics_t* pRenderMetrics, geometryset_t* pGeometry, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle);
+void map_draw_layer_lines(cairo_t* pCairo, rendermetrics_t* pRenderMetrics, geometryset_t* pGeometry, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle);
+void map_draw_layer_labels(cairo_t* pCairo, rendermetrics_t* pRenderMetrics, geometryset_t* pGeometry, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle);
+
void map_draw_layer_points(cairo_t* pCairo, rendermetrics_t* pRenderMetrics, GPtrArray* pLocationsArray);
//void map_draw_layer_railroad(cairo_t* pCairo, rendermetrics_t* pRenderMetrics, sublayerstyle_t* pSubLayerStyle);
@@ -213,30 +216,32 @@
zoomlevel_t g_sZoomLevels[NUM_ZOOMLEVELS+1] = {
{1,"undefined"}, // no zoom level 0
- {18000000, "country"}, // 1
- { 6000000, ""}, // 2
- { 1800000, "state"}, // 3
- { 600000, ""}, // 4
- { 200000, "region"}, // 5
- { 70000, ""}, // 6
- { 25000, "city"}, // 7
+ { 1600000, ""}, // 1
+ { 800000, ""}, // 2
+ { 400000, ""}, // 3
+ { 200000, ""}, // 4
+ { 100000, ""}, // 5
+ { 50000, ""}, // 6
+ { 25000, ""}, // 7
{ 10000, ""}, // 8
{ 4000, ""}, // 9
- { 1000, "street"}, //10
+ { 1800, ""}, //10
};
struct {
gint nLayer;
gint nSubLayer;
- void (*pFunc)(cairo_t*, rendermetrics_t*, geometryset_t*, sublayerstyle_t*);
+ void (*pFunc)(cairo_t*, rendermetrics_t*, geometryset_t*, sublayerstyle_t*, textlabelstyle_t*);
} layerdraworder[] = {
+ {LAYER_MISC_AREA, 0, map_draw_layer_polygons},
+
{LAYER_PARK, 0, map_draw_layer_polygons},
{LAYER_PARK, 1, map_draw_layer_lines},
- {LAYER_RIVER, 0, map_draw_layer_lines},
+ {LAYER_RIVER, 0, map_draw_layer_lines}, // single-line rivers
- {LAYER_LAKE, 0, map_draw_layer_polygons},
- {LAYER_LAKE, 1, map_draw_layer_lines},
+ {LAYER_LAKE, 0, map_draw_layer_polygons}, // lakes and fat rivers
+// {LAYER_LAKE, 1, map_draw_layer_lines},
{LAYER_MINORHIGHWAY_RAMP, 0, map_draw_layer_lines},
{LAYER_MINORSTREET, 0, map_draw_layer_lines},
@@ -244,6 +249,8 @@
{LAYER_MINORHIGHWAY_RAMP, 1, map_draw_layer_lines},
{LAYER_MINORSTREET, 1, map_draw_layer_lines},
+
+
{LAYER_MAJORSTREET, 1, map_draw_layer_lines},
{LAYER_RAILROAD, 0, map_draw_layer_lines},
@@ -252,16 +259,11 @@
{LAYER_MINORHIGHWAY, 0, map_draw_layer_lines},
{LAYER_MINORHIGHWAY, 1, map_draw_layer_lines},
- //
- // Labels
- //
- {LAYER_MINORSTREET, 0, map_draw_layer_labels},
- {LAYER_MAJORSTREET, 0, map_draw_layer_labels},
-
- {LAYER_MINORHIGHWAY, 0, map_draw_layer_labels},
- {LAYER_MAJORHIGHWAY, 0, map_draw_layer_labels},
-
- {LAYER_RAILROAD, 0, map_draw_layer_labels},
+ {LAYER_MINORSTREET, 0, map_draw_layer_labels},
+ {LAYER_MAJORSTREET, 0, map_draw_layer_labels},
+ {LAYER_RAILROAD, 0, map_draw_layer_labels},
+ {LAYER_MINORHIGHWAY, 0, map_draw_layer_labels},
+/// {LAYER_MAJORHIGHWAY, 0, map_draw_layer_labels},
};
// ========================================================
@@ -460,17 +462,16 @@
}
// EXPERIMENTAL TEXT RENDERING
-void map_draw_line_label(cairo_t *pCairo, rendermetrics_t* pRenderMetrics, pointstring_t* pPointString, gdouble fLineWidth, const gchar* pszLabel)
+void map_draw_line_label(cairo_t *pCairo, textlabelstyle_t* pLabelStyle, rendermetrics_t* pRenderMetrics, pointstring_t* pPointString, gdouble fLineWidth, const gchar* pszLabel)
{
- // HACK
-// if(random()%1000 > 100) return;
-
-// if(pPointString->m_pPointsArray->len <= 2) return;
if(pPointString->m_pPointsArray->len < 2) return;
-
+
#define ROAD_MAX_SEGMENTS 100
- if(pPointString->m_pPointsArray->len > ROAD_MAX_SEGMENTS) { g_warning("road with > %d segments!\n", ROAD_MAX_SEGMENTS); return; }
-
+ if(pPointString->m_pPointsArray->len > ROAD_MAX_SEGMENTS) { g_warning("road %s has > %d segments!\n", pszLabel, ROAD_MAX_SEGMENTS); return; }
+
+ gfloat fFontSize = pLabelStyle->m_afFontSizeAtZoomLevel[pRenderMetrics->m_nZoomLevel-1];
+ if(fFontSize == 0) return;
+
mappoint_t* apPoints[ROAD_MAX_SEGMENTS];
gint nNumPoints = pPointString->m_pPointsArray->len;
@@ -518,11 +519,11 @@
fTotalLineLength += fLineLength;
}
- gfloat fFontSize = 14.0;
-
cairo_save(pCairo);
- cairo_select_font(pCairo, "Monospace", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
- cairo_scale_font(pCairo, fFontSize);
+ cairo_select_font(pCairo, "Monospace",
+ CAIRO_FONT_SLANT_NORMAL,
+ pLabelStyle->m_abBoldAtZoomLevel[pRenderMetrics->m_nZoomLevel-1] ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL);
+ cairo_scale_font(pCairo, fFontSize);
// Get total width of string
cairo_text_extents_t extents;
@@ -637,14 +638,10 @@
// g_print("forcing a character (%s) on small segment, giving next segment front-padding: %f\n", azLabelSegment, fFrontPaddingNext);
}
}
-// g_print("%s\n", azLabelSegment);
// move the current index up
nStringStartIndex += nWorkableStringLength;
- // otherwise draw this bit of text
- //~ g_print("drawing buffer: %s\n", azLabelSegment);
-
// Normalize (make length = 1.0) by dividing by line length
// This makes a line with length 1 from the origin (0,0)
gdouble fNormalizedX = fRun / fLineLength;
@@ -665,7 +662,7 @@
// we want the normal pointing towards the top of the screen. that's the negative Y direction.
// if(fPerpendicularNormalizedY > 0) fPerpendicularNormalizedY = -fPerpendicularNormalizedY;
- // text too big to fit? then move the text "up"
+ // text too big to fit? then move the text "up" above the line
//~ if(extents.height > (fLineWidth - LABEL_PIXEL_RELIEF_INSIDE_LINE)) {
//~ // Raise the text "up" (away from center of line) half the width of the line
//~ // This leaves it resting on the line. Then add a few pixels of relief.
@@ -680,37 +677,24 @@
fDrawY -= (fPerpendicularNormalizedY * extents.height/2);
//~ }
- // draw!
-
- //~ cairo_set_rgb_color(pCairo, 0.0,0.0,0.0);
- //~ cairo_move_to(pCairo, fX1, fY1);
- //~ cairo_arc(pCairo, fX1, fY1, 3, 0, 2*M_PI);
- //~ cairo_fill(pCairo);
- //~ cairo_move_to(pCairo, fX2, fY2);
- //~ 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);
+ cairo_set_rgb_color(pCairo, 0.0,0.0,0.0);
cairo_set_alpha(pCairo, 1.0);
-// cairo_arc(pCairo, fDrawX, fDrawY, 3, 0, 2*M_PI);
cairo_rotate(pCairo, fAngleInRadians);
cairo_text_path(pCairo, azLabelSegment);
- gboolean bDrawHalo = FALSE;
+
+ gboolean bDrawHalo = pLabelStyle->m_abHaloAtZoomLevel[pRenderMetrics->m_nZoomLevel-1];
if(bDrawHalo) {
cairo_save(pCairo);
- cairo_set_line_width(pCairo, 3);
+ cairo_set_line_width(pCairo, 4);
cairo_set_rgb_color(pCairo, 1.0,1.0,1.0);
cairo_stroke(pCairo);
cairo_restore(pCairo);
}
cairo_fill(pCairo);
cairo_restore(pCairo);
-
- // if we've drawn some text, we know there should be NO front-padding remaining
-// fFrontPadding = 0.0;
}
cairo_restore(pCairo);
}
@@ -856,8 +840,10 @@
//
// Load geometry
//
+ TIMER_BEGIN(loadtimer, "--- BEGIN ALL DB LOAD");
geometryset_load_geometry(&(pRenderMetrics->m_rWorldBoundingBox));
locationset_load_locations(&(pRenderMetrics->m_rWorldBoundingBox));
+ TIMER_END(loadtimer, "--- END ALL DB LOAD");
const GPtrArray* pLocationSets = locationset_get_set_array();
@@ -874,9 +860,14 @@
// Render Layers
gint iLayerDraw;
for(iLayerDraw=0 ; iLayerDraw<NUM_ELEMS(layerdraworder) ; iLayerDraw++) {
- layerdraworder[iLayerDraw].pFunc(pCairo, pRenderMetrics,
+ //g_print("drawing %d\n", layerdraworder[iLayerDraw].nLayer);
+ 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]);
+ /* style */ &g_aLayers[layerdraworder[iLayerDraw].nLayer].m_Style.m_aSubLayers[layerdraworder[iLayerDraw].nSubLayer],
+ &g_aLayers[layerdraworder[iLayerDraw].nLayer].m_TextLabelStyle
+ );
}
TIMER_END(maptimer, "END RENDER MAP");
@@ -887,7 +878,11 @@
locationset_t* pLocationSet = g_ptr_array_index(pLocationSets, iLocationSet);
map_draw_layer_points(pCairo, pRenderMetrics, pLocationSet->m_pLocationsArray);
}
+ TIMER_END(loctimer, "END RENDER LOCATIONS");
+ //
+ // crosshair
+ //
#define CROSSHAIR_LINE_RELIEF (6)
#define CROSSHAIR_LINE_LENGTH (12)
#define CROSSHAIR_CIRCLE_RADIUS (12)
@@ -912,8 +907,8 @@
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");
// We don't need another redraw until something changes
map_set_redraw_needed(FALSE);
@@ -961,7 +956,7 @@
cairo_restore(pCairo);
}
-void map_draw_layer_polygons(cairo_t* pCairo, rendermetrics_t* pRenderMetrics, geometryset_t* pGeometry, sublayerstyle_t* pSubLayerStyle)
+void map_draw_layer_polygons(cairo_t* pCairo, rendermetrics_t* pRenderMetrics, geometryset_t* pGeometry, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle)
{
mappoint_t* pPoint;
pointstring_t* pPointString;
@@ -976,6 +971,7 @@
cairo_set_rgb_color(pCairo, pSubLayerStyle->m_clrColor.m_fRed, pSubLayerStyle->m_clrColor.m_fGreen, pSubLayerStyle->m_clrColor.m_fBlue);
cairo_set_alpha(pCairo, pSubLayerStyle->m_clrColor.m_fAlpha);
cairo_set_line_width(pCairo, fLineWidth);
+ cairo_set_fill_rule(pCairo, CAIRO_FILL_RULE_EVEN_ODD);
cairo_set_line_join(pCairo, pSubLayerStyle->m_nJoinStyle);
cairo_set_line_cap(pCairo, pSubLayerStyle->m_nCapStyle); /* CAIRO_LINE_CAP_BUTT, CAIRO_LINE_CAP_ROUND, CAIRO_LINE_CAP_CAP */
@@ -1002,36 +998,36 @@
}
// TODO: this is debugging of polygons.
- //~ cairo_save(pCairo);
- //~ cairo_set_rgb_color(pCairo, 1,0,0);
-
- //~ if(pPointString->m_pPointsArray->len >= 3) {
- //~ gdouble fRadius = 2;
- //~ // start at index 1 (0 was used above)
- //~ for(iPoint=0 ; iPoint<pPointString->m_pPointsArray->len ; iPoint++) {
- //~ pPoint = g_ptr_array_index(pPointString->m_pPointsArray, iPoint);
-
- //~ cairo_move_to(pCairo, SCALE_X(pRenderMetrics, pPoint->m_fLongitude), SCALE_Y(pRenderMetrics, pPoint->m_fLatitude));
-
- //~ // util_random_color(&clr);
- //~ // cairo_set_rgb_color(pCairo, clr.m_fRed, clr.m_fGreen, clr.m_fBlue);
-
- //~ gchar buf[20];
- //~ g_snprintf(buf, 20, "%d", iPoint);
- //~ // cairo_select_font(pCairo, "Monospace", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
- //~ cairo_text_path(pCairo, buf);
-
- //~ // cairo_arc(pCairo, SCALE_X(pRenderMetrics, pPoint->m_fLongitude), SCALE_Y(pRenderMetrics, pPoint->m_fLatitude), fRadius, 0, 360.0 * (M_PI/180.0));
- //~ cairo_fill(pCairo);
- //~ fRadius += 2;
- //~ }
- //~ }
- //~ cairo_restore(pCairo);
+// cairo_save(pCairo);
+// cairo_set_rgb_color(pCairo, 1,0,0);
+//
+// if(pPointString->m_pPointsArray->len >= 3) {
+// gdouble fRadius = 2;
+// // start at index 1 (0 was used above)
+// for(iPoint=0 ; iPoint<pPointString->m_pPointsArray->len ; iPoint++) {
+// pPoint = g_ptr_array_index(pPointString->m_pPointsArray, iPoint);
+// cairo_move_to(pCairo, SCALE_X(pRenderMetrics, pPoint->m_fLongitude), SCALE_Y(pRenderMetrics, pPoint->m_fLatitude));
+//
+// color_t clr;
+// util_random_color(&clr);
+// cairo_set_rgb_color(pCairo, clr.m_fRed, clr.m_fGreen, clr.m_fBlue);
+//
+// gchar buf[20];
+// g_snprintf(buf, 20, "%d", iPoint);
+// //~ // cairo_select_font(pCairo, "Monospace", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
+// cairo_text_path(pCairo, buf);
+//
+// cairo_arc(pCairo, SCALE_X(pRenderMetrics, pPoint->m_fLongitude), SCALE_Y(pRenderMetrics, pPoint->m_fLatitude), fRadius, 0, 360.0 * (M_PI/180.0));
+// cairo_fill(pCairo);
+// fRadius += 2;
+// }
+// }
+// cairo_restore(pCairo);
}
cairo_fill(pCairo);
}
-void map_draw_layer_lines(cairo_t* pCairo, rendermetrics_t* pRenderMetrics, geometryset_t* pGeometry, sublayerstyle_t* pSubLayerStyle)
+void map_draw_layer_lines(cairo_t* pCairo, rendermetrics_t* pRenderMetrics, geometryset_t* pGeometry, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle)
{
mappoint_t* pPoint;
pointstring_t* pPointString;
@@ -1039,23 +1035,30 @@
gint iPoint;
gdouble fLineWidth = pSubLayerStyle->m_afLineWidths[pRenderMetrics->m_nZoomLevel-1];
- if(fLineWidth == 0.0) return; // Don't both drawing with line width 0
+ if(fLineWidth == 0.0) return; // Don't bother drawing with line width 0
if(pSubLayerStyle->m_clrColor.m_fAlpha == 0.0) return; // invisible?
+ cairo_save(pCairo);
+
+ gdouble fTolerance;
if(fLineWidth <= 2.0) {
- cairo_set_tolerance(pCairo, 8);
+ fTolerance = 5;
}
- else if(fLineWidth <= 6.0) {
- cairo_set_tolerance(pCairo, 6);
+ else if(fLineWidth <= 5.0) {
+ fTolerance = 1;
}
- else {
- cairo_set_tolerance(pCairo, 0.5);
+ else { // anything bigger...
+ fTolerance = 0.5;
}
+ //g_print("setting tolerance %f\n", fTolerance);
+ cairo_set_tolerance(pCairo, fTolerance);
+
gint nCapStyle = pSubLayerStyle->m_nCapStyle;
-// if(nCapStyle == CAIRO_LINE_CAP_ROUND && fLineWidth <= 6.0) {
-// nCapStyle = CAIRO_LINE_CAP_SQUARE;
-// }
+ if(nCapStyle == CAIRO_LINE_CAP_ROUND && fLineWidth <= 4.0) {
+ g_print("forcing square cap style\n");
+ nCapStyle = CAIRO_LINE_CAP_SQUARE;
+ }
// Set layer attributes
cairo_set_rgb_color(pCairo, pSubLayerStyle->m_clrColor.m_fRed, pSubLayerStyle->m_clrColor.m_fGreen, pSubLayerStyle->m_clrColor.m_fBlue);
@@ -1085,12 +1088,21 @@
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));
}
- }
+#ifdef HACK_AROUND_CAIRO_LINE_CAP_BUG
+ cairo_stroke(pCairo); // this is wrong place of it (see below)
+#endif
+ }
}
+#ifndef HACK_AROUND_CAIRO_LINE_CAP_BUG
+ // this is correct place to stroke, but we can't do this until Cairo fixes this bug:
+ // http://cairographics.org/samples/xxx_multi_segment_caps.html
cairo_stroke(pCairo);
+#endif
+
+ cairo_restore(pCairo);
}
-void map_draw_layer_labels(cairo_t* pCairo, rendermetrics_t* pRenderMetrics, geometryset_t* pGeometry, sublayerstyle_t* pSubLayerStyle)
+void map_draw_layer_labels(cairo_t* pCairo, rendermetrics_t* pRenderMetrics, geometryset_t* pGeometry, sublayerstyle_t* pSubLayerStyle, textlabelstyle_t* pLabelStyle)
{
gint iString;
gdouble fLineWidth = pSubLayerStyle->m_afLineWidths[pRenderMetrics->m_nZoomLevel-1];
@@ -1098,7 +1110,7 @@
for(iString=0 ; iString<pGeometry->m_pPointStringsArray->len ; iString++) {
pointstring_t* pPointString = g_ptr_array_index(pGeometry->m_pPointStringsArray, iString);
if(pPointString->m_pszName[0] != '\0') {
- map_draw_line_label(pCairo, pRenderMetrics, pPointString, fLineWidth, pPointString->m_pszName);
+ map_draw_line_label(pCairo, pLabelStyle, pRenderMetrics, pPointString, fLineWidth, pPointString->m_pszName);
}
}
}
Index: scenemanager.c
===================================================================
RCS file: /cvs/cairo/roadster/src/scenemanager.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- scenemanager.c 18 Feb 2005 04:22:56 -0000 1.1.1.1
+++ scenemanager.c 22 Feb 2005 04:47:24 -0000 1.2
@@ -20,3 +20,49 @@
* 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 "../include/geometryset.h"
+
+/*
+Goals:
+ - Keep labels from overlapping
+ - Prevent the same text from showing up too often, and choose among the options wisely
+*/
+
+// typedef struct roadlabel {
+// geometryset_t* m_pGeometry;
+// gchar* m_pszLabel;
+// } roadlabel_t;
+
+struct {
+ GPtrArray* m_p;
+ GHashTable* m_pLabelHash;
+} g_SceneManager;
+
+void scenemanager_init()
+{
+ g_SceneManager.m_pLabelHash = g_hash_table_new(g_str_hash, g_str_equal);
+}
+
+void scenemanager_add_label_line(geometryset_t* pGeometry, gchar* pszLabel)
+{
+
+}
+
+void scenemanager_add_label_polygon(geometryset_t* pGeometry, gchar* pszLabel)
+{
+
+}
+
+void scenemanager_draw()
+{
+
+}
+
+void scenemanager_clear()
+{
+ g_hash_table_destroy(g_SceneManager.m_pLabelHash);
+
+ scenemanager_init();
+}
Index: search_location.c
===================================================================
RCS file: /cvs/cairo/roadster/src/search_location.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- search_location.c 18 Feb 2005 04:22:51 -0000 1.1.1.1
+++ search_location.c 22 Feb 2005 04:47:24 -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 <gtk/gtk.h>
#include "../include/db.h"
#include "../include/util.h"
@@ -164,7 +164,7 @@
void search_location_filter_result(gint nLocationID)
{
g_print("result: %d\n", nLocationID);
- gchar* p = g_strdup_printf("<span size='larger'><b>1369 Coffee Shop (%d)</b></span>\n1369 Cambridge St.\nCambridge, MA 02141", nLocationID);
+ gchar* p = g_strdup_printf("<span size='larger'><b>Happy Garden</b></span>\n145 Main St.\nCambridge, MA 02141\n617-555-1021");
mappoint_t pt = {0,0};
searchwindow_add_result(0, p, &pt);
g_free(p);
Index: search_road.c
===================================================================
RCS file: /cvs/cairo/roadster/src/search_road.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- search_road.c 19 Feb 2005 14:18:32 -0000 1.3
+++ search_road.c 22 Feb 2005 04:47:24 -0000 1.4
@@ -255,7 +255,7 @@
ROADSIDE_RIGHT,
} ERoadSide;
-#define HIGHLIGHT_DISTANCE_FROM_ROAD (0.00017) // this seems like a good amount...
+#define HIGHLIGHT_DISTANCE_FROM_ROAD (0.00012) // this seems like a good amount...
void pointstring_walk_percentage(pointstring_t* pPointString, gdouble fPercent, ERoadSide eRoadSide, mappoint_t* pReturnPoint)
{
@@ -324,6 +324,19 @@
g_assert_not_reached();
}
+gint min4(gint a, gint b, gint c, gint d)
+{
+ gint x = min(a,b);
+ gint y = min(c,d);
+ return min(x,y);
+}
+
+gint max4(gint a, gint b, gint c, gint d)
+{
+ gint x = max(a,b);
+ gint y = max(c,d);
+ return max(x,y);
+}
#define BUFFER_SIZE 200
void search_road_filter_result(const gchar* pszRoadName, gint nRoadNumber, gint nRoadSuffixID, gint nAddressLeftStart, gint nAddressLeftEnd, gint nAddressRightStart, gint nAddressRightEnd, pointstring_t* pPointString)
@@ -332,41 +345,42 @@
gchar azBuffer[BUFFER_SIZE];
mappoint_t ptAddress = {0};
- //~ gchar* pszCity = "City";
- //~ gchar* pszState = "State";
- //~ gchar* pszZIP = "ZIP";
+ gchar* pszCity = "City";
+ gchar* pszState = "ST";
+ gchar* pszZIP = "00000";
+
+ gchar* pszCityStateZip = g_strdup_printf("%s, %s, %s", pszCity, pszState, pszZIP);
if(nRoadNumber == ROADSEARCH_NUMBER_NONE) {
+ // Right in the center
pointstring_walk_percentage(pPointString, 0.5, ROADSIDE_CENTER, &ptAddress);
- //~ g_snprintf(azBuffer, BUFFER_SIZE, "(%d-%d,%d-%d) %s %s",
- //~ nAddressLeftStart, nAddressLeftEnd,
- //~ nAddressRightStart, nAddressRightEnd,
- //~ pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG));
+// gint nStart = min4(nAddressLeftStart, nAddressLeftEnd, nAddressRightStart, nAddressRigtEnd);
+// gint nEnd = min4(nAddressLeftStart, nAddressLeftEnd, nAddressRightStart, nAddressRigtEnd);
if(nAddressRightStart == 0 && nAddressRightEnd == 0) {
// show no numbers if they're both 0
- g_snprintf(azBuffer, BUFFER_SIZE, "%s %s", pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG));
+ g_snprintf(azBuffer, BUFFER_SIZE, "%s %s\n%s", pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG), pszCityStateZip);
}
else if(nAddressRightStart < nAddressRightEnd) {
- g_snprintf(azBuffer, BUFFER_SIZE, "(%d-%d) %s %s", nAddressRightStart, nAddressRightEnd, pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG));
+ g_snprintf(azBuffer, BUFFER_SIZE, "(%d-%d) %s %s\n%s", nAddressRightStart, nAddressRightEnd, pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG), pszCityStateZip);
}
else {
// reverse start/end for the dear user :)
- g_snprintf(azBuffer, BUFFER_SIZE, "(%d-%d) %s %s", nAddressRightEnd, nAddressRightStart, pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG));
+ g_snprintf(azBuffer, BUFFER_SIZE, "(%d-%d) %s %s\n%s", nAddressRightEnd, nAddressRightStart, pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG), pszCityStateZip);
}
searchwindow_add_result(nRoadID, azBuffer, &ptAddress);
// do left side, same as right side (see above)
if(nAddressLeftStart == 0 && nAddressLeftEnd == 0) {
- g_snprintf(azBuffer, BUFFER_SIZE, "%s %s", pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG));
+ g_snprintf(azBuffer, BUFFER_SIZE, "%s %s\n%s", pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG), pszCityStateZip);
}
else if(nAddressLeftStart < nAddressLeftEnd) {
- g_snprintf(azBuffer, BUFFER_SIZE, "(%d-%d) %s %s", nAddressLeftStart, nAddressLeftEnd, pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG));
+ g_snprintf(azBuffer, BUFFER_SIZE, "(%d-%d) %s %s\n%s", nAddressLeftStart, nAddressLeftEnd, pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG), pszCityStateZip);
}
else {
// swap address to keep smaller number to the left
- g_snprintf(azBuffer, BUFFER_SIZE, "(%d-%d) %s %s", nAddressLeftEnd, nAddressLeftStart, pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG));
+ g_snprintf(azBuffer, BUFFER_SIZE, "(%d-%d) %s %s\n%s", nAddressLeftEnd, nAddressLeftStart, pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG), pszCityStateZip);
}
searchwindow_add_result(nRoadID, azBuffer, &ptAddress);
}
@@ -392,7 +406,7 @@
gfloat fPercent = (gfloat)(nRoadNumber - nAddressLeftStart) / (gfloat)nRange;
pointstring_walk_percentage(pPointString, fPercent, ROADSIDE_LEFT, &ptAddress);
}
- g_snprintf(azBuffer, BUFFER_SIZE, "%d %s %s", nRoadNumber, pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG));
+ g_snprintf(azBuffer, BUFFER_SIZE, "%d %s %s\n%s", nRoadNumber, pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG), pszCityStateZip);
searchwindow_add_result(nRoadID, azBuffer, &ptAddress);
}
else if(nRoadNumber >= nAddressLeftEnd && nRoadNumber <= nAddressLeftStart) {
@@ -408,7 +422,7 @@
// flip percent (23 becomes 77, etc.)
pointstring_walk_percentage(pPointString, (100.0 - fPercent), ROADSIDE_RIGHT, &ptAddress);
}
- g_snprintf(azBuffer, BUFFER_SIZE, "%d %s %s", nRoadNumber, pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG));
+ g_snprintf(azBuffer, BUFFER_SIZE, "%d %s %s\n%s", nRoadNumber, pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG), pszCityStateZip);
searchwindow_add_result(nRoadID, azBuffer, &ptAddress);
}
}
@@ -429,7 +443,7 @@
gfloat fPercent = (gfloat)(nRoadNumber - nAddressRightStart) / (gfloat)nRange;
pointstring_walk_percentage(pPointString, fPercent, ROADSIDE_RIGHT, &ptAddress);
}
- g_snprintf(azBuffer, BUFFER_SIZE, "%d %s %s", nRoadNumber, pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG));
+ g_snprintf(azBuffer, BUFFER_SIZE, "%d %s %s\n%s", nRoadNumber, pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG), pszCityStateZip);
searchwindow_add_result(nRoadID, azBuffer, &ptAddress);
}
else if(nRoadNumber >= nAddressRightEnd && nRoadNumber <= nAddressRightStart) {
@@ -445,9 +459,10 @@
// flip percent (23 becomes 77, etc.)
pointstring_walk_percentage(pPointString, (100.0 - fPercent), ROADSIDE_LEFT, &ptAddress);
}
- g_snprintf(azBuffer, BUFFER_SIZE, "%d %s %s", nRoadNumber, pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG));
+ g_snprintf(azBuffer, BUFFER_SIZE, "%d %s %s\n%s", nRoadNumber, pszRoadName, map_road_suffix_itoa(nRoadSuffixID, SUFFIX_TYPE_LONG), pszCityStateZip);
searchwindow_add_result(nRoadID, azBuffer, &ptAddress);
}
}
}
+ g_free(pszCityStateZip);
}
Index: searchwindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/searchwindow.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- searchwindow.c 18 Feb 2005 04:22:56 -0000 1.1.1.1
+++ searchwindow.c 22 Feb 2005 04:47:24 -0000 1.2
@@ -20,8 +20,8 @@
* 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 <gtk/gtk.h>
#include <glade/glade.h>
#include <gdk/gdkx.h>
@@ -100,7 +100,7 @@
g_SearchWindow.m_pLocationDistanceSpinButton = GTK_SPIN_BUTTON(glade_xml_get_widget(pGladeXML, "locationdistancespinbutton")); g_return_if_fail(g_SearchWindow.m_pLocationDistanceSpinButton != NULL);
g_SearchWindow.m_pLocationDistanceUnitComboBox = GTK_COMBO_BOX(glade_xml_get_widget(pGladeXML, "locationdistanceunitcombobox")); g_return_if_fail(g_SearchWindow.m_pLocationDistanceUnitComboBox != NULL);
- //
+ //
fill_combobox_with_distance_unit_names(g_SearchWindow.m_pLocationDistanceUnitComboBox);
gtk_combo_box_set_active(g_SearchWindow.m_pSearchTypeComboBox, SEARCH_TYPE_ADDRESS);
@@ -123,7 +123,7 @@
GtkTreeIter iter;
gtk_list_store_append(g_SearchWindow.m_pLocationSetComboBoxModel, &iter);
- gtk_list_store_set(g_SearchWindow.m_pLocationSetComboBoxModel, &iter,
+ gtk_list_store_set(g_SearchWindow.m_pLocationSetComboBoxModel, &iter,
LOCATIONSETLIST_COLUMN_NAME, "All",
LOCATIONSETLIST_COLUMN_ID, 0,
-1);
@@ -133,7 +133,7 @@
locationset_t* pLocationSet = g_ptr_array_index(pLocationSets, i);
gtk_list_store_append(g_SearchWindow.m_pLocationSetComboBoxModel, &iter);
- gtk_list_store_set(g_SearchWindow.m_pLocationSetComboBoxModel, &iter,
+ gtk_list_store_set(g_SearchWindow.m_pLocationSetComboBoxModel, &iter,
LOCATIONSETLIST_COLUMN_NAME, pLocationSet->m_pszName,
LOCATIONSETLIST_COLUMN_ID, pLocationSet->m_nID,
-1);
@@ -162,7 +162,7 @@
GtkTreeIter iter;
if(gtk_combo_box_get_active_iter(g_SearchWindow.m_pLocationSetComboBox, &iter)) {
- gtk_tree_model_get(GTK_TREE_MODEL(g_SearchWindow.m_pLocationSetComboBoxModel), &iter,
+ gtk_tree_model_get(GTK_TREE_MODEL(g_SearchWindow.m_pLocationSetComboBoxModel), &iter,
LOCATIONSETLIST_COLUMN_ID, &nID,
-1);
return nID;
@@ -209,6 +209,8 @@
mainwindow_set_not_busy(&pBusy);
}
+
+
gtk_widget_set_sensitive(GTK_WIDGET(g_SearchWindow.m_pFindButton), TRUE);
}
@@ -221,7 +223,7 @@
gchar* pszBuffer = g_strdup_printf("<span size='small'>%s</span>", pszText);
gtk_list_store_append(g_SearchWindow.m_pResultsListStore, &iter);
- gtk_list_store_set(g_SearchWindow.m_pResultsListStore, &iter,
+ gtk_list_store_set(g_SearchWindow.m_pResultsListStore, &iter,
RESULTLIST_COLUMN_NAME, pszBuffer,
RESULTLIST_LATITUDE, pPoint->m_fLatitude,
RESULTLIST_LONGITUDE, pPoint->m_fLongitude,
@@ -258,7 +260,7 @@
// gchar* pszText;
gfloat fLatitude;
gfloat fLongitude;
- gtk_tree_model_get(GTK_TREE_MODEL(g_SearchWindow.m_pResultsListStore), &iter,
+ gtk_tree_model_get(GTK_TREE_MODEL(g_SearchWindow.m_pResultsListStore), &iter,
// RESULTLIST_COLUMN_NAME, &pszText,
RESULTLIST_LATITUDE, &fLatitude,
RESULTLIST_LONGITUDE, &fLongitude,
- Previous message: [cairo-commit] roadster/include layers.h, 1.1.1.1,
1.2 scenemanager.h, 1.1.1.1, 1.2 util.h, 1.1.1.1, 1.2
- Next message: [cairo-commit] roadster ChangeLog,1.10,1.11 configure.in,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list