Example #1
0
        static void Main(string[] args)
        {
            try
            {
                // Set the Culture Info for the entire main thread.
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");

                // Using the "Command Line Parser Library" from CodePlex
                // The MIT License (MIT)
                // Copyright (c) 2005 - 2012 Giacomo Stelluti Scala
                var options = new Options();
                ICommandLineParser parser = new CommandLineParser();

                /// Example
                /// elevation --dms-latitude 61:53:37.20 --dms-longitude 9:51:43.92 --num-cells-I 10 --num-cells-J 10 --distance-ew 2000.0 --distance-ns 2000.0 --output rondane.stl
                if (parser.ParseArguments(args, options))
                {
                    // consume Options type properties
                    var lat    = options.dmsLatitude;
                    var lon    = options.dmsLongitude;
                    var ni     = options.NI;
                    var nj     = options.NJ;
                    var distSN = options.distNS;
                    var distEW = options.distEW;

                    // Generate a surface, i.e. a map of LatLonAlt types surrounding the initial
                    // central location given by the user.
                    var surface   = new Surface(new LatLonAlt(lat, lon), distSN, distEW);
                    var locations = new LatLonAlt[ni, nj];
                    surface.GenerateSurface(ref locations);

                    // Fetch elevation data from Google
                    var service = new GoogleElevationService();
                    service.FillElevationData(ref locations);

                    // Generate a matrix of vertices using cartesian coordinates with
                    // the point of interest in the center (0,0)
                    var vertices = GenerateVerticesMatrix(ref locations, ni, nj, distEW, distSN);

                    // Write the map to an STL output file
                    var fileName = options.Output;
                    //var vertices = Vertex.ToVertex(ref locations);
                    var stl = new Stereolithography(vertices); // vertices);
                    stl.Write(fileName);

                    Console.WriteLine(String.Format("Output written to {0}", fileName));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception Error", e);
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            try
            {
                // Set the Culture Info for the entire main thread.
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");

                // Using the "Command Line Parser Library" from CodePlex
                // The MIT License (MIT)
                // Copyright (c) 2005 - 2012 Giacomo Stelluti Scala
                var options = new Options();
                ICommandLineParser parser = new CommandLineParser();

                /// Example
                /// elevation --dms-latitude 61:53:37.20 --dms-longitude 9:51:43.92 --num-cells-I 10 --num-cells-J 10 --distance-ew 2000.0 --distance-ns 2000.0 --output rondane.stl
                if (parser.ParseArguments(args, options))
                {
                    // consume Options type properties
                    var lat = options.dmsLatitude;
                    var lon = options.dmsLongitude;
                    var ni = options.NI;
                    var nj = options.NJ;
                    var distSN = options.distNS;
                    var distEW = options.distEW;

                    // Generate a surface, i.e. a map of LatLonAlt types surrounding the initial
                    // central location given by the user.
                    var surface = new Surface(new LatLonAlt(lat, lon), distSN, distEW);
                    var locations = new LatLonAlt[ni, nj];
                    surface.GenerateSurface(ref locations);

                    // Fetch elevation data from Google
                    var service = new GoogleElevationService();
                    service.FillElevationData(ref locations);

                    // Generate a matrix of vertices using cartesian coordinates with
                    // the point of interest in the center (0,0)
                    var vertices = GenerateVerticesMatrix(ref locations, ni, nj, distEW, distSN);

                    // Write the map to an STL output file
                    var fileName = options.Output;
                    //var vertices = Vertex.ToVertex(ref locations);
                    var stl = new Stereolithography(vertices); // vertices);
                    stl.Write(fileName);

                    Console.WriteLine(String.Format("Output written to {0}", fileName));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception Error", e);
            }
        }