Edit marker WIP
This commit is contained in:
40
Forms/MarkerEdit.pbf
Normal file
40
Forms/MarkerEdit.pbf
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
;
|
||||||
|
; This code is automatically generated by the FormDesigner.
|
||||||
|
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
|
||||||
|
; Event procedures needs to be put in another source file.
|
||||||
|
;
|
||||||
|
|
||||||
|
Global WindowMarkerEdit
|
||||||
|
|
||||||
|
Global TextIdentifier, TextLegend, StringIdentifier, EditorLegend
|
||||||
|
|
||||||
|
|
||||||
|
Procedure OpenWindowMarkerEdit(x = 0, y = 0, width = 300, height = 100)
|
||||||
|
WindowMarkerEdit = OpenWindow(#PB_Any, x, y, width, height, Marker Edit, #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_WindowCentered | #PB_Window_NoGadgets)
|
||||||
|
TextIdentifier = TextGadget(#PB_Any, 2, 2, 80, 25, Identifier)
|
||||||
|
TextLegend = TextGadget(#PB_Any, 2, 27, 80, 25, Legend)
|
||||||
|
StringIdentifier = StringGadget(#PB_Any, 84, 2, 120, 25, "")
|
||||||
|
EditorLegend = EditorGadget(#PB_Any, 84, 27, 210, 70)
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
Procedure WindowMarkerEdit_Events(event)
|
||||||
|
Select event
|
||||||
|
Case #PB_Event_CloseWindow
|
||||||
|
ProcedureReturn #False
|
||||||
|
|
||||||
|
Case #PB_Event_Menu
|
||||||
|
Select EventMenu()
|
||||||
|
EndSelect
|
||||||
|
|
||||||
|
Case #PB_Event_Gadget
|
||||||
|
Select EventGadget()
|
||||||
|
EndSelect
|
||||||
|
EndSelect
|
||||||
|
ProcedureReturn #True
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
|
||||||
|
; IDE Options = PureBasic 5.50 (Windows - x64)
|
||||||
|
; CursorPosition = 11
|
||||||
|
; Folding = -
|
||||||
|
; EnableXP
|
191
PBMap.pb
191
PBMap.pb
@@ -56,7 +56,7 @@ DeclareModule PBMap
|
|||||||
Declare ClearTracks()
|
Declare ClearTracks()
|
||||||
Declare DeleteTrack(*Ptr)
|
Declare DeleteTrack(*Ptr)
|
||||||
Declare DeleteSelectedTracks()
|
Declare DeleteSelectedTracks()
|
||||||
Declare.i AddMarker(Latitude.d, Longitude.d, Legend.s = "", color.l=-1, CallBackPointer.i = -1)
|
Declare.i AddMarker(Latitude.d, Longitude.d, Identifier.s = "", Legend.s = "", color.l=-1, CallBackPointer.i = -1)
|
||||||
Declare ClearMarkers()
|
Declare ClearMarkers()
|
||||||
Declare DeleteMarker(*Ptr)
|
Declare DeleteMarker(*Ptr)
|
||||||
Declare DeleteSelectedMarkers()
|
Declare DeleteSelectedMarkers()
|
||||||
@@ -68,6 +68,8 @@ DeclareModule PBMap
|
|||||||
Declare.d MouseLatitude()
|
Declare.d MouseLatitude()
|
||||||
Declare.d MouseLongitude()
|
Declare.d MouseLongitude()
|
||||||
Declare.i GetZoom()
|
Declare.i GetZoom()
|
||||||
|
Declare.i GetMode()
|
||||||
|
Declare SetMode(Mode.i = #MODE_DEFAULT)
|
||||||
EndDeclareModule
|
EndDeclareModule
|
||||||
|
|
||||||
Module PBMap
|
Module PBMap
|
||||||
@@ -141,6 +143,7 @@ Module PBMap
|
|||||||
|
|
||||||
Structure Marker
|
Structure Marker
|
||||||
GeographicCoordinates.GeographicCoordinates ; Marker latitude and longitude
|
GeographicCoordinates.GeographicCoordinates ; Marker latitude and longitude
|
||||||
|
Identifier.s
|
||||||
Legend.s
|
Legend.s
|
||||||
Color.l ; Marker color
|
Color.l ; Marker color
|
||||||
Focus.i
|
Focus.i
|
||||||
@@ -263,6 +266,9 @@ Module PBMap
|
|||||||
EndIf
|
EndIf
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
;- *** GetText - Translation purpose
|
||||||
|
IncludeFile "gettext.pbi"
|
||||||
|
|
||||||
;- *** CURL specific
|
;- *** CURL specific
|
||||||
; (program has To be compiled in console format for curl debug infos)
|
; (program has To be compiled in console format for curl debug infos)
|
||||||
|
|
||||||
@@ -1233,57 +1239,6 @@ Module PBMap
|
|||||||
EndIf
|
EndIf
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure DrawMarker(x.i, y.i, Nb, Color.l, Legend.s, Focus.i, Selected.i)
|
|
||||||
;Nice marker by yves86
|
|
||||||
VectorSourceColor(color)
|
|
||||||
MovePathCursor(x, y)
|
|
||||||
AddPathLine(-8, -16, #PB_Path_Relative)
|
|
||||||
AddPathCircle(8, 0, 8, 180, 0, #PB_Path_Relative)
|
|
||||||
AddPathLine(-8, 16, #PB_Path_Relative)
|
|
||||||
;FillPath(#PB_Path_Preserve)
|
|
||||||
;ClipPath(#PB_Path_Preserve)
|
|
||||||
AddPathCircle(0, -16, 5, 0, 360, #PB_Path_Relative)
|
|
||||||
VectorSourceColor(Color)
|
|
||||||
FillPath(#PB_Path_Preserve)
|
|
||||||
If Focus
|
|
||||||
VectorSourceColor(PBMap\Options\ColourFocus)
|
|
||||||
StrokePath(3)
|
|
||||||
ElseIf Selected
|
|
||||||
VectorSourceColor(PBMap\Options\ColourSelected)
|
|
||||||
StrokePath(4)
|
|
||||||
Else
|
|
||||||
VectorSourceColor(Color)
|
|
||||||
StrokePath(1)
|
|
||||||
EndIf
|
|
||||||
If PBMap\Options\ShowMarkersNb
|
|
||||||
Protected Text.s = Str(Nb)
|
|
||||||
VectorFont(FontID(PBMap\Font), 13)
|
|
||||||
MovePathCursor(x - 10, y)
|
|
||||||
VectorSourceColor(RGBA(0, 0, 0, 255))
|
|
||||||
DrawVectorParagraph(Text, 20, 20, #PB_VectorParagraph_Center)
|
|
||||||
EndIf
|
|
||||||
If PBMap\Options\ShowMarkersLegend
|
|
||||||
VectorFont(FontID(PBMap\Font), 13)
|
|
||||||
; Protected Height = VectorParagraphHeight(Legend, 100, 13)
|
|
||||||
;dessin d'un cadre avec fond transparent
|
|
||||||
Protected Height = VectorParagraphHeight(Legend, 100, 100)
|
|
||||||
Protected Width.l
|
|
||||||
If Height < 20 ; une ligne
|
|
||||||
Width = VectorTextWidth(Legend)
|
|
||||||
Else
|
|
||||||
Width = 100
|
|
||||||
EndIf
|
|
||||||
AddPathBox(x - (Width / 2), y - 30 - Height, Width, Height)
|
|
||||||
VectorSourceColor(RGBA(168, 255, 255, 100))
|
|
||||||
FillPath()
|
|
||||||
AddPathBox(x - (Width / 2), y - 30 - Height, Width, Height)
|
|
||||||
VectorSourceColor(RGBA(36, 36, 255, 100))
|
|
||||||
StrokePath(2)
|
|
||||||
MovePathCursor(x - 50, y - 30 - Height)
|
|
||||||
VectorSourceColor(RGBA(0, 0, 0, 255))
|
|
||||||
DrawVectorParagraph(Legend, 100, Height, #PB_VectorParagraph_Center)
|
|
||||||
EndIf
|
|
||||||
EndProcedure
|
|
||||||
|
|
||||||
Procedure ClearMarkers()
|
Procedure ClearMarkers()
|
||||||
ClearList(PBMap\Markers())
|
ClearList(PBMap\Markers())
|
||||||
@@ -1307,11 +1262,12 @@ Module PBMap
|
|||||||
Next
|
Next
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure.i AddMarker(Latitude.d, Longitude.d, Legend.s = "", Color.l=-1, CallBackPointer.i = -1)
|
Procedure.i AddMarker(Latitude.d, Longitude.d, Identifier.s = "", Legend.s = "", Color.l=-1, CallBackPointer.i = -1)
|
||||||
Protected *Ptr = AddElement(PBMap\Markers())
|
Protected *Ptr = AddElement(PBMap\Markers())
|
||||||
If *Ptr
|
If *Ptr
|
||||||
PBMap\Markers()\GeographicCoordinates\Latitude = Latitude
|
PBMap\Markers()\GeographicCoordinates\Latitude = Latitude
|
||||||
PBMap\Markers()\GeographicCoordinates\Longitude = ClipLongitude(Longitude)
|
PBMap\Markers()\GeographicCoordinates\Longitude = ClipLongitude(Longitude)
|
||||||
|
PBMap\Markers()\Identifier = Identifier
|
||||||
PBMap\Markers()\Legend = Legend
|
PBMap\Markers()\Legend = Legend
|
||||||
PBMap\Markers()\Color = Color
|
PBMap\Markers()\Color = Color
|
||||||
PBMap\Markers()\CallBackPointer = CallBackPointer
|
PBMap\Markers()\CallBackPointer = CallBackPointer
|
||||||
@@ -1320,6 +1276,86 @@ Module PBMap
|
|||||||
EndIf
|
EndIf
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
Procedure MarkerWindowEvents()
|
||||||
|
If EventType() = #PB_EventType_Change
|
||||||
|
If EventGadget() = GetGadgetText(EventGadget()) <> ""
|
||||||
|
*Marker\Identifier = GetGadgetText(StringIdentifier)
|
||||||
|
EndIf
|
||||||
|
If GetGadgetText(EditorLegend) <> ""
|
||||||
|
*Marker\Legend = GetGadgetText(EditorLegend)
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
Procedure EditMarker(*Marker.Marker)
|
||||||
|
CallDebugger
|
||||||
|
Protected WindowMarkerEdit = OpenWindow(#PB_Any, 0, 0, 300, 100, "Marker Edit", #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_WindowCentered | #PB_Window_NoGadgets)
|
||||||
|
BindEvent()
|
||||||
|
TextGadget(#PB_Any, 2, 2, 80, 25, gettext("Identifier"))
|
||||||
|
TextGadget(#PB_Any, 2, 27, 80, 25, gettext("Legend"))
|
||||||
|
Protected StringIdentifier = StringGadget(#PB_Any, 84, 2, 120, 25, "")
|
||||||
|
Protected EditorLegend = EditorGadget(#PB_Any, 84, 27, 210, 70)
|
||||||
|
BindEvent(#PB_Event_CloseWindow, @MarkerWindowEvents(), WindowMarkerEdit, *Marker)
|
||||||
|
BindGadgetEvent(StringIdentifier, @MarkerWindowEvents())
|
||||||
|
BindGadgetEvent(EditorLegend, @MarkerWindowEvents())
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
Procedure DrawMarker(x.i, y.i, Nb.i, *Marker.Marker)
|
||||||
|
Protected Text.s
|
||||||
|
;Nice marker by yves86
|
||||||
|
VectorSourceColor(*Marker\Color)
|
||||||
|
MovePathCursor(x, y)
|
||||||
|
AddPathLine(-8, -16, #PB_Path_Relative)
|
||||||
|
AddPathCircle(8, 0, 8, 180, 0, #PB_Path_Relative)
|
||||||
|
AddPathLine(-8, 16, #PB_Path_Relative)
|
||||||
|
;FillPath(#PB_Path_Preserve)
|
||||||
|
;ClipPath(#PB_Path_Preserve)
|
||||||
|
AddPathCircle(0, -16, 5, 0, 360, #PB_Path_Relative)
|
||||||
|
VectorSourceColor(*Marker\Color)
|
||||||
|
FillPath(#PB_Path_Preserve)
|
||||||
|
If *Marker\Focus
|
||||||
|
VectorSourceColor(PBMap\Options\ColourFocus)
|
||||||
|
StrokePath(3)
|
||||||
|
ElseIf *Marker\Selected
|
||||||
|
VectorSourceColor(PBMap\Options\ColourSelected)
|
||||||
|
StrokePath(4)
|
||||||
|
Else
|
||||||
|
VectorSourceColor(*Marker\Color)
|
||||||
|
StrokePath(1)
|
||||||
|
EndIf
|
||||||
|
If PBMap\Options\ShowMarkersNb
|
||||||
|
If *Marker\Identifier = ""
|
||||||
|
Text.s = Str(Nb)
|
||||||
|
Else
|
||||||
|
Text.s = *Marker\Identifier
|
||||||
|
EndIf
|
||||||
|
VectorFont(FontID(PBMap\Font), 13)
|
||||||
|
MovePathCursor(x - VectorTextWidth(Text) / 2, y)
|
||||||
|
VectorSourceColor(RGBA(0, 0, 0, 255))
|
||||||
|
DrawVectorText(Text)
|
||||||
|
EndIf
|
||||||
|
If PBMap\Options\ShowMarkersLegend And *Marker\Legend <> ""
|
||||||
|
VectorFont(FontID(PBMap\Font), 13)
|
||||||
|
;dessin d'un cadre avec fond transparent
|
||||||
|
Protected Height = VectorParagraphHeight(*Marker\Legend, 100, 100)
|
||||||
|
Protected Width.l
|
||||||
|
If Height < 20 ; une ligne
|
||||||
|
Width = VectorTextWidth(*Marker\Legend)
|
||||||
|
Else
|
||||||
|
Width = 100
|
||||||
|
EndIf
|
||||||
|
AddPathBox(x - (Width / 2), y - 30 - Height, Width, Height)
|
||||||
|
VectorSourceColor(RGBA(168, 255, 255, 100))
|
||||||
|
FillPath()
|
||||||
|
AddPathBox(x - (Width / 2), y - 30 - Height, Width, Height)
|
||||||
|
VectorSourceColor(RGBA(36, 36, 255, 100))
|
||||||
|
StrokePath(2)
|
||||||
|
MovePathCursor(x - 50, y - 30 - Height)
|
||||||
|
VectorSourceColor(RGBA(0, 0, 0, 255))
|
||||||
|
DrawVectorParagraph(*Marker\Legend, 100, Height, #PB_VectorParagraph_Center)
|
||||||
|
EndIf
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
; Draw all markers
|
; Draw all markers
|
||||||
Procedure DrawMarkers(*Drawing.DrawingParameters)
|
Procedure DrawMarkers(*Drawing.DrawingParameters)
|
||||||
Protected Pixel.PixelCoordinates
|
Protected Pixel.PixelCoordinates
|
||||||
@@ -1330,7 +1366,7 @@ Module PBMap
|
|||||||
If PBMap\Markers()\CallBackPointer > 0
|
If PBMap\Markers()\CallBackPointer > 0
|
||||||
CallFunctionFast(PBMap\Markers()\CallBackPointer, Pixel\X, Pixel\Y, PBMap\Markers()\Focus, PBMap\Markers()\Selected)
|
CallFunctionFast(PBMap\Markers()\CallBackPointer, Pixel\X, Pixel\Y, PBMap\Markers()\Focus, PBMap\Markers()\Selected)
|
||||||
Else
|
Else
|
||||||
DrawMarker(Pixel\X, Pixel\Y, ListIndex(PBMap\Markers()), PBMap\Markers()\Color, PBMap\Markers()\Legend, PBMap\Markers()\Focus, PBMap\Markers()\Selected)
|
DrawMarker(Pixel\X, Pixel\Y, ListIndex(PBMap\Markers()), @PBMap\Markers())
|
||||||
EndIf
|
EndIf
|
||||||
EndIf
|
EndIf
|
||||||
EndIf
|
EndIf
|
||||||
@@ -1575,10 +1611,14 @@ Module PBMap
|
|||||||
; #MODE_HAND = 1 -> Hand only
|
; #MODE_HAND = 1 -> Hand only
|
||||||
; #MODE_SELECT = 2 -> Move objects only
|
; #MODE_SELECT = 2 -> Move objects only
|
||||||
; #MODE_EDIT = 3 -> Create objects
|
; #MODE_EDIT = 3 -> Create objects
|
||||||
Procedure SetMode(Mode = #MODE_DEFAULT)
|
Procedure SetMode(Mode.i = #MODE_DEFAULT)
|
||||||
PBMap\Mode = Mode
|
PBMap\Mode = Mode
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
Procedure.i GetMode()
|
||||||
|
ProcedureReturn PBMap\Mode
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
;Zoom on x, y position relative to the canvas gadget
|
;Zoom on x, y position relative to the canvas gadget
|
||||||
Procedure SetZoomOnPosition(x, y, zoom)
|
Procedure SetZoomOnPosition(x, y, zoom)
|
||||||
Protected MouseX.d, MouseY.d
|
Protected MouseX.d, MouseY.d
|
||||||
@@ -1692,23 +1732,27 @@ Module PBMap
|
|||||||
CtrlKey = #True
|
CtrlKey = #True
|
||||||
EndIf
|
EndIf
|
||||||
Case #PB_EventType_LeftDoubleClick
|
Case #PB_EventType_LeftDoubleClick
|
||||||
If PBMap\Mode = #MODE_DEFAULT Or PBMap\Mode = #MODE_SELECT
|
|
||||||
;Check if the mouse touch a marker, if so, jump to it
|
|
||||||
LatLon2Pixel(@PBMap\GeographicCoordinates, @PBMap\PixelCoordinates, PBMap\Zoom)
|
LatLon2Pixel(@PBMap\GeographicCoordinates, @PBMap\PixelCoordinates, PBMap\Zoom)
|
||||||
MouseX = PBMap\PixelCoordinates\x - GadgetWidth(PBMap\Gadget) / 2 + GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX)
|
MouseX = PBMap\PixelCoordinates\x - GadgetWidth(PBMap\Gadget) / 2 + GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX)
|
||||||
MouseY = PBMap\PixelCoordinates\y - GadgetHeight(PBMap\Gadget) / 2 + GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY)
|
MouseY = PBMap\PixelCoordinates\y - GadgetHeight(PBMap\Gadget) / 2 + GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY)
|
||||||
;Clip MouseX to the map range (in X, the map is infinite)
|
;Clip MouseX to the map range (in X, the map is infinite)
|
||||||
MouseX = Mod(Mod(MouseX, MapWidth) + MapWidth, MapWidth)
|
MouseX = Mod(Mod(MouseX, MapWidth) + MapWidth, MapWidth)
|
||||||
Touch = #False
|
Touch = #False
|
||||||
|
;Check if the mouse touch a marker
|
||||||
ForEach PBMap\Markers()
|
ForEach PBMap\Markers()
|
||||||
LatLon2Pixel(@PBMap\Markers()\GeographicCoordinates, @MarkerCoords, PBMap\Zoom)
|
LatLon2Pixel(@PBMap\Markers()\GeographicCoordinates, @MarkerCoords, PBMap\Zoom)
|
||||||
If Distance(MarkerCoords\x, MarkerCoords\y, MouseX, MouseY) < 8
|
If Distance(MarkerCoords\x, MarkerCoords\y, MouseX, MouseY) < 8
|
||||||
|
If PBMap\Mode = #MODE_DEFAULT Or PBMap\Mode = #MODE_SELECT
|
||||||
|
;Jump to the marker
|
||||||
Touch = #True
|
Touch = #True
|
||||||
SetLocation(PBMap\Markers()\GeographicCoordinates\Latitude, PBMap\Markers()\GeographicCoordinates\Longitude)
|
SetLocation(PBMap\Markers()\GeographicCoordinates\Latitude, PBMap\Markers()\GeographicCoordinates\Longitude)
|
||||||
|
ElseIf PBMap\Mode = #MODE_EDIT
|
||||||
|
;Edit the legend
|
||||||
|
EditMarker(@PBMap\Markers())
|
||||||
|
EndIf
|
||||||
Break
|
Break
|
||||||
EndIf
|
EndIf
|
||||||
Next
|
Next
|
||||||
EndIf
|
|
||||||
If Not Touch
|
If Not Touch
|
||||||
GotoPixelRel(GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX), GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY))
|
GotoPixelRel(GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX), GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY))
|
||||||
EndIf
|
EndIf
|
||||||
@@ -1873,7 +1917,6 @@ Module PBMap
|
|||||||
BindGadgetEvent(PBMap\Gadget, @CanvasEvents())
|
BindGadgetEvent(PBMap\Gadget, @CanvasEvents())
|
||||||
AddWindowTimer(PBMap\Window, PBMap\Timer, PBMap\Options\TimerInterval)
|
AddWindowTimer(PBMap\Window, PBMap\Timer, PBMap\Options\TimerInterval)
|
||||||
BindEvent(#PB_Event_Timer, @TimerEvents())
|
BindEvent(#PB_Event_Timer, @TimerEvents())
|
||||||
;AddKeyboardShortcut(#PB_Shortcut_Delete
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
EndModule
|
EndModule
|
||||||
@@ -1903,6 +1946,7 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
#Gdt_AddMarker
|
#Gdt_AddMarker
|
||||||
#Gdt_AddOpenseaMap
|
#Gdt_AddOpenseaMap
|
||||||
#Gdt_Degrees
|
#Gdt_Degrees
|
||||||
|
#Gdt_EditMode
|
||||||
EndEnumeration
|
EndEnumeration
|
||||||
|
|
||||||
Structure Location
|
Structure Location
|
||||||
@@ -1960,6 +2004,7 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
ResizeGadget(#Gdt_LoadGpx,WindowWidth(#Window_0)-170,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
ResizeGadget(#Gdt_LoadGpx,WindowWidth(#Window_0)-170,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
||||||
ResizeGadget(#Gdt_AddOpenseaMap,WindowWidth(#Window_0)-170,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
ResizeGadget(#Gdt_AddOpenseaMap,WindowWidth(#Window_0)-170,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
||||||
ResizeGadget(#Gdt_Degrees,WindowWidth(#Window_0)-170,#PB_Ignore,#PB_Ignore,#PB_Ignore)
|
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)
|
||||||
PBMap::Refresh()
|
PBMap::Refresh()
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
@@ -1983,8 +2028,9 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
StringGadget(#StringLongitude, 600, 250, 90, 20, "")
|
StringGadget(#StringLongitude, 600, 250, 90, 20, "")
|
||||||
ButtonGadget(#Gdt_AddMarker, 530, 280, 150, 30, "Add Marker")
|
ButtonGadget(#Gdt_AddMarker, 530, 280, 150, 30, "Add Marker")
|
||||||
ButtonGadget(#Gdt_LoadGpx, 530, 310, 150, 30, "Load GPX")
|
ButtonGadget(#Gdt_LoadGpx, 530, 310, 150, 30, "Load GPX")
|
||||||
ButtonGadget(#Gdt_AddOpenseaMap, 530, 340, 150, 30, "OpenSeaMap")
|
ButtonGadget(#Gdt_AddOpenseaMap, 530, 340, 150, 30, "OpenSeaMap", #PB_Button_Toggle)
|
||||||
ButtonGadget(#Gdt_Degrees, 530, 370, 150, 30, "Show/Hide Degrees")
|
ButtonGadget(#Gdt_Degrees, 530, 370, 150, 30, "Show/Hide Degrees", #PB_Button_Toggle)
|
||||||
|
ButtonGadget(#Gdt_EditMode, 530, 400, 150, 30, "Edit Mode ON/OFF", #PB_Button_Toggle)
|
||||||
|
|
||||||
Define Event.i, Gadget.i, Quit.b = #False
|
Define Event.i, Gadget.i, Quit.b = #False
|
||||||
Define pfValue.d
|
Define pfValue.d
|
||||||
@@ -1992,7 +2038,7 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
|
|
||||||
;Our main gadget
|
;Our main gadget
|
||||||
PBMap::InitPBMap(#Window_0)
|
PBMap::InitPBMap(#Window_0)
|
||||||
PBMap::SetOption("ShowDegrees", "1")
|
PBMap::SetOption("ShowDegrees", "0") : Degrees = 0
|
||||||
PBMap::SetOption("ShowDebugInfos", "0")
|
PBMap::SetOption("ShowDebugInfos", "0")
|
||||||
PBMap::SetOption("ShowScale", "1")
|
PBMap::SetOption("ShowScale", "1")
|
||||||
PBMap::SetOption("ShowMarkersLegend", "1")
|
PBMap::SetOption("ShowMarkersLegend", "1")
|
||||||
@@ -2003,7 +2049,7 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
PBMap::SetCallBackLocation(@UpdateLocation()) ; To obtain realtime coordinates
|
PBMap::SetCallBackLocation(@UpdateLocation()) ; To obtain realtime coordinates
|
||||||
PBMap::SetLocation(-36.81148, 175.08634,12) ; Change the PBMap coordinates
|
PBMap::SetLocation(-36.81148, 175.08634,12) ; Change the PBMap coordinates
|
||||||
PBMAP::SetMapScaleUnit(PBMAP::#SCALE_KM) ; To change the scale unit
|
PBMAP::SetMapScaleUnit(PBMAP::#SCALE_KM) ; To change the scale unit
|
||||||
;PBMap::AddMarker(49.0446828398, 2.0349812508, "", -1, @MyMarker()) ; To add a marker with a customised GFX
|
PBMap::AddMarker(49.0446828398, 2.0349812508, "", "", -1, @MyMarker()) ; To add a marker with a customised GFX
|
||||||
|
|
||||||
Repeat
|
Repeat
|
||||||
Event = WaitWindowEvent()
|
Event = WaitWindowEvent()
|
||||||
@@ -2030,22 +2076,33 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
Select EventType()
|
Select EventType()
|
||||||
Case #PB_EventType_LostFocus
|
Case #PB_EventType_LostFocus
|
||||||
PBMap::SetLocation(ValD(GetGadgetText(#StringLatitude)), ValD(GetGadgetText(#StringLongitude))) ; Change the PBMap coordinates
|
PBMap::SetLocation(ValD(GetGadgetText(#StringLatitude)), ValD(GetGadgetText(#StringLongitude))) ; Change the PBMap coordinates
|
||||||
PBMAP::Refresh()
|
PBMap::Refresh()
|
||||||
EndSelect
|
EndSelect
|
||||||
Case #Gdt_AddMarker
|
Case #Gdt_AddMarker
|
||||||
PBMap::AddMarker(ValD(GetGadgetText(#StringLatitude)), ValD(GetGadgetText(#StringLongitude)), "Test", RGBA(Random(255), Random(255), Random(255), 255))
|
PBMap::AddMarker(ValD(GetGadgetText(#StringLatitude)), ValD(GetGadgetText(#StringLongitude)), "", "Test", RGBA(Random(255), Random(255), Random(255), 255))
|
||||||
Case #Gdt_AddOpenseaMap
|
Case #Gdt_AddOpenseaMap
|
||||||
If OpenSeaMap = 0
|
If OpenSeaMap = 0
|
||||||
OpenSeaMap = PBMap::AddMapServerLayer("OpenSeaMap", 2, "http://t1.openseamap.org/seamark/") ; Add a special osm overlay map on layer nb 2
|
OpenSeaMap = PBMap::AddMapServerLayer("OpenSeaMap", 2, "http://t1.openseamap.org/seamark/") ; Add a special osm overlay map on layer nb 2
|
||||||
|
SetGadgetState(#Gdt_AddOpenseaMap, 1)
|
||||||
Else
|
Else
|
||||||
PBMap::DeleteLayer(OpenSeaMap)
|
PBMap::DeleteLayer(OpenSeaMap)
|
||||||
OpenSeaMap = 0
|
OpenSeaMap = 0
|
||||||
|
SetGadgetState(#Gdt_AddOpenseaMap, 0)
|
||||||
EndIf
|
EndIf
|
||||||
PBMAP::Refresh()
|
PBMAP::Refresh()
|
||||||
Case #Gdt_Degrees
|
Case #Gdt_Degrees
|
||||||
Degrees = 1 - Degrees
|
Degrees = 1 - Degrees
|
||||||
PBMap::SetOption("ShowDegrees", Str(Degrees))
|
PBMap::SetOption("ShowDegrees", Str(Degrees))
|
||||||
PBMap::Refresh()
|
PBMap::Refresh()
|
||||||
|
SetGadgetState(#Gdt_Degrees, Degrees)
|
||||||
|
Case #Gdt_EditMode
|
||||||
|
If PBMap::GetMode() <> PBMap::#MODE_EDIT
|
||||||
|
PBMap::SetMode(PBMap::#MODE_EDIT)
|
||||||
|
SetGadgetState(#Gdt_EditMode, 1)
|
||||||
|
Else
|
||||||
|
PBMap::SetMode(PBMap::#MODE_DEFAULT)
|
||||||
|
SetGadgetState(#Gdt_EditMode, 0)
|
||||||
|
EndIf
|
||||||
EndSelect
|
EndSelect
|
||||||
Case #PB_Event_SizeWindow
|
Case #PB_Event_SizeWindow
|
||||||
ResizeAll()
|
ResizeAll()
|
||||||
@@ -2058,8 +2115,8 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
CompilerEndIf
|
CompilerEndIf
|
||||||
|
|
||||||
; IDE Options = PureBasic 5.50 (Windows - x64)
|
; IDE Options = PureBasic 5.50 (Windows - x64)
|
||||||
; CursorPosition = 1467
|
; CursorPosition = 1278
|
||||||
; FirstLine = 1437
|
; FirstLine = 1269
|
||||||
; Folding = --------------
|
; Folding = --------------
|
||||||
; EnableThread
|
; EnableThread
|
||||||
; EnableXP
|
; EnableXP
|
29
gettext.pbi
Normal file
29
gettext.pbi
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
Procedure.s gettext(String.s = "")
|
||||||
|
Protected Language.s = "EN_en"
|
||||||
|
|
||||||
|
Select Language
|
||||||
|
|
||||||
|
Case "EN_en"
|
||||||
|
ProcedureReturn String
|
||||||
|
|
||||||
|
Case "FR_fr"
|
||||||
|
|
||||||
|
Select String
|
||||||
|
|
||||||
|
Case "Identifier"
|
||||||
|
ProcedureReturn("Identificateur")
|
||||||
|
|
||||||
|
Default
|
||||||
|
ProcedureReturn String
|
||||||
|
|
||||||
|
EndSelect
|
||||||
|
|
||||||
|
Default
|
||||||
|
ProcedureReturn String
|
||||||
|
|
||||||
|
EndSelect
|
||||||
|
EndProcedure
|
||||||
|
; IDE Options = PureBasic 5.50 (Windows - x64)
|
||||||
|
; CursorPosition = 21
|
||||||
|
; Folding = -
|
||||||
|
; EnableXP
|
Reference in New Issue
Block a user