Skip to content

Commit 45d6537

Browse files
committed
Website updates
1 parent 71341e3 commit 45d6537

File tree

9 files changed

+31
-41
lines changed

9 files changed

+31
-41
lines changed

dist/en/main/apidoc/module-ol_format_Polyline-Polyline.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ <h4 class="name">
145145

146146
<div class="tag-source">
147147
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/format/Polyline.js">format/Polyline.js</a>,
148-
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/format/Polyline.js#L34">line 34</a>
148+
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/format/Polyline.js#L33">line 33</a>
149149
</div>
150150

151151
</div>

dist/en/main/apidoc/module-ol_format_Polyline.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ <h4 class="name">
196196

197197
<div class="tag-source">
198198
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/format/Polyline.js">format/Polyline.js</a>,
199-
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/format/Polyline.js#L205">line 205</a>
199+
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/format/Polyline.js#L193">line 193</a>
200200
</div>
201201

202202
</div>
@@ -386,7 +386,7 @@ <h4 class="name">
386386

387387
<div class="tag-source">
388388
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/format/Polyline.js">format/Polyline.js</a>,
389-
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/format/Polyline.js#L258">line 258</a>
389+
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/format/Polyline.js#L242">line 242</a>
390390
</div>
391391

392392
</div>
@@ -494,6 +494,8 @@ <h4 class="name">
494494

495495

496496

497+
<dt class="important tag-deprecated">Deprecated</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
498+
497499

498500

499501

@@ -550,7 +552,7 @@ <h4 class="name">
550552

551553
<div class="tag-source">
552554
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/format/Polyline.js">format/Polyline.js</a>,
553-
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/format/Polyline.js#L172">line 172</a>
555+
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/format/Polyline.js#L163">line 163</a>
554556
</div>
555557

556558
</div>
@@ -741,7 +743,7 @@ <h4 class="name">
741743

742744
<div class="tag-source">
743745
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/format/Polyline.js">format/Polyline.js</a>,
744-
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/format/Polyline.js#L240">line 240</a>
746+
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/format/Polyline.js#L223">line 223</a>
745747
</div>
746748

747749
</div>
@@ -851,6 +853,8 @@ <h4 class="name">
851853

852854

853855

856+
<dt class="important tag-deprecated">Deprecated</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd>
857+
854858

855859

856860

dist/en/main/examples/feature-move-animation.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/examples/feature-move-animation.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/dist/ol.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/dist/ol.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/format/Polyline.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export function decodeDeltas(encoded: string, stride: number, factor?: number):
3434
* multiplied. The remaining decimal places will get rounded away.
3535
* Default is `1e5`.
3636
* @return {string} The encoded string.
37+
* @deprecated
3738
* @api
3839
*/
3940
export function encodeFloats(numbers: Array<number>, factor?: number): string;
@@ -44,6 +45,7 @@ export function encodeFloats(numbers: Array<number>, factor?: number): string;
4445
* @param {number} [factor] The factor by which the result will be divided.
4546
* Default is `1e5`.
4647
* @return {Array<number>} A list of floating point numbers.
48+
* @deprecated
4749
* @api
4850
*/
4951
export function decodeFloats(encoded: string, factor?: number): Array<number>;

