@Override
public void actionPerformed(ActionEvent evt) {
MapLayer currentLayer = getCurrentLayer();
MapLayer layer = currentLayer;
MapLayerEdit transEdit;
transEdit = new MapLayerEdit(currentLayer, createLayerCopy(currentLayer));
if (marqueeSelection != null) {
if (currentLayer instanceof TileLayer) {
layer = new TileLayer(marqueeSelection.getSelectedAreaBounds());
} else if (currentLayer instanceof ObjectGroup) {
layer = new ObjectGroup(marqueeSelection.getSelectedAreaBounds());
}
layer.setMap(currentMap);
layer.maskedCopyFrom(currentLayer, marqueeSelection.getSelectedArea());
}
switch (transform) {
case MapLayer.ROTATE_90:
case MapLayer.ROTATE_180:
case MapLayer.ROTATE_270:
transEdit.setPresentationName("Rotate");
layer.rotate(transform);
// if(marqueeSelection != null)
// marqueeSelection.rotate(transform);
break;
case MapLayer.MIRROR_VERTICAL:
transEdit.setPresentationName("Vertical Flip");
layer.mirror(MapLayer.MIRROR_VERTICAL);
// if(marqueeSelection != null)
// marqueeSelection.mirror(transform);
break;
case MapLayer.MIRROR_HORIZONTAL:
transEdit.setPresentationName("Horizontal Flip");
layer.mirror(MapLayer.MIRROR_HORIZONTAL);
// if(marqueeSelection != null)
// marqueeSelection.mirror(transform);
break;
}
if (marqueeSelection != null) {
layer.mergeOnto(currentLayer);
}
transEdit.end(createLayerCopy(currentLayer));
undoSupport.postEdit(transEdit);
mapView.repaint();
}