Compare commits

..

8 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
8 changed files with 34 additions and 22 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-rc3";
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

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

View File

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