Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS
Conflicts: app/src/main/java/com/navinfo/omqs/ui/activity/map/MainViewModel.kt
This commit is contained in:
@@ -185,7 +185,7 @@
|
||||
width="0.1" />
|
||||
|
||||
<!--道路形态-->
|
||||
<style-line dasharray="8,2,2,2,2,2" id="road_morphology" repeat-gap="3" repeat-start="0" stroke="#1afa29" width="0.3" />
|
||||
<style-line dasharray="8,2,2,2,2,2" id="road_morphology" repeat-gap="3" repeat-start="0" stroke="#1afa29" width="0.4" />
|
||||
|
||||
<!--###### ASSIGNMENT ######-->
|
||||
|
||||
@@ -1491,41 +1491,48 @@
|
||||
</m>
|
||||
|
||||
<m k="qi_table">
|
||||
|
||||
<!-- 道路线 -->
|
||||
<m v="OMDB_RD_LINK">
|
||||
<line stroke="#9c9c9c" width="1" />
|
||||
<line stroke="#9c9c9c" width="0.5" />
|
||||
</m>
|
||||
|
||||
<!--道路种别-->
|
||||
<m v="OMDB_RD_LINK_KIND">
|
||||
<outline-layer id="kind0" stroke="#44000000" width="0.1" />
|
||||
<outline-layer id="kind1" stroke="#aa807040" width="0.1" />
|
||||
<outline-layer id="kind0" stroke="#44000000" width="0.8" fix="true"/>
|
||||
<outline-layer id="kind1" stroke="#aa807040" width="0.8" fix="true"/>
|
||||
|
||||
<m k="kind" v="1">
|
||||
<line blur="0.3" outline="kind0" use="highway:z11" />
|
||||
<line blur="0.3" outline="kind0" use="highway:z11" width="3.5" fix="true"/>
|
||||
</m>
|
||||
|
||||
<m k="kind" v="2|3">
|
||||
<line outline="kind0" use="trunk" />
|
||||
<line outline="kind0" use="trunk" fix="true" width="2.6"/>
|
||||
</m>
|
||||
<m k="kind" v="4">
|
||||
<line outline="kind0" use="primary:z11" />
|
||||
|
||||
<m k="kind" v="4">width="0.4"
|
||||
<line outline="kind0" use="primary:z11" fix="true" width="2.2"/>
|
||||
</m>
|
||||
|
||||
<m k="kind" v="5|6">
|
||||
<line outline="kind0" use="secondary:z11" />
|
||||
<line outline="kind0" use="secondary:z11" fix="true" width="1.5"/>
|
||||
</m>
|
||||
|
||||
<m k="kind" v="7">
|
||||
<line outline="kind0" use="tertiary" />
|
||||
<line outline="kind0" use="tertiary" fix="true" width="2.2"/>
|
||||
</m>
|
||||
|
||||
<m k="kind" v="8">
|
||||
<line outline="kind0" use="residential" />
|
||||
<line outline="kind0" use="residential" fix="true" width="0.5"/>
|
||||
</m>
|
||||
<m k="kind" v="9|10">
|
||||
<line outline="kind0" use="footway:z17" />
|
||||
<line outline="kind0" use="footway:z17" fix="true" width="0.7"/>
|
||||
</m>
|
||||
<m k="kind" v="11|13">
|
||||
<line outline="kind0" use="ferry" />
|
||||
<line outline="kind0" use="ferry" fix="true" width="5"/>
|
||||
</m>
|
||||
<m k="kind" v="15">
|
||||
<line outline="kind0" use="highway:cycleway" />
|
||||
<line outline="kind0" use="highway:cycleway" width="1"/>
|
||||
</m>
|
||||
</m>
|
||||
|
||||
@@ -1613,14 +1620,6 @@
|
||||
<symbol repeat="false" repeat-start="0" rotate="false"
|
||||
src="assets:omdb/icon_4023_0.svg" symbol-height="56" symbol-width="56"></symbol>
|
||||
</m>
|
||||
<!-- <m k="type" v="angle">
|
||||
<symbol repeat="false" repeat-gap="2000" repeat-start="0" rotate="true"
|
||||
src="assets:omdb/icon_arrow_right.svg" symbol-height="64"
|
||||
symbol-width="64"></symbol>
|
||||
</m>
|
||||
<m k="type" v="s_2_e">
|
||||
<line use="s2e" />
|
||||
</m>-->
|
||||
</m>
|
||||
<!-- 道路边界类型 -->
|
||||
<m v="OMDB_RDBOUND_BOUNDARYTYPE">
|
||||
@@ -1914,13 +1913,13 @@
|
||||
<!--电子眼-->
|
||||
<m v="OMDB_ELECTRONICEYE">
|
||||
<m k="eleceyeId">
|
||||
<caption dy="-30" fill="#0000FF" k="name" priority="0" size="12"
|
||||
stroke="#ffffff" stroke-width="1.0"></caption>
|
||||
<caption dy="-12" fill="#ffffff" k="name" priority="0" size="11"
|
||||
stroke="#000000" stroke-width="1.0" bg-fill="#F98F03"></caption>
|
||||
<symbol repeat="false" src="assets:omdb/4010/icon_electroniceye_4010.svg" symbol-height="44" symbol-width="44"></symbol>
|
||||
</m>
|
||||
<m k="type" v="angle">
|
||||
<symbol repeat="false" repeat-gap="2000" repeat-start="0" rotate="true"
|
||||
src="assets:omdb/4010/right.svg" symbol-height="40" symbol-width="40"></symbol>
|
||||
src="assets:omdb/icon_arrow_right.svg" symbol-height="54" symbol-width="54"></symbol>
|
||||
</m>
|
||||
<m k="type" v="s_2_e">
|
||||
<line use="s2e" />
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 5.5 KiB |
@@ -62,7 +62,7 @@ open class RenderEntity() : RealmObject(), Parcelable {
|
||||
var zoomMin: Int = 18 //显示最小级别
|
||||
var zoomMax: Int = 23 //显示最大级别
|
||||
var enable:Int = 0 // 默认0不是显示 1为渲染显示 2为常显
|
||||
var catchEnable:Int = 0 // 0捕捉 1不捕捉
|
||||
var catchEnable:Int = 0 // 0不捕捉 1捕捉
|
||||
|
||||
constructor(name: String) : this() {
|
||||
this.name = name
|
||||
|
||||
@@ -735,7 +735,7 @@ public final class NIMapView extends RelativeLayout {
|
||||
if (mapView != null && mapView.map() != null)
|
||||
return mapView.map().getMapPosition().getZoomLevel();
|
||||
|
||||
return 0;
|
||||
return 16;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -146,6 +146,7 @@ class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView, traceP
|
||||
// 添加显示grid的tile号的图层
|
||||
tileGridLayer = TileGridLayer(mMapView.vtmMap)
|
||||
addLayer(tileGridLayer, NIMapView.LAYER_GROUPS.OPERATE_MARKER)
|
||||
tileGridLayer.isEnabled = false
|
||||
}
|
||||
|
||||
private fun resetOMDBVectorTileLayer() {
|
||||
|
||||
@@ -7,14 +7,17 @@ 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.GeometryTools;
|
||||
import com.navinfo.collect.library.utils.MapParamUtils;
|
||||
|
||||
import org.locationtech.jts.geom.Polygon;
|
||||
import org.oscim.layers.tile.MapTile;
|
||||
import org.oscim.tiling.ITileDataSink;
|
||||
import org.oscim.tiling.ITileDataSource;
|
||||
import org.oscim.tiling.QueryResult;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.realm.Realm;
|
||||
import io.realm.RealmQuery;
|
||||
@@ -33,26 +36,28 @@ public class OMDBReferenceDataSource implements ITileDataSource {
|
||||
@Override
|
||||
public void query(MapTile tile, ITileDataSink mapDataSink) {
|
||||
// 获取tile对应的坐标范围
|
||||
if (tile.zoomLevel >= Constant.OMDB_MIN_ZOOM && tile.zoomLevel <= Constant.OVER_ZOOM) {
|
||||
if (tile.zoomLevel >= Constant.OMDB_MIN_ZOOM && tile.zoomLevel < Constant.OVER_ZOOM) {
|
||||
int m = Constant.OVER_ZOOM - tile.zoomLevel;
|
||||
int xStart = (int) tile.tileX << m;
|
||||
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();
|
||||
Realm.getInstance(MapParamUtils.getTaskConfig()).refresh();
|
||||
isUpdate = false;
|
||||
}
|
||||
|
||||
String sql = "taskId="+ MapParamUtils.getTaskId() +" and tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd + "";
|
||||
String sql = " tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd + "";
|
||||
|
||||
if(MapParamUtils.getDataLayerEnum()!=null){
|
||||
sql += " and enable" + MapParamUtils.getDataLayerEnum().getSql();
|
||||
}else{
|
||||
sql += " and 1=1";
|
||||
sql += " and enable>=0";
|
||||
}
|
||||
|
||||
RealmQuery<ReferenceEntity> realmQuery = Realm.getDefaultInstance().where(ReferenceEntity.class)
|
||||
RealmQuery<ReferenceEntity> realmQuery = Realm.getInstance(MapParamUtils.getTaskConfig()).where(ReferenceEntity.class)
|
||||
.rawPredicate(sql);
|
||||
// 筛选不显示的数据
|
||||
if (Constant.HAD_LAYER_INVISIABLE_ARRAY != null && Constant.HAD_LAYER_INVISIABLE_ARRAY.length > 0) {
|
||||
@@ -64,12 +69,16 @@ public class OMDBReferenceDataSource implements ITileDataSource {
|
||||
}
|
||||
List<ReferenceEntity> listResult = realmQuery/*.distinct("id")*/.findAll();
|
||||
if (!listResult.isEmpty()) {
|
||||
Polygon tilePolygon = GeometryTools.getTilePolygon(tile);
|
||||
listResult = listResult.stream().filter((ReferenceEntity referenceEntity) -> referenceEntity.getWkt().intersects(tilePolygon)).collect(Collectors.toList());
|
||||
mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult);
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
} else {
|
||||
mapDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
||||
}
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
// Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString());
|
||||
Realm.getInstance(MapParamUtils.getTaskConfig()).close();
|
||||
} else {
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
mapDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,17 @@ import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.navinfo.collect.library.data.entity.RenderEntity;
|
||||
import com.navinfo.collect.library.system.Constant;
|
||||
import com.navinfo.collect.library.utils.GeometryTools;
|
||||
import com.navinfo.collect.library.utils.MapParamUtils;
|
||||
|
||||
import org.locationtech.jts.geom.Polygon;
|
||||
import org.oscim.layers.tile.MapTile;
|
||||
import org.oscim.tiling.ITileDataSink;
|
||||
import org.oscim.tiling.ITileDataSource;
|
||||
import org.oscim.tiling.QueryResult;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.realm.Realm;
|
||||
import io.realm.RealmQuery;
|
||||
@@ -32,26 +35,27 @@ public class OMDBTileDataSource implements ITileDataSource {
|
||||
@Override
|
||||
public void query(MapTile tile, ITileDataSink mapDataSink) {
|
||||
// 获取tile对应的坐标范围
|
||||
if (tile.zoomLevel >= Constant.OMDB_MIN_ZOOM && tile.zoomLevel <= Constant.OVER_ZOOM) {
|
||||
if (tile.zoomLevel >= Constant.OMDB_MIN_ZOOM && tile.zoomLevel < Constant.OVER_ZOOM) {
|
||||
int m = Constant.OVER_ZOOM - tile.zoomLevel;
|
||||
int xStart = (int) tile.tileX << m;
|
||||
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();
|
||||
Realm.getInstance(MapParamUtils.getTaskConfig()).refresh();
|
||||
isUpdate = false;
|
||||
}
|
||||
|
||||
String sql = "taskId="+ MapParamUtils.getTaskId() +" and tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd + "";
|
||||
String sql =" tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd + "";
|
||||
|
||||
if(MapParamUtils.getDataLayerEnum()!=null){
|
||||
sql += " and enable" + MapParamUtils.getDataLayerEnum().getSql();
|
||||
}else{
|
||||
sql += " and 1=1";
|
||||
sql += " and enable>=0";
|
||||
}
|
||||
|
||||
RealmQuery<RenderEntity> realmQuery = Realm.getDefaultInstance().where(RenderEntity.class).rawPredicate(sql);
|
||||
RealmQuery<RenderEntity> realmQuery = Realm.getInstance(MapParamUtils.getTaskConfig()).where(RenderEntity.class).rawPredicate(sql);
|
||||
// 筛选不显示的数据
|
||||
if (Constant.HAD_LAYER_INVISIABLE_ARRAY != null && Constant.HAD_LAYER_INVISIABLE_ARRAY.length > 0) {
|
||||
realmQuery.beginGroup();
|
||||
@@ -61,12 +65,18 @@ public class OMDBTileDataSource implements ITileDataSource {
|
||||
realmQuery.endGroup();
|
||||
}
|
||||
List<RenderEntity> listResult = realmQuery/*.distinct("id")*/.findAll();
|
||||
// 数据记录的tile号是以正外接tile号列表,此处过滤并未与当前tile相交的数据
|
||||
if (!listResult.isEmpty()) {
|
||||
Polygon tilePolygon = GeometryTools.getTilePolygon(tile);
|
||||
listResult = listResult.stream().filter((RenderEntity renderEntity) -> renderEntity.getWkt().intersects(tilePolygon)).collect(Collectors.toList());
|
||||
mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult);
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
} else {
|
||||
mapDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
||||
}
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
Realm.getInstance(MapParamUtils.getTaskConfig()).close();
|
||||
} else {
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
mapDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ public class RealmDBTileDataSource implements ITileDataSource {
|
||||
List<GeometryFeatureEntity> listResult = realmQuery.distinct("id").findAll();
|
||||
mThreadLocalDecoders.get().decode(tile, mapDataSink, listResult);
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
Realm.getDefaultInstance().close();
|
||||
// Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString());
|
||||
} else {
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
|
||||
@@ -15,6 +15,8 @@ import org.locationtech.jts.geom.Polygon;
|
||||
import org.locationtech.jts.io.WKTReader;
|
||||
import org.locationtech.jts.operation.linemerge.LineMerger;
|
||||
import org.oscim.core.GeoPoint;
|
||||
import org.oscim.core.MercatorProjection;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.map.Map;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -254,6 +256,22 @@ public class GeometryTools {
|
||||
return gon.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建多边形几何
|
||||
*
|
||||
* @param coords []
|
||||
* @return Geometry
|
||||
*/
|
||||
public static Polygon createPolygonFromCoords(Coordinate[] coords) {
|
||||
GeometryFactory factory = new GeometryFactory();
|
||||
|
||||
Polygon gon = factory.createPolygon(coords);
|
||||
|
||||
if (gon == null)
|
||||
return null;
|
||||
return gon;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建多边形几何
|
||||
*
|
||||
@@ -1433,7 +1451,19 @@ public class GeometryTools {
|
||||
double radianDegree = 2 * Math.asin(Math.sin(radianDistance / 2) / Math.cos(radianLatitude));
|
||||
return Math.toDegrees(radianDegree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定tile对应的polygon面
|
||||
* @param tile vtm中的瓦片
|
||||
* */
|
||||
public static Polygon getTilePolygon(Tile tile) {
|
||||
// 获取当前tile的起点坐标
|
||||
double startLongitude = MercatorProjection.tileXToLongitude(tile.tileX, tile.zoomLevel);
|
||||
double startLatitude = MercatorProjection.tileYToLatitude(tile.tileY, tile.zoomLevel);
|
||||
double endLongitude = MercatorProjection.tileXToLongitude(tile.tileX + 1, tile.zoomLevel);
|
||||
double endLatitude = MercatorProjection.tileYToLatitude(tile.tileY + 1, tile.zoomLevel);
|
||||
return GeometryTools.createPolygonFromCoords(new Coordinate[]{new Coordinate(startLongitude, startLongitude), new Coordinate(endLongitude, startLatitude),
|
||||
new Coordinate(endLongitude, endLatitude), new Coordinate(startLongitude, endLatitude), new Coordinate(startLongitude, startLongitude)});
|
||||
}
|
||||
/**
|
||||
* 经纬度转墨卡托
|
||||
*/
|
||||
|
||||
@@ -2,20 +2,33 @@ package com.navinfo.collect.library.utils;
|
||||
|
||||
import com.navinfo.collect.library.enums.DataLayerEnum;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import io.realm.RealmConfiguration;
|
||||
|
||||
public class MapParamUtils {
|
||||
|
||||
private static int mtaskId = -1;
|
||||
|
||||
private static RealmConfiguration mTaskConfig = null;
|
||||
|
||||
private static DataLayerEnum dataLayerEnum = DataLayerEnum.ONLY_ENABLE_LAYERS;
|
||||
|
||||
public static int getTaskId() {
|
||||
return mtaskId;
|
||||
}
|
||||
|
||||
public static void setTaskId(int taskId) {
|
||||
mtaskId = taskId;
|
||||
}
|
||||
|
||||
public static RealmConfiguration getTaskConfig() {
|
||||
return mTaskConfig;
|
||||
}
|
||||
|
||||
public static void setTaskConfig(RealmConfiguration taskConfig) {
|
||||
mTaskConfig = taskConfig;
|
||||
}
|
||||
|
||||
public static DataLayerEnum getDataLayerEnum() {
|
||||
return dataLayerEnum;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user