Set a tiled layer Data
@ignore
328026
function setLayerData(layer, data) {
       var idx = 0; // initialize the array

       initArray(layer); // set everything

       for (var y = 0; y < layer.rows; y++) {
         for (var x = 0; x < layer.cols; x++) {
           // get the value of the gid
           var gid = data[idx++]; // fill the array

           if (gid !== 0) {
             // add a new tile to the layer
             layer.setTile(x, y, gid);
           }
         }
       }
     }
498389
function (renderer, x, y, tmxTile) {
            var tileset = tmxTile.tileset;
            // draw the tile
            tileset.drawTile(
                renderer,
                ((this.cols - 1) * tileset.tilewidth + (x - y) * tileset.tilewidth >> 1),
                (-tileset.tilewidth + (x + y) * tileset.tileheight >> 2),
                tmxTile
            );
        }
1181984
function(layerContext, node) {
        var obj = {"width": node.getAttribute("width"), "height": node.getAttribute("height")};
        layerContext.tileSize = obj;
    }
1170841
protected void createLayers2() {
        this.mapView2.getLayerManager()
                .getLayers().add(AndroidUtil.createTileRendererLayer(this.tileCaches.get(1),
                this.mapView2.getModel().mapViewPosition, getMapFile2(),
                getRenderTheme2(), false, true, false));
    }
522493
function (obj) {
            var tileX = obj.x / this.hTilewidth;
            var tileY = obj.y / this.tileheight;
            var isoPos = me.pool.pull("me.Vector2d");

            this.tileToPixelCoords(tileX, tileY, isoPos);

            obj.x = isoPos.x;
            obj.y = isoPos.y;

            me.pool.push(isoPos);
        }
402039
protected void setCovered (Map<Integer, SceneBlock> blocks, SceneObject scobj)
    {
        int endx = scobj.info.x - scobj.tile.getBaseWidth() + 1;
        int endy = scobj.info.y - scobj.tile.getBaseHeight() + 1;

        for (int xx = scobj.info.x; xx >= endx; xx--) {
            for (int yy = scobj.info.y; yy >= endy; yy--) {
                SceneBlock block = blocks.get(blockKey(xx, yy));
                if (block != null) {
                    block.setCovered(xx, yy);
                }
            }
        }

//         Log.info("Updated coverage " + scobj.info + ".");
    }
950652
function (tilesets) {
            // get the corresponding tileset
            var tileset = tilesets.getTilesetByGid(this.gid);

            if (tileset.isCollection === false) {
                // set width and height equal to tile size
                this.width = this.framewidth = tileset.tilewidth;
                this.height = this.frameheight = tileset.tileheight;
            }

            // the object corresponding tile object
            this.tile = new me.Tile(this.x, this.y, this.gid, tileset);
        }
23014
function (data) {

            if (this.initialized === true) {
                return;
            }

            // to automatically increment z index
            var zOrder = 0;
            var self = this;

            // Tileset information
            if (!this.tilesets) {
                // make sure we have a TilesetGroup Object
                this.tilesets = new me.TMXTilesetGroup();
            }

            // parse all tileset objects
            if (typeof (data.tilesets) !== "undefined") {
                var tilesets = data.tilesets;
                tilesets.forEach(function (tileset) {
                    // add the new tileset
                    self.tilesets.add(readTileset(tileset));
                });
            }

            // check if a user-defined background color is defined
            if (this.backgroundcolor) {
                this.layers.push(
                    me.pool.pull("me.ColorLayer",
                        "background_color",
                        this.backgroundcolor,
                        zOrder++
                    )
                );
            }

            // check if a background image is defined
            if (this.background_image) {
                // add a new image layer
                this.layers.push(
                    me.pool.pull("me.ImageLayer",
                        0, 0, {
                            name : "background_image",
                            image : this.background_image,
                            z : zOrder++
                        }
                ));
            }

            data.layers.forEach(function (layer) {
                switch (layer.type) {
                    case "imagelayer":
                        self.layers.push(readImageLayer(self, layer, zOrder++));
                        break;

                    case "tilelayer":
                        self.layers.push(readLayer(self, layer, zOrder++));
                        break;

                    // get the object groups information
                    case "objectgroup":
                        self.objectGroups.push(readObjectGroup(self, layer, zOrder++));
                        break;

                    // get the object groups information
                    case "group":
                        self.objectGroups.push(readObjectGroup(self, layer, zOrder++));
                        break;

                    default:
                        break;
                }
            });

            this.initialized = true;
        }
