/*============================================================================== Copyright 2018 by Roland Rabien For more information visit www.rabiensoftware.com ==============================================================================*/ #pragma once //==============================================================================*/ // Draws an OSM map class MapViewer : public Component, private OpenStreetMaps::Listener { public: MapViewer(); ~MapViewer() override; void setZoom (int zoom); void centerOn (double longCenter, double latCenter); void centerUnderPt (juce::Point world, juce::Point view); OpenStreetMaps* getOpenStreetMaps() { return osm; } protected: void resized() override; void paint (Graphics& g) override; void mouseDown (const MouseEvent& e) override; void mouseDrag (const MouseEvent& e) override; void mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel) override; void tileFetched (int zoom, int x, int y) override; void updateMap(); void mapUpdated(); void preferencesChanged(); void saveSnapshot(); private: void updateDoubleBuffer(); void clearDoubleBuffer(); int zoom; int mapsize; int xoffset; int yoffset; double wheelDelta = 0; SharedResourcePointer osm; juce::Point lastPos; juce::Point centerPt; bool userAdjusted; juce::Point posMarker; std::unique_ptr doubleBuffer; };