public Bitmap GetImage(TileQuery query)
        {
            int    tileX = query.X;
            int    tileY = query.Y;
            int    zoom  = query.Z;
            int    nwX;
            int    nwY;
            double nwLat;
            double nwLon;
            double seLat;
            double seLon;

            BingMapsTileSystem.TileXYToPixelXY(tileX, tileY, out nwX, out nwY);
            BingMapsTileSystem.PixelXYToLatLong(nwX, nwY, zoom, out nwLat, out nwLon);
            BingMapsTileSystem.PixelXYToLatLong(nwX + 256, nwY + 256, zoom, out seLat, out seLon);
            double res       = BingMapsTileSystem.GroundResolution(seLat + (nwLat - seLat) / 2d, zoom);
            int    numDigits = BingMapsTileSystem.UsefulDigits(res);

            BoundingBox bbox = new BoundingBox(nwLon, seLat, seLon, nwLat);

            return(GetImage(
                       new BoundingBoxQuery()
            {
                BBox = bbox,
                _querytables = query._querytables,
                Width = 256,
                Height = 256,
                SRID = 4326,
                IsBench = query.IsBench
            }
                       ));
        }
Пример #2
0
    // nucleus grows tissue cell around it like a grower
    void EndTurn(object args)
    {
        TileQuery    q    = new TileQuery();
        TileBehavior tile = q.FindRandomEmptyAdjacent((int)this.transform.position.x, (int)transform.position.y);

        if (tile != null)
        {
            tile.Cell = colony.MakeCell(CellTypeData.Empty, tile.x, tile.y);
        }
    }
Пример #3
0
    public void HighlightBuildableCells()
    {
        ClearHighlights();
        TileQuery           q   = new TileQuery();
        List <TileBehavior> res = q.FindBuildableTiles();

        foreach (TileBehavior tb in res)
        {
            GameObject clone = (GameObject)Instantiate(highlight);
            clone.transform.parent   = tb.transform;
            clone.transform.position = tb.transform.position;
            highlights.Push(clone);
        }
    }
Пример #4
0
    // Use this for initialization
    new void Start()
    {
        base.Start();
        endTurnDelegate = new EventDelegate(EndTurn);
        Events.Listen("EndTurn", endTurnDelegate);

        Colorize();
        colony.Nucleus = this;
        tileGrid       = GameObject.Find("grid").GetComponent <TileGrid> ();
        TileQuery q = new TileQuery();

        q.FindTileAt(tileGrid.width / 2, tileGrid.height / 2).Cell = this;
        this.transform.position = new Vector2(tileGrid.width / 2, tileGrid.height / 2);
    }
Пример #5
0
        public GeoJsonResult GetGeoJsonData(TileQuery query)
        {
            int    tileX = query.X;
            int    tileY = query.Y;
            int    zoom  = query.Z;
            int    nwX;
            int    nwY;
            double nwLat;
            double nwLon;
            double seLat;
            double seLon;

            BingMapsTileSystem.TileXYToPixelXY(tileX, tileY, out nwX, out nwY);
            BingMapsTileSystem.PixelXYToLatLong(nwX, nwY, zoom, out nwLat, out nwLon);
            BingMapsTileSystem.PixelXYToLatLong(nwX + 256, nwY + 256, zoom, out seLat, out seLon);
            double res       = BingMapsTileSystem.GroundResolution(seLat + (nwLat - seLat) / 2d, zoom);
            int    numDigits = BingMapsTileSystem.UsefulDigits(res);

            object box = null;

            if (useGeography)
            {
                box = SqlServerModel.GeograhyFromBoundingBoxNwSe(nwLat, nwLon, seLat, seLon, query.SRID);
            }
            else
            {
                box = SqlServerModel.GeometryFromBoundingBoxNwSe(nwLat, nwLon, seLat, seLon, query.SRID);
            }

            return(GetGeoJsonData(
                       new BoundingBoxQuery()
            {
                useGeography = useGeography,
                Box = box,
                Resolution = res,
                NumDigits = numDigits,
                Tables = query.Tables
            }
                       ));
        }
Пример #6
0
    void OnMouseDown()
    {
        TileQuery q = new TileQuery();

        if (!q.CanBuildAt(x, y))
        {
            return;
        }
        CellChoiceBehavior[] behaviors = FindObjectsOfType <CellChoiceBehavior> ();
        foreach (CellChoiceBehavior b in behaviors)
        {
            if (b.IsSelected)
            {
                ColonyBehavior colony = GameObject.Find("colony").GetComponent <ColonyBehavior> ();
                cell = colony.MakeCell(b.CellType, x, y);
            }
        }
        // new cell was created
        if (cell != null)
        {
            Events.Trigger("PlaceCell", cell);
        }
    }