/// <summary>
        /// Inserts a <see cref="Geometry"/> into the current table as a new record.
        /// </summary>
        /// <param name="obj">The object to be inserted.</param>
        public void Insert(Geometries.Geometry obj)
        {
            MappableEntity mappable = new MappableEntity();

            mappable.obj = obj;
            this.Insert(mappable);
        }
Ejemplo n.º 2
0
        private static bool TypeOf(Geometries.Geometry geometry, Type type)
        {
            if (geometry == null)
            {
                throw new ArgumentNullException("geometry");
            }
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            return(geometry.GetType() == type);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Converts any <see cref="GisSharpBlog.NetTopologySuite.Geometries.Geometry"/> array to the correspondant
        /// <see cref="SharpMap.Geometries.Geometry"/> array.
        /// </summary>
        public static Geometries.Geometry[] ToSharpMapGeometry(NTSGeometry[] geometries)
        {
            Geometries.Geometry[] converted = new Geometries.Geometry[geometries.Length];
            int index = 0;

            foreach (NTSGeometry geometry in geometries)
            {
                converted[index++] = ToSharpMapGeometry(geometry);
            }
            if ((geometries.Length != converted.Length))
            {
                throw new ApplicationException("Conversion error");
            }
            return(converted);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Converts any <see cref="GisSharpBlog.NetTopologySuite.Geometries.Geometry"/> to the correspondant
        /// <see cref="SharpMap.Geometries.Geometry"/>.
        /// </summary>
        public static NTSGeometry ToNTSGeometry(Geometries.Geometry geometry, IGeometryFactory factory)
        {
            if (geometry == null)
            {
                throw new NullReferenceException("geometry");
            }

            if (TypeOf(geometry, typeof(Geometries.Point)))
            {
                return(ToNTSPoint(geometry as Geometries.Point, factory));
            }

            if (TypeOf(geometry, typeof(Geometries.LineString)))
            {
                return(ToNTSLineString(geometry as Geometries.LineString, factory));
            }

            if (TypeOf(geometry, typeof(Geometries.Polygon)))
            {
                return(ToNTSPolygon(geometry as Geometries.Polygon, factory));
            }

            if (TypeOf(geometry, typeof(Geometries.MultiPoint)))
            {
                return(ToNTSMultiPoint(geometry as Geometries.MultiPoint, factory));
            }

            if (TypeOf(geometry, typeof(Geometries.MultiLineString)))
            {
                return(ToNTSMultiLineString(geometry as Geometries.MultiLineString, factory));
            }

            if (TypeOf(geometry, typeof(Geometries.MultiPolygon)))
            {
                return(ToNTSMultiPolygon(geometry as Geometries.MultiPolygon, factory));
            }

            if (TypeOf(geometry, typeof(Geometries.GeometryCollection)))
            {
                return(ToNTSGeometryCollection(geometry as Geometries.GeometryCollection, factory));
            }

            var message = String.Format("Type {0} not supported", geometry.GetType().FullName);

            throw new NotSupportedException(message);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a new feature.
 /// </summary>
 /// <param name="geometry">The geometry.</param>
 /// <param name="attributes">The attributes.</param>
 public Feature(Geometries.Geometry geometry, Attributes.GeometryAttributeCollection attributes)
 {
     this.Geometry   = geometry;
     this.Attributes = attributes;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Creates a new feature.
 /// </summary>
 /// <param name="geometry">The geometry.</param>
 /// <remarks>Attributes will be empty.</remarks>
 public Feature(Geometries.Geometry geometry)
 {
     this.Geometry   = geometry;
     this.Attributes = new SimpleGeometryAttributeCollection();
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Converts any <see cref="GisSharpBlog.NetTopologySuite.Geometries.Geometry"/> array to the correspondant 
 /// <see cref="SharpMap.Geometries.Geometry"/> array.
 /// </summary>
 public static Geometries.Geometry[] ToSharpMapGeometry(NTSGeometry[] geometries)
 {
     Geometries.Geometry[] converted = new Geometries.Geometry[geometries.Length];
     int index = 0;
     foreach (NTSGeometry geometry in geometries)
         converted[index++] = ToSharpMapGeometry(geometry);
     if ((geometries.Length != converted.Length))
         throw new ApplicationException("Conversion error");
     return converted;
 }
Ejemplo n.º 8
0
 public Geometries.Geometry Transform(int fromSRID, int toSRID, Geometries.Geometry geometry)
 {
     throw new NotImplementedException();
 }