本文整理匯總了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));
}