Merge branch 'master' of github.com:openlayers/openlayers into upstream/master

This commit is contained in:
ahocevar
2012-05-30 23:08:06 +02:00
44 changed files with 410 additions and 190 deletions

View File

@@ -8,7 +8,7 @@
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="http://maps.google.com/maps/api/js?v=3.6&amp;sensor=false"></script>
<script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script>
<script src="../lib/OpenLayers.js"></script>
<script src="all-overlays-google.js"></script>
</head>

View File

@@ -20,7 +20,7 @@ map.addControl(draw);
draw.activate();
// handle clicks on method links
$("insertXY").onclick = function() {
document.getElementById("insertXY").onclick = function() {
var values = parseInput(
window.prompt(
"Enter map coordinates for new point (e.g. '-111, 46')", "x, y"
@@ -30,7 +30,7 @@ $("insertXY").onclick = function() {
draw.insertXY(values[0], values[1]);
}
};
$("insertDeltaXY").onclick = function() {
document.getElementById("insertDeltaXY").onclick = function() {
var values = parseInput(
window.prompt(
"Enter offset values for new point (e.g. '15, -10')", "dx, dy"
@@ -40,7 +40,7 @@ $("insertDeltaXY").onclick = function() {
draw.insertDeltaXY(values[0], values[1]);
}
};
$("insertDirectionLength").onclick = function() {
document.getElementById("insertDirectionLength").onclick = function() {
var values = parseInput(
window.prompt(
"Enter direction and length offset values for new point (e.g. '-45, 10')", "direction, length"
@@ -50,7 +50,7 @@ $("insertDirectionLength").onclick = function() {
draw.insertDirectionLength(values[0], values[1]);
}
};
$("insertDeflectionLength").onclick = function() {
document.getElementById("insertDeflectionLength").onclick = function() {
var values = parseInput(
window.prompt(
"Enter deflection and length offset values for new point (e.g. '15, 20')", "deflection, length"
@@ -60,10 +60,10 @@ $("insertDeflectionLength").onclick = function() {
draw.insertDeflectionLength(values[0], values[1]);
}
};
$("cancel").onclick = function() {
document.getElementById("cancel").onclick = function() {
draw.cancel();
};
$("finishSketch").onclick = function() {
document.getElementById("finishSketch").onclick = function() {
draw.finishSketch();
};

View File

@@ -35,7 +35,7 @@
function init() {
map = new OpenLayers.Map( 'map',
{
'maxExtent': new OpenLayers.Bounds(0, 0, $("map").clientWidth, $("map").clientHeight),
'maxExtent': new OpenLayers.Bounds(0, 0, document.getElementById("map").clientWidth, document.getElementById("map").clientHeight),
controls: [],
maxResolution: 'auto'}
);

View File

@@ -92,16 +92,15 @@ geolocate.events.register("locationupdated",geolocate,function(e) {
geolocate.events.register("locationfailed",this,function() {
OpenLayers.Console.log('Location detection failed');
});
$('locate').onclick = function() {
document.getElementById('locate').onclick = function() {
vector.removeAllFeatures();
geolocate.deactivate();
$('track').checked = false;
document.getElementById('track').checked = false;
geolocate.watch = false;
firstGeolocation = true;
geolocate.activate();
};
$('track').onclick = function() {
document.getElementById('track').onclick = function() {
vector.removeAllFeatures();
geolocate.deactivate();
if (this.checked) {
@@ -110,4 +109,4 @@ $('track').onclick = function() {
geolocate.activate();
}
};
$('track').checked = false;
document.getElementById('track').checked = false;

View File

@@ -48,7 +48,6 @@
</style>
<script defer="defer" type="text/javascript">
OpenLayers.ProxyHost = "proxy.cgi?url=";
var map, infocontrols, water, highlightlayer;
function load() {
@@ -125,7 +124,7 @@
highlightLayer.addFeatures(evt.features);
highlightLayer.redraw();
} else {
$('responseText').innerHTML = evt.text;
document.getElementById('responseText').innerHTML = evt.text;
}
}

View File

@@ -8,7 +8,7 @@
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="http://maps.google.com/maps/api/js?v=3.6&amp;sensor=false"></script>
<script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script>
<script src="../lib/OpenLayers.js"></script>
<script src="google-v3-alloverlays.js"></script>
</head>

View File

@@ -8,7 +8,7 @@
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="http://maps.google.com/maps/api/js?v=3.6&amp;sensor=false"></script>
<script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script>
<script src="../lib/OpenLayers.js"></script>
<script src="google-v3.js"></script>
</head>
@@ -35,6 +35,17 @@
location, you must include the extra theme/default/google.css
stylesheet.
</p>
<p>
<strong>Note on Google Maps API versioning:</strong>
This example uses the "nightly" version of Google Maps
API. This is specified by using <code>v=3</code> in the
the Google Maps API URL. Production applications should use the
"release" or "frozen" versions of Google Maps
API. See the <code>OpenLayers.Layer.Google.v3</code> API
docs, and the
<a href="https://developers.google.com/maps/documentation/javascript/basics#Versioning">Versioning Section</a>
of the Google Maps API docs, for more details.
</p>
</div>
</body>
</html>

View File

@@ -163,8 +163,8 @@ var map;
{layer:"lb", requestEncoding:"REST", transitionEffect:"resize"}, defaults
));
labels = format.createLayer(caps, OpenLayers.Util.applyDefaults(
{layer:"beschriftung", requestEncoding:"REST", isBaseLayer: false},
OpenLayers.Util.extend({className: "nofade"}, defaults)
{layer:"beschriftung", requestEncoding:"REST", className:"nofade", isBaseLayer: false},
defaults
));
map.addLayers([fmzk, aerial, labels]);
zoomToInitialExtent();
@@ -184,21 +184,21 @@ var map;
attribution: 'Datenquelle: Stadt Wien - <a href="http://data.wien.gv.at">data.wien.gv.at</a>'
};
fmzk = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({
url: "http://www.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
url: "http://maps.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
layer: "fmzk",
style: "pastell",
transitionEffect: "resize"
},
defaults));
aerial = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({
url: "http://www.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
url: "http://maps.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
layer: "lb",
style: "farbe",
transitionEffect: "resize"
},
defaults));
labels = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({
url: "http://www.wien.gv.at/wmts/beschriftung/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
url: "http://maps.wien.gv.at/wmts/beschriftung/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
layer: "beschriftung",
style: "normal",
transitionEffect: null,

View File

@@ -8,7 +8,7 @@
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="http://maps.google.com/maps/api/js?v=3.6&amp;sensor=false"></script>
<script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script>
<script src="../lib/OpenLayers.js"></script>
<script src="osm-google.js"></script>
</head>

View File

@@ -80,7 +80,9 @@
// create an overview map control with the default options
var overview1 = new OpenLayers.Control.OverviewMap({
maximized: true
maximized: true,
maximizeTitle: 'Show the overview map',
minimizeTitle: 'Hide the overview map'
});
map1.addControl(overview1);

View File

@@ -15,6 +15,7 @@
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
var map, drawControls;
OpenLayers.Feature.Vector.style['default']['strokeWidth'] = '2';
function init(){
map = new OpenLayers.Map('map');
@@ -33,10 +34,10 @@
});
vectors.events.on({
'featureselected': function(feature) {
$('counter').innerHTML = this.selectedFeatures.length;
document.getElementById('counter').innerHTML = this.selectedFeatures.length;
},
'featureunselected': function(feature) {
$('counter').innerHTML = this.selectedFeatures.length;
document.getElementById('counter').innerHTML = this.selectedFeatures.length;
}
});

View File

@@ -35,13 +35,12 @@
<script type="text/javascript">
OpenLayers.Feature.Vector.style['default']['strokeWidth'] = '2';
function init() {
initMap();
initUI();
}
var map, draw, modify, snap, split, vectors;
function initMap() {
@@ -185,15 +184,15 @@
*/
function initUI() {
// add behavior to snap elements
var snapCheck = $("snap_toggle");
var snapCheck = document.getElementById("snap_toggle");
snapCheck.checked = true;
snapCheck.onclick = function() {
if(snapCheck.checked) {
snap.activate();
$("snap_options").style.display = "block";
document.getElementById("snap_options").style.display = "block";
} else {
snap.deactivate();
$("snap_options").style.display = "none";
document.getElementById("snap_options").style.display = "none";
}
};
var target, type, tog, tol;
@@ -201,12 +200,12 @@
var target = snap.targets[0];
for(var j=0; j<types.length; ++j) {
type = types[j];
tog = $("target_" + type);
tog = document.getElementById("target_" + type);
tog.checked = target[type];
tog.onclick = (function(tog, type, target) {
return function() {target[type] = tog.checked;}
})(tog, type, target);
tol = $("target_" + type + "Tolerance");
tol = document.getElementById("target_" + type + "Tolerance");
tol.value = target[type + "Tolerance"];
tol.onchange = (function(tol, type, target) {
return function() {
@@ -216,24 +215,24 @@
}
// add behavior to split elements
var splitCheck = $("split_toggle");
var splitCheck = document.getElementById("split_toggle");
splitCheck.checked = true;
splitCheck.onclick = function() {
if(splitCheck.checked) {
split.activate();
$("split_options").style.display = "block";
document.getElementById("split_options").style.display = "block";
} else {
split.deactivate();
$("split_options").style.display = "none";
document.getElementById("split_options").style.display = "none";
}
};
var edgeCheck = $("edge_toggle");
var edgeCheck = document.getElementById("edge_toggle");
edgeCheck.checked = split.edge;
edgeCheck.onclick = function() {
split.edge = edgeCheck.checked;
};
$("clear").onclick = function() {
document.getElementById("clear").onclick = function() {
modify.deactivate();
vectors.destroyFeatures();
};

View File

@@ -33,7 +33,7 @@
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
OpenLayers.Feature.Vector.style['default']['strokeWidth'] = '2';
function init() {
initMap();
initUI();
@@ -194,7 +194,7 @@
* property values.
*/
function initUI() {
var check = $("snapping");
var check = document.getElementById("snapping");
check.checked = true;
check.onclick = function() {
if(check.checked) {
@@ -204,7 +204,7 @@
}
};
var sel = $("editable");
var sel = document.getElementById("editable");
sel.value = "poly";
sel.onchange = function() {
updateEditable(sel.value);
@@ -216,12 +216,12 @@
target = snap.targets[i];
for(var j=0; j<types.length; ++j) {
type = types[j];
tog = $(i + "_" + type);
tog = document.getElementById(i + "_" + type);
tog.checked = target[type];
tog.onclick = (function(tog, type, target) {
return function() {target[type] = tog.checked;}
})(tog, type, target);
tol = $(i + "_" + type + "Tolerance");
tol = document.getElementById(i + "_" + type + "Tolerance");
tol.value = target[type + "Tolerance"];
tol.onchange = (function(tol, type, target) {
return function() {

View File

@@ -22,7 +22,7 @@
}
</style>
<script src="http://maps.google.com/maps/api/js?v=3.6&amp;sensor=false"></script>
<script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script>
<script src="../lib/OpenLayers.js"></script>
</head>

View File

@@ -73,67 +73,67 @@ var map, vectorlayer, features, stylemap, select;
// The function that gets called on feature selection: shows information
// about the feature/cluser in a div on the page
var showInformation = function(evt){
var showInformation = function(evt){
var feature = evt.feature;
var info = 'Last hovered feature:<br>';
if (feature.cluster) {
info += '&nbsp;&nbsp;Cluster of ' + feature.attributes.count + ' features:';
var clazzes = {
'1': 0,
'2': 0,
'3': 0,
'4': 0
};
for (var i = 0; i < feature.attributes.count; i++) {
var feat = feature.cluster[i];
clazzes[feat.attributes.clazz]++;
}
for (var j=1; j<=4; j++) {
var plural_s = (clazzes[j] !== 1) ? 's' : '';
info += '<br>&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;clazz ' + j + ': ' + clazzes[j] + ' feature' + plural_s;
}
} else {
info += '&nbsp;&nbsp;Single feature of clazz = ' + feature.attributes.clazz;
}
$('info').innerHTML = info;
var info = 'Last hovered feature:<br>';
if (feature.cluster) {
info += '&nbsp;&nbsp;Cluster of ' + feature.attributes.count + ' features:';
var clazzes = {
'1': 0,
'2': 0,
'3': 0,
'4': 0
};
for (var i = 0; i < feature.attributes.count; i++) {
var feat = feature.cluster[i];
clazzes[feat.attributes.clazz]++;
}
for (var j=1; j<=4; j++) {
var plural_s = (clazzes[j] !== 1) ? 's' : '';
info += '<br>&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;clazz ' + j + ': ' + clazzes[j] + ' feature' + plural_s;
}
} else {
info += '&nbsp;&nbsp;Single feature of clazz = ' + feature.attributes.clazz;
}
document.getElementById('info').innerHTML = info;
};
// The function that gets called on feature selection. Shows information
// The function that gets called on feature selection. Shows information
// about the number of "points" on the map.
var updateGeneralInformation = function() {
var info = 'Currently ' + vectorlayer.features.length + ' points are shown on the map.';
$('generalinfo').innerHTML = info;
};
// instanciate the map
map = new OpenLayers.Map("map");
var updateGeneralInformation = function() {
var info = 'Currently ' + vectorlayer.features.length + ' points are shown on the map.';
document.getElementById('generalinfo').innerHTML = info;
};
// background WMS
// instanciate the map
map = new OpenLayers.Map("map");
// background WMS
var ol_wms = new OpenLayers.Layer.WMS("OpenLayers WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0", {
layers: "basic"
});
// context to style the vectorlayer
// context to style the vectorlayer
var context = {
getColor: function(feature){
var color = '#aaaaaa';
if (feature.attributes.clazz && feature.attributes.clazz === 4) {
color = '#ee0000';
} else if(feature.cluster) {
var onlyFour = true;
for (var i = 0; i < feature.cluster.length; i++) {
if (onlyFour && feature.cluster[i].attributes.clazz !== 4) {
onlyFour = false;
}
}
if (onlyFour === true) {
color = '#ee0000';
}
}
return color;
if (feature.attributes.clazz && feature.attributes.clazz === 4) {
color = '#ee0000';
} else if(feature.cluster) {
var onlyFour = true;
for (var i = 0; i < feature.cluster.length; i++) {
if (onlyFour && feature.cluster[i].attributes.clazz !== 4) {
onlyFour = false;
}
}
if (onlyFour === true) {
color = '#ee0000';
}
}
return color;
}
};
// style the vectorlayer
stylemap = new OpenLayers.StyleMap({
'default': new OpenLayers.Style({
@@ -143,32 +143,32 @@ var map, vectorlayer, features, stylemap, select;
strokeColor: "#666666",
strokeWidth: 1,
strokeOpacity: 1,
graphicZIndex: 1
graphicZIndex: 1
}, {
context: context
}),
'select' : new OpenLayers.Style({
'select' : new OpenLayers.Style({
pointRadius: 5,
fillColor: "#ffff00",
fillOpacity: 1,
strokeColor: "#666666",
strokeWidth: 1,
strokeOpacity: 1,
graphicZIndex: 2
graphicZIndex: 2
})
});
// the vectorlayer
vectorlayer = new OpenLayers.Layer.Vector('Vectorlayer', {styleMap: stylemap, strategies: []});
// the select control
select = new OpenLayers.Control.SelectFeature(
// the select control
select = new OpenLayers.Control.SelectFeature(
vectorlayer, {hover: true}
);
map.addControl(select);
select.activate();
vectorlayer.events.on({"featureselected": showInformation});
map.addLayers([ol_wms, vectorlayer]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.zoomToMaxExtent();
@@ -197,18 +197,18 @@ var map, vectorlayer, features, stylemap, select;
switch(this.value) {
case 'cluster':
// standard clustering
strategies.push(new OpenLayers.Strategy.Cluster());
strategies.push(new OpenLayers.Strategy.Cluster());
break;
case 'attribute-cluster':
// use the custom class: only cluster features of the same clazz
strategies.push(new OpenLayers.Strategy.AttributeCluster({
strategies.push(new OpenLayers.Strategy.AttributeCluster({
attribute:'clazz'
}));
break;
case 'rule-cluster':
// use the custom class: only cluster features that have a
// clazz smaller than 4
strategies.push(new OpenLayers.Strategy.RuleCluster({
// clazz smaller than 4
strategies.push(new OpenLayers.Strategy.RuleCluster({
rule: new OpenLayers.Rule({
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.LESS_THAN,
@@ -219,24 +219,24 @@ var map, vectorlayer, features, stylemap, select;
}));
break;
}
// remove layer and control
// remove layer and control
map.removeLayer(vectorlayer);
map.removeControl(select);
// rebuild layer
map.removeControl(select);
// rebuild layer
vectorlayer = new OpenLayers.Layer.Vector('Vectorlayer', {styleMap: stylemap, strategies: strategies});
map.addLayer( vectorlayer );
vectorlayer.addFeatures(features);
// rebuild select control
select = new OpenLayers.Control.SelectFeature(
vectorlayer, {hover: true}
);
map.addControl(select);
select.activate();
vectorlayer.events.on({"featureselected": showInformation});
// update meta information
updateGeneralInformation();
select = new OpenLayers.Control.SelectFeature(
vectorlayer, {hover: true}
);
map.addControl(select);
select.activate();
vectorlayer.events.on({"featureselected": showInformation});
// update meta information
updateGeneralInformation();
};
// bind the behviour to the radios
// bind the behviour to the radios
var inputs = document.getElementsByTagName('input');
for( var cnt = 0; cnt < inputs.length; cnt++) {
var input = inputs[cnt];

View File

@@ -18,7 +18,6 @@
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
// create a semi-random grid of features to be clustered
var dx = 3;
var dy = 3;
@@ -90,24 +89,24 @@
map.setCenter(new OpenLayers.LonLat(0, 0), 2);
reset();
$("reset").onclick = reset;
document.getElementById("reset").onclick = reset;
}
function reset() {
var distance = parseInt($("distance").value);
var threshold = parseInt($("threshold").value);
var distance = parseInt(document.getElementById("distance").value);
var threshold = parseInt(document.getElementById("threshold").value);
strategy.distance = distance || strategy.distance;
strategy.threshold = threshold || strategy.threshold;
$("distance").value = strategy.distance;
$("threshold").value = strategy.threshold || "null";
document.getElementById("distance").value = strategy.distance;
document.getElementById("threshold").value = strategy.threshold || "null";
clusters.removeFeatures(clusters.features);
clusters.addFeatures(features);
}
function display(event) {
var f = event.feature;
var el = $("output");
var el = document.getElementById("output");
if(f.cluster) {
el.innerHTML = "cluster of " + f.attributes.count;
} else {

View File

@@ -69,6 +69,7 @@
<script src="Jugl.js"></script>
<script src="animator.js"></script>
<script type="text/javascript">
var map, template;
/**
@@ -171,21 +172,21 @@
function display(event) {
// clear previous photo list and create new one
$("photos").innerHTML = "";
document.getElementById("photos").innerHTML = "";
var node = template.process({
context: {features: event.feature.cluster},
clone: true,
parent: $("photos")
parent: document.getElementById("photos")
});
// set up forward/rewind
var forward = Animator.apply($("list"), ["start", "end"], {duration: 1500});
$("scroll-end").onmouseover = function() {forward.seekTo(1)};
$("scroll-end").onmouseout = function() {forward.seekTo(forward.state)};
$("scroll-start").onmouseover = function() {forward.seekTo(0)};
$("scroll-start").onmouseout = function() {forward.seekTo(forward.state)};
var forward = Animator.apply(document.getElementById("list"), ["start", "end"], {duration: 1500});
document.getElementById("scroll-end").onmouseover = function() {forward.seekTo(1)};
document.getElementById("scroll-end").onmouseout = function() {forward.seekTo(forward.state)};
document.getElementById("scroll-start").onmouseover = function() {forward.seekTo(0)};
document.getElementById("scroll-start").onmouseout = function() {forward.seekTo(forward.state)};
// set up photo zoom
for(var i=0; i<event.feature.cluster.length; ++i) {
listen($("link-" + i), Animator.apply($("photo-" + i), ["thumb", "big"]));
listen(document.getElementById("link-" + i), Animator.apply(document.getElementById("photo-" + i), ["thumb", "big"]));
}
}

View File

@@ -11,7 +11,7 @@
<script type="text/javascript">
var map, layer;
function init(){
map = new OpenLayers.Map( $('map'), {
map = new OpenLayers.Map( 'map', {
resolutions: [0.087890625, 0.0439453125, 0.02197265625, 0.010986328125]
});
layer = new OpenLayers.Layer.TileCache("TileCache Layer",

View File

@@ -1,4 +1,5 @@
var map, vector;
function init(){
map = new OpenLayers.Map('map', {
projection: 'EPSG:31467',
@@ -7,16 +8,16 @@ function init(){
numZoomLevels: 1,
controls: [
new OpenLayers.Control.Attribution({
div: $('attribution')
div: document.getElementById('attribution')
}),
new OpenLayers.Control.MousePosition({
div: $('mouse-position-31467'),
div: document.getElementById('mouse-position-31467'),
prefix: 'Coordinates: ',
suffix: ' (in <a href="http://spatialreference.org/ref/epsg/'
+ '31467/">EPSG:31467</a>)'
}),
new OpenLayers.Control.MousePosition({
div: $('mouse-position-4326'),
div: document.getElementById('mouse-position-4326'),
displayProjection: new OpenLayers.Projection('EPSG:4326'),
prefix: 'Coordinates: ',
suffix: ' (in <a href="http://spatialreference.org/ref/epsg/'
@@ -59,7 +60,7 @@ function addVector(x, y, btn){
status += '<br /><code class="emph"> '
+ geometry.toString() + '</code>.';
$('status').innerHTML = status;
document.getElementById('status').innerHTML = status;
var feature = new OpenLayers.Feature.Vector(geometry, {}, {
strokeColor: '#333333',
@@ -110,7 +111,7 @@ function addOutline(btn) {
transformedFeature = new OpenLayers.Feature.Vector(geometry, {}, style);
vector.addFeatures([transformedFeature]);
$('status').innerHTML = 'Transformed polygon';
document.getElementById('status').innerHTML = 'Transformed polygon';
btn.disabled = true;
}
@@ -124,8 +125,8 @@ function clearVectors(){
'btnGermany'
];
for (var i = 0, len = ids.length; i < len; i++) {
var elem = $(ids[i]);
var elem = document.getElementById(ids[i]);
elem.disabled = false;
}
$('status').innerHTML = '';
document.getElementById('status').innerHTML = '';
}

View File

@@ -414,4 +414,4 @@
/**
* Constant: VERSION_NUMBER
*/
OpenLayers.VERSION_NUMBER="Release 2.12-rc4";
OpenLayers.VERSION_NUMBER="Release 2.12-rc5";

View File

@@ -261,8 +261,11 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
* deltaZ - {Integer}
*/
wheelChange: function(evt, deltaZ) {
if (!this.map.fractionalZoom) {
deltaZ = Math.round(deltaZ);
}
var currentZoom = this.map.getZoom();
var newZoom = this.map.getZoom() + Math.round(deltaZ);
var newZoom = this.map.getZoom() + deltaZ;
newZoom = Math.max(newZoom, 0);
newZoom = Math.min(newZoom, this.map.getNumZoomLevels());
if (newZoom === currentZoom) {

View File

@@ -127,6 +127,20 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
*/
maximized: false,
/**
* APIProperty: maximizeTitle
* {String} This property is used for showing a tooltip over the
* maximize div. Defaults to "" (no title).
*/
maximizeTitle: "",
/**
* APIProperty: minimizeTitle
* {String} This property is used for showing a tooltip over the
* minimize div. Defaults to "" (no title).
*/
minimizeTitle: "",
/**
* Constructor: OpenLayers.Control.OverviewMap
* Create a new overview map
@@ -247,6 +261,9 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
'absolute');
this.maximizeDiv.style.display = 'none';
this.maximizeDiv.className = this.displayClass + 'MaximizeButton olButton';
if (this.maximizeTitle) {
this.maximizeDiv.title = this.maximizeTitle;
}
this.div.appendChild(this.maximizeDiv);
// minimize button div
@@ -259,6 +276,9 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
'absolute');
this.minimizeDiv.style.display = 'none';
this.minimizeDiv.className = this.displayClass + 'MinimizeButton olButton';
if (this.minimizeTitle) {
this.minimizeDiv.title = this.minimizeTitle;
}
this.div.appendChild(this.minimizeDiv);
this.minimizeControl();
} else {

View File

@@ -285,11 +285,9 @@ OpenLayers.Event = {
if (elementObservers) {
for(var i = elementObservers.length-1; i >= 0; i--) {
var entry = elementObservers[i];
var args = new Array(entry.element,
entry.name,
entry.observer,
entry.useCapture);
var removed = OpenLayers.Event.stopObserving.apply(this, args);
OpenLayers.Event.stopObserving.apply(this, [
entry.element, entry.name, entry.observer, entry.useCapture
]);
}
}
},

View File

@@ -311,8 +311,7 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
/**
* Method: parseStyles
* Looks for <Style> nodes in the data and parses them
* Also parses <StyleMap> nodes, but only uses the 'normal' key
* Parses <Style> nodes
*
* Parameters:
* nodes - {Array} of {DOMElement} data to read/parse.
@@ -558,8 +557,7 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
/**
* Method: parseStyleMaps
* Looks for <Style> nodes in the data and parses them
* Also parses <StyleMap> nodes, but only uses the 'normal' key
* Parses <StyleMap> nodes, but only uses the 'normal' key
*
* Parameters:
* nodes - {Array} of {DOMElement} data to read/parse.
@@ -1212,8 +1210,8 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
createPlacemarkXML: function(feature) {
// Placemark name
var placemarkName = this.createElementNS(this.kmlns, "name");
var name = feature.style && feature.style.label ? feature.style.label :
feature.attributes.name || feature.id;
var label = (feature.style && feature.style.label) ? feature.style.label : feature.id;
var name = feature.attributes.name || label;
placemarkName.appendChild(this.createTextNode(name));
// Placemark description

View File

@@ -54,7 +54,7 @@ OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, {
* negative)
*/
cumulative: true,
/**
* Constructor: OpenLayers.Handler.MouseWheel
*
@@ -114,12 +114,13 @@ OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, {
if (!overScrollableDiv) {
try {
var overflow;
if (elem.currentStyle) {
overflow = elem.currentStyle["overflow"];
} else {
var style =
document.defaultView.getComputedStyle(elem, null);
var overflow = style.getPropertyValue("overflow");
overflow = style.getPropertyValue("overflow");
}
overScrollableDiv = ( overflow &&
(overflow == "auto") || (overflow == "scroll") );
@@ -169,13 +170,21 @@ OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, {
if (!e) {
e = window.event;
}
if (e.wheelDelta) {
delta = e.wheelDelta/120;
delta = e.wheelDelta;
if (window.opera && window.opera.version() < 9.2) {
delta = -delta;
}
if (delta % 160 === 0) {
// opera have steps of 160 instead of 120
delta = delta * 0.75;
}
delta = delta / 120;
} else if (e.detail) {
delta = -e.detail / 3;
// detail in Firefox on OS X is 1/3 of Windows
// so force delta 1 / -1
delta = - (e.detail / Math.abs(e.detail));
}
this.delta = this.delta + delta;

View File

@@ -11,7 +11,13 @@
/**
* Class: OpenLayers.Layer.EventPane
* Base class for 3rd party layers. Create a new event pane layer with the
* Base class for 3rd party layers, providing a DOM element which isolates
* the 3rd-party layer from mouse events.
* Only used by Google layers.
*
* Automatically instantiated by the Google constructor, and not usually instantiated directly.
*
* Create a new event pane layer with the
* <OpenLayers.Layer.EventPane> constructor.
*
* Inherits from:

View File

@@ -14,6 +14,11 @@
/**
* Class: OpenLayers.Layer.Google
*
* Provides a wrapper for Google's Maps API
* Normally the Terms of Use for this API do not allow wrapping, but Google
* have provided written consent to OpenLayers for this - see email in
* http://osgeo-org.1560.n6.nabble.com/Google-Maps-API-Terms-of-Use-changes-tp4910013p4911981.html
*
* Inherits from:
* - <OpenLayers.Layer.SphericalMercator>
* - <OpenLayers.Layer.EventPane>
@@ -462,6 +467,10 @@ OpenLayers.Layer.Google.cache = {};
* Constant: OpenLayers.Layer.Google.v2
*
* Mixin providing functionality specific to the Google Maps API v2.
*
* This API has been deprecated by Google.
* Developers are encouraged to migrate to v3 of the API; support for this
* is provided by <OpenLayers.Layer.Google.v3>
*/
OpenLayers.Layer.Google.v2 = {

View File

@@ -11,15 +11,42 @@
/**
* Constant: OpenLayers.Layer.Google.v3
*
* Mixin providing functionality specific to the Google Maps API v3 <= v3.6.
* Note that this layer configures the google.maps.map object with the
* "disableDefaultUI" option set to true. Using UI controls that the Google
* Maps API provides is not supported by the OpenLayers API. To use this layer,
* you must include the GMaps API (<= v3.6) in your html:
* Mixin providing functionality specific to the Google Maps API v3.
*
* To use this layer, you must include the GMaps v3 API in your html.
*
* Because OpenLayers needs to control mouse events, it isolates the GMaps mapObject
* (the DOM elements provided by Google) using the EventPane.
* However, because the Terms of Use require some of those elements,
* such as the links to Google's terms, to be clickable, these elements have
* to be moved up to OpenLayers' container div. There is however no easy way
* to identify these, and the logic (see the repositionMapElements function
* in the source) may need to be changed if Google changes them.
* These elements are not part of the published API and can be changed at any time,
* so a given OpenLayers release can only guarantee support for the 'frozen'
* Google release at the time of the OpenLayers release. See
* https://developers.google.com/maps/documentation/javascript/basics#Versioning
* for Google's current release cycle.
*
* For this reason, it's recommended that production code specifically loads
* the current frozen version, for example:
*
* (code)
* <script src="http://maps.google.com/maps/api/js?v=3.6&amp;sensor=false"></script>
* <script src="http://maps.google.com/maps/api/js?v=3.7&amp;sensor=false"></script>
* (end)
*
* but that development code should use the latest 'nightly' version, so that any
* problems can be dealt with as soon as they arise, and before they affect the production, 'frozen', code.
*
* Note, however, that frozen versions are retired as part of Google's release
* cycle, and once this happens, you will get the next version, in the example above, 3.8 once 3.7 is retired.
*
* This version supports 3.7.
*
*
* Note that this layer configures the google.maps.map object with the
* "disableDefaultUI" option set to true. Using UI controls that the Google
* Maps API provides is not supported by the OpenLayers API.
*/
OpenLayers.Layer.Google.v3 = {

View File

@@ -1302,19 +1302,20 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
* columns - {Integer} Maximum number of columns we want our grid to have.
*/
removeExcessTiles: function(rows, columns) {
var i, l;
// remove extra rows
while (this.grid.length > rows) {
var row = this.grid.pop();
for (var i=0, l=row.length; i<l; i++) {
for (i=0, l=row.length; i<l; i++) {
var tile = row[i];
this.destroyTile(tile);
}
}
// remove extra columns
while (this.grid[0].length > columns) {
for (var i=0, l=this.grid.length; i<l; i++) {
for (i=0, l=this.grid.length; i<l; i++) {
while (this.grid[i].length > columns) {
var row = this.grid[i];
var tile = row.pop();
this.destroyTile(tile);

View File

@@ -662,6 +662,7 @@ OpenLayers.Map = OpenLayers.Class({
* be properly set below.
*/
delete this.center;
delete this.zoom;
this.addLayers(options.layers);
// set center (and optionally zoom)
if (options.center && !this.getCenter()) {

View File

@@ -107,11 +107,8 @@ OpenLayers.Popup.Anchored =
moveTo: function(px) {
var oldRelativePosition = this.relativePosition;
this.relativePosition = this.calculateRelativePosition(px);
var newPx = this.calculateNewPx(px);
var newArguments = new Array(newPx);
OpenLayers.Popup.prototype.moveTo.apply(this, newArguments);
OpenLayers.Popup.prototype.moveTo.call(this, this.calculateNewPx(px));
//if this move has caused the popup to change its relative position,
// we need to make the appropriate cosmetic changes.

View File

@@ -7,7 +7,7 @@ var OpenLayers = {
/**
* Constant: VERSION_NUMBER
*/
VERSION_NUMBER: "Release 2.12-rc4",
VERSION_NUMBER: "Release 2.12-rc5",
/**
* Constant: singleFile

View File

@@ -74,13 +74,6 @@ OpenLayers.Util.isArray = function(a) {
return (Object.prototype.toString.call(a) === '[object Array]');
};
/**
* Maintain existing definition of $.
*/
if(typeof window.$ === "undefined") {
window.$ = OpenLayers.Util.getElement;
}
/**
* Function: removeItem
* Remove an object from an array. Iterates through the array

View File

@@ -164,6 +164,17 @@ OpenLayers.Util.getArgs = function(url) {
return OpenLayers.Util.getParameters(url);
};
/**
* Maintain existing definition of $.
*
* The use of our $-method is deprecated and the mapping of
* OpenLayers.Util.getElement will eventually be removed. Do not depend on
* window.$ being defined by OpenLayers.
*/
if(typeof window.$ === "undefined") {
window.$ = OpenLayers.Util.getElement;
}
/**
* Namespace: OpenLayers.Ajax
*/

View File

@@ -219,6 +219,20 @@ Corresponding issues/pull requests:
* https://github.com/openlayers/openlayers/pull/101
## Google v3 Layer
This release fixes a problem with the clickable elements supplied by Google. `OpenLayers.Layer.Google.v3` is now compatible with the current frozen version of Google's API (3.7) and also with the current release and nightly versions (3.8 and 3.9), but be aware that Google may change these elements in their release and nightly versions at any time, and an interim fix OpenLayers release may be needed.
It's recommended that production servers always load the frozen version of Google's API, but it would help find potential problems if development pages used the latest nightly version.
See the class description in the API docs for `OpenLayers.Layer.Google.v3` for more details.
Good ideas on how to improve this unsatisfactory situation welcome!
Corresponding issues/pull requests:
* https://github.com/openlayers/openlayers/pull/472
## OSM and Bing Layers
`Layer.OSM` is now defined in its own script file, namely `OpenLayers/Layer/OSM.js`. So people using `Layer.OSM` should now include `OpenLayers/Layer/OSM.js`, as opposed to `OpenLayers/Layer/XYZ.js`, in their OpenLayers builds.

View File

@@ -7,3 +7,31 @@ Previously, objects generated by the library were given id properties with value
Corresponding issues/pull requests:
* https://github.com/openlayers/openlayers/pull/416
## Better support for analog scroll wheel
Removed rounding of zoom level for maps with fractionalZoom == true. So users with an OS and interface device with analog scroll support will now get smooth zooming.
Corresponding issues/pull requests:
* https://github.com/openlayers/openlayers/pull/483
# Behavior Changes from Past Releases
## window.$ is no longer an alias for OpenLayers.Util.getElement
We do no longer create a global variable '$' when such a symbol isn't already
defined. Previous versions of OpenLayers would define '$' to be an alias for
OpenLayers.Util.getElement. If your application requires window.$ to be defined
in such a way you can either
* include deprecated.js in your custom build or as additional ressource in your
HTML-file
* or you do the aliasing in your application code yourself:
window.$ = OpenLayers.Util.getElement;
Corresponding issue/pull requests:
* https://github.com/openlayers/openlayers/pull/423

View File

@@ -14,6 +14,23 @@
"olControlOverviewMap", "displayClass is correct" );
}
function test_divs_title(t) {
t.plan(2);
control = new OpenLayers.Control.OverviewMap({
maximizeTitle: "maximize title",
minimizeTitle: "minimize title"
});
map = new OpenLayers.Map('map', {
layers: [new OpenLayers.Layer("layer", {isBaseLayer: true})],
controls: [control]
});
map.zoomToMaxExtent();
t.eq(control.maximizeDiv.title, "maximize title", "maximizeDiv.title is correct");
t.eq(control.minimizeDiv.title, "minimize title", "minimizeDiv.title is correct");
map.destroy();
}
function test_setMap(t) {
t.plan(4);

View File

@@ -236,13 +236,13 @@
var f = new OpenLayers.Format.KML();
t.eq(f.read(f.write(feature))[0].attributes.name, feature.id, "placemark name from feature.id");
feature.attributes.name = "placemark name from attributes.name";
t.eq(f.read(f.write(feature))[0].attributes.name, feature.attributes.name, "placemark name from attributes.name");
feature.style = {
label: "placemark name from style.label"
};
t.eq(f.read(f.write(feature))[0].attributes.name, feature.style.label, "placemark name from style.label");
feature.attributes.name = "placemark name from attributes.name";
t.eq(f.read(f.write(feature))[0].attributes.name, feature.attributes.name, "placemark name from attributes.name");
}
function test_Format_KML_linestring_projected(t) {
t.plan(1);

View File

@@ -108,7 +108,7 @@
var activated = handler.activate();
var delta = 120;
if (window.opera && window.opera.version() < 9.2) delta = -delta;
if (window.opera && window.opera.version() < 9.2) { delta = -delta; }
handler.onWheelEvent({'target':map.layers[0].div, wheelDelta: delta});
handler.onWheelEvent({'target':map.layers[0].div, wheelDelta: delta});
t.delay_call(1, function() {

View File

@@ -1523,6 +1523,70 @@
map.destroy();
}
function test_removeExcessTiles(t) {
t.plan(15);
/*
* Set up
*/
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.Grid('name', '/url',
{}, {isBaseLayer: true});
map.addLayer(layer);
function newTile(id) {
var t = new OpenLayers.Tile(layer,
new OpenLayers.Pixel(1, 1),
new OpenLayers.Bounds(1, 1, 1, 1));
t._id = id;
return t;
}
layer.grid = [
[newTile(1), newTile(2), newTile(3)],
[newTile(4), newTile(5)],
[newTile(6), newTile(7), newTile(8)]
];
// create a clone to be able to test whether
// tiles have been destroyed or not
var grid = [
layer.grid[0].slice(),
layer.grid[1].slice(),
layer.grid[2].slice()
];
/*
* Test
*/
layer.removeExcessTiles(2, 2);
t.eq(layer.grid.length, 2, 'grid has two rows');
t.eq(layer.grid[0].length, 2, 'row #1 has two columns');
t.eq(layer.grid[0][0]._id, 1, 'row #1 col #1 includes expected tile');
t.eq(layer.grid[0][1]._id, 2, 'row #1 col #2 includes expected tile');
t.eq(layer.grid[1].length, 2, 'row #2 has two columns');
t.eq(layer.grid[1][0]._id, 4, 'row #2 col #1 includes expected tile');
t.eq(layer.grid[1][1]._id, 5, 'row #2 col #2 includes expected tile');
t.ok(grid[0][0].events != null, 'tile 0,0 not destroyed');
t.ok(grid[0][1].events != null, 'tile 0,1 not destroyed');
t.ok(grid[0][2].events == null, 'tile 0,2 destroyed');
t.ok(grid[1][0].events != null, 'tile 1,0 not destroyed');
t.ok(grid[1][1].events != null, 'tile 1,1 not destroyed');
t.ok(grid[2][0].events == null, 'tile 2,0 destroyed');
t.ok(grid[2][1].events == null, 'tile 2,1 destroyed');
t.ok(grid[2][2].events == null, 'tile 2,2 destroyed');
/*
* Tear down
*/
map.destroy();
}
</script>
</head>

View File

@@ -748,7 +748,7 @@
function test_Map_double_addLayer(t) {
t.plan(2);
map = new OpenLayers.Map($('map'));
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.WMS('Test Layer',
"http://octo.metacarta.com/cgi-bin/mapserv",
{map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'}

View File

@@ -1,10 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script>
var custom$ = function() {};
window.$ = custom$;
</script>
<script>
var OpenLayers = [
"OpenLayers/BaseTypes/Class.js",
@@ -77,11 +73,6 @@
t.eq(OpenLayers.Util.isArray(testArray), true, "isArray works");
}
function test_$(t) {
t.plan(1);
t.ok($ === custom$, "OpenLayers doesn't clobber existing definition of $.");
}
function test_Util_getImagesLocation (t) {
t.plan( 1 );
t.ok( OpenLayers.Util.getImagesLocation(), "../img/",

View File

@@ -0,0 +1,20 @@
<html>
<head>
<script>
var custom$ = function() {};
window.$ = custom$;
</script>
<script src="../OLLoader.js"></script>
<script src="../../lib/deprecated.js"></script>
<script>
function test_$(t) {
t.plan(1);
t.ok($ === custom$, "OpenLayers doesn't clobber existing definition of $.");
}
</script>
</head>
<body>
</body>
</html>

View File

@@ -231,6 +231,7 @@
<li>Kinetic.html</li>
<li>Util.html</li>
<li>deprecated/Ajax.html</li>
<li>deprecated/Util.html</li>
<li>deprecated/BaseTypes/Class.html</li>
<li>deprecated/BaseTypes/Element.html</li>
<li>deprecated/Control/MouseToolbar.html</li>