Big Update (Bugs / Cluster
This commit is contained in:
52
Demo.pb
52
Demo.pb
@@ -33,8 +33,6 @@
|
||||
|
||||
XIncludeFile "PBMap.pb"
|
||||
|
||||
InitNetwork()
|
||||
|
||||
CompilerIf #PB_Compiler_Thread = #False
|
||||
MessageRequester("Warning !", "You must enable 'Create ThreadSafe Executable' in compiler options", #PB_MessageRequester_Ok )
|
||||
End
|
||||
@@ -70,6 +68,7 @@ Enumeration
|
||||
#Gdt_Degrees
|
||||
#Gdt_EditMode
|
||||
#Gdt_ClearDiskCache
|
||||
#Gdt_TestClusters
|
||||
#TextGeoLocationQuery
|
||||
#StringGeoLocationQuery
|
||||
EndEnumeration
|
||||
@@ -85,6 +84,40 @@ Structure Location
|
||||
Latitude.d
|
||||
EndStructure
|
||||
|
||||
; =============================================================================
|
||||
; SECTION : Constantes de demo clustering
|
||||
; OBJECTIF : Centraliser les coordonnees d'Eragny pour le test
|
||||
; POURQUOI : Faciliter le reglage et la maintenance
|
||||
; =============================================================================
|
||||
#ERAGNY_LAT = 49.0176
|
||||
#ERAGNY_LON = 2.0979
|
||||
|
||||
; =============================================================================
|
||||
; SECTION : Test clustering
|
||||
; OBJECTIF : Generer un nuage de marqueurs autour d'Eragny
|
||||
; POURQUOI : Visualiser et valider le clustering
|
||||
; COMMENT : Distribution simple autour du centre
|
||||
; =============================================================================
|
||||
Procedure AddClusterTestMarkers(MapGadget.i)
|
||||
Protected i.i
|
||||
Protected Lat.d, Lon.d
|
||||
|
||||
PBMap::ClearMarkers(MapGadget)
|
||||
PBMap::SetOption(MapGadget, "EnableClusters", "1")
|
||||
PBMap::SetOption(MapGadget, "ClusterPixelSize", "60")
|
||||
PBMap::SetOption(MapGadget, "ClusterMinCount", "2")
|
||||
|
||||
PBMap::SetLocation(MapGadget, #ERAGNY_LAT, #ERAGNY_LON, 13)
|
||||
|
||||
For i = 0 To 49
|
||||
Lat = #ERAGNY_LAT + (Random(100) - 50) / 10000.0
|
||||
Lon = #ERAGNY_LON + (Random(100) - 50) / 10000.0
|
||||
PBMap::AddMarker(MapGadget, Lat, Lon, "", "Cluster", RGBA(Random(255), Random(255), Random(255), 255))
|
||||
Next
|
||||
|
||||
PBMap::Refresh(MapGadget)
|
||||
EndProcedure
|
||||
|
||||
Procedure UpdateLocation(*Location.Location)
|
||||
SetGadgetText(#StringLatitude, StrD(*Location\Latitude))
|
||||
SetGadgetText(#StringLongitude, StrD(*Location\Longitude))
|
||||
@@ -169,6 +202,7 @@ Procedure ResizeAll()
|
||||
ResizeGadget(#Gdt_Degrees, WindowWidth(#Window_0)-170, #PB_Ignore, #PB_Ignore, #PB_Ignore)
|
||||
ResizeGadget(#Gdt_EditMode, WindowWidth(#Window_0)-170, #PB_Ignore, #PB_Ignore, #PB_Ignore)
|
||||
ResizeGadget(#Gdt_ClearDiskCache, WindowWidth(#Window_0)-170, #PB_Ignore, #PB_Ignore, #PB_Ignore)
|
||||
ResizeGadget(#Gdt_TestClusters, WindowWidth(#Window_0)-170, #PB_Ignore, #PB_Ignore, #PB_Ignore)
|
||||
ResizeGadget(#TextGeoLocationQuery, WindowWidth(#Window_0)-170, #PB_Ignore, #PB_Ignore, #PB_Ignore)
|
||||
ResizeGadget(#StringGeoLocationQuery, WindowWidth(#Window_0)-170, #PB_Ignore, #PB_Ignore, #PB_Ignore)
|
||||
PBMap::Refresh(#Map)
|
||||
@@ -205,8 +239,9 @@ If OpenWindow(#Window_0, 260, 225, 700, 571, "PBMap", #PB_Window_SystemMenu | #P
|
||||
ButtonGadget(#Gdt_Degrees, 530, 420, 150, 30, "Show/Hide Degrees", #PB_Button_Toggle)
|
||||
ButtonGadget(#Gdt_EditMode, 530, 450, 150, 30, "Edit mode ON/OFF", #PB_Button_Toggle)
|
||||
ButtonGadget(#Gdt_ClearDiskCache, 530, 480, 150, 30, "Clear disk cache", #PB_Button_Toggle)
|
||||
TextGadget(#TextGeoLocationQuery, 530, 515, 150, 15, "Enter an address")
|
||||
StringGadget(#StringGeoLocationQuery, 530, 530, 150, 20, "")
|
||||
ButtonGadget(#Gdt_TestClusters, 530, 510, 150, 30, "Test clusters Eragny")
|
||||
TextGadget(#TextGeoLocationQuery, 530, 545, 150, 15, "Enter an address")
|
||||
StringGadget(#StringGeoLocationQuery, 530, 560, 150, 20, "")
|
||||
SetActiveGadget(#StringGeoLocationQuery)
|
||||
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Return, #MenuEventGeoLocationStringEnter)
|
||||
; *** TODO : code to remove when the SetActiveGadget(-1) will be fixed
|
||||
@@ -341,6 +376,8 @@ If OpenWindow(#Window_0, 260, 225, 700, 571, "PBMap", #PB_Window_SystemMenu | #P
|
||||
EndIf
|
||||
Case #Gdt_ClearDiskCache
|
||||
PBMap::ClearDiskCache(#Map)
|
||||
Case #Gdt_TestClusters
|
||||
AddClusterTestMarkers(#Map)
|
||||
Case #StringGeoLocationQuery
|
||||
Select EventType()
|
||||
Case #PB_EventType_Focus
|
||||
@@ -373,8 +410,9 @@ If OpenWindow(#Window_0, 260, 225, 700, 571, "PBMap", #PB_Window_SystemMenu | #P
|
||||
EndIf
|
||||
|
||||
|
||||
; IDE Options = PureBasic 5.73 LTS (Windows - x64)
|
||||
; CursorPosition = 7
|
||||
; IDE Options = PureBasic 6.21 (Windows - x64)
|
||||
; CursorPosition = 35
|
||||
; FirstLine = 31
|
||||
; Folding = --
|
||||
; EnableThread
|
||||
; EnableXP
|
||||
; EnableXP
|
||||
|
||||
Reference in New Issue
Block a user