本文整理汇总了Java中com.esri.ges.core.geoevent.GeoEvent类的典型用法代码示例。如果您正苦于以下问题:Java GeoEvent类的具体用法?Java GeoEvent怎么用?Java GeoEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GeoEvent类属于com.esri.ges.core.geoevent包,在下文中一共展示了GeoEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import com.esri.ges.core.geoevent.GeoEvent; //导入依赖的package包/类
@Override
public GeoEvent process(GeoEvent geoEvent) throws Exception
{
String trackID = geoEvent.getTrackId();
Date startTime = geoEvent.getStartTime();
if (trackCache.containsKey(trackID))
{
Date lastTime = trackCache.get(trackID);
// Filter out any tracks that haven't been updated since last time
if (!startTime.after(lastTime))
{
LOG.trace("UpdateOnlyProcessor ignoring track as nothing new since last time: " + trackID + " : " + startTime.toString());
return null;
}
LOG.trace("UpdateOnlyProcessor is handling new data for track " + trackID + " : " + startTime.toString() + " is more recent than " + lastTime.toString());
}
else
{
LOG.trace("UpdateOnlyProcessor is handling a new track: " + trackID + " : " + startTime.toString());
}
// If we've reached here, then either there's an update to a track in the cache, or there's a new track, so record it in the cache
trackCache.put(trackID, startTime);
//... and allow the geoEvent through
return geoEvent;
}
示例2: findAndCreate
import com.esri.ges.core.geoevent.GeoEvent; //导入依赖的package包/类
private GeoEvent findAndCreate(String name)
{
Collection<GeoEventDefinition> results = geoEventCreator.getGeoEventDefinitionManager().searchGeoEventDefinitionByName(name);
if (!results.isEmpty())
{
try
{
return geoEventCreator.create(results.iterator().next().getGuid());
}
catch (MessagingException e)
{
LOG.error("GeoEvent creation failed: " + e.getMessage());
}
}
else
LOG.error("GeoEvent creation failed: GeoEvent definition '" + name + "' not found.");
return null;
}
示例3: 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;
}
示例4: 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;
}
示例5: process
import com.esri.ges.core.geoevent.GeoEvent; //导入依赖的package包/类
@Override
public GeoEvent process(GeoEvent geoEvent) throws Exception, MalformedURLException, JSONException
{
try
{
Point point = (Point) geoEvent.getGeometry().getGeometry();
double lon = point.getX();
double lat = point.getY();
int wkid = geoEvent.getGeometry().getSpatialReference().getID();
//fetch nearby OpenStreetmap Points of Interest via geoNames web service
URL geoNamesNearbyOSMPOIsURL = new URL("http://api.geonames.org/findNearbyPOIsOSMJSON?lat=" + Double.toString(lat) + "&lng=" + Double.toString(lon) + "&username=" + geoNamesUsername + "&radius=" + Double.toString(geoNamesNearbyOSMPOIsRadius) + "&maxRows=" + Integer.toString(geoNamesNearbyOSMPOIsMaxRows));
String responseOSMPOI = getReverseGeocode(geoNamesNearbyOSMPOIsURL);
createOSMPOIGeoEvent(geoEvent,responseOSMPOI);
}
catch (MessagingException e)
{
LOGGER.error("EVENT_SEND_FAILURE", e);
}
return null;
}
示例6: process
import com.esri.ges.core.geoevent.GeoEvent; //导入依赖的package包/类
@Override
public GeoEvent process(GeoEvent geoEvent) throws Exception, MalformedURLException, JSONException
{
try
{
Point point = (Point) geoEvent.getGeometry().getGeometry();
double lon = point.getX();
double lat = point.getY();
int wkid = geoEvent.getGeometry().getSpatialReference().getID();
// fetch nearby Wikipedia articles via geoNames web service
String geoNamesLang = "en"; // lang : language code (around 240 languages) (default = en)
URL geoNamesWikipediaURL = new URL("http://api.geonames.org/findNearbyWikipediaJSON?lat=" + Double.toString(lat) + "&lng=" + Double.toString(lon) + "&username=" + geoNamesUsername + "&lang=" + geoNamesLang + "&radius=" + Double.toString(geoNamesWikipediaRadius) + "&maxRows=" + Integer.toString(geoNamesWikipediaMaxRows));
String responseWikipedia = getReverseGeocode(geoNamesWikipediaURL);
createWikipediaGeoEvent(geoEvent, responseWikipedia);
}
catch (MessagingException e)
{
LOGGER.error("EVENT_SEND_FAILURE", e);
}
return null;
}
示例7: populateGeoEvent
import com.esri.ges.core.geoevent.GeoEvent; //导入依赖的package包/类
private GeoEvent populateGeoEvent(GeoEvent geoEvent, GeoEventDefinition edOut, Object outputGeometry) throws MessagingException
{
GeoEvent outGeoEvent;
if (outputGeometry == null)
outGeoEvent = geoEventCreator.create(edOut.getGuid(), geoEvent.getAllFields());
else
outGeoEvent = geoEventCreator.create(edOut.getGuid(), new Object[] { geoEvent.getAllFields(), outputGeometry });
outGeoEvent.setProperty(GeoEventPropertyName.TYPE, geoEvent.getProperty(GeoEventPropertyName.TYPE));
outGeoEvent.setProperty(GeoEventPropertyName.OWNER_ID, geoEvent.getProperty(GeoEventPropertyName.OWNER_ID));
outGeoEvent.setProperty(GeoEventPropertyName.OWNER_URI, geoEvent.getProperty(GeoEventPropertyName.OWNER_URI));
for (Map.Entry<GeoEventPropertyName, Object> property : geoEvent.getProperties())
{
if (!outGeoEvent.hasProperty(property.getKey()))
outGeoEvent.setProperty(property.getKey(), property.getValue());
}
return outGeoEvent;
}
示例8: processGeometry
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;
}
示例9: getLabelFieldValue
import com.esri.ges.core.geoevent.GeoEvent; //导入依赖的package包/类
private String getLabelFieldValue(GeoEvent geoevent)
{
String value = "";
int i;
i = geoevent.getGeoEventDefinition().getIndexOf(kmlLabelFieldTag);
if (i > -1)
{
value = geoevent.getAllFields()[i].toString();
}
else
{
value = geoevent.getTrackId();
}
return value==null?"":value;
}
示例10: generateKml
import com.esri.ges.core.geoevent.GeoEvent; //导入依赖的package包/类
@Override
public byte[] generateKml(Map<String, List<GeoEvent>> geoevents, KmlRequestParameters params) throws JAXBException, XMLStreamException
{
ByteArrayOutputStream kmlOutput = new ByteArrayOutputStream();
// String assetsDir = params.getAssetDir();
if (params.isUpdateMode())
{
doGenerateUpdateKml(geoevents, kmlOutput, params.getUrl(), params);
}
else
{
doGenerateRefreshKml(geoevents, kmlOutput, params);
}
//getKMZ(outputName + ".kml", kmlOutput.toString(), output);
return kmlOutput.toByteArray();
}
示例11: processData
import com.esri.ges.core.geoevent.GeoEvent; //导入依赖的package包/类
@Override
public byte[] processData(Map<String, List<GeoEvent>> geoevents) throws ComponentException
{
byte[] output = null;
loadProperties();
compressKml = getProperty("compression").getValueAsString().equalsIgnoreCase("true") ? true : false;
try
{
if (params.isLinksOnly())
output = getKmlGenerator().generateInitialKml(params);
else
output = getKmlGenerator().generateKml(geoevents, params);
if (compressKml)
output = zipBytes(params.getOutputName() + ".kml", output);
}
catch (Exception error)
{
throw new ComponentException(LOGGER.translate("PROCESS_DATA_ERROR", error.getMessage()));
}
return output;
}
示例12: setGeoEvent
import com.esri.ges.core.geoevent.GeoEvent; //导入依赖的package包/类
public boolean setGeoEvent(GeoEvent geoevent)
{
LOGGER.debug("setGeoEvent");
LOGGER.debug(geoevent.toString());
// Check if the time stamp of the incoming geoevent is out of temporal
// order then don't replace the this.currentGeoEvent
Long timespanMilliSecs = 0L;
timespanMilliSecs = geoevent.getStartTime().getTime() - getCurrentGeoEvent().getStartTime().getTime();
if (timespanMilliSecs < 0)
{
// Don't set to the currentGeoEvent if the incoming geoevent is older
// than the currentGeoEvent
return false;
}
this.previousGeoEvent = this.getCurrentGeoEvent();
this.currentGeoEvent = geoevent;
return true;
}
示例13: sendReport
import com.esri.ges.core.geoevent.GeoEvent; //导入依赖的package包/类
private void sendReport()
{
if (notificationMode != MotionCalculatorNotificationMode.OnChange)
{
return;
}
LOGGER.debug("sendReport");
try
{
GeoEvent outGeoEvent = createMotionGeoEvent();
if (outGeoEvent == null)
{
LOGGER.debug("outGeoEvent is null");
return;
}
LOGGER.debug(outGeoEvent.toString());
send(outGeoEvent);
}
catch (MessagingException e)
{
LOGGER.error("Error sending update GeoEvent for " + id, e);
}
}
示例14: parseFeaturesToStops
import com.esri.ges.core.geoevent.GeoEvent; //导入依赖的package包/类
private List<Stop> parseFeaturesToStops(List<JsonNode> nodes)
{
GeoEvent geoEvent;
List <Stop> stops = new ArrayList<Stop>();
try
{
geoEvent = geoEventCreator.create(stopGEDName, stopGEDOwner);
List<GeoEvent> geoEvents = FeatureUtil.convertFeaturesToGeoEvents(nodes, spatial, geoEventCreator, geoEvent.getGeoEventDefinition());
for(GeoEvent ge : geoEvents)
{
Stop stop = createStop((String)ge.getField( StopResource.STOP_NAME_KEY ));
convertGeoEventToStop(ge, stop);
stops.add(stop);
}
}
catch (MessagingException e)
{
log.error(e);
}
return stops;
}
示例15: getPlan
import com.esri.ges.core.geoevent.GeoEvent; //导入依赖的package包/类
@Override
public GeoEvent getPlan()
{
//List<Vehicle> vehicles = vehiclesManager.getVehicles();
List<Stop> stops = stopsManager.getStops();
List<Route> routes = new ArrayList<Route>(routeManager.getRoutes());
Plan plan = new Plan();
plan.setRoutes(routes);
plan.setStops(stops);
GeoEvent newGeoEvent = null;
try
{
newGeoEvent = routeManager.createPlanGeoEvent(plan, false, PlanStatus.Successful, "");
}
catch(Exception ex)
{
log.error(ex);
newGeoEvent = routeManager.createPlanGeoEvent(null, false, PlanStatus.Failed, ex.getMessage());
}
return newGeoEvent;
}