コード例 #1
0
        public override string AsText(DbGeography geographyValue)
        {
            CheckParameterNotNull("geographyValue", geographyValue);

            dynamic providerValue = geographyValue.ProviderValue;
            return providerValue.STAsText().ToSqlString().Value;
        }
コード例 #2
0
        public override DbGeography Buffer(DbGeography geographyValue, double distance)
        {
            CheckParameterNotNull("geographyValue", geographyValue);

            dynamic providerValue = geographyValue.ProviderValue;
            return GeographyFromProviderValue(providerValue.STBuffer(distance));
        }
コード例 #3
0
        public override byte[] AsBinary(DbGeography geographyValue)
        {
            CheckParameterNotNull("geographyValue", geographyValue);

            dynamic providerValue = geographyValue.ProviderValue;
            return providerValue.STAsBinary().Value;
        }
コード例 #4
0
        public override string AsGml(DbGeography geographyValue)
        {
            CheckParameterNotNull("geographyValue", geographyValue);

            dynamic providerValue = geographyValue.ProviderValue;
            return providerValue.AsGml().Value;
        }
コード例 #5
0
 private static ReadOnlySpatialValues CheckCompatible(DbGeography geographyValue)
 {
     Debug.Assert(geographyValue != null, "Validate geographyValue is non-null before calling CheckCompatible");
     if (geographyValue != null)
     {
         ReadOnlySpatialValues expectedValue = geographyValue.ProviderValue as ReadOnlySpatialValues;
         if (expectedValue != null)
         {
             return expectedValue;
         }
     }
     throw SpatialExceptions.GeographyValueNotCompatibleWithSpatialServices("geographyValue");
 }
コード例 #6
0
 public override bool GetIsEmpty(DbGeography geographyValue)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #7
0
 public override int GetDimension(DbGeography geographyValue)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #8
0
 public override DbGeographyWellKnownValue CreateWellKnownValue(DbGeography geographyValue)
 {
     geographyValue.CheckNull("geographyValue");
     ReadOnlySpatialValues backingValue = CheckCompatible(geographyValue);
     return new DbGeographyWellKnownValue() { CoordinateSystemId = backingValue.CoordinateSystemId, WellKnownBinary = backingValue.CloneBinary(), WellKnownText = backingValue.Text };
 }
コード例 #9
0
 /// <summary>
 /// Returns a nullable double value that indicates the area of the given <see cref="DbGeography"/> value, which may be null if the value does not represent a surface.
 /// <param name="geographyValue">The geography value, which need not represent a surface.</param>
 /// <returns>The area of <paramref name="geographyValue"/>, if it represents a surface; otherwise <c>null</c>.</returns>
 /// </summary>
 /// <exception cref="ArgumentNullException"><paramref name="geographyValue"/> is null.</exception>
 /// <exception cref="ArgumentException"><paramref name="geographyValue"/> is not compatible with this spatial services implementation.</exception>
 public abstract double? GetArea(DbGeography geographyValue);
コード例 #10
0
 /// <summary>
 /// Returns the number of points in the given <see cref="DbGeography"/> value, if it represents a linestring or linear ring.
 /// <param name="geographyValue">The geography value, which need not represent a linestring or linear ring.</param>
 /// <returns>The number of elements in <paramref name="geographyValue"/>, if it represents a linestring or linear ring; otherwise <c>null</c>.</returns>
 /// </summary>
 /// <exception cref="ArgumentNullException"><paramref name="geographyValue"/> is null.</exception>
 /// <exception cref="ArgumentException"><paramref name="geographyValue"/> is not compatible with this spatial services implementation.</exception>
 public abstract int? GetPointCount(DbGeography geographyValue);
コード例 #11
0
 public override DbGeography SymmetricDifference(DbGeography geographyValue, DbGeography otherGeography)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #12
0
 public override DbGeography Buffer(DbGeography geographyValue, double distance)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #13
0
 public override double Distance(DbGeography geographyValue, DbGeography otherGeography)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #14
0
 public override bool Disjoint(DbGeography geographyValue, DbGeography otherGeography)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #15
0
 public override bool Intersects(DbGeography geographyValue, DbGeography otherGeography)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #16
0
 public override bool GetIsEmpty(DbGeography geographyValue)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #17
0
 public override string GetSpatialTypeName(DbGeography geographyValue)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #18
0
 public override int GetDimension(DbGeography geographyValue)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #19
