| | |
| | | //引线标签 |
| | | |
| | | //业务标注引线标签id列表 |
| | | //id列表 |
| | | let _logicMarkLeadLabelIds = new Set(); |
| | | |
| | | //设置业务标注引线标签 |
| | | //设置 |
| | | function setLogicMarkLeadLabels(obj) { |
| | | initialDrawableContainer(); |
| | | clearLogicMarkLeadLabels(); |
| | |
| | | }); |
| | | } |
| | | |
| | | //添加业务标注引线标签 |
| | | //更新 |
| | | function updateLogicMarkLeadLabel(item) { |
| | | if (_drawableContainer == null) { |
| | | return; |
| | | } |
| | | if (_logicMarkLeadLabelIds.size > 0) { |
| | | let leadLabelId = getLogicMarkLeadLabelId(item.id); |
| | | let leadLabel = _drawableContainer.getItemById(leadLabelId); |
| | | leadLabel.setText(item.text); |
| | | } |
| | | } |
| | | |
| | | //更新列表 |
| | | function updateLogicMarkLeadLabels(data) { |
| | | if (data != null && data.length > 0) { |
| | | data.forEach(x => { |
| | | updateLogicMarkLeadLabel(x); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | //添加 |
| | | function addLogicMarkLeadLabel(item) { |
| | | if (_drawableContainer == null) { |
| | | return; |
| | | } |
| | | let leadLabel = createLogicMarkLeadLabel(item); |
| | | var leadLabelId = getLogicMarkLeadLabelId(item.id); |
| | | _logicMarkLeadLabelIds.add(leadLabelId); |
| | | _drawableContainer.addItem(leadLabel); |
| | | } |
| | | |
| | | //创建 |
| | | function createLogicMarkLeadLabel(item) { |
| | | //引线标签的配置类 |
| | | let leadLabelConfig = new Glodon.Bimface.Plugins.Drawable.LeadLabelConfig(); |
| | | //引线折点的相对位置 |
| | |
| | | leadLabelConfig.text = item.text; |
| | | //引线标签关联的构件 |
| | | leadLabelConfig.objectId = item.id; |
| | | if (!isEmpty(item.distance)) { |
| | | leadLabelConfig.visibleDistance = item.distance; |
| | | leadLabelConfig.id = "LogicMarkLeadLabel" + item.id; |
| | | _logicMarkLeadLabelIds.add(leadLabelConfig.id); |
| | | |
| | | } |
| | | var leadLabelId = getLogicMarkLeadLabelId(item.id); |
| | | leadLabelConfig.id = leadLabelId; |
| | | let boundingBox = _modeler.getBoundingBoxById(item.id); |
| | | let boundingBoxMin = boundingBox.min; |
| | | let boundingBoxMax = boundingBox.max; |
| | |
| | | leadLabelConfig.width = null; |
| | | |
| | | let leadLabel = new Glodon.Bimface.Plugins.Drawable.LeadLabel(leadLabelConfig); |
| | | _drawableContainer.addItem(leadLabel); |
| | | return leadLabel; |
| | | } |
| | | |
| | | //清除业务标注引线标签 |
| | | //清除 |
| | | function clearLogicMarkLeadLabels() { |
| | | if (_drawableContainer == null) { |
| | | return; |
| | |
| | | } |
| | | } |
| | | |
| | | //获取id |
| | | function getLogicMarkLeadLabelId(id) { |
| | | return "LogicMarkLeadLabel" + id; |
| | | } |
| | | |
| | | |