本文整理汇总了Java中com.esri.core.geometry.GeometryEngine.distance方法的典型用法代码示例。如果您正苦于以下问题:Java GeometryEngine.distance方法的具体用法?Java GeometryEngine.distance怎么用?Java GeometryEngine.distance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.esri.core.geometry.GeometryEngine
的用法示例。
在下文中一共展示了GeometryEngine.distance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMouseReleased
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Override
public void onMouseReleased(MouseEvent event) {
//System.out.println("Mouse released.");
if(isCircle){
triggerType = TRIGGER_TYPE_CIRCLE;
triggerCenterPoint = map.toMapPoint(centerPoint.x, centerPoint.y);
com.esri.core.geometry.Point triggerBorderPoint = map.toMapPoint(lastPoint.x, lastPoint.y);
// System.out.println("SRS: "+map.getSpatialReference().getID());
// System.out.println("SRS: "+map.getSpatialReference().getText());
// System.out.println("Center: x: "+triggerCenterPoint.getX()+",y: "+triggerCenterPoint.getY());
// System.out.println("Border: x: "+triggerBorderPoint.getX()+",y: "+triggerBorderPoint.getY());
triggerRadius = GeometryEngine.distance(triggerCenterPoint, triggerBorderPoint, map.getSpatialReference());
// System.out.println("Radius: "+triggerRadius);
showCreateTriggersDialog();
reset();
}
}
示例2: GetDistAsString
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
private String GetDistAsString(Graphic g, SpatialReference inputSr, String units)
{
com.esri.core.geometry.Geometry geo = g.getGeometry();
com.esri.core.geometry.Geometry curGeo;
if(!inputSr.equals(srBuffer))
{
curGeo = GeometryEngine.project(geo, inputSr, srBuffer);
}
else
{
curGeo=geo;
}
double tmpDist = GeometryEngine.distance(inGeometry, curGeo, srBuffer);
UnitConverter uc = new UnitConverter();
int inUnitWkid = uc.findWkid(srBuffer.getUnit().getName());
String cn = uc.findConnonicalName(units);
int outUnitWkid = uc.findWkid(cn);
double dist;
if(inUnitWkid!=outUnitWkid)
{
dist = uc.Convert(tmpDist, inUnitWkid, outUnitWkid);
}
else
{
dist=tmpDist;
}
DecimalFormat df = new DecimalFormat("#.00");
return df.format(dist);
}
示例3: GetDistAsString
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
private String GetDistAsString(Map<String, Object> objGeo, SpatialReference inputSr, String units) throws JsonParseException, IOException
{
Geometry geo = generateGeoFromMap(objGeo);
com.esri.core.geometry.Geometry curGeo;
if(!inputSr.equals(srBuffer))
{
curGeo = GeometryEngine.project(geo, inputSr, srBuffer);
}
else
{
curGeo=geo;
}
double tmpDist = GeometryEngine.distance(inGeometry, curGeo, srBuffer);
UnitConverter uc = new UnitConverter();
int inUnitWkid = uc.findWkid(srBuffer.getUnit().getName());
String cn = uc.findConnonicalName(units);
int outUnitWkid = uc.findWkid(cn);
double dist;
if(inUnitWkid!=outUnitWkid)
{
dist = uc.Convert(tmpDist, inUnitWkid, outUnitWkid);
}
else
{
dist=tmpDist;
}
DecimalFormat df = new DecimalFormat("#.00");
return df.format(dist);
}
示例4: getNextPoint
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
private IncrementPoint getNextPoint(Polyline polyln, Point startPt, Integer i, Double dist)
{
Point startVertex = polyln.getPoint(i);
Double currentDist = GeometryEngine.distance(startPt, startVertex, processSr);
Point segStart = null;
Point segEnd = null;
Boolean multipleVertices = true;
if(currentDist > dist)
{
segStart = startPt;
segEnd = startVertex;
multipleVertices = false;
}
while(currentDist < dist)
{
Point start = polyln.getPoint(i);
Point end = polyln.getPoint(i+1);
currentDist += GeometryEngine.distance(start, end, processSr);
++i;
}
if(multipleVertices)
{
segStart = polyln.getPoint(i-1);
segEnd = polyln.getPoint(i);
}
Double segLen = GeometryEngine.distance(segStart, segEnd, processSr);
Double distOver = currentDist - dist;
Double distOnSeg = segLen - distOver;
Point p = findPtOnSegment(segStart, segEnd, distOnSeg);
IncrementPoint ip = new IncrementPoint(p, i);
return ip;
}
示例5: ST_Distance
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
/** Returns the distance between {@code geom1} and {@code geom2}. */
public static double ST_Distance(Geom geom1, Geom geom2) {
return GeometryEngine.distance(geom1.g(), geom2.g(), geom1.sr());
}
示例6: ST_DWithin
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
/** Returns whether {@code geom1} and {@code geom2} are within
* {@code distance} of each other. */
public static boolean ST_DWithin(Geom geom1, Geom geom2, double distance) {
final double distance1 =
GeometryEngine.distance(geom1.g(), geom2.g(), geom1.sr());
return distance1 <= distance;
}
示例7: showViewshedBoundsGraphic
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
/**
* Displays a temporary graphic on the map representing the bounds of the viewshed
* that will be calculated if the given points are used.
* @param viewshedCenter the center of the proposed viewshed (i.e. the observer).
* @param viewshedOuter the outer point of the proposed viewshed's boundaries.
* @return the distance between the two points.
* @see #showViewshedBoundsGraphic(com.esri.core.geometry.Point, double)
* @see #removeViewshedBoundsGraphic()
*/
public double showViewshedBoundsGraphic(Point viewshedCenter, Point viewshedOuter) {
double radius = GeometryEngine.distance(
viewshedCenter,
viewshedOuter,
mapController.getSpatialReference());
showViewshedBoundsGraphic(viewshedCenter, radius);
return radius;
}