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


Java GeometryEngine类代码示例

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


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

示例1: 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,项目名称:defense-solutions-proofs-of-concept,代码行数:20,代码来源:BufferProcessor.java

示例2: 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

示例3: 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

示例4: hasGeometryMoved

import com.esri.core.geometry.GeometryEngine; //导入依赖的package包/类
private boolean hasGeometryMoved(MapGeometry geom1, MapGeometry geom2,
		double tolerance) {
	if (geom1 != null && geom1.getGeometry() != null
			&& geom1.getGeometry().getType() == Type.Point && geom2 != null
			&& geom2.getGeometry() != null
			&& geom2.getGeometry().getType() == Type.Point) {
		Point corePt1 = (Point) geom1.getGeometry();
		Point corePt2 = (Point) geom2.getGeometry();
		double meters = 0.0;
		try {
			meters = GeometryEngine.geodesicDistanceOnWGS84(corePt1,
					corePt2);
		} catch (Throwable error) {
			LOGGER.error(error.getMessage());
		}

		double feet = meter2feet(meters);
		if (feet >= tolerance)
			return true;
		else
			return false;
	} else {
		throw new RuntimeException(
				LOGGER.translate("INVALID_GEOMETRY_TYPE"));
	}
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:27,代码来源:TrackIdleProcessor.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: 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

示例7: 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

示例8: getDistanceBearingString

import com.esri.core.geometry.GeometryEngine; //导入依赖的package包/类
private String getDistanceBearingString(Point from, Point to) {
    double bearingDegrees = Utilities.calculateBearingDegrees(from, to);
    AngularUnit destUnit = Utilities.getAngularUnit(appConfigController.getHeadingUnits());
    AngularUnit degreesUnit = Utilities.getAngularUnit(AngularUnit.Code.DEGREE);
    long bearingInDestUnit = Math.round(bearingDegrees * degreesUnit.getConversionFactor(destUnit));
    
    long distance = Math.round(GeometryEngine.distance(
            GeometryEngine.project(from, Utilities.WGS84, mapController.getSpatialReference()),
            GeometryEngine.project(to, Utilities.WGS84, mapController.getSpatialReference()),
            mapController.getSpatialReference()));
    
    String ret = bearingInDestUnit + destUnit.getAbbreviation() + "\n\n"
            + distance + mapController.getSpatialReference().getUnit().getAbbreviation();
    return ret;
    
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:17,代码来源:MgrsLayerController.java

示例9: firstAndLastPoints

import com.esri.core.geometry.GeometryEngine; //导入依赖的package包/类
static StringBuffer firstAndLastPoints(String role, MultiPath multiPath) {
	StringBuffer sb = new StringBuffer();
	if (role != null) {
		sb.append("(")

		.append(role).append(")");
	}

	sb.append(" ")
			.append(multiPath.getPointCount())
			.append(" pts -> ")
			.append(GeometryEngine.geometryToJson(4623,
					multiPath.getPoint(multiPath.getPathStart(0))));
	sb.append(" - ").append(
			GeometryEngine.geometryToJson(4623,
					multiPath.getPoint(multiPath.getPathEnd(0) - 1)));
	return sb;
}
 
开发者ID:frett27,项目名称:osm-flink-tools,代码行数:19,代码来源:PolygonCreator.java

示例10: runAfterMapInitialized

import com.esri.core.geometry.GeometryEngine; //导入依赖的package包/类
private void runAfterMapInitialized(DbWebmap webmap) {
    ldm = mMapView.getLocationDisplayManager();
    ldm.start();
    
    identifyListener = new IdentifyListener(mMapView, userCredentials);
    mMapView.setOnSingleTapListener(identifyListener);
    
    mMapView.setOnStatusChangedListener(null);
    
    if (null != webmap && null != webmap.getInitExtent()) {
        mMapView.setExtent(GeometryEngine.project(
                webmap.getInitExtent(),
                SpatialReference.create(SpatialReference.WKID_WGS84),
                mMapView.getSpatialReference()));
    }
}
 
开发者ID:garys-esri,项目名称:offline-mapper-android,代码行数:17,代码来源:MapActivity.java

示例11: 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

示例12: toGeoJSON

import com.esri.core.geometry.GeometryEngine; //导入依赖的package包/类
/**
 * Gets {@link JSONObject} with GeoJSON format of {@link MatcherKState} matched geometries.
 *
 * @return {@link JSONObject} with GeoJSON format of {@link MatcherKState} matched geometries.
 * @throws JSONException thrown on JSON extraction or parsing error.
 */
public JSONObject toGeoJSON() throws JSONException {
    JSONObject json = new JSONObject();
    json.put("type", "MultiLineString");
    JSONArray jsonsequence = new JSONArray();
    if (this.sequence() != null) {
        for (MatcherCandidate candidate : this.sequence()) {
            if (candidate.transition() == null) {
                continue;
            }
            JSONObject jsoncandidate = new JSONObject(GeometryEngine
                    .geometryToGeoJson(candidate.transition().route().geometry()));
            jsonsequence.put(jsoncandidate.getJSONArray("coordinates"));
        }
    }
    json.put("coordinates", jsonsequence);
    return json;
}
 
开发者ID:bmwcarit,项目名称:barefoot,代码行数:24,代码来源:MatcherKState.java

示例13: toSlimJSON

import com.esri.core.geometry.GeometryEngine; //导入依赖的package包/类
/**
 * Gets {@link JSONArray} of {@link MatcherKState} with map matched positions, represented by
 * road id and fraction, and the geometry of the routes.
 *
 * @return {@link JSONArray} of {@link MatcherKState} with map matched positions, represented by
 *         road id and fraction, and the geometry of the routes.
 * @throws JSONException thrown on JSON extraction or parsing error.
 */
public JSONArray toSlimJSON() throws JSONException {
    JSONArray json = new JSONArray();
    if (this.sequence() != null) {
        for (MatcherCandidate candidate : this.sequence()) {
            JSONObject jsoncandidate = candidate.point().toJSON();
            if (candidate.transition() != null) {
                jsoncandidate.put("route",
                        GeometryEngine.geometryToWkt(candidate.transition().route().geometry(),
                                WktExportFlags.wktExportLineString));
            }
            json.put(jsoncandidate);
        }
    }
    return json;
}
 
开发者ID:bmwcarit,项目名称:barefoot,代码行数:24,代码来源:MatcherKState.java

示例14: testPolygon

import com.esri.core.geometry.GeometryEngine; //导入依赖的package包/类
@Test
public void testPolygon() throws IOException, JSONException {
    Properties properties = new Properties();
    properties.load(new FileInputStream("config/oberbayern.properties"));
    RoadReader reader = Loader.reader(properties);
    Polygon polygon = (Polygon) GeometryEngine.geometryFromWkt(
            "POLYGON ((11.40848 47.93157, 11.45109 47.93157,11.45109 47.89296,11.40848 47.89296,11.40848 47.93157))",
            WktImportFlags.wktImportDefaults, Type.Polygon);
    BaseRoad road = null;

    reader.open(polygon, null);
    int count = 0;

    while ((road = reader.next()) != null) {
        assertTrue(
                GeometryEngine.overlaps(polygon, road.geometry(), SpatialReference.create(4326))
                        || GeometryEngine.contains(polygon, road.geometry(),
                                SpatialReference.create(4326)));
        count += 1;
    }

    reader.close();
    assertTrue(count > 0);
}
 
开发者ID:bmwcarit,项目名称:barefoot,代码行数:25,代码来源:PostGISReaderTest.java

示例15: testExclusion

import com.esri.core.geometry.GeometryEngine; //导入依赖的package包/类
@Test
public void testExclusion() throws IOException, JSONException {
    Properties properties = new Properties();
    properties.load(new FileInputStream("config/oberbayern.properties"));
    RoadReader reader = Loader.reader(properties);
    Polygon polygon = (Polygon) GeometryEngine.geometryFromWkt(
            "POLYGON ((11.40848 47.93157, 11.45109 47.93157,11.45109 47.89296,11.40848 47.89296,11.40848 47.93157))",
            WktImportFlags.wktImportDefaults, Type.Polygon);
    HashSet<Short> exclusion = new HashSet<>(Arrays.asList((short) 117));
    BaseRoad road = null;

    reader.open(polygon, exclusion);
    int count = 0;

    while ((road = reader.next()) != null) {
        assertTrue(
                GeometryEngine.overlaps(polygon, road.geometry(), SpatialReference.create(4326))
                        || GeometryEngine.contains(polygon, road.geometry(),
                                SpatialReference.create(4326)));
        assertTrue(!exclusion.contains(road.type()));
        count += 1;
    }

    reader.close();
    assertTrue(count > 0);
}
 
开发者ID:bmwcarit,项目名称:barefoot,代码行数:27,代码来源:PostGISReaderTest.java


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