Example #1
0
        static void SensorList(String filename)
        {
            // try to open it for reading...
            Console.Write("Opening " + filename + " data-store for reading...");
            TinyOnDiskStorage data_store = new TinyOnDiskStorage(filename, false, 100000);

            Console.WriteLine("done");

            Dictionary <String, MiataruDataObject> Sensors = new Dictionary <string, MiataruDataObject>();

            foreach (OnDiscAdress ondisc in data_store.InMemoryIndex)
            {
                MiataruDataObject dataobject = new MiataruDataObject();
                dataobject.Deserialize(data_store.Read(ondisc));
                if (!Sensors.ContainsKey(dataobject.AccountName))
                {
                    Sensors.Add(dataobject.AccountName, dataobject);
                }
                //Console.WriteLine(dataobject.Timecode.ToLongTimeString()+";"+dataobject.Timecode.ToShortDateString()+";"+dataobject.Name+";"+dataobject.Type+";"+dataobject.TypeName+";"+dataobject.Value+";"+dataobject.OriginalXS1Statement);
            }

            foreach (MiataruDataObject dataobject in Sensors.Values)
            {
                Console.WriteLine(dataobject.AccountName);
            }
        }
Example #2
0
        static void ExportKML(String filename, String Accountname)
        {
            Console.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?><kml xmlns=\"http://www.opengis.net/kml/2.2\"><Document><name>" + Accountname + "</name><open>1</open>");
            Console.WriteLine("<Style id=\"trailsstyle\">");
            Console.WriteLine("<LineStyle><color>7f0000ff</color><width>6</width></LineStyle></Style><description>n/a</description>");

            // try to open it for reading...
            TinyOnDiskStorage data_store = new TinyOnDiskStorage(filename, false, 100000);

            Console.WriteLine("<Placemark><styleUrl>#trailsstyle</styleUrl><name>" + Accountname + "</name><LineString>;<tessellate>1</tessellate>");
            Console.WriteLine("<coordinates>");

            foreach (OnDiscAdress ondisc in data_store.InMemoryIndex)
            {
                MiataruDataObject dataobject = new MiataruDataObject();
                dataobject.Deserialize(data_store.Read(ondisc));

                if (dataobject.AccountName == Accountname)
                {
                    Console.WriteLine(String.Format("{0:F6}#{1:F6}#{0:F6}", dataobject.Longitude, dataobject.Latitude, dataobject.AccuracyInMeters).Replace(",", ".").Replace("#", ","));
                    // check which date it is...

                    /*					if (CurrentDay == -1)
                     * {	// the first time...
                     *      Console.WriteLine("<Placemark><styleUrl>#trailsstyle</styleUrl><name>"+DateTime.FromBinary (dataobject.Timecode).ToString()+"</name><LineString>;<tessellate>1</tessellate>");
                     *      Console.WriteLine("<coordinates>");
                     *
                     *      CurrentDay = DateTime.FromBinary (dataobject.Timecode).Day;
                     * }
                     *
                     * if (DateTime.FromBinary (dataobject.Timecode).Day == CurrentDay)
                     * {
                     *      Console.WriteLine(String.Format("{0:F6},{1:F6},{0:F6}",dataobject.Latitude, dataobject.Longitude,dataobject.AccuracyInMeters));
                     * }
                     * else
                     * {
                     *      Console.WriteLine("</coordinates></LineString></Placemark>");
                     *      Console.WriteLine("<Placemark><styleUrl>#trailsstyle</styleUrl><name>"+DateTime.FromBinary (dataobject.Timecode).ToString()+"</name><LineString>;<tessellate>1</tessellate>");
                     *      Console.WriteLine("<coordinates>");
                     *      Console.WriteLine(String.Format("{0:F6},{1:F6},{0:F6}",dataobject.Latitude, dataobject.Longitude,dataobject.AccuracyInMeters));
                     *      CurrentDay = DateTime.FromBinary (dataobject.Timecode).Day;
                     * }*/
                }
            }
            Console.WriteLine("</coordinates></LineString></Placemark></Document></kml>");
        }
