本文整理汇总了Java中com.esri.core.geometry.Point类的典型用法代码示例。如果您正苦于以下问题:Java Point类的具体用法?Java Point怎么用?Java Point使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Point类属于com.esri.core.geometry包,在下文中一共展示了Point类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: constructBuffer
import com.esri.core.geometry.Point; //导入依赖的package包/类
private com.esri.ges.spatial.Geometry constructBuffer(double x, double y, double radius, String units, int wkidin, int wkidbuffer, int wkidout) throws GeometryException
{
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);
UnitConverter uc = new UnitConverter();
String c_name = uc.findConnonicalName(units);
int unitout = uc.findWkid(c_name);
Unit u = new LinearUnit(unitout);
Point centerProj = (Point) GeometryEngine.project(center, srIn, srBuffer);
Geometry buffer = GeometryEngine.buffer(centerProj, srBuffer, radius, u);
Geometry bufferout = GeometryEngine.project(buffer, srBuffer, srOut);
String json = GeometryEngine.geometryToJson(srOut, bufferout);
return spatial.fromJson(json);
}
示例2: _parseGeometryType
import com.esri.core.geometry.Point; //导入依赖的package包/类
private static String _parseGeometryType(GeometryType t)
{
String type = null;
if(t == GeometryType.Point)
{
type = "esriGeometryPoint";
}
else if (t==GeometryType.Polyline)
{
type = "esriGeometryPolyline";
}
else if (t==GeometryType.Polygon)
{
type = "esriGeometryPolygon";
}
else if (t==GeometryType.MultiPoint)
{
type = "esriGeometryMultiPoint";
}
return type;
}
示例3: GenerateEllipse
import com.esri.core.geometry.Point; //导入依赖的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;
}
示例4: _parseGeometryType
import com.esri.core.geometry.Point; //导入依赖的package包/类
private static String _parseGeometryType(Geometry.Type t)
{
String type = null;
if(t == Geometry.Type.Point)
{
type = "esriGeometryPoint";
}
else if (t==Geometry.Type.Polyline)
{
type = "esriGeometryPolyline";
}
else if (t==Geometry.Type.Polygon)
{
type = "esriGeometryPolygon";
}
else if (t==Geometry.Type.MultiPoint)
{
type = "esriGeometryMultiPoint";
}
return type;
}
示例5: panTo
import com.esri.core.geometry.Point; //导入依赖的package包/类
/**
* Pans the map to a new center point, if a valid MGRS string is provided.
* @param newCenterMgrs the map's new center point, as an MGRS string.
* @return if the string was valid, the point to which the map was panned; null otherwise
*/
public Point panTo(String newCenterMgrs) {
newCenterMgrs = Utilities.convertToValidMgrs(newCenterMgrs,
pointToMgrs(map.getExtent().getCenter(), map.getSpatialReference()));
if (null != newCenterMgrs) {
Point pt = mgrsToPoint(newCenterMgrs);
if (null != pt) {
map.panTo(pt);
return pt;
} else {
Logger.getLogger(getClass().getName()).warning("MGRS string " + newCenterMgrs + " could not be converted to a point");
return null;
}
} else {
return null;
}
}
示例6: constructEllipse
import com.esri.core.geometry.Point; //导入依赖的package包/类
private MapGeometry constructEllipse(double x, double y, double majorAxis, double minorAxis, double rotation, int wkidin, int wkidbuffer, int wkidout)
{
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);
UnitConverter uc = new UnitConverter();
majorAxis = uc.Convert(majorAxis, units, srBuffer);
minorAxis = uc.Convert(minorAxis, units, srBuffer);
Point centerProj = (Point) GeometryEngine.project(center, srIn, srBuffer);
GeometryUtility geoutil = new GeometryUtility();
Polygon ellipse = geoutil.GenerateEllipse(centerProj, majorAxis, minorAxis, rotation);
Geometry ellipseOut = GeometryEngine.project(ellipse, srBuffer, srOut);
MapGeometry mapGeo = new MapGeometry(ellipseOut, srOut);
return mapGeo;
}
示例7: hasGeometryMoved
import com.esri.core.geometry.Point; //导入依赖的package包/类
private boolean hasGeometryMoved(MapGeometry geom1, MapGeometry geom2,
double tolerance) {
if (geom1 != null && geom1.getGeometry() != null
&& geom1.getGeometry().getType() == Type.Point && geom2 != null
&& geom2.getGeometry() != null
&& geom2.getGeometry().getType() == Type.Point) {
Point corePt1 = (Point) geom1.getGeometry();
Point corePt2 = (Point) geom2.getGeometry();
double meters = 0.0;
try {
meters = GeometryEngine.geodesicDistanceOnWGS84(corePt1,
corePt2);
} catch (Throwable error) {
LOGGER.error(error.getMessage());
}
double feet = meter2feet(meters);
if (feet >= tolerance)
return true;
else
return false;
} else {
throw new RuntimeException(
LOGGER.translate("INVALID_GEOMETRY_TYPE"));
}
}
示例8: process
import com.esri.core.geometry.Point; //导入依赖的package包/类
@Override
public GeoEvent process(GeoEvent ge) throws Exception {
// Operation phase...
if (radius == null) {
radius = (Double) ge.getField(bufferEventFld);
if (radius == null) {
Exception e = new Exception("Radius is not defined in geoevent");
throw (e);
}
}
MapGeometry mapGeo = ge.getGeometry();
Point eventGeo = (Point) mapGeo.getGeometry();
double x = eventGeo.getX();
double y = eventGeo.getY();
int inwkid = mapGeo.getSpatialReference().getID();
//int inwkid = eventGeo.getSpatialReference().getWkid();
Geometry buffer = constructBuffer(x, y, radius,
units, inwkid, bufferwkid, outwkid);
SpatialReference srOut = SpatialReference.create(outwkid);
MapGeometry outMapGeo = new MapGeometry(buffer, srOut);
ge.setGeometry(outMapGeo);
return ge;
}
示例9: constructBuffer
import com.esri.core.geometry.Point; //导入依赖的package包/类
private Geometry constructBuffer(double x, double y,
double radius, String units, int wkidin, int wkidbuffer, int wkidout)
{
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);
UnitConverter uc = new UnitConverter();
String c_name = uc.findConnonicalName(units);
int unitout = uc.findWkid(c_name);
Unit u = LinearUnit.create(unitout);
Point centerProj = (Point) GeometryEngine.project(center, srIn,
srBuffer);
Geometry buffer = GeometryEngine
.buffer(centerProj, srBuffer, radius, u);
Geometry bufferout = GeometryEngine.project(buffer, srBuffer, srOut);
//String json = GeometryEngine.geometryToJson(srOut, bufferout);
return bufferout;
}
示例10: getDistanceBearingString
import com.esri.core.geometry.Point; //导入依赖的package包/类
private String getDistanceBearingString(Point from, Point to) {
double bearingDegrees = Utilities.calculateBearingDegrees(from, to);
AngularUnit destUnit = Utilities.getAngularUnit(appConfigController.getHeadingUnits());
AngularUnit degreesUnit = Utilities.getAngularUnit(AngularUnit.Code.DEGREE);
long bearingInDestUnit = Math.round(bearingDegrees * degreesUnit.getConversionFactor(destUnit));
long distance = Math.round(GeometryEngine.distance(
GeometryEngine.project(from, Utilities.WGS84, mapController.getSpatialReference()),
GeometryEngine.project(to, Utilities.WGS84, mapController.getSpatialReference()),
mapController.getSpatialReference()));
String ret = bearingInDestUnit + destUnit.getAbbreviation() + "\n\n"
+ distance + mapController.getSpatialReference().getUnit().getAbbreviation();
return ret;
}
示例11: identifyComplete
import com.esri.core.geometry.Point; //导入依赖的package包/类
/**
* Called when an identify operation completes.
* @see IdentifyListener
* @param identifyPoint the point used to run the identify operation.
* @param results the identify results.
* @param resultToLayer a map of results to the layer from which each result comes.
*/
public void identifyComplete(Point identifyPoint, IdentifiedItem[] results, Map<IdentifiedItem, Layer> resultToLayer) {
if (0 < results.length) {
identifyPanel.setIdentifyPoint(identifyPoint);
identifyPanel.setResults(results, resultToLayer);
int panelWidth = getWidth() / 5;
if (300 > panelWidth) {
panelWidth = 300;
}
identifyPanel.setSize(panelWidth,
jPanel_navigation.getLocation().y + jPanel_navigation.getSize().height - jToggleButton_911.getLocation().y);
identifyPanel.setLocation(
jPanel_navigation.getLocation().x + jPanel_navigation.getWidth() - identifyPanel.getWidth(),
jToggleButton_911.getLocation().y);
identifyPanel.setVisible(true);
}
}
示例12: showPoint
import com.esri.core.geometry.Point; //导入依赖的package包/类
/**
* Tells the controller to display the given point.
* @param pt the point to display.
* @param sr the spatial reference of the point to display.
*/
public void showPoint(Point pt, SpatialReference sr) {
synchronized (graphicUpdateLock) {
lastPointShownLatLon = (Point) GeometryEngine.project(pt, sr, Utilities.WGS84);
if (-1 == pointGraphicId) {
createPointGraphic(pt);
createTextGraphics(pt);
} else {
updateGraphic(pointGraphicId, pt);
updateTextGraphics(pt);
updateTextGraphics(getDistanceBearingString(currentGpsPointLatLon, lastPointShownLatLon));
}
}
setLayerVisibility(true);
moveLayerToTop();
}
示例13: constructEllipse
import com.esri.core.geometry.Point; //导入依赖的package包/类
private com.esri.ges.spatial.Geometry constructEllipse(double x, double y, double majorAxis, double minorAxis, double rotation, int wkidin, int wkidbuffer, int wkidout) throws GeometryException
{
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);
GeometryUtility geoutil = new GeometryUtility();
Polygon ellipse = geoutil.GenerateEllipse(centerProj, majorAxis, minorAxis, rotation);
Geometry ellipseOut = GeometryEngine.project(ellipse, srBuffer, srOut);
String json = GeometryEngine.geometryToJson(srOut, ellipseOut);
return spatial.fromJson(json);
}
示例14: constructGeometryFromString
import com.esri.core.geometry.Point; //导入依赖的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);
}
示例15: constructCAPGeometry
import com.esri.core.geometry.Point; //导入依赖的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;
}
}