示例#1
0
 /// <summary>
 /// Geometry Constructor
 /// </summary>
 /// <param name="coordinateSystem">The CoordinateSystem</param>
 /// <param name="creator">The implementation that created this instance.</param>
 protected Geometry(CoordinateSystem coordinateSystem, SpatialImplementation creator)
 {
     Util.CheckArgumentNull(coordinateSystem, "coordinateSystem");
     Util.CheckArgumentNull(creator, "creator");
     this.coordinateSystem = coordinateSystem;
     this.creator = creator;
 }
示例#2
0
 public bool Equals(CoordinateSystem other)
 {
     if (object.ReferenceEquals(null, other))
     {
         return false;
     }
     return (object.ReferenceEquals(this, other) || (object.Equals(other.topology, this.topology) && other.EpsgId.Equals(this.EpsgId)));
 }
示例#3
0
 public static GeographyPoint Create(CoordinateSystem coordinateSystem, double latitude, double longitude, double? z, double? m)
 {
     SpatialBuilder builder = SpatialBuilder.Create();
     GeographyPipeline geographyPipeline = builder.GeographyPipeline;
     geographyPipeline.SetCoordinateSystem(coordinateSystem);
     geographyPipeline.BeginGeography(SpatialType.Point);
     geographyPipeline.BeginFigure(new GeographyPosition(latitude, longitude, z, m));
     geographyPipeline.EndFigure();
     geographyPipeline.EndGeography();
     return (GeographyPoint) builder.ConstructedGeography;
 }
示例#4
0
 public static GeometryPoint Create(CoordinateSystem coordinateSystem, double x, double y, double? z, double? m)
 {
     SpatialBuilder builder = SpatialBuilder.Create();
     GeometryPipeline geometryPipeline = builder.GeometryPipeline;
     geometryPipeline.SetCoordinateSystem(coordinateSystem);
     geometryPipeline.BeginGeometry(SpatialType.Point);
     geometryPipeline.BeginFigure(new GeometryPosition(x, y, z, m));
     geometryPipeline.EndFigure();
     geometryPipeline.EndGeometry();
     return (GeometryPoint) builder.ConstructedGeometry;
 }
示例#5
0
 private void InitializeObject()
 {
     this.depth = 0;
     this.initialFirstCoordinate     = 0.0;
     this.initialSecondCoordinate    = 0.0;
     this.mostRecentFirstCoordinate  = 0.0;
     this.mostRecentSecondCoordinate = 0.0;
     this.pointCount = 0;
     this.validationCoordinateSystem = null;
     this.ringCount = 0;
     this.stack.Clear();
     this.stack.Push(CoordinateSystem);
 }
示例#6
0
 private static CoordinateSystem GetOrCreate(int epsgId, Topology topology)
 {
     CoordinateSystem system;
     lock (referencesLock)
     {
         if (References.TryGetValue(KeyFor(epsgId, topology), out system))
         {
             return system;
         }
         system = new CoordinateSystem(epsgId, "ID " + epsgId, topology);
         AddRef(system);
     }
     return system;
 }
 internal GeometryPointImplementation(CoordinateSystem coordinateSystem, SpatialImplementation creator, double x, double y, double? z, double? m) : base(coordinateSystem, creator)
 {
     if (double.IsNaN(x) || double.IsInfinity(x))
     {
         throw new ArgumentException(Strings.InvalidPointCoordinate(x, "x"));
     }
     if (double.IsNaN(y) || double.IsInfinity(y))
     {
         throw new ArgumentException(Strings.InvalidPointCoordinate(y, "y"));
     }
     this.x = x;
     this.y = y;
     this.z = z;
     this.m = m;
 }
 internal GeographyPointImplementation(CoordinateSystem coordinateSystem, SpatialImplementation creator, double latitude, double longitude, double? zvalue, double? mvalue) : base(coordinateSystem, creator)
 {
     if (double.IsNaN(latitude) || double.IsInfinity(latitude))
     {
         throw new ArgumentException(Strings.InvalidPointCoordinate(latitude, "latitude"));
     }
     if (double.IsNaN(longitude) || double.IsInfinity(longitude))
     {
         throw new ArgumentException(Strings.InvalidPointCoordinate(longitude, "longitude"));
     }
     this.latitude = latitude;
     this.longitude = longitude;
     this.z = zvalue;
     this.m = mvalue;
 }
