Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey committed Sep 18, 2018
0 parents commit a5fac36
Show file tree
Hide file tree
Showing 95 changed files with 9,201 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
BasedOnStyle: Mozilla
ColumnLimit: 120
AlignAfterOpenBracket: true
AccessModifierOffset: -4
AllowShortFunctionsOnASingleLine: None
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
BinPackParameters : false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 8
IndentWidth: 4
...
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* -crlf
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.dll
*.dylib

# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build*

# Qt unit tests
target_wrapper.*

# QtCreator
*.autosave

# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*

# QtCreator CMake
CMakeLists.txt.user*
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)

project(QGeoView LANGUAGES C CXX)

add_subdirectory(demo)
add_subdirectory(lib)
27 changes: 27 additions & 0 deletions Doxyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
PROJECT_NAME = "QGeoView"
PROJECT_NUMBER = 1.0
PROJECT_BRIEF = "QGeoView documentation"

ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = YES

WARN_IF_UNDOCUMENTED = NO
WARN_IF_DOC_ERROR = YES

ALIASES = \
"read=\par Read:\n" \
"write=\par Write:\n" \
"notify=\par Notify:\n"

MACRO_EXPANSION = YES

INPUT = lib

FILE_PATTERNS = *.h
RECURSIVE = YES

OUTPUT_DIRECTORY = build/documents

GENERATE_HTML = YES
GENERATE_LATEX = NO
HAVE_DOT = NO
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions QGeoView.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TEMPLATE = subdirs
SUBDIRS = lib \
demo

72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# QGeoView(QGV)

QGeoView is a Qt / C ++ widget for visualizing geographic data, like tiled layers, raster or vector data. QGeoView has only Qt as dependency. This component uses QGraphicsView and focuses on usability and performance.
QGeoView public interface follows best practices from OpenLayers and Google Maps API and supports all basic map features, like:

* EPSG3857 projection (others can be added)
* Camera changes: scaling, rotation, moving
* TMS (OSM, Google, Bing or custom)
* Map control widgets

QGeoView uses a hierarchical object storage system, which can store both visual objects (for example, raster or shapes) and non-visual objects (for example, a layer of items). Override in paint event for the visual object allow you to show on the map any geo-data from any source. However, QGeoView itself does not provide methods for reading/parsing of geo-data sources (files). The only exception are TMS servers and bitmap images, for all other sources you need to extend solution.

## Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

### Prerequisites

What things you need:

* C++11 compiler (GCC, Clang, MinGW,...)
* Qt 5.6 or higher (core, gui, widgets, network)
* qmake or cmake
* doxygen (optional)

### Installing

If you use qmake

```
cd <build-dir>
qmake <source-dir>/QGeoView.pro
make
make install
```

If you use cmake

```
cd <build-dir>
cmake <source-dir>
cmake --build . --config Release --target install
```

If you use doxygen (documentation)

```
cd <source-dir>
doxygen
```

### Demo

Please use demo example to see all QGeoView features:

```
<build-dir>/qgeoview-demo
```

## Versioning

QGeoView uses [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/AmonRaNet/QGeoView/tags).

## Author

