当前位置: 首页>>代码示例>>Java>>正文


Java Polygon.startPath方法代码示例

本文整理汇总了Java中com.esri.core.geometry.Polygon.startPath方法的典型用法代码示例。如果您正苦于以下问题:Java Polygon.startPath方法的具体用法?Java Polygon.startPath怎么用?Java Polygon.startPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.esri.core.geometry.Polygon的用法示例。


在下文中一共展示了Polygon.startPath方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: GenerateEllipse

import com.esri.core.geometry.Polygon; //导入方法依赖的package包/类
public Polygon GenerateEllipse(Point center, double majorAxis, double minorAxis, double ra)
{
	Polygon ellipse = new Polygon();
	for (int i = 0; i < 360; ++i)
	{
		double theta = Math.toRadians(i);
		Point p = ellipsePtFromAngle(center, majorAxis, minorAxis, theta);
		p = GeometryUtility.Rotate(center, p, ra);
		if (i == 0) {
			ellipse.startPath(p);
		}
		else{
			ellipse.lineTo(p);
		}
	}
	ellipse.closeAllPaths();
	return ellipse;
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:19,代码来源:GeometryUtility.java

示例2: parseSimplePolygonCoordinates

import com.esri.core.geometry.Polygon; //导入方法依赖的package包/类
/**
 * Example:
 * [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ]
 * @param parser
 * @return a polygon
 * @throws JsonParseException
 * @throws IOException
 */
private Polygon parseSimplePolygonCoordinates(JsonNode node) {
  Polygon g = new Polygon();
  boolean first = true;
  ArrayNode points = (ArrayNode) node;
  for (JsonNode point : points) {
    Point p = parsePointCoordinates(point);
    if (first) {
      g.startPath(p);
      first = false;
    } else {
      g.lineTo(p);
    }  
  }
  g.closeAllPaths();
  return g;
}
 
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:25,代码来源:GeoJsonParser.java

示例3: constructGeometryFromString

import com.esri.core.geometry.Polygon; //导入方法依赖的package包/类
private com.esri.ges.spatial.Geometry constructGeometryFromString(String geoString) throws GeometryException
{
	String[] pairs = geoString.split(" ");
	
	Polygon polygon = new Polygon();
	Boolean firstit = true;
	for(String coords: pairs)
	{
		
		String[] tuple = coords.split(",");
		Double x = Double.parseDouble(tuple[0]);
		Double y = Double.parseDouble(tuple[1]);
		Point p = new Point(x,y);
		Double z = Double.NaN;
		if (tuple.length>2)
		{
			z = Double.parseDouble(tuple[2]);
			p.setZ(z);
		}
		if(firstit)
		{
			polygon.startPath(p);
			firstit=false;
		}
		else
		{
			polygon.lineTo(p);
		}
	}
	polygon.closeAllPaths();
	String json = GeometryEngine.geometryToJson(srIn, polygon);
	return spatial.fromJson(json);
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:34,代码来源:QueryReportProcessor.java

示例4: constructCAPGeometry

import com.esri.core.geometry.Polygon; //导入方法依赖的package包/类
private com.esri.ges.spatial.Geometry constructCAPGeometry(String geoString)
		throws GeometryException {
	try {
		String[] pairs = geoString.split(" ");

		Polygon polygon = new Polygon();
		Boolean firstit = true;
		for (String coords : pairs) {

			String[] tuple = coords.split(",");
			Double x = Double.parseDouble(tuple[0]);
			Double y = Double.parseDouble(tuple[1]);
			Point p = new Point(x, y);
			Double z = Double.NaN;
			if (tuple.length > 2) {
				z = Double.parseDouble(tuple[2]);
				p.setZ(z);
			}
			if (firstit) {
				polygon.startPath(p);
				firstit = false;
			} else {
				polygon.lineTo(p);
			}
		}
		polygon.closeAllPaths();
		String json = GeometryEngine.geometryToJson(srIn, polygon);
		return spatial.fromJson(json);
	} catch (GeometryException ex) {
		LOG.error(ex.getMessage());
		LOG.error(ex.getStackTrace());
		return null;
	}
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:35,代码来源:PolygonProcessor.java

示例5: constructRangeFan

import com.esri.core.geometry.Polygon; //导入方法依赖的package包/类
private Geometry constructRangeFan(double x, double y, double range,
		String unit, double bearing, double traversal)
		throws GeometryException {
	Polygon fan = new Polygon();
	Point center = new Point();
	center.setX(x);
	center.setY(y);
	// SpatialReference srIn = SpatialReference.create(wkidin);
	// SpatialReference srBuffer = SpatialReference.create(wkidbuffer);
	// SpatialReference srOut = SpatialReference.create(wkidout);
	Point centerProj = (Point) GeometryEngine.project(center, srIn,
			srBuffer);

	double centerX = centerProj.getX();
	double centerY = centerProj.getY();
	bearing = GeometryUtility.Geo2Arithmetic(bearing);
	double leftAngle = bearing - (traversal / 2);
	double rightAngle = bearing + (traversal / 2);
	int count = (int) Math.round(Math.abs(leftAngle - rightAngle));
	fan.startPath(centerProj);
	UnitConverter uc = new UnitConverter();
	range = uc.Convert(range, unit, srBuffer);
	for (int i = 0; i < count; ++i) {
		double d = Math.toRadians(leftAngle + i);
		double arcX = centerX + (range * Math.cos(d));
		double arcY = centerY + (range * Math.sin(d));
		Point arcPt = new Point(arcX, arcY);
		// arcPt = (Point) GeometryEngine.project(arcPt, srBuffer, srOut);
		fan.lineTo(arcPt);
	}
	fan.closeAllPaths();
	return fan;
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:34,代码来源:RangeFanProcessor.java

示例6: constructRangeFan

import com.esri.core.geometry.Polygon; //导入方法依赖的package包/类
private Geometry constructRangeFan(double x, double y, double range,
		String unit, double bearing, double traversal) throws Exception {
	try {
		Polygon fan = new Polygon();
		Point center = new Point();
		center.setX(x);
		center.setY(y);

		Point centerProj = (Point) GeometryEngine.project(center, srIn,
				srBuffer);

		double centerX = centerProj.getX();
		double centerY = centerProj.getY();
		bearing = GeometryUtility.Geo2Arithmetic(bearing);
		double leftAngle = bearing - (traversal / 2);
		double rightAngle = bearing + (traversal / 2);
		int count = (int) Math.round(Math.abs(leftAngle - rightAngle));
		fan.startPath(centerProj);
		UnitConverter uc = new UnitConverter();
		range = uc.Convert(range, unit, srBuffer);
		for (int i = 0; i < count; ++i) {
			double d = Math.toRadians(leftAngle + i);
			double arcX = centerX + (range * Math.cos(d));
			double arcY = centerY + (range * Math.sin(d));
			Point arcPt = new Point(arcX, arcY);
			fan.lineTo(arcPt);
		}
		fan.closeAllPaths();
		return fan;
	} catch (Exception e) {
		LOG.error(e.getMessage());
		throw e;
	}
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:35,代码来源:RangeFanProcessor.java

示例7: constructGeometryFromString

import com.esri.core.geometry.Polygon; //导入方法依赖的package包/类
private MapGeometry constructGeometryFromString(String geoString)
{
	String[] pairs = geoString.split(" ");
	
	Polygon polygon = new Polygon();
	Boolean firstit = true;
	for(String coords: pairs)
	{
		
		String[] tuple = coords.split(",");
		Double x = Double.parseDouble(tuple[0]);
		Double y = Double.parseDouble(tuple[1]);
		Point p = new Point(x,y);
		Double z = Double.NaN;
		if (tuple.length>2)
		{
			z = Double.parseDouble(tuple[2]);
			p.setZ(z);
		}
		if(firstit)
		{
			polygon.startPath(p);
			firstit=false;
		}
		else
		{
			polygon.lineTo(p);
		}
	}
	polygon.closeAllPaths();
	MapGeometry mapgeo = new MapGeometry(polygon, srOut);
	return mapgeo;
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:34,代码来源:QueryReportProcessor.java

示例8: constructGeometryFromString

import com.esri.core.geometry.Polygon; //导入方法依赖的package包/类
private MapGeometry constructGeometryFromString(String geoString) {
	String[] pairs = geoString.split(" ");

	Polygon polygon = new Polygon();
	Boolean firstit = true;
	for (String coords : pairs) {

		String[] tuple = coords.split(",");
		Double x = Double.parseDouble(tuple[0]);
		Double y = Double.parseDouble(tuple[1]);
		Point p = new Point(x, y);
		Double z = Double.NaN;
		if (tuple.length > 2) {
			z = Double.parseDouble(tuple[2]);
			p.setZ(z);
		}
		if (firstit) {
			polygon.startPath(p);
			firstit = false;
		} else {
			polygon.lineTo(p);
		}
	}
	polygon.closeAllPaths();
	MapGeometry mapgeo = new MapGeometry(polygon, srOut);
	return mapgeo;
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:28,代码来源:SpatialQProcessor.java

示例9: contains

import com.esri.core.geometry.Polygon; //导入方法依赖的package包/类
@TypeParameter(StandardTypes.DOUBLE)
@SqlType(StandardTypes.BOOLEAN)
@Nullable
public static Boolean contains(
        @TypeParameter(StandardTypes.DOUBLE) Type elementType,
        @SqlType("array(double)") Block arrayBlock,
        @SqlType(StandardTypes.DOUBLE) double lng,
        @SqlType(StandardTypes.DOUBLE) double lat)
{
    double[] array= new double[arrayBlock.getPositionCount()] ;
    Polygon poly = new Polygon();

    for (int i = 0; i < arrayBlock.getPositionCount(); i++) {

        if (arrayBlock.isNull(i)) {
            continue;
        }
        array[i]=elementType.getDouble(arrayBlock, i);

    }

    poly.startPath(array[0], array[1]);
    for (int i = 2; i < array.length; i += 2) {
        poly.lineTo(array[i], array[i + 1]);
    }
    return OperatorContains.local().execute(poly, new Point(lng,lat), null, null);
}
 
开发者ID:Cuebiq,项目名称:presto-cuebiq-functions,代码行数:28,代码来源:PolyContains.java

示例10: createPolygon

import com.esri.core.geometry.Polygon; //导入方法依赖的package包/类
private static Polygon createPolygon() {
	Polygon polygon = new Polygon();
	polygon.startPath(createFirstLocation());
	polygon.lineTo(createSecondLocation());
	polygon.lineTo(createThirdLocation());
	polygon.lineTo(createFourthLocation());
	polygon.closeAllPaths();
	return polygon;
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:10,代码来源:TestStGeomFromShape.java

示例11: getConvexHull

import com.esri.core.geometry.Polygon; //导入方法依赖的package包/类
private Polygon getConvexHull(Cluster<ClusterableLocation> cluster) {
  List<ClusterableLocation> pointsList = cluster.getPoints();
  ClusterableLocation[] pointsArray = pointsList.toArray(new ClusterableLocation[pointsList.size()]);
  ClusterableLocation[] pointsConvexHull = ConvexHullGenerator.generateHull(pointsArray);
  Polygon convexHull = new Polygon();
  convexHull.startPath(pointsConvexHull[0].getPoint()[0], pointsConvexHull[0].getPoint()[1]);
  for (int i = 1; i < pointsConvexHull.length; i++) {
    ClusterableLocation p = pointsConvexHull[i];
    convexHull.lineTo(p.getPoint()[0], p.getPoint()[1]);
  }
  convexHull.closePathWithLine();
  return convexHull;
}
 
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:14,代码来源:ClusterLayer.java

示例12: findBoundingBox

import com.esri.core.geometry.Polygon; //导入方法依赖的package包/类
private Geometry findBoundingBox(String mgrs, int accuracy, Point mgrsPt)
{
	String mgrsZone = mgrs.substring(0, 1);
	int wkid = 0;
	String utm = null;
	if(mgrsZone.equals("A") || mgrsZone.equals("B") )
	{
		wkid = 32761;
	}
	else if(mgrsZone.equals("Y") || mgrsZone.equals("Z"))
	{
		wkid = 32661;
	}
	else
	{
		PeGeogcs peGeoCS = PeFactory.geogcs(4326);
		double[] coordArray = {mgrsPt.getX(), mgrsPt.getY()};
		String[] utmArray = new String[1];
		PeNotationUtm.geog_to_utm(peGeoCS, 1, coordArray, PeNotationUtm.PE_UTM_OPTS_NS, utmArray);
		utm=utmArray[0];
		wkid=GetWkidFromUTM(utm);
		
	}
	SpatialReference pcs = SpatialReference.create(wkid);
	SpatialReference gcs = SpatialReference.create(4326);
	Geometry projGeo = GeometryEngine.project(mgrsPt, gcs, pcs);//projec local
	Point projPt = (Point)projGeo;
	double dist = getDistFromAccuracy(accuracy);
	double xmin, ymin, xmax, ymax;
	xmin=projPt.getX();
	ymin=projPt.getY();
	xmax = xmin + dist;
	ymax = ymin + dist;
	Polygon pbb = new Polygon();
	pbb.startPath(xmin, ymin);
	pbb.lineTo(xmax, ymin);
	pbb.lineTo(xmax, ymax);
	pbb.lineTo(xmin, ymax);
	pbb.lineTo(xmin, ymin);
	pbb.closeAllPaths();
	Geometry bb = GeometryEngine.project(pbb, pcs, gcs);//project back to wgs84
	return bb;
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:44,代码来源:LatLongProcessor.java


注:本文中的com.esri.core.geometry.Polygon.startPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。