use of uk.me.parabola.imgfmt.app.Coord in project mkgmap by openstreetmap.
the class Polyline method getNodeCount.
/**
* @param countAllNodes : false: count only coord nodes, true: count number nodes
* @return
*/
public int getNodeCount(boolean countAllNodes) {
int idx = 0;
int count = 0;
for (Coord co : points) {
if (idx++ > 0 && (co.getId() > 0 || countAllNodes && co.isNumberNode()))
count++;
}
return count;
}
use of uk.me.parabola.imgfmt.app.Coord in project mkgmap by openstreetmap.
the class RuleFileReaderTest method getWayForClosedCompleteCheck.
/**
* Get a way with a few points for testing the closed and complete flag.
* @param closed way should be closed
* @param complete way should not be complete
*/
private Way getWayForClosedCompleteCheck(boolean closed, boolean complete) {
Way el = new Way(1);
el.addTag("A", "B");
el.addPoint(new Coord(1000, 1000));
el.addPoint(new Coord(1000, 2000));
el.addPoint(new Coord(2000, 2000));
el.addPoint(new Coord(2000, 1000));
if (closed)
el.addPoint(el.getPoints().get(0));
el.setComplete(complete);
el.setClosedInOSM(true);
return el;
}
use of uk.me.parabola.imgfmt.app.Coord in project mkgmap by openstreetmap.
the class StyledConverterTest method makeConverter.
private StyledConverter makeConverter(String name) throws FileNotFoundException {
Style style = new StyleImpl(LOC, name);
MapCollector coll = new MapCollector() {
public void addToBounds(Coord p) {
}
// could save points in the same way as lines to test them
public void addPoint(MapPoint point) {
}
public void addLine(MapLine line) {
// Save line so that it can be examined in the tests.
assertNotNull("points are not null", line.getPoints());
lines.add(line);
}
public void addShape(MapShape shape) {
}
public void addRoad(MapRoad road) {
lines.add(road);
}
public int addRestriction(GeneralRouteRestriction grr) {
return 0;
}
public void addThroughRoute(int junctionNodeId, long roadIdA, long roadIdB) {
}
};
return new StyledConverter(style, coll, new EnhancedProperties());
}
use of uk.me.parabola.imgfmt.app.Coord in project mkgmap by openstreetmap.
the class QuadTree method isCloseToPolygon.
private static boolean isCloseToPolygon(Coord point, List<Coord> polygon, int gap) {
Iterator<Coord> polyIter = polygon.iterator();
Coord c2 = polyIter.next();
while (polyIter.hasNext()) {
Coord c1 = c2;
c2 = polyIter.next();
double dist = point.shortestDistToLineSegment(c1, c2);
if (dist <= gap) {
return true;
}
}
return false;
}
use of uk.me.parabola.imgfmt.app.Coord in project mkgmap by openstreetmap.
the class QuadTreeNode method get.
public ArrayList<Coord> get(QuadTreePolygon polygon, ArrayList<Coord> resultList) {
if (polygon.getBbox().intersects(getBounds())) {
if (isLeaf()) {
for (Coord c : points) {
if (polygon.getArea().contains(c.getLongitude(), c.getLatitude())) {
resultList.add(c);
}
}
} else {
for (QuadTreeNode child : children) {
if (polygon.getBbox().intersects(child.getBounds())) {
java.awt.geom.Area subArea = (java.awt.geom.Area) polygon.getArea().clone();
subArea.intersect(createArea(child.getBounds()));
child.get(new QuadTreePolygon(subArea), resultList);
}
}
}
}
return resultList;
}
Aggregations