本文整理汇总了Java中com.esri.core.geometry.MultiPath类的典型用法代码示例。如果您正苦于以下问题:Java MultiPath类的具体用法?Java MultiPath怎么用?Java MultiPath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MultiPath类属于com.esri.core.geometry包,在下文中一共展示了MultiPath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pop
import com.esri.core.geometry.MultiPath; //导入依赖的package包/类
/**
* pop the first multipath in the collection, null if none
*/
public static MultiPathAndRole pop(List<MultiPathAndRole> l) {
if (l == null)
return null;
boolean finished = false;
MultiPathAndRole e = null;
while (!finished) {
if (l.size() == 0)
return null;
e = l.get(0);
l.remove(0);
MultiPath m = e.getMultiPath();
if (m != null && !m.isEmpty()) {
finished = true;
}
}
return e;
}
示例2: firstAndLastPoints
import com.esri.core.geometry.MultiPath; //导入依赖的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;
}
示例3: getEveryNthPointFromThisMultiPath
import com.esri.core.geometry.MultiPath; //导入依赖的package包/类
float[] getEveryNthPointFromThisMultiPath(MultiPath arcMultiPathParam, int everyNpoints) {
int arcPointCount = arcMultiPathParam.getPointCount();
Log.e("arcadiusDebug", "arcPointCount: " + arcPointCount);
ArrayList<Float> newSmallerArrayToReturn = new ArrayList<Float>();
for (int i = 0; i < arcMultiPathParam.getPointCount(); i += everyNpoints) {
newSmallerArrayToReturn.add((float) arcMultiPathParam.getPoint(i).getX());
newSmallerArrayToReturn.add((float) arcMultiPathParam.getPoint(i).getZ());
newSmallerArrayToReturn.add((float) arcMultiPathParam.getPoint(i).getY());
}
float[] simpleArray = new float[newSmallerArrayToReturn.size()];
for(int i = 0; i < newSmallerArrayToReturn.size(); i++) {
simpleArray[i] = newSmallerArrayToReturn.get(i).floatValue();
}
Log.e("arcadiusDebug", "Big array points: " + arcMultiPathParam.getPointCount());
Log.e("arcadiusDebug", "Small array points: " + simpleArray.length);
return simpleArray;
}
示例4: main
import com.esri.core.geometry.MultiPath; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
byte[] bytes = Files.readAllBytes(Paths.get(args[0]));
String text = new String(bytes, "US-ASCII");
Geometry g = OperatorImportFromWkt.local().execute(0, Geometry.Type.Unknown, text, null);
System.out.println(args[0] + " : " + g.getType() +
" " + ((MultiPath)g).getPathCount() + " rings" + " " + ((MultiPath)g).getPointCount() + " vertices");
System.out.print("Checking if simple... ");
boolean isSimple = OperatorSimplifyOGC.local().isSimpleOGC(g, null, true, null, null);
System.out.println(isSimple);
System.out.print("Running simplify operation... ");
Geometry gSimple = OperatorSimplifyOGC.local().execute(g, null, true, null);
System.out.println("Simple" + " : " + g.getType() +
" " + ((MultiPath)gSimple).getPathCount() + " rings" + " " + ((MultiPath)gSimple).getPointCount() + " vertices");
System.out.println("Done");
System.out.print("Running simplify operation (should be simple now)... ");
isSimple = OperatorSimplifyOGC.local().isSimpleOGC(gSimple, null, true, null, null);
System.out.println(isSimple);
}
示例5: create
import com.esri.core.geometry.MultiPath; //导入依赖的package包/类
/**
* convert the two arrays in one object list
*
* @param multiPath
* @param roles
* @return
*/
private static List<MultiPathAndRole> create(MultiPath[] multiPath,
Role[] roles) {
assert multiPath != null;
assert roles != null;
assert multiPath.length == roles.length;
List<MultiPathAndRole> pathLeft = new ArrayList<>();
for (int i = 0; i < multiPath.length; i++) {
pathLeft.add(new MultiPathAndRole(multiPath[i], roles[i]));
}
return pathLeft;
}
示例6: isClosed
import com.esri.core.geometry.MultiPath; //导入依赖的package包/类
public static boolean isClosed(MultiPath p) {
assert p != null;
int start = p.getPathStart(0);
int end = p.getPathEnd(0) - 1;
return areCoincident(p.getPoint(start), p.getPoint(end));
}
示例7: evaluate
import com.esri.core.geometry.MultiPath; //导入依赖的package包/类
public BooleanWritable evaluate(BytesWritable geomref) {
if (geomref == null || geomref.getLength() == 0) {
LogUtils.Log_ArgumentsNull(LOG);
return null;
}
OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geomref);
if (ogcGeometry == null){
LogUtils.Log_ArgumentsNull(LOG);
return null;
}
try {
switch(GeometryUtils.getType(geomref)) {
case ST_LINESTRING:
case ST_MULTILINESTRING:
MultiPath lines = (MultiPath)(ogcGeometry.getEsriGeometry());
int nPaths = lines.getPathCount();
boolean rslt = true;
for (int ix = 0; rslt && ix < nPaths; ix++) {
Point p0 = lines.getPoint(lines.getPathStart(ix));
Point pf = lines.getPoint(lines.getPathEnd(ix)-1);
rslt = rslt && pf.equals(p0); // no tolerance - OGC
}
resultBoolean.set(rslt);
return resultBoolean;
default: // ST_IsClosed gives ERROR on Point or Polygon, on Postgres/Oracle
LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_LINESTRING, GeometryUtils.getType(geomref));
return null;
}
} catch (Exception e) {
LogUtils.Log_InternalError(LOG, "ST_IsClosed" + e);
return null;
}
}
示例8: evaluate
import com.esri.core.geometry.MultiPath; //导入依赖的package包/类
public IntWritable evaluate(BytesWritable geomref) {
if (geomref == null || geomref.getLength() == 0) {
LogUtils.Log_ArgumentsNull(LOG);
return null;
}
OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geomref);
if (ogcGeometry == null){
LogUtils.Log_ArgumentsNull(LOG);
return null;
}
Geometry esriGeom = ogcGeometry.getEsriGeometry();
switch(esriGeom.getType()) {
case Point:
resultInt.set(esriGeom.isEmpty() ? 0 : 1);
break;
case MultiPoint:
resultInt.set(((MultiPoint)(esriGeom)).getPointCount());
break;
case Polygon:
Polygon polygon = (Polygon)(esriGeom);
resultInt.set(polygon.getPointCount() + polygon.getPathCount());
break;
default:
resultInt.set(((MultiPath)(esriGeom)).getPointCount());
break;
}
return resultInt;
}
示例9: evaluate
import com.esri.core.geometry.MultiPath; //导入依赖的package包/类
/**
* Return the last point of the ST_Linestring.
* @param geomref hive geometry bytes
* @return byte-reference of the last ST_Point
*/
public BytesWritable evaluate(BytesWritable geomref) {
if (geomref == null || geomref.getLength() == 0){
LogUtils.Log_ArgumentsNull(LOG);
return null;
}
OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geomref);
if (ogcGeometry == null){
LogUtils.Log_ArgumentsNull(LOG);
return null;
}
if (GeometryUtils.getType(geomref) == GeometryUtils.OGCType.ST_LINESTRING) {
MultiPath lines = (MultiPath)(ogcGeometry.getEsriGeometry());
int wkid = GeometryUtils.getWKID(geomref);
SpatialReference spatialReference = null;
if (wkid != GeometryUtils.WKID_UNKNOWN) {
spatialReference = SpatialReference.create(wkid);
}
return GeometryUtils.geometryToEsriShapeBytesWritable(OGCGeometry.createFromEsriGeometry(lines.getPoint(lines.getPointCount()-1),
spatialReference));
} else {
LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_LINESTRING, GeometryUtils.getType(geomref));
return null;
}
}
示例10: evaluate
import com.esri.core.geometry.MultiPath; //导入依赖的package包/类
/**
* Return the first point of the ST_Linestring.
* @param geomref hive geometry bytes
* @return byte-reference of the first ST_Point
*/
public BytesWritable evaluate(BytesWritable geomref) {
if (geomref == null || geomref.getLength() == 0){
LogUtils.Log_ArgumentsNull(LOG);
return null;
}
OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geomref);
if (ogcGeometry == null){
LogUtils.Log_ArgumentsNull(LOG);
return null;
}
if (GeometryUtils.getType(geomref) == GeometryUtils.OGCType.ST_LINESTRING) {
MultiPath lines = (MultiPath)(ogcGeometry.getEsriGeometry());
int wkid = GeometryUtils.getWKID(geomref);
SpatialReference spatialReference = null;
if (wkid != GeometryUtils.WKID_UNKNOWN) {
spatialReference = SpatialReference.create(wkid);
}
return GeometryUtils.geometryToEsriShapeBytesWritable(OGCGeometry.createFromEsriGeometry(lines.getPoint(0),
spatialReference));
} else {
LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_LINESTRING, GeometryUtils.getType(geomref));
return null;
}
}
示例11: isClosed
import com.esri.core.geometry.MultiPath; //导入依赖的package包/类
public boolean isClosed() {
MultiPath mp = (MultiPath) getEsriGeometry();
for (int i = 0, n = mp.getPathCount(); i < n; i++) {
if (!mp.isClosedPathInXYPlane(i))
return false;
}
return true;
}
示例12: OGCLineString
import com.esri.core.geometry.MultiPath; //导入依赖的package包/类
public OGCLineString(MultiPath mp, int pathIndex, SpatialReference sr,
boolean reversed) {
multiPath = new Polyline();
if (!mp.isEmpty())
multiPath.addPath(mp, pathIndex, !reversed);
esriSR = sr;
}
示例13: MultiPathAndRole
import com.esri.core.geometry.MultiPath; //导入依赖的package包/类
public MultiPathAndRole(MultiPath p, Role r) {
this.multiPath = p;
this.role = r;
}
示例14: getMultiPath
import com.esri.core.geometry.MultiPath; //导入依赖的package包/类
public MultiPath getMultiPath() {
return multiPath;
}
示例15: dump
import com.esri.core.geometry.MultiPath; //导入依赖的package包/类
public static void dump(MultiPath p) {
assert p != null;
String jsong = GeometryEngine.geometryToJson(4623, p);
System.out.println(jsong);
}