|
@@ -82,7 +82,6 @@ class Body extends Component {
|
|
|
changeset: { tags: {} },
|
|
|
datalocked: false,
|
|
|
lastUsedPresets: [],
|
|
|
- zoom: 18,
|
|
|
};
|
|
|
|
|
|
// this._usedImageryNames = new Set();
|
|
@@ -220,7 +219,7 @@ class Body extends Component {
|
|
|
const locator = layers.find(l => l.properties.id === LOCATOR_OVERLAY_ID);
|
|
|
if (
|
|
|
!this.state.selectedOverlaysImagery && locator
|
|
|
- && (!this.state.zoom || !locator.properties.max_zoom || this.state.zoom <= locator.properties.max_zoom)
|
|
|
+ && (!window.CONFIG.map_initial_zoom || !locator.properties.max_zoom || window.CONFIG.map_initial_zoom <= locator.properties.max_zoom)
|
|
|
) {
|
|
|
newState.selectedOverlaysImagery = [layers.find(l => l.properties.id === LOCATOR_OVERLAY_ID)];
|
|
|
}
|
|
@@ -289,10 +288,61 @@ class Body extends Component {
|
|
|
// this._timerMarker = setInterval(() => this._updateMarker(), 1000);
|
|
|
// setTimeout(() => {this._readers = window.vectorDataManager.getAllReaders()}, 1000);
|
|
|
|
|
|
- PubSub.subscribe("body.data.update", (msg, data) => {
|
|
|
- // this._refreshMarkers(data);
|
|
|
- PubSub.publish('body.data.got', data);
|
|
|
- })
|
|
|
+ PubSub.subscribe("body.draw.indoor", (msg, data) => {
|
|
|
+ // let source = data.source;
|
|
|
+ let geoJsonData = data.data;
|
|
|
+ window.vectorDataManager.setGeoJsonData(geoJsonData);
|
|
|
+
|
|
|
+ PubSub.publish("body.level.set", { level: 0 });
|
|
|
+ // console.log(this.props)
|
|
|
+ if (this.props.force) {
|
|
|
+ PubSub.publish("map.position.set", {
|
|
|
+ coordinates: {
|
|
|
+ lng: window.CONFIG.map_initial_latlng[1],
|
|
|
+ lat: window.CONFIG.map_initial_latlng[0],
|
|
|
+ },
|
|
|
+ zoom: window.CONFIG.map_initial_zoom
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // console.log(this.props)
|
|
|
+ if (this.props.center) {
|
|
|
+ PubSub.publish("map.position.set", {
|
|
|
+ coordinates: {
|
|
|
+ lng: this.props.center.lng,
|
|
|
+ lat: this.props.center.lat,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ PubSub.publish("map.position.set", {
|
|
|
+ coordinates: {
|
|
|
+ lng: geoJsonData.center.x,
|
|
|
+ lat: geoJsonData.center.y,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // if (source === 'db') {
|
|
|
+ // PubSub.publish("map.position.set", {
|
|
|
+ // coordinates: {
|
|
|
+ // lng: window.CONFIG.map_initial_latlng[1],
|
|
|
+ // lat: window.CONFIG.map_initial_latlng[0],
|
|
|
+ // },
|
|
|
+ // zoom: window.CONFIG.map_initial_zoom
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // else if (source === 'local') {
|
|
|
+ // PubSub.publish("map.position.set", {
|
|
|
+ // coordinates: {
|
|
|
+ // lng: geoJsonData.center.x,
|
|
|
+ // lat: geoJsonData.center.y,
|
|
|
+ // },
|
|
|
+ // zoom: window.CONFIG.map_initial_zoom
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // else {
|
|
|
+ // console.error('Unrecognized Indoor GeoJsonData: 未知的室内地图数据')
|
|
|
+ // }
|
|
|
+ });
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -453,18 +503,6 @@ class Body extends Component {
|
|
|
// );
|
|
|
// });
|
|
|
|
|
|
- PubSub.subscribe("body.map.got", (msg, data) => {
|
|
|
- // this.setState({mapDashboardOpen: true});
|
|
|
- // console.log(123, msg, data)
|
|
|
- if (data.length > 0) {
|
|
|
- // console.log(data[0].map_id);
|
|
|
- PubSub.publish('body.draw.loaded', JSON.parse(data[0].map_data));
|
|
|
- } else {
|
|
|
- console.log("body.map.got none");
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* Event for changing current shown level
|
|
|
* @event body.level.set
|
|
@@ -572,20 +610,6 @@ class Body extends Component {
|
|
|
// }
|
|
|
// });
|
|
|
|
|
|
- // PubSub.subscribe("body.right_panel.change", (msg, data) => {
|
|
|
- // if(!window.editor_user){return}
|
|
|
- // if(!this.state.rightPanelOpen){
|
|
|
- // this.setState({ rightPanelOpen: !this.state.rightPanelOpen, rightPanelTab: data.tab });
|
|
|
- // }else{
|
|
|
- // this.setState({ rightPanelTab: data.tab});
|
|
|
- // }
|
|
|
- // });
|
|
|
-
|
|
|
- // PubSub.subscribe("body.map.change", (msg, data) => {
|
|
|
- // // console.log("body.map.change",data);
|
|
|
- // PubSub.publish('body.draw.loaded', JSON.parse(data.map_data));
|
|
|
- // });
|
|
|
-
|
|
|
/**
|
|
|
* Event for toggling one of the side panels
|
|
|
* @event body.panel.toggle
|
|
@@ -755,21 +779,6 @@ class Body extends Component {
|
|
|
// }
|
|
|
// });
|
|
|
|
|
|
- // PubSub.subscribe("body.draw.loaded", (msg, data) => {
|
|
|
- // // console.log(data);
|
|
|
- // window.vectorDataManager.setGeoJsonData(data);
|
|
|
- // localStorage.setItem("mapData", JSON.stringify(data));
|
|
|
- // PubSub.publish("body.level.set", { level: 0 });
|
|
|
-
|
|
|
- // PubSub.publish("map.position.set", {
|
|
|
- // coordinates: {
|
|
|
- // lng: data.center.x,
|
|
|
- // lat: data.center.y,
|
|
|
- // },
|
|
|
- // zoom: 18
|
|
|
- // });
|
|
|
- // });
|
|
|
-
|
|
|
/**
|
|
|
* Event when user has done drawing the requested feature
|
|
|
* @event body.draw.done
|