public SnapshotGenerator(final Network network, final double snapshotPeriod, final QSimConfigGroup config) { this.network = network; int initialCapacity = (int)(network.getLinks().size()*1.1); this.eventLinks = new HashMap<>(initialCapacity, 0.95f); this.linkList = new ArrayList<>(initialCapacity); this.eventAgents = new HashMap<>(1000, 0.95f); this.snapshotPeriod = snapshotPeriod; this.capCorrectionFactor = config.getFlowCapFactor() / network.getCapacityPeriod(); this.storageCapFactor = config.getStorageCapFactor(); this.snapshotStyle = config.getSnapshotStyle(); if (! Double.isNaN( config.getLinkWidthForVis() )){ this.linkWidthCalculator.setLinkWidthForVis( config.getLinkWidthForVis() ); } if (! Double.isNaN(network.getEffectiveLaneWidth())){ this.linkWidthCalculator.setLaneWidth(network.getEffectiveLaneWidth()); } reset(-1); }
static AbstractAgentSnapshotInfoBuilder createAgentSnapshotInfoBuilder(Scenario scenario, SnapshotLinkWidthCalculator linkWidthCalculator) { final SnapshotStyle snapshotStyle = scenario.getConfig().qsim().getSnapshotStyle(); switch(snapshotStyle) { case queue: return new QueueAgentSnapshotInfoBuilder(scenario, linkWidthCalculator); case withHoles: case withHolesAndShowHoles: // the difference is not in the spacing, thus cannot be differentiated by using different classes. kai, sep'14 // ??? kai, nov'15 return new QueueAgentSnapshotInfoBuilder(scenario, linkWidthCalculator); case kinematicWaves: log.warn("The snapshotStyle \"" + snapshotStyle + "\" is not explicitly supported. Using \""+SnapshotStyle.withHoles+ "\" instead."); return new QueueAgentSnapshotInfoBuilder(scenario, linkWidthCalculator); case equiDist: return new EquiDistAgentSnapshotInfoBuilder(scenario, linkWidthCalculator); default: log.warn("The snapshotStyle \"" + snapshotStyle + "\" is not supported. Using equiDist"); return new EquiDistAgentSnapshotInfoBuilder(scenario, linkWidthCalculator); } }
switch (scenario.getConfig().qsim().getSnapshotStyle()) { case equiDist: case queue: if ( QSimConfigGroup.SnapshotStyle.withHolesAndShowHoles==scenario.getConfig().qsim().getSnapshotStyle() ) { addHolePosition( positions, distanceOfHoleFromFromNode, hole, curvedLength, upstreamCoord, downstreamCoord ) ; default: throw new RuntimeException("The traffic dynmics "+scenario.getConfig().qsim().getSnapshotStyle()+" is not implemented yet.");