
org.yaoqiang.graph.io.graphml.GraphMLData Maven / Gradle / Ivy
package org.yaoqiang.graph.io.graphml;
import java.awt.Rectangle;
import org.w3c.dom.Element;
/**
* GraphMLData
*
* @author Shi Yaoqiang([email protected])
*/
public class GraphMLData {
private String dataKey = "";
private GraphMLGenericNode dataGenericNode;
private GraphMLProxyAutoBoundsNode dataProxyAutoBoundsNode;
private GraphMLGenericEdge dataGenericEdge;
private Rectangle geometry = new Rectangle();
public GraphMLData(Element dataElement) {
this.dataKey = dataElement.getAttribute(GraphMLConstants.KEY);
Element genericNodeElement = GraphMLUtils.childsTag(dataElement, GraphMLConstants.YWORKS + GraphMLConstants.GENERIC_NODE);
Element proxyAutoBoundsNodeElement = GraphMLUtils.childsTag(dataElement, GraphMLConstants.YWORKS + GraphMLConstants.PROXY_AUTO_BOUNDS_NODE);
Element genericEdgeElement = GraphMLUtils.childsTag(dataElement, GraphMLConstants.YWORKS + GraphMLConstants.GENERIC_EDGE);
if (genericNodeElement != null) {
this.dataGenericNode = new GraphMLGenericNode(genericNodeElement);
this.geometry = dataGenericNode.getGeometry();
} else if (proxyAutoBoundsNodeElement != null) {
this.dataProxyAutoBoundsNode = new GraphMLProxyAutoBoundsNode(proxyAutoBoundsNodeElement);
this.geometry = dataProxyAutoBoundsNode.getGroupNodes().get(dataProxyAutoBoundsNode.getActiveRealizer()).getGeometry();
} else if (genericEdgeElement != null) {
this.dataGenericEdge = new GraphMLGenericEdge(genericEdgeElement);
}
}
public String getDataKey() {
return dataKey;
}
public GraphMLGenericNode getDataGenericNode() {
return dataGenericNode;
}
public GraphMLProxyAutoBoundsNode getDataProxyAutoBoundsNode() {
return dataProxyAutoBoundsNode;
}
public GraphMLGenericEdge getDataGenericEdge() {
return dataGenericEdge;
}
public Rectangle getGeometry() {
return geometry;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy