view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MapserverStyle.java @ 1817:595c404523a6

Rewritten CrossSectionApp to be useful as test bed for 'Raum/Flaeche' operations. flys-artifacts/trunk@3146 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 03 Nov 2011 09:47:52 +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