Ejemplo n.º 1
0
 internal OperatorBoundaryLocalCursor(com.epl.geometry.GeometryCursor inputGeoms, com.epl.geometry.ProgressTracker tracker)
 {
     m_inputGeometryCursor = inputGeoms;
     m_progress_tracker    = tracker;
     m_b_done = false;
     m_index  = -1;
 }
 /// <summary>Checks the tracker and throws UserCancelException if tracker is not null and progress returns false</summary>
 /// <param name="tracker">can be null, then the method does nothing.</param>
 public static void CheckAndThrow(com.epl.geometry.ProgressTracker tracker)
 {
     if (tracker != null && !tracker.Progress(-1, -1))
     {
         throw new com.epl.geometry.UserCancelException();
     }
 }
 public OperatorGeneralizeCursor(com.epl.geometry.GeometryCursor geoms, double maxDeviation, bool bRemoveDegenerateParts, com.epl.geometry.ProgressTracker progressTracker)
 {
     m_geoms                  = geoms;
     m_maxDeviation           = maxDeviation;
     m_progressTracker        = progressTracker;
     m_bRemoveDegenerateParts = bRemoveDegenerateParts;
 }
 internal OperatorUnionCursor(com.epl.geometry.GeometryCursor inputGeoms1, com.epl.geometry.SpatialReference sr, com.epl.geometry.ProgressTracker progress_tracker)
 {
     //for each dimension there is a list of bins sorted by level
     m_inputGeoms        = inputGeoms1;
     m_spatial_reference = (com.epl.geometry.SpatialReferenceImpl)(sr);
     m_progress_tracker  = progress_tracker;
 }
Ejemplo n.º 5
0
 internal Cracker(com.epl.geometry.ProgressTracker progress_tracker)
 {
     // void dbg_print_sweep_edge_(int edge);
     // void dbg_print_sweep_structure_();
     // void dbg_check_sweep_structure_();
     m_progress_tracker = progress_tracker;
     m_bAllowCoincident = true;
 }
Ejemplo n.º 6
0
 internal OperatorDifferenceCursor(com.epl.geometry.GeometryCursor inputGeoms, com.epl.geometry.GeometryCursor geomSubtractor, com.epl.geometry.SpatialReference sr, com.epl.geometry.ProgressTracker progress_tracker)
 {
     m_bEmpty            = (geomSubtractor == null);
     m_index             = -1;
     m_inputGeoms        = inputGeoms;
     m_Spatial_reference = sr;
     m_geomSubtractor    = geomSubtractor.Next();
     m_progress_tracker  = progress_tracker;
 }
Ejemplo n.º 7
0
 internal DistanceCalculator(OperatorDistanceLocal _enclosing, com.epl.geometry.ProgressTracker progressTracker)
 {
     this._enclosing        = _enclosing;
     this.m_progressTracker = progressTracker;
     this.m_env2DgeometryA  = new com.epl.geometry.Envelope2D();
     this.m_env2DgeometryA.SetEmpty();
     this.m_env2DgeometryB = new com.epl.geometry.Envelope2D();
     this.m_env2DgeometryB.SetEmpty();
 }
 internal OperatorSymmetricDifferenceCursor(com.epl.geometry.GeometryCursor inputGeoms, com.epl.geometry.GeometryCursor rightGeom, com.epl.geometry.SpatialReference sr, com.epl.geometry.ProgressTracker progress_tracker)
 {
     m_bEmpty            = rightGeom == null;
     m_index             = -1;
     m_inputGeoms        = inputGeoms;
     m_spatial_reference = sr;
     m_rightGeom         = rightGeom.Next();
     m_progress_tracker  = progress_tracker;
 }
 internal OperatorOffsetCursor(com.epl.geometry.GeometryCursor inputGeometries, com.epl.geometry.SpatialReference sr, double distance, com.epl.geometry.OperatorOffset.JoinType joins, double bevelRatio, double flattenError, com.epl.geometry.ProgressTracker progressTracker)
 {
     m_index            = -1;
     m_inputGeoms       = inputGeometries;
     m_spatialReference = (com.epl.geometry.SpatialReferenceImpl)sr;
     m_distance         = distance;
     m_joins            = joins;
     m_miterLimit       = bevelRatio;
     m_flattenError     = flattenError;
     m_progressTracker  = progressTracker;
 }
 internal OperatorConvexHullCursor(bool b_merge, com.epl.geometry.GeometryCursor geoms, com.epl.geometry.ProgressTracker progress_tracker)
 {
     m_index = -1;
     if (geoms == null)
     {
         throw new System.ArgumentException();
     }
     m_b_merge             = b_merge;
     m_b_done              = false;
     m_inputGeometryCursor = geoms;
     m_progress_tracker    = progress_tracker;
 }
