Alex Perry :
* Doesn't download the area at lot,lon of 0,0 if terrasync starts before FlightGear is ready * Attempt to download the Airports directory when no scenery needs to be fetched * Add svn over http support for flag "-S", in addition to the existing default of rsync * Add the command line flag "-T" to just refresh the KSFO surrounding area and exit Frederic Bouvier: Add a MSVC71 project file
This commit is contained in:
parent
30b8cde4c0
commit
c6e4bb0669
4 changed files with 261 additions and 54 deletions
|
@ -18,3 +18,5 @@ FlightGear.ncb
|
|||
FlightGear.suo
|
||||
metar_Debug
|
||||
metar_Release
|
||||
Terrasync_Release
|
||||
Terrasync_Debug
|
||||
|
|
|
@ -49,6 +49,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "metar", "metar.vcproj", "{F
|
|||
{22540CD3-D3CA-4C86-A773-80AEEE3ACDED} = {22540CD3-D3CA-4C86-A773-80AEEE3ACDED}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "terrasync", "terrasync.vcproj", "{874D3F55-6048-4068-A7C2-7FA6AF1F30EA}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{22540CD3-D3CA-4C86-A773-80AEEE3ACDED} = {22540CD3-D3CA-4C86-A773-80AEEE3ACDED}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
|
@ -91,6 +96,10 @@ Global
|
|||
{FC424099-5D77-4BC2-A93F-2EE59F816B51}.Debug.Build.0 = Debug|Win32
|
||||
{FC424099-5D77-4BC2-A93F-2EE59F816B51}.Release.ActiveCfg = Release|Win32
|
||||
{FC424099-5D77-4BC2-A93F-2EE59F816B51}.Release.Build.0 = Release|Win32
|
||||
{874D3F55-6048-4068-A7C2-7FA6AF1F30EA}.Debug.ActiveCfg = Debug|Win32
|
||||
{874D3F55-6048-4068-A7C2-7FA6AF1F30EA}.Debug.Build.0 = Debug|Win32
|
||||
{874D3F55-6048-4068-A7C2-7FA6AF1F30EA}.Release.ActiveCfg = Release|Win32
|
||||
{874D3F55-6048-4068-A7C2-7FA6AF1F30EA}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
|
|
140
projects/VC7.1/terrasync.vcproj
Executable file
140
projects/VC7.1/terrasync.vcproj
Executable file
|
@ -0,0 +1,140 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="terrasync"
|
||||
ProjectGUID="{874D3F55-6048-4068-A7C2-7FA6AF1F30EA}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Terrasync_Debug"
|
||||
IntermediateDirectory="Terrasync_Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\SimGear;..\..\..\install\msvc71\OpenSceneGraph\include;..\..\.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NOMINMAX"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ul_d.lib sg_d.lib net_d.lib ws2_32.lib"
|
||||
OutputFile="$(OutDir)/terrasync.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\plib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/terrasync.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Terrasync_Release"
|
||||
IntermediateDirectory="Terrasync_Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\..\SimGear;..\..\..\install\msvc71\OpenSceneGraph\include;..\..\.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NOMINMAX"
|
||||
RuntimeLibrary="2"
|
||||
RuntimeTypeInfo="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ul.lib sg.lib net.lib ws2_32.lib"
|
||||
OutputFile="$(OutDir)/terrasync.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\plib"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\utils\TerraSync\terrasync.cxx">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -3,6 +3,7 @@
|
|||
// Written by Curtis Olson, started November 2002.
|
||||
//
|
||||
// Copyright (C) 2002 Curtis L. Olson - http://www.flightgear.org/~curt
|
||||
// Copyright (C) 2008 Alexander R. Perry <alex.perry@ieee.org>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
@ -40,24 +41,36 @@
|
|||
#include <plib/ul.h>
|
||||
|
||||
#include <simgear/bucket/newbucket.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
|
||||
using std::string;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
static string server = "scenery.flightgear.org";
|
||||
static string source_module = "Scenery";
|
||||
static string source_base = server + (string)"::" + source_module;
|
||||
static string dest_base = "/dest/scenery/dir";
|
||||
const char* svn_base =
|
||||
"http://terrascenery.googlecode.com/svn/trunk/data/Scenery";
|
||||
const char* rsync_base = "scenery.flightgear.org::Scenery";
|
||||
const char* source_base = NULL;
|
||||
const char* dest_base = "terrasyncdir";
|
||||
bool use_svn = false;
|
||||
|
||||
const char* svn_cmd = "svn checkout";
|
||||
const char* rsync_cmd =
|
||||
"rsync --verbose --archive --delete --perms --owner --group";
|
||||
|
||||
|
||||
// display usage
|
||||
static void usage( const string& prog ) {
|
||||
cout << "Usage: " << prog
|
||||
<< " -p <port> [ -s <rsync_source> ] -d <rsync_dest>" << endl;
|
||||
cout << "Usage: " << endl
|
||||
<< prog << " -p <port> "
|
||||
<< "[ -R ] [ -s <rsync_source> ] -d <dest>" << endl
|
||||
<< prog << " -p <port> "
|
||||
<< " -S [ -s <svn_source> ] -d <dest>" << endl;
|
||||
}
|
||||
|
||||
|
||||
const int nowhere = -9999;
|
||||
|
||||
// parse message
|
||||
static void parse_message( const string &msg, int *lat, int *lon ) {
|
||||
double dlat, dlon;
|
||||
|
@ -105,6 +118,44 @@ static void parse_message( const string &msg, int *lat, int *lon ) {
|
|||
} else {
|
||||
*lon = (int)dlon;
|
||||
}
|
||||
|
||||
if ((dlon == 0) && (dlat == 0)) {
|
||||
*lon = nowhere;
|
||||
*lat = nowhere;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// sync one directory tree
|
||||
void sync_tree(char* dir) {
|
||||
int rc;
|
||||
char command[512];
|
||||
SGPath path( dest_base );
|
||||
|
||||
path.append( dir );
|
||||
rc = path.create_dir( 0755 );
|
||||
if (rc) {
|
||||
cout << "Return code = " << rc << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (use_svn) {
|
||||
snprintf( command, 512,
|
||||
"%s %s/%s %s/%s", svn_cmd,
|
||||
source_base, dir,
|
||||
dest_base, dir );
|
||||
} else {
|
||||
snprintf( command, 512,
|
||||
"%s %s/%s/ %s/%s/", rsync_cmd,
|
||||
source_base, dir,
|
||||
dest_base, dir );
|
||||
}
|
||||
cout << command << endl;
|
||||
rc = system( command );
|
||||
if (rc) {
|
||||
cout << "Return code = " << rc << endl;
|
||||
if (rc == 5120) exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -134,47 +185,21 @@ static void sync_area( int lat, int lon ) {
|
|||
}
|
||||
EW = 'w';
|
||||
} else {
|
||||
baselon = (int)(lon / 10) * 10;
|
||||
EW = 'e';
|
||||
}
|
||||
|
||||
char command[512];
|
||||
char container_dir[512];
|
||||
baselon = (int)(lon / 10) * 10;
|
||||
EW = 'e';
|
||||
}
|
||||
|
||||
const char* terrainobjects[3] = { "Terrain", "Objects", 0 };
|
||||
const char** tree;
|
||||
char dir[512];
|
||||
|
||||
// Sync Terrain
|
||||
snprintf( container_dir, 512, "%s/Terrain/%c%03d%c%02d",
|
||||
dest_base.c_str(), EW, abs(baselon), NS, abs(baselat) );
|
||||
snprintf( command, 512, "mkdir -p %s", container_dir );
|
||||
cout << command << endl;
|
||||
system( command );
|
||||
|
||||
snprintf( dir, 512, "Terrain/%c%03d%c%02d/%c%03d%c%02d",
|
||||
EW, abs(baselon), NS, abs(baselat),
|
||||
EW, abs(lon), NS, abs(lat) );
|
||||
|
||||
snprintf( command, 512,
|
||||
"rsync --verbose --archive --delete --perms --owner --group %s/%s/ %s/%s",
|
||||
source_base.c_str(), dir, dest_base.c_str(), dir );
|
||||
cout << command << endl;
|
||||
system( command );
|
||||
|
||||
// Sync Objects
|
||||
snprintf( container_dir, 512, "%s/Objects/%c%03d%c%02d",
|
||||
dest_base.c_str(), EW, abs(baselon), NS, abs(baselat) );
|
||||
snprintf( command, 512, "mkdir -p %s", container_dir );
|
||||
cout << command << endl;
|
||||
system( command );
|
||||
|
||||
snprintf( dir, 512, "Objects/%c%03d%c%02d/%c%03d%c%02d",
|
||||
EW, abs(baselon), NS, abs(baselat),
|
||||
EW, abs(lon), NS, abs(lat) );
|
||||
|
||||
snprintf( command, 512,
|
||||
"rsync --verbose --archive --delete --perms --owner --group %s/%s/ %s/%s",
|
||||
source_base.c_str(), dir, dest_base.c_str(), dir );
|
||||
cout << command << endl;
|
||||
system( command );
|
||||
|
||||
for (tree = &terrainobjects[0]; *tree; tree++) {
|
||||
snprintf( dir, 512, "%s/%c%03d%c%02d/%c%03d%c%02d",
|
||||
*tree,
|
||||
EW, abs(baselon), NS, abs(baselat),
|
||||
EW, abs(lon), NS, abs(lat) );
|
||||
sync_tree(dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -223,6 +248,13 @@ int main( int argc, char **argv ) {
|
|||
} else if ( (string)argv[i] == "-d" ) {
|
||||
++i;
|
||||
dest_base = argv[i];
|
||||
} else if ( (string)argv[i] == "-R" ) {
|
||||
use_svn = false;
|
||||
} else if ( (string)argv[i] == "-S" ) {
|
||||
use_svn = true;
|
||||
} else if ( (string)argv[i] == "-T" ) {
|
||||
sync_areas( 37, -123, 0, 0 );
|
||||
exit(0);
|
||||
} else {
|
||||
usage( argv[0] );
|
||||
exit(-1);
|
||||
|
@ -230,6 +262,14 @@ int main( int argc, char **argv ) {
|
|||
++i;
|
||||
}
|
||||
|
||||
// Use the appropriate default for the "-s" flag
|
||||
if (source_base == NULL) {
|
||||
if (use_svn)
|
||||
source_base = svn_base;
|
||||
else
|
||||
source_base = rsync_base;
|
||||
}
|
||||
|
||||
// Must call this before any other net stuff
|
||||
netInit( &argc,argv );
|
||||
|
||||
|
@ -251,9 +291,10 @@ int main( int argc, char **argv ) {
|
|||
int maxlen = 256;
|
||||
int len;
|
||||
int lat, lon;
|
||||
int last_lat = -9999;
|
||||
int last_lon = -9999;
|
||||
int last_lat = nowhere;
|
||||
int last_lon = nowhere;
|
||||
bool recv_msg = false;
|
||||
int synced_other = 0;
|
||||
|
||||
while ( true ) {
|
||||
recv_msg = false;
|
||||
|
@ -262,13 +303,13 @@ int main( int argc, char **argv ) {
|
|||
recv_msg = true;
|
||||
|
||||
parse_message( msg, &lat, &lon );
|
||||
cout << "pos = " << lat << "," << lon << endl;
|
||||
cout << "pos in msg = " << lat << "," << lon << endl;
|
||||
}
|
||||
|
||||
if ( recv_msg ) {
|
||||
if ( lat != last_lat || lon != last_lon ) {
|
||||
int lat_dir, lon_dir, dist;
|
||||
if ( last_lat == -9999 || last_lon == -9999 ) {
|
||||
if ( last_lat == nowhere || last_lon == nowhere ) {
|
||||
lat_dir = lon_dir = 0;
|
||||
} else {
|
||||
dist = lat - last_lat;
|
||||
|
@ -285,16 +326,31 @@ int main( int argc, char **argv ) {
|
|||
}
|
||||
}
|
||||
cout << "lat = " << lat << " lon = " << lon << endl;
|
||||
cout << "lat_dir = " << lat_dir << " " << " lon_dir = " << lon_dir << endl;
|
||||
cout << "lat_dir = " << lat_dir << " "
|
||||
<< "lon_dir = " << lon_dir << endl;
|
||||
sync_areas( lat, lon, lat_dir, lon_dir );
|
||||
}
|
||||
} else if ( last_lat == nowhere || last_lon == nowhere ) {
|
||||
cout << "Waiting for FGFS to finish startup" << endl;
|
||||
} else {
|
||||
switch (synced_other++) {
|
||||
case 0:
|
||||
sync_tree((char*) "Airports/K");
|
||||
break;
|
||||
case 1:
|
||||
sync_tree((char*) "Airports");
|
||||
break;
|
||||
default:
|
||||
cout << "Done non-tile syncs" << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
last_lat = lat;
|
||||
last_lon = lon;
|
||||
}
|
||||
}
|
||||
|
||||
ulSleep( 1 );
|
||||
}
|
||||
} // while true
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue