view flys-client/src/main/java/de/intevation/flys/client/shared/model/ChartInfo.java @ 3549:6a8f83c538e3

Merged revisions 5384 via svnmerge from file:///home/clients/bsh/bsh-generischer-viewer/Material/SVN/flys-client/trunk ........ r5384 | felix | 2012-09-07 15:02:46 +0200 (Fr, 07 Sep 2012) | 1 line Cosmetics, docs. ........ flys-client/tags/2.9@5389 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 07 Sep 2012 13:12:48 +0000
parents 936e3e6cd9b9
children
line wrap: on
line source
package de.intevation.flys.client.shared.model;

import java.io.Serializable;

import com.google.gwt.core.client.GWT;

import de.intevation.flys.client.shared.Transform2D;


/**
 * Give information about chart dimension and transform of chart<->pixel
 * space.
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public class ChartInfo implements Serializable {

    protected Axis[] xAxes;
    protected Axis[] yAxes;

    protected Transform2D[] transformer;


    public ChartInfo() {
    }


    public ChartInfo(Axis[] xAxes, Axis[] yAxes, Transform2D[] transformer) {
        this.xAxes       = xAxes;
        this.yAxes       = yAxes;
        this.transformer = transformer;
    }


    public Transform2D getTransformer(int pos) {
        if (pos >= 0 && pos < transformer.length) {
            return transformer[pos];
        }

        return null;
    }


    public int getTransformerCount() {
        return transformer.length;
    }


    public int getXAxisCount() {
        return xAxes.length;
    }


    public int getYAxisCount() {
        return yAxes.length;
    }


    public Axis getXAxis(int pos) {
        if (pos >= 0 && pos < xAxes.length) {
            return xAxes[pos];
        }

        return null;
    }


    public Axis getYAxis(int pos) {
        if (pos >= 0 && pos < yAxes.length) {
            return yAxes[pos];
        }

        return null;
    }


    public void dumpGWT() {
        StringBuilder sb = new StringBuilder();

        Axis x = getXAxis(0);

        GWT.log("X axis:");
        GWT.log("... from " + x.getFrom() + " to " + x.getTo());
        GWT.log("... min " + x.getMin() + " max " + x.getMax());

        for (int i = 0, count = getYAxisCount(); i < count; i++) {
            Axis y = getYAxis(i);

            GWT.log("Y axis " + i + ":");
            GWT.log("... from " + y.getFrom() + " to " + y.getTo());
            GWT.log("... min " + y.getMin() + " max " + y.getMax());
        }

        for (Transform2D t: transformer) {
            t.dumpGWT();
        }
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org