Git Product home page Git Product logo

globeviewer's Introduction

What is GlobeViewer?

GlobeViewer allows you to view popular online maps not in Mercator but Orthographic projection. Greenland will never be larger than Australia again. In addition to viewing tiles GlobeViewer caches them. So viewed once the tiles will be available to you afterwards even offline! Currently it supports OpenStreetMap and 2GIS tiles.

Keep in mind that the tiles are not changed, so switching to another projection (from Mercator to Orthographic) will distort them a bit. But all symbols remain readable at all zoom levels.

How to use it

GlobeViewer is designed to be used as a library in any application than can create OpenGL context. Currently it has only been tested with GLFW. You can find corresponding example next door.

If you have build the library (and all its dependencies in case of static build), you can easily use it in your project by adding single header GlobeViewer.h. And that's it. Just call API methods from your application.

Provided example controls

GLFW example has the following controls:

  • Hold left mouse button and drag to move the Globe
  • Hold left mouse button, hold Shift key and drag to rotate the Globe
  • Scroll mouse wheel up to zoom in
  • Scroll mouse wheel down to zoom out
  • Press key 'C' to place the Globe in window center
  • Press key 'B' to rotate the Globe so that projection center is at [0, 0]
  • Press key 'P' to rotate the Globe so that projection center is at the current mouse cursor position if it's inside the Globe, ignore otherwise
  • Press key 'T' to toggle between two tile servers
  • Press key '1' to toggle display of wire-frame
  • Press key '2' to toggle display of map tiles
  • Press Escape to exit

Highlights

Here is a short video that can give you the first impression of what the application is capable of:

Vimeo link

Screenshots

The Globe The North Pole The South Pole Melbourne from far away Melbourne from not so far away Melbourne at zoom level 19

Documentation

Library is fully documented with Doxygen. Docs can be easily generated from provided Doxyfile: if you have Doxygen installed go to doc directory and call 'doxygen' without parameters. If you don't have Graphviz installed in Doxyfile make sure HAVE_DOT is set to NO: HAVE_DOT = NO Or just comment it out as 'NO' is a default value: #HAVE_DOT = YES

Dependencies

General:

  • C++14

Embedded into the source code:

Library

GLFW example:

Versioning

GlobeViewer uses Semantic Versioning 2.0.0.

License

GlobeViewer is licensed under MIT License.

globeviewer's People

Contributors

green-anger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

globeviewer's Issues

Add class to manage map tiles

It must:

  • download tiles
  • cache tiles
  • check cache prior to downloading

In the context of this issue the class should download and cache tiles for map zoom levels 0, 1 and 2 (21 tiles in total).

Good articles to consider from OpenStreetMap wiki:

Typo in namespace gw

It should have been an abbreviation for GlobeViewer, so it must be gv not gw.

Document types

This includes the following:

  • Tile
  • TileServer
  • TileTexture
  • ViewData
  • consts in Defines.h

Provide means to switch tile server on the fly

GlobeViewer already supports two tile servers (OpenStreetMap and 2Gis). There should be API method in GlobeViewer.h and a trigger using it in GLFW example to change the server on the fly.

Creating directory during caching may fail

TileManager::dirs_ consider only TileHead but not TileServer type, so if a directory was created for one TileServer and then you switch to another one no directory will be created for later TileServer because information about creating the dir was already in TileManager::dirs_.

Initially TileManager::dirs_ was created to save some time in the process of directory creation every time, but no profiling was done and it was only a guess. For now it's easier to remove TileManager::dirs_ completely and create directory every time it's needed. Which means moving prepareDir call from TileManager::requestTiles to TileManager::Session::onRead.

Ignore empty tiles

Not every tile server provides tiles for every zoom level from 0 to 19. Sometimes the server may respond with empty file which will be cached (good), send to the requester (good) and processed by if (bad). Check size of the image prior to processing and if it's zero length just ignore. Otherwise the app crashes.

CMake simple install rules

