use of dfEditor.SelectionBox in project darkFunction-Editor by darkFunction.
the class SpritesheetReader method createCustomNodeFromDOMNode.
public CustomNode createCustomNodeFromDOMNode(Element aDOMNode) {
boolean bDir = false;
if (aDOMNode.getTagName().equals("dir"))
bDir = true;
CustomNode node = new CustomNode(aDOMNode.getAttribute("name"), bDir);
if (node.isLeaf() && aDOMNode.getTagName().equals("spr")) {
node.setCustomObject(new SelectionBox(new Rectangle(Integer.parseInt(aDOMNode.getAttribute("x")), Integer.parseInt(aDOMNode.getAttribute("y")), Integer.parseInt(aDOMNode.getAttribute("w")), Integer.parseInt(aDOMNode.getAttribute("h"))), node.getColour()));
} else {
for (int i = 0; i < aDOMNode.getChildNodes().getLength(); ++i) {
Node childNode = aDOMNode.getChildNodes().item(i);
Element element = null;
if (childNode.getNodeType() == Node.ELEMENT_NODE)
element = (Element) childNode;
if (element != null) {
CustomNode customNode = createCustomNodeFromDOMNode(element);
node.add(customNode);
}
}
}
return node;
}
Aggregations