示例#9
0
            protected override System.Spatial.CoordinateSystem OnSetCoordinateSystem(System.Spatial.CoordinateSystem coordinateSystem)
            {
                ValidatorState state = this.stack.Peek();

                this.Execute(PipelineCall.SetCoordinateSystem);
                if (state == CoordinateSystem)
                {
                    this.validationCoordinateSystem = coordinateSystem;
                    return(coordinateSystem);
                }
                if (this.validationCoordinateSystem != coordinateSystem)
                {
                    throw new FormatException(Strings.Validator_SridMismatch);
                }
                return(coordinateSystem);
            }
示例#10
0
 private void BeginShape(SpatialType type, CoordinateSystem defaultCoordinateSystem)
 {
     if (this.currentCoordinateSystem == null)
     {
         this.currentCoordinateSystem = defaultCoordinateSystem;
     }
     if (this.ShapeHasObjectScope)
     {
         this.WriteShapeHeader(type);
     }
     if (TypeHasArrayScope(type))
     {
         this.StartArrayScope();
     }
     this.stack.Push(type);
     this.figureDrawn = false;
 }
示例#11
0
 protected override CoordinateSystem OnSetCoordinateSystem(CoordinateSystem coordinateSystem)
 {
     this.WriteCoordinateSystem(coordinateSystem);
     return coordinateSystem;
 }
