コード例 #1
0
        static void GpsPositionReceived(object sender, EventArgs e)
        {
            if (sender is GPSPositionSensor && refPosition == null)
            {
                if ((int)((GPSPositionSensor)sender).Latitude.value != 0)
                    refPosition = (GPSPositionSensor)sender;
            }
            else if (sender is PositionState && refPosition != null)
            {
                PositionState pos = (PositionState)sender;

                coords.Add(new SharpKml.Base.Vector(
                    Convert.ToDouble((int)refPosition.Latitude.value + (float)pos.East.value) / 10000000f,
                    Convert.ToDouble((int)refPosition.Longitude.value + (float)pos.North.value) / 10000000f,
                    Convert.ToDouble(140f - Convert.ToDouble(pos.Down.value)))
                );

            }

            
            
            
        }
コード例 #2
0
		/**
		 * Create a clone of this object, a new instance ID must be specified.
		 * Do not use this function directly to create new instances, the
		 * UAVObjectManager should be used instead.
		 */
		public override UAVDataObject clone(long instID) {
			// TODO: Need to get specific instance to clone
			try {
				GPSPositionSensor obj = new GPSPositionSensor();
				obj.initialize(instID, this.getMetaObject());
				return obj;
			} catch  (Exception) {
				return null;
			}
		}