本文整理汇总了C#中IEnvelope.ExpandToInclude方法的典型用法代码示例。如果您正苦于以下问题:C# IEnvelope.ExpandToInclude方法的具体用法?C# IEnvelope.ExpandToInclude怎么用?C# IEnvelope.ExpandToInclude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEnvelope
的用法示例。
在下文中一共展示了IEnvelope.ExpandToInclude方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExpandEnvelope
/// <summary>
/// Expands the given Envelope to include the coordinates in the sequence.
/// Allows implementing classes to optimize access to coordinate values.
/// </summary>
/// <param name="env">The envelope to expand.</param>
/// <returns>A reference to the expanded envelope.</returns>
public override IEnvelope ExpandEnvelope(IEnvelope env)
{
for (int i = 0; i < coords.Length; i += dimension )
env.ExpandToInclude(coords[i], coords[i + 1]);
return env;
}
示例2: ExpandEnvelope
/// <summary>
/// Expands the given Envelope to include the coordinates in the sequence.
/// Allows implementing classes to optimize access to coordinate values.
/// </summary>
/// <param name="env">The envelope to expand.</param>
/// <returns>A reference to the expanded envelope.</returns>
public IEnvelope ExpandEnvelope(IEnvelope env)
{
for (int i = 0; i < coordinates.Length; i++ )
env.ExpandToInclude(coordinates[i]);
return env;
}
示例3: QuadTreeOld
/// <summary>
/// Creates a node and either splits the objects recursively into sub-nodes, or stores them at the node depending on the heuristics.
/// Tree is built top->down
/// </summary>
/// <param name="objList">Geometries to index</param>
/// <param name="depth">Current depth of tree</param>
/// <param name="heurdata">Heuristics data</param>
public QuadTreeOld(List<BoxObjects> objList, uint depth, Heuristic heurdata)
{
_Depth = depth;
_box = new Envelope(objList[0].box);
for (int i = 0; i < objList.Count;i++ )
_box.ExpandToInclude(objList[i].box);
// test our build heuristic - if passes, make children
if (depth < heurdata.maxdepth && objList.Count > heurdata.mintricnt &&
(objList.Count > heurdata.tartricnt || ErrorMetric(_box) > heurdata.minerror))
{
List<BoxObjects>[] objBuckets = new List<BoxObjects>[2]; // buckets of geometries
objBuckets[0] = new List<BoxObjects>();
objBuckets[1] = new List<BoxObjects>();
string longaxis = LongestAxis(_box); // longest axis
double geoavg = 0; // geometric average - midpoint of ALL the objects
// go through all bbox and calculate the average of the midpoints
double frac = 1.0f / objList.Count;
for (int i = 0; i < objList.Count;i++ )
{
if (longaxis=="X")
geoavg += objList[i].box.Centre.X * frac;
else
geoavg += objList[i].box.Centre.Y * frac;
}
// // bucket bbox based on their midpoint's side of the geo average in the longest axis
for (int i = 0; i < objList.Count;i++ )
{
if(longaxis=="X")
objBuckets[geoavg > objList[i].box.Centre.X ? 1 : 0].Add(objList[i]);
else
objBuckets[geoavg > objList[i].box.Centre.Y ? 1 : 0].Add(objList[i]);
}
//If objects couldn't be splitted, just store them at the leaf
//TODO: Try splitting on another axis
if (objBuckets[0].Count == 0 || objBuckets[1].Count == 0)
{
_child0 = null;
_child1 = null;
// copy object list
_objList = objList;
}
else
{
// create new children using the buckets
_child0 = new QuadTreeOld(objBuckets[0], depth + 1, heurdata);
_child1 = new QuadTreeOld(objBuckets[1], depth + 1, heurdata);
}
}
else
{
// otherwise the build heuristic failed, this is
// set the first child to null (identifies a leaf)
_child0 = null;
_child1 = null;
// copy object list
_objList = objList;
}
}