a bit of style and the more generous proxy

git-svn-id: http://svn.openlayers.org/trunk/openlayers@7135 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2008-05-10 05:20:59 +00:00
parent 181efd8ed4
commit 1aab3aa3d2

View File

@@ -1,18 +1,24 @@
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" /> <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
<style type="text/css"> <link rel="stylesheet" href="style.css" type="text/css" />
#map { <style>
width: 800px; .olControlSaveFeaturesItemActive {
height: 512px; background-image: url("../theme/default/img/save_features_on.png");
border: 1px solid black; background-repeat: no-repeat;
background-position: 0px 1px;
}
.olControlSaveFeaturesItemInactive {
background-image: url("../theme/default/img/save_features_off.png");
background-repeat: no-repeat;
background-position: 0px 1px;
} }
</style> </style>
<script src="../lib/Firebug/firebug.js"></script> <script src="../lib/Firebug/firebug.js"></script>
<script src="../lib/OpenLayers.js"></script> <script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var map, wfs; var map, wfs;
OpenLayers.ProxyHost= "proxy.cgi?url="; OpenLayers.ProxyHost = "/proxy/?url=";
function init() { function init() {
map = new OpenLayers.Map('map'); map = new OpenLayers.Map('map');
@@ -29,7 +35,10 @@
{ {
typename: "tasmania_cities", typename: "tasmania_cities",
featureNS: "http://www.openplans.org/topp", featureNS: "http://www.openplans.org/topp",
extractAttributes: false extractAttributes: false,
commitReport: function(str) {
OpenLayers.Console.log(str);
}
} }
); );
@@ -39,7 +48,7 @@
displayClass: "olControlEditingToolbar" displayClass: "olControlEditingToolbar"
}); });
var dp = new OpenLayers.Control.DrawFeature( var draw = new OpenLayers.Control.DrawFeature(
wfs, OpenLayers.Handler.Point, wfs, OpenLayers.Handler.Point,
{ {
handlerOptions: {freehand: false}, handlerOptions: {freehand: false},
@@ -47,7 +56,12 @@
} }
); );
dp.featureAdded = function(feature) { var save = new OpenLayers.Control.Button({
trigger: OpenLayers.Function.bind(wfs.commit, wfs),
displayClass: "olControlSaveFeatures"
});
draw.featureAdded = function(feature) {
var oldgeom = feature.geometry; var oldgeom = feature.geometry;
feature.layer.renderer.eraseGeometry(oldgeom); feature.layer.renderer.eraseGeometry(oldgeom);
feature.geometry = new OpenLayers.Geometry.MultiPoint(oldgeom); feature.geometry = new OpenLayers.Geometry.MultiPoint(oldgeom);
@@ -56,29 +70,28 @@
} }
panel.addControls([ panel.addControls([
new OpenLayers.Control.Navigation(), dp new OpenLayers.Control.Navigation(),
save, draw
]); ]);
map.addControl(panel); map.addControl(panel);
map.zoomToExtent(new OpenLayers.Bounds(145.51045,-44.0,149.0,-40.5)); map.zoomToExtent(new OpenLayers.Bounds(140.64,-44.42,151.89,-38.80));
} }
</script> </script>
</head> </head>
<body onload="init()"> <body onload="init()">
<h1 id="title">WFS Example</h1> <h1 id="title">WFS Transaction Example</h1>
<div id="tags"> <div id="tags">
</div> </div>
<p id="shortdesc"> <p id="shortdesc">
Shows the use of the WFS layer type. Shows the use the WFS layer for transactions.
</p> </p>
<a href="#" onclick="OpenLayers.Console.log(wfs.commit());return false">Save Cities</a><br /> <div id="map" class="smallmap"></div>
<div id="map"></div>
<p id="docs"> <p id="docs">
This is an example of using a WFS layer type. Note that it requires a This is an example of using a WFS layer type. Note that it requires a