Ejemplo n.º 11
0
 internal OperatorSimplifyCursorOGC(com.epl.geometry.GeometryCursor geoms, com.epl.geometry.SpatialReference spatialRef, bool bForceSimplify, com.epl.geometry.ProgressTracker progressTracker)
 {
     m_progressTracker = progressTracker;
     m_bForceSimplify  = bForceSimplify;
     m_index           = -1;
     if (geoms == null)
     {
         throw new System.ArgumentException();
     }
     m_inputGeometryCursor = geoms;
     m_spatialReference    = spatialRef;
 }
Ejemplo n.º 12
0
 internal static bool HasNonEmptyBoundary(com.epl.geometry.Geometry geom, com.epl.geometry.ProgressTracker progress_tracker)
 {
     if (geom.IsEmpty())
     {
         return(false);
     }
     com.epl.geometry.Geometry.Type gt = geom.GetType();
     if (gt == com.epl.geometry.Geometry.Type.Polygon)
     {
         if (geom.CalculateArea2D() == 0)
         {
             return(false);
         }
         return(true);
     }
     else
     {
         if (gt == com.epl.geometry.Geometry.Type.Polyline)
         {
             bool[] b = new bool[1];
             b[0] = false;
             CalculatePolylineBoundary_(geom._getImpl(), progress_tracker, true, b);
             return(b[0]);
         }
         else
         {
             if (gt == com.epl.geometry.Geometry.Type.Envelope)
             {
                 return(true);
             }
             else
             {
                 if (com.epl.geometry.Geometry.IsSegment(gt.Value()))
                 {
                     if (!((com.epl.geometry.Segment)geom).IsClosed())
                     {
                         return(true);
                     }
                     return(false);
                 }
                 else
                 {
                     if (com.epl.geometry.Geometry.IsPoint(gt.Value()))
                     {
                         return(false);
                     }
                 }
             }
         }
     }
     return(false);
 }
Ejemplo n.º 13
0
 internal OperatorBufferCursor(com.epl.geometry.GeometryCursor inputGeoms, com.epl.geometry.SpatialReference sr, double[] distances, double max_deviation, int max_vertices, bool b_union, com.epl.geometry.ProgressTracker progress_tracker)
 {
     m_index         = -1;
     m_inputGeoms    = inputGeoms;
     m_max_deviation = max_deviation;
     m_max_vertices_in_full_circle = max_vertices;
     m_Spatial_reference           = (com.epl.geometry.SpatialReferenceImpl)(sr);
     m_distances = distances;
     m_currentUnionEnvelope2D = new com.epl.geometry.Envelope2D();
     m_currentUnionEnvelope2D.SetEmpty();
     m_dindex           = -1;
     m_progress_tracker = progress_tracker;
 }
