本文整理汇总了C#中IStyle.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IStyle.GetType方法的具体用法?C# IStyle.GetType怎么用?C# IStyle.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStyle
的用法示例。
在下文中一共展示了IStyle.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
// todo:
// try to remove the feature argument. LabelStyle should already contain the feature specific text
// The visible feature iterator should create this LabelStyle
public static void Draw(SKCanvas canvas, IViewport viewport, IStyle style, IFeature feature,
IGeometry geometry, IDictionary<int, SKBitmapInfo> symbolBitmapCache)
{
var point = geometry as Point;
var destination = viewport.WorldToScreen(point);
if (style is LabelStyle) // case 1) LabelStyle
{
LabelRenderer.Draw(canvas, (LabelStyle) style, feature, (float) destination.X, (float) destination.Y);
}
else if (style is SymbolStyle)
{
var symbolStyle = (SymbolStyle)style;
if ( symbolStyle.BitmapId >= 0) // case 2) Bitmap Style
{
DrawPointWithBitmapStyle(canvas, symbolStyle, destination, symbolBitmapCache);
}
else // case 3) SymbolStyle without bitmap
{
DrawPointWithSymbolStyle(canvas, symbolStyle, destination, symbolStyle.SymbolType);
}
}
else if (style is VectorStyle) // case 4) VectorStyle
{
DrawPointWithVectorStyle(canvas, (VectorStyle) style, destination);
}
else
{
throw new Exception($"Style of type '{style.GetType()}' is not supported for points");
}
}
示例2: Validate
private static void Validate(Map map, IGraphics g, IGeometry geom, IStyle style)
{
if (map == null)
throw new ArgumentNullException("map");
if (g == null)
throw new ArgumentNullException("g");
if (geom == null)
throw new ArgumentNullException("geom");
if (style == null)
throw new ArgumentNullException("style");
if (!(style is VectorStyle))
{
string s = String.Format("VectorStyle expected but was {0}", style.GetType().Name);
throw new ArgumentException(s);
}
}