feat: Realm增加查询Link的接口
This commit is contained in:
@@ -10,14 +10,16 @@ import io.realm.annotations.PrimaryKey
|
||||
import org.locationtech.jts.geom.Coordinate
|
||||
import org.locationtech.jts.geom.Geometry
|
||||
import org.oscim.core.MercatorProjection
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* 渲染要素对应的实体
|
||||
* */
|
||||
open class RenderEntity(): RealmObject() {
|
||||
@PrimaryKey
|
||||
var id: Long = 0 // id
|
||||
var id: String = UUID.randomUUID().toString() // id
|
||||
lateinit var name: String //要素名
|
||||
lateinit var table: String //要素表名
|
||||
var code: Int = 0 // 要素编码
|
||||
var geometry: String = ""
|
||||
get() = field
|
||||
@@ -27,7 +29,7 @@ open class RenderEntity(): RealmObject() {
|
||||
GeometryToolsKt.getTileXByGeometry(value, tileX)
|
||||
GeometryToolsKt.getTileYByGeometry(value, tileY)
|
||||
}
|
||||
lateinit var properties: RealmDictionary<String?>
|
||||
var properties: RealmDictionary<String?> = RealmDictionary()
|
||||
val tileX: RealmSet<Int> = RealmSet() // x方向的tile编码
|
||||
val tileY: RealmSet<Int> = RealmSet() // y方向的tile编码
|
||||
|
||||
|
||||
@@ -327,6 +327,26 @@ public class GeometryTools {
|
||||
return point;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据经纬度构建一个Point类型的数据
|
||||
*
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @return Point类型的数据
|
||||
*/
|
||||
public static org.locationtech.jts.geom.Point createPoint(double lon, double lat) {
|
||||
// 创建Coordinate对象
|
||||
Coordinate coordinate = new Coordinate(lon, lat);
|
||||
|
||||
// 创建GeometryFactory对象
|
||||
GeometryFactory geometryFactory = new GeometryFactory();
|
||||
|
||||
// 创建Point对象
|
||||
|
||||
|
||||
return geometryFactory.createPoint(coordinate);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 点几何转换为GeoPoint
|
||||
|
||||
@@ -11,12 +11,12 @@ 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);
|
||||
|
||||
var tileYSet: MutableSet<Int?>? = tileYSet
|
||||
var tileYSet: MutableSet<Int>? = tileYSet
|
||||
val startTime = System.currentTimeMillis()
|
||||
if (tileYSet == null) {
|
||||
tileYSet = RealmSet()
|
||||
@@ -55,11 +55,11 @@ class GeometryToolsKt {
|
||||
/**
|
||||
* 根据给定的geometry计算其横跨的20级瓦片X值
|
||||
*/
|
||||
fun getTileXByGeometry(wkt: String, tileXSet: MutableSet<Int?>) {
|
||||
fun getTileXByGeometry(wkt: String, tileXSet: MutableSet<Int>) {
|
||||
val reader = WKTReader()
|
||||
val geometry = reader.read(wkt);
|
||||
|
||||
var tileXSet: MutableSet<Int?>? = tileXSet
|
||||
var tileXSet: MutableSet<Int>? = tileXSet
|
||||
val startTime = System.currentTimeMillis()
|
||||
if (tileXSet == null) {
|
||||
tileXSet = RealmSet()
|
||||
|
||||
Reference in New Issue
Block a user