[cairo-commit] roadster/src animator.c, 1.3, 1.4 main.c, 1.19,
1.20 mainwindow.c, 1.35, 1.36 map.c, 1.37,
1.38 search_location.c, 1.9, 1.10
Ian McIntosh
commit at pdx.freedesktop.org
Fri Apr 1 01:53:51 PST 2005
Committed by: ian
Update of /cvs/cairo/roadster/src
In directory gabe:/tmp/cvs-serv4624/src
Modified Files:
animator.c main.c mainwindow.c map.c search_location.c
Log Message:
* src/animator.c: Use a better math function for smooth scrolling.
* src/mainwindow.c: Tweak sliding a bit.
* src/map.c: Cleanup.
* src/search_location.c: Use all query words.
Index: animator.c
===================================================================
RCS file: /cvs/cairo/roadster/src/animator.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- animator.c 28 Mar 2005 18:49:50 -0000 1.3
+++ animator.c 1 Apr 2005 09:53:49 -0000 1.4
@@ -105,18 +105,9 @@
}
break;
case ANIMATIONTYPE_FAST_THEN_SLIDE:
- if(fTimePercent < 0.5) {
- // go 80% of the distance in half the time
- // uses a simple 45 degree slope (constant-speed movement with no smooth acceration)
- fReturn = (fTimePercent / 0.5) * 0.8;
- }
- else {
- // (note: same as above)
- fReturn = 1.0 - (2.0 * (1.0 - fTimePercent) * (1.0 - fTimePercent));
-
- // compress it into last 20%
- fReturn = (fReturn * 0.2) + 0.8;
- }
+ // graph this to understand fully. :)
+ fReturn = (1 - ((1-fTimePercent) * (1-fTimePercent) * (1-fTimePercent) * (1-fTimePercent)));
+ // NOTE: the more (1-x)s we add, the more time it will spend "slowing down"
break;
default:
g_assert_not_reached();
Index: main.c
===================================================================
RCS file: /cvs/cairo/roadster/src/main.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- main.c 31 Mar 2005 08:29:53 -0000 1.19
+++ main.c 1 Apr 2005 09:53:49 -0000 1.20
@@ -48,7 +48,6 @@
textdomain(PACKAGE);
#endif
-// gnome_program_init(PACKAGE, VERSION, LIBGNOMEUI_MODULE, argc, argv, NULL);
gtk_init(&argc, &argv);
g_type_init();
@@ -63,21 +62,20 @@
gint nNewLocationID;
mappoint_t pt;
- pt.m_fLatitude = 41.54930; // these are in MA somewhere
- pt.m_fLongitude = -70.61403;
+ pt.m_fLatitude = 41.55130;
+ pt.m_fLongitude = -70.61409;
nNewLocationID = 0;
location_insert(nNewLocationSetID, &pt, &nNewLocationID);
location_insert_attribute(nNewLocationID, LOCATION_ATTRIBUTE_ID_NAME, "1369 Coffee House", NULL);
location_insert_attribute(nNewLocationID, LOCATION_ATTRIBUTE_ID_ADDRESS, "1369 Cambridge Street\nCambridge, MA, 02141", NULL);
- pt.m_fLatitude = 41.54762;
+ pt.m_fLatitude = 41.55120;
pt.m_fLongitude = -70.61409;
nNewLocationID = 0;
location_insert(nNewLocationSetID, &pt, &nNewLocationID);
location_insert_attribute(nNewLocationID, LOCATION_ATTRIBUTE_ID_NAME, "One Cup of Coffee", NULL);
location_insert_attribute(nNewLocationID, LOCATION_ATTRIBUTE_ID_ADDRESS, "29 Shore Street\nCambridge, MA, 02141", NULL);
*/
-
prefs_read();
g_print("Running %s\n", g_thread_supported() ? "multi-threaded" : "single-threaded");
@@ -106,10 +104,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");
@@ -136,7 +134,7 @@
g_print("initializing animator\n");
animator_init();
-
+
g_print("connecting to db\n");
gboolean bConnected = db_connect(NULL, NULL, NULL, "");
Index: mainwindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/mainwindow.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- mainwindow.c 31 Mar 2005 08:29:53 -0000 1.35
+++ mainwindow.c 1 Apr 2005 09:53:49 -0000 1.36
@@ -72,7 +72,7 @@
#define SLIDE_TIMEOUT_MS (50) // time between frames (in MS) for smooth-sliding (on double click?)
#define SLIDE_TIME_IN_SECONDS (0.7) // how long the whole slide should take, in seconds
-#define SLIDE_TIME_IN_SECONDS_AUTO (0.5) // time for sliding to search results, etc.
+#define SLIDE_TIME_IN_SECONDS_AUTO (0.8) // time for sliding to search results, etc.
// Layerlist columns
#define LAYERLIST_COLUMN_ENABLED (0)
Index: map.c
===================================================================
RCS file: /cvs/cairo/roadster/src/map.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- map.c 31 Mar 2005 08:29:53 -0000 1.37
+++ map.c 1 Apr 2005 09:53:49 -0000 1.38
@@ -586,7 +586,7 @@
// Get layer type that this belongs on
gint nTypeID = atoi(aRow[1]);
if(nTypeID < LAYER_FIRST || nTypeID > LAYER_LAST) {
- g_warning("geometry record '%s' has bad type '%s'\n", aRow[0], aRow[1]);
+ //g_warning("geometry record '%s' has bad type '%s'\n", aRow[0], aRow[1]);
continue;
}
@@ -641,12 +641,7 @@
g_return_val_if_fail(pMap != NULL, FALSE);
g_return_val_if_fail(pRect != NULL, FALSE);
- db_resultset_t* pResultSet = NULL;
- db_row_t aRow;
-
- gint nZoomLevel = map_get_zoomlevel(pMap);
-
- if(nZoomLevel < MIN_ZOOMLEVEL_FOR_LOCATIONS) {
+ if(map_get_zoomlevel(pMap) < MIN_ZOOMLEVEL_FOR_LOCATIONS) {
return TRUE;
}
@@ -669,6 +664,7 @@
);
//g_print("sql: %s\n", pszSQL);
+ db_resultset_t* pResultSet = NULL;
db_query(pszSQL, &pResultSet);
g_free(pszSQL);
@@ -676,6 +672,7 @@
guint32 uRowCount = 0;
if(pResultSet) {
+ db_row_t aRow;
while((aRow = db_fetch_row(pResultSet))) {
uRowCount++;
@@ -704,13 +701,11 @@
TIMER_SHOW(mytimer, "after rows retrieved");
db_free_result(pResultSet);
- TIMER_SHOW(mytimer, "after free results");
TIMER_END(mytimer, "END Locations LOAD");
-
return TRUE;
}
else {
-// g_print(" no rows\n");
+ TIMER_END(mytimer, "END Locations LOAD (0 results)");
return FALSE;
}
}
@@ -765,6 +760,7 @@
gdouble fX1 = SCALE_X(&metrics, p1->m_fLongitude);
gdouble fY1 = SCALE_Y(&metrics, p1->m_fLatitude);
+
gdouble fX2 = SCALE_X(&metrics, p2->m_fLongitude);
gdouble fY2 = SCALE_Y(&metrics, p2->m_fLatitude);
Index: search_location.c
===================================================================
RCS file: /cvs/cairo/roadster/src/search_location.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- search_location.c 31 Mar 2005 08:29:53 -0000 1.9
+++ search_location.c 1 Apr 2005 09:53:49 -0000 1.10
@@ -35,17 +35,17 @@
#define MAX_QUERY (4000)
#define SEARCH_RESULT_COUNT_LIMIT (100)
-typedef struct {
+//typedef struct {
// mappoint_t m_ptCenter;
// gdouble m_fRadiusInDegrees;
// gint m_nLocationSetID;
- gchar* m_pszCleanedSentence;
- gchar** m_aWords;
- gint m_nWordCount;
-} locationsearch_t;
+// gchar* m_pszCleanedSentence;
+// gchar** m_aWords;
+// gint m_nWordCount;
+//} locationsearch_t;
void search_location_on_cleaned_sentence(const gchar* pszCleanedSentence);
-void search_location_on_words(gchar** aWords, gint nWordCount);
+//void search_location_on_words(gchar** aWords, gint nWordCount);
void search_location_filter_result(gint nLocationID, const gchar* pszName, const gchar* pszAddress, const mappoint_t* pCoordinates);
void search_location_execute(const gchar* pszSentence)
@@ -63,21 +63,20 @@
TIMER_END(search, "END LocationSearch");
}
-void search_location_on_cleaned_sentence(const gchar* pszCleanedSentence)
-{
// Create an array of the words
- gchar** aaWords = g_strsplit(pszCleanedSentence," ", 0); // " " = delimeters, 0 = no max #
- gint nWords = g_strv_length(aaWords);
+/* gchar** aaWords = g_strsplit(pszCleanedSentence," ", 0); // " " = delimeters, 0 = no max # */
+/* gint nWords = g_strv_length(aaWords); */
+/* search_location_on_words(aaWords, nWords); */
+/* g_strfreev(aaWords); // free entire array of strings */
-// search_location_on_locationsearch_struct(pLocationSearch);
- search_location_on_words(aaWords, nWords);
+void search_location_on_cleaned_sentence(const gchar* pszCleanedSentence)
+{
- // cleanup
- g_strfreev(aaWords); // free the array of strings
-}
+ // Get POI #, Name, Address, and Coordinates. Match a POI if any of the words given are in ANY attributes of the POI.
+ // NOTE: We're using this behavior (http://dev.mysql.com/doc/mysql/en/fulltext-boolean.html):
+ // 'apple banana'
+ // Find rows that contain at least one of the two words.
-void search_location_on_words(gchar** aWords, gint nWordCount)
-{
gchar* pszSQL = g_strdup_printf(
"SELECT Location.ID, LocationAttributeValue_Name.Value AS Name, LocationAttributeValue_Address.Value AS Address, AsBinary(Location.Coordinates)"
" FROM LocationAttributeValue"
@@ -90,7 +89,7 @@
" GROUP BY Location.ID;",
LOCATION_ATTRIBUTE_ID_NAME,
LOCATION_ATTRIBUTE_ID_ADDRESS,
- aWords[0]
+ pszCleanedSentence
);
db_resultset_t* pResultSet;
@@ -126,6 +125,10 @@
}
}
+/* void search_location_on_words(gchar** aWords, gint nWordCount) */
+/* { */
+/* } */
+
#define LOCATION_RESULT_SUGGESTED_ZOOMLEVEL (7)
void search_location_filter_result(gint nLocationID, const gchar* pszName, const gchar* pszAddress, const mappoint_t* pCoordinates)
More information about the cairo-commit
mailing list