本文整理汇总了C#中Dimensions.HasFlag方法的典型用法代码示例。如果您正苦于以下问题:C# Dimensions.HasFlag方法的具体用法?C# Dimensions.HasFlag怎么用?C# Dimensions.HasFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dimensions
的用法示例。
在下文中一共展示了Dimensions.HasFlag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseCoordinate
private CoordinateInfo ParseCoordinate(WktTokenQueue tokens, Dimensions dimensions)
{
var token = tokens.Dequeue(WktTokenType.Number);
var x = double.Parse(token.Value, CultureInfo.InvariantCulture);
token = tokens.Dequeue(WktTokenType.Number);
var y = double.Parse(token.Value, CultureInfo.InvariantCulture);
var z = double.NaN;
var m = double.NaN;
var optional = ParseOptionalOrdinates(tokens);
if (optional.Count > 0)
{
if (dimensions.HasFlag(Dimensions.M) && !dimensions.HasFlag(Dimensions.Z))
{
m = optional[0];
}
else
{
z = optional[0];
if (optional.Count > 1)
m = optional[1];
}
}
if (!double.IsNaN(z) && !double.IsNaN(m))
return new CoordinateInfo { X = x, Y = y, Z = z, M = m };
if (!double.IsNaN(z))
return new CoordinateInfo { X = x, Y = y, Z = z };
if (!double.IsNaN(m))
return new CoordinateInfo { X = x, Y = y, M = m };
return new CoordinateInfo { X = x, Y = y };
}
示例2: AppendDimensions
private void AppendDimensions(StringBuilder builder, Dimensions dimensions)
{
if (_settings.DimensionFlag && _settings.MaxDimesions > 2)
{
if (dimensions.HasFlag(Dimensions.Z) || dimensions.HasFlag(Dimensions.M))
builder.Append(" ");
if (dimensions.HasFlag(Dimensions.Z) && _settings.MaxDimesions > 2)
builder.Append("Z");
if (dimensions.HasFlag(Dimensions.M) && _settings.MaxDimesions > 3)
builder.Append("M");
}
}