This commit is contained in:
qiji4215 2023-09-27 16:21:25 +08:00
commit 37de10fe89
21 changed files with 135 additions and 49 deletions

View File

@ -181,6 +181,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,
@ -281,6 +298,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,

View File

@ -92,11 +92,6 @@ class Constant {
const val DEBUG = true
/**
* 地图最多缩放级别20
*/
const val MAX_ZOOM = 20
/**
* 是否自动定位
*/

View File

@ -844,8 +844,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()
}
}
}

View File

@ -190,7 +190,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转递对象

View File

@ -178,7 +178,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 -> {

View File

@ -1851,6 +1851,21 @@
<symbol repeat="false" repeat-start="0" gland="false" repeat-gap="0" 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" src="assets:omdb/tex_fill_area_3027_1.svg"></area>
</m>
<m k="type" v="2">
<area use="obj-area" repeat="true" src="assets:omdb/tex_fill_area_3027_2.svg"></area>
</m>
</m>
<!-- 停止位置 -->
<m v="OMDB_OBJECT_STOPLOCATION">
@ -1960,26 +1975,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>

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="124.7" height="124.7" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 124.7 124.7"><defs><linearGradient id="f" x1="60.1" y1="37.3" x2="64.9" y2="37.3" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#989898"/><stop offset="0" stop-color="#a3a3a3"/><stop offset=".1" stop-color="#c4c5c5"/><stop offset=".2" stop-color="#d8d9d9"/><stop offset=".3" stop-color="#e0e1e1"/><stop offset=".4" stop-color="#dbdcdc"/><stop offset=".5" stop-color="#cccece"/><stop offset=".6" stop-color="#b5b6b7"/><stop offset=".7" stop-color="#949697"/><stop offset=".8" stop-color="#6a6c6f"/><stop offset=".8" stop-color="#3f4246"/><stop offset="1" stop-color="#404247"/><stop offset="1" stop-color="#43434a"/></linearGradient><linearGradient id="g" x1="29.2" y1="14.8" x2="95.5" y2="14.8" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#afbacb"/><stop offset=".1" stop-color="#c1ccda"/><stop offset=".4" stop-color="#d9e6f0"/><stop offset=".5" stop-color="#e3f0f8"/><stop offset=".6" stop-color="#dde9f2"/><stop offset=".8" stop-color="#ccd8e4"/><stop offset="1" stop-color="#b1bbcc"/><stop offset="1" stop-color="#aeb8c9"/></linearGradient><clipPath id="h"><rect x="29.7" y=".9" width="65.3" height="27.7" rx="4.6" ry="4.6" style="fill:#3a77d1;"/></clipPath></defs><g style="isolation:isolate;"><g id="b"><g id="c"><rect width="124.7" height="124.7" style="fill:#535a60; opacity:0;"/><ellipse id="d" cx="62.4" cy="61.3" rx="14.4" ry="3.7" style="fill:#262d34; isolation:isolate; opacity:.2;"/><ellipse id="e" cx="62.4" cy="61.3" rx="7.5" ry="3" style="fill:#535a60;"/><path d="M62.4,12.6h0c1.4,0,2.6,1.2,2.6,2.6V59.6c0,1.4-1.1,2.5-2.5,2.5h-.3c-1.4,0-2.5-1.1-2.5-2.5V15.2c0-1.4,1.2-2.6,2.6-2.6Z" style="fill:url(#f);"/><g><rect x="29.2" y=".5" width="66.3" height="28.7" rx="4.6" ry="4.6" style="fill:url(#g); stroke:#8b9fae; stroke-miterlimit:10; stroke-width:.9px;"/><g><rect x="29.7" y=".9" width="65.3" height="27.7" rx="4.6" ry="4.6" style="fill:#3a77d1;"/><g style="clip-path:url(#h);"><polygon points="37.5 28.6 27.5 28.6 43.4 .9 53.3 .9 37.5 28.6" style="fill:#30313d; mix-blend-mode:color-dodge;"/><polygon points="58.2 28.6 48.2 28.6 64.1 .9 74 .9 58.2 28.6" style="fill:#30313d; mix-blend-mode:color-dodge;"/><polygon points="79.2 28.6 69.2 28.6 85.1 .9 95 .9 79.2 28.6" style="fill:#30313d; mix-blend-mode:color-dodge;"/></g></g><text transform="translate(39.4 20.7)" style="fill:#fff; font-family:AlibabaPuHuiTiM-GBpc-EUC-H, &apos;Alibaba PuHuiTi&apos;; font-size:15.6px;"><tspan x="0" y="0">障碍物</tspan></text><rect x="29.7" y=".9" width="65.3" height="27.7" rx="4.6" ry="4.6" style="fill:none; stroke:#fff; stroke-miterlimit:10; stroke-width:.9px;"/></g></g></g></g></svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.2 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

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

View File

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

View File

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

View File

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

View File

@ -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;
/**

View File

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