added info collector
This commit is contained in:
parent
c509fb280b
commit
901dd3ae55
74
brouter-core/src/main/java/btools/router/AreaInfo.java
Normal file
74
brouter-core/src/main/java/btools/router/AreaInfo.java
Normal file
@ -0,0 +1,74 @@
|
||||
package btools.router;
|
||||
|
||||
import btools.expressions.BExpressionContext;
|
||||
|
||||
public class AreaInfo {
|
||||
final static int RESULT_TYPE_NONE = 0;
|
||||
final static int RESULT_TYPE_ELEV50 = 1;
|
||||
final static int RESULT_TYPE_GREEN = 4;
|
||||
final static int RESULT_TYPE_RIVER = 5;
|
||||
|
||||
public int direction;
|
||||
public int numForest = -1;
|
||||
public int numRiver = -1;
|
||||
|
||||
public OsmNogoPolygon polygon;
|
||||
|
||||
public int ways = 0;
|
||||
public int greenWays = 0;
|
||||
public int riverWays = 0;
|
||||
public double elevStart = 0;
|
||||
public int elev50 = 0;
|
||||
public int elev100 = 0;
|
||||
public int elevMore = 0;
|
||||
|
||||
public AreaInfo(int dir) {
|
||||
direction = dir;
|
||||
}
|
||||
|
||||
void checkGreeness(BExpressionContext expctxWay, double elev, byte[] ab) {
|
||||
ways++;
|
||||
|
||||
double test = elevStart - elev;
|
||||
if (Math.abs(test) < 50) elev50++;
|
||||
|
||||
int[] ld2 = expctxWay.createNewLookupData();
|
||||
expctxWay.decode(ld2, false, ab);
|
||||
|
||||
if (numForest != -1 && ld2[numForest] > 1) {
|
||||
greenWays++;
|
||||
}
|
||||
|
||||
if (numRiver != -1 && ld2[numForest] > 1) {
|
||||
riverWays++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int getElev50Weight() {
|
||||
if (ways == 0) return 0;
|
||||
return (int) (elev50 * 100. / ways);
|
||||
}
|
||||
|
||||
public int getGreen() {
|
||||
if (ways == 0) return 0;
|
||||
return (int) (greenWays * 100. / ways);
|
||||
}
|
||||
|
||||
public int getRiver() {
|
||||
if (ways == 0) return 0;
|
||||
return (int) (riverWays * 100. / ways);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Area ").append(direction).append(" ").append(elevStart).append("m ways ").append(ways);
|
||||
if (ways > 0) {
|
||||
sb.append("\nArea ways <50m " + elev50 + " " + getElev50Weight() + "%");
|
||||
sb.append("\nArea ways green " + greenWays + " " + getGreen() + "% " /*+ (greenWaysWeight/greenWays)*/);
|
||||
sb.append("\nArea ways river " + riverWays + " " + getRiver() + "% " /*+ (greenWaysWeight/greenWays)*/);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@ -78,6 +78,8 @@ public final class RoutingContext {
|
||||
public double correctMisplacedViaPointsDistance;
|
||||
public boolean useDynamicDistance;
|
||||
|
||||
public AreaInfo ai;
|
||||
|
||||
private void setModel(String className) {
|
||||
if (className == null) {
|
||||
pm = new StdModel();
|
||||
@ -120,7 +122,7 @@ public final class RoutingContext {
|
||||
considerTurnRestrictions = 0.f != expctxGlobal.getVariableValue("considerTurnRestrictions", footMode ? 0.f : 1.f);
|
||||
|
||||
correctMisplacedViaPoints = 0.f != expctxGlobal.getVariableValue("correctMisplacedViaPoints", 1.f);
|
||||
correctMisplacedViaPointsDistance = expctxGlobal.getVariableValue("correctMisplacedViaPointsDistance", 40.f);
|
||||
correctMisplacedViaPointsDistance = expctxGlobal.getVariableValue("correctMisplacedViaPointsDistance", 0.f); // 0 == don't use distance
|
||||
|
||||
// process tags not used in the profile (to have them in the data-tab)
|
||||
processUnusedTags = 0.f != expctxGlobal.getVariableValue("processUnusedTags", 0.f);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user