4c1f987a by chiangbt

update 3.28

1 parent 8b3ceed3
......@@ -57,8 +57,6 @@ public class MainActivity extends AppCompatActivity {
private TextView mapinfoView;
// 浮动查询条
private FloatingSearchView floatingSearchView;
// 当前地图层级
private int curLevel = 0;
// 地图类型名称
private String mapType;
......@@ -86,9 +84,10 @@ public class MainActivity extends AppCompatActivity {
locationDisplayManager.stop();
}
// 保证地图级别小于20
if (curLevel < 20) {
if (t_vec.getCurrentLevel() < 20) {
mapView.zoomin(true);
}
mapinfoView.setText("当前地图级别为:" + String.valueOf(t_vec.getCurrentLevel()));
}
});
// 缩小按钮
......@@ -100,9 +99,10 @@ public class MainActivity extends AppCompatActivity {
locationDisplayManager.stop();
}
// 保证地图级别大于0
if (curLevel > 0) {
if (t_vec.getCurrentLevel() > 0) {
mapView.zoomout(true);
}
mapinfoView.setText("当前地图级别为:" + String.valueOf(t_vec.getCurrentLevel()));
}
});
// 回到初始页面
......@@ -114,8 +114,7 @@ public class MainActivity extends AppCompatActivity {
graphicsLayer.removeAll();
// 恢复初始设置地图范围
mapView.zoomToResolution(AppInfo.initPoint, AppInfo.initRes);
curLevel = TDTTileinfo.getCurrentLevel(AppInfo.initRes);
mapinfoView.setText("当前地图级别为:" + String.valueOf(curLevel));
mapinfoView.setText("当前地图级别为:" + String.valueOf(t_vec.getCurrentLevel()));
}
});
// GPS按钮
......@@ -129,6 +128,7 @@ public class MainActivity extends AppCompatActivity {
} else {
locationDisplayManager.start();
mapView.zoomToResolution(locationDisplayManager.getPoint(), t_vec.getRes()[18]);
mapinfoView.setText("当前地图级别为:" + String.valueOf(t_vec.getCurrentLevel()));
}
}
});
......@@ -172,7 +172,7 @@ public class MainActivity extends AppCompatActivity {
graphicsLayer = new GraphicsLayer();
mapView.addLayer(graphicsLayer);
// 设置地图的最小和最大分辨率
mapView.setMaxResolution(t_vec.getRes()[1]);
mapView.setMaxResolution(t_vec.getRes()[2]);
mapView.setMinResolution(t_vec.getRes()[19]);
// 监听地图状态变化事件
mapView.setOnStatusChangedListener(new OnStatusChangedListener() {
......@@ -183,8 +183,7 @@ public class MainActivity extends AppCompatActivity {
// 刚刚打开时,将地图缩放到指定位置及层级
if (status == STATUS.INITIALIZED) {
mapView.zoomToResolution(AppInfo.initPoint, AppInfo.initRes);
curLevel = TDTTileinfo.getCurrentLevel(AppInfo.initRes);
mapinfoView.setText("当前地图级别为:" + String.valueOf(curLevel));
mapinfoView.setText("当前地图级别为:" + String.valueOf(t_vec.getCurrentLevel()));
}
}
});
......@@ -195,10 +194,9 @@ public class MainActivity extends AppCompatActivity {
@Override
public void postAction(float v, float v1, double v2) {
curLevel = TDTTileinfo.getCurrentLevel(mapView.getResolution());
mapinfoView.setText("当前地图级别为:" + String.valueOf(curLevel));
mapinfoView.setText("当前地图级别为:" + String.valueOf(t_vec.getCurrentLevel()));
// t_local只有8和9级数据
if (curLevel > 9 | curLevel < 8) {
if (t_vec.getCurrentLevel() > 9 | t_vec.getCurrentLevel() < 8) {
t_local.setVisible(false);
} else {
t_local.setVisible(true);
......@@ -215,7 +213,7 @@ public class MainActivity extends AppCompatActivity {
@Override
public void onLocationChanged(Location location) {
mapView.zoomToResolution(new Point(location.getLongitude(), location.getLatitude()), t_vec.getRes()[18]);
mapinfoView.setText("当前地图级别为:18");
mapinfoView.setText("当前地图级别为:" + t_vec.getCurrentLevel());
}
@Override
......@@ -242,8 +240,7 @@ public class MainActivity extends AppCompatActivity {
mapView.zoomToResolution(poipt, t_vec.getRes()[19]);
graphicsLayer.addGraphic(new Graphic(poipt,
new PictureMarkerSymbol(getResources().getDrawable(R.mipmap.locator)).setOffsetY(16)));
// floatingSearchView.clearSuggestions();
mapinfoView.setText("当前地图级别为:19");
mapinfoView.setText("当前地图级别为:"+ t_vec.getCurrentLevel());
}
@Override
......
......@@ -17,7 +17,6 @@ import com.esri.core.internal.io.handler.a;
import com.esri.core.io.UserCredentials;
import com.pashanhoo.landsurvey.utils.AppInfo;
import com.pashanhoo.landsurvey.utils.GADBHelper;
import com.pashanhoo.landsurvey.utils.GISHelper;
/**
* Created by jiangbotao on 2018/3/28.
......
......@@ -144,12 +144,4 @@ public class TDTTileinfo {
return tileHeight;
}
public static int getCurrentLevel(double resolution){
for(int i=0; i< res4490.length;i++){
if((res4490[i] -resolution)<0.00000001){
return i;
}
}
return 0;
}
}
......
package com.pashanhoo.landsurvey.layers.tianditu;
import android.content.res.Resources;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
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.R;
import com.pashanhoo.landsurvey.utils.AppInfo;
import java.util.concurrent.RejectedExecutionException;
......@@ -24,7 +17,59 @@ import java.util.concurrent.RejectedExecutionException;
public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer {
private TileInfo tiandituTileInfo;
private static final Point originalPoint = new Point(-180, 90);
private static final 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
};
private static final 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
};
private static final int levels = 21;
private static final int dpi = 96;
private static final int tileWidth = 256;
private static final int tileHeight = 256;
private String layername = "";
private SQLiteDatabase sqLiteDatabase;
......@@ -42,7 +87,6 @@ public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer {
final TianDiTuLocalTiledMapServiceLayer a;
{
a = TianDiTuLocalTiledMapServiceLayer.this;
//super();
......@@ -55,7 +99,7 @@ public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer {
protected void initLayer() {
this.buildTileInfo();
this.setTileInfo(new com.esri.android.map.TiledServiceLayer.TileInfo(originalPoint, scale, res, levels, dpi, tileWidth, tileHeight));
this.setFullExtent(new Envelope(-180, -90, 180, 90));
this.setDefaultSpatialReference(SpatialReference.create(4490)); //CGCS2000
//this.setDefaultSpatialReference(SpatialReference.create(4326));
......@@ -91,61 +135,4 @@ public class TianDiTuLocalTiledMapServiceLayer extends TiledServiceLayer {
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);
}
}
......
......@@ -9,15 +9,10 @@ import com.esri.core.geometry.Envelope;
import com.esri.core.geometry.Point;
import com.esri.core.geometry.SpatialReference;
import com.esri.core.internal.io.handler.ResponseListener;
import com.esri.core.internal.io.handler.a;
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.Random;
import java.util.concurrent.RejectedExecutionException;
......