Example #3
0
		static void ExportKML(String filename, String Accountname)
		{
			Console.WriteLine ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><kml xmlns=\"http://www.opengis.net/kml/2.2\"><Document><name>" + Accountname + "</name><open>1</open>");
			Console.WriteLine ("<Style id=\"trailsstyle\">");
			Console.WriteLine ("<LineStyle><color>7f0000ff</color><width>6</width></LineStyle></Style><description>n/a</description>");

			// try to open it for reading...			
			TinyOnDiskStorage data_store = new TinyOnDiskStorage(filename, false,100000);
			Console.WriteLine("<Placemark><styleUrl>#trailsstyle</styleUrl><name>"+Accountname+"</name><LineString>;<tessellate>1</tessellate>");
			Console.WriteLine("<coordinates>");

			foreach (OnDiscAdress ondisc in data_store.InMemoryIndex)
			{
				MiataruDataObject dataobject = new MiataruDataObject();
				dataobject.Deserialize(data_store.Read(ondisc));

				if (dataobject.AccountName == Accountname) 
				{
					Console.WriteLine(String.Format("{0:F6}#{1:F6}#{0:F6}",dataobject.Longitude, dataobject.Latitude,dataobject.AccuracyInMeters).Replace(",",".").Replace("#",","));
					// check which date it is...
					/*					if (CurrentDay == -1)
					{	// the first time...
						Console.WriteLine("<Placemark><styleUrl>#trailsstyle</styleUrl><name>"+DateTime.FromBinary (dataobject.Timecode).ToString()+"</name><LineString>;<tessellate>1</tessellate>");
						Console.WriteLine("<coordinates>");

						CurrentDay = DateTime.FromBinary (dataobject.Timecode).Day;
					}

					if (DateTime.FromBinary (dataobject.Timecode).Day == CurrentDay) 
					{
						Console.WriteLine(String.Format("{0:F6},{1:F6},{0:F6}",dataobject.Latitude, dataobject.Longitude,dataobject.AccuracyInMeters));
					}
					else
					{
						Console.WriteLine("</coordinates></LineString></Placemark>");
						Console.WriteLine("<Placemark><styleUrl>#trailsstyle</styleUrl><name>"+DateTime.FromBinary (dataobject.Timecode).ToString()+"</name><LineString>;<tessellate>1</tessellate>");
						Console.WriteLine("<coordinates>");
						Console.WriteLine(String.Format("{0:F6},{1:F6},{0:F6}",dataobject.Latitude, dataobject.Longitude,dataobject.AccuracyInMeters));
						CurrentDay = DateTime.FromBinary (dataobject.Timecode).Day;
					}*/
				}
			}
			Console.WriteLine("</coordinates></LineString></Placemark></Document></kml>");
		}
Example #4
0
		static void SensorList (String filename)
		{
			// try to open it for reading...
			Console.Write("Opening "+filename+" data-store for reading...");
			TinyOnDiskStorage data_store = new TinyOnDiskStorage(filename, false,100000);
			Console.WriteLine("done");

			Dictionary<String,MiataruDataObject> Sensors = new Dictionary<string, MiataruDataObject>();

			foreach (OnDiscAdress ondisc in data_store.InMemoryIndex)
			{
				MiataruDataObject dataobject = new MiataruDataObject();
				dataobject.Deserialize(data_store.Read(ondisc));
				if (!Sensors.ContainsKey(dataobject.AccountName))
					Sensors.Add(dataobject.AccountName,dataobject);
				//Console.WriteLine(dataobject.Timecode.ToLongTimeString()+";"+dataobject.Timecode.ToShortDateString()+";"+dataobject.Name+";"+dataobject.Type+";"+dataobject.TypeName+";"+dataobject.Value+";"+dataobject.OriginalXS1Statement);
			}

			foreach(MiataruDataObject dataobject in Sensors.Values)
			{
				Console.WriteLine(dataobject.AccountName);
			}

		}