本文整理汇总了Java中com.esri.core.geometry.MapGeometry.getGeometry方法的典型用法代码示例。如果您正苦于以下问题:Java MapGeometry.getGeometry方法的具体用法?Java MapGeometry.getGeometry怎么用?Java MapGeometry.getGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.esri.core.geometry.MapGeometry
的用法示例。
在下文中一共展示了MapGeometry.getGeometry方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: constructGeometry
import com.esri.core.geometry.MapGeometry; //导入方法依赖的package包/类
private com.esri.core.geometry.Geometry constructGeometry(com.esri.ges.spatial.Geometry geo) throws Exception
{
try{
String jsonIn = geo.toJson();
JsonFactory jf = new JsonFactory();
JsonParser jp = jf.createJsonParser(jsonIn);
MapGeometry mgeo = GeometryEngine.jsonToGeometry(jp);
com.esri.core.geometry.Geometry geoIn= mgeo.getGeometry();
return GeometryEngine.project(geoIn, srIn, srBuffer);
}
catch(Exception e)
{
LOG.error(e.getMessage());
LOG.error(e.getStackTrace());
throw(e);
}
}
示例2: hasGeometryMoved
import com.esri.core.geometry.MapGeometry; //导入方法依赖的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"));
}
}
示例3: process
import com.esri.core.geometry.MapGeometry; //导入方法依赖的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;
}
示例4: ConstructJsonMaskFromGeoEvent
import com.esri.core.geometry.MapGeometry; //导入方法依赖的package包/类
private String ConstructJsonMaskFromGeoEvent(GeoEvent ge) throws IOException
{
com.esri.ges.spatial.Geometry eventgeo = ge.getGeometry();
String json = eventgeo.toJson();
JsonFactory jf = new JsonFactory();
JsonParser jp = jf.createJsonParser(json);
MapGeometry mgeo = GeometryEngine.jsonToGeometry(jp);
Geometry geo = mgeo.getGeometry();
Geometry maskGeo = GeometryEngine.project(geo, srIn, srBuffer);
return GeometryEngine.geometryToJson(srBuffer, maskGeo);
}
示例5: constructGeometry
import com.esri.core.geometry.MapGeometry; //导入方法依赖的package包/类
private Geometry constructGeometry(MapGeometry geo) throws Exception
{
try{
Geometry geoIn= geo.getGeometry();
return GeometryEngine.project(geoIn, srIn, srBuffer);
}
catch(Exception e)
{
LOG.error(e.getMessage());
LOG.error(e.getStackTrace());
throw(e);
}
}
示例6: process
import com.esri.core.geometry.MapGeometry; //导入方法依赖的package包/类
@Override
public GeoEvent process(GeoEvent ge) throws Exception {
if(!ge.getGeoEventDefinition().getTagNames().contains("GEOMETRY"))
{
return null;
}
inwkid = ge.getGeometry().getSpatialReference().getID();
if(majAxisSource.equals("Event"))
{
majorAxisRadius = (Double)ge.getField(majorAxisField);
}
if(minAxisSource.equals("Event"))
{
minorAxisRadius = (Double)ge.getField(minorAxisField);
}
if(rotSource.equals("Event"))
{
rotation=(Double)ge.getField(rotationField);
}
MapGeometry mapGeo = ge.getGeometry();
Geometry geo = mapGeo.getGeometry();
if(!(geo instanceof Point))
{
return null;
}
Point eventGeo = (Point)geo;
double x = eventGeo.getX();
double y = eventGeo.getY();
double rdeg = GeometryUtility.Geo2Arithmetic(rotation);
double r = Math.toRadians(rdeg);
MapGeometry ellipse = constructEllipse(x, y, majorAxisRadius, minorAxisRadius, r, inwkid, procwkid, outwkid);
ge.setGeometry(ellipse);
return ge;
}
示例7: ConstructJsonMaskFromGeoEvent
import com.esri.core.geometry.MapGeometry; //导入方法依赖的package包/类
private String ConstructJsonMaskFromGeoEvent(GeoEvent ge) throws IOException
{
MapGeometry eventgeo = ge.getGeometry();
Geometry geo = eventgeo.getGeometry();
Geometry maskGeo = GeometryEngine.project(geo, srIn, srBuffer);
return GeometryEngine.geometryToJson(srBuffer, maskGeo);
}
示例8: process
import com.esri.core.geometry.MapGeometry; //导入方法依赖的package包/类
@Override
public GeoEvent process(GeoEvent ge) throws Exception {
MapGeometry mapGeo = ge.getGeometry();
Geometry geo = mapGeo.getGeometry();
if(geo.getType()!=Geometry.Type.Polygon)
return null;
Point center = GeometryUtility.CenterOfMass((Polygon)geo);
MapGeometry outMapGeo = new MapGeometry(center, mapGeo.getSpatialReference());
ge.setGeometry(outMapGeo);
return ge;
}
示例9: constructGeometry
import com.esri.core.geometry.MapGeometry; //导入方法依赖的package包/类
private Geometry constructGeometry(MapGeometry geo) throws Exception {
try {
Geometry geoIn = geo.getGeometry();
return GeometryEngine.project(geoIn, srIn, srBuffer);
} catch (Exception e) {
LOG.error(e.getMessage());
LOG.error(e.getStackTrace());
throw (e);
}
}
示例10: hasGeometryMoved
import com.esri.core.geometry.MapGeometry; //导入方法依赖的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"));
}
}
示例11: createPointFromGeoJson
import com.esri.core.geometry.MapGeometry; //导入方法依赖的package包/类
/**
* Converts a geojson string to com.esri.core.geometry.Point.
*
* @param jsonPoint geoJson string representation of a Point
* @return com.esri.core.geometry.Point
* @throws Exception
*/
static Point createPointFromGeoJson(String jsonPoint) throws Exception {
MapGeometry mapGeom = OperatorImportFromGeoJson.local().execute(GeoJsonImportFlags.geoJsonImportDefaults,
Geometry.Type.Point,
jsonPoint,
null);
return (Point) mapGeom.getGeometry();
}
示例12: process
import com.esri.core.geometry.MapGeometry; //导入方法依赖的package包/类
@Override
public GeoEvent process(GeoEvent evt) throws Exception {
MapGeometry mapGeo = (MapGeometry) evt.getField(geofld);
Geometry geo = mapGeo.getGeometry();
int wkid = mapGeo.getSpatialReference().getID();
if(wkid != 4326)
{
return null;
}
if(geo.getType() != Geometry.Type.Point)
{
return null;
}
Point pt = (Point)geo;
double[] coords = {pt.getX(), pt.getY()};
PeGeogcs pegeocs = PeFactory.geogcs(4326);
String[] mgrsvals = new String[1];
PeNotationMgrs.geog_to_mgrs(pegeocs, 1, coords, accuracy, false, mgrsvals);
String mgrs = mgrsvals[0];
//LL ll = new LL(pt.getX(), pt.getY());
//ll.setAccuracy(accuracy);
//MGRS2LatLongConverter converter = new MGRS2LatLongConverter();
//String mgrs = converter.LL2MRGS(ll);
GeoEventDefinition edOut;
GeoEventDefinition geoDef = evt.getGeoEventDefinition();
if((edOut=manager.searchGeoEventDefinition(newdef, getId()))==null)
{
edOut = geoDef.augment(fds);
edOut.setOwner(getId());
edOut.setName(newdef);
manager.addGeoEventDefinition(edOut);
}
GeoEventCreator geoEventCreator = messaging.createGeoEventCreator();
GeoEvent geOut = geoEventCreator.create(edOut.getGuid(), new Object[] {
evt.getAllFields(), mgrs });
geOut.setProperty(GeoEventPropertyName.TYPE, "message");
geOut.setProperty(GeoEventPropertyName.OWNER_ID, getId());
geOut.setProperty(GeoEventPropertyName.OWNER_ID, definition.getUri());
return geOut;
}
示例13: process
import com.esri.core.geometry.MapGeometry; //导入方法依赖的package包/类
@Override
public GeoEvent process(GeoEvent ge) throws Exception {
try {
if(!ge.getGeoEventDefinition().getTagNames().contains("GEOMETRY"))
{
return null;
}
srIn=ge.getGeometry().getSpatialReference();
inwkid = srIn.getID();
double range;
if (rangeSource.equals("Constant")) {
range = rangeConstant;
} else {
range = (Double) ge.getField(rangeEventFld);
}
double bearing;
if (bearingSource.equals("Constant")) {
bearing = bearingConstant;
} else {
bearing = (Double) ge.getField(bearingEventFld);
}
double traversal;
if (traversalSource.equals("Constant")) {
traversal = traversalConstant;
} else {
traversal = (Double) ge.getField(traversalEventFld);
}
Point originGeo = null;
if (geosrc.equals("event")) {
MapGeometry mapGeo = ge.getGeometry();
originGeo = (Point) mapGeo.getGeometry();
}
if (geosrc.equals("geodef")) {
originGeo = (Point) ge.getField(geometryEventFld);
}
if (geosrc.equals("coord")) {
Double ox = (Double) ge.getField(xfield);
Double oy = (Double) ge.getField(yfield);
originGeo = new Point(ox, oy, inwkid);
}
double x = originGeo.getX();
double y = originGeo.getY();
Geometry fan = constructRangeFan(x, y, range, rangeUnits, bearing,
traversal);
Geometry fanout = GeometryEngine.project(fan, srBuffer, srOut);
MapGeometry outMapGeo = new MapGeometry(fanout, srOut);
ge.setGeometry(outMapGeo);
return ge;
} catch (Exception e) {
LOG.error(e.getMessage());
throw e;
}
}
示例14: process
import com.esri.core.geometry.MapGeometry; //导入方法依赖的package包/类
@Override
public GeoEvent process(GeoEvent ge) throws Exception {
if (createDef) {
createGeoEventDefinition(ge);
createDef=false;
}
Date timeStart = (Date)ge.getField("TIME_START");
Date timeEnd = (Date)ge.getField("TIME_END");
if(timeStart== null)
return null;
if(timeEnd==null)
return null;
MapGeometry mapGeo = ge.getGeometry();
Geometry geo = mapGeo.getGeometry();
if(geo.getType()!=Geometry.Type.Polyline)
return null;
Polyline polyln = (Polyline)geo;
Geometry outGeo = null;
Date ts = null;
if(pointType.equals("start"))
{
ts = (Date)ge.getField("TIME_START");
outGeo = getStartPoint(polyln);
}
else if(pointType.equals("end"))
{
ts = (Date)ge.getField("TIME_END");
outGeo = getEndPoint(polyln);
}
else if(pointType.equals("mid"))
{
outGeo = getMiddlePoint(mapGeo);
long midTime = timeStart.getTime() + ((timeEnd.getTime() - timeStart.getTime())/2);
ts = new Date(midTime);
}
MapGeometry outMapGeo = new MapGeometry(outGeo, mapGeo.getSpatialReference());
GeoEvent msg = createLine2PtGeoevent(ge, outMapGeo, ts);
return msg;
}