/// <summary>
        ///  Return a string in KML format containing all pre animation definitions
        ///  that are required for the aircraft
        /// </summary>
        /// <returns></returns>
        public string KMLSetup()
        {
            RDToGeographic converter    = new RDToGeographic();
            string         heatmapSetup = "<Folder>";

            for (int i = 1; i < _population.Count; i++)
            {
                if (i % 1000 == 0)
                {
                    Console.WriteLine(i);
                }
                double[] row        = _population[i];
                var      point      = converter.convertToLatLong(row[0], row[1]);
                var      test       = new GeoPoint3D(point.X, point.Y, 0);
                var      upperRight = test.MoveInDirection(DotSize, 45);
                var      lowerLeft  = test.MoveInDirection(DotSize, 225);

                heatmapSetup += @"
    <GroundOverlay>
      <name> house" + i + @"</name>
      <Icon>
        <href>" + DotFile + @"</href>
      </Icon>
      <LatLonBox>
        <north>" + upperRight.Latitude + @"</north>
        <south>" + lowerLeft.Latitude + @"</south>
        <east>" + upperRight.Longitude + @"</east>
        <west>" + lowerLeft.Longitude + @"</west>
      </LatLonBox>
    </GroundOverlay>
                    ";
            }
            heatmapSetup += @"</Folder>";
            return(heatmapSetup);
        }
Exemplo n.º 2
0
        public void GeoPointMoveDirectionTest()
        {
            GeoPoint3D point      = new GeoPoint3D(1.5, 2.3, 4.5);
            GeoPoint3D movedPoint = point.MoveInDirection(12.5, 50);

            GeoPoint3D destination = new GeoPoint3D(0, 100, 100);

            Assert.AreEqual(1.5, movedPoint.Longitude, 0.001);
        }
        public string KMLSetup()
        {
            var        cameraHeading    = (_trajectory.Heading(0) - 40) % 360;
            GeoPoint3D aircraftLocation = _trajectory.GeoPoint(0);
            GeoPoint3D cameraLocation   = aircraftLocation.MoveInDirection(-1600, cameraHeading);

            return(@"
    <LookAt>
        <latitude>" + cameraLocation.Latitude + @"</latitude>
        <longitude>" + cameraLocation.Longitude + @"</longitude>
        <altitude>" + (cameraLocation.Z + 350) + @"</altitude>
        <altitudeMode>absolute</altitudeMode>
        <heading>" + cameraHeading + @"</heading>
        <tilt>" + 75 + @"</tilt>
    </LookAt>
            ");
        }
        public void ConvertLatLongCustom()
        {
            int    referenceRdX    = 155000;
            int    referenceRdY    = 463000;
            double referenceWgs84X = 52.15517;
            double referenceWgs84Y = 5.387206;

            x = 122202;
            y = 487250;
            var    refPoint    = new Point3D(referenceRdX, referenceRdY, 0, CoordinateUnit.metric);
            var    conPoint    = new Point3D(x, y, 0, CoordinateUnit.metric);
            double heading     = refPoint.HeadingTo(conPoint);
            var    refGeoPoint = new GeoPoint3D(referenceWgs84Y, referenceWgs84X, 0);
            var    conGeoPoint = refGeoPoint.MoveInDirection(conPoint.DistanceTo(refPoint), heading);

            Assert.AreEqual(52.37214, conGeoPoint.Latitude, 0.001);
            Assert.AreEqual(4.905598, conGeoPoint.Longitude, 0.001);
        }
        public string KMLAnimationStep(int t)
        {
            var        cameraHeading    = (_trajectory.Heading(t) - 40) % 360;
            GeoPoint3D aircraftLocation = _trajectory.GeoPoint(t);
            GeoPoint3D cameraLocation   = aircraftLocation.MoveInDirection(-1600, cameraHeading);

            if (t == 0)
            {
                return(@"
<gx:FlyTo>
    <gx:duration>1.0</gx:duration>
    <LookAt>
        <latitude>" + cameraLocation.Latitude + @"</latitude>
        <longitude>" + cameraLocation.Longitude + @"</longitude>
        <altitude>" + (cameraLocation.Z + 350) + @"</altitude>
        <altitudeMode>absolute</altitudeMode>
        <heading>" + cameraHeading + @"</heading>
        <tilt>" + 75 + @"</tilt>
    </LookAt>
</gx:FlyTo>
                ");
            }

            return(@"
<gx:FlyTo>
    <gx:duration>1.0</gx:duration>
    <gx:flyToMode>smooth</gx:flyToMode>
    <LookAt>
        <latitude>" + cameraLocation.Latitude + @"</latitude>
        <longitude>" + cameraLocation.Longitude + @"</longitude>
        <altitude>" + (cameraLocation.Z + 350) + @"</altitude>
        <altitudeMode>absolute</altitudeMode>
        <heading>" + cameraHeading + @"</heading>
        <tilt>" + 75 + @"</tilt>
    </LookAt>
</gx:FlyTo>
            ");
        }