UNPKG

813 BJavaScriptView Raw
1const Constants = require('../constants');
2
3/**
4 * Returns GeoJSON for a Point representing the
5 * vertex of another feature.
6 *
7 * @param {string} parentId
8 * @param {Array<number>} coordinates
9 * @param {string} path - Dot-separated numbers indicating exactly
10 * where the point exists within its parent feature's coordinates.
11 * @param {boolean} selected
12 * @return {GeoJSON} Point
13 */
14module.exports = function(parentId, coordinates, path, selected) {
15 return {
16 type: Constants.geojsonTypes.FEATURE,
17 properties: {
18 meta: Constants.meta.VERTEX,
19 parent: parentId,
20 coord_path: path,
21 active: (selected) ? Constants.activeStates.ACTIVE : Constants.activeStates.INACTIVE
22 },
23 geometry: {
24 type: Constants.geojsonTypes.POINT,
25 coordinates: coordinates
26 }
27 };
28};