Beispiel #1
0
        public static void main(string[] args)
        {
            var seqFact = ExtendedCoordinateSequenceFactory.Instance();

            var array1 = new ExtendedCoordinate[] { new ExtendedCoordinate(0, 0, 0, 91),
                                                    new ExtendedCoordinate(10, 0, 0, 92), new ExtendedCoordinate(10, 10, 0, 93),
                                                    new ExtendedCoordinate(0, 10, 0, 94), new ExtendedCoordinate(0, 0, 0, 91) };
            var seq1 = seqFact.Create(array1);

            var seq2 = seqFact.Create(new ExtendedCoordinate[] { new ExtendedCoordinate(5, 5, 0, 91),
                                                                 new ExtendedCoordinate(15, 5, 0, 92), new ExtendedCoordinate(15, 15, 0, 93),
                                                                 new ExtendedCoordinate(5, 15, 0, 94), new ExtendedCoordinate(5, 5, 0, 91) });

            var fact = new GeometryFactory(ExtendedCoordinateSequenceFactory.Instance());

            IGeometry g1 = fact.CreatePolygon(fact.CreateLinearRing(seq1), null);
            IGeometry g2 = fact.CreatePolygon(fact.CreateLinearRing(seq2), null);

            Console.WriteLine("WKT for g1: " + g1);
            Console.WriteLine("Internal rep for g1: " + ((IPolygon)g1).ExteriorRing.CoordinateSequence);

            Console.WriteLine("WKT for g2: " + g2);
            Console.WriteLine("Internal rep for g2: " + ((IPolygon)g2).ExteriorRing.CoordinateSequence);

            var gInt = g1.Intersection(g2);

            Console.WriteLine("WKT for gInt: " + gInt);
            Console.WriteLine("Internal rep for gInt: " + ((IPolygon)gInt).ExteriorRing.CoordinateSequence);
        }
        public static ExtendedCoordinate[] Copy(Coordinate[] coordinates)
        {
            var copy = new ExtendedCoordinate[coordinates.Length];

            Array.Copy(CopyInternal(coordinates), copy, coordinates.Length);
            return(copy);
        }
		public static void main(string[] args)
		{
			ExtendedCoordinateSequenceFactory seqFact = ExtendedCoordinateSequenceFactory.Instance();
			
			ExtendedCoordinate[] array1 = new ExtendedCoordinate[] { new ExtendedCoordinate(0, 0, 0, 91), 
                new ExtendedCoordinate(10, 0, 0, 92), new ExtendedCoordinate(10, 10, 0, 93), 
                new ExtendedCoordinate(0, 10, 0, 94), new ExtendedCoordinate(0, 0, 0, 91)};
			ICoordinateSequence seq1 = seqFact.Create(array1);
			
			ICoordinateSequence seq2 = seqFact.Create(new ExtendedCoordinate[] { new ExtendedCoordinate(5, 5, 0, 91), 
                new ExtendedCoordinate(15, 5, 0, 92), new ExtendedCoordinate(15, 15, 0, 93), 
                new ExtendedCoordinate(5, 15, 0, 94), new ExtendedCoordinate(5, 5, 0, 91)});
			
			GeometryFactory fact = new GeometryFactory(ExtendedCoordinateSequenceFactory.Instance());

            IGeometry g1 = fact.CreatePolygon(fact.CreateLinearRing(seq1), null);
            IGeometry g2 = fact.CreatePolygon(fact.CreateLinearRing(seq2), null);
			
			Console.WriteLine("WKT for g1: " + g1);
			Console.WriteLine("Internal rep for g1: " + ((IPolygon) g1).ExteriorRing.CoordinateSequence);
			
			Console.WriteLine("WKT for g2: " + g2);
            Console.WriteLine("Internal rep for g2: " + ((IPolygon)g2).ExteriorRing.CoordinateSequence);

            IGeometry gInt = g1.Intersection(g2);
			
			Console.WriteLine("WKT for gInt: " + gInt);
            Console.WriteLine("Internal rep for gInt: " + ((IPolygon)gInt).ExteriorRing.CoordinateSequence);
		}
 private static Coordinate[] CopyInternal(Coordinate[] coordinates)
 {
     var copy = new Coordinate[coordinates.Length];
     for (var i = 0; i < coordinates.Length; i++)
         copy[i] = new ExtendedCoordinate(coordinates[i]);
     return copy;
     
 }
        /// <summary>
        /// Creates a reversed version of this coordinate sequence with cloned <see cref="Coordinate"/>s
        /// </summary>
        /// <returns>A reversed version of this sequence</returns>
        public ICoordinateSequence Reversed()
        {
            var coordinates = new ExtendedCoordinate[Count];

            for (var i = 0; i < Count; i++)
            {
                coordinates[Count - i - 1] = new ExtendedCoordinate(coordinates[i]);
            }
            return(new ExtendedCoordinateSequence(coordinates));
        }
        private static Coordinate[] CopyInternal(Coordinate[] coordinates)
        {
            var copy = new Coordinate[coordinates.Length];

            for (var i = 0; i < coordinates.Length; i++)
            {
                copy[i] = new ExtendedCoordinate(coordinates[i]);
            }
            return(copy);
        }
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this instance.
        /// </returns>
		public object Clone()
		{
			var cloneCoordinates = new ExtendedCoordinate[Count];
			for (var i = 0; i < _coordinates.Length; i++)
			{
				cloneCoordinates[i] = (ExtendedCoordinate) _coordinates[i].Clone();
			}
			
			return new ExtendedCoordinateSequence(cloneCoordinates);
		}
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this instance.
        /// </returns>
        public object Clone()
        {
            var cloneCoordinates = new ExtendedCoordinate[Count];

            for (var i = 0; i < _coordinates.Length; i++)
            {
                cloneCoordinates[i] = (ExtendedCoordinate)_coordinates[i].Clone();
            }

            return(new ExtendedCoordinateSequence(cloneCoordinates));
        }
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this instance.
        /// </returns>
        public override CoordinateSequence Copy()
        {
            var cloneCoordinates = new ExtendedCoordinate[Count];

            for (int i = 0; i < _coordinates.Length; i++)
            {
                cloneCoordinates[i] = (ExtendedCoordinate)_coordinates[i].Copy();
            }

            return(new ExtendedCoordinateSequence(cloneCoordinates));
        }
 public ExtendedCoordinate(ExtendedCoordinate coord)
     : base(coord)
 {
     _m = coord._m;
 }
		/// <summary> Copy constructor -- simply aliases the input array, for better performance.
		/// </summary>
		public ExtendedCoordinateSequence(ExtendedCoordinate[] coordinates)
		{
			_coordinates = new Coordinate[coordinates.Length];
            Array.Copy(coordinates, _coordinates, coordinates.Length);
		}
	    /// <summary>
	    /// Creates a reversed version of this coordinate sequence with cloned <see cref="Coordinate"/>s
	    /// </summary>
	    /// <returns>A reversed version of this sequence</returns>
	    public ICoordinateSequence Reversed()
	    {
            var coordinates = new ExtendedCoordinate[Count];
            for (var i = 0; i < Count; i++)
            {
                coordinates[Count - i - 1] = new ExtendedCoordinate(coordinates[i]);
            }
            return new ExtendedCoordinateSequence(coordinates);
        }
        public static ExtendedCoordinate[] Copy(Coordinate[] coordinates)
		{
			var copy = new ExtendedCoordinate[coordinates.Length];
            Array.Copy(CopyInternal(coordinates), copy, coordinates.Length);
		    return copy;
		}
		public ExtendedCoordinate(ExtendedCoordinate coord) : base(coord)
		{
			_m = coord._m;
		}