Package tiled.core

Examples of tiled.core.MapLayer


        // Load the layers and objectgroups
        for (Node sibs = mapNode.getFirstChild(); sibs != null;
                sibs = sibs.getNextSibling())
        {
            if ("layer".equals(sibs.getNodeName())) {
                MapLayer layer = readLayer(sibs);
                if (layer != null) {
                    map.addLayer(layer);
                }
            }
            else if ("objectgroup".equals(sibs.getNodeName())) {
                MapLayer layer = unmarshalObjectGroup(sibs);
                if (layer != null) {
                    map.addLayer(layer);
                }
            }
        }
View Full Code Here


              Resources.getString("action.layer.duplicate.tooltip"),
              Resources.getIcon("gimp-duplicate-16.png"));
    }

    protected void doPerformAction() {
        MapLayer currentLayer = editor.getCurrentLayer();
        Map currentMap = editor.getCurrentMap();

        if (currentLayer != null) {
            try {
                MapLayer clone = (MapLayer) currentLayer.clone();
                String newName = Resources.getString(
                        "action.layer.duplicate.newlayer.name");
                clone.setName(MessageFormat.format(newName, new Object[]{clone.getName()}));
                currentMap.addLayer(clone);
                editor.setCurrentLayer(currentMap.getTotalLayers() - 1);
            } catch (CloneNotSupportedException ex) {
                ex.printStackTrace();
            }
View Full Code Here

        private Tile myTile;

        public Cell(Map map, int posx, int posy, int start, int len, boolean all) {
            sandwich = new Vector();
            for (int i = 0; i < len; i++) {
                MapLayer ml = map.getLayer(start+i);
                if (ml instanceof TileLayer) {
                    TileLayer l = (TileLayer)ml;
                    if (l.isVisible() || all) {
                        sandwich.add(l.getTileAt(posx, posy));
                    } else {
View Full Code Here

        pack();
        setLocationRelativeTo(getOwner());
    }

    private Properties getPropertiesAt(Point p) {
        MapLayer ml = editor.getCurrentLayer();
        if (!(ml instanceof TileLayer)) {
            return null;
        }

        return ((TileLayer) ml).getTileInstancePropertiesAt(p.x, p.y);
View Full Code Here

        return ((TileLayer) ml).getTileInstancePropertiesAt(p.x, p.y);
    }

    private void setPropertiesAt(Point point, Properties properties) {
        MapLayer ml = editor.getCurrentLayer();
        if (!(ml instanceof TileLayer)) {
            return;
        }

        ((TileLayer) ml).setTileInstancePropertiesAt(point.x, point.y,
View Full Code Here

        //Properties mergedProperties = new Properties();
        mergedProperties.clear();
        propertiesCoordinates.clear();

        // Get all properties of all selected tiles...
        MapLayer ml = editor.getCurrentLayer();
        if (ml instanceof TileLayer) {
            TileLayer tl = (TileLayer) ml;
            Rectangle r = selection.getSelectedAreaBounds();
            int maxJ = (int) (r.getY() + r.getHeight());
            int maxI = (int) (r.getX() + r.getWidth());
View Full Code Here

        }
        return null;
    }

    public Object getValueAt(int row, int col) {
        MapLayer layer = map.getLayer(getRowCount() - row - 1);

        if (layer != null) {
            if (col == 0) {
                return Boolean.valueOf(layer.getLocked() || !layer.isVisible());
            } else if (col == 1) {
                return Boolean.valueOf(layer.isVisible());
            } else if (col == 2) {
                return layer.getName();
            } else {
                return null;
            }
        } else {
            return null;
View Full Code Here

            return null;
        }
    }

    public boolean isCellEditable(int row, int col) {
        MapLayer layer = map.getLayer(getRowCount() - row - 1);

        return !(col == 0 && layer != null && !layer.isVisible());
    }
View Full Code Here

        return !(col == 0 && layer != null && !layer.isVisible());
    }

    public void setValueAt(Object value, int row, int col) {
        MapLayer layer = map.getLayer(getRowCount() - row - 1);
        if (layer != null) {
            if (col == 0) {
                Boolean bool = (Boolean)value;
                layer.setLocked(bool.booleanValue());
            } else if (col == 1) {
                Boolean bool = (Boolean)value;
                layer.setVisible(bool.booleanValue());
            } else if (col == 2) {
                layer.setName(value.toString());
            }
            fireTableCellUpdated(row, col);
        }
    }
View Full Code Here

   * @see SelectionLayer
   */
  public void paintControl(PaintEvent e) {
    GC gc = e.gc;

    MapLayer layer;
    Rectangle clip = gc.getClipping();

    gc.setLineWidth(2);

    // Do an initial fill with the background color
    // todo: make background color configurable
    // try {
    // String colorString = displayPrefs.get("backgroundColor", "");
    // g2d.setColor(Color.decode(colorString));
    // } catch (NumberFormatException e) {
    // }
    gc.setBackground(defaultBgColor);
    gc.fillRectangle(clip.x, clip.y, clip.width, clip.height);

    paintSubMap(map, gc, 1.0f);

    if (!getMode(PF_NOSPECIAL)) {
      Iterator<?> li = map.getLayersSpecial();

      while (li.hasNext()) {
        layer = (MapLayer) li.next();
        if (layer.isVisible()) {
          if (layer instanceof SelectionLayer) {
            // g2d.setComposite(AlphaComposite.getInstance(
            // AlphaComposite.SRC_ATOP, 0.3f));
            gc.setForeground(((SelectionLayer) layer)
                .getHighlightColor());
View Full Code Here

TOP

Related Classes of tiled.core.MapLayer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.