⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 geometry.cs

📁 实现SHP
💻 CS
📖 第 1 页 / 共 3 页
字号:
	}

	/// <summary>
	/// Class which encapsulates a LinearRing that acts as outer boundary in a PolygonType
	/// </summary>
	[Serializable]
	[XmlType(Namespace="http://www.opengis.net/gml")]
	public class PolygonTypeOuterBoundaryIs 
	{
		/// <summary>
		/// The LinearRing this outer boundary encapsulates
		/// </summary>
		public LinearRingType LinearRing;
		/// <summary>
		/// Constructs empty outer boundary
		/// </summary>
		public PolygonTypeOuterBoundaryIs()	{	}
		/// <summary>
		/// Constructs outer boundary using specified CoordinatesType
 		/// </summary>
		/// <param name="cdt">CoordinatesType which defines the LinearRing</param>
		public PolygonTypeOuterBoundaryIs(gml.CoordinatesType cdt)
		{
			LinearRing = new LinearRingType(cdt);
		}
	}

	/// <summary>
	/// Class which encapsulates a LinearRing that acts as inner boundaries in a PolygonType
	/// </summary>
	[Serializable]
	[XmlType(Namespace="http://www.opengis.net/gml")]
	public class PolygonTypeInnerBoundaryIs 
	{

		/// <summary>
		/// The LinearRing this inner boundary encapsulates
		/// </summary>
		public LinearRingType LinearRing;
		/// <summary>
		/// Constructs empty inner boundary
		/// </summary>
		public PolygonTypeInnerBoundaryIs()	{	}
		/// <summary>
		/// Constructs inner boundary using specified CoordinatesType
		/// </summary>
		/// <param name="cdt">CoordinatesType which defines the LinearRing</param>
		public PolygonTypeInnerBoundaryIs(gml.CoordinatesType cdt)
		{
			LinearRing=new LinearRingType(cdt);
		}
	}

	#endregion

	#region aggregate geometries

	/// <summary>
	/// Encapsulates one or more geometry types, either mixed or uniform geometry types
	/// The geometry type must be wrapped inside a GeometryAssociation first.
	/// </summary>
	[Serializable]
	[XmlType(Namespace="http://www.opengis.net/gml")]
	[XmlRoot("MultiGeometry", Namespace="http://www.opengis.net/gml", IsNullable=false)]
	public class GeometryCollectionType : AbstractGeometryCollectionBaseType 
	{
		/// <summary>
		/// Array of GeometryAssociationTypes as members of this collection
		/// </summary>
		[XmlElement("geometryMember")]
		public GeometryAssociationType[] geometryMember=new GeometryAssociationType[0];

		/// <summary>
		/// Constructs empty GeometryCollection and default SRS name
		/// </summary>
		public GeometryCollectionType() : base() {	}

		/// <summary>
		/// Constructs empty GeometryCollection with specified SRS name
		/// </summary>
		/// <param name="srsName">Spatial Reference System name</param>
		public GeometryCollectionType(string srsName) : base(srsName) {}

		/// <summary>
		/// Constructs GeometryCollection with specified SRS name and members.
		/// </summary>
		/// <param name="srsName">Spatial Reference System name</param>
		/// <param name="members">members of this collection</param>
		public GeometryCollectionType(string srsName,GeometryAssociationType[] members) : base(srsName)
		{
			geometryMember=members;
		}

		/// <summary>
		/// Creates svg Group which contains svg object from each members.
		/// </summary>
		/// <returns>svg Group object</returns>
		public override svg.SvgElement createSvgObject()
		{
			svg.group g = new svg.group();
			g.Items = new svg.SvgElement[geometryMember.Length];
			for(int i=0;i<geometryMember.Length;i++ )
			{
				g.Items[i]=geometryMember[i].createSvgElement(); 
			}
			return g;
		}

		/// <summary>
		/// Draws graphics for each member of the collection
		/// </summary>
		/// <param name="g">Graphics to put drawing in</param>
		/// <param name="p">Pen for drawing</param>
		/// <param name="b">Brush for drawing</param>
		public override void DrawGraphics(ref Graphics g, ref Pen p, ref Brush b)
		{
			for(int i=0;i<geometryMember.Length;i++ )
			{
				geometryMember[i].DrawGraphics(ref g, ref p, ref b); 
			}
		}
	}
	
	/// <summary>
	/// Encapsulates one or more PointTypes
	/// </summary>
	[Serializable]
	[XmlType(Namespace="http://www.opengis.net/gml")]
	[XmlRoot("MultiPoint", Namespace="http://www.opengis.net/gml", IsNullable=false)]
	public class MultiPointType : GeometryCollectionType 
	{
		/// <summary>
		/// Member of this collection
		/// </summary>
		[XmlElement("pointMember")]
		public gml.GeometryAssociationType[] pointMember;

		/// <summary>
		/// Constructs empty MultiPointType
		/// </summary>
		public MultiPointType() : base() {	}

		/// <summary>
		/// Constructs empty MultiPointType with specified SRS name.
		/// </summary>
		/// <param name="srsName">Spatial Reference System name</param>
		public MultiPointType(string srsName) : base(srsName)
		{}

		/// <summary>
		/// Constructs MultiPointType with specified SRS name and members.
		/// </summary>
		/// <param name="srsName">Spatial Reference System name</param>
		/// <param name="points">members of this collection</param>
		public MultiPointType(string srsName, gml.PointType[] points) : base(srsName)
		{
			pointMember=new gml.GeometryAssociationType[points.Length];
			for(int i=0;i<points.Length;i++)
			{
				pointMember[i]=new gml.GeometryAssociationType(points[i]);			
			}
		}

		/// <summary>
		/// Creates svg Group object from this MultiPointType members.
		/// </summary>
		/// <returns>svg Group which contains svg objects from each member.</returns>
		public override svg.SvgElement createSvgObject()
		{
			svg.group g = new svg.group();
			g.Items = new svg.SvgElement[pointMember.Length];
			for(int i=0;i<pointMember.Length;i++ )
			{
				pointMember[i].Item.PointRadius = this.PointRadius;
				g.Items[i]=pointMember[i].createSvgElement();
			}
			return g;
		}

		/// <summary>
		/// Draws graphics for each member of this collection
		/// </summary>
		/// <param name="g">Graphics object to draw to</param>
		/// <param name="p">Pen for drawing</param>
		/// <param name="b">Brush for drawing</param>
		public override void DrawGraphics(ref Graphics g, ref Pen p, ref Brush b)
		{
			for(int i=0;i<pointMember.Length;i++ )
			{
				pointMember[i].Item.PointRadius = this.PointRadius;
				pointMember[i].DrawGraphics(ref g, ref p, ref b); 
			}			
		}
	}

	/// <summary>
	/// Encapsulates one or more LineStrings
	/// </summary>
	[Serializable]
	[XmlType(Namespace="http://www.opengis.net/gml")]
	[XmlRoot("MultiLineString", Namespace="http://www.opengis.net/gml", IsNullable=false)]
	public class MultiLineStringType : GeometryCollectionType 
	{
		/// <summary>
		/// Members of this MultiLineStringType
		/// </summary>
		[XmlElement("lineStringMember")]
		public gml.GeometryAssociationType[] lineStringMember;

		/// <summary>
		/// Constructs empty MultiLineStringType
		/// </summary>
		public MultiLineStringType():base(){}
		/// <summary>
		/// Constructs empty MultiLineStringType with specified SRS name
		/// </summary>
		/// <param name="srsName">Spatial Reference System name</param>
		public MultiLineStringType(string srsName) : base(srsName)
		{}

		/// <summary>
		/// Constructs MultiLineStringType with specified SRS name and members.
		/// </summary>
		/// <param name="srsName">Spatial Reference System name</param>
		/// <param name="LSArray">members of this collection</param>
		public MultiLineStringType(string srsName, gml.LineStringType[] LSArray) : base(srsName)
		{
			lineStringMember=new gml.GeometryAssociationType[LSArray.Length];
			for(int i=0;i<LSArray.Length;i++)
			{
				lineStringMember[i]=new gml.GeometryAssociationType(LSArray[i]);
			}
		}

		/// <summary>
		/// Creates svg Group object using members of this collection
		/// </summary>
		/// <returns>svg Group which contains svg object for each member of the collection</returns>
		public override svg.SvgElement createSvgObject()
		{
			svg.group g = new svg.group();
			g.Items = new svg.SvgElement[lineStringMember.Length];
			for(int i=0;i<lineStringMember.Length;i++ )
			{
				g.Items[i]=lineStringMember[i].createSvgElement(); 
			}
			return g;
		}

		/// <summary>
		/// Draws graphics for each member of the collection
		/// </summary>
		/// <param name="g">Graphics to draw to</param>
		/// <param name="p">Pen for drawing</param>
		/// <param name="b">Brush for drawing</param>
		public override void DrawGraphics(ref Graphics g, ref Pen p, ref Brush b)
		{
			for(int i=0;i<lineStringMember.Length;i++ )
			{
				lineStringMember[i].DrawGraphics(ref g, ref p, ref b); 
			}			
		}
	}

	/// <summary>
	/// Encapsulates one or more PolygonType
	/// </summary>
	[Serializable]
	[XmlType(Namespace="http://www.opengis.net/gml")]
	[XmlRoot("MultiPolygon", Namespace="http://www.opengis.net/gml", IsNullable=false)]
	public class MultiPolygonType : GeometryCollectionType 
	{
		/// <summary>
		/// Members of this collection
		/// </summary>
		[XmlElement("polygonMember")]
		//public gml.PolygonType[] polygonMember;
		public gml.GeometryAssociationType[] polygonMember;

		/// <summary>
		/// Constructs empty MultiPolygonType
		/// </summary>
		public MultiPolygonType() : base() {	}
		/// <summary>
		/// Constructs empty MultiPolygonType with specified SRS name
		/// </summary>
		/// <param name="srsName">Spatial Reference System name</param>
		public MultiPolygonType(string srsName) : base(srsName)
		{
		}
		/// <summary>
		/// Constructs MultiPolygonType with specified SRS name and members
		/// </summary>
		/// <param name="srsName">Spatial Reference System name</param>
		/// <param name="PGArray">members of this collection</param>
		public MultiPolygonType(string srsName, gml.PolygonType[] PGArray) : base(srsName)
		{
			polygonMember=new gml.GeometryAssociationType[PGArray.Length];
			for(int i=0;i<PGArray.Length;i++)
			{
				polygonMember[i]=new gml.GeometryAssociationType(PGArray[i]);
			}
		}

		/// <summary>
		/// Creates svg Group object using members of this collection
		/// </summary>
		/// <returns>svg Group which contains svg object for each member of the collection</returns>
		public override svg.SvgElement createSvgObject()
		{
			svg.group g = new svg.group();
			g.Items = new svg.SvgElement[polygonMember.Length];
			for(int i=0;i<polygonMember.Length;i++ )
			{
				g.Items[i]=polygonMember[i].createSvgElement(); 
			}
			return g;
		}

		/// <summary>
		/// Draws graphics for each member of the collection
		/// </summary>
		/// <param name="g">Graphics to draw to</param>
		/// <param name="p">Pen for drawing</param>
		/// <param name="b">Brush for drawing</param>
		public override void DrawGraphics(ref Graphics g, ref Pen p, ref Brush b)
		{
			for(int i=0;i<polygonMember.Length;i++ )
			{
				polygonMember[i].DrawGraphics(ref g, ref p, ref b); 
			}			
		}
	}
	#endregion

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -