弹窗控制器
- 调用
-
let config={
-
url: "C:\\Program Files (x86)\\CityMaker 7\\CityMaker SDK\\Samples\\JS\\beginner\\HTMLWindow\\Introdution.html"
-
}
-
cw5.popUtils.popHtml(config);
- popUtils
```javascirpt
import { cw5 } from "../index.js";
export const popUtils= {};
let labelArr={};
//弹出HTML
popUtils.popHtml=function(obj) {
let wp = cw5.__g.htmlWindow.createWindowParam();
wp.filePath = obj.url
wp.sizeX = obj.sizeX||630;
wp.sizeY = obj.sizeY||370;
wp.offsetX = obj.offsetX||182;
wp.offsetY = obj.offsetY||180;
wp.hastitle =obj.hastitle||false;
wp.round = obj.round||50;
wp.winId =obj.winId|| 1;
wp.minButtonVisible=obj.minButtonVisible||false;
wp.transparence =obj.transparence|| 200;
wp.isPopupWindow =obj.isPopupWindow|| false;
wp.hideOnClick = obj.hideOnClick||false
wp.resizable=obj.resizable||false
cw5.__g.htmlWindow.setWindowParam(wp);
}
popUtils.closeHTML=function(winId){
cw5.__g.htmlWindow.deletePopupWindow(winId)
}
//弹出标签
popUtils.popLabel=function(contentObj,obj) {
// 创建一个TableLabel
let length= Object.getOwnPropertyNames(contentObj).length;
let tableLabel = cw5.__g.objectManager.createTableLabel(length, 2, cw5.rootId);
// 设定表头文字
tableLabel.titleText =obj.title||"";
let index=0;
for (var prop in contentObj) {
tableLabel.setRecord(index, 0,prop);
tableLabel.setRecord(index, 1, contentObj[prop]);
index++
}
let position = cw5.__g.new_Vector3;
let point = cw5.__g.geometryFactory.createPoint(gviVertexAttribute.gviVertexAttributeZ);
//标牌的位置
position.set(obj.x, obj.y, obj.z);
point.position = position;
tableLabel.position = point;
// 列宽度
// tableLabel.setColumnWidth(0, obj.keyWidth||80);
// tableLabel.setColumnWidth(1, obj.valueWidth||80);
// 表的边框颜色
if(obj.borderColor!=null){
tableLabel.borderColor =obj.borderColor;
}
else {
tableLabel.borderColor =cw5.innerUtils.getColor(1,"#111e42")
}
// 表的边框的宽度
if(obj.borderWidth!=null){
tableLabel.borderWidth =obj.borderWidth;
}
else {
tableLabel.borderWidth =2
}
// 表的背景色
if(obj.tableColor!=null){