From 52c1061e24a7ef08c7bbf831cf948d85984c75c8 Mon Sep 17 00:00:00 2001 From: Csaba Halasz <hcs@vostro.(none)> Date: Sun, 25 Oct 2009 16:23:31 +0100 Subject: [PATCH 1/4] Re-apply the reciprocal patch from cvs rev 1.3 and correct an order of magnitude regression in HeadingIndicatorFG --- src/Instrumentation/heading_indicator_fg.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Instrumentation/heading_indicator_fg.cxx b/src/Instrumentation/heading_indicator_fg.cxx index 23d49da74..960bd98ab 100644 --- a/src/Instrumentation/heading_indicator_fg.cxx +++ b/src/Instrumentation/heading_indicator_fg.cxx @@ -117,7 +117,7 @@ HeadingIndicatorFG::update (double dt) // Next, calculate the indicated heading, // introducing errors. - double factor = 0.1 / (spin * spin * spin * spin * spin * spin); + double factor = 100 * (spin * spin * spin * spin * spin * spin); double heading = _heading_in_node->getDoubleValue(); // Now, we have to get the current @@ -128,7 +128,7 @@ HeadingIndicatorFG::update (double dt) if ((heading - _last_heading_deg) < -180) _last_heading_deg -= 360; - heading = fgGetLowPass(_last_heading_deg, heading, dt / factor); + heading = fgGetLowPass(_last_heading_deg, heading, dt * factor); _last_heading_deg = heading; heading += offset; From ce7c98f210fc8ed6a5d7ec37dcce14ce64bc84a3 Mon Sep 17 00:00:00 2001 From: Csaba Halasz <hcs@vostro.(none)> Date: Tue, 13 Oct 2009 17:54:27 +0200 Subject: [PATCH 2/4] Use wider search in FGCommList::FindByPos --- src/ATCDCL/commlist.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ATCDCL/commlist.cxx b/src/ATCDCL/commlist.cxx index baed76f37..96baa9ad7 100644 --- a/src/ATCDCL/commlist.cxx +++ b/src/ATCDCL/commlist.cxx @@ -167,8 +167,8 @@ int FGCommList::FindByPos(const SGGeod& aPos, double range, comm_list_type* stat SGBucket buck(aPos); // get neigboring buckets - int bx = (int)( range*SG_NM_TO_METER / buck.get_width_m() / 2); - int by = (int)( range*SG_NM_TO_METER / buck.get_height_m() / 2 ); + int bx = (int)( range*SG_NM_TO_METER / buck.get_width_m() / 2) + 1; + int by = (int)( range*SG_NM_TO_METER / buck.get_height_m() / 2 ) + 1; // loop over bucket range for ( int i=-bx; i<=bx; i++) { From f0d72b6b50a9d8795eb23c3c6ce81db3a5b555aa Mon Sep 17 00:00:00 2001 From: Csaba Halasz <hcs@vostro.(none)> Date: Tue, 13 Oct 2009 17:56:06 +0200 Subject: [PATCH 3/4] Do not pollute comm list by inserting not found elements in FGCommList::FindByPos --- src/ATCDCL/commlist.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ATCDCL/commlist.cxx b/src/ATCDCL/commlist.cxx index 96baa9ad7..ef5c8d7b8 100644 --- a/src/ATCDCL/commlist.cxx +++ b/src/ATCDCL/commlist.cxx @@ -175,9 +175,10 @@ int FGCommList::FindByPos(const SGGeod& aPos, double range, comm_list_type* stat for ( int j=-by; j<=by; j++) { buck = sgBucketOffset(aPos.getLongitudeDeg(), aPos.getLatitudeDeg(), i, j); long int bucket = buck.gen_index(); - comm_list_type Fstations = commlist_bck[bucket]; - comm_list_iterator current = Fstations.begin(); - comm_list_iterator last = Fstations.end(); + comm_map_const_iterator Fstations = commlist_bck.find(bucket); + if (Fstations == commlist_bck.end()) continue; + comm_list_const_iterator current = Fstations->second.begin(); + comm_list_const_iterator last = Fstations->second.end(); // double az1, az2, s; From d8fb306c7ebc95581dc2bf2e7a8daa46668ab84c Mon Sep 17 00:00:00 2001 From: Csaba Halasz <hcs@vostro.(none)> Date: Tue, 13 Oct 2009 17:57:00 +0200 Subject: [PATCH 4/4] Fix label printing in ATCDialog --- src/ATCDCL/ATCDialog.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ATCDCL/ATCDialog.cxx b/src/ATCDCL/ATCDialog.cxx index f094b1170..f5f5ec935 100644 --- a/src/ATCDCL/ATCDialog.cxx +++ b/src/ATCDCL/ATCDialog.cxx @@ -382,7 +382,6 @@ void FGATCDialog::FreqDisplay(string& ident) { comm_list_type stations; int found = current_commlist->FindByPos(a->geod(), 20.0, &stations); if(found) { - ostringstream ostr; comm_list_iterator itr = stations.begin(); for (n = 0; itr != stations.end(); ++itr) { if(itr->ident != ident) @@ -396,8 +395,9 @@ void FGATCDialog::FreqDisplay(string& ident) { copyProperties(freq_group->getNode("group-template", true), entry); entry->removeChildren("enabled", true); + ostringstream ostr; ostr << itr->type; - entry->setStringValue("text[0]/label", ostr.str().c_str()); + entry->setStringValue("text[0]/label", ostr.str()); char buf[8]; snprintf(buf, 8, "%.2f", (itr->freq / 100.0)); // Convert from KHz to MHz @@ -406,8 +406,6 @@ void FGATCDialog::FreqDisplay(string& ident) { buf[7] = '\0'; entry->setStringValue("text[1]/label", buf); - - ostr.seekp(0); n++; } }