public LiveServerQuadTree(VisNetwork net) { super(net.getNetwork()); this.net = net; }
private List<Plan> getPersonsNOW() { List<Plan> actPersons = new ArrayList<>(); VisLink link = simulationView.getVisNetwork().getVisLinks().get(this.queryLinkId); Collection<? extends VisVehicle> vehs = link.getAllVehicles(); for( VisVehicle veh : vehs) { if ( veh.getDriver() instanceof PlanAgent ) { Plan plan = ((PlanAgent)veh.getDriver()).getCurrentPlan() ; actPersons.add( plan ); } } return actPersons; }
private void doSnapshot(final double time, VisMobsim visMobsim) { if (!this.snapshotWriters.isEmpty()) { Collection<AgentSnapshotInfo> positions = new ArrayList<AgentSnapshotInfo>(); for (VisLink link : visMobsim.getVisNetwork().getVisLinks().values()) { link.getVisData().addAgentSnapshotInfo(positions); } // We do not put non-network agents in movies. // Otherwise, we would add snapshots from visMobsim.getNonNetworkAgentSnapshots() here. for (SnapshotWriter writer : this.snapshotWriters) { writer.beginSnapshot(time); for (AgentSnapshotInfo position : positions) { writer.addAgent(position); } writer.endSnapshot(); } } }
@Override public void writeConstData(ByteBuffer out) throws IOException { //write the data for the links out.putInt(this.network.getVisLinks().size()); for (VisLink visLink : this.network.getVisLinks().values()) { LanesToLinkAssignment l2l = null; if (this.lanes != null){ l2l = this.lanes.getLanesToLinkAssignments().get(visLink.getLink().getId()); } List<ModelLane> la = null; if (l2l != null) { la = LanesUtils.createLanes(visLink.getLink(), l2l); } VisLinkWLanes otfLink = this.laneModelBuilder.createVisLinkLanes(OTFServerQuadTree.getOTFTransformation(), visLink, config.qsim().getNodeOffset(), la); //write link data ByteBufferUtils.putObject(out, otfLink); } }
double dist = 0; Collection<AgentSnapshotInfo> positions = new LinkedList<AgentSnapshotInfo>(); for(VisLink qlink : simulationView.getVisNetwork().getVisLinks().values()) { qlink.getVisData().addAgentSnapshotInfo(positions);
private void installLinkWriterFactories( List<OTFWriterFactory<VisLink>> linkWriterFactoryObjects) { for (VisLink link : this.net.getVisLinks().values()) { Point2D.Double fromCoord = transform(link.getLink().getFromNode().getCoord()); Point2D.Double toCoord = transform(link.getLink().getToNode().getCoord()); double middleEast = (toCoord.getX() + fromCoord.getX()) * 0.5; double middleNorth = (toCoord.getY() + fromCoord.getY()) * 0.5; for (OTFWriterFactory<VisLink> fac : linkWriterFactoryObjects) { OTFDataWriter<VisLink> writer = fac.getWriter(); // null means take the default handler if (writer != null) { writer.setSrc(link); } // this.put(middleEast, middleNorth, writer); // try to put links twice: this.put(fromCoord.getX(), fromCoord.getY(), writer); this.put(toCoord.getX(), toCoord.getY(), writer); // (The unterlying QuadTree documentation says that it will accept the same object multiple times as // long as at different coordinates. So I am trying this out here. The result will depend on the fact if // the collections are implemented as sets (in which case duplicate links will just be ignored) or standard // collections, in which case the plotting will supposedly happen twice, this reducing plotting speed by a // factor of two. (Does not feel like it.) kai, apr'18 } } }