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


C# Styles.VectorStyle类代码示例

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


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

示例1: ReturnMaxColorForMaxValue

        public void ReturnMaxColorForMaxValue()
        {
            var minVectorStyle = new VectorStyle { Fill = new SolidBrush(Color.Red) };
            var maxVectorStyle = new VectorStyle { Fill = new SolidBrush(Color.Blue) };

            var theme = new GradientTheme("red to blue", 10.0, 100.123, minVectorStyle, maxVectorStyle, null, null, null);

            var color = theme.GetFillColor(100.123);

            AssertColor(Color.Blue, color);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:11,代码来源:GradientThemeTest.cs

示例2: Page_Load

	protected void Page_Load(object sender, EventArgs e)
	{
		//Set up the map. We use the method in the App_Code folder for initializing the map
		myMap = MapHelper.InitializeMap(new System.Drawing.Size((int)imgMap.Width.Value,(int)imgMap.Height.Value));
		//Set a gradient theme on the countries layer, based on Population density
		SharpMap.Rendering.Thematics.CustomTheme iTheme = new SharpMap.Rendering.Thematics.CustomTheme(GetCountryStyle);
		SharpMap.Styles.VectorStyle defaultstyle = new SharpMap.Styles.VectorStyle();
		defaultstyle.Fill = Brushes.Gray;
		iTheme.DefaultStyle = defaultstyle;
		(myMap.Layers[0] as SharpMap.Layers.VectorLayer).Theme = iTheme;
		//Turn off the river layer and label-layers
		myMap.Layers[1].Enabled = false;
		myMap.Layers[3].Enabled = false;
		myMap.Layers[4].Enabled = false;
		
		if (Page.IsPostBack) 
		{
			//Page is post back. Restore center and zoom-values from viewstate
			myMap.Center = (ICoordinate)ViewState["mapCenter"];
			myMap.Zoom = (double)ViewState["mapZoom"];
		}
		else
		{
			//This is the initial view of the map. Zoom to the extents of the map:
			//myMap.ZoomToExtents();
            myMap.Center = GeometryFactory.CreateCoordinate(0, 0);
			myMap.Zoom = 360;
			//Create the map
			GenerateMap();
		}
	}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:31,代码来源:Bins.aspx.cs

示例3: UpdateMinMaxForLineStrings

 private static void UpdateMinMaxForLineStrings(VectorStyle defaultStyle, int sizeMin, int sizeMax, VectorStyle minStyle, VectorStyle maxStyle, Color minColor, Color maxColor, float minOutlineSize, float maxOutlineSize, bool skipSizes)
 {
     minStyle.Line = CreatePen(minColor, skipSizes ? 4 : sizeMin, defaultStyle.Line);
     maxStyle.Line = CreatePen(maxColor, skipSizes ? 12 : sizeMax, defaultStyle.Line);
     minStyle.Outline = CreatePen(defaultStyle.Outline.Color, minOutlineSize, defaultStyle.Outline);
     maxStyle.Outline = CreatePen(defaultStyle.Outline.Color, maxOutlineSize, defaultStyle.Outline);
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:7,代码来源:ThemeFactory.cs

示例4: UpdateMinMaxForPolygons

 private static void UpdateMinMaxForPolygons(VectorStyle defaultStyle, VectorStyle minStyle, VectorStyle maxStyle, Color minColor, Color maxColor, float minOutlineSize, float maxOutlineSize)
 {
     minStyle.Fill = new SolidBrush(minColor);
     maxStyle.Fill = new SolidBrush(maxColor);
     minStyle.Outline = CreatePen(defaultStyle.Outline.Color, minOutlineSize, defaultStyle.Outline);
     maxStyle.Outline = CreatePen(defaultStyle.Outline.Color, maxOutlineSize, defaultStyle.Outline);
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:7,代码来源:ThemeFactory.cs

示例5: GetCountryStyle

	/// <summary>
	/// This method is used for determining the color of country based on attributes.
	/// It is used as a delegate for the CustomTheme class.
	/// </summary>
	/// <param name="row"></param>
	/// <returns></returns>
	private SharpMap.Styles.VectorStyle GetCountryStyle(SharpMap.Data.FeatureDataRow row)
	{
		SharpMap.Styles.VectorStyle style = new SharpMap.Styles.VectorStyle();
		switch (row["NAME"].ToString().ToLower())
		{
			case "denmark": //If country name is Danmark, fill it with green
				style.Fill = Brushes.Green;
				return style;
			case "united states": //If country name is USA, fill it with Blue and add a red outline
				style.Fill = Brushes.Blue;
				style.Outline = Pens.Red;
				return style;
			case "china": //If country name is China, fill it with red
				style.Fill = Brushes.Red;
				return style;
			default:
				break;
		}
		//If country name starts with S make it yellow
		if (row["NAME"].ToString().StartsWith("S"))
		{
			style.Fill = Brushes.Yellow;
			return style;
		}
		// If geometry is a (multi)polygon and the area of the polygon is less than 30, make it cyan
		else if (row.Geometry.GetType() == typeof(IMultiPolygon) && (row.Geometry as IMultiPolygon).Area < 30 ||
			row.Geometry.GetType() == typeof(IPolygon) && (row.Geometry as IPolygon).Area < 30 )
		{
			style.Fill = Brushes.Cyan;
			return style;
		}
		else //None of the above -> Use the default style
			return null;
	}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:40,代码来源:Bins.aspx.cs

示例6: Clone

        public VectorStyle Clone()
        {
            VectorStyle vs = null;
            lock (_fillStyle)
            {
                vs = new VectorStyle()
                {
                    _fillStyle = _fillStyle.Clone() as Brush,
                    _lineOffset = _lineOffset,
                    _lineStyle = _lineStyle.Clone() as Pen,
                    _outline = _outline,
                    _outlineStyle = _outlineStyle.Clone() as Pen,
                    _PointBrush = _PointBrush.Clone() as Brush,
                    _PointSize = _PointSize,
                    _symbol = (_symbol != null ? _symbol.Clone() as Image : null),
                    _symbolOffset = new PointF(_symbolOffset.X, _symbolOffset.Y),
                    _symbolRotation = _symbolRotation,
                    _symbolScale = _symbolScale,
                    PointSymbolizer = PointSymbolizer,
                    LineSymbolizer = LineSymbolizer,
                    PolygonSymbolizer = PolygonSymbolizer

                };
            }
            return vs;
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:26,代码来源:VectorStyle.cs

示例7: GetCountryStyle

 /// <summary>
 /// This method is used for determining the style
 /// It is used as a delegate for the CustomTheme class.
 /// </summary>
 /// <param name="row"></param>
 /// <returns></returns>
 private VectorStyle GetCountryStyle(FeatureDataRow row)
 {
     VectorStyle s = new VectorStyle();
     s.Fill = new SolidBrush(Color.Green);
     s.Symbol = GetPieChart(row);
     return s;
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:13,代码来源:PieCharts.aspx.cs

示例8: VectorLayer

 /// <summary>
 /// Initializes a new layer
 /// </summary>
 /// <param name="layername">Name of layer</param>
 public VectorLayer(string layername)
 {
     _Style = new VectorStyle();
     UpdateStyleGeometry();
     name = layername;
     // _SmoothingMode = SmoothingMode.AntiAlias;
     _SmoothingMode = SmoothingMode.HighSpeed;
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:12,代码来源:VectorLayer.cs

示例9: FeatureEditor

 public FeatureEditor(ICoordinateConverter coordinateConverter, ILayer layer, IFeature feature, VectorStyle vectorStyle)
 {
     CoordinateConverter = coordinateConverter;
     Layer = layer;
     SourceFeature = feature;
     VectorStyle = vectorStyle;
     TopologyRules = new List<IFeatureRelationEditor>();
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:8,代码来源:FeatureEditor.cs

示例10: GetCountryStyle

    /// <summary>
    /// This method is used for determining the style
    /// It is used as a delegate for the CustomTheme class.
    /// </summary>
    /// <param name="row"></param>
    /// <returns></returns>
    private SharpMap.Styles.VectorStyle GetCountryStyle(SharpMap.Data.FeatureDataRow row)
    {

        SharpMap.Styles.VectorStyle s = new SharpMap.Styles.VectorStyle();
        s.Fill = new SolidBrush(Color.Green);
        s.Symbol = GetPieChart(row);
        return s;
    }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:14,代码来源:PieCharts.aspx.cs

示例11: OnInitializeDefaultStyle

 protected override void OnInitializeDefaultStyle()
 {
     Style = new VectorStyle
     {
         GeometryType = typeof(ILineString),
         Fill = new SolidBrush(Color.Tomato),
         Line = new Pen(Color.SteelBlue, 3)
     };
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:9,代码来源:NetworkCoverageSegmentLayer.cs

示例12: FeatureInteractor

 public FeatureInteractor(ILayer layer, IFeature feature, VectorStyle vectorStyle, IEditableObject editableObject)
 {
     Layer = layer;
     SourceFeature = feature;
     VectorStyle = vectorStyle;
     FeatureRelationEditors = new List<IFeatureRelationInteractor>();
     EditableObject = editableObject;
     CreateTrackers();
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:9,代码来源:FeatureInteractor.cs

示例13: GenerateThemeWithMaxDoubleAndMinDoubleValue

        public void GenerateThemeWithMaxDoubleAndMinDoubleValue()
        {
            var minVectorStyle = new VectorStyle { Fill = new SolidBrush(Color.Red) };
            var maxVectorStyle = new VectorStyle { Fill = new SolidBrush(Color.Blue) };

            var theme = new GradientTheme("red to blue", double.MinValue, double.MaxValue, minVectorStyle, maxVectorStyle, null, null, null);

            var color = theme.GetFillColor(100);

            AssertColor(Color.FromArgb(255, 127, 0, 127), color);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:11,代码来源:GradientThemeTest.cs

示例14: CreateCategorialTheme

        public static CategorialTheme CreateCategorialTheme(string attribute, VectorStyle defaultStyle, ColorBlend blend, 
            int numberOfClasses, IList<IComparable> values, List<string> categories)
        {
            if (defaultStyle == null)
            {
                defaultStyle = new VectorStyle
                                   {
                                       GeometryType = typeof (IPolygon)
                                   };
            }

            var categorialTheme = new CategorialTheme(attribute, defaultStyle);

            for (int i = 0; i < numberOfClasses; i++)
            {
                string label = (categories != null)
                                   ? categories[i]
                                   : values[i].ToString();

                Color color = (numberOfClasses > 1)
                                  ? blend.GetColor((float) i/(numberOfClasses - 1))
                                  : ((SolidBrush) defaultStyle.Fill).Color;
                
                var vectorStyle = (VectorStyle) defaultStyle.Clone();

                if (defaultStyle.GeometryType == typeof(IPoint))
                {
                    vectorStyle.Fill = new SolidBrush(color);
                    vectorStyle.Line.Width = 16;
                    vectorStyle.Shape = defaultStyle.Shape;
                }
                else if ((defaultStyle.GeometryType == typeof(IPolygon)) || (defaultStyle.GeometryType == typeof(IMultiPolygon)))
                {
                    vectorStyle.Fill = new SolidBrush(color);
                }
                else if ((defaultStyle.GeometryType == typeof(ILineString)) || (defaultStyle.GeometryType == typeof(IMultiLineString)))
                {
                    vectorStyle.Line = new Pen(color, defaultStyle.Line.Width);
                }
                else
                {
                    vectorStyle.Fill = new SolidBrush(color);
                }

                CategorialThemeItem categorialThemeItem = (values[i] != null)
                                                              ? new CategorialThemeItem(label, vectorStyle, vectorStyle.LegendSymbol, values[i])
                                                              : new CategorialThemeItem(label, vectorStyle, vectorStyle.LegendSymbol);

                
                categorialTheme.AddThemeItem(categorialThemeItem);
            }

            return categorialTheme;
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:54,代码来源:ThemeFactory.cs

示例15: GetStyle

        /// <summary>
        /// Returns the style based on a feature
        /// </summary>
        /// <param name="attribute">Attribute to calculate color from</param>
        /// <returns>Color</returns>
        public SharpMap.Styles.IStyle GetStyle(FeatureDataRow attribute)
        {
            VectorStyle vs = new VectorStyle();

            if (!_brushes.ContainsKey(attribute.Geometry))
                _brushes[attribute.Geometry] = new SolidBrush(Color.FromArgb(rand.Next(255), rand.Next(255), rand.Next(255)));

            vs.Fill = _brushes[attribute.Geometry];
            vs.Outline = new Pen(Color.Black);
            vs.EnableOutline = true;
            return vs;
        }
开发者ID:stophun,项目名称:fdotoolbox,代码行数:17,代码来源:RandomizedTheme.cs


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