1.增加搜索相关功能业务2.解决下载omdb后不及时渲染问题3.增加按任务及link关联渲染业务4.接口中增加按任务查询条件
This commit is contained in:
@@ -55,6 +55,10 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
realm {
|
||||
syncEnabled = true
|
||||
}
|
||||
|
||||
//configurations.all {
|
||||
// resolutionStrategy {
|
||||
// force 'com.intellij:annotations:13.0'
|
||||
|
||||
@@ -1813,5 +1813,4 @@
|
||||
</m>
|
||||
|
||||
</m>
|
||||
|
||||
</rendertheme>
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.navinfo.collect.library.map.handler
|
||||
|
||||
import android.util.Log
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||
import com.navinfo.collect.library.map.NIMapView
|
||||
import io.realm.Realm
|
||||
import org.oscim.core.BoundingBox
|
||||
import org.oscim.core.GeoPoint
|
||||
import org.oscim.core.MapPosition
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
package com.navinfo.collect.library.map.handler
|
||||
|
||||
import android.util.Log
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||
import com.navinfo.collect.library.map.NIMapView
|
||||
import com.navinfo.collect.library.map.source.MapLifeNiLocationTileSource
|
||||
import com.navinfo.collect.library.map.source.NavinfoMultiMapFileTileSource
|
||||
import com.navinfo.collect.library.map.source.OMDBReferenceTileSource
|
||||
import com.navinfo.collect.library.map.source.OMDBTileSource
|
||||
import com.navinfo.collect.library.system.Constant
|
||||
import io.realm.Realm
|
||||
import okhttp3.Cache
|
||||
import okhttp3.OkHttpClient
|
||||
import org.oscim.android.theme.AssetsRenderTheme
|
||||
import org.oscim.layers.GroupLayer
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer
|
||||
@@ -131,6 +135,39 @@ class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView, traceP
|
||||
if (omdbLabelLayer != null) {
|
||||
addLayer(omdbLabelLayer, NIMapView.LAYER_GROUPS.LABEL)
|
||||
}
|
||||
}
|
||||
|
||||
private fun resetOMDBVectorTileLayer() {
|
||||
|
||||
if (omdbReferenceTileLayer != null) {
|
||||
removeLayer(omdbReferenceTileLayer)
|
||||
}
|
||||
|
||||
if (omdbReferenceLabelLayer != null) {
|
||||
removeLayer(omdbReferenceLabelLayer)
|
||||
}
|
||||
|
||||
if (omdbVectorTileLayer != null) {
|
||||
removeLayer(omdbVectorTileLayer)
|
||||
}
|
||||
if (omdbLabelLayer != null) {
|
||||
removeLayer(omdbLabelLayer)
|
||||
}
|
||||
|
||||
mMapView.vtmMap.updateMap(true)
|
||||
|
||||
Log.e("qj", "重新加载")
|
||||
}
|
||||
|
||||
public fun updateOMDBVectorTileLayer(){
|
||||
|
||||
omdbTileSource.update()
|
||||
|
||||
omdbReferenceTileSource.update()
|
||||
|
||||
mMapView.vtmMap.setTheme(AssetsRenderTheme(mMapView.context.assets, "", "editormarker.xml"), true)
|
||||
|
||||
mMapView.vtmMap.updateMap(true)
|
||||
|
||||
}
|
||||
|
||||
@@ -215,13 +252,6 @@ class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView, traceP
|
||||
vectorNiLocationTileLayer.isEnabled = false
|
||||
labelNiLocationLayer.isEnabled = false
|
||||
}
|
||||
|
||||
fun omdbLayersClear(){
|
||||
// omdbVectorTileLayer.
|
||||
// omdbReferenceTileLayer.
|
||||
omdbLabelLayer.clearLabels()
|
||||
omdbReferenceLabelLayer.clearLabels()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.navinfo.collect.library.data.entity.ReferenceEntity;
|
||||
import com.navinfo.collect.library.system.Constant;
|
||||
import com.navinfo.collect.library.utils.RealmDBParamUtils;
|
||||
|
||||
import org.oscim.layers.tile.MapTile;
|
||||
import org.oscim.tiling.ITileDataSink;
|
||||
@@ -19,6 +20,8 @@ import io.realm.Realm;
|
||||
import io.realm.RealmQuery;
|
||||
|
||||
public class OMDBReferenceDataSource implements ITileDataSource {
|
||||
private boolean isUpdate;
|
||||
|
||||
private final ThreadLocal<OMDBReferenceDecoder> mThreadLocalDecoders = new ThreadLocal<OMDBReferenceDecoder>() {
|
||||
@Override
|
||||
protected OMDBReferenceDecoder initialValue() {
|
||||
@@ -36,9 +39,12 @@ public class OMDBReferenceDataSource implements ITileDataSource {
|
||||
int xEnd = (int) ((tile.tileX + 1) << m);
|
||||
int yStart = (int) tile.tileY << m;
|
||||
int yEnd = (int) ((tile.tileY + 1) << m);
|
||||
Log.e("jingo", Constant.TASK_ID + " " + xStart + " " + xEnd + " " + yStart + " " + yEnd);
|
||||
if(isUpdate){
|
||||
Realm.getDefaultInstance().refresh();
|
||||
isUpdate = false;
|
||||
}
|
||||
RealmQuery<ReferenceEntity> realmQuery = Realm.getDefaultInstance().where(ReferenceEntity.class)
|
||||
.rawPredicate("taskId=" + Constant.TASK_ID + " and tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd + " and enable>=1");
|
||||
.rawPredicate("taskId="+RealmDBParamUtils.getTaskId() +" and tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd + " and enable>=1" );
|
||||
// 筛选不显示的数据
|
||||
if (Constant.HAD_LAYER_INVISIABLE_ARRAY != null && Constant.HAD_LAYER_INVISIABLE_ARRAY.length > 0) {
|
||||
realmQuery.beginGroup();
|
||||
@@ -70,4 +76,9 @@ public class OMDBReferenceDataSource implements ITileDataSource {
|
||||
Realm.getDefaultInstance().cancelTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
public void update(){
|
||||
isUpdate = true;
|
||||
Log.e("qj",Thread.currentThread().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
package com.navinfo.collect.library.map.source;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.navinfo.collect.library.data.entity.RenderEntity;
|
||||
import com.navinfo.collect.library.system.Constant;
|
||||
|
||||
import org.oscim.tiling.ITileDataSource;
|
||||
import org.oscim.tiling.OverzoomTileDataSource;
|
||||
import org.oscim.tiling.TileSource;
|
||||
|
||||
public class OMDBReferenceTileSource extends TileSource {
|
||||
import io.realm.Realm;
|
||||
|
||||
public class OMDBReferenceTileSource extends RealmDBTileSource {
|
||||
private OMDBReferenceDataSource omdbReferenceTileSource = new OMDBReferenceDataSource();
|
||||
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
//return new OverzoomTileDataSource(new OMDBReferenceDataSource(), Constant.OVER_ZOOM);
|
||||
return new OMDBReferenceDataSource();
|
||||
return omdbReferenceTileSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -23,4 +29,10 @@ public class OMDBReferenceTileSource extends TileSource {
|
||||
public void close() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
omdbReferenceTileSource.update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.navinfo.collect.library.data.RealmUtils;
|
||||
import com.navinfo.collect.library.data.entity.GeometryFeatureEntity;
|
||||
import com.navinfo.collect.library.data.entity.RenderEntity;
|
||||
import com.navinfo.collect.library.system.Constant;
|
||||
import com.navinfo.collect.library.utils.RealmDBParamUtils;
|
||||
|
||||
import org.oscim.layers.tile.MapTile;
|
||||
import org.oscim.tiling.ITileDataSink;
|
||||
@@ -21,6 +22,7 @@ import io.realm.Realm;
|
||||
import io.realm.RealmQuery;
|
||||
|
||||
public class OMDBTileDataSource implements ITileDataSource {
|
||||
private boolean isUpdate;
|
||||
private final ThreadLocal<OMDBDataDecoder> mThreadLocalDecoders = new ThreadLocal<OMDBDataDecoder>() {
|
||||
@Override
|
||||
protected OMDBDataDecoder initialValue() {
|
||||
@@ -38,8 +40,11 @@ public class OMDBTileDataSource implements ITileDataSource {
|
||||
int xEnd = (int) ((tile.tileX + 1) << m);
|
||||
int yStart = (int) tile.tileY << m;
|
||||
int yEnd = (int) ((tile.tileY + 1) << m);
|
||||
Log.e("jingo", Constant.TASK_ID + " " + xStart + " " + xEnd + " " + yStart + " " + yEnd);
|
||||
RealmQuery<RenderEntity> realmQuery = Realm.getDefaultInstance().where(RenderEntity.class).rawPredicate("tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd + " and enable>=1");
|
||||
if(isUpdate){
|
||||
Realm.getDefaultInstance().refresh();
|
||||
isUpdate = false;
|
||||
}
|
||||
RealmQuery<RenderEntity> realmQuery = Realm.getDefaultInstance().where(RenderEntity.class).rawPredicate("taskId ="+RealmDBParamUtils.getTaskId() +" and tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd + " and enable>=1");
|
||||
// 筛选不显示的数据
|
||||
if (Constant.HAD_LAYER_INVISIABLE_ARRAY != null && Constant.HAD_LAYER_INVISIABLE_ARRAY.length > 0) {
|
||||
realmQuery.beginGroup();
|
||||
@@ -53,9 +58,8 @@ public class OMDBTileDataSource implements ITileDataSource {
|
||||
Log.e("qj", "查询数据==" + listResult.size() + "==地图级别" + tile.zoomLevel);
|
||||
mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult);
|
||||
}
|
||||
Log.e("jingo",listResult.size() + "条数据 主");
|
||||
Log.e("jingo", listResult.size() + "条数据 主");
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
// Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString());
|
||||
} else {
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
}
|
||||
@@ -72,4 +76,9 @@ public class OMDBTileDataSource implements ITileDataSource {
|
||||
Realm.getDefaultInstance().cancelTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
public void update(){
|
||||
isUpdate = true;
|
||||
Log.e("qj",Thread.currentThread().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,27 @@
|
||||
package com.navinfo.collect.library.map.source;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.navinfo.collect.library.data.entity.RenderEntity;
|
||||
import com.navinfo.collect.library.system.Constant;
|
||||
|
||||
import org.oscim.tiling.ITileDataSource;
|
||||
import org.oscim.tiling.OverzoomTileDataSource;
|
||||
import org.oscim.tiling.TileSource;
|
||||
|
||||
public class OMDBTileSource extends TileSource {
|
||||
import io.realm.Realm;
|
||||
|
||||
public class OMDBTileSource extends RealmDBTileSource {
|
||||
private OMDBTileDataSource omdbTileSource = new OMDBTileDataSource();
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
// return new OverzoomTileDataSource(new OMDBTileDataSource(), Constant.OVER_ZOOM);
|
||||
return new OMDBTileDataSource();
|
||||
return omdbTileSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpenResult open() {
|
||||
Log.d("qj", Realm.getDefaultInstance().where(RenderEntity.class).findAll().size()+"open安装数量");
|
||||
return OpenResult.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -23,4 +29,10 @@ public class OMDBTileSource extends TileSource {
|
||||
public void close() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
omdbTileSource.update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,4 +25,7 @@ public class RealmDBTileSource extends TileSource {
|
||||
public void close() {
|
||||
|
||||
}
|
||||
|
||||
public void update(){
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,10 @@ public class Constant {
|
||||
}
|
||||
|
||||
public static String[] HAD_LAYER_INVISIABLE_ARRAY;
|
||||
public static final int OVER_ZOOM = 22;
|
||||
public static final int MAX_ZOOM = 22;
|
||||
public static final int OMDB_MIN_ZOOM = 16;
|
||||
public static final int OVER_ZOOM = 20;
|
||||
public static final int MAX_ZOOM = 20;
|
||||
public static final int OMDB_MIN_ZOOM = 15;
|
||||
|
||||
public static int TASK_ID = -1;
|
||||
/**
|
||||
* 服务器地址
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.navinfo.collect.library.utils;
|
||||
|
||||
public class RealmDBParamUtils {
|
||||
private static int mtaskId = -1;
|
||||
|
||||
public static int getTaskId() {
|
||||
return mtaskId;
|
||||
}
|
||||
|
||||
public static void setTaskId(int taskId) {
|
||||
mtaskId = taskId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user