feat: 增加路口内交通岛、上方障碍物的渲染,修改符号、文字颜色
@ -178,6 +178,23 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"3001":{
|
||||
"table": "OMDB_OBJECT_OH_STRUCT",
|
||||
"code": 3001,
|
||||
"name": "上方障碍物",
|
||||
"zoomMin": 15,
|
||||
"zoomMax": 20,
|
||||
"catch":true,
|
||||
"checkLinkId": false,
|
||||
"transformer": [
|
||||
{
|
||||
"k": "geometry",
|
||||
"v": "~",
|
||||
"klib": "geometry",
|
||||
"vlib": "getPolygonCenterPoint()"
|
||||
}
|
||||
]
|
||||
},
|
||||
"3002":{
|
||||
"table": "OMDB_OBJECT_TEXT",
|
||||
"code": 3002,
|
||||
@ -276,6 +293,15 @@
|
||||
"catch":true,
|
||||
"zoomMax": 20
|
||||
},
|
||||
"3027":{
|
||||
"table": "OMDB_OBJECT_REFUGE_ISLAND",
|
||||
"code": 3027,
|
||||
"name": "路口内交通岛",
|
||||
"catch":true,
|
||||
"checkLinkId": false,
|
||||
"zoomMin": 18,
|
||||
"zoomMax": 20
|
||||
},
|
||||
"4001": {
|
||||
"table": "OMDB_INTERSECTION",
|
||||
"code": 4001,
|
||||
|
@ -93,11 +93,6 @@ class Constant {
|
||||
|
||||
const val DEBUG = true
|
||||
|
||||
/**
|
||||
* 地图最多缩放级别20
|
||||
*/
|
||||
const val MAX_ZOOM = 20
|
||||
|
||||
/**
|
||||
* 是否自动定位
|
||||
*/
|
||||
|
@ -845,8 +845,46 @@ class ImportPreProcess {
|
||||
val listResult = mutableListOf<ReferenceEntity>()
|
||||
|
||||
val coorEnd = Coordinate(pointStart.getX() + dx, pointStart.getY() + dy, pointStart.z)
|
||||
renderEntity.geometry = WKTWriter(3).write(GeometryTools.createLineString(arrayOf(pointStart, coorEnd)))
|
||||
// renderEntity.geometry = WKTWriter(3).write(GeometryTools.createLineString(arrayOf(pointStart, coorEnd)))
|
||||
renderEntity.geometry = GeometryTools.createGeometry(GeoPoint(centerPoint!!.y, centerPoint.x)).toString()
|
||||
val code = renderEntity.properties["signType"]
|
||||
renderEntity.properties["src"] = "assets:omdb/appendix/1105_${code}_0.svg"
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上方障碍物中心点坐标
|
||||
*
|
||||
* */
|
||||
fun getPolygonCenterPoint(renderEntity: RenderEntity, containsDirect: Boolean = false) {
|
||||
// 获取中心坐标点,将中心坐标作为数据的新的geometry位置
|
||||
val centerPoint = renderEntity.wkt?.centroid
|
||||
if (containsDirect) {
|
||||
// 根据heading方向自动生成新的Geometry
|
||||
var radian = 0.0
|
||||
val pointStart = Coordinate(centerPoint!!.x, centerPoint.y)
|
||||
var angle =
|
||||
if (renderEntity?.properties?.get("heading") == null) 0.0 else renderEntity?.properties?.get(
|
||||
"heading"
|
||||
)?.toDouble()!!
|
||||
// angle角度为与正北方向的顺时针夹角,将其转换为与X轴正方向的逆时针夹角,即为正东方向的夹角
|
||||
angle = ((450 - angle) % 360)
|
||||
radian = Math.toRadians(angle)
|
||||
|
||||
// 计算偏移距离
|
||||
var dx: Double = GeometryTools.convertDistanceToDegree(
|
||||
defaultTranslateDistance,
|
||||
centerPoint.y
|
||||
) * Math.cos(radian)
|
||||
var dy: Double = GeometryTools.convertDistanceToDegree(
|
||||
defaultTranslateDistance,
|
||||
centerPoint.y
|
||||
) * Math.sin(radian)
|
||||
val listResult = mutableListOf<ReferenceEntity>()
|
||||
|
||||
val coorEnd = Coordinate(pointStart.getX() + dx, pointStart.getY() + dy, pointStart.z)
|
||||
renderEntity.geometry = WKTWriter(3).write(GeometryTools.createLineString(arrayOf(pointStart, coorEnd)))
|
||||
} else {
|
||||
renderEntity.geometry = GeometryTools.createGeometry(GeoPoint(centerPoint!!.y, centerPoint.x)).toString()
|
||||
}
|
||||
}
|
||||
}
|
@ -191,7 +191,7 @@ class MainActivity : BaseActivity() {
|
||||
viewModel.speakMode = SpeakMode(this)
|
||||
// 在mapController初始化前获取当前OMDB图层显隐
|
||||
viewModel.refreshOMDBLayer(LayerConfigUtils.getLayerConfigList())
|
||||
mapController.mMapView.vtmMap.viewport().maxZoomLevel = Constant.MAX_ZOOM
|
||||
mapController.mMapView.vtmMap.viewport().maxZoomLevel = com.navinfo.collect.library.system.Constant.MAX_ZOOM
|
||||
//关联生命周期
|
||||
binding.lifecycleOwner = this
|
||||
//给xml转递对象
|
||||
|
@ -167,7 +167,7 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit?
|
||||
// 定位到指定位置
|
||||
niMapController.mMapView.vtmMap.animator()
|
||||
// .animateTo(GeoPoint( 40.05108004733645, 116.29187746293708 ))
|
||||
.animateTo(GeoPoint(40.5016054261786, 115.82381251427815))
|
||||
.animateTo(GeoPoint(40.50704534740206, 115.80404946472662))
|
||||
}
|
||||
|
||||
R.id.personal_center_menu_open_all_layer -> {
|
||||
|
@ -1814,6 +1814,21 @@
|
||||
<symbol repeat="false" repeat-start="0" gland="false" repeat-gap="32" src="assets:omdb/icon_2204_0.svg"></symbol>
|
||||
</m>
|
||||
|
||||
<!-- 上方障碍物 -->
|
||||
<m v="OMDB_OBJECT_OH_STRUCT">
|
||||
<symbol repeat="false" repeat-start="0" gland="false" repeat-gap="32" symbol-width="42" symbol-height="42" src="assets:omdb/icon_3001_0.svg"></symbol>
|
||||
</m>
|
||||
|
||||
<!-- 路口内交通岛 -->
|
||||
<m v="OMDB_OBJECT_REFUGE_ISLAND">
|
||||
<m k="type" v="1">
|
||||
<area use="obj-area" repeat="true" fill="#33666666"></area>
|
||||
</m>
|
||||
<m k="type" v="2">
|
||||
<area use="obj-area" repeat="true" fill="#33333333"></area>
|
||||
</m>
|
||||
</m>
|
||||
|
||||
<!-- 停止位置 -->
|
||||
<m v="OMDB_OBJECT_STOPLOCATION">
|
||||
|
||||
@ -1923,26 +1938,30 @@
|
||||
<!-- 文字 -->
|
||||
<m v="OMDB_OBJECT_TEXT">
|
||||
<m k="color" v="0">
|
||||
<area use="obj-area" stroke="#00000000" fill="#dfe4ea" repeat="false" src="@text-src:textString" longEdge="t" hasDirect="true"></area>
|
||||
<area use="obj-area" stroke="#00000000" fill="#3C4C56" repeat="false" src="@text-src:textString" longEdge="t" hasDirect="true"></area>
|
||||
</m>
|
||||
<m k="color" v="1">
|
||||
<area use="obj-area" stroke="#00000000" fill="#ffffff" repeat="false" src="@text-src:textString" longEdge="t" hasDirect="true"></area>
|
||||
</m>
|
||||
<m k="color" v="2">
|
||||
<area use="obj-area" stroke="#00000000" fill="#ffff00" repeat="false" src="@text-src:textString" longEdge="t" hasDirect="true"></area>
|
||||
<area use="obj-area" stroke="#00000000" fill="#FFC729" repeat="false" src="@text-src:textString" longEdge="t" hasDirect="true"></area>
|
||||
</m>
|
||||
<m k="color" v="3">
|
||||
<area use="obj-area" stroke="#00000000" fill="#ff0000" repeat="false" src="@text-src:textString" longEdge="t" hasDirect="true"></area>
|
||||
<area use="obj-area" stroke="#00000000" fill="#E2233A" repeat="false" src="@text-src:textString" longEdge="t" hasDirect="true"></area>
|
||||
</m>
|
||||
<m k="color" v="4">
|
||||
<area use="obj-area" stroke="#00000000" fill="#00ff00" repeat="false" src="@text-src:textString" longEdge="t" hasDirect="true"></area>
|
||||
<area use="obj-area" stroke="#00000000" fill="#6A30C6" repeat="false" src="@text-src:textString" longEdge="t" hasDirect="true"></area>
|
||||
</m>
|
||||
<m k="color" v="9">
|
||||
<area use="obj-area" stroke="#00000000" fill="#0000ff" repeat="false" src="@text-src:textString" longEdge="t" hasDirect="true"></area>
|
||||
<area use="obj-area" stroke="#00000000" fill="#053CD6" repeat="false" src="@text-src:textString" longEdge="t" hasDirect="true"></area>
|
||||
</m>
|
||||
</m>
|
||||
<!-- 符号 -->
|
||||
<m v="OMDB_OBJECT_SYMBOL">
|
||||
<!-- 未验证 -->
|
||||
<m k="color" v="0">
|
||||
<area use="obj-area" stroke="#00000000" repeat="false" src="assets:omdb/object_symbol_3003_0.svg" longEdge="t" hasDirect="true"></area>
|
||||
</m>
|
||||
<m k="color" v="1">
|
||||
<area use="obj-area" stroke="#00000000" repeat="false" src="assets:omdb/object_symbol_3003_1.svg" longEdge="t" hasDirect="true"></area>
|
||||
</m>
|
||||
|
1
collect-library/src/main/assets/omdb/icon_3001_0.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1695622525511" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4068" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M896 213.333333h-42.666667V170.666667a42.666667 42.666667 0 0 0-85.333333 0v42.666666H256V170.666667a42.666667 42.666667 0 0 0-85.333333 0v42.666666H128a42.666667 42.666667 0 0 0-42.666667 42.666667v256a42.666667 42.666667 0 0 0 42.666667 42.666667h42.666667v298.666666a42.666667 42.666667 0 0 0 85.333333 0v-298.666666h512v298.666666a42.666667 42.666667 0 0 0 85.333333 0v-298.666666h42.666667a42.666667 42.666667 0 0 0 42.666667-42.666667V256a42.666667 42.666667 0 0 0-42.666667-42.666667zM170.666667 406.186667V298.666667h107.52zM227.84 469.333333l170.666667-170.666666h142.08l-170.666667 170.666666z m262.4 0l170.666667-170.666666h135.68l-170.666667 170.666666zM853.333333 469.333333h-107.093333L853.333333 362.24z" p-id="4069"></path></svg>
|
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="b" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.d{fill:none;}.e{fill:#3c4c56;}</style></defs><g id="c"><rect class="d" width="24" height="24"/><path class="e" d="M21.2,11.6L12.3,1.3c-.2-.2-.4-.2-.6,0L2.8,11.6c-.2,.2-.2,.5,0,.7l8.9,10.4c.2,.2,.4,.2,.6,0l8.9-10.4c.2-.2,.2-.5,0-.7Zm-2.7,.7l-6.2,7.3c-.2,.2-.4,.2-.6,0l-6.2-7.3c-.2-.2-.2-.5,0-.7l6.2-7.3c.2-.2,.4-.2,.6,0l6.2,7.3c.2,.2,.2,.5,0,.7Z"/></g></svg>
|
After Width: | Height: | Size: 499 B |
@ -1 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="b" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.n{opacity:0;stroke-width:1.2px;}.n,.o{fill:none;stroke:#fff;}.p{fill:#fff;fill-rule:evenodd;}</style></defs><g id="c"><g id="d"><g id="e"><g id="f"><g id="g"><rect id="h" class="n" x=".6" y=".6" width="22.8" height="22.8" rx="2" ry="2"/><g id="i"><polygon id="j" class="o" points="12 3 4 11.5 12 20 20 11.5 12 3"/><g id="k"><g id="l"><polygon id="m" class="p" points="12 3 17.1 13.8 12 9.7 6.9 13.8 12 3"/></g></g></g></g></g></g></g></g></svg>
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="b" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.d{fill:none;}.e{fill:#fff;}</style></defs><g id="c"><rect class="d" width="24" height="24"/><path class="e" d="M21.2,11.6L12.3,1.3c-.2-.2-.4-.2-.6,0L2.8,11.6c-.2,.2-.2,.5,0,.7l8.9,10.4c.2,.2,.4,.2,.6,0l8.9-10.4c.2-.2,.2-.5,0-.7Zm-2.7,.7l-6.2,7.3c-.2,.2-.4,.2-.6,0l-6.2-7.3c-.2-.2-.2-.5,0-.7l6.2-7.3c.2-.2,.4-.2,.6,0l6.2,7.3c.2,.2,.2,.5,0,.7Z"/></g></svg>
|
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 496 B |
@ -1 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="b" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.o{opacity:0;stroke-width:1.2px;}.o,.p{fill:none;stroke:#ffdf24;}.q{fill:#ffdf24;fill-rule:evenodd;}</style></defs><g id="c"><g id="d"><g id="e"><g id="f"><g id="g"><g id="h"><rect id="i" class="o" x=".6" y=".6" width="22.8" height="22.8" rx="2" ry="2"/><g id="j"><polygon id="k" class="p" points="12 3.7 4 11.9 12 20 20 11.9 12 3.7"/><g id="l"><g id="m"><polygon id="n" class="q" points="12 3 17.1 13.3 12 9.5 6.9 13.3 12 3"/></g></g></g></g></g></g></g></g></g></svg>
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="b" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.d{fill:none;}.e{fill:#ffc729;}</style></defs><g id="c"><rect class="d" width="24" height="24"/><path class="e" d="M21.2,11.6L12.3,1.3c-.2-.2-.4-.2-.6,0L2.8,11.6c-.2,.2-.2,.5,0,.7l8.9,10.4c.2,.2,.4,.2,.6,0l8.9-10.4c.2-.2,.2-.5,0-.7Zm-2.7,.7l-6.2,7.3c-.2,.2-.4,.2-.6,0l-6.2-7.3c-.2-.2-.2-.5,0-.7l6.2-7.3c.2-.2,.4-.2,.6,0l6.2,7.3c.2,.2,.2,.5,0,.7Z"/></g></svg>
|
Before Width: | Height: | Size: 610 B After Width: | Height: | Size: 499 B |
@ -1 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="b" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.o{opacity:0;stroke-width:1.2px;}.o,.p{fill:none;stroke:#b00b1f;}.q{fill:#b00b1f;fill-rule:evenodd;}</style></defs><g id="c"><g id="d"><g id="e"><g id="f"><g id="g"><g id="h"><rect id="i" class="o" x=".6" y=".6" width="22.8" height="22.8" rx="2" ry="2"/><g id="j"><polygon id="k" class="p" points="12 3 4 11.5 12 20 20 11.5 12 3"/><g id="l"><g id="m"><polygon id="n" class="q" points="12 3 17.1 13.8 12 9.7 6.9 13.8 12 3"/></g></g></g></g></g></g></g></g></g></svg>
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="b" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.d{fill:none;}.e{fill:#e2233a;}</style></defs><g id="c"><rect class="d" width="24" height="24"/><path class="e" d="M21.2,11.6L12.3,1.3c-.2-.2-.4-.2-.6,0L2.8,11.6c-.2,.2-.2,.5,0,.7l8.9,10.4c.2,.2,.4,.2,.6,0l8.9-10.4c.2-.2,.2-.5,0-.7Zm-2.7,.7l-6.2,7.3c-.2,.2-.4,.2-.6,0l-6.2-7.3c-.2-.2-.2-.5,0-.7l6.2-7.3c.2-.2,.4-.2,.6,0l6.2,7.3c.2,.2,.2,.5,0,.7Z"/></g></svg>
|
Before Width: | Height: | Size: 606 B After Width: | Height: | Size: 499 B |
@ -1 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="b" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.o{opacity:0;stroke-width:1.2px;}.o,.p{fill:none;stroke:#2b4acb;}.q{fill:#2b4acb;fill-rule:evenodd;}</style></defs><g id="c"><g id="d"><g id="e"><g id="f"><g id="g"><g id="h"><rect id="i" class="o" x=".6" y=".6" width="22.8" height="22.8" rx="2" ry="2"/><g id="j"><polygon id="k" class="p" points="12 4 4 12.5 12 21 20 12.5 12 4"/><g id="l"><g id="m"><polygon id="n" class="q" points="12 4 17.1 14.8 12 10.7 6.9 14.8 12 4"/></g></g></g></g></g></g></g></g></g></svg>
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="b" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.d{fill:none;}.e{fill:#6a30c6;}</style></defs><g id="c"><rect class="d" width="24" height="24"/><path class="e" d="M18.8,11.7l-6.6-7.7c-.1-.1-.3-.1-.5,0l-6.6,7.7c-.1,.1-.1,.4,0,.5l6.6,7.7c.1,.1,.3,.1,.5,0l6.6-7.7c.1-.1,.1-.4,0-.5Zm-2,.5l-4.6,5.4c-.1,.1-.3,.1-.4,0l-4.6-5.4c-.1-.1-.1-.4,0-.5l4.6-5.4c.1-.1,.3-.1,.4,0l4.6,5.4c.1,.1,.1,.4,0,.5Z"/><path class="e" d="M20.8,2.2c.6,0,1,.4,1,1V20.8c0,.6-.4,1-1,1H3.2c-.6,0-1-.4-1-1V3.2c0-.6,.4-1,1-1H20.8m0-1H3.2c-1.1,0-2,.9-2,2V20.8c0,1.1,.9,2,2,2H20.8c1.1,0,2-.9,2-2V3.2c0-1.1-.9-2-2-2h0Z"/></g></svg>
|
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 687 B |
@ -1 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="b" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.o{fill:#1500ff;}.p{fill:#ececec;fill-rule:evenodd;}.q{fill:none;stroke:#ececec;}</style></defs><g id="c"><g id="d"><g id="e"><g id="f"><g id="g"><g id="h"><rect id="i" class="o" width="24" height="24" rx="2" ry="2"/><g id="j"><g id="k"><g id="l"><polygon id="m" class="p" points="12 4 17.1 14.8 12 10.7 6.9 14.8 12 4"/></g></g><polygon id="n" class="q" points="12 4 4 12.5 12 21 20 12.5 12 4"/></g></g></g></g></g></g></g></svg>
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="b" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.d{fill:none;}.e{fill:#053cd6;}</style></defs><g id="c"><rect class="d" width="24" height="24"/><path class="e" d="M21.2,11.6L12.3,1.3c-.2-.2-.4-.2-.6,0L2.8,11.6c-.2,.2-.2,.5,0,.7l8.9,10.4c.2,.2,.4,.2,.6,0l8.9-10.4c.2-.2,.2-.5,0-.7Zm-2.7,.7l-6.2,7.3c-.2,.2-.4,.2-.6,0l-6.2-7.3c-.2-.2-.2-.5,0-.7l6.2-7.3c.2-.2,.4-.2,.6,0l6.2,7.3c.2,.2,.2,.5,0,.7Z"/></g></svg>
|
Before Width: | Height: | Size: 570 B After Width: | Height: | Size: 499 B |
@ -36,12 +36,18 @@ 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) {
|
||||
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 (tile.zoomLevel >= Constant.OMDB_MIN_ZOOM && tile.zoomLevel <= Constant.DATA_ZOOM) {
|
||||
int m = Constant.DATA_ZOOM - tile.zoomLevel;
|
||||
int xStart = tile.tileX;
|
||||
int xEnd = tile.tileX + 1;
|
||||
int yStart = tile.tileY;
|
||||
int yEnd = tile.tileY + 1;
|
||||
if (m>0) {
|
||||
xStart = (int) (xStart << m);
|
||||
xEnd = (int) (xEnd << m);
|
||||
yStart = (int) (yStart << m);
|
||||
yEnd = (int) (yEnd << m);
|
||||
}
|
||||
|
||||
|
||||
if(isUpdate){
|
||||
|
@ -1,15 +1,9 @@
|
||||
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;
|
||||
|
||||
import io.realm.Realm;
|
||||
|
||||
public class OMDBReferenceTileSource extends RealmDBTileSource {
|
||||
private OMDBReferenceDataSource omdbReferenceTileSource = new OMDBReferenceDataSource();
|
||||
@ -17,7 +11,7 @@ public class OMDBReferenceTileSource extends RealmDBTileSource {
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
//return new OverzoomTileDataSource(new OMDBReferenceDataSource(), Constant.OVER_ZOOM);
|
||||
return omdbReferenceTileSource;
|
||||
return new OverzoomTileDataSource(omdbReferenceTileSource, Constant.OVER_ZOOM);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,12 +35,18 @@ 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) {
|
||||
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 (tile.zoomLevel >= Constant.OMDB_MIN_ZOOM && tile.zoomLevel <= Constant.DATA_ZOOM) {
|
||||
int m = Constant.DATA_ZOOM - tile.zoomLevel;
|
||||
int xStart = tile.tileX;
|
||||
int xEnd = tile.tileX + 1;
|
||||
int yStart = tile.tileY;
|
||||
int yEnd = tile.tileY + 1;
|
||||
if (m>0) {
|
||||
xStart = (int) (xStart << m);
|
||||
xEnd = (int) (xEnd << m);
|
||||
yStart = (int) (yStart << m);
|
||||
yEnd = (int) (yEnd << m);
|
||||
}
|
||||
|
||||
if(isUpdate){
|
||||
Realm.getInstance(MapParamUtils.getTaskConfig()).refresh();
|
||||
|
@ -7,7 +7,6 @@ import com.navinfo.collect.library.system.Constant;
|
||||
|
||||
import org.oscim.tiling.ITileDataSource;
|
||||
import org.oscim.tiling.OverzoomTileDataSource;
|
||||
import org.oscim.tiling.TileSource;
|
||||
|
||||
import io.realm.Realm;
|
||||
|
||||
@ -16,7 +15,7 @@ public class OMDBTileSource extends RealmDBTileSource {
|
||||
@Override
|
||||
public ITileDataSource getDataSource() {
|
||||
// return new OverzoomTileDataSource(new OMDBTileDataSource(), Constant.OVER_ZOOM);
|
||||
return omdbTileSource;
|
||||
return new OverzoomTileDataSource(omdbTileSource, Constant.OVER_ZOOM);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,10 +2,6 @@ package com.navinfo.collect.library.system;
|
||||
|
||||
import android.os.Environment;
|
||||
|
||||
import com.navinfo.collect.library.map.source.RealmDBTileDataSource;
|
||||
|
||||
import org.oscim.tiling.OverzoomTileDataSource;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -30,8 +26,11 @@ public class Constant {
|
||||
}
|
||||
|
||||
public static String[] HAD_LAYER_INVISIABLE_ARRAY;
|
||||
public static final int OVER_ZOOM = 20;
|
||||
public static final int MAX_ZOOM = 20;
|
||||
// 渲染引擎开始切割的级别
|
||||
public static final int OVER_ZOOM = 18;
|
||||
public static final int MAX_ZOOM = 22;
|
||||
// 数据保存时的zoom
|
||||
public static final int DATA_ZOOM = 23;
|
||||
public static final int OMDB_MIN_ZOOM = 15;
|
||||
|
||||
/**
|
||||
|
@ -38,8 +38,8 @@ class GeometryToolsKt {
|
||||
}
|
||||
}
|
||||
// 分别计算最大和最小x值对应的tile号
|
||||
val tileY0 = MercatorProjection.latitudeToTileY(minMaxY[0], Constant.OVER_ZOOM.toByte())
|
||||
val tileY1 = MercatorProjection.latitudeToTileY(minMaxY[1], Constant.OVER_ZOOM.toByte())
|
||||
val tileY0 = MercatorProjection.latitudeToTileY(minMaxY[0], Constant.DATA_ZOOM.toByte())
|
||||
val tileY1 = MercatorProjection.latitudeToTileY(minMaxY[1], Constant.DATA_ZOOM.toByte())
|
||||
val minTileY = if (tileY0 <= tileY1) tileY0 else tileY1
|
||||
val maxTileY = if (tileY0 <= tileY1) tileY1 else tileY0
|
||||
// println("getTileYByGeometry$envelope===$minTileY===$maxTileY")
|
||||
@ -82,8 +82,8 @@ class GeometryToolsKt {
|
||||
}
|
||||
}
|
||||
// 分别计算最大和最小x值对应的tile号
|
||||
val tileX0 = MercatorProjection.longitudeToTileX(minMaxX[0], Constant.OVER_ZOOM.toByte())
|
||||
val tileX1 = MercatorProjection.longitudeToTileX(minMaxX[1], Constant.OVER_ZOOM.toByte())
|
||||
val tileX0 = MercatorProjection.longitudeToTileX(minMaxX[0], Constant.DATA_ZOOM.toByte())
|
||||
val tileX1 = MercatorProjection.longitudeToTileX(minMaxX[1], Constant.DATA_ZOOM.toByte())
|
||||
val minTileX = if (tileX0 <= tileX1) tileX0 else tileX1
|
||||
val maxTileX = if (tileX0 <= tileX1) tileX1 else tileX0
|
||||
// println("getTileXByGeometry$envelope$minTileX===$maxTileX")
|
||||
|