view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MapserverStyle.java @ 1832:a8910c1c82fb

Refactored the RiverAxisArtifact and its State - uses the same base as WMSKmArtifact now. flys-artifacts/trunk@3168 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 04 Nov 2011 12:15:03 +0000
parents 5364b86a0880
children dd467951335c
line wrap: on
line source
package de.intevation.flys.artifacts.model;

import java.util.ArrayList;
import java.util.List;


public class MapserverStyle {

    public static class Clazz {
        protected String name;
        protected String outlinecolor;
        protected String symbol;
        protected int    size;

        public Clazz(String name) {
            this.name = name;
        }

        public void setOutlineColor(String outlinecolor) {
            this.outlinecolor = outlinecolor;
        }

        public void setSize(int size) {
            this.size = size;
        }

        public void setSymbol(String symbol) {
            if (symbol != null && symbol.length() > 0) {
                this.symbol = symbol;
            }
        }

        public String toString() {
            StringBuilder sb = new StringBuilder();
            sb.append("CLASS\n");
            sb.append("NAME \"" + name + "\"\n");
            sb.append("STYLE\n");
            sb.append("SIZE " + String.valueOf(size) + "\n");
            sb.append("OUTLINECOLOR " + outlinecolor + "\n");

            if (symbol != null) {
                sb.append("SYMBOL '" + symbol + "'\n");
            }

            sb.append("END\n");
            sb.append("END\n");

            return sb.toString();
        }
    } // end of Clazz


    protected List<Clazz> classes;


    public MapserverStyle() {
        classes = new ArrayList<Clazz>();
    }

    public void addClazz(Clazz clazz) {
        if (clazz != null) {
            classes.add(clazz);
        }
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();

        for (Clazz clazz: classes) {
            sb.append(clazz.toString());
        }

        return sb.toString();
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org