本文整理汇总了Java中com.vividsolutions.jts.geom.LineString.getPointN方法的典型用法代码示例。如果您正苦于以下问题:Java LineString.getPointN方法的具体用法?Java LineString.getPointN怎么用?Java LineString.getPointN使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vividsolutions.jts.geom.LineString
的用法示例。
在下文中一共展示了LineString.getPointN方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addPolygon
import com.vividsolutions.jts.geom.LineString; //导入方法依赖的package包/类
private void addPolygon(String name, Polygon poly, int color) {
final PolygonOptions polyOptions = new PolygonOptions();
final LineString exteriorRing = poly.getExteriorRing();
for (int iPnt = 0; iPnt < exteriorRing.getNumPoints(); iPnt++) {
final Point p = exteriorRing.getPointN(iPnt);
polyOptions.add(new LatLng(p.getY(), p.getX()));
}
for (int iHole = 0; iHole < poly.getNumInteriorRing(); iHole++) {
final LineString interiorRing = poly.getInteriorRingN(iHole);
final List<LatLng> holePnts = new ArrayList<LatLng>();
for (int iPnt = 0; iPnt < interiorRing.getNumPoints(); iPnt++) {
final Point pnt = interiorRing.getPointN(iPnt);
holePnts.add(new LatLng(pnt.getY(), pnt.getX()));
}
polyOptions.addHole(holePnts);
}
mMap.addPolygon(polyOptions
.strokeWidth(1)
.strokeColor(Color.DKGRAY)
.fillColor(color));
}
示例2: copyConvexHullPoints
import com.vividsolutions.jts.geom.LineString; //导入方法依赖的package包/类
private void copyConvexHullPoints(Polygon poly)
{
LineString ring = (LineString)poly.getExteriorRing();
if (prevIsoPoints == null)
prevIsoPoints = new ArrayList<Coordinate>(ring.getNumPoints());
else
prevIsoPoints.clear();
for (int i = 0; i< ring.getNumPoints(); ++i)
{
Point p = ring.getPointN(i);
prevIsoPoints.add(new Coordinate(p.getX(), p.getY()));
}
}
示例3: getFurthestPoint
import com.vividsolutions.jts.geom.LineString; //导入方法依赖的package包/类
/**
* détermine le point d'une ligne le plus loin d'une ligne de base. Determine
* the closest point of a line to another given line.
*
* @param base la ligne de comparaison, the base line
* @param l une ligne, a line
*/
public static IDirectPosition getFurthestPoint(ILineString base, ILineString l) {
try {
LineString baseLine = (LineString) AdapterFactory.toGeometry(
new GeometryFactory(), base);
LineString line = (LineString) AdapterFactory.toGeometry(
new GeometryFactory(), l);
double distanceMax = Double.MIN_VALUE;
Point pointLePlusLoin = null;
for (int i = 0; i < line.getNumPoints(); i++) {
Point p = line.getPointN(i);
double distance = p.distance(baseLine);
if (distance > distanceMax) {
distanceMax = distance;
pointLePlusLoin = p;
}
}
if (pointLePlusLoin != null) {
return AdapterFactory.toDirectPosition(pointLePlusLoin.getCoordinate());
// return
// AdapterFactory.toDirectPosition(JtsUtil.getPointLePlusProche(point,
// line).getCoordinate());
}
} catch (Exception e) {
}
return null;
}
示例4: addLineString
import com.vividsolutions.jts.geom.LineString; //导入方法依赖的package包/类
private void addLineString(String name, LineString lineString) {
final PolylineOptions polyOptions = new PolylineOptions();
for (int iPnt = 0; iPnt < lineString.getNumPoints(); iPnt++) {
final Point p = lineString.getPointN(iPnt);
polyOptions.add(new LatLng(p.getY(), p.getX()));
}
mMap.addPolyline(polyOptions
.width(1)
.color(Color.YELLOW));
}