Skip to content

Commit

Permalink
remove debugging dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
Xintong Xia committed Mar 26, 2019
1 parent 7e5e924 commit 43a28c7
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 364 deletions.
71 changes: 1 addition & 70 deletions examples/draw-control/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import React, {Component} from 'react';
import {render} from 'react-dom';
import MapGL, {DrawControl} from 'react-map-gl';

import data from './sample.geo';

const MODES = [
{name: 'Read Only', value: DrawControl.READ_ONLY},
{name: 'Select Feature', value: DrawControl.SELECT_FEATURE},
Expand All @@ -14,73 +12,6 @@ const MODES = [
{name: 'Draw Polygon', value: DrawControl.DRAW_POLYGON}
];

function flatFeatures(geoJson, parentId = '0') {
if (!geoJson) {
return null;
}

let features = [];
const {type} = geoJson;

if (type === 'FeatureCollection') {
geoJson.features.forEach((feature, i) => {
features = features.concat(flatFeatures(feature, `${parentId}.${i}`));
});
} else if (type === 'Feature') {
const featureType = geoJson.geometry.type;

switch (featureType) {
case 'Point':
case 'Polygon':
case 'LineString':
geoJson.properties.id = `${parentId}.0`;
features.push(geoJson);
break;

case 'MultiPoint':
case 'MultiPolygon':
case 'MultiLineString':
geoJson.geometry.coordinates.forEach((coordinates, i) => {
features.push({
type: 'Feature',
geometry: {
type: (/Multi(\w+)/).exec(featureType)[1],
coordinates
},
properties: {
...geoJson.properties,
id: `${parentId}.${i}`
}
});
});
break;

case 'GeometryCollection':
geoJson.geometry.geometries.forEach((g, i) => {
const id = `${parentId}.${i}`;
const singleFeature = {
type: 'Feature',
geometry: {
type: g.type,
coordinates: g.coordinates
},
properties: {
...geoJson.properties,
id
}
};

features.concat(flatFeatures(singleFeature, id));
});
break;

default:
}
}

return features;
}

export default class App extends Component {

constructor(props) {
Expand All @@ -94,7 +25,7 @@ export default class App extends Component {
zoom: 14
},
mode: DrawControl.READ_ONLY,
features: flatFeatures(data),
features: [],
selectedId: null
};
}
Expand Down
208 changes: 0 additions & 208 deletions examples/draw-control/src/sample.geo.json

This file was deleted.

59 changes: 0 additions & 59 deletions examples/fullscreen-map/src/app.js

This file was deleted.

27 changes: 0 additions & 27 deletions examples/fullscreen-map/src/pin.js

This file was deleted.

0 comments on commit 43a28c7

Please sign in to comment.