Merge develop

This commit is contained in:
Pieter Vander Vennet 2023-06-11 23:12:03 +02:00
commit 0d1a91dbab
86 changed files with 35793 additions and 1537 deletions

View file

@ -1,8 +1,8 @@
import { Utils } from "../../Utils"
import {Utils} from "../../Utils"
import polygon_features from "../../assets/polygon-features.json"
import OsmToGeoJson from "osmtogeojson"
import { OsmFeature, OsmId, OsmTags, WayId } from "../../Models/OsmFeature"
import { Feature, LineString, Polygon } from "geojson"
import {OsmFeature, OsmId, OsmTags, WayId} from "../../Models/OsmFeature"
import {Feature, LineString, Polygon} from "geojson"
export abstract class OsmObject {
private static defaultBackend = "https://www.openstreetmap.org/"
@ -159,8 +159,7 @@ export abstract class OsmObject {
}
return tags
}
abstract ChangesetXML(changesetId: string): string
abstract ChangesetXML(changesetId: string, header?: string): string
protected VersionXML() {
if (this.version === undefined) {
@ -199,15 +198,15 @@ export class OsmNode extends OsmObject {
this.LoadData(extraData)
}
ChangesetXML(changesetId: string): string {
ChangesetXML(changesetId: string, header?: string): string {
let tags = this.TagsXML()
return (
' <node id="' +
this.id +
'" changeset="' +
changesetId +
'" ' +
(header ?? "") +
(changesetId ? ('" changeset="' + changesetId) : "" ) +
this.VersionXML() +
' lat="' +
this.lat +
@ -256,7 +255,7 @@ export class OsmWay extends OsmObject {
return [this.lat, this.lon]
}
ChangesetXML(changesetId: string): string {
ChangesetXML(changesetId: string, header?: string): string {
let tags = this.TagsXML()
let nds = ""
for (const node in this.nodes) {
@ -266,8 +265,8 @@ export class OsmWay extends OsmObject {
return (
' <way id="' +
this.id +
'" changeset="' +
changesetId +
(header ?? "")+
(changesetId ? ('" changeset="' + changesetId) : "" ) +
'" ' +
this.VersionXML() +
">\n" +
@ -361,7 +360,7 @@ export class OsmRelation extends OsmObject {
return [0, 0] // TODO
}
ChangesetXML(changesetId: string): string {
ChangesetXML(changesetId: string, header?: string): string {
let members = ""
for (const member of this.members) {
members +=
@ -379,7 +378,7 @@ export class OsmRelation extends OsmObject {
if (changesetId !== undefined) {
cs = `changeset="${changesetId}"`
}
return ` <relation id="${this.id}" ${cs} ${this.VersionXML()}>
return ` <relation id="${this.id}" ${header ?? ""} ${cs} ${this.VersionXML()}>
${members}${tags} </relation>
`
}