Compare commits

...

16 Commits

Author SHA1 Message Date
Bart van den Eijnden
8778b746b3 update VERSION_NUMBER to 2.13-rc4 2013-05-24 12:09:53 +02:00
ahocevar
a5ea8d7fcf Fixing tests
Selecting the same feature again should not do anything, which was ensured
in the old implementation by a check in the SelectFeature control. This
means that the previous commit causes a change in behavior in standalone
mode, which I would consider a bugfix. I documented this change in the
release notes.
2013-05-24 12:07:49 +02:00
ahocevar
b103d3b428 We don't want to re-select an already selected feature 2013-05-24 12:07:35 +02:00
ahocevar
8562582dd2 Avoiding duplicate events 2013-05-24 12:07:22 +02:00
ahocevar
cd5ae45273 Do not manage cache when cached tile is on target layer's backbuffer 2013-05-24 12:06:58 +02:00
Tobias Bieniek
d1b00824fc Format/EncodedPolyline: Change default factor to 1e5
This matches the factors in the other methods and the default of the
original algorithm. Having this set at 1 before can be considered
as a bug.
2013-05-24 12:06:39 +02:00
Tobias Bieniek
4399ebcb04 Format/EncodedPolyline: Added opt_factor parameter to encode/decode() 2013-05-24 12:06:25 +02:00
Tobias Bieniek
0bb804c9e7 tests/EncodedPolyline: Fixed indent 2013-05-24 12:06:12 +02:00
Bart van den Eijnden
572d78fb4d set version number to 2.13-rc3 2013-05-17 13:16:49 +02:00
ahocevar
1d948fc914 Make sure that drawTilesFromQueue gets executed
For events other than move, the tile queue may not be populated yet when
updateTimeout is called. So instead of checking for the queue's length,
we register the timer unconditionally in these cases.
2013-05-17 13:15:01 +02:00
ahocevar
449b85966e .olTileReplacing is on the parent of .olTileImage when using frame 2013-05-17 13:14:36 +02:00
ahocevar
1223ea339d Use getTile() instead of imgDiv to get the correct element
The correct way to get the markup of a tile is to use getTile() - the
imgDiv will only be available if the tile does not use a frame.
2013-05-17 13:14:16 +02:00
Bart van den Eijnden
d0f8fa3ecf set version number to RC2 2013-05-13 13:25:03 +02:00
Éric Lemoine
e9a349e4f1 Make feature handler propagate touch events
This commit is a follow-up on issue #294 (commit a6119f6) and #861 (commit c7a4045). The feature handler should not stop the bubbling up of browser events. In this particular case, when the feature handler is activate, Sencha Touch will trigger longpress events when panning the map because the feature handler stops touchmove.
2013-05-13 13:17:02 +02:00
ahocevar
8b4592e71a We are dealing with strings for comparison
Because OpenLayers.Util.getParameters turns comma delimited values into
arrays, comparing e.g. bbox values in urls will return false. By
introducing a splitArgs option, we can use getParameters in a way that
leaves such values as strings and makes them comparable in
OpenLayers.Util.isEquivalentUrl.
2013-05-13 13:01:21 +02:00
iacovlev-pavel
7c5afe1acf Add OpenLayers/Control.js to "requires"
Fix issue #969
2013-05-13 13:01:21 +02:00
13 changed files with 72 additions and 36 deletions

View File

@@ -425,4 +425,4 @@
* When asking questions or reporting issues, make sure to include the output of
* OpenLayers.VERSION_NUMBER in the question or issue-description.
*/
OpenLayers.VERSION_NUMBER="Release 2.13-rc1";
OpenLayers.VERSION_NUMBER="Release 2.13-rc4";

View File

