ailabel给图片画框放大

380 阅读1分钟

addPicMarker(it, boundary, index, div, width, height, arr, layer, feature, polygon, gap, gFirst, gFirstImage) { // Boundary:"666 116,666 159,712 159,712 116"(左下角,左上角,右上角,右下角) const leftX = boundary.split(",")[0].split(" ")[0]; const rightX = boundary.split(",")[2].split(" ")[0]; const bottomY = boundary.split(",")[0].split(" ")[1]; const topY = boundary.split(",")[1].split(" ")[1]; const gMap = new AILabel.Map(div, { center: { x: 325, y: 185 }, // 根据图片在dom元素的宽高设置居中 zoom: 650, mode: "PAN", // 绘制线 }); const gFirstImageLayer = new AILabel.Layer.Image( layer, // id { src: it, width: 650, // 图片宽度 height: 370, // 图片高度 crossOrigin: false, // 图片是否跨域 position: { // 图片左上角对应的坐标位置 x: 0, y: 0, }, }, // imageInfo { name: "第一个图片图层" }, // props { zIndex: 5 } // style ); gMap.addLayer(gFirstImageLayer); const gFirstFeatureLayer = new AILabel.Layer.Feature( feature, // id { name: "第一个矢量图层" }, // props { zIndex: 10 } // style ); gMap.addLayer(gFirstFeatureLayer); const gFirstFeaturePolygon = new AILabel.Feature.Polygon( polygon, // id { points: [ { x: leftX / (width / 650), y: bottomY / (height / 370), }, { x: leftX / (width / 650), y: topY / (height / 370), }, { x: rightX / (width / 650), y: topY / (height / 370), }, { x: rightX / (width / 650), y: bottomY / (height / 370), }, ], }, // shape { name: "第一个多边形" }, // props { strokeStyle: "#FFD500", lineWidth: 2 } // style ); gFirstFeatureLayer.addFeature(gFirstFeaturePolygon); arr[index].gmapLoading = false; gap[index] = gMap; gFirst[index] = gFirstFeatureLayer; gFirstImage[index] = gFirstImageLayer; },

line.JPG