summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GipfelWidget.cxx6
-rw-r--r--src/Panorama.H2
-rw-r--r--src/Panorama.cxx17
3 files changed, 25 insertions, 0 deletions
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; i<mountains->get_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) {