I'd consider the real issue here "turning on TerraSync by just ticking the box should work". It currently doesn't, for several reasons:

1) The TerraSync dialog box (Environment > Scenery Download) only allows selecting directories that are in FG_SCENERY (so the new scenery will be read) but not FG_ROOT/Scenery (as noted above, TerraSync isn't meant to be run there). By default, FG_SCENERY = FG_ROOT/Scenery, so there are no directories available for selection and TerraSync hence can't be turned on. (The dialog script then tries, and fails, to display an error message stating this: fixed by terrasync_error_display.patch)

I suggest including the TerraSync directory in the default scenery directories even if TerraSync is currently off, both to allow it to be turned on from this dialog box, and to keep displaying existing TerraSync scenery if the user later disables new downloads (e.g. because they are running out of data allowance). This is done by terrasync_directory.patch.

This patch does not change the default TerraSync directory (currently $HOME/.fgfs/TerraSync, which will be created if necessary); this can easily be changed in flightgear/src/Main/options.cxx near line 2050, but using a shared directory (such as /var/games/flightgear/TerraSync) would require either making all the downloaded files world-writable (which libsvn doesn't appear to provide a way to do) or making FlightGear setgid (allowed by Policy 11.11, but would it be a good idea security-wise?).

2) If one uses Select Airport to go to a less-negative lat/long (e.g. KSFO to nearly anywhere else in the Americas) the tile one is now in is not downloaded, as the tile selection process rounds the lat/long towards 0 but the tile names are rounded down. Fixed by terrasync_fix_rounding.patch.

3) Select Airport does not wait for the new scenery to become available, so to see it one has to refresh scenery (to load it) then Select Airport again (to get to the new ground level). I don't have an actual fix for that yet, but terrasync_document_ground_refresh.patch adds a note stating this workaround.

These patches were tested together (in upstream 2.12rc) but should all be independent.
Set a default TerraSync directory, so the user can turn TerraSync on by simply ticking the box.

--- /home/palmer/flightgear_source/fg-flightgear/src/Main/options.cxx_orig	2013-09-23 19:02:44.193288081 +0100
+++ /home/palmer/flightgear_source/fg-flightgear/src/Main/options.cxx	2013-09-26 10:22:13.524362071 +0100
@@ -2040,8 +2040,10 @@ void Options::processOptions()
     globals->append_fg_scenery(envp);
   }
     
+  bool no_explicit_scenery_dir=globals->get_fg_scenery().empty(); //need to do terrasync dir before FG_ROOT so it takes priority
+
 // terrasync directory fixup
-  if (fgGetBool("/sim/terrasync/enabled")) {
+  if ( no_explicit_scenery_dir || fgGetBool("/sim/terrasync/enabled")) { //the no_explicit_scenery_dir case is because TerraSync can't be turned on from the dialog box if there is no non-fg-root directory in fg-scenery for it to be turned on in, and also because a user turning TerraSync off due to lack of bandwidth probably doesn't want their already-installed TerraSync scenery to disappear
     string terrasyncDir = fgGetString("/sim/terrasync/scenery-dir");
     if (terrasyncDir.empty()) {
       SGPath p(globals->get_fg_home());
@@ -2052,11 +2054,11 @@ void Options::processOptions()
       fgSetString("/sim/terrasync/scenery-dir", terrasyncDir);
     }
       
-      SGPath p(terrasyncDir);
-      if (!p.exists()) {
+    SGPath p(terrasyncDir);
+    if (!p.exists()) {
           simgear::Dir dd(p);
           dd.create(0700);
-      }
+    }
     
     const string_list& scenery_paths(globals->get_fg_scenery());
     if (std::find(scenery_paths.begin(), scenery_paths.end(), terrasyncDir) == scenery_paths.end()) {
@@ -2064,13 +2066,13 @@ void Options::processOptions()
       globals->append_fg_scenery(terrasyncDir);
     }
   }
-  
-  if (globals->get_fg_scenery().empty()) {
-    // no scenery paths set *at all*, use the data in FG_ROOT
+  if (no_explicit_scenery_dir) {
+    // use the data in FG_ROOT
     SGPath root(globals->get_fg_root());
     root.append("Scenery");
     globals->append_fg_scenery(root.str());
   }
+  
 }
   
 void Options::showUsage() const
Make the "don't run terrasync in FG_ROOT/Scenery" error message actually appear.

--- /home/palmer/flightgear_source/fgfsinstall2-12/lib/FlightGear/gui/dialogs/terrasync.xml_orig	2013-07-29 10:41:14.000000000 +0100
+++ /home/palmer/flightgear_source/fgfsinstall2-12/lib/FlightGear/gui/dialogs/terrasync.xml_fix1	2013-09-26 09:48:55.397460111 +0100
@@ -540,7 +540,7 @@
 
       # Add error text if the user only has fg-data/Scenery available and disable controls.
       if (!valid) {
-        var warning = cmdarg().getChildren("group")[1].getChildren("text")[1];
+        var warning = gui.findElementByName(cmdarg(),"warning_text");
         var txt = "You must configure a separate FG_SCENERY directory for automatic scenery download";
         warning.getNode("label").setValue(txt);
       }
Pass the lat/long rounded down (as used in tile names and expected by terrasync, e.g. 40.7,-90.4 -> w091n40), instead of the default rounded-towards-0 (40.7,-90.4 -> w090n40).

--- /home/palmer/flightgear_source/fg-flightgear/src/Scenery/tilemgr.cxx_orig	2013-09-24 18:13:49.346253295 +0100
+++ /home/palmer/flightgear_source/fg-flightgear/src/Scenery/tilemgr.cxx	2013-09-24 16:35:02.505198514 +0100
@@ -382,7 +382,7 @@ void FGTileMgr::schedule_tiles_at(const
             scheduled_visibility = range_m;
             schedule_needed(current_bucket, range_m);
             if (_terra_sync)
-                _terra_sync->schedulePosition(latitude,longitude);
+                _terra_sync->schedulePosition(floor(latitude),floor(longitude));
         }
         // save bucket
         previous_bucket = current_bucket;
I'd prefer to actually fix this problem, but suspect this may not be easy, so document the workaround for now.

--- /home/palmer/flightgear_source/fgfsinstall2-12/lib/FlightGear/gui/dialogs/terrasync.xml_fix1	2013-09-26 09:48:55.397460111 +0100
+++ /home/palmer/flightgear_source/fgfsinstall2-12/lib/FlightGear/gui/dialogs/terrasync.xml	2013-09-26 12:57:50.620927374 +0100
@@ -148,6 +148,21 @@
       </binding>
     </button>
 
+    <text>
+      <row>7</row>
+      <col>0</col><colspan>4</colspan>
+      <halign>center</halign>
+      <wrap>true</wrap>
+      <label>If you see only water after "Select airport", wait for scenery to download,</label>
+    </text>
+    <text>
+      <row>8</row>
+      <col>0</col><colspan>4</colspan>
+      <halign>center</halign>
+      <wrap>true</wrap>
+      <label>click "Manual Refresh" above (scenery will appear above you), then "Select airport" again.</label>
+    </text>
+
 <!--
     <checkbox>
       <name>internal-svn</name>

Reply via email to