本文整理汇总了Java中com.esri.core.geometry.MapGeometry类的典型用法代码示例。如果您正苦于以下问题:Java MapGeometry类的具体用法?Java MapGeometry怎么用?Java MapGeometry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MapGeometry类属于com.esri.core.geometry包,在下文中一共展示了MapGeometry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createLine2PtGeoevent
import com.esri.core.geometry.MapGeometry; //导入依赖的package包/类
private GeoEvent createLine2PtGeoevent(GeoEvent event, MapGeometry outGeo, Date ts) throws MessagingException, FieldException
{
GeoEventCreator creator = messaging.createGeoEventCreator();
GeoEvent msg = creator.create(outDef, definition.getUri().toString());
for(FieldDefinition fd: event.getGeoEventDefinition().getFieldDefinitions())
{
if(fd.getTags().contains("GEOMETRY"))
{
msg.setGeometry(outGeo);
}
else
{
msg.setField(fd.getName(), event.getField(fd.getName()));
}
msg.setField("TIMESTAMP", ts);
}
return msg;
}
示例3: constructEllipse
import com.esri.core.geometry.MapGeometry; //导入依赖的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;
}
示例4: 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"));
}
}
示例5: 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;
}
示例6: processGeometry
import com.esri.core.geometry.MapGeometry; //导入依赖的package包/类
protected Object processGeometry(GeoEvent geoevent, String geometryField) throws Exception
{
MapGeometry geomout = null;
try
{
MapGeometry geom = (MapGeometry) geoevent.getField(geometryField);
geomout = getAreaAroundPoint(geom);
}
catch (Exception e)
{
if (geoevent.getTrackId() == null)
throw new Exception(LOGGER.translate("SERVICE_AREA_UNABLE_ERROR1", e.getMessage()), e);
else
throw new Exception(LOGGER.translate("SERVICE_AREA_UNABLE_ERROR2", geoevent.getTrackId(), e.getMessage()), e);
}
return geomout;
}
示例7: getGeometriesFromNAReply
import com.esri.core.geometry.MapGeometry; //导入依赖的package包/类
private List<MapGeometry> getGeometriesFromNAReply(JsonNode jsonNode) throws Exception
{
if (jsonNode == null)
{
LOGGER.error("SERVICE_AREA_NO_ROUTES_IN_RESULT");
return null;
}
int wkid = getNodeFollowingPath(jsonNode, wkidPath).getIntValue();
String wkidStr = Integer.toString(wkid);
String geometryString;
List<MapGeometry> retList = new ArrayList<MapGeometry>();
MapGeometry mapGeometry;
for (JsonNode feature : getNodeFollowingPath(jsonNode, new Object[] { "features" }))
{
geometryString = geometryStringFromJsonNode(getNodeFollowingPath(feature, geometryPath), wkidStr);
mapGeometry = GeometryUtil.fromJson(geometryString);
retList.add(mapGeometry);
}
return retList;
}
示例8: 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);
}
示例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: constructGeometryFromString
import com.esri.core.geometry.MapGeometry; //导入依赖的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;
}
示例11: constructBuffer
import com.esri.core.geometry.MapGeometry; //导入依赖的package包/类
private MapGeometry constructBuffer(Geometry geo, double radius, Unit u) throws JsonParseException, IOException
{
Polygon buffer = GeometryEngine.buffer(inGeometry, srBuffer, radius, u);
Geometry bufferout = GeometryEngine.project(buffer, srBuffer, srOut);
MapGeometry mapGeo = new MapGeometry(bufferout, srOut);
return mapGeo;
//String json = GeometryEngine.geometryToJson(srOut, bufferout);
//return spatial.fromJson(json);
}
示例12: 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;
}
示例13: GenerateGeometry
import com.esri.core.geometry.MapGeometry; //导入依赖的package包/类
private MapGeometry GenerateGeometry(Double ox, Double oy, Double dx, Double dy, SpatialReference sr)
{
Point origin = new Point();
Point destination = new Point();
origin.setXY(ox, oy);
destination.setXY(dx, dy);
Polyline ln = new Polyline();
ln.startPath(origin);
ln.lineTo(destination);
MapGeometry mapGeo = new MapGeometry(ln, sr);
return mapGeo;
}
示例14: 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);
}
示例15: 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;
}