本文整理汇总了Java中com.esri.ges.core.geoevent.GeoEvent.getGeoEventDefinition方法的典型用法代码示例。如果您正苦于以下问题:Java GeoEvent.getGeoEventDefinition方法的具体用法?Java GeoEvent.getGeoEventDefinition怎么用?Java GeoEvent.getGeoEventDefinition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.esri.ges.core.geoevent.GeoEvent
的用法示例。
在下文中一共展示了GeoEvent.getGeoEventDefinition方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: process
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;
}
示例3: 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;
}
示例4: 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;
}
示例5: queueGeoEvent
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
@SuppressWarnings("incomplete-switch")
public void queueGeoEvent(HashMap<String, String> fields)
{
// in.mark(4 * 1024);
if (fields.containsKey("_type"))
{
String geoEventTypeName = fields.get("_type");
GeoEvent geoEvent = findAndCreate(geoEventTypeName);
if (geoEvent == null)
{
LOG.error("The incoming GeoEvent of type \"" + geoEventTypeName + "\" does not have a corresponding Event Definition in the ArcGIS GeoEvent server.");
}
else
{
GeoEventDefinition definition = geoEvent.getGeoEventDefinition();
for (String fieldName : fields.keySet())
{
String fieldValue = fields.get(fieldName);
try
{
FieldDefinition fieldDefinition = definition.getFieldDefinition(fieldName);
if (fieldDefinition == null)
{
LOG.error("The incoming GeoEvent of type \"" + geoEventTypeName + "\" had an attribute called \"" + fieldName + "\"that does not exist in the corresponding Event Definition.");
continue;
}
switch (fieldDefinition.getType())
{
case Integer:
geoEvent.setField(fieldName, Integer.parseInt(fieldValue));
break;
case Long:
geoEvent.setField(fieldName, Long.parseLong(fieldValue));
break;
case Short:
geoEvent.setField(fieldName, Short.parseShort(fieldValue));
break;
case Double:
geoEvent.setField(fieldName, Double.parseDouble(fieldValue));
break;
case Float:
geoEvent.setField(fieldName, Float.parseFloat(fieldValue));
break;
case Boolean:
geoEvent.setField(fieldName, Boolean.parseBoolean(fieldValue));
break;
case Date:
geoEvent.setField(fieldName, DateUtil.convert(fieldValue));
break;
case String:
geoEvent.setField(fieldName, fieldValue);
break;
case Geometry:
String geometryString = fieldValue;
if (geometryString.contains(";"))
geometryString = geometryString.substring(0, geometryString.indexOf(';') - 1);
String[] g = geometryString.split(",");
double x = Double.parseDouble(g[0]);
double y = Double.parseDouble(g[1]);
double z = 0;
if (g.length > 2)
z = Double.parseDouble(g[2]);
int wkid = Integer.parseInt(fields.get("_wkid"));
Point point = spatial.createPoint(x, y, z, wkid);
int geometryID = geoEvent.getGeoEventDefinition().getGeometryId();
geoEvent.setField(geometryID, point.toJson());
break;
}
}
catch (Exception ex)
{
LOG.warn("Error wile trying to parse the GeoEvent field " + fieldName + ":" + fieldValue, ex);
}
}
}
queue.add(geoEvent);
}
}
示例6: process
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;
}
示例7: createPlacemarkForTrack
import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
protected Placemark createPlacemarkForTrack(GeoEvent geoevent, List<GeoEvent> geoevents, boolean updateMode, String altitudeMode, String styleUrl, String defaultLineStyleId, String lineStyleField)
{
GeoEventDefinition geoEventDefinition = geoevent.getGeoEventDefinition();
String lineStyleId = defaultLineStyleId;
Placemark pm = new Placemark();
// pm.setName(geoevent.getTrackId() + "_track");
pm.setName(getLabelFieldValue(geoevent) + "_track");
if (updateMode)
pm.setTargetId(geoevent.getTrackId() + "_track");
else
pm.setId(geoevent.getTrackId() + "_track");
LineString line = new LineString();
ArrayList<Data> extendedData = new ArrayList<Data>();
Data data;
Object[] attributes = geoevent.getAllFields();
for (int i = 0; i < attributes.length; i++)
{
Object obj = attributes[i];
if (obj != null)
{
FieldDefinition fieldDefinition = geoEventDefinition.getFieldDefinitions().get(i);
String fieldName = fieldDefinition.getName();
if (i == geoevent.getGeoEventDefinition().getGeometryId())
{
line.setExtrude(true);
line.setTessellate(true);
line.setAltitudeMode(altitudeMode);
line.setCoordinates(getTrackLineString(geoevents, true));
}
else if (obj instanceof Date)
{
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss aa");
data = new Data(fieldName, formatter.format((Date) obj));
extendedData.add(data);
}
else
{
String attribute = obj.toString();
if (attribute.contains(","))
attribute = "\"" + attribute + "\"";
data = new Data(fieldName, attribute.toString());
extendedData.add(data);
if (lineStyleField.length() > 0 && lineStyleField.equals(fieldName))
{
lineStyleId = attribute.toString();
}
}
}
}
pm.setStyleUrl(styleUrl + lineStyleId);
pm.setData(extendedData);
pm.setLineString(line);
return pm;
}