Results 1 to 24 of 24

Thread: Draw region and fill the closed regions with a color

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2006
    Posts
    120

    Draw region and fill the closed regions with a color

    Code:
    Private Sub Form_Load()
        Me.Font.Bold = True
            With Picture1
            .ScaleMode = 3
            .AutoRedraw = True
            .ScaleLeft = 99.7
            .ScaleWidth = 101.46667 - 99.7
            .ScaleTop = 4.0166694
            .ScaleHeight = 2.85667 - 4.0166694
        End With
    End Sub
    i have set the picture1 with the scale above. Now, i need to draw region using the coordinates from the "testDepthArea.txt".

    format "testDepthArea.txt" is like below:
    START 42, L, 87=2;88=5
    101.28147000 3.20742000
    101.27951000 3.20788000
    101.27933000 3.20833000
    101.27951000 3.20865000
    101.28088000 3.20978000
    101.28121000 3.21074000
    STOP
    START 42, A, 87=5;88=10
    101.28147000 3.20742000
    101.27951000 3.20788000
    101.27933000 3.20833000
    101.27951000 3.20865000
    101.28088000 3.20978000
    101.28121000 3.21074000
    101.28121000 3.21074000
    101.28147000 3.20742000
    STOP

    i want use the coordinates between the "Start line" and "Stop line" to create a region, then the color to fill the region is refer to the value after 87=XX
    maybe need to set the color first.
    for example
    set 87=5 ----->5 as red
    set 87=2------>2 as yellow
    Attached Files Attached Files

  2. #2

    Thread Starter
    Lively Member
    Join Date
    May 2006
    Posts
    120

    Re: Draw region and fill the closed regions with a color

    sorry, i want to update the attach file. now , i attach the file which i need to used to write the program.
    Attached Files Attached Files
    Last edited by junlo; Apr 5th, 2007 at 05:14 AM.

  3. #3
    Hyperactive Member
    Join Date
    Aug 2006
    Posts
    367

    Re: Draw region and fill the closed regions with a color

    Do you mean column 1 represents one axis, column 2 the other, and you seek the region bounding the diagonal line?

  4. #4
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Draw region and fill the closed regions with a color

    junlo, I gave you some code to draw colored regions in one of your other threats.
    The thing you want is to draw those regions on a picturebox, so you need to convert those coordinates (you have got the code needed).
    You have a different syntax in your file now, the problem how to get the regions surrounded by START and STOP you do request yet in another threat.
    Why don't you use all the help given so far instead of asking nearly the same stuff over and over again.
    As you see there lots of people willing to help!
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2006
    Posts
    120

    Re: Draw region and fill the closed regions with a color

    Code:
    Private Type Point
        Longitude As Long
        Latitude As Long
    End Type
    Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As Any, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
    Private Declare Function Polygon Lib "gdi32" (ByVal hdc As Long, lpPoint As Any, ByVal nCount As Long) As Long
    Private Declare Function FillRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long, ByVal hBrush As Long) As Long
    Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
    Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
    Const ALTERNATE = 1 ' ALTERNATE and WINDING are
    Const WINDING = 2 ' constants for FillMode.
    Dim PicHght As Long 'the height of your picturebox
    Dim PicWdth As Long 'the width of your picturebox
    Dim MapHght As Double 'the height of your map
    Dim MapWdth As Double 'the width of your picturebox
    Dim Map0X As Double 'the maximum X or width of your map
    Dim Map0Y As Double 'the maximum Y or height of your map
    Dim arrDepth(1000, 1000) As Single
    Dim Region2() As Point
    Dim Region10() As Point
    Dim Region20() As Point
    Dim Region30() As Point
    Dim Region50() As Point
    Dim Region100() As Point
    Dim Region2Count As Integer
    Dim Region10Count As Integer
    Dim Region20Count As Integer
    Dim Region30Count As Integer
    Dim Region50Count As Integer
    Dim Region100Count As Integer
    
    Private Sub Form_load()
    Dim filenr As Long
    Dim filename As String
    Dim data As String
    Dim i As Integer
    Dim j As Integer
    Dim Latitude As Single
    Dim Longitude As Single
    Dim Depth As Single
    Dim Changer As Single
    With Picture1
              .AutoRedraw = True
              .ScaleMode = vbPixels
              PicHght = .ScaleHeight
              PicWdth = .ScaleWidth
         End With
         'Map0X = 101.46667
         'Map0Y = 2.85667
         'MapWdth = 99.7 - Map0X
         'MapHght = 4.01666 - Map0Y
            Map0X = 99.7
            Map0Y = 4.01666
            MapWdth = 101.46667 - Map0X
            MapHght = 2.85667 - Map0Y
         
    filenr = FreeFile
    'put your filepath in here!!!!
    'filename = "C:\XXX\depth.txt"
    
    filename = "D:\Testing\ENC Project\Setting\Output.txt"
    
    Open filename For Input As filenr
    Do
    Input #filenr, data
    If Not data = "" Then
        Longitude = Val(Left(data, InStr(1, data, " ") - 1))
        data = Mid(data, InStr(1, data, " ") + 1)
        Latitude = Val(Left(data, InStr(1, data, ";") - 1))
        data = Mid(data, InStr(1, data, ";") + 1)
        Depth = CSng(data)
        If Longitude < Latitude Then
            Changer = Longitude
            Longitude = Latitude
            Latitude = Changer
        End If
        arrDepth(GetX(Longitude), GetY(Latitude)) = Depth
        CreateRegion GetX(Longitude), GetY(Latitude), Depth
        Picture1.PSet (GetX(Longitude), GetY(Latitude))
    End If
    Loop Until EOF(filenr)
    Close filenr
    'fill regions
    FillRegions Region2, UBound(Region2) - 1, vbYellow
    FillRegions Region10, UBound(Region10) - 1, vbGreen
    FillRegions Region20, UBound(Region20) - 1, vbBlue
    FillRegions Region30, UBound(Region30) - 1, vbRed
    FillRegions Region50, UBound(Region50) - 1, vbWhite
    FillRegions Region100, UBound(Region100) - 1, vbBlack
    End Sub
    Private Function GetLatitude(y As Single) As Double
     GetLatitude = Round((y * MapHght / PicHght) + Map0Y, 5)
    End Function
    
    Private Function GetLongitude(x As Single) As Double
     GetLongitude = Round((x * MapWdth / PicWdth) + Map0X, 5)
    End Function
    
    Private Function GetY(Latitude As Single) As Long
     GetY = (Latitude - Map0Y) * PicHght / MapHght
    End Function
    
    Private Function GetX(Longitude As Single) As Long
     GetX = (Longitude - Map0X) * PicWdth / MapWdth
    End Function
    
    Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    Picture1.ToolTipText = "x=" & CStr(x) & " y=" & CStr(y) & "Lat=" & CStr(GetLatitude(y)) & " Long=" & CStr(GetLongitude(x)) & " Depth: " & CStr(arrDepth(x, y))
    
    End Sub
    
    Private Sub CreateRegion(Longitude As Long, Latitude As Long, Depth As Single)
    'will add the coordinates to the region of this depth
    'only depth of 2, 10,20,30,50,100 are supported!
    Dim i As Integer
    Select Case Depth
        Case Is = 2
                Region2Count = Region2Count + 1
                ReDim Preserve Region2(Region2Count)
                Region2(Region2Count - 1).Latitude = Latitude
                Region2(Region2Count - 1).Longitude = Longitude
        Case Is = 10
                Region10Count = Region10Count + 1
                ReDim Preserve Region10(Region10Count)
                Region10(Region10Count - 1).Latitude = Latitude
                Region10(Region10Count - 1).Longitude = Longitude
        Case Is = 20
                Region20Count = Region20Count + 1
                ReDim Preserve Region20(Region20Count)
                Region20(Region20Count - 1).Latitude = Latitude
                Region20(Region20Count - 1).Longitude = Longitude
        Case Is = 30
                Region30Count = Region30Count + 1
                ReDim Preserve Region30(Region30Count)
                Region30(Region30Count - 1).Latitude = Latitude
                Region30(Region30Count - 1).Longitude = Longitude
        Case Is = 50
                Region50Count = Region50Count + 1
                ReDim Preserve Region50(Region50Count)
                Region50(Region50Count - 1).Latitude = Latitude
                Region50(Region50Count - 1).Longitude = Longitude
        Case Is = 100
                Region100Count = Region100Count + 1
                ReDim Preserve Region100(Region100Count)
                Region100(Region100Count - 1).Latitude = Latitude
                Region100(Region100Count - 1).Longitude = Longitude
    End Select
    End Sub
    
    Private Sub FillRegions(Region() As Point, NumPoints As Long, color As Long)
    Dim hBrush As Long
    Dim hRgn As Long
    Polygon Picture1.hdc, Region(0), NumPoints
    ' Gets stock black brush.
    'hBrush = GetStockObject(color)
    hBrush = CreateSolidBrush(color)
    ' Creates region to fill with color.
    hRgn = CreatePolygonRgn(Region(0), NumPoints, ALTERNATE)
    ' If the creation of the region was successful then color.
    If hRgn Then FillRgn Picture1.hdc, hRgn, hBrush
    DeleteObject hRgn
    End Sub
    opus, thanks you for your code.
    i not understand some part of the code(i have highlight in red color). Can you explain to me that what consept is taken to generate the coordinates.

    Code:
    Region2Count = Region2Count + 1
                ReDim Preserve Region2(Region2Count)
                Region2(Region2Count - 1).Latitude = Latitude
                Region2(Region2Count - 1).Longitude = Longitude

  6. #6

    Thread Starter
    Lively Member
    Join Date
    May 2006
    Posts
    120

    Re: Draw region and fill the closed regions with a color

    Quote Originally Posted by triggernum5
    Do you mean column 1 represents one axis, column 2 the other, and you seek the region bounding the diagonal line?
    yes, column 1 represent the axis-x, column 2 represent axis-y. i want the value between "start line" and "stop line" to draw a region and fill with a color.

    for example:
    START 42, A, 87=5;88=10
    101.28147000 3.20742000
    101.27951000 3.20788000
    101.27933000 3.20833000
    101.27951000 3.20865000
    101.28088000 3.20978000
    101.28121000 3.21074000
    101.28121000 3.21074000
    101.28147000 3.20742000
    STOP

    the "A" represent the value inside "start" and "stop" can connerted to became a closed area. because the starting point and the end point is same.(highlight in red).

    seen i have many set of data inside the "start" and "stop", so i want "87=XX" to be a reference color.if the value "87=xx" is same for other set of data,then they will fill with the same color.

  7. #7
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Draw region and fill the closed regions with a color

    first off all I was using the file provided in the other threat, that'S why it doesn't fitt in here.
    The file had a large number of depth-values of 2, 10, 20,30 50 and 100's, so I decided to use those positions to create a region for each of those depths. I didn't check wether the coordinates would create a regular region (no crossings and so on), in my opinion you should do that!
    After reading the depth-value for arrDepth I call the Sub "CreateRegion", handing over the actual Longitude and Latitude(both converted to the PixelValues for your Picture1) and the depth.
    Now to the actual code, I'll put in some comments.
    vb Code:
    1. Private Sub CreateRegion(Longitude As Long, Latitude As Long, Depth As Single)
    2. 'This Sub will add the coordinates(Longitude,Latitude) to the region of this depth
    3. 'The Regions are arrays called Region2 (for depth 2) Region10 (for depth10) ....
    4.  
    5. Dim i As Integer
    6. 'The select case is used to determine which Region the point will go to.
    7. Select Case Depth
    8.     Case Is = 2
    9.             'if the Depth is 2, the Counter for all Points of Region2 is increased by 1
    10.             Region2Count = Region2Count + 1
    11.             'The array Region2 gets increased by 1, using PRESERVED to ensure the old values remain in the array
    12.             ReDim Preserve Region2(Region2Count)
    13.             'Latitude and Longitude are set to the new array-point
    14.             Region2(Region2Count - 1).Latitude = Latitude
    15.             Region2(Region2Count - 1).Longitude = Longitude
    16.     Case Is = 10
    17.             Region10Count = Region10Count + 1
    18.             ReDim Preserve Region10(Region10Count)
    19.             Region10(Region10Count - 1).Latitude = Latitude
    20.             Region10(Region10Count - 1).Longitude = Longitude
    21.     Case Is = 20
    22.             Region20Count = Region20Count + 1
    23.             ReDim Preserve Region20(Region20Count)
    24.             Region20(Region20Count - 1).Latitude = Latitude
    25.             Region20(Region20Count - 1).Longitude = Longitude
    26.     Case Is = 30
    27.             Region30Count = Region30Count + 1
    28.             ReDim Preserve Region30(Region30Count)
    29.             Region30(Region30Count - 1).Latitude = Latitude
    30.             Region30(Region30Count - 1).Longitude = Longitude
    31.     Case Is = 50
    32.             Region50Count = Region50Count + 1
    33.             ReDim Preserve Region50(Region50Count)
    34.             Region50(Region50Count - 1).Latitude = Latitude
    35.             Region50(Region50Count - 1).Longitude = Longitude
    36.     Case Is = 100
    37.             Region100Count = Region100Count + 1
    38.             ReDim Preserve Region100(Region100Count)
    39.             Region100(Region100Count - 1).Latitude = Latitude
    40.             Region100(Region100Count - 1).Longitude = Longitude
    41. End Select
    42. End Sub
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  8. #8

    Thread Starter
    Lively Member
    Join Date
    May 2006
    Posts
    120

    Re: Draw region and fill the closed regions with a color

    Quote Originally Posted by opus
    You have a different syntax in your file now, the problem how to get the regions surrounded by START and STOP you do request yet in another threat.
    for the previous request in other thread:i was asking to change format below
    START 43, L, 133=20000;174=10
    101.32412440 2.97892000
    101.32416420 2.97895800
    STOP
    to became like this
    101.32412440 2.97892000;10
    101.32416420 2.97895800;10

    but this time, i just found that when has the "START 42,A"
    START 42, A, 87=5;88=10
    101.28147000 3.20742000
    101.27951000 3.20788000
    101.27933000 3.20833000
    101.27951000 3.20865000
    101.28088000 3.20978000
    101.28121000 3.21074000
    101.28121000 3.21074000
    101.28147000 3.20742000
    STOP

    A refer as area,it can connect to became a closed area. because the starting point and the end point is same.(highlight in red).
    87=xx represent minimum depth in that area
    88=xxrepresent maximum depth in that area

    my question now is,seen my data is all in the format "start .......stop".then can i used it without changing to other kind of format.
    when meet the "Start 42,A", draw a closed area with a color represent the depth for that area.

  9. #9
    Hyperactive Member
    Join Date
    Aug 2006
    Posts
    367

    Re: Draw region and fill the closed regions with a color

    Getiing the numbers from the text file is easy, but Junio, the more you try to explain this, the more confused I get.. You aren't using any kind of notation I've ever seen, so maybe you should draw a picture example..

  10. #10

    Thread Starter
    Lively Member
    Join Date
    May 2006
    Posts
    120

    Re: Draw region and fill the closed regions with a color

    Quote Originally Posted by opus
    The file had a large number of depth-values of 2, 10, 20,30 50 and 100's, so I decided to use those positions to create a region for each of those depths. I didn't check wether the coordinates would create a regular region (no crossings and so on), in my opinion you should do that!
    how to check whether the coordinates would create a regular region????
    i had no idea on it.can you provide me the sample or do you know any website can get this kind of infro?thanks.

    from your code, i found that between the region will create diagonal area which fill with color. is it possible to get out the diagonal area???

  11. #11
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Draw region and fill the closed regions with a color

    No, I don't have any coe to check wether the region is "regular".
    The effect you see is probably caused by such a irregular region, i.e. something like a figure eight. You would have to check each region for no crossings or something like that.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  12. #12

    Thread Starter
    Lively Member
    Join Date
    May 2006
    Posts
    120

    Re: Draw region and fill the closed regions with a color

    Opus, my main purpose is get the value of depth to plot a line graph.
    For example:
    if the mouse point to the (latitude,longitude)=depth.
    one graph is maintain the longitude, then get the depth value (latitude - 0.0002,longitude) until (latitude +0.0002,longitude).
    another graph is maintain the latitude,then get the depth value (latitude,longitude -0.0002) until (latitude,longitude+0.0002).

    But, the data which i have still have a lots of point where Depth is "0".
    i fail to generate the entries of depth value by using the method fill region with color.

    So, is it possible i can get depth value by decrease the latitude(instead of latitude -0.0002,longitude) until meet the depth value which is not "0", increase the latitude (instead of latitude -0.0002,longitude) until meet the depth value which is not "0". then get these two depth value to plot line graph.

  13. #13
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Draw region and fill the closed regions with a color

    Your main purpose gets unclear again!
    What does
    my main purpose is get the value of depth to plot a line graph.
    meam? you want to plot a graph, originally you wanted to show the depth-value of each point using the mousemove event.

    Regarding the problem with all the possible (pixel-)points that have a zero depth value:
    If the coloring isn't the way to go for you (differnt color showing different depth RANGE!) you need to generate a "bogus" (or estimated) depth value for each (pixel-)point. Since you can't just use the difference between the next points less and more depth (think about it, some times a point is surrounded only by one line), you need something similar to the colouring. At the start all points have one depth, then you add a region (like before), all points within that region have a different depth, continue that for all regions you have. That problem is remaining that you need "regular" regions!
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  14. #14

    Thread Starter
    Lively Member
    Join Date
    May 2006
    Posts
    120

    Re: Draw region and fill the closed regions with a color

    Quote Originally Posted by opus
    Your main purpose gets unclear again!
    What does meam? you want to plot a graph, originally you wanted to show the depth-value of each point using the mousemove event.
    yes,i need the mousemove event and also the graph. the mousemove event only show at that pixel is what value of depth.
    i also need to plot two graph to show value depth surrounding at that pixel which show by the mouse.
    one graph is front-back view of that pixel(maintain longitude,decrease and increase latitude), another is side view(maintain latitude,decrease and increase longitude) of the depth pixel.

    sorry, my english not good enough to explain. hope you can understand it.

  15. #15
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Draw region and fill the closed regions with a color

    I do understand your problem.
    You have some depth values on your chart area, but you need the depth value for all possible points (in case of the mousemove event all pixel points / in case of the graphs for lat and long the gradient until the next point).
    The problemsis that I don't know any soöution on how to get those values using any kind of mathematics on its own, maybe some other folks (I'd try it inthe math or game section using a better threat title). Even "making" those values by isn't easy, since you the data you have is not not enough (in my opinion)
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  16. #16

    Thread Starter
    Lively Member
    Join Date
    May 2006
    Posts
    120

    Re: Draw region and fill the closed regions with a color

    opus, i don't know write the program to fill the region.
    So, i have manually do it by using paint.
    then, how to write the program to represent each color a different depth value.
    Attached Images Attached Images  

  17. #17
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Draw region and fill the closed regions with a color

    You could use the mouseposition to determine the color, since you know which depth is which color you could state the depth for each point. all you need is the code to get the color of a the pixel your mouse is pointing on!
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  18. #18

    Thread Starter
    Lively Member
    Join Date
    May 2006
    Posts
    120

    Re: Draw region and fill the closed regions with a color

    Quote Originally Posted by opus
    You could use the mouseposition to determine the color, since you know which depth is which color you could state the depth for each point. all you need is the code to get the color of a the pixel your mouse is pointing on!
    how to write the code to get the color of the pixel? i don't idea to write the code. can you show me an example?

    In the map, white is 100 depth, purple is 50, green is 30, red is 20, yellow is 10 and cyan is 2.

    emr...actually i don't sure the color of 2 is blue or cyan because i use paint and pick the color. i don't know their RGB. how can i know the RGB?

  19. #19
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Draw region and fill the closed regions with a color

    you have the x and y valuesof the mouse the mousemove event.
    Use this to get the RGB color of that point:
    RGBColorvalue = Picturebox.Point(x,y)
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  20. #20

    Thread Starter
    Lively Member
    Join Date
    May 2006
    Posts
    120

    Re: Draw region and fill the closed regions with a color

    Quote Originally Posted by opus
    you have the x and y valuesof the mouse the mousemove event.
    Use this to get the RGB color of that point:
    RGBColorvalue = Picturebox.Point(x,y)
    Code:
    Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    RGBcolorValue = PictureBox.Point(x, y)
    Picture1.ToolTipText = "x=" & CStr(x) & " y=" & CStr(y) & "Lat=" & CStr(GetLatitude(y)) & " Long=" & CStr(GetLongitude(x)) & " Depth: " & CStr(arrDepth(x, y)) & RGBcolorValue
    End Sub
    i used the code above, but it came out an error "object required", and highlight the code "RGBcolorValue = PictureBox.Point(x, y)"

  21. #21

    Thread Starter
    Lively Member
    Join Date
    May 2006
    Posts
    120

    Re: Draw region and fill the closed regions with a color

    opus, i very very need your help.

    i want to get all the pixel infro(x,y and color) of the bitmap picture ( the one i manually do it by using paint) to store it in a plain text.

    the plain text format is something like the below:
    100.67719000 4.01361000;1.5
    100.65643000 4.01546000;7

    column one is the pixel x value which have been transfer to longitude value
    column two is the pixel y value which have been transfer to latitude value
    column three is the RGBcolor which have been transfer to depth value.

    hope you can provide me the code to do it. your help is very important to me.thank you very much.
    Attached Files Attached Files

  22. #22
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Draw region and fill the closed regions with a color

    Your needs are turning in circles, I suggest you redefine your needs from the beginning.
    -1- You couldn't get the color because of an typo.
    use his:
    RGBcolorValue = PictureBox1.Point(x, y)
    -2-
    Now you want to get the colorvalues of all pixels, is that correct?
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  23. #23

    Thread Starter
    Lively Member
    Join Date
    May 2006
    Posts
    120

    Re: Draw region and fill the closed regions with a color

    Quote Originally Posted by opus
    Your needs are turning in circles, I suggest you redefine your needs from the beginning.
    -1- You couldn't get the color because of an typo.
    use his:
    RGBcolorValue = PictureBox1.Point(x, y)
    -2-
    Now you want to get the colorvalues of all pixels, is that correct?
    yes, now i need to get the color values of all pixels and save it in plain text.
    format for plain text is like the below:
    100.67719000 4.01361000;1.5
    100.65643000 4.01546000;7

    column one is the pixel x value which have been transfer to longitude value
    column two is the pixel y value which have been transfer to latitude value
    column three is the RGBcolor which have been transfer to depth value.

  24. #24
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Draw region and fill the closed regions with a color

    OK, so use two For next loop's to get each pixel of your PictureBox1,
    change the pixel-value to the coordinate value (you got the code in the old threat) and save those values along with the colorvalue of that picture!
    Something like:

    Code:
    For i=1 to PictureBox1.ScaleWidth
       For j=1 to PictureBox1.ScaleHeight
          'Change i to Longitude
          'Change j o Latitude
          ColorValue=PictureBox.Point(i,j)
          'Write Latitude, Longitude, Color to your file
       Next j
    Next i
    The actual coding should be no problem now

    BTW : You didn't expect me to do all of your work, didn't you
    Last edited by opus; Apr 13th, 2007 at 02:18 AM.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width