annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MapserverStyle.java @ 1823:7a11b37d8594

Added a copy of JFreeChart's XYDifferenceRenderer flys-artifacts/trunk@3152 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 03 Nov 2011 10:32:17 +0000
parents 5364b86a0880
children dd467951335c
rev   line source
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.util.ArrayList;
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import java.util.List;
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 public class MapserverStyle {
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 public static class Clazz {
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 protected String name;
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 protected String outlinecolor;
1816
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
12 protected String symbol;
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 protected int size;
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 public Clazz(String name) {
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 this.name = name;
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 }
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 public void setOutlineColor(String outlinecolor) {
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 this.outlinecolor = outlinecolor;
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 }
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 public void setSize(int size) {
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 this.size = size;
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 }
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
1816
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
27 public void setSymbol(String symbol) {
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
28 if (symbol != null && symbol.length() > 0) {
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
29 this.symbol = symbol;
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
30 }
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
31 }
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
32
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 public String toString() {
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 StringBuilder sb = new StringBuilder();
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 sb.append("CLASS\n");
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 sb.append("NAME \"" + name + "\"\n");
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 sb.append("STYLE\n");
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 sb.append("SIZE " + String.valueOf(size) + "\n");
1816
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
39 sb.append("OUTLINECOLOR " + outlinecolor + "\n");
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
40
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
41 if (symbol != null) {
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
42 sb.append("SYMBOL '" + symbol + "'\n");
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
43 }
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1793
diff changeset
44
1793
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 sb.append("END\n");
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 sb.append("END\n");
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 return sb.toString();
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 }
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 } // end of Clazz
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 protected List<Clazz> classes;
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 public MapserverStyle() {
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 classes = new ArrayList<Clazz>();
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 }
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 public void addClazz(Clazz clazz) {
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 if (clazz != null) {
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 classes.add(clazz);
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 }
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 }
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 public String toString() {
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 StringBuilder sb = new StringBuilder();
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 for (Clazz clazz: classes) {
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 sb.append(clazz.toString());
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 }
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 return sb.toString();
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 }
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 }
1636686070f7 Initial commit to support styles in maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org