bcfced97 by chiangbt

first commit

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