arcgis runtime 100 Create geometries
1 /* Copyright 2016 EsriEsri
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16 17 package com.esri.arcgisruntime.sample.creategeometries;
18 19 import android.graphics.Color;
20 import android.os.Bundle;
21 import android.support.v7.app.AppCompatActivity;
22 23 import com.esri.arcgisruntime.geometry.Envelope;
24 import com.esri.arcgisruntime.geometry.Multipoint;
25 import com.esri.arcgisruntime.geometry.Point;
26 import com.esri.arcgisruntime.geometry.PointCollection;
27 import com.esri.arcgisruntime.geometry.Polygon;
28 import com.esri.arcgisruntime.geometry.Polyline;
29 import com.esri.arcgisruntime.geometry.SpatialReferences;
30 import com.esri.arcgisruntime.mapping.ArcGISMap;
31 import com.esri.arcgisruntime.mapping.Basemap;
32 import com.esri.arcgisruntime.mapping.view.Graphic;
33 import com.esri.arcgisruntime.mapping.view.GraphicsOverlay;
34 import com.esri.arcgisruntime.mapping.view.MapView;
35 import com.esri.arcgisruntime.symbology.SimpleFillSymbol;
36 import com.esri.arcgisruntime.symbology.SimpleLineSymbol;
37 import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol;
38 39 /**
40 * Shows straightforward ways to create Point, Envelope, Multipoint, Polyline, and Polygon geometries. Shows a MapView
41 * with a GraphicsOverlay containing Graphics created from the Point, Multipoint, Polyline, and Polygon geometries, and
42 * sets the Viewpoint of the Map from the Envelope geometry.
43 */
44 public class MainActivity extends AppCompatActivity {
45 46 private Envelope createEnvelope() {
47 48 //[DocRef: Name=Create Envelope, Category=Fundamentals, Topic=Geometries]
49 // create an Envelope using minimum and maximum x,y coordinates and a SpatialReference
50 Envelope envelope = new Envelope(-123.0, 33.5, -101.0, 48.0, SpatialReferences.getWgs84());
51 //[DocRef: END]
52 53 return envelope;
54 }
55 56 private Point createPoint() {
57 //[DocRef: Name=Create Point, Category=Fundamentals, Topic=Geometries]
58 // create a Point using x,y coordinates and a SpatialReference
59 Point pt = new Point(34.056295, -117.195800, SpatialReferences.getWgs84());
60 //[DocRef: END]
61 62 return pt;
63 }
64 65 private Multipoint createMultipoint() {
66 //[DocRef: Name=Create Multipoint, Category=Fundamentals, Topic=Geometries]
67 // create a Multipoint from a PointCollection
68 PointCollection stateCapitalsPST = new PointCollection(SpatialReferences.getWgs84());
69 stateCapitalsPST.add(-121.491014, 38.579065); // Sacramento, CA
70 stateCapitalsPST.add(-122.891366, 47.039231); // Olympia, WA
71 stateCapitalsPST.add(-123.043814, 44.93326); // Salem, OR
72 stateCapitalsPST.add(-119.766999, 39.164885); // Carson City, NV
73 Multipoint multipoint = new Multipoint(stateCapitalsPST);
74 //[DocRef: END]
75 76 return multipoint;
77 }
78 79 private Polyline createPolyline() {
80 //[DocRef: Name=Create Polyline, Category=Fundamentals, Topic=Geometries]
81 // create a Polyline from a PointCollection
82 PointCollection borderCAtoNV = new PointCollection(SpatialReferences.getWgs84());
83 borderCAtoNV.add(-119.992, 41.989);
84 borderCAtoNV.add(-119.994, 38.994);
85 borderCAtoNV.add(-114.620, 35.0);
86 Polyline polyline = new Polyline(borderCAtoNV);
87 //[DocRef: END]
88 89 return polyline;
90 }
91 92 private Polygon createPolygon() {
93 //[DocRef: Name=Create Polygon, Category=Fundamentals, Topic=Geometries]
94 // create a Polygon from a PointCollection
95 PointCollection coloradoCorners = new PointCollection(SpatialReferences.getWgs84());
96 coloradoCorners.add(-109.048, 40.998);
97 coloradoCorners.add(-102.047, 40.998);
98 coloradoCorners.add(-102.037, 36.989);
99 coloradoCorners.add(-109.048, 36.998);
100 Polygon polygon = new Polygon(coloradoCorners);
101 //[DocRef: END]
102 103 return polygon;
104 }
105 106 107 @Override
108 protected void onCreate(Bundle savedInstanceState) {
109 super.onCreate(savedInstanceState);
110 setContentView(R.layout.activity_main);
111 112 // get MapView from layout
113 MapView mMapView = (MapView) findViewById(R.id.mapView);
114 115 // create a map with the BasemapType topographic
116 final ArcGISMap mMap = new ArcGISMap(Basemap.createTopographic());
117 118 // set the map to be displayed in this view
119 mMapView.setMap(mMap);
120 121 // create color and symbols for drawing graphics
122 SimpleMarkerSymbol markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.TRIANGLE, Color.BLUE, 14);
123 SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.CROSS, Color.BLUE, null);
124 SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLUE, 3);
125 126 // add a graphic of point, multipoint, polyline and polygon.
127 GraphicsOverlay overlay = new GraphicsOverlay();
128 mMapView.getGraphicsOverlays().add(overlay);
129 overlay.getGraphics().add(new Graphic(createPolygon(), fillSymbol));
130 overlay.getGraphics().add(new Graphic(createPolyline(), lineSymbol));
131 overlay.getGraphics().add(new Graphic(createMultipoint(), markerSymbol));
132 overlay.getGraphics().add(new Graphic(createPoint(), markerSymbol));
133 134 // use the envelope to set the map viewpoint
135 mMapView.setViewpointGeometryAsync(createEnvelope(), getResources().getDimension(R.dimen.viewpoint_padding));
136 137 }
138 139 }
arcgis runtime 100 Create geometries的更多相关文章
- Arcgis Runtime 100.3开发实例源代码调试日志
Arcgis Runtime 100.3开发实例源代码调试日志 路径: "D:\arcgis runtime1003\arcgis-runtime-samples-dotnet-master ...
- 使用ArcGIS Runtime 100 进行本地GIS数据处理的注意事项
如下图所示,如果需要使用ArcGIS Runtime 100 进行本地GIS数据处理,则需要依赖Local Server通过发布GP服务实现. 一.ArcGIS Runtime所使用的GPK是有版本限 ...
- 基于ArcGIS Runtime 100.x 的移动应用程序开发框架 开源
ArcGIS Runtime作为新一代的轻量GIS应用开发产品,它提供多种API,可以使用Android,iOS,Java,Mac OS X(Objective-C/Swift)..NET,Qt(C+ ...
- ArcGIS Runtime For Android 100.3天地图不加载问题
ArcGIS Runtime 100.3 不加载天地图问题 参考这篇帖子:https://community.esri.com/thread/220496-1003-webtiledlayer-can ...
- ArcGIS Runtime for Android 使用异步GP服务绘制等值线
关于基于Android上ArcGIS Server GP服务的调用,已经有前辈给出了很好的例子: http://blog.csdn.net/esrichinacd/article/details/92 ...
- (转)ArcGIS Runtime for Android 使用异步GP服务绘制等值线
关于基于Android上ArcGIS Server GP服务的调用,已经有前辈给出了很好的例子: http://blog.csdn.net/esrichinacd/article/details/92 ...
- ArcGIS Runtime SDK for iOS开发地图图层-图形图层
注:本文翻译自:https://developers.arcgis.com/ios/objective-c/guide/creating-a-graphics-layer.htm 创建图 ...
- ArcGIS Runtime For Android setViewpointCenterAsync(Point center, double scale)效果奇葩,不响应
最近做一个东西,用的是ArcGIS Runtime Sdk for Android 100.1.0,由于刚用这个版本,理解不够,出现了一个奇葩问题 在对FeatureLayer进行Query之后,想要 ...
- ArcGIS Runtime SDK for iOS之符号和渲染
符号定义了图形外观的非地理方面.它包括了图形的颜色.线宽.透明度等等.ArcGIS Runtime SDK for iOS包含了许多符号类,其中的每个类可以让你以独特的方式指定符号.每个符号的类型也是 ...
随机推荐
- LeetCode699. Falling Squares
On an infinite number line (x-axis), we drop given squares in the order they are given. The i-th squ ...
- 20155309南皓芯2016-2017 2《Java程序设计》第一周学习总结
关于java学习笔记的思考问题 第一章:JDK与JRE,JVM之间有没有必然的联系 第二章:可执行文件夹找到相关链接库 第三章:for与while循环的用法与比较,break与continue跳出的注 ...
- CentOS6.5配置rsyslog
如何在RHEL 6.5安装和配置rsyslog现在7.6版本/ CentOS的6.5 .The情况是,安装和RHEL / CentOS的6.5安装rsyslog现在集中式日志服务器上.所有的客户端服务 ...
- abtest分流随机链接方法(javascript)
¶¹¸¯¸ÉËêµÄ·¨¹úµçÊÓ¸²¸Ç --> 代码如下 <!DOCTYPE HTML> <html> <head> <script type=& ...
- ASP.NET:使用Flurl制作可复用的分页组件
使用ASP.NET MVC查询时,一直使用MvcPaging组件,虽然需要自定义MvcPaging.Pager才能达到我想要的效果,但在没有较好的URL库时,还是这么用.分页的逻辑本来就不复杂,更重要 ...
- 【Codechef】Random Number Generator(多项式除法)
题解 前置技能 1.多项式求逆 求\(f(x)\*g(x) \equiv 1 \pmod {x^{t}}\) 我们在t == 1时,有\(f[0] = frac{1}{g[0]}\) 之后呢,我们倍增 ...
- 洛谷P2525 Uim的情人节礼物·其之壱 [康托展开]
题目传送门 Uim的情人节礼物·其之壱 题目描述 情人节到了,Uim打算给他的后宫们准备情人节礼物.UIm一共有N(1<=N<=9)个后宫妹子(现充去死 挫骨扬灰!). 为了维护他的后宫的 ...
- 学习 HMM
简介 HMM 中的变量可以分为两组. 第一组是状态变量 \(\{y_i,y_2,\cdots, y_n\}\), 其中 \(y_i \in \mathcal{Y}\) 表示第 \(i\) 时刻的系统状 ...
- Keras/tensorflow出现‘Loaded runtime CuDNN library: 7.0.5 but source was compiled with: 7.1.14’错误的解决办法
从tensorflow1.10 升级到1.12版本后,对依赖的CuDNN不兼容产生的问题.鉴于一直使用的是Keras,未使用新版本tensorflow的功能,故果断回退到旧版本. 方法为:pip3 i ...
- Outlook数据提取工具readpst
Outlook数据提取工具readpst Outlook是Windows常用的邮件客户端.它将用户的信息保存到.pst文件中,如邮件.约会.日历.联系人等信息.为了便于查看这些信息,Kali Li ...