本文整理汇总了C#中IFeatureSet.get_Shape方法的典型用法代码示例。如果您正苦于以下问题:C# IFeatureSet.get_Shape方法的具体用法?C# IFeatureSet.get_Shape怎么用?C# IFeatureSet.get_Shape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFeatureSet
的用法示例。
在下文中一共展示了IFeatureSet.get_Shape方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: mergeBasinsByDrainage
/// <summary>
/// Merge basins using using MapWinGIS.Utils
/// </summary>
/// <param name="shed"></param>
/// <param name="drainage"></param>
/// <returns></returns>
private static IFeature mergeBasinsByDrainage(IFeatureSet shed, BinTree drainage)
{
if (drainage == null) return null;
IFeature left = mergeBasinsByDrainage(shed, drainage.left);
IFeature right = mergeBasinsByDrainage(shed, drainage.right);
IFeature lr = mergeAbuttingPolygons(left, right);
IFeature outlet = shed.get_Shape(drainage.val);
// check for multipart shape
if (outlet.NumGeometries > 1)
{
Trace.WriteLine("Subbasin " + drainage.val.ToString() + " has " +
outlet.NumGeometries.ToString() + " parts");
}
else
{
// check for anticlockwise polygon
double area = SignedArea(outlet);
if (area < 0)
{
Trace.WriteLine("Needed to reverse subbasin " + drainage.val.ToString());
outlet = ReverseShape(outlet);
}
}
return mergeAbuttingPolygons(lr, outlet);
}
示例2: GetStreamElevationPoints
//.........这里部分代码省略.........
// if (UpstreamCount == UpstreamFinishedCount) //all upstreams finished
// {
// if (currUS1ID != -2 && currUS2ID != -2) //It has two upstream, have to do a double sum
// {
// Hyd_Stor_Num++;
// InFlow_Num1 = currUS1ID;
// InFlow_Num2 = curridx + 1;
// fig.Write("add 5{0,6:G6}{1,6:G6}{2,6:G6}\n", Hyd_Stor_Num, InFlow_Num1, InFlow_Num2);
// Hyd_Stor_Num++;
// InFlow_Num1 = currUS2ID;
// InFlow_Num2 = Hyd_Stor_Num - 1;
// fig.Write("add 5{0,6:G6}{1,6:G6}{2,6:G6}\n", Hyd_Stor_Num, InFlow_Num1, InFlow_Num2);
// }
// else if (currUS1ID != -2) //It only has one upstream, check if it's 1
// {
// Hyd_Stor_Num++;
// InFlow_Num1 = currUS1ID;
// InFlow_Num2 = curridx + 1;
// fig.Write("add 5{0,6:G6}{1,6:G6}{2,6:G6}\n", Hyd_Stor_Num, InFlow_Num1, InFlow_Num2);
// }
// else if (currUS2ID != -2) //It only has one upstream, check if it's 2
// {
// Hyd_Stor_Num++;
// InFlow_Num1 = currUS2ID;
// InFlow_Num2 = curridx + 1;
// fig.Write("add 5{0,6:G6}{1,6:G6}{2,6:G6}\n", Hyd_Stor_Num, InFlow_Num1, InFlow_Num2);
// }
// //After summing, create the route and possibly reservoir
// Hyd_Stor_Num++;
// InFlow_Num1 = Hyd_Stor_Num - 1;
// fig.Write("route 2{0,6:G6}{1,6:G6}{2,6:G6}\n {1,5:D5}0000.rte{1,5:D5}0000.swq\n", Hyd_Stor_Num, curridx + 1, InFlow_Num1);
// subIDs[curridx] = Hyd_Stor_Num;
// if (sf.get_CellValue(ReservoirFieldNum, curridx).ToString() == "1")
// {
// Hyd_Stor_Num++;
// Res_Num++;
// InFlow_Num1 = Hyd_Stor_Num - 1;
// InFlow_ID = curridx + 1;
// fig.Write("routres 3{0,6:G6}{1,6:G6}{2,6:G6}{3,6:G6}\n {3,5:D5}0000.res{3,5:D5}0000.lwq\n", Hyd_Stor_Num, Res_Num, InFlow_Num1, InFlow_ID);
// subIDs[curridx] = Hyd_Stor_Num;
// }
// }
// else //There are upstream items that need to still be processed before this one
// {
// substack.Push(curridx);
// if (currUS1idx != -1 && currUS1ID == -1)
// {
// substack.Push(currUS1idx);
// }
// if (currUS2idx != -1 && currUS2ID == -1)
// {
// substack.Push(currUS2idx);
// }
// }
// }
// }
// //Write out the saveconc and finish commands
// int SaveFile_Num = 1;
// int Print_Freq = 0; //0 for daily, 1 for hourly
// fig.Write("saveconc 14{0,6:G6}{1,6:G6}{2,6:G6}\n watout.dat\n", Hyd_Stor_Num, SaveFile_Num, Print_Freq);
// fig.WriteLine("finish 0");
// fig.Close();
// sf.Close();
// return true;
// }
// #endregion
// #region "Hydrology Private Helper Functions"
private static void GetStreamElevationPoints(int sindx, IFeatureSet streamShape, IRaster demGrid, out double elevLow, out double elevHigh)
{
var shapePoints = streamShape.get_Shape(sindx).NumPoints;
elevLow = 10000000;
elevHigh = -1000000;
for (var i = 0; i < shapePoints; i += 2)
{
var pt = streamShape.get_Shape(sindx).Coordinates[i];
RcIndex position = demGrid.ProjToCell(pt.X, pt.Y);
if (position.IsEmpty()) continue;
double currVal = demGrid.Value[position.Row, position.Column];
if (currVal < elevLow)
{
elevLow = currVal;
}
if (currVal > elevHigh)
{
elevHigh = currVal;
}
}
}