0
 public override string AsGml(DbGeography geographyValue)
 {
     geographyValue.CheckNull("geographyValue");
     ReadOnlySpatialValues expectedValue = CheckCompatible(geographyValue);
     return expectedValue.GML;
 }
コード例 #20
0
 public override DbGeography Union(DbGeography geographyValue, DbGeography otherGeography)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #21
0
 /// <summary>
 /// Computes the symmetric difference of this DbGeography value and another DbGeography value.
 /// </summary>
 /// <param name="other">The geography value for which the symmetric difference with this value should be computed.</param>
 /// <returns>A new DbGeography value representing the symmetric difference between this geography value and <paramref name="other"/>.</returns>
 /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
 public DbGeography SymmetricDifference(DbGeography other)
 {
     other.CheckNull("other");
     return(this.spatialSvcs.SymmetricDifference(this, other));
 }
コード例 #22
0
 public override DbGeography SymmetricDifference(DbGeography geographyValue, DbGeography otherGeography)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #23
0
 /// <summary>
 /// Computes the intersection of this DbGeography value and another DbGeography value.
 /// </summary>
 /// <param name="other">The geography value for which the intersection with this value should be computed.</param>
 /// <returns>A new DbGeography value representing the intersection between this geography value and <paramref name="other"/>.</returns>
 /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
 public DbGeography Intersection(DbGeography other)
 {
     other.CheckNull("other");
     return(this.spatialSvcs.Intersection(this, other));
 }
コード例 #24
0
 public override DbGeography GetStartPoint(DbGeography geographyValue)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #25
0
 /// <summary>
 /// Determines whether this DbGeography is spatially disjoint from the specified DbGeography argument.
 /// </summary>
 /// <param name="other">The geography value that should be compared with this geography value for disjointness.</param>
 /// <returns><c>true</c> if <paramref name="other"/> is disjoint from this geography value; otherwise <c>false</c>.</returns>
 /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
 public bool Disjoint(DbGeography other)
 {
     other.CheckNull("other");
     return(this.spatialSvcs.Disjoint(this, other));
 }
コード例 #26
0
 public override bool?GetIsClosed(DbGeography geographyValue)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #27
0
 /// <summary>
 /// Returns a point element of the given <see cref="DbGeography"/> value, if it represents a linestring or linear ring.
 /// <param name="geographyValue">The geography value, which need not represent a linestring or linear ring.</param>
 /// <param name="index">The position within the geography value from which the element should be taken.</param>
 /// <returns>The point in <paramref name="geographyValue"/> at position <paramref name="index"/>, if it represents a linestring or linear ring; otherwise <c>null</c>.</returns>
 /// </summary>
 /// <exception cref="ArgumentNullException"><paramref name="geographyValue"/> is null.</exception>
 /// <exception cref="ArgumentException"><paramref name="geographyValue"/> is not compatible with this spatial services implementation.</exception>
 public abstract DbGeography PointAt(DbGeography geographyValue, int index);
コード例 #28
0
 public override int?GetPointCount(DbGeography geographyValue)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #29
0
 /// <summary>
 /// Creates an instance of <see cref="DbGeographyWellKnownValue"/> that represents the specified <see cref="DbGeography"/> value using one or both of the standard well known spatial formats.
 /// </summary>
 /// <param name="geographyValue"></param>
 /// <returns>The well known representation of <paramref name="geographyValue"/>, as a new <see cref="DbGeographyWellKnownValue"/>.</returns>
 /// <exception cref="ArgumentNullException"><paramref name="geographyValue"/> is null.</exception>
 /// <exception cref="ArgumentException"><paramref name="geographyValue"/> is not compatible with this spatial services implementation.</exception>
 public abstract DbGeographyWellKnownValue CreateWellKnownValue(DbGeography geographyValue);
コード例 #30
0
 public override DbGeography PointAt(DbGeography geographyValue, int index)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #31
0
 public override int GetCoordinateSystemId(DbGeography geographyValue)
 {
     geographyValue.CheckNull("geographyValue");
     ReadOnlySpatialValues backingValue = CheckCompatible(geographyValue);
     return backingValue.CoordinateSystemId;
 }
コード例 #32
0
 public override double?GetArea(DbGeography geographyValue)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #33
0
 public override string GetSpatialTypeName(DbGeography geographyValue)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #34
0
 public override bool Intersects(DbGeography geographyValue, DbGeography otherGeography)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #35
