diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 15544b42b..56ba98fc4 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,40 +1,53 @@
-How to build from source?
-=========================
+# How to build from source?
Both development environment and GCS are supported on Windows, Linux and Mac OS X
+## Install prerequisites
+
The first step is to Install all OS specific prerequisites.
-###Mac OS X
+
+### Mac OS X
+
Install XCode and its relatated command line tools (follow Apple documentation).
Install git, curl and p7zip. You can use brew `brew install git curl p7zip` or macport: `sudo port install git curl p7zip`
-###Ubuntu
-
- sudo apt-get install git build-essential curl gdb wget debhelper p7zip-full unzip flex bison libsdl1.2-dev libudev-dev libusb-1.0-0-dev libc6-i386 mesa-common-dev
-###Windows
-Install [msysGIT](https://msysgit.github.io/) under `C:\git`
+### Ubuntu
-Clone LibrePilot Git repository.
-Open Git Bash and run
+ sudo apt-get install git build-essential curl gdb wget debhelper p7zip-full unzip flex bison libsdl1.2-dev libudev-dev libusb-1.0-0-dev libc6-i386 mesa-common-dev
- cd /path/to/LibrePilot_root
- ./make/scripts/win_sdk_install.sh
-You can build using the `/path/to/LibrePilot_root/make/winx86/bin/make` wrapper to call `mingw32-make.exe` as:
+### Windows
- ./make/winx86/bin/make all_sdk_install
-or call `mingw32-make` directly
+Install [Msys2](https://msys2.github.io/) following the instructions on the web site. You can either install the i686 (32 bit) or x86_64 (64 bit) version.
- mingw32-make all_sdk_install
+Start a "MinGW-w64 Win32 Shell" or "MinGW-w64 Win32 Win64 Shell" (NOT "MSYS2 Shell")
+
+Install the dependent packages (32 bit):
+
+ pacman -S --needed git unzip tar mingw-w64-i686-toolchain mingw-w64-i686-qt5 mingw-w64-i686-SDL mingw-w64-i686-mesa mingw-w64-i686-openssl
+
+Or for a 64 bit build:
+
+ pacman -S --needed git unzip tar mingw-w64-x86_64-toolchain mingw-w64-x86_64-qt5 mingw-w64-x86_64-SDL mingw-w64-x86_64-mesa mingw-w64-x86_64-openssl
+
+*NOTE* On Windows you need to run the mingw version of make, which is 'mingw32-make'
+
+
+## Setup the build environment and build
-##Setup the build environment and build
The `all_sdk_install` target will automatically retrieve and install all needed tools (qt, arm gcc etc.) in a local folder `/path/to/LibrePilot_root/tools`
+### Ubuntu / Mac OS X
- make all_sdk_install
- make package
+ make all_sdk_install
+ make package
-The `package` target will build the complete installable package for the current platform.
+### Windows
+
+ mingw32-make all_sdk_install
+ mingw32-make package
+
+The `package` target will build the complete installable package for the current platform. You can build the 'all' target to just build the software.
Run make with no arguments to show the complete list of supported targets.
diff --git a/Makefile b/Makefile
index 04db0a97a..c6686557f 100644
--- a/Makefile
+++ b/Makefile
@@ -82,10 +82,6 @@ One of the project’s primary goals is to provide an open and collaborative env
endef
-# Set up default build configurations (debug | release)
-GCS_BUILD_CONF := release
-GOOGLE_API_VERSION := 14
-
# Clean out undesirable variables from the environment and command-line
# to remove the chance that they will cause problems with our build
define SANITIZE_VAR
@@ -130,14 +126,7 @@ else ifeq ($(V), 0)
else ifeq ($(V), 1)
endif
-# Make sure we know few things about the architecture before including
-# the tools.mk to ensure that we download/install the right tools.
-UNAME := $(shell uname)
-ARCH := $(shell uname -m)
-# Here and everywhere if not Linux or Mac then assume Windows
-ifeq ($(filter Linux Darwin, $(UNAME)), )
- UNAME := Windows
-endif
+ARCH := $(call get_arch)
# Include tools installers
include $(ROOT_DIR)/make/tools.mk
@@ -147,22 +136,23 @@ include $(ROOT_DIR)/make/tools.mk
# We almost need to consider autoconf/automake instead of this
ifeq ($(UNAME), Linux)
- ifeq ($(ARCH), x86_64)
- QT_SPEC := linux-g++-64
- else
- QT_SPEC := linux-g++-32
- endif
UAVOBJGENERATOR := $(BUILD_DIR)/uavobjgenerator/uavobjgenerator
else ifeq ($(UNAME), Darwin)
- QT_SPEC := macx-g++
UAVOBJGENERATOR := $(BUILD_DIR)/uavobjgenerator/uavobjgenerator
else ifeq ($(UNAME), Windows)
- QT_SPEC := win32-g++
UAVOBJGENERATOR := $(BUILD_DIR)/uavobjgenerator/uavobjgenerator.exe
endif
export UAVOBJGENERATOR
+# Set up default build configurations (debug | release)
+GCS_BUILD_CONF := release
+GCS_EXTRA_CONF := osg copy_osg
+
+ifeq ($(UNAME), Windows)
+ GCS_EXTRA_CONF += osgearth
+endif
+
##############################
#
# All targets
@@ -196,7 +186,7 @@ uavobjgenerator: $(UAVOBJGENERATOR)
$(UAVOBJGENERATOR): | $(UAVOBJGENERATOR_DIR)
$(V1) cd $(UAVOBJGENERATOR_DIR) && \
( [ -f Makefile ] || $(QMAKE) $(ROOT_DIR)/ground/uavobjgenerator/uavobjgenerator.pro \
- -spec $(QT_SPEC) CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) ) && \
+ CONFIG+='$(GCS_BUILD_CONF) $(GCS_EXTRA_CONF)' ) && \
$(MAKE) --no-print-directory -w
UAVOBJ_TARGETS := gcs flight python matlab java wireshark
@@ -255,10 +245,8 @@ include $(ROOT_DIR)/flight/Makefile
.PHONY: all_ground
all_ground: gcs uploader
-ifeq ($(V), 1)
- GCS_SILENT :=
-else
- GCS_SILENT := silent
+ifneq ($(V), 1)
+ GCS_EXTRA_CONF += silent
endif
GCS_DIR := $(BUILD_DIR)/$(GCS_SMALL_NAME)_$(GCS_BUILD_CONF)
@@ -270,7 +258,7 @@ GCS_MAKEFILE := $(GCS_DIR)/Makefile
gcs_qmake $(GCS_MAKEFILE): | $(GCS_DIR)
$(V1) cd $(GCS_DIR) && \
$(QMAKE) $(ROOT_DIR)/ground/gcs/gcs.pro \
- -spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) \
+ -r CONFIG+='$(GCS_BUILD_CONF) $(GCS_EXTRA_CONF)' \
'GCS_BIG_NAME="$(GCS_BIG_NAME)"' GCS_SMALL_NAME=$(GCS_SMALL_NAME) \
'ORG_BIG_NAME="$(ORG_BIG_NAME)"' ORG_SMALL_NAME=$(ORG_SMALL_NAME) \
'WIKI_URL_ROOT="$(WIKI_URL_ROOT)"' \
@@ -304,7 +292,7 @@ UPLOADER_MAKEFILE := $(UPLOADER_DIR)/Makefile
uploader_qmake $(UPLOADER_MAKEFILE): | $(UPLOADER_DIR)
$(V1) cd $(UPLOADER_DIR) && \
$(QMAKE) $(ROOT_DIR)/ground/gcs/src/experimental/USB_UPLOAD_TOOL/upload.pro \
- -spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) $(GCS_QMAKE_OPTS)
+ -r CONFIG+='$(GCS_BUILD_CONF) $(GCS_EXTRA_CONF)' $(GCS_QMAKE_OPTS)
.PHONY: uploader
uploader: $(UPLOADER_MAKEFILE)
@@ -316,116 +304,6 @@ uploader_clean:
$(V1) [ ! -d "$(UPLOADER_DIR)" ] || $(RM) -r "$(UPLOADER_DIR)"
-# We want to take snapshots of the UAVOs at each point that they change
-# to allow the GCS to be compatible with as many versions as possible.
-# We always include a pseudo collection called "srctree" which represents
-# the UAVOs in the source tree. So not necessary to add current tree UAVO
-# hash here, it is always included.
-
-# Find the git hashes of each commit that changes uavobjects with:
-# git log --format=%h -- shared/uavobjectdefinition/ | head -n 2
-# List only UAVO hashes of past releases, do not list current hash.
-# Past compatible versions are so far: RELEASE-12.10.2
-UAVO_GIT_VERSIONS := 5e14f53
-
-# All versions includes also the current source tree UAVO hash
-UAVO_ALL_VERSIONS := $(UAVO_GIT_VERSIONS) srctree
-
-# This is where the UAVO collections are stored
-UAVO_COLLECTION_DIR := $(BUILD_DIR)/uavo-collections
-
-# $(1) git hash of a UAVO snapshot
-define UAVO_COLLECTION_GIT_TEMPLATE
-
-# Make the output directory that will contain all of the synthetics for the
-# uavo collection referenced by the git hash $(1)
-$$(UAVO_COLLECTION_DIR)/$(1):
- $$(V1) $(MKDIR) -p $$(UAVO_COLLECTION_DIR)/$(1)
-
-# Extract the snapshot of shared/uavobjectdefinition from git hash $(1)
-$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar: | $$(UAVO_COLLECTION_DIR)/$(1)
-$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar:
- $$(V0) @$(ECHO) " UAVOTAR $(1)"
- $$(V1) $(GIT) archive $(1) -o $$@ -- shared/uavobjectdefinition/
-
-# Extract the uavo xml files from our snapshot
-$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar
- $$(V0) @$(ECHO) " UAVOUNTAR $(1)"
- $$(V1) $(RM) -rf $$@
- $$(V1) $(MKDIR) -p $$@
- $$(V1) $(TAR) -C $$(call toprel, $$@) -xf $$(call toprel, $$<) || $(RM) -rf $$@
-endef
-
-# Map the current working directory into the set of UAVO collections
-$(UAVO_COLLECTION_DIR)/srctree:
- $(V1) $(MKDIR) -p $@
-
-$(UAVO_COLLECTION_DIR)/srctree/uavo-xml: | $(UAVO_COLLECTION_DIR)/srctree
-$(UAVO_COLLECTION_DIR)/srctree/uavo-xml: $(UAVOBJ_XML_DIR)
- $(V1) $(LN) -sf $(ROOT_DIR) $(UAVO_COLLECTION_DIR)/srctree/uavo-xml
-
-# $(1) git hash (or symbolic name) of a UAVO snapshot
-define UAVO_COLLECTION_BUILD_TEMPLATE
-
-# This leaves us with a (broken) symlink that points to the full sha1sum of the collection
-$$(UAVO_COLLECTION_DIR)/$(1)/uavohash: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml
- # Compute the sha1 hash for this UAVO collection
- # The sed bit truncates the UAVO hash to 16 hex digits
- $$(V1) $$(VERSION_INFO) \
- --uavodir=$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition \
- --format='$$$${UAVO_HASH}' | \
- $(SED) -e 's|\(................\).*|\1|' > $$@
-
- $$(V0) @$(ECHO) " UAVOHASH $(1) ->" $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
-
-# Generate the java uavobjects for this UAVO collection
-$$(UAVO_COLLECTION_DIR)/$(1)/java-build/java: $$(UAVO_COLLECTION_DIR)/$(1)/uavohash
- $$(V0) @$(ECHO) " UAVOJAVA $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
- $$(V1) $(MKDIR) -p $$@
- $$(V1) ( \
- cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
- $$(UAVOBJGENERATOR) -java $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition $$(ROOT_DIR) ; \
- )
-
-# Build a jar file for this UAVO collection
-$$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: | $$(ANDROIDGCS_ASSETS_DIR)/uavos
-$$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java
- $$(V0) @$(ECHO) " UAVOJAR $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
- $$(V1) ( \
- HASH=$$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash) && \
- cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
- $(JAVAC) java/*.java \
- $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVDataObject.java \
- $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVObject*.java \
- $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVMetaObject.java \
- -d . && \
- find ./org/openpilot/uavtalk/uavobjects -type f -name '*.class' > classlist.txt && \
- $(JAR) cf tmp_uavobjects.jar @classlist.txt && \
- $$(ANDROID_DX) \
- --dex \
- --output $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar \
- tmp_uavobjects.jar && \
- $(LN) -sf $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar uavobjects.jar \
- )
-
-endef
-
-# One of these for each element of UAVO_GIT_VERSIONS so we can extract the UAVOs from git
-$(foreach githash, $(UAVO_GIT_VERSIONS), $(eval $(call UAVO_COLLECTION_GIT_TEMPLATE,$(githash))))
-
-# One of these for each UAVO_ALL_VERSIONS which includes the ones in the srctree
-$(foreach githash, $(UAVO_ALL_VERSIONS), $(eval $(call UAVO_COLLECTION_BUILD_TEMPLATE,$(githash))))
-
-.PHONY: uavo-collections_java
-uavo-collections_java: $(foreach githash, $(UAVO_ALL_VERSIONS), $(UAVO_COLLECTION_DIR)/$(githash)/java-build/uavobjects.jar)
-
-.PHONY: uavo-collections
-uavo-collections: uavo-collections_java
-
-.PHONY: uavo-collections_clean
-uavo-collections_clean:
- @$(ECHO) " CLEAN $(call toprel, $(UAVO_COLLECTION_DIR))"
- $(V1) [ ! -d "$(UAVO_COLLECTION_DIR)" ] || $(RM) -r $(UAVO_COLLECTION_DIR)
##############################
#
@@ -510,7 +388,7 @@ OPFW_FILES := $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(FIRMWARE_DIR)/$(fw_tar
OPFW_CONTENTS := \
\
\
- $(foreach fw_file, $(OPFW_FILES), $(fw_file)) \
+ $(foreach fw_file, $(OPFW_FILES), $(call system_path,$(fw_file))) \
\
diff --git a/ground/gcs/copydata.pro b/ground/gcs/copydata.pro
index 4fb80f27c..b5c2f4329 100644
--- a/ground/gcs/copydata.pro
+++ b/ground/gcs/copydata.pro
@@ -31,7 +31,7 @@ equals(copyqt, 1) {
libicui18n.so.54 \
libicuuc.so.54 \
libicudata.so.54
- *-64 {
+ contains(QT_ARCH, x86_64) {
QT_LIBS += libqgsttools_p.so.1
}
for(lib, QT_LIBS) {
@@ -48,12 +48,11 @@ equals(copyqt, 1) {
platforms/libqxcb.so \
xcbglintegrations/libqxcb-glx-integration.so \
sqldrivers/libqsqlite.so
- *-32 {
- QT_PLUGINS += mediaservice/libqtmedia_audioengine.so
- }
- *-64 {
+ contains(QT_ARCH, x86_64) {
QT_PLUGINS += mediaservice/libgstaudiodecoder.so \
mediaservice/libgstmediaplayer.so
+ } else {
+ QT_PLUGINS += mediaservice/libqtmedia_audioengine.so
}
}
@@ -81,13 +80,26 @@ equals(copyqt, 1) {
Qt5Quick$${DS}.dll \
Qt5QuickWidgets$${DS}.dll \
Qt5Qml$${DS}.dll \
- icuin54.dll \
- icudt54.dll \
- icuuc54.dll
- # it is more robust to take the following DLLs from Qt rather than from MinGW
- QT_DLLS += libgcc_s_dw2-1.dll \
- libstdc++-6.dll \
- libwinpthread-1.dll
+ libicuin56.dll \
+ libicudt56.dll \
+ libicuuc56.dll \
+ libstdc++-6.dll \
+ libwinpthread-1.dll \
+ libpcre16-0.dll \
+ zlib1.dll \
+ libharfbuzz-0.dll \
+ libfreetype-6.dll \
+ libbz2-1.dll \
+ libpng16-16.dll \
+ libglib-2.0-0.dll \
+ libintl-8.dll \
+ libiconv-2.dll
+ contains(QT_ARCH, i386) {
+ QT_DLLS += libgcc_s_dw2-1.dll
+ } else {
+ QT_DLLS += libgcc_s_seh-1.dll
+ }
+
for(dll, QT_DLLS) {
addCopyFileTarget($${dll},$$[QT_INSTALL_BINS],$${GCS_APP_PATH})
}
@@ -97,14 +109,14 @@ equals(copyqt, 1) {
ssleay32.dll \
libeay32.dll
for(dll, OPENSSL_DLLS) {
- addCopyFileTarget($${dll},$${OPENSSL_DIR},$${GCS_APP_PATH})
+ addCopyFileTarget($${dll},$$[QT_INSTALL_BINS],$${GCS_APP_PATH})
}
# copy OpenGL DLL
OPENGL_DLLS = \
- opengl32_32/opengl32.dll
+ opengl32.dll
for(dll, OPENGL_DLLS) {
- addCopyFileTarget($${dll},$${MESAWIN_DIR},$${GCS_APP_PATH})
+ addCopyFileTarget($${dll},$$[QT_INSTALL_BINS],$${GCS_APP_PATH}/opengl32)
}
QT_PLUGINS = iconengines/qsvgicon$${DS}.dll \
diff --git a/ground/gcs/gcs.pri b/ground/gcs/gcs.pri
index 143b34daa..150eaca0a 100644
--- a/ground/gcs/gcs.pri
+++ b/ground/gcs/gcs.pri
@@ -159,7 +159,6 @@ macx {
GCS_DOC_PATH = $$GCS_DATA_PATH/doc
copydata = 1
copyqt = 1
- copyosg = 1
} else {
GCS_APP_TARGET = $$GCS_SMALL_NAME
GCS_PATH = $$GCS_BUILD_TREE
@@ -185,7 +184,6 @@ macx {
GCS_QT_QML_PATH = $$GCS_APP_PATH
copyqt = $$copydata
- copyosg = $$copydata
} else {
GCS_QT_BASEPATH = $$GCS_LIBRARY_PATH/qt5
GCS_QT_LIBRARY_PATH = $$GCS_QT_BASEPATH/lib
@@ -198,7 +196,6 @@ macx {
} else {
copyqt = 0
}
- copyosg = 1
}
}
@@ -254,9 +251,11 @@ macx {
QMAKE_CFLAGS_WARN_ON += -Werror
QMAKE_CXXFLAGS_WARN_ON += -Wno-gnu-static-float-init
}
+ # building with libc++ is needed when linking with osg/gdal
+ QMAKE_CXXFLAGS += -stdlib=libc++
+ QMAKE_LFLAGS += -stdlib=libc++
}
-
# use ccache when available
QMAKE_CC = $$(CCACHE) $$QMAKE_CC
QMAKE_CXX = $$(CCACHE) $$QMAKE_CXX
diff --git a/ground/gcs/src/libs/libs.pro b/ground/gcs/src/libs/libs.pro
index f3ff6213c..e1b355cf2 100644
--- a/ground/gcs/src/libs/libs.pro
+++ b/ground/gcs/src/libs/libs.pro
@@ -12,6 +12,6 @@ SUBDIRS = \
qwt \
sdlgamepad
-exists( $(OSG_SDK_DIR) ) {
+osg {
SUBDIRS += osgearth
}
diff --git a/ground/gcs/src/libs/opmapcontrol/src/mapwidget/opmapwidget.cpp b/ground/gcs/src/libs/opmapcontrol/src/mapwidget/opmapwidget.cpp
index ee28e2501..f38632da4 100644
--- a/ground/gcs/src/libs/opmapcontrol/src/mapwidget/opmapwidget.cpp
+++ b/ground/gcs/src/libs/opmapcontrol/src/mapwidget/opmapwidget.cpp
@@ -26,9 +26,11 @@
*/
#include "opmapwidget.h"
+#include "waypointitem.h"
+
#include
#include
-#include "waypointitem.h"
+#include
namespace mapcontrol {
OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView(parent), configuration(config), UAV(0), GPS(0), Home(0)
@@ -210,7 +212,7 @@ void OPMapWidget::SetUseOpenGL(const bool &value)
{
useOpenGL = value;
if (useOpenGL) {
- setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
+ setViewport(new QOpenGLWidget()); // QGLFormat(QGL::SampleBuffers)));
} else {
setupViewport(new QWidget());
}
diff --git a/ground/gcs/src/libs/opmapcontrol/src/mapwidget/opmapwidget.h b/ground/gcs/src/libs/opmapcontrol/src/mapwidget/opmapwidget.h
index 895baf452..4f7d9d7fc 100644
--- a/ground/gcs/src/libs/opmapcontrol/src/mapwidget/opmapwidget.h
+++ b/ground/gcs/src/libs/opmapcontrol/src/mapwidget/opmapwidget.h
@@ -33,11 +33,7 @@
#include "../core/languagetype.h"
#include "../core/diagnostics.h"
#include "configuration.h"
-#include
-#include
#include "waypointitem.h"
-#include "QtSvg/QGraphicsSvgItem"
-#include "QGraphicsView"
#include "uavitem.h"
#include "gpsitem.h"
#include "homeitem.h"
@@ -45,6 +41,11 @@
#include "waypointline.h"
#include "waypointcircle.h"
#include "waypointitem.h"
+
+#include
+#include "QtSvg/QGraphicsSvgItem"
+#include "QGraphicsView"
+
namespace mapcontrol {
class UAVItem;
class GPSItem;
diff --git a/ground/gcs/src/libs/osgearth/copydata.pro b/ground/gcs/src/libs/osgearth/copydata.pro
index e28e3d7b9..992f8e4c7 100644
--- a/ground/gcs/src/libs/osgearth/copydata.pro
+++ b/ground/gcs/src/libs/osgearth/copydata.pro
@@ -1,200 +1,251 @@
#
# copy osg and osgearth libraries and data to build dir
#
-equals(copyosg, 1) {
- OSG_VERSION = 3.4.0
-
- linux {
- # copy osg libraries
-
- data_copy.commands += $(MKDIR) $${GCS_LIBRARY_PATH}/osg $$addNewline()
- *-64 {
- data_copy.commands += $(COPY_DIR) $$shell_quote($$OSG_SDK_DIR/lib64/)* $$shell_quote($$GCS_LIBRARY_PATH/osg/)
- }
- *-32 {
- data_copy.commands += $(COPY_DIR) $$shell_quote($$OSG_SDK_DIR/lib/)* $$shell_quote($$GCS_LIBRARY_PATH/osg/)
- }
-
- # add make target
- POST_TARGETDEPS += copydata
-
- data_copy.target = copydata
- QMAKE_EXTRA_TARGETS += data_copy
- }
-
- macx {
-
- data_copy.commands += $(COPY_DIR) $$shell_quote($$OSG_SDK_DIR/lib/)* $$shell_quote($$GCS_LIBRARY_PATH/)
-
- # add make target
- POST_TARGETDEPS += copydata
-
- data_copy.target = copydata
- QMAKE_EXTRA_TARGETS += data_copy
- }
-
- win32 {
- # set debug suffix if needed
- #CONFIG(debug, debug|release):DS = "d"
-
- # copy osg libraries
- OSG_LIBS = \
- libcurl-4.dll \
- libfreetype-6.dll \
- libgdal.dll \
- libgeos-3-3-8.dll \
- libgeos_c-1.dll \
- libjpeg-9.dll \
- libpng16-16.dll \
- libproj-0.dll \
- libtiff-5.dll \
- libtiffxx-5.dll \
- zlib1.dll \
- libOpenThreads$${DS}.dll \
- libosg$${DS}.dll \
- libosgAnimation$${DS}.dll \
- libosgDB$${DS}.dll \
- libosgEarth$${DS}.dll \
- libosgEarthAnnotation$${DS}.dll \
- libosgEarthFeatures$${DS}.dll \
- libosgEarthQt$${DS}.dll \
- libosgEarthSymbology$${DS}.dll \
- libosgEarthUtil$${DS}.dll \
- libosgFX$${DS}.dll \
- libosgGA$${DS}.dll \
- libosgManipulator$${DS}.dll \
- libosgParticle$${DS}.dll \
- libosgPresentation$${DS}.dll \
- libosgQt$${DS}.dll \
- libosgShadow$${DS}.dll \
- libosgSim$${DS}.dll \
- libosgTerrain$${DS}.dll \
- libosgText$${DS}.dll \
- libosgUtil$${DS}.dll \
- libosgViewer$${DS}.dll \
- libosgVolume$${DS}.dll \
- libosgWidget$${DS}.dll
- for(lib, OSG_LIBS) {
- addCopyFileTarget($${lib},$${OSG_SDK_DIR}/bin,$${GCS_APP_PATH})
- }
-
- OSG_PLUGINS = \
- mingw_osgdb_3dc$${DS}.dll \
- mingw_osgdb_3ds$${DS}.dll \
- mingw_osgdb_ac$${DS}.dll \
- mingw_osgdb_bmp$${DS}.dll \
- mingw_osgdb_bsp$${DS}.dll \
- mingw_osgdb_bvh$${DS}.dll \
- mingw_osgdb_cfg$${DS}.dll \
- mingw_osgdb_curl$${DS}.dll \
- mingw_osgdb_dds$${DS}.dll \
- mingw_osgdb_dot$${DS}.dll \
- mingw_osgdb_dw$${DS}.dll \
- mingw_osgdb_dxf$${DS}.dll \
- mingw_osgdb_earth$${DS}.dll \
- mingw_osgdb_gdal$${DS}.dll \
- mingw_osgdb_glsl$${DS}.dll \
- mingw_osgdb_gz$${DS}.dll \
- mingw_osgdb_hdr$${DS}.dll \
- mingw_osgdb_ive$${DS}.dll \
- mingw_osgdb_jpeg$${DS}.dll \
- mingw_osgdb_kml$${DS}.dll \
- mingw_osgdb_ktx$${DS}.dll \
- mingw_osgdb_logo$${DS}.dll \
- mingw_osgdb_lwo$${DS}.dll \
- mingw_osgdb_lws$${DS}.dll \
- mingw_osgdb_md2$${DS}.dll \
- mingw_osgdb_mdl$${DS}.dll \
- mingw_osgdb_normals$${DS}.dll \
- mingw_osgdb_obj$${DS}.dll \
- mingw_osgdb_ogr$${DS}.dll \
- mingw_osgdb_openflight$${DS}.dll \
- mingw_osgdb_osc$${DS}.dll \
- mingw_osgdb_osg$${DS}.dll \
- mingw_osgdb_osga$${DS}.dll \
- mingw_osgdb_osgearth_agglite$${DS}.dll \
- mingw_osgdb_osgearth_arcgis$${DS}.dll \
- mingw_osgdb_osgearth_arcgis_map_cache$${DS}.dll \
- mingw_osgdb_osgearth_bing$${DS}.dll \
- mingw_osgdb_osgearth_cache_filesystem$${DS}.dll \
- mingw_osgdb_osgearth_colorramp$${DS}.dll \
- mingw_osgdb_osgearth_debug$${DS}.dll \
- mingw_osgdb_osgearth_engine_byo$${DS}.dll \
- mingw_osgdb_osgearth_engine_mp$${DS}.dll \
- mingw_osgdb_osgearth_feature_ogr$${DS}.dll \
- mingw_osgdb_osgearth_feature_tfs$${DS}.dll \
- mingw_osgdb_osgearth_feature_wfs$${DS}.dll \
- mingw_osgdb_osgearth_gdal$${DS}.dll \
- mingw_osgdb_osgearth_label_annotation$${DS}.dll \
- mingw_osgdb_osgearth_mask_feature$${DS}.dll \
- mingw_osgdb_osgearth_model_feature_geom$${DS}.dll \
- mingw_osgdb_osgearth_model_feature_stencil$${DS}.dll \
- mingw_osgdb_osgearth_model_simple$${DS}.dll \
- mingw_osgdb_osgearth_noise$${DS}.dll \
- mingw_osgdb_osgearth_ocean_simple$${DS}.dll \
- mingw_osgdb_osgearth_osg$${DS}.dll \
- mingw_osgdb_osgearth_refresh$${DS}.dll \
- mingw_osgdb_osgearth_scriptengine_javascript$${DS}.dll \
- mingw_osgdb_osgearth_sky_gl$${DS}.dll \
- mingw_osgdb_osgearth_sky_simple$${DS}.dll \
- mingw_osgdb_osgearth_splat_mask$${DS}.dll \
- mingw_osgdb_osgearth_template_matclass$${DS}.dll \
- mingw_osgdb_osgearth_tilecache$${DS}.dll \
- mingw_osgdb_osgearth_tileindex$${DS}.dll \
- mingw_osgdb_osgearth_tileservice$${DS}.dll \
- mingw_osgdb_osgearth_tms$${DS}.dll \
- mingw_osgdb_osgearth_vdatum_egm2008$${DS}.dll \
- mingw_osgdb_osgearth_vdatum_egm84$${DS}.dll \
- mingw_osgdb_osgearth_vdatum_egm96$${DS}.dll \
- mingw_osgdb_osgearth_vpb$${DS}.dll \
- mingw_osgdb_osgearth_wcs$${DS}.dll \
- mingw_osgdb_osgearth_wms$${DS}.dll \
- mingw_osgdb_osgearth_xyz$${DS}.dll \
- mingw_osgdb_osgearth_yahoo$${DS}.dll \
- mingw_osgdb_osgshadow$${DS}.dll \
- mingw_osgdb_osgterrain$${DS}.dll \
- mingw_osgdb_osgtgz$${DS}.dll \
- mingw_osgdb_osgviewer$${DS}.dll \
- mingw_osgdb_p3d$${DS}.dll \
- mingw_osgdb_pic$${DS}.dll \
- mingw_osgdb_ply$${DS}.dll \
- mingw_osgdb_png$${DS}.dll \
- mingw_osgdb_pnm$${DS}.dll \
- mingw_osgdb_pov$${DS}.dll \
- mingw_osgdb_pvr$${DS}.dll \
- mingw_osgdb_revisions$${DS}.dll \
- mingw_osgdb_rgb$${DS}.dll \
- mingw_osgdb_rot$${DS}.dll \
- mingw_osgdb_scale$${DS}.dll \
- mingw_osgdb_serializers_osg$${DS}.dll \
- mingw_osgdb_serializers_osganimation$${DS}.dll \
- mingw_osgdb_serializers_osgfx$${DS}.dll \
- mingw_osgdb_serializers_osgga$${DS}.dll \
- mingw_osgdb_serializers_osgmanipulator$${DS}.dll \
- mingw_osgdb_serializers_osgparticle$${DS}.dll \
- mingw_osgdb_serializers_osgshadow$${DS}.dll \
- mingw_osgdb_serializers_osgsim$${DS}.dll \
- mingw_osgdb_serializers_osgterrain$${DS}.dll \
- mingw_osgdb_serializers_osgtext$${DS}.dll \
- mingw_osgdb_serializers_osgviewer$${DS}.dll \
- mingw_osgdb_serializers_osgvolume$${DS}.dll \
- mingw_osgdb_shp$${DS}.dll \
- mingw_osgdb_stl$${DS}.dll \
- mingw_osgdb_tga$${DS}.dll \
- mingw_osgdb_tgz$${DS}.dll \
- mingw_osgdb_tiff$${DS}.dll \
- mingw_osgdb_trans$${DS}.dll \
- mingw_osgdb_trk$${DS}.dll \
- mingw_osgdb_txf$${DS}.dll \
- mingw_osgdb_txp$${DS}.dll \
- mingw_osgdb_vtf$${DS}.dll \
- mingw_osgdb_x$${DS}.dll \
- mingw_osgdb_zip$${DS}.dll
- # copy osg plugins
- for(lib, OSG_PLUGINS) {
- addCopyFileTarget($${lib},$${OSG_SDK_DIR}/bin/osgPlugins-$${OSG_VERSION},$${GCS_LIBRARY_PATH}/osg/osgPlugins-$${OSG_VERSION})
- }
- }
+# set debug suffix if needed
+#win32:CONFIG(debug, debug|release):DS = "d"
+contains(QT_ARCH, x86_64) {
+ LIB_DIR_NAME = lib64
+} else {
+ LIB_DIR_NAME = lib
+}
+
+!msys2:OSG_VERSION = 3.4.0
+msys2:OSG_VERSION = 3.5.1
+
+
+osg:linux {
+ # copy osg libraries
+ data_copy.commands += $(MKDIR) $$GCS_LIBRARY_PATH/osg $$addNewline()
+ data_copy.commands += $(COPY_DIR) $$shell_quote($$OSG_SDK_DIR/$$LIB_DIR_NAME/)* $$shell_quote($$GCS_LIBRARY_PATH/osg/) $$addNewline()
+}
+
+osgearth:linux {
+ # copy osgearth libraries
+ data_copy.commands += $(MKDIR) $$GCS_LIBRARY_PATH/osg $$addNewline()
+ data_copy.commands += $(COPY_DIR) $$shell_quote($$OSGEARTH_SDK_DIR/$$LIB_DIR_NAME/)* $$shell_quote($$GCS_LIBRARY_PATH/osg/) $$addNewline()
+}
+
+osg:macx {
+ # copy osg libraries
+ data_copy.commands += $(COPY_DIR) $$shell_quote($$OSG_SDK_DIR/lib/)* $$shell_quote($$GCS_LIBRARY_PATH/) $$addNewline()
+}
+
+osgearth:macx {
+ # copy osgearth libraries
+ data_copy.commands += $(COPY_DIR) $$shell_quote($$OSGEARTH_SDK_DIR/lib/)* $$shell_quote($$GCS_LIBRARY_PATH/) $$addNewline()
+}
+
+linux|macx {
+ # add make target
+ POST_TARGETDEPS += copydata
+
+ data_copy.target = copydata
+ QMAKE_EXTRA_TARGETS += data_copy
+}
+
+osg:win32 {
+ # osg & osgearth dependencies
+
+ # curl
+ OSG_LIBS = \
+ libcurl-4.dll \
+ libidn-11.dll \
+ librtmp-1.dll \
+ libgmp-10.dll \
+ libgnutls-30.dll \
+ libp11-kit-0.dll \
+ libffi-6.dll \
+ libtasn1-6.dll \
+ libhogweed-4-1.dll \
+ libnettle-6-1.dll \
+ libssh2-1.dll
+
+
+ # gdal
+ OSG_LIBS += \
+ libgdal-20.dll \
+ libgeos_c.dll \
+ libgeos.dll \
+ libjpeg-8.dll \
+ libtiff-5.dll \
+ liblzma-5.dll \
+ libiconv-2.dll \
+ zlib1.dll
+
+ # other
+ OSG_LIBS += \
+ libproj-9.dll \
+ libfreetype-6.dll \
+ libpng16-16.dll
+
+ # osg libraries
+ OSG_LIBS += \
+ libOpenThreads$${DS}.dll \
+ libosg$${DS}.dll \
+ libosgAnimation$${DS}.dll \
+ libosgDB$${DS}.dll \
+ libosgFX$${DS}.dll \
+ libosgGA$${DS}.dll \
+ libosgManipulator$${DS}.dll \
+ libosgParticle$${DS}.dll \
+ libosgPresentation$${DS}.dll \
+ libosgShadow$${DS}.dll \
+ libosgSim$${DS}.dll \
+ libosgTerrain$${DS}.dll \
+ libosgText$${DS}.dll \
+ libosgUtil$${DS}.dll \
+ libosgViewer$${DS}.dll \
+ libosgVolume$${DS}.dll \
+ libosgWidget$${DS}.dll
+
+ osgQt:OSG_LIBS += \
+ libosgQt$${DS}.dll
+
+ for(lib, OSG_LIBS) {
+ addCopyFileTarget($${lib},$${OSG_SDK_DIR}/bin,$${GCS_APP_PATH})
+ }
+
+ # osg plugins
+ OSG_PLUGINS = \
+ mingw_osgdb_3dc$${DS}.dll \
+ mingw_osgdb_3ds$${DS}.dll \
+ mingw_osgdb_ac$${DS}.dll \
+ mingw_osgdb_bmp$${DS}.dll \
+ mingw_osgdb_bsp$${DS}.dll \
+ mingw_osgdb_bvh$${DS}.dll \
+ mingw_osgdb_cfg$${DS}.dll \
+ mingw_osgdb_curl$${DS}.dll \
+ mingw_osgdb_dds$${DS}.dll \
+ mingw_osgdb_dot$${DS}.dll \
+ mingw_osgdb_dw$${DS}.dll \
+ mingw_osgdb_dxf$${DS}.dll \
+ mingw_osgdb_gdal$${DS}.dll \
+ mingw_osgdb_glsl$${DS}.dll \
+ mingw_osgdb_gz$${DS}.dll \
+ mingw_osgdb_hdr$${DS}.dll \
+ mingw_osgdb_ive$${DS}.dll \
+ mingw_osgdb_jpeg$${DS}.dll \
+ mingw_osgdb_ktx$${DS}.dll \
+ mingw_osgdb_logo$${DS}.dll \
+ mingw_osgdb_lwo$${DS}.dll \
+ mingw_osgdb_lws$${DS}.dll \
+ mingw_osgdb_md2$${DS}.dll \
+ mingw_osgdb_mdl$${DS}.dll \
+ mingw_osgdb_normals$${DS}.dll \
+ mingw_osgdb_obj$${DS}.dll \
+ mingw_osgdb_ogr$${DS}.dll \
+ mingw_osgdb_openflight$${DS}.dll \
+ mingw_osgdb_osc$${DS}.dll \
+ mingw_osgdb_osg$${DS}.dll \
+ mingw_osgdb_osga$${DS}.dll \
+ mingw_osgdb_osgshadow$${DS}.dll \
+ mingw_osgdb_osgterrain$${DS}.dll \
+ mingw_osgdb_osgtgz$${DS}.dll \
+ mingw_osgdb_osgviewer$${DS}.dll \
+ mingw_osgdb_p3d$${DS}.dll \
+ mingw_osgdb_pic$${DS}.dll \
+ mingw_osgdb_ply$${DS}.dll \
+ mingw_osgdb_png$${DS}.dll \
+ mingw_osgdb_pnm$${DS}.dll \
+ mingw_osgdb_pov$${DS}.dll \
+ mingw_osgdb_pvr$${DS}.dll \
+ mingw_osgdb_revisions$${DS}.dll \
+ mingw_osgdb_rgb$${DS}.dll \
+ mingw_osgdb_rot$${DS}.dll \
+ mingw_osgdb_scale$${DS}.dll \
+ mingw_osgdb_shp$${DS}.dll \
+ mingw_osgdb_stl$${DS}.dll \
+ mingw_osgdb_tga$${DS}.dll \
+ mingw_osgdb_tgz$${DS}.dll \
+ mingw_osgdb_tiff$${DS}.dll \
+ mingw_osgdb_trans$${DS}.dll \
+ mingw_osgdb_trk$${DS}.dll \
+ mingw_osgdb_txf$${DS}.dll \
+ mingw_osgdb_txp$${DS}.dll \
+ mingw_osgdb_vtf$${DS}.dll \
+ mingw_osgdb_x$${DS}.dll \
+ mingw_osgdb_zip$${DS}.dll \
+ mingw_osgdb_serializers_osg$${DS}.dll \
+ mingw_osgdb_serializers_osganimation$${DS}.dll \
+ mingw_osgdb_serializers_osgfx$${DS}.dll \
+ mingw_osgdb_serializers_osgga$${DS}.dll \
+ mingw_osgdb_serializers_osgmanipulator$${DS}.dll \
+ mingw_osgdb_serializers_osgparticle$${DS}.dll \
+ mingw_osgdb_serializers_osgshadow$${DS}.dll \
+ mingw_osgdb_serializers_osgsim$${DS}.dll \
+ mingw_osgdb_serializers_osgterrain$${DS}.dll \
+ mingw_osgdb_serializers_osgtext$${DS}.dll \
+ mingw_osgdb_serializers_osgviewer$${DS}.dll \
+ mingw_osgdb_serializers_osgvolume$${DS}.dll
+
+ for(lib, OSG_PLUGINS) {
+ addCopyFileTarget($${lib},$${OSG_SDK_DIR}/bin/osgPlugins-$${OSG_VERSION},$${GCS_LIBRARY_PATH}/osg/osgPlugins-$${OSG_VERSION})
+ }
+}
+
+osgearth:win32 {
+ # osgearth libraries
+ OSGEARTH_LIBS = \
+ libosgEarth$${DS}.dll \
+ libosgEarthAnnotation$${DS}.dll \
+ libosgEarthFeatures$${DS}.dll \
+ libosgEarthSymbology$${DS}.dll \
+ libosgEarthUtil$${DS}.dll
+
+ osgearthQt:OSGEARTH_LIBS += \
+ libosgEarthQt$${DS}.dll
+
+ for(lib, OSGEARTH_LIBS) {
+ addCopyFileTarget($${lib},$${OSGEARTH_SDK_DIR}/bin,$${GCS_APP_PATH})
+ }
+
+ # osgearth plugins
+ OSGEARTH_PLUGINS += \
+ mingw_osgdb_earth$${DS}.dll \
+ mingw_osgdb_kml$${DS}.dll \
+ mingw_osgdb_osgearth_agglite$${DS}.dll \
+ mingw_osgdb_osgearth_arcgis$${DS}.dll \
+ mingw_osgdb_osgearth_arcgis_map_cache$${DS}.dll \
+ mingw_osgdb_osgearth_bing$${DS}.dll \
+ mingw_osgdb_osgearth_cache_filesystem$${DS}.dll \
+ mingw_osgdb_osgearth_colorramp$${DS}.dll \
+ mingw_osgdb_osgearth_debug$${DS}.dll \
+ mingw_osgdb_osgearth_engine_byo$${DS}.dll \
+ mingw_osgdb_osgearth_engine_mp$${DS}.dll \
+ mingw_osgdb_osgearth_feature_ogr$${DS}.dll \
+ mingw_osgdb_osgearth_feature_tfs$${DS}.dll \
+ mingw_osgdb_osgearth_feature_wfs$${DS}.dll \
+ mingw_osgdb_osgearth_gdal$${DS}.dll \
+ mingw_osgdb_osgearth_label_annotation$${DS}.dll \
+ mingw_osgdb_osgearth_mask_feature$${DS}.dll \
+ mingw_osgdb_osgearth_model_feature_geom$${DS}.dll \
+ mingw_osgdb_osgearth_model_feature_stencil$${DS}.dll \
+ mingw_osgdb_osgearth_model_simple$${DS}.dll \
+ mingw_osgdb_osgearth_noise$${DS}.dll \
+ mingw_osgdb_osgearth_ocean_simple$${DS}.dll \
+ mingw_osgdb_osgearth_osg$${DS}.dll \
+ mingw_osgdb_osgearth_refresh$${DS}.dll \
+ mingw_osgdb_osgearth_scriptengine_javascript$${DS}.dll \
+ mingw_osgdb_osgearth_sky_gl$${DS}.dll \
+ mingw_osgdb_osgearth_sky_simple$${DS}.dll \
+ mingw_osgdb_osgearth_splat_mask$${DS}.dll \
+ mingw_osgdb_osgearth_template_matclass$${DS}.dll \
+ mingw_osgdb_osgearth_tilecache$${DS}.dll \
+ mingw_osgdb_osgearth_tileindex$${DS}.dll \
+ mingw_osgdb_osgearth_tileservice$${DS}.dll \
+ mingw_osgdb_osgearth_tms$${DS}.dll \
+ mingw_osgdb_osgearth_vdatum_egm2008$${DS}.dll \
+ mingw_osgdb_osgearth_vdatum_egm84$${DS}.dll \
+ mingw_osgdb_osgearth_vdatum_egm96$${DS}.dll \
+ mingw_osgdb_osgearth_vpb$${DS}.dll \
+ mingw_osgdb_osgearth_wcs$${DS}.dll \
+ mingw_osgdb_osgearth_wms$${DS}.dll \
+ mingw_osgdb_osgearth_xyz$${DS}.dll \
+ mingw_osgdb_osgearth_yahoo$${DS}.dll
+
+ for(lib, OSGEARTH_PLUGINS) {
+ addCopyFileTarget($${lib},$${OSGEARTH_SDK_DIR}/bin/osgPlugins-$${OSG_VERSION},$${GCS_LIBRARY_PATH}/osg/osgPlugins-$${OSG_VERSION})
+ }
}
diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGCamera.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGCamera.cpp
index b0d566aae..0877b6296 100644
--- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGCamera.cpp
+++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGCamera.cpp
@@ -41,10 +41,10 @@
#include
-#include
-#include
+#ifdef USE_OSGEARTH
#include
#include
+#endif
#include
#include
@@ -67,29 +67,30 @@ public:
public:
Hidden(OSGCamera *parent) :
- QObject(parent), sceneData(NULL), manipulatorMode(Default), node(NULL),
- trackerMode(NodeCenterAndAzim), trackNode(NULL),
- logDepthBufferEnabled(false), logDepthBuffer(NULL), clampToTerrain(false)
+ QObject(parent), sceneData(NULL), manipulatorMode(ManipulatorMode::Default), node(NULL),
+ trackerMode(TrackerMode::NodeCenterAndAzim), trackNode(NULL),
+ logDepthBufferEnabled(false), clampToTerrain(false)
{
fieldOfView = 90.0;
- first = true;
+ first = true;
- dirty = false;
+ dirty = false;
+ fovDirty = false;
- sizeDirty = false;
- x = 0;
- y = 0;
- width = 0;
- height = 0;
+#ifdef USE_OSGEARTH
+ logDepthBuffer = NULL;
+#endif
}
~Hidden()
{
+#ifdef USE_OSGEARTH
if (logDepthBuffer) {
delete logDepthBuffer;
logDepthBuffer = NULL;
}
+#endif
}
bool acceptSceneData(OSGNode *node)
@@ -112,7 +113,7 @@ public:
return true;
}
- bool acceptManipulatorMode(ManipulatorMode mode)
+ bool acceptManipulatorMode(ManipulatorMode::Enum mode)
{
// qDebug() << "OSGCamera::acceptManipulatorMode" << mode;
if (manipulatorMode == mode) {
@@ -184,20 +185,26 @@ public:
this->camera = camera;
+ // TODO don't add update callback as this disables ON_DEMAND frame update scheme
+ // see https://github.com/gwaldron/osgearth/commit/796daf4792ccaf18ae7eb6a5cb268eef0d42888d
+ // see ViewportRenderer::render() in OSGViewport.cpp
cameraUpdateCallback = new CameraUpdateCallback(this);
camera->addUpdateCallback(cameraUpdateCallback);
+#ifdef USE_OSGEARTH
// install log depth buffer if requested
if (logDepthBufferEnabled) {
qDebug() << "OSGCamera::attach - install logarithmic depth buffer";
logDepthBuffer = new osgEarth::Util::LogarithmicDepthBuffer();
- // logDepthBuffer->setUseFragDepth(true);
+ logDepthBuffer->setUseFragDepth(true);
logDepthBuffer->install(camera);
}
+#endif
- dirty = true;
- sizeDirty = true;
+ dirty = true;
+ fovDirty = true;
updateCamera();
+ updateAspectRatio();
}
void detachCamera(osg::Camera *camera)
@@ -215,14 +222,13 @@ public:
cameraUpdateCallback = NULL;
}
+#ifdef USE_OSGEARTH
if (logDepthBuffer) {
logDepthBuffer->uninstall(camera);
delete logDepthBuffer;
logDepthBuffer = NULL;
}
-
- // reset viewport
- x = y = width = height = 0;
+#endif
}
void attachManipulator(osgViewer::View *view)
@@ -232,7 +238,7 @@ public:
osgGA::CameraManipulator *cm = NULL;
switch (manipulatorMode) {
- case OSGCamera::Default:
+ case ManipulatorMode::Default:
{
qDebug() << "OSGCamera::attachManipulator - use TrackballManipulator";
osgGA::TrackballManipulator *tm = new osgGA::TrackballManipulator();
@@ -241,20 +247,25 @@ public:
cm = tm;
break;
}
- case OSGCamera::User:
+ case ManipulatorMode::User:
qDebug() << "OSGCamera::attachManipulator - no camera manipulator";
// disable any installed camera manipulator
+ // TODO create and use own camera manipulator to avoid disabling ON_DEMAND frame update scheme
+ // see https://github.com/gwaldron/osgearth/commit/796daf4792ccaf18ae7eb6a5cb268eef0d42888d
+ // TODO see StandardManaipulator for example on how to react to events (tohabd FOV changes without the need for an update callback?)
cm = NULL;
break;
- case OSGCamera::Earth:
+ case ManipulatorMode::Earth:
{
+#ifdef USE_OSGEARTH
qDebug() << "OSGCamera::attachManipulator - use EarthManipulator";
osgEarth::Util::EarthManipulator *em = new osgEarth::Util::EarthManipulator();
em->getSettings()->setThrowingEnabled(true);
cm = em;
+#endif
break;
}
- case OSGCamera::Track:
+ case ManipulatorMode::Track:
qDebug() << "OSGCamera::attachManipulator - use NodeTrackerManipulator";
if (trackNode && trackNode->node()) {
// setup tracking camera
@@ -263,22 +274,18 @@ public:
osgGA::NodeTrackerManipulator *ntm = new osgGA::NodeTrackerManipulator(
/*osgGA::StandardManipulator::COMPUTE_HOME_USING_BBOX | osgGA::StandardManipulator::DEFAULT_SETTINGS*/);
switch (trackerMode) {
- case NodeCenter:
+ case TrackerMode::NodeCenter:
ntm->setTrackerMode(osgGA::NodeTrackerManipulator::NODE_CENTER);
break;
- case NodeCenterAndAzim:
+ case TrackerMode::NodeCenterAndAzim:
ntm->setTrackerMode(osgGA::NodeTrackerManipulator::NODE_CENTER_AND_AZIM);
break;
- case NodeCenterAndRotation:
+ case TrackerMode::NodeCenterAndRotation:
ntm->setTrackerMode(osgGA::NodeTrackerManipulator::NODE_CENTER_AND_ROTATION);
break;
}
ntm->setTrackNode(trackNode->node());
- // ntm->setRotationMode(trackRotationMode)
- // ntm->setMinimumDistance(2, false);
ntm->setVerticalAxisFixed(false);
- // ntm->setAutoComputeHomePosition(true);
- // ntm->setDistance(100);
cm = ntm;
} else {
qWarning() << "OSGCamera::attachManipulator - no track node provided.";
@@ -311,31 +318,19 @@ public:
void updateCamera()
{
- if (first) {
- first = false;
- updateCameraFOV();
- }
- updateCameraSize();
- if (manipulatorMode == User) {
+ updateCameraFOV();
+ if (manipulatorMode == ManipulatorMode::User) {
updateCameraPosition();
}
}
- void updateCameraSize()
- {
- if (!sizeDirty || !camera.valid()) {
- return;
- }
- sizeDirty = false;
-
- // qDebug() << "OSGCamera::updateCamera size" << x << y << width << height << fieldOfView;
- camera->getGraphicsContext()->resized(x, y, width, height);
- camera->setViewport(x, y, width, height);
- updateAspectRatio();
- }
-
void updateCameraFOV()
{
+ if (!fovDirty || !camera.valid()) {
+ return;
+ }
+ fovDirty = false;
+
// qDebug() << "OSGCamera::updateCameraFOV";
double fovy, ar, zn, zf;
@@ -351,7 +346,8 @@ public:
camera->getProjectionMatrixAsPerspective(fovy, ar, zn, zf);
- ar = static_cast(width) / static_cast(height);
+ osg::Viewport *viewport = camera->getViewport();
+ ar = static_cast(viewport->width()) / static_cast(viewport->height());
camera->setProjectionMatrixAsPerspective(fovy, ar, zn, zf);
}
@@ -370,6 +366,9 @@ public:
// TODO compensate antenna height when source of position is GPS (i.e. subtract antenna height from altitude) ;)
// Camera position
+ osg::Matrix cameraPosition;
+
+#ifdef USE_OSGEARTH
osgEarth::GeoPoint geoPoint = osgQtQuick::toGeoPoint(position);
if (clampToTerrain) {
if (sceneData) {
@@ -382,8 +381,8 @@ public:
}
}
- osg::Matrix cameraPosition;
geoPoint.createLocalToWorld(cameraPosition);
+#endif
// Camera orientation
// By default the camera looks toward -Z, we must rotate it so it looks toward Y
@@ -404,20 +403,23 @@ public:
}
qreal fieldOfView;
+ bool fovDirty;
OSGNode *sceneData;
- ManipulatorMode manipulatorMode;
+ ManipulatorMode::Enum manipulatorMode;
// to compute home position
- OSGNode *node;
+ OSGNode *node;
// for NodeTrackerManipulator
- TrackerMode trackerMode;
- OSGNode *trackNode;
+ TrackerMode::Enum trackerMode;
+ OSGNode *trackNode;
- bool logDepthBufferEnabled;
+ bool logDepthBufferEnabled;
+#ifdef USE_OSGEARTH
osgEarth::Util::LogarithmicDepthBuffer *logDepthBuffer;
+#endif
bool first;
@@ -430,12 +432,6 @@ public:
QVector3D attitude;
QVector3D position;
- bool sizeDirty;
- int x;
- int y;
- int width;
- int height;
-
osg::ref_ptr camera;
osg::ref_ptr cameraUpdateCallback;
@@ -478,23 +474,13 @@ qreal OSGCamera::fieldOfView() const
return h->fieldOfView;
}
-// ! Camera vertical field of view in degrees
+// Camera vertical field of view in degrees
void OSGCamera::setFieldOfView(qreal arg)
{
if (h->fieldOfView != arg) {
h->fieldOfView = arg;
- h->sizeDirty = true;
+ h->fovDirty = true;
emit fieldOfViewChanged(fieldOfView());
-
- // it should be a queued call to OSGCameraRenderer instead
- /*if (h->viewer.get()) {
- h->viewer->getCamera()->setProjectionMatrixAsPerspective(
- h->fieldOfView,
- qreal(h->currentSize.width())/h->currentSize.height(),
- 1.0f, 10000.0f);
- }*/
-
- // updateFrame();
}
}
@@ -510,12 +496,12 @@ void OSGCamera::setSceneData(OSGNode *node)
}
}
-OSGCamera::ManipulatorMode OSGCamera::manipulatorMode() const
+ManipulatorMode::Enum OSGCamera::manipulatorMode() const
{
return h->manipulatorMode;
}
-void OSGCamera::setManipulatorMode(ManipulatorMode mode)
+void OSGCamera::setManipulatorMode(ManipulatorMode::Enum mode)
{
if (h->acceptManipulatorMode(mode)) {
emit manipulatorModeChanged(manipulatorMode());
@@ -546,12 +532,12 @@ void OSGCamera::setTrackNode(OSGNode *node)
}
}
-OSGCamera::TrackerMode OSGCamera::trackerMode() const
+TrackerMode::Enum OSGCamera::trackerMode() const
{
return h->trackerMode;
}
-void OSGCamera::setTrackerMode(TrackerMode mode)
+void OSGCamera::setTrackerMode(TrackerMode::Enum mode)
{
if (h->trackerMode != mode) {
h->trackerMode = mode;
@@ -619,23 +605,6 @@ void OSGCamera::setLogarithmicDepthBuffer(bool enabled)
}
}
-void OSGCamera::setViewport(int x, int y, int width, int height)
-{
- // qDebug() << "OSGCamera::setViewport" << x << y << width << "x" << heigth;
- if (width <= 0 || height <= 0) {
- qWarning() << "OSGCamera::setViewport - invalid size" << width << "x" << height;
- return;
- }
- if (h->x != x || h->y != y || h->width != width || h->height != height) {
- qWarning() << "OSGCamera::setViewport" << width << "x" << height;
- h->x = x;
- h->y = y;
- h->width = width;
- h->height = height;
- h->sizeDirty = true;
- }
-}
-
bool OSGCamera::attach(osgViewer::View *view)
{
return h->attach(view);
diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGCamera.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGCamera.hpp
index 6b40f153d..08c06518f 100644
--- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGCamera.hpp
+++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGCamera.hpp
@@ -40,6 +40,20 @@ class View;
namespace osgQtQuick {
class OSGNode;
+class ManipulatorMode : public QObject {
+ Q_OBJECT
+public:
+ enum Enum { Default, Earth, Track, User };
+ Q_ENUMS(Enum) // TODO switch to Q_ENUM once on Qt 5.5
+};
+
+class TrackerMode : public QObject {
+ Q_OBJECT
+public:
+ enum Enum { NodeCenter, NodeCenterAndAzim, NodeCenterAndRotation };
+ Q_ENUMS(Enum) // TODO switch to Q_ENUM once on Qt 5.5
+};
+
// This class does too much:
// - tracking a geo point and attitude
// - tracking another node
@@ -52,32 +66,18 @@ class OSGNode;
// - provide good default distance and attitude for tracker camera
class OSGQTQUICK_EXPORT OSGCamera : public QObject {
Q_OBJECT Q_PROPERTY(qreal fieldOfView READ fieldOfView WRITE setFieldOfView NOTIFY fieldOfViewChanged)
-
Q_PROPERTY(osgQtQuick::OSGNode * sceneData READ sceneData WRITE setSceneData NOTIFY sceneDataChanged)
-
- Q_PROPERTY(ManipulatorMode manipulatorMode READ manipulatorMode WRITE setManipulatorMode NOTIFY manipulatorModeChanged)
-
+ Q_PROPERTY(osgQtQuick::ManipulatorMode::Enum manipulatorMode READ manipulatorMode WRITE setManipulatorMode NOTIFY manipulatorModeChanged)
Q_PROPERTY(osgQtQuick::OSGNode * node READ node WRITE setNode NOTIFY nodeChanged)
-
Q_PROPERTY(osgQtQuick::OSGNode * trackNode READ trackNode WRITE setTrackNode NOTIFY trackNodeChanged)
- Q_PROPERTY(TrackerMode trackerMode READ trackerMode WRITE setTrackerMode NOTIFY trackerModeChanged)
-
+ Q_PROPERTY(osgQtQuick::TrackerMode::Enum trackerMode READ trackerMode WRITE setTrackerMode NOTIFY trackerModeChanged)
Q_PROPERTY(bool clampToTerrain READ clampToTerrain WRITE setClampToTerrain NOTIFY clampToTerrainChanged)
Q_PROPERTY(bool intoTerrain READ intoTerrain NOTIFY intoTerrainChanged)
-
Q_PROPERTY(QVector3D attitude READ attitude WRITE setAttitude NOTIFY attitudeChanged)
Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged)
-
Q_PROPERTY(bool logarithmicDepthBuffer READ logarithmicDepthBuffer WRITE setLogarithmicDepthBuffer NOTIFY logarithmicDepthBufferChanged)
- Q_ENUMS(ManipulatorMode)
- Q_ENUMS(TrackerMode)
-
public:
- enum ManipulatorMode { Default, Earth, Track, User };
-
- enum TrackerMode { NodeCenter, NodeCenterAndAzim, NodeCenterAndRotation };
-
explicit OSGCamera(QObject *parent = 0);
virtual ~OSGCamera();
@@ -91,8 +91,8 @@ public:
OSGNode *sceneData();
void setSceneData(OSGNode *node);
- ManipulatorMode manipulatorMode() const;
- void setManipulatorMode(ManipulatorMode);
+ ManipulatorMode::Enum manipulatorMode() const;
+ void setManipulatorMode(ManipulatorMode::Enum);
OSGNode *node() const;
void setNode(OSGNode *node);
@@ -100,8 +100,8 @@ public:
OSGNode *trackNode() const;
void setTrackNode(OSGNode *node);
- TrackerMode trackerMode() const;
- void setTrackerMode(TrackerMode);
+ TrackerMode::Enum trackerMode() const;
+ void setTrackerMode(TrackerMode::Enum);
bool clampToTerrain() const;
void setClampToTerrain(bool arg);
@@ -117,8 +117,6 @@ public:
bool logarithmicDepthBuffer();
void setLogarithmicDepthBuffer(bool enabled);
- void setViewport(int x, int y, int width, int height);
-
virtual bool attach(osgViewer::View *view);
virtual bool detach(osgViewer::View *view);
@@ -127,12 +125,12 @@ signals:
void sceneDataChanged(OSGNode *node);
- void manipulatorModeChanged(ManipulatorMode);
+ void manipulatorModeChanged(ManipulatorMode::Enum);
void nodeChanged(OSGNode *node);
void trackNodeChanged(OSGNode *node);
- void trackerModeChanged(TrackerMode);
+ void trackerModeChanged(TrackerMode::Enum);
void clampToTerrainChanged(bool arg);
void intoTerrainChanged(bool arg);
diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGFileNode.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGFileNode.cpp
index 5e1d5ab5d..19e5ff249 100644
--- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGFileNode.cpp
+++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGFileNode.cpp
@@ -75,7 +75,7 @@ private:
OSGFileNode * const self;
public:
- Hidden(OSGFileNode *parent) : QObject(parent), self(parent), url(), async(false), optimizeMode(None) {}
+ Hidden(OSGFileNode *parent) : QObject(parent), self(parent), url(), async(false), optimizeMode(OptimizeMode::None) {}
bool acceptSource(QUrl url)
{
@@ -99,7 +99,7 @@ public:
QUrl url;
bool async;
- OptimizeMode optimizeMode;
+ OptimizeMode::Enum optimizeMode;
private:
@@ -133,7 +133,7 @@ private:
bool acceptNode(osg::Node *node)
{
qDebug() << "OSGFileNode::acceptNode" << node;
- if (node && optimizeMode != OSGFileNode::None) {
+ if (node && optimizeMode != OptimizeMode::None) {
// qDebug() << "OSGFileNode::acceptNode - optimize" << node << optimizeMode;
osgUtil::Optimizer optimizer;
optimizer.optimize(node, osgUtil::Optimizer::DEFAULT_OPTIMIZATIONS);
@@ -186,12 +186,12 @@ void OSGFileNode::setAsync(const bool async)
}
}
-OSGFileNode::OptimizeMode OSGFileNode::optimizeMode() const
+OptimizeMode::Enum OSGFileNode::optimizeMode() const
{
return h->optimizeMode;
}
-void OSGFileNode::setOptimizeMode(OptimizeMode mode)
+void OSGFileNode::setOptimizeMode(OptimizeMode::Enum mode)
{
// qDebug() << "OSGFileNode::setOptimizeMode" << mode;
if (h->optimizeMode != mode) {
diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGFileNode.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGFileNode.hpp
index fcac16093..b0dbd2717 100644
--- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGFileNode.hpp
+++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGFileNode.hpp
@@ -37,15 +37,19 @@ class QUrl;
QT_END_NAMESPACE
namespace osgQtQuick {
+class OSGQTQUICK_EXPORT OptimizeMode : public QObject {
+ Q_OBJECT
+public:
+ enum Enum { None, Optimize, OptimizeAndCheck };
+ Q_ENUMS(Enum) // TODO switch to Q_ENUM once on Qt 5.5
+};
+
class OSGQTQUICK_EXPORT OSGFileNode : public OSGNode {
Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
Q_PROPERTY(bool async READ async WRITE setAsync NOTIFY asyncChanged)
- Q_PROPERTY(OptimizeMode optimizeMode READ optimizeMode WRITE setOptimizeMode NOTIFY optimizeModeChanged)
-
- Q_ENUMS(OptimizeMode)
+ Q_PROPERTY(osgQtQuick::OptimizeMode::Enum optimizeMode READ optimizeMode WRITE setOptimizeMode NOTIFY optimizeModeChanged)
public:
- enum OptimizeMode { None, Optimize, OptimizeAndCheck };
OSGFileNode(QObject *parent = 0);
virtual ~OSGFileNode();
@@ -56,13 +60,13 @@ public:
bool async() const;
void setAsync(const bool async);
- OptimizeMode optimizeMode() const;
- void setOptimizeMode(OptimizeMode);
+ OptimizeMode::Enum optimizeMode() const;
+ void setOptimizeMode(OptimizeMode::Enum);
signals:
void sourceChanged(const QUrl &url);
void asyncChanged(const bool async);
- void optimizeModeChanged(OptimizeMode);
+ void optimizeModeChanged(OptimizeMode::Enum);
private:
struct Hidden;
diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGSkyNode.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGSkyNode.cpp
index 95b2bc76d..80f314da3 100644
--- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGSkyNode.cpp
+++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGSkyNode.cpp
@@ -43,8 +43,11 @@ struct OSGSkyNode::Hidden : public QObject {
Q_OBJECT
public:
- Hidden(OSGSkyNode *parent) : QObject(parent), self(parent), sceneData(NULL), sunLightEnabled(true), dateTime(), minimumAmbientLight(0.03)
- {}
+ Hidden(OSGSkyNode *parent) : QObject(parent),
+ self(parent), sceneData(NULL), sunLightEnabled(true), minimumAmbientLight(0.03)
+ {
+ dateTime = QDateTime::currentDateTime();
+ }
~Hidden()
{}
diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGViewport.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGViewport.cpp
index 7e47cff12..18a78ea2e 100644
--- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGViewport.cpp
+++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGViewport.cpp
@@ -42,9 +42,9 @@
#include
#include
+#ifdef USE_OSGEARTH
#include
-#include
-#include
+#endif
#include
#include
@@ -62,7 +62,6 @@ namespace osgQtQuick {
Debugging tips
- export OSG_NOTIFY_LEVEL=DEBUG
-
Z-fighting can happen with coincident polygons, but it can also happen when the Z buffer has insufficient resolution
to represent the data in the scene. In the case where you are close up to an object (the helicopter)
and also viewing a far-off object (the earth) the Z buffer has to stretch to accommodate them both.
@@ -71,11 +70,10 @@ namespace osgQtQuick {
Assuming you are not messing around with the near/far computations, and assuming you don't have any other objects
in the scene that are farther off than the earth, there are a couple things you can try.
- One, adjust the near/far ratio of the camera. Look at osgearth_viewer.cpp to see how.
+ Adjust the near/far ratio of the camera. Look at osgearth_viewer.cpp to see how.
+ Use LogarythmicDepthBuffer.
- Two, you can try to use the AutoClipPlaneHandler. You can install it automatically by running osgearth_viewer --autoclip.
-
- If none of that works, you can try parenting your helicopter with an osg::Camera in NESTED mode,
+ More complex : you can try parenting your helicopter with an osg::Camera in NESTED mode,
which will separate the clip plane calculations of the helicopter from those of the earth. *
TODO : add OSGView to handle multiple views for a given OSGViewport
@@ -90,18 +88,13 @@ public:
window(NULL),
sceneData(NULL),
camera(NULL),
- updateMode(Discrete),
+ updateMode(UpdateMode::Discrete),
frameTimer(-1)
{
qDebug() << "OSGViewport::Hidden";
OsgEarth::initialize();
- // workaround to avoid using GraphicsContext #0
- if (!dummy.valid()) {
- dummy = createGraphicsContext();
- }
-
createViewer();
connect(quickItem, &OSGViewport::windowChanged, this, &Hidden::onWindowChanged);
@@ -173,7 +166,6 @@ public:
return false;
}
if (camera) {
- camera->setViewport(0, 0, self->width(), self->height());
camera->attach(view);
} else {
qWarning() << "OSGViewport::attach - no camera!";
@@ -194,20 +186,17 @@ public:
return true;
}
+#ifdef USE_OSGEARTH
// TODO map handling should not be done here
osgEarth::MapNode *mapNode = osgEarth::MapNode::findMapNode(node);
- if (false && mapNode) {
+ if (mapNode) {
qDebug() << "OSGViewport::attach - found map node" << mapNode;
- // install AutoClipPlaneCullCallback : computes near/far planes based on scene geometry
- qDebug() << "OSGViewport::attach - set AutoClipPlaneCullCallback on camera";
- // TODO will the AutoClipPlaneCullCallback be destroyed ?
- // TODO does it need to be added to the map node or to the view ?
- cullCallback = new osgEarth::Util::AutoClipPlaneCullCallback(mapNode);
- // view->getCamera()->addCullCallback(cullCallback);
- mapNode->addCullCallback(cullCallback);
- }
- // view->getCamera()->setSmallFeatureCullingPixelSize(-1.0f);
+ // remove light to prevent unnecessary state changes in SceneView
+ // scene will get light from sky
+ view->setLightingMode(osg::View::NO_LIGHT);
+ }
+#endif
view->setSceneData(node);
@@ -217,17 +206,9 @@ public:
bool detach(osgViewer::View *view)
{
qDebug() << "OSGViewport::detach" << view;
-
if (camera) {
camera->detach(view);
}
-
- osgEarth::MapNode *mapNode = osgEarth::MapNode::findMapNode(view->getSceneData());
- if (mapNode) {
- view->getCamera()->removeCullCallback(cullCallback);
- cullCallback = NULL;
- }
-
return true;
}
@@ -276,7 +257,7 @@ public:
// view->getCamera()->setGraphicsContext(NULL);
}
- bool acceptUpdateMode(OSGViewport::UpdateMode mode)
+ bool acceptUpdateMode(UpdateMode::Enum mode)
{
// qDebug() << "OSGViewport::acceptUpdateMode" << mode;
if (updateMode == mode) {
@@ -300,22 +281,20 @@ public:
return true;
}
- OSGViewport *self;
+ OSGViewport *self;
- QQuickWindow *window;
+ QQuickWindow *window;
- OSGNode *sceneData;
- OSGCamera *camera;
+ OSGNode *sceneData;
+ OSGCamera *camera;
- OSGViewport::UpdateMode updateMode;
+ UpdateMode::Enum updateMode;
int frameTimer;
- osg::ref_ptr viewer;
+ osg::ref_ptr viewer;
osg::ref_ptr view;
- osg::ref_ptr cullCallback;
-
static osg::ref_ptr dummy;
static QtKeyboardMap keyMap;
@@ -332,9 +311,6 @@ public:
viewer = new osgViewer::CompositeViewer();
viewer->setThreadingModel(osgViewer::ViewerBase::SingleThreaded);
- osg::ref_ptr ico = new osgUtil::IncrementalCompileOperation();
- ico->setTargetFrameRate(30.0f);
- viewer->setIncrementalCompileOperation(ico);
// disable the default setting of viewer.done() by pressing Escape.
viewer->setKeyEventSetsDone(0);
@@ -355,7 +331,7 @@ public:
osgViewer::View *createView()
{
- qWarning() << "OSGViewport::createView";
+ qDebug() << "OSGViewport::createView";
osgViewer::View *view = new osgViewer::View();
// TODO will the handlers be destroyed???
@@ -384,14 +360,18 @@ public:
// add the screen capture handler
// view->addEventHandler(new osgViewer::ScreenCaptureHandler);
- view->getCamera()->setGraphicsContext(createGraphicsContext());
+ // setup graphics context and camera
+ osg::Camera *camera = view->getCamera();
+ osg::GraphicsContext *gc = createGraphicsContext();
+ camera->setGraphicsContext(gc);
+ camera->setViewport(new osg::Viewport(0, 0, gc->getTraits()->width, gc->getTraits()->height));
return view;
}
osg::GraphicsContext *createGraphicsContext()
{
- qWarning() << "OSGViewport::createGraphicsContext";
+ qDebug() << "OSGViewport::createGraphicsContext";
osg::GraphicsContext::Traits *traits = getTraits();
// traitsInfo(*traits);
@@ -440,7 +420,7 @@ public:
void start()
{
- if (updateMode == OSGViewport::Discrete && (frameTimer < 0)) {
+ if (updateMode == UpdateMode::Discrete && (frameTimer < 0)) {
qDebug() << "OSGViewport::start - starting timer";
frameTimer = startTimer(33, Qt::PreciseTimer);
}
@@ -491,15 +471,14 @@ public:
h->initializeResources();
- requestRedraw = false;
+ firstFrame = true;
+ needToDoFrame = false;
}
~ViewportRenderer()
{
qDebug() << "ViewportRenderer::~ViewportRenderer";
osgQtQuick::openGLContextInfo(QOpenGLContext::currentContext(), "ViewportRenderer::~ViewportRenderer");
-
- h->releaseResources();
}
// This function is the only place when it is safe for the renderer and the item to read and write each others members.
@@ -508,12 +487,29 @@ public:
// qDebug() << "ViewportRenderer::synchronize";
// osgQtQuick::openGLContextInfo(QOpenGLContext::currentContext(), "ViewportRenderer::synchronize");
+ if (!h->viewer.valid()) {
+ qWarning() << "ViewportRenderer::synchronize - invalid viewer";
+ return;
+ }
+
if (!h->view.valid()) {
qWarning() << "ViewportRenderer::synchronize - invalid view";
return;
}
- // need to split frame() open and do the synchronization here (calling update callbacks, etc...)
+ needToDoFrame = h->viewer->checkNeedToDoFrame();
+ if (needToDoFrame) {
+ if (firstFrame) {
+ h->view->init();
+ if (!h->viewer->isRealized()) {
+ h->viewer->realize();
+ }
+ firstFrame = false;
+ }
+ h->viewer->advance();
+ h->viewer->eventTraversal();
+ h->viewer->updateTraversal();
+ }
}
// This function is called when the FBO should be rendered into.
@@ -524,22 +520,19 @@ public:
// osgQtQuick::openGLContextInfo(QOpenGLContext::currentContext(), "ViewportRenderer::render");
if (!h->viewer.valid()) {
- qWarning() << "ViewportRenderer::render - invalid viewport";
+ qWarning() << "ViewportRenderer::render - invalid viewer";
return;
}
- // needed to properly render models without terrain (Qt bug?)
- QOpenGLContext::currentContext()->functions()->glUseProgram(0);
- if (checkNeedToDoFrame()) {
- // TODO scene update should NOT be done here
- h->viewer->frame();
- requestRedraw = false;
+ if (needToDoFrame) {
+ // needed to properly render models without terrain (Qt bug?)
+ QOpenGLContext::currentContext()->functions()->glUseProgram(0);
+ h->viewer->renderingTraversals();
+ needToDoFrame = false;
}
- // h->self->window()->resetOpenGLState();
-
- if (h->updateMode == OSGViewport::Continuous) {
+ if (h->updateMode == UpdateMode::Continuous) {
// trigger next update
update();
}
@@ -547,35 +540,31 @@ public:
QOpenGLFramebufferObject *createFramebufferObject(const QSize &size)
{
- qDebug() << "ViewportRenderer::createFramebufferObject" << size;
- if (h->camera) {
- h->camera->setViewport(0, 0, size.width(), size.height());
+ // qDebug() << "ViewportRenderer::createFramebufferObject" << size;
+ if (h->view.valid()) {
+ h->view->getCamera()->getGraphicsContext()->resized(0, 0, size.width(), size.height());
+ h->view->getEventQueue()->windowResize(0, 0, size.width(), size.height());
}
QOpenGLFramebufferObjectFormat format;
format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
// format.setSamples(4);
- int dpr = h->self->window()->devicePixelRatio();
+
+ // Keeping this for reference :
+ // Mac need(ed) to have devicePixelRatio (dpr) taken into account (i.e. dpr = 2).
+ // Further tests on Mac have shown that although dpr is still 2 it should not be used to scale the fbo.
+ // Note that getting the window to get the devicePixelRatio is not great (messing with windows is often a bad idea...)
+ int dpr = 1; // h->self->window()->devicePixelRatio();
QOpenGLFramebufferObject *fbo = new QOpenGLFramebufferObject(size.width() / dpr, size.height() / dpr, format);
return fbo;
}
private:
- bool checkNeedToDoFrame()
- {
- // if (requestRedraw) {
- // return true;
- // }
- // if (getDatabasePager()->requiresUpdateSceneGraph() || getDatabasePager()->getRequestsInProgress()) {
- // return true;
- // }
- return true;
- }
-
OSGViewport::Hidden *h;
- bool requestRedraw;
+ bool firstFrame;
+ bool needToDoFrame;
};
osg::ref_ptr OSGViewport::Hidden::dummy;
@@ -583,7 +572,6 @@ QtKeyboardMap OSGViewport::Hidden::keyMap = QtKeyboardMap();
/* class OSGViewport */
-
OSGViewport::OSGViewport(QQuickItem *parent) : QQuickFramebufferObject(parent), h(new Hidden(this))
{
qDebug() << "OSGViewport::OSGViewport";
@@ -597,12 +585,12 @@ OSGViewport::~OSGViewport()
qDebug() << "OSGViewport::~OSGViewport";
}
-OSGViewport::UpdateMode OSGViewport::updateMode() const
+UpdateMode::Enum OSGViewport::updateMode() const
{
return h->updateMode;
}
-void OSGViewport::setUpdateMode(OSGViewport::UpdateMode mode)
+void OSGViewport::setUpdateMode(UpdateMode::Enum mode)
{
if (h->acceptUpdateMode(mode)) {
emit updateModeChanged(updateMode());
@@ -719,10 +707,10 @@ QSGNode *OSGViewport::updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNode
QPointF OSGViewport::mousePoint(QMouseEvent *event)
{
- // qreal x = 0.01 * (event->x() - self->width() / 2);
- // qreal y = 0.01 * (event->y() - self->height() / 2);
- qreal x = 2.0 * (event->x() - width() / 2) / width();
- qreal y = 2.0 * (event->y() - height() / 2) / height();
+ // qreal x = 2.0 * (event->x() - width() / 2) / width();
+ // qreal y = 2.0 * (event->y() - height() / 2) / height();
+ qreal x = event->x();
+ qreal y = event->y();
return QPointF(x, y);
}
diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGViewport.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGViewport.hpp
index 14fc85953..56901d867 100644
--- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGViewport.hpp
+++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGViewport.hpp
@@ -41,30 +41,27 @@ class Renderer;
class OSGNode;
class OSGCamera;
+class UpdateMode : public QObject {
+ Q_OBJECT
+public:
+ enum Enum { Continuous, Discrete, OnDemand };
+ Q_ENUMS(Enum) // TODO switch to Q_ENUM once on Qt 5.5
+};
+
class OSGQTQUICK_EXPORT OSGViewport : public QQuickFramebufferObject {
Q_OBJECT Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
- Q_PROPERTY(UpdateMode updateMode READ updateMode WRITE setUpdateMode NOTIFY updateModeChanged)
+ Q_PROPERTY(osgQtQuick::UpdateMode::Enum updateMode READ updateMode WRITE setUpdateMode NOTIFY updateModeChanged)
Q_PROPERTY(osgQtQuick::OSGNode * sceneData READ sceneData WRITE setSceneData NOTIFY sceneDataChanged)
Q_PROPERTY(osgQtQuick::OSGCamera * camera READ camera WRITE setCamera NOTIFY cameraChanged)
- Q_ENUMS(UpdateMode)
-
public:
-
friend class ViewportRenderer;
- // TODO rename to UpdateMode or something better
- enum UpdateMode {
- Continuous,
- Discrete,
- OnDemand
- };
-
explicit OSGViewport(QQuickItem *parent = 0);
virtual ~OSGViewport();
- UpdateMode updateMode() const;
- void setUpdateMode(UpdateMode mode);
+ UpdateMode::Enum updateMode() const;
+ void setUpdateMode(UpdateMode::Enum mode);
QColor color() const;
void setColor(const QColor &color);
@@ -82,7 +79,7 @@ public:
virtual bool detach(osgViewer::View *view);
signals:
- void updateModeChanged(UpdateMode mode);
+ void updateModeChanged(UpdateMode::Enum mode);
void colorChanged(const QColor &color);
void sceneDataChanged(OSGNode *node);
void cameraChanged(OSGCamera *camera);
diff --git a/ground/gcs/src/libs/osgearth/osgearth.cpp b/ground/gcs/src/libs/osgearth/osgearth.cpp
index bb6b83fb4..7a8be7838 100644
--- a/ground/gcs/src/libs/osgearth/osgearth.cpp
+++ b/ground/gcs/src/libs/osgearth/osgearth.cpp
@@ -38,11 +38,13 @@
#include
#include
+#ifdef USE_OSGEARTH
#include
#include
#include
#include
#include
+#endif
#include
@@ -69,10 +71,14 @@ void OsgEarth::registerQmlTypes()
}
registered = true;
+ // redirect osg logging to Qt (use OSG_DEBUG environment variable to enable osg logging)
+ // osg::setNotifyHandler(new QtNotifyHandler());
+
// initialize();
// Register Qml types
- osgQtQuick::registerTypes("osgQtQuick");
+ qDebug() << "OsgEarth::registerQmlTypes - registering Qml types...";
+ osgQtQuick::registerTypes();
}
void OsgEarth::initialize()
@@ -103,7 +109,7 @@ void OsgEarth::initialize()
// force early initialization of osgEarth capabilities
// Doing this too early (before main window is displayed) causes rendering glitches (black holes)
// Not sure why... See OSGViewport for when it is called (late...)
- osgEarth::Registry::capabilities();
+ // osgEarth::Registry::capabilities();
displayInfo();
}
@@ -123,6 +129,7 @@ void OsgEarth::initializePathes()
void OsgEarth::initializeCache()
{
+#ifdef USE_OSGEARTH
QString cachePath = Utils::GetStoragePath() + "osgearth/cache";
osgEarth::Drivers::FileSystemCacheOptions cacheOptions;
@@ -144,25 +151,15 @@ void OsgEarth::initializeCache()
} else {
qWarning() << "OsgEarth::initializeCache - Failed to initialize cache";
}
-
-// osgDB::SharedStateManager::ShareMode shareMode = osgDB::SharedStateManager::SHARE_NONE;// =osgDB::SharedStateManager::SHARE_ALL;
-// shareMode = true ? static_cast(shareMode | osgDB::SharedStateManager::SHARE_STATESETS) : shareMode;
-// shareMode = true ? static_cast(shareMode | osgDB::SharedStateManager::SHARE_TEXTURES) : shareMode;
-// osgDB::Registry::instance()->getOrCreateSharedStateManager()->setShareMode(shareMode);
-
-// osgDB::Options::CacheHintOptions cacheHintOptions = osgDB::Options::CACHE_NONE;
-// cacheHintOptions = static_cast(cacheHintOptions | osgDB::Options::CACHE_IMAGES);
-// cacheHintOptions = static_cast(cacheHintOptions | osgDB::Options::CACHE_NODES);
-// if (osgDB::Registry::instance()->getOptions() == 0) {
-// osgDB::Registry::instance()->setOptions(new osgDB::Options());
-// }
-// osgDB::Registry::instance()->getOptions()->setObjectCacheHint(cacheHintOptions);
+#endif // ifdef USE_OSGEARTH
}
void OsgEarth::displayInfo()
{
qDebug() << "Using osg version :" << osgGetVersion();
+#ifdef USE_OSGEARTH
qDebug() << "Using osgEarth version :" << osgEarthGetVersion();
+#endif
// library file path list
osgDB::FilePathList &libraryFilePathList = osgDB::Registry::instance()->getLibraryFilePathList();
@@ -190,7 +187,9 @@ void OsgEarth::displayInfo()
qDebug() << "Platform supports threaded OpenGL:" << threadedOpenGL;
#endif
+#ifdef USE_OSGEARTH
osgQtQuick::capabilitiesInfo(osgEarth::Registry::capabilities());
+#endif
}
void QtNotifyHandler::notify(osg::NotifySeverity severity, const char *message)
diff --git a/ground/gcs/src/libs/osgearth/osgearth.pri b/ground/gcs/src/libs/osgearth/osgearth.pri
index 5a995f4f6..3224d5e8a 100644
--- a/ground/gcs/src/libs/osgearth/osgearth.pri
+++ b/ground/gcs/src/libs/osgearth/osgearth.pri
@@ -1,5 +1,8 @@
-exists( $(OSG_SDK_DIR) ) {
- CONFIG += osg
+osg {
DEFINES += USE_OSG
LIBS *= -l$$qtLibraryName(GCSOsgEarth)
}
+
+osgearth {
+ DEFINES += USE_OSGEARTH
+}
diff --git a/ground/gcs/src/libs/osgearth/osgearth.pro b/ground/gcs/src/libs/osgearth/osgearth.pro
index a7185ada0..951c42109 100644
--- a/ground/gcs/src/libs/osgearth/osgearth.pro
+++ b/ground/gcs/src/libs/osgearth/osgearth.pro
@@ -2,6 +2,14 @@ TEMPLATE = lib
TARGET = GCSOsgEarth
DEFINES += OSGEARTH_LIBRARY
+#CONFIG += mys2
+
+osg:DEFINES += USE_OSG
+osgQt:DEFINES += USE_OSG_QT
+
+osgearth:DEFINES += USE_OSGEARTH
+osgearthQt:DEFINES += USE_OSGEARTH_QT
+
#DEFINES += OSG_USE_QT_PRIVATE
QT += widgets opengl qml quick
@@ -12,6 +20,8 @@ contains(DEFINES, OSG_USE_QT_PRIVATE) {
include(../../library.pri)
include(../utils/utils.pri)
+include(osgearth_dependencies.pri)
+
linux {
QMAKE_RPATHDIR = $$shell_quote(\$$ORIGIN/$$relative_path($$GCS_LIBRARY_PATH/osg, $$GCS_LIBRARY_PATH))
include(../../rpath.pri)
@@ -23,9 +33,6 @@ macx:CONFIG += warn_off
# osg and osgearth emit a lot of unused parameter warnings...
QMAKE_CXXFLAGS += -Wno-unused-parameter
-OSG_SDK_DIR = $$clean_path($$(OSG_SDK_DIR))
-message(Using osg from here: $$OSG_SDK_DIR)
-
HEADERS += \
osgearth_global.h \
utility.h \
@@ -45,9 +52,7 @@ HEADERS += \
osgQtQuick/OSGCubeNode.hpp \
osgQtQuick/OSGTextNode.hpp \
osgQtQuick/OSGFileNode.hpp \
- osgQtQuick/OSGModelNode.hpp \
osgQtQuick/OSGBackgroundNode.hpp \
- osgQtQuick/OSGSkyNode.hpp \
osgQtQuick/OSGCamera.hpp \
osgQtQuick/OSGViewport.hpp
@@ -58,51 +63,16 @@ SOURCES += \
osgQtQuick/OSGCubeNode.cpp \
osgQtQuick/OSGTextNode.cpp \
osgQtQuick/OSGFileNode.cpp \
- osgQtQuick/OSGModelNode.cpp \
osgQtQuick/OSGBackgroundNode.cpp \
- osgQtQuick/OSGSkyNode.cpp \
osgQtQuick/OSGCamera.cpp \
osgQtQuick/OSGViewport.cpp
-INCLUDEPATH += $$OSG_SDK_DIR/include
+osgearth:HEADERS += \
+ osgQtQuick/OSGModelNode.hpp \
+ osgQtQuick/OSGSkyNode.hpp
-linux {
- exists( $$OSG_SDK_DIR/lib64 ) {
- LIBS += -L$$OSG_SDK_DIR/lib64
- } else {
- LIBS += -L$$OSG_SDK_DIR/lib
- }
+osgearth:SOURCES += \
+ osgQtQuick/OSGModelNode.cpp \
+ osgQtQuick/OSGSkyNode.cpp
- LIBS +=-lOpenThreads
- LIBS += -losg -losgUtil -losgDB -losgGA -losgViewer -losgText
- LIBS += -losgEarth -losgEarthUtil -losgEarthFeatures -losgEarthSymbology -losgEarthAnnotation
- LIBS += -losgQt -losgEarthQt
-}
-
-macx {
- LIBS += -L$$OSG_SDK_DIR/lib
-
- LIBS += -lOpenThreads
- LIBS += -losg -losgUtil -losgDB -losgGA -losgViewer -losgText
- LIBS += -losgEarth -losgEarthUtil -losgEarthFeatures -losgEarthSymbology -losgEarthAnnotation
- LIBS += -losgQt -losgEarthQt
-}
-
-win32 {
- LIBS += -L$$OSG_SDK_DIR/lib
-
- #CONFIG(release, debug|release) {
- LIBS += -lOpenThreads
- LIBS += -losg -losgUtil -losgDB -losgGA -losgViewer -losgText
- LIBS += -losgEarth -losgEarthUtil -losgEarthFeatures -losgEarthSymbology -losgEarthAnnotation
- LIBS += -losgQt -losgEarthQt
- #}
- #CONFIG(debug, debug|release) {
- # LIBS += -lOpenThreadsd
- # LIBS += -losgd -losgUtild -losgDBd -losgGAd -losgViewerd -losgTextd
- # LIBS += -losgEarthd -losgEarthUtild -losgEarthFeaturesd -losgEarthSymbologyd -losgEarthAnnotationd
- # LIBS += -losgQtd -losgEarthQtd
- #}
-}
-
-include(copydata.pro)
+copy_osg:include(copydata.pro)
diff --git a/ground/gcs/src/libs/osgearth/osgearth_dependencies.pri b/ground/gcs/src/libs/osgearth/osgearth_dependencies.pri
new file mode 100644
index 000000000..c3d55285c
--- /dev/null
+++ b/ground/gcs/src/libs/osgearth/osgearth_dependencies.pri
@@ -0,0 +1,49 @@
+# osg and osgearth emit a lot of unused parameter warnings...
+QMAKE_CXXFLAGS += -Wno-unused-parameter
+
+# set debug suffix if needed
+#win32:CONFIG(debug, debug|release):DS = "d"
+
+contains(QT_ARCH, x86_64) {
+ LIB_DIR_NAME = lib64
+} else {
+ LIB_DIR_NAME = lib
+}
+
+osg {
+ OSG_SDK_DIR = $$clean_path($$(OSG_SDK_DIR))
+ message(Using osg from here: $$OSG_SDK_DIR)
+
+ INCLUDEPATH += $$OSG_SDK_DIR/include
+
+ linux|macx {
+ LIBS += -L$$OSG_SDK_DIR/$$LIB_DIR_NAME
+ LIBS += -lOpenThreads -losg -losgUtil -losgDB -losgGA -losgFX -losgViewer -losgText
+ osgQt:LIBS += -losgQt
+ }
+
+ win32 {
+ LIBS += -L$$OSG_SDK_DIR/lib
+ LIBS += -lOpenThreads$${DS} -losg$${DS} -losgUtil$${DS} -losgDB$${DS} -losgGA$${DS} -losgFX$${DS} -losgViewer$${DS} -losgText$${DS}
+ osgQt:LIBS += -losgQt$${DS}
+ }
+}
+
+osgearth {
+ OSGEARTH_SDK_DIR = $$clean_path($$(OSGEARTH_SDK_DIR))
+ message(Using osgearth from here: $$OSGEARTH_SDK_DIR)
+
+ INCLUDEPATH += $$OSGEARTH_SDK_DIR/include
+
+ linux|macx {
+ LIBS += -L$$OSGEARTH_SDK_DIR/$$LIB_DIR_NAME
+ LIBS += -losgEarth -losgEarthUtil -losgEarthFeatures -losgEarthSymbology -losgEarthAnnotation
+ osgearthQt:LIBS += -losgEarthQt
+ }
+
+ win32 {
+ LIBS += -L$$OSGEARTH_SDK_DIR/lib
+ LIBS += -losgEarth$${DS} -losgEarthUtil$${DS} -losgEarthFeatures$${DS} -losgEarthSymbology$${DS} -losgEarthAnnotation$${DS}
+ osgearthQt:LIBS += -losgEarthQt$${DS}
+ }
+}
diff --git a/ground/gcs/src/libs/osgearth/qtwindowingsystem.cpp b/ground/gcs/src/libs/osgearth/qtwindowingsystem.cpp
index 6eac26a29..f25faa822 100644
--- a/ground/gcs/src/libs/osgearth/qtwindowingsystem.cpp
+++ b/ground/gcs/src/libs/osgearth/qtwindowingsystem.cpp
@@ -30,6 +30,7 @@
#include "utility.h"
#include
+#include
#include
#include
@@ -104,20 +105,7 @@ GraphicsWindowQt::GraphicsWindowQt(osg::GraphicsContext::Traits *traits) :
{
qDebug() << "GraphicsWindowQt::GraphicsWindowQt";
_traits = traits;
-
init();
-
- if (valid()) {
- setState(new osg::State);
- getState()->setGraphicsContext(this);
-
- if (_traits.valid() && _traits->sharedContext.valid()) {
- getState()->setContextID(_traits->sharedContext->getState()->getContextID());
- incrementContextIDUsageCount(getState()->getContextID());
- } else {
- getState()->setContextID(osg::GraphicsContext::createNewContextID());
- }
- }
}
GraphicsWindowQt::~GraphicsWindowQt()
@@ -140,6 +128,24 @@ void GraphicsWindowQt::init()
// if ( !parent )
// parent = windowData ? windowData->_parent : NULL;
+
+ setState(new osg::State);
+ getState()->setGraphicsContext(this);
+
+ if (_traits.valid() && _traits->sharedContext.valid()) {
+ getState()->setContextID(_traits->sharedContext->getState()->getContextID());
+ incrementContextIDUsageCount(getState()->getContextID());
+ } else {
+ getState()->setContextID(osg::GraphicsContext::createNewContextID());
+ }
+
+ // make sure the event queue has the correct window rectangle size and input range
+#if OSG_VERSION_GREATER_OR_EQUAL(3, 4, 0)
+ getEventQueue()->syncWindowRectangleWithGraphicsContext();
+#else
+ getEventQueue()->syncWindowRectangleWithGraphcisContext();
+#endif
+
_initialized = true;
_valid = _initialized;
@@ -244,8 +250,12 @@ bool GraphicsWindowQt::realizeImplementation()
_realized = true;
-//// make sure the event queue has the correct window rectangle size and input range
-// getEventQueue()->syncWindowRectangleWithGraphcisContext();
+ // make sure the event queue has the correct window rectangle size and input range
+#if OSG_VERSION_GREATER_OR_EQUAL(3, 4, 0)
+ getEventQueue()->syncWindowRectangleWithGraphicsContext();
+#else
+ getEventQueue()->syncWindowRectangleWithGraphcisContext();
+#endif
// make this window's context not current
// note: this must be done as we will probably make the context current from another thread
diff --git a/ground/gcs/src/libs/osgearth/utility.cpp b/ground/gcs/src/libs/osgearth/utility.cpp
index becac109b..aa2e4e73a 100644
--- a/ground/gcs/src/libs/osgearth/utility.cpp
+++ b/ground/gcs/src/libs/osgearth/utility.cpp
@@ -42,6 +42,7 @@
#include
#include
+#include
#include
#include
#include
@@ -53,13 +54,17 @@
#include
#include
#include
-#include
+#ifdef USE_OSG_QT
+#include
+#endif // USE_OSG_QT
+
+#ifdef USE_OSGEARTH
#include
-#include
#include
#include
#include
+#endif // USE_OSGEARTH
#include
#include
@@ -76,7 +81,7 @@ public:
public:
virtual void operator()(osg::Node *node, osg::NodeVisitor *nv)
{
- osgUtil::CullVisitor *cv = osgEarth::Culling::asCullVisitor(nv);
+ osgUtil::CullVisitor *cv = 0; // osgEarth::Culling::asCullVisitor(nv);
if (cv) {
OSG_DEBUG << "****** Node:" << node << " " << node->getName() << std::endl;
@@ -150,12 +155,19 @@ osgText::Font *createFont(const std::string &name)
return 0;
}
- return new osgText::Font(new osgQt::QFontImplementation(font));
+ return createFont(font);
}
osgText::Font *createFont(const QFont &font)
{
+#ifdef USE_OSG_QT
return new osgText::Font(new osgQt::QFontImplementation(font));
+
+#else
+ qWarning() << "Cannot create osgText::Font from QFont (osgQt is not available)";
+ return osgText::Font::getDefaultFont();
+
+#endif // USE_OSG_QT
}
osgText::Text *createText(const osg::Vec3 &pos, const std::string &content, float size, osgText::Font *font)
@@ -250,40 +262,6 @@ int QtKeyboardMap::remapKey(QKeyEvent *event)
return itr->second;
}
-osgEarth::GeoPoint toGeoPoint(const QVector3D &position)
-{
- osgEarth::GeoPoint geoPoint(osgEarth::SpatialReference::get("wgs84"),
- position.x(), position.y(), position.z(), osgEarth::ALTMODE_ABSOLUTE);
-
- return geoPoint;
-}
-
-bool clampGeoPoint(osgEarth::GeoPoint &geoPoint, float offset, osgEarth::MapNode *mapNode)
-{
- if (!mapNode) {
- qWarning() << "Utility::clampGeoPoint - null map node";
- return false;
- }
-
- // establish an elevation query interface based on the features' SRS.
- osgEarth::ElevationQuery eq(mapNode->getMap());
- // qDebug() << "Utility::clampGeoPoint - SRS :" << QString::fromStdString(mapNode->getMap()->getSRS()->getName());
-
- bool clamped = false;
- double elevation;
- if (eq.getElevation(geoPoint, elevation, 0.0)) {
- clamped = ((geoPoint.z() - offset) < elevation);
- if (clamped) {
- qDebug() << "Utility::clampGeoPoint - clamping" << geoPoint.z() - offset << "/" << elevation;
- geoPoint.z() = elevation + offset;
- }
- } else {
- qDebug() << "Utility::clampGeoPoint - failed to get elevation";
- }
-
- return clamped;
-}
-
QSurfaceFormat traitsToFormat(const osg::GraphicsContext::Traits *traits)
{
QSurfaceFormat format(QSurfaceFormat::defaultFormat());
@@ -298,9 +276,9 @@ QSurfaceFormat traitsToFormat(const osg::GraphicsContext::Traits *traits)
// format.setSampleBuffers(traits->sampleBuffers);
format.setSamples(traits->samples);
-// format.setAlpha(traits->alpha > 0);
-// format.setDepth(traits->depth > 0);
-// format.setStencil(traits->stencil > 0);
+ // format.setAlpha(traits->alpha > 0);
+ // format.setDepth(traits->depth > 0);
+ // format.setStencil(traits->stencil > 0);
format.setStereo(traits->quadBufferStereo ? 1 : 0);
@@ -395,44 +373,6 @@ void traitsInfo(const osg::GraphicsContext::Traits &traits)
// qDebug().nospace() << "swapInterval : " << traits.swapInterval();
}
-void capabilitiesInfo(const osgEarth::Capabilities &caps)
-{
- qDebug().nospace() << "capabilities ----------------------------------------";
-
- qDebug().nospace() << "Vendor : " << QString::fromStdString(caps.getVendor());
- qDebug().nospace() << "Version : " << QString::fromStdString(caps.getVersion());
- qDebug().nospace() << "Renderer : " << QString::fromStdString(caps.getRenderer());
-
- qDebug().nospace() << "GLSL supported : " << caps.supportsGLSL();
- qDebug().nospace() << "GLSL version : " << caps.getGLSLVersionInt();
-
- qDebug().nospace() << "GLES : " << caps.isGLES();
-
- qDebug().nospace() << "Num Processors : " << caps.getNumProcessors();
-
- qDebug().nospace() << "MaxFFPTextureUnits : " << caps.getMaxFFPTextureUnits();
- qDebug().nospace() << "MaxGPUTextureUnits : " << caps.getMaxGPUTextureUnits();
- qDebug().nospace() << "MaxGPUAttribs : " << caps.getMaxGPUAttribs();
- qDebug().nospace() << "MaxTextureSize : " << caps.getMaxTextureSize();
- qDebug().nospace() << "MaxLights : " << caps.getMaxLights();
- qDebug().nospace() << "DepthBufferBits : " << caps.getDepthBufferBits();
- qDebug().nospace() << "TextureArrays : " << caps.supportsTextureArrays();
- qDebug().nospace() << "Texture3D : " << caps.supportsTexture3D();
- qDebug().nospace() << "MultiTexture : " << caps.supportsMultiTexture();
- qDebug().nospace() << "StencilWrap : " << caps.supportsStencilWrap();
- qDebug().nospace() << "TwoSidedStencil : " << caps.supportsTwoSidedStencil();
- qDebug().nospace() << "Texture2DLod : " << caps.supportsTexture2DLod();
- qDebug().nospace() << "MipmappedTextureUpdates : " << caps.supportsMipmappedTextureUpdates();
- qDebug().nospace() << "DepthPackedStencilBuffer : " << caps.supportsDepthPackedStencilBuffer();
- qDebug().nospace() << "OcclusionQuery : " << caps.supportsOcclusionQuery();
- qDebug().nospace() << "DrawInstanced : " << caps.supportsDrawInstanced();
- qDebug().nospace() << "UniformBufferObjects : " << caps.supportsUniformBufferObjects();
- qDebug().nospace() << "NonPowerOfTwoTextures : " << caps.supportsNonPowerOfTwoTextures();
- qDebug().nospace() << "MaxUniformBlockSize : " << caps.getMaxUniformBlockSize();
- qDebug().nospace() << "PreferDisplayListsForStaticGeometry : " << caps.preferDisplayListsForStaticGeometry();
- qDebug().nospace() << "FragDepthWrite : " << caps.supportsFragDepthWrite();
-}
-
QString formatProfileName(QSurfaceFormat::OpenGLContextProfile profile)
{
switch (profile) {
@@ -499,23 +439,110 @@ QString getUsageString(osgViewer::CompositeViewer *viewer)
return getUsageString(applicationUsage);
}
-void registerTypes(const char *uri)
+#ifdef USE_OSGEARTH
+osgEarth::GeoPoint toGeoPoint(const QVector3D &position)
+{
+ osgEarth::GeoPoint geoPoint(osgEarth::SpatialReference::get("wgs84"),
+ position.x(), position.y(), position.z(), osgEarth::ALTMODE_ABSOLUTE);
+
+ return geoPoint;
+}
+
+bool clampGeoPoint(osgEarth::GeoPoint &geoPoint, float offset, osgEarth::MapNode *mapNode)
+{
+ if (!mapNode) {
+ qWarning() << "Utility::clampGeoPoint - null map node";
+ return false;
+ }
+
+ // establish an elevation query interface based on the features' SRS.
+ osgEarth::ElevationQuery eq(mapNode->getMap());
+ // qDebug() << "Utility::clampGeoPoint - SRS :" << QString::fromStdString(mapNode->getMap()->getSRS()->getName());
+
+ bool clamped = false;
+ double elevation;
+ if (eq.getElevation(geoPoint, elevation, 0.0)) {
+ clamped = ((geoPoint.z() - offset) < elevation);
+ if (clamped) {
+ qDebug() << "Utility::clampGeoPoint - clamping" << geoPoint.z() - offset << "/" << elevation;
+ geoPoint.z() = elevation + offset;
+ }
+ } else {
+ qDebug() << "Utility::clampGeoPoint - failed to get elevation";
+ }
+
+ return clamped;
+}
+
+void capabilitiesInfo(const osgEarth::Capabilities &caps)
+{
+ qDebug().nospace() << "capabilities ----------------------------------------";
+
+ qDebug().nospace() << "Vendor : " << QString::fromStdString(caps.getVendor());
+ qDebug().nospace() << "Version : " << QString::fromStdString(caps.getVersion());
+ qDebug().nospace() << "Renderer : " << QString::fromStdString(caps.getRenderer());
+
+ qDebug().nospace() << "GLSL supported : " << caps.supportsGLSL();
+ qDebug().nospace() << "GLSL version : " << caps.getGLSLVersionInt();
+
+ qDebug().nospace() << "GLES : " << caps.isGLES();
+
+ qDebug().nospace() << "Num Processors : " << caps.getNumProcessors();
+
+ qDebug().nospace() << "MaxFFPTextureUnits : " << caps.getMaxFFPTextureUnits();
+ qDebug().nospace() << "MaxGPUTextureUnits : " << caps.getMaxGPUTextureUnits();
+ qDebug().nospace() << "MaxGPUAttribs : " << caps.getMaxGPUAttribs();
+ qDebug().nospace() << "MaxTextureSize : " << caps.getMaxTextureSize();
+ qDebug().nospace() << "MaxLights : " << caps.getMaxLights();
+ qDebug().nospace() << "DepthBufferBits : " << caps.getDepthBufferBits();
+ qDebug().nospace() << "TextureArrays : " << caps.supportsTextureArrays();
+ qDebug().nospace() << "Texture3D : " << caps.supportsTexture3D();
+ qDebug().nospace() << "MultiTexture : " << caps.supportsMultiTexture();
+ qDebug().nospace() << "StencilWrap : " << caps.supportsStencilWrap();
+ qDebug().nospace() << "TwoSidedStencil : " << caps.supportsTwoSidedStencil();
+ qDebug().nospace() << "Texture2DLod : " << caps.supportsTexture2DLod();
+ qDebug().nospace() << "MipmappedTextureUpdates : " << caps.supportsMipmappedTextureUpdates();
+ qDebug().nospace() << "DepthPackedStencilBuffer : " << caps.supportsDepthPackedStencilBuffer();
+ qDebug().nospace() << "OcclusionQuery : " << caps.supportsOcclusionQuery();
+ qDebug().nospace() << "DrawInstanced : " << caps.supportsDrawInstanced();
+ qDebug().nospace() << "UniformBufferObjects : " << caps.supportsUniformBufferObjects();
+ qDebug().nospace() << "NonPowerOfTwoTextures : " << caps.supportsNonPowerOfTwoTextures();
+ qDebug().nospace() << "MaxUniformBlockSize : " << caps.getMaxUniformBlockSize();
+ qDebug().nospace() << "PreferDisplayListsForStaticGeometry : " << caps.preferDisplayListsForStaticGeometry();
+ qDebug().nospace() << "FragDepthWrite : " << caps.supportsFragDepthWrite();
+}
+#endif // USE_OSGEARTH
+
+void registerTypes()
{
- // Q_ASSERT(uri == QLatin1String("osgQtQuick"));
int maj = 1, min = 0;
// @uri osgQtQuick
- qmlRegisterType(uri, maj, min, "OSGNode");
- qmlRegisterType(uri, maj, min, "OSGGroup");
- qmlRegisterType(uri, maj, min, "OSGFileNode");
- qmlRegisterType(uri, maj, min, "OSGTransformNode");
- qmlRegisterType(uri, maj, min, "OSGTextNode");
- qmlRegisterType(uri, maj, min, "OSGCubeNode");
- qmlRegisterType(uri, maj, min, "OSGViewport");
+ qmlRegisterType("OsgQtQuick", maj, min, "OSGNode");
- qmlRegisterType(uri, maj, min, "OSGModelNode");
- qmlRegisterType(uri, maj, min, "OSGSkyNode");
- qmlRegisterType(uri, maj, min, "OSGBackgroundNode");
- qmlRegisterType(uri, maj, min, "OSGCamera");
+ qmlRegisterType("OsgQtQuick", maj, min, "OSGGroup");
+
+ qmlRegisterType("OsgQtQuick", maj, min, "OSGFileNode");
+ qmlRegisterType("OsgQtQuick", maj, min, "OptimizeMode");
+
+ qmlRegisterType("OsgQtQuick", maj, min, "OSGTransformNode");
+
+ qmlRegisterType("OsgQtQuick", maj, min, "OSGTextNode");
+
+ qmlRegisterType("OsgQtQuick", maj, min, "OSGCubeNode");
+
+ qmlRegisterType("OsgQtQuick", maj, min, "OSGBackgroundNode");
+
+ qmlRegisterType("OsgQtQuick", maj, min, "OSGViewport");
+ qmlRegisterType("OsgQtQuick", maj, min, "UpdateMode");
+
+ qmlRegisterType("OsgQtQuick", maj, min, "OSGCamera");
+ qmlRegisterType("OsgQtQuick", maj, min, "ManipulatorMode");
+ qmlRegisterType("OsgQtQuick", maj, min, "TrackerMode");
+
+#ifdef USE_OSGEARTH
+ qmlRegisterType("OsgQtQuick", maj, min, "OSGModelNode");
+ qmlRegisterType("OsgQtQuick", maj, min, "OSGSkyNode");
+#endif // USE_OSGEARTH
}
} // namespace osgQtQuick
diff --git a/ground/gcs/src/libs/osgearth/utility.h b/ground/gcs/src/libs/osgearth/utility.h
index 8a84f70b4..02175a868 100644
--- a/ground/gcs/src/libs/osgearth/utility.h
+++ b/ground/gcs/src/libs/osgearth/utility.h
@@ -33,8 +33,6 @@
#include
#include
-#include
-
#include
#include
#include
@@ -59,10 +57,13 @@ class Text;
class Font;
} // namespace osgText
+#ifdef USE_OSGEARTH
namespace osgEarth {
class Capabilities;
+class GeoPoint;
class MapNode;
} // namespace osgEarth
+#endif
QT_BEGIN_NAMESPACE
class QFont;
@@ -129,15 +130,11 @@ osgText::Text *createText(const osg::Vec3 &pos,
float size,
osgText::Font *font = 0);
-osgEarth::GeoPoint toGeoPoint(const QVector3D &position);
-bool clampGeoPoint(osgEarth::GeoPoint &geoPoint, float offset, osgEarth::MapNode *mapNode);
-
QSurfaceFormat traitsToFormat(const osg::GraphicsContext::Traits *traits);
void formatToTraits(const QSurfaceFormat & format, osg::GraphicsContext::Traits *traits);
void formatInfo(const QSurfaceFormat & format);
void traitsInfo(const osg::GraphicsContext::Traits & traits);
-void capabilitiesInfo(const osgEarth::Capabilities & caps);
void openGLContextInfo(QOpenGLContext *context, const char *at);
QString formatProfileName(QSurfaceFormat::OpenGLContextProfile profile);
@@ -146,7 +143,13 @@ QString formatSwapBehaviorName(QSurfaceFormat::SwapBehavior swapBehavior);
QString getUsageString(osgViewer::Viewer *viewer);
QString getUsageString(osgViewer::CompositeViewer *viewer);
-void registerTypes(const char *uri);
+#ifdef USE_OSGEARTH
+osgEarth::GeoPoint toGeoPoint(const QVector3D &position);
+bool clampGeoPoint(osgEarth::GeoPoint &geoPoint, float offset, osgEarth::MapNode *mapNode);
+void capabilitiesInfo(const osgEarth::Capabilities & caps);
+#endif
+
+void registerTypes();
} // namespace osgQtQuick
#endif // OSGEARTH_UTILITY_H
diff --git a/ground/gcs/src/libs/sdlgamepad/copydata.pro b/ground/gcs/src/libs/sdlgamepad/copydata.pro
index af9cecbff..ce6d8ff01 100644
--- a/ground/gcs/src/libs/sdlgamepad/copydata.pro
+++ b/ground/gcs/src/libs/sdlgamepad/copydata.pro
@@ -4,7 +4,7 @@ equals(copydata, 1) {
SDL_DLLS = \
SDL.dll
for(dll, SDL_DLLS) {
- addCopyFileTarget($${dll},$${SDL_DIR}/bin,$${GCS_APP_PATH})
+ addCopyFileTarget($${dll},$$[QT_INSTALL_BINS],$${GCS_APP_PATH})
}
}
}
diff --git a/ground/gcs/src/plugins/config/stabilization.ui b/ground/gcs/src/plugins/config/stabilization.ui
index 2dad4132f..0c25b1449 100644
--- a/ground/gcs/src/plugins/config/stabilization.ui
+++ b/ground/gcs/src/plugins/config/stabilization.ui
@@ -6,7 +6,7 @@
0
0
- 974
+ 901
755
@@ -135,9 +135,9 @@
0
- 0
- 950
- 775
+ -104
+ 866
+ 767
@@ -6247,7 +6247,7 @@ Then lower the value by 5 or so.
-
+
0
@@ -7357,556 +7357,6 @@ border-radius: 5;
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 20
-
-
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
-
-
- 74
- 74
- 74
-
-
-
-
- 36
- 36
- 36
-
-
-
-
-
-
-
-
- 58
- 58
- 58
-
-
-
-
-
-
- 48
- 48
- 48
-
-
-
-
-
-
- 19
- 19
- 19
-
-
-
-
-
-
- 26
- 26
- 26
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
-
-
- 74
- 74
- 74
-
-
-
-
- 36
- 36
- 36
-
-
-
-
-
-
-
-
-
-
- 74
- 74
- 74
-
-
-
-
- 36
- 36
- 36
-
-
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
- 19
- 19
- 19
-
-
-
-
-
-
- 255
- 255
- 220
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
-
-
- 74
- 74
- 74
-
-
-
-
- 36
- 36
- 36
-
-
-
-
-
-
-
-
- 58
- 58
- 58
-
-
-
-
-
-
- 48
- 48
- 48
-
-
-
-
-
-
- 19
- 19
- 19
-
-
-
-
-
-
- 26
- 26
- 26
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
-
-
- 74
- 74
- 74
-
-
-
-
- 36
- 36
- 36
-
-
-
-
-
-
-
-
-
-
- 74
- 74
- 74
-
-
-
-
- 36
- 36
- 36
-
-
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
- 19
- 19
- 19
-
-
-
-
-
-
- 255
- 255
- 220
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
-
-
- 74
- 74
- 74
-
-
-
-
- 36
- 36
- 36
-
-
-
-
-
-
-
-
- 58
- 58
- 58
-
-
-
-
-
-
- 48
- 48
- 48
-
-
-
-
-
-
- 19
- 19
- 19
-
-
-
-
-
-
- 26
- 26
- 26
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
- 255
- 255
- 255
-
-
-
-
-
-
-
-
- 74
- 74
- 74
-
-
-
-
- 36
- 36
- 36
-
-
-
-
-
-
-
-
-
-
- 74
- 74
- 74
-
-
-
-
- 36
- 36
- 36
-
-
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
- 39
- 39
- 39
-
-
-
-
-
-
- 255
- 255
- 220
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
-
-
- 75
- true
-
-
-
- false
-
-
- background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
-color: rgb(255, 255, 255);
-border-radius: 5;
-
-
- Yaw
-
-
- Qt::AlignCenter
-
-
-
-
@@ -8084,83 +7534,39 @@ border-radius: 5;
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 25
-
-
-
- <html><head/><body><p>This adjusts how much leveling stability is set into Attitude mode (outer loop). Too much will make your vehicle oscillate in Attitude Mode.</p></body></html>
-
-
- 100
-
-
- 50
-
+
-
+
Qt::Horizontal
-
- QSlider::TicksBelow
+
+ QSizePolicy::Minimum
-
- 20
+
+
+ 60
+ 20
+
-
-
- objname:StabilizationSettingsBankX
- fieldname:YawPI
- element:Kp
- scale:0.1
- haslimits:yes
- buttongroup:2,10
-
+
+
+ -
+
+
+ Qt::Horizontal
-
+
+ QSizePolicy::Minimum
+
+
+
+ 10
+ 20
+
+
+
-
-
-
-
- 60
- 22
-
-
-
-
- 60
- 22
-
-
-
- 200
-
-
- 200
-
-
-
- objname:StabilizationSettingsBankX
- fieldname:YawPI
- element:Kp
- scale:0.1
- haslimits:yes
- buttongroup:2,10
-
-
-
-
- -
Qt::Horizontal
@@ -8168,7 +7574,7 @@ border-radius: 5;
40
- 1
+ 20
@@ -8367,8 +7773,8 @@ border-radius: 5;
0
0
- 950
- 736
+ 866
+ 697
@@ -17657,8 +17063,8 @@ border-radius: 5;
0
0
- 950
- 671
+ 879
+ 663
@@ -23503,8 +22909,8 @@ font:bold;
0
0
- 950
- 671
+ 879
+ 663
@@ -26749,8 +26155,6 @@ Useful if you have accidentally changed some settings.
spinBox_13
horizontalSlider_83
spinBox_14
- horizontalSlider_84
- spinBox_15
lowThrottleZeroIntegral_8
realTimeUpdates_8
scrollArea_2
diff --git a/ground/gcs/src/plugins/dial/dialgadgetwidget.cpp b/ground/gcs/src/plugins/dial/dialgadgetwidget.cpp
index 14bfba5cb..ac7f9e46b 100644
--- a/ground/gcs/src/plugins/dial/dialgadgetwidget.cpp
+++ b/ground/gcs/src/plugins/dial/dialgadgetwidget.cpp
@@ -30,7 +30,7 @@
#include
#include
#include
-#include
+#include
#include
DialGadgetWidget::DialGadgetWidget(QWidget *parent) : QGraphicsView(parent)
@@ -75,7 +75,7 @@ DialGadgetWidget::~DialGadgetWidget()
void DialGadgetWidget::enableOpenGL(bool flag)
{
if (flag) {
- setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
+ setViewport(new QOpenGLWidget()); // QGLFormat(QGL::SampleBuffers)));
} else {
setViewport(new QWidget);
}
diff --git a/ground/gcs/src/plugins/gcscontrol/joystickcontrol.cpp b/ground/gcs/src/plugins/gcscontrol/joystickcontrol.cpp
index 2d8dfdd6c..6d0a44ce7 100644
--- a/ground/gcs/src/plugins/gcscontrol/joystickcontrol.cpp
+++ b/ground/gcs/src/plugins/gcscontrol/joystickcontrol.cpp
@@ -29,7 +29,7 @@
#include "extensionsystem/pluginmanager.h"
#include
#include
-#include
+#include
#include
/**
@@ -85,7 +85,7 @@ JoystickControl::~JoystickControl()
void JoystickControl::enableOpenGL(bool flag)
{
if (flag) {
- setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
+ setViewport(new QOpenGLWidget()); // QGLFormat(QGL::SampleBuffers)));
} else {
setViewport(new QWidget);
}
diff --git a/ground/gcs/src/plugins/lineardial/lineardialgadgetwidget.cpp b/ground/gcs/src/plugins/lineardial/lineardialgadgetwidget.cpp
index 8bc583ff6..9bfb4a84f 100644
--- a/ground/gcs/src/plugins/lineardial/lineardialgadgetwidget.cpp
+++ b/ground/gcs/src/plugins/lineardial/lineardialgadgetwidget.cpp
@@ -28,7 +28,7 @@
#include "lineardialgadgetwidget.h"
#include
#include
-#include
+#include
#include
LineardialGadgetWidget::LineardialGadgetWidget(QWidget *parent) : QGraphicsView(parent)
@@ -66,7 +66,7 @@ LineardialGadgetWidget::~LineardialGadgetWidget()
void LineardialGadgetWidget::enableOpenGL(bool flag)
{
if (flag) {
- setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
+ setViewport(new QOpenGLWidget()); // QGLFormat(QGL::SampleBuffers)));
} else {
setViewport(new QWidget);
}
diff --git a/ground/gcs/src/plugins/ophid/inc/ophid_usbmon.h b/ground/gcs/src/plugins/ophid/inc/ophid_usbmon.h
index eda27387f..b55ffeb27 100644
--- a/ground/gcs/src/plugins/ophid/inc/ophid_usbmon.h
+++ b/ground/gcs/src/plugins/ophid/inc/ophid_usbmon.h
@@ -54,26 +54,10 @@
#include
#include
#include
+extern "C"
+{
#include
-
-// from working mingw hidsdi.h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-HIDAPI VOID WINAPI HidD_GetHidGuid(LPGUID);
-HIDAPI BOOL WINAPI HidD_GetPreparsedData(HANDLE, PHIDP_PREPARSED_DATA *);
-HIDAPI BOOL WINAPI HidD_FreePreparsedData(PHIDP_PREPARSED_DATA);
-HIDAPI BOOL WINAPI HidD_FlushQueue(HANDLE);
-HIDAPI BOOL WINAPI HidD_GetConfiguration(HANDLE, PHIDD_CONFIGURATION, ULONG);
-HIDAPI BOOL WINAPI HidD_SetConfiguration(HANDLE, PHIDD_CONFIGURATION, ULONG);
-HIDAPI BOOL WINAPI HidD_GetPhysicalDescriptor(HANDLE, PVOID, ULONG);
-HIDAPI BOOL WINAPI HidD_GetIndexedString(HANDLE, ULONG, PVOID, ULONG);
-HIDAPI BOOL WINAPI HidD_GetSerialNumberString(HANDLE, PVOID, ULONG);
-
-#ifdef __cplusplus
}
-#endif
#endif // if defined(Q_OS_MAC)
diff --git a/ground/gcs/src/plugins/pfdqml/osgearth.cpp b/ground/gcs/src/plugins/pfdqml/osgearth.cpp
deleted file mode 100644
index 593e46fea..000000000
--- a/ground/gcs/src/plugins/pfdqml/osgearth.cpp
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * 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, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "osgearth.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-#include "utils/pathutils.h"
-
-OsgEarthItem::OsgEarthItem(QDeclarativeItem *parent) :
- QDeclarativeItem(parent),
- m_renderer(0),
- m_rendererThread(0),
- m_currentSize(640, 480),
- m_roll(0.0),
- m_pitch(0.0),
- m_yaw(0.0),
- m_latitude(-28.5),
- m_longitude(153.0),
- m_altitude(400.0),
- m_fieldOfView(90.0),
- m_sceneFile(QLatin1String("/usr/share/osgearth/maps/srtm.earth"))
-{
- setSize(m_currentSize);
- setFlag(ItemHasNoContents, false);
-}
-
-OsgEarthItem::~OsgEarthItem()
-{
- if (m_renderer) {
- m_rendererThread->exit();
- // wait up to 10 seconds for renderer thread to exit
- m_rendererThread->wait(10 * 1000);
-
- delete m_renderer;
- delete m_rendererThread;
- }
-}
-
-QString OsgEarthItem::resolvedSceneFile() const
-{
- QString sceneFile = m_sceneFile;
-
- // try to resolve the relative scene file name:
- if (!QFileInfo(sceneFile).exists()) {
- QDeclarativeView *view = qobject_cast(scene()->views().first());
-
- if (view) {
- QUrl baseUrl = view->engine()->baseUrl();
- sceneFile = baseUrl.resolved(sceneFile).toLocalFile();
- }
- }
-
- return sceneFile;
-}
-
-void OsgEarthItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_UNUSED(oldGeometry);
- Q_UNUSED(newGeometry);
-
- // Dynamic gyometry changes are not supported yet,
- // terrain is rendered to fixed geompetry and scalled for now
-
- /*
- qDebug() << Q_FUNC_INFO << newGeometry;
-
- int w = qRound(newGeometry.width());
- int h = qRound(newGeometry.height());
-
- if (m_currentSize != QSize(w,h) && m_gw.get()) {
- m_currentSize = QSize(w,h);
-
- m_gw->getEventQueue()->windowResize(0,0,w,h);
- m_gw->resized(0,0,w,h);
-
- osg::Camera *camera = m_viewer->getCamera();
- camera->setViewport(new osg::Viewport(0,0,w,h));
- camera->setProjectionMatrixAsPerspective(m_fieldOfView, qreal(w)/h, 1.0f, 10000.0f);
- }
- */
-}
-
-void OsgEarthItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *style, QWidget *widget)
-{
- Q_UNUSED(painter);
- Q_UNUSED(style);
- QGLWidget *glWidget = qobject_cast(widget);
-
- if (!m_renderer) {
- m_renderer = new OsgEarthItemRenderer(this, glWidget);
- connect(m_renderer, SIGNAL(frameReady()),
- this, SLOT(updateView()), Qt::QueuedConnection);
-
- m_rendererThread = new QThread(this);
- m_renderer->moveToThread(m_rendererThread);
- m_rendererThread->start();
-
- QMetaObject::invokeMethod(m_renderer, "initScene", Qt::QueuedConnection);
- return;
- }
-
- QGLFramebufferObject *fbo = m_renderer->lastFrame();
-
- if (glWidget && fbo) {
- glWidget->drawTexture(boundingRect(), fbo->texture());
- }
-}
-
-void OsgEarthItem::updateView()
-{
- update();
-}
-
-void OsgEarthItem::updateFrame()
-{
- if (m_renderer) {
- m_renderer->markDirty();
- QMetaObject::invokeMethod(m_renderer, "updateFrame", Qt::QueuedConnection);
- }
-}
-
-void OsgEarthItem::setRoll(qreal arg)
-{
- if (!qFuzzyCompare(m_roll, arg)) {
- m_roll = arg;
- updateFrame();
- emit rollChanged(arg);
- }
-}
-
-void OsgEarthItem::setPitch(qreal arg)
-{
- if (!qFuzzyCompare(m_pitch, arg)) {
- m_pitch = arg;
- updateFrame();
- emit pitchChanged(arg);
- }
-}
-
-void OsgEarthItem::setYaw(qreal arg)
-{
- if (!qFuzzyCompare(m_yaw, arg)) {
- m_yaw = arg;
- updateFrame();
- emit yawChanged(arg);
- }
-}
-
-void OsgEarthItem::setLatitude(double arg)
-{
- // not sure qFuzzyCompare is accurate enough for geo coordinates
- if (m_latitude != arg) {
- m_latitude = arg;
- emit latitudeChanged(arg);
- }
-}
-
-void OsgEarthItem::setLongitude(double arg)
-{
- if (m_longitude != arg) {
- m_longitude = arg;
- emit longitudeChanged(arg);
- }
-}
-
-void OsgEarthItem::setAltitude(double arg)
-{
- if (!qFuzzyCompare(m_altitude, arg)) {
- m_altitude = arg;
- emit altitudeChanged(arg);
- }
-}
-
-// ! Camera vertical field of view in degrees
-void OsgEarthItem::setFieldOfView(qreal arg)
-{
- if (!qFuzzyCompare(m_fieldOfView, arg)) {
- m_fieldOfView = arg;
- emit fieldOfViewChanged(arg);
-
- // it should be a queued call to OsgEarthItemRenderer instead
- /*if (m_viewer.get()) {
- m_viewer->getCamera()->setProjectionMatrixAsPerspective(
- m_fieldOfView,
- qreal(m_currentSize.width())/m_currentSize.height(),
- 1.0f, 10000.0f);
- }*/
-
- updateFrame();
- }
-}
-
-void OsgEarthItem::setSceneFile(QString arg)
-{
- if (m_sceneFile != arg) {
- m_sceneFile = arg;
- emit sceneFileChanged(arg);
- }
-}
-
-OsgEarthItemRenderer::OsgEarthItemRenderer(OsgEarthItem *item, QGLWidget *glWidget) :
- QObject(0),
- m_item(item),
- m_lastFboNumber(0),
- m_currentSize(640, 480),
- m_cameraDirty(false)
-{
- // make a shared gl widget to avoid
- // osg rendering to mess with qpainter state
- // this runs in the main thread
- m_glWidget = new QGLWidget(0, glWidget);
- m_glWidget.data()->setAttribute(Qt::WA_PaintOutsidePaintEvent);
-
- for (int i = 0; i < FboCount; i++) {
- m_fbo[i] = new QGLFramebufferObject(m_currentSize, QGLFramebufferObject::CombinedDepthStencil);
- QPainter p(m_fbo[i]);
- p.fillRect(0, 0, m_currentSize.width(), m_currentSize.height(), Qt::gray);
- }
-}
-
-OsgEarthItemRenderer::~OsgEarthItemRenderer()
-{
- m_glWidget.data()->makeCurrent();
- for (int i = 0; i < FboCount; i++) {
- delete m_fbo[i];
- m_fbo[i] = 0;
- }
- m_glWidget.data()->doneCurrent();
-
- delete m_glWidget.data();
-}
-
-QGLFramebufferObject *OsgEarthItemRenderer::lastFrame()
-{
- return m_fbo[m_lastFboNumber];
-}
-
-void OsgEarthItemRenderer::initScene()
-{
- Q_ASSERT(!m_viewer.get());
-
- int w = m_currentSize.width();
- int h = m_currentSize.height();
-
- QString sceneFile = m_item->resolvedSceneFile();
- m_model = osgDB::readNodeFile(sceneFile.toStdString());
-
- // setup caching
- osgEarth::MapNode *mapNode = osgEarth::MapNode::findMapNode(m_model.get());
- if (!mapNode) {
- qWarning() << Q_FUNC_INFO << sceneFile << " doesn't look like an osgEarth file";
- }
-
- m_gw = new osgViewer::GraphicsWindowEmbedded(0, 0, w, h);
-
- m_viewer = new osgViewer::Viewer();
- m_viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
- m_viewer->setSceneData(m_model);
- m_viewer->getDatabasePager()->setDoPreCompile(true);
-
- osg::Camera *camera = m_viewer->getCamera();
- camera->setViewport(new osg::Viewport(0, 0, w, h));
- camera->setGraphicsContext(m_gw);
- camera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- // configure the near/far so we don't clip things that are up close
- camera->setNearFarRatio(0.00002);
- camera->setProjectionMatrixAsPerspective(m_item->fieldOfView(), qreal(w) / h, 1.0f, 10000.0f);
-
- updateFrame();
-}
-
-void OsgEarthItemRenderer::updateFrame()
-{
- if (!m_cameraDirty || !m_viewer.get() || m_glWidget.isNull()) {
- return;
- }
-
- m_glWidget.data()->makeCurrent();
-
- // To find a camera view matrix, find placer matrixes for two points
- // onr at requested coords and another latitude shifted by 0.01 deg
- osgEarth::Util::ObjectPlacer placer(m_viewer->getSceneData());
-
- m_cameraDirty = false;
-
- osg::Matrixd positionMatrix;
- placer.createPlacerMatrix(m_item->latitude(), m_item->longitude(), m_item->altitude(), positionMatrix);
- osg::Matrixd positionMatrix2;
- placer.createPlacerMatrix(m_item->latitude() + 0.01, m_item->longitude(), m_item->altitude(), positionMatrix2);
-
- osg::Vec3d eye(0.0f, 0.0f, 0.0f);
- osg::Vec3d viewVector(0.0f, 0.0f, 0.0f);
- osg::Vec3d upVector(0.0f, 0.0f, 1.0f);
-
- eye = positionMatrix.preMult(eye);
- upVector = positionMatrix.preMult(upVector);
- upVector.normalize();
- viewVector = positionMatrix2.preMult(viewVector) - eye;
- viewVector.normalize();
- viewVector *= 10.0;
-
- // TODO: clarify the correct rotation order,
- // currently assuming yaw, pitch, roll
- osg::Quat q;
- q.makeRotate(-m_item->yaw() * M_PI / 180.0, upVector);
- upVector = q * upVector;
- viewVector = q * viewVector;
-
- osg::Vec3d side = viewVector ^ upVector;
- q.makeRotate(m_item->pitch() * M_PI / 180.0, side);
- upVector = q * upVector;
- viewVector = q * viewVector;
-
- q.makeRotate(m_item->roll() * M_PI / 180.0, viewVector);
- upVector = q * upVector;
- viewVector = q * viewVector;
-
- osg::Vec3d center = eye + viewVector;
-
-// qDebug() << "e " << eye.x() << eye.y() << eye.z();
-// qDebug() << "c " << center.x() << center.y() << center.z();
-// qDebug() << "up" << upVector.x() << upVector.y() << upVector.z();
-
- m_viewer->getCamera()->setViewMatrixAsLookAt(osg::Vec3d(eye.x(), eye.y(), eye.z()),
- osg::Vec3d(center.x(), center.y(), center.z()),
- osg::Vec3d(upVector.x(), upVector.y(), upVector.z()));
-
- {
- QGLFramebufferObject *fbo = m_fbo[(m_lastFboNumber + 1) % FboCount];
- QPainter fboPainter(fbo);
- fboPainter.beginNativePainting();
- m_viewer->frame();
- fboPainter.endNativePainting();
- }
- m_glWidget.data()->doneCurrent();
-
- m_lastFboNumber = (m_lastFboNumber + 1) % FboCount;
-
- emit frameReady();
-}
diff --git a/ground/gcs/src/plugins/pfdqml/osgearth.h b/ground/gcs/src/plugins/pfdqml/osgearth.h
deleted file mode 100644
index 332c27156..000000000
--- a/ground/gcs/src/plugins/pfdqml/osgearth.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef OSGEARTH_H
-#define OSGEARTH_H
-
-#include
-
-#include
-#include
-
-class QGLFramebufferObject;
-class QGLWidget;
-class OsgEarthItemRenderer;
-
-class OsgEarthItem : public QDeclarativeItem {
- Q_OBJECT Q_DISABLE_COPY(OsgEarthItem)
-
- Q_PROPERTY(QString sceneFile READ sceneFile WRITE setSceneFile NOTIFY sceneFileChanged)
- Q_PROPERTY(qreal fieldOfView READ fieldOfView WRITE setFieldOfView NOTIFY fieldOfViewChanged)
-
- Q_PROPERTY(qreal roll READ roll WRITE setRoll NOTIFY rollChanged)
- Q_PROPERTY(qreal pitch READ pitch WRITE setPitch NOTIFY pitchChanged)
- Q_PROPERTY(qreal yaw READ yaw WRITE setYaw NOTIFY yawChanged)
-
- Q_PROPERTY(double latitude READ latitude WRITE setLatitude NOTIFY latitudeChanged)
- Q_PROPERTY(double longitude READ longitude WRITE setLongitude NOTIFY longitudeChanged)
- Q_PROPERTY(double altitude READ altitude WRITE setAltitude NOTIFY altitudeChanged)
-
-public:
- OsgEarthItem(QDeclarativeItem *parent = 0);
- ~OsgEarthItem();
-
- QString sceneFile() const
- {
- return m_sceneFile;
- }
- QString resolvedSceneFile() const;
- qreal fieldOfView() const
- {
- return m_fieldOfView;
- }
-
- qreal roll() const
- {
- return m_roll;
- }
- qreal pitch() const
- {
- return m_pitch;
- }
- qreal yaw() const
- {
- return m_yaw;
- }
-
- double latitude() const
- {
- return m_latitude;
- }
- double longitude() const
- {
- return m_longitude;
- }
- double altitude() const
- {
- return m_altitude;
- }
-
-protected:
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *style, QWidget *widget);
-
-public slots:
- void updateView();
- void setSceneFile(QString arg);
- void setFieldOfView(qreal arg);
-
- void setRoll(qreal arg);
- void setPitch(qreal arg);
- void setYaw(qreal arg);
-
- void setLatitude(double arg);
- void setLongitude(double arg);
- void setAltitude(double arg);
-
-signals:
- void rollChanged(qreal arg);
- void pitchChanged(qreal arg);
- void yawChanged(qreal arg);
-
- void latitudeChanged(double arg);
- void longitudeChanged(double arg);
- void altitudeChanged(double arg);
-
- void sceneFileChanged(QString arg);
- void fieldOfViewChanged(qreal arg);
-
-private slots:
- void updateFrame();
-
-private:
- OsgEarthItemRenderer *m_renderer;
- QThread *m_rendererThread;
-
- QSize m_currentSize;
-
- qreal m_roll;
- qreal m_pitch;
- qreal m_yaw;
-
- double m_latitude;
- double m_longitude;
- double m_altitude;
-
- qreal m_fieldOfView;
- QString m_sceneFile;
-};
-
-class OsgEarthItemRenderer : public QObject {
- Q_OBJECT
-public:
- OsgEarthItemRenderer(OsgEarthItem *item, QGLWidget *glWidget);
- ~OsgEarthItemRenderer();
-
- QGLFramebufferObject *lastFrame();
- void markDirty()
- {
- m_cameraDirty = true;
- }
-
-public slots:
- void initScene();
- void updateFrame();
-
-signals:
- void frameReady();
-
-private:
- enum { FboCount = 3 };
- OsgEarthItem *m_item;
-
- osg::ref_ptr m_viewer;
- osg::ref_ptr m_gw;
- osg::ref_ptr m_model;
- QWeakPointer m_glWidget;
-
- QGLFramebufferObject *m_fbo[FboCount];
- int m_lastFboNumber;
-
- QSize m_currentSize;
-
- bool m_cameraDirty;
-};
-
-QML_DECLARE_TYPE(OsgEarthItem)
-
-#endif // OSGEARTH_H
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqml.h b/ground/gcs/src/plugins/pfdqml/pfdqml.h
new file mode 100644
index 000000000..30510e1e4
--- /dev/null
+++ b/ground/gcs/src/plugins/pfdqml/pfdqml.h
@@ -0,0 +1,60 @@
+/**
+ ******************************************************************************
+ *
+ * @file pfdqml.h
+ * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
+ * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup
+ * @{
+ * @addtogroup
+ * @{
+ * @brief
+ *****************************************************************************//*
+ * 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, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PFDQML_H_
+#define PFDQML_H_
+
+#include
+#include
+
+class ModelSelectionMode : public QObject {
+ Q_OBJECT
+
+public:
+ enum Enum { Auto, Predefined };
+ Q_ENUMS(Enum) // TODO switch to Q_ENUM once on Qt 5.5
+
+ static void registerQMLTypes()
+ {
+ qmlRegisterType("Pfd", 1, 0, "ModelSelectionMode");
+ }
+};
+
+class TimeMode : public QObject {
+ Q_OBJECT
+
+public:
+ enum Enum { Local, Predefined };
+ Q_ENUMS(Enum) // TODO switch to Q_ENUM once on Qt 5.5
+
+ static void registerQMLTypes()
+ {
+ qmlRegisterType("Pfd", 1, 0, "TimeMode");
+ }
+};
+
+#endif // PFDQML_H_
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqml.pro b/ground/gcs/src/plugins/pfdqml/pfdqml.pro
index 9af8bdb21..3af6c1ab1 100644
--- a/ground/gcs/src/plugins/pfdqml/pfdqml.pro
+++ b/ground/gcs/src/plugins/pfdqml/pfdqml.pro
@@ -1,17 +1,14 @@
TEMPLATE = lib
TARGET = PfdQml
-QT += svg
-QT += opengl
-QT += qml quick
-OSG {
- DEFINES += USE_OSG
-}
+
+QT += svg qml quick quickwidgets
include(../../plugin.pri)
-include(../../plugins/coreplugin/coreplugin.pri)
include(pfdqml_dependencies.pri)
HEADERS += \
+ pfdqml.h \
+ pfdqmlcontext.h \
pfdqmlplugin.h \
pfdqmlgadget.h \
pfdqmlgadgetwidget.h \
@@ -20,6 +17,7 @@ HEADERS += \
pfdqmlgadgetoptionspage.h
SOURCES += \
+ pfdqmlcontext.cpp \
pfdqmlplugin.cpp \
pfdqmlgadget.cpp \
pfdqmlgadgetfactory.cpp \
@@ -27,15 +25,6 @@ SOURCES += \
pfdqmlgadgetconfiguration.cpp \
pfdqmlgadgetoptionspage.cpp
-
-contains(DEFINES,USE_OSG) {
- LIBS += -losg -losgUtil -losgViewer -losgQt -losgDB -lOpenThreads -losgGA
- LIBS += -losgEarth -losgEarthFeatures -losgEarthUtil
-
- HEADERS += osgearth.h
- SOURCES += osgearth.cpp
-}
-
OTHER_FILES += PfdQml.pluginspec
FORMS += pfdqmlgadgetoptionspage.ui
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqml_dependencies.pri b/ground/gcs/src/plugins/pfdqml/pfdqml_dependencies.pri
index 9aae5fbc0..bd0c552ce 100644
--- a/ground/gcs/src/plugins/pfdqml/pfdqml_dependencies.pri
+++ b/ground/gcs/src/plugins/pfdqml/pfdqml_dependencies.pri
@@ -1 +1,7 @@
+include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/uavobjects/uavobjects.pri)
+include(../../libs/utils/utils.pri)
+
+# TODO get rid of this dependency
+# it is only needed for one initialization call in pfdqmlplugin.cpp
+include(../../libs/osgearth/osgearth.pri)
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqmlcontext.cpp b/ground/gcs/src/plugins/pfdqml/pfdqmlcontext.cpp
new file mode 100644
index 000000000..329ee0511
--- /dev/null
+++ b/ground/gcs/src/plugins/pfdqml/pfdqmlcontext.cpp
@@ -0,0 +1,332 @@
+/**
+ ******************************************************************************
+ *
+ * @file pfdqmlcontext.cpp
+ * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
+ * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup
+ * @{
+ * @addtogroup
+ * @{
+ * @brief
+ *****************************************************************************//*
+ * 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, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "pfdqmlcontext.h"
+
+#include "extensionsystem/pluginmanager.h"
+#include "uavobjectmanager.h"
+#include "uavobject.h"
+#include "utils/stringutils.h"
+#include "flightbatterysettings.h"
+
+#include
+#include
+
+PfdQmlContext::PfdQmlContext(QObject *parent) : QObject(parent),
+ m_speedUnit("m/s"),
+ m_speedFactor(1.0),
+ m_altitudeUnit("m"),
+ m_altitudeFactor(1.0),
+ m_terrainEnabled(false),
+ m_terrainFile(""),
+ m_latitude(39.657380),
+ m_longitude(19.805158),
+ m_altitude(100),
+ m_timeMode(TimeMode::Local),
+ m_dateTime(QDateTime()),
+ m_minAmbientLight(0.03),
+ m_modelFile(""),
+ m_backgroundImageFile("")
+{}
+
+PfdQmlContext::~PfdQmlContext()
+{}
+
+QString PfdQmlContext::speedUnit() const
+{
+ return m_speedUnit;
+}
+
+void PfdQmlContext::setSpeedUnit(QString unit)
+{
+ if (m_speedUnit != unit) {
+ m_speedUnit = unit;
+ emit speedUnitChanged(speedUnit());
+ }
+}
+
+double PfdQmlContext::speedFactor() const
+{
+ return m_speedFactor;
+}
+
+void PfdQmlContext::setSpeedFactor(double factor)
+{
+ if (m_speedFactor != factor) {
+ m_speedFactor = factor;
+ emit speedFactorChanged(speedFactor());
+ }
+}
+
+QString PfdQmlContext::altitudeUnit() const
+{
+ return m_altitudeUnit;
+}
+
+void PfdQmlContext::setAltitudeUnit(QString unit)
+{
+ if (m_altitudeUnit != unit) {
+ m_altitudeUnit = unit;
+ emit altitudeUnitChanged(altitudeUnit());
+ }
+}
+
+double PfdQmlContext::altitudeFactor() const
+{
+ return m_altitudeFactor;
+}
+
+void PfdQmlContext::setAltitudeFactor(double factor)
+{
+ if (m_altitudeFactor != factor) {
+ m_altitudeFactor = factor;
+ emit altitudeFactorChanged(altitudeFactor());
+ }
+}
+
+bool PfdQmlContext::terrainEnabled() const
+{
+ return m_terrainEnabled;
+}
+
+void PfdQmlContext::setTerrainEnabled(bool arg)
+{
+ if (m_terrainEnabled != arg) {
+ m_terrainEnabled = arg;
+ emit terrainEnabledChanged(terrainEnabled());
+ }
+}
+
+QString PfdQmlContext::terrainFile() const
+{
+ return m_terrainFile;
+}
+
+void PfdQmlContext::setTerrainFile(const QString &arg)
+{
+ if (m_terrainFile != arg) {
+ m_terrainFile = arg;
+ emit terrainFileChanged(terrainFile());
+ }
+}
+
+double PfdQmlContext::latitude() const
+{
+ return m_latitude;
+}
+
+void PfdQmlContext::setLatitude(double arg)
+{
+ if (m_latitude != arg) {
+ m_latitude = arg;
+ emit latitudeChanged(latitude());
+ }
+}
+
+double PfdQmlContext::longitude() const
+{
+ return m_longitude;
+}
+
+void PfdQmlContext::setLongitude(double arg)
+{
+ if (m_longitude != arg) {
+ m_longitude = arg;
+ emit longitudeChanged(longitude());
+ }
+}
+
+double PfdQmlContext::altitude() const
+{
+ return m_altitude;
+}
+
+void PfdQmlContext::setAltitude(double arg)
+{
+ if (m_altitude != arg) {
+ m_altitude = arg;
+ emit altitudeChanged(altitude());
+ }
+}
+
+TimeMode::Enum PfdQmlContext::timeMode() const
+{
+ return m_timeMode;
+}
+
+void PfdQmlContext::setTimeMode(TimeMode::Enum arg)
+{
+ if (m_timeMode != arg) {
+ m_timeMode = arg;
+ emit timeModeChanged(timeMode());
+ }
+}
+
+QDateTime PfdQmlContext::dateTime() const
+{
+ return m_dateTime;
+}
+
+void PfdQmlContext::setDateTime(QDateTime arg)
+{
+ if (m_dateTime != arg) {
+ m_dateTime = arg;
+ emit dateTimeChanged(dateTime());
+ }
+}
+
+double PfdQmlContext::minimumAmbientLight() const
+{
+ return m_minAmbientLight;
+}
+
+void PfdQmlContext::setMinimumAmbientLight(double arg)
+{
+ if (m_minAmbientLight != arg) {
+ m_minAmbientLight = arg;
+ emit minimumAmbientLightChanged(minimumAmbientLight());
+ }
+}
+
+QString PfdQmlContext::modelFile() const
+{
+ return m_modelFile;
+}
+
+void PfdQmlContext::setModelFile(const QString &arg)
+{
+ if (m_modelFile != arg) {
+ m_modelFile = arg;
+ emit modelFileChanged(modelFile());
+ }
+}
+
+QString PfdQmlContext::backgroundImageFile() const
+{
+ return m_backgroundImageFile;
+}
+
+void PfdQmlContext::setBackgroundImageFile(const QString &arg)
+{
+ if (m_backgroundImageFile != arg) {
+ m_backgroundImageFile = arg;
+ emit backgroundImageFileChanged(backgroundImageFile());
+ }
+}
+
+void PfdQmlContext::resetConsumedEnergy()
+{
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ UAVObjectManager *uavoManager = pm->getObject();
+
+ Q_ASSERT(uavoManager);
+
+ FlightBatterySettings *batterySettings = FlightBatterySettings::GetInstance(uavoManager);
+
+ batterySettings->setResetConsumedEnergy(true);
+ batterySettings->setData(batterySettings->getData());
+}
+
+void PfdQmlContext::loadConfiguration(PfdQmlGadgetConfiguration *config)
+{
+ setSpeedFactor(config->speedFactor());
+ setSpeedUnit(config->speedUnit());
+ setAltitudeFactor(config->altitudeFactor());
+ setAltitudeUnit(config->altitudeUnit());
+
+ // terrain
+ setTerrainEnabled(config->terrainEnabled());
+ setTerrainFile(config->terrainFile());
+
+ setLatitude(config->latitude());
+ setLongitude(config->longitude());
+ setAltitude(config->altitude());
+
+ // sky
+ setTimeMode(config->timeMode());
+ setDateTime(config->dateTime());
+ setMinimumAmbientLight(config->minAmbientLight());
+
+ // model
+ setModelFile(config->modelFile());
+
+ // background image
+ setBackgroundImageFile(config->backgroundImageFile());
+}
+
+void PfdQmlContext::apply(QQmlContext *context)
+{
+ QStringList objectsToExport;
+
+ objectsToExport <<
+ "VelocityState" <<
+ "PositionState" <<
+ "AttitudeState" <<
+ "AccelState" <<
+ "VelocityDesired" <<
+ "PathDesired" <<
+ "GPSPositionSensor" <<
+ "GPSSatellites" <<
+ "HomeLocation" <<
+ "GCSTelemetryStats" <<
+ "SystemAlarms" <<
+ "NedAccel" <<
+ "ActuatorDesired" <<
+ "TakeOffLocation" <<
+ "PathPlan" <<
+ "WaypointActive" <<
+ "OPLinkStatus" <<
+ "FlightStatus" <<
+ "SystemStats" <<
+ "StabilizationDesired" <<
+ "VtolPathFollowerSettings" <<
+ "HwSettings" <<
+ "ManualControlCommand" <<
+ "SystemSettings" <<
+ "RevoSettings" <<
+ "MagState" <<
+ "FlightBatterySettings" <<
+ "FlightBatteryState" <<
+ "ReceiverStatus";
+
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ UAVObjectManager *objManager = pm->getObject();
+
+ foreach(const QString &objectName, objectsToExport) {
+ UAVObject *object = objManager->getObject(objectName);
+
+ if (object) {
+ // expose object with lower camel case name
+ context->setContextProperty(Utils::toLowerCamelCase(objectName), object);
+ } else {
+ qWarning() << "PfdQmlContext::apply - failed to load object" << objectName;
+ }
+ }
+
+ // to expose settings values
+ context->setContextProperty("qmlWidget", this);
+}
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqmlcontext.h b/ground/gcs/src/plugins/pfdqml/pfdqmlcontext.h
new file mode 100644
index 000000000..78b426ee0
--- /dev/null
+++ b/ground/gcs/src/plugins/pfdqml/pfdqmlcontext.h
@@ -0,0 +1,140 @@
+/**
+ ******************************************************************************
+ *
+ * @file pfdqmlcontext.h
+ * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
+ * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup
+ * @{
+ * @addtogroup
+ * @{
+ * @brief
+ *****************************************************************************//*
+ * 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, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PFDQMLCONTEXT_H_
+#define PFDQMLCONTEXT_H_
+
+#include "pfdqml.h"
+#include "pfdqmlgadgetconfiguration.h"
+
+class QQmlContext;
+
+class PfdQmlContext : public QObject {
+ Q_OBJECT Q_PROPERTY(QString speedUnit READ speedUnit WRITE setSpeedUnit NOTIFY speedUnitChanged)
+ Q_PROPERTY(double speedFactor READ speedFactor WRITE setSpeedFactor NOTIFY speedFactorChanged)
+ Q_PROPERTY(QString altitudeUnit READ altitudeUnit WRITE setAltitudeUnit NOTIFY altitudeUnitChanged)
+ Q_PROPERTY(double altitudeFactor READ altitudeFactor WRITE setAltitudeFactor NOTIFY altitudeFactorChanged)
+
+ // terrain
+ Q_PROPERTY(bool terrainEnabled READ terrainEnabled WRITE setTerrainEnabled NOTIFY terrainEnabledChanged)
+ Q_PROPERTY(QString terrainFile READ terrainFile WRITE setTerrainFile NOTIFY terrainFileChanged)
+
+ Q_PROPERTY(double latitude READ latitude WRITE setLatitude NOTIFY latitudeChanged)
+ Q_PROPERTY(double longitude READ longitude WRITE setLongitude NOTIFY longitudeChanged)
+ Q_PROPERTY(double altitude READ altitude WRITE setAltitude NOTIFY altitudeChanged)
+
+ Q_PROPERTY(TimeMode::Enum timeMode READ timeMode WRITE setTimeMode NOTIFY timeModeChanged)
+ Q_PROPERTY(QDateTime dateTime READ dateTime WRITE setDateTime NOTIFY dateTimeChanged)
+ Q_PROPERTY(double minimumAmbientLight READ minimumAmbientLight WRITE setMinimumAmbientLight NOTIFY minimumAmbientLightChanged)
+
+ Q_PROPERTY(QString modelFile READ modelFile WRITE setModelFile NOTIFY modelFileChanged)
+ Q_PROPERTY(QString backgroundImageFile READ backgroundImageFile WRITE setBackgroundImageFile NOTIFY backgroundImageFileChanged)
+
+public:
+ PfdQmlContext(QObject *parent = 0);
+ virtual ~PfdQmlContext();
+
+ QString speedUnit() const;
+ void setSpeedUnit(QString unit);
+ double speedFactor() const;
+ void setSpeedFactor(double factor);
+ QString altitudeUnit() const;
+ void setAltitudeUnit(QString unit);
+ double altitudeFactor() const;
+ void setAltitudeFactor(double factor);
+
+ bool terrainEnabled() const;
+ void setTerrainEnabled(bool arg);
+ QString terrainFile() const;
+ void setTerrainFile(const QString &arg);
+
+ double latitude() const;
+ void setLatitude(double arg);
+ double longitude() const;
+ void setLongitude(double arg);
+ double altitude() const;
+ void setAltitude(double arg);
+
+ TimeMode::Enum timeMode() const;
+ void setTimeMode(TimeMode::Enum arg);
+ QDateTime dateTime() const;
+ void setDateTime(QDateTime arg);
+ double minimumAmbientLight() const;
+ void setMinimumAmbientLight(double arg);
+
+ QString modelFile() const;
+ void setModelFile(const QString &arg);
+ QString backgroundImageFile() const;
+ void setBackgroundImageFile(const QString &arg);
+
+ Q_INVOKABLE void resetConsumedEnergy();
+
+ void loadConfiguration(PfdQmlGadgetConfiguration *config);
+ void apply(QQmlContext *context);
+
+signals:
+ void speedUnitChanged(QString arg);
+ void speedFactorChanged(double arg);
+ void altitudeUnitChanged(QString arg);
+ void altitudeFactorChanged(double arg);
+
+ void terrainEnabledChanged(bool arg);
+ void terrainFileChanged(QString arg);
+
+ void latitudeChanged(double arg);
+ void longitudeChanged(double arg);
+ void altitudeChanged(double arg);
+
+ void timeModeChanged(TimeMode::Enum arg);
+ void dateTimeChanged(QDateTime arge);
+ void minimumAmbientLightChanged(double arg);
+
+ void modelFileChanged(QString arg);
+ void backgroundImageFileChanged(QString arg);
+
+private:
+ QString m_speedUnit;
+ double m_speedFactor;
+ QString m_altitudeUnit;
+ double m_altitudeFactor;
+
+ bool m_terrainEnabled;
+ QString m_terrainFile;
+
+ double m_latitude;
+ double m_longitude;
+ double m_altitude;
+
+ TimeMode::Enum m_timeMode;
+ QDateTime m_dateTime;
+ double m_minAmbientLight;
+
+ QString m_modelFile;
+
+ QString m_backgroundImageFile;
+};
+#endif /* PFDQMLCONTEXT_H_ */
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqmlgadget.cpp b/ground/gcs/src/plugins/pfdqml/pfdqmlgadget.cpp
index e28257ff5..0530b1540 100644
--- a/ground/gcs/src/plugins/pfdqml/pfdqmlgadget.cpp
+++ b/ground/gcs/src/plugins/pfdqml/pfdqmlgadget.cpp
@@ -1,4 +1,15 @@
-/*
+/**
+ ******************************************************************************
+ *
+ * @file pfdqmlgadget.cpp
+ * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
+ * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup
+ * @{
+ * @addtogroup
+ * @{
+ * @brief
+ *****************************************************************************//*
* 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
@@ -18,51 +29,25 @@
#include "pfdqmlgadgetwidget.h"
#include "pfdqmlgadgetconfiguration.h"
-PfdQmlGadget::PfdQmlGadget(QString classId, PfdQmlGadgetWidget *widget, QWidget *parent) :
- IUAVGadget(classId, parent),
- m_widget(widget)
+PfdQmlGadget::PfdQmlGadget(QString classId, QWidget *parent) :
+ IUAVGadget(classId, parent)
{
- m_container = NULL;
- m_parent = parent;
+ m_qmlGadgetWidget = new PfdQmlGadgetWidget(parent);
}
PfdQmlGadget::~PfdQmlGadget()
{
- delete m_widget;
+ delete m_qmlGadgetWidget;
+}
+
+QWidget *PfdQmlGadget::widget()
+{
+ return m_qmlGadgetWidget;
}
-/*
- This is called when a configuration is loaded, and updates the plugin's settings.
- Careful: the plugin is already drawn before the loadConfiguration method is called the
- first time, so you have to be careful not to assume all the plugin values are initialized
- the first time you use them
- */
void PfdQmlGadget::loadConfiguration(IUAVGadgetConfiguration *config)
{
PfdQmlGadgetConfiguration *m = qobject_cast(config);
- m_widget->setOpenGLEnabled(m->openGLEnabled());
- m_widget->setQmlFile(m->qmlFile());
- m_widget->setEarthFile(m->earthFile());
- m_widget->setTerrainEnabled(m->terrainEnabled());
- m_widget->setActualPositionUsed(m->actualPositionUsed());
- m_widget->setLatitude(m->latitude());
- m_widget->setLongitude(m->longitude());
- m_widget->setAltitude(m->altitude());
- m_widget->setSpeedFactor(m->speedFactor());
- m_widget->setSpeedUnit(m->speedUnit());
- m_widget->setAltitudeFactor(m->altitudeFactor());
- m_widget->setAltitudeUnit(m->altitudeUnit());
-
- // setting OSGEARTH_CACHE_ONLY seems to work the most reliably
- // between osgEarth versions I tried
- if (m->cacheOnly()) {
- qputenv("OSGEARTH_CACHE_ONLY", "true");
- } else {
-#ifdef Q_OS_WIN32
- qputenv("OSGEARTH_CACHE_ONLY", "");
-#else
- unsetenv("OSGEARTH_CACHE_ONLY");
-#endif
- }
+ m_qmlGadgetWidget->loadConfiguration(m);
}
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqmlgadget.h b/ground/gcs/src/plugins/pfdqml/pfdqmlgadget.h
index 5e6fa96a6..45b97eafb 100644
--- a/ground/gcs/src/plugins/pfdqml/pfdqmlgadget.h
+++ b/ground/gcs/src/plugins/pfdqml/pfdqmlgadget.h
@@ -1,4 +1,15 @@
-/*
+/**
+ ******************************************************************************
+ *
+ * @file pfdqmlgadget.h
+ * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
+ * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup
+ * @{
+ * @addtogroup
+ * @{
+ * @brief
+ *****************************************************************************//*
* 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
@@ -17,38 +28,27 @@
#ifndef PFDQMLGADGET_H_
#define PFDQMLGADGET_H_
-#include
-#include "pfdqmlgadgetwidget.h"
+#include "pfdqmlgadget.h"
+
+#include
-class IUAVGadget;
-class QWidget;
-class QString;
class PfdQmlGadgetWidget;
using namespace Core;
class PfdQmlGadget : public Core::IUAVGadget {
Q_OBJECT
-public:
- PfdQmlGadget(QString classId, PfdQmlGadgetWidget *widget, QWidget *parent = 0);
- ~PfdQmlGadget();
- QWidget *widget()
- {
- if (!m_container) {
- m_container = QWidget::createWindowContainer(m_widget, m_parent);
- m_container->setMinimumSize(64, 64);
- m_container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
- }
- return m_container;
- }
+public:
+ PfdQmlGadget(QString classId, QWidget *parent = 0);
+ virtual ~PfdQmlGadget();
+
+ QWidget *widget();
+
void loadConfiguration(IUAVGadgetConfiguration *config);
private:
- QWidget *m_container;
- QWidget *m_parent;
- PfdQmlGadgetWidget *m_widget;
+ PfdQmlGadgetWidget *m_qmlGadgetWidget;
};
-
#endif // PFDQMLGADGET_H_
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetconfiguration.cpp b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetconfiguration.cpp
index dd4638f50..f6df1b985 100644
--- a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetconfiguration.cpp
+++ b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetconfiguration.cpp
@@ -1,4 +1,15 @@
-/*
+/**
+ ******************************************************************************
+ *
+ * @file pfdqmlgadgetconfiguration.cpp
+ * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
+ * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup
+ * @{
+ * @addtogroup
+ * @{
+ * @brief
+ *****************************************************************************//*
* 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
@@ -24,16 +35,21 @@
PfdQmlGadgetConfiguration::PfdQmlGadgetConfiguration(QString classId, QSettings *qSettings, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
m_qmlFile("Unknown"),
- m_earthFile("Unknown"),
- m_openGLEnabled(true),
+ m_speedFactor(1.0),
+ m_altitudeFactor(1.0),
m_terrainEnabled(false),
- m_actualPositionUsed(false),
+ m_terrainFile("Unknown"),
+ m_cacheOnly(false),
m_latitude(0),
m_longitude(0),
m_altitude(0),
- m_cacheOnly(false),
- m_speedFactor(1.0),
- m_altitudeFactor(1.0)
+ m_timeMode(TimeMode::Local),
+ m_dateTime(QDateTime()),
+ m_minAmbientLight(0),
+ m_modelEnabled(false),
+ m_modelFile("Unknown"),
+ m_modelSelectionMode(ModelSelectionMode::Auto),
+ m_backgroundImageFile("Unknown")
{
m_speedMap[1.0] = "m/s";
m_speedMap[3.6] = "km/h";
@@ -45,21 +61,36 @@ PfdQmlGadgetConfiguration::PfdQmlGadgetConfiguration(QString classId, QSettings
// if a saved configuration exists load it
if (qSettings != 0) {
- m_qmlFile = qSettings->value("qmlFile").toString();
- m_qmlFile = Utils::InsertDataPath(m_qmlFile);
+ m_qmlFile = qSettings->value("qmlFile").toString();
+ m_qmlFile = Utils::InsertDataPath(m_qmlFile);
- m_earthFile = qSettings->value("earthFile").toString();
- m_earthFile = Utils::InsertDataPath(m_earthFile);
+ m_speedFactor = qSettings->value("speedFactor").toDouble();
+ m_altitudeFactor = qSettings->value("altitudeFactor").toDouble();
- m_openGLEnabled = qSettings->value("openGLEnabled", true).toBool();
- m_terrainEnabled = qSettings->value("terrainEnabled").toBool();
- m_actualPositionUsed = qSettings->value("actualPositionUsed").toBool();
- m_latitude = qSettings->value("latitude").toDouble();
- m_longitude = qSettings->value("longitude").toDouble();
- m_altitude = qSettings->value("altitude").toDouble();
- m_cacheOnly = qSettings->value("cacheOnly").toBool();
- m_speedFactor = qSettings->value("speedFactor").toDouble();
- m_altitudeFactor = qSettings->value("altitudeFactor").toDouble();
+ // terrain
+ m_terrainEnabled = qSettings->value("terrainEnabled").toBool();
+ m_terrainFile = qSettings->value("earthFile").toString();
+ m_terrainFile = Utils::InsertDataPath(m_terrainFile);
+ m_cacheOnly = qSettings->value("cacheOnly").toBool();
+
+ m_latitude = qSettings->value("latitude").toDouble();
+ m_longitude = qSettings->value("longitude").toDouble();
+ m_altitude = qSettings->value("altitude").toDouble();
+
+ // sky
+ m_timeMode = static_cast(qSettings->value("timeMode").toUInt());
+ m_dateTime = qSettings->value("dateTime").toDateTime();
+ m_minAmbientLight = qSettings->value("minAmbientLight").toDouble();
+
+ // model
+ m_modelEnabled = qSettings->value("modelEnabled").toBool();
+ m_modelSelectionMode = static_cast(qSettings->value("modelSelectionMode").toUInt());
+ m_modelFile = qSettings->value("modelFile").toString();
+ m_modelFile = Utils::InsertDataPath(m_modelFile);
+
+ // background image
+ m_backgroundImageFile = qSettings->value("backgroundImageFile").toString();
+ m_backgroundImageFile = Utils::InsertDataPath(m_backgroundImageFile);
}
}
@@ -71,17 +102,32 @@ IUAVGadgetConfiguration *PfdQmlGadgetConfiguration::clone()
{
PfdQmlGadgetConfiguration *m = new PfdQmlGadgetConfiguration(this->classId());
- m->m_qmlFile = m_qmlFile;
- m->m_openGLEnabled = m_openGLEnabled;
- m->m_earthFile = m_earthFile;
- m->m_terrainEnabled = m_terrainEnabled;
- m->m_actualPositionUsed = m_actualPositionUsed;
- m->m_latitude = m_latitude;
- m->m_longitude = m_longitude;
- m->m_altitude = m_altitude;
- m->m_cacheOnly = m_cacheOnly;
- m->m_speedFactor = m_speedFactor;
- m->m_altitudeFactor = m_altitudeFactor;
+ m->m_qmlFile = m_qmlFile;
+
+ m->m_speedFactor = m_speedFactor;
+ m->m_altitudeFactor = m_altitudeFactor;
+
+ // terrain
+ m->m_terrainEnabled = m_terrainEnabled;
+ m->m_terrainFile = m_terrainFile;
+ m->m_cacheOnly = m_cacheOnly;
+
+ m->m_latitude = m_latitude;
+ m->m_longitude = m_longitude;
+ m->m_altitude = m_altitude;
+
+ // sky
+ m->m_timeMode = m_timeMode;
+ m->m_dateTime = m_dateTime;
+ m->m_minAmbientLight = m_minAmbientLight;
+
+ // model
+ m->m_modelEnabled = m_modelEnabled;
+ m->m_modelSelectionMode = m_modelSelectionMode;
+ m->m_modelFile = m_modelFile;
+
+ // background image
+ m->m_backgroundImageFile = m_backgroundImageFile;
return m;
}
@@ -92,19 +138,35 @@ IUAVGadgetConfiguration *PfdQmlGadgetConfiguration::clone()
*/
void PfdQmlGadgetConfiguration::saveConfig(QSettings *qSettings) const
{
- QString qmlFile = Utils::RemoveDataPath(m_qmlFile);
+ QString qmlFile = Utils::RemoveDataPath(m_qmlFile);
qSettings->setValue("qmlFile", qmlFile);
- QString earthFile = Utils::RemoveDataPath(m_earthFile);
- qSettings->setValue("earthFile", earthFile);
- qSettings->setValue("openGLEnabled", m_openGLEnabled);
+ qSettings->setValue("speedFactor", m_speedFactor);
+ qSettings->setValue("altitudeFactor", m_altitudeFactor);
+
+ // terrain
qSettings->setValue("terrainEnabled", m_terrainEnabled);
- qSettings->setValue("actualPositionUsed", m_actualPositionUsed);
+ QString terrainFile = Utils::RemoveDataPath(m_terrainFile);
+ qSettings->setValue("earthFile", terrainFile);
+ qSettings->setValue("cacheOnly", m_cacheOnly);
+
qSettings->setValue("latitude", m_latitude);
qSettings->setValue("longitude", m_longitude);
qSettings->setValue("altitude", m_altitude);
- qSettings->setValue("cacheOnly", m_cacheOnly);
- qSettings->setValue("speedFactor", m_speedFactor);
- qSettings->setValue("altitudeFactor", m_altitudeFactor);
+
+ // sky
+ qSettings->setValue("timeMode", static_cast(m_timeMode));
+ qSettings->setValue("dateTime", m_dateTime);
+ qSettings->setValue("minAmbientLight", m_minAmbientLight);
+
+ // model
+ qSettings->setValue("modelEnabled", m_modelEnabled);
+ qSettings->setValue("modelSelectionMode", static_cast(m_modelSelectionMode));
+ QString modelFile = Utils::RemoveDataPath(m_modelFile);
+ qSettings->setValue("modelFile", modelFile);
+
+ // background image
+ QString backgroundImageFile = Utils::RemoveDataPath(m_backgroundImageFile);
+ qSettings->setValue("backgroundImageFile", backgroundImageFile);
}
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetconfiguration.h b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetconfiguration.h
index b3f8e9b34..9bcdc42a5 100644
--- a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetconfiguration.h
+++ b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetconfiguration.h
@@ -1,4 +1,15 @@
-/*
+/**
+ ******************************************************************************
+ *
+ * @file pfdqmlgadgetconfiguration.h
+ * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
+ * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup
+ * @{
+ * @addtogroup
+ * @{
+ * @brief
+ *****************************************************************************//*
* 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
@@ -17,8 +28,11 @@
#ifndef PFDQMLGADGETCONFIGURATION_H
#define PFDQMLGADGETCONFIGURATION_H
+#include "pfdqml.h"
#include
+
#include
+#include
using namespace Core;
@@ -27,94 +41,13 @@ class PfdQmlGadgetConfiguration : public IUAVGadgetConfiguration {
public:
explicit PfdQmlGadgetConfiguration(QString classId, QSettings *qSettings = 0, QObject *parent = 0);
- void setQmlFile(const QString &fileName)
- {
- m_qmlFile = fileName;
- }
- void setEarthFile(const QString &fileName)
- {
- m_earthFile = fileName;
- }
- void setOpenGLEnabled(bool flag)
- {
- m_openGLEnabled = flag;
- }
- void setTerrainEnabled(bool flag)
- {
- m_terrainEnabled = flag;
- }
- void setActualPositionUsed(bool flag)
- {
- m_actualPositionUsed = flag;
- }
- void setLatitude(double value)
- {
- m_latitude = value;
- }
- void setLongitude(double value)
- {
- m_longitude = value;
- }
- void setAltitude(double value)
- {
- m_altitude = value;
- }
- void setCacheOnly(bool flag)
- {
- m_cacheOnly = flag;
- }
- void setSpeedFactor(double factor)
- {
- m_speedFactor = factor;
- }
- void setAltitudeFactor(double factor)
- {
- m_altitudeFactor = factor;
- }
-
QString qmlFile() const
{
return m_qmlFile;
}
- QString earthFile() const
+ void setQmlFile(const QString &fileName)
{
- return m_earthFile;
- }
- bool openGLEnabled() const
- {
- return m_openGLEnabled;
- }
- bool terrainEnabled() const
- {
- return m_terrainEnabled;
- }
- bool actualPositionUsed() const
- {
- return m_actualPositionUsed;
- }
- double latitude() const
- {
- return m_latitude;
- }
- double longitude() const
- {
- return m_longitude;
- }
- double altitude() const
- {
- return m_altitude;
- }
- bool cacheOnly() const
- {
- return m_cacheOnly;
- }
- double speedFactor() const
- {
- return m_speedFactor;
- }
- double altitudeFactor() const
- {
- return m_altitudeFactor;
+ m_qmlFile = fileName;
}
QString speedUnit() const
@@ -122,11 +55,147 @@ public:
return m_speedMap[m_speedFactor];
}
+ double speedFactor() const
+ {
+ return m_speedFactor;
+ }
+ void setSpeedFactor(double factor)
+ {
+ m_speedFactor = factor;
+ }
+
QString altitudeUnit() const
{
return m_altitudeMap[m_altitudeFactor];
}
+ double altitudeFactor() const
+ {
+ return m_altitudeFactor;
+ }
+ void setAltitudeFactor(double factor)
+ {
+ m_altitudeFactor = factor;
+ }
+
+ bool terrainEnabled() const
+ {
+ return m_terrainEnabled;
+ }
+ void setTerrainEnabled(bool flag)
+ {
+ m_terrainEnabled = flag;
+ }
+
+ QString terrainFile() const
+ {
+ return m_terrainFile;
+ }
+ void setTerrainFile(const QString &fileName)
+ {
+ m_terrainFile = fileName;
+ }
+
+
+ double latitude() const
+ {
+ return m_latitude;
+ }
+ void setLatitude(double value)
+ {
+ m_latitude = value;
+ }
+
+ double longitude() const
+ {
+ return m_longitude;
+ }
+ void setLongitude(double value)
+ {
+ m_longitude = value;
+ }
+
+ double altitude() const
+ {
+ return m_altitude;
+ }
+ void setAltitude(double value)
+ {
+ m_altitude = value;
+ }
+
+ void setCacheOnly(bool flag)
+ {
+ m_cacheOnly = flag;
+ }
+ bool cacheOnly() const
+ {
+ return m_cacheOnly;
+ }
+
+ TimeMode::Enum timeMode() const
+ {
+ return m_timeMode;
+ }
+ void setTimeMode(TimeMode::Enum timeMode)
+ {
+ m_timeMode = timeMode;
+ }
+
+ QDateTime dateTime() const
+ {
+ return m_dateTime;
+ }
+ void setDateTime(QDateTime &dateTime)
+ {
+ m_dateTime = dateTime;
+ }
+
+ double minAmbientLight() const
+ {
+ return m_minAmbientLight;
+ }
+ void setMinAmbientLight(double minAmbientLight)
+ {
+ m_minAmbientLight = minAmbientLight;
+ }
+
+ bool modelEnabled() const
+ {
+ return m_modelEnabled;
+ }
+ void setModelEnabled(bool flag)
+ {
+ m_modelEnabled = flag;
+ }
+
+ QString modelFile() const
+ {
+ return m_modelFile;
+ }
+ void setModelFile(const QString &fileName)
+ {
+ m_modelFile = fileName;
+ }
+
+ ModelSelectionMode::Enum modelSelectionMode() const
+ {
+ return m_modelSelectionMode;
+ }
+ void setModelSelectionMode(ModelSelectionMode::Enum modelSelectionMode)
+ {
+ m_modelSelectionMode = modelSelectionMode;
+ }
+
+ QString backgroundImageFile() const
+ {
+ return m_backgroundImageFile;
+ }
+ void setBackgroundImageFile(const QString &fileName)
+ {
+ m_backgroundImageFile = fileName;
+ }
+
QMapIterator speedMapIterator()
{
return QMapIterator(m_speedMap);
@@ -142,18 +211,30 @@ public:
private:
QString m_qmlFile; // The name of the dial's SVG source file
- QString m_earthFile; // The name of osgearth terrain file
- bool m_openGLEnabled;
+
+ double m_speedFactor;
+ double m_altitudeFactor;
+
bool m_terrainEnabled;
- bool m_actualPositionUsed;
+ QString m_terrainFile; // The name of osgearth terrain file
+ bool m_cacheOnly;
+
double m_latitude;
double m_longitude;
double m_altitude;
- bool m_cacheOnly;
- double m_speedFactor;
- double m_altitudeFactor;
+
+ TimeMode::Enum m_timeMode;
+ QDateTime m_dateTime;
+ double m_minAmbientLight;
+
+ bool m_modelEnabled;
+ QString m_modelFile; // The name of model file
+ ModelSelectionMode::Enum m_modelSelectionMode;
+
+ QString m_backgroundImageFile;
+
QMap m_speedMap;
QMap m_altitudeMap;
};
-#endif // PfdQmlGADGETCONFIGURATION_H
+#endif // PFDQMLGADGETCONFIGURATION_H
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetfactory.cpp b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetfactory.cpp
index 197f1929d..67ad3b2be 100644
--- a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetfactory.cpp
+++ b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetfactory.cpp
@@ -1,4 +1,15 @@
-/*
+/**
+ ******************************************************************************
+ *
+ * @file pfdqmlgadgetfactory.cpp
+ * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
+ * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup
+ * @{
+ * @addtogroup
+ * @{
+ * @brief
+ *****************************************************************************//*
* 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
@@ -13,8 +24,8 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "pfdqmlgadgetfactory.h"
-#include "pfdqmlgadgetwidget.h"
#include "pfdqmlgadget.h"
#include "pfdqmlgadgetconfiguration.h"
#include "pfdqmlgadgetoptionspage.h"
@@ -31,9 +42,7 @@ PfdQmlGadgetFactory::~PfdQmlGadgetFactory()
Core::IUAVGadget *PfdQmlGadgetFactory::createGadget(QWidget *parent)
{
- PfdQmlGadgetWidget *gadgetWidget = new PfdQmlGadgetWidget();
-
- return new PfdQmlGadget(QString("PfdQmlGadget"), gadgetWidget, parent);
+ return new PfdQmlGadget(QString("PfdQmlGadget"), parent);
}
IUAVGadgetConfiguration *PfdQmlGadgetFactory::createConfiguration(QSettings *qSettings)
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetfactory.h b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetfactory.h
index 23e4610ed..d7bd061a3 100644
--- a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetfactory.h
+++ b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetfactory.h
@@ -1,4 +1,15 @@
-/*
+/**
+ ******************************************************************************
+ *
+ * @file pfdqmlgadgetfactory.h
+ * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
+ * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup
+ * @{
+ * @addtogroup
+ * @{
+ * @brief
+ *****************************************************************************//*
* 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
@@ -37,4 +48,4 @@ public:
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};
-#endif // PfdQmlGADGETFACTORY_H_
+#endif // PFDQMLGADGETFACTORY_H_
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetoptionspage.cpp b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetoptionspage.cpp
index b7f2aab5e..af7d5a7db 100644
--- a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetoptionspage.cpp
+++ b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetoptionspage.cpp
@@ -1,4 +1,15 @@
-/*
+/**
+ ******************************************************************************
+ *
+ * @file pfdqmlgadgetoptionspage.cpp
+ * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
+ * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup
+ * @{
+ * @addtogroup
+ * @{
+ * @brief
+ *****************************************************************************//*
* 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
@@ -21,14 +32,12 @@
#include "uavobjectmanager.h"
#include "uavdataobject.h"
-
#include
#include
#include
PfdQmlGadgetOptionsPage::PfdQmlGadgetOptionsPage(PfdQmlGadgetConfiguration *config, QObject *parent) :
- IOptionsPage(parent),
- m_config(config)
+ IOptionsPage(parent), options_page(NULL), m_config(config)
{}
// creates options page widget (uses the UI file)
@@ -40,29 +49,13 @@ QWidget *PfdQmlGadgetOptionsPage::createPage(QWidget *parent)
// main layout
options_page->setupUi(optionsPageWidget);
- // Restore the contents from the settings:
+ // QML file chooser
options_page->qmlSourceFile->setExpectedKind(Utils::PathChooser::File);
options_page->qmlSourceFile->setPromptDialogFilter(tr("QML file (*.qml)"));
- options_page->qmlSourceFile->setPromptDialogTitle(tr("Choose QML file"));
+ options_page->qmlSourceFile->setPromptDialogTitle(tr("Choose QML File"));
options_page->qmlSourceFile->setPath(m_config->qmlFile());
- // Restore the contents from the settings:
- options_page->earthFile->setExpectedKind(Utils::PathChooser::File);
- options_page->earthFile->setPromptDialogFilter(tr("OsgEarth (*.earth)"));
- options_page->earthFile->setPromptDialogTitle(tr("Choose OsgEarth terrain file"));
- options_page->earthFile->setPath(m_config->earthFile());
-
- options_page->useOpenGL->setChecked(m_config->openGLEnabled());
- options_page->showTerrain->setChecked(m_config->terrainEnabled());
-
- options_page->useActualLocation->setChecked(m_config->actualPositionUsed());
- options_page->usePredefinedLocation->setChecked(!m_config->actualPositionUsed());
- options_page->latitude->setText(QString::number(m_config->latitude()));
- options_page->longitude->setText(QString::number(m_config->longitude()));
- options_page->altitude->setText(QString::number(m_config->altitude()));
- options_page->useOnlyCache->setChecked(m_config->cacheOnly());
-
- // Setup units combos
+ // Speed Unit combo
QMapIterator iter = m_config->speedMapIterator();
while (iter.hasNext()) {
iter.next();
@@ -70,6 +63,7 @@ QWidget *PfdQmlGadgetOptionsPage::createPage(QWidget *parent)
}
options_page->speedUnitCombo->setCurrentIndex(options_page->speedUnitCombo->findData(m_config->speedFactor()));
+ // Altitude Unit combo
iter = m_config->altitudeMapIterator();
while (iter.hasNext()) {
iter.next();
@@ -77,11 +71,54 @@ QWidget *PfdQmlGadgetOptionsPage::createPage(QWidget *parent)
}
options_page->altUnitCombo->setCurrentIndex(options_page->altUnitCombo->findData(m_config->altitudeFactor()));
+ // Terrain check boxes
+ options_page->showTerrain->setChecked(m_config->terrainEnabled());
+
+ // Terrain file chooser
+ options_page->earthFile->setExpectedKind(Utils::PathChooser::File);
+ options_page->earthFile->setPromptDialogFilter(tr("OsgEarth (*.earth)"));
+ options_page->earthFile->setPromptDialogTitle(tr("Choose Terrain File"));
+ options_page->earthFile->setPath(m_config->terrainFile());
+
+ // Terrain position
+ options_page->latitude->setText(QString::number(m_config->latitude()));
+ options_page->longitude->setText(QString::number(m_config->longitude()));
+ options_page->altitude->setText(QString::number(m_config->altitude()));
+
+ options_page->useOnlyCache->setChecked(m_config->cacheOnly());
+
+ // Sky options
+ options_page->useLocalTime->setChecked(m_config->timeMode() == TimeMode::Local);
+ options_page->usePredefinedTime->setChecked(m_config->timeMode() == TimeMode::Predefined);
+ options_page->dateEdit->setDate(m_config->dateTime().date());
+ options_page->timeEdit->setTime(m_config->dateTime().time());
+ options_page->minAmbientLightSpinBox->setValue(m_config->minAmbientLight());
+
+ // Model check boxes
+ options_page->showModel->setChecked(m_config->modelEnabled());
+ options_page->useAutomaticModel->setChecked(m_config->modelSelectionMode() == ModelSelectionMode::Auto);
+ options_page->usePredefinedModel->setChecked(m_config->modelSelectionMode() == ModelSelectionMode::Predefined);
+
+ // Model file chooser
+ options_page->modelFile->setExpectedKind(Utils::PathChooser::File);
+ options_page->modelFile->setPromptDialogFilter(tr("Model file (*.3ds)"));
+ options_page->modelFile->setPromptDialogTitle(tr("Choose Model File"));
+ options_page->modelFile->setPath(m_config->modelFile());
+
+ // Background image chooser
+ options_page->backgroundImageFile->setExpectedKind(Utils::PathChooser::File);
+ // options_page->backgroundImageFile->setPromptDialogFilter(tr("Image file"));
+ options_page->backgroundImageFile->setPromptDialogTitle(tr("Choose Background Image File"));
+ options_page->backgroundImageFile->setPath(m_config->backgroundImageFile());
+
#ifndef USE_OSG
options_page->showTerrain->setChecked(false);
options_page->showTerrain->setVisible(false);
#endif
+ QObject::connect(options_page->actualizeDateTimeButton, SIGNAL(clicked()),
+ this, SLOT(actualizeDateTime()));
+
return optionsPageWidget;
}
@@ -94,24 +131,54 @@ QWidget *PfdQmlGadgetOptionsPage::createPage(QWidget *parent)
void PfdQmlGadgetOptionsPage::apply()
{
m_config->setQmlFile(options_page->qmlSourceFile->path());
- m_config->setEarthFile(options_page->earthFile->path());
- m_config->setOpenGLEnabled(options_page->useOpenGL->isChecked());
+
+ m_config->setSpeedFactor(options_page->speedUnitCombo->itemData(options_page->speedUnitCombo->currentIndex()).toDouble());
+ m_config->setAltitudeFactor(options_page->altUnitCombo->itemData(options_page->altUnitCombo->currentIndex()).toDouble());
#ifdef USE_OSG
m_config->setTerrainEnabled(options_page->showTerrain->isChecked());
-#else
- m_config->setTerrainEnabled(false);
-#endif
+ m_config->setTerrainFile(options_page->earthFile->path());
- m_config->setActualPositionUsed(options_page->useActualLocation->isChecked());
m_config->setLatitude(options_page->latitude->text().toDouble());
m_config->setLongitude(options_page->longitude->text().toDouble());
m_config->setAltitude(options_page->altitude->text().toDouble());
m_config->setCacheOnly(options_page->useOnlyCache->isChecked());
- m_config->setSpeedFactor(options_page->speedUnitCombo->itemData(options_page->speedUnitCombo->currentIndex()).toDouble());
- m_config->setAltitudeFactor(options_page->altUnitCombo->itemData(options_page->altUnitCombo->currentIndex()).toDouble());
+ if (options_page->useLocalTime->isChecked()) {
+ m_config->setTimeMode(TimeMode::Local);
+ } else {
+ m_config->setTimeMode(TimeMode::Predefined);
+ }
+ QDateTime dateTime(options_page->dateEdit->date(), options_page->timeEdit->time());
+ m_config->setDateTime(dateTime);
+ m_config->setMinAmbientLight(options_page->minAmbientLightSpinBox->value());
+
+#else // ifdef USE_OSG
+ m_config->setTerrainEnabled(false);
+#endif // ifdef USE_OSG
+
+#ifdef USE_OSG
+ m_config->setModelEnabled(options_page->showModel->isChecked());
+ m_config->setModelFile(options_page->modelFile->path());
+
+ if (options_page->useAutomaticModel->isChecked()) {
+ m_config->setModelSelectionMode(ModelSelectionMode::Auto);
+ } else {
+ m_config->setModelSelectionMode(ModelSelectionMode::Predefined);
+ }
+ m_config->setBackgroundImageFile(options_page->backgroundImageFile->path());
+#else
+ m_config->setModelEnabled(false);
+#endif
}
void PfdQmlGadgetOptionsPage::finish()
{}
+
+void PfdQmlGadgetOptionsPage::actualizeDateTime()
+{
+ QDateTime dateTime = QDateTime::currentDateTime();
+
+ options_page->dateEdit->setDate(dateTime.date());
+ options_page->timeEdit->setTime(dateTime.time());
+}
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetoptionspage.h b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetoptionspage.h
index a324c0709..f63ba8b45 100644
--- a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetoptionspage.h
+++ b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetoptionspage.h
@@ -1,4 +1,15 @@
-/*
+/**
+ ******************************************************************************
+ *
+ * @file pfdqmlgadgetoptionspage.h
+ * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
+ * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup
+ * @{
+ * @addtogroup
+ * @{
+ * @brief
+ *****************************************************************************//*
* 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
@@ -43,6 +54,9 @@ public:
void apply();
void finish();
+private slots:
+ void actualizeDateTime();
+
private:
Ui::PfdQmlGadgetOptionsPage *options_page;
PfdQmlGadgetConfiguration *m_config;
@@ -50,4 +64,4 @@ private:
private slots:
};
-#endif // PfdQmlGADGETOPTIONSPAGE_H
+#endif // PFDQMLGADGETOPTIONSPAGE_H
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetoptionspage.ui b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetoptionspage.ui
index bb136c6e1..576752a96 100644
--- a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetoptionspage.ui
+++ b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetoptionspage.ui
@@ -20,7 +20,16 @@
Form
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
0
-
@@ -44,7 +53,16 @@
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
0
-
@@ -56,7 +74,7 @@
QLayout::SetMaximumSize
- 10
+ 0
-
@@ -78,33 +96,23 @@
-
-
-
- Use OpenGL
-
-
- true
-
-
-
- -
-
+
-
-
-
- Speed Unit:
-
-
-
- -
Altitude Unit:
+ -
+
+
+ Speed Unit:
+
+
+
-
-
+
150
@@ -114,7 +122,7 @@
-
-
+
150
@@ -126,154 +134,385 @@
-
-
-
- Show Terrain:
+
+
+ 0
-
- true
-
-
-
-
-
-
- 10
-
-
- QLayout::SetMaximumSize
-
-
- 10
-
-
-
-
-
- OsgEarth file:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
- -
-
-
- Use actual location
-
-
-
- -
-
-
- Use pre-defined location:
-
-
- true
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 16
- 16
-
-
-
-
- -
-
-
-
-
-
- Latitude:
-
-
-
- -
-
-
- -
-
-
- Longitude:
-
-
-
- -
-
-
- -
-
-
- Altitude:
-
-
-
- -
-
-
-
-
- -
-
-
- Use only cache data
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 74
- 24
-
-
-
-
- -
-
-
- Pre seed terrain cache
-
-
-
-
+
+
+ Terrain
+
+
+ -
+
+
+ Show Terrain
+
+
+ true
+
+
+
-
+
+
+ 0
+
+
+ QLayout::SetMaximumSize
+
+
+ 0
+
+
-
+
+
+ Terrain file:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+ -
+
+
+ This location will be used if no GPS fix or Home location are available
+
+
+
+
+
+ Default Location
+
+
+
-
+
+
+ 6
+
+
+ 0
+
+
-
+
+
+ Latitude:
+
+
+
+ -
+
+
+ -
+
+
+ Longitude:
+
+
+
+ -
+
+
+ -
+
+
+ Altitude:
+
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+ false
+
+
+ Use only cache data
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 74
+ 24
+
+
+
+
+ -
+
+
+ false
+
+
+ Pre seed terrain cache
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 121
+
+
+
+
+
+
+
+
+ Model
+
+
+ -
+
+
+ Show Model
+
+
+ true
+
+
+
-
+
+
+ false
+
+
+ Use automatic model selection
+
+
+
+ -
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ false
+
+
+ Use this model:
+
+
+
+ -
+
+
+ 6
+
+
+ 0
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Background image:
+
+
+
+ -
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+ Environment
+
+
+ -
+
+
+ Time
+
+
+
-
+
+
+ Use local time
+
+
+
+ -
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ Use this time:
+
+
+
+ -
+
+
+ true
+
+
+
+ -
+
+
+ -
+
+
+ Actualize
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Minimum ambient light:
+
+
+
+ -
+
+
+ 1.000000000000000
+
+
+ 0.010000000000000
+
+
+ 0.030000000000000
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 121
-
-
-
-
@@ -284,75 +523,10 @@
Utils::PathChooser
QWidget
-
+
1
-
-
- usePredefinedLocation
- toggled(bool)
- latitude
- setEnabled(bool)
-
-
- 167
- 188
-
-
- 260
- 222
-
-
-
-
- usePredefinedLocation
- toggled(bool)
- longitude
- setEnabled(bool)
-
-
- 181
- 188
-
-
- 282
- 255
-
-
-
-
- usePredefinedLocation
- toggled(bool)
- altitude
- setEnabled(bool)
-
-
- 207
- 188
-
-
- 308
- 288
-
-
-
-
- useOpenGL
- toggled(bool)
- showTerrain
- setEnabled(bool)
-
-
- 99
- 57
-
-
- 99
- 89
-
-
-
-
+
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp
index 1539e9848..6df36daae 100644
--- a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp
+++ b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp
@@ -1,4 +1,15 @@
-/*
+/**
+ ******************************************************************************
+ *
+ * @file pfdqmlgadgetwidget.cpp
+ * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
+ * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup
+ * @{
+ * @addtogroup
+ * @{
+ * @brief
+ *****************************************************************************//*
* 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
@@ -15,227 +26,101 @@
*/
#include "pfdqmlgadgetwidget.h"
-#include "extensionsystem/pluginmanager.h"
-#include "uavobjectmanager.h"
-#include "uavobject.h"
-#include "flightbatterysettings.h"
-#include "utils/svgimageprovider.h"
-#include "utils/stringutils.h"
-#ifdef USE_OSG
-#include "osgearth.h"
-#endif
-#include
-#include
-#include
-#include
-#include
+#include "pfdqmlcontext.h"
+#include "utils/quickwidgetproxy.h"
+#include "utils/svgimageprovider.h"
+
+#include
+#include
#include
#include
+#include
-PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWindow *parent) :
- QQuickView(parent),
- m_openGLEnabled(false),
- m_terrainEnabled(false),
- m_actualPositionUsed(false),
- m_latitude(46.671478),
- m_longitude(10.158932),
- m_altitude(2000),
- m_speedUnit("m/s"),
- m_speedFactor(1.0),
- m_altitudeUnit("m"),
- m_altitudeFactor(1.0)
+PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWidget *parent) :
+ QWidget(parent), m_quickWidgetProxy(NULL), m_pfdQmlContext(NULL), m_qmlFileName()
{
- setResizeMode(SizeRootObjectToView);
-
- // setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
-
- QStringList objectsToExport;
- objectsToExport <<
- "VelocityState" <<
- "PositionState" <<
- "AttitudeState" <<
- "AccelState" <<
- "VelocityDesired" <<
- "PathDesired" <<
- "GPSPositionSensor" <<
- "GPSSatellites" <<
- "GCSTelemetryStats" <<
- "SystemAlarms" <<
- "NedAccel" <<
- "FlightBatteryState" <<
- "ActuatorDesired" <<
- "TakeOffLocation" <<
- "PathPlan" <<
- "WaypointActive" <<
- "OPLinkStatus" <<
- "FlightStatus" <<
- "SystemStats" <<
- "StabilizationDesired" <<
- "VtolPathFollowerSettings" <<
- "HwSettings" <<
- "ManualControlCommand" <<
- "SystemSettings" <<
- "RevoSettings" <<
- "MagState" <<
- "FlightBatterySettings" <<
- "ReceiverStatus";
-
- ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
- UAVObjectManager *objManager = pm->getObject();
- m_uavoManager = pm->getObject();
- Q_ASSERT(m_uavoManager);
-
- foreach(const QString &objectName, objectsToExport) {
- UAVObject *object = objManager->getObject(objectName);
-
- if (object) {
- // expose object with lower camel case name
- engine()->rootContext()->setContextProperty(Utils::toLowerCamelCase(objectName), object);
- } else {
- qWarning() << "Failed to load object" << objectName;
- }
- }
-
- // to expose settings values
- engine()->rootContext()->setContextProperty("qmlWidget", this);
-#ifdef USE_OSG
- // should not be done here (PFD should not be directly dependent of osg)
- qmlRegisterType("org.OpenPilot", 1, 0, "OsgEarth");
-#endif
+ setLayout(new QStackedLayout());
}
PfdQmlGadgetWidget::~PfdQmlGadgetWidget()
-{}
+{
+ if (m_pfdQmlContext) {
+ delete m_pfdQmlContext;
+ }
+}
+
+void PfdQmlGadgetWidget::setSource(const QUrl &url)
+{
+ m_quickWidgetProxy->setSource(url);
+}
+
+QQmlEngine *PfdQmlGadgetWidget::engine() const
+{
+ return m_quickWidgetProxy->engine();
+}
+
+QList PfdQmlGadgetWidget::errors() const
+{
+ return m_quickWidgetProxy->errors();
+}
+
+void PfdQmlGadgetWidget::loadConfiguration(PfdQmlGadgetConfiguration *config)
+{
+ qDebug() << "PfdQmlGadgetWidget::loadConfiguration" << config->name();
+
+ if (!m_quickWidgetProxy) {
+ m_quickWidgetProxy = new QuickWidgetProxy(this);
+
+#if 0
+ qDebug() << "PfdQmlGadgetWidget::PfdQmlGadgetWidget - persistent OpenGL context" << isPersistentOpenGLContext();
+ qDebug() << "PfdQmlGadgetWidget::PfdQmlGadgetWidget - persistent scene graph" << isPersistentSceneGraph();
+#endif
+
+ // expose context
+ m_pfdQmlContext = new PfdQmlContext(this);
+ m_pfdQmlContext->apply(engine()->rootContext());
+
+ // add widget
+ layout()->addWidget(m_quickWidgetProxy->widget());
+ }
+
+ setQmlFile("");
+
+ m_pfdQmlContext->loadConfiguration(config);
+
+ // go!
+ setQmlFile(config->qmlFile());
+}
void PfdQmlGadgetWidget::setQmlFile(QString fn)
{
+ qDebug() << "PfdQmlGadgetWidget::setQmlFile" << fn;
+
m_qmlFileName = fn;
- engine()->removeImageProvider("svg");
- SvgImageProvider *svgProvider = new SvgImageProvider(fn);
- engine()->addImageProvider("svg", svgProvider);
+ if (fn.isEmpty()) {
+ setSource(QUrl());
- engine()->clearComponentCache();
+ engine()->removeImageProvider("svg");
+ engine()->rootContext()->setContextProperty("svgRenderer", NULL);
- // it's necessary to allow qml side to query svg element position
- engine()->rootContext()->setContextProperty("svgRenderer", svgProvider);
- engine()->setBaseUrl(QUrl::fromLocalFile(fn));
+ // calling clearComponentCache() causes crashes (see https://bugreports.qt-project.org/browse/QTBUG-41465)
+ // but not doing it causes almost systematic crashes when switching PFD gadget to "Model View (Without Terrain)" configuration
+ engine()->clearComponentCache();
+ } else {
+ SvgImageProvider *svgProvider = new SvgImageProvider(fn);
+ engine()->addImageProvider("svg", svgProvider);
- qDebug() << Q_FUNC_INFO << fn;
- setSource(QUrl::fromLocalFile(fn));
+ // it's necessary to allow qml side to query svg element position
+ engine()->rootContext()->setContextProperty("svgRenderer", svgProvider);
+
+ QUrl url = QUrl::fromLocalFile(fn);
+ engine()->setBaseUrl(url);
+ setSource(url);
+ }
foreach(const QQmlError &error, errors()) {
- qDebug() << error.description();
- }
-}
-
-void PfdQmlGadgetWidget::resetConsumedEnergy()
-{
- FlightBatterySettings *mBatterySettings = FlightBatterySettings::GetInstance(m_uavoManager);
-
- mBatterySettings->setResetConsumedEnergy(true);
- mBatterySettings->setData(mBatterySettings->getData());
-}
-
-void PfdQmlGadgetWidget::setEarthFile(QString arg)
-{
- if (m_earthFile != arg) {
- m_earthFile = arg;
- emit earthFileChanged(arg);
- }
-}
-
-void PfdQmlGadgetWidget::setTerrainEnabled(bool arg)
-{
- bool wasEnabled = terrainEnabled();
-
- m_terrainEnabled = arg;
-
- if (wasEnabled != terrainEnabled()) {
- emit terrainEnabledChanged(terrainEnabled());
- }
-}
-
-void PfdQmlGadgetWidget::setSpeedUnit(QString unit)
-{
- if (m_speedUnit != unit) {
- m_speedUnit = unit;
- emit speedUnitChanged(unit);
- }
-}
-
-void PfdQmlGadgetWidget::setSpeedFactor(double factor)
-{
- if (m_speedFactor != factor) {
- m_speedFactor = factor;
- emit speedFactorChanged(factor);
- }
-}
-
-void PfdQmlGadgetWidget::setAltitudeUnit(QString unit)
-{
- if (m_altitudeUnit != unit) {
- m_altitudeUnit = unit;
- emit altitudeUnitChanged(unit);
- }
-}
-
-void PfdQmlGadgetWidget::setAltitudeFactor(double factor)
-{
- if (m_altitudeFactor != factor) {
- m_altitudeFactor = factor;
- emit altitudeFactorChanged(factor);
- }
-}
-
-void PfdQmlGadgetWidget::setOpenGLEnabled(bool arg)
-{
- Q_UNUSED(arg);
- setTerrainEnabled(m_terrainEnabled);
-}
-
-// Switch between PositionState UAVObject position
-// and pre-defined latitude/longitude/altitude properties
-void PfdQmlGadgetWidget::setActualPositionUsed(bool arg)
-{
- if (m_actualPositionUsed != arg) {
- m_actualPositionUsed = arg;
- emit actualPositionUsedChanged(arg);
- }
-}
-
-void PfdQmlGadgetWidget::mouseReleaseEvent(QMouseEvent *event)
-{
- // Reload the schene on the middle mouse button click.
- if (event->button() == Qt::MiddleButton) {
- setQmlFile(m_qmlFileName);
- }
-
- QQuickView::mouseReleaseEvent(event);
-}
-
-void PfdQmlGadgetWidget::setLatitude(double arg)
-{
- // not sure qFuzzyCompare is accurate enough for geo coordinates
- if (m_latitude != arg) {
- m_latitude = arg;
- emit latitudeChanged(arg);
- }
-}
-
-void PfdQmlGadgetWidget::setLongitude(double arg)
-{
- if (m_longitude != arg) {
- m_longitude = arg;
- emit longitudeChanged(arg);
- }
-}
-
-void PfdQmlGadgetWidget::setAltitude(double arg)
-{
- if (!qFuzzyCompare(m_altitude, arg)) {
- m_altitude = arg;
- emit altitudeChanged(arg);
+ qDebug() << "PfdQmlGadgetWidget - " << error.description();
}
}
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetwidget.h b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetwidget.h
index b971942e0..162e17815 100644
--- a/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetwidget.h
+++ b/ground/gcs/src/plugins/pfdqml/pfdqmlgadgetwidget.h
@@ -1,4 +1,15 @@
-/*
+/**
+ ******************************************************************************
+ *
+ * @file pfdqmlgadgetwidget.h
+ * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
+ * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup
+ * @{
+ * @addtogroup
+ * @{
+ * @brief
+ *****************************************************************************//*
* 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
@@ -17,126 +28,35 @@
#ifndef PFDQMLGADGETWIDGET_H_
#define PFDQMLGADGETWIDGET_H_
+#include "pfdqml.h"
#include "pfdqmlgadgetconfiguration.h"
-#include "uavobjectmanager.h"
-#include
-class PfdQmlGadgetWidget : public QQuickView {
- Q_OBJECT Q_PROPERTY(QString earthFile READ earthFile WRITE setEarthFile NOTIFY earthFileChanged)
- Q_PROPERTY(bool terrainEnabled READ terrainEnabled WRITE setTerrainEnabled NOTIFY terrainEnabledChanged)
+#include
- Q_PROPERTY(bool actualPositionUsed READ actualPositionUsed WRITE setActualPositionUsed NOTIFY actualPositionUsedChanged)
+class QQmlEngine;
+class QuickWidgetProxy;
+class PfdQmlContext;
- Q_PROPERTY(QString speedUnit READ speedUnit WRITE setSpeedUnit NOTIFY speedUnitChanged)
- Q_PROPERTY(double speedFactor READ speedFactor WRITE setSpeedFactor NOTIFY speedFactorChanged)
- Q_PROPERTY(QString altitudeUnit READ altitudeUnit WRITE setAltitudeUnit NOTIFY altitudeUnitChanged)
- Q_PROPERTY(double altitudeFactor READ altitudeFactor WRITE setAltitudeFactor NOTIFY altitudeFactorChanged)
-
- // pre-defined fallback position
- Q_PROPERTY(double latitude READ latitude WRITE setLatitude NOTIFY latitudeChanged)
- Q_PROPERTY(double longitude READ longitude WRITE setLongitude NOTIFY longitudeChanged)
- Q_PROPERTY(double altitude READ altitude WRITE setAltitude NOTIFY altitudeChanged)
+class PfdQmlGadgetWidget : public QWidget {
+ Q_OBJECT
public:
- PfdQmlGadgetWidget(QWindow *parent = 0);
- ~PfdQmlGadgetWidget();
- void setQmlFile(QString fn);
+ PfdQmlGadgetWidget(QWidget *parent = 0);
+ virtual ~PfdQmlGadgetWidget();
- QString earthFile() const
- {
- return m_earthFile;
- }
- bool terrainEnabled() const
- {
- return m_terrainEnabled && m_openGLEnabled;
- }
-
- QString speedUnit() const
- {
- return m_speedUnit;
- }
- double speedFactor() const
- {
- return m_speedFactor;
- }
- QString altitudeUnit() const
- {
- return m_altitudeUnit;
- }
- double altitudeFactor() const
- {
- return m_altitudeFactor;
- }
-
- bool actualPositionUsed() const
- {
- return m_actualPositionUsed;
- }
- double latitude() const
- {
- return m_latitude;
- }
- double longitude() const
- {
- return m_longitude;
- }
- double altitude() const
- {
- return m_altitude;
- }
-
- Q_INVOKABLE void resetConsumedEnergy();
-
-public slots:
- void setEarthFile(QString arg);
- void setTerrainEnabled(bool arg);
-
- void setSpeedUnit(QString unit);
- void setSpeedFactor(double factor);
- void setAltitudeUnit(QString unit);
- void setAltitudeFactor(double factor);
-
- void setOpenGLEnabled(bool arg);
-
- void setLatitude(double arg);
- void setLongitude(double arg);
- void setAltitude(double arg);
-
- void setActualPositionUsed(bool arg);
-
-signals:
- void earthFileChanged(QString arg);
- void terrainEnabledChanged(bool arg);
-
- void actualPositionUsedChanged(bool arg);
- void latitudeChanged(double arg);
- void longitudeChanged(double arg);
- void altitudeChanged(double arg);
-
- void speedUnitChanged(QString arg);
- void speedFactorChanged(double arg);
- void altitudeUnitChanged(QString arg);
- void altitudeFactorChanged(double arg);
-
-protected:
- void mouseReleaseEvent(QMouseEvent *event);
+ void loadConfiguration(PfdQmlGadgetConfiguration *config);
private:
- UAVObjectManager *m_uavoManager;
+ void setQmlFile(QString);
+
+ void setSource(const QUrl &url);
+ QQmlEngine *engine() const;
+ QList errors() const;
+
+ QuickWidgetProxy *m_quickWidgetProxy;
+
+ PfdQmlContext *m_pfdQmlContext;
QString m_qmlFileName;
- QString m_earthFile;
- bool m_openGLEnabled;
- bool m_terrainEnabled;
-
- bool m_actualPositionUsed;
- double m_latitude;
- double m_longitude;
- double m_altitude;
-
- QString m_speedUnit;
- double m_speedFactor;
- QString m_altitudeUnit;
- double m_altitudeFactor;
};
#endif /* PFDQMLGADGETWIDGET_H_ */
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqmlplugin.cpp b/ground/gcs/src/plugins/pfdqml/pfdqmlplugin.cpp
index 4c5e84c39..8530ca1c7 100644
--- a/ground/gcs/src/plugins/pfdqml/pfdqmlplugin.cpp
+++ b/ground/gcs/src/plugins/pfdqml/pfdqmlplugin.cpp
@@ -1,4 +1,15 @@
-/*
+/**
+ ******************************************************************************
+ *
+ * @file pfdqmlplugin.cpp
+ * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
+ * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup
+ * @{
+ * @addtogroup
+ * @{
+ * @brief
+ *****************************************************************************//*
* 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
@@ -14,13 +25,17 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "pfdqml.h"
#include "pfdqmlplugin.h"
#include "pfdqmlgadgetfactory.h"
-#include
-#include
-#include
#include
+#ifdef USE_OSG
+#include
+#endif
+
+#include
+#include
PfdQmlPlugin::PfdQmlPlugin()
{
@@ -36,7 +51,18 @@ bool PfdQmlPlugin::initialize(const QStringList & args, QString *errMsg)
{
Q_UNUSED(args);
Q_UNUSED(errMsg);
- mf = new PfdQmlGadgetFactory(this);
+
+#ifdef USE_OSG
+ // TODO get rid of this call...
+ // this is the only place that references osgearth
+ // if this code goes away then the dependency to osgearth should be removed from pfdqml_dependencies.pri
+ OsgEarth::registerQmlTypes();
+#endif
+
+ ModelSelectionMode::registerQMLTypes();
+ TimeMode::registerQMLTypes();
+
+ PfdQmlGadgetFactory *mf = new PfdQmlGadgetFactory(this);
addAutoReleasedObject(mf);
return true;
diff --git a/ground/gcs/src/plugins/pfdqml/pfdqmlplugin.h b/ground/gcs/src/plugins/pfdqml/pfdqmlplugin.h
index 0f137feaf..52dd7c9c0 100644
--- a/ground/gcs/src/plugins/pfdqml/pfdqmlplugin.h
+++ b/ground/gcs/src/plugins/pfdqml/pfdqmlplugin.h
@@ -1,4 +1,15 @@
-/*
+/**
+ ******************************************************************************
+ *
+ * @file pfdqmlplugin.h
+ * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
+ * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup
+ * @{
+ * @addtogroup
+ * @{
+ * @brief
+ *****************************************************************************//*
* 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
@@ -32,8 +43,6 @@ public:
void extensionsInitialized();
bool initialize(const QStringList &arguments, QString *errorString);
void shutdown();
-private:
- PfdQmlGadgetFactory *mf;
};
#endif /* PFDQMLPLUGIN_H_ */
diff --git a/ground/gcs/src/plugins/plugins.pro b/ground/gcs/src/plugins/plugins.pro
index 07a7fc71f..8c8c380e3 100644
--- a/ground/gcs/src/plugins/plugins.pro
+++ b/ground/gcs/src/plugins/plugins.pro
@@ -134,10 +134,10 @@ plugin_gpsdisplay.depends += plugin_uavobjects
SUBDIRS += plugin_gpsdisplay
# QML viewer gadget
-plugin_qmlview.subdir = qmlview
-plugin_qmlview.depends = plugin_coreplugin
-plugin_qmlview.depends += plugin_uavobjects
-SUBDIRS += plugin_qmlview
+#plugin_qmlview.subdir = qmlview
+#plugin_qmlview.depends = plugin_coreplugin
+#plugin_qmlview.depends += plugin_uavobjects
+#SUBDIRS += plugin_qmlview
# PathAction Editor gadget
plugin_pathactioneditor.subdir = pathactioneditor
diff --git a/ground/gcs/src/plugins/qmlview/qmlviewgadgetwidget.cpp b/ground/gcs/src/plugins/qmlview/qmlviewgadgetwidget.cpp
index 808cf3e80..813061aa2 100644
--- a/ground/gcs/src/plugins/qmlview/qmlviewgadgetwidget.cpp
+++ b/ground/gcs/src/plugins/qmlview/qmlviewgadgetwidget.cpp
@@ -34,7 +34,6 @@
#include
#include
-#include
#include
#include
diff --git a/ground/gcs/src/plugins/telemetry/monitorwidget.cpp b/ground/gcs/src/plugins/telemetry/monitorwidget.cpp
index 3f9dcfb20..405f326c9 100644
--- a/ground/gcs/src/plugins/telemetry/monitorwidget.cpp
+++ b/ground/gcs/src/plugins/telemetry/monitorwidget.cpp
@@ -198,18 +198,6 @@ MonitorWidget::~MonitorWidget()
}
}
-/*!
- \brief Enables/Disables OpenGL
- */
-// void LineardialGadgetWidget::enableOpenGL(bool flag)
-// {
-// if (flag) {
-// setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
-// } else {
-// setViewport(new QWidget);
-// }
-// }
-
void MonitorWidget::telemetryConnected()
{
qDebug() << "telemetry connected";
diff --git a/ground/gcs/src/plugins/welcome/welcome.pro b/ground/gcs/src/plugins/welcome/welcome.pro
index 558c1114c..a325536c9 100644
--- a/ground/gcs/src/plugins/welcome/welcome.pro
+++ b/ground/gcs/src/plugins/welcome/welcome.pro
@@ -1,14 +1,18 @@
TEMPLATE = lib
TARGET = Welcome
-QT += network qml quick
+
+QT += network qml quick quickwidgets
include(../../plugin.pri)
include(welcome_dependencies.pri)
-HEADERS += welcomeplugin.h \
+HEADERS += \
+ welcomeplugin.h \
welcomemode.h \
welcome_global.h
-SOURCES += welcomeplugin.cpp \
+
+SOURCES += \
+ welcomeplugin.cpp \
welcomemode.cpp \
RESOURCES += welcome.qrc
diff --git a/ground/gcs/src/plugins/welcome/welcomemode.cpp b/ground/gcs/src/plugins/welcome/welcomemode.cpp
index 83309772c..551074570 100644
--- a/ground/gcs/src/plugins/welcome/welcomemode.cpp
+++ b/ground/gcs/src/plugins/welcome/welcomemode.cpp
@@ -38,6 +38,7 @@
#include
#include
#include
+#include
#include
@@ -49,7 +50,7 @@
#include
#include
-#include
+#include
#include
#include
@@ -59,27 +60,11 @@ using namespace ExtensionSystem;
using namespace Utils;
namespace Welcome {
-struct WelcomeModePrivate {
- WelcomeModePrivate();
-
- QQuickView *quickView;
-};
-
-WelcomeModePrivate::WelcomeModePrivate()
-{}
-
-// --- WelcomeMode
WelcomeMode::WelcomeMode() :
- m_d(new WelcomeModePrivate),
+ m_quickWidgetProxy(NULL),
m_priority(Core::Constants::P_MODE_WELCOME),
m_newVersionText("")
{
- m_d->quickView = new QQuickView;
- m_d->quickView->setResizeMode(QQuickView::SizeRootObjectToView);
- m_d->quickView->engine()->rootContext()->setContextProperty("welcomePlugin", this);
- m_d->quickView->setSource(QUrl("qrc:/welcome/qml/main.qml"));
- m_container = NULL;
-
QNetworkAccessManager *networkAccessManager = new QNetworkAccessManager;
// Only attempt to request our version info if the network is accessible
@@ -97,10 +82,7 @@ WelcomeMode::WelcomeMode() :
}
WelcomeMode::~WelcomeMode()
-{
- delete m_d->quickView;
- delete m_d;
-}
+{}
QString WelcomeMode::name() const
{
@@ -119,12 +101,13 @@ int WelcomeMode::priority() const
QWidget *WelcomeMode::widget()
{
- if (!m_container) {
- m_container = QWidget::createWindowContainer(m_d->quickView);
- m_container->setMinimumSize(64, 64);
- m_container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+ if (!m_quickWidgetProxy) {
+ m_quickWidgetProxy = new QuickWidgetProxy();
+ // qWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
+ m_quickWidgetProxy->engine()->rootContext()->setContextProperty("welcomePlugin", this);
+ m_quickWidgetProxy->setSource(QUrl("qrc:/welcome/qml/main.qml"));
}
- return m_container;
+ return m_quickWidgetProxy->widget();
}
const char *WelcomeMode::uniqueModeName() const
diff --git a/ground/gcs/src/plugins/welcome/welcomemode.h b/ground/gcs/src/plugins/welcome/welcomemode.h
index 62272d70c..5bef4a07f 100644
--- a/ground/gcs/src/plugins/welcome/welcomemode.h
+++ b/ground/gcs/src/plugins/welcome/welcomemode.h
@@ -34,16 +34,14 @@
#include
-
QT_BEGIN_NAMESPACE
+class QuickWidgetProxy;
class QWidget;
class QUrl;
class QNetworkReply;
QT_END_NAMESPACE
namespace Welcome {
-struct WelcomeModePrivate;
-
class WELCOME_EXPORT WelcomeMode : public Core::IMode {
Q_OBJECT Q_PROPERTY(QString versionString READ versionString CONSTANT)
Q_PROPERTY(QString newVersionText READ newVersionText NOTIFY newVersionTextChanged)
@@ -86,8 +84,7 @@ public slots:
void triggerAction(const QString &actionId);
private:
- QWidget *m_container;
- WelcomeModePrivate *m_d;
+ QuickWidgetProxy *m_quickWidgetProxy;
int m_priority;
QString m_newVersionText;
diff --git a/ground/gcs/src/share/configurations/default.xml b/ground/gcs/src/share/configurations/default.xml
index 3f5c2a059..dbb5b7c66 100644
--- a/ground/gcs/src/share/configurations/default.xml
+++ b/ground/gcs/src/share/configurations/default.xml
@@ -1542,272 +1542,6 @@
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/multi/aeroquad/aeroquad_+.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/boards/CopterControl/CopterControl.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/boards/CC3D/CC3D.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/boards/Revolution/revolution.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/multi/blackout/BlackoutMiniHQuad.3DS
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/planes/zagi/zagi.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/multi/easy_quad/easy_quad_X.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/planes/Easystar/easystar.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/planes/firecracker/firecracker.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/planes/funjet/funjet.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/multi/gaui_330x/gaui_330x.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/helis/t-rex/t-rex_450_xl.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/multi/mikrokopter/MK_Hexa.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/multi/joes_cnc/J14-Q_+.3DS
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/multi/joes_cnc/J14-Q_X.3DS
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/multi/joes_cnc/J14-QT_+.3DS
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/multi/joes_cnc/J14-QT_X.3DS
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/multi/mikrokopter/MK_L4-ME.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/multi/ricoo/ricoo.3DS
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/multi/scorpion_tricopter/scorpion_tricopter.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/multi/mattL_Y6/mattL_Y6.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/multi/test_quad/test_quad_+.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/multi/test_quad/test_quad_X.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
-
- false
- 0.0.0
-
-
- %%DATAPATH%%models/multi/dankers_quad/dankers_quad.3ds
- %%DATAPATH%%backgrounds/default_background.png
- false
-
-
-
@@ -1871,55 +1605,175 @@
-
+
false
0.0.0
- false
- 2000
+ %%DATAPATH%%qml/Pfd.qml
1
- false
- %%DATAPATH%%pfd/default/readymap.earth
- 46.6715
- 10.1589
- true
- %%DATAPATH%%pfd/default/Pfd.qml
1
false
-
-
-
-
- false
- 0.0.0
-
-
- false
- 2000
+ %%DATAPATH%%osgearth/readymap.earth
false
- %%DATAPATH%%pfd/default/readymap.earth
- 46.6715
- 10.1589
- true
- %%DATAPATH%%pfd/default/Pfd.qml
- false
+ 39.6576
+ 19.8046
+ 90
+ 0
+ @Variant(AAAAEAAlfhEClAez/w==)
+ 0.50
+ false
+ 1
+ %%DATAPATH%%models/multi/test_quad/test_quad_x.3ds
+ %%DATAPATH%%backgrounds/default_background.png
-
-
-
-
+
+
false
0.0.0
- Unknown
- true
+ %%DATAPATH%%qml/Pfd.qml
+ 1
+ 1
+ true
+ %%DATAPATH%%osgearth/readymap.earth
+ false
+ 39.6576
+ 19.8046
+ 90
+ 0
+ @Variant(AAAAEAAlfhEClAez/w==)
+ 0.50
+ false
+ 1
+ %%DATAPATH%%models/multi/test_quad/test_quad_x.3ds
+ %%DATAPATH%%backgrounds/default_background.png
-
-
+
+
+
+ false
+ 0.0.0
+
+
+ %%DATAPATH%%qml/Pfd.qml
+ 1
+ 1
+ true
+ %%DATAPATH%%osgearth/arcgis.earth
+ false
+ 39.6576
+ 19.8046
+ 90
+ 0
+ @Variant(AAAAEAAlfhEClAez/w==)
+ 0.50
+ false
+ 1
+ %%DATAPATH%%models/multi/test_quad/test_quad_x.3ds
+ %%DATAPATH%%backgrounds/default_background.png
+
+
+
+
+ false
+ 0.0.0
+
+
+ %%DATAPATH%%qml/ModelView.qml
+ 1
+ 1
+ false
+ %%DATAPATH%%osgearth/arcgis.earth
+ false
+ 39.6576
+ 19.8046
+ 90
+ 0
+ @Variant(AAAAEAAlfhEClAez/w==)
+ 0.50
+ true
+ 1
+ %%DATAPATH%%models/multi/test_quad/test_quad_x.3ds
+ %%DATAPATH%%backgrounds/default_background.png
+
+
+
+
+ false
+ 0.0.0
+
+
+ %%DATAPATH%%qml/ModelView.qml
+ 1
+ 1
+ true
+ %%DATAPATH%%osgearth/readymap.earth
+ false
+ 39.6576
+ 19.8046
+ 90
+ 0
+ @Variant(AAAAEAAlfhEClAez/w==)
+ 0.50
+ true
+ 1
+ %%DATAPATH%%models/multi/test_quad/test_quad_x.3ds
+ %%DATAPATH%%backgrounds/default_background.png
+
+
+
+
+ false
+ 0.0.0
+
+
+ %%DATAPATH%%qml/ModelView.qml
+ 1
+ 1
+ true
+ %%DATAPATH%%osgearth/arcgis.earth
+ false
+ 39.6576
+ 19.8046
+ 90
+ 0
+ @Variant(AAAAEAAlfhEClAez/w==)
+ 0.50
+ true
+ 1
+ %%DATAPATH%%models/multi/test_quad/test_quad_x.3ds
+ %%DATAPATH%%backgrounds/default_background.png
+
+
+
+
+ false
+ 0.0.0
+
+
+ %%DATAPATH%%qml/EarthView.qml
+ 1
+ 1
+ true
+ %%DATAPATH%%osgearth/arcgis.earth
+ false
+ 39.6576
+ 19.8046
+ 90
+ 0
+ @Variant(AAAAEAAlfhEClAez/w==)
+ 0.50
+ false
+ 1
+ %%DATAPATH%%models/multi/test_quad/test_quad_x.3ds
+ %%DATAPATH%%backgrounds/default_background.png
+
+
+
@@ -2569,16 +2423,16 @@
PfdQmlGadget
- NoTerrain
+ PFD
uavGadget
- ModelViewGadget
+ PfdQmlGadget
- Blackout_MiniH
-
+ Model View
+
uavGadget
@@ -2714,7 +2568,7 @@
PfdQmlGadget
- NoTerrain
+ PFD
uavGadget
diff --git a/ground/gcs/src/share/copydata.pro b/ground/gcs/src/share/copydata.pro
index 3787f3449..ee8f36672 100644
--- a/ground/gcs/src/share/copydata.pro
+++ b/ground/gcs/src/share/copydata.pro
@@ -2,7 +2,7 @@ include(../../gcs.pri)
TEMPLATE = aux
-DATACOLLECTIONS = vehicletemplates configurations dials models backgrounds pfd sounds diagrams mapicons stylesheets
+DATACOLLECTIONS = vehicletemplates configurations dials models backgrounds qml sounds diagrams mapicons stylesheets osgearth
equals(copydata, 1) {
for(dir, DATACOLLECTIONS) {
diff --git a/ground/gcs/src/share/models/boards/CC3D/CC3D.3ds b/ground/gcs/src/share/models/boards/cc3d/cc3d.3ds
similarity index 60%
rename from ground/gcs/src/share/models/boards/CC3D/CC3D.3ds
rename to ground/gcs/src/share/models/boards/cc3d/cc3d.3ds
index 615698212..a7fd86895 100644
Binary files a/ground/gcs/src/share/models/boards/CC3D/CC3D.3ds and b/ground/gcs/src/share/models/boards/cc3d/cc3d.3ds differ
diff --git a/ground/gcs/src/share/models/boards/cc3d/cc3d.jpg b/ground/gcs/src/share/models/boards/cc3d/cc3d.jpg
new file mode 100644
index 000000000..b9389265b
Binary files /dev/null and b/ground/gcs/src/share/models/boards/cc3d/cc3d.jpg differ
diff --git a/ground/gcs/src/share/models/boards/CC3D/TEXTURE.PNG b/ground/gcs/src/share/models/boards/cc3d/texture-old.png
similarity index 100%
rename from ground/gcs/src/share/models/boards/CC3D/TEXTURE.PNG
rename to ground/gcs/src/share/models/boards/cc3d/texture-old.png
diff --git a/ground/gcs/src/share/models/boards/cc3d/texture.png b/ground/gcs/src/share/models/boards/cc3d/texture.png
new file mode 100644
index 000000000..168ddb9d0
Binary files /dev/null and b/ground/gcs/src/share/models/boards/cc3d/texture.png differ
diff --git a/ground/gcs/src/share/models/boards/CopterControl/CopterControl.3ds b/ground/gcs/src/share/models/boards/coptercontrol/coptercontrol.3ds
similarity index 56%
rename from ground/gcs/src/share/models/boards/CopterControl/CopterControl.3ds
rename to ground/gcs/src/share/models/boards/coptercontrol/coptercontrol.3ds
index c158dba99..54a7915f0 100644
Binary files a/ground/gcs/src/share/models/boards/CopterControl/CopterControl.3ds and b/ground/gcs/src/share/models/boards/coptercontrol/coptercontrol.3ds differ
diff --git a/ground/gcs/src/share/models/boards/CopterControl/TEXTURE.PNG b/ground/gcs/src/share/models/boards/coptercontrol/texture.png
similarity index 100%
rename from ground/gcs/src/share/models/boards/CopterControl/TEXTURE.PNG
rename to ground/gcs/src/share/models/boards/coptercontrol/texture.png
diff --git a/ground/gcs/src/share/models/boards/op_gps_v9/op_gps_v9.3ds b/ground/gcs/src/share/models/boards/op_gps_v9/op_gps_v9.3ds
new file mode 100755
index 000000000..6f31789ba
Binary files /dev/null and b/ground/gcs/src/share/models/boards/op_gps_v9/op_gps_v9.3ds differ
diff --git a/ground/gcs/src/share/models/boards/op_gps_v9/op_gps_v9.jpg b/ground/gcs/src/share/models/boards/op_gps_v9/op_gps_v9.jpg
new file mode 100644
index 000000000..b9cac9f44
Binary files /dev/null and b/ground/gcs/src/share/models/boards/op_gps_v9/op_gps_v9.jpg differ
diff --git a/ground/gcs/src/share/models/boards/op_gps_v9/texture.jpg b/ground/gcs/src/share/models/boards/op_gps_v9/texture.jpg
new file mode 100644
index 000000000..4665c5f06
Binary files /dev/null and b/ground/gcs/src/share/models/boards/op_gps_v9/texture.jpg differ
diff --git a/ground/gcs/src/share/models/boards/Revolution/Revolution.3DS b/ground/gcs/src/share/models/boards/revolution/revolution.3ds
old mode 100644
new mode 100755
similarity index 69%
rename from ground/gcs/src/share/models/boards/Revolution/Revolution.3DS
rename to ground/gcs/src/share/models/boards/revolution/revolution.3ds
index 58cfe8d6d..c290bdadf
Binary files a/ground/gcs/src/share/models/boards/Revolution/Revolution.3DS and b/ground/gcs/src/share/models/boards/revolution/revolution.3ds differ
diff --git a/ground/gcs/src/share/models/boards/revolution/revolution.jpg b/ground/gcs/src/share/models/boards/revolution/revolution.jpg
new file mode 100644
index 000000000..8d55053b0
Binary files /dev/null and b/ground/gcs/src/share/models/boards/revolution/revolution.jpg differ
diff --git a/ground/gcs/src/share/models/boards/Revolution/TEXTURE.PNG b/ground/gcs/src/share/models/boards/revolution/texture.png
similarity index 100%
rename from ground/gcs/src/share/models/boards/Revolution/TEXTURE.PNG
rename to ground/gcs/src/share/models/boards/revolution/texture.png
diff --git a/ground/gcs/src/share/models/helis/t-rex/t-rex_450_xl.3ds b/ground/gcs/src/share/models/helis/t-rex/t-rex_450_xl.3ds
index 87ed5e132..f366f5c38 100644
Binary files a/ground/gcs/src/share/models/helis/t-rex/t-rex_450_xl.3ds and b/ground/gcs/src/share/models/helis/t-rex/t-rex_450_xl.3ds differ
diff --git a/ground/gcs/src/share/models/helis/t-rex/TEXTURE.JPG b/ground/gcs/src/share/models/helis/t-rex/texture.jpg
similarity index 100%
rename from ground/gcs/src/share/models/helis/t-rex/TEXTURE.JPG
rename to ground/gcs/src/share/models/helis/t-rex/texture.jpg
diff --git a/ground/gcs/src/share/models/multi/aeroquad/aeroquad_+.3ds b/ground/gcs/src/share/models/multi/aeroquad/aeroquad_+.3ds
index f8c6b995a..a12921643 100644
Binary files a/ground/gcs/src/share/models/multi/aeroquad/aeroquad_+.3ds and b/ground/gcs/src/share/models/multi/aeroquad/aeroquad_+.3ds differ
diff --git a/ground/gcs/src/share/models/multi/aeroquad/TEXTURE.JPG b/ground/gcs/src/share/models/multi/aeroquad/texture.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/aeroquad/TEXTURE.JPG
rename to ground/gcs/src/share/models/multi/aeroquad/texture.jpg
diff --git a/ground/gcs/src/share/models/multi/blackout/BlackoutMiniHQuad.3DS b/ground/gcs/src/share/models/multi/blackout/blackout_mini_h_quad.3ds
similarity index 62%
rename from ground/gcs/src/share/models/multi/blackout/BlackoutMiniHQuad.3DS
rename to ground/gcs/src/share/models/multi/blackout/blackout_mini_h_quad.3ds
index 1217e54de..e7adcdb88 100644
Binary files a/ground/gcs/src/share/models/multi/blackout/BlackoutMiniHQuad.3DS and b/ground/gcs/src/share/models/multi/blackout/blackout_mini_h_quad.3ds differ
diff --git a/ground/gcs/src/share/models/multi/blackout/BlackoutMiniHQuad.jpg b/ground/gcs/src/share/models/multi/blackout/blackout_mini_h_quad.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/blackout/BlackoutMiniHQuad.jpg
rename to ground/gcs/src/share/models/multi/blackout/blackout_mini_h_quad.jpg
diff --git a/ground/gcs/src/share/models/multi/blackout/TEXTURE.PNG b/ground/gcs/src/share/models/multi/blackout/texture.png
similarity index 100%
rename from ground/gcs/src/share/models/multi/blackout/TEXTURE.PNG
rename to ground/gcs/src/share/models/multi/blackout/texture.png
diff --git a/ground/gcs/src/share/models/multi/dankers_quad/dankers_quad.3ds b/ground/gcs/src/share/models/multi/dankers_quad/dankers_quad.3ds
index b2e727be6..e5721bad7 100644
Binary files a/ground/gcs/src/share/models/multi/dankers_quad/dankers_quad.3ds and b/ground/gcs/src/share/models/multi/dankers_quad/dankers_quad.3ds differ
diff --git a/ground/gcs/src/share/models/multi/dankers_quad/TEXTURE.jpg b/ground/gcs/src/share/models/multi/dankers_quad/texture.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/dankers_quad/TEXTURE.jpg
rename to ground/gcs/src/share/models/multi/dankers_quad/texture.jpg
diff --git a/ground/gcs/src/share/models/multi/easy_quad/BOARDS.JPG b/ground/gcs/src/share/models/multi/easy_quad/boards.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/easy_quad/BOARDS.JPG
rename to ground/gcs/src/share/models/multi/easy_quad/boards.jpg
diff --git a/ground/gcs/src/share/models/multi/easy_quad/easy_quad_X.jpg b/ground/gcs/src/share/models/multi/easy_quad/easy_quad_X.jpg
deleted file mode 100644
index 15192ba5c..000000000
Binary files a/ground/gcs/src/share/models/multi/easy_quad/easy_quad_X.jpg and /dev/null differ
diff --git a/ground/gcs/src/share/models/multi/easy_quad/easy_quad_X.3ds b/ground/gcs/src/share/models/multi/easy_quad/easy_quad_x.3ds
similarity index 56%
rename from ground/gcs/src/share/models/multi/easy_quad/easy_quad_X.3ds
rename to ground/gcs/src/share/models/multi/easy_quad/easy_quad_x.3ds
index b9b3ee09c..775f1811d 100644
Binary files a/ground/gcs/src/share/models/multi/easy_quad/easy_quad_X.3ds and b/ground/gcs/src/share/models/multi/easy_quad/easy_quad_x.3ds differ
diff --git a/ground/gcs/src/share/models/multi/easy_quad/easy_quad_x.jpg b/ground/gcs/src/share/models/multi/easy_quad/easy_quad_x.jpg
new file mode 100644
index 000000000..b5830c96f
Binary files /dev/null and b/ground/gcs/src/share/models/multi/easy_quad/easy_quad_x.jpg differ
diff --git a/ground/gcs/src/share/models/multi/easy_quad/LOGO.JPG b/ground/gcs/src/share/models/multi/easy_quad/logo.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/easy_quad/LOGO.JPG
rename to ground/gcs/src/share/models/multi/easy_quad/logo.jpg
diff --git a/ground/gcs/src/share/models/multi/easy_quad/TEXTURE.JPG b/ground/gcs/src/share/models/multi/easy_quad/texture.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/easy_quad/TEXTURE.JPG
rename to ground/gcs/src/share/models/multi/easy_quad/texture.jpg
diff --git a/ground/gcs/src/share/models/multi/gaui_330x/gaui_330x.3ds b/ground/gcs/src/share/models/multi/gaui_330x/gaui_330x.3ds
index a9af453ba..785e4505b 100644
Binary files a/ground/gcs/src/share/models/multi/gaui_330x/gaui_330x.3ds and b/ground/gcs/src/share/models/multi/gaui_330x/gaui_330x.3ds differ
diff --git a/ground/gcs/src/share/models/multi/joes_cnc/J14-QT_+.3DS b/ground/gcs/src/share/models/multi/joes_cnc/J14-QT_+.3DS
deleted file mode 100644
index 9d0d2de8c..000000000
Binary files a/ground/gcs/src/share/models/multi/joes_cnc/J14-QT_+.3DS and /dev/null differ
diff --git a/ground/gcs/src/share/models/multi/joes_cnc/J14-QT_X.3DS b/ground/gcs/src/share/models/multi/joes_cnc/J14-QT_X.3DS
deleted file mode 100644
index a29de2543..000000000
Binary files a/ground/gcs/src/share/models/multi/joes_cnc/J14-QT_X.3DS and /dev/null differ
diff --git a/ground/gcs/src/share/models/multi/joes_cnc/J14-Q_+.3DS b/ground/gcs/src/share/models/multi/joes_cnc/J14-Q_+.3DS
deleted file mode 100644
index d4bb3dfbf..000000000
Binary files a/ground/gcs/src/share/models/multi/joes_cnc/J14-Q_+.3DS and /dev/null differ
diff --git a/ground/gcs/src/share/models/multi/joes_cnc/J14-Q_X.3DS b/ground/gcs/src/share/models/multi/joes_cnc/J14-Q_X.3DS
deleted file mode 100644
index cb0f3e995..000000000
Binary files a/ground/gcs/src/share/models/multi/joes_cnc/J14-Q_X.3DS and /dev/null differ
diff --git a/ground/gcs/src/share/models/multi/joes_cnc/TEXTURE.JPG b/ground/gcs/src/share/models/multi/joes_cnc/TEXTURE.JPG
deleted file mode 100644
index 9e5500340..000000000
Binary files a/ground/gcs/src/share/models/multi/joes_cnc/TEXTURE.JPG and /dev/null differ
diff --git a/ground/gcs/src/share/models/multi/ricoo/CC.PNG b/ground/gcs/src/share/models/multi/joes_cnc/cc.png
similarity index 100%
rename from ground/gcs/src/share/models/multi/ricoo/CC.PNG
rename to ground/gcs/src/share/models/multi/joes_cnc/cc.png
diff --git a/ground/gcs/src/share/models/multi/joes_cnc/j14-q_+.3ds b/ground/gcs/src/share/models/multi/joes_cnc/j14-q_+.3ds
new file mode 100644
index 000000000..c87474b1a
Binary files /dev/null and b/ground/gcs/src/share/models/multi/joes_cnc/j14-q_+.3ds differ
diff --git a/ground/gcs/src/share/models/multi/joes_cnc/J14-Q_+.jpg b/ground/gcs/src/share/models/multi/joes_cnc/j14-q_+.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/joes_cnc/J14-Q_+.jpg
rename to ground/gcs/src/share/models/multi/joes_cnc/j14-q_+.jpg
diff --git a/ground/gcs/src/share/models/multi/joes_cnc/j14-q_x.3ds b/ground/gcs/src/share/models/multi/joes_cnc/j14-q_x.3ds
new file mode 100644
index 000000000..2051c90dc
Binary files /dev/null and b/ground/gcs/src/share/models/multi/joes_cnc/j14-q_x.3ds differ
diff --git a/ground/gcs/src/share/models/multi/joes_cnc/J14-Q_X.jpg b/ground/gcs/src/share/models/multi/joes_cnc/j14-q_x.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/joes_cnc/J14-Q_X.jpg
rename to ground/gcs/src/share/models/multi/joes_cnc/j14-q_x.jpg
diff --git a/ground/gcs/src/share/models/multi/joes_cnc/j14-qt_+.3ds b/ground/gcs/src/share/models/multi/joes_cnc/j14-qt_+.3ds
new file mode 100644
index 000000000..fe75bfb43
Binary files /dev/null and b/ground/gcs/src/share/models/multi/joes_cnc/j14-qt_+.3ds differ
diff --git a/ground/gcs/src/share/models/multi/joes_cnc/J14-QT_+.jpg b/ground/gcs/src/share/models/multi/joes_cnc/j14-qt_+.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/joes_cnc/J14-QT_+.jpg
rename to ground/gcs/src/share/models/multi/joes_cnc/j14-qt_+.jpg
diff --git a/ground/gcs/src/share/models/multi/joes_cnc/j14-qt_x.3ds b/ground/gcs/src/share/models/multi/joes_cnc/j14-qt_x.3ds
new file mode 100644
index 000000000..76ede1744
Binary files /dev/null and b/ground/gcs/src/share/models/multi/joes_cnc/j14-qt_x.3ds differ
diff --git a/ground/gcs/src/share/models/multi/joes_cnc/J14-QT_X.jpg b/ground/gcs/src/share/models/multi/joes_cnc/j14-qt_x.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/joes_cnc/J14-QT_X.jpg
rename to ground/gcs/src/share/models/multi/joes_cnc/j14-qt_x.jpg
diff --git a/ground/gcs/src/share/models/multi/joes_cnc/texture.png b/ground/gcs/src/share/models/multi/joes_cnc/texture.png
new file mode 100644
index 000000000..5d26bb120
Binary files /dev/null and b/ground/gcs/src/share/models/multi/joes_cnc/texture.png differ
diff --git a/ground/gcs/src/share/models/multi/mattL_Y6/mattL_Y6.3ds b/ground/gcs/src/share/models/multi/mattl_y6/mattl_y6.3ds
similarity index 75%
rename from ground/gcs/src/share/models/multi/mattL_Y6/mattL_Y6.3ds
rename to ground/gcs/src/share/models/multi/mattl_y6/mattl_y6.3ds
index d7f54398b..d2eda5587 100644
Binary files a/ground/gcs/src/share/models/multi/mattL_Y6/mattL_Y6.3ds and b/ground/gcs/src/share/models/multi/mattl_y6/mattl_y6.3ds differ
diff --git a/ground/gcs/src/share/models/multi/mattL_Y6/mattL_Y6.jpg b/ground/gcs/src/share/models/multi/mattl_y6/mattl_y6.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/mattL_Y6/mattL_Y6.jpg
rename to ground/gcs/src/share/models/multi/mattl_y6/mattl_y6.jpg
diff --git a/ground/gcs/src/share/models/multi/mattL_Y6/TEXTURE.PNG b/ground/gcs/src/share/models/multi/mattl_y6/texture.png
similarity index 100%
rename from ground/gcs/src/share/models/multi/mattL_Y6/TEXTURE.PNG
rename to ground/gcs/src/share/models/multi/mattl_y6/texture.png
diff --git a/ground/gcs/src/share/models/multi/mikrokopter/MK_Hexa.3ds b/ground/gcs/src/share/models/multi/mikrokopter/mk_hexa.3ds
similarity index 73%
rename from ground/gcs/src/share/models/multi/mikrokopter/MK_Hexa.3ds
rename to ground/gcs/src/share/models/multi/mikrokopter/mk_hexa.3ds
index 60ae9bc69..db2621bf5 100644
Binary files a/ground/gcs/src/share/models/multi/mikrokopter/MK_Hexa.3ds and b/ground/gcs/src/share/models/multi/mikrokopter/mk_hexa.3ds differ
diff --git a/ground/gcs/src/share/models/multi/mikrokopter/MK_Hexa.jpg b/ground/gcs/src/share/models/multi/mikrokopter/mk_hexa.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/mikrokopter/MK_Hexa.jpg
rename to ground/gcs/src/share/models/multi/mikrokopter/mk_hexa.jpg
diff --git a/ground/gcs/src/share/models/multi/mikrokopter/MK_L4-ME.3ds b/ground/gcs/src/share/models/multi/mikrokopter/mk_l4-me.3ds
similarity index 65%
rename from ground/gcs/src/share/models/multi/mikrokopter/MK_L4-ME.3ds
rename to ground/gcs/src/share/models/multi/mikrokopter/mk_l4-me.3ds
index 5c9cbb8e3..1c74cb026 100644
Binary files a/ground/gcs/src/share/models/multi/mikrokopter/MK_L4-ME.3ds and b/ground/gcs/src/share/models/multi/mikrokopter/mk_l4-me.3ds differ
diff --git a/ground/gcs/src/share/models/multi/mikrokopter/MK_L4-ME.jpg b/ground/gcs/src/share/models/multi/mikrokopter/mk_l4-me.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/mikrokopter/MK_L4-ME.jpg
rename to ground/gcs/src/share/models/multi/mikrokopter/mk_l4-me.jpg
diff --git a/ground/gcs/src/share/models/multi/mikrokopter/MK_Okto.3ds b/ground/gcs/src/share/models/multi/mikrokopter/mk_okto.3ds
similarity index 65%
rename from ground/gcs/src/share/models/multi/mikrokopter/MK_Okto.3ds
rename to ground/gcs/src/share/models/multi/mikrokopter/mk_okto.3ds
index 4cd407e96..5add03e19 100644
Binary files a/ground/gcs/src/share/models/multi/mikrokopter/MK_Okto.3ds and b/ground/gcs/src/share/models/multi/mikrokopter/mk_okto.3ds differ
diff --git a/ground/gcs/src/share/models/multi/mikrokopter/MK_Okto.jpg b/ground/gcs/src/share/models/multi/mikrokopter/mk_okto.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/mikrokopter/MK_Okto.jpg
rename to ground/gcs/src/share/models/multi/mikrokopter/mk_okto.jpg
diff --git a/ground/gcs/src/share/models/multi/mikrokopter/MK_Okto2.3ds b/ground/gcs/src/share/models/multi/mikrokopter/mk_okto2.3ds
similarity index 64%
rename from ground/gcs/src/share/models/multi/mikrokopter/MK_Okto2.3ds
rename to ground/gcs/src/share/models/multi/mikrokopter/mk_okto2.3ds
index 5d1e31ebe..73e21cc18 100644
Binary files a/ground/gcs/src/share/models/multi/mikrokopter/MK_Okto2.3ds and b/ground/gcs/src/share/models/multi/mikrokopter/mk_okto2.3ds differ
diff --git a/ground/gcs/src/share/models/multi/mikrokopter/MK_Okto2.jpg b/ground/gcs/src/share/models/multi/mikrokopter/mk_okto2.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/mikrokopter/MK_Okto2.jpg
rename to ground/gcs/src/share/models/multi/mikrokopter/mk_okto2.jpg
diff --git a/ground/gcs/src/share/models/multi/mikrokopter/TEXTURE.JPG b/ground/gcs/src/share/models/multi/mikrokopter/texture.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/mikrokopter/TEXTURE.JPG
rename to ground/gcs/src/share/models/multi/mikrokopter/texture.jpg
diff --git a/ground/gcs/src/share/models/multi/ricoo/cc.png b/ground/gcs/src/share/models/multi/ricoo/cc.png
new file mode 100644
index 000000000..467f34a97
Binary files /dev/null and b/ground/gcs/src/share/models/multi/ricoo/cc.png differ
diff --git a/ground/gcs/src/share/models/multi/ricoo/ricoo.3DS b/ground/gcs/src/share/models/multi/ricoo/ricoo.3ds
similarity index 57%
rename from ground/gcs/src/share/models/multi/ricoo/ricoo.3DS
rename to ground/gcs/src/share/models/multi/ricoo/ricoo.3ds
index 226920061..2d20a1d8a 100644
Binary files a/ground/gcs/src/share/models/multi/ricoo/ricoo.3DS and b/ground/gcs/src/share/models/multi/ricoo/ricoo.3ds differ
diff --git a/ground/gcs/src/share/models/multi/ricoo/TEXTURE.PNG b/ground/gcs/src/share/models/multi/ricoo/texture.png
similarity index 100%
rename from ground/gcs/src/share/models/multi/ricoo/TEXTURE.PNG
rename to ground/gcs/src/share/models/multi/ricoo/texture.png
diff --git a/ground/gcs/src/share/models/multi/scorpion_tricopter/scorpion_tricopter.3ds b/ground/gcs/src/share/models/multi/scorpion_tricopter/scorpion_tricopter.3ds
index 845bfb03c..5e4ed10c5 100644
Binary files a/ground/gcs/src/share/models/multi/scorpion_tricopter/scorpion_tricopter.3ds and b/ground/gcs/src/share/models/multi/scorpion_tricopter/scorpion_tricopter.3ds differ
diff --git a/ground/gcs/src/share/models/multi/test_quad/TEXTURE.PNG b/ground/gcs/src/share/models/multi/test_quad/TEXTURE.PNG
deleted file mode 100644
index 3623b4fd2..000000000
Binary files a/ground/gcs/src/share/models/multi/test_quad/TEXTURE.PNG and /dev/null differ
diff --git a/ground/gcs/src/share/models/multi/test_quad/test_quad_+-old.3ds b/ground/gcs/src/share/models/multi/test_quad/test_quad_+-old.3ds
new file mode 100755
index 000000000..bb5f7fa87
Binary files /dev/null and b/ground/gcs/src/share/models/multi/test_quad/test_quad_+-old.3ds differ
diff --git a/ground/gcs/src/share/models/multi/test_quad/test_quad_+-old.jpg b/ground/gcs/src/share/models/multi/test_quad/test_quad_+-old.jpg
new file mode 100644
index 000000000..b59a6217b
Binary files /dev/null and b/ground/gcs/src/share/models/multi/test_quad/test_quad_+-old.jpg differ
diff --git a/ground/gcs/src/share/models/multi/test_quad/test_quad_+.3ds b/ground/gcs/src/share/models/multi/test_quad/test_quad_+.3ds
index 863e061e2..a8ddc4a9d 100644
Binary files a/ground/gcs/src/share/models/multi/test_quad/test_quad_+.3ds and b/ground/gcs/src/share/models/multi/test_quad/test_quad_+.3ds differ
diff --git a/ground/gcs/src/share/models/multi/test_quad/test_quad_+.jpg b/ground/gcs/src/share/models/multi/test_quad/test_quad_+.jpg
index 53ede1d4a..5de62b360 100644
Binary files a/ground/gcs/src/share/models/multi/test_quad/test_quad_+.jpg and b/ground/gcs/src/share/models/multi/test_quad/test_quad_+.jpg differ
diff --git a/ground/gcs/src/share/models/multi/test_quad/test_quad_X.jpg b/ground/gcs/src/share/models/multi/test_quad/test_quad_X.jpg
deleted file mode 100644
index 52dc28a7d..000000000
Binary files a/ground/gcs/src/share/models/multi/test_quad/test_quad_X.jpg and /dev/null differ
diff --git a/ground/gcs/src/share/models/multi/test_quad/test_quad_x-old.3ds b/ground/gcs/src/share/models/multi/test_quad/test_quad_x-old.3ds
new file mode 100755
index 000000000..3fe941fcb
Binary files /dev/null and b/ground/gcs/src/share/models/multi/test_quad/test_quad_x-old.3ds differ
diff --git a/ground/gcs/src/share/models/multi/test_quad/test_quad_x-old.jpg b/ground/gcs/src/share/models/multi/test_quad/test_quad_x-old.jpg
new file mode 100644
index 000000000..69f72e858
Binary files /dev/null and b/ground/gcs/src/share/models/multi/test_quad/test_quad_x-old.jpg differ
diff --git a/ground/gcs/src/share/models/multi/test_quad/test_quad_X.3ds b/ground/gcs/src/share/models/multi/test_quad/test_quad_x.3ds
similarity index 57%
rename from ground/gcs/src/share/models/multi/test_quad/test_quad_X.3ds
rename to ground/gcs/src/share/models/multi/test_quad/test_quad_x.3ds
index cc205f954..0c80b7d4b 100644
Binary files a/ground/gcs/src/share/models/multi/test_quad/test_quad_X.3ds and b/ground/gcs/src/share/models/multi/test_quad/test_quad_x.3ds differ
diff --git a/ground/gcs/src/share/models/multi/test_quad/test_quad_x.jpg b/ground/gcs/src/share/models/multi/test_quad/test_quad_x.jpg
new file mode 100644
index 000000000..b5a35cc12
Binary files /dev/null and b/ground/gcs/src/share/models/multi/test_quad/test_quad_x.jpg differ
diff --git a/ground/gcs/src/share/models/multi/test_quad/TEXTURE.JPG b/ground/gcs/src/share/models/multi/test_quad/texture.jpg
similarity index 100%
rename from ground/gcs/src/share/models/multi/test_quad/TEXTURE.JPG
rename to ground/gcs/src/share/models/multi/test_quad/texture.jpg
diff --git a/ground/gcs/src/share/models/multi/test_quad/texture.png b/ground/gcs/src/share/models/multi/test_quad/texture.png
new file mode 100644
index 000000000..168ddb9d0
Binary files /dev/null and b/ground/gcs/src/share/models/multi/test_quad/texture.png differ
diff --git a/ground/gcs/src/share/models/planes/Easystar/easystar.3ds b/ground/gcs/src/share/models/planes/easystar/easystar.3ds
similarity index 64%
rename from ground/gcs/src/share/models/planes/Easystar/easystar.3ds
rename to ground/gcs/src/share/models/planes/easystar/easystar.3ds
index a09088399..7f4cf8cb4 100644
Binary files a/ground/gcs/src/share/models/planes/Easystar/easystar.3ds and b/ground/gcs/src/share/models/planes/easystar/easystar.3ds differ
diff --git a/ground/gcs/src/share/models/planes/Easystar/easystar.jpg b/ground/gcs/src/share/models/planes/easystar/easystar.jpg
similarity index 100%
rename from ground/gcs/src/share/models/planes/Easystar/easystar.jpg
rename to ground/gcs/src/share/models/planes/easystar/easystar.jpg
diff --git a/ground/gcs/src/share/models/planes/Easystar/TEXTURE.JPG b/ground/gcs/src/share/models/planes/easystar/texture.jpg
similarity index 100%
rename from ground/gcs/src/share/models/planes/Easystar/TEXTURE.JPG
rename to ground/gcs/src/share/models/planes/easystar/texture.jpg
diff --git a/ground/gcs/src/share/models/planes/firecracker/firecracker.3ds b/ground/gcs/src/share/models/planes/firecracker/firecracker.3ds
index 2bbd247f6..d99f7d320 100644
Binary files a/ground/gcs/src/share/models/planes/firecracker/firecracker.3ds and b/ground/gcs/src/share/models/planes/firecracker/firecracker.3ds differ
diff --git a/ground/gcs/src/share/models/planes/firecracker/TEXTURE.JPG b/ground/gcs/src/share/models/planes/firecracker/texture.jpg
similarity index 100%
rename from ground/gcs/src/share/models/planes/firecracker/TEXTURE.JPG
rename to ground/gcs/src/share/models/planes/firecracker/texture.jpg
diff --git a/ground/gcs/src/share/models/planes/funjet/funjet.3ds b/ground/gcs/src/share/models/planes/funjet/funjet.3ds
index 50d17d073..b5f921ea5 100644
Binary files a/ground/gcs/src/share/models/planes/funjet/funjet.3ds and b/ground/gcs/src/share/models/planes/funjet/funjet.3ds differ
diff --git a/ground/gcs/src/share/models/planes/funjet/TEXTURE.JPG b/ground/gcs/src/share/models/planes/funjet/texture.jpg
similarity index 100%
rename from ground/gcs/src/share/models/planes/funjet/TEXTURE.JPG
rename to ground/gcs/src/share/models/planes/funjet/texture.jpg
diff --git a/ground/gcs/src/share/models/planes/zagi/zagi.3ds b/ground/gcs/src/share/models/planes/zagi/zagi.3ds
index 232cdef5d..a770105c4 100644
Binary files a/ground/gcs/src/share/models/planes/zagi/zagi.3ds and b/ground/gcs/src/share/models/planes/zagi/zagi.3ds differ
diff --git a/ground/gcs/src/share/models/test/cube.3ds b/ground/gcs/src/share/models/test/cube.3ds
new file mode 100644
index 000000000..7cbbf78fc
Binary files /dev/null and b/ground/gcs/src/share/models/test/cube.3ds differ
diff --git a/ground/gcs/src/share/osgearth/arcgis.earth b/ground/gcs/src/share/osgearth/arcgis.earth
new file mode 100644
index 000000000..020cbf9d1
--- /dev/null
+++ b/ground/gcs/src/share/osgearth/arcgis.earth
@@ -0,0 +1,20 @@
+
+
+
diff --git a/ground/gcs/src/share/osgearth/data/moon_1024x512.jpg b/ground/gcs/src/share/osgearth/data/moon_1024x512.jpg
new file mode 100644
index 000000000..e20464700
Binary files /dev/null and b/ground/gcs/src/share/osgearth/data/moon_1024x512.jpg differ
diff --git a/ground/gcs/src/share/pfd/default/readymap.earth b/ground/gcs/src/share/osgearth/readymap.earth
similarity index 56%
rename from ground/gcs/src/share/pfd/default/readymap.earth
rename to ground/gcs/src/share/osgearth/readymap.earth
index 55adca838..385787888 100644
--- a/ground/gcs/src/share/pfd/default/readymap.earth
+++ b/ground/gcs/src/share/osgearth/readymap.earth
@@ -7,29 +7,21 @@ is a great base map that provides global context for your own local datasets.
It works "out of the box" with osgEarth applications.
**** NOTICE ****
-YOU ARE RESPONSIBLE for abiding by the TERMS AND CONDITIONS outlined at:
-http://readymap.org
-
+YOU ARE RESPONSIBLE for abiding by the TERMS AND CONDITIONS outlined at: http://readymap.org
-->
-
diff --git a/ground/gcs/src/share/pfd/default/PfdTerrainView.qml b/ground/gcs/src/share/pfd/default/PfdTerrainView.qml
deleted file mode 100644
index 21355d16f..000000000
--- a/ground/gcs/src/share/pfd/default/PfdTerrainView.qml
+++ /dev/null
@@ -1,20 +0,0 @@
-import QtQuick 2.0
-import org.OpenPilot 1.0
-
-OsgEarth {
- id: earthView
-
- sceneFile: qmlWidget.earthFile
- fieldOfView: 90
-
- yaw: AttitudeState.Yaw
- pitch: AttitudeState.Pitch
- roll: AttitudeState.Roll
-
- latitude: qmlWidget.actualPositionUsed ?
- GPSPositionSensor.Latitude/10000000.0 : qmlWidget.latitude
- longitude: qmlWidget.actualPositionUsed ?
- GPSPositionSensor.Longitude/10000000.0 : qmlWidget.longitude
- altitude: qmlWidget.actualPositionUsed ?
- GPSPositionSensor.Altitude : qmlWidget.altitude
-}
diff --git a/ground/gcs/src/share/pfd/default/srtm.earth b/ground/gcs/src/share/pfd/default/srtm.earth
deleted file mode 100644
index bd17c7eb0..000000000
--- a/ground/gcs/src/share/pfd/default/srtm.earth
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
- http://demo.pelicanmapping.com/rmweb/data/bluemarble-tms/tms.xml
-
-
-
- http://demo.pelicanmapping.com/rmweb/data/srtm30_plus_tms/tms.xml
-
-
-
- true
-
- 1
-
-
-
-
-
diff --git a/ground/gcs/src/share/pfd/default/yahoo_readymap.earth b/ground/gcs/src/share/pfd/default/yahoo_readymap.earth
deleted file mode 100644
index 6846feb27..000000000
--- a/ground/gcs/src/share/pfd/default/yahoo_readymap.earth
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
- satellite
-
-
-
-
- http://readymap.org/readymap/tiles/1.0.0/9/
-
-
-
-
- false
- 6.0
-
-
-
diff --git a/ground/gcs/src/share/pfd/default/yahoo_srtm.earth b/ground/gcs/src/share/pfd/default/yahoo_srtm.earth
deleted file mode 100644
index 1033290b5..000000000
--- a/ground/gcs/src/share/pfd/default/yahoo_srtm.earth
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
- satellite
-
-
-
- http://demo.pelicanmapping.com/rmweb/data/srtm30_plus_tms/tms.xml
-
-
-
- false
-
- 2
-
-
-
-
-
diff --git a/ground/gcs/src/share/qml/CubeView.qml b/ground/gcs/src/share/qml/CubeView.qml
new file mode 100644
index 000000000..cf87387f5
--- /dev/null
+++ b/ground/gcs/src/share/qml/CubeView.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.4
+import OsgQtQuick 1.0
+
+Item {
+ OSGViewport {
+ anchors.fill: parent
+ focus: true
+ sceneData: cubeNode
+ camera: camera
+
+ OSGCubeNode {
+ id: cubeNode
+ }
+
+ OSGCamera {
+ id: camera
+ fieldOfView: 90
+ }
+ }
+}
diff --git a/ground/gcs/src/share/qml/EarthView.qml b/ground/gcs/src/share/qml/EarthView.qml
new file mode 100644
index 000000000..899ba75d3
--- /dev/null
+++ b/ground/gcs/src/share/qml/EarthView.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.4
+import Pfd 1.0
+import OsgQtQuick 1.0
+
+Item {
+ OSGViewport {
+ anchors.fill: parent
+ focus: true
+ sceneData: skyNode
+ camera: camera
+
+ OSGSkyNode {
+ id: skyNode
+ sceneData: terrainNode
+ dateTime: getDateTime()
+ minimumAmbientLight: qmlWidget.minimumAmbientLight
+
+ function getDateTime() {
+ switch(qmlWidget.timeMode) {
+ case TimeMode.Local:
+ return new Date();
+ case TimeMode.Predefined:
+ return qmlWidget.dateTime;
+ }
+ }
+
+ }
+
+ OSGFileNode {
+ id: terrainNode
+ source: qmlWidget.terrainFile
+ async: false
+ }
+
+ OSGCamera {
+ id: camera
+ fieldOfView: 90
+ manipulatorMode: ManipulatorMode.Earth
+ }
+
+ }
+}
diff --git a/ground/gcs/src/share/qml/ModelView.qml b/ground/gcs/src/share/qml/ModelView.qml
new file mode 100644
index 000000000..fc5bebfe4
--- /dev/null
+++ b/ground/gcs/src/share/qml/ModelView.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.4
+
+Item {
+ Loader {
+ anchors.fill: parent
+ focus: true
+ source: qmlWidget.terrainEnabled ? "model/ModelTerrainView.qml" : "model/ModelView.qml"
+ }
+}
\ No newline at end of file
diff --git a/ground/gcs/src/share/pfd/default/Pfd.qml b/ground/gcs/src/share/qml/Pfd.qml
similarity index 81%
rename from ground/gcs/src/share/pfd/default/Pfd.qml
rename to ground/gcs/src/share/qml/Pfd.qml
index 6eed0626d..abd194187 100644
--- a/ground/gcs/src/share/pfd/default/Pfd.qml
+++ b/ground/gcs/src/share/qml/Pfd.qml
@@ -1,24 +1,25 @@
-import QtQuick 2.0
+import QtQuick 2.4
+import "pfd" as Pfd
Rectangle {
- color: "#666666"
+ color: "#515151"
- SvgElementImage {
+ Pfd.SvgElementImage {
id: background
elementName: "pfd-window"
fillMode: Image.PreserveAspectFit
anchors.fill: parent
sceneSize: Qt.size(width, height)
-
+
Rectangle {
width: Math.floor(parent.paintedHeight * 1.319)
height: Math.floor(parent.paintedHeight - parent.paintedHeight * 0.008)
-
+
color: "transparent"
border.color: "white"
border.width: Math.floor(parent.paintedHeight * 0.008)
radius: Math.floor(parent.paintedHeight * 0.01)
- anchors.centerIn: parent
+ anchors.centerIn: parent
}
Item {
@@ -35,27 +36,28 @@ Rectangle {
anchors.centerIn: parent
clip: true
-
+
Loader {
id: worldLoader
anchors.fill: parent
- source: qmlWidget.terrainEnabled ? "PfdTerrainView.qml" : "PfdWorldView.qml"
+ focus: true
+ source: qmlWidget.terrainEnabled ? "pfd/PfdTerrainView.qml" : "pfd/PfdWorldView.qml"
}
- HorizontCenter {
+ Pfd.HorizontCenter {
id: horizontCenterItem
sceneSize: sceneItem.viewportSize
anchors.fill: parent
}
- RollScale {
+ Pfd.RollScale {
id: rollscale
sceneSize: sceneItem.viewportSize
horizontCenter: horizontCenterItem.horizontCenter
anchors.fill: parent
}
- SvgElementImage {
+ Pfd.SvgElementImage {
id: side_slip_fixed
elementName: "sideslip-fixed"
sceneSize: sceneItem.viewportSize
@@ -63,38 +65,38 @@ Rectangle {
x: scaledBounds.x * sceneItem.width
}
- Compass {
+ Pfd.Compass {
anchors.fill: parent
sceneSize: sceneItem.viewportSize
}
- SpeedScale {
+ Pfd.SpeedScale {
anchors.fill: parent
sceneSize: sceneItem.viewportSize
}
- AltitudeScale {
+ Pfd.AltitudeScale {
anchors.fill: parent
sceneSize: sceneItem.viewportSize
}
- VsiScale {
+ Pfd.VsiScale {
anchors.fill: parent
sceneSize: sceneItem.viewportSize
visible: qmlWidget.altitudeUnit != 0
}
- Info {
+ Pfd.Info {
anchors.fill: parent
sceneSize: sceneItem.viewportSize
}
- Panels {
+ Pfd.Panels {
anchors.fill: parent
sceneSize: sceneItem.viewportSize
}
- Warnings {
+ Pfd.Warnings {
anchors.fill: parent
sceneSize: sceneItem.viewportSize
}
diff --git a/ground/gcs/src/share/pfd/default/common.js b/ground/gcs/src/share/qml/common.js
similarity index 99%
rename from ground/gcs/src/share/pfd/default/common.js
rename to ground/gcs/src/share/qml/common.js
index 502e726a0..bc0a41816 100644
--- a/ground/gcs/src/share/pfd/default/common.js
+++ b/ground/gcs/src/share/qml/common.js
@@ -15,4 +15,3 @@ function formatTime(time) {
else
return time.toString();
}
-
diff --git a/ground/gcs/src/share/qml/model/ModelTerrainView.qml b/ground/gcs/src/share/qml/model/ModelTerrainView.qml
new file mode 100644
index 000000000..fdbfa70eb
--- /dev/null
+++ b/ground/gcs/src/share/qml/model/ModelTerrainView.qml
@@ -0,0 +1,79 @@
+import QtQuick 2.4
+import Pfd 1.0
+import OsgQtQuick 1.0
+
+import UAVTalk.AttitudeState 1.0
+import UAVTalk.HomeLocation 1.0
+import UAVTalk.GPSPositionSensor 1.0
+
+import "../uav.js" as UAV
+
+OSGViewport {
+ anchors.fill: parent
+ focus: true
+ sceneData: skyNode
+ camera: camera
+
+ OSGSkyNode {
+ id: skyNode
+ sceneData: sceneGroup
+ dateTime: getDateTime()
+ minimumAmbientLight: qmlWidget.minimumAmbientLight
+
+ function getDateTime() {
+ switch(qmlWidget.timeMode) {
+ case TimeMode.Local:
+ return new Date();
+ case TimeMode.Predefined:
+ return qmlWidget.dateTime;
+ }
+ }
+
+ }
+
+ OSGGroup {
+ id: sceneGroup
+ children: [ terrainNode, modelNode ]
+ }
+
+ OSGFileNode {
+ id: terrainNode
+ source: qmlWidget.terrainFile
+ async: false
+ }
+
+ OSGModelNode {
+ id: modelNode
+ clampToTerrain: true
+ modelData: modelTransformNode
+ sceneData: terrainNode
+
+ attitude: UAV.attitude()
+ position: UAV.position()
+ }
+
+ OSGTransformNode {
+ id: modelTransformNode
+ // model dimensions are in mm, scale to meters
+ scale: Qt.vector3d(0.001, 0.001, 0.001)
+ modelData: modelFileNode
+ }
+
+ OSGFileNode {
+ id: modelFileNode
+ source: qmlWidget.modelFile
+ async: false
+ optimizeMode: OptimizeMode.OptimizeAndCheck
+ }
+
+ OSGCamera {
+ id: camera
+ fieldOfView: 90
+ logarithmicDepthBuffer: true
+ manipulatorMode: ManipulatorMode.Track
+ // use model to compute camera home position
+ node: modelTransformNode
+ // model will be tracked
+ trackNode: modelTransformNode
+ }
+}
diff --git a/ground/gcs/src/share/qml/model/ModelView.qml b/ground/gcs/src/share/qml/model/ModelView.qml
new file mode 100644
index 000000000..e143a0c89
--- /dev/null
+++ b/ground/gcs/src/share/qml/model/ModelView.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.4
+import OsgQtQuick 1.0
+
+import UAVTalk.AttitudeState 1.0
+
+Item {
+
+ OSGViewport {
+ anchors.fill: parent
+ focus: true
+ sceneData: sceneNode
+ camera: camera
+
+ OSGGroup {
+ id: sceneNode
+ children: [
+ transformNode,
+ backgroundNode
+ ]
+ }
+
+ OSGBackgroundNode {
+ id: backgroundNode
+ imageFile: qmlWidget.backgroundImageFile
+ }
+
+ OSGTransformNode {
+ id: transformNode
+ modelData: fileNode
+ rotate: Qt.vector3d(attitudeState.pitch, attitudeState.roll, -attitudeState.yaw)
+ //scale: Qt.vector3d(0.001, 0.001, 0.001)
+ }
+
+ OSGFileNode {
+ id: fileNode
+ source: qmlWidget.modelFile
+ async: false
+ optimizeMode: OptimizeMode.OptimizeAndCheck
+ }
+
+ OSGCamera {
+ id: camera
+ fieldOfView: 90
+ node: transformNode
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/ground/gcs/src/share/pfd/default/AltitudeScale.qml b/ground/gcs/src/share/qml/pfd/AltitudeScale.qml
similarity index 97%
rename from ground/gcs/src/share/pfd/default/AltitudeScale.qml
rename to ground/gcs/src/share/qml/pfd/AltitudeScale.qml
index 1e0aebb23..b759f0fb6 100644
--- a/ground/gcs/src/share/pfd/default/AltitudeScale.qml
+++ b/ground/gcs/src/share/qml/pfd/AltitudeScale.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.0
+import QtQuick 2.4
import UAVTalk.PositionState 1.0
import UAVTalk.NedAccel 1.0
@@ -18,7 +18,7 @@ Item {
visible: qmlWidget.altitudeUnit != 0
- property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "altitude-window")
+ property variant scaledBounds: svgRenderer.scaledElementBounds("pfd/pfd.svg", "altitude-window")
x: Math.floor(scaledBounds.x * sceneItem.width)
y: Math.floor(scaledBounds.y * sceneItem.height)
@@ -92,7 +92,7 @@ Item {
elementName: "altitude-box"
sceneSize: sceneItem.sceneSize
- property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "altitude-box")
+ property variant scaledBounds: svgRenderer.scaledElementBounds("pfd/pfd.svg", "altitude-box")
x: scaledBounds.x * sceneItem.width
y: scaledBounds.y * sceneItem.height
diff --git a/ground/gcs/src/share/pfd/default/Compass.qml b/ground/gcs/src/share/qml/pfd/Compass.qml
similarity index 96%
rename from ground/gcs/src/share/pfd/default/Compass.qml
rename to ground/gcs/src/share/qml/pfd/Compass.qml
index 872f3d7fe..d6cf696c4 100644
--- a/ground/gcs/src/share/pfd/default/Compass.qml
+++ b/ground/gcs/src/share/qml/pfd/Compass.qml
@@ -1,13 +1,10 @@
-import QtQuick 2.0
-import "."
+import QtQuick 2.4
import UAVTalk.AttitudeState 1.0
import UAVTalk.PositionState 1.0
import UAVTalk.PathDesired 1.0
import UAVTalk.TakeOffLocation 1.0
-import "common.js" as Utils
-
Item {
id: sceneItem
property variant sceneSize
@@ -34,14 +31,13 @@ Item {
id: compass_wheel
elementName: "compass-wheel"
sceneSize: sceneItem.sceneSize
+ smooth: true
x: Math.floor(scaledBounds.x * sceneItem.width)
y: Math.floor(scaledBounds.y * sceneItem.height)
rotation: -attitudeState.yaw
transformOrigin: Item.Center
-
- smooth: true
}
SvgElementImage {
@@ -57,14 +53,15 @@ Item {
rotation: -attitudeState.yaw + home_degrees
transformOrigin: Item.Bottom
- visible: (takeOffLocation.status == Status.Valid)
+ visible: (takeOffLocation.status == Status.Valid)
}
SvgElementImage {
id: compass_waypoint // Double Purple arrow
elementName: "compass-waypoint"
sceneSize: sceneItem.sceneSize
+ smooth: true
x: Math.floor(scaledBounds.x * sceneItem.width)
y: Math.floor(scaledBounds.y * sceneItem.height)
@@ -74,16 +71,13 @@ Item {
rotation: -attitudeState.yaw + course_degrees
transformOrigin: Item.Center
- smooth: true
visible: ((pathDesired.endEast != 0.0) && (pathDesired.endNorth != 0.0))
}
-
-
Item {
id: compass_text_box
- property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "compass-text")
+ property variant scaledBounds: svgRenderer.scaledElementBounds("pfd/pfd.svg", "compass-text")
x: scaledBounds.x * sceneItem.width
y: scaledBounds.y * sceneItem.height
diff --git a/ground/gcs/src/share/pfd/default/HorizontCenter.qml b/ground/gcs/src/share/qml/pfd/HorizontCenter.qml
similarity index 97%
rename from ground/gcs/src/share/pfd/default/HorizontCenter.qml
rename to ground/gcs/src/share/qml/pfd/HorizontCenter.qml
index 6dee7b633..486edb6a7 100644
--- a/ground/gcs/src/share/pfd/default/HorizontCenter.qml
+++ b/ground/gcs/src/share/qml/pfd/HorizontCenter.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.0
+import QtQuick 2.4
Item {
id: sceneItem
diff --git a/ground/gcs/src/share/pfd/default/Info.qml b/ground/gcs/src/share/qml/pfd/Info.qml
similarity index 99%
rename from ground/gcs/src/share/pfd/default/Info.qml
rename to ground/gcs/src/share/qml/pfd/Info.qml
index f8e420aec..fc63dda8f 100644
--- a/ground/gcs/src/share/pfd/default/Info.qml
+++ b/ground/gcs/src/share/qml/pfd/Info.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.0
+import QtQuick 2.4
import UAVTalk.HwSettings 1.0
import UAVTalk.SystemAlarms 1.0
@@ -11,7 +11,7 @@ import UAVTalk.GPSSatellites 1.0
import UAVTalk.FlightBatterySettings 1.0
import UAVTalk.FlightBatteryState 1.0
-import "common.js" as Utils
+import "../common.js" as Utils
Item {
id: info
diff --git a/ground/gcs/src/share/pfd/default/Panels.qml b/ground/gcs/src/share/qml/pfd/Panels.qml
similarity index 89%
rename from ground/gcs/src/share/pfd/default/Panels.qml
rename to ground/gcs/src/share/qml/pfd/Panels.qml
index 057d30d72..20b6711c9 100644
--- a/ground/gcs/src/share/pfd/default/Panels.qml
+++ b/ground/gcs/src/share/qml/pfd/Panels.qml
@@ -10,7 +10,7 @@ import UAVTalk.MagState 1.0
import UAVTalk.ReceiverStatus 1.0
import UAVTalk.OPLinkStatus 1.0
-import "common.js" as Utils
+import "../common.js" as Utils
Item {
id: panels
@@ -186,10 +186,8 @@ Item {
property double offset_value: close_bg.width * 0.85
- property int anim_type: Easing.InOutExpo //Easing.InOutSine Easing.InOutElastic
- property real anim_amplitude: 1.2
- property real anim_period: 2
- property int duration_value: 1600
+ property int anim_type: Easing.OutExpo
+ property int anim_duration: 1600
//
// Close - Open panel
@@ -209,10 +207,10 @@ Item {
}
transitions: Transition {
- SequentialAnimation {
- id: close_anim
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
- }
+ SequentialAnimation {
+ id: close_anim
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
+ }
}
}
@@ -232,10 +230,10 @@ Item {
}
transitions: Transition {
- SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
- PropertyAnimation { property: "opacity"; duration: 500; }
- }
+ SequentialAnimation {
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
+ PropertyAnimation { property: "opacity"; duration: 500; }
+ }
}
}
@@ -265,7 +263,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -289,8 +287,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- id: rc_input_anim
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -310,7 +307,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -341,7 +338,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -368,7 +365,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -401,7 +398,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -425,7 +422,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -448,7 +445,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
@@ -489,7 +486,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
@@ -530,7 +527,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
@@ -588,7 +585,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
@@ -644,7 +641,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -675,7 +672,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -698,9 +695,9 @@ Item {
}
transitions: Transition {
- SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
- }
+ SequentialAnimation {
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
+ }
}
}
@@ -719,7 +716,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -739,7 +736,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -759,7 +756,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
@@ -787,7 +784,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -809,7 +806,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -853,7 +850,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -874,7 +871,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -897,7 +894,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
@@ -929,7 +926,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -952,7 +949,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
@@ -994,7 +991,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -1018,8 +1015,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- id: system_anim
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
@@ -1039,7 +1035,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
@@ -1072,7 +1068,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
@@ -1104,7 +1100,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
@@ -1135,7 +1131,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
@@ -1166,7 +1162,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
@@ -1197,7 +1193,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
@@ -1239,7 +1235,7 @@ Item {
transitions: Transition {
SequentialAnimation {
- PropertyAnimation { property: "x"; easing.type: anim_type; easing.amplitude: anim_amplitude; easing.period: anim_period; duration: duration_value }
+ PropertyAnimation { property: "x"; easing.type: anim_type; duration: anim_duration }
}
}
}
diff --git a/ground/gcs/src/share/qml/pfd/PfdTerrainView.qml b/ground/gcs/src/share/qml/pfd/PfdTerrainView.qml
new file mode 100644
index 000000000..6d34f7e04
--- /dev/null
+++ b/ground/gcs/src/share/qml/pfd/PfdTerrainView.qml
@@ -0,0 +1,151 @@
+import QtQuick 2.4
+import Pfd 1.0
+import OsgQtQuick 1.0
+
+import UAVTalk.AttitudeState 1.0
+import UAVTalk.HomeLocation 1.0
+import UAVTalk.GPSPositionSensor 1.0
+
+import "../uav.js" as UAV
+
+OSGViewport {
+ id: fullview
+ //anchors.fill: parent
+ focus: true
+ sceneData: skyNode
+ camera: camera
+
+ property real horizontCenter : horizontCenterItem.horizontCenter
+
+ // Factor for OSGview vertical offset
+ property double factor: 0.04
+
+ // Stretch height and apply offset
+ //height: height * (1 + factor)
+ y: -height * factor
+
+ OSGSkyNode {
+ id: skyNode
+ sceneData: terrainNode
+ dateTime: getDateTime()
+ minimumAmbientLight: qmlWidget.minimumAmbientLight
+
+ // MOVE...
+ function getDateTime() {
+ switch(qmlWidget.timeMode) {
+ case TimeMode.Local:
+ return new Date();
+ case TimeMode.Predefined:
+ return qmlWidget.dateTime;
+ }
+ }
+
+ }
+
+ OSGFileNode {
+ id: terrainNode
+ source: qmlWidget.terrainFile
+ async: false
+ }
+
+ OSGCamera {
+ id: camera
+ fieldOfView: 100
+ sceneData: terrainNode
+ logarithmicDepthBuffer: true
+ clampToTerrain: true
+ manipulatorMode: ManipulatorMode.User
+
+ attitude: UAV.attitude()
+ position: UAV.position()
+ }
+
+ Rectangle {
+ // using rectangle instead of svg rendered to pixmap
+ // as it's much more memory efficient
+ id: world
+ smooth: true
+ opacity: 0
+
+ property variant scaledBounds: svgRenderer.scaledElementBounds("pfd/pfd.svg", "horizon")
+ width: Math.round(sceneItem.width * scaledBounds.width / 2) * 2
+ height: Math.round(sceneItem.height * scaledBounds.height / 2) * 3
+
+ property double pitch1DegScaledHeight: (svgRenderer.scaledElementBounds("pfd/pfd.svg", "pitch-90").y -
+ svgRenderer.scaledElementBounds("pfd/pfd.svg", "pitch90").y) / 180.0
+
+ property double pitch1DegHeight: sceneItem.height * pitch1DegScaledHeight
+
+
+ transform: [
+ Translate {
+ id: pitchTranslate
+ x: Math.round((world.parent.width - world.width)/2)
+ // y is centered around world_center element
+ y: Math.round(horizontCenter - world.height / 2 + attitudeState.pitch * world.pitch1DegHeight)
+ },
+ Rotation {
+ angle: -attitudeState.roll
+ origin.x : world.parent.width / 2
+ origin.y : horizontCenter
+ }
+ ]
+
+ }
+
+ Item {
+ id: pitch_window
+ property variant scaledBounds: svgRenderer.scaledElementBounds("pfd/pfd.svg", "pitch-window-terrain")
+
+ x: Math.floor(scaledBounds.x * sceneItem.width)
+ y: Math.floor(scaledBounds.y * sceneItem.height) - fullview.y
+ width: Math.floor(scaledBounds.width * sceneItem.width)
+ height: Math.floor(scaledBounds.height * sceneItem.height)
+
+ rotation: -attitudeState.roll
+ transformOrigin: Item.Center
+
+ smooth: true
+ clip: true
+
+ SvgElementImage {
+ id: pitch_scale
+ elementName: "pitch-scale"
+
+ //worldView is loaded with Loader, so background element is visible
+ sceneSize: background.sceneSize
+ anchors.centerIn: parent
+ //see comment for world transform
+ anchors.verticalCenterOffset: attitudeState.pitch * world.pitch1DegHeight
+ border: 64 // sometimes numbers are excluded from bounding rect
+
+ smooth: true
+ }
+
+ SvgElementImage {
+ id: horizont_line
+ elementName: "center-line"
+
+ opacity: 0.5
+
+ // worldView is loaded with Loader, so background element is visible
+ sceneSize: background.sceneSize
+ anchors.centerIn: parent
+
+ anchors.verticalCenterOffset: attitudeState.pitch * world.pitch1DegHeight
+ border: 1
+ smooth: true
+ }
+
+ SvgElementImage {
+ id: pitch_0
+ elementName: "pitch0"
+
+ sceneSize: background.sceneSize
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: attitudeState.pitch * world.pitch1DegHeight
+ border: 1
+ smooth: true
+ }
+ }
+}
diff --git a/ground/gcs/src/share/pfd/default/PfdWorldView.qml b/ground/gcs/src/share/qml/pfd/PfdWorldView.qml
similarity index 65%
rename from ground/gcs/src/share/pfd/default/PfdWorldView.qml
rename to ground/gcs/src/share/qml/pfd/PfdWorldView.qml
index e60ea81e7..232433e56 100644
--- a/ground/gcs/src/share/pfd/default/PfdWorldView.qml
+++ b/ground/gcs/src/share/qml/pfd/PfdWorldView.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.0
+import QtQuick 2.4
import UAVTalk.AttitudeState 1.0
@@ -12,33 +12,32 @@ Item {
id: world
smooth: true
- property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "horizon")
- width: Math.round(sceneItem.width*scaledBounds.width/2)*2
- height: Math.round(sceneItem.height*scaledBounds.height/2)*3
+ property variant scaledBounds: svgRenderer.scaledElementBounds("pfd/pfd.svg", "horizon")
+ width: Math.round(sceneItem.width * scaledBounds.width / 2) * 2
+ height: Math.round(sceneItem.height * scaledBounds.height / 2) * 3
- property double pitch1DegScaledHeight: (svgRenderer.scaledElementBounds("pfd.svg", "pitch-90").y -
- svgRenderer.scaledElementBounds("pfd.svg", "pitch90").y)/180.0
+ property double pitch1DegScaledHeight: ((svgRenderer.scaledElementBounds("pfd/pfd.svg", "pitch-90").y -
+ svgRenderer.scaledElementBounds("pfd/pfd.svg", "pitch90").y) * 1.03) / 180.0
property double pitch1DegHeight: sceneItem.height*pitch1DegScaledHeight
gradient: Gradient {
- GradientStop { position: 0.4000; color: "#013163" }
- GradientStop { position: 0.4999; color: "#0164CC" }
- GradientStop { position: 0.5001; color: "#653300" }
- GradientStop { position: 0.6000; color: "#3C1E00" }
+ GradientStop { position: 0.4000; color: "#013163" }
+ GradientStop { position: 0.4999; color: "#0164CC" }
+ GradientStop { position: 0.5001; color: "#653300" }
+ GradientStop { position: 0.6000; color: "#3C1E00" }
}
transform: [
Translate {
id: pitchTranslate
- x: Math.round((world.parent.width - world.width)/2)
+ x: Math.round((world.parent.width - world.width) / 2)
// y is centered around world_center element
- y: Math.round(horizontCenter - world.height/2 +
- attitudeState.pitch * world.pitch1DegHeight)
+ y: Math.round(horizontCenter - world.height / 2 + attitudeState.pitch * world.pitch1DegHeight)
},
Rotation {
angle: -attitudeState.roll
- origin.x : world.parent.width/2
+ origin.x : world.parent.width / 2
origin.y : horizontCenter
}
]
@@ -47,7 +46,7 @@ Item {
id: horizont_line
elementName: "center-line"
- //worldView is loaded with Loader, so background element is visible
+ // worldView is loaded with Loader, so background element is visible
sceneSize: background.sceneSize
anchors.centerIn: parent
border: 1
@@ -67,7 +66,7 @@ Item {
Item {
id: pitch_window
- property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "pitch-window")
+ property variant scaledBounds: svgRenderer.scaledElementBounds("pfd/pfd.svg", "pitch-window")
x: Math.floor(scaledBounds.x * sceneItem.width)
y: Math.floor(scaledBounds.y * sceneItem.height)
@@ -83,10 +82,10 @@ Item {
SvgElementImage {
id: pitch_scale
elementName: "pitch-scale"
- //worldView is loaded with Loader, so background element is visible
+ // worldView is loaded with Loader, so background element is visible
sceneSize: background.sceneSize
anchors.centerIn: parent
- //see comment for world transform
+ // see comment for world transform
anchors.verticalCenterOffset: attitudeState.pitch * world.pitch1DegHeight
border: 64 //sometimes numbers are excluded from bounding rect
diff --git a/ground/gcs/src/share/pfd/default/RollScale.qml b/ground/gcs/src/share/qml/pfd/RollScale.qml
similarity index 96%
rename from ground/gcs/src/share/pfd/default/RollScale.qml
rename to ground/gcs/src/share/qml/pfd/RollScale.qml
index 240ec2094..8e9a6624e 100644
--- a/ground/gcs/src/share/pfd/default/RollScale.qml
+++ b/ground/gcs/src/share/qml/pfd/RollScale.qml
@@ -1,5 +1,4 @@
-import QtQuick 2.0
-import "."
+import QtQuick 2.4
import UAVTalk.AttitudeState 1.0
diff --git a/ground/gcs/src/share/pfd/default/SpeedScale.qml b/ground/gcs/src/share/qml/pfd/SpeedScale.qml
similarity index 99%
rename from ground/gcs/src/share/pfd/default/SpeedScale.qml
rename to ground/gcs/src/share/qml/pfd/SpeedScale.qml
index 149948501..8e17f2797 100644
--- a/ground/gcs/src/share/pfd/default/SpeedScale.qml
+++ b/ground/gcs/src/share/qml/pfd/SpeedScale.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.0
+import QtQuick 2.4
import UAVTalk.VelocityState 1.0
import UAVTalk.PathDesired 1.0
diff --git a/ground/gcs/src/share/pfd/default/SvgElementImage.qml b/ground/gcs/src/share/qml/pfd/SvgElementImage.qml
similarity index 95%
rename from ground/gcs/src/share/pfd/default/SvgElementImage.qml
rename to ground/gcs/src/share/qml/pfd/SvgElementImage.qml
index 6006380f0..998346316 100644
--- a/ground/gcs/src/share/pfd/default/SvgElementImage.qml
+++ b/ground/gcs/src/share/qml/pfd/SvgElementImage.qml
@@ -1,10 +1,10 @@
-import QtQuick 2.0
+import QtQuick 2.4
Image {
id: sceneItem
property variant sceneSize
property string elementName
- property string svgFileName: "pfd.svg"
+ property string svgFileName: "pfd/pfd.svg"
property int vSlice: 0
property int vSliceCount: 0
property int hSlice: 0
diff --git a/ground/gcs/src/share/pfd/default/SvgElementPositionItem.qml b/ground/gcs/src/share/qml/pfd/SvgElementPositionItem.qml
similarity index 86%
rename from ground/gcs/src/share/pfd/default/SvgElementPositionItem.qml
rename to ground/gcs/src/share/qml/pfd/SvgElementPositionItem.qml
index cc43a024b..170a23c08 100644
--- a/ground/gcs/src/share/pfd/default/SvgElementPositionItem.qml
+++ b/ground/gcs/src/share/qml/pfd/SvgElementPositionItem.qml
@@ -1,10 +1,10 @@
-import QtQuick 2.0
+import QtQuick 2.4
Item {
id: sceneItem
property variant sceneSize
property string elementName
- property string svgFileName: "pfd.svg"
+ property string svgFileName: "pfd/pfd.svg"
property variant scaledBounds: svgRenderer.scaledElementBounds(svgFileName, elementName)
x: Math.floor(scaledBounds.x * sceneSize.width)
diff --git a/ground/gcs/src/share/pfd/default/TooltipArea.qml b/ground/gcs/src/share/qml/pfd/TooltipArea.qml
similarity index 97%
rename from ground/gcs/src/share/pfd/default/TooltipArea.qml
rename to ground/gcs/src/share/qml/pfd/TooltipArea.qml
index 2d6824460..dd5c3c86c 100644
--- a/ground/gcs/src/share/pfd/default/TooltipArea.qml
+++ b/ground/gcs/src/share/qml/pfd/TooltipArea.qml
@@ -1,4 +1,4 @@
-import QtQuick 2.0
+import QtQuick 2.4
import QtQuick.Controls 1.2
import QtQuick.Controls.Private 1.0
import QtQuick.Controls.Styles 1.1
diff --git a/ground/gcs/src/share/pfd/default/VsiScale.qml b/ground/gcs/src/share/qml/pfd/VsiScale.qml
similarity index 93%
rename from ground/gcs/src/share/pfd/default/VsiScale.qml
rename to ground/gcs/src/share/qml/pfd/VsiScale.qml
index ffe42aced..3c0c3a986 100644
--- a/ground/gcs/src/share/pfd/default/VsiScale.qml
+++ b/ground/gcs/src/share/qml/pfd/VsiScale.qml
@@ -1,10 +1,8 @@
-import QtQuick 2.0
+import QtQuick 2.4
import UAVTalk.FlightStatus 1.0
import UAVTalk.VelocityDesired 1.0
-import "common.js" as Utils
-
Item {
id: sceneItem
property variant sceneSize
@@ -74,9 +72,9 @@ Item {
smooth: true
- // rotate it around the center
+ // rotate it around the center, limit value to +/-6m/s
transform: Rotation {
- angle: -vert_velocity * 5
+ angle: (vert_velocity > 6) ? -30 : (vert_velocity < -6) ? 30 : -vert_velocity * 5
origin.y : vsi_arrow.height / 2
origin.x : vsi_arrow.width * 3.15
}
diff --git a/ground/gcs/src/share/pfd/default/Warnings.qml b/ground/gcs/src/share/qml/pfd/Warnings.qml
similarity index 97%
rename from ground/gcs/src/share/pfd/default/Warnings.qml
rename to ground/gcs/src/share/qml/pfd/Warnings.qml
index 9575aee5d..b3431dc99 100644
--- a/ground/gcs/src/share/pfd/default/Warnings.qml
+++ b/ground/gcs/src/share/qml/pfd/Warnings.qml
@@ -1,11 +1,11 @@
-import QtQuick 2.0
+import QtQuick 2.4
import UAVTalk.SystemSettings 1.0
import UAVTalk.SystemAlarms 1.0
import UAVTalk.FlightStatus 1.0
import UAVTalk.VtolPathFollowerSettings 1.0
-import "common.js" as Utils
+import "../common.js" as Utils
Item {
id: warnings
@@ -17,11 +17,11 @@ Item {
// DisArmed , Arming, Armed
property variant armColors : ["gray", "orange", "green"]
-
+
// All 'manual modes' are green, 'assisted' modes in cyan
// "MANUAL","STAB 1","STAB 2", "STAB 3", "STAB 4", "STAB 5", "STAB 6",
// "POS HOLD", "COURSELOCK","VEL ROAM", "HOME LEASH", "ABS POS", "RTB", "LAND", "PATHPLAN", "POI", "AUTOCRUISE", "AUTOTAKEOFF"
- property variant flightmodeColors : ["gray", "green", "green", "green", "green", "green", "green",
+ property variant flightmodeColors : ["gray", "green", "green", "green", "green", "green", "green",
"cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan", "cyan"]
// Manual,Rate,RateTrainer,Attitude,AxisLock,WeakLeveling,VirtualBar,Acro+,Rattitude,
@@ -38,7 +38,7 @@ Item {
property real flight_time: Math.round(systemStats.flightTime / 1000)
property real time_h: (flight_time > 0 ? Math.floor(flight_time / 3600) : 0 )
- property real time_m: (flight_time > 0 ? Math.floor((flight_time - time_h*3600)/60) : 0)
+ property real time_m: (flight_time > 0 ? Math.floor((flight_time - time_h*3600)/60) : 0)
property real time_s: (flight_time > 0 ? Math.floor(flight_time - time_h*3600 - time_m*60) : 0)
SvgElementImage {
@@ -222,8 +222,6 @@ Item {
anchors.fill: parent
color: (flightStatus.flightMode == FlightMode.Manual) ? "grey" : warnings.thrustmodeColors[thrust_mode]
- // Manual,Rate,RateTrainer,Attitude,AxisLock,WeakLeveling,VirtualBar,Acro+,Rattitude,
- // AltitudeHold,AltitudeVario,CruiseControl
// grey : 'disabled' modes
Text {
anchors.centerIn: parent
diff --git a/ground/gcs/src/share/pfd/default/pfd.svg b/ground/gcs/src/share/qml/pfd/pfd.svg
similarity index 100%
rename from ground/gcs/src/share/pfd/default/pfd.svg
rename to ground/gcs/src/share/qml/pfd/pfd.svg
diff --git a/ground/gcs/src/share/qml/uav.js b/ground/gcs/src/share/qml/uav.js
new file mode 100644
index 000000000..5cbae75a7
--- /dev/null
+++ b/ground/gcs/src/share/qml/uav.js
@@ -0,0 +1,43 @@
+// ***********************
+// common.js
+//
+// Common javascript uav utils
+//
+// Librepilot
+// ***********************
+
+Qt.include("common.js")
+
+function attitude() {
+ return Qt.vector3d(attitudeState.pitch, attitudeState.roll, -attitudeState.yaw);
+}
+
+function position() {
+ switch(gpsPositionSensor.status) {
+ case Status.Fix2D:
+ case Status.Fix3D:
+ return gpsPosition();
+ case Status.NoFix:
+ case Status.NoGPS:
+ default:
+ return (homeLocation.set == Set.True) ? homePosition() : defaultPosition();
+ }
+}
+
+function gpsPosition() {
+ return Qt.vector3d(
+ gpsPositionSensor.longitude / 10000000.0,
+ gpsPositionSensor.latitude / 10000000.0,
+ gpsPositionSensor.altitude);
+}
+
+function homePosition() {
+ return Qt.vector3d(
+ homeLocation.longitude / 10000000.0,
+ homeLocation.latitude / 10000000.0,
+ homeLocation.altitude);
+}
+
+function defaultPosition() {
+ return Qt.vector3d(qmlWidget.longitude, qmlWidget.latitude, qmlWidget.altitude);
+}
diff --git a/make/3rdparty/osgearth/README.TXT b/make/3rdparty/osgearth/README.TXT
index d70669d37..5d07eeba9 100644
--- a/make/3rdparty/osgearth/README.TXT
+++ b/make/3rdparty/osgearth/README.TXT
@@ -15,7 +15,7 @@ Linux prerequisites
----------------------------------
$ sudo apt-get install libzip-dev libpng-dev lipjpeg-dev libtiff5-dev libcurl4-openssl-dev
-$ sudo apt-get install libgeos++-dev libgdal-dev
+$ sudo apt-get install libgeos++-dev libgdal-dev
Alternative (not tested recently but could work):
$ sudo apt-get build-dep openscenegraph
@@ -38,9 +38,26 @@ brew install gdal
Windows prerequisites
----------------------------------
-Windows requires many libraries to be build.
-See osg_win.sh for more details.
+pacman -S mingw-w64-i686-cmake mingw-w64-i686-gdal-minimal
+To build minimal gdal
+
+From a MSYS shell:
+
+$ pacman -S base-devel
+
+Follow these instructions : http://sourceforge.net/p/msys2/wiki/Contributing%20to%20MSYS2/
+With :
+- LibrePilot package repository : ???
+
+$ pacman -U mingw-w64-i686-gdal-minimal-2.0.1-2-any.pkg.tar.xz
+
+Notes:
+- uninstall any previously installed gdal package.
+
+Todo
+- declare provides= and conflicts with origina gdal in PKGBUILD file
+ (allows to substitute the minimal package when anything depends on the original package)
Building
----------------------------------
diff --git a/make/3rdparty/osgearth/gdal_GNUmakefile_fix.patch b/make/3rdparty/osgearth/gdal_GNUmakefile_fix.patch
deleted file mode 100644
index 98f41527f..000000000
--- a/make/3rdparty/osgearth/gdal_GNUmakefile_fix.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-Index: GNUmakefile
-===================================================================
---- GNUmakefile (revision 22722)
-+++ GNUmakefile (copie de travail)
-@@ -1,13 +1,13 @@
-
- include GDALmake.opt
-
--GDAL_OBJ = $(GDAL_ROOT)/frmts/o/*.o \
-- $(GDAL_ROOT)/gcore/*.o \
-- $(GDAL_ROOT)/port/*.o \
-- $(GDAL_ROOT)/alg/*.o
-+GDAL_OBJ = ./frmts/o/*.o \
-+ ./gcore/*.o \
-+ ./port/*.o \
-+ ./alg/*.o
-
- ifeq ($(OGR_ENABLED),yes)
--GDAL_OBJ += $(GDAL_ROOT)/ogr/ogrsf_frmts/o/*.o
-+GDAL_OBJ += ./ogr/ogrsf_frmts/o/*.o
- endif
-
- include ./ogr/file.lst
-@@ -28,13 +28,8 @@
- $(LD_SHARED) $(GDAL_SLIB_SONAME) $(GDAL_OBJ) $(GDAL_LIBS) $(LDFLAGS) $(LIBS) \
- -o $(GDAL_SLIB)
-
--$(GDAL_LIB): $(GDAL_OBJ) GDALmake.opt
-- rm -f libgdal.a
-- $(AR) r $(GDAL_LIB) $(GDAL_OBJ)
-- $(RANLIB) $(GDAL_LIB)
--
--$(GDAL_SLIB): $(GDAL_OBJ) $(GDAL_LIB)
-- $(LD_SHARED) $(GDAL_SLIB_SONAME) $(GDAL_OBJ) $(GDAL_LIBS) $(LDFLAGS) $(LIBS) \
-+$(GDAL_SLIB): $(GDAL_OBJ)
-+ $(LD_SHARED) $(GDAL_SLIB_SONAME) $(GDAL_OBJ) $(LDFLAGS) $(LIBS) \
- -o $(GDAL_SLIB)
-
- $(LIBGDAL): $(GDAL_OBJ:.o=.lo)
-@@ -47,7 +42,7 @@
- endif
-
- check-lib: port-target core-target frmts-target ogr-target
-- $(MAKE) $(LIBGDAL-yes)
-+ $(MAKE) $(GDAL_SLIB)
-
- port-target:
- (cd port; $(MAKE))
diff --git a/make/3rdparty/osgearth/osg-3.4.patch b/make/3rdparty/osgearth/osg-3.4.patch
index 0b600ded1..e0a6d92ca 100644
--- a/make/3rdparty/osgearth/osg-3.4.patch
+++ b/make/3rdparty/osgearth/osg-3.4.patch
@@ -1,3 +1,15 @@
+diff --git a/include/osg/OperationThread b/include/osg/OperationThread
+index a62157e..75adfba 100644
+--- a/include/osg/OperationThread
++++ b/include/osg/OperationThread
+@@ -80,6 +80,7 @@ protected:
+ _keep(false) {}
+
+ Operation(const Operation& op):
++ Referenced(),
+ _name(op._name),
+ _keep(op._keep) {}
+
diff --git a/include/osgViewer/View b/include/osgViewer/View
index 472b489..07ef9ce 100644
--- a/include/osgViewer/View
diff --git a/make/3rdparty/osgearth/osg_win.sh b/make/3rdparty/osgearth/osg_win.sh
deleted file mode 100644
index ed428b692..000000000
--- a/make/3rdparty/osgearth/osg_win.sh
+++ /dev/null
@@ -1,388 +0,0 @@
-#!/bin/sh -e
-################################################################################
-#
-# This script compiles OSG and OSGEarth dependencies (GDAL, GEOS, ...)
-#
-# Known to work with MSYS 1.0.11
-# A zip file is provided here http://librepilot.github.io/tools/MSYS-1.0.11.zip
-# This zip is based on the official http://downloads.sourceforge.net/mingw/MSYS-1.0.11.exe
-# It was generated by installing MSYS-1.0.11.exe and adding to it:
-# - http://gnuwin32.sourceforge.net/packages/wget.htm
-# - http://gnuwin32.sourceforge.net/packages/libintl.htm
-# - http://gnuwin32.sourceforge.net/packages/libiconv.htm
-# And finally zipping the resulting directory (minus Readme.txt)
-#
-# A good source for building with mingw :
-# http://www.gaia-gis.it/gaia-sins/mingw_how_to.html
-#
-# Sample command line to execute this script from a MS shell :
-# .\tools\msys\bin\sh --login -i -c /d/Projects/LibrePilot/make/3rdparty/osgearth/osg_win.sh
-#
-# Executing this script from git bash does not seem to work.
-#
-################################################################################
-
-# turn -x on if DEBUG is set to a non-empty string
-[ -n "$DEBUG" ] && set -x
-
-################################################################################
-# MinGW
-################################################################################
-
-#MINGW_DIR=D:/Projects/LibrePilotTools/qt-5.4.1/Tools/mingw491_32
-if [ -z "$MINGW_DIR" ]; then
- echo MINGW_DIR not defined. Exiting...
- exit 1
-fi
-
-umount /mingw || true
-mount $MINGW_DIR /mingw
-
-################################################################################
-# Environment
-################################################################################
-
-BASE_DIR=$(dirname $0)
-
-WORK_DIR=$BASE_DIR
-ROOT_DIR=$BASE_DIR/../../..
-
-DOWNLOAD_DIR=$ROOT_DIR/downloads/osg
-SOURCE_DIR=$ROOT_DIR/3rdparty/osg_dependencies
-BUILD_DIR=$ROOT_DIR/build/3rdparty/osg_dependencies
-
-HOST=mingw32
-
-DOWNLOAD_FILES=1
-
-echo Root dir : $ROOT_DIR
-echo Work dir : $WORK_DIR
-echo Build dir : $BUILD_DIR
-echo MinGW dir : $MINGW_DIR
-
-################################################################################
-# download sources
-################################################################################
-
-if [ "$DOWNLOAD_FILES" -eq 1 ]; then
-
-SRC_FILES="
-http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz
-http://zlib.net/zlib-1.2.8.tar.gz
-http://www.ijg.org/files/jpegsrc.v9a.tar.gz
-http://sourceforge.net/projects/libpng/files/libpng16/older-releases/1.6.16/libpng-1.6.16.tar.gz
-ftp://ftp.remotesensing.org/pub/libtiff/tiff-4.0.3.tar.gz
-http://sourceforge.net/projects/freetype/files/freetype2/2.5.3/freetype-2.5.3.tar.gz
-http://curl.haxx.se/download/curl-7.38.0.tar.gz
-http://download.osgeo.org/proj/proj-4.8.0.tar.gz
-http://download.osgeo.org/proj/proj-datumgrid-1.5.tar.gz
-http://download.osgeo.org/geos/geos-3.3.8.tar.bz2
-http://download.osgeo.org/gdal/1.10.1/gdal-1.10.1.tar.gz
-"
-
-mkdir -p $DOWNLOAD_DIR/
-for f in $SRC_FILES
-do
- filename=$(basename "$f")
- if [ ! -f $DOWNLOAD_DIR/$filename ]; then
- echo "****************************************"
- echo "Downloading $filename"
- echo "****************************************"
- wget -P $DOWNLOAD_DIR/ $f
- fi
-done
-
-fi
-
-################################################################################
-# build all
-################################################################################
-
-# list of libraries to build
-# other candidates include bzip2, libxml2, gif, geotiff, ssl, gl...
-BUILD_PKGCONFIG=1
-BUILD_ZLIB=1
-BUILD_LIBJPEG=1
-BUILD_LIBPNG=1
-BUILD_LIBTIFF=1
-BUILD_FREETYPE=1
-BUILD_OPENSSL=2
-BUILD_CURL=1
-BUILD_PROJ4=1
-BUILD_GEOS=1
-BUILD_GDAL=1
-
-# TODO
-# libcurl needs to be built with and ssl support
-# gdal does not seem to link with shared proj4
-
-# Clean src and build dirs
-rm -rf $SOURCE_DIR/*
-rm -rf $BUILD_DIR/*
-
-mkdir -p $SOURCE_DIR/
-mkdir -p $BUILD_DIR/
-mkdir -p $BUILD_DIR/bin/
-mkdir -p $BUILD_DIR/include/
-mkdir -p $BUILD_DIR/lib/
-
-# make sure all libraries see each others
-export PATH=$BUILD_DIR/bin:$PATH
-export CPATH=$BUILD_DIR/include
-export LIBRARY_PATH=$BUILD_DIR/lib
-export PKG_CONFIG_PATH=$BUILD_DIR/lib/pkgconfig
-
-# compiler flags
-export CFLAGS=-O2
-export CXXFLAGS=-O2
-
-################################################################################
-# pkg-config
-# required by libcurl, gdal, osg, osgearth
-################################################################################
-
-if [ "$BUILD_PKGCONFIG" -eq 1 ]; then
-
-echo "****************************************"
-echo "Building pkg-config..."
-echo "****************************************"
-
-cd $SOURCE_DIR
-tar xzf $DOWNLOAD_DIR/pkg-config-0.28.tar.gz -C .
-cd pkg-config-0.28
-
-./configure --prefix=$BUILD_DIR --build=$HOST \
- --with-internal-glib
-make
-make install
-
-fi
-
-################################################################################
-# ZLIB
-# required by libcurl, gdal, osg, osgearth
-################################################################################
-
-if [ "$BUILD_ZLIB" -eq 1 ]; then
-
-echo "****************************************"
-echo "Building zlib..."
-echo "****************************************"
-
-cd $SOURCE_DIR
-tar xzf $DOWNLOAD_DIR/zlib-1.2.8.tar.gz -C .
-cd zlib-1.2.8
-
-make -f win32/Makefile.gcc clean
-make -f win32/Makefile.gcc
-
-cp -f zlib1.dll $BUILD_DIR/bin/
-cp -f zconf.h $BUILD_DIR/include/
-cp -f zlib.h $BUILD_DIR/include/
-cp -f libz.a $BUILD_DIR/lib/
-cp -f libz.dll.a $BUILD_DIR/lib/
-
-fi
-
-################################################################################
-# LIBJPEG
-# required by gdal, osg, osgearth
-################################################################################
-
-if [ "$BUILD_LIBJPEG" -eq 1 ]; then
-
-echo "****************************************"
-echo "Building libjpeg..."
-echo "****************************************"
-
-cd $SOURCE_DIR
-tar xzf $DOWNLOAD_DIR/jpegsrc.v9a.tar.gz -C .
-cd jpeg-9a
-
-./configure --prefix=$BUILD_DIR --build=$HOST
-make
-make install-strip
-
-fi
-
-################################################################################
-# LIBPNG
-# required by gdal, osg, osgearth
-################################################################################
-
-if [ "$BUILD_LIBPNG" -eq 1 ]; then
-
-echo "****************************************"
-echo "Building libpng..."
-echo "****************************************"
-
-cd $SOURCE_DIR
-tar xzf $DOWNLOAD_DIR/libpng-1.6.16.tar.gz -C .
-cd libpng-1.6.16
-
-./configure --prefix=$BUILD_DIR --build=$HOST
-make
-make install-strip
-
-fi
-
-################################################################################
-# LIBTIFF
-# reqires zlib
-# required by gdal, osg, osgearth
-################################################################################
-
-if [ "$BUILD_LIBTIFF" -eq 1 ]; then
-
-echo "****************************************"
-echo "Building libtiff..."
-echo "****************************************"
-
-cd $SOURCE_DIR
-tar xzf $DOWNLOAD_DIR/tiff-4.0.3.tar.gz -C .
-cd tiff-4.0.3
-
-./configure --prefix=$BUILD_DIR --build=$HOST
-make
-make install-strip
-
-fi
-
-################################################################################
-# FreeType
-################################################################################
-
-if [ "$BUILD_FREETYPE" -eq 1 ]; then
-
-echo "****************************************"
-echo "Building FreeType..."
-echo "****************************************"
-
-cd $SOURCE_DIR
-tar xzf $DOWNLOAD_DIR/freetype-2.5.3.tar.gz -C .
-cd freetype-2.5.3
-
-./configure --prefix=$BUILD_DIR
-make
-make install
-
-fi
-
-################################################################################
-# OpenSSL
-################################################################################
-
-if [ "$BUILD_OPENSSL" -eq 1 ]; then
-
-echo "****************************************"
-echo "Building OpenSSL..."
-echo "****************************************"
-
-cd $SOURCE_DIR
-tar xzf $DOWNLOAD_DIR/curl-7.38.0.tar.gz -C .
-cd curl-7.38.0
-
-./configure --prefix=$BUILD_DIR --build=$HOST
-make
-make install
-
-fi
-
-################################################################################
-# cURL
-# required by gdal, osgearth
-################################################################################
-
-if [ "$BUILD_CURL" -eq 1 ]; then
-
-echo "****************************************"
-echo "Building cURL..."
-echo "****************************************"
-
-cd $SOURCE_DIR
-tar xzf $DOWNLOAD_DIR/curl-7.38.0.tar.gz -C .
-cd curl-7.38.0
-
-./configure --prefix=$BUILD_DIR --build=$HOST \
- --enable-shared=yes --with-zlib=$BUILD_DIR
-make
-make install-strip
-
-fi
-
-################################################################################
-# PROJ.4
-# required by osgearth
-################################################################################
-
-if [ "$BUILD_PROJ4" -eq 1 ]; then
-
-echo "****************************************"
-echo "Building PROJ.4..."
-echo "****************************************"
-
-cd $SOURCE_DIR
-tar -xzf $DOWNLOAD_DIR/proj-4.8.0.tar.gz -C .
-tar -xzf $DOWNLOAD_DIR/proj-datumgrid-1.5.tar.gz -C proj-4.8.0/nad/
-cd proj-4.8.0
-
-./configure --prefix=$BUILD_DIR --build=$HOST \
- --enable-static=no --enable-shared=yes
-make
-make install
-
-fi
-
-################################################################################
-# GEOS
-# required by gdal
-################################################################################
-
-if [ "$BUILD_GEOS" -eq 1 ]; then
-
-echo "****************************************"
-echo "Building GEOS..."
-echo "****************************************"
-
-cd $SOURCE_DIR
-tar xjf $DOWNLOAD_DIR/geos-3.3.8.tar.bz2 -C .
-cd geos-3.3.8
-
-# TODO why --disable-inline?
-./configure --prefix=$BUILD_DIR --build=$HOST \
- --enable-static=no --enable-shared=yes --disable-inline
-make
-make install
-
-fi
-
-################################################################################
-# GDAL
-# requires zlib, libcurl, libpng, libjpeg, libtiff, geos
-# required by osgearth
-################################################################################
-
-if [ "$BUILD_GDAL" -eq 1 ]; then
-
-echo "****************************************"
-echo "Building GDAL..."
-echo "****************************************"
-
-cd $SOURCE_DIR
-tar xzf $DOWNLOAD_DIR/gdal-1.10.1.tar.gz -C .
-cd gdal-1.10.1
-
-# fix GNUmakefile as described here http://trac.osgeo.org/gdal/wiki/BuildingWithMinGW
-patch < $WORK_DIR/gdal_GNUmakefile_fix.patch
-
-./configure --prefix=$BUILD_DIR --build=$HOST \
- --without-python --without-libtool \
- --with-xerces=no \
- --with-libz=$BUILD_DIR --with-curl=$BUILD_DIR \
- --with-png=$BUILD_DIR --with-jpeg=$BUILD_DIR --with-libtiff=$BUILD_DIR \
- --with-geos=$BUILD_DIR/bin/geos-config
-make
-make install
-
-fi
-
diff --git a/make/3rdparty/osgearth/osgearth-2.7.patch b/make/3rdparty/osgearth/osgearth-2.7.patch
new file mode 100644
index 000000000..690eae3af
--- /dev/null
+++ b/make/3rdparty/osgearth/osgearth-2.7.patch
@@ -0,0 +1,13 @@
+diff --git a/src/osgEarthSymbology/Resource b/src/osgEarthSymbology/Resource
+index a8a1441..934fc7d 100644
+--- a/src/osgEarthSymbology/Resource
++++ b/src/osgEarthSymbology/Resource
+@@ -33,7 +33,7 @@ namespace osgEarth { namespace Symbology
+ class OSGEARTHSYMBOLOGY_EXPORT Resource : public Taggable
+ {
+ protected:
+- Resource(const Resource& rhs,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) {};
++ Resource(const Resource& rhs,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) : Taggable() {};
+ Resource( const Config& config =Config() );
+
+ /** dtor */
diff --git a/make/3rdparty/osgearth/osgearth.mk b/make/3rdparty/osgearth/osgearth.mk
index 4f03c216d..fd1e6a490 100644
--- a/make/3rdparty/osgearth/osgearth.mk
+++ b/make/3rdparty/osgearth/osgearth.mk
@@ -2,73 +2,19 @@
# Targets to build osg and osgearth
#
################################
-# Linux prerequisites
-################################
-#
-# Install development libraries for:
-# - zlib
-# - jpeg
-# - png
-# - tiff
-# - curl
-# - geos
-# - gdal
-#
-# $ sudo apt-get install libzip-dev libpng-dev lipjpeg-dev libtiff5-dev libcurl4-openssl-dev libgeos++-dev libgdal-dev
-#
-# Alternative (not tested)
-# $ sudo apt-get build-dep openscenegraph
-#
-# $ curl --version
-# curl 7.35.0 (i686-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
-# Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp
-# Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
-#
-# $ gdal-config --version
-# 1.10.1
-#
-# If using Qt 5.3.1, you'll need to workaround this issue : https://bugreports.qt-project.org/browse/QTBUG-39859
-# by editing the file : ./tool/qt-5.3.1/5.3/gcc/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake
-# and commenting out this line : _qt5gui_find_extra_libs(EGL "EGL" "" "/usr/include/libdrm")
-#
-################################
-# Windows prerequisites
-################################
-#
-# Windows versions of osg and osgearth require many additional libraries to be build
-# See osg_win.sh
-#
-################################
-# OSX prerequisites
-################################
-#
-# brew install cmake
-# brew install gdal
-#
-################################
-# Building
-################################
#
# $ make all_osg
#
# This will:
# - clone the git repositories into the ./3rdparty directory
-# - build osg in the build directory, building steps are : cmake, make, make install
-# - intall osg in the build directory
-# - create distribution files in the build directory
-# - TODO: upload distribution files to the wiki download page
-#
-################################
-# Todo
-# - install osgearth in osg (a minor issue in the osgearth cmake file prevents it)
-# easy to fix then set INSTALL_TO_OSG_DIR=ON when running cmake on osgearth
-# - don't build osg deprecated code (if we don't use it...)
-# - add targets to upload distribution files to wiki.
-# - provide complete list of dependencies for osg and osgearth (current list is most probably incomplete as I already had some stuff installed)
+# - build osg in the build/3rdparty directory
+# - intall osg in the build/3rdparty/install directory
+# - create distribution files (tar.gz and md5) in the build/3rdparty/install directory
+# - [TODO] upload distribution files to the librepilot tools repository
#
################################
-# TODO should be discovered
+# [TODO] should be discovered
QT_VERSION := 5.5.1
################################
@@ -104,22 +50,23 @@ ifeq ($(UNAME), Linux)
OSG_NAME := $(OSG_BASE_NAME)-linux-x86
endif
OSG_CMAKE_GENERATOR := "Unix Makefiles"
+ OSG_CMAKE_MAKE_PROGRAM := make
OSG_WINDOWING_SYSTEM := "X11"
# for some reason Qt is not added to the path in make/tools.mk
OSG_BUILD_PATH := $(QT_SDK_PREFIX)/bin:$(PATH)
else ifeq ($(UNAME), Darwin)
OSG_NAME := $(OSG_BASE_NAME)-clang_64
OSG_CMAKE_GENERATOR := "Unix Makefiles"
+ OSG_CMAKE_MAKE_PROGRAM := make
OSG_WINDOWING_SYSTEM := "Cocoa"
OSG_BUILD_PATH := $(QT_SDK_PREFIX)/bin:$(PATH)
else ifeq ($(UNAME), Windows)
OSG_NAME := $(OSG_BASE_NAME)-$(QT_SDK_ARCH)
OSG_CMAKE_GENERATOR := "MinGW Makefiles"
- # CMake is quite picky about its PATH and will complain if sh.exe is found in it
- OSG_BUILD_PATH := $(MINGW_DIR)/bin:$(QT_SDK_PREFIX)/bin
+ OSG_CMAKE_MAKE_PROGRAM := /mingw32/bin/mingw32-make
endif
-OSG_NAME := $(OSG_NAME_PREFIX)$(OSG_NAME)$(OSG_NAME_SUFIX)
+OSG_NAME := $(OSG_NAME_PREFIX)$(OSG_NAME)$(OSG_NAME_SUFIX)
OSG_SRC_DIR := $(ROOT_DIR)/3rdparty/osg
OSG_BUILD_DIR := $(BUILD_DIR)/3rdparty/$(OSG_NAME)
OSG_INSTALL_DIR := $(BUILD_DIR)/3rdparty/install/$(OSG_NAME)
@@ -130,15 +77,17 @@ osg:
@$(ECHO) "Building osg $(call toprel, $(OSG_SRC_DIR)) into $(call toprel, $(OSG_BUILD_DIR))"
$(V1) $(MKDIR) -p $(OSG_BUILD_DIR)
$(V1) ( $(CD) $(OSG_BUILD_DIR) && \
- PATH=$(OSG_BUILD_PATH) && \
+ if [ -n "$(OSG_BUILD_PATH)" ]; then \
+ PATH=$(OSG_BUILD_PATH) ; \
+ fi ; \
$(CMAKE) -G $(OSG_CMAKE_GENERATOR) -DCMAKE_BUILD_TYPE=$(OSG_BUILD_CONF) \
+ -DCMAKE_MAKE_PROGRAM=$(OSG_CMAKE_MAKE_PROGRAM) \
-DOSG_USE_QT=ON \
-DBUILD_OSG_APPLICATIONS=ON \
-DBUILD_OSG_EXAMPLES=OFF \
-DBUILD_OPENTHREADS_WITH_QT=OFF \
-DOSG_GL3_AVAILABLE=OFF \
-DOSG_PLUGIN_SEARCH_INSTALL_DIR_FOR_PLUGINS=OFF \
- -DCMAKE_PREFIX_PATH=$(BUILD_DIR)/3rdparty/osg_dependencies \
-DCMAKE_OSX_ARCHITECTURES="x86_64" \
-DOSG_WINDOWING_SYSTEM=$(OSG_WINDOWING_SYSTEM) \
-DCMAKE_INSTALL_NAME_DIR=@executable_path/../Plugins \
@@ -160,8 +109,31 @@ package_osg:
.PHONY: install_win_osg
install_win_osg:
- $(V1) $(CP) $(BUILD_DIR)/3rdparty/osg_dependencies/bin/*.dll $(OSG_INSTALL_DIR)/bin/
- $(V1) $(CP) $(BUILD_DIR)/3rdparty/osg_dependencies/lib/*.dll $(OSG_INSTALL_DIR)/bin/
+ # curl
+ $(V1) $(CP) /mingw32/bin/libcurl-4.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/libidn-11.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/librtmp-1.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/libgmp-10.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/libgnutls-30.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/libp11-kit-0.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/libffi-6.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/libtasn1-6.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/libhogweed-4-1.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/libnettle-6-1.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/libssh2-1.dll $(OSG_INSTALL_DIR)/bin/
+ # gdal
+ $(V1) $(CP) /mingw32/bin/libgdal-20.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/libgeos_c.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/libgeos.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/libjpeg-8.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/libtiff-5.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/liblzma-5.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/libiconv-2.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/zlib1.dll $(OSG_INSTALL_DIR)/bin/
+ # other
+ $(V1) $(CP) /mingw32/bin/libproj-9.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/libfreetype-6.dll $(OSG_INSTALL_DIR)/bin/
+ $(V1) $(CP) /mingw32/bin/libpng16-16.dll $(OSG_INSTALL_DIR)/bin/
.NOTPARALLEL:
.PHONY: prepare_osg
@@ -223,6 +195,7 @@ ifeq ($(UNAME), Linux)
OSGEARTH_NAME := $(OSGEARTH_BASE_NAME)-linux-x86
endif
OSGEARTH_CMAKE_GENERATOR := "Unix Makefiles"
+ OSGEARTH_CMAKE_MAKE_PROGRAM := make
# for some reason Qt is not added to the path in make/tools.mk
OSGEARTH_BUILD_PATH := $(QT_SDK_PREFIX)/bin:$(OSG_INSTALL_DIR)/bin:$(PATH)
ifeq ($(ARCH), x86_64)
@@ -233,23 +206,20 @@ ifeq ($(UNAME), Linux)
else ifeq ($(UNAME), Darwin)
OSGEARTH_NAME := $(OSGEARTH_BASE_NAME)-clang_64
OSGEARTH_CMAKE_GENERATOR := "Unix Makefiles"
- OSG_WINDOWING_SYSTEM := "Cocoa"
+ OSGEARTH_CMAKE_MAKE_PROGRAM := make
OSGEARTH_BUILD_PATH := $(QT_SDK_PREFIX)/bin:$(OSG_INSTALL_DIR)/bin:$(PATH)
OSGEARTH_LIB_PATH := $(OSG_INSTALL_DIR)/lib
else ifeq ($(UNAME), Windows)
OSGEARTH_NAME := $(OSGEARTH_BASE_NAME)-$(QT_SDK_ARCH)
OSGEARTH_CMAKE_GENERATOR := "MinGW Makefiles"
- # CMake is quite picky about its PATH and will complain if sh.exe is found in it
- OSGEARTH_BUILD_PATH := $(MINGW_DIR)/bin:$(QT_SDK_PREFIX)/bin:$(OSG_INSTALL_DIR)/bin
+ OSGEARTH_CMAKE_MAKE_PROGRAM := /mingw32/bin/mingw32-make
OSGEARTH_LIB_PATH := $(OSG_INSTALL_DIR)/lib
endif
-OSGEARTH_NAME := $(OSG_NAME_PREFIX)$(OSGEARTH_NAME)$(OSG_NAME_SUFIX)
+OSGEARTH_NAME := $(OSG_NAME_PREFIX)$(OSGEARTH_NAME)$(OSG_NAME_SUFIX)
OSGEARTH_SRC_DIR := $(ROOT_DIR)/3rdparty/osgearth
OSGEARTH_BUILD_DIR := $(BUILD_DIR)/3rdparty/$(OSGEARTH_NAME)
-# osgearth will be installed into osg (there is an official option to do that but it seems broken on mingw)
-#OSGEARTH_INSTALL_DIR := $(BUILD_DIR)/3rdparty/install/$(OSGEARTH_NAME)
-OSGEARTH_INSTALL_DIR := $(OSG_INSTALL_DIR)
+OSGEARTH_INSTALL_DIR := $(BUILD_DIR)/3rdparty/install/$(OSGEARTH_NAME)
OSGEARTH_PATCH_FILE := $(ROOT_DIR)/make/3rdparty/osgearth/osgearth-$(OSGEARTH_VERSION).patch
.PHONY: osgearth
@@ -257,19 +227,21 @@ osgearth:
@$(ECHO) "Building osgEarth $(call toprel, $(OSGEARTH_SRC_DIR)) into $(call toprel, $(OSGEARTH_BUILD_DIR))"
$(V1) $(MKDIR) -p $(OSGEARTH_BUILD_DIR)
$(V1) ( $(CD) $(OSGEARTH_BUILD_DIR) && \
- PATH=$(OSGEARTH_BUILD_PATH) && \
+ if [ -n "$(OSGEARTH_BUILD_PATH)" ]; then \
+ PATH=$(OSGEARTH_BUILD_PATH) ; \
+ fi ; \
LD_LIBRARY_PATH=$(OSGEARTH_LIB_PATH) && \
export DYLD_LIBRARY_PATH=$(OSGEARTH_LIB_PATH) && \
unset OSG_NOTIFY_LEVEL && \
$(CMAKE) -G $(OSGEARTH_CMAKE_GENERATOR) -DCMAKE_BUILD_TYPE=$(OSGEARTH_BUILD_CONF) \
+ -DCMAKE_MAKE_PROGRAM=$(OSGEARTH_CMAKE_MAKE_PROGRAM) \
-DOSGEARTH_USE_QT=ON \
-DINSTALL_TO_OSG_DIR=OFF \
-DOSG_DIR=$(OSG_INSTALL_DIR) \
-DCMAKE_INCLUDE_PATH=$(OSG_INSTALL_DIR)/include \
- -DCMAKE_LIBRARY_PATH=$(OSG_INSTALL_DIR)/lib \
- -DCMAKE_PREFIX_PATH=$(BUILD_DIR)/3rdparty/osg_dependencies \
+ -DCMAKE_LIBRARY_PATH=$(OSGEARTH_LIB_PATH) \
+ -DCMAKE_PREFIX_PATH=$(OSGEARTH_LIB_PATH) \
-DCMAKE_OSX_ARCHITECTURES="x86_64" \
- -DOSG_WINDOWING_SYSTEM=$(OSG_WINDOWING_SYSTEM) \
-DCMAKE_INSTALL_NAME_DIR=@executable_path/../Plugins \
-DCMAKE_INSTALL_PREFIX=$(OSGEARTH_INSTALL_DIR) $(OSGEARTH_SRC_DIR) && \
$(MAKE) && \
@@ -328,7 +300,7 @@ clean_all_osgearth: clean_osgearth
.PHONY: all_osg
ifeq ($(UNAME), Windows)
-all_osg: prepare_osg prepare_osgearth osg osgearth install_win_osg package_osg
+all_osg: prepare_osg prepare_osgearth osg osgearth install_win_osg package_osg package_osgearth
else
-all_osg: prepare_osg prepare_osgearth osg osgearth package_osg
+all_osg: prepare_osg prepare_osgearth osg osgearth package_osg package_osgearth
endif
diff --git a/make/functions.mk b/make/functions.mk
index 5b39e23b5..9054524fa 100644
--- a/make/functions.mk
+++ b/make/functions.mk
@@ -16,6 +16,20 @@
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
+# Make sure we know few things about the architecture before including
+# the tools.mk to ensure that we download/install the right tools.
+UNAME := $(shell uname)
+# Here and everywhere if not Linux or Mac then assume Windows
+ifeq ($(filter Linux Darwin, $(UNAME)), )
+ UNAME := Windows
+endif
+
+ifeq ($(UNAME),Windows)
+ system_path = $(shell cygpath -w $(1))
+else
+ system_path = $(1)
+endif
+
# Function for converting Windows style slashes into Unix style
slashfix = $(subst \,/,$(1))
@@ -36,3 +50,4 @@ endef
smallify = $(subst $(SPACE),-,$(call lc,$1))
+get_arch = $(shell $(CC) -dumpmachine | sed s/-.*//)
diff --git a/make/scripts/version-info.py b/make/scripts/version-info.py
index 140ec7c85..d8b19b05f 100644
--- a/make/scripts/version-info.py
+++ b/make/scripts/version-info.py
@@ -195,6 +195,25 @@ class Repo:
except:
return None
+ def version_four_num(self):
+ """Return package version in format X.X.X.X using only numbers"""
+
+ try:
+ (release, junk, candidate) = self._last_tag.partition("-RC")
+ (year, dot, month_and_patch) = release.partition(".")
+ (month, dot, patch) = month_and_patch.partition(".")
+
+ if candidate == "":
+ candidate = "64" # Need to stay below 65536 for last part
+
+ if patch == "":
+ patch = "0"
+
+ return "{}.{}.{}.{}{:0>3.3}".format(year,month,patch,candidate,self._num_commits_past_tag)
+ except:
+ return None
+
+
def revision(self):
"""Return full revison string (tag if defined, or branch:hash date time if no tag)"""
try:
@@ -463,6 +482,7 @@ string given.
TAG_OR_BRANCH = r.tag(r.branch('unreleased')),
TAG_OR_HASH8 = r.tag(r.hash(8, 'untagged')),
LABEL = r.label(),
+ VERSION_FOUR_NUM = r.version_four_num(),
REVISION = r.revision(),
DIRTY = r.dirty(),
FWTAG = xtrim(r.tag(r.branch('unreleased')), r.dirty(), 25),
diff --git a/make/tools.mk b/make/tools.mk
index 881813c99..c61fcb64a 100644
--- a/make/tools.mk
+++ b/make/tools.mk
@@ -92,11 +92,13 @@ ifeq ($(UNAME), Linux)
QT_SDK_MD5_URL := http://download.qt.io/official_releases/qt/5.5/5.5.1/qt-opensource-linux-x64-5.5.1.run.md5
QT_SDK_ARCH := gcc_64
OSG_URL := http://librepilot.github.io/tools/osg-3.4-linux-x64-qt-5.5.1.tar.gz
+ OSGEARTH_URL := http://librepilot.github.io/tools/osgearth-2.7-linux-x64-qt-5.5.1.tar.gz
else
QT_SDK_URL := http://download.qt.io/official_releases/qt/5.5/5.5.1/qt-opensource-linux-x86-5.5.1.run
QT_SDK_MD5_URL := http://download.qt.io/official_releases/qt/5.5/5.5.1/qt-opensource-linux-x86-5.5.1.run.md5
QT_SDK_ARCH := gcc
OSG_URL := http://librepilot.github.io/tools/osg-3.4-linux-x86-qt-5.5.1.tar.gz
+ OSGEARTH_URL := http://librepilot.github.io/tools/osgearth-2.7-linux-x86-qt-5.5.1.tar.gz
endif
UNCRUSTIFY_URL := http://librepilot.github.io/tools/uncrustify-0.60.tar.gz
DOXYGEN_URL := http://librepilot.github.io/tools/doxygen-1.8.3.1.src.tar.gz
@@ -109,6 +111,7 @@ else ifeq ($(UNAME), Darwin)
UNCRUSTIFY_URL := http://librepilot.github.io/tools/uncrustify-0.60.tar.gz
DOXYGEN_URL := http://librepilot.github.io/tools/doxygen-1.8.3.1.src.tar.gz
OSG_URL := http://librepilot.github.io/tools/osg-3.4-clang_64-qt-5.5.1.tar.gz
+ OSGEARTH_URL := http://librepilot.github.io/tools/osgearth-2.7-clang_64-qt-5.5.1.tar.gz
else ifeq ($(UNAME), Windows)
QT_SDK_URL := http://download.qt.io/official_releases/qt/5.5/5.5.1/qt-opensource-windows-x86-mingw492-5.5.1.exe
QT_SDK_MD5_URL := http://download.qt.io/official_releases/qt/5.5/5.5.1/qt-opensource-windows-x86-mingw492-5.5.1.exe.md5
@@ -119,10 +122,8 @@ else ifeq ($(UNAME), Windows)
UNCRUSTIFY_URL := http://librepilot.github.io/tools/uncrustify-0.60-windows.tar.bz2
DOXYGEN_URL := http://librepilot.github.io/tools/doxygen-1.8.3.1-windows.tar.bz2
MESAWIN_URL := http://librepilot.github.io/tools/mesawin.tar.gz
- CMAKE_URL := http://www.cmake.org/files/v2.8/cmake-2.8.12.2-win32-x86.zip
- CMAKE_MD5_URL := http://librepilot.github.io/tools/cmake-2.8.12.2-win32-x86.zip.md5
- MSYS_URL := http://librepilot.github.io/tools/MSYS-1.0.11.zip
OSG_URL := http://librepilot.github.io/tools/osg-3.4-mingw492_32-qt-5.5.1.tar.gz
+ OSGEARTH_URL := http://librepilot.github.io/tools/osgearth-2.7-mingw492_32-qt-5.5.1.tar.gz
endif
GTEST_URL := http://librepilot.github.io/tools/gtest-1.6.0.zip
@@ -138,12 +139,15 @@ OSG_TOOLS_DIR := $(TOOLS_DIR)
ifeq ($(UNAME), Linux)
ifeq ($(ARCH), x86_64)
- OSG_SDK_DIR := $(OSG_TOOLS_DIR)/osg-3.4-linux-x64-qt-5.5.1
+ OSG_SDK_DIR := $(OSG_TOOLS_DIR)/osg-3.4-linux-x64-qt-5.5.1
+ OSGEARTH_SDK_DIR := $(OSG_TOOLS_DIR)/osgearth-2.7-linux-x64-qt-5.5.1
else
- OSG_SDK_DIR := $(OSG_TOOLS_DIR)/osg-3.4-linux-x86-qt-5.5.1
+ OSG_SDK_DIR := $(OSG_TOOLS_DIR)/osg-3.4-linux-x86-qt-5.5.1
+ OSGEARTH_SDK_DIR := $(OSG_TOOLS_DIR)/osgearth-2.7-linux-x86-qt-5.5.1
endif
else ifeq ($(UNAME), Darwin)
- OSG_SDK_DIR := $(OSG_TOOLS_DIR)/osg-3.4-clang_64-qt-5.5.1
+ OSG_SDK_DIR := $(OSG_TOOLS_DIR)/osg-3.4-clang_64-qt-5.5.1
+ OSGEARTH_SDK_DIR := $(OSG_TOOLS_DIR)/osgearth-2.7-clang_64-qt-5.5.1
else ifeq ($(UNAME), Windows)
MINGW_DIR := $(QT_SDK_DIR)/Tools/$(QT_SDK_ARCH)
# When changing PYTHON_DIR, you must also update it in ground/gcs/src/python.pri
@@ -153,9 +157,8 @@ else ifeq ($(UNAME), Windows)
SDL_DIR := $(TOOLS_DIR)/SDL-1.2.15
OPENSSL_DIR := $(TOOLS_DIR)/openssl-1.0.1e-win32
MESAWIN_DIR := $(TOOLS_DIR)/mesawin
- CMAKE_DIR := $(TOOLS_DIR)/cmake-2.8.12.2-win32-x86
- MSYS_DIR := $(TOOLS_DIR)/msys
OSG_SDK_DIR := $(OSG_TOOLS_DIR)/osg-3.4-mingw492_32-qt-5.5.1
+ OSGEARTH_SDK_DIR := $(OSG_TOOLS_DIR)/osgearth-2.7-mingw492_32-qt-5.5.1
endif
QT_SDK_PREFIX := $(QT_SDK_DIR)
@@ -166,9 +169,11 @@ QT_SDK_PREFIX := $(QT_SDK_DIR)
#
##############################
-BUILD_SDK_TARGETS := arm_sdk qt_sdk osg
+BUILD_SDK_TARGETS := arm_sdk osg
ifeq ($(UNAME), Windows)
- BUILD_SDK_TARGETS += sdl nsis mesawin openssl ccache
+ BUILD_SDK_TARGETS += nsis osgearth
+else
+ BUILD_SDK_TARGETS += qt_sdk
endif
ALL_SDK_TARGETS := $(BUILD_SDK_TARGETS) gtest uncrustify doxygen
@@ -210,6 +215,7 @@ JAVAC := javac
JAR := jar
CD := cd
GREP := grep
+CMAKE := cmake
ifneq ($(UNAME), Windows)
SEVENZIP := 7za
else
@@ -816,27 +822,6 @@ export GTEST_DIR
gtest_version:
-$(V1) $(SED) -n "s/^PACKAGE_STRING='\(.*\)'/\1/p" < $(GTEST_DIR)/configure
-##############################
-#
-# CMake
-#
-##############################
-
-$(eval $(call TOOL_INSTALL_TEMPLATE,cmake,$(CMAKE_DIR),$(CMAKE_URL),$(CMAKE_MD5_URL),$(notdir $(CMAKE_URL))))
-
-ifeq ($(shell [ -d "$(CMAKE_DIR)" ] && $(ECHO) "exists"), exists)
- export CMAKE := $(CMAKE_DIR)/bin/cmake
- export PATH := $(CMAKE_DIR)/bin:$(PATH)
-else
- # not installed, hope it's in the path...
- #$(info $(EMPTY) WARNING $(call toprel, $(CMAKE_DIR)) not found (make cmake_install), using system PATH)
- export CMAKE := cmake
-endif
-
-.PHONY: cmake_version
-cmake_version:
- -$(V1) $(CMAKE) --version
-
##############################
#
# CCACHE
@@ -875,28 +860,6 @@ endef
$(eval $(call TOOL_INSTALL_TEMPLATE,ccache,$(CCACHE_BUILD_DIR),$(CCACHE_URL),$(CCACHE_MD5_URL),$(notdir $(CCACHE_URL)),$(CCACHE_BUILD_TEMPLATE),$(CCACHE_CLEAN_TEMPLATE)))
-##############################
-#
-# MSYS
-#
-##############################
-
-ifeq ($(UNAME), Windows)
-
-$(eval $(call TOOL_INSTALL_TEMPLATE,msys,$(MSYS_DIR),$(MSYS_URL),,$(notdir $(MSYS_URL))))
-
-ifeq ($(shell [ -d "$(MSYS_DIR)" ] && $(ECHO) "exists"), exists)
- export MSYS_DIR
-else
- # not installed, hope it's in the path...
- #$(info $(EMPTY) WARNING $(call toprel, $(MSYS_DIR)) not found (make msys_install), using system PATH)
-endif
-
-.PHONY: msys_version
-msys_version:
-
-endif
-
##############################
#
# osg
@@ -915,7 +878,25 @@ endif
.PHONY: osg_version
osg_version:
-$(V1) $(ECHO) "`$(OSG_SDK_DIR)/bin/osgversion`"
- -$(V1) $(ECHO) "`$(OSG_SDK_DIR)/bin/osgearth_version`"
+
+##############################
+#
+# osgearth
+#
+##############################
+
+$(eval $(call TOOL_INSTALL_TEMPLATE,osgearth,$(OSGEARTH_SDK_DIR),$(OSGEARTH_URL),,$(notdir $(OSGEARTH_URL))))
+
+ifeq ($(shell [ -d "$(OSGEARTH_SDK_DIR)" ] && $(ECHO) "exists"), exists)
+ export OSGEARTH_SDK_DIR := $(OSGEARTH_SDK_DIR)
+else
+ # not installed, hope it's in the path...
+ $(info $(EMPTY) WARNING $(call toprel, $(OSGEARTH_SDK_DIR)) not found (make osgearth_install), using system PATH)
+endif
+
+.PHONY: osgearth_version
+osgearth_version:
+ -$(V1) $(ECHO) "`$(OSGEARTH_SDK_DIR)/bin/osgearth_version`"
##############################
#
diff --git a/package/Linux.mk b/package/Linux.mk
index 399490d44..72a64510c 100644
--- a/package/Linux.mk
+++ b/package/Linux.mk
@@ -54,9 +54,9 @@ install: uninstall
$(V1) $(MKDIR) -p $(DESTDIR)$(datadir)
$(V1) $(MKDIR) -p $(DESTDIR)$(datadir)/applications
$(V1) $(MKDIR) -p $(DESTDIR)$(datadir)/pixmaps
- $(V1) $(INSTALL) $(BUILD_DIR)/$(GCS_SMALL_NAME)_$(GCS_BUILD_CONF)/bin/$(GCS_SMALL_NAME) $(DESTDIR)$(bindir)
- $(V1) $(INSTALL) $(BUILD_DIR)/$(GCS_SMALL_NAME)_$(GCS_BUILD_CONF)/$(libbasename)/$(GCS_SMALL_NAME) $(DESTDIR)$(libdir)
- $(V1) $(INSTALL) $(BUILD_DIR)/$(GCS_SMALL_NAME)_$(GCS_BUILD_CONF)/share/$(GCS_SMALL_NAME) $(DESTDIR)$(datadir)
+ $(V1) $(INSTALL) $(GCS_DIR)/bin/$(GCS_SMALL_NAME) $(DESTDIR)$(bindir)
+ $(V1) $(INSTALL) $(GCS_DIR)/$(libbasename)/$(GCS_SMALL_NAME) $(DESTDIR)$(libdir)
+ $(V1) $(INSTALL) $(GCS_DIR)/share/$(GCS_SMALL_NAME) $(DESTDIR)$(datadir)
$(V1) $(INSTALL) -T $(ROOT_DIR)/package/linux/gcs.desktop $(DESTDIR)$(datadir)/applications/$(ORG_SMALL_NAME).desktop
$(V1) $(INSTALL) -T $(ROOT_DIR)/ground/gcs/src/plugins/coreplugin/images/$(ORG_SMALL_NAME)_logo_128.png \
$(DESTDIR)$(datadir)/pixmaps/$(ORG_SMALL_NAME).png
diff --git a/package/Windows.mk b/package/Windows.mk
index 705fb186a..ee6e50c0e 100644
--- a/package/Windows.mk
+++ b/package/Windows.mk
@@ -6,31 +6,36 @@ ifndef TOP_LEVEL_MAKEFILE
$(error Top level Makefile must be used to build this target)
endif
-VERSION_CMD := $(VERSION_INFO)
+PACKAGE_EXE := $(BUILD_DIR)/$(PACKAGE_FULL_NAME)_$(ARCH).exe
-NSIS_OPTS := /V3
+NSIS_OPTS := -V3
NSIS_WINX86 := $(ROOT_DIR)/package/winx86
NSIS_SCRIPT := $(NSIS_WINX86)/gcs.nsi
-NSIS_TEMPLATE := $(NSIS_WINX86)/gcs.tpl
-NSIS_HEADER := $(OPGCSSYNTHDIR)/gcs.nsh
+
+ifeq ($(ARCH),x86_64)
+WIN_DEF = -DW64
+endif
.PHONY: package
-package: gcs uavobjects_matlab | $(PACKAGE_DIR)
+package: $(PACKAGE_EXE)
+
+$(PACKAGE_EXE): $(NSIS_SCRIPT) gcs uavobjects_matlab | $(PACKAGE_DIR)
ifneq ($(GCS_BUILD_CONF),release)
# We can only package release builds
$(error Packaging is currently supported for release builds only)
endif
- $(V1) mkdir -p "$(dir $(NSIS_HEADER))"
- $(VERSION_CMD) \
- --template='$(NSIS_TEMPLATE)' \
- --outfile='$(NSIS_HEADER)' \
- ORG_BIG_NAME='$(ORG_BIG_NAME)' \
- GCS_BIG_NAME='$(GCS_BIG_NAME)' \
- GCS_SMALL_NAME='$(GCS_SMALL_NAME)' \
- PACKAGE_LBL='$(PACKAGE_LBL)' \
- PACKAGE_NAME='$(PACKAGE_NAME)' \
- PACKAGE_SEP='$(PACKAGE_SEP)'
$(V1) echo "Building Windows installer, please wait..."
$(V1) echo "If you have a script error in line 1 - use Unicode NSIS 2.46+"
$(V1) echo " http://www.scratchpaper.com"
- $(NSIS) $(NSIS_OPTS) $(NSIS_SCRIPT)
+ $(NSIS) $(NSIS_OPTS) \
+ -DORG_BIG_NAME='$(ORG_BIG_NAME)' \
+ -DGCS_BIG_NAME='$(GCS_BIG_NAME)' \
+ -DGCS_SMALL_NAME='$(GCS_SMALL_NAME)' \
+ -DPACKAGE_LBL='$(PACKAGE_LBL)' \
+ -DVERSION_FOUR_NUM='$(shell $(VERSION_INFO) --format=\$${VERSION_FOUR_NUM})' \
+ -DOUT_FILE='$(call system_path,$(PACKAGE_EXE))' \
+ -DPROJECT_ROOT='$(call system_path,$(ROOT_DIR))' \
+ -DGCS_BUILD_TREE='$(call system_path,$(GCS_DIR))' \
+ -DUAVO_SYNTH_TREE='$(call system_path,$(UAVOBJ_OUT_DIR))' \
+ $(WIN_DEF) \
+ $(NSIS_SCRIPT)
diff --git a/package/winx86/gcs.nsi b/package/winx86/gcs.nsi
index 4f1f5bb14..3d5b1f6f2 100644
--- a/package/winx86/gcs.nsi
+++ b/package/winx86/gcs.nsi
@@ -29,20 +29,19 @@
; Includes
!include "x64.nsh"
-!include "..\..\build\gcs-synthetics\gcs.nsh"
;--------------------------------
; Paths
- ; Tree root locations (relative to this script location)
- !define PROJECT_ROOT "..\.."
!define NSIS_DATA_TREE "."
- !define GCS_BUILD_TREE "..\..\build\${GCS_SMALL_NAME}_release"
- !define UAVO_SYNTH_TREE "..\..\build\uavobject-synthetics"
!define AEROSIMRC_TREE "${GCS_BUILD_TREE}\misc\AeroSIM-RC"
; Default installation folder
- InstallDir "$PROGRAMFILES\${ORG_BIG_NAME}"
+!ifdef W64
+ InstallDir "$PROGRAMFILES64\${ORG_BIG_NAME}"
+!else
+ InstallDir "$PROGRAMFILES32\${ORG_BIG_NAME}"
+!endif
; Get installation folder from registry if available
InstallDirRegKey HKLM "Software\${ORG_BIG_NAME}" "Install Location"
@@ -50,21 +49,15 @@
;--------------------------------
; Version information
- ; Program name and installer file
- !define PRODUCT_NAME "${GCS_BIG_NAME}"
- !define INSTALLER_NAME "${GCS_BIG_NAME} Installer"
+ Name "${GCS_BIG_NAME}"
+ OutFile "${OUT_FILE}"
- Name "${PRODUCT_NAME}"
- OutFile "${PACKAGE_DIR}\..\${OUT_FILE}"
-
- VIProductVersion ${PRODUCT_VERSION}
- VIAddVersionKey "ProductName" "${INSTALLER_NAME}"
- VIAddVersionKey "FileVersion" "${FILE_VERSION}"
- VIAddVersionKey "Comments" "${INSTALLER_NAME}. ${BUILD_DESCRIPTION}"
+ VIProductVersion ${VERSION_FOUR_NUM}
+ VIAddVersionKey "ProductName" "${GCS_BIG_NAME}"
+ VIAddVersionKey "ProductVersion" "${VERSION_FOUR_NUM}"
VIAddVersionKey "CompanyName" "The LibrePilot Team, http://www.librepilot.org"
- VIAddVersionKey "LegalTrademarks" "${PRODUCT_NAME} is a trademark of The LibrePilot Team"
VIAddVersionKey "LegalCopyright" "© 2015 The LibrePilot Team"
- VIAddVersionKey "FileDescription" "${INSTALLER_NAME}"
+ VIAddVersionKey "FileDescription" "${GCS_BIG_NAME} Installer"
;--------------------------------
; Installer interface and base settings
@@ -182,13 +175,6 @@ Section "-Plugins" InSecPlugins
File /r "${GCS_BUILD_TREE}\lib\${GCS_SMALL_NAME}\plugins\*.pluginspec"
SectionEnd
-; Copy OSG libs
-Section "-OsgLibs" InSecOsgLibs
- SectionIn RO
- SetOutPath "$INSTDIR\lib\${GCS_SMALL_NAME}\osg"
- File /r "${GCS_BUILD_TREE}\lib\${GCS_SMALL_NAME}\osg\*.dll"
-SectionEnd
-
; Copy GCS resources
Section "-Resources" InSecResources
SetOutPath "$INSTDIR\share"
@@ -222,7 +208,7 @@ SectionEnd
; Copy Opengl32.dll if needed (disabled by default)
Section /o "Mesa OpenGL driver" InSecInstallOpenGL
SetOutPath "$INSTDIR\bin"
- File /r "${GCS_BUILD_TREE}\bin\opengl32_32\opengl32.dll"
+ File /r "${GCS_BUILD_TREE}\bin\opengl32\opengl32.dll"
SectionEnd
; AeroSimRC plugin files
@@ -236,9 +222,9 @@ Section "Shortcuts" InSecShortcuts
SetOutPath "$INSTDIR"
CreateDirectory "$SMPROGRAMS\${ORG_BIG_NAME}"
CreateShortCut "$SMPROGRAMS\${ORG_BIG_NAME}\${GCS_BIG_NAME}.lnk" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" \
- "" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0 "" "" "${PRODUCT_NAME} ${PRODUCT_VERSION}. ${BUILD_DESCRIPTION}"
+ "" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0
CreateShortCut "$SMPROGRAMS\${ORG_BIG_NAME}\${GCS_BIG_NAME} (clean configuration).lnk" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" \
- "-reset" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0 "" "" "${PRODUCT_NAME} ${PRODUCT_VERSION}. ${BUILD_DESCRIPTION}"
+ "-reset" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0
CreateShortCut "$SMPROGRAMS\${ORG_BIG_NAME}\License.lnk" "$INSTDIR\LICENSE.txt" \
"" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0
CreateShortCut "$SMPROGRAMS\${ORG_BIG_NAME}\ReadMe.lnk" "$INSTDIR\README.txt" \
@@ -254,7 +240,7 @@ Section "Shortcuts" InSecShortcuts
CreateShortCut "$SMPROGRAMS\${ORG_BIG_NAME}\Forums.lnk" "http://forum.librepilot.org" \
"" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0
CreateShortCut "$DESKTOP\${GCS_BIG_NAME}.lnk" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" \
- "" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0 "" "" "${PRODUCT_NAME} ${PRODUCT_VERSION}. ${BUILD_DESCRIPTION}"
+ "" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0
CreateShortCut "$SMPROGRAMS\${ORG_BIG_NAME}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
SectionEnd
diff --git a/package/winx86/gcs.tpl b/package/winx86/gcs.tpl
deleted file mode 100644
index 24067201b..000000000
--- a/package/winx86/gcs.tpl
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# *****************************************************************************
-#
-# @file ${OUTFILENAME}
-# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011-2015.
-# @brief Autogenerated NSIS header file, built using template
-# ${TEMPLATE}
-#
-# @see The GNU Public License (GPL) Version 3
-#
-# *****************************************************************************
-#
-
-; Some names, paths and constants
-!define ORG_BIG_NAME "${ORG_BIG_NAME}"
-!define GCS_BIG_NAME "${GCS_BIG_NAME}"
-!define GCS_SMALL_NAME "${GCS_SMALL_NAME}"
-!define PACKAGE_LBL "${PACKAGE_LBL}"
-!define PACKAGE_NAME "${PACKAGE_NAME}"
-!define PACKAGE_SEP "${PACKAGE_SEP}"
-!define PACKAGE_DIR "..\..\build\package"
-!define FIRMWARE_DIR "firmware"
-!define OUT_FILE "$${PACKAGE_NAME}$${PACKAGE_SEP}$${PACKAGE_LBL}$${PACKAGE_SEP}win32.exe"
-
-; Installer version info
-!define PRODUCT_VERSION "0.0.0.0"
-!define FILE_VERSION "${TAG_OR_BRANCH}:${HASH8}${DIRTY} ${DATETIME}"
-!define BUILD_DESCRIPTION "${PACKAGE_LBL} built from ${ORIGIN}, committed ${DATETIME} as ${HASH}"
diff --git a/tool_install.sh b/tool_install.sh
index 1ad5244f4..ae8aeca9f 100755
--- a/tool_install.sh
+++ b/tool_install.sh
@@ -76,12 +76,7 @@ function download_file
#2 The output directory
function zip_extract
{
- if [ "$uname" = Windows ]
- then
- 7za.exe x -o"$2" "$1"
- else
- unzip "$1" -d "$2"
- fi
+ unzip "$1" -d "$2"
}
## Extracts a 7zip file