Android Question how to define class from a specific library

me68

Member
Licensed User
Longtime User
Hello!

I'm using library GoogleMaps for my app. Now i want to add bearing, so the map is always aligned in driving direction.

I found a function GetBearingTo in library OSMDroid, which matches my needs.

But if i add this library to my project, i get errors on compiling caused of another definition of class Marker in OSMDroid

B4X:
Parsing code.                          0.13
Compiling code.                        Error
Error compiling program.
Error description: Unknown member: position
Occurred on line: 907
MapsCalculatingRoute(SelectedMarker.Position.Latitude, SelectedMarker.Position.Longitude)
Word: position

used in sub

B4X:
Sub Pnl_Maps_MarkerClick (SelectedMarker As Marker) As Boolean

How can i define an object from a class in a specific library?

Martin
 

me68

Member
Licensed User
Longtime User
Hello Erel!

I found in the meantime, that "BearingTo" function is also available in GPS library. So i use the Location-Object to do this now - it's working perfect!

B4X:
Sub MapsGps_LocationChanged(lCurrent As Location) ' is also called by MapsTest2

...  
    'Bearing: 0° = north on top, 90° = east on top, 180° = south on top, 270° = west on top
  
    dMapsGpsBearing = lMapsGpsLast.BearingTo(lMapsGpsCurrent)
    If dMapsGpsBearing < 0 Then
        dMapsGpsBearing = dMapsGpsBearing + 360
    End If
    'Log("dMapsGpsBearing=" & dMapsGpsBearing)
  
    UpdatePanelMaps(False, False)
...
End Sub

B4X:
Sub UpdatePanelMaps(bFirstCall As Boolean, bPOIsLoaded As Boolean)
...
            cpAutonomie.Initialize2(lMapsGpsCurrent.Latitude, lMapsGpsCurrent.Longitude, iMapsGpsZoomLevel, dMapsGpsBearing, 0)
...
End Sub

But the general question is: how can i define an object from a special library, if two (or more) libraries uses the same typedef? If i define an object from type "Marker". But "Marker" is defined in library GoogelMaps & OSMDroid.


Martin
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
I'm not sure that I understand. The GetBearing method cannot help you if you are using GoogleMaps library. You can however manually rotate the map according to the bearing.

I think that is like I wished to addition a new class into the library which is available
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Is there alike #getTypeName command?
 
Upvote 0

me68

Member
Licensed User
Longtime User
Have a look: Marker is present in GoogleMaps & OSMDroid:

ScreenShot008.png


Martin
 
Upvote 0
Top