summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GipfelWidget.H2
-rw-r--r--src/GipfelWidget.cxx10
-rw-r--r--src/Panorama.H4
-rw-r--r--src/Panorama.cxx19
4 files changed, 32 insertions, 3 deletions
diff --git a/src/GipfelWidget.H b/src/GipfelWidget.H
index 202ecc0..96c1f0d 100644
--- a/src/GipfelWidget.H
+++ b/src/GipfelWidget.H
@@ -46,6 +46,8 @@ class GipfelWidget : public Fl_Widget {
void set_labels(Hills *v);
+ int get_track_width(Hill *m);
+
public:
GipfelWidget(int X,int Y,int W, int H);
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx
index 32ffbe2..32806a8 100644
--- a/src/GipfelWidget.cxx
+++ b/src/GipfelWidget.cxx
@@ -341,16 +341,16 @@ GipfelWidget::draw() {
}
/* track */
- if (track_points && track_points->get_num() >= 1) {
+ if (track_points && track_points->get_num() > 0) {
int last_x, last_y, last_initialized = 0;
fl_color(FL_RED);
- fl_line_style(FL_SOLID, 2);
for (i=1; i<track_points->get_num(); i++) {
if (!(track_points->get(i)->flags & Hill::VISIBLE)) {
continue;
}
+ fl_line_style(FL_SOLID, get_track_width(track_points->get(i)));
if (last_initialized) {
fl_line(center_x + x() + last_x,
center_y + y() + last_y,
@@ -661,6 +661,12 @@ GipfelWidget::update() {
Fl::wait(1.0);
}
+int
+GipfelWidget::get_track_width(Hill *m) {
+ double dist = pan->get_real_distance(m);
+
+ return MAX(10000.0 / dist, 1.0);
+}
int
GipfelWidget::handle(int event) {
diff --git a/src/Panorama.H b/src/Panorama.H
index 0333338..d53dfc5 100644
--- a/src/Panorama.H
+++ b/src/Panorama.H
@@ -128,6 +128,10 @@ class Panorama {
double get_view_height();
+ double get_earth_radius(Hill *m);
+
+ double get_real_distance(Hill *m);
+
int comp_params(Hill *m1, Hill *m2);
int guess(Hills *p1, Hill *m1);
diff --git a/src/Panorama.cxx b/src/Panorama.cxx
index 8a296aa..61ba781 100644
--- a/src/Panorama.cxx
+++ b/src/Panorama.cxx
@@ -415,7 +415,7 @@ Panorama::update_close_mountains() {
if (m->flags & Hill::TRACK_POINT ||
((m->phi != view_phi || m->lam != view_lam) &&
- (m->height / (m->dist * EARTH_RADIUS)
+ (m->height / (m->dist * get_earth_radius(m))
> height_dist_ratio))) {
close_mountains->add(m);
@@ -521,3 +521,20 @@ Panorama::nick(double dist, double height) {
return beta - pi_d / 2.0;
}
+double
+Panorama::get_earth_radius(Hill *m) {
+ return EARTH_RADIUS;
+}
+
+double
+Panorama::get_real_distance(Hill *m) {
+ double a, b, c, gam;
+
+ a = view_height + get_earth_radius(m); // using m here is not quite right
+ b = m->height + get_earth_radius(m);
+ gam = m->dist;
+
+ c = sqrt(pow(a, 2.0) + pow(b, 2.0) - 2.0 * a * b * cos(gam));
+ return c;
+}
+