Ejemplo n.º 14
0
 internal OperatorCutCursor(bool bConsiderTouch, com.epl.geometry.Geometry cuttee, com.epl.geometry.Polyline cutter, com.epl.geometry.SpatialReference spatialReference, com.epl.geometry.ProgressTracker progressTracker)
 {
     if (cuttee == null || cutter == null)
     {
         throw new com.epl.geometry.GeometryException("invalid argument");
     }
     m_bConsiderTouch = bConsiderTouch;
     m_cuttee         = cuttee;
     m_cutter         = cutter;
     com.epl.geometry.Envelope2D e = com.epl.geometry.InternalUtils.GetMergedExtent(cuttee, cutter);
     m_tolerance       = com.epl.geometry.InternalUtils.CalculateToleranceFromGeometry(spatialReference, e, true);
     m_cutIndex        = -1;
     m_progressTracker = progressTracker;
 }
Ejemplo n.º 15
0
		internal OperatorIntersectionCursor(com.epl.geometry.GeometryCursor inputGeoms, com.epl.geometry.GeometryCursor geomIntersector, com.epl.geometry.SpatialReference sr, com.epl.geometry.ProgressTracker progress_tracker, int dimensionMask)
		{
			// holds empty geometry of intersector
			// type.
			m_bEmpty = geomIntersector == null;
			m_index = -1;
			m_inputGeoms = inputGeoms;
			m_spatial_reference = sr;
			m_geomIntersector = geomIntersector.Next();
			m_geomIntersectorType = m_geomIntersector.GetType().Value();
			m_currentGeomType = com.epl.geometry.Geometry.Type.Unknown.Value();
			m_progress_tracker = progress_tracker;
			m_dimensionMask = dimensionMask;
			if (m_dimensionMask != -1 && (m_dimensionMask <= 0 || m_dimensionMask > 7))
			{
				throw new System.ArgumentException("bad dimension mask");
			}
		}
Ejemplo n.º 16
0
 /// <summary>Performs the Relation operation between two geometries using the DE-9IM matrix encoded as a string.</summary>
 /// <param name="inputGeom1">The first geometry in the relation.</param>
 /// <param name="inputGeom2">The second geometry in the relation.</param>
 /// <param name="sr">The spatial reference of the geometries.</param>
 /// <param name="de_9im_string">The DE-9IM matrix relation encoded as a string.</param>
 /// <returns>Returns True if the relation holds, False otherwise.</returns>
 public abstract bool Execute(com.epl.geometry.Geometry inputGeom1, com.epl.geometry.Geometry inputGeom2, com.epl.geometry.SpatialReference sr, string de_9im_string, com.epl.geometry.ProgressTracker progressTracker);
Ejemplo n.º 17
0
 public override bool Execute(com.epl.geometry.Geometry inputGeom1, com.epl.geometry.Geometry inputGeom2, com.epl.geometry.SpatialReference sr, com.epl.geometry.ProgressTracker progressTracker)
 {
     return(com.epl.geometry.RelationalOperations.Relate(inputGeom1, inputGeom2, sr, com.epl.geometry.RelationalOperations.Relation.touches, progressTracker));
 }
 public override com.epl.geometry.Geometry Execute(com.epl.geometry.Geometry geom, double maxSegmentLengthMeters, com.epl.geometry.SpatialReference sr, int curveType, com.epl.geometry.ProgressTracker progressTracker)
 {
     throw new com.epl.geometry.GeometryException("not implemented");
 }
 public override com.epl.geometry.Geometry Execute(com.epl.geometry.Geometry geom, com.epl.geometry.SpatialReference sr, double maxLengthMeters, double maxDeviationMeters, double reserved, com.epl.geometry.ProgressTracker progressTracker)
 {
     throw new com.epl.geometry.GeometryException("not implemented");
 }
Ejemplo n.º 20
0
 public override bool Execute(com.epl.geometry.Geometry inputGeom1, com.epl.geometry.Geometry inputGeom2, com.epl.geometry.SpatialReference sr, com.epl.geometry.ProgressTracker progressTracker)
 {
     return(!m_disjoint.Execute(inputGeom1, inputGeom2, sr, progressTracker));
 }
