|
@@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
import com.persagy.adm.diagram.core.model.*;
|
|
|
import com.persagy.adm.diagram.core.model.base.Container;
|
|
|
import com.persagy.adm.diagram.core.model.base.IComponent;
|
|
|
+import com.persagy.adm.diagram.core.model.base.IDataBind;
|
|
|
import com.persagy.adm.diagram.core.model.base.IEquipHolder;
|
|
|
import com.persagy.adm.diagram.core.model.legend.Anchor;
|
|
|
import com.persagy.adm.diagram.core.model.legend.Legend;
|
|
@@ -100,7 +101,7 @@ public class DiagramBuilder {
|
|
|
|
|
|
handleNodes();
|
|
|
|
|
|
- buildContainers(containers);
|
|
|
+ handleContainers(containers);
|
|
|
}
|
|
|
|
|
|
private void addEquipNode(Container con, ObjectNode obj){
|
|
@@ -110,7 +111,7 @@ public class DiagramBuilder {
|
|
|
|
|
|
EquipmentNode node = new EquipmentNode();
|
|
|
node.setId(IdUtil.simpleUUID());
|
|
|
- node.setObjId(obj.get("id").asText());
|
|
|
+ node.setDataObjectId(obj.get("id").asText());
|
|
|
node.setObjClassCode(DiagramBuilder.getClassCode(obj));
|
|
|
node.setDataObject(obj);
|
|
|
|
|
@@ -131,7 +132,7 @@ public class DiagramBuilder {
|
|
|
node.setLabel(label);
|
|
|
|
|
|
diagram.getNodes().add(node);
|
|
|
- context.getEquipMap().put(node.getObjId(), node);
|
|
|
+ context.getEquipMap().put(node.getDataObjectId(), node);
|
|
|
}
|
|
|
|
|
|
private void addPackData(Container con, ObjectNode obj){
|
|
@@ -199,16 +200,6 @@ public class DiagramBuilder {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- private void buildContainers(List<Container> containers) {
|
|
|
- for(Container con : containers) {
|
|
|
- if(con.isEquipmentBox()) {
|
|
|
- if(Boolean.TRUE.equals(con.getProp(Container.PROP_AUTO_HIDDEN)) && CollUtil.isEmpty(con.getChildren())) {
|
|
|
- con.setHidden(true);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 对节点进行处理,并返回图例锚点会使用到的关系类型
|
|
|
*/
|
|
@@ -235,6 +226,16 @@ public class DiagramBuilder {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void handleContainers(List<Container> containers) {
|
|
|
+ for(Container con : containers) {
|
|
|
+ if(con.isEquipmentBox()) {
|
|
|
+ if(Boolean.TRUE.equals(con.getProp(Container.PROP_AUTO_HIDDEN)) && CollUtil.isEmpty(con.getChildren())) {
|
|
|
+ con.setHidden(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private String getTypeName(String classCode){
|
|
|
//TODO
|
|
|
return classCode;
|
|
@@ -294,8 +295,8 @@ public class DiagramBuilder {
|
|
|
}
|
|
|
|
|
|
for(ObjectNode rel : optionalRels) {
|
|
|
- Object fromObj = context.getEquipMap().get(rel.get(ObjectRelation.OBJ_FROM_HUM).asText());
|
|
|
- Object toObj = context.getEquipMap().get(rel.get(ObjectRelation.OBJ_TO_HUM).asText());
|
|
|
+ IDataBind fromObj = context.getEquipMap().get(rel.get(ObjectRelation.OBJ_FROM_HUM).asText());
|
|
|
+ IDataBind toObj = context.getEquipMap().get(rel.get(ObjectRelation.OBJ_TO_HUM).asText());
|
|
|
|
|
|
if(fromObj != null && toObj != null) {
|
|
|
String relType = rel.get(ObjectRelation.GRAPH_CODE_HUM).asText() + '/' + rel.get(ObjectRelation.REL_CODE_HUM).asText();
|
|
@@ -318,13 +319,8 @@ public class DiagramBuilder {
|
|
|
|
|
|
}
|
|
|
|
|
|
- private ConnectPoint getConnectPoint(Object obj, String relType, Object theOtherEnd){
|
|
|
- ObjectNode theOtherData = null;
|
|
|
- if(theOtherEnd instanceof EquipmentNode) {
|
|
|
- theOtherData = (ObjectNode) ((EquipmentNode) theOtherEnd).getDataObject();
|
|
|
- } else if(theOtherEnd instanceof MainPipe) {
|
|
|
- theOtherData = (ObjectNode) ((MainPipe) theOtherEnd).getDataObject();
|
|
|
- }
|
|
|
+ private ConnectPoint getConnectPoint(IDataBind obj, String relType, IDataBind theOtherEnd){
|
|
|
+ ObjectNode theOtherData = (ObjectNode) theOtherEnd.getDataObject();
|
|
|
String theOtherType = getClassCode(theOtherData);
|
|
|
|
|
|
if(obj instanceof EquipmentNode) {
|