本文整理汇总了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);
}
示例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();
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例9: FeatureEditor
public FeatureEditor(ICoordinateConverter coordinateConverter, ILayer layer, IFeature feature, VectorStyle vectorStyle)
{
CoordinateConverter = coordinateConverter;
Layer = layer;
SourceFeature = feature;
VectorStyle = vectorStyle;
TopologyRules = new List<IFeatureRelationEditor>();
}
示例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;
}
示例11: OnInitializeDefaultStyle
protected override void OnInitializeDefaultStyle()
{
Style = new VectorStyle
{
GeometryType = typeof(ILineString),
Fill = new SolidBrush(Color.Tomato),
Line = new Pen(Color.SteelBlue, 3)
};
}
示例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();
}
示例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);
}
示例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;
}
示例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;
}