コード例 #1
0
 private void is_Satisfy(int midRow, int midCol, int NeiborRow, int NeiborCol, double dis, IRaster InAccRaster, IRaster InSurRaster, IRaster InLabel, Stack <RasterPixel_2> RpArr)
 {
     if (is_boundary_pixel(NeiborRow, NeiborCol, InAccRaster))
     {
         if (in_Radius(midRow, midCol, NeiborRow, NeiborCol, dis, InAccRaster))
         {
             RasterPixel_2 rp = new RasterPixel_2(NeiborRow, NeiborCol, InAccRaster.Value[NeiborRow, NeiborCol], InSurRaster.Value[NeiborRow, NeiborCol]);
             RpArr.Push(rp);
             InLabel.Value[rp.Row, rp.Column] = rp.Value2;
         }
     }
 }
コード例 #2
0
        public void Execute()
        {
            RcIndex               rc     = Point_to_Raster(pointLayer, Accumulation);
            RasterPixel_2         rp1    = new RasterPixel_2(rc.Row, rc.Column, Accumulation.Value[rc.Row, rc.Column], Surface.Value[rc.Row, rc.Column]);
            Stack <RasterPixel_2> RpArr1 = new Stack <RasterPixel_2>();
            Stack <RasterPixel_2> RpArr2 = new Stack <RasterPixel_2>();

            RpArr1.Push(rp1);
            Label.Value[rp1.Row, rp1.Column] = rp1.Value2;
            do
            {
                RasterPixel_2 rp2 = RpArr1.Pop();
                RpArr2.Push(rp2);
                is_Satisfy(rp2.Row, rp2.Column, rp2.Row, rp2.Column - 1, Radius, Accumulation, Surface, Label, RpArr1);     //Left
                is_Satisfy(rp2.Row, rp2.Column, rp2.Row, rp2.Column + 1, Radius, Accumulation, Surface, Label, RpArr1);     //Right
                is_Satisfy(rp2.Row, rp2.Column, rp2.Row - 1, rp2.Column, Radius, Accumulation, Surface, Label, RpArr1);     //Top
                is_Satisfy(rp2.Row, rp2.Column, rp2.Row + 1, rp2.Column, Radius, Accumulation, Surface, Label, RpArr1);     //Bottom
                is_Satisfy(rp2.Row, rp2.Column, rp2.Row - 1, rp2.Column - 1, Radius, Accumulation, Surface, Label, RpArr1); //TopLeft
                is_Satisfy(rp2.Row, rp2.Column, rp2.Row - 1, rp2.Column + 1, Radius, Accumulation, Surface, Label, RpArr1); //TopRight
                is_Satisfy(rp2.Row, rp2.Column, rp2.Row + 1, rp2.Column - 1, Radius, Accumulation, Surface, Label, RpArr1); //BottomLeft
                is_Satisfy(rp2.Row, rp2.Column, rp2.Row + 1, rp2.Column + 1, Radius, Accumulation, Surface, Label, RpArr1); //BottomRight
            } while (RpArr1.Count > 0);
            RasterPixel_2 rp3        = Search_pour_pixel(RpArr2);
            Coordinate    ResultCoor = Rc_to_Coor(rp3.Row, rp3.Column, Accumulation);

            FeatureSet pointF = new FeatureSet(FeatureType.Point);

            pointF.Projection = Accumulation.Projection;
            DataColumn Column1 = new DataColumn("ID");

            pointF.DataTable.Columns.Add(Column1);
            DataColumn Column2 = new DataColumn("Accumulation");

            pointF.DataTable.Columns.Add(Column2);
            DataColumn Column3 = new DataColumn("Elevation");

            pointF.DataTable.Columns.Add(Column3);

            Point    point          = new Point(ResultCoor);
            IFeature currentFeature = pointF.AddFeature(point);

            currentFeature.DataRow["ID"]           = 0;
            currentFeature.DataRow["Accumulation"] = rp3.Value1;
            currentFeature.DataRow["Elevation"]    = rp3.Value2;
            pointF.SaveAs(savePath, false);
            MainMap.Layers.Add(pointF);
        }