本文整理汇总了C#中Envelope.ExpandBy方法的典型用法代码示例。如果您正苦于以下问题:C# Envelope.ExpandBy方法的具体用法?C# Envelope.ExpandBy怎么用?C# Envelope.ExpandBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Envelope
的用法示例。
在下文中一共展示了Envelope.ExpandBy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindGeoNearPoint
public static FeatureDataRow FindGeoNearPoint(GeoAPI.Geometries.IPoint point, VectorLayer layer, double amountGrow)
{
var box = new Envelope(point.Coordinate);
box.ExpandBy(amountGrow);
var fds = new FeatureDataSet();
layer.DataSource.ExecuteIntersectionQuery(box, fds);
FeatureDataRow result = null;
var minDistance = double.MaxValue;
foreach (FeatureDataTable fdt in fds.Tables)
{
foreach (FeatureDataRow fdr in fdt.Rows)
{
if (fdr.Geometry != null)
{
var distance = point.Distance(fdr.Geometry);
if (distance < minDistance)
{
result = fdr;
minDistance = distance;
}
}
}
}
return result;
}
示例2: Create
private void Create()
{
if (_subdiv != null) return;
Envelope siteEnv = DelaunayTriangulationBuilder.Envelope(_siteCoords);
_diagramEnv = siteEnv;
// add a buffer around the final envelope
double expandBy = Math.Max(_diagramEnv.Width, _diagramEnv.Height);
_diagramEnv.ExpandBy(expandBy);
if (_clipEnv != null)
_diagramEnv.ExpandToInclude(_clipEnv);
var vertices = DelaunayTriangulationBuilder.ToVertices(_siteCoords);
_subdiv = new QuadEdgeSubdivision(siteEnv, _tolerance);
IncrementalDelaunayTriangulator triangulator = new IncrementalDelaunayTriangulator(_subdiv);
triangulator.InsertSites(vertices);
}
示例3: FindNonGabrielPoint
// public static final String DEBUG_SEG_SPLIT = "C:\\proj\\CWB\\test\\segSplit.jml";
/// <summary>
/// Given a set of points stored in the kd-tree and a line segment defined by
/// two points in this set, finds a <see cref="Coordinate"/> in the circumcircle of
/// the line segment, if one exists. This is called the Gabriel point - if none
/// exists then the segment is said to have the Gabriel condition. Uses the
/// heuristic of finding the non-Gabriel point closest to the midpoint of the
/// segment.
/// </summary>
/// <param name="seg">the line segment</param>
/// <returns>
/// A point which is non-Gabriel,
/// or null if no point is non-Gabriel
/// </returns>
private Coordinate FindNonGabrielPoint(Segment seg)
{
Coordinate p = seg.Start;
Coordinate q = seg.End;
// Find the mid point on the line and compute the radius of enclosing circle
Coordinate midPt = new Coordinate((p.X + q.X) / 2.0, (p.Y + q.Y) / 2.0);
double segRadius = p.Distance(midPt);
// compute envelope of circumcircle
Envelope env = new Envelope(midPt);
env.ExpandBy(segRadius);
// Find all points in envelope
ICollection<KdNode<Vertex>> result = _kdt.Query(env);
// For each point found, test if it falls strictly in the circle
// find closest point
Coordinate closestNonGabriel = null;
double minDist = Double.MaxValue;
foreach (KdNode<Vertex> nextNode in result)
{
Coordinate testPt = nextNode.Coordinate;
// ignore segment endpoints
if (testPt.Equals2D(p) || testPt.Equals2D(q))
continue;
double testRadius = midPt.Distance(testPt);
if (testRadius < segRadius)
{
// double testDist = seg.distance(testPt);
double testDist = testRadius;
if (closestNonGabriel == null || testDist < minDist)
{
closestNonGabriel = testPt;
minDist = testDist;
}
}
}
return closestNonGabriel;
}
示例4: ComputeBoundingBox
// ==================================================================
private void ComputeBoundingBox()
{
Envelope vertexEnv = ComputeVertexEnvelope(_initialVertices);
Envelope segEnv = ComputeVertexEnvelope(_segVertices);
Envelope allPointsEnv = new Envelope(vertexEnv);
allPointsEnv.ExpandToInclude(segEnv);
double deltaX = allPointsEnv.Width * 0.2;
double deltaY = allPointsEnv.Height * 0.2;
double delta = Math.Max(deltaX, deltaY);
_computeAreaEnv = new Envelope(allPointsEnv);
_computeAreaEnv.ExpandBy(delta);
}
示例5: FindGeoNearPoint
private FeatureDataRow FindGeoNearPoint(object/*Coordinate*/ coord)
{
var mapPosition = (Coordinate) coord;
var env = new Envelope(mapPosition);
env.ExpandBy(5 * Map.PixelWidth);
var g = NetTopologySuite.Geometries.Prepared.PreparedGeometryFactory.Prepare(Map.Factory.ToGeometry(env));
var fdrs = new List<Tuple<double, FeatureDataRow>>();
var fds = new FeatureDataSet();
var tableCount = 0;
var layersToQuery = GetLayersToQuery(Map);
for (var i = layersToQuery.Count - 1; i >= 0; i--)
{
if (_cts.Token.IsCancellationRequested)
{
Logger.Debug("Cancellation requested");
return null;
}
var l = layersToQuery[i];
if (l.Enabled && l.MinVisible < Map.Zoom &&
l.MaxVisible >= Map.Zoom)
{
if (!l.IsQueryEnabled) continue;
l.ExecuteIntersectionQuery(env, fds);
for (var j = tableCount; j < fds.Tables.Count; j++)
{
var fdt = fds.Tables[j];
for (var k = 0; k < fdt.Rows.Count; k++)
{
var fdr = (FeatureDataRow) fdt.Rows[k];
if (g.Intersects(fdr.Geometry))
{
var distance = g.Geometry.InteriorPoint.Distance(fdr.Geometry);
if (fdr.Geometry.Dimension == Dimension.Surface)
distance += 5* Map.PixelWidth;
fdrs.Add(Tuple.Create(distance, fdr));
}
}
}
tableCount = fds.Tables.Count;
}
}
if (fdrs.Count > 0)
{
fdrs.Sort((t1, t2) => t1.Item1.CompareTo(t2.Item1));
return fdrs[0].Item2;
}
return null;
}
示例6: CheckEnvelope
private void CheckEnvelope()
{
if (_distance < 0.0) return;
double padding = _distance * MaxEnvDiffFrac;
if (padding == 0.0) padding = 0.001;
var expectedEnv = new Envelope(_input.EnvelopeInternal);
expectedEnv.ExpandBy(_distance);
var bufEnv = new Envelope(_result.EnvelopeInternal);
bufEnv.ExpandBy(padding);
if (!bufEnv.Contains(expectedEnv))
{
_isValid = false;
_errorMsg = "Buffer envelope is incorrect";
_errorIndicator = _result;
}
Report("Envelope");
}