After installing to CMAKE_INSTALL_PREFIX the library shall be discoverable in other CMake projects via CMAKE_PREFIX_PATH variable analysis.

Refactor codebase to decouple modules from each other

Currently Renderer is tightly coupled with DataKeeper and Viewport. Projector instance is a child of DataKeeper. For new modules there is always a question where they should belong and sometimes it's not an easy one to answer. To decouple modules signal-slot concept can be used. Following issue #21 Boost.Signal2 must be used. Architecture must be the following:

  • Modules knows nothing of each other
  • Each module has public API including signals that describe module's features
  • Each module must protect its thread-sensitive data
  • GlobeViewer knows about every module and create their instances
  • GlobeViewer defines signal-slot connections (immediately after module creation)

This issue must be resolved ASAP.

Signal mapReady readability can be improved

DataKeeper always sends true and MapGenerator always sends false. There's no need for them to have any parameters. It can be handled at GlobeViewer::Impl level. It can help to rename signal to "mapNotReady" for MapGenerator. Documentation must reflect the change.

Change register methods in DataKeeper to Boost.Signal2

Boost.Signal2 is easier to use and provides some sort of implementation of Observer pattern. Plus it work well in multi-threaded environment.

All future connections between application parts (modules) shall be implemented as Boost.Signal2.

New trigger to rotate the Globe

The mouse movement is currently used to pan the view. Rotating the Globe would be more frequent than panning. Suggest to use simple mouse move to rotate and mouse move with SHIFT modifier to pan.

Dynamic zoom

The closer viewer to the Globe the more sensitive the zoom shall be. Far away it can move fast. There shall be a map to reflect this behaviour.

Center projection to mouse cursor

If the cursor is out of the Globe projection do nothing, otherwise rotate the Globe so that the point under cursor become the new projection center.

Add window resize policy

Currently resizing of the window is happening around the context center: what was in the center before resizing will stay in the center after. It's good for viewing the globe after going full screen. However, sometimes it's not the best option and there should be a choice for the user to pick a point in the client area (OpenGL context) to resize around. The most commonly option would probably be the top left corner.

Display texture

To display map tiles it will require new shader and some GL variables.

Updating map in a thread

#26 is essentially done, however the result is unacceptably slow and the app is almost unusable.

To fix this there should be a compromise between speed and visuals. For now delayed map rendering will be enough. It means upon changing the view or rotating the Globe rendering of the map will stop until getting new calculations of tile texture and corresponding vertices array. So there may (and probably will) be time when user will see no map tiles and will be moving "blindly". At least it will allow keep fast rotating and moving speed.

Simple GLFW window

  • determine screen resolution
  • make window dimensions equal to 80-90% of that values
  • place window in screen center
  • create OpenGL context
  • fill the whole window with some colour (not white)

Map tiles disappear too often

It's too uncomfortable right now to surf the Globe, every movement causes map disappearance and redrawing in milliseconds (when tiles are cached). There's no need to hide the map every time. It's ok if you move or zoom and tile become a bit small or large for a moment and then be replaced by "the right ones". However it's still better to hide map during rotation of the Globe.

Measure distance

GlobeViewer is already a fantastic software and it would be awesome if distance measuring feature is added to the project.

Add window resizing

Meaning OpenGL context within window. If it's not handled properly while the window resized, the context will be stretched which is wrong.

Failure in downloading some tiles must not prevent further processing

Currently TileManager will not send tiles in case one of the requested tiles was not downloaded. This prevents further work, no new map updates will be provided and the app must be restarted to get it working properly.

Should have retry counter and even if reaches zero and give error all other tile must be sent. It's better to have gaps in map then no map at all.

Map generator

Class must find visible tiles, request them from TileManager and compose new texture to send to GlobeViewer to manage (texture must be updated in the same thread where OpenGL was initialized).

Rotate the Globe

For this to be done the following script should suffice:

  • command to shift projection
  • projection center changes
  • the whole wire-frame model recalculated

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.