diff --git a/pom.xml b/pom.xml
index fbda388..2e86795 100644
--- a/pom.xml
+++ b/pom.xml
@@ -415,10 +415,12 @@
gt-main
${geotools.version}
+
org.geotools
gt-referencing
@@ -482,11 +484,13 @@
gt-process
${geotools.version}
+
org.geotools.jdbc
gt-jdbc-postgis
@@ -533,6 +537,58 @@
2.9.1-v20130827-0309
+
+
+
+ org.opengis
+ gt-jdbc
+ 11.0
+ system
+ ${project.basedir}/src/main/webapp/WEB-INF/lib/gt-jdbc-11.0.jar
+
+
+ org.opengis
+ gt-opengis
+ 11.0
+ system
+ ${project.basedir}/src/main/webapp/WEB-INF/lib/gt-opengis-11.0.jar
+
+
+ com.tmax.tibero
+ tibero5-jdbc
+ 5.0
+ system
+ ${project.basedir}/src/main/webapp/WEB-INF/lib/tibero5-jdbc.jar
+
+
+
+ ar.com.hjg
+ pngj
+ 2.1.1
+ system
+ ${project.basedir}/src/main/webapp/WEB-INF/lib/pngj-2.1.1.jar
+
+
+
+ com.geowave
+ geowave-driver
+ 0.9
+ system
+ ${project.basedir}/src/main/webapp/WEB-INF/lib/geowave-driver-0.9.jar
+
+
+
+ com.geotwo
+ wms
+ 1.0
+ system
+ ${project.basedir}/src/main/webapp/WEB-INF/lib/wms.jar
+
+
+
+ com.oracle ojdbc6 11.2.0.4 system
+ ${project.basedir}/src/main/webapp/WEB-INF/lib/ojdbc6-11.2.0.4.jar
+
diff --git a/src/main/java/com/MyStartServer.java b/src/main/java/com/MyStartServer.java
new file mode 100644
index 0000000..127292c
--- /dev/null
+++ b/src/main/java/com/MyStartServer.java
@@ -0,0 +1,49 @@
+package com;
+
+import org.springframework.context.ApplicationListener;
+import org.springframework.context.event.ContextRefreshedEvent;
+import org.springframework.stereotype.Component;
+
+import com.geotwo.webserver.core.ServerInfo;
+import com.geotwo.webserver.core.init.ServerConfiguration;
+import com.geotwo.webserver.core.service.ServiceMngr;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Component
+public class MyStartServer implements ApplicationListener {
+
+ // 로깅을 위한 Logger 인스턴스
+ private static final Logger LOGGER = LoggerFactory.getLogger(MyStartServer.class);
+
+ /**
+ * ContextRefreshedEvent가 발생했을 때 호출되는 메서드입니다.
+ * 이 이벤트는 모든 빈이 로드되고 초기화된 후 애플리케이션 컨텍스트가 성공적으로 새로고침되었을 때 발생합니다.
+ *
+ * @param event 발생한 ContextRefreshedEvent
+ */
+ @Override
+ public void onApplicationEvent(ContextRefreshedEvent event) {
+ // 부모 컨텍스트에도 이벤트가 발생할 수 있으므로, 최상위(루트) 컨텍스트에서만 실행되도록 확인합니다.
+ // 이는 중복 실행을 방지합니다.
+ if (event.getApplicationContext().getParent() == null) {
+ LOGGER.info("**************************************");
+ LOGGER.info("* *");
+ LOGGER.info("* WMS 서버 시작 *");
+ LOGGER.info("* *");
+ LOGGER.info("**************************************");
+
+ // 여기에 서버 시작 시 실행하고 싶은 다른 로직을 추가할 수 있습니다.
+ // 예: 초기 데이터 로드, 스케줄러 시작 등
+
+ if (ServerConfiguration.getInstance().startServer())
+ ServerInfo.getInstance().setStarted(true);
+ else {
+ ServerInfo.getInstance().setStarted(false);
+ }
+
+ ServiceMngr.initServices();
+ }
+ }
+}
diff --git a/src/main/java/com/geotwo/webserver/core/coverage/o2layer/O2LayerUtil.java b/src/main/java/com/geotwo/webserver/core/coverage/o2layer/O2LayerUtil.java
index abe0e58..9081b51 100644
--- a/src/main/java/com/geotwo/webserver/core/coverage/o2layer/O2LayerUtil.java
+++ b/src/main/java/com/geotwo/webserver/core/coverage/o2layer/O2LayerUtil.java
@@ -354,7 +354,7 @@ public class O2LayerUtil {
}
Envelope targetBBox = bbox.intersection(levelSet.getBBox());
if (targetBBox == null || targetBBox.isNull())
- return gcFactory.create("DEM", raster, (Envelope)bbox);
+ return gcFactory.create("DEM", raster, (org.opengis.geometry.Envelope)bbox);
double resX = bbox.getWidth() / width;
double resY = bbox.getHeight() / height;
double res = Math.max(resX, resY);
@@ -405,7 +405,7 @@ public class O2LayerUtil {
GridSampleDimension[] bands = new GridSampleDimension[raster.getNumBands()];
ColorModel model = bands[0].getColorModel(0, bands.length, raster.getSampleModel().getDataType());
RenderedImage image = new BufferedImage(model, raster, false, null);
- return (new GridCoverageFactory()).create("DEM", image, (Envelope)bbox, null, null, propMap);
+ return (new GridCoverageFactory()).create("DEM", image, (org.opengis.geometry.Envelope)bbox, null, null, propMap);
}
public static ArrayList calBlockIndex(O2LayerLevel level, Envelope cBBox) throws Exception {
diff --git a/src/main/java/com/geotwo/webserver/core/feature/FeatureMngr.java b/src/main/java/com/geotwo/webserver/core/feature/FeatureMngr.java
index a28bb34..553beec 100644
--- a/src/main/java/com/geotwo/webserver/core/feature/FeatureMngr.java
+++ b/src/main/java/com/geotwo/webserver/core/feature/FeatureMngr.java
@@ -16,6 +16,7 @@ import com.vividsolutions.jts.geom.Geometry;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
+import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
@@ -143,86 +144,83 @@ public class FeatureMngr {
}
public static List insertFeature(LayerFactory.LayerType layerType, String serverName, String tableName, SimpleFeature feature, boolean useProvidedFid) throws Exception {
- try {
- JDBCFeatureStore featureStore = O2DSMngr.getFeatureStore(layerType, serverName, tableName);
- SimpleFeatureType featureType = featureStore.getSchema();
- for (PropertyDescriptor property : feature.getFeatureType().getDescriptors()) {
- if (featureType.getDescriptor(property.getName().getLocalPart().toUpperCase()) == null)
- if (!property.getName().getLocalPart().equalsIgnoreCase("NAME") &&
- !property.getName().getLocalPart().equalsIgnoreCase("DESCRIPTION") &&
- !property.getName().getLocalPart().equalsIgnoreCase("BOUNDEDBY"))
- throw new Exception("Input Property [" + property.getName().getLocalPart() + "] is not exist.");
- }
- if (useProvidedFid &&
- featureStore.getPrimaryKey() != null &&
- featureStore.getPrimaryKey().getColumns().size() != 0) {
- String pkColumn = ((PrimaryKeyColumn)featureStore.getPrimaryKey().getColumns().get(0)).getName();
- if (feature.getProperty(pkColumn) != null) {
- Object pkValue = feature.getProperty(pkColumn).getValue();
- Id id = QueryMngr.filterFactory.id(new FeatureId[] { (FeatureId)new FeatureIdImpl(pkValue.toString()) });
- int count = featureStore.getCount(new Query(featureStore.getSchema().getTypeName(), (Filter)id));
- if (count != 0)
- throw new SQLException("Can't insert feature :: Already Exist PrimaryKey Value [" + feature.getIdentifier().getID() + "]");
- }
- }
- RefindInsertFeatureCollection refineFeatureCollection =
- new RefindInsertFeatureCollection(feature, (ContentFeatureStore)featureStore, useProvidedFid);
- List fID = null;
- DefaultTransaction transaction = new DefaultTransaction("insert");
try {
- featureStore.setTransaction((Transaction)transaction);
- FeatureWriter writer = featureStore.getWriter((Filter)Filter.INCLUDE, 1);
- SimpleFeature toWrite = (SimpleFeature)writer.next();
- JDBCFeatureReader.ResultSetFeature resultSetFeature = ResultSetFeatureRefinder.refindResultSetFeature(toWrite);
- fID = new LinkedList();
- SimpleFeatureIterator simpleFeatureIterator = refineFeatureCollection.features();
- try {
- while (simpleFeatureIterator.hasNext()) {
- SimpleFeature refineFeature = (SimpleFeature)simpleFeatureIterator.next();
- for (int i = 0; i < resultSetFeature.getType().getAttributeCount(); i++) {
- String name = resultSetFeature.getType().getDescriptor(i).getLocalName();
- resultSetFeature.setAttribute(name, refineFeature.getAttribute(name));
- }
- if (refineFeature.getUserData().size() > 0)
- resultSetFeature.getUserData().putAll(refineFeature.getUserData());
- if (featureStore.getQueryCapabilities().isUseProvidedFIDSupported() && (
- (Boolean)refineFeature.getUserData().get(Hints.USE_PROVIDED_FID)).booleanValue())
- ((FeatureIdImpl)resultSetFeature.getIdentifier()).setID(refineFeature.getID());
- writer.write();
- fID.add(resultSetFeature.getIdentifier());
- }
- } finally {
- writer.close();
- simpleFeatureIterator.close();
- }
- transaction.commit();
- } catch (Exception e) {
- transaction.rollback();
- throw e;
- } finally {
- transaction.close();
- }
- if (feature.getDefaultGeometry() != null ||
- feature.getDefaultGeometry() instanceof Geometry) {
- Geometry insertGeom = (Geometry)feature.getDefaultGeometry();
- if (insertGeom.getUserData() != null &&
- insertGeom.getUserData() instanceof CoordinateReferenceSystem &&
- featureType.getCoordinateReferenceSystem() != null) {
- CoordinateReferenceSystem crs = (CoordinateReferenceSystem)insertGeom.getUserData();
- if (!CRS.equalsIgnoreMetadata(crs, featureType.getCoordinateReferenceSystem())) {
- MathTransform transform = CRS.findMathTransform(crs, featureType.getCoordinateReferenceSystem(), true);
- insertGeom = JTS.transform(insertGeom, transform);
- }
- }
- Envelope envelope = insertGeom.getEnvelopeInternal();
- onInsertMetaData(featureStore, fID, envelope);
- }
- LogMngr.getInstance().logInfo("[DB]", "Insert Success :: " + serverName + "/" + tableName + ">" + fID.toString());
- return fID;
- } catch (Exception eek) {
- LogMngr.getInstance().logInfo("[DB]", "Insert Fail :: " + eek);
- throw new SQLException("Insert Fail :: " + eek);
- }
+ String pkColumn;
+ JDBCFeatureStore featureStore = O2DSMngr.getFeatureStore((LayerFactory.LayerType)layerType, (String)serverName, (String)tableName);
+ SimpleFeatureType featureType = featureStore.getSchema();
+ for (PropertyDescriptor property : feature.getFeatureType().getDescriptors()) {
+ if (featureType.getDescriptor(property.getName().getLocalPart().toUpperCase()) != null || property.getName().getLocalPart().equalsIgnoreCase("NAME") || property.getName().getLocalPart().equalsIgnoreCase("DESCRIPTION") || property.getName().getLocalPart().equalsIgnoreCase("BOUNDEDBY")) continue;
+ throw new Exception("Input Property [" + property.getName().getLocalPart() + "] is not exist.");
+ }
+ if (useProvidedFid && featureStore.getPrimaryKey() != null && featureStore.getPrimaryKey().getColumns().size() != 0 && feature.getProperty(pkColumn = ((PrimaryKeyColumn)featureStore.getPrimaryKey().getColumns().get(0)).getName()) != null) {
+ Object pkValue = feature.getProperty(pkColumn).getValue();
+ Id filter = QueryMngr.filterFactory.id(new FeatureId[]{new FeatureIdImpl(pkValue.toString())});
+ int count = featureStore.getCount(new Query(featureStore.getSchema().getTypeName(), (Filter)filter));
+ if (count != 0) {
+ throw new SQLException("Can't insert feature :: Already Exist PrimaryKey Value [" + feature.getIdentifier().getID() + "]");
+ }
+ }
+ RefindInsertFeatureCollection refineFeatureCollection = new RefindInsertFeatureCollection(feature, (ContentFeatureStore)featureStore, useProvidedFid);
+ LinkedList fID = null;
+ DefaultTransaction transaction = new DefaultTransaction("insert");
+ try {
+ try {
+ featureStore.setTransaction((Transaction)transaction);
+ FeatureWriter writer = featureStore.getWriter((Filter)Filter.INCLUDE, 1);
+ SimpleFeature toWrite = (SimpleFeature)writer.next();
+ toWrite = ResultSetFeatureRefinder.refindResultSetFeature((SimpleFeature)toWrite);
+ fID = new LinkedList();
+ SimpleFeatureIterator f = refineFeatureCollection.features();
+ try {
+ while (f.hasNext()) {
+ SimpleFeature refineFeature = (SimpleFeature)f.next();
+ int i = 0;
+ while (i < toWrite.getType().getAttributeCount()) {
+ String name = toWrite.getType().getDescriptor(i).getLocalName();
+ toWrite.setAttribute(name, refineFeature.getAttribute(name));
+ ++i;
+ }
+ if (refineFeature.getUserData().size() > 0) {
+ toWrite.getUserData().putAll(refineFeature.getUserData());
+ }
+ if (featureStore.getQueryCapabilities().isUseProvidedFIDSupported() && ((Boolean)refineFeature.getUserData().get(Hints.USE_PROVIDED_FID)).booleanValue()) {
+ ((FeatureIdImpl)toWrite.getIdentifier()).setID(refineFeature.getID());
+ }
+ writer.write();
+ fID.add(toWrite.getIdentifier());
+ }
+ }
+ finally {
+ writer.close();
+ f.close();
+ }
+ transaction.commit();
+ }
+ catch (Exception e) {
+ transaction.rollback();
+ throw e;
+ }
+ }
+ finally {
+ transaction.close();
+ }
+ if (feature.getDefaultGeometry() != null || feature.getDefaultGeometry() instanceof Geometry) {
+ CoordinateReferenceSystem crs;
+ Geometry insertGeom = (Geometry)feature.getDefaultGeometry();
+ if (insertGeom.getUserData() != null && insertGeom.getUserData() instanceof CoordinateReferenceSystem && featureType.getCoordinateReferenceSystem() != null && !CRS.equalsIgnoreMetadata((Object)(crs = (CoordinateReferenceSystem)insertGeom.getUserData()), (Object)featureType.getCoordinateReferenceSystem())) {
+ MathTransform transform = CRS.findMathTransform((CoordinateReferenceSystem)crs, (CoordinateReferenceSystem)featureType.getCoordinateReferenceSystem(), (boolean)true);
+ insertGeom = JTS.transform((Geometry)insertGeom, (MathTransform)transform);
+ }
+ Envelope envelope = insertGeom.getEnvelopeInternal();
+ FeatureMngr.onInsertMetaData(featureStore, fID, envelope);
+ }
+ LogMngr.getInstance().logInfo("[DB]", "Insert Success :: " + serverName + "/" + tableName + ">" + ((Object)fID).toString());
+ return fID;
+ }
+ catch (Exception eek) {
+ LogMngr.getInstance().logInfo("[DB]", "Insert Fail :: " + eek);
+ throw new SQLException("Insert Fail :: " + eek);
+ }
}
public static List insertFeatureCollection(LayerFactory.LayerType layerType, String serverName, String tableName, SimpleFeatureCollection collection, boolean useProvidedFid) throws Exception {
@@ -459,16 +457,36 @@ public class FeatureMngr {
}
private static double getMaxCount(JDBCFeatureStore featureStore, String keyField) throws SQLException, IOException {
- Connection cx = featureStore.getDataStore().getConnection(Transaction.AUTO_COMMIT);
- Statement st = cx.createStatement();
- try {
- String sql = "select max(" + keyField + ") from " + featureStore.getSchema().getTypeName();
- LogMngr.getInstance().logDebug("[DB]", "Lookup max count for [" + featureStore.getSchema().getTypeName() + "]");
- LogMngr.getInstance().logDebug("[DB]", "QUERY : " + sql);
- } finally {
- featureStore.getDataStore().closeSafe(cx);
- featureStore.getDataStore().closeSafe(st);
- }
+ Connection cx = featureStore.getDataStore().getConnection(Transaction.AUTO_COMMIT);
+ Statement st = cx.createStatement();
+ try {
+ Double max;
+ ResultSet rs;
+ block8: {
+ String sql = "select max(" + keyField + ") from " + featureStore.getSchema().getTypeName();
+ LogMngr.getInstance().logDebug("[DB]", "Lookup max count for [" + featureStore.getSchema().getTypeName() + "]");
+ LogMngr.getInstance().logDebug("[DB]", "QUERY : " + sql);
+ rs = st.executeQuery(sql);
+ try {
+ rs.next();
+ max = rs.getDouble(1);
+ if (max != null) break block8;
+ }
+ catch (Throwable throwable) {
+ rs.close();
+ throw throwable;
+ }
+ rs.close();
+ return 0.0;
+ }
+ double d = max;
+ rs.close();
+ return d;
+ }
+ finally {
+ featureStore.getDataStore().closeSafe(cx);
+ featureStore.getDataStore().closeSafe(st);
+ }
}
private static SimpleFeature refineInsertFeature(ContentFeatureStore featureStore, SimpleFeature feature) throws Exception {
diff --git a/src/main/java/com/geotwo/webserver/core/render/io/RenderFeatureSource.java b/src/main/java/com/geotwo/webserver/core/render/io/RenderFeatureSource.java
index a6b036b..a8a7a75 100644
--- a/src/main/java/com/geotwo/webserver/core/render/io/RenderFeatureSource.java
+++ b/src/main/java/com/geotwo/webserver/core/render/io/RenderFeatureSource.java
@@ -111,7 +111,7 @@ public class RenderFeatureSource implements SimpleFeatureSource {
}
public void accepts(Query query, FeatureVisitor visitor, ProgressListener progress) throws IOException {
- NullProgressListener nullProgressListener;
+ NullProgressListener nullProgressListener = null;
if (progress == null)
nullProgressListener = new NullProgressListener();
FeatureReader reader = getReader(query);
@@ -143,7 +143,6 @@ public class RenderFeatureSource implements SimpleFeatureSource {
}
public final FeatureReader getReader(Query query) throws IOException {
- System.out.println("thkim RenderFeatureSource.getReader() called with query: " + query);
RenderFeatureReader reader = new RenderFeatureReader(this.delegate, query);
if (query != null) {
ReferencedEnvelope bbox = new ReferencedEnvelope();
diff --git a/src/main/java/com/geotwo/webserver/core/render/legend/LegendGraphicBuilder.java b/src/main/java/com/geotwo/webserver/core/render/legend/LegendGraphicBuilder.java
index 3d23a3b..1eea59d 100644
--- a/src/main/java/com/geotwo/webserver/core/render/legend/LegendGraphicBuilder.java
+++ b/src/main/java/com/geotwo/webserver/core/render/legend/LegendGraphicBuilder.java
@@ -211,7 +211,7 @@ public class LegendGraphicBuilder {
layersImages.add(titleImage);
}
for (int pos = 0; pos < layers.size(); pos++) {
- Feature sampleFeature;
+ Feature sampleFeature = null;
Rule[] applicableRules;
FeatureType renderLayer = layers.get(pos);
Style renderStyle = styles.get(pos);
@@ -287,7 +287,7 @@ public class LegendGraphicBuilder {
shapePainter.paint(graphics, this.samplePoint, legend, scale.doubleValue(), false);
} else {
for (int sIdx = 0; sIdx < symbolizers.length; sIdx++) {
- PointSymbolizer pointSymbolizer;
+ PointSymbolizer pointSymbolizer = null;
Symbolizer symbolizer = symbolizers[sIdx];
if (symbolizer instanceof org.geotools.styling.RasterSymbolizer)
throw new IllegalStateException("It is not legal to have a RasterSymbolizer here");
@@ -400,7 +400,7 @@ public class LegendGraphicBuilder {
}
private Feature createSampleFeature(FeatureType schema) {
- Feature sampleFeature;
+ Feature sampleFeature = null;
try {
if (schema instanceof SimpleFeatureType) {
if (hasMixedGeometry((SimpleFeatureType)schema)) {
diff --git a/src/main/java/com/geotwo/webserver/core/render/sld/SLDParser100.java b/src/main/java/com/geotwo/webserver/core/render/sld/SLDParser100.java
index eb86609..3f3a2c0 100644
--- a/src/main/java/com/geotwo/webserver/core/render/sld/SLDParser100.java
+++ b/src/main/java/com/geotwo/webserver/core/render/sld/SLDParser100.java
@@ -93,21 +93,9 @@ import org.opengis.filter.expression.Expression;
import org.opengis.filter.expression.Function;
import org.opengis.filter.expression.Literal;
import org.opengis.filter.expression.PropertyName;
-import org.opengis.style.ChannelSelection;
-import org.opengis.style.ColorMap;
-import org.opengis.style.ContrastEnhancement;
import org.opengis.style.ContrastMethod;
-import org.opengis.style.Displacement;
-import org.opengis.style.Fill;
-import org.opengis.style.Font;
-import org.opengis.style.Graphic;
import org.opengis.style.GraphicLegend;
-import org.opengis.style.Halo;
-import org.opengis.style.LabelPlacement;
import org.opengis.style.SemanticType;
-import org.opengis.style.ShadedRelief;
-import org.opengis.style.Stroke;
-import org.opengis.style.Symbolizer;
import org.opengis.util.InternationalString;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -1359,7 +1347,7 @@ public class SLDParser100 {
}
if (icon == null) {
this.LOGGER.warning("returning empty icon");
- icon = new EmptyIcon(null);
+ icon = new EmptyIcon();
}
extgraph = this.factory.createExternalGraphic(icon, format);
} else {
@@ -1695,7 +1683,7 @@ public class SLDParser100 {
}
protected LabelPlacement parseLabelPlacement(Node root) {
- LinePlacement linePlacement;
+ LinePlacement linePlacement = null;
if (this.LOGGER.isLoggable(Level.FINEST))
this.LOGGER.finest("parsing labelPlacement");
LabelPlacement ret = null;
@@ -1718,7 +1706,7 @@ public class SLDParser100 {
}
protected PointPlacement parsePointPlacement(Node root) {
- Expression expression;
+ Expression expression = null;
if (this.LOGGER.isLoggable(Level.FINEST))
this.LOGGER.finest("parsing pointPlacement");
Literal literal = this.ff.literal(0.0D);
@@ -1750,7 +1738,7 @@ public class SLDParser100 {
}
protected LinePlacement parseLinePlacement(Node root) {
- Expression expression;
+ Expression expression = null;
if (this.LOGGER.isLoggable(Level.FINEST))
this.LOGGER.finest("parsing linePlacement");
Literal literal = this.ff.literal(0.0D);
diff --git a/src/main/java/com/geotwo/webserver/core/render/sld/SLDTransformer110.java b/src/main/java/com/geotwo/webserver/core/render/sld/SLDTransformer110.java
index a0bba59..f502935 100644
--- a/src/main/java/com/geotwo/webserver/core/render/sld/SLDTransformer110.java
+++ b/src/main/java/com/geotwo/webserver/core/render/sld/SLDTransformer110.java
@@ -1,7 +1,6 @@
package com.geotwo.webserver.core.render.sld;
import com.geotwo.webserver.core.render.StyleMngr;
-import java.awt.Component;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -20,7 +19,6 @@ import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.simple.SimpleFeatureSource;
import org.geotools.factory.CommonFactoryFinder;
import org.geotools.filter.FilterTransformer;
-import org.geotools.filter.FilterTransformer.FilterTranslator;
import org.geotools.gml.producer.FeatureTransformer;
import org.geotools.referencing.CRS;
import org.geotools.styling.AnchorPoint;
@@ -43,7 +41,6 @@ import org.geotools.styling.LinePlacement;
import org.geotools.styling.LineSymbolizer;
import org.geotools.styling.Mark;
import org.geotools.styling.NamedLayer;
-import org.geotools.styling.NamedStyle;
import org.geotools.styling.OverlapBehavior;
import org.geotools.styling.PointPlacement;
import org.geotools.styling.PointSymbolizer;
@@ -85,1290 +82,1081 @@ import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class SLDTransformer110 extends TransformerBase {
- static final String XLINK_NAMESPACE = "http://www.w3.org/1999/xlink";
- static final FilterFactory ff = CommonFactoryFinder.getFilterFactory();
-
- public Translator createTranslator(ContentHandler handler) {
- SchemaLocationSupport schema = new SchemaLocationSupport();
- schema.setLocation("http://www.opengis.net/sld", "StyledLayerDescriptor.xsd");
- return new SLDTranslator(handler, schema);
- }
+ static final String XLINK_NAMESPACE = "http://www.w3.org/1999/xlink";
- class SLDTranslator extends TranslatorSupport implements StyleVisitor {
- FilterTranslator filterTranslator;
-
- public SLDTranslator(ContentHandler handler, SchemaLocationSupport schema) {
- super(handler, "sld", "http://www.opengis.net/sld", schema);
- this.getNamespaceSupport().declarePrefix("se", "http://www.opengis.net/se");
- this.filterTranslator = new FilterTranslator(handler);
- this.addNamespaceDeclarations(this.filterTranslator);
- this.getNamespaceSupport().declarePrefix("xlink", "http://www.w3.org/1999/xlink");
- }
-
- boolean isNull(Expression expr) {
- if (expr == null) {
- return true;
- } else if (expr == Expression.NIL) {
- return true;
- } else if (expr instanceof Literal) {
- Literal literal = (Literal)expr;
- return literal.getValue() == null;
- } else {
- return false;
- }
- }
-
- boolean isDefault(Expression expr, Object defaultValue) {
- if (defaultValue == null) {
- return this.isNull(expr);
- } else if (expr == null) {
- return false;
- } else if (expr == Expression.NIL) {
- return false;
- } else {
- if (expr instanceof Literal) {
- Literal literal = (Literal)expr;
- if (defaultValue.equals(literal.getValue())) {
- return true;
- }
-
- if (defaultValue.toString().equals(literal.getValue().toString())) {
- return true;
- }
- }
-
- return false;
- }
- }
-
- void labelContent(Expression expr) {
- if (expr instanceof Literal) {
- Literal literalLabel = (Literal)expr;
- String label = (String)literalLabel.evaluate((Object)null, String.class);
- if (label != null) {
- if (label.matches("^\\s+.*$|^.*\\s+$|^.*\\s{2,}.*$")) {
- this.cdata(label);
- } else {
- this.chars(label);
- }
- }
- } else if (!(expr instanceof Function) || !"strConcat".equals(((Function)expr).getName()) && !"concat".equals(((Function)expr).getName())) {
- this.filterTranslator.encode(expr);
- } else {
- List parameters = ((Function)expr).getParameters();
- Iterator var4 = parameters.iterator();
-
- while(var4.hasNext()) {
- Expression parameter = (Expression)var4.next();
- this.labelContent(parameter);
- }
- }
-
- }
-
- public void visit(PointPlacement pp) {
- if (pp != null) {
- try {
- this.contentHandler.startElement("", "", "se:LabelPlacement", this.NULL_ATTS);
- this.contentHandler.startElement("", "", "se:PointPlacement", this.NULL_ATTS);
- this.visit(pp.getAnchorPoint());
- this.visit(pp.getDisplacement());
- this.encodeValue("se:Rotation", (Attributes)null, pp.getRotation(), (Object)null);
- this.contentHandler.endElement("", "", "se:PointPlacement");
- this.contentHandler.endElement("", "", "se:LabelPlacement");
- } catch (SAXException var3) {
- throw new RuntimeException(var3);
- }
- }
- }
-
- public void visit(Stroke stroke) {
- if (stroke != null) {
- try {
- this.contentHandler.startElement("", "", "se:Stroke", this.NULL_ATTS);
- if (stroke.getGraphicFill() != null) {
- this.contentHandler.startElement("", "", "se:GraphicFill", this.NULL_ATTS);
- this.visit(stroke.getGraphicFill());
- this.contentHandler.endElement("", "", "se:GraphicFill");
- } else if (stroke.getGraphicStroke() != null) {
- this.contentHandler.startElement("", "", "se:GraphicStroke", this.NULL_ATTS);
- this.visit(stroke.getGraphicStroke());
- this.encodeValue("se:InitialGap", (Attributes)null, stroke.getGraphicStroke().getInitialGap(), (Object)null);
- this.encodeValue("se:Gap", (Attributes)null, stroke.getGraphicStroke().getGap(), (Object)null);
- this.contentHandler.endElement("", "", "se:GraphicStroke");
- }
-
- this.encodeSvgParam("stroke", stroke.getColor());
- this.encodeSvgParam("stroke-linecap", stroke.getLineCap());
- this.encodeSvgParam("stroke-linejoin", stroke.getLineJoin());
- this.encodeSvgParam("stroke-opacity", stroke.getOpacity());
- this.encodeSvgParam("stroke-width", stroke.getWidth());
- this.encodeSvgParam("stroke-dashoffset", stroke.getDashOffset());
- float[] dash = stroke.getDashArray();
- if (dash != null) {
- StringBuffer sb = new StringBuffer();
-
- for(int i = 0; i < dash.length; ++i) {
- sb.append(dash[i]);
- if (i < dash.length - 1) {
- sb.append(" ");
- }
- }
-
- this.encodeSvgParam("stroke-dasharray", SLDTransformer110.ff.literal(sb.toString()));
- }
-
- this.contentHandler.endElement("", "", "se:Stroke");
- } catch (SAXException var5) {
- throw new RuntimeException(var5);
- }
- }
- }
-
- public void visit(LinePlacement lp) {
- if (lp != null) {
- try {
- this.contentHandler.startElement("", "", "se:LabelPlacement", this.NULL_ATTS);
- this.encodeValue("se:PerpendicularOffset", (Attributes)null, lp.getPerpendicularOffset(), (Object)null);
- if (lp.isRepeated()) {
- this.encodeExt("se:IsRepeated", "1");
- }
-
- this.encodeValue("se:InitialGap", (Attributes)null, lp.getInitialGap(), (Object)null);
- this.encodeValue("se:Gap", (Attributes)null, lp.getGap(), (Object)null);
- if (lp.isAligned()) {
- this.encodeExt("se:IsAligned", "1");
- }
-
- if (lp.isGeneralizeLine()) {
- this.encodeExt("se:GeneralizeLine", "1");
- }
-
- this.contentHandler.endElement("", "", "se:LabelPlacement");
- } catch (SAXException var3) {
- throw new RuntimeException(var3);
- }
- }
- }
-
- public void visit(AnchorPoint ap) {
- if (ap != null) {
- try {
- this.contentHandler.startElement("", "", "se:AnchorPoint", this.NULL_ATTS);
- this.encodeValue("se:AnchorPointX", (Attributes)null, ap.getAnchorPointX(), (Object)null);
- this.encodeValue("se:AnchorPointY", (Attributes)null, ap.getAnchorPointY(), (Object)null);
- this.contentHandler.endElement("", "", "se:AnchorPoint");
- } catch (SAXException var3) {
- throw new RuntimeException(var3);
- }
- }
- }
-
- public void visit(TextSymbolizer text) {
- if (text != null) {
- try {
- AttributesImpl atts = new AttributesImpl();
- Unit uom = text.getUnitOfMeasure();
- if (uom != null) {
- atts.addAttribute("", "uom", "uom", "", UomOgcMapping.get(uom).getSEString());
- }
-
- this.contentHandler.startElement("", "", "se:TextSymbolizer", atts);
- if (text.getName() != null && text.getName().length() > 0) {
- this.encodeExt("se:Name", text.getName());
- }
-
- if (text.getDescription() != null) {
- this.visit(text.getDescription());
- }
-
- this.encodeGeometryExpression(text.getGeometry());
- if (text.getLabel() != null) {
- this.contentHandler.startElement("", "", "se:Label", atts);
- this.labelContent(text.getLabel());
- this.contentHandler.endElement("", "", "se:Label");
- }
-
- if (text.getFont() != null) {
- this.visit(text.getFont());
- }
-
- if (text.getLabelPlacement() != null) {
- text.getLabelPlacement().accept(this);
- }
-
- if (text.getHalo() != null) {
- this.visit(text.getHalo());
- }
-
- if (text.getFill() != null) {
- this.visit(text.getFill());
- }
-
- if (text.getOptions() != null) {
- this.encodeVendorOptions(text.getOptions());
- }
-
- this.contentHandler.endElement("", "", "se:TextSymbolizer");
- } catch (SAXException var4) {
- throw new RuntimeException(var4);
- }
- }
- }
-
- public void visit(RasterSymbolizer raster) {
- if (raster != null) {
- try {
- AttributesImpl atts = new AttributesImpl();
- Unit uom = raster.getUnitOfMeasure();
- if (uom != null) {
- atts.addAttribute("", "uom", "uom", "", UomOgcMapping.get(uom).getSEString());
- }
-
- this.contentHandler.startElement("", "", "se:RasterSymbolizer", atts);
- this.encodeGeometryExpression(raster.getGeometry());
- this.encodeValue("se:Opacity", (Attributes)null, raster.getOpacity(), 1.0D);
- if (raster.getChannelSelection() != null) {
- raster.getChannelSelection().accept(this);
- }
-
- if (raster.getOverlap() != null) {
- Expression overlaps = raster.getOverlap();
- if (overlaps instanceof PropertyName) {
- String pn = ((PropertyName)overlaps).getPropertyName();
- if ("RANDOM".equals(pn)) {
- this.encodeExt("se:OverlapBehavior", pn);
- }
- } else {
- this.encodeValue("se:OverlapBehavior", (Attributes)null, overlaps, "RANDOM");
- }
- }
-
- ColorMap colorMap = raster.getColorMap();
- if (colorMap != null && colorMap.getColorMapEntries() != null && colorMap.getColorMapEntries().length > 0) {
- colorMap.accept(this);
- }
-
- if (raster.getContrastEnhancement() != null) {
- raster.getContrastEnhancement().accept(this);
- }
-
- if (raster.getShadedRelief() != null) {
- raster.getShadedRelief().accept(this);
- }
-
- if (raster.getImageOutline() != null) {
- raster.getImageOutline().accept(this);
- }
-
- this.contentHandler.endElement("", "", "se:RasterSymbolizer");
- } catch (SAXException var6) {
- throw new RuntimeException(var6);
- }
- }
- }
-
- public void visit(ColorMap colorMap) {
- if (colorMap != null) {
- try {
- this.contentHandler.startElement("", "", "se:ColorMap", this.NULL_ATTS);
- int var6;
- if (colorMap.getType() == 1) {
- AttributesImpl atts = new AttributesImpl();
- atts.addAttribute("", "fallbackValue", "fallbackValue", "", "");
- this.contentHandler.startElement("", "", "se:Interpolate", atts);
- this.encodeExt("se:LookupValue", "Raster");
- ColorMapEntry[] mapEntries = colorMap.getColorMapEntries();
- ColorMapEntry[] var7 = mapEntries;
- var6 = mapEntries.length;
-
- for(int var5 = 0; var5 < var6; ++var5) {
- ColorMapEntry entry = var7[var5];
- this.contentHandler.startElement("", "", "se:InterpolationPoint", this.NULL_ATTS);
- this.encodeValue("se:Data", this.NULL_ATTS, entry.getQuantity(), (Object)null);
- String color = entry.getColor().toString();
-
- try {
- double opacity = Double.parseDouble(entry.getOpacity().toString());
- int alpha = (int)(255.0D * opacity);
- color = String.format(color + "%02x", alpha);
- } catch (Exception var14) {
- color = String.format(color + "%02x", 0);
- }
-
- this.encodeValue("se:Value", this.NULL_ATTS, StyleMngr.ff.literal(color), (Object)null);
- this.contentHandler.endElement("", "", "se:InterpolationPoint");
- }
-
- this.contentHandler.endElement("", "", "se:Interpolate");
- } else {
- String typeStr = "intervals";
- if (colorMap.getType() == 3) {
- typeStr = "values";
- }
-
- AttributesImpl atts = new AttributesImpl();
- atts.addAttribute("", "fallbackValue", "fallbackValue", "", "");
- atts.addAttribute("", "type", "type", "", typeStr);
- this.contentHandler.startElement("", "", "se:Categorize", atts);
- this.encodeExt("se:LookupValue", "Raster");
- this.encodeValue("se:Value", this.NULL_ATTS, StyleMngr.ff.literal("#FFFFFFFF"), (Object)null);
- ColorMapEntry[] mapEntries = colorMap.getColorMapEntries();
- ColorMapEntry[] var21 = mapEntries;
- int var20 = mapEntries.length;
-
- for(var6 = 0; var6 < var20; ++var6) {
- ColorMapEntry entry = var21[var6];
- String color = entry.getColor().toString();
-
- try {
- double opacity = Double.parseDouble(entry.getOpacity().toString());
- int alpha = (int)(255.0D * opacity);
- color = String.format(color + "%02x", alpha);
- } catch (Exception var13) {
- color = String.format(color + "%02x", 0);
- }
-
- this.encodeValue("se:Threshold", this.NULL_ATTS, entry.getQuantity(), (Object)null);
- this.encodeValue("se:Value", this.NULL_ATTS, StyleMngr.ff.literal(color), (Object)null);
- }
-
- this.contentHandler.endElement("", "", "se:Categorize");
- }
-
- this.contentHandler.endElement("", "", "se:ColorMap");
- } catch (Exception var15) {
- throw new RuntimeException(var15);
- }
- }
- }
-
- public void visit(ColorMapEntry colorEntry) {
- }
-
- public void visit(Symbolizer sym) {
- try {
- this.contentHandler.startElement("", "!--", "!--", this.NULL_ATTS);
- this.chars("Unidentified Symbolizer " + sym.getClass());
- this.contentHandler.endElement("", "--", "--");
- } catch (SAXException var3) {
- throw new RuntimeException(var3);
- }
- }
-
- public void visit(PolygonSymbolizer poly) {
- try {
- AttributesImpl atts = new AttributesImpl();
- Unit uom = poly.getUnitOfMeasure();
- if (uom != null) {
- atts.addAttribute("", "uom", "uom", "", UomOgcMapping.get(uom).getSEString());
- }
-
- this.contentHandler.startElement("", "", "se:PolygonSymbolizer", atts);
- if (poly.getName() != null && poly.getName().length() > 0) {
- this.encodeExt("se:Name", poly.getName());
- }
-
- if (poly.getDescription() != null) {
- this.visit(poly.getDescription());
- }
-
- this.encodeGeometryExpression(poly.getGeometry());
- if (poly.getFill() != null) {
- this.visit(poly.getFill());
- }
-
- if (poly.getStroke() != null) {
- this.visit(poly.getStroke());
- }
-
- if (poly.getDisplacement() != null) {
- this.visit(poly.getDisplacement());
- }
-
- if (poly.getPerpendicularOffset() != null) {
- this.encodeValue("se:PerpendicularOffset", (Attributes)null, poly.getPerpendicularOffset(), (Object)null);
- }
-
- if (poly.getOptions() != null) {
- this.encodeVendorOptions(poly.getOptions());
- }
-
- this.contentHandler.endElement("", "", "se:PolygonSymbolizer");
- } catch (SAXException var4) {
- throw new RuntimeException(var4);
- }
- }
-
- public void visit(ExternalGraphic exgr) {
- try {
- if (exgr.getInlineContent() != null) {
- this.contentHandler.startElement("", "", "se:ExternalGraphic", this.NULL_ATTS);
- this.encodeInlineContent(exgr.getInlineContent());
- } else {
- if (exgr.getOnlineResource() == null) {
- return;
- }
-
- this.contentHandler.startElement("", "", "se:ExternalGraphic", this.NULL_ATTS);
- this.encodeOnLineResource(exgr.getOnlineResource());
- }
-
- this.encodeExt("se:Format", exgr.getFormat());
- this.contentHandler.endElement("", "", "se:ExternalGraphic");
- } catch (Exception var3) {
- throw new RuntimeException(var3);
- }
- }
-
- public void visit(LineSymbolizer line) {
- try {
- AttributesImpl atts = new AttributesImpl();
- Unit uom = line.getUnitOfMeasure();
- if (uom != null) {
- atts.addAttribute("", "uom", "uom", "", UomOgcMapping.get(uom).getSEString());
- }
-
- this.contentHandler.startElement("", "", "se:LineSymbolizer", atts);
- if (line.getName() != null && line.getName().length() > 0) {
- this.encodeExt("se:Name", line.getName());
- }
-
- if (line.getDescription() != null) {
- this.visit(line.getDescription());
- }
-
- this.encodeGeometryExpression(line.getGeometry());
- if (line.getStroke() != null) {
- this.visit(line.getStroke());
- }
-
- if (line.getPerpendicularOffset() != null) {
- this.encodeValue("se:PerpendicularOffset", (Attributes)null, line.getPerpendicularOffset(), (Object)null);
- }
-
- if (line.getOptions() != null) {
- this.encodeVendorOptions(line.getOptions());
- }
-
- this.contentHandler.endElement("", "", "se:LineSymbolizer");
- } catch (SAXException var4) {
- throw new RuntimeException(var4);
- }
- }
-
- public void visit(Fill fill) {
- try {
- this.contentHandler.startElement("", "", "se:Fill", this.NULL_ATTS);
- if (fill.getGraphicFill() != null) {
- this.contentHandler.startElement("", "", "se:GraphicFill", this.NULL_ATTS);
- this.visit(fill.getGraphicFill());
- this.contentHandler.endElement("", "", "se:GraphicFill");
- }
-
- this.encodeSvgParam("fill", fill.getColor());
- this.encodeSvgParam("fill-opacity", fill.getOpacity());
- this.contentHandler.endElement("", "", "se:Fill");
- } catch (SAXException var3) {
- throw new RuntimeException(var3);
- }
- }
-
- public void visit(Rule rule) {
- try {
- this.contentHandler.startElement("", "", "se:Rule", this.NULL_ATTS);
- if (rule.getName() != null && rule.getName().length() > 0) {
- this.encodeExt("se:Name", rule.getName());
- }
-
- if (rule.getDescription() != null) {
- this.visit(rule.getDescription());
- }
-
- if (rule.getLegend() != null) {
- this.contentHandler.startElement("", "", "se:LegendGraphic", this.NULL_ATTS);
- this.visit((Graphic)rule.getLegend());
- this.contentHandler.endElement("", "", "se:LegendGraphic");
- }
-
- Filter filter = rule.getFilter();
- if (filter != null && filter != Filter.INCLUDE) {
- this.visit(filter);
- }
-
- if (rule.isElseFilter()) {
- this.encodeExt("se:ElseFilter", (String)null);
- }
-
- if (rule.getMinScaleDenominator() != 0.0D) {
- this.encodeExt("se:MinScaleDenominator", Double.toString(rule.getMinScaleDenominator()));
- }
-
- if (rule.getMaxScaleDenominator() != Double.POSITIVE_INFINITY) {
- this.encodeExt("se:MaxScaleDenominator", Double.toString(rule.getMaxScaleDenominator()));
- }
-
- Symbolizer[] symbols = rule.getSymbolizers();
- Symbolizer[] var7 = symbols;
- int var6 = symbols.length;
-
- for(int var5 = 0; var5 < var6; ++var5) {
- Symbolizer symbol = var7[var5];
- symbol.accept(this);
- }
-
- this.contentHandler.endElement("", "", "se:Rule");
- } catch (Exception var8) {
- throw new RuntimeException(var8);
- }
- }
-
- public void visit(Mark mark) {
- try {
- if (mark.getWellKnownName() != null) {
- this.contentHandler.startElement("", "", "se:Mark", this.NULL_ATTS);
- this.encodeValue("se:WellKnownName", (Attributes)null, mark.getWellKnownName(), (Object)null);
- } else if (mark.getExternalMark() != null && mark.getExternalMark().getInlineContent() != null) {
- this.contentHandler.startElement("", "", "se:Mark", this.NULL_ATTS);
- this.encodeInlineContent(mark.getExternalMark().getInlineContent());
- this.encodeExt("se:Format", mark.getExternalMark().getFormat());
- if (mark.getExternalMark().getMarkIndex() != -1) {
- this.encodeExt("se:MarkIndex", Integer.toString(mark.getExternalMark().getMarkIndex()));
- }
- } else {
- if (mark.getExternalMark() == null || mark.getExternalMark().getOnlineResource() == null) {
- return;
- }
-
- this.contentHandler.startElement("", "", "se:Mark", this.NULL_ATTS);
- this.encodeOnLineResource(mark.getExternalMark().getOnlineResource());
- this.encodeExt("se:Format", mark.getExternalMark().getFormat());
- if (mark.getExternalMark().getMarkIndex() != -1) {
- this.encodeExt("se:MarkIndex", Integer.toString(mark.getExternalMark().getMarkIndex()));
- }
- }
-
- if (mark.getFill() != null) {
- this.visit(mark.getFill());
- }
-
- if (mark.getStroke() != null) {
- this.visit(mark.getStroke());
- }
-
- this.contentHandler.endElement("", "", "se:Mark");
- } catch (SAXException var3) {
- throw new RuntimeException(var3);
- }
- }
-
- public void visit(PointSymbolizer ps) {
- try {
- AttributesImpl atts = new AttributesImpl();
- Unit uom = ps.getUnitOfMeasure();
- if (uom != null) {
- atts.addAttribute("", "uom", "uom", "", UomOgcMapping.get(uom).getSEString());
- }
-
- this.contentHandler.startElement("", "", "se:PointSymbolizer", atts);
- if (ps.getName() != null && ps.getName().length() > 0) {
- this.encodeExt("se:Name", ps.getName());
- }
-
- if (ps.getDescription() != null) {
- this.visit(ps.getDescription());
- }
-
- this.encodeGeometryExpression(ps.getGeometry());
- if (ps.getGraphic() != null) {
- this.visit(ps.getGraphic());
- }
-
- if (ps.getOptions() != null) {
- this.encodeVendorOptions(ps.getOptions());
- }
-
- this.contentHandler.endElement("", "", "se:PointSymbolizer");
- } catch (SAXException var4) {
- throw new RuntimeException(var4);
- }
- }
-
- public void visit(Halo halo) {
- try {
- this.contentHandler.startElement("", "", "se:Halo", this.NULL_ATTS);
- this.encodeValue("se:Radius", (Attributes)null, halo.getRadius(), (Object)null);
- if (halo.getFill() != null) {
- this.visit(halo.getFill());
- }
-
- this.contentHandler.endElement("", "", "se:Halo");
- } catch (Exception var3) {
- throw new RuntimeException(var3);
- }
- }
-
- public void visit(Graphic gr) {
- try {
- this.contentHandler.startElement("", "", "se:Graphic", this.NULL_ATTS);
- Iterator var3 = gr.graphicalSymbols().iterator();
-
- while(var3.hasNext()) {
- GraphicalSymbol symbol = (GraphicalSymbol)var3.next();
- if (symbol instanceof ExternalGraphic) {
- this.visit((ExternalGraphic)symbol);
- } else if (symbol instanceof Mark) {
- this.visit((Mark)symbol);
- }
- }
-
- this.encodeValue("se:Opacity", (Attributes)null, gr.getOpacity(), (Object)null);
- this.encodeValue("se:Size", (Attributes)null, gr.getSize(), (Object)null);
- this.encodeValue("se:Rotation", (Attributes)null, gr.getRotation(), (Object)null);
- if (gr.getAnchorPoint() != null) {
- this.visit(gr.getAnchorPoint());
- }
-
- if (gr.getDisplacement() != null) {
- this.visit(gr.getDisplacement());
- }
-
- this.contentHandler.endElement("", "", "se:Graphic");
- } catch (Exception var4) {
- throw new RuntimeException(var4);
- }
- }
-
- public void visit(StyledLayerDescriptor sld) {
- AttributesImpl atts = new AttributesImpl();
- atts.addAttribute("", "version", "version", "", "1.1.0");
- this.start("StyledLayerDescriptor", atts);
- if (sld.getName() != null && sld.getName().length() > 0) {
- this.encodeExt("se:Name", sld.getName());
- }
-
- if (sld.getTitle() != null && sld.getTitle().length() > 0 || sld.getAbstract() != null && sld.getAbstract().length() > 0) {
- this.encodeDescription(sld.getTitle(), sld.getAbstract());
- }
-
- StyledLayer[] layers = sld.getStyledLayers();
- if (layers != null && layers.length > 0) {
- StyledLayer[] var7;
- int var6 = (var7 = sld.getStyledLayers()).length;
-
- for(int var5 = 0; var5 < var6; ++var5) {
- StyledLayer layer = var7[var5];
- if (layer instanceof NamedLayer) {
- this.visit((NamedLayer)layer);
- } else {
- if (!(layer instanceof UserLayer)) {
- throw new IllegalArgumentException("StyledLayer '" + layer.getClass().toString() + "' not found");
- }
-
- this.visit((UserLayer)layer);
- }
- }
- }
-
- this.end("StyledLayerDescriptor");
- }
-
- public void visit(NamedLayer layer) {
- this.start("NamedLayer");
- this.encodeExt("se:Name", layer.getName());
- FeatureTypeConstraint[] lfCons = layer.getLayerFeatureConstraints();
- if (lfCons != null && lfCons.length > 0) {
- this.start("LayerFeatureConstraints");
- FeatureTypeConstraint[] var6 = lfCons;
- int var5 = lfCons.length;
-
- for(int var4 = 0; var4 < var5; ++var4) {
- FeatureTypeConstraint lfc = var6[var4];
- this.visit(lfc);
- }
-
- this.end("LayerFeatureConstraints");
- }
-
- Iterator var8 = layer.styles().iterator();
-
- while(var8.hasNext()) {
- Style style = (Style)var8.next();
- this.visit(style);
- }
-
- this.end("NamedLayer");
- }
-
- public void visit(UserLayer layer) {
- this.start("UserLayer");
- if (layer.getName() != null && layer.getName().length() > 0) {
- this.encodeExt("se:Name", layer.getName());
- }
-
- DataStore inlineFDS = layer.getInlineFeatureDatastore();
- if (inlineFDS != null) {
- this.visitInlineFeatureType(inlineFDS, layer.getInlineFeatureType());
- } else if (layer.getRemoteOWS() != null) {
- this.visit(layer.getRemoteOWS());
- }
-
- this.start("LayerFeatureConstraints");
- FeatureTypeConstraint[] lfc = layer.getLayerFeatureConstraints();
- if (lfc != null && lfc.length > 0) {
- for(int i = 0; i < lfc.length; ++i) {
- this.visit(lfc[i]);
- }
- } else {
- this.start("FeatureTypeConstraint");
- this.end("FeatureTypeConstraint");
- }
-
- this.end("LayerFeatureConstraints");
- Style[] styles = layer.getUserStyles();
-
- for(int i = 0; i < styles.length; ++i) {
- this.visit(styles[i]);
- }
-
- this.end("UserLayer");
- }
-
- private void visitInlineFeatureType(DataStore dataStore, SimpleFeatureType featureType) {
- this.start("InlineFeature");
-
- try {
- String ftName = featureType.getTypeName();
- SimpleFeatureSource fs = dataStore.getFeatureSource(ftName);
- SimpleFeatureCollection fc = fs.getFeatures();
- FeatureTransformer ftrax = new FeatureTransformer();
- ftrax.setCollectionNamespace((String)null);
- ftrax.setCollectionPrefix((String)null);
- ftrax.setGmlPrefixing(true);
- ftrax.setIndentation(2);
- CoordinateReferenceSystem crs = featureType.getGeometryDescriptor().getCoordinateReferenceSystem();
- String srsName = null;
- if (crs != null) {
- srsName = CRS.toSRS(crs, true);
- if (srsName == null) {
- Set ids = crs.getIdentifiers();
- if (ids != null && !ids.isEmpty()) {
- Iterator var11 = ids.iterator();
-
- while(var11.hasNext()) {
- ReferenceIdentifier id = (ReferenceIdentifier)var11.next();
- if (id != null) {
- srsName = String.valueOf(id);
- break;
- }
- }
- }
- }
-
- if (srsName != null) {
- int var16 = srsName.indexOf(58);
- }
- }
-
- if (srsName != null) {
- ftrax.setSrsName(srsName);
- }
-
- String defaultNS = this.getDefaultNamespace();
- ftrax.getFeatureTypeNamespaces().declareDefaultNamespace("", defaultNS);
- String ns = featureType.getName().getNamespaceURI();
- if (ns != null) {
- String prefix = this.nsSupport.getPrefix(ns);
- if (prefix != null) {
- ftrax.getFeatureTypeNamespaces().declareNamespace(featureType, prefix, ns);
- }
- }
-
- Translator t = ftrax.createTranslator(this.contentHandler);
- t.encode(fc);
- } catch (IOException var12) {
- }
-
- this.end("InlineFeature");
- }
-
- public void visit(RemoteOWS remoteOWS) {
- this.start("RemoteOWS");
- this.element("Service", remoteOWS.getService());
- this.encodeOnLineResource(remoteOWS.getOnlineResource());
- this.end("RemoteOWS");
- }
-
- public void visit(FeatureTypeConstraint ftc) {
- this.start("FeatureTypeConstraint");
- if (ftc != null) {
- this.encodeExt("se:FeatureTypeName", ftc.getFeatureTypeName());
- this.visit(ftc.getFilter());
- Extent[] extent = ftc.getExtents();
-
- for(int i = 0; i < extent.length; ++i) {
- this.visit(extent[i]);
- }
- }
-
- this.end("FeatureTypeConstraint");
- }
-
- public void visit(Extent extent) {
- this.start("Extent");
- this.encodeExt("se:Name", extent.getName());
- this.element("Value", extent.getValue());
- this.end("Extent");
- }
-
- public void visit(Filter filter) {
- try {
- this.contentHandler.startElement("", "", "ogc:Filter", this.NULL_ATTS);
- this.filterTranslator.encode(filter);
- this.contentHandler.endElement("", "", "ogc:Filter");
- } catch (SAXException var3) {
- throw new RuntimeException(var3);
- }
- }
-
- public void visit(Style style) {
- if (style instanceof NamedStyle) {
- this.start("NamedStyle");
- this.encodeExt("se:Name", style.getName());
- if (style.getDescription() != null) {
- this.visit(style.getDescription());
- }
-
- this.end("NamedStyle");
- } else {
- this.start("UserStyle");
- if (style.getName() != null && style.getName().length() > 0) {
- this.encodeExt("se:Name", style.getName());
- }
-
- if (style.getDescription() != null) {
- this.visit(style.getDescription());
- }
-
- if (style.isDefault()) {
- this.element("IsDefault", "1");
- }
-
- List ftStyles = style.featureTypeStyles();
- if (ftStyles != null && ftStyles.size() > 0) {
- Iterator var4 = ftStyles.iterator();
-
- while(var4.hasNext()) {
- FeatureTypeStyle fts = (FeatureTypeStyle)var4.next();
- this.visit(fts);
- }
- }
-
- this.end("UserStyle");
- }
-
- }
-
- public void visit(FeatureTypeStyle fts) {
- try {
- this.contentHandler.startElement("", "", "se:FeatureTypeStyle", this.NULL_ATTS);
- if (fts.getName() != null && fts.getName().length() > 0) {
- this.encodeExt("se:Name", fts.getName());
- }
-
- if (fts.getDescription() != null) {
- this.visit(fts.getDescription());
- }
-
- Set ftNames = fts.featureTypeNames();
- if (ftNames != null && ftNames.size() > 0) {
- this.encodeExt("se:FeatureTypeName", ((Name)ftNames.iterator().next()).toString());
- }
-
- Set sTypes = fts.semanticTypeIdentifiers();
- if (sTypes != null && sTypes.size() > 0 && (sTypes.size() != 1 || !((SemanticType)sTypes.iterator().next()).equals(SemanticType.ANY.toString()))) {
- Iterator var5 = fts.semanticTypeIdentifiers().iterator();
-
- while(var5.hasNext()) {
- SemanticType sti = (SemanticType)var5.next();
- if (sti.name() != null && sti.name().length() > 0) {
- this.encodeExt("se:SemanticTypeIdentifier", sti.name());
- }
- }
- }
-
- List rules = fts.rules();
- if (rules != null && rules.size() > 0) {
- Iterator var6 = rules.iterator();
-
- while(var6.hasNext()) {
- Rule rule = (Rule)var6.next();
- this.visit(rule);
- }
- }
-
- OnLineResource olResource = fts.getOnlineResource();
- if (olResource != null) {
- this.encodeOnLineResource(olResource);
- }
-
- this.contentHandler.endElement("", "", "se:FeatureTypeStyle");
- } catch (Exception var7) {
- throw new RuntimeException(var7);
- }
- }
-
- public void visit(Displacement dis) {
- Expression dx = dis.getDisplacementX();
- Expression dy = dis.getDisplacementY();
- if (!this.isNull(dx) || !this.isNull(dy)) {
- if (!this.isDefault(dx, 0) || !this.isDefault(dy, 0)) {
- try {
- this.contentHandler.startElement("", "", "se:Displacement", this.NULL_ATTS);
- this.encodeValue("se:DisplacementX", (Attributes)null, dis.getDisplacementX(), (Object)null);
- this.encodeValue("se:DisplacementY", (Attributes)null, dis.getDisplacementY(), (Object)null);
- this.contentHandler.endElement("", "", "se:Displacement");
- } catch (SAXException var5) {
- throw new RuntimeException(var5);
- }
- }
- }
- }
-
- void encodeGeometryExpression(Expression geom) {
- if (geom != null) {
- try {
- this.contentHandler.startElement("", "", "se:Geometry", this.NULL_ATTS);
- this.filterTranslator.encode(geom);
- this.contentHandler.endElement("", "", "se:Geometry");
- } catch (SAXException var3) {
- throw new RuntimeException(var3);
- }
- }
- }
-
- void encodeSvgParam(String name, Expression expression) {
- this.encodeSvgParam(name, expression, (Object)null);
- }
-
- void encodeSvgParam(String name, Expression expression, Object defaultValue) {
- if (expression != null) {
- AttributesImpl atts = new AttributesImpl();
- atts.addAttribute("", "name", "name", "", name);
- this.encodeValue("se:SvgParameter", atts, expression, defaultValue);
- }
- }
-
- void encodeVendorOptions(Map options) {
- if (options != null) {
- Iterator it = options.keySet().iterator();
-
- while(it.hasNext()) {
- String key = (String)it.next();
- String value = (String)options.get(key);
- this.encodeVendorOption(key, value);
- }
- }
-
- }
-
- void encodeVendorOption(String key, String value) {
- AttributesImpl atts = new AttributesImpl();
- atts.addAttribute("", "name", "name", "", key);
- this.encodeExt("se:VendorOption", value, atts);
- }
-
- public void encode(Style[] styles) {
- try {
- this.contentHandler.startDocument();
- this.start("StyledLayerDescriptor", this.NULL_ATTS);
- this.start("NamedLayer", this.NULL_ATTS);
- int i = 0;
-
- for(int ii = styles.length; i < ii; ++i) {
- styles[i].accept(this);
- }
-
- this.end("NamedLayer");
- this.end("StyledLayerDescriptor");
- this.contentHandler.endDocument();
- } catch (SAXException var4) {
- throw new RuntimeException(var4);
- }
- }
-
- public void encode(StyledLayerDescriptor sld) {
- try {
- this.contentHandler.startDocument();
- sld.accept(this);
- this.contentHandler.endDocument();
- } catch (SAXException var3) {
- throw new RuntimeException(var3);
- }
- }
-
- public void encode(Object o) throws IllegalArgumentException {
- if (o instanceof StyledLayerDescriptor) {
- this.encode((StyledLayerDescriptor)o);
- } else if (o instanceof Style[]) {
- this.encode((Style[])o);
- } else {
- Class c = o.getClass();
-
- try {
- Method m = c.getMethod("accept", StyleVisitor.class);
- m.invoke(o, this);
- } catch (NoSuchMethodException var4) {
- throw new IllegalArgumentException("Cannot encode " + o);
- } catch (Exception var5) {
- throw new RuntimeException("Internal transformation exception", var5);
- }
- }
-
- }
-
- public void visit(ContrastEnhancement ce) {
- if (ce != null && ce.getMethod() != null) {
- try {
- this.contentHandler.startElement("", "", "se:ContrastEnhancement", this.NULL_ATTS);
- ContrastMethod method = ce.getMethod();
- if (method != null && !ContrastMethod.NONE.equals(method)) {
- String val = method.name();
- val = val.substring(0, 1).toUpperCase() + val.substring(1).toLowerCase();
- this.encodeExt("se:" + val, (String)null, this.NULL_ATTS);
- }
-
- Expression exp = (Literal)ce.getGammaValue();
- if (exp != null) {
- this.encodeExt("se:GammaValue", ((Literal)exp).getValue().toString());
- }
-
- this.contentHandler.endElement("", "", "se:ContrastEnhancement");
- } catch (SAXException var4) {
- throw new RuntimeException(var4);
- }
- }
- }
-
- public void visit(ImageOutline outline) {
- if (outline != null) {
- try {
- this.contentHandler.startElement("", "", "se:ImageOutline", this.NULL_ATTS);
- outline.getSymbolizer().accept(this);
- this.contentHandler.endElement("", "", "se:ImageOutline");
- } catch (SAXException var3) {
- throw new RuntimeException(var3);
- }
- }
- }
-
- public void visit(ChannelSelection cs) {
- try {
- if (cs.getGrayChannel() != null) {
- this.contentHandler.startElement("", "", "se:ChannelSelection", this.NULL_ATTS);
- SelectedChannelType gray = cs.getGrayChannel();
- this.contentHandler.startElement("", "", "se:GrayChannel", this.NULL_ATTS);
- gray.accept(this);
- this.contentHandler.endElement("", "", "se:GrayChannel");
- this.contentHandler.endElement("", "", "se:ChannelSelection");
- } else if (cs.getRGBChannels() != null && cs.getRGBChannels().length == 3 && cs.getRGBChannels()[0] != null && cs.getRGBChannels()[1] != null && cs.getRGBChannels()[2] != null) {
- this.contentHandler.startElement("", "", "se:ChannelSelection", this.NULL_ATTS);
- SelectedChannelType[] rgb = cs.getRGBChannels();
- this.contentHandler.startElement("", "", "se:RedChannel", this.NULL_ATTS);
- rgb[0].accept(this);
- this.contentHandler.endElement("", "", "se:RedChannel");
- this.contentHandler.startElement("", "", "se:GreenChannel", this.NULL_ATTS);
- rgb[1].accept(this);
- this.contentHandler.endElement("", "", "se:GreenChannel");
- this.contentHandler.startElement("", "", "se:BlueChannel", this.NULL_ATTS);
- rgb[2].accept(this);
- this.contentHandler.endElement("", "", "se:BlueChannel");
- this.contentHandler.endElement("", "", "se:ChannelSelection");
- }
-
- } catch (SAXException var3) {
- throw new RuntimeException(var3);
- }
- }
-
- public void visit(OverlapBehavior ob) {
- }
-
- public void visit(SelectedChannelType sct) {
- if (sct != null) {
- this.encodeExt("se:SourceChannelName", sct.getChannelName());
- ContrastEnhancement ce = sct.getContrastEnhancement();
- if (ce != null) {
- ce.accept(this);
- }
-
- }
- }
-
- public void visit(ShadedRelief sr) {
- if (sr != null) {
- try {
- this.contentHandler.startElement("", "", "se:ShadedRelief", this.NULL_ATTS);
- if (sr.isBrightnessOnly()) {
- this.encodeExt("se:BrightnessOnly", "true");
- } else {
- this.encodeExt("se:BrightnessOnly", "false");
- }
-
- if (sr.getReliefFactor() != null) {
- Literal l = (Literal)sr.getReliefFactor();
- this.encodeExt("se:ReliefFactor", l.getValue().toString());
- }
-
- this.contentHandler.endElement("", "", "se:ShadedRelief");
- } catch (SAXException var3) {
- throw new RuntimeException(var3);
- }
- }
- }
-
- public void visit(Description desc) {
- if (desc != null) {
- if (desc.getTitle() != null && desc.getTitle().length() > 0 || desc.getAbstract() != null && desc.getAbstract().length() > 0) {
- try {
- this.contentHandler.startElement("", "", "se:Description", this.NULL_ATTS);
- if (desc.getTitle() != null && desc.getTitle().length() > 0) {
- this.encodeExt("se:Title", desc.getTitle().toString());
- }
-
- if (desc.getAbstract() != null && desc.getAbstract().length() > 0) {
- this.encodeExt("se:Abstract", desc.getAbstract().toString());
- }
-
- this.contentHandler.endElement("", "", "se:Description");
- } catch (SAXException var3) {
- throw new RuntimeException(var3);
- }
- }
-
- }
- }
-
- void encodeDescription(String title, String abs) {
- try {
- this.contentHandler.startElement("", "", "se:Description", this.NULL_ATTS);
- if (title != null && title.length() > 0 && !title.equalsIgnoreCase("TITLE")) {
- this.encodeExt("se:Title", title);
- }
-
- if (abs != null && abs.length() > 0 && !abs.equalsIgnoreCase("ABSTRACT")) {
- this.encodeExt("se:Abstract", abs);
- }
-
- this.contentHandler.endElement("", "", "se:Description");
- } catch (SAXException var4) {
- throw new RuntimeException(var4);
- }
- }
-
- public void visit(Font font) {
- try {
- this.contentHandler.startElement("", "", "se:Font", this.NULL_ATTS);
- List familys = font.getFamily();
- if (familys != null && familys.size() > 0) {
- Iterator var4 = familys.iterator();
-
- while(var4.hasNext()) {
- Expression family = (Expression)var4.next();
- this.encodeSvgParam("font-family", family);
- }
- }
-
- this.encodeSvgParam("font-size", font.getSize());
- this.encodeSvgParam("font-style", font.getStyle());
- this.encodeSvgParam("font-weight", font.getWeight());
- this.contentHandler.endElement("", "", "se:Font");
- } catch (SAXException var5) {
- throw new RuntimeException(var5);
- }
- }
-
- void encodeOnLineResource(String olResource) {
- AttributesImpl atts = new AttributesImpl();
- atts.addAttribute("http://www.w3.org/1999/xlink", "type", "xlink:type", "", "simple");
- atts.addAttribute("http://www.w3.org/1999/xlink", "xlink", "xlink:href", "", olResource);
- this.encodeExt("se:OnlineResource", (String)null, atts);
- }
-
- void encodeOnLineResource(OnLineResource olResource) {
- AttributesImpl atts = new AttributesImpl();
- atts.addAttribute("http://www.w3.org/1999/xlink", "type", "xlink:type", "", "simple");
- atts.addAttribute("http://www.w3.org/1999/xlink", "xlink", "xlink:href", "", olResource.getLinkage().toASCIIString());
- this.encodeExt("se:OnlineResource", (String)null, atts);
- }
-
- void encodeInlineContent(Icon icon) {
- try {
- AttributesImpl atts = new AttributesImpl();
- atts.addAttribute("", "encoding", "encoding", "", "base64");
- this.contentHandler.startElement("", "", "se:InlineContent", atts);
- BufferedImage img = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), 2);
- icon.paintIcon((Component)null, img.getGraphics(), 0, 0);
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- try {
- ImageIO.write(img, "PNG", baos);
- } catch (IOException var7) {
- }
-
- byte[] dataToEncode = baos.toByteArray();
- String base64Data = Base64.encodeBytes(dataToEncode);
- this.chars(base64Data);
- this.contentHandler.endElement("", "", "se:InlineContent");
- } catch (SAXException var8) {
- throw new RuntimeException(var8);
- }
- }
-
- void encodeValue(String elementName, Attributes atts, Expression expression, Object defaultValue) {
- if (expression != null) {
- if (expression instanceof Literal && defaultValue != null) {
- Object value = expression.evaluate((Object)null, defaultValue.getClass());
- if (value != null && value.equals(defaultValue)) {
- return;
- }
- }
-
- if (atts == null) {
- atts = this.NULL_ATTS;
- }
-
- if (expression instanceof Literal) {
- this.encodeExt(elementName, (String)expression.evaluate((Object)null, String.class), atts);
- } else {
- try {
- this.contentHandler.startElement("", "", elementName, atts);
- this.filterTranslator.encode(expression);
- this.contentHandler.endElement("", "", elementName);
- } catch (SAXException var6) {
- throw new RuntimeException(var6);
- }
- }
-
- }
- }
-
- void encodeExt(String qName, String value) {
- this.encodeExt(qName, value, this.NULL_ATTS);
- }
-
- void encodeExt(String qName, String value, Attributes atts) {
- try {
- if (value == null) {
- value = "";
- }
-
- this.contentHandler.startElement("", "", qName, atts);
- this.chars(value);
- this.contentHandler.endElement("", "", qName);
- } catch (SAXException var5) {
- throw new RuntimeException(var5);
- }
- }
- }
+ static final FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
+
+ public Translator createTranslator(ContentHandler handler) {
+ TransformerBase.SchemaLocationSupport schema = new TransformerBase.SchemaLocationSupport();
+ schema.setLocation("http://www.opengis.net/sld", "StyledLayerDescriptor.xsd");
+ return (Translator)new SLDTranslator(handler, schema);
+ }
+
+ static class SLDTranslator extends TransformerBase.TranslatorSupport implements StyleVisitor {
+ FilterTransformer.FilterTranslator filterTranslator;
+
+ public SLDTranslator(ContentHandler handler, TransformerBase.SchemaLocationSupport schema) {
+ super(handler, "sld", "http://www.opengis.net/sld", schema);
+ getNamespaceSupport().declarePrefix("se", "http://www.opengis.net/se");
+ this.filterTranslator = new FilterTransformer.FilterTranslator(handler);
+ addNamespaceDeclarations((TransformerBase.TranslatorSupport)this.filterTranslator);
+ getNamespaceSupport().declarePrefix("xlink", "http://www.w3.org/1999/xlink");
+ }
+
+ boolean isNull(Expression expr) {
+ if (expr == null)
+ return true;
+ if (expr == Expression.NIL)
+ return true;
+ if (expr instanceof Literal) {
+ Literal literal = (Literal)expr;
+ return (literal.getValue() == null);
+ }
+ return false;
+ }
+
+ boolean isDefault(Expression expr, Object defaultValue) {
+ if (defaultValue == null)
+ return isNull(expr);
+ if (expr == null)
+ return false;
+ if (expr == Expression.NIL)
+ return false;
+ if (expr instanceof Literal) {
+ Literal literal = (Literal)expr;
+ if (defaultValue.equals(literal.getValue()))
+ return true;
+ if (defaultValue.toString().equals(
+ literal.getValue().toString()))
+ return true;
+ }
+ return false;
+ }
+
+ void labelContent(Expression expr) {
+ if (expr instanceof Literal) {
+ Literal literalLabel = (Literal)expr;
+ String label = (String)literalLabel.evaluate(null, String.class);
+ if (label != null)
+ if (label.matches("^\\s+.*$|^.*\\s+$|^.*\\s{2,}.*$")) {
+ cdata(label);
+ } else {
+ chars(label);
+ }
+ } else if (expr instanceof Function && (
+ "strConcat".equals(((Function)expr).getName()) || "concat"
+ .equals(((Function)expr).getName()))) {
+ List parameters = ((Function)expr).getParameters();
+ for (Expression parameter : parameters)
+ labelContent(parameter);
+ } else {
+ this.filterTranslator.encode(expr);
+ }
+ }
+
+ public void visit(PointPlacement pp) {
+ if (pp == null)
+ return;
+ try {
+ this.contentHandler.startElement("", "", "se:LabelPlacement", this.NULL_ATTS);
+ this.contentHandler.startElement("", "", "se:PointPlacement", this.NULL_ATTS);
+ visit(pp.getAnchorPoint());
+ visit(pp.getDisplacement());
+ encodeValue("se:Rotation", (Attributes)null, pp.getRotation(), (Object)null);
+ this.contentHandler.endElement("", "", "se:PointPlacement");
+ this.contentHandler.endElement("", "", "se:LabelPlacement");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(Stroke stroke) {
+ if (stroke == null)
+ return;
+ try {
+ this.contentHandler.startElement("", "", "se:Stroke", this.NULL_ATTS);
+ if (stroke.getGraphicFill() != null) {
+ this.contentHandler.startElement("", "", "se:GraphicFill", this.NULL_ATTS);
+ visit(stroke.getGraphicFill());
+ this.contentHandler.endElement("", "", "se:GraphicFill");
+ } else if (stroke.getGraphicStroke() != null) {
+ this.contentHandler.startElement("", "", "se:GraphicStroke", this.NULL_ATTS);
+ visit(stroke.getGraphicStroke());
+ encodeValue("se:InitialGap", (Attributes)null, stroke.getGraphicStroke().getInitialGap(), (Object)null);
+ encodeValue("se:Gap", (Attributes)null, stroke.getGraphicStroke().getGap(), (Object)null);
+ this.contentHandler.endElement("", "", "se:GraphicStroke");
+ }
+ encodeSvgParam("stroke", stroke.getColor());
+ encodeSvgParam("stroke-linecap", stroke.getLineCap());
+ encodeSvgParam("stroke-linejoin", stroke.getLineJoin());
+ encodeSvgParam("stroke-opacity", stroke.getOpacity());
+ encodeSvgParam("stroke-width", stroke.getWidth());
+ encodeSvgParam("stroke-dashoffset", stroke.getDashOffset());
+ float[] dash = stroke.getDashArray();
+ if (dash != null) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < dash.length; i++) {
+ sb.append(dash[i]);
+ if (i < dash.length - 1)
+ sb.append(" ");
+ }
+ encodeSvgParam("stroke-dasharray", (Expression)SLDTransformer110.ff.literal(sb.toString()));
+ }
+ this.contentHandler.endElement("", "", "se:Stroke");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(LinePlacement lp) {
+ if (lp == null)
+ return;
+ try {
+ this.contentHandler.startElement("", "", "se:LabelPlacement", this.NULL_ATTS);
+ encodeValue("se:PerpendicularOffset", (Attributes)null, lp.getPerpendicularOffset(), (Object)null);
+ if (lp.isRepeated())
+ encodeExt("se:IsRepeated", "1");
+ encodeValue("se:InitialGap", (Attributes)null, lp.getInitialGap(), (Object)null);
+ encodeValue("se:Gap", (Attributes)null, lp.getGap(), (Object)null);
+ if (lp.isAligned())
+ encodeExt("se:IsAligned", "1");
+ if (lp.isGeneralizeLine())
+ encodeExt("se:GeneralizeLine", "1");
+ this.contentHandler.endElement("", "", "se:LabelPlacement");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(AnchorPoint ap) {
+ if (ap == null)
+ return;
+ try {
+ this.contentHandler.startElement("", "", "se:AnchorPoint", this.NULL_ATTS);
+ encodeValue("se:AnchorPointX", (Attributes)null, ap.getAnchorPointX(), (Object)null);
+ encodeValue("se:AnchorPointY", (Attributes)null, ap.getAnchorPointY(), (Object)null);
+ this.contentHandler.endElement("", "", "se:AnchorPoint");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(TextSymbolizer text) {
+ if (text == null)
+ return;
+ try {
+ AttributesImpl atts = new AttributesImpl();
+ Unit uom = text.getUnitOfMeasure();
+ if (uom != null)
+ atts.addAttribute("", "uom", "uom", "", UomOgcMapping.get(uom).getSEString());
+ this.contentHandler.startElement("", "", "se:TextSymbolizer", atts);
+ if (text.getName() != null && text.getName().length() > 0)
+ encodeExt("se:Name", text.getName());
+ if (text.getDescription() != null)
+ visit(text.getDescription());
+ encodeGeometryExpression(text.getGeometry());
+ if (text.getLabel() != null) {
+ this.contentHandler.startElement("", "", "se:Label", atts);
+ labelContent(text.getLabel());
+ this.contentHandler.endElement("", "", "se:Label");
+ }
+ if (text.getFont() != null)
+ visit(text.getFont());
+ if (text.getLabelPlacement() != null)
+ text.getLabelPlacement().accept(this);
+ if (text.getHalo() != null)
+ visit(text.getHalo());
+ if (text.getFill() != null)
+ visit(text.getFill());
+ if (text.getOptions() != null)
+ encodeVendorOptions(text.getOptions());
+ this.contentHandler.endElement("", "", "se:TextSymbolizer");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(RasterSymbolizer raster) {
+ if (raster == null)
+ return;
+ try {
+ AttributesImpl atts = new AttributesImpl();
+ Unit uom = raster.getUnitOfMeasure();
+ if (uom != null)
+ atts.addAttribute("", "uom", "uom", "", UomOgcMapping.get(uom).getSEString());
+ this.contentHandler.startElement("", "", "se:RasterSymbolizer", atts);
+ encodeGeometryExpression(raster.getGeometry());
+ encodeValue("se:Opacity", (Attributes)null, raster.getOpacity(), Double.valueOf(1.0D));
+ if (raster.getChannelSelection() != null)
+ raster.getChannelSelection().accept(this);
+ if (raster.getOverlap() != null) {
+ Expression overlaps = raster.getOverlap();
+ if (overlaps instanceof PropertyName) {
+ String pn = ((PropertyName)overlaps).getPropertyName();
+ if ("RANDOM".equals(pn))
+ encodeExt("se:OverlapBehavior", pn);
+ } else {
+ encodeValue("se:OverlapBehavior", (Attributes)null, overlaps, "RANDOM");
+ }
+ }
+ ColorMap colorMap = raster.getColorMap();
+ if (colorMap != null && colorMap.getColorMapEntries() != null && (colorMap.getColorMapEntries()).length > 0)
+ colorMap.accept(this);
+ if (raster.getContrastEnhancement() != null)
+ raster.getContrastEnhancement().accept(this);
+ if (raster.getShadedRelief() != null)
+ raster.getShadedRelief().accept(this);
+ if (raster.getImageOutline() != null)
+ raster.getImageOutline().accept(this);
+ this.contentHandler.endElement("", "", "se:RasterSymbolizer");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(ColorMap colorMap) {
+ if (colorMap == null)
+ return;
+ try {
+ this.contentHandler.startElement("", "", "se:ColorMap", this.NULL_ATTS);
+ if (colorMap.getType() == 1) {
+ AttributesImpl atts = new AttributesImpl();
+ atts.addAttribute("", "fallbackValue", "fallbackValue", "", "");
+ this.contentHandler.startElement("", "", "se:Interpolate", atts);
+ encodeExt("se:LookupValue", "Raster");
+ ColorMapEntry[] mapEntries = colorMap.getColorMapEntries();
+ byte b;
+ int i;
+ ColorMapEntry[] arrayOfColorMapEntry1;
+ for (i = (arrayOfColorMapEntry1 = mapEntries).length, b = 0; b < i; ) {
+ ColorMapEntry entry = arrayOfColorMapEntry1[b];
+ this.contentHandler.startElement("", "", "se:InterpolationPoint", this.NULL_ATTS);
+ encodeValue("se:Data", this.NULL_ATTS, entry.getQuantity(), (Object)null);
+ String color = entry.getColor().toString();
+ try {
+ double opacity = Double.parseDouble(entry.getOpacity().toString());
+ int alpha = (int)(255.0D * opacity);
+ color = String.format(String.valueOf(color) + "%02x", new Object[] { Integer.valueOf(alpha) });
+ } catch (Exception e) {
+ color = String.format(String.valueOf(color) + "%02x", new Object[] { Integer.valueOf(0) });
+ }
+ encodeValue("se:Value", this.NULL_ATTS, (Expression)StyleMngr.ff.literal(color), (Object)null);
+ this.contentHandler.endElement("", "", "se:InterpolationPoint");
+ b++;
+ }
+ this.contentHandler.endElement("", "", "se:Interpolate");
+ } else {
+ String typeStr = "intervals";
+ if (colorMap.getType() == 3)
+ typeStr = "values";
+ AttributesImpl atts = new AttributesImpl();
+ atts.addAttribute("", "fallbackValue", "fallbackValue", "", "");
+ atts.addAttribute("", "type", "type", "", typeStr);
+ this.contentHandler.startElement("", "", "se:Categorize", atts);
+ encodeExt("se:LookupValue", "Raster");
+ encodeValue("se:Value", this.NULL_ATTS, (Expression)StyleMngr.ff.literal("#FFFFFFFF"), (Object)null);
+ ColorMapEntry[] mapEntries = colorMap.getColorMapEntries();
+ byte b;
+ int i;
+ ColorMapEntry[] arrayOfColorMapEntry1;
+ for (i = (arrayOfColorMapEntry1 = mapEntries).length, b = 0; b < i; ) {
+ ColorMapEntry entry = arrayOfColorMapEntry1[b];
+ String color = entry.getColor().toString();
+ try {
+ double opacity = Double.parseDouble(entry.getOpacity().toString());
+ int alpha = (int)(255.0D * opacity);
+ color = String.format(String.valueOf(color) + "%02x", new Object[] { Integer.valueOf(alpha) });
+ } catch (Exception e) {
+ color = String.format(String.valueOf(color) + "%02x", new Object[] { Integer.valueOf(0) });
+ }
+ encodeValue("se:Threshold", this.NULL_ATTS, entry.getQuantity(), (Object)null);
+ encodeValue("se:Value", this.NULL_ATTS, (Expression)StyleMngr.ff.literal(color), (Object)null);
+ b++;
+ }
+ this.contentHandler.endElement("", "", "se:Categorize");
+ }
+ this.contentHandler.endElement("", "", "se:ColorMap");
+ } catch (Exception se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(ColorMapEntry colorEntry) {}
+
+ public void visit(Symbolizer sym) {
+ try {
+ this.contentHandler.startElement("", "!--", "!--", this.NULL_ATTS);
+ chars("Unidentified Symbolizer " + sym.getClass());
+ this.contentHandler.endElement("", "--", "--");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(PolygonSymbolizer poly) {
+ try {
+ AttributesImpl atts = new AttributesImpl();
+ Unit uom = poly.getUnitOfMeasure();
+ if (uom != null)
+ atts.addAttribute("", "uom", "uom", "",
+ UomOgcMapping.get(uom).getSEString());
+ this.contentHandler.startElement("", "", "se:PolygonSymbolizer",
+ atts);
+ if (poly.getName() != null && poly.getName().length() > 0)
+ encodeExt("se:Name", poly.getName());
+ if (poly.getDescription() != null)
+ visit(poly.getDescription());
+ encodeGeometryExpression(poly.getGeometry());
+ if (poly.getFill() != null)
+ visit(poly.getFill());
+ if (poly.getStroke() != null)
+ visit(poly.getStroke());
+ if (poly.getDisplacement() != null)
+ visit(poly.getDisplacement());
+ if (poly.getPerpendicularOffset() != null)
+ encodeValue("se:PerpendicularOffset", (Attributes)null, poly.getPerpendicularOffset(), (Object)null);
+ if (poly.getOptions() != null)
+ encodeVendorOptions(poly.getOptions());
+ this.contentHandler.endElement("", "", "se:PolygonSymbolizer");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(ExternalGraphic exgr) {
+ try {
+ if (exgr.getInlineContent() != null) {
+ this.contentHandler.startElement("", "", "se:ExternalGraphic", this.NULL_ATTS);
+ encodeInlineContent(exgr.getInlineContent());
+ } else if (exgr.getOnlineResource() != null) {
+ this.contentHandler.startElement("", "", "se:ExternalGraphic", this.NULL_ATTS);
+ encodeOnLineResource(exgr.getOnlineResource());
+ } else {
+ return;
+ }
+ encodeExt("se:Format", exgr.getFormat());
+ this.contentHandler.endElement("", "", "se:ExternalGraphic");
+ } catch (Exception se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(LineSymbolizer line) {
+ try {
+ AttributesImpl atts = new AttributesImpl();
+ Unit uom = line.getUnitOfMeasure();
+ if (uom != null)
+ atts.addAttribute("", "uom", "uom", "",
+ UomOgcMapping.get(uom).getSEString());
+ this.contentHandler.startElement("", "", "se:LineSymbolizer", atts);
+ if (line.getName() != null && line.getName().length() > 0)
+ encodeExt("se:Name", line.getName());
+ if (line.getDescription() != null)
+ visit(line.getDescription());
+ encodeGeometryExpression(line.getGeometry());
+ if (line.getStroke() != null)
+ visit(line.getStroke());
+ if (line.getPerpendicularOffset() != null)
+ encodeValue("se:PerpendicularOffset", (Attributes)null, line.getPerpendicularOffset(), (Object)null);
+ if (line.getOptions() != null)
+ encodeVendorOptions(line.getOptions());
+ this.contentHandler.endElement("", "", "se:LineSymbolizer");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(Fill fill) {
+ try {
+ this.contentHandler.startElement("", "", "se:Fill", this.NULL_ATTS);
+ if (fill.getGraphicFill() != null) {
+ this.contentHandler.startElement("", "", "se:GraphicFill",
+ this.NULL_ATTS);
+ visit(fill.getGraphicFill());
+ this.contentHandler.endElement("", "", "se:GraphicFill");
+ }
+ encodeSvgParam("fill", fill.getColor());
+ encodeSvgParam("fill-opacity", fill.getOpacity());
+ this.contentHandler.endElement("", "", "se:Fill");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(Rule rule) {
+ try {
+ this.contentHandler.startElement("", "", "se:Rule", this.NULL_ATTS);
+ if (rule.getName() != null && rule.getName().length() > 0)
+ encodeExt("se:Name", rule.getName());
+ if (rule.getDescription() != null)
+ visit(rule.getDescription());
+ if (rule.getLegend() != null) {
+ this.contentHandler.startElement("", "", "se:LegendGraphic",
+ this.NULL_ATTS);
+ visit((Graphic)rule.getLegend());
+ this.contentHandler.endElement("", "", "se:LegendGraphic");
+ }
+ Filter filter = rule.getFilter();
+ if (filter != null && filter != Filter.INCLUDE)
+ visit(filter);
+ if (rule.isElseFilter())
+ encodeExt("se:ElseFilter", (String)null);
+ if (rule.getMinScaleDenominator() != 0.0D)
+ encodeExt("se:MinScaleDenominator",
+ Double.toString(rule.getMinScaleDenominator()));
+ if (rule.getMaxScaleDenominator() != Double.POSITIVE_INFINITY)
+ encodeExt("se:MaxScaleDenominator",
+ Double.toString(rule.getMaxScaleDenominator()));
+ Symbolizer[] symbols = rule.getSymbolizers();
+ byte b;
+ int i;
+ Symbolizer[] arrayOfSymbolizer1;
+ for (i = (arrayOfSymbolizer1 = symbols).length, b = 0; b < i; ) {
+ Symbolizer symbol = arrayOfSymbolizer1[b];
+ symbol.accept(this);
+ b++;
+ }
+ this.contentHandler.endElement("", "", "se:Rule");
+ } catch (Exception se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(Mark mark) {
+ try {
+ if (mark.getWellKnownName() != null) {
+ this.contentHandler.startElement("", "", "se:Mark", this.NULL_ATTS);
+ encodeValue("se:WellKnownName", (Attributes)null, mark.getWellKnownName(), (Object)null);
+ } else if (mark.getExternalMark() != null &&
+ mark.getExternalMark().getInlineContent() != null) {
+ this.contentHandler.startElement("", "", "se:Mark", this.NULL_ATTS);
+ encodeInlineContent(mark.getExternalMark().getInlineContent());
+ encodeExt("se:Format", mark.getExternalMark().getFormat());
+ if (mark.getExternalMark().getMarkIndex() != -1)
+ encodeExt("se:MarkIndex", Integer.toString(mark.getExternalMark().getMarkIndex()));
+ } else if (mark.getExternalMark() != null &&
+ mark.getExternalMark().getOnlineResource() != null) {
+ this.contentHandler.startElement("", "", "se:Mark", this.NULL_ATTS);
+ encodeOnLineResource(mark.getExternalMark().getOnlineResource());
+ encodeExt("se:Format", mark.getExternalMark().getFormat());
+ if (mark.getExternalMark().getMarkIndex() != -1)
+ encodeExt("se:MarkIndex", Integer.toString(mark.getExternalMark().getMarkIndex()));
+ } else {
+ return;
+ }
+ if (mark.getFill() != null)
+ visit(mark.getFill());
+ if (mark.getStroke() != null)
+ visit(mark.getStroke());
+ this.contentHandler.endElement("", "", "se:Mark");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(PointSymbolizer ps) {
+ try {
+ AttributesImpl atts = new AttributesImpl();
+ Unit uom = ps.getUnitOfMeasure();
+ if (uom != null)
+ atts.addAttribute("", "uom", "uom", "",
+ UomOgcMapping.get(uom).getSEString());
+ this.contentHandler.startElement("", "", "se:PointSymbolizer", atts);
+ if (ps.getName() != null && ps.getName().length() > 0)
+ encodeExt("se:Name", ps.getName());
+ if (ps.getDescription() != null)
+ visit(ps.getDescription());
+ encodeGeometryExpression(ps.getGeometry());
+ if (ps.getGraphic() != null)
+ visit(ps.getGraphic());
+ if (ps.getOptions() != null)
+ encodeVendorOptions(ps.getOptions());
+ this.contentHandler.endElement("", "", "se:PointSymbolizer");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(Halo halo) {
+ try {
+ this.contentHandler.startElement("", "", "se:Halo", this.NULL_ATTS);
+ encodeValue("se:Radius", (Attributes)null, halo.getRadius(), (Object)null);
+ if (halo.getFill() != null)
+ visit(halo.getFill());
+ this.contentHandler.endElement("", "", "se:Halo");
+ } catch (Exception se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(Graphic gr) {
+ try {
+ this.contentHandler.startElement("", "", "se:Graphic", this.NULL_ATTS);
+ for (GraphicalSymbol symbol : gr.graphicalSymbols()) {
+ if (symbol instanceof ExternalGraphic) {
+ visit((ExternalGraphic)symbol);
+ continue;
+ }
+ if (symbol instanceof Mark)
+ visit((Mark)symbol);
+ }
+ encodeValue("se:Opacity", (Attributes)null, gr.getOpacity(), (Object)null);
+ encodeValue("se:Size", (Attributes)null, gr.getSize(), (Object)null);
+ encodeValue("se:Rotation", (Attributes)null, gr.getRotation(), (Object)null);
+ if (gr.getAnchorPoint() != null)
+ visit(gr.getAnchorPoint());
+ if (gr.getDisplacement() != null)
+ visit(gr.getDisplacement());
+ this.contentHandler.endElement("", "", "se:Graphic");
+ } catch (Exception se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(StyledLayerDescriptor sld) {
+ AttributesImpl atts = new AttributesImpl();
+ atts.addAttribute("", "version", "version", "", "1.1.0");
+ start("StyledLayerDescriptor", atts);
+ if (sld.getName() != null && sld.getName().length() > 0)
+ encodeExt("se:Name", sld.getName());
+ if ((sld.getTitle() != null && sld.getTitle().length() > 0) || (
+ sld.getAbstract() != null && sld.getAbstract()
+ .length() > 0))
+ encodeDescription(sld.getTitle(), sld.getAbstract());
+ StyledLayer[] layers = sld.getStyledLayers();
+ if (layers != null && layers.length > 0) {
+ byte b;
+ int i;
+ StyledLayer[] arrayOfStyledLayer;
+ for (i = (arrayOfStyledLayer = sld.getStyledLayers()).length, b = 0; b < i; ) {
+ StyledLayer layer = arrayOfStyledLayer[b];
+ if (layer instanceof NamedLayer) {
+ visit((NamedLayer)layer);
+ } else if (layer instanceof UserLayer) {
+ visit((UserLayer)layer);
+ } else {
+ throw new IllegalArgumentException("StyledLayer '" +
+ layer.getClass().toString() + "' not found");
+ }
+ b++;
+ }
+ }
+ end("StyledLayerDescriptor");
+ }
+
+ public void visit(NamedLayer layer) {
+ start("NamedLayer");
+ encodeExt("se:Name", layer.getName());
+ FeatureTypeConstraint[] lfCons = layer.getLayerFeatureConstraints();
+ if (lfCons != null && lfCons.length > 0) {
+ start("LayerFeatureConstraints");
+ byte b;
+ int i;
+ FeatureTypeConstraint[] arrayOfFeatureTypeConstraint;
+ for (i = (arrayOfFeatureTypeConstraint = lfCons).length, b = 0; b < i; ) {
+ FeatureTypeConstraint lfc = arrayOfFeatureTypeConstraint[b];
+ visit(lfc);
+ b++;
+ }
+ end("LayerFeatureConstraints");
+ }
+ for (Style style : layer.styles())
+ visit(style);
+ end("NamedLayer");
+ }
+
+ public void visit(UserLayer layer) {
+ start("UserLayer");
+ if (layer.getName() != null && layer.getName().length() > 0)
+ encodeExt("se:Name", layer.getName());
+ DataStore inlineFDS = layer.getInlineFeatureDatastore();
+ if (inlineFDS != null) {
+ visitInlineFeatureType(inlineFDS, layer.getInlineFeatureType());
+ } else if (layer.getRemoteOWS() != null) {
+ visit(layer.getRemoteOWS());
+ }
+ start("LayerFeatureConstraints");
+ FeatureTypeConstraint[] lfc = layer.getLayerFeatureConstraints();
+ if (lfc != null && lfc.length > 0) {
+ for (int j = 0; j < lfc.length; j++)
+ visit(lfc[j]);
+ } else {
+ start("FeatureTypeConstraint");
+ end("FeatureTypeConstraint");
+ }
+ end("LayerFeatureConstraints");
+ Style[] styles = layer.getUserStyles();
+ for (int i = 0; i < styles.length; i++)
+ visit(styles[i]);
+ end("UserLayer");
+ }
+
+ private void visitInlineFeatureType(DataStore dataStore, SimpleFeatureType featureType) {
+ start("InlineFeature");
+ try {
+ String ftName = featureType.getTypeName();
+ SimpleFeatureSource fs = dataStore
+ .getFeatureSource(ftName);
+ SimpleFeatureCollection fc = fs.getFeatures();
+ FeatureTransformer ftrax = new FeatureTransformer();
+ ftrax.setCollectionNamespace(null);
+ ftrax.setCollectionPrefix(null);
+ ftrax.setGmlPrefixing(true);
+ ftrax.setIndentation(2);
+ CoordinateReferenceSystem crs = featureType
+ .getGeometryDescriptor().getCoordinateReferenceSystem();
+ String srsName = null;
+ if (crs != null) {
+ srsName = CRS.toSRS(crs, true);
+ if (srsName == null) {
+ Set ids = crs.getIdentifiers();
+ if (ids != null && !ids.isEmpty())
+ for (ReferenceIdentifier id : ids) {
+ if (id != null) {
+ srsName = String.valueOf(id);
+ break;
+ }
+ }
+ }
+ int i = -1;
+ if (srsName != null)
+ i = srsName.indexOf(':');
+ }
+ if (srsName != null)
+ ftrax.setSrsName(srsName);
+ String defaultNS = getDefaultNamespace();
+ ftrax.getFeatureTypeNamespaces().declareDefaultNamespace("",
+ defaultNS);
+ String ns = featureType.getName().getNamespaceURI();
+ if (ns != null) {
+ String prefix = this.nsSupport.getPrefix(ns);
+ if (prefix != null)
+ ftrax.getFeatureTypeNamespaces().declareNamespace(
+ (FeatureType)featureType, prefix, ns);
+ }
+ Translator t = ftrax
+ .createTranslator(this.contentHandler);
+ t.encode(fc);
+ } catch (IOException iOException) {}
+ end("InlineFeature");
+ }
+
+ public void visit(RemoteOWS remoteOWS) {
+ start("RemoteOWS");
+ element("Service", remoteOWS.getService());
+ encodeOnLineResource(remoteOWS.getOnlineResource());
+ end("RemoteOWS");
+ }
+
+ public void visit(FeatureTypeConstraint ftc) {
+ start("FeatureTypeConstraint");
+ if (ftc != null) {
+ encodeExt("se:FeatureTypeName", ftc.getFeatureTypeName());
+ visit(ftc.getFilter());
+ Extent[] extent = ftc.getExtents();
+ for (int i = 0; i < extent.length; i++)
+ visit(extent[i]);
+ }
+ end("FeatureTypeConstraint");
+ }
+
+ public void visit(Extent extent) {
+ start("Extent");
+ encodeExt("se:Name", extent.getName());
+ element("Value", extent.getValue());
+ end("Extent");
+ }
+
+ public void visit(Filter filter) {
+ try {
+ this.contentHandler.startElement("", "", "ogc:Filter", this.NULL_ATTS);
+ this.filterTranslator.encode(filter);
+ this.contentHandler.endElement("", "", "ogc:Filter");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(Style style) {
+ if (style instanceof org.geotools.styling.NamedStyle) {
+ start("NamedStyle");
+ encodeExt("se:Name", style.getName());
+ if (style.getDescription() != null)
+ visit(style.getDescription());
+ end("NamedStyle");
+ } else {
+ start("UserStyle");
+ if (style.getName() != null && style.getName().length() > 0)
+ encodeExt("se:Name", style.getName());
+ if (style.getDescription() != null)
+ visit(style.getDescription());
+ if (style.isDefault())
+ element("IsDefault", "1");
+ List ftStyles = style.featureTypeStyles();
+ if (ftStyles != null && ftStyles.size() > 0)
+ for (FeatureTypeStyle fts : ftStyles)
+ visit(fts);
+ end("UserStyle");
+ }
+ }
+
+ public void visit(FeatureTypeStyle fts) {
+ try {
+ this.contentHandler.startElement("", "", "se:FeatureTypeStyle",
+ this.NULL_ATTS);
+ if (fts.getName() != null && fts.getName().length() > 0)
+ encodeExt("se:Name", fts.getName());
+ if (fts.getDescription() != null)
+ visit(fts.getDescription());
+ Set ftNames = fts.featureTypeNames();
+ if (ftNames != null && ftNames.size() > 0)
+ encodeExt("se:FeatureTypeName", ((Name)ftNames.iterator().next()).toString());
+ Set sTypes = fts.semanticTypeIdentifiers();
+ if (sTypes != null && sTypes.size() > 0 && (
+ sTypes.size() != 1 ||
+ !((SemanticType)sTypes.iterator().next()).equals(SemanticType.ANY.toString())))
+ for (SemanticType sti : fts.semanticTypeIdentifiers()) {
+ if (sti.name() != null && sti.name().length() > 0)
+ encodeExt("se:SemanticTypeIdentifier", sti.name());
+ }
+ List rules = fts.rules();
+ if (rules != null && rules.size() > 0)
+ for (Rule rule : rules)
+ visit(rule);
+ OnLineResource olResource = fts.getOnlineResource();
+ if (olResource != null)
+ encodeOnLineResource(olResource);
+ this.contentHandler.endElement("", "", "se:FeatureTypeStyle");
+ } catch (Exception se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(Displacement dis) {
+ Expression dx = dis.getDisplacementX();
+ Expression dy = dis.getDisplacementY();
+ if (isNull(dx) && isNull(dy))
+ return;
+ if (isDefault(dx, Integer.valueOf(0)) && isDefault(dy, Integer.valueOf(0)))
+ return;
+ try {
+ this.contentHandler.startElement("", "", "se:Displacement", this.NULL_ATTS);
+ encodeValue("se:DisplacementX", (Attributes)null, dis.getDisplacementX(), (Object)null);
+ encodeValue("se:DisplacementY", (Attributes)null, dis.getDisplacementY(), (Object)null);
+ this.contentHandler.endElement("", "", "se:Displacement");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ void encodeGeometryExpression(Expression geom) {
+ if (geom == null)
+ return;
+ try {
+ this.contentHandler.startElement("", "", "se:Geometry", this.NULL_ATTS);
+ this.filterTranslator.encode(geom);
+ this.contentHandler.endElement("", "", "se:Geometry");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ void encodeSvgParam(String name, Expression expression) {
+ encodeSvgParam(name, expression, (Object)null);
+ }
+
+ void encodeSvgParam(String name, Expression expression, Object defaultValue) {
+ if (expression == null)
+ return;
+ AttributesImpl atts = new AttributesImpl();
+ atts.addAttribute("", "name", "name", "", name);
+ encodeValue("se:SvgParameter", atts, expression, defaultValue);
+ }
+
+ void encodeVendorOptions(Map options) {
+ if (options != null) {
+ Iterator it = options.keySet().iterator();
+ while (it.hasNext()) {
+ String key = it.next();
+ String value = (String)options.get(key);
+ encodeVendorOption(key, value);
+ }
+ }
+ }
+
+ void encodeVendorOption(String key, String value) {
+ AttributesImpl atts = new AttributesImpl();
+ atts.addAttribute("", "name", "name", "", key);
+ encodeExt("se:VendorOption", value, atts);
+ }
+
+ public void encode(Style[] styles) {
+ try {
+ this.contentHandler.startDocument();
+ start("StyledLayerDescriptor", this.NULL_ATTS);
+ start("NamedLayer", this.NULL_ATTS);
+ for (int i = 0, ii = styles.length; i < ii; i++)
+ styles[i].accept(this);
+ end("NamedLayer");
+ end("StyledLayerDescriptor");
+ this.contentHandler.endDocument();
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void encode(StyledLayerDescriptor sld) {
+ try {
+ this.contentHandler.startDocument();
+ sld.accept(this);
+ this.contentHandler.endDocument();
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void encode(Object o) throws IllegalArgumentException {
+ if (o instanceof StyledLayerDescriptor) {
+ encode((StyledLayerDescriptor)o);
+ } else if (o instanceof Style[]) {
+ encode((Style[])o);
+ } else {
+ Class> c = o.getClass();
+ try {
+ Method m = c.getMethod("accept",
+ new Class[] { StyleVisitor.class });
+ m.invoke(o, new Object[] { this });
+ } catch (NoSuchMethodException nsme) {
+ throw new IllegalArgumentException("Cannot encode " + o);
+ } catch (Exception e) {
+ throw new RuntimeException(
+ "Internal transformation exception", e);
+ }
+ }
+ }
+
+ public void visit(ContrastEnhancement ce) {
+ if (ce == null || ce.getMethod() == null)
+ return;
+ try {
+ this.contentHandler.startElement("", "", "se:ContrastEnhancement", this.NULL_ATTS);
+ ContrastMethod method = ce.getMethod();
+ if (method != null && !ContrastMethod.NONE.equals(method)) {
+ String val = method.name();
+ val = String.valueOf(val.substring(0, 1).toUpperCase()) + val.substring(1).toLowerCase();
+ encodeExt("se:" + val, (String)null, this.NULL_ATTS);
+ }
+ Literal literal = (Literal)ce.getGammaValue();
+ if (literal != null)
+ encodeExt("se:GammaValue", literal.getValue().toString());
+ this.contentHandler.endElement("", "", "se:ContrastEnhancement");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(ImageOutline outline) {
+ if (outline == null)
+ return;
+ try {
+ this.contentHandler.startElement("", "", "se:ImageOutline", this.NULL_ATTS);
+ outline.getSymbolizer().accept(this);
+ this.contentHandler.endElement("", "", "se:ImageOutline");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(ChannelSelection cs) {
+ try {
+ if (cs.getGrayChannel() != null) {
+ this.contentHandler.startElement("", "", "se:ChannelSelection", this.NULL_ATTS);
+ SelectedChannelType gray = cs.getGrayChannel();
+ this.contentHandler.startElement("", "", "se:GrayChannel", this.NULL_ATTS);
+ gray.accept(this);
+ this.contentHandler.endElement("", "", "se:GrayChannel");
+ this.contentHandler.endElement("", "", "se:ChannelSelection");
+ } else if (cs.getRGBChannels() != null && (cs.getRGBChannels()).length == 3 && cs.getRGBChannels()[0] != null && cs.getRGBChannels()[1] != null && cs.getRGBChannels()[2] != null) {
+ this.contentHandler.startElement("", "", "se:ChannelSelection", this.NULL_ATTS);
+ SelectedChannelType[] rgb = cs.getRGBChannels();
+ this.contentHandler.startElement("", "", "se:RedChannel", this.NULL_ATTS);
+ rgb[0].accept(this);
+ this.contentHandler.endElement("", "", "se:RedChannel");
+ this.contentHandler.startElement("", "", "se:GreenChannel", this.NULL_ATTS);
+ rgb[1].accept(this);
+ this.contentHandler.endElement("", "", "se:GreenChannel");
+ this.contentHandler.startElement("", "", "se:BlueChannel", this.NULL_ATTS);
+ rgb[2].accept(this);
+ this.contentHandler.endElement("", "", "se:BlueChannel");
+ this.contentHandler.endElement("", "", "se:ChannelSelection");
+ }
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(OverlapBehavior ob) {}
+
+ public void visit(SelectedChannelType sct) {
+ if (sct == null)
+ return;
+ encodeExt("se:SourceChannelName", sct.getChannelName());
+ ContrastEnhancement ce = sct.getContrastEnhancement();
+ if (ce != null)
+ ce.accept(this);
+ }
+
+ public void visit(ShadedRelief sr) {
+ if (sr == null)
+ return;
+ try {
+ this.contentHandler.startElement("", "", "se:ShadedRelief", this.NULL_ATTS);
+ if (sr.isBrightnessOnly()) {
+ encodeExt("se:BrightnessOnly", "true");
+ } else {
+ encodeExt("se:BrightnessOnly", "false");
+ }
+ if (sr.getReliefFactor() != null) {
+ Literal l = (Literal)sr.getReliefFactor();
+ encodeExt("se:ReliefFactor", l.getValue().toString());
+ }
+ this.contentHandler.endElement("", "", "se:ShadedRelief");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(Description desc) {
+ if (desc == null)
+ return;
+ if ((desc.getTitle() != null && desc.getTitle().length() > 0) || (
+ desc.getAbstract() != null && desc.getAbstract()
+ .length() > 0))
+ try {
+ this.contentHandler.startElement("", "", "se:Description",
+ this.NULL_ATTS);
+ if (desc.getTitle() != null &&
+ desc.getTitle().length() > 0)
+ encodeExt("se:Title", desc.getTitle().toString());
+ if (desc.getAbstract() != null &&
+ desc.getAbstract().length() > 0)
+ encodeExt("se:Abstract", desc.getAbstract().toString());
+ this.contentHandler.endElement("", "", "se:Description");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ void encodeDescription(String title, String abs) {
+ try {
+ this.contentHandler
+ .startElement("", "", "se:Description", this.NULL_ATTS);
+ if (title != null && title.length() > 0 &&
+ !title.equalsIgnoreCase("TITLE"))
+ encodeExt("se:Title", title);
+ if (abs != null && abs.length() > 0 &&
+ !abs.equalsIgnoreCase("ABSTRACT"))
+ encodeExt("se:Abstract", abs);
+ this.contentHandler.endElement("", "", "se:Description");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ public void visit(Font font) {
+ try {
+ this.contentHandler.startElement("", "", "se:Font", this.NULL_ATTS);
+ List familys = font.getFamily();
+ if (familys != null && familys.size() > 0)
+ for (Expression family : familys)
+ encodeSvgParam("font-family", family);
+ encodeSvgParam("font-size", font.getSize());
+ encodeSvgParam("font-style", font.getStyle());
+ encodeSvgParam("font-weight", font.getWeight());
+ this.contentHandler.endElement("", "", "se:Font");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ void encodeOnLineResource(String olResource) {
+ AttributesImpl atts = new AttributesImpl();
+ atts.addAttribute("http://www.w3.org/1999/xlink", "type", "xlink:type", "",
+ "simple");
+ atts.addAttribute("http://www.w3.org/1999/xlink", "xlink", "xlink:href", "",
+ olResource);
+ encodeExt("se:OnlineResource", (String)null, atts);
+ }
+
+ void encodeOnLineResource(OnLineResource olResource) {
+ AttributesImpl atts = new AttributesImpl();
+ atts.addAttribute("http://www.w3.org/1999/xlink", "type", "xlink:type", "",
+ "simple");
+ atts.addAttribute("http://www.w3.org/1999/xlink", "xlink", "xlink:href", "",
+ olResource.getLinkage().toASCIIString());
+ encodeExt("se:OnlineResource", (String)null, atts);
+ }
+
+ void encodeInlineContent(Icon icon) {
+ try {
+ AttributesImpl atts = new AttributesImpl();
+ atts.addAttribute("", "encoding", "encoding", "", "base64");
+ this.contentHandler.startElement("", "", "se:InlineContent", atts);
+ BufferedImage img = new BufferedImage(icon.getIconWidth(),
+ icon.getIconHeight(), 2);
+ icon.paintIcon(null, img.getGraphics(), 0, 0);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ try {
+ ImageIO.write(img, "PNG", baos);
+ } catch (IOException iOException) {}
+ byte[] dataToEncode = baos.toByteArray();
+ String base64Data = Base64.encodeBytes(dataToEncode);
+ chars(base64Data);
+ this.contentHandler.endElement("", "", "se:InlineContent");
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+
+ void encodeValue(String elementName, Attributes atts, Expression expression, Object defaultValue) {
+ if (expression == null)
+ return;
+ if (expression instanceof Literal && defaultValue != null) {
+ Object value = expression.evaluate(null,
+ defaultValue.getClass());
+ if (value != null && value.equals(defaultValue))
+ return;
+ }
+ if (atts == null)
+ atts = this.NULL_ATTS;
+ if (expression instanceof Literal) {
+ encodeExt(elementName, (String)expression.evaluate(null, String.class),
+ atts);
+ } else {
+ try {
+ this.contentHandler.startElement("", "", elementName, atts);
+ this.filterTranslator.encode(expression);
+ this.contentHandler.endElement("", "", elementName);
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+ }
+
+ void encodeExt(String qName, String value) {
+ encodeExt(qName, value, this.NULL_ATTS);
+ }
+
+ void encodeExt(String qName, String value, Attributes atts) {
+ try {
+ if (value == null)
+ value = "";
+ this.contentHandler.startElement("", "", qName, atts);
+ chars(value);
+ this.contentHandler.endElement("", "", qName);
+ } catch (SAXException se) {
+ throw new RuntimeException(se);
+ }
+ }
+ }
}
diff --git a/src/main/java/com/geotwo/webserver/core/tile/wmts/TileMatrixRule.java b/src/main/java/com/geotwo/webserver/core/tile/wmts/TileMatrixRule.java
index 12ee441..f6869ce 100644
--- a/src/main/java/com/geotwo/webserver/core/tile/wmts/TileMatrixRule.java
+++ b/src/main/java/com/geotwo/webserver/core/tile/wmts/TileMatrixRule.java
@@ -1,78 +1,81 @@
package com.geotwo.webserver.core.tile.wmts;
+import com.geotwo.webserver.core.tile.wmts.TileMatrix;
import java.io.File;
public class TileMatrixRule {
- public enum RuleType {
- COLUMN_FIRST, ROW_FIRST, GWC;
- }
-
- public static String createPath(TileMatrix matrix, int col, int row, String format) {
- StringBuffer path;
- long shift;
- long half;
- int digits;
- long halfx;
- long halfy;
- if (!matrix.isTopLeft())
- row = matrix.getMatrixHeight() - 1 - row;
- switch (matrix.getRule()) {
- case null:
- return String.valueOf(matrix.getIdentifier()) + File.separatorChar + col + File.separatorChar + row + "." + format;
- case ROW_FIRST:
- return String.valueOf(matrix.getIdentifier()) + File.separatorChar + row + File.separatorChar + col + "." + format;
- case GWC:
- path = new StringBuffer();
- path.append(matrix.getIdentifier());
- path.append(File.separatorChar);
- shift = (matrix.getLevel() / 2);
- half = (2 << (int)shift);
- digits = 1;
- if (half > 10L)
- digits = (int)Math.log10(half) + 1;
- halfx = col / half;
- halfy = row / half;
- zeroPadder(halfx, digits, path);
- path.append('_');
- zeroPadder(halfy, digits, path);
- path.append(File.separatorChar);
- zeroPadder(col, 2 * digits, path);
- path.append('_');
- zeroPadder(row, 2 * digits, path);
- path.append('.');
- path.append(format);
- return path.toString();
- }
- return null;
- }
-
- public static RuleType getRuleType(String rule) {
- if (rule.equalsIgnoreCase("COLUMN") || rule.equalsIgnoreCase("COL") || rule.equalsIgnoreCase("C") || rule.equalsIgnoreCase("X"))
- return RuleType.COLUMN_FIRST;
- if (rule.equalsIgnoreCase("ROW") || rule.equalsIgnoreCase("R") || rule.equalsIgnoreCase("Y"))
- return RuleType.ROW_FIRST;
- if (rule.equalsIgnoreCase("GWC") || rule.equalsIgnoreCase("G") || rule.equalsIgnoreCase("GEOWEBCACHE"))
- return RuleType.GWC;
- return null;
- }
-
- public static void zeroPadder(long number, int order, StringBuffer padding) {
- int numberOrder = 1;
- if (number > 9L)
- if (number > 11L) {
- numberOrder = (int)Math.ceil(Math.log10(number) - 0.001D);
- } else {
- numberOrder = 2;
- }
- int diffOrder = order - numberOrder;
- if (diffOrder > 0) {
- while (diffOrder > 0) {
- padding.append('0');
- diffOrder--;
- }
- padding.append(number);
- } else {
- padding.append(number);
- }
- }
-}
+ public static String createPath(TileMatrix matrix, int col, int row, String format) {
+ if (!matrix.isTopLeft()) {
+ row = matrix.getMatrixHeight() - 1 - row;
+ }
+ switch (matrix.getRule()) {
+ case COLUMN_FIRST: {
+ return String.valueOf(matrix.getIdentifier()) + File.separatorChar + col + File.separatorChar + row + "." + format;
+ }
+ case ROW_FIRST: {
+ return String.valueOf(matrix.getIdentifier()) + File.separatorChar + row + File.separatorChar + col + "." + format;
+ }
+ case GWC: {
+ StringBuffer path = new StringBuffer();
+ path.append(matrix.getIdentifier());
+ path.append(File.separatorChar);
+ long shift = matrix.getLevel() / 2;
+ long half = 2 << (int)shift;
+ int digits = 1;
+ if (half > 10L) {
+ digits = (int)Math.log10(half) + 1;
+ }
+ long halfx = (long)col / half;
+ long halfy = (long)row / half;
+ TileMatrixRule.zeroPadder(halfx, digits, path);
+ path.append('_');
+ TileMatrixRule.zeroPadder(halfy, digits, path);
+ path.append(File.separatorChar);
+ TileMatrixRule.zeroPadder(col, 2 * digits, path);
+ path.append('_');
+ TileMatrixRule.zeroPadder(row, 2 * digits, path);
+ path.append('.');
+ path.append(format);
+ return path.toString();
+ }
+ }
+ return null;
+ }
+
+ public static RuleType getRuleType(String rule) {
+ if (rule.equalsIgnoreCase("COLUMN") || rule.equalsIgnoreCase("COL") || rule.equalsIgnoreCase("C") || rule.equalsIgnoreCase("X")) {
+ return RuleType.COLUMN_FIRST;
+ }
+ if (rule.equalsIgnoreCase("ROW") || rule.equalsIgnoreCase("R") || rule.equalsIgnoreCase("Y")) {
+ return RuleType.ROW_FIRST;
+ }
+ if (rule.equalsIgnoreCase("GWC") || rule.equalsIgnoreCase("G") || rule.equalsIgnoreCase("GEOWEBCACHE")) {
+ return RuleType.GWC;
+ }
+ return null;
+ }
+
+ public static void zeroPadder(long number, int order, StringBuffer padding) {
+ int diffOrder;
+ int numberOrder = 1;
+ if (number > 9L) {
+ numberOrder = number > 11L ? (int)Math.ceil(Math.log10(number) - 0.001) : 2;
+ }
+ if ((diffOrder = order - numberOrder) > 0) {
+ while (diffOrder > 0) {
+ padding.append('0');
+ --diffOrder;
+ }
+ padding.append(number);
+ } else {
+ padding.append(number);
+ }
+ }
+
+ public static enum RuleType {
+ COLUMN_FIRST,
+ ROW_FIRST,
+ GWC;
+
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/geotwo/webserver/core/vector/geowave/GeoWaveFeatureSource.java b/src/main/java/com/geotwo/webserver/core/vector/geowave/GeoWaveFeatureSource.java
index c5bc4cf..8d5972a 100644
--- a/src/main/java/com/geotwo/webserver/core/vector/geowave/GeoWaveFeatureSource.java
+++ b/src/main/java/com/geotwo/webserver/core/vector/geowave/GeoWaveFeatureSource.java
@@ -222,7 +222,7 @@ public class GeoWaveFeatureSource extends ContentFeatureSource {
protected FeatureReader getReaderInternal(Query query) throws IOException {
FeatureReader reader;
- ReTypeFeatureReader reTypeFeatureReader;
+ ReTypeFeatureReader reTypeFeatureReader = null;
Filter[] split = splitFilter(query.getFilter());
Filter preFilter = split[0];
Filter postFilter = split[1];
diff --git a/src/main/java/com/geotwo/webserver/core/vector/jdbc/ns/NonSpatialDialect.java b/src/main/java/com/geotwo/webserver/core/vector/jdbc/ns/NonSpatialDialect.java
index a87782c..3f10b5e 100644
--- a/src/main/java/com/geotwo/webserver/core/vector/jdbc/ns/NonSpatialDialect.java
+++ b/src/main/java/com/geotwo/webserver/core/vector/jdbc/ns/NonSpatialDialect.java
@@ -414,7 +414,7 @@ public class NonSpatialDialect extends PreparedStatementSQLDialect implements O2
public void setGeometryValue(Geometry g, int dimension, int srid, Class binding, PreparedStatement ps, int column) throws SQLException {
if (g != null) {
- LineString lineString;
+ LineString lineString = null;
if (g instanceof LinearRing)
lineString = g.getFactory().createLineString(((LinearRing)g).getCoordinateSequence());
WKBWriter wkbWriter = new WKBWriter(dimension);
diff --git a/src/main/java/com/geotwo/webserver/core/vector/jdbc/oracle/sdo/SDO.java b/src/main/java/com/geotwo/webserver/core/vector/jdbc/oracle/sdo/SDO.java
index 2206d08..1cca4a5 100644
--- a/src/main/java/com/geotwo/webserver/core/vector/jdbc/oracle/sdo/SDO.java
+++ b/src/main/java/com/geotwo/webserver/core/vector/jdbc/oracle/sdo/SDO.java
@@ -1201,7 +1201,7 @@ public final class SDO {
List list = new LinkedList();
for (int i = triplet; i < endTriplet; i++) {
LineString lineString;
- Polygon polygon;
+ Polygon polygon = null;
int etype = ETYPE(elemInfo, i);
int interpretation = INTERPRETATION(elemInfo, i);
switch (etype) {
diff --git a/src/main/java/com/geotwo/webserver/core/vector/jdbc/simple/SimpleDialect.java b/src/main/java/com/geotwo/webserver/core/vector/jdbc/simple/SimpleDialect.java
index 34b27ce..312eafe 100644
--- a/src/main/java/com/geotwo/webserver/core/vector/jdbc/simple/SimpleDialect.java
+++ b/src/main/java/com/geotwo/webserver/core/vector/jdbc/simple/SimpleDialect.java
@@ -373,7 +373,7 @@ public class SimpleDialect extends PreparedStatementSQLDialect implements O2SqlD
public void setGeometryValue(Geometry g, int dimension, int srid, Class binding, PreparedStatement ps, int column) throws SQLException {
if (g != null) {
- LineString lineString;
+ LineString lineString = null;
if (g instanceof LinearRing)
lineString = g.getFactory().createLineString(((LinearRing)g).getCoordinateSequence());
WKBWriter wkbWriter = new WKBWriter(dimension);
diff --git a/src/main/java/com/geotwo/webserver/core/vector/jdbc/simple/SimpleFilterToSQL.java b/src/main/java/com/geotwo/webserver/core/vector/jdbc/simple/SimpleFilterToSQL.java
index b15113a..c12db0f 100644
--- a/src/main/java/com/geotwo/webserver/core/vector/jdbc/simple/SimpleFilterToSQL.java
+++ b/src/main/java/com/geotwo/webserver/core/vector/jdbc/simple/SimpleFilterToSQL.java
@@ -2,9 +2,11 @@ package com.geotwo.webserver.core.vector.jdbc.simple;
import com.geotwo.webserver.core.ServerContext;
import com.geotwo.webserver.core.log.LogMngr;
+import com.geotwo.webserver.core.map.layer.FeatureLayer;
import com.geotwo.webserver.core.map.layer.Layer;
import com.geotwo.webserver.core.util.ServerUtil;
import com.geotwo.webserver.core.vector.crs.CRSMngr;
+import com.geotwo.webserver.core.vector.jdbc.simple.SimpleDialect;
import com.vividsolutions.jts.geom.Envelope;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.Polygon;
@@ -25,138 +27,153 @@ import org.opengis.geometry.BoundingBox;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.TransformException;
-public class SimpleFilterToSQL extends PreparedFilterToSQL {
- private SimpleDialect dsDialect;
-
- public SimpleFilterToSQL(SimpleDialect dialect) {
- this.dsDialect = dialect;
- }
-
- protected FilterCapabilities createFilterCapabilities() {
- FilterCapabilities caps = new FilterCapabilities();
- caps.addAll(SQLDialect.BASE_DBMS_CAPABILITIES);
- caps.addType(BBOX.class);
- return caps;
- }
-
- protected Object visitBinarySpatialOperator(BinarySpatialOperator filter, PropertyName property, Literal geometry, boolean swapped, Object extraData) {
- try {
- if (filter instanceof BBOX) {
- BBOX bbox = (BBOX)filter;
- ReferencedEnvelope referencedEnvelope = ReferencedEnvelope.reference(bbox.getBounds());
- Envelope envelope = intersectionBound((Envelope)referencedEnvelope);
- if (envelope == null || envelope.isNull()) {
- this.out.append(" 1=0 ");
- LogMngr.getInstance().logDebug("[DB]", "WHERE : " + this.out.toString());
- return extraData;
- }
- String bboxSQL = this.dsDialect.simpleSQL.getSqlBBox();
+public class SimpleFilterToSQL
+extends PreparedFilterToSQL {
+ private SimpleDialect dsDialect;
+
+ public SimpleFilterToSQL(SimpleDialect dialect) {
+ this.dsDialect = dialect;
+ }
+
+ protected FilterCapabilities createFilterCapabilities() {
+ FilterCapabilities caps = new FilterCapabilities();
+ caps.addAll(SQLDialect.BASE_DBMS_CAPABILITIES);
+ caps.addType(BBOX.class);
+ return caps;
+ }
+
+ protected Object visitBinarySpatialOperator(BinarySpatialOperator filter, PropertyName property, Literal geometry, boolean swapped, Object extraData) {
+ try {
+ Envelope envelop;
+ if (filter instanceof BBOX) {
+ BBOX bbox = (BBOX)filter;
+ envelop = ReferencedEnvelope.reference((BoundingBox)bbox.getBounds());
+ if ((envelop = this.intersectionBound((Envelope)envelop)) == null || envelop.isNull()) {
+ this.out.append(" 1=0 ");
+ LogMngr.getInstance().logDebug("[DB]", "WHERE : " + this.out.toString());
+ return extraData;
+ }
+ } else {
+ throw new RuntimeException("Unsupported filter type " + filter.getClass());
+ }
+ String bboxSQL = this.dsDialect.simpleSQL.getSqlBBox();
+ this.dsDialect.simpleSQL.getClass();
+ bboxSQL = ServerUtil.replaceFirst((String)bboxSQL, (String)"?GEOMETRY?", (String)this.findPropertyName(property));
+ this.dsDialect.simpleSQL.getClass();
+ bboxSQL = ServerUtil.replaceFirst((String)bboxSQL, (String)"?GEOMETRY?", (String)this.setLiteralBBox(bboxSQL, (Envelope)envelop, extraData));
+ this.out.append(bboxSQL);
+ LogMngr.getInstance().logDebug("[DB]", "WHERE : " + this.out.toString());
+ }
+ catch (Exception e) {
+ throw new RuntimeException("Fail to create Filter SQL", e);
+ }
+ return extraData;
+ }
+
+ public String findPropertyName(PropertyName expression) {
+ StringBuffer sb = new StringBuffer();
+ if (expression instanceof JoinPropertyName) {
+ sb.append(this.escapeName(((JoinPropertyName)expression).getAlias()));
+ sb.append(".");
+ }
+ AttributeDescriptor attribute = null;
+ try {
+ attribute = (AttributeDescriptor)expression.evaluate((Object)this.featureType);
+ }
+ catch (Exception exception) {
+ // empty catch block
+ }
+ String encodedField = attribute != null ? this.fieldEncoder.encode(this.escapeName(attribute.getLocalName())) : this.fieldEncoder.encode(this.escapeName(expression.getPropertyName()));
+ sb.append(encodedField);
+ return sb.toString();
+ }
+
+ public String setLiteralBBox(String bboxSQL, Envelope envelope, Object context) {
+ Geometry polygon = JTS.toGeometry((Envelope)envelope);
+ if (!polygon.isValid()) {
+ polygon = polygon.buffer(1.0E-5);
+ }
+ this.literalValues.add(polygon);
+ this.dimensions.add(this.currentDimension);
+ polygon.setSRID(this.currentSRID.intValue());
+ this.SRIDs.add(this.currentSRID);
+ Class> clazz = null;
+ if (context instanceof Class) {
+ clazz = (Class>)context;
+ } else if (polygon != null) {
+ clazz = polygon.getClass();
+ }
+ this.literalTypes.add(clazz);
+ StringBuffer sb = new StringBuffer();
+ if (polygon == null || this.dialect == null) {
+ sb.append("?");
+ } else if (Geometry.class.isAssignableFrom(polygon.getClass())) {
+ int srid = this.currentSRID != null ? this.currentSRID : -1;
+ int dimension = this.currentDimension != null ? this.currentDimension : -1;
+ this.dialect.prepareGeometryValue((Geometry)polygon, dimension, srid, Geometry.class, sb);
+ } else if (this.encodingFunction) {
+ this.dialect.prepareFunctionArgument(clazz, sb);
+ } else {
+ sb.append("?");
+ }
+ String string = this.dsDialect.simpleSQL.getGeomFromWKB();
this.dsDialect.simpleSQL.getClass();
- bboxSQL = ServerUtil.replaceFirst(bboxSQL, "?GEOMETRY?", findPropertyName(property));
+ String resultStr = ServerUtil.replaceFirst((String)string, (String)"?WKB?", (String)sb.toString());
this.dsDialect.simpleSQL.getClass();
- bboxSQL = ServerUtil.replaceFirst(bboxSQL, "?GEOMETRY?", setLiteralBBox(bboxSQL, envelope, extraData));
- this.out.append(bboxSQL);
- LogMngr.getInstance().logDebug("[DB]", "WHERE : " + this.out.toString());
- } else {
- throw new RuntimeException("Unsupported filter type " + filter.getClass());
- }
- } catch (Exception e) {
- throw new RuntimeException("Fail to create Filter SQL", e);
- }
- return extraData;
- }
-
- public String findPropertyName(PropertyName expression) {
- String encodedField;
- StringBuffer sb = new StringBuffer();
- if (expression instanceof JoinPropertyName) {
- sb.append(escapeName(((JoinPropertyName)expression).getAlias()));
- sb.append(".");
- }
- AttributeDescriptor attribute = null;
- try {
- attribute = (AttributeDescriptor)expression.evaluate(this.featureType);
- } catch (Exception exception) {}
- if (attribute != null) {
- encodedField = this.fieldEncoder.encode(escapeName(attribute.getLocalName()));
- } else {
- encodedField = this.fieldEncoder.encode(escapeName(expression.getPropertyName()));
- }
- sb.append(encodedField);
- return sb.toString();
- }
-
- public String setLiteralBBox(String bboxSQL, Envelope envelope, Object context) {
- Geometry geometry;
- Polygon polygon = JTS.toGeometry(envelope);
- if (!polygon.isValid())
- geometry = polygon.buffer(1.0E-5D);
- this.literalValues.add(geometry);
- this.dimensions.add(this.currentDimension);
- geometry.setSRID(this.currentSRID.intValue());
- this.SRIDs.add(this.currentSRID);
- Class> clazz = null;
- if (context instanceof Class) {
- clazz = (Class)context;
- } else if (geometry != null) {
- clazz = geometry.getClass();
- }
- this.literalTypes.add(clazz);
- StringBuffer sb = new StringBuffer();
- if (geometry == null || this.dialect == null) {
- sb.append("?");
- } else if (Geometry.class.isAssignableFrom(geometry.getClass())) {
- int srid = (this.currentSRID != null) ? this.currentSRID.intValue() : -1;
- int dimension = (this.currentDimension != null) ? this.currentDimension.intValue() : -1;
- this.dialect.prepareGeometryValue(geometry, dimension, srid, Geometry.class, sb);
- } else if (this.encodingFunction) {
- this.dialect.prepareFunctionArgument(clazz, sb);
- } else {
- sb.append("?");
- }
- this.dsDialect.simpleSQL.getClass();
- String resultStr = ServerUtil.replaceFirst(this.dsDialect.simpleSQL.getGeomFromWKB(), "?WKB?", sb.toString());
- this.dsDialect.simpleSQL.getClass();
- return ServerUtil.replaceFirst(resultStr, "?SRID?", (String)this.currentSRID);
- }
-
- private Envelope intersectionBound(Envelope envelop) {
- try {
- ArrayList layers = ServerContext.getMap().getAllLayers();
- for (Layer layer : layers) {
- if (!(layer instanceof com.geotwo.webserver.core.map.layer.FeatureLayer))
- continue;
- if (layer.getServerName().equalsIgnoreCase(this.dsDialect.serverName) &&
- layer.getSourceName().equalsIgnoreCase(this.featureType.getTypeName()))
- return layer.getBBox().intersection(envelop);
- }
- } catch (Exception exception) {}
- return envelop;
- }
-
- private BoundingBox transformFilter(BoundingBox bound) {
- if (bound.getCoordinateReferenceSystem() == null)
- return bound;
- try {
- CoordinateReferenceSystem targetCRS = getCRS(this.featureType.getTypeName());
- if (!CRS.equalsIgnoreMetadata(targetCRS, bound.getCoordinateReferenceSystem()))
- return bound.toBounds(targetCRS);
- } catch (TransformException e) {
- e.printStackTrace();
- }
- return bound;
- }
-
- private CoordinateReferenceSystem getCRS(String typeName) {
- try {
- ArrayList layers = ServerContext.getMap().getAllLayers();
- for (Layer layer : layers) {
- if (!(layer instanceof com.geotwo.webserver.core.map.layer.FeatureLayer))
- continue;
- if (layer.getSourceName().equalsIgnoreCase(typeName))
- return layer.getCRS();
- }
- } catch (Exception exception) {}
- return CRSMngr.getCRS(Integer.valueOf(4326));
- }
-}
+ return ServerUtil.replaceFirst((String)resultStr, (String)"?SRID?", (String)("" + this.currentSRID));
+ }
+
+ private Envelope intersectionBound(Envelope envelop) {
+ try {
+ ArrayList layers = ServerContext.getMap().getAllLayers();
+ for (Object obj : layers) {
+
+ Layer layer = null;
+ if (obj instanceof Layer) {
+ layer = (Layer)obj;
+ }
+ if (!(obj instanceof FeatureLayer) || !layer.getServerName().equalsIgnoreCase(this.dsDialect.serverName) || !layer.getSourceName().equalsIgnoreCase(this.featureType.getTypeName())) continue;
+ return layer.getBBox().intersection(envelop);
+ }
+ }
+ catch (Exception exception) {
+ // empty catch block
+ }
+ return envelop;
+ }
+
+ private BoundingBox transformFilter(BoundingBox bound) {
+ if (bound.getCoordinateReferenceSystem() == null) {
+ return bound;
+ }
+ try {
+ CoordinateReferenceSystem targetCRS = this.getCRS(this.featureType.getTypeName());
+ if (!CRS.equalsIgnoreMetadata((Object)targetCRS, (Object)bound.getCoordinateReferenceSystem())) {
+ return bound.toBounds(targetCRS);
+ }
+ }
+ catch (TransformException e) {
+ e.printStackTrace();
+ }
+ return bound;
+ }
+
+ private CoordinateReferenceSystem getCRS(String typeName) {
+ try {
+ ArrayList layers = ServerContext.getMap().getAllLayers();
+ for (Object obj : layers) {
+
+ Layer layer = null;
+ if (obj instanceof Layer) {
+ layer = (Layer)obj;
+ }
+ if (!(layer instanceof FeatureLayer) || !layer.getSourceName().equalsIgnoreCase(typeName)) continue;
+ return layer.getCRS();
+ }
+ }
+ catch (Exception exception) {
+ // empty catch block
+ }
+ return CRSMngr.getCRS((Integer)4326);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/geotwo/webserver/plugin/ows/wms/wms130/WMSGetCapabilities.java b/src/main/java/com/geotwo/webserver/plugin/ows/wms/wms130/WMSGetCapabilities.java
index 276c8b2..086ffd9 100644
--- a/src/main/java/com/geotwo/webserver/plugin/ows/wms/wms130/WMSGetCapabilities.java
+++ b/src/main/java/com/geotwo/webserver/plugin/ows/wms/wms130/WMSGetCapabilities.java
@@ -233,7 +233,7 @@ public class WMSGetCapabilities {
for (int k = 0; k < this.layerList.size(); k++) {
Layer layer = this.layerList.get(k);
if (layer != null) {
- BoundingBox boundingBox;
+ BoundingBox boundingBox = null;
Element layerElement1 = this.doc.createElementNS(this.support.getURI("wms"), "Layer");
layerElement.appendChild(layerElement1);
Element nameElement1 = this.doc.createElementNS(this.support.getURI("wms"), "Name");
@@ -279,7 +279,7 @@ public class WMSGetCapabilities {
}
private Map GetTotalLayerInfo() throws TransformException, FactoryException {
- ReferencedEnvelope referencedEnvelope1;
+ ReferencedEnvelope referencedEnvelope1 = null;
Map totalLayerInfo = new HashMap();
List crsList = new ArrayList();
Map> map = new HashMap>();
diff --git a/src/main/java/com/geotwo/webserver/plugin/ows/wms/wms130/WMSGetLegendGraphic.java b/src/main/java/com/geotwo/webserver/plugin/ows/wms/wms130/WMSGetLegendGraphic.java
index ba93c09..2490bad 100644
--- a/src/main/java/com/geotwo/webserver/plugin/ows/wms/wms130/WMSGetLegendGraphic.java
+++ b/src/main/java/com/geotwo/webserver/plugin/ows/wms/wms130/WMSGetLegendGraphic.java
@@ -62,7 +62,7 @@ public class WMSGetLegendGraphic {
}
private void writeImage(BufferedImage image, HttpServletResponse resp) throws Exception {
- ServletOutputStream servletOutputStream;
+ ServletOutputStream servletOutputStream = null;
OutputStream out = null;
try {
String format = this.requestObj.getFormat();
diff --git a/src/main/resources/egovframework/egovProps/geoinfoWeb.properties b/src/main/resources/egovframework/egovProps/geoinfoWeb.properties
deleted file mode 100644
index 464814f..0000000
--- a/src/main/resources/egovframework/egovProps/geoinfoWeb.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-GlobalsWeb.WebSystemTitle = ::\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\u0537\u00bd\u00fd\ufffd\ufffd\ufffd::
-GlobalsWeb.WebManageSystemTitle = ::\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\u00fd\ufffd\ufffd\ufffd::
-#GlobalsWeb.WebXmlPath = D:\\Tomcat6\\webapps\\geoinfo\\web\\grid\\DataXml
-#GlobalsWeb.WebImagePath = D:\\Tomcat6\\webapps\\geoinfo\\web\\file
-#GlobalsWeb.WebSupplyPath = D:\\Tomcat6\\webapps\\geoinfo\\web\\supply
-GlobalsWeb.WebXmlPath = D:\\src\\geoinfo_integration\\WebContent\\web\\grid\\DataXml\\
-GlobalsWeb.WebImagePath = D:\\egov_geoinfo\\eGovFrameDev-3.5.1-64bit\\workspace\\geoinfo_eGov\\src\\main\\webapp\\web\\file\\
-GlobalsWeb.WebSupplyPath = D:\\egov_geoinfo\\eGovFrameDev-3.5.1-64bit\\workspace\\geoinfo_eGov\\src\\main\\webapp\\web\\supply\\
-GlobalsWeb.WebSupplyServer = localhost
-GlobalsWeb.WebSupplyUser = kict
-GlobalsWeb.WebSupplyPassword = kictgis1234
-GlobalsWeb.WebSupplyPort = 10021
-GlobalsWeb.WebSupplyDir = /geoinfoCH/WebContent/file/service/
-
-GlobalsWeb.GlbWidth = 600
-GlobalsWeb.GlbHeight = 600
-GlobalsWeb.Levels = {6:2445.98,7:1222.99,8:611.50,9:305.75,10:152.87,11:76.44,12:38.22,13:19.11,14:9.55,15:4.78,16:2.39,17:1.19,18:0.60}
-GlobalsWeb.CurrentLevel = 16
-GlobalsWeb.GISwms = http://218.232.234.166/o2map/services/wms
-#GlobalsWeb.GISwms = http://172.12.192.44:8080/o2map/services/wms
\ No newline at end of file
diff --git a/src/main/resources/egovframework/egovProps/globals.properties.sample b/src/main/resources/egovframework/egovProps/globals.properties.sample
index 5ee13ed..cda50a5 100644
--- a/src/main/resources/egovframework/egovProps/globals.properties.sample
+++ b/src/main/resources/egovframework/egovProps/globals.properties.sample
@@ -1,47 +1,30 @@
##############################################
-################### DB\uad00\ub828 ###################
+################### DB관련 ###################
##############################################
# Oracle
Oracle.Driver=oracle.jdbc.driver.OracleDriver
################################################################
-# Oracle.Url=jdbc:oracle:thin:@192.168.0.8:3452:orcl is prod
-#Oracle.Url=jdbc:oracle:thin:@192.168.0.8:3452:orcl
-# dbnt devlop server
-Oracle.Url=jdbc:oracle:thin:@118.219.150.34:1521:ORAGEODEV
-# develop local server
-#Oracle.Url=jdbc:oracle:thin:@192.168.86.2:1521:xe
-# thkim local test
-#Oracle.Url=jdbc:oracle:thin:@127.0.0.1:1521:ORAGEODEV
-#Oracle.Url=jdbc:oracle:thin:@vas2.com:1521:ORAGEODEV
+Oracle.Url=jdbc:oracle:thin:@10.dbnt.co.kr:1521:ORAGEODEV
################################################################
-
-#Oracle.Url=jdbc:oracle:thin:@192.168.0.29:1521:xe
-#Oracle.Url=jdbc:oracle:thin:@192.168.0.71:1521:orcl
-#Oracle.Url=jdbc:oracle:thin:@220.121.145.78:7080:xe
-#Oracle.Url=jdbc:oracle:thin:@localhost:1521:orcl
-#Oracle.Url=jdbc:oracle:thin:@218.232.234.162:1521:ORAGEO
Oracle.ID=geoinfo
Oracle.Password=geoinfo
-# thkim local test
-#Oracle.Password=dbnt060928!rlaxogh
-#Oracle.Password=!!kictgis1234
###############################################
-################### \ud30c\uc77c\uad00\ub828 ###################
+################### 파일관련 ###################
###############################################
#Geoinfo.FilePath=D:\\Tomcat6\\geoinfoEgov\\webapps\\geoinfo\\files\\
Geoinfo.FilePath=D:\\app_geoinfo\\app\\files\\
-#\uac80\uc0c9\uc720\ud1b5 3\ucc28\uc6d0
+#검색유통 3차원
#Geoinfo.FilePath3D=files\\4dim\\2014\\
Geoinfo.FilePath3D=D:\\app_geoinfo\\app\\files\\4dim\\2014\\
-#\uc804\ubb38\uac00\uc758\uacac
+#전문가의견
Geoinfo.Report=files\\report\\
-#\uc785\ub825\uc2dc\uc2a4\ud15c
+#입력시스템
Geoinfo.WebFilePath=files\\web\\
Globals.FileExtImg=.jpeg,.jpg,.bmp,.tiff,.gif,.png
@@ -53,4 +36,6 @@ Globals.FileExtZip=.hwp,.pdf,.zip,.xls,.xlsx,.ppt,.pptx
###############################################
JWT.secret_key=RnrxhWlQksportalSystem!@!@$#@!@#@!$12442321
# The token expires in 1,800,000 milliseconds, which is equal to 30 minutes.
-JWT.access_expired=1800000
\ No newline at end of file
+JWT.access_expired=1800000
+
+O2MAP.wms.url=http://127.0.0.1:2936/o2map/services/wms
\ No newline at end of file
diff --git a/src/main/resources/egovframework/spring/context-common.xml b/src/main/resources/egovframework/spring/context-common.xml
index 0d948a5..b96145f 100644
--- a/src/main/resources/egovframework/spring/context-common.xml
+++ b/src/main/resources/egovframework/spring/context-common.xml
@@ -4,18 +4,14 @@
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
-
+
+
-
-
-
-
-
-
+
@@ -31,45 +27,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- *
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -77,17 +34,8 @@
-
-
-
-
-
-
-
+
diff --git a/src/main/resources/egovframework/spring/context-mybatis.xml b/src/main/resources/egovframework/spring/context-mybatis.xml
deleted file mode 100644
index 0eba4a5..0000000
--- a/src/main/resources/egovframework/spring/context-mybatis.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/main/resources/egovframework/spring/context-properties.xml b/src/main/resources/egovframework/spring/context-properties.xml
index 1e38de9..8677093 100644
--- a/src/main/resources/egovframework/spring/context-properties.xml
+++ b/src/main/resources/egovframework/spring/context-properties.xml
@@ -2,32 +2,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/main/resources/egovframework/spring/context-scheduling.xml b/src/main/resources/egovframework/spring/context-scheduling.xml
deleted file mode 100644
index 6703acb..0000000
--- a/src/main/resources/egovframework/spring/context-scheduling.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/main/webapp/WEB-INF/config/springmvc/action-servlet.xml b/src/main/webapp/WEB-INF/config/springmvc/action-servlet.xml
index 2f45c9c..50b7640 100644
--- a/src/main/webapp/WEB-INF/config/springmvc/action-servlet.xml
+++ b/src/main/webapp/WEB-INF/config/springmvc/action-servlet.xml
@@ -11,7 +11,7 @@ xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:util="http://www.spr
-
+
@@ -22,56 +22,8 @@ xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:util="http://www.spr
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -83,13 +35,5 @@ xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:util="http://www.spr
-
-
-
- /WEB-INF/tiles/tiles-layout.xml
-
-
-
-
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index 666f044..c7a1db5 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -62,14 +62,16 @@
1
-
- action
- *.do
-
-
- action
- *.doo
-
+
+
+ O2MapService
+ com.geotwo.webserver.core.service.Service
+
+
+
+ O2MapService
+ /services/*
+
action
*.json