/** * * @param coordinateTransformation transformation from the internal CRS to the CRS in which the file should be written * @param fraction of persons to write to the plans file */ public StreamingPopulationWriter( final CoordinateTransformation coordinateTransformation, final double fraction) { this.write_person_fraction = fraction; this.handler = new PopulationWriterHandlerImplV6(coordinateTransformation); }
@Override public void writePerson(final Person person, final BufferedWriter out) throws IOException { this.startPerson(person, out); for (Plan plan : person.getPlans()) { startPlan(plan, out); // act/leg for (PlanElement pe : plan.getPlanElements()) { if (pe instanceof Activity) { Activity act = (Activity) pe; this.writeAct(act, out); } else if (pe instanceof Leg) { Leg leg = (Leg) pe; this.startLeg(leg, out); // route Route route = leg.getRoute(); if (route != null) { PopulationWriterHandlerImplV6.startRoute(route, out); PopulationWriterHandlerImplV6.endRoute(out); } PopulationWriterHandlerImplV6.endLeg(out); } } PopulationWriterHandlerImplV6.endPlan(out); } PopulationWriterHandlerImplV6.endPerson(out); this.writeSeparator(out); out.flush(); }
public final void writeV6(final String filename) { this.handler = new PopulationWriterHandlerImplV6(coordinateTransformation); ((PopulationWriterHandlerImplV6) handler).putAttributeConverters( converters ); write(filename); }
/** * Creates a new PlansWriter to write out the specified plans to the specified file and with * the specified version. * If plans-streaming is on, the file will already be opened and the file-header be written. * If plans-streaming is off, the file will not be created until {@link #write(java.lang.String)} is called. * * @param coordinateTransformation transformation from the internal CRS to the CRS in which the file should be written * @param population the population to write to file * @param fraction of persons to write to the plans file */ public PopulationWriter( final CoordinateTransformation coordinateTransformation, final Population population, final Network network, final double fraction) { this.coordinateTransformation = coordinateTransformation; this.population = population; this.network = network; this.write_person_fraction = fraction; this.handler = new PopulationWriterHandlerImplV6( coordinateTransformation ); }