diff --git a/app/src/main/assets/omdb_config.json b/app/src/main/assets/omdb_config.json index d7ac2a91..c09fe454 100644 --- a/app/src/main/assets/omdb_config.json +++ b/app/src/main/assets/omdb_config.json @@ -20,6 +20,19 @@ "code": 2010, "name": "道路方向" }, + "2013": { + "table": "OMDB_LANE_MARK_BOUNDARYTYPE", + "code": 2013, + "name": "车道边界类型", + "transformer": [ + { + "k": "geometry", + "v": "~", + "klib": "geometry", + "vlib": "unpackingLaneBoundary()" + } + ] + }, "2019": { "table": "OMDB_LINK_SPEEDLIMIT", "code": 2019, @@ -55,6 +68,11 @@ "code": 2041, "name": "车道数" }, + "2083":{ + "table": "OMDB_RDBOUND_BOUNDARYTYPE", + "code": 2083, + "name": "道路边界类型" + }, "2201":{ "table": "OMDB_BRIDGE", "code": 2201, @@ -131,7 +149,7 @@ "k": "geometry", "v": "~", "klib": "geometry", - "vlib": "translateRightWithAngle()" + "vlib": "generateRestrictionRerference()" } ] }, diff --git a/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt b/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt index 51bebc84..99abeeb1 100644 --- a/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt +++ b/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt @@ -1,7 +1,11 @@ package com.navinfo.omqs.db +import com.navinfo.collect.library.data.entity.ReferenceEntity import com.navinfo.collect.library.data.entity.RenderEntity import com.navinfo.collect.library.utils.GeometryTools +import io.realm.Realm +import org.json.JSONArray +import org.json.JSONObject import org.locationtech.jts.algorithm.Angle import org.locationtech.jts.geom.Coordinate import org.locationtech.jts.geom.Geometry @@ -60,7 +64,9 @@ class ImportPreProcess { var radian = 0.0 // geometry的角度,如果是点,获取angle,如果是线,获取最后两个点的方向 var point = Coordinate(geometry?.coordinate) if (Geometry.TYPENAME_POINT == geometry?.geometryType) { - val angle = if(renderEntity?.properties?.get("angle") == null) 0.0 else renderEntity?.properties?.get("angle")?.toDouble()!! + // angle为正北方向夹角,需要将其转换为与正东方向夹角 + var angle = if(renderEntity?.properties?.get("angle") == null) 0.0 else renderEntity?.properties?.get("angle")?.toDouble()!! + angle-=90 radian = Math.toRadians(angle) } else if (Geometry.TYPENAME_LINESTRING == geometry?.geometryType) { val p1: Coordinate = geometry.coordinates.get(geometry.coordinates.size - 2) @@ -77,6 +83,7 @@ class ImportPreProcess { // 计算偏移后的点 // val coordMid = // Coordinate(point.getX() + dy, point.getY() - dx) + // 计算指定距离外与当前位置成90度夹角的点位 val pointStart = GeoPoint(point.getY() - dx, point.getX() + dy) // val pointStart = GeoPoint(pointMid.latitude-dy, pointMid.longitude-dx) val pointEnd = GeoPoint(pointStart.latitude- dx, pointStart.longitude+ dy) @@ -107,4 +114,66 @@ class ImportPreProcess { } return "0" } + + /** + * 解析车道边线数据二级属性 + * */ + fun unpackingLaneBoundary(renderEntity: RenderEntity) { + if (renderEntity.code == 2013&&!renderEntity.properties["shapeList"].isNullOrEmpty()&&renderEntity.properties["shapeList"]!="null") { + // 解析shapeList,将数组中的属性放会properties + val shapeList = JSONArray(renderEntity.properties["shapeList"]) + val shape = shapeList.getJSONObject(0) + for (key in shape.keys()) { + renderEntity.properties[key] = shape[key].toString() + } + } + } + + /** + * 自动生成普通交限的参考数据 + * */ + fun generateRestrictionRerference(renderEntity: RenderEntity) { + // 获取当前renderEntity的geometry + val geometry = renderEntity.wkt + var radian = 0.0 // geometry的角度,如果是点,获取angle,如果是线,获取最后两个点的方向 + var point = Coordinate(geometry?.coordinate) + if (Geometry.TYPENAME_POINT == geometry?.geometryType) { + var angle = if(renderEntity?.properties?.get("angle") == null) 0.0 else renderEntity?.properties?.get("angle")?.toDouble()!! + radian = Math.toRadians(angle) + } + + // 计算偏移距离 + val dx: Double = GeometryTools.convertDistanceToDegree(3.0, geometry?.coordinate?.y!!) * Math.sin(radian) + val dy: Double = GeometryTools.convertDistanceToDegree(3.0, geometry?.coordinate?.y!!) * Math.cos(radian) + + // 计算偏移后的点 + val pointTranS = + GeoPoint(point.getY() - dx, point.getX() + dy) // 向右偏移的点 + + // 计算与原有方向平行的终点坐标 + val pointTranE = GeoPoint(pointTranS.latitude + dy, pointTranS.longitude + dx) + + renderEntity.geometry = GeometryTools.createGeometry(pointTranS).toString() + + // 将这个点记录在数据中 + val startEndReference = ReferenceEntity() + startEndReference.renderEntityId = renderEntity.id + startEndReference.name = "普通交限参考线" + startEndReference.table = renderEntity.table + // 起终点坐标组成的线 + startEndReference.geometry = GeometryTools.createLineString(listOf(GeoPoint(point.y, point.x), pointTranS)).toString() + startEndReference.properties["qi_table"] = renderEntity.table + startEndReference.properties["type"] = "s_2_e" + Realm.getDefaultInstance().insert(startEndReference) + + val angleReference = ReferenceEntity() + angleReference.renderEntityId = renderEntity.id + angleReference.name = "普通交限参考方向" + angleReference.table = renderEntity.table + // 与原有方向指向平行的线 + angleReference.geometry = GeometryTools.createLineString(listOf(pointTranS, pointTranE)).toString() + angleReference.properties["qi_table"] = renderEntity.table + angleReference.properties["type"] = "angle" + Realm.getDefaultInstance().insert(angleReference) + } } \ No newline at end of file diff --git a/app/src/main/java/com/navinfo/omqs/ui/activity/login/LoginViewModel.kt b/app/src/main/java/com/navinfo/omqs/ui/activity/login/LoginViewModel.kt index 520c3332..42665c08 100644 --- a/app/src/main/java/com/navinfo/omqs/ui/activity/login/LoginViewModel.kt +++ b/app/src/main/java/com/navinfo/omqs/ui/activity/login/LoginViewModel.kt @@ -228,7 +228,7 @@ class LoginViewModel @Inject constructor( .name("OMQS.realm") .encryptionKey(password) // .modules(Realm.getDefaultModule(), MyRealmModule()) - .schemaVersion(1) + .schemaVersion(2) .build() Realm.setDefaultConfiguration(config) // 拷贝配置文件到用户目录下 diff --git a/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterFragment.kt b/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterFragment.kt index 1e5e5a81..5d53c83a 100644 --- a/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterFragment.kt +++ b/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterFragment.kt @@ -111,7 +111,7 @@ class PersonalCenterFragment : BaseFragment(), FSAFActivityCallbacks { viewModel.readRealmData() // 定位到指定位置 niMapController.mMapView.vtmMap.animator() - .animateTo(GeoPoint(28.724637921467508 ,115.83412668023867 )) + .animateTo(GeoPoint(40.031657799200346, 116.32207834810715 )) } R.id.personal_center_menu_task_list -> { findNavController().navigate(R.id.TaskManagerFragment) diff --git a/collect-library/src/main/assets/editormarker.xml b/collect-library/src/main/assets/editormarker.xml index 7815f74b..3c3395da 100644 --- a/collect-library/src/main/assets/editormarker.xml +++ b/collect-library/src/main/assets/editormarker.xml @@ -173,6 +173,9 @@ + + + @@ -1651,81 +1654,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1733,81 +1661,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1855,6 +1708,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1874,11 +1791,15 @@ - - - - - + + + + + + + + + \ No newline at end of file diff --git a/collect-library/src/main/assets/omdb/icon_arrow_right.png b/collect-library/src/main/assets/omdb/icon_arrow_right.png new file mode 100644 index 00000000..b0246785 Binary files /dev/null and b/collect-library/src/main/assets/omdb/icon_arrow_right.png differ diff --git a/collect-library/src/main/assets/omdb/icon_close.png b/collect-library/src/main/assets/omdb/icon_close.png new file mode 100644 index 00000000..33cb1884 Binary files /dev/null and b/collect-library/src/main/assets/omdb/icon_close.png differ diff --git a/collect-library/src/main/assets/omdb/icon_right.png b/collect-library/src/main/assets/omdb/icon_right.png new file mode 100644 index 00000000..949982b5 Binary files /dev/null and b/collect-library/src/main/assets/omdb/icon_right.png differ diff --git a/collect-library/src/main/java/com/navinfo/collect/library/data/entity/ReferenceEntity.kt b/collect-library/src/main/java/com/navinfo/collect/library/data/entity/ReferenceEntity.kt new file mode 100644 index 00000000..5697cd25 --- /dev/null +++ b/collect-library/src/main/java/com/navinfo/collect/library/data/entity/ReferenceEntity.kt @@ -0,0 +1,64 @@ +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.Ignore +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 ReferenceEntity() : RealmObject() { + @PrimaryKey + var id: String = UUID.randomUUID().toString() // id + var renderEntityId: String = "" // 参考的renderEntity的Id + lateinit var name: String //要素名 + lateinit var table: String //要素表名 + var code: Int = 0 // 要素编码 + var geometry: String = "" // 要素渲染参考的geometry,该数据可能会在导入预处理环节被修改,原始geometry会保存在properties的geometry字段下 + get() { + wkt = GeometryTools.createGeometry(field) + return field + } + set(value) { + field = value + // 根据geometry自动计算当前要素的x-tile和y-tile + GeometryToolsKt.getTileXByGeometry(value, tileX) + GeometryToolsKt.getTileYByGeometry(value, tileY) + // 根据传入的geometry文本,自动转换为Geometry对象 + try { + wkt = GeometryTools.createGeometry(value) + } catch (e: Exception) { + + } + } + + @Ignore + var wkt: Geometry? = null + get() { + if (field == null || field!!.isEmpty) { + try { + field = GeometryTools.createGeometry(geometry) + } catch (e: Exception) { + + } + } + return field + } + var properties: RealmDictionary = RealmDictionary() + var tileX: RealmSet = RealmSet() // x方向的tile编码 + var tileY: RealmSet = RealmSet() // y方向的tile编码 + + constructor(name: String): this() { + this.name = name + } + +} \ No newline at end of file diff --git a/collect-library/src/main/java/com/navinfo/collect/library/map/handler/LayerManagerHandler.kt b/collect-library/src/main/java/com/navinfo/collect/library/map/handler/LayerManagerHandler.kt index ba22bce1..75aafa44 100644 --- a/collect-library/src/main/java/com/navinfo/collect/library/map/handler/LayerManagerHandler.kt +++ b/collect-library/src/main/java/com/navinfo/collect/library/map/handler/LayerManagerHandler.kt @@ -4,6 +4,7 @@ import androidx.appcompat.app.AppCompatActivity import com.navinfo.collect.library.map.NIMapView import com.navinfo.collect.library.map.source.MapLifeNiLocationTileSource import com.navinfo.collect.library.map.source.NavinfoMultiMapFileTileSource +import com.navinfo.collect.library.map.source.OMDBReferenceTileSource import com.navinfo.collect.library.map.source.OMDBTileSource import com.navinfo.collect.library.system.Constant import okhttp3.Cache @@ -45,9 +46,12 @@ class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tracePa * 显示待测评OMDB数据的图层 * */ private lateinit var omdbVectorTileLayer: VectorTileLayer + private lateinit var omdbReferenceTileLayer: VectorTileLayer private lateinit var omdbLabelLayer: LabelLayer + private lateinit var omdbReferenceLabelLayer: LabelLayer private val omdbTileSource by lazy { OMDBTileSource() } + private val omdbReferenceTileSource by lazy { OMDBReferenceTileSource() } init { initMap() @@ -99,6 +103,7 @@ class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tracePa } private fun initOMDBVectorTileLayer() { + // 初始化OMDB相关图层 omdbVectorTileLayer = VectorTileLayer(mMapView.vtmMap, omdbTileSource) omdbLabelLayer = LabelLayer(mMapView.vtmMap, omdbVectorTileLayer, LabelTileLoaderHook(), Constant.OMDB_MIN_ZOOM) if(omdbVectorTileLayer!=null){ @@ -107,6 +112,16 @@ class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tracePa if(omdbLabelLayer!=null){ addLayer(omdbLabelLayer, NIMapView.LAYER_GROUPS.VECTOR_TILE) } + + // 初始化OMDB参考相关图层 + omdbReferenceTileLayer = VectorTileLayer(mMapView.vtmMap, omdbReferenceTileSource) + omdbReferenceLabelLayer = LabelLayer(mMapView.vtmMap, omdbReferenceTileLayer, LabelTileLoaderHook(), Constant.OMDB_MIN_ZOOM) + if(omdbReferenceTileLayer!=null){ + addLayer(omdbReferenceTileLayer,NIMapView.LAYER_GROUPS.VECTOR_TILE) + } + if(omdbReferenceLabelLayer!=null){ + addLayer(omdbReferenceLabelLayer, NIMapView.LAYER_GROUPS.VECTOR_TILE) + } } /** diff --git a/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceDataSource.java b/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceDataSource.java new file mode 100644 index 00000000..917f632e --- /dev/null +++ b/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceDataSource.java @@ -0,0 +1,71 @@ +package com.navinfo.collect.library.map.source; + +import android.os.Build; + +import androidx.annotation.RequiresApi; + +import com.navinfo.collect.library.data.entity.ReferenceEntity; +import com.navinfo.collect.library.system.Constant; + +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 io.realm.Realm; +import io.realm.RealmQuery; + +public class OMDBReferenceDataSource implements ITileDataSource { + private final ThreadLocal mThreadLocalDecoders = new ThreadLocal() { + @Override + protected OMDBReferenceDecoder initialValue() { + return new OMDBReferenceDecoder(); + } + }; + + @RequiresApi(api = Build.VERSION_CODES.N) + @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< realmQuery = Realm.getDefaultInstance().where(ReferenceEntity.class) + .rawPredicate("tileX>="+xStart+" and tileX<="+xEnd+" and tileY>="+yStart+" and tileY<="+yEnd); + // 筛选不显示的数据 + if (Constant.HAD_LAYER_INVISIABLE_ARRAY!=null&&Constant.HAD_LAYER_INVISIABLE_ARRAY.length>0) { + realmQuery.beginGroup(); + for (String type: Constant.HAD_LAYER_INVISIABLE_ARRAY) { + realmQuery.notEqualTo("table", type); + } + realmQuery.endGroup(); + } + List listResult = realmQuery/*.distinct("id")*/.findAll(); + if (!listResult.isEmpty()) { + mThreadLocalDecoders.get().decode(tile, mapDataSink, listResult); + } + mapDataSink.completed(QueryResult.SUCCESS); +// Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString()); + } else { + mapDataSink.completed(QueryResult.SUCCESS); + } + } + + @Override + public void dispose() { + + } + + @Override + public void cancel() { + if (Realm.getDefaultInstance().isInTransaction()) { + Realm.getDefaultInstance().cancelTransaction(); + } + } +} diff --git a/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceDecoder.java b/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceDecoder.java new file mode 100644 index 00000000..d859fde9 --- /dev/null +++ b/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceDecoder.java @@ -0,0 +1,186 @@ +package com.navinfo.collect.library.map.source; + +import static org.oscim.core.MercatorProjection.latitudeToY; +import static org.oscim.core.MercatorProjection.longitudeToX; + +import android.os.Build; + +import androidx.annotation.RequiresApi; + +import com.navinfo.collect.library.data.entity.ReferenceEntity; + +import org.locationtech.jts.geom.Coordinate; +import org.locationtech.jts.geom.Geometry; +import org.locationtech.jts.geom.GeometryFactory; +import org.locationtech.jts.geom.LineString; +import org.locationtech.jts.geom.MultiLineString; +import org.locationtech.jts.geom.MultiPoint; +import org.locationtech.jts.geom.MultiPolygon; +import org.locationtech.jts.geom.Point; +import org.locationtech.jts.geom.Polygon; +import org.oscim.core.MapElement; +import org.oscim.core.Tag; +import org.oscim.core.Tile; +import org.oscim.tiling.ITileDataSink; +import org.oscim.tiling.source.mvt.TileDecoder; + +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; + +public class OMDBReferenceDecoder extends TileDecoder { + private final String mLocale; + + private static final float REF_TILE_SIZE = 4096.0f; + + private final GeometryFactory mGeomFactory; + private final MapElement mMapElement; + private ITileDataSink mTileDataSink; + private double mTileY, mTileX, mTileScale; + + public OMDBReferenceDecoder() { + super(); + mLocale = ""; + mGeomFactory = new GeometryFactory(); + mMapElement = new MapElement(); + mMapElement.layer = 5; + } + + @Override + public boolean decode(Tile tile, ITileDataSink sink, InputStream is) throws IOException { + mTileDataSink = sink; + mTileScale = 1 << tile.zoomLevel; + mTileX = tile.tileX / mTileScale; + mTileY = tile.tileY / mTileScale; + mTileScale *= Tile.SIZE; + return true; + } + + @RequiresApi(api = Build.VERSION_CODES.N) + public boolean decode(Tile tile, ITileDataSink sink, List listResult) { + mTileDataSink = sink; + mTileScale = 1 << tile.zoomLevel; + mTileX = tile.tileX / mTileScale; + mTileY = tile.tileY / mTileScale; + mTileScale *= Tile.SIZE; + + listResult.stream().iterator().forEachRemaining(new Consumer() { + @Override + public void accept(ReferenceEntity renderEntity) { +// Log.d("RealmDBTileDataSource", renderEntity.getGeometry()); + Map properties= new HashMap<>(renderEntity.getProperties().size()); + properties.putAll(renderEntity.getProperties()); + parseGeometry(renderEntity.getTable(), renderEntity.getWkt(), properties); + } + }); + return true; + } + + public void parseGeometry(String layerName, Geometry geometry, Map tags) { + mMapElement.clear(); + mMapElement.tags.clear(); + + parseTags(tags, layerName); + if (mMapElement.tags.size() == 0) { + return; + } + + boolean err = false; + if (geometry instanceof Point) { + mMapElement.startPoints(); + processCoordinateArray(geometry.getCoordinates(), false); + } else if (geometry instanceof MultiPoint) { + MultiPoint multiPoint = (MultiPoint) geometry; + for (int i = 0; i < multiPoint.getNumGeometries(); i++) { + mMapElement.startPoints(); + processCoordinateArray(multiPoint.getGeometryN(i).getCoordinates(), false); + } + } else if (geometry instanceof LineString) { + processLineString((LineString) geometry); + } else if (geometry instanceof MultiLineString) { + MultiLineString multiLineString = (MultiLineString) geometry; + for (int i = 0; i < multiLineString.getNumGeometries(); i++) { + processLineString((LineString) multiLineString.getGeometryN(i)); + } + } else if (geometry instanceof Polygon) { + Polygon polygon = (Polygon) geometry; + processPolygon(polygon); + } else if (geometry instanceof MultiPolygon) { + MultiPolygon multiPolygon = (MultiPolygon) geometry; + for (int i = 0; i < multiPolygon.getNumGeometries(); i++) { + processPolygon((Polygon) multiPolygon.getGeometryN(i)); + } + } else { + err = true; + } + + if (!err) { + mTileDataSink.process(mMapElement); + } + } + + private void processLineString(LineString lineString) { + mMapElement.startLine(); + processCoordinateArray(lineString.getCoordinates(), false); + } + + private void processPolygon(Polygon polygon) { + mMapElement.startPolygon(); + processCoordinateArray(polygon.getExteriorRing().getCoordinates(), true); + for (int i = 0; i < polygon.getNumInteriorRing(); i++) { + mMapElement.startHole(); + processCoordinateArray(polygon.getInteriorRingN(i).getCoordinates(), true); + } + } + + private void processCoordinateArray(Coordinate[] coordinates, boolean removeLast) { + int length = removeLast ? coordinates.length - 1 : coordinates.length; + for (int i = 0; i < length; i++) { + mMapElement.addPoint((float) ((longitudeToX(coordinates[i].x) - mTileX) * mTileScale), + (float) ((latitudeToY(coordinates[i].y) - mTileY) * mTileScale)); + } + +// int length = removeLast ? coordinates.length - 1 : coordinates.length; +// // 初始化3D数据类型 +// float[] point3D = new float[coordinates.length*3]; +// for (int i = 0; i < length; i++) { +// point3D[i*3] = (float) coordinates[i].x; +// point3D[(i*3)+1] = (float) coordinates[i].y; +// point3D[(i*3)+2] = (float) coordinates[i].z; +// } +// mMapElement.points = point3D; +// mMapElement.pointNextPos = mMapElement.points.length; +// mMapElement.type = GeometryBuffer.GeometryType.TRIS; + } + + private void parseTags(Map map, String layerName) { + mMapElement.tags.add(new Tag("layer", layerName)); + boolean hasName = false; + String fallbackName = null; + for (Map.Entry entry : map.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + String val = (value instanceof String) ? (String) value : String.valueOf(value); + if (key.startsWith(Tag.KEY_NAME)) { + int len = key.length(); + if (len == 4) { + fallbackName = val; + continue; + } + if (len < 7) + continue; + if (mLocale.equals(key.substring(5))) { + hasName = true; + mMapElement.tags.add(new Tag(Tag.KEY_NAME, val, false)); + } + } else { + mMapElement.tags.add(new Tag(key, val)); + } + } + if (!hasName && fallbackName != null) + mMapElement.tags.add(new Tag(Tag.KEY_NAME, fallbackName, false)); + } +} diff --git a/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceTileSource.java b/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceTileSource.java new file mode 100644 index 00000000..aa661822 --- /dev/null +++ b/collect-library/src/main/java/com/navinfo/collect/library/map/source/OMDBReferenceTileSource.java @@ -0,0 +1,25 @@ +package com.navinfo.collect.library.map.source; + +import com.navinfo.collect.library.system.Constant; + +import org.oscim.tiling.ITileDataSource; +import org.oscim.tiling.OverzoomTileDataSource; +import org.oscim.tiling.TileSource; + +public class OMDBReferenceTileSource extends TileSource { + + @Override + public ITileDataSource getDataSource() { + return new OverzoomTileDataSource(new OMDBReferenceDataSource(), Constant.OVER_ZOOM); + } + + @Override + public OpenResult open() { + return OpenResult.SUCCESS; + } + + @Override + public void close() { + + } +}