本文整理汇总了C#中SharpMap.Styles.VectorStyle类的典型用法代码示例。如果您正苦于以下问题:C# VectorStyle类的具体用法?C# VectorStyle怎么用?C# VectorStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VectorStyle类属于SharpMap.Styles命名空间,在下文中一共展示了VectorStyle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: GetStyle
private static VectorStyle GetStyle()
{
VectorStyle style = new VectorStyle
{
Fill = Brushes.AntiqueWhite,
Line = Pens.Red,
EnableOutline = true,
Outline = Pens.Black,
Symbol = new Bitmap(10, 10)
};
return style;
}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:13,代码来源:LineStringMutatorTest.cs
示例17: RandomVectorStyleNoSymbols
/// <summary>
/// returns a Random VectorStyle with no symbols.
///
/// </summary>
/// <returns></returns>
public static IVectorStyle RandomVectorStyleNoSymbols()
{
VectorStyle vs = new VectorStyle();
vs.EnableOutline = random.Next(0, 2) == 1;
vs.Fill = RandomBrush();
vs.Line = RandomPen();
vs.Outline = RandomPen();
return vs;
}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:19,代码来源:RandomStyle.cs
示例18: FromVectorStyle
public static SharpDXVectorStyle FromVectorStyle(RenderTarget rt, Factory f, VectorStyle vs)
{
var res = new SharpDXVectorStyle
{
// Global
Enabled = vs.Enabled,
MinVisible = vs.MinVisible,
MaxVisible = vs.MaxVisible,
};
// Point
if (vs.PointColor != null)
{
res.PointColor = Converter.ToSharpDXBrush(rt, vs.PointColor);
res.PointSize = vs.PointSize;
}
if (vs.Symbol != null)
{
res.Symbol = Converter.ToSharpDXBitmap(rt, vs.Symbol as System.Drawing.Bitmap, vs.SymbolScale);
res.SymbolOffset = Converter.ToSharpDXPoint(vs.SymbolOffset);
//res.SymbolScale = vs.SymbolScale;
res.SymbolRotation = vs.SymbolRotation;
}
// Line
if (vs.Line != null)
{
res.Line = Converter.ToSharpDXBrush(rt, vs.Line.Brush);
res.LineWidth = vs.Line.Width;
res.LineStrokeStyle = Converter.ToSharpDXStrokeStyle(f, vs.Line);
res.LineOffset = vs.LineOffset;
}
if (vs.Outline != null)
{
res.EnableOutline = vs.EnableOutline;
res.Outline = Converter.ToSharpDXBrush(rt, vs.Outline.Brush);
res.OutlineWidth = vs.Outline.Width;
res.OutlineStrokeStyle = Converter.ToSharpDXStrokeStyle(f, vs.Line);
}
// Fill
if (vs.Fill != null)
{
res.Fill = Converter.ToSharpDXBrush(rt, vs.Fill);
}
return res;
}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:48,代码来源:SharpDXVectorStyle.cs
示例19: CreateGradientTheme
/// <summary>
/// Creates a <see cref="GradientTheme"/>
/// </summary>
/// <param name="attribute">Name of the feature attribute</param>
/// <param name="defaultStyle">Default <see cref="VectorStyle"/> to base this theme on</param>
/// <param name="blend"><see cref="ColorBlend"/>
/// defining the min and max colors
/// Note: Silently assumes 2 Colors defined
/// </param>
/// <param name="minValue">Minimum value of the feature attribute values</param>
/// <param name="maxValue">Maximum value of the feature attribute values</param>
/// <param name="sizeMin">Minimum line/point size in pixels</param>
/// <param name="sizeMax">Maximum line/point size in pixels</param>
/// <param name="skipColors">Use the min and max colors (false) or the defaultStyle fill color (true)</param>
/// <param name="skipSizes">Let the size of a point depend on the value (false) or use the defaultStyle size (true)</param>
/// <param name="numberOfClasses">The number of classes (ThemeItems) to generate (default = 8)</param>
/// <returns>A new <see cref="GradientTheme"/></returns>
public static GradientTheme CreateGradientTheme(string attribute, VectorStyle defaultStyle, ColorBlend blend,
double minValue, double maxValue, int sizeMin, int sizeMax, bool skipColors, bool skipSizes, int numberOfClasses = 8)
{
if (defaultStyle == null)
{
defaultStyle = new VectorStyle { GeometryType = typeof(IPolygon) };
}
Color minColor = (skipColors) ? ((SolidBrush)defaultStyle.Fill).Color : blend.GetColor(0);
Color maxColor = (skipColors) ? ((SolidBrush)defaultStyle.Fill).Color : blend.GetColor(1);
var deltaWidth = (defaultStyle.Outline.Width - defaultStyle.Line.Width);
float minOutlineSize = deltaWidth + sizeMin;
float maxOutlineSize = deltaWidth + sizeMax;
// Use default styles if not working with VectorLayers (i.e. RegularGridCoverageLayers)
var minStyle = (VectorStyle)defaultStyle.Clone();
var maxStyle = (VectorStyle)defaultStyle.Clone();
minStyle.GeometryType = defaultStyle.GeometryType;
maxStyle.GeometryType = defaultStyle.GeometryType;
if (defaultStyle.GeometryType == typeof(IPoint))
{
UpdateMinMaxForPoints(defaultStyle, sizeMin, sizeMax, minStyle, maxStyle, minColor, maxColor, skipSizes);
}
else if ((defaultStyle.GeometryType == typeof(IPolygon)) || (defaultStyle.GeometryType == typeof(IMultiPolygon)))
{
UpdateMinMaxForPolygons(defaultStyle, minStyle, maxStyle, minColor, maxColor, minOutlineSize, maxOutlineSize);
}
else if ((defaultStyle.GeometryType == typeof(ILineString)) || (defaultStyle.GeometryType == typeof(IMultiLineString)))
{
UpdateMinMaxForLineStrings(defaultStyle, sizeMin, sizeMax, minStyle, maxStyle, minColor, maxColor, minOutlineSize, maxOutlineSize, skipSizes);
}
else
{
//use for unknown geometry..
minStyle.Fill = new SolidBrush(minColor);
maxStyle.Fill = new SolidBrush(maxColor);
minStyle.Outline = CreatePen(minColor, minOutlineSize, defaultStyle.Outline);
maxStyle.Outline = CreatePen(maxColor, maxOutlineSize, defaultStyle.Outline);
}
return new GradientTheme(attribute, minValue, maxValue, minStyle, maxStyle, blend, blend, null, numberOfClasses);
}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:63,代码来源:ThemeFactory.cs
示例20: CreateLayer
private static ILayer CreateLayer(string path, VectorStyle style)
{
FileInfo file = new FileInfo(path);
if (!file.Exists)
throw new FileNotFoundException("file not found", path);
string full = file.FullName;
string name = Path.GetFileNameWithoutExtension(full);
ILayer layer = new VectorLayer(name, new ShapeFile(full, true))
{
SRID = 900913,
CoordinateTransformation = LayerTools.Wgs84toGoogleMercator,
Style = style,
SmoothingMode = SmoothingMode.AntiAlias
};
return layer;
}
开发者ID:PedroMaitan,项目名称:sharpmap,代码行数:17,代码来源:Form2.cs
注:本文中的SharpMap.Styles.VectorStyle类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论