Skip to content

Commit

Permalink
Merge pull request #3126 from manisandro/globe
Browse files Browse the repository at this point in the history
Revived globe, compatible with OsgEarth 2.7
  • Loading branch information
manisandro committed May 29, 2016
2 parents 79d6407 + cdbd4e4 commit 87121d6
Show file tree
Hide file tree
Showing 102 changed files with 6,093 additions and 6,460 deletions.
3 changes: 3 additions & 0 deletions cmake/FindOSGEARTH.cmake
Expand Up @@ -96,6 +96,9 @@ FIND_OSGEARTH_LIBRARY( OSGEARTHSYMBOLOGY_LIBRARY_DEBUG osgEarthSymbologyd )
FIND_OSGEARTH_LIBRARY( OSGEARTHQT_LIBRARY osgEarthQt )
FIND_OSGEARTH_LIBRARY( OSGEARTHQT_LIBRARY_DEBUG osgEarthQtd )

FIND_OSGEARTH_LIBRARY( OSGEARTHANNOTATION_LIBRARY osgEarthAnnotation )
FIND_OSGEARTH_LIBRARY( OSGEARTHANNOTATION_LIBRARY_DEBUG osgEarthAnnotationd )


SET( OSGEARTH_FOUND "NO" )
IF( OSGEARTH_LIBRARY AND OSGEARTH_INCLUDE_DIR )
Expand Down
1 change: 1 addition & 0 deletions images/images.qrc
Expand Up @@ -522,6 +522,7 @@
<file>themes/default/symbologyRemove.svg</file>
<file>themes/default/symbologyUp.png</file>
<file>themes/default/symbologyUp.svg</file>
<file>themes/default/sync_views.svg</file>
<file>themes/default/text.png</file>
<file>themes/default/tracking.png</file>
<file>themes/default/transformed.png</file>
Expand Down
151 changes: 151 additions & 0 deletions images/themes/default/sync_views.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions python/core/core.sip
Expand Up @@ -24,6 +24,7 @@
%Include qgsaggregatecalculator.sip
%Include qgsattributeaction.sip
%Include qgsattributetableconfig.sip
%Include qgsbillboardregistry.sip
%Include qgsbrowsermodel.sip
%Include qgsclipper.sip
%Include qgscolorscheme.sip
Expand Down Expand Up @@ -103,6 +104,7 @@
%Include qgsowsconnection.sip
%Include qgspaintenginehack.sip
%Include qgspallabeling.sip
%Include qgsplugininterface.sip
%Include qgspluginlayer.sip
%Include qgspluginlayerregistry.sip
%Include qgspoint.sip
Expand Down
56 changes: 56 additions & 0 deletions python/core/qgsbillboardregistry.sip
@@ -0,0 +1,56 @@
/** Billboard items stored in the QgsBillBoardRegistry */
class QgsBillBoardItem
{
%TypeHeaderCode
#include <qgsbillboardregistry.h>
%End
public:
QImage image; /* The image of the billboard */
QgsPoint worldPos; /* The WGS84 world position of the billboard */
QString layerId; /* The layer which the image is part of, if any */
};

/**
* @brief The QgsBillBoardRegistry class stores images which should
* be displayed as billboards in the globe plugin.
* Map canvas items and layers may decide to add items which should
* be drawn as billboards in the globe.
*
* Retreive the instance pointer to a QgsBillBoardRegistry for a
* project via QgsProject::instance()->billboardRegistry().
*/
class QgsBillBoardRegistry : public QObject
{
%TypeHeaderCode
#include <qgsbillboardregistry.h>
%End
public:
/**
* @brief Adds a billboard to the registry
* @param parent The parent (i.e. a QgsMapLayer or a QgsMapCanvasItem) which is creating the billboard
* @param image The billboard image
* @param worldPos The geo position of the image, in WGS84
* @param layerId The id of the layer to which the item belongs, if any
*/
void addItem( void* parent, const QImage& image, const QgsPoint& worldPos, const QString& layerId = QString() );
/**
* @brief Removes all billboards which were created by the specified parent
* @param parent The parent
*/
void removeItem( void* parent );

/**
* @brief Retreive all registered billboard items
* @return List of registered billboard items
*/
QList<QgsBillBoardItem*> items() const;

signals:
/** Emitted when an item is added to the registry */
void itemAdded( QgsBillBoardItem* item );
/** Emitted when an item is removed from the registry */
void itemRemoved( QgsBillBoardItem* item );

private:
QgsBillBoardRegistry( QObject* parent = 0 );
};
5 changes: 5 additions & 0 deletions python/core/qgsmapsettings.sip
Expand Up @@ -66,6 +66,11 @@ class QgsMapSettings
//! @note added in 2.8
void setLayerStyleOverrides( const QMap<QString, QString>& overrides );