**Andrey Yaroshenko** ([AmonRaNet](https://github.com/AmonRaNet))

## License

This project is licensed under the [GPL License](http://www.gnu.org/licenses/).

Please contact the author if you need development with closed source.
5 changes: 5 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Release Notes

## v1.0.0 - 17.09.2018

Initial version
59 changes: 59 additions & 0 deletions demo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
set(CMAKE_CXX_STANDARD 11)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

find_package(Qt5 REQUIRED COMPONENTS
Core
Gui
Network
Widgets
)

add_executable(qgeoview-demo
main.cpp
mainwindow.h
mainwindow.cpp
mainwindow.ui
demoitem.h
demoitem.cpp
selectordialog.h
selectordialog.cpp
samples/widgets.cpp
samples/widgets.h
samples/background.cpp
samples/background.h
samples/mouse.cpp
samples/mouse.h
samples/items.cpp
samples/items.h
samples/flags.cpp
samples/flags.h
samples/customtiles.cpp
samples/customtiles.h
samples/utilities.cpp
samples/utilities.h
samples/waveanimation.cpp
samples/waveanimation.h
samples/ellipse.cpp
samples/ellipse.h
samples/rectangle.cpp
samples/rectangle.h
samples/placemark.cpp
samples/placemark.h
samples/mytiles.cpp
samples/mytiles.h
samples/mytile.cpp
samples/mytile.h
)

target_link_libraries(qgeoview-demo
PRIVATE
Qt5::Core
Qt5::Network
Qt5::Gui
Qt5::Widgets
QGeoView
)
45 changes: 45 additions & 0 deletions demo/demo.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
TARGET = qgeoview-demo
TEMPLATE = app
CONFIG-= console

include(../lib/lib.pri)

SOURCES += \
demoitem.cpp \
main.cpp \
mainwindow.cpp \
selectordialog.cpp \
samples/background.cpp \
samples/customtiles.cpp \
samples/ellipse.cpp \
samples/flags.cpp \
samples/items.cpp \
samples/mouse.cpp \
samples/mytiles.cpp \
samples/mytile.cpp \
samples/placemark.cpp \
samples/rectangle.cpp \
samples/utilities.cpp \
samples/waveanimation.cpp \
samples/widgets.cpp

HEADERS += \
demoitem.h \
mainwindow.h \
selectordialog.h \
samples/background.h \
samples/customtiles.h \
samples/ellipse.h \
samples/flags.h \
samples/items.h \
samples/mouse.h \
samples/mytiles.h \
samples/mytile.h \
samples/placemark.h \
samples/rectangle.h \
samples/utilities.h \
samples/waveanimation.h \
samples/widgets.h

FORMS += \
mainwindow.ui
80 changes: 80 additions & 0 deletions demo/demoitem.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/***************************************************************************
* QGeoView is a Qt / C ++ widget for visualizing geographic data.
* Copyright (C) 2018 Andrey Yaroshenko.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see https://www.gnu.org/licenses.
****************************************************************************/

#include "demoitem.h"

DemoItem::DemoItem(QGVMap* geoMap, SelectorDialog::Type type, QObject* parent)
: QObject(parent)
, mGeoMap(geoMap)
{
mSelectorDialog.reset(new SelectorDialog(type));
}

QGVMap* DemoItem::geoMap() const
{
return mGeoMap;
}

SelectorDialog* DemoItem::selector() const
{
return mSelectorDialog.data();
}

void DemoItem::init()
{
onInit();
Q_EMIT ready(this);
}
void DemoItem::start()
{
onStart();
Q_EMIT started(this);
}
void DemoItem::end()
{
onEnd();
Q_EMIT ended(this);
}

QGV::GeoPos DemoItem::randPos(const QGV::GeoRect& targetArea)
{
const double latRange = targetArea.latTop() - targetArea.latBottom();
const double lonRange = targetArea.lonRigth() - targetArea.lonLeft();
static const int range = 1000;
return { targetArea.latBottom() + latRange * (qrand() % range) / range,
targetArea.lonLeft() + lonRange * (qrand() % range) / range };
}

QGV::GeoRect DemoItem::randRect(const QGV::GeoRect& targetArea, const QSizeF& size)
{
const auto baseGeo = randPos(targetArea);
const auto base = geoMap()->getProjection()->geoToProj(baseGeo);
return geoMap()->getProjection()->projToGeo({ base, base + QPointF(size.width(), size.height()) });
}

QGV::GeoRect DemoItem::randRect(const QGV::GeoRect& targetArea, int baseSize)
{
const auto size = randSize(baseSize);
return randRect(targetArea, size);
}

QSizeF DemoItem::randSize(int baseSize)
{
const int range = -baseSize / 2;
return QSize(baseSize + (qrand() % range), baseSize + (qrand() % range));
}
Loading

0 comments on commit a5fac36

Please sign in to comment.