MATSIM
SnapshotLinkWidthCalculator.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * LinkWidthCalculator
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2012 by the members listed in the COPYING, *
8  * LICENSE and WARRANTY file. *
9  * email : info at matsim dot org *
10  * *
11  * *********************************************************************** *
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * See also COPYING, LICENSE and WARRANTY file *
18  * *
19  * *********************************************************************** */
20 package org.matsim.vis.snapshotwriters;
21 
22 
34  private double widthOfMedian = 30. ; // default
35 
36  private double laneWidth = 3.75; //default in NetworkImpl and network_v1.dtd
37 
38  public void setLaneWidth( double dd ) {
39  if ( !Double.isNaN(dd) ) {
40  // ( seems that this can be NaN when coming from reading a regular network. kai, jul'16 )
41  laneWidth = dd ;
42  }
43  }
44 
45  public double getLaneWidth(){
46  return laneWidth;
47  }
48 
49  public void setLinkWidthForVis(double linkWidthCorrectionFactor){
50  this.widthOfMedian = linkWidthCorrectionFactor;
51  }
52 
53  public double calculateLinkWidth(double nrOfLanes){
54 // System.err.println(widthOfMedian + " " + laneWidth + " " + nrOfLanes);
55  return widthOfMedian + laneWidth * nrOfLanes;
56  }
57 
58  double calculateLanePosition(double lane){
59  return 0.5 * widthOfMedian + laneWidth * lane;
60  }
61 
62 }