Merge branch 'master' of https://gitlab.navinfo.com/qiji4215/OneMapQS
Conflicts: app/src/main/java/com/navinfo/omqs/OMQSApplication.kt
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package com.navinfo.collect.library.data.entity
|
||||
|
||||
import io.realm.RealmDictionary
|
||||
import io.realm.RealmObject
|
||||
import io.realm.annotations.PrimaryKey
|
||||
|
||||
open class OMDBEntity(): RealmObject() {
|
||||
@PrimaryKey
|
||||
var id: Long = 0
|
||||
lateinit var table: String
|
||||
lateinit var properties: RealmDictionary<String?>
|
||||
|
||||
constructor(table: String, properties: RealmDictionary<String?>): this() {
|
||||
this.table = table
|
||||
this.properties = properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.navinfo.collect.library.data.entity
|
||||
|
||||
import com.navinfo.collect.library.system.Constant
|
||||
import com.navinfo.collect.library.utils.GeometryTools
|
||||
import com.navinfo.collect.library.utils.GeometryToolsKt
|
||||
import io.realm.RealmDictionary
|
||||
import io.realm.RealmObject
|
||||
import io.realm.RealmSet
|
||||
import io.realm.annotations.PrimaryKey
|
||||
import org.locationtech.jts.geom.Coordinate
|
||||
import org.locationtech.jts.geom.Geometry
|
||||
import org.oscim.core.MercatorProjection
|
||||
|
||||
/**
|
||||
* 渲染要素对应的实体
|
||||
* */
|
||||
open class RenderEntity(): RealmObject() {
|
||||
@PrimaryKey
|
||||
var id: Long = 0 // id
|
||||
lateinit var name: String //要素名
|
||||
var code: Int = 0 // 要素编码
|
||||
var geometry: String = ""
|
||||
get() = field
|
||||
set(value) {
|
||||
field = value
|
||||
// 根据geometry自动计算当前要素的x-tile和y-tile
|
||||
GeometryToolsKt.getTileXByGeometry(value, tileX)
|
||||
GeometryToolsKt.getTileYByGeometry(value, tileY)
|
||||
}
|
||||
lateinit var properties: RealmDictionary<String?>
|
||||
val tileX: RealmSet<Int> = RealmSet() // x方向的tile编码
|
||||
val tileY: RealmSet<Int> = RealmSet() // y方向的tile编码
|
||||
|
||||
constructor(name: String, properties: RealmDictionary<String?>): this() {
|
||||
this.name = name
|
||||
this.properties = properties
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ class NIMapController {
|
||||
measureLayerHandler = MeasureLayerHandler(context, mapView)
|
||||
mMapView = mapView
|
||||
mapView.setOptions(options)
|
||||
mMapView.vtmMap.viewport().maxZoomLevel = Constant.MAX_ZOOM // 设置地图的最大级别
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ public class Constant {
|
||||
HAD_LAYER_INVISIABLE_ARRAY = HD_LAYER_VISIABLE_MAP.keySet().toArray(new String[HD_LAYER_VISIABLE_MAP.keySet().size()]);
|
||||
}
|
||||
public static String[] HAD_LAYER_INVISIABLE_ARRAY;
|
||||
public static final int OVER_ZOOM = 23;
|
||||
public static final int OVER_ZOOM = 21;
|
||||
public static final int MAX_ZOOM = 25;
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,6 @@ public class GeometryTools {
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
return createMultiPoint;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.navinfo.collect.library.utils
|
||||
|
||||
import com.navinfo.collect.library.system.Constant
|
||||
import io.realm.RealmSet
|
||||
import org.locationtech.jts.geom.Geometry
|
||||
import org.locationtech.jts.io.WKTReader
|
||||
@@ -10,7 +11,7 @@ class GeometryToolsKt {
|
||||
/**
|
||||
* 根据给定的geometry计算其横跨的20级瓦片Y值
|
||||
*/
|
||||
fun getTileYByGeometry(wkt: String, tileYSet: MutableSet<Int?>){
|
||||
fun getTileYByGeometry(wkt: String, tileYSet: MutableSet<Int?>) {
|
||||
|
||||
val reader = WKTReader()
|
||||
val geometry = reader.read(wkt);
|
||||
@@ -37,8 +38,8 @@ class GeometryToolsKt {
|
||||
}
|
||||
}
|
||||
// 分别计算最大和最小x值对应的tile号
|
||||
val tileY0 = MercatorProjection.latitudeToTileY(minMaxY[0], 20.toByte())
|
||||
val tileY1 = MercatorProjection.latitudeToTileY(minMaxY[1], 20.toByte())
|
||||
val tileY0 = MercatorProjection.latitudeToTileY(minMaxY[0], Constant.OVER_ZOOM.toByte())
|
||||
val tileY1 = MercatorProjection.latitudeToTileY(minMaxY[1], Constant.OVER_ZOOM.toByte())
|
||||
val minTileY = if (tileY0 <= tileY1) tileY0 else tileY1
|
||||
val maxTileY = if (tileY0 <= tileY1) tileY1 else tileY0
|
||||
println("getTileYByGeometry$envelope===$minTileY===$maxTileY")
|
||||
@@ -81,8 +82,8 @@ class GeometryToolsKt {
|
||||
}
|
||||
}
|
||||
// 分别计算最大和最小x值对应的tile号
|
||||
val tileX0 = MercatorProjection.longitudeToTileX(minMaxX[0], 20.toByte())
|
||||
val tileX1 = MercatorProjection.longitudeToTileX(minMaxX[1], 20.toByte())
|
||||
val tileX0 = MercatorProjection.longitudeToTileX(minMaxX[0], Constant.OVER_ZOOM.toByte())
|
||||
val tileX1 = MercatorProjection.longitudeToTileX(minMaxX[1], Constant.OVER_ZOOM.toByte())
|
||||
val minTileX = if (tileX0 <= tileX1) tileX0 else tileX1
|
||||
val maxTileX = if (tileX0 <= tileX1) tileX1 else tileX0
|
||||
println("getTileXByGeometry$envelope$minTileX===$maxTileX")
|
||||
|
||||
Reference in New Issue
Block a user