Mercurial > mxd2map
comparison src/java/de/intevation/mxd/reader/SimpleMarkerSymbolReader.java @ 42:395307e8b7ee
First MapScript Writer that generates valid mapfiles.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Fri, 15 Apr 2011 14:14:49 +0200 |
parents | 7a927921eb6c |
children | ef7ca23c4233 |
comparison
equal
deleted
inserted
replaced
41:60ed2164035a | 42:395307e8b7ee |
---|---|
1 package de.intevation.mxd.reader; | 1 package de.intevation.mxd.reader; |
2 | 2 |
3 import java.io.IOException; | 3 import java.io.IOException; |
4 | |
5 import java.awt.Color; | |
4 | 6 |
5 import org.apache.log4j.Logger; | 7 import org.apache.log4j.Logger; |
6 | 8 |
7 import com.esri.arcgis.display.ISymbol; | 9 import com.esri.arcgis.display.ISymbol; |
8 import com.esri.arcgis.display.SimpleMarkerSymbol; | 10 import com.esri.arcgis.display.SimpleMarkerSymbol; |
9 import com.esri.arcgis.display.esriSimpleMarkerStyle; | 11 import com.esri.arcgis.display.esriSimpleMarkerStyle; |
10 import com.esri.arcgis.display.IRgbColor; | 12 import com.esri.arcgis.display.IRgbColor; |
11 import com.esri.arcgis.display.RgbColor; | 13 import com.esri.arcgis.display.RgbColor; |
12 | 14 |
13 import org.w3c.dom.Element; | 15 import org.w3c.dom.Element; |
14 | |
15 import de.intevation.mxd.utils.MapToXMLUtils; | 16 import de.intevation.mxd.utils.MapToXMLUtils; |
16 | 17 |
17 /** | 18 /** |
18 * Reads simple marker symbol information. | 19 * Reads simple marker symbol information. |
19 * | 20 * |
82 if(symbol.getStyle() == esriSimpleMarkerStyle.esriSMSCircle) | 83 if(symbol.getStyle() == esriSimpleMarkerStyle.esriSMSCircle) |
83 symbolElement.setAttribute("style", "point"); | 84 symbolElement.setAttribute("style", "point"); |
84 | 85 |
85 if(symbol.getColor() instanceof IRgbColor) { | 86 if(symbol.getColor() instanceof IRgbColor) { |
86 IRgbColor color = (IRgbColor)symbol.getColor(); | 87 IRgbColor color = (IRgbColor)symbol.getColor(); |
87 symbolElement.setAttribute("color", "(" + color.getRed() + | 88 Color c = new Color ( |
88 "," + color.getGreen() + | 89 color.getRed(), |
89 "," + color.getBlue() + ")"); | 90 color.getGreen(), |
91 color.getBlue()); | |
92 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); | |
90 symbolElement.setAttribute("transparency", | 93 symbolElement.setAttribute("transparency", |
91 String.valueOf(color.getTransparency())); | 94 String.valueOf(color.getTransparency())); |
92 } | 95 } |
93 else { | 96 else { |
94 RgbColor col = new RgbColor(); | 97 RgbColor col = new RgbColor(); |
95 col.setRGB(symbol.getColor().getRGB()); | 98 col.setRGB(symbol.getColor().getRGB()); |
96 symbolElement.setAttribute("color", "(" + col.getRed() + | 99 Color c = new Color ( |
97 "," + col.getGreen() + | 100 col.getRed(), |
98 "," + col.getBlue() + ")"); | 101 col.getGreen(), |
102 col.getBlue()); | |
103 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); | |
99 symbolElement.setAttribute("transparency", | 104 symbolElement.setAttribute("transparency", |
100 String.valueOf(col.getTransparency())); | 105 String.valueOf(col.getTransparency())); |
101 } | 106 } |
102 | 107 |
103 symbolElement.setAttribute("size", String.valueOf(symbol.getSize())); | 108 symbolElement.setAttribute("size", String.valueOf(symbol.getSize())); |
104 symbolElement.setAttribute("outline_size", | 109 symbolElement.setAttribute("outline_size", |
105 String.valueOf(symbol.getOutlineSize())); | 110 String.valueOf(symbol.getOutlineSize())); |
106 if(symbol.getOutlineColor() instanceof IRgbColor) { | 111 if(symbol.getOutlineColor() instanceof IRgbColor) { |
107 IRgbColor color = (IRgbColor)symbol.getOutlineColor(); | 112 IRgbColor color = (IRgbColor)symbol.getOutlineColor(); |
108 symbolElement.setAttribute("outline_color", "(" + color.getRed() + | 113 Color c = new Color ( |
109 "," + color.getGreen() + | 114 color.getRed(), |
110 "," + color.getBlue() + ")"); | 115 color.getGreen(), |
116 color.getBlue()); | |
117 symbolElement.setAttribute( | |
118 "outline_color", | |
119 String.valueOf(c.getRGB())); | |
111 symbolElement.setAttribute("outline_transparency", | 120 symbolElement.setAttribute("outline_transparency", |
112 String.valueOf(color.getTransparency())); | 121 String.valueOf(color.getTransparency())); |
113 } | 122 } |
114 else { | 123 else { |
115 RgbColor col = new RgbColor(); | 124 RgbColor col = new RgbColor(); |
116 col.setRGB(symbol.getOutlineColor().getRGB()); | 125 col.setRGB(symbol.getOutlineColor().getRGB()); |
117 symbolElement.setAttribute("outline_color", "(" + col.getRed() + | 126 Color c = new Color ( |
118 "," + col.getGreen() + | 127 col.getRed(), |
119 "," + col.getBlue() + ")"); | 128 col.getGreen(), |
129 col.getBlue()); | |
130 symbolElement.setAttribute( | |
131 "outline_color", | |
132 String.valueOf(c.getRGB())); | |
120 symbolElement.setAttribute("outline_transparency", | 133 symbolElement.setAttribute("outline_transparency", |
121 String.valueOf(col.getTransparency())); | 134 String.valueOf(col.getTransparency())); |
122 } | 135 } |
123 | 136 |
124 symbolElement.setAttribute("angle", String.valueOf(symbol.getAngle())); | 137 symbolElement.setAttribute("angle", String.valueOf(symbol.getAngle())); |