|
@@ -43,11 +43,11 @@ let isValidPoint = (modelId)=>{//所存的modelId没被删或者它本身不在
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- window.AMapWith84 = {
|
|
|
+ window.AMapWith84__ = { //在Potree里setLonlat时不管转不转效果都一样 很奇怪,所以这里改名。只在ces
|
|
|
aMapToWgs84, wgs84ToAMap
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+}
|
|
|
|
|
|
//江门本地版本
|
|
|
|
|
@@ -732,7 +732,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
map.switchStyle(type )
|
|
|
}, */
|
|
|
switchMapType(type){//切换成江门的卫星或标准
|
|
|
- return;
|
|
|
+
|
|
|
console.log('switchMapType',type)
|
|
|
let maximumLevel, url
|
|
|
if(type == 'satellite'){
|
|
@@ -744,8 +744,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
}
|
|
|
cesImageryProvider = new Cesium.UrlTemplateImageryProvider({ //直接用84坐标,不用转高德
|
|
|
url,
|
|
|
- crossOrigin: 'anonymous',
|
|
|
- //tilingScheme: new Cesium.WebMercatorTilingScheme(), // 使用 Web Mercator 投影
|
|
|
+ crossOrigin: 'anonymous',
|
|
|
minimumLevel: 0,
|
|
|
maximumLevel
|
|
|
})
|
|
@@ -1861,7 +1860,46 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
viewer.backgroundOpacity = 0
|
|
|
//密钥
|
|
|
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI2ZGM2YzY0ZC1kNWE0LTRiYTgtYTkwNS1kYmJiODRjMWUwMmQiLCJpZCI6MjMzMTQ1LCJpYXQiOjE3MjI5OTUwNTB9.niqpkl6xOkQ2KeJjelyDDDydmSGqKXKb5cX2NyxSNAw'
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ class AmapMercatorTilingScheme extends Cesium.WebMercatorTilingScheme {
|
|
|
+ constructor(options) {
|
|
|
+ super(options)
|
|
|
+ let projection = new Cesium.WebMercatorProjection()
|
|
|
+ this._projection.project = function(cartographic, result) {
|
|
|
+ //WGS84转GCJ02坐标
|
|
|
+ /* result = gcoord.transform([
|
|
|
+ Cesium.Math.toDegrees(cartographic.longitude),
|
|
|
+ Cesium.Math.toDegrees(cartographic.latitude)
|
|
|
+ ], gcoord.WGS84, gcoord.GCJ02) */
|
|
|
+
|
|
|
+ result = AMapWith84__.wgs84ToAMap({
|
|
|
+ x: Cesium.Math.toDegrees(cartographic.longitude),
|
|
|
+ y: Cesium.Math.toDegrees(cartographic.latitude)
|
|
|
+ })
|
|
|
+
|
|
|
+ result = projection.project(new Cesium.Cartographic(Cesium.Math.toRadians(result.x),Cesium.Math.toRadians(result.y)))
|
|
|
+ return new Cesium.Cartesian2(result.x,result.y)
|
|
|
+ }
|
|
|
+ this._projection.unproject = function(cartesian, result) {
|
|
|
+ let cartographic = projection.unproject(cartesian)
|
|
|
+ //GCJ02转WGS84坐标
|
|
|
+ /* result = gcoord.transform([
|
|
|
+ Cesium.Math.toDegrees(cartographic.longitude),
|
|
|
+ Cesium.Math.toDegrees(cartographic.latitude)
|
|
|
+ ], gcoord.GCJ02, gcoord.WGS84) */
|
|
|
+
|
|
|
+ result = AMapWith84__.aMapToWgs84({
|
|
|
+ x: Cesium.Math.toDegrees(cartographic.longitude),
|
|
|
+ y: Cesium.Math.toDegrees(cartographic.latitude)
|
|
|
+ })
|
|
|
+
|
|
|
+ return new Cesium.Cartographic(Cesium.Math.toRadians(result.x),Cesium.Math.toRadians(result.y))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }//see : https://blog.csdn.net/hongxianqiang/article/details/140541555 cesium加载高德地图并纠偏
|
|
|
+
|
|
|
+
|
|
|
window.cesiumViewer = new Cesium.Viewer('app', {
|
|
|
useDefaultRenderLoop: true,
|
|
|
requestRenderMode: true, //add 只有需要render时才会render,如tile加载完后、镜头移动后
|
|
@@ -1878,20 +1916,22 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
//高德秘钥版 imageryProvider: new Cesium.AmapImageryProvider({key, mapStyle: 'normal'})
|
|
|
//报错 401 (Unauthorized) 的方法 https://blog.csdn.net/LBY_XK/article/details/121992641
|
|
|
|
|
|
- //terrainShadows: Cesium.ShadowMode.DISABLED, //terrain地形
|
|
|
+ //terrainShadows: Cesium.ShadowMode.DISABLED, //terrain地形 //自带的地图直接用84坐标
|
|
|
});
|
|
|
|
|
|
- let satellite = false
|
|
|
- let imageryProvider = cesImageryProvider || new Cesium.UrlTemplateImageryProvider({ //直接用84坐标,不用转高德
|
|
|
+ let satellite = true
|
|
|
+ let gaoDeImageryProvider = cesImageryProvider || new Cesium.UrlTemplateImageryProvider({
|
|
|
url: `//wprd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=${satellite?6:7}&x={x}&y={y}&z={z}&token=YOUR_API_KEY`, //style=6是卫星,7是标准
|
|
|
minimumLevel: 0,
|
|
|
- maximumLevel: satellite?18:19,
|
|
|
+ maximumLevel: satellite?18:19,
|
|
|
+ credit: new Cesium.Credit('高德地图'),
|
|
|
+ tilingScheme: new AmapMercatorTilingScheme(), //修改投影,从84->高德
|
|
|
crossOrigin: 'anonymous',
|
|
|
})
|
|
|
cesiumViewer.imageryLayers.removeAll();
|
|
|
- cesiumViewer.imageryLayers.addImageryProvider(imageryProvider);
|
|
|
-
|
|
|
+ cesiumViewer.imageryLayers.addImageryProvider(gaoDeImageryProvider);
|
|
|
|
|
|
+
|
|
|
Potree.cesScreenshot = (w,h)=>{
|
|
|
console.log('cesScreenshot',w,h)
|
|
|
cesiumViewer.scene.canvas.style.width = w+'px'
|
|
@@ -2072,7 +2112,6 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
/*
|
|
|
|