diff --git a/PBMap.pb b/PBMap.pb index 3f1fbf2..5795e5f 100644 --- a/PBMap.pb +++ b/PBMap.pb @@ -36,7 +36,8 @@ DeclareModule PBMap Declare DrawingThread(Null) Declare SetZoom(Zoom.i, mode.i = #PB_Relative) Declare ZoomToArea() - Declare SetCallBackLocation(*CallBackLocation) + Declare SetCallBackLocation(CallBackLocation.i) + Declare SetCallBackMainPointer(CallBackMainPointer.i) Declare LoadGpxFile(file.s); Declare AddMarker(Latitude.d,Longitude.d,color.l=-1, CallBackPointer.i = -1) Declare Quit() @@ -122,6 +123,7 @@ Module PBMap Drawing.DrawingParameters ; Drawing parameters based on focus point ; CallBackLocation.i ; @Procedure(latitude.d,lontitude.d) + CallBackMainPointer.i ; @Procedure(X.i, Y.i) to DrawPointer (you must use VectorDrawing lib) ; Position.PixelPosition ; Actual focus point coords in pixels (global) MoveStartingPoint.PixelPosition ; Start mouse position coords when dragging the map @@ -701,7 +703,12 @@ Module PBMap DrawTiles(@Drawing) DrawTrack(@Drawing) DrawMarker(@Drawing) - Pointer(Drawing\CenterX, Drawing\CenterY, #Red) + ; @Procedure(X.i, Y.i) to DrawPointer (you must use VectorDrawing lib) + If PBMap\CallBackMainPointer > 0 + CallFunctionFast(PBMap\CallBackMainPointer, Drawing\CenterX, Drawing\CenterY) + Else + Pointer(Drawing\CenterX, Drawing\CenterY, #Red) + EndIf StopVectorDrawing() ;Redraw ; If something was not correctly drawn, redraw after a while @@ -817,6 +824,10 @@ Module PBMap PBMap\CallBackLocation = CallBackLocation EndProcedure + Procedure SetCallBackMainPointer(CallBackMainPointer.i) + PBMap\CallBackMainPointer = CallBackMainPointer + EndProcedure + Procedure.d GetLatitude() Protected Value.d LockMutex(PBMap\Drawing\Mutex) @@ -841,10 +852,7 @@ Module PBMap ProcedureReturn Value EndProcedure - Procedure RefreshMapGadget() - SignalSemaphore(PBMap\Drawing\Semaphore) - EndProcedure - + Procedure Event(Event.l) Protected Gadget.i Protected MouseX.i, MouseY.i @@ -982,6 +990,11 @@ CompilerIf #PB_Compiler_IsMainFile FillPath(#PB_Path_Preserve):VectorSourceColor(RGBA(0, 0, 0, 255)):StrokePath(1) EndProcedure + Procedure MainPointer(x.i, y.i) + VectorSourceColor(RGBA(255, 255,255, 255)):AddPathCircle(x, y,32):StrokePath(1) + VectorSourceColor(RGBA(0,0,0, 255)):AddPathCircle(x, y,29):StrokePath(2) + EndProcedure + Procedure ResizeAll() ResizeGadget(#Map,10,10,WindowWidth(#Window_0)-198,WindowHeight(#Window_0)-59) ResizeGadget(#Text_1,WindowWidth(#Window_0)-170,#PB_Ignore,#PB_Ignore,#PB_Ignore) @@ -1029,6 +1042,7 @@ CompilerIf #PB_Compiler_IsMainFile PBMap::InitPBMap() PBMap::MapGadget(#Map, 10, 10, 512, 512) PBMap::SetCallBackLocation(@UpdateLocation()) + PBMap::SetCallBackMainPointer(@MainPointer()) ;To change the Main Pointer PBMap::SetLocation(49.04599, 2.03347, 17) PBMap::AddMarker(49.0446828398, 2.0349812508, -1, @MyPointer()) @@ -1068,8 +1082,8 @@ CompilerIf #PB_Compiler_IsMainFile CompilerEndIf ; IDE Options = PureBasic 5.50 (Windows - x86) -; CursorPosition = 860 -; FirstLine = 847 +; CursorPosition = 994 +; FirstLine = 969 ; Folding = --------- ; EnableThread ; EnableXP