//! Get custom rendering flags, separated by ';'. Layers might honour these to alter their rendering.
const QString& customRenderFlags() const;
//! Set custom rendering flags, separated by ';'. Layers might honour these to alter their rendering.
void setCustomRenderFlags( const QString& customRenderFlags );

//! sets whether to use projections for this layer set
void setCrsTransformEnabled( bool enabled );
//! returns true if projections are enabled for this layer set
Expand Down
28 changes: 28 additions & 0 deletions python/core/qgsplugininterface.sip
@@ -0,0 +1,28 @@
/***************************************************************************
qgsplugininterface.sip
--------------------------------------
Date : 21.8.2013
Copyright : (C) 2013 Matthias Kuhn
Email : matthias dot kuhn at gmx dot ch
***************************************************************************

This comment has been minimized.

Copy link
@nyalldawson

nyalldawson May 30, 2016

Collaborator

@m-kuhn Should this be removed? It's not used, and if I recall we decided not to allow plugins to provide their own bindings.

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn May 30, 2016

Member

I think so, originally my plan was to split it all into smaller pieces to make them review- and mergeable individually.

This comment has been minimized.

Copy link
@manisandro

manisandro May 30, 2016

Author Member

@m-kuhn , @nyalldawson So I'll remove the globe bindings, right?

This comment has been minimized.

Copy link
@nyalldawson

nyalldawson May 30, 2016

Collaborator

@manisandro yep - pull them out and remove this class too.

* *
* 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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

/**
* @brief Trivial base class for plugin interfaces
*/
class QgsPluginInterface : QObject
{
%TypeHeaderCode
#include "qgsplugininterface.h"
%End

protected:
/** Should only be instantiated from subclasses */
QgsPluginInterface( QObject* parent = 0 );
};
5 changes: 5 additions & 0 deletions python/core/qgsproject.sip
Expand Up @@ -275,6 +275,11 @@ class QgsProject : QObject

QgsRelationManager* relationManager() const;

/** Return the project's billboard manager instance pointer
* @note added in QGIS 2.16
*/
QgsBillBoardRegistry* billboardRegistry() const;

/** Return pointer to the root (invisible) node of the project's layer tree
* @note added in 2.4
*/
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsrectangle.sip
Expand Up @@ -74,7 +74,7 @@ class QgsRectangle
//! return true when rectangle contains a point
bool contains( const QgsPoint &p ) const;
//! expand the rectangle so that covers both the original rectangle and the given rectangle
void combineExtentWith( QgsRectangle *rect );
void combineExtentWith( const QgsRectangle& rect );
//! expand the rectangle so that covers both the original rectangle and the given point
void combineExtentWith( double x, double y );
//! test if rectangle is empty.
Expand Down
2 changes: 2 additions & 0 deletions python/gui/gui.sip
Expand Up @@ -102,6 +102,7 @@
%Include qgsmaplayeractionregistry.sip
%Include qgsmaplayercombobox.sip
%Include qgsmaplayermodel.sip
%Include qgsmaplayerpropertiesfactory.sip
%Include qgsmaplayerproxymodel.sip
%Include qgsmapmouseevent.sip
%Include qgsmapoverviewcanvas.sip
Expand Down Expand Up @@ -155,6 +156,7 @@
%Include qgsunitselectionwidget.sip
%Include qgsuserinputdockwidget.sip
%Include qgsvariableeditorwidget.sip
%Include qgsvectorlayerpropertiespage.sip
%Include qgsvectorlayertools.sip
%Include qgsvertexmarker.sip

Expand Down
6 changes: 6 additions & 0 deletions python/gui/qgisinterface.sip
Expand Up @@ -279,6 +279,12 @@ class QgisInterface : QObject
/** Unregister a previously registered action. (e.g. when plugin is going to be unloaded) */
virtual bool unregisterMainWindowAction( QAction* action ) = 0;

/** Register a new tab in the vector layer properties dialog */
virtual void registerMapLayerPropertiesFactory( QgsMapLayerPropertiesFactory* factory ) = 0;

/** Unregister a previously registered tab in the layer properties dialog */
virtual void unregisterMapLayerPropertiesFactory( QgsMapLayerPropertiesFactory* factory ) = 0;

