Explorar o código

[Mod 0000] CAD底图替换

houzekong hai 2 semanas
pai
achega
35a3be5dcc
Modificáronse 1 ficheiros con 12 adicións e 3 borrados
  1. 12 3
      src/views/system/cadFile/app.ts

+ 12 - 3
src/views/system/cadFile/app.ts

@@ -39,8 +39,11 @@ export const initMap2d = async (container: HTMLElement, config: { fileUrl?: stri
   style.clipbounds = Math.pow(2, 6);
 
   const res = await svc.openMap({
-    mapid: 'mapId', // 地图ID,上传文件后获得的mapid
+    mapid: 'c56c59154345', // 地图ID,上传文件后获得的mapid
     version: env.version,
+    cbInputPassword: () => {
+      return Promise.resolve('hllcad');
+    },
     fileid: fileUrl,
     // @ts-ignore
     mapopenway: env.mapopenway || vjmap.MapOpenWay.GeomRender,
@@ -63,8 +66,10 @@ export const initMap2d = async (container: HTMLElement, config: { fileUrl?: stri
   map = new vjmap.Map({
     container, // DIV容器ID
     style: svc.rasterStyle(), // 样式,这里是栅格样式
-    center: prj.toLngLat(mapExtent.center()), // 设置地图中心点
-    zoom: 8, // 设置地图缩放级别
+    center: { lng: -0.9509370605581751, lat: -0.37209374623643043 }, // 设置地图中心点
+    // center: prj.toLngLat(mapExtent.center()), // 设置地图中心点
+    zoom: 11, // 设置地图缩放级别
+    // zoom: 1, // 设置地图缩放级别
     pitch: 0,
     antialias: true, // 反锯齿
     renderWorldCopies: false, // 不显示多屏地图
@@ -72,6 +77,10 @@ export const initMap2d = async (container: HTMLElement, config: { fileUrl?: stri
 
   // 关联服务对象和投影对象
   map.attach(svc, prj);
+  // map.on('click', (ev) => {
+  //   console.log(map?.getCenter());
+  //   console.log(map?.getZoom());
+  // });
   await map.onLoad();
 
   return map;