我是靠谱客的博主 淡然啤酒,这篇文章主要介绍ArcGIS For Android 定位绘图工具 [中心点,误差圆],现在分享给大家,希望可以做个参考。


复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/** * 定位绘图 * * @author wuxin * @time 10:29 */ public class DrawLocate { private static Graphic graphicCenterPoint; private static Graphic graphicErrorRound; /** * 绘制定位 * @param center 中心点 * @param radius 误差圆半径(单位:米) * @param graphicsLayer 绘制图层 * @param centerImage 中心点图片 * @param errorRoundColorFill 误差圆颜色 * @param errorRoundColorLine 误差圆边线颜色 */ public static void drawPoint(Point center, double radius, GraphicsLayer graphicsLayer, Drawable centerImage, int errorRoundColorFill, int errorRoundColorLine) { /* 清除图层 */ if(graphicsLayer != null){ graphicsLayer.removeAll(); } /* 绘制中心点 */ PictureMarkerSymbol symbol = new PictureMarkerSymbol(centerImage); symbol.setOffsetY(10.0f); graphicCenterPoint = new Graphic(center, symbol); /* 绘制误差圆 */ if(radius > 0){ Polygon polygon = new Polygon(); getCircle(center, radius, polygon); FillSymbol fillSymbol = new SimpleFillSymbol(errorRoundColorFill); fillSymbol.setAlpha(10); SimpleLineSymbol lineSymbol = new SimpleLineSymbol(errorRoundColorLine, 2.0f, SimpleLineSymbol.STYLE.SOLID); fillSymbol.setOutline(lineSymbol); graphicErrorRound = new Graphic(polygon, fillSymbol); } /* 绘制上图 */ graphicsLayer.addGraphics(new Graphic[]{graphicCenterPoint, graphicErrorRound}); } /** * 获取圆的图形对象 * * @param center * @param radius * @return */ public static Polygon getCircle(Point center, double radius) { Polygon polygon = new Polygon(); getCircle(center, radius, polygon); return polygon; } /** * * @param center * 中心点 * @param radius * 半径(米) * @param circle * 圆的图形对象 */ private static void getCircle(Point center, double radius, Polygon circle) { circle.setEmpty(); Point[] points = getPoints(center, radius); circle.startPath(points[0]); for (int i = 1; i < points.length; i++) circle.lineTo(points[i]); } /** * 通过中心点和半径计算得出圆形的边线点集合 * * @param center * @param radius * @return */ private static Point[] getPoints(Point center, double radius) { Point[] points = new Point[50]; double sin; double cos; double x; double y; for (double i = 0; i < 50; i++) { sin = Math.sin(Math.PI * 2 * i / 50); cos = Math.cos(Math.PI * 2 * i / 50); x = center.getX() + radius * sin; y = center.getY() + radius * cos; points[(int) i] = new Point(x, y); } return points; } }

引用方式:

复制代码
1
2
DrawLocate.drawPoint(point, location.getRadius(), baiduLayer, image, Color.parseColor("#0099FF"), Color.parseColor("#0099FF"));


最后

以上就是淡然啤酒最近收集整理的关于ArcGIS For Android 定位绘图工具 [中心点,误差圆]的全部内容,更多相关ArcGIS内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(93)

评论列表共有 0 条评论

立即
投稿
返回
顶部