Example #1
0
        public void AddPlacename(string name, float lat, float lon, Hashtable metaData)
        {
            WorldWindPlacenameFile p = null;

            foreach (WorldWindPlacenameFile tempFile in m_placenameFiles)
            {
                if (lat < tempFile.north && lat >= tempFile.south && lon >= tempFile.west && lon < tempFile.east)
                {
                    p = tempFile;
                    break;
                }
            }

            if (p == null)
            {
                return;
            }

            if (p.m_placeNames.Count == 50000)
            {
                //split
                WorldWindPlacenameFile[] splitFiles = p.SplitPlacenameFiles();
                m_placenameFiles.Remove(p);
                foreach (WorldWindPlacenameFile newFile in splitFiles)
                {
                    m_placenameFiles.Add(newFile);
                }
                this.AddPlacename(name, lat, lon, metaData);
            }
            else
            {
                p.AddPlacename(name, lat, lon, metaData);
            }
        }
Example #2
0
        public WorldWindPlacenameFile[] SplitPlacenameFiles()
        {
            //split
            WorldWindPlacenameFile northWest = new WorldWindPlacenameFile();

            northWest.north        = this.north;
            northWest.south        = 0.5f * (this.north + this.south);
            northWest.west         = this.west;
            northWest.east         = 0.5f * (this.west + this.east);
            northWest.dataFilename = GetRowFromLatitude(northWest.south, northWest.north - northWest.south).ToString().PadLeft(4, '0') + "_" + GetColFromLongitude(northWest.west, northWest.east - northWest.west).ToString().PadLeft(4, '0') + ".wwp";

            WorldWindPlacenameFile northEast = new WorldWindPlacenameFile();

            northEast.north        = this.north;
            northEast.south        = 0.5f * (this.north + this.south);
            northEast.west         = 0.5f * (this.west + this.east);
            northEast.east         = this.east;
            northEast.dataFilename = GetRowFromLatitude(northEast.south, northEast.north - northEast.south).ToString().PadLeft(4, '0') + "_" + GetColFromLongitude(northEast.west, northEast.east - northEast.west).ToString().PadLeft(4, '0') + ".wwp";

            WorldWindPlacenameFile southWest = new WorldWindPlacenameFile();

            southWest.north        = 0.5f * (this.north + this.south);
            southWest.south        = this.south;
            southWest.west         = this.west;
            southWest.east         = 0.5f * (this.west + this.east);
            southWest.dataFilename = GetRowFromLatitude(southWest.south, southWest.north - southWest.south).ToString().PadLeft(4, '0') + "_" + GetColFromLongitude(southWest.west, southWest.east - southWest.west).ToString().PadLeft(4, '0') + ".wwp";

            WorldWindPlacenameFile southEast = new WorldWindPlacenameFile();

            southEast.north        = 0.5f * (this.north + this.south);
            southEast.south        = this.south;
            southEast.west         = 0.5f * (this.west + this.east);
            southEast.east         = this.east;
            southEast.dataFilename = GetRowFromLatitude(southEast.south, southEast.north - southEast.south).ToString().PadLeft(4, '0') + "_" + GetColFromLongitude(southEast.west, southEast.east - southEast.west).ToString().PadLeft(4, '0') + ".wwp";

            foreach (WorldWindPlacename p in m_placeNames)
            {
                if (p.Lat >= 0.5f * (this.north + this.south))
                {
                    if (p.Lon >= 0.5 * (this.west + this.east))
                    {
                        northEast.AddPlacename(p.Name, p.Lat, p.Lon, p.metaData);
                    }
                    else
                    {
                        northWest.AddPlacename(p.Name, p.Lat, p.Lon, p.metaData);
                    }
                }
                else
                {
                    if (p.Lon >= 0.5 * (this.west + this.east))
                    {
                        southEast.AddPlacename(p.Name, p.Lat, p.Lon, p.metaData);
                    }
                    else
                    {
                        southWest.AddPlacename(p.Name, p.Lat, p.Lon, p.metaData);
                    }
                }
            }

            WorldWindPlacenameFile[] returnArray = new WorldWindPlacenameFile[] { northWest, northEast, southWest, southEast };
            return(returnArray);
        }
Example #3
0
        public WorldWindPlacenameFile[] SplitPlacenameFiles()
        {
            //split
            WorldWindPlacenameFile northWest = new WorldWindPlacenameFile();
            northWest.north = this.north;
            northWest.south = 0.5f*(this.north + this.south);
            northWest.west = this.west;
            northWest.east = 0.5f*(this.west + this.east);
            northWest.dataFilename = GetRowFromLatitude(northWest.south, northWest.north - northWest.south).ToString().PadLeft(4, '0') + "_" + GetColFromLongitude(northWest.west, northWest.east - northWest.west).ToString().PadLeft(4, '0') + ".wwp";

            WorldWindPlacenameFile northEast = new WorldWindPlacenameFile();
            northEast.north = this.north;
            northEast.south = 0.5f*(this.north + this.south);
            northEast.west = 0.5f*(this.west + this.east);
            northEast.east = this.east;
            northEast.dataFilename = GetRowFromLatitude(northEast.south, northEast.north - northEast.south).ToString().PadLeft(4, '0') + "_" + GetColFromLongitude(northEast.west, northEast.east - northEast.west).ToString().PadLeft(4, '0') + ".wwp";

            WorldWindPlacenameFile southWest = new WorldWindPlacenameFile();
            southWest.north = 0.5f*(this.north + this.south);
            southWest.south = this.south;
            southWest.west = this.west;
            southWest.east = 0.5f*(this.west + this.east);
            southWest.dataFilename = GetRowFromLatitude(southWest.south, southWest.north - southWest.south).ToString().PadLeft(4, '0') + "_" + GetColFromLongitude(southWest.west, southWest.east - southWest.west).ToString().PadLeft(4, '0') + ".wwp";

            WorldWindPlacenameFile southEast = new WorldWindPlacenameFile();
            southEast.north = 0.5f*(this.north + this.south);
            southEast.south = this.south;
            southEast.west = 0.5f*(this.west + this.east);
            southEast.east = this.east;
            southEast.dataFilename = GetRowFromLatitude(southEast.south, southEast.north - southEast.south).ToString().PadLeft(4, '0') + "_" + GetColFromLongitude(southEast.west, southEast.east - southEast.west).ToString().PadLeft(4, '0') + ".wwp";

            foreach (WorldWindPlacename p in m_placeNames) {
                if (p.Lat
                    >= 0.5f*(this.north + this.south)) {
                    if (p.Lon
                        >= 0.5*(this.west + this.east)) {
                        northEast.AddPlacename(p.Name, p.Lat, p.Lon, p.metaData);
                    }
                    else {
                        northWest.AddPlacename(p.Name, p.Lat, p.Lon, p.metaData);
                    }
                }
                else {
                    if (p.Lon
                        >= 0.5*(this.west + this.east)) {
                        southEast.AddPlacename(p.Name, p.Lat, p.Lon, p.metaData);
                    }
                    else {
                        southWest.AddPlacename(p.Name, p.Lat, p.Lon, p.metaData);
                    }
                }
            }

            WorldWindPlacenameFile[] returnArray = new WorldWindPlacenameFile[] {northWest, northEast, southWest, southEast};
            return returnArray;
        }