當前位置: 首頁>>代碼示例>>Java>>正文


Java LineString.getPointN方法代碼示例

本文整理匯總了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));
}
 
開發者ID:sevar83,項目名稱:SpatiAtlas,代碼行數:25,代碼來源:MapFragment.java

示例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()));
	}
}
 
開發者ID:GIScience,項目名稱:openrouteservice,代碼行數:14,代碼來源:ConcaveBallsIsochroneMapBuilder.java

示例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;
}
 
開發者ID:IGNF,項目名稱:geoxygene,代碼行數:34,代碼來源:JtsAlgorithms.java

示例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));
}
 
開發者ID:sevar83,項目名稱:SpatiAtlas,代碼行數:13,代碼來源:MapFragment.java


注:本文中的com.vividsolutions.jts.geom.LineString.getPointN方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。