本文整理汇总了Java中com.esri.ges.core.geoevent.GeoEvent.setGeometry方法的典型用法代码示例。如果您正苦于以下问题:Java GeoEvent.setGeometry方法的具体用法?Java GeoEvent.setGeometry怎么用?Java GeoEvent.setGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.esri.ges.core.geoevent.GeoEvent
的用法示例。
在下文中一共展示了GeoEvent.setGeometry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLine2PtGeoevent
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的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;
}
示例2: process
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的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;
}
示例3: createGeoEvent
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
@Override
public GeoEvent createGeoEvent(Route route, String ownerId, Uri uri)
{
try
{
GeoEvent geoEvent = geoEventCreator.create( routeGEDName, routeGEDOwner );
geoEvent.setGeometry( route.getShape() );
geoEvent.setField( RouteResource.ROUTE_NAME_KEY, route.getRouteName() );
geoEvent.setField( RouteResource.VEHICLE_NAME_KEY, route.getVehicleName() );
geoEvent.setField( RouteResource.DRIVER_NAME_KEY, route.getDriverName() );
geoEvent.setField( RouteResource.PASSENGER_NAME_KEY, route.getPassengerName() );
geoEvent.setField( RouteResource.LAST_UPDATED_KEY, route.getLastUpdated() );
geoEvent.setField( RouteResource.ROUTE_START_KEY, route.getRouteStart() );
geoEvent.setField( RouteResource.ROUTE_END_KEY, route.getRouteEnd() );
geoEvent.setField( RouteResource.DISPATCH_ACK_KEY, route.getDispatchAck() );
geoEvent.setField( RouteResource.SHAPE_KEY, route.getShape() );
geoEvent.setProperty(GeoEventPropertyName.TYPE, "event");
geoEvent.setProperty(GeoEventPropertyName.OWNER_ID, ownerId);
geoEvent.setProperty(GeoEventPropertyName.OWNER_URI, uri);
return geoEvent;
}
catch( Exception e )
{
throw new RuntimeException( e );
}
}
示例4: createGeoEventForAoi
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
private GeoEvent createGeoEventForAoi( Aoi aoi)
{
try
{
GeoEvent geoEvent = geoEventCreator.create( geofenceGEDName, geofenceGEDOwner );
// All of our Aoi's only have one geometry.
Geometry geom = aoi.getGeometries().get( 0 );
geoEvent.setGeometry( geom );
geoEvent.setField( GeoFenceResource.GEOFENCE_ID_KEY, aoi.getId() );
geoEvent.setField( GeoFenceResource.CATEGORY_KEY, aoi.getCategory() );
geoEvent.setField( GeoFenceResource.GEOFENCE_NAME_KEY, aoi.getName() );
geoEvent.setField( GeoFenceResource.ACTIVE_KEY, Boolean.toString( aoi.isActive() ) );
geoEvent.setField( GeoFenceResource.SHAPE_KEY, geom.toJson() );
return geoEvent;
}
catch( Exception e )
{
throw new RuntimeException( e );
}
}
示例5: process
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
@Override
public GeoEvent process(GeoEvent evt){
try {
int inwkid = (Integer) properties.get("wkidin").getValue();
int outwkid = (Integer) properties.get("wkidout").getValue();
//int bufferwkid = (Integer) properties.get("wkidbuffer").getValue();
srIn = SpatialReference.create(inwkid);
//srBuffer = SpatialReference.create(bufferwkid);
srOut = SpatialReference.create(outwkid);
String eventfld = properties.get("polyfld").getValue().toString();
String[] arr = eventfld.split(":");
String geostring = (String) evt.getField(arr[1]);
String format = properties.get("polyformat").getValue().toString();
com.esri.ges.spatial.Geometry geo = null;
if (format.equals("Json")) {
geo = constructJsonGeometry(geostring);
} else if (format.equals("CAP")) {
geo = constructCAPGeometry(geostring);
}
evt.setGeometry(geo);
return evt;
} catch (Exception ex) {
LOG.error(ex.getMessage());
LOG.error(ex.getStackTrace());
return null;
}
}
示例6: process
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
@Override
public GeoEvent process(GeoEvent ge) throws Exception {
String radiusSource = properties.get("radiusSource").getValue().toString();
double radius;
if(radiusSource.equals("Constant"))
{
radius = (Double)properties.get("radius").getValue();
}
else
{
String eventfld = properties.get("radiusEvent").getValue().toString();
String[] arr = eventfld.split(":");
radius = (Double)ge.getField(arr[1]);
}
String units = properties.get("units").getValue().toString();
int inwkid = (Integer) properties.get("wkidin").getValue();
int outwkid = (Integer) properties.get("wkidout").getValue();
int bufferwkid = (Integer) properties.get("wkidbuffer").getValue();
com.esri.ges.spatial.Point eventGeo = (com.esri.ges.spatial.Point) ge.getGeometry();
double x = eventGeo.getX();
double y = eventGeo.getY();
com.esri.ges.spatial.Geometry buffer = constructBuffer(x,y,radius,units,inwkid,bufferwkid,outwkid);
ge.setGeometry(buffer);
return ge;
}
示例7: process
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的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;
}
示例8: process
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的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: createVertexGeoevent
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
private GeoEvent createVertexGeoevent(GeoEvent event, MapGeometry outGeo, double dist, long time, double timeFromStartMinutes, Integer increment) throws MessagingException, FieldException
{
Date ts = new Date(time);
Double distOnLine = dist;
GeoEvent msg = geoEventCreator.create(outDef, definition.getUri().toString());
for(FieldDefinition fd: event.getGeoEventDefinition().getFieldDefinitions())
{
if(fd.getTags().contains("GEOMETRY"))
{
msg.setGeometry(outGeo);
}
else if(fd.getTags().contains("TRACK_ID"))
{
String trackid = event.getTrackId() + "_" + increment.toString();
msg.setField("TRACK_ID", trackid);
}
else
{
msg.setField(fd.getName(), event.getField(fd.getName()));
}
}
msg.setField("TIMESTAMP", ts);
msg.setField("TIME_FROM_START", timeFromStartMinutes);
msg.setField("DISTANCE_ON_LINE", distOnLine);
msg.setProperty(GeoEventPropertyName.TYPE, "event");
msg.setProperty(GeoEventPropertyName.OWNER_ID, getId());
msg.setProperty(GeoEventPropertyName.OWNER_URI,
definition.getUri());
return msg;
}
示例10: createIncrementalPointGeoevent
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
private GeoEvent createIncrementalPointGeoevent(GeoEvent event, MapGeometry outGeo, Date timestart, Integer increment) throws MessagingException, FieldException
{
long multiplier = increment+1;
long timeFromStart = timeInterval*multiplier;
long incrementTime = timestart.getTime() + (timeFromStart);
double timeFromStartMinutes = timeFromStart/60000.0;
Double distOnLine = distInterval*multiplier;
Date ts = new Date(incrementTime);
GeoEvent msg = geoEventCreator.create(outDef, definition.getUri().toString());
for(FieldDefinition fd: event.getGeoEventDefinition().getFieldDefinitions())
{
if(fd.getTags().contains("GEOMETRY"))
{
msg.setGeometry(outGeo);
}
else if(fd.getTags().contains("TRACK_ID"))
{
String trackid = event.getTrackId() + "_" + increment.toString();
msg.setField("TRACK_ID", trackid);
}
else
{
msg.setField(fd.getName(), event.getField(fd.getName()));
}
}
msg.setField("TIMESTAMP", ts);
msg.setField("TIME_FROM_START", timeFromStartMinutes);
msg.setField("DISTANCE_ON_LINE", distOnLine);
msg.setProperty(GeoEventPropertyName.TYPE, "event");
msg.setProperty(GeoEventPropertyName.OWNER_ID, getId());
msg.setProperty(GeoEventPropertyName.OWNER_URI,
definition.getUri());
return msg;
}
示例11: createMotionGeoEvent
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
private GeoEvent createMotionGeoEvent()
{
GeoEventDefinition edOut;
GeoEvent geoEventOut = null;
try
{
edOut = lookupAndCreateEnrichedDefinition(this.currentGeoEvent.getGeoEventDefinition());
if (edOut == null)
{
LOGGER.debug("edOut is null");
return null;
}
geoEventOut = geoEventCreator.create(edOut.getGuid(), new Object[] { getCurrentGeoEvent().getAllFields(), createMotionGeoEventFields(currentGeoEvent.getTrackId(), this) });
if (geometryType.equals("Line"))
{
geoEventOut.setGeometry(new MapGeometry(this.lineGeometry, SpatialReference.create(4326)));
}
// need to use "event" instead of "message" otherwise the resulting GeoEvent will come back in the process() method
geoEventOut.setProperty(GeoEventPropertyName.TYPE, "event");
geoEventOut.setProperty(GeoEventPropertyName.OWNER_ID, getId());
geoEventOut.setProperty(GeoEventPropertyName.OWNER_URI, definition.getUri());
for (Map.Entry<GeoEventPropertyName, Object> property : getCurrentGeoEvent().getProperties())
{
if (!geoEventOut.hasProperty(property.getKey()))
{
geoEventOut.setProperty(property.getKey(), property.getValue());
}
}
}
catch (Exception error)
{
LOGGER.error("CREATE_GEOEVENT_FAILED", error.getMessage());
LOGGER.info(error.getMessage(), error);
}
return geoEventOut;
}
示例12: createGeoEvent
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
@Override
public GeoEvent createGeoEvent(Vehicle vehicle, String ownerId, Uri uri)
{
if( geoEventCreator == null )
{
geoEventCreator = messaging.createGeoEventCreator();
if( geoEventCreator == null )
{
throw new RuntimeException( "Could not instantiate a GeoEventCreator." );
}
}
GeoEvent event;
try
{
event = geoEventCreator.create( vehicleGEDName, vehicleGEDOwner );
event.setField( VehicleResource.LAST_UPDATED_KEY, vehicle.getLastUpdated() );
event.setField( VehicleResource.DEVICE_ID_KEY, vehicle.getDeviceId() );
event.setField( VehicleResource.DEVICE_TYPE_KEY, vehicle.getDeviceType() );
event.setField( VehicleResource.VEHICLE_NAME_KEY, vehicle.getVehicleName() );
event.setField( VehicleResource.VEHICLE_GROUP_NAME_KEY, vehicle.getVehicleGroupName() );
event.setField( VehicleResource.CAPACITY_KEY, vehicle.getCapacity() );
event.setField( VehicleResource.SPECIALTIES_KEY, vehicle.getSpecialties() );
event.setField( VehicleResource.FIXED_COST_KEY, vehicle.getFixedCost() );
event.setField( VehicleResource.FUEL_ECONOMY_KEY, vehicle.getFuelEconomy() );
event.setField( VehicleResource.FUEL_TYPE_KEY, vehicle.getFuelType() );
event.setField( VehicleResource.SPEED_KEY, vehicle.getSpeed() );
event.setField( VehicleResource.PANIC_KEY, vehicle.getPanic() );
event.setField( VehicleResource.NOTE_KEY, vehicle.getNote() );
event.setField( "shape", vehicle.getLocation().toJson() );
event.setGeometry( vehicle.getLocation() );
event.setProperty(GeoEventPropertyName.TYPE, "event");
event.setProperty(GeoEventPropertyName.OWNER_ID, ownerId);
event.setProperty(GeoEventPropertyName.OWNER_URI, uri);
}
catch( Exception e )
{
throw new RuntimeException( e );
}
return event;
}
示例13: createGeoEvent
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
@Override
public GeoEvent createGeoEvent(Stop stop, String ownerId, Uri uri)
{
try
{
GeoEvent geoEvent = geoEventCreator.create(stopGEDName, stopGEDOwner);
Set<String> predefinedTags = stop.getPredefinedKeys();
for (FieldDefinition fd : geoEvent.getGeoEventDefinition().getFieldDefinitions())
{
String name = fd.getName();
String value = stop.getAttribute(getResourceName(fd, predefinedTags));
if (value == null)
{
geoEvent.setField(name, null);
}
else
{
switch (fd.getType())
{
case Boolean:
geoEvent.setField(name, value.equals("true")?true:false );
break;
case Date:
geoEvent.setField(name, new Date( Long.parseLong( value ) ) );
break;
case Double:
Double doubleValue = null;
if( !Validator.isEmpty( value ) )
{
doubleValue = Double.parseDouble( value );
}
geoEvent.setField(name, doubleValue);
break;
case Float:
Float floatValue = null;
if( !Validator.isEmpty( value ) )
{
floatValue = Float.parseFloat( value );
}
geoEvent.setField(name, floatValue);
break;
case Integer:
Integer intValue = null;
if( !Validator.isEmpty( value ) )
{
intValue = Integer.parseInt( value );
}
geoEvent.setField(name, intValue);
break;
case Long:
Long longValue = null;
if( !Validator.isEmpty( value ) )
{
longValue = Long.parseLong( value );
}
geoEvent.setField(name, longValue);
break;
case Geometry:
geoEvent.setGeometry(stop.getLocation());
break;
default:
geoEvent.setField(name, value);
break;
}
}
}
geoEvent.setProperty(GeoEventPropertyName.TYPE, "event");
geoEvent.setProperty(GeoEventPropertyName.OWNER_ID, ownerId);
geoEvent.setProperty(GeoEventPropertyName.OWNER_URI, uri);
return geoEvent;
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
示例14: createGeoEvent2
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
public GeoEvent createGeoEvent2(Stop stop, String ownerId, Uri uri)
{
try
{
GeoEvent geoEvent = geoEventCreator.create(stopGEDName, stopGEDOwner);
geoEvent.setGeometry( stop.getLocation() );
geoEvent.setField(StopResource.LAST_UPDATED_KEY, stop.getLastUpdated());
geoEvent.setField(StopResource.SHAPE_KEY, stop.getLocation().toJson());
geoEvent.setField(StopResource.STOP_NAME_KEY, stop.getName());
geoEvent.setField(StopResource.ROUTE_NAME_KEY, stop.getRouteName());
geoEvent.setField(StopResource.SEQUENCE_NUMBER_KEY, stop.getSequenceNumber());
geoEvent.setField(StopResource.STATUS_KEY, stop.getStatus().toString() );
geoEvent.setField(StopResource.TYPE_KEY, stop.getType());
geoEvent.setField(StopResource.DESCRIPTION_KEY, stop.getDescription());
geoEvent.setField(StopResource.PICKUP_CAPACITY_KEY, stop.getPickupCapacity());
geoEvent.setField(StopResource.DELIVERY_CAPACITY_KEY, stop.getDeliveryCapacity());
geoEvent.setField(StopResource.ADDRESS_KEY, stop.getAddress());
geoEvent.setField(StopResource.CURB_APPROACH_KEY, stop.getCurbApproach());
geoEvent.setField(StopResource.CUSTOM_STOP_PROPERTIES_KEY, stop.getCustomProperties());
geoEvent.setField(StopResource.TIME_WINDOW_START_1_KEY, stop.getTimeWindowStart1());
geoEvent.setField(StopResource.TIME_WINDOW_END_1_KEY, stop.getTimeWindowEnd1());
geoEvent.setField(StopResource.TIME_WINDOW_START_2_KEY, stop.getTimeWindowStart2());
geoEvent.setField(StopResource.TIME_WINDOW_END_2_KEY, stop.getTimeWindowEnd2());
geoEvent.setField(StopResource.MAX_VIOLATION_KEY, stop.getMaxViolationTime());
geoEvent.setField(StopResource.SCHEDULED_ARRIVAL_KEY, stop.getScheduledArrival());
geoEvent.setField(StopResource.PROJECTED_ARRIVAL_KEY, stop.getProjectedArrival());
geoEvent.setField(StopResource.ACTUAL_ARRIVAL_KEY, stop.getActualArrival());
geoEvent.setField(StopResource.SCHEDULED_SERVICE_DURATION_KEY, stop.getScheduledServiceDuration());
geoEvent.setField(StopResource.ACTUAL_SERVICE_DURATION_KEY, stop.getActualServiceDuration());
geoEvent.setField(StopResource.SCHEDULED_DEPARTURE_KEY, stop.getScheduledDeparture());
geoEvent.setField(StopResource.PROJECTED_DEPARTURE_KEY, stop.getProjectedDeparture());
geoEvent.setField(StopResource.ACTUAL_DEPARTURE_KEY, stop.getActualDeparture());
geoEvent.setField(StopResource.NOTE_KEY, stop.getNote());
geoEvent.setProperty(GeoEventPropertyName.TYPE, "event");
geoEvent.setProperty(GeoEventPropertyName.OWNER_ID, ownerId);
geoEvent.setProperty(GeoEventPropertyName.OWNER_URI, uri);
return geoEvent;
}
catch( Exception e )
{
throw new RuntimeException( e );
}
}
示例15: process
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的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;
}
}