21 package org.matsim.core.network.io;
23 import java.io.IOException;
25 import org.apache.log4j.Logger;
36 import net.opengis.kml.v_2_2_0.AbstractFeatureType;
37 import net.opengis.kml.v_2_2_0.DocumentType;
38 import net.opengis.kml.v_2_2_0.FolderType;
39 import net.opengis.kml.v_2_2_0.ObjectFactory;
40 import net.opengis.kml.v_2_2_0.PlacemarkType;
41 import net.opengis.kml.v_2_2_0.StyleType;
66 this.styleFactory = styleFac;
71 FolderType folder = this.kmlObjectFactory.createFolderType();
73 folder.setName(
"MATSIM Network");
77 FolderType nodeFolder = kmlObjectFactory.createFolderType();
78 nodeFolder.setName(
"Nodes");
82 AbstractFeatureType abstractFeature = this.networkFeatureFactory.
createNodeFeature(n, networkNodeStyle);
83 if (abstractFeature.getClass().equals(PlacemarkType.class)) {
84 nodeFolder.getAbstractFeatureGroup().add(this.kmlObjectFactory.createPlacemark((PlacemarkType) abstractFeature));
85 }
else if (abstractFeature.getClass().equals(FolderType.class)) {
86 nodeFolder.getAbstractFeatureGroup().add(this.kmlObjectFactory.createFolder((FolderType) abstractFeature));
88 log.warn(
"Not yet implemented: Adding node KML features of type " + abstractFeature.getClass());
92 folder.getAbstractFeatureGroup().add(kmlObjectFactory.createFolder(nodeFolder));
94 FolderType linkFolder = kmlObjectFactory.createFolderType();
95 linkFolder.setName(
"Links");
98 AbstractFeatureType abstractFeature = this.networkFeatureFactory.
createLinkFeature(l, networkLinkStyle);
99 if (abstractFeature.getClass().equals(PlacemarkType.class)) {
100 linkFolder.getAbstractFeatureGroup().add(this.kmlObjectFactory.createPlacemark((PlacemarkType) abstractFeature));
101 }
else if (abstractFeature.getClass().equals(FolderType.class)) {
102 linkFolder.getAbstractFeatureGroup().add(this.kmlObjectFactory.createFolder((FolderType) abstractFeature));
104 log.warn(
"Not yet implemented: Adding node KML features of type " + abstractFeature.getClass());
107 folder.getAbstractFeatureGroup().add(kmlObjectFactory.createFolder(linkFolder));
NetworkKmlStyleFactory styleFactory
final NetworkFeatureFactory networkFeatureFactory
Map< Id< Node >, ? extends Node > getNodes()
final ObjectFactory kmlObjectFactory
AbstractFeatureType createLinkFeature(final Link l, StyleType networkStyle)
FolderType getNetworkFolder()
void setNetworkKmlStyleFactory(NetworkKmlStyleFactory styleFac)
abstract StyleType createDefaultNetworkNodeStyle()
Map< Id< Link >, ? extends Link > getLinks()
AbstractFeatureType createNodeFeature(final Node n, StyleType networkStyle)
KmlNetworkWriter(final Network network, final CoordinateTransformation coordTransform, KMZWriter writer, DocumentType doc)
abstract StyleType createDefaultNetworkLinkStyle()