Addressing @tschaub's review comment.

This commit is contained in:
ahocevar
2012-08-14 13:31:41 +02:00
parent 5fff368a2d
commit 88572303fb
2 changed files with 11 additions and 10 deletions
+4 -4
View File
@@ -11,12 +11,12 @@ function init() {
layers: [new OpenLayers.Layer.Vector()] layers: [new OpenLayers.Layer.Vector()]
}); });
var features = [new OpenLayers.Format.WKT().read( var features = [new OpenLayers.Feature.Vector(OpenLayers.Geometry.fromWKT(
'LINESTRING(117 22,112 18,118 13, 115 8)' 'LINESTRING(117 22,112 18,118 13, 115 8)'
)]; ))];
var geometry = (new OpenLayers.Format.WKT().read( var geometry = OpenLayers.Geometry.fromWKT(
'POLYGON((110 20,120 20,120 10,110 10,110 20),(112 17,118 18,118 16,112 15,112 17))' 'POLYGON((110 20,120 20,120 10,110 10,110 20),(112 17,118 18,118 16,112 15,112 17))'
)).geometry; );
map.baseLayer.addFeatures(features); map.baseLayer.addFeatures(features);
map.baseLayer.addFeatures([new OpenLayers.Feature.Vector(geometry)]); map.baseLayer.addFeatures([new OpenLayers.Feature.Vector(geometry)]);
+7 -6
View File
@@ -3,6 +3,7 @@
<script src="OLLoader.js"></script> <script src="OLLoader.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var wkt = new OpenLayers.Format.WKT();
var process; var process;
var client = new OpenLayers.WPSClient({ var client = new OpenLayers.WPSClient({
servers: { servers: {
@@ -82,8 +83,8 @@
// configured with output identifier // configured with output identifier
process.execute({ process.execute({
inputs: { inputs: {
line: new OpenLayers.Format.WKT().read(line), line: wkt.read(line),
polygon: new OpenLayers.Format.WKT().read(polygon) polygon: wkt.read(polygon)
}, },
output: 'foo', output: 'foo',
success: success success: success
@@ -91,8 +92,8 @@
// configured without output identifier // configured without output identifier
process.execute({ process.execute({
inputs: { inputs: {
line: new OpenLayers.Format.WKT().read(line), line: wkt.read(line),
polygon: new OpenLayers.Format.WKT().read(polygon) polygon: wkt.read(polygon)
}, },
success: success success: success
}); });
@@ -130,10 +131,10 @@
var intersect = client.getProcess('local', 'JTS:intersection'); var intersect = client.getProcess('local', 'JTS:intersection');
intersect.configure({ intersect.configure({
inputs: { inputs: {
a: new OpenLayers.Format.WKT().read( a: wkt.read(
'LINESTRING(117 22,112 18,118 13,115 8)' 'LINESTRING(117 22,112 18,118 13,115 8)'
), ),
b: new OpenLayers.Format.WKT().read( b: wkt.read(
'POLYGON((110 20,120 20,120 10,110 10,110 20),(112 17,118 18,118 16,112 15,112 17))' 'POLYGON((110 20,120 20,120 10,110 10,110 20),(112 17,118 18,118 16,112 15,112 17))'
) )
} }