Merge remote-tracking branch 'libre/next' into thread/LP-104_LP-196_HoTT_and_Ex.Bus_Support
@ -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.
|
||||
|
152
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 := \
|
||||
<!DOCTYPE RCC><RCC version="1.0"> \
|
||||
<qresource prefix="/firmware"> \
|
||||
$(foreach fw_file, $(OPFW_FILES), <file alias="$(notdir $(fw_file))">$(fw_file)</file>) \
|
||||
$(foreach fw_file, $(OPFW_FILES), <file alias="$(notdir $(fw_file))">$(call system_path,$(fw_file))</file>) \
|
||||
</qresource> \
|
||||
</RCC>
|
||||
|
||||
|
@ -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 \
|
||||
|
@ -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
|
||||
|
@ -12,6 +12,6 @@ SUBDIRS = \
|
||||
qwt \
|
||||
sdlgamepad
|
||||
|
||||
exists( $(OSG_SDK_DIR) ) {
|
||||
osg {
|
||||
SUBDIRS += osgearth
|
||||
}
|
||||
|
@ -26,9 +26,11 @@
|
||||
*/
|
||||
|
||||
#include "opmapwidget.h"
|
||||
#include "waypointitem.h"
|
||||
|
||||
#include <QtGui>
|
||||
#include <QMetaObject>
|
||||
#include "waypointitem.h"
|
||||
#include <QOpenGLWidget>
|
||||
|
||||
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());
|
||||
}
|
||||
|
@ -33,11 +33,7 @@
|
||||
#include "../core/languagetype.h"
|
||||
#include "../core/diagnostics.h"
|
||||
#include "configuration.h"
|
||||
#include <QObject>
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
#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 <QObject>
|
||||
#include "QtSvg/QGraphicsSvgItem"
|
||||
#include "QGraphicsView"
|
||||
|
||||
namespace mapcontrol {
|
||||
class UAVItem;
|
||||
class GPSItem;
|
||||
|
@ -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})
|
||||
}
|
||||
}
|
||||
|
@ -41,10 +41,10 @@
|
||||
|
||||
#include <osgViewer/View>
|
||||
|
||||
#include <osgEarth/GeoData>
|
||||
#include <osgEarth/SpatialReference>
|
||||
#ifdef USE_OSGEARTH
|
||||
#include <osgEarthUtil/EarthManipulator>
|
||||
#include <osgEarthUtil/LogarithmicDepthBuffer>
|
||||
#endif
|
||||
|
||||
#include <QDebug>
|
||||
#include <QThread>
|
||||
@ -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<double>(width) / static_cast<double>(height);
|
||||
osg::Viewport *viewport = camera->getViewport();
|
||||
ar = static_cast<double>(viewport->width()) / static_cast<double>(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<osg::Camera> camera;
|
||||
osg::ref_ptr<CameraUpdateCallback> 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);
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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()
|
||||
{}
|
||||
|
@ -42,9 +42,9 @@
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
#include <osgGA/StateSetManipulator>
|
||||
|
||||
#ifdef USE_OSGEARTH
|
||||
#include <osgEarth/MapNode>
|
||||
#include <osgEarthUtil/AutoClipPlaneHandler>
|
||||
#include <osgEarthUtil/Sky>
|
||||
#endif
|
||||
|
||||
#include <QOpenGLContext>
|
||||
#include <QQuickWindow>
|
||||
@ -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<osgViewer::CompositeViewer> viewer;
|
||||
osg::ref_ptr<osgViewer::CompositeViewer> viewer;
|
||||
osg::ref_ptr<osgViewer::View> view;
|
||||
|
||||
osg::ref_ptr<osg::NodeCallback> cullCallback;
|
||||
|
||||
static osg::ref_ptr<osg::GraphicsContext> dummy;
|
||||
|
||||
static QtKeyboardMap keyMap;
|
||||
@ -332,9 +311,6 @@ public:
|
||||
viewer = new osgViewer::CompositeViewer();
|
||||
viewer->setThreadingModel(osgViewer::ViewerBase::SingleThreaded);
|
||||
|
||||
osg::ref_ptr<osgUtil::IncrementalCompileOperation> 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<osg::GraphicsContext> 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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -38,11 +38,13 @@
|
||||
#include <osg/Notify>
|
||||
#include <osgDB/Registry>
|
||||
|
||||
#ifdef USE_OSGEARTH
|
||||
#include <osgEarth/Version>
|
||||
#include <osgEarth/Cache>
|
||||
#include <osgEarth/Capabilities>
|
||||
#include <osgEarth/Registry>
|
||||
#include <osgEarthDrivers/cache_filesystem/FileSystemCache>
|
||||
#endif
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@ -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<osgDB::SharedStateManager::ShareMode>(shareMode | osgDB::SharedStateManager::SHARE_STATESETS) : shareMode;
|
||||
// shareMode = true ? static_cast<osgDB::SharedStateManager::ShareMode>(shareMode | osgDB::SharedStateManager::SHARE_TEXTURES) : shareMode;
|
||||
// osgDB::Registry::instance()->getOrCreateSharedStateManager()->setShareMode(shareMode);
|
||||
|
||||
// osgDB::Options::CacheHintOptions cacheHintOptions = osgDB::Options::CACHE_NONE;
|
||||
// cacheHintOptions = static_cast<osgDB::Options::CacheHintOptions>(cacheHintOptions | osgDB::Options::CACHE_IMAGES);
|
||||
// cacheHintOptions = static_cast<osgDB::Options::CacheHintOptions>(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)
|
||||
|
@ -1,5 +1,8 @@
|
||||
exists( $(OSG_SDK_DIR) ) {
|
||||
CONFIG += osg
|
||||
osg {
|
||||
DEFINES += USE_OSG
|
||||
LIBS *= -l$$qtLibraryName(GCSOsgEarth)
|
||||
}
|
||||
|
||||
osgearth {
|
||||
DEFINES += USE_OSGEARTH
|
||||
}
|
||||
|
@ -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)
|
||||
|
49
ground/gcs/src/libs/osgearth/osgearth_dependencies.pri
Normal file
@ -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}
|
||||
}
|
||||
}
|
@ -30,6 +30,7 @@
|
||||
#include "utility.h"
|
||||
|
||||
#include <osg/DeleteHandler>
|
||||
#include <osg/Version>
|
||||
#include <osgViewer/GraphicsWindow>
|
||||
|
||||
#include <QOpenGLContext>
|
||||
@ -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
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
#include <osg/NodeCallback>
|
||||
#include <osg/Camera>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/io_utils>
|
||||
#include <osg/ApplicationUsage>
|
||||
#include <osgViewer/Viewer>
|
||||
@ -53,13 +54,17 @@
|
||||
#include <osgText/Font>
|
||||
#include <osgText/Text>
|
||||
#include <osgText/String>
|
||||
#include <osgQt/QFontImplementation>
|
||||
|
||||
#ifdef USE_OSG_QT
|
||||
#include <osgQt/QFontImplementation>
|
||||
#endif // USE_OSG_QT
|
||||
|
||||
#ifdef USE_OSGEARTH
|
||||
#include <osgEarth/Capabilities>
|
||||
#include <osgEarth/CullingUtils>
|
||||
#include <osgEarth/MapNode>
|
||||
#include <osgEarth/SpatialReference>
|
||||
#include <osgEarth/ElevationQuery>
|
||||
#endif // USE_OSGEARTH
|
||||
|
||||
#include <QFont>
|
||||
#include <QKeyEvent>
|
||||
@ -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<osgQtQuick::OSGNode>(uri, maj, min, "OSGNode");
|
||||
qmlRegisterType<osgQtQuick::OSGGroup>(uri, maj, min, "OSGGroup");
|
||||
qmlRegisterType<osgQtQuick::OSGFileNode>(uri, maj, min, "OSGFileNode");
|
||||
qmlRegisterType<osgQtQuick::OSGTransformNode>(uri, maj, min, "OSGTransformNode");
|
||||
qmlRegisterType<osgQtQuick::OSGTextNode>(uri, maj, min, "OSGTextNode");
|
||||
qmlRegisterType<osgQtQuick::OSGCubeNode>(uri, maj, min, "OSGCubeNode");
|
||||
qmlRegisterType<osgQtQuick::OSGViewport>(uri, maj, min, "OSGViewport");
|
||||
qmlRegisterType<osgQtQuick::OSGNode>("OsgQtQuick", maj, min, "OSGNode");
|
||||
|
||||
qmlRegisterType<osgQtQuick::OSGModelNode>(uri, maj, min, "OSGModelNode");
|
||||
qmlRegisterType<osgQtQuick::OSGSkyNode>(uri, maj, min, "OSGSkyNode");
|
||||
qmlRegisterType<osgQtQuick::OSGBackgroundNode>(uri, maj, min, "OSGBackgroundNode");
|
||||
qmlRegisterType<osgQtQuick::OSGCamera>(uri, maj, min, "OSGCamera");
|
||||
qmlRegisterType<osgQtQuick::OSGGroup>("OsgQtQuick", maj, min, "OSGGroup");
|
||||
|
||||
qmlRegisterType<osgQtQuick::OSGFileNode>("OsgQtQuick", maj, min, "OSGFileNode");
|
||||
qmlRegisterType<osgQtQuick::OptimizeMode>("OsgQtQuick", maj, min, "OptimizeMode");
|
||||
|
||||
qmlRegisterType<osgQtQuick::OSGTransformNode>("OsgQtQuick", maj, min, "OSGTransformNode");
|
||||
|
||||
qmlRegisterType<osgQtQuick::OSGTextNode>("OsgQtQuick", maj, min, "OSGTextNode");
|
||||
|
||||
qmlRegisterType<osgQtQuick::OSGCubeNode>("OsgQtQuick", maj, min, "OSGCubeNode");
|
||||
|
||||
qmlRegisterType<osgQtQuick::OSGBackgroundNode>("OsgQtQuick", maj, min, "OSGBackgroundNode");
|
||||
|
||||
qmlRegisterType<osgQtQuick::OSGViewport>("OsgQtQuick", maj, min, "OSGViewport");
|
||||
qmlRegisterType<osgQtQuick::UpdateMode>("OsgQtQuick", maj, min, "UpdateMode");
|
||||
|
||||
qmlRegisterType<osgQtQuick::OSGCamera>("OsgQtQuick", maj, min, "OSGCamera");
|
||||
qmlRegisterType<osgQtQuick::ManipulatorMode>("OsgQtQuick", maj, min, "ManipulatorMode");
|
||||
qmlRegisterType<osgQtQuick::TrackerMode>("OsgQtQuick", maj, min, "TrackerMode");
|
||||
|
||||
#ifdef USE_OSGEARTH
|
||||
qmlRegisterType<osgQtQuick::OSGModelNode>("OsgQtQuick", maj, min, "OSGModelNode");
|
||||
qmlRegisterType<osgQtQuick::OSGSkyNode>("OsgQtQuick", maj, min, "OSGSkyNode");
|
||||
#endif // USE_OSGEARTH
|
||||
}
|
||||
} // namespace osgQtQuick
|
||||
|
@ -33,8 +33,6 @@
|
||||
#include <osg/NodeVisitor>
|
||||
#include <osg/GraphicsContext>
|
||||
|
||||
#include <osgEarth/GeoData>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QOpenGLContext>
|
||||
#include <QSurfaceFormat>
|
||||
@ -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
|
||||
|
@ -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})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>974</width>
|
||||
<width>901</width>
|
||||
<height>755</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -135,9 +135,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>950</width>
|
||||
<height>775</height>
|
||||
<y>-104</y>
|
||||
<width>866</width>
|
||||
<height>767</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
@ -6247,7 +6247,7 @@ Then lower the value by 5 or so.</string>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_12" columnstretch="0,1,0,1,0,1,0">
|
||||
<layout class="QGridLayout" name="gridLayout_12" columnstretch="0,0,0,0,0,0,0,0">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -7357,556 +7357,6 @@ border-radius: 5;</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QLabel" name="label_152">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button">
|
||||
<brush brushstyle="LinearGradientPattern">
|
||||
<gradient startx="0.507000000000000" starty="0.000000000000000" endx="0.507000000000000" endy="0.772000000000000" type="LinearGradient" spread="ReflectSpread" coordinatemode="ObjectBoundingMode">
|
||||
<gradientstop position="0.208955000000000">
|
||||
<color alpha="255">
|
||||
<red>74</red>
|
||||
<green>74</green>
|
||||
<blue>74</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
<gradientstop position="0.786070000000000">
|
||||
<color alpha="255">
|
||||
<red>36</red>
|
||||
<green>36</green>
|
||||
<blue>36</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
</gradient>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>58</red>
|
||||
<green>58</green>
|
||||
<blue>58</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>48</red>
|
||||
<green>48</green>
|
||||
<blue>48</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>19</red>
|
||||
<green>19</green>
|
||||
<blue>19</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>26</red>
|
||||
<green>26</green>
|
||||
<blue>26</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="LinearGradientPattern">
|
||||
<gradient startx="0.507000000000000" starty="0.000000000000000" endx="0.507000000000000" endy="0.772000000000000" type="LinearGradient" spread="ReflectSpread" coordinatemode="ObjectBoundingMode">
|
||||
<gradientstop position="0.208955000000000">
|
||||
<color alpha="255">
|
||||
<red>74</red>
|
||||
<green>74</green>
|
||||
<blue>74</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
<gradientstop position="0.786070000000000">
|
||||
<color alpha="255">
|
||||
<red>36</red>
|
||||
<green>36</green>
|
||||
<blue>36</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
</gradient>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="LinearGradientPattern">
|
||||
<gradient startx="0.507000000000000" starty="0.000000000000000" endx="0.507000000000000" endy="0.772000000000000" type="LinearGradient" spread="ReflectSpread" coordinatemode="ObjectBoundingMode">
|
||||
<gradientstop position="0.208955000000000">
|
||||
<color alpha="255">
|
||||
<red>74</red>
|
||||
<green>74</green>
|
||||
<blue>74</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
<gradientstop position="0.786070000000000">
|
||||
<color alpha="255">
|
||||
<red>36</red>
|
||||
<green>36</green>
|
||||
<blue>36</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
</gradient>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>19</red>
|
||||
<green>19</green>
|
||||
<blue>19</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>220</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button">
|
||||
<brush brushstyle="LinearGradientPattern">
|
||||
<gradient startx="0.507000000000000" starty="0.000000000000000" endx="0.507000000000000" endy="0.772000000000000" type="LinearGradient" spread="ReflectSpread" coordinatemode="ObjectBoundingMode">
|
||||
<gradientstop position="0.208955000000000">
|
||||
<color alpha="255">
|
||||
<red>74</red>
|
||||
<green>74</green>
|
||||
<blue>74</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
<gradientstop position="0.786070000000000">
|
||||
<color alpha="255">
|
||||
<red>36</red>
|
||||
<green>36</green>
|
||||
<blue>36</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
</gradient>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>58</red>
|
||||
<green>58</green>
|
||||
<blue>58</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>48</red>
|
||||
<green>48</green>
|
||||
<blue>48</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>19</red>
|
||||
<green>19</green>
|
||||
<blue>19</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>26</red>
|
||||
<green>26</green>
|
||||
<blue>26</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="LinearGradientPattern">
|
||||
<gradient startx="0.507000000000000" starty="0.000000000000000" endx="0.507000000000000" endy="0.772000000000000" type="LinearGradient" spread="ReflectSpread" coordinatemode="ObjectBoundingMode">
|
||||
<gradientstop position="0.208955000000000">
|
||||
<color alpha="255">
|
||||
<red>74</red>
|
||||
<green>74</green>
|
||||
<blue>74</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
<gradientstop position="0.786070000000000">
|
||||
<color alpha="255">
|
||||
<red>36</red>
|
||||
<green>36</green>
|
||||
<blue>36</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
</gradient>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="LinearGradientPattern">
|
||||
<gradient startx="0.507000000000000" starty="0.000000000000000" endx="0.507000000000000" endy="0.772000000000000" type="LinearGradient" spread="ReflectSpread" coordinatemode="ObjectBoundingMode">
|
||||
<gradientstop position="0.208955000000000">
|
||||
<color alpha="255">
|
||||
<red>74</red>
|
||||
<green>74</green>
|
||||
<blue>74</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
<gradientstop position="0.786070000000000">
|
||||
<color alpha="255">
|
||||
<red>36</red>
|
||||
<green>36</green>
|
||||
<blue>36</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
</gradient>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>19</red>
|
||||
<green>19</green>
|
||||
<blue>19</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>220</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button">
|
||||
<brush brushstyle="LinearGradientPattern">
|
||||
<gradient startx="0.507000000000000" starty="0.000000000000000" endx="0.507000000000000" endy="0.772000000000000" type="LinearGradient" spread="ReflectSpread" coordinatemode="ObjectBoundingMode">
|
||||
<gradientstop position="0.208955000000000">
|
||||
<color alpha="255">
|
||||
<red>74</red>
|
||||
<green>74</green>
|
||||
<blue>74</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
<gradientstop position="0.786070000000000">
|
||||
<color alpha="255">
|
||||
<red>36</red>
|
||||
<green>36</green>
|
||||
<blue>36</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
</gradient>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>58</red>
|
||||
<green>58</green>
|
||||
<blue>58</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>48</red>
|
||||
<green>48</green>
|
||||
<blue>48</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>19</red>
|
||||
<green>19</green>
|
||||
<blue>19</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>26</red>
|
||||
<green>26</green>
|
||||
<blue>26</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="LinearGradientPattern">
|
||||
<gradient startx="0.507000000000000" starty="0.000000000000000" endx="0.507000000000000" endy="0.772000000000000" type="LinearGradient" spread="ReflectSpread" coordinatemode="ObjectBoundingMode">
|
||||
<gradientstop position="0.208955000000000">
|
||||
<color alpha="255">
|
||||
<red>74</red>
|
||||
<green>74</green>
|
||||
<blue>74</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
<gradientstop position="0.786070000000000">
|
||||
<color alpha="255">
|
||||
<red>36</red>
|
||||
<green>36</green>
|
||||
<blue>36</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
</gradient>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="LinearGradientPattern">
|
||||
<gradient startx="0.507000000000000" starty="0.000000000000000" endx="0.507000000000000" endy="0.772000000000000" type="LinearGradient" spread="ReflectSpread" coordinatemode="ObjectBoundingMode">
|
||||
<gradientstop position="0.208955000000000">
|
||||
<color alpha="255">
|
||||
<red>74</red>
|
||||
<green>74</green>
|
||||
<blue>74</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
<gradientstop position="0.786070000000000">
|
||||
<color alpha="255">
|
||||
<red>36</red>
|
||||
<green>36</green>
|
||||
<blue>36</blue>
|
||||
</color>
|
||||
</gradientstop>
|
||||
</gradient>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>39</red>
|
||||
<green>39</green>
|
||||
<blue>39</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>220</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">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;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Yaw</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_153">
|
||||
<property name="sizePolicy">
|
||||
@ -8084,83 +7534,39 @@ border-radius: 5;</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<widget class="QSlider" name="horizontalSlider_84">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><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></string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="sliderPosition">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<item row="1" column="7">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>20</number>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<stringlist>
|
||||
<string>objname:StabilizationSettingsBankX</string>
|
||||
<string>fieldname:YawPI</string>
|
||||
<string>element:Kp</string>
|
||||
<string>scale:0.1</string>
|
||||
<string>haslimits:yes</string>
|
||||
<string>buttongroup:2,10</string>
|
||||
</stringlist>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QSpinBox" name="spinBox_15">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>200</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>200</number>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<stringlist>
|
||||
<string>objname:StabilizationSettingsBankX</string>
|
||||
<string>fieldname:YawPI</string>
|
||||
<string>element:Kp</string>
|
||||
<string>scale:0.1</string>
|
||||
<string>haslimits:yes</string>
|
||||
<string>buttongroup:2,10</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="5">
|
||||
<spacer name="horizontalSpacer_48">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -8168,7 +7574,7 @@ border-radius: 5;</string>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>1</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@ -8367,8 +7773,8 @@ border-radius: 5;</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>950</width>
|
||||
<height>736</height>
|
||||
<width>866</width>
|
||||
<height>697</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_29">
|
||||
@ -17657,8 +17063,8 @@ border-radius: 5;</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>950</width>
|
||||
<height>671</height>
|
||||
<width>879</width>
|
||||
<height>663</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8" stretch="0,0,0,0,0,0">
|
||||
@ -23503,8 +22909,8 @@ font:bold;</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>950</width>
|
||||
<height>671</height>
|
||||
<width>879</width>
|
||||
<height>663</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_18">
|
||||
@ -26749,8 +26155,6 @@ Useful if you have accidentally changed some settings.</string>
|
||||
<tabstop>spinBox_13</tabstop>
|
||||
<tabstop>horizontalSlider_83</tabstop>
|
||||
<tabstop>spinBox_14</tabstop>
|
||||
<tabstop>horizontalSlider_84</tabstop>
|
||||
<tabstop>spinBox_15</tabstop>
|
||||
<tabstop>lowThrottleZeroIntegral_8</tabstop>
|
||||
<tabstop>realTimeUpdates_8</tabstop>
|
||||
<tabstop>scrollArea_2</tabstop>
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <utils/stylehelper.h>
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QDebug>
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include <QDebug>
|
||||
#include <QWidget>
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QMouseEvent>
|
||||
|
||||
/**
|
||||
@ -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);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "lineardialgadgetwidget.h"
|
||||
#include <utils/stylehelper.h>
|
||||
#include <QFileDialog>
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QDebug>
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -54,26 +54,10 @@
|
||||
#include <windows.h>
|
||||
#include <dbt.h>
|
||||
#include <setupapi.h>
|
||||
extern "C"
|
||||
{
|
||||
#include <hidsdi.h>
|
||||
|
||||
// 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)
|
||||
|
||||
|
||||
|
@ -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 <QtCore/qfileinfo.h>
|
||||
#include <QtCore/qthread.h>
|
||||
#include <QtDeclarative/qdeclarative.h>
|
||||
#include <QtDeclarative/qdeclarativeview.h>
|
||||
#include <QtDeclarative/qdeclarativeengine.h>
|
||||
#include <qpainter.h>
|
||||
#include <qvector3d.h>
|
||||
#include <QtOpenGL/qglframebufferobject.h>
|
||||
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/AutoTransform>
|
||||
#include <osg/Camera>
|
||||
#include <osg/TexMat>
|
||||
#include <osg/TextureRectangle>
|
||||
#include <osg/Texture2D>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgEarthUtil/EarthManipulator>
|
||||
#include <osgEarthUtil/ObjectPlacer>
|
||||
#include <osgEarth/Map>
|
||||
|
||||
#include <QtCore/qtimer.h>
|
||||
|
||||
#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<QDeclarativeView *>(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<QGLWidget *>(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();
|
||||
}
|
@ -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 <osgViewer/Viewer>
|
||||
|
||||
#include <QtDeclarative/QDeclarativeItem>
|
||||
#include <osgQt/GraphicsWindowQt>
|
||||
|
||||
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<osgViewer::Viewer> m_viewer;
|
||||
osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> m_gw;
|
||||
osg::ref_ptr<osg::Node> m_model;
|
||||
QWeakPointer<QGLWidget> m_glWidget;
|
||||
|
||||
QGLFramebufferObject *m_fbo[FboCount];
|
||||
int m_lastFboNumber;
|
||||
|
||||
QSize m_currentSize;
|
||||
|
||||
bool m_cameraDirty;
|
||||
};
|
||||
|
||||
QML_DECLARE_TYPE(OsgEarthItem)
|
||||
|
||||
#endif // OSGEARTH_H
|
60
ground/gcs/src/plugins/pfdqml/pfdqml.h
Normal file
@ -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 <QObject>
|
||||
#include <QtQml>
|
||||
|
||||
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<ModelSelectionMode>("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<TimeMode>("Pfd", 1, 0, "TimeMode");
|
||||
}
|
||||
};
|
||||
|
||||
#endif // PFDQML_H_
|
@ -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
|
||||
|
@ -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)
|
||||
|
332
ground/gcs/src/plugins/pfdqml/pfdqmlcontext.cpp
Normal file
@ -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 <QQmlContext>
|
||||
#include <QDebug>
|
||||
|
||||
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<UAVObjectManager>();
|
||||
|
||||
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<UAVObjectManager>();
|
||||
|
||||
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);
|
||||
}
|
140
ground/gcs/src/plugins/pfdqml/pfdqmlcontext.h
Normal file
@ -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_ */
|
@ -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<PfdQmlGadgetConfiguration *>(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);
|
||||
}
|
||||
|
@ -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 <coreplugin/iuavgadget.h>
|
||||
#include "pfdqmlgadgetwidget.h"
|
||||
#include "pfdqmlgadget.h"
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
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_
|
||||
|
@ -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<TimeMode::Enum>(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<ModelSelectionMode::Enum>(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<uint>(m_timeMode));
|
||||
qSettings->setValue("dateTime", m_dateTime);
|
||||
qSettings->setValue("minAmbientLight", m_minAmbientLight);
|
||||
|
||||
// model
|
||||
qSettings->setValue("modelEnabled", m_modelEnabled);
|
||||
qSettings->setValue("modelSelectionMode", static_cast<uint>(m_modelSelectionMode));
|
||||
QString modelFile = Utils::RemoveDataPath(m_modelFile);
|
||||
qSettings->setValue("modelFile", modelFile);
|
||||
|
||||
// background image
|
||||
QString backgroundImageFile = Utils::RemoveDataPath(m_backgroundImageFile);
|
||||
qSettings->setValue("backgroundImageFile", backgroundImageFile);
|
||||
}
|
||||
|
@ -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 <coreplugin/iuavgadgetconfiguration.h>
|
||||
|
||||
#include <QMap>
|
||||
#include <QDateTime>
|
||||
|
||||
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<double, QString> speedMapIterator()
|
||||
{
|
||||
return QMapIterator<double, QString>(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<double, QString> m_speedMap;
|
||||
QMap<double, QString> m_altitudeMap;
|
||||
};
|
||||
|
||||
#endif // PfdQmlGADGETCONFIGURATION_H
|
||||
#endif // PFDQMLGADGETCONFIGURATION_H
|
||||
|
@ -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)
|
||||
|
@ -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_
|
||||
|
@ -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 <QFileDialog>
|
||||
#include <QtAlgorithms>
|
||||
#include <QStringList>
|
||||
|
||||
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<double, QString> 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());
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -20,7 +20,16 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -44,7 +53,16 @@
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -56,7 +74,7 @@
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
@ -78,33 +96,23 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="useOpenGL">
|
||||
<property name="text">
|
||||
<string>Use OpenGL</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Speed Unit:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Altitude Unit:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Speed Unit:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="speedUnitCombo">
|
||||
<widget class="QComboBox" name="altUnitCombo">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
@ -114,7 +122,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="altUnitCombo">
|
||||
<widget class="QComboBox" name="speedUnitCombo">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
@ -126,154 +134,385 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="showTerrain">
|
||||
<property name="title">
|
||||
<string>Show Terrain:</string>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0" colspan="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>OsgEarth file:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Utils::PathChooser" name="earthFile" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QRadioButton" name="useActualLocation">
|
||||
<property name="text">
|
||||
<string>Use actual location</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QRadioButton" name="usePredefinedLocation">
|
||||
<property name="text">
|
||||
<string>Use pre-defined location:</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="3">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Latitude:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="latitude"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Longitude:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="longitude"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Altitude:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="altitude"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="useOnlyCache">
|
||||
<property name="text">
|
||||
<string>Use only cache data</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>74</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QPushButton" name="preSeedTerrain">
|
||||
<property name="text">
|
||||
<string>Pre seed terrain cache</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>Terrain</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="showTerrain">
|
||||
<property name="title">
|
||||
<string>Show Terrain</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Terrain file:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Utils::PathChooser" name="earthFile" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="toolTip">
|
||||
<string>This location will be used if no GPS fix or Home location are available</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Default Location</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Latitude:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="latitude"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Longitude:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="longitude"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Altitude:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="altitude"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="useOnlyCache">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use only cache data</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>74</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="preSeedTerrain">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pre seed terrain cache</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>121</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>Model</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="showModel">
|
||||
<property name="title">
|
||||
<string>Show Model</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="useAutomaticModel">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use automatic model selection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="usePredefinedModel">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use this model:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="Utils::PathChooser" name="modelFile" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Background image:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Utils::PathChooser" name="backgroundImageFile" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>Environment</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Time</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="useLocalTime">
|
||||
<property name="text">
|
||||
<string>Use local time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="usePredefinedTime">
|
||||
<property name="text">
|
||||
<string>Use this time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="dateEdit">
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTimeEdit" name="timeEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="actualizeDateTimeButton">
|
||||
<property name="text">
|
||||
<string>Actualize</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Minimum ambient light:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="minAmbientLightSpinBox">
|
||||
<property name="maximum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.010000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.030000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>121</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -284,75 +523,10 @@
|
||||
<customwidget>
|
||||
<class>Utils::PathChooser</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>utils/pathchooser.h</header>
|
||||
<header location="global">utils/pathchooser.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>usePredefinedLocation</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>latitude</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>167</x>
|
||||
<y>188</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>260</x>
|
||||
<y>222</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>usePredefinedLocation</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>longitude</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>181</x>
|
||||
<y>188</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>282</x>
|
||||
<y>255</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>usePredefinedLocation</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>altitude</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>207</x>
|
||||
<y>188</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>308</x>
|
||||
<y>288</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>useOpenGL</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>showTerrain</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>99</x>
|
||||
<y>57</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>99</x>
|
||||
<y>89</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -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 <QDebug>
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
#include <QtCore/qfileinfo.h>
|
||||
#include <QtCore/qdir.h>
|
||||
#include <QMouseEvent>
|
||||
#include "pfdqmlcontext.h"
|
||||
|
||||
#include "utils/quickwidgetproxy.h"
|
||||
#include "utils/svgimageprovider.h"
|
||||
|
||||
#include <QLayout>
|
||||
#include <QStackedLayout>
|
||||
#include <QQmlEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QDebug>
|
||||
|
||||
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<UAVObjectManager>();
|
||||
m_uavoManager = pm->getObject<UAVObjectManager>();
|
||||
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<OsgEarthItem>("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<QQmlError> 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();
|
||||
}
|
||||
}
|
||||
|
@ -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 <QQuickView>
|
||||
|
||||
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 <QWidget>
|
||||
|
||||
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<QQmlError> 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_ */
|
||||
|
@ -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 <QDebug>
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#ifdef USE_OSG
|
||||
#include <osgearth/osgearth.h>
|
||||
#endif
|
||||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
|
||||
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;
|
||||
|
@ -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_ */
|
||||
|
@ -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
|
||||
|
@ -34,7 +34,6 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QSvgRenderer>
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
#include <QtCore/qfileinfo.h>
|
||||
#include <QtCore/qdir.h>
|
||||
|
||||
|
@ -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";
|
||||
|
@ -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
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <utils/styledbar.h>
|
||||
#include <utils/welcomemodetreewidget.h>
|
||||
#include <utils/iwelcomepage.h>
|
||||
#include <utils/quickwidgetproxy.h>
|
||||
|
||||
#include <QDesktopServices>
|
||||
|
||||
@ -49,7 +50,7 @@
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include <QtQuick>
|
||||
#include <QQuickView>
|
||||
#include <QQuickWidget>
|
||||
#include <QQmlEngine>
|
||||
#include <QQmlContext>
|
||||
|
||||
@ -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
|
||||
|
@ -34,16 +34,14 @@
|
||||
|
||||
#include <coreplugin/imode.h>
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
@ -1542,272 +1542,6 @@
|
||||
</data>
|
||||
</Yaw>
|
||||
</LineardialGadget>
|
||||
<ModelViewGadget>
|
||||
<Aeroquad__PCT__20__PCT__2B>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/multi/aeroquad/aeroquad_+.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Aeroquad__PCT__20__PCT__2B>
|
||||
<CopterControl>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/boards/CopterControl/CopterControl.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</CopterControl>
|
||||
<CC3D>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/boards/CC3D/CC3D.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</CC3D>
|
||||
<Revolution>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/boards/Revolution/revolution.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Revolution>
|
||||
<Blackout_MiniH>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/multi/blackout/BlackoutMiniHQuad.3DS</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Blackout_MiniH>
|
||||
<Zagi>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/planes/zagi/zagi.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Zagi>
|
||||
<Easyquad__PCT__20X>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/multi/easy_quad/easy_quad_X.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Easyquad__PCT__20X>
|
||||
<Easystar>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/planes/Easystar/easystar.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Easystar>
|
||||
<Firecracker>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/planes/firecracker/firecracker.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Firecracker>
|
||||
<Funjet>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/planes/funjet/funjet.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Funjet>
|
||||
<Gaui__PCT__20330X>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/multi/gaui_330x/gaui_330x.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Gaui__PCT__20330X>
|
||||
<Helicopter__PCT__20-__PCT__20TRex__PCT__20450>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/helis/t-rex/t-rex_450_xl.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Helicopter__PCT__20-__PCT__20TRex__PCT__20450>
|
||||
<Hexacopter>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/multi/mikrokopter/MK_Hexa.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Hexacopter>
|
||||
<Joe__PCT__27s__PCT__2014__PCT__22__PCT__20Quad__PCT__20__PCT__2B>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/multi/joes_cnc/J14-Q_+.3DS</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Joe__PCT__27s__PCT__2014__PCT__22__PCT__20Quad__PCT__20__PCT__2B>
|
||||
<Joe__PCT__27s__PCT__2014__PCT__22__PCT__20Quad__PCT__20X__PCT__20>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/multi/joes_cnc/J14-Q_X.3DS</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Joe__PCT__27s__PCT__2014__PCT__22__PCT__20Quad__PCT__20X__PCT__20>
|
||||
<Joe__PCT__27s__PCT__2014__PCT__22__PCT__20T__PCT__20Quad__PCT__20__PCT__2B>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/multi/joes_cnc/J14-QT_+.3DS</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Joe__PCT__27s__PCT__2014__PCT__22__PCT__20T__PCT__20Quad__PCT__20__PCT__2B>
|
||||
<Joe__PCT__27s__PCT__2014__PCT__22__PCT__20T__PCT__20Quad__PCT__20X>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/multi/joes_cnc/J14-QT_X.3DS</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Joe__PCT__27s__PCT__2014__PCT__22__PCT__20T__PCT__20Quad__PCT__20X>
|
||||
<Quadcopter>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/multi/mikrokopter/MK_L4-ME.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Quadcopter>
|
||||
<Ricoo>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/multi/ricoo/ricoo.3DS</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Ricoo>
|
||||
<Scorpion__PCT__20Tricopter>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/multi/scorpion_tricopter/scorpion_tricopter.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Scorpion__PCT__20Tricopter>
|
||||
<MattL__PCT__27s__PCT__20Y6>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/multi/mattL_Y6/mattL_Y6.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</MattL__PCT__27s__PCT__20Y6>
|
||||
<Test__PCT__20Quad__PCT__20__PCT__2B>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/multi/test_quad/test_quad_+.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Test__PCT__20Quad__PCT__20__PCT__2B>
|
||||
<Test__PCT__20Quad__PCT__20X>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/multi/test_quad/test_quad_X.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Test__PCT__20Quad__PCT__20X>
|
||||
<Danker__PCT__27s__PCT__20Quad>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<acFilename>%%DATAPATH%%models/multi/dankers_quad/dankers_quad.3ds</acFilename>
|
||||
<bgFilename>%%DATAPATH%%backgrounds/default_background.png</bgFilename>
|
||||
<enableVbo>false</enableVbo>
|
||||
</data>
|
||||
</Danker__PCT__27s__PCT__20Quad>
|
||||
</ModelViewGadget>
|
||||
<OPMapGadget>
|
||||
<Google__PCT__20Sat>
|
||||
<configInfo>
|
||||
@ -1871,55 +1605,175 @@
|
||||
</default>
|
||||
</OPMapGadget>
|
||||
<PfdQmlGadget>
|
||||
<NoTerrain>
|
||||
<PFD>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<actualPositionUsed>false</actualPositionUsed>
|
||||
<altitude>2000</altitude>
|
||||
<qmlFile>%%DATAPATH%%qml/Pfd.qml</qmlFile>
|
||||
<altitudeFactor>1</altitudeFactor>
|
||||
<cacheOnly>false</cacheOnly>
|
||||
<earthFile>%%DATAPATH%%pfd/default/readymap.earth</earthFile>
|
||||
<latitude>46.6715</latitude>
|
||||
<longitude>10.1589</longitude>
|
||||
<openGLEnabled>true</openGLEnabled>
|
||||
<qmlFile>%%DATAPATH%%pfd/default/Pfd.qml</qmlFile>
|
||||
<speedFactor>1</speedFactor>
|
||||
<terrainEnabled>false</terrainEnabled>
|
||||
</data>
|
||||
</NoTerrain>
|
||||
<Terrain>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<actualPositionUsed>false</actualPositionUsed>
|
||||
<altitude>2000</altitude>
|
||||
<earthFile>%%DATAPATH%%osgearth/readymap.earth</earthFile>
|
||||
<cacheOnly>false</cacheOnly>
|
||||
<earthFile>%%DATAPATH%%pfd/default/readymap.earth</earthFile>
|
||||
<latitude>46.6715</latitude>
|
||||
<longitude>10.1589</longitude>
|
||||
<openGLEnabled>true</openGLEnabled>
|
||||
<qmlFile>%%DATAPATH%%pfd/default/Pfd.qml</qmlFile>
|
||||
<terrainEnabled>false</terrainEnabled>
|
||||
<latitude>39.6576</latitude>
|
||||
<longitude>19.8046</longitude>
|
||||
<altitude>90</altitude>
|
||||
<timeMode>0</timeMode>
|
||||
<dateTime>@Variant(AAAAEAAlfhEClAez/w==)</dateTime>
|
||||
<minAmbientLight>0.50</minAmbientLight>
|
||||
<modelEnabled>false</modelEnabled>
|
||||
<modelSelectionMode>1</modelSelectionMode>
|
||||
<modelFile>%%DATAPATH%%models/multi/test_quad/test_quad_x.3ds</modelFile>
|
||||
<backgroundImageFile>%%DATAPATH%%backgrounds/default_background.png</backgroundImageFile>
|
||||
</data>
|
||||
</Terrain>
|
||||
</PfdQmlGadget>
|
||||
<QmlViewGadget>
|
||||
<default>
|
||||
</PFD>
|
||||
<PFD__PCT__20__PCT__28ReadyMap__PCT__29>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<dialFile>Unknown</dialFile>
|
||||
<useOpenGLFlag>true</useOpenGLFlag>
|
||||
<qmlFile>%%DATAPATH%%qml/Pfd.qml</qmlFile>
|
||||
<altitudeFactor>1</altitudeFactor>
|
||||
<speedFactor>1</speedFactor>
|
||||
<terrainEnabled>true</terrainEnabled>
|
||||
<earthFile>%%DATAPATH%%osgearth/readymap.earth</earthFile>
|
||||
<cacheOnly>false</cacheOnly>
|
||||
<latitude>39.6576</latitude>
|
||||
<longitude>19.8046</longitude>
|
||||
<altitude>90</altitude>
|
||||
<timeMode>0</timeMode>
|
||||
<dateTime>@Variant(AAAAEAAlfhEClAez/w==)</dateTime>
|
||||
<minAmbientLight>0.50</minAmbientLight>
|
||||
<modelEnabled>false</modelEnabled>
|
||||
<modelSelectionMode>1</modelSelectionMode>
|
||||
<modelFile>%%DATAPATH%%models/multi/test_quad/test_quad_x.3ds</modelFile>
|
||||
<backgroundImageFile>%%DATAPATH%%backgrounds/default_background.png</backgroundImageFile>
|
||||
</data>
|
||||
</default>
|
||||
</QmlViewGadget>
|
||||
</PFD__PCT__20__PCT__28ReadyMap__PCT__29>
|
||||
<PFD__PCT__20__PCT__28ArcGis__PCT__29>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<qmlFile>%%DATAPATH%%qml/Pfd.qml</qmlFile>
|
||||
<altitudeFactor>1</altitudeFactor>
|
||||
<speedFactor>1</speedFactor>
|
||||
<terrainEnabled>true</terrainEnabled>
|
||||
<earthFile>%%DATAPATH%%osgearth/arcgis.earth</earthFile>
|
||||
<cacheOnly>false</cacheOnly>
|
||||
<latitude>39.6576</latitude>
|
||||
<longitude>19.8046</longitude>
|
||||
<altitude>90</altitude>
|
||||
<timeMode>0</timeMode>
|
||||
<dateTime>@Variant(AAAAEAAlfhEClAez/w==)</dateTime>
|
||||
<minAmbientLight>0.50</minAmbientLight>
|
||||
<modelEnabled>false</modelEnabled>
|
||||
<modelSelectionMode>1</modelSelectionMode>
|
||||
<modelFile>%%DATAPATH%%models/multi/test_quad/test_quad_x.3ds</modelFile>
|
||||
<backgroundImageFile>%%DATAPATH%%backgrounds/default_background.png</backgroundImageFile>
|
||||
</data>
|
||||
</PFD__PCT__20__PCT__28ArcGis__PCT__29>
|
||||
<Model__PCT__20View>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<qmlFile>%%DATAPATH%%qml/ModelView.qml</qmlFile>
|
||||
<altitudeFactor>1</altitudeFactor>
|
||||
<speedFactor>1</speedFactor>
|
||||
<terrainEnabled>false</terrainEnabled>
|
||||
<earthFile>%%DATAPATH%%osgearth/arcgis.earth</earthFile>
|
||||
<cacheOnly>false</cacheOnly>
|
||||
<latitude>39.6576</latitude>
|
||||
<longitude>19.8046</longitude>
|
||||
<altitude>90</altitude>
|
||||
<timeMode>0</timeMode>
|
||||
<dateTime>@Variant(AAAAEAAlfhEClAez/w==)</dateTime>
|
||||
<minAmbientLight>0.50</minAmbientLight>
|
||||
<modelEnabled>true</modelEnabled>
|
||||
<modelSelectionMode>1</modelSelectionMode>
|
||||
<modelFile>%%DATAPATH%%models/multi/test_quad/test_quad_x.3ds</modelFile>
|
||||
<backgroundImageFile>%%DATAPATH%%backgrounds/default_background.png</backgroundImageFile>
|
||||
</data>
|
||||
</Model__PCT__20View>
|
||||
<Model__PCT__20View__PCT__20__PCT__28ReadyMap__PCT__29>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<qmlFile>%%DATAPATH%%qml/ModelView.qml</qmlFile>
|
||||
<altitudeFactor>1</altitudeFactor>
|
||||
<speedFactor>1</speedFactor>
|
||||
<terrainEnabled>true</terrainEnabled>
|
||||
<earthFile>%%DATAPATH%%osgearth/readymap.earth</earthFile>
|
||||
<cacheOnly>false</cacheOnly>
|
||||
<latitude>39.6576</latitude>
|
||||
<longitude>19.8046</longitude>
|
||||
<altitude>90</altitude>
|
||||
<timeMode>0</timeMode>
|
||||
<dateTime>@Variant(AAAAEAAlfhEClAez/w==)</dateTime>
|
||||
<minAmbientLight>0.50</minAmbientLight>
|
||||
<modelEnabled>true</modelEnabled>
|
||||
<modelSelectionMode>1</modelSelectionMode>
|
||||
<modelFile>%%DATAPATH%%models/multi/test_quad/test_quad_x.3ds</modelFile>
|
||||
<backgroundImageFile>%%DATAPATH%%backgrounds/default_background.png</backgroundImageFile>
|
||||
</data>
|
||||
</Model__PCT__20View__PCT__20__PCT__28ReadyMap__PCT__29>
|
||||
<Model__PCT__20View__PCT__20__PCT__28ArcGis__PCT__29>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<qmlFile>%%DATAPATH%%qml/ModelView.qml</qmlFile>
|
||||
<altitudeFactor>1</altitudeFactor>
|
||||
<speedFactor>1</speedFactor>
|
||||
<terrainEnabled>true</terrainEnabled>
|
||||
<earthFile>%%DATAPATH%%osgearth/arcgis.earth</earthFile>
|
||||
<cacheOnly>false</cacheOnly>
|
||||
<latitude>39.6576</latitude>
|
||||
<longitude>19.8046</longitude>
|
||||
<altitude>90</altitude>
|
||||
<timeMode>0</timeMode>
|
||||
<dateTime>@Variant(AAAAEAAlfhEClAez/w==)</dateTime>
|
||||
<minAmbientLight>0.50</minAmbientLight>
|
||||
<modelEnabled>true</modelEnabled>
|
||||
<modelSelectionMode>1</modelSelectionMode>
|
||||
<modelFile>%%DATAPATH%%models/multi/test_quad/test_quad_x.3ds</modelFile>
|
||||
<backgroundImageFile>%%DATAPATH%%backgrounds/default_background.png</backgroundImageFile>
|
||||
</data>
|
||||
</Model__PCT__20View__PCT__20__PCT__28ArcGis__PCT__29>
|
||||
<Earth__PCT__20View>
|
||||
<configInfo>
|
||||
<locked>false</locked>
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<qmlFile>%%DATAPATH%%qml/EarthView.qml</qmlFile>
|
||||
<altitudeFactor>1</altitudeFactor>
|
||||
<speedFactor>1</speedFactor>
|
||||
<terrainEnabled>true</terrainEnabled>
|
||||
<earthFile>%%DATAPATH%%osgearth/arcgis.earth</earthFile>
|
||||
<cacheOnly>false</cacheOnly>
|
||||
<latitude>39.6576</latitude>
|
||||
<longitude>19.8046</longitude>
|
||||
<altitude>90</altitude>
|
||||
<timeMode>0</timeMode>
|
||||
<dateTime>@Variant(AAAAEAAlfhEClAez/w==)</dateTime>
|
||||
<minAmbientLight>0.50</minAmbientLight>
|
||||
<modelEnabled>false</modelEnabled>
|
||||
<modelSelectionMode>1</modelSelectionMode>
|
||||
<modelFile>%%DATAPATH%%models/multi/test_quad/test_quad_x.3ds</modelFile>
|
||||
<backgroundImageFile>%%DATAPATH%%backgrounds/default_background.png</backgroundImageFile>
|
||||
</data>
|
||||
</Earth__PCT__20View>
|
||||
</PfdQmlGadget>
|
||||
<ScopeGadget>
|
||||
<Accel>
|
||||
<configInfo>
|
||||
@ -2569,16 +2423,16 @@
|
||||
<side0>
|
||||
<classId>PfdQmlGadget</classId>
|
||||
<gadget>
|
||||
<activeConfiguration>NoTerrain</activeConfiguration>
|
||||
<activeConfiguration>PFD</activeConfiguration>
|
||||
</gadget>
|
||||
<type>uavGadget</type>
|
||||
</side0>
|
||||
<side1>
|
||||
<side0>
|
||||
<classId>ModelViewGadget</classId>
|
||||
<classId>PfdQmlGadget</classId>
|
||||
<gadget>
|
||||
<activeConfiguration>Blackout_MiniH</activeConfiguration>
|
||||
</gadget>
|
||||
<activeConfiguration>Model View</activeConfiguration>
|
||||
</gadget>
|
||||
<type>uavGadget</type>
|
||||
</side0>
|
||||
<side1>
|
||||
@ -2714,7 +2568,7 @@
|
||||
<side0>
|
||||
<classId>PfdQmlGadget</classId>
|
||||
<gadget>
|
||||
<activeConfiguration>NoTerrain</activeConfiguration>
|
||||
<activeConfiguration>PFD</activeConfiguration>
|
||||
</gadget>
|
||||
<type>uavGadget</type>
|
||||
</side0>
|
||||
|
@ -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) {
|
||||
|
BIN
ground/gcs/src/share/models/boards/cc3d/cc3d.jpg
Normal file
After Width: | Height: | Size: 162 KiB |
Before Width: | Height: | Size: 160 KiB After Width: | Height: | Size: 160 KiB |
BIN
ground/gcs/src/share/models/boards/cc3d/texture.png
Normal file
After Width: | Height: | Size: 130 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
BIN
ground/gcs/src/share/models/boards/op_gps_v9/op_gps_v9.3ds
Executable file
BIN
ground/gcs/src/share/models/boards/op_gps_v9/op_gps_v9.jpg
Normal file
After Width: | Height: | Size: 136 KiB |
BIN
ground/gcs/src/share/models/boards/op_gps_v9/texture.jpg
Normal file
After Width: | Height: | Size: 309 KiB |
BIN
ground/gcs/src/share/models/boards/Revolution/Revolution.3DS → ground/gcs/src/share/models/boards/revolution/revolution.3ds
Normal file → Executable file
BIN
ground/gcs/src/share/models/boards/revolution/revolution.jpg
Normal file
After Width: | Height: | Size: 261 KiB |
Before Width: | Height: | Size: 344 KiB After Width: | Height: | Size: 344 KiB |
Before Width: | Height: | Size: 316 KiB After Width: | Height: | Size: 316 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 275 KiB After Width: | Height: | Size: 275 KiB |
Before Width: | Height: | Size: 127 KiB |
BIN
ground/gcs/src/share/models/multi/easy_quad/easy_quad_x.jpg
Normal file
After Width: | Height: | Size: 126 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
BIN
ground/gcs/src/share/models/multi/joes_cnc/j14-q_+.3ds
Normal file
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 84 KiB |
BIN
ground/gcs/src/share/models/multi/joes_cnc/j14-q_x.3ds
Normal file
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 84 KiB |
BIN
ground/gcs/src/share/models/multi/joes_cnc/j14-qt_+.3ds
Normal file
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 125 KiB |
BIN
ground/gcs/src/share/models/multi/joes_cnc/j14-qt_x.3ds
Normal file
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 132 KiB |
BIN
ground/gcs/src/share/models/multi/joes_cnc/texture.png
Normal file
After Width: | Height: | Size: 1.1 KiB |