Compare commits
4 Commits
release-2.
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dcd05d13ce | ||
|
|
d8b8f44803 | ||
|
|
3c6cd6f559 | ||
|
|
b5103eb8ce |
@@ -2,7 +2,7 @@
|
||||
|
||||
OpenLayers.js -- OpenLayers Map Viewer Library
|
||||
|
||||
Copyright 2005-2006 MetaCarta, Inc., released under a BSD license.
|
||||
Copyright 2005-2006 MetaCarta, Inc., released under the BSD license.
|
||||
Please see http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
for the full text of the license.
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
OpenLayers contributors:
|
||||
Howard Butler
|
||||
Bertil Chaupis
|
||||
John Cole
|
||||
Jeff Dege
|
||||
Schuyler Erle
|
||||
Christian López Espínola
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#map {
|
||||
width: 512px;
|
||||
width: 45%;
|
||||
height: 350px;
|
||||
border: 1px solid gray;
|
||||
}
|
||||
@@ -42,8 +42,8 @@
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1>OpenLayers Draw Point Example</h1>
|
||||
<div style="float:right">
|
||||
<textarea id="gml" cols="80" rows="30"></textarea>
|
||||
<div style="float:right;width:50%">
|
||||
<textarea id="gml" style="width:100%" rows="30"></textarea>
|
||||
</div>
|
||||
<div id="map"></div>
|
||||
</body>
|
||||
|
||||
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();
|
||||
panel = new OpenLayers.Control.Panel({defaultControl: zb});
|
||||
var panel = new OpenLayers.Control.Panel({defaultControl: zb});
|
||||
panel.addControls([
|
||||
new OpenLayers.Control.MouseDefaults(),
|
||||
zb,
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
popup = new OpenLayers.Popup.Anchored("chicken",
|
||||
new OpenLayers.LonLat(5,40),
|
||||
new OpenLayers.Size(200,200),
|
||||
"example popup");
|
||||
"example popup", true);
|
||||
|
||||
map.addPopup(popup);
|
||||
}
|
||||
@@ -69,8 +69,17 @@
|
||||
}
|
||||
|
||||
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) {
|
||||
popup = feature.createPopup();
|
||||
popup = feature.createPopup(true);
|
||||
popup.setContentHTML("<a href='http://www.somethingconstructive.net' target='_blank'>click me</a>");
|
||||
popup.setBackgroundColor("yellow");
|
||||
popup.setOpacity(0.7);
|
||||
|
||||
@@ -17,11 +17,23 @@
|
||||
var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
|
||||
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");
|
||||
|
||||
// create a point feature
|
||||
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
|
||||
var pointList = [];
|
||||
@@ -32,7 +44,7 @@
|
||||
pointList.push(newPoint);
|
||||
}
|
||||
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
|
||||
var pointList = [];
|
||||
@@ -59,5 +71,9 @@
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<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>
|
||||
</html>
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
}
|
||||
|
||||
function displayWKT(feature) {
|
||||
var str = wkt.write(feature.geometry);
|
||||
var str = wkt.write(feature);
|
||||
// not a good idea in general, just for this demo
|
||||
str = str.replace(/,/g, ', ');
|
||||
document.getElementById('info').innerHTML = str;
|
||||
@@ -86,19 +86,18 @@
|
||||
|
||||
function parseWKT() {
|
||||
var element = document.getElementById('wkt');
|
||||
var collection = wkt.read(element.value);
|
||||
var features = wkt.read(element.value);
|
||||
var bounds;
|
||||
if(collection) {
|
||||
if(collection.constructor != Array) {
|
||||
collection = [collection];
|
||||
if(features) {
|
||||
if(features.constructor != Array) {
|
||||
features = [features];
|
||||
}
|
||||
var features = [];
|
||||
for(var i=0; i<collection.length; ++i) {
|
||||
features.push(new OpenLayers.Feature.Vector(collection[i]));
|
||||
for(var i=0; i<features.length; ++i) {
|
||||
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);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
@@ -31,8 +31,9 @@ OpenLayers.Class = {
|
||||
// so the util.extend() doesnt copy it over. we do it manually.
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
/**
|
||||
@@ -180,7 +180,8 @@ OpenLayers.Control.OverviewMap.prototype =
|
||||
this.elementEvents.register('dblclick', this, function(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('mousedown', this, this.rectMouseDown);
|
||||
this.rectEvents.register('mousemove', this, this.rectMouseMove);
|
||||
@@ -520,8 +521,8 @@ OpenLayers.Control.OverviewMap.prototype =
|
||||
this.ovmap.size.w - this.wComp);
|
||||
this.extentRectangle.style.top = parseInt(top) + 'px';
|
||||
this.extentRectangle.style.left = parseInt(left) + 'px';
|
||||
this.extentRectangle.style.height = parseInt(bottom - top)+ 'px';
|
||||
this.extentRectangle.style.width = parseInt(right - left) + 'px';
|
||||
this.extentRectangle.style.height = parseInt(Math.max(bottom - top, 0))+ 'px';
|
||||
this.extentRectangle.style.width = parseInt(Math.max(right - left, 0)) + 'px';
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* 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.
|
||||
// Access to this div is via the panel_div attribute of the
|
||||
// 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++) {
|
||||
var element = document.createElement("div");
|
||||
var textNode = document.createTextNode(" ");
|
||||
@@ -137,8 +139,6 @@ OpenLayers.Control.Panel.prototype =
|
||||
this.onClick.bind(this, controls[i]));
|
||||
OpenLayers.Event.observe(controls[i].panel_div, "mousedown",
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* 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',
|
||||
* and 'popupContentHTML' properties set in this.data. It uses
|
||||
* this.marker.icon as default anchor.
|
||||
@@ -132,7 +133,7 @@ OpenLayers.Feature.prototype= {
|
||||
*
|
||||
* @type OpenLayers.Popup.AnchoredBubble
|
||||
*/
|
||||
createPopup: function() {
|
||||
createPopup: function(closeBox) {
|
||||
|
||||
if (this.lonlat != null) {
|
||||
|
||||
@@ -143,7 +144,7 @@ OpenLayers.Feature.prototype= {
|
||||
this.lonlat,
|
||||
this.data.popupSize,
|
||||
this.data.popupContentHTML,
|
||||
anchor);
|
||||
anchor, closeBox);
|
||||
}
|
||||
return this.popup;
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
@@ -84,13 +84,11 @@ OpenLayers.Format.GML.prototype =
|
||||
|
||||
var feature = new OpenLayers.Feature.Vector();
|
||||
|
||||
if (xmlNode.firstChild.attributes && xmlNode.firstChild.attributes['fid']) {
|
||||
feature.fid = xmlNode.firstChild.attributes['fid'].nodeValue;
|
||||
}
|
||||
|
||||
// match MultiPolygon
|
||||
if (OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, this.gmlns, "gml", "MultiPolygon").length != 0) {
|
||||
var multipolygon = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, this.gmlns, "gml", "MultiPolygon")[0];
|
||||
feature.fid = multipolygon.parentNode.parentNode.getAttribute('fid');
|
||||
|
||||
geom = new OpenLayers.Geometry.MultiPolygon();
|
||||
var polygons = OpenLayers.Ajax.getElementsByTagNameNS(multipolygon,
|
||||
this.gmlns, "gml", "Polygon");
|
||||
@@ -104,6 +102,7 @@ OpenLayers.Format.GML.prototype =
|
||||
this.gmlns, "gml", "MultiLineString").length != 0) {
|
||||
var multilinestring = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
|
||||
this.gmlns, "gml", "MultiLineString")[0];
|
||||
feature.fid = multilinestring.parentNode.parentNode.getAttribute('fid');
|
||||
|
||||
geom = new OpenLayers.Geometry.MultiLineString();
|
||||
var lineStrings = OpenLayers.Ajax.getElementsByTagNameNS(multilinestring, this.gmlns, "gml", "LineString");
|
||||
@@ -122,6 +121,7 @@ OpenLayers.Format.GML.prototype =
|
||||
this.gmlns, "gml", "MultiPoint").length != 0) {
|
||||
var multiPoint = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
|
||||
this.gmlns, "gml", "MultiPoint")[0];
|
||||
feature.fid = multiPoint.parentNode.parentNode.getAttribute('fid');
|
||||
|
||||
geom = new OpenLayers.Geometry.MultiPoint();
|
||||
|
||||
@@ -138,6 +138,7 @@ OpenLayers.Format.GML.prototype =
|
||||
this.gmlns, "gml", "Polygon").length != 0) {
|
||||
var polygon = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
|
||||
this.gmlns, "gml", "Polygon")[0];
|
||||
feature.fid = polygon.parentNode.parentNode.getAttribute('fid');
|
||||
|
||||
geom = this.parsePolygonNode(polygon);
|
||||
}
|
||||
@@ -146,6 +147,8 @@ OpenLayers.Format.GML.prototype =
|
||||
this.gmlns, "gml", "LineString").length != 0) {
|
||||
var lineString = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
|
||||
this.gmlns, "gml", "LineString")[0];
|
||||
feature.fid = lineString.parentNode.parentNode.getAttribute('fid');
|
||||
|
||||
p = this.parseCoords(lineString);
|
||||
if (p.points) {
|
||||
geom = new OpenLayers.Geometry.LineString(p.points);
|
||||
@@ -157,6 +160,7 @@ OpenLayers.Format.GML.prototype =
|
||||
this.gmlns, "gml", "Point").length != 0) {
|
||||
var point = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
|
||||
this.gmlns, "gml", "Point")[0];
|
||||
feature.fid = point.parentNode.parentNode.getAttribute('fid');
|
||||
|
||||
p = this.parseCoords(point);
|
||||
if (p.points) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
@@ -97,10 +97,10 @@ OpenLayers.Format.GeoRSS.prototype =
|
||||
var path = "";
|
||||
if (points) {
|
||||
for (var i = 0; i < points.length; i++) {
|
||||
path += points[i].lat + " " + points[i].lon + " ";
|
||||
path += points[i].y + " " + points[i].x + " ";
|
||||
}
|
||||
} else {
|
||||
path += geometry.lat + " " + geometry.lon + " ";
|
||||
path += geometry.y + " " + geometry.x + " ";
|
||||
}
|
||||
return document.createTextNode(path);
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* 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
|
||||
* of OpenLayers.Geometry. Supports WKT for POINT, MULTIPOINT, LINESTRING,
|
||||
* MULTILINESTRING, POLYGON, MULTIPOLYGON, and GEOMETRYCOLLECTION.
|
||||
* Deserialize a WKT string and return an OpenLayers.Feature.Vector or an
|
||||
* array of OpenLayers.Feature.Vector. Supports WKT for POINT, MULTIPOINT,
|
||||
* LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON, and
|
||||
* GEOMETRYCOLLECTION.
|
||||
* @param {String} wkt A WKT string
|
||||
* @returns {OpenLayers.Geometry|Array} A geometry or array of geometries
|
||||
* for GEOMETRYCOLLECTION WKT.
|
||||
* @returns {OpenLayers.Feature.Vector|Array} A feature or array of
|
||||
* features for
|
||||
* GEOMETRYCOLLECTION WKT.
|
||||
*/
|
||||
read: function(wkt) {
|
||||
var geometry, type, str;
|
||||
var features, type, str;
|
||||
var matches = this.regExes.typeStr.exec(wkt);
|
||||
if(matches) {
|
||||
type = matches[1].toLowerCase();
|
||||
str = matches[2];
|
||||
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.
|
||||
* @param {OpenLayers.Geometry|Array} geom A geometry or array of geometries
|
||||
* Serialize a feature or array of features into a WKT string.
|
||||
* @param {OpenLayers.Feature.Vector|Array} features A feature or array of
|
||||
* features
|
||||
* @returns {String} The WKT string representation of the input geometries
|
||||
*/
|
||||
write: function(geom) {
|
||||
write: function(features) {
|
||||
var collection, geometry, type, data, isCollection;
|
||||
if(geom.constructor == Array) {
|
||||
collection = geom;
|
||||
if(features.constructor == Array) {
|
||||
collection = features;
|
||||
isCollection = true;
|
||||
} else {
|
||||
collection = [geom];
|
||||
collection = [features];
|
||||
isCollection = false;
|
||||
}
|
||||
var pieces = [];
|
||||
@@ -67,7 +70,7 @@ OpenLayers.Format.WKT.prototype =
|
||||
if(isCollection && i>0) {
|
||||
pieces.push(',');
|
||||
}
|
||||
geometry = collection[i];
|
||||
geometry = collection[i].geometry;
|
||||
type = geometry.CLASS_NAME.split('.')[2].toLowerCase();
|
||||
if(!this.extract[type]) {
|
||||
return null;
|
||||
@@ -178,47 +181,57 @@ OpenLayers.Format.WKT.prototype =
|
||||
*/
|
||||
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
|
||||
* @returns {OpenLayers.Geometry.Point} A point geometry
|
||||
* @returns {OpenLayers.Feature.Vector} A point feature
|
||||
* @private
|
||||
*/
|
||||
'point': function(str) {
|
||||
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
|
||||
* @returns {OpenLayers.Geometry.MultiPoint} A multipoint geometry
|
||||
* @returns {OpenLayers.Feature.Vector} A multipoint feature
|
||||
* @private
|
||||
*/
|
||||
'multipoint': function(str) {
|
||||
var points = str.trim().split(',');
|
||||
var components = [];
|
||||
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
|
||||
* @returns {OpenLayers.Geometry.LineString} A linestring geometry
|
||||
* @returns {OpenLayers.Feature.Vector} A linestring feature
|
||||
* @private
|
||||
*/
|
||||
'linestring': function(str) {
|
||||
var points = str.trim().split(',');
|
||||
var components = [];
|
||||
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
|
||||
* @returns {OpenLayers.Geometry.LineString} A multilinestring geometry
|
||||
* @returns {OpenLayers.Feature.Vector} A multilinestring feature
|
||||
* @private
|
||||
*/
|
||||
'multilinestring': function(str) {
|
||||
var line;
|
||||
@@ -226,15 +239,18 @@ OpenLayers.Format.WKT.prototype =
|
||||
var components = [];
|
||||
for(var i=0; i<lines.length; ++i) {
|
||||
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
|
||||
* @returns {OpenLayers.Geometry.Polygon} A polygon geometry
|
||||
* @returns {OpenLayers.Feature.Vector} A polygon feature
|
||||
* @private
|
||||
*/
|
||||
'polygon': function(str) {
|
||||
var ring, linestring, linearring;
|
||||
@@ -242,17 +258,20 @@ OpenLayers.Format.WKT.prototype =
|
||||
var components = [];
|
||||
for(var i=0; i<rings.length; ++i) {
|
||||
ring = rings[i].replace(this.regExes.trimParens, '$1');
|
||||
linestring = this.parse.linestring.apply(this, [ring]);
|
||||
linearring = new OpenLayers.Geometry.LinearRing(linestring.components);
|
||||
linestring = this.parse.linestring.apply(this, [ring]).geometry;
|
||||
linearring = new OpenLayers.Geometry.LinearRing(linestring.components)
|
||||
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
|
||||
* @returns {OpenLayers.Geometry.MultiPolygon} A multipolygon geometry
|
||||
* @returns {OpenLayers.Feature.Vector} A multipolygon feature
|
||||
* @private
|
||||
*/
|
||||
'multipolygon': function(str) {
|
||||
var polygon;
|
||||
@@ -260,15 +279,18 @@ OpenLayers.Format.WKT.prototype =
|
||||
var components = [];
|
||||
for(var i=0; i<polygons.length; ++i) {
|
||||
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
|
||||
* @returns {Array} An array of OpenLayers.Geometry
|
||||
* @returns {Array} An array of OpenLayers.Feature.Vector
|
||||
* @private
|
||||
*/
|
||||
'geometrycollection': function(str) {
|
||||
// separate components of the collection with |
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @requires OpenLayers/Format/WKT.js
|
||||
* @requires OpenLayers/Feature/Vector.js
|
||||
*/
|
||||
OpenLayers.Geometry = OpenLayers.Class.create();
|
||||
OpenLayers.Geometry.prototype = {
|
||||
@@ -150,7 +151,9 @@ OpenLayers.Geometry.prototype = {
|
||||
* @type String
|
||||
*/
|
||||
toString: function() {
|
||||
return OpenLayers.Format.WKT.prototype.write(this);
|
||||
return OpenLayers.Format.WKT.prototype.write(
|
||||
new OpenLayers.Feature.Vector(this)
|
||||
);
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
@@ -286,6 +286,8 @@ OpenLayers.Layer.prototype = {
|
||||
|
||||
if (!this.isBaseLayer) {
|
||||
this.inRange = this.calculateInRange();
|
||||
var show = ((this.visibility) && (this.inRange));
|
||||
this.div.style.display = show ? "" : "none";
|
||||
}
|
||||
|
||||
// deal with gutters
|
||||
@@ -606,13 +608,15 @@ OpenLayers.Layer.prototype = {
|
||||
if (viewPortPx != null) {
|
||||
var size = this.map.getSize();
|
||||
var center = this.map.getCenter();
|
||||
var res = this.map.getResolution();
|
||||
if (center) {
|
||||
var res = this.map.getResolution();
|
||||
|
||||
var delta_x = viewPortPx.x - (size.w / 2);
|
||||
var delta_y = viewPortPx.y - (size.h / 2);
|
||||
var delta_x = viewPortPx.x - (size.w / 2);
|
||||
var delta_y = viewPortPx.y - (size.h / 2);
|
||||
|
||||
lonlat = new OpenLayers.LonLat(center.lon + delta_x * res ,
|
||||
center.lat - delta_y * res);
|
||||
lonlat = new OpenLayers.LonLat(center.lon + delta_x * res ,
|
||||
center.lat - delta_y * res);
|
||||
} // else { DEBUG STATEMENT }
|
||||
}
|
||||
return lonlat;
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer.js
|
||||
* @requires OpenLayers/Tile/Image.js
|
||||
*/
|
||||
OpenLayers.Layer.Image = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.Image.prototype =
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
// @requires OpenLayers/Layer/Grid.js
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
@@ -21,6 +21,15 @@ OpenLayers.Layer.Markers.prototype =
|
||||
/** internal marker list
|
||||
* @type Array(OpenLayers.Marker) */
|
||||
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
|
||||
@@ -51,8 +60,9 @@ OpenLayers.Layer.Markers.prototype =
|
||||
moveTo:function(bounds, zoomChanged, dragging) {
|
||||
OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
|
||||
|
||||
if (zoomChanged) {
|
||||
if (zoomChanged || !this.drawn) {
|
||||
this.redraw();
|
||||
this.drawn = true;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD licence.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD licence.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
@@ -97,8 +97,7 @@ OpenLayers.Layer.Vector.prototype =
|
||||
destroy: function() {
|
||||
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
|
||||
|
||||
// HACK HACK -- I believe we should be iterating and
|
||||
// calling feature[i].destroy() here.
|
||||
this.destroyFeatures();
|
||||
this.features = null;
|
||||
this.selectedFeatures = null;
|
||||
if (this.renderer) {
|
||||
@@ -247,7 +246,15 @@ OpenLayers.Layer.Vector.prototype =
|
||||
var feature = features[i];
|
||||
this.features = OpenLayers.Util.removeItem(this.features, feature);
|
||||
|
||||
this.renderer.eraseGeometry(feature.geometry);
|
||||
if (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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
@@ -92,7 +92,9 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
||||
obj = OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this, [obj]);
|
||||
|
||||
// copy/set any non-init, non-simple values here
|
||||
|
||||
|
||||
obj.tile = null;
|
||||
|
||||
return obj;
|
||||
},
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
@@ -199,11 +199,25 @@ OpenLayers.Map.prototype = {
|
||||
|
||||
// only append link stylesheet if the theme property is set
|
||||
if(this.theme) {
|
||||
var cssNode = document.createElement('link');
|
||||
cssNode.setAttribute('rel', 'stylesheet');
|
||||
cssNode.setAttribute('type', 'text/css');
|
||||
cssNode.setAttribute('href', this.theme);
|
||||
document.getElementsByTagName('head')[0].appendChild(cssNode);
|
||||
// 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');
|
||||
cssNode.setAttribute('rel', 'stylesheet');
|
||||
cssNode.setAttribute('type', 'text/css');
|
||||
cssNode.setAttribute('href', this.theme);
|
||||
document.getElementsByTagName('head')[0].appendChild(cssNode);
|
||||
}
|
||||
}
|
||||
|
||||
this.layers = [];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
@@ -45,6 +45,9 @@ OpenLayers.Popup.prototype = {
|
||||
|
||||
/** @type DOMElement */
|
||||
contentDiv:null,
|
||||
|
||||
/** @type DOMElement */
|
||||
groupDiv:null,
|
||||
|
||||
/** @type int */
|
||||
padding: 5,
|
||||
@@ -84,13 +87,18 @@ OpenLayers.Popup.prototype = {
|
||||
this.div = OpenLayers.Util.createDiv(this.id, null, null,
|
||||
null, null, null, "hidden");
|
||||
this.div.className = 'olPopup';
|
||||
|
||||
this.groupDiv = OpenLayers.Util.createDiv(null, null, null,
|
||||
null, "relative", null,
|
||||
"hidden");
|
||||
|
||||
var id = this.div.id + "_contentDiv";
|
||||
this.contentDiv = OpenLayers.Util.createDiv(id, null, this.size.clone(),
|
||||
null, "relative", null,
|
||||
"hidden");
|
||||
this.contentDiv.className = 'olPopupContent';
|
||||
this.div.appendChild(this.contentDiv);
|
||||
this.groupDiv.appendChild(this.contentDiv);
|
||||
this.div.appendChild(this.groupDiv);
|
||||
|
||||
if (closeBox == true) {
|
||||
// close icon
|
||||
@@ -102,7 +110,7 @@ OpenLayers.Popup.prototype = {
|
||||
img);
|
||||
closeImg.style.right = this.padding + "px";
|
||||
closeImg.style.top = this.padding + "px";
|
||||
this.div.appendChild(closeImg);
|
||||
this.groupDiv.appendChild(closeImg);
|
||||
|
||||
var closePopup = function(e) {
|
||||
this.hide();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
@@ -139,7 +139,7 @@ OpenLayers.Popup.AnchoredBubble.prototype =
|
||||
if (firstTime) {
|
||||
OpenLayers.Rico.Corner.round(this.div, options);
|
||||
} else {
|
||||
OpenLayers.Rico.Corner.reRound(this.contentDiv, options);
|
||||
OpenLayers.Rico.Corner.reRound(this.groupDiv, options);
|
||||
//set the popup color and opacity
|
||||
this.setBackgroundColor();
|
||||
this.setOpacity();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
@@ -50,7 +50,9 @@ OpenLayers.Renderer.SVG.prototype =
|
||||
*/
|
||||
supported: function() {
|
||||
var svgFeature = "http://www.w3.org/TR/SVG11/feature#SVG";
|
||||
var supported = (document.implementation.hasFeature("org.w3c.svg", "1.0") || document.implementation.hasFeature(svgFeature, "1.1"));
|
||||
var supported = (document.implementation &&
|
||||
(document.implementation.hasFeature("org.w3c.svg", "1.0") ||
|
||||
document.implementation.hasFeature(svgFeature, "1.1")));
|
||||
return supported;
|
||||
},
|
||||
|
||||
@@ -282,9 +284,7 @@ OpenLayers.Renderer.SVG.prototype =
|
||||
node.setAttributeNS(null, "cy", y);
|
||||
node.setAttributeNS(null, "r", radius);
|
||||
} else {
|
||||
node.setAttributeNS(null, "cx", "");
|
||||
node.setAttributeNS(null, "cy", "");
|
||||
node.setAttributeNS(null, "r", 0);
|
||||
this.root.removeChild(node);
|
||||
}
|
||||
|
||||
},
|
||||
@@ -434,8 +434,9 @@ OpenLayers.Renderer.SVG.prototype =
|
||||
var strings = [];
|
||||
for(var i = 0; i < components.length; i++) {
|
||||
var component = this.getShortString(components[i]);
|
||||
if (!component) { return false; }
|
||||
strings.push(component);
|
||||
if (component) {
|
||||
strings.push(component);
|
||||
}
|
||||
}
|
||||
return strings.join(",");
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user