21 changes: 12 additions & 9 deletions src/analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,18 @@ ENDIF (WIN32)

ADD_LIBRARY(qgis_analysis SHARED ${QGIS_ANALYSIS_SRCS} ${QGIS_ANALYSIS_MOC_SRCS} ${QGIS_ANALYSIS_HDRS})

SET_TARGET_PROPERTIES(qgis_analysis PROPERTIES
# no moc headers, messes up PROPERTIES syntax
PUBLIC_HEADER "${QGIS_ANALYSIS_HDRS}"
CLEAN_DIRECT_OUTPUT 1
FRAMEWORK 1
FRAMEWORK_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}"
MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_SOURCE_DIR}/mac/framework.info.plist.in"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis_analysis)
IF(APPLE)
SET_TARGET_PROPERTIES(qgis_analysis PROPERTIES
# no moc headers, messes up PROPERTIES syntax
PUBLIC_HEADER "${QGIS_ANALYSIS_HDRS}"
CLEAN_DIRECT_OUTPUT 1
FRAMEWORK 1
FRAMEWORK_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}"
MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_SOURCE_DIR}/mac/framework.info.plist.in"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis_analysis
)
ENDIF(APPLE)

#generate unversioned libs for android
IF (NOT ANDROID)
Expand Down
19 changes: 11 additions & 8 deletions src/analysis/network/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,17 @@ INCLUDE_DIRECTORIES(

ADD_LIBRARY(qgis_networkanalysis SHARED ${QGIS_NETWORK_ANALYSIS_SRCS} ${QGIS_NETWORK_ANALYSIS_MOC_SRCS} ${QGIS_NETWORK_ANALYSIS_HDRS})

SET_TARGET_PROPERTIES(qgis_networkanalysis PROPERTIES
PUBLIC_HEADER "${QGIS_NETWORK_ANALYSIS_HDRS};${QGIS_NETWORK_ANALYSIS_MOC_HDRS}"
CLEAN_DIRECT_OUTPUT 1
FRAMEWORK 1
FRAMEWORK_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}"
MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_SOURCE_DIR}/mac/framework.info.plist.in"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis_networkanalysis)
IF(APPLE)
SET_TARGET_PROPERTIES(qgis_networkanalysis PROPERTIES
PUBLIC_HEADER "${QGIS_NETWORK_ANALYSIS_HDRS};${QGIS_NETWORK_ANALYSIS_MOC_HDRS}"
CLEAN_DIRECT_OUTPUT 1
FRAMEWORK 1
FRAMEWORK_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}"
MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_SOURCE_DIR}/mac/framework.info.plist.in"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis_networkanalysis
)
ENDIF(APPLE)

#generate unversioned libs for android
IF (NOT ANDROID)
Expand Down
19 changes: 11 additions & 8 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -492,14 +492,17 @@ ENDIF (WIN32)

ADD_LIBRARY(qgis_core SHARED ${QGIS_CORE_SRCS} ${QGIS_CORE_MOC_SRCS} ${QGIS_CORE_HDRS} ${QGIS_CORE_MOC_HDRS})

SET_TARGET_PROPERTIES(qgis_core PROPERTIES
PUBLIC_HEADER "${QGIS_CORE_HDRS};${QGIS_CORE_MOC_HDRS}"
CLEAN_DIRECT_OUTPUT 1
FRAMEWORK 1
FRAMEWORK_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}"
MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_SOURCE_DIR}/mac/framework.info.plist.in"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis_core)
IF(APPLE)
SET_TARGET_PROPERTIES(qgis_core PROPERTIES
PUBLIC_HEADER "${QGIS_CORE_HDRS};${QGIS_CORE_MOC_HDRS}"
CLEAN_DIRECT_OUTPUT 1
FRAMEWORK 1
FRAMEWORK_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}"
MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_SOURCE_DIR}/mac/framework.info.plist.in"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis_core
)
ENDIF(APPLE)

#generate unversioned libs for android
IF (NOT ANDROID)
Expand Down
9 changes: 6 additions & 3 deletions src/core/composer/qgscomposerframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@
#include "qgscomposerframe.h"
#include "qgscomposermultiframe.h"

QgsComposerFrame::QgsComposerFrame( QgsComposition* c, QgsComposerMultiFrame* mf, double x, double y, double width, double height ):
QgsComposerItem( x, y, width, height, c ), mMultiFrame( mf )
QgsComposerFrame::QgsComposerFrame( QgsComposition* c, QgsComposerMultiFrame* mf, qreal x, qreal y, qreal width, qreal height )
: QgsComposerItem( x, y, width, height, c )
, mMultiFrame( mf )
{
}