示例#12
0
 private void WriteCoordinateSystem(CoordinateSystem coordinateSystem)
 {
     if (!this.coordinateSystemWritten)
     {
         this.writer.Write("SRID");
         this.writer.Write("=");
         this.writer.Write(coordinateSystem.Id);
         this.writer.Write(";");
         this.coordinateSystemWritten = true;
     }
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="coordinateSystem">The CoordinateSystem</param>
 /// <param name="creator">The implementation that created this instance.</param>
 protected GeographyMultiCurve(CoordinateSystem coordinateSystem, SpatialImplementation creator)
     : base(coordinateSystem, creator)
 {
 }
示例#14
0
 protected override CoordinateSystem OnSetCoordinateSystem(CoordinateSystem coordinateSystem)
 {
     this.currentCoordinateSystem = coordinateSystem;
     return coordinateSystem;
 }
示例#15
0
 protected GeometryMultiPoint(CoordinateSystem coordinateSystem, SpatialImplementation creator) : base(coordinateSystem, creator)
 {
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="coordinateSystem">The CoordinateSystem</param>
 /// <param name="creator">The implementation that created this instance.</param>
 /// <param name="polygons">Polygons</param>
 internal GeometryMultiPolygonImplementation(CoordinateSystem coordinateSystem, SpatialImplementation creator, params GeometryPolygon[] polygons)
     : base(coordinateSystem, creator)
 {
     this.polygons = polygons;
 }
示例#17
0
 private static void AddRef(CoordinateSystem coords)
 {
     References.Add(KeyFor(coords.EpsgId.Value, coords.topology), coords);
 }
示例#18
0
 protected GeometryCurve(CoordinateSystem coordinateSystem, SpatialImplementation creator) : base(coordinateSystem, creator)
 {
 }
示例#19
0
 protected GeometryMultiLineString(CoordinateSystem coordinateSystem, SpatialImplementation creator) : base(coordinateSystem, creator)
 {
 }
 internal GeometryCollectionImplementation(CoordinateSystem coordinateSystem, SpatialImplementation creator, params Geometry[] geometry) : base(coordinateSystem, creator)
 {
     this.geometryArray = geometry ?? new Geometry[0];
 }
示例#21
0
 /// <summary>
 /// Create a empty point
 /// </summary>
 /// <param name="coordinateSystem">CoordinateSystem</param>
 /// <param name="creator">The implementation that created this instance.</param>
 protected GeographyPoint(CoordinateSystem coordinateSystem, SpatialImplementation creator)
     : base(coordinateSystem, creator)
 {
 }
示例#22
0
 private static void AddRef(CoordinateSystem coords)
 {
     References.Add(KeyFor(coords.EpsgId.Value, coords.topology), coords);
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="coordinateSystem">The CoordinateSystem</param>
 /// <param name="creator">The implementation that created this instance.</param>
 /// <param name="points">Points</param>
 internal GeographyMultiPointImplementation(CoordinateSystem coordinateSystem, SpatialImplementation creator, params GeographyPoint[] points)
     : base(coordinateSystem, creator)
 {
     this.points = points ?? new GeographyPoint[0];
 }
示例#24
0
 /// <summary>
 /// Set the coordinate system
 /// </summary>
 /// <param name="coordinateSystem">The CoordinateSystem</param>
 /// <returns>the coordinate system to be passed down the pipeline</returns>
 protected virtual CoordinateSystem OnSetCoordinateSystem(CoordinateSystem coordinateSystem)
 {
     return coordinateSystem;
 }
示例#25
0
 protected GeographyCollection(CoordinateSystem coordinateSystem, SpatialImplementation creator) : base(coordinateSystem, creator)
 {
 }
示例#26
0
 /// <summary>
 /// Set the coordinate system
 /// </summary>
 /// <param name="coordinateSystem">The CoordinateSystem</param>
 public override void SetCoordinateSystem(CoordinateSystem coordinateSystem)
 {
     both.OnSetCoordinateSystem(coordinateSystem);
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="coordinateSystem">The CoordinateSystem</param>
 /// <param name="creator">The implementation that created this instance.</param>
 /// <param name="rings">The rings of this polygon</param>
 internal GeographyPolygonImplementation(CoordinateSystem coordinateSystem, SpatialImplementation creator, params GeographyLineString[] rings)
     : base(coordinateSystem, creator)
 {
     this.rings = rings ?? new GeographyLineString[0];
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="coordinateSystem">CoordinateSystem</param>
 /// <param name="creator">The implementation that created this instance.</param>
 protected GeographyLineString(CoordinateSystem coordinateSystem, SpatialImplementation creator)
     : base(coordinateSystem, creator)
 {
 }
        /// <summary>
        /// Write the coordinate system
        /// </summary>
        /// <param name="coordinateSystem">The CoordinateSystem</param>
        private void WriteCoordinateSystem(CoordinateSystem coordinateSystem)
        {
            if (!this.coordinateSystemWritten)
            {
                // SRID can only be set once in WKT, but can be set once per BeginGeo in collection types
                this.writer.Write(WellKnownTextConstants.WktSrid);
                this.writer.Write(WellKnownTextConstants.WktEquals);
                this.writer.Write(coordinateSystem.Id);
                this.writer.Write(WellKnownTextConstants.WktSemiColon);

                this.coordinateSystemWritten = true;
            }
        }
 internal GeographyFullGlobeImplementation(CoordinateSystem coordinateSystem, SpatialImplementation creator) : base(coordinateSystem, creator)
 {
 }
示例#31
0
 public abstract void SetCoordinateSystem(CoordinateSystem coordinateSystem);
示例#32
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="coordinateSystem">The CoordinateSystem</param>
 /// <param name="creator">The implementation that created this instance.</param>
 internal GeometrySurface(CoordinateSystem coordinateSystem, SpatialImplementation creator)
     : base(coordinateSystem, creator)
 {
 }
 internal GeometryLineStringImplementation(CoordinateSystem coordinateSystem, SpatialImplementation creator, params GeometryPoint[] points) : base(coordinateSystem, creator)
 {
     this.points = points ?? new GeometryPoint[0];
 }
 internal GeometryMultiLineStringImplementation(CoordinateSystem coordinateSystem, SpatialImplementation creator, params GeometryLineString[] lineStrings) : base(coordinateSystem, creator)
 {
     this.lineStrings = lineStrings ?? new GeometryLineString[0];
 }
示例#35
0
 protected override void OnReset()
 {
     this.parentStack = new Stack<SpatialType>();
     this.coordinateSystemWritten = false;
     this.currentCoordinateSystem = null;
     this.figureWritten = false;
     this.shouldWriteContainerWrapper = false;
 }