diff options
author | Ian McIntosh <ian_mcintosh@linuxadvocate.org> | 2005-09-30 18:55:31 +0000 |
---|---|---|
committer | Ian McIntosh <ian_mcintosh@linuxadvocate.org> | 2005-09-30 18:55:31 +0000 |
commit | 362ddf4ed34d7f5c48c375ae0146f76ccc64cc64 (patch) | |
tree | 917f65f501458559dced0e8916707bc2374468cb | |
parent | d3f430894d1e1f6a522786d6e39259215e5c270b (diff) |
Removed these unused files.
Commented out track code.
Removed unused init() functions.
Removed calls to *_init() for above.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/animator.c | 5 | ||||
-rw-r--r-- | src/db.c | 15 | ||||
-rw-r--r-- | src/downloader.c | 5 | ||||
-rw-r--r-- | src/downloader.h | 2 | ||||
-rw-r--r-- | src/locationselection.c | 1 | ||||
-rw-r--r-- | src/locationselection.h | 1 | ||||
-rw-r--r-- | src/main.c | 11 | ||||
-rw-r--r-- | src/mainwindow.c | 14 | ||||
-rw-r--r-- | src/map_draw_gdk.c | 121 | ||||
-rw-r--r-- | src/map_tile.c | 2 | ||||
-rw-r--r-- | src/search_road.c | 2 | ||||
-rw-r--r-- | src/track.c | 90 | ||||
-rw-r--r-- | src/track.h | 32 |
15 files changed, 95 insertions, 219 deletions
@@ -1,5 +1,17 @@ 2005-09-30 Ian McIntosh <ian_mcintosh@linuxadvocate.org> + * src/locationselection.c: + * src/locationselection.h: + * src/track.c: + * src/track.h: Removed these unused files. + * src/map_draw_gdk.c: + * src/mainwindow.c: Commented out track code. + * src/animator.c: + * src/downloader.c: Removed unused init() functions. + * src/main.c: Removed calls to *_init() for above. + +2005-09-30 Ian McIntosh <ian_mcintosh@linuxadvocate.org> + * src/downloader.c: Added. This provides an easy interface to asyncronous file downloads. 2005-09-29 Ian McIntosh <ian_mcintosh@linuxadvocate.org> diff --git a/src/Makefile.am b/src/Makefile.am index d2555b5..1ed79fe 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -46,7 +46,6 @@ roadster_SOURCES = \ scenemanager.c\ point.c\ pointstring.c\ - track.c\ glyph.c\ road.c\ animator.c\ diff --git a/src/animator.c b/src/animator.c index 5913d10..2c0e8a9 100644 --- a/src/animator.c +++ b/src/animator.c @@ -29,11 +29,6 @@ #include "animator.h" -void animator_init() -{ - -} - animator_t* animator_new(EAnimationType eAnimationType, gdouble fAnimationTimeInSeconds) { g_assert(fAnimationTimeInSeconds > 0.0); @@ -89,8 +89,8 @@ void db_init() "--skip-bdb", // query cache options - "--query-cache-type=1", // enable query cache (for map tiles) - pszSetQueryCacheSize, + "--query-cache-type=1", // enable query cache (for map tiles) + pszSetQueryCacheSize, // fulltext index options "--ft-min-word-len=1", // don't miss any words, even 1-letter words (esp. numbers like "3") @@ -653,4 +653,15 @@ void db_create_tables() " Name VARCHAR(60) NOT NULL," " IconName VARCHAR(60) NOT NULL," " PRIMARY KEY (ID));", NULL); + +// // Remote File Cache +// db_query("CREATE TABLE IF NOT EXISTS RemoteFileCache(" +// " ID INT3 UNSIGNED NOT NULL AUTO_INCREMENT," // NOTE: 3 bytes. +// " RemoteFilePath VARCHAR(255) NOT NULL," // the full URI (eg. "http://site/path/file.png" +// " LocalFileName VARCHAR(255) NOT NULL," // just the 'name' part. the path should be prepended +// " LocalFileSize INT4 NOT NULL," +// " PRIMARY KEY (ID)," +// " INDEX (RemoteFilePath)," +// " INDEX (LocalFileName))", +// NULL); } diff --git a/src/downloader.c b/src/downloader.c index 7f1ab86..312ba88 100644 --- a/src/downloader.c +++ b/src/downloader.c @@ -56,11 +56,6 @@ static void _downloader_move_pending_to_active(downloader_t* pDownloader); // // functions // -void downloader_init(void) -{ - // nothing -} - downloader_t* downloader_new(gint nMaxConcurrentActive) { downloader_t* pNew = g_new0(downloader_t, 1); diff --git a/src/downloader.h b/src/downloader.h index c26934e..f3107d8 100644 --- a/src/downloader.h +++ b/src/downloader.h @@ -38,9 +38,7 @@ typedef struct { } downloader_t; // public API -void downloader_init(void); downloader_t* downloader_new(gint nMaxConcurrentActive); - void downloader_add_uri(downloader_t* pDownloader, const gchar* pszRemoteFilePath, DownloaderCallbackFileResult pCallbackFileResult); #endif diff --git a/src/locationselection.c b/src/locationselection.c deleted file mode 100644 index 8b13789..0000000 --- a/src/locationselection.c +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/locationselection.h b/src/locationselection.h deleted file mode 100644 index 8b13789..0000000 --- a/src/locationselection.h +++ /dev/null @@ -1 +0,0 @@ - @@ -32,13 +32,11 @@ #include "map.h" #include "gpsclient.h" #include "scenemanager.h" -#include "animator.h" #include "road.h" #include "locationset.h" #include "location.h" #include "search.h" #include "search.h" -#include "downloader.h" static gboolean main_init(void); static void main_deinit(void); @@ -135,11 +133,11 @@ gboolean main_init(void) g_warning("gnome_vfs_init failed\n"); return FALSE; } - gchar* pszApplicationDir = g_strdup_printf("%s/.roadster", g_get_home_dir()); gnome_vfs_make_directory(pszApplicationDir, 0700); g_free(pszApplicationDir); #endif + g_print("initializing points\n"); point_init(); g_print("initializing pointstrings\n"); @@ -148,8 +146,6 @@ gboolean main_init(void) g_print("initializing roads\n"); road_init(); - g_print("initializing tracks\n"); - track_init(); g_print("initializing map styles\n"); map_style_init(); g_print("initializing map\n"); @@ -161,9 +157,6 @@ gboolean main_init(void) g_print("initializing gpsclient\n"); gpsclient_init(); - g_print("initializing animator\n"); - animator_init(); - // // Database // @@ -196,8 +189,6 @@ gboolean main_init(void) location_init(); g_print("initialization complete\n"); - - downloader_init(); return TRUE; } diff --git a/src/mainwindow.c b/src/mainwindow.c index 0939191..0fe0a40 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -1445,13 +1445,13 @@ static gboolean mainwindow_on_gps_redraw_timeout(gpointer __unused) const gpsdata_t* pData = gpsclient_getdata(); if(pData->eStatus == GPS_STATUS_LIVE) { - if(g_MainWindow.nCurrentGPSPath == 0) { - // create a new track for GPS trail - g_MainWindow.nCurrentGPSPath = track_new(); - map_add_track(g_MainWindow.pMap, g_MainWindow.nCurrentGPSPath); - } - - track_add_point(g_MainWindow.nCurrentGPSPath, &pData->ptPosition); +// if(g_MainWindow.nCurrentGPSPath == 0) { +// // create a new track for GPS trail +// g_MainWindow.nCurrentGPSPath = track_new(); +// map_add_track(g_MainWindow.pMap, g_MainWindow.nCurrentGPSPath); +// } +// +// track_add_point(g_MainWindow.nCurrentGPSPath, &pData->ptPosition); // Show position? if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(g_MainWindow.GPS.pShowPositionCheckButton))) { diff --git a/src/map_draw_gdk.c b/src/map_draw_gdk.c index 6285dc7..d0011c5 100644 --- a/src/map_draw_gdk.c +++ b/src/map_draw_gdk.c @@ -39,7 +39,6 @@ #include "road.h" #include "point.h" #include "map_style.h" -#include "track.h" #include "locationset.h" #include "location.h" #include "scenemanager.h" @@ -50,10 +49,11 @@ static void map_draw_gdk_layer_lines(map_t* pMap, GdkPixmap* pPixmap, rendermetr static void map_draw_gdk_layer_fill(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics, maplayerstyle_t* pLayerStyle); -static void map_draw_gdk_tracks(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics); static void map_draw_gdk_locations(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics); static void map_draw_gdk_locationset(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics, locationset_t* pLocationSet, GPtrArray* pLocationsArray); +//static void map_draw_gdk_tracks(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics); + //#define ENABLE_MAP_GRAYSCALE_HACK // just a little test. black and white might be good for something void map_draw_gdk_set_color(GdkGC* pGC, color_t* pColor) @@ -112,7 +112,7 @@ void map_draw_gdk(map_t* pMap, rendermetrics_t* pRenderMetrics, GdkPixmap* pPixm //map_draw_gdk_locations(pMap, pPixmap, pRenderMetrics); } } - map_draw_gdk_tracks(pMap, pPixmap, pRenderMetrics); +// map_draw_gdk_tracks(pMap, pPixmap, pRenderMetrics); } // 3. Labels @@ -315,63 +315,6 @@ static void map_draw_gdk_layer_lines(map_t* pMap, GdkPixmap* pPixmap, rendermetr } } -static void map_draw_gdk_tracks(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics) -{ - gint i; - for(i=0 ; i<pMap->pTracksArray->len ; i++) { - gint hTrack = g_array_index(pMap->pTracksArray, gint, i); - - GdkColor clr; - clr.red = (gint)(0.5 * 65535.0); - clr.green = (gint)(0.5 * 65535.0); - clr.blue = (gint)(1.0 * 65535.0); - gdk_gc_set_rgb_fg_color(pMap->pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->pTargetWidget)], &clr); - - pointstring_t* pPointString = track_get_pointstring(hTrack); - if(pPointString == NULL) continue; - - if(pPointString->pPointsArray->len >= 2) { - - if(pPointString->pPointsArray->len > MAX_GDK_LINE_SEGMENTS) { - //g_warning("not drawing track with > %d segments\n", MAX_GDK_LINE_SEGMENTS); - continue; - } - - GdkPoint aPoints[MAX_GDK_LINE_SEGMENTS]; - - 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; - - gint iPoint; - for(iPoint=0 ; iPoint<pPointString->pPointsArray->len ; iPoint++) { - mappoint_t* pPoint = g_ptr_array_index(pPointString->pPointsArray, iPoint); - - // find extents - fMaxLat = max(pPoint->fLatitude,fMaxLat); - fMinLat = min(pPoint->fLatitude,fMinLat); - fMaxLon = max(pPoint->fLongitude,fMaxLon); - fMinLon = min(pPoint->fLongitude,fMinLon); - - aPoints[iPoint].x = (gint)SCALE_X(pRenderMetrics, pPoint->fLongitude); - aPoints[iPoint].y = (gint)SCALE_Y(pRenderMetrics, pPoint->fLatitude); - } - - // rectangle overlap test - if(fMaxLat < pRenderMetrics->rWorldBoundingBox.A.fLatitude - || fMaxLon < pRenderMetrics->rWorldBoundingBox.A.fLongitude - || fMinLat > pRenderMetrics->rWorldBoundingBox.B.fLatitude - || fMinLon > pRenderMetrics->rWorldBoundingBox.B.fLongitude) - { - continue; // not visible - } - - gdk_draw_lines(pPixmap, pMap->pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->pTargetWidget)], aPoints, pPointString->pPointsArray->len); - } - } -} - // Draw all locations from sets marked visible static void map_draw_gdk_locations(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics) { @@ -424,6 +367,7 @@ static void map_draw_gdk_locationset(map_t* pMap, GdkPixmap* pPixmap, rendermetr } } +#ifdef ROADSTER_DEAD_CODE // GdkColor clr1; // clr1.red = 255/255.0 * 65535; // clr1.green = 80/255.0 * 65535; @@ -446,3 +390,60 @@ static void map_draw_gdk_locationset(map_t* pMap, GdkPixmap* pPixmap, rendermetr // nX-1,nY-1, // 3, 3); +// static void map_draw_gdk_tracks(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics) +// { +// gint i; +// for(i=0 ; i<pMap->pTracksArray->len ; i++) { +// gint hTrack = g_array_index(pMap->pTracksArray, gint, i); +// +// GdkColor clr; +// clr.red = (gint)(0.5 * 65535.0); +// clr.green = (gint)(0.5 * 65535.0); +// clr.blue = (gint)(1.0 * 65535.0); +// gdk_gc_set_rgb_fg_color(pMap->pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->pTargetWidget)], &clr); +// +// pointstring_t* pPointString = track_get_pointstring(hTrack); +// if(pPointString == NULL) continue; +// +// if(pPointString->pPointsArray->len >= 2) { +// +// if(pPointString->pPointsArray->len > MAX_GDK_LINE_SEGMENTS) { +// //g_warning("not drawing track with > %d segments\n", MAX_GDK_LINE_SEGMENTS); +// continue; +// } +// +// GdkPoint aPoints[MAX_GDK_LINE_SEGMENTS]; +// +// 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; +// +// gint iPoint; +// for(iPoint=0 ; iPoint<pPointString->pPointsArray->len ; iPoint++) { +// mappoint_t* pPoint = g_ptr_array_index(pPointString->pPointsArray, iPoint); +// +// // find extents +// fMaxLat = max(pPoint->fLatitude,fMaxLat); +// fMinLat = min(pPoint->fLatitude,fMinLat); +// fMaxLon = max(pPoint->fLongitude,fMaxLon); +// fMinLon = min(pPoint->fLongitude,fMinLon); +// +// aPoints[iPoint].x = (gint)SCALE_X(pRenderMetrics, pPoint->fLongitude); +// aPoints[iPoint].y = (gint)SCALE_Y(pRenderMetrics, pPoint->fLatitude); +// } +// +// // rectangle overlap test +// if(fMaxLat < pRenderMetrics->rWorldBoundingBox.A.fLatitude +// || fMaxLon < pRenderMetrics->rWorldBoundingBox.A.fLongitude +// || fMinLat > pRenderMetrics->rWorldBoundingBox.B.fLatitude +// || fMinLon > pRenderMetrics->rWorldBoundingBox.B.fLongitude) +// { +// continue; // not visible +// } +// +// gdk_draw_lines(pPixmap, pMap->pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->pTargetWidget)], aPoints, pPointString->pPointsArray->len); +// } +// } +// } +#endif diff --git a/src/map_tile.c b/src/map_tile.c index 9e08b52..80da339 100644 --- a/src/map_tile.c +++ b/src/map_tile.c @@ -1,5 +1,3 @@ - - void map_tile_load() { diff --git a/src/search_road.c b/src/search_road.c index a06b40c..e69d5a2 100644 --- a/src/search_road.c +++ b/src/search_road.c @@ -367,7 +367,7 @@ void search_road_on_roadsearch_struct(const roadsearch_t* pRoadSearch) g_free(pszQuery); } - +// XXX: doesn't map.c have something like this? :) static gfloat point_calc_distance(mappoint_t* pA, mappoint_t* pB) { gdouble fRise = pB->fLatitude - pA->fLatitude; diff --git a/src/track.c b/src/track.c deleted file mode 100644 index 2ff075a..0000000 --- a/src/track.c +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************** - * track.c - * - * Copyright 2005 Ian McIntosh - * ian_mcintosh@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. - */ - -#include <gtk/gtk.h> -#include "main.h" -#include "map.h" -#include "pointstring.h" -#include "point.h" - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -typedef struct track { - pointstring_t* pPointString; - gint nID; -} track_t; - -struct { - GHashTable* pTracksHash; - GMemChunk* g_pTrackChunkAllocator; -} g_Tracks; - -void track_init(void) -{ - g_Tracks.pTracksHash = g_hash_table_new(g_int_hash, g_int_equal); - g_Tracks.g_pTrackChunkAllocator = g_mem_chunk_new("ROADSTER tracks", - sizeof(track_t), sizeof(track_t)*100, G_ALLOC_AND_FREE); - g_return_if_fail(g_Tracks.g_pTrackChunkAllocator != NULL); -} - -gint track_new() -{ - // insert into DB to get a unique ID - gint nID = 1; - - // allocate structure for it - track_t* pNew = g_mem_chunk_alloc0(g_Tracks.g_pTrackChunkAllocator); - pNew->nID = nID; - pointstring_alloc(&pNew->pPointString); - - // save in hash for fast lookups - g_hash_table_insert(g_Tracks.pTracksHash, &pNew->nID, pNew); - - return nID; -} - -void track_add_point(gint nTrackID, const mappoint_t *pPoint) -{ -// g_print("adding point to track %d\n", nTrackID); - - track_t* pTrack = g_hash_table_lookup(g_Tracks.pTracksHash, &nTrackID); - if(pTrack == NULL) { - // lookup in DB? - - g_warning("not adding to track %d\n", nTrackID); - return; - } - - pointstring_append_point(pTrack->pPointString, pPoint); -} - -const pointstring_t* track_get_pointstring(gint nID) -{ - track_t* pTrack = g_hash_table_lookup(g_Tracks.pTracksHash, &nID); - if(pTrack != NULL) { - return pTrack->pPointString; - } - return NULL; -} diff --git a/src/track.h b/src/track.h deleted file mode 100644 index bc7f314..0000000 --- a/src/track.h +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************************** - * track.h - * - * Copyright 2005 Ian McIntosh - * ian_mcintosh@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. - */ - -#ifndef _TRACK_H_ -#define _TRACK_H_ - -void track_add_point(gint nTrackID, const mappoint_t *pPoint); -void track_init(void); -gint track_new(); -const pointstring_t* track_get_pointstring(gint nID); - -#endif |