]> git.mxchange.org Git - simgear.git/blobdiff - simgear/bucket/newbucket.cxx
Merge branch 'topics/condexp' into next
[simgear.git] / simgear / bucket / newbucket.cxx
index 9a913628cbf39a777f3fab541cdff8e25c29cfe4..119959039091e68cd7dcad37dcfd125aa7913371 100644 (file)
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Library General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA  02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  * $Id$
  **************************************************************************/
@@ -45,6 +44,9 @@ SGBucket::SGBucket(const double dlon, const double dlat) {
     set_bucket(dlon, dlat);
 }
 
+SGBucket::SGBucket(const SGGeod& geod) {
+    set_bucket(geod);
+}
 
 // create an impossible bucket if false
 SGBucket::SGBucket(const bool is_good) {
@@ -74,11 +76,6 @@ SGBucket::SGBucket(const long int bindex) {
 }
 
 
-// default destructor
-SGBucket::~SGBucket() {
-}
-
-
 // Set the bucket params for the specified lat and lon
 void SGBucket::set_bucket( double *lonlat ) {
     set_bucket( lonlat[0], lonlat[1] );
@@ -109,7 +106,7 @@ void SGBucket::set_bucket( double dlon, double dlat ) {
     } else if ( span <= 1.0 ) {
        x = (int)((dlon - lon) / span);
     } else {
-       if ( (dlon >= 0) || (fabs(diff) < SG_EPSILON) ) {
+       if ( dlon >= 0 ) {
            lon = (int)( (int)(lon / span) * span);
        } else {
            // cout << " lon = " << lon 
@@ -136,6 +133,11 @@ void SGBucket::set_bucket( double dlon, double dlat ) {
 }
 
 
+void SGBucket::set_bucket(const SGGeod& geod)
+{
+    set_bucket(geod.getLongitudeDeg(), geod.getLatitudeDeg());
+}
+
 // Build the path name for this bucket
 string SGBucket::gen_base_path() const {
     // long int index;