Ejemplo n.º 21
0
        /// <summary>Returns true if the given path of the input MultiPath is convex.</summary>
        /// <remarks>
        /// Returns true if the given path of the input MultiPath is convex. Returns false otherwise.
        /// \param multi_path The MultiPath to check if the path is convex.
        /// \param path_index The path of the MultiPath to check if its convex.
        /// </remarks>
        internal static bool IsPathConvex(com.epl.geometry.MultiPath multi_path, int path_index, com.epl.geometry.ProgressTracker progress_tracker)
        {
            com.epl.geometry.MultiPathImpl mimpl = (com.epl.geometry.MultiPathImpl)multi_path._getImpl();
            int  path_start = mimpl.GetPathStart(path_index);
            int  path_end   = mimpl.GetPathEnd(path_index);
            bool bxyclosed  = !mimpl.IsClosedPath(path_index) && mimpl.IsClosedPathInXYPlane(path_index);

            com.epl.geometry.AttributeStreamOfDbl position = (com.epl.geometry.AttributeStreamOfDbl)(mimpl.GetAttributeStreamRef(com.epl.geometry.VertexDescription.Semantics.POSITION));
            int position_start = 2 * path_start;
            int position_end   = 2 * path_end;

            if (bxyclosed)
            {
                position_end -= 2;
            }
            if (position_end - position_start < 6)
            {
                return(true);
            }
            // This matches the logic for case 1 of the tree hull algorithm. The idea is inductive. We assume we have a convex hull pt_0,...,pt_m, and we see if
            // a new point (pt_pivot) is among the transitive tournament for pt_0, knowing that pt_pivot comes after pt_m.
            // We check three conditions:
            // 1) pt_m->pt_pivot->pt_0 is clockwise (closure across the boundary is convex)
            // 2) pt_1->pt_pivot->pt_0 is clockwise (the first step forward is convex)  (pt_1 is the next point after pt_0)
            // 3) pt_m->pt_pivot->pt_m_prev is clockwise (the first step backwards is convex)  (pt_m_prev is the previous point before pt_m)
            // If all three of the above conditions are clockwise, then pt_pivot is among the transitive tournament for pt_0, and therefore the polygon pt_0, ..., pt_m, pt_pivot is convex.
            com.epl.geometry.Point2D pt_0     = new com.epl.geometry.Point2D();
            com.epl.geometry.Point2D pt_m     = new com.epl.geometry.Point2D();
            com.epl.geometry.Point2D pt_pivot = new com.epl.geometry.Point2D();
            position.Read(position_start, pt_0);
            position.Read(position_start + 2, pt_m);
            position.Read(position_start + 4, pt_pivot);
            // Initial inductive step
            com.epl.geometry.ECoordinate det_ec = Determinant_(pt_m, pt_pivot, pt_0);
            if (det_ec.IsFuzzyZero() || !IsClockwise_(det_ec.Value()))
            {
                return(false);
            }
            com.epl.geometry.Point2D pt_1      = new com.epl.geometry.Point2D(pt_m.x, pt_m.y);
            com.epl.geometry.Point2D pt_m_prev = new com.epl.geometry.Point2D();
            // Assume that pt_0,...,pt_m is convex. Check if the next point, pt_pivot, maintains the convex invariant.
            for (int i = position_start + 6; i < position_end; i += 2)
            {
                pt_m_prev.SetCoords(pt_m);
                pt_m.SetCoords(pt_pivot);
                position.Read(i, pt_pivot);
                det_ec = Determinant_(pt_m, pt_pivot, pt_0);
                if (det_ec.IsFuzzyZero() || !IsClockwise_(det_ec.Value()))
                {
                    return(false);
                }
                det_ec = Determinant_(pt_1, pt_pivot, pt_0);
                if (det_ec.IsFuzzyZero() || !IsClockwise_(det_ec.Value()))
                {
                    return(false);
                }
                det_ec = Determinant_(pt_m, pt_pivot, pt_m_prev);
                if (det_ec.IsFuzzyZero() || !IsClockwise_(det_ec.Value()))
                {
                    return(false);
                }
            }
            return(true);
        }
 /// <summary>Calculates the geodetic area of the input Geometry.</summary>
 /// <param name="geom">The input Geometry for the geodetic area calculation.</param>
 /// <param name="sr">The SpatialReference of the Geometry.</param>
 /// <param name="geodeticCurveType">
 /// Use the
 /// <see cref="GeodeticCurveType"/>
 /// interface to choose the
 /// interpretation of a line connecting two points.
 /// </param>
 /// <param name="progressTracker"/>
 /// <returns>Returns the geodetic area of the Geometry.</returns>
 public abstract double Execute(com.epl.geometry.Geometry geom, com.epl.geometry.SpatialReference sr, int geodeticCurveType, com.epl.geometry.ProgressTracker progressTracker);
 // Reviewed vs. Feb 8 2011
 public override com.epl.geometry.Geometry Execute(com.epl.geometry.Geometry geom, com.epl.geometry.SpatialReference spatialRef, bool bForceSimplify, com.epl.geometry.ProgressTracker progressTracker)
 {
     com.epl.geometry.SimpleGeometryCursor inputCursor  = new com.epl.geometry.SimpleGeometryCursor(geom);
     com.epl.geometry.GeometryCursor       outputCursor = Execute(inputCursor, spatialRef, bForceSimplify, progressTracker);
     return(outputCursor.Next());
 }
        // Reviewed vs. Feb 8 2011
        public override bool IsSimpleAsFeature(com.epl.geometry.Geometry geom, com.epl.geometry.SpatialReference spatialRef, bool bForceTest, com.epl.geometry.NonSimpleResult result, com.epl.geometry.ProgressTracker progressTracker)
        {
            int res = com.epl.geometry.OperatorSimplifyLocalHelper.IsSimpleAsFeature(geom, spatialRef, bForceTest, result, progressTracker);

            return(res > 0);
        }
 // Reviewed vs. Feb 8 2011
 public override com.epl.geometry.GeometryCursor Execute(com.epl.geometry.GeometryCursor geoms, com.epl.geometry.SpatialReference spatialRef, bool bForceSimplify, com.epl.geometry.ProgressTracker progressTracker)
 {
     return(new com.epl.geometry.OperatorSimplifyCursor(geoms, spatialRef, bForceSimplify, progressTracker));
 }
Ejemplo n.º 26
0
 /// <summary>Performs the Cut operation on a geometry.</summary>
 /// <param name="bConsiderTouch">
 /// Indicates whether we consider a touch event a cut.
 /// This only applies to polylines, but it's recommended to set this variable to True.
 /// </param>
 /// <param name="cuttee">The input geometry to be cut.</param>
 /// <param name="cutter">
 /// The polyline that will be used to divide the cuttee into
 /// pieces where it crosses the cutter.
 /// </param>
 /// <returns>
 /// Returns a GeometryCursor of cut geometries.
 /// All left cuts will be grouped together in the first geometry. Right cuts and
 /// coincident cuts are grouped in the second geometry, and each undefined cut along
 /// with any uncut parts are output as separate geometries. If there were no cuts
 /// the cursor will return no geometry. If the left or right cut does not
 /// exist, the returned geometry will be empty for this type of cut. An
 /// undefined cut will only be produced if a left cut or right cut was
 /// produced and there was a part left over after cutting or a cut is
 /// bounded to the left and right of the cutter.
 /// </returns>
 public abstract com.epl.geometry.GeometryCursor Execute(bool bConsiderTouch, com.epl.geometry.Geometry cuttee, com.epl.geometry.Polyline cutter, com.epl.geometry.SpatialReference spatialReference, com.epl.geometry.ProgressTracker progressTracker);
 /// <summary>Performs the Symmetric Difference operation on the geometry set.</summary>
 /// <param name="inputGeometries">is the set of Geometry instances to be XOR'd by rightGeometry.</param>
 /// <param name="rightGeometry">is the Geometry being XOR'd with the inputGeometies.</param>
 /// <returns>
 /// Returns the result of the symmetric difference.
 /// The operator XOR's every geometry in inputGeometries with rightGeometry.
 /// </returns>
 public abstract com.epl.geometry.GeometryCursor Execute(com.epl.geometry.GeometryCursor inputGeometries, com.epl.geometry.GeometryCursor rightGeometry, com.epl.geometry.SpatialReference sr, com.epl.geometry.ProgressTracker progressTracker);
Ejemplo n.º 28
0
 /// <summary>Creates a buffer around the input geometries</summary>
 /// <param name="input_geometries">The geometries to buffer.</param>
 /// <param name="sr">The Spatial_reference of the Geometries. It is used to obtain the tolerance. Can be null.</param>
 /// <param name="distances">The buffer distances for the Geometries. If the size of the distances array is less than the number of geometries in the input_geometries, the last distance value is used for the rest of geometries.</param>
 /// <param name="max_deviation">
 /// The max deviation of the result buffer from the true buffer in the units of the sr.
 /// When max_deviation is NaN or 0, it is replaced with 1e-5 * abs(distance).
 /// When max_deviation is larger than MIN = 0.5 * abs(distance), it is replaced with MIN. See below for more information.
 /// </param>
 /// <param name="max_vertices_in_full_circle">
 /// The maximum number of vertices in polygon produced from a buffered point. A value of 96 is used in methods that do not accept max_vertices_in_full_circle.
 /// If the value is less than MIN=12, it is set to MIN. See below for more information.
 /// </param>
 /// <param name="b_union">If True, the buffered geometries will be unioned, otherwise they wont be unioned.</param>
 /// <param name="progress_tracker">
 /// The progress tracker that allows to cancel the operation. Pass null if not needed.
 /// The max_deviation and max_vertices_in_full_circle control the quality of round joins in the buffer. That is, the precision of the buffer is max_deviation unless
 /// the number of required vertices is too large.
 /// The max_vertices_in_full_circle controls how many vertices can be in each round join in the buffer. It is approximately equal to the number of vertices in the polygon around a
 /// buffered point. It has a priority over max_deviation. The max deviation is the distance from the result polygon to a true buffer.
 /// The real deviation is calculated as the max(max_deviation, abs(distance) * (1 - cos(PI / max_vertex_in_complete_circle))).
 /// Note that max_deviation can be exceeded because geometry is generalized with 0.25 * real_deviation, also input segments closer than 0.25 * real_deviation are
 /// snapped to a point.
 /// </param>
 internal abstract com.epl.geometry.GeometryCursor Execute(com.epl.geometry.GeometryCursor input_geometries, com.epl.geometry.SpatialReference sr, double[] distances, double max_deviation, int max_vertices_in_full_circle, bool b_union, com.epl.geometry.ProgressTracker progress_tracker
                                                           );
 /// <summary>Performs the Symmetric Difference operation on the two geometries.</summary>
 /// <param name="leftGeometry">is one of the Geometry instances in the XOR operation.</param>
 /// <param name="rightGeometry">is one of the Geometry instances in the XOR operation.</param>
 /// <returns>Returns the result of the symmetric difference.</returns>
 public abstract com.epl.geometry.Geometry Execute(com.epl.geometry.Geometry leftGeometry, com.epl.geometry.Geometry rightGeometry, com.epl.geometry.SpatialReference sr, com.epl.geometry.ProgressTracker progressTracker);
Ejemplo n.º 30
0
 internal OperatorClipCursor(com.epl.geometry.GeometryCursor geoms, com.epl.geometry.Envelope2D envelope, com.epl.geometry.SpatialReference spatial_ref, com.epl.geometry.ProgressTracker progress_tracker)
 {
     m_index = -1;
     if (geoms == null)
     {
         throw new System.ArgumentException();
     }
     m_envelope            = envelope;
     m_inputGeometryCursor = geoms;
     m_spatialRefImpl      = (com.epl.geometry.SpatialReferenceImpl)spatial_ref;
     m_tolerance           = com.epl.geometry.InternalUtils.CalculateToleranceFromGeometry(spatial_ref, envelope, false);
 }