本文整理汇总了Java中com.esri.ges.core.geoevent.GeoEvent.getTrackId方法的典型用法代码示例。如果您正苦于以下问题:Java GeoEvent.getTrackId方法的具体用法?Java GeoEvent.getTrackId怎么用?Java GeoEvent.getTrackId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.esri.ges.core.geoevent.GeoEvent
的用法示例。
在下文中一共展示了GeoEvent.getTrackId方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: 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;
}
示例4: filterMaxPerInterval
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
public GeoEvent filterMaxPerInterval(GeoEvent dataMessage) throws Exception {
try {
TrackRecord track = defaultTrack;
String trackID = dataMessage.getTrackId();
String guid = dataMessage.getGeoEventDefinition().getGuid();
if (trackID != null) {
String uid = guid + "_" + trackID;
if (!trackCache.containsKey(uid))
trackCache.put(uid, new TrackRecord());
track = trackCache.get(uid);
}
long now = System.currentTimeMillis();
if (now - track.lastTime < intervalInMillis) {
track.count++;
if (track.count > eventsPerInterval)
return null;
} else {
track.lastTime = now;
track.count = 1;
}
if (now - lastCleanup > 2 * intervalInMillis)
cleanup();
return dataMessage;
} catch (Exception e) {
LOG.error(e.getMessage());
LOG.error(e.getStackTrace());
throw (e);
}
}
示例5: filterByInterval
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
private GeoEvent filterByInterval(GeoEvent dataMessage) throws Exception
{
try {
TrackRecord track = defaultTrack;
String trackID = dataMessage.getTrackId();
String guid = dataMessage.getGeoEventDefinition().getGuid();
if (trackID != null) {
String uid = guid + "_" + trackID;
if (!trackCache.containsKey(uid)) {
trackCache.put(uid, new TrackRecord());
return dataMessage;
}
track = trackCache.get(uid);
}
long now = System.currentTimeMillis();
if (now - track.lastTime >= intervalInMillis) {
track.lastTime = now;
} else {
return null;
}
if (now - lastCleanup > 2 * intervalInMillis)
cleanup();
return dataMessage;
} catch (Exception e) {
LOG.error(e.getMessage());
LOG.error(e.getStackTrace());
throw (e);
}
}
示例6: buildCacheKey
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
private String buildCacheKey(GeoEvent geoEvent) {
if (geoEvent != null && geoEvent.getTrackId() != null) {
GeoEventDefinition definition = geoEvent.getGeoEventDefinition();
return definition.getOwner() + "/" + definition.getName() + "/"
+ geoEvent.getTrackId();
}
return null;
}
示例7: 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;
}
示例8: 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;
}
示例9: processGeoEvent
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
private GeoEvent processGeoEvent(GeoEvent geoEvent) throws MalformedURLException, JSONException, ConfigurationException, GeoEventDefinitionManagerException, FieldException
{
if (geoEvent.getTrackId() == null || geoEvent.getGeometry() == null)
{
LOGGER.warn("NULL_ERROR: TrackID and/or Geometry is NULL.");
return null;
}
Geometry geom = geoEvent.getGeometry().getGeometry();
if (geom.isEmpty())
return geoEvent;
if (!Geometry.isPoint(geom.getType().value()))
return geoEvent;
if (Geometry.isMultiVertex(geom.getType().value()))
return geoEvent;
Point point = (Point) geom;
double lon = point.getX();
double lat = point.getY();
int wkid = geoEvent.getGeometry().getSpatialReference().getID();
// fetch nearest street address (reverse geocode) via ArcGIS Online World GeoCode service
// The response format. Values: html | json | kmz
// The default response format is html.
agolSearchFormat = "json";
URL agolURL = new URL("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?location=" + Double.toString(lon) + "," + Double.toString(lat) + "&distance=" + Integer.toString(agolSearchDistance) + "&outSR=" + Integer.toString(wkid) + "&f=" + agolSearchFormat);
String addressJson = getReverseGeocode(agolURL);
GeoEvent agolStreetAddress = augmentGeoEventWithAddress(geoEvent, addressJson);
return agolStreetAddress;
}
示例10: process
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
@Override
public GeoEvent process(GeoEvent geoevent) throws Exception
{
String trackId = geoevent.getTrackId();
MotionElements motionEle;
if (motionElementsCache.containsKey(trackId) == false)
{
motionEle = new MotionElements(geoevent);
}
else
{
motionEle = motionElementsCache.get(trackId);
boolean correctTemporalOrder = motionEle.setGeoEvent(geoevent);
// Only compute and send report if the temporal order is correct
if (correctTemporalOrder)
{
motionEle.calculateAndSendReport();
}
else
{
LOGGER.error("Wrong temporal order detected: " + geoevent.toString());
}
}
// Need to synchronize the Concurrent Map on write to avoid wrong counting
synchronized (lock1)
{
motionElementsCache.put(trackId, motionEle);
}
return null;
}
示例11: buildIncidentKey
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
@Override
public String buildIncidentKey(GeoEvent geoEvent)
{
if (geoEvent != null && geoEvent.getTrackId() != null && geoEvent.getStartTime() != null && geoEvent.getGeometry() != null)
{
GeoEventDefinition definition = geoEvent.getGeoEventDefinition();
return definition.getOwner() + "/" + definition.getName() + "/" + geoEvent.getTrackId();
}
return null;
}
示例12: buildIncidentCacheKey
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
private String buildIncidentCacheKey(GeoEvent geoEvent)
{
if (geoEvent != null && geoEvent.getTrackId() != null && geoEvent.getStartTime() != null && geoEvent.getGeometry() != null)
{
GeoEventDefinition definition = geoEvent.getGeoEventDefinition();
return definition.getOwner() + "/" + definition.getName() + "/" + geoEvent.getTrackId();
}
return null;
}
示例13: process
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;
}
示例14: processGeoEvent
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;
}