@Override public boolean isInRange(Count<Link> count) { double dist = CoordUtils.calcEuclideanDistance(count.getCoord(), centerCoord); return dist < distance; } };
@Override public void startCount(final Count count, final BufferedWriter out) throws IOException { out.write("\t<count"); out.write(" loc_id=\"" + count.getId() + "\""); out.write(" cs_id=\"" + count.getCsLabel() + "\""); if (count.getCoord() != null) { final Coord coord = coordinateTransformation.transform( count.getCoord() ); out.write(" x=\"" + coord.getX() + "\""); out.write(" y=\"" + coord.getY() + "\""); } out.write(">\n"); }
for (Count count : this.counts.getCounts().values()) { Id stopId = count.getId(); if (!isInRange(count.getCoord())) { continue;
writer.write((anOcuppancy) + TAB); writer.write(count.getCoord().toString() + TAB + count.getCsLabel() + NL);
private void assertCountsAreReprojectedCorrectly( Counts<Link> originalCounts, Counts<Link> reprojectedCounts) { Assert.assertEquals( "unexpected number of counts", originalCounts.getCounts().size(), reprojectedCounts.getCounts().size() ); for ( Id<Link> id : originalCounts.getCounts().keySet() ) { final Coord original = originalCounts.getCount( id ).getCoord(); final Coord transformed = reprojectedCounts.getCount( id ).getCoord(); Assert.assertEquals( "wrong reprojected X value", original.getX() + 1000 , transformed.getX(), MatsimTestUtils.EPSILON ); Assert.assertEquals( "wrong reprojected Y value", original.getY() + 1000 , transformed.getY(), MatsimTestUtils.EPSILON ); } }
public void testSEElementCountWithCoords() throws SAXException { AttributeFactory attributeFactory = new AttributeFactory(); final Counts counts = new Counts(); MatsimCountsReader reader = new MatsimCountsReader(counts); reader.setDoctype("counts_v1.xsd"); reader.startElement("", "counts", "counts", attributeFactory.createCountsAttributes()); reader.startElement("", "count", "count", attributeFactory.createCountAttributesWithCoords()); Count count = counts.getCount(Id.create(1, Link.class)); assertNotNull("Count attribute x,y setting failed", count.getCoord()); assertEquals("Count attribute x setting failed", 123.456, count.getCoord().getX(), EPSILON); assertEquals("Count attribute y setting failed", 987.654, count.getCoord().getY(), EPSILON); reader.endElement("", "count", "count"); reader.endElement("", "counts", "counts"); }
coord = this.coordTransform.transform(calculatePlacemarkPosition(link)); } else { coord = this.coordTransform.transform(this.counts.getCount(itemId).getCoord());
coord = this.coordTransform.transform(count.getCoord()); relativeError = csc.calculateRelativeError() * 100;
if (simCounts.getCount(countSimComparison.getId()) == null) { simCounts.createAndAddCount(countSimComparison.getId(), counts.getCount(countSimComparison.getId()).getCsLabel()); simCounts.getCount(countSimComparison.getId()).setCoord(counts.getCount(countSimComparison.getId()).getCoord());
public void testSEElementCountWithoutCoords() throws SAXException { AttributeFactory attributeFactory = new AttributeFactory(); final Counts counts = new Counts(); MatsimCountsReader reader = new MatsimCountsReader(counts); reader.setDoctype("counts_v1.xsd"); reader.startElement("", "counts", "counts", attributeFactory.createCountsAttributes()); reader.startElement("", "count", "count", attributeFactory.createCountAttributes()); Count count = counts.getCount(Id.create(1, Link.class)); assertEquals("Count attribute setting failed", "testNr", count.getCsLabel()); assertNull("Count attributes x,y should not be set", count.getCoord()); reader.endElement("", "count", "count"); reader.endElement("", "counts", "counts"); }