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