@@ -4,6 +4,7 @@
* full text of the license. */
/**
* @requires OpenLayers/Control.js
* @requires OpenLayers/Handler/Drag.js
* @requires OpenLayers/Handler/Keyboard.js
*/
@@ -234,8 +235,8 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
this.handlers.drag.evt);
if (feature) {
this.dragStart(feature);
} else if (this.feature && this.clickout) {
this.unselectFeature(this.feature);
} else if (this.clickout) {
this._unselect = this.feature;
}
},
move: function(pixel) {
@@ -362,8 +363,9 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
* feature - {<OpenLayers.Feature.Vector>} the selected feature.
*/
selectFeature: function(feature) {
if (this.geometryTypes && OpenLayers.Util.indexOf(this.geometryTypes,
feature.geometry.CLASS_NAME) == -1) {
if (this.feature === feature ||
(this.geometryTypes && OpenLayers.Util.indexOf(this.geometryTypes,
feature.geometry.CLASS_NAME) == -1)) {
return;
}
if (this.beforeSelectFeature(feature) !== false) {

View File

@@ -102,8 +102,9 @@ OpenLayers.Format.EncodedPolyline = OpenLayers.Class(OpenLayers.Format, {
* {Array(Array(int))} An array containing n-dimensional arrays of
* coordinates.
*/
decode: function(encoded, dims) {
var flatPoints = this.decodeDeltas(encoded, dims, 1);
decode: function(encoded, dims, opt_factor) {
var factor = opt_factor || 1e5;
var flatPoints = this.decodeDeltas(encoded, dims, factor);
var flatPointsLength = flatPoints.length;
var points = [];
@@ -177,7 +178,8 @@ OpenLayers.Format.EncodedPolyline = OpenLayers.Class(OpenLayers.Format, {
* Returns:
* {String} An encoded string
*/
encode: function (points, dims) {
encode: function (points, dims, opt_factor) {
var factor = opt_factor || 1e5;
var flatPoints = [];
var pointsLength = points.length;
@@ -189,7 +191,7 @@ OpenLayers.Format.EncodedPolyline = OpenLayers.Class(OpenLayers.Format, {
}
}
return this.encodeDeltas(flatPoints, dims, 1);
return this.encodeDeltas(flatPoints, dims, factor);
},
/**

View File

@@ -147,7 +147,7 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
* evt - {Event}
*/
touchmove: function(evt) {
OpenLayers.Event.stop(evt);
OpenLayers.Event.preventDefault(evt);
},
/**
@@ -278,7 +278,7 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
if(type === "touchstart") {
// stop the event to prevent Android Webkit from
// "flashing" the map div
OpenLayers.Event.stop(evt);
OpenLayers.Event.preventDefault(evt);
}
var inNew = (this.feature != this.lastFeature);
if(this.geometryTypeMatches(this.feature)) {

View File

@@ -1100,7 +1100,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
this.events.triggerEvent("tileloadstart", {tile: tile});
this.numLoadingTiles++;
if (!this.singleTile && this.backBuffer && this.gridResolution === this.backBufferResolution) {
OpenLayers.Element.addClass(tile.imgDiv, replacingCls);
OpenLayers.Element.addClass(tile.getTile(), replacingCls);
}
};
@@ -1112,13 +1112,14 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
aborted: aborted
});
if (!this.singleTile && !aborted && this.backBuffer && this.gridResolution === this.backBufferResolution) {
if (OpenLayers.Element.getStyle(tile.imgDiv, 'display') === 'none') {
var tileDiv = tile.getTile();
if (OpenLayers.Element.getStyle(tileDiv, 'display') === 'none') {
var bufferTile = document.getElementById(tile.id + '_bb');
if (bufferTile) {
bufferTile.parentNode.removeChild(bufferTile);
}
}
OpenLayers.Element.removeClass(tile.imgDiv, replacingCls);
OpenLayers.Element.removeClass(tileDiv, replacingCls);
}
//if that was the last tile, then trigger a 'loadend' on the layer
if (this.numLoadingTiles === 0) {

View File

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

View File

@@ -175,7 +175,7 @@ OpenLayers.TileManager = OpenLayers.Class({
* evt - {Object} Listener argument
*/
move: function(evt) {
this.updateTimeout(evt.object, this.moveDelay);
this.updateTimeout(evt.object, this.moveDelay, true);
},
/**
@@ -272,11 +272,16 @@ OpenLayers.TileManager = OpenLayers.Class({
* Parameters:
* map - {<OpenLayers.Map>} The map to update the timeout for
* delay - {Number} The delay to apply
* nice - {Boolean} If true, the timeout function will only be created if
* the tilequeue is not empty. This is used by the move handler to
* avoid impacts on dragging performance. For other events, the tile
* queue may not be populated yet, so we need to set the timer
* regardless of the queue size.
*/
updateTimeout: function(map, delay) {
updateTimeout: function(map, delay, nice) {
window.clearTimeout(this.tileQueueId[map.id]);
var tileQueue = this.tileQueue[map.id];
if (tileQueue.length) {
if (!nice || tileQueue.length) {
this.tileQueueId[map.id] = window.setTimeout(
OpenLayers.Function.bind(function() {
this.drawTilesFromQueue(map);
@@ -383,6 +388,11 @@ OpenLayers.TileManager = OpenLayers.Class({
if (img && (!img.parentNode ||
OpenLayers.Element.hasClass(img.parentNode, 'olBackBuffer'))) {
if (tile.layer.backBuffer) {
if (tile.layer.backBuffer === img.parentNode) {
// cached image is on the target layer's backbuffer already,
// so nothing to do here
return;
}
img.style.opacity = 0;
img.style.visibility = 'hidden';
}

View File

@@ -866,11 +866,17 @@ OpenLayers.Util.destinationVincenty = function(lonlat, brng, dist) {
* url - {String} Optional url used to extract the query string.
* If url is null or is not supplied, query string is taken
* from the page location.
* options - {Object} Additional options. Optional.
*
* Valid options:
* splitArgs - {Boolean} Split comma delimited params into arrays? Default is
* true.
*
* Returns:
* {Object} An object of key/value pairs from the query string.
*/
OpenLayers.Util.getParameters = function(url) {
OpenLayers.Util.getParameters = function(url, options) {
options = options || {};
// if no url specified, take it from the location bar
url = (url === null || url === undefined) ? window.location.href : url;
@@ -906,7 +912,9 @@ OpenLayers.Util.getParameters = function(url) {
}
// follow OGC convention of comma delimited values
value = value.split(",");
if (options.splitArgs !== false) {
value = value.split(",");
}
//if there's only one value, do not return as array
if (value.length == 1) {
@@ -1299,7 +1307,8 @@ OpenLayers.Util.isEquivalentUrl = function(url1, url2, options) {
OpenLayers.Util.applyDefaults(options, {
ignoreCase: true,
ignorePort80: true,
ignoreHash: true
ignoreHash: true,
splitArgs: false
});
var urlObj1 = OpenLayers.Util.createUrlObject(url1, options);
@@ -1340,6 +1349,8 @@ OpenLayers.Util.isEquivalentUrl = function(url1, url2, options) {
* ignoreCase - {Boolean} lowercase url,
* ignorePort80 - {Boolean} don't include explicit port if port is 80,
* ignoreHash - {Boolean} Don't include part of url after the hash (#).
* splitArgs - {Boolean} Split comma delimited params into arrays? Default is
* true.
*
* Returns:
* {Object} An object with separate url, a, port, host, and args parsed out
@@ -1395,7 +1406,8 @@ OpenLayers.Util.createUrlObject = function(url, options) {
var qMark = url.indexOf("?");
queryString = (qMark != -1) ? url.substr(qMark) : "";
}
urlObject.args = OpenLayers.Util.getParameters(queryString);
urlObject.args = OpenLayers.Util.getParameters(queryString,
{splitArgs: options.splitArgs});
// pathname
//

View File

@@ -44,7 +44,7 @@ The `enableKinetic` property for the DragPan control has been changed to true by
## Control.ModifyFeature: no more built-in SelectFeature control
The ModifyFeature control is now much leaner, making it more reliable when combined with other controls. The most noticable change is that it has no
`selectControl` member any more. Users who previously relied on this built-in SelectFeature control will now have to create both a SelectFeature and a ModifyFeature control and configure the ModifyFeature control with `standalone: true`. To get features selected, call the `selectFeature` method e.g. from a `featureselected` listener on the vector layer.
`selectControl` member any more. Users who previously relied on this built-in SelectFeature control will now have to create both a SelectFeature and a ModifyFeature control and configure the ModifyFeature control with `standalone: true`. To get features selected, call the `selectFeature` method e.g. from a `featureselected` listener on the vector layer. Note that other than in the old implementation, calling `selectFeature` on an already selected feature will not do anything.
## Format.GPX: No more prefixes

View File

@@ -225,6 +225,7 @@
// Points don't call collectVertices
control.selectFeature(fakeFeature);
control.unselectFeature(fakeFeature);
control.collectVertices = function() {
t.ok(true, "collectVertices called");
@@ -237,7 +238,8 @@
layer.addFeatures = function(features) {
t.ok(features == 'a' || features == 'd', "features passed correctly");
}
layer.destroyFeatures = function() {};
fakeFeature.geometry = new OpenLayers.Geometry.Polygon([
new OpenLayers.Geometry.LinearRing([
new OpenLayers.Geometry.Point(0, 0),
@@ -246,7 +248,9 @@
]);
// OnSelect calls collectVertices and passes features to layer
control.selectFeature(fakeFeature);
control.selectFeature(fakeFeature);
control.unselectFeature(fakeFeature);
layer.destroyFeatures = OpenLayers.Layer.Vector.prototype.destroyFeatures;
control.vertices = ['a'];
control.virtualVertices = [{destroy: function() {}}];

View File

@@ -3,12 +3,12 @@
<script src="../OLLoader.js"></script>
<script type="text/javascript">
var flatPoints;
var floats, smallFloats, encodedFloats;
var signedIntegers, encodedSignedIntegers;
var unsignedIntegers, encodedUnsignedIntegers;
var flatPoints;
var floats, smallFloats, encodedFloats;
var signedIntegers, encodedSignedIntegers;
var unsignedIntegers, encodedUnsignedIntegers;
function resetTestingData() {
function resetTestingData() {
flatPoints = [38.50000, -120.20000,
40.70000, -120.95000,
43.25200, -126.45300];
@@ -22,7 +22,7 @@
unsignedIntegers = [0, 30, 1, 31, 32, 2, 174];
encodedUnsignedIntegers = '?]@^_@AmD';
}
}
var basePoints = new Array(
new Array(3850000, -12020000),
@@ -106,8 +106,8 @@
for (i in decodedPoints) {
var point = basePoints[i];
var decodedPoint = decodedPoints[i];
t.eq(point[0], decodedPoint[0]);
t.eq(point[1], decodedPoint[1]);
t.eq(parseInt(decodedPoint[0] * 1e5), point[0]);
t.eq(parseInt(decodedPoint[1] * 1e5), point[1]);
}
}
@@ -141,7 +141,7 @@
var format = new OpenLayers.Format.EncodedPolyline();
t.eq(format.encode(basePoints, 2), encoded);
t.eq(format.encode(basePoints, 2, 1), encoded);
}
function test_encodeDeltas_returns_expected_value(t) {

View File

@@ -783,7 +783,7 @@
}
function test_Util_isEquivalentUrl(t) {
t.plan(9);
t.plan(10);
var url1, url2, options;
@@ -846,6 +846,11 @@
url2 = new Array(window.location.pathname.split("/").length-1).join("../")+"foo/bar";
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "absolute and relative path without host works for "+url2)
//ARGS
url1 = "foo.html?bbox=1,2,3,4",
url2 = url1;
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "equal urls with comma delimited params are equal");
}
function test_createUrlObject(t) {

View File

@@ -506,7 +506,7 @@ a.olControlZoomOut {
}
/* when replacing tiles, do not show tile and backbuffer at the same time */
.olTileImage.olTileReplacing {
.olTileReplacing {
display: none;
}