You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(39) |
Dec
(70) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(52) |
Feb
(168) |
Mar
(248) |
Apr
(143) |
May
(418) |
Jun
(558) |
Jul
(702) |
Aug
(311) |
Sep
(141) |
Oct
(350) |
Nov
(172) |
Dec
(182) |
| 2003 |
Jan
(320) |
Feb
(362) |
Mar
(356) |
Apr
(218) |
May
(447) |
Jun
(203) |
Jul
(745) |
Aug
(494) |
Sep
(175) |
Oct
(422) |
Nov
(554) |
Dec
(162) |
| 2004 |
Jan
(217) |
Feb
(353) |
Mar
(228) |
Apr
(407) |
May
(211) |
Jun
(270) |
Jul
(264) |
Aug
(198) |
Sep
(268) |
Oct
(227) |
Nov
(118) |
Dec
(47) |
| 2005 |
Jan
(207) |
Feb
(243) |
Mar
(297) |
Apr
(197) |
May
(281) |
Jun
(166) |
Jul
(164) |
Aug
(92) |
Sep
(155) |
Oct
(196) |
Nov
(189) |
Dec
(114) |
| 2006 |
Jan
(129) |
Feb
(219) |
Mar
(274) |
Apr
(213) |
May
(245) |
Jun
(220) |
Jul
(376) |
Aug
(347) |
Sep
(179) |
Oct
(493) |
Nov
(448) |
Dec
(339) |
| 2007 |
Jan
(304) |
Feb
(273) |
Mar
(237) |
Apr
(186) |
May
(215) |
Jun
(320) |
Jul
(229) |
Aug
(313) |
Sep
(331) |
Oct
(279) |
Nov
(347) |
Dec
(266) |
| 2008 |
Jan
(332) |
Feb
(280) |
Mar
(203) |
Apr
(277) |
May
(301) |
Jun
(356) |
Jul
(292) |
Aug
(203) |
Sep
(277) |
Oct
(142) |
Nov
(210) |
Dec
(239) |
| 2009 |
Jan
(250) |
Feb
(193) |
Mar
(174) |
Apr
(183) |
May
(342) |
Jun
(230) |
Jul
(292) |
Aug
(161) |
Sep
(204) |
Oct
(280) |
Nov
(281) |
Dec
(175) |
| 2010 |
Jan
(113) |
Feb
(106) |
Mar
(199) |
Apr
(166) |
May
(298) |
Jun
(147) |
Jul
(175) |
Aug
(192) |
Sep
(71) |
Oct
(79) |
Nov
(58) |
Dec
(55) |
| 2011 |
Jan
(83) |
Feb
(169) |
Mar
(142) |
Apr
(207) |
May
(311) |
Jun
(183) |
Jul
(218) |
Aug
(190) |
Sep
(158) |
Oct
(197) |
Nov
(93) |
Dec
(74) |
| 2012 |
Jan
(92) |
Feb
(50) |
Mar
(64) |
Apr
(45) |
May
(100) |
Jun
(70) |
Jul
(3) |
Aug
(1) |
Sep
(2) |
Oct
(5) |
Nov
(7) |
Dec
(4) |
| 2013 |
Jan
(6) |
Feb
(2) |
Mar
(2) |
Apr
(4) |
May
(3) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
| 2014 |
Jan
(2) |
Feb
(2) |
Mar
(2) |
Apr
(3) |
May
(3) |
Jun
(1) |
Jul
|
Aug
(4) |
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
| 2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
(1) |
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(1) |
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <svn...@os...> - 2012-01-11 05:39:39
|
Author: mleslie
Date: 2012-01-10 21:39:32 -0800 (Tue, 10 Jan 2012)
New Revision: 38475
Modified:
trunk/pom.xml
Log:
Adding dependency management entries for the geogit dependencies.
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-01-11 05:24:52 UTC (rev 38474)
+++ trunk/pom.xml 2012-01-11 05:39:32 UTC (rev 38475)
@@ -976,6 +976,35 @@
<version>2.6.0</version>
</dependency>
+ <!-- GeoGIT -->
+ <dependency>
+ <groupId>org.geogit</groupId>
+ <artifactId>geogit</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sleepycat</groupId>
+ <artifactId>je</artifactId>
+ <version>4.1.7</version>
+ </dependency>
+ <dependency>
+ <groupId>com.caucho</groupId>
+ <artifactId>resin-hessian</artifactId>
+ <version>4.0.20</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.uuid</groupId>
+ <artifactId>java-uuid-generator</artifactId>
+ <version>3.1.2</version>
+ </dependency>
+ <dependency>
+ <!-- Google Common Libraries. Featuring com.google.collect collection
+ classes -->
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>r09</version>
+ </dependency>
+
<!-- Other random non test dependencies -->
<dependency>
<groupId>net.sf.ehcache</groupId>
|
|
From: <svn...@os...> - 2012-01-11 05:24:59
|
Author: mleslie
Date: 2012-01-10 21:24:52 -0800 (Tue, 10 Jan 2012)
New Revision: 38474
Modified:
trunk/modules/unsupported/geogit-versioned/pom.xml
trunk/modules/unsupported/geogit-versioned/src/main/java/org/geogit/storage/hessian/GtEntityType.java
Log:
Adding date support to the feature type serialisation.
Modified: trunk/modules/unsupported/geogit-versioned/pom.xml
===================================================================
--- trunk/modules/unsupported/geogit-versioned/pom.xml 2012-01-10 13:31:07 UTC (rev 38473)
+++ trunk/modules/unsupported/geogit-versioned/pom.xml 2012-01-11 05:24:52 UTC (rev 38474)
@@ -78,60 +78,46 @@
<dependency>
<groupId>com.fasterxml.uuid</groupId>
<artifactId>java-uuid-generator</artifactId>
- <version>3.1.2</version>
</dependency>
<dependency>
<groupId>org.geogit</groupId>
<artifactId>geogit</artifactId>
- <version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-cql</artifactId>
<version>8-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>com.caucho</groupId>
+ <artifactId>resin-hessian</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
-
<dependency>
<!-- Google Common Libraries. Featuring com.google.collect collection
classes -->
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
- <version>r09</version>
</dependency>
<!-- Berkeley DB JE -->
<dependency>
<groupId>com.sleepycat</groupId>
<artifactId>je</artifactId>
- <version>4.1.7</version>
</dependency>
<!-- Test scope dependencies -->
<dependency>
- <groupId>org.geogit</groupId>
- <artifactId>geogit</artifactId>
- <version>1.0-SNAPSHOT</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>com.caucho</groupId>
- <artifactId>resin-hessian</artifactId>
- <version>4.0.20</version>
- </dependency>
-
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-property</artifactId>
<version>8-SNAPSHOT</version>
Modified: trunk/modules/unsupported/geogit-versioned/src/main/java/org/geogit/storage/hessian/GtEntityType.java
===================================================================
--- trunk/modules/unsupported/geogit-versioned/src/main/java/org/geogit/storage/hessian/GtEntityType.java 2012-01-10 13:31:07 UTC (rev 38473)
+++ trunk/modules/unsupported/geogit-versioned/src/main/java/org/geogit/storage/hessian/GtEntityType.java 2012-01-11 05:24:52 UTC (rev 38474)
@@ -27,8 +27,9 @@
BYTE_ARRAY(12, byte[].class), CHAR_ARRAY(13, char[].class), DOUBLE_ARRAY(14, double[].class),
FLOAT_ARRAY(15, float[].class), INT_ARRAY(16, int[].class), LONG_ARRAY(17, long[].class),
GEOMETRY(9, Geometry.class), NULL(10, null), UNKNOWN_SERIALISABLE(18, Serializable.class),
- UNKNOWN(19, null), UUID(20, java.util.UUID.class);
+ UNKNOWN(19, null), UUID(20, java.util.UUID.class), DATE_UTIL(21, java.util.Date.class), DATE_SQL(22, java.sql.Date.class);
+
public static GtEntityType determineType(Object value) {
if (value == null)
return NULL;
@@ -68,6 +69,10 @@
return UUID;
if (value instanceof Geometry)
return GEOMETRY;
+ if (value instanceof java.util.Date)
+ return DATE_UTIL;
+ if (value instanceof java.sql.Date)
+ return DATE_SQL;
if (value instanceof Serializable)
return UNKNOWN_SERIALISABLE;
return UNKNOWN;
|
|
From: <svn...@os...> - 2012-01-10 13:31:18
|
Author: jive Date: 2012-01-10 05:31:07 -0800 (Tue, 10 Jan 2012) New Revision: 38473 Modified: trunk/docs/web/about.rst Log: Indicate the current stable and devel version on the about geotools page; as people no longer check the wiki Modified: trunk/docs/web/about.rst =================================================================== --- trunk/docs/web/about.rst 2012-01-10 01:24:18 UTC (rev 38472) +++ trunk/docs/web/about.rst 2012-01-10 13:31:07 UTC (rev 38473) @@ -8,17 +8,17 @@ implement Geographic Information Systems (GIS). The GeoTools library implements Open Geospatial Consortium (OGC) specifications as they are developed. -The capabilities of GeoTools are presented in the User Guide +For an overview of the capabilities of GeoTools please check the User Guide `feature list <http://docs.geotools.org/latest/userguide/geotools.html>`_. -Geotools is used by a number of projects including Web Feature Servers, Web Map -Servers, and desktop applications. For more information check out some -fascinating -`screenshots <http://docs.codehaus.org/display/GEOTOOLS/Screenshots>`_ and -applications powered by GeoTools! +Current `version <http://docs.geotools.org/latest/developer/conventions/version.html>`_ information: -.. `Geomajas <http://www.geomajas.org/>`_ `GeoServer <http://geoserver.org/>`_ `uDig <http://udig.refractions.net/>`_ +* `8.0 <http://sourceforge.net/projects/geotools/files/GeoTools%208.0%20Releases/>`_: Development +* `2.7 <http://sourceforge.net/projects/geotools/files/GeoTools%202.7%20Releases/>`_: Stable +GeoTools is used by a `number of projects <http://docs.codehaus.org/display/GEOTOOLS/Screenshots>`_ +including Web Feature Servers, Web Map Servers, and desktop applications. + Open Source ----------- |
|
From: <svn...@os...> - 2012-01-10 01:24:25
|
Author: jive
Date: 2012-01-09 17:24:18 -0800 (Mon, 09 Jan 2012)
New Revision: 38472
Modified:
trunk/modules/unsupported/pom.xml
trunk/modules/unsupported/shapefile-ng/src/main/java/org/geotools/data/shapefile/ng/ShapefileDataStoreFactory.java
Log:
Included shapefile-ng in the -Dall profile; and change the display name so users can tell it is different in the uDig wizard
Modified: trunk/modules/unsupported/pom.xml
===================================================================
--- trunk/modules/unsupported/pom.xml 2012-01-09 16:47:51 UTC (rev 38471)
+++ trunk/modules/unsupported/pom.xml 2012-01-10 01:24:18 UTC (rev 38472)
@@ -164,12 +164,6 @@
</modules>
</profile>
<profile>
- <id>shapefile-ng</id>
- <modules>
- <module>shapefile-ng</module>
- </modules>
- </profile>
- <profile>
<id>geogit-versioned</id>
<activation>
<property><name>all</name></property>
@@ -196,6 +190,7 @@
<module>feature-aggregate</module>
<module>mongodb</module>
<module>property-ng</module>
+ <module>shapefile-ng</module>
</modules>
</profile>
</profiles>
Modified: trunk/modules/unsupported/shapefile-ng/src/main/java/org/geotools/data/shapefile/ng/ShapefileDataStoreFactory.java
===================================================================
--- trunk/modules/unsupported/shapefile-ng/src/main/java/org/geotools/data/shapefile/ng/ShapefileDataStoreFactory.java 2012-01-09 16:47:51 UTC (rev 38471)
+++ trunk/modules/unsupported/shapefile-ng/src/main/java/org/geotools/data/shapefile/ng/ShapefileDataStoreFactory.java 2012-01-10 01:24:18 UTC (rev 38472)
@@ -125,7 +125,7 @@
};
public String getDisplayName() {
- return "Shapefile";
+ return "Shapefile Next Generation";
}
public String getDescription() {
|
|
From: <svn...@os...> - 2012-01-09 16:48:05
|
Author: apm Date: 2012-01-09 08:47:51 -0800 (Mon, 09 Jan 2012) New Revision: 38471 Added: trunk/modules/unsupported/mongodb/src/main/resources/javascript/ Removed: trunk/modules/unsupported/mongodb/src/main/javascript/ Log: MongoDB datastore; moved server-side javascript files from src/main/javascript/ to src/main/resources/ for automatic inclusion in jar file. |
|
From: <svn...@os...> - 2012-01-09 03:10:49
|
Author: jdeolive
Date: 2012-01-08 19:10:43 -0800 (Sun, 08 Jan 2012)
New Revision: 38470
Modified:
trunk/modules/unsupported/geojson/src/main/java/org/geotools/geojson/geom/GeometryJSON.java
trunk/modules/unsupported/geojson/src/test/java/org/geotools/geojson/GeometryJSONTest.java
Log:
GEOT-3990, 3d writing support for for geojson encoder, patch submitted by James Chamberlain
Modified: trunk/modules/unsupported/geojson/src/main/java/org/geotools/geojson/geom/GeometryJSON.java
===================================================================
--- trunk/modules/unsupported/geojson/src/main/java/org/geotools/geojson/geom/GeometryJSON.java 2012-01-09 03:10:16 UTC (rev 38469)
+++ trunk/modules/unsupported/geojson/src/main/java/org/geotools/geojson/geom/GeometryJSON.java 2012-01-09 03:10:43 UTC (rev 38470)
@@ -16,6 +16,7 @@
*/
package org.geotools.geojson.geom;
+import com.vividsolutions.jts.geom.Coordinate;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -28,7 +29,6 @@
import org.geotools.geojson.GeoJSONUtil;
import org.geotools.geojson.IContentHandler;
-import org.json.simple.JSONArray;
import org.json.simple.JSONAware;
import org.opengis.geometry.BoundingBox;
@@ -713,12 +713,17 @@
}
for (int i = 0; i < seq.size(); i++) {
+ Coordinate coord = seq.getCoordinate(i);
sb.append("[");
- formatDecimal(seq.getX(i), sb);
+ formatDecimal(coord.x, sb);
sb.append(",");
- formatDecimal(seq.getY(i), sb);
+ formatDecimal(coord.y, sb);
+ if (!Double.isNaN(coord.z)) {
+ sb.append(",");
+ formatDecimal(coord.z, sb);
+ }
sb.append("],");
}
sb.setLength(sb.length()-1);
@@ -738,10 +743,15 @@
}
for (int i = 0; i < seq.size(); i++) {
+ Coordinate coord = seq.getCoordinate(i);
out.write("[");
- out.write(String.valueOf(seq.getX(i)));
+ out.write(String.valueOf(coord.x));
out.write(",");
- out.write(String.valueOf(seq.getY(i)));
+ out.write(String.valueOf(coord.y));
+ if (!Double.isNaN(coord.z)){
+ out.write(",");
+ out.write(String.valueOf(coord.z));
+ }
out.write("]");
if (i < seq.size()-1) {
out.write(",");
Modified: trunk/modules/unsupported/geojson/src/test/java/org/geotools/geojson/GeometryJSONTest.java
===================================================================
--- trunk/modules/unsupported/geojson/src/test/java/org/geotools/geojson/GeometryJSONTest.java 2012-01-09 03:10:16 UTC (rev 38469)
+++ trunk/modules/unsupported/geojson/src/test/java/org/geotools/geojson/GeometryJSONTest.java 2012-01-09 03:10:43 UTC (rev 38470)
@@ -43,8 +43,9 @@
public void testPointWrite() throws Exception {
assertEquals(pointText(), gjson.toString(point()));
+ assertEquals(point3dText(), gjson.toString(point3d()));
}
-
+
String pointText() {
return strip("{'type': 'Point','coordinates':[100.1,0.1]}");
}
@@ -54,14 +55,25 @@
return p;
}
+ String point3dText() {
+ return strip("{'type': 'Point','coordinates':[100.1,0.1,10.2]}");
+ }
+
+ Point point3d() {
+ Point p = gf.createPoint(new Coordinate(100.1, 0.1, 10.2));
+ return p;
+ }
+
public void testPointRead() throws Exception {
assertTrue(point().equals(gjson.readPoint(reader(pointText()))));
+ assertTrue(point3d().equals(gjson.readPoint(reader(point3dText()))));
}
-
+
public void testLineWrite() throws Exception {
assertEquals(lineText(), gjson.toString(line()));
+ assertEquals(line3dText(), gjson.toString(line3d()));
}
-
+
String lineText() {
return strip(
"{'type': 'LineString', 'coordinates': [[100.1,0.1],[101.1,1.1]]}");
@@ -72,13 +84,25 @@
return l;
}
+ String line3dText() {
+ return strip(
+ "{'type': 'LineString', 'coordinates': [[100.1,0.1,10.2],[101.1,1.1,10.2]]}");
+ }
+
+ LineString line3d() {
+ LineString l = gf.createLineString(array(new double[][]{{100.1, 0.1, 10.2},{101.1,1.1, 10.2}}));
+ return l;
+ }
+
public void testLineRead() throws Exception {
assertTrue(line().equals(gjson.readLine(reader(lineText()))));
+ assertTrue(line3d().equals(gjson.readLine(reader(line3dText()))));
}
-
+
public void testPolyWrite() throws Exception {
assertEquals(polygonText1(), gjson.toString(polygon1()));
assertEquals(polygonText2(), gjson.toString(polygon2()));
+ assertEquals(polygonText3(), gjson.toString(polygon3()));
}
Polygon polygon2() {
@@ -90,6 +114,25 @@
{100.2, 0.2}, {100.8, 0.2}, {100.8, 0.8}, {100.2, 0.8}, {100.2, 0.2}}))});
return poly;
}
+
+ Polygon polygon3() {
+ Polygon poly;
+ poly = gf.createPolygon(gf.createLinearRing(
+ array(new double[][]{
+ {100.1, 0.1, 10.2}, {101.1, 0.1, 11.2}, {101.1, 1.1, 11.2}, {100.1, 1.1, 10.2}, {100.1, 0.1, 10.2}})),
+ new LinearRing[]{ gf.createLinearRing(array(new double[][]{
+ {100.2, 0.2, 10.2}, {100.8, 0.2, 11.2}, {100.8, 0.8, 11.2}, {100.2, 0.8, 10.2}, {100.2, 0.2, 10.2}}))});
+ return poly;
+ }
+
+ String polygonText3() {
+ return strip("{ 'type': 'Polygon',"+
+ " 'coordinates': ["+
+ " [ [100.1, 0.1, 10.2], [101.1, 0.1, 11.2], [101.1, 1.1, 11.2], [100.1, 1.1, 10.2], [100.1, 0.1, 10.2] ],"+
+ " [ [100.2, 0.2, 10.2], [100.8, 0.2, 11.2], [100.8, 0.8, 11.2], [100.2, 0.8, 10.2], [100.2, 0.2, 10.2] ]"+
+ " ]"+
+ " }");
+ }
String polygonText1() {
return strip("{ 'type': 'Polygon',"+
@@ -118,10 +161,12 @@
public void testPolyRead() throws Exception {
assertTrue(polygon1().equals(gjson.readPolygon(reader(polygonText1()))));
assertTrue(polygon2().equals(gjson.readPolygon(reader(polygonText2()))));
+ assertTrue(polygon3().equals(gjson.readPolygon(reader(polygonText3()))));
}
public void testMultiPointWrite() throws Exception {
assertEquals(multiPointText(), gjson.toString(multiPoint()));
+ assertEquals(multiPoint3dText(), gjson.toString(multiPoint3d()));
}
String multiPointText() {
@@ -136,12 +181,26 @@
return mpoint;
}
+ String multiPoint3dText() {
+ return strip(
+ "{ 'type': 'MultiPoint',"+
+ "'coordinates': [ [100.1, 0.1, 10.2], [101.1, 1.1, 11.2] ]"+
+ "}");
+ }
+
+ MultiPoint multiPoint3d() {
+ MultiPoint mpoint = gf.createMultiPoint(array(new double[][]{{100.1, 0.1, 10.2}, {101.1, 1.1, 11.2}}));
+ return mpoint;
+ }
+
public void testMultiPointRead() throws Exception {
assertTrue(multiPoint().equals(gjson.readMultiPoint(reader(multiPointText()))));
+ assertTrue(multiPoint3d().equals(gjson.readMultiPoint(reader(multiPoint3dText()))));
}
public void testMultiLineWrite() throws Exception {
assertEquals(multiLineText(), gjson.toString(multiLine()));
+ assertEquals(multiLine3dText(), gjson.toString(multiLine3d()));
}
String multiLineText() {
@@ -162,12 +221,32 @@
return mline;
}
+ String multiLine3dText() {
+ return strip(
+ "{ 'type': 'MultiLineString',"+
+ " 'coordinates': ["+
+ " [ [100.1, 0.1, 10.2], [101.1, 1.1, 10.2] ],"+
+ " [ [102.1, 2.1, 11.2], [103.1, 3.1, 11.2] ]"+
+ " ]"+
+ " }");
+ }
+
+ MultiLineString multiLine3d() {
+ MultiLineString mline = gf.createMultiLineString(new LineString[]{
+ gf.createLineString(array(new double[][]{{100.1, 0.1, 10.2}, {101.1, 1.1, 10.2}})),
+ gf.createLineString(array(new double[][]{{102.1, 2.1, 11.2}, {103.1, 3.1, 11.2}}))
+ });
+ return mline;
+ }
+
public void testMultiLineRead() throws Exception {
assertTrue(multiLine().equals(gjson.readMultiLine(reader(multiLineText()))));
+ assertTrue(multiLine3d().equals(gjson.readMultiLine(reader(multiLine3dText()))));
}
public void testMultiPolygonWrite() throws Exception {
assertEquals(multiPolygonText(), gjson.toString(multiPolygon()));
+ assertEquals(multiPolygon3dText(), gjson.toString(multiPolygon3d()));
}
String multiPolygonText() {
@@ -193,12 +272,37 @@
return mpoly;
}
+ String multiPolygon3dText() {
+ return strip(
+ "{ 'type': 'MultiPolygon',"+
+ " 'coordinates': ["+
+ " [[[102.1, 2.1, 10.2], [103.1, 2.1, 10.2], [103.1, 3.1, 10.2], [102.1, 3.1, 10.2], [102.1, 2.1, 10.2]]],"+
+ " [[[100.1, 0.1, 10.2], [101.1, 0.1, 10.2], [101.1, 1.1, 10.2], [100.1, 1.1, 10.2], [100.1, 0.1, 10.2]],"+
+ " [[100.2, 0.2, 10.2], [100.8, 0.2, 10.2], [100.8, 0.8, 10.2], [100.2, 0.8, 10.2], [100.2, 0.2, 10.2]]]"+
+ " ]"+
+ " }");
+ }
+
+ MultiPolygon multiPolygon3d() {
+ MultiPolygon mpoly = gf.createMultiPolygon(new Polygon[]{
+ gf.createPolygon(gf.createLinearRing(
+ array(new double[][]{{102.1, 2.1, 10.2}, {103.1, 2.1, 10.2}, {103.1, 3.1, 10.2}, {102.1, 3.1, 10.2}, {102.1, 2.1, 10.2}})),null),
+ gf.createPolygon(gf.createLinearRing(
+ array(new double[][]{{100.1, 0.1, 10.2}, {101.1, 0.1, 10.2}, {101.1, 1.1, 10.2}, {100.1, 1.1, 10.2}, {100.1, 0.1, 10.2}})),
+ new LinearRing[]{gf.createLinearRing(
+ array(new double[][]{{100.2, 0.2, 10.2}, {100.8, 0.2, 10.2}, {100.8, 0.8, 10.2}, {100.2, 0.8, 10.2}, {100.2, 0.2, 10.2}}))})
+ });
+ return mpoly;
+ }
+
public void testMultiPolygonRead() throws IOException {
assertTrue(multiPolygon().equals(gjson.readMultiPolygon(reader(multiPolygonText()))));
+ assertTrue(multiPolygon3d().equals(gjson.readMultiPolygon(reader(multiPolygon3dText()))));
}
public void testGeometryCollectionWrite() throws Exception {
assertEquals(collectionText(), gjson.toString(collection()));
+ assertEquals(collection3dText(), gjson.toString(collection3d()));
}
private String collectionText() {
@@ -223,21 +327,52 @@
return gcol;
}
+ private String collection3dText() {
+ return strip(
+ "{ 'type': 'GeometryCollection',"+
+ " 'geometries': ["+
+ " { 'type': 'Point',"+
+ " 'coordinates': [100.1, 0.1, 10.2]"+
+ " },"+
+ " { 'type': 'LineString',"+
+ " 'coordinates': [ [101.1, 0.1, 10.2], [102.1, 1.1, 11.2] ]"+
+ " }"+
+ " ]"+
+ " }");
+ }
+
+ GeometryCollection collection3d() {
+ GeometryCollection gcol = gf.createGeometryCollection(new Geometry[]{
+ gf.createPoint(new Coordinate(100.1,0.1, 10.2)),
+ gf.createLineString(array(new double[][]{{101.1, 0.1, 10.2}, {102.1, 1.1, 11.2}}))
+ });
+ return gcol;
+ }
+
public void testGeometryCollectionRead() throws Exception {
assertEqual(collection(),
(GeometryCollection)gjson.readGeometryCollection(reader(collectionText())));
+ assertEqual(collection3d(),
+ (GeometryCollection)gjson.readGeometryCollection(reader(collection3dText())));
}
public void testRead() throws Exception {
assertTrue(point().equals(gjson.read(reader(pointText()))));
+ assertTrue(point3d().equals(gjson.read(reader(point3dText()))));
assertTrue(line().equals(gjson.read(reader(lineText()))));
+ assertTrue(line3d().equals(gjson.read(reader(line3dText()))));
assertTrue(polygon1().equals(gjson.read(reader(polygonText1()))));
assertTrue(polygon2().equals(gjson.read(reader(polygonText2()))));
+ assertTrue(polygon3().equals(gjson.read(reader(polygonText3()))));
assertTrue(multiPoint().equals(gjson.read(reader(multiPointText()))));
+ assertTrue(multiPoint3d().equals(gjson.read(reader(multiPoint3dText()))));
assertTrue(multiLine().equals(gjson.read(reader(multiLineText()))));
+ assertTrue(multiLine3d().equals(gjson.read(reader(multiLine3dText()))));
assertTrue(multiPolygon().equals(gjson.read(reader(multiPolygonText()))));
+ assertTrue(multiPolygon3d().equals(gjson.read(reader(multiPolygon3dText()))));
assertEqual(collection(), (GeometryCollection) gjson.read(reader(collectionText())));
+ assertEqual(collection3d(), (GeometryCollection) gjson.read(reader(collection3dText())));
}
void assertEqual(GeometryCollection col1, GeometryCollection col2) {
|
|
From: <svn...@os...> - 2012-01-09 03:10:23
|
Author: jdeolive
Date: 2012-01-08 19:10:16 -0800 (Sun, 08 Jan 2012)
New Revision: 38469
Modified:
branches/2.7.x/modules/unsupported/geojson/src/main/java/org/geotools/geojson/geom/GeometryJSON.java
branches/2.7.x/modules/unsupported/geojson/src/test/java/org/geotools/geojson/GeometryJSONTest.java
Log:
GEOT-3990, 3d writing support for for geojson encoder, patch submitted by James Chamberlain
Modified: branches/2.7.x/modules/unsupported/geojson/src/main/java/org/geotools/geojson/geom/GeometryJSON.java
===================================================================
--- branches/2.7.x/modules/unsupported/geojson/src/main/java/org/geotools/geojson/geom/GeometryJSON.java 2012-01-06 15:26:32 UTC (rev 38468)
+++ branches/2.7.x/modules/unsupported/geojson/src/main/java/org/geotools/geojson/geom/GeometryJSON.java 2012-01-09 03:10:16 UTC (rev 38469)
@@ -16,6 +16,7 @@
*/
package org.geotools.geojson.geom;
+import com.vividsolutions.jts.geom.Coordinate;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
@@ -26,7 +27,6 @@
import org.geotools.geojson.GeoJSONUtil;
import org.geotools.geojson.IContentHandler;
-import org.json.simple.JSONArray;
import org.json.simple.JSONAware;
import org.opengis.geometry.BoundingBox;
@@ -492,12 +492,17 @@
}
for (int i = 0; i < seq.size(); i++) {
+ Coordinate coord = seq.getCoordinate(i);
sb.append("[");
- formatDecimal(seq.getX(i), sb);
+ formatDecimal(coord.x, sb);
sb.append(",");
- formatDecimal(seq.getY(i), sb);
+ formatDecimal(coord.y, sb);
+ if (!Double.isNaN(coord.z)) {
+ sb.append(",");
+ formatDecimal(coord.z, sb);
+ }
sb.append("],");
}
sb.setLength(sb.length()-1);
@@ -517,10 +522,15 @@
}
for (int i = 0; i < seq.size(); i++) {
+ Coordinate coord = seq.getCoordinate(i);
out.write("[");
- out.write(String.valueOf(seq.getX(i)));
+ out.write(String.valueOf(coord.x));
out.write(",");
- out.write(String.valueOf(seq.getY(i)));
+ out.write(String.valueOf(coord.y));
+ if (!Double.isNaN(coord.z)){
+ out.write(",");
+ out.write(String.valueOf(coord.z));
+ }
out.write("]");
if (i < seq.size()-1) {
out.write(",");
Modified: branches/2.7.x/modules/unsupported/geojson/src/test/java/org/geotools/geojson/GeometryJSONTest.java
===================================================================
--- branches/2.7.x/modules/unsupported/geojson/src/test/java/org/geotools/geojson/GeometryJSONTest.java 2012-01-06 15:26:32 UTC (rev 38468)
+++ branches/2.7.x/modules/unsupported/geojson/src/test/java/org/geotools/geojson/GeometryJSONTest.java 2012-01-09 03:10:16 UTC (rev 38469)
@@ -38,8 +38,9 @@
public void testPointWrite() throws Exception {
assertEquals(pointText(), gjson.toString(point()));
+ assertEquals(point3dText(), gjson.toString(point3d()));
}
-
+
String pointText() {
return strip("{'type': 'Point','coordinates':[100.1,0.1]}");
}
@@ -49,14 +50,25 @@
return p;
}
+ String point3dText() {
+ return strip("{'type': 'Point','coordinates':[100.1,0.1,10.2]}");
+ }
+
+ Point point3d() {
+ Point p = gf.createPoint(new Coordinate(100.1, 0.1, 10.2));
+ return p;
+ }
+
public void testPointRead() throws Exception {
assertTrue(point().equals(gjson.readPoint(reader(pointText()))));
+ assertTrue(point3d().equals(gjson.readPoint(reader(point3dText()))));
}
-
+
public void testLineWrite() throws Exception {
assertEquals(lineText(), gjson.toString(line()));
+ assertEquals(line3dText(), gjson.toString(line3d()));
}
-
+
String lineText() {
return strip(
"{'type': 'LineString', 'coordinates': [[100.1,0.1],[101.1,1.1]]}");
@@ -67,13 +79,25 @@
return l;
}
+ String line3dText() {
+ return strip(
+ "{'type': 'LineString', 'coordinates': [[100.1,0.1,10.2],[101.1,1.1,10.2]]}");
+ }
+
+ LineString line3d() {
+ LineString l = gf.createLineString(array(new double[][]{{100.1, 0.1, 10.2},{101.1,1.1, 10.2}}));
+ return l;
+ }
+
public void testLineRead() throws Exception {
assertTrue(line().equals(gjson.readLine(reader(lineText()))));
+ assertTrue(line3d().equals(gjson.readLine(reader(line3dText()))));
}
-
+
public void testPolyWrite() throws Exception {
assertEquals(polygonText1(), gjson.toString(polygon1()));
assertEquals(polygonText2(), gjson.toString(polygon2()));
+ assertEquals(polygonText3(), gjson.toString(polygon3()));
}
Polygon polygon2() {
@@ -85,6 +109,25 @@
{100.2, 0.2}, {100.8, 0.2}, {100.8, 0.8}, {100.2, 0.8}, {100.2, 0.2}}))});
return poly;
}
+
+ Polygon polygon3() {
+ Polygon poly;
+ poly = gf.createPolygon(gf.createLinearRing(
+ array(new double[][]{
+ {100.1, 0.1, 10.2}, {101.1, 0.1, 11.2}, {101.1, 1.1, 11.2}, {100.1, 1.1, 10.2}, {100.1, 0.1, 10.2}})),
+ new LinearRing[]{ gf.createLinearRing(array(new double[][]{
+ {100.2, 0.2, 10.2}, {100.8, 0.2, 11.2}, {100.8, 0.8, 11.2}, {100.2, 0.8, 10.2}, {100.2, 0.2, 10.2}}))});
+ return poly;
+ }
+
+ String polygonText3() {
+ return strip("{ 'type': 'Polygon',"+
+ " 'coordinates': ["+
+ " [ [100.1, 0.1, 10.2], [101.1, 0.1, 11.2], [101.1, 1.1, 11.2], [100.1, 1.1, 10.2], [100.1, 0.1, 10.2] ],"+
+ " [ [100.2, 0.2, 10.2], [100.8, 0.2, 11.2], [100.8, 0.8, 11.2], [100.2, 0.8, 10.2], [100.2, 0.2, 10.2] ]"+
+ " ]"+
+ " }");
+ }
String polygonText1() {
return strip("{ 'type': 'Polygon',"+
@@ -113,10 +156,12 @@
public void testPolyRead() throws Exception {
assertTrue(polygon1().equals(gjson.readPolygon(reader(polygonText1()))));
assertTrue(polygon2().equals(gjson.readPolygon(reader(polygonText2()))));
+ assertTrue(polygon3().equals(gjson.readPolygon(reader(polygonText3()))));
}
public void testMultiPointWrite() throws Exception {
assertEquals(multiPointText(), gjson.toString(multiPoint()));
+ assertEquals(multiPoint3dText(), gjson.toString(multiPoint3d()));
}
String multiPointText() {
@@ -131,12 +176,26 @@
return mpoint;
}
+ String multiPoint3dText() {
+ return strip(
+ "{ 'type': 'MultiPoint',"+
+ "'coordinates': [ [100.1, 0.1, 10.2], [101.1, 1.1, 11.2] ]"+
+ "}");
+ }
+
+ MultiPoint multiPoint3d() {
+ MultiPoint mpoint = gf.createMultiPoint(array(new double[][]{{100.1, 0.1, 10.2}, {101.1, 1.1, 11.2}}));
+ return mpoint;
+ }
+
public void testMultiPointRead() throws Exception {
assertTrue(multiPoint().equals(gjson.readMultiPoint(reader(multiPointText()))));
+ assertTrue(multiPoint3d().equals(gjson.readMultiPoint(reader(multiPoint3dText()))));
}
public void testMultiLineWrite() throws Exception {
assertEquals(multiLineText(), gjson.toString(multiLine()));
+ assertEquals(multiLine3dText(), gjson.toString(multiLine3d()));
}
String multiLineText() {
@@ -157,12 +216,32 @@
return mline;
}
+ String multiLine3dText() {
+ return strip(
+ "{ 'type': 'MultiLineString',"+
+ " 'coordinates': ["+
+ " [ [100.1, 0.1, 10.2], [101.1, 1.1, 10.2] ],"+
+ " [ [102.1, 2.1, 11.2], [103.1, 3.1, 11.2] ]"+
+ " ]"+
+ " }");
+ }
+
+ MultiLineString multiLine3d() {
+ MultiLineString mline = gf.createMultiLineString(new LineString[]{
+ gf.createLineString(array(new double[][]{{100.1, 0.1, 10.2}, {101.1, 1.1, 10.2}})),
+ gf.createLineString(array(new double[][]{{102.1, 2.1, 11.2}, {103.1, 3.1, 11.2}}))
+ });
+ return mline;
+ }
+
public void testMultiLineRead() throws Exception {
assertTrue(multiLine().equals(gjson.readMultiLine(reader(multiLineText()))));
+ assertTrue(multiLine3d().equals(gjson.readMultiLine(reader(multiLine3dText()))));
}
public void testMultiPolygonWrite() throws Exception {
assertEquals(multiPolygonText(), gjson.toString(multiPolygon()));
+ assertEquals(multiPolygon3dText(), gjson.toString(multiPolygon3d()));
}
String multiPolygonText() {
@@ -188,12 +267,37 @@
return mpoly;
}
+ String multiPolygon3dText() {
+ return strip(
+ "{ 'type': 'MultiPolygon',"+
+ " 'coordinates': ["+
+ " [[[102.1, 2.1, 10.2], [103.1, 2.1, 10.2], [103.1, 3.1, 10.2], [102.1, 3.1, 10.2], [102.1, 2.1, 10.2]]],"+
+ " [[[100.1, 0.1, 10.2], [101.1, 0.1, 10.2], [101.1, 1.1, 10.2], [100.1, 1.1, 10.2], [100.1, 0.1, 10.2]],"+
+ " [[100.2, 0.2, 10.2], [100.8, 0.2, 10.2], [100.8, 0.8, 10.2], [100.2, 0.8, 10.2], [100.2, 0.2, 10.2]]]"+
+ " ]"+
+ " }");
+ }
+
+ MultiPolygon multiPolygon3d() {
+ MultiPolygon mpoly = gf.createMultiPolygon(new Polygon[]{
+ gf.createPolygon(gf.createLinearRing(
+ array(new double[][]{{102.1, 2.1, 10.2}, {103.1, 2.1, 10.2}, {103.1, 3.1, 10.2}, {102.1, 3.1, 10.2}, {102.1, 2.1, 10.2}})),null),
+ gf.createPolygon(gf.createLinearRing(
+ array(new double[][]{{100.1, 0.1, 10.2}, {101.1, 0.1, 10.2}, {101.1, 1.1, 10.2}, {100.1, 1.1, 10.2}, {100.1, 0.1, 10.2}})),
+ new LinearRing[]{gf.createLinearRing(
+ array(new double[][]{{100.2, 0.2, 10.2}, {100.8, 0.2, 10.2}, {100.8, 0.8, 10.2}, {100.2, 0.8, 10.2}, {100.2, 0.2, 10.2}}))})
+ });
+ return mpoly;
+ }
+
public void testMultiPolygonRead() throws IOException {
assertTrue(multiPolygon().equals(gjson.readMultiPolygon(reader(multiPolygonText()))));
+ assertTrue(multiPolygon3d().equals(gjson.readMultiPolygon(reader(multiPolygon3dText()))));
}
public void testGeometryCollectionWrite() throws Exception {
assertEquals(collectionText(), gjson.toString(collection()));
+ assertEquals(collection3dText(), gjson.toString(collection3d()));
}
private String collectionText() {
@@ -218,21 +322,52 @@
return gcol;
}
+ private String collection3dText() {
+ return strip(
+ "{ 'type': 'GeometryCollection',"+
+ " 'geometries': ["+
+ " { 'type': 'Point',"+
+ " 'coordinates': [100.1, 0.1, 10.2]"+
+ " },"+
+ " { 'type': 'LineString',"+
+ " 'coordinates': [ [101.1, 0.1, 10.2], [102.1, 1.1, 11.2] ]"+
+ " }"+
+ " ]"+
+ " }");
+ }
+
+ GeometryCollection collection3d() {
+ GeometryCollection gcol = gf.createGeometryCollection(new Geometry[]{
+ gf.createPoint(new Coordinate(100.1,0.1, 10.2)),
+ gf.createLineString(array(new double[][]{{101.1, 0.1, 10.2}, {102.1, 1.1, 11.2}}))
+ });
+ return gcol;
+ }
+
public void testGeometryCollectionRead() throws Exception {
assertEqual(collection(),
(GeometryCollection)gjson.readGeometryCollection(reader(collectionText())));
+ assertEqual(collection3d(),
+ (GeometryCollection)gjson.readGeometryCollection(reader(collection3dText())));
}
public void testRead() throws Exception {
assertTrue(point().equals(gjson.read(reader(pointText()))));
+ assertTrue(point3d().equals(gjson.read(reader(point3dText()))));
assertTrue(line().equals(gjson.read(reader(lineText()))));
+ assertTrue(line3d().equals(gjson.read(reader(line3dText()))));
assertTrue(polygon1().equals(gjson.read(reader(polygonText1()))));
assertTrue(polygon2().equals(gjson.read(reader(polygonText2()))));
+ assertTrue(polygon3().equals(gjson.read(reader(polygonText3()))));
assertTrue(multiPoint().equals(gjson.read(reader(multiPointText()))));
+ assertTrue(multiPoint3d().equals(gjson.read(reader(multiPoint3dText()))));
assertTrue(multiLine().equals(gjson.read(reader(multiLineText()))));
+ assertTrue(multiLine3d().equals(gjson.read(reader(multiLine3dText()))));
assertTrue(multiPolygon().equals(gjson.read(reader(multiPolygonText()))));
+ assertTrue(multiPolygon3d().equals(gjson.read(reader(multiPolygon3dText()))));
assertEqual(collection(), (GeometryCollection) gjson.read(reader(collectionText())));
+ assertEqual(collection3d(), (GeometryCollection) gjson.read(reader(collection3dText())));
}
void assertEqual(GeometryCollection col1, GeometryCollection col2) {
|
|
From: <svn...@os...> - 2012-01-06 15:26:39
|
Author: jdeolive Date: 2012-01-06 07:26:32 -0800 (Fri, 06 Jan 2012) New Revision: 38468 Modified: trunk/docs/user/library/jdbc/spatiallite.rst Log: specifying which versions of sqlite/spatialite are supported Modified: trunk/docs/user/library/jdbc/spatiallite.rst =================================================================== --- trunk/docs/user/library/jdbc/spatiallite.rst 2012-01-06 03:33:55 UTC (rev 38467) +++ trunk/docs/user/library/jdbc/spatiallite.rst 2012-01-06 15:26:32 UTC (rev 38468) @@ -1,10 +1,16 @@ -Spatial Lite Plugin -------------------- +SpatiaLite Plugin +----------------- Supports direct access to a SQLite/SpatiaLite database. SQLite is a popular embedded relational database. SpatiaLite is the spatial extension to SQLite. +.. note:: + + The plugin uses internal versions of SpatiaLite (2.3.1) and SQLite (3.7.2). + Therefore the plugin is only capable of accessing databases that are + compatible with these versions. + References: * http://www.sqlite.org/ |
|
From: <svn...@os...> - 2012-01-06 03:34:02
|
Author: ang05a
Date: 2012-01-05 19:33:55 -0800 (Thu, 05 Jan 2012)
New Revision: 38467
Modified:
trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/FeatureTypeRegistry.java
Log:
GEOT-4002:App schema throws IOException when swe.xsd version 2.0 is used
Modified: trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/FeatureTypeRegistry.java
===================================================================
--- trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/FeatureTypeRegistry.java 2012-01-05 16:18:59 UTC (rev 38466)
+++ trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/FeatureTypeRegistry.java 2012-01-06 03:33:55 UTC (rev 38467)
@@ -20,13 +20,11 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NoSuchElementException;
-import java.util.Set;
import java.util.Stack;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -38,9 +36,6 @@
import org.eclipse.xsd.XSDAttributeUseCategory;
import org.eclipse.xsd.XSDComplexTypeDefinition;
import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSchemaContent;
-import org.eclipse.xsd.XSDSchemaDirective;
import org.eclipse.xsd.XSDTypeDefinition;
import org.geotools.feature.Types;
import org.geotools.feature.type.ComplexFeatureTypeFactoryImpl;
@@ -130,8 +125,6 @@
private FeatureTypeFactory typeFactory;
- private NamespaceSupport namespaces;
-
/**
* stack of currently being built type names, used by
* {@link #createType(Name, XSDTypeDefinition)} to prevent recursive type definitions by
@@ -145,7 +138,6 @@
}
public FeatureTypeRegistry(NamespaceSupport namespaces) {
- this.namespaces = namespaces;
schemas = new ArrayList<SchemaIndex>();
typeFactory = new ComplexFeatureTypeFactoryImpl();
descriptorRegistry = new HashMap<Name, AttributeDescriptor>();
@@ -474,7 +466,9 @@
if (baseType != null) {
String targetNamespace = baseType.getTargetNamespace();
String name = baseType.getName();
- superType = getType(targetNamespace, name);
+ if (name != null) {
+ superType = getType(targetNamespace, name);
+ }
if (superType == null) {
superType = createType(baseType, crs, attMappings);
}
|
|
From: <svn...@os...> - 2012-01-05 16:19:08
|
Author: jdeolive
Date: 2012-01-05 08:18:59 -0800 (Thu, 05 Jan 2012)
New Revision: 38466
Modified:
branches/2.7.x/pom.xml
Log:
removing eastwood snapshot dependency
Modified: branches/2.7.x/pom.xml
===================================================================
--- branches/2.7.x/pom.xml 2012-01-05 16:18:35 UTC (rev 38465)
+++ branches/2.7.x/pom.xml 2012-01-05 16:18:59 UTC (rev 38466)
@@ -734,7 +734,7 @@
<dependency>
<groupId>jfree</groupId>
<artifactId>eastwood</artifactId>
- <version>1.1.1-SNAPSHOT</version>
+ <version>1.1.1-20090908</version>
</dependency>
<!-- XML -->
|
|
From: <svn...@os...> - 2012-01-05 16:18:44
|
Author: jdeolive
Date: 2012-01-05 08:18:35 -0800 (Thu, 05 Jan 2012)
New Revision: 38465
Modified:
trunk/pom.xml
Log:
removing eastwood snapshot dependency
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-01-05 12:04:26 UTC (rev 38464)
+++ trunk/pom.xml 2012-01-05 16:18:35 UTC (rev 38465)
@@ -813,7 +813,7 @@
<dependency>
<groupId>jfree</groupId>
<artifactId>eastwood</artifactId>
- <version>1.1.1-SNAPSHOT</version>
+ <version>1.1.1-20090908</version>
</dependency>
<!-- XML -->
|
|
From: <svn...@os...> - 2012-01-05 12:04:50
|
Author: apm
Date: 2012-01-05 04:04:26 -0800 (Thu, 05 Jan 2012)
New Revision: 38464
Added:
trunk/modules/unsupported/mongodb/src/main/javascript/gtmpFuncs.js
Modified:
trunk/modules/unsupported/mongodb/src/main/javascript/INSTALL.txt
Log:
Added MongoDB server-side script for bounding box queries to modules/unsupported/mongodb
Modified: trunk/modules/unsupported/mongodb/src/main/javascript/INSTALL.txt
===================================================================
--- trunk/modules/unsupported/mongodb/src/main/javascript/INSTALL.txt 2012-01-05 05:33:48 UTC (rev 38463)
+++ trunk/modules/unsupported/mongodb/src/main/javascript/INSTALL.txt 2012-01-05 12:04:26 UTC (rev 38464)
@@ -1,6 +1,7 @@
-This directory contains a JavaScript file; MetaDataCompute.js; that need to be installed
-on the MongoDB database server as a stored JavaScript module.
+This directory contains two JavaScript files; MetaDataCompute.js and gtmpFuncs.js; that need to be installed
+on the MongoDB database server as stored JavaScript modules.
-Copy MetaDataCompute.js to your MongoDB server, then install it as follows:
+Copy both files to your MongoDB server, then install them as follows:
> mongo MetaDataCompute.js
-(Assumes "mongo" executable in path. The JavaScript file installs the necessary server-side scripts.)
+> mongo gtmpFuncs.js
+(Assumes "mongo" executable in path. The JavaScript files install the necessary server-side scripts.)
Added: trunk/modules/unsupported/mongodb/src/main/javascript/gtmpFuncs.js
===================================================================
--- trunk/modules/unsupported/mongodb/src/main/javascript/gtmpFuncs.js (rev 0)
+++ trunk/modules/unsupported/mongodb/src/main/javascript/gtmpFuncs.js 2012-01-05 12:04:26 UTC (rev 38464)
@@ -0,0 +1,128 @@
+/** support for bounding box queries
+
+ * @author David Boyd, Data Tactics Corp.
+ *
+ * Copyright 2011 GeoTools
+ *
+ * @see The GNU Lesser General Public License (LGPL)
+*/
+/*This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
+ * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+
+// Simple point in Bounding box function.
+// boundingbox is of the form float[4] = [Left Longitude, Bottom Latitude,
+// Right Longitude, Top Latitued ]
+// point isof the form float[2]= [longitude, latitude ]
+var gtmpPointInBBOX = { _id : "gtmpPointInBBOX", value : function(bbox, point) {
+
+ var leftLongitude = bbox[0];
+ var bottomLatitude = bbox[1];
+ var rightLongitude = bbox[2];
+ var topLatitude = bbox[3];
+ var tLongitude = point[0];
+ var tLatitude = point[1];
+
+ // For the bounding box assume that when box crosses
+ // the 180 longitude that it will be the smaller of the
+ // defined box queried.
+
+ //checks to see if bounding box crosses 180 degrees
+ var boxcase = 0;
+ if (leftLongitude < 0) {
+ if (rightLongitude < 0) {
+ boxcase = 3;
+ } else {
+ boxcase = 2;
+ }
+ } else {
+ boxcase = 1;
+ }
+
+ var inX = false;
+ switch (boxcase) {
+ case 1:
+ if ((tLongitude >= leftLongitude) &&
+ (tLongitude <= rightLongitude))
+ inX = true;
+ else
+ inX = false;
+ break;
+ case 2:
+ var normLongitude = 360.0 + leftLongitude;
+ if ((tLongitude >= normLongitude) &&
+ (tLongitude <= rightLongitude))
+ inX = true;
+ else
+ inX = false;
+ break;
+ case 3:
+ if ((tLongitude >= leftLongitude) &&
+ (tLongitude <= rightLongitude))
+ inX = true;
+ else
+ inX = false;
+ break;
+ }
+ if (!inX)
+ return false;
+
+ // Now test the Latitude
+ if ((tLatitude >= bottomLatitude) &&
+ (tLatitude <= topLatitude))
+ return true;
+
+ return false;
+ }
+}
+
+// Simple bounding box intersection test
+// Both boxes are of the form: float[4] = [Left Longitude, Bottom Latitude,
+// Right Longitude, Top Latitued ]
+var gtmpBBoxIntersect = { _id: "gtmpBBoxIntersect", value: function(bbox1, bbox2) {
+ var AminX = bbox1[0];
+ var AminY = bbox1[1];
+ var AmaxX = bbox1[2];
+ var AmaxY = bbox1[3];
+
+ var BminX = bbox2[0];
+ var BminY = bbox2[1];
+ var BmaxX = bbox2[2];
+ var BmaxY = bbox2[3];
+
+ if ((AmaxX < BminX) || (AminX > BmaxX) ||
+ (AmaxY < BminY) || (AminY > BmaxY)) {
+ return false;
+ }
+
+ return true;
+ }
+}
+
+var gtmpGeoQuery = { _id : 'gtmpGeoQuery', value: function(bbox) {
+ if (!obj.geometry) return false;
+ if (obj.geometry.type == 'Point') {
+ return gtmpPointInBBOX(bbox, obj.geometry.coordinates);
+ }
+ if (obj.geometry.type == 'Polygon') {
+ return gtmpBBoxIntersect(bbox, obj.bbox);
+ }
+ return false;
+ }
+}
+
+db.system.js.remove('gtmpPointInBBOX');
+db.system.js.remove('gtmpBBoxIntersect');
+db.system.js.remove('gtmpGeoQuery');
+db.system.js.save(gtmpPointInBBOX);
+db.system.js.save(gtmpBBoxIntersect);
+db.system.js.save(gtmpGeoQuery);
+
+exit
|
|
From: <svn...@os...> - 2012-01-05 05:33:54
|
Author: jive
Date: 2012-01-04 21:33:48 -0800 (Wed, 04 Jan 2012)
New Revision: 38463
Modified:
trunk/modules/extension/wms/src/main/java/org/geotools/data/wms/xml/WMSComplexTypes.java
Log:
Fix for GEOT-3999 updateSequence ignored on WMS capabilities, thanks jhudson
Modified: trunk/modules/extension/wms/src/main/java/org/geotools/data/wms/xml/WMSComplexTypes.java
===================================================================
--- trunk/modules/extension/wms/src/main/java/org/geotools/data/wms/xml/WMSComplexTypes.java 2012-01-05 05:33:19 UTC (rev 38462)
+++ trunk/modules/extension/wms/src/main/java/org/geotools/data/wms/xml/WMSComplexTypes.java 2012-01-05 05:33:48 UTC (rev 38463)
@@ -236,10 +236,9 @@
}
}
- capabilities.setVersion(attrs.getValue("", "version"));
+ capabilities.setVersion(attrs.getValue("", "version")); //$NON-NLS-1$//$NON-NLS-2$
+ capabilities.setUpdateSequence(attrs.getValue("", "updateSequence")); //$NON-NLS-1$//$NON-NLS-2$
- // Update sequence ignored
-
capabilities.setService(service);
return capabilities;
@@ -356,10 +355,9 @@
}
}
- capabilities.setVersion(attrs.getValue("", "version"));
+ capabilities.setVersion(attrs.getValue("", "version")); //$NON-NLS-1$//$NON-NLS-2$
+ capabilities.setUpdateSequence(attrs.getValue("", "updateSequence")); //$NON-NLS-1$//$NON-NLS-2$
- // Update sequence ignored
-
capabilities.setService(service);
return capabilities;
|
|
From: <svn...@os...> - 2012-01-05 05:33:26
|
Author: jive
Date: 2012-01-04 21:33:19 -0800 (Wed, 04 Jan 2012)
New Revision: 38462
Modified:
trunk/build/maven/jar-collector/src/main/java/org/geotools/maven/JarCollector.java
Log:
Patch for GEOT-3981 thanks Joachim Van der Auwera
Modified: trunk/build/maven/jar-collector/src/main/java/org/geotools/maven/JarCollector.java
===================================================================
--- trunk/build/maven/jar-collector/src/main/java/org/geotools/maven/JarCollector.java 2012-01-05 05:10:07 UTC (rev 38461)
+++ trunk/build/maven/jar-collector/src/main/java/org/geotools/maven/JarCollector.java 2012-01-05 05:33:19 UTC (rev 38462)
@@ -18,8 +18,10 @@
import java.io.File;
import java.io.IOException;
+import java.util.List;
import java.util.Set;
+import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
@@ -67,14 +69,6 @@
private String jarName;
/**
- * Project dependencies.
- *
- * @parameter expression="${project.artifacts}"
- * @required
- */
- private Set<Artifact> dependencies;
-
- /**
* The Maven project running this plugin.
*
* @parameter expression="${project}"
@@ -146,8 +140,10 @@
}
}
FileUtils.copyFileToDirectory(jarFile, collect);
+ Set<Artifact> dependencies = project.getDependencyArtifacts();
if (dependencies != null) {
for (final Artifact artifact : dependencies) {
+ System.out.println("+++++++++++++++++++++++ DEP: " + artifact.getDependencyTrail());
final String scope = artifact.getScope();
if (scope != null && // Maven 2.0.6 bug?
(scope.equalsIgnoreCase(Artifact.SCOPE_COMPILE) ||
|
|
From: <svn...@os...> - 2012-01-05 05:10:14
|
Author: ang05a
Date: 2012-01-04 21:10:07 -0800 (Wed, 04 Jan 2012)
New Revision: 38461
Modified:
branches/2.7.x/modules/library/temporal/src/test/java/org/geotools/temporal/object/DefaultTemporalGeometricPrimitiveTest.java
Log:
GEOT-3995: DefaultTemporalGeometricPrimitiveTest fails in 2012
Modified: branches/2.7.x/modules/library/temporal/src/test/java/org/geotools/temporal/object/DefaultTemporalGeometricPrimitiveTest.java
===================================================================
--- branches/2.7.x/modules/library/temporal/src/test/java/org/geotools/temporal/object/DefaultTemporalGeometricPrimitiveTest.java 2012-01-05 03:36:41 UTC (rev 38460)
+++ branches/2.7.x/modules/library/temporal/src/test/java/org/geotools/temporal/object/DefaultTemporalGeometricPrimitiveTest.java 2012-01-05 05:10:07 UTC (rev 38461)
@@ -100,7 +100,7 @@
*/
@Test
public void testLength() {
- cal.set(2012, 0, 1);
+ cal.set(2020, 0, 1);
temporalGeomericPrimitive1 = new DefaultPeriod(new DefaultInstant(position1), new DefaultInstant(position2));
temporalGeomericPrimitive2 = new DefaultPeriod(new DefaultInstant(position2), new DefaultInstant(new DefaultPosition(cal.getTime())));
Duration result = temporalGeomericPrimitive1.length();
|
|
From: <svn...@os...> - 2012-01-05 03:36:47
|
Author: jdeolive
Date: 2012-01-04 19:36:41 -0800 (Wed, 04 Jan 2012)
New Revision: 38460
Modified:
trunk/modules/unsupported/wps/pom.xml
Log:
fixing dependency on non existing postgis module, switched to jdbc-postgis
Modified: trunk/modules/unsupported/wps/pom.xml
===================================================================
--- trunk/modules/unsupported/wps/pom.xml 2012-01-05 03:32:35 UTC (rev 38459)
+++ trunk/modules/unsupported/wps/pom.xml 2012-01-05 03:36:41 UTC (rev 38460)
@@ -96,14 +96,14 @@
<groupId>org.geotools</groupId>
<artifactId>gt-main</artifactId>
<version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.geotools</groupId>
- <artifactId>gt-postgis</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.geotools.jdbc</groupId>
+ <artifactId>gt-jdbc-postgis</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.geotools.ogc</groupId>
<artifactId>net.opengis.wps</artifactId>
<version>${project.version}</version>
|
|
From: <svn...@os...> - 2012-01-05 03:32:42
|
Author: ang05a
Date: 2012-01-04 19:32:35 -0800 (Wed, 04 Jan 2012)
New Revision: 38459
Modified:
trunk/modules/library/main/src/test/java/org/geotools/temporal/object/DefaultTemporalGeometricPrimitiveTest.java
Log:
GEOT-3995: DefaultTemporalGeometricPrimitiveTest fails in 2012
Modified: trunk/modules/library/main/src/test/java/org/geotools/temporal/object/DefaultTemporalGeometricPrimitiveTest.java
===================================================================
--- trunk/modules/library/main/src/test/java/org/geotools/temporal/object/DefaultTemporalGeometricPrimitiveTest.java 2012-01-05 03:27:03 UTC (rev 38458)
+++ trunk/modules/library/main/src/test/java/org/geotools/temporal/object/DefaultTemporalGeometricPrimitiveTest.java 2012-01-05 03:32:35 UTC (rev 38459)
@@ -101,7 +101,7 @@
*/
@Test
public void testLength() {
- cal.set(2012, 0, 1);
+ cal.set(2020, 0, 1);
temporalGeomericPrimitive1 = new DefaultPeriod(new DefaultInstant(position1), new DefaultInstant(position2));
temporalGeomericPrimitive2 = new DefaultPeriod(new DefaultInstant(position2), new DefaultInstant(new DefaultPosition(cal.getTime())));
Duration result = temporalGeomericPrimitive1.length();
|
|
From: <svn...@os...> - 2012-01-05 03:27:09
|
Author: jdeolive
Date: 2012-01-04 19:27:03 -0800 (Wed, 04 Jan 2012)
New Revision: 38458
Modified:
branches/2.7.x/modules/plugin/jdbc/jdbc-h2/pom.xml
Log:
setting geodb version to 0.7-RC2
Modified: branches/2.7.x/modules/plugin/jdbc/jdbc-h2/pom.xml
===================================================================
--- branches/2.7.x/modules/plugin/jdbc/jdbc-h2/pom.xml 2012-01-05 03:26:39 UTC (rev 38457)
+++ branches/2.7.x/modules/plugin/jdbc/jdbc-h2/pom.xml 2012-01-05 03:27:03 UTC (rev 38458)
@@ -68,7 +68,7 @@
<dependency>
<groupId>org.opengeo</groupId>
<artifactId>geodb</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.7-RC2</version>
<exclusions>
<exclusion>
<groupId>com.h2database</groupId>
|
|
From: <svn...@os...> - 2012-01-05 03:26:45
|
Author: jdeolive
Date: 2012-01-04 19:26:39 -0800 (Wed, 04 Jan 2012)
New Revision: 38457
Modified:
trunk/modules/plugin/jdbc/jdbc-h2/pom.xml
Log:
setting geodb version to 0.7-RC2
Modified: trunk/modules/plugin/jdbc/jdbc-h2/pom.xml
===================================================================
--- trunk/modules/plugin/jdbc/jdbc-h2/pom.xml 2012-01-04 12:31:25 UTC (rev 38456)
+++ trunk/modules/plugin/jdbc/jdbc-h2/pom.xml 2012-01-05 03:26:39 UTC (rev 38457)
@@ -68,7 +68,7 @@
<dependency>
<groupId>org.opengeo</groupId>
<artifactId>geodb</artifactId>
- <version>0.6-SNAPSHOT</version>
+ <version>0.7-RC2</version>
<exclusions>
<exclusion>
<groupId>com.h2database</groupId>
|
|
From: <svn...@os...> - 2012-01-04 12:31:37
|
Author: afabiani
Date: 2012-01-04 04:31:25 -0800 (Wed, 04 Jan 2012)
New Revision: 38456
Modified:
trunk/docs/user/unsupported/wps.rst
Log:
- [GEOT-3998] : updating WPS client library documentation
Modified: trunk/docs/user/unsupported/wps.rst
===================================================================
--- trunk/docs/user/unsupported/wps.rst 2012-01-04 11:40:08 UTC (rev 38455)
+++ trunk/docs/user/unsupported/wps.rst 2012-01-04 12:31:25 UTC (rev 38456)
@@ -50,6 +50,79 @@
By using these wrapper classes, a programmer can quickly build process requests and get results
with only a few lines of code (view examples below).
+WPS with custom HTTPClient Example
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The following example shows how to create a WebProcessingService using a custom implementation of org.geotools.data.ows.HTTPClient ::
+
+ public class MyWpsHTTPClient implements HTTPClient
+ {
+ @Override
+ public abstract org.geotools.data.ows.HTTPResponse post(java.net.URL arg0, java.io.InputStream arg1, java.lang.String arg2) throws java.io.IOException;
+
+ @Override
+ public abstract org.geotools.data.ows.HTTPResponse get(java.net.URL arg0) throws java.io.IOException
+ {
+ //csutom method implementation here...
+ }
+
+ @Override
+ public abstract java.lang.String getUser();
+ {
+ //csutom method implementation here...
+ }
+
+ @Override
+ public abstract void setUser(java.lang.String arg0);
+ {
+ //csutom method implementation here...
+ }
+
+ @Override
+ public abstract java.lang.String getPassword();
+ {
+ //csutom method implementation here...
+ }
+
+ @Override
+ public abstract void setPassword(java.lang.String arg0);
+ {
+ //csutom method implementation here...
+ }
+
+ @Override
+ public abstract int getConnectTimeout();
+ {
+ //csutom method implementation here...
+ }
+
+ @Override
+ public abstract void setConnectTimeout(int arg0);
+ {
+ //csutom method implementation here...
+ }
+
+ @Override
+ public abstract int getReadTimeout();
+ {
+ //csutom method implementation here...
+ }
+
+ @Override
+ public abstract void setReadTimeout(int arg0);
+ {
+ //csutom method implementation here...
+ }
+ }
+
+It's possible now to allow the WecProcessingService make use of MyWpsHTTPClient by simply passing it to the class Constructor.::
+
+ wps = new WebProcessingService(url, new MyWpsHTTPClient(), null);
+
+Notice also that GeoTools already has an available implementation of HTTPClient which may be used for the most common cases, allowing also Basic authentication.::
+
+ org.geotools.data.ows.SimpleHttpClient
+
WPS getCapabilties Example
^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -111,3 +184,47 @@
Double result = (Double) results.get("result");
Now you you have a result that was calculated on the WPS server.
+
+WPS getExecutionResponse Example
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+This example shows how to ask to the WPS for the status of a process request and handle
+the different status codes.::
+
+ WebProcessingService wps = new WebProcessingService(
+ new URL(storedRequestURL),
+ this.wpsHTTPClient,
+ null);
+
+ GetExecutionStatusRequest execRequest = wps.createGetExecutionStatusRequest();
+ execRequest.setIdentifier(this.wpsProcessIdentifier);
+
+ GetExecutionStatusResponse response = wps.issueRequest(execRequest);
+
+ // Checking for Exceptions and Status...
+ if ((response.getExceptionResponse() == null) && (response.getExecuteResponse() != null))
+ {
+ if (response.getExecuteResponse().getStatus().getProcessSucceeded() != null)
+ {
+ // Process complete ... checking output
+ for (Object processOutput : response.getExecuteResponse().getProcessOutputs().getOutput())
+ {
+ OutputDataType wpsOutput = (OutputDataType) processOutput;
+ // retrieve the value of the output ...
+ wpsOutput.getData().getLiteralData().getValue();
+ }
+ else if (response.getExecuteResponse().getStatus().getProcessFailed() != null)
+ {
+ // Process failed ... handle failed status
+ }
+ else if (response.getExecuteResponse().getStatus().getProcessStarted() != null)
+ {
+ // Updating status percentage...
+ int percentComplete =
+ response.getExecuteResponse().getStatus().getProcessStarted().getPercentCompleted().intValue();
+ }
+ }
+ else
+ {
+ // Retrieve here the Exception message and handle the errored status ...
+ }
|
|
From: <svn...@os...> - 2012-01-04 11:40:22
|
Author: afabiani
Date: 2012-01-04 03:40:08 -0800 (Wed, 04 Jan 2012)
New Revision: 38455
Added:
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/request/AbstractGetExecutionStatusRequest.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/request/GetExecutionStatusRequest.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/response/GetExecutionStatusResponse.java
Modified:
trunk/modules/unsupported/wps/pom.xml
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/ows/AbstractWPS.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/ows/AbstractWPSGetCapabilitiesResponse.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/ows/ProcessDescription.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/ows/package-info.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPS1_0_0.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPSFactory.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPSProcess.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPSSpecification.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPSUtils.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WebProcessingService.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/package-info.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/request/AbstractExecuteProcessRequest.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/request/AbstractWPSRequest.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/request/ExecuteProcessRequest.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/request/package-info.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/response/DescribeProcessResponse.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/response/ExecuteProcessResponse.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/response/WPSGetCapabilitiesResponse.java
trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/response/package-info.java
trunk/modules/unsupported/wps/src/test/java/org/geotools/data/wps/OnlineWPSFactoryTest.java
trunk/modules/unsupported/wps/src/test/java/org/geotools/data/wps/OnlineWPSManualRequestTest.java
trunk/modules/unsupported/wps/src/test/java/org/geotools/data/wps/ParsingTest.java
Log:
- GEOT-3996 / GEOT-3997
Modified: trunk/modules/unsupported/wps/pom.xml
===================================================================
--- trunk/modules/unsupported/wps/pom.xml 2011-12-29 14:27:14 UTC (rev 38454)
+++ trunk/modules/unsupported/wps/pom.xml 2012-01-04 11:40:08 UTC (rev 38455)
@@ -96,6 +96,12 @@
<groupId>org.geotools</groupId>
<artifactId>gt-main</artifactId>
<version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.geotools</groupId>
+ <artifactId>gt-postgis</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.geotools.ogc</groupId>
@@ -119,6 +125,25 @@
</dependency>
<dependency>
<groupId>org.geotools</groupId>
+ <artifactId>gt-xml</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.geotools</groupId>
+ <artifactId>gt-wfs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.geotools.xsd</groupId>
+ <artifactId>gt-xsd-wfs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.geotools.ogc</groupId>
+ <artifactId>net.opengis.wfs</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.geotools</groupId>
<artifactId>gt-sample-data</artifactId>
<version>${project.version}</version>
<scope>test</scope>
Modified: trunk/modules/unsupported/wps/src/main/java/org/geotools/data/ows/AbstractWPS.java
===================================================================
--- trunk/modules/unsupported/wps/src/main/java/org/geotools/data/ows/AbstractWPS.java 2011-12-29 14:27:14 UTC (rev 38454)
+++ trunk/modules/unsupported/wps/src/main/java/org/geotools/data/ows/AbstractWPS.java 2012-01-04 11:40:08 UTC (rev 38455)
@@ -3,7 +3,7 @@
* http://geotools.org
*
* (C) 2004-2008, Open Source Geospatial Foundation (OSGeo)
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
@@ -16,15 +16,10 @@
*/
package org.geotools.data.ows;
-import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
@@ -33,95 +28,153 @@
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
-import java.util.zip.GZIPInputStream;
import net.opengis.wps10.WPSCapabilitiesType;
import org.geotools.data.ResourceInfo;
import org.geotools.data.ServiceInfo;
-import org.geotools.data.ows.SimpleHttpClient.SimpleHTTPResponse;
import org.geotools.ows.ServiceException;
+
/**
- * This abstract class provides a building block for one to implement a
- * WPS client.
- *
+ * This abstract class provides a building block for one to implement a
+ * WPS client.
+ *
* This class provides version negotiation, Capabilities document retrieval,
* and a request/response infrastructure. Implementing subclasses need to
- * provide their own Specifications
- *
+ * provide their own Specifications
+ *
* @author gdavis
*
*
- *
- *
- *
* @source $URL$
*/
-public abstract class AbstractWPS<C extends WPSCapabilitiesType, R extends Object> {
+public abstract class AbstractWPS<C extends WPSCapabilitiesType, R extends Object>
+{
+
+ private static final Logger LOGGER = org.geotools.util.logging.Logging.getLogger("org.geotools.data.ows");
+ private HTTPClient httpClient;
protected final URL serverURL;
protected C capabilities;
protected ServiceInfo info;
- protected Map<R,ResourceInfo> resourceInfo = new HashMap<R,ResourceInfo>();
-
+ protected Map<R, ResourceInfo> resourceInfo = new HashMap<R, ResourceInfo>();
+
/** Contains the specifications that are to be used with this service */
protected Specification[] specs;
protected Specification specification;
-
- private static final Logger LOGGER = org.geotools.util.logging.Logging.getLogger("org.geotools.data.ows");
/**
* Set up the specifications used and retrieve the Capabilities document
* given by serverURL.
- *
+ *
* @param serverURL a URL that points to the capabilities document of a server
* @throws IOException if there is an error communicating with the server
* @throws ServiceException if the server responds with an error
*/
- public AbstractWPS( final URL serverURL ) throws IOException, ServiceException {
- if (serverURL == null) {
- throw new NullPointerException("ServerURL cannot be null");
- }
-
- this.serverURL = serverURL;
+ public AbstractWPS(final URL serverURL) throws IOException, ServiceException
+ {
+ this(serverURL, new SimpleHttpClient(), null);
- setupSpecifications();
-
capabilities = negotiateVersion();
- if (capabilities == null) {
- throw new ServiceException("Unable to retrieve or parse Capabilities document.");
+ if (capabilities == null)
+ {
+ throw new ServiceException("Unable to retrieve or parse Capabilities document.");
}
+ else if (capabilities != null)
+ {
+ setupSpecification(capabilities);
+ }
}
- public AbstractWPS(C capabilties, URL serverURL) {
- if (capabilties == null) {
- throw new NullPointerException("Capabilities cannot be null.");
- }
-
- if (serverURL == null) {
- throw new NullPointerException("ServerURL cannot be null");
- }
-
- setupSpecifications();
-
- for (int i = 0; i < specs.length; i++) {
- if (specs[i].getVersion().equals(capabilties.getVersion())) {
- specification = specs[i];
- break;
- }
- }
-
- if (specification == null) {
- specification = specs[specs.length-1];
- LOGGER.warning("Unable to choose a specification based on cached capabilities. "
- +"Arbitrarily choosing spec '"+specification.getVersion()+"'.");
- }
-
- this.serverURL = serverURL;
- this.capabilities = capabilties;
- }
+ /**
+ * @throws IOException
+ * @throws ServiceException
+ * @deprecated use {@link #AbstractWPS(OWSConfig)}
+ */
+ public AbstractWPS(final URL serverURL, int requestTimeout) throws ServiceException, IOException
+ {
+ this(serverURL, new SimpleHttpClient(), null);
+ this.httpClient.setConnectTimeout(requestTimeout);
+ this.httpClient.setReadTimeout(requestTimeout);
+ }
/**
+ * @deprecated use {@link #AbstractWPS(OWSConfig, Capabilities)}
+ */
+ public AbstractWPS(C capabilties, URL serverURL) throws ServiceException, IOException
+ {
+ this(serverURL, new SimpleHttpClient(), capabilties);
+ }
+
+ public AbstractWPS(final URL serverURL, final HTTPClient httpClient,
+ final C capabilities) throws ServiceException, IOException
+ {
+ if (serverURL == null)
+ {
+ throw new NullPointerException("serverURL");
+ }
+ if (httpClient == null)
+ {
+ throw new NullPointerException("httpClient");
+ }
+
+ this.serverURL = serverURL;
+ this.httpClient = httpClient;
+
+ setupSpecifications();
+
+ if (capabilities != null)
+ {
+ setupSpecification(capabilities);
+
+ this.capabilities = capabilities;
+ }
+ else
+ {
+ this.capabilities = negotiateVersion();
+ if (this.capabilities == null)
+ {
+ throw new ServiceException("Unable to retrieve or parse Capabilities document.");
+ }
+ setupSpecification(this.capabilities);
+ }
+
+ }
+
+ /**
+ * @param capabilities
+ */
+ private void setupSpecification(final C capabilities)
+ {
+ for (int i = 0; i < specs.length; i++)
+ {
+ if (specs[i].getVersion().equals(capabilities.getVersion()))
+ {
+ specification = specs[i];
+
+ break;
+ }
+ }
+
+ if (specification == null)
+ {
+ specification = specs[specs.length - 1];
+ LOGGER.warning("Unable to choose a specification based on cached capabilities. " +
+ "Arbitrarily choosing spec '" + specification.getVersion() + "'.");
+ }
+ }
+
+ public void setHttpClient(HTTPClient httpClient)
+ {
+ this.httpClient = httpClient;
+ }
+
+ public HTTPClient getHTTPClient()
+ {
+ return this.httpClient;
+ }
+
+ /**
* Description of this service.
* <p>
* Provides a very quick description of the service, for more information
@@ -129,34 +182,44 @@
* <p>
* @return description of this service.
*/
- public ServiceInfo getInfo(){
- synchronized ( capabilities ){
- if( info == null ){
+ public ServiceInfo getInfo()
+ {
+ synchronized (capabilities)
+ {
+ if (info == null)
+ {
info = createInfo();
}
+
return info;
- }
+ }
}
+
/**
* Implemented by a subclass to describe service
* @return ServiceInfo
*/
protected abstract ServiceInfo createInfo();
- public ResourceInfo getInfo( R resource ){
- synchronized ( capabilities ){
- if( !resourceInfo.containsKey( resource ) ){
- resourceInfo.put( resource, createInfo( resource ) );
+ public ResourceInfo getInfo(R resource)
+ {
+ synchronized (capabilities)
+ {
+ if (!resourceInfo.containsKey(resource))
+ {
+ resourceInfo.put(resource, createInfo(resource));
}
}
- return resourceInfo.get( resource );
+
+ return resourceInfo.get(resource);
}
-
- protected abstract ResourceInfo createInfo(R resource );
-
- private void syncrhonized( Capabilities capabilities2 ) {
- // TODO Auto-generated method stub
+ protected abstract ResourceInfo createInfo(R resource);
+
+
+ private void syncrhonized(Capabilities capabilities2)
+ {
+ // TODO Auto-generated method stub
}
/**
@@ -183,26 +246,28 @@
* </ul>
* </p>
* <p>
- * The OGC tells us to repeat this process (or give up). This means we are
- * actually going to come up with a bit of setup cost in figuring out our
+ * The OGC tells us to repeat this process (or give up). This means we are
+ * actually going to come up with a bit of setup cost in figuring out our
* GetCapabilities request. This means that it is possible that we may make
- * multiple requests before being satisfied with a response.
- *
- * Also, if we are unable to parse a given version for some reason,
+ * multiple requests before being satisfied with a response.
+ *
+ * Also, if we are unable to parse a given version for some reason,
* for example, malformed XML, we will request a lower version until
* we have run out of versions to request with. Thus, a server that does
- * not play nicely may take some time to parse and might not even
+ * not play nicely may take some time to parse and might not even
* succeed.
- *
+ *
* @return a capabilities object that represents the Capabilities on the server
* @throws IOException if there is an error communicating with the server, or the XML cannot be parsed
* @throws ServiceException if the server returns a ServiceException
*/
- protected C negotiateVersion() throws IOException, ServiceException {
+ protected C negotiateVersion() throws IOException, ServiceException
+ {
List versions = new ArrayList(specs.length);
Exception exception = null;
- for( int i = 0; i < specs.length; i++ ) {
+ for (int i = 0; i < specs.length; i++)
+ {
versions.add(i, specs[i].getVersion());
}
@@ -211,80 +276,101 @@
int test = maxClient;
- while( (minClient <= test) && (test <= maxClient) ) {
+ while ((minClient <= test) && (test <= maxClient))
+ {
Specification tempSpecification = specs[test];
String clientVersion = tempSpecification.getVersion();
GetCapabilitiesRequest request = tempSpecification.createGetCapabilitiesRequest(serverURL);
- //Grab document
+ // Grab document
C tempCapabilities;
- try {
+ try
+ {
tempCapabilities = (C) issueRequest(request).getCapabilities();
- } catch (ServiceException e) {
- tempCapabilities = null;
- exception = e;
}
+ catch (ServiceException e)
+ {
+ tempCapabilities = null;
+ exception = e;
+ }
int compare = -1;
- String serverVersion = clientVersion; //Ignored if caps is null
+ String serverVersion = clientVersion; // Ignored if caps is null
- if (tempCapabilities != null) {
+ if (tempCapabilities != null)
+ {
serverVersion = tempCapabilities.getVersion();
compare = serverVersion.compareTo(clientVersion);
}
- if (compare == 0) {
- //we have an exact match and have capabilities as well!
+ if (compare == 0)
+ {
+ // we have an exact match and have capabilities as well!
this.specification = tempSpecification;
return tempCapabilities;
}
- if (tempCapabilities != null && versions.contains(serverVersion)) {
+ if ((tempCapabilities != null) && versions.contains(serverVersion))
+ {
// we can communicate with this server
int index = versions.indexOf(serverVersion);
this.specification = specs[index];
return tempCapabilities;
- } else if (compare < 0) {
+ }
+ else if (compare < 0)
+ {
// server responded lower then we asked - and we don't understand.
maxClient = test - 1; // set current version as limit
// lets try and go one lower?
- //
+ //
clientVersion = before(versions, serverVersion);
- if (clientVersion == null) {
- if (exception != null) {
- if (exception instanceof ServiceException) {
- throw (ServiceException) exception;
- }
+ if (clientVersion == null)
+ {
+ if (exception != null)
+ {
+ if (exception instanceof ServiceException)
+ {
+ throw (ServiceException) exception;
+ }
+
IOException e = new IOException(exception.getMessage());
throw e;
}
+
return null; // do not know any lower version numbers
}
test = versions.indexOf(clientVersion);
- } else {
+ }
+ else
+ {
// server responsed higher than we asked - and we don't understand
minClient = test + 1; // set current version as lower limit
// lets try and go one higher
clientVersion = after(versions, serverVersion);
- if (clientVersion == null) {
- if (exception != null) {
- if (exception instanceof ServiceException) {
- throw (ServiceException) exception;
- }
+ if (clientVersion == null)
+ {
+ if (exception != null)
+ {
+ if (exception instanceof ServiceException)
+ {
+ throw (ServiceException) exception;
+ }
+
IOException e = new IOException(exception.getMessage());
throw e;
}
+
return null; // do not know any lower version numbers
}
@@ -293,33 +379,40 @@
}
// could not talk to this server
- if (exception != null) {
+ if (exception != null)
+ {
IOException e = new IOException(exception.getMessage());
throw e;
}
+
return null;
}
/**
* Utility method returning the known version, just before the provided version
- *
+ *
* @param known List<String> of all known versions
* @param version the boundary condition
* @return the version just below the provided boundary version
*/
- String before( List known, String version ) {
- if (known.isEmpty()) {
+ String before(List known, String version)
+ {
+ if (known.isEmpty())
+ {
return null;
}
String before = null;
- for( Iterator i = known.iterator(); i.hasNext(); ) {
+ for (Iterator i = known.iterator(); i.hasNext();)
+ {
String test = (String) i.next();
- if (test.compareTo(version) < 0) {
+ if (test.compareTo(version) < 0)
+ {
- if ((before == null) || (before.compareTo(test) < 0)) {
+ if ((before == null) || (before.compareTo(test) < 0))
+ {
before = test;
}
}
@@ -330,23 +423,28 @@
/**
* Utility method returning the known version, just after the provided version
- *
+ *
* @param known a List<String> of all known versions
* @param version the boundary condition
* @return a version just after the provided boundary condition
*/
- String after( List known, String version ) {
- if (known.isEmpty()) {
+ String after(List known, String version)
+ {
+ if (known.isEmpty())
+ {
return null;
}
String after = null;
- for( Iterator i = known.iterator(); i.hasNext(); ) {
+ for (Iterator i = known.iterator(); i.hasNext();)
+ {
String test = (String) i.next();
- if (test.compareTo(version) > 0) {
- if ((after == null) || (after.compareTo(test) < 0)) {
+ if (test.compareTo(version) > 0)
+ {
+ if ((after == null) || (after.compareTo(test) < 0))
+ {
after = test;
}
}
@@ -358,68 +456,56 @@
/**
* Issues a request to the server and returns that server's response. It
* asks the server to send the response gzipped to provide a faster transfer
- * time.
- *
+ * time.
+ *
* @param request the request to be issued
* @return a response from the server, which is created according to the specific Request
* @throws IOException if there was a problem communicating with the server
* @throws ServiceException if the server responds with an exception or returns bad content
*/
- protected Response internalIssueRequest( Request request ) throws IOException, ServiceException {
- URL finalURL = request.getFinalURL();
+ protected Response internalIssueRequest(Request request) throws IOException, ServiceException
+ {
+ final URL finalURL = request.getFinalURL();
- HttpURLConnection connection = (HttpURLConnection) finalURL.openConnection();
-
- connection.addRequestProperty("Accept-Encoding", "gzip");
-
- if (request.requiresPost()) {
- connection.setRequestMethod("POST");
- connection.setDoOutput(true);
- connection.setRequestProperty("Content-type", request.getPostContentType());
+ final HTTPResponse httpResponse;
- OutputStream outputStream = connection.getOutputStream();
+ if (request.requiresPost())
+ {
- if (LOGGER.isLoggable(Level.FINE)) {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- request.performPostOutput(out);
-
- InputStream in = new ByteArrayInputStream(out.toByteArray());
- BufferedReader reader = new BufferedReader(new InputStreamReader(in));
+ final String postContentType = request.getPostContentType();
- PrintStream stream = new PrintStream(outputStream);
-
- StringBuffer postText = new StringBuffer();
-
- while (reader.ready()) {
- String input = reader.readLine();
- postText = postText.append(input);
- stream.println(input);
- }
- LOGGER.fine(postText.toString());
- //System.out.println(postText);
-
- stream.close();
- out.close();
- in.close();
- } else {
- request.performPostOutput(outputStream);
- }
-
- outputStream.flush();
- outputStream.close();
- } else {
- connection.setRequestMethod("GET");
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ request.performPostOutput(out);
+
+ InputStream in = new ByteArrayInputStream(out.toByteArray());
+
+ try
+ {
+ httpResponse = httpClient.post(finalURL, in, postContentType);
+ }
+ finally
+ {
+ in.close();
+ }
}
-
- HTTPResponse httpResponse = new SimpleHttpClient.SimpleHTTPResponse(connection);
- return request.createResponse(httpResponse);
+ else
+ {
+ httpResponse = httpClient.get(finalURL);
+ }
+
+ final Response response = request.createResponse(httpResponse);
+
+ return response;
}
-
- public AbstractWPSGetCapabilitiesResponse issueRequest(GetCapabilitiesRequest request) throws IOException, ServiceException {
- return (AbstractWPSGetCapabilitiesResponse) internalIssueRequest(request);
+
+ public AbstractWPSGetCapabilitiesResponse issueRequest(GetCapabilitiesRequest request) throws IOException,
+ ServiceException
+ {
+ return (AbstractWPSGetCapabilitiesResponse) internalIssueRequest(request);
}
-
- public void setLoggingLevel(Level newLevel) {
- LOGGER.setLevel(newLevel);
+
+ public void setLoggingLevel(Level newLevel)
+ {
+ LOGGER.setLevel(newLevel);
}
}
Modified: trunk/modules/unsupported/wps/src/main/java/org/geotools/data/ows/AbstractWPSGetCapabilitiesResponse.java
===================================================================
--- trunk/modules/unsupported/wps/src/main/java/org/geotools/data/ows/AbstractWPSGetCapabilitiesResponse.java 2011-12-29 14:27:14 UTC (rev 38454)
+++ trunk/modules/unsupported/wps/src/main/java/org/geotools/data/ows/AbstractWPSGetCapabilitiesResponse.java 2012-01-04 11:40:08 UTC (rev 38455)
@@ -3,7 +3,7 @@
* http://geotools.org
*
* (C) 2004-2008, Open Source Geospatial Foundation (OSGeo)
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
@@ -23,10 +23,11 @@
import org.geotools.ows.ServiceException;
+
/**
* Base class for WPS GetCapabilities responses. They should typically attempt to
- * parse the Capabilities document in inputStream in the constructor.
- *
+ * parse the Capabilities document in inputStream in the constructor.
+ *
* @author gdavis
*
*
@@ -34,23 +35,27 @@
*
* @source $URL$
*/
-public abstract class AbstractWPSGetCapabilitiesResponse extends Response {
+public abstract class AbstractWPSGetCapabilitiesResponse extends Response
+{
- protected WPSCapabilitiesType capabilities;
- protected ExceptionReportType excepResponse;
+ protected WPSCapabilitiesType capabilities;
+ protected ExceptionReportType excepResponse;
- public AbstractWPSGetCapabilitiesResponse(HTTPResponse response) throws ServiceException, IOException {
- super(response);
- }
-
- /**
- * Returns the capabilities object parsed during the response
- */
- public WPSCapabilitiesType getCapabilities() {
- return capabilities;
- }
-
- public ExceptionReportType getExceptionResponse() {
+ public AbstractWPSGetCapabilitiesResponse(HTTPResponse httpResponse) throws ServiceException, IOException
+ {
+ super(httpResponse);
+ }
+
+ /**
+ * Returns the capabilities object parsed during the response
+ */
+ public WPSCapabilitiesType getCapabilities()
+ {
+ return capabilities;
+ }
+
+ public ExceptionReportType getExceptionResponse()
+ {
return excepResponse;
- }
+ }
}
Modified: trunk/modules/unsupported/wps/src/main/java/org/geotools/data/ows/ProcessDescription.java
===================================================================
--- trunk/modules/unsupported/wps/src/main/java/org/geotools/data/ows/ProcessDescription.java 2011-12-29 14:27:14 UTC (rev 38454)
+++ trunk/modules/unsupported/wps/src/main/java/org/geotools/data/ows/ProcessDescription.java 2012-01-04 11:40:08 UTC (rev 38455)
@@ -3,7 +3,7 @@
* http://geotools.org
*
* (C) 2004-2008, Open Source Geospatial Foundation (OSGeo)
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
Modified: trunk/modules/unsupported/wps/src/main/java/org/geotools/data/ows/package-info.java
===================================================================
--- trunk/modules/unsupported/wps/src/main/java/org/geotools/data/ows/package-info.java 2011-12-29 14:27:14 UTC (rev 38454)
+++ trunk/modules/unsupported/wps/src/main/java/org/geotools/data/ows/package-info.java 2012-01-04 11:40:08 UTC (rev 38455)
@@ -16,9 +16,9 @@
*/
/**
* package to build WPS requests.
- *
- * This portion of the program was contributed by Sejong University and funded
- * by Seoul R&BD 10540. Any official publishing of the produced result is
+ *
+ * This portion of the program was contributed by Sejong University and funded
+ * by Seoul R&BD 10540. Any official publishing of the produced result is
* requested to retain the aforementioned acknowledgment.
*/
package org.geotools.data.ows;
Modified: trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPS1_0_0.java
===================================================================
--- trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPS1_0_0.java 2011-12-29 14:27:14 UTC (rev 38454)
+++ trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPS1_0_0.java 2012-01-04 11:40:08 UTC (rev 38455)
@@ -3,7 +3,7 @@
* http://geotools.org
*
* (C) 2004-2008, Open Source Geospatial Foundation (OSGeo)
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
@@ -17,29 +17,46 @@
package org.geotools.data.wps;
import java.io.IOException;
+import java.math.BigInteger;
import java.net.URL;
+import java.util.List;
import java.util.Properties;
+import net.opengis.ows11.BoundingBoxType;
+import net.opengis.ows11.CodeType;
+import net.opengis.ows11.Ows11Factory;
+import net.opengis.wps10.DataType;
+import net.opengis.wps10.DocumentOutputDefinitionType;
+import net.opengis.wps10.LiteralDataType;
+import net.opengis.wps10.OutputDefinitionType;
+import net.opengis.wps10.ResponseDocumentType;
+import net.opengis.wps10.ResponseFormType;
+import net.opengis.wps10.Wps10Factory;
+
import org.geotools.data.ows.AbstractGetCapabilitiesRequest;
import org.geotools.data.ows.GetCapabilitiesRequest;
import org.geotools.data.ows.HTTPResponse;
import org.geotools.data.ows.Response;
import org.geotools.data.wps.request.AbstractDescribeProcessRequest;
import org.geotools.data.wps.request.AbstractExecuteProcessRequest;
+import org.geotools.data.wps.request.AbstractGetExecutionStatusRequest;
import org.geotools.data.wps.request.DescribeProcessRequest;
import org.geotools.data.wps.request.ExecuteProcessRequest;
+import org.geotools.data.wps.request.GetExecutionStatusRequest;
import org.geotools.data.wps.response.DescribeProcessResponse;
import org.geotools.data.wps.response.ExecuteProcessResponse;
+import org.geotools.data.wps.response.GetExecutionStatusResponse;
import org.geotools.data.wps.response.WPSGetCapabilitiesResponse;
import org.geotools.ows.ServiceException;
+
/**
* Provides support for the Web Processing Service 1.0.0 Specification.
* <p>
- * WPS1_0_0 provides both name and version information that may be checked against
+ * WPS1_0_0 provides both name and version information that may be checked against
* a GetCapabilities document during version negotiation.
* </p>
- *
+ *
* @author gdavis
*
*
@@ -47,121 +64,254 @@
*
* @source $URL$
*/
-public class WPS1_0_0 extends WPSSpecification {
+public class WPS1_0_0 extends WPSSpecification
+{
+ private static final Wps10Factory wpsFactory = Wps10Factory.eINSTANCE;
+
+ private static String processKey(String key)
+ {
+ return key.trim().toLowerCase();
+ }
+
/**
* Public constructor creates the WMS1_0_0 object.
*/
- public WPS1_0_0() {
+ public WPS1_0_0()
+ {
}
/**
* Expected version attribute for root element.
- *
+ *
* @return the expect version value for this specification
*/
- public String getVersion() {
- return "1.0.0"; //$NON-NLS-1$
+ public String getVersion()
+ {
+ return "1.0.0"; // $NON-NLS-1$
}
-
+
/**
* Create a request for performing GetCapabilities requests on a 1.0.0 server.
- *
+ *
* @see org.geotools.data.wps.WPSSpecification#createGetCapabilitiesRequest(java.net.URL)
* @param server a URL that points to the 1.0.0 server
* @return a AbstractGetCapabilitiesRequest object that can provide a valid request
*/
- public GetCapabilitiesRequest createGetCapabilitiesRequest( URL server ) {
+ public GetCapabilitiesRequest createGetCapabilitiesRequest(URL server)
+ {
return new GetCapsRequest(server);
}
-
- private static String processKey(String key) {
- return key.trim().toLowerCase();
+
+ @Override
+ public DescribeProcessRequest createDescribeProcessRequest(
+ URL onlineResource) throws UnsupportedOperationException
+ {
+ return new InternalDescribeProcessRequest(onlineResource, null);
}
+ @Override
+ public ExecuteProcessRequest createExecuteProcessRequest(URL onlineResource) throws UnsupportedOperationException
+ {
+ return new InternalExecuteProcessRequest(onlineResource, null);
+ }
+
+ @Override
+ public GetExecutionStatusRequest createGetExecutionStatusRequest(URL onlineResource)
+ throws UnsupportedOperationException
+ {
+ return new InternalGetExecutionStatusRequest(onlineResource, null);
+ }
+
+ @Override
+ public DataType createLiteralInputValue(String literalValue)
+ {
+ DataType literalInputValue = wpsFactory.createDataType();
+ LiteralDataType literalDataType = wpsFactory.createLiteralDataType();
+ literalDataType.setValue(literalValue);
+ literalInputValue.setLiteralData(literalDataType);
+
+ return literalInputValue;
+ }
+
+ @Override
+ public DataType createBoundingBoxInputValue(String crs, int dimensions, List<Double> lowerCorner,
+ List<Double> upperCorner)
+ {
+ DataType bbox = wpsFactory.createDataType();
+ BoundingBoxType bboxType = Ows11Factory.eINSTANCE.createBoundingBoxType();
+ bboxType.setCrs(crs);
+ bboxType.setDimensions(BigInteger.valueOf(dimensions));
+ bboxType.setLowerCorner(lowerCorner);
+ bboxType.setUpperCorner(upperCorner);
+ bbox.setBoundingBoxData(bboxType);
+
+ return bbox;
+ }
+
+ @Override
+ public ResponseFormType createResponseForm(ResponseDocumentType responseDoc,
+ OutputDefinitionType rawOutput)
+ {
+ ResponseFormType responseForm = wpsFactory.createResponseFormType();
+
+ if (responseDoc != null)
+ {
+ responseForm.setResponseDocument(responseDoc);
+ }
+
+ if (rawOutput != null)
+ {
+ responseForm.setRawDataOutput(rawOutput);
+ }
+
+ return responseForm;
+ }
+
+ @Override
+ public OutputDefinitionType createOutputDefinitionType(String identifier)
+ {
+ CodeType inputType = Ows11Factory.eINSTANCE.createCodeType();
+ inputType.setValue(identifier);
+
+ OutputDefinitionType rawOutput = wpsFactory.createOutputDefinitionType();
+ rawOutput.setIdentifier(inputType);
+
+ return rawOutput;
+ }
+
+ @Override
+ public ResponseDocumentType createResponseDocumentType(boolean lineage, boolean status,
+ boolean storeExecuteResponse, String outputType)
+ {
+ ResponseDocumentType responseDoc = wpsFactory.createResponseDocumentType();
+ responseDoc.setLineage(lineage);
+ responseDoc.setStatus(status);
+ responseDoc.setStoreExecuteResponse(storeExecuteResponse);
+
+ if (outputType != null)
+ {
+ DocumentOutputDefinitionType output = wpsFactory.createDocumentOutputDefinitionType();
+ CodeType inputType = Ows11Factory.eINSTANCE.createCodeType();
+ inputType.setValue(outputType);
+ output.setIdentifier(inputType);
+ responseDoc.getOutput().add(output);
+ }
+
+ return responseDoc;
+ }
+
/**
* We need a custom request object.
*/
- static public class GetCapsRequest extends AbstractGetCapabilitiesRequest {
+ public static class GetCapsRequest extends AbstractGetCapabilitiesRequest
+ {
+
/**
* Construct a Request compatible with a 1.0.0 Web Process Server.
- *
+ *
* @param urlGetCapabilities URL of GetCapabilities document.
*/
- public GetCapsRequest( URL urlGetCapabilities ) {
+ public GetCapsRequest(URL urlGetCapabilities)
+ {
super(urlGetCapabilities);
}
- protected void initVersion() {
- properties.setProperty(VERSION, "1.0.0");
+ protected void initVersion()
+ {
+ properties.setProperty(VERSION, "1.0.0");
}
- protected void initRequest() {
+ protected void initRequest()
+ {
setProperty("REQUEST", "getCapabilities");
}
- protected void initService() {
- //The 1.0.0 specification does not use the service property
+ protected void initService()
+ {
+ // The 1.0.0 specification does not use the service property
}
- protected String processKey( String key ) {
+ protected String processKey(String key)
+ {
return WPS1_0_0.processKey(key);
}
-
- public Response createResponse(HTTPResponse response) throws ServiceException, IOException {
- return new WPSGetCapabilitiesResponse(response);
- }
+
+ public Response createResponse(HTTPResponse httpResponse) throws ServiceException, IOException
+ {
+ return new WPSGetCapabilitiesResponse(httpResponse);
+ }
}
- @Override
- public DescribeProcessRequest createDescribeProcessRequest(
- URL onlineResource) throws UnsupportedOperationException {
- return new InternalDescribeProcessRequest(onlineResource, null);
- }
-
- public static class InternalDescribeProcessRequest extends AbstractDescribeProcessRequest {
+ public static class InternalDescribeProcessRequest extends AbstractDescribeProcessRequest
+ {
/**
* @param onlineResource
* @param properties
*/
- public InternalDescribeProcessRequest( URL onlineResource, Properties properties ) {
+ public InternalDescribeProcessRequest(URL onlineResource, Properties properties)
+ {
super(onlineResource, properties);
}
- protected void initVersion() {
+ protected void initVersion()
+ {
setProperty(VERSION, "1.0.0");
}
-
- public Response createResponse(HTTPResponse response) throws ServiceException, IOException {
- return new DescribeProcessResponse(response);
- }
- }
- @Override
- public ExecuteProcessRequest createExecuteProcessRequest(URL onlineResource)
- throws UnsupportedOperationException {
- return new InternalExecuteProcessRequest(onlineResource, null);
- }
-
- public static class InternalExecuteProcessRequest extends AbstractExecuteProcessRequest {
-
+ public Response createResponse(HTTPResponse httpResponse) throws ServiceException, IOException
+ {
+ return new DescribeProcessResponse(httpResponse);
+ }
+ }
+
+ public static class InternalExecuteProcessRequest extends AbstractExecuteProcessRequest
+ {
+
/**
* @param onlineResource
* @param properties
*/
- public InternalExecuteProcessRequest( URL onlineResource, Properties properties ) {
+ public InternalExecuteProcessRequest(URL onlineResource, Properties properties)
+ {
super(onlineResource, properties);
}
- protected void initVersion() {
+ protected void initVersion()
+ {
setProperty(VERSION, "1.0.0");
}
-
- public Response createResponse(HTTPResponse response) throws ServiceException, IOException {
- return new ExecuteProcessResponse(response);
- }
-
- }
+
+ public Response createResponse(HTTPResponse httpResponse) throws ServiceException, IOException
+ {
+ return new ExecuteProcessResponse(httpResponse);
+ }
+
+ }
+
+ public static class InternalGetExecutionStatusRequest extends AbstractGetExecutionStatusRequest
+ {
+
+ /**
+ * @param onlineResource
+ * @param properties
+ */
+ public InternalGetExecutionStatusRequest(URL onlineResource, Properties properties)
+ {
+ super(onlineResource, properties);
+ }
+
+ protected void initVersion()
+ {
+ setProperty(VERSION, "1.0.0");
+ }
+
+ public Response createResponse(HTTPResponse httpResponse) throws ServiceException, IOException
+ {
+ return new GetExecutionStatusResponse(httpResponse);
+ }
+ }
+
}
Modified: trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPSFactory.java
===================================================================
--- trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPSFactory.java 2011-12-29 14:27:14 UTC (rev 38454)
+++ trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPSFactory.java 2012-01-04 11:40:08 UTC (rev 38455)
@@ -3,7 +3,7 @@
* http://geotools.org
*
* (C) 2004-2008, Open Source Geospatial Foundation (OSGeo)
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
@@ -30,22 +30,24 @@
import org.geotools.text.Text;
import org.opengis.util.InternationalString;
+
/**
* This class acts as a ProcessFactory for any process. It handles converting related bean
* structures into a ProcessFactory object, and can be created from a describeprocess response and
* can be passed around as a process encompassing object for ease of use. This factory can make a
* representation of a process and its "execute" method will actually build a request to the server
* to execute the process and return the results.
- *
+ *
* @author GDavis
- *
*
*
*
*
+ *
* @source $URL$
*/
-public class WPSFactory extends SingleProcessFactory {
+public class WPSFactory extends SingleProcessFactory
+{
private ProcessDescriptionType pdt;
@@ -63,7 +65,8 @@
private Map<String, Parameter<?>> resultInfo = new TreeMap<String, Parameter<?>>();
- public WPSFactory(ProcessDescriptionType pdt, URL serverUrl) {
+ public WPSFactory(ProcessDescriptionType pdt, URL serverUrl)
+ {
this.pdt = pdt;
this.serverUrl = serverUrl;
buildValuesFromProcessDescriptionType();
@@ -71,14 +74,15 @@
/**
* Go through the ProcessDescriptionType object tree and set this flactory's values based on it.
- *
+ *
* @param pdt
*/
- private void buildValuesFromProcessDescriptionType() {
+ private void buildValuesFromProcessDescriptionType()
+ {
this.version = this.pdt.getProcessVersion();
this.title = this.pdt.getTitle().getValue();
this.identifier = this.pdt.getIdentifier().getValue();
- this.description = WPSUtils.isAbstractNull(this.pdt) ? "" : this.pdt.getAbstract().getValue();
+ this.description = WPSUtils.isAbstractNull(this.pdt) ? "" : this.pdt.getAbstract().getValue();
this.parameterInfo = WPSUtils.createInputParamMap(this.pdt, this.parameterInfo);
this.resultInfo = WPSUtils.createOutputParamMap(this.pdt, this.resultInfo);
}
@@ -86,45 +90,54 @@
/**
* Create a representation of a process
*/
- public Process create() {
+ public Process create()
+ {
return new WPSProcess(this);
}
- public InternationalString getDescription() {
+ public InternationalString getDescription()
+ {
return Text.text(description);
}
- public Map<String, Parameter<?>> getParameterInfo() {
+ public Map<String, Parameter<?>> getParameterInfo()
+ {
return Collections.unmodifiableMap(parameterInfo);
}
- public Map<String, Parameter<?>> getResultInfo(Map<String, Object> parameters)
- throws IllegalArgumentException {
+ public Map<String, Parameter<?>> getResultInfo(Map<String, Object> parameters) throws IllegalArgumentException
+ {
return Collections.unmodifiableMap(resultInfo);
}
- public InternationalString getTitle() {
+ public InternationalString getTitle()
+ {
return Text.text(title);
}
- public String getIdentifier() {
+ public String getIdentifier()
+ {
return identifier;
}
- public String getVersion() {
+ public String getVersion()
+ {
return version;
}
- public boolean supportsProgress() {
+ public boolean supportsProgress()
+ {
// unknown, so return false
return false;
}
- public ProcessDescriptionType getProcessDescriptionType() {
+ public ProcessDescriptionType getProcessDescriptionType()
+ {
return this.pdt;
}
- public URL getServerURL() {
+ public URL getServerURL()
+ {
return this.serverUrl;
}
Modified: trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPSProcess.java
===================================================================
--- trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPSProcess.java 2011-12-29 14:27:14 UTC (rev 38454)
+++ trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPSProcess.java 2012-01-04 11:40:08 UTC (rev 38455)
@@ -94,35 +94,33 @@
// loop through each expected input in the describeprocess, and set it
// based on what we have in the provided input map.
- if (pdt.getDataInputs()!=null){
- EList inputs = pdt.getDataInputs().getInput();
- Iterator iterator = inputs.iterator();
- while (iterator.hasNext()) {
- InputDescriptionType idt = (InputDescriptionType) iterator.next();
- String identifier = idt.getIdentifier().getValue();
- Object inputValue = input.get(identifier);
- if (inputValue != null) {
- // if our value is some sort of collection, then created multiple
- // dataTypes for this inputdescriptiontype.
- List<DataType> list = new ArrayList<DataType>();
- if (inputValue instanceof Map) {
- for (Object inVal : ((Map)inputValue).values()) {
- DataType createdInput = WPSUtils.createInputDataType(inVal, idt);
- list.add(createdInput);
- }
- } else if (inputValue instanceof Collection) {
- for (Object inVal : (Collection)inputValue) {
- DataType createdInput = WPSUtils.createInputDataType(inVal, idt);
- list.add(createdInput);
- }
- } else {
- // our value is a single object so create a single datatype for it
- DataType createdInput = WPSUtils.createInputDataType(inputValue, idt);
+ EList inputs = pdt.getDataInputs().getInput();
+ Iterator iterator = inputs.iterator();
+ while (iterator.hasNext()) {
+ InputDescriptionType idt = (InputDescriptionType) iterator.next();
+ String identifier = idt.getIdentifier().getValue();
+ Object inputValue = input.get(identifier);
+ if (inputValue != null) {
+ // if our value is some sort of collection, then created multiple
+ // dataTypes for this inputdescriptiontype.
+ List<DataType> list = new ArrayList<DataType>();
+ if (inputValue instanceof Map) {
+ for (Object inVal : ((Map)inputValue).values()) {
+ DataType createdInput = WPSUtils.createInputDataType(inVal, idt);
list.add(createdInput);
}
- // add the input to the execute request
- exeRequest.addInput(identifier, list);
+ } else if (inputValue instanceof Collection) {
+ for (Object inVal : (Collection)inputValue) {
+ DataType createdInput = WPSUtils.createInputDataType(inVal, idt);
+ list.add(createdInput);
+ }
+ } else {
+ // our value is a single object so create a single datatype for it
+ DataType createdInput = WPSUtils.createInputDataType(inputValue, idt);
+ list.add(createdInput);
}
+ // add the input to the execute request
+ exeRequest.addInput(identifier, list);
}
}
Modified: trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPSSpecification.java
===================================================================
--- trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPSSpecification.java 2011-12-29 14:27:14 UTC (rev 38454)
+++ trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPSSpecification.java 2012-01-04 11:40:08 UTC (rev 38455)
@@ -3,7 +3,7 @@
* http://geotools.org
*
* (C) 2004-2008, Open Source Geospatial Foundation (OSGeo)
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
@@ -17,37 +17,63 @@
package org.geotools.data.wps;
import java.net.URL;
+import java.util.List;
+import net.opengis.wps10.DataType;
+import net.opengis.wps10.OutputDefinitionType;
+import net.opengis.wps10.ResponseDocumentType;
+import net.opengis.wps10.ResponseFormType;
+
import org.geotools.data.ows.Specification;
import org.geotools.data.wps.request.DescribeProcessRequest;
import org.geotools.data.wps.request.ExecuteProcessRequest;
+import org.geotools.data.wps.request.GetExecutionStatusRequest;
/**
- *
*
+ *
* @source $URL$
*/
-public abstract class WPSSpecification extends Specification {
+public abstract class WPSSpecification extends Specification
+{
/**
* Creates a DescribeProcess request which can be used to retrieve
* information about a specific process on the WPS Server.
- *
+ *
* @param onlineResource the location where the request can be made
* @return a DescribeProcessRequest to be configured and then passed to the WPS Server
* @throws UnsupportedOperationException if the version of the specification doesn't support this request
*/
- public abstract DescribeProcessRequest createDescribeProcessRequest( URL onlineResource ) throws UnsupportedOperationException;
+ public abstract DescribeProcessRequest createDescribeProcessRequest(URL onlineResource)
+ throws UnsupportedOperationException;
/**
* Creates a Execute request which can be used to execute
* a specific process on the WPS Server.
- *
+ *
* @param onlineResource the location where the request can be made
* @return an ExecuteProcessRequest to be configured and then passed to the WPS Server
* @throws UnsupportedOperationException if the version of the specification doesn't support this request
*/
- public abstract ExecuteProcessRequest createExecuteProcessRequest( URL onlineResource ) throws UnsupportedOperationException;
-
- }
+ public abstract ExecuteProcessRequest createExecuteProcessRequest(URL onlineResource)
+ throws UnsupportedOperationException;
+
+ public abstract GetExecutionStatusRequest createGetExecutionStatusRequest(URL onlineResource)
+ throws UnsupportedOperationException;
+
+ public abstract DataType createLiteralInputValue(String literalValue);
+
+ public abstract DataType createBoundingBoxInputValue(String crs, int dimensions, List<Double> lowerCorner,
+ List<Double> upperCorner);
+
+ public abstract ResponseFormType createResponseForm(ResponseDocumentType responseDoc,
+ OutputDefinitionType rawOutput);
+
+ public abstract ResponseDocumentType createResponseDocumentType(boolean lineage, boolean status,
+ boolean storeExecuteResponse, String outputType);
+
+ public abstract OutputDefinitionType createOutputDefinitionType(String identifier);
+
+}
Modified: trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPSUtils.java
===================================================================
--- trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPSUtils.java 2011-12-29 14:27:14 UTC (rev 38454)
+++ trunk/modules/unsupported/wps/src/main/java/org/geotools/data/wps/WPSUtils.java 2012-01-04 11:40:08 UTC (rev 38455)
@@ -22,6 +22,8 @@
import java.util.Map;
import java.util.TreeMap;
+import com.vividsolutions.jts.geom.Geometry;
+
import net.opengis.wps10.ComplexDataCombinationsType;
import net.opengis.wps10.ComplexDataDescriptionType;
import net.opengis.wps10.ComplexDataType;
@@ -47,11 +49,10 @@
import org.geotools.util.Converters;
import org.opengis.util.InternationalString;
-import com.vividsolutions.jts.geom.Geometry;
/**
* Contains helpful static util methods for the WPS module
- *
+ *
* @author gdavis
*
*
@@ -59,7 +60,8 @@
*
* @source $URL$
*/
-public class WPSUtils {
+public class WPSUtils
+{
/**
* static ints representing the input types
@@ -71,31 +73,40 @@
/**
* Creates a DataType input object from the given object and InputDescriptionType (from a
* describeprocess) and decides if the input is a literal or complex data based on its type.
- *
+ *
* @param obj
* the base input object
* @param idt
* input description type defining the input
* @return the created DataType input object
*/
- public static DataType createInputDataType(Object obj, InputDescriptionType idt) {
+ public static DataType createInputDataType(Object obj, InputDescriptionType idt)
+ {
int inputtype = 0;
// first try to figure out if the input is a literal or complex based
// on the data in the idt
LiteralInputType literalData = idt.getLiteralData();
SupportedComplexDataInputType complexData = idt.getComplexData();
- if (literalData != null) {
+ if (literalData != null)
+ {
inputtype = INPUTTYPE_LITERAL;
- } else if (complexData != null) {
+ }
+ else if (complexData != null)
+ {
inputtype = INPUTTYPE_COMPLEXDATA;
- } else {
+ }
+ else
+ {
// is the value a literal? Do a very basic test here for common
// literal types. TODO: figure out a more thorough test here
- if (obj instanceof String || obj instanceof Double || obj instanceof Float
- || obj instanceof Integer) {
+ if ((obj instanceof String) || (obj instanceof Double) || (obj instanceof Float) ||
+ (obj instanceof Integer))
+ {
inputtype = INPUTTYPE_LITERAL;
- } else {
+ }
+ else
+ {
// assume complex data
inputtype = INPUTTYPE_COMPLEXDATA;
}
@@ -103,10 +114,10 @@
// now create the input based on its type
String schema = null;
- if (inputtype == INPUTTYPE_COMPLEXDATA) {
+ if (inputtype == INPUTTYPE_COMPLEXDATA)
+ {
ComplexDataCombinationsType supported = complexData.getSupported();
- ComplexDataDescriptionType cddt = (ComplexDataDescriptionType) supported.getFormat()
- .get(0);
+ ComplexDataDescriptionType cddt = (ComplexDataDescriptionType) supported.getFormat().get(0);
schema = cddt.getSchema();
}
@@ -115,7 +126,7 @@
/**
* Creates a DataType input object from the given object, schema and type (complex or literal).
- *
+ *
* @param obj
* the base input object
* @param type
@@ -124,15 +135,19 @@
* only used for type complexdata
* @return the created DataType input object
*/
- public static DataType createInputDataType(Object obj, int type, String schema) {
+ public static DataType createInputDataType(Object obj, int type, String schema)
+ {
DataType dt = Wps10Factory.eINSTANCE.createDataType();
- if (type == INPUTTYPE_LITERAL) {
+ if (type == INPUTTYPE_LITERAL)
+ {
LiteralDataType ldt = Wps10Factory.eINSTANCE.createLiteralDataType();
ldt.setValue(obj.toString());
dt.setLiteralData(ldt);
- } else {
+ }
+ else
+ {
// assume complex data
ComplexDataType cdt = Wps10Factory.eINSTANCE.createComplexDataType();
@@ -142,47 +157,61 @@
// cdt.getMixed().add(obj);
cdt.getData().add(obj);
- if (schema != null) {
+ if (schema != null)
+ {
cdt.setSchema(schema);
}
dt.setComplexData(cdt);
}
+
return dt;
}
/**
* Create a map of <String name, Parameter> inputs for a process based on its describeProcess.
- *
+ *
* @param processDesc
* @param map
* add the inputs to the given map (create it if null)
* @return map of name,Parameter representing the input params for this process
*/
public static Map<String, Parameter<?>> createInputParamMap(ProcessDescriptionType processDesc,
- Map<String, Parameter<?>> map) {
- if (map == null) {
+ Map<String, Parameter<?>> map)
+ {
+ if (map == null)
+ {
map = new TreeMap<String, Parameter<?>>();
}
// loop through the process desc and setup each input param
DataInputsType dataInputs = processDesc.getDataInputs();
if (dataInputs == null)
+ {
return null;
+ }
+
EList inputs = dataInputs.getInput();
- if (inputs == null || inputs.isEmpty())
+ if ((inputs == null) || inputs.isEmpty())
+ {
return null;
+ }
+
Iterator iterator = inputs.iterator();
- while (iterator.hasNext()) {
+ while (iterator.hasNext())
+ {
InputDescriptionType idt = (InputDescriptionType) iterator.next();
// determine if the input is a literal or complex data, and from that
// find out what type the object should be
LiteralInputType literalData = idt.getLiteralData();
SupportedComplexDataInputType complexData = idt.getComplexData();
Class type = Object.class;
- if (literalData != null) {
+ if (literalData != null)
+ {
String reference = literalData.getDataType().getReference();
type = getLiteralTypeFromReference(reference);
- } else if (complexData != null) {
+ }
+ else if (complexData != null)
+ {
// TODO: get all supported types and determine how to handle that, not just the
// default.
ComplexDataDescriptionType format = complexData.getDefault().getFormat();
@@ -190,25 +219,31 @@
String mimetype = format.getMimeType();
String schema = format.getSchema();
if (encoding == null)
+ {
encoding = "";
+ }
if ...
[truncated message content] |
|
From: <blu...@ho...> - 2012-01-01 03:11:33
|
บนเฟซบุ๊คของ เพียงดิน รักไทย ใครคือ ไอ้หมาน ช่วยตอบให้หน่อย http://www.facebook.com/pages/เพียงดิน/273785206004843 |
|
From: <4ev...@gm...> - 2011-12-30 07:11:57
|
ทำไมกลุ่มนิติราษฎร์จึงเคลื่อนไหวขอยกเลิก ประมวลกฎหมายอาญามาตรา 112
หากไม่มีเจตนา แอบแฝงซ่อนเร้นต้องการล้มล้างสถาบันพระมหากษัตริย์
อย่างที่มีหลายฝ่ายตั้งข้อสงสัยซึ่งมีความสอดคล้องกับความเคลื่อนไหวของ
พรรคการเมืองเพื่อไทย ที่ต้องการแก้ไขรัฐธรรมนูญฉบับปี 2550 โดยอ้างสาเหตุ
ว่าเป็นรัฐธรรมนูญที่มาจากการรัฐประหาร
อย่าลืมว่าการรัฐประหารเมื่อวันที่ 19 กันยายน 2549 ของคณะทหารหรือ
คณะมนตรีความมั่นคง แห่งชาตินั้นมีความแตกต่างจากการก่อรัฐประหารของ
คณะทหารก่อนหน้านี้รวม 9 ครั้ง ในประวัติศาสตร์ ที่ผ่านมาเพราะเป็นการรัฐประหาร
เพื่อกำจัดคนโกงบ้านโกงเมือง
หรือว่าคณะนิติราษฎร์จะมีเจตนา ที่ต้องการช่วยให้คนโกงกลับมามีอำนาจการเมืองอีกครั้งในประเทศไทย
นายอรรถพร พลบุตร “ผมไม่เข้าใจความนึก คิดของอาจารย์กลุ่มเล็กๆ กลุ่มนี้ว่า การที่
กฏหมายห้ามหมิ่นประมาท ดูหมิ่น หรือแสดงความอาฆาตมาดร้ายพระมหากษัตริย์จะทำให้บ้าน
ถล่มดินทลาย หรือทำให้คนกลุ่มนี้ขาดใจตายหรืออย่างไร จึงต้องดิ้นรนทุกวิถีทางที่จะแก้ไขมาตรา
112”
|
|
From: <svn...@os...> - 2011-12-29 14:27:21
|
Author: aaime
Date: 2011-12-29 06:27:14 -0800 (Thu, 29 Dec 2011)
New Revision: 38454
Added:
branches/2.7.x/modules/library/coverage/src/test/java/org/geotools/image/ColorUtilitiesTest.java
Modified:
branches/2.7.x/modules/library/coverage/src/main/java/org/geotools/resources/image/ColorUtilities.java
Log:
[GEOT-3992] Derive a new index color model from a translucent index color model and a background color
Modified: branches/2.7.x/modules/library/coverage/src/main/java/org/geotools/resources/image/ColorUtilities.java
===================================================================
--- branches/2.7.x/modules/library/coverage/src/main/java/org/geotools/resources/image/ColorUtilities.java 2011-12-29 11:45:35 UTC (rev 38453)
+++ branches/2.7.x/modules/library/coverage/src/main/java/org/geotools/resources/image/ColorUtilities.java 2011-12-29 14:27:14 UTC (rev 38454)
@@ -17,6 +17,7 @@
package org.geotools.resources.image;
import java.awt.Color;
+import java.awt.Transparency;
import java.awt.color.ColorSpace;
import java.awt.image.ColorModel;
import java.awt.image.DataBuffer;
@@ -521,6 +522,73 @@
}
/**
+ * Applies the specified background color to an index color model, building a new index color
+ * model (or returning the same index color mode if it has no transparency at all)
+ */
+ public static IndexColorModel applyBackgroundColor(IndexColorModel icm, Color bg) {
+ int trasparentIdx = icm.getTransparentPixel();
+ if (icm.getTransparency() == Transparency.OPAQUE && trasparentIdx == -1) {
+ // no transparency at all
+ return icm;
+ }
+
+ // grab the components
+ int size = icm.getMapSize();
+ byte[] reds = new byte[size];
+ byte[] greens = new byte[size];
+ byte[] blues = new byte[size];
+ icm.getReds(reds);
+ icm.getGreens(greens);
+ icm.getBlues(blues);
+
+ // single transparent pixel? replace it
+ if (icm.getTransparency() == Transparency.OPAQUE && trasparentIdx != -1) {
+ reds[trasparentIdx] = (byte) bg.getRed();
+ greens[trasparentIdx] = (byte) bg.getGreen();
+ blues[trasparentIdx] = (byte) bg.getBlue();
+ return new IndexColorModel(icm.getPixelSize(), size, reds, greens, blues);
+ } else {
+ // grab the alpha and do the merge
+ byte[] alphas = new byte[size];
+ icm.getAlphas(alphas);
+
+ int r = bg.getRed() & 0xFF;
+ int g = bg.getGreen() & 0xFF;
+ int b = bg.getBlue() & 0xFF;
+ int a = bg.getAlpha() & 0xFF;
+ for (int i = 0; i < size; i++) {
+ int t1 = alphas[i] & 0xFF; // a1
+ float t2 = (a & 0xFF) * (1.0f - t1 / 255f); // a2 * (1 - a1 / maxValue)
+ float t3 = t1 + t2; // output alpha
+ float t4, t5;
+ if (t3 == 0.0F) {
+ t4 = 0.0F;
+ t5 = 0.0F;
+ } else {
+ t4 = t1 / t3;
+ t5 = 1.0f - t4;
+ }
+
+ int ri = reds[i] & 0xFF;
+ reds[i] = (byte) (ri * t4 + r * t5);
+ int gi = greens[i] & 0xFF;
+ greens[i] = (byte) (gi * t4 + g * t5);
+ int bi = blues[i] & 0xFF;
+ blues[i] = (byte) (bi * t4 + b * t5);
+ alphas[i] = (byte) t3;
+ }
+
+ // if the bg color had transparency we still have a translucent image, otherwise
+ // an opaque one
+ if (a < 255) {
+ return new IndexColorModel(icm.getPixelSize(), size, reds, greens, blues, alphas);
+ } else {
+ return new IndexColorModel(icm.getPixelSize(), size, reds, greens, blues);
+ }
+ }
+ }
+
+ /**
* Provide the maximum allowe value for a certain data type.
* @param dataType the data type to suggest a maximum value for.
* @return the data type maximum value for.
Added: branches/2.7.x/modules/library/coverage/src/test/java/org/geotools/image/ColorUtilitiesTest.java
===================================================================
--- branches/2.7.x/modules/library/coverage/src/test/java/org/geotools/image/ColorUtilitiesTest.java (rev 0)
+++ branches/2.7.x/modules/library/coverage/src/test/java/org/geotools/image/ColorUtilitiesTest.java 2011-12-29 14:27:14 UTC (rev 38454)
@@ -0,0 +1,84 @@
+package org.geotools.image;
+
+import static org.junit.Assert.*;
+
+import java.awt.Color;
+import java.awt.Transparency;
+import java.awt.image.IndexColorModel;
+
+import org.geotools.resources.image.ColorUtilities;
+import org.junit.Test;
+
+public class ColorUtilitiesTest {
+
+ @Test
+ public void mergeSolidBackgroundSolidPalette() {
+ byte[] r = new byte[] {-1, 0, 0};
+ byte[] g = new byte[] {0, -1, 0};
+ byte[] b = new byte[] {0, 0, -1};
+ IndexColorModel icm = new IndexColorModel(2, 3, r, g, b);
+ IndexColorModel merged = ColorUtilities.applyBackgroundColor(icm, Color.WHITE);
+ assertFalse(merged.hasAlpha());
+ assertEquals(merged.getTransparency(), Transparency.OPAQUE);
+ byte[] mr = new byte[3];
+ byte[] mb = new byte[3];
+ byte[] mg = new byte[3];
+ merged.getReds(mr);
+ merged.getGreens(mg);
+ merged.getBlues(mb);
+ for (int i = 0; i < r.length; i++) {
+ assertEquals(r[i], mr[i]);
+ assertEquals(g[i], mg[i]);
+ assertEquals(b[i], mb[i]);
+ }
+ }
+
+ @Test
+ public void mergeSolidBackgroundTranslucentPalette() {
+ byte[] r = new byte[] {-1, 0, 0};
+ byte[] g = new byte[] {0, -1, 0};
+ byte[] b = new byte[] {0, 0, -1};
+ byte[] a = new byte[] {-128, -128, -128};
+ IndexColorModel icm = new IndexColorModel(2, 3, r, g, b, a);
+ IndexColorModel merged = ColorUtilities.applyBackgroundColor(icm, Color.WHITE);
+ assertFalse(merged.hasAlpha());
+ assertEquals(merged.getTransparency(), Transparency.OPAQUE);
+ byte[] mr = new byte[3];
+ byte[] mb = new byte[3];
+ byte[] mg = new byte[3];
+ merged.getReds(mr);
+ merged.getGreens(mg);
+ merged.getBlues(mb);
+ for (int i = 0; i < r.length; i++) {
+ assertEquals((r[i] & 0xFF) == 255 ? 255 : 126, mr[i] & 0xFF);
+ assertEquals((g[i] & 0xFF) == 255 ? 255 : 126, mg[i] & 0xFF);
+ assertEquals((b[i] & 0xFF) == 255 ? 255 : 126, mb[i] & 0xFF);
+ }
+ }
+
+ @Test
+ public void mergeTranslucentBackgroundTranslucentPalette() {
+ byte[] r = new byte[] {-1, 0, 0};
+ byte[] g = new byte[] {0, -1, 0};
+ byte[] b = new byte[] {0, 0, -1};
+ byte[] a = new byte[] {-128, -128, -128};
+ IndexColorModel icm = new IndexColorModel(2, 3, r, g, b, a);
+ IndexColorModel merged = ColorUtilities.applyBackgroundColor(icm, new Color(255, 255, 255, 128));
+ assertTrue(merged.hasAlpha());
+ assertEquals(merged.getTransparency(), Transparency.TRANSLUCENT);
+ byte[] mr = new byte[3];
+ byte[] mb = new byte[3];
+ byte[] mg = new byte[3];
+ byte[] ma = new byte[3];
+ merged.getReds(mr);
+ merged.getGreens(mg);
+ merged.getBlues(mb);
+ merged.getAlphas(ma);
+ for (int i = 0; i < r.length; i++) {
+ assertEquals((r[i] & 0xFF) == 255 ? 255 : 84, mr[i] & 0xFF);
+ assertEquals((g[i] & 0xFF) == 255 ? 255 : 84, mg[i] & 0xFF);
+ assertEquals((b[i] & 0xFF) == 255 ? 255 : 84, mb[i] & 0xFF);
+ assertEquals(191, ma[i] & 0xFF);
+ }
+ }
+}
|
|
From: <svn...@os...> - 2011-12-29 11:45:42
|
Author: aaime
Date: 2011-12-29 03:45:35 -0800 (Thu, 29 Dec 2011)
New Revision: 38453
Added:
trunk/modules/library/coverage/src/test/java/org/geotools/image/ColorUtilitiesTest.java
Modified:
trunk/modules/library/coverage/src/main/java/org/geotools/resources/image/ColorUtilities.java
Log:
[GEOT-3992] Derive a new index color model from a translucent index color model and a background color
Modified: trunk/modules/library/coverage/src/main/java/org/geotools/resources/image/ColorUtilities.java
===================================================================
--- trunk/modules/library/coverage/src/main/java/org/geotools/resources/image/ColorUtilities.java 2011-12-27 10:57:10 UTC (rev 38452)
+++ trunk/modules/library/coverage/src/main/java/org/geotools/resources/image/ColorUtilities.java 2011-12-29 11:45:35 UTC (rev 38453)
@@ -17,6 +17,7 @@
package org.geotools.resources.image;
import java.awt.Color;
+import java.awt.Transparency;
import java.awt.color.ColorSpace;
import java.awt.image.ColorModel;
import java.awt.image.DataBuffer;
@@ -522,6 +523,73 @@
}
/**
+ * Applies the specified background color to an index color model, building a new index color
+ * model (or returning the same index color mode if it has no transparency at all)
+ */
+ public static IndexColorModel applyBackgroundColor(IndexColorModel icm, Color bg) {
+ int trasparentIdx = icm.getTransparentPixel();
+ if (icm.getTransparency() == Transparency.OPAQUE && trasparentIdx == -1) {
+ // no transparency at all
+ return icm;
+ }
+
+ // grab the components
+ int size = icm.getMapSize();
+ byte[] reds = new byte[size];
+ byte[] greens = new byte[size];
+ byte[] blues = new byte[size];
+ icm.getReds(reds);
+ icm.getGreens(greens);
+ icm.getBlues(blues);
+
+ // single transparent pixel? replace it
+ if (icm.getTransparency() == Transparency.OPAQUE && trasparentIdx != -1) {
+ reds[trasparentIdx] = (byte) bg.getRed();
+ greens[trasparentIdx] = (byte) bg.getGreen();
+ blues[trasparentIdx] = (byte) bg.getBlue();
+ return new IndexColorModel(icm.getPixelSize(), size, reds, greens, blues);
+ } else {
+ // grab the alpha and do the merge
+ byte[] alphas = new byte[size];
+ icm.getAlphas(alphas);
+
+ int r = bg.getRed() & 0xFF;
+ int g = bg.getGreen() & 0xFF;
+ int b = bg.getBlue() & 0xFF;
+ int a = bg.getAlpha() & 0xFF;
+ for (int i = 0; i < size; i++) {
+ int t1 = alphas[i] & 0xFF; // a1
+ float t2 = (a & 0xFF) * (1.0f - t1 / 255f); // a2 * (1 - a1 / maxValue)
+ float t3 = t1 + t2; // output alpha
+ float t4, t5;
+ if (t3 == 0.0F) {
+ t4 = 0.0F;
+ t5 = 0.0F;
+ } else {
+ t4 = t1 / t3;
+ t5 = 1.0f - t4;
+ }
+
+ int ri = reds[i] & 0xFF;
+ reds[i] = (byte) (ri * t4 + r * t5);
+ int gi = greens[i] & 0xFF;
+ greens[i] = (byte) (gi * t4 + g * t5);
+ int bi = blues[i] & 0xFF;
+ blues[i] = (byte) (bi * t4 + b * t5);
+ alphas[i] = (byte) t3;
+ }
+
+ // if the bg color had transparency we still have a translucent image, otherwise
+ // an opaque one
+ if (a < 255) {
+ return new IndexColorModel(icm.getPixelSize(), size, reds, greens, blues, alphas);
+ } else {
+ return new IndexColorModel(icm.getPixelSize(), size, reds, greens, blues);
+ }
+ }
+ }
+
+ /**
* Provide the maximum allowe value for a certain data type.
* @param dataType the data type to suggest a maximum value for.
* @return the data type maximum value for.
Added: trunk/modules/library/coverage/src/test/java/org/geotools/image/ColorUtilitiesTest.java
===================================================================
--- trunk/modules/library/coverage/src/test/java/org/geotools/image/ColorUtilitiesTest.java (rev 0)
+++ trunk/modules/library/coverage/src/test/java/org/geotools/image/ColorUtilitiesTest.java 2011-12-29 11:45:35 UTC (rev 38453)
@@ -0,0 +1,84 @@
+package org.geotools.image;
+
+import static org.junit.Assert.*;
+
+import java.awt.Color;
+import java.awt.Transparency;
+import java.awt.image.IndexColorModel;
+
+import org.geotools.resources.image.ColorUtilities;
+import org.junit.Test;
+
+public class ColorUtilitiesTest {
+
+ @Test
+ public void mergeSolidBackgroundSolidPalette() {
+ byte[] r = new byte[] {-1, 0, 0};
+ byte[] g = new byte[] {0, -1, 0};
+ byte[] b = new byte[] {0, 0, -1};
+ IndexColorModel icm = new IndexColorModel(2, 3, r, g, b);
+ IndexColorModel merged = ColorUtilities.applyBackgroundColor(icm, Color.WHITE);
+ assertFalse(merged.hasAlpha());
+ assertEquals(merged.getTransparency(), Transparency.OPAQUE);
+ byte[] mr = new byte[3];
+ byte[] mb = new byte[3];
+ byte[] mg = new byte[3];
+ merged.getReds(mr);
+ merged.getGreens(mg);
+ merged.getBlues(mb);
+ for (int i = 0; i < r.length; i++) {
+ assertEquals(r[i], mr[i]);
+ assertEquals(g[i], mg[i]);
+ assertEquals(b[i], mb[i]);
+ }
+ }
+
+ @Test
+ public void mergeSolidBackgroundTranslucentPalette() {
+ byte[] r = new byte[] {-1, 0, 0};
+ byte[] g = new byte[] {0, -1, 0};
+ byte[] b = new byte[] {0, 0, -1};
+ byte[] a = new byte[] {-128, -128, -128};
+ IndexColorModel icm = new IndexColorModel(2, 3, r, g, b, a);
+ IndexColorModel merged = ColorUtilities.applyBackgroundColor(icm, Color.WHITE);
+ assertFalse(merged.hasAlpha());
+ assertEquals(merged.getTransparency(), Transparency.OPAQUE);
+ byte[] mr = new byte[3];
+ byte[] mb = new byte[3];
+ byte[] mg = new byte[3];
+ merged.getReds(mr);
+ merged.getGreens(mg);
+ merged.getBlues(mb);
+ for (int i = 0; i < r.length; i++) {
+ assertEquals((r[i] & 0xFF) == 255 ? 255 : 126, mr[i] & 0xFF);
+ assertEquals((g[i] & 0xFF) == 255 ? 255 : 126, mg[i] & 0xFF);
+ assertEquals((b[i] & 0xFF) == 255 ? 255 : 126, mb[i] & 0xFF);
+ }
+ }
+
+ @Test
+ public void mergeTranslucentBackgroundTranslucentPalette() {
+ byte[] r = new byte[] {-1, 0, 0};
+ byte[] g = new byte[] {0, -1, 0};
+ byte[] b = new byte[] {0, 0, -1};
+ byte[] a = new byte[] {-128, -128, -128};
+ IndexColorModel icm = new IndexColorModel(2, 3, r, g, b, a);
+ IndexColorModel merged = ColorUtilities.applyBackgroundColor(icm, new Color(255, 255, 255, 128));
+ assertTrue(merged.hasAlpha());
+ assertEquals(merged.getTransparency(), Transparency.TRANSLUCENT);
+ byte[] mr = new byte[3];
+ byte[] mb = new byte[3];
+ byte[] mg = new byte[3];
+ byte[] ma = new byte[3];
+ merged.getReds(mr);
+ merged.getGreens(mg);
+ merged.getBlues(mb);
+ merged.getAlphas(ma);
+ for (int i = 0; i < r.length; i++) {
+ assertEquals((r[i] & 0xFF) == 255 ? 255 : 84, mr[i] & 0xFF);
+ assertEquals((g[i] & 0xFF) == 255 ? 255 : 84, mg[i] & 0xFF);
+ assertEquals((b[i] & 0xFF) == 255 ? 255 : 84, mb[i] & 0xFF);
+ assertEquals(191, ma[i] & 0xFF);
+ }
+ }
+}
|