将Visual Studio 2008 C#应用程序移植到Visual Studio 2013,Windows 8.1 store \ phone app(需要在应用程序中包含一个DB)。要使用什么数据库(在c#中编码),以替换此代码...
private static double GetArea(SurveySegment[] segments)
{
SqlGeometryBuilder builder = new SqlGeometryBuilder();
builder.SetSrid(0); // Don't need an SRID here
builder.BeginGeometry(OpenGisGeometryType.Polygon);
// Walk around the segments
PointF p = new PointF(0, 0);
builder.BeginFigure(p.X, p.Y);
for (int i = 0; i < segments.Length; i++)
{
p += segments[i].FromOrigin;
builder.AddLine(p.X, p.Y);
}
// Polygon's end point must be at the origin
if (p.X != 0 || p.Y != 0)
builder.AddLine(0, 0);
builder.EndFigure();
builder.EndGeometry();
// Return the area in the units used in the segments
return builder.ConstructedGeometry.STArea().Value;
}