}
}
}
public void process(DXFDocument doc, Map<String,String> context) throws ProcessorException {
DXFLayer mergeLayer = null;
if (this.merge) {
if (doc.containsDXFLayer(MERGED_LAYER_NAME)) {
mergeLayer = doc.getDXFLayer(MERGED_LAYER_NAME);
} else {
mergeLayer = new DXFLayer();
mergeLayer.setName(MERGED_LAYER_NAME);
doc.addDXFLayer(mergeLayer);
}
}
// iterate over all layers
Iterator<DXFLayer> i = doc.getDXFLayerIterator();
while (i.hasNext()) {
DXFLayer layer = (DXFLayer) i.next();
if (this.removableLayers.contains(layer.getName())) {
i.remove();
} else if (this.merge) {
if (layer != mergeLayer) {
Iterator<String> types = layer.getDXFEntityTypeIterator();
while (types.hasNext()) {
String type = (String) types.next();
Iterator<DXFEntity> entityIterator = layer.getDXFEntities(type).iterator();
while (entityIterator.hasNext()) {
DXFEntity e = (DXFEntity) entityIterator.next();
// we set all entities to the merged layer
// and remove them from the last layer