Exemplo n.º 1
0
 public void SetUp()
 {
     m_stringWriter    = new StringWriter();
     m_document        = new CzmlDocument(m_stringWriter);
     m_metadata        = new StringDictionary();
     m_pointPattern    = @"{""id"":""[0-9a-zA-Z-]+"",""position"":{""cartographicRadians"":\[-?(\d)*(\.([\de-])*)?,-?(\d)*(\.([\de-])*)?,-?(\d)*(\.([\de-])*)?\]},""point"":{""color"":{""rgba"":\[\d{1,3},\d{1,3},\d{1,3},\d{1,3}\]}}}";
     m_polygonPattern  = @"{""id"":""[0-9a-zA-Z-]+"",""polygon"":{""material"":{""solidColor"":{""color"":{""rgba"":\[\d{1,3},\d{1,3},\d{1,3},\d{1,3}\]}}}},""vertexPositions"":{""cartographicRadians"":\[(-?(\d)*(\.([\de-])*)?,-?(\d)*(\.([\de-])*)?,-?(\d)*(\.([\de-])*)?,?)+\]}}";
     m_polylinePattern = @"{""id"":""[0-9a-zA-Z-]+"",""vertexPositions"":{""cartographicRadians"":\[(-?(\d)*(\.([\de-])*)?,-?(\d)*(\.([\de-])*)?,-?(\d)*(\.([\de-])*)?,?)+\]},""polyline"":{""color"":{""rgba"":\[\d{1,3},\d{1,3},\d{1,3},\d{1,3}\]}}}";
     m_trianglePattern = @"{""id"":""[0-9a-zA-Z-]+"",""polygon"":{""material"":{""solidColor"":{""color"":{""rgba"":\[\d{1,3},\d{1,3},\d{1,3},\d{1,3}\]}}}},""vertexPositions"":{""cartographicRadians"":\[(-?(\d)*(\.([\de-])*)?,?){9}\]}}";
 }
Exemplo n.º 2
0
        public EntityPlatform(ExampleEntity entity, EarthCentralBody earth, string dataPath)
        {
            //id, string
            m_id = entity.EntityIdentifier.ToString();

            //name, string
            string name = entity.Marking.ToString();

            //Last Update, DateTime
            DateTime time = DateTime.Parse(entity.LastUpdateDateTime.ToString());

            //Position, Cartesian
            string[] xyz = entity.Position.ToString().Split(',');
            Cartesian position = new Cartesian(Convert.ToDouble(xyz[0]), Convert.ToDouble(xyz[1]), Convert.ToDouble(xyz[2]));

            m_platform = new Platform();
            m_platform.Name = name;
            m_platform.LocationPoint = new PointCartographic(earth, earth.Shape.CartesianToCartographic(position));
            m_platform.OrientationAxes = new AxesVehicleVelocityLocalHorizontal(earth.FixedFrame, m_platform.LocationPoint);

            LabelGraphicsExtension labelExtension = new LabelGraphicsExtension(new LabelGraphics
            {
                Text = new ConstantCesiumProperty<string>(name),
                Scale = new ConstantCesiumProperty<double>(0.5),
                FillColor = new ConstantCesiumProperty<Color>(Color.White),
                PixelOffset = new ConstantCesiumProperty<Rectangular>(new Rectangular(35, -15))
            });
            m_platform.Extensions.Add(labelExtension);

            string symbol = entity.Symbology.ToString().Replace('*', '_') + ".png";
            CesiumResource billboardResource = new CesiumResource(new Uri(dataPath + symbol), CesiumResourceBehavior.LinkTo);
            BillboardGraphicsExtension billboardExtension = new BillboardGraphicsExtension(new BillboardGraphics
            {
                Image = new ConstantCesiumProperty<CesiumResource>(billboardResource),
                Show = true,
                Scale = new ConstantCesiumProperty<double>(1)
            });
            m_platform.Extensions.Add(billboardExtension);

            m_czmlDocument = new CzmlDocument();
            m_czmlDocument.Name = "Realtime";
            m_czmlDocument.RequestedInterval = new TimeInterval(new JulianDate(DateTime.Now), new JulianDate(DateTime.Now.AddDays(1.0)));
            m_czmlDocument.Clock = new Clock
            {
                Step = ClockStep.SystemClock
            };

            m_czmlDocument.ObjectsToWrite.Add(m_platform);
        }
Exemplo n.º 3
0
        /// <summary>
        /// This method will be called after all the objects above are created.
        /// </summary>
        public void WriteDocument(TextWriter writer)
        {
            // Configure the interval over which to generate data.
            // In this case, compute 1 day of data.
            var dataInterval = new TimeInterval(m_epoch, m_epoch.AddDays(1));

            // Create and configure the CZML document.
            var czmlDocument = new CzmlDocument
            {
                Name              = "CesiumDemo",
                Description       = "Demonstrates CZML generation using STK Components",
                RequestedInterval = dataInterval,
                // For this demonstration, include whitespace in the CZML
                // to enable easy inspection of the contents. In a real application,
                // this would usually be false to reduce file size.
                PrettyFormatting = true,
                // Configure the clock on the client to reflect the time for which the data is computed.
                Clock = new Clock
                {
                    Interval    = dataInterval,
                    CurrentTime = dataInterval.Start,
                    Multiplier  = 15.0,
                },
            };

            // Add all of our objects with graphical extensions.
            czmlDocument.ObjectsToWrite.Add(m_satellite);
            czmlDocument.ObjectsToWrite.Add(m_satelliteXAxis);
            czmlDocument.ObjectsToWrite.Add(m_satelliteYAxis);
            czmlDocument.ObjectsToWrite.Add(m_satelliteZAxis);
            czmlDocument.ObjectsToWrite.Add(m_satelliteSunVector);
            czmlDocument.ObjectsToWrite.Add(m_facility);
            czmlDocument.ObjectsToWrite.Add(m_satelliteFacilityLink);
            czmlDocument.ObjectsToWrite.Add(m_facilitySensor);
            czmlDocument.ObjectsToWrite.Add(m_sensorDome);
            czmlDocument.ObjectsToWrite.Add(m_rotatingSensor);
            czmlDocument.ObjectsToWrite.Add(m_maskPlatform);
            czmlDocument.ObjectsToWrite.Add(m_aircraft);
            czmlDocument.ObjectsToWrite.Add(m_aircraftSensorOne);
            czmlDocument.ObjectsToWrite.Add(m_aircraftSensorTwo);
            czmlDocument.ObjectsToWrite.Add(m_aircraftAzimuthElevationMaskLink);

            // Write the CZML.
            czmlDocument.WriteDocument(writer);
        }
Exemplo n.º 4
0
 public void SetUp()
 {
     m_stringWriter = new StringWriter();
     m_document     = new CzmlDocument(m_stringWriter);
     m_document.NamespaceDeclarations["gx"] = m_gxNamespace;
 }
Exemplo n.º 5
0
 public void SetUp()
 {
     m_stringWriter = new StringWriter();
     m_document     = new CzmlDocument(m_stringWriter);
 }