当前位置: 首页>>代码示例>>Java>>正文


Java GeoEvent.getGeometry方法代码示例

本文整理汇总了Java中com.esri.ges.core.geoevent.GeoEvent.getGeometry方法的典型用法代码示例。如果您正苦于以下问题:Java GeoEvent.getGeometry方法的具体用法?Java GeoEvent.getGeometry怎么用?Java GeoEvent.getGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.esri.ges.core.geoevent.GeoEvent的用法示例。


在下文中一共展示了GeoEvent.getGeometry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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;
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:25,代码来源:BufferProcessor.java

示例2: cacheGeoEventWithVehichleResource

import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
private void cacheGeoEventWithVehichleResource(GeoEvent geoEvent, String trackId)
{
  Route route = routeManager.getRouteByName( trackId );
  if( route == null )
  {
    log.error( "Couldn't find route "+trackId+" when trying to cache last GeoEvent." );
  }
  else
  {
    Resource resource = vehiclesManager.getResourceForVehicle( trackId );
    if( resource != null )
    {
      resource.cache( geoEvent );
      Geometry geom = geoEvent.getGeometry();
      if( geom.getType() == GeometryType.Point )
      {
        vehiclesManager.getVehicleByName( trackId ).setLocation( (Point)geom );
      }
    }
    else
    {
      log.info( "Didn't find resource for vehicle "+trackId );
    }
  }
}
 
开发者ID:Esri,项目名称:route-monitor-for-geoevent,代码行数:26,代码来源:AutoArrivalDepartureProcessor.java

示例3: process

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,代码来源:BufferProcessor.java

示例4: ConstructJsonMaskFromGeoEvent

import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
private String ConstructJsonMaskFromGeoEvent(GeoEvent ge) throws IOException
{
	com.esri.ges.spatial.Geometry eventgeo = ge.getGeometry();
	String json = eventgeo.toJson();
	JsonFactory jf = new JsonFactory();
	JsonParser jp = jf.createJsonParser(json);
	MapGeometry mgeo = GeometryEngine.jsonToGeometry(jp);
	Geometry geo = mgeo.getGeometry();
	Geometry maskGeo = GeometryEngine.project(geo, srIn, srBuffer);
	return GeometryEngine.geometryToJson(srBuffer, maskGeo);
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:12,代码来源:VisibilityProcessor.java

示例5: process

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,代码来源:EllipseProcessor.java

示例6: ConstructJsonMaskFromGeoEvent

import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
private String ConstructJsonMaskFromGeoEvent(GeoEvent ge) throws IOException
{
	MapGeometry eventgeo = ge.getGeometry();
	Geometry geo = eventgeo.getGeometry();
	Geometry maskGeo = GeometryEngine.project(geo, srIn, srBuffer);
	return GeometryEngine.geometryToJson(srBuffer, maskGeo);
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:8,代码来源:VisibilityProcessor.java

示例7: process

import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
@Override
public GeoEvent process(GeoEvent ge) throws Exception {
	
	MapGeometry mapGeo = ge.getGeometry();
	Geometry geo = mapGeo.getGeometry();
	if(geo.getType()!=Geometry.Type.Polygon)
		return null;
	Point center = GeometryUtility.CenterOfMass((Polygon)geo);
	MapGeometry outMapGeo = new MapGeometry(center, mapGeo.getSpatialReference());
	ge.setGeometry(outMapGeo);
	return ge;
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:13,代码来源:Polygon2PtProcessor.java

示例8: populateGeoEvent

import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的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;
}
 
开发者ID:Esri,项目名称:extent-enricher-for-geoevent,代码行数:54,代码来源:GeometryExtentEnricher.java

示例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;
}
 
开发者ID:Esri,项目名称:reverse-geocoder-for-geoevent,代码行数:34,代码来源:ReverseGeocoderProcessor.java

示例10: getTrackLineString

import com.esri.ges.core.geoevent.GeoEvent; //导入方法依赖的package包/类
protected String getTrackLineString(List<GeoEvent> geoevents, boolean useZValue)
{
  String strCoords = "";
  String ptStr = "";
  for (int j = geoevents.size() - 1; j >= 0; j--)
  {
  	GeoEvent geoEvent = geoevents.get(j);
  	if( geoEvent.getGeometry() != null && geoEvent.getGeometry().getGeometry() != null && geoEvent.getGeometry().getGeometry().getType() == Type.Point  )
    {
    	com.esri.core.geometry.Point pt = (com.esri.core.geometry.Point) geoEvent.getGeometry().getGeometry();
      if (useZValue)
      {
        // Workaround: currently geomtry doesn't give us z value.  We have to make sure that 
        // the geoevent has a field that is tagged as ALTITUDE which supplies the z value
        double zvalue = pt.getZ();
        int index = geoevents.get(j).getGeoEventDefinition().getIndexOf(altitudeTag);
        if(index > -1)
        {
          zvalue=Double.parseDouble(geoevents.get(j).getAllFields()[index].toString());
        }
        ptStr = pt.getX() + "," + pt.getY() + "," + zvalue;
      }
      else
      {
        ptStr = pt.getX() + "," + pt.getY() + ",NaN";
      }

      if (strCoords.length() == 0)
      {
        strCoords = ptStr;
      }
      else
      {
        strCoords = strCoords + " " + ptStr;
      }
    }
  }
  return strCoords;
}
 
开发者ID:Esri,项目名称:kml-for-geoevent,代码行数:40,代码来源:KmlGeneratorBase.java

示例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;
}
 
开发者ID:Esri,项目名称:route-monitor-for-geoevent,代码行数:11,代码来源:AutoArrivalDepartureManagerImpl.java

示例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;
}
 
开发者ID:Esri,项目名称:route-monitor-for-geoevent,代码行数:10,代码来源:AutoArrivalDepartureProcessor.java

示例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;
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:65,代码来源:TrackIdleProcessor.java

示例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;
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:65,代码来源:TrackIdleProcessor.java

示例15: process

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,代码来源:RangeFanProcessor.java


注:本文中的com.esri.ges.core.geoevent.GeoEvent.getGeometry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。