本文整理汇总了C#中Feature.CopyAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# Feature.CopyAttributes方法的具体用法?C# Feature.CopyAttributes怎么用?C# Feature.CopyAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Feature
的用法示例。
在下文中一共展示了Feature.CopyAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
/// <summary>
/// Executes the generate centroid FeatureSet Opaeration tool programaticaly.
/// Ping deleted static for external testing 01/2010
/// </summary>
/// <param name="input1">The input FeatureSet.</param>
/// <param name="output">The output FeatureSet.</param>
/// <param name="cancelProgressHandler">The progress handler.</param>
/// <returns></returns>
public bool Execute(IFeatureSet input1, IFeatureSet output, ICancelProgressHandler cancelProgressHandler)
{
// Validates the input and output data
if (input1 == null || output == null)
{
return false;
}
bool multiPoint = false;
foreach (IFeature f1 in input1.Features)
{
if (f1.NumGeometries > 1)
{
multiPoint = true;
}
}
output.FeatureType = multiPoint == false ? FeatureType.Point : FeatureType.MultiPoint;
int previous = 0;
int i = 0;
int maxFeature = input1.Features.Count;
output.CopyTableSchema(input1);
foreach (IFeature f in input1.Features)
{
if (cancelProgressHandler.Cancel)
{
return false;
}
IFeature fnew = new Feature(f.Centroid());
// Add the centroid to output
output.Features.Add(fnew);
fnew.CopyAttributes(f);
int current = Convert.ToInt32(Math.Round(i * 100D / maxFeature));
// only update when increment in percentage
if (current > previous)
{
cancelProgressHandler.Progress(string.Empty, current, current + TextStrings.progresscompleted);
}
previous = current;
i++;
}
output.SaveAs(output.Filename, true);
return true;
}
示例2: VoronoiPolygons
//.........这里部分代码省略.........
coords.Add(firstEdge.VVertexB.ToCoordinate());
Vector2 previous = firstEdge.VVertexB;
myEdges.Remove(myEdges[0]);
Vector2 start = firstEdge.VVertexA;
while (myEdges.Count > 0)
{
for (int j = 0; j < myEdges.Count; j++)
{
VoronoiEdge edge = myEdges[j];
if (edge.VVertexA.Equals(previous))
{
previous = edge.VVertexB;
Coordinate c = previous.ToCoordinate();
coords.Add(c);
myEdges.Remove(edge);
break;
}
// couldn't match by adding to the end, so try adding to the beginning
if (edge.VVertexB.Equals(start))
{
start = edge.VVertexA;
coords.Insert(0, start.ToCoordinate());
myEdges.Remove(edge);
break;
}
// I don't like the reverse situation, but it seems necessary.
if (edge.VVertexB.Equals(previous))
{
previous = edge.VVertexA;
Coordinate c = previous.ToCoordinate();
coords.Add(c);
myEdges.Remove(edge);
break;
}
if (edge.VVertexA.Equals(start))
{
start = edge.VVertexB;
coords.Insert(0, start.ToCoordinate());
myEdges.Remove(edge);
break;
}
}
}
for (int j = 0; j < coords.Count; j++)
{
Coordinate cA = coords[j];
// Remove NAN values
if (double.IsNaN(cA.X) || double.IsNaN(cA.Y))
{
coords.Remove(cA);
}
// Remove duplicate coordinates
for (int k = j + 1; k < coords.Count; k++)
{
Coordinate cB = coords[k];
if (cA.Equals2D(cB)) coords.Remove(cB);
}
}
foreach (Coordinate coord in coords)
{
if (double.IsNaN(coord.X) || double.IsNaN(coord.Y))
{
coords.Remove(coord);
}
}
if (coords.Count <= 2) continue;
Polygon pg = new Polygon(coords);
if (cropToExtent)
{
try
{
IGeometry g = pg.Intersection(bounds);
IPolygon p = g as IPolygon;
if (p != null)
{
Feature f = new Feature(p, result);
f.CopyAttributes(points.Features[i]);
}
}
catch (Exception)
{
Feature f = new Feature(pg, result);
f.CopyAttributes(points.Features[i]);
}
}
else
{
Feature f = new Feature(pg, result);
f.CopyAttributes(points.Features[i]);
}
}
return;
}