Android Question B4XImageView and Overlay Mark_Point over planimetry

mike1967

Active Member
Licensed User
Longtime User
Hello i realized this part of app like screen attached. I can move a mark point over a planimetry in order to individuate position of equipments on it. I realize it with two B4XImageView an a trasparent panel for capture the touch point coordinates. Now i need a function that realize this also on a Zoomable Images. Is Possible ? Can provide me suggestions and sample code ? Thanks in advances.
 

Attachments

  • screenshot-2021-03-22_18.01.21.721.png
    screenshot-2021-03-22_18.01.21.721.png
    428.1 KB · Views: 214
  • screenshot-2021-03-22_18.01.34.425.png
    screenshot-2021-03-22_18.01.34.425.png
    428.6 KB · Views: 208
  • screenshot-2021-03-22_18.01.46.988.png
    screenshot-2021-03-22_18.01.46.988.png
    425.6 KB · Views: 185
  • screenshot-2021-03-22_18.01.54.735.png
    screenshot-2021-03-22_18.01.54.735.png
    428.4 KB · Views: 186

TILogistic

Expert
Licensed User
Longtime User
Test:
Use the source code and do whatever you like in the Touch event.

see:
 
Last edited:
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
other:

 
Upvote 0

mike1967

Active Member
Licensed User
Longtime User
other:

How can i add multiple Mark point as Image programmatically ? Thanks in advances
 
Upvote 0

mike1967

Active Member
Licensed User
Longtime User
Use two layers. Draw the marks on the top layer. Use B4XCanvas.ClearRect to clear marks.
Actually :
B4X:
Private Sub pnlLayerLoc_Touch (Action As Int, X As Float, Y As Float)
    Log(X)
    Log(Y)
    Dim touchstart, touchduration As Long
 
    If Action=B4XPages.GetNativeParent(Me).ACTION_UP Then
   
                touchduration = DateTime.Now - touchstart
       
        If touchduration < 400 Then ' Short click
       
        Else ' long click/touch
            If move=False And removemarkpoint=False Then
            pnlLayerLoc.LoadLayout("mark_point")
            imgMarkPoint.Left=X-(imgMarkPoint.Width/2)
            imgMarkPoint.Top=Y-(imgMarkPoint.Height)
            End If
        End If
       
    End If
    If Action=B4XPages.GetNativeParent(Me).ACTION_DOWN Then
        touchstart = DateTime.Now
        move=False
        removemarkpoint=False
    End If
    If Action=B4XPages.GetNativeParent(Me).ACTION_MOVE Then
        move=True
        Log(imgViewPlanimetria.mBase.Width)
        Log(imgViewPlanimetria.mBase.Height)
       
        imgMarkPoint.Left=X-(imgMarkPoint.Width/2)
        imgMarkPoint.Top=Y-(imgMarkPoint.Height*4)
        imgMarkPoint.Tag=X & "," & Y
    End If
   
End Sub

Sub imgMarkPoint_LongClick
    Dim currimgMarkPoint As ImageView
    currimgMarkPoint = Sender
    currimgMarkPoint.Visible=False
    currimgMarkPoint.RemoveView
    removemarkpoint=True
End Sub

Panel transparent over image view
 
Upvote 0

mike1967

Active Member
Licensed User
Longtime User
Actually :
B4X:
Private Sub pnlLayerLoc_Touch (Action As Int, X As Float, Y As Float)
    Log(X)
    Log(Y)
    Dim touchstart, touchduration As Long

    If Action=B4XPages.GetNativeParent(Me).ACTION_UP Then
  
                touchduration = DateTime.Now - touchstart
      
        If touchduration < 400 Then ' Short click
      
        Else ' long click/touch
            If move=False And removemarkpoint=False Then
            pnlLayerLoc.LoadLayout("mark_point")
            imgMarkPoint.Left=X-(imgMarkPoint.Width/2)
            imgMarkPoint.Top=Y-(imgMarkPoint.Height)
            End If
        End If
      
    End If
    If Action=B4XPages.GetNativeParent(Me).ACTION_DOWN Then
        touchstart = DateTime.Now
        move=False
        removemarkpoint=False
    End If
    If Action=B4XPages.GetNativeParent(Me).ACTION_MOVE Then
        move=True
        Log(imgViewPlanimetria.mBase.Width)
        Log(imgViewPlanimetria.mBase.Height)
      
        imgMarkPoint.Left=X-(imgMarkPoint.Width/2)
        imgMarkPoint.Top=Y-(imgMarkPoint.Height*4)
        imgMarkPoint.Tag=X & "," & Y
    End If
  
End Sub

Sub imgMarkPoint_LongClick
    Dim currimgMarkPoint As ImageView
    currimgMarkPoint = Sender
    currimgMarkPoint.Visible=False
    currimgMarkPoint.RemoveView
    removemarkpoint=True
End Sub

Panel transparent over image view
How can implementa zoomable view with this code that work?
 
Upvote 0

mike1967

Active Member
Licensed User
Longtime User
You need to create a bitmap and show it with ZoomImageView. If the two layers are made with a panel that holds another panel then you can take a snapshot of the parent panel.

Another option is to take ZoomImageView code and modify it to work with your two layers. It is not trivial.
I have only one panel over a b4ximageview and all events reach the panel. So i must to add another panel ? I dont understand very well ,Is possibile same samples ? Thanks in advances.
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
OTHER B4A:


 
Upvote 0
Top