// @todo is this deprecated in favour of QgsContextHelp?
/** Open a url in the users browser. By default the QGIS doc directory is used
* as the base for the URL. To open a URL that is not relative to the installed
Expand Down
32 changes: 32 additions & 0 deletions python/gui/qgsmaplayerpropertiesfactory.sip
@@ -0,0 +1,32 @@
/** \ingroup gui
* \note added in 2.1
*/
class QgsMapLayerPropertiesFactory
{
%TypeHeaderCode
#include <qgsmaplayerpropertiesfactory.h>
%End

public:
/** Constructor */
QgsMapLayerPropertiesFactory();

/** Destructor */
virtual ~QgsMapLayerPropertiesFactory();

/**
* @brief Create a new properties page
* @param layer The layer for which to create the page
* @param parent The parent widget
* @return The new properties page instance
*/
virtual QgsVectorLayerPropertiesPage* createVectorLayerPropertiesPage( QgsVectorLayer* layer, QWidget* parent ) = 0;

/**
* @brief Creates the QListWidgetItem for the properties page
* @param layer The layer for which to create the item
* @param view The parent QListView
* @return The QListWidgetItem for the properties page
*/
virtual QListWidgetItem* createVectorLayerPropertiesItem( QgsVectorLayer* layer, QListWidget* view ) = 0;
};
21 changes: 21 additions & 0 deletions python/gui/qgsvectorlayerpropertiespage.sip
@@ -0,0 +1,21 @@
/** \ingroup gui
* \note added in 2.1
*/

/**
* @brief Base class for custom vector layer property pages
*/
class QgsVectorLayerPropertiesPage : QWidget
{
%TypeHeaderCode
#include <qgsvectorlayerpropertiespage.h>
%End

public:
/** Constructor */
explicit QgsVectorLayerPropertiesPage( QWidget *parent = 0 );

public slots:
/** Apply changes */
virtual void apply() = 0;
};

11 comments on commit 87121d6

@jef-n
Copy link
Member

@jef-n jef-n commented on 87121d6 May 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks support for osgEarth 2.4 as in OSGeo4W.

@manisandro
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jef-n I can mail you OSGeo4W packages sources for osgEarth 2.7.

@jef-n
Copy link
Member

@jef-n jef-n commented on 87121d6 May 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also breaks builds for Debian wheezy (osgEarth 2.5), jessie (current stable, 2.5), ubuntu trusty (2.4), wily and xenial (also 2.5). yakkety has 2.7. ubuntugis has 2.7 for xenial.

I suppose QGIS 2.14 (and 2.8) also don't support osgearth 2.7 (relevant for OSGeo4W)

@manisandro
Copy link
Member Author

@manisandro manisandro commented on 87121d6 May 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jef-n So with upstream doing API breaks at will and occasional internal changes which can cause breakage even though the API remains the same, it is very hard to maintain a workable implementation for multiple releases.
So for distros not shipping the current version of osgEarth, the plugin should just be disabled. The fix for this would be to set the minimum required version to 2.7 in CMake.
For OSGeo4W, does the package base have to be the same for legacy QGIS versions? I'm open to suggestions, but at some point such breakage from the past is needed if the globe plugin is to be actively maintained (and I already fear the day where osgEarth 3.0 is released, with possibly even more radical breakages, so even getting the code to compile with 2.x might then be a huge challenge).

@jef-n
Copy link
Member

@jef-n jef-n commented on 87121d6 May 31, 2016 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jef-n
Copy link
Member

@jef-n jef-n commented on 87121d6 Jun 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any opinion about the user base and stability of the globe plugin? I guess it was somewhat experimental anyway and doesn't have many users. In OSGeo4W I could just upgrade OSGEarth to 2.7 and disable the globe plugin for 2.14 in the next point release (when 2.8 will vanish, be replaced be 2.14 as LTR). In the Linux builds (if everything works out as intented - nighlies are still underway) the globe plugin will also vanish where 2.7 is not available.

@andreasneumann
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the user base of QGIS globe was probably very low. It wasn't very stable and feature-rich in the past and thus not much in use.

@luipir
Copy link
Contributor

@luipir luipir commented on 87121d6 Jun 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed @andreasneumann btw now I can't compile on wily due to dependency and I can't check if now globe works

@jef-n
Copy link
Member

@jef-n jef-n commented on 87121d6 Jun 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luipir set WITH_GLOBE=FALSE

@luipir
Copy link
Contributor

@luipir luipir commented on 87121d6 Jun 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jef-n sorry I was saying I can't compile Globe :)

@manisandro
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luipir osgEarth 2.7 is a hard requirement. Supporting older versions is simply too much work, given the volatility of the osgEarth API.

Please sign in to comment.