| | |
| | | import org.apache.commons.io.FileUtils;
|
| | | import org.apache.log4j.Logger;
|
| | | import org.geotools.TestData;
|
| | | import org.testng.Assert;
|
| | | import org.testng.annotations.BeforeTest;
|
| | | import org.testng.annotations.Test;
|
| | |
|
| | |
| | | if (record.element() != null) {
|
| | | Element element = (Element) record.element();
|
| | | ElementType type = element.getElementType();
|
| | |
|
| | | boolean completed = false;
|
| | | if ((!type.isComplexElement()) && (!element.isComponentElement())) {
|
| | | if (lastComplex != null) {
|
| | | // @todo add process in here
|
| | | processCompleteElement(lastComplex, writer);
|
| | | lastComplex = null;
|
| | | }
|
| | |
|
| | | // @todo add process in here
|
| | | processCompleteElement(element, writer);
|
| | | } else if (element.isComponentElement()) {
|
| | | if (lastComplex != null) {
|
| | | ((ComplexElement) lastComplex).add(element);
|
| | | } else {
|
| | | logger.warn("wong." + element.toString());
|
| | | Assert.fail("Component Element cannot found parent.");
|
| | | }
|
| | | } else if (type.isComplexElement()) {
|
| | | if (lastComplex == null) {
|
| | | lastComplex = element;
|
| | | } else {
|
| | | if (lastComplex != null) {
|
| | | // @todo add process in here
|
| | | lastComplex = element;
|
| | | processCompleteElement(lastComplex, writer);
|
| | | }
|
| | | lastComplex = element;
|
| | | }
|
| | |
|
| | | if (element.getElementType().isComplexElement()) {
|
| | | if (element instanceof ComplexChainElement) {
|
| | | ComplexChainElement complexChain = (ComplexChainElement) element;
|
| | | int size = complexChain.size();
|
| | | for (Object aComplexChain : complexChain) {
|
| | | Element subElement = (Element) aComplexChain;
|
| | | subElement.getType();
|
| | | }
|
| | | }
|
| | |
|
| | | if (element instanceof ComplexShapeElement) {
|
| | | ComplexShapeElement complexShape = (ComplexShapeElement) element;
|
| | | }
|
| | |
|
| | | if (element instanceof TextNodeElement) {
|
| | | TextNodeElement textNode = (TextNodeElement) element;
|
| | | int size = textNode.size();
|
| | | for (int i = 0; i < size; i++) {
|
| | | Element subElement = textNode.get(i);
|
| | | subElement.getElementType();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | writer.writeElement(element);
|
| | | // writer.writeElement(element);
|
| | | }
|
| | | count++;
|
| | | }
|
| | |
| | |
|
| | | // FileUtils.copyFile(target, new File("G://target.dgn"));
|
| | | }
|
| | |
|
| | | private boolean processCompleteElement(Element element, Dgn7fileWriter writer) throws IOException {
|
| | | writer.writeElement(element);
|
| | | return true;
|
| | | }
|
| | | }
|