当前位置: 首页>>代码示例>>C#>>正文


C# SharpMap.GetType方法代码示例

本文整理汇总了C#中SharpMap.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# SharpMap.GetType方法的具体用法?C# SharpMap.GetType怎么用?C# SharpMap.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SharpMap的用法示例。


在下文中一共展示了SharpMap.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToNTSGeometry

        /// <summary>
        /// Converts any <see cref=GisSharpBlog.NetTopologySuite.Geometries.Geometry"/> to the correspondant 
        /// <see cref="SharpMap.Geometries.Geometry"/>.
        /// </summary>
        /// <param name="geometry"></param>
        /// <returns></returns>
        public static GisSharpBlog.NetTopologySuite.Geometries.Geometry ToNTSGeometry(SharpMap.Geometries.Geometry geometry,
            GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory factory)
        {
            if (geometry == null)
                throw new NullReferenceException("geometry");

            if (geometry.GetType() == typeof(SharpMap.Geometries.Point))
                return ToNTSPoint(geometry as SharpMap.Geometries.Point, factory);

            else if (geometry.GetType() == typeof(SharpMap.Geometries.LineString))
                return ToNTSLineString(geometry as SharpMap.Geometries.LineString, factory);

            else if (geometry.GetType() == typeof(SharpMap.Geometries.Polygon))
                return ToNTSPolygon(geometry as SharpMap.Geometries.Polygon, factory);

            else if (geometry.GetType() == typeof(SharpMap.Geometries.MultiPoint))
                return ToNTSMultiPoint(geometry as SharpMap.Geometries.MultiPoint, factory);

            else if (geometry.GetType() == typeof(SharpMap.Geometries.MultiLineString))
                return ToNTSMultiLineString(geometry as SharpMap.Geometries.MultiLineString, factory);

            else if (geometry.GetType() == typeof(SharpMap.Geometries.MultiPolygon))
                return ToNTSMultiPolygon(geometry as SharpMap.Geometries.MultiPolygon, factory);

            else if (geometry.GetType() == typeof(SharpMap.Geometries.GeometryCollection))
                return ToNTSGeometryCollection(geometry as SharpMap.Geometries.GeometryCollection, factory);

            else throw new NotSupportedException("Type " + geometry.GetType().FullName + " not supported");
        }
开发者ID:ZoneDesignSystems,项目名称:zds,代码行数:35,代码来源:GeometryConverter.cs

示例2: CreateLabel

    protected override SharpMap.Rendering.Label CreateLabel(SharpMap.Geometries.Geometry feature, string text, float rotation, SharpMap.Styles.LabelStyle style, Map map, System.Drawing.Graphics g)
    {
      //System.Drawing.SizeF size = g.MeasureString(text, style.Font);

      System.Drawing.PointF position = map.WorldToImage(feature.GetBoundingBox().GetCentroid());
      //position.X = position.X - size.Width * (short)style.HorizontalAlignment * 0.5f;
      //position.Y = position.Y - size.Height * (short)style.VerticalAlignment * 0.5f;
      if (position.X /*- size.Width*/ > map.Size.Width || position.X /*+ size.Width */< 0 ||
        position.Y /*- size.Height*/ > map.Size.Height || position.Y /*+ size.Height*/ < 0)
        return null;
      else
      {
        SharpMap.Rendering.Label lbl;

        if (!style.CollisionDetection)
          lbl = new SharpMap.Rendering.Label(text, position, rotation, this.Priority, null, style);
        else
        {
          //Collision detection is enabled so we need to measure the size of the string
          lbl = new SharpMap.Rendering.Label(text, position, rotation, this.Priority,
            new SharpMap.Rendering.LabelBox(position.X /*- size.Width * 0.5f*/ - style.CollisionBuffer.Width, position.Y + /*size.Height * 0.5f*/ + style.CollisionBuffer.Height,
            /*size.Width +*/ 2f * style.CollisionBuffer.Width, /*size.Height +*/ style.CollisionBuffer.Height * 2f), style);
        }
        if (feature.GetType() == typeof(SharpMap.Geometries.LineString))
        {
          SharpMap.Geometries.LineString line = feature as SharpMap.Geometries.LineString;
          if (line.Length / map.PixelSize > 40/*size.Width*/) //Only label feature if it is long enough
            CalculateLabelOnLinestring(line, ref lbl, map);
          else
            return null;
        }

        return lbl;
      }
    }
开发者ID:diegowald,项目名称:intellitrack,代码行数:35,代码来源:HtmlLabel.cs

