/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package csa.tiletools.tiles;

import csa.gui.Scaler;
import java.awt.image.BufferedImage;

/** Shallow tiles are as of now only used for "building" wrapping tiles in visualizations of a map 
 *
 * @author salchr
 */
public class EmptyTile extends Tile
{

    public EmptyTile(int w, int h)
    {
        maxHO = h; // unscaled
        maxWO = w;
        init();
        
        data = new TileData();
        data.mName = toString();
        data.mClass = toString();
        
    }
    @Override public boolean isEmptyTile()
    {
        return true;
    }
    public BufferedImage getImage()
    {
        return null;
    }
    public void start()
    {
        
    }
    public void stop()
    {
        
    }     

    // is allways scaled correctly, because the image is scaled when set scale is called
    public int getCurrentOffsetX()
    {
        return 0;
    }
    // is allways scaled correctly, becaus the image is scaled when set scale is called
    public int getCurrentOffsetY()
    {
        return 0;
    }

    protected void correctCoordinates()
    {
        XScaled = Scaler.scalePercentToInt(X, scalePercent);
        YScaled = Scaler.scalePercentToInt(Y, scalePercent);
    }    

    public int getPaintX() {
        return X;
    }
    public int getPaintXScaled() {
        // image data is scaled in image, not here!
        //return XScaled+((int)(mBData.elementAt(animCounter).ox*scalePercent)/100);
        
        return XScaled;
    }
    public int getPaintY() {
        return Y;
    }
    
    public int getPaintYScaled() {
        // image data is scaled in image, not here!
        return YScaled;
    }
    
    
    
    public boolean setScalePercent(int s)
    {
        if (scalePercent == s) return false;
        scalePercent = s;
        init();
        correctCoordinates();
        return true;
    }
 
    
    protected void init()
    {
        maxWS = Scaler.scalePercentToInt(maxWO, scalePercent);
        maxHS = Scaler.scalePercentToInt(maxHO, scalePercent);
        minWidthScaled=maxWS;
        minHeightScaled=maxHS;
        maxHSReal = maxHS;
        maxHOReal = maxHO;
        
        if (scalePercent == 100)
        {
            maxWO=maxWS;
            maxHO=maxHS;
            minHeightScaledReal = maxHS;
            minWidthUnscaled=minWidthScaled;
            minHeightUnscaled=minHeightScaled;
        }
        else
        {
            minWidthUnscaled=maxWO;
            minHeightUnscaled=maxHO;
            minHeightScaledReal = minHeightScaled;
            minHeightUnscaledReal = minHeightUnscaled;
        }
    }

    @Override
    public String toString()
    {
        return "EMPTY:"+maxWO+"x"+maxHO;
    }
    
}
