view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MapserverStyle.java @ 1862:4cc21f0a470e

Handle Annotation Facets in DischargeLongitudinalSection diagrams. flys-artifacts/trunk@3211 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 10 Nov 2011 10:20:40 +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