Add changesetMeta documentation
This commit is contained in:
parent
6cc051f015
commit
6656bde6e9
5 changed files with 146 additions and 1 deletions
|
@ -30,6 +30,7 @@ import { LayerConfigJson } from "../src/Models/ThemeConfig/Json/LayerConfigJson"
|
|||
import { Utils } from "../src/Utils"
|
||||
import { TagUtils } from "../src/Logic/Tags/TagUtils"
|
||||
import Script from "./Script"
|
||||
import { Changes } from "../src/Logic/Osm/Changes"
|
||||
|
||||
/**
|
||||
* Converts a markdown-file into a .json file, which a walkthrough/slideshow element can use
|
||||
|
@ -180,6 +181,10 @@ export class GenerateDocs extends Script {
|
|||
"src/UI/InputElement/Validators.ts",
|
||||
])
|
||||
|
||||
this.WriteFile("./Docs/ChangesetMeta.md", Changes.getDocs(), [
|
||||
"src/Logic/Osm/Changes.ts",
|
||||
"src/Logic/Osm/ChangesetHandler.ts",
|
||||
])
|
||||
new WikiPageGenerator().generate()
|
||||
|
||||
console.log("Generated docs")
|
||||
|
@ -239,7 +244,7 @@ export class GenerateDocs extends Script {
|
|||
}
|
||||
|
||||
private generateHotkeyDocs() {
|
||||
new ThemeViewState(new LayoutConfig(<any>bookcases))
|
||||
new ThemeViewState(new LayoutConfig(<any>bookcases), new Set())
|
||||
this.WriteFile("./Docs/Hotkeys.md", Hotkeys.generateDocumentation(), [])
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,20 @@ export default class ChangeLocationAction extends OsmChangeAction {
|
|||
private readonly _id: number
|
||||
private readonly _newLonLat: [number, number]
|
||||
private readonly _meta: { theme: string; reason: string }
|
||||
static metatags: {
|
||||
readonly key?: string
|
||||
readonly value?: string
|
||||
readonly docs: string
|
||||
readonly changeType: string[]
|
||||
readonly specialMotivation?: boolean
|
||||
}[] = [
|
||||
{
|
||||
value: "relocated|improve_accuraccy|...",
|
||||
docs: "Will appear if the ",
|
||||
changeType: ["move"],
|
||||
specialMotivation: true,
|
||||
},
|
||||
]
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
|
|
|
@ -4,6 +4,27 @@ import { TagsFilter } from "../../Tags/TagsFilter"
|
|||
import { OsmTags } from "../../../Models/OsmFeature"
|
||||
|
||||
export default class ChangeTagAction extends OsmChangeAction {
|
||||
static metatags: {
|
||||
readonly key?: string
|
||||
readonly value?: string
|
||||
readonly docs: string
|
||||
readonly changeType: string[]
|
||||
readonly specialMotivation?: boolean
|
||||
}[] = [
|
||||
{
|
||||
changeType: ["answer"],
|
||||
docs: "Indicates the number of questions that have been answered",
|
||||
},
|
||||
{ changeType: ["soft-delete"], docs: "Indicates the number of soft-deleted items" },
|
||||
{
|
||||
changeType: ["add-image"],
|
||||
docs: "Indicates the number of images that have been added in this changeset",
|
||||
},
|
||||
{
|
||||
changeType: ["link-image"],
|
||||
docs: "Indicates the number of images that have been linked in this changeset",
|
||||
},
|
||||
]
|
||||
private readonly _elementId: string
|
||||
/**
|
||||
* The tags to apply onto the object
|
||||
|
|
|
@ -13,6 +13,12 @@ import { ChangesetHandler, ChangesetTag } from "./ChangesetHandler"
|
|||
import { OsmConnection } from "./OsmConnection"
|
||||
import FeaturePropertiesStore from "../FeatureSource/Actors/FeaturePropertiesStore"
|
||||
import OsmObjectDownloader from "./OsmObjectDownloader"
|
||||
import Combine from "../../UI/Base/Combine"
|
||||
import BaseUIElement from "../../UI/BaseUIElement"
|
||||
import Title from "../../UI/Base/Title"
|
||||
import Table from "../../UI/Base/Table"
|
||||
import ChangeLocationAction from "./Actions/ChangeLocationAction"
|
||||
import ChangeTagAction from "./Actions/ChangeTagAction"
|
||||
|
||||
/**
|
||||
* Handles all changes made to OSM.
|
||||
|
@ -99,6 +105,97 @@ export class Changes {
|
|||
return changes
|
||||
}
|
||||
|
||||
public static getDocs(): BaseUIElement {
|
||||
function addSource(items: any[], src: string) {
|
||||
items.forEach((i) => {
|
||||
i["source"] = src
|
||||
})
|
||||
return items
|
||||
}
|
||||
const metatagsDocs: {
|
||||
key?: string
|
||||
value?: string
|
||||
docs: string
|
||||
changeType?: string[]
|
||||
specialMotivation?: boolean
|
||||
source?: string
|
||||
}[] = [
|
||||
...addSource(
|
||||
[
|
||||
{
|
||||
key: "comment",
|
||||
docs: "The changeset comment. Will be a fixed string, mentioning the theme",
|
||||
},
|
||||
{
|
||||
key: "theme",
|
||||
docs: "The name of the theme that was used to create this change. ",
|
||||
},
|
||||
{
|
||||
key: "source",
|
||||
value: "survey",
|
||||
docs: "The contributor had their geolocation enabled while making changes",
|
||||
},
|
||||
{
|
||||
key: "change_within_{distance}",
|
||||
docs: "If the contributor enabled their geolocation, this will hint how far away they were from the objects they edited. This gives an indication of proximity and if they truly surveyed or were armchair-mapping",
|
||||
},
|
||||
{
|
||||
key: "change_over_{distance}",
|
||||
docs: "If the contributor enabled their geolocation, this will hint how far away they were from the objects they edited. If they were over 5000m away, the might have been armchair-mapping",
|
||||
},
|
||||
{
|
||||
key: "created_by",
|
||||
value: "MapComplete <version>",
|
||||
docs: "The piece of software used to create this changeset; will always start with MapComplete, followed by the version number",
|
||||
},
|
||||
{
|
||||
key: "locale",
|
||||
value: "en|nl|de|...",
|
||||
docs: "The code of the language that the contributor used MapComplete in. Hints what language the user speaks.",
|
||||
},
|
||||
{
|
||||
key: "host",
|
||||
value: "https://mapcomplete.org/<theme>",
|
||||
docs: "The URL that the contributor used to make changes. One can see the used instance with this",
|
||||
},
|
||||
{
|
||||
key: "imagery",
|
||||
docs: "The identifier of the used background layer, this will probably be an identifier from the [editor layer index](https://github.com/osmlab/editor-layer-index)",
|
||||
},
|
||||
],
|
||||
"default"
|
||||
),
|
||||
...addSource(ChangeTagAction.metatags, "ChangeTag"),
|
||||
...addSource(ChangeLocationAction.metatags, "ChangeLocation"),
|
||||
// TODO
|
||||
/*
|
||||
...DeleteAction.metatags,
|
||||
...LinkImageAction.metatags,
|
||||
...OsmChangeAction.metatags,
|
||||
...RelationSplitHandler.metatags,
|
||||
...ReplaceGeometryAction.metatags,
|
||||
...SplitAction.metatags,*/
|
||||
]
|
||||
return new Combine([
|
||||
new Title("Metatags on a changeset", 1),
|
||||
"You might encounter the following metatags on a changeset:",
|
||||
new Table(
|
||||
["key", "value", "explanation", "source"],
|
||||
metatagsDocs.map(({ key, value, docs, source, changeType, specialMotivation }) => [
|
||||
key ?? changeType?.join(", ") ?? "",
|
||||
value,
|
||||
new Combine([
|
||||
docs,
|
||||
specialMotivation
|
||||
? "This might give a reason per modified node or way"
|
||||
: "",
|
||||
]),
|
||||
source,
|
||||
])
|
||||
),
|
||||
])
|
||||
}
|
||||
|
||||
private static GetNeededIds(changes: ChangeDescription[]) {
|
||||
return Utils.Dedup(changes.filter((c) => c.id >= 0).map((c) => c.type + "/" + c.id))
|
||||
}
|
||||
|
|
|
@ -6,6 +6,14 @@ import Constants from "../../Models/Constants"
|
|||
import { Changes } from "./Changes"
|
||||
import { Utils } from "../../Utils"
|
||||
import FeaturePropertiesStore from "../FeatureSource/Actors/FeaturePropertiesStore"
|
||||
import ChangeLocationAction from "./Actions/ChangeLocationAction"
|
||||
import ChangeTagAction from "./Actions/ChangeTagAction"
|
||||
import DeleteAction from "./Actions/DeleteAction"
|
||||
import LinkImageAction from "./Actions/LinkImageAction"
|
||||
import OsmChangeAction from "./Actions/OsmChangeAction"
|
||||
import RelationSplitHandler from "./Actions/RelationSplitHandler"
|
||||
import ReplaceGeometryAction from "./Actions/ReplaceGeometryAction"
|
||||
import SplitAction from "./Actions/SplitAction"
|
||||
|
||||
export interface ChangesetTag {
|
||||
key: string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue