Re: Add "o" to OBJWriter output
Code: Select all
public class LDObjWriter extends OBJWriter {
private boolean firstNode = true;
private boolean separateObjects = false;
public boolean isSeparateObjects() {
return separateObjects;
}
public void setSeparateObjects(boolean separateObjects) {
this.separateObjects = separateObjects;
}
@Override
public void writeNode(Node node) throws IOException, InterruptedIOException {
writeNode(node, null);
}
@Override
public void writeNode(Node node, String nodeName) throws IOException, InterruptedIOException {
if (firstNode) {
super.writeNode(null, null);
firstNode = false;
}
if (separateObjects && nodeName != null && !nodeName.isEmpty()) {
this.out.write("o " + nodeName + "\n");
}
super.writeNode(node, nodeName);
}
public void newObject(String name) throws IOException {
if (firstNode) {
super.writeNode(null, null);
firstNode = false;
}
this.out.write("o " + name + "\n");
separateObjects = false;
}
}