Example #1
0
        /*
         * private static DSCoordinateSequence FromCoordinateSequence(ICoordinateSequence coordinateSequence, DSCoordinateSequenceFactory factory)
         * {
         *  var coordinates = FromCoordinates(coordinateSequence.ToCoordinateArray());
         *  return factory.Create(coordinates);
         * }
         */

        private static GeoAPIPoint FromPoint(IPoint geometry, GeoAPIGeometryFactory factory, bool copyUserData)
        {
            var coord = FromCoordinate(geometry.Coordinate);
            var point = factory.CreatePoint(coord);

            if (copyUserData)
            {
                point.UserData = geometry.UserData;
            }
            return(point);
        }
Example #2
0
        /// <summary>
        /// Get the point for this shape if this is a point shape.
        /// </summary>
        /// <param name="shape">The shape to convert</param>
        /// <param name="factory">The geometry factory to use.</param>
        /// <param name="copyAttributes">A value indicating whether or not to copy the <see cref="Data.Shape.Attributes"/> to <see cref="GeoAPIGeometry.UserData"/></param>
        /// <returns>The geometry representing the converted shape.</returns>
        private static GeoAPIGeometry FromPointShape(Data.Shape shape, GeoAPIGeometryFactory factory, bool copyAttributes)
        {
            var part = shape.Range.Parts[0];
            var i    = part.StartIndex;

            var c = new GeoAPICoordinate(part.Vertices[0], part.Vertices[1]);

            //if (shape.HasM()) c.M = shape.M[i]
            if (shape.HasZ())
            {
                c.Z = shape.Z[i];
            }
            var ret = factory.CreatePoint(c);

            if (copyAttributes)
            {
                ret.UserData = shape.Attributes;
            }
            return(ret);
        }
        /// <summary>
        /// Get the point for this shape if this is a point shape.
        /// </summary>
        /// <param name="shape">The shape to convert</param>
        /// <param name="factory">The geometry factory to use.</param>
        /// <param name="copyAttributes">A value indicating whether or not to copy the <see cref="Data.Shape.Attributes"/> to <see cref="GeoAPIGeometry.UserData"/></param>
        /// <returns>The geometry representing the converted shape.</returns>
        private static GeoAPIGeometry FromPointShape(Data.Shape shape, GeoAPIGeometryFactory factory, bool copyAttributes)
        {
            var part = shape.Range.Parts[0];
            var i = part.StartIndex;

            var c = new GeoAPICoordinate(part.Vertices[0], part.Vertices[1]);
            //if (shape.HasM()) c.M = shape.M[i]
            if (shape.HasZ()) c.Z = shape.Z[i];
            var ret = factory.CreatePoint(c);
            if (copyAttributes)
                ret.UserData = shape.Attributes;
            return ret;
        }
        /*
        private static DSCoordinateSequence FromCoordinateSequence(ICoordinateSequence coordinateSequence, DSCoordinateSequenceFactory factory)
        {
            var coordinates = FromCoordinates(coordinateSequence.ToCoordinateArray());
            return factory.Create(coordinates);
        }
         */

        private static GeoAPIPoint FromPoint(IPoint geometry, GeoAPIGeometryFactory factory, bool copyUserData)
        {
            var coord = FromCoordinate(geometry.Coordinate);
            var point = factory.CreatePoint(coord);
            if (copyUserData)
                point.UserData = geometry.UserData;
            return point;
        }