Compare commits

...

12 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
10 changed files with 47 additions and 29 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-rc2";
OpenLayers.VERSION_NUMBER="Release 2.13-rc4";

View File

@@ -235,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) {
@@ -363,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

@@ -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-rc2",
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

@@ -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

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