Resolve conflicts

This commit is contained in:
Andreas Hocevar
2022-04-17 18:48:02 +02:00
parent 252671108f
commit 884c0c6129
7 changed files with 19 additions and 26 deletions

View File

@@ -469,9 +469,7 @@ class Snap extends PointerInteraction {
if (this.vertex_) {
for (let i = 0; i < segmentsLength; ++i) {
const segmentData = segments[i];
if (
segmentData.feature.getGeometry().getType() !== GeometryType.CIRCLE
) {
if (segmentData.feature.getGeometry().getType() !== 'Circle') {
segmentData.segment.forEach((vertex) => {
const tempVertexCoord = fromUserCoordinate(vertex, projection);
const delta = squaredDistance(projectedCoordinate, tempVertexCoord);
@@ -492,9 +490,7 @@ class Snap extends PointerInteraction {
for (let i = 0; i < segmentsLength; ++i) {
let vertex = null;
const segmentData = segments[i];
if (
segmentData.feature.getGeometry().getType() === GeometryType.CIRCLE
) {
if (segmentData.feature.getGeometry().getType() === 'Circle') {
let circleGeometry = segmentData.feature.getGeometry();
const userProjection = getUserProjection();
if (userProjection) {

View File

@@ -208,7 +208,7 @@ class Layer extends BaseLayer {
}
/**
* @return {import("../source/State.js").default} Source state.
* @return {import("../source/Source.js").State} Source state.
*/
getSourceState() {
const source = this.getSource();

View File

@@ -3,7 +3,6 @@
*/
import BaseTileLayer from './BaseTile.js';
import LayerProperty from '../layer/Property.js';
import SourceState from '../source/State.js';
import WebGLTileLayerRenderer, {
Attributes,
Uniforms,
@@ -383,11 +382,11 @@ class WebGLTileLayer extends BaseTileLayer {
}
/**
* @return {import("../source/State.js").default} Source state.
* @return {import("../source/Source.js").State} Source state.
*/
getSourceState() {
const source = this.getRenderSource();
return source ? source.getState() : SourceState.UNDEFINED;
return source ? source.getState() : 'undefined';
}
/**
@@ -454,16 +453,16 @@ class WebGLTileLayer extends BaseTileLayer {
for (let i = 0, ii = sources.length; i < ii; ++i) {
const source = sources[i];
const sourceState = source.getState();
if (sourceState == SourceState.LOADING) {
if (sourceState == 'loading') {
const onChange = () => {
if (source.getState() == SourceState.READY) {
if (source.getState() == 'ready') {
source.removeEventListener('change', onChange);
this.changed();
}
};
source.addEventListener('change', onChange);
}
ready = ready && sourceState == SourceState.READY;
ready = ready && sourceState == 'ready';
}
const canvas = this.renderSources(frameState, sources);
if (this.getRenderer().renderComplete && ready) {

View File

@@ -347,25 +347,25 @@ RenderFeature.prototype.getFlatCoordinates =
export function toGeometry(renderFeature) {
const geometryType = renderFeature.getType();
switch (geometryType) {
case GeometryType.POINT:
case 'Point':
return new Point(renderFeature.getFlatCoordinates());
case GeometryType.MULTI_POINT:
case 'MultiPoint':
return new MultiPoint(
renderFeature.getFlatCoordinates(),
GeometryLayout.XY
);
case GeometryType.LINE_STRING:
case 'LineString':
return new LineString(
renderFeature.getFlatCoordinates(),
GeometryLayout.XY
);
case GeometryType.MULTI_LINE_STRING:
case 'MultiLineString':
return new MultiLineString(
renderFeature.getFlatCoordinates(),
GeometryLayout.XY,
/** @type {Array<number>} */ (renderFeature.getEnds())
);
case GeometryType.POLYGON:
case 'Polygon':
const flatCoordinates = renderFeature.getFlatCoordinates();
const ends = /** @type {Array<number>} */ (renderFeature.getEnds());
const endss = inflateEnds(flatCoordinates, ends);

View File

@@ -114,8 +114,7 @@ class CompositeMapRenderer extends MapRenderer {
const sourceState = layer.getSourceState();
if (
!inView(layerState, viewState) ||
(layerState.sourceState != 'ready' &&
layerState.sourceState != 'undefined')
(sourceState != 'ready' && sourceState != 'undefined')
) {
layer.unrender();
continue;

View File

@@ -1968,14 +1968,14 @@ describe('ol.interaction.Draw', function () {
}
function drawPoint(geometryLayout) {
createDrawInteraction(GeometryType.POINT, geometryLayout);
createDrawInteraction('Point', geometryLayout);
simulateEvent('pointermove', 10, 20);
simulateEvent('pointerdown', 10, 20);
simulateEvent('pointerup', 10, 20);
}
function drawLineString(geometryLayout) {
createDrawInteraction(GeometryType.LINE_STRING, geometryLayout);
createDrawInteraction('LineString', geometryLayout);
// first point
simulateEvent('pointermove', 10, 20);
simulateEvent('pointerdown', 10, 20);
@@ -1992,7 +1992,7 @@ describe('ol.interaction.Draw', function () {
}
function drawPolygon(geometryLayout) {
createDrawInteraction(GeometryType.POLYGON, geometryLayout);
createDrawInteraction('Polygon', geometryLayout);
// first point
simulateEvent('pointermove', 10, 20);
simulateEvent('pointerdown', 10, 20);
@@ -2014,7 +2014,7 @@ describe('ol.interaction.Draw', function () {
}
function drawCircle(geometryLayout) {
createDrawInteraction(GeometryType.CIRCLE, geometryLayout);
createDrawInteraction('Circle', geometryLayout);
// first point
simulateEvent('pointermove', 10, 20);
simulateEvent('pointerdown', 10, 20);

View File

@@ -1,4 +1,3 @@
import GeometryType from '../../../../src/ol/geom/GeometryType.js';
import RenderFeature, {
toFeature,
toGeometry,
@@ -141,7 +140,7 @@ describe('ol/render/Feature', function () {
],
]);
const renderFeature = new RenderFeature(
GeometryType.POLYGON,
'Polygon',
geometry.getFlatCoordinates().slice(),
geometry.getEndss().flat(1)
);