For iRowCount = 0 To pRasterLayer.RowCount - 1 For iColCount = 0 To pRasterLayer.ColumnCount - 1 x = pRaster2.ToMapX(iColCount) y = pRaster2.ToMapY(iRowCount) Xle = Xle + 1 arrX(Xle) = x arrY(Xle) = y Next iColCount Next iRowCount ------------------------------------------------------------- for q = 0 to xle for dangle = 0 to 359 step 2 ExtentX = 200 * Sin(rAngle) ''200 is the search buffer distance. I am actually taking it from the user defined text box value ExtentY = 200 * Cos(rAngle) ExtentX = arrX(q) + ExtentX ExtentY = arrY(q) + ExtentY x2 = arrX(q) y2 = arrY(q) do until x2 = extentx and y2 = extenty ---- look through each pixel (Ipixelblock) ---- compare ---- assign max loop next next
Structure PT Implements IComparable Public X As Double Public Y As Double Public Degree As Integer Public Value As Double Public Position As Integer 'numeric order of point from center. Public Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo Dim tmpObj As PT = CType(obj, PT) If Me.Value.CompareTo(tmpObj.Value) = 0 Then Return (Me.Position.CompareTo(tmpObj.Position)) Else Return (tmpObj.Value.CompareTo(Me.Value)) End If End Function End Structure Private Function MaxPoints(ByVal BufferRadius As Double, ByVal Interval As Integer, ByVal InPoint As IPoint, ByVal pRaster2 As IRaster2) As ArrayList Dim al As New ArrayList Dim finalAl As New ArrayList Dim col As Integer Dim row As Integer Dim newPT As PT Dim z As Integer = 0 Dim xCoord As Double Dim yCoord As Double Dim count As Integer For x As Integer = 2 To 360 Step 2 Do While z < BufferRadius xCoord = z * Math.Cos((90 - x) * Math.PI / 180.0F) + InPoint.X yCoord = z * Math.Sin((90 - x) * Math.PI / 180.0F) + InPoint.Y col = pRaster.ToPixelColumn(xCoord) row = pRaster.ToPixelRow(yCoord) newPT.Degree = x newPT.X = xCoord newPT.Y = yCoord newPT.Value = CDbl(pRaster.GetPixelValue(0, col, row)) al.Add(newPT) z += Interval count += 1 Loop al.Sort() finalAl.Add(al(0)) al.Clear() z = 0 count = 0 Next Return finalAl End Function
do until x2 = extentx and y2 = extenty ---- look through each pixel (Ipixelblock) ---- compare ---- assign max ---- get xy of max pixel value loop
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.