Compare commits
5 Commits
v5.3.2
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
419abc8b4a | ||
|
|
d8b8f44803 | ||
|
|
3c6cd6f559 | ||
|
|
b5103eb8ce | ||
|
|
b6fb16153c |
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
OpenLayers.js -- OpenLayers Map Viewer Library
|
OpenLayers.js -- OpenLayers Map Viewer Library
|
||||||
|
|
||||||
Copyright 2005-2006 MetaCarta, Inc., released under a modified BSD license.
|
Copyright 2005-2006 MetaCarta, Inc., released under the BSD license.
|
||||||
Please see http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
Please see http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
for the full text of the license.
|
for the full text of the license.
|
||||||
|
|
||||||
Includes compressed code under the following licenses:
|
Includes compressed code under the following licenses:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
OpenLayers contributors:
|
OpenLayers contributors:
|
||||||
Howard Butler
|
Howard Butler
|
||||||
Bertil Chaupis
|
Bertil Chaupis
|
||||||
|
John Cole
|
||||||
Jeff Dege
|
Jeff Dege
|
||||||
Schuyler Erle
|
Schuyler Erle
|
||||||
Christian López Espínola
|
Christian López Espínola
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
#map {
|
#map {
|
||||||
width: 512px;
|
width: 45%;
|
||||||
height: 350px;
|
height: 350px;
|
||||||
border: 1px solid gray;
|
border: 1px solid gray;
|
||||||
}
|
}
|
||||||
@@ -42,8 +42,8 @@
|
|||||||
</head>
|
</head>
|
||||||
<body onload="init()">
|
<body onload="init()">
|
||||||
<h1>OpenLayers Draw Point Example</h1>
|
<h1>OpenLayers Draw Point Example</h1>
|
||||||
<div style="float:right">
|
<div style="float:right;width:50%">
|
||||||
<textarea id="gml" cols="80" rows="30"></textarea>
|
<textarea id="gml" style="width:100%" rows="30"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -13,10 +13,11 @@
|
|||||||
<script src="../lib/OpenLayers.js"></script>
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
<!--
|
<!--
|
||||||
|
var map;
|
||||||
function init(){
|
function init(){
|
||||||
var map = new OpenLayers.Map('map');
|
map = new OpenLayers.Map('map');
|
||||||
|
|
||||||
var options = {maxResolution: 'auto', numZoomLevels: 3};
|
var options = {numZoomLevels: 3};
|
||||||
|
|
||||||
var graphic = new OpenLayers.Layer.Image(
|
var graphic = new OpenLayers.Layer.Image(
|
||||||
'City Lights',
|
'City Lights',
|
||||||
|
|||||||
@@ -99,25 +99,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var displayedGeom = null;
|
var displayedFeature = null;
|
||||||
function feature_info_hover(geometry) {
|
function feature_info_hover(feature) {
|
||||||
if(geometry.parent) {
|
if (displayedFeature != feature &&
|
||||||
geometry = geometry.parent;
|
(!feature.layer.selectedFeatures.length ||
|
||||||
}
|
(feature.layer.selectedFeatures[0] == feature))) {
|
||||||
if (displayedGeom != geometry &&
|
feature_info(feature);
|
||||||
(!geometry.feature.layer.selectedFeatures.length ||
|
displayedFeature = feature;
|
||||||
(geometry.feature.layer.selectedFeatures[0].geometry == geometry))) {
|
|
||||||
feature_info(geometry);
|
|
||||||
displaydGeom = geometry;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function feature_info(geometry) {
|
function feature_info(feature) {
|
||||||
if(geometry.parent) {
|
|
||||||
geometry = geometry.parent;
|
|
||||||
}
|
|
||||||
var html = "<ul>";
|
var html = "<ul>";
|
||||||
for(var i in geometry.feature.attributes)
|
for(var i in feature.attributes)
|
||||||
html += "<li><b>" + i + "</b>: "+ geometry.feature.attributes[i] + "</li>";
|
html += "<li><b>" + i + "</b>: "+ feature.attributes[i] + "</li>";
|
||||||
html += "</ul>";
|
html += "</ul>";
|
||||||
$('feature_info').innerHTML = html;
|
$('feature_info').innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|||||||
54
examples/outOfRangeMarkers.html
Normal file
54
examples/outOfRangeMarkers.html
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<style type="text/css">
|
||||||
|
#map {
|
||||||
|
width: 650px;
|
||||||
|
height: 550px;
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAKsGpqSOKkB-Ih2JopAmNbBTv_3ENzieGiNBMV02NiUJp8KZGIRTQWhul8K0wiNOHDxOF0-W2RmFoRg'></script>
|
||||||
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
<!--
|
||||||
|
function init(){
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
var map = new OpenLayers.Map('map', { controls: [] });
|
||||||
|
var lon = 35;
|
||||||
|
var lat = -6;
|
||||||
|
var zoom = 6;
|
||||||
|
var map, layer;
|
||||||
|
|
||||||
|
// Map Controls
|
||||||
|
map.addControl(new OpenLayers.Control.PanZoomBar());
|
||||||
|
map.addControl(new OpenLayers.Control.MouseToolbar());
|
||||||
|
map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));
|
||||||
|
map.addControl(new OpenLayers.Control.MousePosition());
|
||||||
|
|
||||||
|
|
||||||
|
// Map Layers
|
||||||
|
var GMapsSat = new OpenLayers.Layer.Google( "Google Satellite" , {type: G_SATELLITE_MAP, 'maxZoomLevel':18} );
|
||||||
|
var GMapsHybr = new OpenLayers.Layer.Google( "Google Hybrid" , {type: G_HYBRID_TYPE, 'maxZoomLevel':18} );
|
||||||
|
var GMapsStreets = new OpenLayers.Layer.Google( "Google Steets" , {type: G_NORMAL_MAP, 'maxZoomLevel':18} );
|
||||||
|
var MarkersLayer2 = new OpenLayers.Layer.Text( "Region info", {location: "outOfRangeMarkers.txt", maxResolution: 0.02});
|
||||||
|
|
||||||
|
// Add Layers
|
||||||
|
map.addLayers([GMapsHybr, GMapsStreets, GMapsSat, MarkersLayer2]);
|
||||||
|
|
||||||
|
|
||||||
|
// Visual
|
||||||
|
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
|
||||||
|
if (!map.getCenter()) map.zoomToMaxExtent();
|
||||||
|
}
|
||||||
|
// -->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
|
||||||
|
<body onload="init()">
|
||||||
|
|
||||||
|
<div id="map"></div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
3
examples/outOfRangeMarkers.txt
Normal file
3
examples/outOfRangeMarkers.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
point title description icon
|
||||||
|
-4.14,37.90 Kilimanjaro Beskrivning http://www.villageografica.com/Africa-Webmap/img/marker-blue.png
|
||||||
|
-3.24,34.35 Shinyanga Beskrivning http://www.villageografica.com/Africa-Webmap/img/marker-blue.png
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
|
|
||||||
|
|
||||||
zb = new OpenLayers.Control.ZoomBox();
|
zb = new OpenLayers.Control.ZoomBox();
|
||||||
panel = new OpenLayers.Control.Panel({defaultControl: zb});
|
var panel = new OpenLayers.Control.Panel({defaultControl: zb});
|
||||||
panel.addControls([
|
panel.addControls([
|
||||||
new OpenLayers.Control.MouseDefaults(),
|
new OpenLayers.Control.MouseDefaults(),
|
||||||
zb,
|
zb,
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
popup = new OpenLayers.Popup.Anchored("chicken",
|
popup = new OpenLayers.Popup.Anchored("chicken",
|
||||||
new OpenLayers.LonLat(5,40),
|
new OpenLayers.LonLat(5,40),
|
||||||
new OpenLayers.Size(200,200),
|
new OpenLayers.Size(200,200),
|
||||||
"example popup");
|
"example popup", true);
|
||||||
|
|
||||||
map.addPopup(popup);
|
map.addPopup(popup);
|
||||||
}
|
}
|
||||||
@@ -69,8 +69,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mousedown(evt) {
|
function mousedown(evt) {
|
||||||
|
// check to see if the popup was hidden by the close box
|
||||||
|
// if so, then destroy it before continuing
|
||||||
|
if (popup != null) {
|
||||||
|
if (!popup.visible()) {
|
||||||
|
markers.map.removePopup(popup);
|
||||||
|
popup.destroy();
|
||||||
|
popup = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (popup == null) {
|
if (popup == null) {
|
||||||
popup = feature.createPopup();
|
popup = feature.createPopup(true);
|
||||||
popup.setContentHTML("<a href='http://www.somethingconstructive.net' target='_blank'>click me</a>");
|
popup.setContentHTML("<a href='http://www.somethingconstructive.net' target='_blank'>click me</a>");
|
||||||
popup.setBackgroundColor("yellow");
|
popup.setBackgroundColor("yellow");
|
||||||
popup.setOpacity(0.7);
|
popup.setOpacity(0.7);
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script src="../lib/OpenLayers.js"></script>
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
<script src="../lib/Firebug/debug.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
<!--
|
<!--
|
||||||
var map;
|
var map;
|
||||||
@@ -18,11 +17,23 @@
|
|||||||
var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||||
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
|
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
|
|
||||||
|
var style_blue = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
|
||||||
|
style_blue.strokeColor = "blue";
|
||||||
|
style_blue.fillColor = "blue";
|
||||||
|
var style_green = {
|
||||||
|
strokeColor: "#00FF00",
|
||||||
|
strokeOpacity: 1,
|
||||||
|
strokeWidth: 3,
|
||||||
|
pointRadius: 6,
|
||||||
|
pointerEvents: "visiblePainted"
|
||||||
|
};
|
||||||
|
|
||||||
var vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry");
|
var vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry");
|
||||||
|
|
||||||
// create a point feature
|
// create a point feature
|
||||||
var point = new OpenLayers.Geometry.Point(-111.04, 45.68);
|
var point = new OpenLayers.Geometry.Point(-111.04, 45.68);
|
||||||
var pointFeature = new OpenLayers.Feature.Vector(point);
|
var pointFeature = new OpenLayers.Feature.Vector(point,null,style_blue);
|
||||||
|
|
||||||
// create a line feature from a list of points
|
// create a line feature from a list of points
|
||||||
var pointList = [];
|
var pointList = [];
|
||||||
@@ -33,7 +44,7 @@
|
|||||||
pointList.push(newPoint);
|
pointList.push(newPoint);
|
||||||
}
|
}
|
||||||
var lineFeature = new OpenLayers.Feature.Vector(
|
var lineFeature = new OpenLayers.Feature.Vector(
|
||||||
new OpenLayers.Geometry.LineString(pointList));
|
new OpenLayers.Geometry.LineString(pointList),null,style_green);
|
||||||
|
|
||||||
// create a polygon feature from a linear ring of points
|
// create a polygon feature from a linear ring of points
|
||||||
var pointList = [];
|
var pointList = [];
|
||||||
@@ -60,5 +71,9 @@
|
|||||||
</head>
|
</head>
|
||||||
<body onload="init()">
|
<body onload="init()">
|
||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
|
<p>This example shows drawing simple vector features -- point, line, polygon
|
||||||
|
in different styles, created 'manually', by constructing the entire style
|
||||||
|
object, via 'copy', extending the default style object, and by
|
||||||
|
inheriting the default style from the layer.</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
df.featureAdded = function(feature) {
|
df.featureAdded = function(feature) {
|
||||||
feature.state = OpenLayers.State.INSERT;
|
feature.state = OpenLayers.State.INSERT;
|
||||||
feature.style['strokeColor'] = "#ff0000";
|
feature.style['strokeColor'] = "#ff0000";
|
||||||
feature.layer.renderer.drawGeometry(feature.geometry, feature.style);
|
feature.layer.drawFeature(feature);
|
||||||
}
|
}
|
||||||
p.addControls([ new OpenLayers.Control.Navigation(), df ]);
|
p.addControls([ new OpenLayers.Control.Navigation(), df ]);
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
for(var i = 0; i < map.layers[1].features.length; i++) {
|
for(var i = 0; i < map.layers[1].features.length; i++) {
|
||||||
var f = map.layers[1].features[i];
|
var f = map.layers[1].features[i];
|
||||||
f.style['strokeColor'] = '#ee9900';
|
f.style['strokeColor'] = '#ee9900';
|
||||||
map.layers[1].renderer.drawGeometry(f.geometry, f.style);
|
map.layers[1].drawFeature(f);
|
||||||
}
|
}
|
||||||
map.layers[1].commit();
|
map.layers[1].commit();
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
featureNS: 'http://www.openplans.org/topp',
|
featureNS: 'http://www.openplans.org/topp',
|
||||||
extractAttributes: false
|
extractAttributes: false
|
||||||
} );
|
} );
|
||||||
rlayer.onFeatureInsert=function(feature) { feature.style.strokeColor = "#ff0000"; feature.layer.renderer.drawGeometry(feature.geometry, feature.style); }
|
rlayer.onFeatureInsert=function(feature) { feature.style.strokeColor = "#ff0000"; feature.layer.drawFeature(feature); }
|
||||||
map.addLayer(rlayer);
|
map.addLayer(rlayer);
|
||||||
layer = new OpenLayers.Layer.WFS( "Cities",
|
layer = new OpenLayers.Layer.WFS( "Cities",
|
||||||
"http://dev.openlayers.org/geoserver/wfs", {typename: 'topp:tasmania_cities'},
|
"http://dev.openlayers.org/geoserver/wfs", {typename: 'topp:tasmania_cities'},
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
df.featureAdded = function(feature) {
|
df.featureAdded = function(feature) {
|
||||||
feature.state = OpenLayers.State.INSERT;
|
feature.state = OpenLayers.State.INSERT;
|
||||||
feature.style['strokeColor'] = "#0000ff";
|
feature.style['strokeColor'] = "#0000ff";
|
||||||
feature.layer.renderer.drawGeometry(feature.geometry, feature.style);
|
feature.layer.drawFeature(feature);
|
||||||
}
|
}
|
||||||
dp = new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Point, {handlerOptions: {'freehand': false}, 'displayClass': 'olControlDrawFeaturePoint'});
|
dp = new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Point, {handlerOptions: {'freehand': false}, 'displayClass': 'olControlDrawFeaturePoint'});
|
||||||
dp.featureAdded = function(feature) {
|
dp.featureAdded = function(feature) {
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
feature.geometry = new OpenLayers.Geometry.MultiPoint(oldgeom);
|
feature.geometry = new OpenLayers.Geometry.MultiPoint(oldgeom);
|
||||||
feature.state = OpenLayers.State.INSERT;
|
feature.state = OpenLayers.State.INSERT;
|
||||||
feature.style['strokeColor'] = "#0000ff";
|
feature.style['strokeColor'] = "#0000ff";
|
||||||
feature.layer.renderer.drawGeometry(feature.geometry, feature.style);
|
feature.layer.drawFeature(feature);
|
||||||
}
|
}
|
||||||
p.addControls([ new OpenLayers.Control.Navigation(), df, dp ]);
|
p.addControls([ new OpenLayers.Control.Navigation(), df, dp ]);
|
||||||
|
|
||||||
|
|||||||
@@ -77,8 +77,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayWKT(geometry) {
|
function displayWKT(feature) {
|
||||||
var str = wkt.write(geometry);
|
var str = wkt.write(feature);
|
||||||
// not a good idea in general, just for this demo
|
// not a good idea in general, just for this demo
|
||||||
str = str.replace(/,/g, ', ');
|
str = str.replace(/,/g, ', ');
|
||||||
document.getElementById('info').innerHTML = str;
|
document.getElementById('info').innerHTML = str;
|
||||||
@@ -86,19 +86,18 @@
|
|||||||
|
|
||||||
function parseWKT() {
|
function parseWKT() {
|
||||||
var element = document.getElementById('wkt');
|
var element = document.getElementById('wkt');
|
||||||
var collection = wkt.read(element.value);
|
var features = wkt.read(element.value);
|
||||||
var bounds;
|
var bounds;
|
||||||
if(collection) {
|
if(features) {
|
||||||
if(collection.constructor != Array) {
|
if(features.constructor != Array) {
|
||||||
collection = [collection];
|
features = [features];
|
||||||
}
|
}
|
||||||
var features = [];
|
for(var i=0; i<features.length; ++i) {
|
||||||
for(var i=0; i<collection.length; ++i) {
|
|
||||||
features.push(new OpenLayers.Feature.Vector(collection[i]));
|
|
||||||
if (!bounds) {
|
if (!bounds) {
|
||||||
bounds = collection[i].getBounds();
|
bounds = features[i].geometry.getBounds();
|
||||||
|
} else {
|
||||||
|
bounds.extend(features[i].geometry.getBounds());
|
||||||
}
|
}
|
||||||
bounds.extend(collection[i].getBounds());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
vectors.addFeatures(features);
|
vectors.addFeatures(features);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/* @requires OpenLayers/BaseTypes.js
|
/* @requires OpenLayers/BaseTypes.js
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -32,7 +32,8 @@ OpenLayers.Class = {
|
|||||||
//
|
//
|
||||||
// to be revisited in 3.0
|
// to be revisited in 3.0
|
||||||
//
|
//
|
||||||
if (arguments[i].hasOwnProperty('toString')) {
|
if((arguments[i].hasOwnProperty && arguments[i].hasOwnProperty('toString')) ||
|
||||||
|
(!arguments[i].hasOwnProperty && arguments[i].toString)) {
|
||||||
proto.toString = arguments[i].toString;
|
proto.toString = arguments[i].toString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ OpenLayers.Control.DrawFeature.prototype =
|
|||||||
/**
|
/**
|
||||||
* @type {Object} The functions that are sent to the handler for callback
|
* @type {Object} The functions that are sent to the handler for callback
|
||||||
*/
|
*/
|
||||||
callbacks: {},
|
callbacks: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Function} Called after each feature is added
|
* @type {Function} Called after each feature is added
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ OpenLayers.Control.KeyboardDefaults.prototype =
|
|||||||
OpenLayers.Class.inherit( OpenLayers.Control, {
|
OpenLayers.Class.inherit( OpenLayers.Control, {
|
||||||
|
|
||||||
/** @type int */
|
/** @type int */
|
||||||
slideFactor: 50,
|
slideFactor: 75,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -50,23 +50,45 @@ OpenLayers.Control.KeyboardDefaults.prototype =
|
|||||||
defaultKeyPress: function (code) {
|
defaultKeyPress: function (code) {
|
||||||
switch(code) {
|
switch(code) {
|
||||||
case OpenLayers.Event.KEY_LEFT:
|
case OpenLayers.Event.KEY_LEFT:
|
||||||
this.map.pan(-50, 0);
|
this.map.pan(-this.slideFactor, 0);
|
||||||
break;
|
break;
|
||||||
case OpenLayers.Event.KEY_RIGHT:
|
case OpenLayers.Event.KEY_RIGHT:
|
||||||
this.map.pan(50, 0);
|
this.map.pan(this.slideFactor, 0);
|
||||||
break;
|
break;
|
||||||
case OpenLayers.Event.KEY_UP:
|
case OpenLayers.Event.KEY_UP:
|
||||||
this.map.pan(0, -50);
|
this.map.pan(0, -this.slideFactor);
|
||||||
break;
|
break;
|
||||||
case OpenLayers.Event.KEY_DOWN:
|
case OpenLayers.Event.KEY_DOWN:
|
||||||
this.map.pan(0, 50);
|
this.map.pan(0, this.slideFactor);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 33: // Page Up
|
case 33: // Page Up
|
||||||
|
var size = this.map.getSize();
|
||||||
|
this.map.pan(0, -0.75*size.h);
|
||||||
|
break;
|
||||||
|
case 34: // Page Down
|
||||||
|
var size = this.map.getSize();
|
||||||
|
this.map.pan(0, 0.75*size.h);
|
||||||
|
break;
|
||||||
|
case 35: // End
|
||||||
|
var size = this.map.getSize();
|
||||||
|
this.map.pan(0.75*size.w, 0);
|
||||||
|
break;
|
||||||
|
case 36: // Pos1
|
||||||
|
var size = this.map.getSize();
|
||||||
|
this.map.pan(-0.75*size.w, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
case 43: // +
|
case 43: // +
|
||||||
this.map.zoomIn();
|
this.map.zoomIn();
|
||||||
break;
|
break;
|
||||||
case 45: // -
|
case 45: // -
|
||||||
case 34: // Page Down
|
this.map.zoomOut();
|
||||||
|
break;
|
||||||
|
case 107: // + (IE only)
|
||||||
|
this.map.zoomIn();
|
||||||
|
break;
|
||||||
|
case 109: // - (IE only)
|
||||||
this.map.zoomOut();
|
this.map.zoomOut();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -336,7 +336,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
|||||||
|
|
||||||
//configure main div
|
//configure main div
|
||||||
this.div.style.position = "absolute";
|
this.div.style.position = "absolute";
|
||||||
this.div.style.top = "10px";
|
this.div.style.top = "25px";
|
||||||
this.div.style.right = "0px";
|
this.div.style.right = "0px";
|
||||||
this.div.style.left = "";
|
this.div.style.left = "";
|
||||||
this.div.style.fontFamily = "sans-serif";
|
this.div.style.fontFamily = "sans-serif";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -181,7 +181,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
|||||||
}
|
}
|
||||||
document.onselectstart=null;
|
document.onselectstart=null;
|
||||||
this.mouseDragStart = null;
|
this.mouseDragStart = null;
|
||||||
this.map.div.style.cursor = "default";
|
this.map.div.style.cursor = "";
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
|||||||
this.map.div.style.cursor = "crosshair";
|
this.map.div.style.cursor = "crosshair";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.map.div.style.cursor = "default";
|
this.map.div.style.cursor = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
/**
|
/**
|
||||||
* @fileoverview Locator Map Control
|
* @fileoverview Locator Map Control
|
||||||
@@ -46,7 +46,7 @@ OpenLayers.Control.OverviewMap.prototype =
|
|||||||
*
|
*
|
||||||
* @type Array(OpenLayers.Layer)
|
* @type Array(OpenLayers.Layer)
|
||||||
*/
|
*/
|
||||||
layers: [],
|
layers: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ratio of the overview map resolution to the main map resolution
|
* The ratio of the overview map resolution to the main map resolution
|
||||||
@@ -68,13 +68,14 @@ OpenLayers.Control.OverviewMap.prototype =
|
|||||||
* options that the main map was constructed with.
|
* options that the main map was constructed with.
|
||||||
* @type: Object
|
* @type: Object
|
||||||
*/
|
*/
|
||||||
mapOptions: {},
|
mapOptions: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Object} options Hashtable of options to set on the overview map
|
* @param {Object} options Hashtable of options to set on the overview map
|
||||||
*/
|
*/
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
|
this.layers = new Array();
|
||||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -179,7 +180,8 @@ OpenLayers.Control.OverviewMap.prototype =
|
|||||||
this.elementEvents.register('dblclick', this, function(e) {
|
this.elementEvents.register('dblclick', this, function(e) {
|
||||||
OpenLayers.Event.stop(e);
|
OpenLayers.Event.stop(e);
|
||||||
});
|
});
|
||||||
this.rectEvents = new OpenLayers.Events(this, this.extentRectangle);
|
this.rectEvents = new OpenLayers.Events(this, this.extentRectangle,
|
||||||
|
null, true);
|
||||||
this.rectEvents.register('mouseout', this, this.rectMouseOut);
|
this.rectEvents.register('mouseout', this, this.rectMouseOut);
|
||||||
this.rectEvents.register('mousedown', this, this.rectMouseDown);
|
this.rectEvents.register('mousedown', this, this.rectMouseDown);
|
||||||
this.rectEvents.register('mousemove', this, this.rectMouseMove);
|
this.rectEvents.register('mousemove', this, this.rectMouseMove);
|
||||||
@@ -519,8 +521,8 @@ OpenLayers.Control.OverviewMap.prototype =
|
|||||||
this.ovmap.size.w - this.wComp);
|
this.ovmap.size.w - this.wComp);
|
||||||
this.extentRectangle.style.top = parseInt(top) + 'px';
|
this.extentRectangle.style.top = parseInt(top) + 'px';
|
||||||
this.extentRectangle.style.left = parseInt(left) + 'px';
|
this.extentRectangle.style.left = parseInt(left) + 'px';
|
||||||
this.extentRectangle.style.height = parseInt(bottom - top)+ 'px';
|
this.extentRectangle.style.height = parseInt(Math.max(bottom - top, 0))+ 'px';
|
||||||
this.extentRectangle.style.width = parseInt(right - left) + 'px';
|
this.extentRectangle.style.width = parseInt(Math.max(right - left, 0)) + 'px';
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -104,6 +104,8 @@ OpenLayers.Control.PanZoom.prototype =
|
|||||||
this.doubleClick.bindAsEventListener(btn));
|
this.doubleClick.bindAsEventListener(btn));
|
||||||
OpenLayers.Event.observe(btn, "dblclick",
|
OpenLayers.Event.observe(btn, "dblclick",
|
||||||
this.doubleClick.bindAsEventListener(btn));
|
this.doubleClick.bindAsEventListener(btn));
|
||||||
|
OpenLayers.Event.observe(btn, "click",
|
||||||
|
this.doubleClick.bindAsEventListener(btn));
|
||||||
btn.action = id;
|
btn.action = id;
|
||||||
btn.map = this.map;
|
btn.map = this.map;
|
||||||
btn.slideFactor = this.slideFactor;
|
btn.slideFactor = this.slideFactor;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ OpenLayers.Control.PanZoomBar.prototype =
|
|||||||
zoomBarUp:function(evt) {
|
zoomBarUp:function(evt) {
|
||||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||||
if (this.zoomStart) {
|
if (this.zoomStart) {
|
||||||
this.div.style.cursor="default";
|
this.div.style.cursor="";
|
||||||
this.map.events.unregister("mouseup", this, this.passEventToSlider);
|
this.map.events.unregister("mouseup", this, this.passEventToSlider);
|
||||||
this.map.events.unregister("mousemove", this, this.passEventToSlider);
|
this.map.events.unregister("mousemove", this, this.passEventToSlider);
|
||||||
var deltaY = this.zoomStart.y - evt.xy.y
|
var deltaY = this.zoomStart.y - evt.xy.y
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -129,6 +129,8 @@ OpenLayers.Control.Panel.prototype =
|
|||||||
// Give each control a panel_div which will be used later.
|
// Give each control a panel_div which will be used later.
|
||||||
// Access to this div is via the panel_div attribute of the
|
// Access to this div is via the panel_div attribute of the
|
||||||
// control added to the panel.
|
// control added to the panel.
|
||||||
|
// Also, stop mousedowns and clicks, but don't stop mouseup,
|
||||||
|
// since they need to pass through.
|
||||||
for (var i = 0; i < controls.length; i++) {
|
for (var i = 0; i < controls.length; i++) {
|
||||||
var element = document.createElement("div");
|
var element = document.createElement("div");
|
||||||
var textNode = document.createTextNode(" ");
|
var textNode = document.createTextNode(" ");
|
||||||
@@ -137,8 +139,6 @@ OpenLayers.Control.Panel.prototype =
|
|||||||
this.onClick.bind(this, controls[i]));
|
this.onClick.bind(this, controls[i]));
|
||||||
OpenLayers.Event.observe(controls[i].panel_div, "mousedown",
|
OpenLayers.Event.observe(controls[i].panel_div, "mousedown",
|
||||||
OpenLayers.Event.stop.bindAsEventListener());
|
OpenLayers.Event.stop.bindAsEventListener());
|
||||||
OpenLayers.Event.observe(controls[i].panel_div, "mouseup",
|
|
||||||
OpenLayers.Event.stop.bindAsEventListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.map) { // map.addControl() has already been called on the panel
|
if (this.map) { // map.addControl() has already been called on the panel
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -27,13 +27,13 @@ OpenLayers.Control.SelectFeature.prototype =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Function} Optional function to be called when a feature is selected.
|
* @type {Function} Optional function to be called when a feature is selected.
|
||||||
* The function should expect to be called with a geometry.
|
* The function should expect to be called with a feature.
|
||||||
*/
|
*/
|
||||||
onSelect: function() {},
|
onSelect: function() {},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Function} Optional function to be called when a feature is unselected.
|
* @type {Function} Optional function to be called when a feature is unselected.
|
||||||
* The function should expect to be called with a geometry.
|
* The function should expect to be called with a feature.
|
||||||
*/
|
*/
|
||||||
onUnselect: function() {},
|
onUnselect: function() {},
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ OpenLayers.Control.SelectFeature.prototype =
|
|||||||
/**
|
/**
|
||||||
* @type {Object} The functions that are sent to the handler for callback
|
* @type {Object} The functions that are sent to the handler for callback
|
||||||
*/
|
*/
|
||||||
callbacks: {},
|
callbacks: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Object} Hash of styles
|
* @type {Object} Hash of styles
|
||||||
@@ -76,31 +76,28 @@ OpenLayers.Control.SelectFeature.prototype =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the feature handler detects a mouse-down on a feature
|
* Called when the feature handler detects a mouse-down on a feature
|
||||||
* @param {OpenLayers.Geometry}
|
* @param {OpenLayers.Vector.Feature}
|
||||||
*/
|
*/
|
||||||
downFeature: function(geometry) {
|
downFeature: function(feature) {
|
||||||
if(this.hover) {
|
if(this.hover) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(geometry.parent) {
|
|
||||||
geometry = geometry.parent;
|
|
||||||
}
|
|
||||||
if (this.multiple) {
|
if (this.multiple) {
|
||||||
if(OpenLayers.Util.indexOf(this.layer.selectedFeatures, geometry.feature) > -1) {
|
if(OpenLayers.Util.indexOf(this.layer.selectedFeatures, feature) > -1) {
|
||||||
this.unselect(geometry);
|
this.unselect(feature);
|
||||||
} else {
|
} else {
|
||||||
this.select(geometry);
|
this.select(feature);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(OpenLayers.Util.indexOf(this.layer.selectedFeatures, geometry.feature) > -1) {
|
if(OpenLayers.Util.indexOf(this.layer.selectedFeatures, feature) > -1) {
|
||||||
this.unselect(geometry);
|
this.unselect(feature);
|
||||||
} else {
|
} else {
|
||||||
if (this.layer.selectedFeatures) {
|
if (this.layer.selectedFeatures) {
|
||||||
for (var i = 0; i < this.layer.selectedFeatures.length; i++) {
|
for (var i = 0; i < this.layer.selectedFeatures.length; i++) {
|
||||||
this.unselect(this.layer.selectedFeatures[i].geometry);
|
this.unselect(this.layer.selectedFeatures[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.select(geometry);
|
this.select(feature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -108,63 +105,57 @@ OpenLayers.Control.SelectFeature.prototype =
|
|||||||
/**
|
/**
|
||||||
* Called when the feature handler detects a mouse-over on a feature.
|
* Called when the feature handler detects a mouse-over on a feature.
|
||||||
* Only responds if this.hover is true.
|
* Only responds if this.hover is true.
|
||||||
* @param {OpenLayers.Geometry}
|
* @param {OpenLayers.Feature.Vector}
|
||||||
*/
|
*/
|
||||||
overFeature: function(geometry) {
|
overFeature: function(feature) {
|
||||||
if(!this.hover) {
|
if(!this.hover) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(geometry.parent) {
|
if(!(OpenLayers.Util.indexOf(this.layer.selectedFeatures, feature) > -1)) {
|
||||||
geometry = geometry.parent;
|
this.select(feature);
|
||||||
}
|
|
||||||
if(!(OpenLayers.Util.indexOf(this.layer.selectedFeatures, geometry.feature) > -1)) {
|
|
||||||
this.select(geometry);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the feature handler detects a mouse-out on a feature.
|
* Called when the feature handler detects a mouse-out on a feature.
|
||||||
* Only responds if this.hover is true.
|
* Only responds if this.hover is true.
|
||||||
* @param {OpenLayers.Geometry}
|
* @param {OpenLayers.Feature.Vector}
|
||||||
*/
|
*/
|
||||||
outFeature: function(geometry) {
|
outFeature: function(feature) {
|
||||||
if(!this.hover) {
|
if(!this.hover) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(geometry.parent) {
|
this.unselect(feature);
|
||||||
geometry = geometry.parent;
|
|
||||||
}
|
|
||||||
this.unselect(geometry);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add feature to the layer's selectedFeature array, render the feature as
|
* Add feature to the layer's selectedFeature array, render the feature as
|
||||||
* selected, and call the onSelect function.
|
* selected, and call the onSelect function.
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Feature.Vector} feature
|
||||||
*/
|
*/
|
||||||
select: function(geometry) {
|
select: function(feature) {
|
||||||
// Store feature style for restoration later
|
// Store feature style for restoration later
|
||||||
if(geometry.feature.originalStyle == null) {
|
if(feature.originalStyle == null) {
|
||||||
geometry.feature.originalStyle = geometry.feature.style;
|
feature.originalStyle = feature.style;
|
||||||
}
|
}
|
||||||
this.layer.selectedFeatures.push(geometry.feature);
|
this.layer.selectedFeatures.push(feature);
|
||||||
this.layer.renderer.drawGeometry(geometry, this.selectStyle);
|
this.layer.drawFeature(feature, this.selectStyle);
|
||||||
this.onSelect(geometry);
|
this.onSelect(feature);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove feature from the layer's selectedFeature array, render the feature as
|
* Remove feature from the layer's selectedFeature array, render the feature as
|
||||||
* normal, and call the onUnselect function.
|
* normal, and call the onUnselect function.
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Feature.Vector} feature
|
||||||
*/
|
*/
|
||||||
unselect: function(geometry) {
|
unselect: function(feature) {
|
||||||
// Store feature style for restoration later
|
// Store feature style for restoration later
|
||||||
if(geometry.feature.originalStyle == null) {
|
if(feature.originalStyle == null) {
|
||||||
geometry.feature.originalStyle = geometry.feature.style;
|
feature.originalStyle = feature.style;
|
||||||
}
|
}
|
||||||
this.layer.renderer.drawGeometry(geometry, geometry.feature.originalStyle);
|
this.layer.drawFeature(feature, feature.originalStyle);
|
||||||
OpenLayers.Util.removeItem(this.layer.selectedFeatures, geometry.feature);
|
OpenLayers.Util.removeItem(this.layer.selectedFeatures, feature);
|
||||||
this.onUnselect(geometry);
|
this.onUnselect(feature);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Set the map property for the control.
|
/** Set the map property for the control.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -121,6 +121,7 @@ OpenLayers.Feature.prototype= {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param {Boolean} closeBox create popup with closebox or not
|
||||||
* @returns A Popup Object created from the 'lonlat', 'popupSize',
|
* @returns A Popup Object created from the 'lonlat', 'popupSize',
|
||||||
* and 'popupContentHTML' properties set in this.data. It uses
|
* and 'popupContentHTML' properties set in this.data. It uses
|
||||||
* this.marker.icon as default anchor.
|
* this.marker.icon as default anchor.
|
||||||
@@ -132,7 +133,7 @@ OpenLayers.Feature.prototype= {
|
|||||||
*
|
*
|
||||||
* @type OpenLayers.Popup.AnchoredBubble
|
* @type OpenLayers.Popup.AnchoredBubble
|
||||||
*/
|
*/
|
||||||
createPopup: function() {
|
createPopup: function(closeBox) {
|
||||||
|
|
||||||
if (this.lonlat != null) {
|
if (this.lonlat != null) {
|
||||||
|
|
||||||
@@ -143,7 +144,7 @@ OpenLayers.Feature.prototype= {
|
|||||||
this.lonlat,
|
this.lonlat,
|
||||||
this.data.popupSize,
|
this.data.popupSize,
|
||||||
this.data.popupContentHTML,
|
this.data.popupContentHTML,
|
||||||
anchor);
|
anchor, closeBox);
|
||||||
}
|
}
|
||||||
return this.popup;
|
return this.popup;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
// TRASH THIS
|
// TRASH THIS
|
||||||
@@ -27,10 +27,10 @@ OpenLayers.Feature.Vector.prototype =
|
|||||||
/** @type OpenLayers.Geometry */
|
/** @type OpenLayers.Geometry */
|
||||||
geometry:null,
|
geometry:null,
|
||||||
|
|
||||||
/** @type array */
|
/** @type Object */
|
||||||
attributes: {},
|
attributes: null,
|
||||||
|
|
||||||
/** @type strinng */
|
/** @type String */
|
||||||
state: null,
|
state: null,
|
||||||
|
|
||||||
/** @type Object */
|
/** @type Object */
|
||||||
@@ -46,10 +46,11 @@ OpenLayers.Feature.Vector.prototype =
|
|||||||
initialize: function(geometry, data, style) {
|
initialize: function(geometry, data, style) {
|
||||||
OpenLayers.Feature.prototype.initialize.apply(this, [null, null, data]);
|
OpenLayers.Feature.prototype.initialize.apply(this, [null, null, data]);
|
||||||
this.lonlat = null;
|
this.lonlat = null;
|
||||||
this.setGeometry(geometry);
|
this.geometry = geometry;
|
||||||
this.state = null;
|
this.state = null;
|
||||||
|
this.attributes = new Object();
|
||||||
if (data) {
|
if (data) {
|
||||||
OpenLayers.Util.extend(this.attributes, data);
|
this.attributes = OpenLayers.Util.extend(this.attributes, data);
|
||||||
}
|
}
|
||||||
this.style = style ? style : null;
|
this.style = style ? style : null;
|
||||||
},
|
},
|
||||||
@@ -125,56 +126,6 @@ OpenLayers.Feature.Vector.prototype =
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a feature id to the feature
|
|
||||||
*
|
|
||||||
* @param {String} feature id to set
|
|
||||||
*/
|
|
||||||
setFid: function(fid) {
|
|
||||||
this.fid = fid;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a geometry to the feature
|
|
||||||
*
|
|
||||||
* @param {OpenLayers.Geometry} geometry to set
|
|
||||||
* @param {Boolean} recurse Recursively set feature (for components)
|
|
||||||
*/
|
|
||||||
setGeometry: function(geometry, recurse) {
|
|
||||||
if(geometry) {
|
|
||||||
this.geometry = geometry;
|
|
||||||
this.geometry.feature = this;
|
|
||||||
if (recurse != false) {
|
|
||||||
this._setGeometryFeatureReference(this.geometry, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets recursively the reference to the feature in the geometry
|
|
||||||
*
|
|
||||||
* @param {OpenLayers.Geometry}
|
|
||||||
* @param {OpenLayers.Feature}
|
|
||||||
*/
|
|
||||||
_setGeometryFeatureReference: function(geometry, feature) {
|
|
||||||
geometry.feature = feature;
|
|
||||||
if (geometry.components) {
|
|
||||||
for (var i = 0; i < geometry.components.length; i++) {
|
|
||||||
this._setGeometryFeatureReference(geometry.components[i], feature);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds attributes an attributes object to the feature.
|
|
||||||
* (should not be in geometry but in feature class)
|
|
||||||
*
|
|
||||||
* @param {Attributes} attributes
|
|
||||||
*/
|
|
||||||
setAttributes: function(attributes) {
|
|
||||||
this.attributes=attributes;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {OpenLayers.LonLat} lonlat
|
* @param {OpenLayers.LonLat} lonlat
|
||||||
* @param {float} toleranceLon Optional tolerance in Geometric Coords
|
* @param {float} toleranceLon Optional tolerance in Geometric Coords
|
||||||
@@ -277,7 +228,8 @@ OpenLayers.Feature.Vector.style = {
|
|||||||
pointRadius: 6,
|
pointRadius: 6,
|
||||||
hoverPointRadius: 1,
|
hoverPointRadius: 1,
|
||||||
hoverPointUnit: "%",
|
hoverPointUnit: "%",
|
||||||
pointerEvents: "visiblePainted"
|
pointerEvents: "visiblePainted",
|
||||||
|
cursor: "pointer"
|
||||||
},
|
},
|
||||||
'temporary': {
|
'temporary': {
|
||||||
fillColor: "yellow",
|
fillColor: "yellow",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,13 +84,11 @@ OpenLayers.Format.GML.prototype =
|
|||||||
|
|
||||||
var feature = new OpenLayers.Feature.Vector();
|
var feature = new OpenLayers.Feature.Vector();
|
||||||
|
|
||||||
if (xmlNode.firstChild.attributes && xmlNode.firstChild.attributes['fid']) {
|
|
||||||
feature.fid = xmlNode.firstChild.attributes['fid'].nodeValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// match MultiPolygon
|
// match MultiPolygon
|
||||||
if (OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, this.gmlns, "gml", "MultiPolygon").length != 0) {
|
if (OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, this.gmlns, "gml", "MultiPolygon").length != 0) {
|
||||||
var multipolygon = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, this.gmlns, "gml", "MultiPolygon")[0];
|
var multipolygon = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, this.gmlns, "gml", "MultiPolygon")[0];
|
||||||
|
feature.fid = multipolygon.parentNode.parentNode.getAttribute('fid');
|
||||||
|
|
||||||
geom = new OpenLayers.Geometry.MultiPolygon();
|
geom = new OpenLayers.Geometry.MultiPolygon();
|
||||||
var polygons = OpenLayers.Ajax.getElementsByTagNameNS(multipolygon,
|
var polygons = OpenLayers.Ajax.getElementsByTagNameNS(multipolygon,
|
||||||
this.gmlns, "gml", "Polygon");
|
this.gmlns, "gml", "Polygon");
|
||||||
@@ -104,6 +102,7 @@ OpenLayers.Format.GML.prototype =
|
|||||||
this.gmlns, "gml", "MultiLineString").length != 0) {
|
this.gmlns, "gml", "MultiLineString").length != 0) {
|
||||||
var multilinestring = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
|
var multilinestring = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
|
||||||
this.gmlns, "gml", "MultiLineString")[0];
|
this.gmlns, "gml", "MultiLineString")[0];
|
||||||
|
feature.fid = multilinestring.parentNode.parentNode.getAttribute('fid');
|
||||||
|
|
||||||
geom = new OpenLayers.Geometry.MultiLineString();
|
geom = new OpenLayers.Geometry.MultiLineString();
|
||||||
var lineStrings = OpenLayers.Ajax.getElementsByTagNameNS(multilinestring, this.gmlns, "gml", "LineString");
|
var lineStrings = OpenLayers.Ajax.getElementsByTagNameNS(multilinestring, this.gmlns, "gml", "LineString");
|
||||||
@@ -122,6 +121,7 @@ OpenLayers.Format.GML.prototype =
|
|||||||
this.gmlns, "gml", "MultiPoint").length != 0) {
|
this.gmlns, "gml", "MultiPoint").length != 0) {
|
||||||
var multiPoint = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
|
var multiPoint = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
|
||||||
this.gmlns, "gml", "MultiPoint")[0];
|
this.gmlns, "gml", "MultiPoint")[0];
|
||||||
|
feature.fid = multiPoint.parentNode.parentNode.getAttribute('fid');
|
||||||
|
|
||||||
geom = new OpenLayers.Geometry.MultiPoint();
|
geom = new OpenLayers.Geometry.MultiPoint();
|
||||||
|
|
||||||
@@ -138,6 +138,7 @@ OpenLayers.Format.GML.prototype =
|
|||||||
this.gmlns, "gml", "Polygon").length != 0) {
|
this.gmlns, "gml", "Polygon").length != 0) {
|
||||||
var polygon = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
|
var polygon = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
|
||||||
this.gmlns, "gml", "Polygon")[0];
|
this.gmlns, "gml", "Polygon")[0];
|
||||||
|
feature.fid = polygon.parentNode.parentNode.getAttribute('fid');
|
||||||
|
|
||||||
geom = this.parsePolygonNode(polygon);
|
geom = this.parsePolygonNode(polygon);
|
||||||
}
|
}
|
||||||
@@ -146,6 +147,8 @@ OpenLayers.Format.GML.prototype =
|
|||||||
this.gmlns, "gml", "LineString").length != 0) {
|
this.gmlns, "gml", "LineString").length != 0) {
|
||||||
var lineString = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
|
var lineString = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
|
||||||
this.gmlns, "gml", "LineString")[0];
|
this.gmlns, "gml", "LineString")[0];
|
||||||
|
feature.fid = lineString.parentNode.parentNode.getAttribute('fid');
|
||||||
|
|
||||||
p = this.parseCoords(lineString);
|
p = this.parseCoords(lineString);
|
||||||
if (p.points) {
|
if (p.points) {
|
||||||
geom = new OpenLayers.Geometry.LineString(p.points);
|
geom = new OpenLayers.Geometry.LineString(p.points);
|
||||||
@@ -157,6 +160,7 @@ OpenLayers.Format.GML.prototype =
|
|||||||
this.gmlns, "gml", "Point").length != 0) {
|
this.gmlns, "gml", "Point").length != 0) {
|
||||||
var point = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
|
var point = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
|
||||||
this.gmlns, "gml", "Point")[0];
|
this.gmlns, "gml", "Point")[0];
|
||||||
|
feature.fid = point.parentNode.parentNode.getAttribute('fid');
|
||||||
|
|
||||||
p = this.parseCoords(point);
|
p = this.parseCoords(point);
|
||||||
if (p.points) {
|
if (p.points) {
|
||||||
@@ -165,7 +169,7 @@ OpenLayers.Format.GML.prototype =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
feature.setGeometry(geom, false);
|
feature.geometry = geom;
|
||||||
if (this.extractAttributes) {
|
if (this.extractAttributes) {
|
||||||
feature.attributes = this.parseAttributes(xmlNode);
|
feature.attributes = this.parseAttributes(xmlNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -97,10 +97,10 @@ OpenLayers.Format.GeoRSS.prototype =
|
|||||||
var path = "";
|
var path = "";
|
||||||
if (points) {
|
if (points) {
|
||||||
for (var i = 0; i < points.length; i++) {
|
for (var i = 0; i < points.length; i++) {
|
||||||
path += points[i].lat + " " + points[i].lon + " ";
|
path += points[i].y + " " + points[i].x + " ";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
path += geometry.lat + " " + geometry.lon + " ";
|
path += geometry.y + " " + geometry.x + " ";
|
||||||
}
|
}
|
||||||
return document.createTextNode(path);
|
return document.createTextNode(path);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,7 +80,7 @@ OpenLayers.Format.KML.prototype =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
feature.setGeometry(geom);
|
feature.geometry = geom;
|
||||||
feature.attributes = this.parseAttributes(xmlNode);
|
feature.attributes = this.parseAttributes(xmlNode);
|
||||||
|
|
||||||
return feature;
|
return feature;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,38 +25,41 @@ OpenLayers.Format.WKT.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize a WKT string and return an OpenLayers.Geometry or an array
|
* Deserialize a WKT string and return an OpenLayers.Feature.Vector or an
|
||||||
* of OpenLayers.Geometry. Supports WKT for POINT, MULTIPOINT, LINESTRING,
|
* array of OpenLayers.Feature.Vector. Supports WKT for POINT, MULTIPOINT,
|
||||||
* MULTILINESTRING, POLYGON, MULTIPOLYGON, and GEOMETRYCOLLECTION.
|
* LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON, and
|
||||||
|
* GEOMETRYCOLLECTION.
|
||||||
* @param {String} wkt A WKT string
|
* @param {String} wkt A WKT string
|
||||||
* @returns {OpenLayers.Geometry|Array} A geometry or array of geometries
|
* @returns {OpenLayers.Feature.Vector|Array} A feature or array of
|
||||||
* for GEOMETRYCOLLECTION WKT.
|
* features for
|
||||||
|
* GEOMETRYCOLLECTION WKT.
|
||||||
*/
|
*/
|
||||||
read: function(wkt) {
|
read: function(wkt) {
|
||||||
var geometry, type, str;
|
var features, type, str;
|
||||||
var matches = this.regExes.typeStr.exec(wkt);
|
var matches = this.regExes.typeStr.exec(wkt);
|
||||||
if(matches) {
|
if(matches) {
|
||||||
type = matches[1].toLowerCase();
|
type = matches[1].toLowerCase();
|
||||||
str = matches[2];
|
str = matches[2];
|
||||||
if(this.parse[type]) {
|
if(this.parse[type]) {
|
||||||
geometry = this.parse[type].apply(this, [str]);
|
features = this.parse[type].apply(this, [str]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return geometry;
|
return features;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serialize a geometry or array of geometries into a WKT string.
|
* Serialize a feature or array of features into a WKT string.
|
||||||
* @param {OpenLayers.Geometry|Array} geom A geometry or array of geometries
|
* @param {OpenLayers.Feature.Vector|Array} features A feature or array of
|
||||||
|
* features
|
||||||
* @returns {String} The WKT string representation of the input geometries
|
* @returns {String} The WKT string representation of the input geometries
|
||||||
*/
|
*/
|
||||||
write: function(geom) {
|
write: function(features) {
|
||||||
var collection, geometry, type, data, isCollection;
|
var collection, geometry, type, data, isCollection;
|
||||||
if(geom.constructor == Array) {
|
if(features.constructor == Array) {
|
||||||
collection = geom;
|
collection = features;
|
||||||
isCollection = true;
|
isCollection = true;
|
||||||
} else {
|
} else {
|
||||||
collection = [geom];
|
collection = [features];
|
||||||
isCollection = false;
|
isCollection = false;
|
||||||
}
|
}
|
||||||
var pieces = [];
|
var pieces = [];
|
||||||
@@ -67,7 +70,7 @@ OpenLayers.Format.WKT.prototype =
|
|||||||
if(isCollection && i>0) {
|
if(isCollection && i>0) {
|
||||||
pieces.push(',');
|
pieces.push(',');
|
||||||
}
|
}
|
||||||
geometry = collection[i];
|
geometry = collection[i].geometry;
|
||||||
type = geometry.CLASS_NAME.split('.')[2].toLowerCase();
|
type = geometry.CLASS_NAME.split('.')[2].toLowerCase();
|
||||||
if(!this.extract[type]) {
|
if(!this.extract[type]) {
|
||||||
return null;
|
return null;
|
||||||
@@ -178,47 +181,57 @@ OpenLayers.Format.WKT.prototype =
|
|||||||
*/
|
*/
|
||||||
parse: {
|
parse: {
|
||||||
/**
|
/**
|
||||||
* Return point geometry given a point WKT fragment.
|
* Return point feature given a point WKT fragment.
|
||||||
* @param {String} str A WKT fragment representing the point
|
* @param {String} str A WKT fragment representing the point
|
||||||
* @returns {OpenLayers.Geometry.Point} A point geometry
|
* @returns {OpenLayers.Feature.Vector} A point feature
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
'point': function(str) {
|
'point': function(str) {
|
||||||
var coords = str.trim().split(this.regExes.spaces);
|
var coords = str.trim().split(this.regExes.spaces);
|
||||||
return new OpenLayers.Geometry.Point(coords[0], coords[1]);
|
return new OpenLayers.Feature.Vector(
|
||||||
|
new OpenLayers.Geometry.Point(coords[0], coords[1])
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a multipoint geometry given a multipoint WKT fragment.
|
* Return a multipoint feature given a multipoint WKT fragment.
|
||||||
* @param {String} A WKT fragment representing the multipoint
|
* @param {String} A WKT fragment representing the multipoint
|
||||||
* @returns {OpenLayers.Geometry.MultiPoint} A multipoint geometry
|
* @returns {OpenLayers.Feature.Vector} A multipoint feature
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
'multipoint': function(str) {
|
'multipoint': function(str) {
|
||||||
var points = str.trim().split(',');
|
var points = str.trim().split(',');
|
||||||
var components = [];
|
var components = [];
|
||||||
for(var i=0; i<points.length; ++i) {
|
for(var i=0; i<points.length; ++i) {
|
||||||
components.push(this.parse.point.apply(this, [points[i]]));
|
components.push(this.parse.point.apply(this, [points[i]]).geometry);
|
||||||
}
|
}
|
||||||
return new OpenLayers.Geometry.MultiPoint(components);
|
return new OpenLayers.Feature.Vector(
|
||||||
|
new OpenLayers.Geometry.MultiPoint(components)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a linestring geometry given a linestring WKT fragment.
|
* Return a linestring feature given a linestring WKT fragment.
|
||||||
* @param {String} A WKT fragment representing the linestring
|
* @param {String} A WKT fragment representing the linestring
|
||||||
* @returns {OpenLayers.Geometry.LineString} A linestring geometry
|
* @returns {OpenLayers.Feature.Vector} A linestring feature
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
'linestring': function(str) {
|
'linestring': function(str) {
|
||||||
var points = str.trim().split(',');
|
var points = str.trim().split(',');
|
||||||
var components = [];
|
var components = [];
|
||||||
for(var i=0; i<points.length; ++i) {
|
for(var i=0; i<points.length; ++i) {
|
||||||
components.push(this.parse.point.apply(this, [points[i]]));
|
components.push(this.parse.point.apply(this, [points[i]]).geometry);
|
||||||
}
|
}
|
||||||
return new OpenLayers.Geometry.LineString(components);
|
return new OpenLayers.Feature.Vector(
|
||||||
|
new OpenLayers.Geometry.LineString(components)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a multilinestring geometry given a multilinestring WKT fragment.
|
* Return a multilinestring feature given a multilinestring WKT fragment.
|
||||||
* @param {String} A WKT fragment representing the multilinestring
|
* @param {String} A WKT fragment representing the multilinestring
|
||||||
* @returns {OpenLayers.Geometry.LineString} A multilinestring geometry
|
* @returns {OpenLayers.Feature.Vector} A multilinestring feature
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
'multilinestring': function(str) {
|
'multilinestring': function(str) {
|
||||||
var line;
|
var line;
|
||||||
@@ -226,15 +239,18 @@ OpenLayers.Format.WKT.prototype =
|
|||||||
var components = [];
|
var components = [];
|
||||||
for(var i=0; i<lines.length; ++i) {
|
for(var i=0; i<lines.length; ++i) {
|
||||||
line = lines[i].replace(this.regExes.trimParens, '$1');
|
line = lines[i].replace(this.regExes.trimParens, '$1');
|
||||||
components.push(this.parse.linestring.apply(this, [line]));
|
components.push(this.parse.linestring.apply(this, [line]).geometry);
|
||||||
}
|
}
|
||||||
return new OpenLayers.Geometry.MultiLineString(components);
|
return new OpenLayers.Feature.Vector(
|
||||||
|
new OpenLayers.Geometry.MultiLineString(components)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a polygon geometry given a polygon WKT fragment.
|
* Return a polygon feature given a polygon WKT fragment.
|
||||||
* @param {String} A WKT fragment representing the polygon
|
* @param {String} A WKT fragment representing the polygon
|
||||||
* @returns {OpenLayers.Geometry.Polygon} A polygon geometry
|
* @returns {OpenLayers.Feature.Vector} A polygon feature
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
'polygon': function(str) {
|
'polygon': function(str) {
|
||||||
var ring, linestring, linearring;
|
var ring, linestring, linearring;
|
||||||
@@ -242,17 +258,20 @@ OpenLayers.Format.WKT.prototype =
|
|||||||
var components = [];
|
var components = [];
|
||||||
for(var i=0; i<rings.length; ++i) {
|
for(var i=0; i<rings.length; ++i) {
|
||||||
ring = rings[i].replace(this.regExes.trimParens, '$1');
|
ring = rings[i].replace(this.regExes.trimParens, '$1');
|
||||||
linestring = this.parse.linestring.apply(this, [ring]);
|
linestring = this.parse.linestring.apply(this, [ring]).geometry;
|
||||||
linearring = new OpenLayers.Geometry.LinearRing(linestring.components);
|
linearring = new OpenLayers.Geometry.LinearRing(linestring.components)
|
||||||
components.push(linearring);
|
components.push(linearring);
|
||||||
}
|
}
|
||||||
return new OpenLayers.Geometry.Polygon(components);
|
return new OpenLayers.Feature.Vector(
|
||||||
|
new OpenLayers.Geometry.Polygon(components)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a multipolygon geometry given a multipolygon WKT fragment.
|
* Return a multipolygon feature given a multipolygon WKT fragment.
|
||||||
* @param {String} A WKT fragment representing the multipolygon
|
* @param {String} A WKT fragment representing the multipolygon
|
||||||
* @returns {OpenLayers.Geometry.MultiPolygon} A multipolygon geometry
|
* @returns {OpenLayers.Feature.Vector} A multipolygon feature
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
'multipolygon': function(str) {
|
'multipolygon': function(str) {
|
||||||
var polygon;
|
var polygon;
|
||||||
@@ -260,15 +279,18 @@ OpenLayers.Format.WKT.prototype =
|
|||||||
var components = [];
|
var components = [];
|
||||||
for(var i=0; i<polygons.length; ++i) {
|
for(var i=0; i<polygons.length; ++i) {
|
||||||
polygon = polygons[i].replace(this.regExes.trimParens, '$1');
|
polygon = polygons[i].replace(this.regExes.trimParens, '$1');
|
||||||
components.push(this.parse.polygon.apply(this, [polygon]));
|
components.push(this.parse.polygon.apply(this, [polygon]).geometry);
|
||||||
}
|
}
|
||||||
return new OpenLayers.Geometry.MultiPolygon(components);
|
return new OpenLayers.Feature.Vector(
|
||||||
|
new OpenLayers.Geometry.MultiPolygon(components)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array of geometries given a geometrycollection WKT fragment.
|
* Return an array of features given a geometrycollection WKT fragment.
|
||||||
* @param {String} A WKT fragment representing the geometrycollection
|
* @param {String} A WKT fragment representing the geometrycollection
|
||||||
* @returns {Array} An array of OpenLayers.Geometry
|
* @returns {Array} An array of OpenLayers.Feature.Vector
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
'geometrycollection': function(str) {
|
'geometrycollection': function(str) {
|
||||||
// separate components of the collection with |
|
// separate components of the collection with |
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
* @requires OpenLayers/Format/WKT.js
|
* @requires OpenLayers/Format/WKT.js
|
||||||
|
* @requires OpenLayers/Feature/Vector.js
|
||||||
*/
|
*/
|
||||||
OpenLayers.Geometry = OpenLayers.Class.create();
|
OpenLayers.Geometry = OpenLayers.Class.create();
|
||||||
OpenLayers.Geometry.prototype = {
|
OpenLayers.Geometry.prototype = {
|
||||||
@@ -20,14 +21,6 @@ OpenLayers.Geometry.prototype = {
|
|||||||
/** @type OpenLayers.Bounds */
|
/** @type OpenLayers.Bounds */
|
||||||
bounds: null,
|
bounds: null,
|
||||||
|
|
||||||
/**
|
|
||||||
* Cross reference back to the feature that owns this geometry so
|
|
||||||
* that that the feature can be identified after the geometry has been
|
|
||||||
* selected by a mouse click.
|
|
||||||
*
|
|
||||||
* @type OpenLayers.Feature */
|
|
||||||
feature: null,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
@@ -42,7 +35,6 @@ OpenLayers.Geometry.prototype = {
|
|||||||
this.id = null;
|
this.id = null;
|
||||||
|
|
||||||
this.bounds = null;
|
this.bounds = null;
|
||||||
this.feature = null;
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -159,7 +151,9 @@ OpenLayers.Geometry.prototype = {
|
|||||||
* @type String
|
* @type String
|
||||||
*/
|
*/
|
||||||
toString: function() {
|
toString: function() {
|
||||||
return OpenLayers.Format.WKT.prototype.write(this);
|
return OpenLayers.Format.WKT.prototype.write(
|
||||||
|
new OpenLayers.Feature.Vector(this)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,14 +70,6 @@ OpenLayers.Geometry.Collection.prototype =
|
|||||||
return geometry;
|
return geometry;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns the components of the geometry
|
|
||||||
* @type Array(OpenLayers.Geometry)
|
|
||||||
*/
|
|
||||||
getComponents: function(){
|
|
||||||
return this.components;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns the components of the geometry
|
* @returns the components of the geometry
|
||||||
* @type String
|
* @type String
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,7 +99,7 @@ OpenLayers.Handler.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Handler,
|
|||||||
this.removeBox();
|
this.removeBox();
|
||||||
|
|
||||||
// TBD: use CSS classes instead
|
// TBD: use CSS classes instead
|
||||||
this.map.div.style.cursor = "default";
|
this.map.div.style.cursor = "";
|
||||||
|
|
||||||
this.callback("done", [result]);
|
this.callback("done", [result]);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,13 +76,11 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
|
|||||||
if (this.started) {
|
if (this.started) {
|
||||||
this.dragging = true;
|
this.dragging = true;
|
||||||
this.callback("move", [evt.xy]);
|
this.callback("move", [evt.xy]);
|
||||||
if(document.onselectstart) {
|
|
||||||
if(!this.oldOnselectstart) {
|
if(!this.oldOnselectstart) {
|
||||||
this.oldOnselectstart = document.onselectstart;
|
this.oldOnselectstart = document.onselectstart;
|
||||||
document.onselectstart = function() {return false;}
|
document.onselectstart = function() {return false;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -95,14 +93,11 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
|
|||||||
mouseup: function (evt) {
|
mouseup: function (evt) {
|
||||||
if (this.started) {
|
if (this.started) {
|
||||||
this.started = false;
|
this.started = false;
|
||||||
this.dragging = false;
|
|
||||||
// TBD replace with CSS classes
|
// TBD replace with CSS classes
|
||||||
this.map.div.style.cursor = "default";
|
this.map.div.style.cursor = "";
|
||||||
this.callback("up", [evt.xy]);
|
this.callback("up", [evt.xy]);
|
||||||
if(document.onselectstart) {
|
|
||||||
document.onselectstart = this.oldOnselectstart;
|
document.onselectstart = this.oldOnselectstart;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -117,7 +112,7 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
|
|||||||
this.started = false;
|
this.started = false;
|
||||||
this.dragging = false;
|
this.dragging = false;
|
||||||
// TBD replace with CSS classes
|
// TBD replace with CSS classes
|
||||||
this.map.div.style.cursor = "default";
|
this.map.div.style.cursor = "";
|
||||||
this.callback("out", []);
|
this.callback("out", []);
|
||||||
if(document.onselectstart) {
|
if(document.onselectstart) {
|
||||||
document.onselectstart = this.oldOnselectstart;
|
document.onselectstart = this.oldOnselectstart;
|
||||||
@@ -136,8 +131,8 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
|
|||||||
*/
|
*/
|
||||||
click: function (evt) {
|
click: function (evt) {
|
||||||
// throw away the first left click event that happens after a mouse up
|
// throw away the first left click event that happens after a mouse up
|
||||||
if (OpenLayers.Event.isLeftClick(evt) && this.dragging) {
|
if (this.dragging) {
|
||||||
this.dragging = true;
|
this.dragging = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.started = false;
|
this.started = false;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -21,9 +21,9 @@ OpenLayers.Handler.Feature.prototype =
|
|||||||
layerIndex: null,
|
layerIndex: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {OpenLayers.Geometry}
|
* @type {OpenLayers.Feature.Vector}
|
||||||
*/
|
*/
|
||||||
geometry: null,
|
feature: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -33,7 +33,7 @@ OpenLayers.Handler.Feature.prototype =
|
|||||||
* @param {Array} callbacks An object with a 'over' property whos value is
|
* @param {Array} callbacks An object with a 'over' property whos value is
|
||||||
* a function to be called when the mouse is over
|
* a function to be called when the mouse is over
|
||||||
* a feature. The callback should expect to recieve
|
* a feature. The callback should expect to recieve
|
||||||
* a single argument, the geometry.
|
* a single argument, the feature.
|
||||||
* @param {Object} options
|
* @param {Object} options
|
||||||
*/
|
*/
|
||||||
initialize: function(control, layer, callbacks, options) {
|
initialize: function(control, layer, callbacks, options) {
|
||||||
@@ -75,7 +75,7 @@ OpenLayers.Handler.Feature.prototype =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Capture double-clicks. Let the event continue propagating if the
|
* Capture double-clicks. Let the event continue propagating if the
|
||||||
* double-click doesn't hit a geometry. Otherwise call the dblclick
|
* double-click doesn't hit a feature. Otherwise call the dblclick
|
||||||
* callback.
|
* callback.
|
||||||
*
|
*
|
||||||
* @param {Event} evt
|
* @param {Event} evt
|
||||||
@@ -92,26 +92,26 @@ OpenLayers.Handler.Feature.prototype =
|
|||||||
* @type {Boolean} A feature was selected
|
* @type {Boolean} A feature was selected
|
||||||
*/
|
*/
|
||||||
select: function(type, evt) {
|
select: function(type, evt) {
|
||||||
var geometry = this.layer.renderer.getGeometryFromEvent(evt);
|
var feature = this.layer.getFeatureFromEvent(evt);
|
||||||
if(geometry) {
|
if(feature) {
|
||||||
// three cases:
|
// three cases:
|
||||||
// over a new, out of the last and over a new, or still on the last
|
// over a new, out of the last and over a new, or still on the last
|
||||||
if(!this.geometry) {
|
if(!this.feature) {
|
||||||
// over a new geometry
|
// over a new feature
|
||||||
this.callback('over', [geometry]);
|
this.callback('over', [feature]);
|
||||||
} else if(this.geometry != geometry) {
|
} else if(this.feature != feature) {
|
||||||
// out of the last and over a new
|
// out of the last and over a new
|
||||||
this.callback('out', [this.geometry]);
|
this.callback('out', [this.feature]);
|
||||||
this.callback('over', [geometry]);
|
this.callback('over', [feature]);
|
||||||
}
|
}
|
||||||
this.geometry = geometry;
|
this.feature = feature;
|
||||||
this.callback(type, [geometry]);
|
this.callback(type, [feature]);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if(this.geometry) {
|
if(this.feature) {
|
||||||
// out of the last
|
// out of the last
|
||||||
this.callback('out', [this.geometry]);
|
this.callback('out', [this.feature]);
|
||||||
this.geometry = null;
|
this.feature = null;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
OpenLayers.Class.inherit(OpenLayers.Handler.Point, {
|
OpenLayers.Class.inherit(OpenLayers.Handler.Point, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type OpenLayers.Geometry.LineString
|
* @type OpenLayers.Feature.Vector
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
line: null,
|
line: null,
|
||||||
@@ -65,15 +65,17 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
/**
|
/**
|
||||||
* Add temporary geometries
|
* Add temporary geometries
|
||||||
*/
|
*/
|
||||||
createGeometry: function() {
|
createFeature: function() {
|
||||||
this.line = new OpenLayers.Geometry.LineString();
|
this.line = new OpenLayers.Feature.Vector(
|
||||||
this.point = new OpenLayers.Geometry.Point();
|
new OpenLayers.Geometry.LineString());
|
||||||
|
this.point = new OpenLayers.Feature.Vector(
|
||||||
|
new OpenLayers.Geometry.Point());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy temporary geometries
|
* Destroy temporary geometries
|
||||||
*/
|
*/
|
||||||
destroyGeometry: function() {
|
destroyFeature: function() {
|
||||||
this.line.destroy();
|
this.line.destroy();
|
||||||
this.point.destroy();
|
this.point.destroy();
|
||||||
},
|
},
|
||||||
@@ -83,7 +85,9 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
* the behavior of LinearRing that disregards adding duplicate points.
|
* the behavior of LinearRing that disregards adding duplicate points.
|
||||||
*/
|
*/
|
||||||
addPoint: function() {
|
addPoint: function() {
|
||||||
this.line.addComponent(this.point.clone(), this.line.components.length);
|
this.line.geometry.addComponent(this.point.geometry.clone(),
|
||||||
|
this.line.geometry.components.length);
|
||||||
|
this.callback("point", [this.point.geometry]);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,18 +104,18 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
* Modify the existing geometry given the new point
|
* Modify the existing geometry given the new point
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
modifyGeometry: function() {
|
modifyFeature: function() {
|
||||||
var index = this.line.components.length - 1;
|
var index = this.line.geometry.components.length - 1;
|
||||||
this.line.components[index].x = this.point.x;
|
this.line.geometry.components[index].x = this.point.geometry.x;
|
||||||
this.line.components[index].y = this.point.y;
|
this.line.geometry.components[index].y = this.point.geometry.y;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render geometries on the temporary layer.
|
* Render geometries on the temporary layer.
|
||||||
*/
|
*/
|
||||||
drawGeometry: function() {
|
drawFeature: function() {
|
||||||
this.layer.renderer.drawGeometry(this.line, this.style);
|
this.layer.drawFeature(this.line, this.style);
|
||||||
this.layer.renderer.drawGeometry(this.point, this.style);
|
this.layer.drawFeature(this.point, this.style);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,7 +124,7 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
* @type OpenLayers.Geometry.LineString
|
* @type OpenLayers.Geometry.LineString
|
||||||
*/
|
*/
|
||||||
geometryClone: function() {
|
geometryClone: function() {
|
||||||
return this.line.clone();
|
return this.line.geometry.clone();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,17 +140,17 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(this.lastDown == null) {
|
if(this.lastDown == null) {
|
||||||
this.createGeometry();
|
this.createFeature();
|
||||||
}
|
}
|
||||||
this.mouseDown = true;
|
this.mouseDown = true;
|
||||||
this.lastDown = evt.xy;
|
this.lastDown = evt.xy;
|
||||||
var lonlat = this.control.map.getLonLatFromPixel(evt.xy);
|
var lonlat = this.control.map.getLonLatFromPixel(evt.xy);
|
||||||
this.point.x = lonlat.lon;
|
this.point.geometry.x = lonlat.lon;
|
||||||
this.point.y = lonlat.lat;
|
this.point.geometry.y = lonlat.lat;
|
||||||
if((this.lastUp == null) || !this.lastUp.equals(evt.xy)) {
|
if((this.lastUp == null) || !this.lastUp.equals(evt.xy)) {
|
||||||
this.addPoint();
|
this.addPoint();
|
||||||
}
|
}
|
||||||
this.drawGeometry();
|
this.drawFeature();
|
||||||
this.drawing = true;
|
this.drawing = true;
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
@@ -161,14 +165,14 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
mousemove: function (evt) {
|
mousemove: function (evt) {
|
||||||
if(this.drawing) {
|
if(this.drawing) {
|
||||||
var lonlat = this.map.getLonLatFromPixel(evt.xy);
|
var lonlat = this.map.getLonLatFromPixel(evt.xy);
|
||||||
this.point.x = lonlat.lon;
|
this.point.geometry.x = lonlat.lon;
|
||||||
this.point.y = lonlat.lat;
|
this.point.geometry.y = lonlat.lat;
|
||||||
if(this.mouseDown && this.freehandMode(evt)) {
|
if(this.mouseDown && this.freehandMode(evt)) {
|
||||||
this.addPoint();
|
this.addPoint();
|
||||||
} else {
|
} else {
|
||||||
this.modifyGeometry();
|
this.modifyFeature();
|
||||||
}
|
}
|
||||||
this.drawGeometry();
|
this.drawFeature();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@@ -190,7 +194,6 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
this.addPoint();
|
this.addPoint();
|
||||||
}
|
}
|
||||||
this.lastUp = evt.xy;
|
this.lastUp = evt.xy;
|
||||||
this.callback("point", [this.point]);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -205,9 +208,9 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
*/
|
*/
|
||||||
dblclick: function(evt) {
|
dblclick: function(evt) {
|
||||||
if(!this.freehandMode(evt)) {
|
if(!this.freehandMode(evt)) {
|
||||||
var index = this.line.components.length - 1;
|
var index = this.line.geometry.components.length - 1;
|
||||||
this.line.removeComponent(this.line.components[index]);
|
this.line.geometry.removeComponent(this.line.geometry.components[index]);
|
||||||
this.finalize(this.line);
|
this.finalize();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
OpenLayers.Class.inherit(OpenLayers.Handler, {
|
OpenLayers.Class.inherit(OpenLayers.Handler, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type OpenLayers.Geometry.Point
|
* @type OpenLayers.Feature.Vector
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
point: null,
|
point: null,
|
||||||
@@ -87,10 +87,11 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add temporary geometries
|
* Add temporary features
|
||||||
*/
|
*/
|
||||||
createGeometry: function() {
|
createFeature: function() {
|
||||||
this.point = new OpenLayers.Geometry.Point();
|
this.point = new OpenLayers.Feature.Vector(
|
||||||
|
new OpenLayers.Geometry.Point());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -112,7 +113,7 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
/**
|
/**
|
||||||
* Destroy the temporary geometries
|
* Destroy the temporary geometries
|
||||||
*/
|
*/
|
||||||
destroyGeometry: function() {
|
destroyFeature: function() {
|
||||||
this.point.destroy();
|
this.point.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -122,7 +123,7 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
finalize: function() {
|
finalize: function() {
|
||||||
this.layer.renderer.clear();
|
this.layer.renderer.clear();
|
||||||
this.callback("done", [this.geometryClone()]);
|
this.callback("done", [this.geometryClone()]);
|
||||||
this.destroyGeometry();
|
this.destroyFeature();
|
||||||
this.drawing = false;
|
this.drawing = false;
|
||||||
this.mouseDown = false;
|
this.mouseDown = false;
|
||||||
this.lastDown = null;
|
this.lastDown = null;
|
||||||
@@ -135,7 +136,7 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
cancel: function() {
|
cancel: function() {
|
||||||
this.layer.renderer.clear();
|
this.layer.renderer.clear();
|
||||||
this.callback("cancel", [this.geometryClone()]);
|
this.callback("cancel", [this.geometryClone()]);
|
||||||
this.destroyGeometry();
|
this.destroyFeature();
|
||||||
this.drawing = false;
|
this.drawing = false;
|
||||||
this.mouseDown = false;
|
this.mouseDown = false;
|
||||||
this.lastDown = null;
|
this.lastDown = null;
|
||||||
@@ -151,10 +152,10 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render geometries on the temporary layer.
|
* Render features on the temporary layer.
|
||||||
*/
|
*/
|
||||||
drawGeometry: function() {
|
drawFeature: function() {
|
||||||
this.layer.renderer.drawGeometry(this.point, this.style);
|
this.layer.drawFeature(this.point, this.style);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -163,7 +164,7 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
* @type OpenLayers.Geometry.Point
|
* @type OpenLayers.Geometry.Point
|
||||||
*/
|
*/
|
||||||
geometryClone: function() {
|
geometryClone: function() {
|
||||||
return this.point.clone();
|
return this.point.geometry.clone();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -183,14 +184,14 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(this.lastDown == null) {
|
if(this.lastDown == null) {
|
||||||
this.createGeometry();
|
this.createFeature();
|
||||||
}
|
}
|
||||||
this.lastDown = evt.xy;
|
this.lastDown = evt.xy;
|
||||||
this.drawing = true;
|
this.drawing = true;
|
||||||
var lonlat = this.map.getLonLatFromPixel(evt.xy);
|
var lonlat = this.map.getLonLatFromPixel(evt.xy);
|
||||||
this.point.x = lonlat.lon;
|
this.point.geometry.x = lonlat.lon;
|
||||||
this.point.y = lonlat.lat;
|
this.point.geometry.y = lonlat.lat;
|
||||||
this.drawGeometry();
|
this.drawFeature();
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -204,9 +205,9 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
mousemove: function (evt) {
|
mousemove: function (evt) {
|
||||||
if(this.drawing) {
|
if(this.drawing) {
|
||||||
var lonlat = this.map.getLonLatFromPixel(evt.xy);
|
var lonlat = this.map.getLonLatFromPixel(evt.xy);
|
||||||
this.point.x = lonlat.lon;
|
this.point.geometry.x = lonlat.lon;
|
||||||
this.point.y = lonlat.lat;
|
this.point.geometry.y = lonlat.lat;
|
||||||
this.drawGeometry();
|
this.drawFeature();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@@ -220,7 +221,7 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
*/
|
*/
|
||||||
mouseup: function (evt) {
|
mouseup: function (evt) {
|
||||||
if(this.drawing) {
|
if(this.drawing) {
|
||||||
this.finalize(this.point);
|
this.finalize();
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ OpenLayers.Handler.Polygon.prototype =
|
|||||||
OpenLayers.Class.inherit(OpenLayers.Handler.Path, {
|
OpenLayers.Class.inherit(OpenLayers.Handler.Path, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type OpenLayers.Geometry.Polygon
|
* @type OpenLayers.Feature.Vector
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
polygon: null,
|
polygon: null,
|
||||||
@@ -44,17 +44,20 @@ OpenLayers.Handler.Polygon.prototype =
|
|||||||
/**
|
/**
|
||||||
* Add temporary geometries
|
* Add temporary geometries
|
||||||
*/
|
*/
|
||||||
createGeometry: function() {
|
createFeature: function() {
|
||||||
this.polygon = new OpenLayers.Geometry.Polygon();
|
this.polygon = new OpenLayers.Feature.Vector(
|
||||||
this.line = new OpenLayers.Geometry.LinearRing();
|
new OpenLayers.Geometry.Polygon());
|
||||||
this.polygon.addComponent(this.line);
|
this.line = new OpenLayers.Feature.Vector(
|
||||||
this.point = new OpenLayers.Geometry.Point();
|
new OpenLayers.Geometry.LinearRing());
|
||||||
|
this.polygon.geometry.addComponent(this.line.geometry);
|
||||||
|
this.point = new OpenLayers.Feature.Vector(
|
||||||
|
new OpenLayers.Geometry.Point());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy temporary geometries
|
* Destroy temporary geometries
|
||||||
*/
|
*/
|
||||||
destroyGeometry: function() {
|
destroyFeature: function() {
|
||||||
this.polygon.destroy();
|
this.polygon.destroy();
|
||||||
this.point.destroy();
|
this.point.destroy();
|
||||||
},
|
},
|
||||||
@@ -63,18 +66,18 @@ OpenLayers.Handler.Polygon.prototype =
|
|||||||
* Modify the existing geometry given the new point
|
* Modify the existing geometry given the new point
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
modifyGeometry: function() {
|
modifyFeature: function() {
|
||||||
var index = this.line.components.length - 2;
|
var index = this.line.geometry.components.length - 2;
|
||||||
this.line.components[index].x = this.point.x;
|
this.line.geometry.components[index].x = this.point.geometry.x;
|
||||||
this.line.components[index].y = this.point.y;
|
this.line.geometry.components[index].y = this.point.geometry.y;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render geometries on the temporary layer.
|
* Render geometries on the temporary layer.
|
||||||
*/
|
*/
|
||||||
drawGeometry: function() {
|
drawFeature: function() {
|
||||||
this.layer.renderer.drawGeometry(this.polygon, this.style);
|
this.layer.drawFeature(this.polygon, this.style);
|
||||||
this.layer.renderer.drawGeometry(this.point, this.style);
|
this.layer.drawFeature(this.point, this.style);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,7 +86,7 @@ OpenLayers.Handler.Polygon.prototype =
|
|||||||
* @type OpenLayers.Geometry.Polygon
|
* @type OpenLayers.Geometry.Polygon
|
||||||
*/
|
*/
|
||||||
geometryClone: function() {
|
geometryClone: function() {
|
||||||
return this.polygon.clone();
|
return this.polygon.geometry.clone();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,9 +98,9 @@ OpenLayers.Handler.Polygon.prototype =
|
|||||||
dblclick: function(evt) {
|
dblclick: function(evt) {
|
||||||
if(!this.freehandMode(evt)) {
|
if(!this.freehandMode(evt)) {
|
||||||
// remove the penultimate point
|
// remove the penultimate point
|
||||||
var index = this.line.components.length - 2;
|
var index = this.line.geometry.components.length - 2;
|
||||||
this.line.removeComponent(this.line.components[index]);
|
this.line.geometry.removeComponent(this.line.geometry.components[index]);
|
||||||
this.finalize(this.line);
|
this.finalize();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -148,24 +148,23 @@ OpenLayers.Layer.prototype = {
|
|||||||
* @param {Object} options Hashtable of extra options to tag onto the layer
|
* @param {Object} options Hashtable of extra options to tag onto the layer
|
||||||
*/
|
*/
|
||||||
initialize: function(name, options) {
|
initialize: function(name, options) {
|
||||||
//store a copy of the custom options for later cloning
|
|
||||||
this.options = OpenLayers.Util.extend(new Object(), options);
|
|
||||||
|
|
||||||
//add options to layer
|
this.addOptions(options);
|
||||||
OpenLayers.Util.extend(this, this.options);
|
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
|
if (this.id == null) {
|
||||||
|
|
||||||
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
|
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
|
||||||
|
|
||||||
if (this.div == null) {
|
|
||||||
this.div = OpenLayers.Util.createDiv();
|
this.div = OpenLayers.Util.createDiv();
|
||||||
this.div.style.width = "100%";
|
this.div.style.width = "100%";
|
||||||
this.div.style.height = "100%";
|
this.div.style.height = "100%";
|
||||||
this.div.id = this.id;
|
this.div.id = this.id;
|
||||||
}
|
|
||||||
|
|
||||||
this.events = new OpenLayers.Events(this, this.div, this.EVENT_TYPES);
|
this.events = new OpenLayers.Events(this, this.div,
|
||||||
|
this.EVENT_TYPES);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -188,7 +187,9 @@ OpenLayers.Layer.prototype = {
|
|||||||
this.div = null;
|
this.div = null;
|
||||||
this.options = null;
|
this.options = null;
|
||||||
|
|
||||||
|
if (this.events) {
|
||||||
this.events.destroy();
|
this.events.destroy();
|
||||||
|
}
|
||||||
this.events = null;
|
this.events = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -216,9 +217,12 @@ OpenLayers.Layer.prototype = {
|
|||||||
* @param {String} newName
|
* @param {String} newName
|
||||||
*/
|
*/
|
||||||
setName: function(newName) {
|
setName: function(newName) {
|
||||||
|
if (newName != this.name) {
|
||||||
this.name = newName;
|
this.name = newName;
|
||||||
if (this.map != null)
|
if (this.map != null) {
|
||||||
this.map.events.triggerEvent("changelayer");
|
this.map.events.triggerEvent("changelayer");
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -226,6 +230,10 @@ OpenLayers.Layer.prototype = {
|
|||||||
*/
|
*/
|
||||||
addOptions: function (newOptions) {
|
addOptions: function (newOptions) {
|
||||||
|
|
||||||
|
if (this.options == null) {
|
||||||
|
this.options = new Object();
|
||||||
|
}
|
||||||
|
|
||||||
// update our copy for clone
|
// update our copy for clone
|
||||||
OpenLayers.Util.extend(this.options, newOptions);
|
OpenLayers.Util.extend(this.options, newOptions);
|
||||||
|
|
||||||
@@ -264,6 +272,8 @@ OpenLayers.Layer.prototype = {
|
|||||||
* @param {OpenLayers.Map} map
|
* @param {OpenLayers.Map} map
|
||||||
*/
|
*/
|
||||||
setMap: function(map) {
|
setMap: function(map) {
|
||||||
|
if (this.map == null) {
|
||||||
|
|
||||||
this.map = map;
|
this.map = map;
|
||||||
|
|
||||||
// grab some essential layer data from the map if it hasn't already
|
// grab some essential layer data from the map if it hasn't already
|
||||||
@@ -276,10 +286,13 @@ OpenLayers.Layer.prototype = {
|
|||||||
|
|
||||||
if (!this.isBaseLayer) {
|
if (!this.isBaseLayer) {
|
||||||
this.inRange = this.calculateInRange();
|
this.inRange = this.calculateInRange();
|
||||||
|
var show = ((this.visibility) && (this.inRange));
|
||||||
|
this.div.style.display = show ? "" : "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
// deal with gutters
|
// deal with gutters
|
||||||
this.setTileSize();
|
this.setTileSize();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -336,7 +349,7 @@ OpenLayers.Layer.prototype = {
|
|||||||
if (visibility != this.visibility) {
|
if (visibility != this.visibility) {
|
||||||
this.visibility = visibility;
|
this.visibility = visibility;
|
||||||
this.display(visibility);
|
this.display(visibility);
|
||||||
if (this.map != null) {
|
if (visibility && this.map != null) {
|
||||||
var extent = this.map.getExtent();
|
var extent = this.map.getExtent();
|
||||||
if (extent != null) {
|
if (extent != null) {
|
||||||
this.moveTo(extent, true);
|
this.moveTo(extent, true);
|
||||||
@@ -378,10 +391,12 @@ OpenLayers.Layer.prototype = {
|
|||||||
* @param {Boolean} isBaseLayer
|
* @param {Boolean} isBaseLayer
|
||||||
*/
|
*/
|
||||||
setIsBaseLayer: function(isBaseLayer) {
|
setIsBaseLayer: function(isBaseLayer) {
|
||||||
|
if (isBaseLayer != this.isBaseLayer) {
|
||||||
this.isBaseLayer = isBaseLayer;
|
this.isBaseLayer = isBaseLayer;
|
||||||
if (this.map != null) {
|
if (this.map != null) {
|
||||||
this.map.events.triggerEvent("changelayer");
|
this.map.events.triggerEvent("changelayer");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
@@ -593,6 +608,7 @@ OpenLayers.Layer.prototype = {
|
|||||||
if (viewPortPx != null) {
|
if (viewPortPx != null) {
|
||||||
var size = this.map.getSize();
|
var size = this.map.getSize();
|
||||||
var center = this.map.getCenter();
|
var center = this.map.getCenter();
|
||||||
|
if (center) {
|
||||||
var res = this.map.getResolution();
|
var res = this.map.getResolution();
|
||||||
|
|
||||||
var delta_x = viewPortPx.x - (size.w / 2);
|
var delta_x = viewPortPx.x - (size.w / 2);
|
||||||
@@ -600,6 +616,7 @@ OpenLayers.Layer.prototype = {
|
|||||||
|
|
||||||
lonlat = new OpenLayers.LonLat(center.lon + delta_x * res ,
|
lonlat = new OpenLayers.LonLat(center.lon + delta_x * res ,
|
||||||
center.lat - delta_y * res);
|
center.lat - delta_y * res);
|
||||||
|
} // else { DEBUG STATEMENT }
|
||||||
}
|
}
|
||||||
return lonlat;
|
return lonlat;
|
||||||
},
|
},
|
||||||
@@ -646,12 +663,14 @@ OpenLayers.Layer.prototype = {
|
|||||||
* @param {Float} opacity
|
* @param {Float} opacity
|
||||||
*/
|
*/
|
||||||
setOpacity: function(opacity) {
|
setOpacity: function(opacity) {
|
||||||
|
if (opacity != this.opacity) {
|
||||||
this.opacity = opacity;
|
this.opacity = opacity;
|
||||||
for(var i=0; i<this.div.childNodes.length; ++i) {
|
for(var i=0; i<this.div.childNodes.length; ++i) {
|
||||||
var element = this.div.childNodes[i].firstChild;
|
var element = this.div.childNodes[i].firstChild;
|
||||||
OpenLayers.Util.modifyDOMElement(element, null, null, null,
|
OpenLayers.Util.modifyDOMElement(element, null, null, null,
|
||||||
null, null, null, opacity);
|
null, null, null, opacity);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -15,8 +15,11 @@ OpenLayers.Layer.Boxes.prototype =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
|
*
|
||||||
|
* @param {String} name
|
||||||
|
* @param {Object} options Hashtable of extra options to tag onto the layer
|
||||||
*/
|
*/
|
||||||
initialize: function () {
|
initialize: function (name, options) {
|
||||||
OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments);
|
OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -15,8 +15,7 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
|||||||
/** Used to hash URL param strings for multi-WMS server selection.
|
/** Used to hash URL param strings for multi-WMS server selection.
|
||||||
* Set to the Golden Ratio per Knuth's recommendation.
|
* Set to the Golden Ratio per Knuth's recommendation.
|
||||||
*
|
*
|
||||||
* @type Numeric
|
* @final @type Numeric
|
||||||
* @private
|
|
||||||
*/
|
*/
|
||||||
URL_HASH_FACTOR: (Math.sqrt(5) - 1) / 2,
|
URL_HASH_FACTOR: (Math.sqrt(5) - 1) / 2,
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
* @class
|
* @class
|
||||||
*
|
*
|
||||||
* @requires OpenLayers/Layer.js
|
* @requires OpenLayers/Layer.js
|
||||||
|
* @requires OpenLayers/Tile/Image.js
|
||||||
*/
|
*/
|
||||||
OpenLayers.Layer.Image = OpenLayers.Class.create();
|
OpenLayers.Layer.Image = OpenLayers.Class.create();
|
||||||
OpenLayers.Layer.Image.prototype =
|
OpenLayers.Layer.Image.prototype =
|
||||||
@@ -24,17 +25,23 @@ OpenLayers.Layer.Image.prototype =
|
|||||||
/** @type String */
|
/** @type String */
|
||||||
url: null,
|
url: null,
|
||||||
|
|
||||||
/** @type OpenLayers.Bounds */
|
/**
|
||||||
|
* The image bounds in map units
|
||||||
|
* @type OpenLayers.Bounds
|
||||||
|
*/
|
||||||
extent: null,
|
extent: null,
|
||||||
|
|
||||||
/** @type OpenLayers.Size */
|
/**
|
||||||
|
* The image size in pixels
|
||||||
|
* @type OpenLayers.Size
|
||||||
|
*/
|
||||||
size: null,
|
size: null,
|
||||||
|
|
||||||
/** @type OpenLayers.Tile.Image */
|
/** @type OpenLayers.Tile.Image */
|
||||||
tile: null,
|
tile: null,
|
||||||
|
|
||||||
/** The ratio of height/width represented by a single pixel in the graphic
|
/**
|
||||||
*
|
* The ratio of height/width represented by a single pixel in the graphic
|
||||||
* @type Float */
|
* @type Float */
|
||||||
aspectRatio: null,
|
aspectRatio: null,
|
||||||
|
|
||||||
@@ -94,10 +101,16 @@ OpenLayers.Layer.Image.prototype =
|
|||||||
* @param {OpenLayers.Map} map
|
* @param {OpenLayers.Map} map
|
||||||
*/
|
*/
|
||||||
setMap: function(map) {
|
setMap: function(map) {
|
||||||
// If nothing to do with resolutions has been set, assume a single
|
/**
|
||||||
// resolution determined by extent/size
|
* If nothing to do with resolutions has been set, assume a single
|
||||||
|
* resolution determined by ratio*extent/size - if an image has a
|
||||||
|
* pixel aspect ratio different than one (as calculated above), the
|
||||||
|
* image will be stretched in one dimension only.
|
||||||
|
*/
|
||||||
if( this.options.maxResolution == null ) {
|
if( this.options.maxResolution == null ) {
|
||||||
this.options.maxResolution = this.extent.getWidth() / this.size.w;
|
this.options.maxResolution = this.aspectRatio *
|
||||||
|
this.extent.getWidth() /
|
||||||
|
this.size.w;
|
||||||
}
|
}
|
||||||
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
||||||
},
|
},
|
||||||
@@ -116,10 +129,7 @@ OpenLayers.Layer.Image.prototype =
|
|||||||
if(zoomChanged || firstRendering) {
|
if(zoomChanged || firstRendering) {
|
||||||
|
|
||||||
//determine new tile size
|
//determine new tile size
|
||||||
var tileWidth = this.extent.getWidth() / this.map.getResolution();
|
this.setTileSize();
|
||||||
var tileHeight = this.extent.getHeight() /
|
|
||||||
(this.map.getResolution() * this.aspectRatio);
|
|
||||||
var tileSize = new OpenLayers.Size(tileWidth, tileHeight);
|
|
||||||
|
|
||||||
//determine new position (upper left corner of new bounds)
|
//determine new position (upper left corner of new bounds)
|
||||||
var ul = new OpenLayers.LonLat(this.extent.left, this.extent.top);
|
var ul = new OpenLayers.LonLat(this.extent.left, this.extent.top);
|
||||||
@@ -128,16 +138,28 @@ OpenLayers.Layer.Image.prototype =
|
|||||||
if(firstRendering) {
|
if(firstRendering) {
|
||||||
//create the new tile
|
//create the new tile
|
||||||
this.tile = new OpenLayers.Tile.Image(this, ulPx, this.extent,
|
this.tile = new OpenLayers.Tile.Image(this, ulPx, this.extent,
|
||||||
this.url, tileSize);
|
this.url, this.tileSize);
|
||||||
} else {
|
} else {
|
||||||
//just resize the tile and set it's new position
|
//just resize the tile and set it's new position
|
||||||
this.tile.size = tileSize.clone();
|
this.tile.size = this.tileSize.clone();
|
||||||
this.tile.position = ulPx.clone();
|
this.tile.position = ulPx.clone();
|
||||||
}
|
}
|
||||||
this.tile.draw();
|
this.tile.draw();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the tile size based on the map size. This also sets layer.imageSize
|
||||||
|
* and layer.imageOffset for use by Tile.Image.
|
||||||
|
*/
|
||||||
|
setTileSize: function() {
|
||||||
|
var tileWidth = this.extent.getWidth() / this.map.getResolution();
|
||||||
|
var tileHeight = this.extent.getHeight() / this.map.getResolution();
|
||||||
|
this.tileSize = new OpenLayers.Size(tileWidth, tileHeight);
|
||||||
|
this.imageSize = this.tileSize;
|
||||||
|
this.imageOffset = new OpenLayers.Pixel(0, 0);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} newUrl
|
* @param {String} newUrl
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -146,6 +146,36 @@ OpenLayers.Layer.KaMap.prototype =
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Object} obj
|
||||||
|
*
|
||||||
|
* @returns An exact clone of this OpenLayers.Layer.Grid
|
||||||
|
* @type OpenLayers.Layer.Grid
|
||||||
|
*/
|
||||||
|
clone: function (obj) {
|
||||||
|
|
||||||
|
if (obj == null) {
|
||||||
|
obj = new OpenLayers.Layer.KaMap(this.name,
|
||||||
|
this.url,
|
||||||
|
this.params,
|
||||||
|
this.options);
|
||||||
|
}
|
||||||
|
|
||||||
|
//get all additions from superclasses
|
||||||
|
obj = OpenLayers.Layer.Grid.prototype.clone.apply(this, [obj]);
|
||||||
|
|
||||||
|
// copy/set any non-init, non-simple values here
|
||||||
|
if (this.tileSize != null) {
|
||||||
|
obj.tileSize = this.tileSize.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
// we do not want to copy reference to grid, so we make a new array
|
||||||
|
obj.grid = new Array();
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
CLASS_NAME: "OpenLayers.Layer.KaMap"
|
CLASS_NAME: "OpenLayers.Layer.KaMap"
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
// @requires OpenLayers/Layer/Grid.js
|
// @requires OpenLayers/Layer/Grid.js
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -22,6 +22,15 @@ OpenLayers.Layer.Markers.prototype =
|
|||||||
* @type Array(OpenLayers.Marker) */
|
* @type Array(OpenLayers.Marker) */
|
||||||
markers: null,
|
markers: null,
|
||||||
|
|
||||||
|
|
||||||
|
/** internal state of drawing. This is a workaround for the fact
|
||||||
|
* that the map does not call moveTo with a zoomChanged when the
|
||||||
|
* map is first starting up. This lets us catch the case where we
|
||||||
|
* have *never* drawn the layer, and draw it even if the zoom hasn't
|
||||||
|
* changed.
|
||||||
|
* @type Boolean */
|
||||||
|
drawn: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
*
|
*
|
||||||
@@ -51,8 +60,9 @@ OpenLayers.Layer.Markers.prototype =
|
|||||||
moveTo:function(bounds, zoomChanged, dragging) {
|
moveTo:function(bounds, zoomChanged, dragging) {
|
||||||
OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
|
OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
|
||||||
|
|
||||||
if (zoomChanged) {
|
if (zoomChanged || !this.drawn) {
|
||||||
this.redraw();
|
this.redraw();
|
||||||
|
this.drawn = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD licence.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD licence.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
*
|
*
|
||||||
* @requires OpenLayers/Layer.js
|
* @requires OpenLayers/Layer.js
|
||||||
* @requires OpenLayers/Renderer.js
|
* @requires OpenLayers/Renderer.js
|
||||||
|
* @requires OpenLayers/Feature/Vector.js
|
||||||
*/
|
*/
|
||||||
OpenLayers.Layer.Vector = OpenLayers.Class.create();
|
OpenLayers.Layer.Vector = OpenLayers.Class.create();
|
||||||
OpenLayers.Layer.Vector.prototype =
|
OpenLayers.Layer.Vector.prototype =
|
||||||
@@ -21,17 +22,11 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
/** @type Boolean */
|
/** @type Boolean */
|
||||||
isVector: true,
|
isVector: true,
|
||||||
|
|
||||||
/** @type {Array(OpenLayer.Feature.Vector)} */
|
/** @type Array(OpenLayer.Feature.Vector) */
|
||||||
features: null,
|
features: null,
|
||||||
|
|
||||||
/** @type {Array(OpenLayers.Feature.Vector)} */
|
/** @type Array(OpenLayers.Feature.Vector) */
|
||||||
selectedFeatures: [],
|
selectedFeatures: null,
|
||||||
|
|
||||||
/** @type {Boolean} */
|
|
||||||
editing: false,
|
|
||||||
|
|
||||||
/** @type {Boolean} */
|
|
||||||
editable: false,
|
|
||||||
|
|
||||||
/** @type {Boolean} */
|
/** @type {Boolean} */
|
||||||
reportError: true,
|
reportError: true,
|
||||||
@@ -75,6 +70,10 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
* Options renderer {Object}: Typically SVGRenderer or VMLRenderer.
|
* Options renderer {Object}: Typically SVGRenderer or VMLRenderer.
|
||||||
*/
|
*/
|
||||||
initialize: function(name, options) {
|
initialize: function(name, options) {
|
||||||
|
|
||||||
|
var defaultStyle = OpenLayers.Feature.Vector.style['default'];
|
||||||
|
this.style = OpenLayers.Util.extend({}, defaultStyle);
|
||||||
|
|
||||||
OpenLayers.Layer.prototype.initialize.apply(this, arguments);
|
OpenLayers.Layer.prototype.initialize.apply(this, arguments);
|
||||||
|
|
||||||
// allow user-set renderer, otherwise assign one
|
// allow user-set renderer, otherwise assign one
|
||||||
@@ -98,12 +97,9 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
destroy: function() {
|
destroy: function() {
|
||||||
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
|
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
|
||||||
|
|
||||||
// HACK HACK -- I believe we should be iterating and
|
this.destroyFeatures();
|
||||||
// calling feature[i].destroy() here.
|
|
||||||
this.features = null;
|
this.features = null;
|
||||||
this.selectedFeatures = null;
|
this.selectedFeatures = null;
|
||||||
this.editing = null;
|
|
||||||
this.editable = null;
|
|
||||||
if (this.renderer) {
|
if (this.renderer) {
|
||||||
this.renderer.destroy();
|
this.renderer.destroy();
|
||||||
}
|
}
|
||||||
@@ -172,7 +168,7 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
/** Reset the vector layer's div so that it once again is lined up with
|
/** Reset the vector layer's div so that it once again is lined up with
|
||||||
* the map. Notify the renderer of the change of extent, and in the
|
* the map. Notify the renderer of the change of extent, and in the
|
||||||
* case of a change of zoom level (resolution), have the
|
* case of a change of zoom level (resolution), have the
|
||||||
* renderer reproject.
|
* renderer redraw features.
|
||||||
*
|
*
|
||||||
* If the layer has not yet been drawn, cycle through the layer's
|
* If the layer has not yet been drawn, cycle through the layer's
|
||||||
* features and draw each one.
|
* features and draw each one.
|
||||||
@@ -191,15 +187,11 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
this.renderer.setExtent(extent);
|
this.renderer.setExtent(extent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zoomChanged) {
|
if (!this.drawn || zoomChanged) {
|
||||||
this.renderer.reproject();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.drawn) {
|
|
||||||
this.drawn = true;
|
this.drawn = true;
|
||||||
for(var i = 0; i < this.features.length; i++) {
|
for(var i = 0; i < this.features.length; i++) {
|
||||||
var feature = this.features[i];
|
var feature = this.features[i];
|
||||||
this.renderer.drawGeometry(feature.geometry, feature.style);
|
this.drawFeature(feature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -228,17 +220,13 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
feature.layer = this;
|
feature.layer = this;
|
||||||
|
|
||||||
if (!feature.style) {
|
if (!feature.style) {
|
||||||
if (this.style) {
|
|
||||||
feature.style = OpenLayers.Util.extend({}, this.style);
|
feature.style = OpenLayers.Util.extend({}, this.style);
|
||||||
} else {
|
|
||||||
feature.style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.preFeatureInsert(feature);
|
this.preFeatureInsert(feature);
|
||||||
|
|
||||||
if (this.drawn) {
|
if (this.drawn) {
|
||||||
this.renderer.drawGeometry(feature.geometry, feature.style);
|
this.drawFeature(feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onFeatureInsert(feature);
|
this.onFeatureInsert(feature);
|
||||||
@@ -254,60 +242,91 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
features = [features];
|
features = [features];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < features.length; i++) {
|
for (var i = features.length - 1; i >= 0; i--) {
|
||||||
var feature = features[i];
|
var feature = features[i];
|
||||||
this.features = OpenLayers.Util.removeItem(this.features, feature);
|
this.features = OpenLayers.Util.removeItem(this.features, feature);
|
||||||
|
|
||||||
|
if (feature.geometry) {
|
||||||
this.renderer.eraseGeometry(feature.geometry);
|
this.renderer.eraseGeometry(feature.geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//in the case that this feature is one of the selected features,
|
||||||
|
// remove it from that array as well.
|
||||||
|
if (OpenLayers.Util.indexOf(this.selectedFeatures, feature) != -1){
|
||||||
|
OpenLayers.Util.removeItem(this.selectedFeatures, feature);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Destroy all features on the layer and empty the selected features array.
|
||||||
*/
|
*/
|
||||||
destroyFeatures: function () {
|
destroyFeatures: function () {
|
||||||
|
this.selectedFeatures = new Array();
|
||||||
for (var i = this.features.length - 1; i >= 0; i--) {
|
for (var i = this.features.length - 1; i >= 0; i--) {
|
||||||
this.features[i].destroy();
|
this.features[i].destroy();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} fid
|
* Draw (or redraw) a feature on the layer. If the optional style argument
|
||||||
|
* is included, this style will be used. If no style is included, the
|
||||||
|
* feature's style will be used. If the feature doesn't have a style,
|
||||||
|
* the layer's style will be used.
|
||||||
|
*
|
||||||
|
* @param {OpenLayers.Feature.Vector} feature
|
||||||
* @param {Object} style
|
* @param {Object} style
|
||||||
*/
|
*/
|
||||||
redrawFeature: function(fid, style) {
|
drawFeature: function(feature, style) {
|
||||||
for (var i = 0; i < this.features.length; i++) {
|
if(style == null) {
|
||||||
var feature = this.features[i];
|
if(feature.style) {
|
||||||
if (feature.fid == fid) {
|
style = feature.style;
|
||||||
this.renderer.drawGeometry(feature.geometry, style);
|
} else {
|
||||||
|
style = this.style;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.renderer.drawFeature(feature, style);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start editing the layer
|
* Erase features from the layer.
|
||||||
*
|
*
|
||||||
* @returns Whether or not the layer is editable
|
* @param {Array(OpenLayers.Feature.Vector)} features
|
||||||
* @type Boolean
|
|
||||||
*/
|
*/
|
||||||
unlock: function() {
|
eraseFeatures: function(features) {
|
||||||
if(this.editable) {
|
this.renderer.eraseFeatures(features);
|
||||||
this.editing = true;
|
|
||||||
}
|
|
||||||
return this.editable;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop editing the layer
|
* Given an event, return a feature if the event occurred over one.
|
||||||
|
* Otherwise, return null.
|
||||||
*
|
*
|
||||||
* @return Whether or not the layer *was* editing
|
* @param {Event}
|
||||||
* HACK HACK This return value seems wierd to me.
|
* @type OpenLayers.Feature.Vector
|
||||||
* @type Boolean
|
* @return A feature if one was under the event
|
||||||
*/
|
*/
|
||||||
lock: function() {
|
getFeatureFromEvent: function(evt) {
|
||||||
if(this.editing) {
|
var featureId = this.renderer.getFeatureIdFromEvent(evt);
|
||||||
this.editing = false;
|
return this.getFeatureById(featureId);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a feature id, return the feature if it exists in the features array
|
||||||
|
*
|
||||||
|
* @param String featureId
|
||||||
|
* @type OpenLayers.Feature.Vector
|
||||||
|
* @return A feature corresponding to the given featureId
|
||||||
|
*/
|
||||||
|
getFeatureById: function(featureId) {
|
||||||
|
//TBD - would it be more efficient to use a hash for this.features?
|
||||||
|
var feature = null;
|
||||||
|
for(var i=0; i<this.features.length; ++i) {
|
||||||
|
if(this.features[i].id == featureId) {
|
||||||
|
feature = this.features[i];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return this.editing;
|
}
|
||||||
|
return feature;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,8 +338,7 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
var vectorLayer = this.map.vectorLayer;
|
var vectorLayer = this.map.vectorLayer;
|
||||||
for (var i = 0; i < this.map.featureSelection.length; i++) {
|
for (var i = 0; i < this.map.featureSelection.length; i++) {
|
||||||
var featureSelection = this.map.featureSelection[i];
|
var featureSelection = this.map.featureSelection[i];
|
||||||
vectorLayer.renderer.drawGeometry(featureSelection.geometry,
|
vectorLayer.drawFeature(featureSelection, vectorLayer.style);
|
||||||
vectorLayer.style);
|
|
||||||
}
|
}
|
||||||
this.map.featureSelection = [];
|
this.map.featureSelection = [];
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -203,6 +203,17 @@ OpenLayers.Layer.WFS.prototype =
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call the onMapResize method of the appropriate parent class.
|
||||||
|
*/
|
||||||
|
onMapResize: function() {
|
||||||
|
if(this.vectorMode) {
|
||||||
|
OpenLayers.Layer.Vector.prototype.onMapResize.apply(this, arguments);
|
||||||
|
} else {
|
||||||
|
OpenLayers.Layer.Markers.prototype.onMapResize.apply(this, arguments);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} obj
|
* @param {Object} obj
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -93,6 +93,8 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
|||||||
|
|
||||||
// copy/set any non-init, non-simple values here
|
// copy/set any non-init, non-simple values here
|
||||||
|
|
||||||
|
obj.tile = null;
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -199,12 +199,26 @@ OpenLayers.Map.prototype = {
|
|||||||
|
|
||||||
// only append link stylesheet if the theme property is set
|
// only append link stylesheet if the theme property is set
|
||||||
if(this.theme) {
|
if(this.theme) {
|
||||||
|
// check existing links for equivalent url
|
||||||
|
var addNode = true;
|
||||||
|
var nodes = document.getElementsByTagName('link');
|
||||||
|
for(var i=0; i<nodes.length; ++i) {
|
||||||
|
if(OpenLayers.Util.isEquivalentUrl(nodes.item(i).href,
|
||||||
|
this.theme)) {
|
||||||
|
addNode = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// only add a new node if one with an equivalent url hasn't already
|
||||||
|
// been added
|
||||||
|
if(addNode) {
|
||||||
var cssNode = document.createElement('link');
|
var cssNode = document.createElement('link');
|
||||||
cssNode.setAttribute('rel', 'stylesheet');
|
cssNode.setAttribute('rel', 'stylesheet');
|
||||||
cssNode.setAttribute('type', 'text/css');
|
cssNode.setAttribute('type', 'text/css');
|
||||||
cssNode.setAttribute('href', this.theme);
|
cssNode.setAttribute('href', this.theme);
|
||||||
document.getElementsByTagName('head')[0].appendChild(cssNode);
|
document.getElementsByTagName('head')[0].appendChild(cssNode);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.layers = [];
|
this.layers = [];
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -33,6 +33,17 @@ OpenLayers.Marker.Box.prototype =
|
|||||||
this.setBorder(borderColor, borderWidth);
|
this.setBorder(borderColor, borderWidth);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
destroy: function() {
|
||||||
|
|
||||||
|
this.bounds = null;
|
||||||
|
this.div = null;
|
||||||
|
|
||||||
|
OpenLayers.Marker.prototype.destroy.apply(this, arguments);
|
||||||
|
},
|
||||||
|
|
||||||
/** Allow the user to change the box's color and border width
|
/** Allow the user to change the box's color and border width
|
||||||
*
|
*
|
||||||
* @param {String} color Default is "red"
|
* @param {String} color Default is "red"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -46,6 +46,9 @@ OpenLayers.Popup.prototype = {
|
|||||||
/** @type DOMElement */
|
/** @type DOMElement */
|
||||||
contentDiv:null,
|
contentDiv:null,
|
||||||
|
|
||||||
|
/** @type DOMElement */
|
||||||
|
groupDiv:null,
|
||||||
|
|
||||||
/** @type int */
|
/** @type int */
|
||||||
padding: 5,
|
padding: 5,
|
||||||
|
|
||||||
@@ -85,12 +88,17 @@ OpenLayers.Popup.prototype = {
|
|||||||
null, null, null, "hidden");
|
null, null, null, "hidden");
|
||||||
this.div.className = 'olPopup';
|
this.div.className = 'olPopup';
|
||||||
|
|
||||||
|
this.groupDiv = OpenLayers.Util.createDiv(null, null, null,
|
||||||
|
null, "relative", null,
|
||||||
|
"hidden");
|
||||||
|
|
||||||
var id = this.div.id + "_contentDiv";
|
var id = this.div.id + "_contentDiv";
|
||||||
this.contentDiv = OpenLayers.Util.createDiv(id, null, this.size.clone(),
|
this.contentDiv = OpenLayers.Util.createDiv(id, null, this.size.clone(),
|
||||||
null, "relative", null,
|
null, "relative", null,
|
||||||
"hidden");
|
"hidden");
|
||||||
this.contentDiv.className = 'olPopupContent';
|
this.contentDiv.className = 'olPopupContent';
|
||||||
this.div.appendChild(this.contentDiv);
|
this.groupDiv.appendChild(this.contentDiv);
|
||||||
|
this.div.appendChild(this.groupDiv);
|
||||||
|
|
||||||
if (closeBox == true) {
|
if (closeBox == true) {
|
||||||
// close icon
|
// close icon
|
||||||
@@ -102,10 +110,14 @@ OpenLayers.Popup.prototype = {
|
|||||||
img);
|
img);
|
||||||
closeImg.style.right = this.padding + "px";
|
closeImg.style.right = this.padding + "px";
|
||||||
closeImg.style.top = this.padding + "px";
|
closeImg.style.top = this.padding + "px";
|
||||||
this.div.appendChild(closeImg);
|
this.groupDiv.appendChild(closeImg);
|
||||||
|
|
||||||
var closeEvents = new OpenLayers.Events(this, closeImg);
|
var closePopup = function(e) {
|
||||||
closeEvents.register("mousedown", this, this.hide);
|
this.hide();
|
||||||
|
OpenLayers.Event.stop(e);
|
||||||
|
}
|
||||||
|
OpenLayers.Event.observe(closeImg, "click",
|
||||||
|
closePopup.bindAsEventListener(this));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ OpenLayers.Popup.AnchoredBubble.prototype =
|
|||||||
if (firstTime) {
|
if (firstTime) {
|
||||||
OpenLayers.Rico.Corner.round(this.div, options);
|
OpenLayers.Rico.Corner.round(this.div, options);
|
||||||
} else {
|
} else {
|
||||||
OpenLayers.Rico.Corner.reRound(this.contentDiv, options);
|
OpenLayers.Rico.Corner.reRound(this.groupDiv, options);
|
||||||
//set the popup color and opacity
|
//set the popup color and opacity
|
||||||
this.setBackgroundColor();
|
this.setBackgroundColor();
|
||||||
this.setOpacity();
|
this.setOpacity();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,36 +106,72 @@ OpenLayers.Renderer.prototype =
|
|||||||
return this.resolution;
|
return this.resolution;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw the feature. The optional style argument can be used
|
||||||
|
* to override the feature's own style. This method should only
|
||||||
|
* be called from layer.drawFeature().
|
||||||
|
*
|
||||||
|
* @param {OpenLayers.Feature.Vector} feature
|
||||||
|
* @param {Object} style
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
drawFeature: function(feature, style) {
|
||||||
|
if(style == null) {
|
||||||
|
style = feature.style;
|
||||||
|
}
|
||||||
|
this.drawGeometry(feature.geometry, style, feature.id);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virtual function
|
* virtual function
|
||||||
*
|
*
|
||||||
* Draw a geometry on the specified layer.
|
* Draw a geometry. This should only be called from the renderer itself.
|
||||||
|
* Use layer.drawFeature() from outside the renderer.
|
||||||
*
|
*
|
||||||
* @param geometry {OpenLayers.Geometry}
|
* @param geometry {OpenLayers.Geometry}
|
||||||
* @param style {Object}
|
* @param style {Object}
|
||||||
|
* @param {String} featureId
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawGeometry: function(geometry, style) {},
|
drawGeometry: function(geometry, style, featureId) {},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virtual function
|
* virtual function
|
||||||
*
|
*
|
||||||
* Clear all vectors from the renderer
|
* Clear all vectors from the renderer
|
||||||
*
|
* @private
|
||||||
*/
|
*/
|
||||||
clear: function() {},
|
clear: function() {},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virtual function
|
* virtual function
|
||||||
*
|
*
|
||||||
* Returns a geometry from an event that happened on a layer.
|
* Returns a feature id from an event on the renderer.
|
||||||
* How this happens is specific to the renderer.
|
* How this happens is specific to the renderer. This should be
|
||||||
|
* called from layer.getFeatureFromEvent().
|
||||||
*
|
*
|
||||||
* @param evt {OpenLayers.Event}
|
* @param evt {OpenLayers.Event}
|
||||||
*
|
*
|
||||||
* @returns A geometry from an event that happened on a layer
|
* @returns A feature id or null
|
||||||
* @type OpenLayers.Geometry
|
* @type String
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
getGeometryFromEvent: function(evt) {},
|
getFeatureIdFromEvent: function(evt) {},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is called by the layer to erase features
|
||||||
|
* @param {Array(OpenLayers.Feature.Vector)} features
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
eraseFeatures: function(features) {
|
||||||
|
if(!(features instanceof Array)) {
|
||||||
|
features = [features];
|
||||||
|
}
|
||||||
|
for(var i=0; i<features.length; ++i) {
|
||||||
|
this.eraseGeometry(features[i].geometry);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virtual function
|
* virtual function
|
||||||
@@ -143,6 +179,7 @@ OpenLayers.Renderer.prototype =
|
|||||||
* Remove a geometry from the renderer (by id)
|
* Remove a geometry from the renderer (by id)
|
||||||
*
|
*
|
||||||
* @param geometry {OpenLayers.Geometry}
|
* @param geometry {OpenLayers.Geometry}
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
eraseGeometry: function(geometry) {},
|
eraseGeometry: function(geometry) {},
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user