Window Store+ArcGIS for Store 入门

前文

最近在学习如何利用Window Store+ArcGIS for Store 开发一款平板应用。开始之前先来个测试Demo玩玩,但是!!我的VS长这样


示例代码的长这样



看了资料知道这两个其实没有啥区别,都可以。。。。似不似傻

好,现在我们的目标是做这样一个Demo:建立一个可以展示地图的App Demo

正文

1 新建一个Window Store app应用工程

2  添加对ArcGIS Runtime API assembly的引用

3同时要添加对Microsoft Visual C++ 2013 Runtime Package for Windows程序集的引用,否则可能会出现下图这样的错误提示。

4为了能够让我们的程序通过编译,我们还得选取一个特定的平台,在这里呢我选择的是

X64(PS:平台要和你的dll文件对应,X64的平台也要对应相应的ArcGIS dll文件,否则会出现架构不兼容的问题)










当然了,你可能会想这样做







但是它不会发挥任何作用,并且也是设置成Any CPU之后,dll文件前面有感叹号的原因

这是MainPage.xaml文件代码

<Page
    x:Class="App2.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App2"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:esri="using:Esri.ArcGISRuntime.Controls"
    xmlns:layers="using:Esri.ArcGISRuntime.Layers"
    mc:Ignorable="d">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <esri:MapView x:Name="MapView1">
            <esri:Map x:Name="MyMap">
                <layers:ArcGISTiledMapServiceLayer ID="BaseMap" 
                     ServiceUri="http://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer"/>
            </esri:Map>
        </esri:MapView>

    </Grid>

</Page>

运行工程,上图,到此大功告成~~~~~大笑




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
你可以使用 Vue 3 和 ArcGIS API for JavaScript 4 来打印地图。下面是一个简单的示例代码,展示了如何在 Vue 3 中使用 ArcGIS API for JavaScript 4 来打印地图: 首先,在你的 Vue 3 项目中安装 ArcGIS API for JavaScript 4 的依赖: ```bash npm install --save @arcgis/core ``` 然后,在你的 Vue 组件中引入 ArcGIS API for JavaScript 4 的模块: ```javascript import { loadModules } from '@esri/arcgis-rest-loader'; export default { name: 'MapPrint', data() { return { map: null }; }, mounted() { this.initMap(); }, methods: { async initMap() { // 加载 ArcGIS API for JavaScript 4 的模块 const [Map, MapView] = await loadModules(['esri/Map', 'esri/views/MapView']); // 创建地图实例 this.map = new Map({ basemap: 'streets' }); // 创建地图视图 const mapView = new MapView({ container: this.$refs.mapViewContainer, map: this.map, zoom: 12, center: [-118.2437, 34.0522] // 设置初始地图中心点坐标 }); }, printMap() { // 打印地图 this.$refs.mapViewContainer.print(); } } }; ``` 在上面的代码中,我们创建了一个名为 `MapPrint` 的 Vue 组件,并通过 `loadModules` 方法加载了 `esri/Map` 和 `esri/views/MapView` 模块。然后,我们在 `mounted` 钩子函数中初始化了地图,并在 `printMap` 方法中调用了 `print` 方法来实现地图的打印功能。 最后,在你的 Vue 组件模板中添加一个地图容器和一个按钮来触发打印地图的操作: ```html <template> <div> <div ref="mapViewContainer" style="width: 100%; height: 400px;"></div> <button @click="printMap">Print Map</button> </div> </template> ``` 这样,当你在浏览器中打开该 Vue 组件页面时,你将看到一个包含地图的容器和一个打印地图的按钮。点击按钮后,地图将被打印出来。 希望这个示例能对你有所帮助!如果你还有其他问题,请随时提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值