Codota Logo
MultiPath
Code IndexAdd Codota to your IDE (free)

How to use
MultiPath
in
com.esri.core.geometry

Best Java code snippets using com.esri.core.geometry.MultiPath (Showing top 20 results out of 315)

  • Common ways to obtain MultiPath
private void myMethod () {
MultiPath m =
  • Codota Iconnew Polyline()
  • Codota IconOGCGeometry oGCGeometry;(MultiPath) oGCGeometry.getEsriGeometry()
  • Smart code suggestions by Codota
}
origin: prestodb/presto

@SqlNullable
@Description("Returns TRUE if the LineString or Multi-LineString's start and end points are coincident")
@ScalarFunction("ST_IsClosed")
@SqlType(BOOLEAN)
public static Boolean stIsClosed(@SqlType(GEOMETRY_TYPE_NAME) Slice input)
{
  OGCGeometry geometry = deserialize(input);
  validateType("ST_IsClosed", geometry, EnumSet.of(LINE_STRING, MULTI_LINE_STRING));
  MultiPath lines = (MultiPath) geometry.getEsriGeometry();
  int pathCount = lines.getPathCount();
  for (int i = 0; i < pathCount; i++) {
    Point start = lines.getPoint(lines.getPathStart(i));
    Point end = lines.getPoint(lines.getPathEnd(i) - 1);
    if (!end.equals(start)) {
      return false;
    }
  }
  return true;
}
origin: prestodb/presto

@SqlNullable
@Description("Returns the last point of a LINESTRING geometry as a Point")
@ScalarFunction("ST_EndPoint")
@SqlType(GEOMETRY_TYPE_NAME)
public static Slice stEndPoint(@SqlType(GEOMETRY_TYPE_NAME) Slice input)
{
  OGCGeometry geometry = deserialize(input);
  validateType("ST_EndPoint", geometry, EnumSet.of(LINE_STRING));
  if (geometry.isEmpty()) {
    return null;
  }
  MultiPath lines = (MultiPath) geometry.getEsriGeometry();
  SpatialReference reference = geometry.getEsriSpatialReference();
  return serialize(createFromEsriGeometry(lines.getPoint(lines.getPointCount() - 1), reference));
}
origin: prestodb/presto

multipath.startPath(point.X(), point.Y());
      format("Invalid input to ST_LineString: consecutive duplicate points at index %s", i + 1));
multipath.lineTo(point.X(), point.Y());
origin: Esri/geometry-api-java

private static boolean multiPathExactlyEqualsMultiPath_(
    MultiPath multipathA, MultiPath multipathB, double tolerance,
    ProgressTracker progress_tracker) {
  if (multipathA.getPathCount() != multipathB.getPathCount()
      || multipathA.getPointCount() != multipathB.getPointCount())
    return false;
  Point2D ptA = new Point2D(), ptB = new Point2D();
  boolean bAllPointsEqual = true;
  double tolerance_sq = tolerance * tolerance;
  for (int ipath = 0; ipath < multipathA.getPathCount(); ipath++) {
    if (multipathA.getPathEnd(ipath) != multipathB.getPathEnd(ipath)) {
      bAllPointsEqual = false;
      break;
    }
    for (int i = multipathA.getPathStart(ipath); i < multipathB
        .getPathEnd(ipath); i++) {
      multipathA.getXY(i, ptA);
      multipathB.getXY(i, ptB);
      if (Point2D.sqrDistance(ptA, ptB) > tolerance_sq) {
        bAllPointsEqual = false;
        break;
      }
    }
    if (!bAllPointsEqual)
      break;
  }
  if (!bAllPointsEqual)
    return false;
  return true;
}
origin: Esri/geometry-api-java