0
 public override byte[] AsBinary(DbGeography geographyValue)
 {
     geographyValue.CheckNull("geographyValue");
     ReadOnlySpatialValues expectedValue = CheckCompatible(geographyValue);
     return expectedValue.CloneBinary();
 }
コード例 #36
0
 public override double Distance(DbGeography geographyValue, DbGeography otherGeography)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #37
0
 public override bool Disjoint(DbGeography geographyValue, DbGeography otherGeography)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #38
0
 /// <summary>
 /// Computes the union of this DbGeography value and another DbGeography value.
 /// </summary>
 /// <param name="other">The geography value for which the union with this value should be computed.</param>
 /// <returns>A new DbGeography value representing the union between this geography value and <paramref name="other"/>.</returns>
 /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
 public DbGeography Union(DbGeography other)
 {
     other.CheckNull("other");
     return(this.spatialSvcs.Union(this, other));
 }
コード例 #39
0
 public override DbGeography Buffer(DbGeography geographyValue, double distance)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #40
0
 public override bool? GetIsClosed(DbGeography geographyValue)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #41
0
 public override DbGeography Union(DbGeography geographyValue, DbGeography otherGeography)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #42
0
 public override DbGeography PointAt(DbGeography geographyValue, int index)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #43
0
 public override DbGeography GetStartPoint(DbGeography geographyValue)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #44
0
 /// <summary>
 /// Computes the distance between the closest points in this DbGeography value and another DbGeography value.
 /// </summary>
 /// <param name="other">The geography value for which the distance from this value should be computed.</param>
 /// <returns>A double value that specifies the distance between the two closest points in this geography value and <paramref name="other"/>.</returns>
 /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
 public double?Distance(DbGeography other)
 {
     other.CheckNull("other");
     return(this.spatialSvcs.Distance(this, other));
 }
コード例 #45
0
 public override int? GetPointCount(DbGeography geographyValue)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #46
0
 /// <summary>
 /// Returns a <see cref="DbGeography"/> value that represents the end point of the given DbGeography value, which may be null if the value does not represent a curve.
 /// <param name="geographyValue">The geography value, which need not represent a curve.</param>
 /// <returns>The end point of <paramref name="geographyValue"/>, if it represents a curve; otherwise <c>null</c>.</returns>
 /// </summary>
 /// <exception cref="ArgumentNullException"><paramref name="geographyValue"/> is null.</exception>
 /// <exception cref="ArgumentException"><paramref name="geographyValue"/> is not compatible with this spatial services implementation.</exception>
 public abstract DbGeography GetEndPoint(DbGeography geographyValue);
コード例 #47
0
 public override double? GetArea(DbGeography geographyValue)
 {
     throw SpatialServicesUnavailable();
 }
コード例 #48
0
 /// <summary>
 /// Returns a nullable Boolean value that whether the given <see cref="DbGeography"/> value is closed, which may be null if the value does not represent a curve.
 /// <param name="geographyValue">The geography value, which need not represent a curve.</param>
 /// <returns><c>true</c> if <paramref name="geographyValue"/> represents a closed curve; <c>false</c> if <paramref name="geographyValue"/> represents a curve that is not closed; otherwise <c>null</c>.</returns>
 /// </summary>
 /// <exception cref="ArgumentNullException"><paramref name="geographyValue"/> is null.</exception>
 /// <exception cref="ArgumentException"><paramref name="geographyValue"/> is not compatible with this spatial services implementation.</exception>
 public abstract bool? GetIsClosed(DbGeography geographyValue);
コード例 #49
0
        public static object ConvertToSqlTypesGeography(DbGeography geography)
        {
            Debug.Assert(geography != null, "geography != null");

            var providerValue = geography.ProviderValue;
            if (providerValue == null || providerValue.GetType() == SqlGeographyType)
            {
                return providerValue;
            }
         
            // DbGeography value created by a different spatial services
            throw new NotSupportedException("DbGeography values not backed by Sql Server spatial types are not supported.");
        }
コード例 #50
0
 /// <summary>
 /// Determines whether this DbGeography is spatially equal to the specified DbGeography argument.
 /// </summary>
 /// <param name="other">The geography value that should be compared with this geography value for equality.</param>
 /// <returns><c>true</c> if <paramref name="other"/> is spatially equal to this geography value; otherwise <c>false</c>.</returns>
 /// <exception cref="ArgumentNullException"><paramref name="other"/> is null.</exception>
 public bool SpatialEquals(DbGeography other)
 {
     other.CheckNull("other");
     return(this.spatialSvcs.SpatialEquals(this, other));
 }