コード例 #1
0
    /*
     * public bool loadOSM(string filePath)
     * {
     *  // load OSM data
     *  string rawData = OSMLoader.loadFromFile(filePath);
     *  if (rawData == "") return false;
     *
     *  // initialize the parser
     *  parser = new OSMParser();
     *  parser.load(rawData);
     *  loadBounds();
     *
     *  return true;
     * }
     */

    private bool loadNodes()
    {
        nodes = parser.nodes;

        /// normalize
        double minX = UMaths.lon2x(minLon);
        double minY = UMaths.lat2y(minLat);

        /// Mercator
        foreach (DictionaryEntry e in nodes)
        {
            OSMNode n = (OSMNode)e.Value;
            n.pos.x = (float)UMaths.lon2x(n.lon) - (float)minX;
            n.pos.z = (float)UMaths.lat2y(n.lat) - (float)minY;
        }
        return(true);
    }
コード例 #2
0
 private void calculateDimensions()
 {
     width  = UMaths.lon2x(bounds[3]) - UMaths.lon2x(bounds[1]);
     height = UMaths.lat2y(bounds[2]) - UMaths.lat2y(bounds[0]);
 }