QgsComposerFrame::QgsComposerFrame(): QgsComposerItem( 0, 0, 0, 0, 0 ), mMultiFrame( 0 )
QgsComposerFrame::QgsComposerFrame()
: QgsComposerItem( 0, 0, 0, 0, 0 )
, mMultiFrame( 0 )
{
}

Expand Down
9 changes: 7 additions & 2 deletions src/core/qgsmaplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ QString const & QgsMapLayer::source() const
return mDataSource;
}

QgsRectangle QgsMapLayer::extent() const
QgsRectangle QgsMapLayer::extent()
{
return mLayerExtent;
return mExtent;
}

bool QgsMapLayer::draw( QgsRenderContext& rendererContext )
Expand Down Expand Up @@ -1247,3 +1247,8 @@ QString QgsMapLayer::metadata()
{
return QString();
}

void QgsMapLayer::setExtent( const QgsRectangle &r )
{
mExtent = r;
}
10 changes: 6 additions & 4 deletions src/core/qgsmaplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ class CORE_EXPORT QgsMapLayer : public QObject
*/
virtual void drawLabels( QgsRenderContext& rendererContext );

/** Return the extent of the layer as a QRect */
QgsRectangle extent() const;
/** Return the extent of the layer */
virtual QgsRectangle extent();

/*! Return the status of the layer. An invalid layer is one which has a bad datasource
* or other problem. Child classes set this flag when intialized
Expand All @@ -126,7 +126,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
QString publicSource() const;

/** Returns the source for the layer */
QString const & source() const;
QString const &source() const;

/**
* Returns the sublayers of this layer
Expand Down Expand Up @@ -390,6 +390,8 @@ class CORE_EXPORT QgsMapLayer : public QObject
void dataChanged();

protected:
/** Set the extent */
virtual void setExtent( const QgsRectangle &rect );

/** set whether layer is valid or not - should be used in constructor.
\note added in v1.5 */
Expand Down Expand Up @@ -421,7 +423,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
unsigned int mTransparencyLevel;

/** Extent of the layer */
QgsRectangle mLayerExtent;
QgsRectangle mExtent;

/** Indicates if the layer is valid and can be drawn */
bool mValid;
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgspluginlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ QString QgsPluginLayer::pluginLayerType()
return mPluginLayerType;
}

void QgsPluginLayer::setExtent( const QgsRectangle & extent )
void QgsPluginLayer::setExtent( const QgsRectangle &extent )
{
mLayerExtent = extent;
mExtent = extent;
}
40 changes: 28 additions & 12 deletions src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ QgsVectorLayer::QgsVectorLayer( QString vectorLayerPath,
, mJoinBuffer( 0 )
, mDiagramRenderer( 0 )
, mDiagramLayerSettings( 0 )
, mValidExtent( false )
{
mActions = new QgsAttributeAction( this );

Expand Down Expand Up @@ -1461,10 +1462,24 @@ long QgsVectorLayer::updateFeatureCount() const

void QgsVectorLayer::updateExtents()
{
if ( !hasGeometryType() )
return;
mValidExtent = false;
}

void QgsVectorLayer::setExtent( const QgsRectangle &r )
{
QgsMapLayer::setExtent( r );
mValidExtent = true;
}

mLayerExtent.setMinimal();
QgsRectangle QgsVectorLayer::extent()
{
if ( mValidExtent )
return QgsMapLayer::extent();

QgsRectangle rect;

if ( !hasGeometryType() )
return rect;

if ( !mDataProvider )
{
Expand All @@ -1480,13 +1495,13 @@ void QgsVectorLayer::updateExtents()
if ( mDataProvider->featureCount() != 0 )
{
QgsRectangle r = mDataProvider->extent();
mLayerExtent.combineExtentWith( &r );
rect.combineExtentWith( &r );
}

for ( QgsFeatureList::iterator it = mAddedFeatures.begin(); it != mAddedFeatures.end(); it++ )
{
QgsRectangle r = it->geometry()->boundingBox();
mLayerExtent.combineExtentWith( &r );
rect.combineExtentWith( &r );
}
}
else
Expand All @@ -1499,19 +1514,23 @@ void QgsVectorLayer::updateExtents()
if ( fet.geometry() )
{
QgsRectangle bb = fet.geometry()->boundingBox();
mLayerExtent.combineExtentWith( &bb );
rect.combineExtentWith( &bb );
}
}
}

if ( mLayerExtent.xMinimum() > mLayerExtent.xMaximum() && mLayerExtent.yMinimum() > mLayerExtent.yMaximum() )
if ( rect.xMinimum() > rect.xMaximum() && rect.yMinimum() > rect.yMaximum() )
{
// special case when there are no features in provider nor any added
mLayerExtent = QgsRectangle(); // use rectangle with zero coordinates
rect = QgsRectangle(); // use rectangle with zero coordinates
}

setExtent( rect );

// Send this (hopefully) up the chain to the map canvas
emit recalculateExtents();

return rect;
}

