Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS

 Conflicts:
	collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceDataSource.java
	collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBTileDataSource.java
	vtm
This commit is contained in:
squallzhjch
2023-08-11 14:30:42 +08:00
28 changed files with 600 additions and 296 deletions

View File

@@ -1956,15 +1956,15 @@
</m>
<!-- 路口 -->
<m v="OMDB_INTERSECTION">
<!-- <m k="type" v="node">-->
<!-- <symbol src="assets:symbols/dot_blue_dark.svg"></symbol>-->
<!-- </m>-->
<!-- <m k="intersectionPid">-->
<!-- <symbol src="assets:symbols/dot_magenta.svg"></symbol>-->
<!-- </m>-->
<m k="geometry">
<symbol src="@typesrc"></symbol>
<m k="type" v="node">
<symbol src="assets:symbols/dot_blue_dark.svg"></symbol>
</m>
<m k="intersectionPid">
<symbol src="assets:symbols/dot_magenta.svg"></symbol>
</m>
<!-- <m k="geometry">
<symbol src="@typesrc"></symbol>
</m>-->
</m>
<!--车道中心线-->
@@ -2036,13 +2036,20 @@
</m>
<m k="boundaryType" v="1">
<!--无标线无可区分边界-->
<line dasharray="12,6" repeat-start="0" stroke="#ffffff" width="0.2"/>
<line dasharray="5,5" repeat-start="0" stroke="#ffffff" width="0.2"/>
</m>
</m>
<!-- 车道边界类型 -->
<m v="OMDB_LANE_MARK_BOUNDARYTYPE">
<outline-layer id="boundary" stroke="#ffffff" width="0.1" />
<!--只区分虚线与实线-->
<m k="boundaryType" v="1">
<line dasharray="5,5" repeat-start="5" stroke="#90A0BD" width="0.05"/>
</m>
<m k="boundaryType" v="2">
<!--标线-->
<m k="markType" v="0|1|4|5|6|7|8">
@@ -2072,22 +2079,22 @@
<!--其他|实线-->
<m k="markColor" v="1">
<line dasharray="12,6" repeat-start="0" stroke="#ffffff" width="0.1"/>
<line dasharray="5,5" repeat-start="0" stroke="#ffffff" width="0.1"/>
</m>
<m k="markColor" v="2">
<line dasharray="12,6" repeat-start="0" stroke="#eccc68" width="0.1"/>
<line dasharray="5,5" repeat-start="0" stroke="#eccc68" width="0.1"/>
</m>
<m k="markColor" v="6">
<line dasharray="12,6" repeat-start="0" stroke="#0000ff" width="0.1"/>
<line dasharray="5,5" repeat-start="0" stroke="#0000ff" width="0.1"/>
</m>
<m k="markColor" v="7">
<line dasharray="12,6" repeat-start="0" stroke="#00ff00" width="0.1"/>
<line dasharray="5,5" repeat-start="0" stroke="#00ff00" width="0.1"/>
</m>
<m k="markColor" v="0|9">
<line dasharray="12,6" repeat-start="0" stroke="#8e44ad" width="0.1"/>
<line dasharray="5,5" repeat-start="0" stroke="#8e44ad" width="0.1"/>
</m>
</m>
@@ -2097,10 +2104,6 @@
<m k="boundaryType" v="0|3|4|5|6|7|8|9">
<line stroke="#ffffff" use="boundaryType" />
</m>
<!--只区分虚线与实线-->
<m k="boundaryType" v="1">
<line dasharray="12,6" repeat-start="0" stroke="#ffffff" width="0.1"/>
</m>
</m>
<!--常规点限速-->

View File

@@ -1813,5 +1813,4 @@
</m>
</m>
</rendertheme>

View File

@@ -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

View File

@@ -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()
}
}

View File

@@ -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,8 +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);
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();
@@ -68,4 +75,9 @@ public class OMDBReferenceDataSource implements ITileDataSource {
Realm.getDefaultInstance().cancelTransaction();
}
}
public void update(){
isUpdate = true;
Log.e("qj",Thread.currentThread().getName());
}
}

View File

@@ -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();
}
}

View File

@@ -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,7 +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);
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();
@@ -68,4 +74,9 @@ public class OMDBTileDataSource implements ITileDataSource {
Realm.getDefaultInstance().cancelTransaction();
}
}
public void update(){
isUpdate = true;
Log.e("qj",Thread.currentThread().getName());
}
}

View File

@@ -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();
}
}

View File

@@ -25,4 +25,7 @@ public class RealmDBTileSource extends TileSource {
public void close() {
}
public void update(){
}
}

View File

@@ -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;
/**
* 服务器地址
*/

View File

@@ -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;
}
}