本文整理汇总了Java中com.esri.ges.core.geoevent.FieldException类的典型用法代码示例。如果您正苦于以下问题:Java FieldException类的具体用法?Java FieldException怎么用?Java FieldException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FieldException类属于com.esri.ges.core.geoevent包,在下文中一共展示了FieldException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: traverseFieldGroup
import com.esri.ges.core.geoevent.FieldException; //导入依赖的package包/类
private String traverseFieldGroup(FieldDefinition parentFieldDef, StringBuilder sb, FieldGroup fg){
StringBuilder mine=new StringBuilder();
//System.out.println("**Start: "+ parentFieldDef.getName());
for (FieldDefinition fieldDef: parentFieldDef.getChildren()){
if(fieldDef.getType()==FieldType.Group){
//System.out.println("Found another Group:"+ fieldDef.getName());
try {
mine.append("<"+fieldDef.getName()+getAttributes(fieldDef,mine,fg.getFieldGroup(fieldDef.getName()))+">"+traverseFieldGroup(fieldDef,mine,fg.getFieldGroup(fieldDef.getName()))+"</"+fieldDef.getName()+">");
} catch (FieldException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
//System.out.println("not a group:" + fieldDef.getName()+"="+fg.getField(fieldDef.getName())+ " toString: "+ fieldDef.toString());
if(fg.getField(fieldDef.getName())!=null){
if (fieldDef.getName().equals("#text"))
mine.append(fg.getField(fieldDef.getName()));
}
}
}
//System.out.println("**End: "+ parentFieldDef.getName());
return mine.toString();
}
示例2: createLine2PtGeoevent
import com.esri.ges.core.geoevent.FieldException; //导入依赖的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;
}
示例3: convertGeoEventToCalculateParameters
import com.esri.ges.core.geoevent.FieldException; //导入依赖的package包/类
private Collection<CalculateParamsWrapper> convertGeoEventToCalculateParameters(GeoEvent geoEvent) throws FieldException
{
Collection<CalculateParamsWrapper> wrappers = new ArrayList<CalculateParamsWrapper>();
List<FieldGroup> fieldGroups = geoEvent.getFieldGroups(0);
for(FieldGroup fg : fieldGroups)
{
// TODO: workaround. json adapter writes Boolean as string. As a result, the input which uses the same GED could not read Boolean fields.
// If optimize is null, set it to false.
boolean optimize = false;
if(fg.getField("optimize") != null)
optimize = (Boolean)fg.getField("optimize");
CalculateParamsWrapper wrapper = new CalculateParamsWrapper();
wrapper.setRouteName((String)fg.getField("routeName"));
wrapper.setOptimize(optimize);
wrapper.setStops((List<String>)fg.getFields("stops"));
wrappers.add(wrapper);
}
return wrappers;
}
示例4: getStopsSnapshot
import com.esri.ges.core.geoevent.FieldException; //导入依赖的package包/类
private void getStopsSnapshot(GeoEvent geoevent, Map<String, DefaultStop> stopsSnapshot)
{
try
{
List<FieldGroup> geRoutes = geoevent.getFieldGroups("route");
for(FieldGroup fg : geRoutes)
{
List<String> geStops = (List<String>) fg.getFields("stops");
for(String stopname : geStops)
{
Stop stop = stopsManager.getStopByName(stopname);
if(stop != null)
{
DefaultStop dStop = new DefaultStop(stop);
stopsSnapshot.put(stopname, dStop);
}
}
}
}
catch (FieldException e)
{
LOG.error(e);
}
}
示例5: translate
import com.esri.ges.core.geoevent.FieldException; //导入依赖的package包/类
@Override
public void translate(GeoEvent geoEvent, String[] data) throws FieldException
{
int i = 1;
geoEvent.setField(i++, toTime(data[1], null));
geoEvent.setField(i++, toPoint(data[2], data[4], "N".equals(data[3]), "E".equals(data[5])));
geoEvent.setField(i++, convertToShort(data[6]));
geoEvent.setField(i++, convertToShort(data[7]));
geoEvent.setField(i++, convertToDouble(data[8]));
geoEvent.setField(i++, convertToDouble(data[9]));
geoEvent.setField(i++, data[10]);
geoEvent.setField(i++, convertToDouble(data[11]));
geoEvent.setField(i++, data[12]);
geoEvent.setField(i++, data[13]);
geoEvent.setField(i++, data[14].split("\\*")[0]);
}
示例6: translate
import com.esri.ges.core.geoevent.FieldException; //导入依赖的package包/类
@Override
public void translate(GeoEvent geoEvent, String[] data) throws FieldException
{
int i = 1;
geoEvent.setField(i++, toTime(data[1], data[9]));
geoEvent.setField(i++, toPoint(data[3], data[5], "N".equals(data[4]), "E".equals(data[6])));
geoEvent.setField(i++, data[2]);
geoEvent.setField(i++, convertToDouble(data[7]));
geoEvent.setField(i++, convertToDouble(data[8]));
geoEvent.setField(i++, convertToDouble(data[10]));
if(data.length==12)
geoEvent.setField(i++, data[11].split("\\*")[0]);
else
{
geoEvent.setField(i++, data[11]);
geoEvent.setField(i++, data[12].split("\\*")[0]);
}
}
示例7: processVertices
import com.esri.ges.core.geoevent.FieldException; //导入依赖的package包/类
private void processVertices(GeoEvent ge, Polyline polyln, double distTotal, long start, long end, LinearUnit lu, Boolean projected) throws MessagingException, FieldException
{
int count = polyln.getPointCount();
double currentDist = 0;
long currentTime = start;
long totalTime = end - start;
Geometry outGeo = null;
Point projGeo = null;
Point lastPoint = null;
for(int i = 0; i < count; ++i)
{
projGeo = polyln.getPoint(i);
if(i!=0)
{
Polyline seg = new Polyline();
seg.startPath(lastPoint);
seg.lineTo(projGeo);
double segDist = GeometryEngine.geodesicLength(seg, processSr, lu);
currentDist += segDist;
double percent = currentDist/distTotal;
currentTime = (long) Math.floor((start + (totalTime*percent)));
}
if(projected)
{
outGeo = GeometryEngine.project(projGeo, processSr, outSr);
}
else
{
outGeo=projGeo;
}
MapGeometry outMapGeo = new MapGeometry(outGeo, outSr);
double minutesFromStart = (currentTime - start)/60000;
GeoEvent msg = createVertexGeoevent(ge, outMapGeo, currentDist, currentTime, minutesFromStart, i);
send(msg);
lastPoint = projGeo;
}
}
示例8: createVertexGeoevent
import com.esri.ges.core.geoevent.FieldException; //导入依赖的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;
}
示例9: createIncrementalPointGeoevent
import com.esri.ges.core.geoevent.FieldException; //导入依赖的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;
}
示例10: populateGeoEvent
import com.esri.ges.core.geoevent.FieldException; //导入依赖的package包/类
/**
* The populateGeoEvent method does the following things:
* <ol>
* <li>Creates a copy of the incoming GeoEvent using the {@link GeoEventCreator}.</li>
* <li>Check's the GeoEvent's Geometry (it make sure it exists) and creates an extent from it.</li>
* <li>Adds the fields <code>MinX</code>, <code>MinY</code>, <code>MaxX</code>, <code>MaxY</code></li> to the GeoEvent using the Geometry's extent.
* <li>Optionally, adds the Geometry's extent center point as well.</li>
* </ol>
*
* @param geoEvent The incoming GeoEvent to be augmented
* @param edOut the augmented GeoEventDefinition
* @return the augmented GeoEvent
*
* @throws MessagingException if the incoming GeoEvent cannot be augmented.
*
* @see GeoEvent
* @see GeoEventDefinition
*/
private GeoEvent populateGeoEvent(GeoEvent geoEvent, GeoEventDefinition edOut) throws MessagingException
{
GeoEvent outGeoEvent = geoEventCreator.create(edOut.getGuid(), new Object[] { geoEvent.getAllFields(), (addCenterPoint) ? new Object[5] : new Object[4] });
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));
MapGeometry geometry = geoEvent.getGeometry();
if (geometry != null)
{
Envelope2D boundingBox = new Envelope2D();
geometry.getGeometry().queryEnvelope2D(boundingBox);
try
{
outGeoEvent.setField("MinX", boundingBox.xmin);
outGeoEvent.setField("MinY", boundingBox.ymin);
outGeoEvent.setField("MaxX", boundingBox.xmax);
outGeoEvent.setField("MaxY", boundingBox.ymax);
if (addCenterPoint)
{
Point centerPt = new Point(boundingBox.getCenter());
outGeoEvent.setField("CenterPoint", new MapGeometry(centerPt, geometry.getSpatialReference()));
}
}
catch (FieldException error)
{
LOGGER.error("ERROR_SETTING_EXTENT_FIELDS", error.getMessage());
LOGGER.info(error.getMessage(), error);
}
}
else
LOGGER.debug("GEOMETRY_EMPTY_MSG");
return outGeoEvent;
}
示例11: processGeoEvent
import com.esri.ges.core.geoevent.FieldException; //导入依赖的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;
}
示例12: clearPlan
import com.esri.ges.core.geoevent.FieldException; //导入依赖的package包/类
@Override
public GeoEvent clearPlan(GeoEvent geoEvent, String agsConnectionName, String path, String featureService, String stopLayer, String routeLayer, String vehicleLayer, String geofenceLayer, String alertLayer)
{
stopsManager.clearAllStops(agsConnectionName, path, featureService, stopLayer, geofenceLayer);
routeManager.clearAllRouteFeatures(agsConnectionName, path, featureService, routeLayer);
vehiclesManager.clearAllVehicleFeatures(agsConnectionName, path, featureService, vehicleLayer);
alertsManager.clearAllAlertFeatures(agsConnectionName, path, featureService, alertLayer);
autoArrivalDepartureManager.clearIncidents();
GeoEvent newGeoEvent = (GeoEvent) geoEvent.clone(null);
try
{
newGeoEvent.setField(STATUS_FIELD, PlanStatus.Successful.toString());
}
catch (FieldException e)
{
log.error(e.getStackTrace());
try
{
newGeoEvent.setField(STATUS_FIELD, PlanStatus.Failed.toString());
}
catch (FieldException e1)
{
log.error(e1.getStackTrace());
}
}
return newGeoEvent;
}
示例13: translate
import com.esri.ges.core.geoevent.FieldException; //导入依赖的package包/类
@Override
public void translate(GeoEvent geoEvent, String[] data) throws FieldException
{
int i = 1;
geoEvent.setField(i++, toTime(data[5], null));
geoEvent.setField(i++, toPoint(data[1], data[3], "N".equals(data[2]), "E".equals(data[4])));
geoEvent.setField(i++, data[6].split("\\*")[0]);
}
示例14: readIDField
import com.esri.ges.core.geoevent.FieldException; //导入依赖的package包/类
public void readIDField(ByteBuffer buf, GeoEvent geoEvent, int i) throws MessagingException, FieldException
{
//Check if there is more data
int rm = buf.remaining();
if (buf.remaining() > 8)
{
buf.mark();
readString(buf, 1); //Read out semi-colon ;
String idName = readString(buf, 3); //Read out ID=
if (idName.equals("ID=") == true)
{
//read until ';' to get value of the ID
String id = "";
while(true)
{
String data = readString(buf, 1);
if (data.equals(";") == false)
{
id += data;
}
else
{
break;
}
}
geoEvent.setField(i++, id);
}
else //no ID= field
{
buf.reset(); //set the buf position back to the marked position
}
}
}
示例15: translate
import com.esri.ges.core.geoevent.FieldException; //导入依赖的package包/类
@Override
protected void translate(String trackId, ByteBuffer buf, GeoEvent geoEvent) throws MessagingException, FieldException
{
//CP Compact Position Solution
//AAAAABBBCCCCDDDDEEEEFG
//Total number of characters is 22
int i = 0;
geoEvent.setField(i++, trackId);
geoEvent.setField(i++, toTime(convertToInteger(readString(buf, 5)), 0)); //GPS Time of day 5 Sec AAAAA
Integer y = convertToInteger(readString(buf, 7).replace('+', ' ').trim()); //Latitude 7 Deg BBBCCCC
Integer x = convertToInteger(readString(buf, 8).replace('+', ' ').trim()); //Longitude 8 Deg DDDDEEEE
if (x != null && y != null)
{
MapGeometry geometry = new MapGeometry(new Point(x * 0.0001, y * 0.00001), SpatialReference.create(4326));
geoEvent.setField(i++, GeometryUtil.toJson(geometry));
}
geoEvent.setField(i++, convertToShort(readString(buf, 1))); //Source 1 n/a F
/*
0 = 2D GPS
1 = 3D GPS
2 = 2D DGPS
3 = 3D DGPS
6 = DR
8 = Degraded DR
9 = Unknown
*/
geoEvent.setField(i++, convertToShort(readString(buf, 1))); //Age of Data Indicator 1 n/a G
/*
2 = Fresh, <10 sec
1 = Old, >10 sec
0 = Not available
*/
readIDField(buf, geoEvent, i);
}