Merge branch 'master' of https://gitlab.navinfo.com/CollectVehicle/OneMapQS
This commit is contained in:
commit
a8d88a2ada
@ -61,7 +61,7 @@ class ImportPreProcess {
|
||||
) {
|
||||
var angle = renderEntity?.properties?.get("angle")?.toDouble()!!
|
||||
// angle角度为与正北方向的顺时针夹角,将其转换为与X轴正方向的逆时针夹角,即为正东方向的夹角
|
||||
angle = -((450 - angle) % 360)
|
||||
angle = ((450 - angle) % 360)
|
||||
radian = Math.toRadians(angle)
|
||||
} else {
|
||||
var isReverse = false // 是否为逆向
|
||||
@ -138,7 +138,7 @@ class ImportPreProcess {
|
||||
// angle += 180
|
||||
// }
|
||||
// angle角度为与正北方向的顺时针夹角,将其转换为与X轴正方向的逆时针夹角,即为正东方向的夹角
|
||||
angle = -((450 - angle) % 360)
|
||||
angle = ((450 - angle) % 360)
|
||||
radian = Math.toRadians(angle)
|
||||
} else if (Geometry.TYPENAME_LINESTRING == geometry?.geometryType) {
|
||||
var coordinates = geometry.coordinates
|
||||
@ -327,7 +327,7 @@ class ImportPreProcess {
|
||||
"angle"
|
||||
)?.toDouble()!!
|
||||
// angle角度为与正北方向的顺时针夹角,将其转换为与X轴正方向的逆时针夹角,即为正东方向的夹角
|
||||
angle = -((450 - angle) % 360)
|
||||
angle = ((450 - angle) % 360)
|
||||
radian = Math.toRadians(angle)
|
||||
} else if (Geometry.TYPENAME_LINESTRING == geometry?.geometryType) {
|
||||
var coordinates = geometry.coordinates
|
||||
@ -351,7 +351,7 @@ class ImportPreProcess {
|
||||
}
|
||||
} else renderEntity?.properties?.get("angle")?.toDouble()!!
|
||||
|
||||
angle = -((450 - angle) % 360)
|
||||
angle = ((450 - angle) % 360)
|
||||
radian = Math.toRadians(angle)
|
||||
}
|
||||
|
||||
@ -735,7 +735,7 @@ class ImportPreProcess {
|
||||
"angle"
|
||||
)?.toDouble()!!
|
||||
// angle角度为与正北方向的顺时针夹角,将其转换为与X轴正方向的逆时针夹角,即为正东方向的夹角
|
||||
angle = -((450 - angle) % 360)
|
||||
angle = ((450 - angle) % 360)
|
||||
radian = Math.toRadians(angle)
|
||||
} else if (Geometry.TYPENAME_LINESTRING == geometry?.geometryType) {
|
||||
var coordinates = geometry.coordinates
|
||||
@ -756,7 +756,7 @@ class ImportPreProcess {
|
||||
}
|
||||
} else renderEntity?.properties?.get("angle")?.toDouble()!!
|
||||
|
||||
angle = -((450 - angle) % 360)
|
||||
angle = ((450 - angle) % 360)
|
||||
radian = Math.toRadians(angle)
|
||||
}
|
||||
|
||||
|
@ -1620,14 +1620,6 @@
|
||||
<symbol repeat="false" repeat-start="0" rotate="false"
|
||||
src="assets:omdb/icon_4023_0.svg" symbol-height="56" symbol-width="56"></symbol>
|
||||
</m>
|
||||
<!-- <m k="type" v="angle">
|
||||
<symbol repeat="false" repeat-gap="2000" repeat-start="0" rotate="true"
|
||||
src="assets:omdb/icon_arrow_right.svg" symbol-height="64"
|
||||
symbol-width="64"></symbol>
|
||||
</m>
|
||||
<m k="type" v="s_2_e">
|
||||
<line use="s2e" />
|
||||
</m>-->
|
||||
</m>
|
||||
<!-- 道路边界类型 -->
|
||||
<m v="OMDB_RDBOUND_BOUNDARYTYPE">
|
||||
@ -1921,13 +1913,13 @@
|
||||
<!--电子眼-->
|
||||
<m v="OMDB_ELECTRONICEYE">
|
||||
<m k="eleceyeId">
|
||||
<caption dy="-30" fill="#0000FF" k="name" priority="0" size="12"
|
||||
stroke="#ffffff" stroke-width="1.0"></caption>
|
||||
<caption dy="-12" fill="#ffffff" k="name" priority="0" size="11"
|
||||
stroke="#000000" stroke-width="1.0" bg-fill="#F98F03"></caption>
|
||||
<symbol repeat="false" src="assets:omdb/4010/icon_electroniceye_4010.svg" symbol-height="44" symbol-width="44"></symbol>
|
||||
</m>
|
||||
<m k="type" v="angle">
|
||||
<symbol repeat="false" repeat-gap="2000" repeat-start="0" rotate="true"
|
||||
src="assets:omdb/4010/right.svg" symbol-height="40" symbol-width="40"></symbol>
|
||||
src="assets:omdb/icon_arrow_right.svg" symbol-height="54" symbol-width="54"></symbol>
|
||||
</m>
|
||||
<m k="type" v="s_2_e">
|
||||
<line use="s2e" />
|
||||
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 5.5 KiB |
@ -7,14 +7,17 @@ import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.navinfo.collect.library.data.entity.ReferenceEntity;
|
||||
import com.navinfo.collect.library.system.Constant;
|
||||
import com.navinfo.collect.library.utils.GeometryTools;
|
||||
import com.navinfo.collect.library.utils.MapParamUtils;
|
||||
|
||||
import org.locationtech.jts.geom.Polygon;
|
||||
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 java.util.stream.Collectors;
|
||||
|
||||
import io.realm.Realm;
|
||||
import io.realm.RealmQuery;
|
||||
@ -33,7 +36,7 @@ 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) {
|
||||
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);
|
||||
@ -66,12 +69,16 @@ public class OMDBReferenceDataSource implements ITileDataSource {
|
||||
}
|
||||
List<ReferenceEntity> listResult = realmQuery/*.distinct("id")*/.findAll();
|
||||
if (!listResult.isEmpty()) {
|
||||
Polygon tilePolygon = GeometryTools.getTilePolygon(tile);
|
||||
listResult = listResult.stream().filter((ReferenceEntity referenceEntity) -> referenceEntity.getWkt().intersects(tilePolygon)).collect(Collectors.toList());
|
||||
mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult);
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
} else {
|
||||
mapDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
||||
}
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
Realm.getInstance(MapParamUtils.getTaskConfig()).close();
|
||||
} else {
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
mapDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,14 +7,17 @@ import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.navinfo.collect.library.data.entity.RenderEntity;
|
||||
import com.navinfo.collect.library.system.Constant;
|
||||
import com.navinfo.collect.library.utils.GeometryTools;
|
||||
import com.navinfo.collect.library.utils.MapParamUtils;
|
||||
|
||||
import org.locationtech.jts.geom.Polygon;
|
||||
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 java.util.stream.Collectors;
|
||||
|
||||
import io.realm.Realm;
|
||||
import io.realm.RealmQuery;
|
||||
@ -32,7 +35,7 @@ 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) {
|
||||
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);
|
||||
@ -62,13 +65,18 @@ public class OMDBTileDataSource implements ITileDataSource {
|
||||
realmQuery.endGroup();
|
||||
}
|
||||
List<RenderEntity> listResult = realmQuery/*.distinct("id")*/.findAll();
|
||||
// 数据记录的tile号是以正外接tile号列表,此处过滤并未与当前tile相交的数据
|
||||
if (!listResult.isEmpty()) {
|
||||
Polygon tilePolygon = GeometryTools.getTilePolygon(tile);
|
||||
listResult = listResult.stream().filter((RenderEntity renderEntity) -> renderEntity.getWkt().intersects(tilePolygon)).collect(Collectors.toList());
|
||||
mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult);
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
} else {
|
||||
mapDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
||||
}
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
Realm.getInstance(MapParamUtils.getTaskConfig()).close();
|
||||
} else {
|
||||
mapDataSink.completed(QueryResult.SUCCESS);
|
||||
mapDataSink.completed(QueryResult.TILE_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ import org.locationtech.jts.geom.Polygon;
|
||||
import org.locationtech.jts.io.WKTReader;
|
||||
import org.locationtech.jts.operation.linemerge.LineMerger;
|
||||
import org.oscim.core.GeoPoint;
|
||||
import org.oscim.core.MercatorProjection;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.map.Map;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -257,6 +259,22 @@ public class GeometryTools {
|
||||
return gon.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建多边形几何
|
||||
*
|
||||
* @param coords []
|
||||
* @return Geometry
|
||||
*/
|
||||
public static Polygon createPolygonFromCoords(Coordinate[] coords) {
|
||||
GeometryFactory factory = new GeometryFactory();
|
||||
|
||||
Polygon gon = factory.createPolygon(coords);
|
||||
|
||||
if (gon == null)
|
||||
return null;
|
||||
return gon;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建多边形几何
|
||||
*
|
||||
@ -1607,7 +1625,19 @@ public class GeometryTools {
|
||||
double radianDegree = 2 * Math.asin(Math.sin(radianDistance / 2) / Math.cos(radianLatitude));
|
||||
return Math.toDegrees(radianDegree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定tile对应的polygon面
|
||||
* @param tile vtm中的瓦片
|
||||
* */
|
||||
public static Polygon getTilePolygon(Tile tile) {
|
||||
// 获取当前tile的起点坐标
|
||||
double startLongitude = MercatorProjection.tileXToLongitude(tile.tileX, tile.zoomLevel);
|
||||
double startLatitude = MercatorProjection.tileYToLatitude(tile.tileY, tile.zoomLevel);
|
||||
double endLongitude = MercatorProjection.tileXToLongitude(tile.tileX + 1, tile.zoomLevel);
|
||||
double endLatitude = MercatorProjection.tileYToLatitude(tile.tileY + 1, tile.zoomLevel);
|
||||
return GeometryTools.createPolygonFromCoords(new Coordinate[]{new Coordinate(startLongitude, startLongitude), new Coordinate(endLongitude, startLatitude),
|
||||
new Coordinate(endLongitude, endLatitude), new Coordinate(startLongitude, endLatitude), new Coordinate(startLongitude, startLongitude)});
|
||||
}
|
||||
/**
|
||||
* 经纬度转墨卡托
|
||||
*/
|
||||
|
2
vtm
2
vtm
@ -1 +1 @@
|
||||
Subproject commit 3ea6a7c90627e6e8ea10b3896004d9082167a7ff
|
||||
Subproject commit d1ac330cf7a8727bb2065093e72d60521775ba6d
|
Loading…
x
Reference in New Issue
Block a user