1 package org.matsim.counts;
3 import org.apache.logging.log4j.LogManager;
4 import org.apache.logging.log4j.Logger;
14 import org.xml.sax.Attributes;
16 import java.util.Stack;
26 private final static String
VALUE =
"value";
27 private final Class<? extends Identifiable<?>>
idClass;
48 if (externalInputCRS != null && targetCRS != null) {
51 }
else if ( externalInputCRS==null && targetCRS==null ){
54 log.warn(
"finding a coordinate spec on one side but not on the other: inputCRS=" + externalInputCRS +
"; targetCRS=" + targetCRS +
". We are assuming that things are consistent, and are continuing anyways." );
73 public void endTag(String name, String content, Stack<String> context) {
78 if (inputCRS != null && targetCRS != null) {
79 if (externalInputCRS != null) {
81 log.warn(
"coordinate transformation defined both in config and in input file: setting from input file will be used");
89 attributesDelegate.
endTag(name, content, context);
95 int t = Integer.parseInt(atts.getValue(
"t"));
96 double val = Double.parseDouble(atts.getValue(
"val"));
101 int interval = Integer.parseInt(atts.getValue(
"interval"));
102 currMeasurable = currLocation.
createMeasurable(atts.getValue(
"type"), atts.getValue(
"networkMode"), interval);
106 String idString = atts.getValue(
"refId");
108 String stationName = atts.getValue(
"name");
111 currLocation.
setId(atts.getValue(
"id"));
113 String x = atts.getValue(
"x");
114 String y = atts.getValue(
"y");
115 if (x != null && y != null) {
117 new Coord(Double.parseDouble(x), Double.parseDouble(y))
127 for (
int i = 0; i < atts.getLength(); i++) {
128 String name = atts.getQName(i);
129 String value = atts.getValue(i);
132 case "name" -> counts.
setName(value);
133 case "source" -> counts.
setSource(value);
134 case "year" -> counts.
setYear(Integer.parseInt(value));
static final String TAG_ATTRIBUTE
final String externalInputCRS
Attributes getAttributes()
Measurable createMeasurable(String typeOfMeasurableData, String mode, int interval)
org.matsim.utils.objectattributes.attributable.Attributes currAttributes
void setSource(String source)
Measurable currMeasurable
static final String TAG_ATTRIBUTES
MeasurementLocation< T > createAndAddMeasureLocation(final Id< T > id, String stationName)
void startMeasurable(String tag, Attributes atts)
CountsReaderMatsimV2(Counts<?> counts, Class<? extends Identifiable<?>> idClass)
void addValuesToMeasurable(Attributes atts)
static< T extends MatsimToplevelContainer &Attributable > void putCRS(T container, String CRS)
CountsReaderMatsimV2(String externalInputCRS, String targetCRS, Counts<?> counts, Class<? extends Identifiable<?>> idClass)
static final String INPUT_CRS_ATT
Attributes getAttributes()
void setName(String name)
void startTag(String name, Attributes atts, Stack< String > context)
static< T > Id< T > create(final long key, final Class< T > type)
MeasurementLocation<?> currLocation
void endTag(String name, String content, Stack< String > context)
void setDescription(String description)
void setAtSecond(int seconds, double value)
Object getAttribute(final String attribute)
static final String VALUE
static final String ELEMENT_NAME
final Class<? extends Identifiable<?> > idClass
final AttributesXmlReaderDelegate attributesDelegate
void startMeasurementLocation(Attributes atts)
void endTag(String name, String content, Stack< String > context)
void startMultiModeCounts(Attributes atts)
CoordinateTransformation coordinateTransformation
void startTag(String name, org.xml.sax.Attributes atts, Stack< String > context, Attributes currentAttributes)
void setCoordinates(Coord coordinates)