QString QgsVectorLayer::subsetString()
Expand Down Expand Up @@ -2819,10 +2838,7 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )
QString s = mbr.toString();
QgsDebugMsg( "Extent of layer: " + s );
// store the extent
mLayerExtent.setXMaximum( mbr.xMaximum() );
mLayerExtent.setXMinimum( mbr.xMinimum() );
mLayerExtent.setYMaximum( mbr.yMaximum() );
mLayerExtent.setYMinimum( mbr.yMinimum() );
setExtent( mbr );

// get and store the feature type
mWkbType = mDataProvider->geometryType();
Expand Down
9 changes: 9 additions & 0 deletions src/core/qgsvectorlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,9 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
/** Draws the layer labels using coordinate transformation */
void drawLabels( QgsRenderContext& rendererContext );

/** Return the extent of the layer as a QRect */
QgsRectangle extent();

/** returns field list in the to-be-committed state */
const QgsFieldMap &pendingFields() const;

Expand Down Expand Up @@ -745,6 +748,10 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
void committedAttributeValuesChanges( const QString& layerId, const QgsChangedAttributesMap& changedAttributesValues );
void committedGeometriesChanges( const QString& layerId, const QgsGeometryMap& changedGeometries );

protected:
/** Set the extent */
void setExtent( const QgsRectangle &rect );

private: // Private methods

/** vector layers are not copyable */
Expand Down Expand Up @@ -986,6 +993,8 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer

//stores infos about diagram placement (placement type, priority, position distance)
QgsDiagramLayerSettings *mDiagramLayerSettings;

bool mValidExtent;
};

#endif
12 changes: 3 additions & 9 deletions src/core/raster/qgsrasterlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ bool QgsRasterLayer::draw( QgsRenderContext& rendererContext )

try
{
myProjectedLayerExtent = rendererContext.coordinateTransform()->transformBoundingBox( mLayerExtent );
myProjectedLayerExtent = rendererContext.coordinateTransform()->transformBoundingBox( extent() );
}
catch ( QgsCsException &cs )
{
Expand All @@ -705,7 +705,7 @@ bool QgsRasterLayer::draw( QgsRenderContext& rendererContext )
{
QgsDebugMsg( "coordinateTransform not set" );
myProjectedViewExtent = rendererContext.extent();
myProjectedLayerExtent = mLayerExtent;
myProjectedLayerExtent = extent();
}

QPainter* theQPainter = rendererContext.painter();
Expand Down Expand Up @@ -1691,10 +1691,7 @@ void QgsRasterLayer::setDataProvider( QString const & provider )
QString s = mbr.toString();
QgsDebugMsg( "Extent of layer: " + s );
// store the extent
mLayerExtent.setXMaximum( mbr.xMaximum() );
mLayerExtent.setXMinimum( mbr.xMinimum() );
mLayerExtent.setYMaximum( mbr.yMaximum() );
mLayerExtent.setYMinimum( mbr.yMinimum() );
setExtent( mbr );

mWidth = mDataProvider->xSize();
mHeight = mDataProvider->ySize();
Expand All @@ -1704,9 +1701,6 @@ void QgsRasterLayer::setDataProvider( QString const & provider )
QgsDebugMsg( "mLayerName: " + name() );

mValidNoDataValue = mDataProvider->isNoDataValueValid();
if ( mValidNoDataValue )
{
}

// set up the raster drawing style
setDrawingStyle( MultiBandColor ); //sensible default
Expand Down
19 changes: 11 additions & 8 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -306,14 +306,17 @@ ADD_LIBRARY(qgis_gui SHARED
#${MODELTEST_SRCS} ${MODELTEST_MOC_SRCS} # for ModelTest
)

SET_TARGET_PROPERTIES(qgis_gui PROPERTIES
PUBLIC_HEADER "${QGIS_GUI_HDRS};${QGIS_GUI_MOC_HDRS}"
CLEAN_DIRECT_OUTPUT 1
FRAMEWORK 1
FRAMEWORK_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}"
MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_SOURCE_DIR}/mac/framework.info.plist.in"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis_gui)
IF(APPLE)
SET_TARGET_PROPERTIES(qgis_gui PROPERTIES
PUBLIC_HEADER "${QGIS_GUI_HDRS};${QGIS_GUI_MOC_HDRS}"
CLEAN_DIRECT_OUTPUT 1
FRAMEWORK 1
FRAMEWORK_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}"
MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_SOURCE_DIR}/mac/framework.info.plist.in"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis_gui
)
ENDIF(APPLE)

#generate unversioned libs for android
IF (NOT ANDROID)
Expand Down