625559
private void appendMap(MapTile other, int offsetX, int offsetY)
    {
        for (int v = 0; v < other.getInTileHeight(); v++)
        {
            final int ty = offsetY + v;
            for (int h = 0; h < other.getInTileWidth(); h++)
            {
                final int tx = offsetX + h;
                final Tile tile = other.getTile(h, v);
                if (tile != null)
                {
                    final double x = tx * (double) map.getTileWidth();
                    final double y = ty * (double) map.getTileHeight();
                    map.setTile(map.createTile(tile.getSheet(), tile.getNumber(), x, y));
                }
            }
        }
    }
519903
public void setCustomLayer(final BufferedImage CUSTOM_LAYER) {
        if (customLayer != null) {
            customLayer.flush();
        }
        customLayer = CUSTOM_LAYER;
        fireStateChanged();
    }
1067372
def setLayer(self, layer):
        
        if layer == self._layer:
            return False

        self._layer = layer
        self.syncLayerData()

        return True
28318
public void setTile(int x, int y, String tile) {
        if ((x > getArrayWidth()) || (y > getArrayHeight()) || (x < 0) || (y < 0)) {
            throw new IllegalArgumentException();
        }
        image[x][y] = tile;
    }
478437
def set_data_values(self, label, x, y, z):
        
        # TODO: avoid re-allocating an array every time
        self.layers[label]['data'] = np.array([x, y, z]).transpose()
        self._update()
931572
public static TileRendererLayer createTileRendererLayer(
            TileCache tileCache, IMapViewPosition mapViewPosition,
            MapDataStore mapFile, XmlRenderTheme renderTheme) {
        TileRendererLayer tileRendererLayer = new TileRendererLayer(tileCache, mapFile,
                mapViewPosition, AndroidGraphicFactory.INSTANCE);
        tileRendererLayer.setXmlRenderTheme(renderTheme);
        return tileRendererLayer;
    }
348456
function(x, y, tileData){
            var light = this.ambientLight;
            var lighting = this.get(x, y);

            var overlay = function(c1, c2){
                var out = c1.slice();
                for (var i = 0; i < 3; i++) {
                    var a = c1[i],
                        b = c2[i];
                    if(b < 128){
                        out[i] = Math.round(2 * a * b / 255);
                    } else {
                        out[i] = Math.round(255 - 2 * (255 - a) * (255 - b) / 255);
                    }
                }
                return out;
            };

            if(lighting){
                light = ROT.Color.add(this.ambientLight, lighting);
            }

            if(tileData.color){
                var color = ROT.Color.fromString(tileData.color);
                color = overlay(light, color);
                tileData.color = ROT.Color.toRGB(color);
            }

            if(tileData.bgColor){
                var bgColor = ROT.Color.fromString(tileData.bgColor);
                bgColor = overlay(light, bgColor);
                tileData.bgColor = ROT.Color.toRGB(bgColor);
            }
            return tileData;
        }
288883
public void setLayerOpacity(int alpha, int layer) {

        if ((alpha >= 0) && (alpha <= 100) && isAttached()) {
            Element colorbar;

            switch (layer) {
                case COLORBAR_A:
                    colorbar = m_colorA.getElement();
                    break;
                case COLORBAR_B:
                    colorbar = m_colorB.getElement();
                    break;
                case COLORBAR_C:
                    colorbar = m_colorC.getElement();
                    break;
                case COLORBAR_D:
                    colorbar = m_colorD.getElement();
                    break;
                default:
                    return;
            }
            colorbar.getStyle().setOpacity((1.0 * alpha) / 100);
            CmsTransparencyImpl.setTransparency(colorbar, alpha);
        }
    }
852367
function TMXMapInfo (opts) {
    this.tilesets = []
    this.layers = []
    this.objectGroups = []
    this.properties = {}
    this.tileProperties = {}
    this.filename = opts.filename || opts.file || ''

    this.parseXMLFile(opts)
}