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


Java GeometryEngine.project方法代码示例

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


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

示例1: constructGeometry

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
private com.esri.core.geometry.Geometry constructGeometry(com.esri.ges.spatial.Geometry geo) throws Exception
{
	try{
		String jsonIn = geo.toJson();
		JsonFactory jf = new JsonFactory();
		JsonParser jp = jf.createJsonParser(jsonIn);
		MapGeometry mgeo = GeometryEngine.jsonToGeometry(jp);
		com.esri.core.geometry.Geometry geoIn= mgeo.getGeometry();
		return GeometryEngine.project(geoIn, srIn, srBuffer);
	}
	catch(Exception e)
	{
		LOG.error(e.getMessage());
		LOG.error(e.getStackTrace());
		throw(e);
	}
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:18,代码来源:QueryReportProcessor.java

示例2: displaySpotReport

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Override
protected Integer displaySpotReport(double x, double y, final int wkid, Integer graphicId, Geomessage geomessage) {
    try {
        Geometry pt = new Point(x, y);
        if (null != mapController.getSpatialReference() && wkid != mapController.getSpatialReference().getID()) {
            pt = GeometryEngine.project(pt, SpatialReference.create(wkid), mapController.getSpatialReference());
        }
        if (null != graphicId) {
            spotReportLayer.updateGraphic(graphicId, pt);
            spotReportLayer.updateGraphic(graphicId, geomessage.getProperties());
        } else {
            Graphic graphic = new Graphic(pt, spotReportSymbol, geomessage.getProperties());
            graphicId = spotReportLayer.addGraphic(graphic);
            
        }
        return graphicId;
    } catch (NumberFormatException nfe) {
        Logger.getLogger(getClass().getName()).log(Level.SEVERE, "Could not parse spot report", nfe);
        return null;
    }
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:22,代码来源:AdvancedSymbolController.java

示例3: showPoint

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
/**
 * Tells the controller to display the given point.
 * @param pt the point to display.
 * @param sr the spatial reference of the point to display.
 */
public void showPoint(Point pt, SpatialReference sr) {
    synchronized (graphicUpdateLock) {
        lastPointShownLatLon = (Point) GeometryEngine.project(pt, sr, Utilities.WGS84);
        if (-1 == pointGraphicId) {
            createPointGraphic(pt);
            createTextGraphics(pt);
        } else {
            updateGraphic(pointGraphicId, pt);
            updateTextGraphics(pt);
            updateTextGraphics(getDistanceBearingString(currentGpsPointLatLon, lastPointShownLatLon));
        }
    }
    
    setLayerVisibility(true);
    moveLayerToTop();
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:22,代码来源:MgrsLayerController.java

示例4: constructEllipse

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
private MapGeometry constructEllipse(double x, double y, double majorAxis, double minorAxis, double rotation, int wkidin, int wkidbuffer, int wkidout)
{
	Point center = new Point();
	center.setX(x);
	center.setY(y);
	SpatialReference srIn = SpatialReference.create(wkidin);
	SpatialReference srBuffer = SpatialReference.create(wkidbuffer);
	SpatialReference srOut = SpatialReference.create(wkidout);
	UnitConverter uc = new UnitConverter();
	majorAxis = uc.Convert(majorAxis, units, srBuffer);
	minorAxis = uc.Convert(minorAxis, units, srBuffer);
	Point centerProj = (Point) GeometryEngine.project(center, srIn, srBuffer);
	GeometryUtility geoutil = new GeometryUtility();
	Polygon ellipse = geoutil.GenerateEllipse(centerProj, majorAxis, minorAxis, rotation);
	Geometry ellipseOut = GeometryEngine.project(ellipse, srBuffer, srOut);
	MapGeometry mapGeo = new MapGeometry(ellipseOut, srOut);
	return mapGeo;
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:19,代码来源:EllipseProcessor.java

示例5: constructBuffer

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
private Geometry constructBuffer(double x, double y,
		double radius, String units, int wkidin, int wkidbuffer, int wkidout)
		 {
	Point center = new Point();
	center.setX(x);
	center.setY(y);
	SpatialReference srIn = SpatialReference.create(wkidin);
	SpatialReference srBuffer = SpatialReference.create(wkidbuffer);
	SpatialReference srOut = SpatialReference.create(wkidout);
	UnitConverter uc = new UnitConverter();
	String c_name = uc.findConnonicalName(units);
	int unitout = uc.findWkid(c_name);
	Unit u = LinearUnit.create(unitout);
	Point centerProj = (Point) GeometryEngine.project(center, srIn,
			srBuffer);
	Geometry buffer = GeometryEngine
			.buffer(centerProj, srBuffer, radius, u);
	Geometry bufferout = GeometryEngine.project(buffer, srBuffer, srOut);
	//String json = GeometryEngine.geometryToJson(srOut, bufferout);
	return bufferout;

}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:23,代码来源:BufferProcessor.java

示例6: onOptionsItemSelected

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.action_1:
        Point pt = GeometryEngine.project(-64.479, 10.165, mMapView.getSpatialReference());
        mMapView.zoomToScale(pt, 72224);
        break;
        
    case R.id.action_2:
        pt = GeometryEngine.project(-64.57, 10.148, mMapView.getSpatialReference());
        mMapView.zoomToScale(pt, 144448);
        break;
        
    case R.id.action_3:
        pt = GeometryEngine.project(-64.637, 10.153, mMapView.getSpatialReference());
        mMapView.zoomToScale(pt, 72224);
        break;            
    }
    return super.onOptionsItemSelected(item);
}
 
开发者ID:garys-esri,项目名称:offline-mapper-android,代码行数:21,代码来源:MapActivity.java

示例7: setFence

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
public static void setFence(Polygon newFence, SpatialReference fenceSpatialReference) {

    // Keep the original geometries.
    mFenceSr = fenceSpatialReference;
    mFence = newFence;

    // Work with the fence in WGS84, as that's what the location updates will be in.
    // Note that transformations could be used here to increase accuracy.
    if ( mFenceSr.getID() != mWgs84Sr.getID() ) {
      Geometry densified = GeometryEngine.geodesicDensifyGeometry(mFence,
          mFenceSr, 20, null);
      mFenceWgs84 = (Polygon)GeometryEngine.project(densified, mFenceSr, mWgs84Sr);
    }
    else {
      mFenceWgs84 = mFence;
    }
  }
 
开发者ID:Esri,项目名称:arcgis-runtime-demos-android,代码行数:18,代码来源:LocalGeofence.java

示例8: bufferLine

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
/**
 * Create a buffer for a line.
 * @param lineJsonString A JSON string defining the line.
 * @param distance The buffer distance.
 * @return A JSON string with the buffer polygon.
 */
public static String bufferLine(String lineJsonString, double distance){
	String geoJson = null;
	try{
		Polyline polyline = new Polyline();
		JSONObject lineJson = new JSONObject(lineJsonString);
		JSONArray paths = lineJson.getJSONArray("paths");
		JSONArray line = paths.getJSONArray(0);
		for(int k = 0; k < line.length(); k++){
			JSONArray point = line.getJSONArray(k);
			double x = point.getDouble(0);
			double y = point.getDouble(1);
			if(k == 0){
				polyline.startPath(x, y);
			}else{
				polyline.lineTo(x, y);
			}
		}
		SpatialReference srsWGS84 = SpatialReference.create(SpatialReference.WKID_WGS84);
		SpatialReference srsWebMercator = SpatialReference.create(SpatialReference.WKID_WGS84_WEB_MERCATOR);
		Geometry mercatorPolyline = GeometryEngine.project(polyline, srsWGS84, srsWebMercator);
		Polygon mercatorPolygon = GeometryEngine.buffer(mercatorPolyline, srsWebMercator, distance, srsWebMercator.getUnit());
		Polygon polygon = (Polygon) GeometryEngine.project(mercatorPolygon, srsWebMercator, srsWGS84);
		geoJson = GeometryEngine.geometryToJson(srsWGS84, polygon);			
	}catch(Exception e){
		log.error("Error creating line buffer: "+e.getMessage());
	}
	return geoJson;
}
 
开发者ID:EsriDE,项目名称:PTM-OSMGeotrigger,代码行数:35,代码来源:Util.java

示例9: processResult

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
/**
 * Process result from geoprocessing execution.
 * 
 * @param result output of geoprocessing execution.
 */
private void processResult(GPParameter[] result) {
  for (GPParameter outputParameter : result) {
    if (outputParameter instanceof GPFeatureRecordSetLayer) {
      GPFeatureRecordSetLayer gpLayer = (GPFeatureRecordSetLayer) outputParameter;
      int zone = 0;
      // get all the graphics and add them to the graphics layer.
      // there will be one graphic per zone.
      for (Graphic graphic : gpLayer.getGraphics()) {
        SpatialReference fromSR = SpatialReference.create(4326);
        Geometry g = graphic.getGeometry();
        Geometry pg = GeometryEngine.project(g, fromSR, jMap.getSpatialReference());
        Graphic theGraphic = new Graphic(pg, zoneFillSymbols[zone++]);
        // add to the graphics layer
        graphicsLayer.addGraphic(theGraphic);
      }
    }
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:24,代码来源:DemoTheatreApp.java

示例10: parseFeatures

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
private List<Feature> parseFeatures(ArrayNode jsonFeatures) {
  List<Feature> features = new LinkedList<Feature>();
  for (JsonNode jsonFeature : jsonFeatures) {
    String type = jsonFeature.path(FIELD_TYPE).getTextValue();
    if (!FIELD_FEATURE.equals(type)) {
      continue;
    }
    Geometry g = parseGeometry(jsonFeature.path(FIELD_GEOMETRY));
    if (outSR != null && outSR.getID() != 4326) {
      g = GeometryEngine.project(g, inSR, outSR);
    }
    Map<String, Object> attributes = parseProperties(jsonFeature.path(FIELD_PROPERTIES));
    Feature f = new Graphic(g, symbol, attributes);
    features.add(f);
  } 
  return features; 
}
 
开发者ID:Esri,项目名称:arcgis-runtime-demo-java,代码行数:18,代码来源:GeoJsonParser.java

示例11: constructBuffer

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
private com.esri.ges.spatial.Geometry constructBuffer(double x, double y, double radius, String units, int wkidin, int wkidbuffer, int wkidout) throws GeometryException
{
	Point center = new Point();
	center.setX(x);
	center.setY(y);
	SpatialReference srIn = SpatialReference.create(wkidin);
	SpatialReference srBuffer = SpatialReference.create(wkidbuffer);
	SpatialReference srOut = SpatialReference.create(wkidout);
	UnitConverter uc = new UnitConverter();
	String c_name = uc.findConnonicalName(units);
	int unitout = uc.findWkid(c_name);
	Unit  u = new LinearUnit(unitout);
	Point centerProj = (Point) GeometryEngine.project(center, srIn, srBuffer);
	Geometry buffer = GeometryEngine.buffer(centerProj, srBuffer, radius, u);
	Geometry bufferout = GeometryEngine.project(buffer, srBuffer, srOut);
	String json = GeometryEngine.geometryToJson(srOut, bufferout);
	return spatial.fromJson(json);
	
}
 
开发者ID:Esri,项目名称:solutions-geoevent-java,代码行数:20,代码来源:BufferProcessor.java

示例12: constructEllipse

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
private com.esri.ges.spatial.Geometry constructEllipse(double x, double y, double majorAxis, double minorAxis, double rotation, int wkidin, int wkidbuffer, int wkidout) throws GeometryException
{
	Point center = new Point();
	center.setX(x);
	center.setY(y);
	SpatialReference srIn = SpatialReference.create(wkidin);
	SpatialReference srBuffer = SpatialReference.create(wkidbuffer);
	SpatialReference srOut = SpatialReference.create(wkidout);
	Point centerProj = (Point) GeometryEngine.project(center, srIn, srBuffer);
	GeometryUtility geoutil = new GeometryUtility();
	Polygon ellipse = geoutil.GenerateEllipse(centerProj, majorAxis, minorAxis, rotation);
	Geometry ellipseOut = GeometryEngine.project(ellipse, srBuffer, srOut);
	String json = GeometryEngine.geometryToJson(srOut, ellipseOut);
	return spatial.fromJson(json);
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:16,代码来源:EllipseProcessor.java

示例13: constructBuffer

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
private com.esri.ges.spatial.Geometry constructBuffer(Geometry geo, double radius, Unit u) throws GeometryException, JsonParseException, IOException
{
	
	com.esri.core.geometry.Geometry buffer = GeometryEngine.buffer(inGeometry, srBuffer, radius, u);
	com.esri.core.geometry.Geometry bufferout = GeometryEngine.project(buffer, srBuffer, srOut);
	String json = GeometryEngine.geometryToJson(srOut, bufferout);
	return spatial.fromJson(json);
	
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:10,代码来源:QueryReportProcessor.java

示例14: GetDistAsString

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
private String GetDistAsString(Graphic g, SpatialReference inputSr, String units)
{
	com.esri.core.geometry.Geometry geo = g.getGeometry();
	com.esri.core.geometry.Geometry curGeo;
	
	if(!inputSr.equals(srBuffer))
	{
		curGeo = GeometryEngine.project(geo, inputSr, srBuffer);
	}
	else
	{
		curGeo=geo;
	}
	double tmpDist = GeometryEngine.distance(inGeometry, curGeo, srBuffer);
	UnitConverter uc = new UnitConverter();
	int inUnitWkid = uc.findWkid(srBuffer.getUnit().getName());
	String cn = uc.findConnonicalName(units);
	int outUnitWkid = uc.findWkid(cn);
	double dist;
	if(inUnitWkid!=outUnitWkid)
	{
		dist = uc.Convert(tmpDist, inUnitWkid, outUnitWkid);
	}
	else
	{
		dist=tmpDist;
	}
	
	DecimalFormat df = new DecimalFormat("#.00");
	return df.format(dist);
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:32,代码来源:QueryReportProcessor.java

示例15: onLocationChanged

import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
public void onLocationChanged(Location location) {
    if (null != location) {
        final Point mapPoint = GeometryEngine.project(location.getLongitude(), location.getLatitude(), getSpatialReference());
        new Thread() {
            public void run() {
                synchronized (lastLocationLock) {
                    lastLocation = mapPoint;
                }
            };
        }.start();
        
        if (isAutoPan()) {
            map.panTo(mapPoint);
            
            switch (getLocationController().getNavigationMode()) {
                case NORTH_UP:
                    setRotation(0);
                    break;

                case TRACK_UP:
                    setRotation(location.getHeading());
                    break;
                    
                case WAYPOINT_UP:
                    Graphic waypoint = ((LocationController) getLocationController()).getSelectedWaypoint();
                    if (null != waypoint) {
                        Point waypointLonLat = (Point) GeometryEngine.project(
                                waypoint.getGeometry(),
                                null == waypoint.getSpatialReference() ? getSpatialReference() : waypoint.getSpatialReference(),
                                Utilities.WGS84);
                        setRotation(Utilities.calculateBearingDegrees(location.getLongitude(), location.getLatitude(), waypointLonLat.getX(), waypointLonLat.getY()));
                    }
            }
        }
    }
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:37,代码来源:MapController.java


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