Package tiled.core

Examples of tiled.core.MapLayer


    // }
  }

  public void paintSubMap(MultilayerPlane m, GC gc, float mapOpacity) {
    Iterator<?> li = m.getLayers();
    MapLayer layer;

    while (li.hasNext()) {
      layer = (MapLayer) li.next();
      if (layer != null) {
        float opacity = layer.getOpacity() * mapOpacity;
        if (layer.isVisible() && opacity > 0.0f) {
          // if (opacity < 1.0f) {
          // g2d.setComposite(AlphaComposite.getInstance(
          // AlphaComposite.SRC_ATOP, opacity));
          // }
          // else {
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 layer.getLocked() || !layer.isVisible();
            } else if (col == 1) {
                return 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) {
                layer.setLocked((Boolean)value);
            } else if (col == 1) {
                layer.setVisible((Boolean)value);
            } else if (col == 2) {
                layer.setName(value.toString());
            }
            fireTableCellUpdated(row, col);
        }
    }
View Full Code Here

        private Tile myTile;

        public Cell(Map map, int posx, int posy, int start, int len, boolean all) {
            sandwich = new Vector<Tile>();
            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

  @Override
  public void handleMove(MouseEvent e) {
    if (mapEditor.getCurrentPointerState() != MapEditor.PS_RESIZEOBJ)
      return;
    MapLayer layer = map.getLayer(mapView.getCurrentLayer());
    mapView.setCursor(Display.getDefault()
        .getSystemCursor(SWT.CURSOR_ARROW));
    if (layer instanceof ObjectGroup) {
      MapObject targetObject = ((ObjectGroup) layer)
          .getObjectAt(e.x, e.y);
View Full Code Here

  @Override
  public boolean canStartDrag(MouseEvent e) {
    if (mapEditor.getCurrentPointerState() != MapEditor.PS_RESIZEOBJ)
      return false;
    MapLayer layer = map.getLayer(mapView.getCurrentLayer());
    if (layer instanceof ObjectGroup) {
      MapObject targetObject = ((ObjectGroup) layer)
          .getObjectAt(e.x, e.y);
      if (targetObject != null) {
        Rectangle bounds = ((ObjectGroup) layer)
View Full Code Here

  }

  @Override
  public void handleDragStart(MouseEvent e) {
    MapLayer layer = map.getLayer(mapView.getCurrentLayer());
    targetObject = ((ObjectGroup) layer).getObjectAt(e.x, e.y);
    if (targetObject != null) {
      Rectangle bounds = ((ObjectGroup) layer)
          .getActualObjectRectangle(targetObject);
      Rectangle targetBounds = targetObject.getBounds();
View Full Code Here

  }
 
  protected boolean clickedSelectionLayer(MouseEvent e) {
    Iterator<MapLayer> layersSpecial = editor.getMap().getLayersSpecial();
    for (Iterator<MapLayer> iterator = layersSpecial; iterator.hasNext();) {
      MapLayer layer = iterator.next();
      if (layer == selectionLayer && ((ObjectGroup) layer).getPixelBounds().contains(initialDragLocation.x,initialDragLocation.y)) {
        return true;
      }
    }
    return false;
View Full Code Here

      }
    });
  }

  protected void handleLayerChanged(int newIndex, int oldIndex) {
    MapLayer layer = map.getLayer(newIndex);
    if (!viewer.getSelection().isEmpty()) {
      Object element = ((IStructuredSelection) viewer.getSelection()).getFirstElement();
      if (!element.equals(layer))
        viewer.setSelection(new StructuredSelection(map.getLayer(newIndex)));
    }
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.