当前位置: 首页>>代码示例>>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;未经允许,请勿转载。