From 63148523ee70d96520a1ed4c574d760e072310ec Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 2 Aug 2005 16:17:50 +0100 Subject: remove old trackpoints before adding new gps track --- src/GipfelWidget.cxx | 6 ++++++ src/Panorama.H | 2 ++ src/Panorama.cxx | 17 +++++++++++++++++ 3 files changed, 25 insertions(+) (limited to 'src') diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index 6e0f9a3..802db90 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -94,6 +94,12 @@ GipfelWidget::load_data(const char *file) { int GipfelWidget::load_track(const char *file) { + if (track_points) { + pan->remove_trackpoints(); + track_points->clobber(); + delete track_points; + } + track_points = new Hills(); if (track_points->load(file) != 0) { diff --git a/src/Panorama.H b/src/Panorama.H index bd44346..3f47b76 100644 --- a/src/Panorama.H +++ b/src/Panorama.H @@ -77,6 +77,8 @@ class Panorama { void add_hills(Hills *h); + void remove_trackpoints(); + int set_viewpoint(const char *pos); void set_height_dist_ratio(double r); diff --git a/src/Panorama.cxx b/src/Panorama.cxx index 90e1208..74595f7 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -92,6 +92,23 @@ Panorama::add_hills(Hills *h) { update_angles(); } +void +Panorama::remove_trackpoints() { + Hills *h_new = new Hills(); + Hill *m; + + for(int i=0; iget_num(); i++) { + m = mountains->get(i); + if (! (m->flags & HILL_TRACK_POINT)) { + h_new->add(m); + } + } + + delete mountains; + mountains = h_new; +} + + int Panorama::set_viewpoint(const char *name) { if (get_pos(name, &view_phi, &view_lam, &view_height) != 1) { -- cgit v1.2.3