Skip to content

Commit

Permalink
Do not consider multipoint geometries with only one array element as …
Browse files Browse the repository at this point in the history
…invalid [notarize]
  • Loading branch information
tkleinke committed Apr 24, 2023
1 parent 0ebe49a commit 33172cc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions desktop/src/app/model/validations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,12 @@ export module Validations {
}
break;
case 'MultiPoint':
if (!Validations.validatePolylineOrMultiPointCoordinates(geometry.coordinates)) {
if (!Validations.validateMultiPointCoordinates(geometry.coordinates)) {
return [ValidationErrors.INVALID_COORDINATES, 'MultiPoint'];
}
break;
case 'LineString':
if (!Validations.validatePolylineOrMultiPointCoordinates(geometry.coordinates)) {
if (!Validations.validatePolylineCoordinates(geometry.coordinates)) {
return [ValidationErrors.INVALID_COORDINATES, 'LineString'];
}
break;
Expand Down Expand Up @@ -559,7 +559,14 @@ export module Validations {
}


export function validatePolylineOrMultiPointCoordinates(coordinates: number[][]): boolean {
export function validateMultiPointCoordinates(coordinates: number[][]): boolean {

return coordinates.length !== 0
&& coordinates.every(validatePointCoordinates);
}


export function validatePolylineCoordinates(coordinates: number[][]): boolean {

return coordinates.length >= 2
&& coordinates.every(validatePointCoordinates);
Expand All @@ -569,7 +576,7 @@ export module Validations {
export function validateMultiPolylineCoordinates(coordinates: number[][][]): boolean {

return coordinates.length !== 0
&& coordinates.every(validatePolylineOrMultiPointCoordinates);
&& coordinates.every(validatePolylineCoordinates);
}


Expand Down

0 comments on commit 33172cc

Please sign in to comment.