private static void exportPolypathToJson(MultiPath pp, String name, SpatialReference spatialReference, JsonWriter jsonWriter, Map<String, Object> exportProperties) {
  boolean bExportZs = pp.hasAttribute(Semantics.Z);
  boolean bExportMs = pp.hasAttribute(Semantics.M);
  if (!pp.isEmpty()) {
    int n = pp.getPathCount(); // rings or paths
    MultiPathImpl mpImpl = (MultiPathImpl) pp._getImpl();// get impl for
      int startindex = pp.getPathStart(i);
      int numVertices = pp.getPathSize(i);
      double startx = 0.0, starty = 0.0, startz = NumberUtils.NaN(), startm = NumberUtils.NaN();
      double z = NumberUtils.NaN(), m = NumberUtils.NaN();
      boolean bClosed = pp.isClosedPath(i);
      for (int j = startindex; j < startindex + numVertices; j++) {
        pp.getXY(j, pt);
        pp.getXY(startindex, pt);
origin: Esri/geometry-api-java

MultiPathImpl multi_path_impl_b = (MultiPathImpl)multi_path_b._getImpl();
  for (int ipath = 0, npath = multi_path_b.getPathCount(); ipath < npath; ipath++)
    if (multi_path_b.getPathSize(ipath) > 0)
      multi_path_b.queryPathEnvelope2D(ipath, path_env_b);
        Point2D anyPoint = multi_path_b.getXY(multi_path_b.getPathStart(ipath));
        int res = PointInPolygonHelper.isPointInPolygon(p_polygon_a, anyPoint, 0);
        if (res == 0)
        if (PointInPolygonHelper.quadTreeWillHelp(polygon_a, multi_path_b.getPathCount() - 1) && (polygon_impl_a._getAccelerators() == null || polygon_impl_a._getAccelerators().getQuadTree() == null)) {
          pa = new Polygon();
          polygon_a.copyTo(pa);
  if (polygon_a.getPathCount() == 1 || multi_path_b.getType().value() == Geometry.GeometryType.Polyline)
    return true; //boundaries do not intersect. all paths of b are inside of a
origin: Esri/geometry-api-java

private Geometry densifyMultiPath(MultiPath geom) {
  MultiPath densifiedPoly = (MultiPath) geom.createInstance();
  SegmentIterator iter = geom.querySegmentIterator();
  while (iter.nextPath()) {
    boolean bStartNewPath = true;
        double dcount = Math.ceil(len / m_maxLength);
        Point point = new Point(geom.getDescription());// LOCALREFCLASS1(Point,
          bStartNewPath = false;
          seg.queryStart(point);
          densifiedPoly.startPath(point);
        for (int i = 0, n = (int) dcount - 1; i < n; i++) {
          seg.queryCoord(t, point);
          densifiedPoly.lineTo(point);
          t += dt;
          densifiedPoly.lineTo(point);
        } else {
          densifiedPoly.closePathWithLine();
      } else {
        if (!bIsClosing)
          densifiedPoly.addSegment(seg, bStartNewPath);
        else
          densifiedPoly.closePathWithLine();
origin: aseldawy/spatialhadoop2

double sub_geom_alpha = path.calculateLength2D() * scale;
int color_alpha = sub_geom_alpha > 1.0 ? 255 : (int) Math.round(sub_geom_alpha * 255);
 return;
int[] xpoints = new int[path.getPointCount()];
int[] ypoints = new int[path.getPointCount()];
for (int i = 0; i < path.getPointCount(); i++) {
 double px = path.getPoint(i).getX();
 double py = path.getPoint(i).getY();
 g.drawPolygon(xpoints, ypoints, path.getPointCount());
else if (path instanceof Polyline)
 g.drawPolyline(xpoints, ypoints, path.getPointCount());
origin: Esri/geometry-api-java

/**
 * Returns the specified Point N in this LineString.
 * @param n The 0 based index of the Point.
 */
public OGCPoint pointN(int n) {
  int nn;
  if (multiPath.isClosedPath(0) && n == multiPath.getPathSize(0)) {
    nn = multiPath.getPathStart(0);
  } else
    nn = n + multiPath.getPathStart(0);
  return (OGCPoint) OGCGeometry.createFromEsriGeometry(
      multiPath.getPoint(nn), esriSR);
}
origin: Esri/geometry-api-java

MultiPathImpl multi_path_impl_b = (MultiPathImpl)multipath_b._getImpl();
Polygon p_polygon_b = null;
if (multipath_b.getType().value() == Geometry.GeometryType.Polygon)
  p_polygon_b = (Polygon)multipath_b;
  int path_b = intersector.getBlueElement();
  pt_b = multipath_b.getXY(multipath_b.getPathStart(path_b));
  env_a_inf.setCoords(intersector.getRedEnvelope());
  env_a_inf.inflate(tolerance, tolerance);
  if (multipath_b.getType().value() == Geometry.GeometryType.Polygon)
    if (PointInPolygonHelper.quadTreeWillHelp(polygon_a, multipath_b.getPathCount() - 1) && (multi_path_impl_a._getAccelerators() == null || multi_path_impl_a._getAccelerators().getQuadTree() == null)) {
      pa = new Polygon();
      polygon_a.copyTo(pa);
  if (multipath_b.getType().value() == Geometry.GeometryType.Polygon)
origin: Esri/geometry-api-java

  @Override
  public OGCPoint pointN(int n) {
    int nn;
    if (n == multiPath.getPathSize(0)) {
      nn = multiPath.getPathStart(0);
    } else
      nn = multiPath.getPathStart(0) + n;

    return (OGCPoint) OGCGeometry.createFromEsriGeometry(
        multiPath.getPoint(nn), esriSR);
  }
}
origin: com.esri.geometry/esri-geometry-api

void _OffsetPath(MultiPath multiPath, int pathIndex, MultiPath resultingPath) {
  int startVertex = multiPath.getPathStart(pathIndex);
  int endVertex = multiPath.getPathEnd(pathIndex);
  if (multiPath.isClosedPath(pathIndex)) {
    Point2D ptStart = multiPath.getXY(startVertex);
    while (multiPath.getXY(endVertex - 1).isEqual(ptStart))
      endVertex--;
        m_srcPts.add(new GraphicPoint(multiPath.getXY(i)));
    Point2D ptStart = multiPath.getXY(startVertex);
    while ((startVertex < endVertex)
        && multiPath.getXY(startVertex + 1).isEqual(ptStart))
      startVertex++;
    Point2D ptEnd = multiPath.getXY(endVertex - 1);
    while ((startVertex < endVertex)
        && multiPath.getXY(endVertex - 2).isEqual(ptEnd))
      endVertex--;
      GraphicPoint pt = new GraphicPoint(multiPath.getXY(startVertex));
      pt.type |= IS_END + CLOSING_SEG;
      m_srcPts.add(pt);
        pt = new GraphicPoint(multiPath.getXY(i));
        m_srcPts.add(pt);
      pt = new GraphicPoint(multiPath.getXY(endVertex - 1));
      pt.type |= IS_END;
origin: Esri/geometry-api-java

int addPathFromMultiPath(MultiPath multi_path, int ipath, boolean as_polygon) {
  int newgeom = createGeometry(as_polygon ? Geometry.Type.Polygon
      : Geometry.Type.Polyline, multi_path.getDescription());
  MultiPathImpl mp_impl = (MultiPathImpl) multi_path._getImpl();
  if (multi_path.getPathSize(ipath) < 2)
    return newgeom; //return empty geometry
  m_vertices_mp.add(multi_path, multi_path.getPathStart(ipath),
      mp_impl.getPathEnd(ipath));
  m_xy_stream = (AttributeStreamOfDbl) m_vertices
origin: Esri/geometry-api-java

void shiftPath(MultiPath inputGeom, int iPath, double shift) {
  MultiVertexGeometryImpl vertexGeometryImpl = (MultiVertexGeometryImpl) inputGeom
      ._getImpl();
  AttributeStreamOfDbl xyStream = (AttributeStreamOfDbl) vertexGeometryImpl
      .getAttributeStreamRef(VertexDescription.Semantics.POSITION);
  int i1 = inputGeom.getPathStart(iPath);
  int i2 = inputGeom.getPathEnd(iPath);
  Point2D pt = new Point2D();
  while (i1 < i2) {
    xyStream.read(i1, pt);
    pt.x += shift;
    xyStream.write(i1, pt);
    i1++;
  }
}
origin: prestodb/presto

@SqlNullable
@Description("Returns the first point of a LINESTRING geometry as a Point")
@ScalarFunction("ST_StartPoint")
@SqlType(GEOMETRY_TYPE_NAME)
public static Slice stStartPoint(@SqlType(GEOMETRY_TYPE_NAME) Slice input)
{
  OGCGeometry geometry = deserialize(input);
  validateType("ST_StartPoint", geometry, EnumSet.of(LINE_STRING));
  if (geometry.isEmpty()) {
    return null;
  }
  MultiPath lines = (MultiPath) geometry.getEsriGeometry();
  SpatialReference reference = geometry.getEsriSpatialReference();
  return serialize(createFromEsriGeometry(lines.getPoint(0), reference));
}
origin: Esri/geometry-api-java

/**
 * The number of Points in this LineString.
 */
public int numPoints() {
  if (multiPath.isEmpty())
    return 0;
  int d = multiPath.isClosedPath(0) ? 1 : 0;
  return multiPath.getPointCount() + d;
}
origin: Esri/spatial-framework-for-hadoop

  break;
default:
  resultInt.set(((MultiPath)(esriGeom)).getPointCount());
  break;
origin: Esri/geometry-api-java

public int numPoints() {
  if (multiPath.isEmpty())
    return 0;
  return multiPath.getPointCount() + 1;
}
origin: Esri/geometry-api-java

public int numGeometries() {
  MultiPath mp = (MultiPath) getEsriGeometry();
  return mp.getPathCount();
}
origin: Esri/geometry-api-java

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;
}
com.esri.core.geometryMultiPath

Javadoc

The MulitPath class is a base class for polygons and polylines.

Most used methods

  • getPoint
  • getPointCount
  • getPathCount
    Returns the number of paths in this multipath.
  • getPathEnd
    Returns the index immediately following the last index of the path.
  • getPathStart
    Returns the start index of the path.
  • lineTo
    Adds a Line Segment to the given end point.
  • startPath
    Starts a new path at a point.
  • addSegment
    Adds a new segment to this multipath.
  • calculateLength2D
  • _getImpl
  • add
    Appends all paths from another multipath.
  • addPath
    Adds a new path to this multipath.
  • add,
  • addPath,
  • closePathWithLine,
  • createInstance,
  • estimateMemorySize,
  • getBoundary,
  • getDescription,
  • getPathSize,
  • getPointByVal,
  • getSegmentCount

Popular in Java

  • Running tasks concurrently on multiple threads
  • runOnUiThread (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getExternalFilesDir (Context)
  • String (java.lang)
  • BigInteger (java.math)
    Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now