Gin
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
MapViewer Class Reference

Interactive map viewer component using OpenStreetMap tiles. More...

#include <gin_mapviewer.h>

Inheritance diagram for MapViewer:

Public Member Functions

 MapViewer ()
 
 ~MapViewer () override
 
void setZoom (int zoom)
 Zoom level between 0 and 18.
 
void centerOn (double longCenter, double latCenter)
 Centre map on long/lat.
 
void centerUnderPt (juce::Point< double > world, juce::Point< int > view)
 Set world coordinate (longlat) under view coordinate (x/y)
 
OpenStreetMapsgetOpenStreetMaps ()
 

Protected Member Functions

void resized () override
 
void paint (juce::Graphics &g) override
 
void mouseDown (const juce::MouseEvent &e) override
 
void mouseDrag (const juce::MouseEvent &e) override
 
void mouseWheelMove (const juce::MouseEvent &e, const juce::MouseWheelDetails &wheel) override
 
void tileFetched (int zoom, int x, int y) override
 
void updateMap ()
 
void mapUpdated ()
 

Detailed Description

Interactive map viewer component using OpenStreetMap tiles.

MapViewer displays an interactive map using tiles from OpenStreetMap servers. It supports panning, zooming (levels 0-18), and can be centered on any latitude/longitude coordinate. The component handles tile fetching, caching, and rendering automatically.

Key Features:

Zoom Levels:

Usage:

mapViewer.setSize(800, 600);
// Center on London
mapViewer.centerOn(-0.1278, 51.5074); // longitude, latitude
mapViewer.setZoom(12); // City level zoom
// Or center on San Francisco
mapViewer.centerOn(-122.4194, 37.7749);
mapViewer.setZoom(13);
Interactive map viewer component using OpenStreetMap tiles.
Definition gin_mapviewer.h:56
A lightweight 2D point class for projects that don't use juce_graphics.
Definition gin_point.h:25
See also
OpenStreetMaps

Constructor & Destructor Documentation

◆ MapViewer()

MapViewer::MapViewer ( )

◆ ~MapViewer()

MapViewer::~MapViewer ( )
override

Member Function Documentation

◆ setZoom()

void MapViewer::setZoom ( int  zoom)

Zoom level between 0 and 18.

◆ centerOn()

void MapViewer::centerOn ( double  longCenter,
double  latCenter 
)

Centre map on long/lat.

◆ centerUnderPt()

void MapViewer::centerUnderPt ( juce::Point< double world,
juce::Point< int view 
)

Set world coordinate (longlat) under view coordinate (x/y)

◆ getOpenStreetMaps()

OpenStreetMaps * MapViewer::getOpenStreetMaps ( )

◆ resized()

void MapViewer::resized ( )
overrideprotected

◆ paint()

void MapViewer::paint ( juce::Graphics &  g)
overrideprotected

◆ mouseDown()

void MapViewer::mouseDown ( const juce::MouseEvent &  e)
overrideprotected

◆ mouseDrag()

void MapViewer::mouseDrag ( const juce::MouseEvent &  e)
overrideprotected

◆ mouseWheelMove()

void MapViewer::mouseWheelMove ( const juce::MouseEvent &  e,
const juce::MouseWheelDetails &  wheel 
)
overrideprotected

◆ tileFetched()

void MapViewer::tileFetched ( int  zoom,
int  x,
int  y 
)
overrideprotectedvirtual

◆ updateMap()

void MapViewer::updateMap ( )
protected

◆ mapUpdated()

void MapViewer::mapUpdated ( )
protected

The documentation for this class was generated from the following file: