} // public override int ComputeOrientation(Coordinate p1, Coordinate p2, Coordinate q) 

		/// <summary>
		/// Tests to see if point p is in the envelope of ring.
		/// </summary>
		/// <param name="p">Point to test.</param>
		/// <param name="ring">Geometry from which to create envelope.</param>
		/// <returns>Returns true if point is in envelope of ring.</returns>
		private bool IsInEnvelope(Coordinate p, Coordinates ring) 
		{
			Envelope envelope = new Envelope();
			for (int i = 0; i < ring.Count; i++) 
			{
				envelope.ExpandToInclude( ring[i] );
			}
			return envelope.Contains( p );		
		} // private bool IsInEnvelope(Coordinate p, Coordinates ring)
		///<summary>
		/// Returns the minimum and maximum x and y value1s in this Geometry, or a null Envelope if this Geometry
		/// is empty.
		///</summary>
		///<remarks>Unlike getEnvelopeInternal, this method calculates the Envelope each time it is called; 
		/// getEnvelopeInternal caches the result of this method.</remarks>
		///<returns>
		///	Returns this Geometrys bounding box; if the Geometry is empty, Envelope.IsNull will return true
		///</returns>
		protected override Envelope ComputeEnvelopeInternal()
		{
			Envelope env = new Envelope();
			if(_geometries != null)
			{
				foreach(Geometry geom in _geometries)
				{
					env.ExpandToInclude(geom.GetEnvelopeInternal());
				}
			}
			return env;
		}
Example #3
0
		public static Node CreateExpanded( Node node, Envelope addEnv )
		{
			Envelope expandEnv = new Envelope(addEnv);
			if (node != null) expandEnv.ExpandToInclude(node.Envelope);

			Node largerNode = CreateNode(expandEnv);
			if (node != null) largerNode.InsertNode(node);
			return largerNode;
		}
Example #4
0
		/// <summary>
		/// Find a small loop starting at this point, if one exists. If found, return the index of the 
		/// last point of the loop. If none exists, return 0
		/// </summary>
		/// <param name="pts"></param>
		/// <param name="startIndex"></param>
		/// <returns></returns>
		private int CheckForLoop(Coordinates pts, int startIndex)
		{
			
			Coordinate startPt = pts[startIndex];
			Envelope env = new Envelope();
			env.ExpandToInclude(startPt);
			int endIndex = startIndex;
			for (int j = 1; j <= _maxPointsInLoop; j++) 
			{
				endIndex = startIndex + j;
				if (endIndex >= pts.Count) break;

				env.ExpandToInclude(pts[endIndex]);
				if (pts[endIndex].Equals(startPt)) 
				{
					if (env.Height < _maxLoopExtent && env.Width < _maxLoopExtent) 
					{
						return j;
					}
				}
			}
			return 0;
		}