本文整理匯總了Java中com.esri.ges.core.geoevent.GeoEvent.getField方法的典型用法代碼示例。如果您正苦於以下問題:Java GeoEvent.getField方法的具體用法?Java GeoEvent.getField怎麽用?Java GeoEvent.getField使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.esri.ges.core.geoevent.GeoEvent的用法示例。
在下文中一共展示了GeoEvent.getField方法的24個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。
示例1: process
點讚 3
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;
}
開發者ID:Esri,項目名稱:defense-solutions-proofs-of-concept,代碼行數:25,
示例2: processGeometry
點讚 3
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的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;
}
開發者ID:Esri,項目名稱:service-area-calculator-for-geoevent,代碼行數:19,
示例3: createVehicleFromGeoEvent
點讚 3
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的package包/類
private Vehicle createVehicleFromGeoEvent(GeoEvent geoEvent)
{
DefaultVehicle vehicle = new DefaultVehicle();
vehicle.setCumulativeMinutes((Double) geoEvent.getField(VehicleResource.CUMULATIVE_MINUTES_KEY));
vehicle.setDeviceId((String) geoEvent.getField(VehicleResource.DEVICE_ID_KEY));
vehicle.setDeviceType((String) geoEvent.getField(VehicleResource.DEVICE_TYPE_KEY));
vehicle.setEventName((String) geoEvent.getField(VehicleResource.EVENT_NAME_KEY));
vehicle.setLastUpdated((Date) geoEvent.getField(VehicleResource.LAST_UPDATED_KEY));
Object vehicleLocationObject = geoEvent.getField(VehicleResource.GEOMETRY_KEY);
if (vehicleLocationObject != null)
{
Geometry vehicleLocation = geometryFromAttribute(vehicleLocationObject);
if (vehicleLocation != null && vehicleLocation instanceof Point)
{
vehicle.setLocation((Point) vehicleLocation);
}
}
vehicle.setNextStopSequenceNumber((Integer) geoEvent.getField(VehicleResource.NEXT_STOP_SEQUENCE_NUMBER_KEY));
vehicle.setPanic((String) geoEvent.getField(VehicleResource.PANIC_KEY));
vehicle.setSpeed((Double) geoEvent.getField(VehicleResource.SPEED_KEY));
vehicle.setVehicleGroupName((String) geoEvent.getField(VehicleResource.VEHICLE_GROUP_NAME_KEY));
vehicle.setVehicleName((String) geoEvent.getField(VehicleResource.VEHICLE_NAME_KEY));
return vehicle;
}
開發者ID:Esri,項目名稱:route-monitor-for-geoevent,代碼行數:25,
示例4: updateETAForOneStop
點讚 3
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的package包/類
private void updateETAForOneStop(GeoEvent geoEvent) throws Exception
{
if (geoEventCreator == null && (geoEventCreator = messaging.createGeoEventCreator()) == null)
return;
String trackId = (String) geoEvent.getField("TRACK_ID");
Stop stop = getNextStop(trackId);
if (stop == null)
{
LOG.error( "Couldn't update ETA for track "+trackId+" because the next stop was not found." );
return;
}
calculateETAForNextStop(stop, geoEvent);
if(stop != null)
send(stopsManager.createGeoEvent(stop, getId(), definition.getUri()));
}
開發者ID:Esri,項目名稱:route-monitor-for-geoevent,代碼行數:17,
示例5: process
點讚 2
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;
}
}
開發者ID:Esri,項目名稱:defense-solutions-proofs-of-concept,代碼行數:30,
示例6: process
點讚 2
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;
}
開發者ID:Esri,項目名稱:defense-solutions-proofs-of-concept,代碼行數:28,
示例7: process
點讚 2
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;
}
開發者ID:Esri,項目名稱:defense-solutions-proofs-of-concept,代碼行數:37,
示例8: process
點讚 2
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的package包/類
@Override
public GeoEvent process(GeoEvent ge) throws Exception {
LOG.info("VisibilityProcessor.process starts.................");
double radius;
if(!ge.getGeoEventDefinition().getTagNames().contains("GEOMETRY"))
{
return null;
}
srIn=ge.getGeometry().getSpatialReference();
if(isRadiusConstant)
{
radius = radiusConstant;
}
else
{
radius = (Double)ge.getField(radiusEventfld);
}
double elevation;
if(isElevConstant){
elevation =elevConstant;
}
else
{
elevation = (Double)ge.getField(elevEventfld);
}
LOG.info("Calling ConstructVisibilityRest.................");
GeoEvent outGeo = ConstructVisibilityRest(ge, gp, is, radius, radiusUnit, elevation, units_elev, procwkid);
LOG.info("VisibilityProcessor.process ends.................");
return outGeo;
}
開發者ID:Esri,項目名稱:defense-solutions-proofs-of-concept,代碼行數:40,
示例9: process
點讚 2
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的package包/類
public GeoEvent process(GeoEvent evt) throws Exception {
GeoEventDefinition ged = evt.getGeoEventDefinition();
FieldDefinition fd = ged.getFieldDefinition(aggregateFld);
if (fd == null)
return null;
FieldType type = fd.getType();
if (!typelist.contains(type)) {
return null;
}
Double val = null;
if (type == FieldType.Double) {
val = (Double) evt.getField(aggregateFld);
} else if (type == FieldType.Integer) {
val = ((Integer) evt.getField(aggregateFld)) * 1.0;
} else if (type == FieldType.Long) {
val = ((Long) evt.getField(aggregateFld)) * 1.0;
} else if (type == FieldType.Short) {
val = ((Short) evt.getField(aggregateFld)) * 1.0;
} else if (type == FieldType.Float) {
val = ((Float) evt.getField(aggregateFld)) * 1.0;
}
if(val == null)
{
return null;
}
timestamp = System.currentTimeMillis();
cache.put(timestamp, val);
return null;
}
開發者ID:Esri,項目名稱:defense-solutions-proofs-of-concept,代碼行數:33,
示例10: convertGeoEventToStop
點讚 2
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的package包/類
public void convertGeoEventToStop( GeoEvent message, Stop stop )
{
Set predefinedTags = stop.getPredefinedKeys();
for (FieldDefinition fd :message.getGeoEventDefinition().getFieldDefinitions())
{
String name = fd.getName();
Object value = message.getField(name);
String resrouceName = getResourceName(fd, predefinedTags);
if(value == null)
{
continue;
}
String valueToInsert;
switch(fd.getType())
{
case Boolean:
case Double:
case Integer:
case Long:
case Short:
case String:
case Geometry:
valueToInsert = value.toString();
break;
case Date:
valueToInsert = Long.toString( ((Date)value).getTime() );
break;
default:
valueToInsert = null;
break;
}
stop.setAttribute( resrouceName, valueToInsert );
}
}
開發者ID:Esri,項目名稱:route-monitor-for-geoevent,代碼行數:37,
示例11: createVehicleFromGeoEvent
點讚 2
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的package包/類
public Vehicle createVehicleFromGeoEvent(GeoEvent geoEvent)
{
DefaultVehicle vehicle = new DefaultVehicle();
vehicle.setCumulativeMinutes((Double) geoEvent.getField(VehicleResource.CUMULATIVE_MINUTES_KEY));
vehicle.setDeviceId((String) geoEvent.getField(VehicleResource.DEVICE_ID_KEY));
vehicle.setDeviceType((String) geoEvent.getField(VehicleResource.DEVICE_TYPE_KEY));
vehicle.setEventName((String) geoEvent.getField(VehicleResource.EVENT_NAME_KEY));
vehicle.setLastUpdated((Date) geoEvent.getField(VehicleResource.LAST_UPDATED_KEY));
Object vehicleLocationObject = geoEvent.getField(VehicleResource.GEOMETRY_KEY);
if (vehicleLocationObject != null)
{
Geometry vehicleLocation = geometryFromAttribute(vehicleLocationObject);
if (vehicleLocation != null && vehicleLocation instanceof Point)
{
vehicle.setLocation((Point) vehicleLocation);
}
}
vehicle.setNextStopSequenceNumber((Integer) geoEvent.getField(VehicleResource.NEXT_STOP_SEQUENCE_NUMBER_KEY));
vehicle.setPanic((String) geoEvent.getField(VehicleResource.PANIC_KEY));
vehicle.setSpeed((Double) geoEvent.getField(VehicleResource.SPEED_KEY));
vehicle.setVehicleGroupName((String) geoEvent.getField(VehicleResource.VEHICLE_GROUP_NAME_KEY));
vehicle.setVehicleName((String) geoEvent.getField(VehicleResource.VEHICLE_NAME_KEY));
vehicle.setFixedCost((Double) geoEvent.getField(VehicleResource.FIXED_COST_KEY));
vehicle.setFuelEconomy((Double) geoEvent.getField(VehicleResource.FUEL_ECONOMY_KEY));
vehicle.setFuelType((String) geoEvent.getField(VehicleResource.FUEL_TYPE_KEY));
vehicle.setCapacity((String) geoEvent.getField(VehicleResource.CAPACITY_KEY));
vehicle.setSpecialties((String) geoEvent.getField(VehicleResource.SPECIALTIES_KEY));
return vehicle;
}
開發者ID:Esri,項目名稱:route-monitor-for-geoevent,代碼行數:30,
示例12: getPointFromField
點讚 2
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的package包/類
private Point getPointFromField( GeoEvent geoEvent, String fieldName )
{
Object routePointObject = geoEvent.getField( fieldName );
if( routePointObject != null )
{
Geometry routeEndPoint = geometryFromAttribute( routePointObject );
if( routeEndPoint != null && routeEndPoint instanceof Point )
{
return (Point)routeEndPoint;
}
}
return null;
}
開發者ID:Esri,項目名稱:route-monitor-for-geoevent,代碼行數:14,
示例13: resequence
點讚 2
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的package包/類
@Override
public GeoEvent resequence(GeoEvent geoEvent, String naConnection, String routeSolverPath)
{
Collection routes;
Plan plan = null;
boolean commit = false;
try
{
routes = convertGeoEventToCalculateParameters(geoEvent);
//commit = (Boolean)geoEvent.getField("commit");
// TODO: workaround. json adapter writes Boolean as string. As a result, the input which uses the same GED could not read Boolean fields.
// If commit is null, set it to true.
commit = true;
if(geoEvent.getField("commit") != null)
commit = (Boolean)geoEvent.getField("commit");
plan = calculate(routes, naConnection, routeSolverPath, commit);
}
catch (Exception e)
{
log.error(e);
return createPlanGeoEvent(null, false, PlanStatus.Failed, e.getMessage());
}
return createPlanGeoEvent(plan, commit, PlanStatus.Successful, "");
}
開發者ID:Esri,項目名稱:route-monitor-for-geoevent,代碼行數:28,
示例14: processGeoEvent
點讚 2
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的package包/類
protected GeoEvent processGeoEvent(GeoEvent geoEvent)
{
String stopName = (String)geoEvent.getField( StopResource.STOP_NAME_KEY );
Point point = getLocation(geoEvent);
if(point == null)
return null;
Aoi aoi = aoiManager.getAoi(stopsManager.getStopsAoiCategory(), stopName);
if(aoi != null)
{
Stop oldStop = stopsManager.getStopByName(stopName);
if(oldStop != null)
{
String newStatus = (String)geoEvent.getField(StopResource.STATUS_KEY);
if(newStatus != null)
if(newStatus.equals(StopStatus.AtStop.toString()) || newStatus.equals(StopStatus.Completed.toString())
|| newStatus.equals(StopStatus.Exception.toString()))
return null;
if((oldStop.getLocation().getX()==point.getX() && oldStop.getLocation().getY()==point.getY()))
return null;
stopsManager.convertGeoEventToStop(geoEvent, oldStop);
if(oldStop.getStatus()==StopStatus.Canceled)
return null;
}
else
{
Stop stop = stopsManager.createStop(stopName);
stopsManager.convertGeoEventToStop(geoEvent, stop);
if(stop.getStatus()==StopStatus.Canceled)
return null;
}
aoiManager.deleteAoi(stopsManager.getStopsAoiCategory(), stopName);
}
if(serviceAreaType.equals(ServiceAreaCalculatorDefinition.SERVICE_AREA_TYPE_BUFFER))
return createBufferForStop(bufferDistance, stopName, point);
else
return createAoiForStop(naConnectionName, path, driveTime, stopName, point);
}
開發者ID:Esri,項目名稱:route-monitor-for-geoevent,代碼行數:40,
示例15: updateETAForAllStops
點讚 2
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的package包/類
private void updateETAForAllStops(GeoEvent geoEvent) throws Exception
{
if (geoEventCreator == null && (geoEventCreator = messaging.createGeoEventCreator()) == null)
return;
String trackId = (String) geoEvent.getField("TRACK_ID");
List stops = getNextStops(trackId);
Stop stop = stops.get(0);
if (stop == null)
{
LOG.error( "Couldn't update ETA for track "+trackId+" because the next stop was not found." );
return;
}
calculateETAForNextStop(stop, geoEvent);
if(stop != null)
{
long diff = DateUtil.millisecondsBetween(stop.getProjectedArrival(), stop.getScheduledArrival());
for(int i=1; i
{
if(stops.get(i) != null)
{
if(stops.get(i).getScheduledArrival() != null)
stops.get(i).setProjectedArrival(new Date(stops.get(i).getScheduledArrival().getTime() + diff));
if(stops.get(i).getScheduledDeparture() != null)
stops.get(i).setProjectedDeparture(new Date(stops.get(i).getScheduledDeparture().getTime() + diff));
send(stopsManager.createGeoEvent(stops.get(i), getId(), definition.getUri()));
}
}
}
}
開發者ID:Esri,項目名稱:route-monitor-for-geoevent,代碼行數:34,
示例16: process
點讚 2
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的package包/類
@Override
public GeoEvent process(GeoEvent geoEvent) throws Exception
{
GeoEvent newGeoEvent = null;
if(geoEvent.getField(REQUEST_ID_FIELD) == null )
{
log.error("Request ID is not available in the GeoEvent.");
return null;
}
String requestId = (String)geoEvent.getField(REQUEST_ID_FIELD);
if(!geoEvent.getGeoEventDefinition().getName().equals(planManager.getPlanCommandGeoEventDefinition().getName()))
return null;
if(geoEvent.getField(planManager.getPlanCommandActionField()).equals(planManager.getPlanCommandActionClear()))
newGeoEvent = planManager.clearPlan(geoEvent, agsConnectionName, path, featureService, stopLayer, routeLayer, vehicleLayer, geofenceLayer, alertLayer);
else if(geoEvent.getField(planManager.getPlanCommandActionField()).equals(planManager.getPlanCommandActionGet()))
newGeoEvent = planManager.getPlan();
else if(geoEvent.getField(planManager.getPlanCommandActionField()).equals(planManager.getPlanCommandActionReload()))
newGeoEvent = planManager.reloadPlan(agsConnectionName, path, featureService, stopLayer, routeLayer, vehicleLayer, alertLayer);
else if(geoEvent.getField(planManager.getPlanCommandActionField()).equals(planManager.getPlanCommandActionLoad()))
{
//planManager.clearPlan(geoEvent, agsConnectionName, path, featureService, stopLayer, routeLayer, vehicleLayer, geofenceLayer, alertLayer);
newGeoEvent = planManager.loadPlan(geoEvent);
}
if(newGeoEvent.getGeoEventDefinition().getFieldDefinition(REQUEST_ID_FIELD) != null)
newGeoEvent.setField(REQUEST_ID_FIELD, requestId);
return newGeoEvent;
}
開發者ID:Esri,項目名稱:route-monitor-for-geoevent,代碼行數:31,
示例17: process
點讚 2
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的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;
}
開發者ID:Esri,項目名稱:defense-solutions-proofs-of-concept,代碼行數:42,
示例18: process
點讚 2
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的package包/類
@Override
public GeoEvent process(GeoEvent geoEvent) throws Exception {
GeoEvent msg = null;
if (createDef) {
createGeoEventDefinition(geoEvent, keepFields);
createDef=false;
}
if (geoEvent.getTrackId() == null || geoEvent.getGeometry() == null) {
LOGGER.warn("NULL_ERROR");
return null;
}
if (trackIdles == null) {
LOGGER.warn("TRACK_IDLES_NULL");
return null;
}
try {
String cacheKey = buildCacheKey(geoEvent);
TrackIdleProcessorStart idleStart = trackIdles.get(cacheKey);
Date startTime = (Date)geoEvent.getField("TIME_START");
long currentStartTime = startTime.getTime();
if (idleStart != null && idleStart.getGeometry() != null) {
if (!hasGeometryMoved(geoEvent.getGeometry(),
idleStart.getGeometry(), tolerance)) {
double idleDuration = (currentStartTime - idleStart
.getStartTime().getTime()) / 1000.0;
idleDuration = idleDuration >= 0 ? idleDuration
: -idleDuration;
idleDuration = Math.round(idleDuration * 10.0) / 10.0;
if (idleDuration >= idleLimit) {
idleStart.setIdleDuration(idleDuration);
if (notificationMode == TrackIdleProcessorNotificationMode.Continuous)
msg = createTrackIdleGeoEvent(idleStart, true,
geoEvent, ged);
else if (!idleStart.isIdling())
msg = createTrackIdleGeoEvent(idleStart, true,
geoEvent, ged);
idleStart.setIdling(true);
}
}
else
{
if (idleStart.isIdling())
{
msg = createTrackIdleGeoEvent(idleStart, false, geoEvent, ged);
}
idleStart.setGeometry(geoEvent.getGeometry());
idleStart.setStartTime(geoEvent.getStartTime());
idleStart.setIdling(false);
}
} else {
trackIdles.put(
cacheKey,
new TrackIdleProcessorStart(geoEvent.getTrackId(), startTime, geoEvent.getGeometry()));
}
} catch (Exception error) {
LOGGER.error(error.getMessage(), error);
}
return msg;
}
開發者ID:Esri,項目名稱:defense-solutions-proofs-of-concept,代碼行數:65,
示例19: processGeoEvent
點讚 2
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的package包/類
private GeoEvent processGeoEvent(GeoEvent geoEvent)
throws GeoEventDefinitionManagerException {
GeoEvent geoevent = null;
if (createDef) {
createGeoEventDefinition(geoEvent, keepFields);
createDef=false;
}
if (geoEvent.getTrackId() == null || geoEvent.getGeometry() == null) {
LOGGER.warn("NULL_ERROR");
return null;
}
if (trackIdles == null) {
LOGGER.warn("TRACK_IDLES_NULL");
return null;
}
try {
String cacheKey = buildCacheKey(geoEvent);
TrackIdleProcessorStart idleStart = trackIdles.get(cacheKey);
Date startTime = (Date)geoEvent.getField("TIME_START");
long currentStartTime = startTime.getTime();
if (idleStart != null && idleStart.getGeometry() != null) {
if (!hasGeometryMoved(geoEvent.getGeometry(),
idleStart.getGeometry(), tolerance)) {
double idleDuration = (currentStartTime - idleStart
.getStartTime().getTime()) / 1000.0;
idleDuration = idleDuration >= 0 ? idleDuration
: -idleDuration;
idleDuration = Math.round(idleDuration * 10.0) / 10.0;
if (idleDuration >= idleLimit) {
idleStart.setIdleDuration(idleDuration);
if (notificationMode == TrackIdleProcessorNotificationMode.Continuous)
geoevent = createTrackIdleGeoEvent(idleStart, true,
geoEvent, ged);
else if (!idleStart.isIdling())
geoevent = createTrackIdleGeoEvent(idleStart, true,
geoEvent, ged);
idleStart.setIdling(true);
}
}
else
{
if (idleStart.isIdling())
{
geoevent = createTrackIdleGeoEvent(idleStart, false, geoEvent, ged);
}
idleStart.setGeometry(geoEvent.getGeometry());
idleStart.setStartTime(geoEvent.getStartTime());
idleStart.setIdling(false);
}
} else {
trackIdles.put(
cacheKey,
new TrackIdleProcessorStart(geoEvent.getTrackId(), startTime, geoEvent.getGeometry()));
}
} catch (Exception error) {
LOGGER.error(error.getMessage(), error);
}
return geoevent;
}
開發者ID:Esri,項目名稱:defense-solutions-proofs-of-concept,代碼行數:65,
示例20: CreateQueries
點讚 2
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的package包/類
public ArrayList CreateQueries(GeoEvent ge) throws Exception {
Set eventTokens = eventTokenMap.keySet();
Iterator eventIt = eventTokens.iterator();
while (eventIt.hasNext()) {
String et = eventIt.next();
String fn = eventTokenMap.get(et);
String val = null;
if (ge.getField(fn) != null) {
val = ge.getField(fn).toString();
wc = wc.replace(et, val);
}
}
ArrayList queries = new ArrayList();
URL url = conn.getUrl();
String protocol = url.getProtocol();
String host = url.getHost();
Integer port = url.getPort();
String path = url.getPath();
String baseUrl = null;
String curPath=null;
if (endpoint != null)
{
curPath = endpoint;
}
else
{
baseUrl = protocol + "://" + host +":" + port.toString() + path + "rest/services";
curPath = baseUrl + "/" + folder + "/" + service+ "/FeatureServer/" + layerId;
}
//String baseUrl = url.getProtocol() + "://" + url.getHost() + ":"
//+ url.getPort() + url.getPath() + "rest/services/";
if(connectionType == ConnectionType.AGOL)
{
//String agolUrl = DefaultAGOLConnection.ARCGIS_Dot_Com_URL;
//token = agolconn.getToken();
}
String restpath = curPath + "/query?";
HashMap query = new HashMap();
HashMap fieldMap = new HashMap();
String fldsString = field;
String[] fieldArray = fldsString.split(",");
for (String f : fieldArray) {
String tk = tokenizer.tokenize(f);
fieldMap.put(f, tk);
}
query.put("restpath", restpath);
query.put("path", curPath);
query.put("whereclause", wc);
query.put("fields", fldsString);
query.put("tokenMap", fieldMap);
query.put("usingdist", calcDist);
query.put("layer", layer.getName());
UUID uid = UUID.randomUUID();
query.put("id", uid);
queries.add(query);
return queries;
}
開發者ID:Esri,項目名稱:defense-solutions-proofs-of-concept,代碼行數:62,
示例21: process
點讚 2
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的package包/類
@Override
public GeoEvent process(GeoEvent geoEvent) throws Exception
{
Date eventTime = (Date) geoEvent.getField("TIME_START");
String trackId = (String) geoEvent.getField("TRACK_ID");
Stop stop = getNextStop(trackId);
if (stop == null)
{
log.error( "Couldn't update ETA for track "+trackId+" because the next stop was not found." );
return null;
}
String incidentCacheKey = buildIncidentCacheKey(geoEvent);
if( incidentCacheKey != null )
{
// String guid = incidentIDMapper.get( incidentCacheKey );
String guid = autoArrivalDepartureManager.getIncidentId(incidentCacheKey);
Incident incident = null;
StopIncidentConditions conditions = stopConditions.get( stop.getName() );
if( guid != null && autoArrivalDepartureManager.hasIncident( guid ) )
{
autoArrivalDepartureManager.updateIncident( guid, geoEvent );
incident = autoArrivalDepartureManager.getIncidentById(guid);
}
else
{
if( conditions == null )
{
conditions = createOpenSpatialConditionForStop( stop );
stopConditions.put( stop.getName(), conditions );
}
if( conditions.open.evaluate( geoEvent ) )
{
incident = autoArrivalDepartureManager.openIncident( "Arrive-Depart for Stop "+stop.getName(),
IncidentType.Cumulative, AlertType.Notification,
com.esri.ges.core.incident.GeometryType.Point, conditions.open,
conditions.close, geoEvent.getGeoEventDefinition().getOwner(), definition.getUri(), 3600, geoEvent, incidentCacheKey);
// incidentIDMapper.put( incidentCacheKey, incident.getId() );
if(stop.getStatus()==StopStatus.Dispatched || stop.getStatus()==StopStatus.Assigned)
{
stop.setActualArrival( eventTime );
stop.setStatus( StopStatus.AtStop );
}
}
}
if (incident != null)
{
if( conditions.close.evaluate(geoEvent) || stop.getStatus()==StopStatus.Completed || stop.getStatus()==StopStatus.Exception)
{
// incidentIDMapper.remove( incidentCacheKey );
// incidentManager.closeIncident( guid, geoEvent );
autoArrivalDepartureManager.closeIncident(incidentCacheKey, geoEvent);
stopConditions.remove(stop.getName());
Vehicle vehicle = vehiclesManager.getVehicleByName( stop.getRouteName() );
vehicle.setNextStopSequenceNumber( stop.getSequenceNumber()+1 );
if(stop.getStatus()==StopStatus.AtStop)
{
stop.setActualDeparture( eventTime );
stop.setActualServiceDuration( (int)DateUtil.minutesBetween( stop.getActualArrival(), eventTime ) );
stop.setStatus( StopStatus.Completed );
}
}
}
}
stop.setLastUpdated(eventTime);
cacheGeoEventWithVehichleResource( geoEvent, trackId );
return createGeoEvent(stop);
}
開發者ID:Esri,項目名稱:route-monitor-for-geoevent,代碼行數:72,
示例22: process
點讚 2
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;
}
}
開發者ID:Esri,項目名稱:solutions-geoevent-java,代碼行數:60,
示例23: process
點讚 2
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的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;
}
開發者ID:Esri,項目名稱:solutions-geoevent-java,代碼行數:44,
示例24: mutateStackForCalculation
點讚 2
import com.esri.ges.core.geoevent.GeoEvent; //導入方法依賴的package包/類
@Override
void mutateStackForCalculation(Stack stack, GeoEvent geoEvent)
{
Object value = null;
Field field = geoEvent.getField((FieldExpression)this.value);
if (field != null)
{
FieldDefinition fd = field.getDefinition();
value = field.getValue();
if (fd != null)
{
switch (fd.getType())
{
case Group:
break;
case Boolean:
if (value == null)
value = Boolean.FALSE;
break;
case Date:
if (value == null)
{
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(0);
value = calendar.getTimeInMillis();
}
else
value = ((Date)value).getTime();
break;
case Geometry:
break;
case String:
if (value == null)
value = "";
break;
case Short:
if (value == null)
value = (short)0;
break;
case Integer:
if (value == null)
value = 0;
break;
case Long:
if (value == null)
value = 0l;
break;
case Float:
if (field.getValue() == null)
value = 0f;
break;
case Double:
if (value == null)
value = 0d;
break;
}
}
}
stack.push(value);
}
開發者ID:Esri,項目名稱:solutions-geoevent-java,代碼行數:61,
注:本文中的com.esri.ges.core.geoevent.GeoEvent.getField方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。