-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
241 additions
and
145 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
html body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
/* 去除地图黑边框 */ | ||
.esri-view .esri-view-surface--inset-outline:focus::after { | ||
outline: unset !important; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { defineComponent } from 'vue' | ||
import View from './components/View' | ||
import '@/assets/style/app.scss' | ||
|
||
export default defineComponent({ | ||
components: { | ||
View | ||
}, | ||
setup () { | ||
return () => | ||
<div id="app"> | ||
<View class="view" /> | ||
</div> | ||
} | ||
}) |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#app { | ||
height: 100vh; | ||
|
||
.view { | ||
height: inherit; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.view { | ||
height: 50vh; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { | ||
defineComponent, | ||
getCurrentInstance, | ||
onMounted, | ||
} from 'vue'; | ||
import { useStore } from 'vuex' | ||
import { VIEW_DEFAULT_OPTIONS } from '@/config/esri.conf' | ||
import { useEsri, useEsriUtils } from '@/hooks/esri'; | ||
|
||
export default defineComponent({ | ||
setup () { | ||
const { ArcGISMap, MapView } = useEsri() | ||
const store = useStore() | ||
|
||
const { createBasemap } = useEsriUtils() | ||
|
||
onMounted(() => { | ||
const map = new ArcGISMap({ | ||
basemap: createBasemap('彩色中文含兴趣点版中国基础地图') | ||
}) | ||
|
||
const view = new MapView({ | ||
map, ...VIEW_DEFAULT_OPTIONS | ||
}) | ||
|
||
store.commit('setMapView', { map, view }) | ||
}) | ||
|
||
return () => | ||
<div id="view-container"></div> | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const ARCGIS_API_URL : string = 'https://wuxizhe.fun/arcgisjs/api/4.15' | ||
|
||
export const ESRI_CONFIG = { | ||
url: `${ARCGIS_API_URL}/init.js`, | ||
css: `${ARCGIS_API_URL}/esri/themes/light/main.css`, | ||
} | ||
|
||
export const BASEMAPS = { | ||
"彩色中文含兴趣点版中国基础地图": { | ||
type: "WebTileLayer", | ||
url: "http://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer/tile/{level}/{row}/{col}", | ||
}, | ||
"灰色中文不含兴趣点版中国基础地图": { | ||
type: "WebTileLayer", | ||
url: "http://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetGray/MapServer/tile/{level}/{row}/{col}", | ||
}, | ||
"蓝黑色中文不含兴趣点版中国基础地图": { | ||
type: "WebTileLayer", | ||
url: "http://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{level}/{row}/{col}", | ||
}, | ||
"暖色中文不含兴趣点版中国基础地图": { | ||
type: "WebTileLayer", | ||
url: "http://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetWarm/MapServer/tile/{level}/{row}/{col}", | ||
} | ||
} | ||
|
||
export const VIEW_DEFAULT_OPTIONS = { | ||
container: 'view-container', | ||
zoom: 3, | ||
center: [110, 10], | ||
ui: { | ||
components: [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { BASEMAPS } from '@/config/esri.conf'; | ||
import { reactive } from 'vue'; | ||
|
||
const esri = reactive({}) | ||
|
||
export function useEsriUtils () { | ||
|
||
return { | ||
set (obj : any) { | ||
Object.assign(esri, { ...obj }) | ||
}, | ||
createBasemap (name: string) { | ||
const { WebTileLayer } = useEsri() | ||
const basemap = (BASEMAPS as any)[name] | ||
if (basemap.type === 'WebTileLayer') { | ||
return { baseLayers: [ new WebTileLayer({ urlTemplate: basemap.url }) ] } | ||
} | ||
}, | ||
} | ||
} | ||
|
||
|
||
export function useEsri () { | ||
return ({ ...esri } as any) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,30 @@ | ||
import { createApp } from 'vue' | ||
import App from './App.vue' | ||
import App from './App' | ||
import router from './router' | ||
import store from './store' | ||
|
||
createApp(App).use(store).use(router).mount('#app') | ||
import { loadModules } from 'esri-loader' | ||
import { ESRI_CONFIG } from './config/esri.conf' | ||
import { useEsriUtils } from './hooks/esri' | ||
|
||
const app = createApp(App) | ||
|
||
loadModules([ | ||
'esri/Map', | ||
'esri/views/MapView', | ||
'esri/layers/WebTileLayer', | ||
], ESRI_CONFIG).then(([ | ||
ArcGISMap, | ||
MapView, | ||
WebTileLayer, | ||
]) => { | ||
const { set } = useEsriUtils() | ||
set({ | ||
ArcGISMap, | ||
MapView, | ||
WebTileLayer, | ||
}) | ||
|
||
app.use(store).use(router).mount('#app') | ||
}) | ||
|
Oops, something went wrong.