本文整理汇总了C#中PointD.Grow方法的典型用法代码示例。如果您正苦于以下问题:C# PointD.Grow方法的具体用法?C# PointD.Grow怎么用?C# PointD.Grow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointD
的用法示例。
在下文中一共展示了PointD.Grow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getWeightedVertices
private List<SDMinVertex> getWeightedVertices(Polyline polyline)
{
List<SDMinVertex> result = new List<SDMinVertex>();
for (int i = 0; i < polyline.Paths.Count; i++)
for (int j = 0; j < polyline.Paths[i].Vertices.Count; j++)
if (j != 0 && j != polyline.Paths[i].Vertices.Count - 1)
{
SDMinVertex vertex = getWeightedVertex(polyline, i, j);
vertex.Previous = result[result.Count - 1];
vertex.Previous.Next = vertex;
result.Add(vertex);
}
else
{
SDMinVertex vertex = new SDMinVertex();
vertex.PathIndex = i;
vertex.PointIndex = j;
BoundingRectangle br = new PointD(polyline.Paths[i].Vertices[j]).GetBoundingRectangle();
br.Grow(PlanimetryAlgorithms.Tolerance);
vertex.BoundingRectangle = br;
vertex.Weight = double.PositiveInfinity;
if (j != 0)
{
vertex.Previous = result[result.Count - 1];
vertex.Previous.Next = vertex;
}
result.Add(vertex);
}
Comparison<SDMinVertex> comparision = delegate(SDMinVertex weight1, SDMinVertex weight2)
{
if(double.IsInfinity(weight1.Weight) && double.IsInfinity(weight2.Weight))
return 0;
if (double.IsInfinity(weight1.Weight))
return 1;
if (double.IsInfinity(weight2.Weight))
return -1;
if (weight1 == weight2)
return 0;
return weight1.Weight > weight2.Weight ? 1 : -1;
};
// sort list
result.Sort(comparision);
return result;
}
示例2: getWeightedVertex
private SDMinVertex getWeightedVertex(Polyline polyline, int pathIndex, int pointIndex)
{
SDMinVertex result = new SDMinVertex();
result.PathIndex = pathIndex;
result.PointIndex = pointIndex;
result.Weight = getVertexWeight(polyline, pathIndex, pointIndex);
BoundingRectangle br = new PointD(polyline.Paths[pathIndex].Vertices[pointIndex]).GetBoundingRectangle();
br.Grow(PlanimetryAlgorithms.Tolerance);
result.BoundingRectangle = br;
return result;
}