示例3: GetWmsLayerNode

		private static XmlNode GetWmsLayerNode(SharpMap.Layers.ILayer layer, XmlDocument doc)
		{
			XmlNode LayerNode = doc.CreateNode(XmlNodeType.Element, "Layer", wmsNamespaceURI);
			LayerNode.AppendChild(CreateElement("Name", layer.LayerName, doc, false, wmsNamespaceURI));
			LayerNode.AppendChild(CreateElement("Title", layer.LayerName, doc, false, wmsNamespaceURI));
			//If this is a grouplayer, add childlayers recursively
			if (layer.GetType() == typeof(SharpMap.Layers.LayerGroup))
				foreach (SharpMap.Layers.Layer childlayer in ((SharpMap.Layers.LayerGroup)layer).Layers)
					LayerNode.AppendChild(GetWmsLayerNode(childlayer, doc));		
			
			LayerNode.AppendChild(GenerateBoundingBoxElement(layer.Envelope, layer.SRID, doc));

			return LayerNode;
		}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:14,代码来源:Capabilities.cs

示例4: LegendDiv

    private HtmlGenericControl LegendDiv(SharpMap.Layers.ILayer myLayer)
    {
        HtmlGenericControl legendDiv = new HtmlGenericControl("div");
        legendDiv.Style.Add("width", "2em");
        legendDiv.Style.Add("overflow", "hidden");
        legendDiv.Style.Add("position", "absolute");
        legendDiv.Style.Add("margin-left", "0.5em");
        legendDiv.Style.Add("margin-bottom", "0px");
        if (myLayer.GetType() == typeof(SharpMap.Layers.VectorLayer))
        {
            SharpMap.Layers.VectorLayer myVectorLayer = (myLayer as SharpMap.Layers.VectorLayer);

            SharpMap.Styles.VectorStyle myStyle = new SharpMap.Styles.VectorStyle();
            if (myVectorLayer.Theme != null)
            {
                if (myVectorLayer.Theme.GetType() == typeof(SharpMap.Rendering.Thematics.CustomTheme))
                {
                    SharpMap.Rendering.Thematics.CustomTheme myTheme = (myVectorLayer.Theme as SharpMap.Rendering.Thematics.CustomTheme);
                    myStyle = (myTheme.DefaultStyle as SharpMap.Styles.VectorStyle);
                }
                else if (myVectorLayer.Theme.GetType() == typeof(SharpMap.Rendering.Thematics.GradientTheme))
                {
                    SharpMap.Rendering.Thematics.GradientTheme myTheme = (myVectorLayer.Theme as SharpMap.Rendering.Thematics.GradientTheme);
                    myStyle = (myTheme.MinStyle as SharpMap.Styles.VectorStyle);
                }
            }
            else
                myStyle = myVectorLayer.Style;

            if (myStyle.Outline.Color.Name.ToString() != "Black")
            {
                string lineStyle = (myStyle.Outline.DashStyle.ToString() == "Dash") ? "dotted" : "solid";
                legendDiv.Style.Add("border", lineStyle + " " + myStyle.Outline.Width.ToString() + "px " + ColorToHex(myStyle.Outline.Color));
                legendDiv.Style.Add("height", "1em");
            }
            else
            {
                string lineStyle = (myStyle.Line.DashStyle.ToString() == "Dash") ? "dotted" : "solid";
                legendDiv.Style.Add("border-bottom", lineStyle + " " + myStyle.Line.Width.ToString() + "px " + ColorToHex(myStyle.Line.Color));
                legendDiv.Style.Add("height", "0.8em");
            }

            System.Drawing.SolidBrush fillBrush = (myVectorLayer.Style.Fill as System.Drawing.SolidBrush);
            if (fillBrush.Color.Name.ToString() != "Black")
            {
                HtmlGenericControl fillDiv = new HtmlGenericControl("div");
                fillDiv.Style.Add("border-left", "solid 2em " + ColorToHex(fillBrush.Color));
                fillDiv.Style.Add("height", "1.2em");
                fillDiv.Style.Add("overflow", "hidden");
                fillDiv.Style.Add("opacity ", ColorAlpha(fillBrush.Color) + "%");
                fillDiv.Style.Add("filter", "ALPHA(opacity=" + ColorAlpha(fillBrush.Color) + ")");
                legendDiv.Controls.Add(fillDiv);
            }
        }
        return legendDiv;
    }
开发者ID:vz0,项目名称:custom-gis-server,代码行数:56,代码来源:Default.aspx.cs


注:本文中的SharpMap.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。