本文整理汇总了Java中com.esri.core.geometry.GeometryEngine.jsonToGeometry方法的典型用法代码示例。如果您正苦于以下问题:Java GeometryEngine.jsonToGeometry方法的具体用法?Java GeometryEngine.jsonToGeometry怎么用?Java GeometryEngine.jsonToGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.esri.core.geometry.GeometryEngine
的用法示例。
在下文中一共展示了GeometryEngine.jsonToGeometry方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: ConstructJsonMaskFromGeoEvent
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的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);
}
示例3: loadElements
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
public ArrayList<MultiPathAndRole> loadElements(int i) throws Exception {
File f = new File(storefolder, "test_file_" + i);
FileReader fr = new FileReader(f);
try {
JSONObject jo = new JSONObject(new JSONTokener(fr));
JSONArray origin = jo.getJSONArray("origin");
ArrayList<MultiPathAndRole> m = new ArrayList<MultiPathAndRole>(origin.length());
for (int j = 0; j < origin.length(); j++) {
JSONObject r = origin.getJSONObject(j);
MapGeometry geometry = GeometryEngine.jsonToGeometry(r.getJSONObject("geometry").toString());
m.add(new MultiPathAndRole((MultiPath) geometry.getGeometry(), Role.valueOf(r.getString("role"))));
}
return m;
} finally {
fr.close();
}
}
示例4: parseGeom
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Override
protected OGCGeometry parseGeom(JsonParser parser) {
MapGeometry mapGeom = GeometryEngine.jsonToGeometry(parser);
return OGCGeometry.createFromEsriGeometry(mapGeom.getGeometry(), mapGeom.getSpatialReference());
}