terriajs
Version:
Geospatial data visualization platform.
79 lines (71 loc) • 2.21 kB
text/typescript
import objectTrait from "../Decorators/objectTrait";
import primitiveTrait from "../Decorators/primitiveTrait";
import mixTraits from "../mixTraits";
import ModelTraits from "../ModelTraits";
import { traitClass } from "../Trait";
import AutoRefreshingTraits from "./AutoRefreshingTraits";
import TableTraits from "./Table/TableTraits";
import UrlTraits from "./UrlTraits";
class PollingTraits extends ModelTraits {
({
name: "Seconds",
description: "Time in seconds to wait before polling for new data.",
type: "number"
})
seconds?: number;
({
name: "url",
description:
"The URL to poll for new data. If undefined, uses the catalog item `url` if there is one.",
type: "string"
})
url?: string;
({
name: "shouldReplaceData",
description:
"If true, the new data replaces the existing data, otherwise the new data will be appended to the old data.",
type: "boolean"
})
shouldReplaceData = true;
}
({
description: `Creates one catalog item from url that points to a CSV file that contains geospatial data.`,
example: {
type: "csv",
url: "https://tiles.terria.io/static/auspost-locations.csv",
name: "Australia Post Locations",
id: "some unique ID"
}
})
export default class CsvCatalogItemTraits extends mixTraits(
AutoRefreshingTraits,
UrlTraits,
TableTraits
) {
({
name: "Character Set",
description:
"The character set of the CSV data, overriding the information provided by the server, if any.",
type: "string"
})
characterSet?: string;
({
name: "CSV Data",
description: "The actual CSV data, represented as a string.",
type: "string"
})
csvString?: string;
({
name: "Ignore rows starting with comment",
description:
"Any rows of a CSV starting with '#' or '//' will be ignored. A value of `undefined` will be treated the same as `false`.",
type: "boolean"
})
ignoreRowsStartingWithComment?: boolean;
({
name: "Polling",
description: "Polling configuration",
type: PollingTraits
})
polling?: PollingTraits;
}