]> git.mxchange.org Git - simgear.git/blobdiff - simgear/bucket/newbucket.cxx
sprintf -> snprintf in bucket code.
[simgear.git] / simgear / bucket / newbucket.cxx
index 227d9979382c064590384a2dd8434e682db6af77..0a2e542c3f706290728ee877a7e2a431a3faba31 100644 (file)
@@ -212,7 +212,7 @@ std::string SGBucket::gen_base_path() const {
        main_lat *= -1;
     }
 
-    sprintf(raw_path, "%c%03d%c%02d/%c%03d%c%02d", 
+    snprintf(raw_path, 256, "%c%03d%c%02d/%c%03d%c%02d", 
            hem, top_lon, pole, top_lat, 
            hem, main_lon, pole, main_lat);
 
@@ -224,17 +224,6 @@ std::string SGBucket::gen_base_path() const {
 
 // return width of the tile in degrees
 double SGBucket::get_width() const {
-    if (lon==-180 && (lat==-89 || lat==88) ) {
-        /* Normally the tile at 180W in 88N and 89S
-         * would cover 184W to 176W and the next
-         * on the east side starts at 176W.
-         * To correct, make this a special tile
-         * from 180W to 176W with 4 degrees width
-         * instead of the normal 8 degrees at
-         * that latitude.
-         */
-         return 4.0;
-    }
     return sg_bucket_span( get_center_lat() );
 }
 
@@ -356,4 +345,13 @@ void sgBucketDiff( const SGBucket& b1, const SGBucket& b2, int *dx, int *dy ) {
 #endif
 }
 
+void sgGetBuckets( const SGGeod& min, const SGGeod& max, std::vector<SGBucket>& list ) {
+    double lon, lat, span;
 
+    for (lat = min.getLatitudeDeg(); lat <= max.getLatitudeDeg(); lat += SG_BUCKET_SPAN) {
+        span = sg_bucket_span( lat );
+        for (lon = min.getLongitudeDeg(); lon <= max.getLongitudeDeg(); lon += span) {
+            list.push_back( SGBucket(lon , lat) );
+        }
+    }
+}