dist/en/main/ol/format/Polyline.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/format/Polyline.js

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Feature from '../Feature.js';
55
import LineString from '../geom/LineString.js';
66
import {getStrideForLayout} from '../geom/SimpleGeometry.js';
77
import {flipXY} from '../geom/flat/flip.js';
8-
import {inflateCoordinates} from '../geom/flat/inflate.js';
98
import {get as getProjection} from '../proj.js';
109
import {transformGeometryWithOptions} from './Feature.js';
1110
import TextFeature from './TextFeature.js';
@@ -95,13 +94,7 @@ class Polyline extends TextFeature {
9594
const stride = getStrideForLayout(this.geometryLayout_);
9695
const flatCoordinates = decodeDeltas(text, stride, this.factor_);
9796
flipXY(flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
98-
const coordinates = inflateCoordinates(
99-
flatCoordinates,
100-
0,
101-
flatCoordinates.length,
102-
stride,
103-
);
104-
const lineString = new LineString(coordinates, this.geometryLayout_);
97+
const lineString = new LineString(flatCoordinates, this.geometryLayout_);
10598

10699
return transformGeometryWithOptions(
107100
lineString,
@@ -144,11 +137,9 @@ class Polyline extends TextFeature {
144137
* @override
145138
*/
146139
writeGeometryText(geometry, options) {
147-
geometry =
148-
/** @type {LineString} */
149-
(
150-
transformGeometryWithOptions(geometry, true, this.adaptOptions(options))
151-
);
140+
geometry = /** @type {LineString} */ (
141+
transformGeometryWithOptions(geometry, true, this.adaptOptions(options))
142+
);
152143
const flatCoordinates = geometry.getFlatCoordinates();
153144
const stride = geometry.getStride();
154145
flipXY(flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
@@ -171,24 +162,21 @@ class Polyline extends TextFeature {
171162
*/
172163
export function encodeDeltas(numbers, stride, factor) {
173164
factor = factor ? factor : 1e5;
174-
let d;
175165

176-
const lastNumbers = new Array(stride);
177-
for (d = 0; d < stride; ++d) {
178-
lastNumbers[d] = 0;
179-
}
166+
const lastNumbers = new Array(stride).fill(0);
180167

181168
for (let i = 0, ii = numbers.length; i < ii; ) {
182-
for (d = 0; d < stride; ++d, ++i) {
183-
const num = numbers[i];
169+
for (let d = 0; d < stride; ++d, ++i) {
170+
const value = numbers[i] * factor;
171+
const num = value < 0 ? Math.ceil(value - 0.5) : Math.round(value);
184172
const delta = num - lastNumbers[d];
185173
lastNumbers[d] = num;
186174

187175
numbers[i] = delta;
188176
}
189177
}
190178

191-
return encodeFloats(numbers, factor);
179+
return encodeSignedIntegers(numbers);
192180
}
193181

194182
/**
@@ -204,21 +192,15 @@ export function encodeDeltas(numbers, stride, factor) {
204192
*/
205193
export function decodeDeltas(encoded, stride, factor) {
206194
factor = factor ? factor : 1e5;
207-
let d;
208195

209196
/** @type {Array<number>} */
210-
const lastNumbers = new Array(stride);
211-
for (d = 0; d < stride; ++d) {
212-
lastNumbers[d] = 0;
213-
}
214-
215-
const numbers = decodeFloats(encoded, factor);
197+
const lastNumbers = new Array(stride).fill(0);
198+
const numbers = decodeSignedIntegers(encoded);
216199

217200
for (let i = 0, ii = numbers.length; i < ii; ) {
218-
for (d = 0; d < stride; ++d, ++i) {
201+
for (let d = 0; d < stride; ++d, ++i) {
219202
lastNumbers[d] += numbers[i];
220-
221-
numbers[i] = lastNumbers[d];
203+
numbers[i] = lastNumbers[d] / factor;
222204
}
223205
}
224206

@@ -235,6 +217,7 @@ export function decodeDeltas(encoded, stride, factor) {
235217
* multiplied. The remaining decimal places will get rounded away.
236218
* Default is `1e5`.
237219
* @return {string} The encoded string.
220+
* @deprecated
238221
* @api
239222
*/
240223
export function encodeFloats(numbers, factor) {
@@ -253,6 +236,7 @@ export function encodeFloats(numbers, factor) {
253236
* @param {number} [factor] The factor by which the result will be divided.
254237
* Default is `1e5`.
255238
* @return {Array<number>} A list of floating point numbers.
239+
* @deprecated
256240
* @api
257241
*/
258242
export function decodeFloats(encoded, factor) {

0 commit comments

Comments
 (0)