summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2005-09-04 12:14:54 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2005-09-04 12:14:54 +0200
commit6dce9b9515265d938a672a0817fd293015c77551 (patch)
tree999fa51735a22abf8da35e71c12e15882936b2bb
parent700f8cb97bc9a033b82252e0120e41962135fb06 (diff)
Make Hill flags part of Hill class
-rw-r--r--src/GipfelWidget.cxx10
-rw-r--r--src/Hill.H10
-rw-r--r--src/Hill.cxx6
-rw-r--r--src/Panorama.cxx10
-rw-r--r--src/choose_hill.cxx2
5 files changed, 20 insertions, 18 deletions
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx
index 6969744..be1dbcb 100644
--- a/src/GipfelWidget.cxx
+++ b/src/GipfelWidget.cxx
@@ -242,7 +242,7 @@ GipfelWidget::load_track(const char *file) {
}
for (int i=0; i<track_points->get_num(); i++) {
- track_points->get(i)->flags |= HILL_TRACK_POINT;
+ track_points->get(i)->flags |= Hill::TRACK_POINT;
}
pan->add_hills(track_points);
@@ -303,7 +303,7 @@ GipfelWidget::draw() {
for (i=0; i<mnts->get_num(); i++) {
m = mnts->get(i);
- if (m->flags & (HILL_DUPLICATE | HILL_TRACK_POINT)) {
+ if (m->flags & (Hill::DUPLICATE | Hill::TRACK_POINT)) {
continue;
}
@@ -375,7 +375,7 @@ GipfelWidget::set_labels(Hills *v) {
for (i=0; i<v->get_num(); i++) {
m = v->get(i);
- if (m->flags & (HILL_DUPLICATE | HILL_TRACK_POINT)) {
+ if (m->flags & (Hill::DUPLICATE | Hill::TRACK_POINT)) {
continue;
}
@@ -385,7 +385,7 @@ GipfelWidget::set_labels(Hills *v) {
for (j=0; j < i; j++) {
n = v->get(j);
- if (n->flags & (HILL_DUPLICATE | HILL_TRACK_POINT)) {
+ if (n->flags & (Hill::DUPLICATE | Hill::TRACK_POINT)) {
continue;
}
@@ -411,7 +411,7 @@ GipfelWidget::set_cur_mountain(int m_x, int m_y) {
for (i=0; i<mnts->get_num(); i++) {
m = mnts->get(i);
- if (m->flags & (HILL_DUPLICATE | HILL_TRACK_POINT)) {
+ if (m->flags & (Hill::DUPLICATE | Hill::TRACK_POINT)) {
continue;
}
diff --git a/src/Hill.H b/src/Hill.H
index b3edf28..169208b 100644
--- a/src/Hill.H
+++ b/src/Hill.H
@@ -23,16 +23,18 @@
#define HILL_H
-#define HILL_DUPLICATE 0x01
-#define HILL_TRACK_POINT 0x02
-#define HILL_VISIBLE 0x04
-
class Hill;
class Hill {
private:
public:
+ typedef enum {
+ DUPLICATE = 0x01,
+ TRACK_POINT = 0x02,
+ VISIBLE = 0x04
+ } flags_t;
+
double phi, lam;
double height;
double alph;
diff --git a/src/Hill.cxx b/src/Hill.cxx
index b78dcd7..7acf77d 100644
--- a/src/Hill.cxx
+++ b/src/Hill.cxx
@@ -124,7 +124,7 @@ void Hills::mark_duplicates(double dist) {
for(i=0; i<get_num();i++) {
m = get(i);
- if (m->flags & HILL_TRACK_POINT) {
+ if (m->flags & Hill::TRACK_POINT) {
continue;
}
@@ -132,10 +132,10 @@ void Hills::mark_duplicates(double dist) {
j = i + 1;
n = get(j);
while (n && fabs(n->phi - m->phi) <= dist) {
- if (! n->flags & HILL_DUPLICATE) {
+ if (! n->flags & Hill::DUPLICATE) {
if (fabs(n->lam - m->lam) <= dist &&
fabs(n->height - m->height) <= 50.0 ) {
- n->flags |= HILL_DUPLICATE;
+ n->flags |= Hill::DUPLICATE;
}
}
j = j + 1;
diff --git a/src/Panorama.cxx b/src/Panorama.cxx
index b72e37b..cb98105 100644
--- a/src/Panorama.cxx
+++ b/src/Panorama.cxx
@@ -81,7 +81,7 @@ Panorama::remove_trackpoints() {
for(int i=0; i<mountains->get_num(); i++) {
m = mountains->get(i);
- if (! (m->flags & HILL_TRACK_POINT)) {
+ if (! (m->flags & Hill::TRACK_POINT)) {
h_new->add(m);
}
}
@@ -194,7 +194,7 @@ Panorama::guess(Hills *p, Hill *m1) {
m1->x = x1_sav;
m1->y = y1_sav;
- if (m_tmp2->flags & HILL_TRACK_POINT ||
+ if (m_tmp2->flags & Hill::TRACK_POINT ||
m1 == m_tmp2 || fabs(m1->alph - m_tmp2->alph) > pi_d *0.7) {
continue;
}
@@ -411,7 +411,7 @@ Panorama::update_close_mountains() {
for (i=0; i<mountains->get_num(); i++) {
m = mountains->get(i);
- if (m->flags & HILL_TRACK_POINT ||
+ if (m->flags & Hill::TRACK_POINT ||
((m->phi != view_phi || m->lam != view_lam) &&
(m->height / (m->dist * EARTH_RADIUS)
> height_dist_ratio))) {
@@ -443,9 +443,9 @@ Panorama::update_visible_mountains() {
if (m->a_view < view_angle && m->a_view > - view_angle) {
visible_mountains->add(m);
- m->flags |= HILL_VISIBLE;
+ m->flags |= Hill::VISIBLE;
} else {
- m->flags &= ~HILL_VISIBLE;
+ m->flags &= ~Hill::VISIBLE;
}
}
diff --git a/src/choose_hill.cxx b/src/choose_hill.cxx
index 1cab2ac..f144d5e 100644
--- a/src/choose_hill.cxx
+++ b/src/choose_hill.cxx
@@ -35,7 +35,7 @@ choose_hill(const Hills *hills, const char *l) {
for (int i=0; i<h_sort->get_num(); i++) {
Hill *m = h_sort->get(i);
- if (m->flags & (HILL_DUPLICATE | HILL_TRACK_POINT)) {
+ if (m->flags & (Hill::DUPLICATE | Hill::TRACK_POINT)) {
continue;
}
sc->add(m->name, m);