示例#1
0
        internal static bool IsPixelLand(ISector sector)
        {
            if (GLOBAL_FINAL == null)
            {
                LoadAll();
            }
            int land1 = GLOBAL_FINAL.gridPoints[sector.GetRoot()][sector.X, sector.Y].naturalTypes.Contains(0) ? 0 : -1;
            int land2 = GLOBAL_FINAL.gridPoints[sector.GetRoot()][sector.X + 1, sector.Y].naturalTypes.Contains(0) ? 0 : -1;
            int land3 = GLOBAL_FINAL.gridPoints[sector.GetRoot()][sector.X, sector.Y + 1].naturalTypes.Contains(0) ? 0 : -1;
            int land4 = GLOBAL_FINAL.gridPoints[sector.GetRoot()][sector.X + 1, sector.Y + 1].naturalTypes.Contains(0) ? 0 : -1;

            if (GLOBAL_FINAL.gridPoints[sector.GetRoot()][sector.X, sector.Y].naturalTypes.Contains(1))
            {
                land1 = 1;
            }
            if (GLOBAL_FINAL.gridPoints[sector.GetRoot()][sector.X + 1, sector.Y].naturalTypes.Contains(1))
            {
                land2 = 1;
            }
            if (GLOBAL_FINAL.gridPoints[sector.GetRoot()][sector.X, sector.Y + 1].naturalTypes.Contains(1))
            {
                land3 = 1;
            }
            if (GLOBAL_FINAL.gridPoints[sector.GetRoot()][sector.X + 1, sector.Y + 1].naturalTypes.Contains(1))
            {
                land4 = 1;
            }
            return(land1 == 0 && land2 == 0 && land3 == 0 && land4 == 0);
        }
示例#2
0
 internal static GridPointInfo GetGridPointInfo(ISector sector)
 {
     if (GLOBAL_FINAL == null)
     {
         LoadAll();
     }
     return(GLOBAL_FINAL.gridPoints[sector.GetRoot()][sector.X, sector.Y]);
 }
示例#3
0
        public BlobCollection(List <Blob> blobs, ISector sector)
        {
            borderWay      = new Way();
            borderWay.id   = -10;
            borderWay.refs = new List <long>()
            {
                -900, -901, -902, -903, -900
            };                                                                  // arbitrary for now, but ccw for land
            nodes.Add(-900, new Vector2d(0, 0));
            nodes.Add(-901, new Vector2d(0, 1));
            nodes.Add(-902, new Vector2d(1, 1));
            nodes.Add(-903, new Vector2d(1, 0));

            this.blobs         = blobs;
            this.sector        = sector;
            this.gridPointInfo = OSMMetaFinal.GetGridPointInfo(sector);
            // initialize
            ISector rootSector = sector.GetRoot();

            foreach (var blob in blobs)
            {
                if (blob.type != "OSMData")
                {
                    continue;
                }
                // build node data
                for (int i = 0; i < blob.pBlock.primitivegroup.Count; i++)
                {
                    var pGroup = blob.pBlock.primitivegroup[i];
                    for (int j = 0; j < pGroup.dense.Count; j++)
                    {
                        var d = pGroup.dense[j];
                        for (int k = 0; k < d.id.Count; k++)
                        {
                            double longitude = .000000001 * (blob.pBlock.lon_offset + (blob.pBlock.granularity * d.lon[k]));
                            double latitude  = .000000001 * (blob.pBlock.lat_offset + (blob.pBlock.granularity * d.lat[k]));
                            nodes[d.id[k]] = sector.ProjectToLocalCoordinates(new LongLat(longitude * Math.PI / 180, latitude * Math.PI / 180).ToSphereVector());
                        }
                    }
                }
            }
        }