bcfced97 by chiangbt

first commit

0 parents
Showing 57 changed files with 1876 additions and 0 deletions
1 *.iml
2 .gradle
3 /local.properties
4 /.idea/workspace.xml
5 /.idea/libraries
6 .DS_Store
7 /build
8 /captures
9 .externalNativeBuild
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project version="4">
3 <component name="GradleSettings">
4 <option name="linkedExternalProjectsSettings">
5 <GradleProjectSettings>
6 <option name="distributionType" value="DEFAULT_WRAPPED" />
7 <option name="externalProjectPath" value="$PROJECT_DIR$" />
8 <option name="modules">
9 <set>
10 <option value="$PROJECT_DIR$" />
11 <option value="$PROJECT_DIR$/app" />
12 </set>
13 </option>
14 <option name="resolveModulePerSourceSet" value="false" />
15 </GradleProjectSettings>
16 </option>
17 </component>
18 </project>
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project version="4">
3 <component name="NullableNotNullManager">
4 <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
5 <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
6 <option name="myNullables">
7 <value>
8 <list size="4">
9 <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
10 <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
11 <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
12 <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
13 </list>
14 </value>
15 </option>
16 <option name="myNotNulls">
17 <value>
18 <list size="4">
19 <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
20 <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
21 <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
22 <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
23 </list>
24 </value>
25 </option>
26 </component>
27 <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
28 <output url="file://$PROJECT_DIR$/build/classes" />
29 </component>
30 <component name="ProjectType">
31 <option name="id" value="Android" />
32 </component>
33 </project>
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project version="4">
3 <component name="ProjectModuleManager">
4 <modules>
5 <module fileurl="file://$PROJECT_DIR$/LandSurvey.iml" filepath="$PROJECT_DIR$/LandSurvey.iml" />
6 <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
7 </modules>
8 </component>
9 </project>
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project version="4">
3 <component name="RunConfigurationProducerService">
4 <option name="ignoredProducers">
5 <set>
6 <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
7 <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
8 <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
9 </set>
10 </option>
11 </component>
12 </project>
...\ No newline at end of file ...\ No newline at end of file
1 apply plugin: 'com.android.application'
2
3 android {
4 compileSdkVersion 26
5 defaultConfig {
6 applicationId "com.pashanhoo.landsurvey"
7 minSdkVersion 21
8 targetSdkVersion 26
9 versionCode 1
10 versionName "1.0"
11 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 }
13 packagingOptions {
14 exclude 'META-INF/LGPL2.1'
15 exclude 'META-INF/LICENSE'
16 exclude 'META-INF/NOTICE'
17 }
18 buildTypes {
19 release {
20 minifyEnabled false
21 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 }
23 }
24 }
25
26 dependencies {
27 compile 'com.esri.arcgis.android:arcgis-android:10.2.9'
28 compile 'com.mikepenz:fontawesome-typeface:4.7.0.0@aar'
29
30 implementation fileTree(dir: 'libs', include: ['*.jar'])
31 implementation 'com.android.support:appcompat-v7:26.1.0'
32 implementation 'com.android.support.constraint:constraint-layout:1.0.2'
33 implementation 'com.android.support:design:26.1.0'
34 testImplementation 'junit:junit:4.12'
35 androidTestImplementation 'com.android.support.test:runner:1.0.1'
36 androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
37 }
1 # Add project specific ProGuard rules here.
2 # You can control the set of applied configuration files using the
3 # proguardFiles setting in build.gradle.
4 #
5 # For more details, see
6 # http://developer.android.com/guide/developing/tools/proguard.html
7
8 # If your project uses WebView with JS, uncomment the following
9 # and specify the fully qualified class name to the JavaScript interface
10 # class:
11 #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 # public *;
13 #}
14
15 # Uncomment this to preserve the line number information for
16 # debugging stack traces.
17 #-keepattributes SourceFile,LineNumberTable
18
19 # If you keep the line number information, uncomment this to
20 # hide the original source file name.
21 #-renamesourcefileattribute SourceFile
1 package com.pashanhoo.landsurvey;
2
3 import android.content.Context;
4 import android.support.test.InstrumentationRegistry;
5 import android.support.test.runner.AndroidJUnit4;
6
7 import org.junit.Test;
8 import org.junit.runner.RunWith;
9
10 import static org.junit.Assert.*;
11
12 /**
13 * Instrumented test, which will execute on an Android device.
14 *
15 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16 */
17 @RunWith(AndroidJUnit4.class)
18 public class ExampleInstrumentedTest {
19 @Test
20 public void useAppContext() throws Exception {
21 // Context of the app under test.
22 Context appContext = InstrumentationRegistry.getTargetContext();
23
24 assertEquals("com.pashanhoo.landsurvey", appContext.getPackageName());
25 }
26 }
1 <?xml version="1.0" encoding="utf-8"?>
2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 package="com.pashanhoo.landsurvey">
4 <uses-feature
5 android:glEsVersion="0x00020000"
6 android:required="true" />
7 <uses-permission android:name="android.permission.INTERNET" />
8 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
9 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
10 <application
11 android:allowBackup="true"
12 android:icon="@mipmap/logo"
13 android:label="@string/app_name"
14 android:roundIcon="@mipmap/ic_launcher_round"
15 android:supportsRtl="true"
16 android:theme="@style/AppTheme">
17 <activity
18 android:name=".MainActivity"
19 android:label="@string/app_name"
20 android:screenOrientation="landscape"
21 android:theme="@style/AppTheme.NoActionBar">
22 <intent-filter>
23 <action android:name="android.intent.action.MAIN" />
24
25 <category android:name="android.intent.category.LAUNCHER" />
26 </intent-filter>
27 </activity>
28 </application>
29
30 </manifest>
...\ No newline at end of file ...\ No newline at end of file
1 package com.pashanhoo.landsurvey;
2
3 import android.location.Location;
4 import android.location.LocationListener;
5 import android.os.Bundle;
6 import android.support.design.widget.FloatingActionButton;
7 import android.support.v7.app.AppCompatActivity;
8 import android.support.v7.widget.Toolbar;
9 import android.util.Log;
10 import android.view.View;
11 import android.view.Menu;
12 import android.view.MenuItem;
13
14 import com.esri.android.map.LocationDisplayManager;
15 import com.esri.android.map.MapView;
16 import com.esri.android.map.event.OnStatusChangedListener;
17 import com.esri.android.runtime.ArcGISRuntime;
18 import com.esri.core.geometry.Point;
19 import com.pashanhoo.landsurvey.layers.tianditu.TDTTileinfo;
20 import com.pashanhoo.landsurvey.layers.tianditu.TianDiTuLocalTiledMapServiceLayer;
21 import com.pashanhoo.landsurvey.layers.tianditu.TianDiTuTiledMapServiceLayer;
22 import com.pashanhoo.landsurvey.layers.tianditu.TianDiTuTiledMapServiceType;
23 import com.pashanhoo.landsurvey.utils.AppInfo;
24
25 public class MainActivity extends AppCompatActivity {
26
27 private MapView mapView;
28 private LocationDisplayManager locationDisplayManager;
29 private TianDiTuTiledMapServiceLayer t_vec;
30 private TianDiTuTiledMapServiceLayer t_cva;
31 private TianDiTuTiledMapServiceLayer t_img;
32 private TianDiTuTiledMapServiceLayer t_cia;
33 // mbtiles式天地图数据
34 private TianDiTuLocalTiledMapServiceLayer t_local;
35
36 private String mapType;
37
38 @Override
39 protected void onCreate(Bundle savedInstanceState) {
40 super.onCreate(savedInstanceState);
41 setContentView(R.layout.activity_main);
42 Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
43 setSupportActionBar(toolbar);
44 //初始化-------------------------------------------------------------------
45 AppInfo.Settings();
46 //按钮动作-------------------------------------------------------------------
47 FloatingActionButton zoomin = (FloatingActionButton) findViewById(R.id.zoomin);
48 zoomin.setOnClickListener(new View.OnClickListener() {
49 @Override
50 public void onClick(View view) {
51 if(locationDisplayManager!=null){
52 locationDisplayManager.stop();
53 }
54 mapView.zoomin(true);
55 }
56 });
57 FloatingActionButton zoomout = (FloatingActionButton) findViewById(R.id.zoomout);
58 zoomout.setOnClickListener(new View.OnClickListener() {
59 @Override
60 public void onClick(View view) {
61 if(locationDisplayManager!=null){
62 locationDisplayManager.stop();
63 }
64 mapView.zoomout(true);
65 }
66 });
67 FloatingActionButton fullmap = (FloatingActionButton) findViewById(R.id.fullmap);
68 fullmap.setOnClickListener(new View.OnClickListener() {
69 @Override
70 public void onClick(View view) {
71 locationDisplayManager.stop();
72 mapView.zoomToResolution(AppInfo.initPoint, AppInfo.initRes);
73 }
74 });
75 FloatingActionButton gps = (FloatingActionButton) findViewById(R.id.gps);
76 gps.setOnClickListener(new View.OnClickListener() {
77 @Override
78 public void onClick(View view) {
79 if(locationDisplayManager.isStarted()){
80 locationDisplayManager.stop();
81 }else{
82 locationDisplayManager.start();
83 mapView.zoomToResolution(locationDisplayManager.getPoint(), TDTTileinfo.getRes4490()[18]);
84 }
85 }
86 });
87 //地图初始化-------------------------------------------------------------------
88 ArcGISRuntime.setClientId("1eFHW78avlnRUPHm");
89 mapView = (MapView)findViewById(R.id.map);
90 mapView.setEsriLogoVisible(false);
91 mapView.enableWrapAround(false);
92
93 t_vec = new TianDiTuTiledMapServiceLayer(TianDiTuTiledMapServiceType.VEC_C);
94 mapView.addLayer(t_vec);
95 t_cva = new TianDiTuTiledMapServiceLayer(TianDiTuTiledMapServiceType.CVA_C);
96 mapView.addLayer(t_cva);
97
98 // t_local = new TianDiTuLocalTiledMapServiceLayer("my.mbtiles");
99 // mapView.addLayer(t_local);
100
101 t_img = new TianDiTuTiledMapServiceLayer(TianDiTuTiledMapServiceType.IMG_C);
102 t_img.setVisible(false);
103 mapView.addLayer(t_img);
104 t_cia = new TianDiTuTiledMapServiceLayer(TianDiTuTiledMapServiceType.CIA_C);
105 t_cia.setVisible(false);
106 mapView.addLayer(t_cia);
107 mapType = "VEC";
108
109 mapView.setMaxResolution(TDTTileinfo.getRes4490()[0]);
110 mapView.setMinResolution(TDTTileinfo.getRes4490()[18]);
111
112 mapView.setOnStatusChangedListener(new OnStatusChangedListener() {
113 private static final long serialVersionUID = 1L;
114 @Override
115 public void onStatusChanged(Object o, STATUS status) {
116 if(status == STATUS.INITIALIZED){
117 mapView.zoomToResolution(AppInfo.initPoint, AppInfo.initRes);
118 }
119 }
120 });
121
122 // GPS
123 locationDisplayManager = mapView.getLocationDisplayManager();
124 locationDisplayManager.setShowLocation(true);
125 locationDisplayManager.setAutoPanMode(LocationDisplayManager.AutoPanMode.LOCATION);//设置模式
126 locationDisplayManager.setShowPings(true);
127 locationDisplayManager.setLocationListener(new LocationListener() {
128 @Override
129 public void onLocationChanged(Location location) {
130 mapView.zoomToResolution(new Point(location.getLongitude(), location.getLatitude()), mapView.getResolution());
131 }
132
133 @Override
134 public void onStatusChanged(String s, int i, Bundle bundle) {
135 }
136
137 @Override
138 public void onProviderEnabled(String s) {
139 }
140
141 @Override
142 public void onProviderDisabled(String s) {
143 }
144 });
145
146 }
147
148 @Override
149 public void onResume() {
150 super.onResume();
151 mapView.unpause();
152 if(locationDisplayManager!=null){
153 locationDisplayManager.resume();
154 }
155 }
156
157 @Override
158 public void onPause() {
159 super.onPause();
160 mapView.pause();
161 if(locationDisplayManager!=null){
162 locationDisplayManager.pause();
163 }
164 }
165
166 @Override
167 public void onStop() {
168 super.onStop();
169 if(locationDisplayManager!=null){
170 locationDisplayManager.stop();
171 }
172
173 }
174
175 @Override
176 public boolean onCreateOptionsMenu(Menu menu) {
177 // Inflate the menu; this adds items to the action bar if it is present.
178 getMenuInflater().inflate(R.menu.menu_main, menu);
179 return true;
180 }
181
182 @Override
183 public boolean onOptionsItemSelected(MenuItem item) {
184 // Handle action bar item clicks here. The action bar will
185 // automatically handle clicks on the Home/Up button, so long
186 // as you specify a parent activity in AndroidManifest.xml.
187 int id = item.getItemId();
188
189 //noinspection SimplifiableIfStatement
190 if (id == R.id.action_settings) {
191 if(mapType == "VEC"){
192 setLayer("IMG");
193 mapType = "IMG";
194 }else{
195 setLayer("VEC");
196 mapType = "VEC";
197 }
198 return true;
199 }
200
201 return super.onOptionsItemSelected(item);
202 }
203
204 // 切换地图形式
205 private void setLayer(String type){
206 switch (type){
207 case "VEC":
208 t_vec.setVisible(true);
209 t_cva.setVisible(true);
210 t_img.setVisible(false);
211 t_cia.setVisible(false);
212 break;
213 case "IMG":
214 t_vec.setVisible(false);
215 t_cva.setVisible(false);
216 t_img.setVisible(true);
217 t_cia.setVisible(true);
218 break;
219 default:
220 Log.i("keymapinfo", "map");
221 }
222 }
223 }
1 package com.pashanhoo.landsurvey.layers;
2
3 /**
4 * Created by jiangbotao on 2018/3/23.
5 */
6
7 public interface BaseTiledMapServiceType {
8
9 String getName();
10 }
1 package com.pashanhoo.landsurvey.layers.tianditu;
2
3 import com.esri.core.geometry.Point;
4
5 /**
6 * Created by jiangbotao on 2018/3/22.
7 */
8
9 public class TDTTileinfo {
10
11 private static Point originalPoint4490 = new Point(-180, 90);
12
13 private static double[] res4490 = {
14 1.40625,
15 0.703125,
16 0.3515625,
17 0.17578125,
18 0.087890625,
19 0.0439453125,
20 0.02197265625,
21 0.010986328125,
22 0.0054931640625,
23 0.00274658203125,
24 0.001373291015625,
25 0.0006866455078125,
26 0.00034332275390625,
27 0.000171661376953125,
28 8.58306884765629E-05,
29 4.29153442382814E-05,
30 2.14576721191407E-05,
31 1.07288360595703E-05,
32 5.36441802978515E-06,
33 2.68220901489258E-06,
34 1.34110450744629E-06
35 };
36 private static double[] scale4490 = {
37 400000000,
38 295497598.5708346,
39 147748799.285417,
40 73874399.6427087,
41 36937199.8213544,
42 18468599.9106772,
43 9234299.95533859,
44 4617149.97766929,
45 2308574.98883465,
46 1154287.49441732,
47 577143.747208662,
48 288571.873604331,
49 144285.936802165,
50 72142.9684010827,
51 36071.4842005414,
52 18035.7421002707,
53 9017.87105013534,
54 4508.93552506767,
55 2254.467762533835,
56 1127.2338812669175,
57 563.616940
58 };
59 private static int levels = 21;
60 private static int dpi = 96;
61 private static int tileWidth = 256;
62 private static int tileHeight = 256;
63
64
65 private static Point originalPoint4326 = new Point(-20037508.3427892, 20037508.3427892);
66 private static double[] scale4326={
67 295829355.45,
68 147914677.73,
69 73957338.86,
70 36978669.43,
71 18489334.72,
72 9244667.36,
73 4622333.68,
74 2311166.84,
75 1155583.42,
76 577791.71,
77 288895.85,
78 144447.93,
79 72223.96,
80 36111.98,
81 18055.99,
82 9028,
83 4514,
84 2257 };
85 private static double[] res4326={
86 0.70391441567318025,
87 0.35195720784848739,
88 0.1759786039123464,
89 0.087989301956173202,
90 0.043994650989983904,
91 0.021997325494991952,
92 0.010998662747495976,
93 0.005499331373747988,
94 0.002749665686873994,
95 0.001374832843436997,
96 0.00068741640982119352,
97 0.00034370821680790179,
98 0.00017185409650664589,
99 8.5927048253322947e-005,
100 4.2963524126661473e-005,
101 2.1481773960635764e-005,
102 1.0740886980317882e-005,
103 5.3704434901589409e-006 };
104
105 public static Point getOriginalPoint4490() {
106 return originalPoint4490;
107 }
108
109 public static double[] getRes4490() {
110 return res4490;
111 }
112
113 public static double[] getScale4490() {
114 return scale4490;
115 }
116
117 public static Point getOriginalPoint4236() {
118 return originalPoint4326;
119 }
120
121 public static double[] getRes4326() {
122 return res4326;
123 }
124
125 public static double[] getScale4326() {
126 return scale4326;
127 }
128
129 public static int getLevels() {
130 return levels;
131 }
132
133 public static int getDpi() {
134 return dpi;
135 }
136
137 public static int getTileWidth() {
138 return tileWidth;
139 }
140
141 public static int getTileHeight() {
142 return tileHeight;
143 }
144 }
1 package com.pashanhoo.landsurvey.layers.tianditu;
2
3 import java.util.Random;
4
5 /**
6 * Created by jiangbotao on 2018/3/23.
7 */
8
9 public class TDTUrl {
10
11 private TianDiTuTiledMapServiceType _tiandituMapServiceType;
12 private int _level;
13 private int _col;
14 private int _row;
15
16 public TDTUrl(int level, int col, int row, TianDiTuTiledMapServiceType tiandituMapServiceType) {
17 this._level = level;
18 this._col = col;
19 this._row = row;
20 this._tiandituMapServiceType = tiandituMapServiceType;
21 }
22
23 public String generatUrl() {
24
25 StringBuilder url = new StringBuilder("http://t");
26 Random random = new Random();
27 int subdomain = (random.nextInt(6) + 1);
28 url.append(subdomain);
29 switch (this._tiandituMapServiceType) {
30 case VEC_C:
31 url.append(".tianditu.com/DataServer?T=vec_c&X=").append(this._col).append("&Y=").append(this._row).append("&L=").append(this._level);
32 break;
33 case CVA_C:
34 url.append(".tianditu.com/DataServer?T=cva_c&X=").append(this._col).append("&Y=").append(this._row).append("&L=").append(this._level);
35 break;
36 case CIA_C:
37 url.append(".tianditu.com/DataServer?T=cia_c&X=").append(this._col).append("&Y=").append(this._row).append("&L=").append(this._level);
38 break;
39 case IMG_C:
40 url.append(".tianditu.com/DataServer?T=img_c&X=").append(this._col).append("&Y=").append(this._row).append("&L=").append(this._level);
41 break;
42 case VEC_W:
43 url.append(".tianditu.com/DataServer?T=vec_w&X=").append(this._col).append("&Y=").append(this._row).append("&L=").append(this._level);
44 break;
45 case CVA_W:
46 url.append(".tianditu.com/DataServer?T=cva_w&X=").append(this._col).append("&Y=").append(this._row).append("&L=").append(this._level);
47 break;
48 case CIA_W:
49 url.append(".tianditu.com/DataServer?T=cia_w&X=").append(this._col).append("&Y=").append(this._row).append("&L=").append(this._level);
50 break;
51 case IMG_W:
52 url.append(".tianditu.com/DataServer?T=img_w&X=").append(this._col).append("&Y=").append(this._row).append("&L=").append(this._level);
53 break;
54 default:
55 return null;
56 }
57 return url.toString();
58 }
59 }
1 package com.pashanhoo.landsurvey.layers.tianditu;
2
3 import android.database.Cursor;
4 import android.database.sqlite.SQLiteDatabase;
5 import android.os.Environment;
6 import android.util.Log;
7
8 import com.esri.android.map.TiledServiceLayer;
9 import com.esri.core.geometry.Envelope;
10 import com.esri.core.geometry.Point;
11 import com.esri.core.geometry.SpatialReference;
12 import com.pashanhoo.landsurvey.utils.AppInfo;
13
14 import java.util.concurrent.RejectedExecutionException;
15
16 /**
17 * Created by jiangbotao on 2018/3/25.
18 */
19
20 public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer {
21
22 String sqlitedb = "";
23 private TileInfo tiandituTileInfo;
24
25 public TianDiTuLocalTiledMapServiceLayer(String url) {
26 super(url);
27 this.sqlitedb = url;
28 try {
29 getServiceExecutor().submit(new Runnable() {
30
31 public final void run() {
32 a.initLayer();
33 }
34
35 final TianDiTuLocalTiledMapServiceLayer a;
36
37
38 {
39 a = TianDiTuLocalTiledMapServiceLayer.this;
40 //super();
41 }
42 });
43 return;
44 } catch (RejectedExecutionException _ex) {
45 }
46 }
47
48
49 protected void initLayer() {
50 this.buildTileInfo();
51 this.setFullExtent(new Envelope(-180, -90, 180, 90));
52 this.setDefaultSpatialReference(SpatialReference.create(4490)); //CGCS2000
53 //this.setDefaultSpatialReference(SpatialReference.create(4326));
54 this.setInitialExtent(new Envelope(90.52, 33.76, 113.59, 42.88));
55 super.initLayer();
56 }
57
58
59 @Override
60 protected byte[] getTile(int level, int col, int row) throws Exception {
61 byte[] result = null;
62 try{
63 result = getOfflineCacheDB(level, col, row);
64 }catch (Exception ex) {
65 ex.printStackTrace();
66 }
67
68 return result;
69 }
70
71 private byte[] getOfflineCacheDB(int level, int col, int row) throws Exception {
72
73 byte[] result = null;
74 Log.i("local", level + ":"+ col + ":" + row);
75 Log.i("local", String.valueOf(Math.pow(2, level)));
76 row = (int) (Math.pow(2, level) - col - row);
77 Log.i("local", level + ":"+ col + ":" + row);
78 Log.i("local","---------------------");
79 String sql = "select * from tiles where zoom_level = " + level + " and tile_column = " + col + " and tile_row = " + row;
80
81 Cursor mCursor =
82 SQLiteDatabase.openOrCreateDatabase(Environment.getExternalStorageDirectory()+"/keymapinfo/" + this.sqlitedb, null)
83 .rawQuery(sql, null);
84 boolean hasData = false;
85
86 while (mCursor.moveToNext()) {//判断是否存在数据
87 hasData = true;
88 }
89 if (hasData) {//数据库中有数据
90 try {
91 if (mCursor.moveToFirst()) {
92 result = mCursor.getBlob(mCursor.getColumnIndex("tile_data"));
93 }
94 mCursor.close();
95 } catch (Exception e) {
96 e.printStackTrace();
97 result = null;
98 }
99 }
100 return result;
101 }
102
103 private void buildTileInfo() {
104 Point originalPoint = new Point(-180, 90);
105
106 double[] res = {
107 1.40625,
108 0.703125,
109 0.3515625,
110 0.17578125,
111 0.087890625,
112 0.0439453125,
113 0.02197265625,
114 0.010986328125,
115 0.0054931640625,
116 0.00274658203125,
117 0.001373291015625,
118 0.0006866455078125,
119 0.00034332275390625,
120 0.000171661376953125,
121 8.58306884765629E-05,
122 4.29153442382814E-05,
123 2.14576721191407E-05,
124 1.07288360595703E-05,
125 5.36441802978515E-06,
126 2.68220901489258E-06,
127 1.34110450744629E-06
128 };
129 double[] scale = {
130 400000000,
131 295497598.5708346,
132 147748799.285417,
133 73874399.6427087,
134 36937199.8213544,
135 18468599.9106772,
136 9234299.95533859,
137 4617149.97766929,
138 2308574.98883465,
139 1154287.49441732,
140 577143.747208662,
141 288571.873604331,
142 144285.936802165,
143 72142.9684010827,
144 36071.4842005414,
145 18035.7421002707,
146 9017.87105013534,
147 4508.93552506767,
148 2254.467762533835,
149 1127.2338812669175,
150 563.616940
151 };
152 int levels = 21;
153 int dpi = 96;
154 int tileWidth = 256;
155 int tileHeight = 256;
156 this.tiandituTileInfo = new com.esri.android.map.TiledServiceLayer.TileInfo(originalPoint, scale, res, levels, dpi, tileWidth, tileHeight);
157 this.setTileInfo(this.tiandituTileInfo);
158 }
159 }
1 package com.pashanhoo.landsurvey.layers.tianditu;
2
3 import android.content.ContentValues;
4 import android.database.Cursor;
5 import android.util.Log;
6
7 import com.esri.android.map.TiledServiceLayer;
8 import com.esri.core.geometry.Envelope;
9 import com.esri.core.geometry.Point;
10 import com.esri.core.geometry.SpatialReference;
11 import com.esri.core.io.UserCredentials;
12 import com.pashanhoo.landsurvey.utils.AppInfo;
13 import com.pashanhoo.landsurvey.utils.GADBHelper;
14
15 import java.io.BufferedInputStream;
16 import java.io.ByteArrayOutputStream;
17 import java.net.HttpURLConnection;
18 import java.net.URL;
19 import java.util.concurrent.RejectedExecutionException;
20
21 /**
22 * Created by jiangbotao on 2018/3/23.
23 */
24
25 public class TianDiTuTiledMapServiceLayer extends TiledServiceLayer {
26
27 private TianDiTuTiledMapServiceType _mapType;
28 private TileInfo tiandituTileInfo;
29
30 public TianDiTuTiledMapServiceLayer() {
31 this(null, null, true);
32 }
33
34 public TianDiTuTiledMapServiceLayer(TianDiTuTiledMapServiceType mapType) {
35 this(mapType, null, true);
36 GADBHelper.createTable(AppInfo.mapcachedb, _mapType.getName());
37 }
38
39 public TianDiTuTiledMapServiceLayer(TianDiTuTiledMapServiceType mapType, UserCredentials usercredentials) {
40 this(mapType, usercredentials, true);
41 }
42
43 public TianDiTuTiledMapServiceLayer(TianDiTuTiledMapServiceType mapType, UserCredentials usercredentials, boolean flag) {
44 super("");
45 this._mapType = mapType;
46 setCredentials(usercredentials);
47
48 if (flag)
49 try {
50 getServiceExecutor().submit(new Runnable() {
51
52 public final void run() {
53 a.initLayer();
54 }
55
56 final TianDiTuTiledMapServiceLayer a;
57 {
58 a = TianDiTuTiledMapServiceLayer.this;
59 //super();
60 }
61 });
62 return;
63 } catch (RejectedExecutionException _ex) {
64 }
65 }
66
67
68 public TianDiTuTiledMapServiceType getMapType() {
69 return this._mapType;
70 }
71
72 protected void initLayer() {
73 this.buildTileInfo();
74 this.setFullExtent(new Envelope(-180, -90, 180, 90));
75 this.setDefaultSpatialReference(SpatialReference.create(4490)); //CGCS2000
76 //this.setDefaultSpatialReference(SpatialReference.create(4326));
77 this.setInitialExtent(new Envelope(90.52, 33.76, 113.59, 42.88));
78 super.initLayer();
79 }
80
81 public void refresh() {
82 try {
83 getServiceExecutor().submit(new Runnable() {
84
85 public final void run() {
86 if (a.isInitialized())
87 try {
88 a.b();
89 a.clearTiles();
90 return;
91 } catch (Exception exception) {
92 Log.e("ArcGIS", "Re-initialization of the layer failed.", exception);
93 }
94 }
95
96 final TianDiTuTiledMapServiceLayer a;
97
98 {
99 a = TianDiTuTiledMapServiceLayer.this;
100 //super();
101 }
102 });
103 return;
104 } catch (RejectedExecutionException _ex) {
105 return;
106 }
107 }
108
109 final void b()
110 throws Exception {
111
112 }
113
114 @Override
115 protected byte[] getTile(int level, int col, int row) throws Exception {
116 byte[] result = null;
117 try {
118 // 首先从离线数据库中读取
119 result = getOfflineCacheDB(level, col, row);
120 // 如果没有就直接从web上读取
121 if (result == null) {
122 ByteArrayOutputStream bos = new ByteArrayOutputStream();
123
124 URL sjwurl = new URL(this.getTianDiMapUrl(level, col, row));
125 HttpURLConnection httpUrl = null;
126 BufferedInputStream bis = null;
127 byte[] buf = new byte[1024];
128
129 httpUrl = (HttpURLConnection) sjwurl.openConnection();
130 httpUrl.connect();
131 bis = new BufferedInputStream(httpUrl.getInputStream());
132
133 while (true) {
134 int bytes_read = bis.read(buf);
135 if (bytes_read > 0) {
136 bos.write(buf, 0, bytes_read);
137 } else {
138 break;
139 }
140 }
141 ;
142 bis.close();
143 httpUrl.disconnect();
144
145 result = bos.toByteArray();
146 // 将读取的数据存入mbtiles中
147 AddOfflineCacheDB(level, col, row, result);
148 }
149 } catch (Exception ex) {
150 ex.printStackTrace();
151 }
152
153 return result;
154 }
155
156 private void AddOfflineCacheDB(int level, int col, int row, byte[] bytes){
157 ContentValues values = new ContentValues();
158 values.put("TILELEVEL", level);
159 values.put("TILECOL", col);
160 values.put("TILEROW", row);
161 values.put("TILEDATA", bytes);
162
163 AppInfo.mapcachedb.insert(_mapType.getName(), null, values);
164 }
165
166
167 private byte[] getOfflineCacheDB(int level, int col, int row) throws Exception {
168
169 byte[] result = null;
170 String sql = "select * from " + _mapType.getName() + " where TILELEVEL = " + level + " and TILECOL = " + col + " and TILEROW = " + row;
171 Cursor mCursor = AppInfo.mapcachedb.rawQuery(sql, null);
172 boolean hasData = false;
173
174 while (mCursor.moveToNext()) {//判断是否存在数据
175 hasData = true;
176 }
177 if (hasData) {//数据库中有数据
178 try {
179 if (mCursor.moveToFirst()) {
180 result = mCursor.getBlob(mCursor.getColumnIndex("TILEDATA"));
181 }
182 mCursor.close();
183 } catch (Exception e) {
184 e.printStackTrace();
185 result = null;
186 }
187 }
188 return result;
189 }
190
191 @Override
192 public TileInfo getTileInfo() {
193 return this.tiandituTileInfo;
194 }
195
196 /**
197 *
198 * */
199 private String getTianDiMapUrl(int level, int col, int row) {
200 String url = new TDTUrl(level, col, row, this._mapType).generatUrl();
201 return url;
202 }
203
204 private void buildTileInfo() {
205 Point originalPoint = new Point(-180, 90);
206
207 double[] res = {
208 1.40625,
209 0.703125,
210 0.3515625,
211 0.17578125,
212 0.087890625,
213 0.0439453125,
214 0.02197265625,
215 0.010986328125,
216 0.0054931640625,
217 0.00274658203125,
218 0.001373291015625,
219 0.0006866455078125,
220 0.00034332275390625,
221 0.000171661376953125,
222 8.58306884765629E-05,
223 4.29153442382814E-05,
224 2.14576721191407E-05,
225 1.07288360595703E-05,
226 5.36441802978515E-06,
227 2.68220901489258E-06,
228 1.34110450744629E-06
229 };
230 double[] scale = {
231 400000000,
232 295497598.5708346,
233 147748799.285417,
234 73874399.6427087,
235 36937199.8213544,
236 18468599.9106772,
237 9234299.95533859,
238 4617149.97766929,
239 2308574.98883465,
240 1154287.49441732,
241 577143.747208662,
242 288571.873604331,
243 144285.936802165,
244 72142.9684010827,
245 36071.4842005414,
246 18035.7421002707,
247 9017.87105013534,
248 4508.93552506767,
249 2254.467762533835,
250 1127.2338812669175,
251 563.616940
252 };
253 int levels = 21;
254 int dpi = 96;
255 int tileWidth = 256;
256 int tileHeight = 256;
257 this.tiandituTileInfo = new com.esri.android.map.TiledServiceLayer.TileInfo(originalPoint, scale, res, levels, dpi, tileWidth, tileHeight);
258 this.setTileInfo(this.tiandituTileInfo);
259 }
260 }
1 package com.pashanhoo.landsurvey.layers.tianditu;
2
3 import com.pashanhoo.landsurvey.layers.BaseTiledMapServiceType;
4
5 /**
6 * Created by jiangbotao on 2018/3/23.
7 */
8
9 public enum TianDiTuTiledMapServiceType implements BaseTiledMapServiceType {
10
11 /**
12 * 矢量数据,CGCS2000
13 * */
14 VEC_C,
15 /**
16 * 影像数据
17 * */
18 IMG_C,
19 /**
20 * 矢量注记
21 * */
22 CVA_C,
23 /**
24 * 影像注记
25 * */
26 CIA_C,
27 /**
28 * 矢量数据,web墨卡托4326
29 */
30 VEC_W,
31 /**
32 * 影像数据
33 * */
34 IMG_W,
35 /**
36 * 矢量注记
37 * */
38 CVA_W,
39 /**
40 * 影像注记
41 * */
42 CIA_W;
43
44 public void setName()
45 {
46
47 }
48
49 @Override
50 public String getName()
51 {
52 return this.name().toString();
53 }
54 }
1 package com.pashanhoo.landsurvey.utils;
2
3 import android.database.sqlite.SQLiteDatabase;
4 import android.os.Environment;
5 import android.util.Log;
6
7 import com.esri.core.geometry.Point;
8 import com.pashanhoo.landsurvey.layers.tianditu.TDTTileinfo;
9
10 import java.io.File;
11
12 /**
13 * Created by jiangbotao on 2018/3/23.
14 */
15
16 public class AppInfo {
17
18 public static String dbcachepath;
19
20 public static SQLiteDatabase mapcachedb;
21
22 public static Point initPoint = new Point(121.56, 29.862149);
23
24 public static double initRes = TDTTileinfo.getRes4490()[12];
25
26 public static void Settings(){
27 // 新建地图缓存数据库,不要试图新建多级目录,切记切记,如keymapinfo/cache
28 dbcachepath = Environment.getExternalStorageDirectory()+"/keymapinfo";
29 // 创建目录
30 final File mFolder = new File(dbcachepath);
31 if(!mFolder.exists()) {
32 mFolder.mkdirs();
33 }
34 Log.i("keymapinfo", AppInfo.dbcachepath);
35 mapcachedb = SQLiteDatabase.openOrCreateDatabase(dbcachepath + "/mapcache.db", null);
36 }
37 }
1 package com.pashanhoo.landsurvey.utils;
2
3 import android.content.Context;
4 import android.database.sqlite.SQLiteDatabase;
5 import android.database.sqlite.SQLiteOpenHelper;
6
7 /**
8 * Created by jiangbotao on 2018/3/23.
9 */
10
11 public class GADBHelper extends SQLiteOpenHelper {
12
13 private static final int VERSION = 1;
14 public static String TABLE_NAME = "ga_local";
15
16 public GADBHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
17 super(context, name, factory, version);
18 }
19
20 public GADBHelper(Context context, String name) {
21 this(context, name, null, VERSION);
22 }
23
24 @Override
25 public void onCreate(SQLiteDatabase db) {
26 db.beginTransaction();
27 db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_NAME +
28 "(TILELEVEL INT," +
29 "TILECOL INT," +
30 "TILEROW INT," +
31 "TILEDATA BLOB)");
32
33 db.setTransactionSuccessful();
34 db.endTransaction();
35 }
36
37 @Override
38 public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
39 db.execSQL("drop table if exists" + TABLE_NAME);
40 onCreate(db);
41 }
42
43 public void delete() {
44 SQLiteDatabase db = this.getWritableDatabase();
45 db.beginTransaction();
46 db.delete(GADBHelper.TABLE_NAME, "1=1", null);
47 db.setTransactionSuccessful();
48 db.endTransaction();
49 }
50
51
52 public static void createTable(SQLiteDatabase db, String TABLE_NAME){
53 db.beginTransaction();
54 db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_NAME +
55 "(TILELEVEL INT," +
56 "TILECOL INT," +
57 "TILEROW INT," +
58 "TILEDATA BLOB," +
59 "TILETIME TEXT)");
60
61 db.setTransactionSuccessful();
62 db.endTransaction();
63 }
64 }
1 <vector xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:aapt="http://schemas.android.com/aapt"
3 android:width="108dp"
4 android:height="108dp"
5 android:viewportHeight="108"
6 android:viewportWidth="108">
7 <path
8 android:fillType="evenOdd"
9 android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
10 android:strokeColor="#00000000"
11 android:strokeWidth="1">
12 <aapt:attr name="android:fillColor">
13 <gradient
14 android:endX="78.5885"
15 android:endY="90.9159"
16 android:startX="48.7653"
17 android:startY="61.0927"
18 android:type="linear">
19 <item
20 android:color="#44000000"
21 android:offset="0.0" />
22 <item
23 android:color="#00000000"
24 android:offset="1.0" />
25 </gradient>
26 </aapt:attr>
27 </path>
28 <path
29 android:fillColor="#FFFFFF"
30 android:fillType="nonZero"
31 android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
32 android:strokeColor="#00000000"
33 android:strokeWidth="1" />
34 </vector>
1 <?xml version="1.0" encoding="utf-8"?>
2 <vector xmlns:android="http://schemas.android.com/apk/res/android"
3 android:width="108dp"
4 android:height="108dp"
5 android:viewportHeight="108"
6 android:viewportWidth="108">
7 <path
8 android:fillColor="#26A69A"
9 android:pathData="M0,0h108v108h-108z" />
10 <path
11 android:fillColor="#00000000"
12 android:pathData="M9,0L9,108"
13 android:strokeColor="#33FFFFFF"
14 android:strokeWidth="0.8" />
15 <path
16 android:fillColor="#00000000"
17 android:pathData="M19,0L19,108"
18 android:strokeColor="#33FFFFFF"
19 android:strokeWidth="0.8" />
20 <path
21 android:fillColor="#00000000"
22 android:pathData="M29,0L29,108"
23 android:strokeColor="#33FFFFFF"
24 android:strokeWidth="0.8" />
25 <path
26 android:fillColor="#00000000"
27 android:pathData="M39,0L39,108"
28 android:strokeColor="#33FFFFFF"
29 android:strokeWidth="0.8" />
30 <path
31 android:fillColor="#00000000"
32 android:pathData="M49,0L49,108"
33 android:strokeColor="#33FFFFFF"
34 android:strokeWidth="0.8" />
35 <path
36 android:fillColor="#00000000"
37 android:pathData="M59,0L59,108"
38 android:strokeColor="#33FFFFFF"
39 android:strokeWidth="0.8" />
40 <path
41 android:fillColor="#00000000"
42 android:pathData="M69,0L69,108"
43 android:strokeColor="#33FFFFFF"
44 android:strokeWidth="0.8" />
45 <path
46 android:fillColor="#00000000"
47 android:pathData="M79,0L79,108"
48 android:strokeColor="#33FFFFFF"
49 android:strokeWidth="0.8" />
50 <path
51 android:fillColor="#00000000"
52 android:pathData="M89,0L89,108"
53 android:strokeColor="#33FFFFFF"
54 android:strokeWidth="0.8" />
55 <path
56 android:fillColor="#00000000"
57 android:pathData="M99,0L99,108"
58 android:strokeColor="#33FFFFFF"
59 android:strokeWidth="0.8" />
60 <path
61 android:fillColor="#00000000"
62 android:pathData="M0,9L108,9"
63 android:strokeColor="#33FFFFFF"
64 android:strokeWidth="0.8" />
65 <path
66 android:fillColor="#00000000"
67 android:pathData="M0,19L108,19"
68 android:strokeColor="#33FFFFFF"
69 android:strokeWidth="0.8" />
70 <path
71 android:fillColor="#00000000"
72 android:pathData="M0,29L108,29"
73 android:strokeColor="#33FFFFFF"
74 android:strokeWidth="0.8" />
75 <path
76 android:fillColor="#00000000"
77 android:pathData="M0,39L108,39"
78 android:strokeColor="#33FFFFFF"
79 android:strokeWidth="0.8" />
80 <path
81 android:fillColor="#00000000"
82 android:pathData="M0,49L108,49"
83 android:strokeColor="#33FFFFFF"
84 android:strokeWidth="0.8" />
85 <path
86 android:fillColor="#00000000"
87 android:pathData="M0,59L108,59"
88 android:strokeColor="#33FFFFFF"
89 android:strokeWidth="0.8" />
90 <path
91 android:fillColor="#00000000"
92 android:pathData="M0,69L108,69"
93 android:strokeColor="#33FFFFFF"
94 android:strokeWidth="0.8" />
95 <path
96 android:fillColor="#00000000"
97 android:pathData="M0,79L108,79"
98 android:strokeColor="#33FFFFFF"
99 android:strokeWidth="0.8" />
100 <path
101 android:fillColor="#00000000"
102 android:pathData="M0,89L108,89"
103 android:strokeColor="#33FFFFFF"
104 android:strokeWidth="0.8" />
105 <path
106 android:fillColor="#00000000"
107 android:pathData="M0,99L108,99"
108 android:strokeColor="#33FFFFFF"
109 android:strokeWidth="0.8" />
110 <path
111 android:fillColor="#00000000"
112 android:pathData="M19,29L89,29"
113 android:strokeColor="#33FFFFFF"
114 android:strokeWidth="0.8" />
115 <path
116 android:fillColor="#00000000"
117 android:pathData="M19,39L89,39"
118 android:strokeColor="#33FFFFFF"
119 android:strokeWidth="0.8" />
120 <path
121 android:fillColor="#00000000"
122 android:pathData="M19,49L89,49"
123 android:strokeColor="#33FFFFFF"
124 android:strokeWidth="0.8" />
125 <path
126 android:fillColor="#00000000"
127 android:pathData="M19,59L89,59"
128 android:strokeColor="#33FFFFFF"
129 android:strokeWidth="0.8" />
130 <path
131 android:fillColor="#00000000"
132 android:pathData="M19,69L89,69"
133 android:strokeColor="#33FFFFFF"
134 android:strokeWidth="0.8" />
135 <path
136 android:fillColor="#00000000"
137 android:pathData="M19,79L89,79"
138 android:strokeColor="#33FFFFFF"
139 android:strokeWidth="0.8" />
140 <path
141 android:fillColor="#00000000"
142 android:pathData="M29,19L29,89"
143 android:strokeColor="#33FFFFFF"
144 android:strokeWidth="0.8" />
145 <path
146 android:fillColor="#00000000"
147 android:pathData="M39,19L39,89"
148 android:strokeColor="#33FFFFFF"
149 android:strokeWidth="0.8" />
150 <path
151 android:fillColor="#00000000"
152 android:pathData="M49,19L49,89"
153 android:strokeColor="#33FFFFFF"
154 android:strokeWidth="0.8" />
155 <path
156 android:fillColor="#00000000"
157 android:pathData="M59,19L59,89"
158 android:strokeColor="#33FFFFFF"
159 android:strokeWidth="0.8" />
160 <path
161 android:fillColor="#00000000"
162 android:pathData="M69,19L69,89"
163 android:strokeColor="#33FFFFFF"
164 android:strokeWidth="0.8" />
165 <path
166 android:fillColor="#00000000"
167 android:pathData="M79,19L79,89"
168 android:strokeColor="#33FFFFFF"
169 android:strokeWidth="0.8" />
170 </vector>
1 <?xml version="1.0" encoding="utf-8"?>
2 <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 xmlns:tools="http://schemas.android.com/tools"
5 android:layout_width="match_parent"
6 android:layout_height="match_parent"
7 tools:context="com.pashanhoo.landsurvey.MainActivity">
8
9 <android.support.design.widget.AppBarLayout
10 android:layout_width="match_parent"
11 android:layout_height="wrap_content"
12 android:theme="@style/AppTheme.AppBarOverlay">
13
14 <android.support.v7.widget.Toolbar
15 android:id="@+id/toolbar"
16 android:layout_width="match_parent"
17 android:layout_height="?attr/actionBarSize"
18 android:background="?attr/colorPrimary"
19 app:navigationIcon="@android:drawable/ic_dialog_map"
20 app:popupTheme="@style/AppTheme.PopupOverlay" />
21
22 </android.support.design.widget.AppBarLayout>
23
24 <include layout="@layout/content_main" />
25 <android.support.v7.widget.LinearLayoutCompat
26 android:layout_width="wrap_content"
27 android:layout_height="match_parent"
28 android:orientation="vertical"
29 android:layout_marginTop="76dp"
30 android:layout_marginRight="16dp"
31 android:layout_marginBottom="16dp"
32 android:layout_gravity="top|end">
33 <android.support.design.widget.FloatingActionButton
34 android:id="@+id/zoomin"
35 android:layout_width="wrap_content"
36 android:layout_height="wrap_content"
37 android:layout_gravity="top|end"
38 android:layout_marginTop="0dp"
39 android:layout_marginRight="0dp"
40 app:srcCompat="@mipmap/ic_zoom_in_white_48dp" />
41 <android.support.design.widget.FloatingActionButton
42 android:id="@+id/zoomout"
43 android:layout_width="wrap_content"
44 android:layout_height="wrap_content"
45 android:layout_gravity="top|end"
46 android:layout_marginTop="16dp"
47 android:layout_marginRight="0dp"
48 app:srcCompat="@mipmap/ic_zoom_out_white_48dp" />
49 <android.support.design.widget.FloatingActionButton
50 android:id="@+id/gps"
51 android:layout_width="wrap_content"
52 android:layout_height="wrap_content"
53 android:layout_gravity="top|end"
54 android:layout_marginTop="16dp"
55 android:layout_marginRight="0dp"
56 app:srcCompat="@mipmap/ic_my_location_white_48dp" />
57 <android.support.design.widget.FloatingActionButton
58 android:id="@+id/fullmap"
59 android:layout_width="wrap_content"
60 android:layout_height="wrap_content"
61 android:layout_gravity="top|end"
62 android:layout_marginTop="16dp"
63 android:layout_marginRight="0dp"
64 app:srcCompat="@mipmap/ic_home_white_48dp" />
65 </android.support.v7.widget.LinearLayoutCompat>
66
67
68 </android.support.design.widget.CoordinatorLayout>
1 <?xml version="1.0" encoding="utf-8"?>
2 <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 xmlns:tools="http://schemas.android.com/tools"
5 android:layout_width="match_parent"
6 android:layout_height="match_parent"
7 app:layout_behavior="@string/appbar_scrolling_view_behavior"
8 tools:context="com.pashanhoo.landsurvey.MainActivity"
9 tools:showIn="@layout/activity_main">
10
11 <com.esri.android.map.MapView
12 android:id="@+id/map"
13 android:layout_width="fill_parent"
14 android:layout_height="fill_parent"></com.esri.android.map.MapView>
15
16 </android.support.constraint.ConstraintLayout>
1 <menu xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:app="http://schemas.android.com/apk/res-auto"
3 xmlns:tools="http://schemas.android.com/tools"
4 tools:context="com.pashanhoo.landsurvey.MainActivity">
5 <item
6 android:id="@+id/action_settings"
7 android:orderInCategory="100"
8 android:icon="@mipmap/ic_layers_white_48dp"
9 android:title="@string/action_settings"
10 app:showAsAction="always" >
11 <menu>
12
13 </menu>
14 </item>
15 </menu>
1 <?xml version="1.0" encoding="utf-8"?>
2 <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3 <background android:drawable="@drawable/ic_launcher_background" />
4 <foreground android:drawable="@drawable/ic_launcher_foreground" />
5 </adaptive-icon>
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="utf-8"?>
2 <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3 <background android:drawable="@drawable/ic_launcher_background" />
4 <foreground android:drawable="@drawable/ic_launcher_foreground" />
5 </adaptive-icon>
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="utf-8"?>
2 <resources>
3 <color name="colorPrimary">#3F51B5</color>
4 <color name="colorPrimaryDark">#303F9F</color>
5 <color name="colorAccent">#FF4081</color>
6 </resources>
1 <resources>
2 <dimen name="fab_margin">16dp</dimen>
3 </resources>
1 <resources>
2 <string name="app_name">土地监察</string>
3 <string name="action_settings">切换图层</string>
4 </resources>
1 <resources>
2
3 <!-- Base application theme. -->
4 <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
5 <!-- Customize your theme here. -->
6 <item name="colorPrimary">@color/colorPrimary</item>
7 <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
8 <item name="colorAccent">@color/colorAccent</item>
9 </style>
10
11 <style name="AppTheme.NoActionBar">
12 <item name="windowActionBar">false</item>
13 <item name="windowNoTitle">true</item>
14 </style>
15
16 <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
17
18 <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
19
20 </resources>
1 package com.pashanhoo.landsurvey;
2
3 import org.junit.Test;
4
5 import static org.junit.Assert.*;
6
7 /**
8 * Example local unit test, which will execute on the development machine (host).
9 *
10 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
11 */
12 public class ExampleUnitTest {
13 @Test
14 public void addition_isCorrect() throws Exception {
15 assertEquals(4, 2 + 2);
16 }
17 }
...\ No newline at end of file ...\ No newline at end of file
1 // Top-level build file where you can add configuration options common to all sub-projects/modules.
2
3 buildscript {
4
5 repositories {
6 google()
7 jcenter()
8 }
9 dependencies {
10 classpath 'com.android.tools.build:gradle:3.0.1'
11
12
13 // NOTE: Do not place your application dependencies here; they belong
14 // in the individual module build.gradle files
15 }
16 }
17
18 allprojects {
19 repositories {
20 google()
21 jcenter()
22 maven {
23 url 'https://esri.bintray.com/arcgis'
24 }
25 maven {
26 url 'https://jitpack.io'
27 }
28 }
29 }
30
31 task clean(type: Delete) {
32 delete rootProject.buildDir
33 }
1 # Project-wide Gradle settings.
2
3 # IDE (e.g. Android Studio) users:
4 # Gradle settings configured through the IDE *will override*
5 # any settings specified in this file.
6
7 # For more details on how to configure your build environment visit
8 # http://www.gradle.org/docs/current/userguide/build_environment.html
9
10 # Specifies the JVM arguments used for the daemon process.
11 # The setting is particularly useful for tweaking memory settings.
12 org.gradle.jvmargs=-Xmx1536m
13
14 # When configured, Gradle will run in incubating parallel mode.
15 # This option should only be used with decoupled projects. More details, visit
16 # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 # org.gradle.parallel=true
No preview for this file type
1 #Fri Mar 23 21:53:12 CST 2018
2 distributionBase=GRADLE_USER_HOME
3 distributionPath=wrapper/dists
4 zipStoreBase=GRADLE_USER_HOME
5 zipStorePath=wrapper/dists
6 distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
1 #!/usr/bin/env bash
2
3 ##############################################################################
4 ##
5 ## Gradle start up script for UN*X
6 ##
7 ##############################################################################
8
9 # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 DEFAULT_JVM_OPTS=""
11
12 APP_NAME="Gradle"
13 APP_BASE_NAME=`basename "$0"`
14
15 # Use the maximum available, or set MAX_FD != -1 to use that value.
16 MAX_FD="maximum"
17
18 warn ( ) {
19 echo "$*"
20 }
21
22 die ( ) {
23 echo
24 echo "$*"
25 echo
26 exit 1
27 }
28
29 # OS specific support (must be 'true' or 'false').
30 cygwin=false
31 msys=false
32 darwin=false
33 case "`uname`" in
34 CYGWIN* )
35 cygwin=true
36 ;;
37 Darwin* )
38 darwin=true
39 ;;
40 MINGW* )
41 msys=true
42 ;;
43 esac
44
45 # Attempt to set APP_HOME
46 # Resolve links: $0 may be a link
47 PRG="$0"
48 # Need this for relative symlinks.
49 while [ -h "$PRG" ] ; do
50 ls=`ls -ld "$PRG"`
51 link=`expr "$ls" : '.*-> \(.*\)$'`
52 if expr "$link" : '/.*' > /dev/null; then
53 PRG="$link"
54 else
55 PRG=`dirname "$PRG"`"/$link"
56 fi
57 done
58 SAVED="`pwd`"
59 cd "`dirname \"$PRG\"`/" >/dev/null
60 APP_HOME="`pwd -P`"
61 cd "$SAVED" >/dev/null
62
63 CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64
65 # Determine the Java command to use to start the JVM.
66 if [ -n "$JAVA_HOME" ] ; then
67 if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 # IBM's JDK on AIX uses strange locations for the executables
69 JAVACMD="$JAVA_HOME/jre/sh/java"
70 else
71 JAVACMD="$JAVA_HOME/bin/java"
72 fi
73 if [ ! -x "$JAVACMD" ] ; then
74 die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75
76 Please set the JAVA_HOME variable in your environment to match the
77 location of your Java installation."
78 fi
79 else
80 JAVACMD="java"
81 which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82
83 Please set the JAVA_HOME variable in your environment to match the
84 location of your Java installation."
85 fi
86
87 # Increase the maximum file descriptors if we can.
88 if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 MAX_FD_LIMIT=`ulimit -H -n`
90 if [ $? -eq 0 ] ; then
91 if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 MAX_FD="$MAX_FD_LIMIT"
93 fi
94 ulimit -n $MAX_FD
95 if [ $? -ne 0 ] ; then
96 warn "Could not set maximum file descriptor limit: $MAX_FD"
97 fi
98 else
99 warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 fi
101 fi
102
103 # For Darwin, add options to specify how the application appears in the dock
104 if $darwin; then
105 GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 fi
107
108 # For Cygwin, switch paths to Windows format before running java
109 if $cygwin ; then
110 APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 JAVACMD=`cygpath --unix "$JAVACMD"`
113
114 # We build the pattern for arguments to be converted via cygpath
115 ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 SEP=""
117 for dir in $ROOTDIRSRAW ; do
118 ROOTDIRS="$ROOTDIRS$SEP$dir"
119 SEP="|"
120 done
121 OURCYGPATTERN="(^($ROOTDIRS))"
122 # Add a user-defined pattern to the cygpath arguments
123 if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 fi
126 # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 i=0
128 for arg in "$@" ; do
129 CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131
132 if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 else
135 eval `echo args$i`="\"$arg\""
136 fi
137 i=$((i+1))
138 done
139 case $i in
140 (0) set -- ;;
141 (1) set -- "$args0" ;;
142 (2) set -- "$args0" "$args1" ;;
143 (3) set -- "$args0" "$args1" "$args2" ;;
144 (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 esac
151 fi
152
153 # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 function splitJvmOpts() {
155 JVM_OPTS=("$@")
156 }
157 eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159
160 exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
1 @if "%DEBUG%" == "" @echo off
2 @rem ##########################################################################
3 @rem
4 @rem Gradle startup script for Windows
5 @rem
6 @rem ##########################################################################
7
8 @rem Set local scope for the variables with windows NT shell
9 if "%OS%"=="Windows_NT" setlocal
10
11 @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 set DEFAULT_JVM_OPTS=
13
14 set DIRNAME=%~dp0
15 if "%DIRNAME%" == "" set DIRNAME=.
16 set APP_BASE_NAME=%~n0
17 set APP_HOME=%DIRNAME%
18
19 @rem Find java.exe
20 if defined JAVA_HOME goto findJavaFromJavaHome
21
22 set JAVA_EXE=java.exe
23 %JAVA_EXE% -version >NUL 2>&1
24 if "%ERRORLEVEL%" == "0" goto init
25
26 echo.
27 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 echo.
29 echo Please set the JAVA_HOME variable in your environment to match the
30 echo location of your Java installation.
31
32 goto fail
33
34 :findJavaFromJavaHome
35 set JAVA_HOME=%JAVA_HOME:"=%
36 set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
38 if exist "%JAVA_EXE%" goto init
39
40 echo.
41 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 echo.
43 echo Please set the JAVA_HOME variable in your environment to match the
44 echo location of your Java installation.
45
46 goto fail
47
48 :init
49 @rem Get command-line arguments, handling Windowz variants
50
51 if not "%OS%" == "Windows_NT" goto win9xME_args
52 if "%@eval[2+2]" == "4" goto 4NT_args
53
54 :win9xME_args
55 @rem Slurp the command line arguments.
56 set CMD_LINE_ARGS=
57 set _SKIP=2
58
59 :win9xME_args_slurp
60 if "x%~1" == "x" goto execute
61
62 set CMD_LINE_ARGS=%*
63 goto execute
64
65 :4NT_args
66 @rem Get arguments from the 4NT Shell from JP Software
67 set CMD_LINE_ARGS=%$
68
69 :execute
70 @rem Setup the command line
71
72 set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73
74 @rem Execute Gradle
75 "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76
77 :end
78 @rem End local scope for the variables with windows NT shell
79 if "%ERRORLEVEL%"=="0" goto mainEnd
80
81 :fail
82 rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 rem the _cmd.exe /c_ return code!
84 if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 exit /b 1
86
87 :mainEnd
88 if "%OS%"=="Windows_NT" endlocal
89
90 :omega
1 include ':app'