| | |
| | | } |
| | | |
| | | //添加自定义标签项 |
| | | function addCustomLabelItem(item) { |
| | | let content = document.createElement('div'); |
| | | content.style.width = '110px'; |
| | | content.style.height = 'auto'; |
| | | content.style.border = 'solid'; |
| | | content.style.borderColor = '#FFFFFF'; |
| | | content.style.padding = '2px'; |
| | | content.style.borderWidth = '1px'; |
| | | content.style.borderRadius = '3px'; |
| | | content.style.background = '#32D3A6'; |
| | | content.innerHTML = getTdHtml(item.data); |
| | | content.style.color = '#FFFFFF'; |
| | | content.style.fontSize = '10px'; |
| | | //content.style.textAlign = 'center'; |
| | | content.style.lineHeight = '14px'; |
| | | let config = new Glodon.Bimface.Plugins.Drawable.CustomItemConfig(); |
| | | config.content = content; |
| | | config.viewer = _viewer; |
| | | config.opacity = 1; |
| | | config.worldPosition = _modeler.getBoundingBoxById(item.id).min; |
| | | let customLabelItem = new Glodon.Bimface.Plugins.Drawable.CustomItem(config); |
| | | _drawableContainer.addItem(customLabelItem); |
| | | } |
| | | //function addCustomLabelItem(item) { |
| | | // let content = document.createElement('div'); |
| | | // content.style.width = '110px'; |
| | | // content.style.height = 'auto'; |
| | | // content.style.border = 'solid'; |
| | | // content.style.borderColor = '#FFFFFF'; |
| | | // content.style.padding = '2px'; |
| | | // content.style.borderWidth = '1px'; |
| | | // content.style.borderRadius = '3px'; |
| | | // content.style.background = '#32D3A6'; |
| | | // content.innerHTML = getTdHtml(item.data); |
| | | // content.style.color = '#FFFFFF'; |
| | | // content.style.fontSize = '10px'; |
| | | // //content.style.textAlign = 'center'; |
| | | // content.style.lineHeight = '14px'; |
| | | // let config = new Glodon.Bimface.Plugins.Drawable.CustomItemConfig(); |
| | | // config.content = content; |
| | | // config.viewer = _viewer; |
| | | // config.opacity = 1; |
| | | // config.worldPosition = _modeler.getBoundingBoxById(item.id).min; |
| | | // let customLabelItem = new Glodon.Bimface.Plugins.Drawable.CustomItem(config); |
| | | // _drawableContainer.addItem(customLabelItem); |
| | | //} |
| | | |
| | | |
| | | //清除自定义标签 |
| | |
| | | } |
| | | |
| | | //获取数据内容html |
| | | //function getTdHtml(data) { |
| | | // if (data == null || data.length < 1) { |
| | | // return ''; |
| | | // } |
| | | // let html = '<table>'; |
| | | // data.forEach(d => { |
| | | // html += '<tr><td style="width:50px">' + d.name + '</td><td style="width:40px">' + d.value + '</td><td>' + d.unit + '</td></tr>' |
| | | // }); |
| | | // return html += '</table>'; |
| | | //} |
| | | |
| | | |
| | | //添加自定义标签项 |
| | | function addCustomLabelItem(item) { |
| | | let content = document.createElement('div'); |
| | | content.className = 'w-fit rounded-md space-y-1.5 text-nowrap flex flex-col'; |
| | | content.style.color = 'white'; |
| | | content.style.backgroundColor = '#32d3a6'; |
| | | content.style.padding = '5px'; |
| | | |
| | | content.innerHTML = getTdHtml(item.data); |
| | | |
| | | let config = new Glodon.Bimface.Plugins.Drawable.CustomItemConfig(); |
| | | config.content = content; |
| | | config.viewer = _viewer; |
| | | config.opacity = 1; |
| | | config.worldPosition = _modeler.getBoundingBoxById(item.id).min; |
| | | let customLabelItem = new Glodon.Bimface.Plugins.Drawable.CustomItem(config); |
| | | _drawableContainer.addItem(customLabelItem); |
| | | } |
| | | |
| | | |
| | | //获取数据内容html |
| | | function getTdHtml(data) { |
| | | if (data == null || data.length < 1) { |
| | | return ''; |
| | | } |
| | | let html = '<table>'; |
| | | data.forEach(d => { |
| | | html += '<tr><td style="width:50px">' + d.name + '</td><td style="width:40px">' + d.value + '</td><td>' + d.unit + '</td></tr>' |
| | | let html = ''; |
| | | data.forEach((d) => { |
| | | html += ` |
| | | <div class="flex justify-between items-center"> |
| | | <span>${d.name}</span> |
| | | <span class="p-x-8">${d.value}</span> |
| | | <span>${d.unit}</span> |
| | | |
| | | </div>`; |
| | | }); |
| | | return html += '</table>'; |
| | | return html; |
| | | } |
| | | |
| | | |
| | | |
| | | |