Java Code Examples for mil.nga.sf.LineString#getPoints()
The following examples show how to use
mil.nga.sf.LineString#getPoints() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultFeatureTiles.java From geopackage-android with MIT License | 6 votes |
/** * Add the linestring to the path * * @param simplifyTolerance simplify tolerance in meters * @param boundingBox bounding box * @param transform projection transform * @param path path * @param lineString line string */ private void addLineString(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, Path path, LineString lineString) { List<Point> points = lineString.getPoints(); if (points.size() >= 2) { // Try to simplify the number of points in the LineString points = simplifyPoints(simplifyTolerance, points); for (int i = 0; i < points.size(); i++) { Point point = points.get(i); Point webMercatorPoint = transform.transform(point); float x = TileBoundingBoxUtils.getXPixel(tileWidth, boundingBox, webMercatorPoint.getX()); float y = TileBoundingBoxUtils.getYPixel(tileHeight, boundingBox, webMercatorPoint.getY()); if (i == 0) { path.moveTo(x, y); } else { path.lineTo(x, y); } } } }
Example 2
Source File: DefaultFeatureTiles.java From geopackage-android with MIT License | 6 votes |
/** * Add the polygon on the canvas * * @param simplifyTolerance simplify tolerance in meters * @param boundingBox bounding box * @param transform projection transform * @param path path * @param polygon polygon */ private void addPolygon(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, Path path, Polygon polygon) { List<LineString> rings = polygon.getRings(); if (!rings.isEmpty()) { // Add the polygon points LineString polygonLineString = rings.get(0); List<Point> polygonPoints = polygonLineString.getPoints(); if (polygonPoints.size() >= 2) { addRing(simplifyTolerance, boundingBox, transform, path, polygonPoints); // Add the holes for (int i = 1; i < rings.size(); i++) { LineString holeLineString = rings.get(i); List<Point> holePoints = holeLineString.getPoints(); if (holePoints.size() >= 2) { addRing(simplifyTolerance, boundingBox, transform, path, holePoints); } } } } }
Example 3
Source File: FeatureUtils.java From geopackage-android with MIT License | 5 votes |
/** * Validate Line String * * @param topGeometry * @param lineString */ private static void validateLineString(Geometry topGeometry, LineString lineString) { TestCase.assertEquals(GeometryType.LINESTRING, lineString.getGeometryType()); validateZAndM(topGeometry, lineString); for (Point point : lineString.getPoints()) { validatePoint(topGeometry, point); } }
Example 4
Source File: FeatureUtils.java From geopackage-java with MIT License | 5 votes |
/** * Validate Line String * * @param topGeometry * @param lineString */ private static void validateLineString(Geometry topGeometry, LineString lineString) { TestCase.assertEquals(GeometryType.LINESTRING, lineString.getGeometryType()); validateZAndM(topGeometry, lineString); for (Point point : lineString.getPoints()) { validatePoint(topGeometry, point); } }