static void exportKml(string filename, string outputFile) { Document kml = new Document(); FileChannel ch = new FileChannel(filename); UAVObjectManager mgr = new UAVObjectManager(); UAVObjectsInitialize.register(mgr); UavTalk.UavTalkProto tlk = new UavTalkProto(ch, mgr); mgr.getObject<GPSPositionSensor>().onUpdated += new EventHandler(GpsPositionReceived); mgr.getObject<PositionState>().onUpdated += new EventHandler(GpsPositionReceived); ch.open(); while (ch.isRunning) Thread.Sleep(50); LineString ls = new LineString(); ls.AltitudeMode = SharpKml.Dom.AltitudeMode.Absolute; ls.Extrude = true; ls.Coordinates = coords; Placemark pm = new Placemark(); pm.Name = "Flight Path "; //pm.StyleUrl = new Uri("#yellowLineGreenPoly", UriKind.Relative); pm.Geometry = ls; kml.AddFeature(pm); Serializer serializer = new Serializer(); serializer.Serialize(kml); StreamWriter sw = new StreamWriter(outputFile); sw.Write(serializer.Xml); sw.Close(); }
private void apriToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Log Files *.tll;*.opl|*.tll;*.opl"; if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { uavobjectData.Clear(); treeView1.Nodes.Clear(); zedGraphControl1.GraphPane.CurveList.Clear(); nodes.Clear(); curves.Clear(); FileChannel ch = new FileChannel(dlg.FileName); ch.fileclosed += new EventHandler(fileclosed); UavTalk.UavTalkProto tlk = new UavTalk.UavTalkProto(ch, mgr); timestamp = 0; treeView1.Enabled = false; ch.open(); } }
static void test1() { HidChannel ch = new HidChannel(0x20A0, 0x415C); UAVObjectManager mgr = new UAVObjectManager(); UAVObjectsInitialize.register(mgr); UavTalk.UavTalkProto tlk = new UavTalkProto(ch, mgr); ch.open(); tlk.sendObjectRequest(mgr.getObject<OPLinkSettings>(), false); while (true) { var obj = mgr.getObject<OPLinkSettings>(); obj.CoordID.setValue((uint)0xE4C1B293); tlk.sendObject(obj, false, false); //tlk.sendObjectRequest(mgr.getObject<SystemStats>(),false); Thread.Sleep(2000); } }