Beispiel #1
0
        /// <summary>
        /// This method will output the analysed KML file to the given location.
        /// </summary>
        /// <param name="file">The output location of the KML file</param>
        public void GenerateKML(String file)
        {
            // Ensure that analysis has been performed
            if (DBscan == null)
            {
                throw new Exception("Input data has not been clustered");
            }

            // Output the KML
            KMLWriter.GenerateKML(DBscan.Clusters, DBscan.Noise, file);
        }
        public void TestGenerateKMLNoise()
        {
            // Generate the output file path
            String file = OUTPUT_DIR + "kml_noise.kml";

            // Write the Clusters to disk
            KMLWriter.GenerateKML(Clusters, Noise, file);
            // Get the output file as a String array
            String[] kml = ReadFile(file);
            // Ensure that there is an XML heading tag in the output file
            Assert.AreEqual(kml[0], "<?xml version=\"1.0\" encoding=\"utf-8\"?>");
            // Ensure that there is a KML namespace present.
            Assert.AreEqual(kml[1], "<kml xmlns=\"http://www.opengis.net/kml/2.2\">");
            // Ensure that there are Folders
            Assert.AreEqual(kml[305], "<Folder>");
            // Ensure that a folder has a name
            Assert.AreEqual(kml[306], "<name>Cluster 0</name>");
            // Ensure that there is a placemark
            Assert.AreEqual(kml[308], "<Placemark>");
            // Ensure that the above placemark is closed
            Assert.AreEqual(kml[315], "</Placemark>");
            // Ensure that the above folder is closed
            Assert.AreEqual(kml[760], "</Folder>");
        }