characterwidget.h | characterwidget.h | |||
---|---|---|---|---|
/************************************************************************** ** | /************************************************************************** ** | |||
** | ** | |||
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). | |||
** All rights reserved. | ** All rights reserved. | |||
** Contact: Nokia Corporation (qt-info@nokia.com) | ** Contact: Nokia Corporation (qt-info@nokia.com) | |||
** | ** | |||
** This library/program is free software; you can redistribute it | ||||
** and/or modify it under the terms of the GNU Library General Public | ||||
** License as published by the Free Software Foundation; either | ||||
** version 2 of the License, or ( at your option ) any later version. | ||||
** | ||||
** This file is part of the examples of the Qt Toolkit. | ** This file is part of the examples of the Qt Toolkit. | |||
** | ** | |||
** $QT_BEGIN_LICENSE:LGPL$ | ** $QT_BEGIN_LICENSE:LGPL$ | |||
** Commercial Usage | ** Commercial Usage | |||
** Licensees holding valid Qt Commercial licenses may use this file in | ** Licensees holding valid Qt Commercial licenses may use this file in | |||
** accordance with the Qt Commercial License Agreement provided with the | ** accordance with the Qt Commercial License Agreement provided with the | |||
** Software or, alternatively, in accordance with the terms contained in | ** Software or, alternatively, in accordance with the terms contained in | |||
** a written agreement between you and Nokia. | ** a written agreement between you and Nokia. | |||
** | ** | |||
** GNU Lesser General Public License Usage | ** GNU Lesser General Public License Usage | |||
skipping to change at line 57 | skipping to change at line 62 | |||
#include <QSize> | #include <QSize> | |||
#include <QString> | #include <QString> | |||
#include <QWidget> | #include <QWidget> | |||
QT_BEGIN_NAMESPACE | QT_BEGIN_NAMESPACE | |||
class QMouseEvent; | class QMouseEvent; | |||
class QPaintEvent; | class QPaintEvent; | |||
QT_END_NAMESPACE | QT_END_NAMESPACE | |||
//! [0] | //! [0] | |||
class CharacterWidget : public QWidget | class GUI_EXPORT CharacterWidget : public QWidget | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
CharacterWidget( QWidget *parent = 0 ); | CharacterWidget( QWidget *parent = 0 ); | |||
QSize sizeHint() const; | QSize sizeHint() const; | |||
int getColumns() const { return columns; } | ||||
int getSquareSize() const { return squareSize; } | ||||
public slots: | public slots: | |||
void updateFont( const QFont &font ); | void updateFont( const QFont &font ); | |||
void updateSize( double fontSize ); | void updateSize( double fontSize ); | |||
void updateStyle( const QString &fontStyle ); | void updateStyle( const QString &fontStyle ); | |||
void updateFontMerging( bool enable ); | void updateFontMerging( bool enable ); | |||
void updateColumns( int cols ); | ||||
signals: | signals: | |||
void characterSelected( const QChar &character ); | void characterSelected( const QChar &character ); | |||
protected: | protected: | |||
void mouseMoveEvent( QMouseEvent *event ); | void mouseMoveEvent( QMouseEvent *event ); | |||
void mousePressEvent( QMouseEvent *event ); | void mousePressEvent( QMouseEvent *event ); | |||
void paintEvent( QPaintEvent *event ); | void paintEvent( QPaintEvent *event ); | |||
private: | private: | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 10 lines changed or added | |||
qgis.h | qgis.h | |||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGIS_H | #ifndef QGIS_H | |||
#define QGIS_H | #define QGIS_H | |||
#include <QEvent> | #include <QEvent> | |||
#include <QString> | #include <QString> | |||
#include <QRegExp> | ||||
#include <QMetaType> | ||||
#include <QVariant> | ||||
#include <stdlib.h> | ||||
#include <cfloat> | #include <cfloat> | |||
#include <cmath> | #include <cmath> | |||
#include <qnumeric.h> | #include <qnumeric.h> | |||
/** \ingroup core | /** \ingroup core | |||
* The QGis class provides global constants for use throughout the applicat ion. | * The QGis class provides global constants for use throughout the applicat ion. | |||
*/ | */ | |||
class CORE_EXPORT QGis | class CORE_EXPORT QGis | |||
{ | { | |||
public: | public: | |||
skipping to change at line 67 | skipping to change at line 71 | |||
WKBMultiPolygon, | WKBMultiPolygon, | |||
WKBNoGeometry = 100, //attributes only | WKBNoGeometry = 100, //attributes only | |||
WKBPoint25D = 0x80000001, | WKBPoint25D = 0x80000001, | |||
WKBLineString25D, | WKBLineString25D, | |||
WKBPolygon25D, | WKBPolygon25D, | |||
WKBMultiPoint25D, | WKBMultiPoint25D, | |||
WKBMultiLineString25D, | WKBMultiLineString25D, | |||
WKBMultiPolygon25D, | WKBMultiPolygon25D, | |||
}; | }; | |||
static WkbType singleType( WkbType type ) | ||||
{ | ||||
switch ( type ) | ||||
{ | ||||
case WKBMultiPoint: return WKBPoint; | ||||
case WKBMultiLineString: return WKBLineString; | ||||
case WKBMultiPolygon: return WKBPolygon; | ||||
case WKBMultiPoint25D: return WKBPoint25D; | ||||
case WKBMultiLineString25D: return WKBLineString25D; | ||||
case WKBMultiPolygon25D: return WKBPolygon25D; | ||||
default: return type; | ||||
} | ||||
} | ||||
static WkbType flatType( WkbType type ) | ||||
{ | ||||
switch ( type ) | ||||
{ | ||||
case WKBPoint25D: return WKBPoint; | ||||
case WKBLineString25D: return WKBLineString; | ||||
case WKBPolygon25D: return WKBPolygon; | ||||
case WKBMultiPoint25D: return WKBMultiPoint; | ||||
case WKBMultiLineString25D: return WKBMultiLineString; | ||||
case WKBMultiPolygon25D: return WKBMultiPolygon; | ||||
default: return type; | ||||
} | ||||
} | ||||
static int wkbDimensions( WkbType type ) | ||||
{ | ||||
switch ( type ) | ||||
{ | ||||
case WKBUnknown: return 0; | ||||
case WKBNoGeometry: return 0; | ||||
case WKBPoint25D: return 3; | ||||
case WKBLineString25D: return 3; | ||||
case WKBPolygon25D: return 3; | ||||
case WKBMultiPoint25D: return 3; | ||||
case WKBMultiLineString25D: return 3; | ||||
case WKBMultiPolygon25D: return 3; | ||||
default: return 2; | ||||
} | ||||
} | ||||
enum GeometryType | enum GeometryType | |||
{ | { | |||
Point, | Point, | |||
Line, | Line, | |||
Polygon, | Polygon, | |||
UnknownGeometry, | UnknownGeometry, | |||
NoGeometry | NoGeometry | |||
}; | }; | |||
// String representation of geometry types (set in qgis.cpp) | //! description strings for geometry types | |||
static const char *qgisVectorGeometryType[]; | static const char *vectorGeometryType( GeometryType type ) | |||
{ | ||||
switch ( type ) | ||||
{ | ||||
case Point: return "Point"; | ||||
case Line: return "Line"; | ||||
case Polygon: return "Polygon"; | ||||
case UnknownGeometry: return "Unknown geometry"; | ||||
case NoGeometry: return "No geometry"; | ||||
default: return "Invalid type"; | ||||
} | ||||
} | ||||
//! description strings for feature types | //! description strings for feature types | |||
static const char *qgisFeatureTypes[]; | static const char *featureType( WkbType type ) | |||
{ | ||||
switch ( type ) | ||||
{ | ||||
case WKBUnknown: return "WKBUnknown"; | ||||
case WKBPoint: return "WKBPoint"; | ||||
case WKBLineString: return "WKBLineString"; | ||||
case WKBPolygon: return "WKBPolygon"; | ||||
case WKBMultiPoint: return "WKBMultiLineString"; | ||||
case WKBMultiPolygon: return "WKBMultiPolygon"; | ||||
case WKBNoGeometry: return "WKBNoGeometry"; | ||||
case WKBPoint25D: return "WKBPoint25D"; | ||||
case WKBLineString25D: return "WKBLineString25D"; | ||||
case WKBPolygon25D: return "WKBPolygon25D"; | ||||
case WKBMultiPoint25D: return "WKBMultiPoint25D"; | ||||
case WKBMultiLineString25D: return "WKBMultiLineString25D"; | ||||
case WKBMultiPolygon25D: return "WKBMultiPolygon25D"; | ||||
default: return "invalid wkbtype"; | ||||
} | ||||
} | ||||
/** Raster data types. | ||||
* This is modified and extended copy of GDALDataType. | ||||
*/ | ||||
enum DataType | ||||
{ | ||||
/*! Unknown or unspecified type */ UnknownDataType = 0 | ||||
, | ||||
/*! Eight bit unsigned integer (quint8) */ Byte = 1, | ||||
/*! Sixteen bit unsigned integer (quint16) */ UInt16 = 2, | ||||
/*! Sixteen bit signed integer (qint16) */ Int16 = 3, | ||||
/*! Thirty two bit unsigned integer (quint32) */ UInt32 = 4, | ||||
/*! Thirty two bit signed integer (qint32) */ Int32 = 5, | ||||
/*! Thirty two bit floating point (float) */ Float32 = 6, | ||||
/*! Sixty four bit floating point (double) */ Float64 = 7, | ||||
/*! Complex Int16 */ CInt16 = 8, | ||||
/*! Complex Int32 */ CInt32 = 9, | ||||
/*! Complex Float32 */ CFloat32 = 10, | ||||
/*! Complex Float64 */ CFloat64 = 11, | ||||
/*! Color, alpha, red, green, blue, 4 bytes the same as | ||||
QImage::Format_ARGB32 */ ARGB32 = 12, | ||||
/*! Color, alpha, red, green, blue, 4 bytes the same as | ||||
QImage::Format_ARGB32_Premultiplied */ ARGB32_Premultiplie | ||||
d = 13 | ||||
}; | ||||
/** Map units that qgis supports | /** Map units that qgis supports | |||
* @note that QGIS < 1.4 api had only Meters, Feet, Degrees and Unknown Unit | * @note that QGIS < 1.4 api had only Meters, Feet, Degrees and Unknown Unit | |||
* @note and QGIS >1.8 returns to that | ||||
*/ | */ | |||
enum UnitType | enum UnitType | |||
{ | { | |||
Meters = 0, | Meters = 0, | |||
Feet = 1, | Feet = 1, | |||
Degrees = 2, //for 1.0 api backwards compatibility | Degrees = 2, //for 1.0 api backwards compatibility | |||
DecimalDegrees = 2, | UnknownUnit = 3, | |||
DegreesMinutesSeconds = 4, | ||||
DegreesDecimalMinutes = 5, | // for [1.4;1.8] api compatibility | |||
UnknownUnit = 3 | DecimalDegrees = 2, // was 2 | |||
DegreesMinutesSeconds = 2, // was 4 | ||||
DegreesDecimalMinutes = 2, // was 5 | ||||
}; | }; | |||
//! Provides the canonical name of the type value | ||||
// Added in version 2.0 | ||||
static QString toLiteral( QGis::UnitType unit ); | ||||
//! Converts from the canonical name to the type value | ||||
// Added in version 2.0 | ||||
static UnitType fromLiteral( QString literal, QGis::UnitType defaultTy | ||||
pe = UnknownUnit ); | ||||
//! Provides translated version of the type value | ||||
// Added in version 2.0 | ||||
static QString tr( QGis::UnitType unit ); | ||||
//! User defined event types | //! User defined event types | |||
enum UserEvent | enum UserEvent | |||
{ | { | |||
// These first two are useful for threads to alert their parent data providers | // These first two are useful for threads to alert their parent data providers | |||
//! The extents have been calculated by a provider of a layer | //! The extents have been calculated by a provider of a layer | |||
ProviderExtentCalcEvent = ( QEvent::User + 1 ), | ProviderExtentCalcEvent = ( QEvent::User + 1 ), | |||
//! The row count has been calculated by a provider of a layer | //! The row count has been calculated by a provider of a layer | |||
ProviderCountCalcEvent | ProviderCountCalcEvent | |||
}; | }; | |||
static const double DEFAULT_IDENTIFY_RADIUS; | static const double DEFAULT_IDENTIFY_RADIUS; | |||
private: | ||||
// String representation of unit types (set in qgis.cpp) | ||||
static const char *qgisUnitTypes[]; | ||||
}; | }; | |||
// hack to workaround warnings when casting void pointers | // hack to workaround warnings when casting void pointers | |||
// retrieved from QLibrary::resolve to function pointers. | // retrieved from QLibrary::resolve to function pointers. | |||
// It's assumed that this works on all systems supporting | // It's assumed that this works on all systems supporting | |||
// QLibrary | // QLibrary | |||
inline void ( *cast_to_fptr( void *p ) )() | inline void ( *cast_to_fptr( void *p ) )() | |||
{ | { | |||
union | union | |||
{ | { | |||
void *p; | void *p; | |||
void ( *f )(); | void ( *f )(); | |||
} u; | } u; | |||
u.p = p; | u.p = p; | |||
return u.f; | return u.f; | |||
} | } | |||
// | // | |||
// return a string representation of a double | ||||
// | ||||
inline QString qgsDoubleToString( const double &a ) | ||||
{ | ||||
return QString::number( a, 'f', 17 ).remove( QRegExp( "\\.?0+$" ) ); | ||||
} | ||||
// | ||||
// compare two doubles (but allow some difference) | // compare two doubles (but allow some difference) | |||
// | // | |||
inline bool doubleNear( double a, double b, double epsilon = 4 * DBL_EPSILO N ) | inline bool qgsDoubleNear( double a, double b, double epsilon = 4 * DBL_EPS ILON ) | |||
{ | { | |||
const double diff = a - b; | const double diff = a - b; | |||
return diff > -epsilon && diff <= epsilon; | return diff > -epsilon && diff <= epsilon; | |||
} | } | |||
// | ||||
// compare two doubles using specified number of significant digits | ||||
// | ||||
inline bool qgsDoubleNearSig( double a, double b, int significantDigits = 1 | ||||
0 ) | ||||
{ | ||||
// The most simple would be to print numbers as %.xe and compare as strin | ||||
gs | ||||
// but that is probably too costly | ||||
// Then the fastest would be to set some bits directly, but little/big en | ||||
dian | ||||
// has to be considered (maybe TODO) | ||||
// Is there a better way? | ||||
int aexp, bexp; | ||||
double ar = frexp( a, &aexp ); | ||||
double br = frexp( b, &bexp ); | ||||
return aexp == bexp && | ||||
qRound( ar * pow( 10.0, significantDigits ) ) == qRound( br * pow( | ||||
10.0, significantDigits ) ) ; | ||||
} | ||||
bool qgsVariantLessThan( const QVariant& lhs, const QVariant& rhs ); | ||||
bool qgsVariantGreaterThan( const QVariant& lhs, const QVariant& rhs ); | ||||
/** Allocates size bytes and returns a pointer to the allocated memory. | ||||
Works like C malloc() but prints debug message by QgsLogger if allocati | ||||
on fails. | ||||
@param size size in bytes | ||||
*/ | ||||
void CORE_EXPORT *qgsMalloc( size_t size ); | ||||
/** Allocates memory for an array of nmemb elements of size bytes each and | ||||
returns | ||||
a pointer to the allocated memory. Works like C calloc() but prints deb | ||||
ug message | ||||
by QgsLogger if allocation fails. | ||||
@param nmemb number of elements | ||||
@param size size of element in bytes | ||||
*/ | ||||
void CORE_EXPORT *qgsCalloc( size_t nmemb, size_t size ); | ||||
/** Frees the memory space pointed to by ptr. Works like C free(). | ||||
@param ptr pointer to memory space | ||||
*/ | ||||
void CORE_EXPORT qgsFree( void *ptr ); | ||||
/** Wkt string that represents a geographic coord sys | /** Wkt string that represents a geographic coord sys | |||
* @note added in 1.8 to replace GEOWkt | * @note added in 1.8 to replace GEOWkt | |||
*/ | */ | |||
const QString GEOWKT = | extern CORE_EXPORT const QString GEOWKT; | |||
"GEOGCS[\"WGS 84\", " | extern CORE_EXPORT const QString PROJECT_SCALES; | |||
" DATUM[\"WGS_1984\", " | ||||
" SPHEROID[\"WGS 84\",6378137,298.257223563, " | ||||
" AUTHORITY[\"EPSG\",7030]], " | ||||
" TOWGS84[0,0,0,0,0,0,0], " | ||||
" AUTHORITY[\"EPSG\",6326]], " | ||||
" PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",8901]], " | ||||
" UNIT[\"DMSH\",0.0174532925199433,AUTHORITY[\"EPSG\",9108]], " | ||||
" AXIS[\"Lat\",NORTH], " | ||||
" AXIS[\"Long\",EAST], " | ||||
" AUTHORITY[\"EPSG\",4326]]"; | ||||
/** Wkt string that represents a geographic coord sys | ||||
* @note deprecated in 1.8 due to violation of coding conventions (globals | ||||
* should be in all caps). | ||||
*/ | ||||
#ifndef _MSC_VER | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
const QString GEOWkt = GEOWKT; | ||||
/** PROJ4 string that represents a geographic coord sys */ | /** PROJ4 string that represents a geographic coord sys */ | |||
extern CORE_EXPORT const QString GEOPROJ4; | extern CORE_EXPORT const QString GEOPROJ4; | |||
/** Magic number for a geographic coord sys in POSTGIS SRID */ | /** Magic number for a geographic coord sys in POSTGIS SRID */ | |||
const long GEOSRID = 4326; | const long GEOSRID = 4326; | |||
/** Magic number for a geographic coord sys in QGIS srs.db tbl_srs.srs_id * / | /** Magic number for a geographic coord sys in QGIS srs.db tbl_srs.srs_id * / | |||
const long GEOCRS_ID = 3452; | const long GEOCRS_ID = 3452; | |||
/** Magic number for a geographic coord sys in EpsgCrsId ID format */ | /** Magic number for a geographic coord sys in EpsgCrsId ID format */ | |||
const long GEO_EPSG_CRS_ID = 4326; | const long GEO_EPSG_CRS_ID = 4326; | |||
/** Geographic coord sys from EPSG authority */ | /** Geographic coord sys from EPSG authority */ | |||
const QString GEO_EPSG_CRS_AUTHID = "EPSG:4326"; | extern CORE_EXPORT const QString GEO_EPSG_CRS_AUTHID; | |||
/** The length of the string "+proj=" */ | /** The length of the string "+proj=" */ | |||
const int PROJ_PREFIX_LEN = 6; | const int PROJ_PREFIX_LEN = 6; | |||
/** The length of the string "+ellps=" */ | /** The length of the string "+ellps=" */ | |||
const int ELLPS_PREFIX_LEN = 7; | const int ELLPS_PREFIX_LEN = 7; | |||
/** The length of the string "+lat_1=" */ | /** The length of the string "+lat_1=" */ | |||
const int LAT_PREFIX_LEN = 7; | const int LAT_PREFIX_LEN = 7; | |||
/** Magick number that determines whether a projection crsid is a system (s rs.db) | /** Magick number that determines whether a projection crsid is a system (s rs.db) | |||
* or user (~/.qgis.qgis.db) defined projection. */ | * or user (~/.qgis.qgis.db) defined projection. */ | |||
const int USER_CRS_START_ID = 100000; | const int USER_CRS_START_ID = 100000; | |||
//! Constant that holds the string representation for "No ellips/No CRS" | ||||
// Added in version 2.0 | ||||
extern CORE_EXPORT const QString GEO_NONE; | ||||
// | // | |||
// Constants for point symbols | // Constants for point symbols | |||
// | // | |||
/** Magic number that determines the minimum allowable point size for point symbols */ | /** Magic number that determines the minimum allowable point size for point symbols */ | |||
const double MINIMUM_POINT_SIZE = 0.1; | const double MINIMUM_POINT_SIZE = 0.1; | |||
/** Magic number that determines the default point size for point symbols * / | /** Magic number that determines the default point size for point symbols * / | |||
const double DEFAULT_POINT_SIZE = 2.0; | const double DEFAULT_POINT_SIZE = 2.0; | |||
const double DEFAULT_LINE_WIDTH = 0.26; | const double DEFAULT_LINE_WIDTH = 0.26; | |||
/** default snapping tolerance for segments (@note added in 1.8) */ | /** default snapping tolerance for segments (@note added in 1.8) */ | |||
const double DEFAULT_SEGMENT_EPSILON = 1e-8; | const double DEFAULT_SEGMENT_EPSILON = 1e-8; | |||
typedef QMap<QString, QString> QgsStringMap; | ||||
// FIXME: also in qgisinterface.h | // FIXME: also in qgisinterface.h | |||
#ifndef QGISEXTERN | #ifndef QGISEXTERN | |||
#ifdef WIN32 | #ifdef WIN32 | |||
# define QGISEXTERN extern "C" __declspec( dllexport ) | # define QGISEXTERN extern "C" __declspec( dllexport ) | |||
# ifdef _MSC_VER | # ifdef _MSC_VER | |||
// do not warn about C bindings returing QString | // do not warn about C bindings returing QString | |||
# pragma warning(disable:4190) | # pragma warning(disable:4190) | |||
# endif | # endif | |||
#else | #else | |||
# define QGISEXTERN extern "C" | # define QGISEXTERN extern "C" | |||
End of changes. 15 change blocks. | ||||
29 lines changed or deleted | 196 lines changed or added | |||
qgisinterface.h | qgisinterface.h | |||
---|---|---|---|---|
skipping to change at line 34 | skipping to change at line 34 | |||
class QDockWidget; | class QDockWidget; | |||
class QMainWindow; | class QMainWindow; | |||
class QWidget; | class QWidget; | |||
class QgsComposerView; | class QgsComposerView; | |||
class QgsMapLayer; | class QgsMapLayer; | |||
class QgsMapCanvas; | class QgsMapCanvas; | |||
class QgsRasterLayer; | class QgsRasterLayer; | |||
class QgsVectorLayer; | class QgsVectorLayer; | |||
class QgsLegendInterface; | class QgsLegendInterface; | |||
class QgsPluginManagerInterface; | ||||
class QgsFeature; | class QgsFeature; | |||
class QgsMessageBar; | ||||
#include <QObject> | #include <QObject> | |||
#include <QFont> | ||||
#include <QPair> | #include <QPair> | |||
#include <map> | #include <map> | |||
#include <qgis.h> | #include <qgis.h> | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
# pragma warning( push ) | # pragma warning( push ) | |||
# pragma warning( disable: 4996 ) // was declared deprecated | # pragma warning( disable: 4996 ) // was declared deprecated | |||
#endif | #endif | |||
skipping to change at line 76 | skipping to change at line 79 | |||
QgisInterface(); | QgisInterface(); | |||
/** Virtual destructor */ | /** Virtual destructor */ | |||
virtual ~QgisInterface(); | virtual ~QgisInterface(); | |||
/** Get pointer to legend interface | /** Get pointer to legend interface | |||
\note added in 1.4 | \note added in 1.4 | |||
*/ | */ | |||
virtual QgsLegendInterface* legendInterface() = 0; | virtual QgsLegendInterface* legendInterface() = 0; | |||
virtual QgsPluginManagerInterface* pluginManagerInterface() = 0; | ||||
public slots: // TODO: do these functions really need to be slots? | public slots: // TODO: do these functions really need to be slots? | |||
/* Exposed functions */ | ||||
//! Zoom to full extent of map layers | //! Zoom to full extent of map layers | |||
virtual void zoomFull() = 0; | virtual void zoomFull() = 0; | |||
//! Zoom to previous view extent | //! Zoom to previous view extent | |||
virtual void zoomToPrevious() = 0; | virtual void zoomToPrevious() = 0; | |||
//! Zoom to next view extent | //! Zoom to next view extent | |||
virtual void zoomToNext() = 0; | virtual void zoomToNext() = 0; | |||
//! Zoom to extent of the active layer | //! Zoom to extent of the active layer | |||
virtual void zoomToActiveLayer() = 0; | virtual void zoomToActiveLayer() = 0; | |||
//! Add a vector layer | //! Add a vector layer | |||
virtual QgsVectorLayer* addVectorLayer( QString vectorLayerPath, QStrin g baseName, QString providerKey ) = 0; | virtual QgsVectorLayer* addVectorLayer( QString vectorLayerPath, QStrin g baseName, QString providerKey ) = 0; | |||
//! Add a raster layer given a raster layer file name | //! Add a raster layer given a raster layer file name | |||
virtual QgsRasterLayer* addRasterLayer( QString rasterLayerPath, QStrin g baseName = QString() ) = 0; | virtual QgsRasterLayer* addRasterLayer( QString rasterLayerPath, QStrin g baseName = QString() ) = 0; | |||
//! Add a WMS layer | //! Add a WMS layer | |||
virtual QgsRasterLayer* addRasterLayer( const QString& url, const QStri | virtual QgsRasterLayer* addRasterLayer( const QString& url, const QStri | |||
ng& layerName, const QString& providerKey, const QStringList& layers, | ng& layerName, const QString& providerKey ) = 0; | |||
const QStringList& styles, cons | ||||
t QString& format, const QString& crs ) = 0; | ||||
//! Add a project | //! Add a project | |||
virtual bool addProject( QString theProject ) = 0; | virtual bool addProject( QString theProject ) = 0; | |||
//! Start a blank project | //! Start a blank project | |||
virtual void newProject( bool thePromptToSaveFlag = false ) = 0; | virtual void newProject( bool thePromptToSaveFlag = false ) = 0; | |||
//! Get pointer to the active layer (layer selected in the legend) | //! Get pointer to the active layer (layer selected in the legend) | |||
virtual QgsMapLayer *activeLayer() = 0; | virtual QgsMapLayer *activeLayer() = 0; | |||
//! Set the active layer (layer gets selected in the legend) | //! Set the active layer (layer gets selected in the legend) | |||
//! returns true if the layer exists, false otherwise | //! returns true if the layer exists, false otherwise | |||
//! added in 1.4 | //! added in 1.4 | |||
virtual bool setActiveLayer( QgsMapLayer * ) = 0; | virtual bool setActiveLayer( QgsMapLayer * ) = 0; | |||
//! Add an icon to the plugins toolbar | //! Add an icon to the plugins toolbar | |||
virtual int addToolBarIcon( QAction *qAction ) = 0; | virtual int addToolBarIcon( QAction *qAction ) = 0; | |||
/** | ||||
* Add a widget to the plugins toolbar. | ||||
* To remove this widget again, call {@link removeToolBarIcon} | ||||
* with the returned QAction. | ||||
* | ||||
* @param widget widget to add. The toolbar will take ownership of this | ||||
widget | ||||
* @return the QAction you can use to remove this widget from the toolb | ||||
ar | ||||
*/ | ||||
virtual QAction* addToolBarWidget( QWidget* widget ) = 0; | ||||
//! Remove an action (icon) from the plugin toolbar | //! Remove an action (icon) from the plugin toolbar | |||
virtual void removeToolBarIcon( QAction *qAction ) = 0; | virtual void removeToolBarIcon( QAction *qAction ) = 0; | |||
/** | ||||
* Add a widget to the raster toolbar. | ||||
* To remove this widget again, call {@link removeRasterToolBarIcon} | ||||
* with the returned QAction. | ||||
* | ||||
* @param widget widget to add. The toolbar will take ownership of this | ||||
widget | ||||
* @return the QAction you can use to remove this widget from the toolb | ||||
ar | ||||
*/ | ||||
virtual QAction* addRasterToolBarWidget( QWidget* widget ) = 0; | ||||
//! Add an icon to the Raster toolbar | //! Add an icon to the Raster toolbar | |||
//! @note added in 2.0 | //! @note added in 2.0 | |||
virtual int addRasterToolBarIcon( QAction *qAction ) = 0; | virtual int addRasterToolBarIcon( QAction *qAction ) = 0; | |||
//! Remove an action (icon) from the Raster toolbar | //! Remove an action (icon) from the Raster toolbar | |||
//! @note added in 2.0 | //! @note added in 2.0 | |||
virtual void removeRasterToolBarIcon( QAction *qAction ) = 0; | virtual void removeRasterToolBarIcon( QAction *qAction ) = 0; | |||
//! Add an icon to the Vector toolbar | //! Add an icon to the Vector toolbar | |||
//! @note added in 2.0 | //! @note added in 2.0 | |||
virtual int addVectorToolBarIcon( QAction *qAction ) = 0; | virtual int addVectorToolBarIcon( QAction *qAction ) = 0; | |||
/** | ||||
* Add a widget to the vector toolbar. | ||||
* To remove this widget again, call {@link removeVectorToolBarIcon} | ||||
* with the returned QAction. | ||||
* | ||||
* @param widget widget to add. The toolbar will take ownership of this | ||||
widget | ||||
* @return the QAction you can use to remove this widget from the toolb | ||||
ar | ||||
*/ | ||||
virtual QAction* addVectorToolBarWidget( QWidget* widget ) = 0; | ||||
//! Remove an action (icon) from the Vector toolbar | //! Remove an action (icon) from the Vector toolbar | |||
//! @note added in 2.0 | //! @note added in 2.0 | |||
virtual void removeVectorToolBarIcon( QAction *qAction ) = 0; | virtual void removeVectorToolBarIcon( QAction *qAction ) = 0; | |||
//! Add an icon to the Database toolbar | //! Add an icon to the Database toolbar | |||
//! @note added in 2.0 | //! @note added in 2.0 | |||
virtual int addDatabaseToolBarIcon( QAction *qAction ) = 0; | virtual int addDatabaseToolBarIcon( QAction *qAction ) = 0; | |||
/** | ||||
* Add a widget to the database toolbar. | ||||
* To remove this widget again, call {@link removeDatabaseToolBarIcon} | ||||
* with the returned QAction. | ||||
* | ||||
* @param widget widget to add. The toolbar will take ownership of this | ||||
widget | ||||
* @return the QAction you can use to remove this widget from the toolb | ||||
ar | ||||
*/ | ||||
virtual QAction* addDatabaseToolBarWidget( QWidget* widget ) = 0; | ||||
//! Remove an action (icon) from the Database toolbar | //! Remove an action (icon) from the Database toolbar | |||
//! @note added in 2.0 | //! @note added in 2.0 | |||
virtual void removeDatabaseToolBarIcon( QAction *qAction ) = 0; | virtual void removeDatabaseToolBarIcon( QAction *qAction ) = 0; | |||
//! Add an icon to the Web toolbar | //! Add an icon to the Web toolbar | |||
//! @note added in 2.0 | //! @note added in 2.0 | |||
virtual int addWebToolBarIcon( QAction *qAction ) = 0; | virtual int addWebToolBarIcon( QAction *qAction ) = 0; | |||
/** | ||||
* Add a widget to the web toolbar. | ||||
* To remove this widget again, call {@link removeWebToolBarIcon} | ||||
* with the returned QAction. | ||||
* | ||||
* @param widget widget to add. The toolbar will take ownership of this | ||||
widget | ||||
* @return the QAction you can use to remove this widget from the toolb | ||||
ar | ||||
*/ | ||||
virtual QAction* addWebToolBarWidget( QWidget* widget ) = 0; | ||||
//! Remove an action (icon) from the Web toolbar | //! Remove an action (icon) from the Web toolbar | |||
//! @note added in 2.0 | //! @note added in 2.0 | |||
virtual void removeWebToolBarIcon( QAction *qAction ) = 0; | virtual void removeWebToolBarIcon( QAction *qAction ) = 0; | |||
//! Add toolbar with specified name | //! Add toolbar with specified name | |||
virtual QToolBar * addToolBar( QString name ) = 0; | virtual QToolBar *addToolBar( QString name ) = 0; | |||
/** Return a pointer to the map canvas */ | /** Return a pointer to the map canvas */ | |||
virtual QgsMapCanvas * mapCanvas() = 0; | virtual QgsMapCanvas * mapCanvas() = 0; | |||
/** Return a pointer to the main window (instance of QgisApp in case of QGIS) */ | /** Return a pointer to the main window (instance of QgisApp in case of QGIS) */ | |||
virtual QWidget * mainWindow() = 0; | virtual QWidget * mainWindow() = 0; | |||
/** Return the message bar of the main app */ | ||||
virtual QgsMessageBar * messageBar() = 0; | ||||
/**Return mainwindows / composer views of running composer instances (c urrently only one)*/ | /**Return mainwindows / composer views of running composer instances (c urrently only one)*/ | |||
virtual QList<QgsComposerView*> activeComposers() = 0; | virtual QList<QgsComposerView*> activeComposers() = 0; | |||
/** Create a new composer | ||||
* @param title window title for new composer (one will be generated if | ||||
empty) | ||||
* @return pointer to composer's view | ||||
* @note new composer window will be shown and activated (added in 1.9) | ||||
*/ | ||||
virtual QgsComposerView* createNewComposer( QString title = QString( "" | ||||
) ) = 0; | ||||
/** Duplicate an existing parent composer from composer view | ||||
* @param composerView pointer to existing composer view | ||||
* @param title window title for duplicated composer (one will be gener | ||||
ated if empty) | ||||
* @return pointer to duplicate composer's view | ||||
* @note dupicate composer window will be hidden until loaded, then sho | ||||
wn and activated (added in 1.9) | ||||
*/ | ||||
virtual QgsComposerView* duplicateComposer( QgsComposerView* composerVi | ||||
ew, QString title = QString( "" ) ) = 0; | ||||
/** Deletes parent composer of composer view, after closing composer wi | ||||
ndow | ||||
* @note (added in 1.9) | ||||
*/ | ||||
virtual void deleteComposer( QgsComposerView* composerView ) = 0; | ||||
/** Return changeable options built from settings and/or defaults | ||||
* @note (added in 1.9) | ||||
*/ | ||||
virtual QMap<QString, QVariant> defaultStyleSheetOptions() = 0; | ||||
/** Generate stylesheet | ||||
* @param opts generated default option values, or a changed copy of th | ||||
em | ||||
* @note added in 1.9 | ||||
*/ | ||||
virtual void buildStyleSheet( const QMap<QString, QVariant>& opts ) = 0 | ||||
; | ||||
/** Save changed default option keys/values to user settings | ||||
* @note added in 1.9 | ||||
*/ | ||||
virtual void saveStyleSheetOptions( const QMap<QString, QVariant>& opts | ||||
) = 0; | ||||
/** Get reference font for initial qApp (may not be same as QgisApp) | ||||
* @note added in 1.9 | ||||
*/ | ||||
virtual QFont defaultStyleSheetFont() = 0; | ||||
/** Add action to the plugins menu */ | /** Add action to the plugins menu */ | |||
virtual void addPluginToMenu( QString name, QAction* action ) = 0; | virtual void addPluginToMenu( QString name, QAction* action ) = 0; | |||
/** Remove action from the plugins menu */ | /** Remove action from the plugins menu */ | |||
virtual void removePluginMenu( QString name, QAction* action ) = 0; | virtual void removePluginMenu( QString name, QAction* action ) = 0; | |||
/** Add "add layer" action to layer menu | /** Add "add layer" action to layer menu | |||
* @note added in 1.7 | * @note added in 1.7 | |||
*/ | */ | |||
virtual void insertAddLayerAction( QAction *action ) = 0; | virtual void insertAddLayerAction( QAction *action ) = 0; | |||
skipping to change at line 227 | skipping to change at line 328 | |||
virtual void removePluginWebMenu( QString name, QAction* action ) = 0; | virtual void removePluginWebMenu( QString name, QAction* action ) = 0; | |||
/** Add a dock widget to the main window */ | /** Add a dock widget to the main window */ | |||
virtual void addDockWidget( Qt::DockWidgetArea area, QDockWidget * dock widget ) = 0; | virtual void addDockWidget( Qt::DockWidgetArea area, QDockWidget * dock widget ) = 0; | |||
/** Remove specified dock widget from main window (doesn't delete it). | /** Remove specified dock widget from main window (doesn't delete it). | |||
* @note Added in 1.1 | * @note Added in 1.1 | |||
*/ | */ | |||
virtual void removeDockWidget( QDockWidget * dockwidget ) = 0; | virtual void removeDockWidget( QDockWidget * dockwidget ) = 0; | |||
/** refresh the legend of a layer | ||||
\deprecated use QgsLegendInterface::refreshLayerSymbology | ||||
*/ | ||||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual void refreshLegend( QgsMapLayer *l ) = 0; | ||||
/** open layer properties dialog | /** open layer properties dialog | |||
\note added in 1.5 | \note added in 1.5 | |||
*/ | */ | |||
virtual void showLayerProperties( QgsMapLayer *l ) = 0; | virtual void showLayerProperties( QgsMapLayer *l ) = 0; | |||
/** open attribute table dialog | /** open attribute table dialog | |||
\note added in 1.7 | \note added in 1.7 | |||
*/ | */ | |||
virtual void showAttributeTable( QgsVectorLayer *l ) = 0; | virtual void showAttributeTable( QgsVectorLayer *l ) = 0; | |||
skipping to change at line 270 | skipping to change at line 363 | |||
*/ | */ | |||
virtual bool unregisterMainWindowAction( QAction* action ) = 0; | virtual bool unregisterMainWindowAction( QAction* action ) = 0; | |||
// @todo is this deprecated in favour of QgsContextHelp? | // @todo is this deprecated in favour of QgsContextHelp? | |||
/** Open a url in the users browser. By default the QGIS doc directory is used | /** 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 i nstalled | * as the base for the URL. To open a URL that is not relative to the i nstalled | |||
* QGIS documentation, set useQgisDocDirectory to false. | * QGIS documentation, set useQgisDocDirectory to false. | |||
* @param url URL to open | * @param url URL to open | |||
* @param useQgisDocDirectory If true, the URL will be formed by concat enating | * @param useQgisDocDirectory If true, the URL will be formed by concat enating | |||
* url to the QGIS documentation directory path (prefix/share/doc) | * url to the QGIS documentation directory path (prefix/share/doc) | |||
* @deprecated | ||||
*/ | */ | |||
#ifndef Q_MOC_RUN | #ifndef Q_MOC_RUN | |||
Q_DECL_DEPRECATED | Q_DECL_DEPRECATED | |||
#endif | #endif | |||
virtual void openURL( QString url, bool useQgisDocDirectory = true ) = 0; | virtual void openURL( QString url, bool useQgisDocDirectory = true ) = 0; | |||
/** Accessors for inserting items into menus and toolbars. | /** Accessors for inserting items into menus and toolbars. | |||
* An item can be inserted before any existing action. | * An item can be inserted before any existing action. | |||
*/ | */ | |||
//! Menus | //! Menus | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QMenu *fileMenu() = 0; | virtual QMenu *fileMenu() = 0; | |||
virtual QMenu *projectMenu() = 0; | ||||
virtual QMenu *editMenu() = 0; | virtual QMenu *editMenu() = 0; | |||
virtual QMenu *viewMenu() = 0; | virtual QMenu *viewMenu() = 0; | |||
virtual QMenu *layerMenu() = 0; | virtual QMenu *layerMenu() = 0; | |||
/** \note added in 2.0 | ||||
*/ | ||||
virtual QMenu *newLayerMenu() = 0; | ||||
virtual QMenu *settingsMenu() = 0; | virtual QMenu *settingsMenu() = 0; | |||
virtual QMenu *pluginMenu() = 0; | virtual QMenu *pluginMenu() = 0; | |||
virtual QMenu *rasterMenu() = 0; | virtual QMenu *rasterMenu() = 0; | |||
/** \note added in 1.7 | /** \note added in 1.7 | |||
*/ | */ | |||
virtual QMenu *databaseMenu() = 0; | virtual QMenu *databaseMenu() = 0; | |||
/** \note added in 2.0 | /** \note added in 2.0 | |||
*/ | */ | |||
virtual QMenu *vectorMenu() = 0; | virtual QMenu *vectorMenu() = 0; | |||
/** \note added in 2.0 | /** \note added in 2.0 | |||
skipping to change at line 306 | skipping to change at line 407 | |||
virtual QMenu *webMenu() = 0; | virtual QMenu *webMenu() = 0; | |||
virtual QMenu *firstRightStandardMenu() = 0; | virtual QMenu *firstRightStandardMenu() = 0; | |||
virtual QMenu *windowMenu() = 0; | virtual QMenu *windowMenu() = 0; | |||
virtual QMenu *helpMenu() = 0; | virtual QMenu *helpMenu() = 0; | |||
//! ToolBars | //! ToolBars | |||
virtual QToolBar *fileToolBar() = 0; | virtual QToolBar *fileToolBar() = 0; | |||
virtual QToolBar *layerToolBar() = 0; | virtual QToolBar *layerToolBar() = 0; | |||
virtual QToolBar *mapNavToolToolBar() = 0; | virtual QToolBar *mapNavToolToolBar() = 0; | |||
virtual QToolBar *digitizeToolBar() = 0; | virtual QToolBar *digitizeToolBar() = 0; | |||
virtual QToolBar *advancedDigitizeToolBar() = 0; // added in v1.5 | virtual QToolBar *advancedDigitizeToolBar() = 0; // added in v1.5 | |||
virtual QToolBar *attributesToolBar() = 0; | virtual QToolBar *attributesToolBar() = 0; | |||
virtual QToolBar *pluginToolBar() = 0; | virtual QToolBar *pluginToolBar() = 0; | |||
virtual QToolBar *helpToolBar() = 0; | virtual QToolBar *helpToolBar() = 0; | |||
/** \note added in 1.7 | /** \note added in 1.7 | |||
*/ | */ | |||
virtual QToolBar *rasterToolBar() = 0; | virtual QToolBar *rasterToolBar() = 0; | |||
/** \note added in 2.0 | /** \note added in 2.0 | |||
*/ | */ | |||
virtual QToolBar *vectorToolBar() = 0; | virtual QToolBar *vectorToolBar() = 0; | |||
/** \note added in 2.0 | /** \note added in 2.0 | |||
*/ | */ | |||
virtual QToolBar *databaseToolBar() = 0; | virtual QToolBar *databaseToolBar() = 0; | |||
/** \note added in 2.0 | /** \note added in 2.0 | |||
*/ | */ | |||
virtual QToolBar *webToolBar() = 0; | virtual QToolBar *webToolBar() = 0; | |||
//! File menu actions | //! Project menu actions | |||
virtual QAction *actionNewProject() = 0; | virtual QAction *actionNewProject() = 0; | |||
virtual QAction *actionOpenProject() = 0; | virtual QAction *actionOpenProject() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionFileSeparator1() = 0; | ||||
virtual QAction *actionSaveProject() = 0; | virtual QAction *actionSaveProject() = 0; | |||
virtual QAction *actionSaveProjectAs() = 0; | virtual QAction *actionSaveProjectAs() = 0; | |||
virtual QAction *actionSaveMapAsImage() = 0; | virtual QAction *actionSaveMapAsImage() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionFileSeparator2() = 0; | ||||
virtual QAction *actionProjectProperties() = 0; | virtual QAction *actionProjectProperties() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionFileSeparator3() = 0; | ||||
virtual QAction *actionPrintComposer() = 0; | virtual QAction *actionPrintComposer() = 0; | |||
#ifndef Q_MOC_RUN | virtual QAction *actionShowComposerManager() = 0; | |||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionFileSeparator4() = 0; | ||||
virtual QAction *actionExit() = 0; | virtual QAction *actionExit() = 0; | |||
//! Edit menu actions | //! Edit menu actions | |||
virtual QAction *actionCutFeatures() = 0; | virtual QAction *actionCutFeatures() = 0; | |||
virtual QAction *actionCopyFeatures() = 0; | virtual QAction *actionCopyFeatures() = 0; | |||
virtual QAction *actionPasteFeatures() = 0; | virtual QAction *actionPasteFeatures() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionEditSeparator1() = 0; | ||||
virtual QAction *actionAddFeature() = 0; | virtual QAction *actionAddFeature() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionCapturePoint() = 0; | ||||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionCaptureLine() = 0; | ||||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionCapturePolygon() = 0; | ||||
virtual QAction *actionDeleteSelected() = 0; | virtual QAction *actionDeleteSelected() = 0; | |||
virtual QAction *actionMoveFeature() = 0; | virtual QAction *actionMoveFeature() = 0; | |||
virtual QAction *actionSplitFeatures() = 0; | virtual QAction *actionSplitFeatures() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionAddVertex() = 0; | ||||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionDeleteVertex() = 0; | ||||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionMoveVertex() = 0; | ||||
virtual QAction *actionAddRing() = 0; | virtual QAction *actionAddRing() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionAddIsland() = 0; | ||||
virtual QAction *actionAddPart() = 0; | virtual QAction *actionAddPart() = 0; | |||
virtual QAction *actionSimplifyFeature() = 0; | virtual QAction *actionSimplifyFeature() = 0; | |||
virtual QAction *actionDeleteRing() = 0; | virtual QAction *actionDeleteRing() = 0; | |||
virtual QAction *actionDeletePart() = 0; | virtual QAction *actionDeletePart() = 0; | |||
virtual QAction *actionNodeTool() = 0; | virtual QAction *actionNodeTool() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionEditSeparator2() = 0; | ||||
//! View menu actions | //! View menu actions | |||
virtual QAction *actionPan() = 0; | virtual QAction *actionPan() = 0; | |||
virtual QAction *actionTouch() = 0; | ||||
virtual QAction *actionPanToSelected() = 0; | virtual QAction *actionPanToSelected() = 0; | |||
virtual QAction *actionZoomIn() = 0; | virtual QAction *actionZoomIn() = 0; | |||
virtual QAction *actionZoomOut() = 0; | virtual QAction *actionZoomOut() = 0; | |||
virtual QAction *actionSelect() = 0; | virtual QAction *actionSelect() = 0; | |||
virtual QAction *actionSelectRectangle() = 0; | virtual QAction *actionSelectRectangle() = 0; | |||
virtual QAction *actionSelectPolygon() = 0; | virtual QAction *actionSelectPolygon() = 0; | |||
virtual QAction *actionSelectFreehand() = 0; | virtual QAction *actionSelectFreehand() = 0; | |||
virtual QAction *actionSelectRadius() = 0; | virtual QAction *actionSelectRadius() = 0; | |||
virtual QAction *actionIdentify() = 0; | virtual QAction *actionIdentify() = 0; | |||
virtual QAction *actionMeasure() = 0; | virtual QAction *actionMeasure() = 0; | |||
virtual QAction *actionMeasureArea() = 0; | virtual QAction *actionMeasureArea() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionViewSeparator1() = 0; | ||||
virtual QAction *actionZoomFullExtent() = 0; | virtual QAction *actionZoomFullExtent() = 0; | |||
virtual QAction *actionZoomToLayer() = 0; | virtual QAction *actionZoomToLayer() = 0; | |||
virtual QAction *actionZoomToSelected() = 0; | virtual QAction *actionZoomToSelected() = 0; | |||
virtual QAction *actionZoomLast() = 0; | virtual QAction *actionZoomLast() = 0; | |||
virtual QAction *actionZoomActualSize() = 0; | virtual QAction *actionZoomActualSize() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionViewSeparator2() = 0; | ||||
virtual QAction *actionMapTips() = 0; | virtual QAction *actionMapTips() = 0; | |||
virtual QAction *actionNewBookmark() = 0; | virtual QAction *actionNewBookmark() = 0; | |||
virtual QAction *actionShowBookmarks() = 0; | virtual QAction *actionShowBookmarks() = 0; | |||
virtual QAction *actionDraw() = 0; | virtual QAction *actionDraw() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionViewSeparator3() = 0; | ||||
//! Layer menu actions | //! Layer menu actions | |||
virtual QAction *actionNewVectorLayer() = 0; | virtual QAction *actionNewVectorLayer() = 0; | |||
virtual QAction *actionAddOgrLayer() = 0; | virtual QAction *actionAddOgrLayer() = 0; | |||
virtual QAction *actionAddRasterLayer() = 0; | virtual QAction *actionAddRasterLayer() = 0; | |||
virtual QAction *actionAddPgLayer() = 0; | virtual QAction *actionAddPgLayer() = 0; | |||
virtual QAction *actionAddWmsLayer() = 0; | virtual QAction *actionAddWmsLayer() = 0; | |||
#ifndef Q_MOC_RUN | /** @note added in 1.9 */ | |||
Q_DECL_DEPRECATED | virtual QAction *actionCopyLayerStyle() = 0; | |||
#endif | /** @note added in 1.9 */ | |||
virtual QAction *actionLayerSeparator1() = 0; | virtual QAction *actionPasteLayerStyle() = 0; | |||
virtual QAction *actionOpenTable() = 0; | virtual QAction *actionOpenTable() = 0; | |||
virtual QAction *actionOpenFieldCalculator() = 0; | ||||
virtual QAction *actionToggleEditing() = 0; | virtual QAction *actionToggleEditing() = 0; | |||
/** @note added in 1.9 */ | ||||
virtual QAction *actionSaveActiveLayerEdits() = 0; | ||||
/** @note added in 1.9 */ | ||||
virtual QAction *actionAllEdits() = 0; | ||||
/** @note added in 1.9 */ | ||||
virtual QAction *actionSaveEdits() = 0; | ||||
/** @note added in 1.9 */ | ||||
virtual QAction *actionSaveAllEdits() = 0; | ||||
/** @note added in 1.9 */ | ||||
virtual QAction *actionRollbackEdits() = 0; | ||||
/** @note added in 1.9 */ | ||||
virtual QAction *actionRollbackAllEdits() = 0; | ||||
/** @note added in 1.9 */ | ||||
virtual QAction *actionCancelEdits() = 0; | ||||
/** @note added in 1.9 */ | ||||
virtual QAction *actionCancelAllEdits() = 0; | ||||
virtual QAction *actionLayerSaveAs() = 0; | virtual QAction *actionLayerSaveAs() = 0; | |||
virtual QAction *actionLayerSelectionSaveAs() = 0; | virtual QAction *actionLayerSelectionSaveAs() = 0; | |||
virtual QAction *actionRemoveLayer() = 0; | virtual QAction *actionRemoveLayer() = 0; | |||
/** @note added in 1.9 */ | ||||
virtual QAction *actionDuplicateLayer() = 0; | ||||
virtual QAction *actionLayerProperties() = 0; | virtual QAction *actionLayerProperties() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionLayerSeparator2() = 0; | ||||
virtual QAction *actionAddToOverview() = 0; | virtual QAction *actionAddToOverview() = 0; | |||
virtual QAction *actionAddAllToOverview() = 0; | virtual QAction *actionAddAllToOverview() = 0; | |||
virtual QAction *actionRemoveAllFromOverview() = 0; | virtual QAction *actionRemoveAllFromOverview() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionLayerSeparator3() = 0; | ||||
virtual QAction *actionHideAllLayers() = 0; | virtual QAction *actionHideAllLayers() = 0; | |||
virtual QAction *actionShowAllLayers() = 0; | virtual QAction *actionShowAllLayers() = 0; | |||
//! Plugin menu actions | //! Plugin menu actions | |||
virtual QAction *actionManagePlugins() = 0; | virtual QAction *actionManagePlugins() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionPluginSeparator1() = 0; | ||||
virtual QAction *actionPluginListSeparator() = 0; | virtual QAction *actionPluginListSeparator() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionPluginSeparator2() = 0; | ||||
virtual QAction *actionPluginPythonSeparator() = 0; | ||||
virtual QAction *actionShowPythonDialog() = 0; | virtual QAction *actionShowPythonDialog() = 0; | |||
//! Settings menu actions | //! Settings menu actions | |||
virtual QAction *actionToggleFullScreen() = 0; | virtual QAction *actionToggleFullScreen() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionSettingsSeparator1() = 0; | ||||
virtual QAction *actionOptions() = 0; | virtual QAction *actionOptions() = 0; | |||
virtual QAction *actionCustomProjection() = 0; | virtual QAction *actionCustomProjection() = 0; | |||
//! Help menu actions | //! Help menu actions | |||
virtual QAction *actionHelpContents() = 0; | virtual QAction *actionHelpContents() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionHelpSeparator1() = 0; | ||||
virtual QAction *actionQgisHomePage() = 0; | virtual QAction *actionQgisHomePage() = 0; | |||
virtual QAction *actionCheckQgisVersion() = 0; | virtual QAction *actionCheckQgisVersion() = 0; | |||
#ifndef Q_MOC_RUN | ||||
Q_DECL_DEPRECATED | ||||
#endif | ||||
virtual QAction *actionHelpSeparator2() = 0; | ||||
virtual QAction *actionAbout() = 0; | virtual QAction *actionAbout() = 0; | |||
//! Open feature form | //! Open feature form | |||
// returns true when dialog was accepted | // returns true when dialog was accepted | |||
// @added in 1.6 | // @added in 1.6 | |||
virtual bool openFeatureForm( QgsVectorLayer *vlayer, QgsFeature &f, bo | virtual bool openFeatureForm( QgsVectorLayer *l, QgsFeature &f, bool up | |||
ol updateFeatureOnly = false ) = 0; | dateFeatureOnly = false ) = 0; | |||
virtual QDialog* getFeatureForm( QgsVectorLayer *l, QgsFeature &f ) = 0 | ||||
; | ||||
virtual void preloadForm( QString uifile ) = 0; | ||||
/** Return vector layers in edit mode | ||||
* @param modified whether to return only layers that have been modifie | ||||
d | ||||
* @returns list of layers in legend order, or empty list | ||||
* @note added in 1.9 */ | ||||
virtual QList<QgsMapLayer *> editableLayers( bool modified = false ) co | ||||
nst = 0; | ||||
/** Get timeout for timed messages: default of 5 seconds | ||||
* @note added in 1.9 */ | ||||
virtual int messageTimeout() = 0; | ||||
signals: | signals: | |||
/** Emited whenever current (selected) layer changes. | /** Emitted whenever current (selected) layer changes. | |||
* The pointer to layer can be null if no layer is selected | * The pointer to layer can be null if no layer is selected | |||
*/ | */ | |||
void currentLayerChanged( QgsMapLayer * layer ); | void currentLayerChanged( QgsMapLayer * layer ); | |||
/**This signal is emitted when a new composer instance has been created | /**This signal is emitted when a new composer instance has been created | |||
* @note added in 1.4 | * @note added in 1.4 | |||
*/ | */ | |||
void composerAdded( QgsComposerView* v ); | void composerAdded( QgsComposerView* v ); | |||
/**This signal is emitted before a new composer instance is going to be removed | /**This signal is emitted before a new composer instance is going to be removed | |||
* @note added in 1.4 | * @note added in 1.4 | |||
*/ | */ | |||
void composerWillBeRemoved( QgsComposerView* v ); | void composerWillBeRemoved( QgsComposerView* v ); | |||
/**This signal is emitted when the initialization is complete | /**This signal is emitted when the initialization is complete | |||
* @note added in version 1.6 | * @note added in version 1.6 | |||
*/ | */ | |||
void initializationCompleted(); | void initializationCompleted(); | |||
/** emitted when a project file is successfully read | /** emitted when a project file is successfully read | |||
@note | @note | |||
This is useful for plug-ins that store properties with project file s. A | This is useful for plug-ins that store properties with project file s. A | |||
plug-in can connect to this signal. When it is emitted, the plug-i n | plug-in can connect to this signal. When it is emitted, the plug-i n | |||
knows to then check the project properties for any relevant state. | knows to then check the project properties for any relevant state. | |||
skipping to change at line 544 | skipping to change at line 589 | |||
@note | @note | |||
This is similar to projectRead(); plug-ins might want to be notifie d | This is similar to projectRead(); plug-ins might want to be notifie d | |||
that they're in a new project. Yes, projectRead() could have been | that they're in a new project. Yes, projectRead() could have been | |||
overloaded to be used in the case of new projects instead. However , | overloaded to be used in the case of new projects instead. However , | |||
it's probably more semantically correct to have an entirely separat e | it's probably more semantically correct to have an entirely separat e | |||
signal for when this happens. | signal for when this happens. | |||
Added in v1.6 | Added in v1.6 | |||
*/ | */ | |||
void newProjectCreated(); | void newProjectCreated(); | |||
}; | }; | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
# pragma warning( pop ) | # pragma warning( pop ) | |||
# pragma warning( disable: 4190 ) | # pragma warning( disable: 4190 ) | |||
#endif | #endif | |||
// FIXME: also in core/qgis.h | // FIXME: also in core/qgis.h | |||
#ifndef QGISEXTERN | #ifndef QGISEXTERN | |||
#ifdef WIN32 | #ifdef WIN32 | |||
End of changes. 53 change blocks. | ||||
120 lines changed or deleted | 185 lines changed or added | |||
qgisplugin.h | qgisplugin.h | |||
---|---|---|---|---|
skipping to change at line 15 | skipping to change at line 15 | |||
Copyright : (C) 2007 by Gary E. Sherman | Copyright : (C) 2007 by Gary E. Sherman | |||
Email : sherman at mrcc dot com | Email : sherman at mrcc dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
/*! Quantum GIS - Plugin API | /*! QGIS - Plugin API | |||
* | * | |||
* \section about About QGis Plugins | * \section about About QGis Plugins | |||
* Plugins provide additional functionality to QGis. Plugins must | * Plugins provide additional functionality to QGis. Plugins must | |||
* implement several required methods in order to be registered with | * implement several required methods in order to be registered with | |||
* QGis. These methods include: | * QGis. These methods include: | |||
* <ul>name | * <ul>name | |||
* <li>version | * <li>version | |||
* <li>description | * <li>description | |||
* </ul> | * </ul> | |||
* | * | |||
skipping to change at line 68 | skipping to change at line 68 | |||
TOOLBAR_BUTTON, | TOOLBAR_BUTTON, | |||
}; | }; | |||
@todo XXX this may be a hint that there should be subclasses | @todo XXX this may be a hint that there should be subclasses | |||
*/ | */ | |||
enum PLUGINTYPE | enum PLUGINTYPE | |||
{ | { | |||
UI = 1, /* user interface plug-in */ | UI = 1, /* user interface plug-in */ | |||
MAPLAYER, /* map layer plug-in */ | MAPLAYER, /* map layer plug-in */ | |||
RENDERER, /*a plugin for a new renderer class*/ | RENDERER, /*a plugin for a new renderer class*/ | |||
VECTOR_OVERLAY /*an overlay plugin. Added in version 1 .1*/ | ||||
}; | }; | |||
QgisPlugin( QString const & name = "", | QgisPlugin( QString const & name = "", | |||
QString const & description = "", | QString const & description = "", | |||
QString const & category = "", | QString const & category = "", | |||
QString const & version = "", | QString const & version = "", | |||
PLUGINTYPE const & type = MAPLAYER ) | PLUGINTYPE const & type = MAPLAYER ) | |||
: mName( name ), | : mName( name ), | |||
mDescription( description ), | mDescription( description ), | |||
mCategory( category ), | mCategory( category ), | |||
skipping to change at line 200 | skipping to change at line 199 | |||
//! Typedef for getting the plugin type without instantiating the plugin | //! Typedef for getting the plugin type without instantiating the plugin | |||
typedef int type_t(); | typedef int type_t(); | |||
//! Typedef for getting the plugin version without instantiating the plugin | //! Typedef for getting the plugin version without instantiating the plugin | |||
typedef QString version_t(); | typedef QString version_t(); | |||
//! Typedef for getting the plugin icon file name without instantiating the plugin | //! Typedef for getting the plugin icon file name without instantiating the plugin | |||
typedef QString icon_t(); | typedef QString icon_t(); | |||
//! Typedef for getting the experimental status without instantiating the p | ||||
lugin | ||||
typedef QString experimental_t(); | ||||
#endif //qgisplugin_h | #endif //qgisplugin_h | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 5 lines changed or added | |||
qgsapplication.h | qgsapplication.h | |||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSAPPLICATION_H | #ifndef QGSAPPLICATION_H | |||
#define QGSAPPLICATION_H | #define QGSAPPLICATION_H | |||
#include <QApplication> | #include <QApplication> | |||
#include <QEvent> | #include <QEvent> | |||
#include <QStringList> | #include <QStringList> | |||
#include <qgis.h> | #include <qgis.h> | |||
#include <qgsconfig.h> | ||||
#define ABISYM(x) x ## VERSION_INT | ||||
/** \ingroup core | /** \ingroup core | |||
* Extends QApplication to provide access to QGIS specific resources such | * Extends QApplication to provide access to QGIS specific resources such | |||
* as theme paths, database paths etc. | * as theme paths, database paths etc. | |||
*/ | */ | |||
class CORE_EXPORT QgsApplication: public QApplication | class CORE_EXPORT QgsApplication: public QApplication | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
//! @note customConfigDir parameter added in v1.6 | //! @note customConfigDir parameter added in v1.6 | |||
skipping to change at line 71 | skipping to change at line 70 | |||
* be reverted to 'default'. | * be reverted to 'default'. | |||
*/ | */ | |||
static void setThemeName( const QString theThemeName ); | static void setThemeName( const QString theThemeName ); | |||
/** Set the active theme to the specified theme. | /** Set the active theme to the specified theme. | |||
* The theme name should be a single word e.g. 'default','classic'. | * The theme name should be a single word e.g. 'default','classic'. | |||
* The theme search path usually will be pkgDataPath + "/themes/" + the mName + "/" | * The theme search path usually will be pkgDataPath + "/themes/" + the mName + "/" | |||
* but plugin writers etc can use this method as a basis for searching | * but plugin writers etc can use this method as a basis for searching | |||
* for resources in their own datastores e.g. a Qt4 resource bundle. | * for resources in their own datastores e.g. a Qt4 resource bundle. | |||
*/ | */ | |||
static const QString themeName() ; | static const QString themeName(); | |||
//! Returns the path to the authors file. | //! Returns the path to the authors file. | |||
static const QString authorsFilePath(); | static const QString authorsFilePath(); | |||
/** Returns the path to the contributors file. | /** Returns the path to the contributors file. | |||
* Contributors are people who have submitted patches | * Contributors are people who have submitted patches | |||
* but don't have svn write access. | * but don't have svn write access. | |||
* @note this function was added in version 1.3 */ | * @note this function was added in version 1.3 */ | |||
static const QString contributorsFilePath(); | static const QString contributorsFilePath(); | |||
skipping to change at line 96 | skipping to change at line 95 | |||
/** Returns the path to the donors file. | /** Returns the path to the donors file. | |||
@note this function was added in version 1.2*/ | @note this function was added in version 1.2*/ | |||
static const QString donorsFilePath(); | static const QString donorsFilePath(); | |||
/** | /** | |||
* Returns the path to the sponsors file. | * Returns the path to the sponsors file. | |||
* @note This was added in QGIS 1.1 | * @note This was added in QGIS 1.1 | |||
*/ | */ | |||
static const QString translatorsFilePath(); | static const QString translatorsFilePath(); | |||
//! Returns the path to the developer image directory. | /*! | |||
//! @deprecated images are not provided anymore :-P | Returns the path to the licence file. | |||
Q_DECL_DEPRECATED static const QString developerPath(); | */ | |||
static const QString licenceFilePath(); | ||||
//! Returns the path to the help application. | //! Returns the path to the help application. | |||
static const QString helpAppPath(); | static const QString helpAppPath(); | |||
//! Returns the path to the translation directory. | //! Returns the path to the translation directory. | |||
static const QString i18nPath(); | static const QString i18nPath(); | |||
//! Returns the path to the master qgis.db file. | //! Returns the path to the master qgis.db file. | |||
static const QString qgisMasterDbFilePath(); | static const QString qgisMasterDbFilePath(); | |||
skipping to change at line 128 | skipping to change at line 128 | |||
//! Returns the path to the icons image directory. | //! Returns the path to the icons image directory. | |||
static const QString iconsPath(); | static const QString iconsPath(); | |||
//! Returns the path to the srs.db file. | //! Returns the path to the srs.db file. | |||
static const QString srsDbFilePath(); | static const QString srsDbFilePath(); | |||
//! Returns the pathes to svg directories. | //! Returns the pathes to svg directories. | |||
//! @note added in 1.4 | //! @note added in 1.4 | |||
static const QStringList svgPaths(); | static const QStringList svgPaths(); | |||
//! Returns the paths to svg applications svg directory. | //! Returns the system environment variables passed to application. | |||
//! @deprecated since 1.4 - use svgPaths() | //! @note added in 1.9 | |||
Q_DECL_DEPRECATED static const QString svgPath(); | static const QMap<QString, QString> systemEnvVars() { return ABISYM( mS | |||
ystemEnvVars ); } | ||||
//! Returns the path to the application prefix directory. | //! Returns the path to the application prefix directory. | |||
static const QString prefixPath(); | static const QString prefixPath(); | |||
//! Returns the path to the application plugin directory. | //! Returns the path to the application plugin directory. | |||
static const QString pluginPath(); | static const QString pluginPath(); | |||
//! Returns the common root path of all application data directories. | //! Returns the common root path of all application data directories. | |||
static const QString pkgDataPath(); | static const QString pkgDataPath(); | |||
skipping to change at line 152 | skipping to change at line 152 | |||
static const QString activeThemePath(); | static const QString activeThemePath(); | |||
//! Returns the path to the default theme directory. | //! Returns the path to the default theme directory. | |||
static const QString defaultThemePath(); | static const QString defaultThemePath(); | |||
//! Returns path to the desired icon file. | //! Returns path to the desired icon file. | |||
//! First it tries to use the active theme path, then default theme pat h | //! First it tries to use the active theme path, then default theme pat h | |||
//! @note Added in 1.5 | //! @note Added in 1.5 | |||
static QString iconPath( QString iconFile ); | static QString iconPath( QString iconFile ); | |||
//! Helper to get a theme icon. It will fall back to the | ||||
//! default theme if the active theme does not have the required icon. | ||||
//! @note Added in 2.0 | ||||
static QIcon getThemeIcon( const QString theName ); | ||||
//! Helper to get a theme icon as a pixmap. It will fall back to the | ||||
//! default theme if the active theme does not have the required icon. | ||||
//! @note Added in 2.0 | ||||
static QPixmap getThemePixmap( const QString theName ); | ||||
//! Returns the path to user's style. Added in QGIS 1.4 | //! Returns the path to user's style. Added in QGIS 1.4 | |||
static const QString userStyleV2Path(); | static const QString userStyleV2Path(); | |||
//! Returns the path to default style (works as a starting point). Adde d in QGIS 1.4 | //! Returns the path to default style (works as a starting point). Adde d in QGIS 1.4 | |||
static const QString defaultStyleV2Path(); | static const QString defaultStyleV2Path(); | |||
//! Returns the path containing qgis_core, qgis_gui, qgispython (and ot her) libraries | //! Returns the path containing qgis_core, qgis_gui, qgispython (and ot her) libraries | |||
//! @note Added in 2.0 | //! @note Added in 2.0 | |||
static const QString libraryPath(); | static const QString libraryPath(); | |||
skipping to change at line 181 | skipping to change at line 191 | |||
//! Alters pkg data path - used by 3rd party apps | //! Alters pkg data path - used by 3rd party apps | |||
static void setPkgDataPath( const QString thePkgDataPath ); | static void setPkgDataPath( const QString thePkgDataPath ); | |||
//! Alters default svg paths - used by 3rd party apps. Added in QGIS 1. 5 | //! Alters default svg paths - used by 3rd party apps. Added in QGIS 1. 5 | |||
static void setDefaultSvgPaths( const QStringList& pathList ); | static void setDefaultSvgPaths( const QStringList& pathList ); | |||
//! loads providers | //! loads providers | |||
static void initQgis(); | static void initQgis(); | |||
//! initialise qgis.db | ||||
static bool createDB( QString* errorMessage = 0 ); | ||||
//! deletes provider registry and map layer registry | //! deletes provider registry and map layer registry | |||
static void exitQgis(); | static void exitQgis(); | |||
/** constants for endian-ness */ | /** constants for endian-ness */ | |||
typedef enum ENDIAN | typedef enum ENDIAN | |||
{ | { | |||
XDR = 0, // network, or big-endian, byte order | XDR = 0, // network, or big-endian, byte order | |||
NDR = 1 // little-endian byte order | NDR = 1 // little-endian byte order | |||
} | } | |||
endian_t; | endian_t; | |||
skipping to change at line 204 | skipping to change at line 217 | |||
/** \brief get a standard css style sheet for reports. | /** \brief get a standard css style sheet for reports. | |||
* Typically you will use this method by doing: | * Typically you will use this method by doing: | |||
* QString myStyle = QgsApplication::reportStyleSheet(); | * QString myStyle = QgsApplication::reportStyleSheet(); | |||
* textBrowserReport->document()->setDefaultStyleSheet(myStyle); | * textBrowserReport->document()->setDefaultStyleSheet(myStyle); | |||
* @return QString containing the CSS 2.1 compliant stylesheet. | * @return QString containing the CSS 2.1 compliant stylesheet. | |||
* @note you can use the special Qt extensions too, for example | * @note you can use the special Qt extensions too, for example | |||
* the gradient fills for backgrounds. | * the gradient fills for backgrounds. | |||
*/ | */ | |||
static QString reportStyleSheet(); | static QString reportStyleSheet(); | |||
/** Convenience function to get a summary of the paths used in this | /** Convenience function to get a summary of the paths used in this | |||
* application instance useful for debugging mainly.*/ | * application instance useful for debugging mainly.*/ | |||
static QString showSettings(); | static QString showSettings(); | |||
/** Register OGR drivers ensuring this only happens once. | /** Register OGR drivers ensuring this only happens once. | |||
* This is a workaround for an issue with older gdal versions that | * This is a workaround for an issue with older gdal versions that | |||
* caused duplicate driver name entries to appear in the list | * caused duplicate driver name entries to appear in the list | |||
* of registered drivers when QgsApplication::registerOgrDrivers was ca lled multiple | * of registered drivers when QgsApplication::registerOgrDrivers was ca lled multiple | |||
* times. | * times. | |||
*/ | */ | |||
static void registerOgrDrivers(); | static void registerOgrDrivers(); | |||
/**Converts absolute path to path relative to target | /**Converts absolute path to path relative to target | |||
@note: this method was added in version 1.6*/ | @note: this method was added in version 1.6*/ | |||
skipping to change at line 253 | skipping to change at line 268 | |||
* and then calls GDALDriverManager::AutoSkipDrivers() to unregister it . The | * and then calls GDALDriverManager::AutoSkipDrivers() to unregister it . The | |||
* driver name should be the short format of the Gdal driver name e.g. GTIFF. | * driver name should be the short format of the Gdal driver name e.g. GTIFF. | |||
* @note added in 2.0 | * @note added in 2.0 | |||
*/ | */ | |||
static void restoreGdalDriver( QString theDriver ); | static void restoreGdalDriver( QString theDriver ); | |||
/** Returns the list of gdal drivers that should be skipped (based on | /** Returns the list of gdal drivers that should be skipped (based on | |||
* GDAL_SKIP environment variable) | * GDAL_SKIP environment variable) | |||
* @note added in 2.0 | * @note added in 2.0 | |||
*/ | */ | |||
static QStringList skippedGdalDrivers( ) { return ABISYM( mGdalSkipList ); }; | static QStringList skippedGdalDrivers( ) { return ABISYM( mGdalSkipList ); } | |||
/** Apply the skipped drivers list to gdal | /** Apply the skipped drivers list to gdal | |||
* @see skipGdalDriver | * @see skipGdalDriver | |||
* @see restoreGdalDriver | * @see restoreGdalDriver | |||
* @see skippedGdalDrivers | * @see skippedGdalDrivers | |||
* @note added in 2.0 */ | * @note added in 2.0 */ | |||
static void applyGdalSkippedDrivers(); | static void applyGdalSkippedDrivers(); | |||
signals: | signals: | |||
//! @note not available in python bindings | ||||
void preNotify( QObject * receiver, QEvent * event, bool * done ); | void preNotify( QObject * receiver, QEvent * event, bool * done ); | |||
private: | private: | |||
static QObject* ABISYM( mFileOpenEventReceiver ); | static QObject* ABISYM( mFileOpenEventReceiver ); | |||
static QStringList ABISYM( mFileOpenEventList ); | static QStringList ABISYM( mFileOpenEventList ); | |||
static QString ABISYM( mPrefixPath ); | static QString ABISYM( mPrefixPath ); | |||
static QString ABISYM( mPluginPath ); | static QString ABISYM( mPluginPath ); | |||
static QString ABISYM( mPkgDataPath ); | static QString ABISYM( mPkgDataPath ); | |||
static QString ABISYM( mLibraryPath ); | static QString ABISYM( mLibraryPath ); | |||
static QString ABISYM( mLibexecPath ); | static QString ABISYM( mLibexecPath ); | |||
static QString ABISYM( mThemeName ); | static QString ABISYM( mThemeName ); | |||
static QStringList ABISYM( mDefaultSvgPaths ); | static QStringList ABISYM( mDefaultSvgPaths ); | |||
static QMap<QString, QString> ABISYM( mSystemEnvVars ); | ||||
static QString ABISYM( mConfigPath ); | static QString ABISYM( mConfigPath ); | |||
/** true when running from build directory, i.e. without 'make install' */ | /** true when running from build directory, i.e. without 'make install' */ | |||
static bool ABISYM( mRunningFromBuildDir ); | static bool ABISYM( mRunningFromBuildDir ); | |||
/** path to the source directory. valid only when running from build di rectory. */ | /** path to the source directory. valid only when running from build di rectory. */ | |||
static QString ABISYM( mBuildSourcePath ); | static QString ABISYM( mBuildSourcePath ); | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
/** configuration internal dir */ | /** configuration internal dir */ | |||
static QString ABISYM( mCfgIntDir ); | static QString ABISYM( mCfgIntDir ); | |||
End of changes. 11 change blocks. | ||||
10 lines changed or deleted | 28 lines changed or added | |||
qgsattributeaction.h | qgsattributeaction.h | |||
---|---|---|---|---|
skipping to change at line 112 | skipping to change at line 112 | |||
//! Destructor | //! Destructor | |||
virtual ~QgsAttributeAction() {} | virtual ~QgsAttributeAction() {} | |||
//! Add an action with the given name and action details. | //! Add an action with the given name and action details. | |||
// Will happily have duplicate names and actions. If | // Will happily have duplicate names and actions. If | |||
// capture is true, when running the action using doAction(), | // capture is true, when running the action using doAction(), | |||
// any stdout from the process will be captured and displayed in a | // any stdout from the process will be captured and displayed in a | |||
// dialog box. | // dialog box. | |||
void addAction( QgsAction::ActionType type, QString name, QString actio n, bool capture = false ); | void addAction( QgsAction::ActionType type, QString name, QString actio n, bool capture = false ); | |||
/*! Does the action using the given values. defaultValueIndex is an | //! Remove an action at given index | |||
* index into values which indicates which value in the values vector | void removeAction( int index ); | |||
* is to be used if the action has a default placeholder. | ||||
* @note parameter executePython deprecated (and missing in python bin | ||||
ding) | ||||
* @deprecated | ||||
*/ | ||||
Q_DECL_DEPRECATED void doAction( int index, | ||||
const QgsAttributeMap &attributes, | ||||
int defaultValueIndex = 0, | ||||
void ( *executePython )( const QString | ||||
& ) = 0 ); | ||||
/*! Does the given values. defaultValueIndex is the index of the | /*! Does the given values. defaultValueIndex is the index of the | |||
* field to be used if the action has a $currfield placeholder. | * field to be used if the action has a $currfield placeholder. | |||
* @note added in 1.9 | * @note added in 1.9 | |||
* @note available in python bindings as doActionFeature | ||||
*/ | */ | |||
void doAction( int index, | void doAction( int index, | |||
QgsFeature &feat, | QgsFeature &feat, | |||
int defaultValueIndex = 0 ); | int defaultValueIndex = 0 ); | |||
/*! Does the action using the expression builder to expand it | /*! Does the action using the expression builder to expand it | |||
* and getting values from the passed feature attribute map. | * and getting values from the passed feature attribute map. | |||
* substitutionMap is used to pass custom substitutions, to replace | * substitutionMap is used to pass custom substitutions, to replace | |||
* each key in the map with the associated value | * each key in the map with the associated value | |||
* @note added in 1.9 | * @note added in 1.9 | |||
* @note available in python bindings as doActionFeatureWithSubstituti on | ||||
*/ | */ | |||
void doAction( int index, | void doAction( int index, | |||
QgsFeature &feat, | QgsFeature &feat, | |||
const QMap<QString, QVariant> *substitutionMap = 0 ); | const QMap<QString, QVariant> *substitutionMap = 0 ); | |||
//! Removes all actions | //! Removes all actions | |||
void clearActions() { mActions.clear(); } | void clearActions() { mActions.clear(); } | |||
//! Return the layer | //! Return the layer | |||
QgsVectorLayer *layer() { return mLayer; } | QgsVectorLayer *layer() { return mLayer; } | |||
End of changes. 3 change blocks. | ||||
12 lines changed or deleted | 4 lines changed or added | |||
qgsattributeeditor.h | qgsattributeeditor.h | |||
---|---|---|---|---|
skipping to change at line 21 | skipping to change at line 21 | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSATTRIBUTEEDITOR_H | #ifndef QGSATTRIBUTEEDITOR_H | |||
#define QGSATTRIBUTEEDITOR_H | #define QGSATTRIBUTEEDITOR_H | |||
#include <QVariant> | #include <QVariant> | |||
#include <QMetaType> | ||||
#include "qgsfeature.h" | ||||
class QObject; | class QObject; | |||
class QWidget; | class QWidget; | |||
class QgsVectorLayer; | class QgsVectorLayer; | |||
class QComboBox; | class QComboBox; | |||
class QListWidget; | ||||
class QgsAttributeEditorElement; | ||||
/* \brief create attribute widget for editing */ | /* \brief create attribute widget for editing */ | |||
class GUI_EXPORT QgsAttributeEditor : public QObject | class GUI_EXPORT QgsAttributeEditor : public QObject | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsAttributeEditor( QObject *parent ) : QObject( parent ) {}; | QgsAttributeEditor( QObject *parent, QgsVectorLayer *vl = 0, int idx = | |||
-1 ) | ||||
: QObject( parent ) | ||||
, mLayer( vl ) | ||||
, mIdx( idx ) | ||||
{}; | ||||
/** | ||||
* Creates or prepares a attributre editor widget | ||||
* @param parent The parent object | ||||
* @param editor The widget to prepare. Set to null if it should be gen | ||||
erated | ||||
* @param vl The vector layer to use as data source | ||||
* @param idx The field index this widget refers to | ||||
* @param value the value to initiate this widget with | ||||
* @param proxyWidgets an array of widgets, which will act as a value p | ||||
roxy if the same field is inserted multiple times | ||||
* | ||||
*/ | ||||
static QWidget *createAttributeEditor( QWidget *parent, QWidget *editor | ||||
, QgsVectorLayer *vl, int idx, const QVariant &value, QMap<int, QWidget*> & | ||||
proxyWidgets ); | ||||
/** | ||||
* Creates or prepares a attributre editor widget | ||||
* @param parent The parent object | ||||
* @param editor The widget to prepare. Set to null if it should be gen | ||||
erated | ||||
* @param vl The vector layer to use as data source | ||||
* @param idx The field index this widget refers to | ||||
* @param value the value to initiate this widget with | ||||
* | ||||
*/ | ||||
static QWidget *createAttributeEditor( QWidget *parent, QWidget *editor , QgsVectorLayer *vl, int idx, const QVariant &value ); | static QWidget *createAttributeEditor( QWidget *parent, QWidget *editor , QgsVectorLayer *vl, int idx, const QVariant &value ); | |||
/** | ||||
* Creates a widget form a QgsAttributeEditorElement definition. Will r | ||||
ecursively generate containers and widgets. | ||||
* @param widgetDef The definition for the widget | ||||
* @param parent The parent object | ||||
* @param vl The vector layer to use as data source | ||||
* @param attrs Attributes for the current feature. | ||||
* @param proxyWidgets An array of widgets, which will act as a value p | ||||
roxy if the same field is inserted multiple times | ||||
* @param createGroupBox If the element is a container, should a GroupB | ||||
ox be created to hold the children? | ||||
* | ||||
*/ | ||||
static QWidget *createWidgetFromDef( const QgsAttributeEditorElement* w | ||||
idgetDef, QWidget* parent, QgsVectorLayer* vl, QgsAttributes &attrs, QMap<i | ||||
nt, QWidget*> &proxyWidgets, bool createGroupBox ); | ||||
static bool retrieveValue( QWidget *widget, QgsVectorLayer *vl, int idx , QVariant &value ); | static bool retrieveValue( QWidget *widget, QgsVectorLayer *vl, int idx , QVariant &value ); | |||
static bool setValue( QWidget *widget, QgsVectorLayer *vl, int idx, con st QVariant &value ); | static bool setValue( QWidget *widget, QgsVectorLayer *vl, int idx, con st QVariant &value ); | |||
private: | private: | |||
static QComboBox *comboBox( QWidget *editor, QWidget *parent ); | static QComboBox *comboBox( QWidget *editor, QWidget *parent ); | |||
static QListWidget *listWidget( QWidget *editor, QWidget *parent ); | ||||
public slots: | public slots: | |||
void selectFileName(); | void selectFileName(); | |||
void selectDate(); | void selectDate(); | |||
void loadUrl( const QString & ); | ||||
void loadPixmap( const QString & ); | ||||
void updateUrl(); | ||||
void openUrl(); | ||||
void updateColor(); | ||||
private: | ||||
QgsVectorLayer *mLayer; | ||||
int mIdx; | ||||
}; | ||||
class GUI_EXPORT QgsStringRelay : public QObject | ||||
{ | ||||
Q_OBJECT | ||||
public: | ||||
QgsStringRelay( QObject* parent = NULL ) | ||||
: QObject( parent ) {} | ||||
void appendProxy( QWidget* proxy ) { mProxyList << proxy; } | ||||
public slots: | ||||
void changeText(); | ||||
void changeText( QString str ); | ||||
signals: | ||||
void textChanged( QString ); | ||||
private: | ||||
QList<QWidget*> mProxyList; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
1 lines changed or deleted | 84 lines changed or added | |||
qgsattributetabledelegate.h | qgsattributetabledelegate.h | |||
---|---|---|---|---|
skipping to change at line 22 | skipping to change at line 22 | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSATTRIBUTETABLEDELEGATE_H | #ifndef QGSATTRIBUTETABLEDELEGATE_H | |||
#define QGSATTRIBUTETABLEDELEGATE_H | #define QGSATTRIBUTETABLEDELEGATE_H | |||
#include <QItemDelegate> | #include <QItemDelegate> | |||
#include "qgsfeature.h" | #include "qgsfeature.h" | |||
class QgsFeatureSelectionModel; | ||||
class QPainter; | class QPainter; | |||
class QgsVectorLayer; | class QgsVectorLayer; | |||
class QgsAttributeTableView; | ||||
/** \ingroup app | /** \ingroup app | |||
* A delegate item class for QgsAttributeTable (see Qt documentation for | * A delegate item class for QgsAttributeTable (see Qt documentation for | |||
* QItemDelegate). | * QItemDelegate). | |||
*/ | */ | |||
class QgsAttributeTableDelegate : public QItemDelegate | class GUI_EXPORT QgsAttributeTableDelegate : public QItemDelegate | |||
{ | { | |||
Q_OBJECT; | Q_OBJECT; | |||
QgsVectorLayer *layer( const QAbstractItemModel *model ) const; | QgsVectorLayer *layer( const QAbstractItemModel *model ) const; | |||
int fieldIdx( const QModelIndex &index ) const; | ||||
QgsFeatureId featureId( const QModelIndex &index ) const; | ||||
public: | public: | |||
/** Constructor | /** Constructor | |||
* @param parent parent object | * @param parent parent object | |||
*/ | */ | |||
QgsAttributeTableDelegate( QObject* parent = NULL ) : | QgsAttributeTableDelegate( QObject* parent = NULL ) : | |||
QItemDelegate( parent ) {}; | QItemDelegate( parent ) {}; | |||
/** Used to create an editor for when the user tries to | /** Used to create an editor for when the user tries to | |||
* change the contents of a cell */ | * change the contents of a cell */ | |||
QWidget * createEditor( | QWidget * createEditor( | |||
skipping to change at line 71 | skipping to change at line 71 | |||
* @param index index of field which is to be modified | * @param index index of field which is to be modified | |||
*/ | */ | |||
void setModelData( QWidget *editor, QAbstractItemModel *model, const QM odelIndex &index ) const; | void setModelData( QWidget *editor, QAbstractItemModel *model, const QM odelIndex &index ) const; | |||
/** | /** | |||
* Sets data from model into the editor. Overloads default method | * Sets data from model into the editor. Overloads default method | |||
* @param editor editor which was created by create editor function in this class | * @param editor editor which was created by create editor function in this class | |||
* @param index index of field which is to be retrieved | * @param index index of field which is to be retrieved | |||
*/ | */ | |||
void setEditorData( QWidget *editor, const QModelIndex &index ) const; | void setEditorData( QWidget *editor, const QModelIndex &index ) const; | |||
void setFeatureSelectionModel( QgsFeatureSelectionModel* featureSelecti | ||||
onModel ); | ||||
private: | ||||
QgsFeatureSelectionModel* mFeatureSelectionModel; | ||||
}; | }; | |||
#endif //QGSATTRIBUTETABLEDELEGATE_H | #endif //QGSATTRIBUTETABLEDELEGATE_H | |||
End of changes. 5 change blocks. | ||||
3 lines changed or deleted | 9 lines changed or added | |||
qgsattributetablefiltermodel.h | qgsattributetablefiltermodel.h | |||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSATTRIBUTETABLEFILTERMODEL_H | #ifndef QGSATTRIBUTETABLEFILTERMODEL_H | |||
#define QGSATTRIBUTETABLEFILTERMODEL_H | #define QGSATTRIBUTETABLEFILTERMODEL_H | |||
#include <QSortFilterProxyModel> | #include <QSortFilterProxyModel> | |||
#include <QModelIndex> | #include <QModelIndex> | |||
class QgsAttributeTableModel; | #include "qgsvectorlayer.h" //QgsFeatureIds | |||
class QgsVectorLayer; | #include "qgsattributetablemodel.h" | |||
#include "qgsfeaturemodel.h" | ||||
class QgsVectorLayerCache; | ||||
class QgsMapCanvas; | ||||
class QItemSelectionModel; | ||||
class QgsAttributeTableFilterModel: public QSortFilterProxyModel | class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel , public QgsFeatureModel | |||
{ | { | |||
Q_OBJECT | ||||
public: | public: | |||
enum FilterMode | ||||
{ | ||||
ShowAll, | ||||
ShowSelected, | ||||
ShowVisible, | ||||
ShowFilteredList, | ||||
ShowEdited | ||||
}; | ||||
/** | /** | |||
* Constructor | * | |||
* @param theLayer initializing layer pointer | * Make sure, the master model is already loaded, so the selection will | |||
get synchronized. | ||||
* | ||||
* @param parent parent object (owner) | ||||
* @param sourceModel The QgsAttributeTableModel to use as source (most | ||||
ly referred to as master model) | ||||
* @param canvas The mapCanvas. Used to identify the currently visible | ||||
features. | ||||
*/ | */ | |||
QgsAttributeTableFilterModel( QgsVectorLayer* theLayer ); | QgsAttributeTableFilterModel( QgsMapCanvas* canvas, QgsAttributeTableMo | |||
del* sourceModel, QObject* parent = NULL ); | ||||
void setSourceModel( QgsAttributeTableModel* sourceModel ); | ||||
/** | /** | |||
* Sorts model by the column | * Changes the sort order of the features. If set to true, selected fea | |||
* @param column column to sort by | tures | |||
* @param order sorting order | * will be sorted on top, regardless of the current sort column | |||
* | ||||
* @param selectedOnTop Specify, if selected features should be sorted | ||||
on top | ||||
*/ | */ | |||
virtual void sort( int column, Qt::SortOrder order = Qt::AscendingOrder | void setSelectedOnTop( bool selectedOnTop ); | |||
); | ||||
/** | ||||
* Returns if selected features are currently shown on top | ||||
* | ||||
* @return True if selected are shown on top | ||||
*/ | ||||
bool selectedOnTop(); | ||||
/** | ||||
* Specify a list of features, which the filter will accept. | ||||
* The filter mode will automatically be adjusted to show only these fe | ||||
atures (ShowFilteredList). | ||||
* | ||||
* @param ids The list of feature ids which will be accepted by the fi | ||||
lter | ||||
*/ | ||||
virtual void setFilteredFeatures( QgsFeatureIds ids ); | ||||
/** | ||||
* Set the filter mode the filter will use. | ||||
* | ||||
* @param filterMode Sets the current mode of the filter | ||||
*/ | ||||
void setFilterMode( FilterMode filterMode ); | ||||
/** | ||||
* Returns the layer this filter acts on. | ||||
* | ||||
* @return Abovementioned layer | ||||
*/ | ||||
inline QgsVectorLayer *layer() const { return masterModel()->layer(); } | ||||
/** | ||||
* Returns the layerCache this filter acts on. | ||||
* | ||||
* @return The layer cache | ||||
*/ | ||||
inline QgsVectorLayerCache *layerCache() const { return masterModel()-> | ||||
layerCache(); } | ||||
/** | ||||
* Returns the table model this filter is using | ||||
* | ||||
* @return the table model in quesion | ||||
*/ | ||||
inline QgsAttributeTableModel *masterModel() const { return mTableModel | ||||
; } | ||||
/** | ||||
* Returns the feature id for a given model index. | ||||
* | ||||
* @param row A model index of the row in question | ||||
* | ||||
* @return The feature id of the feature visible in the provided row | ||||
*/ | ||||
QgsFeatureId rowToId( const QModelIndex& row ); | ||||
QModelIndex fidToIndex( QgsFeatureId fid ); | ||||
QModelIndexList fidToIndexList( QgsFeatureId fid ); | ||||
QgsVectorLayer *layer() const { return mLayer; } | virtual QModelIndex mapToMaster( const QModelIndex &proxyIndex ) const; | |||
QgsAttributeTableModel *tableModel() const { return reinterpret_cast<Qg | ||||
sAttributeTableModel*>( sourceModel() ); } | ||||
void setHideUnselected( bool theFlag ) { mHideUnselected = theFlag; } | virtual QModelIndex mapFromMaster( const QModelIndex &sourceIndex ) con st; | |||
protected: | protected: | |||
/** | /** | |||
* Returns true if the source row will be accepted | * Returns true if the source row will be accepted | |||
* | ||||
* @param sourceRow row from the source model | * @param sourceRow row from the source model | |||
* @param sourceParent parent index in the source model | * @param sourceParent parent index in the source model | |||
*/ | */ | |||
bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const; | bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const; | |||
/** | ||||
* Updates the list of currently visible features on the map canvas. | ||||
* Is called automatically when the filter mode is adjusted or the exte | ||||
nts changed. | ||||
*/ | ||||
void generateListOfVisibleFeatures(); | ||||
/** | ||||
* Used by the sorting algorithm. Compares the two model indices. Will | ||||
also consider the | ||||
* selection state of the feature in case selected features are to be s | ||||
hown on top. | ||||
*/ | ||||
bool lessThan( const QModelIndex &left, const QModelIndex &right ) cons | ||||
t; | ||||
/** | ||||
* Sort by the given column using the given order. | ||||
* Prefetches all the data from the layer to speed up sorting. | ||||
* | ||||
* @param column The column which should be sorted | ||||
* @param order The order ( Qt::AscendingOrder or Qt::DescendingOrder | ||||
) | ||||
*/ | ||||
virtual void sort( int column, Qt::SortOrder order = Qt::AscendingOrder | ||||
); | ||||
public slots: | ||||
/** | ||||
* Is called upon every change of the visible extents on the map canvas | ||||
. | ||||
* When a change is signalled, the filter is updated and invalidated if | ||||
needed. | ||||
* | ||||
*/ | ||||
void extentsChanged(); | ||||
private slots: | ||||
void selectionChanged(); | ||||
private: | private: | |||
QgsVectorLayer* mLayer; | QgsFeatureIds mFilteredFeatures; | |||
bool mHideUnselected; | QgsMapCanvas* mCanvas; | |||
FilterMode mFilterMode; | ||||
bool mSelectedOnTop; | ||||
QItemSelectionModel* mMasterSelection; | ||||
QgsAttributeTableModel* mTableModel; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 13 change blocks. | ||||
17 lines changed or deleted | 149 lines changed or added | |||
qgsattributetablemodel.h | qgsattributetablemodel.h | |||
---|---|---|---|---|
skipping to change at line 25 | skipping to change at line 25 | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSATTRIBUTETABLEMODEL_H | #ifndef QGSATTRIBUTETABLEMODEL_H | |||
#define QGSATTRIBUTETABLEMODEL_H | #define QGSATTRIBUTETABLEMODEL_H | |||
#include <QAbstractTableModel> | #include <QAbstractTableModel> | |||
#include <QModelIndex> | #include <QModelIndex> | |||
#include <QObject> | #include <QObject> | |||
#include <QHash> | #include <QHash> | |||
#include <QQueue> | #include <QQueue> | |||
#include <QMap> | ||||
#include "qgsfeature.h" // QgsAttributeMap | ||||
#include "qgsvectorlayer.h" // QgsAttributeList | #include "qgsvectorlayer.h" // QgsAttributeList | |||
#include "qgsattributetableidcolumnpair.h" | #include "qgsvectorlayercache.h" | |||
class QgsMapCanvas; | class QgsMapCanvas; | |||
/** | ||||
* A model backed by a {@link QgsVectorLayerCache} which is able to provide | ||||
* feature/attribute information to a QAbstractItemView. | ||||
* | ||||
* @brief | ||||
* Is able to generate editor widgets for its QModelIndexes as well. | ||||
* Is mostly referred to as "master model" within this doc and the source. | ||||
* | ||||
* @see <a href="http://doc.qt.digia.com/qt/model-view-programming.html">Qt | ||||
Model View Programming</a> | ||||
*/ | ||||
class GUI_EXPORT QgsAttributeTableModel: public QAbstractTableModel | class GUI_EXPORT QgsAttributeTableModel: public QAbstractTableModel | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
enum Role | ||||
{ | ||||
SortRole = Qt::UserRole + 1, | ||||
FeatureIdRole = Qt::UserRole + 2, | ||||
FieldIndexRole = Qt::UserRole + 3 | ||||
}; | ||||
public: | ||||
/** | /** | |||
* Constructor | * Constructor | |||
* @param theLayer layer pointer | * @param layerCache A layer cache to use as backend | |||
* @param parent parent pointer | * @param parent The parent QObject (owner) | |||
*/ | */ | |||
QgsAttributeTableModel( QgsMapCanvas *canvas, QgsVectorLayer *theLayer, | QgsAttributeTableModel( QgsVectorLayerCache *layerCache, QObject *paren | |||
QObject *parent = 0 ); | t = 0 ); | |||
virtual ~QgsAttributeTableModel(); | ||||
/** | ||||
* Loads the layer into the model | ||||
* Preferably to be called, before basing any other models on this mode | ||||
l | ||||
*/ | ||||
virtual void loadLayer(); | ||||
/** | /** | |||
* Returns the number of rows | * Returns the number of rows | |||
* @param parent parent index | * @param parent parent index | |||
*/ | */ | |||
virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const ; | virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const ; | |||
/** | /** | |||
* Returns the number of columns | * Returns the number of columns | |||
* @param parent parent index | * @param parent parent index | |||
*/ | */ | |||
int columnCount( const QModelIndex &parent = QModelIndex() ) const; | int columnCount( const QModelIndex &parent = QModelIndex() ) const; | |||
/** | /** | |||
* Returns header data | * Returns header data | |||
* @param section required section | * @param section required section | |||
* @param orientation horizontal or vertical orientation | * @param orientation horizontal or vertical orientation | |||
* @param role data role | * @param role data role | |||
*/ | */ | |||
QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; | QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; | |||
/** | /** | |||
* Returns data on the given index | * Returns data on the given index | |||
* @param index model index | * @param index model index | |||
* @param role data role | * @param role data role | |||
*/ | */ | |||
virtual QVariant data( const QModelIndex &index, int role ) const; | virtual QVariant data( const QModelIndex &index, int role ) const; | |||
/** | /** | |||
* Updates data on given index | * Updates data on given index | |||
* @param index model index | * @param index model index | |||
* @param value new data value | * @param value new data value | |||
* @param role data role | * @param role data role | |||
*/ | */ | |||
virtual bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ); | virtual bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ); | |||
/** | /** | |||
* Returns item flags for the index | * Returns item flags for the index | |||
* @param index model index | * @param index model index | |||
*/ | */ | |||
Qt::ItemFlags flags( const QModelIndex &index ) const; | Qt::ItemFlags flags( const QModelIndex &index ) const; | |||
/** | /** | |||
* Reloads the model data between indices | * Reloads the model data between indices | |||
* @param index1 start index | * @param index1 start index | |||
* @param index2 end index | * @param index2 end index | |||
*/ | */ | |||
void reload( const QModelIndex &index1, const QModelIndex &index2 ); | void reload( const QModelIndex &index1, const QModelIndex &index2 ); | |||
/** | /** | |||
* Remove rows | * Remove rows | |||
*/ | */ | |||
bool removeRows( int row, int count, const QModelIndex &parent = QModel Index() ); | bool removeRows( int row, int count, const QModelIndex &parent = QModel Index() ); | |||
/** | /** | |||
* Resets the model | * Resets the model | |||
*/ | */ | |||
void resetModel(); | void resetModel(); | |||
/** | ||||
* Layout has been changed | ||||
*/ | ||||
void changeLayout(); | ||||
/** | ||||
* Layout will be changed | ||||
*/ | ||||
void incomingChangeLayout(); | ||||
/** | /** | |||
* Maps feature id to table row | * Maps feature id to table row | |||
* @param id feature id | * @param id feature id | |||
*/ | */ | |||
int idToRow( QgsFeatureId id ) const; | int idToRow( QgsFeatureId id ) const; | |||
QModelIndex idToIndex( QgsFeatureId id ) const; | ||||
QModelIndexList idToIndexList( QgsFeatureId id ) const; | ||||
/** | /** | |||
* get field index from column | * get field index from column | |||
*/ | */ | |||
int fieldIdx( int col ) const; | int fieldIdx( int col ) const; | |||
/** | /** | |||
* get column from field index | * get column from field index | |||
*/ | */ | |||
int fieldCol( int idx ) const; | int fieldCol( int idx ) const; | |||
/** | /** | |||
* Maps row to feature id | * Maps row to feature id | |||
* @param row row number | * @param row row number | |||
*/ | */ | |||
QgsFeatureId rowToId( int row ) const; | QgsFeatureId rowToId( int row ) const; | |||
/** | ||||
* Sorts the model | ||||
* @param column column to sort by | ||||
* @param order sorting order | ||||
*/ | ||||
virtual void sort( int column, Qt::SortOrder order = Qt::AscendingOrder | ||||
); | ||||
/** | /** | |||
* Swaps two rows | * Swaps two rows | |||
* @param a first row | * @param a first row | |||
* @param b second row | * @param b second row | |||
*/ | */ | |||
void swapRows( QgsFeatureId a, QgsFeatureId b ); | void swapRows( QgsFeatureId a, QgsFeatureId b ); | |||
/** | /** | |||
* Returns layer pointer | * Returns the layer this model uses as backend. Retrieved from the lay er cache. | |||
*/ | */ | |||
QgsVectorLayer* layer() const { return mLayer; } | inline QgsVectorLayer* layer() const { return mLayerCache ? mLayerCache ->layer() : NULL; } | |||
/** Execute an action */ | /** | |||
* Returns the layer cache this model uses as backend. | ||||
*/ | ||||
inline QgsVectorLayerCache* layerCache() const { return mLayerCache; } | ||||
/** | ||||
* Execute an action | ||||
*/ | ||||
void executeAction( int action, const QModelIndex &idx ) const; | void executeAction( int action, const QModelIndex &idx ) const; | |||
/** return feature attributes at given index */ | /** | |||
* Return the feature attributes at given model index | ||||
* @return feature attributes at given model index | ||||
*/ | ||||
QgsFeature feature( const QModelIndex &idx ) const; | QgsFeature feature( const QModelIndex &idx ) const; | |||
/** | ||||
* Caches the entire data for one column. This should be called prior t | ||||
o sorting, | ||||
* so the data does not have to be fetched for every single comparison. | ||||
* Specify -1 as column to invalidate the cache | ||||
* | ||||
* @param column The column index of the field to catch | ||||
*/ | ||||
void prefetchColumnData( int column ); | ||||
signals: | signals: | |||
/** | /** | |||
* Model has been changed | * Model has been changed | |||
*/ | */ | |||
void modelChanged(); | void modelChanged(); | |||
//! @note not available in python bindings | ||||
void progress( int i, bool &cancel ); | void progress( int i, bool &cancel ); | |||
void finished(); | void finished(); | |||
public slots: | ||||
void extentsChanged(); | ||||
private slots: | private slots: | |||
/** | /** | |||
* Launched when attribute has been added | * Launched whenever the number of fields has changed | |||
* @param idx attribute index | ||||
*/ | */ | |||
virtual void attributeAdded( int idx ); | virtual void updatedFields(); | |||
/** | /** | |||
* Launched when attribute has been deleted | * Called whenever a column is removed; | |||
* @param idx attribute index | ||||
*/ | */ | |||
virtual void attributeDeleted( int idx ); | virtual void attributeDeleted( int idx ); | |||
protected slots: | protected slots: | |||
/** | /** | |||
* Launched when attribute value has been changed | * Launched when attribute value has been changed | |||
* @param fid feature id | * @param fid feature id | |||
* @param idx attribute index | * @param idx attribute index | |||
* @param value new value | * @param value new value | |||
*/ | */ | |||
virtual void attributeValueChanged( QgsFeatureId fid, int idx, const QV ariant &value ); | virtual void attributeValueChanged( QgsFeatureId fid, int idx, const QV ariant &value ); | |||
/** | /** | |||
* Launched when a feature has been deleted | * Launched when a feature has been deleted | |||
* @param fid feature id | * @param fid feature id | |||
*/ | */ | |||
virtual void featureDeleted( QgsFeatureId fid ); | virtual void featureDeleted( QgsFeatureId fid ); | |||
/** | /** | |||
* Launched when a feature has been added | * Launched when a feature has been added | |||
* @param fid feature id | * @param fid feature id | |||
* @parem inOperation guard insertion with beginInsertRows() / endInser tRows() | * @param inOperation guard insertion with beginInsertRows() / endInser tRows() | |||
*/ | */ | |||
virtual void featureAdded( QgsFeatureId fid, bool inOperation = true ); | virtual void featureAdded( QgsFeatureId fid, bool inOperation = true ); | |||
/** | /** | |||
* Launched when layer has been deleted | * Launched when layer has been deleted | |||
*/ | */ | |||
virtual void layerDeleted(); | virtual void layerDeleted(); | |||
protected: | protected: | |||
QgsMapCanvas *mCanvas; | QgsVectorLayerCache *mLayerCache; | |||
QgsVectorLayer *mLayer; | ||||
int mFieldCount; | int mFieldCount; | |||
mutable QgsFeature mFeat; | mutable QgsFeature mFeat; | |||
mutable QHash<QgsFeatureId, QgsFeature> mFeatureMap; | ||||
QgsAttributeList mAttributes; | QgsAttributeList mAttributes; | |||
QMap< int, const QMap<QString, QVariant> * > mValueMaps; | QMap< int, const QMap<QString, QVariant> * > mValueMaps; | |||
QList<QgsAttributeTableIdColumnPair> mSortList; | ||||
QHash<QgsFeatureId, int> mIdRowMap; | QHash<QgsFeatureId, int> mIdRowMap; | |||
QHash<int, QgsFeatureId> mRowIdMap; | QHash<int, QgsFeatureId> mRowIdMap; | |||
//! useful when showing only features from a particular extent | ||||
QgsRectangle mCurrentExtent; | ||||
/** | ||||
* Initializes id <-> row maps | ||||
*/ | ||||
void initIdMaps(); | ||||
/** | /** | |||
* Gets mFieldCount, mAttributes and mValueMaps | * Gets mFieldCount, mAttributes and mValueMaps | |||
*/ | */ | |||
virtual void loadAttributes(); | virtual void loadAttributes(); | |||
public: | ||||
/** | ||||
* Loads the layer into the model | ||||
*/ | ||||
virtual void loadLayer(); | ||||
private: | private: | |||
mutable QQueue<QgsFeatureId> mFeatureQueue; | ||||
/** | /** | |||
* load feature fid into mFeat | * Load feature fid into local cache (mFeat) | |||
* @param fid feature id | * | |||
* @param fid feature id | ||||
* | ||||
* @return feature exists | * @return feature exists | |||
*/ | */ | |||
virtual bool featureAtId( QgsFeatureId fid ) const; | virtual bool loadFeatureAtId( QgsFeatureId fid ) const; | |||
QgsFeatureRequest mFeatureRequest; | ||||
/** The currently cached column */ | ||||
int mCachedField; | ||||
/** Allows to cache one specific column (used for sorting) */ | ||||
QHash<QgsFeatureId, QVariant> mFieldCache; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 38 change blocks. | ||||
57 lines changed or deleted | 94 lines changed or added | |||
qgsattributetableview.h | qgsattributetableview.h | |||
---|---|---|---|---|
skipping to change at line 22 | skipping to change at line 22 | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSATTRIBUTETABLEVIEW_H | #ifndef QGSATTRIBUTETABLEVIEW_H | |||
#define QGSATTRIBUTETABLEVIEW_H | #define QGSATTRIBUTETABLEVIEW_H | |||
#include <QTableView> | #include <QTableView> | |||
#include <QAction> | #include <QAction> | |||
#include "qgsfeature.h" // For QgsFeatureIds | ||||
class QgsAttributeTableModel; | class QgsAttributeTableModel; | |||
class QgsAttributeTableFilterModel; | class QgsAttributeTableFilterModel; | |||
class QgsVectorLayerCache; | ||||
class QgsFeatureSelectionModel; | ||||
class QgsAttributeTableDelegate; | ||||
class QgsMapCanvas; | class QgsMapCanvas; | |||
class QgsVectorLayer; | class QgsVectorLayer; | |||
class QMenu; | class QMenu; | |||
class QProgressDialog; | class QProgressDialog; | |||
/** | ||||
* @brief | ||||
* Provides a table view of features of a @link QgsVectorLayer @endlink. | ||||
* | ||||
* This can either be used as a standalone widget. QgsBrowser features a re | ||||
ference implementation. | ||||
* Or this can be used within the @link QgsDualView @endlink stacked widget | ||||
. | ||||
*/ | ||||
class GUI_EXPORT QgsAttributeTableView : public QTableView | class GUI_EXPORT QgsAttributeTableView : public QTableView | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsAttributeTableView( QWidget* parent = 0 ); | QgsAttributeTableView( QWidget* parent = 0 ); | |||
virtual ~QgsAttributeTableView(); | virtual ~QgsAttributeTableView(); | |||
virtual void setModel( QgsAttributeTableFilterModel* filterModel ); | ||||
/** | ||||
* Autocreates the models | ||||
* @param layerCache The @link QgsVectorLayerCache @endlink to use ( as | ||||
backend ) | ||||
* @param canvas The @link QgsMapCanvas @endlink to use ( for the c | ||||
urrently visible features filter ) | ||||
* | ||||
* @deprecated | ||||
*/ | ||||
void setCanvasAndLayerCache( QgsMapCanvas *canvas, QgsVectorLayerCache | ||||
*layerCache ); | ||||
/** | ||||
* This event filter is installed on the verticalHeader to intercept mo | ||||
use press and release | ||||
* events. These are used to disable / enable live synchronisation with | ||||
the map canvas selection | ||||
* which can be slow due to recurring canvas repaints. Updating the | ||||
* | ||||
* @param object The object which is the target of the event. | ||||
* @param event The intercepted event | ||||
* | ||||
* @return Returns always false, so the event gets processed | ||||
*/ | ||||
virtual bool eventFilter( QObject* object, QEvent* event ); | ||||
protected: | ||||
/** | ||||
* Called for mouse press events on a table cell. | ||||
* Disables selection change for these events. | ||||
* | ||||
* @param event The mouse event | ||||
*/ | ||||
void mousePressEvent( QMouseEvent *event ); | ||||
/** | /** | |||
* Sets the layer | * Called for mouse release events on a table cell. | |||
* @param canvas canvas pointer | * Disables selection change for these events. | |||
* @param layer layer pointer | * | |||
* @param event The mouse event | ||||
*/ | */ | |||
void setCanvasAndLayer( QgsMapCanvas *canvas, QgsVectorLayer *layer ); | void mouseReleaseEvent( QMouseEvent *event ); | |||
/** | ||||
* Called for mouse move events on a table cell. | ||||
* Disables selection change for these events. | ||||
* | ||||
* @param event The mouse event | ||||
*/ | ||||
void mouseMoveEvent( QMouseEvent *event ); | ||||
/** | ||||
* Called for key press events | ||||
* Disables selection change by only pressing an arrow key | ||||
* | ||||
* @param event The mouse event | ||||
*/ | ||||
void keyPressEvent( QKeyEvent *event ); | ||||
/** | ||||
* @brief | ||||
* Is called when the context menu will be shown. Emits a @link willSho | ||||
wContextMenu @endlink signal, | ||||
* so the menu can be populated by other parts of the application. | ||||
* | ||||
* @param event The associated event object. | ||||
*/ | ||||
void contextMenuEvent( QContextMenuEvent* event ); | ||||
/** | /** | |||
* Saves geometry to the settings on close | * Saves geometry to the settings on close | |||
* @param event not used | * @param event not used | |||
*/ | */ | |||
void closeEvent( QCloseEvent *event ); | void closeEvent( QCloseEvent *event ); | |||
void contextMenuEvent( QContextMenuEvent* ); | ||||
signals: | signals: | |||
/** | ||||
* @brief | ||||
* Is emitted, in order to provide a hook to add aditional menu entries | ||||
to the context menu. | ||||
* | ||||
* @param menu If additional QMenuItems are added, they will show u | ||||
p in the context menu. | ||||
* @param atIndex The QModelIndex, to which the context menu belongs. | ||||
Relative to the source model. | ||||
* In most cases, this will be a @link QgsAttributeTabl | ||||
eFilterModel @endlink | ||||
*/ | ||||
void willShowContextMenu( QMenu* menu, QModelIndex atIndex ); | void willShowContextMenu( QMenu* menu, QModelIndex atIndex ); | |||
void finished(); | void finished(); | |||
void progress( int i, bool &cancel ); | ||||
public slots: | ||||
void repaintRequested( QModelIndexList indexes ); | ||||
void repaintRequested(); | ||||
virtual void selectAll(); | ||||
virtual void selectRow( int row ); | ||||
virtual void _q_selectRow( int row ); | ||||
private: | private: | |||
QgsMapCanvas *mCanvas; | void selectRow( int row, bool anchor ); | |||
QgsAttributeTableModel* mModel; | QgsAttributeTableModel* mMasterModel; | |||
QgsAttributeTableFilterModel* mFilterModel; | QgsAttributeTableFilterModel* mFilterModel; | |||
QgsFeatureSelectionModel* mFeatureSelectionModel; | ||||
QgsAttributeTableDelegate* mTableDelegate; | ||||
QAbstractItemModel* mModel; // Most likely the filter model | ||||
QMenu *mActionPopup; | QMenu *mActionPopup; | |||
QgsVectorLayerCache* mLayerCache; | ||||
int mRowSectionAnchor; | ||||
QItemSelectionModel::SelectionFlag mCtrlDragSelectionFlag; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 12 change blocks. | ||||
10 lines changed or deleted | 110 lines changed or added | |||
qgsbrowsermodel.h | qgsbrowsermodel.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsbrowsermodel.h | qgsbrowsermodel.h | |||
--------------------- | --------------------- | |||
begin : July 2011 | begin : July 2011 | |||
copyright : (C) 2011 by Martin Dobias | copyright : (C) 2011 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSBROWSERMODEL_H | #ifndef QGSBROWSERMODEL_H | |||
#define QGSBROWSERMODEL_H | #define QGSBROWSERMODEL_H | |||
skipping to change at line 78 | skipping to change at line 78 | |||
/** Returns an object that contains serialized items of data correspond ing to the list of indexes specified */ | /** Returns an object that contains serialized items of data correspond ing to the list of indexes specified */ | |||
virtual QMimeData * mimeData( const QModelIndexList &indexes ) const; | virtual QMimeData * mimeData( const QModelIndexList &indexes ) const; | |||
/** Handles the data supplied by a drag and drop operation that ended w ith the given action */ | /** Handles the data supplied by a drag and drop operation that ended w ith the given action */ | |||
virtual bool dropMimeData( const QMimeData * data, Qt::DropAction actio n, int row, int column, const QModelIndex & parent ); | virtual bool dropMimeData( const QMimeData * data, Qt::DropAction actio n, int row, int column, const QModelIndex & parent ); | |||
QgsDataItem *dataItem( const QModelIndex &idx ) const; | QgsDataItem *dataItem( const QModelIndex &idx ) const; | |||
bool hasChildren( const QModelIndex &parent = QModelIndex() ) const; | bool hasChildren( const QModelIndex &parent = QModelIndex() ) const; | |||
// Reload the whole model | ||||
void reload(); | ||||
// Refresh item specified by path | // Refresh item specified by path | |||
void refresh( QString path ); | void refresh( QString path ); | |||
// Refresh item childs | // Refresh item childs | |||
void refresh( const QModelIndex &index = QModelIndex() ); | void refresh( const QModelIndex &index = QModelIndex() ); | |||
//! return index of a path | //! return index of a path | |||
QModelIndex findPath( QString path ); | QModelIndex findPath( QString path ); | |||
void connectItem( QgsDataItem *item ); | void connectItem( QgsDataItem *item ); | |||
signals: | bool canFetchMore( const QModelIndex & parent ) const; | |||
void fetchMore( const QModelIndex & parent ); | ||||
public slots: | public slots: | |||
//void removeItems( QgsDataItem * parent, QVector<QgsDataItem *>items ) | // Reload the whole model | |||
; | void reload(); | |||
//void addItems( QgsDataItem * parent, QVector<QgsDataItem *>items ); | ||||
//void refreshItems( QgsDataItem * parent, QVector<QgsDataItem *>items | ||||
); | ||||
void beginInsertItems( QgsDataItem *parent, int first, int last ); | void beginInsertItems( QgsDataItem *parent, int first, int last ); | |||
void endInsertItems(); | void endInsertItems(); | |||
void beginRemoveItems( QgsDataItem *parent, int first, int last ); | void beginRemoveItems( QgsDataItem *parent, int first, int last ); | |||
void endRemoveItems(); | void endRemoveItems(); | |||
protected: | void addFavouriteDirectory( QString favDir ); | |||
void removeFavourite( const QModelIndex &index ); | ||||
void updateProjectHome(); | ||||
protected: | ||||
// populates the model | // populates the model | |||
void addRootItems(); | void addRootItems(); | |||
void removeRootItems(); | void removeRootItems(); | |||
QVector<QgsDataItem*> mRootItems; | QVector<QgsDataItem*> mRootItems; | |||
QgsFavouritesItem *mFavourites; | ||||
QgsDirectoryItem *mProjectHome; | ||||
}; | }; | |||
#endif // QGSBROWSERMODEL_H | #endif // QGSBROWSERMODEL_H | |||
End of changes. 7 change blocks. | ||||
12 lines changed or deleted | 12 lines changed or added | |||
qgsbrushstylecombobox.h | qgsbrushstylecombobox.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsbrushstylecombobox.h | qgsbrushstylecombobox.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSBRUSHSTYLECOMBOBOX_H | #ifndef QGSBRUSHSTYLECOMBOBOX_H | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgscategorizedsymbolrendererv2.h | qgscategorizedsymbolrendererv2.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgscategorizedsymbolrendererv2.h | qgscategorizedsymbolrendererv2.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCATEGORIZEDSYMBOLRENDERERV2_H | #ifndef QGSCATEGORIZEDSYMBOLRENDERERV2_H | |||
#define QGSCATEGORIZEDSYMBOLRENDERERV2_H | #define QGSCATEGORIZEDSYMBOLRENDERERV2_H | |||
skipping to change at line 30 | skipping to change at line 30 | |||
#include <QHash> | #include <QHash> | |||
class QgsVectorColorRampV2; | class QgsVectorColorRampV2; | |||
class QgsVectorLayer; | class QgsVectorLayer; | |||
/* \brief categorized renderer */ | /* \brief categorized renderer */ | |||
class CORE_EXPORT QgsRendererCategoryV2 | class CORE_EXPORT QgsRendererCategoryV2 | |||
{ | { | |||
public: | public: | |||
QgsRendererCategoryV2( ); | ||||
//! takes ownership of symbol | //! takes ownership of symbol | |||
QgsRendererCategoryV2( QVariant value, QgsSymbolV2* symbol, QString lab el ); | QgsRendererCategoryV2( QVariant value, QgsSymbolV2* symbol, QString lab el ); | |||
//! copy constructor | //! copy constructor | |||
QgsRendererCategoryV2( const QgsRendererCategoryV2& cat ); | QgsRendererCategoryV2( const QgsRendererCategoryV2& cat ); | |||
~QgsRendererCategoryV2(); | ~QgsRendererCategoryV2(); | |||
QgsRendererCategoryV2& operator=( const QgsRendererCategoryV2& cat ); | ||||
QVariant value() const; | QVariant value() const; | |||
QgsSymbolV2* symbol() const; | QgsSymbolV2* symbol() const; | |||
QString label() const; | QString label() const; | |||
void setValue( const QVariant &value ); | void setValue( const QVariant &value ); | |||
void setSymbol( QgsSymbolV2* s ); | void setSymbol( QgsSymbolV2* s ); | |||
void setLabel( const QString &label ); | void setLabel( const QString &label ); | |||
// debugging | // debugging | |||
QString dump(); | QString dump() const; | |||
void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const; | void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const; | |||
protected: | protected: | |||
QVariant mValue; | QVariant mValue; | |||
QgsSymbolV2* mSymbol; | QgsSymbolV2* mSymbol; | |||
QString mLabel; | QString mLabel; | |||
}; | }; | |||
typedef QList<QgsRendererCategoryV2> QgsCategoryList; | typedef QList<QgsRendererCategoryV2> QgsCategoryList; | |||
skipping to change at line 76 | skipping to change at line 79 | |||
virtual ~QgsCategorizedSymbolRendererV2(); | virtual ~QgsCategorizedSymbolRendererV2(); | |||
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature ); | virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature ); | |||
virtual void startRender( QgsRenderContext& context, const QgsVectorLay er *vlayer ); | virtual void startRender( QgsRenderContext& context, const QgsVectorLay er *vlayer ); | |||
virtual void stopRender( QgsRenderContext& context ); | virtual void stopRender( QgsRenderContext& context ); | |||
virtual QList<QString> usedAttributes(); | virtual QList<QString> usedAttributes(); | |||
virtual QString dump(); | virtual QString dump() const; | |||
virtual QgsFeatureRendererV2* clone(); | virtual QgsFeatureRendererV2* clone(); | |||
virtual void toSld( QDomDocument& doc, QDomElement &element ) const; | virtual void toSld( QDomDocument& doc, QDomElement &element ) const; | |||
//! returns bitwise OR-ed capabilities of the renderer | //! returns bitwise OR-ed capabilities of the renderer | |||
//! \note added in 2.0 | //! \note added in 2.0 | |||
virtual int capabilities() { return SymbolLevels | RotationField; } | virtual int capabilities() { return SymbolLevels | RotationField | Filt er; } | |||
virtual QgsSymbolV2List symbols(); | virtual QgsSymbolV2List symbols(); | |||
//! @note added in 2.0 | ||||
void updateSymbols( QgsSymbolV2 * sym ); | ||||
const QgsCategoryList& categories() { return mCategories; } | const QgsCategoryList& categories() { return mCategories; } | |||
//! return index of category with specified value (-1 if not found) | //! return index of category with specified value (-1 if not found) | |||
int categoryIndexForValue( QVariant val ); | int categoryIndexForValue( QVariant val ); | |||
bool updateCategoryValue( int catIndex, const QVariant &value ); | bool updateCategoryValue( int catIndex, const QVariant &value ); | |||
bool updateCategorySymbol( int catIndex, QgsSymbolV2* symbol ); | bool updateCategorySymbol( int catIndex, QgsSymbolV2* symbol ); | |||
bool updateCategoryLabel( int catIndex, QString label ); | bool updateCategoryLabel( int catIndex, QString label ); | |||
void addCategory( const QgsRendererCategoryV2 &category ); | void addCategory( const QgsRendererCategoryV2 &category ); | |||
bool deleteCategory( int catIndex ); | bool deleteCategory( int catIndex ); | |||
void deleteAllCategories(); | void deleteAllCategories(); | |||
//! Moves the category at index position from to index position to. | ||||
void moveCategory( int from, int to ); | ||||
void sortByValue( Qt::SortOrder order = Qt::AscendingOrder ); | ||||
void sortByLabel( Qt::SortOrder order = Qt::AscendingOrder ); | ||||
QString classAttribute() const { return mAttrName; } | QString classAttribute() const { return mAttrName; } | |||
void setClassAttribute( QString attr ) { mAttrName = attr; } | void setClassAttribute( QString attr ) { mAttrName = attr; } | |||
//! create renderer from XML element | //! create renderer from XML element | |||
static QgsFeatureRendererV2* create( QDomElement& element ); | static QgsFeatureRendererV2* create( QDomElement& element ); | |||
//! store renderer info to XML element | //! store renderer info to XML element | |||
virtual QDomElement save( QDomDocument& doc ); | virtual QDomElement save( QDomDocument& doc ); | |||
//! return a list of symbology items for the legend | //! return a list of symbology items for the legend | |||
virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize ); | virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize ); | |||
//! return a list of item text / symbol | //! return a list of item text / symbol | |||
//! @note: this method was added in version 1.5 | //! @note: this method was added in version 1.5 | |||
//! @note not available in python bindings | ||||
virtual QgsLegendSymbolList legendSymbolItems(); | virtual QgsLegendSymbolList legendSymbolItems(); | |||
QgsSymbolV2* sourceSymbol(); | QgsSymbolV2* sourceSymbol(); | |||
void setSourceSymbol( QgsSymbolV2* sym ); | void setSourceSymbol( QgsSymbolV2* sym ); | |||
QgsVectorColorRampV2* sourceColorRamp(); | QgsVectorColorRampV2* sourceColorRamp(); | |||
void setSourceColorRamp( QgsVectorColorRampV2* ramp ); | void setSourceColorRamp( QgsVectorColorRampV2* ramp ); | |||
//! @note added in 1.6 | //! @note added in 1.6 | |||
void setRotationField( QString fieldName ) { mRotationField = fieldName ; } | void setRotationField( QString fieldName ) { mRotationField = fieldName ; } | |||
//! @note added in 1.6 | //! @note added in 1.6 | |||
QString rotationField() const { return mRotationField; } | QString rotationField() const { return mRotationField; } | |||
//! @note added in 1.6 | //! @note added in 1.6 | |||
void setSizeScaleField( QString fieldName ) { mSizeScaleField = fieldNa me; } | void setSizeScaleField( QString fieldName ) { mSizeScaleField = fieldNa me; } | |||
//! @note added in 1.6 | //! @note added in 1.6 | |||
QString sizeScaleField() const { return mSizeScaleField; } | QString sizeScaleField() const { return mSizeScaleField; } | |||
//! @note added in 2.0 | ||||
void setScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod ); | ||||
//! @note added in 2.0 | ||||
QgsSymbolV2::ScaleMethod scaleMethod() const { return mScaleMethod; } | ||||
protected: | protected: | |||
QString mAttrName; | QString mAttrName; | |||
QgsCategoryList mCategories; | QgsCategoryList mCategories; | |||
QgsSymbolV2* mSourceSymbol; | QgsSymbolV2* mSourceSymbol; | |||
QgsVectorColorRampV2* mSourceColorRamp; | QgsVectorColorRampV2* mSourceColorRamp; | |||
QString mRotationField; | QString mRotationField; | |||
QString mSizeScaleField; | QString mSizeScaleField; | |||
QgsSymbolV2::ScaleMethod mScaleMethod; | ||||
//! attribute index (derived from attribute name in startRender) | //! attribute index (derived from attribute name in startRender) | |||
int mAttrNum; | int mAttrNum; | |||
int mRotationFieldIdx, mSizeScaleFieldIdx; | int mRotationFieldIdx, mSizeScaleFieldIdx; | |||
//! hashtable for faster access to symbols | //! hashtable for faster access to symbols | |||
QHash<QString, QgsSymbolV2*> mSymbolHash; | QHash<QString, QgsSymbolV2*> mSymbolHash; | |||
//! temporary symbols, used for data-defined rotation and scaling | //! temporary symbols, used for data-defined rotation and scaling | |||
QHash<QString, QgsSymbolV2*> mTempSymbols; | QHash<QString, QgsSymbolV2*> mTempSymbols; | |||
End of changes. 11 change blocks. | ||||
4 lines changed or deleted | 22 lines changed or added | |||
qgscategorizedsymbolrendererv2widget.h | qgscategorizedsymbolrendererv2widget.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgscategorizedsymbolrendererv2widget.h | qgscategorizedsymbolrendererv2widget.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCATEGORIZEDSYMBOLRENDERERV2WIDGET_H | #ifndef QGSCATEGORIZEDSYMBOLRENDERERV2WIDGET_H | |||
#define QGSCATEGORIZEDSYMBOLRENDERERV2WIDGET_H | #define QGSCATEGORIZEDSYMBOLRENDERERV2WIDGET_H | |||
#include "qgscategorizedsymbolrendererv2.h" | #include "qgscategorizedsymbolrendererv2.h" | |||
#include "qgsrendererv2widget.h" | #include "qgsrendererv2widget.h" | |||
#include <QStandardItem> | #include <QStandardItem> | |||
#include <QProxyStyle> | ||||
class QgsCategorizedSymbolRendererV2; | class QgsCategorizedSymbolRendererV2; | |||
class QgsRendererCategoryV2; | class QgsRendererCategoryV2; | |||
#include "ui_qgscategorizedsymbolrendererv2widget.h" | #include "ui_qgscategorizedsymbolrendererv2widget.h" | |||
class GUI_EXPORT QgsCategorizedSymbolRendererV2Widget : public QgsRendererV 2Widget, private Ui::QgsCategorizedSymbolRendererV2Widget | class GUI_EXPORT QgsCategorizedSymbolRendererV2Model : public QAbstractItem Model | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | ||||
QgsCategorizedSymbolRendererV2Model( QObject * parent = 0 ); | ||||
Qt::ItemFlags flags( const QModelIndex & index ) const; | ||||
Qt::DropActions supportedDropActions() const; | ||||
QVariant data( const QModelIndex &index, int role ) const; | ||||
bool setData( const QModelIndex & index, const QVariant & value, int ro | ||||
le ); | ||||
QVariant headerData( int section, Qt::Orientation orientation, int role | ||||
) const; | ||||
int rowCount( const QModelIndex &parent = QModelIndex() ) const; | ||||
int columnCount( const QModelIndex & = QModelIndex() ) const; | ||||
QModelIndex index( int row, int column, const QModelIndex &parent = QMo | ||||
delIndex() ) const; | ||||
QModelIndex parent( const QModelIndex &index ) const; | ||||
QStringList mimeTypes() const; | ||||
QMimeData *mimeData( const QModelIndexList &indexes ) const; | ||||
bool dropMimeData( const QMimeData *data, Qt::DropAction action, int ro | ||||
w, int column, const QModelIndex &parent ); | ||||
void setRenderer( QgsCategorizedSymbolRendererV2* renderer ); | ||||
void addCategory( const QgsRendererCategoryV2 &cat ); | ||||
void deleteRows( QList<int> rows ); | ||||
void removeAllRows( ); | ||||
void sort( int column, Qt::SortOrder order = Qt::AscendingOrder ); | ||||
signals: | ||||
void rowsMoved(); | ||||
private: | ||||
QgsCategorizedSymbolRendererV2* mRenderer; | ||||
QString mMimeFormat; | ||||
}; | ||||
// View style which shows drop indicator line between items | ||||
class QgsCategorizedSymbolRendererV2ViewStyle: public QProxyStyle | ||||
{ | ||||
public: | public: | |||
QgsCategorizedSymbolRendererV2ViewStyle( QStyle* style = 0 ); | ||||
void drawPrimitive( PrimitiveElement element, const QStyleOption * opti | ||||
on, QPainter * painter, const QWidget * widget = 0 ) const; | ||||
}; | ||||
class GUI_EXPORT QgsCategorizedSymbolRendererV2Widget : public QgsRendererV | ||||
2Widget, private Ui::QgsCategorizedSymbolRendererV2Widget | ||||
{ | ||||
Q_OBJECT | ||||
public: | ||||
static QgsRendererV2Widget* create( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ); | static QgsRendererV2Widget* create( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ); | |||
QgsCategorizedSymbolRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2 * style, QgsFeatureRendererV2* renderer ); | QgsCategorizedSymbolRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2 * style, QgsFeatureRendererV2* renderer ); | |||
~QgsCategorizedSymbolRendererV2Widget(); | ~QgsCategorizedSymbolRendererV2Widget(); | |||
virtual QgsFeatureRendererV2* renderer(); | virtual QgsFeatureRendererV2* renderer(); | |||
public slots: | public slots: | |||
void changeCategorizedSymbol(); | void changeCategorizedSymbol(); | |||
void categoryColumnChanged(); | void categoryColumnChanged(); | |||
void categoriesDoubleClicked( const QModelIndex & idx ); | void categoriesDoubleClicked( const QModelIndex & idx ); | |||
void addCategory(); | ||||
void addCategories(); | void addCategories(); | |||
void deleteCategory(); | void deleteCategories(); | |||
void deleteAllCategories(); | void deleteAllCategories(); | |||
void changeCurrentValue( QStandardItem * item ); | ||||
void rotationFieldChanged( QString fldName ); | void rotationFieldChanged( QString fldName ); | |||
void sizeScaleFieldChanged( QString fldName ); | void sizeScaleFieldChanged( QString fldName ); | |||
void scaleMethodChanged( QgsSymbolV2::ScaleMethod scaleMethod ); | ||||
void showSymbolLevels(); | void showSymbolLevels(); | |||
void rowsMoved(); | ||||
protected: | protected: | |||
void updateUiFromRenderer(); | void updateUiFromRenderer(); | |||
void updateCategorizedSymbolIcon(); | void updateCategorizedSymbolIcon(); | |||
//! populate categories view | // Called by virtual refreshSymbolView() | |||
void populateCategories(); | void populateCategories(); | |||
//! populate column combo | //! populate column combo | |||
void populateColumns(); | void populateColumns(); | |||
void populateColorRamps(); | ||||
void addCategory( const QgsRendererCategoryV2& cat ); | ||||
//! return row index for the currently selected category (-1 if on no s election) | //! return row index for the currently selected category (-1 if on no s election) | |||
int currentCategoryRow(); | int currentCategoryRow(); | |||
//! return key for the currently selected category | //! return a list of indexes for the categories unders selection | |||
QVariant currentCategory(); | QList<int> selectedCategories(); | |||
//! change the selected symbols alone for the change button, if there i | ||||
s a selection | ||||
void changeSelectedSymbols(); | ||||
void changeCategorySymbol(); | void changeCategorySymbol(); | |||
QList<QgsSymbolV2*> selectedSymbols(); | QList<QgsSymbolV2*> selectedSymbols(); | |||
void refreshSymbolView() { populateCategories(); } | void refreshSymbolView() { populateCategories(); } | |||
protected slots: | ||||
void addCategory(); | ||||
protected: | protected: | |||
QgsCategorizedSymbolRendererV2* mRenderer; | QgsCategorizedSymbolRendererV2* mRenderer; | |||
QgsSymbolV2* mCategorizedSymbol; | QgsSymbolV2* mCategorizedSymbol; | |||
QgsRendererV2DataDefinedMenus* mDataDefinedMenus; | QgsRendererV2DataDefinedMenus* mDataDefinedMenus; | |||
QgsCategorizedSymbolRendererV2Model* mModel; | ||||
private: | private: | |||
QString mOldClassificationAttribute; | QString mOldClassificationAttribute; | |||
}; | }; | |||
#endif // QGSCATEGORIZEDSYMBOLRENDERERV2WIDGET_H | #endif // QGSCATEGORIZEDSYMBOLRENDERERV2WIDGET_H | |||
End of changes. 17 change blocks. | ||||
14 lines changed or deleted | 63 lines changed or added | |||
qgsclipper.h | qgsclipper.h | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCLIPPER_H | #ifndef QGSCLIPPER_H | |||
#define QGSCLIPPER_H | #define QGSCLIPPER_H | |||
#include "qgis.h" | #include "qgis.h" | |||
#include "qgspoint.h" | #include "qgspoint.h" | |||
#include "qgsrectangle.h" | #include "qgsrectangle.h" | |||
#include <vector> | #include <QVector> | |||
#include <utility> | ||||
#include <QPolygonF> | #include <QPolygonF> | |||
/** \ingroup core | /** \ingroup core | |||
* A class to trim lines and polygons to within a rectangular region. | * A class to trim lines and polygons to within a rectangular region. | |||
* The functions in this class are likely to be called from within a | * The functions in this class are likely to be called from within a | |||
* render loop and hence need to as CPU efficient as possible. | * render loop and hence need to as CPU efficient as possible. | |||
* The main purpose of the functions in this class are to trim lines | * The main purpose of the functions in this class are to trim lines | |||
* and polygons to lie within a rectangular region. This is necessary | * and polygons to lie within a rectangular region. This is necessary | |||
* for drawing items to an X11 display which have a limit on the | * for drawing items to an X11 display which have a limit on the | |||
* magnitude of the screen coordinates (+/- 32768, i.e. 16 bit integer). | * magnitude of the screen coordinates (+/- 32768, i.e. 16 bit integer). | |||
skipping to change at line 76 | skipping to change at line 74 | |||
static const double MAX_Y; | static const double MAX_Y; | |||
static const double MIN_Y; | static const double MIN_Y; | |||
// A handy way to refer to the four boundaries | // A handy way to refer to the four boundaries | |||
enum Boundary {XMax, XMin, YMax, YMin}; | enum Boundary {XMax, XMin, YMax, YMin}; | |||
// Trims the given feature to a rectangular box. Returns the trimmed | // Trims the given feature to a rectangular box. Returns the trimmed | |||
// feature in x and y. The shapeOpen parameter determines whether | // feature in x and y. The shapeOpen parameter determines whether | |||
// the function treats the points as a closed shape (polygon), or as | // the function treats the points as a closed shape (polygon), or as | |||
// an open shape (linestring). | // an open shape (linestring). | |||
static void trimFeature( std::vector<double>& x, | static void trimFeature( QVector<double>& x, | |||
std::vector<double>& y, | QVector<double>& y, | |||
bool shapeOpen ); | bool shapeOpen ); | |||
static void trimPolygon( QPolygonF& pts, const QgsRectangle& clipRect ) ; | static void trimPolygon( QPolygonF& pts, const QgsRectangle& clipRect ) ; | |||
/**Reads a polyline from WKB and clips it to clipExtent | /**Reads a polyline from WKB and clips it to clipExtent | |||
@param wkb pointer to the start of the line wkb | @param wkb pointer to the start of the line wkb | |||
@param clipExtent clipping bounds | @param clipExtent clipping bounds | |||
@param line out: clipped line coordinates*/ | @param line out: clipped line coordinates*/ | |||
static unsigned char* clippedLineWKB( unsigned char* wkb, const QgsRect angle& clipExtent, QPolygonF& line ); | static const unsigned char* clippedLineWKB( const unsigned char* wkb, c onst QgsRectangle& clipExtent, QPolygonF& line ); | |||
private: | private: | |||
// Used when testing for equivalance to 0.0 | // Used when testing for equivalance to 0.0 | |||
static const double SMALL_NUM; | static const double SMALL_NUM; | |||
// Trims the given feature to the given boundary. Returns the | // Trims the given feature to the given boundary. Returns the | |||
// trimmed feature in the outX and outY vectors. | // trimmed feature in the outX and outY vectors. | |||
static void trimFeatureToBoundary( const std::vector<double>& inX, | static void trimFeatureToBoundary( const QVector<double>& inX, | |||
const std::vector<double>& inY, | const QVector<double>& inY, | |||
std::vector<double>& outX, | QVector<double>& outX, | |||
std::vector<double>& outY, | QVector<double>& outY, | |||
Boundary b, | Boundary b, | |||
bool shapeOpen ); | bool shapeOpen ); | |||
static void trimPolygonToBoundary( const QPolygonF& inPts, QPolygonF& o utPts, const QgsRectangle& rect, Boundary b, double boundaryValue ); | static void trimPolygonToBoundary( const QPolygonF& inPts, QPolygonF& o utPts, const QgsRectangle& rect, Boundary b, double boundaryValue ); | |||
// Determines if a point is inside or outside the given boundary | // Determines if a point is inside or outside the given boundary | |||
static bool inside( const double x, const double y, Boundary b ); | static bool inside( const double x, const double y, Boundary b ); | |||
static bool inside( const QPointF& pt, Boundary b, double val ); | static bool inside( const QPointF& pt, Boundary b, double val ); | |||
skipping to change at line 156 | skipping to change at line 154 | |||
// Trim the feature using Sutherland and Hodgman's | // Trim the feature using Sutherland and Hodgman's | |||
// polygon-clipping algorithm. See J. D. Foley, A. van Dam, | // polygon-clipping algorithm. See J. D. Foley, A. van Dam, | |||
// S. K. Feiner, and J. F. Hughes, Computer Graphics, Principles and | // S. K. Feiner, and J. F. Hughes, Computer Graphics, Principles and | |||
// Practice. Addison-Wesley Systems Programming Series, | // Practice. Addison-Wesley Systems Programming Series, | |||
// Addison-Wesley, 2nd ed., 1991. | // Addison-Wesley, 2nd ed., 1991. | |||
// I understand that this is not the most efficient algorithm, but is | // I understand that this is not the most efficient algorithm, but is | |||
// one (the only?) that is guaranteed to always give the correct | // one (the only?) that is guaranteed to always give the correct | |||
// result. | // result. | |||
inline void QgsClipper::trimFeature( std::vector<double>& x, | inline void QgsClipper::trimFeature( QVector<double>& x, | |||
std::vector<double>& y, | QVector<double>& y, | |||
bool shapeOpen ) | bool shapeOpen ) | |||
{ | { | |||
std::vector<double> tmpX; | QVector<double> tmpX; | |||
std::vector<double> tmpY; | QVector<double> tmpY; | |||
trimFeatureToBoundary( x, y, tmpX, tmpY, XMax, shapeOpen ); | trimFeatureToBoundary( x, y, tmpX, tmpY, XMax, shapeOpen ); | |||
x.clear(); | x.clear(); | |||
y.clear(); | y.clear(); | |||
trimFeatureToBoundary( tmpX, tmpY, x, y, YMax, shapeOpen ); | trimFeatureToBoundary( tmpX, tmpY, x, y, YMax, shapeOpen ); | |||
tmpX.clear(); | tmpX.clear(); | |||
tmpY.clear(); | tmpY.clear(); | |||
trimFeatureToBoundary( x, y, tmpX, tmpY, XMin, shapeOpen ); | trimFeatureToBoundary( x, y, tmpX, tmpY, XMin, shapeOpen ); | |||
skipping to change at line 197 | skipping to change at line 195 | |||
pts.clear(); | pts.clear(); | |||
trimPolygonToBoundary( tmpPts, pts, clipRect, YMin, clipRect.yMinimum() ) ; | trimPolygonToBoundary( tmpPts, pts, clipRect, YMin, clipRect.yMinimum() ) ; | |||
} | } | |||
// An auxilary function that is part of the polygon trimming | // An auxilary function that is part of the polygon trimming | |||
// code. Will trim the given polygon to the given boundary and return | // code. Will trim the given polygon to the given boundary and return | |||
// the trimmed polygon in the out pointer. Uses Sutherland and | // the trimmed polygon in the out pointer. Uses Sutherland and | |||
// Hodgman's polygon-clipping algorithm. | // Hodgman's polygon-clipping algorithm. | |||
inline void QgsClipper::trimFeatureToBoundary( | inline void QgsClipper::trimFeatureToBoundary( | |||
const std::vector<double>& inX, | const QVector<double>& inX, | |||
const std::vector<double>& inY, | const QVector<double>& inY, | |||
std::vector<double>& outX, | QVector<double>& outX, | |||
std::vector<double>& outY, | QVector<double>& outY, | |||
Boundary b, bool shapeOpen ) | Boundary b, bool shapeOpen ) | |||
{ | { | |||
// The shapeOpen parameter selects whether this function treats the | // The shapeOpen parameter selects whether this function treats the | |||
// shape as open or closed. False is appropriate for polygons and | // shape as open or closed. False is appropriate for polygons and | |||
// true for polylines. | // true for polylines. | |||
unsigned int i1 = inX.size() - 1; // start with last point | int i1 = inX.size() - 1; // start with last point | |||
// and compare to the first point initially. | // and compare to the first point initially. | |||
for ( unsigned int i2 = 0; i2 < inX.size() ; ++i2 ) | for ( int i2 = 0; i2 < inX.size() ; ++i2 ) | |||
{ | { | |||
// look at each edge of the polygon in turn | // look at each edge of the polygon in turn | |||
//ignore segments with nan or inf coordinates | //ignore segments with nan or inf coordinates | |||
if ( qIsNaN( inX[i2] ) || qIsNaN( inY[i2] ) || qIsInf( inX[i2] ) || qIs Inf( inY[i2] ) | if ( qIsNaN( inX[i2] ) || qIsNaN( inY[i2] ) || qIsInf( inX[i2] ) || qIs Inf( inY[i2] ) | |||
|| qIsNaN( inX[i1] ) || qIsNaN( inY[i1] ) || qIsInf( inX[i1] ) || qIsInf( inY[i1] ) ) | || qIsNaN( inX[i1] ) || qIsNaN( inY[i1] ) || qIsInf( inX[i1] ) || qIsInf( inY[i1] ) ) | |||
{ | { | |||
i1 = i2; | i1 = i2; | |||
continue; | continue; | |||
} | } | |||
skipping to change at line 263 | skipping to change at line 261 | |||
outY.push_back( p.y() ); | outY.push_back( p.y() ); | |||
} | } | |||
} | } | |||
} | } | |||
i1 = i2; | i1 = i2; | |||
} | } | |||
} | } | |||
inline void QgsClipper::trimPolygonToBoundary( const QPolygonF& inPts, QPol ygonF& outPts, const QgsRectangle& rect, Boundary b, double boundaryValue ) | inline void QgsClipper::trimPolygonToBoundary( const QPolygonF& inPts, QPol ygonF& outPts, const QgsRectangle& rect, Boundary b, double boundaryValue ) | |||
{ | { | |||
unsigned int i1 = inPts.size() - 1; // start with last point | int i1 = inPts.size() - 1; // start with last point | |||
// and compare to the first point initially. | // and compare to the first point initially. | |||
for ( int i2 = 0; i2 < inPts.size() ; ++i2 ) | for ( int i2 = 0; i2 < inPts.size() ; ++i2 ) | |||
{ // look at each edge of the polygon in turn | { // look at each edge of the polygon in turn | |||
if ( inside( inPts[i2], b, boundaryValue ) ) // end point of edge is in side boundary | if ( inside( inPts[i2], b, boundaryValue ) ) // end point of edge is in side boundary | |||
{ | { | |||
if ( inside( inPts[i1], b, boundaryValue ) ) | if ( inside( inPts[i1], b, boundaryValue ) ) | |||
{ | { | |||
outPts.append( inPts[i2] ); | outPts.append( inPts[i2] ); | |||
} | } | |||
skipping to change at line 421 | skipping to change at line 419 | |||
r_n = ( y1 - rect.yMaximum() ) * ( rect.xMaximum() - rect.xMinimum() ); | r_n = ( y1 - rect.yMaximum() ) * ( rect.xMaximum() - rect.xMinimum() ); | |||
r_d = -( y2 - y1 ) * ( rect.xMaximum() - rect.xMinimum() ); | r_d = -( y2 - y1 ) * ( rect.xMaximum() - rect.xMinimum() ); | |||
break; | break; | |||
case YMin: // y = MIN_Y boundary | case YMin: // y = MIN_Y boundary | |||
r_n = ( y1 - rect.yMinimum() ) * ( rect.xMaximum() - rect.xMinimum() ); | r_n = ( y1 - rect.yMinimum() ) * ( rect.xMaximum() - rect.xMinimum() ); | |||
r_d = -( y2 - y1 ) * ( rect.xMaximum() - rect.xMinimum() ); | r_d = -( y2 - y1 ) * ( rect.xMaximum() - rect.xMinimum() ); | |||
break; | break; | |||
} | } | |||
double r = 0; | double r = 0; | |||
if ( !doubleNear( r_d, 0.0 ) ) | if ( !qgsDoubleNear( r_d, 0.0 ) ) | |||
{ | { | |||
r = r_n / r_d; | r = r_n / r_d; | |||
} | } | |||
return QPointF( x1 + r*( x2 - x1 ), y1 + r*( y2 - y1 ) ); | return QPointF( x1 + r*( x2 - x1 ), y1 + r*( y2 - y1 ) ); | |||
} | } | |||
inline void QgsClipper::clipStartTop( double& x0, double& y0, const double& x1, const double& y1, double yMax ) | inline void QgsClipper::clipStartTop( double& x0, double& y0, const double& x1, const double& y1, double yMax ) | |||
{ | { | |||
x0 += ( x1 - x0 ) * ( yMax - y0 ) / ( y1 - y0 ); | x0 += ( x1 - x0 ) * ( yMax - y0 ) / ( y1 - y0 ); | |||
y0 = yMax; | y0 = yMax; | |||
End of changes. 11 change blocks. | ||||
22 lines changed or deleted | 20 lines changed or added | |||
qgscliptominmaxenhancement.h | qgscliptominmaxenhancement.h | |||
---|---|---|---|---|
skipping to change at line 34 | skipping to change at line 34 | |||
/** \ingroup core | /** \ingroup core | |||
* A raster contrast enhancement that will clip a value to the specified mi n/max range. | * A raster contrast enhancement that will clip a value to the specified mi n/max range. | |||
* For example if a min max range of [10,240] is specified in the construct or, and | * For example if a min max range of [10,240] is specified in the construct or, and | |||
* a value of 250 is called using enhance(), the value will be truncated (' clipped') | * a value of 250 is called using enhance(), the value will be truncated (' clipped') | |||
* to 240. | * to 240. | |||
*/ | */ | |||
class CORE_EXPORT QgsClipToMinMaxEnhancement : public QgsContrastEnhancemen tFunction | class CORE_EXPORT QgsClipToMinMaxEnhancement : public QgsContrastEnhancemen tFunction | |||
{ | { | |||
public: | public: | |||
QgsClipToMinMaxEnhancement( QgsContrastEnhancement::QgsRasterDataType, double, double ); | QgsClipToMinMaxEnhancement( QGis::DataType, double, double ); | |||
int enhance( double ); | int enhance( double ); | |||
bool isValueInDisplayableRange( double ); | bool isValueInDisplayableRange( double ); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgscolorbrewerpalette.h | qgscolorbrewerpalette.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgscolorbrewerpalette.h | qgscolorbrewerpalette.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCOLORBREWERPALETTE_H | #ifndef QGSCOLORBREWERPALETTE_H | |||
#define QGSCOLORBREWERPALETTE_H | #define QGSCOLORBREWERPALETTE_H | |||
extern const char* brewerString; | #include <QList> | |||
#include <QColor> | ||||
#include "qgssymbollayerv2utils.h" | ||||
class CORE_EXPORT QgsColorBrewerPalette | class CORE_EXPORT QgsColorBrewerPalette | |||
{ | { | |||
public: | public: | |||
static QList<QColor> listSchemeColors( QString schemeName, int colors ) | static QList<QColor> listSchemeColors( QString schemeName, int colors ) | |||
{ | { | |||
QList<QColor> pal; | QList<QColor> pal; | |||
QString palette( brewerString ); | QString palette( brewerString ); | |||
QStringList list = palette.split( QChar( '\n' ) ); | QStringList list = palette.split( QChar( '\n' ) ); | |||
foreach( QString entry, list ) | foreach ( QString entry, list ) | |||
{ | { | |||
QStringList items = entry.split( QChar( '-' ) ); | QStringList items = entry.split( QChar( '-' ) ); | |||
if ( items.count() != 3 || items[0] != schemeName || items[1].toInt () != colors ) | if ( items.count() != 3 || items[0] != schemeName || items[1].toInt () != colors ) | |||
continue; | continue; | |||
QStringList colors = items[2].split( QChar( ' ' ) ); | QStringList colors = items[2].split( QChar( ' ' ) ); | |||
foreach( QString clr, colors ) | foreach ( QString clr, colors ) | |||
pal << parseColor( clr ); | { | |||
pal << QgsSymbolLayerV2Utils::parseColor( clr ); | ||||
} | ||||
} | } | |||
return pal; | return pal; | |||
} | } | |||
static QStringList listSchemes() | static QStringList listSchemes() | |||
{ | { | |||
QStringList schemes; | QStringList schemes; | |||
QString palette( brewerString ); | QString palette( brewerString ); | |||
QStringList list = palette.split( QChar( '\n' ) ); | QStringList list = palette.split( QChar( '\n' ) ); | |||
foreach( QString entry, list ) | foreach ( QString entry, list ) | |||
{ | { | |||
QStringList items = entry.split( QChar( '-' ) ); | QStringList items = entry.split( QChar( '-' ) ); | |||
if ( items.count() != 3 ) | if ( items.count() != 3 ) | |||
continue; | continue; | |||
if ( !schemes.contains( items[0] ) ) | if ( !schemes.contains( items[0] ) ) | |||
schemes << items[0]; | schemes << items[0]; | |||
} | } | |||
return schemes; | return schemes; | |||
} | } | |||
static QList<int> listSchemeVariants( QString schemeName ) | static QList<int> listSchemeVariants( QString schemeName ) | |||
{ | { | |||
QList<int> variants; | QList<int> variants; | |||
QString palette( brewerString ); | QString palette( brewerString ); | |||
QStringList list = palette.split( QChar( '\n' ) ); | QStringList list = palette.split( QChar( '\n' ) ); | |||
foreach( QString entry, list ) | foreach ( QString entry, list ) | |||
{ | { | |||
QStringList items = entry.split( QChar( '-' ) ); | QStringList items = entry.split( QChar( '-' ) ); | |||
if ( items.count() != 3 || items[0] != schemeName ) | if ( items.count() != 3 || items[0] != schemeName ) | |||
continue; | continue; | |||
variants << items[1].toInt(); | variants << items[1].toInt(); | |||
} | } | |||
return variants; | return variants; | |||
} | } | |||
static QColor parseColor( QString color ) | // extracted ColorBrewer data | |||
{ | static const char *brewerString; | |||
QStringList p = color.split( QChar( ',' ) ); | ||||
if ( p.count() != 3 ) | ||||
return QColor(); | ||||
return QColor( p[0].toInt(), p[1].toInt(), p[2].toInt() ); | ||||
} | ||||
}; | }; | |||
/* | ||||
Apache-Style Software License for ColorBrewer software and ColorBrewer Colo | ||||
r Schemes | ||||
Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania Stat | ||||
e University. | ||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||||
use this file except in compliance with the License. | ||||
You may obtain a copy of the License at http://www.apache.org/licenses/LICE | ||||
NSE-2.0 | ||||
*/ | ||||
// extracted ColorBrewer data | ||||
const char* brewerString = | ||||
"Spectral-3-252,141,89 255,255,191 153,213,148\n" | ||||
"Spectral-4-215,25,28 253,174,97 171,221,164 43,131,186\n" | ||||
"Spectral-5-215,25,28 253,174,97 255,255,191 171,221,164 43,131,186\n" | ||||
"Spectral-6-213,62,79 252,141,89 254,224,139 230,245,152 153,213,148 50,1 | ||||
36,189\n" | ||||
"Spectral-7-213,62,79 252,141,89 254,224,139 255,255,191 230,245,152 153, | ||||
213,148 50,136,189\n" | ||||
"Spectral-8-213,62,79 244,109,67 253,174,97 254,224,139 230,245,152 171,2 | ||||
21,164 102,194,165 50,136,189\n" | ||||
"Spectral-9-213,62,79 244,109,67 253,174,97 254,224,139 255,255,191 230,2 | ||||
45,152 171,221,164 102,194,165 50,136,189\n" | ||||
"Spectral-10-158,1,66 213,62,79 244,109,67 253,174,97 254,224,139 230,245 | ||||
,152 171,221,164 102,194,165 50,136,189 94,79,162\n" | ||||
"Spectral-11-158,1,66 213,62,79 244,109,67 253,174,97 254,224,139 255,255 | ||||
,191 230,245,152 171,221,164 102,194,165 50,136,189 94,79,162\n" | ||||
"RdYlGn-3-252,141,89 255,255,191 145,207,96\n" | ||||
"RdYlGn-4-215,25,28 253,174,97 166,217,106 26,150,65\n" | ||||
"RdYlGn-5-215,25,28 253,174,97 255,255,191 166,217,106 26,150,65\n" | ||||
"RdYlGn-6-215,48,39 252,141,89 254,224,139 217,239,139 145,207,96 26,152, | ||||
80\n" | ||||
"RdYlGn-7-215,48,39 252,141,89 254,224,139 255,255,191 217,239,139 145,20 | ||||
7,96 26,152,80\n" | ||||
"RdYlGn-8-215,48,39 244,109,67 253,174,97 254,224,139 217,239,139 166,217 | ||||
,106 102,189,99 26,152,80\n" | ||||
"RdYlGn-9-215,48,39 244,109,67 253,174,97 254,224,139 255,255,191 217,239 | ||||
,139 166,217,106 102,189,99 26,152,80\n" | ||||
"RdYlGn-10-165,0,38 215,48,39 244,109,67 253,174,97 254,224,139 217,239,1 | ||||
39 166,217,106 102,189,99 26,152,80 0,104,55\n" | ||||
"RdYlGn-11-165,0,38 215,48,39 244,109,67 253,174,97 254,224,139 255,255,1 | ||||
91 217,239,139 166,217,106 102,189,99 26,152,80 0,104,55\n" | ||||
"Set2-3-102,194,165 252,141,98 141,160,203\n" | ||||
"Set2-4-102,194,165 252,141,98 141,160,203 231,138,195\n" | ||||
"Set2-5-102,194,165 252,141,98 141,160,203 231,138,195 166,216,84\n" | ||||
"Set2-6-102,194,165 252,141,98 141,160,203 231,138,195 166,216,84 255,217 | ||||
,47\n" | ||||
"Set2-7-102,194,165 252,141,98 141,160,203 231,138,195 166,216,84 255,217 | ||||
,47 229,196,148\n" | ||||
"Set2-8-102,194,165 252,141,98 141,160,203 231,138,195 166,216,84 255,217 | ||||
,47 229,196,148 179,179,179\n" | ||||
"Accent-3-127,201,127 190,174,212 253,192,134\n" | ||||
"Accent-4-127,201,127 190,174,212 253,192,134 255,255,153\n" | ||||
"Accent-5-127,201,127 190,174,212 253,192,134 255,255,153 56,108,176\n" | ||||
"Accent-6-127,201,127 190,174,212 253,192,134 255,255,153 56,108,176 240, | ||||
2,127\n" | ||||
"Accent-7-127,201,127 190,174,212 253,192,134 255,255,153 56,108,176 240, | ||||
2,127 191,91,23\n" | ||||
"Accent-8-127,201,127 190,174,212 253,192,134 255,255,153 56,108,176 240, | ||||
2,127 191,91,23 102,102,102\n" | ||||
"OrRd-3-254,232,200 253,187,132 227,74,51\n" | ||||
"OrRd-4-254,240,217 253,204,138 252,141,89 215,48,31\n" | ||||
"OrRd-5-254,240,217 253,204,138 252,141,89 227,74,51 179,0,0\n" | ||||
"OrRd-6-254,240,217 253,212,158 253,187,132 252,141,89 227,74,51 179,0,0\ | ||||
n" | ||||
"OrRd-7-254,240,217 253,212,158 253,187,132 252,141,89 239,101,72 215,48, | ||||
31 153,0,0\n" | ||||
"OrRd-8-255,247,236 254,232,200 253,212,158 253,187,132 252,141,89 239,10 | ||||
1,72 215,48,31 153,0,0\n" | ||||
"OrRd-9-255,247,236 254,232,200 253,212,158 253,187,132 252,141,89 239,10 | ||||
1,72 215,48,31 179,0,0 127,0,0\n" | ||||
"Set1-3-228,26,28 55,126,184 77,175,74\n" | ||||
"Set1-4-228,26,28 55,126,184 77,175,74 152,78,163\n" | ||||
"Set1-5-228,26,28 55,126,184 77,175,74 152,78,163 255,127,0\n" | ||||
"Set1-6-228,26,28 55,126,184 77,175,74 152,78,163 255,127,0 255,255,51\n" | ||||
"Set1-7-228,26,28 55,126,184 77,175,74 152,78,163 255,127,0 255,255,51 16 | ||||
6,86,40\n" | ||||
"Set1-8-228,26,28 55,126,184 77,175,74 152,78,163 255,127,0 255,255,51 16 | ||||
6,86,40 247,129,191\n" | ||||
"Set1-9-228,26,28 55,126,184 77,175,74 152,78,163 255,127,0 255,255,51 16 | ||||
6,86,40 247,129,191 153,153,153\n" | ||||
"PuBu-3-236,231,242 166,189,219 43,140,190\n" | ||||
"PuBu-4-241,238,246 189,201,225 116,169,207 5,112,176\n" | ||||
"PuBu-5-241,238,246 189,201,225 116,169,207 43,140,190 4,90,141\n" | ||||
"PuBu-6-241,238,246 208,209,230 166,189,219 116,169,207 43,140,190 4,90,1 | ||||
41\n" | ||||
"PuBu-7-241,238,246 208,209,230 166,189,219 116,169,207 54,144,192 5,112, | ||||
176 3,78,123\n" | ||||
"PuBu-8-255,247,251 236,231,242 208,209,230 166,189,219 116,169,207 54,14 | ||||
4,192 5,112,176 3,78,123\n" | ||||
"PuBu-9-255,247,251 236,231,242 208,209,230 166,189,219 116,169,207 54,14 | ||||
4,192 5,112,176 4,90,141 2,56,88\n" | ||||
"Set3-3-141,211,199 255,255,179 190,186,218\n" | ||||
"Set3-4-141,211,199 255,255,179 190,186,218 251,128,114\n" | ||||
"Set3-5-141,211,199 255,255,179 190,186,218 251,128,114 128,177,211\n" | ||||
"Set3-6-141,211,199 255,255,179 190,186,218 251,128,114 128,177,211 253,1 | ||||
80,98\n" | ||||
"Set3-7-141,211,199 255,255,179 190,186,218 251,128,114 128,177,211 253,1 | ||||
80,98 179,222,105\n" | ||||
"Set3-8-141,211,199 255,255,179 190,186,218 251,128,114 128,177,211 253,1 | ||||
80,98 179,222,105 252,205,229\n" | ||||
"Set3-9-141,211,199 255,255,179 190,186,218 251,128,114 128,177,211 253,1 | ||||
80,98 179,222,105 252,205,229 217,217,217\n" | ||||
"Set3-10-141,211,199 255,255,179 190,186,218 251,128,114 128,177,211 253, | ||||
180,98 179,222,105 252,205,229 217,217,217 188,128,189\n" | ||||
"Set3-11-141,211,199 255,255,179 190,186,218 251,128,114 128,177,211 253, | ||||
180,98 179,222,105 252,205,229 217,217,217 188,128,189 204,235,197\n" | ||||
"Set3-12-141,211,199 255,255,179 190,186,218 251,128,114 128,177,211 253, | ||||
180,98 179,222,105 252,205,229 217,217,217 188,128,189 204,235,197 255,237, | ||||
111\n" | ||||
"BuPu-3-224,236,244 158,188,218 136,86,167\n" | ||||
"BuPu-4-237,248,251 179,205,227 140,150,198 136,65,157\n" | ||||
"BuPu-5-237,248,251 179,205,227 140,150,198 136,86,167 129,15,124\n" | ||||
"BuPu-6-237,248,251 191,211,230 158,188,218 140,150,198 136,86,167 129,15 | ||||
,124\n" | ||||
"BuPu-7-237,248,251 191,211,230 158,188,218 140,150,198 140,107,177 136,6 | ||||
5,157 110,1,107\n" | ||||
"BuPu-8-247,252,253 224,236,244 191,211,230 158,188,218 140,150,198 140,1 | ||||
07,177 136,65,157 110,1,107\n" | ||||
"BuPu-9-247,252,253 224,236,244 191,211,230 158,188,218 140,150,198 140,1 | ||||
07,177 136,65,157 129,15,124 77,0,75\n" | ||||
"Dark2-3-27,158,119 217,95,2 117,112,179\n" | ||||
"Dark2-4-27,158,119 217,95,2 117,112,179 231,41,138\n" | ||||
"Dark2-5-27,158,119 217,95,2 117,112,179 231,41,138 102,166,30\n" | ||||
"Dark2-6-27,158,119 217,95,2 117,112,179 231,41,138 102,166,30 230,171,2\ | ||||
n" | ||||
"Dark2-7-27,158,119 217,95,2 117,112,179 231,41,138 102,166,30 230,171,2 | ||||
166,118,29\n" | ||||
"Dark2-8-27,158,119 217,95,2 117,112,179 231,41,138 102,166,30 230,171,2 | ||||
166,118,29 102,102,102\n" | ||||
"RdBu-3-239,138,98 247,247,247 103,169,207\n" | ||||
"RdBu-4-202,0,32 244,165,130 146,197,222 5,113,176\n" | ||||
"RdBu-5-202,0,32 244,165,130 247,247,247 146,197,222 5,113,176\n" | ||||
"RdBu-6-178,24,43 239,138,98 253,219,199 209,229,240 103,169,207 33,102,1 | ||||
72\n" | ||||
"RdBu-7-178,24,43 239,138,98 253,219,199 247,247,247 209,229,240 103,169, | ||||
207 33,102,172\n" | ||||
"RdBu-8-178,24,43 214,96,77 244,165,130 253,219,199 209,229,240 146,197,2 | ||||
22 67,147,195 33,102,172\n" | ||||
"RdBu-9-178,24,43 214,96,77 244,165,130 253,219,199 247,247,247 209,229,2 | ||||
40 146,197,222 67,147,195 33,102,172\n" | ||||
"RdBu-10-103,0,31 178,24,43 214,96,77 244,165,130 253,219,199 209,229,240 | ||||
146,197,222 67,147,195 33,102,172 5,48,97\n" | ||||
"RdBu-11-103,0,31 178,24,43 214,96,77 244,165,130 253,219,199 247,247,247 | ||||
209,229,240 146,197,222 67,147,195 33,102,172 5,48,97\n" | ||||
"Oranges-3-254,230,206 253,174,107 230,85,13\n" | ||||
"Oranges-4-254,237,222 253,190,133 253,141,60 217,71,1\n" | ||||
"Oranges-5-254,237,222 253,190,133 253,141,60 230,85,13 166,54,3\n" | ||||
"Oranges-6-254,237,222 253,208,162 253,174,107 253,141,60 230,85,13 166,5 | ||||
4,3\n" | ||||
"Oranges-7-254,237,222 253,208,162 253,174,107 253,141,60 241,105,19 217, | ||||
72,1 140,45,4\n" | ||||
"Oranges-8-255,245,235 254,230,206 253,208,162 253,174,107 253,141,60 241 | ||||
,105,19 217,72,1 140,45,4\n" | ||||
"Oranges-9-255,245,235 254,230,206 253,208,162 253,174,107 253,141,60 241 | ||||
,105,19 217,72,1 166,54,3 127,39,4\n" | ||||
"BuGn-3-229,245,249 153,216,201 44,162,95\n" | ||||
"BuGn-4-237,248,251 178,226,226 102,194,164 35,139,69\n" | ||||
"BuGn-5-237,248,251 178,226,226 102,194,164 44,162,95 0,109,44\n" | ||||
"BuGn-6-237,248,251 204,236,230 153,216,201 102,194,164 44,162,95 0,109,4 | ||||
4\n" | ||||
"BuGn-7-237,248,251 204,236,230 153,216,201 102,194,164 65,174,118 35,139 | ||||
,69 0,88,36\n" | ||||
"BuGn-8-247,252,253 229,245,249 204,236,230 153,216,201 102,194,164 65,17 | ||||
4,118 35,139,69 0,88,36\n" | ||||
"BuGn-9-247,252,253 229,245,249 204,236,230 153,216,201 102,194,164 65,17 | ||||
4,118 35,139,69 0,109,44 0,68,27\n" | ||||
"PiYG-3-233,163,201 247,247,247 161,215,106\n" | ||||
"PiYG-4-208,28,139 241,182,218 184,225,134 77,172,38\n" | ||||
"PiYG-5-208,28,139 241,182,218 247,247,247 184,225,134 77,172,38\n" | ||||
"PiYG-6-197,27,125 233,163,201 253,224,239 230,245,208 161,215,106 77,146 | ||||
,33\n" | ||||
"PiYG-7-197,27,125 233,163,201 253,224,239 247,247,247 230,245,208 161,21 | ||||
5,106 77,146,33\n" | ||||
"PiYG-8-197,27,125 222,119,174 241,182,218 253,224,239 230,245,208 184,22 | ||||
5,134 127,188,65 77,146,33\n" | ||||
"PiYG-9-197,27,125 222,119,174 241,182,218 253,224,239 247,247,247 230,24 | ||||
5,208 184,225,134 127,188,65 77,146,33\n" | ||||
"PiYG-10-142,1,82 197,27,125 222,119,174 241,182,218 253,224,239 230,245, | ||||
208 184,225,134 127,188,65 77,146,33 39,100,25\n" | ||||
"PiYG-11-142,1,82 197,27,125 222,119,174 241,182,218 253,224,239 247,247, | ||||
247 230,245,208 184,225,134 127,188,65 77,146,33 39,100,25\n" | ||||
"YlOrBr-3-255,247,188 254,196,79 217,95,14\n" | ||||
"YlOrBr-4-255,255,212 254,217,142 254,153,41 204,76,2\n" | ||||
"YlOrBr-5-255,255,212 254,217,142 254,153,41 217,95,14 153,52,4\n" | ||||
"YlOrBr-6-255,255,212 254,227,145 254,196,79 254,153,41 217,95,14 153,52, | ||||
4\n" | ||||
"YlOrBr-7-255,255,212 254,227,145 254,196,79 254,153,41 236,112,20 204,76 | ||||
,2 140,45,4\n" | ||||
"YlOrBr-8-255,255,229 255,247,188 254,227,145 254,196,79 254,153,41 236,1 | ||||
12,20 204,76,2 140,45,4\n" | ||||
"YlOrBr-9-255,255,229 255,247,188 254,227,145 254,196,79 254,153,41 236,1 | ||||
12,20 204,76,2 153,52,4 102,37,6\n" | ||||
"YlGn-3-247,252,185 173,221,142 49,163,84\n" | ||||
"YlGn-4-255,255,204 194,230,153 120,198,121 35,132,67\n" | ||||
"YlGn-5-255,255,204 194,230,153 120,198,121 49,163,84 0,104,55\n" | ||||
"YlGn-6-255,255,204 217,240,163 173,221,142 120,198,121 49,163,84 0,104,5 | ||||
5\n" | ||||
"YlGn-7-255,255,204 217,240,163 173,221,142 120,198,121 65,171,93 35,132, | ||||
67 0,90,50\n" | ||||
"YlGn-8-255,255,229 247,252,185 217,240,163 173,221,142 120,198,121 65,17 | ||||
1,93 35,132,67 0,90,50\n" | ||||
"YlGn-9-255,255,229 247,252,185 217,240,163 173,221,142 120,198,121 65,17 | ||||
1,93 35,132,67 0,104,55 0,69,41\n" | ||||
"Reds-3-254,224,210 252,146,114 222,45,38\n" | ||||
"Reds-4-254,229,217 252,174,145 251,106,74 203,24,29\n" | ||||
"Reds-5-254,229,217 252,174,145 251,106,74 222,45,38 165,15,21\n" | ||||
"Reds-6-254,229,217 252,187,161 252,146,114 251,106,74 222,45,38 165,15,2 | ||||
1\n" | ||||
"Reds-7-254,229,217 252,187,161 252,146,114 251,106,74 239,59,44 203,24,2 | ||||
9 153,0,13\n" | ||||
"Reds-8-255,245,240 254,224,210 252,187,161 252,146,114 251,106,74 239,59 | ||||
,44 203,24,29 153,0,13\n" | ||||
"Reds-9-255,245,240 254,224,210 252,187,161 252,146,114 251,106,74 239,59 | ||||
,44 203,24,29 165,15,21 103,0,13\n" | ||||
"RdPu-3-253,224,221 250,159,181 197,27,138\n" | ||||
"RdPu-4-254,235,226 251,180,185 247,104,161 174,1,126\n" | ||||
"RdPu-5-254,235,226 251,180,185 247,104,161 197,27,138 122,1,119\n" | ||||
"RdPu-6-254,235,226 252,197,192 250,159,181 247,104,161 197,27,138 122,1, | ||||
119\n" | ||||
"RdPu-7-254,235,226 252,197,192 250,159,181 247,104,161 221,52,151 174,1, | ||||
126 122,1,119\n" | ||||
"RdPu-8-255,247,243 253,224,221 252,197,192 250,159,181 247,104,161 221,5 | ||||
2,151 174,1,126 122,1,119\n" | ||||
"RdPu-9-255,247,243 253,224,221 252,197,192 250,159,181 247,104,161 221,5 | ||||
2,151 174,1,126 122,1,119 73,0,106\n" | ||||
"Greens-3-229,245,224 161,217,155 49,163,84\n" | ||||
"Greens-4-237,248,233 186,228,179 116,196,118 35,139,69\n" | ||||
"Greens-5-237,248,233 186,228,179 116,196,118 49,163,84 0,109,44\n" | ||||
"Greens-6-237,248,233 199,233,192 161,217,155 116,196,118 49,163,84 0,109 | ||||
,44\n" | ||||
"Greens-7-237,248,233 199,233,192 161,217,155 116,196,118 65,171,93 35,13 | ||||
9,69 0,90,50\n" | ||||
"Greens-8-247,252,245 229,245,224 199,233,192 161,217,155 116,196,118 65, | ||||
171,93 35,139,69 0,90,50\n" | ||||
"Greens-9-247,252,245 229,245,224 199,233,192 161,217,155 116,196,118 65, | ||||
171,93 35,139,69 0,109,44 0,68,27\n" | ||||
"PRGn-3-175,141,195 247,247,247 127,191,123\n" | ||||
"PRGn-4-123,50,148 194,165,207 166,219,160 0,136,55\n" | ||||
"PRGn-5-123,50,148 194,165,207 247,247,247 166,219,160 0,136,55\n" | ||||
"PRGn-6-118,42,131 175,141,195 231,212,232 217,240,211 127,191,123 27,120 | ||||
,55\n" | ||||
"PRGn-7-118,42,131 175,141,195 231,212,232 247,247,247 217,240,211 127,19 | ||||
1,123 27,120,55\n" | ||||
"PRGn-8-118,42,131 153,112,171 194,165,207 231,212,232 217,240,211 166,21 | ||||
9,160 90,174,97 27,120,55\n" | ||||
"PRGn-9-118,42,131 153,112,171 194,165,207 231,212,232 247,247,247 217,24 | ||||
0,211 166,219,160 90,174,97 27,120,55\n" | ||||
"PRGn-10-64,0,75 118,42,131 153,112,171 194,165,207 231,212,232 217,240,2 | ||||
11 166,219,160 90,174,97 27,120,55 0,68,27\n" | ||||
"PRGn-11-64,0,75 118,42,131 153,112,171 194,165,207 231,212,232 247,247,2 | ||||
47 217,240,211 166,219,160 90,174,97 27,120,55 0,68,27\n" | ||||
"YlGnBu-3-237,248,177 127,205,187 44,127,184\n" | ||||
"YlGnBu-4-255,255,204 161,218,180 65,182,196 34,94,168\n" | ||||
"YlGnBu-5-255,255,204 161,218,180 65,182,196 44,127,184 37,52,148\n" | ||||
"YlGnBu-6-255,255,204 199,233,180 127,205,187 65,182,196 44,127,184 37,52 | ||||
,148\n" | ||||
"YlGnBu-7-255,255,204 199,233,180 127,205,187 65,182,196 29,145,192 34,94 | ||||
,168 12,44,132\n" | ||||
"YlGnBu-8-255,255,217 237,248,177 199,233,180 127,205,187 65,182,196 29,1 | ||||
45,192 34,94,168 12,44,132\n" | ||||
"YlGnBu-9-255,255,217 237,248,177 199,233,180 127,205,187 65,182,196 29,1 | ||||
45,192 34,94,168 37,52,148 8,29,88\n" | ||||
"RdYlBu-3-252,141,89 255,255,191 145,191,219\n" | ||||
"RdYlBu-4-215,25,28 253,174,97 171,217,233 44,123,182\n" | ||||
"RdYlBu-5-215,25,28 253,174,97 255,255,191 171,217,233 44,123,182\n" | ||||
"RdYlBu-6-215,48,39 252,141,89 254,224,144 224,243,248 145,191,219 69,117 | ||||
,180\n" | ||||
"RdYlBu-7-215,48,39 252,141,89 254,224,144 255,255,191 224,243,248 145,19 | ||||
1,219 69,117,180\n" | ||||
"RdYlBu-8-215,48,39 244,109,67 253,174,97 254,224,144 224,243,248 171,217 | ||||
,233 116,173,209 69,117,180\n" | ||||
"RdYlBu-9-215,48,39 244,109,67 253,174,97 254,224,144 255,255,191 224,243 | ||||
,248 171,217,233 116,173,209 69,117,180\n" | ||||
"RdYlBu-10-165,0,38 215,48,39 244,109,67 253,174,97 254,224,144 224,243,2 | ||||
48 171,217,233 116,173,209 69,117,180 49,54,149\n" | ||||
"RdYlBu-11-165,0,38 215,48,39 244,109,67 253,174,97 254,224,144 255,255,1 | ||||
91 224,243,248 171,217,233 116,173,209 69,117,180 49,54,149\n" | ||||
"Paired-3-166,206,227 31,120,180 178,223,138\n" | ||||
"Paired-4-166,206,227 31,120,180 178,223,138 51,160,44\n" | ||||
"Paired-5-166,206,227 31,120,180 178,223,138 51,160,44 251,154,153\n" | ||||
"Paired-6-166,206,227 31,120,180 178,223,138 51,160,44 251,154,153 227,26 | ||||
,28\n" | ||||
"Paired-7-166,206,227 31,120,180 178,223,138 51,160,44 251,154,153 227,26 | ||||
,28 253,191,111\n" | ||||
"Paired-8-166,206,227 31,120,180 178,223,138 51,160,44 251,154,153 227,26 | ||||
,28 253,191,111 255,127,0\n" | ||||
"Paired-9-166,206,227 31,120,180 178,223,138 51,160,44 251,154,153 227,26 | ||||
,28 253,191,111 255,127,0 202,178,214\n" | ||||
"Paired-10-166,206,227 31,120,180 178,223,138 51,160,44 251,154,153 227,2 | ||||
6,28 253,191,111 255,127,0 202,178,214 106,61,154\n" | ||||
"Paired-11-166,206,227 31,120,180 178,223,138 51,160,44 251,154,153 227,2 | ||||
6,28 253,191,111 255,127,0 202,178,214 106,61,154 255,255,153\n" | ||||
"Paired-12-166,206,227 31,120,180 178,223,138 51,160,44 251,154,153 227,2 | ||||
6,28 253,191,111 255,127,0 202,178,214 106,61,154 255,255,153 177,89,40\n" | ||||
"BrBG-3-216,179,101 245,245,245 90,180,172\n" | ||||
"BrBG-4-166,97,26 223,194,125 128,205,193 1,133,113\n" | ||||
"BrBG-5-166,97,26 223,194,125 245,245,245 128,205,193 1,133,113\n" | ||||
"BrBG-6-140,81,10 216,179,101 246,232,195 199,234,229 90,180,172 1,102,94 | ||||
\n" | ||||
"BrBG-7-140,81,10 216,179,101 246,232,195 245,245,245 199,234,229 90,180, | ||||
172 1,102,94\n" | ||||
"BrBG-8-140,81,10 191,129,45 223,194,125 246,232,195 199,234,229 128,205, | ||||
193 53,151,143 1,102,94\n" | ||||
"BrBG-9-140,81,10 191,129,45 223,194,125 246,232,195 245,245,245 199,234, | ||||
229 128,205,193 53,151,143 1,102,94\n" | ||||
"BrBG-10-84,48,5 140,81,10 191,129,45 223,194,125 246,232,195 199,234,229 | ||||
128,205,193 53,151,143 1,102,94 0,60,48\n" | ||||
"BrBG-11-84,48,5 140,81,10 191,129,45 223,194,125 246,232,195 245,245,245 | ||||
199,234,229 128,205,193 53,151,143 1,102,94 0,60,48\n" | ||||
"Purples-3-239,237,245 188,189,220 117,107,177\n" | ||||
"Purples-4-242,240,247 203,201,226 158,154,200 106,81,163\n" | ||||
"Purples-5-242,240,247 203,201,226 158,154,200 117,107,177 84,39,143\n" | ||||
"Purples-6-242,240,247 218,218,235 188,189,220 158,154,200 117,107,177 84 | ||||
,39,143\n" | ||||
"Purples-7-242,240,247 218,218,235 188,189,220 158,154,200 128,125,186 10 | ||||
6,81,163 74,20,134\n" | ||||
"Purples-8-252,251,253 239,237,245 218,218,235 188,189,220 158,154,200 12 | ||||
8,125,186 106,81,163 74,20,134\n" | ||||
"Purples-9-252,251,253 239,237,245 218,218,235 188,189,220 158,154,200 12 | ||||
8,125,186 106,81,163 84,39,143 63,0,125\n" | ||||
"Pastel2-3-179,226,205 253,205,172 203,213,232\n" | ||||
"Pastel2-4-179,226,205 253,205,172 203,213,232 244,202,228\n" | ||||
"Pastel2-5-179,226,205 253,205,172 203,213,232 244,202,228 230,245,201\n" | ||||
"Pastel2-6-179,226,205 253,205,172 203,213,232 244,202,228 230,245,201 25 | ||||
5,242,174\n" | ||||
"Pastel2-7-179,226,205 253,205,172 203,213,232 244,202,228 230,245,201 25 | ||||
5,242,174 241,226,204\n" | ||||
"Pastel2-8-179,226,205 253,205,172 203,213,232 244,202,228 230,245,201 25 | ||||
5,242,174 241,226,204 204,204,204\n" | ||||
"Pastel1-3-251,180,174 179,205,227 204,235,197\n" | ||||
"Pastel1-4-251,180,174 179,205,227 204,235,197 222,203,228\n" | ||||
"Pastel1-5-251,180,174 179,205,227 204,235,197 222,203,228 254,217,166\n" | ||||
"Pastel1-6-251,180,174 179,205,227 204,235,197 222,203,228 254,217,166 25 | ||||
5,255,204\n" | ||||
"Pastel1-7-251,180,174 179,205,227 204,235,197 222,203,228 254,217,166 25 | ||||
5,255,204 229,216,189\n" | ||||
"Pastel1-8-251,180,174 179,205,227 204,235,197 222,203,228 254,217,166 25 | ||||
5,255,204 229,216,189 253,218,236\n" | ||||
"Pastel1-9-251,180,174 179,205,227 204,235,197 222,203,228 254,217,166 25 | ||||
5,255,204 229,216,189 253,218,236 242,242,242\n" | ||||
"GnBu-3-224,243,219 168,221,181 67,162,202\n" | ||||
"GnBu-4-240,249,232 186,228,188 123,204,196 43,140,190\n" | ||||
"GnBu-5-240,249,232 186,228,188 123,204,196 67,162,202 8,104,172\n" | ||||
"GnBu-6-240,249,232 204,235,197 168,221,181 123,204,196 67,162,202 8,104, | ||||
172\n" | ||||
"GnBu-7-240,249,232 204,235,197 168,221,181 123,204,196 78,179,211 43,140 | ||||
,190 8,88,158\n" | ||||
"GnBu-8-247,252,240 224,243,219 204,235,197 168,221,181 123,204,196 78,17 | ||||
9,211 43,140,190 8,88,158\n" | ||||
"GnBu-9-247,252,240 224,243,219 204,235,197 168,221,181 123,204,196 78,17 | ||||
9,211 43,140,190 8,104,172 8,64,129\n" | ||||
"Greys-3-240,240,240 189,189,189 99,99,99\n" | ||||
"Greys-4-247,247,247 204,204,204 150,150,150 82,82,82\n" | ||||
"Greys-5-247,247,247 204,204,204 150,150,150 99,99,99 37,37,37\n" | ||||
"Greys-6-247,247,247 217,217,217 189,189,189 150,150,150 99,99,99 37,37,3 | ||||
7\n" | ||||
"Greys-7-247,247,247 217,217,217 189,189,189 150,150,150 115,115,115 82,8 | ||||
2,82 37,37,37\n" | ||||
"Greys-8-255,255,255 240,240,240 217,217,217 189,189,189 150,150,150 115, | ||||
115,115 82,82,82 37,37,37\n" | ||||
"Greys-9-255,255,255 240,240,240 217,217,217 189,189,189 150,150,150 115, | ||||
115,115 82,82,82 37,37,37 0,0,0\n" | ||||
"RdGy-3-239,138,98 255,255,255 153,153,153\n" | ||||
"RdGy-4-202,0,32 244,165,130 186,186,186 64,64,64\n" | ||||
"RdGy-5-202,0,32 244,165,130 255,255,255 186,186,186 64,64,64\n" | ||||
"RdGy-6-178,24,43 239,138,98 253,219,199 224,224,224 153,153,153 77,77,77 | ||||
\n" | ||||
"RdGy-7-178,24,43 239,138,98 253,219,199 255,255,255 224,224,224 153,153, | ||||
153 77,77,77\n" | ||||
"RdGy-8-178,24,43 214,96,77 244,165,130 253,219,199 224,224,224 186,186,1 | ||||
86 135,135,135 77,77,77\n" | ||||
"RdGy-9-178,24,43 214,96,77 244,165,130 253,219,199 255,255,255 224,224,2 | ||||
24 186,186,186 135,135,135 77,77,77\n" | ||||
"RdGy-10-103,0,31 178,24,43 214,96,77 244,165,130 253,219,199 224,224,224 | ||||
186,186,186 135,135,135 77,77,77 26,26,26\n" | ||||
"RdGy-11-103,0,31 178,24,43 214,96,77 244,165,130 253,219,199 255,255,255 | ||||
224,224,224 186,186,186 135,135,135 77,77,77 26,26,26\n" | ||||
"YlOrRd-3-255,237,160 254,178,76 240,59,32\n" | ||||
"YlOrRd-4-255,255,178 254,204,92 253,141,60 227,26,28\n" | ||||
"YlOrRd-5-255,255,178 254,204,92 253,141,60 240,59,32 189,0,38\n" | ||||
"YlOrRd-6-255,255,178 254,217,118 254,178,76 253,141,60 240,59,32 189,0,3 | ||||
8\n" | ||||
"YlOrRd-7-255,255,178 254,217,118 254,178,76 253,141,60 252,78,42 227,26, | ||||
28 177,0,38\n" | ||||
"YlOrRd-8-255,255,204 255,237,160 254,217,118 254,178,76 253,141,60 252,7 | ||||
8,42 227,26,28 177,0,38\n" | ||||
"YlOrRd-9-255,255,204 255,237,160 254,217,118 254,178,76 253,141,60 252,7 | ||||
8,42 227,26,28 189,0,38 128,0,38\n" | ||||
"PuOr-3-241,163,64 247,247,247 153,142,195\n" | ||||
"PuOr-4-230,97,1 253,184,99 178,171,210 94,60,153\n" | ||||
"PuOr-5-230,97,1 253,184,99 247,247,247 178,171,210 94,60,153\n" | ||||
"PuOr-6-179,88,6 241,163,64 254,224,182 216,218,235 153,142,195 84,39,136 | ||||
\n" | ||||
"PuOr-7-179,88,6 241,163,64 254,224,182 247,247,247 216,218,235 153,142,1 | ||||
95 84,39,136\n" | ||||
"PuOr-8-179,88,6 224,130,20 253,184,99 254,224,182 216,218,235 178,171,21 | ||||
0 128,115,172 84,39,136\n" | ||||
"PuOr-9-179,88,6 224,130,20 253,184,99 254,224,182 247,247,247 216,218,23 | ||||
5 178,171,210 128,115,172 84,39,136\n" | ||||
"PuOr-10-127,59,8 179,88,6 224,130,20 253,184,99 254,224,182 216,218,235 | ||||
178,171,210 128,115,172 84,39,136 45,0,75\n" | ||||
"PuOr-11-127,59,8 179,88,6 224,130,20 253,184,99 254,224,182 247,247,247 | ||||
216,218,235 178,171,210 128,115,172 84,39,136 45,0,75\n" | ||||
"PuRd-3-231,225,239 201,148,199 221,28,119\n" | ||||
"PuRd-4-241,238,246 215,181,216 223,101,176 206,18,86\n" | ||||
"PuRd-5-241,238,246 215,181,216 223,101,176 221,28,119 152,0,67\n" | ||||
"PuRd-6-241,238,246 212,185,218 201,148,199 223,101,176 221,28,119 152,0, | ||||
67\n" | ||||
"PuRd-7-241,238,246 212,185,218 201,148,199 223,101,176 231,41,138 206,18 | ||||
,86 145,0,63\n" | ||||
"PuRd-8-247,244,249 231,225,239 212,185,218 201,148,199 223,101,176 231,4 | ||||
1,138 206,18,86 145,0,63\n" | ||||
"PuRd-9-247,244,249 231,225,239 212,185,218 201,148,199 223,101,176 231,4 | ||||
1,138 206,18,86 152,0,67 103,0,31\n" | ||||
"Blues-3-222,235,247 158,202,225 49,130,189\n" | ||||
"Blues-4-239,243,255 189,215,231 107,174,214 33,113,181\n" | ||||
"Blues-5-239,243,255 189,215,231 107,174,214 49,130,189 8,81,156\n" | ||||
"Blues-6-239,243,255 198,219,239 158,202,225 107,174,214 49,130,189 8,81, | ||||
156\n" | ||||
"Blues-7-239,243,255 198,219,239 158,202,225 107,174,214 66,146,198 33,11 | ||||
3,181 8,69,148\n" | ||||
"Blues-8-247,251,255 222,235,247 198,219,239 158,202,225 107,174,214 66,1 | ||||
46,198 33,113,181 8,69,148\n" | ||||
"Blues-9-247,251,255 222,235,247 198,219,239 158,202,225 107,174,214 66,1 | ||||
46,198 33,113,181 8,81,156 8,48,107\n" | ||||
"PuBuGn-3-236,226,240 166,189,219 28,144,153\n" | ||||
"PuBuGn-4-246,239,247 189,201,225 103,169,207 2,129,138\n" | ||||
"PuBuGn-5-246,239,247 189,201,225 103,169,207 28,144,153 1,108,89\n" | ||||
"PuBuGn-6-246,239,247 208,209,230 166,189,219 103,169,207 28,144,153 1,10 | ||||
8,89\n" | ||||
"PuBuGn-7-246,239,247 208,209,230 166,189,219 103,169,207 54,144,192 2,12 | ||||
9,138 1,100,80\n" | ||||
"PuBuGn-8-255,247,251 236,226,240 208,209,230 166,189,219 103,169,207 54, | ||||
144,192 2,129,138 1,100,80\n" | ||||
"PuBuGn-9-255,247,251 236,226,240 208,209,230 166,189,219 103,169,207 54, | ||||
144,192 2,129,138 1,108,89 1,70,54"; | ||||
#endif // QGSCOLORBREWERPALETTE_H | #endif // QGSCOLORBREWERPALETTE_H | |||
End of changes. 8 change blocks. | ||||
456 lines changed or deleted | 14 lines changed or added | |||
qgscolorbutton.h | qgscolorbutton.h | |||
---|---|---|---|---|
skipping to change at line 18 | skipping to change at line 18 | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCOLORBUTTON_H | #ifndef QGSCOLORBUTTON_H | |||
#define QGSCOLORBUTTON_H | #define QGSCOLORBUTTON_H | |||
#include <QToolButton> | #include <QColorDialog> | |||
#include <QPushButton> | #include <QPushButton> | |||
#include <QTemporaryFile> | ||||
/** \ingroup gui | /** \ingroup gui | |||
* A cross platform button subclass for selecting colors. | * \class QgsColorButton | |||
* A cross platform button subclass for selecting colors. Will open a color | ||||
chooser dialog when clicked. | ||||
* Offers live updates to button from color chooser dialog | ||||
* @note inherited base class moved from QToolButton to QPushButton in QGIS | ||||
1.9 | ||||
*/ | */ | |||
class GUI_EXPORT QgsColorButton: public QToolButton | ||||
class GUI_EXPORT QgsColorButton: public QPushButton | ||||
{ | { | |||
Q_OBJECT | ||||
public: | public: | |||
QgsColorButton( QWidget *parent = 0 ); | /** | |||
* Construct a new color button. | ||||
* | ||||
* @param parent The parent QWidget for the dialog | ||||
* @param cdt The title to show in the color chooser dialog | ||||
* @param cdo Options for the color chooser dialog | ||||
* @note changed in 1.9 | ||||
*/ | ||||
QgsColorButton( QWidget *parent = 0, QString cdt = "", QColorDialog::Co | ||||
lorDialogOptions cdo = 0 ); | ||||
~QgsColorButton(); | ~QgsColorButton(); | |||
/** | ||||
* Specify the current color. Will emit a colorChanged signal if the co | ||||
lor is different to the previous. | ||||
* | ||||
* @param color the new color | ||||
* @note added in 1.9 | ||||
*/ | ||||
void setColor( const QColor &color ); | void setColor( const QColor &color ); | |||
QColor color() const { return mColor; } | /** | |||
* Return the currently selected color. | ||||
* | ||||
* @return the currently selected color | ||||
* @note added in 1.9 | ||||
*/ | ||||
QColor color() const; | ||||
/** | ||||
* Specify the options for the color chooser dialog (e.g. alpha). | ||||
* | ||||
* @param cdo Options for the color chooser dialog | ||||
* @note added in 1.9 | ||||
*/ | ||||
void setColorDialogOptions( QColorDialog::ColorDialogOptions cdo ); | ||||
/** | ||||
* Returns the options for the color chooser dialog. | ||||
* | ||||
* @return Options for the color chooser dialog | ||||
* @note added in 1.9 | ||||
*/ | ||||
QColorDialog::ColorDialogOptions colorDialogOptions(); | ||||
/** | ||||
* Set the title, which the color chooser dialog will show. | ||||
* | ||||
* @param cdt Title for the color chooser dialog | ||||
* @note added in 1.9 | ||||
*/ | ||||
void setColorDialogTitle( QString cdt ); | ||||
/** | ||||
* Returns the title, which the color chooser dialog shows. | ||||
* | ||||
* @return Title for the color chooser dialog | ||||
* @note added in 1.9 | ||||
*/ | ||||
QString colorDialogTitle(); | ||||
/** | ||||
* Whether the button accepts live updates from QColorDialog. | ||||
* | ||||
* @note added in 1.9 | ||||
*/ | ||||
bool acceptLiveUpdates() { return mAcceptLiveUpdates; } | ||||
/** | ||||
* Sets whether the button accepts live updates from QColorDialog. | ||||
* Live updates may cause changes that are not undoable on QColorDialog | ||||
cancel. | ||||
* | ||||
* @note added in 1.9 | ||||
*/ | ||||
void setAcceptLiveUpdates( bool accept ) { mAcceptLiveUpdates = accept; | ||||
} | ||||
public slots: | ||||
/** | ||||
* Sets the background pixmap for the button based upon set color and t | ||||
ransparency. | ||||
* Call directly to update background after adding/removing QColorDialo | ||||
g::ShowAlphaChannel option | ||||
* but the color has not changed, i.e. setColor() wouldn't update butto | ||||
n and | ||||
* you want the button to retain the set color's alpha component regard | ||||
less | ||||
* | ||||
* @note added in 1.9 | ||||
*/ | ||||
void setButtonBackground(); | ||||
signals: | ||||
/** | ||||
* Is emitted, whenever a new color is accepted. The color is always va | ||||
lid. | ||||
* In case the new color is the same, no signal is emitted, to avoid in | ||||
finite loops. | ||||
* | ||||
* @param color New color | ||||
* @note added in 1.9 | ||||
*/ | ||||
void colorChanged( const QColor &color ); | ||||
protected: | protected: | |||
void paintEvent( QPaintEvent *e ); | void changeEvent( QEvent* e ); | |||
#if 0 // causes too many cyclical updates, but may be needed on some platfo | ||||
private: | rms | |||
QColor mColor; | void paintEvent( QPaintEvent* e ); | |||
}; | #endif | |||
void showEvent( QShowEvent* e ); | ||||
class GUI_EXPORT QgsColorButtonV2 : public QPushButton | static const QPixmap& transpBkgrd(); | |||
{ | ||||
public: | ||||
QgsColorButtonV2( QWidget* parent = 0 ); | ||||
QgsColorButtonV2( QString text, QWidget* parent = 0 ); | ||||
void setColor( const QColor &color ); | ||||
QColor color() const { return mColor; } | ||||
private: | private: | |||
QString mColorDialogTitle; | ||||
QColor mColor; | QColor mColor; | |||
QColorDialog::ColorDialogOptions mColorDialogOptions; | ||||
bool mAcceptLiveUpdates; | ||||
QTemporaryFile mTempPNG; | ||||
private slots: | ||||
void onButtonClicked(); | ||||
/** | ||||
* Sets color for button, if valid. | ||||
* | ||||
* @note added in 1.9 | ||||
*/ | ||||
void setValidColor( const QColor& newColor ); | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 11 change blocks. | ||||
19 lines changed or deleted | 133 lines changed or added | |||
qgscolorrampcombobox.h | qgscolorrampcombobox.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgscolorrampcombobox.h | qgscolorrampcombobox.h | |||
--------------------- | --------------------- | |||
begin : October 2010 | begin : October 2010 | |||
copyright : (C) 2010 by Martin Dobias | copyright : (C) 2010 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCOLORRAMPCOMBOBOX_H | #ifndef QGSCOLORRAMPCOMBOBOX_H | |||
#define QGSCOLORRAMPCOMBOBOX_H | #define QGSCOLORRAMPCOMBOBOX_H | |||
#include <QComboBox> | #include <QComboBox> | |||
class QgsStyleV2; | class QgsStyleV2; | |||
class QgsVectorColorRampV2; | class QgsVectorColorRampV2; | |||
class QgsColorRampComboBox : public QComboBox | class GUI_EXPORT QgsColorRampComboBox : public QComboBox | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
explicit QgsColorRampComboBox( QWidget *parent = 0 ); | explicit QgsColorRampComboBox( QWidget *parent = 0 ); | |||
~QgsColorRampComboBox(); | ~QgsColorRampComboBox(); | |||
//! initialize the combo box with color ramps from the style | //! initialize the combo box with color ramps from the style | |||
void populate( QgsStyleV2* style ); | void populate( QgsStyleV2* style ); | |||
//! add/select color ramp which was used previously by the renderer | //! add/select color ramp which was used previously by the renderer | |||
void setSourceColorRamp( QgsVectorColorRampV2* sourceRamp ); | void setSourceColorRamp( QgsVectorColorRampV2* sourceRamp ); | |||
//! return new instance of the current color ramp or NULL if there is n o active color ramp | //! return new instance of the current color ramp or NULL if there is n o active color ramp | |||
QgsVectorColorRampV2* currentColorRamp(); | QgsVectorColorRampV2* currentColorRamp(); | |||
static QSize rampIconSize; | static QSize rampIconSize; | |||
signals: | ||||
public slots: | public slots: | |||
void colorRampChanged( int index ); | void colorRampChanged( int index ); | |||
protected: | protected: | |||
QgsStyleV2* mStyle; | QgsStyleV2* mStyle; | |||
QgsVectorColorRampV2* mSourceColorRamp; // owns the copy | QgsVectorColorRampV2* mSourceColorRamp; // owns the copy | |||
}; | }; | |||
#endif // QGSCOLORRAMPCOMBOBOX_H | #endif // QGSCOLORRAMPCOMBOBOX_H | |||
End of changes. 4 change blocks. | ||||
5 lines changed or deleted | 2 lines changed or added | |||
qgscolorrampshader.h | qgscolorrampshader.h | |||
---|---|---|---|---|
skipping to change at line 68 | skipping to change at line 68 | |||
{ | { | |||
INTERPOLATED, | INTERPOLATED, | |||
DISCRETE, | DISCRETE, | |||
EXACT | EXACT | |||
}; | }; | |||
/** \brief Get the custom colormap*/ | /** \brief Get the custom colormap*/ | |||
QList<QgsColorRampShader::ColorRampItem> colorRampItemList() const {ret urn mColorRampItemList;} | QList<QgsColorRampShader::ColorRampItem> colorRampItemList() const {ret urn mColorRampItemList;} | |||
/** \brief Get the color ramp type */ | /** \brief Get the color ramp type */ | |||
QgsColorRampShader::ColorRamp_TYPE colorRampType() {return mColorRampTy pe;} | QgsColorRampShader::ColorRamp_TYPE colorRampType() const {return mColor RampType;} | |||
/** \brief Get the color ramp type as a string */ | /** \brief Get the color ramp type as a string */ | |||
QString colorRampTypeAsQString(); | QString colorRampTypeAsQString(); | |||
/** \brief Get the maximum size the color cache can be*/ | /** \brief Get the maximum size the color cache can be*/ | |||
int maximumColorCacheSize() { return mMaximumColorCacheSize; } | int maximumColorCacheSize() { return mMaximumColorCacheSize; } | |||
/** \brief Set custom colormap */ | /** \brief Set custom colormap */ | |||
void setColorRampItemList( const QList<QgsColorRampShader::ColorRampIte m>& theList ); //TODO: sort on set | void setColorRampItemList( const QList<QgsColorRampShader::ColorRampIte m>& theList ); //TODO: sort on set | |||
/** \brief Set the color ramp type*/ | /** \brief Set the color ramp type*/ | |||
void setColorRampType( QgsColorRampShader::ColorRamp_TYPE theColorRampT ype ); | void setColorRampType( QgsColorRampShader::ColorRamp_TYPE theColorRampT ype ); | |||
/** \brief Set the color ramp type*/ | /** \brief Set the color ramp type*/ | |||
void setColorRampType( QString ); | void setColorRampType( QString ); | |||
/** \brief Set the maximum size the color cache can be */ | /** \brief Set the maximum size the color cache can be */ | |||
void setMaximumColorCacheSize( int theSize ) { mMaximumColorCacheSize = theSize; } | void setMaximumColorCacheSize( int theSize ) { mMaximumColorCacheSize = theSize; } | |||
/** \brief Generates and new RGB value based on one input value */ | /** \brief Generates and new RGB value based on one input value */ | |||
bool shade( double, int*, int*, int* ); | bool shade( double, int*, int*, int*, int* ); | |||
/** \brief Generates and new RGB value based on original RGB value */ | /** \brief Generates and new RGB value based on original RGB value */ | |||
bool shade( double, double, double, int*, int*, int* ); | bool shade( double, double, double, double, int*, int*, int*, int* ); | |||
void legendSymbologyItems( QList< QPair< QString, QColor > >& symbolIte | ||||
ms ) const; | ||||
void setClip( bool clip ) { mClip = clip; } | ||||
bool clip() const { return mClip; } | ||||
private: | private: | |||
/** Current index from which to start searching the color table*/ | /** Current index from which to start searching the color table*/ | |||
int mCurrentColorRampItemIndex; | int mCurrentColorRampItemIndex; | |||
//TODO: Consider pulling this out as a separate class and internally st oring as a QMap rather than a QList | //TODO: Consider pulling this out as a separate class and internally st oring as a QMap rather than a QList | |||
/** This vector holds the information for classification based on value s. | /** This vector holds the information for classification based on value s. | |||
* Each item holds a value, a label and a color. The member | * Each item holds a value, a label and a color. The member | |||
* mDiscreteClassification holds if one color is applied for all values | * mDiscreteClassification holds if one color is applied for all values | |||
* between two class breaks (true) or if the item values are (linearly) | * between two class breaks (true) or if the item values are (linearly) | |||
skipping to change at line 119 | skipping to change at line 124 | |||
/** \brief Cache of values that have already been looked up */ | /** \brief Cache of values that have already been looked up */ | |||
QMap<double, QColor> mColorCache; | QMap<double, QColor> mColorCache; | |||
/** Maximum size of the color cache. The color cache could eat a ton of | /** Maximum size of the color cache. The color cache could eat a ton of | |||
* memory if you have 32-bit data */ | * memory if you have 32-bit data */ | |||
int mMaximumColorCacheSize; | int mMaximumColorCacheSize; | |||
/** Gets the color for a pixel value from the classification vector | /** Gets the color for a pixel value from the classification vector | |||
* mValueClassification. Assigns the color of the lower class for every | * mValueClassification. Assigns the color of the lower class for every | |||
* pixel between two class breaks.*/ | * pixel between two class breaks.*/ | |||
bool discreteColor( double, int*, int*, int* ); | bool discreteColor( double, int*, int*, int*, int* ); | |||
/** Gets the color for a pixel value from the classification vector | /** Gets the color for a pixel value from the classification vector | |||
* mValueClassification. Assigns the color of the exact matching value in | * mValueClassification. Assigns the color of the exact matching value in | |||
* the color ramp item list */ | * the color ramp item list */ | |||
bool exactColor( double, int*, int*, int* ); | bool exactColor( double, int*, int*, int*, int* ); | |||
/** Gets the color for a pixel value from the classification vector | /** Gets the color for a pixel value from the classification vector | |||
* mValueClassification. Interpolates the color between two class break s | * mValueClassification. Interpolates the color between two class break s | |||
* linearly.*/ | * linearly.*/ | |||
bool interpolatedColor( double, int*, int*, int* ); | bool interpolatedColor( double, int*, int*, int*, int* ); | |||
/** Do not render values out of range */ | ||||
bool mClip; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
6 lines changed or deleted | 15 lines changed or added | |||
qgscomposerattributetable.h | qgscomposerattributetable.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
#ifndef QGSCOMPOSERATTRIBUTETABLE_H | #ifndef QGSCOMPOSERATTRIBUTETABLE_H | |||
#define QGSCOMPOSERATTRIBUTETABLE_H | #define QGSCOMPOSERATTRIBUTETABLE_H | |||
#include "qgscomposertable.h" | #include "qgscomposertable.h" | |||
class QgsComposerMap; | class QgsComposerMap; | |||
class QgsVectorLayer; | class QgsVectorLayer; | |||
/**Helper class for sorting, takes into account sorting column and ascendin g / descending*/ | /**Helper class for sorting, takes into account sorting column and ascendin g / descending*/ | |||
class QgsComposerAttributeTableCompare | class CORE_EXPORT QgsComposerAttributeTableCompare | |||
{ | { | |||
public: | public: | |||
QgsComposerAttributeTableCompare(); | QgsComposerAttributeTableCompare(); | |||
bool operator()( const QgsAttributeMap& m1, const QgsAttributeMap& m2 ) ; | bool operator()( const QgsAttributeMap& m1, const QgsAttributeMap& m2 ) ; | |||
void setSortColumn( int col ) { mCurrentSortColumn = col; } | void setSortColumn( int col ) { mCurrentSortColumn = col; } | |||
void setAscending( bool asc ) { mAscending = asc; } | void setAscending( bool asc ) { mAscending = asc; } | |||
private: | private: | |||
int mCurrentSortColumn; | int mCurrentSortColumn; | |||
bool mAscending; | bool mAscending; | |||
}; | }; | |||
skipping to change at line 56 | skipping to change at line 56 | |||
/** return correct graphics item type. Added in v1.7 */ | /** return correct graphics item type. Added in v1.7 */ | |||
virtual int type() const { return ComposerAttributeTable; } | virtual int type() const { return ComposerAttributeTable; } | |||
/** \brief Reimplementation of QCanvasItem::paint*/ | /** \brief Reimplementation of QCanvasItem::paint*/ | |||
virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget ); | virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget ); | |||
bool writeXML( QDomElement& elem, QDomDocument & doc ) const; | bool writeXML( QDomElement& elem, QDomDocument & doc ) const; | |||
bool readXML( const QDomElement& itemElem, const QDomDocument& doc ); | bool readXML( const QDomElement& itemElem, const QDomDocument& doc ); | |||
void setVectorLayer( QgsVectorLayer* vl );// { mVectorLayer = vl; } | void setVectorLayer( QgsVectorLayer* vl ); | |||
const QgsVectorLayer* vectorLayer() const { return mVectorLayer; } | const QgsVectorLayer* vectorLayer() const { return mVectorLayer; } | |||
void setComposerMap( const QgsComposerMap* map ); | void setComposerMap( const QgsComposerMap* map ); | |||
const QgsComposerMap* composerMap() const { return mComposerMap; } | const QgsComposerMap* composerMap() const { return mComposerMap; } | |||
void setMaximumNumberOfFeatures( int nr ) { mMaximumNumberOfFeatures = nr; } | void setMaximumNumberOfFeatures( int nr ) { mMaximumNumberOfFeatures = nr; } | |||
int maximumNumberOfFeatures() const { return mMaximumNumberOfFeatures; } | int maximumNumberOfFeatures() const { return mMaximumNumberOfFeatures; } | |||
void setDisplayOnlyVisibleFeatures( bool b ) { mShowOnlyVisibleFeatures = b; } | void setDisplayOnlyVisibleFeatures( bool b ) { mShowOnlyVisibleFeatures = b; } | |||
bool displayOnlyVisibleFeatures() const { return mShowOnlyVisibleFeatur es; } | bool displayOnlyVisibleFeatures() const { return mShowOnlyVisibleFeatur es; } | |||
QSet<int> displayAttributes() const { return mDisplayAttributes; } | QSet<int> displayAttributes() const { return mDisplayAttributes; } | |||
void setDisplayAttributes( const QSet<int>& attr ) { mDisplayAttributes = attr;} | void setDisplayAttributes( const QSet<int>& attr ) { mDisplayAttributes = attr; } | |||
QMap<int, QString> fieldAliasMap() const { return mFieldAliasMap; } | QMap<int, QString> fieldAliasMap() const { return mFieldAliasMap; } | |||
void setFieldAliasMap( const QMap<int, QString>& map ) { mFieldAliasMap = map; } | void setFieldAliasMap( const QMap<int, QString>& map ) { mFieldAliasMap = map; } | |||
/**Adapts mMaximumNumberOfFeatures depending on the rectangle height*/ | /**Adapts mMaximumNumberOfFeatures depending on the rectangle height*/ | |||
void setSceneRect( const QRectF& rectangle ); | void setSceneRect( const QRectF& rectangle ); | |||
// @note not available in python bindings | ||||
void setSortAttributes( const QList<QPair<int, bool> > att ) { mSortInf ormation = att; } | void setSortAttributes( const QList<QPair<int, bool> > att ) { mSortInf ormation = att; } | |||
// @note not available in python bindings | ||||
QList<QPair<int, bool> > sortAttributes() const { return mSortInformati on; } | QList<QPair<int, bool> > sortAttributes() const { return mSortInformati on; } | |||
protected: | protected: | |||
/**Retrieves feature attributes*/ | /**Retrieves feature attributes | |||
bool getFeatureAttributes( QList<QgsAttributeMap>& attributes ); | * @note not available in python bindings | |||
*/ | ||||
bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps ); | ||||
//! @note not available in python bindings | ||||
QMap<int, QString> getHeaderLabels() const; | QMap<int, QString> getHeaderLabels() const; | |||
private: | private: | |||
/**Associated vector layer*/ | /**Associated vector layer*/ | |||
QgsVectorLayer* mVectorLayer; | QgsVectorLayer* mVectorLayer; | |||
/**Associated composer map (used to display the visible features)*/ | /**Associated composer map (used to display the visible features)*/ | |||
const QgsComposerMap* mComposerMap; | const QgsComposerMap* mComposerMap; | |||
/**Maximum number of features that is displayed*/ | /**Maximum number of features that is displayed*/ | |||
int mMaximumNumberOfFeatures; | int mMaximumNumberOfFeatures; | |||
skipping to change at line 115 | skipping to change at line 122 | |||
void initializeAliasMap(); | void initializeAliasMap(); | |||
/**Returns the attribute name to display in the item (attribute name or an alias if present)*/ | /**Returns the attribute name to display in the item (attribute name or an alias if present)*/ | |||
QString attributeDisplayName( int attributeIndex, const QString& name ) const; | QString attributeDisplayName( int attributeIndex, const QString& name ) const; | |||
private slots: | private slots: | |||
/**Checks if this vector layer will be removed (and sets mVectorLayer t o 0 if yes) */ | /**Checks if this vector layer will be removed (and sets mVectorLayer t o 0 if yes) */ | |||
void removeLayer( QString layerId ); | void removeLayer( QString layerId ); | |||
signals: | signals: | |||
/**This signal is emitted if the maximum number of feature changes (int eractively)*/ | /**This signal is emitted if the maximum number of feature changes (int eractively)*/ | |||
void maximumNumerOfFeaturesChanged( int n ); | void maximumNumberOfFeaturesChanged( int n ); | |||
}; | }; | |||
#endif // QGSCOMPOSERATTRIBUTETABLE_H | #endif // QGSCOMPOSERATTRIBUTETABLE_H | |||
End of changes. 7 change blocks. | ||||
6 lines changed or deleted | 13 lines changed or added | |||
qgscomposeritem.h | qgscomposeritem.h | |||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCOMPOSERITEM_H | #ifndef QGSCOMPOSERITEM_H | |||
#define QGSCOMPOSERITEM_H | #define QGSCOMPOSERITEM_H | |||
#include "qgscomposition.h" | #include "qgscomposeritemcommand.h" | |||
#include "qgscomposereffect.h" | ||||
#include "qgsmaprenderer.h" // for blend mode functions & enums | ||||
#include <QGraphicsRectItem> | #include <QGraphicsRectItem> | |||
#include <QObject> | #include <QObject> | |||
class QgsComposition; | ||||
class QWidget; | class QWidget; | |||
class QDomDocument; | class QDomDocument; | |||
class QDomElement; | class QDomElement; | |||
class QGraphicsLineItem; | ||||
class QqsComposition; | class QgsComposerItemGroup; | |||
/** \ingroup MapComposer | /** \ingroup MapComposer | |||
* A item that forms part of a map composition. | * A item that forms part of a map composition. | |||
*/ | */ | |||
class CORE_EXPORT QgsComposerItem: public QObject, public QGraphicsRectItem | class CORE_EXPORT QgsComposerItem: public QObject, public QGraphicsRectItem | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
enum ItemType | enum ItemType | |||
skipping to change at line 55 | skipping to change at line 58 | |||
ComposerItemGroup, | ComposerItemGroup, | |||
ComposerLabel, | ComposerLabel, | |||
ComposerLegend, | ComposerLegend, | |||
ComposerMap, | ComposerMap, | |||
ComposerPaper, // QgsPaperItem | ComposerPaper, // QgsPaperItem | |||
ComposerPicture, | ComposerPicture, | |||
ComposerScaleBar, | ComposerScaleBar, | |||
ComposerShape, | ComposerShape, | |||
ComposerTable, | ComposerTable, | |||
ComposerAttributeTable, | ComposerAttributeTable, | |||
ComposerTextTable | ComposerTextTable, | |||
ComposerFrame | ||||
}; | }; | |||
/**Describes the action (move or resize in different directon) to be do ne during mouse move*/ | /**Describes the action (move or resize in different directon) to be do ne during mouse move*/ | |||
enum MouseMoveAction | enum MouseMoveAction | |||
{ | { | |||
MoveItem, | MoveItem, | |||
ResizeUp, | ResizeUp, | |||
ResizeDown, | ResizeDown, | |||
ResizeLeft, | ResizeLeft, | |||
ResizeRight, | ResizeRight, | |||
skipping to change at line 107 | skipping to change at line 111 | |||
QgsComposerItem( qreal x, qreal y, qreal width, qreal height, QgsCompos ition* composition, bool manageZValue = true ); | QgsComposerItem( qreal x, qreal y, qreal width, qreal height, QgsCompos ition* composition, bool manageZValue = true ); | |||
virtual ~QgsComposerItem(); | virtual ~QgsComposerItem(); | |||
/** return correct graphics item type. Added in v1.7 */ | /** return correct graphics item type. Added in v1.7 */ | |||
virtual int type() const { return ComposerItem; } | virtual int type() const { return ComposerItem; } | |||
/** \brief Set selected, selected item should be highlighted */ | /** \brief Set selected, selected item should be highlighted */ | |||
virtual void setSelected( bool s ); | virtual void setSelected( bool s ); | |||
/** \brief Is selected */ | /** \brief Is selected */ | |||
virtual bool selected( void ) {return QGraphicsRectItem::isSelected();} | virtual bool selected() {return QGraphicsRectItem::isSelected();} | |||
/** stores state in project */ | /** stores state in project */ | |||
virtual bool writeSettings( void ); | virtual bool writeSettings(); | |||
/** read state from project */ | /** read state from project */ | |||
virtual bool readSettings( void ); | virtual bool readSettings(); | |||
/** delete settings from project file */ | /** delete settings from project file */ | |||
virtual bool removeSettings( void ); | virtual bool removeSettings(); | |||
/**Moves item in canvas coordinates*/ | /**Moves item in canvas coordinates*/ | |||
void move( double dx, double dy ); | void move( double dx, double dy ); | |||
/**Move Content of item. Does nothing per default (but implemented in c omposer map) | /**Move Content of item. Does nothing per default (but implemented in c omposer map) | |||
@param dx move in x-direction (canvas coordinates) | @param dx move in x-direction (canvas coordinates) | |||
@param dy move in y-direction(canvas coordinates)*/ | @param dy move in y-direction(canvas coordinates)*/ | |||
virtual void moveContent( double dx, double dy ) { Q_UNUSED( dx ); Q_UN USED( dy ); } | virtual void moveContent( double dx, double dy ) { Q_UNUSED( dx ); Q_UN USED( dy ); } | |||
/**Zoom content of item. Does nothing per default (but implemented in c omposer map) | /**Zoom content of item. Does nothing per default (but implemented in c omposer map) | |||
skipping to change at line 139 | skipping to change at line 143 | |||
@param y y-position of mouse cursor (in item coordinates)*/ | @param y y-position of mouse cursor (in item coordinates)*/ | |||
virtual void zoomContent( int delta, double x, double y ) { Q_UNUSED( d elta ); Q_UNUSED( x ); Q_UNUSED( y ); } | virtual void zoomContent( int delta, double x, double y ) { Q_UNUSED( d elta ); Q_UNUSED( x ); Q_UNUSED( y ); } | |||
/**Moves the item to a new position (in canvas coordinates)*/ | /**Moves the item to a new position (in canvas coordinates)*/ | |||
void setItemPosition( double x, double y, ItemPositionMode itemPoint = UpperLeft ); | void setItemPosition( double x, double y, ItemPositionMode itemPoint = UpperLeft ); | |||
/**Sets item position and width / height in one go | /**Sets item position and width / height in one go | |||
@note: this method was added in version 1.6*/ | @note: this method was added in version 1.6*/ | |||
void setItemPosition( double x, double y, double width, double height, ItemPositionMode itemPoint = UpperLeft ); | void setItemPosition( double x, double y, double width, double height, ItemPositionMode itemPoint = UpperLeft ); | |||
/**Returns item's last used position mode. | ||||
@note: This property has no effect on actual's item position, which i | ||||
s always the top-left corner. | ||||
@note: this method was added in version 2.0*/ | ||||
ItemPositionMode lastUsedPositionMode() { return mLastUsedPositionMode; | ||||
} | ||||
/**Sets this items bound in scene coordinates such that 1 item size uni ts | /**Sets this items bound in scene coordinates such that 1 item size uni ts | |||
corresponds to 1 scene size unit*/ | corresponds to 1 scene size unit*/ | |||
virtual void setSceneRect( const QRectF& rectangle ); | virtual void setSceneRect( const QRectF& rectangle ); | |||
/** stores state in Dom element | /** stores state in Dom element | |||
* @param elem is Dom element corresponding to 'Composer' tag | * @param elem is Dom element corresponding to 'Composer' tag | |||
* @param doc is the Dom document | * @param doc is the Dom document | |||
*/ | */ | |||
virtual bool writeXML( QDomElement& elem, QDomDocument & doc ) const = 0; | virtual bool writeXML( QDomElement& elem, QDomDocument & doc ) const = 0; | |||
skipping to change at line 162 | skipping to change at line 171 | |||
/** sets state from Dom document | /** sets state from Dom document | |||
* @param itemElem is Dom node corresponding to item tag | * @param itemElem is Dom node corresponding to item tag | |||
* @param doc is Dom document | * @param doc is Dom document | |||
*/ | */ | |||
virtual bool readXML( const QDomElement& itemElem, const QDomDocument& doc ) = 0; | virtual bool readXML( const QDomElement& itemElem, const QDomDocument& doc ) = 0; | |||
/**Reads parameter that are not subclass specific in document. Usually called from readXML methods of subclasses*/ | /**Reads parameter that are not subclass specific in document. Usually called from readXML methods of subclasses*/ | |||
bool _readXML( const QDomElement& itemElem, const QDomDocument& doc ); | bool _readXML( const QDomElement& itemElem, const QDomDocument& doc ); | |||
/** Whether this item has a frame or not. | /** Whether this item has a frame or not. | |||
* @return boolean - true if there is a frame around this item, otherwi | ||||
se false. | ||||
* @note deprecated since 1.8 don't use! | ||||
* @see hasFrame | ||||
*/ | ||||
Q_DECL_DEPRECATED bool frame() const {return hasFrame();} | ||||
/** Whether this item has a frame or not. | ||||
* @returns true if there is a frame around this item, otherwise false. | * @returns true if there is a frame around this item, otherwise false. | |||
* @note introduced since 1.8 | * @note introduced since 1.8 | |||
* @see hasFrame | ||||
*/ | */ | |||
bool hasFrame() const {return mFrame;} | bool hasFrame() const {return mFrame;} | |||
/** Set whether this item has a frame drawn around it or not. | ||||
* @returns void | ||||
* @note deprecated since 1.8 don't use! | ||||
* @see setFrameEnabled | ||||
*/ | ||||
Q_DECL_DEPRECATED void setFrame( bool drawFrame ) { setFrameEnabled( dr | ||||
awFrame );} | ||||
/** Set whether this item has a frame drawn around it or not. | /** Set whether this item has a frame drawn around it or not. | |||
* @param drawFrame draw frame | * @param drawFrame draw frame | |||
* @returns nothing | * @returns nothing | |||
* @note introduced in 1.8 | * @note introduced in 1.8 | |||
* @see hasFrame | * @see hasFrame | |||
*/ | */ | |||
void setFrameEnabled( bool drawFrame ) {mFrame = drawFrame;} | void setFrameEnabled( bool drawFrame ) {mFrame = drawFrame;} | |||
/** Whether this item has a Background or not. | ||||
* @returns true if there is a Background around this item, otherwise f | ||||
alse. | ||||
* @note introduced since 2.0 | ||||
* @see hasBackground | ||||
*/ | ||||
bool hasBackground() const {return mBackground;} | ||||
/** Set whether this item has a Background drawn around it or not. | ||||
* @param drawBackground draw Background | ||||
* @returns nothing | ||||
* @note introduced in 2.0 | ||||
* @see hasBackground | ||||
*/ | ||||
void setBackgroundEnabled( bool drawBackground ) {mBackground = drawBac | ||||
kground;} | ||||
/** Gets the background color for this item | ||||
* @returns background color | ||||
* @note introduced in 2.0 | ||||
*/ | ||||
QColor backgroundColor() const { return mBackgroundColor; } | ||||
/** Sets the background color for this item | ||||
* @param backgroundColor new background color | ||||
* @returns nothing | ||||
* @note introduced in 2.0 | ||||
*/ | ||||
void setBackgroundColor( const QColor& backgroundColor ); | ||||
/** Returns the item's composition blending mode */ | ||||
QPainter::CompositionMode blendMode() const {return mBlendMode;} | ||||
/** Sets the item's composition blending mode*/ | ||||
void setBlendMode( QPainter::CompositionMode blendMode ); | ||||
/** Returns the item's transparency */ | ||||
int transparency() const {return mTransparency;} | ||||
/** Sets the item's transparency */ | ||||
void setTransparency( int transparency ); | ||||
/** Returns true if effects (eg blend modes) are enabled for the item | ||||
* @note introduced in 2.0 | ||||
*/ | ||||
bool effectsEnabled() const {return mEffectsEnabled;} | ||||
/** Sets whether effects (eg blend modes) are enabled for the item | ||||
* @note introduced in 2.0 | ||||
*/ | ||||
void setEffectsEnabled( bool effectsEnabled ); | ||||
/**Composite operations for item groups do nothing per default*/ | /**Composite operations for item groups do nothing per default*/ | |||
virtual void addItem( QgsComposerItem* item ) { Q_UNUSED( item ); } | virtual void addItem( QgsComposerItem* item ) { Q_UNUSED( item ); } | |||
virtual void removeItems() {} | virtual void removeItems() {} | |||
const QgsComposition* composition() const {return mComposition;} | const QgsComposition* composition() const {return mComposition;} | |||
QgsComposition* composition() {return mComposition;} | ||||
virtual void beginItemCommand( const QString& text ) { beginCommand( te | ||||
xt ); } | ||||
/**Starts new composer undo command | /**Starts new composer undo command | |||
@param commandText command title | @param commandText command title | |||
@param c context for mergeable commands (unknown for non-mergeable co mmands*/ | @param c context for mergeable commands (unknown for non-mergeable co mmands*/ | |||
void beginCommand( const QString& commandText, QgsComposerMergeCommand: :Context c = QgsComposerMergeCommand::Unknown ); | void beginCommand( const QString& commandText, QgsComposerMergeCommand: :Context c = QgsComposerMergeCommand::Unknown ); | |||
virtual void endItemCommand() { endCommand(); } | ||||
/**Finish current command and push it onto the undo stack */ | /**Finish current command and push it onto the undo stack */ | |||
void endCommand(); | void endCommand(); | |||
void cancelCommand(); | void cancelCommand(); | |||
//functions that encapsulate the workaround for the Qt font bug (that i s to scale the font size up and then scale the | //functions that encapsulate the workaround for the Qt font bug (that i s to scale the font size up and then scale the | |||
//painter down by the same factor for drawing | //painter down by the same factor for drawing | |||
/**Draws Text. Takes care about all the composer specific issues (calcu lation to pixel, scaling of font and painter | /**Draws Text. Takes care about all the composer specific issues (calcu lation to pixel, scaling of font and painter | |||
to work around the Qt font bug)*/ | to work around the Qt font bug)*/ | |||
void drawText( QPainter* p, double x, double y, const QString& text, co nst QFont& font ) const; | void drawText( QPainter* p, double x, double y, const QString& text, co nst QFont& font ) const; | |||
/**Like the above, but with a rectangle for multiline text*/ | /**Like the above, but with a rectangle for multiline text*/ | |||
void drawText( QPainter* p, const QRectF& rect, const QString& text, co nst QFont& font, Qt::AlignmentFlag halignement = Qt::AlignLeft, Qt::Alignme ntFlag valignement = Qt::AlignTop ) const; | void drawText( QPainter* p, const QRectF& rect, const QString& text, co nst QFont& font, Qt::AlignmentFlag halignment = Qt::AlignLeft, Qt::Alignmen tFlag valignment = Qt::AlignTop ) const; | |||
/**Returns the font width in millimeters (considers upscaling and downs caling with FONT_WORKAROUND_SCALE*/ | /**Returns the font width in millimeters (considers upscaling and downs caling with FONT_WORKAROUND_SCALE*/ | |||
double textWidthMillimeters( const QFont& font, const QString& text ) c onst; | double textWidthMillimeters( const QFont& font, const QString& text ) c onst; | |||
/**Returns the font height of a character in millimeters | /**Returns the font height of a character in millimeters | |||
@note this method was added in version 1.7*/ | @note this method was added in version 1.7*/ | |||
double fontHeightCharacterMM( const QFont& font, const QChar& c ) const ; | double fontHeightCharacterMM( const QFont& font, const QChar& c ) const ; | |||
/**Returns the font ascent in Millimeters (considers upscaling and down scaling with FONT_WORKAROUND_SCALE*/ | /**Returns the font ascent in Millimeters (considers upscaling and down scaling with FONT_WORKAROUND_SCALE*/ | |||
double fontAscentMillimeters( const QFont& font ) const; | double fontAscentMillimeters( const QFont& font ) const; | |||
/**Returns the font ascent in Millimeters (considers upscaling and down | ||||
scaling with FONT_WORKAROUND_SCALE*/ | ||||
double fontDescentMillimeters( const QFont& font ) const; | ||||
/**Calculates font to from point size to pixel size*/ | /**Calculates font to from point size to pixel size*/ | |||
double pixelFontSize( double pointSize ) const; | double pixelFontSize( double pointSize ) const; | |||
/**Returns a font where size is in pixel and font size is upscaled with FONT_WORKAROUND_SCALE*/ | /**Returns a font where size is in pixel and font size is upscaled with FONT_WORKAROUND_SCALE*/ | |||
QFont scaledFontPixelSize( const QFont& font ) const; | QFont scaledFontPixelSize( const QFont& font ) const; | |||
/**Locks / unlocks the item position for mouse drags | /**Locks / unlocks the item position for mouse drags | |||
@note this method was added in version 1.2*/ | @note this method was added in version 1.2*/ | |||
void setPositionLock( bool lock ) {mItemPositionLocked = lock;} | void setPositionLock( bool lock ) {mItemPositionLocked = lock;} | |||
skipping to change at line 243 | skipping to change at line 298 | |||
/**Update mouse cursor at (item) position | /**Update mouse cursor at (item) position | |||
@note this method was added in version 1.2*/ | @note this method was added in version 1.2*/ | |||
void updateCursor( const QPointF& itemPos ); | void updateCursor( const QPointF& itemPos ); | |||
double rotation() const {return mRotation;} | double rotation() const {return mRotation;} | |||
/**Updates item, with the possibility to do custom update for subclasse s*/ | /**Updates item, with the possibility to do custom update for subclasse s*/ | |||
virtual void updateItem() { QGraphicsRectItem::update(); } | virtual void updateItem() { QGraphicsRectItem::update(); } | |||
/**Get item identification name | /**Get item's id (which is not necessarly unique) | |||
@note this method was added in version 1.7*/ | @note this method was added in version 1.7*/ | |||
QString id() const { return mId; } | QString id() const { return mId; } | |||
/**Set item identification name | /**Set item's id (which is not necessarly unique) | |||
@note this method was added in version 1.7 | @note this method was added in version 1.7*/ | |||
This method was moved from qgscomposerlabel so that ev | virtual void setId( const QString& id ); | |||
ery object can have a | ||||
id (NathanW)*/ | /**Get item identification name | |||
void setId( const QString& id ) { mId = id; } | @note this method was added in version 2.0 | |||
@note there is not setter since one can't manually set the id*/ | ||||
QString uuid() const { return mUuid; } | ||||
public slots: | public slots: | |||
virtual void setRotation( double r ); | virtual void setRotation( double r ); | |||
void repaint(); | void repaint(); | |||
protected: | protected: | |||
QgsComposition* mComposition; | QgsComposition* mComposition; | |||
QgsComposerItem::MouseMoveAction mCurrentMouseMoveAction; | QgsComposerItem::MouseMoveAction mCurrentMouseMoveAction; | |||
/**Start point of the last mouse move action (in scene coordinates)*/ | /**Start point of the last mouse move action (in scene coordinates)*/ | |||
QPointF mMouseMoveStartPos; | QPointF mMouseMoveStartPos; | |||
/**Position of the last mouse move event (in scene coordinates)*/ | /**Position of the last mouse move event (in scene coordinates)*/ | |||
QPointF mLastMouseEventPos; | QPointF mLastMouseEventPos; | |||
/**Rectangle used during move and resize actions*/ | /**Rectangle used during move and resize actions*/ | |||
QGraphicsRectItem* mBoundingResizeRectangle; | QGraphicsRectItem* mBoundingResizeRectangle; | |||
QGraphicsLineItem* mHAlignSnapItem; | ||||
QGraphicsLineItem* mVAlignSnapItem; | ||||
/**True if item fram needs to be painted*/ | /**True if item fram needs to be painted*/ | |||
bool mFrame; | bool mFrame; | |||
/**True if item background needs to be painted*/ | ||||
bool mBackground; | ||||
/**Background color*/ | ||||
QColor mBackgroundColor; | ||||
/**True if item position and size cannot be changed with mouse move | /**True if item position and size cannot be changed with mouse move | |||
@note: this member was added in version 1.2*/ | @note: this member was added in version 1.2*/ | |||
bool mItemPositionLocked; | bool mItemPositionLocked; | |||
/**Backup to restore item appearance if no view scale factor is availab le*/ | /**Backup to restore item appearance if no view scale factor is availab le*/ | |||
mutable double mLastValidViewScaleFactor; | mutable double mLastValidViewScaleFactor; | |||
/**Item rotation in degrees, clockwise*/ | /**Item rotation in degrees, clockwise*/ | |||
double mRotation; | double mRotation; | |||
/**Composition blend mode for item*/ | ||||
QPainter::CompositionMode mBlendMode; | ||||
bool mEffectsEnabled; | ||||
QgsComposerEffect *mEffect; | ||||
/**Item transparency*/ | ||||
int mTransparency; | ||||
/**The item's position mode | ||||
@note: this member was added in version 2.0*/ | ||||
ItemPositionMode mLastUsedPositionMode; | ||||
//event handlers | //event handlers | |||
virtual void mouseMoveEvent( QGraphicsSceneMouseEvent * event ); | virtual void mouseMoveEvent( QGraphicsSceneMouseEvent * event ); | |||
virtual void mousePressEvent( QGraphicsSceneMouseEvent * event ); | virtual void mousePressEvent( QGraphicsSceneMouseEvent * event ); | |||
virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent * event ); | virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent * event ); | |||
virtual void hoverMoveEvent( QGraphicsSceneHoverEvent * event ); | virtual void hoverMoveEvent( QGraphicsSceneHoverEvent * event ); | |||
/**Finds out the appropriate cursor for the current mouse position in t he widget (e.g. move in the middle, resize at border)*/ | /**Finds out the appropriate cursor for the current mouse position in t he widget (e.g. move in the middle, resize at border)*/ | |||
Qt::CursorShape cursorForPosition( const QPointF& itemCoordPos ); | Qt::CursorShape cursorForPosition( const QPointF& itemCoordPos ); | |||
skipping to change at line 349 | skipping to change at line 425 | |||
bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double wi dth, double height ) const; | bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double wi dth, double height ) const; | |||
/**Calculates width / height of the bounding box of a rotated rectangle (mRotation)*/ | /**Calculates width / height of the bounding box of a rotated rectangle (mRotation)*/ | |||
void sizeChangedByRotation( double& width, double& height ); | void sizeChangedByRotation( double& width, double& height ); | |||
/**Rotates a point / vector | /**Rotates a point / vector | |||
@param angle rotation angle in degrees, counterclockwise | @param angle rotation angle in degrees, counterclockwise | |||
@param x in/out: x coordinate before / after the rotation | @param x in/out: x coordinate before / after the rotation | |||
@param y in/out: y cooreinate before / after the rotation*/ | @param y in/out: y cooreinate before / after the rotation*/ | |||
void rotate( double angle, double& x, double& y ) const; | void rotate( double angle, double& x, double& y ) const; | |||
/**Return horizontal align snap item. Creates a new graphics line if 0* | ||||
/ | ||||
QGraphicsLineItem* hAlignSnapItem(); | ||||
void deleteHAlignSnapItem(); | ||||
/**Return vertical align snap item. Creates a new graphics line if 0*/ | ||||
QGraphicsLineItem* vAlignSnapItem(); | ||||
void deleteVAlignSnapItem(); | ||||
void deleteAlignItems(); | ||||
signals: | signals: | |||
/**Is emitted on rotation change to notify north arrow pictures*/ | /**Is emitted on rotation change to notify north arrow pictures*/ | |||
void rotationChanged( double newRotation ); | void rotationChanged( double newRotation ); | |||
/**Used e.g. by the item widgets to update the gui elements*/ | /**Used e.g. by the item widgets to update the gui elements*/ | |||
void itemChanged(); | void itemChanged(); | |||
/**Emitted if the rectangle changes*/ | ||||
void sizeChanged(); | ||||
private: | private: | |||
// Label id (unique within the same composition) | // id (not unique) | |||
QString mId; | QString mId; | |||
// name (unique) | ||||
QString mUuid; | ||||
// name (temporary when loaded from template) | ||||
QString mTemplateUuid; | ||||
void init( bool manageZValue ); | void init( bool manageZValue ); | |||
friend class QgsComposerItemGroup; // to access mTemplateUuid | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 27 change blocks. | ||||
31 lines changed or deleted | 127 lines changed or added | |||
qgscomposeritemgroup.h | qgscomposeritemgroup.h | |||
---|---|---|---|---|
skipping to change at line 44 | skipping to change at line 44 | |||
/**Adds an item to the group. All the group members are deleted | /**Adds an item to the group. All the group members are deleted | |||
if the group is deleted*/ | if the group is deleted*/ | |||
void addItem( QgsComposerItem* item ); | void addItem( QgsComposerItem* item ); | |||
/**Removes the items but does not delete them*/ | /**Removes the items but does not delete them*/ | |||
void removeItems(); | void removeItems(); | |||
/**Draw outline and ev. selection handles*/ | /**Draw outline and ev. selection handles*/ | |||
void paint( QPainter * painter, const QStyleOptionGraphicsItem * option , QWidget * widget = 0 ); | void paint( QPainter * painter, const QStyleOptionGraphicsItem * option , QWidget * widget = 0 ); | |||
/**Sets this items bound in scene coordinates such that 1 item size uni ts | /**Sets this items bound in scene coordinates such that 1 item size uni ts | |||
corresponds to 1 scene size unit*/ | corresponds to 1 scene size unit*/ | |||
void setSceneRect( const QRectF& rectangle ); | void setSceneRect( const QRectF& rectangle ); | |||
/** resizes an item in x- and y direction (scene coordinates)*/ | ||||
void resize( double dx, double dy ); | ||||
/** stores state in Dom node | /** stores state in Dom node | |||
* @param elem is Dom element corresponding to 'Composer' tag | * @param elem is Dom element corresponding to 'Composer' tag | |||
* @param doc is the Dom document | * @param doc is the Dom document | |||
*/ | */ | |||
bool writeXML( QDomElement& elem, QDomDocument & doc ) const | bool writeXML( QDomElement& elem, QDomDocument & doc ) const; | |||
{ Q_UNUSED( elem ); Q_UNUSED( doc ); return true; } | ||||
/** sets state from Dom document | /** sets state from Dom document | |||
* @param itemElem is Dom node corresponding to item tag | * @param itemElem is Dom node corresponding to item tag | |||
* @param doc is the Dom document | * @param doc is the Dom document | |||
*/ | */ | |||
bool readXML( const QDomElement& itemElem, const QDomDocument& doc ) | bool readXML( const QDomElement& itemElem, const QDomDocument& doc ); | |||
{ Q_UNUSED( itemElem ); Q_UNUSED( doc ); return true; } | ||||
QSet<QgsComposerItem*> items() { return mItems; } | QSet<QgsComposerItem*> items() { return mItems; } | |||
signals: | signals: | |||
void childItemDeleted( QgsComposerItem* item ); | void childItemDeleted( QgsComposerItem* item ); | |||
public slots: | ||||
void itemDestroyed(); | ||||
protected: | protected: | |||
void drawFrame( QPainter* p ); | void drawFrame( QPainter* p ); | |||
private: | private: | |||
QSet<QgsComposerItem*> mItems; | QSet<QgsComposerItem*> mItems; | |||
QRectF mSceneBoundingRectangle; | QRectF mSceneBoundingRectangle; | |||
}; | }; | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 5 lines changed or added | |||
qgscomposerlegend.h | qgscomposerlegend.h | |||
---|---|---|---|---|
skipping to change at line 21 | skipping to change at line 21 | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCOMPOSERLEGEND_H | #ifndef QGSCOMPOSERLEGEND_H | |||
#define QGSCOMPOSERLEGEND_H | #define QGSCOMPOSERLEGEND_H | |||
#include "qgscomposerlegendstyle.h" | ||||
#include "qgscomposeritem.h" | #include "qgscomposeritem.h" | |||
#include "qgscomposerlegenditem.h" | ||||
#include "qgslegendmodel.h" | #include "qgslegendmodel.h" | |||
class QgsSymbol; | ||||
class QgsSymbolV2; | class QgsSymbolV2; | |||
class QgsComposerGroupItem; | class QgsComposerGroupItem; | |||
class QgsComposerLayerItem; | class QgsComposerLayerItem; | |||
class QgsComposerMap; | class QgsComposerMap; | |||
/** \ingroup MapComposer | /** \ingroup MapComposer | |||
* A legend that can be placed onto a map composition | * A legend that can be placed onto a map composition | |||
*/ | */ | |||
class CORE_EXPORT QgsComposerLegend: public QgsComposerItem | class CORE_EXPORT QgsComposerLegend : public QgsComposerItem | |||
{ | { | |||
Q_OBJECT | Q_OBJECT; | |||
public: | public: | |||
QgsComposerLegend( QgsComposition* composition ); | QgsComposerLegend( QgsComposition* composition ); | |||
~QgsComposerLegend(); | ~QgsComposerLegend(); | |||
/** return correct graphics item type. Added in v1.7 */ | /** return correct graphics item type. Added in v1.7 */ | |||
virtual int type() const { return ComposerLegend; } | virtual int type() const { return ComposerLegend; } | |||
/** \brief Reimplementation of QCanvasItem::paint*/ | /** \brief Reimplementation of QCanvasItem::paint*/ | |||
void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyl e, QWidget* pWidget ); | void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyl e, QWidget* pWidget ); | |||
skipping to change at line 60 | skipping to change at line 61 | |||
/**Sets item box to the whole content*/ | /**Sets item box to the whole content*/ | |||
void adjustBoxSize(); | void adjustBoxSize(); | |||
/**Returns pointer to the legend model*/ | /**Returns pointer to the legend model*/ | |||
QgsLegendModel* model() {return &mLegendModel;} | QgsLegendModel* model() {return &mLegendModel;} | |||
//setters and getters | //setters and getters | |||
void setTitle( const QString& t ) {mTitle = t;} | void setTitle( const QString& t ) {mTitle = t;} | |||
QString title() const {return mTitle;} | QString title() const {return mTitle;} | |||
QFont titleFont() const; | /** Returns reference to modifiable style */ | |||
void setTitleFont( const QFont& f ); | QgsComposerLegendStyle & rstyle( QgsComposerLegendStyle::Style s ) { re | |||
turn mStyleMap[s]; } | ||||
QFont groupFont() const; | /** Returns style */ | |||
void setGroupFont( const QFont& f ); | QgsComposerLegendStyle style( QgsComposerLegendStyle::Style s ) const { | |||
return mStyleMap.value( s ); } | ||||
QFont layerFont() const; | void setStyle( QgsComposerLegendStyle::Style s, const QgsComposerLegend | |||
void setLayerFont( const QFont& f ); | Style style ) { mStyleMap[s] = style; } | |||
QFont itemFont() const; | QFont styleFont( QgsComposerLegendStyle::Style s ) const { return style | |||
void setItemFont( const QFont& f ); | ( s ).font(); } | |||
/** Set style font */ | ||||
void setStyleFont( QgsComposerLegendStyle::Style s, const QFont& f ); | ||||
/** Set style margin*/ | ||||
void setStyleMargin( QgsComposerLegendStyle::Style s, double margin ); | ||||
void setStyleMargin( QgsComposerLegendStyle::Style s, QgsComposerLegend | ||||
Style::Side side, double margin ); | ||||
double boxSpace() const {return mBoxSpace;} | double boxSpace() const {return mBoxSpace;} | |||
void setBoxSpace( double s ) {mBoxSpace = s;} | void setBoxSpace( double s ) {mBoxSpace = s;} | |||
double groupSpace() const {return mGroupSpace;} | double columnSpace() const {return mColumnSpace;} | |||
void setGroupSpace( double s ) {mGroupSpace = s;} | void setColumnSpace( double s ) { mColumnSpace = s;} | |||
double layerSpace() const {return mLayerSpace;} | ||||
void setLayerSpace( double s ) {mLayerSpace = s;} | ||||
double symbolSpace() const {return mSymbolSpace;} | ||||
void setSymbolSpace( double s ) {mSymbolSpace = s;} | ||||
double iconLabelSpace() const {return mIconLabelSpace;} | QColor fontColor() const {return mFontColor;} | |||
void setIconLabelSpace( double s ) {mIconLabelSpace = s;} | void setFontColor( const QColor& c ) {mFontColor = c;} | |||
double symbolWidth() const {return mSymbolWidth;} | double symbolWidth() const {return mSymbolWidth;} | |||
void setSymbolWidth( double w ) {mSymbolWidth = w;} | void setSymbolWidth( double w ) {mSymbolWidth = w;} | |||
double symbolHeight() const {return mSymbolHeight;} | double symbolHeight() const {return mSymbolHeight;} | |||
void setSymbolHeight( double h ) {mSymbolHeight = h;} | void setSymbolHeight( double h ) {mSymbolHeight = h;} | |||
void setWrapChar( const QString& t ) {mWrapChar = t;} | void setWrapChar( const QString& t ) {mWrapChar = t;} | |||
QString wrapChar() const {return mWrapChar;} | QString wrapChar() const {return mWrapChar;} | |||
int columnCount() const { return mColumnCount; } | ||||
void setColumnCount( int c ) { mColumnCount = c;} | ||||
int splitLayer() const { return mSplitLayer; } | ||||
void setSplitLayer( bool s ) { mSplitLayer = s;} | ||||
int equalColumnWidth() const { return mEqualColumnWidth; } | ||||
void setEqualColumnWidth( bool s ) { mEqualColumnWidth = s;} | ||||
void setComposerMap( const QgsComposerMap* map ); | void setComposerMap( const QgsComposerMap* map ); | |||
const QgsComposerMap* composerMap() const { return mComposerMap; } | const QgsComposerMap* composerMap() const { return mComposerMap;} | |||
/**Updates the model and all legend entries*/ | /**Updates the model and all legend entries*/ | |||
void updateLegend(); | void updateLegend(); | |||
/** stores state in Dom node | /** stores state in Dom node | |||
* @param elem is Dom element corresponding to 'Composer' tag | * @param elem is Dom element corresponding to 'Composer' tag | |||
* @param doc Dom document | * @param doc Dom document | |||
*/ | */ | |||
bool writeXML( QDomElement& elem, QDomDocument & doc ) const; | bool writeXML( QDomElement& elem, QDomDocument & doc ) const; | |||
skipping to change at line 124 | skipping to change at line 130 | |||
public slots: | public slots: | |||
/**Data changed*/ | /**Data changed*/ | |||
void synchronizeWithModel(); | void synchronizeWithModel(); | |||
/**Sets mCompositionMap to 0 if the map is deleted*/ | /**Sets mCompositionMap to 0 if the map is deleted*/ | |||
void invalidateCurrentMap(); | void invalidateCurrentMap(); | |||
protected: | protected: | |||
QString mTitle; | QString mTitle; | |||
QString mWrapChar; | QString mWrapChar; | |||
//different fonts for entries | QColor mFontColor; | |||
QFont mTitleFont; | ||||
QFont mGroupFont; | ||||
QFont mLayerFont; | ||||
QFont mItemFont; | ||||
/**Space between item box and contents*/ | /**Space between item box and contents*/ | |||
double mBoxSpace; | qreal mBoxSpace; | |||
/**Vertical space between group entries*/ | /**Space between columns*/ | |||
double mGroupSpace; | double mColumnSpace; | |||
/**Vertical space between layer entries*/ | ||||
double mLayerSpace; | ||||
/**Vertical space between symbol entries*/ | ||||
double mSymbolSpace; | ||||
/**Horizontal space between item icon and label*/ | ||||
double mIconLabelSpace; | ||||
/**Width of symbol icon*/ | /**Width of symbol icon*/ | |||
double mSymbolWidth; | double mSymbolWidth; | |||
/**Height of symbol icon*/ | /**Height of symbol icon*/ | |||
double mSymbolHeight; | double mSymbolHeight; | |||
/** Spacing between lines when wrapped */ | /** Spacing between lines when wrapped */ | |||
double mlineSpacing; | double mlineSpacing; | |||
/** Number of legend columns */ | ||||
int mColumnCount; | ||||
QgsLegendModel mLegendModel; | QgsLegendModel mLegendModel; | |||
/**Reference to map (because symbols are sometimes in map units)*/ | /**Reference to map (because symbols are sometimes in map units)*/ | |||
const QgsComposerMap* mComposerMap; | const QgsComposerMap* mComposerMap; | |||
/** Allow splitting layers into multiple columns */ | ||||
bool mSplitLayer; | ||||
/** Use the same width (maximum) for all columns */ | ||||
bool mEqualColumnWidth; | ||||
private: | private: | |||
/** Nucleon is either group title, layer title or layer child item. | ||||
* Nucleon is similar to QgsComposerLegendItem but it does not have | ||||
* the same hierarchy. E.g. layer title nucleon is just title, it does | ||||
not | ||||
* include all layer subitems, the same with groups. | ||||
*/ | ||||
class Nucleon | ||||
{ | ||||
public: | ||||
QgsComposerLegendItem* item; | ||||
// Symbol size size without any space around for symbol item | ||||
QSizeF symbolSize; | ||||
// Label size without any space around for symbol item | ||||
QSizeF labelSize; | ||||
QSizeF size; | ||||
// Offset of symbol label, this offset is the same for all symbol l | ||||
abels | ||||
// of the same layer in the same column | ||||
double labelXOffset; | ||||
}; | ||||
/** Atom is indivisible set (indivisible into more columns). It may con | ||||
sists | ||||
* of one or more Nucleon, depending on layer splitting mode: | ||||
* 1) no layer split: [group_title ...] layer_title layer_item [layer_ | ||||
item ...] | ||||
* 2) layer split: [group_title ...] layer_title layer_item | ||||
* or: layer_item | ||||
* It means that group titles must not be split from layer title and l | ||||
ayer title | ||||
* must not be split from first item, because it would look bad and it | ||||
would not | ||||
* be readable to leave group or layer title at the bottom of column. | ||||
*/ | ||||
class Atom | ||||
{ | ||||
public: | ||||
Atom(): size( QSizeF( 0, 0 ) ), column( 0 ) {} | ||||
QList<Nucleon> nucleons; | ||||
// Atom size including nucleons interspaces but without any space a | ||||
round atom. | ||||
QSizeF size; | ||||
int column; | ||||
}; | ||||
/** Create list of atoms according to current layer splitting mode */ | ||||
QList<Atom> createAtomList( QStandardItem* rootItem, bool splitLayer ); | ||||
/** Divide atoms to columns and set columns on atoms */ | ||||
void setColumns( QList<Atom>& atomList ); | ||||
QgsComposerLegend(); //forbidden | QgsComposerLegend(); //forbidden | |||
/**Draws a group item and all subitems*/ | QSizeF drawTitle( QPainter* painter = 0, QPointF point = QPointF(), Qt: | |||
void drawGroupItem( QPainter* p, QgsComposerGroupItem* groupItem, doubl | :AlignmentFlag halignment = Qt::AlignLeft ); | |||
e& currentYCoord, double& maxXCoord ); | ||||
/**Draws a group item and all subitems | ||||
* Returns list of sizes of layers and groups including this group. | ||||
*/ | ||||
QSizeF drawGroupItemTitle( QgsComposerGroupItem* groupItem, QPainter* p | ||||
ainter = 0, QPointF point = QPointF() ); | ||||
/**Draws a layer item and all subitems*/ | /**Draws a layer item and all subitems*/ | |||
void drawLayerItem( QPainter* p, QgsComposerLayerItem* layerItem, doubl e& currentYCoord, double& maxXCoord ); | QSizeF drawLayerItemTitle( QgsComposerLayerItem* layerItem, QPainter* p ainter = 0, QPointF point = QPointF() ); | |||
/**Draws child items of a layer item | Nucleon drawSymbolItem( QgsComposerLegendItem* symbolItem, QPainter* pa | |||
@param p painter | inter = 0, QPointF point = QPointF(), double labelXOffset = 0. ); | |||
@param layerItem parent model item (layer) | ||||
@param currentYCoord in/out: current y position of legend item | ||||
@param maxXCoord in/out: maximum x-coordinate of the whole legend | ||||
@param layerOpacity opacity of the corresponding map layer | ||||
*/ | ||||
void drawLayerChildItems( QPainter* p, QStandardItem* layerItem, double | ||||
& currentYCoord, double& maxXCoord, int layerOpacity = 255 ); | ||||
/**Draws a symbol at the current y position and returns the new x posit ion. Returns real symbol height, because for points, | /**Draws a symbol at the current y position and returns the new x posit ion. Returns real symbol height, because for points, | |||
it is possible that it differs from mSymbolHeight*/ | it is possible that it differs from mSymbolHeight*/ | |||
void drawSymbol( QPainter* p, QgsSymbol* s, double currentYCoord, doubl | void drawSymbolV2( QPainter* p, QgsSymbolV2* s, double currentYCoord, d | |||
e& currentXPosition, double& symbolHeight, int layerOpacity = 255 ) const; | ouble& currentXPosition, double& symbolHeight ) const; | |||
void drawSymbolV2( QPainter* p, QgsSymbolV2* s, double currentYCoord, d | ||||
ouble& currentXPosition, double& symbolHeight, int layerOpacity = 255 ) con | /** Draw atom and return its actual size, the atom is drawn with the sp | |||
st; | ace above it | |||
void drawPointSymbol( QPainter*, QgsSymbol* s, double currentYCoord, do | * so that first atoms in column are all aligned to the same line rega | |||
uble& currentXPosition, double& symbolHeight, int opacity = 255 ) const; | rdles their | |||
void drawLineSymbol( QPainter*, QgsSymbol* s, double currentYCoord, dou | * style top space */ | |||
ble& currentXPosition, int opacity = 255 ) const; | QSizeF drawAtom( Atom atom, QPainter* painter = 0, QPointF point = QPoi | |||
void drawPolygonSymbol( QPainter* p, QgsSymbol* s, double currentYCoord | ntF() ); | |||
, double& currentXPosition, int opacity = 255 ) const; | ||||
double spaceAboveAtom( Atom atom ); | ||||
/**Helper function that lists ids of layers contained in map canvas*/ | /**Helper function that lists ids of layers contained in map canvas*/ | |||
QStringList layerIdList() const; | QStringList layerIdList() const; | |||
private: | /** Splits a string using the wrap char taking into account handling em | |||
/** Splits a string using the the wrap char taking into account handlin | pty | |||
g empty | ||||
wrap char which means no wrapping */ | wrap char which means no wrapping */ | |||
QStringList splitStringForWrapping( QString stringToSplt ); | QStringList splitStringForWrapping( QString stringToSplt ); | |||
QMap<QgsComposerLegendStyle::Style, QgsComposerLegendStyle> mStyleMap; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 21 change blocks. | ||||
66 lines changed or deleted | 128 lines changed or added | |||
qgscomposerlegenditem.h | qgscomposerlegenditem.h | |||
---|---|---|---|---|
skipping to change at line 21 | skipping to change at line 21 | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCOMPOSERLEGENDITEM_H | #ifndef QGSCOMPOSERLEGENDITEM_H | |||
#define QGSCOMPOSERLEGENDITEM_H | #define QGSCOMPOSERLEGENDITEM_H | |||
#include "qgscomposerlegendstyle.h" | ||||
#include <QStandardItem> | #include <QStandardItem> | |||
class QDomDocument; | class QDomDocument; | |||
class QDomElement; | class QDomElement; | |||
/**Abstract base class for the legend item types*/ | /**Abstract base class for the legend item types*/ | |||
class CORE_EXPORT QgsComposerLegendItem: public QStandardItem | class CORE_EXPORT QgsComposerLegendItem: public QStandardItem | |||
{ | { | |||
public: | public: | |||
QgsComposerLegendItem( QgsComposerLegendStyle::Style s = QgsComposerLeg | ||||
QgsComposerLegendItem(); | endStyle::Undefined ); | |||
QgsComposerLegendItem( const QString& text ); | QgsComposerLegendItem( const QString& text, QgsComposerLegendStyle::Sty | |||
QgsComposerLegendItem( const QIcon& icon, const QString& text ); | le s = QgsComposerLegendStyle::Undefined ); | |||
QgsComposerLegendItem( const QIcon& icon, const QString& text, QgsCompo | ||||
serLegendStyle::Style s = QgsComposerLegendStyle::Undefined ); | ||||
virtual ~QgsComposerLegendItem(); | virtual ~QgsComposerLegendItem(); | |||
enum ItemType | enum ItemType | |||
{ | { | |||
GroupItem = QStandardItem::UserType, | GroupItem = QStandardItem::UserType, | |||
LayerItem, | LayerItem, | |||
SymbologyItem, | ||||
SymbologyV2Item, | SymbologyV2Item, | |||
RasterSymbolItem | RasterSymbolItem, | |||
StyleItem | ||||
}; | }; | |||
virtual void writeXML( QDomElement& elem, QDomDocument& doc ) const = 0 ; | virtual void writeXML( QDomElement& elem, QDomDocument& doc ) const = 0 ; | |||
/**Read item content from xml | /**Read item content from xml | |||
@param itemElem item to read from | @param itemElem item to read from | |||
@param xServerAvailable Read item icons if true (QIcon needs x-server )*/ | @param xServerAvailable Read item icons if true (QIcon needs x-server )*/ | |||
virtual void readXML( const QDomElement& itemElem, bool xServerAvailabl e = true ) = 0; | virtual void readXML( const QDomElement& itemElem, bool xServerAvailabl e = true ) = 0; | |||
virtual ItemType itemType() const = 0; | virtual ItemType itemType() const = 0; | |||
virtual QStandardItem* clone() const = 0; | virtual QStandardItem* clone() const = 0; | |||
protected: | QgsComposerLegendStyle::Style style() const { return mStyle; } | |||
void writeXMLChildren( QDomElement& elem, QDomDocument& doc ) const; | void setStyle( QgsComposerLegendStyle::Style style ) { mStyle = style; | |||
}; | } | |||
class QgsSymbol; | // Get text defined by user | |||
virtual QString userText() const { return mUserText; } | ||||
class CORE_EXPORT QgsComposerSymbolItem: public QgsComposerLegendItem | // Set text defined by user | |||
{ | virtual void setUserText( const QString & text ) { mUserText = text; } | |||
public: | ||||
QgsComposerSymbolItem(); | ||||
QgsComposerSymbolItem( const QString& text ); | ||||
QgsComposerSymbolItem( const QIcon& icon, const QString& text ); | ||||
virtual ~QgsComposerSymbolItem(); | ||||
virtual QStandardItem* clone() const; | protected: | |||
void writeXMLChildren( QDomElement& elem, QDomDocument& doc ) const; | ||||
virtual void writeXML( QDomElement& elem, QDomDocument& doc ) const; | ||||
virtual void readXML( const QDomElement& itemElem, bool xServerAvailabl | ||||
e = true ); | ||||
/**Set symbol (takes ownership)*/ | ||||
void setSymbol( QgsSymbol* s ); | ||||
QgsSymbol* symbol() {return mSymbol;} | ||||
void setLayerID( const QString& id ) { mLayerID = id; } | ||||
QString layerID() const { return mLayerID; } | ||||
ItemType itemType() const { return SymbologyItem; } | QgsComposerLegendStyle::Style mStyle; | |||
private: | // User defined text | |||
QgsSymbol* mSymbol; | QString mUserText; | |||
QString mLayerID; //this is needed to read the symbol from XML | ||||
}; | }; | |||
class QgsSymbolV2; | class QgsSymbolV2; | |||
class CORE_EXPORT QgsComposerSymbolV2Item: public QgsComposerLegendItem | class CORE_EXPORT QgsComposerSymbolV2Item: public QgsComposerLegendItem | |||
{ | { | |||
public: | public: | |||
QgsComposerSymbolV2Item(); | QgsComposerSymbolV2Item(); | |||
QgsComposerSymbolV2Item( const QString& text ); | QgsComposerSymbolV2Item( const QString& text ); | |||
QgsComposerSymbolV2Item( const QIcon& icon, const QString& text ); | QgsComposerSymbolV2Item( const QIcon& icon, const QString& text ); | |||
skipping to change at line 111 | skipping to change at line 95 | |||
/**Set symbol (takes ownership)*/ | /**Set symbol (takes ownership)*/ | |||
void setSymbolV2( QgsSymbolV2* s ); | void setSymbolV2( QgsSymbolV2* s ); | |||
QgsSymbolV2* symbolV2() {return mSymbolV2;} | QgsSymbolV2* symbolV2() {return mSymbolV2;} | |||
ItemType itemType() const { return SymbologyV2Item; } | ItemType itemType() const { return SymbologyV2Item; } | |||
private: | private: | |||
QgsSymbolV2* mSymbolV2; | QgsSymbolV2* mSymbolV2; | |||
}; | }; | |||
class CORE_EXPORT QgsComposerRasterSymbolItem: public QgsComposerLegendItem | class CORE_EXPORT QgsComposerRasterSymbolItem : public QgsComposerLegendIte m | |||
{ | { | |||
public: | public: | |||
QgsComposerRasterSymbolItem(); | QgsComposerRasterSymbolItem(); | |||
QgsComposerRasterSymbolItem( const QString& text ); | QgsComposerRasterSymbolItem( const QString& text ); | |||
QgsComposerRasterSymbolItem( const QIcon& icon, const QString& text ); | QgsComposerRasterSymbolItem( const QIcon& icon, const QString& text ); | |||
virtual ~QgsComposerRasterSymbolItem(); | virtual ~QgsComposerRasterSymbolItem(); | |||
virtual QStandardItem* clone() const; | virtual QStandardItem* clone() const; | |||
virtual void writeXML( QDomElement& elem, QDomDocument& doc ) const; | virtual void writeXML( QDomElement& elem, QDomDocument& doc ) const; | |||
skipping to change at line 136 | skipping to change at line 120 | |||
ItemType itemType() const { return RasterSymbolItem; } | ItemType itemType() const { return RasterSymbolItem; } | |||
void setColor( const QColor& c ) { mColor = c; } | void setColor( const QColor& c ) { mColor = c; } | |||
QColor color() const { return mColor; } | QColor color() const { return mColor; } | |||
private: | private: | |||
QString mLayerID; | QString mLayerID; | |||
QColor mColor; | QColor mColor; | |||
}; | }; | |||
class CORE_EXPORT QgsComposerLayerItem: public QgsComposerLegendItem | class CORE_EXPORT QgsComposerLayerItem : public QgsComposerLegendItem | |||
{ | { | |||
public: | public: | |||
QgsComposerLayerItem(); | QgsComposerLayerItem(); | |||
QgsComposerLayerItem( const QString& text ); | QgsComposerLayerItem( const QString& text ); | |||
virtual ~QgsComposerLayerItem(); | virtual ~QgsComposerLayerItem(); | |||
virtual QStandardItem* clone() const; | virtual QStandardItem* clone() const; | |||
virtual void writeXML( QDomElement& elem, QDomDocument& doc ) const; | virtual void writeXML( QDomElement& elem, QDomDocument& doc ) const; | |||
virtual void readXML( const QDomElement& itemElem, bool xServerAvailabl e = true ); | virtual void readXML( const QDomElement& itemElem, bool xServerAvailabl e = true ); | |||
ItemType itemType() const { return LayerItem; } | ItemType itemType() const { return LayerItem; } | |||
void setLayerID( const QString& id ) { mLayerID = id; } | void setLayerID( const QString& id ) { mLayerID = id; } | |||
QString layerID() const { return mLayerID; } | QString layerID() const { return mLayerID; } | |||
void setShowFeatureCount( bool show ) { mShowFeatureCount = show; } | ||||
bool showFeatureCount() const { return mShowFeatureCount; } | ||||
void setDefaultStyle(); | ||||
private: | private: | |||
QString mLayerID; | QString mLayerID; | |||
// Show vector feature counts | ||||
bool mShowFeatureCount; | ||||
}; | }; | |||
class CORE_EXPORT QgsComposerGroupItem: public QgsComposerLegendItem | class CORE_EXPORT QgsComposerGroupItem: public QgsComposerLegendItem | |||
{ | { | |||
public: | public: | |||
QgsComposerGroupItem(); | QgsComposerGroupItem(); | |||
QgsComposerGroupItem( const QString& text ); | QgsComposerGroupItem( const QString& text ); | |||
virtual ~QgsComposerGroupItem(); | virtual ~QgsComposerGroupItem(); | |||
virtual QStandardItem* clone() const; | virtual QStandardItem* clone() const; | |||
virtual void writeXML( QDomElement& elem, QDomDocument& doc ) const; | virtual void writeXML( QDomElement& elem, QDomDocument& doc ) const; | |||
virtual void readXML( const QDomElement& itemElem, bool xServerAvailabl e = true ); | virtual void readXML( const QDomElement& itemElem, bool xServerAvailabl e = true ); | |||
ItemType itemType() const { return GroupItem; } | ItemType itemType() const { return GroupItem; } | |||
}; | }; | |||
class CORE_EXPORT QgsComposerStyleItem: public QStandardItem | ||||
{ | ||||
public: | ||||
QgsComposerStyleItem( ); | ||||
QgsComposerStyleItem( QgsComposerLegendItem *item ); | ||||
~QgsComposerStyleItem(); | ||||
}; | ||||
#endif // QGSCOMPOSERLEGENDITEM_H | #endif // QGSCOMPOSERLEGENDITEM_H | |||
End of changes. 14 change blocks. | ||||
36 lines changed or deleted | 38 lines changed or added | |||
qgscomposermap.h | qgscomposermap.h | |||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCOMPOSERMAP_H | #ifndef QGSCOMPOSERMAP_H | |||
#define QGSCOMPOSERMAP_H | #define QGSCOMPOSERMAP_H | |||
//#include "ui_qgscomposermapbase.h" | //#include "ui_qgscomposermapbase.h" | |||
#include "qgscomposeritem.h" | #include "qgscomposeritem.h" | |||
#include "qgsrectangle.h" | #include "qgsrectangle.h" | |||
#include <QFont> | ||||
#include <QGraphicsRectItem> | #include <QGraphicsRectItem> | |||
class QgsComposition; | class QgsComposition; | |||
class QgsMapRenderer; | class QgsMapRenderer; | |||
class QgsMapToPixel; | class QgsMapToPixel; | |||
class QDomNode; | class QDomNode; | |||
class QDomDocument; | class QDomDocument; | |||
class QGraphicsView; | class QGraphicsView; | |||
class QPainter; | class QPainter; | |||
class QgsFillSymbolV2; | ||||
class QgsLineSymbolV2; | ||||
class QgsVectorLayer; | ||||
/** \ingroup MapComposer | /** \ingroup MapComposer | |||
* \class QgsComposerMap | * \class QgsComposerMap | |||
* \brief Object representing map window. | * \brief Object representing map window. | |||
*/ | */ | |||
// NOTE: QgsComposerMapBase must be first, otherwise does not compile | // NOTE: QgsComposerMapBase must be first, otherwise does not compile | |||
class CORE_EXPORT QgsComposerMap : public QgsComposerItem | class CORE_EXPORT QgsComposerMap : public QgsComposerItem | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
/** Constructor. */ | /** Constructor. */ | |||
QgsComposerMap( QgsComposition *composition, int x, int y, int width, i nt height ); | QgsComposerMap( QgsComposition *composition, int x, int y, int width, i nt height ); | |||
/** Constructor. Settings are read from project. */ | /** Constructor. Settings are read from project. */ | |||
QgsComposerMap( QgsComposition *composition ); | QgsComposerMap( QgsComposition *composition ); | |||
~QgsComposerMap(); | virtual ~QgsComposerMap(); | |||
/** return correct graphics item type. Added in v1.7 */ | /** return correct graphics item type. Added in v1.7 */ | |||
virtual int type() const { return ComposerMap; } | virtual int type() const { return ComposerMap; } | |||
/** \brief Preview style */ | /** \brief Preview style */ | |||
enum PreviewMode | enum PreviewMode | |||
{ | { | |||
Cache = 0, // Use raster cache | Cache = 0, // Use raster cache | |||
Render, // Render the map | Render, // Render the map | |||
Rectangle // Display only rectangle | Rectangle // Display only rectangle | |||
skipping to change at line 69 | skipping to change at line 73 | |||
enum GridStyle | enum GridStyle | |||
{ | { | |||
Solid = 0, //solid lines | Solid = 0, //solid lines | |||
Cross //only draw line crossings | Cross //only draw line crossings | |||
}; | }; | |||
enum GridAnnotationPosition | enum GridAnnotationPosition | |||
{ | { | |||
InsideMapFrame = 0, | InsideMapFrame = 0, | |||
OutsideMapFrame | OutsideMapFrame, | |||
Disabled | ||||
}; | }; | |||
enum GridAnnotationDirection | enum GridAnnotationDirection | |||
{ | { | |||
Horizontal = 0, | Horizontal = 0, | |||
Vertical, | Vertical, | |||
HorizontalAndVertical, | HorizontalAndVertical, | |||
BoundaryDirection | BoundaryDirection | |||
}; | }; | |||
/**This function is deprecated*/ | enum GridAnnotationFormat | |||
void draw( QPainter *painter, const QgsRectangle& extent, const QSize& | { | |||
size, int dpi ); | Decimal = 0, | |||
DegreeMinute, | ||||
DegreeMinuteSecond | ||||
}; | ||||
enum GridFrameStyle | ||||
{ | ||||
NoGridFrame = 0, | ||||
Zebra //black / white pattern | ||||
}; | ||||
/**Enum for different frame borders*/ | ||||
enum Border | ||||
{ | ||||
Left, | ||||
Right, | ||||
Bottom, | ||||
Top | ||||
}; | ||||
/** \brief Draw to paint device | /** \brief Draw to paint device | |||
@param painter painter | @param painter painter | |||
@param extent map extent | @param extent map extent | |||
@param size size in scene coordinates | @param size size in scene coordinates | |||
@param dpi scene dpi | @param dpi scene dpi | |||
@param forceWidthScale force wysiwyg line widths / marker sizes | @param forceWidthScale force wysiwyg line widths / marker sizes | |||
*/ | */ | |||
void draw( QPainter *painter, const QgsRectangle& extent, const QSizeF& size, double dpi, double* forceWidthScale = 0 ); | void draw( QPainter *painter, const QgsRectangle& extent, const QSizeF& size, double dpi, double* forceWidthScale = 0 ); | |||
/** \brief Reimplementation of QCanvasItem::paint - draw on canvas */ | /** \brief Reimplementation of QCanvasItem::paint - draw on canvas */ | |||
void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyl e, QWidget* pWidget ); | void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyl e, QWidget* pWidget ); | |||
/** \brief Create cache image */ | /** \brief Create cache image */ | |||
void cache( void ); | void cache(); | |||
/** \brief Get identification number*/ | /** \brief Get identification number*/ | |||
int id() const {return mId;} | int id() const {return mId;} | |||
/**True if a draw is already in progress*/ | /**True if a draw is already in progress*/ | |||
bool isDrawing() const {return mDrawing;} | bool isDrawing() const {return mDrawing;} | |||
/** resizes an item in x- and y direction (canvas coordinates)*/ | /** resizes an item in x- and y direction (canvas coordinates)*/ | |||
void resize( double dx, double dy ); | void resize( double dx, double dy ); | |||
skipping to change at line 122 | skipping to change at line 146 | |||
/**Zoom content of map | /**Zoom content of map | |||
@param delta value from wheel event that describes magnitude and direc tion (positive /negative number) | @param delta value from wheel event that describes magnitude and direc tion (positive /negative number) | |||
@param x x-coordinate of mouse position in item coordinates | @param x x-coordinate of mouse position in item coordinates | |||
@param y y-coordinate of mouse position in item coordinates*/ | @param y y-coordinate of mouse position in item coordinates*/ | |||
void zoomContent( int delta, double x, double y ); | void zoomContent( int delta, double x, double y ); | |||
/**Sets new scene rectangle bounds and recalculates hight and extent*/ | /**Sets new scene rectangle bounds and recalculates hight and extent*/ | |||
void setSceneRect( const QRectF& rectangle ); | void setSceneRect( const QRectF& rectangle ); | |||
/** \brief Scale */ | /** \brief Scale */ | |||
double scale( void ) const; | double scale() const; | |||
/**Sets new scale and changes only mExtent*/ | /**Sets new scale and changes only mExtent*/ | |||
void setNewScale( double scaleDenominator ); | void setNewScale( double scaleDenominator ); | |||
/**Sets new Extent and changes width, height (and implicitely also scal e)*/ | /**Sets new Extent and changes width, height (and implicitely also scal e)*/ | |||
void setNewExtent( const QgsRectangle& extent ); | void setNewExtent( const QgsRectangle& extent ); | |||
PreviewMode previewMode() const {return mPreviewMode;} | PreviewMode previewMode() const {return mPreviewMode;} | |||
void setPreviewMode( PreviewMode m ); | void setPreviewMode( PreviewMode m ); | |||
skipping to change at line 162 | skipping to change at line 186 | |||
QgsRectangle extent() const {return mExtent;} | QgsRectangle extent() const {return mExtent;} | |||
const QgsMapRenderer* mapRenderer() const {return mMapRenderer;} | const QgsMapRenderer* mapRenderer() const {return mMapRenderer;} | |||
/**Sets offset values to shift image (useful for live updates when movi ng item content)*/ | /**Sets offset values to shift image (useful for live updates when movi ng item content)*/ | |||
void setOffset( double xOffset, double yOffset ); | void setOffset( double xOffset, double yOffset ); | |||
/**True if composer map renders a WMS layer*/ | /**True if composer map renders a WMS layer*/ | |||
bool containsWMSLayer() const; | bool containsWMSLayer() const; | |||
/**True if composer map contains layers with blend modes or flattened l | ||||
ayers for vectors */ | ||||
bool containsAdvancedEffects() const; | ||||
/** stores state in Dom node | /** stores state in Dom node | |||
* @param elem is Dom element corresponding to 'Composer' tag | * @param elem is Dom element corresponding to 'Composer' tag | |||
* @param doc Dom document | * @param doc Dom document | |||
*/ | */ | |||
bool writeXML( QDomElement& elem, QDomDocument & doc ) const; | bool writeXML( QDomElement& elem, QDomDocument & doc ) const; | |||
/** sets state from Dom document | /** sets state from Dom document | |||
* @param itemElem is Dom node corresponding to 'ComposerMap' tag | * @param itemElem is Dom node corresponding to 'ComposerMap' tag | |||
* @param doc is Dom document | * @param doc is Dom document | |||
*/ | */ | |||
skipping to change at line 206 | skipping to change at line 233 | |||
void setGridOffsetX( double offset ) { mGridOffsetX = offset; } | void setGridOffsetX( double offset ) { mGridOffsetX = offset; } | |||
double gridOffsetX() const { return mGridOffsetX; } | double gridOffsetX() const { return mGridOffsetX; } | |||
/**Sets y-coordinate offset for composer grid | /**Sets y-coordinate offset for composer grid | |||
@note this function was added in version 1.4*/ | @note this function was added in version 1.4*/ | |||
void setGridOffsetY( double offset ) { mGridOffsetY = offset; } | void setGridOffsetY( double offset ) { mGridOffsetY = offset; } | |||
double gridOffsetY() const { return mGridOffsetY; } | double gridOffsetY() const { return mGridOffsetY; } | |||
/**Sets the pen to draw composer grid | /**Sets the pen to draw composer grid | |||
@note this function was added in version 1.4*/ | @note this function was added in version 1.4*/ | |||
void setGridPen( const QPen& p ) { mGridPen = p; } | void setGridPen( const QPen& p ); | |||
QPen gridPen() const { return mGridPen; } | QPen gridPen() const; | |||
/**Sets with of grid pen | /**Sets with of grid pen | |||
@note this function was added in version 1.4*/ | @note this function was added in version 1.4*/ | |||
void setGridPenWidth( double w ); | void setGridPenWidth( double w ); | |||
/**Sets the color of the grid pen | /**Sets the color of the grid pen | |||
@note this function was added in version 1.4*/ | @note this function was added in version 1.4*/ | |||
void setGridPenColor( const QColor& c ); | void setGridPenColor( const QColor& c ); | |||
/**Sets font for grid annotations | /**Sets font for grid annotations | |||
@note this function was added in version 1.4*/ | @note this function was added in version 1.4*/ | |||
void setGridAnnotationFont( const QFont& f ) { mGridAnnotationFont = f; } | void setGridAnnotationFont( const QFont& f ) { mGridAnnotationFont = f; } | |||
QFont gridAnnotationFont() const { return mGridAnnotationFont; } | QFont gridAnnotationFont() const { return mGridAnnotationFont; } | |||
/**Sets font color for grid annotations | ||||
@note: this function was added in version 2.0*/ | ||||
void setAnnotationFontColor( const QColor& c ) {mGridAnnotationFontColo | ||||
r = c;} | ||||
/**Get font color for grid annotations | ||||
@note: this function was added in version 2.0*/ | ||||
QColor annotationFontColor() const {return mGridAnnotationFontColor;} | ||||
/**Sets coordinate precision for grid annotations | /**Sets coordinate precision for grid annotations | |||
@note this function was added in version 1.4*/ | @note this function was added in version 1.4*/ | |||
void setGridAnnotationPrecision( int p ) {mGridAnnotationPrecision = p; } | void setGridAnnotationPrecision( int p ) {mGridAnnotationPrecision = p; } | |||
int gridAnnotationPrecision() const {return mGridAnnotationPrecision;} | int gridAnnotationPrecision() const {return mGridAnnotationPrecision;} | |||
/**Sets flag if grid annotation should be shown | /**Sets flag if grid annotation should be shown | |||
@note this function was added in version 1.4*/ | @note this function was added in version 1.4*/ | |||
void setShowGridAnnotation( bool show ) {mShowGridAnnotation = show;} | void setShowGridAnnotation( bool show ) {mShowGridAnnotation = show;} | |||
bool showGridAnnotation() const {return mShowGridAnnotation;} | bool showGridAnnotation() const {return mShowGridAnnotation;} | |||
/**Sets position of grid annotations. Possibilities are inside or outsi | void setGridAnnotationPosition( GridAnnotationPosition p, QgsComposerMa | |||
de of the map frame | p::Border border ); | |||
@note this function was added in version 1.4*/ | GridAnnotationPosition gridAnnotationPosition( QgsComposerMap::Border b | |||
void setGridAnnotationPosition( GridAnnotationPosition p ) {mGridAnnota | order ) const; | |||
tionPosition = p;} | ||||
GridAnnotationPosition gridAnnotationPosition() const {return mGridAnno | ||||
tationPosition;} | ||||
/**Sets distance between map frame and annotations | /**Sets distance between map frame and annotations | |||
@note this function was added in version 1.4*/ | @note this function was added in version 1.4*/ | |||
void setAnnotationFrameDistance( double d ) {mAnnotationFrameDistance = d;} | void setAnnotationFrameDistance( double d ) {mAnnotationFrameDistance = d;} | |||
double annotationFrameDistance() const {return mAnnotationFrameDistance ;} | double annotationFrameDistance() const {return mAnnotationFrameDistance ;} | |||
/**Sets grid annotation direction. Can be horizontal, vertical, directi | void setGridAnnotationDirection( GridAnnotationDirection d, QgsComposer | |||
on of axis and horizontal and vertical | Map::Border border ); | |||
@note this function was added in version 1.4*/ | GridAnnotationDirection gridAnnotationDirection( QgsComposerMap::Border | |||
void setGridAnnotationDirection( GridAnnotationDirection d ) {mGridAnno | border ) const; | |||
tationDirection = d;} | ||||
GridAnnotationDirection gridAnnotationDirection() const {return mGridAn | void setGridAnnotationFormat( GridAnnotationFormat f ) { mGridAnnotatio | |||
notationDirection;} | nFormat = f; } | |||
GridAnnotationFormat gridAnnotationFormat() const { return mGridAnnotat | ||||
ionFormat; } | ||||
/**Set grid frame style (NoGridFrame or Zebra) | ||||
@note: this function was added in version 1.9*/ | ||||
void setGridFrameStyle( GridFrameStyle style ) { mGridFrameStyle = styl | ||||
e; } | ||||
GridFrameStyle gridFrameStyle() const { return mGridFrameStyle; } | ||||
/**Set grid frame width | ||||
@note: this function was added in version 1.9*/ | ||||
void setGridFrameWidth( double w ) { mGridFrameWidth = w; } | ||||
double gridFrameWidth() const { return mGridFrameWidth; } | ||||
/**In case of annotations, the bounding rectangle can be larger than th e map item rectangle | /**In case of annotations, the bounding rectangle can be larger than th e map item rectangle | |||
@note this function was added in version 1.4*/ | @note this function was added in version 1.4*/ | |||
QRectF boundingRect() const; | QRectF boundingRect() const; | |||
/**Updates the bounding rect of this item. Call this function before do ing any changes related to annotation out of the map rectangle | /**Updates the bounding rect of this item. Call this function before do ing any changes related to annotation out of the map rectangle | |||
@note this function was added in version 1.4*/ | @note this function was added in version 1.4*/ | |||
void updateBoundingRect(); | void updateBoundingRect(); | |||
/**Sets length of the cros segments (if grid style is cross) | /**Sets length of the cros segments (if grid style is cross) | |||
@note this function was added in version 1.4*/ | @note this function was added in version 1.4*/ | |||
skipping to change at line 270 | skipping to change at line 315 | |||
/**Sets canvas pointer (necessary to query and draw map canvas items)*/ | /**Sets canvas pointer (necessary to query and draw map canvas items)*/ | |||
void setMapCanvas( QGraphicsView* canvas ) { mMapCanvas = canvas; } | void setMapCanvas( QGraphicsView* canvas ) { mMapCanvas = canvas; } | |||
void setDrawCanvasItems( bool b ) { mDrawCanvasItems = b; } | void setDrawCanvasItems( bool b ) { mDrawCanvasItems = b; } | |||
bool drawCanvasItems() const { return mDrawCanvasItems; } | bool drawCanvasItems() const { return mDrawCanvasItems; } | |||
/**Returns the conversion factor map units -> mm*/ | /**Returns the conversion factor map units -> mm*/ | |||
double mapUnitsToMM() const; | double mapUnitsToMM() const; | |||
/**Sets overview frame map. -1 disables the overview frame | ||||
@note: this function was added in version 1.9*/ | ||||
void setOverviewFrameMap( int mapId ); | ||||
/**Returns id of overview frame (or -1 if no overfiew frame) | ||||
@note: this function was added in version 1.9*/ | ||||
int overviewFrameMapId() const { return mOverviewFrameMapId; } | ||||
void setOverviewFrameMapSymbol( QgsFillSymbolV2* symbol ); | ||||
QgsFillSymbolV2* overviewFrameMapSymbol() { return mOverviewFrameMapSym | ||||
bol; } | ||||
/** Returns the overview's blending mode */ | ||||
QPainter::CompositionMode overviewBlendMode() const {return mOverviewBl | ||||
endMode;} | ||||
/** Sets the overview's blending mode*/ | ||||
void setOverviewBlendMode( QPainter::CompositionMode blendMode ); | ||||
/** Returns true if the overview frame is inverted */ | ||||
bool overviewInverted() const {return mOverviewInverted;} | ||||
/** Sets the overview's inversion mode*/ | ||||
void setOverviewInverted( bool inverted ); | ||||
void setGridLineSymbol( QgsLineSymbolV2* symbol ); | ||||
QgsLineSymbolV2* gridLineSymbol() { return mGridLineSymbol; } | ||||
/** Returns the grid's blending mode */ | ||||
QPainter::CompositionMode gridBlendMode() const {return mGridBlendMode; | ||||
} | ||||
/** Sets the grid's blending mode*/ | ||||
void setGridBlendMode( QPainter::CompositionMode blendMode ); | ||||
/**Sets mId to a number not yet used in the composition. mId is kept if | ||||
it is not in use. | ||||
Usually, this function is called before adding the composer map to | ||||
the composition*/ | ||||
void assignFreeId(); | ||||
signals: | signals: | |||
void extentChanged(); | void extentChanged(); | |||
public slots: | public slots: | |||
/**Called if map canvas has changed*/ | /**Called if map canvas has changed*/ | |||
void updateCachedImage( ); | void updateCachedImage( ); | |||
/**Call updateCachedImage if item is in render mode*/ | /**Call updateCachedImage if item is in render mode*/ | |||
void renderModeUpdateCachedImage(); | void renderModeUpdateCachedImage(); | |||
private: | private: | |||
/**Enum for different frame borders*/ | enum AnnotationCoordinate | |||
enum Border | ||||
{ | { | |||
Left, | Longitude = 0, | |||
Right, | Latitude | |||
Bottom, | ||||
Top | ||||
}; | }; | |||
// Pointer to map renderer of the QGIS main map. Note that QgsComposerM ap uses a different map renderer, | // Pointer to map renderer of the QGIS main map. Note that QgsComposerM ap uses a different map renderer, | |||
//it just copies some properties from the main map renderer. | //it just copies some properties from the main map renderer. | |||
QgsMapRenderer *mMapRenderer; | QgsMapRenderer *mMapRenderer; | |||
/**Unique identifier*/ | /**Unique identifier*/ | |||
int mId; | int mId; | |||
// Map region in map units realy used for rendering | // Map region in map units realy used for rendering | |||
skipping to change at line 329 | skipping to change at line 403 | |||
double mXOffset; | double mXOffset; | |||
/**Offset in y direction for showing map cache image*/ | /**Offset in y direction for showing map cache image*/ | |||
double mYOffset; | double mYOffset; | |||
/**Flag if layers to be displayed should be read from qgis canvas (true ) or from stored list in mLayerSet (false)*/ | /**Flag if layers to be displayed should be read from qgis canvas (true ) or from stored list in mLayerSet (false)*/ | |||
bool mKeepLayerSet; | bool mKeepLayerSet; | |||
/**Stored layer list (used if layer live-link mKeepLayerSet is disabled )*/ | /**Stored layer list (used if layer live-link mKeepLayerSet is disabled )*/ | |||
QStringList mLayerSet; | QStringList mLayerSet; | |||
/**Id of map which displays its extent rectangle into this composer map | ||||
(overview map functionality). -1 if not present*/ | ||||
int mOverviewFrameMapId; | ||||
/**Drawing style for overview farme*/ | ||||
QgsFillSymbolV2* mOverviewFrameMapSymbol; | ||||
QgsLineSymbolV2* mGridLineSymbol; | ||||
/**Blend mode for overview*/ | ||||
QPainter::CompositionMode mOverviewBlendMode; | ||||
bool mOverviewInverted; | ||||
/**Establishes signal/slot connection for update in case of layer chang e*/ | /**Establishes signal/slot connection for update in case of layer chang e*/ | |||
void connectUpdateSlot(); | void connectUpdateSlot(); | |||
/**Removes layer ids from mLayerSet that are no longer present in the q gis main map*/ | /**Removes layer ids from mLayerSet that are no longer present in the q gis main map*/ | |||
void syncLayerSet(); | void syncLayerSet(); | |||
/**True if coordinate grid has to be displayed*/ | /**True if coordinate grid has to be displayed*/ | |||
bool mGridEnabled; | bool mGridEnabled; | |||
/**Solid or crosses*/ | /**Solid or crosses*/ | |||
GridStyle mGridStyle; | GridStyle mGridStyle; | |||
/**Grid line interval in x-direction (map units)*/ | /**Grid line interval in x-direction (map units)*/ | |||
double mGridIntervalX; | double mGridIntervalX; | |||
/**Grid line interval in y-direction (map units)*/ | /**Grid line interval in y-direction (map units)*/ | |||
double mGridIntervalY; | double mGridIntervalY; | |||
/**Grid line offset in x-direction*/ | /**Grid line offset in x-direction*/ | |||
double mGridOffsetX; | double mGridOffsetX; | |||
/**Grid line offset in y-direction*/ | /**Grid line offset in y-direction*/ | |||
double mGridOffsetY; | double mGridOffsetY; | |||
/**Grid line pen*/ | ||||
QPen mGridPen; | ||||
/**Font for grid line annotation*/ | /**Font for grid line annotation*/ | |||
QFont mGridAnnotationFont; | QFont mGridAnnotationFont; | |||
/**Font color for grid line annotation*/ | ||||
QColor mGridAnnotationFontColor; | ||||
/**Digits after the dot*/ | /**Digits after the dot*/ | |||
int mGridAnnotationPrecision; | int mGridAnnotationPrecision; | |||
/**True if coordinate values should be drawn*/ | /**True if coordinate values should be drawn*/ | |||
bool mShowGridAnnotation; | bool mShowGridAnnotation; | |||
/**Annotation position inside or outside of map frame*/ | /**Blend mode for grid*/ | |||
GridAnnotationPosition mGridAnnotationPosition; | QPainter::CompositionMode mGridBlendMode; | |||
/**Annotation position for left map side (inside / outside / not shown) | ||||
*/ | ||||
GridAnnotationPosition mLeftGridAnnotationPosition; | ||||
/**Annotation position for right map side (inside / outside / not shown | ||||
)*/ | ||||
GridAnnotationPosition mRightGridAnnotationPosition; | ||||
/**Annotation position for top map side (inside / outside / not shown)* | ||||
/ | ||||
GridAnnotationPosition mTopGridAnnotationPosition; | ||||
/**Annotation position for bottom map side (inside / outside / not show | ||||
n)*/ | ||||
GridAnnotationPosition mBottomGridAnnotationPosition; | ||||
/**Distance between map frame and annotation*/ | /**Distance between map frame and annotation*/ | |||
double mAnnotationFrameDistance; | double mAnnotationFrameDistance; | |||
/**Annotation can be horizontal / vertical or different for axes*/ | ||||
GridAnnotationDirection mGridAnnotationDirection; | /**Annotation direction on left side ( horizontal or vertical )*/ | |||
GridAnnotationDirection mLeftGridAnnotationDirection; | ||||
/**Annotation direction on right side ( horizontal or vertical )*/ | ||||
GridAnnotationDirection mRightGridAnnotationDirection; | ||||
/**Annotation direction on top side ( horizontal or vertical )*/ | ||||
GridAnnotationDirection mTopGridAnnotationDirection; | ||||
/**Annotation direction on bottom side ( horizontal or vertical )*/ | ||||
GridAnnotationDirection mBottomGridAnnotationDirection; | ||||
GridAnnotationFormat mGridAnnotationFormat; | ||||
GridFrameStyle mGridFrameStyle; | ||||
double mGridFrameWidth; | ||||
/**Current bounding rectangle. This is used to check if notification to the graphics scene is necessary*/ | /**Current bounding rectangle. This is used to check if notification to the graphics scene is necessary*/ | |||
QRectF mCurrentRectangle; | QRectF mCurrentRectangle; | |||
/**The length of the cross sides for mGridStyle Cross*/ | /**The length of the cross sides for mGridStyle Cross*/ | |||
double mCrossLength; | double mCrossLength; | |||
QGraphicsView* mMapCanvas; | QGraphicsView* mMapCanvas; | |||
/**True if annotation items, rubber band, etc. from the main canvas sho uld be displayed*/ | /**True if annotation items, rubber band, etc. from the main canvas sho uld be displayed*/ | |||
bool mDrawCanvasItems; | bool mDrawCanvasItems; | |||
/**Draws the map grid*/ | /**Draws the map grid*/ | |||
void drawGrid( QPainter* p ); | void drawGrid( QPainter* p ); | |||
void drawGridFrame( QPainter* p, const QList< QPair< double, QLineF > > & hLines, const QList< QPair< double, QLineF > >& vLines ); | ||||
/**Draw coordinates for mGridAnnotationType Coordinate | /**Draw coordinates for mGridAnnotationType Coordinate | |||
@param p drawing painter | @param p drawing painter | |||
@param hLines horizontal coordinate lines in item coordinates | @param hLines horizontal coordinate lines in item coordinates | |||
@param vLines vertical coordinate lines in item coordinates*/ | @param vLines vertical coordinate lines in item coordinates*/ | |||
void drawCoordinateAnnotations( QPainter* p, const QList< QPair< double , QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines ); | void drawCoordinateAnnotations( QPainter* p, const QList< QPair< double , QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines ); | |||
void drawCoordinateAnnotation( QPainter* p, const QPointF& pos, QString annotationString ); | void drawCoordinateAnnotation( QPainter* p, const QPointF& pos, QString annotationString ); | |||
/**Draws a single annotation | /**Draws a single annotation | |||
@param p drawing painter | @param p drawing painter | |||
@param pos item coordinates where to draw | @param pos item coordinates where to draw | |||
@param rotation text rotation | @param rotation text rotation | |||
@param annotationText the text to draw*/ | @param annotationText the text to draw*/ | |||
void drawAnnotation( QPainter* p, const QPointF& pos, int rotation, con st QString& annotationText ); | void drawAnnotation( QPainter* p, const QPointF& pos, int rotation, con st QString& annotationText ); | |||
QString gridAnnotationString( double value, AnnotationCoordinate coord ) const; | ||||
/**Returns the grid lines with associated coordinate value | /**Returns the grid lines with associated coordinate value | |||
@return 0 in case of success*/ | @return 0 in case of success*/ | |||
int xGridLines( QList< QPair< double, QLineF > >& lines ) const; | int xGridLines( QList< QPair< double, QLineF > >& lines ) const; | |||
/**Returns the grid lines for the y-coordinates. Not vertical in case o f rotation | /**Returns the grid lines for the y-coordinates. Not vertical in case o f rotation | |||
@return 0 in case of success*/ | @return 0 in case of success*/ | |||
int yGridLines( QList< QPair< double, QLineF > >& lines ) const; | int yGridLines( QList< QPair< double, QLineF > >& lines ) const; | |||
/**Returns extent that considers mOffsetX / mOffsetY (during content mo ve)*/ | /**Returns extent that considers mOffsetX / mOffsetY (during content mo ve)*/ | |||
QgsRectangle transformedExtent() const; | QgsRectangle transformedExtent() const; | |||
/**Returns extent that considers rotation and shift with mOffsetX / mOf fsetY*/ | /**Returns extent that considers rotation and shift with mOffsetX / mOf fsetY*/ | |||
QPolygonF transformedMapPolygon() const; | QPolygonF transformedMapPolygon() const; | |||
skipping to change at line 412 | skipping to change at line 520 | |||
@param yShift in: shift in y direction (in item units), out: yShift in map units*/ | @param yShift in: shift in y direction (in item units), out: yShift in map units*/ | |||
void transformShift( double& xShift, double& yShift ) const; | void transformShift( double& xShift, double& yShift ) const; | |||
/**Transforms map coordinates to item coordinates (considering rotation and move offset)*/ | /**Transforms map coordinates to item coordinates (considering rotation and move offset)*/ | |||
QPointF mapToItemCoords( const QPointF& mapCoords ) const; | QPointF mapToItemCoords( const QPointF& mapCoords ) const; | |||
/**Returns the item border of a point (in item coordinates)*/ | /**Returns the item border of a point (in item coordinates)*/ | |||
Border borderForLineCoord( const QPointF& p ) const; | Border borderForLineCoord( const QPointF& p ) const; | |||
void drawCanvasItems( QPainter* painter, const QStyleOptionGraphicsItem * itemStyle ); | void drawCanvasItems( QPainter* painter, const QStyleOptionGraphicsItem * itemStyle ); | |||
void drawCanvasItem( QGraphicsItem* item, QPainter* painter, const QSty leOptionGraphicsItem* itemStyle ); | void drawCanvasItem( QGraphicsItem* item, QPainter* painter, const QSty leOptionGraphicsItem* itemStyle ); | |||
QPointF composerMapPosForItem( const QGraphicsItem* item ) const; | QPointF composerMapPosForItem( const QGraphicsItem* item ) const; | |||
void sortGridLinesOnBorders( const QList< QPair< double, QLineF > >& hL | ||||
ines, const QList< QPair< double, QLineF > >& vLines, QMap< double, double | ||||
>& leftFrameEntries, | ||||
QMap< double, double >& rightFrameEntries, | ||||
QMap< double, double >& topFrameEntries, QMap< double, double >& bottomFra | ||||
meEntries ) const; | ||||
void drawGridFrameBorder( QPainter* p, const QMap< double, double >& bo | ||||
rderPos, Border border ); | ||||
void drawGridLine( const QLineF& line, QPainter* p ); | ||||
void drawOverviewMapExtent( QPainter* p ); | ||||
void createDefaultOverviewFrameSymbol(); | ||||
void createDefaultGridLineSymbol(); | ||||
void initGridAnnotationFormatFromProject(); | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 25 change blocks. | ||||
36 lines changed or deleted | 169 lines changed or added | |||
qgscomposerpicture.h | qgscomposerpicture.h | |||
---|---|---|---|---|
skipping to change at line 25 | skipping to change at line 25 | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCOMPOSERPICTURE_H | #ifndef QGSCOMPOSERPICTURE_H | |||
#define QGSCOMPOSERPICTURE_H | #define QGSCOMPOSERPICTURE_H | |||
#include "qgscomposeritem.h" | #include "qgscomposeritem.h" | |||
#include <QFile> | #include <QFile> | |||
#include <QImage> | #include <QImage> | |||
#include <QSvgRenderer> | #include <QSvgRenderer> | |||
class QgsComposerMap; | ||||
/** \ingroup MapComposer | /** \ingroup MapComposer | |||
* A composer class that displays svg files or raster format (jpg, png, ... ) | * A composer class that displays svg files or raster format (jpg, png, ... ) | |||
* */ | * */ | |||
class CORE_EXPORT QgsComposerPicture: public QgsComposerItem | class CORE_EXPORT QgsComposerPicture: public QgsComposerItem | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsComposerPicture( QgsComposition *composition ); | QgsComposerPicture( QgsComposition *composition ); | |||
~QgsComposerPicture(); | ~QgsComposerPicture(); | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 2 lines changed or added | |||
qgscomposerscalebar.h | qgscomposerscalebar.h | |||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCOMPOSERSCALEBAR_H | #ifndef QGSCOMPOSERSCALEBAR_H | |||
#define QGSCOMPOSERSCALEBAR_H | #define QGSCOMPOSERSCALEBAR_H | |||
#include "qgscomposeritem.h" | #include "qgscomposeritem.h" | |||
#include <QFont> | ||||
#include <QPen> | #include <QPen> | |||
#include <QColor> | ||||
class QgsComposerMap; | class QgsComposerMap; | |||
class QgsScaleBarStyle; | class QgsScaleBarStyle; | |||
/** \ingroup MapComposer | /** \ingroup MapComposer | |||
* A scale bar item that can be added to a map composition. | * A scale bar item that can be added to a map composition. | |||
*/ | */ | |||
class CORE_EXPORT QgsComposerScaleBar: public QgsComposerItem | class CORE_EXPORT QgsComposerScaleBar: public QgsComposerItem | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
/**Added in version 1.8*/ | /**Added in version 1.8*/ | |||
enum Alignment | enum Alignment | |||
{ | { | |||
Left = 0, | Left = 0, | |||
Middle, | Middle, | |||
Right | Right | |||
}; | }; | |||
/**Added in version 1.9*/ | ||||
enum ScaleBarUnits | ||||
{ | ||||
MapUnits = 0, | ||||
Meters, | ||||
Feet | ||||
}; | ||||
QgsComposerScaleBar( QgsComposition* composition ); | QgsComposerScaleBar( QgsComposition* composition ); | |||
~QgsComposerScaleBar(); | ~QgsComposerScaleBar(); | |||
/** return correct graphics item type. Added in v1.7 */ | /** return correct graphics item type. Added in v1.7 */ | |||
virtual int type() const { return ComposerScaleBar; } | virtual int type() const { return ComposerScaleBar; } | |||
/** \brief Reimplementation of QCanvasItem::paint*/ | /** \brief Reimplementation of QCanvasItem::paint*/ | |||
void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyl e, QWidget* pWidget ); | void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyl e, QWidget* pWidget ); | |||
//getters and setters | //getters and setters | |||
skipping to change at line 70 | skipping to change at line 79 | |||
void setNumUnitsPerSegment( double units ); | void setNumUnitsPerSegment( double units ); | |||
double numMapUnitsPerScaleBarUnit() const {return mNumMapUnitsPerScaleB arUnit;} | double numMapUnitsPerScaleBarUnit() const {return mNumMapUnitsPerScaleB arUnit;} | |||
void setNumMapUnitsPerScaleBarUnit( double d ) {mNumMapUnitsPerScaleBar Unit = d;} | void setNumMapUnitsPerScaleBarUnit( double d ) {mNumMapUnitsPerScaleBar Unit = d;} | |||
QString unitLabeling() const {return mUnitLabeling;} | QString unitLabeling() const {return mUnitLabeling;} | |||
void setUnitLabeling( const QString& label ) {mUnitLabeling = label;} | void setUnitLabeling( const QString& label ) {mUnitLabeling = label;} | |||
QFont font() const; | QFont font() const; | |||
QColor fontColor() const {return mFontColor;} | ||||
void setFontColor( const QColor& c ) {mFontColor = c;} | ||||
void setFont( const QFont& font ); | void setFont( const QFont& font ); | |||
QPen pen() const {return mPen;} | QPen pen() const {return mPen;} | |||
void setPen( const QPen& pen ) {mPen = pen;} | void setPen( const QPen& pen ) {mPen = pen;} | |||
QBrush brush() const {return mBrush;} | QBrush brush() const {return mBrush;} | |||
void setBrush( const QBrush& brush ) {mBrush = brush;} | void setBrush( const QBrush& brush ) {mBrush = brush;} | |||
double height() const {return mHeight;} | double height() const {return mHeight;} | |||
void setHeight( double h ) {mHeight = h;} | void setHeight( double h ) {mHeight = h;} | |||
skipping to change at line 97 | skipping to change at line 109 | |||
double boxContentSpace() const {return mBoxContentSpace;} | double boxContentSpace() const {return mBoxContentSpace;} | |||
void setBoxContentSpace( double space ); | void setBoxContentSpace( double space ); | |||
double segmentMillimeters() const {return mSegmentMillimeters;} | double segmentMillimeters() const {return mSegmentMillimeters;} | |||
/**Left / Middle/ Right | /**Left / Middle/ Right | |||
@note: this method was added in version 1.8*/ | @note: this method was added in version 1.8*/ | |||
Alignment alignment() const { return mAlignment; } | Alignment alignment() const { return mAlignment; } | |||
/**@note: this method was added in version 1.8*/ | /**@note: this method was added in version 1.8*/ | |||
void setAlignment( Alignment a ) { mAlignment = a; } | void setAlignment( Alignment a ); | |||
/**@note: this method was added in version 1.9*/ | ||||
ScaleBarUnits units() const { return mUnits; } | ||||
/**@note: this method was added in version 1.9*/ | ||||
void setUnits( ScaleBarUnits u ); | ||||
/**Apply default settings*/ | /**Apply default settings*/ | |||
void applyDefaultSettings(); | void applyDefaultSettings(); | |||
/**Apply default size (scale bar 1/5 of map item width) | /**Apply default size (scale bar 1/5 of map item width) | |||
@note this method was added in version 1.7*/ | @note this method was added in version 1.7*/ | |||
void applyDefaultSize(); | void applyDefaultSize(); | |||
/**Sets style by name | /**Sets style by name | |||
@param styleName (untranslated) style name. Possibilities are: 'Single Box', 'Double Box', 'Line Ticks Middle', 'Line Ticks Down', 'Line Ticks Up ', 'Numeric'*/ | @param styleName (untranslated) style name. Possibilities are: 'Single Box', 'Double Box', 'Line Ticks Middle', 'Line Ticks Down', 'Line Ticks Up ', 'Numeric'*/ | |||
void setStyle( const QString& styleName ); | void setStyle( const QString& styleName ); | |||
skipping to change at line 162 | skipping to change at line 180 | |||
int mNumSegmentsLeft; | int mNumSegmentsLeft; | |||
/**Size of a segment (in map units)*/ | /**Size of a segment (in map units)*/ | |||
double mNumUnitsPerSegment; | double mNumUnitsPerSegment; | |||
/**Number of map units per scale bar units (e.g. 1000 to have km for a map with m units)*/ | /**Number of map units per scale bar units (e.g. 1000 to have km for a map with m units)*/ | |||
double mNumMapUnitsPerScaleBarUnit; | double mNumMapUnitsPerScaleBarUnit; | |||
/**Labeling of map units*/ | /**Labeling of map units*/ | |||
QString mUnitLabeling; | QString mUnitLabeling; | |||
/**Font*/ | /**Font*/ | |||
QFont mFont; | QFont mFont; | |||
QColor mFontColor; | ||||
/**Outline*/ | /**Outline*/ | |||
QPen mPen; | QPen mPen; | |||
/**Fill*/ | /**Fill*/ | |||
QBrush mBrush; | QBrush mBrush; | |||
/**Height of bars/lines*/ | /**Height of bars/lines*/ | |||
double mHeight; | double mHeight; | |||
/**Scalebar style*/ | /**Scalebar style*/ | |||
QgsScaleBarStyle* mStyle; | QgsScaleBarStyle* mStyle; | |||
/**Space between bar and Text labels*/ | /**Space between bar and Text labels*/ | |||
double mLabelBarSpace; | double mLabelBarSpace; | |||
/**Space between content and item box*/ | /**Space between content and item box*/ | |||
double mBoxContentSpace; | double mBoxContentSpace; | |||
/**Width of a segment (in mm)*/ | /**Width of a segment (in mm)*/ | |||
double mSegmentMillimeters; | double mSegmentMillimeters; | |||
Alignment mAlignment; | Alignment mAlignment; | |||
ScaleBarUnits mUnits; | ||||
/**Calculates with of a segment in mm and stores it in mSegmentMillimet ers*/ | /**Calculates with of a segment in mm and stores it in mSegmentMillimet ers*/ | |||
void refreshSegmentMillimeters(); | void refreshSegmentMillimeters(); | |||
/**Returns diagonal of composer map in selected units (map units / mete | ||||
rs / feet)*/ | ||||
double mapWidth() const; | ||||
}; | }; | |||
#endif //QGSCOMPOSERSCALEBAR_H | #endif //QGSCOMPOSERSCALEBAR_H | |||
End of changes. 9 change blocks. | ||||
2 lines changed or deleted | 27 lines changed or added | |||
qgscomposershape.h | qgscomposershape.h | |||
---|---|---|---|---|
skipping to change at line 22 | skipping to change at line 22 | |||
* it under the terms of the GNU General Public License as published by * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCOMPOSERSHAPE_H | #ifndef QGSCOMPOSERSHAPE_H | |||
#define QGSCOMPOSERSHAPE_H | #define QGSCOMPOSERSHAPE_H | |||
#include "qgscomposeritem.h" | #include "qgscomposeritem.h" | |||
#include <QBrush> | ||||
#include <QPen> | ||||
/**A composer items that draws common shapes (ellipse, triangle, rectangle) */ | /**A composer items that draws common shapes (ellipse, triangle, rectangle) */ | |||
class CORE_EXPORT QgsComposerShape: public QgsComposerItem | class CORE_EXPORT QgsComposerShape: public QgsComposerItem | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
enum Shape | enum Shape | |||
{ | { | |||
Ellipse, | Ellipse, | |||
skipping to change at line 59 | skipping to change at line 61 | |||
*/ | */ | |||
bool writeXML( QDomElement& elem, QDomDocument & doc ) const; | bool writeXML( QDomElement& elem, QDomDocument & doc ) const; | |||
/** sets state from Dom document | /** sets state from Dom document | |||
* @param itemElem is Dom node corresponding to item tag | * @param itemElem is Dom node corresponding to item tag | |||
* @param doc is Dom document | * @param doc is Dom document | |||
*/ | */ | |||
bool readXML( const QDomElement& itemElem, const QDomDocument& doc ); | bool readXML( const QDomElement& itemElem, const QDomDocument& doc ); | |||
//setters and getters | //setters and getters | |||
void setLineWidth( double width ); | ||||
double lineWidth() const; | ||||
void setOutlineColor( const QColor& color ); | ||||
QColor outlineColor() const; | ||||
void setFillColor( const QColor& color ); | ||||
QColor fillColor() const; | ||||
QgsComposerShape::Shape shapeType() const {return mShape;} | QgsComposerShape::Shape shapeType() const {return mShape;} | |||
void setShapeType( QgsComposerShape::Shape s ) {mShape = s;} | void setShapeType( QgsComposerShape::Shape s ) {mShape = s;} | |||
bool transparentFill() const; | ||||
void setTransparentFill( bool transparent ); | ||||
/**Sets this items bound in scene coordinates such that 1 item size uni ts | /**Sets this items bound in scene coordinates such that 1 item size uni ts | |||
corresponds to 1 scene size unit. Also, the shape is scaled*/ | corresponds to 1 scene size unit. Also, the shape is scaled*/ | |||
void setSceneRect( const QRectF& rectangle ); | void setSceneRect( const QRectF& rectangle ); | |||
public slots: | public slots: | |||
/**Sets item rotation and resizes item bounds such that the shape alway s has the same size*/ | /**Sets item rotation and resizes item bounds such that the shape alway s has the same size*/ | |||
virtual void setRotation( double r ); | virtual void setRotation( double r ); | |||
protected: | ||||
/* reimplement drawFrame, since it's not a rect, but a custom shape */ | ||||
virtual void drawFrame( QPainter* p ); | ||||
/* reimplement drawBackground, since it's not a rect, but a custom shap | ||||
e */ | ||||
virtual void drawBackground( QPainter* p ); | ||||
private: | private: | |||
/**Ellipse, rectangle or triangle*/ | /**Ellipse, rectangle or triangle*/ | |||
Shape mShape; | Shape mShape; | |||
/**Shape outline*/ | ||||
QPen mPen; | ||||
/**Shape fill*/ | ||||
QBrush mBrush; | ||||
double mShapeWidth; | ||||
double mShapeHeight; | ||||
/**Apply default graphics settings*/ | /* draws the custom shape */ | |||
void initGraphicsSettings(); | void drawShape( QPainter* p ); | |||
/**Returns a point on the line from startPoint to directionPoint that i s a certain distance away from the starting point*/ | /**Returns a point on the line from startPoint to directionPoint that i s a certain distance away from the starting point*/ | |||
QPointF pointOnLineWithDistance( const QPointF& startPoint, const QPoin tF& directionPoint, double distance ) const; | QPointF pointOnLineWithDistance( const QPointF& startPoint, const QPoin tF& directionPoint, double distance ) const; | |||
}; | }; | |||
#endif // QGSCOMPOSERSHAPEITEM_H | #endif // QGSCOMPOSERSHAPEITEM_H | |||
End of changes. 6 change blocks. | ||||
16 lines changed or deleted | 11 lines changed or added | |||
qgscomposerview.h | qgscomposerview.h | |||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
class QKeyEvent; | class QKeyEvent; | |||
class QMainWindow; | class QMainWindow; | |||
class QMouseEvent; | class QMouseEvent; | |||
class QgsComposition; | class QgsComposition; | |||
class QgsComposerArrow; | class QgsComposerArrow; | |||
class QgsComposerItem; | class QgsComposerItem; | |||
class QgsComposerLabel; | class QgsComposerLabel; | |||
class QgsComposerLegend; | class QgsComposerLegend; | |||
class QgsComposerMap; | class QgsComposerMap; | |||
class QgsComposerPicture; | class QgsComposerPicture; | |||
class QgsComposerRuler; | ||||
class QgsComposerScaleBar; | class QgsComposerScaleBar; | |||
class QgsComposerShape; | class QgsComposerShape; | |||
class QgsComposerAttributeTable; | class QgsComposerAttributeTable; | |||
/** \ingroup MapComposer | /** \ingroup MapComposer | |||
* \ingroup gui | * \ingroup gui | |||
* Widget to display the composer items. Manages the composer tools and the | * Widget to display the composer items. Manages the composer tools and the | |||
* mouse/key events. | * mouse/key events. | |||
* Creates the composer items according to the current map tools and keeps track | * Creates the composer items according to the current map tools and keeps track | |||
* of the rubber band item. | * of the rubber band item. | |||
skipping to change at line 57 | skipping to change at line 58 | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
/**Current tool*/ | /**Current tool*/ | |||
enum Tool | enum Tool | |||
{ | { | |||
Select = 0, // Select/Move item | Select = 0, // Select/Move item | |||
AddArrow, //add arrow | AddArrow, //add arrow | |||
AddHtml, | ||||
AddMap, // add new map | AddMap, // add new map | |||
AddLegend, // add vector legend | AddLegend, // add vector legend | |||
AddLabel, // add label | AddLabel, // add label | |||
AddScalebar, // add scalebar | AddScalebar, // add scalebar | |||
AddPicture, // add raster/vector picture | AddPicture, // add raster/vector picture | |||
AddRectangle, | AddRectangle, | |||
AddEllipse, | AddEllipse, | |||
AddTriangle, | AddTriangle, | |||
AddTable, //add attribute table | AddTable, //add attribute table | |||
MoveItemContent //move content of item (e.g. content of map) | MoveItemContent //move content of item (e.g. content of map) | |||
skipping to change at line 91 | skipping to change at line 93 | |||
void setComposition( QgsComposition* c ); | void setComposition( QgsComposition* c ); | |||
/**Returns the composition or 0 in case of error*/ | /**Returns the composition or 0 in case of error*/ | |||
QgsComposition* composition(); | QgsComposition* composition(); | |||
/**Returns the composer main window*/ | /**Returns the composer main window*/ | |||
QMainWindow* composerWindow(); | QMainWindow* composerWindow(); | |||
void setPaintingEnabled( bool enabled ) { mPaintingEnabled = enabled; } | void setPaintingEnabled( bool enabled ) { mPaintingEnabled = enabled; } | |||
bool paintingEnabled() const { return mPaintingEnabled; } | bool paintingEnabled() const { return mPaintingEnabled; } | |||
/**Update rulers with current scene rect*/ | ||||
void updateRulers(); | ||||
void setHorizontalRuler( QgsComposerRuler* r ) { mHorizontalRuler = r; | ||||
} | ||||
void setVerticalRuler( QgsComposerRuler* r ) { mVerticalRuler = r; } | ||||
protected: | protected: | |||
void mousePressEvent( QMouseEvent* ); | void mousePressEvent( QMouseEvent* ); | |||
void mouseReleaseEvent( QMouseEvent* ); | void mouseReleaseEvent( QMouseEvent* ); | |||
void mouseMoveEvent( QMouseEvent* ); | void mouseMoveEvent( QMouseEvent* ); | |||
void mouseDoubleClickEvent( QMouseEvent* e ); | void mouseDoubleClickEvent( QMouseEvent* e ); | |||
void keyPressEvent( QKeyEvent * e ); | void keyPressEvent( QKeyEvent * e ); | |||
void keyReleaseEvent( QKeyEvent * e ); | ||||
void wheelEvent( QWheelEvent* event ); | void wheelEvent( QWheelEvent* event ); | |||
void paintEvent( QPaintEvent* event ); | void paintEvent( QPaintEvent* event ); | |||
void hideEvent( QHideEvent* e ); | void hideEvent( QHideEvent* e ); | |||
void showEvent( QShowEvent* e ); | void showEvent( QShowEvent* e ); | |||
void resizeEvent( QResizeEvent* event ); | ||||
void scrollContentsBy( int dx, int dy ); | ||||
private: | private: | |||
/**Status of shift key (used for multiple selection)*/ | ||||
bool mShiftKeyPressed; | ||||
/**Current composer tool*/ | /**Current composer tool*/ | |||
QgsComposerView::Tool mCurrentTool; | QgsComposerView::Tool mCurrentTool; | |||
/**Rubber band item*/ | /**Rubber band item*/ | |||
QGraphicsRectItem* mRubberBandItem; | QGraphicsRectItem* mRubberBandItem; | |||
/**Rubber band item for arrows*/ | /**Rubber band item for arrows*/ | |||
QGraphicsLineItem* mRubberBandLineItem; | QGraphicsLineItem* mRubberBandLineItem; | |||
/**Item to move content*/ | /**Item to move content*/ | |||
QgsComposerItem* mMoveContentItem; | QgsComposerItem* mMoveContentItem; | |||
/**Start position of content move*/ | /**Start position of content move*/ | |||
QPointF mMoveContentStartPos; | QPointF mMoveContentStartPos; | |||
/**Start of rubber band creation*/ | /**Start of rubber band creation*/ | |||
QPointF mRubberBandStartPos; | QPointF mRubberBandStartPos; | |||
bool mPaintingEnabled; | bool mPaintingEnabled; | |||
QgsComposerRuler* mHorizontalRuler; | ||||
QgsComposerRuler* mVerticalRuler; | ||||
/** Draw a shape on the canvas */ | /** Draw a shape on the canvas */ | |||
void addShape( Tool currentTool ); | void addShape( Tool currentTool ); | |||
//void connectAddRemoveCommandSignals( QgsAddRemoveItemCommand* c ); | //void connectAddRemoveCommandSignals( QgsAddRemoveItemCommand* c ); | |||
signals: | signals: | |||
/**Is emitted when selected item changed. If 0, no item is selected*/ | /**Is emitted when selected item changed. If 0, no item is selected*/ | |||
void selectedItemChanged( QgsComposerItem* selected ); | void selectedItemChanged( QgsComposerItem* selected ); | |||
/**Is emitted when a composer item has been removed from the scene*/ | ||||
void itemRemoved( QgsComposerItem* ); | void itemRemoved( QgsComposerItem* ); | |||
/**Current action (e.g. adding composer map) has been finished. The pur pose of this signal is that | /**Current action (e.g. adding composer map) has been finished. The pur pose of this signal is that | |||
QgsComposer may set the selection tool again*/ | QgsComposer may set the selection tool again*/ | |||
void actionFinished(); | void actionFinished(); | |||
/**Emitted before composerview is shown*/ | /**Emitted before composerview is shown*/ | |||
void composerViewShow( QgsComposerView* ); | void composerViewShow( QgsComposerView* ); | |||
/**Emitted before composerview is hidden*/ | /**Emitted before composerview is hidden*/ | |||
void composerViewHide( QgsComposerView* ); | void composerViewHide( QgsComposerView* ); | |||
}; | }; | |||
End of changes. 8 change blocks. | ||||
3 lines changed or deleted | 16 lines changed or added | |||
qgscomposition.h | qgscomposition.h | |||
---|---|---|---|---|
skipping to change at line 19 | skipping to change at line 19 | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCOMPOSITION_H | #ifndef QGSCOMPOSITION_H | |||
#define QGSCOMPOSITION_H | #define QGSCOMPOSITION_H | |||
#include "qgscomposeritem.h" | ||||
#include <memory> | ||||
#include <QDomDocument> | #include <QDomDocument> | |||
#include <QGraphicsScene> | #include <QGraphicsScene> | |||
#include <QLinkedList> | #include <QLinkedList> | |||
#include <QList> | ||||
#include <QPair> | ||||
#include <QSet> | ||||
#include <QUndoStack> | #include <QUndoStack> | |||
#include <QPrinter> | ||||
#include <QPainter> | ||||
#include "qgscomposeritemcommand.h" | ||||
#include "qgsaddremoveitemcommand.h" | #include "qgsaddremoveitemcommand.h" | |||
#include "qgscomposeritemcommand.h" | ||||
#include "qgsatlascomposition.h" | ||||
class QgsComposerItem; | class QgisApp; | |||
class QgsComposerFrame; | ||||
class QgsComposerMap; | class QgsComposerMap; | |||
class QgsPaperItem; | class QgsPaperItem; | |||
class QGraphicsRectItem; | class QGraphicsRectItem; | |||
class QgsMapRenderer; | class QgsMapRenderer; | |||
class QDomElement; | class QDomElement; | |||
class QgsComposerArrow; | class QgsComposerArrow; | |||
class QgsComposerHtml; | ||||
class QgsComposerItem; | class QgsComposerItem; | |||
class QgsComposerLabel; | class QgsComposerLabel; | |||
class QgsComposerLegend; | class QgsComposerLegend; | |||
class QgsComposerMap; | class QgsComposerMap; | |||
class QgsComposerPicture; | class QgsComposerPicture; | |||
class QgsComposerScaleBar; | class QgsComposerScaleBar; | |||
class QgsComposerShape; | class QgsComposerShape; | |||
class QgsComposerAttributeTable; | class QgsComposerAttributeTable; | |||
class QgsComposerMultiFrame; | ||||
class QgsComposerMultiFrameCommand; | ||||
class QgsVectorLayer; | ||||
class QgsComposer; | ||||
/** \ingroup MapComposer | /** \ingroup MapComposer | |||
* Graphics scene for map printing. The class manages the paper item which always | * Graphics scene for map printing. The class manages the paper item which always | |||
* is the item in the back (z-value 0). It maintains the z-Values of the it ems and stores | * is the item in the back (z-value 0). It maintains the z-Values of the it ems and stores | |||
* them in a list in ascending z-Order. This list can be changed to lower/r aise items one position | * them in a list in ascending z-Order. This list can be changed to lower/r aise items one position | |||
* or to bring them to front/back. | * or to bring them to front/back. | |||
* */ | * */ | |||
class CORE_EXPORT QgsComposition: public QGraphicsScene | class CORE_EXPORT QgsComposition : public QGraphicsScene | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
/** \brief Plot type */ | /** \brief Plot type */ | |||
enum PlotStyle | enum PlotStyle | |||
{ | { | |||
Preview = 0, // Use cache etc | Preview = 0, // Use cache etc | |||
Print, // Render well | Print, // Render well | |||
Postscript // Fonts need different scaling! | Postscript // Fonts need different scaling! | |||
skipping to change at line 82 | skipping to change at line 97 | |||
/**Changes size of paper item*/ | /**Changes size of paper item*/ | |||
void setPaperSize( double width, double height ); | void setPaperSize( double width, double height ); | |||
/**Returns height of paper item*/ | /**Returns height of paper item*/ | |||
double paperHeight() const; | double paperHeight() const; | |||
/**Returns width of paper item*/ | /**Returns width of paper item*/ | |||
double paperWidth() const; | double paperWidth() const; | |||
double spaceBetweenPages() const { return mSpaceBetweenPages; } | ||||
/**Note: added in version 1.9*/ | ||||
void setNumPages( int pages ); | ||||
/**Note: added in version 1.9*/ | ||||
int numPages() const; | ||||
void setSnapToGridEnabled( bool b ); | void setSnapToGridEnabled( bool b ); | |||
bool snapToGridEnabled() const {return mSnapToGrid;} | bool snapToGridEnabled() const {return mSnapToGrid;} | |||
void setSnapGridResolution( double r ); | void setSnapGridResolution( double r ); | |||
double snapGridResolution() const {return mSnapGridResolution;} | double snapGridResolution() const {return mSnapGridResolution;} | |||
void setSnapGridOffsetX( double offset ); | void setSnapGridOffsetX( double offset ); | |||
double snapGridOffsetX() const {return mSnapGridOffsetX;} | double snapGridOffsetX() const {return mSnapGridOffsetX;} | |||
void setSnapGridOffsetY( double offset ); | void setSnapGridOffsetY( double offset ); | |||
double snapGridOffsetY() const {return mSnapGridOffsetY;} | double snapGridOffsetY() const {return mSnapGridOffsetY;} | |||
void setGridPen( const QPen& p ); | void setGridPen( const QPen& p ); | |||
const QPen& gridPen() const {return mGridPen;} | const QPen& gridPen() const {return mGridPen;} | |||
void setGridStyle( GridStyle s ); | void setGridStyle( GridStyle s ); | |||
GridStyle gridStyle() const {return mGridStyle;} | GridStyle gridStyle() const {return mGridStyle;} | |||
void setAlignmentSnap( bool s ) { mAlignmentSnap = s; } | ||||
bool alignmentSnap() const { return mAlignmentSnap; } | ||||
void setAlignmentSnapTolerance( double t ) { mAlignmentSnapTolerance = | ||||
t; } | ||||
double alignmentSnapTolerance() const { return mAlignmentSnapTolerance; | ||||
} | ||||
/**Returns pointer to undo/redo command storage*/ | /**Returns pointer to undo/redo command storage*/ | |||
QUndoStack* undoStack() { return &mUndoStack; } | QUndoStack* undoStack() { return &mUndoStack; } | |||
/**Returns the topmost composer item. Ignores mPaperItem*/ | /**Returns the topmost composer item. Ignores mPaperItem*/ | |||
QgsComposerItem* composerItemAt( const QPointF & position ); | QgsComposerItem* composerItemAt( const QPointF & position ); | |||
/** Returns the page number (0-bsaed) given a coordinate */ | ||||
int pageNumberAt( const QPointF& position ) const; | ||||
/** Returns on which page number (0-based) is displayed an item */ | ||||
int itemPageNumber( const QgsComposerItem* ) const; | ||||
QList<QgsComposerItem*> selectedComposerItems(); | QList<QgsComposerItem*> selectedComposerItems(); | |||
/**Returns pointers to all composer maps in the scene*/ | /**Returns pointers to all composer maps in the scene | |||
@note available in python bindings only with PyQt >= 4.8.4 | ||||
*/ | ||||
QList<const QgsComposerMap*> composerMapItems() const; | QList<const QgsComposerMap*> composerMapItems() const; | |||
/**Return composer items of a specific type | ||||
@note not available in python bindings | ||||
*/ | ||||
template<class T> void composerItems( QList<T*>& itemList ); | ||||
/**Returns the composer map with specified id | /**Returns the composer map with specified id | |||
@return id or 0 pointer if the composer map item does not exist*/ | @return QgsComposerMap or 0 pointer if the composer map item does not exist*/ | |||
const QgsComposerMap* getComposerMapById( int id ) const; | const QgsComposerMap* getComposerMapById( int id ) const; | |||
/*Returns the composer html with specified id (a string as named in the | ||||
composer user interface item properties). | ||||
@note Added in QGIS 2.0 | ||||
@param id - A QString representing the id of the item. | ||||
@return QgsComposerHtml pointer or 0 pointer if no such item exists. | ||||
*/ | ||||
const QgsComposerHtml* getComposerHtmlByItem( QgsComposerItem *item ) c | ||||
onst; | ||||
/**Returns a composer item given its text identifier. | ||||
Ids are not necessarely unique, but this function returns only one e | ||||
lement. | ||||
@note added in 2.0 | ||||
@param theId - A QString representing the identifier of the item to | ||||
retrieve. | ||||
@return QgsComposerItem pointer or 0 pointer if no such item exists. | ||||
**/ | ||||
const QgsComposerItem* getComposerItemById( QString theId ) const; | ||||
/**Returns a composer item given its unique identifier. | ||||
@note added in 2.0 | ||||
@param theUuid A QString representing the UUID of the item to | ||||
**/ | ||||
const QgsComposerItem* getComposerItemByUuid( QString theUuid ) const; | ||||
int printResolution() const {return mPrintResolution;} | int printResolution() const {return mPrintResolution;} | |||
void setPrintResolution( int dpi ) {mPrintResolution = dpi;} | void setPrintResolution( int dpi ) {mPrintResolution = dpi;} | |||
bool printAsRaster() const {return mPrintAsRaster;} | bool printAsRaster() const {return mPrintAsRaster;} | |||
void setPrintAsRaster( bool enabled ) { mPrintAsRaster = enabled; } | void setPrintAsRaster( bool enabled ) { mPrintAsRaster = enabled; } | |||
/**Returns true if a composition should use advanced effects such as bl | ||||
end modes | ||||
@note added in 1.9*/ | ||||
bool useAdvancedEffects() const {return mUseAdvancedEffects;} | ||||
/**Used to enable or disable advanced effects such as blend modes in a | ||||
composition | ||||
@note: added in version 1.9*/ | ||||
void setUseAdvancedEffects( bool effectsEnabled ); | ||||
double selectionTolerance() const { return mSelectionTolerance; } | double selectionTolerance() const { return mSelectionTolerance; } | |||
void setSelectionTolerance( double tol ); | void setSelectionTolerance( double tol ); | |||
/**Returns pointer to map renderer of qgis map canvas*/ | /**Returns pointer to map renderer of qgis map canvas*/ | |||
QgsMapRenderer* mapRenderer() {return mMapRenderer;} | QgsMapRenderer* mapRenderer() {return mMapRenderer;} | |||
QgsComposition::PlotStyle plotStyle() const {return mPlotStyle;} | QgsComposition::PlotStyle plotStyle() const {return mPlotStyle;} | |||
void setPlotStyle( QgsComposition::PlotStyle style ) {mPlotStyle = styl e;} | void setPlotStyle( QgsComposition::PlotStyle style ) {mPlotStyle = styl e;} | |||
/**Returns the pixel font size for a font that has point size set. | /**Returns the pixel font size for a font that has point size set. | |||
skipping to change at line 144 | skipping to change at line 215 | |||
/**Does the inverse calculation and returns points for pixels (equals t o mm in QgsComposition)*/ | /**Does the inverse calculation and returns points for pixels (equals t o mm in QgsComposition)*/ | |||
double pointFontSize( int pixelSize ) const; | double pointFontSize( int pixelSize ) const; | |||
/**Writes settings to xml (paper dimension)*/ | /**Writes settings to xml (paper dimension)*/ | |||
bool writeXML( QDomElement& composerElem, QDomDocument& doc ); | bool writeXML( QDomElement& composerElem, QDomDocument& doc ); | |||
/**Reads settings from xml file*/ | /**Reads settings from xml file*/ | |||
bool readXML( const QDomElement& compositionElem, const QDomDocument& d oc ); | bool readXML( const QDomElement& compositionElem, const QDomDocument& d oc ); | |||
/**Load a template document | ||||
@param doc template document | ||||
@param substitutionMap map with text to replace. Text needs to be e | ||||
nclosed by brackets (e.g. '[text]' ) | ||||
@param addUndoCommands whether or not to add undo commands | ||||
*/ | ||||
bool loadFromTemplate( const QDomDocument& doc, QMap<QString, QString>* | ||||
substitutionMap = 0, bool addUndoCommands = false ); | ||||
/**Add items from XML representation to the graphics scene (for project file reading, pasting items from clipboard) | /**Add items from XML representation to the graphics scene (for project file reading, pasting items from clipboard) | |||
@param elem items parent element, e.g. \verbatim <Composer> \endverba tim or \verbatim <ComposerItemClipboard> \endverbatim | @param elem items parent element, e.g. \verbatim <Composer> \endverba tim or \verbatim <ComposerItemClipboard> \endverbatim | |||
@param doc xml document | @param doc xml document | |||
@param mapsToRestore for reading from project file: set preview move 'rectangle' to all maps and save the preview states to show composer maps o n demand | @param mapsToRestore for reading from project file: set preview move 'rectangle' to all maps and save the preview states to show composer maps o n demand | |||
@param addUndoCommands insert AddItem commands if true (e.g. for copy /paste) | @param addUndoCommands insert AddItem commands if true (e.g. for copy /paste) | |||
@param pos item position. Optional, take position from xml if 0*/ | @param pos item position. Optional, take position from xml if 0 | |||
@param pasteInPlace whether the position should be kept but mapped to | ||||
the page origin. (the page is the page under to the mouse cursor) | ||||
@note not available in python bindings | ||||
*/ | ||||
void addItemsFromXML( const QDomElement& elem, const QDomDocument& doc, QMap< QgsComposerMap*, int >* mapsToRestore = 0, | void addItemsFromXML( const QDomElement& elem, const QDomDocument& doc, QMap< QgsComposerMap*, int >* mapsToRestore = 0, | |||
bool addUndoCommands = false, QPointF* pos = 0 ); | bool addUndoCommands = false, QPointF* pos = 0, b ool pasteInPlace = false ); | |||
/**Adds item to z list. Usually called from constructor of QgsComposerI tem*/ | /**Adds item to z list. Usually called from constructor of QgsComposerI tem*/ | |||
void addItemToZList( QgsComposerItem* item ); | void addItemToZList( QgsComposerItem* item ); | |||
/**Removes item from z list. Usually called from destructor of QgsCompo serItem*/ | /**Removes item from z list. Usually called from destructor of QgsCompo serItem*/ | |||
void removeItemFromZList( QgsComposerItem* item ); | void removeItemFromZList( QgsComposerItem* item ); | |||
//functions to move selected items in hierarchy | //functions to move selected items in hierarchy | |||
void raiseSelectedItems(); | void raiseSelectedItems(); | |||
void raiseItem( QgsComposerItem* item ); | void raiseItem( QgsComposerItem* item ); | |||
void lowerSelectedItems(); | void lowerSelectedItems(); | |||
skipping to change at line 183 | skipping to change at line 264 | |||
void alignSelectedItemsVCenter(); | void alignSelectedItemsVCenter(); | |||
void alignSelectedItemsBottom(); | void alignSelectedItemsBottom(); | |||
/**Sorts the zList. The only time where this function needs to be calle d is from QgsComposer | /**Sorts the zList. The only time where this function needs to be calle d is from QgsComposer | |||
after reading all the items from xml file*/ | after reading all the items from xml file*/ | |||
void sortZList(); | void sortZList(); | |||
/**Snaps a scene coordinate point to grid*/ | /**Snaps a scene coordinate point to grid*/ | |||
QPointF snapPointToGrid( const QPointF& scenePoint ) const; | QPointF snapPointToGrid( const QPointF& scenePoint ) const; | |||
/**Snaps item position to align with other items (left / middle / right | ||||
or top / middle / bottom | ||||
@param item current item | ||||
@param alignX x-coordinate of align or -1 if not aligned to x | ||||
@param alignY y-coordinate of align or -1 if not aligned to y | ||||
@param dx item shift in x direction | ||||
@param dy item shift in y direction | ||||
@return new upper left point after the align*/ | ||||
QPointF alignItem( const QgsComposerItem* item, double& alignX, double& | ||||
alignY, double dx = 0, double dy = 0 ); | ||||
/**Snaps position to align with the boundaries of other items | ||||
@param pos position to snap | ||||
@param excludeItem item to exclude | ||||
@param alignX snapped x coordinate or -1 if not snapped | ||||
@param alignY snapped y coordinate or -1 if not snapped | ||||
@return snapped position or original position if no snap*/ | ||||
QPointF alignPos( const QPointF& pos, const QgsComposerItem* excludeIte | ||||
m, double& alignX, double& alignY ); | ||||
/**Add a custom snap line (can be horizontal or vertical)*/ | ||||
QGraphicsLineItem* addSnapLine(); | ||||
/**Remove custom snap line (and delete the object)*/ | ||||
void removeSnapLine( QGraphicsLineItem* line ); | ||||
/**Get nearest snap line | ||||
* @note not available in python bindings | ||||
*/ | ||||
QGraphicsLineItem* nearestSnapLine( bool horizontal, double x, double y | ||||
, double tolerance, QList< QPair< QgsComposerItem*, QgsComposerItem::ItemPo | ||||
sitionMode > >& snappedItems ); | ||||
/**Hides / shows custom snap lines*/ | ||||
void setSnapLinesVisible( bool visible ); | ||||
/**Allocates new item command and saves initial state in it | /**Allocates new item command and saves initial state in it | |||
@param item target item | @param item target item | |||
@param commandText descriptive command text | @param commandText descriptive command text | |||
@param c context for merge commands (unknown for non-mergeable comman ds)*/ | @param c context for merge commands (unknown for non-mergeable comman ds)*/ | |||
void beginCommand( QgsComposerItem* item, const QString& commandText, Q gsComposerMergeCommand::Context c = QgsComposerMergeCommand::Unknown ); | void beginCommand( QgsComposerItem* item, const QString& commandText, Q gsComposerMergeCommand::Context c = QgsComposerMergeCommand::Unknown ); | |||
/**Saves end state of item and pushes command to the undo history*/ | /**Saves end state of item and pushes command to the undo history*/ | |||
void endCommand(); | void endCommand(); | |||
/**Deletes current command*/ | /**Deletes current command*/ | |||
void cancelCommand(); | void cancelCommand(); | |||
/**Adds an arrow item to the graphics scene and advices composer to cre | void beginMultiFrameCommand( QgsComposerMultiFrame* multiFrame, const Q | |||
ate a widget for it (through signal)*/ | String& text ); | |||
void endMultiFrameCommand(); | ||||
/**Adds multiframe. The object is owned by QgsComposition until removeM | ||||
ultiFrame is called*/ | ||||
void addMultiFrame( QgsComposerMultiFrame* multiFrame ); | ||||
/**Removes multi frame (but does not delete it)*/ | ||||
void removeMultiFrame( QgsComposerMultiFrame* multiFrame ); | ||||
/**Adds an arrow item to the graphics scene and advices composer to cre | ||||
ate a widget for it (through signal) | ||||
@note not available in python bindings*/ | ||||
void addComposerArrow( QgsComposerArrow* arrow ); | void addComposerArrow( QgsComposerArrow* arrow ); | |||
/**Adds label to the graphics scene and advices composer to create a wi dget for it (through signal)*/ | /**Adds label to the graphics scene and advices composer to create a wi dget for it (through signal)*/ | |||
void addComposerLabel( QgsComposerLabel* label ); | void addComposerLabel( QgsComposerLabel* label ); | |||
/**Adds map to the graphics scene and advices composer to create a widg et for it (through signal)*/ | /**Adds map to the graphics scene and advices composer to create a widg et for it (through signal)*/ | |||
void addComposerMap( QgsComposerMap* map, bool setDefaultPreviewStyle = true ); | void addComposerMap( QgsComposerMap* map, bool setDefaultPreviewStyle = true ); | |||
/**Adds scale bar to the graphics scene and advices composer to create a widget for it (through signal)*/ | /**Adds scale bar to the graphics scene and advices composer to create a widget for it (through signal)*/ | |||
void addComposerScaleBar( QgsComposerScaleBar* scaleBar ); | void addComposerScaleBar( QgsComposerScaleBar* scaleBar ); | |||
/**Adds legend to the graphics scene and advices composer to create a w idget for it (through signal)*/ | /**Adds legend to the graphics scene and advices composer to create a w idget for it (through signal)*/ | |||
void addComposerLegend( QgsComposerLegend* legend ); | void addComposerLegend( QgsComposerLegend* legend ); | |||
/**Adds picture to the graphics scene and advices composer to create a widget for it (through signal)*/ | /**Adds picture to the graphics scene and advices composer to create a widget for it (through signal)*/ | |||
void addComposerPicture( QgsComposerPicture* picture ); | void addComposerPicture( QgsComposerPicture* picture ); | |||
/**Adds a composer shape to the graphics scene and advices composer to create a widget for it (through signal)*/ | /**Adds a composer shape to the graphics scene and advices composer to create a widget for it (through signal)*/ | |||
void addComposerShape( QgsComposerShape* shape ); | void addComposerShape( QgsComposerShape* shape ); | |||
/**Adds a composer table to the graphics scene and advices composer to create a widget for it (through signal)*/ | /**Adds a composer table to the graphics scene and advices composer to create a widget for it (through signal)*/ | |||
void addComposerTable( QgsComposerAttributeTable* table ); | void addComposerTable( QgsComposerAttributeTable* table ); | |||
/**Adds composer html frame and advices composer to create a widget for | ||||
it (through signal)*/ | ||||
void addComposerHtmlFrame( QgsComposerHtml* html, QgsComposerFrame* fra | ||||
me ); | ||||
/**Remove item from the graphics scene. Additionally to QGraphicsScene: :removeItem, this function considers undo/redo command*/ | /**Remove item from the graphics scene. Additionally to QGraphicsScene: :removeItem, this function considers undo/redo command*/ | |||
void removeComposerItem( QgsComposerItem* item ); | void removeComposerItem( QgsComposerItem* item, bool createCommand = tr ue ); | |||
/**Convenience function to create a QgsAddRemoveItemCommand, connect it s signals and push it to the undo stack*/ | /**Convenience function to create a QgsAddRemoveItemCommand, connect it s signals and push it to the undo stack*/ | |||
void pushAddRemoveCommand( QgsComposerItem* item, const QString& text, QgsAddRemoveItemCommand::State state = QgsAddRemoveItemCommand::Added ); | void pushAddRemoveCommand( QgsComposerItem* item, const QString& text, QgsAddRemoveItemCommand::State state = QgsAddRemoveItemCommand::Added ); | |||
//printing | ||||
/** Prepare the printer for printing */ | ||||
void beginPrint( QPrinter& printer ); | ||||
/** Prepare the printer for printing in a PDF */ | ||||
void beginPrintAsPDF( QPrinter& printer, const QString& file ); | ||||
/** Print on a preconfigured printer */ | ||||
void doPrint( QPrinter& printer, QPainter& painter ); | ||||
/** Convenience function that prepares the printer and prints */ | ||||
void print( QPrinter &printer ); | ||||
/** Convenience function that prepares the printer for printing in PDF | ||||
and prints */ | ||||
void exportAsPDF( const QString& file ); | ||||
//! print composer page to image | ||||
//! If the image does not fit into memory, a null image is returned | ||||
QImage printPageAsRaster( int page ); | ||||
/**Render a page to a paint device | ||||
@note added in version 1.9*/ | ||||
void renderPage( QPainter* p, int page ); | ||||
QgsAtlasComposition& atlasComposition() { return mAtlasComposition; } | ||||
public slots: | public slots: | |||
/**Casts object to the proper subclass type and calls corresponding ite mAdded signal*/ | /**Casts object to the proper subclass type and calls corresponding ite mAdded signal*/ | |||
void sendItemAddedSignal( QgsComposerItem* item ); | void sendItemAddedSignal( QgsComposerItem* item ); | |||
private: | private: | |||
/**Pointer to map renderer of QGIS main map*/ | /**Pointer to map renderer of QGIS main map*/ | |||
QgsMapRenderer* mMapRenderer; | QgsMapRenderer* mMapRenderer; | |||
QgsComposition::PlotStyle mPlotStyle; | QgsComposition::PlotStyle mPlotStyle; | |||
QgsPaperItem* mPaperItem; | double mPageWidth; | |||
double mPageHeight; | ||||
QList< QgsPaperItem* > mPages; | ||||
double mSpaceBetweenPages; //space in preview between pages | ||||
/**Maintains z-Order of items. Starts with item at position 1 (position 0 is always paper item)*/ | /**Maintains z-Order of items. Starts with item at position 1 (position 0 is always paper item)*/ | |||
QLinkedList<QgsComposerItem*> mItemZList; | QLinkedList<QgsComposerItem*> mItemZList; | |||
/**List multiframe objects*/ | ||||
QSet<QgsComposerMultiFrame*> mMultiFrames; | ||||
/**Dpi for printout*/ | /**Dpi for printout*/ | |||
int mPrintResolution; | int mPrintResolution; | |||
/**Flag if map should be printed as a raster (via QImage). False by def ault*/ | /**Flag if map should be printed as a raster (via QImage). False by def ault*/ | |||
bool mPrintAsRaster; | bool mPrintAsRaster; | |||
/**Flag if advanced visual effects such as blend modes should be used. | ||||
True by default*/ | ||||
bool mUseAdvancedEffects; | ||||
/**Distance tolerance for item selection (in mm)*/ | /**Distance tolerance for item selection (in mm)*/ | |||
double mSelectionTolerance; | double mSelectionTolerance; | |||
/**Parameters for snap to grid function*/ | /**Parameters for snap to grid function*/ | |||
bool mSnapToGrid; | bool mSnapToGrid; | |||
double mSnapGridResolution; | double mSnapGridResolution; | |||
double mSnapGridOffsetX; | double mSnapGridOffsetX; | |||
double mSnapGridOffsetY; | double mSnapGridOffsetY; | |||
QPen mGridPen; | QPen mGridPen; | |||
GridStyle mGridStyle; | GridStyle mGridStyle; | |||
/**Parameters for alignment snap*/ | ||||
bool mAlignmentSnap; | ||||
double mAlignmentSnapTolerance; | ||||
/**Arbitraty snap lines (horizontal and vertical)*/ | ||||
QList< QGraphicsLineItem* > mSnapLines; | ||||
QUndoStack mUndoStack; | QUndoStack mUndoStack; | |||
QgsComposerItemCommand* mActiveCommand; | QgsComposerItemCommand* mActiveItemCommand; | |||
QgsComposerMultiFrameCommand* mActiveMultiFrameCommand; | ||||
/** The atlas composition object. It is held by the QgsComposition */ | ||||
QgsAtlasComposition mAtlasComposition; | ||||
QgsComposition(); //default constructor is forbidden | QgsComposition(); //default constructor is forbidden | |||
/**Reset z-values of items based on position in z list*/ | /**Reset z-values of items based on position in z list*/ | |||
void updateZValues(); | void updateZValues(); | |||
/**Returns the bounding rectangle of the selected items in scene coordi nates | /**Returns the bounding rectangle of the selected items in scene coordi nates | |||
@return 0 in case of success*/ | @return 0 in case of success*/ | |||
int boundingRectOfSelectedItems( QRectF& bRect ); | int boundingRectOfSelectedItems( QRectF& bRect ); | |||
void loadSettings(); | void loadSettings(); | |||
void saveSettings(); | void saveSettings(); | |||
void connectAddRemoveCommandSignals( QgsAddRemoveItemCommand* c ); | void connectAddRemoveCommandSignals( QgsAddRemoveItemCommand* c ); | |||
void updatePaperItems(); | ||||
void addPaperItem(); | ||||
void removePaperItems(); | ||||
void deleteAndRemoveMultiFrames(); | ||||
static QString encodeStringForXML( const QString& str ); | ||||
//helper functions for item align | ||||
void collectAlignCoordinates( QMap< double, const QgsComposerItem* >& a | ||||
lignCoordsX, | ||||
QMap< double, const QgsComposerItem* >& a | ||||
lignCoordsY, const QgsComposerItem* excludeItem ); | ||||
void checkNearestItem( double checkCoord, const QMap< double, const Qgs | ||||
ComposerItem* >& alignCoords, double& smallestDiff, | ||||
double itemCoordOffset, double& itemCoord, doubl | ||||
e& alignCoord ) const; | ||||
/**Find nearest item in coordinate map to a double. | ||||
@return true if item found, false if coords is empty*/ | ||||
static bool nearestItem( const QMap< double, const QgsComposerItem* >& | ||||
coords, double value, double& nearestValue ); | ||||
signals: | signals: | |||
void paperSizeChanged(); | void paperSizeChanged(); | |||
void nPagesChanged(); | ||||
/**Is emitted when selected item changed. If 0, no item is selected*/ | /**Is emitted when selected item changed. If 0, no item is selected*/ | |||
void selectedItemChanged( QgsComposerItem* selected ); | void selectedItemChanged( QgsComposerItem* selected ); | |||
/**Is emitted when new composer arrow has been added to the view*/ | /**Is emitted when new composer arrow has been added to the view*/ | |||
void composerArrowAdded( QgsComposerArrow* arrow ); | void composerArrowAdded( QgsComposerArrow* arrow ); | |||
/**Is emitted when a new composer html has been added to the view*/ | ||||
void composerHtmlFrameAdded( QgsComposerHtml* html, QgsComposerFrame* f | ||||
rame ); | ||||
/**Is emitted when new composer label has been added to the view*/ | /**Is emitted when new composer label has been added to the view*/ | |||
void composerLabelAdded( QgsComposerLabel* label ); | void composerLabelAdded( QgsComposerLabel* label ); | |||
/**Is emitted when new composer map has been added to the view*/ | /**Is emitted when new composer map has been added to the view*/ | |||
void composerMapAdded( QgsComposerMap* map ); | void composerMapAdded( QgsComposerMap* map ); | |||
/**Is emitted when new composer scale bar has been added*/ | /**Is emitted when new composer scale bar has been added*/ | |||
void composerScaleBarAdded( QgsComposerScaleBar* scalebar ); | void composerScaleBarAdded( QgsComposerScaleBar* scalebar ); | |||
/**Is emitted when a new composer legend has been added*/ | /**Is emitted when a new composer legend has been added*/ | |||
void composerLegendAdded( QgsComposerLegend* legend ); | void composerLegendAdded( QgsComposerLegend* legend ); | |||
/**Is emitted when a new composer picture has been added*/ | /**Is emitted when a new composer picture has been added*/ | |||
void composerPictureAdded( QgsComposerPicture* picture ); | void composerPictureAdded( QgsComposerPicture* picture ); | |||
/**Is emitted when a new composer shape has been added*/ | /**Is emitted when a new composer shape has been added*/ | |||
void composerShapeAdded( QgsComposerShape* shape ); | void composerShapeAdded( QgsComposerShape* shape ); | |||
/**Is emitted when a new composer table has been added*/ | /**Is emitted when a new composer table has been added*/ | |||
void composerTableAdded( QgsComposerAttributeTable* table ); | void composerTableAdded( QgsComposerAttributeTable* table ); | |||
/**Is emitted when a composer item has been removed from the scene*/ | /**Is emitted when a composer item has been removed from the scene*/ | |||
void itemRemoved( QgsComposerItem* ); | void itemRemoved( QgsComposerItem* ); | |||
}; | }; | |||
template<class T> void QgsComposition::composerItems( QList<T*>& itemList ) | ||||
{ | ||||
itemList.clear(); | ||||
QList<QGraphicsItem *> graphicsItemList = items(); | ||||
QList<QGraphicsItem *>::iterator itemIt = graphicsItemList.begin(); | ||||
for ( ; itemIt != graphicsItemList.end(); ++itemIt ) | ||||
{ | ||||
T* item = dynamic_cast<T*>( *itemIt ); | ||||
if ( item ) | ||||
{ | ||||
itemList.push_back( item ); | ||||
} | ||||
} | ||||
} | ||||
#endif | #endif | |||
End of changes. 34 change blocks. | ||||
12 lines changed or deleted | 238 lines changed or added | |||
qgsconfig.h | qgsconfig.h | |||
---|---|---|---|---|
// QGSCONFIG.H | // QGSCONFIG.H | |||
#ifndef QGSCONFIG_H | #ifndef QGSCONFIG_H | |||
#define QGSCONFIG_H | #define QGSCONFIG_H | |||
// Version must be specified according to | // Version must be specified according to | |||
// <int>.<int>.<int>-<any text>. | // <int>.<int>.<int>-<any text>. | |||
// or else upgrading old project file will not work | // or else upgrading old project file will not work | |||
// reliably. | // reliably. | |||
#define VERSION "1.8.0-Lisboa" | #define VERSION "2.0.0-Dufour" | |||
//used in vim src/core/qgis.cpp | //used in vim src/core/qgis.cpp | |||
//The way below should work but it resolves to a number like 0110 which the compiler treats as octal I think | //The way below should work but it resolves to a number like 0110 which the compiler treats as octal I think | |||
//because debuggin it out shows the decimal number 72 which results in inco rrect version status. | //because debuggin it out shows the decimal number 72 which results in inco rrect version status. | |||
//As a short term fix I (Tim) am defining the version in top level cmake. I t would be good to | //As a short term fix I (Tim) am defining the version in top level cmake. I t would be good to | |||
//reinstate this more generic approach below at some point though | //reinstate this more generic approach below at some point though | |||
//#define VERSION_INT 180 | //#define VERSION_INT 200 | |||
#define VERSION_INT 10800 | #define VERSION_INT 20000 | |||
#define ABISYM(x) x ## 20000 | ||||
//used in main.cpp and anywhere else where the release name is needed | //used in main.cpp and anywhere else where the release name is needed | |||
#define RELEASE_NAME "Lisboa" | #define RELEASE_NAME "Dufour" | |||
#define QGIS_PLUGIN_SUBDIR "lib/qgis/plugins" | #define QGIS_PLUGIN_SUBDIR "lib/qgis/plugins" | |||
#define QGIS_DATA_SUBDIR "share/qgis" | #define QGIS_DATA_SUBDIR "share/qgis" | |||
#define QGIS_LIBEXEC_SUBDIR "lib/qgis" | #define QGIS_LIBEXEC_SUBDIR "lib/qgis" | |||
#define QGIS_LIB_SUBDIR "lib" | #define QGIS_LIB_SUBDIR "lib" | |||
#define CMAKE_INSTALL_PREFIX "/home/andrey/upstream-tracker/testing/qgis/1. | #define CMAKE_INSTALL_PREFIX "/home/ut/testing/qgis/2.0.0" | |||
8.0" | #define CMAKE_SOURCE_DIR "/home/ut/repository/qgis/install/qgis-2.0.0" | |||
#define CMAKE_SOURCE_DIR "/home/andrey/upstream-tracker/repository/qgis/qgi | ||||
s-1.8.0" | #define QSCINTILLA_VERSION_STR "2.5.1" | |||
//used by Mac to find system Qt plugins when bundle is run from build direc | ||||
tory | ||||
#define QTPLUGINSDIR "/usr/plugins" | ||||
/* #undef USING_NMAKE */ | ||||
#define HAVE_POSTGRESQL | #define HAVE_POSTGRESQL | |||
#define HAVE_SPATIALITE | #define HAVE_SPATIALITE | |||
#define HAVE_MSSQL | #define HAVE_MSSQL | |||
/* #undef HAVE_ORACLE */ | ||||
/* #undef HAVE_PYTHON */ | /* #undef HAVE_PYTHON */ | |||
/* #undef HAVE_TOUCH */ | ||||
/* #undef HAVE_OSGEARTHQT */ | ||||
/* #undef MAPSERVER_SKIP_ECW */ | ||||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
8 lines changed or deleted | 22 lines changed or added | |||
qgscontexthelp.h | qgscontexthelp.h | |||
---|---|---|---|---|
skipping to change at line 21 | skipping to change at line 21 | |||
/************************************************************************** * | /************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCONTEXTHELP_H | #ifndef QGSCONTEXTHELP_H | |||
#define QGSCONTEXTHELP_H | #define QGSCONTEXTHELP_H | |||
#include <QObject> | ||||
class QProcess; | #include <QObject> | |||
class QTcpSocket; | #include <QHash> | |||
#include <QProcess> | ||||
#ifdef Q_OS_MACX | ||||
#define QGSCONTEXTHELP_REUSE 1 | ||||
#endif | ||||
/** \ingroup core | /** \ingroup core | |||
* Provides a context based help browser for a dialog. | * Provides a context based help browser for a dialog. | |||
* | * | |||
* The help text is stored in SQLite and accessed by a context identifier | * The help text is stored in SQLite and accessed by a context identifier | |||
* unique to each dialog. This is a singleton class which invokes the help | * unique to each dialog. This is a singleton class which invokes the help | |||
* viewer using QProcess and ensures that only one viewer is open. | * viewer using QProcess and ensures that only one viewer is open. | |||
* The viewer will be terminated if open when the main application quits. | * The viewer will be terminated if open when the main application quits. | |||
* | * | |||
* If the compile-time flag QGSCONTEXTHELP_REUSE is defined, the help viewe | ||||
r | ||||
* will be reused if it is still open. If this flag is not set, the viewer | ||||
* process will be terminated if open and restarted; this makes it the top | ||||
* window for window managers such as Linux/GNOME which will make a window | ||||
* active but not bring it to the top if raised programatically. | ||||
*/ | */ | |||
class CORE_EXPORT QgsContextHelp : public QObject | class CORE_EXPORT QgsContextHelp : public QObject | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
static void run( QString context ); | static void run( QString context ); | |||
private slots: | private slots: | |||
void readPort(); | ||||
void processExited(); | void processExited(); | |||
void error( QProcess::ProcessError error ); | ||||
private: | private: | |||
//! Constructor | //! Constructor | |||
QgsContextHelp( QString context ); | QgsContextHelp(); | |||
//! Destructor | //! Destructor | |||
~QgsContextHelp(); | ~QgsContextHelp(); | |||
QProcess *start( QString context ); | QProcess *start(); | |||
void showContext( QString context ); | void showContext( QString context ); | |||
static QgsContextHelp *gContextHelp; // Singleton instance | static QgsContextHelp *gContextHelp; // Singleton instance | |||
QProcess *mProcess; | QProcess *mProcess; | |||
#ifdef QGSCONTEXTHELP_REUSE | ||||
// Communications socket when reusing existing process | static QHash<QString, QString> gContextHelpTexts; | |||
QTcpSocket *mSocket; | ||||
#else | void init(); | |||
// Replacement process when terminating and restarting | ||||
QProcess *mNextProcess; | ||||
#endif | ||||
}; | }; | |||
#endif //QGSCONTEXTHELP_H | #endif //QGSCONTEXTHELP_H | |||
End of changes. 9 change blocks. | ||||
22 lines changed or deleted | 10 lines changed or added | |||
qgscontrastenhancement.h | qgscontrastenhancement.h | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCONTRASTENHANCEMENT_H | #ifndef QGSCONTRASTENHANCEMENT_H | |||
#define QGSCONTRASTENHANCEMENT_H | #define QGSCONTRASTENHANCEMENT_H | |||
#include <limits> | #include <limits> | |||
#include "qgis.h" | ||||
class QgsContrastEnhancementFunction; | class QgsContrastEnhancementFunction; | |||
class QDomDocument; | ||||
class QDomElement; | ||||
class QString; | ||||
/** \ingroup core | /** \ingroup core | |||
* Manipulates raster pixel values so that they enhanceContrast or clip int o a | * Manipulates raster pixel values so that they enhanceContrast or clip int o a | |||
* specified numerical range according to the specified | * specified numerical range according to the specified | |||
* ContrastEnhancementAlgorithm. | * ContrastEnhancementAlgorithm. | |||
*/ | */ | |||
class CORE_EXPORT QgsContrastEnhancement | class CORE_EXPORT QgsContrastEnhancement | |||
{ | { | |||
public: | public: | |||
skipping to change at line 48 | skipping to change at line 53 | |||
/** \brief This enumerator describes the types of contrast enhancement algorithms that can be used. */ | /** \brief This enumerator describes the types of contrast enhancement algorithms that can be used. */ | |||
enum ContrastEnhancementAlgorithm | enum ContrastEnhancementAlgorithm | |||
{ | { | |||
NoEnhancement, //this should be the default color sc aling algorithm | NoEnhancement, //this should be the default color sc aling algorithm | |||
StretchToMinimumMaximum, //linear histogram enhanceContrast | StretchToMinimumMaximum, //linear histogram enhanceContrast | |||
StretchAndClipToMinimumMaximum, | StretchAndClipToMinimumMaximum, | |||
ClipToMinimumMaximum, | ClipToMinimumMaximum, | |||
UserDefinedEnhancement | UserDefinedEnhancement | |||
}; | }; | |||
/** These are exactly the same as GDAL pixel data types | QgsContrastEnhancement( QGis::DataType theDatatype = QGis::Byte ); | |||
** This was added so that the python bindings could be built, | QgsContrastEnhancement( const QgsContrastEnhancement& ce ); | |||
** which initially was a problem because GDALDataType was passed | ||||
** around as an argument to numerous method, including the constructor | ||||
. | ||||
** | ||||
** It seems like there should be a better way to do this... | ||||
*/ | ||||
enum QgsRasterDataType | ||||
{ | ||||
QGS_Unknown = 0, | ||||
/*! Eight bit unsigned integer */ QGS_Byte = 1, | ||||
/*! Sixteen bit unsigned integer */ QGS_UInt16 = 2, | ||||
/*! Sixteen bit signed integer */ QGS_Int16 = 3, | ||||
/*! Thirty two bit unsigned integer */ QGS_UInt32 = 4, | ||||
/*! Thirty two bit signed integer */ QGS_Int32 = 5, | ||||
/*! Thirty two bit floating point */ QGS_Float32 = 6, | ||||
/*! Sixty four bit floating point */ QGS_Float64 = 7, | ||||
/*! Complex Int16 */ QGS_CInt16 = 8, | ||||
/*! Complex Int32 */ QGS_CInt32 = 9, | ||||
/*! Complex Float32 */ QGS_CFloat32 = 10, | ||||
/*! Complex Float64 */ QGS_CFloat64 = 11, | ||||
QGS_TypeCount = 12 /* maximum type # + 1 */ | ||||
}; | ||||
QgsContrastEnhancement( QgsContrastEnhancement::QgsRasterDataType theDa | ||||
tatype = QGS_Byte ); | ||||
~QgsContrastEnhancement(); | ~QgsContrastEnhancement(); | |||
/* | /* | |||
* | * | |||
* Static methods | * Static methods | |||
* | * | |||
*/ | */ | |||
/** \brief Helper function that returns the maximum possible value for a GDAL data type */ | /** \brief Helper function that returns the maximum possible value for a GDAL data type */ | |||
static double maximumValuePossible( QgsRasterDataType ); | static double maximumValuePossible( QGis::DataType ); | |||
/** \brief Helper function that returns the minimum possible value for a GDAL data type */ | /** \brief Helper function that returns the minimum possible value for a GDAL data type */ | |||
static double minimumValuePossible( QgsRasterDataType ); | static double minimumValuePossible( QGis::DataType ); | |||
/* | /* | |||
* | * | |||
* Non-Static Inline methods | * Non-Static Inline methods | |||
* | * | |||
*/ | */ | |||
/** \brief Return the maximum value for the contrast enhancement range. */ | /** \brief Return the maximum value for the contrast enhancement range. */ | |||
double maximumValue() const { return mMaximumValue; } | double maximumValue() const { return mMaximumValue; } | |||
/** \brief Return the minimum value for the contrast enhancement range. */ | /** \brief Return the minimum value for the contrast enhancement range. */ | |||
double minimumValue() const { return mMinimumValue; } | double minimumValue() const { return mMinimumValue; } | |||
ContrastEnhancementAlgorithm contrastEnhancementAlgorithm() const { ret urn mContrastEnhancementAlgorithm; } | ContrastEnhancementAlgorithm contrastEnhancementAlgorithm() const { ret urn mContrastEnhancementAlgorithm; } | |||
static QString contrastEnhancementAlgorithmString( ContrastEnhancementA | ||||
lgorithm algorithm ); | ||||
static ContrastEnhancementAlgorithm contrastEnhancementAlgorithmFromStr | ||||
ing( const QString& contrastEnhancementString ); | ||||
/* | /* | |||
* | * | |||
* Non-Static methods | * Non-Static methods | |||
* | * | |||
*/ | */ | |||
/** \brief Apply the contrast enhancement to a value. Return values are 0 - 254, -1 means the pixel was clipped and should not be displayed */ | /** \brief Apply the contrast enhancement to a value. Return values are 0 - 254, -1 means the pixel was clipped and should not be displayed */ | |||
int enhanceContrast( double ); | int enhanceContrast( double ); | |||
/** \brief Return true if pixel is in stretable range, false if pixel i s outside of range (i.e., clipped) */ | /** \brief Return true if pixel is in stretable range, false if pixel i s outside of range (i.e., clipped) */ | |||
bool isValueInDisplayableRange( double ); | bool isValueInDisplayableRange( double ); | |||
skipping to change at line 122 | skipping to change at line 108 | |||
/** \brief A public method that allows the user to set their own custom contrast enhancment function */ | /** \brief A public method that allows the user to set their own custom contrast enhancment function */ | |||
void setContrastEnhancementFunction( QgsContrastEnhancementFunction* ); | void setContrastEnhancementFunction( QgsContrastEnhancementFunction* ); | |||
/** \brief Set the maximum value for the contrast enhancement range. */ | /** \brief Set the maximum value for the contrast enhancement range. */ | |||
void setMaximumValue( double, bool generateTable = true ); | void setMaximumValue( double, bool generateTable = true ); | |||
/** \brief Return the minimum value for the contrast enhancement range. */ | /** \brief Return the minimum value for the contrast enhancement range. */ | |||
void setMinimumValue( double, bool generateTable = true ); | void setMinimumValue( double, bool generateTable = true ); | |||
void writeXML( QDomDocument& doc, QDomElement& parentElem ) const; | ||||
void readXML( const QDomElement& elem ); | ||||
private: | private: | |||
/** \brief Current contrast enhancement algorithm */ | /** \brief Current contrast enhancement algorithm */ | |||
ContrastEnhancementAlgorithm mContrastEnhancementAlgorithm; | ContrastEnhancementAlgorithm mContrastEnhancementAlgorithm; | |||
/** \brief Pointer to the contrast enhancement function */ | /** \brief Pointer to the contrast enhancement function */ | |||
QgsContrastEnhancementFunction* mContrastEnhancementFunction; | QgsContrastEnhancementFunction* mContrastEnhancementFunction; | |||
/** \brief Flag indicating if the lookup table needs to be regenerated */ | /** \brief Flag indicating if the lookup table needs to be regenerated */ | |||
bool mEnhancementDirty; | bool mEnhancementDirty; | |||
skipping to change at line 145 | skipping to change at line 135 | |||
/** \brief Pointer to the lookup table */ | /** \brief Pointer to the lookup table */ | |||
int *mLookupTable; | int *mLookupTable; | |||
/** \brief User defineable minimum value for the band, used for enhance Contrasting */ | /** \brief User defineable minimum value for the band, used for enhance Contrasting */ | |||
double mMinimumValue; | double mMinimumValue; | |||
/** \brief user defineable maximum value for the band, used for enhance Contrasting */ | /** \brief user defineable maximum value for the band, used for enhance Contrasting */ | |||
double mMaximumValue; | double mMaximumValue; | |||
/** \brief Data type of the band */ | /** \brief Data type of the band */ | |||
QgsRasterDataType mRasterDataType; | QGis::DataType mRasterDataType; | |||
/** \brief Maximum range of values for a given data type */ | /** \brief Maximum range of values for a given data type */ | |||
double mRasterDataTypeRange; | double mRasterDataTypeRange; | |||
/** \brief Method to generate a new lookup table */ | /** \brief Method to generate a new lookup table */ | |||
bool generateLookupTable(); | bool generateLookupTable(); | |||
/** \brief Method to calculate the actual enhanceContrasted value(s) */ | /** \brief Method to calculate the actual enhanceContrasted value(s) */ | |||
int calculateContrastEnhancementValue( double ); | int calculateContrastEnhancementValue( double ); | |||
}; | }; | |||
End of changes. 8 change blocks. | ||||
30 lines changed or deleted | 20 lines changed or added | |||
qgscontrastenhancementfunction.h | qgscontrastenhancementfunction.h | |||
---|---|---|---|---|
skipping to change at line 22 | skipping to change at line 22 | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCONTRASTENHANCEMENTFUNCTION_H | #ifndef QGSCONTRASTENHANCEMENTFUNCTION_H | |||
#define QGSCONTRASTENHANCEMENTFUNCTION_H | #define QGSCONTRASTENHANCEMENTFUNCTION_H | |||
#include "qgis.h" | ||||
#include "qgscontrastenhancement.h" | #include "qgscontrastenhancement.h" | |||
/** \ingroup core | /** \ingroup core | |||
* A contrast enhancement funcion is the base class for all raster contrast enhancements. | * A contrast enhancement funcion is the base class for all raster contrast enhancements. | |||
* | * | |||
* The purpose of a contrast enhancement is to enhanceContrast or clip a pi xel value into | * The purpose of a contrast enhancement is to enhanceContrast or clip a pi xel value into | |||
* a specified bounding range. | * a specified bounding range. | |||
*/ | */ | |||
class CORE_EXPORT QgsContrastEnhancementFunction | class CORE_EXPORT QgsContrastEnhancementFunction | |||
{ | { | |||
public: | public: | |||
QgsContrastEnhancementFunction( QgsContrastEnhancement::QgsRasterDataTy | QgsContrastEnhancementFunction( QGis::DataType, double, double ); | |||
pe, double, double ); | QgsContrastEnhancementFunction( const QgsContrastEnhancementFunction& f | |||
); | ||||
virtual ~QgsContrastEnhancementFunction() {} | virtual ~QgsContrastEnhancementFunction() {} | |||
/** \brief A customizable method that takes in a double and returns a i nt between 0 and 255 */ | /** \brief A customizable method that takes in a double and returns a i nt between 0 and 255 */ | |||
virtual int enhance( double ); | virtual int enhance( double ); | |||
/** \brief A customicable method to indicate if the pixels is displayab le */ | /** \brief A customicable method to indicate if the pixels is displayab le */ | |||
virtual bool isValueInDisplayableRange( double ); | virtual bool isValueInDisplayableRange( double ); | |||
/** \brief Mustator for the maximum value */ | /** \brief Mustator for the maximum value */ | |||
void setMaximumValue( double ); | void setMaximumValue( double ); | |||
skipping to change at line 60 | skipping to change at line 62 | |||
/** \brief User defineable maximum value for the band, used for enhance Contrasting */ | /** \brief User defineable maximum value for the band, used for enhance Contrasting */ | |||
double mMaximumValue; | double mMaximumValue; | |||
/** \brief User defineable minimum value for the band, used for enhance Contrasting */ | /** \brief User defineable minimum value for the band, used for enhance Contrasting */ | |||
double mMinimumValue; | double mMinimumValue; | |||
/** \brief Minimum maximum range for the band, used for enhanceContrast ing */ | /** \brief Minimum maximum range for the band, used for enhanceContrast ing */ | |||
double mMinimumMaximumRange; | double mMinimumMaximumRange; | |||
/** \brief Data type of the band */ | /** \brief Data type of the band */ | |||
QgsContrastEnhancement::QgsRasterDataType mQgsRasterDataType; | QGis::DataType mQgsRasterDataType; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 5 lines changed or added | |||
qgscoordinatereferencesystem.h | qgscoordinatereferencesystem.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSCOORDINATEREFERENCESYSTEM_H | #ifndef QGSCOORDINATEREFERENCESYSTEM_H | |||
#define QGSCOORDINATEREFERENCESYSTEM_H | #define QGSCOORDINATEREFERENCESYSTEM_H | |||
//Standard includes | //Standard includes | |||
#include <ostream> | #include <ostream> | |||
//qt includes | //qt includes | |||
#include <QString> | #include <QString> | |||
#include <QMap> | #include <QMap> | |||
#include <QHash> | ||||
class QDomNode; | class QDomNode; | |||
class QDomDocument; | class QDomDocument; | |||
// forward declaration for sqlite3 | // forward declaration for sqlite3 | |||
typedef struct sqlite3 sqlite3; | typedef struct sqlite3 sqlite3; | |||
//qgis includes | //qgis includes | |||
#include "qgis.h" | #include "qgis.h" | |||
#ifdef DEBUG | ||||
typedef struct OGRSpatialReferenceHS *OGRSpatialReferenceH; | ||||
#else | ||||
typedef void *OGRSpatialReferenceH; | ||||
#endif | ||||
class QgsCoordinateReferenceSystem; | class QgsCoordinateReferenceSystem; | |||
typedef void ( *CUSTOM_CRS_VALIDATION )( QgsCoordinateReferenceSystem* ); | typedef void ( *CUSTOM_CRS_VALIDATION )( QgsCoordinateReferenceSystem& ); | |||
/** \ingroup core | /** \ingroup core | |||
* Class for storing a coordinate reference system (CRS) | * Class for storing a coordinate reference system (CRS) | |||
*/ | */ | |||
class CORE_EXPORT QgsCoordinateReferenceSystem | class CORE_EXPORT QgsCoordinateReferenceSystem | |||
{ | { | |||
public: | public: | |||
enum CrsType | enum CrsType | |||
{ | { | |||
InternalCrsId, | InternalCrsId, | |||
PostgisCrsId, | PostgisCrsId, | |||
EpsgCrsId // deprecated | EpsgCrsId // deprecated | |||
}; | }; | |||
//! Default constructor | //! Default constructor | |||
QgsCoordinateReferenceSystem(); | QgsCoordinateReferenceSystem(); | |||
~QgsCoordinateReferenceSystem(); | ~QgsCoordinateReferenceSystem(); | |||
/*! | /*! | |||
* Constructs a CRS object from a string definition as defined in the c reateFromString | * Constructs a CRS object from a string definition as defined in the c reateFromString | |||
* member function (by default a WKT definition). | * member function (by default a WKT definition). | |||
skipping to change at line 114 | skipping to change at line 122 | |||
* First the system level read only srs.db will be checked | * First the system level read only srs.db will be checked | |||
* and then the users ~/.qgis/qgis.db database will be checked for a ma tch. | * and then the users ~/.qgis/qgis.db database will be checked for a ma tch. | |||
* @note Any members will be overwritten during this process. | * @note Any members will be overwritten during this process. | |||
* @note SRID and EpsgCrsId may be blank if no match can be found on sr s db. | * @note SRID and EpsgCrsId may be blank if no match can be found on sr s db. | |||
* @param theWkt The Wkt for the desired spatial reference system. | * @param theWkt The Wkt for the desired spatial reference system. | |||
* @return bool TRUE if success else false | * @return bool TRUE if success else false | |||
*/ | */ | |||
bool createFromWkt( const QString theWkt ); | bool createFromWkt( const QString theWkt ); | |||
/*! Set up this srs by fetching the appropriate information from the | /*! Set up this srs by fetching the appropriate information from the | |||
* sqlite backend. First the system level read only srs.db will be chec | ||||
ked | ||||
* and then the users ~/.qgis/qgis.db database will be checked for a ma | ||||
tch. | ||||
* @note Any members will be overwritten during this process. | ||||
* @param theEpsg The EpsgCrsId for the desired spatial reference syste | ||||
m. | ||||
* @return bool TRUE if success else false | ||||
* @deprecated use createFromOgcWmsCrs() | ||||
*/ | ||||
Q_DECL_DEPRECATED bool createFromEpsg( const long theEpsg ); | ||||
/*! Set up this srs by fetching the appropriate information from the | ||||
* sqlite backend. If the srsid is < 100000, only the system srs.db | * sqlite backend. If the srsid is < 100000, only the system srs.db | |||
* will be checked. If the srsid > 100000 the srs will be retrieved fro m | * will be checked. If the srsid > 100000 the srs will be retrieved fro m | |||
* the ~/.qgis/qgis.db | * the ~/.qgis/qgis.db | |||
* @note Any members will be overwritten during this process. | * @note Any members will be overwritten during this process. | |||
* @param theSrsId The QGIS SrsId for the desired spatial reference sys tem. | * @param theSrsId The QGIS SrsId for the desired spatial reference sys tem. | |||
* @return bool TRUE if success else false | * @return bool TRUE if success else false | |||
*/ | */ | |||
bool createFromSrsId( const long theSrsId ); | bool createFromSrsId( const long theSrsId ); | |||
/*! Set up this srs by passing it a proj4 style formatted string. | /*! Set up this srs by passing it a proj4 style formatted string. | |||
* The string will be parsed and the projection and ellipsoid | * The string will be parsed and the projection and ellipsoid | |||
* members set and the remainder of the proj4 string will be stored | * members set and the remainder of the proj4 string will be stored | |||
* in the parameters member. The reason for this is so that we | * in the parameters member. The reason for this is so that we | |||
* can easily present the user with 'natural language' representation | * can easily present the user with 'natural language' representation | |||
* of the projection and ellipsoid by looking them up in the srs.bs sql ite | * of the projection and ellipsoid by looking them up in the srs.bs sql ite | |||
* database. Also having the ellpse and proj elements stripped out | * database. Also having the ellipse and proj elements stripped out | |||
* is hepful to speed up globbing queries (see below). | * is helpful to speed up globbing queries (see below). | |||
* | * | |||
* We try to match the proj string to and srsid using the following log ic: | * We try to match the proj string to and srsid using the following log ic: | |||
* | * | |||
* - perform a whole text search on srs name (if not null). The srs nam e will | * - perform a whole text search on srs name (if not null). The srs nam e will | |||
* have been set if this method has been delegated to from createFrom Wkt. | * have been set if this method has been delegated to from createFrom Wkt. | |||
* - if the above does not match perform a whole text search on proj4 s tring (if not null) | * - if the above does not match perform a whole text search on proj4 s tring (if not null) | |||
* - if none of the above match convert the proj4 string to an OGR CRS | * - if none of the above match convert the proj4 string to an OGR CRS | |||
* then check if its a geocs or a proj cs (using ogr isGeographic) | * then check if its a geocs or a proj cs (using ogr isGeographic) | |||
* then sequentially walk through the database (first users qgis.db s rs tbl then | * then sequentially walk through the database (first users qgis.db s rs tbl then | |||
* system srs.db tbl), converting each entry into an ogr srs and usin g isSame | * system srs.db tbl), converting each entry into an ogr srs and usin g isSame | |||
* or isSameGeocs (essentially calling the == overloaded operator). W e'll try to | * or isSameGeocs (essentially calling the == overloaded operator). W e'll try to | |||
* be smart about this and first parse out the proj and ellpse string s and only | * be smart about this and first parse out the proj and ellpse string s and only | |||
* check for a match in entities that have the same ellps and proj en tries so | * check for a match in entities that have the same ellps and proj en tries so | |||
* that it doesn't munch yer cpu so much. | * that it doesn't munch yer cpu so much. | |||
* | * | |||
* @note If the srs was not matched, we will create a new entry on the | ||||
users tbl_srs | ||||
* for this srs. | ||||
* | ||||
* @param theProjString A proj4 format string | * @param theProjString A proj4 format string | |||
* @return bool TRUE if success else false | * @return bool TRUE if success else false | |||
*/ | */ | |||
bool createFromProj4( const QString theProjString ); | bool createFromProj4( const QString theProjString ); | |||
/*! Set up this srs from a string definition, by default a WKT definiti on. Otherwise | /*! Set up this srs from a string definition, by default a WKT definiti on. Otherwise | |||
* the string defines a authority, followed by a colon, followed by the definition. | * the string defines a authority, followed by a colon, followed by the definition. | |||
* The authority can be one of "epsg", "postgis", "internal" for intege r definitions, | * The authority can be one of "epsg", "postgis", "internal" for intege r definitions, | |||
* and "wkt" or "proj4" for string definitions. The implementation of each authority | * and "wkt" or "proj4" for string definitions. The implementation of each authority | |||
* uses the corresponding createFrom... function. | * uses the corresponding createFrom... function. | |||
skipping to change at line 185 | skipping to change at line 180 | |||
* Valid formats: WKT string, "EPSG:n", "EPSGA:n", "AUTO:proj_id,unit_i d,lon0,lat0", | * Valid formats: WKT string, "EPSG:n", "EPSGA:n", "AUTO:proj_id,unit_i d,lon0,lat0", | |||
* "urn:ogc:def:crs:EPSG::n", PROJ.4 string, filename (with WKT, XML or PROJ.4 string), | * "urn:ogc:def:crs:EPSG::n", PROJ.4 string, filename (with WKT, XML or PROJ.4 string), | |||
* well known name (such as NAD27, NAD83, WGS84 or WGS72), | * well known name (such as NAD27, NAD83, WGS84 or WGS72), | |||
* ESRI::[WKT string] (directly or in a file), "IGNF:xxx" | * ESRI::[WKT string] (directly or in a file), "IGNF:xxx" | |||
* | * | |||
* For more details on supported formats see OGRSpatialReference::SetFr omUserInput() | * For more details on supported formats see OGRSpatialReference::SetFr omUserInput() | |||
* ( http://www.gdal.org/ogr/classOGRSpatialReference.html#aec3c6a49533 fe457ddc763d699ff8796 ) | * ( http://www.gdal.org/ogr/classOGRSpatialReference.html#aec3c6a49533 fe457ddc763d699ff8796 ) | |||
* @note this function generates a WKT string using OSRSetFromUserInput () and | * @note this function generates a WKT string using OSRSetFromUserInput () and | |||
* passes it to createFromWkt() function. | * passes it to createFromWkt() function. | |||
* @param theDefinition A String containing a coordinate reference syst em definition. | * @param theDefinition A String containing a coordinate reference syst em definition. | |||
* | ||||
* @note added in 1.8 | ||||
*/ | */ | |||
bool createFromUserInput( const QString theDefinition ); | bool createFromUserInput( const QString theDefinition ); | |||
/*! Make sure that ESRI WKT import is done properly. | /*! Make sure that ESRI WKT import is done properly. | |||
* This is required for proper shapefile CRS import when using gdal>= 1 .9. | * This is required for proper shapefile CRS import when using gdal>= 1 .9. | |||
* @note This function is called by createFromUserInput() and QgsOgrPro vider::crs(), there is usually | * @note This function is called by createFromUserInput() and QgsOgrPro vider::crs(), there is usually | |||
* no need to call it from elsewhere. | * no need to call it from elsewhere. | |||
* @note This function sets CPL config option GDAL_FIX_ESRI_WKT to a pr oper value, | * @note This function sets CPL config option GDAL_FIX_ESRI_WKT to a pr oper value, | |||
* unless it has been set by the user through the commandline or an env ironment variable. | * unless it has been set by the user through the commandline or an env ironment variable. | |||
* For more details refer to OGRSpatialReference::morphFromESRI() . | * For more details refer to OGRSpatialReference::morphFromESRI() . | |||
* | ||||
* @note added in 1.8 | * @note added in 1.8 | |||
*/ | */ | |||
static void setupESRIWktFix(); | static void setupESRIWktFix(); | |||
/*! Find out whether this CRS is correctly initialised and usable */ | /*! Find out whether this CRS is correctly initialised and usable */ | |||
bool isValid() const; | bool isValid() const; | |||
/*! Perform some validation on this CRS. If the sts doesn't validate th e | /*! Perform some validation on this CRS. If the sts doesn't validate th e | |||
* default behaviour settings for layers with unknown CRS will be | * default behaviour settings for layers with unknown CRS will be | |||
* consulted and acted on accordingly. By hell or high water this | * consulted and acted on accordingly. By hell or high water this | |||
skipping to change at line 234 | skipping to change at line 232 | |||
long findMatchingProj(); | long findMatchingProj(); | |||
/*! Overloaded == operator used to compare to CRS's. | /*! Overloaded == operator used to compare to CRS's. | |||
* Internally it will delegate to the equals method described below | * Internally it will delegate to the equals method described below | |||
*/ | */ | |||
bool operator==( const QgsCoordinateReferenceSystem &theSrs ) const; | bool operator==( const QgsCoordinateReferenceSystem &theSrs ) const; | |||
/*! Overloaded != operator used to compare to CRS's. | /*! Overloaded != operator used to compare to CRS's. | |||
* Returns opposite bool value to operator == | * Returns opposite bool value to operator == | |||
*/ | */ | |||
bool operator!=( const QgsCoordinateReferenceSystem &theSrs ) const; | bool operator!=( const QgsCoordinateReferenceSystem &theSrs ) const; | |||
/*! Overloaded == operator used to compare to CRS's. | ||||
* Internally it will use OGR isSameCRS() or isSameGeoCRS() methods as | ||||
appropriate. | ||||
* Additionally logic may also be applied if the result from the OGR m | ||||
ethods | ||||
* is inconclusive. | ||||
* @deprecated in 1.8 as the same proj.4 string not necessarily means t | ||||
he same CRS | ||||
*/ | ||||
Q_DECL_DEPRECATED bool equals( QString theProj4String ); | ||||
/*! Restores state from the given Dom node. | /*! Restores state from the given Dom node. | |||
* @param theNode The node from which state will be restored | * @param theNode The node from which state will be restored | |||
* @return bool True on success, False on failure | * @return bool True on success, False on failure | |||
*/ | */ | |||
bool readXML( QDomNode & theNode ); | bool readXML( QDomNode & theNode ); | |||
/*! Stores state to the given Dom node in the given document. | /*! Stores state to the given Dom node in the given document. | |||
* Below is an example of the generated tag. | * Below is an example of the generated tag. | |||
\verbatim | \verbatim | |||
<spatialrefsys> | <spatialrefsys> | |||
<proj4>+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs </proj4> | <proj4>+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs </proj4> | |||
<srsid>2585</srsid> | <srsid>2585</srsid> | |||
<srid>4326</srid> | <srid>4326</srid> | |||
<epsg>4326</epsg> | <epsg>4326</epsg> | |||
<description>WGS 84</description> | <description>WGS 84</description> | |||
skipping to change at line 268 | skipping to change at line 259 | |||
</spatialrefsys> | </spatialrefsys> | |||
\endverbatim | \endverbatim | |||
* @param theNode The node in which state will be restored | * @param theNode The node in which state will be restored | |||
* @param theDoc The document in which state will be stored | * @param theDoc The document in which state will be stored | |||
* @return bool True on success, False on failure | * @return bool True on success, False on failure | |||
*/ | */ | |||
bool writeXML( QDomNode & theNode, QDomDocument & theDoc ) const; | bool writeXML( QDomNode & theNode, QDomDocument & theDoc ) const; | |||
/** Sets custom function to force valid CRS | /** Sets custom function to force valid CRS | |||
* QGIS uses implementation in QgisGui::customSrsValidation | * QGIS uses implementation in QgisGui::customSrsValidation | |||
* @note not available in python bindings | ||||
*/ | */ | |||
static void setCustomSrsValidation( CUSTOM_CRS_VALIDATION f ); | static void setCustomSrsValidation( CUSTOM_CRS_VALIDATION f ); | |||
/** Gets custom function | /** Gets custom function | |||
* @note not available in python bindings | ||||
*/ | */ | |||
static CUSTOM_CRS_VALIDATION customSrsValidation(); | static CUSTOM_CRS_VALIDATION customSrsValidation(); | |||
// Accessors ----------------------------------- | // Accessors ----------------------------------- | |||
/*! Get the SrsId - if possible | /*! Get the SrsId - if possible | |||
* @return long theSrsId The internal sqlite3 srs.db primary key for t his srs | * @return long theSrsId The internal sqlite3 srs.db primary key for t his srs | |||
*/ | */ | |||
long srsid() const; | long srsid() const; | |||
/*! Get the postgis srid for this srs | /*! Get the postgis srid for this srs | |||
* @return long theSRID the Postgis spatial_ref_sys identifier for thi s srs (defaults to 0) | * @return long theSRID the Postgis spatial_ref_sys identifier for thi s srs (defaults to 0) | |||
*/ | */ | |||
long postgisSrid() const; | long postgisSrid() const; | |||
/*! Get the EpsgCrsId identifier for this srs | ||||
* @return long theEpsg the EPSG identifier for this srs (defaults to | ||||
0) | ||||
* @deprecated there are other authorities - use authid() | ||||
*/ | ||||
Q_DECL_DEPRECATED long epsg() const; | ||||
/*! Get the authority identifier for this srs | /*! Get the authority identifier for this srs | |||
* @return QString the Authority identifier for this srs | * @return QString the Authority identifier for this srs | |||
* @note added in 1.5 | * @note added in 1.5 | |||
*/ | */ | |||
QString authid() const; | QString authid() const; | |||
/*! Get the Description | /*! Get the Description | |||
* @return QString the Description A textual description of the srs. | * @return QString the Description A textual description of the srs. | |||
* @note A zero length string will be returned if the description is un initialised | * @note A zero length string will be returned if the description is un initialised | |||
*/ | */ | |||
skipping to change at line 338 | skipping to change at line 325 | |||
*/ | */ | |||
QString toProj4() const; | QString toProj4() const; | |||
/*! Get this Geographic? flag | /*! Get this Geographic? flag | |||
* @return bool theGeoFlag Whether this is a geographic or projected c oordinate system | * @return bool theGeoFlag Whether this is a geographic or projected c oordinate system | |||
*/ | */ | |||
bool geographicFlag() const; | bool geographicFlag() const; | |||
/*! return if axis is inverted (eg. for WMS 1.3) | /*! return if axis is inverted (eg. for WMS 1.3) | |||
* @return bool Whether this is crs axis is inverted | * @return bool Whether this is crs axis is inverted | |||
* @note added in 1.9.90 | * @note added in 1.8 | |||
*/ | */ | |||
bool axisInverted() const; | bool axisInverted() const; | |||
/*! Get the units that the projection is in | /*! Get the units that the projection is in | |||
* @return QGis::UnitType that gives the units for the coordinate syste m | * @return QGis::UnitType that gives the units for the coordinate syste m | |||
*/ | */ | |||
QGis::UnitType mapUnits() const; | QGis::UnitType mapUnits() const; | |||
// Mutators ----------------------------------- | // Mutators ----------------------------------- | |||
/*! Set user hint for validation | /*! Set user hint for validation | |||
skipping to change at line 362 | skipping to change at line 349 | |||
/*! Get user hint for validation | /*! Get user hint for validation | |||
*/ | */ | |||
QString validationHint(); | QString validationHint(); | |||
/*! Update proj.4 parameters in our database from proj.4 | /*! Update proj.4 parameters in our database from proj.4 | |||
* @returns number of updated CRS on success and | * @returns number of updated CRS on success and | |||
* negative number of failed updates in case of errors. | * negative number of failed updates in case of errors. | |||
* @note added in 1.8 | * @note added in 1.8 | |||
*/ | */ | |||
static int syncDb(); | static int syncDb(); | |||
/*! Save the proj4-string as a custom CRS | ||||
* @returns bool true if success else false | ||||
*/ | ||||
bool saveAsUserCRS( QString name ); | ||||
// Mutators ----------------------------------- | // Mutators ----------------------------------- | |||
// We don't want to expose these to the public api since they wont crea te | // We don't want to expose these to the public api since they wont crea te | |||
// a fully valid crs. Programmers should use the createFrom* methods ra ther | // a fully valid crs. Programmers should use the createFrom* methods ra ther | |||
private: | private: | |||
/** A static helper function to find out the proj4 string for a srsid | /** A static helper function to find out the proj4 string for a srsid | |||
* @param theSrsId The srsid used for the lookup | * @param theSrsId The srsid used for the lookup | |||
* @return QString The proj4 string | * @return QString The proj4 string | |||
*/ | */ | |||
static QString proj4FromSrsId( const int theSrsId ); | static QString proj4FromSrsId( const int theSrsId ); | |||
skipping to change at line 452 | skipping to change at line 444 | |||
//!The official proj4 acronym for the ellipoid | //!The official proj4 acronym for the ellipoid | |||
QString mEllipsoidAcronym; | QString mEllipsoidAcronym; | |||
//!Whether this is a geographic or projected coordinate system | //!Whether this is a geographic or projected coordinate system | |||
bool mGeoFlag; | bool mGeoFlag; | |||
//! The map units | //! The map units | |||
QGis::UnitType mMapUnits; | QGis::UnitType mMapUnits; | |||
//!If available, the Postgis spatial_ref_sys identifier for this srs (d efaults to 0) | //!If available, the Postgis spatial_ref_sys identifier for this srs (d efaults to 0) | |||
long mSRID; | long mSRID; | |||
//!If available the authority identifier for this srs | //!If available the authority identifier for this srs | |||
QString mAuthId; | QString mAuthId; | |||
//! Wehter this srs is properly defined and valid | //! Whether this srs is properly defined and valid | |||
bool mIsValidFlag; | bool mIsValidFlag; | |||
//! Work out the projection units and set the appropriate local variabl e | //! Work out the projection units and set the appropriate local variabl e | |||
void setMapUnits(); | void setMapUnits(); | |||
//! Save the proj4-string as a custom CRS | ||||
bool saveAsUserCRS(); | ||||
//! Helper for getting number of user CRS already in db | //! Helper for getting number of user CRS already in db | |||
long getRecordCount(); | long getRecordCount(); | |||
//! Helper for sql-safe value quoting | //! Helper for sql-safe value quoting | |||
static QString quotedValue( QString value ); | static QString quotedValue( QString value ); | |||
void *mCRS; | OGRSpatialReferenceH mCRS; | |||
bool loadFromDb( QString db, QString expression, QString value ); | bool loadFromDb( QString db, QString expression, QString value ); | |||
QString mValidationHint; | QString mValidationHint; | |||
mutable QString mWkt; | mutable QString mWkt; | |||
static bool loadIDs( QHash<int, QString> &wkts ); | ||||
static bool loadWkts( QHash<int, QString> &wkts, const char *filename ) | ||||
; | ||||
//!Whether this is a coordinate system has inverted axis | //!Whether this is a coordinate system has inverted axis | |||
mutable int mAxisInverted; | mutable int mAxisInverted; | |||
static CUSTOM_CRS_VALIDATION mCustomSrsValidation; | static CUSTOM_CRS_VALIDATION mCustomSrsValidation; | |||
}; | }; | |||
//! Output stream operator | //! Output stream operator | |||
inline std::ostream& operator << ( std::ostream& os, const QgsCoordinateRef erenceSystem &r ) | inline std::ostream& operator << ( std::ostream& os, const QgsCoordinateRef erenceSystem &r ) | |||
{ | { | |||
QString mySummary( "\n\tSpatial Reference System:" ); | QString mySummary( "\n\tSpatial Reference System:" ); | |||
End of changes. 20 change blocks. | ||||
47 lines changed or deleted | 32 lines changed or added | |||
qgscoordinatetransform.h | qgscoordinatetransform.h | |||
---|---|---|---|---|
skipping to change at line 30 | skipping to change at line 30 | |||
//qt includes | //qt includes | |||
#include <QObject> | #include <QObject> | |||
//qgis includes | //qgis includes | |||
#include "qgspoint.h" | #include "qgspoint.h" | |||
#include "qgsrectangle.h" | #include "qgsrectangle.h" | |||
#include "qgscsexception.h" | #include "qgscsexception.h" | |||
#include "qgscoordinatereferencesystem.h" | #include "qgscoordinatereferencesystem.h" | |||
class QDomNode; | class QDomNode; | |||
class QDomDocument; | class QDomDocument; | |||
class QPolygonF; | ||||
//non qt includes | //non qt includes | |||
#include <iostream> | #include <iostream> | |||
#include <vector> | #include <vector> | |||
typedef void* projPJ; | typedef void* projPJ; | |||
class QString; | class QString; | |||
/** \ingroup core | /** \ingroup core | |||
* Class for doing transforms between two map coordinate systems. | * Class for doing transforms between two map coordinate systems. | |||
skipping to change at line 51 | skipping to change at line 52 | |||
* This class can convert map coordinates to a different coordinate referenc e system. | * This class can convert map coordinates to a different coordinate referenc e system. | |||
* It is normally associated with a map layer and is used to transform betwe en the | * It is normally associated with a map layer and is used to transform betwe en the | |||
* layer's coordinate system and the coordinate system of the map canvas, al though | * layer's coordinate system and the coordinate system of the map canvas, al though | |||
* it can be used in a more general sense to transform coordinates. | * it can be used in a more general sense to transform coordinates. | |||
* | * | |||
* All references to source and destination coordinate systems refer to | * All references to source and destination coordinate systems refer to | |||
* layer and map canvas respectively. All operations are from the perspectiv e | * layer and map canvas respectively. All operations are from the perspectiv e | |||
* of the layer. For example, a forward transformation transforms coordinate s from the | * of the layer. For example, a forward transformation transforms coordinate s from the | |||
* layers coordinate system to the map canvas. | * layers coordinate system to the map canvas. | |||
*/ | */ | |||
class CORE_EXPORT QgsCoordinateTransform: public QObject | class CORE_EXPORT QgsCoordinateTransform : public QObject | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
/*! Default constructor. Make sure you use initialised() manually if yo u use this one! */ | /*! Default constructor. Make sure you use initialised() manually if yo u use this one! */ | |||
QgsCoordinateTransform() ; | QgsCoordinateTransform(); | |||
/** Constructs a QgsCoordinateTransform using QgsCoordinateReferenceSys tem objects. | /** Constructs a QgsCoordinateTransform using QgsCoordinateReferenceSys tem objects. | |||
* @param theSource CRS, typically of the layer's coordinate system | * @param theSource CRS, typically of the layer's coordinate system | |||
* @param theDest CRS, typically of the map canvas coordinate system | * @param theDest CRS, typically of the map canvas coordinate system | |||
*/ | */ | |||
QgsCoordinateTransform( const QgsCoordinateReferenceSystem& theSource, | QgsCoordinateTransform( const QgsCoordinateReferenceSystem& theSource, | |||
const QgsCoordinateReferenceSystem& theDest ); | const QgsCoordinateReferenceSystem& theDest ); | |||
/** Constructs a QgsCoordinateTransform using CRS ID of source and dest ination CRS */ | /** Constructs a QgsCoordinateTransform using CRS ID of source and dest ination CRS */ | |||
QgsCoordinateTransform( long theSourceSrsId, long theDestSrsId ); | QgsCoordinateTransform( long theSourceSrsId, long theDestSrsId ); | |||
skipping to change at line 122 | skipping to change at line 123 | |||
*/ | */ | |||
const QgsCoordinateReferenceSystem& sourceCrs() const { return mSourceC RS; } | const QgsCoordinateReferenceSystem& sourceCrs() const { return mSourceC RS; } | |||
/*! | /*! | |||
* Get the QgsCoordinateReferenceSystem representation of the map canva s coordinate system | * Get the QgsCoordinateReferenceSystem representation of the map canva s coordinate system | |||
* @return QgsCoordinateReferenceSystem of the map canvas coordinate sy stem | * @return QgsCoordinateReferenceSystem of the map canvas coordinate sy stem | |||
*/ | */ | |||
const QgsCoordinateReferenceSystem& destCRS() const { return mDestCRS; } | const QgsCoordinateReferenceSystem& destCRS() const { return mDestCRS; } | |||
/*! Transform the point from Source Coordinate System to Destination Co ordinate System | /*! Transform the point from Source Coordinate System to Destination Co ordinate System | |||
* If the direction is ForwardTransform then coordinates are transformed | * If the direction is ForwardTransform then coordinates are transforme | |||
from layer CS --> map canvas CS, | d from layer CS --> map canvas CS, | |||
* otherwise points are transformed from map canvas CS to layerCS. | * otherwise points are transformed from map canvas CS to layerCS. | |||
* @param p Point to transform | * @param p Point to transform | |||
* @param direction TransformDirection (defaults to ForwardTransform) | * @param direction TransformDirection (defaults to ForwardTransform) | |||
* @return QgsPoint in Destination Coordinate System | * @return QgsPoint in Destination Coordinate System | |||
*/ | */ | |||
QgsPoint transform( const QgsPoint p, TransformDirection direction = Fo rwardTransform ) const; | QgsPoint transform( const QgsPoint p, TransformDirection direction = Fo rwardTransform ) const; | |||
/*! Transform the point specified by x,y from Source Coordinate System to Destination Coordinate System | /*! Transform the point specified by x,y from Source Coordinate System to Destination Coordinate System | |||
* If the direction is ForwardTransform then coordinates are transformed | * If the direction is ForwardTransform then coordinates are transforme | |||
from layer CS --> map canvas CS, | d from layer CS --> map canvas CS, | |||
* otherwise points are transformed from map canvas CS to layerCS. | * otherwise points are transformed from map canvas CS to layerCS. | |||
* @param x x cordinate of point to transform | * @param x x cordinate of point to transform | |||
* @param y y coordinate of point to transform | * @param y y coordinate of point to transform | |||
* @param direction TransformDirection (defaults to ForwardTransform) | * @param direction TransformDirection (defaults to ForwardTransform) | |||
* @return QgsPoint in Destination Coordinate System | * @return QgsPoint in Destination Coordinate System | |||
*/ | */ | |||
QgsPoint transform( const double x, const double y, TransformDirection direction = ForwardTransform ) const; | QgsPoint transform( const double x, const double y, TransformDirection direction = ForwardTransform ) const; | |||
/*! Transform a QgsRectangle to the dest Coordinate system | /*! Transform a QgsRectangle to the dest Coordinate system | |||
* If the direction is ForwardTransform then coordinates are transformed | * If the direction is ForwardTransform then coordinates are transforme | |||
from layer CS --> map canvas CS, | d from layer CS --> map canvas CS, | |||
* otherwise points are transformed from map canvas CS to layerCS. | * otherwise points are transformed from map canvas CS to layerCS. | |||
* It assumes that rect is a bounding box, and creates a bounding box | * It assumes that rect is a bounding box, and creates a bounding box | |||
* in the proejcted CS, so that all points in source rectangle is within | * in the proejcted CS, so that all points in source rectangle is withi | |||
* returned rectangle. | n | |||
* @param theRect rect to transform | * returned rectangle. | |||
* @param direction TransformDirection (defaults to ForwardTransform) | * @param theRect rect to transform | |||
* @return QgsRectangle in Destination Coordinate System | * @param direction TransformDirection (defaults to ForwardTransform) | |||
* @return QgsRectangle in Destination Coordinate System | ||||
*/ | */ | |||
QgsRectangle transformBoundingBox( const QgsRectangle theRect, Transfor mDirection direction = ForwardTransform ) const; | QgsRectangle transformBoundingBox( const QgsRectangle theRect, Transfor mDirection direction = ForwardTransform ) const; | |||
// Same as for the other transform() functions, but alters the x | // Same as for the other transform() functions, but alters the x | |||
// and y variables in place. The second one works with good old-fashion ed | // and y variables in place. The second one works with good old-fashion ed | |||
// C style arrays. | // C style arrays. | |||
void transformInPlace( double& x, double& y, double &z, TransformDirect ion direction = ForwardTransform ) const; | void transformInPlace( double& x, double& y, double &z, TransformDirect ion direction = ForwardTransform ) const; | |||
void transformInPlace( std::vector<double>& x, std::vector<double>& y, | //! @note not available in python bindings | |||
std::vector<double>& z, | void transformInPlace( QVector<double>& x, QVector<double>& y, QVector< | |||
double>& z, | ||||
TransformDirection direction = ForwardTransform ) const; | TransformDirection direction = ForwardTransform ) const; | |||
void transformPolygon( QPolygonF& poly, TransformDirection direction = | ||||
ForwardTransform ) const; | ||||
#ifdef ANDROID | #ifdef ANDROID | |||
void transformInPlace( float& x, float& y, float& z, TransformDirection direction = ForwardTransform ) const; | void transformInPlace( float& x, float& y, float& z, TransformDirection direction = ForwardTransform ) const; | |||
void transformInPlace( std::vector<float>& x, std::vector<float>& y, st d::vector<float>& z, | void transformInPlace( QVector<float>& x, QVector<float>& y, QVector<fl oat>& z, | |||
TransformDirection direction = ForwardTransform ) const; | TransformDirection direction = ForwardTransform ) const; | |||
#endif | #endif | |||
/*! Transform a QgsRectangle to the dest Coordinate system | /*! Transform a QgsRectangle to the dest Coordinate system | |||
* If the direction is ForwardTransform then coordinates are transformed | * If the direction is ForwardTransform then coordinates are transforme | |||
from layer CS --> map canvas CS, | d from layer CS --> map canvas CS, | |||
* otherwise points are transformed from map canvas CS to layerCS. | * otherwise points are transformed from map canvas CS to layerCS. | |||
* @param theRect rect to transform | * @param theRect rect to transform | |||
* @param direction TransformDirection (defaults to ForwardTransform) | * @param direction TransformDirection (defaults to ForwardTransform) | |||
* @return QgsRectangle in Destination Coordinate System | * @return QgsRectangle in Destination Coordinate System | |||
*/ | */ | |||
QgsRectangle transform( const QgsRectangle theRect, TransformDirection direction = ForwardTransform ) const; | QgsRectangle transform( const QgsRectangle theRect, TransformDirection direction = ForwardTransform ) const; | |||
/*! Transform an array of coordinates to a different Coordinate System | /*! Transform an array of coordinates to a different Coordinate System | |||
* If the direction is ForwardTransform then coordinates are transformed | * If the direction is ForwardTransform then coordinates are transforme | |||
from layer CS --> map canvas CS, | d from layer CS --> map canvas CS, | |||
* otherwise points are transformed from map canvas CS to layerCS. | * otherwise points are transformed from map canvas CS to layerCS. | |||
* @param numPoint number of coordinates in arrays | * @param numPoint number of coordinates in arrays | |||
* @param x array of x coordinates to transform | * @param x array of x coordinates to transform | |||
* @param y array of y coordinates to transform | * @param y array of y coordinates to transform | |||
* @param z array of z coordinates to transform | * @param z array of z coordinates to transform | |||
* @param direction TransformDirection (defaults to ForwardTransform) | * @param direction TransformDirection (defaults to ForwardTransform) | |||
* @return QgsRectangle in Destination Coordinate System | * @return QgsRectangle in Destination Coordinate System | |||
*/ | */ | |||
void transformCoords( const int &numPoint, double *x, double *y, double *z, TransformDirection direction = ForwardTransform ) const; | void transformCoords( const int &numPoint, double *x, double *y, double *z, TransformDirection direction = ForwardTransform ) const; | |||
/*! | /*! | |||
* Flag to indicate whether the coordinate systems have been initialise d | * Flag to indicate whether the coordinate systems have been initialise d | |||
* @return true if initialised, otherwise false | * @return true if initialised, otherwise false | |||
*/ | */ | |||
bool isInitialised() const {return mInitialisedFlag;}; | bool isInitialised() const {return mInitialisedFlag;}; | |||
/*! See if the transform short circuits because src and dest are equiva lent | /*! See if the transform short circuits because src and dest are equiva lent | |||
End of changes. 11 change blocks. | ||||
42 lines changed or deleted | 48 lines changed or added | |||
qgscredentialdialog.h | qgscredentialdialog.h | |||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
/** \ingroup gui | /** \ingroup gui | |||
* A generic dialog for requesting credentials | * A generic dialog for requesting credentials | |||
*/ | */ | |||
class GUI_EXPORT QgsCredentialDialog : public QDialog, public QgsCredential s, private Ui_QgsCredentialDialog | class GUI_EXPORT QgsCredentialDialog : public QDialog, public QgsCredential s, private Ui_QgsCredentialDialog | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsCredentialDialog( QWidget *parent = 0, Qt::WFlags fl = QgisGui::Moda lDialogFlags ); | QgsCredentialDialog( QWidget *parent = 0, Qt::WFlags fl = QgisGui::Moda lDialogFlags ); | |||
~QgsCredentialDialog(); | ~QgsCredentialDialog(); | |||
signals: | ||||
void credentialsRequested( QString, QString *, QString *, QString, bool | ||||
* ); | ||||
private slots: | ||||
void requestCredentials( QString, QString *, QString *, QString, bool * | ||||
); | ||||
protected: | protected: | |||
virtual bool request( QString realm, QString &username, QString &passwo rd, QString message = QString::null ); | virtual bool request( QString realm, QString &username, QString &passwo rd, QString message = QString::null ); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 8 lines changed or added | |||
qgsdashspacedialog.h | qgsdashspacedialog.h | |||
---|---|---|---|---|
skipping to change at line 22 | skipping to change at line 22 | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSDASHSPACEDIALOG_H | #ifndef QGSDASHSPACEDIALOG_H | |||
#define QGSDASHSPACEDIALOG_H | #define QGSDASHSPACEDIALOG_H | |||
#include "ui_qgsdashspacedialogbase.h" | #include "ui_qgsdashspacedialogbase.h" | |||
/**A dialog to enter a custom dash space pattern for lines*/ | /**A dialog to enter a custom dash space pattern for lines*/ | |||
class QgsDashSpaceDialog: public QDialog, private Ui::QgsDashSpaceDialogBas e | class GUI_EXPORT QgsDashSpaceDialog: public QDialog, private Ui::QgsDashSpa ceDialogBase | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsDashSpaceDialog( const QVector<qreal>& v, QWidget * parent = 0, Qt:: WindowFlags f = 0 ); | QgsDashSpaceDialog( const QVector<qreal>& v, QWidget * parent = 0, Qt:: WindowFlags f = 0 ); | |||
~QgsDashSpaceDialog(); | ~QgsDashSpaceDialog(); | |||
QVector<qreal> dashDotVector() const; | QVector<qreal> dashDotVector() const; | |||
private slots: | private slots: | |||
void on_mAddButton_clicked(); | void on_mAddButton_clicked(); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgsdataitem.h | qgsdataitem.h | |||
---|---|---|---|---|
skipping to change at line 28 | skipping to change at line 28 | |||
#define QGSDATAITEM_H | #define QGSDATAITEM_H | |||
#include <QIcon> | #include <QIcon> | |||
#include <QLibrary> | #include <QLibrary> | |||
#include <QObject> | #include <QObject> | |||
#include <QPixmap> | #include <QPixmap> | |||
#include <QString> | #include <QString> | |||
#include <QVector> | #include <QVector> | |||
#include <QTreeWidget> | #include <QTreeWidget> | |||
#include "qgsapplication.h" | ||||
#include "qgsmaplayer.h" | #include "qgsmaplayer.h" | |||
#include "qgscoordinatereferencesystem.h" | #include "qgscoordinatereferencesystem.h" | |||
class QgsDataProvider; | class QgsDataProvider; | |||
class QgsDataItem; | class QgsDataItem; | |||
// TODO: bad place, where to put this? qgsproviderregistry.h? | // TODO: bad place, where to put this? qgsproviderregistry.h? | |||
typedef int dataCapabilities_t(); | typedef int dataCapabilities_t(); | |||
typedef QgsDataItem * dataItem_t( QString, QgsDataItem* ); | typedef QgsDataItem * dataItem_t( QString, QgsDataItem* ); | |||
skipping to change at line 53 | skipping to change at line 54 | |||
enum Type | enum Type | |||
{ | { | |||
Collection, | Collection, | |||
Directory, | Directory, | |||
Layer, | Layer, | |||
Error, | Error, | |||
Favourites | Favourites | |||
}; | }; | |||
QgsDataItem( QgsDataItem::Type type, QgsDataItem* parent, QString name, QString path ); | QgsDataItem( QgsDataItem::Type type, QgsDataItem* parent, QString name, QString path ); | |||
virtual ~QgsDataItem() {} | virtual ~QgsDataItem(); | |||
bool hasChildren(); | bool hasChildren(); | |||
int rowCount(); | int rowCount(); | |||
// | // | |||
virtual void refresh(); | virtual void refresh(); | |||
// Create vector of children | // Create vector of children | |||
virtual QVector<QgsDataItem*> createChildren(); | virtual QVector<QgsDataItem*> createChildren(); | |||
// Populate children using children vector created by createChildren() | // Populate children using children vector created by createChildren() | |||
virtual void populate(); | virtual void populate(); | |||
bool isPopulated() { return mPopulated; } | ||||
// Insert new child using alphabetical order based on mName, emits nece ssary signal to model before and after, sets parent and connects signals | // Insert new child using alphabetical order based on mName, emits nece ssary signal to model before and after, sets parent and connects signals | |||
// refresh - refresh populated item, emit signals to model | // refresh - refresh populated item, emit signals to model | |||
virtual void addChildItem( QgsDataItem * child, bool refresh = false ); | virtual void addChildItem( QgsDataItem * child, bool refresh = false ); | |||
// remove and delete child item, signals to browser are emited | // remove and delete child item, signals to browser are emitted | |||
virtual void deleteChildItem( QgsDataItem * child ); | virtual void deleteChildItem( QgsDataItem * child ); | |||
// remove child item but don't delete it, signals to browser are emitte | ||||
d | ||||
// returns pointer to the removed item or null if no such item was foun | ||||
d | ||||
virtual QgsDataItem * removeChildItem( QgsDataItem * child ); | ||||
virtual bool equal( const QgsDataItem *other ); | virtual bool equal( const QgsDataItem *other ); | |||
virtual QWidget * paramWidget() { return 0; } | virtual QWidget * paramWidget() { return 0; } | |||
// list of actions provided by this item - usually used for popup menu on right-click | // list of actions provided by this item - usually used for popup menu on right-click | |||
virtual QList<QAction*> actions() { return QList<QAction*>(); } | virtual QList<QAction*> actions() { return QList<QAction*>(); } | |||
// whether accepts drag&drop'd layers - e.g. for import | // whether accepts drag&drop'd layers - e.g. for import | |||
virtual bool acceptDrop() { return false; } | virtual bool acceptDrop() { return false; } | |||
skipping to change at line 105 | skipping to change at line 111 | |||
}; | }; | |||
// This will _write_ selected crs in data source | // This will _write_ selected crs in data source | |||
virtual bool setCrs( QgsCoordinateReferenceSystem crs ) | virtual bool setCrs( QgsCoordinateReferenceSystem crs ) | |||
{ Q_UNUSED( crs ); return false; } | { Q_UNUSED( crs ); return false; } | |||
virtual Capability capabilities() { return NoCapabilities; } | virtual Capability capabilities() { return NoCapabilities; } | |||
// static methods | // static methods | |||
static QPixmap getThemePixmap( const QString theName ); | ||||
// Find child index in vector of items using '==' operator | // Find child index in vector of items using '==' operator | |||
static int findItem( QVector<QgsDataItem*> items, QgsDataItem * item ); | static int findItem( QVector<QgsDataItem*> items, QgsDataItem * item ); | |||
// members | // members | |||
Type type() const { return mType; } | Type type() const { return mType; } | |||
QgsDataItem* parent() const { return mParent; } | QgsDataItem* parent() const { return mParent; } | |||
void setParent( QgsDataItem* parent ) { mParent = parent; } | ||||
QVector<QgsDataItem*> children() const { return mChildren; } | QVector<QgsDataItem*> children() const { return mChildren; } | |||
QIcon icon() const { return mIcon; } | QIcon icon() const { return mIcon; } | |||
QString name() const { return mName; } | QString name() const { return mName; } | |||
QString path() const { return mPath; } | QString path() const { return mPath; } | |||
void setIcon( QIcon icon ) { mIcon = icon; } | void setIcon( QIcon icon ) { mIcon = icon; } | |||
void setToolTip( QString msg ) { mToolTip = msg; } | void setToolTip( QString msg ) { mToolTip = msg; } | |||
QString toolTip() const { return mToolTip; } | QString toolTip() const { return mToolTip; } | |||
skipping to change at line 237 | skipping to change at line 242 | |||
Group, | Group, | |||
Type | Type | |||
}; | }; | |||
QgsDirectoryItem( QgsDataItem* parent, QString name, QString path ); | QgsDirectoryItem( QgsDataItem* parent, QString name, QString path ); | |||
~QgsDirectoryItem(); | ~QgsDirectoryItem(); | |||
QVector<QgsDataItem*> createChildren(); | QVector<QgsDataItem*> createChildren(); | |||
virtual bool equal( const QgsDataItem *other ); | virtual bool equal( const QgsDataItem *other ); | |||
virtual QWidget * paramWidget(); | virtual QWidget *paramWidget(); | |||
/* static QVector<QgsDataProvider*> mProviders; */ | /* static QVector<QgsDataProvider*> mProviders; */ | |||
//! @note not available via python bindings | ||||
static QVector<QLibrary*> mLibraries; | static QVector<QLibrary*> mLibraries; | |||
}; | }; | |||
/** | /** | |||
Data item that can be used to report problems (e.g. network error) | Data item that can be used to report problems (e.g. network error) | |||
*/ | */ | |||
class CORE_EXPORT QgsErrorItem : public QgsDataItem | class CORE_EXPORT QgsErrorItem : public QgsDataItem | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsErrorItem( QgsDataItem* parent, QString error, QString path ); | QgsErrorItem( QgsDataItem* parent, QString error, QString path ); | |||
~QgsErrorItem(); | ~QgsErrorItem(); | |||
//QVector<QgsDataItem*> createChildren(); | //QVector<QgsDataItem*> createChildren(); | |||
//virtual bool equal( const QgsDataItem *other ); | //virtual bool equal( const QgsDataItem *other ); | |||
}; | }; | |||
// --------- | // --------- | |||
class QgsDirectoryParamWidget : public QTreeWidget | class CORE_EXPORT QgsDirectoryParamWidget : public QTreeWidget | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsDirectoryParamWidget( QString path, QWidget* parent = NULL ); | QgsDirectoryParamWidget( QString path, QWidget* parent = NULL ); | |||
protected: | protected: | |||
void mousePressEvent( QMouseEvent* event ); | void mousePressEvent( QMouseEvent* event ); | |||
public slots: | public slots: | |||
skipping to change at line 284 | skipping to change at line 290 | |||
/** Contains various Favourites directories */ | /** Contains various Favourites directories */ | |||
class CORE_EXPORT QgsFavouritesItem : public QgsDataCollectionItem | class CORE_EXPORT QgsFavouritesItem : public QgsDataCollectionItem | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsFavouritesItem( QgsDataItem* parent, QString name, QString path = QS tring() ); | QgsFavouritesItem( QgsDataItem* parent, QString name, QString path = QS tring() ); | |||
~QgsFavouritesItem(); | ~QgsFavouritesItem(); | |||
QVector<QgsDataItem*> createChildren(); | QVector<QgsDataItem*> createChildren(); | |||
void addDirectory( QString favIcon ); | ||||
void removeDirectory( QgsDirectoryItem *item ); | ||||
static const QIcon &iconFavourites(); | static const QIcon &iconFavourites(); | |||
}; | }; | |||
/** A zip file: contains layers, using GDAL/OGR VSIFILE mechanism */ | /** A zip file: contains layers, using GDAL/OGR VSIFILE mechanism */ | |||
class CORE_EXPORT QgsZipItem : public QgsDataCollectionItem | class CORE_EXPORT QgsZipItem : public QgsDataCollectionItem | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
protected: | protected: | |||
QString mVsiPrefix; | ||||
QStringList mZipFileList; | QStringList mZipFileList; | |||
public: | public: | |||
QgsZipItem( QgsDataItem* parent, QString name, QString path ); | QgsZipItem( QgsDataItem* parent, QString name, QString path ); | |||
~QgsZipItem(); | ~QgsZipItem(); | |||
QVector<QgsDataItem*> createChildren(); | QVector<QgsDataItem*> createChildren(); | |||
QStringList getFiles(); | const QStringList & getZipFileList(); | |||
//! @note not available via python bindings | ||||
static QVector<dataItem_t *> mDataItemPtr; | static QVector<dataItem_t *> mDataItemPtr; | |||
static QStringList mProviderNames; | static QStringList mProviderNames; | |||
static QString vsiPrefix( QString uri ); | ||||
static QgsDataItem* itemFromPath( QgsDataItem* parent, QString path, QS tring name ); | static QgsDataItem* itemFromPath( QgsDataItem* parent, QString path, QS tring name ); | |||
static const QIcon &iconZip(); | static const QIcon &iconZip(); | |||
const QStringList & getZipFileList() const { return mZipFileList; } | ||||
}; | }; | |||
#endif // QGSDATAITEM_H | #endif // QGSDATAITEM_H | |||
End of changes. 16 change blocks. | ||||
9 lines changed or deleted | 22 lines changed or added | |||
qgsdataprovider.h | qgsdataprovider.h | |||
---|---|---|---|---|
skipping to change at line 25 | skipping to change at line 25 | |||
#ifndef QQGSDATAPROVIDER_H | #ifndef QQGSDATAPROVIDER_H | |||
#define QQGSDATAPROVIDER_H | #define QQGSDATAPROVIDER_H | |||
#include <QDateTime> | #include <QDateTime> | |||
#include <QObject> | #include <QObject> | |||
#include <QString> | #include <QString> | |||
#include <QStringList> | #include <QStringList> | |||
//#include "qgsdataitem.h" | //#include "qgsdataitem.h" | |||
#include "qgserror.h" | ||||
class QgsRectangle; | class QgsRectangle; | |||
class QgsCoordinateReferenceSystem; | class QgsCoordinateReferenceSystem; | |||
/** \ingroup core | /** \ingroup core | |||
* Abstract base class for spatial data provider implementations. | * Abstract base class for spatial data provider implementations. | |||
* @author Gary E.Sherman | * @author Gary E.Sherman | |||
* | * | |||
* This object needs to inherit from QObject to enable event | * This object needs to inherit from QObject to enable event | |||
* processing in the Postgres/PostGIS provider (QgsPostgresProvider). | * processing in the Postgres/PostGIS provider (QgsPostgresProvider). | |||
skipping to change at line 79 | skipping to change at line 80 | |||
* If the provider isn't capable of returning | * If the provider isn't capable of returning | |||
* its projection an empty srs will be return, ti will return 0 | * its projection an empty srs will be return, ti will return 0 | |||
*/ | */ | |||
virtual QgsCoordinateReferenceSystem crs() = 0; | virtual QgsCoordinateReferenceSystem crs() = 0; | |||
/** | /** | |||
* Set the data source specification. This may be a path or database | * Set the data source specification. This may be a path or database | |||
* connection string | * connection string | |||
* @param uri source specification | * @param uri source specification | |||
*/ | */ | |||
virtual void setDataSourceUri( QString const & uri ) | virtual void setDataSourceUri( const QString & uri ) | |||
{ | { | |||
mDataSourceURI = uri; | mDataSourceURI = uri; | |||
} | } | |||
/** | /** | |||
* Get the data source specification. This may be a path or database | * Get the data source specification. This may be a path or database | |||
* connection string | * connection string | |||
* @return data source specification | * @return data source specification | |||
*/ | */ | |||
virtual QString dataSourceUri() const | virtual QString dataSourceUri() const | |||
skipping to change at line 265 | skipping to change at line 266 | |||
@note | @note | |||
It'd be nice to eventually be raster/vector neutral. | It'd be nice to eventually be raster/vector neutral. | |||
*/ | */ | |||
virtual QString fileRasterFilters() const | virtual QString fileRasterFilters() const | |||
{ | { | |||
return ""; | return ""; | |||
} | } | |||
/**Reloads the data from the the source. Needs to be implemented by pro viders with data caches to | /**Reloads the data from the source. Needs to be implemented by provide rs with data caches to | |||
synchronize with changes in the data source*/ | synchronize with changes in the data source*/ | |||
virtual void reloadData() {} | virtual void reloadData() {} | |||
/** Time stamp of data source in the moment when data/metadata were loa ded by provider */ | /** Time stamp of data source in the moment when data/metadata were loa ded by provider */ | |||
virtual QDateTime timestamp() const { return mTimestamp; } | virtual QDateTime timestamp() const { return mTimestamp; } | |||
/** Current time stamp of data source */ | /** Current time stamp of data source */ | |||
virtual QDateTime dataTimestamp() const { return QDateTime(); } | virtual QDateTime dataTimestamp() const { return QDateTime(); } | |||
/** Get current status error. This error describes some principal probl | ||||
em | ||||
* for which provider cannot work and thus is not valid. It is not las | ||||
t error | ||||
* after accessing data by block(), identify() etc. | ||||
*/ | ||||
virtual QgsError error() const { return mError; } | ||||
signals: | signals: | |||
/** | /** | |||
* This is emitted whenever the worker thread has fully calculated th e | * This is emitted whenever the worker thread has fully calculated th e | |||
* PostGIS extents for this layer, and its event has been received by this | * PostGIS extents for this layer, and its event has been received by this | |||
* provider. | * provider. | |||
*/ | */ | |||
void fullExtentCalculated(); | void fullExtentCalculated(); | |||
/** | /** | |||
skipping to change at line 303 | skipping to change at line 310 | |||
* @param changed binary combination of changes | * @param changed binary combination of changes | |||
* @note added in 1.7 | * @note added in 1.7 | |||
*/ | */ | |||
void dataChanged( int changed ); | void dataChanged( int changed ); | |||
protected: | protected: | |||
/** | /** | |||
* Timestamp of data in the moment when the data were loaded by provider . | * Timestamp of data in the moment when the data were loaded by provider . | |||
*/ | */ | |||
QDateTime mTimestamp; | QDateTime mTimestamp; | |||
/** \brief Error */ | ||||
QgsError mError; | ||||
/** Add error message */ | ||||
void appendError( const QgsErrorMessage & theMessage ) { mError.append( | ||||
theMessage );} | ||||
/** Set error message */ | ||||
void setError( const QgsError & theError ) { mError = theError;} | ||||
private: | private: | |||
/** | /** | |||
* Universal Resource Identifier for source data. | * Universal Resource Identifier for source data. | |||
* This could be a file, database, or server address. | * This could be a file, database, or server address. | |||
*/ | */ | |||
QString mDataSourceURI; | QString mDataSourceURI; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 22 lines changed or added | |||
qgsdatasourceuri.h | qgsdatasourceuri.h | |||
---|---|---|---|---|
skipping to change at line 24 | skipping to change at line 24 | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSDATASOURCEURI_H | #ifndef QGSDATASOURCEURI_H | |||
#define QGSDATASOURCEURI_H | #define QGSDATASOURCEURI_H | |||
#include "qgis.h" | #include "qgis.h" | |||
#include <QMap> | ||||
/** \ingroup core | /** \ingroup core | |||
* Class for storing the component parts of a PostgreSQL/RDBMS datasource U RI. | * Class for storing the component parts of a PostgreSQL/RDBMS datasource U RI. | |||
* This structure stores the database connection information, including hos t, database, | * This structure stores the database connection information, including hos t, database, | |||
* user name, password, schema, password, and sql where clause | * user name, password, schema, password, and sql where clause | |||
* | ||||
* Extended to support generic params so that it may be used by any provide | ||||
r. | ||||
* The 2 modes (the old - RDMS specific and the new generic) may not yet be | ||||
mixed. | ||||
* (Radim Blazek 4/2012) | ||||
*/ | */ | |||
class CORE_EXPORT QgsDataSourceURI | class CORE_EXPORT QgsDataSourceURI | |||
{ | { | |||
public: | public: | |||
//! \note enumeration added in version 1.1 | //! \note enumeration added in version 1.1 | |||
enum SSLmode { SSLprefer, SSLdisable, SSLallow, SSLrequire }; | enum SSLmode { SSLprefer, SSLdisable, SSLallow, SSLrequire }; | |||
//! default constructor | //! default constructor | |||
QgsDataSourceURI(); | QgsDataSourceURI(); | |||
//! constructor which parses input URI | //! constructor which parses input URI | |||
QgsDataSourceURI( QString uri ); | QgsDataSourceURI( QString uri ); | |||
//! constructor which parses input encoded URI (generic mode) | ||||
// \note added in 1.9 | ||||
QgsDataSourceURI( const QByteArray & uri ); | ||||
//! return connection part of URI | //! return connection part of URI | |||
QString connectionInfo() const; | QString connectionInfo() const; | |||
//! return complete uri | //! return complete uri | |||
QString uri() const; | QString uri() const; | |||
//! return complete encoded uri (generic mode) | ||||
// \note added in 1.9 | ||||
QByteArray encodedUri() const; | ||||
//! set complete encoded uri (generic mode) | ||||
// \note added in 1.9 | ||||
// \note not available in python bindings | ||||
void setEncodedUri( const QByteArray & uri ); | ||||
//! set complete encoded uri (generic mode) | ||||
// \note added in 1.9 | ||||
void setEncodedUri( const QString & uri ); | ||||
//! quoted table name | //! quoted table name | |||
QString quotedTablename() const; | QString quotedTablename() const; | |||
//! Set generic param (generic mode) | ||||
// \note if key exists, another is inserted | ||||
// \note added in 1.9 | ||||
void setParam( const QString &key, const QString &value ); | ||||
void setParam( const QString &key, const QStringList &value ); | ||||
//! Remove generic param (generic mode) | ||||
// \note remove all occurrences of key, returns number of params remove | ||||
d | ||||
// \note added in 1.9 | ||||
int removeParam( const QString &key ); | ||||
//! Get generic param (generic mode) | ||||
// \note added in 1.9 | ||||
QString param( const QString &key ) const; | ||||
//! Get multiple generic param (generic mode) | ||||
// \note added in 1.9 | ||||
QStringList params( const QString &key ) const; | ||||
//! Test if param exists (generic mode) | ||||
// \note added in 1.9 | ||||
bool hasParam( const QString &key ) const; | ||||
//! Set all connection related members at once | //! Set all connection related members at once | |||
//! \note This optional sslmode parameter has been added in version 1.1 | //! \note This optional sslmode parameter has been added in version 1.1 | |||
void setConnection( const QString& aHost, | void setConnection( const QString& aHost, | |||
const QString& aPort, | const QString& aPort, | |||
const QString& aDatabase, | const QString& aDatabase, | |||
const QString& aUsername, | const QString& aUsername, | |||
const QString& aPassword, | const QString& aPassword, | |||
SSLmode sslmode = SSLprefer ); | SSLmode sslmode = SSLprefer ); | |||
//! Set all connection related members at once (for the service case) | //! Set all connection related members at once (for the service case) | |||
skipping to change at line 124 | skipping to change at line 170 | |||
QString service() const; | QString service() const; | |||
// added in version 1.2 | // added in version 1.2 | |||
QString keyColumn() const; | QString keyColumn() const; | |||
void setKeyColumn( QString column ); | void setKeyColumn( QString column ); | |||
// added in 1.9 | // added in 1.9 | |||
QGis::WkbType wkbType() const; | QGis::WkbType wkbType() const; | |||
void setWkbType( QGis::WkbType type ); | void setWkbType( QGis::WkbType type ); | |||
// added in 1.9 | ||||
QString srid() const; | QString srid() const; | |||
void setSrid( QString srid ); | void setSrid( QString srid ); | |||
private: | private: | |||
void skipBlanks( const QString &uri, int &i ); | void skipBlanks( const QString &uri, int &i ); | |||
QString getValue( const QString &uri, int &i ); | QString getValue( const QString &uri, int &i ); | |||
QString escape( const QString &uri, QChar delim ) const; | QString escape( const QString &uri, QChar delim ) const; | |||
/* data */ | /* data */ | |||
skipping to change at line 166 | skipping to change at line 213 | |||
//! key column | //! key column | |||
QString mKeyColumn; | QString mKeyColumn; | |||
//! Use estimated metadata flag | //! Use estimated metadata flag | |||
bool mUseEstimatedMetadata; | bool mUseEstimatedMetadata; | |||
//! Disable SelectAtId capability (eg. to trigger the attribute table m emory model for expensive views) | //! Disable SelectAtId capability (eg. to trigger the attribute table m emory model for expensive views) | |||
bool mSelectAtIdDisabled; | bool mSelectAtIdDisabled; | |||
//! geometry type (or QGis::WKBUnknown if not specified) | //! geometry type (or QGis::WKBUnknown if not specified) | |||
QGis::WkbType mWkbType; | QGis::WkbType mWkbType; | |||
//! SRID or a null string if not specified | //! SRID or a null string if not specified | |||
QString mSrid; | QString mSrid; | |||
//! Generic params store | ||||
QMap<QString, QString> mParams; | ||||
}; | }; | |||
#endif //QGSDATASOURCEURI_H | #endif //QGSDATASOURCEURI_H | |||
End of changes. 7 change blocks. | ||||
0 lines changed or deleted | 52 lines changed or added | |||
qgsderivativefilter.h | qgsderivativefilter.h | |||
---|---|---|---|---|
skipping to change at line 24 | skipping to change at line 24 | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSDERIVATIVEFILTER_H | #ifndef QGSDERIVATIVEFILTER_H | |||
#define QGSDERIVATIVEFILTER_H | #define QGSDERIVATIVEFILTER_H | |||
#include "qgsninecellfilter.h" | #include "qgsninecellfilter.h" | |||
/**Adds the ability to calculate derivatives in x- and y-directions. Needs to be subclassed (e.g. for slope and aspect)*/ | /**Adds the ability to calculate derivatives in x- and y-directions. Needs to be subclassed (e.g. for slope and aspect)*/ | |||
class QgsDerivativeFilter: public QgsNineCellFilter | class ANALYSIS_EXPORT QgsDerivativeFilter : public QgsNineCellFilter | |||
{ | { | |||
public: | public: | |||
QgsDerivativeFilter( const QString& inputFile, const QString& outputFil e, const QString& outputFormat ); | QgsDerivativeFilter( const QString& inputFile, const QString& outputFil e, const QString& outputFormat ); | |||
virtual ~QgsDerivativeFilter(); | virtual ~QgsDerivativeFilter(); | |||
//to be implemented by subclasses | //to be implemented by subclasses | |||
virtual float processNineCellWindow( float* x11, float* x21, float* x31 , | virtual float processNineCellWindow( float* x11, float* x21, float* x31 , | |||
float* x12, float* x22, float* x32 , | float* x12, float* x22, float* x32 , | |||
float* x13, float* x23, float* x33 ) = 0; | float* x13, float* x23, float* x33 ) = 0; | |||
protected: | protected: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgsdetaileditemwidget.h | qgsdetaileditemwidget.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
#ifndef QGSDETAILEDITEMWIDGET_H | #ifndef QGSDETAILEDITEMWIDGET_H | |||
#define QGSDETAILEDITEMWIDGET_H | #define QGSDETAILEDITEMWIDGET_H | |||
#include <ui_qgsdetaileditemwidgetbase.h> | #include <ui_qgsdetaileditemwidgetbase.h> | |||
#include <qgsdetaileditemdata.h> | #include <qgsdetaileditemdata.h> | |||
/** \ingroup gui | /** \ingroup gui | |||
* A widget renderer for detailed item views. | * A widget renderer for detailed item views. | |||
* @see also QgsDetailedItem and QgsDetailedItemData. | * @see also QgsDetailedItem and QgsDetailedItemData. | |||
*/ | */ | |||
class QgsDetailedItemWidget : | class GUI_EXPORT QgsDetailedItemWidget : | |||
public QWidget, private Ui::QgsDetailedItemWidgetBase | public QWidget, private Ui::QgsDetailedItemWidgetBase | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsDetailedItemWidget( QWidget * parent = 0 ); | QgsDetailedItemWidget( QWidget * parent = 0 ); | |||
~QgsDetailedItemWidget(); | ~QgsDetailedItemWidget(); | |||
void setData( QgsDetailedItemData theData ); | void setData( QgsDetailedItemData theData ); | |||
void setChecked( bool theFlag ); | void setChecked( bool theFlag ); | |||
private: | private: | |||
QgsDetailedItemData mData; | QgsDetailedItemData mData; | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgsdiagramrendererv2.h | qgsdiagramrendererv2.h | |||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSDIAGRAMRENDERERV2_H | #ifndef QGSDIAGRAMRENDERERV2_H | |||
#define QGSDIAGRAMRENDERERV2_H | #define QGSDIAGRAMRENDERERV2_H | |||
#include <QColor> | #include <QColor> | |||
#include <QFont> | #include <QFont> | |||
#include <QList> | #include <QList> | |||
#include <QPointF> | #include <QPointF> | |||
#include <QSizeF> | #include <QSizeF> | |||
#include <QDomDocument> | ||||
#include "qgsfeature.h" | #include "qgsfeature.h" | |||
#include "qgspallabeling.h" | ||||
class QgsDiagram; | class QgsDiagram; | |||
class QgsDiagramRendererV2; | class QgsDiagramRendererV2; | |||
class QgsFeature; | class QgsFeature; | |||
class QgsRenderContext; | class QgsRenderContext; | |||
class QDomElement; | class QDomElement; | |||
class QgsPalGeometry; | ||||
class QgsCoordinateTransform; | ||||
class QgsMapToPixel; | ||||
class QgsVectorLayer; | ||||
namespace pal { class Layer; } | namespace pal { class Layer; } | |||
struct CORE_EXPORT QgsDiagramLayerSettings | class CORE_EXPORT QgsDiagramLayerSettings | |||
{ | { | |||
//avoid inclusion of QgsPalLabeling | public: | |||
enum Placement | //avoid inclusion of QgsPalLabeling | |||
{ | enum Placement | |||
AroundPoint, // Point / Polygon | { | |||
OverPoint, // Point / Polygon | AroundPoint = 0, // Point / Polygon | |||
Line, // Line / Polygon | OverPoint, // Point / Polygon | |||
Curved, // Line | Line, // Line / Polygon | |||
Horizontal, // Polygon | Curved, // Line | |||
Free // Polygon | Horizontal, // Polygon | |||
}; | Free // Polygon | |||
}; | ||||
enum LinePlacementFlags | ||||
{ | enum LinePlacementFlags | |||
OnLine = 1, | { | |||
AboveLine = 2, | OnLine = 1, | |||
BelowLine = 4, | AboveLine = 2, | |||
MapOrientation = 8 | BelowLine = 4, | |||
}; | MapOrientation = 8 | |||
}; | ||||
QgsDiagramLayerSettings() | ||||
: placement( AroundPoint ) | QgsDiagramLayerSettings() | |||
, placementFlags( OnLine ) | : placement( AroundPoint ) | |||
, priority( 5 ) | , placementFlags( OnLine ) | |||
, obstacle( false ) | , priority( 5 ) | |||
, dist( 0.0 ) | , obstacle( false ) | |||
, renderer( 0 ) | , dist( 0.0 ) | |||
, palLayer( 0 ) | , renderer( 0 ) | |||
, ct( 0 ) | , palLayer( 0 ) | |||
, xform( 0 ) | , ct( 0 ) | |||
, xPosColumn( -1 ) | , xform( 0 ) | |||
, yPosColumn( -1 ) | , xPosColumn( -1 ) | |||
{ | , yPosColumn( -1 ) | |||
} | { | |||
} | ||||
//pal placement properties | ||||
Placement placement; | //pal placement properties | |||
LinePlacementFlags placementFlags; | Placement placement; | |||
int priority; // 0 = low, 10 = high | LinePlacementFlags placementFlags; | |||
bool obstacle; // whether it's an obstacle | int priority; // 0 = low, 10 = high | |||
double dist; // distance from the feature (in mm) | bool obstacle; // whether it's an obstacle | |||
QgsDiagramRendererV2* renderer; | double dist; // distance from the feature (in mm) | |||
QgsDiagramRendererV2* renderer; | ||||
//assigned when layer gets prepared | ||||
pal::Layer* palLayer; | //assigned when layer gets prepared | |||
const QgsCoordinateTransform* ct; | pal::Layer* palLayer; | |||
const QgsMapToPixel* xform; | const QgsCoordinateTransform* ct; | |||
QList<QgsPalGeometry*> geometries; | const QgsMapToPixel* xform; | |||
QList<QgsPalGeometry*> geometries; | ||||
int xPosColumn; //attribute index for x coordinate (or -1 if position not | int xPosColumn; //attribute index for x coordinate (or -1 if position n | |||
data defined) | ot data defined) | |||
int yPosColumn;//attribute index for y coordinate (or -1 if position not | int yPosColumn;//attribute index for y coordinate (or -1 if position no | |||
data defined) | t data defined) | |||
void readXML( const QDomElement& elem ); | void readXML( const QDomElement& elem, const QgsVectorLayer* layer ); | |||
void writeXML( QDomElement& layerElem, QDomDocument& doc ) const; | void writeXML( QDomElement& layerElem, QDomDocument& doc, const QgsVect | |||
orLayer* layer ) const; | ||||
}; | }; | |||
//diagram settings for rendering | //diagram settings for rendering | |||
struct CORE_EXPORT QgsDiagramSettings | class CORE_EXPORT QgsDiagramSettings | |||
{ | { | |||
enum SizeType | public: | |||
{ | enum SizeType | |||
MM, | { | |||
MapUnits | MM, | |||
}; | MapUnits | |||
}; | ||||
QgsDiagramSettings(): sizeType( MM ), minScaleDenominator( -1 ), maxScale | ||||
Denominator( -1 ) | enum LabelPlacementMethod | |||
{} | { | |||
QFont font; | Height, | |||
QList< QColor > categoryColors; | XHeight | |||
QList< int > categoryIndices; | }; | |||
QSizeF size; //size | ||||
SizeType sizeType; //mm or map units | //! Orientation of histogram | |||
QColor backgroundColor; | enum DiagramOrientation | |||
QColor penColor; | { | |||
double penWidth; | Up, | |||
Down, | ||||
//scale range (-1 if no lower / upper bound ) | Left, | |||
double minScaleDenominator; | Right | |||
double maxScaleDenominator; | }; | |||
QgsDiagramSettings(): sizeType( MM ), minScaleDenominator( -1 ), maxSca | ||||
leDenominator( -1 ) | ||||
{} | ||||
QFont font; | ||||
QList< QColor > categoryColors; | ||||
QList< int > categoryIndices; | ||||
QSizeF size; //size | ||||
SizeType sizeType; //mm or map units | ||||
QColor backgroundColor; | ||||
QColor penColor; | ||||
double penWidth; | ||||
LabelPlacementMethod labelPlacementMethod; | ||||
DiagramOrientation diagramOrientation; | ||||
double barWidth; | ||||
int transparency; // 0 - 100 | ||||
bool scaleByArea; | ||||
int angleOffset; | ||||
//scale range (-1 if no lower / upper bound ) | ||||
double minScaleDenominator; | ||||
double maxScaleDenominator; | ||||
//! Scale diagrams smaller than mMinimumSize to mMinimumSize | ||||
double minimumSize; | ||||
void readXML( const QDomElement& elem ); | void readXML( const QDomElement& elem, const QgsVectorLayer* layer ); | |||
void writeXML( QDomElement& rendererElem, QDomDocument& doc ) const; | void writeXML( QDomElement& rendererElem, QDomDocument& doc, const QgsV | |||
ectorLayer* layer ) const; | ||||
}; | ||||
//additional diagram settings for interpolated size rendering | ||||
class CORE_EXPORT QgsDiagramInterpolationSettings | ||||
{ | ||||
public: | ||||
QSizeF lowerSize; | ||||
QSizeF upperSize; | ||||
double lowerValue; | ||||
double upperValue; | ||||
/**Index of the classification attribute*/ | ||||
int classificationAttribute; | ||||
}; | }; | |||
/**Returns diagram settings for a feature*/ | /**Returns diagram settings for a feature*/ | |||
class CORE_EXPORT QgsDiagramRendererV2 | class CORE_EXPORT QgsDiagramRendererV2 | |||
{ | { | |||
public: | public: | |||
QgsDiagramRendererV2(); | QgsDiagramRendererV2(); | |||
virtual ~QgsDiagramRendererV2(); | virtual ~QgsDiagramRendererV2(); | |||
/**Returns size of the diagram for feature f in map units. Returns an i nvalid QSizeF in case of error*/ | /**Returns size of the diagram for feature f in map units. Returns an i nvalid QSizeF in case of error*/ | |||
virtual QSizeF sizeMapUnits( const QgsAttributeMap& attributes, const Q gsRenderContext& c ); | virtual QSizeF sizeMapUnits( const QgsAttributes& attributes, const Qgs RenderContext& c ); | |||
virtual QString rendererName() const = 0; | virtual QString rendererName() const = 0; | |||
/**Returns attribute indices needed for diagram rendering*/ | /**Returns attribute indices needed for diagram rendering*/ | |||
virtual QList<int> diagramAttributes() const = 0; | virtual QList<int> diagramAttributes() const = 0; | |||
void renderDiagram( const QgsAttributeMap& att, QgsRenderContext& c, co nst QPointF& pos ); | void renderDiagram( const QgsAttributes& att, QgsRenderContext& c, cons t QPointF& pos ); | |||
void setDiagram( QgsDiagram* d ); | void setDiagram( QgsDiagram* d ); | |||
const QgsDiagram* diagram() const { return mDiagram; } | const QgsDiagram* diagram() const { return mDiagram; } | |||
/**Returns list with all diagram settings in the renderer*/ | /**Returns list with all diagram settings in the renderer*/ | |||
virtual QList<QgsDiagramSettings> diagramSettings() const = 0; | virtual QList<QgsDiagramSettings> diagramSettings() const = 0; | |||
virtual void readXML( const QDomElement& elem ) = 0; | virtual void readXML( const QDomElement& elem, const QgsVectorLayer* la | |||
virtual void writeXML( QDomElement& layerElem, QDomDocument& doc ) cons | yer ) = 0; | |||
t = 0; | virtual void writeXML( QDomElement& layerElem, QDomDocument& doc, const | |||
QgsVectorLayer* layer ) const = 0; | ||||
protected: | protected: | |||
/**Returns diagram settings for a feature (or false if the diagram for the feature is not to be rendered). Used internally within renderDiagram() | /**Returns diagram settings for a feature (or false if the diagram for the feature is not to be rendered). Used internally within renderDiagram() | |||
* @param att attribute map | * @param att attribute map | |||
* @param c render context | * @param c render context | |||
* @param s out: diagram settings for the feature | * @param s out: diagram settings for the feature | |||
*/ | */ | |||
virtual bool diagramSettings( const QgsAttributeMap& att, const QgsRend erContext& c, QgsDiagramSettings& s ) = 0; | virtual bool diagramSettings( const QgsAttributes& att, const QgsRender Context& c, QgsDiagramSettings& s ) = 0; | |||
/**Returns size of the diagram (in painter units) or an invalid size in case of error*/ | /**Returns size of the diagram (in painter units) or an invalid size in case of error*/ | |||
virtual QSizeF diagramSize( const QgsAttributeMap& attributes, const Qg sRenderContext& c ) = 0; | virtual QSizeF diagramSize( const QgsAttributes& attributes, const QgsR enderContext& c ) = 0; | |||
/**Converts size from mm to map units*/ | /**Converts size from mm to map units*/ | |||
void convertSizeToMapUnits( QSizeF& size, const QgsRenderContext& conte xt ) const; | void convertSizeToMapUnits( QSizeF& size, const QgsRenderContext& conte xt ) const; | |||
/**Returns the paint device dpi (or -1 in case of error*/ | /**Returns the paint device dpi (or -1 in case of error*/ | |||
static int dpiPaintDevice( const QPainter* ); | static int dpiPaintDevice( const QPainter* ); | |||
//read / write diagram | //read / write diagram | |||
void _readXML( const QDomElement& elem ); | void _readXML( const QDomElement& elem, const QgsVectorLayer* layer ); | |||
void _writeXML( QDomElement& rendererElem, QDomDocument& doc ) const; | void _writeXML( QDomElement& rendererElem, QDomDocument& doc, const Qgs | |||
VectorLayer* layer ) const; | ||||
/**Reference to the object that does the real diagram rendering*/ | /**Reference to the object that does the real diagram rendering*/ | |||
QgsDiagram* mDiagram; | QgsDiagram* mDiagram; | |||
}; | }; | |||
/**Renders the diagrams for all features with the same settings*/ | /**Renders the diagrams for all features with the same settings*/ | |||
class CORE_EXPORT QgsSingleCategoryDiagramRenderer: public QgsDiagramRender erV2 | class CORE_EXPORT QgsSingleCategoryDiagramRenderer : public QgsDiagramRende rerV2 | |||
{ | { | |||
public: | public: | |||
QgsSingleCategoryDiagramRenderer(); | QgsSingleCategoryDiagramRenderer(); | |||
~QgsSingleCategoryDiagramRenderer(); | ~QgsSingleCategoryDiagramRenderer(); | |||
QString rendererName() const { return "SingleCategory"; } | QString rendererName() const { return "SingleCategory"; } | |||
QList<int> diagramAttributes() const { return mSettings.categoryIndices ; } | QList<int> diagramAttributes() const { return mSettings.categoryIndices ; } | |||
void setDiagramSettings( const QgsDiagramSettings& s ) { mSettings = s; } | void setDiagramSettings( const QgsDiagramSettings& s ) { mSettings = s; } | |||
QList<QgsDiagramSettings> diagramSettings() const; | QList<QgsDiagramSettings> diagramSettings() const; | |||
void readXML( const QDomElement& elem ); | void readXML( const QDomElement& elem, const QgsVectorLayer* layer ); | |||
void writeXML( QDomElement& layerElem, QDomDocument& doc ) const; | void writeXML( QDomElement& layerElem, QDomDocument& doc, const QgsVect | |||
orLayer* layer ) const; | ||||
protected: | protected: | |||
bool diagramSettings( const QgsAttributeMap&, const QgsRenderContext& c , QgsDiagramSettings& s ); | bool diagramSettings( const QgsAttributes&, const QgsRenderContext& c, QgsDiagramSettings& s ); | |||
QSizeF diagramSize( const QgsAttributeMap& attributes, const QgsRenderC | QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderCon | |||
ontext& c ) | text& c ); | |||
{ Q_UNUSED( attributes ); Q_UNUSED( c ); return mSettings.size; } | ||||
private: | private: | |||
QgsDiagramSettings mSettings; | QgsDiagramSettings mSettings; | |||
}; | }; | |||
class CORE_EXPORT QgsLinearlyInterpolatedDiagramRenderer: public QgsDiagram RendererV2 | class CORE_EXPORT QgsLinearlyInterpolatedDiagramRenderer : public QgsDiagra mRendererV2 | |||
{ | { | |||
public: | public: | |||
QgsLinearlyInterpolatedDiagramRenderer(); | QgsLinearlyInterpolatedDiagramRenderer(); | |||
~QgsLinearlyInterpolatedDiagramRenderer(); | ~QgsLinearlyInterpolatedDiagramRenderer(); | |||
/**Returns list with all diagram settings in the renderer*/ | /**Returns list with all diagram settings in the renderer*/ | |||
QList<QgsDiagramSettings> diagramSettings() const; | QList<QgsDiagramSettings> diagramSettings() const; | |||
void setDiagramSettings( const QgsDiagramSettings& s ) { mSettings = s; } | void setDiagramSettings( const QgsDiagramSettings& s ) { mSettings = s; } | |||
QList<int> diagramAttributes() const; | QList<int> diagramAttributes() const; | |||
QString rendererName() const { return "LinearlyInterpolated"; } | QString rendererName() const { return "LinearlyInterpolated"; } | |||
void setLowerValue( double val ) { mLowerValue = val; } | void setLowerValue( double val ) { mInterpolationSettings.lowerValue = | |||
double lowerValue() const { return mLowerValue; } | val; } | |||
double lowerValue() const { return mInterpolationSettings.lowerValue; } | ||||
void setUpperValue( double val ) { mUpperValue = val; } | void setUpperValue( double val ) { mInterpolationSettings.upperValue = | |||
double upperValue() const { return mUpperValue; } | val; } | |||
double upperValue() const { return mInterpolationSettings.upperValue; } | ||||
void setLowerSize( QSizeF s ) { mLowerSize = s; } | void setLowerSize( QSizeF s ) { mInterpolationSettings.lowerSize = s; } | |||
QSizeF lowerSize() const { return mLowerSize; } | QSizeF lowerSize() const { return mInterpolationSettings.lowerSize; } | |||
void setUpperSize( QSizeF s ) { mUpperSize = s; } | void setUpperSize( QSizeF s ) { mInterpolationSettings.upperSize = s; } | |||
QSizeF upperSize() const { return mUpperSize; } | QSizeF upperSize() const { return mInterpolationSettings.upperSize; } | |||
int classificationAttribute() const { return mClassificationAttribute; | int classificationAttribute() const { return mInterpolationSettings.cla | |||
} | ssificationAttribute; } | |||
void setClassificationAttribute( int index ) { mClassificationAttribute | void setClassificationAttribute( int index ) { mInterpolationSettings.c | |||
= index; } | lassificationAttribute = index; } | |||
void readXML( const QDomElement& elem ); | void readXML( const QDomElement& elem, const QgsVectorLayer* layer ); | |||
void writeXML( QDomElement& layerElem, QDomDocument& doc ) const; | void writeXML( QDomElement& layerElem, QDomDocument& doc, const QgsVect | |||
orLayer* layer ) const; | ||||
protected: | protected: | |||
bool diagramSettings( const QgsAttributeMap&, const QgsRenderContext& c , QgsDiagramSettings& s ); | bool diagramSettings( const QgsAttributes&, const QgsRenderContext& c, QgsDiagramSettings& s ); | |||
QSizeF diagramSize( const QgsAttributeMap& attributes, const QgsRenderC ontext& c ); | QSizeF diagramSize( const QgsAttributes& attributes, const QgsRenderCon text& c ); | |||
private: | private: | |||
QgsDiagramSettings mSettings; | QgsDiagramSettings mSettings; | |||
QSizeF mLowerSize; | QgsDiagramInterpolationSettings mInterpolationSettings; | |||
QSizeF mUpperSize; | ||||
double mLowerValue; | ||||
double mUpperValue; | ||||
/**Index of the classification attribute*/ | ||||
int mClassificationAttribute; | ||||
}; | }; | |||
#endif // QGSDIAGRAMRENDERERV2_H | #endif // QGSDIAGRAMRENDERERV2_H | |||
End of changes. 30 change blocks. | ||||
118 lines changed or deleted | 164 lines changed or added | |||
qgsdistancearea.h | qgsdistancearea.h | |||
---|---|---|---|---|
skipping to change at line 43 | skipping to change at line 43 | |||
*/ | */ | |||
class CORE_EXPORT QgsDistanceArea | class CORE_EXPORT QgsDistanceArea | |||
{ | { | |||
public: | public: | |||
//! Constructor | //! Constructor | |||
QgsDistanceArea(); | QgsDistanceArea(); | |||
//! Destructor | //! Destructor | |||
~QgsDistanceArea(); | ~QgsDistanceArea(); | |||
//! Copy constructor | ||||
QgsDistanceArea( const QgsDistanceArea &origDA ); | ||||
//! Assignment operator | ||||
QgsDistanceArea & operator=( const QgsDistanceArea & origDA ); | ||||
//! sets whether coordinates must be projected to ellipsoid before meas uring | //! sets whether coordinates must be projected to ellipsoid before meas uring | |||
void setProjectionsEnabled( bool flag ); | void setEllipsoidalMode( bool flag ); | |||
//! returns projections enabled flag | //! returns projections enabled flag | |||
bool hasCrsTransformEnabled() { return mProjectionsEnabled; } | bool ellipsoidalEnabled() const { return mEllipsoidalMode; } | |||
//! sets source spatial reference system (by QGIS CRS) | //! sets source spatial reference system (by QGIS CRS) | |||
void setSourceCrs( long srsid ); | void setSourceCrs( long srsid ); | |||
//! sets source spatial reference system (by EpsgCrsId) | ||||
Q_DECL_DEPRECATED void setSourceEpsgCrsId( long epsgId ); | ||||
//! sets source spatial reference system by authid | //! sets source spatial reference system by authid | |||
void setSourceAuthId( QString authid ); | void setSourceAuthId( QString authid ); | |||
//! returns source spatial reference system | //! returns source spatial reference system | |||
long sourceCrs() { return mSourceRefSys; } | long sourceCrs() { return mSourceRefSys; } | |||
//! What sort of coordinate system is being used? | //! What sort of coordinate system is being used? | |||
bool geographic() { return mCoordTransform->sourceCrs().geographicFlag( ); } | bool geographic() { return mCoordTransform->sourceCrs().geographicFlag( ); } | |||
//! sets ellipsoid by its acronym | //! sets ellipsoid by its acronym | |||
bool setEllipsoid( const QString& ellipsoid ); | bool setEllipsoid( const QString& ellipsoid ); | |||
//! Sets ellipsoid by supplied radii | ||||
// Inverse flattening is calculated with invf = a/(a-b) | ||||
bool setEllipsoid( double semiMajor, double semiMinor ); | ||||
//! returns ellipsoid's acronym | //! returns ellipsoid's acronym | |||
const QString& ellipsoid() { return mEllipsoid; } | const QString& ellipsoid() { return mEllipsoid; } | |||
//! returns ellipsoid's semi major axis | //! returns ellipsoid's semi major axis | |||
double ellipsoidSemiMajor() { return mSemiMajor; } | double ellipsoidSemiMajor() { return mSemiMajor; } | |||
//! returns ellipsoid's semi minor axis | //! returns ellipsoid's semi minor axis | |||
double ellipsoidSemiMinor() { return mSemiMinor; } | double ellipsoidSemiMinor() { return mSemiMinor; } | |||
//! returns ellipsoid's inverse flattening | //! returns ellipsoid's inverse flattening | |||
double ellipsoidInverseFlattening() { return mInvFlattening; } | double ellipsoidInverseFlattening() { return mInvFlattening; } | |||
skipping to change at line 96 | skipping to change at line 103 | |||
double measureLine( const QgsPoint& p1, const QgsPoint& p2 ); | double measureLine( const QgsPoint& p1, const QgsPoint& p2 ); | |||
//! measures polygon area | //! measures polygon area | |||
double measurePolygon( const QList<QgsPoint>& points ); | double measurePolygon( const QList<QgsPoint>& points ); | |||
//! compute bearing - in radians | //! compute bearing - in radians | |||
double bearing( const QgsPoint& p1, const QgsPoint& p2 ); | double bearing( const QgsPoint& p1, const QgsPoint& p2 ); | |||
static QString textUnit( double value, int decimals, QGis::UnitType u, bool isArea, bool keepBaseUnit = false ); | static QString textUnit( double value, int decimals, QGis::UnitType u, bool isArea, bool keepBaseUnit = false ); | |||
//! Helper for conversion between physical units | ||||
void convertMeasurement( double &measure, QGis::UnitType &measureUnits, | ||||
QGis::UnitType displayUnits, bool isArea ); | ||||
protected: | protected: | |||
//! measures line distance, line points are extracted from WKB | //! measures line distance, line points are extracted from WKB | |||
unsigned char* measureLine( unsigned char* feature, double* area, bool hasZptr = false ); | const unsigned char* measureLine( const unsigned char* feature, double* area, bool hasZptr = false ); | |||
//! measures polygon area and perimeter, vertices are extracted from WK B | //! measures polygon area and perimeter, vertices are extracted from WK B | |||
unsigned char* measurePolygon( unsigned char* feature, double* area, do uble* perimeter, bool hasZptr = false ); | const unsigned char* measurePolygon( const unsigned char* feature, doub le* area, double* perimeter, bool hasZptr = false ); | |||
/** | /** | |||
calculates distance from two points on ellipsoid | calculates distance from two points on ellipsoid | |||
based on inverse Vincenty's formulae | based on inverse Vincenty's formulae | |||
Points p1 and p2 are expected to be in degrees and in currently used ellipsoid | Points p1 and p2 are expected to be in degrees and in currently used ellipsoid | |||
@note if course1 is not NULL, bearing (in radians) from first point i s calculated | @note if course1 is not NULL, bearing (in radians) from first point i s calculated | |||
(the same for course2) | (the same for course2) | |||
@return distance in meters | @return distance in meters | |||
skipping to change at line 131 | skipping to change at line 141 | |||
double computePolygonFlatArea( const QList<QgsPoint>& points ); | double computePolygonFlatArea( const QList<QgsPoint>& points ); | |||
/** | /** | |||
precalculates some values | precalculates some values | |||
(must be called always when changing ellipsoid) | (must be called always when changing ellipsoid) | |||
*/ | */ | |||
void computeAreaInit(); | void computeAreaInit(); | |||
private: | private: | |||
//! Copy helper | ||||
void _copy( const QgsDistanceArea & origDA ); | ||||
//! used for transforming coordinates from source CRS to ellipsoid's co ordinates | //! used for transforming coordinates from source CRS to ellipsoid's co ordinates | |||
QgsCoordinateTransform* mCoordTransform; | QgsCoordinateTransform* mCoordTransform; | |||
//! indicates whether we will transform coordinates | //! indicates whether we will transform coordinates | |||
bool mProjectionsEnabled; | bool mEllipsoidalMode; | |||
//! id of the source spatial reference system | //! id of the source spatial reference system | |||
long mSourceRefSys; | long mSourceRefSys; | |||
//! ellipsoid acronym (from table tbl_ellipsoids) | //! ellipsoid acronym (from table tbl_ellipsoids) | |||
QString mEllipsoid; | QString mEllipsoid; | |||
//! ellipsoid parameters | //! ellipsoid parameters | |||
double mSemiMajor, mSemiMinor, mInvFlattening; | double mSemiMajor, mSemiMinor, mInvFlattening; | |||
End of changes. 10 change blocks. | ||||
8 lines changed or deleted | 21 lines changed or added | |||
qgsellipsesymbollayerv2widget.h | qgsellipsesymbollayerv2widget.h | |||
---|---|---|---|---|
skipping to change at line 41 | skipping to change at line 41 | |||
// from base class | // from base class | |||
virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |||
virtual QgsSymbolLayerV2* symbolLayer(); | virtual QgsSymbolLayerV2* symbolLayer(); | |||
protected: | protected: | |||
QgsEllipseSymbolLayerV2* mLayer; | QgsEllipseSymbolLayerV2* mLayer; | |||
private: | private: | |||
void blockComboSignals( bool block ); | void blockComboSignals( bool block ); | |||
//insert available attributes for data defined symbolisation | ||||
void fillDataDefinedComboBoxes(); | ||||
private slots: | private slots: | |||
void on_mShapeListWidget_itemSelectionChanged(); | void on_mShapeListWidget_itemSelectionChanged(); | |||
void on_mWidthSpinBox_valueChanged( double d ); | void on_mWidthSpinBox_valueChanged( double d ); | |||
void on_mHeightSpinBox_valueChanged( double d ); | void on_mHeightSpinBox_valueChanged( double d ); | |||
void on_mRotationSpinBox_valueChanged( double d ); | void on_mRotationSpinBox_valueChanged( double d ); | |||
void on_mOutlineWidthSpinBox_valueChanged( double d ); | void on_mOutlineWidthSpinBox_valueChanged( double d ); | |||
void on_btnChangeColorBorder_clicked(); | void on_btnChangeColorBorder_colorChanged( const QColor& newColor ); | |||
void on_btnChangeColorFill_clicked(); | void on_btnChangeColorFill_colorChanged( const QColor& newColor ); | |||
void on_mDDSymbolWidthComboBox_currentIndexChanged( int idx ); | void on_mSymbolWidthUnitComboBox_currentIndexChanged( int index ); | |||
void on_mDDSymbolHeightComboBox_currentIndexChanged( int idx ); | void on_mOutlineWidthUnitComboBox_currentIndexChanged( int index ); | |||
void on_mDDRotationComboBox_currentIndexChanged( int idx ); | void on_mSymbolHeightUnitComboBox_currentIndexChanged( int index ); | |||
void on_mDDOutlineWidthComboBox_currentIndexChanged( int idx ); | void on_mOffsetUnitComboBox_currentIndexChanged( int index ); | |||
void on_mDDFillColorComboBox_currentIndexChanged( int idx ); | ||||
void on_mDDOutlineColorComboBox_currentIndexChanged( int idx ); | void on_mDataDefinedPropertiesButton_clicked(); | |||
void on_mDDShapeComboBox_currentIndexChanged( int idx ); | void setOffset(); | |||
}; | }; | |||
#endif // QGSELLIPSESYMBOLLAYERV2WIDGET_H | #endif // QGSELLIPSESYMBOLLAYERV2WIDGET_H | |||
End of changes. 3 change blocks. | ||||
11 lines changed or deleted | 9 lines changed or added | |||
qgsexpression.h | qgsexpression.h | |||
---|---|---|---|---|
skipping to change at line 19 | skipping to change at line 19 | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSEXPRESSION_H | #ifndef QGSEXPRESSION_H | |||
#define QGSEXPRESSION_H | #define QGSEXPRESSION_H | |||
#include <QMetaType> | ||||
#include <QStringList> | #include <QStringList> | |||
#include <QVariant> | #include <QVariant> | |||
#include <QList> | #include <QList> | |||
#include <QDomDocument> | #include <QDomDocument> | |||
#include "qgsfield.h" | #include "qgsfield.h" | |||
#include "qgsdistancearea.h" | ||||
class QgsDistanceArea; | ||||
class QgsFeature; | class QgsFeature; | |||
class QgsGeometry; | ||||
class QgsOgcUtils; | ||||
class QgsVectorLayer; | ||||
class QDomElement; | class QDomElement; | |||
/** | /** | |||
Class for parsing and evaluation of expressions (formerly called "search st rings"). | Class for parsing and evaluation of expressions (formerly called "search st rings"). | |||
The expressions try to follow both syntax and semantics of SQL expressions. | The expressions try to follow both syntax and semantics of SQL expressions. | |||
Usage: | Usage: | |||
QgsExpression exp("gid*2 > 10 and type not in ('D','F')); | QgsExpression exp("gid*2 > 10 and type not in ('D','F')); | |||
if (exp.hasParserError()) | if (exp.hasParserError()) | |||
skipping to change at line 56 | skipping to change at line 61 | |||
else | else | |||
{ | { | |||
// examine the result | // examine the result | |||
} | } | |||
Possible QVariant value types: | Possible QVariant value types: | |||
- invalid (null) | - invalid (null) | |||
- int | - int | |||
- double | - double | |||
- string | - string | |||
- geometry | ||||
Similarly to SQL, this class supports three-value logic: true/false/unknown . | Similarly to SQL, this class supports three-value logic: true/false/unknown . | |||
Unknown value may be a result of operations with missing data (NULL). Pleas e note | Unknown value may be a result of operations with missing data (NULL). Pleas e note | |||
that NULL is different value than zero or an empty string. For example | that NULL is different value than zero or an empty string. For example | |||
3 > NULL returns unknown. | 3 > NULL returns unknown. | |||
There is no special (three-value) 'boolean' type: true/false is represented as | There is no special (three-value) 'boolean' type: true/false is represented as | |||
1/0 integer, unknown value is represented the same way as NULL values: inva lid QVariant. | 1/0 integer, unknown value is represented the same way as NULL values: inva lid QVariant. | |||
For better performance with many evaluations you may first call prepare(fie lds) function | For better performance with many evaluations you may first call prepare(fie lds) function | |||
skipping to change at line 93 | skipping to change at line 99 | |||
{ | { | |||
public: | public: | |||
QgsExpression( const QString& expr ); | QgsExpression( const QString& expr ); | |||
~QgsExpression(); | ~QgsExpression(); | |||
//! Returns true if an error occurred when parsing the input expression | //! Returns true if an error occurred when parsing the input expression | |||
bool hasParserError() const { return !mParserErrorString.isNull(); } | bool hasParserError() const { return !mParserErrorString.isNull(); } | |||
//! Returns parser error | //! Returns parser error | |||
QString parserErrorString() const { return mParserErrorString; } | QString parserErrorString() const { return mParserErrorString; } | |||
class Node; | ||||
//! Returns root node of the expression. Root node is null is parsing h | ||||
as failed | ||||
const Node* rootNode() const { return mRootNode; } | ||||
//! Get the expression ready for evaluation - find out column indexes. | //! Get the expression ready for evaluation - find out column indexes. | |||
bool prepare( const QgsFieldMap& fields ); | bool prepare( const QgsFields& fields ); | |||
//! Get list of columns referenced by the expression | //! Get list of columns referenced by the expression | |||
QStringList referencedColumns(); | QStringList referencedColumns(); | |||
//! Returns true if the expression uses feature geometry for some compu tation | //! Returns true if the expression uses feature geometry for some compu tation | |||
bool needsGeometry(); | bool needsGeometry(); | |||
// evaluation | // evaluation | |||
//! Evaluate the feature and return the result | //! Evaluate the feature and return the result | |||
//! @note prepare() should be called before calling this method | //! @note prepare() should be called before calling this method | |||
QVariant evaluate( QgsFeature* f = NULL ); | QVariant evaluate( const QgsFeature* f = NULL ); | |||
//! Evaluate the feature and return the result | ||||
//! @note prepare() should be called before calling this method | ||||
inline QVariant evaluate( const QgsFeature& f ) { return evaluate( &f ) | ||||
; } | ||||
//! Evaluate the feature and return the result | ||||
//! @note this method does not expect that prepare() has been called on | ||||
this instance | ||||
QVariant evaluate( const QgsFeature* f, const QgsFields& fields ); | ||||
//! Evaluate the feature and return the result | //! Evaluate the feature and return the result | |||
//! @note this method does not expect that prepare() has been called on this instance | //! @note this method does not expect that prepare() has been called on this instance | |||
QVariant evaluate( QgsFeature* f, const QgsFieldMap& fields ); | inline QVariant evaluate( const QgsFeature& f, const QgsFields& fields ) { return evaluate( &f, fields ); } | |||
//! Returns true if an error occurred when evaluating last input | //! Returns true if an error occurred when evaluating last input | |||
bool hasEvalError() const { return !mEvalErrorString.isNull(); } | bool hasEvalError() const { return !mEvalErrorString.isNull(); } | |||
//! Returns evaluation error | //! Returns evaluation error | |||
QString evalErrorString() const { return mEvalErrorString; } | QString evalErrorString() const { return mEvalErrorString; } | |||
//! Set evaluation error (used internally by evaluation functions) | //! Set evaluation error (used internally by evaluation functions) | |||
void setEvalErrorString( QString str ) { mEvalErrorString = str; } | void setEvalErrorString( QString str ) { mEvalErrorString = str; } | |||
//! Set the number for $rownum special column | //! Set the number for $rownum special column | |||
void setCurrentRowNumber( int rowNumber ) { mRowNumber = rowNumber; } | void setCurrentRowNumber( int rowNumber ) { mRowNumber = rowNumber; } | |||
//! Return the number used for $rownum special column | //! Return the number used for $rownum special column | |||
int currentRowNumber() { return mRowNumber; } | int currentRowNumber() { return mRowNumber; } | |||
//! Assign a special column | ||||
static void setSpecialColumn( const QString& name, QVariant value ); | ||||
//! Unset a special column | ||||
static void unsetSpecialColumn( const QString& name ); | ||||
//! Return the value of the given special column or a null QVariant if | ||||
undefined | ||||
static QVariant specialColumn( const QString& name ); | ||||
void setScale( double scale ) { mScale = scale; } | ||||
int scale() {return mScale; } | ||||
const QString& expression() const { return mExpression; } | ||||
//! Return the parsed expression as a string - useful for debugging | //! Return the parsed expression as a string - useful for debugging | |||
QString dump() const; | QString dump() const; | |||
//! Return calculator used for distance and area calculations | //! Return calculator used for distance and area calculations | |||
//! (used by internal functions) | //! (used by internal functions) | |||
QgsDistanceArea* geomCalculator() { if ( !mCalc ) initGeomCalculator(); | QgsDistanceArea *geomCalculator() { initGeomCalculator(); return mCalc; | |||
return mCalc; } | } | |||
// | ||||
//! Sets the geometry calculator used in evaluation of expressions, | ||||
// instead of the default. | ||||
void setGeomCalculator( QgsDistanceArea &calc ); | ||||
/** This function currently replaces each expression between [% and %] | ||||
in the string with the result of its evaluation on the feature | ||||
passed as argument. | ||||
Additional substitutions can be passed through the substitutionMap | ||||
parameter | ||||
*/ | ||||
static QString replaceExpressionText( QString action, QgsFeature* feat, | ||||
QgsVectorLayer* layer, | ||||
const QMap<QString, QVariant> *su | ||||
bstitutionMap = 0 ); | ||||
static QString replaceExpressionText( QString action, QgsFeature& feat, | ||||
QgsVectorLayer* layer, | ||||
const QMap<QString, QVariant> *su | ||||
bstitutionMap = 0 ); | ||||
enum UnaryOperator | enum UnaryOperator | |||
{ | { | |||
uoNot, | uoNot, | |||
uoMinus, | uoMinus, | |||
}; | }; | |||
enum BinaryOperator | enum BinaryOperator | |||
{ | { | |||
// logical | // logical | |||
boOr, | boOr, | |||
boAnd, | boAnd, | |||
skipping to change at line 169 | skipping to change at line 217 | |||
boPlus, | boPlus, | |||
boMinus, | boMinus, | |||
boMul, | boMul, | |||
boDiv, | boDiv, | |||
boMod, | boMod, | |||
boPow, | boPow, | |||
// strings | // strings | |||
boConcat, | boConcat, | |||
}; | }; | |||
enum SpatialOperator | ||||
{ | ||||
soBbox, | ||||
soIntersects, | ||||
soContains, | ||||
soCrosses, | ||||
soEquals, | ||||
soDisjoint, | ||||
soOverlaps, | ||||
soTouches, | ||||
soWithin, | ||||
}; | ||||
static const char* BinaryOperatorText[]; | static const char* BinaryOperatorText[]; | |||
static const char* UnaryOperatorText[]; | static const char* UnaryOperatorText[]; | |||
static const char* BinaryOgcOperatorText[]; | typedef QVariant( *FcnEval )( const QVariantList& values, const QgsFeat | |||
static const char* UnaryOgcOperatorText[]; | ure* f, QgsExpression* parent ); | |||
/** | ||||
* A abstract base class for defining QgsExpression functions. | ||||
*/ | ||||
class CORE_EXPORT Function | ||||
{ | ||||
public: | ||||
Function( QString fnname, int params, QString group, QString helpTe | ||||
xt = QString(), bool usesGeometry = false ) | ||||
: mName( fnname ), mParams( params ), mUsesGeometry( usesGeomet | ||||
ry ), mGroup( group ), mHelpText( helpText ) {} | ||||
/** The name of the function. */ | ||||
QString name() { return mName; } | ||||
/** The number of parameters this function takes. */ | ||||
int params() { return mParams; } | ||||
/** Does this function use a geometry object. */ | ||||
bool usesgeometry() { return mUsesGeometry; } | ||||
/** The group the function belongs to. */ | ||||
QString group() { return mGroup; } | ||||
/** The help text for the function. */ | ||||
QString helptext() { return mHelpText.isEmpty() ? QgsExpression::he | ||||
lptext( mName ) : mHelpText; } | ||||
virtual QVariant func( const QVariantList& values, const QgsFeature | ||||
* f, QgsExpression* parent ) = 0; | ||||
bool operator==( const Function& other ) const | ||||
{ | ||||
if ( QString::compare( mName, other.mName, Qt::CaseInsensitive ) | ||||
== 0 ) | ||||
return true; | ||||
typedef QVariant( *FcnEval )( const QVariantList& values, QgsFeature* f | return false; | |||
, QgsExpression* parent ); | } | |||
struct FunctionDef | private: | |||
QString mName; | ||||
int mParams; | ||||
bool mUsesGeometry; | ||||
QString mGroup; | ||||
QString mHelpText; | ||||
}; | ||||
class StaticFunction : public Function | ||||
{ | { | |||
FunctionDef( QString fnname, int params, FcnEval fcn, QString group, | public: | |||
QString helpText = QString(), bool usesGeometry = false ) | StaticFunction( QString fnname, int params, FcnEval fcn, QString gr | |||
: mName( fnname ), mParams( params ), mFcn( fcn ), mUsesGeometry( | oup, QString helpText = QString(), bool usesGeometry = false ) | |||
usesGeometry ), mGroup( group ), mHelpText( helpText ) {} | : Function( fnname, params, group, helpText, usesGeometry ), mF | |||
/** The name of the function. */ | nc( fcn ) {} | |||
QString mName; | ||||
/** The number of parameters this function takes. */ | virtual QVariant func( const QVariantList& values, const QgsFeature | |||
int mParams; | * f, QgsExpression* parent ) | |||
/** Pointer to fucntion. */ | { | |||
FcnEval mFcn; | return mFnc( values, f, parent ); | |||
/** Does this function use a geometry object. */ | } | |||
bool mUsesGeometry; | ||||
/** The group the function belongs to. */ | private: | |||
QString mGroup; | FcnEval mFnc; | |||
/** The help text for the function. */ | ||||
QString mHelpText; | ||||
}; | }; | |||
static const QList<FunctionDef> &BuiltinFunctions(); | const static QList<Function*> &Functions(); | |||
static QList<FunctionDef> gmBuiltinFunctions; | static QList<Function*> gmFunctions; | |||
static QStringList gmBuiltinFunctions; | ||||
const static QStringList &BuiltinFunctions(); | ||||
static bool registerFunction( Function* function ); | ||||
static bool unregisterFunction( QString name ); | ||||
// tells whether the identifier is a name of existing function | // tells whether the identifier is a name of existing function | |||
static bool isFunctionName( QString name ); | static bool isFunctionName( QString name ); | |||
// return index of the function in BuiltinFunctions array | // return index of the function in Functions array | |||
static int functionIndex( QString name ); | static int functionIndex( QString name ); | |||
/** Returns the number of functions defined in the parser | /** Returns the number of functions defined in the parser | |||
* @return The number of function defined in the parser. | * @return The number of function defined in the parser. | |||
*/ | */ | |||
static int functionCount(); | static int functionCount(); | |||
/** | ||||
* Returns a list of special Column definitions | ||||
*/ | ||||
static QList<Function*> specialColumns(); | ||||
//! return quoted column reference (in double quotes) | //! return quoted column reference (in double quotes) | |||
static QString quotedColumnRef( QString name ) { return QString( "\"%1\ "" ).arg( name.replace( "\"", "\"\"" ) ); } | static QString quotedColumnRef( QString name ) { return QString( "\"%1\ "" ).arg( name.replace( "\"", "\"\"" ) ); } | |||
//! return quoted string (in single quotes) | //! return quoted string (in single quotes) | |||
static QString quotedString( QString text ) { return QString( "'%1'" ). arg( text.replace( "'", "''" ) ); } | static QString quotedString( QString text ) { return QString( "'%1'" ). arg( text.replace( "'", "''" ) ); } | |||
////// | ////// | |||
class Visitor; // visitor interface is defined below | class Visitor; // visitor interface is defined below | |||
enum NodeType | ||||
{ | ||||
ntUnaryOperator, | ||||
ntBinaryOperator, | ||||
ntInOperator, | ||||
ntFunction, | ||||
ntLiteral, | ||||
ntColumnRef, | ||||
ntCondition | ||||
}; | ||||
class CORE_EXPORT Node | class CORE_EXPORT Node | |||
{ | { | |||
public: | public: | |||
virtual ~Node() {} | virtual ~Node() {} | |||
virtual NodeType nodeType() const = 0; | ||||
// abstract virtual eval function | // abstract virtual eval function | |||
// errors are reported to the parent | // errors are reported to the parent | |||
virtual QVariant eval( QgsExpression* parent, QgsFeature* f ) = 0; | virtual QVariant eval( QgsExpression* parent, const QgsFeature* f ) = 0; | |||
// abstract virtual preparation function | // abstract virtual preparation function | |||
// errors are reported to the parent | // errors are reported to the parent | |||
virtual bool prepare( QgsExpression* parent, const QgsFieldMap& fie lds ) = 0; | virtual bool prepare( QgsExpression* parent, const QgsFields& field s ) = 0; | |||
virtual QString dump() const = 0; | virtual QString dump() const = 0; | |||
virtual void toOgcFilter( QDomDocument &doc, QDomElement &element ) | ||||
const { Q_UNUSED( doc ); Q_UNUSED( element ); } | ||||
static QgsExpression::Node* createFromOgcFilter( QDomElement &eleme | ||||
nt, QString &errorMessage ); | ||||
virtual QStringList referencedColumns() const = 0; | virtual QStringList referencedColumns() const = 0; | |||
virtual bool needsGeometry() const = 0; | virtual bool needsGeometry() const = 0; | |||
// support for visitor pattern | // support for visitor pattern | |||
virtual void accept( Visitor& v ) = 0; | virtual void accept( Visitor& v ) const = 0; | |||
}; | }; | |||
class CORE_EXPORT NodeList | class CORE_EXPORT NodeList | |||
{ | { | |||
public: | public: | |||
NodeList() {} | NodeList() {} | |||
virtual ~NodeList() { foreach( Node* n, mList ) delete n; } | virtual ~NodeList() { foreach ( Node* n, mList ) delete n; } | |||
void append( Node* node ) { mList.append( node ); } | void append( Node* node ) { mList.append( node ); } | |||
int count() { return mList.count(); } | int count() { return mList.count(); } | |||
QList<Node*> list() { return mList; } | QList<Node*> list() { return mList; } | |||
virtual QString dump() const; | virtual QString dump() const; | |||
virtual void toOgcFilter( QDomDocument &doc, QDomElement &element ) const; | ||||
protected: | protected: | |||
QList<Node*> mList; | QList<Node*> mList; | |||
}; | }; | |||
class CORE_EXPORT Interval | ||||
{ | ||||
// YEAR const value taken from postgres query | ||||
// SELECT EXTRACT(EPOCH FROM interval '1 year') | ||||
static const int YEARS = 31557600; | ||||
static const int MONTHS = 60 * 60 * 24 * 30; | ||||
static const int WEEKS = 60 * 60 * 24 * 7; | ||||
static const int DAY = 60 * 60 * 24; | ||||
static const int HOUR = 60 * 60; | ||||
static const int MINUTE = 60; | ||||
public: | ||||
Interval( double seconds = 0 ): mSeconds( seconds ), mValid( true ) | ||||
{ } | ||||
~Interval(); | ||||
double years() { return mSeconds / YEARS;} | ||||
double months() { return mSeconds / MONTHS; } | ||||
double weeks() { return mSeconds / WEEKS;} | ||||
double days() { return mSeconds / DAY;} | ||||
double hours() { return mSeconds / HOUR;} | ||||
double minutes() { return mSeconds / MINUTE;} | ||||
bool isValid() { return mValid; } | ||||
void setValid( bool valid ) { mValid = valid; } | ||||
double seconds() { return mSeconds; } | ||||
bool operator==( const QgsExpression::Interval& other ) const; | ||||
static QgsExpression::Interval invalidInterVal(); | ||||
static QgsExpression::Interval fromString( QString string ); | ||||
private: | ||||
double mSeconds; | ||||
bool mValid; | ||||
}; | ||||
class CORE_EXPORT NodeUnaryOperator : public Node | class CORE_EXPORT NodeUnaryOperator : public Node | |||
{ | { | |||
public: | public: | |||
NodeUnaryOperator( UnaryOperator op, Node* operand ) : mOp( op ), m Operand( operand ) {} | NodeUnaryOperator( UnaryOperator op, Node* operand ) : mOp( op ), m Operand( operand ) {} | |||
~NodeUnaryOperator() { delete mOperand; } | ~NodeUnaryOperator() { delete mOperand; } | |||
UnaryOperator op() { return mOp; } | UnaryOperator op() const { return mOp; } | |||
Node* operand() { return mOperand; } | Node* operand() const { return mOperand; } | |||
virtual bool prepare( QgsExpression* parent, const QgsFieldMap& fie | virtual NodeType nodeType() const { return ntUnaryOperator; } | |||
lds ); | virtual bool prepare( QgsExpression* parent, const QgsFields& field | |||
virtual QVariant eval( QgsExpression* parent, QgsFeature* f ); | s ); | |||
virtual QVariant eval( QgsExpression* parent, const QgsFeature* f ) | ||||
; | ||||
virtual QString dump() const; | virtual QString dump() const; | |||
virtual void toOgcFilter( QDomDocument &doc, QDomElement &element ) | ||||
const; | ||||
static QgsExpression::Node* createFromOgcFilter( QDomElement &eleme | ||||
nt, QString &errorMessage ); | ||||
virtual QStringList referencedColumns() const { return mOperand->re ferencedColumns(); } | virtual QStringList referencedColumns() const { return mOperand->re ferencedColumns(); } | |||
virtual bool needsGeometry() const { return mOperand->needsGeometry (); } | virtual bool needsGeometry() const { return mOperand->needsGeometry (); } | |||
virtual void accept( Visitor& v ) { v.visit( this ); } | virtual void accept( Visitor& v ) const { v.visit( *this ); } | |||
protected: | protected: | |||
UnaryOperator mOp; | UnaryOperator mOp; | |||
Node* mOperand; | Node* mOperand; | |||
}; | }; | |||
class CORE_EXPORT NodeBinaryOperator : public Node | class CORE_EXPORT NodeBinaryOperator : public Node | |||
{ | { | |||
public: | public: | |||
NodeBinaryOperator( BinaryOperator op, Node* opLeft, Node* opRight ) : mOp( op ), mOpLeft( opLeft ), mOpRight( opRight ) {} | NodeBinaryOperator( BinaryOperator op, Node* opLeft, Node* opRight ) : mOp( op ), mOpLeft( opLeft ), mOpRight( opRight ) {} | |||
~NodeBinaryOperator() { delete mOpLeft; delete mOpRight; } | ~NodeBinaryOperator() { delete mOpLeft; delete mOpRight; } | |||
BinaryOperator op() { return mOp; } | BinaryOperator op() const { return mOp; } | |||
Node* opLeft() { return mOpLeft; } | Node* opLeft() const { return mOpLeft; } | |||
Node* opRight() { return mOpRight; } | Node* opRight() const { return mOpRight; } | |||
virtual bool prepare( QgsExpression* parent, const QgsFieldMap& fie | virtual NodeType nodeType() const { return ntBinaryOperator; } | |||
lds ); | virtual bool prepare( QgsExpression* parent, const QgsFields& field | |||
virtual QVariant eval( QgsExpression* parent, QgsFeature* f ); | s ); | |||
virtual QVariant eval( QgsExpression* parent, const QgsFeature* f ) | ||||
; | ||||
virtual QString dump() const; | virtual QString dump() const; | |||
virtual void toOgcFilter( QDomDocument &doc, QDomElement &element ) | ||||
const; | ||||
static QgsExpression::Node* createFromOgcFilter( QDomElement &eleme | ||||
nt, QString &errorMessage ); | ||||
virtual QStringList referencedColumns() const { return mOpLeft->ref erencedColumns() + mOpRight->referencedColumns(); } | virtual QStringList referencedColumns() const { return mOpLeft->ref erencedColumns() + mOpRight->referencedColumns(); } | |||
virtual bool needsGeometry() const { return mOpLeft->needsGeometry( ) || mOpRight->needsGeometry(); } | virtual bool needsGeometry() const { return mOpLeft->needsGeometry( ) || mOpRight->needsGeometry(); } | |||
virtual void accept( Visitor& v ) { v.visit( this ); } | virtual void accept( Visitor& v ) const { v.visit( *this ); } | |||
protected: | protected: | |||
bool compare( double diff ); | bool compare( double diff ); | |||
int computeInt( int x, int y ); | int computeInt( int x, int y ); | |||
double computeDouble( double x, double y ); | double computeDouble( double x, double y ); | |||
QDateTime computeDateTimeFromInterval( QDateTime d, QgsExpression:: Interval *i ); | ||||
BinaryOperator mOp; | BinaryOperator mOp; | |||
Node* mOpLeft; | Node* mOpLeft; | |||
Node* mOpRight; | Node* mOpRight; | |||
}; | }; | |||
class CORE_EXPORT NodeInOperator : public Node | class CORE_EXPORT NodeInOperator : public Node | |||
{ | { | |||
public: | public: | |||
NodeInOperator( Node* node, NodeList* list, bool notin = false ) : mNode( node ), mList( list ), mNotIn( notin ) {} | NodeInOperator( Node* node, NodeList* list, bool notin = false ) : mNode( node ), mList( list ), mNotIn( notin ) {} | |||
virtual ~NodeInOperator() { delete mNode; delete mList; } | virtual ~NodeInOperator() { delete mNode; delete mList; } | |||
Node* node() { return mNode; } | Node* node() const { return mNode; } | |||
bool isNotIn() { return mNotIn; } | bool isNotIn() const { return mNotIn; } | |||
NodeList* list() { return mList; } | NodeList* list() const { return mList; } | |||
virtual bool prepare( QgsExpression* parent, const QgsFieldMap& fie | virtual NodeType nodeType() const { return ntInOperator; } | |||
lds ); | virtual bool prepare( QgsExpression* parent, const QgsFields& field | |||
virtual QVariant eval( QgsExpression* parent, QgsFeature* f ); | s ); | |||
virtual QVariant eval( QgsExpression* parent, const QgsFeature* f ) | ||||
; | ||||
virtual QString dump() const; | virtual QString dump() const; | |||
virtual void toOgcFilter( QDomDocument &doc, QDomElement &element ) | virtual QStringList referencedColumns() const { QStringList lst( mN | |||
const; | ode->referencedColumns() ); foreach ( Node* n, mList->list() ) lst.append( | |||
n->referencedColumns() ); return lst; } | ||||
virtual QStringList referencedColumns() const { QStringList lst( mN | virtual bool needsGeometry() const { bool needs = false; foreach ( | |||
ode->referencedColumns() ); foreach( Node* n, mList->list() ) lst.append( n | Node* n, mList->list() ) needs |= n->needsGeometry(); return needs; } | |||
->referencedColumns() ); return lst; } | virtual void accept( Visitor& v ) const { v.visit( *this ); } | |||
virtual bool needsGeometry() const { bool needs = false; foreach( N | ||||
ode* n, mList->list() ) needs |= n->needsGeometry(); return needs; } | ||||
virtual void accept( Visitor& v ) { v.visit( this ); } | ||||
protected: | protected: | |||
Node* mNode; | Node* mNode; | |||
NodeList* mList; | NodeList* mList; | |||
bool mNotIn; | bool mNotIn; | |||
}; | }; | |||
class CORE_EXPORT NodeFunction : public Node | class CORE_EXPORT NodeFunction : public Node | |||
{ | { | |||
public: | public: | |||
NodeFunction( int fnIndex, NodeList* args ): mFnIndex( fnIndex ), m Args( args ) {} | NodeFunction( int fnIndex, NodeList* args ): mFnIndex( fnIndex ), m Args( args ) {} | |||
//NodeFunction( QString name, NodeList* args ) : mName(name), mArgs (args) {} | //NodeFunction( QString name, NodeList* args ) : mName(name), mArgs (args) {} | |||
virtual ~NodeFunction() { delete mArgs; } | virtual ~NodeFunction() { delete mArgs; } | |||
int fnIndex() { return mFnIndex; } | int fnIndex() const { return mFnIndex; } | |||
NodeList* args() { return mArgs; } | NodeList* args() const { return mArgs; } | |||
virtual bool prepare( QgsExpression* parent, const QgsFieldMap& fie | virtual NodeType nodeType() const { return ntFunction; } | |||
lds ); | virtual bool prepare( QgsExpression* parent, const QgsFields& field | |||
virtual QVariant eval( QgsExpression* parent, QgsFeature* f ); | s ); | |||
virtual QVariant eval( QgsExpression* parent, const QgsFeature* f ) | ||||
; | ||||
virtual QString dump() const; | virtual QString dump() const; | |||
virtual void toOgcFilter( QDomDocument &doc, QDomElement &element ) | virtual QStringList referencedColumns() const { QStringList lst; if | |||
const; | ( !mArgs ) return lst; foreach ( Node* n, mArgs->list() ) lst.append( n->r | |||
static QgsExpression::Node* createFromOgcFilter( QDomElement &eleme | eferencedColumns() ); return lst; } | |||
nt, QString &errorMessage ); | virtual bool needsGeometry() const { bool needs = Functions()[mFnIn | |||
dex]->usesgeometry(); if ( mArgs ) { foreach ( Node* n, mArgs->list() ) nee | ||||
virtual QStringList referencedColumns() const { QStringList lst; if | ds |= n->needsGeometry(); } return needs; } | |||
( !mArgs ) return lst; foreach( Node* n, mArgs->list() ) lst.append( n->re | virtual void accept( Visitor& v ) const { v.visit( *this ); } | |||
ferencedColumns() ); return lst; } | ||||
virtual bool needsGeometry() const { bool needs = BuiltinFunctions( | ||||
)[mFnIndex].mUsesGeometry; if ( mArgs ) { foreach( Node* n, mArgs->list() ) | ||||
needs |= n->needsGeometry(); } return needs; } | ||||
virtual void accept( Visitor& v ) { v.visit( this ); } | ||||
protected: | protected: | |||
//QString mName; | //QString mName; | |||
int mFnIndex; | int mFnIndex; | |||
NodeList* mArgs; | NodeList* mArgs; | |||
}; | }; | |||
class CORE_EXPORT NodeLiteral : public Node | class CORE_EXPORT NodeLiteral : public Node | |||
{ | { | |||
public: | public: | |||
NodeLiteral( QVariant value ) : mValue( value ) {} | NodeLiteral( QVariant value ) : mValue( value ) {} | |||
QVariant value() { return mValue; } | QVariant value() const { return mValue; } | |||
virtual bool prepare( QgsExpression* parent, const QgsFieldMap& fie | virtual NodeType nodeType() const { return ntLiteral; } | |||
lds ); | virtual bool prepare( QgsExpression* parent, const QgsFields& field | |||
virtual QVariant eval( QgsExpression* parent, QgsFeature* f ); | s ); | |||
virtual QVariant eval( QgsExpression* parent, const QgsFeature* f ) | ||||
; | ||||
virtual QString dump() const; | virtual QString dump() const; | |||
virtual void toOgcFilter( QDomDocument &doc, QDomElement &element ) | ||||
const; | ||||
static QgsExpression::Node* createFromOgcFilter( QDomElement &eleme | ||||
nt, QString &errorMessage ); | ||||
virtual QStringList referencedColumns() const { return QStringList( ); } | virtual QStringList referencedColumns() const { return QStringList( ); } | |||
virtual bool needsGeometry() const { return false; } | virtual bool needsGeometry() const { return false; } | |||
virtual void accept( Visitor& v ) { v.visit( this ); } | virtual void accept( Visitor& v ) const { v.visit( *this ); } | |||
protected: | protected: | |||
QVariant mValue; | QVariant mValue; | |||
}; | }; | |||
class CORE_EXPORT NodeColumnRef : public Node | class CORE_EXPORT NodeColumnRef : public Node | |||
{ | { | |||
public: | public: | |||
NodeColumnRef( QString name ) : mName( name ), mIndex( -1 ) {} | NodeColumnRef( QString name ) : mName( name ), mIndex( -1 ) {} | |||
QString name() { return mName; } | QString name() const { return mName; } | |||
virtual bool prepare( QgsExpression* parent, const QgsFieldMap& fie | virtual NodeType nodeType() const { return ntColumnRef; } | |||
lds ); | virtual bool prepare( QgsExpression* parent, const QgsFields& field | |||
virtual QVariant eval( QgsExpression* parent, QgsFeature* f ); | s ); | |||
virtual QVariant eval( QgsExpression* parent, const QgsFeature* f ) | ||||
; | ||||
virtual QString dump() const; | virtual QString dump() const; | |||
virtual void toOgcFilter( QDomDocument &doc, QDomElement &element ) | ||||
const; | ||||
static QgsExpression::Node* createFromOgcFilter( QDomElement &eleme | ||||
nt, QString &errorMessage ); | ||||
virtual QStringList referencedColumns() const { return QStringList( mName ); } | virtual QStringList referencedColumns() const { return QStringList( mName ); } | |||
virtual bool needsGeometry() const { return false; } | virtual bool needsGeometry() const { return false; } | |||
virtual void accept( Visitor& v ) { v.visit( this ); } | virtual void accept( Visitor& v ) const { v.visit( *this ); } | |||
protected: | protected: | |||
QString mName; | QString mName; | |||
int mIndex; | int mIndex; | |||
}; | }; | |||
class CORE_EXPORT WhenThen | class CORE_EXPORT WhenThen | |||
{ | { | |||
public: | public: | |||
WhenThen( Node* whenExp, Node* thenExp ) : mWhenExp( whenExp ), mTh enExp( thenExp ) {} | WhenThen( Node* whenExp, Node* thenExp ) : mWhenExp( whenExp ), mTh enExp( thenExp ) {} | |||
skipping to change at line 429 | skipping to change at line 559 | |||
//protected: | //protected: | |||
Node* mWhenExp; | Node* mWhenExp; | |||
Node* mThenExp; | Node* mThenExp; | |||
}; | }; | |||
typedef QList<WhenThen*> WhenThenList; | typedef QList<WhenThen*> WhenThenList; | |||
class CORE_EXPORT NodeCondition : public Node | class CORE_EXPORT NodeCondition : public Node | |||
{ | { | |||
public: | public: | |||
NodeCondition( WhenThenList* conditions, Node* elseExp = NULL ) : m Conditions( *conditions ), mElseExp( elseExp ) { delete conditions; } | NodeCondition( WhenThenList* conditions, Node* elseExp = NULL ) : m Conditions( *conditions ), mElseExp( elseExp ) { delete conditions; } | |||
~NodeCondition() { delete mElseExp; foreach( WhenThen* cond, mCondi tions ) delete cond; } | ~NodeCondition() { delete mElseExp; foreach ( WhenThen* cond, mCond itions ) delete cond; } | |||
virtual QVariant eval( QgsExpression* parent, QgsFeature* f ); | virtual NodeType nodeType() const { return ntCondition; } | |||
virtual bool prepare( QgsExpression* parent, const QgsFieldMap& fie | virtual QVariant eval( QgsExpression* parent, const QgsFeature* f ) | |||
lds ); | ; | |||
virtual bool prepare( QgsExpression* parent, const QgsFields& field | ||||
s ); | ||||
virtual QString dump() const; | virtual QString dump() const; | |||
virtual void toOgcFilter( QDomDocument &doc, QDomElement &element ) | ||||
const; | ||||
virtual QStringList referencedColumns() const; | virtual QStringList referencedColumns() const; | |||
virtual bool needsGeometry() const; | virtual bool needsGeometry() const; | |||
virtual void accept( Visitor& v ) { v.visit( this ); } | virtual void accept( Visitor& v ) const { v.visit( *this ); } | |||
protected: | protected: | |||
WhenThenList mConditions; | WhenThenList mConditions; | |||
Node* mElseExp; | Node* mElseExp; | |||
}; | }; | |||
////// | ////// | |||
/** support for visitor pattern - algorithms dealing with the expressio ns | /** support for visitor pattern - algorithms dealing with the expressio ns | |||
may be implemented without modifying the Node classes */ | may be implemented without modifying the Node classes */ | |||
class CORE_EXPORT Visitor | class CORE_EXPORT Visitor | |||
{ | { | |||
public: | public: | |||
virtual ~Visitor() {} | virtual ~Visitor() {} | |||
virtual void visit( NodeUnaryOperator* n ) = 0; | virtual void visit( const NodeUnaryOperator& n ) = 0; | |||
virtual void visit( NodeBinaryOperator* n ) = 0; | virtual void visit( const NodeBinaryOperator& n ) = 0; | |||
virtual void visit( NodeInOperator* n ) = 0; | virtual void visit( const NodeInOperator& n ) = 0; | |||
virtual void visit( NodeFunction* n ) = 0; | virtual void visit( const NodeFunction& n ) = 0; | |||
virtual void visit( NodeLiteral* n ) = 0; | virtual void visit( const NodeLiteral& n ) = 0; | |||
virtual void visit( NodeColumnRef* n ) = 0; | virtual void visit( const NodeColumnRef& n ) = 0; | |||
virtual void visit( NodeCondition* n ) = 0; | virtual void visit( const NodeCondition& n ) = 0; | |||
}; | }; | |||
/** entry function for the visitor pattern */ | /** entry function for the visitor pattern */ | |||
void acceptVisitor( Visitor& v ); | void acceptVisitor( Visitor& v ) const; | |||
// convert from/to OGC Filter | static QString helptext( QString name ); | |||
void toOgcFilter( QDomDocument &doc, QDomElement &element ) const; | static QString group( QString group ); | |||
static QgsExpression* createFromOgcFilter( QDomElement &element ); | ||||
protected: | protected: | |||
// internally used to create an empty expression | // internally used to create an empty expression | |||
QgsExpression() : mRootNode( NULL ), mRowNumber( 0 ), mCalc( NULL ) {} | QgsExpression() : mRootNode( 0 ), mRowNumber( 0 ), mCalc( 0 ) {} | |||
void initGeomCalculator(); | ||||
QString mExpression; | QString mExpression; | |||
Node* mRootNode; | Node* mRootNode; | |||
QString mParserErrorString; | QString mParserErrorString; | |||
QString mEvalErrorString; | QString mEvalErrorString; | |||
int mRowNumber; | int mRowNumber; | |||
double mScale; | ||||
void initGeomCalculator(); | static QMap<QString, QVariant> gmSpecialColumns; | |||
QgsDistanceArea* mCalc; | QgsDistanceArea *mCalc; | |||
friend class QgsOgcUtils; | ||||
static void initFunctionHelp(); | ||||
static QHash<QString, QString> gFunctionHelpTexts; | ||||
static QHash<QString, QString> gGroups; | ||||
}; | }; | |||
Q_DECLARE_METATYPE( QgsExpression::Interval ); | ||||
#endif // QGSEXPRESSION_H | #endif // QGSEXPRESSION_H | |||
End of changes. 61 change blocks. | ||||
141 lines changed or deleted | 286 lines changed or added | |||
qgsexpressionbuilderdialog.h | qgsexpressionbuilderdialog.h | |||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
* it under the terms of the GNU General Public License as published by * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSEXPRESSIONBUILDERDIALOG_H | #ifndef QGSEXPRESSIONBUILDERDIALOG_H | |||
#define QGSEXPRESSIONBUILDERDIALOG_H | #define QGSEXPRESSIONBUILDERDIALOG_H | |||
#include <QDialog> | #include <QDialog> | |||
#include "qgsdistancearea.h" | ||||
#include "ui_qgsexpressionbuilderdialogbase.h" | #include "ui_qgsexpressionbuilderdialogbase.h" | |||
/** A generic dialog for building expression strings | /** A generic dialog for building expression strings | |||
* @remarks This class also shows an example on how to use QgsExpressionBu ilderWidget | * @remarks This class also shows an example on how to use QgsExpressionBu ilderWidget | |||
*/ | */ | |||
class GUI_EXPORT QgsExpressionBuilderDialog : public QDialog, private Ui::Q gsExpressionBuilderDialogBase | class GUI_EXPORT QgsExpressionBuilderDialog : public QDialog, private Ui::Q gsExpressionBuilderDialogBase | |||
{ | { | |||
public: | public: | |||
QgsExpressionBuilderDialog( QgsVectorLayer* layer, QString startText = QString(), QWidget* parent = NULL ); | QgsExpressionBuilderDialog( QgsVectorLayer* layer, QString startText = QString(), QWidget* parent = NULL ); | |||
/** The builder widget that is used by the dialog */ | /** The builder widget that is used by the dialog */ | |||
QgsExpressionBuilderWidget* expressionBuilder(); | QgsExpressionBuilderWidget* expressionBuilder(); | |||
void setExpressionText( const QString& text ); | void setExpressionText( const QString& text ); | |||
QString expressionText(); | QString expressionText(); | |||
/** Sets geometry calculator used in distance/area calculations. | ||||
* @note added in version 2.0 | ||||
*/ | ||||
void setGeomCalculator( const QgsDistanceArea & da ); | ||||
protected: | protected: | |||
/** | /** | |||
* Handle closing of the window | * Is called when the dialog get accepted or rejected | |||
* @param event unused | * Used to save geometry | |||
* | ||||
* @param r result value (unused) | ||||
*/ | */ | |||
void closeEvent( QCloseEvent * event ); | virtual void done( int r ); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 11 lines changed or added | |||
qgsexpressionbuilderwidget.h | qgsexpressionbuilderwidget.h | |||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSEXPRESSIONBUILDER_H | #ifndef QGSEXPRESSIONBUILDER_H | |||
#define QGSEXPRESSIONBUILDER_H | #define QGSEXPRESSIONBUILDER_H | |||
#include <QWidget> | #include <QWidget> | |||
#include "ui_qgsexpressionbuilder.h" | #include "ui_qgsexpressionbuilder.h" | |||
#include "qgsvectorlayer.h" | #include "qgsvectorlayer.h" | |||
#include "qgsexpressionhighlighter.h" | #include "qgsexpressionhighlighter.h" | |||
#include "qgsdistancearea.h" | ||||
#include "QStandardItemModel" | #include "QStandardItemModel" | |||
#include "QStandardItem" | #include "QStandardItem" | |||
#include "QSortFilterProxyModel" | #include "QSortFilterProxyModel" | |||
/** Search proxy used to filter the QgsExpressionBuilderWidget tree. | /** Search proxy used to filter the QgsExpressionBuilderWidget tree. | |||
* The default search for a tree model only searches top level this will h andle one | * The default search for a tree model only searches top level this will h andle one | |||
* level down | * level down | |||
*/ | */ | |||
class QgsExpressionItemSearchProxy : public QSortFilterProxyModel | class QgsExpressionItemSearchProxy : public QSortFilterProxyModel | |||
skipping to change at line 95 | skipping to change at line 96 | |||
/** Set the help text for the current item | /** Set the help text for the current item | |||
* | * | |||
* @note The help text can be set as a html string. | * @note The help text can be set as a html string. | |||
*/ | */ | |||
void setHelpText( QString helpText ) { mHelpText = helpText; } | void setHelpText( QString helpText ) { mHelpText = helpText; } | |||
/** Get the type of expression item eg header, field, ExpressionNode. | /** Get the type of expression item eg header, field, ExpressionNode. | |||
* | * | |||
* @return The QgsExpressionItem::ItemType | * @return The QgsExpressionItem::ItemType | |||
*/ | */ | |||
QgsExpressionItem::ItemType getItemType() { return mType ; } | QgsExpressionItem::ItemType getItemType() { return mType; } | |||
private: | private: | |||
QString mExpressionText; | QString mExpressionText; | |||
QString mHelpText; | QString mHelpText; | |||
QgsExpressionItem::ItemType mType; | QgsExpressionItem::ItemType mType; | |||
}; | }; | |||
/** A reusable widget that can be used to build a expression string. | /** A reusable widget that can be used to build a expression string. | |||
* See QgsExpressionBuilderDialog for exmaple of usage. | * See QgsExpressionBuilderDialog for exmaple of usage. | |||
*/ | */ | |||
skipping to change at line 123 | skipping to change at line 124 | |||
/** Sets layer in order to get the fields and values | /** Sets layer in order to get the fields and values | |||
* @note this needs to be called before calling loadFieldNames(). | * @note this needs to be called before calling loadFieldNames(). | |||
*/ | */ | |||
void setLayer( QgsVectorLayer* layer ); | void setLayer( QgsVectorLayer* layer ); | |||
/** Loads all the field names from the layer. | /** Loads all the field names from the layer. | |||
* @remarks Should this really be public couldn't we just do this for the user? | * @remarks Should this really be public couldn't we just do this for the user? | |||
*/ | */ | |||
void loadFieldNames(); | void loadFieldNames(); | |||
void loadFieldNames( QgsFieldMap fields ); | void loadFieldNames( const QgsFields& fields ); | |||
/** Sets geometry calculator used in distance/area calculations. | ||||
* @note added in version 2.0 | ||||
*/ | ||||
void setGeomCalculator( const QgsDistanceArea & da ); | ||||
/** Gets the expression string that has been set in the expression area . | /** Gets the expression string that has been set in the expression area . | |||
* @returns The expression as a string. */ | * @returns The expression as a string. */ | |||
QString expressionText(); | QString expressionText(); | |||
/** Sets the expression string for the widget */ | /** Sets the expression string for the widget */ | |||
void setExpressionText( const QString& expression ); | void setExpressionText( const QString& expression ); | |||
/** Registers a node item for the expression builder. | /** Registers a node item for the expression builder. | |||
* @param group The group the item will be show in the tree view. If the group doesn't exsit it will be created. | * @param group The group the item will be show in the tree view. If the group doesn't exsit it will be created. | |||
skipping to change at line 161 | skipping to change at line 167 | |||
void on_mValueListWidget_itemDoubleClicked( QListWidgetItem* item ); | void on_mValueListWidget_itemDoubleClicked( QListWidgetItem* item ); | |||
void operatorButtonClicked(); | void operatorButtonClicked(); | |||
void showContextMenu( const QPoint & ); | void showContextMenu( const QPoint & ); | |||
void loadSampleValues(); | void loadSampleValues(); | |||
void loadAllValues(); | void loadAllValues(); | |||
private slots: | private slots: | |||
void setExpressionState( bool state ); | void setExpressionState( bool state ); | |||
signals: | signals: | |||
/** Emited when the user changes the expression in the widget. | /** Emitted when the user changes the expression in the widget. | |||
* Users of this widget should connect to this signal to decide if to let the user | * Users of this widget should connect to this signal to decide if to let the user | |||
* continue. | * continue. | |||
* @param isValid Is true if the expression the user has typed is vali d. | * @param isValid Is true if the expression the user has typed is vali d. | |||
*/ | */ | |||
void expressionParsed( bool isValid ); | void expressionParsed( bool isValid ); | |||
private: | private: | |||
void fillFieldValues( int fieldIndex, int countLimit ); | void fillFieldValues( int fieldIndex, int countLimit ); | |||
QString loadFunctionHelp( QgsExpressionItem* functionName ); | QString loadFunctionHelp( QgsExpressionItem* functionName ); | |||
QgsVectorLayer *mLayer; | QgsVectorLayer *mLayer; | |||
QStandardItemModel *mModel; | QStandardItemModel *mModel; | |||
QgsExpressionItemSearchProxy *mProxyModel; | QgsExpressionItemSearchProxy *mProxyModel; | |||
QMap<QString, QgsExpressionItem*> mExpressionGroups; | QMap<QString, QgsExpressionItem*> mExpressionGroups; | |||
QgsFeature mFeature; | QgsFeature mFeature; | |||
QgsExpressionHighlighter* highlighter; | QgsExpressionHighlighter* highlighter; | |||
bool mExpressionValid; | bool mExpressionValid; | |||
QgsDistanceArea mDa; | ||||
}; | }; | |||
#endif // QGSEXPRESSIONBUILDER_H | #endif // QGSEXPRESSIONBUILDER_H | |||
End of changes. 5 change blocks. | ||||
3 lines changed or deleted | 10 lines changed or added | |||
qgsexpressionhighlighter.h | qgsexpressionhighlighter.h | |||
---|---|---|---|---|
skipping to change at line 28 | skipping to change at line 28 | |||
#include "qgsfield.h" | #include "qgsfield.h" | |||
#include <QSyntaxHighlighter> | #include <QSyntaxHighlighter> | |||
#include <QHash> | #include <QHash> | |||
#include <QTextCharFormat> | #include <QTextCharFormat> | |||
#include <QStringList> | #include <QStringList> | |||
class QTextDocument; | class QTextDocument; | |||
class QgsExpressionHighlighter : QSyntaxHighlighter | class GUI_EXPORT QgsExpressionHighlighter : public QSyntaxHighlighter | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsExpressionHighlighter( QTextDocument *parent = 0 ); | QgsExpressionHighlighter( QTextDocument *parent = 0 ); | |||
void addFields( QStringList fieldList ); | void addFields( QStringList fieldList ); | |||
protected: | protected: | |||
void highlightBlock( const QString &text ); | void highlightBlock( const QString &text ); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgsfeature.h | qgsfeature.h | |||
---|---|---|---|---|
skipping to change at line 24 | skipping to change at line 24 | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSFEATURE_H | #ifndef QGSFEATURE_H | |||
#define QGSFEATURE_H | #define QGSFEATURE_H | |||
#include <QMap> | #include <QMap> | |||
#include <QString> | #include <QString> | |||
#include <QVariant> | #include <QVariant> | |||
#include <QList> | #include <QList> | |||
#include <QHash> | #include <QHash> | |||
#include <QVector> | ||||
#include <QSet> | ||||
class QgsGeometry; | class QgsGeometry; | |||
class QgsRectangle; | class QgsRectangle; | |||
class QgsFeature; | class QgsFeature; | |||
class QgsFields; | ||||
// feature id class (currently 64 bit) | // feature id class (currently 64 bit) | |||
#if 0 | #if 0 | |||
#include <limits> | #include <limits> | |||
class QgsFeatureId | class QgsFeatureId | |||
{ | { | |||
public: | public: | |||
QgsFeatureId( qint64 id = 0 ) : mId( id ) {} | QgsFeatureId( qint64 id = 0 ) : mId( id ) {} | |||
QgsFeatureId( QString str ) : mId( str.toLongLong() ) {} | QgsFeatureId( QString str ) : mId( str.toLongLong() ) {} | |||
skipping to change at line 96 | skipping to change at line 99 | |||
typedef int QgsFeatureId; | typedef int QgsFeatureId; | |||
#define FID_IS_NEW(fid) (fid<0) | #define FID_IS_NEW(fid) (fid<0) | |||
#define FID_TO_NUMBER(fid) static_cast<int>(fid) | #define FID_TO_NUMBER(fid) static_cast<int>(fid) | |||
#define FID_TO_STRING(fid) QString::number( fid ) | #define FID_TO_STRING(fid) QString::number( fid ) | |||
#define STRING_TO_FID(str) (str).toLong() | #define STRING_TO_FID(str) (str).toLong() | |||
#endif | #endif | |||
// key = field index, value = field value | // key = field index, value = field value | |||
typedef QMap<int, QVariant> QgsAttributeMap; | typedef QMap<int, QVariant> QgsAttributeMap; | |||
typedef QVector<QVariant> QgsAttributes; | ||||
class QgsField; | ||||
typedef QMap<int, QgsField> QgsFieldMap; | ||||
/** \ingroup core | /** \ingroup core | |||
* The feature class encapsulates a single feature including its id, | * The feature class encapsulates a single feature including its id, | |||
* geometry and a list of field/values attributes. | * geometry and a list of field/values attributes. | |||
* | * | |||
* @author Gary E.Sherman | * @author Gary E.Sherman | |||
*/ | */ | |||
class CORE_EXPORT QgsFeature | class CORE_EXPORT QgsFeature | |||
{ | { | |||
public: | public: | |||
//! Constructor | //! Constructor | |||
QgsFeature( QgsFeatureId id = QgsFeatureId(), QString typeName = "" ); | QgsFeature( QgsFeatureId id = QgsFeatureId() ); | |||
QgsFeature( const QgsFields& fields, QgsFeatureId id = QgsFeatureId() ) | ||||
; | ||||
/** copy ctor needed due to internal pointer */ | /** copy ctor needed due to internal pointer */ | |||
QgsFeature( QgsFeature const & rhs ); | QgsFeature( const QgsFeature & rhs ); | |||
/** assignment operator needed due to internal pointer */ | /** assignment operator needed due to internal pointer */ | |||
QgsFeature & operator=( QgsFeature const & rhs ); | QgsFeature & operator=( QgsFeature const & rhs ); | |||
//! Destructor | //! Destructor | |||
~QgsFeature(); | ~QgsFeature(); | |||
/** | /** | |||
* Get the feature id for this feature | * Get the feature id for this feature | |||
* @return Feature id | * @return Feature id | |||
*/ | */ | |||
QgsFeatureId id() const; | QgsFeatureId id() const; | |||
/** | /** | |||
* Set the feature id for this feature | * Set the feature id for this feature | |||
* @param id Feature id | * @param id Feature id | |||
*/ | */ | |||
void setFeatureId( QgsFeatureId id ); | void setFeatureId( QgsFeatureId id ); | |||
/** returns the feature's type name | const QgsAttributes& attributes() const { return mAttributes; } | |||
*/ | QgsAttributes& attributes() { return mAttributes; } | |||
QString typeName() const; | void setAttributes( const QgsAttributes& attrs ) { mAttributes = attrs; | |||
} | ||||
/** sets the feature's type name | ||||
*/ | ||||
void setTypeName( QString typeName ); | ||||
/** | /** | |||
* Get the attributes for this feature. | * Set an attribute by id | |||
* @return A std::map containing the field name/value mapping | * | |||
* @param field The index of the field to set | ||||
* @param attr The value of the attribute | ||||
* | ||||
* @return false, if the field id does not exist | ||||
* | ||||
* @note For Python: raises a KeyError exception instead of returning f | ||||
alse | ||||
*/ | */ | |||
const QgsAttributeMap& attributeMap() const; | bool setAttribute( int field, const QVariant& attr ); | |||
/**Sets all the attributes in one go*/ | ||||
void setAttributeMap( const QgsAttributeMap& attributeMap ); | ||||
/** Clear attribute map | /** | |||
* added in 1.5 | * Initialize this feature with the given number of fields. Discard any | |||
previously set attribute data. | ||||
* @param fieldCount Number of fields to initialize | ||||
*/ | */ | |||
void clearAttributeMap(); | void initAttributes( int fieldCount ); | |||
/** | /** | |||
* Add an attribute to the map | * Deletes an attribute and its value | |||
* | ||||
* @param field The index of the field | ||||
* | ||||
* @note For Python: raises a KeyError exception if the field is not fo | ||||
und | ||||
*/ | */ | |||
void addAttribute( int field, QVariant attr ); | ||||
/**Deletes an attribute and its value*/ | ||||
void deleteAttribute( int field ); | void deleteAttribute( int field ); | |||
/**Changes an existing attribute value | ||||
@param field index of the field | ||||
@param attr attribute name and value to be set */ | ||||
void changeAttribute( int field, QVariant attr ); | ||||
/** | /** | |||
* Return the validity of this feature. This is normally set by | * Return the validity of this feature. This is normally set by | |||
* the provider to indicate some problem that makes the feature | * the provider to indicate some problem that makes the feature | |||
* invalid or to indicate a null feature. | * invalid or to indicate a null feature. | |||
*/ | */ | |||
bool isValid() const; | bool isValid() const; | |||
/** | /** | |||
* Set the validity of the feature. | * Set the validity of the feature. | |||
*/ | */ | |||
void setValid( bool validity ); | void setValid( bool validity ); | |||
/** | /** | |||
* Return the dirty state of this feature. | ||||
* Dirty is set if (e.g.) the feature's geometry has been modified in-m | ||||
emory. | ||||
*/ | ||||
bool isDirty() const; | ||||
/** | ||||
* Reset the dirtiness of the feature. (i.e. make clean) | ||||
* You would normally do this after it's saved to permanent storage (e. | ||||
g. disk, an ACID-compliant database) | ||||
*/ | ||||
void clean(); | ||||
/** | ||||
* Get the geometry object associated with this feature | * Get the geometry object associated with this feature | |||
*/ | */ | |||
QgsGeometry *geometry(); | QgsGeometry *geometry() const; | |||
/** | /** | |||
* Get the geometry object associated with this feature | * Get the geometry object associated with this feature | |||
* The caller assumes responsibility for the QgsGeometry*'s destruction . | * The caller assumes responsibility for the QgsGeometry*'s destruction . | |||
*/ | */ | |||
QgsGeometry *geometryAndOwnership(); | QgsGeometry *geometryAndOwnership(); | |||
/** Set this feature's geometry from another QgsGeometry object (deep c opy) | /** Set this feature's geometry from another QgsGeometry object (deep c opy) | |||
*/ | */ | |||
void setGeometry( const QgsGeometry& geom ); | void setGeometry( const QgsGeometry& geom ); | |||
/** Set this feature's geometry (takes geometry ownership) | /** Set this feature's geometry (takes geometry ownership) | |||
* @note not available in python bindings | ||||
*/ | */ | |||
void setGeometry( QgsGeometry* geom ); | void setGeometry( QgsGeometry* geom ); | |||
/** | /** | |||
* Set this feature's geometry from WKB | * Set this feature's geometry from WKB | |||
* | * | |||
* This feature assumes responsibility for destroying geom. | * This feature assumes responsibility for destroying geom. | |||
*/ | */ | |||
void setGeometryAndOwnership( unsigned char * geom, size_t length ); | void setGeometryAndOwnership( unsigned char * geom, size_t length ); | |||
/** Assign a field map with the feature to allow attribute access by at | ||||
tribute name | ||||
* | ||||
* @param fields The attribute fields which this feature holds | ||||
. When used from python, make sure | ||||
* a copy of the fields is held by python, as ow | ||||
nership stays there. | ||||
* I.e. Do not call feature.setFields( myDataPro | ||||
vider.fields() ) but instead call | ||||
* myFields = myDataProvider.fields() | ||||
* feature.setFields( myFields ) | ||||
* @param initAttributes If true, attributes are initialized. Clears a | ||||
ny data previously assigned. | ||||
* C++: Defaults to false | ||||
* Python: Defaults to true | ||||
* @note added in 2.0 | ||||
*/ | ||||
void setFields( const QgsFields* fields, bool initAttributes = false ); | ||||
/** Get associated field map. may be NULL | ||||
* @note added in 2.0 | ||||
*/ | ||||
const QgsFields* fields() const { return mFields; } | ||||
/** Insert a value into attribute. Returns false if attribute name coul | ||||
d not be converted to index. | ||||
* Field map must be associated to make this work. | ||||
* | ||||
* @param name The name of the field to set | ||||
* @param value The value to set | ||||
* | ||||
* @return false if attribute name could not be converted to index (C+ | ||||
+ only) | ||||
* | ||||
* @note For Python: raises a KeyError exception instead of returning | ||||
false | ||||
* @note added in 2.0 | ||||
*/ | ||||
bool setAttribute( const QString& name, QVariant value ); | ||||
/** Remove an attribute value. Returns false if attribute name could no | ||||
t be converted to index. | ||||
* Field map must be associated to make this work. | ||||
* | ||||
* @param name The name of the field to delete | ||||
* | ||||
* @return false if attribute name could not be converted to index (C+ | ||||
+ only) | ||||
* | ||||
* @note For Python: raises a KeyError exception instead of returning | ||||
false | ||||
* @note added in 2.0 | ||||
*/ | ||||
bool deleteAttribute( const QString& name ); | ||||
/** Lookup attribute value from attribute name. | ||||
* Returns invalid variant if attribute name could not be converted to | ||||
index (C++ only) | ||||
* Field map must be associated to make this work. | ||||
* | ||||
* @param name The name of the attribute to get | ||||
* | ||||
* @return The value of the attribute (C++: Invalid variant if no such | ||||
name exists ) | ||||
* | ||||
* @note For Python: raises a KeyError exception if field is not found | ||||
* @note added in 2.0 | ||||
*/ | ||||
QVariant attribute( const QString& name ) const; | ||||
/** Lookup attribute value from its index. Returns invalid variant if t | ||||
he index does not exist. | ||||
* | ||||
* @param fieldIdx The index of the attribute to get | ||||
* | ||||
* @return The value of the attribute (C++: Invalid variant if no such | ||||
index exists ) | ||||
* | ||||
* @note For Python: raises a KeyError exception if field is not found | ||||
* @note added in 2.0 | ||||
*/ | ||||
QVariant attribute( int fieldIdx ) const; | ||||
/** Utility method to get attribute index from name. Returns -1 if fiel | ||||
d does not exist or field map is not associated. | ||||
* Field map must be associated to make this work. | ||||
* | ||||
* @note added in 2.0 | ||||
*/ | ||||
int fieldNameIndex( const QString& fieldName ) const; | ||||
private: | private: | |||
//! feature id | //! feature id | |||
QgsFeatureId mFid; | QgsFeatureId mFid; | |||
/** map of attributes accessed by field index */ | /** attributes accessed by field index */ | |||
QgsAttributeMap mAttributes; | QgsAttributes mAttributes; | |||
/** pointer to geometry in binary WKB format | /** pointer to geometry in binary WKB format | |||
This is usually set by a call to OGRGeometry::exportToWkb() | This is usually set by a call to OGRGeometry::exportToWkb() | |||
*/ | */ | |||
QgsGeometry *mGeometry; | QgsGeometry *mGeometry; | |||
/** Indicator if the mGeometry is owned by this QgsFeature. | /** Indicator if the mGeometry is owned by this QgsFeature. | |||
If so, this QgsFeature takes responsibility for the mGeometry's des truction. | If so, this QgsFeature takes responsibility for the mGeometry's des truction. | |||
*/ | */ | |||
bool mOwnsGeometry; | bool mOwnsGeometry; | |||
//! Flag to indicate if this feature is valid | //! Flag to indicate if this feature is valid | |||
// TODO: still applies? [MD] | ||||
bool mValid; | bool mValid; | |||
//! Flag to indicate if this feature is dirty (e.g. geometry has been m | //! Optional field map for name-based attribute lookups | |||
odified in-memory) | const QgsFields* mFields; | |||
// TODO: still applies? [MD] | ||||
bool mDirty; | ||||
/// feature type name | ||||
QString mTypeName; | ||||
}; // class QgsFeature | }; // class QgsFeature | |||
// key = feature id, value = changed attributes | // key = feature id, value = changed attributes | |||
typedef QMap<QgsFeatureId, QgsAttributeMap> QgsChangedAttributesMap; | typedef QMap<QgsFeatureId, QgsAttributeMap> QgsChangedAttributesMap; | |||
// key = feature id, value = changed geometry | // key = feature id, value = changed geometry | |||
typedef QMap<QgsFeatureId, QgsGeometry> QgsGeometryMap; | typedef QMap<QgsFeatureId, QgsGeometry> QgsGeometryMap; | |||
typedef QSet<QgsFeatureId> QgsFeatureIds; | typedef QSet<QgsFeatureId> QgsFeatureIds; | |||
// key = field index, value = field name | // key = field index, value = field name | |||
typedef QMap<int, QString> QgsFieldNameMap; | typedef QMap<int, QString> QgsFieldNameMap; | |||
typedef QList<QgsFeature> QgsFeatureList; | typedef QList<QgsFeature> QgsFeatureList; | |||
Q_DECLARE_METATYPE( QgsFeatureList ); | ||||
#endif | #endif | |||
End of changes. 21 change blocks. | ||||
52 lines changed or deleted | 137 lines changed or added | |||
qgsfield.h | qgsfield.h | |||
---|---|---|---|---|
skipping to change at line 21 | skipping to change at line 21 | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSFIELD_H | #ifndef QGSFIELD_H | |||
#define QGSFIELD_H | #define QGSFIELD_H | |||
#include <QString> | #include <QString> | |||
#include <QVariant> | #include <QVariant> | |||
#include <QVector> | ||||
/** \ingroup core | /** \ingroup core | |||
* Encapsulate a field in an attribute table or data source. | * Encapsulate a field in an attribute table or data source. | |||
* QgsField stores metadata about an attribute field, including name, type | * QgsField stores metadata about an attribute field, including name, type | |||
* length, and if applicable, precision. | * length, and if applicable, precision. | |||
*/ | */ | |||
class CORE_EXPORT QgsField | class CORE_EXPORT QgsField | |||
{ | { | |||
public: | public: | |||
skipping to change at line 54 | skipping to change at line 55 | |||
QVariant::Type type = QVariant::Invalid, | QVariant::Type type = QVariant::Invalid, | |||
QString typeName = QString(), | QString typeName = QString(), | |||
int len = 0, | int len = 0, | |||
int prec = 0, | int prec = 0, | |||
QString comment = QString() ); | QString comment = QString() ); | |||
//! Destructor | //! Destructor | |||
~QgsField(); | ~QgsField(); | |||
bool operator==( const QgsField& other ) const; | bool operator==( const QgsField& other ) const; | |||
bool operator!=( const QgsField& other ) const; | ||||
//! Gets the name of the field | //! Gets the name of the field | |||
const QString & name() const; | const QString & name() const; | |||
//! Gets variant type of the field as it will be retrieved from data so urce | //! Gets variant type of the field as it will be retrieved from data so urce | |||
QVariant::Type type() const; | QVariant::Type type() const; | |||
/** | /** | |||
Gets the field type. Field types vary depending on the data source. E xamples | Gets the field type. Field types vary depending on the data source. E xamples | |||
are char, int, double, blob, geometry, etc. The type is stored exactl y as | are char, int, double, blob, geometry, etc. The type is stored exactl y as | |||
skipping to change at line 120 | skipping to change at line 122 | |||
Set the field precision. | Set the field precision. | |||
@param prec Precision of the field | @param prec Precision of the field | |||
*/ | */ | |||
void setPrecision( int prec ); | void setPrecision( int prec ); | |||
/** | /** | |||
Set the field comment | Set the field comment | |||
*/ | */ | |||
void setComment( const QString & comment ); | void setComment( const QString & comment ); | |||
/**Formats string for display*/ | ||||
QString displayString( const QVariant& v ) const; | ||||
private: | private: | |||
//! Name | //! Name | |||
QString mName; | QString mName; | |||
//! Variant type | //! Variant type | |||
QVariant::Type mType; | QVariant::Type mType; | |||
//! Type name from provider | //! Type name from provider | |||
QString mTypeName; | QString mTypeName; | |||
skipping to change at line 145 | skipping to change at line 150 | |||
int mPrecision; | int mPrecision; | |||
//! Comment | //! Comment | |||
QString mComment; | QString mComment; | |||
}; // class QgsField | }; // class QgsField | |||
// key = field index, value=field data | // key = field index, value=field data | |||
typedef QMap<int, QgsField> QgsFieldMap; | typedef QMap<int, QgsField> QgsFieldMap; | |||
/** | ||||
\ingroup core | ||||
Container of fields for a vector layer. | ||||
In addition to storing a list of QgsField instances, it also: | ||||
- allows quick lookups of field names to index in the list | ||||
- keeps track of where the field definition comes from (vector data provid | ||||
er, joined layer or newly added from an editing operation) | ||||
*/ | ||||
class CORE_EXPORT QgsFields | ||||
{ | ||||
public: | ||||
enum FieldOrigin | ||||
{ | ||||
OriginUnknown, //!< it has not been specified where the field comes | ||||
from | ||||
OriginProvider, //!< field comes from the underlying data provider o | ||||
f the vector layer (originIndex = index in provider's fields) | ||||
OriginJoin, //!< field comes from a joined layer (originIndex | ||||
/ 1000 = index of the join, originIndex % 1000 = index within the join) | ||||
OriginEdit //!< field has been temporarily added in editing mod | ||||
e (originIndex = index in the list of added attributes) | ||||
}; | ||||
typedef struct Field | ||||
{ | ||||
Field(): origin( OriginUnknown ), originIndex( -1 ) {} | ||||
Field( const QgsField& f, FieldOrigin o, int oi ): field( f ), origin | ||||
( o ), originIndex( oi ) {} | ||||
QgsField field; //!< field | ||||
FieldOrigin origin; //!< origin of the field | ||||
int originIndex; //!< index specific to the origin | ||||
} Field; | ||||
//! Remove all fields | ||||
void clear(); | ||||
//! Append a field. The field must have unique name, otherwise it is re | ||||
jected (returns false) | ||||
bool append( const QgsField& field, FieldOrigin origin = OriginProvider | ||||
, int originIndex = -1 ); | ||||
//! Remove a field with the given index | ||||
void remove( int fieldIdx ); | ||||
//! Extend with fields from an other QgsFields container | ||||
void extend( const QgsFields& other ); | ||||
//! Check whether the container is empty | ||||
inline bool isEmpty() const { return mFields.isEmpty(); } | ||||
//! Return number of items | ||||
inline int count() const { return mFields.count(); } | ||||
//! Return number of items | ||||
inline int size() const { return mFields.count(); } | ||||
//! Get field at particular index (must be in range 0..N-1) | ||||
inline const QgsField& operator[]( int i ) const { return mFields[i].fi | ||||
eld; } | ||||
//! Get field at particular index (must be in range 0..N-1) | ||||
inline QgsField& operator[]( int i ) { return mFields[i].field; } | ||||
//! Get field at particular index (must be in range 0..N-1) | ||||
const QgsField& at( int i ) const { return mFields[i].field; } | ||||
//! Get field at particular index (must be in range 0..N-1) | ||||
const QgsField& field( int fieldIdx ) const { return mFields[fieldIdx]. | ||||
field; } | ||||
//! Get field at particular index (must be in range 0..N-1) | ||||
const QgsField& field( const QString& name ) const { return mFields[ in | ||||
dexFromName( name )].field; } | ||||
//! Get field's origin (value from an enumeration) | ||||
FieldOrigin fieldOrigin( int fieldIdx ) const { return mFields[fieldIdx | ||||
].origin; } | ||||
//! Get field's origin index (its meaning is specific to each type of o | ||||
rigin) | ||||
int fieldOriginIndex( int fieldIdx ) const { return mFields[fieldIdx].o | ||||
riginIndex; } | ||||
//! Look up field's index from name. Returns -1 on error | ||||
int indexFromName( const QString& name ) const { return mNameToIndex.va | ||||
lue( name, -1 ); } | ||||
//! Utility function to return a list of QgsField instances | ||||
QList<QgsField> toList() const; | ||||
protected: | ||||
//! internal storage of the container | ||||
QVector<Field> mFields; | ||||
//! map for quick resolution of name to index | ||||
QHash<QString, int> mNameToIndex; | ||||
}; | ||||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
0 lines changed or deleted | 96 lines changed or added | |||
qgsfieldvalidator.h | qgsfieldvalidator.h | |||
---|---|---|---|---|
skipping to change at line 33 | skipping to change at line 33 | |||
#include <QValidator> | #include <QValidator> | |||
#include <QVariant> | #include <QVariant> | |||
#include <QSettings> | #include <QSettings> | |||
#include "qgsfield.h" | #include "qgsfield.h" | |||
class GUI_EXPORT QgsFieldValidator : public QValidator | class GUI_EXPORT QgsFieldValidator : public QValidator | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsFieldValidator( QObject *parent, const QgsField &field ); | QgsFieldValidator( QObject *parent, const QgsField &field, QString date Format ); | |||
~QgsFieldValidator(); | ~QgsFieldValidator(); | |||
virtual State validate( QString &, int & ) const; | virtual State validate( QString &, int & ) const; | |||
virtual void fixup( QString & ) const; | virtual void fixup( QString & ) const; | |||
QString dateFormat() const { return mDateFormat; } | ||||
private: | private: | |||
// Disables copy constructing | // Disables copy constructing | |||
Q_DISABLE_COPY( QgsFieldValidator ) | Q_DISABLE_COPY( QgsFieldValidator ) | |||
QValidator *mValidator; | QValidator *mValidator; | |||
QgsField mField; | QgsField mField; | |||
QString mNullValue; | QString mNullValue; | |||
QString mDateFormat; | ||||
}; | }; | |||
#endif // QGSFIELDVALIDATOR_H | #endif // QGSFIELDVALIDATOR_H | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 4 lines changed or added | |||
qgsfillsymbollayerv2.h | qgsfillsymbollayerv2.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsfillsymbollayerv2.h | qgsfillsymbollayerv2.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSFILLSYMBOLLAYERV2_H | #ifndef QGSFILLSYMBOLLAYERV2_H | |||
skipping to change at line 60 | skipping to change at line 60 | |||
void stopRender( QgsSymbolV2RenderContext& context ); | void stopRender( QgsSymbolV2RenderContext& context ); | |||
void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, Q gsSymbolV2RenderContext& context ); | void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, Q gsSymbolV2RenderContext& context ); | |||
QgsStringMap properties() const; | QgsStringMap properties() const; | |||
QgsSymbolLayerV2* clone() const; | QgsSymbolLayerV2* clone() const; | |||
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const; | void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const; | |||
QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFacto | ||||
r ) const; | ||||
Qt::BrushStyle brushStyle() const { return mBrushStyle; } | Qt::BrushStyle brushStyle() const { return mBrushStyle; } | |||
void setBrushStyle( Qt::BrushStyle style ) { mBrushStyle = style; } | void setBrushStyle( Qt::BrushStyle style ) { mBrushStyle = style; } | |||
QColor borderColor() const { return mBorderColor; } | QColor borderColor() const { return mBorderColor; } | |||
void setBorderColor( QColor borderColor ) { mBorderColor = borderColor; } | void setBorderColor( QColor borderColor ) { mBorderColor = borderColor; } | |||
Qt::PenStyle borderStyle() const { return mBorderStyle; } | Qt::PenStyle borderStyle() const { return mBorderStyle; } | |||
void setBorderStyle( Qt::PenStyle borderStyle ) { mBorderStyle = border Style; } | void setBorderStyle( Qt::PenStyle borderStyle ) { mBorderStyle = border Style; } | |||
double borderWidth() const { return mBorderWidth; } | double borderWidth() const { return mBorderWidth; } | |||
void setBorderWidth( double borderWidth ) { mBorderWidth = borderWidth; } | void setBorderWidth( double borderWidth ) { mBorderWidth = borderWidth; } | |||
void setOffset( QPointF offset ) { mOffset = offset; } | void setOffset( QPointF offset ) { mOffset = offset; } | |||
QPointF offset() { return mOffset; } | QPointF offset() { return mOffset; } | |||
void setBorderWidthUnit( QgsSymbolV2::OutputUnit unit ) { mBorderWidthU | ||||
nit = unit; } | ||||
QgsSymbolV2::OutputUnit borderWidthUnit() const { return mBorderWidthUn | ||||
it; } | ||||
void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit | ||||
; } | ||||
QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | ||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | ||||
QgsSymbolV2::OutputUnit outputUnit() const; | ||||
protected: | protected: | |||
QBrush mBrush; | QBrush mBrush; | |||
QBrush mSelBrush; | QBrush mSelBrush; | |||
Qt::BrushStyle mBrushStyle; | Qt::BrushStyle mBrushStyle; | |||
QColor mBorderColor; | QColor mBorderColor; | |||
Qt::PenStyle mBorderStyle; | Qt::PenStyle mBorderStyle; | |||
double mBorderWidth; | double mBorderWidth; | |||
QgsSymbolV2::OutputUnit mBorderWidthUnit; | ||||
QPen mPen; | QPen mPen; | |||
QPen mSelPen; | ||||
QPointF mOffset; | QPointF mOffset; | |||
QgsSymbolV2::OutputUnit mOffsetUnit; | ||||
private: | ||||
//helper functions for data defined symbology | ||||
void applyDataDefinedSymbology( QgsSymbolV2RenderContext& context, QBru | ||||
sh& brush, QPen& pen, QPen& selPen ); | ||||
}; | }; | |||
/**Base class for polygon renderers generating texture images*/ | /**Base class for polygon renderers generating texture images*/ | |||
class CORE_EXPORT QgsImageFillSymbolLayer: public QgsFillSymbolLayerV2 | class CORE_EXPORT QgsImageFillSymbolLayer: public QgsFillSymbolLayerV2 | |||
{ | { | |||
public: | public: | |||
QgsImageFillSymbolLayer(); | QgsImageFillSymbolLayer(); | |||
virtual ~QgsImageFillSymbolLayer(); | virtual ~QgsImageFillSymbolLayer(); | |||
void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, Q gsSymbolV2RenderContext& context ); | void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, Q gsSymbolV2RenderContext& context ); | |||
virtual QgsSymbolV2* subSymbol() { return mOutline; } | virtual QgsSymbolV2* subSymbol() { return mOutline; } | |||
virtual bool setSubSymbol( QgsSymbolV2* symbol ); | virtual bool setSubSymbol( QgsSymbolV2* symbol ); | |||
void setOutlineWidthUnit( QgsSymbolV2::OutputUnit unit ) { mOutlineWidt | ||||
hUnit = unit; } | ||||
QgsSymbolV2::OutputUnit outlineWidthUnit() const { return mOutlineWidth | ||||
Unit; } | ||||
protected: | protected: | |||
QBrush mBrush; | QBrush mBrush; | |||
double mNextAngle; // mAngle / data defined angle | ||||
/**Outline width*/ | /**Outline width*/ | |||
double mOutlineWidth; | double mOutlineWidth; | |||
QgsSymbolV2::OutputUnit mOutlineWidthUnit; | ||||
/**Custom outline*/ | /**Custom outline*/ | |||
QgsLineSymbolV2* mOutline; | QgsLineSymbolV2* mOutline; | |||
virtual void applyDataDefinedSettings( const QgsSymbolV2RenderContext& | ||||
context ) { Q_UNUSED( context ); } | ||||
}; | }; | |||
/**A class for svg fill patterns. The class automatically scales the patter n to | /**A class for svg fill patterns. The class automatically scales the patter n to | |||
the appropriate pixel dimensions of the output device*/ | the appropriate pixel dimensions of the output device*/ | |||
class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsImageFillSymbolLayer | class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsImageFillSymbolLayer | |||
{ | { | |||
public: | public: | |||
QgsSVGFillSymbolLayer( const QString& svgFilePath = "", double width = 20, double rotation = 0.0 ); | QgsSVGFillSymbolLayer( const QString& svgFilePath = "", double width = 20, double rotation = 0.0 ); | |||
QgsSVGFillSymbolLayer( const QByteArray& svgData, double width = 20, do uble rotation = 0.0 ); | QgsSVGFillSymbolLayer( const QByteArray& svgData, double width = 20, do uble rotation = 0.0 ); | |||
~QgsSVGFillSymbolLayer(); | ~QgsSVGFillSymbolLayer(); | |||
skipping to change at line 145 | skipping to change at line 171 | |||
void setPatternWidth( double width ) { mPatternWidth = width;} | void setPatternWidth( double width ) { mPatternWidth = width;} | |||
double patternWidth() const { return mPatternWidth; } | double patternWidth() const { return mPatternWidth; } | |||
void setSvgFillColor( const QColor& c ) { mSvgFillColor = c; } | void setSvgFillColor( const QColor& c ) { mSvgFillColor = c; } | |||
QColor svgFillColor() const { return mSvgFillColor; } | QColor svgFillColor() const { return mSvgFillColor; } | |||
void setSvgOutlineColor( const QColor& c ) { mSvgOutlineColor = c; } | void setSvgOutlineColor( const QColor& c ) { mSvgOutlineColor = c; } | |||
QColor svgOutlineColor() const { return mSvgOutlineColor; } | QColor svgOutlineColor() const { return mSvgOutlineColor; } | |||
void setSvgOutlineWidth( double w ) { mSvgOutlineWidth = w; } | void setSvgOutlineWidth( double w ) { mSvgOutlineWidth = w; } | |||
double svgOutlineWidth() const { return mSvgOutlineWidth; } | double svgOutlineWidth() const { return mSvgOutlineWidth; } | |||
void setPatternWidthUnit( QgsSymbolV2::OutputUnit unit ) { mPatternWidt | ||||
hUnit = unit; } | ||||
QgsSymbolV2::OutputUnit patternWidthUnit() const { return mPatternWidth | ||||
Unit; } | ||||
void setSvgOutlineWidthUnit( QgsSymbolV2::OutputUnit unit ) { mSvgOutli | ||||
neWidthUnit = unit; } | ||||
QgsSymbolV2::OutputUnit svgOutlineWidthUnit() const { return mSvgOutlin | ||||
eWidthUnit; } | ||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | ||||
QgsSymbolV2::OutputUnit outputUnit() const; | ||||
protected: | protected: | |||
/**Width of the pattern (in QgsSymbolV2 output units)*/ | /**Width of the pattern (in output units)*/ | |||
double mPatternWidth; | double mPatternWidth; | |||
QgsSymbolV2::OutputUnit mPatternWidthUnit; | ||||
/**SVG data*/ | /**SVG data*/ | |||
QByteArray mSvgData; | QByteArray mSvgData; | |||
/**Path to the svg file (or empty if constructed directly from data)*/ | /**Path to the svg file (or empty if constructed directly from data)*/ | |||
QString mSvgFilePath; | QString mSvgFilePath; | |||
/**SVG view box (to keep the aspect ratio */ | /**SVG view box (to keep the aspect ratio */ | |||
QRectF mSvgViewBox; | QRectF mSvgViewBox; | |||
/** SVG pattern image | ||||
* @note added in 1.9 */ | ||||
QImage* mSvgPattern; | ||||
//param(fill), param(outline), param(outline-width) are going | //param(fill), param(outline), param(outline-width) are going | |||
//to be replaced in memory | //to be replaced in memory | |||
QColor mSvgFillColor; | QColor mSvgFillColor; | |||
QColor mSvgOutlineColor; | QColor mSvgOutlineColor; | |||
double mSvgOutlineWidth; | double mSvgOutlineWidth; | |||
QgsSymbolV2::OutputUnit mSvgOutlineWidthUnit; | ||||
void applyDataDefinedSettings( const QgsSymbolV2RenderContext& context | ||||
); | ||||
private: | private: | |||
/**Helper function that gets the view box from the byte array*/ | /**Helper function that gets the view box from the byte array*/ | |||
void storeViewBox(); | void storeViewBox(); | |||
void setDefaultSvgParams(); //fills mSvgFillColor, mSvgOutlineColor, mS vgOutlineWidth with default values for mSvgFilePath | void setDefaultSvgParams(); //fills mSvgFillColor, mSvgOutlineColor, mS vgOutlineWidth with default values for mSvgFilePath | |||
/**Applies the svg pattern to the brush*/ | ||||
void applyPattern( QBrush& brush, const QString& svgFilePath, double pa | ||||
tternWidth, QgsSymbolV2::OutputUnit patternWidthUnit, const QColor& svgFill | ||||
Color, const QColor& svgOutlineColor, | ||||
double svgOutlineWidth, QgsSymbolV2::OutputUnit svgO | ||||
utlineWidthUnit, const QgsSymbolV2RenderContext& context ); | ||||
}; | }; | |||
class CORE_EXPORT QgsLinePatternFillSymbolLayer: public QgsImageFillSymbolL ayer | class CORE_EXPORT QgsLinePatternFillSymbolLayer: public QgsImageFillSymbolL ayer | |||
{ | { | |||
public: | public: | |||
QgsLinePatternFillSymbolLayer(); | QgsLinePatternFillSymbolLayer(); | |||
~QgsLinePatternFillSymbolLayer(); | ~QgsLinePatternFillSymbolLayer(); | |||
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsSt ringMap() ); | static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsSt ringMap() ); | |||
static QgsSymbolLayerV2* createFromSld( QDomElement &element ); | static QgsSymbolLayerV2* createFromSld( QDomElement &element ); | |||
skipping to change at line 188 | skipping to change at line 235 | |||
void startRender( QgsSymbolV2RenderContext& context ); | void startRender( QgsSymbolV2RenderContext& context ); | |||
void stopRender( QgsSymbolV2RenderContext& context ); | void stopRender( QgsSymbolV2RenderContext& context ); | |||
QgsStringMap properties() const; | QgsStringMap properties() const; | |||
QgsSymbolLayerV2* clone() const; | QgsSymbolLayerV2* clone() const; | |||
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const; | void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const; | |||
QString ogrFeatureStyleWidth( double widthScaleFactor ) const; | ||||
//getters and setters | //getters and setters | |||
void setLineAngle( double a ) { mLineAngle = a; } | void setLineAngle( double a ) { mLineAngle = a; } | |||
double lineAngle() const { return mLineAngle; } | double lineAngle() const { return mLineAngle; } | |||
void setDistance( double d ) { mDistance = d; } | void setDistance( double d ) { mDistance = d; } | |||
double distance() const { return mDistance; } | double distance() const { return mDistance; } | |||
void setLineWidth( double w ) { mLineWidth = w; } | void setLineWidth( double w ) { mLineWidth = w; } | |||
double lineWidth() const { return mLineWidth; } | double lineWidth() const { return mLineWidth; } | |||
void setColor( const QColor& c ) { mColor = c; } | void setColor( const QColor& c ) { mColor = c; } | |||
QColor color() const { return mColor; } | QColor color() const { return mColor; } | |||
void setOffset( double offset ) { mOffset = offset; } | void setOffset( double offset ) { mOffset = offset; } | |||
double offset() const { return mOffset; } | double offset() const { return mOffset; } | |||
void setDistanceUnit( QgsSymbolV2::OutputUnit unit ) { mDistanceUnit = | ||||
unit; } | ||||
QgsSymbolV2::OutputUnit distanceUnit() const { return mDistanceUnit; } | ||||
void setLineWidthUnit( QgsSymbolV2::OutputUnit unit ) { mLineWidthUnit | ||||
= unit; } | ||||
QgsSymbolV2::OutputUnit lineWidthUnit() const { return mLineWidthUnit; | ||||
} | ||||
void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit | ||||
; } | ||||
QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | ||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | ||||
QgsSymbolV2::OutputUnit outputUnit() const; | ||||
protected: | protected: | |||
/**Distance (in mm or map units) between lines*/ | /**Distance (in mm or map units) between lines*/ | |||
double mDistance; | double mDistance; | |||
QgsSymbolV2::OutputUnit mDistanceUnit; | ||||
/**Line width (in mm or map units)*/ | /**Line width (in mm or map units)*/ | |||
double mLineWidth; | double mLineWidth; | |||
QgsSymbolV2::OutputUnit mLineWidthUnit; | ||||
QColor mColor; | QColor mColor; | |||
/**Vector line angle in degrees (0 = horizontal, counterclockwise)*/ | /**Vector line angle in degrees (0 = horizontal, counterclockwise)*/ | |||
double mLineAngle; | double mLineAngle; | |||
/**Offset perpendicular to line direction*/ | /**Offset perpendicular to line direction*/ | |||
double mOffset; | double mOffset; | |||
QgsSymbolV2::OutputUnit mOffsetUnit; | ||||
void applyDataDefinedSettings( const QgsSymbolV2RenderContext& context | ||||
); | ||||
private: | ||||
/**Applies the svg pattern to the brush*/ | ||||
void applyPattern( const QgsSymbolV2RenderContext& context, QBrush& bru | ||||
sh, double lineAngle, double distance, double lineWidth, const QColor& colo | ||||
r ); | ||||
}; | }; | |||
class CORE_EXPORT QgsPointPatternFillSymbolLayer: public QgsImageFillSymbol Layer | class CORE_EXPORT QgsPointPatternFillSymbolLayer: public QgsImageFillSymbol Layer | |||
{ | { | |||
public: | public: | |||
QgsPointPatternFillSymbolLayer(); | QgsPointPatternFillSymbolLayer(); | |||
~QgsPointPatternFillSymbolLayer(); | ~QgsPointPatternFillSymbolLayer(); | |||
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsSt ringMap() ); | static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsSt ringMap() ); | |||
static QgsSymbolLayerV2* createFromSld( QDomElement &element ); | static QgsSymbolLayerV2* createFromSld( QDomElement &element ); | |||
skipping to change at line 249 | skipping to change at line 319 | |||
double displacementX() const { return mDisplacementX; } | double displacementX() const { return mDisplacementX; } | |||
void setDisplacementX( double d ) { mDisplacementX = d; } | void setDisplacementX( double d ) { mDisplacementX = d; } | |||
double displacementY() const { return mDisplacementY; } | double displacementY() const { return mDisplacementY; } | |||
void setDisplacementY( double d ) { mDisplacementY = d; } | void setDisplacementY( double d ) { mDisplacementY = d; } | |||
bool setSubSymbol( QgsSymbolV2* symbol ); | bool setSubSymbol( QgsSymbolV2* symbol ); | |||
virtual QgsSymbolV2* subSymbol() { return mMarkerSymbol; } | virtual QgsSymbolV2* subSymbol() { return mMarkerSymbol; } | |||
void setDistanceXUnit( QgsSymbolV2::OutputUnit unit ) { mDistanceXUnit | ||||
= unit; } | ||||
QgsSymbolV2::OutputUnit distanceXUnit() const { return mDistanceXUnit; | ||||
} | ||||
void setDistanceYUnit( QgsSymbolV2::OutputUnit unit ) { mDistanceYUnit | ||||
= unit; } | ||||
QgsSymbolV2::OutputUnit distanceYUnit() const { return mDistanceYUnit; | ||||
} | ||||
void setDisplacementXUnit( QgsSymbolV2::OutputUnit unit ) { mDisplaceme | ||||
ntXUnit = unit; } | ||||
QgsSymbolV2::OutputUnit displacementXUnit() const { return mDisplacemen | ||||
tXUnit; } | ||||
void setDisplacementYUnit( QgsSymbolV2::OutputUnit unit ) { mDisplaceme | ||||
ntYUnit = unit; } | ||||
QgsSymbolV2::OutputUnit displacementYUnit() const { return mDisplacemen | ||||
tYUnit; } | ||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | ||||
QgsSymbolV2::OutputUnit outputUnit() const; | ||||
protected: | protected: | |||
QgsMarkerSymbolV2* mMarkerSymbol; | QgsMarkerSymbolV2* mMarkerSymbol; | |||
double mDistanceX; | double mDistanceX; | |||
QgsSymbolV2::OutputUnit mDistanceXUnit; | ||||
double mDistanceY; | double mDistanceY; | |||
QgsSymbolV2::OutputUnit mDistanceYUnit; | ||||
double mDisplacementX; | double mDisplacementX; | |||
QgsSymbolV2::OutputUnit mDisplacementXUnit; | ||||
double mDisplacementY; | double mDisplacementY; | |||
QgsSymbolV2::OutputUnit mDisplacementYUnit; | ||||
void applyDataDefinedSettings( const QgsSymbolV2RenderContext& context | ||||
); | ||||
private: | ||||
void applyPattern( const QgsSymbolV2RenderContext& context, QBrush& bru | ||||
sh, double distanceX, double distanceY, | ||||
double displacementX, double displacementY ); | ||||
}; | }; | |||
class CORE_EXPORT QgsCentroidFillSymbolLayerV2 : public QgsFillSymbolLayerV 2 | class CORE_EXPORT QgsCentroidFillSymbolLayerV2 : public QgsFillSymbolLayerV 2 | |||
{ | { | |||
public: | public: | |||
QgsCentroidFillSymbolLayerV2(); | QgsCentroidFillSymbolLayerV2(); | |||
~QgsCentroidFillSymbolLayerV2(); | ~QgsCentroidFillSymbolLayerV2(); | |||
// static stuff | // static stuff | |||
skipping to change at line 289 | skipping to change at line 384 | |||
QgsSymbolLayerV2* clone() const; | QgsSymbolLayerV2* clone() const; | |||
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const; | void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const; | |||
void setColor( const QColor& color ); | void setColor( const QColor& color ); | |||
QgsSymbolV2* subSymbol(); | QgsSymbolV2* subSymbol(); | |||
bool setSubSymbol( QgsSymbolV2* symbol ); | bool setSubSymbol( QgsSymbolV2* symbol ); | |||
void setOutputUnit( QgsSymbolV2::OutputUnit unit ) { Q_UNUSED( unit ); | ||||
} | ||||
QgsSymbolV2::OutputUnit outputUnit() const; | ||||
virtual QSet<QString> usedAttributes() const; | ||||
protected: | protected: | |||
QgsMarkerSymbolV2* mMarker; | QgsMarkerSymbolV2* mMarker; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 27 change blocks. | ||||
2 lines changed or deleted | 136 lines changed or added | |||
qgsgenericprojectionselector.h | qgsgenericprojectionselector.h | |||
---|---|---|---|---|
skipping to change at line 66 | skipping to change at line 66 | |||
~QgsGenericProjectionSelector(); | ~QgsGenericProjectionSelector(); | |||
public slots: | public slots: | |||
/** If no parameter is passed, the message will be a generic | /** If no parameter is passed, the message will be a generic | |||
* 'define the CRS for this layer'. | * 'define the CRS for this layer'. | |||
*/ | */ | |||
void setMessage( QString theMessage = "" ); | void setMessage( QString theMessage = "" ); | |||
long selectedCrsId(); | long selectedCrsId(); | |||
QString selectedAuthId(); | QString selectedAuthId(); | |||
Q_DECL_DEPRECATED QString selectedProj4String(); | ||||
Q_DECL_DEPRECATED long selectedEpsg(); | ||||
void setSelectedCrsName( QString theName ); | void setSelectedCrsName( QString theName ); | |||
void setSelectedCrsId( long theID ); | void setSelectedCrsId( long theID ); | |||
void setSelectedAuthId( QString authId ); | void setSelectedAuthId( QString authId ); | |||
Q_DECL_DEPRECATED void setSelectedEpsg( long theID ); | ||||
/** | /** | |||
* \brief filters this dialog by the given CRSs | * \brief filters this dialog by the given CRSs | |||
* | * | |||
* Sets this dialog to filter the available projections to those listed | * Sets this dialog to filter the available projections to those listed | |||
* by the given Coordinate Reference Systems. | * by the given Coordinate Reference Systems. | |||
* | * | |||
* \param crsFilter a list of OGC Coordinate Reference Systems to filte r the | * \param crsFilter a list of OGC Coordinate Reference Systems to filte r the | |||
* list of projections by. This is useful in (e.g.) W MS situations | * list of projections by. This is useful in (e.g.) W MS situations | |||
* where you just want to offer what the WMS server ca n support. | * where you just want to offer what the WMS server ca n support. | |||
* | * | |||
* \warning This function's behaviour is undefined if it is called afte r the dialog is shown. | * \warning This function's behaviour is undefined if it is called afte r the dialog is shown. | |||
*/ | */ | |||
void setOgcWmsCrsFilter( QSet<QString> crsFilter ); | void setOgcWmsCrsFilter( QSet<QString> crsFilter ); | |||
}; | }; | |||
#endif // #ifndef QGSLAYERCRSSELECTOR_H | #endif // #ifndef QGSLAYERCRSSELECTOR_H | |||
End of changes. 3 change blocks. | ||||
6 lines changed or deleted | 0 lines changed or added | |||
qgsgeometry.h | qgsgeometry.h | |||
---|---|---|---|---|
skipping to change at line 21 | skipping to change at line 21 | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSGEOMETRY_H | #ifndef QGSGEOMETRY_H | |||
#define QGSGEOMETRY_H | #define QGSGEOMETRY_H | |||
#include <QString> | #include <QString> | |||
#include <QVector> | #include <QVector> | |||
#include <QDomDocument> | ||||
#include "qgis.h" | #include "qgis.h" | |||
#include <geos_c.h> | #include <geos_c.h> | |||
#if defined(GEOS_VERSION_MAJOR) && (GEOS_VERSION_MAJOR<3) | #if defined(GEOS_VERSION_MAJOR) && (GEOS_VERSION_MAJOR<3) | |||
#define GEOSGeometry struct GEOSGeom_t | #define GEOSGeometry struct GEOSGeom_t | |||
#define GEOSCoordSequence struct GEOSCoordSeq_t | #define GEOSCoordSequence struct GEOSCoordSeq_t | |||
#endif | #endif | |||
#include "qgspoint.h" | #include "qgspoint.h" | |||
#include "qgscoordinatetransform.h" | #include "qgscoordinatetransform.h" | |||
#include "qgsfeature.h" | ||||
#include <QSet> | ||||
class QgsVectorLayer; | ||||
/** polyline is represented as a vector of points */ | /** polyline is represented as a vector of points */ | |||
typedef QVector<QgsPoint> QgsPolyline; | typedef QVector<QgsPoint> QgsPolyline; | |||
/** polygon: first item of the list is outer ring, inner rings (if any) sta rt from second item */ | /** polygon: first item of the list is outer ring, inner rings (if any) sta rt from second item */ | |||
typedef QVector<QgsPolyline> QgsPolygon; | typedef QVector<QgsPolyline> QgsPolygon; | |||
/** a collection of QgsPoints that share a common collection of attributes */ | /** a collection of QgsPoints that share a common collection of attributes */ | |||
typedef QVector<QgsPoint> QgsMultiPoint; | typedef QVector<QgsPoint> QgsMultiPoint; | |||
skipping to change at line 73 | skipping to change at line 79 | |||
* @author Brendan Morley | * @author Brendan Morley | |||
*/ | */ | |||
class CORE_EXPORT QgsGeometry | class CORE_EXPORT QgsGeometry | |||
{ | { | |||
public: | public: | |||
//! Constructor | //! Constructor | |||
QgsGeometry(); | QgsGeometry(); | |||
/** copy constructor will prompt a deep copy of the object */ | /** copy constructor will prompt a deep copy of the object */ | |||
QgsGeometry( QgsGeometry const & ); | QgsGeometry( const QgsGeometry & ); | |||
/** assignments will prompt a deep copy of the object */ | /** assignments will prompt a deep copy of the object | |||
@note not available in python bindings | ||||
*/ | ||||
QgsGeometry & operator=( QgsGeometry const & rhs ); | QgsGeometry & operator=( QgsGeometry const & rhs ); | |||
//! Destructor | //! Destructor | |||
~QgsGeometry(); | ~QgsGeometry(); | |||
/** static method that creates geometry from Wkt */ | /** static method that creates geometry from Wkt */ | |||
static QgsGeometry* fromWkt( QString wkt ); | static QgsGeometry* fromWkt( QString wkt ); | |||
/** construct geometry from a point */ | /** construct geometry from a point */ | |||
static QgsGeometry* fromPoint( const QgsPoint& point ); | static QgsGeometry* fromPoint( const QgsPoint& point ); | |||
skipping to change at line 101 | skipping to change at line 109 | |||
static QgsGeometry* fromMultiPolyline( const QgsMultiPolyline& multilin e ); | static QgsGeometry* fromMultiPolyline( const QgsMultiPolyline& multilin e ); | |||
/** construct geometry from a polygon */ | /** construct geometry from a polygon */ | |||
static QgsGeometry* fromPolygon( const QgsPolygon& polygon ); | static QgsGeometry* fromPolygon( const QgsPolygon& polygon ); | |||
/** construct geometry from a multipolygon */ | /** construct geometry from a multipolygon */ | |||
static QgsGeometry* fromMultiPolygon( const QgsMultiPolygon& multipoly ); | static QgsGeometry* fromMultiPolygon( const QgsMultiPolygon& multipoly ); | |||
/** construct geometry from a rectangle */ | /** construct geometry from a rectangle */ | |||
static QgsGeometry* fromRect( const QgsRectangle& rect ); | static QgsGeometry* fromRect( const QgsRectangle& rect ); | |||
/** | /** | |||
Set the geometry, feeding in a geometry in GEOS format. | Set the geometry, feeding in a geometry in GEOS format. | |||
This class will take ownership of the buffer. | This class will take ownership of the buffer. | |||
@note not available in python bindings | ||||
*/ | */ | |||
void fromGeos( GEOSGeometry* geos ); | void fromGeos( GEOSGeometry* geos ); | |||
/** | /** | |||
Set the geometry, feeding in the buffer containing OGC Well-Known Bin ary and the buffer's length. | Set the geometry, feeding in the buffer containing OGC Well-Known Bin ary and the buffer's length. | |||
This class will take ownership of the buffer. | This class will take ownership of the buffer. | |||
*/ | */ | |||
void fromWkb( unsigned char * wkb, size_t length ); | void fromWkb( unsigned char * wkb, size_t length ); | |||
/** | /** | |||
Returns the buffer containing this geometry in WKB format. | Returns the buffer containing this geometry in WKB format. | |||
You may wish to use in conjunction with wkbSize(). | You may wish to use in conjunction with wkbSize(). | |||
*/ | */ | |||
unsigned char * asWkb(); | const unsigned char* asWkb() const; | |||
/** | /** | |||
Returns the size of the WKB in asWkb(). | * Returns the size of the WKB in asWkb(). | |||
*/ | */ | |||
size_t wkbSize(); | size_t wkbSize() const; | |||
/**Returns a geos geomtry. QgsGeometry keeps ownership, don't delete th e returned object! | /**Returns a geos geomtry. QgsGeometry keeps ownership, don't delete th e returned object! | |||
@note this method was added in version 1.1*/ | @note this method was added in version 1.1 | |||
GEOSGeometry* asGeos(); | @note not available in python bindings | |||
*/ | ||||
const GEOSGeometry* asGeos() const; | ||||
/** Returns type of wkb (point / linestring / polygon etc.) */ | /** Returns type of wkb (point / linestring / polygon etc.) */ | |||
QGis::WkbType wkbType(); | QGis::WkbType wkbType() const; | |||
/** Returns type of the vector */ | /** Returns type of the vector */ | |||
QGis::GeometryType type(); | QGis::GeometryType type(); | |||
/** Returns true if wkb of the geometry is of WKBMulti* type */ | /** Returns true if wkb of the geometry is of WKBMulti* type */ | |||
bool isMultipart(); | bool isMultipart(); | |||
/** compare geometries using GEOS | /** compare geometries using GEOS | |||
@note added in 1.5 | @note added in 1.5 | |||
*/ | */ | |||
skipping to change at line 221 | skipping to change at line 232 | |||
bool deleteVertex( int atVertex ); | bool deleteVertex( int atVertex ); | |||
/** | /** | |||
* Returns coordinates of a vertex. | * Returns coordinates of a vertex. | |||
* @param atVertex index of the vertex | * @param atVertex index of the vertex | |||
* @return Coordinates of the vertex or QgsPoint(0,0) on error | * @return Coordinates of the vertex or QgsPoint(0,0) on error | |||
*/ | */ | |||
QgsPoint vertexAt( int atVertex ); | QgsPoint vertexAt( int atVertex ); | |||
/** | /** | |||
Returns the squared cartesian distance between the given point | * Returns the squared cartesian distance between the given point | |||
to the given vertex index (vertex at the given position number, | * to the given vertex index (vertex at the given position number, | |||
ring and item (first number is index 0)) | * ring and item (first number is index 0)) | |||
*/ | */ | |||
double sqrDistToVertexAt( QgsPoint& point, int atVertex ); | double sqrDistToVertexAt( QgsPoint& point, int atVertex ); | |||
/** | /** | |||
* Searches for the the closest vertex in this geometry to the given po int. | * Searches for the closest vertex in this geometry to the given point. | |||
* @param point Specifiest the point for search | * @param point Specifiest the point for search | |||
* @param atVertex Receives index of the closest vertex | * @param atVertex Receives index of the closest vertex | |||
* @return The squared cartesian distance is also returned in sqrDist, negative number on error | * @return The squared cartesian distance is also returned in sqrDist, negative number on error | |||
*/ | */ | |||
double closestVertexWithContext( const QgsPoint& point, int& atVertex ) ; | double closestVertexWithContext( const QgsPoint& point, int& atVertex ) ; | |||
/** | /** | |||
* Searches for the closest segment of geometry to the given point | * Searches for the closest segment of geometry to the given point | |||
* @param point Specifies the point for search | * @param point Specifies the point for search | |||
* @param minDistPoint Receives the nearest point on the segment | * @param minDistPoint Receives the nearest point on the segment | |||
skipping to change at line 257 | skipping to change at line 267 | |||
/**Adds a new ring to this geometry. This makes only sense for polygon and multipolygons. | /**Adds a new ring to this geometry. This makes only sense for polygon and multipolygons. | |||
@return 0 in case of success (ring added), 1 problem with geometry typ e, 2 ring not closed, | @return 0 in case of success (ring added), 1 problem with geometry typ e, 2 ring not closed, | |||
3 ring is not valid geometry, 4 ring not disjoint with existing rings, 5 no polygon found which contained the ring*/ | 3 ring is not valid geometry, 4 ring not disjoint with existing rings, 5 no polygon found which contained the ring*/ | |||
int addRing( const QList<QgsPoint>& ring ); | int addRing( const QList<QgsPoint>& ring ); | |||
/**Adds a new island polygon to a multipolygon feature | /**Adds a new island polygon to a multipolygon feature | |||
@return 0 in case of success, 1 if not a multipolygon, 2 if ring is no t a valid geometry, 3 if new polygon ring | @return 0 in case of success, 1 if not a multipolygon, 2 if ring is no t a valid geometry, 3 if new polygon ring | |||
not disjoint with existing polygons of the feature*/ | not disjoint with existing polygons of the feature*/ | |||
int addPart( const QList<QgsPoint> &points ); | int addPart( const QList<QgsPoint> &points ); | |||
Q_DECL_DEPRECATED int addIsland( const QList<QgsPoint> &points ) { retu rn addPart( points ); } | ||||
/**Translate this geometry by dx, dy | /**Translate this geometry by dx, dy | |||
@return 0 in case of success*/ | @return 0 in case of success*/ | |||
int translate( double dx, double dy ); | int translate( double dx, double dy ); | |||
/**Transform this geometry as described by CoordinateTranasform ct | /**Transform this geometry as described by CoordinateTranasform ct | |||
@return 0 in case of success*/ | @return 0 in case of success*/ | |||
int transform( const QgsCoordinateTransform& ct ); | int transform( const QgsCoordinateTransform& ct ); | |||
/**Splits this geometry according to a given line. Note that the geomet ry is only split once. If there are several intersections | /**Splits this geometry according to a given line. Note that the geomet ry is only split once. If there are several intersections | |||
skipping to change at line 293 | skipping to change at line 302 | |||
/**Changes this geometry such that it does not intersect the other geom etry | /**Changes this geometry such that it does not intersect the other geom etry | |||
@param other geometry that should not be intersect | @param other geometry that should not be intersect | |||
@return 0 in case of success*/ | @return 0 in case of success*/ | |||
int makeDifference( QgsGeometry* other ); | int makeDifference( QgsGeometry* other ); | |||
/**Returns the bounding box of this feature*/ | /**Returns the bounding box of this feature*/ | |||
QgsRectangle boundingBox(); | QgsRectangle boundingBox(); | |||
/** Test for intersection with a rectangle (uses GEOS) */ | /** Test for intersection with a rectangle (uses GEOS) */ | |||
bool intersects( const QgsRectangle& r ); | bool intersects( const QgsRectangle& r ) const; | |||
/** Test for intersection with a geometry (uses GEOS) */ | /** Test for intersection with a geometry (uses GEOS) */ | |||
bool intersects( QgsGeometry* geometry ); | bool intersects( const QgsGeometry* geometry ) const; | |||
/** Test for containment of a point (uses GEOS) */ | /** Test for containment of a point (uses GEOS) */ | |||
bool contains( QgsPoint* p ); | bool contains( const QgsPoint* p ) const; | |||
/** Test for if geometry is contained in an other (uses GEOS) | /** Test for if geometry is contained in an other (uses GEOS) | |||
* @note added in 1.5 */ | * @note added in 1.5 */ | |||
bool contains( QgsGeometry* geometry ); | bool contains( const QgsGeometry* geometry ) const; | |||
/** Test for if geometry is disjoint of an other (uses GEOS) | /** Test for if geometry is disjoint of an other (uses GEOS) | |||
* @note added in 1.5 */ | * @note added in 1.5 */ | |||
bool disjoint( QgsGeometry* geometry ); | bool disjoint( const QgsGeometry* geometry ) const; | |||
/** Test for if geometry equals an other (uses GEOS) | /** Test for if geometry equals an other (uses GEOS) | |||
* @note added in 1.5 */ | * @note added in 1.5 */ | |||
bool equals( QgsGeometry* geometry ); | bool equals( const QgsGeometry* geometry ) const; | |||
/** Test for if geometry touch an other (uses GEOS) | /** Test for if geometry touch an other (uses GEOS) | |||
* @note added in 1.5 */ | * @note added in 1.5 */ | |||
bool touches( QgsGeometry* geometry ); | bool touches( const QgsGeometry* geometry ) const; | |||
/** Test for if geometry overlaps an other (uses GEOS) | /** Test for if geometry overlaps an other (uses GEOS) | |||
* @note added in 1.5 */ | * @note added in 1.5 */ | |||
bool overlaps( QgsGeometry* geometry ); | bool overlaps( const QgsGeometry* geometry ) const; | |||
/** Test for if geometry is within an other (uses GEOS) | /** Test for if geometry is within an other (uses GEOS) | |||
* @note added in 1.5 */ | * @note added in 1.5 */ | |||
bool within( QgsGeometry* geometry ); | bool within( const QgsGeometry* geometry ) const; | |||
/** Test for if geometry crosses an other (uses GEOS) | /** Test for if geometry crosses an other (uses GEOS) | |||
* @note added in 1.5 */ | * @note added in 1.5 */ | |||
bool crosses( QgsGeometry* geometry ); | bool crosses( const QgsGeometry* geometry ) const; | |||
/** Returns a buffer region around this geometry having the given width and with a specified number | /** Returns a buffer region around this geometry having the given width and with a specified number | |||
of segments used to approximate curves */ | of segments used to approximate curves */ | |||
QgsGeometry* buffer( double distance, int segments ); | QgsGeometry* buffer( double distance, int segments ); | |||
/** Returns a simplified version of this geometry using a specified tol erance value */ | /** Returns a simplified version of this geometry using a specified tol erance value */ | |||
QgsGeometry* simplify( double tolerance ); | QgsGeometry* simplify( double tolerance ); | |||
/** Returns the center of mass of a geometry | /** Returns the center of mass of a geometry | |||
* @note for line based geometries, the center point of the line is retu rned, | * @note for line based geometries, the center point of the line is retu rned, | |||
* and for point based geometries, the point itself is returned */ | * and for point based geometries, the point itself is returned */ | |||
QgsGeometry* centroid(); | QgsGeometry* centroid(); | |||
/** Returns the smallest convex polygon that contains all the points in the geometry. */ | /** Returns the smallest convex polygon that contains all the points in the geometry. */ | |||
QgsGeometry* convexHull(); | QgsGeometry* convexHull(); | |||
/* Return interpolated point on line at distance | ||||
* @note added in 1.9 | ||||
*/ | ||||
QgsGeometry* interpolate( double distance ); | ||||
/** Returns a geometry representing the points shared by this geometry and other. */ | /** Returns a geometry representing the points shared by this geometry and other. */ | |||
QgsGeometry* intersection( QgsGeometry* geometry ); | QgsGeometry* intersection( QgsGeometry* geometry ); | |||
/** Returns a geometry representing all the points in this geometry and other (a | /** Returns a geometry representing all the points in this geometry and other (a | |||
* union geometry operation). | * union geometry operation). | |||
* @note this operation is not called union since its a reserved word i n C++.*/ | * @note this operation is not called union since its a reserved word i n C++.*/ | |||
QgsGeometry* combine( QgsGeometry* geometry ); | QgsGeometry* combine( QgsGeometry* geometry ); | |||
/** Returns a geometry representing the points making up this geometry that do not make up other. */ | /** Returns a geometry representing the points making up this geometry that do not make up other. */ | |||
QgsGeometry* difference( QgsGeometry* geometry ); | QgsGeometry* difference( QgsGeometry* geometry ); | |||
/** Returns a Geometry representing the points making up this Geometry that do not make up other. */ | /** Returns a Geometry representing the points making up this Geometry that do not make up other. */ | |||
QgsGeometry* symDifference( QgsGeometry* geometry ); | QgsGeometry* symDifference( QgsGeometry* geometry ); | |||
/** Exports the geometry to mWkt | /** Exports the geometry to mWkt | |||
@return true in case of success and false else | * @return true in case of success and false else | |||
*/ | */ | |||
QString exportToWkt(); | QString exportToWkt() const; | |||
/** Exports the geometry to mGeoJSON | /** Exports the geometry to mGeoJSON | |||
@return true in case of success and false else | * @return true in case of success and false else | |||
* @note added in 1.8 | ||||
* @note python binding added in 1.9 | ||||
*/ | */ | |||
QString exportToGeoJSON(); | QString exportToGeoJSON() const; | |||
/* Accessor functions for getting geometry data */ | /* Accessor functions for getting geometry data */ | |||
/** return contents of the geometry as a point | /** return contents of the geometry as a point | |||
if wkbType is WKBPoint, otherwise returns [0,0] */ | if wkbType is WKBPoint, otherwise returns [0,0] */ | |||
QgsPoint asPoint(); | QgsPoint asPoint() const; | |||
/** return contents of the geometry as a polyline | /** return contents of the geometry as a polyline | |||
if wkbType is WKBLineString, otherwise an empty list */ | if wkbType is WKBLineString, otherwise an empty list */ | |||
QgsPolyline asPolyline(); | QgsPolyline asPolyline() const; | |||
/** return contents of the geometry as a polygon | /** return contents of the geometry as a polygon | |||
if wkbType is WKBPolygon, otherwise an empty list */ | if wkbType is WKBPolygon, otherwise an empty list */ | |||
QgsPolygon asPolygon(); | QgsPolygon asPolygon() const; | |||
/** return contents of the geometry as a multi point | /** return contents of the geometry as a multi point | |||
if wkbType is WKBMultiPoint, otherwise an empty list */ | if wkbType is WKBMultiPoint, otherwise an empty list */ | |||
QgsMultiPoint asMultiPoint(); | QgsMultiPoint asMultiPoint() const; | |||
/** return contents of the geometry as a multi linestring | /** return contents of the geometry as a multi linestring | |||
if wkbType is WKBMultiLineString, otherwise an empty list */ | if wkbType is WKBMultiLineString, otherwise an empty list */ | |||
QgsMultiPolyline asMultiPolyline(); | QgsMultiPolyline asMultiPolyline() const; | |||
/** return contents of the geometry as a multi polygon | /** return contents of the geometry as a multi polygon | |||
if wkbType is WKBMultiPolygon, otherwise an empty list */ | if wkbType is WKBMultiPolygon, otherwise an empty list */ | |||
QgsMultiPolygon asMultiPolygon(); | QgsMultiPolygon asMultiPolygon() const; | |||
/** return contents of the geometry as a list of geometries | /** return contents of the geometry as a list of geometries | |||
@note added in version 1.1 */ | @note added in version 1.1 */ | |||
QList<QgsGeometry*> asGeometryCollection(); | QList<QgsGeometry*> asGeometryCollection() const; | |||
/** delete a ring in polygon or multipolygon. | /** delete a ring in polygon or multipolygon. | |||
Ring 0 is outer ring and can't be deleted. | Ring 0 is outer ring and can't be deleted. | |||
@return true on success | @return true on success | |||
@note added in version 1.2 */ | @note added in version 1.2 */ | |||
bool deleteRing( int ringNum, int partNum = 0 ); | bool deleteRing( int ringNum, int partNum = 0 ); | |||
/** delete part identified by the part number | /** delete part identified by the part number | |||
@return true on success | @return true on success | |||
@note added in version 1.2 */ | @note added in version 1.2 */ | |||
skipping to change at line 419 | skipping to change at line 435 | |||
/**Converts single type geometry into multitype geometry | /**Converts single type geometry into multitype geometry | |||
e.g. a polygon into a multipolygon geometry with one polygon | e.g. a polygon into a multipolygon geometry with one polygon | |||
@return true in case of success and false else*/ | @return true in case of success and false else*/ | |||
bool convertToMultiType(); | bool convertToMultiType(); | |||
/** Modifies geometry to avoid intersections with the layers specified in project properties | /** Modifies geometry to avoid intersections with the layers specified in project properties | |||
* @return 0 in case of success, | * @return 0 in case of success, | |||
* 1 if geometry is not of polygon type, | * 1 if geometry is not of polygon type, | |||
* 2 if avoid intersection would change the geometry type, | * 2 if avoid intersection would change the geometry type, | |||
* 3 other error during intersection removal | * 3 other error during intersection removal | |||
* @param ignoreFeatures possibility to give a list of features where intersections should be ignored (not available in python bindings) | ||||
* @note added in 1.5 | * @note added in 1.5 | |||
*/ | */ | |||
int avoidIntersections(); | int avoidIntersections( QMap<QgsVectorLayer*, QSet<QgsFeatureId> > igno reFeatures = ( QMap<QgsVectorLayer*, QSet<QgsFeatureId> >() ) ); | |||
class Error | class Error | |||
{ | { | |||
QString message; | QString message; | |||
QgsPoint location; | QgsPoint location; | |||
bool hasLocation; | bool hasLocation; | |||
public: | public: | |||
Error() : message( "none" ), hasLocation( false ) {} | Error() : message( "none" ), hasLocation( false ) {} | |||
Error( QString m ) : message( m ), hasLocation( false ) {} | Error( QString m ) : message( m ), hasLocation( false ) {} | |||
Error( QString m, QgsPoint p ) : message( m ), location( p ), hasLo cation( true ) {} | Error( QString m, QgsPoint p ) : message( m ), location( p ), hasLo cation( true ) {} | |||
QString what() { return message; }; | QString what() { return message; }; | |||
QgsPoint where() { return location; } | QgsPoint where() { return location; } | |||
bool hasWhere() { return hasLocation; } | bool hasWhere() { return hasLocation; } | |||
}; | }; | |||
/** Validate geometry and produce a list of geometry errors | /** Validate geometry and produce a list of geometry errors | |||
* @note added in 1.5 | * @note added in 1.5 | |||
* @note python binding added in 1.6 | ||||
**/ | **/ | |||
void validateGeometry( QList<Error> &errors ); | void validateGeometry( QList<Error> &errors ); | |||
private: | private: | |||
// Private variables | // Private variables | |||
// All of these are mutable since there may be on-the-fly | // All of these are mutable since there may be on-the-fly | |||
// conversions between WKB, GEOS and Wkt; | // conversions between WKB, GEOS and Wkt; | |||
// However the intent is the const functions do not | // However the intent is the const functions do not | |||
// semantically change the value that this object represents. | // semantically change the value that this object represents. | |||
/** pointer to geometry in binary WKB format | /** pointer to geometry in binary WKB format | |||
This is the class' native implementation | This is the class' native implementation | |||
*/ | */ | |||
unsigned char * mGeometry; | mutable unsigned char * mGeometry; | |||
/** size of geometry */ | /** size of geometry */ | |||
size_t mGeometrySize; | mutable size_t mGeometrySize; | |||
/** cached GEOS version of this geometry */ | /** cached GEOS version of this geometry */ | |||
GEOSGeometry* mGeos; | mutable GEOSGeometry* mGeos; | |||
/** If the geometry has been set since the last conversion to WKB **/ | /** If the geometry has been set since the last conversion to WKB **/ | |||
bool mDirtyWkb; | mutable bool mDirtyWkb; | |||
/** If the geometry has been set since the last conversion to GEOS **/ | /** If the geometry has been set since the last conversion to GEOS **/ | |||
bool mDirtyGeos; | mutable bool mDirtyGeos; | |||
// Private functions | // Private functions | |||
/** Converts from the WKB geometry to the GEOS geometry. | /** Converts from the WKB geometry to the GEOS geometry. | |||
@return true in case of success and false else | @return true in case of success and false else | |||
*/ | */ | |||
bool exportWkbToGeos(); | bool exportWkbToGeos() const; | |||
/** Converts from the GEOS geometry to the WKB geometry. | /** Converts from the GEOS geometry to the WKB geometry. | |||
@return true in case of success and false else | @return true in case of success and false else | |||
*/ | */ | |||
bool exportGeosToWkb(); | bool exportGeosToWkb() const; | |||
/** Insert a new vertex before the given vertex index (first number is index 0) | /** Insert a new vertex before the given vertex index (first number is index 0) | |||
* in the given GEOS Coordinate Sequence. | * in the given GEOS Coordinate Sequence. | |||
* If the requested vertex number is greater | * If the requested vertex number is greater | |||
* than the last actual vertex, | * than the last actual vertex, | |||
* it is assumed that the vertex is to be appended instead of inserted . | * it is assumed that the vertex is to be appended instead of inserted . | |||
* @param x x coordinate | * @param x x coordinate | |||
* @param y y coordinate | * @param y y coordinate | |||
* @param beforeVertex insert before vertex with this index | * @param beforeVertex insert before vertex with this index | |||
* @param old_sequence The sequence to update (The caller remains th e owner). | * @param old_sequence The sequence to update (The caller remains th e owner). | |||
skipping to change at line 562 | skipping to change at line 580 | |||
/**Tests if geom bounding rect is within -180 <= x <= 180, -90 <= y <= 90. Other methods may use more accurate tolerances if this is true*/ | /**Tests if geom bounding rect is within -180 <= x <= 180, -90 <= y <= 90. Other methods may use more accurate tolerances if this is true*/ | |||
static bool geomInDegrees( const GEOSGeometry* geom ); | static bool geomInDegrees( const GEOSGeometry* geom ); | |||
/**Returns number of single geometry in a geos geometry. Is save for ge os 2 and 3*/ | /**Returns number of single geometry in a geos geometry. Is save for ge os 2 and 3*/ | |||
int numberOfGeometries( GEOSGeometry* g ) const; | int numberOfGeometries( GEOSGeometry* g ) const; | |||
int mergeGeometriesMultiTypeSplit( QVector<GEOSGeometry*>& splitResult ); | int mergeGeometriesMultiTypeSplit( QVector<GEOSGeometry*>& splitResult ); | |||
/** return point from wkb */ | /** return point from wkb */ | |||
QgsPoint asPoint( unsigned char*& ptr, bool hasZValue ); | QgsPoint asPoint( unsigned char*& ptr, bool hasZValue ) const; | |||
/** return polyline from wkb */ | /** return polyline from wkb */ | |||
QgsPolyline asPolyline( unsigned char*& ptr, bool hasZValue ); | QgsPolyline asPolyline( unsigned char*& ptr, bool hasZValue ) const; | |||
/** return polygon from wkb */ | /** return polygon from wkb */ | |||
QgsPolygon asPolygon( unsigned char*& ptr, bool hasZValue ); | QgsPolygon asPolygon( unsigned char*& ptr, bool hasZValue ) const; | |||
static bool geosRelOp( char( *op )( const GEOSGeometry*, const GEOSGeom etry * ), | static bool geosRelOp( char( *op )( const GEOSGeometry*, const GEOSGeom etry * ), | |||
QgsGeometry *a, QgsGeometry *b ); | const QgsGeometry* a, const QgsGeometry* b ); | |||
/**Returns < 0 if point(x/y) is left of the line x1,y1 -> x1,y2*/ | /**Returns < 0 if point(x/y) is left of the line x1,y1 -> x1,y2*/ | |||
double leftOf( double x, double y, double& x1, double& y1, double& x2, double& y2 ); | double leftOf( double x, double y, double& x1, double& y1, double& x2, double& y2 ); | |||
static int refcount; | ||||
}; // class QgsGeometry | }; // class QgsGeometry | |||
Q_DECLARE_METATYPE( QgsGeometry ); | ||||
#endif | #endif | |||
End of changes. 50 change blocks. | ||||
50 lines changed or deleted | 68 lines changed or added | |||
qgsgeometryanalyzer.h | qgsgeometryanalyzer.h | |||
---|---|---|---|---|
skipping to change at line 154 | skipping to change at line 154 | |||
//helper functions for event layer | //helper functions for event layer | |||
void addEventLayerFeature( QgsFeature& feature, QgsGeometry* geom, QgsG eometry* lineGeom, QgsVectorFileWriter* fileWriter, QgsFeatureList& memoryF eatures, int offsetField = -1, double offsetScale = 1.0, | void addEventLayerFeature( QgsFeature& feature, QgsGeometry* geom, QgsG eometry* lineGeom, QgsVectorFileWriter* fileWriter, QgsFeatureList& memoryF eatures, int offsetField = -1, double offsetScale = 1.0, | |||
bool forceSingleType = false ); | bool forceSingleType = false ); | |||
/**Create geometry offset relative to line geometry. | /**Create geometry offset relative to line geometry. | |||
@param geom the geometry to modify | @param geom the geometry to modify | |||
@param lineGeom the line geometry to which the feature is reference d | @param lineGeom the line geometry to which the feature is reference d | |||
@param offset the offset value in layer unit. Negative values mean offset towards left, positive values offset to the right side*/ | @param offset the offset value in layer unit. Negative values mean offset towards left, positive values offset to the right side*/ | |||
void createOffsetGeometry( QgsGeometry* geom, QgsGeometry* lineGeom, do uble offset ); | void createOffsetGeometry( QgsGeometry* geom, QgsGeometry* lineGeom, do uble offset ); | |||
QgsPoint createPointOffset( double x, double y, double dist, QgsGeometr y* lineGeom ) const; | QgsPoint createPointOffset( double x, double y, double dist, QgsGeometr y* lineGeom ) const; | |||
unsigned char* locateBetweenWkbString( unsigned char* ptr, QgsMultiPoly | const unsigned char* locateBetweenWkbString( const unsigned char* ptr, | |||
line& result, double fromMeasure, double toMeasure ); | QgsMultiPolyline& result, double fromMeasure, double toMeasure ); | |||
unsigned char* locateAlongWkbString( unsigned char* ptr, QgsMultiPoint& | const unsigned char* locateAlongWkbString( const unsigned char* ptr, Qg | |||
result, double measure ); | sMultiPoint& result, double measure ); | |||
static bool clipSegmentByRange( double x1, double y1, double m1, double x2, double y2, double m2, double range1, double range2, QgsPoint& pt1, Qgs Point& pt2, bool& secondPointClipped ); | static bool clipSegmentByRange( double x1, double y1, double m1, double x2, double y2, double m2, double range1, double range2, QgsPoint& pt1, Qgs Point& pt2, bool& secondPointClipped ); | |||
static void locateAlongSegment( double x1, double y1, double m1, double x2, double y2, double m2, double measure, bool& pt1Ok, QgsPoint& pt1, bool & pt2Ok, QgsPoint& pt2 ); | static void locateAlongSegment( double x1, double y1, double m1, double x2, double y2, double m2, double measure, bool& pt1Ok, QgsPoint& pt1, bool & pt2Ok, QgsPoint& pt2 ); | |||
}; | }; | |||
#endif //QGSVECTORANALYZER | #endif //QGSVECTORANALYZER | |||
End of changes. 1 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
qgsgpsconnection.h | qgsgpsconnection.h | |||
---|---|---|---|---|
skipping to change at line 52 | skipping to change at line 52 | |||
double direction; | double direction; | |||
QList<QgsSatelliteInfo> satellitesInView; | QList<QgsSatelliteInfo> satellitesInView; | |||
double pdop; | double pdop; | |||
double hdop; | double hdop; | |||
double vdop; | double vdop; | |||
double hacc; //horizontal accurancy in meters | double hacc; //horizontal accurancy in meters | |||
double vacc; //vertical accurancy in meters | double vacc; //vertical accurancy in meters | |||
QDateTime utcDateTime; | QDateTime utcDateTime; | |||
QChar fixMode; | QChar fixMode; | |||
int fixType; | int fixType; | |||
int quality; // from GPGGA | int quality; // from GPGGA | |||
int satellitesUsed; // from GPGGA | int satellitesUsed; // from GPGGA | |||
QChar status; // from GPRMC A,V | QChar status; // from GPRMC A,V | |||
QList<int>satPrn; // list of SVs in use; needed for QgsSatelliteInfo.inUs | QList<int> satPrn; // list of SVs in use; needed for QgsSatelliteInfo.inU | |||
e and other uses | se and other uses | |||
bool satInfoComplete; // based on GPGSV sentences - to be used to determ | bool satInfoComplete; // based on GPGSV sentences - to be used to determi | |||
ine when to graph signal and satellite position | ne when to graph signal and satellite position | |||
}; | }; | |||
/**Abstract base class for connection to a GPS device*/ | /**Abstract base class for connection to a GPS device*/ | |||
class CORE_EXPORT QgsGPSConnection : public QObject | class CORE_EXPORT QgsGPSConnection : public QObject | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
enum Status | enum Status | |||
{ | { | |||
NotConnected, | NotConnected, | |||
Connected, | Connected, | |||
DataReceived, | DataReceived, | |||
GPSDataReceived | GPSDataReceived | |||
}; | }; | |||
/**Constructor | /**Constructor | |||
@param dev input device for the connection (e.g. serial device). Th e class takes ownership of the object | @param dev input device for the connection (e.g. serial device). Th e class takes ownership of the object | |||
@param pollIntervall update intervall in milliseconds*/ | */ | |||
QgsGPSConnection( QIODevice* dev ); | QgsGPSConnection( QIODevice* dev ); | |||
virtual ~QgsGPSConnection(); | virtual ~QgsGPSConnection(); | |||
/**Opens connection to device*/ | /**Opens connection to device*/ | |||
bool connect(); | bool connect(); | |||
/**Closes connection to device*/ | /**Closes connection to device*/ | |||
bool close(); | bool close(); | |||
/**Sets the GPS source. The class takes ownership of the device class*/ | /**Sets the GPS source. The class takes ownership of the device class*/ | |||
void setSource( QIODevice* source ); | void setSource( QIODevice* source ); | |||
/**Returns the status. Possible state are not connected, connected, dat a received*/ | /**Returns the status. Possible state are not connected, connected, dat a received*/ | |||
Status status() const { return mStatus; } | Status status() const { return mStatus; } | |||
/**Returns the current gps information (lat, lon, etc.)*/ | /**Returns the current gps information (lat, lon, etc.)*/ | |||
QgsGPSInformation currentGPSInformation() const { return mLastGPSInform ation; } | QgsGPSInformation currentGPSInformation() const { return mLastGPSInform ation; } | |||
signals: | signals: | |||
void stateChanged( const QgsGPSInformation& info ); | void stateChanged( const QgsGPSInformation& info ); | |||
void nmeaSentenceReceived( const QString& substring ); // added to cap ture 'raw' data | void nmeaSentenceReceived( const QString& substring ); // added to capt ure 'raw' data | |||
protected: | protected: | |||
/**Data source (e.g. serial device, socket, file,...)*/ | /**Data source (e.g. serial device, socket, file,...)*/ | |||
QIODevice* mSource; | QIODevice* mSource; | |||
/**Last state of the gps related variables (e.g. position, time, ...)*/ | /**Last state of the gps related variables (e.g. position, time, ...)*/ | |||
QgsGPSInformation mLastGPSInformation; | QgsGPSInformation mLastGPSInformation; | |||
/**Connection status*/ | /**Connection status*/ | |||
Status mStatus; | Status mStatus; | |||
private: | private: | |||
End of changes. 4 change blocks. | ||||
8 lines changed or deleted | 8 lines changed or added | |||
qgsgraduatedsymbolrendererv2.h | qgsgraduatedsymbolrendererv2.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsgraduatedsymbolrendererv2.h | qgsgraduatedsymbolrendererv2.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSGRADUATEDSYMBOLRENDERERV2_H | #ifndef QGSGRADUATEDSYMBOLRENDERERV2_H | |||
#define QGSGRADUATEDSYMBOLRENDERERV2_H | #define QGSGRADUATEDSYMBOLRENDERERV2_H | |||
#include "qgssymbolv2.h" | #include "qgssymbolv2.h" | |||
#include "qgsrendererv2.h" | #include "qgsrendererv2.h" | |||
class CORE_EXPORT QgsRendererRangeV2 | class CORE_EXPORT QgsRendererRangeV2 | |||
{ | { | |||
public: | public: | |||
QgsRendererRangeV2(); | ||||
QgsRendererRangeV2( double lowerValue, double upperValue, QgsSymbolV2* symbol, QString label ); | QgsRendererRangeV2( double lowerValue, double upperValue, QgsSymbolV2* symbol, QString label ); | |||
QgsRendererRangeV2( const QgsRendererRangeV2& range ); | QgsRendererRangeV2( const QgsRendererRangeV2& range ); | |||
~QgsRendererRangeV2(); | ~QgsRendererRangeV2(); | |||
QgsRendererRangeV2& operator=( const QgsRendererRangeV2& range ); | ||||
double lowerValue() const; | double lowerValue() const; | |||
double upperValue() const; | double upperValue() const; | |||
QgsSymbolV2* symbol() const; | QgsSymbolV2* symbol() const; | |||
QString label() const; | QString label() const; | |||
void setSymbol( QgsSymbolV2* s ); | void setSymbol( QgsSymbolV2* s ); | |||
void setLabel( QString label ); | void setLabel( QString label ); | |||
void setLowerValue( double lowerValue ); | void setLowerValue( double lowerValue ); | |||
void setUpperValue( double upperValue ); | void setUpperValue( double upperValue ); | |||
// debugging | // debugging | |||
QString dump(); | QString dump() const; | |||
void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const; | void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const; | |||
protected: | protected: | |||
double mLowerValue, mUpperValue; | double mLowerValue, mUpperValue; | |||
QgsSymbolV2* mSymbol; | QgsSymbolV2* mSymbol; | |||
QString mLabel; | QString mLabel; | |||
}; | }; | |||
typedef QList<QgsRendererRangeV2> QgsRangeList; | typedef QList<QgsRendererRangeV2> QgsRangeList; | |||
skipping to change at line 71 | skipping to change at line 74 | |||
virtual ~QgsGraduatedSymbolRendererV2(); | virtual ~QgsGraduatedSymbolRendererV2(); | |||
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature ); | virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature ); | |||
virtual void startRender( QgsRenderContext& context, const QgsVectorLay er *vlayer ); | virtual void startRender( QgsRenderContext& context, const QgsVectorLay er *vlayer ); | |||
virtual void stopRender( QgsRenderContext& context ); | virtual void stopRender( QgsRenderContext& context ); | |||
virtual QList<QString> usedAttributes(); | virtual QList<QString> usedAttributes(); | |||
virtual QString dump(); | virtual QString dump() const; | |||
virtual QgsFeatureRendererV2* clone(); | virtual QgsFeatureRendererV2* clone(); | |||
virtual void toSld( QDomDocument& doc, QDomElement &element ) const; | virtual void toSld( QDomDocument& doc, QDomElement &element ) const; | |||
//! returns bitwise OR-ed capabilities of the renderer | //! returns bitwise OR-ed capabilities of the renderer | |||
//! \note added in 2.0 | //! \note added in 2.0 | |||
virtual int capabilities() { return SymbolLevels | RotationField; } | virtual int capabilities() { return SymbolLevels | RotationField | Filt er; } | |||
virtual QgsSymbolV2List symbols(); | virtual QgsSymbolV2List symbols(); | |||
QString classAttribute() const { return mAttrName; } | QString classAttribute() const { return mAttrName; } | |||
void setClassAttribute( QString attr ) { mAttrName = attr; } | void setClassAttribute( QString attr ) { mAttrName = attr; } | |||
const QgsRangeList& ranges() { return mRanges; } | const QgsRangeList& ranges() { return mRanges; } | |||
bool updateRangeSymbol( int rangeIndex, QgsSymbolV2* symbol ); | bool updateRangeSymbol( int rangeIndex, QgsSymbolV2* symbol ); | |||
bool updateRangeLabel( int rangeIndex, QString label ); | bool updateRangeLabel( int rangeIndex, QString label ); | |||
bool updateRangeUpperValue( int rangeIndex, double value ); | bool updateRangeUpperValue( int rangeIndex, double value ); | |||
bool updateRangeLowerValue( int rangeIndex, double value ); | bool updateRangeLowerValue( int rangeIndex, double value ); | |||
void addClass( QgsSymbolV2* symbol ); | void addClass( QgsSymbolV2* symbol ); | |||
void deleteClass( int idx ); | void deleteClass( int idx ); | |||
void deleteAllClasses(); | ||||
//! Moves the category at index position from to index position to. | ||||
void moveClass( int from, int to ); | ||||
void sortByValue( Qt::SortOrder order = Qt::AscendingOrder ); | ||||
void sortByLabel( Qt::SortOrder order = Qt::AscendingOrder ); | ||||
enum Mode | enum Mode | |||
{ | { | |||
EqualInterval, | EqualInterval, | |||
Quantile, | Quantile, | |||
Jenks, | Jenks, | |||
StdDev, | StdDev, | |||
Pretty, | Pretty, | |||
Custom | Custom | |||
}; | }; | |||
skipping to change at line 128 | skipping to change at line 138 | |||
static QgsFeatureRendererV2* create( QDomElement& element ); | static QgsFeatureRendererV2* create( QDomElement& element ); | |||
//! store renderer info to XML element | //! store renderer info to XML element | |||
virtual QDomElement save( QDomDocument& doc ); | virtual QDomElement save( QDomDocument& doc ); | |||
//! return a list of symbology items for the legend | //! return a list of symbology items for the legend | |||
virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize ); | virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize ); | |||
//! return a list of item text / symbol | //! return a list of item text / symbol | |||
//! @note: this method was added in version 1.5 | //! @note: this method was added in version 1.5 | |||
//! @note not available in python bindings | ||||
virtual QgsLegendSymbolList legendSymbolItems(); | virtual QgsLegendSymbolList legendSymbolItems(); | |||
QgsSymbolV2* sourceSymbol(); | QgsSymbolV2* sourceSymbol(); | |||
void setSourceSymbol( QgsSymbolV2* sym ); | void setSourceSymbol( QgsSymbolV2* sym ); | |||
QgsVectorColorRampV2* sourceColorRamp(); | QgsVectorColorRampV2* sourceColorRamp(); | |||
void setSourceColorRamp( QgsVectorColorRampV2* ramp ); | void setSourceColorRamp( QgsVectorColorRampV2* ramp ); | |||
/** Update the color ramp used. Also updates all symbols colors. | /** Update the color ramp used. Also updates all symbols colors. | |||
* Doesn't alter current breaks. | * Doesn't alter current breaks. | |||
skipping to change at line 154 | skipping to change at line 165 | |||
//! @note added in 1.6 | //! @note added in 1.6 | |||
void setRotationField( QString fieldName ) { mRotationField = fieldName ; } | void setRotationField( QString fieldName ) { mRotationField = fieldName ; } | |||
//! @note added in 1.6 | //! @note added in 1.6 | |||
QString rotationField() const { return mRotationField; } | QString rotationField() const { return mRotationField; } | |||
//! @note added in 1.6 | //! @note added in 1.6 | |||
void setSizeScaleField( QString fieldName ) { mSizeScaleField = fieldNa me; } | void setSizeScaleField( QString fieldName ) { mSizeScaleField = fieldNa me; } | |||
//! @note added in 1.6 | //! @note added in 1.6 | |||
QString sizeScaleField() const { return mSizeScaleField; } | QString sizeScaleField() const { return mSizeScaleField; } | |||
//! @note added in 2.0 | ||||
void setScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod ); | ||||
//! @note added in 2.0 | ||||
QgsSymbolV2::ScaleMethod scaleMethod() const { return mScaleMethod; } | ||||
protected: | protected: | |||
QString mAttrName; | QString mAttrName; | |||
QgsRangeList mRanges; | QgsRangeList mRanges; | |||
Mode mMode; | Mode mMode; | |||
QgsSymbolV2* mSourceSymbol; | QgsSymbolV2* mSourceSymbol; | |||
QgsVectorColorRampV2* mSourceColorRamp; | QgsVectorColorRampV2* mSourceColorRamp; | |||
QString mRotationField; | QString mRotationField; | |||
QString mSizeScaleField; | QString mSizeScaleField; | |||
QgsSymbolV2::ScaleMethod mScaleMethod; | ||||
//! attribute index (derived from attribute name in startRender) | //! attribute index (derived from attribute name in startRender) | |||
int mAttrNum; | int mAttrNum; | |||
int mRotationFieldIdx, mSizeScaleFieldIdx; | int mRotationFieldIdx, mSizeScaleFieldIdx; | |||
//! temporary symbols, used for data-defined rotation and scaling | //! temporary symbols, used for data-defined rotation and scaling | |||
#if QT_VERSION < 0x40600 | #if QT_VERSION < 0x40600 | |||
QMap<QgsSymbolV2*, QgsSymbolV2*> mTempSymbols; | QMap<QgsSymbolV2*, QgsSymbolV2*> mTempSymbols; | |||
#else | #else | |||
QHash<QgsSymbolV2*, QgsSymbolV2*> mTempSymbols; | QHash<QgsSymbolV2*, QgsSymbolV2*> mTempSymbols; | |||
End of changes. 10 change blocks. | ||||
4 lines changed or deleted | 21 lines changed or added | |||
qgsgraduatedsymbolrendererv2widget.h | qgsgraduatedsymbolrendererv2widget.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsgraduatedsymbolrendererv2widget.h | qgsgraduatedsymbolrendererv2widget.h | |||
--------------------- | --------------------- | |||
begin : December 2009 | begin : December 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSGRADUATEDSYMBOLRENDERERV2WIDGET_H | #ifndef QGSGRADUATEDSYMBOLRENDERERV2WIDGET_H | |||
#define QGSGRADUATEDSYMBOLRENDERERV2WIDGET_H | #define QGSGRADUATEDSYMBOLRENDERERV2WIDGET_H | |||
#include "qgsgraduatedsymbolrendererv2.h" | #include "qgsgraduatedsymbolrendererv2.h" | |||
#include "qgsrendererv2widget.h" | #include "qgsrendererv2widget.h" | |||
#include <QStandardItem> | #include <QStandardItem> | |||
#include <QProxyStyle> | ||||
#include "ui_qgsgraduatedsymbolrendererv2widget.h" | #include "ui_qgsgraduatedsymbolrendererv2widget.h" | |||
class GUI_EXPORT QgsGraduatedSymbolRendererV2Widget : public QgsRendererV2W idget, private Ui::QgsGraduatedSymbolRendererV2Widget | class GUI_EXPORT QgsGraduatedSymbolRendererV2Model : public QAbstractItemMo del | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | ||||
QgsGraduatedSymbolRendererV2Model( QObject * parent = 0 ); | ||||
Qt::ItemFlags flags( const QModelIndex & index ) const; | ||||
Qt::DropActions supportedDropActions() const; | ||||
QVariant data( const QModelIndex &index, int role ) const; | ||||
bool setData( const QModelIndex & index, const QVariant & value, int ro | ||||
le ); | ||||
QVariant headerData( int section, Qt::Orientation orientation, int role | ||||
) const; | ||||
int rowCount( const QModelIndex &parent = QModelIndex() ) const; | ||||
int columnCount( const QModelIndex & = QModelIndex() ) const; | ||||
QModelIndex index( int row, int column, const QModelIndex &parent = QMo | ||||
delIndex() ) const; | ||||
QModelIndex parent( const QModelIndex &index ) const; | ||||
QStringList mimeTypes() const; | ||||
QMimeData *mimeData( const QModelIndexList &indexes ) const; | ||||
bool dropMimeData( const QMimeData *data, Qt::DropAction action, int ro | ||||
w, int column, const QModelIndex &parent ); | ||||
void setRenderer( QgsGraduatedSymbolRendererV2* renderer ); | ||||
void addClass( QgsSymbolV2* symbol ); | ||||
void deleteRows( QList<int> rows ); | ||||
void removeAllRows( ); | ||||
void sort( int column, Qt::SortOrder order = Qt::AscendingOrder ); | ||||
signals: | ||||
void rowsMoved(); | ||||
private: | ||||
QgsGraduatedSymbolRendererV2* mRenderer; | ||||
QString mMimeFormat; | ||||
}; | ||||
// View style which shows drop indicator line between items | ||||
class QgsGraduatedSymbolRendererV2ViewStyle: public QProxyStyle | ||||
{ | ||||
public: | public: | |||
QgsGraduatedSymbolRendererV2ViewStyle( QStyle* style = 0 ); | ||||
void drawPrimitive( PrimitiveElement element, const QStyleOption * opti | ||||
on, QPainter * painter, const QWidget * widget = 0 ) const; | ||||
}; | ||||
class GUI_EXPORT QgsGraduatedSymbolRendererV2Widget : public QgsRendererV2W | ||||
idget, private Ui::QgsGraduatedSymbolRendererV2Widget | ||||
{ | ||||
Q_OBJECT | ||||
public: | ||||
static QgsRendererV2Widget* create( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ); | static QgsRendererV2Widget* create( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ); | |||
QgsGraduatedSymbolRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ); | QgsGraduatedSymbolRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ); | |||
~QgsGraduatedSymbolRendererV2Widget(); | ~QgsGraduatedSymbolRendererV2Widget(); | |||
virtual QgsFeatureRendererV2* renderer(); | virtual QgsFeatureRendererV2* renderer(); | |||
public slots: | public slots: | |||
void changeGraduatedSymbol(); | void changeGraduatedSymbol(); | |||
void graduatedColumnChanged(); | void graduatedColumnChanged(); | |||
void classifyGraduated(); | void classifyGraduated(); | |||
void reapplyColorRamp(); | void reapplyColorRamp(); | |||
void rangesDoubleClicked( const QModelIndex & idx ); | void rangesDoubleClicked( const QModelIndex & idx ); | |||
void rangesClicked( const QModelIndex & idx ); | void rangesClicked( const QModelIndex & idx ); | |||
void changeCurrentValue( QStandardItem * item ); | void changeCurrentValue( QStandardItem * item ); | |||
/**Adds a class manually to the classification*/ | /**Adds a class manually to the classification*/ | |||
void addClass(); | void addClass(); | |||
/**Removes a class from the classification*/ | /**Removes currently selected classes */ | |||
void deleteCurrentClass(); | void deleteClasses(); | |||
/**Removes all classes from the classification*/ | ||||
void deleteAllClasses(); | ||||
void rotationFieldChanged( QString fldName ); | void rotationFieldChanged( QString fldName ); | |||
void sizeScaleFieldChanged( QString fldName ); | void sizeScaleFieldChanged( QString fldName ); | |||
void scaleMethodChanged( QgsSymbolV2::ScaleMethod scaleMethod ); | ||||
void showSymbolLevels(); | void showSymbolLevels(); | |||
void rowsMoved(); | ||||
protected: | protected: | |||
void updateUiFromRenderer(); | void updateUiFromRenderer(); | |||
void updateGraduatedSymbolIcon(); | void updateGraduatedSymbolIcon(); | |||
//! return a list of indexes for the classes under selection | ||||
QList<int> selectedClasses(); | ||||
//! populate column combos in categorized and graduated page | //! populate column combos in categorized and graduated page | |||
void populateColumns(); | void populateColumns(); | |||
void populateColorRamps(); | ||||
//! populate ranges of graduated symbol renderer | ||||
void populateRanges(); | ||||
void changeRangeSymbol( int rangeIdx ); | void changeRangeSymbol( int rangeIdx ); | |||
void changeRange( int rangeIdx ); | void changeRange( int rangeIdx ); | |||
void changeSelectedSymbols(); | ||||
QList<QgsSymbolV2*> selectedSymbols(); | QList<QgsSymbolV2*> selectedSymbols(); | |||
QgsSymbolV2* findSymbolForRange( double lowerBound, double upperBound, const QgsRangeList& ranges ) const; | QgsSymbolV2* findSymbolForRange( double lowerBound, double upperBound, const QgsRangeList& ranges ) const; | |||
void refreshSymbolView(); | void refreshSymbolView(); | |||
protected: | protected: | |||
QgsGraduatedSymbolRendererV2* mRenderer; | QgsGraduatedSymbolRendererV2* mRenderer; | |||
QgsSymbolV2* mGraduatedSymbol; | QgsSymbolV2* mGraduatedSymbol; | |||
int mRowSelected; | int mRowSelected; | |||
QgsRendererV2DataDefinedMenus* mDataDefinedMenus; | QgsRendererV2DataDefinedMenus* mDataDefinedMenus; | |||
QgsGraduatedSymbolRendererV2Model* mModel; | ||||
}; | }; | |||
#endif // QGSGRADUATEDSYMBOLRENDERERV2WIDGET_H | #endif // QGSGRADUATEDSYMBOLRENDERERV2WIDGET_H | |||
End of changes. 14 change blocks. | ||||
9 lines changed or deleted | 64 lines changed or added | |||
qgsgraph.h | qgsgraph.h | |||
---|---|---|---|---|
skipping to change at line 149 | skipping to change at line 149 | |||
* add vertex to a grap | * add vertex to a grap | |||
*/ | */ | |||
int addVertex( const QgsPoint& pt ); | int addVertex( const QgsPoint& pt ); | |||
/** | /** | |||
* add edge to a graph | * add edge to a graph | |||
*/ | */ | |||
int addArc( int outVertexIdx, int inVertexIdx, const QVector< QVariant >& properties ); | int addArc( int outVertexIdx, int inVertexIdx, const QVector< QVariant >& properties ); | |||
/** | /** | |||
* retrun vertex count | * return vertex count | |||
*/ | */ | |||
int vertexCount() const; | int vertexCount() const; | |||
/** | /** | |||
* return vertex at index | * return vertex at index | |||
*/ | */ | |||
const QgsGraphVertex& vertex( int idx ) const; | const QgsGraphVertex& vertex( int idx ) const; | |||
/** | /** | |||
* retrun edge count | * return edge count | |||
*/ | */ | |||
int arcCount() const; | int arcCount() const; | |||
/** | /** | |||
* retrun edge at index | * return edge at index | |||
*/ | */ | |||
const QgsGraphArc& arc( int idx ) const; | const QgsGraphArc& arc( int idx ) const; | |||
/** | /** | |||
* find vertex by point | * find vertex by point | |||
* \return vertex index | * \return vertex index | |||
*/ | */ | |||
int findVertex( const QgsPoint& pt ) const; | int findVertex( const QgsPoint& pt ) const; | |||
private: | private: | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
qgsgraphanalyzer.h | qgsgraphanalyzer.h | |||
---|---|---|---|---|
skipping to change at line 39 | skipping to change at line 39 | |||
*/ | */ | |||
class ANALYSIS_EXPORT QgsGraphAnalyzer | class ANALYSIS_EXPORT QgsGraphAnalyzer | |||
{ | { | |||
public: | public: | |||
/** | /** | |||
* solve shortest path problem using dijkstra algorithm | * solve shortest path problem using dijkstra algorithm | |||
* @param source The source graph | * @param source The source graph | |||
* @param startVertexIdx index of start vertex | * @param startVertexIdx index of start vertex | |||
* @param criterionNum index of arc property as optimization criterion | * @param criterionNum index of arc property as optimization criterion | |||
* @param treeResult array represents the shortest path tree. resultTre e[ vertexIndex ] == inboundingArcIndex if vertex reacheble and resultTree[ vertexIndex ] == -1 others. | * @param resultTree array represents the shortest path tree. resultTre e[ vertexIndex ] == inboundingArcIndex if vertex reacheble and resultTree[ vertexIndex ] == -1 others. | |||
* @param resultCost array of cost paths | * @param resultCost array of cost paths | |||
*/ | */ | |||
static void dijkstra( const QgsGraph* source, int startVertexIdx, int c riterionNum, QVector<int>* resultTree = NULL, QVector<double>* resultCost = NULL ); | static void dijkstra( const QgsGraph* source, int startVertexIdx, int c riterionNum, QVector<int>* resultTree = NULL, QVector<double>* resultCost = NULL ); | |||
/** | /** | |||
* return shortest path tree with root-node in startVertexIdx | * return shortest path tree with root-node in startVertexIdx | |||
* @param source The source graph | * @param source The source graph | |||
* @param startVertexIdx index of start vertex | * @param startVertexIdx index of start vertex | |||
* @param criterionNum index of edge property as optimization criterion | * @param criterionNum index of edge property as optimization criterion | |||
*/ | */ | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgsgraphbuilderintr.h | qgsgraphbuilderintr.h | |||
---|---|---|---|---|
skipping to change at line 49 | skipping to change at line 49 | |||
* @param crs Coordinate reference system for new graph vertex | * @param crs Coordinate reference system for new graph vertex | |||
* @param ctfEnabled enable coordinate transform from source graph CRS to CRS graph | * @param ctfEnabled enable coordinate transform from source graph CRS to CRS graph | |||
* @param topologyTolerance sqrt distance between source point as one g raph vertex | * @param topologyTolerance sqrt distance between source point as one g raph vertex | |||
* @param ellipsoidID ellipsoid for edge measurement | * @param ellipsoidID ellipsoid for edge measurement | |||
*/ | */ | |||
QgsGraphBuilderInterface( const QgsCoordinateReferenceSystem& crs, bool ctfEnabled = true, double topologyTolerance = 0.0, const QString& ellipsoi dID = "WGS84" ) : | QgsGraphBuilderInterface( const QgsCoordinateReferenceSystem& crs, bool ctfEnabled = true, double topologyTolerance = 0.0, const QString& ellipsoi dID = "WGS84" ) : | |||
mCrs( crs ), mCtfEnabled( ctfEnabled ), mTopologyTolerance( topolog yTolerance ) | mCrs( crs ), mCtfEnabled( ctfEnabled ), mTopologyTolerance( topolog yTolerance ) | |||
{ | { | |||
mDa.setSourceCrs( mCrs.srsid() ); | mDa.setSourceCrs( mCrs.srsid() ); | |||
mDa.setEllipsoid( ellipsoidID ); | mDa.setEllipsoid( ellipsoidID ); | |||
mDa.setProjectionsEnabled( ctfEnabled ); | mDa.setEllipsoidalMode( ctfEnabled ); | |||
} | } | |||
//! Destructor | //! Destructor | |||
virtual ~QgsGraphBuilderInterface() | virtual ~QgsGraphBuilderInterface() | |||
{ } | { } | |||
//! get destinaltion Crs | //! get destinaltion Crs | |||
QgsCoordinateReferenceSystem& destinationCrs() | QgsCoordinateReferenceSystem& destinationCrs() | |||
{ | { | |||
return mCrs; | return mCrs; | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgsinterpolator.h | qgsinterpolator.h | |||
---|---|---|---|---|
skipping to change at line 67 | skipping to change at line 67 | |||
virtual ~QgsInterpolator(); | virtual ~QgsInterpolator(); | |||
/**Calculates interpolation value for map coordinates x, y | /**Calculates interpolation value for map coordinates x, y | |||
@param x x-coordinate (in map units) | @param x x-coordinate (in map units) | |||
@param y y-coordinate (in map units) | @param y y-coordinate (in map units) | |||
@param result out: interpolation result | @param result out: interpolation result | |||
@return 0 in case of success*/ | @return 0 in case of success*/ | |||
virtual int interpolatePoint( double x, double y, double& result ) = 0; | virtual int interpolatePoint( double x, double y, double& result ) = 0; | |||
/**Use a vector attribute as interpolation value*/ | ||||
void enableAttributeValueInterpolation( int attribute ); | ||||
protected: | protected: | |||
/**Caches the vertex and value data from the provider. All the vertex d ata | /**Caches the vertex and value data from the provider. All the vertex d ata | |||
will be held in virtual memory | will be held in virtual memory | |||
@return 0 in case of success*/ | @return 0 in case of success*/ | |||
int cacheBaseData(); | int cacheBaseData(); | |||
QVector<vertexData> mCachedBaseData; | QVector<vertexData> mCachedBaseData; | |||
/**Flag that tells if the cache already has been filled*/ | /**Flag that tells if the cache already has been filled*/ | |||
bool mDataIsCached; | bool mDataIsCached; | |||
End of changes. 1 change blocks. | ||||
3 lines changed or deleted | 0 lines changed or added | |||
qgslabel.h | qgslabel.h | |||
---|---|---|---|---|
skipping to change at line 45 | skipping to change at line 45 | |||
class QgsField; | class QgsField; | |||
class QgsLabelAttributes; | class QgsLabelAttributes; | |||
#include "qgsfield.h" | #include "qgsfield.h" | |||
#include "qgsrectangle.h" | #include "qgsrectangle.h" | |||
#include "qgsrendercontext.h" | #include "qgsrendercontext.h" | |||
typedef QList<int> QgsAttributeList; | typedef QList<int> QgsAttributeList; | |||
typedef QMap<int, QgsField> QgsFieldMap; | typedef QMap<int, QgsField> QgsFieldMap; | |||
class QgsFields; | ||||
/** \ingroup core | /** \ingroup core | |||
* A class to render labels. | * A class to render labels. | |||
* Label rendering properties can be either specified directly or | * Label rendering properties can be either specified directly or | |||
* in most cases determined dynamically based on the value of an attribute . | * in most cases determined dynamically based on the value of an attribute . | |||
**/ | **/ | |||
class CORE_EXPORT QgsLabel | class CORE_EXPORT QgsLabel | |||
{ | { | |||
public: | public: | |||
QgsLabel( const QgsFieldMap & fields ); | QgsLabel( const QgsFields & fields ); | |||
~QgsLabel(); | ~QgsLabel(); | |||
/* Fields */ | /* Fields */ | |||
enum LabelField | enum LabelField | |||
{ | { | |||
Text = 0, | Text = 0, | |||
Family, | Family, | |||
Size, | Size, | |||
SizeType, | SizeType, | |||
skipping to change at line 94 | skipping to change at line 95 | |||
LabelFieldCount | LabelFieldCount | |||
}; | }; | |||
struct labelpoint | struct labelpoint | |||
{ | { | |||
QgsPoint p; | QgsPoint p; | |||
double angle; | double angle; | |||
}; | }; | |||
/** \brief render label | /** \brief render label | |||
* \param painter painter to render label in | ||||
* \param viewExtent extent to render labels in | ||||
* \param coordinateTransform coordinate transformation to use | ||||
* \param transform transformation from coordinate to canvas pixels | ||||
* \param feature feature to label | ||||
* \param selected feature is selected | ||||
* \param classAttributes attributes to create label from | ||||
* \param sizeScale scale | ||||
* \param rasterScaleFactor raster scale | ||||
* \deprecated | ||||
*/ | ||||
Q_DECL_DEPRECATED void renderLabel( QPainter* painter, const QgsRectang | ||||
le& viewExtent, | ||||
QgsCoordinateTransform* coordinateT | ||||
ransform, | ||||
const QgsMapToPixel *transform, | ||||
QgsFeature &feature, bool selected, | ||||
QgsLabelAttributes *classAttributes = 0, | ||||
double sizeScale = 1., double raste | ||||
rScaleFactor = 1.0 ) | ||||
{ | ||||
QgsRenderContext r; | ||||
r.setExtent( viewExtent ); | ||||
r.setCoordinateTransform( new QgsCoordinateTransform( coordinateTrans | ||||
form->sourceCrs(), coordinateTransform->destCRS() ) ); | ||||
r.setMapToPixel( *transform ); | ||||
r.setPainter( painter ); | ||||
r.setScaleFactor( sizeScale ); | ||||
r.setRasterScaleFactor( rasterScaleFactor ); | ||||
renderLabel( r, feature, selected, classAttributes ); | ||||
} | ||||
/** \brief render label | ||||
* \param renderContext the render context | * \param renderContext the render context | |||
* \param feature feature to render the label for | * \param feature feature to render the label for | |||
* \param selected feature is selected | * \param selected feature is selected | |||
* \param classAttributes attributes to create the label from | * \param classAttributes attributes to create the label from | |||
* \note added in 1.2 | * \note added in 1.2 | |||
*/ | */ | |||
void renderLabel( QgsRenderContext &renderContext, QgsFeature &feature, bool selected, QgsLabelAttributes *classAttributes = 0 ); | void renderLabel( QgsRenderContext &renderContext, QgsFeature &feature, bool selected, QgsLabelAttributes *classAttributes = 0 ); | |||
/** Reads the renderer configuration from an XML file | /** Reads the renderer configuration from an XML file | |||
@param node the Dom node to read | @param node the Dom node to read | |||
*/ | */ | |||
void readXML( const QDomNode& node ); | void readXML( const QDomNode& node ); | |||
/** Writes the contents of the renderer to a configuration file */ | /** Writes the contents of the renderer to a configuration file */ | |||
void writeXML( QDomNode & label_node, QDomDocument & document ) const; | void writeXML( QDomNode & label_node, QDomDocument & document ) const; | |||
//! add vector of required fields to existing list of fields | //! add vector of required fields to existing list of fields | |||
void addRequiredFields( QgsAttributeList& fields ) const; | void addRequiredFields( QgsAttributeList& fields ) const; | |||
//! Set available fields | //! Set available fields | |||
void setFields( const QgsFieldMap & fields ); | void setFields( const QgsFields & fields ); | |||
//! Available vector fields | //! Available vector fields | |||
QgsFieldMap & fields( void ); | QgsFields & fields(); | |||
/** Pointer to default attributes. | ||||
* @deprecated in version 2 as it is badly named. Rather use attributes | ||||
. | ||||
* @see labelAttributes method rather */ | ||||
Q_DECL_DEPRECATED QgsLabelAttributes *layerAttributes( void ); | ||||
/** Pointer to default attributes. | /** Pointer to default attributes. | |||
* @note this replaces the to-be-deprecated layerAttributes method. | * @note this replaces the to-be-deprecated layerAttributes method. | |||
* @note introduced in QGIS 1.4 | * @note introduced in QGIS 1.4 | |||
*/ | */ | |||
QgsLabelAttributes *labelAttributes( void ); | QgsLabelAttributes *labelAttributes(); | |||
//! Set label field | //! Set label field | |||
void setLabelField( int attr, int fieldIndex ); | void setLabelField( int attr, int fieldIndex ); | |||
//! label field | //! label field | |||
QString labelField( int attr ) const; | QString labelField( int attr ) const; | |||
/** Get field value if : 1) field name is not empty | /** Get field value if : 1) field name is not empty | |||
* 2) field exists | * 2) field exists | |||
* 3) value is defined | * 3) value is defined | |||
skipping to change at line 200 | skipping to change at line 168 | |||
double xoffset, double yoffset, | double xoffset, double yoffset, | |||
double ang, | double ang, | |||
int width, int height, int alignment ); | int width, int height, int alignment ); | |||
bool readLabelField( QDomElement &el, int attr, QString prefix ); | bool readLabelField( QDomElement &el, int attr, QString prefix ); | |||
/** Get label point for simple feature in map units */ | /** Get label point for simple feature in map units */ | |||
void labelPoint( std::vector<labelpoint>&, QgsFeature &feature ); | void labelPoint( std::vector<labelpoint>&, QgsFeature &feature ); | |||
/** Get label point for the given feature in wkb format. */ | /** Get label point for the given feature in wkb format. */ | |||
unsigned char* labelPoint( labelpoint& point, unsigned char* wkb, size_ t wkblen ); | const unsigned char* labelPoint( labelpoint& point, const unsigned char * wkb, size_t wkblen ); | |||
/** Color to draw selected features */ | /** Color to draw selected features */ | |||
QColor mSelectionColor; | QColor mSelectionColor; | |||
//! Default layer attributes | //! Default layer attributes | |||
QgsLabelAttributes *mLabelAttributes; | QgsLabelAttributes *mLabelAttributes; | |||
//! Available layer fields | //! Available layer fields | |||
QgsFieldMap mField; | QgsFields mFields; | |||
//! Label fields | //! Label fields | |||
std::vector<QString> mLabelField; | std::vector<QString> mLabelField; | |||
//! Label field indexes | //! Label field indexes | |||
std::vector<int> mLabelFieldIdx; | std::vector<int> mLabelFieldIdx; | |||
/** Minimum scale at which this label should be displayed */ | /** Minimum scale at which this label should be displayed */ | |||
float mMinScale; | float mMinScale; | |||
/** Maximum scale at which this label should be displayed */ | /** Maximum scale at which this label should be displayed */ | |||
End of changes. 8 change blocks. | ||||
45 lines changed or deleted | 7 lines changed or added | |||
qgslabelattributes.h | qgslabelattributes.h | |||
---|---|---|---|---|
skipping to change at line 101 | skipping to change at line 101 | |||
}; | }; | |||
static QString unitsName( int units ); | static QString unitsName( int units ); | |||
static int unitsCode( const QString &name ); | static int unitsCode( const QString &name ); | |||
static QString alignmentName( int alignment ); | static QString alignmentName( int alignment ); | |||
static int alignmentCode( const QString &name ); | static int alignmentCode( const QString &name ); | |||
/* Text */ | /* Text */ | |||
void setText( const QString & text ); | void setText( const QString & text ); | |||
bool textIsSet( void ) const; | bool textIsSet() const; | |||
const QString text( void ) const; | const QString text() const; | |||
/* Font */ | /* Font */ | |||
void setFamily( const QString & family ); | void setFamily( const QString & family ); | |||
bool familyIsSet( void ) const; | bool familyIsSet() const; | |||
const QString family( void ) const; | const QString family() const; | |||
void setBold( bool enable ); | void setBold( bool enable ); | |||
bool boldIsSet( void ) const; | bool boldIsSet() const; | |||
bool bold( void ) const; | bool bold() const; | |||
void setItalic( bool enable ); | void setItalic( bool enable ); | |||
bool italicIsSet( void ) const; | bool italicIsSet() const; | |||
bool italic( void ) const; | bool italic() const; | |||
void setUnderline( bool enable ); | void setUnderline( bool enable ); | |||
bool underlineIsSet( void ) const; | bool underlineIsSet() const; | |||
bool underline( void ) const; | bool underline() const; | |||
/* strikeout added in 1.5 */ | /* strikeout added in 1.5 */ | |||
void setStrikeOut( bool enable ); | void setStrikeOut( bool enable ); | |||
bool strikeOutIsSet( void ) const; | bool strikeOutIsSet() const; | |||
bool strikeOut( void ) const; | bool strikeOut() const; | |||
void setSize( double size, int type ); | void setSize( double size, int type ); | |||
bool sizeIsSet( void ) const; | bool sizeIsSet() const; | |||
int sizeType( void ) const; | int sizeType() const; | |||
double size( void ) const; | double size() const; | |||
void setColor( const QColor &color ); | void setColor( const QColor &color ); | |||
bool colorIsSet( void ) const; | bool colorIsSet() const; | |||
const QColor & color( void ) const; | const QColor & color() const; | |||
/* Offset */ | /* Offset */ | |||
void setOffset( double x, double y, int type ); | void setOffset( double x, double y, int type ); | |||
bool offsetIsSet( void ) const; | bool offsetIsSet() const; | |||
int offsetType( void ) const; | int offsetType() const; | |||
double xOffset( void ) const; | double xOffset() const; | |||
double yOffset( void ) const; | double yOffset() const; | |||
/* Angle */ | /* Angle */ | |||
void setAngle( double angle ); | void setAngle( double angle ); | |||
bool angleIsSet( void ) const; | bool angleIsSet() const; | |||
double angle( void ) const; | double angle() const; | |||
bool angleIsAuto( void ) const; | bool angleIsAuto() const; | |||
void setAutoAngle( bool state ); | void setAutoAngle( bool state ); | |||
/* Alignment */ | /* Alignment */ | |||
void setAlignment( int alignment ); | void setAlignment( int alignment ); | |||
bool alignmentIsSet( void ) const; | bool alignmentIsSet() const; | |||
int alignment( void ) const; | int alignment() const; | |||
/* Buffer */ | /* Buffer */ | |||
bool bufferEnabled() const; | bool bufferEnabled() const; | |||
void setBufferEnabled( bool useBufferFlag ); | void setBufferEnabled( bool useBufferFlag ); | |||
void setBufferSize( double size, int type ); | void setBufferSize( double size, int type ); | |||
bool bufferSizeIsSet( void ) const; | bool bufferSizeIsSet() const; | |||
int bufferSizeType( void ) const; | int bufferSizeType() const; | |||
double bufferSize( void ) const; | double bufferSize() const; | |||
void setBufferColor( const QColor &color ); | void setBufferColor( const QColor &color ); | |||
bool bufferColorIsSet( void ) const; | bool bufferColorIsSet() const; | |||
QColor bufferColor( void ) const; | QColor bufferColor() const; | |||
void setBufferStyle( Qt::BrushStyle style ); | void setBufferStyle( Qt::BrushStyle style ); | |||
bool bufferStyleIsSet( void ) const; | bool bufferStyleIsSet() const; | |||
Qt::BrushStyle bufferStyle( void ) const; | Qt::BrushStyle bufferStyle() const; | |||
/* Border */ | /* Border */ | |||
void setBorderColor( const QColor &color ); | void setBorderColor( const QColor &color ); | |||
bool borderColorIsSet( void ) const; | bool borderColorIsSet() const; | |||
QColor borderColor( void ) const; | QColor borderColor() const; | |||
void setBorderWidth( int width ); | void setBorderWidth( int width ); | |||
bool borderWidthIsSet( void ) const; | bool borderWidthIsSet() const; | |||
int borderWidth( void ) const; | int borderWidth() const; | |||
void setBorderStyle( Qt::PenStyle style ); | void setBorderStyle( Qt::PenStyle style ); | |||
bool borderStyleIsSet( void ) const; | bool borderStyleIsSet() const; | |||
Qt::PenStyle borderStyle( void ) const; | Qt::PenStyle borderStyle() const; | |||
bool multilineEnabled() const; | bool multilineEnabled() const; | |||
void setMultilineEnabled( bool useMultiline ); | void setMultilineEnabled( bool useMultiline ); | |||
/* label only selected features | /* label only selected features | |||
* added in 1.5 | * added in 1.5 | |||
*/ | */ | |||
bool selectedOnly() const; | bool selectedOnly() const; | |||
void setSelectedOnly( bool selectedonly ); | void setSelectedOnly( bool selectedonly ); | |||
End of changes. 18 change blocks. | ||||
39 lines changed or deleted | 39 lines changed or added | |||
qgslegendinterface.h | qgslegendinterface.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
#ifndef QGSLEGENDINTERFACE_H | #ifndef QGSLEGENDINTERFACE_H | |||
#define QGSLEGENDINTERFACE_H | #define QGSLEGENDINTERFACE_H | |||
#include <QObject> | #include <QObject> | |||
#include <QPair> | #include <QPair> | |||
#include <QStringList> | #include <QStringList> | |||
#include <QModelIndex> | #include <QModelIndex> | |||
class QgsMapLayer; | class QgsMapLayer; | |||
class QTreeWidgetItem; | class QTreeWidgetItem; | |||
class QAction; | ||||
#include "qgsmaplayer.h" | ||||
//Information about relationship between groups and layers | //Information about relationship between groups and layers | |||
//key: group name (or null strings for single layers without groups) | //key: group name (or null strings for single layers without groups) | |||
//value: containter with layer ids contained in the group | //value: containter with layer ids contained in the group | |||
typedef QPair< QString, QList<QString> > GroupLayerInfo; | typedef QPair< QString, QList<QString> > GroupLayerInfo; | |||
/** \ingroup gui | /** \ingroup gui | |||
* QgsLegendInterface | * QgsLegendInterface | |||
* Abstract base class to make QgsLegend available to plugins. | * Abstract base class to make QgsLegend available to plugins. | |||
* | * | |||
skipping to change at line 57 | skipping to change at line 60 | |||
/** Virtual destructor */ | /** Virtual destructor */ | |||
virtual ~QgsLegendInterface(); | virtual ~QgsLegendInterface(); | |||
//! Return a string list of groups | //! Return a string list of groups | |||
virtual QStringList groups() = 0; | virtual QStringList groups() = 0; | |||
//! Return the relationship between groups and layers in the legend | //! Return the relationship between groups and layers in the legend | |||
virtual QList< GroupLayerInfo > groupLayerRelationship() { return QList < GroupLayerInfo >(); } | virtual QList< GroupLayerInfo > groupLayerRelationship() { return QList < GroupLayerInfo >(); } | |||
//! Return all layers in the project in legend order | //! Returns the currently selected layers of QgsLegendLayers. | |||
//! @param inDrawOrder return layers in drawing order (added in 1.9) | ||||
//! @returns list of layers, else an empty list | ||||
virtual QList<QgsMapLayer *> selectedLayers( bool inDrawOrder = false ) | ||||
const = 0; | ||||
//! Return all layers in the project in drawing order | ||||
//! @note added in 1.5 | //! @note added in 1.5 | |||
virtual QList< QgsMapLayer * > layers() const = 0; | virtual QList< QgsMapLayer * > layers() const = 0; | |||
//! Check if a group exists | //! Check if a group exists | |||
//! @note added in 1.5 | //! @note added in 1.5 | |||
virtual bool groupExists( int groupIndex ) = 0; | virtual bool groupExists( int groupIndex ) = 0; | |||
//! Check if a group is expanded | //! Check if a group is expanded | |||
//! @note added in 1.5 | //! @note added in 1.5 | |||
virtual bool isGroupExpanded( int groupIndex ) = 0; | virtual bool isGroupExpanded( int groupIndex ) = 0; | |||
//! Check if a group is visible | //! Check if a group is visible | |||
//! @note added in 1.5 | //! @note added in 1.5 | |||
virtual bool isGroupVisible( int groupIndex ) = 0; | virtual bool isGroupVisible( int groupIndex ) = 0; | |||
//! Check if a layer is expanded | ||||
//! @note added in 2.0 | ||||
virtual bool isLayerExpanded( QgsMapLayer * ml ) = 0; | ||||
//! Check if a layer is visible | //! Check if a layer is visible | |||
//! @note added in 1.5 | //! @note added in 1.5 | |||
virtual bool isLayerVisible( QgsMapLayer * ml ) = 0; | virtual bool isLayerVisible( QgsMapLayer * ml ) = 0; | |||
/** Add action for layers in the legend | ||||
* @note added in 2.0 | ||||
*/ | ||||
virtual void addLegendLayerAction( QAction* action, QString menu, QStri | ||||
ng id, | ||||
QgsMapLayer::LayerType type, bool al | ||||
lLayers ) = 0; | ||||
/** Add action for a specific layers in the legend. | ||||
* Use this in combination with addLegendLayerAction( allLayers = False | ||||
) | ||||
* @note added in 2.0 | ||||
*/ | ||||
virtual void addLegendLayerActionForLayer( QAction* action, QgsMapLayer | ||||
* layer ) = 0; | ||||
/** Remove action for layers in the legend | ||||
* @note added in 2.0 | ||||
*/ | ||||
virtual bool removeLegendLayerAction( QAction* action ) = 0; | ||||
//! Returns the current layer if the current item is a QgsLegendLayer. | ||||
//! If the current item is a QgsLegendLayer, its first maplayer is retu | ||||
rned. | ||||
//! Else, 0 is returned. | ||||
//! @note Added in 2.0 | ||||
virtual QgsMapLayer* currentLayer() = 0; | ||||
//! set the current layer | ||||
//! returns true if the layer exists, false otherwise | ||||
//! @note Added in 2.0 | ||||
virtual bool setCurrentLayer( QgsMapLayer *layer ) = 0; | ||||
signals: | signals: | |||
//! emitted when a group index has changed | //! emitted when a group index has changed | |||
void groupIndexChanged( int oldIndex, int newIndex ); | void groupIndexChanged( int oldIndex, int newIndex ); | |||
/* //! emitted when group relations have changed */ | /* //! emitted when group relations have changed */ | |||
void groupRelationsChanged( ); | void groupRelationsChanged( ); | |||
/* //! emitted when an item (group/layer) is added */ | /* //! emitted when an item (group/layer) is added */ | |||
void itemAdded( QModelIndex index ); | void itemAdded( QModelIndex index ); | |||
/* //! emitted when an item (group/layer) is removed */ | /* //! emitted when an item (group/layer) is removed */ | |||
void itemRemoved( ); | void itemRemoved( ); | |||
//! Emitted whenever current (selected) layer changes | ||||
// the pointer to layer can be null if no layer is selected | ||||
//! @note Added in 2.0 | ||||
void currentLayerChanged( QgsMapLayer * layer ); | ||||
public slots: | public slots: | |||
//! Add a new group | //! Add a new group | |||
//! a parent group can be given to nest the new group in it | //! a parent group can be given to nest the new group in it | |||
virtual int addGroup( QString name, bool expand = true, QTreeWidgetItem * parent = 0 ) = 0; | virtual int addGroup( QString name, bool expand = true, QTreeWidgetItem * parent = 0 ) = 0; | |||
//! Add a new group | //! Add a new group | |||
//! a parent group index has to be given to nest the new group in it | //! a parent group index has to be given to nest the new group in it | |||
virtual int addGroup( QString name, bool expand, int parentIndex ) = 0; | virtual int addGroup( QString name, bool expand, int parentIndex ) = 0; | |||
//! Remove group on index | //! Remove group on index | |||
virtual void removeGroup( int groupIndex ) = 0; | virtual void removeGroup( int groupIndex ) = 0; | |||
//! Move a layer to a group | //! Move a layer to a group | |||
virtual void moveLayer( QgsMapLayer * ml, int groupIndex ) = 0; | virtual void moveLayer( QgsMapLayer * ml, int groupIndex ) = 0; | |||
//! Collapse or expand a group | //! Collapse or expand a group | |||
//! @note added in 1.5 | //! @note added in 1.5 | |||
virtual void setGroupExpanded( int groupIndex, bool expand ) = 0; | virtual void setGroupExpanded( int groupIndex, bool expand ) = 0; | |||
//! Collapse or expand a layer | ||||
//! @note added in 2.0 | ||||
virtual void setLayerExpanded( QgsMapLayer * ml, bool expand ) = 0; | ||||
//! Set the visibility of a group | //! Set the visibility of a group | |||
//! @note added in 1.5 | //! @note added in 1.5 | |||
virtual void setGroupVisible( int groupIndex, bool visible ) = 0; | virtual void setGroupVisible( int groupIndex, bool visible ) = 0; | |||
//! Set the visibility of a layer | //! Set the visibility of a layer | |||
//! @note added in 1.5 | //! @note added in 1.5 | |||
virtual void setLayerVisible( QgsMapLayer * ml, bool visible ) = 0; | virtual void setLayerVisible( QgsMapLayer * ml, bool visible ) = 0; | |||
//! Refresh layer symbology | //! Refresh layer symbology | |||
//! @note added in 1.5 | //! @note added in 1.5 | |||
End of changes. 6 change blocks. | ||||
1 lines changed or deleted | 56 lines changed or added | |||
qgslegendmodel.h | qgslegendmodel.h | |||
---|---|---|---|---|
skipping to change at line 28 | skipping to change at line 28 | |||
#ifndef QGSLEGENDMODEL_H | #ifndef QGSLEGENDMODEL_H | |||
#define QGSLEGENDMODEL_H | #define QGSLEGENDMODEL_H | |||
#include <QStandardItemModel> | #include <QStandardItemModel> | |||
#include <QStringList> | #include <QStringList> | |||
#include <QSet> | #include <QSet> | |||
class QDomDocument; | class QDomDocument; | |||
class QDomElement; | class QDomElement; | |||
class QgsMapLayer; | class QgsMapLayer; | |||
class QgsSymbol; | ||||
class QgsSymbolV2; | class QgsSymbolV2; | |||
class QgsVectorLayer; | class QgsVectorLayer; | |||
//Information about relationship between groups and layers | //Information about relationship between groups and layers | |||
//key: group name (or null strings for single layers without groups) | //key: group name (or null strings for single layers without groups) | |||
//value: containter with layer ids contained in the group | //value: containter with layer ids contained in the group | |||
typedef QPair< QString, QList<QString> > GroupLayerInfo; | typedef QPair< QString, QList<QString> > GroupLayerInfo; | |||
/** \ingroup MapComposer | /** \ingroup MapComposer | |||
* A model that provides group, layer and classification items. | * A model that provides group, layer and classification items. | |||
skipping to change at line 59 | skipping to change at line 58 | |||
LayerItem, | LayerItem, | |||
ClassificationItem | ClassificationItem | |||
}; | }; | |||
QgsLegendModel(); | QgsLegendModel(); | |||
~QgsLegendModel(); | ~QgsLegendModel(); | |||
/**Sets layer set and groups*/ | /**Sets layer set and groups*/ | |||
void setLayerSetAndGroups( const QStringList& layerIds, const QList< Gr oupLayerInfo >& groupInfo ); | void setLayerSetAndGroups( const QStringList& layerIds, const QList< Gr oupLayerInfo >& groupInfo ); | |||
void setLayerSet( const QStringList& layerIds ); | void setLayerSet( const QStringList& layerIds ); | |||
/**Adds a group to a toplevel position (or -1 if it should be placed at | /**Adds a group | |||
the end of the legend). Returns a pointer to the added group*/ | @param text name of group (defaults to translation of "Group") | |||
QStandardItem* addGroup( QString text = tr( "Group" ), int position = - | @param position insertion position (toplevel position (or -1 if it sh | |||
1 ); | ould be placed at the end of the legend). | |||
@returns a pointer to the added group | ||||
*/ | ||||
QStandardItem *addGroup( QString text = QString::null, int position = - | ||||
1 ); | ||||
/**Tries to automatically update a model entry (e.g. a whole layer or o nly a single item)*/ | /**Tries to automatically update a model entry (e.g. a whole layer or o nly a single item)*/ | |||
void updateItem( QStandardItem* item ); | void updateItem( QStandardItem* item ); | |||
/**Updates the whole symbology of a layer*/ | /**Updates the whole symbology of a layer*/ | |||
void updateLayer( QStandardItem* layerItem ); | void updateLayer( QStandardItem* layerItem ); | |||
/**Tries to update a single classification item*/ | /**Tries to update a single classification item*/ | |||
void updateVectorClassificationItem( QStandardItem* classificationItem, | ||||
QgsSymbol* symbol, QString itemText ) | ||||
{ Q_UNUSED( classificationItem ); Q_UNUSED( symbol ); Q_UNUSED( itemTex | ||||
t ); } | ||||
void updateVectorV2ClassificationItem( QStandardItem* classificationIte m, QgsSymbolV2* symbol, QString itemText ) | void updateVectorV2ClassificationItem( QStandardItem* classificationIte m, QgsSymbolV2* symbol, QString itemText ) | |||
{ Q_UNUSED( classificationItem ); Q_UNUSED( symbol ); Q_UNUSED( itemTex t ); } | { Q_UNUSED( classificationItem ); Q_UNUSED( symbol ); Q_UNUSED( itemTex t ); } | |||
void updateRasterClassificationItem( QStandardItem* classificationItem ) | void updateRasterClassificationItem( QStandardItem* classificationItem ) | |||
{ Q_UNUSED( classificationItem ); } | { Q_UNUSED( classificationItem ); } | |||
/** Update single item text using item userText and other properties li | ||||
ke showFeatureCount */ | ||||
void updateItemText( QStandardItem* item ); | ||||
bool writeXML( QDomElement& composerLegendElem, QDomDocument& doc ) con st; | bool writeXML( QDomElement& composerLegendElem, QDomDocument& doc ) con st; | |||
bool readXML( const QDomElement& legendModelElem, const QDomDocument& d oc ); | bool readXML( const QDomElement& legendModelElem, const QDomDocument& d oc ); | |||
Qt::DropActions supportedDropActions() const; | Qt::DropActions supportedDropActions() const; | |||
Qt::ItemFlags flags( const QModelIndex &index ) const; | Qt::ItemFlags flags( const QModelIndex &index ) const; | |||
/**Implemented to support drag operations*/ | /**Implemented to support drag operations*/ | |||
virtual bool removeRows( int row, int count, const QModelIndex & parent = QModelIndex() ); | virtual bool removeRows( int row, int count, const QModelIndex & parent = QModelIndex() ); | |||
/**For the drag operation*/ | /**For the drag operation*/ | |||
skipping to change at line 101 | skipping to change at line 105 | |||
bool autoUpdate() { return mAutoUpdate; } | bool autoUpdate() { return mAutoUpdate; } | |||
public slots: | public slots: | |||
void removeLayer( const QString& layerId ); | void removeLayer( const QString& layerId ); | |||
void addLayer( QgsMapLayer* theMapLayer ); | void addLayer( QgsMapLayer* theMapLayer ); | |||
signals: | signals: | |||
void layersChanged(); | void layersChanged(); | |||
private: | private: | |||
/**Adds classification items of vector layers | ||||
@return 0 in case of success*/ | ||||
int addVectorLayerItems( QStandardItem* layerItem, QgsVectorLayer* vlay | ||||
er ); | ||||
/**Adds classification items of vector layers using new symbology*/ | /**Adds classification items of vector layers using new symbology*/ | |||
int addVectorLayerItemsV2( QStandardItem* layerItem, QgsVectorLayer* vl ayer ); | int addVectorLayerItemsV2( QStandardItem* layerItem, QgsVectorLayer* vl ayer ); | |||
/**Adds item of raster layer | /**Adds item of raster layer | |||
@return 0 in case of success*/ | @return 0 in case of success*/ | |||
int addRasterLayerItems( QStandardItem* layerItem, QgsMapLayer* rlayer ); | int addRasterLayerItems( QStandardItem* layerItem, QgsMapLayer* rlayer ); | |||
/**Creates a model item for a vector symbol. The calling function takes | void updateLayerItemText( QStandardItem* layerItem ); | |||
ownership*/ | void updateSymbolV2ItemText( QStandardItem* symbolItem ); | |||
QStandardItem* itemFromSymbol( QgsSymbol* s, int opacity, const QString | void updateRasterSymbolItemText( QStandardItem* symbolItem ); | |||
& layerID ); | ||||
protected: | protected: | |||
QStringList mLayerIds; | QStringList mLayerIds; | |||
/**True if this application has toplevel windows (normally true). If th is is false, this means that the application | /**True if this application has toplevel windows (normally true). If th is is false, this means that the application | |||
might not have a running x-server on unix systems and so QPixmap and QIcon cannot be used*/ | might not have a running x-server on unix systems and so QPixmap and QIcon cannot be used*/ | |||
bool mHasTopLevelWindow; | bool mHasTopLevelWindow; | |||
/**True if the legend is auto updated when layers are added or removed from the map canvas */ | /**True if the legend is auto updated when layers are added or removed from the map canvas */ | |||
bool mAutoUpdate; | bool mAutoUpdate; | |||
}; | }; | |||
End of changes. 6 change blocks. | ||||
18 lines changed or deleted | 15 lines changed or added | |||
qgslinearminmaxenhancement.h | qgslinearminmaxenhancement.h | |||
---|---|---|---|---|
skipping to change at line 31 | skipping to change at line 31 | |||
#include "qgscontrastenhancementfunction.h" | #include "qgscontrastenhancementfunction.h" | |||
/** \ingroup core | /** \ingroup core | |||
* A color enhancement function that performs a linear enhanceContrast bet ween min and max. | * A color enhancement function that performs a linear enhanceContrast bet ween min and max. | |||
*/ | */ | |||
class CORE_EXPORT QgsLinearMinMaxEnhancement : public QgsContrastEnhancemen tFunction | class CORE_EXPORT QgsLinearMinMaxEnhancement : public QgsContrastEnhancemen tFunction | |||
{ | { | |||
public: | public: | |||
QgsLinearMinMaxEnhancement( QgsContrastEnhancement::QgsRasterDataType, double, double ); | QgsLinearMinMaxEnhancement( QGis::DataType, double, double ); | |||
int enhance( double ); | int enhance( double ); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgslinearminmaxenhancementwithclip.h | qgslinearminmaxenhancementwithclip.h | |||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
#include "qgscontrastenhancementfunction.h" | #include "qgscontrastenhancementfunction.h" | |||
/** \ingroup core | /** \ingroup core | |||
* A linear enhanceContrast enhancement that first clips to min max and the n enhanceContrastes | * A linear enhanceContrast enhancement that first clips to min max and the n enhanceContrastes | |||
* linearly between min and max. | * linearly between min and max. | |||
*/ | */ | |||
class CORE_EXPORT QgsLinearMinMaxEnhancementWithClip : public QgsContrastEn hancementFunction | class CORE_EXPORT QgsLinearMinMaxEnhancementWithClip : public QgsContrastEn hancementFunction | |||
{ | { | |||
public: | public: | |||
QgsLinearMinMaxEnhancementWithClip( QgsContrastEnhancement::QgsRasterDa taType, double, double ); | QgsLinearMinMaxEnhancementWithClip( QGis::DataType, double, double ); | |||
int enhance( double ); | int enhance( double ); | |||
bool isValueInDisplayableRange( double ); | bool isValueInDisplayableRange( double ); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgslinesymbollayerv2.h | qgslinesymbollayerv2.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgslinesymbollayerv2.h | qgslinesymbollayerv2.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSLINESYMBOLLAYERV2_H | #ifndef QGSLINESYMBOLLAYERV2_H | |||
#define QGSLINESYMBOLLAYERV2_H | #define QGSLINESYMBOLLAYERV2_H | |||
#include "qgssymbollayerv2.h" | #include "qgssymbollayerv2.h" | |||
#include <QPen> | #include <QPen> | |||
#include <QVector> | #include <QVector> | |||
class QgsExpression; | ||||
#define DEFAULT_SIMPLELINE_COLOR QColor(0,0,0) | #define DEFAULT_SIMPLELINE_COLOR QColor(0,0,0) | |||
#define DEFAULT_SIMPLELINE_WIDTH DEFAULT_LINE_WIDTH | #define DEFAULT_SIMPLELINE_WIDTH DEFAULT_LINE_WIDTH | |||
#define DEFAULT_SIMPLELINE_PENSTYLE Qt::SolidLine | #define DEFAULT_SIMPLELINE_PENSTYLE Qt::SolidLine | |||
#define DEFAULT_SIMPLELINE_JOINSTYLE Qt::BevelJoin | #define DEFAULT_SIMPLELINE_JOINSTYLE Qt::BevelJoin | |||
#define DEFAULT_SIMPLELINE_CAPSTYLE Qt::SquareCap | #define DEFAULT_SIMPLELINE_CAPSTYLE Qt::SquareCap | |||
class CORE_EXPORT QgsSimpleLineSymbolLayerV2 : public QgsLineSymbolLayerV2 | class CORE_EXPORT QgsSimpleLineSymbolLayerV2 : public QgsLineSymbolLayerV2 | |||
{ | { | |||
public: | public: | |||
QgsSimpleLineSymbolLayerV2( QColor color = DEFAULT_SIMPLELINE_COLOR, | QgsSimpleLineSymbolLayerV2( QColor color = DEFAULT_SIMPLELINE_COLOR, | |||
skipping to change at line 58 | skipping to change at line 60 | |||
void stopRender( QgsSymbolV2RenderContext& context ); | void stopRender( QgsSymbolV2RenderContext& context ); | |||
void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context ); | void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context ); | |||
QgsStringMap properties() const; | QgsStringMap properties() const; | |||
QgsSymbolLayerV2* clone() const; | QgsSymbolLayerV2* clone() const; | |||
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const; | void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const; | |||
QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFacto | ||||
r ) const; | ||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | ||||
QgsSymbolV2::OutputUnit outputUnit() const; | ||||
// new stuff | // new stuff | |||
Qt::PenStyle penStyle() const { return mPenStyle; } | Qt::PenStyle penStyle() const { return mPenStyle; } | |||
void setPenStyle( Qt::PenStyle style ) { mPenStyle = style; } | void setPenStyle( Qt::PenStyle style ) { mPenStyle = style; } | |||
Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; } | Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; } | |||
void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; } | void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; } | |||
Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; } | Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; } | |||
void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; } | void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; } | |||
double offset() const { return mOffset; } | double offset() const { return mOffset; } | |||
void setOffset( double offset ) { mOffset = offset; } | void setOffset( double offset ) { mOffset = offset; } | |||
QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | ||||
void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit | ||||
; } | ||||
bool useCustomDashPattern() const { return mUseCustomDashPattern; } | bool useCustomDashPattern() const { return mUseCustomDashPattern; } | |||
void setUseCustomDashPattern( bool b ) { mUseCustomDashPattern = b; } | void setUseCustomDashPattern( bool b ) { mUseCustomDashPattern = b; } | |||
QgsSymbolV2::OutputUnit customDashPatternUnit() const { return mCustomD | ||||
ashPatternUnit; } | ||||
void setCustomDashPatternUnit( QgsSymbolV2::OutputUnit unit ) { mCustom | ||||
DashPatternUnit = unit; } | ||||
QVector<qreal> customDashVector() const { return mCustomDashVector; } | QVector<qreal> customDashVector() const { return mCustomDashVector; } | |||
void setCustomDashVector( const QVector<qreal>& vector ) { mCustomDashV ector = vector; } | void setCustomDashVector( const QVector<qreal>& vector ) { mCustomDashV ector = vector; } | |||
protected: | protected: | |||
Qt::PenStyle mPenStyle; | Qt::PenStyle mPenStyle; | |||
Qt::PenJoinStyle mPenJoinStyle; | Qt::PenJoinStyle mPenJoinStyle; | |||
Qt::PenCapStyle mPenCapStyle; | Qt::PenCapStyle mPenCapStyle; | |||
QPen mPen; | QPen mPen; | |||
QPen mSelPen; | QPen mSelPen; | |||
double mOffset; | double mOffset; | |||
QgsSymbolV2::OutputUnit mOffsetUnit; | ||||
//use a custom dash dot pattern instead of the predefined ones | //use a custom dash dot pattern instead of the predefined ones | |||
bool mUseCustomDashPattern; | bool mUseCustomDashPattern; | |||
QgsSymbolV2::OutputUnit mCustomDashPatternUnit; | ||||
/**Vector with an even number of entries for the */ | /**Vector with an even number of entries for the */ | |||
QVector<qreal> mCustomDashVector; | QVector<qreal> mCustomDashVector; | |||
private: | ||||
//helper functions for data defined symbology | ||||
void applyDataDefinedSymbology( QgsSymbolV2RenderContext& context, QPen | ||||
& pen, QPen& selPen, double& offset ); | ||||
}; | }; | |||
///////// | ///////// | |||
#define DEFAULT_MARKERLINE_ROTATE true | #define DEFAULT_MARKERLINE_ROTATE true | |||
#define DEFAULT_MARKERLINE_INTERVAL 3 | #define DEFAULT_MARKERLINE_INTERVAL 3 | |||
class CORE_EXPORT QgsMarkerLineSymbolLayerV2 : public QgsLineSymbolLayerV2 | class CORE_EXPORT QgsMarkerLineSymbolLayerV2 : public QgsLineSymbolLayerV2 | |||
{ | { | |||
public: | public: | |||
skipping to change at line 156 | skipping to change at line 177 | |||
double interval() const { return mInterval; } | double interval() const { return mInterval; } | |||
void setInterval( double interval ) { mInterval = interval; } | void setInterval( double interval ) { mInterval = interval; } | |||
double offset() const { return mOffset; } | double offset() const { return mOffset; } | |||
void setOffset( double offset ) { mOffset = offset; } | void setOffset( double offset ) { mOffset = offset; } | |||
Placement placement() const { return mPlacement; } | Placement placement() const { return mPlacement; } | |||
void setPlacement( Placement p ) { mPlacement = p; } | void setPlacement( Placement p ) { mPlacement = p; } | |||
QgsSymbolV2::OutputUnit intervalUnit() const { return mIntervalUnit; } | ||||
void setIntervalUnit( QgsSymbolV2::OutputUnit unit ) { mIntervalUnit = | ||||
unit; } | ||||
QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | ||||
void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit | ||||
; } | ||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | ||||
QgsSymbolV2::OutputUnit outputUnit() const; | ||||
protected: | protected: | |||
void renderPolylineInterval( const QPolygonF& points, QgsSymbolV2Render Context& context ); | void renderPolylineInterval( const QPolygonF& points, QgsSymbolV2Render Context& context ); | |||
void renderPolylineVertex( const QPolygonF& points, QgsSymbolV2RenderCo ntext& context ); | void renderPolylineVertex( const QPolygonF& points, QgsSymbolV2RenderCo ntext& context, Placement placement = Vertex ); | |||
void renderPolylineCentral( const QPolygonF& points, QgsSymbolV2RenderC ontext& context ); | void renderPolylineCentral( const QPolygonF& points, QgsSymbolV2RenderC ontext& context ); | |||
double markerAngle( const QPolygonF& points, bool isRing, int vertex ); | ||||
bool mRotateMarker; | bool mRotateMarker; | |||
double mInterval; | double mInterval; | |||
QgsSymbolV2::OutputUnit mIntervalUnit; | ||||
QgsMarkerSymbolV2* mMarker; | QgsMarkerSymbolV2* mMarker; | |||
double mOffset; | double mOffset; | |||
QgsSymbolV2::OutputUnit mOffsetUnit; | ||||
Placement mPlacement; | Placement mPlacement; | |||
}; | }; | |||
///////// | ||||
#define DEFAULT_LINEDECORATION_COLOR QColor(0,0,0) | ||||
#define DEFAULT_LINEDECORATION_WIDTH DEFAULT_LINE_WIDTH | ||||
class CORE_EXPORT QgsLineDecorationSymbolLayerV2 : public QgsLineSymbolLaye | ||||
rV2 | ||||
{ | ||||
public: | ||||
QgsLineDecorationSymbolLayerV2( QColor color = DEFAULT_LINEDECORATION_C | ||||
OLOR, | ||||
double width = DEFAULT_LINEDECORATION_W | ||||
IDTH ); | ||||
~QgsLineDecorationSymbolLayerV2(); | ||||
// static stuff | ||||
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsSt | ||||
ringMap() ); | ||||
static QgsSymbolLayerV2* createFromSld( QDomElement &element ); | ||||
// implemented from base classes | ||||
QString layerType() const; | ||||
void startRender( QgsSymbolV2RenderContext& context ); | ||||
void stopRender( QgsSymbolV2RenderContext& context ); | ||||
void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& | ||||
context ); | ||||
QgsStringMap properties() const; | ||||
QgsSymbolLayerV2* clone() const; | ||||
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props | ||||
) const; | ||||
protected: | ||||
QPen mPen; | ||||
QPen mSelPen; | ||||
}; | ||||
#endif | #endif | |||
End of changes. 14 change blocks. | ||||
48 lines changed or deleted | 42 lines changed or added | |||
qgslinevectorlayerdirector.h | qgslinevectorlayerdirector.h | |||
---|---|---|---|---|
skipping to change at line 38 | skipping to change at line 38 | |||
/** | /** | |||
* \ingroup networkanalysis | * \ingroup networkanalysis | |||
* \class QgsLineVectorLayerDirector | * \class QgsLineVectorLayerDirector | |||
* \brief Determine making the graph from vector line layer | * \brief Determine making the graph from vector line layer | |||
*/ | */ | |||
class ANALYSIS_EXPORT QgsLineVectorLayerDirector : public QgsGraphDirector | class ANALYSIS_EXPORT QgsLineVectorLayerDirector : public QgsGraphDirector | |||
{ | { | |||
public: | public: | |||
/** | /** | |||
* @param vl source vector layer | * @param myLayer source vector layer | |||
* @param directionFieldId feield contain road direction value | * @param directionFieldId feield contain road direction value | |||
* @param directDirectionValue value for one-way road | * @param directDirectionValue value for one-way road | |||
* @param reverseDirectionValue value for reverse one-way road | * @param reverseDirectionValue value for reverse one-way road | |||
* @param bothDirectionValue value for road | * @param bothDirectionValue value for road | |||
* @param defaultDirection 1 - direct direction, 2 - reverse direction, 3 - both direction | * @param defaultDirection 1 - direct direction, 2 - reverse direction, 3 - both direction | |||
*/ | */ | |||
QgsLineVectorLayerDirector( QgsVectorLayer* vl, | QgsLineVectorLayerDirector( QgsVectorLayer* myLayer, | |||
int directionFieldId, | int directionFieldId, | |||
const QString& directDirectionValue, | const QString& directDirectionValue, | |||
const QString& reverseDirectionValue, | const QString& reverseDirectionValue, | |||
const QString& bothDirectionValue, | const QString& bothDirectionValue, | |||
int defaultDirection | int defaultDirection | |||
); | ); | |||
//! Destructor | //! Destructor | |||
virtual ~QgsLineVectorLayerDirector(); | virtual ~QgsLineVectorLayerDirector(); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
qgslogger.h | qgslogger.h | |||
---|---|---|---|---|
skipping to change at line 33 | skipping to change at line 33 | |||
#include <QString> | #include <QString> | |||
class QFile; | class QFile; | |||
#ifdef QGISDEBUG | #ifdef QGISDEBUG | |||
#define QgsDebugMsg(str) QgsLogger::debug(QString(str), 1, __FILE__, __FUNC TION__, __LINE__) | #define QgsDebugMsg(str) QgsLogger::debug(QString(str), 1, __FILE__, __FUNC TION__, __LINE__) | |||
#define QgsDebugMsgLevel(str, level) \ | #define QgsDebugMsgLevel(str, level) \ | |||
{ \ | { \ | |||
if ( QgsLogger::debugLevel() >= (level) && (level) > 0 ) \ | if ( QgsLogger::debugLevel() >= (level) && (level) > 0 ) \ | |||
QgsLogger::debug(QString(str), (level), __FILE__, __FUNCTION__, __LIN E__); \ | QgsLogger::debug(QString(str), (level), __FILE__, __FUNCTION__, __LIN E__); \ | |||
} | } | |||
#define QgsDebugCall QgsScopeLogger _qgsScopeLogger(__FILE__, __FUNCTION__, __LINE__) | ||||
#else | #else | |||
#define QgsDebugCall | ||||
#define QgsDebugMsg(str) | #define QgsDebugMsg(str) | |||
#define QgsDebugMsgLevel(str, level) | #define QgsDebugMsgLevel(str, level) | |||
#endif | #endif | |||
/** \ingroup core | /** \ingroup core | |||
* QgsLogger is a class to print debug/warning/error messages to the consol e. | * QgsLogger is a class to print debug/warning/error messages to the consol e. | |||
* The advantage of this class over iostream & co. is that the | * The advantage of this class over iostream & co. is that the | |||
* output can be controlled with environment variables: | * output can be controlled with environment variables: | |||
* QGIS_DEBUG is an int describing what debug messages are written to the c onsole. | * QGIS_DEBUG is an int describing what debug messages are written to the c onsole. | |||
* If the debug level of a message is <= QGIS_DEBUG, the message is written to the | * If the debug level of a message is <= QGIS_DEBUG, the message is written to the | |||
skipping to change at line 70 | skipping to change at line 72 | |||
@param debuglevel | @param debuglevel | |||
@param file file name where the message comes from | @param file file name where the message comes from | |||
@param function function where the message comes from | @param function function where the message comes from | |||
@param line place in file where the message comes from*/ | @param line place in file where the message comes from*/ | |||
static void debug( const QString& msg, int debuglevel = 1, const char* file = NULL, const char* function = NULL, int line = -1 ); | static void debug( const QString& msg, int debuglevel = 1, const char* file = NULL, const char* function = NULL, int line = -1 ); | |||
/**Similar to the previous method, but prints a variable int-value pair */ | /**Similar to the previous method, but prints a variable int-value pair */ | |||
static void debug( const QString& var, int val, int debuglevel = 1, con st char* file = NULL, const char* function = NULL, int line = -1 ); | static void debug( const QString& var, int val, int debuglevel = 1, con st char* file = NULL, const char* function = NULL, int line = -1 ); | |||
/**Similar to the previous method, but prints a variable double-value p air*/ | /**Similar to the previous method, but prints a variable double-value p air*/ | |||
// @note not available in python bindings | ||||
static void debug( const QString& var, double val, int debuglevel = 1, const char* file = NULL, const char* function = NULL, int line = -1 ); | static void debug( const QString& var, double val, int debuglevel = 1, const char* file = NULL, const char* function = NULL, int line = -1 ); | |||
/**Prints out a variable/value pair for types with overloaded operator< <*/ | /**Prints out a variable/value pair for types with overloaded operator< <*/ | |||
// @note not available in python bindings | ||||
template <typename T> static void debug( const QString& var, T val, con st char* file = 0, const char* function = 0, | template <typename T> static void debug( const QString& var, T val, con st char* file = 0, const char* function = 0, | |||
int line = -1, int debuglevel = 1 ) | int line = -1, int debuglevel = 1 ) | |||
{ | { | |||
Q_UNUSED( debuglevel ); | Q_UNUSED( debuglevel ); | |||
const char* dfile = debugFile(); | const char* dfile = debugFile(); | |||
if ( dfile ) //exit if QGIS_DEBUG_FILE is set and the message comes f rom the wrong file | if ( dfile ) //exit if QGIS_DEBUG_FILE is set and the message comes f rom the wrong file | |||
{ | { | |||
if ( !file || strcmp( dfile, file ) != 0 ) | if ( !file || strcmp( dfile, file ) != 0 ) | |||
{ | { | |||
return; | return; | |||
skipping to change at line 131 | skipping to change at line 135 | |||
/**Reads the environment variable QGIS_DEBUG_FILE. Returns NULL if the variable is not set. | /**Reads the environment variable QGIS_DEBUG_FILE. Returns NULL if the variable is not set. | |||
* If set, only messages from this source file will be sent to logs. */ | * If set, only messages from this source file will be sent to logs. */ | |||
static const char* debugFile(); | static const char* debugFile(); | |||
/** current debug level */ | /** current debug level */ | |||
static int sDebugLevel; | static int sDebugLevel; | |||
static int sPrefixLength; | static int sPrefixLength; | |||
}; | }; | |||
class QgsScopeLogger | ||||
{ | ||||
public: | ||||
QgsScopeLogger( const char* file, const char* func, int line ) | ||||
: _file( file ), _func( func ), _line( line ) | ||||
{ | ||||
QgsLogger::debug( "Entering.", 1, _file, _func, _line ); | ||||
} | ||||
~QgsScopeLogger() | ||||
{ | ||||
QgsLogger::debug( "Leaving.", 1, _file, _func, _line ); | ||||
} | ||||
private: | ||||
const char *_file; | ||||
const char *_func; | ||||
int _line; | ||||
}; | ||||
#endif | #endif | |||
End of changes. 5 change blocks. | ||||
0 lines changed or deleted | 22 lines changed or added | |||
qgsmanageconnectionsdialog.h | qgsmanageconnectionsdialog.h | |||
---|---|---|---|---|
skipping to change at line 41 | skipping to change at line 41 | |||
Export, | Export, | |||
Import | Import | |||
}; | }; | |||
enum Type | enum Type | |||
{ | { | |||
WMS, | WMS, | |||
PostGIS, | PostGIS, | |||
WFS, | WFS, | |||
MSSQL, | MSSQL, | |||
WCS, | ||||
Oracle, | ||||
}; | }; | |||
// constructor | // constructor | |||
// mode argument must be 0 for export and 1 for import | // mode argument must be 0 for export and 1 for import | |||
// type argument must be 0 for WMS and 1 for PostGIS | // type argument must be 0 for WMS and 1 for PostGIS | |||
QgsManageConnectionsDialog( QWidget *parent = NULL, Mode mode = Export, Type type = WMS, QString fileName = "" ); | QgsManageConnectionsDialog( QWidget *parent = NULL, Mode mode = Export, Type type = WMS, QString fileName = "" ); | |||
public slots: | public slots: | |||
void doExportImport(); | void doExportImport(); | |||
void selectAll(); | void selectAll(); | |||
void clearSelection(); | void clearSelection(); | |||
private: | private: | |||
bool populateConnections(); | bool populateConnections(); | |||
QDomDocument saveWMSConnections( const QStringList &connections ); | ||||
QDomDocument saveOWSConnections( const QStringList &connections, const | ||||
QString &service ); | ||||
QDomDocument saveWFSConnections( const QStringList &connections ); | QDomDocument saveWFSConnections( const QStringList &connections ); | |||
QDomDocument savePgConnections( const QStringList & connections ); | QDomDocument savePgConnections( const QStringList & connections ); | |||
QDomDocument saveMssqlConnections( const QStringList & connections ); | QDomDocument saveMssqlConnections( const QStringList & connections ); | |||
void loadWMSConnections( const QDomDocument &doc, const QStringList &it | QDomDocument saveOracleConnections( const QStringList & connections ); | |||
ems ); | ||||
void loadOWSConnections( const QDomDocument &doc, const QStringList &it | ||||
ems, const QString &service ); | ||||
void loadWFSConnections( const QDomDocument &doc, const QStringList &it ems ); | void loadWFSConnections( const QDomDocument &doc, const QStringList &it ems ); | |||
void loadPgConnections( const QDomDocument &doc, const QStringList &ite ms ); | void loadPgConnections( const QDomDocument &doc, const QStringList &ite ms ); | |||
void loadMssqlConnections( const QDomDocument &doc, const QStringList & items ); | void loadMssqlConnections( const QDomDocument &doc, const QStringList & items ); | |||
void loadOracleConnections( const QDomDocument &doc, const QStringList &items ); | ||||
QString mFileName; | QString mFileName; | |||
Mode mDialogMode; | Mode mDialogMode; | |||
Type mConnectionType; | Type mConnectionType; | |||
}; | }; | |||
#endif // QGSMANAGECONNECTIONSDIALOG_H | #endif // QGSMANAGECONNECTIONSDIALOG_H | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 10 lines changed or added | |||
qgsmapcanvas.h | qgsmapcanvas.h | |||
---|---|---|---|---|
skipping to change at line 21 | skipping to change at line 21 | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSMAPCANVAS_H | #ifndef QGSMAPCANVAS_H | |||
#define QGSMAPCANVAS_H | #define QGSMAPCANVAS_H | |||
#include "qgsconfig.h" | ||||
#include <list> | #include <list> | |||
#include <memory> | #include <memory> | |||
#include <deque> | #include <deque> | |||
#include "qgsrectangle.h" | #include "qgsrectangle.h" | |||
#include "qgspoint.h" | #include "qgspoint.h" | |||
#include "qgis.h" | #include "qgis.h" | |||
#include <QDomDocument> | #include <QDomDocument> | |||
#include <QGraphicsView> | #include <QGraphicsView> | |||
skipping to change at line 122 | skipping to change at line 124 | |||
void setCurrentLayer( QgsMapLayer* layer ); | void setCurrentLayer( QgsMapLayer* layer ); | |||
void updateOverview(); | void updateOverview(); | |||
void enableOverviewMode( QgsMapOverviewCanvas* overview ); | void enableOverviewMode( QgsMapOverviewCanvas* overview ); | |||
QgsMapCanvasMap* map(); | QgsMapCanvasMap* map(); | |||
QgsMapRenderer* mapRenderer(); | QgsMapRenderer* mapRenderer(); | |||
//! Accessor for the canvas pixmap | ||||
//! @deprecated use canvasPaintDevice() | ||||
Q_DECL_DEPRECATED QPixmap& canvasPixmap(); | ||||
//! Accessor for the canvas paint device | //! Accessor for the canvas paint device | |||
QPaintDevice &canvasPaintDevice(); | QPaintDevice &canvasPaintDevice(); | |||
//! Get the last reported scale of the canvas | //! Get the last reported scale of the canvas | |||
double scale(); | double scale(); | |||
//! Clear the map canvas | //! Clear the map canvas | |||
void clear(); | void clear(); | |||
//! Returns the mapUnitsPerPixel (map units per pixel) for the canvas | //! Returns the mapUnitsPerPixel (map units per pixel) for the canvas | |||
double mapUnitsPerPixel() const; | double mapUnitsPerPixel() const; | |||
//! Returns the current zoom exent of the map canvas | //! Returns the current zoom exent of the map canvas | |||
QgsRectangle extent() const; | QgsRectangle extent() const; | |||
//! Returns the combined exent for all layers on the map canvas | //! Returns the combined exent for all layers on the map canvas | |||
QgsRectangle fullExtent() const; | QgsRectangle fullExtent() const; | |||
//! Set the extent of the map canvas | //! Set the extent of the map canvas | |||
void setExtent( QgsRectangle const & r ); | void setExtent( const QgsRectangle &r ); | |||
//! Zoom to the full extent of all layers | //! Zoom to the full extent of all layers | |||
void zoomToFullExtent(); | void zoomToFullExtent(); | |||
//! Zoom to the previous extent (view) | //! Zoom to the previous extent (view) | |||
void zoomToPreviousExtent(); | void zoomToPreviousExtent(); | |||
//! Zoom to the Next extent (view) | //! Zoom to the next extent (view) | |||
void zoomToNextExtent(); | void zoomToNextExtent(); | |||
// ! Clears the list of extents and sets current extent as first item | // ! Clears the list of extents and sets current extent as first item | |||
void clearExtentHistory(); | void clearExtentHistory(); | |||
/** Zoom to the extent of the selected features of current (vector) lay er. | /** Zoom to the extent of the selected features of current (vector) lay er. | |||
Added in version 1.2: optionally specify different than current layer */ | Added in version 1.2: optionally specify different than current layer */ | |||
void zoomToSelected( QgsVectorLayer* layer = NULL ); | void zoomToSelected( QgsVectorLayer* layer = NULL ); | |||
/** Pan to the selected features of current (vector) layer keeping same extent. | /** Pan to the selected features of current (vector) layer keeping same extent. | |||
skipping to change at line 185 | skipping to change at line 183 | |||
void unsetMapTool( QgsMapTool* mapTool ); | void unsetMapTool( QgsMapTool* mapTool ); | |||
/**Returns the currently active tool*/ | /**Returns the currently active tool*/ | |||
QgsMapTool* mapTool(); | QgsMapTool* mapTool(); | |||
/** Write property of QColor bgColor. */ | /** Write property of QColor bgColor. */ | |||
virtual void setCanvasColor( const QColor & _newVal ); | virtual void setCanvasColor( const QColor & _newVal ); | |||
/** Read property of QColor bgColor. */ | /** Read property of QColor bgColor. */ | |||
virtual QColor canvasColor() const; | virtual QColor canvasColor() const; | |||
/** Emits signal scalChanged to update scale in main window */ | /** Emits signal scaleChanged to update scale in main window */ | |||
void updateScale(); | void updateScale(); | |||
/** Updates the full extent */ | /** Updates the full extent */ | |||
void updateFullExtent(); | void updateFullExtent(); | |||
//! return the map layer at position index in the layer stack | //! return the map layer at position index in the layer stack | |||
QgsMapLayer *layer( int index ); | QgsMapLayer *layer( int index ); | |||
//! return number of layers on the map | //! return number of layers on the map | |||
int layerCount() const; | int layerCount() const; | |||
skipping to change at line 317 | skipping to change at line 315 | |||
private slots: | private slots: | |||
//! called when current maptool is destroyed | //! called when current maptool is destroyed | |||
void mapToolDestroyed(); | void mapToolDestroyed(); | |||
signals: | signals: | |||
/** Let the owner know how far we are with render operations */ | /** Let the owner know how far we are with render operations */ | |||
void setProgress( int, int ); | void setProgress( int, int ); | |||
/** emits current mouse position | /** emits current mouse position | |||
\note changed in 1.3 */ | \note changed in 1.3 */ | |||
void xyCoordinates( const QgsPoint & p ); | void xyCoordinates( const QgsPoint &p ); | |||
//! Emitted when the scale of the map changes | //! Emitted when the scale of the map changes | |||
void scaleChanged( double ); | void scaleChanged( double ); | |||
//! Emitted when the extents of the map change | //! Emitted when the extents of the map change | |||
void extentsChanged(); | void extentsChanged(); | |||
/** Emitted when the canvas has rendered. | /** Emitted when the canvas has rendered. | |||
Passes a pointer to the painter on which the map was drawn. This is | Passes a pointer to the painter on which the map was drawn. This is | |||
useful for plugins that wish to draw on the map after it has been | useful for plugins that wish to draw on the map after it has been | |||
rendered. Passing the painter allows plugins to work when the map is | rendered. Passing the painter allows plugins to work when the map is | |||
being rendered onto a pixmap other than the mapCanvas own pixmap membe r. | being rendered onto a pixmap other than the mapCanvas own pixmap membe r. | |||
*/ | */ | |||
void renderComplete( QPainter * ); | void renderComplete( QPainter * ); | |||
/** Emitted when canvas finished a refresh request. | ||||
\note Added in 2.0 */ | ||||
void mapCanvasRefreshed(); | ||||
/** Emitted when the canvas is about to be rendered. | /** Emitted when the canvas is about to be rendered. | |||
\note Added in 1.5 */ | \note Added in 1.5 */ | |||
void renderStarting(); | void renderStarting(); | |||
//! Emitted when a new set of layers has been received | //! Emitted when a new set of layers has been received | |||
void layersChanged(); | void layersChanged(); | |||
//! Emit key press event | //! Emit key press event | |||
void keyPressed( QKeyEvent * e ); | void keyPressed( QKeyEvent * e ); | |||
//! Emit key release event | //! Emit key release event | |||
void keyReleased( QKeyEvent * e ); | void keyReleased( QKeyEvent * e ); | |||
//! Emit map tool changed event | //! Emit map tool changed event | |||
void mapToolSet( QgsMapTool * tool ); | void mapToolSet( QgsMapTool *tool ); | |||
//! Emitted when selection in any layer gets changed | //! Emitted when selection in any layer gets changed | |||
void selectionChanged( QgsMapLayer * layer ); | void selectionChanged( QgsMapLayer * layer ); | |||
//! Emitted when zoom last status changed | //! Emitted when zoom last status changed | |||
//! @note: this signal was added in version 1.4 | //! @note: this signal was added in version 1.4 | |||
void zoomLastStatusChanged( bool ); | void zoomLastStatusChanged( bool ); | |||
//! Emitted when zoom next status changed | //! Emitted when zoom next status changed | |||
//! @note: this signal was added in version 1.4 | //! @note: this signal was added in version 1.4 | |||
skipping to change at line 432 | skipping to change at line 434 | |||
//! all map rendering is done in this class | //! all map rendering is done in this class | |||
QgsMapRenderer* mMapRenderer; | QgsMapRenderer* mMapRenderer; | |||
//! owns pixmap with rendered map and controls rendering | //! owns pixmap with rendered map and controls rendering | |||
QgsMapCanvasMap* mMap; | QgsMapCanvasMap* mMap; | |||
//! map overview widget - it's controlled by QgsMapCanvas | //! map overview widget - it's controlled by QgsMapCanvas | |||
QgsMapOverviewCanvas* mMapOverview; | QgsMapOverviewCanvas* mMapOverview; | |||
//! If backbuffering is currently enabled | ||||
bool mBackbufferEnabled; | ||||
//! Flag indicating a map refresh is in progress | //! Flag indicating a map refresh is in progress | |||
bool mDrawing; | bool mDrawing; | |||
//! Flag indicating if the map canvas is frozen. | //! Flag indicating if the map canvas is frozen. | |||
bool mFrozen; | bool mFrozen; | |||
/*! \brief Flag to track the state of the Map canvas. | /*! \brief Flag to track the state of the Map canvas. | |||
* | * | |||
* The canvas is | * The canvas is | |||
* flagged as dirty by any operation that changes the state of | * flagged as dirty by any operation that changes the state of | |||
End of changes. 9 change blocks. | ||||
9 lines changed or deleted | 13 lines changed or added | |||
qgsmapcanvasmap.h | qgsmapcanvasmap.h | |||
---|---|---|---|---|
skipping to change at line 51 | skipping to change at line 51 | |||
void useImageToRender( bool flag ) { mUseQImageToRender = flag; } | void useImageToRender( bool flag ) { mUseQImageToRender = flag; } | |||
//! renders map using QgsMapRenderer to mPixmap | //! renders map using QgsMapRenderer to mPixmap | |||
void render(); | void render(); | |||
void setBackgroundColor( const QColor& color ) { mBgColor = color; } | void setBackgroundColor( const QColor& color ) { mBgColor = color; } | |||
void setPanningOffset( const QPoint& point ); | void setPanningOffset( const QPoint& point ); | |||
//! @deprecated Please use paintDevice() function which is also save in | ||||
case QImage is used | ||||
Q_DECL_DEPRECATED QPixmap& pixmap() { return mPixmap; } | ||||
QPaintDevice& paintDevice(); | QPaintDevice& paintDevice(); | |||
void paint( QPainter* p, const QStyleOptionGraphicsItem*, QWidget* ); | void paint( QPainter* p, const QStyleOptionGraphicsItem*, QWidget* ); | |||
QRectF boundingRect() const; | QRectF boundingRect() const; | |||
//! Update contents - can be called while drawing to show the status. | //! Update contents - can be called while drawing to show the status. | |||
//! Added in version 1.2 | //! Added in version 1.2 | |||
void updateContents(); | void updateContents(); | |||
End of changes. 1 change blocks. | ||||
4 lines changed or deleted | 0 lines changed or added | |||
qgsmaplayer.h | qgsmaplayer.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
#ifndef QGSMAPLAYER_H | #ifndef QGSMAPLAYER_H | |||
#define QGSMAPLAYER_H | #define QGSMAPLAYER_H | |||
#include <QDateTime> | #include <QDateTime> | |||
#include <QObject> | #include <QObject> | |||
#include <QUndoStack> | #include <QUndoStack> | |||
#include <QVariant> | #include <QVariant> | |||
#include <QImage> | #include <QImage> | |||
#include <QDomNode> | #include <QDomNode> | |||
#include <QPainter> | ||||
#include "qgis.h" | #include "qgis.h" | |||
#include "qgserror.h" | ||||
#include "qgsrectangle.h" | #include "qgsrectangle.h" | |||
#include "qgsmaprenderer.h" | ||||
class QgsRenderContext; | class QgsRenderContext; | |||
class QgsCoordinateReferenceSystem; | class QgsCoordinateReferenceSystem; | |||
class QDomDocument; | class QDomDocument; | |||
class QKeyEvent; | class QKeyEvent; | |||
class QPainter; | class QPainter; | |||
/** \ingroup core | /** \ingroup core | |||
* Base class for all map layer types. | * Base class for all map layer types. | |||
skipping to change at line 72 | skipping to change at line 75 | |||
/** Destructor */ | /** Destructor */ | |||
virtual ~QgsMapLayer(); | virtual ~QgsMapLayer(); | |||
/** Get the type of the layer | /** Get the type of the layer | |||
* @return Integer matching a value in the QgsMapLayer::LayerType enum | * @return Integer matching a value in the QgsMapLayer::LayerType enum | |||
*/ | */ | |||
QgsMapLayer::LayerType type() const; | QgsMapLayer::LayerType type() const; | |||
/** Get this layer's unique ID, this ID is used to access this layer fr om map layer registry | /** Get this layer's unique ID, this ID is used to access this layer fr om map layer registry | |||
* @note added in 1.7 | * @note added in 1.7 | |||
**/ | */ | |||
QString id() const; | QString id() const; | |||
/** Get this layer's unique ID, this ID is used to access this layer fr | ||||
om map layer registry | ||||
* @deprecated use id() | ||||
**/ | ||||
Q_DECL_DEPRECATED QString getLayerID() const { return id(); } | ||||
/** Set the display name of the layer | /** Set the display name of the layer | |||
* @param name New name for the layer | * @param name New name for the layer | |||
*/ | */ | |||
void setLayerName( const QString & name ); | void setLayerName( const QString & name ); | |||
/** Get the display name of the layer | /** Get the display name of the layer | |||
* @return the layer name | * @return the layer name | |||
*/ | */ | |||
QString const & name() const; | const QString & name() const; | |||
/** Get the original name of the layer | ||||
* @note added in 1.9 | ||||
*/ | ||||
const QString & originalName() const { return mLayerOrigName; } | ||||
void setTitle( const QString& title ) { mTitle = title; } | void setTitle( const QString& title ) { mTitle = title; } | |||
const QString& title() const { return mTitle; } | const QString& title() const { return mTitle; } | |||
void setAbstract( const QString& abstract ) { mAbstract = abstract; } | void setAbstract( const QString& abstract ) { mAbstract = abstract; } | |||
const QString& abstract() const { return mAbstract; } | const QString& abstract() const { return mAbstract; } | |||
void setKeywordList( const QString& keywords ) { mKeywordList = keyword | ||||
s; } | ||||
const QString& keywordList() const { return mKeywordList; } | ||||
/* Layer dataUrl information */ | ||||
void setDataUrl( const QString& dataUrl ) { mDataUrl = dataUrl; } | ||||
const QString& dataUrl() const { return mDataUrl; } | ||||
void setDataUrlFormat( const QString& dataUrlFormat ) { mDataUrlFormat | ||||
= dataUrlFormat; } | ||||
const QString& dataUrlFormat() const { return mDataUrlFormat; } | ||||
/* Layer attribution information */ | ||||
void setAttribution( const QString& attrib ) { mAttribution = attrib; } | ||||
const QString& attribution() const { return mAttribution; } | ||||
void setAttributionUrl( const QString& attribUrl ) { mAttributionUrl = | ||||
attribUrl; } | ||||
const QString& attributionUrl() const { return mAttributionUrl; } | ||||
/* Layer metadataUrl information */ | ||||
void setMetadataUrl( const QString& metaUrl ) { mMetadataUrl = metaUrl; | ||||
} | ||||
const QString& metadataUrl() const { return mMetadataUrl; } | ||||
void setMetadataUrlType( const QString& metaUrlType ) { mMetadataUrlTyp | ||||
e = metaUrlType; } | ||||
const QString& metadataUrlType() const { return mMetadataUrlType; } | ||||
void setMetadataUrlFormat( const QString& metaUrlFormat ) { mMetadataUr | ||||
lFormat = metaUrlFormat; } | ||||
const QString& metadataUrlFormat() const { return mMetadataUrlFormat; } | ||||
/* Set the blending mode used for rendering a layer */ | ||||
void setBlendMode( const QPainter::CompositionMode blendMode ); | ||||
/* Returns the current blending mode for a layer */ | ||||
QPainter::CompositionMode blendMode() const; | ||||
/**Synchronises with changes in the datasource | /**Synchronises with changes in the datasource | |||
@note added in version 1.6*/ | @note added in version 1.6*/ | |||
virtual void reload() {} | virtual void reload() {} | |||
/** This is the method that does the actual work of | /** This is the method that does the actual work of | |||
* drawing the layer onto a paint device. | * drawing the layer onto a paint device. | |||
* @param rendererContext describes the extents, | * @param rendererContext describes the extents, | |||
* resolumon etc. that should be used when rendering the | * resolumon etc. that should be used when rendering the | |||
* layer. | * layer. | |||
*/ | */ | |||
virtual bool draw( QgsRenderContext& rendererContext ); | virtual bool draw( QgsRenderContext& rendererContext ); | |||
/** Draw labels | /** Draw labels | |||
* @todo to be removed: used only in vector layers | * @todo to be removed: used only in vector layers | |||
*/ | */ | |||
virtual void drawLabels( QgsRenderContext& rendererContext ); | virtual void drawLabels( QgsRenderContext& rendererContext ); | |||
/** Return the extent of the layer as a QRect */ | /** Return the extent of the layer */ | |||
QgsRectangle extent() const; | virtual QgsRectangle extent(); | |||
/*! Return the status of the layer. An invalid layer is one which has a bad datasource | /*! 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 | * or other problem. Child classes set this flag when intialized | |||
* @return True if the layer is valid and can be accessed | * @return True if the layer is valid and can be accessed | |||
*/ | */ | |||
bool isValid(); | bool isValid(); | |||
/*! Gets a version of the internal layer definition that has sensitive | /*! Gets a version of the internal layer definition that has sensitive | |||
* bits removed (for example, the password). This function should | * bits removed (for example, the password). This function should | |||
* be used when displaying the source name for general viewing. | * be used when displaying the source name for general viewing. | |||
*/ | */ | |||
QString publicSource() const; | QString publicSource() const; | |||
/** Returns the source for the layer */ | /** Returns the source for the layer */ | |||
QString const & source() const; | const QString &source() const; | |||
/** | /** | |||
* Returns the sublayers of this layer | * Returns the sublayers of this layer | |||
* (Useful for providers that manage their own layers, such as WMS) | * (Useful for providers that manage their own layers, such as WMS) | |||
*/ | */ | |||
virtual QStringList subLayers() const; | virtual QStringList subLayers() const; | |||
/** | /** | |||
* Reorders the *previously selected* sublayers of this layer from bott om to top | * Reorders the *previously selected* sublayers of this layer from bott om to top | |||
* (Useful for providers that manage their own layers, such as WMS) | * (Useful for providers that manage their own layers, such as WMS) | |||
*/ | */ | |||
virtual void setLayerOrder( const QStringList &layers ); | virtual void setLayerOrder( const QStringList &layers ); | |||
/** Set the visibility of the given sublayer name */ | /** Set the visibility of the given sublayer name */ | |||
virtual void setSubLayerVisibility( QString name, bool vis ); | virtual void setSubLayerVisibility( QString name, bool vis ); | |||
/** True if the layer can be edited */ | /** True if the layer can be edited */ | |||
virtual bool isEditable() const; | virtual bool isEditable() const; | |||
/** sets state from Dom document | /** sets state from Dom document | |||
@param layer_node is Dom node corresponding to ``maplayer'' tag | @param layerElement The Dom element corresponding to ``maplayer'' ta g | |||
@note | @note | |||
The Dom node corresponds to a Dom document project file XML element read | The Dom node corresponds to a Dom document project file XML element read | |||
by QgsProject. | by QgsProject. | |||
This, in turn, calls readXml(), which is over-rideable by sub-classe s so | This, in turn, calls readXml(), which is over-rideable by sub-classe s so | |||
that they can read their own specific state from the given Dom node. | that they can read their own specific state from the given Dom node. | |||
Invoked by QgsProject::read(). | Invoked by QgsProject::read(). | |||
@returns true if successful | @returns true if successful | |||
*/ | */ | |||
bool readXML( const QDomNode& layer_node ); | bool readLayerXML( const QDomElement& layerElement ); | |||
/** stores state in Dom node | /** stores state in Dom node | |||
@param layer_node is Dom node corresponding to ``projectlayers'' tag | @param layerElement is a Dom element corresponding to ``maplayer'' t | |||
@param document is Dom document | ag | |||
@param document is a the dom document being written | ||||
@note | @note | |||
The Dom node corresponds to a Dom document project file XML element to be | The Dom node corresponds to a Dom document project file XML element to be | |||
written by QgsProject. | written by QgsProject. | |||
This, in turn, calls writeXml(), which is over-rideable by sub-class es so | This, in turn, calls writeXml(), which is over-rideable by sub-class es so | |||
that they can write their own specific state to the given Dom node. | that they can write their own specific state to the given Dom node. | |||
Invoked by QgsProject::write(). | Invoked by QgsProject::write(). | |||
@returns true if successful | @returns true if successful | |||
*/ | */ | |||
bool writeXML( QDomNode & layer_node, QDomDocument & document ); | bool writeLayerXML( QDomElement& layerElement, QDomDocument& document ) ; | |||
/** Set a custom property for layer. Properties are stored in a map and saved in project file. | /** Set a custom property for layer. Properties are stored in a map and saved in project file. | |||
* @note Added in v1.4 */ | * @note Added in v1.4 */ | |||
void setCustomProperty( const QString& key, const QVariant& value ); | void setCustomProperty( const QString& key, const QVariant& value ); | |||
/** Read a custom property from layer. Properties are stored in a map a nd saved in project file. | /** Read a custom property from layer. Properties are stored in a map a nd saved in project file. | |||
* @note Added in v1.4 */ | * @note Added in v1.4 */ | |||
QVariant customProperty( const QString& value, const QVariant& defaultV alue = QVariant() ) const; | QVariant customProperty( const QString& value, const QVariant& defaultV alue = QVariant() ) const; | |||
/** Remove a custom property from layer. Properties are stored in a map and saved in project file. | /** Remove a custom property from layer. Properties are stored in a map and saved in project file. | |||
* @note Added in v1.4 */ | * @note Added in v1.4 */ | |||
void removeCustomProperty( const QString& key ); | void removeCustomProperty( const QString& key ); | |||
/** Copies the symbology settings from another layer. Returns true in c | ||||
ase of success */ | ||||
virtual bool copySymbologySettings( const QgsMapLayer& other ) = 0; | ||||
/** Returns true if this layer can be in the same symbology group with | ||||
another layer */ | ||||
virtual bool hasCompatibleSymbology( const QgsMapLayer& other ) const = | ||||
0; | ||||
/** Accessor for transparency level. */ | ||||
unsigned int getTransparency(); | ||||
/** Mutator for transparency level. Should be between 0 and 255 */ | ||||
void setTransparency( unsigned int ); | ||||
/** | /** | |||
* If an operation returns 0 (e.g. draw()), this function | * If an operation returns 0 (e.g. draw()), this function | |||
* returns the text of the error associated with the failure. | * returns the text of the error associated with the failure. | |||
* Interactive users of this provider can then, for example, | * Interactive users of this provider can then, for example, | |||
* call a QMessageBox to display the contents. | * call a QMessageBox to display the contents. | |||
*/ | */ | |||
virtual QString lastErrorTitle(); | virtual QString lastErrorTitle(); | |||
/** | /** | |||
* If an operation returns 0 (e.g. draw()), this function | * If an operation returns 0 (e.g. draw()), this function | |||
* returns the text of the error associated with the failure. | * returns the text of the error associated with the failure. | |||
* Interactive users of this provider can then, for example, | * Interactive users of this provider can then, for example, | |||
* call a QMessageBox to display the contents. | * call a QMessageBox to display the contents. | |||
*/ | */ | |||
virtual QString lastError(); | virtual QString lastError(); | |||
/** Get current status error. This error describes some principal probl | ||||
em | ||||
* for which layer cannot work and thus is not valid. It is not last e | ||||
rror | ||||
* after accessing data by draw() etc. | ||||
*/ | ||||
virtual QgsError error() const { return mError; } | ||||
/** Returns layer's spatial reference system | /** Returns layer's spatial reference system | |||
@note This was introduced in QGIS 1.4 | @note This was introduced in QGIS 1.4 | |||
*/ | */ | |||
const QgsCoordinateReferenceSystem& crs() const; | const QgsCoordinateReferenceSystem& crs() const; | |||
/** Returns layer's spatial reference system | ||||
@note This method is here for API compatibility | ||||
and will be deprecated in 2.0 | ||||
@deprecated use crs() | ||||
*/ | ||||
Q_DECL_DEPRECATED const QgsCoordinateReferenceSystem& srs(); | ||||
/** Sets layer's spatial reference system | /** Sets layer's spatial reference system | |||
@note emitSignal added in 1.4 */ | @note emitSignal added in 1.4 */ | |||
void setCrs( const QgsCoordinateReferenceSystem& srs, bool emitSignal = true ); | void setCrs( const QgsCoordinateReferenceSystem& srs, bool emitSignal = true ); | |||
/** A convenience function to capitalise the layer name */ | /** A convenience function to (un)capitalise the layer name */ | |||
static QString capitaliseLayerName( const QString name ); | static QString capitaliseLayerName( const QString& name ); | |||
/** Retrieve the style URI for this layer | /** Retrieve the style URI for this layer | |||
* (either as a .qml file on disk or as a | * (either as a .qml file on disk or as a | |||
* record in the users style table in their personal qgis.db) | * record in the users style table in their personal qgis.db) | |||
* @return a QString withe the style file name | * @return a QString with the style file name | |||
* @see also loadNamedStyle () and saveNamedStyle (); | * @see also loadNamedStyle () and saveNamedStyle (); | |||
* @note This method was added in QGIS 1.8 | * @note This method was added in QGIS 1.8 | |||
*/ | */ | |||
virtual QString styleURI( ); | virtual QString styleURI( ); | |||
/** Retrieve the default style for this layer if one | /** Retrieve the default style for this layer if one | |||
* exists (either as a .qml file on disk or as a | * exists (either as a .qml file on disk or as a | |||
* record in the users style table in their personal qgis.db) | * record in the users style table in their personal qgis.db) | |||
* @param theResultFlag a reference to a flag that will be set to false if | * @param theResultFlag a reference to a flag that will be set to false if | |||
* we did not manage to load the default style. | * we did not manage to load the default style. | |||
skipping to change at line 275 | skipping to change at line 293 | |||
* key matches the URI. | * key matches the URI. | |||
* @param theResultFlag a reference to a flag that will be set to false if | * @param theResultFlag a reference to a flag that will be set to false if | |||
* we did not manage to load the default style. | * we did not manage to load the default style. | |||
* @return a QString with any status messages | * @return a QString with any status messages | |||
* @see also loadDefaultStyle (); | * @see also loadDefaultStyle (); | |||
*/ | */ | |||
virtual QString loadNamedStyle( const QString theURI, bool & theResultF lag ); | virtual QString loadNamedStyle( const QString theURI, bool & theResultF lag ); | |||
virtual bool loadNamedStyleFromDb( const QString db, const QString theU RI, QString &qml ); | virtual bool loadNamedStyleFromDb( const QString db, const QString theU RI, QString &qml ); | |||
//TODO edit infos | ||||
/** | ||||
* Export the properties of this layer as named style in a QDomDocument | ||||
* @param doc the target QDomDocument | ||||
* @param errorMsg this QString will be initialized on error | ||||
* during the execution of writeSymbology | ||||
*/ | ||||
virtual void exportNamedStyle( QDomDocument &doc, QString &errorMsg ); | ||||
/** | ||||
* Export the properties of this layer as SLD style in a QDomDocument | ||||
* @param doc the target QDomDocument | ||||
* @param errorMsg this QString will be initialized on error | ||||
* during the execution of writeSymbology | ||||
*/ | ||||
virtual void exportSldStyle( QDomDocument &doc, QString &errorMsg ); | ||||
/** Save the properties of this layer as the default style | /** Save the properties of this layer as the default style | |||
* (either as a .qml file on disk or as a | * (either as a .qml file on disk or as a | |||
* record in the users style table in their personal qgis.db) | * record in the users style table in their personal qgis.db) | |||
* @param theResultFlag a reference to a flag that will be set to false if | * @param theResultFlag a reference to a flag that will be set to false if | |||
* we did not manage to save the default style. | * we did not manage to save the default style. | |||
* @return a QString with any status messages | * @return a QString with any status messages | |||
* @sa loadNamedStyle() and @see saveNamedStyle() | * @sa loadNamedStyle() and @see saveNamedStyle() | |||
*/ | */ | |||
virtual QString saveDefaultStyle( bool & theResultFlag ); | virtual QString saveDefaultStyle( bool & theResultFlag ); | |||
skipping to change at line 326 | skipping to change at line 361 | |||
* @param errorMessage reference to string that will be updated with a ny error messages | * @param errorMessage reference to string that will be updated with a ny error messages | |||
* @return true in case of success. | * @return true in case of success. | |||
*/ | */ | |||
virtual bool writeSymbology( QDomNode &node, QDomDocument& doc, QString & errorMessage ) const = 0; | virtual bool writeSymbology( QDomNode &node, QDomDocument& doc, QString & errorMessage ) const = 0; | |||
/** Return pointer to layer's undo stack */ | /** Return pointer to layer's undo stack */ | |||
QUndoStack* undoStack(); | QUndoStack* undoStack(); | |||
/** Get the QImage used for caching render operations | /** Get the QImage used for caching render operations | |||
* @note This method was added in QGIS 1.4 **/ | * @note This method was added in QGIS 1.4 **/ | |||
QImage * cacheImage() { return mpCacheImage; } | QImage *cacheImage() { return mpCacheImage; } | |||
/** Set the QImage used for caching render operations | /** Set the QImage used for caching render operations | |||
* @note This method was added in QGIS 1.4 **/ | * @note This method was added in QGIS 1.4 **/ | |||
void setCacheImage( QImage * thepImage ); | void setCacheImage( QImage * thepImage ); | |||
/** | ||||
* @brief Is called when the cache image is being deleted. Overwrite an | ||||
d use to clean up. | ||||
* @note added in 2.0 | ||||
*/ | ||||
virtual void onCacheImageDelete() {} | ||||
public slots: | public slots: | |||
/** Event handler for when a coordinate transform fails due to bad vert ex error */ | /** Event handler for when a coordinate transform fails due to bad vert ex error */ | |||
virtual void invalidTransformInput(); | virtual void invalidTransformInput(); | |||
/** Accessor and mutator for the minimum scale member */ | /** Accessor and mutator for the minimum scale denominator member */ | |||
void setMinimumScale( float theMinScale ); | void setMinimumScale( float theMinScale ); | |||
float minimumScale(); | float minimumScale(); | |||
/** Accessor and mutator for the maximum scale member */ | /** Accessor and mutator for the maximum scale denominator member */ | |||
void setMaximumScale( float theMaxScale ); | void setMaximumScale( float theMaxScale ); | |||
float maximumScale(); | float maximumScale(); | |||
/** Accessor and mutator for the scale based visilibility flag */ | /** Accessor and mutator for the scale based visilibility flag */ | |||
void toggleScaleBasedVisibility( bool theVisibilityFlag ); | void toggleScaleBasedVisibility( bool theVisibilityFlag ); | |||
bool hasScaleBasedVisibility(); | bool hasScaleBasedVisibility(); | |||
/** Clear cached image | /** Clear cached image | |||
* added in 1.5 */ | * added in 1.5 */ | |||
void clearCacheImage(); | void clearCacheImage(); | |||
skipping to change at line 391 | skipping to change at line 432 | |||
void screenUpdateRequested(); | void screenUpdateRequested(); | |||
/** This is used to send a request that any mapcanvas using this layer update its extents */ | /** This is used to send a request that any mapcanvas using this layer update its extents */ | |||
void recalculateExtents(); | void recalculateExtents(); | |||
/** data of layer changed | /** data of layer changed | |||
* added in 1.5 */ | * added in 1.5 */ | |||
void dataChanged(); | void dataChanged(); | |||
protected: | protected: | |||
/** Set the extent */ | ||||
virtual void setExtent( const QgsRectangle &rect ); | ||||
/** set whether layer is valid or not - should be used in constructor. | /** set whether layer is valid or not - should be used in constructor. | |||
\note added in v1.5 */ | \note added in v1.5 */ | |||
void setValid( bool valid ); | void setValid( bool valid ); | |||
/** called by readXML(), used by children to read state specific to the m from | /** called by readLayerXML(), used by children to read state specific t o them from | |||
project files. | project files. | |||
*/ | */ | |||
virtual bool readXml( const QDomNode& layer_node ); | virtual bool readXml( const QDomNode& layer_node ); | |||
/** called by writeXML(), used by children to write state specific to t hem to | /** called by writeLayerXML(), used by children to write state specific to them to | |||
project files. | project files. | |||
*/ | */ | |||
virtual bool writeXml( QDomNode & layer_node, QDomDocument & document ) ; | virtual bool writeXml( QDomNode & layer_node, QDomDocument & document ) ; | |||
/** Read custom properties from project file. Added in v1.4 | /** Read custom properties from project file. Added in v1.4 | |||
@param layerNode note to read from | @param layerNode note to read from | |||
@param keyStartsWith reads only properties starting with the specifie d string (or all if the string is empty)*/ | @param keyStartsWith reads only properties starting with the specifie d string (or all if the string is empty)*/ | |||
void readCustomProperties( const QDomNode& layerNode, const QString& ke yStartsWith = "" ); | void readCustomProperties( const QDomNode& layerNode, const QString& ke yStartsWith = "" ); | |||
/** Write custom properties to project file. Added in v1.4 */ | /** Write custom properties to project file. Added in v1.4 */ | |||
void writeCustomProperties( QDomNode & layerNode, QDomDocument & doc ) const; | void writeCustomProperties( QDomNode & layerNode, QDomDocument & doc ) const; | |||
/** debugging member - invoked when a connect() is made to this object */ | /** debugging member - invoked when a connect() is made to this object */ | |||
void connectNotify( const char * signal ); | void connectNotify( const char * signal ); | |||
/** Add error message */ | ||||
void appendError( const QgsErrorMessage & theMessage ) { mError.append( | ||||
theMessage );} | ||||
/** Set error message */ | ||||
void setError( const QgsError & theError ) { mError = theError;} | ||||
/** Transparency level for this layer should be 0-255 (255 being opaque ) */ | /** Transparency level for this layer should be 0-255 (255 being opaque ) */ | |||
unsigned int mTransparencyLevel; | unsigned int mTransparencyLevel; | |||
/** Extent of the layer */ | /** Extent of the layer */ | |||
QgsRectangle mLayerExtent; | QgsRectangle mExtent; | |||
/** Indicates if the layer is valid and can be drawn */ | /** Indicates if the layer is valid and can be drawn */ | |||
bool mValid; | bool mValid; | |||
/** data source description string, varies by layer type */ | /** data source description string, varies by layer type */ | |||
QString mDataSource; | QString mDataSource; | |||
/** Name of the layer - used for display */ | /** Name of the layer - used for display */ | |||
QString mLayerName; | QString mLayerName; | |||
/** Original name of the layer | ||||
* @note added in 1.9 | ||||
*/ | ||||
QString mLayerOrigName; | ||||
QString mTitle; | QString mTitle; | |||
/**Description of the layer*/ | /**Description of the layer*/ | |||
QString mAbstract; | QString mAbstract; | |||
QString mKeywordList; | ||||
/**DataUrl of the layer*/ | ||||
QString mDataUrl; | ||||
QString mDataUrlFormat; | ||||
/**Attribution of the layer*/ | ||||
QString mAttribution; | ||||
QString mAttributionUrl; | ||||
/**MetadataUrl of the layer*/ | ||||
QString mMetadataUrl; | ||||
QString mMetadataUrlType; | ||||
QString mMetadataUrlFormat; | ||||
/** \brief Error */ | ||||
QgsError mError; | ||||
private: | private: | |||
/** layer's spatial reference system. | /** layer's spatial reference system. | |||
private to make sure setCrs must be used and layerCrsChanged() is e mitted */ | private to make sure setCrs must be used and layerCrsChanged() is e mitted */ | |||
QgsCoordinateReferenceSystem* mCRS; | QgsCoordinateReferenceSystem* mCRS; | |||
/** private copy constructor - QgsMapLayer not copyable */ | /** private copy constructor - QgsMapLayer not copyable */ | |||
QgsMapLayer( QgsMapLayer const & ); | QgsMapLayer( QgsMapLayer const & ); | |||
/** private assign operator - QgsMapLayer not copyable */ | /** private assign operator - QgsMapLayer not copyable */ | |||
QgsMapLayer & operator=( QgsMapLayer const & ); | QgsMapLayer & operator=( QgsMapLayer const & ); | |||
/** Unique ID of this layer - used to refer to this layer in map layer registry */ | /** Unique ID of this layer - used to refer to this layer in map layer registry */ | |||
QString mID; | QString mID; | |||
/** Type of the layer (eg. vector, raster) */ | /** Type of the layer (eg. vector, raster) */ | |||
QgsMapLayer::LayerType mLayerType; | QgsMapLayer::LayerType mLayerType; | |||
/** Blend mode for the layer */ | ||||
QPainter::CompositionMode mBlendMode; | ||||
/** Tag for embedding additional information */ | /** Tag for embedding additional information */ | |||
QString mTag; | QString mTag; | |||
/** Minimum scale at which this layer should be displayed */ | /** Minimum scale denominator at which this layer should be displayed * / | |||
float mMinScale; | float mMinScale; | |||
/** Maximum scale at which this layer should be displayed */ | /** Maximum scale denominator at which this layer should be displayed * / | |||
float mMaxScale; | float mMaxScale; | |||
/** A flag that tells us whether to use the above vars to restrict laye r visibility */ | /** A flag that tells us whether to use the above vars to restrict laye r visibility */ | |||
bool mScaleBasedVisibility; | bool mScaleBasedVisibility; | |||
/** Collection of undoable operations for this layer. **/ | /** Collection of undoable operations for this layer. **/ | |||
QUndoStack mUndoStack; | QUndoStack mUndoStack; | |||
QMap<QString, QVariant> mCustomProperties; | QMap<QString, QVariant> mCustomProperties; | |||
/**QImage for caching of rendering operations | /**QImage for caching of rendering operations | |||
End of changes. 33 change blocks. | ||||
49 lines changed or deleted | 129 lines changed or added | |||
qgsmaplayerregistry.h | qgsmaplayerregistry.h | |||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
* it under the terms of the GNU General Public License as published by * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSMAPLAYERREGISTRY_H | #ifndef QGSMAPLAYERREGISTRY_H | |||
#define QGSMAPLAYERREGISTRY_H | #define QGSMAPLAYERREGISTRY_H | |||
#include <QMap> | #include <QMap> | |||
#include <QSet> | ||||
#include <QObject> | #include <QObject> | |||
#include <QStringList> | #include <QStringList> | |||
class QString; | class QString; | |||
class QgsMapLayer; | class QgsMapLayer; | |||
/** \ingroup core | /** \ingroup core | |||
* This class tracks map layers that are currently loaded and provides | * This class tracks map layers that are currently loaded and provides | |||
* a means to fetch a pointer to a map layer and delete it. | * a means to fetch a pointer to a map layer and delete it. | |||
*/ | */ | |||
class CORE_EXPORT QgsMapLayerRegistry : public QObject | class CORE_EXPORT QgsMapLayerRegistry : public QObject | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
//! Returns the instance pointer, creating the object on the first call | ||||
//! Returns the instance pointer, creating the object on the first call | ||||
static QgsMapLayerRegistry * instance(); | static QgsMapLayerRegistry * instance(); | |||
/*! Return the number of registered layers. | ||||
* | //! Return the number of registered layers. | |||
* */ | ||||
int count(); | int count(); | |||
~QgsMapLayerRegistry(); | ~QgsMapLayerRegistry(); | |||
//! Retrieve a pointer to a loaded layer by id | //! Retrieve a pointer to a loaded layer by id | |||
QgsMapLayer * mapLayer( QString theLayerId ); | QgsMapLayer *mapLayer( QString theLayerId ); | |||
//! Retrieve the mapLayers collection (mainly intended for use by proje | ||||
ctio) | ||||
QMap<QString, QgsMapLayer*> & mapLayers(); | ||||
/** Add a layer to the map of loaded layers | ||||
@returns NULL if unable to add layer, otherwise pointer to newly add | ||||
ed layer | ||||
@note | ||||
As a side-effect QgsProject is made dirty. | //! Retrieve a pointer to a loaded layer by name | |||
QList<QgsMapLayer *> mapLayersByName( QString layerName ); | ||||
Emits signal that layer has been added only if theEmitSignal is true | //! Retrieve the mapLayers collection (mainly intended for use by proje | |||
(by default). | ction) | |||
const QMap<QString, QgsMapLayer*> & mapLayers(); | ||||
Not emitting signal is useful when you want to use registry for laye | /** | |||
rs | * @brief | |||
on a different canvas and don't want them added to the main canvas a | * Add a list of layers to the map of loaded layers | |||
utomatically. | * | |||
* The layersAdded() and layersWasAdded() signals will be emitted in an | ||||
@note This method is deprecated since QGIS 1.8, you should use addMa | y case. | |||
pLayers rather. | * The legendLayersAdded() signal only if addToLegend is true. | |||
*/ | * | |||
Q_DECL_DEPRECATED QgsMapLayer *addMapLayer( QgsMapLayer * theMapLayer, | * @param theMapLayers A list of layer which should be added to the re | |||
bool theEmitSignal = true ); | gistry | |||
* @param addToLegend If true (by default), the layers will be added | ||||
/** Add a list of layers to the map of loaded layers | to the | |||
@returns QList<QgsMapLayer *> - a list of the map layers that were a | * legend and to the main canvas. If you have a pr | |||
dded | ivate | |||
successfully. If a layer is invalid, or already exists in the regist | * layer, you can set this parameter to false to h | |||
ry, | ide it. | |||
it will not be part of the returned QList. | * @param takeOwnership Ownership will be transferred to the layer regi | |||
@note added in QGIS 1.8 | stry. | |||
* If you specify false here, you have take care o | ||||
As a side-effect QgsProject is made dirty. | f deleting | |||
* the layers yourself. Not available in python. | ||||
If theEmitSignal is true (by default), a layersAdded( QList<QgsMapLa | * | |||
yer *>) | * @return QList<QgsMapLayer *> - a list of the map layers that were ad | |||
signal will be emitted indicating that a batch of layers were added. | ded | |||
Not emitting signal is useful when you want to use registry for laye | * successfully. If a layer is invalid, or already exists in th | |||
rs | e registry, | |||
on a different canvas and don't want them added to the main canvas a | * it will not be part of the returned QList. | |||
utomatically. | * | |||
*/ | * @note As a side-effect QgsProject is made dirty. | |||
* @note Added in QGIS 1.8 | ||||
*/ | ||||
QList<QgsMapLayer *> addMapLayers( QList<QgsMapLayer *> theMapLayers, | QList<QgsMapLayer *> addMapLayers( QList<QgsMapLayer *> theMapLayers, | |||
bool theEmitSignal = true ); | bool addToLegend = true, | |||
bool takeOwnership = true ); | ||||
/** Remove a layer from qgis | ||||
@note As a side-effect QgsProject is made dirty. Any canvases using | ||||
that layer will need to remove it | ||||
If theEmitSignal is true (by default), a layerWillBeRemoved( QString | ||||
theId ) | ||||
signal will be emitted indicating to any listeners that the layer is | ||||
being removed. | ||||
The layer being removed is deleted as well as the registry | ||||
table entry. | ||||
@note This method is deprecated since QGIS 1.8, you should use remov | ||||
eMapLayers rather. | ||||
*/ | ||||
Q_DECL_DEPRECATED void removeMapLayer( QString theLayerId, bool theEmit | ||||
Signal = true ); | ||||
/** Remove a set of layers from qgis | /** | |||
@note As a side-effect QgsProject is made dirty. | * @brief | |||
Any canvases using the affected layers will need to remove them | * Add a layer to the map of loaded layers | |||
* | ||||
* The layersAdded() and layersWasAdded() signals will be emitted in an | ||||
y case. | ||||
* The legendLayersAdded() signal only if addToLegend is true. | ||||
* If you are adding multiple layers at once, you should use | ||||
* {@link addMapLayers()} instead. | ||||
* | ||||
* @param theMapLayer A layer to add to the registry | ||||
* @param addToLegend If true (by default), the layer will be added to | ||||
the | ||||
* legend and to the main canvas. If you have a priv | ||||
ate | ||||
* you can set this parameter to false to hide it. | ||||
* @param takeOwnership Ownership will be transferred to the layer regi | ||||
stry. | ||||
* If you specify false here, you have take care o | ||||
f deleting | ||||
* the layer yourself. Not available in python. | ||||
* | ||||
* @return NULL if unable to add layer, otherwise pointer to newly adde | ||||
d layer | ||||
* | ||||
* @see addMapLayers | ||||
* | ||||
* @note As a side-effect QgsProject is made dirty. | ||||
* @note Use addMapLayers if adding more than one layer at a time | ||||
*/ | ||||
QgsMapLayer* addMapLayer( QgsMapLayer * theMapLayer, bool addToLegend = | ||||
true, bool takeOwnership = true ); | ||||
If theEmitSignal is true (by default), a layersRemoved( QStringList | /** | |||
theLayerIds ) | * @brief | |||
signal will be emitted indicating to any listeners that the layers a | * Remove a set of layers from the registry | |||
re being removed. | * | |||
* Any canvases using the affected layers will need to remove them | ||||
* | ||||
* The layers being removed are deleted as well as the registry | ||||
* table entries. | ||||
* | ||||
* @param theLayerIds The ids of the layers to remove | ||||
* | ||||
* @note As a side-effect QgsProject is made dirty. | ||||
*/ | ||||
void removeMapLayers( QStringList theLayerIds ); | ||||
The layer being removed is deleted as well as the registry | /** | |||
table entry. | * @brief | |||
*/ | * Remove a layer from qgis | |||
void removeMapLayers( QStringList theLayerIds, bool theEmitSignal = tru | * | |||
e ); | * Any canvases using the affected layers will need to remove them | |||
* | ||||
* The layer being removed is deleted as well as the registry | ||||
* table entry. | ||||
* | ||||
* @param theLayerId The id of the layer to remove | ||||
* | ||||
* @note As a side-effect QgsProject is made dirty. | ||||
*/ | ||||
void removeMapLayer( const QString& theLayerId ); | ||||
/** Remove all registered layers | /** | |||
@note raises removedAll() | * Remove all registered layers | |||
As a side-effect QgsProject is made dirty. | * | |||
@note The layers are deleted as the registry is cleared! | * @note As a side-effect QgsProject is made dirty. | |||
*/ | * @note The layers are deleted as the registry is cleared! | |||
*/ | ||||
void removeAllMapLayers(); | void removeAllMapLayers(); | |||
/* Clears all layer caches, resetting them to zero and | /** | |||
* Clears all layer caches, resetting them to zero and | ||||
* freeing up any memory they may have been using. Layer | * freeing up any memory they may have been using. Layer | |||
* caches are used to speed up rendering in certain situations | * caches are used to speed up rendering in certain situations | |||
* see ticket #1974 for more details. | * see ticket #1974 for more details. | |||
* @note this method was added in QGIS 1.4 | * | |||
* @note Added in QGIS 1.4 | ||||
*/ | */ | |||
void clearAllLayerCaches(); | void clearAllLayerCaches(); | |||
/**Reload all provider data caches (currently used for WFS and WMS prov | /** | |||
iders) | * Reload all provider data caches (currently used for WFS and WMS prov | |||
@note: this method was added in QGIS 1.6*/ | iders) | |||
* | ||||
* @note Added in QGIS 1.6 | ||||
*/ | ||||
void reloadAllLayers(); | void reloadAllLayers(); | |||
signals: | signals: | |||
/** | ||||
/** Emitted when one or more layers are removed from the registry | * Emitted when one or more layers are removed from the registry | |||
@note intended to replace layerWillBeRemoved in QGIS 1.8 | * | |||
*/ | * @param theLayerIds A list of ids of the layers which are removed. | |||
*/ | ||||
void layersWillBeRemoved( QStringList theLayerIds ); | void layersWillBeRemoved( QStringList theLayerIds ); | |||
/** emitted when a layer is removed from the registry | /** | |||
connected to main map canvas and overview map canvas remove() | * Emitted when a layer is removed from the registry | |||
@note we should deprecate this at some stage | * | |||
*/ | * @param theLayerId The id of the layer being removed | |||
* | ||||
* @note Consider using {@link layersWillBeRemoved()} instead | ||||
*/ | ||||
void layerWillBeRemoved( QString theLayerId ); | void layerWillBeRemoved( QString theLayerId ); | |||
/** Emitted when one or more layers are added to the registry | /** | |||
@note intended to replace layerWasAdded in QGIS 1.8 | * Emitted after one or more layers were removed from the registry | |||
*/ | * | |||
* @param theLayerIds A list of ids of the layers which were removed. | ||||
*/ | ||||
void layersRemoved( QStringList theLayerIds ); | ||||
/** | ||||
* Emitted after a layer was removed from the registry | ||||
* | ||||
* @param theLayerId The id of the layer removed | ||||
* | ||||
* @note Consider using {@link layersRemoved()} instead | ||||
*/ | ||||
void layerRemoved( QString theLayerId ); | ||||
/** | ||||
* Emitted, when all layers are removed, before {@link layersWillBeRemo | ||||
ved()} and | ||||
* {@link layerWillBeRemoved()} signals are emitted. You will still get | ||||
these signals | ||||
* in any case. | ||||
* You can use this signal to do easy (and fast) cleanup. | ||||
* | ||||
* @note Added in 2.0 | ||||
*/ | ||||
void removeAll(); | ||||
/** | ||||
* Emitted when one or more layers are added to the registry. | ||||
* This signal is also emitted for layers added to the registry, | ||||
* but not to the legend and canvas. | ||||
* | ||||
* @param theMapLayers The layers which have been added | ||||
* | ||||
* @see legendLayersAdded() | ||||
*/ | ||||
void layersAdded( QList<QgsMapLayer *> theMapLayers ); | void layersAdded( QList<QgsMapLayer *> theMapLayers ); | |||
/** emitted when a layer is added to the registry | ||||
connected to main map canvas and overview map canvas addLayer() | ||||
@note we should deprecate this at some stage | ||||
*/ | ||||
void layerWasAdded( QgsMapLayer * theMapLayer ); | ||||
/** emitted when ALL layers are removed at once | /** | |||
This could have been implemented by iteratively signalling | * Emitted when a layer is added to the registry. | |||
layerWillBeRemoved() for each layer as it is removed. However, this | * | |||
generally causes a cascade of effects that are unnecessary if we're | * @param theMapLayer The id of the layer which has been added | |||
ultimately removing all layers. E.g., removing the legend item | * | |||
corresponding to the layer. Why bother doing that when you're just | * @note Consider using {@link layersAdded()} instead | |||
going | ||||
to clear everything anyway? | ||||
*/ | */ | |||
void removedAll(); | void layerWasAdded( QgsMapLayer* theMapLayer ); | |||
protected: | /** | |||
* Emitted, when a layer is added to the registry and the legend. | ||||
* Plugins are allowed to have private layers, which are signalled by | ||||
* {@link layersAdded()} and {@link layerWasAdded()} but will not be | ||||
* advertised by this signal. | ||||
* | ||||
* @param theMapLayers The {@link QgsMapLayer}s which are added to the | ||||
legend. | ||||
* | ||||
* @note Added in 2.0 | ||||
*/ | ||||
void legendLayersAdded( QList<QgsMapLayer*> theMapLayers ); | ||||
//! protected constructor | protected: | |||
//! protected constructor | ||||
QgsMapLayerRegistry( QObject * parent = 0 ); | QgsMapLayerRegistry( QObject * parent = 0 ); | |||
private: | private: | |||
static QgsMapLayerRegistry* mInstance; | static QgsMapLayerRegistry* mInstance; | |||
QMap<QString, QgsMapLayer*> mMapLayers; | QMap<QString, QgsMapLayer*> mMapLayers; | |||
QSet<QgsMapLayer*> mOwnedLayers; | ||||
/** debugging member | /** debugging member | |||
invoked when a connect() is made to this object | invoked when a connect() is made to this object | |||
*/ | */ | |||
void connectNotify( const char * signal ); | void connectNotify( const char * signal ); | |||
}; // class QgsMapLayerRegistry | }; // class QgsMapLayerRegistry | |||
#endif //QgsMapLayerRegistry_H | #endif //QgsMapLayerRegistry_H | |||
End of changes. 24 change blocks. | ||||
114 lines changed or deleted | 190 lines changed or added | |||
qgsmapoverviewcanvas.h | qgsmapoverviewcanvas.h | |||
---|---|---|---|---|
skipping to change at line 61 | skipping to change at line 61 | |||
//! changes background color | //! changes background color | |||
void setBackgroundColor( const QColor& color ); | void setBackgroundColor( const QColor& color ); | |||
//! updates layer set for overview | //! updates layer set for overview | |||
void setLayerSet( const QStringList& layerSet ); | void setLayerSet( const QStringList& layerSet ); | |||
QStringList& layerSet(); | QStringList& layerSet(); | |||
void enableAntiAliasing( bool flag ) { mAntiAliasing = flag; } | void enableAntiAliasing( bool flag ) { mAntiAliasing = flag; } | |||
void updateFullExtent( const QgsRectangle& rect ); | void updateFullExtent(); | |||
public slots: | public slots: | |||
void hasCrsTransformEnabled( bool flag ); | void hasCrsTransformEnabled( bool flag ); | |||
void destinationSrsChanged(); | void destinationSrsChanged(); | |||
protected: | protected: | |||
//! Overridden paint event | //! Overridden paint event | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgsmaprenderer.h | qgsmaprenderer.h | |||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSMAPRENDER_H | #ifndef QGSMAPRENDER_H | |||
#define QGSMAPRENDER_H | #define QGSMAPRENDER_H | |||
#include <QMutex> | #include <QMutex> | |||
#include <QSize> | #include <QSize> | |||
#include <QStringList> | #include <QStringList> | |||
#include <QVector> | #include <QVector> | |||
#include <QPainter> | ||||
#include "qgis.h" | #include "qgis.h" | |||
#include "qgsrectangle.h" | #include "qgsrectangle.h" | |||
#include "qgsrendercontext.h" | #include "qgsrendercontext.h" | |||
#include "qgsfeature.h" | #include "qgsfeature.h" | |||
class QDomDocument; | class QDomDocument; | |||
class QDomNode; | class QDomNode; | |||
class QPainter; | class QPainter; | |||
class QgsMapToPixel; | class QgsMapToPixel; | |||
class QgsMapLayer; | class QgsMapLayer; | |||
class QgsMapRenderer; | class QgsMapRenderer; | |||
class QgsScaleCalculator; | class QgsScaleCalculator; | |||
class QgsCoordinateReferenceSystem; | class QgsCoordinateReferenceSystem; | |||
class QgsDistanceArea; | class QgsDistanceArea; | |||
class QgsOverlayObjectPositionManager; | ||||
class QgsVectorLayer; | class QgsVectorLayer; | |||
struct QgsDiagramLayerSettings; | class QgsPalLayerSettings; | |||
class QgsDiagramLayerSettings; | ||||
struct CORE_EXPORT QgsLabelPosition | class CORE_EXPORT QgsLabelPosition | |||
{ | { | |||
QgsLabelPosition( int id, double r, const QVector< QgsPoint >& corners, c | public: | |||
onst QgsRectangle& rect, double w, double h, const QString& layer, bool ups | QgsLabelPosition( int id, double r, const QVector< QgsPoint >& corners, | |||
ide_down, bool diagram = false ): | const QgsRectangle& rect, double w, double h, const QString& layer, const | |||
featureId( id ), rotation( r ), cornerPoints( corners ), labelRect( r | QString& labeltext, const QFont& labelfont, bool upside_down, bool diagram | |||
ect ), width( w ), height( h ), layerID( layer ), upsideDown( upside_down ) | = false, bool pinned = false ): | |||
, isDiagram( diagram ) {} | featureId( id ), rotation( r ), cornerPoints( corners ), labelRect( | |||
QgsLabelPosition(): featureId( -1 ), rotation( 0 ), labelRect( QgsRectang | rect ), width( w ), height( h ), layerID( layer ), labelText( labeltext ), | |||
le() ), width( 0 ), height( 0 ), layerID( "" ), upsideDown( false ), isDiag | labelFont( labelfont ), upsideDown( upside_down ), isDiagram( diagram ), i | |||
ram( false ) {} | sPinned( pinned ) {} | |||
int featureId; | QgsLabelPosition(): featureId( -1 ), rotation( 0 ), labelRect( QgsRecta | |||
double rotation; | ngle() ), width( 0 ), height( 0 ), layerID( "" ), labelText( "" ), labelFon | |||
QVector< QgsPoint > cornerPoints; | t( QFont() ), upsideDown( false ), isDiagram( false ), isPinned( false ) {} | |||
QgsRectangle labelRect; | int featureId; | |||
double width; | double rotation; | |||
double height; | QVector< QgsPoint > cornerPoints; | |||
QString layerID; | QgsRectangle labelRect; | |||
bool upsideDown; | double width; | |||
bool isDiagram; | double height; | |||
QString layerID; | ||||
QString labelText; | ||||
QFont labelFont; | ||||
bool upsideDown; | ||||
bool isDiagram; | ||||
bool isPinned; | ||||
}; | }; | |||
/** Labeling engine interface. | /** Labeling engine interface. | |||
* \note Added in QGIS v1.4 | * \note Added in QGIS v1.4 | |||
*/ | */ | |||
class QgsLabelingEngineInterface | class CORE_EXPORT QgsLabelingEngineInterface | |||
{ | { | |||
public: | public: | |||
virtual ~QgsLabelingEngineInterface() {} | virtual ~QgsLabelingEngineInterface() {} | |||
//! called when we're going to start with rendering | //! called when we're going to start with rendering | |||
virtual void init( QgsMapRenderer* mp ) = 0; | virtual void init( QgsMapRenderer* mp ) = 0; | |||
//! called to find out whether the layer is used for labeling | //! called to find out whether the layer is used for labeling | |||
virtual bool willUseLayer( QgsVectorLayer* layer ) = 0; | virtual bool willUseLayer( QgsVectorLayer* layer ) = 0; | |||
//! clears all PAL layer settings for registered layers | ||||
//! @note: this method was added in version 1.9 | ||||
virtual void clearActiveLayers() = 0; | ||||
//! clears data defined objects from PAL layer settings for a registere | ||||
d layer | ||||
//! @note: this method was added in version 1.9 | ||||
virtual void clearActiveLayer( QgsVectorLayer* layer ) = 0; | ||||
//! called when starting rendering of a layer | //! called when starting rendering of a layer | |||
//! @note: this method was added in version 1.6 | //! @note: this method was added in version 1.6 | |||
virtual int prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices , QgsRenderContext& ctx ) = 0; | virtual int prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices , QgsRenderContext& ctx ) = 0; | |||
//! returns PAL layer settings for a registered layer | ||||
//! @note: this method was added in version 1.9 | ||||
virtual QgsPalLayerSettings& layer( const QString& layerName ) = 0; | ||||
//! adds a diagram layer to the labeling engine | //! adds a diagram layer to the labeling engine | |||
virtual int addDiagramLayer( QgsVectorLayer* layer, QgsDiagramLayerSett ings* s ) | virtual int addDiagramLayer( QgsVectorLayer* layer, QgsDiagramLayerSett ings* s ) | |||
{ Q_UNUSED( layer ); Q_UNUSED( s ); return 0; } | { Q_UNUSED( layer ); Q_UNUSED( s ); return 0; } | |||
//! called for every feature | //! called for every feature | |||
virtual void registerFeature( QgsVectorLayer* layer, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() ) = 0; | virtual void registerFeature( QgsVectorLayer* layer, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() ) = 0; | |||
//! called for every diagram feature | //! called for every diagram feature | |||
virtual void registerDiagramFeature( QgsVectorLayer* layer, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() ) | virtual void registerDiagramFeature( QgsVectorLayer* layer, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() ) | |||
{ Q_UNUSED( layer ); Q_UNUSED( feat ); Q_UNUSED( context ); } | { Q_UNUSED( layer ); Q_UNUSED( feat ); Q_UNUSED( context ); } | |||
//! called when the map is drawn and labels should be placed | //! called when the map is drawn and labels should be placed | |||
virtual void drawLabeling( QgsRenderContext& context ) = 0; | virtual void drawLabeling( QgsRenderContext& context ) = 0; | |||
//! called when we're done with rendering | //! called when we're done with rendering | |||
virtual void exit() = 0; | virtual void exit() = 0; | |||
//! return infos about labels at a given (map) position | //! return infos about labels at a given (map) position | |||
//! @note: this method was added in version 1.7 | //! @note: this method was added in version 1.7 | |||
virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ) = 0; | virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ) = 0; | |||
//! return infos about labels within a given (map) rectangle | ||||
//! @note: this method was added in version 1.9 | ||||
virtual QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r | ||||
) = 0; | ||||
//! called when passing engine among map renderers | //! called when passing engine among map renderers | |||
virtual QgsLabelingEngineInterface* clone() = 0; | virtual QgsLabelingEngineInterface* clone() = 0; | |||
}; | }; | |||
/** \ingroup core | /** \ingroup core | |||
* A non GUI class for rendering a map layer set onto a QPainter. | * A non GUI class for rendering a map layer set onto a QPainter. | |||
*/ | */ | |||
class CORE_EXPORT QgsMapRenderer : public QObject | class CORE_EXPORT QgsMapRenderer : public QObject | |||
skipping to change at line 114 | skipping to change at line 131 | |||
public: | public: | |||
/**Output units for pen width and point marker width/height*/ | /**Output units for pen width and point marker width/height*/ | |||
enum OutputUnits | enum OutputUnits | |||
{ | { | |||
Millimeters, | Millimeters, | |||
Pixels | Pixels | |||
//MAP_UNITS probably supported in future versions | //MAP_UNITS probably supported in future versions | |||
}; | }; | |||
/** Blending modes enum defining the available composition modes that c | ||||
an | ||||
* be used when rendering a layer | ||||
*/ | ||||
enum BlendMode | ||||
{ | ||||
BlendNormal, | ||||
BlendLighten, | ||||
BlendScreen, | ||||
BlendDodge, | ||||
BlendAddition, | ||||
BlendDarken, | ||||
BlendMultiply, | ||||
BlendBurn, | ||||
BlendOverlay, | ||||
BlendSoftLight, | ||||
BlendHardLight, | ||||
BlendDifference, | ||||
BlendSubtract | ||||
}; | ||||
//! constructor | //! constructor | |||
QgsMapRenderer(); | QgsMapRenderer(); | |||
//! destructor | //! destructor | |||
~QgsMapRenderer(); | ~QgsMapRenderer(); | |||
//! starts rendering | //! starts rendering | |||
//! @ param forceWidthScale Force a specific scale factor for line widt hs and marker sizes. Automatically calculated from output device DPI if 0 | //! @ param forceWidthScale Force a specific scale factor for line widt hs and marker sizes. Automatically calculated from output device DPI if 0 | |||
void render( QPainter* painter, double* forceWidthScale = 0 ); | void render( QPainter* painter, double* forceWidthScale = 0 ); | |||
//! sets extent and checks whether suitable (returns false if not) | //! sets extent and checks whether suitable (returns false if not) | |||
bool setExtent( const QgsRectangle& extent ); | bool setExtent( const QgsRectangle& extent ); | |||
//! returns current extent | //! returns current extent | |||
QgsRectangle extent() const; | QgsRectangle extent() const; | |||
const QgsMapToPixel* coordinateTransform() { return &( mRenderContext.m apToPixel() ); } | const QgsMapToPixel* coordinateTransform() { return &( mRenderContext.m apToPixel() ); } | |||
//! Scale denominator | ||||
double scale() const { return mScale; } | double scale() const { return mScale; } | |||
/**Sets scale for scale based visibility. Normally, the scale is calcul ated automatically. This | /**Sets scale for scale based visibility. Normally, the scale is calcul ated automatically. This | |||
function is only used to force a preview scale (e.g. for print compose r)*/ | function is only used to force a preview scale (e.g. for print compose r)*/ | |||
void setScale( double scale ) {mScale = scale;} | void setScale( double scale ) {mScale = scale;} | |||
double mapUnitsPerPixel() const { return mMapUnitsPerPixel; } | double mapUnitsPerPixel() const { return mMapUnitsPerPixel; } | |||
int width() const { return mSize.width(); }; | int width() const { return mSize.width(); }; | |||
int height() const { return mSize.height(); }; | int height() const { return mSize.height(); }; | |||
//! Recalculate the map scale | //! Recalculate the map scale | |||
void updateScale(); | void updateScale(); | |||
//! Return the measuring object | ||||
//! @deprecated | ||||
Q_DECL_DEPRECATED QgsDistanceArea *distanceArea() { return mDistArea; } | ||||
QGis::UnitType mapUnits() const; | QGis::UnitType mapUnits() const; | |||
void setMapUnits( QGis::UnitType u ); | void setMapUnits( QGis::UnitType u ); | |||
//! sets whether map image will be for overview | //! sets whether map image will be for overview | |||
void enableOverviewMode( bool isOverview = true ) { mOverview = isOverv iew; } | void enableOverviewMode( bool isOverview = true ) { mOverview = isOverv iew; } | |||
void setOutputSize( QSize size, int dpi ); | void setOutputSize( QSize size, int dpi ); | |||
void setOutputSize( QSizeF size, double dpi ); | void setOutputSize( QSizeF size, double dpi ); | |||
//!accessor for output dpi | //!accessor for output dpi | |||
double outputDpi(); | double outputDpi(); | |||
//!accessor for output size | //!accessor for output size | |||
QSize outputSize(); | QSize outputSize(); | |||
QSizeF outputSizeF(); | QSizeF outputSizeF(); | |||
//! transform extent in layer's CRS to extent in output CRS | /** | |||
* @brief transform bounding box from layer's CRS to output CRS | ||||
* @see layerToMapCoordinates( QgsMapLayer* theLayer, QgsRectangle rect | ||||
) if you want to transform a rectangle | ||||
* @return a bounding box (aligned rectangle) containing the transforme | ||||
d extent | ||||
*/ | ||||
QgsRectangle layerExtentToOutputExtent( QgsMapLayer* theLayer, QgsRecta ngle extent ); | QgsRectangle layerExtentToOutputExtent( QgsMapLayer* theLayer, QgsRecta ngle extent ); | |||
//! transform coordinates from layer's CRS to output CRS | /** | |||
* @brief transform bounding box from output CRS to layer's CRS | ||||
* @see mapToLayerCoordinates( QgsMapLayer* theLayer,QgsRectangle rect | ||||
) if you want to transform a rectangle | ||||
* @return a bounding box (aligned rectangle) containing the transforme | ||||
d extent | ||||
*/ | ||||
QgsRectangle outputExtentToLayerExtent( QgsMapLayer* theLayer, QgsRecta | ||||
ngle extent ); | ||||
/** | ||||
* @brief transform point coordinates from layer's CRS to output CRS | ||||
* @return the transformed point | ||||
*/ | ||||
QgsPoint layerToMapCoordinates( QgsMapLayer* theLayer, QgsPoint point ) ; | QgsPoint layerToMapCoordinates( QgsMapLayer* theLayer, QgsPoint point ) ; | |||
//! transform coordinates from output CRS to layer's CRS | /** | |||
* @brief transform rectangle from layer's CRS to output CRS | ||||
* @see layerExtentToOutputExtent() if you want to transform a bounding | ||||
box | ||||
* @return the transformed rectangle | ||||
*/ | ||||
QgsRectangle layerToMapCoordinates( QgsMapLayer* theLayer, QgsRectangle | ||||
rect ); | ||||
/** | ||||
* @brief transform point coordinates from output CRS to layer's CRS | ||||
* @return the transformed point | ||||
*/ | ||||
QgsPoint mapToLayerCoordinates( QgsMapLayer* theLayer, QgsPoint point ) ; | QgsPoint mapToLayerCoordinates( QgsMapLayer* theLayer, QgsPoint point ) ; | |||
//! transform rect's coordinates from output CRS to layer's CRS | /** | |||
* @brief transform rectangle from output CRS to layer's CRS | ||||
* @see outputExtentToLayerExtent() if you want to transform a bounding | ||||
box | ||||
* @return the transformed rectangle | ||||
*/ | ||||
QgsRectangle mapToLayerCoordinates( QgsMapLayer* theLayer, QgsRectangle rect ); | QgsRectangle mapToLayerCoordinates( QgsMapLayer* theLayer, QgsRectangle rect ); | |||
//! sets whether to use projections for this layer set | //! sets whether to use projections for this layer set | |||
void setProjectionsEnabled( bool enabled ); | void setProjectionsEnabled( bool enabled ); | |||
//! returns true if projections are enabled for this layer set | //! returns true if projections are enabled for this layer set | |||
bool hasCrsTransformEnabled(); | bool hasCrsTransformEnabled() const; | |||
/** sets destination coordinate reference system | ||||
* @note deprecated by qgis 1.7 | ||||
* @see setDestinationCrs | ||||
*/ | ||||
Q_DECL_DEPRECATED void setDestinationSrs( const QgsCoordinateReferenceS | ||||
ystem& srs ) { setDestinationCrs( srs ); }; | ||||
/** returns CRS of destination coordinate reference system | ||||
* @note deprecated by qgis 1.7 | ||||
* @see destinationCrs | ||||
*/ | ||||
Q_DECL_DEPRECATED const QgsCoordinateReferenceSystem& destinationSrs() | ||||
{ return destinationCrs(); }; | ||||
//! sets destination coordinate reference system | //! sets destination coordinate reference system | |||
void setDestinationCrs( const QgsCoordinateReferenceSystem& crs ); | void setDestinationCrs( const QgsCoordinateReferenceSystem& crs ); | |||
//! returns CRS of destination coordinate reference system | //! returns CRS of destination coordinate reference system | |||
const QgsCoordinateReferenceSystem& destinationCrs(); | const QgsCoordinateReferenceSystem& destinationCrs() const; | |||
void setOutputUnits( OutputUnits u ) {mOutputUnits = u;} | void setOutputUnits( OutputUnits u ) {mOutputUnits = u;} | |||
OutputUnits outputUnits() const {return mOutputUnits;} | OutputUnits outputUnits() const {return mOutputUnits;} | |||
//! returns current extent of layer set | //! returns current extent of layer set | |||
QgsRectangle fullExtent(); | QgsRectangle fullExtent(); | |||
//! returns current layer set | //! returns current layer set | |||
QStringList& layerSet(); | QStringList& layerSet(); | |||
skipping to change at line 232 | skipping to change at line 283 | |||
//! Labeling engine (NULL if there's no custom engine) | //! Labeling engine (NULL if there's no custom engine) | |||
//! \note Added in QGIS v1.4 | //! \note Added in QGIS v1.4 | |||
QgsLabelingEngineInterface* labelingEngine() { return mLabelingEngine; } | QgsLabelingEngineInterface* labelingEngine() { return mLabelingEngine; } | |||
//! Set labeling engine. Previous engine (if any) is deleted. | //! Set labeling engine. Previous engine (if any) is deleted. | |||
//! Takes ownership of the engine. | //! Takes ownership of the engine. | |||
//! Added in QGIS v1.4 | //! Added in QGIS v1.4 | |||
void setLabelingEngine( QgsLabelingEngineInterface* iface ); | void setLabelingEngine( QgsLabelingEngineInterface* iface ); | |||
//! Returns a QPainter::CompositionMode corresponding to a BlendMode | ||||
//! Added in 1.9 | ||||
static QPainter::CompositionMode getCompositionMode( const QgsMapRender | ||||
er::BlendMode blendMode ); | ||||
//! Returns a BlendMode corresponding to a QPainter::CompositionMode | ||||
//! Added in 1.9 | ||||
static QgsMapRenderer::BlendMode getBlendModeEnum( const QPainter::Comp | ||||
ositionMode blendMode ); | ||||
signals: | signals: | |||
void drawingProgress( int current, int total ); | void drawingProgress( int current, int total ); | |||
void hasCrsTransformEnabled( bool flag ); | void hasCrsTransformEnabled( bool flag ); | |||
void destinationSrsChanged(); | void destinationSrsChanged(); | |||
void updateMap(); | void updateMap(); | |||
void mapUnitsChanged(); | void mapUnitsChanged(); | |||
//! emitted when layer's draw() returned false | //! emitted when layer's draw() returned false | |||
void drawError( QgsMapLayer* ); | void drawError( QgsMapLayer* ); | |||
public slots: | public slots: | |||
//! called by signal from layer current being drawn | //! called by signal from layer current being drawn | |||
void onDrawingProgress( int current, int total ); | void onDrawingProgress( int current, int total ); | |||
//! invalidate cached layer CRS | ||||
void invalidateCachedLayerCrs(); | ||||
//! cached layer was destroyed | ||||
void cachedLayerDestroyed(); | ||||
protected: | protected: | |||
//! adjust extent to fit the pixmap size | //! adjust extent to fit the pixmap size | |||
void adjustExtentToSize(); | void adjustExtentToSize(); | |||
/** Convenience function to project an extent into the layer source | /** Convenience function to project an extent into the layer source | |||
* CRS, but also split it into two extents if it crosses | * CRS, but also split it into two extents if it crosses | |||
* the +/- 180 degree line. Modifies the given extent to be in the | * the +/- 180 degree line. Modifies the given extent to be in the | |||
* source CRS coordinates, and if it was split, returns true, and | * source CRS coordinates, and if it was split, returns true, and | |||
* also sets the contents of the r2 parameter | * also sets the contents of the r2 parameter | |||
*/ | */ | |||
bool splitLayersExtent( QgsMapLayer* layer, QgsRectangle& extent, QgsRe ctangle& r2 ); | bool splitLayersExtent( QgsMapLayer* layer, QgsRectangle& extent, QgsRe ctangle& r2 ); | |||
/**Creates an overlay object position manager subclass according to the | ||||
current settings | ||||
@note this method was added in version 1.1*/ | ||||
QgsOverlayObjectPositionManager* overlayManagerFromSettings(); | ||||
//! indicates drawing in progress | //! indicates drawing in progress | |||
static bool mDrawing; | static bool mDrawing; | |||
//! map units per pixel | //! map units per pixel | |||
double mMapUnitsPerPixel; | double mMapUnitsPerPixel; | |||
//! Map scale at its current zool level | //! Map scale denominator at its current zoom level | |||
double mScale; | double mScale; | |||
//! scale calculator | //! scale calculator | |||
QgsScaleCalculator * mScaleCalculator; | QgsScaleCalculator * mScaleCalculator; | |||
//! current extent to be drawn | //! current extent to be drawn | |||
QgsRectangle mExtent; | QgsRectangle mExtent; | |||
// | // | |||
/** Last extent to we drew so we know if we can | /** Last extent to we drew so we know if we can | |||
used layer render caching or not. Note there are no | used layer render caching or not. Note there are no | |||
skipping to change at line 330 | skipping to change at line 378 | |||
//!Output units | //!Output units | |||
OutputUnits mOutputUnits; | OutputUnits mOutputUnits; | |||
//! Labeling engine (NULL by default) | //! Labeling engine (NULL by default) | |||
QgsLabelingEngineInterface* mLabelingEngine; | QgsLabelingEngineInterface* mLabelingEngine; | |||
//! Locks rendering loop for concurrent draws | //! Locks rendering loop for concurrent draws | |||
QMutex mRenderMutex; | QMutex mRenderMutex; | |||
private: | private: | |||
QgsCoordinateTransform *tr( QgsMapLayer *layer ); | const QgsCoordinateTransform* tr( QgsMapLayer *layer ); | |||
QgsCoordinateTransform *mCachedTr; | ||||
QgsMapLayer *mCachedTrForLayer; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 23 change blocks. | ||||
60 lines changed or deleted | 118 lines changed or added | |||
qgsmaptip.h | qgsmaptip.h | |||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef _QGSMAPTIP_H_ | #ifndef _QGSMAPTIP_H_ | |||
#define _QGSMAPTIP_H_ | #define _QGSMAPTIP_H_ | |||
class QgsMapLayer; | class QgsMapLayer; | |||
class QgsMapCanvas; | class QgsMapCanvas; | |||
class QPoint; | class QPoint; | |||
class QString; | class QString; | |||
#include "qgsfeature.h" | ||||
/** \ingroup gui | /** \ingroup gui | |||
* A maptip is a class to display a tip on a map canvas | * A maptip is a class to display a tip on a map canvas | |||
* when a mouse is hovered over a feature. | * when a mouse is hovered over a feature. | |||
*/ | */ | |||
class GUI_EXPORT QgsMapTip | class GUI_EXPORT QgsMapTip | |||
{ | { | |||
public: | public: | |||
/** Default constructor | /** Default constructor | |||
*/ | */ | |||
QgsMapTip(); | QgsMapTip(); | |||
skipping to change at line 59 | skipping to change at line 61 | |||
/** Clear the current maptip if it exists | /** Clear the current maptip if it exists | |||
* @param mpMapCanvas the canvas from which the tip should be cleared. | * @param mpMapCanvas the canvas from which the tip should be cleared. | |||
*/ | */ | |||
void clear( QgsMapCanvas *mpMapCanvas ); | void clear( QgsMapCanvas *mpMapCanvas ); | |||
private: | private: | |||
// Fetch the feature to use for the maptip text. Only the first feature in the | // Fetch the feature to use for the maptip text. Only the first feature in the | |||
// search radius is used | // search radius is used | |||
QString fetchFeature( QgsMapLayer * thepLayer, | QString fetchFeature( QgsMapLayer * thepLayer, | |||
QgsPoint & theMapPosition, | QgsPoint & theMapPosition, | |||
QgsMapCanvas *thepMapCanvas ); | QgsMapCanvas *thepMapCanvas ); | |||
QString replaceText( QString displayText, QgsVectorLayer *layer, QgsFea | ||||
ture &feat ); | ||||
// Flag to indicate if a maptip is currently being displayed | // Flag to indicate if a maptip is currently being displayed | |||
bool mMapTipVisible; | bool mMapTipVisible; | |||
// Last point on the map canvas when the maptip timer fired. This point is in widget pixel | // Last point on the map canvas when the maptip timer fired. This point is in widget pixel | |||
// coordinates | // coordinates | |||
QPoint mLastPosition; | QPoint mLastPosition; | |||
}; | }; | |||
#endif // _QGSMAPTIP_H_ | #endif // _QGSMAPTIP_H_ | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 6 lines changed or added | |||
qgsmaptool.h | qgsmaptool.h | |||
---|---|---|---|---|
skipping to change at line 19 | skipping to change at line 19 | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSMAPTOOL_H | #ifndef QGSMAPTOOL_H | |||
#define QGSMAPTOOL_H | #define QGSMAPTOOL_H | |||
#include "qgsconfig.h" | ||||
#include <QCursor> | #include <QCursor> | |||
#include <QString> | #include <QString> | |||
#include <QObject> | #include <QObject> | |||
#ifdef HAVE_TOUCH | #ifdef HAVE_TOUCH | |||
#include <QGestureEvent> | #include <QGestureEvent> | |||
#endif | #endif | |||
class QgsMapLayer; | class QgsMapLayer; | |||
class QgsMapCanvas; | class QgsMapCanvas; | |||
class QKeyEvent; | class QKeyEvent; | |||
class QMouseEvent; | class QMouseEvent; | |||
class QWheelEvent; | ||||
class QgsPoint; | class QgsPoint; | |||
class QgsRectangle; | class QgsRectangle; | |||
class QPoint; | class QPoint; | |||
class QAction; | class QAction; | |||
class QAbstractButton; | class QAbstractButton; | |||
/** \ingroup gui | /** \ingroup gui | |||
* Abstract base class for all map tools. | * Abstract base class for all map tools. | |||
* Map tools are user interactive tools for manipulating the | * Map tools are user interactive tools for manipulating the | |||
* map canvas. For example map pan and zoom features are | * map canvas. For example map pan and zoom features are | |||
skipping to change at line 62 | skipping to change at line 65 | |||
//! Mouse double click event for overriding. Default implementation doe s nothing. | //! Mouse double click event for overriding. Default implementation doe s nothing. | |||
virtual void canvasDoubleClickEvent( QMouseEvent * e ); | virtual void canvasDoubleClickEvent( QMouseEvent * e ); | |||
//! Mouse press event for overriding. Default implementation does nothi ng. | //! Mouse press event for overriding. Default implementation does nothi ng. | |||
virtual void canvasPressEvent( QMouseEvent * e ); | virtual void canvasPressEvent( QMouseEvent * e ); | |||
//! Mouse release event for overriding. Default implementation does not hing. | //! Mouse release event for overriding. Default implementation does not hing. | |||
virtual void canvasReleaseEvent( QMouseEvent * e ); | virtual void canvasReleaseEvent( QMouseEvent * e ); | |||
//! Mouse wheel event for overriding. Default implementation does nothi | ||||
ng. | ||||
//! Added in version 2.0 | ||||
virtual void wheelEvent( QWheelEvent* e ); | ||||
//! Key event for overriding. Default implementation does nothing. | //! Key event for overriding. Default implementation does nothing. | |||
virtual void keyPressEvent( QKeyEvent* e ); | virtual void keyPressEvent( QKeyEvent* e ); | |||
//! Key event for overriding. Default implementation does nothing. | //! Key event for overriding. Default implementation does nothing. | |||
//! Added in version 1.1 | //! Added in version 1.1 | |||
virtual void keyReleaseEvent( QKeyEvent* e ); | virtual void keyReleaseEvent( QKeyEvent* e ); | |||
#ifdef HAVE_TOUCH | #ifdef HAVE_TOUCH | |||
//! gesture event for overriding. Default implementation does nothing. | //! gesture event for overriding. Default implementation does nothing. | |||
virtual bool gestureEvent( QGestureEvent* e ); | virtual bool gestureEvent( QGestureEvent* e ); | |||
skipping to change at line 93 | skipping to change at line 100 | |||
/** Return associated action with map tool or NULL if no action is asso ciated */ | /** Return associated action with map tool or NULL if no action is asso ciated */ | |||
QAction* action(); | QAction* action(); | |||
/** Use this to associate a button to this maptool. It has the same mea ning | /** Use this to associate a button to this maptool. It has the same mea ning | |||
* as setAction() function except it works with a button instead of an QAction. */ | * as setAction() function except it works with a button instead of an QAction. */ | |||
void setButton( QAbstractButton* button ); | void setButton( QAbstractButton* button ); | |||
/** Return associated button with map tool or NULL if no button is asso ciated */ | /** Return associated button with map tool or NULL if no button is asso ciated */ | |||
QAbstractButton* button(); | QAbstractButton* button(); | |||
/** Set a user defined cursor */ | ||||
virtual void setCursor( QCursor cursor ); | ||||
/** Check whether this MapTool performs a zoom or pan operation. | /** Check whether this MapTool performs a zoom or pan operation. | |||
* If it does, we will be able to perform the zoom and then | * If it does, we will be able to perform the zoom and then | |||
* resume operations with the original / previously used tool.*/ | * resume operations with the original / previously used tool.*/ | |||
virtual bool isTransient(); | virtual bool isTransient(); | |||
/** Check whether this MapTool performs an edit operation. | /** Check whether this MapTool performs an edit operation. | |||
* If it does, we will deactivate it when editing is turned off | * If it does, we will deactivate it when editing is turned off | |||
*/ | */ | |||
virtual bool isEditTool(); | virtual bool isEditTool(); | |||
skipping to change at line 123 | skipping to change at line 133 | |||
//! constructor takes map canvas as a parameter | //! constructor takes map canvas as a parameter | |||
QgsMapTool( QgsMapCanvas* canvas ); | QgsMapTool( QgsMapCanvas* canvas ); | |||
//! transformation from screen coordinates to map coordinates | //! transformation from screen coordinates to map coordinates | |||
QgsPoint toMapCoordinates( const QPoint& point ); | QgsPoint toMapCoordinates( const QPoint& point ); | |||
//! transformation from screen coordinates to layer's coordinates | //! transformation from screen coordinates to layer's coordinates | |||
QgsPoint toLayerCoordinates( QgsMapLayer* layer, const QPoint& point ); | QgsPoint toLayerCoordinates( QgsMapLayer* layer, const QPoint& point ); | |||
//! trasformation from map coordinates to layer's coordinates | //! transformation from map coordinates to layer's coordinates | |||
QgsPoint toLayerCoordinates( QgsMapLayer* layer, const QgsPoint& point ); | QgsPoint toLayerCoordinates( QgsMapLayer* layer, const QgsPoint& point ); | |||
//!transformation from layer's coordinates to map coordinates (which is different in case reprojection is used) | //!transformation from layer's coordinates to map coordinates (which is different in case reprojection is used) | |||
QgsPoint toMapCoordinates( QgsMapLayer* layer, const QgsPoint& point ); | QgsPoint toMapCoordinates( QgsMapLayer* layer, const QgsPoint& point ); | |||
//! trnasformation of the rect from map coordinates to layer's coordina tes | //! trnasformation of the rect from map coordinates to layer's coordina tes | |||
QgsRectangle toLayerCoordinates( QgsMapLayer* layer, const QgsRectangle & rect ); | QgsRectangle toLayerCoordinates( QgsMapLayer* layer, const QgsRectangle & rect ); | |||
//! transformation from map coordinates to screen coordinates | //! transformation from map coordinates to screen coordinates | |||
QPoint toCanvasCoordinates( const QgsPoint& point ); | QPoint toCanvasCoordinates( const QgsPoint& point ); | |||
End of changes. 5 change blocks. | ||||
1 lines changed or deleted | 12 lines changed or added | |||
qgsmaptoolemitpoint.h | qgsmaptoolemitpoint.h | |||
---|---|---|---|---|
skipping to change at line 46 | skipping to change at line 46 | |||
//! Overridden mouse move event | //! Overridden mouse move event | |||
virtual void canvasMoveEvent( QMouseEvent * e ); | virtual void canvasMoveEvent( QMouseEvent * e ); | |||
//! Overridden mouse press event - emits the signal | //! Overridden mouse press event - emits the signal | |||
virtual void canvasPressEvent( QMouseEvent * e ); | virtual void canvasPressEvent( QMouseEvent * e ); | |||
//! Overridden mouse release event | //! Overridden mouse release event | |||
virtual void canvasReleaseEvent( QMouseEvent * e ); | virtual void canvasReleaseEvent( QMouseEvent * e ); | |||
signals: | signals: | |||
//! signal emitted on canvas click | //! signal emitted on canvas click | |||
// \note changed in 1.3 | // \note changed in 1.3 | |||
void canvasClicked( const QgsPoint& point, Qt::MouseButton button ); | void canvasClicked( const QgsPoint& point, Qt::MouseButton button ); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 0 lines changed or added | |||
qgsmaptopixel.h | qgsmaptopixel.h | |||
---|---|---|---|---|
skipping to change at line 72 | skipping to change at line 72 | |||
* @return QgsPoint in map coordinates | * @return QgsPoint in map coordinates | |||
*/ | */ | |||
/* Transform device coordinates to map coordinates. Modifies the | /* Transform device coordinates to map coordinates. Modifies the | |||
given coordinates in place. Intended as a fast way to do the | given coordinates in place. Intended as a fast way to do the | |||
transform. */ | transform. */ | |||
void transformInPlace( double& x, double& y ) const; | void transformInPlace( double& x, double& y ) const; | |||
/* Transform device coordinates to map coordinates. Modifies the | /* Transform device coordinates to map coordinates. Modifies the | |||
given coordinates in place. Intended as a fast way to do the | given coordinates in place. Intended as a fast way to do the | |||
transform. */ | transform. | |||
void transformInPlace( std::vector<double>& x, | @note not available in python bindings | |||
std::vector<double>& y ) const; | */ | |||
void transformInPlace( QVector<double>& x, QVector<double>& y ) const; | ||||
#ifdef ANDROID | #ifdef ANDROID | |||
void transformInPlace( float& x, float& y ) const; | void transformInPlace( float& x, float& y ) const; | |||
void transformInPlace( std::vector<float>& x, | void transformInPlace( QVector<float>& x, QVector<float>& y ) const; | |||
std::vector<float>& y ) const; | ||||
#endif | #endif | |||
QgsPoint toMapCoordinates( int x, int y ) const; | QgsPoint toMapCoordinates( int x, int y ) const; | |||
/*! Transform device coordinates to map (world) coordinates | /*! Transform device coordinates to map (world) coordinates | |||
@note: this method was added in version 1.6*/ | @note: this method was added in version 1.6*/ | |||
QgsPoint toMapCoordinatesF( double x, double y ) const; | QgsPoint toMapCoordinatesF( double x, double y ) const; | |||
/*! Tranform device coordinates to map (world) coordinates | /*! Tranform device coordinates to map (world) coordinates | |||
* @param p Point to be converted to map cooordinates | * @param p Point to be converted to map cooordinates | |||
* @return QgsPoint in map coorndiates | * @return QgsPoint in map coorndiates | |||
*/ | */ | |||
QgsPoint toMapCoordinates( QPoint p ) const; | QgsPoint toMapCoordinates( QPoint p ) const; | |||
QgsPoint toMapPoint( double x, double y ) const; | QgsPoint toMapPoint( double x, double y ) const; | |||
/*! Set map units per pixel | /*! Set map units per pixel | |||
* @param mapUnitsPerPixel Map units per pixel | * @param mapUnitsPerPixel Map units per pixel | |||
*/ | */ | |||
void setMapUnitsPerPixel( double mapUnitsPerPixel ); | void setMapUnitsPerPixel( double mapUnitsPerPixel ); | |||
//! Return current map units per pixel | //! Return current map units per pixel | |||
double mapUnitsPerPixel() const; | double mapUnitsPerPixel() const; | |||
skipping to change at line 124 | skipping to change at line 124 | |||
*/ | */ | |||
void setParameters( double mapUnitsPerPixel, double xmin, double ymin, double ymax ); | void setParameters( double mapUnitsPerPixel, double xmin, double ymin, double ymax ); | |||
//! String representation of the parameters used in the transform | //! String representation of the parameters used in the transform | |||
QString showParameters(); | QString showParameters(); | |||
private: | private: | |||
double mMapUnitsPerPixel; | double mMapUnitsPerPixel; | |||
double yMax; | double yMax; | |||
double yMin; | double yMin; | |||
double xMin; | double xMin; | |||
double xMax; | ||||
}; | }; | |||
#endif // QGSMAPTOPIXEL | #endif // QGSMAPTOPIXEL | |||
End of changes. 4 change blocks. | ||||
10 lines changed or deleted | 8 lines changed or added | |||
qgsmarkersymbollayerv2.h | qgsmarkersymbollayerv2.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsmarkersymbollayerv2.h | qgsmarkersymbollayerv2.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSMARKERSYMBOLLAYERV2_H | #ifndef QGSMARKERSYMBOLLAYERV2_H | |||
#define QGSMARKERSYMBOLLAYERV2_H | #define QGSMARKERSYMBOLLAYERV2_H | |||
#include "qgssymbollayerv2.h" | #include "qgssymbollayerv2.h" | |||
#include "qgsvectorlayer.h" | ||||
#define DEFAULT_SIMPLEMARKER_NAME "circle" | #define DEFAULT_SIMPLEMARKER_NAME "circle" | |||
#define DEFAULT_SIMPLEMARKER_COLOR QColor(255,0,0) | #define DEFAULT_SIMPLEMARKER_COLOR QColor(255,0,0) | |||
#define DEFAULT_SIMPLEMARKER_BORDERCOLOR QColor(0,0,0) | #define DEFAULT_SIMPLEMARKER_BORDERCOLOR QColor(0,0,0) | |||
#define DEFAULT_SIMPLEMARKER_SIZE DEFAULT_POINT_SIZE | #define DEFAULT_SIMPLEMARKER_SIZE DEFAULT_POINT_SIZE | |||
#define DEFAULT_SIMPLEMARKER_ANGLE 0 | #define DEFAULT_SIMPLEMARKER_ANGLE 0 | |||
#include <QPen> | #include <QPen> | |||
#include <QBrush> | #include <QBrush> | |||
#include <QPicture> | #include <QPicture> | |||
#include <QPolygonF> | #include <QPolygonF> | |||
#include <QFont> | #include <QFont> | |||
class CORE_EXPORT QgsSimpleMarkerSymbolLayerV2 : public QgsMarkerSymbolLaye rV2 | class CORE_EXPORT QgsSimpleMarkerSymbolLayerV2 : public QgsMarkerSymbolLaye rV2 | |||
{ | { | |||
public: | public: | |||
QgsSimpleMarkerSymbolLayerV2( QString name = DEFAULT_SIMPLEMARKER_NAME, | QgsSimpleMarkerSymbolLayerV2( QString name = DEFAULT_SIMPLEMARKER_NAME, | |||
QColor color = DEFAULT_SIMPLEMARKER_COLOR , | QColor color = DEFAULT_SIMPLEMARKER_COLOR , | |||
QColor borderColor = DEFAULT_SIMPLEMARKER _BORDERCOLOR, | QColor borderColor = DEFAULT_SIMPLEMARKER _BORDERCOLOR, | |||
double size = DEFAULT_SIMPLEMARKER_SIZE, | double size = DEFAULT_SIMPLEMARKER_SIZE, | |||
double angle = DEFAULT_SIMPLEMARKER_ANGLE | double angle = DEFAULT_SIMPLEMARKER_ANGLE | |||
); | , | |||
QgsSymbolV2::ScaleMethod scaleMethod = DE | ||||
FAULT_SCALE_METHOD ); | ||||
// static stuff | // static stuff | |||
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsSt ringMap() ); | static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsSt ringMap() ); | |||
static QgsSymbolLayerV2* createFromSld( QDomElement &element ); | static QgsSymbolLayerV2* createFromSld( QDomElement &element ); | |||
// implemented from base classes | // implemented from base classes | |||
QString layerType() const; | QString layerType() const; | |||
skipping to change at line 63 | skipping to change at line 65 | |||
void stopRender( QgsSymbolV2RenderContext& context ); | void stopRender( QgsSymbolV2RenderContext& context ); | |||
void renderPoint( const QPointF& point, QgsSymbolV2RenderContext& conte xt ); | void renderPoint( const QPointF& point, QgsSymbolV2RenderContext& conte xt ); | |||
QgsStringMap properties() const; | QgsStringMap properties() const; | |||
QgsSymbolLayerV2* clone() const; | QgsSymbolLayerV2* clone() const; | |||
void writeSldMarker( QDomDocument &doc, QDomElement &element, QgsString Map props ) const; | void writeSldMarker( QDomDocument &doc, QDomElement &element, QgsString Map props ) const; | |||
QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFacto | ||||
r ) const; | ||||
QString name() const { return mName; } | QString name() const { return mName; } | |||
void setName( QString name ) { mName = name; } | void setName( QString name ) { mName = name; } | |||
QColor borderColor() const { return mBorderColor; } | QColor borderColor() const { return mBorderColor; } | |||
void setBorderColor( QColor color ) { mBorderColor = color; } | void setBorderColor( QColor color ) { mBorderColor = color; } | |||
double outlineWidth() const { return mOutlineWidth; } | ||||
void setOutlineWidth( double w ) { mOutlineWidth = w; } | ||||
QgsSymbolV2::OutputUnit outlineWidthUnit() const { return mOutlineWidth | ||||
Unit; } | ||||
void setOutlineWidthUnit( QgsSymbolV2::OutputUnit u ) { mOutlineWidthUn | ||||
it = u; } | ||||
protected: | protected: | |||
void drawMarker( QPainter* p, QgsSymbolV2RenderContext& context ); | void drawMarker( QPainter* p, QgsSymbolV2RenderContext& context ); | |||
bool prepareShape(); | bool prepareShape( QString name = QString() ); | |||
bool preparePath(); | bool preparePath( QString name = QString() ); | |||
void prepareCache( QgsSymbolV2RenderContext& context ); | /**Prepares cache image | |||
@return true in case of success, false if cache image size too large*/ | ||||
bool prepareCache( QgsSymbolV2RenderContext& context ); | ||||
QColor mBorderColor; | QColor mBorderColor; | |||
double mOutlineWidth; | ||||
QgsSymbolV2::OutputUnit mOutlineWidthUnit; | ||||
QPen mPen; | QPen mPen; | |||
QBrush mBrush; | QBrush mBrush; | |||
QPolygonF mPolygon; | QPolygonF mPolygon; | |||
QPainterPath mPath; | QPainterPath mPath; | |||
QString mName; | QString mName; | |||
QImage mCache; | QImage mCache; | |||
QPen mSelPen; | QPen mSelPen; | |||
QBrush mSelBrush; | QBrush mSelBrush; | |||
QImage mSelCache; | QImage mSelCache; | |||
bool mUsingCache; | bool mUsingCache; | |||
//Maximum width/height of cache image | ||||
static const int mMaximumCacheWidth = 3000; | ||||
}; | }; | |||
////////// | ////////// | |||
#define DEFAULT_SVGMARKER_NAME "/symbol/Star1.svg" | #define DEFAULT_SVGMARKER_NAME "/crosses/Star1.svg" | |||
#define DEFAULT_SVGMARKER_SIZE 2*DEFAULT_POINT_SIZE | #define DEFAULT_SVGMARKER_SIZE 2*DEFAULT_POINT_SIZE | |||
#define DEFAULT_SVGMARKER_ANGLE 0 | #define DEFAULT_SVGMARKER_ANGLE 0 | |||
class CORE_EXPORT QgsSvgMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2 | class CORE_EXPORT QgsSvgMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2 | |||
{ | { | |||
public: | public: | |||
QgsSvgMarkerSymbolLayerV2( QString name = DEFAULT_SVGMARKER_NAME, | QgsSvgMarkerSymbolLayerV2( QString name = DEFAULT_SVGMARKER_NAME, | |||
double size = DEFAULT_SVGMARKER_SIZE, | double size = DEFAULT_SVGMARKER_SIZE, | |||
double angle = DEFAULT_SVGMARKER_ANGLE ); | double angle = DEFAULT_SVGMARKER_ANGLE ); | |||
// static stuff | // static stuff | |||
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsSt ringMap() ); | static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsSt ringMap() ); | |||
static QgsSymbolLayerV2* createFromSld( QDomElement &element ); | static QgsSymbolLayerV2* createFromSld( QDomElement &element ); | |||
//! Return a list of all available svg files | ||||
static QStringList listSvgFiles(); | ||||
//! Get symbol's path from its name | ||||
static QString symbolNameToPath( QString name ); | ||||
//! Get symbols's name from its path | ||||
static QString symbolPathToName( QString path ); | ||||
// implemented from base classes | // implemented from base classes | |||
QString layerType() const; | QString layerType() const; | |||
void startRender( QgsSymbolV2RenderContext& context ); | void startRender( QgsSymbolV2RenderContext& context ); | |||
void stopRender( QgsSymbolV2RenderContext& context ); | void stopRender( QgsSymbolV2RenderContext& context ); | |||
void renderPoint( const QPointF& point, QgsSymbolV2RenderContext& conte xt ); | void renderPoint( const QPointF& point, QgsSymbolV2RenderContext& conte xt ); | |||
skipping to change at line 146 | skipping to change at line 154 | |||
QColor fillColor() const { return mFillColor; } | QColor fillColor() const { return mFillColor; } | |||
void setFillColor( const QColor& c ) { mFillColor = c; } | void setFillColor( const QColor& c ) { mFillColor = c; } | |||
QColor outlineColor() const { return mOutlineColor; } | QColor outlineColor() const { return mOutlineColor; } | |||
void setOutlineColor( const QColor& c ) { mOutlineColor = c; } | void setOutlineColor( const QColor& c ) { mOutlineColor = c; } | |||
double outlineWidth() const { return mOutlineWidth; } | double outlineWidth() const { return mOutlineWidth; } | |||
void setOutlineWidth( double w ) { mOutlineWidth = w; } | void setOutlineWidth( double w ) { mOutlineWidth = w; } | |||
protected: | void setOutlineWidthUnit( QgsSymbolV2::OutputUnit unit ) { mOutlineWidt | |||
hUnit = unit; } | ||||
QgsSymbolV2::OutputUnit outlineWidthUnit() const { return mOutlineWidth | ||||
Unit; } | ||||
void loadSvg(); | void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | |||
QgsSymbolV2::OutputUnit outputUnit() const; | ||||
protected: | ||||
QString mPath; | QString mPath; | |||
//param(fill), param(outline), param(outline-width) are going | //param(fill), param(outline), param(outline-width) are going | |||
//to be replaced in memory | //to be replaced in memory | |||
QColor mFillColor; | QColor mFillColor; | |||
QColor mOutlineColor; | QColor mOutlineColor; | |||
double mOutlineWidth; | double mOutlineWidth; | |||
QgsSymbolV2::OutputUnit mOutlineWidthUnit; | ||||
double mOrigSize; | double mOrigSize; | |||
}; | }; | |||
////////// | ////////// | |||
#define POINT2MM(x) ( (x) * 25.4 / 72 ) // point is 1/72 of inch | #define POINT2MM(x) ( (x) * 25.4 / 72 ) // point is 1/72 of inch | |||
#define MM2POINT(x) ( (x) * 72 / 25.4 ) | #define MM2POINT(x) ( (x) * 72 / 25.4 ) | |||
#define DEFAULT_FONTMARKER_FONT "Dingbats" | #define DEFAULT_FONTMARKER_FONT "Dingbats" | |||
#define DEFAULT_FONTMARKER_CHR QChar('A') | #define DEFAULT_FONTMARKER_CHR QChar('A') | |||
End of changes. 15 change blocks. | ||||
18 lines changed or deleted | 36 lines changed or added | |||
qgsmessagelog.h | qgsmessagelog.h | |||
---|---|---|---|---|
skipping to change at line 40 | skipping to change at line 40 | |||
* \note added in 1.9 | * \note added in 1.9 | |||
*/ | */ | |||
class CORE_EXPORT QgsMessageLog : public QObject | class CORE_EXPORT QgsMessageLog : public QObject | |||
{ | { | |||
Q_OBJECT; | Q_OBJECT; | |||
public: | public: | |||
static QgsMessageLog *instance(); | static QgsMessageLog *instance(); | |||
enum MessageLevel | ||||
{ | ||||
INFO = 0, | ||||
WARNING = 1, | ||||
CRITICAL = 2 | ||||
}; | ||||
//! add a message to the instance (and create it if necessary) | //! add a message to the instance (and create it if necessary) | |||
static void logMessage( QString message, QString tag = QString::null, i nt level = 0 ); | static void logMessage( QString message, QString tag = QString::null, M essageLevel level = WARNING ); | |||
signals: | signals: | |||
void messageReceived( QString message, QString tag, int level ); | void messageReceived( QString message, QString tag, QgsMessageLog::Mess ageLevel level ); | |||
private: | private: | |||
QgsMessageLog(); | QgsMessageLog(); | |||
void emitMessage( QString message, QString tag, int level ); | void emitMessage( QString message, QString tag, QgsMessageLog::MessageL evel level ); | |||
static QgsMessageLog *sInstance; | static QgsMessageLog *sInstance; | |||
}; | }; | |||
/** | /** | |||
\brief Default implementation of message logging interface | \brief Default implementation of message logging interface | |||
This class outputs log messages to the standard output. Therefore it might | This class outputs log messages to the standard output. Therefore it might | |||
be the right choice for apps without GUI. | be the right choice for apps without GUI. | |||
*/ | */ | |||
class CORE_EXPORT QgsMessageLogConsole : public QObject | class CORE_EXPORT QgsMessageLogConsole : public QObject | |||
{ | { | |||
Q_OBJECT; | Q_OBJECT; | |||
public: | public: | |||
QgsMessageLogConsole(); | QgsMessageLogConsole(); | |||
public slots: | public slots: | |||
void logMessage( QString message, QString tag, int level ); | void logMessage( QString message, QString tag, QgsMessageLog::MessageLe vel level ); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 11 lines changed or added | |||
qgsmessagelogviewer.h | qgsmessagelogviewer.h | |||
---|---|---|---|---|
skipping to change at line 43 | skipping to change at line 43 | |||
* \note added in 1.8 | * \note added in 1.8 | |||
*/ | */ | |||
class GUI_EXPORT QgsMessageLogViewer: public QDialog, private Ui::QgsMessag eLogViewer | class GUI_EXPORT QgsMessageLogViewer: public QDialog, private Ui::QgsMessag eLogViewer | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsMessageLogViewer( QStatusBar *statusBar = 0, QWidget *parent = 0, Qt ::WFlags fl = QgisGui::ModalDialogFlags ); | QgsMessageLogViewer( QStatusBar *statusBar = 0, QWidget *parent = 0, Qt ::WFlags fl = QgisGui::ModalDialogFlags ); | |||
~QgsMessageLogViewer(); | ~QgsMessageLogViewer(); | |||
public slots: | public slots: | |||
void logMessage( QString message, QString tag, int level ); | void logMessage( QString message, QString tag, QgsMessageLog::MessageLe vel level ); | |||
private: | private: | |||
void showEvent( QShowEvent * ); | void showEvent( QShowEvent * ); | |||
void hideEvent( QHideEvent * ); | void hideEvent( QHideEvent * ); | |||
QToolButton *mButton; | QToolButton *mButton; | |||
int mCount; | int mCount; | |||
private slots: | private slots: | |||
void closeTab( int index ); | void closeTab( int index ); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgsmessageoutput.h | qgsmessageoutput.h | |||
---|---|---|---|---|
skipping to change at line 59 | skipping to change at line 59 | |||
//! message to be appended to the current text | //! message to be appended to the current text | |||
virtual void appendMessage( const QString& message ) = 0; | virtual void appendMessage( const QString& message ) = 0; | |||
//! set title for the messages | //! set title for the messages | |||
virtual void setTitle( const QString& title ) = 0; | virtual void setTitle( const QString& title ) = 0; | |||
//! display the message to the user | //! display the message to the user | |||
virtual void showMessage( bool blocking = true ) = 0; | virtual void showMessage( bool blocking = true ) = 0; | |||
//! sets function that will be used to create message output | //! sets function that will be used to create message output | |||
//! @note not available in python bindings | ||||
static void setMessageOutputCreator( MESSAGE_OUTPUT_CREATOR f ); | static void setMessageOutputCreator( MESSAGE_OUTPUT_CREATOR f ); | |||
//! function that returns new class derived from QgsMessageOutput | //! function that returns new class derived from QgsMessageOutput | |||
//! (don't forget to delete it then) | //! (don't forget to delete it then) | |||
static QgsMessageOutput* createMessageOutput(); | static QgsMessageOutput* createMessageOutput(); | |||
private: | private: | |||
//! Pointer to the function which creates the class for output | //! Pointer to the function which creates the class for output | |||
static MESSAGE_OUTPUT_CREATOR mMessageOutputCreator; | static MESSAGE_OUTPUT_CREATOR mMessageOutputCreator; | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added | |||
qgsmessageviewer.h | qgsmessageviewer.h | |||
---|---|---|---|---|
skipping to change at line 33 | skipping to change at line 33 | |||
#include <QString> | #include <QString> | |||
/** \ingroup gui | /** \ingroup gui | |||
* A generic message view for displaying QGIS messages. | * A generic message view for displaying QGIS messages. | |||
*/ | */ | |||
class GUI_EXPORT QgsMessageViewer: public QDialog, public QgsMessageOutput, private Ui::QgsMessageViewer | class GUI_EXPORT QgsMessageViewer: public QDialog, public QgsMessageOutput, private Ui::QgsMessageViewer | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsMessageViewer( QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDi alogFlags ); | QgsMessageViewer( QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDi alogFlags, bool deleteOnClose = true ); | |||
~QgsMessageViewer(); | ~QgsMessageViewer(); | |||
virtual void setMessage( const QString& message, MessageType msgType ); | virtual void setMessage( const QString& message, MessageType msgType ); | |||
virtual void appendMessage( const QString& message ); | virtual void appendMessage( const QString& message ); | |||
virtual void showMessage( bool blocking = true ); | virtual void showMessage( bool blocking = true ); | |||
virtual void setTitle( const QString& title ); | virtual void setTitle( const QString& title ); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgsmimedatautils.h | qgsmimedatautils.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsmimedatautils.h | qgsmimedatautils.h | |||
--------------------- | --------------------- | |||
begin : November 2011 | begin : November 2011 | |||
copyright : (C) 2011 by Martin Dobias | copyright : (C) 2011 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSMIMEDATAUTILS_H | #ifndef QGSMIMEDATAUTILS_H | |||
#define QGSMIMEDATAUTILS_H | #define QGSMIMEDATAUTILS_H | |||
#include <QMimeData> | #include <QMimeData> | |||
class QgsLayerItem; | class QgsLayerItem; | |||
class CORE_EXPORT QgsMimeDataUtils | class CORE_EXPORT QgsMimeDataUtils | |||
{ | { | |||
public: | public: | |||
struct Uri | struct CORE_EXPORT Uri | |||
{ | { | |||
Uri( QgsLayerItem* layer ); | Uri( QgsLayerItem* layer ); | |||
Uri( QString& encData ); | Uri( QString& encData ); | |||
QString data() const; | QString data() const; | |||
QString layerType; | QString layerType; | |||
QString providerKey; | QString providerKey; | |||
QString name; | QString name; | |||
QString uri; | QString uri; | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
qgsnetworkaccessmanager.h | qgsnetworkaccessmanager.h | |||
---|---|---|---|---|
skipping to change at line 25 | skipping to change at line 25 | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSNETWORKACCESSMANAGER_H | #ifndef QGSNETWORKACCESSMANAGER_H | |||
#define QGSNETWORKACCESSMANAGER_H | #define QGSNETWORKACCESSMANAGER_H | |||
#include <QList> | #include <QList> | |||
#include <QStringList> | #include <QStringList> | |||
#include <QNetworkAccessManager> | #include <QNetworkAccessManager> | |||
#include <QNetworkProxy> | #include <QNetworkProxy> | |||
#include <QNetworkRequest> | ||||
/* | /* | |||
* \class QgsNetworkAccessManager | * \class QgsNetworkAccessManager | |||
* \brief network access manager for QGIS | * \brief network access manager for QGIS | |||
* \ingroup core | * \ingroup core | |||
* \since 1.5 | * \since 1.5 | |||
* | * | |||
* This class implements the QGIS network access manager. It's a singleton | * This class implements the QGIS network access manager. It's a singleton | |||
* that can be use across QGIS. | * that can be used across QGIS. | |||
* | * | |||
* Plugins can insert proxy factories and thereby redirect requests to | * Plugins can insert proxy factories and thereby redirect requests to | |||
* individual proxies. | * individual proxies. | |||
* | * | |||
* If no proxy factories are there or none returns a proxy for an URL a | * If no proxy factories are there or none returns a proxy for an URL a | |||
* fallback proxy can be set. There's also a exclude list that defines URL s | * fallback proxy can be set. There's also a exclude list that defines URL s | |||
* that the fallback proxy should not be used for, then no proxy will be us ed. | * that the fallback proxy should not be used for, then no proxy will be us ed. | |||
* | * | |||
*/ | */ | |||
class CORE_EXPORT QgsNetworkAccessManager : public QNetworkAccessManager | class CORE_EXPORT QgsNetworkAccessManager : public QNetworkAccessManager | |||
skipping to change at line 75 | skipping to change at line 76 | |||
//! retrieve fall back proxy (for urls that no factory returned proxies for) | //! retrieve fall back proxy (for urls that no factory returned proxies for) | |||
const QNetworkProxy &fallbackProxy() const; | const QNetworkProxy &fallbackProxy() const; | |||
//! retrieve exclude list (urls shouldn't use the fallback proxy) | //! retrieve exclude list (urls shouldn't use the fallback proxy) | |||
const QStringList &excludeList() const; | const QStringList &excludeList() const; | |||
//! set fallback proxy and URL that shouldn't use it. | //! set fallback proxy and URL that shouldn't use it. | |||
void setFallbackProxyAndExcludes( const QNetworkProxy &proxy, const QSt ringList &excludes ); | void setFallbackProxyAndExcludes( const QNetworkProxy &proxy, const QSt ringList &excludes ); | |||
//! Get name for QNetworkRequest::CacheLoadControl | ||||
static QString cacheLoadControlName( QNetworkRequest::CacheLoadControl | ||||
theControl ); | ||||
//! Get QNetworkRequest::CacheLoadControl from name | ||||
static QNetworkRequest::CacheLoadControl cacheLoadControlFromName( cons | ||||
t QString &theName ); | ||||
signals: | signals: | |||
void requestAboutToBeCreated( QNetworkAccessManager::Operation, const Q NetworkRequest &, QIODevice * ); | void requestAboutToBeCreated( QNetworkAccessManager::Operation, const Q NetworkRequest &, QIODevice * ); | |||
void requestCreated( QNetworkReply * ); | void requestCreated( QNetworkReply * ); | |||
private slots: | ||||
void abortRequest(); | ||||
protected: | protected: | |||
virtual QNetworkReply *createRequest( QNetworkAccessManager::Operation op, const QNetworkRequest & req, QIODevice * outgoingData = 0 ); | virtual QNetworkReply *createRequest( QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0 ); | |||
private: | private: | |||
QgsNetworkAccessManager( QObject *parent = 0 ); | QgsNetworkAccessManager( QObject *parent = 0 ); | |||
#if QT_VERSION >= 0x40500 | #if QT_VERSION >= 0x40500 | |||
QList<QNetworkProxyFactory*> mProxyFactories; | QList<QNetworkProxyFactory*> mProxyFactories; | |||
#endif | #endif | |||
QNetworkProxy mFallbackProxy; | QNetworkProxy mFallbackProxy; | |||
QStringList mExcludedURLs; | QStringList mExcludedURLs; | |||
static QgsNetworkAccessManager *smNAM; | static QgsNetworkAccessManager *smNAM; | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 14 lines changed or added | |||
qgsnewvectorlayerdialog.h | qgsnewvectorlayerdialog.h | |||
---|---|---|---|---|
skipping to change at line 40 | skipping to change at line 40 | |||
public: | public: | |||
// run the dialog, create the layer. Return file name if the creation w as successful | // run the dialog, create the layer. Return file name if the creation w as successful | |||
static QString runAndCreateLayer( QWidget* parent = 0, QString* enc = 0 ); | static QString runAndCreateLayer( QWidget* parent = 0, QString* enc = 0 ); | |||
QgsNewVectorLayerDialog( QWidget *parent = 0, Qt::WFlags fl = QgisGui:: ModalDialogFlags ); | QgsNewVectorLayerDialog( QWidget *parent = 0, Qt::WFlags fl = QgisGui:: ModalDialogFlags ); | |||
~QgsNewVectorLayerDialog(); | ~QgsNewVectorLayerDialog(); | |||
/**Returns the selected geometry type*/ | /**Returns the selected geometry type*/ | |||
QGis::WkbType selectedType() const; | QGis::WkbType selectedType() const; | |||
/**Appends the chosen attribute names and types to at*/ | /**Appends the chosen attribute names and types to at*/ | |||
void attributes( std::list<std::pair<QString, QString> >& at ) const; | void attributes( QList< QPair<QString, QString> >& at ) const; | |||
/**Returns the file format for storage*/ | /**Returns the file format for storage*/ | |||
QString selectedFileFormat() const; | QString selectedFileFormat() const; | |||
/**Returns the selected crs id*/ | /**Returns the selected crs id*/ | |||
int selectedCrsId() const; | int selectedCrsId() const; | |||
protected slots: | protected slots: | |||
void on_mAddAttributeButton_clicked(); | void on_mAddAttributeButton_clicked(); | |||
void on_mRemoveAttributeButton_clicked(); | void on_mRemoveAttributeButton_clicked(); | |||
void on_mTypeBox_currentIndexChanged( int index ); | void on_mTypeBox_currentIndexChanged( int index ); | |||
void on_pbnChangeSpatialRefSys_clicked(); | void on_pbnChangeSpatialRefSys_clicked(); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgsnmeaconnection.h | qgsnmeaconnection.h | |||
---|---|---|---|---|
skipping to change at line 31 | skipping to change at line 31 | |||
#include "qgsgpsconnection.h" | #include "qgsgpsconnection.h" | |||
/**Evaluates NMEA sentences coming from a GPS device*/ | /**Evaluates NMEA sentences coming from a GPS device*/ | |||
class CORE_EXPORT QgsNMEAConnection: public QgsGPSConnection | class CORE_EXPORT QgsNMEAConnection: public QgsGPSConnection | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsNMEAConnection( QIODevice *dev ); | QgsNMEAConnection( QIODevice *dev ); | |||
~QgsNMEAConnection(); | ~QgsNMEAConnection(); | |||
//bool poll( QgsGPSInformation& info, int maxTime ); | ||||
protected slots: | protected slots: | |||
/**Parse available data source content*/ | /**Parse available data source content*/ | |||
void parseData(); | void parseData(); | |||
protected: | protected: | |||
/**Store data from the device before it is processed*/ | /**Store data from the device before it is processed*/ | |||
QString mStringBuffer; | QString mStringBuffer; | |||
/**Splits mStringBuffer into sentences and calls libnmea*/ | /**Splits mStringBuffer into sentences and calls libnmea*/ | |||
void processStringBuffer(); | void processStringBuffer(); | |||
//handle the different sentence type | //handle the different sentence type | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 0 lines changed or added | |||
qgspallabeling.h | qgspallabeling.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgspallabeling.h | qgspallabeling.h | |||
Smart labeling for vector layers | Smart labeling for vector layers | |||
------------------- | ------------------- | |||
begin : June 2009 | begin : June 2009 | |||
copyright : (C) Martin Dobias | copyright : (C) Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
//Note: although this file is in the core library, it is not part of the st able API | //Note: although this file is in the core library, it is not part of the st able API | |||
//and might change at any time! | //and might change at any time! | |||
#ifndef QGSPALLABELING_H | #ifndef QGSPALLABELING_H | |||
#define QGSPALLABELING_H | #define QGSPALLABELING_H | |||
class QFontMetricsF; | class QFontMetricsF; | |||
class QPainter; | class QPainter; | |||
class QPicture; | ||||
class QgsGeometry; | class QgsGeometry; | |||
class QgsMapRenderer; | class QgsMapRenderer; | |||
class QgsRectangle; | class QgsRectangle; | |||
class QgsCoordinateTransform; | class QgsCoordinateTransform; | |||
class QgsLabelSearchTree; | class QgsLabelSearchTree; | |||
struct QgsDiagramLayerSettings; | ||||
#include <QString> | #include <QString> | |||
#include <QFont> | #include <QFont> | |||
#include <QFontDatabase> | ||||
#include <QColor> | #include <QColor> | |||
#include <QHash> | #include <QHash> | |||
#include <QList> | #include <QList> | |||
#include <QRectF> | #include <QRectF> | |||
namespace pal | namespace pal | |||
{ | { | |||
class Pal; | class Pal; | |||
class Layer; | class Layer; | |||
class LabelPosition; | class LabelPosition; | |||
} | } | |||
class QgsMapToPixel; | class QgsMapToPixel; | |||
class QgsFeature; | class QgsFeature; | |||
#include "qgspoint.h" | #include "qgspoint.h" | |||
#include "qgsrectangle.h" | ||||
#include "qgsmaprenderer.h" // definition of QgsLabelingEngineInterface | #include "qgsmaprenderer.h" // definition of QgsLabelingEngineInterface | |||
#include "qgsexpression.h" | #include "qgsexpression.h" | |||
#include "qgsdatadefined.h" | ||||
#include "qgsdiagramrendererv2.h" | ||||
class QgsPalGeometry; | class QgsPalGeometry; | |||
class QgsVectorLayer; | class QgsVectorLayer; | |||
class CORE_EXPORT QgsPalLayerSettings | class CORE_EXPORT QgsPalLayerSettings | |||
{ | { | |||
public: | public: | |||
QgsPalLayerSettings(); | QgsPalLayerSettings(); | |||
QgsPalLayerSettings( const QgsPalLayerSettings& s ); | QgsPalLayerSettings( const QgsPalLayerSettings& s ); | |||
~QgsPalLayerSettings(); | ~QgsPalLayerSettings(); | |||
skipping to change at line 82 | skipping to change at line 86 | |||
}; | }; | |||
enum LinePlacementFlags | enum LinePlacementFlags | |||
{ | { | |||
OnLine = 1, | OnLine = 1, | |||
AboveLine = 2, | AboveLine = 2, | |||
BelowLine = 4, | BelowLine = 4, | |||
MapOrientation = 8 | MapOrientation = 8 | |||
}; | }; | |||
enum QuadrantPosition | ||||
{ | ||||
QuadrantAboveLeft, | ||||
QuadrantAbove, | ||||
QuadrantAboveRight, | ||||
QuadrantLeft, | ||||
QuadrantOver, | ||||
QuadrantRight, | ||||
QuadrantBelowLeft, | ||||
QuadrantBelow, | ||||
QuadrantBelowRight | ||||
}; | ||||
enum UpsideDownLabels | ||||
{ | ||||
Upright, // upside-down labels (90 <= angle < 270) are shown upright | ||||
ShowDefined, // show upside down when rotation is layer- or data-defi | ||||
ned | ||||
ShowAll // show upside down for all labels, including dynamic ones | ||||
}; | ||||
enum DirectionSymbols | ||||
{ | ||||
SymbolLeftRight, // place direction symbols on left/right of label | ||||
SymbolAbove, // place direction symbols on above label | ||||
SymbolBelow // place direction symbols on below label | ||||
}; | ||||
enum MultiLineAlign | ||||
{ | ||||
MultiLeft = 0, | ||||
MultiCenter, | ||||
MultiRight | ||||
}; | ||||
enum ShapeType | ||||
{ | ||||
ShapeRectangle = 0, | ||||
ShapeSquare, | ||||
ShapeEllipse, | ||||
ShapeCircle, | ||||
ShapeSVG | ||||
}; | ||||
enum SizeType | ||||
{ | ||||
SizeBuffer = 0, | ||||
SizeFixed, | ||||
SizePercent | ||||
}; | ||||
enum RotationType | ||||
{ | ||||
RotationSync = 0, | ||||
RotationOffset, | ||||
RotationFixed | ||||
}; | ||||
/** Units used for option sizes, before being converted to rendered siz | ||||
es */ | ||||
enum SizeUnit | ||||
{ | ||||
Points = 0, | ||||
MM, | ||||
MapUnits, | ||||
Percent | ||||
}; | ||||
enum ShadowType | ||||
{ | ||||
ShadowLowest = 0, | ||||
ShadowText, | ||||
ShadowBuffer, | ||||
ShadowShape | ||||
}; | ||||
// update mDataDefinedNames QMap in constructor when adding/deleting en | ||||
um value | ||||
enum DataDefinedProperties | enum DataDefinedProperties | |||
{ | { | |||
// text style | ||||
Size = 0, | Size = 0, | |||
Bold, | Bold = 1, | |||
Italic, | Italic = 2, | |||
Underline, | Underline = 3, | |||
Color, | Color = 4, | |||
Strikeout, | Strikeout = 5, | |||
Family, | Family = 6, | |||
BufferSize, | FontStyle = 21, | |||
BufferColor, | FontSizeUnit = 22, | |||
PositionX, //x-coordinate data defined label position | FontTransp = 18, | |||
PositionY, //y-coordinate data defined label position | FontCase = 27, | |||
Hali, //horizontal alignment for data defined label position (Left, C | FontLetterSpacing = 28, | |||
enter, Right) | FontWordSpacing = 29, | |||
Vali, //vertical alignment for data defined label position (Bottom, B | FontBlendMode = 30, | |||
ase, Half, Cap, Top) | ||||
LabelDistance, | // text formatting | |||
Rotation //data defined rotation (only useful in connection with data | MultiLineWrapChar = 31, | |||
defined position) | MultiLineHeight = 32, | |||
MultiLineAlignment = 33, | ||||
DirSymbDraw = 34, | ||||
DirSymbLeft = 35, | ||||
DirSymbRight = 36, | ||||
DirSymbPlacement = 37, | ||||
DirSymbReverse = 38, | ||||
NumFormat = 39, | ||||
NumDecimals = 40, | ||||
NumPlusSign = 41, | ||||
// text buffer | ||||
BufferDraw = 42, | ||||
BufferSize = 7, | ||||
BufferUnit = 43, | ||||
BufferColor = 8, | ||||
BufferTransp = 19, | ||||
BufferJoinStyle = 44, | ||||
BufferBlendMode = 45, | ||||
// background | ||||
ShapeDraw = 46, | ||||
ShapeKind = 47, | ||||
ShapeSVGFile = 48, | ||||
ShapeSizeType = 49, | ||||
ShapeSizeX = 50, | ||||
ShapeSizeY = 85, | ||||
ShapeSizeUnits = 51, | ||||
ShapeRotationType = 52, | ||||
ShapeRotation = 53, | ||||
ShapeOffset = 54, | ||||
ShapeOffsetUnits = 55, | ||||
ShapeRadii = 56, | ||||
ShapeRadiiUnits = 57, | ||||
ShapeTransparency = 63, | ||||
ShapeBlendMode = 64, | ||||
ShapeFillColor = 58, | ||||
ShapeBorderColor = 59, | ||||
ShapeBorderWidth = 60, | ||||
ShapeBorderWidthUnits = 61, | ||||
ShapeJoinStyle = 62, | ||||
// drop shadow | ||||
ShadowDraw = 65, | ||||
ShadowUnder = 66, | ||||
ShadowOffsetAngle = 67, | ||||
ShadowOffsetDist = 68, | ||||
ShadowOffsetUnits = 69, | ||||
ShadowRadius = 70, | ||||
ShadowRadiusUnits = 71, | ||||
ShadowTransparency = 72, | ||||
ShadowScale = 73, | ||||
ShadowColor = 74, | ||||
ShadowBlendMode = 75, | ||||
// placement | ||||
CentroidWhole = 76, | ||||
OffsetQuad = 77, | ||||
OffsetXY = 78, | ||||
OffsetUnits = 80, | ||||
LabelDistance = 13, | ||||
DistanceUnits = 81, | ||||
OffsetRotation = 82, | ||||
CurvedCharAngleInOut = 83, | ||||
// (data defined only) | ||||
PositionX = 9, //x-coordinate data defined label position | ||||
PositionY = 10, //y-coordinate data defined label position | ||||
Hali = 11, //horizontal alignment for data defined label position (Le | ||||
ft, Center, Right) | ||||
Vali = 12, //vertical alignment for data defined label position (Bott | ||||
om, Base, Half, Cap, Top) | ||||
Rotation = 14, //data defined rotation | ||||
// rendering | ||||
ScaleVisibility = 23, | ||||
MinScale = 16, | ||||
MaxScale = 17, | ||||
FontLimitPixel = 24, | ||||
FontMinPixel = 25, | ||||
FontMaxPixel = 26, | ||||
// (data defined only) | ||||
Show = 15, | ||||
AlwaysShow = 20 | ||||
}; | }; | |||
// whether to label this layer | ||||
bool enabled; | ||||
//-- text style | ||||
QString fieldName; | QString fieldName; | |||
/** Is this label made from a expression string eg FieldName || 'mm' | /** Is this label made from a expression string eg FieldName || 'mm' | |||
*/ | */ | |||
bool isExpression; | bool isExpression; | |||
/** Returns the QgsExpression for this label settings. | /** Returns the QgsExpression for this label settings. | |||
*/ | */ | |||
QgsExpression* getLabelExpression(); | QgsExpression* getLabelExpression(); | |||
Placement placement; | ||||
unsigned int placementFlags; | ||||
QFont textFont; | QFont textFont; | |||
QString textNamedStyle; | ||||
bool fontSizeInMapUnits; //true if font size is in map units (otherwise | ||||
in points) | ||||
QColor textColor; | QColor textColor; | |||
bool enabled; | int textTransp; | |||
int priority; // 0 = low, 10 = high | QPainter::CompositionMode blendMode; | |||
bool obstacle; // whether it's an obstacle | QColor previewBkgrdColor; | |||
double dist; // distance from the feature (in mm) | ||||
double vectorScaleFactor; //scale factor painter units->pixels | //-- text formatting | |||
double rasterCompressFactor; //pixel resolution scale factor | ||||
int scaleMin, scaleMax; // disabled if both are zero | QString wrapChar; | |||
double bufferSize; //buffer size (in mm) | double multilineHeight; //0.0 to 10.0, leading between lines as multipl | |||
QColor bufferColor; | yer of line height | |||
MultiLineAlign multilineAlign; // horizontal alignment of multi-line la | ||||
bels | ||||
// Adds '<' or '>', or user-defined symbol to the label string pointing | ||||
to the | ||||
// direction of the line / polygon ring | ||||
// Works only if Placement == Line | ||||
bool addDirectionSymbol; | ||||
QString leftDirectionSymbol; | ||||
QString rightDirectionSymbol; | ||||
DirectionSymbols placeDirectionSymbol; // whether to place left/right, | ||||
above or below label | ||||
bool reverseDirectionSymbol; | ||||
bool formatNumbers; | bool formatNumbers; | |||
int decimals; | int decimals; | |||
bool plusSign; | bool plusSign; | |||
//-- text buffer | ||||
bool bufferDraw; | ||||
double bufferSize; // buffer size | ||||
bool bufferSizeInMapUnits; //true if buffer is in map units (otherwise | ||||
in mm) | ||||
QColor bufferColor; | ||||
bool bufferNoFill; //set interior of buffer to 100% transparent | ||||
int bufferTransp; | ||||
Qt::PenJoinStyle bufferJoinStyle; | ||||
QPainter::CompositionMode bufferBlendMode; | ||||
//-- shape background | ||||
bool shapeDraw; | ||||
ShapeType shapeType; | ||||
QString shapeSVGFile; | ||||
SizeType shapeSizeType; | ||||
QPointF shapeSize; | ||||
SizeUnit shapeSizeUnits; | ||||
RotationType shapeRotationType; | ||||
double shapeRotation; | ||||
QPointF shapeOffset; | ||||
SizeUnit shapeOffsetUnits; | ||||
QPointF shapeRadii; | ||||
SizeUnit shapeRadiiUnits; | ||||
int shapeTransparency; | ||||
QPainter::CompositionMode shapeBlendMode; | ||||
QColor shapeFillColor; | ||||
QColor shapeBorderColor; | ||||
double shapeBorderWidth; | ||||
SizeUnit shapeBorderWidthUnits; | ||||
Qt::PenJoinStyle shapeJoinStyle; | ||||
//-- drop shadow | ||||
bool shadowDraw; | ||||
ShadowType shadowUnder; | ||||
int shadowOffsetAngle; | ||||
double shadowOffsetDist; | ||||
SizeUnit shadowOffsetUnits; | ||||
bool shadowOffsetGlobal; | ||||
double shadowRadius; | ||||
SizeUnit shadowRadiusUnits; | ||||
bool shadowRadiusAlphaOnly; | ||||
int shadowTransparency; | ||||
int shadowScale; | ||||
QColor shadowColor; | ||||
QPainter::CompositionMode shadowBlendMode; | ||||
//-- placement | ||||
Placement placement; | ||||
unsigned int placementFlags; | ||||
bool centroidWhole; // whether centroid calculated from whole or visibl | ||||
e polygon | ||||
double dist; // distance from the feature (in mm) | ||||
bool distInMapUnits; //true if distance is in map units (otherwise in m | ||||
m) | ||||
// offset labels of point/centroid features default to center | ||||
// move label to quadrant: left/down, don't move, right/up (-1, 0, 1) | ||||
QuadrantPosition quadOffset; | ||||
double xOffset; // offset from point in mm or map units | ||||
double yOffset; // offset from point in mm or map units | ||||
bool labelOffsetInMapUnits; //true if label offset is in map units (oth | ||||
erwise in mm) | ||||
double angleOffset; // rotation applied to offset labels | ||||
bool preserveRotation; // preserve predefined rotation data during labe | ||||
l pin/unpin operations | ||||
double maxCurvedCharAngleIn; // maximum angle between inside curved lab | ||||
el characters (defaults to 20.0, range 20.0 to 60.0) | ||||
double maxCurvedCharAngleOut; // maximum angle between outside curved l | ||||
abel characters (defaults to -20.0, range -20.0 to -95.0) | ||||
int priority; // 0 = low, 10 = high | ||||
//-- rendering | ||||
bool scaleVisibility; | ||||
int scaleMin; | ||||
int scaleMax; | ||||
bool fontLimitPixelSize; // true is label should be limited by fontMinP | ||||
ixelSize/fontMaxPixelSize | ||||
int fontMinPixelSize; // minimum pixel size for showing rendered map un | ||||
it labels (1 - 1000) | ||||
int fontMaxPixelSize; // maximum pixel size for showing rendered map un | ||||
it labels (1 - 10000) | ||||
bool displayAll; // if true, all features will be labelled even though | ||||
overlaps occur | ||||
unsigned int upsidedownLabels; // whether, or how, to show upsidedown l | ||||
abels | ||||
bool labelPerPart; // whether to label every feature's part or only the biggest one | bool labelPerPart; // whether to label every feature's part or only the biggest one | |||
bool mergeLines; | bool mergeLines; | |||
bool limitNumLabels; // whether to limit the number of labels to be dra | ||||
wn | ||||
int maxNumLabels; // maximum number of labels to be drawn | ||||
double minFeatureSize; // minimum feature size to be labelled (in mm) | double minFeatureSize; // minimum feature size to be labelled (in mm) | |||
// Adds '<' or '>' to the label string pointing to the direction of the | bool obstacle; // whether features for layer are obstacles to labels of | |||
line / polygon ring | other layers | |||
// Works only if Placement == Line | ||||
bool addDirectionSymbol; | //-- scale factors | |||
bool fontSizeInMapUnits; //true if font size is in map units (otherwise | double vectorScaleFactor; //scale factor painter units->pixels | |||
in points) | double rasterCompressFactor; //pixel resolution scale factor | |||
bool distInMapUnits; //true if distance is in map units (otherwise in m | ||||
m) | ||||
QString wrapChar; | ||||
// called from register feature hook | // called from register feature hook | |||
void calculateLabelSize( const QFontMetricsF* fm, QString text, double& labelX, double& labelY ); | void calculateLabelSize( const QFontMetricsF* fm, QString text, double& labelX, double& labelY, QgsFeature* f = 0 ); | |||
// implementation of register feature hook | // implementation of register feature hook | |||
void registerFeature( QgsVectorLayer* layer, QgsFeature& f, const QgsRe nderContext& context ); | void registerFeature( QgsVectorLayer* layer, QgsFeature& f, const QgsRe nderContext& context ); | |||
void readFromLayer( QgsVectorLayer* layer ); | void readFromLayer( QgsVectorLayer* layer ); | |||
void writeToLayer( QgsVectorLayer* layer ); | void writeToLayer( QgsVectorLayer* layer ); | |||
/**Set a property as data defined*/ | /** Get a data defined property pointer | |||
void setDataDefinedProperty( DataDefinedProperties p, int attributeInde | * @note added in 1.9, helpful for Python access | |||
x ); | */ | |||
/**Set a property to static instead data defined*/ | QgsDataDefined* dataDefinedProperty( QgsPalLayerSettings::DataDefinedPr | |||
void removeDataDefinedProperty( DataDefinedProperties p ); | operties p ); | |||
/** Set a property as data defined | ||||
* @note added in 1.9, helpful for Python access | ||||
*/ | ||||
void setDataDefinedProperty( QgsPalLayerSettings::DataDefinedProperties | ||||
p, | ||||
bool active, bool useExpr, const QString& | ||||
expr, const QString& field ); | ||||
/** Set a property to static instead data defined */ | ||||
void removeDataDefinedProperty( QgsPalLayerSettings::DataDefinedPropert | ||||
ies p ); | ||||
/** Convert old property value to new one as delimited values | ||||
* @note not available in python bindings; added in 1.9, as temporary s | ||||
olution until refactoring of project settings | ||||
*/ | ||||
QString updateDataDefinedString( const QString& value ); | ||||
/** Get property value as separate values split into Qmap | ||||
* @note not available in python bindings; added in 1.9 | ||||
*/ | ||||
QMap<QString, QString> dataDefinedMap( QgsPalLayerSettings::DataDefined | ||||
Properties p ) const; | ||||
/** Get data defined property value from expression string or attribute | ||||
field name | ||||
* @returns value inside QVariant | ||||
* @note not available in python bindings; added in 1.9 | ||||
*/ | ||||
QVariant dataDefinedValue( QgsPalLayerSettings::DataDefinedProperties p | ||||
, QgsFeature& f, const QgsFields& fields ) const; | ||||
/** Get data defined property value from expression string or attribute | ||||
field name | ||||
* @returns true/false whether result is null or invalid | ||||
* @note not available in python bindings; added in 1.9 | ||||
*/ | ||||
bool dataDefinedEvaluate( QgsPalLayerSettings::DataDefinedProperties p, | ||||
QVariant& exprVal ) const; | ||||
/** Whether data definition is active | ||||
*/ | ||||
bool dataDefinedIsActive( QgsPalLayerSettings::DataDefinedProperties p | ||||
) const; | ||||
/** Whether data definition is set to use an expression | ||||
*/ | ||||
bool dataDefinedUseExpression( QgsPalLayerSettings::DataDefinedProperti | ||||
es p ) const; | ||||
/** Map of current data defined properties | ||||
*/ | ||||
QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined* > dat | ||||
aDefinedProperties; | ||||
/** Calculates pixel size (considering output size should be in pixel o | ||||
r map units, scale factors and optionally oversampling) | ||||
* @param size size to convert | ||||
* @param c rendercontext | ||||
* @param unit SizeUnit enum value of size | ||||
* @param rasterfactor whether to consider oversampling | ||||
* @return font pixel size | ||||
*/ | ||||
int sizeToPixel( double size, const QgsRenderContext& c , SizeUnit unit | ||||
, bool rasterfactor = false ) const; | ||||
/** Calculates size (considering output size should be in pixel or map | ||||
units, scale factors and optionally oversampling) | ||||
* @param size size to convert | ||||
* @param c rendercontext | ||||
* @param unit SizeUnit enum value of size | ||||
* @param rasterfactor whether to consider oversampling | ||||
* @return size that will render, as double | ||||
* @note added in 1.9, as a better precision replacement for sizeToPixe | ||||
l | ||||
*/ | ||||
double scaleToPixelContext( double size, const QgsRenderContext& c, Siz | ||||
eUnit unit, bool rasterfactor = false ) const; | ||||
/** Map of data defined enum to names and old-style indecies | ||||
* The QPair contains a new string for layer property key, and a refere | ||||
nce to old-style numeric key (< QGIS 2.0) | ||||
* @note not available in python bindings; added in 1.9 | ||||
*/ | ||||
QMap<QgsPalLayerSettings::DataDefinedProperties, QPair<QString, int> > | ||||
dataDefinedNames() const { return mDataDefinedNames; } | ||||
// temporary stuff: set when layer gets prepared | // temporary stuff: set when layer gets prepared or labeled | |||
// NOTE: not in Python binding | ||||
pal::Layer* palLayer; | pal::Layer* palLayer; | |||
QgsFeature* mCurFeat; | ||||
const QgsFields* mCurFields; | ||||
int fieldIndex; | int fieldIndex; | |||
QFontMetricsF* fontMetrics; | ||||
const QgsMapToPixel* xform; | const QgsMapToPixel* xform; | |||
const QgsCoordinateTransform* ct; | const QgsCoordinateTransform* ct; | |||
QgsPoint ptZero, ptOne; | QgsPoint ptZero, ptOne; | |||
QList<QgsPalGeometry*> geometries; | QList<QgsPalGeometry*> geometries; | |||
QgsGeometry* extentGeom; | QgsGeometry* extentGeom; | |||
int mFeaturesToLabel; // total features that will probably be labeled, | ||||
may be less (figured before PAL) | ||||
int mFeatsSendingToPal; // total features tested for sending into PAL ( | ||||
relative to maxNumLabels) | ||||
int mFeatsRegPal; // number of features registered in PAL, when using l | ||||
imitNumLabels | ||||
/**Stores field indices for data defined layer properties*/ | QString mTextFontFamily; | |||
QMap< DataDefinedProperties, int > dataDefinedProperties; | bool mTextFontFound; | |||
/**Calculates pixel size (considering output size should be in pixel or | bool showingShadowRects; // whether to show debug rectangles for drop s | |||
map units, scale factors and oversampling) | hadows | |||
@param size size to convert | ||||
@param c rendercontext | ||||
@return font pixel size*/ | ||||
int sizeToPixel( double size, const QgsRenderContext& c ) const; | ||||
private: | private: | |||
void readDataDefinedPropertyMap( QgsVectorLayer* layer, | ||||
QMap < QgsPalLayerSettings::DataDefine | ||||
dProperties, | ||||
QgsDataDefined* > & propertyMap ); | ||||
void writeDataDefinedPropertyMap( QgsVectorLayer* layer, | ||||
const QMap < QgsPalLayerSettings::Dat | ||||
aDefinedProperties, | ||||
QgsDataDefined* > & propertyMap ); | ||||
void readDataDefinedProperty( QgsVectorLayer* layer, | ||||
QgsPalLayerSettings::DataDefinedPropertie | ||||
s p, | ||||
QMap < QgsPalLayerSettings::DataDefinedPr | ||||
operties, | ||||
QgsDataDefined* > & propertyMap ); | ||||
// convenience data defined evaluation function | ||||
bool dataDefinedValEval( const QString& valType, | ||||
QgsPalLayerSettings::DataDefinedProperties p, | ||||
QVariant& exprVal ); | ||||
void parseTextStyle( QFont& labelFont, | ||||
QgsPalLayerSettings::SizeUnit fontunits, | ||||
const QgsRenderContext& context ); | ||||
void parseTextBuffer(); | ||||
void parseTextFormatting(); | ||||
void parseShapeBackground(); | ||||
void parseDropShadow(); | ||||
/**Checks if a feature is larger than a minimum size (in mm) | /**Checks if a feature is larger than a minimum size (in mm) | |||
@return true if above size, false if below*/ | @return true if above size, false if below*/ | |||
bool checkMinimumSizeMM( const QgsRenderContext& ct, QgsGeometry* geom, double minSize ) const; | bool checkMinimumSizeMM( const QgsRenderContext& ct, QgsGeometry* geom, double minSize ) const; | |||
QMap<DataDefinedProperties, QVariant> dataDefinedValues; | ||||
QgsExpression* expression; | QgsExpression* expression; | |||
QMap<QgsPalLayerSettings::DataDefinedProperties, QPair<QString, int> > | ||||
mDataDefinedNames; | ||||
QFontDatabase mFontDB; | ||||
}; | }; | |||
class CORE_EXPORT QgsLabelCandidate | class CORE_EXPORT QgsLabelCandidate | |||
{ | { | |||
public: | public: | |||
QgsLabelCandidate( QRectF r, double c ): rect( r ), cost( c ) {} | QgsLabelCandidate( QRectF r, double c ): rect( r ), cost( c ) {} | |||
QRectF rect; | QRectF rect; | |||
double cost; | double cost; | |||
}; | }; | |||
/** \ingroup core | ||||
* Maintains current state of more grainular and temporal values when crea | ||||
ting/painting | ||||
* component parts of an individual label (e.g. buffer, background, shadow | ||||
, etc.). | ||||
*/ | ||||
class CORE_EXPORT QgsLabelComponent | ||||
{ | ||||
public: | ||||
QgsLabelComponent(): mText( QString() ) | ||||
, mOrigin( QgsPoint() ) | ||||
, mUseOrigin( false ) | ||||
, mRotation( 0.0 ) | ||||
, mRotationOffset( 0.0 ) | ||||
, mUseRotation( false ) | ||||
, mCenter( QgsPoint() ) | ||||
, mUseCenter( false ) | ||||
, mSize( QgsPoint() ) | ||||
, mOffset( QgsPoint() ) | ||||
, mPicture( 0 ) | ||||
, mPictureBuffer( 0.0 ) | ||||
, mDpiRatio( 1.0 ) | ||||
{} | ||||
const QString& text() { return mText; } | ||||
void setText( const QString& text ) { mText = text; } | ||||
const QgsPoint& origin() { return mOrigin; } | ||||
void setOrigin( QgsPoint point ) { mOrigin = point; } | ||||
bool useOrigin() const { return mUseOrigin; } | ||||
void setUseOrigin( bool use ) { mUseOrigin = use; } | ||||
double rotation() const { return mRotation; } | ||||
void setRotation( double rotation ) { mRotation = rotation; } | ||||
double rotationOffset() const { return mRotationOffset; } | ||||
void setRotationOffset( double rotation ) { mRotationOffset = rotation; | ||||
} | ||||
bool useRotation() const { return mUseRotation; } | ||||
void setUseRotation( bool use ) { mUseRotation = use; } | ||||
const QgsPoint& center() { return mCenter; } | ||||
void setCenter( QgsPoint point ) { mCenter = point; } | ||||
bool useCenter() const { return mUseCenter; } | ||||
void setUseCenter( bool use ) { mUseCenter = use; } | ||||
const QgsPoint& size() { return mSize; } | ||||
void setSize( QgsPoint point ) { mSize = point; } | ||||
const QgsPoint& offset() { return mOffset; } | ||||
void setOffset( QgsPoint point ) { mOffset = point; } | ||||
const QPicture* picture() { return mPicture; } | ||||
void setPicture( QPicture* picture ) { mPicture = picture; } | ||||
double pictureBuffer() const { return mPictureBuffer; } | ||||
void setPictureBuffer( double buffer ) { mPictureBuffer = buffer; } | ||||
double dpiRatio() const { return mDpiRatio; } | ||||
void setDpiRatio( double ratio ) { mDpiRatio = ratio; } | ||||
private: | ||||
// current label component text, | ||||
// e.g. single line in a multi-line label or charcater in curved labeli | ||||
ng | ||||
QString mText; | ||||
// current origin point for painting (generally current painter rotatio | ||||
n point) | ||||
QgsPoint mOrigin; | ||||
// whether to translate the painter to supplied origin | ||||
bool mUseOrigin; | ||||
// any rotation to be applied to painter (in radians) | ||||
double mRotation; | ||||
// any rotation to be applied to painter (in radians) after initial rot | ||||
ation | ||||
double mRotationOffset; | ||||
// whether to use the rotation to rotate the painter | ||||
bool mUseRotation; | ||||
// current center point of label compnent, after rotation | ||||
QgsPoint mCenter; | ||||
// whether to translate the painter to supplied origin based upon cente | ||||
r | ||||
bool mUseCenter; | ||||
// width and height of label component, transformed and ready for paint | ||||
ing | ||||
QgsPoint mSize; | ||||
// any translation offsets to be applied before painting, transformed a | ||||
nd ready for painting | ||||
QgsPoint mOffset; | ||||
// a stored QPicture of painting for the component | ||||
QPicture* mPicture; | ||||
// buffer for component to accommodate graphic items ignored by QPictur | ||||
e, | ||||
// e.g. half-width of an applied QPen, which would extend beyond boundi | ||||
ngRect() of QPicture | ||||
double mPictureBuffer; | ||||
// a ratio of native painter dpi and that of rendering context's painte | ||||
r | ||||
double mDpiRatio; | ||||
}; | ||||
class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface | class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface | |||
{ | { | |||
public: | public: | |||
enum DrawLabelType | ||||
{ | ||||
LabelText = 0, | ||||
LabelBuffer, | ||||
LabelShape, | ||||
LabelSVG, | ||||
LabelShadow | ||||
}; | ||||
QgsPalLabeling(); | QgsPalLabeling(); | |||
~QgsPalLabeling(); | ~QgsPalLabeling(); | |||
QgsPalLayerSettings& layer( const QString& layerName ); | QgsPalLayerSettings& layer( const QString& layerName ); | |||
void numCandidatePositions( int& candPoint, int& candLine, int& candPol ygon ); | void numCandidatePositions( int& candPoint, int& candLine, int& candPol ygon ); | |||
void setNumCandidatePositions( int candPoint, int candLine, int candPol ygon ); | void setNumCandidatePositions( int candPoint, int candLine, int candPol ygon ); | |||
enum Search { Chain, Popmusic_Tabu, Popmusic_Chain, Popmusic_Tabu_Chain , Falp }; | enum Search { Chain, Popmusic_Tabu, Popmusic_Chain, Popmusic_Tabu_Chain , Falp }; | |||
void setSearchMethod( Search s ); | void setSearchMethod( Search s ); | |||
Search searchMethod() const; | Search searchMethod() const; | |||
bool isShowingCandidates() const { return mShowingCandidates; } | bool isShowingCandidates() const { return mShowingCandidates; } | |||
void setShowingCandidates( bool showing ) { mShowingCandidates = showin g; } | void setShowingCandidates( bool showing ) { mShowingCandidates = showin g; } | |||
const QList<QgsLabelCandidate>& candidates() { return mCandidates; } | const QList<QgsLabelCandidate>& candidates() { return mCandidates; } | |||
bool isShowingShadowRectangles() const { return mShowingShadowRects; } | ||||
void setShowingShadowRectangles( bool showing ) { mShowingShadowRects = | ||||
showing; } | ||||
bool isShowingAllLabels() const { return mShowingAllLabels; } | bool isShowingAllLabels() const { return mShowingAllLabels; } | |||
void setShowingAllLabels( bool showing ) { mShowingAllLabels = showing; } | void setShowingAllLabels( bool showing ) { mShowingAllLabels = showing; } | |||
// implemented methods from labeling engine interface | // implemented methods from labeling engine interface | |||
//! called when we're going to start with rendering | //! called when we're going to start with rendering | |||
virtual void init( QgsMapRenderer* mr ); | virtual void init( QgsMapRenderer* mr ); | |||
//! called to find out whether the layer is used for labeling | //! called to find out whether the layer is used for labeling | |||
virtual bool willUseLayer( QgsVectorLayer* layer ); | virtual bool willUseLayer( QgsVectorLayer* layer ); | |||
//! clears all PAL layer settings for registered layers | ||||
//! @note: this method was added in version 1.9 | ||||
virtual void clearActiveLayers(); | ||||
//! clears data defined objects from PAL layer settings for a registere | ||||
d layer | ||||
//! @note: this method was added in version 1.9 | ||||
virtual void clearActiveLayer( QgsVectorLayer* layer ); | ||||
//! hook called when drawing layer before issuing select() | //! hook called when drawing layer before issuing select() | |||
virtual int prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices , QgsRenderContext& ctx ); | virtual int prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices , QgsRenderContext& ctx ); | |||
//! adds a diagram layer to the labeling engine | //! adds a diagram layer to the labeling engine | |||
virtual int addDiagramLayer( QgsVectorLayer* layer, QgsDiagramLayerSett ings *s ); | virtual int addDiagramLayer( QgsVectorLayer* layer, QgsDiagramLayerSett ings *s ); | |||
//! hook called when drawing for every feature in a layer | //! hook called when drawing for every feature in a layer | |||
virtual void registerFeature( QgsVectorLayer* layer, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() ); | virtual void registerFeature( QgsVectorLayer* layer, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() ); | |||
virtual void registerDiagramFeature( QgsVectorLayer* layer, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() ); | virtual void registerDiagramFeature( QgsVectorLayer* layer, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() ); | |||
//! called when the map is drawn and labels should be placed | //! called when the map is drawn and labels should be placed | |||
virtual void drawLabeling( QgsRenderContext& context ); | virtual void drawLabeling( QgsRenderContext& context ); | |||
//! called when we're done with rendering | //! called when we're done with rendering | |||
virtual void exit(); | virtual void exit(); | |||
//! return infos about labels at a given (map) position | //! return infos about labels at a given (map) position | |||
virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ); | virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ); | |||
//! return infos about labels within a given (map) rectangle | ||||
virtual QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r | ||||
); | ||||
//! called when passing engine among map renderers | //! called when passing engine among map renderers | |||
virtual QgsLabelingEngineInterface* clone(); | virtual QgsLabelingEngineInterface* clone(); | |||
//! @note not available in python bindings | ||||
void drawLabelCandidateRect( pal::LabelPosition* lp, QPainter* painter, const QgsMapToPixel* xform ); | void drawLabelCandidateRect( pal::LabelPosition* lp, QPainter* painter, const QgsMapToPixel* xform ); | |||
//!drawLabel | //!drawLabel | |||
void drawLabel( pal::LabelPosition* label, QPainter* painter, const QFo | //! @note not available in python bindings | |||
nt& f, const QColor& c, const QgsMapToPixel* xform, double bufferSize = -1, | void drawLabel( pal::LabelPosition* label, QgsRenderContext& context, Q | |||
const QColor& bufferColor = QColor( 255, 255, 255 ), bo | gsPalLayerSettings& tmpLyr, DrawLabelType drawType ); | |||
ol drawBuffer = false ); | ||||
static void drawLabelBuffer( QPainter* p, QString text, const QFont& fo | ||||
nt, double size, QColor color ); | ||||
protected: | ||||
void initPal(); | static void drawLabelBuffer( QgsRenderContext& context, | |||
QgsLabelComponent component, | ||||
const QgsPalLayerSettings& tmpLyr ); | ||||
static void drawLabelBackground( QgsRenderContext& context, | ||||
QgsLabelComponent component, | ||||
const QgsPalLayerSettings& tmpLyr ); | ||||
static void drawLabelShadow( QgsRenderContext& context, | ||||
QgsLabelComponent component, | ||||
const QgsPalLayerSettings& tmpLyr ); | ||||
//! load/save engine settings to project file | ||||
//! @note added in QGIS 1.9 | ||||
void loadEngineSettings(); | ||||
void saveEngineSettings(); | ||||
void clearEngineSettings(); | ||||
bool isStoredWithProject() const { return mSavedWithProject; } | ||||
void setStoredWithProject( bool store ) { mSavedWithProject = store; } | ||||
protected: | protected: | |||
// update temporary QgsPalLayerSettings with any data defined text styl | ||||
e values | ||||
void dataDefinedTextStyle( QgsPalLayerSettings& tmpLyr, | ||||
const QMap< QgsPalLayerSettings::DataDefined | ||||
Properties, QVariant >& ddValues ); | ||||
// update temporary QgsPalLayerSettings with any data defined text form | ||||
atting values | ||||
void dataDefinedTextFormatting( QgsPalLayerSettings& tmpLyr, | ||||
const QMap< QgsPalLayerSettings::DataDe | ||||
finedProperties, QVariant >& ddValues ); | ||||
// update temporary QgsPalLayerSettings with any data defined text buff | ||||
er values | ||||
void dataDefinedTextBuffer( QgsPalLayerSettings& tmpLyr, | ||||
const QMap< QgsPalLayerSettings::DataDefine | ||||
dProperties, QVariant >& ddValues ); | ||||
// update temporary QgsPalLayerSettings with any data defined shape bac | ||||
kground values | ||||
void dataDefinedShapeBackground( QgsPalLayerSettings& tmpLyr, | ||||
const QMap< QgsPalLayerSettings::DataD | ||||
efinedProperties, QVariant >& ddValues ); | ||||
// update temporary QgsPalLayerSettings with any data defined drop shad | ||||
ow values | ||||
void dataDefinedDropShadow( QgsPalLayerSettings& tmpLyr, | ||||
const QMap< QgsPalLayerSettings::DataDefine | ||||
dProperties, QVariant >& ddValues ); | ||||
// hashtable of layer settings, being filled during labeling | // hashtable of layer settings, being filled during labeling | |||
QHash<QgsVectorLayer*, QgsPalLayerSettings> mActiveLayers; | QHash<QgsVectorLayer*, QgsPalLayerSettings> mActiveLayers; | |||
// hashtable of active diagram layers | // hashtable of active diagram layers | |||
QHash<QgsVectorLayer*, QgsDiagramLayerSettings> mActiveDiagramLayers; | QHash<QgsVectorLayer*, QgsDiagramLayerSettings> mActiveDiagramLayers; | |||
QgsPalLayerSettings mInvalidLayerSettings; | QgsPalLayerSettings mInvalidLayerSettings; | |||
QgsMapRenderer* mMapRenderer; | QgsMapRenderer* mMapRenderer; | |||
int mCandPoint, mCandLine, mCandPolygon; | int mCandPoint, mCandLine, mCandPolygon; | |||
Search mSearch; | Search mSearch; | |||
pal::Pal* mPal; | pal::Pal* mPal; | |||
// list of candidates from last labeling | // list of candidates from last labeling | |||
QList<QgsLabelCandidate> mCandidates; | QList<QgsLabelCandidate> mCandidates; | |||
bool mShowingCandidates; | bool mShowingCandidates; | |||
bool mShowingAllLabels; // whether to avoid collisions or not | bool mShowingAllLabels; // whether to avoid collisions or not | |||
bool mSavedWithProject; // whether engine settings have been read from | ||||
project file | ||||
bool mShowingShadowRects; // whether to show debugging rectangles for d | ||||
rop shadows | ||||
QgsLabelSearchTree* mLabelSearchTree; | QgsLabelSearchTree* mLabelSearchTree; | |||
}; | }; | |||
#endif // QGSPALLABELING_H | #endif // QGSPALLABELING_H | |||
End of changes. 38 change blocks. | ||||
65 lines changed or deleted | 657 lines changed or added | |||
qgspenstylecombobox.h | qgspenstylecombobox.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgspenstylecombobox.h | qgspenstylecombobox.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSPENSTYLECOMBOBOX_H | #ifndef QGSPENSTYLECOMBOBOX_H | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgspluginlayer.h | qgspluginlayer.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgspluginlayer.h | qgspluginlayer.h | |||
--------------------- | --------------------- | |||
begin : January 2010 | begin : January 2010 | |||
copyright : (C) 2010 by Martin Dobias | copyright : (C) 2010 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSPLUGINLAYER_H | #ifndef QGSPLUGINLAYER_H | |||
#define QGSPLUGINLAYER_H | #define QGSPLUGINLAYER_H | |||
skipping to change at line 40 | skipping to change at line 40 | |||
class CORE_EXPORT QgsPluginLayer : public QgsMapLayer | class CORE_EXPORT QgsPluginLayer : public QgsMapLayer | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsPluginLayer( QString layerType, QString layerName = QString() ); | QgsPluginLayer( QString layerType, QString layerName = QString() ); | |||
/** return plugin layer type (the same as used in QgsPluginLayerRegistr y) */ | /** return plugin layer type (the same as used in QgsPluginLayerRegistr y) */ | |||
QString pluginLayerType(); | QString pluginLayerType(); | |||
void setExtent( const QgsRectangle & extent ); | void setExtent( const QgsRectangle &extent ); | |||
protected: | protected: | |||
QString mPluginLayerType; | QString mPluginLayerType; | |||
}; | }; | |||
#endif // QGSPLUGINLAYER_H | #endif // QGSPLUGINLAYER_H | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
qgspoint.h | qgspoint.h | |||
---|---|---|---|---|
skipping to change at line 136 | skipping to change at line 136 | |||
//! As above but with precision for string representation of a point | //! As above but with precision for string representation of a point | |||
QString toString( int thePrecision ) const; | QString toString( int thePrecision ) const; | |||
/** Return a string representation as degrees minutes seconds. | /** Return a string representation as degrees minutes seconds. | |||
* Its up to the calling function to ensure that this point can | * Its up to the calling function to ensure that this point can | |||
* be meaningfully represented in this form. | * be meaningfully represented in this form. | |||
* @note added in QGIS 1.4 | * @note added in QGIS 1.4 | |||
*/ | */ | |||
QString toDegreesMinutesSeconds( int thePrecision ) const; | QString toDegreesMinutesSeconds( int thePrecision ) const; | |||
/** Return a string representation as degrees minutes. | ||||
* Its up to the calling function to ensure that this point can | ||||
* be meaningfully represented in this form. | ||||
* @note added in QGIS 1.9 | ||||
*/ | ||||
QString toDegreesMinutes( int thePrecision ) const; | ||||
/*! Return the well known text representation for the point. | /*! Return the well known text representation for the point. | |||
* The wkt is created without an SRID. | * The wkt is created without an SRID. | |||
* @return Well known text in the form POINT(x y) | * @return Well known text in the form POINT(x y) | |||
*/ | */ | |||
QString wellKnownText() const; | QString wellKnownText() const; | |||
/**Returns the squared distance between this point and x,y*/ | /**Returns the squared distance between this point and x,y*/ | |||
double sqrDist( double x, double y ) const; | double sqrDist( double x, double y ) const; | |||
/**Returns the squared distance between this and other point*/ | /**Returns the squared distance between this and other point*/ | |||
skipping to change at line 162 | skipping to change at line 169 | |||
/**Calculates azimut between this point and other one (clockwise in deg ree, starting from north) | /**Calculates azimut between this point and other one (clockwise in deg ree, starting from north) | |||
@note: this function has been added in version 1.7*/ | @note: this function has been added in version 1.7*/ | |||
double azimuth( const QgsPoint& other ); | double azimuth( const QgsPoint& other ); | |||
//! equality operator | //! equality operator | |||
bool operator==( const QgsPoint &other ); | bool operator==( const QgsPoint &other ); | |||
//! Inequality operator | //! Inequality operator | |||
bool operator!=( const QgsPoint &other ) const; | bool operator!=( const QgsPoint &other ) const; | |||
//! Assignment | ||||
QgsPoint & operator=( const QgsPoint &other ); | ||||
//! Multiply x and y by the given value | //! Multiply x and y by the given value | |||
void multiply( const double& scalar ); | void multiply( const double& scalar ); | |||
//! Test if this point is on the segment defined by points a, b | //! Test if this point is on the segment defined by points a, b | |||
//! @return 0 if this point is not on the open ray through a and b, | //! @return 0 if this point is not on the open ray through a and b, | |||
//! 1 if point is on open ray a, 2 if point is within line segment, | //! 1 if point is on open ray a, 2 if point is within line segment, | |||
//! 3 if point is on open ray b. | //! 3 if point is on open ray b. | |||
int onSegment( const QgsPoint& a, const QgsPoint& b ) const; | int onSegment( const QgsPoint& a, const QgsPoint& b ) const; | |||
//! Assignment | ||||
QgsPoint & operator=( const QgsPoint &other ); | ||||
QgsVector operator-( QgsPoint p ) const { return QgsVector( m_x - p.m_x , m_y - p.m_y ); } | QgsVector operator-( QgsPoint p ) const { return QgsVector( m_x - p.m_x , m_y - p.m_y ); } | |||
QgsPoint &operator+=( const QgsVector &v ) { *this = *this + v; return *this; } | QgsPoint &operator+=( const QgsVector &v ) { *this = *this + v; return *this; } | |||
QgsPoint &operator-=( const QgsVector &v ) { *this = *this - v; return *this; } | QgsPoint &operator-=( const QgsVector &v ) { *this = *this - v; return *this; } | |||
QgsPoint operator+( const QgsVector &v ) const { return QgsPoint( m_x + v.x(), m_y + v.y() ); } | QgsPoint operator+( const QgsVector &v ) const { return QgsPoint( m_x + v.x(), m_y + v.y() ); } | |||
QgsPoint operator-( const QgsVector &v ) const { return QgsPoint( m_x - v.x(), m_y - v.y() ); } | QgsPoint operator-( const QgsVector &v ) const { return QgsPoint( m_x - v.x(), m_y - v.y() ); } | |||
private: | private: | |||
//! x coordinate | //! x coordinate | |||
double m_x; | double m_x; | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 10 lines changed or added | |||
qgspointdisplacementrendererwidget.h | qgspointdisplacementrendererwidget.h | |||
---|---|---|---|---|
skipping to change at line 49 | skipping to change at line 49 | |||
void blockAllSignals( bool block ); | void blockAllSignals( bool block ); | |||
void updateCenterIcon(); | void updateCenterIcon(); | |||
void setupBlankUi( const QString& layerName ); | void setupBlankUi( const QString& layerName ); | |||
private slots: | private slots: | |||
void on_mLabelFieldComboBox_currentIndexChanged( const QString& text ); | void on_mLabelFieldComboBox_currentIndexChanged( const QString& text ); | |||
void on_mRendererComboBox_currentIndexChanged( int index ); | void on_mRendererComboBox_currentIndexChanged( int index ); | |||
void on_mLabelFontButton_clicked(); | void on_mLabelFontButton_clicked(); | |||
void on_mCircleWidthSpinBox_valueChanged( double d ); | void on_mCircleWidthSpinBox_valueChanged( double d ); | |||
void on_mCircleColorButton_clicked(); | void on_mCircleColorButton_colorChanged( const QColor& newColor ); | |||
void on_mDistanceSpinBox_valueChanged( double d ); | void on_mDistanceSpinBox_valueChanged( double d ); | |||
void on_mLabelColorButton_clicked(); | void on_mLabelColorButton_colorChanged( const QColor& newColor ); | |||
void on_mCircleModificationSpinBox_valueChanged( double d ); | void on_mCircleModificationSpinBox_valueChanged( double d ); | |||
void on_mScaleDependentLabelsCheckBox_stateChanged( int state ); | void on_mScaleDependentLabelsCheckBox_stateChanged( int state ); | |||
void on_mMaxScaleDenominatorEdit_textChanged( const QString & text ); | void on_mMaxScaleDenominatorEdit_textChanged( const QString & text ); | |||
void on_mCenterSymbolPushButton_clicked(); | void on_mCenterSymbolPushButton_clicked(); | |||
void on_mRendererSettingsButton_clicked(); | void on_mRendererSettingsButton_clicked(); | |||
}; | }; | |||
#endif // QGSPOINTDISPLACEMENTRENDERERWIDGET_H | #endif // QGSPOINTDISPLACEMENTRENDERERWIDGET_H | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
qgsproject.h | qgsproject.h | |||
---|---|---|---|---|
skipping to change at line 31 | skipping to change at line 31 | |||
#ifndef QGSPROJECT_H | #ifndef QGSPROJECT_H | |||
#define QGSPROJECT_H | #define QGSPROJECT_H | |||
#include <memory> | #include <memory> | |||
#include "qgsprojectversion.h" | #include "qgsprojectversion.h" | |||
#include <QHash> | #include <QHash> | |||
#include <QList> | #include <QList> | |||
#include <QObject> | #include <QObject> | |||
#include <QPair> | #include <QPair> | |||
//for the snap settings | ||||
#include "qgssnapper.h" | ||||
#include "qgstolerance.h" | ||||
//#include <QDomDocument> | //#include <QDomDocument> | |||
class QFileInfo; | class QFileInfo; | |||
class QDomDocument; | class QDomDocument; | |||
class QDomElement; | class QDomElement; | |||
class QDomNode; | class QDomNode; | |||
class QgsMapLayer; | class QgsMapLayer; | |||
class QgsProjectBadLayerHandler; | class QgsProjectBadLayerHandler; | |||
class QgsVectorLayer; | class QgsVectorLayer; | |||
skipping to change at line 79 | skipping to change at line 83 | |||
/// access to canonical QgsProject instance | /// access to canonical QgsProject instance | |||
static QgsProject * instance(); | static QgsProject * instance(); | |||
/** | /** | |||
Every project has an associated title string | Every project has an associated title string | |||
@todo However current dialogs don't allow setting of it yet | @todo However current dialogs don't allow setting of it yet | |||
*/ | */ | |||
//@{ | //@{ | |||
void title( QString const & title ); | void title( const QString & title ); | |||
/** returns title */ | /** returns title */ | |||
QString const & title() const; | const QString & title() const; | |||
//@} | //@} | |||
/** | /** | |||
the dirty flag is true if the project has been modified since the la st | the dirty flag is true if the project has been modified since the la st | |||
write() | write() | |||
*/ | */ | |||
//@{ | //@{ | |||
bool isDirty() const; | bool isDirty() const; | |||
void dirty( bool b ); | void dirty( bool b ); | |||
//@} | //@} | |||
/** | /** | |||
Every project has an associated file that contains its XML | Every project has an associated file that contains its XML | |||
*/ | */ | |||
//@{ | //@{ | |||
void setFileName( QString const & name ); | void setFileName( const QString & name ); | |||
/** returns file name */ | /** returns file name */ | |||
QString fileName() const; | QString fileName() const; | |||
//@} | //@} | |||
/** read project file | /** read project file | |||
@note Any current plug-in state is erased | @note Any current plug-in state is erased | |||
@note dirty set to false after successful invocation | @note dirty set to false after successful invocation | |||
skipping to change at line 131 | skipping to change at line 135 | |||
@note | @note | |||
- Gets the extents | - Gets the extents | |||
- Creates maplayers | - Creates maplayers | |||
- Registers maplayers | - Registers maplayers | |||
@note it's presumed that the caller has already reset the map canvas , map registry, and legend | @note it's presumed that the caller has already reset the map canvas , map registry, and legend | |||
*/ | */ | |||
//@{ | //@{ | |||
bool read( QFileInfo const & file ); | bool read( const QFileInfo & file ); | |||
bool read( ); | bool read(); | |||
//@} | //@} | |||
/** read the layer described in the associated Dom node | /** read the layer described in the associated Dom node | |||
@param layerNode represents a QgsProject Dom node that maps to a specific layer. | @param layerNode represents a QgsProject Dom node that maps to a specific layer. | |||
QgsProject raises an exception when one of the QgsProject::read() | QgsProject raises an exception when one of the QgsProject::read() | |||
implementations fails. Since the read()s are invoked from qgisapp, | implementations fails. Since the read()s are invoked from qgisapp, | |||
then qgisapp handles the exception. It prompts the user for the ne w | then qgisapp handles the exception. It prompts the user for the ne w | |||
location of the data, if any. If there is a new location, the Dom | location of the data, if any. If there is a new location, the Dom | |||
skipping to change at line 159 | skipping to change at line 163 | |||
/** write project file | /** write project file | |||
XXX How to best get read access to Qgis state? Actually we can fina gle | XXX How to best get read access to Qgis state? Actually we can fina gle | |||
that by searching for qgisapp in object hiearchy. | that by searching for qgisapp in object hiearchy. | |||
@note file name argument implicitly sets file | @note file name argument implicitly sets file | |||
@note dirty set to false after successful invocation | @note dirty set to false after successful invocation | |||
*/ | */ | |||
//@{ | //@{ | |||
bool write( QFileInfo const & file ); | bool write( const QFileInfo & file ); | |||
bool write( ); | bool write(); | |||
//@} | //@} | |||
/// syntactic sugar for property lists | /// syntactic sugar for property lists | |||
// DEPRECATED typedef QPair< QString, QVariant > PropertyValue; | // DEPRECATED typedef QPair< QString, QVariant > PropertyValue; | |||
// DEPRECATED typedef QValueList< PropertyValue > Properties; | // DEPRECATED typedef QValueList< PropertyValue > Properties; | |||
/** extra properties, typically added by plug-ins | /** extra properties, typically added by plug-ins | |||
This allows for extra properties to be associated with projects. Th ink | This allows for extra properties to be associated with projects. Th ink | |||
of it as a registry bound to a project. | of it as a registry bound to a project. | |||
skipping to change at line 204 | skipping to change at line 208 | |||
void clearProperties(); | void clearProperties(); | |||
/* key value mutators | /* key value mutators | |||
keys would be the familiar QSettings-like '/' delimited entries, impl ying | keys would be the familiar QSettings-like '/' delimited entries, impl ying | |||
a hierarchy of keys and corresponding values | a hierarchy of keys and corresponding values | |||
@note The key string <em>must</em> include '/'s. E.g., "/foo" not "f oo". | @note The key string <em>must</em> include '/'s. E.g., "/foo" not "f oo". | |||
*/ | */ | |||
//@{ | //@{ | |||
bool writeEntry( QString const & scope, const QString & key, bool value | //! @note available in python bindings as writeEntryBool | |||
); | bool writeEntry( const QString & scope, const QString & key, bool value | |||
bool writeEntry( QString const & scope, const QString & key, double val | ); | |||
ue ); | //! @note available in python bindings as writeEntryDouble | |||
bool writeEntry( QString const & scope, const QString & key, int value | bool writeEntry( const QString & scope, const QString & key, double val | |||
); | ue ); | |||
bool writeEntry( QString const & scope, const QString & key, const QStr | bool writeEntry( const QString & scope, const QString & key, int value | |||
ing & value ); | ); | |||
bool writeEntry( QString const & scope, const QString & key, const QStr | bool writeEntry( const QString & scope, const QString & key, const QStr | |||
ingList & value ); | ing & value ); | |||
bool writeEntry( const QString & scope, const QString & key, const QStr | ||||
ingList & value ); | ||||
//@} | //@} | |||
/** key value accessors | /** key value accessors | |||
keys would be the familiar QSettings-like '/' delimited entries, | keys would be the familiar QSettings-like '/' delimited entries, | |||
implying a hierarchy of keys and corresponding values | implying a hierarchy of keys and corresponding values | |||
@note The key string <em>must</em> include '/'s. E.g., "/foo" not "foo". | @note The key string <em>must</em> include '/'s. E.g., "/foo" not "foo". | |||
*/ | */ | |||
//@{ | //@{ | |||
QStringList readListEntry( QString const & scope, const QString & key, bool * ok = 0 ) const; | QStringList readListEntry( const QString & scope, const QString & key, QStringList def = QStringList(), bool *ok = 0 ) const; | |||
QString readEntry( QString const & scope, const QString & key, const QS | QString readEntry( const QString & scope, const QString & key, const QS | |||
tring & def = QString::null, bool * ok = 0 ) const; | tring & def = QString::null, bool * ok = 0 ) const; | |||
int readNumEntry( QString const & scope, const QString & key, int def = | int readNumEntry( const QString & scope, const QString & key, int def = | |||
0, bool * ok = 0 ) const; | 0, bool * ok = 0 ) const; | |||
double readDoubleEntry( QString const & scope, const QString & key, dou | double readDoubleEntry( const QString & scope, const QString & key, dou | |||
ble def = 0, bool * ok = 0 ) const; | ble def = 0, bool * ok = 0 ) const; | |||
bool readBoolEntry( QString const & scope, const QString & key, bool de | bool readBoolEntry( const QString & scope, const QString & key, bool de | |||
f = false, bool * ok = 0 ) const; | f = false, bool * ok = 0 ) const; | |||
//@} | //@} | |||
/** remove the given key */ | /** remove the given key */ | |||
bool removeEntry( QString const & scope, const QString & key ); | bool removeEntry( const QString & scope, const QString & key ); | |||
/** return keys with values -- do not return keys that contain other ke ys | /** return keys with values -- do not return keys that contain other ke ys | |||
@note equivalent to QSettings entryList() | @note equivalent to QSettings entryList() | |||
*/ | */ | |||
QStringList entryList( QString const & scope, QString const & key ) con st; | QStringList entryList( const QString & scope, const QString & key ) con st; | |||
/** return keys with keys -- do not return keys that contain only value s | /** return keys with keys -- do not return keys that contain only value s | |||
@note equivalent to QSettings subkeyList() | @note equivalent to QSettings subkeyList() | |||
*/ | */ | |||
QStringList subkeyList( QString const & scope, QString const & key ) co nst; | QStringList subkeyList( const QString & scope, const QString & key ) co nst; | |||
/** dump out current project properties to stderr | /** dump out current project properties to stderr | |||
@todo XXX Now slightly broken since re-factoring. Won't print out to p-level key | @todo XXX Now slightly broken since re-factoring. Won't print out to p-level key | |||
and redundantly prints sub-keys. | and redundantly prints sub-keys. | |||
*/ | */ | |||
void dumpProperties() const; | void dumpProperties() const; | |||
/** prepare a filename to save it to the project file | /** prepare a filename to save it to the project file | |||
@note added in 1.3 */ | @note added in 1.3 */ | |||
skipping to change at line 271 | skipping to change at line 277 | |||
/** Change handler for missing layers. | /** Change handler for missing layers. | |||
Deletes old handler and takes ownership of the new one. | Deletes old handler and takes ownership of the new one. | |||
@note added in 1.4 */ | @note added in 1.4 */ | |||
void setBadLayerHandler( QgsProjectBadLayerHandler* handler ); | void setBadLayerHandler( QgsProjectBadLayerHandler* handler ); | |||
/**Returns project file path if layer is embedded from other project fi le. Returns empty string if layer is not embedded*/ | /**Returns project file path if layer is embedded from other project fi le. Returns empty string if layer is not embedded*/ | |||
QString layerIsEmbedded( const QString& id ) const; | QString layerIsEmbedded( const QString& id ) const; | |||
/**Creates a maplayer instance defined in an arbitrary project file. Ca ller takes ownership | /**Creates a maplayer instance defined in an arbitrary project file. Ca ller takes ownership | |||
@return the layer or 0 in case of error | @return the layer or 0 in case of error | |||
@note: added in version 1.8*/ | @note: added in version 1.8 | |||
//static QgsMapLayer* createEmbeddedLayer( const QString& layerId, cons | @note not available in python bindings | |||
t QString& projectFilePath ); | */ | |||
bool createEmbeddedLayer( const QString& layerId, const QString& projec tFilePath, QList<QDomNode>& brokenNodes, | bool createEmbeddedLayer( const QString& layerId, const QString& projec tFilePath, QList<QDomNode>& brokenNodes, | |||
QList< QPair< QgsVectorLayer*, QDomElement > >& vectorLayerList, bool saveFlag = true ); | QList< QPair< QgsVectorLayer*, QDomElement > >& vectorLayerList, bool saveFlag = true ); | |||
/**Convenience function to set snap settings per layer | ||||
@note added in version 1.9*/ | ||||
void setSnapSettingsForLayer( const QString& layerId, bool enabled, Qgs | ||||
Snapper::SnappingType type, QgsTolerance::UnitType unit, double tolerance, | ||||
bool avoidIntersection ); | ||||
/**Convenience function to query snap settings of a layer | ||||
@note added in version 1.9*/ | ||||
bool snapSettingsForLayer( const QString& layerId, bool& enabled, QgsSn | ||||
apper::SnappingType& type, QgsTolerance::UnitType& units, double& tolerance | ||||
, | ||||
bool& avoidIntersection ) const; | ||||
/**Convenience function to set topological editing | ||||
@note added in version 1.9*/ | ||||
void setTopologicalEditing( bool enabled ); | ||||
/**Convenience function to query topological editing status | ||||
@note added in version 1.9*/ | ||||
bool topologicalEditing() const; | ||||
/** Return project's home path | ||||
@return home path of project (or QString::null if not set) | ||||
@note added in version 2.0 */ | ||||
QString homePath() const; | ||||
protected: | protected: | |||
/** Set error message from read/write operation | /** Set error message from read/write operation | |||
@note added in 1.4 */ | @note added in 1.4 */ | |||
void setError( QString errorMessage ); | void setError( QString errorMessage ); | |||
/** Clear error message | /** Clear error message | |||
@note added in 1.4 */ | @note added in 1.4 */ | |||
void clearError(); | void clearError(); | |||
//Creates layer and adds it to maplayer registry | //Creates layer and adds it to maplayer registry | |||
//! @note not available in python bindings | ||||
bool addLayer( const QDomElement& layerElem, QList<QDomNode>& brokenNod es, QList< QPair< QgsVectorLayer*, QDomElement > >& vectorLayerList ); | bool addLayer( const QDomElement& layerElem, QList<QDomNode>& brokenNod es, QList< QPair< QgsVectorLayer*, QDomElement > >& vectorLayerList ); | |||
signals: | signals: | |||
//! emitted when project is being read | //! emitted when project is being read | |||
void readProject( const QDomDocument & ); | void readProject( const QDomDocument & ); | |||
//! emitted when project is being written | //! emitted when project is being written | |||
void writeProject( QDomDocument & ); | void writeProject( QDomDocument & ); | |||
/** | ||||
* Emitted, after the basic initialisation of a layer from the project | ||||
* file is done. You can use this signal to read additional information | ||||
* from the project file. | ||||
* | ||||
* @param mapLayer The map layer which is being initialized | ||||
* @param layerNode The layer node from the project file | ||||
*/ | ||||
void readMapLayer( QgsMapLayer *mapLayer, const QDomElement &layerNode | ||||
); | ||||
/** | ||||
* Emitted, when a layer is being saved. You can use this method to sav | ||||
e | ||||
* additional information to the layer. | ||||
* | ||||
* @param mapLayer The map layer which is being initialized | ||||
* @param layerElem The layer element from the project file | ||||
* @param doc The document | ||||
*/ | ||||
void writeMapLayer( QgsMapLayer *mapLayer, QDomElement &layerElem, QDom | ||||
Document &doc ); | ||||
//! emitted when the project file has been written and closed | ||||
void projectSaved(); | ||||
//! emitted when an old project file is read. | //! emitted when an old project file is read. | |||
void oldProjectVersionWarning( QString ); | void oldProjectVersionWarning( QString ); | |||
//! emitted when a layer from a projects was read | //! emitted when a layer from a projects was read | |||
// @param i current layer | // @param i current layer | |||
// @param n number of layers | // @param n number of layers | |||
void layerLoaded( int i, int n ); | void layerLoaded( int i, int n ); | |||
void loadingLayer( QString ); | ||||
void snapSettingsChanged(); | ||||
private: | private: | |||
QgsProject(); // private 'cause it's a singleton | QgsProject(); // private 'cause it's a singleton | |||
QgsProject( QgsProject const & ); // private 'cause it's a singleton | QgsProject( QgsProject const & ); // private 'cause it's a singleton | |||
struct Imp; | struct Imp; | |||
/// implementation handle | /// implementation handle | |||
std::auto_ptr<Imp> imp_; | std::auto_ptr<Imp> imp_; | |||
skipping to change at line 329 | skipping to change at line 386 | |||
QString mErrorMessage; | QString mErrorMessage; | |||
QgsProjectBadLayerHandler* mBadLayerHandler; | QgsProjectBadLayerHandler* mBadLayerHandler; | |||
/**Embeded layers which are defined in other projects. Key: layer id, | /**Embeded layers which are defined in other projects. Key: layer id, | |||
value: pair< project file path, save layer yes / no (e.g. if the layer is part of an embedded group, loading/saving is done by the legend) | value: pair< project file path, save layer yes / no (e.g. if the layer is part of an embedded group, loading/saving is done by the legend) | |||
If the project file path is empty, QgsProject is going to ignore the layer for saving (e.g. because it is part and managed by an embedded group )*/ | If the project file path is empty, QgsProject is going to ignore the layer for saving (e.g. because it is part and managed by an embedded group )*/ | |||
QHash< QString, QPair< QString, bool> > mEmbeddedLayers; | QHash< QString, QPair< QString, bool> > mEmbeddedLayers; | |||
void snapSettings( QStringList& layerIdList, QStringList& enabledList, | ||||
QStringList& snapTypeList, QStringList& snapUnitList, QStringList& toleranc | ||||
eUnitList, | ||||
QStringList& avoidIntersectionList ) const; | ||||
}; // QgsProject | }; // QgsProject | |||
/** Interface for classes that handle missing layer files when reading proj ect file. | /** Interface for classes that handle missing layer files when reading proj ect file. | |||
@note added in 1.4 */ | @note added in 1.4 */ | |||
class CORE_EXPORT QgsProjectBadLayerHandler | class CORE_EXPORT QgsProjectBadLayerHandler | |||
{ | { | |||
public: | public: | |||
virtual void handleBadLayers( QList<QDomNode> layers, QDomDocument proj ectDom ) = 0; | virtual void handleBadLayers( QList<QDomNode> layers, QDomDocument proj ectDom ) = 0; | |||
virtual ~QgsProjectBadLayerHandler() {} | virtual ~QgsProjectBadLayerHandler() {} | |||
}; | }; | |||
End of changes. 19 change blocks. | ||||
33 lines changed or deleted | 100 lines changed or added | |||
qgsprojectbadlayerguihandler.h | qgsprojectbadlayerguihandler.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsprojectbadlayerguihandler.h - handle bad layers | qgsprojectbadlayerguihandler.h - handle bad layers | |||
--------------------- | --------------------- | |||
begin : December 2009 | begin : December 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSPROJECTBADLAYERGUIHANDLER_H | #ifndef QGSPROJECTBADLAYERGUIHANDLER_H | |||
#define QGSPROJECTBADLAYERGUIHANDLER_H | #define QGSPROJECTBADLAYERGUIHANDLER_H | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgsprojectfiletransform.h | qgsprojectfiletransform.h | |||
---|---|---|---|---|
skipping to change at line 33 | skipping to change at line 33 | |||
*/ | */ | |||
#ifndef QGSPROJECTFILETRANSFORM_H | #ifndef QGSPROJECTFILETRANSFORM_H | |||
#define QGSPROJECTFILETRANSFORM_H | #define QGSPROJECTFILETRANSFORM_H | |||
#include <QString> | #include <QString> | |||
#include <QDomDocument> | #include <QDomDocument> | |||
#include <vector> | #include <vector> | |||
#include "qgsprojectversion.h" | #include "qgsprojectversion.h" | |||
class QgsProjectFileTransform | class QgsRasterLayer; | |||
class CORE_EXPORT QgsProjectFileTransform | ||||
{ | { | |||
public: | public: | |||
//Default constructor | //Default constructor | |||
//QgsProjectfiletransform() {} | //QgsProjectfiletransform() {} | |||
~QgsProjectFileTransform() {} | ~QgsProjectFileTransform() {} | |||
/*! Create an instance from a Dom and a supplied version | /*! Create an instance from a Dom and a supplied version | |||
* @param domDocument The Dom document to use as content | * @param domDocument The Dom document to use as content | |||
* @param version Version number | * @param version Version number | |||
*/ | */ | |||
skipping to change at line 57 | skipping to change at line 59 | |||
mDom = domDocument; | mDom = domDocument; | |||
mCurrentVersion = version; | mCurrentVersion = version; | |||
} | } | |||
bool updateRevision( QgsProjectVersion version ); | bool updateRevision( QgsProjectVersion version ); | |||
/*! Prints the contents via QgsDebugMsg() | /*! Prints the contents via QgsDebugMsg() | |||
*/ | */ | |||
void dump(); | void dump(); | |||
static void convertRasterProperties( QDomDocument& doc, QDomNode& paren | ||||
tNode, QDomElement& rasterPropertiesElem, QgsRasterLayer* rlayer ); | ||||
private: | private: | |||
typedef struct | typedef struct | |||
{ | { | |||
QgsProjectVersion from; | QgsProjectVersion from; | |||
QgsProjectVersion to; | QgsProjectVersion to; | |||
void ( QgsProjectFileTransform::* transformFunc )(); | void ( QgsProjectFileTransform::* transformFunc )(); | |||
} transform; | } transform; | |||
static transform transformers[]; | static transform transformers[]; | |||
skipping to change at line 81 | skipping to change at line 85 | |||
// Transformer functions below. Declare functions here, | // Transformer functions below. Declare functions here, | |||
// define them in qgsprojectfiletransform.cpp and add them | // define them in qgsprojectfiletransform.cpp and add them | |||
// to the transformArray with proper version number | // to the transformArray with proper version number | |||
void transformNull() {}; // Do absolutely nothing | void transformNull() {}; // Do absolutely nothing | |||
void transform081to090(); | void transform081to090(); | |||
void transform091to0100(); | void transform091to0100(); | |||
void transform0100to0110(); | void transform0100to0110(); | |||
void transform0110to1000(); | void transform0110to1000(); | |||
void transform1100to1200(); | void transform1100to1200(); | |||
void transform1400to1500(); | void transform1400to1500(); | |||
void transform1800to1900(); | ||||
//helper functions | ||||
static int rasterBandNumber( const QDomElement& rasterPropertiesElem, c | ||||
onst QString bandName, QgsRasterLayer* rlayer ); | ||||
static void transformContrastEnhancement( QDomDocument& doc, const QDom | ||||
Element& rasterproperties, QDomElement& rendererElem ); | ||||
static void transformRasterTransparency( QDomDocument& doc, const QDomE | ||||
lement& orig, QDomElement& rendererElem ); | ||||
}; | }; | |||
#endif //QGSPROJECTFILETRANSFORM_H | #endif //QGSPROJECTFILETRANSFORM_H | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 15 lines changed or added | |||
qgsprojectionselector.h | qgsprojectionselector.h | |||
---|---|---|---|---|
skipping to change at line 28 | skipping to change at line 28 | |||
#include "qgis.h" | #include "qgis.h" | |||
class QResizeEvent; | class QResizeEvent; | |||
/** \ingroup gui | /** \ingroup gui | |||
* A widget for selecting a Coordinate reference system from a tree. | * A widget for selecting a Coordinate reference system from a tree. | |||
* @see QgsGenericProjectionSelector. | * @see QgsGenericProjectionSelector. | |||
@author Tim Sutton | @author Tim Sutton | |||
*/ | */ | |||
class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProj ectionSelectorBase | class GUI_EXPORT QgsProjectionSelector : public QWidget, private Ui::QgsPro jectionSelectorBase | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsProjectionSelector( QWidget* parent, const char *name = "", Qt::WFla gs fl = 0 ); | QgsProjectionSelector( QWidget* parent, const char *name = "", Qt::WFla gs fl = 0 ); | |||
~QgsProjectionSelector(); | ~QgsProjectionSelector(); | |||
/** | /** | |||
* \brief Populate the proj tree view with user defined projection name s... | * \brief Populate the proj tree view with user defined projection name s... | |||
* | * | |||
skipping to change at line 69 | skipping to change at line 69 | |||
* \brief Make the string safe for use in SQL statements. | * \brief Make the string safe for use in SQL statements. | |||
* This involves escaping single quotes, double quotes, backslashes, | * This involves escaping single quotes, double quotes, backslashes, | |||
* and optionally, percentage symbols. Percentage symbols are used | * and optionally, percentage symbols. Percentage symbols are used | |||
* as wildcards sometimes and so when using the string as part of the | * as wildcards sometimes and so when using the string as part of the | |||
* LIKE phrase of a select statement, should be escaped. | * LIKE phrase of a select statement, should be escaped. | |||
* \arg const QString in The input string to make safe. | * \arg const QString in The input string to make safe. | |||
* \return The string made safe for SQL statements. | * \return The string made safe for SQL statements. | |||
*/ | */ | |||
const QString sqlSafeString( const QString theSQL ); | const QString sqlSafeString( const QString theSQL ); | |||
//! Gets the current EpsgCrsId-style projection identifier | ||||
// @deprecated there are other authorities - use selectedAuthId() | ||||
Q_DECL_DEPRECATED long selectedEpsg(); | ||||
//! Gets the current InternalCrsId-style projection identifier | ||||
long selectedSrsid(); | ||||
//! Gets the current authority-style projection identifier | //! Gets the current authority-style projection identifier | |||
QString selectedAuthId(); | QString selectedAuthId(); | |||
public slots: | public slots: | |||
void setSelectedCrsName( QString theCRSName ); | void setSelectedCrsName( QString theCRSName ); | |||
QString selectedName(); | QString selectedName(); | |||
void setSelectedCrsId( long theCRSID ); | void setSelectedCrsId( long theCRSID ); | |||
void setSelectedAuthId( QString authId ); | void setSelectedAuthId( QString authId ); | |||
//! Get the selected coordinate system | ||||
// @deprecated there are other authorities - so not always defined | ||||
Q_DECL_DEPRECATED void setSelectedEpsg( long epsg ); | ||||
QString selectedProj4String(); | QString selectedProj4String(); | |||
//! Gets the current PostGIS-style projection identifier | //! Gets the current PostGIS-style projection identifier | |||
long selectedPostgresSrId(); | long selectedPostgresSrId(); | |||
//! Gets the current QGIS projection identfier | //! Gets the current QGIS projection identfier | |||
long selectedCrsId(); | long selectedCrsId(); | |||
/** | /** | |||
* \brief filters this widget by the given CRSs | * \brief filters this widget by the given CRSs | |||
End of changes. 3 change blocks. | ||||
12 lines changed or deleted | 1 lines changed or added | |||
qgsprojectproperty.h | qgsprojectproperty.h | |||
---|---|---|---|---|
skipping to change at line 93 | skipping to change at line 93 | |||
/** | /** | |||
adds property hierarchy to given Dom element | adds property hierarchy to given Dom element | |||
Used for saving properties to project file. | Used for saving properties to project file. | |||
@param nodeName the tag name associated with this element | @param nodeName the tag name associated with this element | |||
@param element the parent (or encompassing) property element | @param element the parent (or encompassing) property element | |||
@param document the overall project file Dom document | @param document the overall project file Dom document | |||
*/ | */ | |||
virtual bool writeXML( QString const & nodeName, | virtual bool writeXML( const QString & nodeName, | |||
QDomElement & element, | QDomElement & element, | |||
QDomDocument & document ) = 0; | QDomDocument & document ) = 0; | |||
/** return the node's value | /** return the node's value | |||
For QgsPropertyValue nodes, this is straightforward -- just return t he | For QgsPropertyValue nodes, this is straightforward -- just return t he | |||
embedded QVariant, _value. For QgsPropertyKey, this means returning | embedded QVariant, _value. For QgsPropertyKey, this means returning | |||
the QgsPropertyValue _value that is keyed by its name, if it exists; | the QgsPropertyValue _value that is keyed by its name, if it exists; | |||
i.e., QgsPropertyKey "foo" will return the property value mapped to its | i.e., QgsPropertyKey "foo" will return the property value mapped to its | |||
name, "foo", in its QHash of QProperties. | name, "foo", in its QHash of QProperties. | |||
skipping to change at line 120 | skipping to change at line 120 | |||
/** QgsPropertyValue node | /** QgsPropertyValue node | |||
Contains a QgsPropertyKey's value | Contains a QgsPropertyKey's value | |||
*/ | */ | |||
class CORE_EXPORT QgsPropertyValue : public QgsProperty | class CORE_EXPORT QgsPropertyValue : public QgsProperty | |||
{ | { | |||
public: | public: | |||
QgsPropertyValue() | QgsPropertyValue() | |||
{} | {} | |||
QgsPropertyValue( QVariant const &value ) | QgsPropertyValue( const QVariant &value ) | |||
: value_( value ) | : value_( value ) | |||
{} | {} | |||
virtual ~ QgsPropertyValue() | virtual ~ QgsPropertyValue() | |||
{} | {} | |||
/** returns true if is a QgsPropertyKey */ | /** returns true if is a QgsPropertyKey */ | |||
virtual bool isKey() const | virtual bool isKey() const | |||
{ return false; } | { return false; } | |||
skipping to change at line 150 | skipping to change at line 150 | |||
@note I suppose, in a way, value nodes can also be qualified as leaf | @note I suppose, in a way, value nodes can also be qualified as leaf | |||
nodes even though we're only counting key nodes. | nodes even though we're only counting key nodes. | |||
*/ | */ | |||
bool isLeaf() const | bool isLeaf() const | |||
{ return true; } | { return true; } | |||
void dump( size_t tabs = 0 ) const; | void dump( size_t tabs = 0 ) const; | |||
bool readXML( QDomNode & keyNode ); | bool readXML( QDomNode & keyNode ); | |||
bool writeXML( QString const & nodeName, | bool writeXML( const QString & nodeName, | |||
QDomElement & element, | QDomElement & element, | |||
QDomDocument & document ); | QDomDocument & document ); | |||
size_t count() const | size_t count() const | |||
{ return 0; } | { return 0; } | |||
/** return keys that do not contain other keys | /** return keys that do not contain other keys | |||
Since QgsPropertyValue isn't a key, don't do anything. | Since QgsPropertyValue isn't a key, don't do anything. | |||
*/ | */ | |||
skipping to change at line 192 | skipping to change at line 192 | |||
E.g., given the key sequence "/foo/bar", "foo" will have a corresponding | E.g., given the key sequence "/foo/bar", "foo" will have a corresponding | |||
QgsPropertyKey with a name "foo". It will contain an element in its | QgsPropertyKey with a name "foo". It will contain an element in its | |||
mProperties that maps to "bar", which is another QgsPropertyKey. The "b ar" | mProperties that maps to "bar", which is another QgsPropertyKey. The "b ar" | |||
QgsPropertyKey will, in turn, have an element that maps to itself, i.e. "bar", | QgsPropertyKey will, in turn, have an element that maps to itself, i.e. "bar", | |||
that will contain a QgsPropertyValue. | that will contain a QgsPropertyValue. | |||
*/ | */ | |||
class CORE_EXPORT QgsPropertyKey : public QgsProperty | class CORE_EXPORT QgsPropertyKey : public QgsProperty | |||
{ | { | |||
public: | public: | |||
QgsPropertyKey( const QString name = "" ); | ||||
QgsPropertyKey( QString const name = "" ); | ||||
virtual ~ QgsPropertyKey(); | virtual ~ QgsPropertyKey(); | |||
/// every key has a name | /// every key has a name | |||
// @{ | // @{ | |||
QString const & name() const | const QString &name() const | |||
{ return mName; } | { return mName; } | |||
QString & name() | QString & name() | |||
{ return mName; } | { return mName; } | |||
// @} | // @} | |||
/** if this key has a value, it will be stored by its name in its | /** if this key has a value, it will be stored by its name in its | |||
* properties | * properties | |||
*/ | */ | |||
QVariant value() const; | QVariant value() const; | |||
/// add the given property key | /// add the given property key | |||
QgsPropertyKey * addKey( QString const & keyName ) | QgsPropertyKey * addKey( const QString & keyName ) | |||
{ | { | |||
delete mProperties.take( keyName ); | delete mProperties.take( keyName ); | |||
mProperties.insert( keyName, new QgsPropertyKey( keyName ) ); | mProperties.insert( keyName, new QgsPropertyKey( keyName ) ); | |||
return dynamic_cast<QgsPropertyKey*>( mProperties.value( keyName ) ); | return dynamic_cast<QgsPropertyKey*>( mProperties.value( keyName ) ); | |||
} | } | |||
/// remove the given key | /// remove the given key | |||
void removeKey( QString const & keyName ) | void removeKey( const QString & keyName ) | |||
{ | { | |||
delete mProperties.take( keyName ); | delete mProperties.take( keyName ); | |||
} | } | |||
/** set the value associated with this key | /** set the value associated with this key | |||
@param name is the key name | @param name is the key name | |||
@param value is the value to set | @param value is the value to set | |||
@return pointer to property value | @return pointer to property value | |||
*/ | */ | |||
QgsPropertyValue * setValue( QString const & name, QVariant const & val ue ) | QgsPropertyValue * setValue( const QString & name, const QVariant & val ue ) | |||
{ | { | |||
delete mProperties.take( name ); | delete mProperties.take( name ); | |||
mProperties.insert( name, new QgsPropertyValue( value ) ); | mProperties.insert( name, new QgsPropertyValue( value ) ); | |||
return dynamic_cast<QgsPropertyValue*>( mProperties.value( name ) ); | return dynamic_cast<QgsPropertyValue*>( mProperties.value( name ) ); | |||
} | } | |||
/** set the value associated with this key | /** set the value associated with this key | |||
@note that the single value node associated with each key is always | @note that the single value node associated with each key is always | |||
stored keyed by the current key name | stored keyed by the current key name | |||
*/ | */ | |||
QgsPropertyValue * setValue( QVariant const & value ) | QgsPropertyValue * setValue( const QVariant & value ) | |||
{ | { | |||
return setValue( name(), value ); | return setValue( name(), value ); | |||
} | } | |||
void dump( size_t tabs = 0 ) const; | void dump( size_t tabs = 0 ) const; | |||
bool readXML( QDomNode & keyNode ); | bool readXML( QDomNode & keyNode ); | |||
bool writeXML( QString const &nodeName, QDomElement & element, QDomDocu ment & document ); | bool writeXML( const QString &nodeName, QDomElement & element, QDomDocu ment & document ); | |||
/// how many elements are contained within this one? | /// how many elements are contained within this one? | |||
size_t count() const | size_t count() const | |||
{ return mProperties.count(); } | { return mProperties.count(); } | |||
/// Does this property not have any subkeys or values? | /// Does this property not have any subkeys or values? | |||
/* virtual */ bool isEmpty() const | /* virtual */ bool isEmpty() const | |||
{ return mProperties.isEmpty(); } | { return mProperties.isEmpty(); } | |||
/** returns true if is a QgsPropertyKey */ | /** returns true if is a QgsPropertyKey */ | |||
End of changes. 10 change blocks. | ||||
12 lines changed or deleted | 10 lines changed or added | |||
qgsprojectversion.h | qgsprojectversion.h | |||
---|---|---|---|---|
skipping to change at line 43 | skipping to change at line 43 | |||
public: | public: | |||
QgsProjectVersion() {}; | QgsProjectVersion() {}; | |||
~QgsProjectVersion() {}; | ~QgsProjectVersion() {}; | |||
QgsProjectVersion( int major, int minor, int sub, QString name = "" ); | QgsProjectVersion( int major, int minor, int sub, QString name = "" ); | |||
QgsProjectVersion( QString string ); | QgsProjectVersion( QString string ); | |||
int majorVersion() { return mMajor;}; | int majorVersion() { return mMajor;}; | |||
int minorVersion() { return mMinor;}; | int minorVersion() { return mMinor;}; | |||
int subVersion() { return mSub;}; | int subVersion() { return mSub;}; | |||
QString text(); | QString text(); | |||
/*! Boolean equal operator | /*! Boolean equal operator | |||
*/ | */ | |||
bool operator==( const QgsProjectVersion &other ); | bool operator==( const QgsProjectVersion &other ); | |||
/*! Boolean >= operator | /*! Boolean >= operator | |||
*/ | */ | |||
bool operator>=( const QgsProjectVersion &other ); | bool operator>=( const QgsProjectVersion &other ); | |||
/*! Boolean > operator | /*! Boolean > operator | |||
*/ | */ | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added | |||
qgsprovidermetadata.h | qgsprovidermetadata.h | |||
---|---|---|---|---|
skipping to change at line 40 | skipping to change at line 40 | |||
iteratively loaded once to get their metadata information, and then | iteratively loaded once to get their metadata information, and then | |||
unloaded when the QgsProviderRegistry is created.) QgsProviderMetadata | unloaded when the QgsProviderRegistry is created.) QgsProviderMetadata | |||
supplies enough information to be able to later load the associated shar ed | supplies enough information to be able to later load the associated shar ed | |||
library object. | library object. | |||
*/ | */ | |||
class CORE_EXPORT QgsProviderMetadata | class CORE_EXPORT QgsProviderMetadata | |||
{ | { | |||
public: | public: | |||
QgsProviderMetadata( QString const & _key, QString const & _description , QString const & _library ); | QgsProviderMetadata( const QString & _key, const QString & _description , const QString & _library ); | |||
/** this returns the unique key associated with the provider | /** this returns the unique key associated with the provider | |||
This key string is used for the associative container in QgsProvide rRegistry | This key string is used for the associative container in QgsProvide rRegistry | |||
*/ | */ | |||
QString const & key() const; | const QString & key() const; | |||
/** this returns descriptive text for the provider | /** this returns descriptive text for the provider | |||
This is used to provide a descriptive list of available data provid ers. | This is used to provide a descriptive list of available data provid ers. | |||
*/ | */ | |||
QString const & description() const; | const QString & description() const; | |||
/** this returns the library file name | /** this returns the library file name | |||
This is used to QLibrary calls to load the data provider. | This is used to QLibrary calls to load the data provider. | |||
*/ | */ | |||
QString const & library() const; | const QString & library() const; | |||
private: | private: | |||
/// unique key for data provider | /// unique key for data provider | |||
QString key_; | QString key_; | |||
/// associated terse description | /// associated terse description | |||
QString description_; | QString description_; | |||
/// file path | /// file path | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
qgsproviderregistry.h | qgsproviderregistry.h | |||
---|---|---|---|---|
skipping to change at line 50 | skipping to change at line 50 | |||
public: | public: | |||
/** means of accessing canonical single instance */ | /** means of accessing canonical single instance */ | |||
static QgsProviderRegistry* instance( QString pluginPath = QString::nul l ); | static QgsProviderRegistry* instance( QString pluginPath = QString::nul l ); | |||
/** Virtual dectructor */ | /** Virtual dectructor */ | |||
virtual ~QgsProviderRegistry(); | virtual ~QgsProviderRegistry(); | |||
/** Return path for the library of the provider */ | /** Return path for the library of the provider */ | |||
QString library( QString const & providerKey ) const; | QString library( const QString & providerKey ) const; | |||
/** Return list of provider plugins found */ | /** Return list of provider plugins found */ | |||
QString pluginList( bool asHtml = false ) const; | QString pluginList( bool asHtml = false ) const; | |||
/** return library directory where plugins are found */ | /** return library directory where plugins are found */ | |||
const QDir & libraryDirectory() const; | const QDir & libraryDirectory() const; | |||
/** Set library directory where to search for plugins */ | /** Set library directory where to search for plugins */ | |||
void setLibraryDirectory( QDir const & path ); | void setLibraryDirectory( const QDir & path ); | |||
/** Create an instance of the provider | /** Create an instance of the provider | |||
@param providerKey identificator of the provider | @param providerKey identificator of the provider | |||
@param dataSource string containing data source for the provider | @param dataSource string containing data source for the provider | |||
@return instance of provider or NULL on error | @return instance of provider or NULL on error | |||
*/ | */ | |||
QgsDataProvider *provider( const QString & providerKey, | QgsDataProvider *provider( const QString & providerKey, | |||
const QString & dataSource ); | const QString & dataSource ); | |||
QWidget *selectWidget( const QString & providerKey, | QWidget *selectWidget( const QString & providerKey, | |||
skipping to change at line 101 | skipping to change at line 101 | |||
supported by all data providers. | supported by all data providers. | |||
This walks through all data providers appending calls to their | This walks through all data providers appending calls to their | |||
fileVectorFilters to a string, which is then returned. | fileVectorFilters to a string, which is then returned. | |||
@note | @note | |||
It'd be nice to eventually be raster/vector neutral. | It'd be nice to eventually be raster/vector neutral. | |||
*/ | */ | |||
virtual QString fileVectorFilters() const; | virtual QString fileVectorFilters() const; | |||
/** return raster file filter string | ||||
Returns a string suitable for a QFileDialog of raster file formats | ||||
supported by all data providers. | ||||
This walks through all data providers appending calls to their | ||||
buildSupportedRasterFileFilter to a string, which is then returned. | ||||
@note this method was added in QGIS 2.0 | ||||
@note This replaces QgsRasterLayer::buildSupportedRasterFileFilter() | ||||
*/ | ||||
virtual QString fileRasterFilters() const; | ||||
/** return a string containing the available database drivers | /** return a string containing the available database drivers | |||
* @note this method was added in QGIS 1.1 | * @note this method was added in QGIS 1.1 | |||
*/ | */ | |||
virtual QString databaseDrivers() const; | virtual QString databaseDrivers() const; | |||
/** return a string containing the available directory drivers | /** return a string containing the available directory drivers | |||
* @note this method was added in QGIS 1.1 | * @note this method was added in QGIS 1.1 | |||
*/ | */ | |||
virtual QString directoryDrivers() const; | virtual QString directoryDrivers() const; | |||
/** return a string containing the available protocol drivers | /** return a string containing the available protocol drivers | |||
* @note this method was added in QGIS 1.1 | * @note this method was added in QGIS 1.1 | |||
*/ | */ | |||
virtual QString protocolDrivers() const; | virtual QString protocolDrivers() const; | |||
void registerGuis( QWidget *widget ); | ||||
/** open the given vector data source | /** open the given vector data source | |||
Similar to open(QString const &), except that the user specifies a data provider | Similar to open(QString const &), except that the user specifies a data provider | |||
with which to open the data source instead of using the default data pr ovider | with which to open the data source instead of using the default data pr ovider | |||
that QgsDataManager would figure out to use. This should be useful whe n (and if) | that QgsDataManager would figure out to use. This should be useful whe n (and if) | |||
there will exist more than one data provider that can handle a given da ta | there will exist more than one data provider that can handle a given da ta | |||
source. (E.g., use GDAL to open an SDTS file, or a different data prov ider that uses | source. (E.g., use GDAL to open an SDTS file, or a different data prov ider that uses | |||
sdts++.) | sdts++.) | |||
Called by QgsDataManager::open(). | Called by QgsDataManager::open(). | |||
skipping to change at line 163 | skipping to change at line 177 | |||
/** file filter string for vector files | /** file filter string for vector files | |||
Built once when registry is constructed by appending strings return ed | Built once when registry is constructed by appending strings return ed | |||
from iteratively calling vectorFileFilter() for each visited data | from iteratively calling vectorFileFilter() for each visited data | |||
provider. The alternative would have been to do this each time | provider. The alternative would have been to do this each time | |||
fileVectorFilters was invoked; instead we only have to build it the | fileVectorFilters was invoked; instead we only have to build it the | |||
one time. | one time. | |||
*/ | */ | |||
QString mVectorFileFilters; | QString mVectorFileFilters; | |||
/** file filter string for raster files | ||||
*/ | ||||
QString mRasterFileFilters; | ||||
/** Available database drivers string for vector databases | /** Available database drivers string for vector databases | |||
This is a string of form: | This is a string of form: | |||
DriverNameToShow,DriverName;DriverNameToShow,DriverName;... | DriverNameToShow,DriverName;DriverNameToShow,DriverName;... | |||
*/ | */ | |||
QString mDatabaseDrivers; | QString mDatabaseDrivers; | |||
/** Available directory drivers string for vector databases | /** Available directory drivers string for vector databases | |||
This is a string of form: | This is a string of form: | |||
DriverNameToShow,DriverName;DriverNameToShow,DriverName;... | DriverNameToShow,DriverName;DriverNameToShow,DriverName;... | |||
End of changes. 7 change blocks. | ||||
6 lines changed or deleted | 23 lines changed or added | |||
qgspythonrunner.h | qgspythonrunner.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgspythonrunner.h | qgspythonrunner.h | |||
--------------------- | --------------------- | |||
begin : May 2011 | begin : May 2011 | |||
copyright : (C) 2011 by Martin Dobias | copyright : (C) 2011 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSPYTHONRUNNER_H | #ifndef QGSPYTHONRUNNER_H | |||
#define QGSPYTHONRUNNER_H | #define QGSPYTHONRUNNER_H | |||
skipping to change at line 40 | skipping to change at line 40 | |||
{ | { | |||
public: | public: | |||
/** returns true if the runner has an instance | /** returns true if the runner has an instance | |||
(and thus is able to run commands) */ | (and thus is able to run commands) */ | |||
static bool isValid(); | static bool isValid(); | |||
/** execute a python statement */ | /** execute a python statement */ | |||
static bool run( QString command, QString messageOnError = QString() ); | static bool run( QString command, QString messageOnError = QString() ); | |||
/** Eval a python statement */ | ||||
static bool eval( QString command, QString& result ); | ||||
/** assign an instance of python runner so that run() can be used. | /** assign an instance of python runner so that run() can be used. | |||
This method should be called during app initialization. | This method should be called during app initialization. | |||
Takes ownership of the object, deletes previous instance. */ | Takes ownership of the object, deletes previous instance. */ | |||
static void setInstance( QgsPythonRunner* runner ); | static void setInstance( QgsPythonRunner* runner ); | |||
protected: | protected: | |||
/** protected constructor: can be instantiated only from children */ | /** protected constructor: can be instantiated only from children */ | |||
QgsPythonRunner(); | QgsPythonRunner(); | |||
virtual ~QgsPythonRunner(); | virtual ~QgsPythonRunner(); | |||
virtual bool runCommand( QString command, QString messageOnError = QStr ing() ) = 0; | virtual bool runCommand( QString command, QString messageOnError = QStr ing() ) = 0; | |||
virtual bool evalCommand( QString command, QString& result ) = 0; | ||||
static QgsPythonRunner* mInstance; | static QgsPythonRunner* mInstance; | |||
}; | }; | |||
#endif // QGSPYTHONRUNNER_H | #endif // QGSPYTHONRUNNER_H | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 6 lines changed or added | |||
qgsquerybuilder.h | qgsquerybuilder.h | |||
---|---|---|---|---|
skipping to change at line 44 | skipping to change at line 44 | |||
* features displayed in a database layer. The fields in the table are | * features displayed in a database layer. The fields in the table are | |||
* displayed and sample values (or all values) can be viewed to aid in | * displayed and sample values (or all values) can be viewed to aid in | |||
* constructing the query. A test function returns the number of features t hat | * constructing the query. A test function returns the number of features t hat | |||
* will be returned. | * will be returned. | |||
* | * | |||
*/ | */ | |||
class GUI_EXPORT QgsQueryBuilder : public QDialog, private Ui::QgsQueryBuil derBase | class GUI_EXPORT QgsQueryBuilder : public QDialog, private Ui::QgsQueryBuil derBase | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
/*! Constructor which takes the table name. | ||||
* This constructor is used when adding layers to the map since | ||||
* the query builder connection as the layer selection dialog. | ||||
* @param tableName Name of the table being queried | ||||
* @param parent Parent widget | ||||
* @param fl dialog flags | ||||
*/ | ||||
QgsQueryBuilder( QString tableName, QWidget *parent = 0, | ||||
Qt::WFlags fl = QgisGui::ModalDialogFlags ); | ||||
/*! This constructor is used when the query builder is called from the | /*! This constructor is used when the query builder is called from the | |||
* vector layer properties dialog | * vector layer properties dialog | |||
* @param layer existing vector layer | * @param layer existing vector layer | |||
* @param parent Parent widget | * @param parent Parent widget | |||
* @param fl dialog flags | * @param fl dialog flags | |||
*/ | */ | |||
QgsQueryBuilder( QgsVectorLayer *layer, QWidget *parent = 0, | QgsQueryBuilder( QgsVectorLayer *layer, QWidget *parent = 0, | |||
Qt::WFlags fl = QgisGui::ModalDialogFlags ); | Qt::WFlags fl = QgisGui::ModalDialogFlags ); | |||
~QgsQueryBuilder(); | ~QgsQueryBuilder(); | |||
skipping to change at line 108 | skipping to change at line 98 | |||
* Get all distinct values for the field. Values are inserted | * Get all distinct values for the field. Values are inserted | |||
* into the value list box | * into the value list box | |||
*/ | */ | |||
void on_btnGetAllValues_clicked(); | void on_btnGetAllValues_clicked(); | |||
/*! | /*! | |||
* Get sample distinct values for the selected field. The sample size i s | * Get sample distinct values for the selected field. The sample size i s | |||
* limited to an arbitrary value (currently set to 25). The values | * limited to an arbitrary value (currently set to 25). The values | |||
* are inserted into the values list box. | * are inserted into the values list box. | |||
*/ | */ | |||
void on_btnSampleValues_clicked(); | void on_btnSampleValues_clicked(); | |||
void setDatasourceDescription( QString uri ); | void setDatasourceDescription( QString uri ); | |||
private: | private: | |||
/*! | /*! | |||
* Populate the field list for the selected table | * Populate the field list for the selected table | |||
*/ | */ | |||
void populateFields(); | void populateFields(); | |||
/*! | /*! | |||
* Setup models for listviews | * Setup models for listviews | |||
End of changes. 2 change blocks. | ||||
10 lines changed or deleted | 1 lines changed or added | |||
qgsrasterbandstats.h | qgsrasterbandstats.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
#ifndef QGSRASTERBANDSTATS | #ifndef QGSRASTERBANDSTATS | |||
#define QGSRASTERBANDSTATS | #define QGSRASTERBANDSTATS | |||
#include <QString> | #include <QString> | |||
#include <QVector> | #include <QVector> | |||
#include <limits> | #include <limits> | |||
#include "qgscolorrampshader.h" | #include "qgscolorrampshader.h" | |||
#include "qgsrectangle.h" | ||||
/** \ingroup core | /** \ingroup core | |||
* The RasterBandStats struct is a container for statistics about a single | * The RasterBandStats struct is a container for statistics about a single | |||
* raster band. | * raster band. | |||
*/ | */ | |||
class CORE_EXPORT QgsRasterBandStats | class CORE_EXPORT QgsRasterBandStats | |||
{ | { | |||
public: | public: | |||
typedef QVector<int> HistogramVector; | enum Stats | |||
{ | ||||
None = 0, | ||||
Min = 1, | ||||
Max = 1 << 1, | ||||
Range = 1 << 2, | ||||
Sum = 1 << 3, | ||||
Mean = 1 << 4, | ||||
StdDev = 1 << 5, | ||||
SumOfSquares = 1 << 6, | ||||
All = Min | Max | Range | Sum | Mean | StdDev | SumOfSquares | ||||
}; | ||||
QgsRasterBandStats() | QgsRasterBandStats() | |||
{ | { | |||
bandName = ""; | statsGathered = None; | |||
statsGathered = false; | ||||
minimumValue = std::numeric_limits<double>::max(); | minimumValue = std::numeric_limits<double>::max(); | |||
maximumValue = std::numeric_limits<double>::min(); | maximumValue = std::numeric_limits<double>::min(); | |||
range = 0.0; | range = 0.0; | |||
mean = 0.0; | mean = 0.0; | |||
sumOfSquares = 0.0; | sumOfSquares = 0.0; | |||
stdDev = 0.0; | stdDev = 0.0; | |||
sum = 0.0; | sum = 0.0; | |||
elementCount = 0; | elementCount = 0; | |||
histogramVector = new HistogramVector(); | width = 0; | |||
isHistogramEstimated = false; | height = 0; | |||
isHistogramOutOfRange = false; | } | |||
/*! Compares region, size etc. not collected statistics */ | ||||
bool contains( const QgsRasterBandStats &s ) const | ||||
{ | ||||
return ( s.bandNumber == bandNumber && | ||||
s.extent == extent && | ||||
s.width == width && | ||||
s.height == height && | ||||
s.statsGathered == ( statsGathered & s.statsGathered ) ); | ||||
} | } | |||
/** \brief The name of the band that these stats belong to. */ | /** \brief The name of the band that these stats belong to. */ | |||
QString bandName; | //QString bandName; | |||
/** \brief The gdal band number (starts at 1)*/ | /** \brief The gdal band number (starts at 1)*/ | |||
int bandNumber; | int bandNumber; | |||
/** Color table */ | /** \brief The number of not no data cells in the band. */ | |||
QList<QgsColorRampShader::ColorRampItem> colorTable; | // TODO: check if no data are excluded in stats calculation | |||
size_t elementCount; | ||||
/** \brief The number of cells in the band. Equivalent to height x widt | ||||
h. | ||||
* TODO: check if NO_DATA are excluded!*/ | ||||
int elementCount; | ||||
/** \brief whteher histogram values are estimated or completely calcula | ||||
ted */ | ||||
bool isHistogramEstimated; | ||||
/** whehter histogram compuation should include out of range values */ | ||||
bool isHistogramOutOfRange; | ||||
/** \brief Store the histogram for a given layer */ | ||||
HistogramVector * histogramVector; | ||||
/** \brief The maximum cell value in the raster band. NO_DATA values | /** \brief The maximum cell value in the raster band. NO_DATA values | |||
* are ignored. This does not use the gdal GetMaximmum function. */ | * are ignored. This does not use the gdal GetMaximmum function. */ | |||
double maximumValue; | double maximumValue; | |||
/** \brief The minimum cell value in the raster band. NO_DATA values | /** \brief The minimum cell value in the raster band. NO_DATA values | |||
* are ignored. This does not use the gdal GetMinimum function. */ | * are ignored. This does not use the gdal GetMinimum function. */ | |||
double minimumValue; | double minimumValue; | |||
/** \brief The mean cell value for the band. NO_DATA values are exclude d. */ | /** \brief The mean cell value for the band. NO_DATA values are exclude d. */ | |||
double mean; | double mean; | |||
/** \brief The range is the distance between min & max. */ | /** \brief The range is the distance between min & max. */ | |||
double range; | double range; | |||
/** \brief The standard deviation of the cell values. */ | /** \brief The standard deviation of the cell values. */ | |||
double stdDev; | double stdDev; | |||
/** \brief A flag to indicate whether this RasterBandStats struct | /** \brief Collected statistics */ | |||
* is completely populated */ | int statsGathered; | |||
bool statsGathered; | ||||
/** \brief The sum of all cells in the band. NO_DATA values are exclude d. */ | /** \brief The sum of all cells in the band. NO_DATA values are exclude d. */ | |||
double sum; | double sum; | |||
/** \brief The sum of the squares. Used to calculate standard deviation . */ | /** \brief The sum of the squares. Used to calculate standard deviation . */ | |||
double sumOfSquares; | double sumOfSquares; | |||
/** \brief Number of columns used to calc statistics */ | ||||
int width; | ||||
/** \brief Number of rows used to calc statistics */ | ||||
int height; | ||||
/** \brief Extent used to calc statistics */ | ||||
QgsRectangle extent; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
27 lines changed or deleted | 42 lines changed or added | |||
qgsrasterdataprovider.h | qgsrasterdataprovider.h | |||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
/* Thank you to Marco Hugentobler for the original vector DataProvider */ | /* Thank you to Marco Hugentobler for the original vector DataProvider */ | |||
#ifndef QGSRASTERDATAPROVIDER_H | #ifndef QGSRASTERDATAPROVIDER_H | |||
#define QGSRASTERDATAPROVIDER_H | #define QGSRASTERDATAPROVIDER_H | |||
#include <cmath> | ||||
#include <QDateTime> | #include <QDateTime> | |||
#include <QVariant> | ||||
#include "qgslogger.h" | ||||
#include "qgsrectangle.h" | ||||
#include "qgsdataprovider.h" | ||||
#include "qgscolorrampshader.h" | #include "qgscolorrampshader.h" | |||
#include "qgsrasterpyramid.h" | ||||
#include "qgscoordinatereferencesystem.h" | #include "qgscoordinatereferencesystem.h" | |||
#include "qgsdataprovider.h" | ||||
#include "qgserror.h" | ||||
#include "qgsfeature.h" | ||||
#include "qgsfield.h" | ||||
#include "qgslogger.h" | ||||
#include "qgsrasterbandstats.h" | #include "qgsrasterbandstats.h" | |||
#include "qgsraster.h" | ||||
#include "cpl_conv.h" | #include "qgsrasterhistogram.h" | |||
#include <cmath> | #include "qgsrasterinterface.h" | |||
#include "qgsrasterpyramid.h" | ||||
#include "qgsrasterrange.h" | ||||
#include "qgsrectangle.h" | ||||
class QImage; | class QImage; | |||
class QgsPoint; | ||||
class QByteArray; | class QByteArray; | |||
#define TINY_VALUE std::numeric_limits<double>::epsilon() * 20 | class QgsPoint; | |||
class QgsRasterIdentifyResult; | ||||
/** \ingroup core | /** \ingroup core | |||
* Base class for raster data providers. | * Base class for raster data providers. | |||
* | ||||
* \note This class has been copied and pasted from | ||||
* QgsVectorDataProvider, and does not yet make | ||||
* sense for Raster layers. | ||||
*/ | */ | |||
class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider | class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public Qg sRasterInterface | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
//! If you add to this, please also add to capabilitiesString() | ||||
enum Capability | ||||
{ | ||||
NoCapabilities = 0, | ||||
Identify = 1, | ||||
ExactMinimumMaximum = 1 << 1, | ||||
ExactResolution = 1 << 2, | ||||
EstimatedMinimumMaximum = 1 << 3, | ||||
BuildPyramids = 1 << 4, | ||||
Histogram = 1 << 5, | ||||
Size = 1 << 6 // has fixed source type | ||||
}; | ||||
// This is modified copy of GDALDataType | ||||
enum DataType | ||||
{ | ||||
/*! Unknown or unspecified type */ UnknownDataType = 0, | ||||
/*! Eight bit unsigned integer */ Byte = 1, | ||||
/*! Sixteen bit unsigned integer */ UInt16 = 2, | ||||
/*! Sixteen bit signed integer */ Int16 = 3, | ||||
/*! Thirty two bit unsigned integer */ UInt32 = 4, | ||||
/*! Thirty two bit signed integer */ Int32 = 5, | ||||
/*! Thirty two bit floating point */ Float32 = 6, | ||||
/*! Sixty four bit floating point */ Float64 = 7, | ||||
/*! Complex Int16 */ CInt16 = 8, | ||||
/*! Complex Int32 */ CInt32 = 9, | ||||
/*! Complex Float32 */ CFloat32 = 10, | ||||
/*! Complex Float64 */ CFloat64 = 11, | ||||
/*! Color, alpha, red, green, blue, 4 bytes */ ARGBDataType = 12, | ||||
TypeCount = 13 /* maximum type # + 1 */ | ||||
}; | ||||
// This is modified copy of GDALColorInterp | ||||
enum ColorInterpretation | ||||
{ | ||||
UndefinedColorInterpretation = 0, | ||||
/*! Greyscale */ GrayIndex = 1, | ||||
/*! Paletted (see associated color table) */ PaletteIndex = | ||||
2, | ||||
/*! Red band of RGBA image */ RedBand = 3, | ||||
/*! Green band of RGBA image */ GreenBand = 4, | ||||
/*! Blue band of RGBA image */ BlueBand = 5, | ||||
/*! Alpha (0=transparent, 255=opaque) */ AlphaBand = 6, | ||||
/*! Hue band of HLS image */ HueBand = 7, | ||||
/*! Saturation band of HLS image */ SaturationBand | ||||
= 8, | ||||
/*! Lightness band of HLS image */ LightnessBand = | ||||
9, | ||||
/*! Cyan band of CMYK image */ CyanBand = 10, | ||||
/*! Magenta band of CMYK image */ MagentaBand = 1 | ||||
1, | ||||
/*! Yellow band of CMYK image */ YellowBand = 12 | ||||
, | ||||
/*! Black band of CMLY image */ BlackBand = 13, | ||||
/*! Y Luminance */ YCbCr_YBand = 1 | ||||
4, | ||||
/*! Cb Chroma */ YCbCr_CbBand = | ||||
15, | ||||
/*! Cr Chroma */ YCbCr_CrBand = | ||||
16, | ||||
/*! Max current value */ ColorInterpreta | ||||
tionMax = 16 | ||||
}; | ||||
// Progress types | ||||
enum RasterProgressType | ||||
{ | ||||
ProgressHistogram = 0, | ||||
ProgressPyramids = 1, | ||||
ProgressStatistics = 2 | ||||
}; | ||||
QgsRasterDataProvider(); | QgsRasterDataProvider(); | |||
QgsRasterDataProvider( QString const & uri ); | QgsRasterDataProvider( const QString & uri ); | |||
virtual ~QgsRasterDataProvider() {}; | virtual ~QgsRasterDataProvider() {}; | |||
/** | virtual QgsRasterInterface * clone() const = 0; | |||
* Add the list of WMS layer names to be rendered by this server | ||||
*/ | ||||
virtual void addLayers( QStringList const & layers, | ||||
QStringList const & styles = QStringList() ) = | ||||
0; | ||||
//! get raster image encodings supported by (e.g.) the WMS Server, expr | /* It makes no sense to set input on provider */ | |||
essed as MIME types | bool setInput( QgsRasterInterface* input ) { Q_UNUSED( input ); return | |||
virtual QStringList supportedImageEncodings() = 0; | false; } | |||
/** | /** \brief Renders the layer as an image */ | |||
* Get the image encoding (as a MIME type) used in the transfer from (e | virtual QImage* draw( const QgsRectangle & viewExtent, int pixelWidth, | |||
.g.) the WMS server | int pixelHeight ) = 0; | |||
*/ | ||||
virtual QString imageEncoding() const = 0; | ||||
/** | ||||
* Set the image encoding (as a MIME type) used in the transfer from (e | ||||
.g.) the WMS server | ||||
*/ | ||||
virtual void setImageEncoding( QString const & mimeType ) = 0; | ||||
/** | ||||
* Set the image projection (in WMS CRS format) used in the transfer fr | ||||
om (e.g.) the WMS server | ||||
*/ | ||||
virtual void setImageCrs( QString const & crs ) = 0; | ||||
// TODO: Document this better. | /** Get the extent of the data source. | |||
/** \brief Renders the layer as an image | * @return QgsRectangle containing the extent of the layer */ | |||
*/ | virtual QgsRectangle extent() = 0; | |||
virtual QImage* draw( QgsRectangle const & viewExtent, int pixelWidth, | ||||
int pixelHeight ) = 0; | ||||
/** Returns a bitmask containing the supported capabilities | ||||
Note, some capabilities may change depending on whether | ||||
a spatial filter is active on this provider, so it may | ||||
be prudent to check this value per intended operation. | ||||
*/ | ||||
virtual int capabilities() const | ||||
{ | ||||
return QgsRasterDataProvider::NoCapabilities; | ||||
} | ||||
/** | ||||
* Returns the above in friendly format. | ||||
*/ | ||||
QString capabilitiesString() const; | ||||
// TODO: Get the supported formats by this provider | ||||
// TODO: Get the file masks supported by this provider, suitable for fe | ||||
eding into the file open dialog box | ||||
/** Returns data type for the band specified by number */ | /** Returns data type for the band specified by number */ | |||
virtual int dataType( int bandNo ) const | virtual QGis::DataType dataType( int bandNo ) const = 0; | |||
{ | ||||
return srcDataType( bandNo ); | ||||
} | ||||
/** Returns source data type for the band specified by number, | /** Returns source data type for the band specified by number, | |||
* source data type may be shorter than dataType | * source data type may be shorter than dataType */ | |||
*/ | virtual QGis::DataType srcDataType( int bandNo ) const = 0; | |||
virtual int srcDataType( int bandNo ) const | ||||
{ | ||||
Q_UNUSED( bandNo ); | ||||
return QgsRasterDataProvider::UnknownDataType; | ||||
} | ||||
int typeSize( int dataType ) const | ||||
{ | ||||
// modified copy from GDAL | ||||
switch ( dataType ) | ||||
{ | ||||
case Byte: | ||||
return 8; | ||||
case UInt16: | ||||
case Int16: | ||||
return 16; | ||||
case UInt32: | ||||
case Int32: | ||||
case Float32: | ||||
case CInt16: | ||||
return 32; | ||||
case Float64: | ||||
case CInt32: | ||||
case CFloat32: | ||||
return 64; | ||||
case CFloat64: | ||||
return 128; | ||||
case ARGBDataType: | ||||
return 32; | ||||
default: | ||||
return 0; | ||||
} | ||||
} | ||||
int dataTypeSize( int bandNo ) const | ||||
{ | ||||
return typeSize( dataType( bandNo ) ); | ||||
} | ||||
/** Get numbur of bands */ | ||||
virtual int bandCount() const | ||||
{ | ||||
return 1; | ||||
} | ||||
/** Returns data type for the band specified by number */ | /** Returns data type for the band specified by number */ | |||
virtual int colorInterpretation( int theBandNo ) const | virtual int colorInterpretation( int theBandNo ) const | |||
{ | { | |||
Q_UNUSED( theBandNo ); | Q_UNUSED( theBandNo ); | |||
return QgsRasterDataProvider::UndefinedColorInterpretation; | return QgsRaster::UndefinedColorInterpretation; | |||
} | } | |||
QString colorName( int colorInterpretation ) const | QString colorName( int colorInterpretation ) const | |||
{ | { | |||
// Modified copy from GDAL | // Modified copy from GDAL | |||
switch ( colorInterpretation ) | switch ( colorInterpretation ) | |||
{ | { | |||
case UndefinedColorInterpretation: | case QgsRaster::UndefinedColorInterpretation: | |||
return "Undefined"; | return "Undefined"; | |||
case GrayIndex: | case QgsRaster::GrayIndex: | |||
return "Gray"; | return "Gray"; | |||
case PaletteIndex: | case QgsRaster::PaletteIndex: | |||
return "Palette"; | return "Palette"; | |||
case RedBand: | case QgsRaster::RedBand: | |||
return "Red"; | return "Red"; | |||
case GreenBand: | case QgsRaster::GreenBand: | |||
return "Green"; | return "Green"; | |||
case BlueBand: | case QgsRaster::BlueBand: | |||
return "Blue"; | return "Blue"; | |||
case AlphaBand: | case QgsRaster::AlphaBand: | |||
return "Alpha"; | return "Alpha"; | |||
case HueBand: | case QgsRaster::HueBand: | |||
return "Hue"; | return "Hue"; | |||
case SaturationBand: | case QgsRaster::SaturationBand: | |||
return "Saturation"; | return "Saturation"; | |||
case LightnessBand: | case QgsRaster::LightnessBand: | |||
return "Lightness"; | return "Lightness"; | |||
case CyanBand: | case QgsRaster::CyanBand: | |||
return "Cyan"; | return "Cyan"; | |||
case MagentaBand: | case QgsRaster::MagentaBand: | |||
return "Magenta"; | return "Magenta"; | |||
case YellowBand: | case QgsRaster::YellowBand: | |||
return "Yellow"; | return "Yellow"; | |||
case BlackBand: | case QgsRaster::BlackBand: | |||
return "Black"; | return "Black"; | |||
case YCbCr_YBand: | case QgsRaster::YCbCr_YBand: | |||
return "YCbCr_Y"; | return "YCbCr_Y"; | |||
case YCbCr_CbBand: | case QgsRaster::YCbCr_CbBand: | |||
return "YCbCr_Cb"; | return "YCbCr_Cb"; | |||
case YCbCr_CrBand: | case QgsRaster::YCbCr_CrBand: | |||
return "YCbCr_Cr"; | return "YCbCr_Cr"; | |||
default: | default: | |||
return "Unknown"; | return "Unknown"; | |||
} | } | |||
} | } | |||
/** Reload data (data could change) */ | /** Reload data (data could change) */ | |||
virtual bool reload( ) { return true; } | virtual bool reload() { return true; } | |||
virtual QString colorInterpretationName( int theBandNo ) const | virtual QString colorInterpretationName( int theBandNo ) const | |||
{ | { | |||
return colorName( colorInterpretation( theBandNo ) ); | return colorName( colorInterpretation( theBandNo ) ); | |||
} | } | |||
/** Get block size */ | // TODO: remove or make protected all readBlock working with void* | |||
virtual int xBlockSize() const { return 0; } | ||||
virtual int yBlockSize() const { return 0; } | ||||
/** Get raster size */ | ||||
virtual int xSize() const { return 0; } | ||||
virtual int ySize() const { return 0; } | ||||
/** read block of data */ | /** Read block of data using given extent and size. */ | |||
// TODO clarify what happens on the last block (the part outside raster | virtual QgsRasterBlock *block( int theBandNo, const QgsRectangle &theEx | |||
) | tent, int theWidth, int theHeight ); | |||
virtual void readBlock( int bandNo, int xBlock, int yBlock, void *data | ||||
) | ||||
{ Q_UNUSED( bandNo ); Q_UNUSED( xBlock ); Q_UNUSED( yBlock ); Q_UNUSED( | ||||
data ); } | ||||
/** read block of data using give extent and size */ | /* Return true if source band has no data value */ | |||
virtual void readBlock( int bandNo, QgsRectangle const & viewExtent, i | virtual bool srcHasNoDataValue( int bandNo ) const { return mSrcHasNoDa | |||
nt width, int height, void *data ) | taValue.value( bandNo -1 ); } | |||
{ Q_UNUSED( bandNo ); Q_UNUSED( viewExtent ); Q_UNUSED( width ); Q_UNUS | ||||
ED( height ); Q_UNUSED( data ); } | ||||
/** read block of data using give extent and size */ | /** \brief Get source nodata value usage */ | |||
virtual void readBlock( int bandNo, QgsRectangle const & viewExtent, i | virtual bool useSrcNoDataValue( int bandNo ) const { return mUseSrcNoDa | |||
nt width, int height, QgsCoordinateReferenceSystem theSrcCRS, QgsCoordinate | taValue.value( bandNo -1 ); } | |||
ReferenceSystem theDestCRS, void *data ); | ||||
/* Read a value from a data block at a given index. */ | /** \brief Set source nodata value usage */ | |||
virtual double readValue( void *data, int type, int index ); | virtual void setUseSrcNoDataValue( int bandNo, bool use ); | |||
/** value representing null data */ | /** Value representing no data value. */ | |||
virtual double noDataValue() const { return 0; } | virtual double srcNoDataValue( int bandNo ) const { return mSrcNoDataVa | |||
lue.value( bandNo -1 ); } | ||||
virtual double minimumValue( int bandNo ) const { Q_UNUSED( bandNo ); r | virtual void setUserNoDataValue( int bandNo, QgsRasterRangeList noData | |||
eturn 0; } | ); | |||
virtual double maximumValue( int bandNo ) const { Q_UNUSED( bandNo ); r | ||||
eturn 0; } | /** Get list of user no data value ranges */ | |||
virtual QgsRasterRangeList userNoDataValues( int bandNo ) const { retu | ||||
rn mUserNoDataValue.value( bandNo -1 ); } | ||||
virtual QList<QgsColorRampShader::ColorRampItem> colorTable( int bandNo ) const | virtual QList<QgsColorRampShader::ColorRampItem> colorTable( int bandNo ) const | |||
{ Q_UNUSED( bandNo ); return QList<QgsColorRampShader::ColorRampItem>() ; } | { Q_UNUSED( bandNo ); return QList<QgsColorRampShader::ColorRampItem>() ; } | |||
// Defined in parent | /** \brief Returns the sublayers of this layer - useful for providers t | |||
/** \brief Returns the sublayers of this layer - Useful for providers t | hat manage | |||
hat manage their own layers, such as WMS */ | * their own layers, such as WMS */ | |||
virtual QStringList subLayers() const | virtual QStringList subLayers() const | |||
{ | { | |||
return QStringList(); | return QStringList(); | |||
} | } | |||
/** \brief Populate the histogram vector for a given band */ | ||||
virtual void populateHistogram( int theBandNoInt, | ||||
QgsRasterBandStats & theBandStats, | ||||
int theBinCountInt = 256, | ||||
bool theIgnoreOutOfRangeFlag = true, | ||||
bool theThoroughBandScanFlag = false | ||||
) | ||||
{ Q_UNUSED( theBandNoInt ); Q_UNUSED( theBandStats ); Q_UNUSED( theBinC | ||||
ountInt ); Q_UNUSED( theIgnoreOutOfRangeFlag ); Q_UNUSED( theThoroughBandSc | ||||
anFlag ); } | ||||
/** \brief Create pyramid overviews */ | /** \brief Create pyramid overviews */ | |||
virtual QString buildPyramids( const QList<QgsRasterPyramid> & thePyra | virtual QString buildPyramids( const QList<QgsRasterPyramid> & thePyram | |||
midList, | idList, | |||
const QString & theResamplingMethod = " | const QString & theResamplingMethod = "N | |||
NEAREST", | EAREST", | |||
bool theTryInternalFlag = false ) | QgsRaster::RasterPyramidsFormat theForma | |||
{ Q_UNUSED( thePyramidList ); Q_UNUSED( theResamplingMethod ); Q_UNUSED | t = QgsRaster::PyramidsGTiff, | |||
( theTryInternalFlag ); return "FAILED_NOT_SUPPORTED"; }; | const QStringList & theConfigOptions = Q | |||
StringList() ) | ||||
{ | ||||
Q_UNUSED( thePyramidList ); Q_UNUSED( theResamplingMethod ); | ||||
Q_UNUSED( theFormat ); Q_UNUSED( theConfigOptions ); | ||||
return "FAILED_NOT_SUPPORTED"; | ||||
}; | ||||
/** \brief Accessor for ths raster layers pyramid list. A pyramid list | /** \brief Accessor for ths raster layers pyramid list. | |||
defines the | * @param overviewList used to construct the pyramid list (optional), w | |||
hen empty the list is defined by the provider. | ||||
* A pyramid list defines the | ||||
* POTENTIAL pyramids that can be in a raster. To know which of the pyr amid layers | * POTENTIAL pyramids that can be in a raster. To know which of the pyr amid layers | |||
* ACTUALLY exists you need to look at the existsFlag member in each st ruct stored in the | * ACTUALLY exists you need to look at the existsFlag member in each st ruct stored in the | |||
* list. | * list. | |||
*/ | */ | |||
virtual QList<QgsRasterPyramid> buildPyramidList() { return QList<QgsRa | virtual QList<QgsRasterPyramid> buildPyramidList( QList<int> overviewLi | |||
sterPyramid>(); }; | st = QList<int>() ) | |||
{ Q_UNUSED( overviewList ); return QList<QgsRasterPyramid>(); }; | ||||
/** If the provider supports it, return band stats for the | ||||
given band. Default behaviour is to blockwise read the data | ||||
and generate the stats unless the provider overloads this function. | ||||
*/ | ||||
virtual QgsRasterBandStats bandStatistics( int theBandNo ); | ||||
/** \brief helper function to create zero padded band names */ | /** \brief Returns true if raster has at least one populated histogram. | |||
QString generateBandName( int theBandNumber ) | */ | |||
{ | bool hasPyramids(); | |||
return tr( "Band" ) + QString( " %1" ) .arg( theBandNumber, 1 + ( in | ||||
t ) log10(( float ) bandCount() ), 10, QChar( '0' ) ); | ||||
} | ||||
/** | /** | |||
* Get metadata in a format suitable for feeding directly | * Get metadata in a format suitable for feeding directly | |||
* into a subset of the GUI raster properties "Metadata" tab. | * into a subset of the GUI raster properties "Metadata" tab. | |||
*/ | */ | |||
virtual QString metadata() = 0; | virtual QString metadata() = 0; | |||
/** \brief Identify raster value(s) found on the point position */ | /** \brief Identify raster value(s) found on the point position. The co | |||
virtual bool identify( const QgsPoint & point, QMap<QString, QString>& | ntext | |||
results ); | * parameters theExtent, theWidth and theHeigh are important to | |||
identify | ||||
/** | * on the same zoom level as a displayed map and to do effectiv | |||
* \brief Identify details from a server (e.g. WMS) from the last scree | e | |||
n update | * caching (WCS). If context params are not specified the highe | |||
* | st | |||
* \param[in] point The pixel coordinate (as it was displayed locally | * resolution is used. capabilities() may be used to test if fo | |||
on screen) | rmat | |||
* | * is supported by provider. Values are set to 'no data' or emp | |||
* \return A text document containing the return from the WMS server | ty string | |||
* | * if point is outside data source extent. | |||
* \note WMS Servers prefer to receive coordinates in image space, ther | ||||
efore | ||||
* this function expects coordinates in that format. | ||||
* | * | |||
* \note The arbitraryness of the returned document is enforced by WMS standards | * \note The arbitraryness of the returned document is enforced by WMS standards | |||
* up to at least v1.3.0 | * up to at least v1.3.0 | |||
* @param thePoint coordinates in data source CRS | ||||
* @param theFormat result format | ||||
* @param theExtent context extent | ||||
* @param theWidth context width | ||||
* @param theHeight context height | ||||
* @return QgsRaster::IdentifyFormatValue: map of values for each band, | ||||
keys are band numbers | ||||
* (from 1). | ||||
* QgsRaster::IdentifyFormatFeature: map of QgsRasterFeatureLis | ||||
t for each sublayer | ||||
* (WMS) - TODO: it is not consistent with QgsRaster::IdentifyF | ||||
ormatValue. | ||||
* QgsRaster::IdentifyFormatHtml: map of HTML strings for each | ||||
sublayer (WMS). | ||||
* Empty if failed or there are no results (TODO: better error | ||||
reporting). | ||||
*/ | */ | |||
virtual QString identifyAsText( const QgsPoint& point ) = 0; | //virtual QMap<int, QVariant> identify( const QgsPoint & thePoint, QgsR | |||
aster::IdentifyFormat theFormat, const QgsRectangle &theExtent = QgsRectang | ||||
/** | le(), int theWidth = 0, int theHeight = 0 ); | |||
* \brief Identify details from a server (e.g. WMS) from the last scree | virtual QgsRasterIdentifyResult identify( const QgsPoint & thePoint, Qg | |||
n update | sRaster::IdentifyFormat theFormat, const QgsRectangle &theExtent = QgsRecta | |||
* | ngle(), int theWidth = 0, int theHeight = 0 ); | |||
* \param[in] point The pixel coordinate (as it was displayed locally | ||||
on screen) | ||||
* | ||||
* \return A html document containing the return from the WMS server | ||||
* | ||||
* \note WMS Servers prefer to receive coordinates in image space, ther | ||||
efore | ||||
* this function expects coordinates in that format. | ||||
* | ||||
* \note The arbitraryness of the returned document is enforced by WMS | ||||
standards | ||||
* up to at least v1.3.0 | ||||
* | ||||
* \note added in 1.5 | ||||
*/ | ||||
virtual QString identifyAsHtml( const QgsPoint& point ) = 0; | ||||
/** | /** | |||
* \brief Returns the caption error text for the last error in this p rovider | * \brief Returns the caption error text for the last error in this p rovider | |||
* | * | |||
* If an operation returns 0 (e.g. draw()), this function | * If an operation returns 0 (e.g. draw()), this function | |||
* returns the text of the error associated with the failure. | * returns the text of the error associated with the failure. | |||
* Interactive users of this provider can then, for example, | * Interactive users of this provider can then, for example, | |||
* call a QMessageBox to display the contents. | * call a QMessageBox to display the contents. | |||
* | * | |||
*/ | */ | |||
skipping to change at line 450 | skipping to change at line 273 | |||
*/ | */ | |||
virtual QString lastError() = 0; | virtual QString lastError() = 0; | |||
/** | /** | |||
* \brief Returns the format of the error text for the last error in this provider | * \brief Returns the format of the error text for the last error in this provider | |||
* | * | |||
* \note added in 1.6 | * \note added in 1.6 | |||
*/ | */ | |||
virtual QString lastErrorFormat(); | virtual QString lastErrorFormat(); | |||
//virtual void buildSupportedRasterFileFilter( QString & theFileFilters | ||||
String ) ; | ||||
/** This helper checks to see whether the file name appears to be a val | ||||
id | ||||
* raster file name. If the file name looks like it could be valid, | ||||
* but some sort of error occurs in processing the file, the error is | ||||
* returned in retError. | ||||
*/ | ||||
//virtual bool isValidRasterFileName( QString const & theFileNameQStrin | ||||
g, QString & retErrMsg ) { return false; } ; | ||||
//virtual bool isValidRasterFileName( const QString & theFileNameQStrin | ||||
g ) { return false; }; | ||||
/**Returns the dpi of the output device. | /**Returns the dpi of the output device. | |||
@note: this method was added in version 1.2*/ | @note: this method was added in version 1.2*/ | |||
int dpi() const {return mDpi;} | int dpi() const {return mDpi;} | |||
/**Sets the output device resolution. | /**Sets the output device resolution. | |||
@note: this method was added in version 1.2*/ | @note: this method was added in version 1.2*/ | |||
void setDpi( int dpi ) {mDpi = dpi;} | void setDpi( int dpi ) {mDpi = dpi;} | |||
/** \brief Is the NoDataValue Valid */ | ||||
bool isNoDataValueValid() const { return mValidNoDataValue; } | ||||
static QStringList cStringList2Q_( char ** stringList ); | ||||
static QString makeTableCell( QString const & value ); | ||||
static QString makeTableCells( QStringList const & values ); | ||||
/** \brief Set null value in char */ | ||||
QByteArray noValueBytes( int theBandNo ); | ||||
/** Time stamp of data source in the moment when data/metadata were loa ded by provider */ | /** Time stamp of data source in the moment when data/metadata were loa ded by provider */ | |||
virtual QDateTime timestamp() const { return mTimestamp; } | virtual QDateTime timestamp() const { return mTimestamp; } | |||
/** Current time stamp of data source */ | /** Current time stamp of data source */ | |||
virtual QDateTime dataTimestamp() const { return QDateTime(); } | virtual QDateTime dataTimestamp() const { return QDateTime(); } | |||
/**Writes into the provider datasource*/ | ||||
// TODO: add data type (may be defferent from band type) | ||||
virtual bool write( void* data, int band, int width, int height, int xO | ||||
ffset, int yOffset ) | ||||
{ | ||||
Q_UNUSED( data ); | ||||
Q_UNUSED( band ); | ||||
Q_UNUSED( width ); | ||||
Q_UNUSED( height ); | ||||
Q_UNUSED( xOffset ); | ||||
Q_UNUSED( yOffset ); | ||||
return false; | ||||
} | ||||
/** Creates a new dataset with mDataSourceURI */ | ||||
static QgsRasterDataProvider* create( const QString &providerKey, | ||||
const QString &uri, | ||||
const QString& format, int nBands | ||||
, | ||||
QGis::DataType type, | ||||
int width, int height, double* ge | ||||
oTransform, | ||||
const QgsCoordinateReferenceSyste | ||||
m& crs, | ||||
QStringList createOptions = QStri | ||||
ngList() ); | ||||
/** Set no data value on created dataset | ||||
* @param bandNo band number | ||||
* @param noDataValue no data value | ||||
*/ | ||||
virtual bool setNoDataValue( int bandNo, double noDataValue ) { Q_UNUSE | ||||
D( bandNo ); Q_UNUSED( noDataValue ); return false; } | ||||
/** Returns the formats supported by create() */ | ||||
// TODO: this should be static and call C functions in provider library | ||||
//static QStringList createFormats(); | ||||
/** Remove dataset*/ | ||||
virtual bool remove() { return false; } | ||||
/** Returns a list of pyramid resampling method name and label pairs | ||||
* for given provider */ | ||||
static QList<QPair<QString, QString> > pyramidResamplingMethods( QStrin | ||||
g providerKey ); | ||||
/** Validates creation options for a specific dataset and destination f | ||||
ormat. | ||||
* @note used by GDAL provider only | ||||
* @note see also validateCreationOptionsFormat() in gdal provider for | ||||
validating options based on format only */ | ||||
virtual QString validateCreationOptions( const QStringList& createOptio | ||||
ns, QString format ) | ||||
{ Q_UNUSED( createOptions ); Q_UNUSED( format ); return QString(); } | ||||
/** Validates pyramid creation options for a specific dataset and desti | ||||
nation format | ||||
* @note used by GDAL provider only */ | ||||
virtual QString validatePyramidsConfigOptions( QgsRaster::RasterPyramid | ||||
sFormat pyramidsFormat, | ||||
const QStringList & theConfigOptions, const QString & fileFormat ) | ||||
{ Q_UNUSED( pyramidsFormat ); Q_UNUSED( theConfigOptions ); Q_UNUSED( f | ||||
ileFormat ); return QString(); } | ||||
static QString identifyFormatName( QgsRaster::IdentifyFormat format ); | ||||
static QgsRaster::IdentifyFormat identifyFormatFromName( QString format | ||||
Name ); | ||||
static QString identifyFormatLabel( QgsRaster::IdentifyFormat format ); | ||||
static Capability identifyFormatToCapability( QgsRaster::IdentifyFormat | ||||
format ); | ||||
signals: | signals: | |||
/** Emit a signal to notify of the progress event. | /** Emit a signal to notify of the progress event. | |||
* Emited theProgress is in percents (0.0-100.0) */ | * Emitted theProgress is in percents (0.0-100.0) */ | |||
void progress( int theType, double theProgress, QString theMessage ); | void progress( int theType, double theProgress, QString theMessage ); | |||
void progressUpdate( int theProgress ); | ||||
protected: | protected: | |||
/**Dots per intch. Extended WMS (e.g. QGIS mapserver) support DPI depen | /** Read block of data | |||
dent output and therefore | * @note not available in python bindings */ | |||
virtual void readBlock( int bandNo, int xBlock, int yBlock, void *data | ||||
) | ||||
{ Q_UNUSED( bandNo ); Q_UNUSED( xBlock ); Q_UNUSED( yBlock ); Q_UNUSED( | ||||
data ); } | ||||
/** Read block of data using give extent and size | ||||
* @note not available in python bindings */ | ||||
virtual void readBlock( int bandNo, QgsRectangle const & viewExtent, i | ||||
nt width, int height, void *data ) | ||||
{ Q_UNUSED( bandNo ); Q_UNUSED( viewExtent ); Q_UNUSED( width ); Q_UNUS | ||||
ED( height ); Q_UNUSED( data ); } | ||||
/** Returns true if user no data contains value */ | ||||
bool userNoDataValuesContains( int bandNo, double value ) const; | ||||
static QStringList cStringList2Q_( char ** stringList ); | ||||
static QString makeTableCell( const QString & value ); | ||||
static QString makeTableCells( const QStringList & values ); | ||||
/** Dots per inch. Extended WMS (e.g. QGIS mapserver) support DPI depen | ||||
dent output and therefore | ||||
are suited for printing. A value of -1 means it has not been set | are suited for printing. A value of -1 means it has not been set | |||
@note: this member has been added in version 1.2*/ | @note: this member has been added in version 1.2*/ | |||
int mDpi; | int mDpi; | |||
/** \brief Cell value representing no data. e.g. -9999, indexed from 0 | /** Source no data value is available and is set to be used or internal | |||
*/ | no data | |||
QList<double> mNoDataValue; | * is available. Used internally only */ | |||
//bool hasNoDataValue ( int theBandNo ); | ||||
/** \brief Flag indicating if the nodatavalue is valid*/ | ||||
bool mValidNoDataValue; | /** \brief Cell value representing original source no data. e.g. -9999, | |||
indexed from 0 */ | ||||
QList<double> mSrcNoDataValue; | ||||
/** \brief Source no data value exists. */ | ||||
QList<bool> mSrcHasNoDataValue; | ||||
/** \brief Use source nodata value. User can disable usage of source no | ||||
data | ||||
* value as nodata. It may happen that a value is wrongly given by GDA | ||||
L | ||||
* as nodata (e.g. 0) and it has to be treated as regular value. */ | ||||
QList<bool> mUseSrcNoDataValue; | ||||
/** \brief List of lists of user defined additional no data values | ||||
* for each band, indexed from 0 */ | ||||
QList< QgsRasterRangeList > mUserNoDataValue; | ||||
QgsRectangle mExtent; | QgsRectangle mExtent; | |||
}; | ||||
static void initPyramidResamplingDefs(); | ||||
static QStringList mPyramidResamplingListGdal; | ||||
static QgsStringMap mPyramidResamplingMapGdal; | ||||
}; | ||||
#endif | #endif | |||
End of changes. 63 change blocks. | ||||
358 lines changed or deleted | 256 lines changed or added | |||
qgsrasterlayer.h | qgsrasterlayer.h | |||
---|---|---|---|---|
skipping to change at line 24 | skipping to change at line 24 | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSRASTERLAYER_H | #ifndef QGSRASTERLAYER_H | |||
#define QGSRASTERLAYER_H | #define QGSRASTERLAYER_H | |||
// | ||||
// Includes | ||||
// | ||||
#include <QColor> | #include <QColor> | |||
#include <QDateTime> | #include <QDateTime> | |||
#include <QVector> | ||||
#include <QList> | #include <QList> | |||
#include <QMap> | #include <QMap> | |||
#include <QPair> | #include <QPair> | |||
#include <QVector> | ||||
#include "qgis.h" | #include "qgis.h" | |||
#include "qgspoint.h" | #include "qgsbrightnesscontrastfilter.h" | |||
#include "qgsmaplayer.h" | ||||
#include "qgsrasterviewport.h" | ||||
#include "qgscontrastenhancement.h" | ||||
#include "qgsrastertransparency.h" | ||||
#include "qgsrastershader.h" | ||||
#include "qgscolorrampshader.h" | #include "qgscolorrampshader.h" | |||
#include "qgsrastershaderfunction.h" | #include "qgscontrastenhancement.h" | |||
#include "qgshuesaturationfilter.h" | ||||
#include "qgsmaplayer.h" | ||||
#include "qgspoint.h" | ||||
#include "qgsraster.h" | ||||
#include "qgsrasterdataprovider.h" | #include "qgsrasterdataprovider.h" | |||
#include "qgsrasterinterface.h" | ||||
#include "qgsrasterpipe.h" | ||||
#include "qgsrasterresamplefilter.h" | ||||
#include "qgsrastershaderfunction.h" | ||||
#include "qgsrastershader.h" | ||||
#include "qgsrastertransparency.h" | ||||
#include "qgsrasterviewport.h" | ||||
// | ||||
// Forward declarations | ||||
// | ||||
class QgsMapToPixel; | class QgsMapToPixel; | |||
class QgsRasterRenderer; | ||||
class QgsRectangle; | class QgsRectangle; | |||
class QgsRasterBandStats; | ||||
class QgsRasterPyramid; | ||||
class QImage; | class QImage; | |||
class QLibrary; | ||||
class QPixmap; | class QPixmap; | |||
class QSlider; | class QSlider; | |||
class QLibrary; | ||||
/** \ingroup core | /** \ingroup core | |||
* This class provides qgis with the ability to render raster datasets | * This class provides qgis with the ability to render raster datasets | |||
* onto the mapcanvas. | * onto the mapcanvas. | |||
* | * | |||
* The qgsrasterlayer class makes use of gdal for data io, and thus suppor ts | * The qgsrasterlayer class makes use of gdal for data io, and thus suppor ts | |||
* any gdal supported format. The constructor attempts to infer what type of | * any gdal supported format. The constructor attempts to infer what type of | |||
* file (LayerType) is being opened - not in terms of the file format (tif , ascii grid etc.) | * file (LayerType) is being opened - not in terms of the file format (tif , ascii grid etc.) | |||
* but rather in terms of whether the image is a GRAYSCALE, PaletteD or Mu ltiband, | * but rather in terms of whether the image is a GRAYSCALE, PaletteD or Mu ltiband, | |||
* | * | |||
skipping to change at line 173 | skipping to change at line 171 | |||
* Mappings are non-exclusive. That is a given band can be assigned to no, some or all | * Mappings are non-exclusive. That is a given band can be assigned to no, some or all | |||
* color mappings. The constructor sets sensible defaults for band mapping s but these can be | * color mappings. The constructor sets sensible defaults for band mapping s but these can be | |||
* overridden at run time using the setRedBandName, setGreenBandName, setB lueBandName and setGrayBandName | * overridden at run time using the setRedBandName, setGreenBandName, setB lueBandName and setGrayBandName | |||
* methods. | * methods. | |||
*/ | */ | |||
class CORE_EXPORT QgsRasterLayer : public QgsMapLayer | class CORE_EXPORT QgsRasterLayer : public QgsMapLayer | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
/** \brief Default cumulative cut lower limit */ | ||||
static const double CUMULATIVE_CUT_LOWER; | ||||
/** \brief Default cumulative cut upper limit */ | ||||
static const double CUMULATIVE_CUT_UPPER; | ||||
/** \brief Default sample size (number of pixels) for estimated statis | ||||
tics/histogram calculation */ | ||||
static const double SAMPLE_SIZE; | ||||
/** \brief Constructor. Provider is not set. */ | ||||
QgsRasterLayer(); | ||||
/** \brief This is the constructor for the RasterLayer class. | /** \brief This is the constructor for the RasterLayer class. | |||
* | * | |||
* The main tasks carried out by the constructor are: | * The main tasks carried out by the constructor are: | |||
* | * | |||
* -Load the rasters default style (.qml) file if it exists | * -Load the rasters default style (.qml) file if it exists | |||
* | * | |||
* -Populate the RasterStatsVector with initial values for each band. | * -Populate the RasterStatsVector with initial values for each band. | |||
* | * | |||
* -Calculate the layer extents | * -Calculate the layer extents | |||
* | * | |||
* -Determine whether the layer is gray, paletted or multiband. | * -Determine whether the layer is gray, paletted or multiband. | |||
* | * | |||
* -Assign sensible defaults for the red, green, blue and gray bands. | * -Assign sensible defaults for the red, green, blue and gray bands. | |||
* | * | |||
* - | * - | |||
* */ | * */ | |||
QgsRasterLayer( const QString & path = QString::null, | QgsRasterLayer( const QString & path, | |||
const QString & baseName = QString::null, | const QString & baseName = QString::null, | |||
bool loadDefaultStyleFlag = true ); | bool loadDefaultStyleFlag = true ); | |||
/** \brief [ data provider interface ] Constructor in provider mode */ | /** \brief [ data provider interface ] Constructor in provider mode */ | |||
QgsRasterLayer( int dummy, | QgsRasterLayer( const QString & uri, | |||
const QString & baseName = QString(), | const QString & baseName, | |||
const QString & path = QString(), | const QString & providerKey, | |||
const QString & providerLib = QString(), | bool loadDefaultStyleFlag = true ); | |||
const QStringList & layers = QStringList(), | ||||
const QStringList & styles = QStringList(), | ||||
const QString & format = QString(), | ||||
const QString & crs = QString() ); | ||||
/** \brief The destructor */ | /** \brief The destructor */ | |||
~QgsRasterLayer(); | ~QgsRasterLayer(); | |||
// | ||||
// Enums, structs and typedefs | ||||
// | ||||
/** \brief This enumerator describes the types of shading that can be u sed */ | /** \brief This enumerator describes the types of shading that can be u sed */ | |||
enum ColorShadingAlgorithm | enum ColorShadingAlgorithm | |||
{ | { | |||
UndefinedShader, | UndefinedShader, | |||
PseudoColorShader, | PseudoColorShader, | |||
FreakOutShader, | FreakOutShader, | |||
ColorRampShader, | ColorRampShader, | |||
UserDefinedShader | UserDefinedShader | |||
}; | }; | |||
/** \brief This enumerator describes the different kinds of drawing we | ||||
can do */ | ||||
enum DrawingStyle | ||||
{ | ||||
UndefinedDrawingStyle, | ||||
SingleBandGray, // a single band image drawn as a ran | ||||
ge of gray colors | ||||
SingleBandPseudoColor, // a single band image drawn using a | ||||
pseudocolor algorithm | ||||
PalettedColor, //a "Palette" image drawn using color | ||||
table | ||||
PalettedSingleBandGray, // a "Palette" layer drawn in gray sca | ||||
le | ||||
PalettedSingleBandPseudoColor, // a "Palette" layerdrawn using a pseu | ||||
docolor algorithm | ||||
PalettedMultiBandColor, // currently not supported | ||||
MultiBandSingleGandGray, // a layer containing 2 or more bands | ||||
, but a single band drawn as a range of gray colors | ||||
//added in 1.6 to fix naming glitch | ||||
MultiBandSingleBandGray = MultiBandSingleGandGray, // a layer contain | ||||
ing 2 or more bands, but a single band drawn as a range of gray colors | ||||
MultiBandSingleBandPseudoColor, //a layer containing 2 or more bands, | ||||
but a single band drawn using a pseudocolor algorithm | ||||
MultiBandColor, //a layer containing 2 or more bands | ||||
, mapped to RGB color space. In the case of a multiband with only two bands | ||||
, one band will be mapped to more than one color. | ||||
SingleBandColorDataStyle // ARGB values rendered directly | ||||
}; | ||||
/** \brief This enumerator describes the type of raster layer */ | /** \brief This enumerator describes the type of raster layer */ | |||
enum LayerType | enum LayerType | |||
{ | { | |||
GrayOrUndefined, | GrayOrUndefined, | |||
Palette, | Palette, | |||
Multiband, | Multiband, | |||
ColorLayer | ColorLayer | |||
} ; | }; | |||
/** \brief A list containing on ContrastEnhancement object per raster b | ||||
and in this raster layer */ | ||||
typedef QList<QgsContrastEnhancement> ContrastEnhancementList; | ||||
/** \brief A list containing one RasterPyramid struct per raster band | ||||
in this raster layer. | ||||
* POTENTIAL pyramid layer. This works by dividing the height | ||||
* and width of the raster by an incrementing number. As soon as the re | ||||
sult | ||||
* of the division is <=256 we stop allowing RasterPyramid structs | ||||
* to be added to the list. Each time a RasterPyramid is created | ||||
* we will check to see if a pyramid matching these dimensions already | ||||
exists | ||||
* in the raster layer, and if so mark the exists flag as true */ | ||||
typedef QList<QgsRasterPyramid> RasterPyramidList; | ||||
/** \brief A list containing one RasterBandStats struct per raster ban | ||||
d in this raster layer. | ||||
* Note that while every RasterBandStats element will have the name and | ||||
number of its associated | ||||
* band populated, any additional stats are calculated on a need to kno | ||||
w basis.*/ | ||||
typedef QList<QgsRasterBandStats> RasterStatsList; | ||||
// | ||||
// Static methods: | ||||
// | ||||
static void buildSupportedRasterFileFilter( QString & fileFilters ); | ||||
/** This helper checks to see whether the file name appears to be a val id | /** This helper checks to see whether the file name appears to be a val id | |||
* raster file name. If the file name looks like it could be valid, | * raster file name. If the file name looks like it could be valid, | |||
* but some sort of error occurs in processing the file, the error is | * but some sort of error occurs in processing the file, the error is | |||
* returned in retError. | * returned in retError. | |||
*/ | */ | |||
static bool isValidRasterFileName( const QString & theFileNameQString, QString &retError ); | static bool isValidRasterFileName( const QString & theFileNameQString, QString &retError ); | |||
static bool isValidRasterFileName( const QString & theFileNameQString ) ; | static bool isValidRasterFileName( const QString & theFileNameQString ) ; | |||
//static QStringList subLayers( GDALDatasetH dataset ); | ||||
/** Return time stamp for given file name */ | /** Return time stamp for given file name */ | |||
static QDateTime lastModified( const QString & name ); | static QDateTime lastModified( const QString & name ); | |||
// Keep this for now, it is used by Python interface!!! | ||||
/** \brief ensures that GDAL drivers are registered, but only once */ | ||||
static void registerGdalDrivers(); | ||||
// | ||||
// Non Static inline methods | ||||
// | ||||
/** \brief Initialize default values */ | ||||
void init(); | ||||
// For backward compatibility (Python) get rid of it once python is upd | ||||
ated | ||||
void setDataProvider( const QString & provider, | ||||
const QStringList & layers, | ||||
const QStringList & styles, | ||||
const QString & format, | ||||
const QString & crs ); | ||||
/** [ data provider interface ] Set the data provider */ | /** [ data provider interface ] Set the data provider */ | |||
void setDataProvider( const QString & provider, | void setDataProvider( const QString & provider ); | |||
const QStringList & layers, | ||||
const QStringList & styles, | ||||
const QString & format, | ||||
const QString & crs, | ||||
bool loadDefaultStyleFlag ); | ||||
static QLibrary* loadProviderLibrary( QString theProviderKey ); | ||||
static QgsRasterDataProvider* loadProvider( QString theProviderKey, QSt | ||||
ring theDataSource = 0 ); | ||||
/** \brief Accessor for blue band name mapping */ | ||||
QString blueBandName() const { return mBlueBandName; } | ||||
/** \brief Accessor for color shader algorithm */ | ||||
QgsRasterLayer::ColorShadingAlgorithm colorShadingAlgorithm() const { r | ||||
eturn mColorShadingAlgorithm; } | ||||
/** \brief Accessor for contrast enhancement algorithm */ | ||||
QgsContrastEnhancement::ContrastEnhancementAlgorithm contrastEnhancemen | ||||
tAlgorithm() { return mContrastEnhancementAlgorithm; } | ||||
/** \brief Returns contrast enhancement algorithm as a string */ | ||||
QString contrastEnhancementAlgorithmAsString() const; | ||||
/** \brief Accessor for drawing style */ | ||||
DrawingStyle drawingStyle() { return mDrawingStyle; } | ||||
/** \brief Accessor for gray band name mapping */ | ||||
QString grayBandName() const { return mGrayBandName; } | ||||
/** \brief Accessor for green band name mapping */ | ||||
QString greenBandName() const { return mGreenBandName; } | ||||
/** \brief Accessor for mHasPyramids (READ ONLY) */ | ||||
bool hasPyramids() { return mHasPyramids; } | ||||
/** \brief Accessor for mUserDefinedGrayMinimumMaximum */ | ||||
bool hasUserDefinedGrayMinimumMaximum() const { return mUserDefinedGray | ||||
MinimumMaximum; } | ||||
/** \brief Accessor for mUserDefinedRGBMinimumMaximum */ | ||||
bool hasUserDefinedRGBMinimumMaximum() const { return mUserDefinedRGBMi | ||||
nimumMaximum; } | ||||
/** \brief Accessor that returns the height of the (unclipped) raster * | ||||
/ | ||||
int height() { return mHeight; } | ||||
/** \brief Accessor to find out whether the histogram should be inverte | ||||
d */ | ||||
bool invertHistogram() const { return mInvertColor; } | ||||
/** \brief Is the NoDataValue Valid */ | ||||
bool isNoDataValueValid() const { return mValidNoDataValue; } | ||||
/** \brief Accessor for mGrayMinimumMaximumEstimated */ | ||||
bool isGrayMinimumMaximumEstimated() const { return mGrayMinimumMaximum | ||||
Estimated; } | ||||
/** \brief Accessor for mRGBMinimumMaximumEstimated */ | ||||
bool isRGBMinimumMaximumEstimated() const { return mRGBMinimumMaximumEs | ||||
timated; } | ||||
/** \brief Accessor that returns the NO_DATA entry for this raster */ | ||||
double noDataValue( bool* isValid = 0 ) { if ( isValid ) { *isValid = m | ||||
ValidNoDataValue;} return mNoDataValue; } | ||||
/** \brief Returns a pointer to the transparency object */ | ||||
QgsRasterTransparency* rasterTransparency() { return &mRasterTransparen | ||||
cy; } | ||||
/** \brief Accessor for raster shader */ | ||||
QgsRasterShader* rasterShader() { return mRasterShader; } | ||||
/** \brief Accessor for raster layer type (which is a read only proper ty) */ | /** \brief Accessor for raster layer type (which is a read only proper ty) */ | |||
LayerType rasterType() { return mRasterType; } | LayerType rasterType() { return mRasterType; } | |||
/** \brief Accessor for red band name (allows alternate mappings e.g. m | /** \brief Accessor for drawing style */ | |||
ap blue as red color) */ | //DrawingStyle drawingStyle() { return mDrawingStyle; } | |||
QString redBandName() const { return mRedBandName; } | ||||
/** \brief Mutator for drawing style */ | /** \brief Mutator for drawing style */ | |||
void setDrawingStyle( const DrawingStyle & theDrawingStyle ) { mDrawin | //void setDrawingStyle( const DrawingStyle & theDrawingStyle ) { mDraw | |||
gStyle = theDrawingStyle; } | ingStyle = theDrawingStyle; setRendererForDrawingStyle( theDrawingStyle ); | |||
} | ||||
/** \brief Mutator for mGrayMinimumMaximumEstimated */ | ||||
void setGrayMinimumMaximumEstimated( bool theBool ) { mGrayMinimumMaxim | ||||
umEstimated = theBool; } | ||||
/** \brief Mutator to alter the state of the invert histogram flag */ | ||||
void setInvertHistogram( bool theFlag ) { mInvertColor = theFlag; } | ||||
/** \brief Mutator for mRGBMinimumMaximumEstimated */ | ||||
void setRGBMinimumMaximumEstimated( bool theBool ) { mRGBMinimumMaximum | ||||
Estimated = theBool; } | ||||
/** \brief Mutator to alter the number of standard deviations that shou | ||||
ld be plotted */ | ||||
void setStandardDeviations( double theStandardDeviations ) { mStandardD | ||||
eviations = theStandardDeviations; } | ||||
/** \brief Mutator for mUserDefinedGrayMinimumMaximum */ | /**Set raster renderer. Takes ownership of the renderer object*/ | |||
void setUserDefinedGrayMinimumMaximum( bool theBool ) { mUserDefinedGra | void setRenderer( QgsRasterRenderer* theRenderer ); | |||
yMinimumMaximum = theBool; } | QgsRasterRenderer* renderer() const { return mPipe.renderer(); } | |||
/** \brief Mutator for mUserDefinedRGBMinimumMaximum */ | /**Set raster resample filter. Takes ownership of the resample filter o | |||
void setUserDefinedRGBMinimumMaximum( bool theBool ) { mUserDefinedRGBM | bject*/ | |||
inimumMaximum = theBool; } | QgsRasterResampleFilter * resampleFilter() const { return mPipe.resampl | |||
eFilter(); } | ||||
/** \brief Accessor to find out how many standard deviations are being | QgsBrightnessContrastFilter * brightnessFilter() const { return mPipe.b | |||
plotted */ | rightnessFilter(); } | |||
double standardDeviations() const { return mStandardDeviations; } | QgsHueSaturationFilter * hueSaturationFilter() const { return mPipe.hue | |||
SaturationFilter(); } | ||||
/** \brief Accessor for transparent band name mapping */ | /** Get raster pipe */ | |||
QString transparentBandName() const { return mTransparencyBandName; } | QgsRasterPipe * pipe() { return &mPipe; } | |||
/** \brief [ data provider interface ] Does this layer use a provider | ||||
for setting/retrieving data? | ||||
* @deprecated in 2.0 | ||||
*/ | ||||
Q_DECL_DEPRECATED bool usesProvider(); | ||||
/** \brief Accessor that returns the width of the (unclipped) raster * / | /** \brief Accessor that returns the width of the (unclipped) raster * / | |||
int width() { return mWidth; } | int width() const; | |||
/** \brief Accessor that returns the height of the (unclipped) raster * | ||||
/ | ||||
int height() const; | ||||
// | ||||
// Non Static methods | ||||
// | ||||
/** \brief Get the number of bands in this layer */ | /** \brief Get the number of bands in this layer */ | |||
unsigned int bandCount() const; | int bandCount() const; | |||
/** \brief Get the name of a band given its number */ | /** \brief Get the name of a band given its number */ | |||
const QString bandName( int theBandNoInt ); | const QString bandName( int theBandNoInt ); | |||
/** \brief Get the number of a band given its name. The name is the rew | ||||
ritten name set | ||||
* up in the constructor, and will not necessarily be the same as the | ||||
name retrieved directly from gdal! | ||||
* If no matching band is found zero will be returned! */ | ||||
int bandNumber( const QString & theBandName ) const; | ||||
/** \brief Get RasterBandStats for a band given its number (read only) | ||||
*/ | ||||
const QgsRasterBandStats bandStatistics( int ); | ||||
/** \brief Get RasterBandStats for a band given its name (read only) * | ||||
/ | ||||
const QgsRasterBandStats bandStatistics( const QString & ); | ||||
/** \brief Accessor for ths raster layers pyramid list. A pyramid list | ||||
defines the | ||||
* POTENTIAL pyramids that can be in a raster. To know which of the pyr | ||||
amid layers | ||||
* ACTUALLY exists you need to look at the existsFlag member in each st | ||||
ruct stored in the | ||||
* list. | ||||
*/ | ||||
RasterPyramidList buildPyramidList(); | ||||
/** \brief Accessor for color shader algorithm */ | ||||
QString colorShadingAlgorithmAsString() const; | ||||
/** \brief Wrapper for GDALComputeRasterMinMax with the estimate option | ||||
*/ | ||||
void computeMinimumMaximumEstimates( int theBand, double* theMinMax ); | ||||
/** \brief Wrapper for GDALComputeRasterMinMax with the estimate option | ||||
*/ | ||||
void computeMinimumMaximumEstimates( QString theBand, double* theMinMax | ||||
); | ||||
/** \brief Wrapper for GDALComputeRasterMinMax with the estimate option | ||||
\note added in v1.6 */ | ||||
void computeMinimumMaximumEstimates( int theBand, double& theMin, doubl | ||||
e& theMax ); | ||||
/** \brief Compute the actual minimum maximum pixel values based on the | ||||
current (last) display extent */ | ||||
void computeMinimumMaximumFromLastExtent( int theBand, double* theMinMa | ||||
x ); | ||||
/** \brief Compute the actual minimum maximum pixel values based on the | ||||
current (last) display extent */ | ||||
void computeMinimumMaximumFromLastExtent( QString theBand, double* theM | ||||
inMax ); | ||||
/** \brief Compute the actual minimum maximum pixel values based on th | ||||
e current (last) display extent | ||||
\note added in v1.6 */ | ||||
void computeMinimumMaximumFromLastExtent( int theBand, double& theMin, | ||||
double& theMax ); | ||||
/** \brief Get a pointer to the contrast enhancement for the selected b | ||||
and */ | ||||
QgsContrastEnhancement* contrastEnhancement( unsigned int theBand ); | ||||
const QgsContrastEnhancement* constContrastEnhancement( unsigned int th | ||||
eBand ) const; | ||||
/**Copies the symbology settings from another layer. Returns true in ca | ||||
se of success*/ | ||||
bool copySymbologySettings( const QgsMapLayer& theOther ); | ||||
/** \brief Get a pointer to the color table */ | ||||
QList<QgsColorRampShader::ColorRampItem>* colorTable( int theBandNoInt | ||||
); | ||||
/** Returns the data provider */ | /** Returns the data provider */ | |||
QgsRasterDataProvider* dataProvider(); | QgsRasterDataProvider* dataProvider(); | |||
/** Returns the data provider in a const-correct manner */ | /** Returns the data provider in a const-correct manner | |||
@note available in python bindings as constDataProvider() | ||||
*/ | ||||
const QgsRasterDataProvider* dataProvider() const; | const QgsRasterDataProvider* dataProvider() const; | |||
/**Synchronises with changes in the datasource | /**Synchronises with changes in the datasource | |||
@note added in version 1.6*/ | @note added in version 1.6*/ | |||
virtual void reload(); | virtual void reload(); | |||
/** \brief This is called when the view on the raster layer needs to be redrawn */ | /** \brief This is called when the view on the raster layer needs to be redrawn */ | |||
bool draw( QgsRenderContext& rendererContext ); | bool draw( QgsRenderContext& rendererContext ); | |||
/** \brief This is an overloaded version of the draw() function that is called by both draw() and thumbnailAsPixmap */ | /** \brief This is an overloaded version of the draw() function that is called by both draw() and thumbnailAsPixmap */ | |||
void draw( QPainter * theQPainter, | void draw( QPainter * theQPainter, | |||
QgsRasterViewPort * myRasterViewPort, | QgsRasterViewPort * myRasterViewPort, | |||
const QgsMapToPixel* theQgsMapToPixel = 0 ); | const QgsMapToPixel* theQgsMapToPixel = 0 ); | |||
/** \brief Returns a string representation of drawing style | ||||
* | ||||
* Implemented mainly for serialisation / deserialisation of settings t | ||||
o xml. | ||||
* NOTE: May be deprecated in the future!. DrawingStyle drawingStyle() | ||||
instead. | ||||
* */ | ||||
QString drawingStyleAsString() const; | ||||
/** \brief Checks if symbology is the same as another layers */ | ||||
bool hasCompatibleSymbology( const QgsMapLayer& theOther ) const; | ||||
/** \brief Check whether a given band number has stats associated with | ||||
it */ | ||||
bool hasStatistics( int theBandNoInt ); | ||||
/** \brief Identify raster value(s) found on the point position */ | ||||
bool identify( const QgsPoint & point, QMap<QString, QString>& results | ||||
); | ||||
/** \brief Identify arbitrary details from the WMS server found on the | ||||
point position */ | ||||
QString identifyAsText( const QgsPoint & point ); | ||||
/** \brief Identify arbitrary details from the WMS server found on the | ||||
point position | ||||
* @note added in 1.5 | ||||
*/ | ||||
QString identifyAsHtml( const QgsPoint & point ); | ||||
/** \brief Currently returns always false */ | ||||
bool isEditable() const; | ||||
/** \brief [ data provider interface ] If an operation returns 0 (e.g. draw()), this function returns the text of the error associated with the fa ilure */ | /** \brief [ data provider interface ] If an operation returns 0 (e.g. draw()), this function returns the text of the error associated with the fa ilure */ | |||
QString lastError(); | QString lastError(); | |||
/** \brief [ data provider interface ] If an operation returns 0 (e.g. draw()), this function returns the text of the error associated with the fa ilure */ | /** \brief [ data provider interface ] If an operation returns 0 (e.g. draw()), this function returns the text of the error associated with the fa ilure */ | |||
QString lastErrorTitle(); | QString lastErrorTitle(); | |||
/**Returns a list with classification items (Text and color) | /**Returns a list with classification items (Text and color) | |||
@note this method was added in version 1.8*/ | @note this method was added in version 1.8*/ | |||
QList< QPair< QString, QColor > > legendSymbologyItems() const; | QList< QPair< QString, QColor > > legendSymbologyItems() const; | |||
/** \brief Get a legend image for this layer */ | ||||
QPixmap legendAsPixmap(); | ||||
/** \brief Overloaded version of above function that can print layer n | ||||
ame onto legend */ | ||||
QPixmap legendAsPixmap( bool ); | ||||
/** \brief Use this method when you want an annotated legend suitable f | ||||
or print output etc */ | ||||
QPixmap legendAsPixmap( int theLabelCount ); | ||||
/** \brief Accessor for maximum value user for contrast enhancement */ | ||||
double maximumValue( unsigned int theBand ); | ||||
/** \brief Accessor for maximum value user for contrast enhancement */ | ||||
double maximumValue( QString theBand ); | ||||
/** \brief Obtain GDAL Metadata for this layer */ | /** \brief Obtain GDAL Metadata for this layer */ | |||
QString metadata(); | QString metadata(); | |||
/** \brief Accessor for minimum value user for contrast enhancement */ | ||||
double minimumValue( unsigned int theBand ); | ||||
/** \brief Accessor for minimum value user for contrast enhancement */ | ||||
double minimumValue( QString theBand ); | ||||
/** \brief Get an 100x100 pixmap of the color palette. If the layer has no palette a white pixmap will be returned */ | /** \brief Get an 100x100 pixmap of the color palette. If the layer has no palette a white pixmap will be returned */ | |||
QPixmap paletteAsPixmap( int theBandNumber = 1 ); | QPixmap paletteAsPixmap( int theBandNumber = 1 ); | |||
/** \brief [ data provider interface ] Which provider is being used fo r this Raster Layer? | /** \brief [ data provider interface ] Which provider is being used fo r this Raster Layer? | |||
* @note added in 2.0 | * @note added in 2.0 | |||
*/ | */ | |||
QString providerType() const; | QString providerType() const; | |||
/** \brief [ data provider interface ] Which provider is being used fo | ||||
r this Raster Layer? | ||||
* @deprecated use providerType() | ||||
*/ | ||||
Q_DECL_DEPRECATED QString providerKey() const { return providerType(); | ||||
} | ||||
/** \brief Returns the number of raster units per each raster pixel. In a world file, this is normally the first row (without the sign) */ | /** \brief Returns the number of raster units per each raster pixel. In a world file, this is normally the first row (without the sign) */ | |||
double rasterUnitsPerPixel(); | double rasterUnitsPerPixelX(); | |||
double rasterUnitsPerPixelY(); | ||||
/** \brief Read color table from GDAL raster band */ | ||||
// Keep this for QgsRasterLayerProperties | ||||
bool readColorTable( int theBandNumber, QList<QgsColorRampShader::Color | ||||
RampItem>* theList ); | ||||
/** \brief Simple reset function that set the noDataValue back to the v | ||||
alue stored in the first raster band */ | ||||
void resetNoDataValue(); | ||||
/** \brief Mutator for blue band name mapping */ | ||||
void setBlueBandName( const QString & theBandName ); | ||||
/** \brief Mutator for color shader algorithm */ | ||||
void setColorShadingAlgorithm( QgsRasterLayer::ColorShadingAlgorithm th | ||||
eShaderAlgorithm ); | ||||
/** \brief Mutator for color shader algorithm */ | /** \brief Set contrast enhancement algorithm | |||
void setColorShadingAlgorithm( QString theShaderAlgorithm ); | * @param theAlgorithm Contrast enhancement algorithm | |||
* @param theLimits Limits | ||||
* @param theExtent Extent used to calculate limits, if empty, use ful | ||||
l layer extent | ||||
* @param theSampleSize Size of data sample to calculate limits, if 0, | ||||
use full resolution | ||||
* @param theGenerateLookupTableFlag Generate llokup table. */ | ||||
void setContrastEnhancement( QgsContrastEnhancement::ContrastEnhancemen | ||||
tAlgorithm theAlgorithm, | ||||
QgsRaster::ContrastEnhancementLimits theLi | ||||
mits = QgsRaster::ContrastEnhancementMinMax, | ||||
QgsRectangle theExtent = QgsRectangle(), | ||||
int theSampleSize = SAMPLE_SIZE, | ||||
bool theGenerateLookupTableFlag = true ); | ||||
/** \brief Mutator for contrast enhancement algorithm */ | /** \brief Set default contrast enhancement */ | |||
void setContrastEnhancementAlgorithm( QgsContrastEnhancement::ContrastE | void setDefaultContrastEnhancement(); | |||
nhancementAlgorithm theAlgorithm, | ||||
bool theGenerateLookupTableFlag = | ||||
true ); | ||||
/** \brief Mutator for contrast enhancement algorithm */ | ||||
void setContrastEnhancementAlgorithm( QString theAlgorithm, bool theGen | ||||
erateLookupTableFlag = true ); | ||||
/** \brief Mutator for contrast enhancement function */ | ||||
void setContrastEnhancementFunction( QgsContrastEnhancementFunction* th | ||||
eFunction ); | ||||
/** \brief Overloaded version of the above function for convenience whe n restoring from xml */ | /** \brief Overloaded version of the above function for convenience whe n restoring from xml */ | |||
void setDrawingStyle( const QString & theDrawingStyleQString ); | void setDrawingStyle( const QString & theDrawingStyleQString ); | |||
/** \brief Mutator for gray band name mapping */ | ||||
void setGrayBandName( const QString & theBandName ); | ||||
/** \brief Mutator for green band name mapping */ | ||||
void setGreenBandName( const QString & theBandName ); | ||||
/** \brief Mutator for setting the maximum value for contrast enhanceme | ||||
nt */ | ||||
void setMaximumValue( unsigned int theBand, double theValue, bool theGe | ||||
nerateLookupTableFlag = true ); | ||||
/** \brief Mutator for setting the maximum value for contrast enhanceme | ||||
nt */ | ||||
void setMaximumValue( QString theBand, double theValue, bool theGenerat | ||||
eLookupTableFlag = true ); | ||||
/** \brief Sets the minimum and maximum values for the band(s) currentl | ||||
y | ||||
* being displayed using the only pixel values from the last/current ex | ||||
tent | ||||
* */ | ||||
void setMinimumMaximumUsingLastExtent(); | ||||
/** \brief Sets the minimum and maximum values for the band(s) currentl | ||||
y | ||||
* being displayed using the only pixel values from the dataset min/max | ||||
*/ | ||||
void setMinimumMaximumUsingDataset(); | ||||
/** \brief Mutator for setting the minimum value for contrast enhanceme | ||||
nt */ | ||||
void setMinimumValue( unsigned int theBand, double theValue, bool theGe | ||||
nerateLookupTableFlag = true ); | ||||
/** \brief Mutator for setting the minimum value for contrast enhanceme | ||||
nt */ | ||||
void setMinimumValue( QString theBand, double theValue, bool theGenerat | ||||
eLookupTableFlag = true ); | ||||
/** \brief Mutator that allows the NO_DATA entry for this raster to be | ||||
overridden */ | ||||
void setNoDataValue( double theNoData ); | ||||
/** \brief Set the raster shader function to a user defined function | ||||
\note ownership of the shader function is transfered to raster shader | ||||
*/ | ||||
void setRasterShaderFunction( QgsRasterShaderFunction* theFunction ); | ||||
/** \brief Mutator for red band name (allows alternate mappings e.g. ma | ||||
p blue as red color) */ | ||||
void setRedBandName( const QString & theBandName ); | ||||
/** \brief Mutator for transparent band name mapping */ | ||||
void setTransparentBandName( const QString & theBandName ); | ||||
/** \brief [ data provider interface ] A wrapper function to emit a pr ogress update signal */ | /** \brief [ data provider interface ] A wrapper function to emit a pr ogress update signal */ | |||
void showProgress( int theValue ); | void showProgress( int theValue ); | |||
/** \brief Returns the sublayers of this layer - Useful for providers t hat manage their own layers, such as WMS */ | /** \brief Returns the sublayers of this layer - Useful for providers t hat manage their own layers, such as WMS */ | |||
virtual QStringList subLayers() const; | virtual QStringList subLayers() const; | |||
/** \brief Draws a thumbnail of the rasterlayer into the supplied pixma | /** \brief Draws a preview of the rasterlayer into a pixmap */ | |||
p pointer */ | QPixmap previewAsPixmap( QSize size, QColor bgColor = Qt::white ); | |||
void thumbnailAsPixmap( QPixmap * theQPixmap ); | ||||
/** \brief Draws a thumbnail of the rasterlayer into the supplied QImag | ||||
e pointer | ||||
* @note added in QGIS 1.6 | ||||
* */ | ||||
void thumbnailAsImage( QImage * thepImage ); | ||||
/** \brief Emit a signal asking for a repaint. (inherited from maplayer ) */ | /** \brief Emit a signal asking for a repaint. (inherited from maplayer ) */ | |||
void triggerRepaint(); | void triggerRepaint(); | |||
// | ||||
// Virtual methods | ||||
// | ||||
/** | /** | |||
* Reorders the *previously selected* sublayers of this layer from bott om to top | * Reorders the *previously selected* sublayers of this layer from bott om to top | |||
* | * | |||
* (Useful for providers that manage their own layers, such as WMS) | * (Useful for providers that manage their own layers, such as WMS) | |||
* | * | |||
*/ | */ | |||
virtual void setLayerOrder( const QStringList &layers ); | virtual void setLayerOrder( const QStringList &layers ); | |||
/** | /** | |||
* Set the visibility of the given sublayer name | * Set the visibility of the given sublayer name | |||
*/ | */ | |||
virtual void setSubLayerVisibility( QString name, bool vis ); | virtual void setSubLayerVisibility( QString name, bool vis ); | |||
/** Time stamp of data source in the moment when data/metadata were loa ded by provider */ | /** Time stamp of data source in the moment when data/metadata were loa ded by provider */ | |||
virtual QDateTime timestamp() const { return mDataProvider->timestamp() ; } | virtual QDateTime timestamp() const { return mDataProvider->timestamp() ; } | |||
public slots: | public slots: | |||
/** \brief Create GDAL pyramid overviews */ | ||||
QString buildPyramids( const RasterPyramidList &, | ||||
const QString & theResamplingMethod = "NEAREST" | ||||
, | ||||
bool theTryInternalFlag = false ); | ||||
/** \brief Populate the histogram vector for a given band */ | ||||
void populateHistogram( int theBandNoInt, | ||||
int theBinCountInt = 256, | ||||
bool theIgnoreOutOfRangeFlag = true, | ||||
bool theThoroughBandScanFlag = false ); | ||||
void showStatusMessage( const QString & theMessage ); | void showStatusMessage( const QString & theMessage ); | |||
/** \brief Propagate progress updates from GDAL up to the parent app */ | /** \brief Propagate progress updates from GDAL up to the parent app */ | |||
void updateProgress( int, int ); | void updateProgress( int, int ); | |||
/** \brief receive progress signal from provider */ | /** \brief receive progress signal from provider */ | |||
void onProgress( int, double, QString ); | void onProgress( int, double, QString ); | |||
signals: | signals: | |||
/** \brief Signal for notifying listeners of long running processes */ | /** \brief Signal for notifying listeners of long running processes */ | |||
void progressUpdate( int theValue ); | void progressUpdate( int theValue ); | |||
/** | /** | |||
* This is emitted whenever data or metadata (e.g. color table, exten t) has changed | * This is emitted whenever data or metadata (e.g. color table, exten t) has changed | |||
* @note added in 1.7 | * @note added in 1.7 | |||
*/ | */ | |||
void dataChanged(); | void dataChanged(); | |||
protected: | protected: | |||
/** \brief Read the symbology for the current layer from the Dom node s upplied */ | /** \brief Read the symbology for the current layer from the Dom node s upplied */ | |||
bool readSymbology( const QDomNode& node, QString& errorMessage ); | bool readSymbology( const QDomNode& node, QString& errorMessage ); | |||
/** \brief Reads layer specific state from project file Dom node */ | /** \brief Reads layer specific state from project file Dom node */ | |||
bool readXml( const QDomNode& layer_node ); | bool readXml( const QDomNode& layer_node ); | |||
/** \brief Write the symbology for the layer into the docment provided */ | /** \brief Write the symbology for the layer into the docment provided */ | |||
bool writeSymbology( QDomNode&, QDomDocument& doc, QString& errorMessag e ) const; | bool writeSymbology( QDomNode&, QDomDocument& doc, QString& errorMessag e ) const; | |||
/** \brief Write layer specific state to project file Dom node */ | /** \brief Write layer specific state to project file Dom node */ | |||
bool writeXml( QDomNode & layer_node, QDomDocument & doc ); | bool writeXml( QDomNode & layer_node, QDomDocument & doc ); | |||
private: | private: | |||
// | /** \brief Initialize default values */ | |||
// Private methods | void init(); | |||
// | ||||
/** \brief Drawing routine for color type data */ | ||||
void drawSingleBandColorData( QPainter * theQPainter, | ||||
QgsRasterViewPort * theRasterViewPort, | ||||
const QgsMapToPixel* theQgsMapToPixel, | ||||
int theBandNoInt ); | ||||
/** \brief Drawing routine for multiband image */ | ||||
void drawMultiBandColor( QPainter * theQPainter, | ||||
QgsRasterViewPort * theRasterViewPort, | ||||
const QgsMapToPixel* theQgsMapToPixel ); | ||||
/** \brief Drawing routine for multiband image, rendered as a single ba | ||||
nd image in grayscale */ | ||||
void drawMultiBandSingleBandGray( QPainter * theQPainter, | ||||
QgsRasterViewPort * theRasterViewPort | ||||
, | ||||
const QgsMapToPixel* theQgsMapToPixel | ||||
, | ||||
int theBandNoInt ); | ||||
/** \brief Drawing routine for multiband image, rendered as a single ba | ||||
nd image in pseudocolor */ | ||||
void drawMultiBandSingleBandPseudoColor( QPainter * theQPainter, | ||||
QgsRasterViewPort * theRasterViewPort, | ||||
const QgsMapToPixel* theQgsMapToPixel, | ||||
int theBandNoInt ); | ||||
/** \brief Drawing routine for single band with a color map */ | ||||
void drawPalettedSingleBandColor( QPainter * theQPainter, | ||||
QgsRasterViewPort * theRasterViewPort | ||||
, | ||||
const QgsMapToPixel* theQgsMapToPixel | ||||
, | ||||
int theBandNoInt ); | ||||
/** \brief Drawing routine for paletted image, rendered as a single ban | ||||
d image in grayscale */ | ||||
void drawPalettedSingleBandGray( QPainter * theQPainter, | ||||
QgsRasterViewPort * theRasterViewPort, | ||||
const QgsMapToPixel* theQgsMapToPixel, | ||||
int theBandNoInt ); | ||||
/** \brief Drawing routine for paletted image, rendered as a single ban | ||||
d image in pseudocolor */ | ||||
void drawPalettedSingleBandPseudoColor( QPainter * theQPainter, | ||||
QgsRasterViewPort * theRasterVi | ||||
ewPort, | ||||
const QgsMapToPixel* theQgsMapT | ||||
oPixel, | ||||
int theBandNoInt ); | ||||
/** \brief Drawing routine for paletted multiband image */ | ||||
void drawPalettedMultiBandColor( QPainter * theQPainter, | ||||
QgsRasterViewPort * theRasterViewPort, | ||||
const QgsMapToPixel* theQgsMapToPixel, | ||||
int theBandNoInt ); | ||||
/** \brief Drawing routine for single band grayscale image */ | ||||
void drawSingleBandGray( QPainter * theQPainter, | ||||
QgsRasterViewPort * theRasterViewPort, | ||||
const QgsMapToPixel* theQgsMapToPixel, | ||||
int theBandNoInt ); | ||||
/** \brief Drawing routine for single band grayscale image, rendered in | ||||
pseudocolor */ | ||||
void drawSingleBandPseudoColor( QPainter * theQPainter, | ||||
QgsRasterViewPort * theRasterViewPort, | ||||
const QgsMapToPixel* theQgsMapToPixel, | ||||
int theBandNoInt ); | ||||
/** \brief Close data provider and clear related members */ | /** \brief Close data provider and clear related members */ | |||
void closeDataProvider(); | void closeDataProvider(); | |||
/** \brief helper function to create zero padded band names */ | ||||
QString generateBandName( int ); | ||||
/** \brief Find out whether a given band exists. */ | ||||
bool hasBand( const QString & theBandName ); | ||||
/** \brief Query GDAL to find out the Wkt projection string for this la | ||||
yer.*/ | ||||
QString projectionWkt(); | ||||
/** \brief Allocate memory and load data to that allocated memory */ | ||||
//void* readData( GDALRasterBandH gdalBand, QgsRasterViewPort *viewPort | ||||
); | ||||
void* readData( int bandNo, QgsRasterViewPort *viewPort ); | ||||
/** \brief Load the given raster file */ | ||||
bool readFile( const QString & fileName ); | ||||
/** \brief Read a raster value given position from memory block created | ||||
by readData() */ | ||||
//inline double readValue( void *data, GDALDataType type, int index ); | ||||
inline double readValue( void *data, int type, int index ); | ||||
/** \brief Update the layer if it is outdated */ | /** \brief Update the layer if it is outdated */ | |||
bool update(); | bool update(); | |||
/** \brief Verify and transform band name for internal consistency. Ret | /**Sets corresponding renderer for style*/ | |||
urn 'Not Set' on any type of failure */ | void setRendererForDrawingStyle( const QgsRaster::DrawingStyle & theDr | |||
QString validateBandName( const QString & theBandName ); | awingStyle ); | |||
// | ||||
// Private member vars | ||||
// | ||||
/** \brief Constant defining flag for XML and a constant that signals property not used */ | /** \brief Constant defining flag for XML and a constant that signals property not used */ | |||
const QString QSTRING_NOT_SET; | const QString QSTRING_NOT_SET; | |||
const QString TRSTRING_NOT_SET; | const QString TRSTRING_NOT_SET; | |||
/** \brief The number of bands in the dataset */ | /** Pointer to data provider */ | |||
int mBandCount; | ||||
/** \brief The band to be associated with the color blue - usually 3 */ | ||||
QString mBlueBandName; | ||||
/** \brief The raster shading algorithm being used */ | ||||
ColorShadingAlgorithm mColorShadingAlgorithm; | ||||
/** \brief The contrast enhancement algorithm being used */ | ||||
QgsContrastEnhancement::ContrastEnhancementAlgorithm mContrastEnhanceme | ||||
ntAlgorithm; | ||||
/** \brief List containing the contrast enhancements for each band */ | ||||
ContrastEnhancementList mContrastEnhancementList; | ||||
/** \brief Number of stddev to plot (0) to ignore. Not applicable to al | ||||
l layer types */ | ||||
double mStandardDeviations; | ||||
/** [ data provider interface ] Pointer to data provider derived from | ||||
the abstract base class QgsDataProvider */ | ||||
QgsRasterDataProvider* mDataProvider; | QgsRasterDataProvider* mDataProvider; | |||
DrawingStyle mDrawingStyle; | //DrawingStyle mDrawingStyle; | |||
/** [ data provider interface ] Flag indicating whether the layer is i | ||||
n editing mode or not*/ | ||||
bool mEditable; | ||||
/** [ data provider interface ]The error message associated with the la st error */ | /** [ data provider interface ]The error message associated with the la st error */ | |||
QString mError; | QString mError; | |||
/** [ data provider interface ] The error caption associated with the l ast error */ | /** [ data provider interface ] The error caption associated with the l ast error */ | |||
QString mErrorCaption; | QString mErrorCaption; | |||
/** \brief Pointer to the gdaldataset */ | ||||
//GDALDatasetH mGdalBaseDataset; | ||||
/** \brief Pointer to the gdaldataset (possibly warped vrt) */ | ||||
//GDALDatasetH mGdalDataset; | ||||
/** \brief Values for mapping pixel to world coordinates. Contents of t | ||||
his array are the same as the GDAL adfGeoTransform */ | ||||
double mGeoTransform[6]; | ||||
/** \brief The band to be associated with the grayscale only output - u | ||||
sually 1 */ | ||||
QString mGrayBandName; | ||||
/** \brief Flag to indicate of the min max values are actual or estimat | ||||
es/user defined */ | ||||
bool mGrayMinimumMaximumEstimated; | ||||
/** \brief The band to be associated with the color green - usually 2 * | ||||
/ | ||||
QString mGreenBandName; | ||||
/** \brief Whether this raster has overviews / pyramids or not */ | ||||
bool mHasPyramids; | ||||
/** \brief Raster width */ | ||||
int mWidth; | ||||
/** \brief Raster height */ | ||||
int mHeight; | ||||
/** \brief Flag indicating whether the color of pixels should be invert | ||||
ed or not */ | ||||
bool mInvertColor; | ||||
/** [ data provider interface ] Timestamp, the last modified time of t he data source when the layer was created */ | /** [ data provider interface ] Timestamp, the last modified time of t he data source when the layer was created */ | |||
QDateTime mLastModified; | QDateTime mLastModified; | |||
QgsRasterViewPort mLastViewPort; | QgsRasterViewPort mLastViewPort; | |||
/** [ data provider interface ] pointer for loading the provider libra | ||||
ry */ | ||||
//QLibrary* mLib; | ||||
/** [ data provider interface ] Flag indicating whether the layer has | ||||
been modified since the last commit*/ | ||||
bool mModified; | ||||
/** \brief Cell value representing no data. e.g. -9999 */ | ||||
double mNoDataValue; | ||||
/** [ data provider interface ] Data provider key */ | /** [ data provider interface ] Data provider key */ | |||
QString mProviderKey; | QString mProviderKey; | |||
/** \brief This list holds a series of RasterPyramid structs which stor | ||||
e information for each potential pyramid level */ | ||||
RasterPyramidList mPyramidList; | ||||
/** \brief The raster shader for the layer */ | ||||
QgsRasterShader* mRasterShader; | ||||
/** \brief A collection of stats - one for each band in the layer */ | ||||
RasterStatsList mRasterStatsList; | ||||
/** \brief The transparency container */ | ||||
QgsRasterTransparency mRasterTransparency; | ||||
LayerType mRasterType; | LayerType mRasterType; | |||
/** \brief The band to be associated with the color red - usually 1 */ | QgsRasterPipe mPipe; | |||
QString mRedBandName; | ||||
/** \brief Flag to indicate of the min max values are actual or estimat | ||||
es/user defined */ | ||||
bool mRGBMinimumMaximumEstimated; | ||||
/** \brief The band to be associated with transparency */ | ||||
QString mTransparencyBandName; | ||||
/** \brief Flag to indicate if the user entered custom min max values * | ||||
/ | ||||
bool mUserDefinedGrayMinimumMaximum; | ||||
/** \brief Flag to indicate if the user entered custom min max values * | ||||
/ | ||||
bool mUserDefinedRGBMinimumMaximum; | ||||
/** \brief Flag indicating if the nodatavalue is valid*/ | ||||
bool mValidNoDataValue; | ||||
/** WMS parameters */ | ||||
/* TODO: put everything to URI */ | ||||
QStringList mLayers; | ||||
QStringList mStyles; | ||||
QString mFormat; | ||||
QString mCrs; | ||||
}; | ||||
/*#include <QColor> | ||||
typedef void* GDALRasterBandH; | ||||
class QgsMapToPixel; | ||||
struct QgsRasterViewPort; | ||||
class QImage; | ||||
class QPainter;*/ | ||||
/**A class encapsulates reading from a raster band and drawing the pixels t | ||||
o a painter. | ||||
The class allows sequential reading of the scan lines and setting the im | ||||
age scan line pixels. It automatically decides | ||||
on how much of the band / image should stay in virtual memory at a time* | ||||
/ | ||||
class CORE_EXPORT QgsRasterImageBuffer | ||||
{ | ||||
public: | ||||
QgsRasterImageBuffer( QgsRasterDataProvider *dataProvider, int bandNo, | ||||
QPainter* p, | ||||
QgsRasterViewPort* viewPort, const QgsMapToPixel* | ||||
mapToPixel, double* mGeoTransform ); | ||||
~QgsRasterImageBuffer(); | ||||
void reset( int maxPixelsInVirtualMemory = 5000000 ); | ||||
/**Returns a pointer to the next scan line (or 0 if end)*/ | ||||
bool nextScanLine( QRgb** imageScanLine, void** rasterScanLine ); | ||||
void setWritingEnabled( bool enabled ) { mWritingEnabled = enabled; } | ||||
private: | ||||
QgsRasterImageBuffer(); //forbidden | ||||
/**Creates next part image. Returns false if at end*/ | ||||
bool createNextPartImage(); | ||||
/**Peter's fix for zoomed in rasters*/ | ||||
void drawPixelRectangle(); | ||||
QgsRasterDataProvider* mDataProvider; | ||||
int mBandNo; | ||||
QPainter* mPainter; | ||||
QgsRasterViewPort* mViewPort; | ||||
const QgsMapToPixel* mMapToPixel; | ||||
double* mGeoTransform; | ||||
bool mValid; | ||||
/**True (default), if values are written to an image. If false, the cla | ||||
ss only reads the values, but does not create an image*/ | ||||
bool mWritingEnabled; | ||||
/**Draws the raster pixels as rectangles. This is only used if the map | ||||
units per pixel is very, very small*/ | ||||
bool mDrawPixelRect; | ||||
int mCurrentRow; | ||||
int mNumPartImages; //number of part images | ||||
int mNumRasterRowsPerPart; //number of (raster source) rows per part | ||||
int mCurrentPartRasterMin; //minimum (raster source) row of current ima | ||||
ge | ||||
int mCurrentPartRasterMax; //maximum (raster source) row of current ima | ||||
ge | ||||
int mCurrentPartImageRow; //current image row | ||||
int mNumCurrentImageRows; //number of image rows for the current part | ||||
int mCurrentPart; | ||||
//current memory image and gdal scan data | ||||
QImage* mCurrentImage; | ||||
void* mCurrentGDALData; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 53 change blocks. | ||||
755 lines changed or deleted | 93 lines changed or added | |||
qgsrasterprojector.h | qgsrasterprojector.h | |||
---|---|---|---|---|
skipping to change at line 19 | skipping to change at line 19 | |||
/************************************************************************** * | /************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
/* This code takes ideas from WarpBuilder in Geotools. | /* This code takes ideas from WarpBuilder in Geotools. | |||
* Thank you to Ing. Andrea Aime, Ing. Simone Giannecchini and GeoSolutions S.A.S. | * Thank to Ing. Andrea Aime, Ing. Simone Giannecchini and GeoSolutions S.A .S. | |||
* See : http://geo-solutions.blogspot.com/2011/01/developers-corner-improv ing.html | * See : http://geo-solutions.blogspot.com/2011/01/developers-corner-improv ing.html | |||
*/ | */ | |||
#ifndef QGSRASTERPROJECTOR_H | #ifndef QGSRASTERPROJECTOR_H | |||
#define QGSRASTERPROJECTOR_H | #define QGSRASTERPROJECTOR_H | |||
#include <QVector> | #include <QVector> | |||
#include <QList> | #include <QList> | |||
#include "qgsrectangle.h" | #include "qgsrectangle.h" | |||
#include "qgscoordinatereferencesystem.h" | #include "qgscoordinatereferencesystem.h" | |||
#include "qgscoordinatetransform.h" | #include "qgscoordinatetransform.h" | |||
#include "qgsrasterinterface.h" | ||||
#include <cmath> | #include <cmath> | |||
//class QgsRectangle; | ||||
class QgsPoint; | class QgsPoint; | |||
//class CORE_EXPORT QgsRasterProjector | class CORE_EXPORT QgsRasterProjector : public QgsRasterInterface | |||
class QgsRasterProjector | ||||
{ | { | |||
// Q_OBJECT | ||||
public: | public: | |||
/** \brief QgsRasterProjector implements approximate projection support for | /** \brief QgsRasterProjector implements approximate projection support for | |||
* it calculates grid of points in source CRS for target CRS + extent | * it calculates grid of points in source CRS for target CRS + extent | |||
* which are used to calculate affine transformation matrices. | * which are used to calculate affine transformation matrices. | |||
* */ | */ | |||
QgsRasterProjector( | QgsRasterProjector( | |||
QgsCoordinateReferenceSystem theSrcCRS, | QgsCoordinateReferenceSystem theSrcCRS, | |||
QgsCoordinateReferenceSystem theDestCRS, | QgsCoordinateReferenceSystem theDestCRS, | |||
QgsRectangle theDestExtent, | QgsRectangle theDestExtent, | |||
int theDestRows, int theDestCols, | int theDestRows, int theDestCols, | |||
double theMaxSrcXRes, double theMaxSrcYRes, | double theMaxSrcXRes, double theMaxSrcYRes, | |||
QgsRectangle theExtent | QgsRectangle theExtent | |||
); | ); | |||
QgsRasterProjector( | ||||
QgsCoordinateReferenceSystem theSrcCRS, | ||||
QgsCoordinateReferenceSystem theDestCRS, | ||||
double theMaxSrcXRes, double theMaxSrcYRes, | ||||
QgsRectangle theExtent | ||||
); | ||||
QgsRasterProjector(); | ||||
/** \brief Copy constructor */ | ||||
// To avoid synthesized which fails on copy of QgsCoordinateTransform | ||||
// (QObject child) in Python bindings | ||||
QgsRasterProjector( const QgsRasterProjector &projector ); | ||||
/** \brief The destructor */ | /** \brief The destructor */ | |||
~QgsRasterProjector(); | ~QgsRasterProjector(); | |||
QgsRasterProjector & operator=( const QgsRasterProjector &projector ); | ||||
QgsRasterInterface *clone() const; | ||||
int bandCount() const; | ||||
QGis::DataType dataType( int bandNo ) const; | ||||
/** \brief set source and destination CRS */ | ||||
void setCRS( const QgsCoordinateReferenceSystem & theSrcCRS, const QgsC | ||||
oordinateReferenceSystem & theDestCRS ); | ||||
/** \brief Get source CRS */ | ||||
QgsCoordinateReferenceSystem srcCrs() const { return mSrcCRS; } | ||||
/** \brief Get destination CRS */ | ||||
QgsCoordinateReferenceSystem destCrs() const { return mDestCRS; } | ||||
/** \brief set maximum source resolution */ | ||||
void setMaxSrcRes( double theMaxSrcXRes, double theMaxSrcYRes ) | ||||
{ | ||||
mMaxSrcXRes = theMaxSrcXRes; mMaxSrcYRes = theMaxSrcYRes; | ||||
} | ||||
QgsRasterBlock *block( int bandNo, const QgsRectangle & extent, int wid | ||||
th, int height ); | ||||
private: | ||||
/** get source extent */ | ||||
QgsRectangle srcExtent() { return mSrcExtent; } | ||||
/** get/set source width/height */ | ||||
int srcRows() { return mSrcRows; } | ||||
int srcCols() { return mSrcCols; } | ||||
void setSrcRows( int theRows ) { mSrcRows = theRows; mSrcXRes = mSrcExt | ||||
ent.height() / mSrcRows; } | ||||
void setSrcCols( int theCols ) { mSrcCols = theCols; mSrcYRes = mSrcExt | ||||
ent.width() / mSrcCols; } | ||||
/** \brief Get source row and column indexes for current source extent | ||||
and resolution */ | ||||
void srcRowCol( int theDestRow, int theDestCol, int *theSrcRow, int *th | ||||
eSrcCol ); | ||||
int dstRows() const { return mDestRows; } | ||||
int dstCols() const { return mDestCols; } | ||||
/** \brief get destination point for _current_ destination position */ | /** \brief get destination point for _current_ destination position */ | |||
void destPointOnCPMatrix( int theRow, int theCol, double *theX, double *theY ); | void destPointOnCPMatrix( int theRow, int theCol, double *theX, double *theY ); | |||
/** \brief Get matrix upper left row/col indexes for destination row/co l */ | /** \brief Get matrix upper left row/col indexes for destination row/co l */ | |||
int matrixRow( int theDestRow ); | int matrixRow( int theDestRow ); | |||
int matrixCol( int theDestCol ); | int matrixCol( int theDestCol ); | |||
/** \brief get destination point for _current_ matrix position */ | /** \brief get destination point for _current_ matrix position */ | |||
QgsPoint srcPoint( int theRow, int theCol ); | QgsPoint srcPoint( int theRow, int theCol ); | |||
/** \brief Get precise source row and column indexes for current source extent and resolution */ | /** \brief Get precise source row and column indexes for current source extent and resolution */ | |||
inline void preciseSrcRowCol( int theDestRow, int theDestCol, int *theS rcRow, int *theSrcCol ); | inline void preciseSrcRowCol( int theDestRow, int theDestCol, int *theS rcRow, int *theSrcCol ); | |||
/** \brief Get approximate source row and column indexes for current so urce extent and resolution */ | /** \brief Get approximate source row and column indexes for current so urce extent and resolution */ | |||
inline void approximateSrcRowCol( int theDestRow, int theDestCol, int * theSrcRow, int *theSrcCol ); | inline void approximateSrcRowCol( int theDestRow, int theDestCol, int * theSrcRow, int *theSrcCol ); | |||
/** \brief Get source row and column indexes for current source extent | /** \brief Calculate matrix */ | |||
and resolution */ | void calc(); | |||
void srcRowCol( int theDestRow, int theDestCol, int *theSrcRow, int *th | ||||
eSrcCol ); | ||||
/** \brief insert rows to matrix */ | /** \brief insert rows to matrix */ | |||
void insertRows(); | void insertRows(); | |||
/** \brief insert columns to matrix */ | /** \brief insert columns to matrix */ | |||
void insertCols(); | void insertCols(); | |||
/* calculate single control point in current matrix */ | /* calculate single control point in current matrix */ | |||
void calcCP( int theRow, int theCol ); | void calcCP( int theRow, int theCol ); | |||
skipping to change at line 108 | skipping to change at line 158 | |||
/** \brief check error along columns | /** \brief check error along columns | |||
* returns true if within threshold */ | * returns true if within threshold */ | |||
bool checkCols(); | bool checkCols(); | |||
/** \brief check error along rows | /** \brief check error along rows | |||
* returns true if within threshold */ | * returns true if within threshold */ | |||
bool checkRows(); | bool checkRows(); | |||
/** Calculate array of src helper points */ | /** Calculate array of src helper points */ | |||
//void calcHelper ( int theMatrixRow, QList<QgsPoint> *thePoints ); | ||||
void calcHelper( int theMatrixRow, QgsPoint *thePoints ); | void calcHelper( int theMatrixRow, QgsPoint *thePoints ); | |||
/** Calc / switch helper */ | /** Calc / switch helper */ | |||
void nextHelper(); | void nextHelper(); | |||
/** get source extent */ | ||||
QgsRectangle srcExtent() { return mSrcExtent; } | ||||
/** get/set source width/height */ | ||||
int srcRows() { return mSrcRows; } | ||||
int srcCols() { return mSrcCols; } | ||||
void setSrcRows( int theRows ) { mSrcRows = theRows; mSrcXRes = mSrcExt | ||||
ent.height() / mSrcRows; } | ||||
void setSrcCols( int theCols ) { mSrcCols = theCols; mSrcYRes = mSrcExt | ||||
ent.width() / mSrcCols; } | ||||
/** get mCPMatrix as string */ | /** get mCPMatrix as string */ | |||
QString cpToString(); | QString cpToString(); | |||
private: | ||||
/** Source CRS */ | /** Source CRS */ | |||
QgsCoordinateReferenceSystem mSrcCRS; | QgsCoordinateReferenceSystem mSrcCRS; | |||
/** Destination CRS */ | /** Destination CRS */ | |||
QgsCoordinateReferenceSystem mDestCRS; | QgsCoordinateReferenceSystem mDestCRS; | |||
/** Coordinate transform */ | /** Reverse coordinate transform (from destination to source) */ | |||
QgsCoordinateTransform mCoordinateTransform; | QgsCoordinateTransform mCoordinateTransform; | |||
/** Destination extent */ | /** Destination extent */ | |||
QgsRectangle mDestExtent; | QgsRectangle mDestExtent; | |||
/** Source extent */ | /** Source extent */ | |||
QgsRectangle mSrcExtent; | QgsRectangle mSrcExtent; | |||
/** Source raster extent */ | /** Source raster extent */ | |||
QgsRectangle mExtent; | QgsRectangle mExtent; | |||
skipping to change at line 178 | skipping to change at line 217 | |||
/** number of destination rows per matrix row */ | /** number of destination rows per matrix row */ | |||
double mDestRowsPerMatrixRow; | double mDestRowsPerMatrixRow; | |||
/** number of destination cols per matrix col */ | /** number of destination cols per matrix col */ | |||
double mDestColsPerMatrixCol; | double mDestColsPerMatrixCol; | |||
/** Grid of source control points */ | /** Grid of source control points */ | |||
QList< QList<QgsPoint> > mCPMatrix; | QList< QList<QgsPoint> > mCPMatrix; | |||
/** Grid of source control points transformation possible indicator */ | ||||
/* Same size as mCPMatrix */ | ||||
QList< QList<bool> > mCPLegalMatrix; | ||||
/** Array of source points for each destination column on top of curren t CPMatrix grid row */ | /** Array of source points for each destination column on top of curren t CPMatrix grid row */ | |||
/* Warning: using QList is slow on access */ | /* Warning: using QList is slow on access */ | |||
QgsPoint *pHelperTop; | QgsPoint *pHelperTop; | |||
/** Array of source points for each destination column on bottom of cur rent CPMatrix grid row */ | /** Array of source points for each destination column on bottom of cur rent CPMatrix grid row */ | |||
/* Warning: using QList is slow on access */ | /* Warning: using QList is slow on access */ | |||
QgsPoint *pHelperBottom; | QgsPoint *pHelperBottom; | |||
/** Current mHelperTop matrix row */ | /** Current mHelperTop matrix row */ | |||
int mHelperTopRow; | int mHelperTopRow; | |||
End of changes. 14 change blocks. | ||||
24 lines changed or deleted | 69 lines changed or added | |||
qgsrastershader.h | qgsrastershader.h | |||
---|---|---|---|---|
skipping to change at line 24 | skipping to change at line 24 | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSRASTERSHADER_H | #ifndef QGSRASTERSHADER_H | |||
#define QGSRASTERSHADER_H | #define QGSRASTERSHADER_H | |||
#include "qgsrastershaderfunction.h" | #include "qgsrastershaderfunction.h" | |||
class QDomDocument; | ||||
class QDomElement; | ||||
/** \ingroup core | /** \ingroup core | |||
* Interface for all raster shaders. | * Interface for all raster shaders. | |||
*/ | */ | |||
class CORE_EXPORT QgsRasterShader | class CORE_EXPORT QgsRasterShader | |||
{ | { | |||
public: | public: | |||
QgsRasterShader( double theMinimumValue = 0.0, double theMaximumValue = 255.0 ); | QgsRasterShader( double theMinimumValue = 0.0, double theMaximumValue = 255.0 ); | |||
~QgsRasterShader(); | ~QgsRasterShader(); | |||
skipping to change at line 46 | skipping to change at line 49 | |||
* Non-Static Inline methods | * Non-Static Inline methods | |||
* | * | |||
*/ | */ | |||
/** \brief Return the maximum value for the raster shader */ | /** \brief Return the maximum value for the raster shader */ | |||
double maximumValue() { return mMaximumValue; } | double maximumValue() { return mMaximumValue; } | |||
/** \brief Return the minimum value for the raster shader */ | /** \brief Return the minimum value for the raster shader */ | |||
double minimumValue() { return mMinimumValue; } | double minimumValue() { return mMinimumValue; } | |||
QgsRasterShaderFunction* rasterShaderFunction() { return mRasterShaderF unction; } | QgsRasterShaderFunction* rasterShaderFunction() { return mRasterShaderF unction; } | |||
const QgsRasterShaderFunction* rasterShaderFunction() const { return mR asterShaderFunction; } | ||||
/* | /* | |||
* | * | |||
* Non-Static methods | * Non-Static methods | |||
* | * | |||
*/ | */ | |||
/** \brief generates and new RGB value based on one input value */ | /** \brief generates and new RGBA value based on one input value */ | |||
bool shade( double, int*, int*, int* ); | bool shade( double, int*, int*, int* , int* ); | |||
/** \brief generates and new RGB value based on original RGB value */ | /** \brief generates and new RGBA value based on original RGBA value */ | |||
bool shade( double, double, double, int*, int*, int* ); | bool shade( double, double, double, double, int*, int*, int* , int* ); | |||
/** \brief A public method that allows the user to set their own shader function | /** \brief A public method that allows the user to set their own shader function | |||
\note Raster shader takes ownership of the shader function instance * / | \note Raster shader takes ownership of the shader function instance * / | |||
void setRasterShaderFunction( QgsRasterShaderFunction* ); | void setRasterShaderFunction( QgsRasterShaderFunction* ); | |||
/** \brief Set the maximum value */ | /** \brief Set the maximum value */ | |||
void setMaximumValue( double ); | void setMaximumValue( double ); | |||
/** \brief Return the minimum value */ | /** \brief Return the minimum value */ | |||
void setMinimumValue( double ); | void setMinimumValue( double ); | |||
void writeXML( QDomDocument& doc, QDomElement& parent ) const; | ||||
void readXML( const QDomElement& elem ); | ||||
private: | private: | |||
/** \brief User defineable minimum value for the raster shader */ | /** \brief User defineable minimum value for the raster shader */ | |||
double mMinimumValue; | double mMinimumValue; | |||
/** \brief user defineable maximum value for the raster shader */ | /** \brief user defineable maximum value for the raster shader */ | |||
double mMaximumValue; | double mMaximumValue; | |||
/** \brief Pointer to the shader function */ | /** \brief Pointer to the shader function */ | |||
QgsRasterShaderFunction* mRasterShaderFunction; | QgsRasterShaderFunction* mRasterShaderFunction; | |||
}; | }; | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 12 lines changed or added | |||
qgsrastershaderfunction.h | qgsrastershaderfunction.h | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSRASTERSHADERFUNCTION_H | #ifndef QGSRASTERSHADERFUNCTION_H | |||
#define QGSRASTERSHADERFUNCTION_H | #define QGSRASTERSHADERFUNCTION_H | |||
/** \ingroup core | /** \ingroup core | |||
* The raster shade function applies a shader to a pixel at render time - | * The raster shade function applies a shader to a pixel at render time - | |||
* typically used to render grayscale images as false color. | * typically used to render grayscale images as false color. | |||
*/ | */ | |||
#include <QColor> | ||||
#include <QPair> | ||||
class CORE_EXPORT QgsRasterShaderFunction | class CORE_EXPORT QgsRasterShaderFunction | |||
{ | { | |||
public: | public: | |||
QgsRasterShaderFunction( double theMinimumValue = 0.0, double theMaximu mValue = 255.0 ); | QgsRasterShaderFunction( double theMinimumValue = 0.0, double theMaximu mValue = 255.0 ); | |||
virtual ~QgsRasterShaderFunction() {} | virtual ~QgsRasterShaderFunction() {} | |||
/** \brief Set the maximum value */ | /** \brief Set the maximum value */ | |||
virtual void setMaximumValue( double ); | virtual void setMaximumValue( double ); | |||
/** \brief Return the minimum value */ | /** \brief Return the minimum value */ | |||
virtual void setMinimumValue( double ); | virtual void setMinimumValue( double ); | |||
/** \brief generates and new RGB value based on one input value */ | /** \brief generates and new RGBA value based on one input value */ | |||
virtual bool shade( double, int*, int*, int* ); | virtual bool shade( double, int*, int*, int*, int* ); | |||
/** \brief generates and new RGB value based on original RGB value */ | /** \brief generates and new RGBA value based on original RGBA value */ | |||
virtual bool shade( double, double, double, int*, int*, int* ); | virtual bool shade( double, double, double, double, int*, int*, int*, i | |||
nt* ); | ||||
double minimumMaximumRange() const { return mMinimumMaximumRange; } | double minimumMaximumRange() const { return mMinimumMaximumRange; } | |||
double minimumValue() const { return mMinimumValue; } | double minimumValue() const { return mMinimumValue; } | |||
double maximumValue() const { return mMaximumValue; } | double maximumValue() const { return mMaximumValue; } | |||
virtual void legendSymbologyItems( QList< QPair< QString, QColor > >& s | ||||
ymbolItems ) const { Q_UNUSED( symbolItems ); } | ||||
protected: | protected: | |||
/** \brief User defineable maximum value for the shading function */ | /** \brief User defineable maximum value for the shading function */ | |||
double mMaximumValue; | double mMaximumValue; | |||
/** \brief User defineable minimum value for the shading function */ | /** \brief User defineable minimum value for the shading function */ | |||
double mMinimumValue; | double mMinimumValue; | |||
/** \brief Minimum maximum range for the shading function */ | /** \brief Minimum maximum range for the shading function */ | |||
double mMinimumMaximumRange; | double mMinimumMaximumRange; | |||
}; | }; | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 11 lines changed or added | |||
qgsrastertransparency.h | qgsrastertransparency.h | |||
---|---|---|---|---|
skipping to change at line 21 | skipping to change at line 21 | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSRASTERTRANSPARENCY_H | #ifndef QGSRASTERTRANSPARENCY_H | |||
#define QGSRASTERTRANSPARENCY_H | #define QGSRASTERTRANSPARENCY_H | |||
#include <QList> | ||||
class QDomDocument; | ||||
class QDomElement; | ||||
/** \ingroup core | /** \ingroup core | |||
* Defines the list of pixel values to be considered as transparent or semi | * Defines the list of pixel values to be considered as transparent or semi | |||
* transparent when rendering rasters. | * transparent when rendering rasters. | |||
*/ | */ | |||
class CORE_EXPORT QgsRasterTransparency | class CORE_EXPORT QgsRasterTransparency | |||
{ | { | |||
public: | public: | |||
QgsRasterTransparency(); | QgsRasterTransparency(); | |||
skipping to change at line 44 | skipping to change at line 48 | |||
struct TransparentThreeValuePixel | struct TransparentThreeValuePixel | |||
{ | { | |||
double red; | double red; | |||
double green; | double green; | |||
double blue; | double blue; | |||
double percentTransparent; | double percentTransparent; | |||
}; | }; | |||
struct TransparentSingleValuePixel | struct TransparentSingleValuePixel | |||
{ | { | |||
double pixelValue; | double min; | |||
double max; | ||||
double percentTransparent; | double percentTransparent; | |||
}; | }; | |||
// | // | |||
// Initializer, Accessor and mutator for transparency tables. | // Initializer, Accessor and mutator for transparency tables. | |||
// | // | |||
/** \brief Mutator for transparentSingleValuePixelList */ | /** \brief Accessor for transparentSingleValuePixelList */ | |||
QList<QgsRasterTransparency::TransparentSingleValuePixel> transparentSi ngleValuePixelList() const; | QList<QgsRasterTransparency::TransparentSingleValuePixel> transparentSi ngleValuePixelList() const; | |||
/** \brief Mutator for transparentThreeValuePixelList */ | /** \brief Accessor for transparentThreeValuePixelList */ | |||
QList<QgsRasterTransparency::TransparentThreeValuePixel> transparentThr eeValuePixelList() const; | QList<QgsRasterTransparency::TransparentThreeValuePixel> transparentThr eeValuePixelList() const; | |||
/** \brief Reset to the transparency list to a single value */ | /** \brief Reset to the transparency list to a single value */ | |||
void initializeTransparentPixelList( double ); | void initializeTransparentPixelList( double ); | |||
/** \brief Reset to the transparency list to a single value */ | /** \brief Reset to the transparency list to a single value */ | |||
void initializeTransparentPixelList( double, double, double ); | void initializeTransparentPixelList( double, double, double ); | |||
/** \brief Accessor for transparentSingleValuePixelList */ | /** \brief Mutator for transparentSingleValuePixelList */ | |||
void setTransparentSingleValuePixelList( QList<QgsRasterTransparency::T ransparentSingleValuePixel> ); | void setTransparentSingleValuePixelList( QList<QgsRasterTransparency::T ransparentSingleValuePixel> ); | |||
/** \brief Accessor for transparentThreeValuePixelList */ | /** \brief Mutator for transparentThreeValuePixelList */ | |||
void setTransparentThreeValuePixelList( QList<QgsRasterTransparency::Tr ansparentThreeValuePixel> ); | void setTransparentThreeValuePixelList( QList<QgsRasterTransparency::Tr ansparentThreeValuePixel> ); | |||
/** \brief Returns the transparency value for a single value Pixel */ | /** \brief Returns the transparency value for a single value Pixel */ | |||
int alphaValue( double, int theGlobalTransparency = 255 ) const; | int alphaValue( double, int theGlobalTransparency = 255 ) const; | |||
/** \brief Return the transparency value for a RGB Pixel */ | /** \brief Return the transparency value for a RGB Pixel */ | |||
int alphaValue( double, double, double, int theGlobalTransparency = 255 ) const; | int alphaValue( double, double, double, int theGlobalTransparency = 255 ) const; | |||
/**True if there are no entries in the pixel lists except the nodata va | ||||
lue*/ | ||||
//bool isEmpty( double nodataValue ) const; | ||||
bool isEmpty( ) const; | ||||
void writeXML( QDomDocument& doc, QDomElement& parentElem ) const; | ||||
void readXML( const QDomElement& elem ); | ||||
private: | private: | |||
/** \brief The list to hold transparency values for RGB layers */ | /** \brief The list to hold transparency values for RGB layers */ | |||
QList<QgsRasterTransparency::TransparentThreeValuePixel> mTransparentTh reeValuePixelList; | QList<QgsRasterTransparency::TransparentThreeValuePixel> mTransparentTh reeValuePixelList; | |||
/** \brief The lsit to hold transparency values for single value pixel layers */ | /** \brief The list to hold transparency values for single value pixel layers */ | |||
QList<QgsRasterTransparency::TransparentSingleValuePixel> mTransparentS ingleValuePixelList; | QList<QgsRasterTransparency::TransparentSingleValuePixel> mTransparentS ingleValuePixelList; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
6 lines changed or deleted | 20 lines changed or added | |||
qgsrasterviewport.h | qgsrasterviewport.h | |||
---|---|---|---|---|
skipping to change at line 33 | skipping to change at line 33 | |||
/** \ingroup core | /** \ingroup core | |||
* This class provides details of the viewable area that a raster will | * This class provides details of the viewable area that a raster will | |||
* be rendered into. | * be rendered into. | |||
* | * | |||
* The qgsrasterviewport class sets up a viewport / area of interest to be used | * The qgsrasterviewport class sets up a viewport / area of interest to be used | |||
* by rasterlayer draw functions at the point of drawing to the screen. | * by rasterlayer draw functions at the point of drawing to the screen. | |||
*/ | */ | |||
struct QgsRasterViewPort | struct QgsRasterViewPort | |||
{ | { | |||
// NOT IN MAP SPACE BUT DEVICE SPACE | /** \brief Coordinate (in output device coordinate system) of top left co | |||
/** \brief Coordinate (in geographic coordinate system) of top left corne | rner | |||
r of the part of the raster that | * of the part of the raster that is to be rendered.*/ | |||
* is to be rendered.*/ | QgsPoint mTopLeftPoint; | |||
QgsPoint topLeftPoint; | /** \brief Coordinate (in output device coordinate system) of bottom righ | |||
/** \brief Coordinate (in geographic coordinate system) of bottom right c | t corner | |||
orner of the part of the raster that | * of the part of the raster that is to be rendered.*/ | |||
* is to be rendered.*/ | QgsPoint mBottomRightPoint; | |||
QgsPoint bottomRightPoint; | ||||
/** \brief Distance in map units from left edge to right edge for the par | /** \brief Width, number of columns to be rendered */ | |||
t of the raster that | int mWidth; | |||
* is to be rendered.*/ | /** \brief Distance in map units from bottom edge to top edge for the par | |||
t of | ||||
int drawableAreaXDim; | * the raster that is to be rendered.*/ | |||
/** \brief Distance in map units from bottom edge to top edge for the par | /** \brief Height, number of rows to be rendered */ | |||
t of the raster that | int mHeight; | |||
* is to be rendered.*/ | ||||
int drawableAreaYDim; | ||||
// intersection of current map extent and layer extent | /** \brief Intersection of current map extent and layer extent */ | |||
QgsRectangle mDrawnExtent; | QgsRectangle mDrawnExtent; | |||
// Source coordinate system | /** \brief Source coordinate system */ | |||
QgsCoordinateReferenceSystem mSrcCRS; | QgsCoordinateReferenceSystem mSrcCRS; | |||
// Target coordinate system | /** \brief Target coordinate system */ | |||
QgsCoordinateReferenceSystem mDestCRS; | QgsCoordinateReferenceSystem mDestCRS; | |||
}; | }; | |||
#endif //QGSRASTERVIEWPORT_H | #endif //QGSRASTERVIEWPORT_H | |||
End of changes. 4 change blocks. | ||||
21 lines changed or deleted | 19 lines changed or added | |||
qgsrectangle.h | qgsrectangle.h | |||
---|---|---|---|---|
skipping to change at line 22 | skipping to change at line 22 | |||
* it under the terms of the GNU General Public License as published by * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSRECT_H | #ifndef QGSRECT_H | |||
#define QGSRECT_H | #define QGSRECT_H | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <QDomDocument> | ||||
class QString; | class QString; | |||
class QRectF; | ||||
#include "qgspoint.h" | #include "qgspoint.h" | |||
/** \ingroup core | /** \ingroup core | |||
* A rectangle specified with double values. | * A rectangle specified with double values. | |||
* | * | |||
* QgsRectangle is used to store a rectangle when double values are require d. | * QgsRectangle is used to store a rectangle when double values are require d. | |||
* Examples are storing a layer extent or the current view extent of a map | * Examples are storing a layer extent or the current view extent of a map | |||
*/ | */ | |||
class CORE_EXPORT QgsRectangle | class CORE_EXPORT QgsRectangle | |||
{ | { | |||
public: | public: | |||
//! Constructor | //! Constructor | |||
QgsRectangle( double xmin = 0, double ymin = 0, double xmax = 0, double ymax = 0 ); | QgsRectangle( double xmin = 0, double ymin = 0, double xmax = 0, double ymax = 0 ); | |||
//! Construct a rectangle from two points. The rectangle is normalized after construction. | //! Construct a rectangle from two points. The rectangle is normalized after construction. | |||
QgsRectangle( QgsPoint const & p1, QgsPoint const & p2 ); | QgsRectangle( const QgsPoint & p1, const QgsPoint & p2 ); | |||
//! Construct a rectangle from a QRectF. The rectangle is normalized af | ||||
ter construction. | ||||
//@note added in 2.0 | ||||
QgsRectangle( const QRectF & qRectF ); | ||||
//! Copy constructor | //! Copy constructor | |||
QgsRectangle( const QgsRectangle &other ); | QgsRectangle( const QgsRectangle &other ); | |||
//! Destructor | //! Destructor | |||
~QgsRectangle(); | ~QgsRectangle(); | |||
//! Set the rectangle from two QgsPoints. The rectangle is | //! Set the rectangle from two QgsPoints. The rectangle is | |||
//normalised after construction. | //normalised after construction. | |||
void set( const QgsPoint& p1, const QgsPoint& p2 ); | void set( const QgsPoint& p1, const QgsPoint& p2 ); | |||
//! Set the rectangle from four points. The rectangle is | //! Set the rectangle from four points. The rectangle is | |||
// normalised after construction. | // normalised after construction. | |||
void set( double xmin, double ymin, double xmax, double ymax ); | void set( double xmin, double ymin, double xmax, double ymax ); | |||
skipping to change at line 78 | skipping to change at line 82 | |||
double yMinimum() const; | double yMinimum() const; | |||
//! Normalize the rectangle so it has non-negative width/height | //! Normalize the rectangle so it has non-negative width/height | |||
void normalize(); | void normalize(); | |||
//! Width of the rectangle | //! Width of the rectangle | |||
double width() const; | double width() const; | |||
//! Height of the rectangle | //! Height of the rectangle | |||
double height() const; | double height() const; | |||
//! Center point of the rectangle | //! Center point of the rectangle | |||
QgsPoint center() const; | QgsPoint center() const; | |||
//! Scale the rectangle around its center point | //! Scale the rectangle around its center point | |||
void scale( double, const QgsPoint *c = 0 ); | void scale( double scaleFactor, const QgsPoint *c = 0 ); | |||
//! Expand the rectangle to support zoom out scaling | ||||
void expand( double, const QgsPoint *c = 0 ); | ||||
//! return the intersection with the given rectangle | //! return the intersection with the given rectangle | |||
QgsRectangle intersect( const QgsRectangle *rect ) const; | QgsRectangle intersect( const QgsRectangle *rect ) const; | |||
//! returns true when rectangle intersects with other rectangle | //! returns true when rectangle intersects with other rectangle | |||
bool intersects( const QgsRectangle& rect ) const; | bool intersects( const QgsRectangle& rect ) const; | |||
//! return true when rectangle contains other rectangle | //! return true when rectangle contains other rectangle | |||
//! @note added in version 1.1 | //! @note added in version 1.1 | |||
bool contains( const QgsRectangle& rect ) const; | bool contains( const QgsRectangle& rect ) const; | |||
//! return true when rectangle contains a point | //! return true when rectangle contains a point | |||
//! @note added in version 1.3 | //! @note added in version 1.3 | |||
bool contains( const QgsPoint &p ) const; | bool contains( const QgsPoint &p ) const; | |||
//! expand the rectangle so that covers both the original rectangle and the given rectangle | //! expand the rectangle so that covers both the original rectangle and the given rectangle | |||
void combineExtentWith( QgsRectangle *rect ); | void combineExtentWith( QgsRectangle *rect ); | |||
//! expand the rectangle so that covers both the original rectangle and the given point | //! expand the rectangle so that covers both the original rectangle and the given point | |||
void combineExtentWith( double x, double y ); | void combineExtentWith( double x, double y ); | |||
//! test if rectangle is empty | //! test if rectangle is empty | |||
bool isEmpty() const; | bool isEmpty() const; | |||
//! returns string representation in Wkt form | //! returns string representation in Wkt form | |||
QString asWktCoordinates() const; | QString asWktCoordinates() const; | |||
//! returns string representation as WKT Polygon | ||||
//@note added in 2.0 | ||||
QString asWktPolygon() const; | ||||
//! returns a QRectF with same coordinates. | ||||
//@note added in 2.0 | ||||
QRectF toRectF() const; | ||||
//! returns string representation of form xmin,ymin xmax,ymax | //! returns string representation of form xmin,ymin xmax,ymax | |||
QString toString( bool automaticPrecision = false ) const; | QString toString( bool automaticPrecision = false ) const; | |||
//! overloaded toString that allows precision of numbers to be set | //! overloaded toString that allows precision of numbers to be set | |||
QString toString( int thePrecision ) const; | QString toString( int thePrecision ) const; | |||
//! returns rectangle s a polygon | //! returns rectangle as a polygon | |||
QString asPolygon() const; | QString asPolygon() const; | |||
/*! Comparison operator | /*! Comparison operator | |||
@return True if rectangles are equal | @return True if rectangles are equal | |||
*/ | */ | |||
bool operator==( const QgsRectangle &r1 ) const; | bool operator==( const QgsRectangle &r1 ) const; | |||
/*! Comparison operator | /*! Comparison operator | |||
@return False if rectangles are equal | @return False if rectangles are equal | |||
*/ | */ | |||
bool operator!=( const QgsRectangle &r1 ) const; | bool operator!=( const QgsRectangle &r1 ) const; | |||
/*! Assignment operator | /*! Assignment operator | |||
End of changes. 6 change blocks. | ||||
6 lines changed or deleted | 15 lines changed or added | |||
qgsrendercontext.h | qgsrendercontext.h | |||
---|---|---|---|---|
skipping to change at line 21 | skipping to change at line 21 | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSRENDERCONTEXT_H | #ifndef QGSRENDERCONTEXT_H | |||
#define QGSRENDERCONTEXT_H | #define QGSRENDERCONTEXT_H | |||
#include <QColor> | ||||
#include "qgscoordinatetransform.h" | #include "qgscoordinatetransform.h" | |||
#include "qgsmaptopixel.h" | #include "qgsmaptopixel.h" | |||
#include "qgsrectangle.h" | #include "qgsrectangle.h" | |||
class QPainter; | class QPainter; | |||
class QgsLabelingEngineInterface; | class QgsLabelingEngineInterface; | |||
/** \ingroup core | /** \ingroup core | |||
* Contains information about the context of a rendering operation. | * Contains information about the context of a rendering operation. | |||
skipping to change at line 60 | skipping to change at line 62 | |||
const QgsMapToPixel& mapToPixel() const {return mMapToPixel;} | const QgsMapToPixel& mapToPixel() const {return mMapToPixel;} | |||
double scaleFactor() const {return mScaleFactor;} | double scaleFactor() const {return mScaleFactor;} | |||
double rasterScaleFactor() const {return mRasterScaleFactor;} | double rasterScaleFactor() const {return mRasterScaleFactor;} | |||
bool renderingStopped() const {return mRenderingStopped;} | bool renderingStopped() const {return mRenderingStopped;} | |||
bool forceVectorOutput() const {return mForceVectorOutput;} | bool forceVectorOutput() const {return mForceVectorOutput;} | |||
/**Returns true if advanced effects such as blend modes such be used | ||||
@note added in 1.9*/ | ||||
bool useAdvancedEffects() const {return mUseAdvancedEffects;} | ||||
/**Used to enable or disable advanced effects such as blend modes | ||||
@note: added in version 1.9*/ | ||||
void setUseAdvancedEffects( bool enabled ) { mUseAdvancedEffects = enab | ||||
led; } | ||||
bool drawEditingInformation() const {return mDrawEditingInformation;} | bool drawEditingInformation() const {return mDrawEditingInformation;} | |||
double rendererScale() const {return mRendererScale;} | double rendererScale() const {return mRendererScale;} | |||
//! Added in QGIS v1.4 | //! Added in QGIS v1.4 | |||
QgsLabelingEngineInterface* labelingEngine() const { return mLabelingEn gine; } | QgsLabelingEngineInterface* labelingEngine() const { return mLabelingEn gine; } | |||
//! Added in QGIS v2.0 | ||||
QColor selectionColor() const { return mSelectionColor; } | ||||
//setters | //setters | |||
/**Sets coordinate transformation. QgsRenderContext takes ownership and | /**Sets coordinate transformation. QgsRenderContext does not take owner | |||
deletes if necessary*/ | ship*/ | |||
void setCoordinateTransform( QgsCoordinateTransform* t ); | void setCoordinateTransform( const QgsCoordinateTransform* t ); | |||
void setMapToPixel( const QgsMapToPixel& mtp ) {mMapToPixel = mtp;} | void setMapToPixel( const QgsMapToPixel& mtp ) {mMapToPixel = mtp;} | |||
void setExtent( const QgsRectangle& extent ) {mExtent = extent;} | void setExtent( const QgsRectangle& extent ) {mExtent = extent;} | |||
void setDrawEditingInformation( bool b ) {mDrawEditingInformation = b;} | void setDrawEditingInformation( bool b ) {mDrawEditingInformation = b;} | |||
void setRenderingStopped( bool stopped ) {mRenderingStopped = stopped;} | void setRenderingStopped( bool stopped ) {mRenderingStopped = stopped;} | |||
void setScaleFactor( double factor ) {mScaleFactor = factor;} | void setScaleFactor( double factor ) {mScaleFactor = factor;} | |||
void setRasterScaleFactor( double factor ) {mRasterScaleFactor = factor ;} | void setRasterScaleFactor( double factor ) {mRasterScaleFactor = factor ;} | |||
void setRendererScale( double scale ) {mRendererScale = scale;} | void setRendererScale( double scale ) {mRendererScale = scale;} | |||
void setPainter( QPainter* p ) {mPainter = p;} | void setPainter( QPainter* p ) {mPainter = p;} | |||
//! Added in QGIS v1.5 | //! Added in QGIS v1.5 | |||
void setForceVectorOutput( bool force ) {mForceVectorOutput = force;} | void setForceVectorOutput( bool force ) {mForceVectorOutput = force;} | |||
//! Added in QGIS v1.4 | //! Added in QGIS v1.4 | |||
void setLabelingEngine( QgsLabelingEngineInterface* iface ) { mLabeling Engine = iface; } | void setLabelingEngine( QgsLabelingEngineInterface* iface ) { mLabeling Engine = iface; } | |||
//! Added in QGIS v2.0 | ||||
void setSelectionColor( const QColor& color ) { mSelectionColor = color | ||||
; } | ||||
private: | private: | |||
/**Painter for rendering operations*/ | /**Painter for rendering operations*/ | |||
QPainter* mPainter; | QPainter* mPainter; | |||
/**For transformation between coordinate systems. Can be 0 if on-the-fl y reprojection is not used*/ | /**For transformation between coordinate systems. Can be 0 if on-the-fl y reprojection is not used*/ | |||
QgsCoordinateTransform* mCoordTransform; | const QgsCoordinateTransform* mCoordTransform; | |||
/**True if vertex markers for editing should be drawn*/ | /**True if vertex markers for editing should be drawn*/ | |||
bool mDrawEditingInformation; | bool mDrawEditingInformation; | |||
QgsRectangle mExtent; | QgsRectangle mExtent; | |||
/**If true then no rendered vector elements should be cached as image*/ | /**If true then no rendered vector elements should be cached as image*/ | |||
bool mForceVectorOutput; | bool mForceVectorOutput; | |||
/**Flag if advanced visual effects such as blend modes should be used. | ||||
True by default*/ | ||||
bool mUseAdvancedEffects; | ||||
QgsMapToPixel mMapToPixel; | QgsMapToPixel mMapToPixel; | |||
/**True if the rendering has been canceled*/ | /**True if the rendering has been canceled*/ | |||
bool mRenderingStopped; | bool mRenderingStopped; | |||
/**Factor to scale line widths and point marker sizes*/ | /**Factor to scale line widths and point marker sizes*/ | |||
double mScaleFactor; | double mScaleFactor; | |||
/**Factor to scale rasters*/ | /**Factor to scale rasters*/ | |||
double mRasterScaleFactor; | double mRasterScaleFactor; | |||
/**Map scale*/ | /**Map scale*/ | |||
double mRendererScale; | double mRendererScale; | |||
/**Labeling engine (can be NULL)*/ | /**Labeling engine (can be NULL)*/ | |||
QgsLabelingEngineInterface* mLabelingEngine; | QgsLabelingEngineInterface* mLabelingEngine; | |||
/** Color used for features that are marked as selected */ | ||||
QColor mSelectionColor; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
4 lines changed or deleted | 27 lines changed or added | |||
qgsrendererv2.h | qgsrendererv2.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsrendererv2.h | qgsrendererv2.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSRENDERERV2_H | #ifndef QGSRENDERERV2_H | |||
skipping to change at line 77 | skipping to change at line 77 | |||
class CORE_EXPORT QgsFeatureRendererV2 | class CORE_EXPORT QgsFeatureRendererV2 | |||
{ | { | |||
public: | public: | |||
// renderer takes ownership of its symbols! | // renderer takes ownership of its symbols! | |||
//! return a new renderer - used by default in vector layers | //! return a new renderer - used by default in vector layers | |||
static QgsFeatureRendererV2* defaultRenderer( QGis::GeometryType geomTy pe ); | static QgsFeatureRendererV2* defaultRenderer( QGis::GeometryType geomTy pe ); | |||
QString type() const { return mType; } | QString type() const { return mType; } | |||
// to be overridden | /** to be overridden | |||
* @param feature feature | ||||
* @return returns pointer to symbol or 0 if symbol was not found | ||||
*/ | ||||
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature ) = 0; | virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature ) = 0; | |||
virtual void startRender( QgsRenderContext& context, const QgsVectorLay er *vlayer ) = 0; | virtual void startRender( QgsRenderContext& context, const QgsVectorLay er *vlayer ) = 0; | |||
virtual void stopRender( QgsRenderContext& context ) = 0; | virtual void stopRender( QgsRenderContext& context ) = 0; | |||
virtual QList<QString> usedAttributes() = 0; | virtual QList<QString> usedAttributes() = 0; | |||
virtual ~QgsFeatureRendererV2() {} | virtual ~QgsFeatureRendererV2() {} | |||
virtual QgsFeatureRendererV2* clone() = 0; | virtual QgsFeatureRendererV2* clone() = 0; | |||
virtual bool renderFeature( QgsFeature& feature, QgsRenderContext& cont ext, int layer = -1, bool selected = false, bool drawVertexMarker = false ) ; | virtual bool renderFeature( QgsFeature& feature, QgsRenderContext& cont ext, int layer = -1, bool selected = false, bool drawVertexMarker = false ) ; | |||
//! for debugging | //! for debugging | |||
virtual QString dump(); | virtual QString dump() const; | |||
enum Capabilities | enum Capabilities | |||
{ | { | |||
SymbolLevels = 1, // rendering with symbol levels (i.e. implement s symbols(), symbolForFeature()) | SymbolLevels = 1, // rendering with symbol levels (i.e. implement s symbols(), symbolForFeature()) | |||
RotationField = 1 << 1, // rotate symbols by attribute value | RotationField = 1 << 1, // rotate symbols by attribute value | |||
MoreSymbolsPerFeature = 1 << 2 // may use more than one symbol to re | MoreSymbolsPerFeature = 1 << 2, // may use more than one symbol to r | |||
nder a feature: symbolsForFeature() will return them | ender a feature: symbolsForFeature() will return them | |||
Filter = 1 << 3, // features may be filtered, i.e. some featu | ||||
res may not be rendered (categorized, rule based ...) | ||||
ScaleDependent = 1 << 4 // depends on scale if feature will be render | ||||
ed (rule based ) | ||||
}; | }; | |||
//! returns bitwise OR-ed capabilities of the renderer | //! returns bitwise OR-ed capabilities of the renderer | |||
//! \note added in 2.0 | //! \note added in 2.0 | |||
virtual int capabilities() { return 0; } | virtual int capabilities() { return 0; } | |||
//! for symbol levels | //! for symbol levels | |||
virtual QgsSymbolV2List symbols() = 0; | virtual QgsSymbolV2List symbols() = 0; | |||
bool usingSymbolLevels() const { return mUsingSymbolLevels; } | bool usingSymbolLevels() const { return mUsingSymbolLevels; } | |||
skipping to change at line 145 | skipping to change at line 150 | |||
//! used from subclasses to create SLD Rule elements following SLD v1.1 specs | //! used from subclasses to create SLD Rule elements following SLD v1.1 specs | |||
//! @note added in 1.9 | //! @note added in 1.9 | |||
virtual void toSld( QDomDocument& doc, QDomElement &element ) const | virtual void toSld( QDomDocument& doc, QDomElement &element ) const | |||
{ element.appendChild( doc.createComment( QString( "FeatureRendererV2 % 1 not implemented yet" ).arg( type() ) ) ); } | { element.appendChild( doc.createComment( QString( "FeatureRendererV2 % 1 not implemented yet" ).arg( type() ) ) ); } | |||
//! return a list of symbology items for the legend | //! return a list of symbology items for the legend | |||
virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize ); | virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize ); | |||
//! return a list of item text / symbol | //! return a list of item text / symbol | |||
//! @note: this method was added in version 1.5 | //! @note: this method was added in version 1.5 | |||
//! @note: not available in python bindings | ||||
virtual QgsLegendSymbolList legendSymbolItems(); | virtual QgsLegendSymbolList legendSymbolItems(); | |||
//! set type and size of editing vertex markers for subsequent renderin g | //! set type and size of editing vertex markers for subsequent renderin g | |||
void setVertexMarkerAppearance( int type, int size ); | void setVertexMarkerAppearance( int type, int size ); | |||
//! return rotation field name (or empty string if not set or not suppo rted by renderer) | //! return rotation field name (or empty string if not set or not suppo rted by renderer) | |||
//! @note added in 1.9 | //! @note added in 1.9 | |||
virtual QString rotationField() const { return ""; } | virtual QString rotationField() const { return ""; } | |||
//! sets rotation field of renderer (if supported by the renderer) | //! sets rotation field of renderer (if supported by the renderer) | |||
//! @note added in 1.9 | //! @note added in 1.9 | |||
skipping to change at line 186 | skipping to change at line 192 | |||
bool selected, | bool selected, | |||
bool drawVertexMarker ); | bool drawVertexMarker ); | |||
//! render editing vertex marker at specified point | //! render editing vertex marker at specified point | |||
void renderVertexMarker( QPointF& pt, QgsRenderContext& context ); | void renderVertexMarker( QPointF& pt, QgsRenderContext& context ); | |||
//! render editing vertex marker for a polyline | //! render editing vertex marker for a polyline | |||
void renderVertexMarkerPolyline( QPolygonF& pts, QgsRenderContext& cont ext ); | void renderVertexMarkerPolyline( QPolygonF& pts, QgsRenderContext& cont ext ); | |||
//! render editing vertex marker for a polygon | //! render editing vertex marker for a polygon | |||
void renderVertexMarkerPolygon( QPolygonF& pts, QList<QPolygonF>* rings , QgsRenderContext& context ); | void renderVertexMarkerPolygon( QPolygonF& pts, QList<QPolygonF>* rings , QgsRenderContext& context ); | |||
static unsigned char* _getPoint( QPointF& pt, QgsRenderContext& context | static const unsigned char* _getPoint( QPointF& pt, QgsRenderContext& c | |||
, unsigned char* wkb ); | ontext, const unsigned char* wkb ); | |||
static unsigned char* _getLineString( QPolygonF& pts, QgsRenderContext& | static const unsigned char* _getLineString( QPolygonF& pts, QgsRenderCo | |||
context, unsigned char* wkb ); | ntext& context, const unsigned char* wkb ); | |||
static unsigned char* _getPolygon( QPolygonF& pts, QList<QPolygonF>& ho | static const unsigned char* _getPolygon( QPolygonF& pts, QList<QPolygon | |||
les, QgsRenderContext& context, unsigned char* wkb ); | F>& holes, QgsRenderContext& context, const unsigned char* wkb ); | |||
void setScaleMethodToSymbol( QgsSymbolV2* symbol, int scaleMethod ); | ||||
QString mType; | QString mType; | |||
bool mUsingSymbolLevels; | bool mUsingSymbolLevels; | |||
/** The current type of editing marker */ | /** The current type of editing marker */ | |||
int mCurrentVertexMarkerType; | int mCurrentVertexMarkerType; | |||
/** The current size of editing marker */ | /** The current size of editing marker */ | |||
int mCurrentVertexMarkerSize; | int mCurrentVertexMarkerSize; | |||
}; | }; | |||
class QgsRendererV2Widget; // why does SIP fail, when this isn't here | ||||
#endif // QGSRENDERERV2_H | #endif // QGSRENDERERV2_H | |||
End of changes. 7 change blocks. | ||||
11 lines changed or deleted | 23 lines changed or added | |||
qgsrendererv2propertiesdialog.h | qgsrendererv2propertiesdialog.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsrendererv2propertiesdialog.h | qgsrendererv2propertiesdialog.h | |||
--------------------- | --------------------- | |||
begin : December 2009 | begin : December 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSRENDERERV2PROPERTIESDIALOG_H | #ifndef QGSRENDERERV2PROPERTIESDIALOG_H | |||
skipping to change at line 46 | skipping to change at line 46 | |||
public: | public: | |||
QgsRendererV2PropertiesDialog( QgsVectorLayer* layer, QgsStyleV2* style , bool embedded = false ); | QgsRendererV2PropertiesDialog( QgsVectorLayer* layer, QgsStyleV2* style , bool embedded = false ); | |||
public slots: | public slots: | |||
//! called when user changes renderer type | //! called when user changes renderer type | |||
void rendererChanged(); | void rendererChanged(); | |||
void apply(); | void apply(); | |||
void onOK(); | void onOK(); | |||
void useOldSymbology(); | ||||
signals: | ||||
void useNewSymbology( bool ); | ||||
protected: | protected: | |||
//! Reimplements dialog keyPress event so we can ignore it | //! Reimplements dialog keyPress event so we can ignore it | |||
void keyPressEvent( QKeyEvent * event ); | void keyPressEvent( QKeyEvent * event ); | |||
QgsVectorLayer* mLayer; | QgsVectorLayer* mLayer; | |||
QgsStyleV2* mStyle; | QgsStyleV2* mStyle; | |||
QgsRendererV2Widget* mActiveWidget; | QgsRendererV2Widget* mActiveWidget; | |||
}; | }; | |||
End of changes. 2 change blocks. | ||||
6 lines changed or deleted | 1 lines changed or added | |||
qgsrendererv2registry.h | qgsrendererv2registry.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsrendererv2registry.h | qgsrendererv2registry.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSRENDERERV2REGISTRY_H | #ifndef QGSRENDERERV2REGISTRY_H | |||
#define QGSRENDERERV2REGISTRY_H | #define QGSRENDERERV2REGISTRY_H | |||
skipping to change at line 80 | skipping to change at line 80 | |||
typedef QgsFeatureRendererV2*( *QgsRendererV2CreateFromSldFunc )( QDomEleme nt&, QGis::GeometryType geomType ); | typedef QgsFeatureRendererV2*( *QgsRendererV2CreateFromSldFunc )( QDomEleme nt&, QGis::GeometryType geomType ); | |||
/** | /** | |||
Convenience metadata class that uses static functions to create renderer a nd its widget. | Convenience metadata class that uses static functions to create renderer a nd its widget. | |||
*/ | */ | |||
class CORE_EXPORT QgsRendererV2Metadata : public QgsRendererV2AbstractMetad ata | class CORE_EXPORT QgsRendererV2Metadata : public QgsRendererV2AbstractMetad ata | |||
{ | { | |||
public: | public: | |||
/** construct metadata */ | /** construct metadata */ | |||
//! @note not available in python bindings | ||||
QgsRendererV2Metadata( QString name, | QgsRendererV2Metadata( QString name, | |||
QString visibleName, | QString visibleName, | |||
QgsRendererV2CreateFunc pfCreate, | QgsRendererV2CreateFunc pfCreate, | |||
QIcon icon = QIcon(), | QIcon icon = QIcon(), | |||
QgsRendererV2WidgetFunc pfWidget = NULL ) | QgsRendererV2WidgetFunc pfWidget = NULL ) | |||
: QgsRendererV2AbstractMetadata( name, visibleName, icon ) | : QgsRendererV2AbstractMetadata( name, visibleName, icon ) | |||
, mCreateFunc( pfCreate ) | , mCreateFunc( pfCreate ) | |||
, mWidgetFunc( pfWidget ) | , mWidgetFunc( pfWidget ) | |||
, mCreateFromSldFunc( NULL ) | , mCreateFromSldFunc( NULL ) | |||
{} | {} | |||
//! @note not available in python bindings | ||||
QgsRendererV2Metadata( QString name, | QgsRendererV2Metadata( QString name, | |||
QString visibleName, | QString visibleName, | |||
QgsRendererV2CreateFunc pfCreate, | QgsRendererV2CreateFunc pfCreate, | |||
QgsRendererV2CreateFromSldFunc pfCreateFromSld, | QgsRendererV2CreateFromSldFunc pfCreateFromSld, | |||
QIcon icon = QIcon(), | QIcon icon = QIcon(), | |||
QgsRendererV2WidgetFunc pfWidget = NULL ) | QgsRendererV2WidgetFunc pfWidget = NULL ) | |||
: QgsRendererV2AbstractMetadata( name, visibleName, icon ) | : QgsRendererV2AbstractMetadata( name, visibleName, icon ) | |||
, mCreateFunc( pfCreate ) | , mCreateFunc( pfCreate ) | |||
, mWidgetFunc( pfWidget ) | , mWidgetFunc( pfWidget ) | |||
, mCreateFromSldFunc( pfCreateFromSld ) | , mCreateFromSldFunc( pfCreateFromSld ) | |||
{} | {} | |||
virtual QgsFeatureRendererV2* createRenderer( QDomElement& elem ) { ret urn mCreateFunc ? mCreateFunc( elem ) : NULL; } | virtual QgsFeatureRendererV2* createRenderer( QDomElement& elem ) { ret urn mCreateFunc ? mCreateFunc( elem ) : NULL; } | |||
virtual QgsRendererV2Widget* createRendererWidget( QgsVectorLayer* laye r, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) | virtual QgsRendererV2Widget* createRendererWidget( QgsVectorLayer* laye r, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) | |||
{ return mWidgetFunc ? mWidgetFunc( layer, style, renderer ) : NULL; } | { return mWidgetFunc ? mWidgetFunc( layer, style, renderer ) : NULL; } | |||
virtual QgsFeatureRendererV2* createRendererFromSld( QDomElement& elem, QGis::GeometryType geomType ) | virtual QgsFeatureRendererV2* createRendererFromSld( QDomElement& elem, QGis::GeometryType geomType ) | |||
{ return mCreateFromSldFunc ? mCreateFromSldFunc( elem, geomType ) : NU LL; } | { return mCreateFromSldFunc ? mCreateFromSldFunc( elem, geomType ) : NU LL; } | |||
//! @note not available in python bindings | ||||
QgsRendererV2CreateFunc createFunction() const { return mCreateFunc; } | QgsRendererV2CreateFunc createFunction() const { return mCreateFunc; } | |||
//! @note not available in python bindings | ||||
QgsRendererV2WidgetFunc widgetFunction() const { return mWidgetFunc; } | QgsRendererV2WidgetFunc widgetFunction() const { return mWidgetFunc; } | |||
//! @note not available in python bindings | ||||
QgsRendererV2CreateFromSldFunc createFromSldFunction() const { return m CreateFromSldFunc; } | QgsRendererV2CreateFromSldFunc createFromSldFunction() const { return m CreateFromSldFunc; } | |||
//! @note not available in python bindings | ||||
void setWidgetFunction( QgsRendererV2WidgetFunc f ) { mWidgetFunc = f; } | void setWidgetFunction( QgsRendererV2WidgetFunc f ) { mWidgetFunc = f; } | |||
protected: | protected: | |||
//! pointer to function that creates an instance of the renderer when l oading project / style | //! pointer to function that creates an instance of the renderer when l oading project / style | |||
QgsRendererV2CreateFunc mCreateFunc; | QgsRendererV2CreateFunc mCreateFunc; | |||
//! pointer to function that creates a widget for configuration of rend erer's params | //! pointer to function that creates a widget for configuration of rend erer's params | |||
QgsRendererV2WidgetFunc mWidgetFunc; | QgsRendererV2WidgetFunc mWidgetFunc; | |||
//! pointer to function that creates an instance of the renderer from S LD | //! pointer to function that creates an instance of the renderer from S LD | |||
QgsRendererV2CreateFromSldFunc mCreateFromSldFunc; | QgsRendererV2CreateFromSldFunc mCreateFromSldFunc; | |||
}; | }; | |||
End of changes. 7 change blocks. | ||||
1 lines changed or deleted | 7 lines changed or added | |||
qgsrendererv2widget.h | qgsrendererv2widget.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsrendererv2widget.h | qgsrendererv2widget.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSRENDERERV2WIDGET_H | #ifndef QGSRENDERERV2WIDGET_H | |||
#define QGSRENDERERV2WIDGET_H | #define QGSRENDERERV2WIDGET_H | |||
#include <QWidget> | #include <QWidget> | |||
#include <QMenu> | #include <QMenu> | |||
#include "qgssymbolv2.h" | ||||
class QgsVectorLayer; | class QgsVectorLayer; | |||
class QgsStyleV2; | class QgsStyleV2; | |||
class QgsSymbolV2; | ||||
class QgsFeatureRendererV2; | class QgsFeatureRendererV2; | |||
class QgsSymbolV2SelectorDialog; | class QgsSymbolV2SelectorDialog; | |||
/** | /** | |||
Base class for renderer settings widgets | Base class for renderer settings widgets | |||
WORKFLOW: | WORKFLOW: | |||
- open renderer dialog with some RENDERER (never null!) | - open renderer dialog with some RENDERER (never null!) | |||
- find out which widget to use | - find out which widget to use | |||
- instantiate it and set in stacked widget | - instantiate it and set in stacked widget | |||
skipping to change at line 81 | skipping to change at line 81 | |||
/**Change marker sizes of selected symbols*/ | /**Change marker sizes of selected symbols*/ | |||
void changeSymbolSize(); | void changeSymbolSize(); | |||
}; | }; | |||
//////////// | //////////// | |||
#include <QObject> | #include <QObject> | |||
class QMenu; | class QMenu; | |||
class QgsField; | class QgsField; | |||
class QgsFields; | ||||
typedef QMap<int, QgsField> QgsFieldMap; | ||||
/** | /** | |||
Utility class for prividing GUI for data-defined rendering. | Utility class for prividing GUI for data-defined rendering. | |||
*/ | */ | |||
class QgsRendererV2DataDefinedMenus : public QObject | class QgsRendererV2DataDefinedMenus : public QObject | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsRendererV2DataDefinedMenus( QMenu* menu, const QgsFieldMap& flds, QS | QgsRendererV2DataDefinedMenus( QMenu* menu, const QgsFields& flds, QStr | |||
tring rotationField, QString sizeScaleField ); | ing rotationField, QString sizeScaleField, QgsSymbolV2::ScaleMethod scaleMe | |||
thod ); | ||||
void populateMenu( QMenu* menu, const char* slot, QString fieldName ); | ~QgsRendererV2DataDefinedMenus(); | |||
void updateMenu( QMenu* menu, QString fieldName ); | ||||
void populateMenu( QMenu* menu, const char* slot, QString fieldName, QA | ||||
ctionGroup *actionGroup ); | ||||
#if 0 | ||||
void updateMenu( QActionGroup* actionGroup, QString fieldName ); | ||||
#endif | ||||
public slots: | public slots: | |||
void rotationFieldSelected(); | void rotationFieldSelected( QAction *a ); | |||
void sizeScaleFieldSelected(); | void sizeScaleFieldSelected( QAction *a ); | |||
void scaleMethodSelected( QAction *a ); | ||||
signals: | signals: | |||
void rotationFieldChanged( QString fldName ); | void rotationFieldChanged( QString fldName ); | |||
void sizeScaleFieldChanged( QString fldName ); | void sizeScaleFieldChanged( QString fldName ); | |||
void scaleMethodChanged( QgsSymbolV2::ScaleMethod scaleMethod ); | ||||
protected: | protected: | |||
QMenu* mRotationMenu; | QMenu* mRotationMenu; | |||
QMenu* mSizeScaleMenu; | QMenu* mSizeScaleMenu; | |||
const QgsFieldMap& mFlds; | QActionGroup *mSizeMethodActionGroup; | |||
QActionGroup *mRotationAttributeActionGroup; | ||||
QActionGroup *mSizeAttributeActionGroup; | ||||
const QgsFields& mFlds; | ||||
}; | }; | |||
#endif // QGSRENDERERV2WIDGET_H | #endif // QGSRENDERERV2WIDGET_H | |||
End of changes. 9 change blocks. | ||||
12 lines changed or deleted | 20 lines changed or added | |||
qgsrubberband.h | qgsrubberband.h | |||
---|---|---|---|---|
skipping to change at line 30 | skipping to change at line 30 | |||
#include <QBrush> | #include <QBrush> | |||
#include <QList> | #include <QList> | |||
#include <QPen> | #include <QPen> | |||
#include <QPolygon> | #include <QPolygon> | |||
class QgsVectorLayer; | class QgsVectorLayer; | |||
class QPaintEvent; | class QPaintEvent; | |||
/** \ingroup gui | /** \ingroup gui | |||
* A class for drawing transient features (e.g. digitising lines) on the ma p. | * A class for drawing transient features (e.g. digitising lines) on the ma p. | |||
* It may be used | ||||
*/ | */ | |||
class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem | class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem | |||
{ | { | |||
public: | public: | |||
QgsRubberBand( QgsMapCanvas* mapCanvas, bool isPolygon = false ); | ||||
/** Icons | ||||
* Added in 1.9 */ | ||||
enum IconType | ||||
{ | ||||
/** | ||||
* No icon is used | ||||
*/ | ||||
ICON_NONE, | ||||
/** | ||||
* A cross is used to highlight points (+) | ||||
*/ | ||||
ICON_CROSS, | ||||
/** | ||||
* A cross is used to highlight points (x) | ||||
*/ | ||||
ICON_X, | ||||
/** | ||||
* A box is used to highlight points (□) | ||||
*/ | ||||
ICON_BOX, | ||||
/** | ||||
* A circle is used to highlight points (○) | ||||
*/ | ||||
ICON_CIRCLE | ||||
}; | ||||
/** | ||||
* Creates a new RubberBand. | ||||
* @param mapCanvas The map canvas to draw onto. It's CRS will be used | ||||
map points onto screen coordinates. | ||||
* @param geometryType Defines how the data should be drawn onto the s | ||||
creen. (Use QGis::Line, QGis::Polygon or QGis::Point) | ||||
* @note Added in 1.9. | ||||
*/ | ||||
QgsRubberBand( QgsMapCanvas* mapCanvas, QGis::GeometryType geometryType | ||||
= QGis::Line ); | ||||
/** | ||||
* Creates a new RubberBand. | ||||
* @deprecated Use the constructor which takes QGis::GeometryType as s | ||||
econd argument instead | ||||
* @param mapCanvas The map canvas to draw onto. It's CRS will be used | ||||
map points onto screen coordinates. | ||||
* @param isPolygon true: draw as (multi-)polygon, false draw as (mult | ||||
i-)linestring | ||||
*/ | ||||
QgsRubberBand( QgsMapCanvas* mapCanvas, bool isPolygon ); | ||||
~QgsRubberBand(); | ~QgsRubberBand(); | |||
/** | ||||
* Set the color for the rubberband | ||||
* @param color The color used to render this rubberband | ||||
*/ | ||||
void setColor( const QColor & color ); | void setColor( const QColor & color ); | |||
/** | ||||
* Set the width of the line. Outline width for polygon. | ||||
* @param width The width for any lines painted for this rubberband | ||||
*/ | ||||
void setWidth( int width ); | void setWidth( int width ); | |||
void reset( bool isPolygon = false ); | /** | |||
* Set the icon type to highlight point geometries. | ||||
* @param icon The icon to visualize point geometries | ||||
* @note Added in 1.9 | ||||
*/ | ||||
void setIcon( IconType icon ); | ||||
/** | ||||
* Set the size of the point icons | ||||
* @note Added in 1.9 | ||||
*/ | ||||
void setIconSize( int iconSize ); | ||||
/** | ||||
* Set the style of the line | ||||
* @note Added in 1.9 | ||||
*/ | ||||
void setLineStyle( Qt::PenStyle penStyle ); | ||||
//! Add point to rubberband and update canvas | /** | |||
//! If adding more points consider using update=false for better perfor | * Set the style of the brush | |||
mance | * @note Added in 1.9 | |||
//! geometryIndex is the index of the feature part (in case of multipar | */ | |||
t geometries) | void setBrushStyle( Qt::BrushStyle brushStyle ); | |||
void addPoint( const QgsPoint & p, bool update = true, int geometryInde | ||||
x = 0 ); | ||||
//!Removes the last point. Most useful in connection with undo operatio | /** | |||
ns | * Clears all the geometries in this rubberband. | |||
void removeLastPoint( int geometryIndex = 0 ); | * Sets the representation type according to geometryType. | |||
* @param geometryType Defines how the data should be drawn onto the s | ||||
creen. (Use QGis::Line, QGis::Polygon or QGis::Point) | ||||
* @note Added in 1.9. | ||||
*/ | ||||
void reset( QGis::GeometryType geometryType = QGis::Line ); | ||||
/** | ||||
* @deprecated Use the reset method which takes QGis::GeometryType as s | ||||
econd argument instead | ||||
* Clears all the geometries in this rubberband. | ||||
* Sets the representation type according to isPolygon. | ||||
* @param isPolygon true: draw as (multi-)polygon, false draw as (mult | ||||
i-)linestring | ||||
*/ | ||||
void reset( bool isPolygon ); | ||||
/** | ||||
* Add a vertex to the rubberband and update canvas. | ||||
* The rendering of the vertex depends on the current GeometryType and | ||||
icon. | ||||
* If adding more points consider using update=false for better perform | ||||
ance | ||||
* @param p The vertex/point to add | ||||
* @param doUpdate Should the map canvas be updated immediately? | ||||
* @param geometryIndex The index of the feature part (in case of mult | ||||
ipart geometries) | ||||
*/ | ||||
void addPoint( const QgsPoint & p, bool doUpdate = true, int geometryIn | ||||
dex = 0 ); | ||||
/** | ||||
* Remove a vertex from the rubberband and (optionally) update canvas. | ||||
* @param index The index of the vertex/point to remove, negative indexe | ||||
s start at end | ||||
* @param doUpdate Should the map canvas be updated immediately? | ||||
* @param geometryIndex The index of the feature part (in case of multip | ||||
art geometries) | ||||
*/ | ||||
void removePoint( int index = 0, bool doUpdate = true, int geometryInde | ||||
x = 0 ); | ||||
/** | ||||
* Removes the last point. Most useful in connection with undo operatio | ||||
ns | ||||
*/ | ||||
void removeLastPoint( int geometryIndex = 0 , bool doUpdate = true ); | ||||
/** | ||||
* Moves the rubber band point specified by index. Note that if the rub | ||||
ber band is | ||||
* not used to track the last mouse position, the first point of the ru | ||||
bber band has two vertices | ||||
*/ | ||||
void movePoint( const QgsPoint & p, int geometryIndex = 0 ); | void movePoint( const QgsPoint & p, int geometryIndex = 0 ); | |||
/**Moves the rubber band point specified by index. Note that if the rub | ||||
ber band is | /** | |||
not used to track the last mouse position, the first point of the rubb | * Moves the rubber band point specified by index. Note that if the rub | |||
er band has two vertices*/ | ber band is | |||
* not used to track the last mouse position, the first point of the ru | ||||
bber band has two vertices | ||||
*/ | ||||
void movePoint( int index, const QgsPoint& p, int geometryIndex = 0 ); | void movePoint( int index, const QgsPoint& p, int geometryIndex = 0 ); | |||
/**Sets this rubber band to the geometry of an existing feature. | /** | |||
This is useful for feature highlighting. | * Returns number of vertices in feature part | |||
@param geom the geometry object | * @param geometryIndex The index of the feature part (in case of mult | |||
@param layer the layer containing the feature, used for coord transform | ipart geometries) | |||
ation to map | * @return number of vertices | |||
crs. In case of 0 pointer, the coordinates are not going to be transfor | */ | |||
med. | int partSize( int geometryIndex ) const; | |||
*/ | ||||
/** | ||||
* Sets this rubber band to the geometry of an existing feature. | ||||
* This is useful for feature highlighting. | ||||
* In contrast to {@link addGeometry}, this method does also change the | ||||
geometry type of the rubberband. | ||||
* @param geom the geometry object | ||||
* @param layer the layer containing the feature, used for coord trans | ||||
formation to map | ||||
* crs. In case of 0 pointer, the coordinates are not goi | ||||
ng to be transformed. | ||||
*/ | ||||
void setToGeometry( QgsGeometry* geom, QgsVectorLayer* layer ); | void setToGeometry( QgsGeometry* geom, QgsVectorLayer* layer ); | |||
/**Sets this rubber band to a map canvas rectangle | /** | |||
@param rect rectangle in canvas coordinates | * Sets this rubber band to a map canvas rectangle | |||
@note added in version 1.7*/ | * @param rect rectangle in canvas coordinates | |||
* @note added in version 1.7 | ||||
*/ | ||||
void setToCanvasRectangle( const QRect& rect ); | void setToCanvasRectangle( const QRect& rect ); | |||
/**Add the geometry of an existing feature to a rubberband | /** | |||
This is useful for multi feature highlighting. | * Add the geometry of an existing feature to a rubberband | |||
@param geom the geometry object | * This is useful for multi feature highlighting. | |||
@param layer the layer containing the feature, used for coord transform | * As of 2.0, this method does not change the GeometryType any more. Yo | |||
ation to map | u need to set the GeometryType | |||
crs. In case of 0 pointer, the coordinates are not going to be transfor | * of the rubberband explicitly by calling {@link reset} or {@link setT | |||
med. | oGeometry} with appropriate arguments. | |||
@note added in 1.5 | * {@link setToGeometry} is also to be preferred for backwards-compatib | |||
*/ | ility. | |||
* | ||||
* @param geom the geometry object. Will be treated as a collection of | ||||
vertices. | ||||
* @param layer the layer containing the feature, used for coord trans | ||||
formation to map | ||||
* crs. In case of 0 pointer, the coordinates are not goi | ||||
ng to be transformed. | ||||
* @note added in 1.5 | ||||
*/ | ||||
void addGeometry( QgsGeometry* geom, QgsVectorLayer* layer ); | void addGeometry( QgsGeometry* geom, QgsVectorLayer* layer ); | |||
/**Adds translation to original coordinates (all in map coordinates)*/ | /** | |||
* Adds translation to original coordinates (all in map coordinates) | ||||
* @param dx x translation | ||||
* @param dy y translation | ||||
*/ | ||||
void setTranslationOffset( double dx, double dy ); | void setTranslationOffset( double dx, double dy ); | |||
/**Returns number of geometries | /** | |||
* added in 1.5 */ | * Returns number of geometries | |||
* @return number of geometries | ||||
* @note added in 1.5 | ||||
*/ | ||||
int size() const; | int size() const; | |||
/**Returns count of vertices in all lists of mPoint*/ | /** | |||
* Returns count of vertices in all lists of mPoint | ||||
* @return The total number of vertices | ||||
*/ | ||||
int numberOfVertices() const; | int numberOfVertices() const; | |||
/**Return vertex*/ | /** | |||
* Return vertex | ||||
* @param i The geometry index | ||||
* @param j The vertex index within geometry i | ||||
*/ | ||||
const QgsPoint *getPoint( int i, int j = 0 ) const; | const QgsPoint *getPoint( int i, int j = 0 ) const; | |||
/**Returns the rubberband as a Geometry. | /** | |||
* added in 1.6 */ | * Returns the rubberband as a Geometry. | |||
* @return A geometry object which reflects the current state of the r | ||||
ubberband. | ||||
* @note Added in 1.6 | ||||
*/ | ||||
QgsGeometry* asGeometry(); | QgsGeometry* asGeometry(); | |||
protected: | protected: | |||
virtual void paint( QPainter* p ); | virtual void paint( QPainter* p ); | |||
//! recalculates needed rectangle | //! recalculates needed rectangle | |||
void updateRect(); | void updateRect(); | |||
private: | private: | |||
QBrush mBrush; | QBrush mBrush; | |||
QPen mPen; | QPen mPen; | |||
/**Nested lists used for multitypes*/ | /** The size of the icon for points. | |||
* @note Added in 1.9 */ | ||||
int mIconSize; | ||||
/** Icon to be shown. | ||||
* @note Added in 1.9 */ | ||||
IconType mIconType; | ||||
/** | ||||
* Nested lists used for multitypes | ||||
*/ | ||||
QList< QList <QgsPoint> > mPoints; | QList< QList <QgsPoint> > mPoints; | |||
bool mIsPolygon; | QGis::GeometryType mGeometryType; | |||
double mTranslationOffsetX; | double mTranslationOffsetX; | |||
double mTranslationOffsetY; | double mTranslationOffsetY; | |||
QgsRubberBand(); | QgsRubberBand(); | |||
static QgsPolyline getPolyline( const QList<QgsPoint> & points ); | static QgsPolyline getPolyline( const QList<QgsPoint> & points ); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 19 change blocks. | ||||
45 lines changed or deleted | 221 lines changed or added | |||
qgsruggednessfilter.h | qgsruggednessfilter.h | |||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
/**Calculates the ruggedness index based on a 3x3 moving window. | /**Calculates the ruggedness index based on a 3x3 moving window. | |||
Algorithm from Riley et al. 1999: A terrain ruggedness index that quantif ies topographic heterogeneity*/ | Algorithm from Riley et al. 1999: A terrain ruggedness index that quantif ies topographic heterogeneity*/ | |||
class ANALYSIS_EXPORT QgsRuggednessFilter: public QgsNineCellFilter | class ANALYSIS_EXPORT QgsRuggednessFilter: public QgsNineCellFilter | |||
{ | { | |||
public: | public: | |||
QgsRuggednessFilter( const QString& inputFile, const QString& outputFil e, const QString& outputFormat ); | QgsRuggednessFilter( const QString& inputFile, const QString& outputFil e, const QString& outputFormat ); | |||
~QgsRuggednessFilter(); | ~QgsRuggednessFilter(); | |||
protected: | protected: | |||
/**Calculates output value from nine input values. The input values and the output value can be equal to the \ | /**Calculates output value from nine input values. The input values and the output value can be equal to the | |||
nodata value if not present or outside of the border. Must be impleme nted by subclasses*/ | nodata value if not present or outside of the border. Must be impleme nted by subclasses*/ | |||
float processNineCellWindow( float* x11, float* x21, float* x31, \ | float processNineCellWindow( float* x11, float* x21, float* x31, | |||
float* x12, float* x22, float* x32, float* | float* x12, float* x22, float* x32, | |||
x13, float* x23, float* x33 ); | float* x13, float* x23, float* x33 ); | |||
private: | private: | |||
QgsRuggednessFilter(); | QgsRuggednessFilter(); | |||
}; | }; | |||
#endif // QGSRUGGEDNESSFILTER_H | #endif // QGSRUGGEDNESSFILTER_H | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
qgsrulebasedrendererv2widget.h | qgsrulebasedrendererv2widget.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsrulebasedrendererv2widget.h - Settings widget for rule-based rendere r | qgsrulebasedrendererv2widget.h - Settings widget for rule-based rendere r | |||
--------------------- | --------------------- | |||
begin : May 2010 | begin : May 2010 | |||
copyright : (C) 2010 by Martin Dobias | copyright : (C) 2010 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSRULEBASEDRENDERERV2WIDGET_H | #ifndef QGSRULEBASEDRENDERERV2WIDGET_H | |||
skipping to change at line 28 | skipping to change at line 28 | |||
#include "qgsrendererv2widget.h" | #include "qgsrendererv2widget.h" | |||
#include "qgsrulebasedrendererv2.h" | #include "qgsrulebasedrendererv2.h" | |||
class QMenu; | class QMenu; | |||
/////// | /////// | |||
#include <QAbstractItemModel> | #include <QAbstractItemModel> | |||
/* Features count fro rule */ | ||||
struct QgsRuleBasedRendererV2Count | ||||
{ | ||||
int count; // number of features | ||||
int duplicateCount; // number of features present also in other rule(s) | ||||
// map of feature counts in other rules | ||||
QMap<QgsRuleBasedRendererV2::Rule*, int> duplicateCountMap; | ||||
}; | ||||
/* | /* | |||
Tree model for the rules: | Tree model for the rules: | |||
(invalid) == root node | (invalid) == root node | |||
+--- top level rule | +--- top level rule | |||
+--- top level rule | +--- top level rule | |||
*/ | */ | |||
class QgsRuleBasedRendererV2Model : public QAbstractItemModel | class GUI_EXPORT QgsRuleBasedRendererV2Model : public QAbstractItemModel | |||
{ | { | |||
public: | public: | |||
QgsRuleBasedRendererV2Model( QgsRuleBasedRendererV2* r ); | QgsRuleBasedRendererV2Model( QgsRuleBasedRendererV2* r ); | |||
virtual Qt::ItemFlags flags( const QModelIndex &index ) const; | virtual Qt::ItemFlags flags( const QModelIndex &index ) const; | |||
virtual QVariant data( const QModelIndex &index, int role = Qt::Display Role ) const; | virtual QVariant data( const QModelIndex &index, int role = Qt::Display Role ) const; | |||
virtual QVariant headerData( int section, Qt::Orientation orientation, | virtual QVariant headerData( int section, Qt::Orientation orientation, | |||
int role = Qt::DisplayRole ) const; | int role = Qt::DisplayRole ) const; | |||
virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const ; | virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const ; | |||
virtual int columnCount( const QModelIndex & = QModelIndex() ) const; | virtual int columnCount( const QModelIndex & = QModelIndex() ) const; | |||
skipping to change at line 68 | skipping to change at line 77 | |||
bool dropMimeData( const QMimeData *data, Qt::DropAction action, int ro w, int column, const QModelIndex &parent ); | bool dropMimeData( const QMimeData *data, Qt::DropAction action, int ro w, int column, const QModelIndex &parent ); | |||
bool removeRows( int row, int count, const QModelIndex & parent = QMode lIndex() ); | bool removeRows( int row, int count, const QModelIndex & parent = QMode lIndex() ); | |||
// new methods | // new methods | |||
QgsRuleBasedRendererV2::Rule* ruleForIndex( const QModelIndex& index ) const; | QgsRuleBasedRendererV2::Rule* ruleForIndex( const QModelIndex& index ) const; | |||
void insertRule( const QModelIndex& parent, int before, QgsRuleBasedRen dererV2::Rule* newrule ); | void insertRule( const QModelIndex& parent, int before, QgsRuleBasedRen dererV2::Rule* newrule ); | |||
void updateRule( const QModelIndex& parent, int row ); | void updateRule( const QModelIndex& parent, int row ); | |||
// update rule and all its descendants | ||||
void updateRule( const QModelIndex& index ); | ||||
void removeRule( const QModelIndex& index ); | void removeRule( const QModelIndex& index ); | |||
void willAddRules( const QModelIndex& parent, int count ); // call begi nInsertRows | void willAddRules( const QModelIndex& parent, int count ); // call begi nInsertRows | |||
void finishedAddingRules(); // call endInsertRows | void finishedAddingRules(); // call endInsertRows | |||
void setFeatureCounts( QMap<QgsRuleBasedRendererV2::Rule*, QgsRuleBased | ||||
RendererV2Count> theCountMap ); | ||||
void clearFeatureCounts(); | ||||
protected: | protected: | |||
QgsRuleBasedRendererV2* mR; | QgsRuleBasedRendererV2* mR; | |||
QMap<QgsRuleBasedRendererV2::Rule*, QgsRuleBasedRendererV2Count> mFeatu reCountMap; | ||||
}; | }; | |||
/////// | /////// | |||
#include "ui_qgsrulebasedrendererv2widget.h" | #include "ui_qgsrulebasedrendererv2widget.h" | |||
class GUI_EXPORT QgsRuleBasedRendererV2Widget : public QgsRendererV2Widget, private Ui::QgsRuleBasedRendererV2Widget | class GUI_EXPORT QgsRuleBasedRendererV2Widget : public QgsRendererV2Widget, private Ui::QgsRuleBasedRendererV2Widget | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
skipping to change at line 100 | skipping to change at line 115 | |||
~QgsRuleBasedRendererV2Widget(); | ~QgsRuleBasedRendererV2Widget(); | |||
virtual QgsFeatureRendererV2* renderer(); | virtual QgsFeatureRendererV2* renderer(); | |||
public slots: | public slots: | |||
void addRule(); | void addRule(); | |||
void editRule(); | void editRule(); | |||
void editRule( const QModelIndex& index ); | void editRule( const QModelIndex& index ); | |||
void removeRule(); | void removeRule(); | |||
void countFeatures(); | ||||
void clearFeatureCounts() { mModel->clearFeatureCounts(); } | ||||
void refineRuleScales(); | void refineRuleScales(); | |||
void refineRuleCategories(); | void refineRuleCategories(); | |||
void refineRuleRanges(); | void refineRuleRanges(); | |||
void setRenderingOrder(); | void setRenderingOrder(); | |||
void currentRuleChanged( const QModelIndex& current = QModelIndex(), co nst QModelIndex& previous = QModelIndex() ); | void currentRuleChanged( const QModelIndex& current = QModelIndex(), co nst QModelIndex& previous = QModelIndex() ); | |||
void saveSectionWidth( int section, int oldSize, int newSize ); | ||||
void restoreSectionWidths(); | ||||
protected: | protected: | |||
void refineRule( int type ); | void refineRule( int type ); | |||
void refineRuleCategoriesGui( const QModelIndexList& index ); | void refineRuleCategoriesGui( const QModelIndexList& index ); | |||
void refineRuleRangesGui( const QModelIndexList& index ); | void refineRuleRangesGui( const QModelIndexList& index ); | |||
void refineRuleScalesGui( const QModelIndexList& index ); | void refineRuleScalesGui( const QModelIndexList& index ); | |||
QgsRuleBasedRendererV2::Rule* currentRule(); | QgsRuleBasedRendererV2::Rule* currentRule(); | |||
QList<QgsSymbolV2*> selectedSymbols(); | QList<QgsSymbolV2*> selectedSymbols(); | |||
skipping to change at line 138 | skipping to change at line 158 | |||
#include <QDialog> | #include <QDialog> | |||
#include "ui_qgsrendererrulepropsdialogbase.h" | #include "ui_qgsrendererrulepropsdialogbase.h" | |||
class GUI_EXPORT QgsRendererRulePropsDialog : public QDialog, private Ui::Q gsRendererRulePropsDialog | class GUI_EXPORT QgsRendererRulePropsDialog : public QDialog, private Ui::Q gsRendererRulePropsDialog | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsRendererRulePropsDialog( QgsRuleBasedRendererV2::Rule* rule, QgsVect orLayer* layer, QgsStyleV2* style ); | QgsRendererRulePropsDialog( QgsRuleBasedRendererV2::Rule* rule, QgsVect orLayer* layer, QgsStyleV2* style, QWidget* parent = 0 ); | |||
~QgsRendererRulePropsDialog(); | ~QgsRendererRulePropsDialog(); | |||
QgsRuleBasedRendererV2::Rule* rule() { return mRule; } | QgsRuleBasedRendererV2::Rule* rule() { return mRule; } | |||
public slots: | public slots: | |||
void testFilter(); | void testFilter(); | |||
void buildExpression(); | void buildExpression(); | |||
void accept(); | void accept(); | |||
protected: | protected: | |||
End of changes. 9 change blocks. | ||||
3 lines changed or deleted | 24 lines changed or added | |||
qgsscalecalculator.h | qgsscalecalculator.h | |||
---|---|---|---|---|
skipping to change at line 52 | skipping to change at line 52 | |||
QGis::UnitType mapUnits = QGis::Meters ); | QGis::UnitType mapUnits = QGis::Meters ); | |||
//! Destructor | //! Destructor | |||
~QgsScaleCalculator(); | ~QgsScaleCalculator(); | |||
/** | /** | |||
* Set the dpi to be used in scale calculations | * Set the dpi to be used in scale calculations | |||
* @param dpi Dots per inch of monitor resolution | * @param dpi Dots per inch of monitor resolution | |||
*/ | */ | |||
void setDpi( double dpi ); | void setDpi( double dpi ); | |||
/** | /** | |||
* Accessor for dpi used in scale calculations | * Accessor for dpi used in scale calculations | |||
* @return int the dpi used for scale calculations. | * @return int the dpi used for scale calculations. | |||
*/ | */ | |||
double dpi(); | double dpi(); | |||
/** | /** | |||
* Set the map units | * Set the map units | |||
* @param mapUnits Units of the data on the map. Must match a value fro m the | * @param mapUnits Units of the data on the map. Must match a value fro m the | |||
*/ | */ | |||
void setMapUnits( QGis::UnitType mapUnits ); | void setMapUnits( QGis::UnitType mapUnits ); | |||
/** Returns current map units */ | /** Returns current map units */ | |||
QGis::UnitType mapUnits() const; | QGis::UnitType mapUnits() const; | |||
/** | /** | |||
* Calculate the scale | * Calculate the scale denominator | |||
* @param mapExtent QgsRectangle containing the current map extent | * @param mapExtent QgsRectangle containing the current map extent | |||
* @param canvasWidth Width of the map canvas in pixel (physical) units | * @param canvasWidth Width of the map canvas in pixel (physical) units | |||
* @return scale of current map view | * @return scale denominator of current map view | |||
*/ | */ | |||
double calculate( const QgsRectangle &mapExtent, int canvasWidth ); | double calculate( const QgsRectangle &mapExtent, int canvasWidth ); | |||
/** | /** | |||
* Calculate the distance between two points in geographic coordinates. | * Calculate the distance between two points in geographic coordinates. | |||
* Used to calculate scale for map views with geographic (decimal degre e) | * Used to calculate scale for map views with geographic (decimal degre e) | |||
* data. | * data. | |||
* @param mapExtent QgsRectangle containing the current map extent | * @param mapExtent QgsRectangle containing the current map extent | |||
*/ | */ | |||
double calculateGeographicDistance( const QgsRectangle &mapExtent ); | double calculateGeographicDistance( const QgsRectangle &mapExtent ); | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 3 lines changed or added | |||
qgsscalecombobox.h | qgsscalecombobox.h | |||
---|---|---|---|---|
skipping to change at line 34 | skipping to change at line 34 | |||
* A combobox which lets the user select map scale from predefined list | * A combobox which lets the user select map scale from predefined list | |||
* and highlights nearest to current scale value | * and highlights nearest to current scale value | |||
**/ | **/ | |||
class GUI_EXPORT QgsScaleComboBox : public QComboBox | class GUI_EXPORT QgsScaleComboBox : public QComboBox | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsScaleComboBox( QWidget* parent = 0 ); | QgsScaleComboBox( QWidget* parent = 0 ); | |||
virtual ~QgsScaleComboBox(); | virtual ~QgsScaleComboBox(); | |||
//! Function to read the selected scale as text | ||||
// @note added in 2.0 | ||||
QString scaleString(); | ||||
//! Function to set the selected scale from text | ||||
// @note added in 2.0 | ||||
bool setScaleString( QString scaleTxt ); | ||||
//! Function to read the selected scale as double | ||||
// @note added in 2.0 | ||||
double scale(); | ||||
//! Function to set the selected scale from double | ||||
// @note added in 2.0 | ||||
void setScale( double scale ); | ||||
//! Helper function to convert a double to scale string | ||||
// Performs rounding, so an exact representation is not to | ||||
// be expected. | ||||
// @note added in 2.0 | ||||
static QString toString( double scale ); | ||||
//! Helper function to convert a scale string to double | ||||
// @note added in 2.0 | ||||
static double toDouble( QString scaleString, bool *ok = NULL ); | ||||
signals: | ||||
//! Signal is emitted when *user* has finished editing/selecting a new | ||||
scale. | ||||
// @note added in 2.0 | ||||
void scaleChanged(); | ||||
public slots: | ||||
void updateScales( const QStringList &scales = QStringList() ); | ||||
protected: | protected: | |||
void showPopup(); | void showPopup(); | |||
private slots: | ||||
void fixupScale(); | ||||
private: | ||||
double mScale; | ||||
}; | }; | |||
#endif // QGSSCALECOMBOBOX_H | #endif // QGSSCALECOMBOBOX_H | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 37 lines changed or added | |||
qgssinglesymbolrendererv2.h | qgssinglesymbolrendererv2.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgssinglesymbolrendererv2.h | qgssinglesymbolrendererv2.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSSINGLESYMBOLRENDERERV2_H | #ifndef QGSSINGLESYMBOLRENDERERV2_H | |||
#define QGSSINGLESYMBOLRENDERERV2_H | #define QGSSINGLESYMBOLRENDERERV2_H | |||
#include "qgis.h" | #include "qgis.h" | |||
#include "qgsrendererv2.h" | #include "qgsrendererv2.h" | |||
#include "qgssymbolv2.h" | ||||
class CORE_EXPORT QgsSingleSymbolRendererV2 : public QgsFeatureRendererV2 | class CORE_EXPORT QgsSingleSymbolRendererV2 : public QgsFeatureRendererV2 | |||
{ | { | |||
public: | public: | |||
QgsSingleSymbolRendererV2( QgsSymbolV2* symbol ); | QgsSingleSymbolRendererV2( QgsSymbolV2* symbol ); | |||
virtual ~QgsSingleSymbolRendererV2(); | virtual ~QgsSingleSymbolRendererV2(); | |||
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature ); | virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature ); | |||
skipping to change at line 50 | skipping to change at line 51 | |||
//! @note added in 1.5 | //! @note added in 1.5 | |||
void setRotationField( QString fieldName ) { mRotationField = fieldName ; } | void setRotationField( QString fieldName ) { mRotationField = fieldName ; } | |||
//! @note added in 1.5 | //! @note added in 1.5 | |||
QString rotationField() const { return mRotationField; } | QString rotationField() const { return mRotationField; } | |||
//! @note added in 1.5 | //! @note added in 1.5 | |||
void setSizeScaleField( QString fieldName ) { mSizeScaleField = fieldNa me; } | void setSizeScaleField( QString fieldName ) { mSizeScaleField = fieldNa me; } | |||
//! @note added in 1.5 | //! @note added in 1.5 | |||
QString sizeScaleField() const { return mSizeScaleField; } | QString sizeScaleField() const { return mSizeScaleField; } | |||
virtual QString dump(); | //! @note added in 2.0 | |||
void setScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod ); | ||||
//! @note added in 2.0 | ||||
QgsSymbolV2::ScaleMethod scaleMethod() const { return mScaleMethod; } | ||||
virtual QString dump() const; | ||||
virtual QgsFeatureRendererV2* clone(); | virtual QgsFeatureRendererV2* clone(); | |||
virtual void toSld( QDomDocument& doc, QDomElement &element ) const; | virtual void toSld( QDomDocument& doc, QDomElement &element ) const; | |||
static QgsFeatureRendererV2* createFromSld( QDomElement& element, QGis: :GeometryType geomType ); | static QgsFeatureRendererV2* createFromSld( QDomElement& element, QGis: :GeometryType geomType ); | |||
//! returns bitwise OR-ed capabilities of the renderer | //! returns bitwise OR-ed capabilities of the renderer | |||
//! \note added in 2.0 | //! \note added in 2.0 | |||
virtual int capabilities() { return SymbolLevels | RotationField; } | virtual int capabilities() { return SymbolLevels | RotationField; } | |||
skipping to change at line 74 | skipping to change at line 80 | |||
static QgsFeatureRendererV2* create( QDomElement& element ); | static QgsFeatureRendererV2* create( QDomElement& element ); | |||
//! store renderer info to XML element | //! store renderer info to XML element | |||
virtual QDomElement save( QDomDocument& doc ); | virtual QDomElement save( QDomDocument& doc ); | |||
//! return a list of symbology items for the legend | //! return a list of symbology items for the legend | |||
virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize ); | virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize ); | |||
//! return a list of item text / symbol | //! return a list of item text / symbol | |||
//! @note: this method was added in version 1.5 | //! @note: this method was added in version 1.5 | |||
//! @note not available in python bindings | ||||
virtual QgsLegendSymbolList legendSymbolItems(); | virtual QgsLegendSymbolList legendSymbolItems(); | |||
protected: | protected: | |||
QgsSymbolV2* mSymbol; | QgsSymbolV2* mSymbol; | |||
QString mRotationField; | QString mRotationField; | |||
QString mSizeScaleField; | QString mSizeScaleField; | |||
QgsSymbolV2::ScaleMethod mScaleMethod; | ||||
// temporary stuff for rendering | // temporary stuff for rendering | |||
int mRotationFieldIdx, mSizeScaleFieldIdx; | int mRotationFieldIdx, mSizeScaleFieldIdx; | |||
QgsSymbolV2* mTempSymbol; | QgsSymbolV2* mTempSymbol; | |||
double mOrigSize; | double mOrigSize; | |||
}; | }; | |||
#endif // QGSSINGLESYMBOLRENDERERV2_H | #endif // QGSSINGLESYMBOLRENDERERV2_H | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 10 lines changed or added | |||
qgssinglesymbolrendererv2widget.h | qgssinglesymbolrendererv2widget.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgssinglesymbolrendererv2widget.h | qgssinglesymbolrendererv2widget.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSSINGLESYMBOLRENDERERV2WIDGET_H | #ifndef QGSSINGLESYMBOLRENDERERV2WIDGET_H | |||
#define QGSSINGLESYMBOLRENDERERV2WIDGET_H | #define QGSSINGLESYMBOLRENDERERV2WIDGET_H | |||
skipping to change at line 30 | skipping to change at line 30 | |||
class QgsSingleSymbolRendererV2; | class QgsSingleSymbolRendererV2; | |||
class QgsSymbolV2SelectorDialog; | class QgsSymbolV2SelectorDialog; | |||
class QMenu; | class QMenu; | |||
class GUI_EXPORT QgsSingleSymbolRendererV2Widget : public QgsRendererV2Widg et | class GUI_EXPORT QgsSingleSymbolRendererV2Widget : public QgsRendererV2Widg et | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
static QgsRendererV2Widget* create( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ); | static QgsRendererV2Widget* create( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ); | |||
QgsSingleSymbolRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* sty le, QgsFeatureRendererV2* renderer ); | QgsSingleSymbolRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* sty le, QgsFeatureRendererV2* renderer ); | |||
~QgsSingleSymbolRendererV2Widget(); | ~QgsSingleSymbolRendererV2Widget(); | |||
virtual QgsFeatureRendererV2* renderer(); | virtual QgsFeatureRendererV2* renderer(); | |||
public slots: | public slots: | |||
void changeSingleSymbol(); | void changeSingleSymbol(); | |||
void rotationFieldChanged( QString fldName ); | void rotationFieldChanged( QString fldName ); | |||
void sizeScaleFieldChanged( QString fldName ); | void sizeScaleFieldChanged( QString fldName ); | |||
void scaleMethodChanged( QgsSymbolV2::ScaleMethod scaleMethod ); | ||||
void showSymbolLevels(); | void showSymbolLevels(); | |||
protected: | protected: | |||
QgsSingleSymbolRendererV2* mRenderer; | QgsSingleSymbolRendererV2* mRenderer; | |||
QgsSymbolV2SelectorDialog* mSelector; | QgsSymbolV2SelectorDialog* mSelector; | |||
QgsSymbolV2* mSingleSymbol; | QgsSymbolV2* mSingleSymbol; | |||
QgsRendererV2DataDefinedMenus* mDataDefinedMenus; | QgsRendererV2DataDefinedMenus* mDataDefinedMenus; | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
qgssnapper.h | qgssnapper.h | |||
---|---|---|---|---|
skipping to change at line 73 | skipping to change at line 73 | |||
enum SnappingType | enum SnappingType | |||
{ | { | |||
SnapToVertex, | SnapToVertex, | |||
SnapToSegment, | SnapToSegment, | |||
//snap to vertex and also to segment if no vertex is within the searc h tolerance | //snap to vertex and also to segment if no vertex is within the searc h tolerance | |||
SnapToVertexAndSegment | SnapToVertexAndSegment | |||
}; | }; | |||
enum SnappingMode | enum SnappingMode | |||
{ | { | |||
/**Only one snapping result is retured*/ | /**Only one snapping result is returned*/ | |||
SnapWithOneResult, | SnapWithOneResult, | |||
/**Several snapping results which have the same position are returned . | /**Several snapping results which have the same position are returned . | |||
This is useful for topological editing*/ | This is useful for topological editing*/ | |||
SnapWithResultsForSamePosition, | SnapWithResultsForSamePosition, | |||
/**All results within the given layer tolerances are returned*/ | /**All results within the given layer tolerances are returned*/ | |||
SnapWithResultsWithinTolerances | SnapWithResultsWithinTolerances | |||
}; | }; | |||
struct SnapLayer | struct SnapLayer | |||
{ | { | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgsspatialindex.h | qgsspatialindex.h | |||
---|---|---|---|---|
skipping to change at line 48 | skipping to change at line 48 | |||
#include "qgsfeature.h" | #include "qgsfeature.h" | |||
class CORE_EXPORT QgsSpatialIndex | class CORE_EXPORT QgsSpatialIndex | |||
{ | { | |||
public: | public: | |||
/* creation of spatial index */ | /* creation of spatial index */ | |||
/** create new spatial index that will be stored in memory */ | ||||
//static QgsSpatialIndex* createMemoryIndex(); | ||||
/** create new spatial index that stores its data on disk */ | ||||
//static QgsSpatialIndex* createDiskIndex(QString fileName); | ||||
/** constructor - creates R-tree */ | /** constructor - creates R-tree */ | |||
QgsSpatialIndex(); | QgsSpatialIndex(); | |||
/** destructor finalizes work with spatial index */ | /** destructor finalizes work with spatial index */ | |||
~QgsSpatialIndex(); | ~QgsSpatialIndex(); | |||
/* operations */ | /* operations */ | |||
/** add feature to index */ | /** add feature to index */ | |||
bool insertFeature( QgsFeature& f ); | bool insertFeature( QgsFeature& f ); | |||
skipping to change at line 77 | skipping to change at line 71 | |||
/* queries */ | /* queries */ | |||
/** returns features that intersect the specified rectangle */ | /** returns features that intersect the specified rectangle */ | |||
QList<QgsFeatureId> intersects( QgsRectangle rect ); | QList<QgsFeatureId> intersects( QgsRectangle rect ); | |||
/** returns nearest neighbors (their count is specified by second param eter) */ | /** returns nearest neighbors (their count is specified by second param eter) */ | |||
QList<QgsFeatureId> nearestNeighbor( QgsPoint point, int neighbors ); | QList<QgsFeatureId> nearestNeighbor( QgsPoint point, int neighbors ); | |||
protected: | protected: | |||
// @note not available in python bindings | ||||
SpatialIndex::Region rectToRegion( QgsRectangle rect ); | SpatialIndex::Region rectToRegion( QgsRectangle rect ); | |||
// @note not available in python bindings | ||||
bool featureInfo( QgsFeature& f, SpatialIndex::Region& r, QgsFeatureId &id ); | bool featureInfo( QgsFeature& f, SpatialIndex::Region& r, QgsFeatureId &id ); | |||
private: | private: | |||
/** storage manager */ | /** storage manager */ | |||
SpatialIndex::IStorageManager* mStorageManager; | SpatialIndex::IStorageManager* mStorageManager; | |||
/** buffer for index data */ | /** buffer for index data */ | |||
SpatialIndex::StorageManager::IBuffer* mStorage; | SpatialIndex::StorageManager::IBuffer* mStorage; | |||
End of changes. 3 change blocks. | ||||
8 lines changed or deleted | 2 lines changed or added | |||
qgsstylev2.h | qgsstylev2.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsstylev2.h | qgsstylev2.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSSTYLEV2_H | #ifndef QGSSTYLEV2_H | |||
#define QGSSTYLEV2_H | #define QGSSTYLEV2_H | |||
#include <QMap> | #include <QMap> | |||
#include <QMultiMap> | ||||
#include <QString> | #include <QString> | |||
#include <sqlite3.h> | ||||
#include "qgssymbollayerv2utils.h" // QgsStringMap | #include "qgssymbollayerv2utils.h" // QgsStringMap | |||
class QgsSymbolV2; | class QgsSymbolV2; | |||
class QgsSymbolLayerV2; | class QgsSymbolLayerV2; | |||
class QgsVectorColorRampV2; | class QgsVectorColorRampV2; | |||
class QDomDocument; | class QDomDocument; | |||
class QDomElement; | class QDomElement; | |||
typedef QMap<QString, QgsVectorColorRampV2* > QgsVectorColorRampV2Map; | typedef QMap<QString, QgsVectorColorRampV2* > QgsVectorColorRampV2Map; | |||
typedef QMap<int, QString> QgsSymbolGroupMap; | ||||
/*! | ||||
* A multimap to hold the smart group conditions as constraint and paramet | ||||
er pairs. | ||||
* Both the key and the value of the map are QString. The key is the const | ||||
raint of the condition and the value is the parameter which is applied for | ||||
the constraint. | ||||
* | ||||
* The supported constraints are: | ||||
* tag -> symbol has the tag matching the parameter | ||||
* !tag -> symbol doesnot have the tag matching the parameter | ||||
* group -> symbol belongs to group specified by the parameter | ||||
* !group -> symbol doesn't belong to the group specified by the parameter | ||||
* name -> symbol has a part of its name matching the parameter | ||||
* !name -> symbol doesn't have any part of the name matching the paramete | ||||
r | ||||
* | ||||
* Example Usage: | ||||
* QgsSmartConditionMap conditions; | ||||
* conditions.insert( "tag", "red" ); // adds the condition: Symbol has th | ||||
e tag red | ||||
* conditions.insert( "!name", "way" ); // add the condition: Symbol doesn | ||||
't have any part of its name matching `way` | ||||
* | ||||
* \note This is a Multimap, which means it will contain multiple values f | ||||
or the same key. | ||||
*/ | ||||
typedef QMultiMap<QString, QString> QgsSmartConditionMap; | ||||
// enumerators representing sqlite DB columns | ||||
enum SymbolTable { SymbolId, SymbolName, SymbolXML, SymbolGroupId }; | ||||
enum SymgroupTable { SymgroupId, SymgroupName, SymgroupParent }; | ||||
enum TagTable { TagId, TagName }; | ||||
enum TagmapTable { TagmapTagId, TagmapSymbolId }; | ||||
enum ColorrampTable { ColorrampId, ColorrampName, ColorrampXML, ColorrampGr | ||||
oupId }; | ||||
enum SmartgroupTable { SmartgroupId, SmartgroupName, SmartgroupXML }; | ||||
class CORE_EXPORT QgsStyleV2 | class CORE_EXPORT QgsStyleV2 | |||
{ | { | |||
public: | public: | |||
QgsStyleV2(); | QgsStyleV2(); | |||
~QgsStyleV2(); | ~QgsStyleV2(); | |||
//! return default application-wide style | //! Enum for Entities involved in a style | |||
static QgsStyleV2* defaultStyle(); | /*! | |||
The enumerator is used for identifying the entity being operated on | ||||
when generic | ||||
database functions are being run. | ||||
\sa group(), rename(), remove(), symbolsOfGroup(), symbolsWithTag() | ||||
, symbolsOfSmartgroup() | ||||
*/ | ||||
enum StyleEntity { SymbolEntity, GroupEntity, TagEntity, ColorrampEntit | ||||
y, SmartgroupEntity }; | ||||
//! add color ramp to style. takes ramp's ownership | ||||
/*! | ||||
* \note Adding a color ramp with the name of existing one replaces it | ||||
. | ||||
* \param name is the name of the color ramp being added or updated | ||||
* \param colorRamp is the Vector color ramp | ||||
* \param update set to true when the style DB has to be updated, by d | ||||
efault it is false | ||||
* \return success status of the operation | ||||
*/ | ||||
bool addColorRamp( QString name, QgsVectorColorRampV2* colorRamp, bool | ||||
update = false ); | ||||
//! adds a new group and returns the group's id | ||||
/*! | ||||
* \param groupName the name of the new group as QString | ||||
* \param parent is the id of the parent group when a subgrouo is to b | ||||
e created. By default it is 0 indicating it is not a sub-group | ||||
* \return returns an int, which is the DB id of the new group created | ||||
, 0 if the group couldn't be created | ||||
*/ | ||||
int addGroup( QString groupName, int parent = 0 ); | ||||
//! adds new smartgroup to the database and returns the id | ||||
/*! | ||||
* \param name is the name of the new Smart Group to be added | ||||
* \param op is the operator between the conditions; AND/OR as QString | ||||
* \param conditions are the smart group conditions | ||||
*/ | ||||
int addSmartgroup( QString name, QString op, QgsSmartConditionMap condi | ||||
tions ); | ||||
//! add symbol to style. takes symbol's ownership | ||||
/*! | ||||
* \note Adding a symbol with the name of existing one replaces it. | ||||
* \param name is the name of the symbol being added or updated | ||||
* \param symbol is the Vector symbol | ||||
* \param update set to true when the style DB has to be updated, by d | ||||
efault it is false | ||||
* \return success status of the operation | ||||
*/ | ||||
bool addSymbol( QString name, QgsSymbolV2* symbol, bool update = false | ||||
); | ||||
//! adds a new tag and returns the tag's id | ||||
/*! | ||||
* \param tagName the name of the new tag to be created | ||||
* \return returns an int, which is the DB id of the new tag created, | ||||
0 if the tag couldn't be created | ||||
*/ | ||||
int addTag( QString tagName ); | ||||
//! return a map of groupid and names for the given parent group | ||||
QgsSymbolGroupMap childGroupNames( QString parent = "" ); | ||||
//! remove all contents of the style | //! remove all contents of the style | |||
void clear(); | void clear(); | |||
//! add symbol to style. takes symbol's ownership | //! return a NEW copy of color ramp | |||
bool addSymbol( QString name, QgsSymbolV2* symbol ); | QgsVectorColorRampV2* colorRamp( QString name ); | |||
//! return count of color ramps | ||||
int colorRampCount(); | ||||
//! return a list of names of color ramps | ||||
QStringList colorRampNames(); | ||||
//! return a const pointer to a symbol (doesn't create new instance) | ||||
const QgsVectorColorRampV2* colorRampRef( QString name ) const; | ||||
//! return the id in the style database for the given colorramp name | ||||
//! returns 0 if not found | ||||
int colorrampId( QString name ); | ||||
//! return default application-wide style | ||||
static QgsStyleV2* defaultStyle(); | ||||
//! tags the symbol with the tags in the list | ||||
/*! | ||||
* Applies the given tags to the given symbol or colorramp | ||||
* \param type is either SymbolEntity or ColorrampEntity | ||||
* \param symbol is the name of the symbol or colorramp as QString | ||||
* \param tags is the list of the tags that are to be applied as QStri | ||||
ngList | ||||
* \return returns the success state of the operation | ||||
*/ | ||||
bool tagSymbol( StyleEntity type, QString symbol, QStringList tags ); | ||||
//! detags the symbol with the given list | ||||
/*! | ||||
* Removes the given tags for the specified symbol or colorramp | ||||
* \param type is either SymbolEntity or ColorrampEntity | ||||
* \param symbol is the name of the symbol or colorramp | ||||
* \param tags is the list of tags that are to be removed as QStringLi | ||||
st | ||||
* \return returns the success state of the operation | ||||
*/ | ||||
bool detagSymbol( StyleEntity type, QString symbol, QStringList tags ); | ||||
//! remove symbol from style (and delete it) | //! remove symbol from style (and delete it) | |||
bool removeSymbol( QString name ); | bool removeSymbol( QString name ); | |||
//! change symbol's name | //! change symbol's name | |||
//! @note added in v1.7 | //! @note added in v1.7 | |||
bool renameSymbol( QString oldName, QString newName ); | bool renameSymbol( QString oldName, QString newName ); | |||
//! return a NEW copy of symbol | //! return a NEW copy of symbol | |||
QgsSymbolV2* symbol( QString name ); | QgsSymbolV2* symbol( QString name ); | |||
//! return a const pointer to a symbol (doesn't create new instance) | //! return a const pointer to a symbol (doesn't create new instance) | |||
const QgsSymbolV2* symbolRef( QString name ) const; | const QgsSymbolV2* symbolRef( QString name ) const; | |||
//! return count of symbols in style | //! return count of symbols in style | |||
int symbolCount(); | int symbolCount(); | |||
//! return a list of names of symbols | //! return a list of names of symbols | |||
QStringList symbolNames(); | QStringList symbolNames(); | |||
//! add color ramp to style. takes ramp's ownership | //! return the id in the style database for the given symbol name | |||
bool addColorRamp( QString name, QgsVectorColorRampV2* colorRamp ); | //! returns 0 if not found | |||
int symbolId( QString name ); | ||||
//! return the DB id for the given group name | ||||
int groupId( QString group ); | ||||
//! return the DB id for the given tag name | ||||
int tagId( QString tag ); | ||||
//! return the DB id for the given smartgroup name | ||||
int smartgroupId( QString smartgroup ); | ||||
//! return the all the groups in the style | ||||
QStringList groupNames(); | ||||
//! returns the symbolnames of a given groupid | ||||
/*! | ||||
* \param type is either SymbolEntity or ColorampEntity | ||||
* \param groupid is id of the group to which the symbols belong to, a | ||||
s int | ||||
* \return A QStringList of the symbol or colorramp names for the give | ||||
n group id | ||||
*/ | ||||
QStringList symbolsOfGroup( StyleEntity type, int groupid ); | ||||
//! returns the symbol names with which have the given tag | ||||
/*! | ||||
* \param type is either SymbolEntity or ColorampEntity | ||||
* \param tagid is id of the tag which has been applied over the symbo | ||||
l as int | ||||
* \return A QStringList of the symbol or colorramp names for the give | ||||
n tag id | ||||
*/ | ||||
QStringList symbolsWithTag( StyleEntity type, int tagid ); | ||||
//! applies the specified group to the symbol or colorramp specified by | ||||
StyleEntity | ||||
/*! | ||||
* \param type is either SymbolEntity of ColorrampEntity | ||||
* \param name is the name of the symbol or coloramp whose group is to | ||||
be set | ||||
* \param groupid is the id of the group to which the entity is assign | ||||
ed | ||||
* \return returns the success state as bool | ||||
*/ | ||||
bool group( StyleEntity type, QString name, int groupid ); | ||||
//! rename the given entity with the specified id | ||||
/*! | ||||
* \param type is any of the style entites. Refer enum StyleEntity. | ||||
* \param id is the DB id of the entity which is to be renamed | ||||
* \param newName is the new name of the entity | ||||
*/ | ||||
void rename( StyleEntity type, int id, QString newName ); | ||||
//! remove the specified entity from the db | ||||
/*! | ||||
* \param type is any of the style entites. Refer enum StyleEntity. | ||||
* \param id is the DB id of the entity to be removed | ||||
*/ | ||||
void remove( StyleEntity type, int id ); | ||||
//! add the symbol to the DB with the tags | ||||
/*! | ||||
* \param name is the name of the symbol as QString | ||||
* \param symbol is the pointer to the new QgsSymbolV2 being saved | ||||
* \param groupid is the id of the group to which the symbol belongs. | ||||
Pass 0 if it doesn't belong to any group or not known. | ||||
* \param tags is a list of tags that are associated with the symbol a | ||||
s a QStringList. | ||||
* \return returns the success state of the save operation | ||||
*/ | ||||
bool saveSymbol( QString name, QgsSymbolV2* symbol, int groupid, QStrin | ||||
gList tags ); | ||||
//! add the colorramp to the DB | ||||
/*! | ||||
* \param name is the name of the colorramp as QString | ||||
* \param ramp is the pointer to the new QgsVectorColorRampV2 being sa | ||||
ved | ||||
* \param groupid is the id of the group to which the Color Ramp belon | ||||
gs. Pass 0 if it doesn't belong to any group or not known. | ||||
* \param tags is a list of tags that are associated with the color ra | ||||
mp as a QStringList. | ||||
* \return returns the success state of the save operation | ||||
*/ | ||||
bool saveColorRamp( QString name, QgsVectorColorRampV2* ramp, int group | ||||
id, QStringList tags ); | ||||
//! remove color ramp from style (and delete it) | //! remove color ramp from style (and delete it) | |||
bool removeColorRamp( QString name ); | bool removeColorRamp( QString name ); | |||
//! change ramp's name | //! change ramp's name | |||
//! @note added in v1.7 | //! @note added in v1.7 | |||
bool renameColorRamp( QString oldName, QString newName ); | bool renameColorRamp( QString oldName, QString newName ); | |||
//! return a NEW copy of color ramp | ||||
QgsVectorColorRampV2* colorRamp( QString name ); | ||||
//! return a const pointer to a symbol (doesn't create new instance) | ||||
const QgsVectorColorRampV2* colorRampRef( QString name ) const; | ||||
//! return count of color ramps | ||||
int colorRampCount(); | ||||
//! return a list of names of color ramps | ||||
QStringList colorRampNames(); | ||||
//! load a file into the style | //! load a file into the style | |||
bool load( QString filename ); | bool load( QString filename ); | |||
//! save style into a file (will use current filename if empty string i s passed) | //! save style into a file (will use current filename if empty string i s passed) | |||
bool save( QString filename = QString() ); | bool save( QString filename = QString() ); | |||
//! return last error from load/save operation | //! return last error from load/save operation | |||
QString errorString() { return mErrorString; } | QString errorString() { return mErrorString; } | |||
//! return current file name of the style | //! return current file name of the style | |||
QString fileName() { return mFileName; } | QString fileName() { return mFileName; } | |||
//! return the names of the symbols which have a matching 'substring' i | ||||
n its defintion | ||||
/*! | ||||
* \param type is either SymbolEntity or ColorrampEntity | ||||
* \param qword is the query string to search the symbols or colorramp | ||||
s. | ||||
* \return A QStringList of the matched symbols or colorramps | ||||
* */ | ||||
QStringList findSymbols( StyleEntity type, QString qword ); | ||||
//! return the tags associated with the symbol | ||||
/*! | ||||
* \param type is either SymbolEntity or ColorrampEntity | ||||
* \param symbol is the name of the symbol or color ramp | ||||
* \return A QStringList of the tags that have been applied to that sy | ||||
mbol/colorramp | ||||
*/ | ||||
QStringList tagsOfSymbol( StyleEntity type, QString symbol ); | ||||
//! returns the smart groups map with id as key and name as value | ||||
QgsSymbolGroupMap smartgroupsListMap(); | ||||
//! returns the smart groups list | ||||
QStringList smartgroupNames(); | ||||
//! returns the QgsSmartConditionMap for the given id | ||||
QgsSmartConditionMap smartgroup( int id ); | ||||
//! returns the operator for the smartgroup | ||||
//clumsy implementation TODO create a class for smartgroups | ||||
QString smartgroupOperator( int id ); | ||||
//! returns the symbols for the smartgroup | ||||
QStringList symbolsOfSmartgroup( StyleEntity type, int id ); | ||||
//! Exports the style as a XML file | ||||
bool exportXML( QString filename ); | ||||
//! Imports the symbols and colorramps into the default style database | ||||
from the given XML file | ||||
bool importXML( QString filename ); | ||||
protected: | protected: | |||
QgsSymbolV2Map mSymbols; | QgsSymbolV2Map mSymbols; | |||
QgsVectorColorRampV2Map mColorRamps; | QgsVectorColorRampV2Map mColorRamps; | |||
QString mErrorString; | QString mErrorString; | |||
QString mFileName; | QString mFileName; | |||
sqlite3* mCurrentDB; | ||||
static QgsStyleV2* mDefaultStyle; | static QgsStyleV2* mDefaultStyle; | |||
//! convenience function to open the DB and return a sqlite3 object | ||||
bool openDB( QString filename ); | ||||
//! convenience function that would run queries which don't generate re | ||||
turn values | ||||
//! \param query query to run | ||||
//! \param freeQuery release query memory | ||||
//! \return success true on success | ||||
bool runEmptyQuery( char* query, bool freeQuery = true ); | ||||
//! prepares the complex query for removing a group, so that the childr | ||||
en are not abandoned | ||||
char* getGroupRemoveQuery( int id ); | ||||
//! gets the id from the table for the given name from the database, 0 | ||||
if not found | ||||
int getId( QString table, QString name ); | ||||
//! updates the properties of an existing symbol/colorramp | ||||
/*! | ||||
* \note This should not be called separately, only called through add | ||||
Symbol or addColorRamp | ||||
* \param type is either SymbolEntity or ColorrampEntity | ||||
* \param name is the name of an existing symbol or a color ramp | ||||
* \return Success state of the update operation | ||||
*/ | ||||
bool updateSymbol( StyleEntity type, QString name ); | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 12 change blocks. | ||||
20 lines changed or deleted | 305 lines changed or added | |||
qgsstylev2exportimportdialog.h | qgsstylev2exportimportdialog.h | |||
---|---|---|---|---|
skipping to change at line 21 | skipping to change at line 21 | |||
* it under the terms of the GNU General Public License as published by * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSSTYLEV2EXPORTIMPORTDIALOG_H | #ifndef QGSSTYLEV2EXPORTIMPORTDIALOG_H | |||
#define QGSSTYLEV2EXPORTIMPORTDIALOG_H | #define QGSSTYLEV2EXPORTIMPORTDIALOG_H | |||
#include <QDialog> | #include <QDialog> | |||
#include <QUrl> | ||||
#include <QProgressDialog> | ||||
#include <QTemporaryFile> | ||||
#include <QNetworkAccessManager> | ||||
#include <QNetworkReply> | ||||
#include "ui_qgsstylev2exportimportdialogbase.h" | #include "ui_qgsstylev2exportimportdialogbase.h" | |||
class QgsStyleV2; | class QgsStyleV2; | |||
class QgsStyleV2ExportImportDialog : public QDialog, private Ui::QgsStyleV2 ExportImportDialogBase | class GUI_EXPORT QgsStyleV2ExportImportDialog : public QDialog, private Ui: :QgsStyleV2ExportImportDialogBase | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
enum Mode | enum Mode | |||
{ | { | |||
Export, | Export, | |||
Import | Import | |||
}; | }; | |||
// constructor | // constructor | |||
// mode argument must be 0 for saving and 1 for loading | // mode argument must be 0 for saving and 1 for loading | |||
QgsStyleV2ExportImportDialog( QgsStyleV2* style, QWidget *parent = NULL , Mode mode = Export, QString fileName = "" ); | QgsStyleV2ExportImportDialog( QgsStyleV2* style, QWidget *parent = NULL , Mode mode = Export ); | |||
~QgsStyleV2ExportImportDialog(); | ~QgsStyleV2ExportImportDialog(); | |||
public slots: | public slots: | |||
void doExportImport(); | void doExportImport(); | |||
void selectAll(); | void selectAll(); | |||
void clearSelection(); | void clearSelection(); | |||
void importTypeChanged( int ); | ||||
void browse(); | ||||
private slots: | ||||
void httpFinished(); | ||||
void fileReadyRead(); | ||||
void updateProgress( qint64, qint64 ); | ||||
void downloadCanceled(); | ||||
private: | private: | |||
void downloadStyleXML( QUrl url ); | ||||
bool populateStyles( QgsStyleV2* style ); | bool populateStyles( QgsStyleV2* style ); | |||
void moveStyles( QModelIndexList* selection, QgsStyleV2* src, QgsStyleV 2* dst ); | void moveStyles( QModelIndexList* selection, QgsStyleV2* src, QgsStyleV 2* dst ); | |||
QProgressDialog *mProgressDlg; | ||||
QTemporaryFile *mTempFile; | ||||
QNetworkAccessManager *mNetManager; | ||||
QNetworkReply *mNetReply; | ||||
QString mFileName; | QString mFileName; | |||
Mode mDialogMode; | Mode mDialogMode; | |||
QgsStyleV2* mQgisStyle; | QgsStyleV2* mQgisStyle; | |||
QgsStyleV2* mTempStyle; | QgsStyleV2* mTempStyle; | |||
}; | }; | |||
#endif // QGSSTYLEV2EXPORTIMPORTDIALOG_H | #endif // QGSSTYLEV2EXPORTIMPORTDIALOG_H | |||
End of changes. 6 change blocks. | ||||
2 lines changed or deleted | 22 lines changed or added | |||
qgsstylev2managerdialog.h | qgsstylev2managerdialog.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsstylev2managerdialog.h | qgsstylev2managerdialog.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSSTYLEV2MANAGERDIALOG_H | #ifndef QGSSTYLEV2MANAGERDIALOG_H | |||
#define QGSSTYLEV2MANAGERDIALOG_H | #define QGSSTYLEV2MANAGERDIALOG_H | |||
#include <QDialog> | #include <QDialog> | |||
#include <QStandardItem> | #include <QStandardItem> | |||
#include <QAction> | ||||
#include <QMenu> | ||||
#include "ui_qgsstylev2managerdialogbase.h" | #include "ui_qgsstylev2managerdialogbase.h" | |||
#include "qgscontexthelp.h" | #include "qgscontexthelp.h" | |||
class QgsStyleV2; | class QgsStyleV2; | |||
class GUI_EXPORT QgsStyleV2ManagerDialog : public QDialog, private Ui::QgsS tyleV2ManagerDialogBase | class GUI_EXPORT QgsStyleV2ManagerDialog : public QDialog, private Ui::QgsS tyleV2ManagerDialogBase | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* parent = NULL ); | QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* parent = NULL ); | |||
//! open add color ramp dialog, return color ramp's name if the ramp ha s been added | //! open add color ramp dialog, return color ramp's name if the ramp ha s been added | |||
static QString addColorRampStatic( QWidget* parent, QgsStyleV2* style ) | static QString addColorRampStatic( QWidget* parent, QgsStyleV2* style, | |||
; | QString RampType = QString() ); | |||
public slots: | public slots: | |||
void addItem(); | void addItem(); | |||
void editItem(); | void editItem(); | |||
void removeItem(); | void removeItem(); | |||
void exportItems(); | void exportItems(); | |||
void importItems(); | void importItems(); | |||
void on_tabItemType_currentChanged( int ); | ||||
//! adds symbols of some type to list | //! adds symbols of some type to list | |||
void populateList(); | void populateList(); | |||
//! called when the dialog is going to be closed | //! called when the dialog is going to be closed | |||
void onFinished(); | void onFinished(); | |||
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()-> className() ); } | void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()-> className() ); } | |||
void itemChanged( QStandardItem* item ); | void itemChanged( QStandardItem* item ); | |||
void groupChanged( const QModelIndex& ); | ||||
void groupRenamed( QStandardItem * ); | ||||
void addGroup(); | ||||
void removeGroup(); | ||||
//! carryout symbol grouping using check boxes | ||||
void groupSymbolsAction(); | ||||
//! edit the selected smart group | ||||
void editSmartgroupAction(); | ||||
//! symbol changed from one group | ||||
void regrouped( QStandardItem* ); | ||||
//! filter the symbols based on input search term | ||||
void filterSymbols( QString ); | ||||
//! Listen to tag changes | ||||
void tagsChanged(); | ||||
//! Perform symbol specific tasks when selected | ||||
void symbolSelected( const QModelIndex& ); | ||||
//! Context menu for the groupTree | ||||
void grouptreeContextMenu( const QPoint& ); | ||||
//! Context menu for the listItems ( symbols list ) | ||||
void listitemsContextMenu( const QPoint& ); | ||||
protected slots: | ||||
bool addColorRamp( QAction* action ); | ||||
protected: | protected: | |||
//! populate combo box with known style items (symbols, color ramps) | //! populate combo box with known style items (symbols, color ramps) | |||
void populateTypes(); | void populateTypes(); | |||
//! populate list view with symbols of specified type | //! populate the groups | |||
void populateSymbols( int type ); | void populateGroups(); | |||
//! build the groups tree | ||||
void buildGroupTree( QStandardItem* &parent ); | ||||
//! to set symbols checked when in editing mode | ||||
void setSymbolsChecked( QStringList ); | ||||
//! populate list view with symbols of the current type with the given | ||||
names | ||||
void populateSymbols( QStringList symbolNames, bool checkable = false ) | ||||
; | ||||
//! populate list view with color ramps | //! populate list view with color ramps | |||
void populateColorRamps(); | void populateColorRamps( QStringList colorRamps, bool checkable = false ); | |||
int currentItemType(); | int currentItemType(); | |||
QString currentItemName(); | QString currentItemName(); | |||
//! add a new symbol to style | //! add a new symbol to style | |||
bool addSymbol(); | bool addSymbol(); | |||
//! add a new color ramp to style | //! add a new color ramp to style | |||
bool addColorRamp(); | bool addColorRamp(); | |||
bool editSymbol(); | bool editSymbol(); | |||
bool editColorRamp(); | bool editColorRamp(); | |||
bool removeSymbol(); | bool removeSymbol(); | |||
bool removeColorRamp(); | bool removeColorRamp(); | |||
//! Enables or disbables the symbol specific inputs | ||||
void enableSymbolInputs( bool ); | ||||
//! Enables or disables the groupTree specific inputs | ||||
void enableGroupInputs( bool ); | ||||
//! Enables or diables the groupTree items for grouping mode | ||||
void enableItemsForGroupingMode( bool ); | ||||
//! Event filter to capture tagsLineEdit out of focus | ||||
bool eventFilter( QObject* , QEvent* ); | ||||
//! sets the text of the item with bold font | ||||
void setBold( QStandardItem* ); | ||||
QgsStyleV2* mStyle; | QgsStyleV2* mStyle; | |||
QString mStyleFilename; | QString mStyleFilename; | |||
bool mModified; | bool mModified; | |||
//! Mode to display the symbol list | ||||
bool mGrouppingMode; | ||||
//! space to store symbol tags | ||||
QStringList mTagList; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 9 change blocks. | ||||
6 lines changed or deleted | 71 lines changed or added | |||
qgssymbollayerv2.h | qgssymbollayerv2.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgssymbollayerv2.h | qgssymbollayerv2.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSSYMBOLLAYERV2_H | #ifndef QGSSYMBOLLAYERV2_H | |||
#define QGSSYMBOLLAYERV2_H | #define QGSSYMBOLLAYERV2_H | |||
// MSVC compiler doesn't have defined M_PI in math.h | ||||
#ifndef M_PI | ||||
#define M_PI 3.14159265358979323846 | ||||
#endif | ||||
#define DEG2RAD(x) ((x)*M_PI/180) | ||||
#define DEFAULT_SCALE_METHOD QgsSymbolV2::ScaleArea | ||||
#include <QColor> | #include <QColor> | |||
#include <QMap> | #include <QMap> | |||
#include <QPointF> | #include <QPointF> | |||
#include <QSet> | #include <QSet> | |||
#include <QDomDocument> | #include <QDomDocument> | |||
#include <QDomElement> | #include <QDomElement> | |||
#include "qgssymbolv2.h" | #include "qgssymbolv2.h" | |||
#include "qgssymbollayerv2utils.h" // QgsStringMap | #include "qgssymbollayerv2utils.h" // QgsStringMap | |||
class QPainter; | class QPainter; | |||
class QSize; | class QSize; | |||
class QPolygonF; | class QPolygonF; | |||
class QgsExpression; | ||||
class QgsRenderContext; | class QgsRenderContext; | |||
class CORE_EXPORT QgsSymbolLayerV2 | class CORE_EXPORT QgsSymbolLayerV2 | |||
{ | { | |||
public: | public: | |||
// not necessarily supported by all symbol layers... | // not necessarily supported by all symbol layers... | |||
virtual void setColor( const QColor& color ) { mColor = color; } | virtual void setColor( const QColor& color ) { mColor = color; } | |||
virtual QColor color() const { return mColor; } | virtual QColor color() const { return mColor; } | |||
virtual ~QgsSymbolLayerV2() {} | virtual ~QgsSymbolLayerV2() { removeDataDefinedProperties(); } | |||
virtual QString layerType() const = 0; | virtual QString layerType() const = 0; | |||
virtual void startRender( QgsSymbolV2RenderContext& context ) = 0; | virtual void startRender( QgsSymbolV2RenderContext& context ) = 0; | |||
virtual void stopRender( QgsSymbolV2RenderContext& context ) = 0; | virtual void stopRender( QgsSymbolV2RenderContext& context ) = 0; | |||
virtual QgsSymbolLayerV2* clone() const = 0; | virtual QgsSymbolLayerV2* clone() const = 0; | |||
virtual void toSld( QDomDocument &doc, QDomElement &element, QgsStringM ap props ) const | virtual void toSld( QDomDocument &doc, QDomElement &element, QgsStringM ap props ) const | |||
{ Q_UNUSED( props ); element.appendChild( doc.createComment( QString( " SymbolLayerV2 %1 not implemented yet" ).arg( layerType() ) ) ); } | { Q_UNUSED( props ); element.appendChild( doc.createComment( QString( " SymbolLayerV2 %1 not implemented yet" ).arg( layerType() ) ) ); } | |||
virtual QString ogrFeatureStyle( double mmScaleFactor, double mapUnitSc | ||||
aleFactor ) const { Q_UNUSED( mmScaleFactor ); Q_UNUSED( mapUnitScaleFactor | ||||
); return QString(); } | ||||
virtual QgsStringMap properties() const = 0; | virtual QgsStringMap properties() const = 0; | |||
virtual void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ) = 0; | virtual void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ) = 0; | |||
virtual QgsSymbolV2* subSymbol() { return NULL; } | virtual QgsSymbolV2* subSymbol() { return NULL; } | |||
// set layer's subsymbol. takes ownership of the passed symbol | // set layer's subsymbol. takes ownership of the passed symbol | |||
virtual bool setSubSymbol( QgsSymbolV2* symbol ) { delete symbol; retur n false; } | virtual bool setSubSymbol( QgsSymbolV2* symbol ) { delete symbol; retur n false; } | |||
QgsSymbolV2::SymbolType type() const { return mType; } | QgsSymbolV2::SymbolType type() const { return mType; } | |||
void setLocked( bool locked ) { mLocked = locked; } | void setLocked( bool locked ) { mLocked = locked; } | |||
bool isLocked() const { return mLocked; } | bool isLocked() const { return mLocked; } | |||
virtual void setOutputUnit( QgsSymbolV2::OutputUnit unit ) { Q_UNUSED( | ||||
unit ); } //= 0; | ||||
virtual QgsSymbolV2::OutputUnit outputUnit() const { return QgsSymbolV2 | ||||
::Mixed; } //= 0; | ||||
// used only with rending with symbol levels is turned on (0 = first pa ss, 1 = second, ...) | // used only with rending with symbol levels is turned on (0 = first pa ss, 1 = second, ...) | |||
void setRenderingPass( int renderingPass ) { mRenderingPass = rendering Pass; } | void setRenderingPass( int renderingPass ) { mRenderingPass = rendering Pass; } | |||
int renderingPass() const { return mRenderingPass; } | int renderingPass() const { return mRenderingPass; } | |||
// symbol layers normally only use additional attributes to provide dat a defined settings | // symbol layers normally only use additional attributes to provide dat a defined settings | |||
virtual QSet<QString> usedAttributes() const { return QSet<QString>(); | virtual QSet<QString> usedAttributes() const; | |||
} | ||||
virtual const QgsExpression* dataDefinedProperty( const QString& proper | ||||
ty ) const; | ||||
virtual QString dataDefinedPropertyString( const QString& property ) co | ||||
nst; | ||||
virtual void setDataDefinedProperty( const QString& property, const QSt | ||||
ring& expressionString ); | ||||
virtual void removeDataDefinedProperty( const QString& property ); | ||||
virtual void removeDataDefinedProperties(); | ||||
protected: | protected: | |||
QgsSymbolLayerV2( QgsSymbolV2::SymbolType type, bool locked = false ) | QgsSymbolLayerV2( QgsSymbolV2::SymbolType type, bool locked = false ) | |||
: mType( type ), mLocked( locked ), mRenderingPass( 0 ) {} | : mType( type ), mLocked( locked ), mRenderingPass( 0 ) {} | |||
QgsSymbolV2::SymbolType mType; | QgsSymbolV2::SymbolType mType; | |||
bool mLocked; | bool mLocked; | |||
QColor mColor; | QColor mColor; | |||
int mRenderingPass; | int mRenderingPass; | |||
QMap< QString, QgsExpression* > mDataDefinedProperties; | ||||
// Configuration of selected symbology implementation | // Configuration of selected symbology implementation | |||
static const bool selectionIsOpaque = true; // Selection ignores symbo l alpha | static const bool selectionIsOpaque = true; // Selection ignores symbo l alpha | |||
static const bool selectFillBorder = false; // Fill symbol layer also selects border symbology | static const bool selectFillBorder = false; // Fill symbol layer also selects border symbology | |||
static const bool selectFillStyle = false; // Fill symbol uses symbol layer style.. | static const bool selectFillStyle = false; // Fill symbol uses symbol layer style.. | |||
virtual void prepareExpressions( const QgsVectorLayer* vl ); | ||||
virtual QgsExpression* expression( const QString& property ); | ||||
/**Saves data defined properties to string map*/ | ||||
void saveDataDefinedProperties( QgsStringMap& stringMap ) const; | ||||
/**Copies data defined properties of this layer to another symbol layer | ||||
*/ | ||||
void copyDataDefinedProperties( QgsSymbolLayerV2* destLayer ) const; | ||||
}; | }; | |||
////////////////////// | ////////////////////// | |||
class CORE_EXPORT QgsMarkerSymbolLayerV2 : public QgsSymbolLayerV2 | class CORE_EXPORT QgsMarkerSymbolLayerV2 : public QgsSymbolLayerV2 | |||
{ | { | |||
public: | public: | |||
virtual void renderPoint( const QPointF& point, QgsSymbolV2RenderContex t& context ) = 0; | virtual void renderPoint( const QPointF& point, QgsSymbolV2RenderContex t& context ) = 0; | |||
void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ); | void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ); | |||
void setAngle( double angle ) { mAngle = angle; } | void setAngle( double angle ) { mAngle = angle; } | |||
double angle() const { return mAngle; } | double angle() const { return mAngle; } | |||
void setSize( double size ) { mSize = size; } | void setSize( double size ) { mSize = size; } | |||
double size() const { return mSize; } | double size() const { return mSize; } | |||
void setScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod ) { mScaleMet | ||||
hod = scaleMethod; } | ||||
QgsSymbolV2::ScaleMethod scaleMethod() const { return mScaleMethod; } | ||||
void setOffset( QPointF offset ) { mOffset = offset; } | void setOffset( QPointF offset ) { mOffset = offset; } | |||
QPointF offset() { return mOffset; } | QPointF offset() { return mOffset; } | |||
virtual void toSld( QDomDocument &doc, QDomElement &element, QgsStringM ap props ) const; | virtual void toSld( QDomDocument &doc, QDomElement &element, QgsStringM ap props ) const; | |||
virtual void writeSldMarker( QDomDocument &doc, QDomElement &element, Q gsStringMap props ) const | virtual void writeSldMarker( QDomDocument &doc, QDomElement &element, Q gsStringMap props ) const | |||
{ Q_UNUSED( props ); element.appendChild( doc.createComment( QString( " QgsMarkerSymbolLayerV2 %1 not implemented yet" ).arg( layerType() ) ) ); } | { Q_UNUSED( props ); element.appendChild( doc.createComment( QString( " QgsMarkerSymbolLayerV2 %1 not implemented yet" ).arg( layerType() ) ) ); } | |||
void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit | ||||
; } | ||||
QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | ||||
void setSizeUnit( QgsSymbolV2::OutputUnit unit ) { mSizeUnit = unit; } | ||||
QgsSymbolV2::OutputUnit sizeUnit() const { return mSizeUnit; } | ||||
virtual void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | ||||
virtual QgsSymbolV2::OutputUnit outputUnit() const; | ||||
protected: | protected: | |||
QgsMarkerSymbolLayerV2( bool locked = false ); | QgsMarkerSymbolLayerV2( bool locked = false ); | |||
void markerOffset( QgsSymbolV2RenderContext& context, double& offsetX, | ||||
double& offsetY ); | ||||
static QPointF _rotatedOffset( const QPointF& offset, double angle ); | ||||
double mAngle; | double mAngle; | |||
double mSize; | double mSize; | |||
QgsSymbolV2::OutputUnit mSizeUnit; | ||||
QPointF mOffset; | QPointF mOffset; | |||
QgsSymbolV2::OutputUnit mOffsetUnit; | ||||
QgsSymbolV2::ScaleMethod mScaleMethod; | ||||
}; | }; | |||
class CORE_EXPORT QgsLineSymbolLayerV2 : public QgsSymbolLayerV2 | class CORE_EXPORT QgsLineSymbolLayerV2 : public QgsSymbolLayerV2 | |||
{ | { | |||
public: | public: | |||
virtual void renderPolyline( const QPolygonF& points, QgsSymbolV2Render Context& context ) = 0; | virtual void renderPolyline( const QPolygonF& points, QgsSymbolV2Render Context& context ) = 0; | |||
//! @note added in v1.7 | //! @note added in v1.7 | |||
virtual void renderPolygonOutline( const QPolygonF& points, QList<QPoly gonF>* rings, QgsSymbolV2RenderContext& context ); | virtual void renderPolygonOutline( const QPolygonF& points, QList<QPoly gonF>* rings, QgsSymbolV2RenderContext& context ); | |||
virtual void setWidth( double width ) { mWidth = width; } | virtual void setWidth( double width ) { mWidth = width; } | |||
virtual double width() const { return mWidth; } | virtual double width() const { return mWidth; } | |||
void setWidthUnit( QgsSymbolV2::OutputUnit unit ) { mWidthUnit = unit; | ||||
} | ||||
QgsSymbolV2::OutputUnit widthUnit() const { return mWidthUnit; } | ||||
void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ); | void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ); | |||
protected: | protected: | |||
QgsLineSymbolLayerV2( bool locked = false ); | QgsLineSymbolLayerV2( bool locked = false ); | |||
double mWidth; | double mWidth; | |||
QgsSymbolV2::OutputUnit mWidthUnit; | ||||
}; | }; | |||
class CORE_EXPORT QgsFillSymbolLayerV2 : public QgsSymbolLayerV2 | class CORE_EXPORT QgsFillSymbolLayerV2 : public QgsSymbolLayerV2 | |||
{ | { | |||
public: | public: | |||
virtual void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context ) = 0; | virtual void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context ) = 0; | |||
void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ); | void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ); | |||
void setAngle( double angle ) { mAngle = angle; } | void setAngle( double angle ) { mAngle = angle; } | |||
double angle() const { return mAngle; } | double angle() const { return mAngle; } | |||
protected: | protected: | |||
QgsFillSymbolLayerV2( bool locked = false ); | QgsFillSymbolLayerV2( bool locked = false ); | |||
/**Default method to render polygon*/ | /**Default method to render polygon*/ | |||
void _renderPolygon( QPainter* p, const QPolygonF& points, const QList< QPolygonF>* rings ); | void _renderPolygon( QPainter* p, const QPolygonF& points, const QList< QPolygonF>* rings ); | |||
double mAngle; | double mAngle; | |||
}; | }; | |||
class QgsSymbolLayerV2Widget; | class QgsSymbolLayerV2Widget; // why does SIP fail, when this isn't here | |||
#endif | #endif | |||
End of changes. 17 change blocks. | ||||
5 lines changed or deleted | 65 lines changed or added | |||
qgssymbollayerv2registry.h | qgssymbollayerv2registry.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgssymbollayerv2registry.h | qgssymbollayerv2registry.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSSYMBOLLAYERV2REGISTRY_H | #ifndef QGSSYMBOLLAYERV2REGISTRY_H | |||
skipping to change at line 65 | skipping to change at line 65 | |||
typedef QgsSymbolLayerV2*( *QgsSymbolLayerV2CreateFunc )( const QgsStringMa p& ); | typedef QgsSymbolLayerV2*( *QgsSymbolLayerV2CreateFunc )( const QgsStringMa p& ); | |||
typedef QgsSymbolLayerV2Widget*( *QgsSymbolLayerV2WidgetFunc )( const QgsVe ctorLayer* ); | typedef QgsSymbolLayerV2Widget*( *QgsSymbolLayerV2WidgetFunc )( const QgsVe ctorLayer* ); | |||
typedef QgsSymbolLayerV2*( *QgsSymbolLayerV2CreateFromSldFunc )( QDomElemen t& ); | typedef QgsSymbolLayerV2*( *QgsSymbolLayerV2CreateFromSldFunc )( QDomElemen t& ); | |||
/** | /** | |||
Convenience metadata class that uses static functions to create symbol lay er and its widget. | Convenience metadata class that uses static functions to create symbol lay er and its widget. | |||
*/ | */ | |||
class CORE_EXPORT QgsSymbolLayerV2Metadata : public QgsSymbolLayerV2Abstrac tMetadata | class CORE_EXPORT QgsSymbolLayerV2Metadata : public QgsSymbolLayerV2Abstrac tMetadata | |||
{ | { | |||
public: | public: | |||
//! not available in python bindings | ||||
QgsSymbolLayerV2Metadata( QString name, QString visibleName, | QgsSymbolLayerV2Metadata( QString name, QString visibleName, | |||
QgsSymbolV2::SymbolType type, | QgsSymbolV2::SymbolType type, | |||
QgsSymbolLayerV2CreateFunc pfCreate, | QgsSymbolLayerV2CreateFunc pfCreate, | |||
QgsSymbolLayerV2WidgetFunc pfWidget = NULL ) | QgsSymbolLayerV2WidgetFunc pfWidget = NULL ) | |||
: QgsSymbolLayerV2AbstractMetadata( name, visibleName, type ) | : QgsSymbolLayerV2AbstractMetadata( name, visibleName, type ) | |||
, mCreateFunc( pfCreate ) | , mCreateFunc( pfCreate ) | |||
, mWidgetFunc( pfWidget ) | , mWidgetFunc( pfWidget ) | |||
, mCreateFromSldFunc( NULL ) | , mCreateFromSldFunc( NULL ) | |||
{} | {} | |||
//! not available in python bindings | ||||
QgsSymbolLayerV2Metadata( QString name, QString visibleName, | QgsSymbolLayerV2Metadata( QString name, QString visibleName, | |||
QgsSymbolV2::SymbolType type, | QgsSymbolV2::SymbolType type, | |||
QgsSymbolLayerV2CreateFunc pfCreate, | QgsSymbolLayerV2CreateFunc pfCreate, | |||
QgsSymbolLayerV2CreateFromSldFunc pfCreateFro mSld, | QgsSymbolLayerV2CreateFromSldFunc pfCreateFro mSld, | |||
QgsSymbolLayerV2WidgetFunc pfWidget = NULL ) | QgsSymbolLayerV2WidgetFunc pfWidget = NULL ) | |||
: QgsSymbolLayerV2AbstractMetadata( name, visibleName, type ) | : QgsSymbolLayerV2AbstractMetadata( name, visibleName, type ) | |||
, mCreateFunc( pfCreate ) | , mCreateFunc( pfCreate ) | |||
, mWidgetFunc( pfWidget ) | , mWidgetFunc( pfWidget ) | |||
, mCreateFromSldFunc( pfCreateFromSld ) | , mCreateFromSldFunc( pfCreateFromSld ) | |||
{} | {} | |||
//! not available in python bindings | ||||
QgsSymbolLayerV2CreateFunc createFunction() const { return mCreateFunc; } | QgsSymbolLayerV2CreateFunc createFunction() const { return mCreateFunc; } | |||
//! not available in python bindings | ||||
QgsSymbolLayerV2WidgetFunc widgetFunction() const { return mWidgetFunc; } | QgsSymbolLayerV2WidgetFunc widgetFunction() const { return mWidgetFunc; } | |||
//! not available in python bindings | ||||
QgsSymbolLayerV2CreateFromSldFunc createFromSldFunction() const { retur n mCreateFromSldFunc; } | QgsSymbolLayerV2CreateFromSldFunc createFromSldFunction() const { retur n mCreateFromSldFunc; } | |||
//! not available in python bindings | ||||
void setWidgetFunction( QgsSymbolLayerV2WidgetFunc f ) { mWidgetFunc = f; } | void setWidgetFunction( QgsSymbolLayerV2WidgetFunc f ) { mWidgetFunc = f; } | |||
virtual QgsSymbolLayerV2* createSymbolLayer( const QgsStringMap& map ) { return mCreateFunc ? mCreateFunc( map ) : NULL; } | virtual QgsSymbolLayerV2* createSymbolLayer( const QgsStringMap& map ) { return mCreateFunc ? mCreateFunc( map ) : NULL; } | |||
virtual QgsSymbolLayerV2Widget* createSymbolLayerWidget( const QgsVecto rLayer* vl ) { return mWidgetFunc ? mWidgetFunc( vl ) : NULL; } | virtual QgsSymbolLayerV2Widget* createSymbolLayerWidget( const QgsVecto rLayer* vl ) { return mWidgetFunc ? mWidgetFunc( vl ) : NULL; } | |||
virtual QgsSymbolLayerV2* createSymbolLayerFromSld( QDomElement& elem ) { return mCreateFromSldFunc ? mCreateFromSldFunc( elem ) : NULL; } | virtual QgsSymbolLayerV2* createSymbolLayerFromSld( QDomElement& elem ) { return mCreateFromSldFunc ? mCreateFromSldFunc( elem ) : NULL; } | |||
protected: | protected: | |||
QgsSymbolLayerV2CreateFunc mCreateFunc; | QgsSymbolLayerV2CreateFunc mCreateFunc; | |||
QgsSymbolLayerV2WidgetFunc mWidgetFunc; | QgsSymbolLayerV2WidgetFunc mWidgetFunc; | |||
QgsSymbolLayerV2CreateFromSldFunc mCreateFromSldFunc; | QgsSymbolLayerV2CreateFromSldFunc mCreateFromSldFunc; | |||
End of changes. 7 change blocks. | ||||
1 lines changed or deleted | 7 lines changed or added | |||
qgssymbollayerv2utils.h | qgssymbollayerv2utils.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgssymbollayerv2utils.h | qgssymbollayerv2utils.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSSYMBOLLAYERV2UTILS_H | #ifndef QGSSYMBOLLAYERV2UTILS_H | |||
skipping to change at line 92 | skipping to change at line 92 | |||
static QString encodeSldRealVector( const QVector<qreal>& v ); | static QString encodeSldRealVector( const QVector<qreal>& v ); | |||
static QVector<qreal> decodeSldRealVector( const QString& s ); | static QVector<qreal> decodeSldRealVector( const QString& s ); | |||
static QString encodeOutputUnit( QgsSymbolV2::OutputUnit unit ); | static QString encodeOutputUnit( QgsSymbolV2::OutputUnit unit ); | |||
static QgsSymbolV2::OutputUnit decodeOutputUnit( QString str ); | static QgsSymbolV2::OutputUnit decodeOutputUnit( QString str ); | |||
static QString encodeSldUom( QgsSymbolV2::OutputUnit unit, double *scal eFactor ); | static QString encodeSldUom( QgsSymbolV2::OutputUnit unit, double *scal eFactor ); | |||
static QgsSymbolV2::OutputUnit decodeSldUom( QString str, double *scale Factor ); | static QgsSymbolV2::OutputUnit decodeSldUom( QString str, double *scale Factor ); | |||
static QString encodeScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod | ||||
); | ||||
static QgsSymbolV2::ScaleMethod decodeScaleMethod( QString str ); | ||||
static QIcon symbolPreviewIcon( QgsSymbolV2* symbol, QSize size ); | static QIcon symbolPreviewIcon( QgsSymbolV2* symbol, QSize size ); | |||
static QIcon symbolLayerPreviewIcon( QgsSymbolLayerV2* layer, QgsSymbol V2::OutputUnit u, QSize size ); | static QIcon symbolLayerPreviewIcon( QgsSymbolLayerV2* layer, QgsSymbol V2::OutputUnit u, QSize size ); | |||
static QIcon colorRampPreviewIcon( QgsVectorColorRampV2* ramp, QSize si ze ); | static QIcon colorRampPreviewIcon( QgsVectorColorRampV2* ramp, QSize si ze ); | |||
static void drawStippledBackround( QPainter* painter, QRect rect ); | ||||
static QPixmap symbolPreviewPixmap( QgsSymbolV2* symbol, QSize size ); | static QPixmap symbolPreviewPixmap( QgsSymbolV2* symbol, QSize size ); | |||
static QPixmap colorRampPreviewPixmap( QgsVectorColorRampV2* ramp, QSiz e size ); | static QPixmap colorRampPreviewPixmap( QgsVectorColorRampV2* ramp, QSiz e size ); | |||
static QgsSymbolV2* loadSymbol( QDomElement& element ); | static QgsSymbolV2* loadSymbol( QDomElement& element ); | |||
static QgsSymbolLayerV2* loadSymbolLayer( QDomElement& element ); | static QgsSymbolLayerV2* loadSymbolLayer( QDomElement& element ); | |||
static QDomElement saveSymbol( QString name, QgsSymbolV2* symbol, QDomD ocument& doc, QgsSymbolV2Map* subSymbols = NULL ); | static QDomElement saveSymbol( QString symbolName, QgsSymbolV2* symbol, QDomDocument& doc ); | |||
static bool createSymbolLayerV2ListFromSld( QDomElement& element, QGis: :GeometryType geomType, QgsSymbolLayerV2List &layers ); | static bool createSymbolLayerV2ListFromSld( QDomElement& element, QGis: :GeometryType geomType, QgsSymbolLayerV2List &layers ); | |||
static QgsSymbolLayerV2* createFillLayerFromSld( QDomElement &element ) ; | static QgsSymbolLayerV2* createFillLayerFromSld( QDomElement &element ) ; | |||
static QgsSymbolLayerV2* createLineLayerFromSld( QDomElement &element ) ; | static QgsSymbolLayerV2* createLineLayerFromSld( QDomElement &element ) ; | |||
static QgsSymbolLayerV2* createMarkerLayerFromSld( QDomElement &element ); | static QgsSymbolLayerV2* createMarkerLayerFromSld( QDomElement &element ); | |||
static bool convertPolygonSymbolizerToPointMarker( QDomElement &element , QgsSymbolLayerV2List &layerList ); | static bool convertPolygonSymbolizerToPointMarker( QDomElement &element , QgsSymbolLayerV2List &layerList ); | |||
static bool hasExternalGraphic( QDomElement &element ); | static bool hasExternalGraphic( QDomElement &element ); | |||
static bool hasWellKnownMark( QDomElement &element ); | static bool hasWellKnownMark( QDomElement &element ); | |||
skipping to change at line 126 | skipping to change at line 131 | |||
static bool needMarkerLine( QDomElement &element ); | static bool needMarkerLine( QDomElement &element ); | |||
static bool needLinePatternFill( QDomElement &element ); | static bool needLinePatternFill( QDomElement &element ); | |||
static bool needPointPatternFill( QDomElement &element ); | static bool needPointPatternFill( QDomElement &element ); | |||
static bool needSvgFill( QDomElement &element ); | static bool needSvgFill( QDomElement &element ); | |||
static void fillToSld( QDomDocument &doc, QDomElement &element, | static void fillToSld( QDomDocument &doc, QDomElement &element, | |||
Qt::BrushStyle brushStyle, QColor color = QColor () ); | Qt::BrushStyle brushStyle, QColor color = QColor () ); | |||
static bool fillFromSld( QDomElement &element, | static bool fillFromSld( QDomElement &element, | |||
Qt::BrushStyle &brushStyle, QColor &color ); | Qt::BrushStyle &brushStyle, QColor &color ); | |||
//! @note not available in python bindings | ||||
static void lineToSld( QDomDocument &doc, QDomElement &element, | static void lineToSld( QDomDocument &doc, QDomElement &element, | |||
Qt::PenStyle penStyle, QColor color, double widt h = -1, | Qt::PenStyle penStyle, QColor color, double widt h = -1, | |||
const Qt::PenJoinStyle *penJoinStyle = 0, const Qt::PenCapStyle *penCapStyle = 0, | const Qt::PenJoinStyle *penJoinStyle = 0, const Qt::PenCapStyle *penCapStyle = 0, | |||
const QVector<qreal> *customDashPattern = 0, dou ble dashOffset = 0.0 ); | const QVector<qreal> *customDashPattern = 0, dou ble dashOffset = 0.0 ); | |||
static bool lineFromSld( QDomElement &element, | static bool lineFromSld( QDomElement &element, | |||
Qt::PenStyle &penStyle, QColor &color, double &width, | Qt::PenStyle &penStyle, QColor &color, double &width, | |||
Qt::PenJoinStyle *penJoinStyle = 0, Qt::PenCap Style *penCapStyle = 0, | Qt::PenJoinStyle *penJoinStyle = 0, Qt::PenCap Style *penCapStyle = 0, | |||
QVector<qreal> *customDashPattern = 0, double *dashOffset = 0 ); | QVector<qreal> *customDashPattern = 0, double *dashOffset = 0 ); | |||
static void externalGraphicToSld( QDomDocument &doc, QDomElement &eleme nt, | static void externalGraphicToSld( QDomDocument &doc, QDomElement &eleme nt, | |||
skipping to change at line 159 | skipping to change at line 165 | |||
static void externalMarkerToSld( QDomDocument &doc, QDomElement &elemen t, | static void externalMarkerToSld( QDomDocument &doc, QDomElement &elemen t, | |||
QString path, QString format, int *mar kIndex = 0, | QString path, QString format, int *mar kIndex = 0, | |||
QColor color = QColor(), double size = -1 ); | QColor color = QColor(), double size = -1 ); | |||
static bool externalMarkerFromSld( QDomElement &element, | static bool externalMarkerFromSld( QDomElement &element, | |||
QString &path, QString &format, int &markIndex, | QString &path, QString &format, int &markIndex, | |||
QColor &color, double &size ); | QColor &color, double &size ); | |||
static void labelTextToSld( QDomDocument &doc, QDomElement &element, QS tring label, | static void labelTextToSld( QDomDocument &doc, QDomElement &element, QS tring label, | |||
QFont font, QColor color = QColor(), double size = -1 ); | QFont font, QColor color = QColor(), double size = -1 ); | |||
/**Create ogr feature style string for pen */ | ||||
static QString ogrFeatureStylePen( double width, double mmScaleFactor, | ||||
double mapUnitsScaleFactor, const QColor& c, | ||||
Qt::PenJoinStyle joinStyle = Qt::Mit | ||||
erJoin, | ||||
Qt::PenCapStyle capStyle = Qt::FlatC | ||||
ap, | ||||
double offset = 0.0, | ||||
const QVector<qreal>* dashPattern = | ||||
0 ); | ||||
/**Create ogr feature style string for brush | ||||
@param fillColr fill color*/ | ||||
static QString ogrFeatureStyleBrush( const QColor& fillColr ); | ||||
static void createRotationElement( QDomDocument &doc, QDomElement &elem ent, QString rotationFunc ); | static void createRotationElement( QDomDocument &doc, QDomElement &elem ent, QString rotationFunc ); | |||
static bool rotationFromSldElement( QDomElement &element, QString &rota tionFunc ); | static bool rotationFromSldElement( QDomElement &element, QString &rota tionFunc ); | |||
static void createOpacityElement( QDomDocument &doc, QDomElement &eleme nt, QString alphaFunc ); | static void createOpacityElement( QDomDocument &doc, QDomElement &eleme nt, QString alphaFunc ); | |||
static bool opacityFromSldElement( QDomElement &element, QString &alpha Func ); | static bool opacityFromSldElement( QDomElement &element, QString &alpha Func ); | |||
static void createDisplacementElement( QDomDocument &doc, QDomElement & element, QPointF offset ); | static void createDisplacementElement( QDomDocument &doc, QDomElement & element, QPointF offset ); | |||
static bool displacementFromSldElement( QDomElement &element, QPointF & offset ); | static bool displacementFromSldElement( QDomElement &element, QPointF & offset ); | |||
static void createOnlineResourceElement( QDomDocument &doc, QDomElement &element, QString path, QString format ); | static void createOnlineResourceElement( QDomDocument &doc, QDomElement &element, QString path, QString format ); | |||
skipping to change at line 194 | skipping to change at line 210 | |||
static void saveProperties( QgsStringMap props, QDomDocument& doc, QDom Element& element ); | static void saveProperties( QgsStringMap props, QDomDocument& doc, QDom Element& element ); | |||
static QgsSymbolV2Map loadSymbols( QDomElement& element ); | static QgsSymbolV2Map loadSymbols( QDomElement& element ); | |||
static QDomElement saveSymbols( QgsSymbolV2Map& symbols, QString tagNam e, QDomDocument& doc ); | static QDomElement saveSymbols( QgsSymbolV2Map& symbols, QString tagNam e, QDomDocument& doc ); | |||
static void clearSymbolMap( QgsSymbolV2Map& symbols ); | static void clearSymbolMap( QgsSymbolV2Map& symbols ); | |||
static QgsVectorColorRampV2* loadColorRamp( QDomElement& element ); | static QgsVectorColorRampV2* loadColorRamp( QDomElement& element ); | |||
static QDomElement saveColorRamp( QString name, QgsVectorColorRampV2* r amp, QDomDocument& doc ); | static QDomElement saveColorRamp( QString name, QgsVectorColorRampV2* r amp, QDomDocument& doc ); | |||
/** parse color definition with format "rgb(0,0,0)" or "0,0,0" */ | ||||
static QColor parseColor( QString colorStr ); | ||||
/**Returns the line width scale factor depending on the unit and the pa int device*/ | /**Returns the line width scale factor depending on the unit and the pa int device*/ | |||
static double lineWidthScaleFactor( QgsRenderContext& c, QgsSymbolV2::O utputUnit u ); | static double lineWidthScaleFactor( const QgsRenderContext& c, QgsSymbo lV2::OutputUnit u ); | |||
/**Returns scale factor painter units -> pixel dimensions*/ | /**Returns scale factor painter units -> pixel dimensions*/ | |||
static double pixelSizeScaleFactor( QgsRenderContext& c, QgsSymbolV2::O utputUnit u ); | static double pixelSizeScaleFactor( const QgsRenderContext& c, QgsSymbo lV2::OutputUnit u ); | |||
/**Creates a render context for a pixel based device*/ | /**Creates a render context for a pixel based device*/ | |||
static QgsRenderContext createRenderContext( QPainter* p ); | static QgsRenderContext createRenderContext( QPainter* p ); | |||
/**Multiplies opacity of image pixel values with a (global) transparenc y value*/ | /**Multiplies opacity of image pixel values with a (global) transparenc y value*/ | |||
static void multiplyImageOpacity( QImage* image, qreal alpha ); | static void multiplyImageOpacity( QImage* image, qreal alpha ); | |||
/** Blurs an image in place, e.g. creating Qt-independent drop shadows | ||||
* @note added in 1.9 | ||||
*/ | ||||
static void blurImageInPlace( QImage& image, const QRect& rect, int rad | ||||
ius, bool alphaOnly ); | ||||
/**Sorts the passed list in requested order*/ | /**Sorts the passed list in requested order*/ | |||
static void sortVariantList( QList<QVariant>& list, Qt::SortOrder order ); | static void sortVariantList( QList<QVariant>& list, Qt::SortOrder order ); | |||
/**Returns a point on the line from startPoint to directionPoint that i s a certain distance away from the starting point*/ | /**Returns a point on the line from startPoint to directionPoint that i s a certain distance away from the starting point*/ | |||
static QPointF pointOnLineWithDistance( const QPointF& startPoint, cons t QPointF& directionPoint, double distance ); | static QPointF pointOnLineWithDistance( const QPointF& startPoint, cons t QPointF& directionPoint, double distance ); | |||
//! Return a list of all available svg files | ||||
static QStringList listSvgFiles(); | ||||
//! Return a list of svg files at the specified directory | ||||
static QStringList listSvgFilesAt( QString directory ); | ||||
//! Get symbol's path from its name | ||||
static QString symbolNameToPath( QString name ); | ||||
//! Get symbols's name from its path | ||||
static QString symbolPathToName( QString path ); | ||||
}; | }; | |||
class QPolygonF; | class QPolygonF; | |||
//! calculate line shifted by a specified distance | //! calculate line shifted by a specified distance | |||
QPolygonF offsetLine( QPolygonF polyline, double dist ); | QPolygonF offsetLine( QPolygonF polyline, double dist ); | |||
#endif | #endif | |||
End of changes. 11 change blocks. | ||||
4 lines changed or deleted | 46 lines changed or added | |||
qgssymbollayerv2widget.h | qgssymbollayerv2widget.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgssymbollayerv2widget.h - symbol layer widgets | qgssymbollayerv2widget.h - symbol layer widgets | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSSYMBOLLAYERV2WIDGET_H | #ifndef QGSSYMBOLLAYERV2WIDGET_H | |||
skipping to change at line 64 | skipping to change at line 64 | |||
QgsSimpleLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* pa rent = NULL ); | QgsSimpleLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* pa rent = NULL ); | |||
static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsSimpleLineSymbolLayerV2Widget( vl ); } | static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsSimpleLineSymbolLayerV2Widget( vl ); } | |||
// from base class | // from base class | |||
virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |||
virtual QgsSymbolLayerV2* symbolLayer(); | virtual QgsSymbolLayerV2* symbolLayer(); | |||
public slots: | public slots: | |||
void penWidthChanged(); | void penWidthChanged(); | |||
void colorChanged(); | void colorChanged( const QColor& color ); | |||
void penStyleChanged(); | void penStyleChanged(); | |||
void offsetChanged(); | void offsetChanged(); | |||
void on_mCustomCheckBox_stateChanged( int state ); | void on_mCustomCheckBox_stateChanged( int state ); | |||
void on_mChangePatternButton_clicked(); | void on_mChangePatternButton_clicked(); | |||
void on_mPenWidthUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mOffsetUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mDashPatternUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mDataDefinedPropertiesButton_clicked(); | ||||
protected: | protected: | |||
QgsSimpleLineSymbolLayerV2* mLayer; | QgsSimpleLineSymbolLayerV2* mLayer; | |||
//creates a new icon for the 'change pattern' button | //creates a new icon for the 'change pattern' button | |||
void updatePatternIcon(); | void updatePatternIcon(); | |||
}; | }; | |||
/////////// | /////////// | |||
skipping to change at line 98 | skipping to change at line 102 | |||
QgsSimpleMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL ); | QgsSimpleMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL ); | |||
static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsSimpleMarkerSymbolLayerV2Widget( vl ); } | static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsSimpleMarkerSymbolLayerV2Widget( vl ); } | |||
// from base class | // from base class | |||
virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |||
virtual QgsSymbolLayerV2* symbolLayer(); | virtual QgsSymbolLayerV2* symbolLayer(); | |||
public slots: | public slots: | |||
void setName(); | void setName(); | |||
void setColorBorder(); | void setColorBorder( const QColor& color ); | |||
void setColorFill(); | void setColorFill( const QColor& color ); | |||
void setSize(); | void setSize(); | |||
void setAngle(); | void setAngle(); | |||
void setOffset(); | void setOffset(); | |||
void on_mSizeUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mOffsetUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mOutlineWidthUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mDataDefinedPropertiesButton_clicked(); | ||||
void on_mOutlineWidthSpinBox_valueChanged( double d ); | ||||
protected: | protected: | |||
QgsSimpleMarkerSymbolLayerV2* mLayer; | QgsSimpleMarkerSymbolLayerV2* mLayer; | |||
}; | }; | |||
/////////// | /////////// | |||
#include "ui_widget_simplefill.h" | #include "ui_widget_simplefill.h" | |||
class QgsSimpleFillSymbolLayerV2; | class QgsSimpleFillSymbolLayerV2; | |||
skipping to change at line 128 | skipping to change at line 137 | |||
public: | public: | |||
QgsSimpleFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* pa rent = NULL ); | QgsSimpleFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* pa rent = NULL ); | |||
static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsSimpleFillSymbolLayerV2Widget( vl ); } | static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsSimpleFillSymbolLayerV2Widget( vl ); } | |||
// from base class | // from base class | |||
virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |||
virtual QgsSymbolLayerV2* symbolLayer(); | virtual QgsSymbolLayerV2* symbolLayer(); | |||
public slots: | public slots: | |||
void setColor(); | void setColor( const QColor& color ); | |||
void setBorderColor(); | void setBorderColor( const QColor& color ); | |||
void setBrushStyle(); | void setBrushStyle(); | |||
void borderWidthChanged(); | void borderWidthChanged(); | |||
void borderStyleChanged(); | void borderStyleChanged(); | |||
void offsetChanged(); | void offsetChanged(); | |||
void on_mBorderWidthUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mOffsetUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mDataDefinedPropertiesButton_clicked(); | ||||
protected: | protected: | |||
QgsSimpleFillSymbolLayerV2* mLayer; | QgsSimpleFillSymbolLayerV2* mLayer; | |||
}; | }; | |||
/////////// | /////////// | |||
#include "ui_widget_markerline.h" | #include "ui_widget_markerline.h" | |||
class QgsMarkerLineSymbolLayerV2; | class QgsMarkerLineSymbolLayerV2; | |||
skipping to change at line 161 | skipping to change at line 173 | |||
static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsMarkerLineSymbolLayerV2Widget( vl ); } | static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsMarkerLineSymbolLayerV2Widget( vl ); } | |||
// from base class | // from base class | |||
virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |||
virtual QgsSymbolLayerV2* symbolLayer(); | virtual QgsSymbolLayerV2* symbolLayer(); | |||
public slots: | public slots: | |||
void setInterval( double val ); | void setInterval( double val ); | |||
void setMarker(); | ||||
void setRotate(); | void setRotate(); | |||
void setOffset(); | void setOffset(); | |||
void setPlacement(); | void setPlacement(); | |||
void on_mIntervalUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mOffsetUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mDataDefinedPropertiesButton_clicked(); | ||||
protected: | protected: | |||
void updateMarker(); | ||||
QgsMarkerLineSymbolLayerV2* mLayer; | QgsMarkerLineSymbolLayerV2* mLayer; | |||
}; | }; | |||
/////////// | /////////// | |||
#include "ui_widget_svgmarker.h" | #include "ui_widget_svgmarker.h" | |||
class QgsSvgMarkerSymbolLayerV2; | class QgsSvgMarkerSymbolLayerV2; | |||
class GUI_EXPORT QgsSvgMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2W idget, private Ui::WidgetSvgMarker | class GUI_EXPORT QgsSvgMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2W idget, private Ui::WidgetSvgMarker | |||
skipping to change at line 194 | skipping to change at line 206 | |||
QgsSvgMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* par ent = NULL ); | QgsSvgMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* par ent = NULL ); | |||
static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsSvgMarkerSymbolLayerV2Widget( vl ); } | static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsSvgMarkerSymbolLayerV2Widget( vl ); } | |||
// from base class | // from base class | |||
virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |||
virtual QgsSymbolLayerV2* symbolLayer(); | virtual QgsSymbolLayerV2* symbolLayer(); | |||
public slots: | public slots: | |||
void setName( const QModelIndex& idx ); | void setName( const QModelIndex& idx ); | |||
void populateIcons( const QModelIndex& idx ); | ||||
void setSize(); | void setSize(); | |||
void setAngle(); | void setAngle(); | |||
void setOffset(); | void setOffset(); | |||
void on_mFileToolButton_clicked(); | void on_mFileToolButton_clicked(); | |||
void on_mFileLineEdit_textEdited( const QString& text ); | void on_mFileLineEdit_textEdited( const QString& text ); | |||
void on_mChangeColorButton_clicked(); | void on_mFileLineEdit_editingFinished(); | |||
void on_mChangeBorderColorButton_clicked(); | void on_mChangeColorButton_colorChanged( const QColor& color ); | |||
void on_mChangeBorderColorButton_colorChanged( const QColor& color ); | ||||
void on_mBorderWidthSpinBox_valueChanged( double d ); | void on_mBorderWidthSpinBox_valueChanged( double d ); | |||
void on_mSizeUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mBorderWidthUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mOffsetUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mDataDefinedPropertiesButton_clicked(); | ||||
protected: | protected: | |||
void populateList(); | void populateList(); | |||
//update gui for svg file (insert new path, update activation of gui el ements for svg params) | //update gui for svg file (insert new path, update activation of gui el ements for svg params) | |||
void setGuiForSvg( const QgsSvgMarkerSymbolLayerV2* layer ); | void setGuiForSvg( const QgsSvgMarkerSymbolLayerV2* layer ); | |||
QgsSvgMarkerSymbolLayerV2* mLayer; | QgsSvgMarkerSymbolLayerV2* mLayer; | |||
}; | }; | |||
/////////// | /////////// | |||
#include "ui_widget_linedecoration.h" | ||||
class QgsLineDecorationSymbolLayerV2; | ||||
class GUI_EXPORT QgsLineDecorationSymbolLayerV2Widget : public QgsSymbolLay | ||||
erV2Widget, private Ui::WidgetLineDecoration | ||||
{ | ||||
Q_OBJECT | ||||
public: | ||||
QgsLineDecorationSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget | ||||
* parent = NULL ); | ||||
static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret | ||||
urn new QgsLineDecorationSymbolLayerV2Widget( vl ); } | ||||
// from base class | ||||
virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | ||||
virtual QgsSymbolLayerV2* symbolLayer(); | ||||
public slots: | ||||
void colorChanged(); | ||||
void penWidthChanged(); | ||||
protected: | ||||
QgsLineDecorationSymbolLayerV2* mLayer; | ||||
}; | ||||
////////// | ||||
#include "ui_widget_svgfill.h" | #include "ui_widget_svgfill.h" | |||
class QgsSVGFillSymbolLayer; | class QgsSVGFillSymbolLayer; | |||
class GUI_EXPORT QgsSVGFillSymbolLayerWidget : public QgsSymbolLayerV2Widge t, private Ui::WidgetSVGFill | class GUI_EXPORT QgsSVGFillSymbolLayerWidget : public QgsSymbolLayerV2Widge t, private Ui::WidgetSVGFill | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsSVGFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL ); | QgsSVGFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL ); | |||
static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsSVGFillSymbolLayerWidget( vl ); } | static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsSVGFillSymbolLayerWidget( vl ); } | |||
// from base class | // from base class | |||
virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |||
virtual QgsSymbolLayerV2* symbolLayer(); | virtual QgsSymbolLayerV2* symbolLayer(); | |||
protected: | protected: | |||
QgsSVGFillSymbolLayer* mLayer; | QgsSVGFillSymbolLayer* mLayer; | |||
//sets new output unit. Is called on combo box or spin box change | ||||
void setOutputUnit(); | ||||
void insertIcons(); | void insertIcons(); | |||
void updateOutlineIcon(); | ||||
void updateParamGui(); | void updateParamGui(); | |||
private slots: | private slots: | |||
void on_mBrowseToolButton_clicked(); | void on_mBrowseToolButton_clicked(); | |||
void on_mTextureWidthSpinBox_valueChanged( double d ); | void on_mTextureWidthSpinBox_valueChanged( double d ); | |||
void on_mSVGLineEdit_textChanged( const QString & text ); | void on_mSVGLineEdit_textEdited( const QString & text ); | |||
void on_mSVGLineEdit_editingFinished(); | ||||
void setFile( const QModelIndex& item ); | void setFile( const QModelIndex& item ); | |||
void on_mChangeOutlinePushButton_clicked(); | void populateIcons( const QModelIndex& item ); | |||
void on_mRotationSpinBox_valueChanged( double d ); | void on_mRotationSpinBox_valueChanged( double d ); | |||
void on_mChangeColorButton_clicked(); | void on_mChangeColorButton_colorChanged( const QColor& color ); | |||
void on_mChangeBorderColorButton_clicked(); | void on_mChangeBorderColorButton_colorChanged( const QColor& color ); | |||
void on_mBorderWidthSpinBox_valueChanged( double d ); | void on_mBorderWidthSpinBox_valueChanged( double d ); | |||
void on_mTextureWidthUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mSvgOutlineWidthUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mDataDefinedPropertiesButton_clicked(); | ||||
}; | }; | |||
////////// | ////////// | |||
#include "ui_widget_linepatternfill.h" | #include "ui_widget_linepatternfill.h" | |||
class QgsLinePatternFillSymbolLayer; | class QgsLinePatternFillSymbolLayer; | |||
class GUI_EXPORT QgsLinePatternFillSymbolLayerWidget : public QgsSymbolLaye rV2Widget, private Ui::WidgetLinePatternFill | class GUI_EXPORT QgsLinePatternFillSymbolLayerWidget : public QgsSymbolLaye rV2Widget, private Ui::WidgetLinePatternFill | |||
{ | { | |||
skipping to change at line 304 | skipping to change at line 296 | |||
virtual QgsSymbolLayerV2* symbolLayer(); | virtual QgsSymbolLayerV2* symbolLayer(); | |||
protected: | protected: | |||
QgsLinePatternFillSymbolLayer* mLayer; | QgsLinePatternFillSymbolLayer* mLayer; | |||
private slots: | private slots: | |||
void on_mAngleSpinBox_valueChanged( double d ); | void on_mAngleSpinBox_valueChanged( double d ); | |||
void on_mDistanceSpinBox_valueChanged( double d ); | void on_mDistanceSpinBox_valueChanged( double d ); | |||
void on_mLineWidthSpinBox_valueChanged( double d ); | void on_mLineWidthSpinBox_valueChanged( double d ); | |||
void on_mOffsetSpinBox_valueChanged( double d ); | void on_mOffsetSpinBox_valueChanged( double d ); | |||
void on_mColorPushButton_clicked(); | void on_mColorPushButton_colorChanged( const QColor& color ); | |||
void on_mOutlinePushButton_clicked(); | void on_mDistanceUnitComboBox_currentIndexChanged( int index ); | |||
void on_mLineWidthUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mOffsetUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mDataDefinedPropertiesButton_clicked(); | ||||
}; | }; | |||
////////// | ////////// | |||
#include "ui_widget_pointpatternfill.h" | #include "ui_widget_pointpatternfill.h" | |||
class QgsPointPatternFillSymbolLayer; | class QgsPointPatternFillSymbolLayer; | |||
class GUI_EXPORT QgsPointPatternFillSymbolLayerWidget: public QgsSymbolLaye rV2Widget, private Ui::WidgetPointPatternFill | class GUI_EXPORT QgsPointPatternFillSymbolLayerWidget: public QgsSymbolLaye rV2Widget, private Ui::WidgetPointPatternFill | |||
{ | { | |||
skipping to change at line 327 | skipping to change at line 322 | |||
public: | public: | |||
QgsPointPatternFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget * parent = NULL ); | QgsPointPatternFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget * parent = NULL ); | |||
static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsPointPatternFillSymbolLayerWidget( vl ); } | static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsPointPatternFillSymbolLayerWidget( vl ); } | |||
virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |||
virtual QgsSymbolLayerV2* symbolLayer(); | virtual QgsSymbolLayerV2* symbolLayer(); | |||
protected: | protected: | |||
QgsPointPatternFillSymbolLayer* mLayer; | QgsPointPatternFillSymbolLayer* mLayer; | |||
void updateMarkerIcon(); | ||||
private slots: | private slots: | |||
void on_mHorizontalDistanceSpinBox_valueChanged( double d ); | void on_mHorizontalDistanceSpinBox_valueChanged( double d ); | |||
void on_mVerticalDistanceSpinBox_valueChanged( double d ); | void on_mVerticalDistanceSpinBox_valueChanged( double d ); | |||
void on_mHorizontalDisplacementSpinBox_valueChanged( double d ); | void on_mHorizontalDisplacementSpinBox_valueChanged( double d ); | |||
void on_mVerticalDisplacementSpinBox_valueChanged( double d ); | void on_mVerticalDisplacementSpinBox_valueChanged( double d ); | |||
void on_mChangeMarkerButton_clicked(); | void on_mHorizontalDistanceUnitComboBox_currentIndexChanged( int index | |||
); | ||||
void on_mVerticalDistanceUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mHorizontalDisplacementUnitComboBox_currentIndexChanged( int in | ||||
dex ); | ||||
void on_mVerticalDisplacementUnitComboBox_currentIndexChanged( int inde | ||||
x ); | ||||
void on_mDataDefinedPropertiesButton_clicked(); | ||||
}; | }; | |||
///////// | ///////// | |||
#include "ui_widget_fontmarker.h" | #include "ui_widget_fontmarker.h" | |||
class QgsFontMarkerSymbolLayerV2; | class QgsFontMarkerSymbolLayerV2; | |||
class CharacterWidget; | class CharacterWidget; | |||
class GUI_EXPORT QgsFontMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2 Widget, private Ui::WidgetFontMarker | class GUI_EXPORT QgsFontMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2 Widget, private Ui::WidgetFontMarker | |||
skipping to change at line 359 | skipping to change at line 357 | |||
QgsFontMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* pa rent = NULL ); | QgsFontMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* pa rent = NULL ); | |||
static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsFontMarkerSymbolLayerV2Widget( vl ); } | static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsFontMarkerSymbolLayerV2Widget( vl ); } | |||
// from base class | // from base class | |||
virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |||
virtual QgsSymbolLayerV2* symbolLayer(); | virtual QgsSymbolLayerV2* symbolLayer(); | |||
public slots: | public slots: | |||
void setFontFamily( const QFont& font ); | void setFontFamily( const QFont& font ); | |||
void setColor(); | void setColor( const QColor& color ); | |||
void setSize( double size ); | void setSize( double size ); | |||
void setAngle( double angle ); | void setAngle( double angle ); | |||
void setCharacter( const QChar& chr ); | void setCharacter( const QChar& chr ); | |||
void setOffset(); | void setOffset(); | |||
void on_mSizeUnitComboBox_currentIndexChanged( int index ); | ||||
void on_mOffsetUnitComboBox_currentIndexChanged( int index ); | ||||
protected: | protected: | |||
QgsFontMarkerSymbolLayerV2* mLayer; | QgsFontMarkerSymbolLayerV2* mLayer; | |||
CharacterWidget* widgetChar; | CharacterWidget* widgetChar; | |||
}; | }; | |||
////////// | ////////// | |||
#include "ui_widget_centroidfill.h" | #include "ui_widget_centroidfill.h" | |||
skipping to change at line 389 | skipping to change at line 389 | |||
public: | public: | |||
QgsCentroidFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL ); | QgsCentroidFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL ); | |||
static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsCentroidFillSymbolLayerV2Widget( vl ); } | static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsCentroidFillSymbolLayerV2Widget( vl ); } | |||
// from base class | // from base class | |||
virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |||
virtual QgsSymbolLayerV2* symbolLayer(); | virtual QgsSymbolLayerV2* symbolLayer(); | |||
public slots: | ||||
void setMarker(); | ||||
protected: | protected: | |||
void updateMarker(); | ||||
QgsCentroidFillSymbolLayerV2* mLayer; | QgsCentroidFillSymbolLayerV2* mLayer; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 27 change blocks. | ||||
58 lines changed or deleted | 53 lines changed or added | |||
qgssymbollevelsv2dialog.h | qgssymbollevelsv2dialog.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgssymbollevelsv2dialog.h | qgssymbollevelsv2dialog.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSSYMBOLLEVELSV2DIALOG_H | #ifndef QGSSYMBOLLEVELSV2DIALOG_H | |||
#define QGSSYMBOLLEVELSV2DIALOG_H | #define QGSSYMBOLLEVELSV2DIALOG_H | |||
skipping to change at line 29 | skipping to change at line 29 | |||
#include <QList> | #include <QList> | |||
#include "qgsrendererv2.h" | #include "qgsrendererv2.h" | |||
#include "ui_qgssymbollevelsv2dialogbase.h" | #include "ui_qgssymbollevelsv2dialogbase.h" | |||
class GUI_EXPORT QgsSymbolLevelsV2Dialog : public QDialog, private Ui::QgsS ymbolLevelsV2DialogBase | class GUI_EXPORT QgsSymbolLevelsV2Dialog : public QDialog, private Ui::QgsS ymbolLevelsV2DialogBase | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
// @note not available in python bindings | ||||
QgsSymbolLevelsV2Dialog( QgsLegendSymbolList list, bool usingSymbolLeve ls, QWidget* parent = NULL ); | QgsSymbolLevelsV2Dialog( QgsLegendSymbolList list, bool usingSymbolLeve ls, QWidget* parent = NULL ); | |||
bool usingLevels() const; | bool usingLevels() const; | |||
// used by rule-based renderer (to hide checkbox to enable/disable orde ring) | // used by rule-based renderer (to hide checkbox to enable/disable orde ring) | |||
void setForceOrderingEnabled( bool enabled ); | void setForceOrderingEnabled( bool enabled ); | |||
public slots: | public slots: | |||
void updateUi(); | void updateUi(); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
qgssymbologyv2conversion.h | qgssymbologyv2conversion.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgssymbologyv2conversion.h | qgssymbologyv2conversion.h | |||
--------------------- | --------------------- | |||
begin : December 2009 | begin : December 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSSYMBOLOGYV2CONVERSION_H | #ifndef QGSSYMBOLOGYV2CONVERSION_H | |||
#define QGSSYMBOLOGYV2CONVERSION_H | #define QGSSYMBOLOGYV2CONVERSION_H | |||
class QgsSymbol; | class QDomNode; | |||
class QgsSymbolV2; | ||||
class QgsVectorLayer; | ||||
class QgsFeatureRendererV2; | ||||
#include "qgis.h" | ||||
#include <Qt> | ||||
/** This class is not a part of public API, it is intended only for compati | ||||
bility with older versions of QGIS (1.x) */ | ||||
class CORE_EXPORT QgsSymbologyV2Conversion | class CORE_EXPORT QgsSymbologyV2Conversion | |||
{ | { | |||
public: | public: | |||
//! return a symbol in new symbology as close as possible to old symbol | /** Read old renderer definition from XML and create matching new rende | |||
//! @note not all properties will be preserved | rer */ | |||
static QgsSymbolV2* symbolV1toV2( const QgsSymbol* s ); | static QgsFeatureRendererV2* readOldRenderer( const QDomNode& layerNode | |||
, QGis::GeometryType geomType ); | ||||
//! return a symbol in old symbology as close as possible to new symbol | ||||
//! @note not all properties will be preserved | ||||
static QgsSymbol* symbolV2toV1( QgsSymbolV2* s ); | ||||
//! convert layer from old symbology to new symbology | ||||
//! @note not all properties will be preserved | ||||
static void rendererV1toV2( QgsVectorLayer* layer ); | ||||
//! convert layer from new symbology to old symbology | ||||
//! @note not all properties will be preserved | ||||
static void rendererV2toV1( QgsVectorLayer* layer ); | ||||
static QString penStyle2QString( Qt::PenStyle penstyle ); | ||||
static Qt::PenStyle qString2PenStyle( QString string ); | ||||
static QString brushStyle2QString( Qt::BrushStyle brushstyle ); | ||||
static Qt::BrushStyle qString2BrushStyle( QString string ); | ||||
}; | }; | |||
#endif // QGSSYMBOLOGYV2CONVERSION_H | #endif // QGSSYMBOLOGYV2CONVERSION_H | |||
End of changes. 5 change blocks. | ||||
19 lines changed or deleted | 18 lines changed or added | |||
qgssymbolv2.h | qgssymbolv2.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgssymbolv2.h | qgssymbolv2.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSSYMBOLV2_H | #ifndef QGSSYMBOLV2_H | |||
skipping to change at line 39 | skipping to change at line 39 | |||
class QDomDocument; | class QDomDocument; | |||
class QDomElement; | class QDomElement; | |||
//class | //class | |||
class QgsFeature; | class QgsFeature; | |||
class QgsSymbolLayerV2; | class QgsSymbolLayerV2; | |||
class QgsRenderContext; | class QgsRenderContext; | |||
class QgsVectorLayer; | class QgsVectorLayer; | |||
typedef QMap<QString, QString> QgsStringMap; | ||||
typedef QList<QgsSymbolLayerV2*> QgsSymbolLayerV2List; | typedef QList<QgsSymbolLayerV2*> QgsSymbolLayerV2List; | |||
class CORE_EXPORT QgsSymbolV2 | class CORE_EXPORT QgsSymbolV2 | |||
{ | { | |||
public: | public: | |||
enum OutputUnit | enum OutputUnit | |||
{ | { | |||
MM, | MM = 0, | |||
MapUnit | MapUnit, | |||
Mixed //mixed units in symbol layers | ||||
}; | }; | |||
enum SymbolType | enum SymbolType | |||
{ | { | |||
Marker, | Marker, | |||
Line, | Line, | |||
Fill | Fill | |||
}; | }; | |||
enum ScaleMethod | ||||
{ | ||||
ScaleArea, | ||||
ScaleDiameter | ||||
}; | ||||
//! @note added in 1.5 | //! @note added in 1.5 | |||
enum RenderHint | enum RenderHint | |||
{ | { | |||
DataDefinedSizeScale = 1, | DataDefinedSizeScale = 1, | |||
DataDefinedRotation = 2 | DataDefinedRotation = 2 | |||
}; | }; | |||
virtual ~QgsSymbolV2(); | virtual ~QgsSymbolV2(); | |||
//! return new default symbol for specified geometry type | //! return new default symbol for specified geometry type | |||
skipping to change at line 98 | skipping to change at line 104 | |||
//! remove symbol layer from the list and return pointer to it | //! remove symbol layer from the list and return pointer to it | |||
QgsSymbolLayerV2* takeSymbolLayer( int index ); | QgsSymbolLayerV2* takeSymbolLayer( int index ); | |||
//! delete layer at specified index and set a new one | //! delete layer at specified index and set a new one | |||
bool changeSymbolLayer( int index, QgsSymbolLayerV2* layer ); | bool changeSymbolLayer( int index, QgsSymbolLayerV2* layer ); | |||
void startRender( QgsRenderContext& context, const QgsVectorLayer* laye r = 0 ); | void startRender( QgsRenderContext& context, const QgsVectorLayer* laye r = 0 ); | |||
void stopRender( QgsRenderContext& context ); | void stopRender( QgsRenderContext& context ); | |||
void setColor( const QColor& color ); | void setColor( const QColor& color ); | |||
QColor color(); | QColor color() const; | |||
void drawPreviewIcon( QPainter* painter, QSize size ); | void drawPreviewIcon( QPainter* painter, QSize size ); | |||
QImage bigSymbolPreviewImage(); | QImage bigSymbolPreviewImage(); | |||
QString dump(); | QString dump() const; | |||
virtual QgsSymbolV2* clone() const = 0; | virtual QgsSymbolV2* clone() const = 0; | |||
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const; | void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const; | |||
OutputUnit outputUnit() const { return mOutputUnit; } | QgsSymbolV2::OutputUnit outputUnit() const; | |||
void setOutputUnit( OutputUnit u ) { mOutputUnit = u; } | void setOutputUnit( QgsSymbolV2::OutputUnit u ); | |||
//! Get alpha transparency 1 for opaque, 0 for invisible | //! Get alpha transparency 1 for opaque, 0 for invisible | |||
qreal alpha() const { return mAlpha; } | qreal alpha() const { return mAlpha; } | |||
//! Set alpha transparency 1 for opaque, 0 for invisible | //! Set alpha transparency 1 for opaque, 0 for invisible | |||
void setAlpha( qreal alpha ) { mAlpha = alpha; } | void setAlpha( qreal alpha ) { mAlpha = alpha; } | |||
//! @note added in 1.5 | //! @note added in 1.5 | |||
void setRenderHints( int hints ) { mRenderHints = hints; } | void setRenderHints( int hints ) { mRenderHints = hints; } | |||
//! @note added in 1.5 | //! @note added in 1.5 | |||
int renderHints() const { return mRenderHints; } | int renderHints() const { return mRenderHints; } | |||
skipping to change at line 138 | skipping to change at line 144 | |||
QgsSymbolLayerV2List cloneLayers() const; | QgsSymbolLayerV2List cloneLayers() const; | |||
//! check whether a symbol layer type can be used within the symbol | //! check whether a symbol layer type can be used within the symbol | |||
//! (marker-marker, line-line, fill-fill/line) | //! (marker-marker, line-line, fill-fill/line) | |||
//! @note added in 1.7 | //! @note added in 1.7 | |||
bool isSymbolLayerCompatible( SymbolType t ); | bool isSymbolLayerCompatible( SymbolType t ); | |||
SymbolType mType; | SymbolType mType; | |||
QgsSymbolLayerV2List mLayers; | QgsSymbolLayerV2List mLayers; | |||
OutputUnit mOutputUnit; | ||||
/**Symbol opacity (in the range 0 - 1)*/ | /**Symbol opacity (in the range 0 - 1)*/ | |||
qreal mAlpha; | qreal mAlpha; | |||
int mRenderHints; | int mRenderHints; | |||
}; | }; | |||
/////////////////////// | /////////////////////// | |||
class CORE_EXPORT QgsSymbolV2RenderContext | class CORE_EXPORT QgsSymbolV2RenderContext | |||
{ | { | |||
public: | public: | |||
QgsSymbolV2RenderContext( QgsRenderContext& c, QgsSymbolV2::OutputUnit u , qreal alpha = 1.0, bool selected = false, int renderHints = 0, const Qg sFeature* f = 0 ); | QgsSymbolV2RenderContext( QgsRenderContext& c, QgsSymbolV2::OutputUnit u , qreal alpha = 1.0, bool selected = false, int renderHints = 0, const Qg sFeature* f = 0 ); | |||
~QgsSymbolV2RenderContext(); | ~QgsSymbolV2RenderContext(); | |||
QgsRenderContext& renderContext() { return mRenderContext; } | QgsRenderContext& renderContext() { return mRenderContext; } | |||
const QgsRenderContext& renderContext() const { return mRenderContext; } | ||||
//void setRenderContext( QgsRenderContext& c ) { mRenderContext = c;} | //void setRenderContext( QgsRenderContext& c ) { mRenderContext = c;} | |||
QgsSymbolV2::OutputUnit outputUnit() const { return mOutputUnit; } | QgsSymbolV2::OutputUnit outputUnit() const { return mOutputUnit; } | |||
void setOutputUnit( QgsSymbolV2::OutputUnit u ) { mOutputUnit = u; } | void setOutputUnit( QgsSymbolV2::OutputUnit u ) { mOutputUnit = u; } | |||
//! Get alpha transparency 1 for opaque, 0 for invisible | //! Get alpha transparency 1 for opaque, 0 for invisible | |||
qreal alpha() const { return mAlpha; } | qreal alpha() const { return mAlpha; } | |||
//! Set alpha transparency 1 for opaque, 0 for invisible | //! Set alpha transparency 1 for opaque, 0 for invisible | |||
void setAlpha( qreal alpha ) { mAlpha = alpha; } | void setAlpha( qreal alpha ) { mAlpha = alpha; } | |||
skipping to change at line 179 | skipping to change at line 184 | |||
int renderHints() const { return mRenderHints; } | int renderHints() const { return mRenderHints; } | |||
//! @note added in 1.5 | //! @note added in 1.5 | |||
void setRenderHints( int hints ) { mRenderHints = hints; } | void setRenderHints( int hints ) { mRenderHints = hints; } | |||
void setFeature( const QgsFeature* f ) { mFeature = f; } | void setFeature( const QgsFeature* f ) { mFeature = f; } | |||
const QgsFeature* feature() const { return mFeature; } | const QgsFeature* feature() const { return mFeature; } | |||
void setLayer( const QgsVectorLayer* layer ) { mLayer = layer; } | void setLayer( const QgsVectorLayer* layer ) { mLayer = layer; } | |||
const QgsVectorLayer* layer() const { return mLayer; } | const QgsVectorLayer* layer() const { return mLayer; } | |||
// Color used for selections | ||||
static QColor selectionColor(); | ||||
double outputLineWidth( double width ) const; | double outputLineWidth( double width ) const; | |||
double outputPixelSize( double size ) const; | double outputPixelSize( double size ) const; | |||
// workaround for sip 4.7. Don't use assignment - will fail with assert ion error | // workaround for sip 4.7. Don't use assignment - will fail with assert ion error | |||
QgsSymbolV2RenderContext& operator=( const QgsSymbolV2RenderContext& ); | QgsSymbolV2RenderContext& operator=( const QgsSymbolV2RenderContext& ); | |||
private: | private: | |||
QgsRenderContext& mRenderContext; | QgsRenderContext& mRenderContext; | |||
QgsSymbolV2::OutputUnit mOutputUnit; | QgsSymbolV2::OutputUnit mOutputUnit; | |||
qreal mAlpha; | qreal mAlpha; | |||
skipping to change at line 217 | skipping to change at line 219 | |||
static QgsMarkerSymbolV2* createSimple( const QgsStringMap& properties ); | static QgsMarkerSymbolV2* createSimple( const QgsStringMap& properties ); | |||
QgsMarkerSymbolV2( QgsSymbolLayerV2List layers = QgsSymbolLayerV2List() ); | QgsMarkerSymbolV2( QgsSymbolLayerV2List layers = QgsSymbolLayerV2List() ); | |||
void setAngle( double angle ); | void setAngle( double angle ); | |||
double angle(); | double angle(); | |||
void setSize( double size ); | void setSize( double size ); | |||
double size(); | double size(); | |||
void setScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod ); | ||||
ScaleMethod scaleMethod(); | ||||
void renderPoint( const QPointF& point, const QgsFeature* f, QgsRenderC ontext& context, int layer = -1, bool selected = false ); | void renderPoint( const QPointF& point, const QgsFeature* f, QgsRenderC ontext& context, int layer = -1, bool selected = false ); | |||
virtual QgsSymbolV2* clone() const; | virtual QgsSymbolV2* clone() const; | |||
}; | }; | |||
class CORE_EXPORT QgsLineSymbolV2 : public QgsSymbolV2 | class CORE_EXPORT QgsLineSymbolV2 : public QgsSymbolV2 | |||
{ | { | |||
public: | public: | |||
/** Create a line symbol with one symbol layer: SimpleLine with specifi ed properties. | /** Create a line symbol with one symbol layer: SimpleLine with specifi ed properties. | |||
This is a convenience method for easier creation of line symbols. | This is a convenience method for easier creation of line symbols. | |||
End of changes. 11 change blocks. | ||||
13 lines changed or deleted | 18 lines changed or added | |||
qgssymbolv2selectordialog.h | qgssymbolv2selectordialog.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgssymbolv2selectordialog.h | qgssymbolv2selectordialog.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSSYMBOLV2SELECTORDIALOG_H | #ifndef QGSSYMBOLV2SELECTORDIALOG_H | |||
#define QGSSYMBOLV2SELECTORDIALOG_H | #define QGSSYMBOLV2SELECTORDIALOG_H | |||
#include <QDialog> | #include <QDialog> | |||
#include "ui_qgssymbolv2selectordialogbase.h" | #include "ui_qgssymbolv2selectordialogbase.h" | |||
#include <QStandardItemModel> | ||||
class QgsStyleV2; | class QgsStyleV2; | |||
class QgsSymbolV2; | class QgsSymbolV2; | |||
class QgsSymbolLayerV2; | ||||
class QgsVectorLayer; | class QgsVectorLayer; | |||
class QMenu; | class QMenu; | |||
class QWidget; | ||||
class SymbolLayerItem; | ||||
class GUI_EXPORT QgsSymbolV2SelectorDialog : public QDialog, private Ui::Qg sSymbolV2SelectorDialogBase | class GUI_EXPORT QgsSymbolV2SelectorDialog : public QDialog, private Ui::Qg sSymbolV2SelectorDialogBase | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsSymbolV2SelectorDialog( QgsSymbolV2* symbol, QgsStyleV2* style, cons t QgsVectorLayer* vl, QWidget* parent = NULL, bool embedded = false ); | QgsSymbolV2SelectorDialog( QgsSymbolV2* symbol, QgsStyleV2* style, cons t QgsVectorLayer* vl, QWidget* parent = 0, bool embedded = false ); | |||
//! return menu for "advanced" button - create it if doesn't exist and show the advanced button | //! return menu for "advanced" button - create it if doesn't exist and show the advanced button | |||
QMenu* advancedMenu(); | QMenu* advancedMenu(); | |||
protected: | protected: | |||
void populateSymbolView(); | ||||
void updateSymbolPreview(); | ||||
void updateSymbolColor(); | ||||
void updateSymbolInfo(); | ||||
//! Reimplements dialog keyPress event so we can ignore it | //! Reimplements dialog keyPress event so we can ignore it | |||
void keyPressEvent( QKeyEvent * event ); | void keyPressEvent( QKeyEvent * event ); | |||
private: | void loadSymbol(); | |||
/**Displays alpha value as transparency in mTransparencyLabel*/ | //! @note not available in python bindings | |||
void displayTransparency( double alpha ); | void loadSymbol( QgsSymbolV2* symbol, SymbolLayerItem* parent ); | |||
public slots: | void updateUi(); | |||
void changeSymbolProperties(); | ||||
void setSymbolFromStyle( const QModelIndex & index ); | ||||
void setSymbolColor(); | ||||
void setMarkerAngle( double angle ); | ||||
void setMarkerSize( double size ); | ||||
void setLineWidth( double width ); | ||||
void addSymbolToStyle(); | ||||
void on_mSymbolUnitComboBox_currentIndexChanged( const QString & text ) | ||||
; | ||||
void on_mTransparencySlider_valueChanged( int value ); | ||||
void openStyleManager(); | void updateLockButton(); | |||
//! @note not available in python bindings | ||||
SymbolLayerItem* currentLayerItem(); | ||||
QgsSymbolLayerV2* currentLayer(); | ||||
void moveLayerByOffset( int offset ); | ||||
void setWidget( QWidget* widget ); | ||||
signals: | signals: | |||
void symbolModified(); | void symbolModified(); | |||
protected: | public slots: | |||
void moveLayerDown(); | ||||
void moveLayerUp(); | ||||
void addLayer(); | ||||
void removeLayer(); | ||||
void lockLayer(); | ||||
void layerChanged(); | ||||
void updateLayerPreview(); | ||||
void updatePreview(); | ||||
//! Slot to update tree when a new symbol from style | ||||
void symbolChanged(); | ||||
//! alters tree and sets proper widget when Layer Type is changed | ||||
//! @note: The layer is received from the LayerPropertiesWidget | ||||
void changeLayer( QgsSymbolLayerV2* layer ); | ||||
protected: // data | ||||
QgsStyleV2* mStyle; | QgsStyleV2* mStyle; | |||
QgsSymbolV2* mSymbol; | QgsSymbolV2* mSymbol; | |||
QMenu* mAdvancedMenu; | QMenu* mAdvancedMenu; | |||
const QgsVectorLayer* mVectorLayer; | const QgsVectorLayer* mVectorLayer; | |||
QStandardItemModel* model; | ||||
QWidget *mPresentWidget; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 11 change blocks. | ||||
23 lines changed or deleted | 45 lines changed or added | |||
qgsvectorcolorbrewercolorrampv2dialog.h | qgsvectorcolorbrewercolorrampv2dialog.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsvectorcolorbrewercolorrampv2dialog.h | qgsvectorcolorbrewercolorrampv2dialog.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSVECTORCOLORBREWERCOLORRAMPV2DIALOG_H | #ifndef QGSVECTORCOLORBREWERCOLORRAMPV2DIALOG_H | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgsvectorcolorrampv2.h | qgsvectorcolorrampv2.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsvectorcolorrampv2.h | qgsvectorcolorrampv2.h | |||
--------------------- | --------------------- | |||
begin : November 2009 | begin : November 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSVECTORCOLORRAMPV2_H | #ifndef QGSVECTORCOLORRAMPV2_H | |||
#define QGSVECTORCOLORRAMPV2_H | #define QGSVECTORCOLORRAMPV2_H | |||
#include <QColor> | #include <QColor> | |||
#include "qgssymbollayerv2.h" // for QgsStringMap | #include "qgssymbollayerv2.h" // for QgsStringMap | |||
#include "qgslogger.h" | ||||
class CORE_EXPORT QgsVectorColorRampV2 | class CORE_EXPORT QgsVectorColorRampV2 | |||
{ | { | |||
public: | public: | |||
virtual ~QgsVectorColorRampV2() {} | virtual ~QgsVectorColorRampV2() {} | |||
// Number of defined colors | ||||
virtual int count() const = 0; | ||||
// Relative value (0,1) of color at index | ||||
virtual double value( int index ) const = 0; | ||||
virtual QColor color( double value ) const = 0; | virtual QColor color( double value ) const = 0; | |||
virtual QString type() const = 0; | virtual QString type() const = 0; | |||
virtual QgsVectorColorRampV2* clone() const = 0; | virtual QgsVectorColorRampV2* clone() const = 0; | |||
virtual QgsStringMap properties() const = 0; | virtual QgsStringMap properties() const = 0; | |||
}; | }; | |||
struct QgsGradientStop | ||||
{ | ||||
double offset; // relative (0,1) | ||||
QColor color; | ||||
QgsGradientStop( double o, const QColor& c ) : offset( o ), color( c ) { | ||||
} | ||||
}; | ||||
typedef QList<QgsGradientStop> QgsGradientStopsList; | ||||
#define DEFAULT_GRADIENT_COLOR1 QColor(0,0,255) | #define DEFAULT_GRADIENT_COLOR1 QColor(0,0,255) | |||
#define DEFAULT_GRADIENT_COLOR2 QColor(0,255,0) | #define DEFAULT_GRADIENT_COLOR2 QColor(0,255,0) | |||
class CORE_EXPORT QgsVectorGradientColorRampV2 : public QgsVectorColorRampV 2 | class CORE_EXPORT QgsVectorGradientColorRampV2 : public QgsVectorColorRampV 2 | |||
{ | { | |||
public: | public: | |||
QgsVectorGradientColorRampV2( QColor color1 = DEFAULT_GRADIENT_COLOR1, | QgsVectorGradientColorRampV2( QColor color1 = DEFAULT_GRADIENT_COLOR1, | |||
QColor color2 = DEFAULT_GRADIENT_COLOR2 ) | QColor color2 = DEFAULT_GRADIENT_COLOR2, | |||
; | bool discrete = false, | |||
QgsGradientStopsList stops = QgsGradientS | ||||
topsList() ); | ||||
static QgsVectorColorRampV2* create( const QgsStringMap& properties = Q gsStringMap() ); | static QgsVectorColorRampV2* create( const QgsStringMap& properties = Q gsStringMap() ); | |||
virtual int count() const { return mStops.count() + 2; } | ||||
virtual double value( int index ) const; | ||||
virtual QColor color( double value ) const; | virtual QColor color( double value ) const; | |||
virtual QString type() const { return "gradient"; } | virtual QString type() const { return "gradient"; } | |||
virtual QgsVectorColorRampV2* clone() const; | virtual QgsVectorColorRampV2* clone() const; | |||
virtual QgsStringMap properties() const; | virtual QgsStringMap properties() const; | |||
QColor color1() const { return mColor1; } | QColor color1() const { return mColor1; } | |||
QColor color2() const { return mColor2; } | QColor color2() const { return mColor2; } | |||
void setColor1( QColor color ) { mColor1 = color; } | void setColor1( QColor color ) { mColor1 = color; } | |||
void setColor2( QColor color ) { mColor2 = color; } | void setColor2( QColor color ) { mColor2 = color; } | |||
typedef QMap<double, QColor> StopsMap; | bool isDiscrete() const { return mDiscrete; } | |||
void setDiscrete( bool discrete ) { mDiscrete = discrete; } | ||||
void convertToDiscrete( bool discrete ); | ||||
void setStops( const QgsGradientStopsList& stops ) { mStops = stops; } | ||||
const QgsGradientStopsList& stops() const { return mStops; } | ||||
void setStops( const StopsMap& stops ) { mStops = stops; } | QgsStringMap info() const { return mInfo; } | |||
const StopsMap& stops() const { return mStops; } | void setInfo( const QgsStringMap& info ) { mInfo = info; } | |||
protected: | protected: | |||
QColor mColor1, mColor2; | QColor mColor1, mColor2; | |||
StopsMap mStops; | bool mDiscrete; | |||
QgsGradientStopsList mStops; | ||||
QgsStringMap mInfo; | ||||
}; | }; | |||
#define DEFAULT_RANDOM_COUNT 10 | #define DEFAULT_RANDOM_COUNT 10 | |||
#define DEFAULT_RANDOM_HUE_MIN 0 | #define DEFAULT_RANDOM_HUE_MIN 0 | |||
#define DEFAULT_RANDOM_HUE_MAX 359 | #define DEFAULT_RANDOM_HUE_MAX 359 | |||
#define DEFAULT_RANDOM_VAL_MIN 0 | #define DEFAULT_RANDOM_VAL_MIN 200 | |||
#define DEFAULT_RANDOM_VAL_MAX 255 | #define DEFAULT_RANDOM_VAL_MAX 240 | |||
#define DEFAULT_RANDOM_SAT_MIN 0 | #define DEFAULT_RANDOM_SAT_MIN 100 | |||
#define DEFAULT_RANDOM_SAT_MAX 255 | #define DEFAULT_RANDOM_SAT_MAX 240 | |||
class CORE_EXPORT QgsVectorRandomColorRampV2 : public QgsVectorColorRampV2 | class CORE_EXPORT QgsVectorRandomColorRampV2 : public QgsVectorColorRampV2 | |||
{ | { | |||
public: | public: | |||
QgsVectorRandomColorRampV2( int count = DEFAULT_RANDOM_COUNT, | QgsVectorRandomColorRampV2( int count = DEFAULT_RANDOM_COUNT, | |||
int hueMin = DEFAULT_RANDOM_HUE_MIN, int hu eMax = DEFAULT_RANDOM_HUE_MAX, | int hueMin = DEFAULT_RANDOM_HUE_MIN, int hu eMax = DEFAULT_RANDOM_HUE_MAX, | |||
int satMin = DEFAULT_RANDOM_SAT_MIN, int sa tMax = DEFAULT_RANDOM_SAT_MAX, | int satMin = DEFAULT_RANDOM_SAT_MIN, int sa tMax = DEFAULT_RANDOM_SAT_MAX, | |||
int valMin = DEFAULT_RANDOM_VAL_MIN, int va lMax = DEFAULT_RANDOM_VAL_MAX ); | int valMin = DEFAULT_RANDOM_VAL_MIN, int va lMax = DEFAULT_RANDOM_VAL_MAX ); | |||
static QgsVectorColorRampV2* create( const QgsStringMap& properties = Q gsStringMap() ); | static QgsVectorColorRampV2* create( const QgsStringMap& properties = Q gsStringMap() ); | |||
virtual double value( int index ) const; | ||||
virtual QColor color( double value ) const; | virtual QColor color( double value ) const; | |||
virtual QString type() const { return "random"; } | virtual QString type() const { return "random"; } | |||
virtual QgsVectorColorRampV2* clone() const; | virtual QgsVectorColorRampV2* clone() const; | |||
virtual QgsStringMap properties() const; | virtual QgsStringMap properties() const; | |||
void updateColors(); | void updateColors(); | |||
skipping to change at line 134 | skipping to change at line 164 | |||
#define DEFAULT_COLORBREWER_COLORS 5 | #define DEFAULT_COLORBREWER_COLORS 5 | |||
class CORE_EXPORT QgsVectorColorBrewerColorRampV2 : public QgsVectorColorRa mpV2 | class CORE_EXPORT QgsVectorColorBrewerColorRampV2 : public QgsVectorColorRa mpV2 | |||
{ | { | |||
public: | public: | |||
QgsVectorColorBrewerColorRampV2( QString schemeName = DEFAULT_COLORBREW ER_SCHEMENAME, | QgsVectorColorBrewerColorRampV2( QString schemeName = DEFAULT_COLORBREW ER_SCHEMENAME, | |||
int colors = DEFAULT_COLORBREWER_COLOR S ); | int colors = DEFAULT_COLORBREWER_COLOR S ); | |||
static QgsVectorColorRampV2* create( const QgsStringMap& properties = Q gsStringMap() ); | static QgsVectorColorRampV2* create( const QgsStringMap& properties = Q gsStringMap() ); | |||
virtual double value( int index ) const; | ||||
virtual QColor color( double value ) const; | virtual QColor color( double value ) const; | |||
virtual QString type() const { return "colorbrewer"; } | virtual QString type() const { return "colorbrewer"; } | |||
virtual QgsVectorColorRampV2* clone() const; | virtual QgsVectorColorRampV2* clone() const; | |||
virtual QgsStringMap properties() const; | virtual QgsStringMap properties() const; | |||
QString schemeName() const { return mSchemeName; } | QString schemeName() const { return mSchemeName; } | |||
virtual int count() const { return mColors; } | ||||
int colors() const { return mColors; } | int colors() const { return mColors; } | |||
void setSchemeName( QString schemeName ) { mSchemeName = schemeName; lo adPalette(); } | void setSchemeName( QString schemeName ) { mSchemeName = schemeName; lo adPalette(); } | |||
void setColors( int colors ) { mColors = colors; loadPalette(); } | void setColors( int colors ) { mColors = colors; loadPalette(); } | |||
static QStringList listSchemeNames(); | static QStringList listSchemeNames(); | |||
static QList<int> listSchemeVariants( QString schemeName ); | static QList<int> listSchemeVariants( QString schemeName ); | |||
protected: | protected: | |||
void loadPalette(); | void loadPalette(); | |||
QString mSchemeName; | QString mSchemeName; | |||
int mColors; | int mColors; | |||
QList<QColor> mPalette; | QList<QColor> mPalette; | |||
}; | }; | |||
#define DEFAULT_CPTCITY_SCHEMENAME "cb/div/BrBG_" //change this | ||||
#define DEFAULT_CPTCITY_VARIANTNAME "05" | ||||
class CORE_EXPORT QgsCptCityColorRampV2 : public QgsVectorGradientColorRamp | ||||
V2 | ||||
{ | ||||
public: | ||||
QgsCptCityColorRampV2( QString schemeName = DEFAULT_CPTCITY_SCHEMENAME, | ||||
QString variantName = DEFAULT_CPTCITY_VARIANTNAM | ||||
E, | ||||
bool doLoadFile = true ); | ||||
QgsCptCityColorRampV2( QString schemeName, QStringList variantList, | ||||
QString variantName = QString(), bool doLoadFile | ||||
= true ); | ||||
static QgsVectorColorRampV2* create( const QgsStringMap& properties = Q | ||||
gsStringMap() ); | ||||
virtual QString type() const { return "cpt-city"; } | ||||
virtual QgsVectorColorRampV2* clone() const; | ||||
void copy( const QgsCptCityColorRampV2* other ); | ||||
QgsVectorGradientColorRampV2* cloneGradientRamp() const; | ||||
virtual QgsStringMap properties() const; | ||||
QString schemeName() const { return mSchemeName; } | ||||
QString variantName() const { return mVariantName; } | ||||
QStringList variantList() const { return mVariantList; } | ||||
/* lazy loading - have to call loadPalette() explicitly */ | ||||
void setSchemeName( QString schemeName ) { mSchemeName = schemeName; mF | ||||
ileLoaded = false; } | ||||
void setVariantName( QString variantName ) { mVariantName = variantName | ||||
; mFileLoaded = false; } | ||||
void setVariantList( QStringList variantList ) { mVariantList = variant | ||||
List; } | ||||
void setName( QString schemeName, QString variantName = "", QStringList | ||||
variantList = QStringList() ) | ||||
{ mSchemeName = schemeName; mVariantName = variantName; mVariantList = | ||||
variantList; mFileLoaded = false; } | ||||
void loadPalette() { loadFile(); } | ||||
bool hasMultiStops() const { return mMultiStops; } | ||||
QString fileName() const; | ||||
bool loadFile(); | ||||
bool fileLoaded() const { return mFileLoaded; } | ||||
QString copyingFileName() const; | ||||
QString descFileName() const; | ||||
QgsStringMap copyingInfo() const; | ||||
protected: | ||||
QString mSchemeName; | ||||
QString mVariantName; | ||||
QStringList mVariantList; | ||||
bool mFileLoaded; | ||||
bool mMultiStops; | ||||
}; | ||||
#endif | #endif | |||
End of changes. 15 change blocks. | ||||
12 lines changed or deleted | 108 lines changed or added | |||
qgsvectordataprovider.h | qgsvectordataprovider.h | |||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSVECTORDATAPROVIDER_H | #ifndef QGSVECTORDATAPROVIDER_H | |||
#define QGSVECTORDATAPROVIDER_H | #define QGSVECTORDATAPROVIDER_H | |||
class QTextCodec; | class QTextCodec; | |||
#include <QList> | #include <QList> | |||
#include <QSet> | #include <QSet> | |||
#include <QMap> | #include <QMap> | |||
#include <QHash> | ||||
//QGIS Includes | //QGIS Includes | |||
#include "qgis.h" | #include "qgis.h" | |||
#include "qgsdataprovider.h" | #include "qgsdataprovider.h" | |||
#include "qgsfeature.h" | #include "qgsfeature.h" | |||
#include "qgsfield.h" | #include "qgsfield.h" | |||
#include "qgsrectangle.h" | #include "qgsrectangle.h" | |||
typedef QList<int> QgsAttributeList; | typedef QList<int> QgsAttributeList; | |||
typedef QSet<int> QgsAttributeIds; | typedef QSet<int> QgsAttributeIds; | |||
typedef QHash<int, QString> QgsAttrPalIndexNameHash; | ||||
class QgsFeatureIterator; | ||||
#include "qgsfeaturerequest.h" | ||||
/** \ingroup core | /** \ingroup core | |||
* This is the base class for vector data providers. | * This is the base class for vector data providers. | |||
* | * | |||
* Data providers abstract the retrieval and writing (where supported) | * Data providers abstract the retrieval and writing (where supported) | |||
* of feature and attribute information from a spatial datasource. | * of feature and attribute information from a spatial datasource. | |||
* | * | |||
* | * | |||
*/ | */ | |||
class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider | class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider | |||
skipping to change at line 80 | skipping to change at line 86 | |||
/** fast access to features using their ID */ | /** fast access to features using their ID */ | |||
SelectAtId = 1 << 7, | SelectAtId = 1 << 7, | |||
/** allows modifications of geometries */ | /** allows modifications of geometries */ | |||
ChangeGeometries = 1 << 8, | ChangeGeometries = 1 << 8, | |||
/** DEPRECATED - do not use */ | /** DEPRECATED - do not use */ | |||
SelectGeometryAtId = 1 << 9, | SelectGeometryAtId = 1 << 9, | |||
/** DEPRECATED - do not use */ | /** DEPRECATED - do not use */ | |||
RandomSelectGeometryAtId = 1 << 10, | RandomSelectGeometryAtId = 1 << 10, | |||
/** DEPRECATED - do not use */ | /** DEPRECATED - do not use */ | |||
SequentialSelectGeometryAtId = 1 << 11, | SequentialSelectGeometryAtId = 1 << 11, | |||
CreateAttributeIndex = 1 << 12, | CreateAttributeIndex = 1 << 12, | |||
/** Uses mEncoding for conversion of 8-bit strings to unicode */ | /** allows user to select encoding */ | |||
SetEncoding = 1 << 13, | SelectEncoding = 1 << 13, | |||
}; | }; | |||
/** bitmask of all provider's editing capabilities */ | /** bitmask of all provider's editing capabilities */ | |||
const static int EditingCapabilities = AddFeatures | DeleteFeatures | | const static int EditingCapabilities = AddFeatures | DeleteFeatures | | |||
ChangeAttributeValues | ChangeGe ometries | AddAttributes | DeleteAttributes; | ChangeAttributeValues | ChangeGe ometries | AddAttributes | DeleteAttributes; | |||
/** | /** | |||
* Constructor of the vector provider | * Constructor of the vector provider | |||
* @param uri uniform resource locator (URI) for a dataset | * @param uri uniform resource locator (URI) for a dataset | |||
*/ | */ | |||
skipping to change at line 105 | skipping to change at line 111 | |||
/** | /** | |||
* Destructor | * Destructor | |||
*/ | */ | |||
virtual ~QgsVectorDataProvider(); | virtual ~QgsVectorDataProvider(); | |||
/** | /** | |||
* Returns the permanent storage type for this layer as a friendly name . | * Returns the permanent storage type for this layer as a friendly name . | |||
*/ | */ | |||
virtual QString storageType() const; | virtual QString storageType() const; | |||
/** Select features based on a bounding rectangle. Features can be retr | ||||
ieved with calls to nextFeature. | ||||
* @param fetchAttributes list of attributes which should be fetched | ||||
* @param rect spatial filter | ||||
* @param fetchGeometry true if the feature geometry should be fetched | ||||
* @param useIntersect true if an accurate intersection test should be | ||||
used, | ||||
* false if a test based on bounding box is suffici | ||||
ent | ||||
*/ | ||||
virtual void select( QgsAttributeList fetchAttributes = QgsAttributeLis | ||||
t(), | ||||
QgsRectangle rect = QgsRectangle(), | ||||
bool fetchGeometry = true, | ||||
bool useIntersect = false ) = 0; | ||||
/** | ||||
* This function does nothing useful, it's kept only for compatibility. | ||||
* @todo to be removed | ||||
*/ | ||||
virtual long updateFeatureCount(); | ||||
/** | ||||
* Gets the feature at the given feature ID. | ||||
* @param featureId of the feature to be returned | ||||
* @param feature which will receive the data | ||||
* @param fetchGeometry flag which if true, will cause the geometry to | ||||
be fetched from the provider | ||||
* @param fetchAttributes a list containing the indexes of the attribut | ||||
e fields to copy | ||||
* @return True when feature was found, otherwise false | ||||
* | ||||
* Default implementation traverses all features until it finds the one | ||||
with correct ID. | ||||
* In case the provider supports reading the feature directly, override | ||||
this function. | ||||
*/ | ||||
virtual bool featureAtId( QgsFeatureId featureId, | ||||
QgsFeature& feature, | ||||
bool fetchGeometry = true, | ||||
QgsAttributeList fetchAttributes = QgsAttribu | ||||
teList() ); | ||||
/** | /** | |||
* Get the next feature resulting from a select operation. | * Query the provider for features specified in request. | |||
* @param feature feature which will receive data from the provider | ||||
* @return true when there was a feature to fetch, false when end was h | ||||
it | ||||
*/ | */ | |||
virtual bool nextFeature( QgsFeature& feature ) = 0; | virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest& reques t = QgsFeatureRequest() ) = 0; | |||
/** | /** | |||
* Get feature type. | * Get feature type. | |||
* @return int representing the feature type | * @return int representing the feature type | |||
*/ | */ | |||
virtual QGis::WkbType geometryType() const = 0; | virtual QGis::WkbType geometryType() const = 0; | |||
/** | /** | |||
* Number of features in the layer | * Number of features in the layer | |||
* @return long containing number of features | * @return long containing number of features | |||
*/ | */ | |||
virtual long featureCount() const = 0; | virtual long featureCount() const = 0; | |||
/** | /** | |||
* Number of attribute fields for a feature in the layer | ||||
*/ | ||||
virtual uint fieldCount() const = 0; | ||||
/** | ||||
* Return a map of indexes with field names for this layer | * Return a map of indexes with field names for this layer | |||
* @return map of fields | * @return map of fields | |||
* @see QgsFieldMap | * @see QgsFieldMap | |||
*/ | */ | |||
virtual const QgsFieldMap &fields() const = 0; | virtual const QgsFields &fields() const = 0; | |||
/** | /** | |||
* Return a short comment for the data that this provider is | * Return a short comment for the data that this provider is | |||
* providing access to (e.g. the comment for postgres table). | * providing access to (e.g. the comment for postgres table). | |||
*/ | */ | |||
virtual QString dataComment() const; | virtual QString dataComment() const; | |||
/** Restart reading features from previous select operation */ | ||||
virtual void rewind() = 0; | ||||
/** | /** | |||
* Returns the minimum value of an attribute | * Returns the minimum value of an attribute | |||
* @param index the index of the attribute | * @param index the index of the attribute | |||
* | * | |||
* Default implementation walks all numeric attributes and caches minim al | * Default implementation walks all numeric attributes and caches minim al | |||
* and maximal values. If provider has facilities to retrieve minimal | * and maximal values. If provider has facilities to retrieve minimal | |||
* value directly, override this function. | * value directly, override this function. | |||
*/ | */ | |||
virtual QVariant minimumValue( int index ); | virtual QVariant minimumValue( int index ); | |||
skipping to change at line 238 | skipping to change at line 200 | |||
/** | /** | |||
* Adds new attributes | * Adds new attributes | |||
* @param attributes list of new attributes | * @param attributes list of new attributes | |||
* @return true in case of success and false in case of failure | * @return true in case of success and false in case of failure | |||
* @note added in 1.2 | * @note added in 1.2 | |||
*/ | */ | |||
virtual bool addAttributes( const QList<QgsField> &attributes ); | virtual bool addAttributes( const QList<QgsField> &attributes ); | |||
/** | /** | |||
* Add new attributes | ||||
* @param attributes map of attributes name as key and type as value | ||||
* @return true in case of success and false in case of failure | ||||
* @deprecated | ||||
*/ | ||||
Q_DECL_DEPRECATED virtual bool addAttributes( const QMap<QString, QStri | ||||
ng> &attributes ); | ||||
/** | ||||
* Deletes existing attributes | * Deletes existing attributes | |||
* @param attributes a set containing names of attributes | * @param attributes a set containing indices of attributes | |||
* @return true in case of success and false in case of failure | * @return true in case of success and false in case of failure | |||
*/ | */ | |||
virtual bool deleteAttributes( const QgsAttributeIds &attributes ); | virtual bool deleteAttributes( const QgsAttributeIds &attributes ); | |||
/** | /** | |||
* Changes attribute values of existing features. | * Changes attribute values of existing features. | |||
* @param attr_map a map containing changed attributes | * @param attr_map a map containing changed attributes | |||
* @return true in case of success and false in case of failure | * @return true in case of success and false in case of failure | |||
*/ | */ | |||
virtual bool changeAttributeValues( const QgsChangedAttributesMap &attr _map ); | virtual bool changeAttributeValues( const QgsChangedAttributesMap &attr _map ); | |||
skipping to change at line 318 | skipping to change at line 272 | |||
/**Return a map where the key is the name of the field and the value is its index*/ | /**Return a map where the key is the name of the field and the value is its index*/ | |||
QMap<QString, int> fieldNameMap() const; | QMap<QString, int> fieldNameMap() const; | |||
/** | /** | |||
* Return list of indexes to fetch all attributes in nextFeature() | * Return list of indexes to fetch all attributes in nextFeature() | |||
*/ | */ | |||
virtual QgsAttributeList attributeIndexes(); | virtual QgsAttributeList attributeIndexes(); | |||
/** | /** | |||
* Set whether provider should also return features that don't have | * Return list of indexes of fields that make up the primary key | |||
* associated geometry. false by default | * @note added in 2.0 | |||
*/ | ||||
virtual QgsAttributeList pkAttributeIndexes() { return QgsAttributeList | ||||
(); } | ||||
/** | ||||
* Return list of indexes to names for QgsPalLabeling fix | ||||
*/ | */ | |||
void enableGeometrylessFeatures( bool fetch ); | virtual QgsAttrPalIndexNameHash palAttributeIndexNames() const { return mAttrPalIndexName; } | |||
/** | /** | |||
* check if provider supports type of field | * check if provider supports type of field | |||
* @note added in 1.2 | * @note added in 1.2 | |||
*/ | */ | |||
bool supportedType( const QgsField &field ) const; | bool supportedType( const QgsField &field ) const; | |||
struct NativeType | struct NativeType | |||
{ | { | |||
NativeType( QString typeDesc, QString typeName, QVariant::Type type, int minLen = 0, int maxLen = 0, int minPrec = 0, int maxPrec = 0 ) : | NativeType( QString typeDesc, QString typeName, QVariant::Type type, int minLen = 0, int maxLen = 0, int minPrec = 0, int maxPrec = 0 ) : | |||
mTypeDesc( typeDesc ), mTypeName( typeName ), mType( type ), mMin Len( minLen ), mMaxLen( maxLen ), mMinPrec( minPrec ), mMaxPrec( maxPrec ) {}; | mTypeDesc( typeDesc ), mTypeName( typeName ), mType( type ), mMin Len( minLen ), mMaxLen( maxLen ), mMinPrec( minPrec ), mMaxPrec( maxPrec ) {}; | |||
QString mTypeDesc; | QString mTypeDesc; | |||
QString mTypeName; | QString mTypeName; | |||
QVariant::Type mType; | QVariant::Type mType; | |||
int mMinLen, mMaxLen; | int mMinLen; | |||
int mMinPrec, mMaxPrec; | int mMaxLen; | |||
int mMinPrec; | ||||
int mMaxPrec; | ||||
}; | }; | |||
/** | /** | |||
* Returns the names of the supported types | * Returns the names of the supported types | |||
* @note added in 1.2 | * @note added in 1.2 | |||
*/ | */ | |||
const QList< NativeType > &nativeTypes() const; | const QList< NativeType > &nativeTypes() const; | |||
/** | ||||
* Returns the names of the supported types | ||||
* @deprecated use nativeTypes() | ||||
*/ | ||||
Q_DECL_DEPRECATED const QMap<QString, QVariant::Type> &supportedNativeT | ||||
ypes() const; | ||||
/** Returns true if the provider is strict about the type of inserted f eatures | /** Returns true if the provider is strict about the type of inserted f eatures | |||
(e.g. no multipolygon in a polygon layer) | (e.g. no multipolygon in a polygon layer) | |||
@note: added in version 1.4*/ | @note: added in version 1.4*/ | |||
virtual bool doesStrictFeatureTypeCheck() const { return true;} | virtual bool doesStrictFeatureTypeCheck() const { return true;} | |||
/** Returns a list of available encodings */ | ||||
static const QStringList &availableEncodings(); | static const QStringList &availableEncodings(); | |||
/* provider has errors to report | /* provider has errors to report | |||
* @note added in 1.7 | * @note added in 1.7 | |||
*/ | */ | |||
bool hasErrors(); | bool hasErrors(); | |||
/* clear recorded errors | /* clear recorded errors | |||
* @note added in 1.7 | * @note added in 1.7 | |||
*/ | */ | |||
void clearErrors(); | void clearErrors(); | |||
/* get recorded errors | /* get recorded errors | |||
* @note added in 1.7 | * @note added in 1.7 | |||
*/ | */ | |||
QStringList errors(); | QStringList errors(); | |||
/** | ||||
* It returns false by default. | ||||
* Must be implemented by providers that support saving and loading sty | ||||
les to db returning true | ||||
*/ | ||||
virtual bool isSaveAndLoadStyleToDBSupported() { return false; } | ||||
protected: | protected: | |||
QVariant convertValue( QVariant::Type type, QString value ); | QVariant convertValue( QVariant::Type type, QString value ); | |||
void clearMinMaxCache(); | void clearMinMaxCache(); | |||
void fillMinMaxCache(); | void fillMinMaxCache(); | |||
bool mCacheMinMaxDirty; | bool mCacheMinMaxDirty; | |||
QMap<int, QVariant> mCacheMinValues, mCacheMaxValues; | QMap<int, QVariant> mCacheMinValues, mCacheMaxValues; | |||
/** Encoding */ | /** Encoding */ | |||
skipping to change at line 401 | skipping to change at line 363 | |||
bool mFetchGeom; | bool mFetchGeom; | |||
/**List of attribute indices to fetch with nextFeature calls*/ | /**List of attribute indices to fetch with nextFeature calls*/ | |||
QgsAttributeList mAttributesToFetch; | QgsAttributeList mAttributesToFetch; | |||
/**The names of the providers native types*/ | /**The names of the providers native types*/ | |||
QList< NativeType > mNativeTypes; | QList< NativeType > mNativeTypes; | |||
void pushError( QString msg ); | void pushError( QString msg ); | |||
/** Old-style mapping of index to name for QgsPalLabeling fix */ | ||||
QgsAttrPalIndexNameHash mAttrPalIndexName; | ||||
private: | private: | |||
/** old notation **/ | /** old notation **/ | |||
QMap<QString, QVariant::Type> mOldTypeList; | QMap<QString, QVariant::Type> mOldTypeList; | |||
// list of errors | // list of errors | |||
QStringList mErrors; | QStringList mErrors; | |||
static QStringList smEncodings; | static QStringList smEncodings; | |||
}; | }; | |||
End of changes. 18 change blocks. | ||||
82 lines changed or deleted | 37 lines changed or added | |||
qgsvectorfieldsymbollayerwidget.h | qgsvectorfieldsymbollayerwidget.h | |||
---|---|---|---|---|
skipping to change at line 38 | skipping to change at line 38 | |||
~QgsVectorFieldSymbolLayerWidget(); | ~QgsVectorFieldSymbolLayerWidget(); | |||
static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsVectorFieldSymbolLayerWidget( vl ); } | static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret urn new QgsVectorFieldSymbolLayerWidget( vl ); } | |||
// from base class | // from base class | |||
virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |||
virtual QgsSymbolLayerV2* symbolLayer(); | virtual QgsSymbolLayerV2* symbolLayer(); | |||
protected: | protected: | |||
QgsVectorFieldSymbolLayer* mLayer; | QgsVectorFieldSymbolLayer* mLayer; | |||
void updateMarkerIcon(); | ||||
private slots: | private slots: | |||
void on_mScaleSpinBox_valueChanged( double d ); | void on_mScaleSpinBox_valueChanged( double d ); | |||
void on_mXAttributeComboBox_currentIndexChanged( int index ); | void on_mXAttributeComboBox_currentIndexChanged( int index ); | |||
void on_mYAttributeComboBox_currentIndexChanged( int index ); | void on_mYAttributeComboBox_currentIndexChanged( int index ); | |||
void on_mLineStylePushButton_clicked(); | ||||
void on_mCartesianRadioButton_toggled( bool checked ); | void on_mCartesianRadioButton_toggled( bool checked ); | |||
void on_mPolarRadioButton_toggled( bool checked ); | void on_mPolarRadioButton_toggled( bool checked ); | |||
void on_mHeightRadioButton_toggled( bool checked ); | void on_mHeightRadioButton_toggled( bool checked ); | |||
void on_mDegreesRadioButton_toggled( bool checked ); | void on_mDegreesRadioButton_toggled( bool checked ); | |||
void on_mRadiansRadioButton_toggled( bool checked ); | void on_mRadiansRadioButton_toggled( bool checked ); | |||
void on_mClockwiseFromNorthRadioButton_toggled( bool checked ); | void on_mClockwiseFromNorthRadioButton_toggled( bool checked ); | |||
void on_mCounterclockwiseFromEastRadioButton_toggled( bool checked ); | void on_mCounterclockwiseFromEastRadioButton_toggled( bool checked ); | |||
void on_mDistanceUnitComboBox_currentIndexChanged( int index ); | ||||
}; | }; | |||
#endif // QGSVECTORFIELDSYMBOLLAYERWIDGET_H | #endif // QGSVECTORFIELDSYMBOLLAYERWIDGET_H | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added | |||
qgsvectorfilewriter.h | qgsvectorfilewriter.h | |||
---|---|---|---|---|
skipping to change at line 24 | skipping to change at line 24 | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef _QGSVECTORFILEWRITER_H_ | #ifndef _QGSVECTORFILEWRITER_H_ | |||
#define _QGSVECTORFILEWRITER_H_ | #define _QGSVECTORFILEWRITER_H_ | |||
#include "qgsvectorlayer.h" | #include "qgsvectorlayer.h" | |||
#include "qgsfield.h" | #include "qgsfield.h" | |||
#include "qgssymbolv2.h" | ||||
#include <ogr_api.h> | ||||
#include <QPair> | #include <QPair> | |||
typedef void *OGRDataSourceH; | class QgsSymbolLayerV2; | |||
typedef void *OGRLayerH; | ||||
typedef void *OGRGeometryH; | ||||
class QTextCodec; | class QTextCodec; | |||
/** \ingroup core | /** \ingroup core | |||
* A convenience class for writing vector files to disk. | * A convenience class for writing vector files to disk. | |||
There are two possibilities how to use this class: | There are two possibilities how to use this class: | |||
1. static call to QgsVectorFileWriter::writeAsShapefile(...) which saves t he whole vector layer | 1. static call to QgsVectorFileWriter::writeAsShapefile(...) which saves t he whole vector layer | |||
2. create an instance of the class and issue calls to addFeature(...) | 2. create an instance of the class and issue calls to addFeature(...) | |||
Currently supports only writing to shapefiles, but shouldn't be a problem to add capability | Currently supports only writing to shapefiles, but shouldn't be a problem to add capability | |||
to support other OGR-writable formats. | to support other OGR-writable formats. | |||
skipping to change at line 59 | skipping to change at line 58 | |||
ErrDriverNotFound, | ErrDriverNotFound, | |||
ErrCreateDataSource, | ErrCreateDataSource, | |||
ErrCreateLayer, | ErrCreateLayer, | |||
ErrAttributeTypeUnsupported, | ErrAttributeTypeUnsupported, | |||
ErrAttributeCreationFailed, | ErrAttributeCreationFailed, | |||
ErrProjection, // added in 1.5 | ErrProjection, // added in 1.5 | |||
ErrFeatureWriteFailed, // added in 1.6 | ErrFeatureWriteFailed, // added in 1.6 | |||
ErrInvalidLayer, // added in 2.0 | ErrInvalidLayer, // added in 2.0 | |||
}; | }; | |||
/** Write contents of vector layer to a shapefile | //added in 2.0 | |||
@deprecated Use writeAsVectorFormat instead*/ | enum SymbologyExport | |||
Q_DECL_DEPRECATED static WriterError writeAsShapefile( QgsVectorLayer* | { | |||
layer, | NoSymbology = 0, //export only data | |||
const QString& shapefileName, | FeatureSymbology, //Keeps the number of features and export symbology | |||
const QString& fileEncoding, | per feature | |||
const QgsCoordinateReferenceSystem *destCRS, | SymbolLayerSymbology //Exports one feature per symbol layer (consider | |||
bool onlySelected = false, | ing symbol levels) | |||
QString *errorMessage = 0, | }; | |||
const QStringList &datasourceOptions = QStringList(), // added in 1 | ||||
.6 | ||||
const QStringList &layerOptions = QStringList() // added in 1.6 | ||||
); | ||||
/** Write contents of vector layer to an (OGR supported) vector formt | /** Write contents of vector layer to an (OGR supported) vector formt | |||
@note: this method was added in version 1.5*/ | @note: this method was added in version 1.5 | |||
@param layer layer to write | ||||
@param fileName file name to write to | ||||
@param fileEncoding encoding to use | ||||
@param destCRS pointer to CRS to reproject exported geometries to | ||||
@param driverName OGR driver to use | ||||
@param onlySelected write only selected features of layer | ||||
@param errorMessage pointer to buffer fo error message | ||||
@param datasourceOptions list of OGR data source creation options | ||||
@param layerOptions list of OGR layer creation options | ||||
@param skipAttributeCreation only write geometries | ||||
@param newFilename QString pointer which will contain the new file name | ||||
created (in case it is different to fileName). | ||||
@param symbologyExport symbology to export | ||||
@param symbologyScale scale of symbology | ||||
*/ | ||||
static WriterError writeAsVectorFormat( QgsVectorLayer* layer, | static WriterError writeAsVectorFormat( QgsVectorLayer* layer, | |||
const QString& fileName, | const QString& fileName, | |||
const QString& fileEncoding, | const QString& fileEncoding, | |||
const QgsCoordinateReferenceSys tem *destCRS, | const QgsCoordinateReferenceSys tem *destCRS, | |||
const QString& driverName = "ES RI Shapefile", | const QString& driverName = "ES RI Shapefile", | |||
bool onlySelected = false, | bool onlySelected = false, | |||
QString *errorMessage = 0, | QString *errorMessage = 0, | |||
const QStringList &datasourceOp tions = QStringList(), // added in 1.6 | const QStringList &datasourceOp tions = QStringList(), // added in 1.6 | |||
const QStringList &layerOptions = QStringList(), // added in 1.6 | const QStringList &layerOptions = QStringList(), // added in 1.6 | |||
bool skipAttributeCreation = fa lse, // added in 1.6 | bool skipAttributeCreation = fa lse, // added in 1.6 | |||
QString *newFilename = 0 // add | QString *newFilename = 0, // ad | |||
ed in 1.9 | ded in 1.9 | |||
SymbologyExport symbologyExport | ||||
= NoSymbology, //added in 2.0 | ||||
double symbologyScale = 1.0 // | ||||
added in 2.0 | ||||
); | ); | |||
/** create shapefile and initialize it */ | /** create shapefile and initialize it */ | |||
QgsVectorFileWriter( const QString& vectorFileName, | QgsVectorFileWriter( const QString& vectorFileName, | |||
const QString& fileEncoding, | const QString& fileEncoding, | |||
const QgsFieldMap& fields, | const QgsFields& fields, | |||
QGis::WkbType geometryType, | QGis::WkbType geometryType, | |||
const QgsCoordinateReferenceSystem* srs, | const QgsCoordinateReferenceSystem* srs, | |||
const QString& driverName = "ESRI Shapefile", | const QString& driverName = "ESRI Shapefile", | |||
const QStringList &datasourceOptions = QStringList (), // added in 1.6 | const QStringList &datasourceOptions = QStringList (), // added in 1.6 | |||
const QStringList &layerOptions = QStringList(), / / added in 1.6 | const QStringList &layerOptions = QStringList(), / / added in 1.6 | |||
QString *newFilename = 0 // added in 1.9 | QString *newFilename = 0, // added in 1.9 | |||
SymbologyExport symbologyExport = NoSymbology//add | ||||
ed in 2.0 | ||||
); | ); | |||
/**Returns map with format filter string as key and OGR format key as v alue*/ | /**Returns map with format filter string as key and OGR format key as v alue*/ | |||
static QMap< QString, QString> supportedFiltersAndFormats(); | static QMap< QString, QString> supportedFiltersAndFormats(); | |||
/**Returns driver list that can be used for dialogs*/ | /**Returns driver list that can be used for dialogs. It contains all OG | |||
R drivers | ||||
* + some additional internal QGIS driver names to distinguish between | ||||
more | ||||
* supported formats of the same OGR driver | ||||
*/ | ||||
static QMap< QString, QString> ogrDriverList(); | static QMap< QString, QString> ogrDriverList(); | |||
/**Returns filter string that can be used for dialogs*/ | /**Returns filter string that can be used for dialogs*/ | |||
static QString fileFilterString(); | static QString fileFilterString(); | |||
/**Creates a filter for an OGR driver key*/ | /**Creates a filter for an OGR driver key*/ | |||
static QString filterForDriver( const QString& driverName ); | static QString filterForDriver( const QString& driverName ); | |||
/**Converts codec name to string passed to ENCODING layer creation opti | ||||
on of OGR Shapefile*/ | ||||
static QString convertCodecNameForEncodingOption( const QString &codecN | ||||
ame ); | ||||
/** checks whether there were any errors in constructor */ | /** checks whether there were any errors in constructor */ | |||
WriterError hasError(); | WriterError hasError(); | |||
/** retrieves error message | /** retrieves error message | |||
* @note added in 1.5 | * @note added in 1.5 | |||
*/ | */ | |||
QString errorMessage(); | QString errorMessage(); | |||
/** add feature to the currently opened shapefile */ | /** add feature to the currently opened shapefile */ | |||
bool addFeature( QgsFeature& feature ); | bool addFeature( QgsFeature& feature, QgsFeatureRendererV2* renderer = 0, QGis::UnitType outputUnit = QGis::Meters ); | |||
//! @note not available in python bindings | ||||
QMap<int, int> attrIdxToOgrIdx() { return mAttrIdxToOgrIdx; } | QMap<int, int> attrIdxToOgrIdx() { return mAttrIdxToOgrIdx; } | |||
/** close opened shapefile for writing */ | /** close opened shapefile for writing */ | |||
~QgsVectorFileWriter(); | ~QgsVectorFileWriter(); | |||
/** Delete a shapefile (and its accompanying shx / dbf / prf) | /** Delete a shapefile (and its accompanying shx / dbf / prf) | |||
* @param theFileName /path/to/file.shp | * @param theFileName /path/to/file.shp | |||
* @return bool true if the file was deleted successfully | * @return bool true if the file was deleted successfully | |||
*/ | */ | |||
static bool deleteShapeFile( QString theFileName ); | static bool deleteShapeFile( QString theFileName ); | |||
protected: | SymbologyExport symbologyExport() const { return mSymbologyExport; } | |||
void setSymbologyExport( SymbologyExport symExport ) { mSymbologyExport | ||||
= symExport; } | ||||
double symbologyScaleDenominator() const { return mSymbologyScaleDenomi | ||||
nator; } | ||||
void setSymbologyScaleDenominator( double d ) { mSymbologyScaleDenomina | ||||
tor = d; } | ||||
protected: | ||||
//! @note not available in python bindings | ||||
OGRGeometryH createEmptyGeometry( QGis::WkbType wkbType ); | OGRGeometryH createEmptyGeometry( QGis::WkbType wkbType ); | |||
OGRDataSourceH mDS; | OGRDataSourceH mDS; | |||
OGRLayerH mLayer; | OGRLayerH mLayer; | |||
OGRGeometryH mGeom; | OGRGeometryH mGeom; | |||
QgsFieldMap mFields; | QgsFields mFields; | |||
/** contains error value if construction was not successful */ | /** contains error value if construction was not successful */ | |||
WriterError mError; | WriterError mError; | |||
QString mErrorMessage; | QString mErrorMessage; | |||
QTextCodec *mCodec; | QTextCodec *mCodec; | |||
/** geometry type which is being used */ | /** geometry type which is being used */ | |||
QGis::WkbType mWkbType; | QGis::WkbType mWkbType; | |||
/** map attribute indizes to OGR field indexes */ | /** map attribute indizes to OGR field indexes */ | |||
QMap<int, int> mAttrIdxToOgrIdx; | QMap<int, int> mAttrIdxToOgrIdx; | |||
SymbologyExport mSymbologyExport; | ||||
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1700 | ||||
QMap< QgsSymbolLayerV2*, QString > mSymbolLayerTable; | ||||
#endif | ||||
/**Scale for symbology export (e.g. for symbols units in map units)*/ | ||||
double mSymbologyScaleDenominator; | ||||
private: | private: | |||
static bool driverMetadata( QString driverName, QString &longName, QStr ing &trLongName, QString &glob, QString &ext ); | static bool driverMetadata( QString driverName, QString &longName, QStr ing &trLongName, QString &glob, QString &ext ); | |||
void createSymbolLayerTable( QgsVectorLayer* vl, const QgsCoordinateTr | ||||
ansform* ct, OGRDataSourceH ds ); | ||||
OGRFeatureH createFeature( QgsFeature& feature ); | ||||
bool writeFeature( OGRLayerH layer, OGRFeatureH feature ); | ||||
/**Writes features considering symbol level order*/ | ||||
WriterError exportFeaturesSymbolLevels( QgsVectorLayer* layer, QgsFeatu | ||||
reIterator& fit, const QgsCoordinateTransform* ct, QString* errorMessage = | ||||
0 ); | ||||
double mmScaleFactor( double scaleDenominator, QgsSymbolV2::OutputUnit | ||||
symbolUnits, QGis::UnitType mapUnits ); | ||||
double mapUnitScaleFactor( double scaleDenominator, QgsSymbolV2::Output | ||||
Unit symbolUnits, QGis::UnitType mapUnits ); | ||||
QgsRenderContext renderContext() const; | ||||
void startRender( QgsVectorLayer* vl ) const; | ||||
void stopRender( QgsVectorLayer* vl ) const; | ||||
QgsFeatureRendererV2* symbologyRenderer( QgsVectorLayer* vl ) const; | ||||
/**Adds attributes needed for classification*/ | ||||
void addRendererAttributes( QgsVectorLayer* vl, QgsAttributeList& attLi | ||||
st ); | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 16 change blocks. | ||||
26 lines changed or deleted | 92 lines changed or added | |||
qgsvectorgradientcolorrampv2dialog.h | qgsvectorgradientcolorrampv2dialog.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsvectorgradientcolorrampv2dialog.h | qgsvectorgradientcolorrampv2dialog.h | |||
--------------------- | --------------------- | |||
begin : December 2009 | begin : December 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSVECTORGRADIENTCOLORRAMPV2DIALOG_H | #ifndef QGSVECTORGRADIENTCOLORRAMPV2DIALOG_H | |||
skipping to change at line 33 | skipping to change at line 33 | |||
class QgsVectorGradientColorRampV2; | class QgsVectorGradientColorRampV2; | |||
class GUI_EXPORT QgsVectorGradientColorRampV2Dialog : public QDialog, priva te Ui::QgsVectorGradientColorRampV2DialogBase | class GUI_EXPORT QgsVectorGradientColorRampV2Dialog : public QDialog, priva te Ui::QgsVectorGradientColorRampV2DialogBase | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QgsVectorGradientColorRampV2Dialog( QgsVectorGradientColorRampV2* ramp, QWidget* parent = NULL ); | QgsVectorGradientColorRampV2Dialog( QgsVectorGradientColorRampV2* ramp, QWidget* parent = NULL ); | |||
public slots: | public slots: | |||
void setColor1(); | void setColor1( const QColor& color ); | |||
void setColor2(); | void setColor2( const QColor& color ); | |||
void toggledStops( bool on ); | void toggledStops( bool on ); | |||
void addStop(); | void addStop(); | |||
void removeStop(); | void removeStop(); | |||
void stopDoubleClicked( QTreeWidgetItem* item, int column ); | void stopDoubleClicked( QTreeWidgetItem* item, int column ); | |||
void setItemStopColor( const QColor& newColor ); | ||||
protected slots: | ||||
void on_cboType_currentIndexChanged( int index ); | ||||
void on_btnInformation_pressed(); | ||||
protected: | protected: | |||
void updateStops(); | ||||
void updatePreview(); | void updatePreview(); | |||
void setStopColor( QTreeWidgetItem* item, QColor color ); | void setStopColor( QTreeWidgetItem* item, QColor color ); | |||
QgsVectorGradientColorRampV2* mRamp; | QgsVectorGradientColorRampV2* mRamp; | |||
static const int StopColorRole = Qt::UserRole + 1; | static const int StopColorRole = Qt::UserRole + 1; | |||
static const int StopOffsetRole = Qt::UserRole + 2; | static const int StopOffsetRole = Qt::UserRole + 2; | |||
QTreeWidgetItem* mCurrentItem; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 5 change blocks. | ||||
3 lines changed or deleted | 11 lines changed or added | |||
qgsvectorlayer.h | qgsvectorlayer.h | |||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
#define QGSVECTORLAYER_H | #define QGSVECTORLAYER_H | |||
#include <QMap> | #include <QMap> | |||
#include <QSet> | #include <QSet> | |||
#include <QList> | #include <QList> | |||
#include <QStringList> | #include <QStringList> | |||
#include "qgis.h" | #include "qgis.h" | |||
#include "qgsmaplayer.h" | #include "qgsmaplayer.h" | |||
#include "qgsfeature.h" | #include "qgsfeature.h" | |||
#include "qgsfeatureiterator.h" | ||||
#include "qgsfield.h" | ||||
#include "qgssnapper.h" | #include "qgssnapper.h" | |||
#include "qgsfield.h" | #include "qgsfield.h" | |||
class QPainter; | class QPainter; | |||
class QImage; | class QImage; | |||
class QgsAttributeAction; | class QgsAttributeAction; | |||
class QgsCoordinateTransform; | class QgsCoordinateTransform; | |||
class QgsFeatureRequest; | ||||
class QgsGeometry; | class QgsGeometry; | |||
class QgsGeometryVertexIndex; | class QgsGeometryVertexIndex; | |||
class QgsMapToPixel; | class QgsMapToPixel; | |||
class QgsLabel; | class QgsLabel; | |||
class QgsRectangle; | class QgsRectangle; | |||
class QgsRenderer; | ||||
class QgsUndoCommand; | ||||
class QgsVectorDataProvider; | class QgsVectorDataProvider; | |||
class QgsVectorOverlay; | ||||
class QgsSingleSymbolRendererV2; | class QgsSingleSymbolRendererV2; | |||
class QgsRectangle; | class QgsRectangle; | |||
class QgsVectorLayerJoinBuffer; | class QgsVectorLayerJoinBuffer; | |||
class QgsFeatureRendererV2; | class QgsFeatureRendererV2; | |||
class QgsDiagramRendererV2; | class QgsDiagramRendererV2; | |||
struct QgsDiagramLayerSettings; | class QgsDiagramLayerSettings; | |||
class QgsGeometryCache; | ||||
class QgsVectorLayerEditBuffer; | ||||
class QgsSymbolV2; | ||||
typedef QList<int> QgsAttributeList; | typedef QList<int> QgsAttributeList; | |||
typedef QSet<int> QgsAttributeIds; | typedef QSet<int> QgsAttributeIds; | |||
/** @note Added in 1.9 */ | ||||
class CORE_EXPORT QgsAttributeEditorElement : public QObject | ||||
{ | ||||
Q_OBJECT | ||||
public: | ||||
enum AttributeEditorType | ||||
{ | ||||
AeTypeContainer, | ||||
AeTypeField, | ||||
AeTypeInvalid | ||||
}; | ||||
QgsAttributeEditorElement( AttributeEditorType type, QString name, QObj | ||||
ect *parent = NULL ) | ||||
: QObject( parent ), mType( type ), mName( name ) {} | ||||
virtual ~QgsAttributeEditorElement() {} | ||||
QString name() const { return mName; } | ||||
AttributeEditorType type() const { return mType; } | ||||
virtual QDomElement toDomElement( QDomDocument& doc ) const = 0; | ||||
protected: | ||||
AttributeEditorType mType; | ||||
QString mName; | ||||
}; | ||||
/** @note Added in 1.9 */ | ||||
class CORE_EXPORT QgsAttributeEditorContainer : public QgsAttributeEditorEl | ||||
ement | ||||
{ | ||||
public: | ||||
QgsAttributeEditorContainer( QString name, QObject *parent ) | ||||
: QgsAttributeEditorElement( AeTypeContainer, name, parent ) {} | ||||
~QgsAttributeEditorContainer() {} | ||||
virtual QDomElement toDomElement( QDomDocument& doc ) const; | ||||
virtual void addChildElement( QgsAttributeEditorElement *widget ); | ||||
QList<QgsAttributeEditorElement*> children() const { return mChildren; | ||||
} | ||||
private: | ||||
QList<QgsAttributeEditorElement*> mChildren; | ||||
}; | ||||
/** @note Added in 1.9 */ | ||||
class CORE_EXPORT QgsAttributeEditorField : public QgsAttributeEditorElemen | ||||
t | ||||
{ | ||||
public: | ||||
QgsAttributeEditorField( QString name , int idx, QObject *parent ) | ||||
: QgsAttributeEditorElement( AeTypeField, name, parent ), mIdx( idx | ||||
) {} | ||||
~QgsAttributeEditorField() {} | ||||
virtual QDomElement toDomElement( QDomDocument& doc ) const; | ||||
int idx() const { return mIdx; } | ||||
private: | ||||
int mIdx; | ||||
}; | ||||
/** @note added in 1.7 */ | /** @note added in 1.7 */ | |||
struct CORE_EXPORT QgsVectorJoinInfo | struct CORE_EXPORT QgsVectorJoinInfo | |||
{ | { | |||
/**Join field in the target layer*/ | /**Join field in the target layer*/ | |||
int targetField; | QString targetFieldName; | |||
/**Source layer*/ | /**Source layer*/ | |||
QString joinLayerId; | QString joinLayerId; | |||
/**Join field in the source layer*/ | /**Join field in the source layer*/ | |||
int joinField; | QString joinFieldName; | |||
/**True if the join is cached in virtual memory*/ | /**True if the join is cached in virtual memory*/ | |||
bool memoryCache; | bool memoryCache; | |||
/**Cache for joined attributes to provide fast lookup (size is 0 if no me | /**Cache for joined attributes to provide fast lookup (size is 0 if no me | |||
mory caching)*/ | mory caching) | |||
QHash< QString, QgsAttributeMap> cachedAttributes; | @note not available in python bindings | |||
}; | */ | |||
QHash< QString, QgsAttributes> cachedAttributes; | ||||
/** Join information prepared for fast attribute id mapping in QgsVectorLay | /**Join field index in the target layer. For backward compatibility with | |||
erJoinBuffer::updateFeatureAttributes(). | 1.x (x>=7)*/ | |||
Created in the select() method of QgsVectorLayerJoinBuffer for the joins | int targetFieldIndex; | |||
that contain fetched attributes | /**Join field index in the source layer. For backward compatibility with | |||
@note added in 1.7 | 1.x (x>=7)*/ | |||
*/ | int joinFieldIndex; | |||
struct CORE_EXPORT QgsFetchJoinInfo | ||||
{ | ||||
const QgsVectorJoinInfo* joinInfo; | ||||
QgsAttributeList attributes; //attributes to fetch | ||||
int indexOffset; //index offset between this layer and join layer | ||||
}; | }; | |||
/** \ingroup core | /** \ingroup core | |||
* Vector layer backed by a data source provider. | * Represents a vector layer which manages a vector based data sets. | |||
* | ||||
* The QgsVectorLayer is instantiated by specifying the name of a data prov | ||||
ider, | ||||
* such as postgres or wfs, and url defining the specific data set to conne | ||||
ct to. | ||||
* The vector layer constructor in turn instantiates a QgsVectorDataProvide | ||||
r subclass | ||||
* corresponding to the provider type, and passes it the url. The data pro | ||||
vider | ||||
* connects to the data source. | ||||
* | ||||
* The QgsVectorLayer provides a common interface to the different data typ | ||||
es. It also | ||||
* manages editing transactions. | ||||
* | ||||
* Sample usage of the QgsVectorLayer class: | ||||
* | ||||
* \code | ||||
* QString uri = "point?crs=epsg:4326&field=id:integer"; | ||||
* QgsVectorLayer *scratchLayer = new QgsVectorLayer(uri, "Scratch poin | ||||
t layer", "memory"); | ||||
* \endcode | ||||
* | ||||
* The main data providers supported by QGIS are listed below. | ||||
* | ||||
* \section providers Vector data providers | ||||
* | ||||
* \subsection memory Memory data providerType (memory) | ||||
* | ||||
* The memory data provider is used to construct in memory data, for exampl | ||||
e scratch | ||||
* data or data generated from spatial operations such as contouring. Ther | ||||
e is no | ||||
* inherent persistent storage of the data. The data source uri is constru | ||||
cted. The | ||||
* url specifies the geometry type ("point", "linestring", "polygon", | ||||
* "multipoint","multilinestring","multipolygon"), optionally followed by u | ||||
rl parameters | ||||
* as follows: | ||||
* | ||||
* - crs=definition | ||||
* Defines the coordinate reference system to use for the layer. | ||||
* definition is any string accepted by QgsCoordinateReferenceSystem::cre | ||||
ateFromString() | ||||
* | ||||
* - index=yes | ||||
* Specifies that the layer will be constructed with a spatial index | ||||
* | ||||
* - field=name:type(length,precision) | ||||
* Defines an attribute of the layer. Multiple field parameters can be a | ||||
dded | ||||
* to the data provider definition. type is one of "integer", "double", | ||||
"string". | ||||
* | ||||
* An example url is "Point?crs=epsg:4326&field=id:integer&field=name:strin | ||||
g(20)&index=yes" | ||||
* | ||||
* \subsection ogr OGR data provider (ogr) | ||||
* | ||||
* Accesses data using the OGR drivers (http://www.gdal.org/ogr/ogr_formats | ||||
.html). The url | ||||
* is the OGR connection string. A wide variety of data formats can be acc | ||||
essed using this | ||||
* driver, including file based formats used by many GIS systems, database | ||||
formats, and | ||||
* web services. Some of these formats are also supported by custom data p | ||||
roviders listed | ||||
* below. | ||||
* | ||||
* \subsection spatialite Spatialite data provider (spatialite) | ||||
* | ||||
* Access data in a spatialite database. The url defines the connection par | ||||
ameters, table, | ||||
* geometry column, and other attributes. The url can be constructed using | ||||
the | ||||
* QgsDataSourceURI class. | ||||
* | ||||
* \subsection postgres Postgresql data provider (postgres) | ||||
* | ||||
* Connects to a postgresql database. The url defines the connection param | ||||
eters, table, | ||||
* geometry column, and other attributes. The url can be constructed using | ||||
the | ||||
* QgsDataSourceURI class. | ||||
* | ||||
* \subsection mssql Microsoft SQL server data provider (mssql) | ||||
* | ||||
* Connects to a Microsoft SQL server database. The url defines the connec | ||||
tion parameters, table, | ||||
* geometry column, and other attributes. The url can be constructed using | ||||
the | ||||
* QgsDataSourceURI class. | ||||
* | ||||
* \subsection sqlanywhere SQL Anywhere data provider (sqlanywhere) | ||||
* | ||||
* Connects to an SQLanywhere database. The url defines the connection par | ||||
ameters, table, | ||||
* geometry column, and other attributes. The url can be constructed using | ||||
the | ||||
* QgsDataSourceURI class. | ||||
* | ||||
* \subsection wfs WFS (web feature service) data provider (wfs) | ||||
* | ||||
* Used to access data provided by a web feature service. | ||||
* | ||||
* The url can be a HTTP url to a WFS 1.0.0 server or a GML2 data file path | ||||
. | ||||
* Examples are http://foobar/wfs or /foo/bar/file.gml | ||||
* | ||||
* If a GML2 file path is provided the driver will attempt to read the sche | ||||
ma from a | ||||
* file in the same directory with the same basename + “.xsd”. This xsd fil | ||||
e must be | ||||
* in the same format as a WFS describe feature type response. If no xsd fi | ||||
le is provide | ||||
* then the driver will attempt to guess the attribute types from the file. | ||||
* | ||||
* In the case of a HTTP URL the ‘FILTER’ query string parameter can be use | ||||
d to filter | ||||
* the WFS feature type. The ‘FILTER’ key value can either be a QGIS expres | ||||
sion | ||||
* or an OGC XML filter. If the value is set to a QGIS expression the drive | ||||
r will | ||||
* turn it into OGC XML filter before passing it to the WFS server. Beware | ||||
the | ||||
* QGIS expression filter only supports” =, != ,<,> ,<= ,>= ,AND ,OR ,NOT, | ||||
LIKE, IS NULL” | ||||
* attribute operators, “BBOX, Disjoint, Intersects, Touches, Crosses, Cont | ||||
ains, Overlaps, Within” | ||||
* spatial binary operators and the QGIS local “geomFromWKT, geomFromGML” | ||||
* geometry constructor functions. | ||||
* | ||||
* Also note: | ||||
* | ||||
* - You can use various functions available in the QGIS Expression list, | ||||
* however the function must exist server side and have the same name and | ||||
arguments to work. | ||||
* | ||||
* - Use the special $geometry parameter to provide the layer geometry colu | ||||
mn as input | ||||
* into the spatial binary operators e.g intersects($geometry, geomFromWK | ||||
T('POINT (5 6)')) | ||||
* | ||||
* \subsection delimitedtext Delimited text file data provider (delimitedte | ||||
xt) | ||||
* | ||||
* Accesses data in a delimited text file, for example CSV files generated | ||||
by | ||||
* spreadsheets. The contents of the file are split into columns based on s | ||||
pecified | ||||
* delimiter characters. Each record may be represented spatially either b | ||||
y an | ||||
* X and Y coordinate column, or by a WKT (well known text) formatted colum | ||||
ns. | ||||
* | ||||
* The url defines the filename, the formatting options (how the | ||||
* text in the file is divided into data fields, and which fields contain t | ||||
he | ||||
* X,Y coordinates or WKT text definition. The options are specified as ur | ||||
l query | ||||
* items. | ||||
* | ||||
* At its simplest the url can just be the filename, in which case it will | ||||
be loaded | ||||
* as a CSV formatted file. | ||||
* | ||||
* The url may include the following items: | ||||
* | ||||
* - encoding=UTF-8 | ||||
* | ||||
* Defines the character encoding in the file. The default is UTF-8. To | ||||
use | ||||
* the default encoding for the operating system use "System". | ||||
* | ||||
* - type=(csv|regexp|whitespace|plain) | ||||
* | ||||
* Defines the algorithm used to split records into columns. Records are | ||||
* defined by new lines, except for csv format files for which quoted fie | ||||
lds | ||||
* may span multiple records. The default type is csv. | ||||
* | ||||
* - "csv" splits the file based on three sets of characters: | ||||
* delimiter characters, quote characters, | ||||
* and escape characters. Delimiter characters mark the end | ||||
* of a field. Quote characters enclose a field which can contain | ||||
* delimiter characters, and newlines. Escape characters cause the | ||||
* following character to be treated literally (including delimiter, | ||||
* quote, and newline characters). Escape and quote characters must | ||||
* be different from delimiter characters. Escape characters that are | ||||
* also quote characters are treated specially - they can only | ||||
* escape themselves within quotes. Elsewhere they are treated as | ||||
* quote characters. The defaults for delimiter, quote, and escape | ||||
* are ',', '"', '"'. | ||||
* - "regexp" splits each record using a regular expression (see QRegExp | ||||
* documentation for details). | ||||
* - "whitespace" splits each record based on whitespace (on or more whi | ||||
tespace | ||||
* characters. Leading whitespace in the record is ignored. | ||||
* - "plain" is provided for backwards compatibility. It is equivalent | ||||
to | ||||
* CSV except that the default quote characters are single and double | ||||
quotes, | ||||
* and there is no escape characters. | ||||
* | ||||
* - delimiter=characters | ||||
* | ||||
* Defines the delimiter characters used for csv and plain type files, or | ||||
the | ||||
* regular expression for regexp type files. It is a literal string of c | ||||
haracters | ||||
* except that "\t" may be used to represent a tab character. | ||||
* | ||||
* - quote=characters | ||||
* | ||||
* Defines the characters that are used as quote characters for csv and p | ||||
lain type | ||||
* files. | ||||
* | ||||
* - escape=characters | ||||
* | ||||
* Defines the characters used to escape delimiter, quote, and newline ch | ||||
aracters. | ||||
* | ||||
* - skipLines=n | ||||
* | ||||
* Defines the number of lines to ignore at the beginning of the file (de | ||||
fault 0) | ||||
* | ||||
* - useHeader=(yes|no) | ||||
* | ||||
* Defines whether the first record in the file (after skipped lines) con | ||||
tains | ||||
* column names (default yes) | ||||
* | ||||
* - trimFields=(yes|no) | ||||
* | ||||
* If yes then leading and trailing whitespace will be removed from field | ||||
s | ||||
* | ||||
* - skipEmptyFields=(yes|no) | ||||
* | ||||
* If yes then empty fields will be discarded (eqivalent to concatenating | ||||
consecutive | ||||
* delimiters) | ||||
* | ||||
* - maxFields=# | ||||
* | ||||
* Specifies the maximum number of fields to load for each record. Addit | ||||
ional | ||||
* fields will be discarded. Default is 0 - load all fields. | ||||
* | ||||
* - decimalPoint=c | ||||
* | ||||
* Defines a character that is used as a decimal point in the numeric col | ||||
umns | ||||
* The default is '.'. | ||||
* | ||||
* - xField=column yField=column | ||||
* | ||||
* Defines the name of the columns holding the x and y coordinates for XY | ||||
point geometries. | ||||
* If the useHeader is no (ie there are no column names), then this is th | ||||
e column | ||||
* number (with the first column as 1). | ||||
* | ||||
* - xyDms=(yes|no) | ||||
* | ||||
* If yes then the X and Y coordinates are interpreted as | ||||
* degrees/minutes/seconds format (fairly permissively), | ||||
* or degree/minutes format. | ||||
* | ||||
* - wktField=column | ||||
* | ||||
* Defines the name of the columns holding the WKT geometry definition fo | ||||
r WKT geometries. | ||||
* If the useHeader is no (ie there are no column names), then this is th | ||||
e column | ||||
* number (with the first column as 1). | ||||
* | ||||
* - geomType=(point|line|polygon|none) | ||||
* | ||||
* Defines the geometry type for WKT type geometries. QGIS will only dis | ||||
play one | ||||
* type of geometry for the layer - any others will be ignored when the f | ||||
ile is | ||||
* loaded. By default the provider uses the type of the first geometry i | ||||
n the file. | ||||
* Use geomType to override this type. | ||||
* | ||||
* geomType can also be set to none, in which case the layer is loaded wi | ||||
thout | ||||
* geometries. | ||||
* | ||||
* - subset=expression | ||||
* | ||||
* Defines an expression that will identify a subset of records to displa | ||||
y | ||||
* | ||||
* - crs=crsstring | ||||
* | ||||
* Defines the coordinate reference system used for the layer. This can | ||||
be | ||||
* any string accepted by QgsCoordinateReferenceSystem::createFromString( | ||||
) | ||||
* | ||||
* -subsetIndex=(yes|no) | ||||
* | ||||
* Determines whether the provider generates an index to improve the effi | ||||
ciency | ||||
* of subsets. The default is yes | ||||
* | ||||
* -spatialIndex=(yes|no) | ||||
* | ||||
* Determines whether the provider generates a spatial index. The defaul | ||||
t is no. | ||||
* | ||||
* -watchFile=(yes|no) | ||||
* | ||||
* Defines whether the file will be monitored for changes. The default is | ||||
* to monitor for changes. | ||||
* | ||||
* - quiet | ||||
* | ||||
* Errors encountered loading the file will not be reported in a user dia | ||||
log if | ||||
* quiet is included (They will still be shown in the output log). | ||||
* | ||||
* \subsection gpx GPX data provider (gpx) | ||||
* | ||||
* Provider reads tracks, routes, and waypoints from a GPX file. The url | ||||
* defines the name of the file, and the type of data to retrieve from it | ||||
* ("track", "route", or "waypoint"). | ||||
* | ||||
* An example url is "/home/user/data/holiday.gpx?type=route" | ||||
* | ||||
* \subsection grass Grass data provider (grass) | ||||
* | ||||
* Provider to display vector data in a GRASS GIS layer. | ||||
* | ||||
*/ | */ | |||
class CORE_EXPORT QgsVectorLayer : public QgsMapLayer | class CORE_EXPORT QgsVectorLayer : public QgsMapLayer | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
/** The different types to layout the attribute editor. @note added in | ||||
1.9 */ | ||||
enum EditorLayout | ||||
{ | ||||
GeneratedLayout = 0, | ||||
TabLayout = 1, | ||||
UiFileLayout = 2 | ||||
}; | ||||
enum EditType | enum EditType | |||
{ | { | |||
LineEdit, | LineEdit, | |||
UniqueValues, | UniqueValues, | |||
UniqueValuesEditable, | UniqueValuesEditable, | |||
ValueMap, | ValueMap, | |||
Classification, | Classification, | |||
EditRange, | EditRange, | |||
SliderRange, | SliderRange, | |||
CheckBox, /* added in 1.4 */ | CheckBox, /**< @note added in 1.4 */ | |||
FileName, | FileName, | |||
Enumeration, | Enumeration, | |||
Immutable, /* The attribute value should not be changed in the at | Immutable, /**< The attribute value should not be changed in the | |||
tribute form*/ | attribute form */ | |||
Hidden, /* The attribute value should not be shown in the attr | Hidden, /**< The attribute value should not be shown in the at | |||
ibute form @added in 1.4 */ | tribute form @note added in 1.4 */ | |||
TextEdit, /* multiline edit @added in 1.4*/ | TextEdit, /**< multiline edit @note added in 1.4*/ | |||
Calendar, /* calendar widget @added in 1.5 */ | Calendar, /**< calendar widget @note added in 1.5 */ | |||
DialRange, /* dial range @added in 1.5 */ | DialRange, /**< dial range @note added in 1.5 */ | |||
ValueRelation, /* value map from an table @added in 1.8 */ | ValueRelation, /**< value map from an table @note added in 1.8 */ | |||
UuidGenerator, /* uuid generator - readonly and automatically intiali | UuidGenerator, /**< uuid generator - readonly and automatically intia | |||
zed @added in 1.9 */ | lized @note added in 1.9 */ | |||
Photo, /**< phote widget @note added in 1.9 */ | ||||
WebView, /**< webview widget @note added in 1.9 */ | ||||
Color, /**< color @note added in 1.9 */ | ||||
}; | }; | |||
struct RangeData | struct RangeData | |||
{ | { | |||
RangeData() {} | RangeData() {} | |||
RangeData( QVariant theMin, QVariant theMax, QVariant theStep ) | RangeData( QVariant theMin, QVariant theMax, QVariant theStep ) | |||
: mMin( theMin ), mMax( theMax ), mStep( theStep ) {} | : mMin( theMin ), mMax( theMax ), mStep( theStep ) {} | |||
QVariant mMin; | QVariant mMin; | |||
QVariant mMax; | QVariant mMax; | |||
QVariant mStep; | QVariant mStep; | |||
}; | }; | |||
struct ValueRelationData | struct ValueRelationData | |||
{ | { | |||
ValueRelationData() {} | ValueRelationData() {} | |||
ValueRelationData( QString layer, QString key, QString value, bool al | ValueRelationData( QString layer, QString key, QString value, bool al | |||
lowNull, bool orderByValue ) | lowNull, bool orderByValue, | |||
: mLayer( layer ), mKey( key ), mValue( value ), mAllowNull( allo | bool allowMulti = false, | |||
wNull ), mOrderByValue( orderByValue ) {} | QString filterExpression = QString::null ) | |||
: mLayer( layer ) | ||||
, mKey( key ) | ||||
, mValue( value ) | ||||
, mFilterExpression( filterExpression ) | ||||
, mAllowNull( allowNull ) | ||||
, mOrderByValue( orderByValue ) | ||||
, mAllowMulti( allowMulti ) | ||||
{} | ||||
QString mLayer; | QString mLayer; | |||
QString mKey; | QString mKey; | |||
QString mValue; | QString mValue; | |||
QString mFilterExpression; | ||||
bool mAllowNull; | bool mAllowNull; | |||
bool mOrderByValue; | bool mOrderByValue; | |||
bool mAllowMulti; /* allow selection of multiple keys @added in 1.9 | ||||
*/ | ||||
}; | ||||
struct GroupData | ||||
{ | ||||
GroupData() {} | ||||
GroupData( QString name , QList<QString> fields ) | ||||
: mName( name ), mFields( fields ) {} | ||||
QString mName; | ||||
QList<QString> mFields; | ||||
}; | }; | |||
/** Constructor */ | struct TabData | |||
{ | ||||
TabData() {} | ||||
TabData( QString name , QList<QString> fields , QList<GroupData> grou | ||||
ps ) | ||||
: mName( name ), mFields( fields ), mGroups( groups ) {} | ||||
QString mName; | ||||
QList<QString> mFields; | ||||
QList<GroupData> mGroups; | ||||
}; | ||||
/** Constructor - creates a vector layer | ||||
* | ||||
* The QgsVectorLayer is constructed by instantiating a data provider. | ||||
The provider | ||||
* interprets the supplied path (url) of the data source to connect to | ||||
and access the | ||||
* data. | ||||
* | ||||
* @param path The path or url of the parameter. Typically this enco | ||||
des | ||||
* parameters used by the data provider as url query item | ||||
s. | ||||
* @param baseName The name used to represent the layer in the legend | ||||
* @param providerLib The name of the data provider, eg "memory", "po | ||||
stgres" | ||||
* @param loadDefaultStyleFlag whether to load the default style | ||||
* | ||||
*/ | ||||
QgsVectorLayer( QString path = QString::null, QString baseName = QStrin g::null, | QgsVectorLayer( QString path = QString::null, QString baseName = QStrin g::null, | |||
QString providerLib = QString::null, bool loadDefaultSt yleFlag = true ); | QString providerLib = QString::null, bool loadDefaultSt yleFlag = true ); | |||
/** Destructor */ | /** Destructor */ | |||
virtual ~QgsVectorLayer(); | virtual ~QgsVectorLayer(); | |||
/** Returns the permanent storage type for this layer as a friendly nam e. */ | /** Returns the permanent storage type for this layer as a friendly nam e. */ | |||
QString storageType() const; | QString storageType() const; | |||
/** Capabilities for this layer in a friendly format. */ | /** Capabilities for this layer in a friendly format. */ | |||
skipping to change at line 157 | skipping to change at line 534 | |||
/** Returns a comment for the data in the layer */ | /** Returns a comment for the data in the layer */ | |||
QString dataComment() const; | QString dataComment() const; | |||
/** Set the primary display field to be used in the identify results di alog */ | /** Set the primary display field to be used in the identify results di alog */ | |||
void setDisplayField( QString fldName = "" ); | void setDisplayField( QString fldName = "" ); | |||
/** Returns the primary display field name used in the identify results dialog */ | /** Returns the primary display field name used in the identify results dialog */ | |||
const QString displayField() const; | const QString displayField() const; | |||
/** Set the preview expression, used to create a human readable preview | ||||
string. | ||||
* Used e.g. in the attribute table feature list. Uses { @link QgsExpr | ||||
ession }. | ||||
* | ||||
* @param displayExpression The expression which will be used to previ | ||||
ew features | ||||
* for this layer | ||||
* @note added in 2.0 | ||||
*/ | ||||
void setDisplayExpression( const QString displayExpression ); | ||||
/** | ||||
* Get the preview expression, used to create a human readable preview | ||||
string. | ||||
* Uses { @link QgsExpression } | ||||
* | ||||
* @return The expression which will be used to preview features for t | ||||
his layer | ||||
* | ||||
* @note added in 2.0 | ||||
*/ | ||||
const QString displayExpression(); | ||||
/** Returns the data provider */ | /** Returns the data provider */ | |||
QgsVectorDataProvider* dataProvider(); | QgsVectorDataProvider* dataProvider(); | |||
/** Returns the data provider in a const-correct manner */ | /** Returns the data provider in a const-correct manner | |||
@note not available in python bindings | ||||
*/ | ||||
const QgsVectorDataProvider* dataProvider() const; | const QgsVectorDataProvider* dataProvider() const; | |||
/** Sets the textencoding of the data provider */ | /** Sets the textencoding of the data provider */ | |||
void setProviderEncoding( const QString& encoding ); | void setProviderEncoding( const QString& encoding ); | |||
/** Setup the coordinate system tranformation for the layer */ | /** Setup the coordinate system tranformation for the layer */ | |||
void setCoordinateSystem(); | void setCoordinateSystem(); | |||
/** Joins another vector layer to this layer | /** Joins another vector layer to this layer | |||
@param joinInfo join object containing join layer id, target and sour ce field | @param joinInfo join object containing join layer id, target and sour ce field | |||
@note added in 1.7 */ | @note added in 1.7 */ | |||
void addJoin( QgsVectorJoinInfo joinInfo ); | void addJoin( const QgsVectorJoinInfo& joinInfo ); | |||
/** Removes a vector layer join | /** Removes a vector layer join | |||
@note added in 1.7 */ | @note added in 1.7 */ | |||
void removeJoin( const QString& joinLayerId ); | void removeJoin( const QString& joinLayerId ); | |||
/** @note added in 1.7 */ | /** @note added in 1.7 */ | |||
const QList< QgsVectorJoinInfo >& vectorJoins() const; | const QList< QgsVectorJoinInfo >& vectorJoins() const; | |||
/** Get the label object associated with this layer */ | /** Get the label object associated with this layer */ | |||
QgsLabel *label(); | QgsLabel *label(); | |||
const QgsLabel *label() const; | const QgsLabel *label() const; | |||
QgsAttributeAction* actions() { return mActions; } | QgsAttributeAction *actions() { return mActions; } | |||
/** The number of features that are selected in this layer */ | /** | |||
* The number of features that are selected in this layer | ||||
* | ||||
* @return See description | ||||
*/ | ||||
int selectedFeatureCount(); | int selectedFeatureCount(); | |||
/** Select features found within the search rectangle (in layer's coord | /** | |||
inates) */ | * Select features found within the search rectangle (in layer's coordi | |||
void select( QgsRectangle & rect, bool lock ); | nates) | |||
* | ||||
* @param rect The search rectangle | ||||
* @param addToSelection If set to true will not clear before selectin | ||||
g | ||||
* | ||||
* @see invertSelectionInRectangle(QgsRectangle & rect) | ||||
*/ | ||||
void select( QgsRectangle & rect, bool addToSelection ); | ||||
/** | ||||
* Modifies the current selection on this layer | ||||
* | ||||
* @param selectIds Select these ids | ||||
* @param deselectIds Deselect these ids | ||||
* | ||||
* @see select(QgsFeatureIds) | ||||
* @see select(QgsFeatureId) | ||||
* @see deselect(QgsFeatureIds) | ||||
* @see deselect(QgsFeatureId) | ||||
*/ | ||||
void modifySelection( QgsFeatureIds selectIds, QgsFeatureIds deselectId | ||||
s ); | ||||
/** Select not selected features and deselect selected ones */ | /** Select not selected features and deselect selected ones */ | |||
void invertSelection(); | void invertSelection(); | |||
/** Invert selection of features found within the search rectangle (in | /** Select all the features */ | |||
layer's coordinates) */ | void selectAll(); | |||
/** | ||||
* Invert selection of features found within the search rectangle (in l | ||||
ayer's coordinates) | ||||
* | ||||
* @param rect The rectangle in which the selection of features will b | ||||
e inverted | ||||
* | ||||
* @see invertSelection() | ||||
*/ | ||||
void invertSelectionInRectangle( QgsRectangle & rect ); | void invertSelectionInRectangle( QgsRectangle & rect ); | |||
/** Get a copy of the user-selected features */ | /** | |||
* Get a copy of the user-selected features | ||||
* | ||||
* @return A list of { @link QgsFeature } 's | ||||
* | ||||
* @see selectedFeaturesIds() | ||||
*/ | ||||
QgsFeatureList selectedFeatures(); | QgsFeatureList selectedFeatures(); | |||
/** Return reference to identifiers of selected features */ | /** | |||
const QgsFeatureIds& selectedFeaturesIds() const; | * Return reference to identifiers of selected features | |||
* | ||||
* @return A list of { @link QgsFeatureId } 's | ||||
* @see selectedFeatures() | ||||
*/ | ||||
const QgsFeatureIds &selectedFeaturesIds() const; | ||||
/** Change selection to the new set of features */ | /** | |||
void setSelectedFeatures( const QgsFeatureIds& ids ); | * Change selection to the new set of features. Dismisses the current s | |||
election. | ||||
* Will emit the { @link selectionChanged( QgsFeatureIds, QgsFeatureIds | ||||
, bool ) } signal with the | ||||
* clearAndSelect flag set. | ||||
* | ||||
* @param ids The ids which will be the new selection | ||||
*/ | ||||
void setSelectedFeatures( const QgsFeatureIds &ids ); | ||||
/** Returns the bounding box of the selected features. If there is no s election, QgsRectangle(0,0,0,0) is returned */ | /** Returns the bounding box of the selected features. If there is no s election, QgsRectangle(0,0,0,0) is returned */ | |||
QgsRectangle boundingBoxOfSelected(); | QgsRectangle boundingBoxOfSelected(); | |||
/** Copies the symbology settings from another layer. Returns true in c | ||||
ase of success */ | ||||
bool copySymbologySettings( const QgsMapLayer& other ); | ||||
/** Returns true if this layer can be in the same symbology group with | ||||
another layer */ | ||||
bool hasCompatibleSymbology( const QgsMapLayer& other ) const; | ||||
/** Returns a pointer to the renderer */ | ||||
const QgsRenderer* renderer() const; | ||||
/** Sets the renderer. If a renderer is already present, it is deleted | ||||
*/ | ||||
void setRenderer( QgsRenderer * r ); | ||||
/** Sets diagram rendering object (takes ownership) */ | /** Sets diagram rendering object (takes ownership) */ | |||
void setDiagramRenderer( QgsDiagramRendererV2* r ); | void setDiagramRenderer( QgsDiagramRendererV2* r ); | |||
const QgsDiagramRendererV2* diagramRenderer() const { return mDiagramRe nderer; } | const QgsDiagramRendererV2* diagramRenderer() const { return mDiagramRe nderer; } | |||
void setDiagramLayerSettings( const QgsDiagramLayerSettings& s ); | void setDiagramLayerSettings( const QgsDiagramLayerSettings& s ); | |||
const QgsDiagramLayerSettings *diagramLayerSettings() const { return mD iagramLayerSettings; } | const QgsDiagramLayerSettings *diagramLayerSettings() const { return mD iagramLayerSettings; } | |||
/** Return renderer V2. | /** Return renderer V2. | |||
* @note added in 1.4 */ | * @note added in 1.4 */ | |||
QgsFeatureRendererV2* rendererV2(); | QgsFeatureRendererV2* rendererV2(); | |||
/** Set renderer V2. | /** Set renderer V2. | |||
* @note added in 1.4 | * @note added in 1.4 | |||
*/ | */ | |||
void setRendererV2( QgsFeatureRendererV2* r ); | void setRendererV2( QgsFeatureRendererV2* r ); | |||
/** Return whether using renderer V2. | ||||
* @note added in 1.4 | ||||
*/ | ||||
bool isUsingRendererV2(); | ||||
/** set whether to use renderer V2 for drawing. | ||||
* @note added in 1.4 | ||||
*/ | ||||
void setUsingRendererV2( bool usingRendererV2 ); | ||||
/** Draw layer with renderer V2. | /** Draw layer with renderer V2. QgsFeatureRenderer::startRender() need s to be called before using this method | |||
* @note added in 1.4 | * @note added in 1.4 | |||
*/ | */ | |||
void drawRendererV2( QgsRenderContext& rendererContext, bool labeling ) ; | void drawRendererV2( QgsFeatureIterator &fit, QgsRenderContext& rendere rContext, bool labeling ); | |||
/** Draw layer with renderer V2 using symbol levels. | /** Draw layer with renderer V2 using symbol levels. QgsFeatureRenderer ::startRender() needs to be called before using this method | |||
* @note added in 1.4 | * @note added in 1.4 | |||
*/ | */ | |||
void drawRendererV2Levels( QgsRenderContext& rendererContext, bool labe ling ); | void drawRendererV2Levels( QgsFeatureIterator &fit, QgsRenderContext& r endererContext, bool labeling ); | |||
/** Returns point, line or polygon */ | /** Returns point, line or polygon */ | |||
QGis::GeometryType geometryType() const; | QGis::GeometryType geometryType() const; | |||
/** Returns true if this is a geometry layer and false in case of NoGeo metry (table only) or UnknownGeometry | /** Returns true if this is a geometry layer and false in case of NoGeo metry (table only) or UnknownGeometry | |||
@note added in 1.7*/ | * @note added in 1.7 | |||
*/ | ||||
bool hasGeometryType() const; | bool hasGeometryType() const; | |||
/**Returns the WKBType or WKBUnknown in case of error*/ | /**Returns the WKBType or WKBUnknown in case of error*/ | |||
QGis::WkbType wkbType() const; | QGis::WkbType wkbType() const; | |||
/** Return the provider type for this layer */ | /** Return the provider type for this layer */ | |||
QString providerType() const; | QString providerType() const; | |||
/** reads vector layer specific state from project file Dom node. | /** reads vector layer specific state from project file Dom node. | |||
* @note Called by QgsMapLayer::readXML(). | * @note Called by QgsMapLayer::readXML(). | |||
*/ | */ | |||
virtual bool readXml( const QDomNode& layer_node ); | virtual bool readXml( const QDomNode& layer_node ); | |||
/** write vector layer specific state to project file Dom node. | /** write vector layer specific state to project file Dom node. | |||
* @note Called by QgsMapLayer::writeXML(). | * @note Called by QgsMapLayer::writeXML(). | |||
*/ | */ | |||
virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc ); | virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc ); | |||
/** | ||||
* Save named and sld style of the layer to the style table in the db. | ||||
* @param name | ||||
* @param description | ||||
* @param useAsDefault | ||||
* @param uiFileContent | ||||
* @param msgError | ||||
*/ | ||||
virtual void saveStyleToDatabase( QString name, QString description, | ||||
bool useAsDefault, QString uiFileCont | ||||
ent, | ||||
QString &msgError ); | ||||
/** | ||||
* Lists all the style in db split into related to the layer and not re | ||||
lated to | ||||
* @param ids the list in which will be stored the style db ids | ||||
* @param names the list in which will be stored the style names | ||||
* @param descriptions the list in which will be stored the style descr | ||||
iptions | ||||
* @param msgError | ||||
* @return the number of styles related to current layer | ||||
*/ | ||||
virtual int listStylesInDatabase( QStringList &ids, QStringList &names, | ||||
QStringList &descriptions, QString &m | ||||
sgError ); | ||||
/** | ||||
* Will return the named style corresponding to style id provided | ||||
*/ | ||||
virtual QString getStyleFromDatabase( QString styleId, QString &msgErro | ||||
r ); | ||||
/** | ||||
* Load a named style from file/local db/datasource db | ||||
* @param theURI the URI of the style or the URI of the layer | ||||
* @param theResultFlag will be set to true if a named style is correct | ||||
ly loaded | ||||
* @param loadFromLocalDb if true forces to load from local db instead | ||||
of datasource one | ||||
*/ | ||||
virtual QString loadNamedStyle( const QString theURI, bool &theResultFl | ||||
ag, bool loadFromLocalDb ); | ||||
/** | ||||
* Calls loadNamedStyle( theURI, theResultFlag, false ); | ||||
* Retained for backward compatibility | ||||
*/ | ||||
virtual QString loadNamedStyle( const QString theURI, bool &theResultFl | ||||
ag ); | ||||
virtual bool applyNamedStyle( QString namedStyle , QString errorMsg ); | ||||
/** convert a saved attribute editor element into a AttributeEditor str | ||||
ucture as it's used internally. | ||||
* @param elem the DOM element | ||||
* @param parent the QObject which will own this object | ||||
*/ | ||||
QgsAttributeEditorElement* attributeEditorElementFromDomElement( QDomEl | ||||
ement &elem, QObject* parent ); | ||||
/** Read the symbology for the current layer from the Dom node supplied . | /** Read the symbology for the current layer from the Dom node supplied . | |||
* @param node node that will contain the symbology definition for this | * @param node node that will contain the symbology definition for this | |||
layer. | layer. | |||
* @param errorMessage reference to string that will be updated with any | * @param errorMessage reference to string that will be updated with an | |||
error messages | y error messages | |||
* @return true in case of success. | * @return true in case of success. | |||
*/ | */ | |||
bool readSymbology( const QDomNode& node, QString& errorMessage ); | bool readSymbology( const QDomNode& node, QString& errorMessage ); | |||
/** Write the symbology for the layer into the docment provided. | /** Write the symbology for the layer into the docment provided. | |||
* @param node the node that will have the style element added to it. | * @param node the node that will have the style element added to it. | |||
* @param doc the document that will have the QDomNode added. | * @param doc the document that will have the QDomNode added. | |||
* @param errorMessage reference to string that will be updated with a ny error messages | * @param errorMessage reference to string that will be updated with a ny error messages | |||
* @return true in case of success. | * @return true in case of success. | |||
*/ | */ | |||
bool writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorM essage ) const; | bool writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorM essage ) const; | |||
skipping to change at line 307 | skipping to change at line 786 | |||
/** | /** | |||
* Number of features in the layer. This is necessary if features are | * Number of features in the layer. This is necessary if features are | |||
* added/deleted or the layer has been subsetted. If the data provider | * added/deleted or the layer has been subsetted. If the data provider | |||
* chooses not to support this feature, the total number of features | * chooses not to support this feature, the total number of features | |||
* can be returned. | * can be returned. | |||
* @return long containing number of features | * @return long containing number of features | |||
*/ | */ | |||
virtual long featureCount() const; | virtual long featureCount() const; | |||
/** This function does nothing useful, it's kept only for compatibility | /** | |||
. | * Number of features rendered with specified symbol. Features must be | |||
* @todo to be removed | first | |||
* calculated by countSymbolFeatures() | ||||
* @param symbol the symbol | ||||
* @return number of features rendered by symbol or -1 if failed or cou | ||||
nts are not available | ||||
*/ | ||||
long featureCount( QgsSymbolV2* symbol ); | ||||
/** | ||||
* Count features for symbols. Feature counts may be get by featureCoun | ||||
t( QgsSymbolV2*). | ||||
* @param showProgress show progress dialog | ||||
* @return true if calculated, false if failed or was canceled by user | ||||
*/ | */ | |||
virtual long updateFeatureCount() const; | bool countSymbolFeatures( bool showProgress = true ); | |||
/** | /** | |||
* Set the string (typically sql) used to define a subset of the layer | * Set the string (typically sql) used to define a subset of the layer | |||
* @param subset The subset string. This may be the where clause of a s ql statement | * @param subset The subset string. This may be the where clause of a s ql statement | |||
* or other defintion string specific to the underlying d ataprovider | * or other defintion string specific to the underlying d ataprovider | |||
* and data store. | * and data store. | |||
* @return true, when setting the subset string was successful, false o therwise (added in 1.4) | * @return true, when setting the subset string was successful, false o therwise (added in 1.4) | |||
*/ | */ | |||
virtual bool setSubsetString( QString subset ); | virtual bool setSubsetString( QString subset ); | |||
/** | /** | |||
* Get the string (typically sql) used to define a subset of the layer | * Get the string (typically sql) used to define a subset of the layer | |||
* @return The subset string or QString::null if not implemented by the provider | * @return The subset string or QString::null if not implemented by the provider | |||
*/ | */ | |||
virtual QString subsetString(); | virtual QString subsetString(); | |||
/** | /** | |||
* Select features with or without attributes in a given window. | * Query the provider for features specified in request. | |||
* @param fetchAttributes indizes of attributes to fetch | */ | |||
* @param rect window (QgsRectangle() for all) | QgsFeatureIterator getFeatures( const QgsFeatureRequest& request = QgsF | |||
* @param fetchGeometry fetch features with geometry | eatureRequest() ); | |||
* @param useIntersect fetch only features that actually intersect the | ||||
window (not just the bounding box) | ||||
*/ | ||||
void select( QgsAttributeList fetchAttributes, | ||||
QgsRectangle rect = QgsRectangle(), | ||||
bool fetchGeometry = true, | ||||
bool useIntersect = false ); | ||||
/** | ||||
* fetch a feature (after select) | ||||
* @param feature buffer to read the feature into | ||||
* @return true, if a feature was fetched, false, if there are no more | ||||
features | ||||
*/ | ||||
bool nextFeature( QgsFeature& feature ); | ||||
/**Gets the feature at the given feature id. Considers the changed, add | ||||
ed, deleted and permanent features | ||||
@return true in case of success*/ | ||||
bool featureAtId( QgsFeatureId featureId, QgsFeature &f, bool fetchGeom | ||||
etries = true, bool fetchAttributes = true ); | ||||
/** Adds a feature | /** Adds a feature | |||
@param f feature to add | @param f feature to add | |||
@param alsoUpdateExtent If True, will also go to the effort of e.g. updating the extents. | @param alsoUpdateExtent If True, will also go to the effort of e.g. updating the extents. | |||
@return True in case of success and False in cas e of error | @return True in case of success and False in cas e of error | |||
*/ | */ | |||
bool addFeature( QgsFeature& f, bool alsoUpdateExtent = true ); | bool addFeature( QgsFeature& f, bool alsoUpdateExtent = true ); | |||
/** Updates an existing feature | /** Updates an existing feature | |||
@param f feature to update | @param f feature to update | |||
skipping to change at line 392 | skipping to change at line 863 | |||
*/ | */ | |||
bool deleteSelectedFeatures(); | bool deleteSelectedFeatures(); | |||
/**Adds a ring to polygon/multipolygon features | /**Adds a ring to polygon/multipolygon features | |||
@return | @return | |||
0 in case of success, | 0 in case of success, | |||
1 problem with feature type, | 1 problem with feature type, | |||
2 ring not closed, | 2 ring not closed, | |||
3 ring not valid, | 3 ring not valid, | |||
4 ring crosses existing rings, | 4 ring crosses existing rings, | |||
5 no feature found where ring can be inserted*/ | 5 no feature found where ring can be inserted | |||
6 layer not editable */ | ||||
int addRing( const QList<QgsPoint>& ring ); | int addRing( const QList<QgsPoint>& ring ); | |||
/**Adds a new part polygon to a multipart feature | /**Adds a new part polygon to a multipart feature | |||
@return | @return | |||
0 in case of success, | 0 in case of success, | |||
1 if selected feature is not multipart, | 1 if selected feature is not multipart, | |||
2 if ring is not a valid geometry, | 2 if ring is not a valid geometry, | |||
3 if new polygon ring not disjoint with existing rings, | 3 if new polygon ring not disjoint with existing rings, | |||
4 if no feature was selected, | 4 if no feature was selected, | |||
5 if several features are selected, | 5 if several features are selected, | |||
6 if selected geometry not found*/ | 6 if selected geometry not found | |||
7 layer not editable */ | ||||
int addPart( const QList<QgsPoint>& ring ); | int addPart( const QList<QgsPoint>& ring ); | |||
Q_DECL_DEPRECATED int addIsland( const QList<QgsPoint>& ring ) { return addPart( ring ); } | ||||
/**Translates feature by dx, dy | /**Translates feature by dx, dy | |||
@param featureId id of the feature to translate | @param featureId id of the feature to translate | |||
@param dx translation of x-coordinate | @param dx translation of x-coordinate | |||
@param dy translation of y-coordinate | @param dy translation of y-coordinate | |||
@return 0 in case of success*/ | @return 0 in case of success*/ | |||
int translateFeature( QgsFeatureId featureId, double dx, double dy ); | int translateFeature( QgsFeatureId featureId, double dx, double dy ); | |||
/**Splits features cut by the given line | /**Splits features cut by the given line | |||
@param splitLine line that splits the layer features | * @param splitLine line that splits the layer features | |||
@param topologicalEditing true if topological editing is enabled | * @param topologicalEditing true if topological editing is enabled | |||
@return 0 in case of success, 4 if there is a selection but no featu | * @return | |||
re split*/ | * 0 in case of success, | |||
* 4 if there is a selection but no feature split | ||||
*/ | ||||
int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEd iting = false ); | int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEd iting = false ); | |||
/**Changes the specified geometry such that it has no intersections wit h other | /**Changes the specified geometry such that it has no intersections wit h other | |||
polygon (or multipolygon) geometries in this vector layer | * polygon (or multipolygon) geometries in this vector layer | |||
@param geom geometry to modify | * @param geom geometry to modify | |||
@return 0 in case of success*/ | * @param ignoreFeatures list of feature ids where intersections shoul | |||
int removePolygonIntersections( QgsGeometry* geom ); | d be ignored | |||
* @return 0 in case of success | ||||
*/ | ||||
int removePolygonIntersections( QgsGeometry* geom, QgsFeatureIds ignore | ||||
Features = QgsFeatureIds() ); | ||||
/** Adds topological points for every vertex of the geometry. | /** Adds topological points for every vertex of the geometry. | |||
@param geom the geometry where each vertex is added to segments of othe | * @param geom the geometry where each vertex is added to segments of o | |||
r features | ther features | |||
@note geom is not going to be modified by the function | * @note geom is not going to be modified by the function | |||
@return 0 in case of success | * @return 0 in case of success | |||
@see addTopologicalPoints | */ | |||
*/ | ||||
int addTopologicalPoints( QgsGeometry* geom ); | int addTopologicalPoints( QgsGeometry* geom ); | |||
/**Adds a vertex to segments which intersect point p but don't | /** Adds a vertex to segments which intersect point p but don't | |||
already have a vertex there. If a feature already has a vertex at posi | * already have a vertex there. If a feature already has a vertex at po | |||
tion p, | sition p, | |||
no additional vertex is inserted. This method is useful for topologica | * no additional vertex is inserted. This method is useful for topologi | |||
l | cal | |||
editing. | * editing. | |||
@param p position of the vertex | * @param p position of the vertex | |||
@return 0 in case of success*/ | * @return 0 in case of success | |||
*/ | ||||
int addTopologicalPoints( const QgsPoint& p ); | int addTopologicalPoints( const QgsPoint& p ); | |||
/**Inserts vertices to the snapped segments. | /**Inserts vertices to the snapped segments. | |||
This is useful for topological editing if snap to segment is enabled. | * This is useful for topological editing if snap to segment is enabled | |||
@param snapResults results collected from the snapping operation | . | |||
@return 0 in case of success*/ | * @param snapResults results collected from the snapping operation | |||
* @return 0 in case of success | ||||
*/ | ||||
int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapR esults ); | int insertSegmentVerticesForSnap( const QList<QgsSnappingResult>& snapR esults ); | |||
/** Set labels on */ | /** Set labels on */ | |||
void enableLabels( bool on ); | void enableLabels( bool on ); | |||
/** Label is on */ | /** Label is on */ | |||
bool hasLabelsEnabled( void ) const; | bool hasLabelsEnabled() const; | |||
/** Returns true if the provider is in editing mode */ | /** Returns true if the provider is in editing mode */ | |||
virtual bool isEditable() const; | virtual bool isEditable() const; | |||
/** Returns true if the provider is in read-only mode | /** Returns true if the provider is in read-only mode | |||
* @note added in 1.6 */ | * @note added in 1.6 | |||
*/ | ||||
virtual bool isReadOnly() const; | virtual bool isReadOnly() const; | |||
/** Returns true if the provider has been modified since the last commi t */ | /** Returns true if the provider has been modified since the last commi t */ | |||
virtual bool isModified() const; | virtual bool isModified() const; | |||
/**Snaps a point to the closest vertex if there is one within the snapp ing tolerance | /**Snaps a point to the closest vertex if there is one within the snapp ing tolerance | |||
@param point The point which is set to the position of a verte | * @param point The point which is set to the position of a vert | |||
x if there is one within the snapping tolerance. | ex if there is one within the snapping tolerance. | |||
If there is no point within this tolerance, point is left unchanged. | * If there is no point within this tolerance, point is left unchanged | |||
@param tolerance The snapping tolerance | . | |||
@return true if point has been snapped, false if no vertex within se | * @param tolerance The snapping tolerance | |||
arch tolerance*/ | * @return true if the point has been snapped, false if no vertex with | |||
in search tolerance | ||||
*/ | ||||
bool snapPoint( QgsPoint& point, double tolerance ); | bool snapPoint( QgsPoint& point, double tolerance ); | |||
/**Snaps to segment or vertex within given tolerance | /**Snaps to segment or vertex within given tolerance | |||
@param startPoint point to snap (in layer coordinates) | * @param startPoint point to snap (in layer coordinates) | |||
@param snappingTolerance distance tolerance for snapping | * @param snappingTolerance distance tolerance for snapping | |||
@param snappingResults snapping results. Key is the distance between | * @param snappingResults snapping results. Key is the distance between | |||
startPoint and snapping target | startPoint and snapping target | |||
@param snap_to to segment / to vertex | * @param snap_to to segment / to vertex | |||
@return 0 in case of success | * @return 0 in case of success | |||
*/ | */ | |||
int snapWithContext( const QgsPoint& startPoint, | int snapWithContext( const QgsPoint& startPoint, | |||
double snappingTolerance, | double snappingTolerance, | |||
QMultiMap < double, QgsSnappingResult > &snappingR esults, | QMultiMap < double, QgsSnappingResult > &snappingR esults, | |||
QgsSnapper::SnappingType snap_to ); | QgsSnapper::SnappingType snap_to ); | |||
/**Synchronises with changes in the datasource | /**Synchronises with changes in the datasource | |||
@note added in version 1.6*/ | @note added in version 1.6*/ | |||
virtual void reload(); | virtual void reload(); | |||
/** Draws the layer | /** Draws the layer | |||
* @return false if an error occurred during drawing | * @return false if an error occurred during drawing | |||
*/ | */ | |||
bool draw( QgsRenderContext& rendererContext ); | bool draw( QgsRenderContext& rendererContext ); | |||
/** Draws the layer labels using coordinate transformation */ | /** Draws the layer labels using coordinate transformation */ | |||
void drawLabels( QgsRenderContext& rendererContext ); | void drawLabels( QgsRenderContext& rendererContext ); | |||
/** Return the extent of the layer as a QRect */ | ||||
QgsRectangle extent(); | ||||
/** returns field list in the to-be-committed state */ | /** returns field list in the to-be-committed state */ | |||
const QgsFieldMap &pendingFields() const; | const QgsFields &pendingFields() const; | |||
/** returns list of attributes */ | /** returns list of attributes */ | |||
QgsAttributeList pendingAllAttributesList(); | QgsAttributeList pendingAllAttributesList(); | |||
/** returns list of attribute making up the primary key | ||||
* @note added in 2.0 | ||||
*/ | ||||
QgsAttributeList pendingPkAttributesList(); | ||||
/** returns feature count after commit */ | /** returns feature count after commit */ | |||
int pendingFeatureCount(); | int pendingFeatureCount(); | |||
/** Make layer read-only (editing disabled) or not | /** Make layer read-only (editing disabled) or not | |||
* @return false if the layer is in editing yet | * @return false if the layer is in editing yet | |||
* @note added in 1.6 | * @note added in 1.6 | |||
*/ | */ | |||
bool setReadOnly( bool readonly = true ); | bool setReadOnly( bool readonly = true ); | |||
/** Sets whether some features are modified or not */ | ||||
void setModified( bool modified = true, bool onlyGeometryWasModified = | ||||
false ); | ||||
/** Make layer editable */ | /** Make layer editable */ | |||
bool startEditing(); | bool startEditing(); | |||
/** change feature's geometry | /** change feature's geometry | |||
@note added in version 1.2 */ | @note added in version 1.2 */ | |||
bool changeGeometry( QgsFeatureId fid, QgsGeometry* geom ); | bool changeGeometry( QgsFeatureId fid, QgsGeometry* geom ); | |||
/** changed an attribute value (but does not commit it) */ | /** changed an attribute value (but does not commit it) */ | |||
bool changeAttributeValue( QgsFeatureId fid, int field, QVariant value, bool emitSignal = true ); | bool changeAttributeValue( QgsFeatureId fid, int field, QVariant value, bool emitSignal = true ); | |||
/** add an attribute field (but does not commit it) | /** add an attribute field (but does not commit it) | |||
returns true if the field was added | returns true if the field was added | |||
@note added in version 1.2 */ | @note added in version 1.2 */ | |||
bool addAttribute( const QgsField &field ); | bool addAttribute( const QgsField &field ); | |||
/** add an attribute field (but does not commit it) | ||||
returns true if the field was added | ||||
@deprecated */ | ||||
Q_DECL_DEPRECATED bool addAttribute( QString name, QString type ); | ||||
/**Sets an alias (a display name) for attributes to display in dialogs | /**Sets an alias (a display name) for attributes to display in dialogs | |||
@note added in version 1.2*/ | @note added in version 1.2*/ | |||
void addAttributeAlias( int attIndex, QString aliasString ); | void addAttributeAlias( int attIndex, QString aliasString ); | |||
/**Adds a tab (for the attribute editor form) holding groups and fields | ||||
@note added in version 1.9*/ | ||||
void addAttributeEditorWidget( QgsAttributeEditorElement* data ); | ||||
/**Returns a list of tabs holding groups and fields | ||||
@note added in version 1.9*/ | ||||
QList< QgsAttributeEditorElement* > &attributeEditorElements(); | ||||
/**Clears all the tabs for the attribute editor form | ||||
@note added in version 1.9*/ | ||||
void clearAttributeEditorWidgets(); | ||||
/**Returns the alias of an attribute name or an empty string if there i s no alias | /**Returns the alias of an attribute name or an empty string if there i s no alias | |||
@note added in version 1.2*/ | @note added in version 1.2*/ | |||
QString attributeAlias( int attributeIndex ) const; | QString attributeAlias( int attributeIndex ) const; | |||
/**Convenience function that returns the attribute alias if defined or the field name else | /**Convenience function that returns the attribute alias if defined or the field name else | |||
@note added in version 1.2*/ | @note added in version 1.2*/ | |||
QString attributeDisplayName( int attributeIndex ) const; | QString attributeDisplayName( int attributeIndex ) const; | |||
const QMap< QString, QString >& attributeAliases() const { return mAttr | ||||
ibuteAliasMap; } | ||||
const QSet<QString>& excludeAttributesWMS() const { return mExcludeAttr | ||||
ibutesWMS; } | ||||
void setExcludeAttributesWMS( const QSet<QString>& att ) { mExcludeAttr | ||||
ibutesWMS = att; } | ||||
const QSet<QString>& excludeAttributesWFS() const { return mExcludeAttr | ||||
ibutesWFS; } | ||||
void setExcludeAttributesWFS( const QSet<QString>& att ) { mExcludeAttr | ||||
ibutesWFS = att; } | ||||
/** delete an attribute field (but does not commit it) */ | /** delete an attribute field (but does not commit it) */ | |||
bool deleteAttribute( int attr ); | bool deleteAttribute( int attr ); | |||
/** | ||||
* Deletes a list of attribute fields (but does not commit it) | ||||
* | ||||
* @param attrs the indices of the attributes to delete | ||||
* @return true if at least one attribute has been deleted | ||||
* | ||||
*/ | ||||
bool deleteAttributes( QList<int> attrs ); | ||||
/** Insert a copy of the given features into the layer (but does not c ommit it) */ | /** Insert a copy of the given features into the layer (but does not c ommit it) */ | |||
bool addFeatures( QgsFeatureList features, bool makeSelected = true ); | bool addFeatures( QgsFeatureList features, bool makeSelected = true ); | |||
/** delete a feature from the layer (but does not commit it) */ | /** delete a feature from the layer (but does not commit it) */ | |||
bool deleteFeature( QgsFeatureId fid ); | bool deleteFeature( QgsFeatureId fid ); | |||
/** | /** | |||
Attempts to commit any changes to disk. Returns the result of the at tempt. | Attempts to commit any changes to disk. Returns the result of the at tempt. | |||
If a commit fails, the in-memory changes are left alone. | If a commit fails, the in-memory changes are left alone. | |||
skipping to change at line 572 | skipping to change at line 1080 | |||
The commits occur in distinct stages, | The commits occur in distinct stages, | |||
(add attributes, add features, change attribute values, change | (add attributes, add features, change attribute values, change | |||
geometries, delete features, delete attributes) | geometries, delete features, delete attributes) | |||
so if a stage fails, it's difficult to roll back cleanly. | so if a stage fails, it's difficult to roll back cleanly. | |||
Therefore any error message also includes which stage failed so | Therefore any error message also includes which stage failed so | |||
that the user has some chance of repairing the damage cleanly. | that the user has some chance of repairing the damage cleanly. | |||
*/ | */ | |||
bool commitChanges(); | bool commitChanges(); | |||
const QStringList &commitErrors(); | const QStringList &commitErrors(); | |||
/** Stop editing and discard the edits */ | /** Stop editing and discard the edits | |||
bool rollBack(); | * @param deleteBuffer whether to delete editing buffer (added in 1.9) | |||
*/ | ||||
bool rollBack( bool deleteBuffer = true ); | ||||
/**get edit type*/ | /**get edit type*/ | |||
EditType editType( int idx ); | EditType editType( int idx ); | |||
/**set edit type*/ | /**set edit type*/ | |||
void setEditType( int idx, EditType edit ); | void setEditType( int idx, EditType edit ); | |||
/** get the active layout for the attribute editor for this layer (adde | ||||
d in 1.9) */ | ||||
EditorLayout editorLayout(); | ||||
/** set the active layout for the attribute editor for this layer (adde | ||||
d in 1.9) */ | ||||
void setEditorLayout( EditorLayout editorLayout ); | ||||
/** set string representing 'true' for a checkbox (added in 1.4) */ | /** set string representing 'true' for a checkbox (added in 1.4) */ | |||
void setCheckedState( int idx, QString checked, QString notChecked ); | void setCheckedState( int idx, QString checked, QString notChecked ); | |||
/** return string representing 'true' for a checkbox (added in 1.4) */ | /** return string representing 'true' for a checkbox (added in 1.4) | |||
* @note not available in python bindings | ||||
* FIXME: need SIP binding for QPair<QString, QString> | ||||
*/ | ||||
QPair<QString, QString> checkedState( int idx ); | QPair<QString, QString> checkedState( int idx ); | |||
/** get edit form (added in 1.4) */ | /** get edit form (added in 1.4) */ | |||
QString editForm(); | QString editForm(); | |||
/** set edit form (added in 1.4) */ | /** set edit form (added in 1.4) */ | |||
void setEditForm( QString ui ); | void setEditForm( QString ui ); | |||
/** get annotation form (added in 1.5)*/ | /** get annotation form (added in 1.5)*/ | |||
QString annotationForm() const { return mAnnotationForm; } | QString annotationForm() const { return mAnnotationForm; } | |||
skipping to change at line 616 | skipping to change at line 1135 | |||
QMap<QString, QVariant> &valueMap( int idx ); | QMap<QString, QVariant> &valueMap( int idx ); | |||
/**access range */ | /**access range */ | |||
RangeData &range( int idx ); | RangeData &range( int idx ); | |||
/**access relations | /**access relations | |||
* @note added in 1.8 | * @note added in 1.8 | |||
**/ | **/ | |||
ValueRelationData &valueRelation( int idx ); | ValueRelationData &valueRelation( int idx ); | |||
/**Adds a new overlay to this class. QgsVectorLayer takes ownership of | /**access date format | |||
the object | * @note added in 1.9 | |||
@note this method was added in version 1.1 | */ | |||
*/ | QString &dateFormat( int idx ); | |||
void addOverlay( QgsVectorOverlay* overlay ); | ||||
/**Removes all overlays of a given type | /**access widget size for photo and webview widget | |||
@note this method was added in version 1.1 | * @note added in 1.9 | |||
*/ | */ | |||
void removeOverlay( const QString& typeName ); | QSize &widgetSize( int idx ); | |||
/**Returns pointers to the overlays of this layer | /**is edit widget editable | |||
@note this method was added in version 1.1 | * @note added in 1.9 | |||
*/ | **/ | |||
void vectorOverlays( QList<QgsVectorOverlay*>& overlayList ); | bool fieldEditable( int idx ); | |||
/**Returns the (first) overlay of a type, e.g. diagram or label | /**label widget on top | |||
@note this method was added in version 1.1 | * @note added in 1.9 | |||
*/ | **/ | |||
QgsVectorOverlay* findOverlayByType( const QString& typeName ); | bool labelOnTop( int idx ); | |||
/**set edit widget editable | ||||
* @note added in 1.9 | ||||
**/ | ||||
void setFieldEditable( int idx, bool editable ); | ||||
/**label widget on top | ||||
* @note added in 1.9 | ||||
**/ | ||||
void setLabelOnTop( int idx, bool onTop ); | ||||
//! Buffer with uncommitted editing operations. Only valid after editin | ||||
g has been turned on. | ||||
QgsVectorLayerEditBuffer* editBuffer() { return mEditBuffer; } | ||||
/** | /** | |||
* Create edit command for undo/redo operations | * Create edit command for undo/redo operations | |||
* @param text text which is to be displayed in undo window | * @param text text which is to be displayed in undo window | |||
*/ | */ | |||
void beginEditCommand( QString text ); | void beginEditCommand( QString text ); | |||
/** Finish edit command and add it to undo/redo stack */ | /** Finish edit command and add it to undo/redo stack */ | |||
void endEditCommand(); | void endEditCommand(); | |||
/** Destroy active command and reverts all changes in it */ | /** Destroy active command and reverts all changes in it */ | |||
void destroyEditCommand(); | void destroyEditCommand(); | |||
/** Execute undo operation. To be called only from QgsVectorLayerUndoCo | ||||
mmand. */ | ||||
void undoEditCommand( QgsUndoCommand* cmd ); | ||||
/** Execute redo operation. To be called only from QgsVectorLayerUndoCo | ||||
mmand. */ | ||||
void redoEditCommand( QgsUndoCommand* cmd ); | ||||
/** Returns the index of a field name or -1 if the field does not exist | /** Returns the index of a field name or -1 if the field does not exist | |||
@note this method was added in version 1.4 | @note this method was added in version 1.4 | |||
*/ | */ | |||
int fieldNameIndex( const QString& fieldName ) const; | int fieldNameIndex( const QString& fieldName ) const; | |||
/** Editing vertex markers | /** Editing vertex markers | |||
@note public from version 1.4 */ | @note public from version 1.4 */ | |||
enum VertexMarkerType | enum VertexMarkerType | |||
{ | { | |||
SemiTransparentCircle, | SemiTransparentCircle, | |||
Cross, | Cross, | |||
NoMarker /* added in version 1.1 */ | NoMarker /* added in version 1.1 */ | |||
}; | }; | |||
/** Draws a vertex symbol at (screen) coordinates x, y. (Useful to assi st vertex editing.) | /** Draws a vertex symbol at (screen) coordinates x, y. (Useful to assi st vertex editing.) | |||
@note public and static from version 1.4 */ | @note public and static from version 1.4 */ | |||
static void drawVertexMarker( double x, double y, QPainter& p, QgsVecto rLayer::VertexMarkerType type, int vertexSize ); | static void drawVertexMarker( double x, double y, QPainter& p, QgsVecto rLayer::VertexMarkerType type, int vertexSize ); | |||
/** Assembles mUpdatedFields considering provider fields, joined fields and added fields | /** Assembles mUpdatedFields considering provider fields, joined fields and added fields | |||
@note added in 1.7 */ | @note added in 1.7 */ | |||
void updateFieldMap(); | void updateFields(); | |||
/** Caches joined attributes if required (and not already done) | /** Caches joined attributes if required (and not already done) | |||
@note added in 1.7 */ | @note added in 1.7 */ | |||
void createJoinCaches(); | void createJoinCaches(); | |||
/**Returns unique values for column | /**Returns unique values for column | |||
@param index column index for attribute | @param index column index for attribute | |||
@param uniqueValues out: result list | @param uniqueValues out: result list | |||
@param limit maximum number of values to return (-1 if unlimited) | @param limit maximum number of values to return (-1 if unlimited) | |||
@note this method was added in version 1.7*/ | @note this method was added in version 1.7 */ | |||
void uniqueValues( int index, QList<QVariant> &uniqueValues, int limit = -1 ); | void uniqueValues( int index, QList<QVariant> &uniqueValues, int limit = -1 ); | |||
/**Returns minimum value for an attribute column or invalid variant in case of error | /**Returns minimum value for an attribute column or invalid variant in case of error | |||
@note added in 1.7*/ | @note added in 1.7*/ | |||
QVariant minimumValue( int index ); | QVariant minimumValue( int index ); | |||
/**Returns maximum value for an attribute column or invalid variant in case of error | /**Returns maximum value for an attribute column or invalid variant in case of error | |||
@note added in 1.7*/ | @note added in 1.7*/ | |||
QVariant maximumValue( int index ); | QVariant maximumValue( int index ); | |||
/* Set the blending mode used for rendering each feature | ||||
* @note added in 2.0 | ||||
*/ | ||||
void setFeatureBlendMode( const QPainter::CompositionMode blendMode ); | ||||
/* Returns the current blending mode for features | ||||
* @note added in 2.0 | ||||
*/ | ||||
QPainter::CompositionMode featureBlendMode() const; | ||||
/* Set the transparency for the vector layer | ||||
* @note added in 2.0 | ||||
*/ | ||||
void setLayerTransparency( int layerTransparency ); | ||||
/* Returns the current transparency for the vector layer | ||||
* @note added in 2.0 | ||||
*/ | ||||
int layerTransparency() const; | ||||
public slots: | public slots: | |||
/** Select feature by its ID, optionally emit signal selectionChanged() | /** | |||
*/ | * Select feature by its ID | |||
void select( QgsFeatureId featureId, bool emitSignal = true ); | * | |||
* @param featureId The id of the feature to select | ||||
* | ||||
* @see select(QgsFeatureIds) | ||||
*/ | ||||
void select( const QgsFeatureId &featureId ); | ||||
/** Deselect feature by its ID, optionally emit signal selectionChanged | /** | |||
() */ | * Select features by their ID | |||
void deselect( QgsFeatureId featureId, bool emitSignal = true ); | * | |||
* @param featureIds The ids of the features to select | ||||
* | ||||
* @see select(QgsFeatureId) | ||||
*/ | ||||
void select( const QgsFeatureIds& featureIds ); | ||||
/** | ||||
* Deselect feature by its ID | ||||
* | ||||
* @param featureId The id of the feature to deselect | ||||
* | ||||
* @see deselect(QgsFeatureIds) | ||||
*/ | ||||
void deselect( const QgsFeatureId featureId ); | ||||
/** | ||||
* Deselect features by their ID | ||||
* | ||||
* @param featureIds The ids of the features to deselect | ||||
* | ||||
* @see deselect(QgsFeatureId) | ||||
*/ | ||||
void deselect( const QgsFeatureIds& featureIds ); | ||||
/** Clear selection */ | /** | |||
void removeSelection( bool emitSignal = true ); | * Clear selection | |||
* | ||||
* @see setSelectedFeatures(const QgsFeatureIds&) | ||||
*/ | ||||
void removeSelection(); | ||||
void triggerRepaint(); | void triggerRepaint(); | |||
/** Update the extents for the layer. This is necessary if features are | /** Update the extents for the layer. This is necessary if features are | |||
* added/deleted or the layer has been subsetted. | * added/deleted or the layer has been subsetted. | |||
*/ | */ | |||
virtual void updateExtents(); | virtual void updateExtents(); | |||
/** Check if there is a join with a layer that will be removed | /** Check if there is a join with a layer that will be removed | |||
@note added in 1.7 */ | @note added in 1.7 */ | |||
void checkJoinLayerRemove( QString theLayerId ); | void checkJoinLayerRemove( QString theLayerId ); | |||
QString metadata(); | QString metadata(); | |||
/** @note not available in python bindings */ | ||||
inline QgsGeometryCache* cache() { return mCache; } | ||||
/** | ||||
* @brief Is called when the cache image is being deleted. Overwrite an | ||||
d use to clean up. | ||||
* @note added in 2.0 | ||||
*/ | ||||
virtual void onCacheImageDelete(); | ||||
protected slots: | ||||
void invalidateSymbolCountedFlag(); | ||||
signals: | signals: | |||
/** This signal is emited when selection was changed */ | /** | |||
* This signal is emitted when selection was changed | ||||
* | ||||
* @param selected Newly selected feature ids | ||||
* @param deselected Ids of all features which have previously bee | ||||
n selected but are not any more | ||||
* @param clearAndSelect In case this is set to true, the old selectio | ||||
n was dismissed and the new selection corresponds to selected | ||||
*/ | ||||
void selectionChanged( const QgsFeatureIds selected, const QgsFeatureId | ||||
s deselected, const bool clearAndSelect ); | ||||
/** This signal is emitted when selection was changed */ | ||||
void selectionChanged(); | void selectionChanged(); | |||
/** This signal is emitted when modifications has been done on layer */ | /** This signal is emitted when modifications has been done on layer */ | |||
void layerModified( bool onlyGeometry ); | void layerModified(); | |||
/** Is emitted, when editing on this layer has started*/ | ||||
void editingStarted(); | void editingStarted(); | |||
/** Is emitted, when edited changes successfully have been written to t | ||||
he data provider */ | ||||
void editingStopped(); | void editingStopped(); | |||
/** Is emitted, before changes are commited to the data provider */ | ||||
void beforeCommitChanges(); | ||||
/** Is emitted, before changes are rolled back*/ | ||||
void beforeRollBack(); | ||||
/** | ||||
* Will be emitted, when a new attribute has been added to this vector | ||||
layer. | ||||
* Applies only to types {@link QgsFields::OriginEdit} and {@link QgsFi | ||||
elds::OriginProvider} | ||||
* | ||||
* @param idx The index of the new attribute | ||||
* | ||||
* @see updatedFields() | ||||
*/ | ||||
void attributeAdded( int idx ); | void attributeAdded( int idx ); | |||
/** | ||||
* Will be emitted, when an attribute has been deleted from this vector | ||||
layer. | ||||
* Applies only to types {@link QgsFields::OriginEdit} and {@link QgsFi | ||||
elds::OriginProvider} | ||||
* | ||||
* @param idx The index of the deleted attribute | ||||
* | ||||
* @see updatedFields() | ||||
*/ | ||||
void attributeDeleted( int idx ); | void attributeDeleted( int idx ); | |||
void featureAdded( QgsFeatureId fid ); // added in 1.7 | void featureAdded( QgsFeatureId fid ); // added in 1.7 | |||
void featureDeleted( QgsFeatureId fid ); | void featureDeleted( QgsFeatureId fid ); | |||
/** | ||||
* Is emitted, whenever the fields available from this layer have been | ||||
changed. | ||||
* This can be due to manually adding attributes or due to a join. | ||||
* | ||||
* @note Added in 2.0 | ||||
*/ | ||||
void updatedFields(); | ||||
void layerDeleted(); | void layerDeleted(); | |||
void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant & ); | void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant & ); | |||
void geometryChanged( QgsFeatureId fid, QgsGeometry &geom ); // added i n 1.9 | void geometryChanged( QgsFeatureId fid, QgsGeometry &geom ); // added i n 1.9 | |||
/** Signals emitted after committing changes | /** Signals emitted after committing changes | |||
\note added in v1.6 */ | \note added in v1.6 */ | |||
void committedAttributesDeleted( const QString& layerId, const QgsAttri buteIds& deletedAttributeIds ); | void committedAttributesDeleted( const QString& layerId, const QgsAttri buteList& deletedAttributes ); | |||
void committedAttributesAdded( const QString& layerId, const QList<QgsF ield>& addedAttributes ); | void committedAttributesAdded( const QString& layerId, const QList<QgsF ield>& addedAttributes ); | |||
void committedFeaturesAdded( const QString& layerId, const QgsFeatureLi st& addedFeatures ); | void committedFeaturesAdded( const QString& layerId, const QgsFeatureLi st& addedFeatures ); | |||
void committedFeaturesRemoved( const QString& layerId, const QgsFeature Ids& deletedFeatureIds ); | void committedFeaturesRemoved( const QString& layerId, const QgsFeature Ids& deletedFeatureIds ); | |||
void committedAttributeValuesChanges( const QString& layerId, const Qgs ChangedAttributesMap& changedAttributesValues ); | void committedAttributeValuesChanges( const QString& layerId, const Qgs ChangedAttributesMap& changedAttributesValues ); | |||
void committedGeometriesChanges( const QString& layerId, const QgsGeome tryMap& changedGeometries ); | void committedGeometriesChanges( const QString& layerId, const QgsGeome tryMap& changedGeometries ); | |||
/** Emitted when the font family defined for labeling layer is not foun | ||||
d on system | ||||
* @note added in 1.9 | ||||
*/ | ||||
void labelingFontNotFound( QgsVectorLayer* layer, const QString& fontfa | ||||
mily ); | ||||
protected: | ||||
/** Set the extent */ | ||||
void setExtent( const QgsRectangle &rect ); | ||||
private: // Private methods | private: // Private methods | |||
/** vector layers are not copyable */ | /** vector layers are not copyable */ | |||
QgsVectorLayer( QgsVectorLayer const & rhs ); | QgsVectorLayer( const QgsVectorLayer & rhs ); | |||
/** vector layers are not copyable */ | /** vector layers are not copyable */ | |||
QgsVectorLayer & operator=( QgsVectorLayer const & rhs ); | QgsVectorLayer & operator=( QgsVectorLayer const & rhs ); | |||
/** bind layer to a specific data provider | /** bind layer to a specific data provider | |||
@param provider should be "postgres", "ogr", or ?? | @param provider should be "postgres", "ogr", or ?? | |||
@todo XXX should this return bool? Throw exceptions? | @todo XXX should this return bool? Throw exceptions? | |||
*/ | */ | |||
bool setDataProvider( QString const & provider ); | bool setDataProvider( QString const & provider ); | |||
/** Draws features. May cause projections exceptions to be generated | ||||
* (i.e., code that calls this function needs to catch them) */ | ||||
void drawFeature( QgsRenderContext &renderContext, | ||||
QgsFeature& fet, | ||||
QImage* marker ); | ||||
/** Convenience function to transform the given point */ | ||||
void transformPoint( double& x, double& y, | ||||
const QgsMapToPixel* mtp, const QgsCoordinateTrans | ||||
form* ct ); | ||||
void transformPoints( std::vector<double>& x, std::vector<double>& y, s | ||||
td::vector<double>& z, QgsRenderContext &renderContext ); | ||||
/** Draw the linestring as given in the WKB format. Returns a pointer | ||||
* to the byte after the end of the line string binary data stream (WKB | ||||
). | ||||
*/ | ||||
unsigned char *drawLineString( unsigned char *WKBlinestring, QgsRenderC | ||||
ontext &renderContext ); | ||||
/** Draw the polygon as given in the WKB format. Returns a pointer to | ||||
* the byte after the end of the polygon binary data stream (WKB). | ||||
*/ | ||||
unsigned char *drawPolygon( unsigned char *WKBpolygon, QgsRenderContext | ||||
&renderContext ); | ||||
/** Goes through all features and finds a free id (e.g. to give it temp orarily to a not-commited feature) */ | /** Goes through all features and finds a free id (e.g. to give it temp orarily to a not-commited feature) */ | |||
QgsFeatureId findFreeId(); | QgsFeatureId findFreeId(); | |||
/**Deletes the geometries in mCachedGeometries*/ | ||||
void deleteCachedGeometries(); | ||||
/**Snaps to a geometry and adds the result to the multimap if it is wit hin the snapping result | /**Snaps to a geometry and adds the result to the multimap if it is wit hin the snapping result | |||
@param startPoint start point of the snap | @param startPoint start point of the snap | |||
@param featureId id of feature | @param featureId id of feature | |||
@param geom geometry to snap | @param geom geometry to snap | |||
@param sqrSnappingTolerance squared search tolerance of the snap | @param sqrSnappingTolerance squared search tolerance of the snap | |||
@param snappingResults list to which the result is appended | @param snappingResults list to which the result is appended | |||
@param snap_to snap to vertex or to segment | @param snap_to snap to vertex or to segment | |||
*/ | */ | |||
void snapToGeometry( const QgsPoint& startPoint, | void snapToGeometry( const QgsPoint& startPoint, | |||
QgsFeatureId featureId, | QgsFeatureId featureId, | |||
QgsGeometry* geom, | QgsGeometry* geom, | |||
double sqrSnappingTolerance, | double sqrSnappingTolerance, | |||
QMultiMap<double, QgsSnappingResult>& snappingResu lts, | QMultiMap<double, QgsSnappingResult>& snappingResu lts, | |||
QgsSnapper::SnappingType snap_to ) const; | QgsSnapper::SnappingType snap_to ) const; | |||
/**Little helper function that gives bounding box from a list of points | ||||
. | ||||
@return 0 in case of success*/ | ||||
int boundingBoxFromPointList( const QList<QgsPoint>& list, double& xmin | ||||
, double& ymin, double& xmax, double& ymax ) const; | ||||
/**Reads vertex marker type from settings*/ | /**Reads vertex marker type from settings*/ | |||
static QgsVectorLayer::VertexMarkerType currentVertexMarkerType(); | static QgsVectorLayer::VertexMarkerType currentVertexMarkerType(); | |||
/**Reads vertex marker size from settings*/ | /**Reads vertex marker size from settings*/ | |||
static int currentVertexMarkerSize(); | static int currentVertexMarkerSize(); | |||
/**Update feature with uncommited attribute updates and joined attribut | /** Add joined attributes to a feature */ | |||
es*/ | //void addJoinedAttributes( QgsFeature& f, bool all = false ); | |||
void updateFeatureAttributes( QgsFeature &f, bool all = false ); | ||||
/**Adds joined attributes to a feature | ||||
@param f the feature to add the attributes | ||||
@param joinInfo vector join | ||||
@param joinFieldName name of the (source) join Field | ||||
@param joinValue lookup value for join | ||||
@param attributes (join layer) attribute indices to add | ||||
@param attributeIndexOffset index offset to get from join layer attri | ||||
bute index to layer index*/ | ||||
void addJoinedFeatureAttributes( QgsFeature& f, const QgsVectorJoinInfo | ||||
& joinInfo, const QString& joinFieldName, const QVariant& joinValue, | ||||
const QgsAttributeList& attributes, in | ||||
t attributeIndexOffset ); | ||||
/**Update feature with uncommited geometry updates*/ | ||||
void updateFeatureGeometry( QgsFeature &f ); | ||||
/** Record changed geometry, store in active command (if any) */ | ||||
void editGeometryChange( QgsFeatureId featureId, QgsGeometry& geometry | ||||
); | ||||
/** Record added feature, store in active command (if any) */ | ||||
void editFeatureAdd( QgsFeature& feature ); | ||||
/** Record deleted feature, store in active command (if any) */ | ||||
void editFeatureDelete( QgsFeatureId featureId ); | ||||
/** Record changed attribute, store in active command (if any) */ | ||||
void editAttributeChange( QgsFeatureId featureId, int field, QVariant v | ||||
alue ); | ||||
/** Stop version 2 renderer and selected renderer (if required) */ | /** Stop version 2 renderer and selected renderer (if required) */ | |||
void stopRendererV2( QgsRenderContext& rendererContext, QgsSingleSymbol RendererV2* selRenderer ); | void stopRendererV2( QgsRenderContext& rendererContext, QgsSingleSymbol RendererV2* selRenderer ); | |||
/**Updates an index in an attribute map to a new value (usually necessa | ||||
ry because of a join operation)*/ | ||||
void updateAttributeMapIndex( QgsAttributeMap& map, int oldIndex, int n | ||||
ewIndex ) const; | ||||
/**Registers label and diagram layer | /**Registers label and diagram layer | |||
@param rendererContext render context | @param rendererContext render context | |||
@param attributes attributes needed for labeling and diagrams will be added to the list | @param attributes attributes needed for labeling and diagrams will be added to the list | |||
@param labeling out: true if there will be labeling (ng) for this lay er*/ | @param labeling out: true if there will be labeling (ng) for this lay er*/ | |||
void prepareLabelingAndDiagrams( QgsRenderContext& rendererContext, Qgs AttributeList& attributes, bool& labeling ); | void prepareLabelingAndDiagrams( QgsRenderContext& rendererContext, Qgs AttributeList& attributes, bool& labeling ); | |||
private: // Private attributes | private: // Private attributes | |||
/** Update threshold for drawing features as they are read. A value of zero indicates | /** Update threshold for drawing features as they are read. A value of zero indicates | |||
* that no features will be drawn until all have been read | * that no features will be drawn until all have been read | |||
*/ | */ | |||
int mUpdateThreshold; | int mUpdateThreshold; | |||
/** Enables backbuffering for the map window. This improves graphics pe | ||||
rformance, | ||||
* but the possibility to cancel rendering and incremental feature dra | ||||
wing will be lost. | ||||
* | ||||
*/ | ||||
bool mEnableBackbuffer; | ||||
/** Pointer to data provider derived from the abastract base class QgsD ataProvider */ | /** Pointer to data provider derived from the abastract base class QgsD ataProvider */ | |||
QgsVectorDataProvider *mDataProvider; | QgsVectorDataProvider *mDataProvider; | |||
QgsFeatureIterator mProviderIterator; | ||||
/** index of the primary label field */ | /** index of the primary label field */ | |||
QString mDisplayField; | QString mDisplayField; | |||
/** the preview expression used to generate a human readable preview st | ||||
ring for features */ | ||||
QString mDisplayExpression; | ||||
/** Data provider key */ | /** Data provider key */ | |||
QString mProviderKey; | QString mProviderKey; | |||
/** The user-defined actions that are accessed from the Identify Result s dialog box */ | /** The user-defined actions that are accessed from the Identify Result s dialog box */ | |||
QgsAttributeAction* mActions; | QgsAttributeAction* mActions; | |||
/** Flag indicating whether the layer is in editing mode or not */ | ||||
bool mEditable; | ||||
/** Flag indicating whether the layer is in read-only mode (editing dis abled) or not */ | /** Flag indicating whether the layer is in read-only mode (editing dis abled) or not */ | |||
bool mReadOnly; | bool mReadOnly; | |||
/** Flag indicating whether the layer has been modified since the last | ||||
commit */ | ||||
bool mModified; | ||||
/** cache of the committed geometries retrieved *for the current displa | ||||
y* */ | ||||
QgsGeometryMap mCachedGeometries; | ||||
/** extent for which there are cached geometries */ | ||||
QgsRectangle mCachedGeometriesRect; | ||||
/** Set holding the feature IDs that are activated. Note that if a fea ture | /** Set holding the feature IDs that are activated. Note that if a fea ture | |||
subsequently gets deleted (i.e. by its addition to mDeletedFeatureI ds), | subsequently gets deleted (i.e. by its addition to mDeletedFeatureI ds), | |||
it always needs to be removed from mSelectedFeatureIds as well. | it always needs to be removed from mSelectedFeatureIds as well. | |||
*/ | */ | |||
QgsFeatureIds mSelectedFeatureIds; | QgsFeatureIds mSelectedFeatureIds; | |||
/** Deleted feature IDs which are not commited. Note a feature can be | ||||
added and then deleted | ||||
again before the change is committed - in that case the added featu | ||||
re would be removed | ||||
from mAddedFeatures only and *not* entered here. | ||||
*/ | ||||
QgsFeatureIds mDeletedFeatureIds; | ||||
/** New features which are not commited. Note a feature can be added a | ||||
nd then changed, | ||||
therefore the details here can be overridden by mChangedAttributeVa | ||||
lues and mChangedGeometries. | ||||
*/ | ||||
QgsFeatureList mAddedFeatures; | ||||
/** Changed attributes values which are not commited */ | ||||
QgsChangedAttributesMap mChangedAttributeValues; | ||||
/** deleted attributes fields which are not commited */ | ||||
QgsAttributeIds mDeletedAttributeIds; | ||||
/** added attributes fields which are not commited */ | ||||
QgsAttributeIds mAddedAttributeIds; | ||||
/** Changed geometries which are not commited. */ | ||||
QgsGeometryMap mChangedGeometries; | ||||
/** field map to commit */ | /** field map to commit */ | |||
QgsFieldMap mUpdatedFields; | QgsFields mUpdatedFields; | |||
/**Map that stores the aliases for attributes. Key is the attribute nam e and value the alias for that attribute*/ | /**Map that stores the aliases for attributes. Key is the attribute nam e and value the alias for that attribute*/ | |||
QMap< QString, QString > mAttributeAliasMap; | QMap< QString, QString > mAttributeAliasMap; | |||
/** max field index */ | /**Stores a list of attribute editor elements (Each holding a tree stru | |||
int mMaxUpdatedIndex; | cture for a tab in the attribute editor)*/ | |||
QList< QgsAttributeEditorElement* > mAttributeEditorElements; | ||||
/**Attributes which are not published in WMS*/ | ||||
QSet<QString> mExcludeAttributesWMS; | ||||
/**Attributes which are not published in WFS*/ | ||||
QSet<QString> mExcludeAttributesWFS; | ||||
/**Map that stores the tab for attributes in the edit form. Key is the | ||||
tab order and value the tab name*/ | ||||
QList< TabData > mTabs; | ||||
/** Geometry type as defined in enum WkbType (qgis.h) */ | /** Geometry type as defined in enum WkbType (qgis.h) */ | |||
int mWkbType; | int mWkbType; | |||
QgsUndoCommand * mActiveCommand; | ||||
/** Renderer object which holds the information about how to display th e features */ | /** Renderer object which holds the information about how to display th e features */ | |||
QgsRenderer *mRenderer; | ||||
/** Renderer V2 */ | ||||
QgsFeatureRendererV2 *mRendererV2; | QgsFeatureRendererV2 *mRendererV2; | |||
/** whether to use V1 or V2 renderer */ | ||||
bool mUsingRendererV2; | ||||
/** Label */ | /** Label */ | |||
QgsLabel *mLabel; | QgsLabel *mLabel; | |||
/** Display labels */ | /** Display labels */ | |||
bool mLabelOn; | bool mLabelOn; | |||
/** Whether 'labeling font not found' has be shown for this layer (only | ||||
show once in QgsMessageBar, on first rendering) */ | ||||
bool mLabelFontNotFoundNotified; | ||||
/** Blend mode for features */ | ||||
QPainter::CompositionMode mFeatureBlendMode; | ||||
/** Layer transparency */ | ||||
int mLayerTransparency; | ||||
/**The current type of editing marker*/ | /**The current type of editing marker*/ | |||
QgsVectorLayer::VertexMarkerType mCurrentVertexMarkerType; | QgsVectorLayer::VertexMarkerType mCurrentVertexMarkerType; | |||
/** The current size of editing marker */ | /** The current size of editing marker */ | |||
int mCurrentVertexMarkerSize; | int mCurrentVertexMarkerSize; | |||
/**Flag if the vertex markers should be drawn only for selection (true) or for all features (false)*/ | /** Flag if the vertex markers should be drawn only for selection (true ) or for all features (false) */ | |||
bool mVertexMarkerOnlyForSelection; | bool mVertexMarkerOnlyForSelection; | |||
/**List of overlays. Vector overlays will be rendered on top of all map | ||||
layers*/ | ||||
QList<QgsVectorOverlay*> mOverlays; | ||||
QStringList mCommitErrors; | QStringList mCommitErrors; | |||
QMap< QString, EditType > mEditTypes; | QMap< QString, EditType > mEditTypes; | |||
QMap< QString, bool> mFieldEditables; | ||||
QMap< QString, bool> mLabelOnTop; | ||||
QMap< QString, QMap<QString, QVariant> > mValueMaps; | QMap< QString, QMap<QString, QVariant> > mValueMaps; | |||
QMap< QString, RangeData > mRanges; | QMap< QString, RangeData > mRanges; | |||
QMap< QString, QPair<QString, QString> > mCheckedStates; | QMap< QString, QPair<QString, QString> > mCheckedStates; | |||
QMap< QString, ValueRelationData > mValueRelations; | QMap< QString, ValueRelationData > mValueRelations; | |||
QMap< QString, QString> mDateFormats; | ||||
QMap< QString, QSize> mWidgetSize; | ||||
/** Defines the default layout to use for the attribute editor (Drag an | ||||
d drop, UI File, Generated) */ | ||||
EditorLayout mEditorLayout; | ||||
QString mEditForm, mEditFormInit; | QString mEditForm, mEditFormInit; | |||
//annotation form for this layer | //annotation form for this layer | |||
QString mAnnotationForm; | QString mAnnotationForm; | |||
bool mFetching; | //! cache for some vector layer data - currently only geometries for fa | |||
QgsRectangle mFetchRect; | ster editing | |||
QgsAttributeList mFetchAttributes; | QgsGeometryCache* mCache; | |||
QgsAttributeList mFetchProvAttributes; | ||||
bool mFetchGeometry; | //! stores information about uncommitted changes to layer | |||
QgsVectorLayerEditBuffer* mEditBuffer; | ||||
QSet<QgsFeatureId> mFetchConsidered; | friend class QgsVectorLayerEditBuffer; | |||
QgsGeometryMap::iterator mFetchChangedGeomIt; | ||||
QgsFeatureList::iterator mFetchAddedFeaturesIt; | ||||
//stores information about joined layers | //stores information about joined layers | |||
QgsVectorLayerJoinBuffer* mJoinBuffer; | QgsVectorLayerJoinBuffer* mJoinBuffer; | |||
//diagram rendering object. 0 if diagram drawing is disabled | //diagram rendering object. 0 if diagram drawing is disabled | |||
QgsDiagramRendererV2* mDiagramRenderer; | QgsDiagramRendererV2* mDiagramRenderer; | |||
//stores infos about diagram placement (placement type, priority, posit ion distance) | //stores infos about diagram placement (placement type, priority, posit ion distance) | |||
QgsDiagramLayerSettings *mDiagramLayerSettings; | QgsDiagramLayerSettings *mDiagramLayerSettings; | |||
bool mValidExtent; | ||||
// Features in renderer classes counted | ||||
bool mSymbolFeatureCounted; | ||||
// Feature counts for each renderer symbol | ||||
QMap<QgsSymbolV2*, long> mSymbolFeatureCountMap; | ||||
QgsRenderContext* mCurrentRendererContext; | ||||
friend class QgsVectorLayerFeatureIterator; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 110 change blocks. | ||||
351 lines changed or deleted | 1041 lines changed or added | |||
qgsvectorlayerimport.h | qgsvectorlayerimport.h | |||
---|---|---|---|---|
skipping to change at line 25 | skipping to change at line 25 | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef _QGSVECTORLAYERIMPORT_H_ | #ifndef _QGSVECTORLAYERIMPORT_H_ | |||
#define _QGSVECTORLAYERIMPORT_H_ | #define _QGSVECTORLAYERIMPORT_H_ | |||
#include "qgsvectordataprovider.h" | #include "qgsvectordataprovider.h" | |||
#include "qgsvectorlayer.h" | #include "qgsvectorlayer.h" | |||
class QProgressDialog; | ||||
/** \ingroup core | /** \ingroup core | |||
* A convenience class for writing vector files to disk. | * A convenience class for writing vector files to disk. | |||
There are two possibilities how to use this class: | There are two possibilities how to use this class: | |||
1. static call to QgsVectorFileWriter::writeAsShapefile(...) which saves t he whole vector layer | 1. static call to QgsVectorFileWriter::writeAsShapefile(...) which saves t he whole vector layer | |||
2. create an instance of the class and issue calls to addFeature(...) | 2. create an instance of the class and issue calls to addFeature(...) | |||
Currently supports only writing to shapefiles, but shouldn't be a problem to add capability | Currently supports only writing to shapefiles, but shouldn't be a problem to add capability | |||
to support other OGR-writable formats. | to support other OGR-writable formats. | |||
*/ | */ | |||
class CORE_EXPORT QgsVectorLayerImport | class CORE_EXPORT QgsVectorLayerImport | |||
skipping to change at line 62 | skipping to change at line 64 | |||
}; | }; | |||
/** Write contents of vector layer to a different datasource */ | /** Write contents of vector layer to a different datasource */ | |||
static ImportError importLayer( QgsVectorLayer* layer, | static ImportError importLayer( QgsVectorLayer* layer, | |||
const QString& uri, | const QString& uri, | |||
const QString& providerKey, | const QString& providerKey, | |||
const QgsCoordinateReferenceSystem *des tCRS, | const QgsCoordinateReferenceSystem *des tCRS, | |||
bool onlySelected = false, | bool onlySelected = false, | |||
QString *errorMessage = 0, | QString *errorMessage = 0, | |||
bool skipAttributeCreation = false, | bool skipAttributeCreation = false, | |||
QMap<QString, QVariant> *options = 0 | QMap<QString, QVariant> *options = 0, | |||
QProgressDialog *progress = 0 | ||||
); | ); | |||
/** create a empty layer and add fields to it */ | /** create a empty layer and add fields to it */ | |||
QgsVectorLayerImport( const QString &uri, | QgsVectorLayerImport( const QString &uri, | |||
const QString &provider, | const QString &provider, | |||
const QgsFieldMap& fields, | const QgsFields &fields, | |||
QGis::WkbType geometryType, | QGis::WkbType geometryType, | |||
const QgsCoordinateReferenceSystem* crs, | const QgsCoordinateReferenceSystem* crs, | |||
bool overwrite = false, | bool overwrite = false, | |||
const QMap<QString, QVariant> *options = 0 | const QMap<QString, QVariant> *options = 0, | |||
QProgressDialog *progress = 0 | ||||
); | ); | |||
/** checks whether there were any errors */ | /** checks whether there were any errors */ | |||
ImportError hasError(); | ImportError hasError(); | |||
/** retrieves error message */ | /** retrieves error message */ | |||
QString errorMessage(); | QString errorMessage(); | |||
int errorCount() const { return mErrorCount; } | int errorCount() const { return mErrorCount; } | |||
/** add feature to the new created layer */ | /** add feature to the new created layer */ | |||
bool addFeature( QgsFeature& feature ); | bool addFeature( QgsFeature& feature ); | |||
/** close the new created layer */ | /** close the new created layer */ | |||
~QgsVectorLayerImport(); | ~QgsVectorLayerImport(); | |||
protected: | protected: | |||
/** flush the buffer writing the features to the new layer */ | /** flush the buffer writing the features to the new layer */ | |||
bool flushBuffer(); | bool flushBuffer(); | |||
/** create index */ | ||||
bool createSpatialIndex(); | ||||
/** contains error value */ | /** contains error value */ | |||
ImportError mError; | ImportError mError; | |||
QString mErrorMessage; | QString mErrorMessage; | |||
int mErrorCount; | int mErrorCount; | |||
QgsVectorDataProvider *mProvider; | QgsVectorDataProvider *mProvider; | |||
/** map attribute indexes to new field indexes */ | /** map attribute indexes to new field indexes */ | |||
QMap<int, int> mOldToNewAttrIdx; | QMap<int, int> mOldToNewAttrIdx; | |||
int mAttributeCount; | ||||
QgsFeatureList mFeatureBuffer; | QgsFeatureList mFeatureBuffer; | |||
QProgressDialog *mProgress; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
3 lines changed or deleted | 12 lines changed or added | |||
qgsvectorrandomcolorrampv2dialog.h | qgsvectorrandomcolorrampv2dialog.h | |||
---|---|---|---|---|
/************************************************************************** * | /************************************************************************** * | |||
qgsvectorrandomcolorrampv2dialog.h | qgsvectorrandomcolorrampv2dialog.h | |||
--------------------- | --------------------- | |||
begin : December 2009 | begin : December 2009 | |||
copyright : (C) 2009 by Martin Dobias | copyright : (C) 2009 by Martin Dobias | |||
email : wonder.sk at gmail.com | email : wonder dot sk at gmail dot com | |||
************************************************************************** * | ************************************************************************** * | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
************************************************************************** */ | ************************************************************************** */ | |||
#ifndef QGSVECTORRANDOMCOLORRAMPV2DIALOG_H | #ifndef QGSVECTORRANDOMCOLORRAMPV2DIALOG_H | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
qgszonalstatistics.h | qgszonalstatistics.h | |||
---|---|---|---|---|
skipping to change at line 57 | skipping to change at line 57 | |||
void statisticsFromMiddlePointTest( void* band, QgsGeometry* poly, int pixelOffsetX, int pixelOffsetY, int nCellsX, int nCellsY, | void statisticsFromMiddlePointTest( void* band, QgsGeometry* poly, int pixelOffsetX, int pixelOffsetY, int nCellsX, int nCellsY, | |||
double cellSizeX, double cellSizeY, const QgsRectangle& rasterBBox, double& sum, double& count ); | double cellSizeX, double cellSizeY, const QgsRectangle& rasterBBox, double& sum, double& count ); | |||
void statisticsFromMiddlePointTest_improved( void* band, QgsGeometry* p oly, int pixelOffsetX, int pixelOffsetY, int nCellsX, int nCellsY, | void statisticsFromMiddlePointTest_improved( void* band, QgsGeometry* p oly, int pixelOffsetX, int pixelOffsetY, int nCellsX, int nCellsY, | |||
double cellSizeX, double cellSizeY, const QgsRectangle& rasterBBox, double& sum, double& count ); | double cellSizeX, double cellSizeY, const QgsRectangle& rasterBBox, double& sum, double& count ); | |||
/**Returns statistics with precise pixel - polygon intersection test (s low) */ | /**Returns statistics with precise pixel - polygon intersection test (s low) */ | |||
void statisticsFromPreciseIntersection( void* band, QgsGeometry* poly, int pixelOffsetX, int pixelOffsetY, int nCellsX, int nCellsY, | void statisticsFromPreciseIntersection( void* band, QgsGeometry* poly, int pixelOffsetX, int pixelOffsetY, int nCellsX, int nCellsY, | |||
double cellSizeX, double cellSi zeY, const QgsRectangle& rasterBBox, double& sum, double& count ); | double cellSizeX, double cellSi zeY, const QgsRectangle& rasterBBox, double& sum, double& count ); | |||
QString getUniqueFieldName( QString fieldName ); | ||||
QString mRasterFilePath; | QString mRasterFilePath; | |||
/**Raster band to calculate statistics from (defaults to 1)*/ | /**Raster band to calculate statistics from (defaults to 1)*/ | |||
int mRasterBand; | int mRasterBand; | |||
QgsVectorLayer* mPolygonLayer; | QgsVectorLayer* mPolygonLayer; | |||
QString mAttributePrefix; | QString mAttributePrefix; | |||
/**The nodata value of the input layer*/ | /**The nodata value of the input layer*/ | |||
float mInputNodataValue; | float mInputNodataValue; | |||
}; | }; | |||
#endif // QGSZONALSTATISTICS_H | #endif // QGSZONALSTATISTICS_H | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 2 lines changed or added | |||
ui_qgscredentialdialog.h | ui_qgscredentialdialog.h | |||
---|---|---|---|---|
/************************************************************************** ****** | /************************************************************************** ****** | |||
** Form generated from reading UI file 'qgscredentialdialog.ui' | ** Form generated from reading UI file 'qgscredentialdialog.ui' | |||
** | ** | |||
** Created: Wed Jun 13 12:06:00 2012 | ** Created by: Qt User Interface Compiler version 4.8.5 | |||
** by: Qt User Interface Compiler version 4.7.4 | ||||
** | ** | |||
** WARNING! All changes made in this file will be lost when recompiling UI file! | ** WARNING! All changes made in this file will be lost when recompiling UI file! | |||
*************************************************************************** *****/ | *************************************************************************** *****/ | |||
#ifndef UI_QGSCREDENTIALDIALOG_H | #ifndef UI_QGSCREDENTIALDIALOG_H | |||
#define UI_QGSCREDENTIALDIALOG_H | #define UI_QGSCREDENTIALDIALOG_H | |||
#include <QtCore/QVariant> | #include <QtCore/QVariant> | |||
#include <QtGui/QAction> | #include <QtGui/QAction> | |||
#include <QtGui/QApplication> | #include <QtGui/QApplication> | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added | |||
ui_qgsdetaileditemwidgetbase.h | ui_qgsdetaileditemwidgetbase.h | |||
---|---|---|---|---|
/************************************************************************** ****** | /************************************************************************** ****** | |||
** Form generated from reading UI file 'qgsdetaileditemwidgetbase.ui' | ** Form generated from reading UI file 'qgsdetaileditemwidgetbase.ui' | |||
** | ** | |||
** Created: Wed Jun 13 12:05:58 2012 | ** Created by: Qt User Interface Compiler version 4.8.5 | |||
** by: Qt User Interface Compiler version 4.7.4 | ||||
** | ** | |||
** WARNING! All changes made in this file will be lost when recompiling UI file! | ** WARNING! All changes made in this file will be lost when recompiling UI file! | |||
*************************************************************************** *****/ | *************************************************************************** *****/ | |||
#ifndef UI_QGSDETAILEDITEMWIDGETBASE_H | #ifndef UI_QGSDETAILEDITEMWIDGETBASE_H | |||
#define UI_QGSDETAILEDITEMWIDGETBASE_H | #define UI_QGSDETAILEDITEMWIDGETBASE_H | |||
#include <QtCore/QVariant> | #include <QtCore/QVariant> | |||
#include <QtGui/QAction> | #include <QtGui/QAction> | |||
#include <QtGui/QApplication> | #include <QtGui/QApplication> | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added | |||
ui_qgsexpressionbuilder.h | ui_qgsexpressionbuilder.h | |||
---|---|---|---|---|
/************************************************************************** ****** | /************************************************************************** ****** | |||
** Form generated from reading UI file 'qgsexpressionbuilder.ui' | ** Form generated from reading UI file 'qgsexpressionbuilder.ui' | |||
** | ** | |||
** Created: Wed Jun 13 12:06:00 2012 | ** Created by: Qt User Interface Compiler version 4.8.5 | |||
** by: Qt User Interface Compiler version 4.7.4 | ||||
** | ** | |||
** WARNING! All changes made in this file will be lost when recompiling UI file! | ** WARNING! All changes made in this file will be lost when recompiling UI file! | |||
*************************************************************************** *****/ | *************************************************************************** *****/ | |||
#ifndef UI_QGSEXPRESSIONBUILDER_H | #ifndef UI_QGSEXPRESSIONBUILDER_H | |||
#define UI_QGSEXPRESSIONBUILDER_H | #define UI_QGSEXPRESSIONBUILDER_H | |||
#include <QtCore/QVariant> | #include <QtCore/QVariant> | |||
#include <QtGui/QAction> | #include <QtGui/QAction> | |||
#include <QtGui/QApplication> | #include <QtGui/QApplication> | |||
#include <QtGui/QButtonGroup> | #include <QtGui/QButtonGroup> | |||
#include <QtGui/QGridLayout> | #include <QtGui/QGridLayout> | |||
#include <QtGui/QGroupBox> | #include <QtGui/QGroupBox> | |||
#include <QtGui/QHBoxLayout> | #include <QtGui/QHBoxLayout> | |||
#include <QtGui/QHeaderView> | #include <QtGui/QHeaderView> | |||
#include <QtGui/QLabel> | #include <QtGui/QLabel> | |||
#include <QtGui/QLineEdit> | ||||
#include <QtGui/QListWidget> | #include <QtGui/QListWidget> | |||
#include <QtGui/QPushButton> | #include <QtGui/QPushButton> | |||
#include <QtGui/QSpacerItem> | ||||
#include <QtGui/QTextEdit> | #include <QtGui/QTextEdit> | |||
#include <QtGui/QTreeView> | #include <QtGui/QTreeView> | |||
#include <QtGui/QVBoxLayout> | #include <QtGui/QVBoxLayout> | |||
#include <QtGui/QWidget> | #include <QtGui/QWidget> | |||
#include "qgsfilterlineedit.h" | ||||
QT_BEGIN_NAMESPACE | QT_BEGIN_NAMESPACE | |||
class Ui_QgsExpressionBuilderWidgetBase | class Ui_QgsExpressionBuilderWidgetBase | |||
{ | { | |||
public: | public: | |||
QGridLayout *gridLayout; | QGridLayout *gridLayout; | |||
QGridLayout *gridLayout_3; | QGridLayout *gridLayout_3; | |||
QGroupBox *moperationListGroup; | QGroupBox *moperationListGroup; | |||
QGridLayout *gridLayout_6; | QGridLayout *gridLayout_6; | |||
QTreeView *expressionTree; | QTreeView *expressionTree; | |||
QHBoxLayout *horizontalLayout; | QgsFilterLineEdit *txtSearchEdit; | |||
QLabel *label; | ||||
QLineEdit *txtSearchEdit; | ||||
QVBoxLayout *verticalLayout_2; | QVBoxLayout *verticalLayout_2; | |||
QGroupBox *mFunctionHelGroup; | QGroupBox *mFunctionHelGroup; | |||
QGridLayout *gridLayout_4; | QGridLayout *gridLayout_4; | |||
QTextEdit *txtHelpText; | QTextEdit *txtHelpText; | |||
QGroupBox *mValueGroupBox; | QGroupBox *mValueGroupBox; | |||
QGridLayout *gridLayout_7; | QGridLayout *gridLayout_7; | |||
QListWidget *mValueListWidget; | QListWidget *mValueListWidget; | |||
QHBoxLayout *horizontalLayout_5; | ||||
QPushButton *btnLoadAll; | ||||
QPushButton *btnLoadSample; | ||||
QGroupBox *mOperatorsGroupBox; | QGroupBox *mOperatorsGroupBox; | |||
QHBoxLayout *horizontalLayout_2; | QHBoxLayout *horizontalLayout_2; | |||
QPushButton *btnEqualPushButton; | QPushButton *btnEqualPushButton; | |||
QPushButton *btnPlusPushButton; | QPushButton *btnPlusPushButton; | |||
QPushButton *btnMinusPushButton; | QPushButton *btnMinusPushButton; | |||
QPushButton *btnDividePushButton; | QPushButton *btnDividePushButton; | |||
QPushButton *btnMultiplyPushButton; | QPushButton *btnMultiplyPushButton; | |||
QPushButton *btnExpButton; | QPushButton *btnExpButton; | |||
QPushButton *btnConcatButton; | QPushButton *btnConcatButton; | |||
QPushButton *btnOpenBracketPushButton; | QPushButton *btnOpenBracketPushButton; | |||
QPushButton *btnCloseBracketPushButton; | QPushButton *btnCloseBracketPushButton; | |||
QHBoxLayout *horizontalLayout_3; | QHBoxLayout *horizontalLayout_3; | |||
QLabel *label_2; | QLabel *label_2; | |||
QLabel *lblPreview; | QLabel *lblPreview; | |||
QGroupBox *groupBox; | QGroupBox *groupBox; | |||
QGridLayout *gridLayout_2; | QGridLayout *gridLayout_2; | |||
QTextEdit *txtExpressionString; | QTextEdit *txtExpressionString; | |||
QVBoxLayout *opensaveLayout; | ||||
QPushButton *btnSave; | ||||
QPushButton *btnOpen; | ||||
QSpacerItem *verticalSpacer; | ||||
void setupUi(QWidget *QgsExpressionBuilderWidgetBase) | void setupUi(QWidget *QgsExpressionBuilderWidgetBase) | |||
{ | { | |||
if (QgsExpressionBuilderWidgetBase->objectName().isEmpty()) | if (QgsExpressionBuilderWidgetBase->objectName().isEmpty()) | |||
QgsExpressionBuilderWidgetBase->setObjectName(QString::fromUtf8 ("QgsExpressionBuilderWidgetBase")); | QgsExpressionBuilderWidgetBase->setObjectName(QString::fromUtf8 ("QgsExpressionBuilderWidgetBase")); | |||
QgsExpressionBuilderWidgetBase->resize(561, 587); | QgsExpressionBuilderWidgetBase->resize(561, 587); | |||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferr ed); | QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferr ed); | |||
sizePolicy.setHorizontalStretch(0); | sizePolicy.setHorizontalStretch(0); | |||
sizePolicy.setVerticalStretch(0); | sizePolicy.setVerticalStretch(0); | |||
sizePolicy.setHeightForWidth(QgsExpressionBuilderWidgetBase->sizePo licy().hasHeightForWidth()); | sizePolicy.setHeightForWidth(QgsExpressionBuilderWidgetBase->sizePo licy().hasHeightForWidth()); | |||
skipping to change at line 96 | skipping to change at line 91 | |||
gridLayout->setHorizontalSpacing(0); | gridLayout->setHorizontalSpacing(0); | |||
gridLayout->setVerticalSpacing(3); | gridLayout->setVerticalSpacing(3); | |||
gridLayout_3 = new QGridLayout(); | gridLayout_3 = new QGridLayout(); | |||
gridLayout_3->setSpacing(10); | gridLayout_3->setSpacing(10); | |||
gridLayout_3->setObjectName(QString::fromUtf8("gridLayout_3")); | gridLayout_3->setObjectName(QString::fromUtf8("gridLayout_3")); | |||
moperationListGroup = new QGroupBox(QgsExpressionBuilderWidgetBase) ; | moperationListGroup = new QGroupBox(QgsExpressionBuilderWidgetBase) ; | |||
moperationListGroup->setObjectName(QString::fromUtf8("moperationLis tGroup")); | moperationListGroup->setObjectName(QString::fromUtf8("moperationLis tGroup")); | |||
moperationListGroup->setFlat(true); | moperationListGroup->setFlat(true); | |||
gridLayout_6 = new QGridLayout(moperationListGroup); | gridLayout_6 = new QGridLayout(moperationListGroup); | |||
gridLayout_6->setSpacing(0); | gridLayout_6->setSpacing(0); | |||
gridLayout_6->setContentsMargins(0, 0, 0, 0); | ||||
gridLayout_6->setObjectName(QString::fromUtf8("gridLayout_6")); | gridLayout_6->setObjectName(QString::fromUtf8("gridLayout_6")); | |||
gridLayout_6->setContentsMargins(0, -1, 0, 0); | ||||
expressionTree = new QTreeView(moperationListGroup); | expressionTree = new QTreeView(moperationListGroup); | |||
expressionTree->setObjectName(QString::fromUtf8("expressionTree")); | expressionTree->setObjectName(QString::fromUtf8("expressionTree")); | |||
expressionTree->setFrameShape(QFrame::StyledPanel); | expressionTree->setFrameShape(QFrame::StyledPanel); | |||
expressionTree->setFrameShadow(QFrame::Sunken); | expressionTree->setFrameShadow(QFrame::Sunken); | |||
expressionTree->setEditTriggers(QAbstractItemView::NoEditTriggers); | expressionTree->setEditTriggers(QAbstractItemView::NoEditTriggers); | |||
expressionTree->setUniformRowHeights(false); | expressionTree->setUniformRowHeights(false); | |||
expressionTree->setSortingEnabled(false); | expressionTree->setSortingEnabled(false); | |||
expressionTree->setAnimated(true); | expressionTree->setAnimated(true); | |||
expressionTree->header()->setVisible(false); | expressionTree->header()->setVisible(false); | |||
gridLayout_6->addWidget(expressionTree, 5, 0, 1, 1); | gridLayout_6->addWidget(expressionTree, 4, 0, 1, 1); | |||
horizontalLayout = new QHBoxLayout(); | txtSearchEdit = new QgsFilterLineEdit(moperationListGroup); | |||
horizontalLayout->setSpacing(0); | ||||
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout | ||||
")); | ||||
horizontalLayout->setContentsMargins(-1, 2, -1, 2); | ||||
label = new QLabel(moperationListGroup); | ||||
label->setObjectName(QString::fromUtf8("label")); | ||||
label->setEnabled(true); | ||||
label->setScaledContents(false); | ||||
horizontalLayout->addWidget(label); | ||||
txtSearchEdit = new QLineEdit(moperationListGroup); | ||||
txtSearchEdit->setObjectName(QString::fromUtf8("txtSearchEdit")); | txtSearchEdit->setObjectName(QString::fromUtf8("txtSearchEdit")); | |||
txtSearchEdit->setEnabled(true); | txtSearchEdit->setEnabled(true); | |||
horizontalLayout->addWidget(txtSearchEdit); | gridLayout_6->addWidget(txtSearchEdit, 2, 0, 1, 1); | |||
gridLayout_6->addLayout(horizontalLayout, 2, 0, 1, 1); | ||||
gridLayout_3->addWidget(moperationListGroup, 0, 0, 1, 1); | gridLayout_3->addWidget(moperationListGroup, 0, 0, 1, 1); | |||
verticalLayout_2 = new QVBoxLayout(); | verticalLayout_2 = new QVBoxLayout(); | |||
verticalLayout_2->setSpacing(0); | verticalLayout_2->setSpacing(0); | |||
verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2 ")); | verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2 ")); | |||
verticalLayout_2->setSizeConstraint(QLayout::SetDefaultConstraint); | verticalLayout_2->setSizeConstraint(QLayout::SetDefaultConstraint); | |||
verticalLayout_2->setContentsMargins(-1, 0, 0, -1); | verticalLayout_2->setContentsMargins(-1, 0, 0, 0); | |||
mFunctionHelGroup = new QGroupBox(QgsExpressionBuilderWidgetBase); | mFunctionHelGroup = new QGroupBox(QgsExpressionBuilderWidgetBase); | |||
mFunctionHelGroup->setObjectName(QString::fromUtf8("mFunctionHelGro up")); | mFunctionHelGroup->setObjectName(QString::fromUtf8("mFunctionHelGro up")); | |||
mFunctionHelGroup->setFlat(true); | mFunctionHelGroup->setFlat(true); | |||
gridLayout_4 = new QGridLayout(mFunctionHelGroup); | gridLayout_4 = new QGridLayout(mFunctionHelGroup); | |||
gridLayout_4->setSpacing(0); | gridLayout_4->setSpacing(0); | |||
gridLayout_4->setObjectName(QString::fromUtf8("gridLayout_4")); | gridLayout_4->setObjectName(QString::fromUtf8("gridLayout_4")); | |||
gridLayout_4->setContentsMargins(0, 3, 0, 0); | gridLayout_4->setContentsMargins(0, -1, 0, 0); | |||
txtHelpText = new QTextEdit(mFunctionHelGroup); | txtHelpText = new QTextEdit(mFunctionHelGroup); | |||
txtHelpText->setObjectName(QString::fromUtf8("txtHelpText")); | txtHelpText->setObjectName(QString::fromUtf8("txtHelpText")); | |||
txtHelpText->setReadOnly(true); | txtHelpText->setReadOnly(true); | |||
gridLayout_4->addWidget(txtHelpText, 0, 0, 1, 1); | gridLayout_4->addWidget(txtHelpText, 0, 0, 1, 1); | |||
verticalLayout_2->addWidget(mFunctionHelGroup); | verticalLayout_2->addWidget(mFunctionHelGroup); | |||
mValueGroupBox = new QGroupBox(QgsExpressionBuilderWidgetBase); | mValueGroupBox = new QGroupBox(QgsExpressionBuilderWidgetBase); | |||
mValueGroupBox->setObjectName(QString::fromUtf8("mValueGroupBox")); | mValueGroupBox->setObjectName(QString::fromUtf8("mValueGroupBox")); | |||
mValueGroupBox->setFlat(true); | mValueGroupBox->setFlat(true); | |||
gridLayout_7 = new QGridLayout(mValueGroupBox); | gridLayout_7 = new QGridLayout(mValueGroupBox); | |||
gridLayout_7->setSpacing(0); | gridLayout_7->setSpacing(0); | |||
gridLayout_7->setObjectName(QString::fromUtf8("gridLayout_7")); | gridLayout_7->setObjectName(QString::fromUtf8("gridLayout_7")); | |||
gridLayout_7->setContentsMargins(0, 3, 0, 0); | gridLayout_7->setContentsMargins(0, -1, 0, 0); | |||
mValueListWidget = new QListWidget(mValueGroupBox); | mValueListWidget = new QListWidget(mValueGroupBox); | |||
mValueListWidget->setObjectName(QString::fromUtf8("mValueListWidget ")); | mValueListWidget->setObjectName(QString::fromUtf8("mValueListWidget ")); | |||
QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Expand ing); | QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Expand ing); | |||
sizePolicy1.setHorizontalStretch(0); | sizePolicy1.setHorizontalStretch(0); | |||
sizePolicy1.setVerticalStretch(0); | sizePolicy1.setVerticalStretch(0); | |||
sizePolicy1.setHeightForWidth(mValueListWidget->sizePolicy().hasHei ghtForWidth()); | sizePolicy1.setHeightForWidth(mValueListWidget->sizePolicy().hasHei ghtForWidth()); | |||
mValueListWidget->setSizePolicy(sizePolicy1); | mValueListWidget->setSizePolicy(sizePolicy1); | |||
mValueListWidget->setMaximumSize(QSize(16777215, 16777215)); | mValueListWidget->setMaximumSize(QSize(16777215, 16777215)); | |||
mValueListWidget->setAutoFillBackground(false); | mValueListWidget->setAutoFillBackground(false); | |||
mValueListWidget->setEditTriggers(QAbstractItemView::NoEditTriggers ); | mValueListWidget->setEditTriggers(QAbstractItemView::NoEditTriggers ); | |||
mValueListWidget->setProperty("showDropIndicator", QVariant(false)) ; | mValueListWidget->setProperty("showDropIndicator", QVariant(false)) ; | |||
mValueListWidget->setAlternatingRowColors(true); | mValueListWidget->setAlternatingRowColors(true); | |||
mValueListWidget->setViewMode(QListView::ListMode); | mValueListWidget->setViewMode(QListView::ListMode); | |||
gridLayout_7->addWidget(mValueListWidget, 0, 0, 1, 1); | gridLayout_7->addWidget(mValueListWidget, 0, 0, 1, 2); | |||
verticalLayout_2->addWidget(mValueGroupBox); | verticalLayout_2->addWidget(mValueGroupBox); | |||
horizontalLayout_5 = new QHBoxLayout(); | ||||
horizontalLayout_5->setObjectName(QString::fromUtf8("horizontalLayo | ||||
ut_5")); | ||||
horizontalLayout_5->setContentsMargins(6, -1, -1, -1); | ||||
btnLoadAll = new QPushButton(QgsExpressionBuilderWidgetBase); | ||||
btnLoadAll->setObjectName(QString::fromUtf8("btnLoadAll")); | ||||
horizontalLayout_5->addWidget(btnLoadAll); | ||||
btnLoadSample = new QPushButton(QgsExpressionBuilderWidgetBase); | ||||
btnLoadSample->setObjectName(QString::fromUtf8("btnLoadSample")); | ||||
horizontalLayout_5->addWidget(btnLoadSample); | ||||
verticalLayout_2->addLayout(horizontalLayout_5); | ||||
gridLayout_3->addLayout(verticalLayout_2, 0, 1, 1, 1); | gridLayout_3->addLayout(verticalLayout_2, 0, 1, 1, 1); | |||
gridLayout->addLayout(gridLayout_3, 0, 0, 1, 1); | gridLayout->addLayout(gridLayout_3, 0, 0, 1, 1); | |||
mOperatorsGroupBox = new QGroupBox(QgsExpressionBuilderWidgetBase); | mOperatorsGroupBox = new QGroupBox(QgsExpressionBuilderWidgetBase); | |||
mOperatorsGroupBox->setObjectName(QString::fromUtf8("mOperatorsGrou pBox")); | mOperatorsGroupBox->setObjectName(QString::fromUtf8("mOperatorsGrou pBox")); | |||
QSizePolicy sizePolicy2(QSizePolicy::Fixed, QSizePolicy::Fixed); | QSizePolicy sizePolicy2(QSizePolicy::Fixed, QSizePolicy::Fixed); | |||
sizePolicy2.setHorizontalStretch(0); | sizePolicy2.setHorizontalStretch(0); | |||
sizePolicy2.setVerticalStretch(0); | sizePolicy2.setVerticalStretch(0); | |||
sizePolicy2.setHeightForWidth(mOperatorsGroupBox->sizePolicy().hasH eightForWidth()); | sizePolicy2.setHeightForWidth(mOperatorsGroupBox->sizePolicy().hasH eightForWidth()); | |||
skipping to change at line 198 | skipping to change at line 195 | |||
mOperatorsGroupBox->setMaximumSize(QSize(300, 16777215)); | mOperatorsGroupBox->setMaximumSize(QSize(300, 16777215)); | |||
mOperatorsGroupBox->setSizeIncrement(QSize(20, 0)); | mOperatorsGroupBox->setSizeIncrement(QSize(20, 0)); | |||
mOperatorsGroupBox->setBaseSize(QSize(7, 0)); | mOperatorsGroupBox->setBaseSize(QSize(7, 0)); | |||
mOperatorsGroupBox->setLayoutDirection(Qt::LeftToRight); | mOperatorsGroupBox->setLayoutDirection(Qt::LeftToRight); | |||
mOperatorsGroupBox->setAutoFillBackground(false); | mOperatorsGroupBox->setAutoFillBackground(false); | |||
mOperatorsGroupBox->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt: :AlignTop); | mOperatorsGroupBox->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt: :AlignTop); | |||
mOperatorsGroupBox->setFlat(true); | mOperatorsGroupBox->setFlat(true); | |||
horizontalLayout_2 = new QHBoxLayout(mOperatorsGroupBox); | horizontalLayout_2 = new QHBoxLayout(mOperatorsGroupBox); | |||
horizontalLayout_2->setSpacing(2); | horizontalLayout_2->setSpacing(2); | |||
horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayo ut_2")); | horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayo ut_2")); | |||
horizontalLayout_2->setContentsMargins(0, 4, 0, 0); | horizontalLayout_2->setContentsMargins(0, -1, 0, 0); | |||
btnEqualPushButton = new QPushButton(mOperatorsGroupBox); | btnEqualPushButton = new QPushButton(mOperatorsGroupBox); | |||
btnEqualPushButton->setObjectName(QString::fromUtf8("btnEqualPushBu tton")); | btnEqualPushButton->setObjectName(QString::fromUtf8("btnEqualPushBu tton")); | |||
horizontalLayout_2->addWidget(btnEqualPushButton); | horizontalLayout_2->addWidget(btnEqualPushButton); | |||
btnPlusPushButton = new QPushButton(mOperatorsGroupBox); | btnPlusPushButton = new QPushButton(mOperatorsGroupBox); | |||
btnPlusPushButton->setObjectName(QString::fromUtf8("btnPlusPushButt on")); | btnPlusPushButton->setObjectName(QString::fromUtf8("btnPlusPushButt on")); | |||
QSizePolicy sizePolicy3(QSizePolicy::Minimum, QSizePolicy::Fixed); | QSizePolicy sizePolicy3(QSizePolicy::Minimum, QSizePolicy::Fixed); | |||
sizePolicy3.setHorizontalStretch(0); | sizePolicy3.setHorizontalStretch(0); | |||
sizePolicy3.setVerticalStretch(0); | sizePolicy3.setVerticalStretch(0); | |||
skipping to change at line 303 | skipping to change at line 300 | |||
sizePolicy5.setHorizontalStretch(0); | sizePolicy5.setHorizontalStretch(0); | |||
sizePolicy5.setVerticalStretch(0); | sizePolicy5.setVerticalStretch(0); | |||
sizePolicy5.setHeightForWidth(groupBox->sizePolicy().hasHeightForWi dth()); | sizePolicy5.setHeightForWidth(groupBox->sizePolicy().hasHeightForWi dth()); | |||
groupBox->setSizePolicy(sizePolicy5); | groupBox->setSizePolicy(sizePolicy5); | |||
groupBox->setMinimumSize(QSize(0, 0)); | groupBox->setMinimumSize(QSize(0, 0)); | |||
groupBox->setMaximumSize(QSize(16777215, 120)); | groupBox->setMaximumSize(QSize(16777215, 120)); | |||
groupBox->setBaseSize(QSize(0, 0)); | groupBox->setBaseSize(QSize(0, 0)); | |||
groupBox->setFlat(true); | groupBox->setFlat(true); | |||
gridLayout_2 = new QGridLayout(groupBox); | gridLayout_2 = new QGridLayout(groupBox); | |||
gridLayout_2->setSpacing(3); | gridLayout_2->setSpacing(3); | |||
gridLayout_2->setContentsMargins(0, 0, 0, 0); | ||||
gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2")); | gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2")); | |||
gridLayout_2->setContentsMargins(0, -1, 0, 0); | ||||
txtExpressionString = new QTextEdit(groupBox); | txtExpressionString = new QTextEdit(groupBox); | |||
txtExpressionString->setObjectName(QString::fromUtf8("txtExpression String")); | txtExpressionString->setObjectName(QString::fromUtf8("txtExpression String")); | |||
txtExpressionString->setMinimumSize(QSize(0, 32)); | txtExpressionString->setMinimumSize(QSize(0, 32)); | |||
txtExpressionString->viewport()->setProperty("cursor", QVariant(QCu rsor(Qt::IBeamCursor))); | txtExpressionString->viewport()->setProperty("cursor", QVariant(QCu rsor(Qt::IBeamCursor))); | |||
gridLayout_2->addWidget(txtExpressionString, 2, 0, 1, 1); | gridLayout_2->addWidget(txtExpressionString, 2, 0, 1, 1); | |||
opensaveLayout = new QVBoxLayout(); | ||||
opensaveLayout->setSpacing(3); | ||||
opensaveLayout->setObjectName(QString::fromUtf8("opensaveLayout")); | ||||
btnSave = new QPushButton(groupBox); | ||||
btnSave->setObjectName(QString::fromUtf8("btnSave")); | ||||
QIcon icon; | ||||
icon.addFile(QString::fromUtf8(":/images/themes/default/mActionFile | ||||
Save.png"), QSize(), QIcon::Normal, QIcon::Off); | ||||
btnSave->setIcon(icon); | ||||
opensaveLayout->addWidget(btnSave); | ||||
btnOpen = new QPushButton(groupBox); | ||||
btnOpen->setObjectName(QString::fromUtf8("btnOpen")); | ||||
QIcon icon1; | ||||
icon1.addFile(QString::fromUtf8(":/images/themes/gis/mActionFileOpe | ||||
n.png"), QSize(), QIcon::Normal, QIcon::Off); | ||||
btnOpen->setIcon(icon1); | ||||
opensaveLayout->addWidget(btnOpen); | ||||
verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSiz | ||||
ePolicy::Expanding); | ||||
opensaveLayout->addItem(verticalSpacer); | ||||
gridLayout_2->addLayout(opensaveLayout, 2, 1, 1, 1); | ||||
gridLayout->addWidget(groupBox, 2, 0, 1, 1); | gridLayout->addWidget(groupBox, 2, 0, 1, 1); | |||
retranslateUi(QgsExpressionBuilderWidgetBase); | retranslateUi(QgsExpressionBuilderWidgetBase); | |||
QMetaObject::connectSlotsByName(QgsExpressionBuilderWidgetBase); | QMetaObject::connectSlotsByName(QgsExpressionBuilderWidgetBase); | |||
} // setupUi | } // setupUi | |||
void retranslateUi(QWidget *QgsExpressionBuilderWidgetBase) | void retranslateUi(QWidget *QgsExpressionBuilderWidgetBase) | |||
{ | { | |||
QgsExpressionBuilderWidgetBase->setWindowTitle(QApplication::transl ate("QgsExpressionBuilderWidgetBase", "Form", 0, QApplication::UnicodeUTF8) ); | QgsExpressionBuilderWidgetBase->setWindowTitle(QApplication::transl ate("QgsExpressionBuilderWidgetBase", "Form", 0, QApplication::UnicodeUTF8) ); | |||
moperationListGroup->setTitle(QApplication::translate("QgsExpressio nBuilderWidgetBase", "Function List", 0, QApplication::UnicodeUTF8)); | moperationListGroup->setTitle(QApplication::translate("QgsExpressio nBuilderWidgetBase", "Function List", 0, QApplication::UnicodeUTF8)); | |||
label->setText(QApplication::translate("QgsExpressionBuilderWidgetB ase", "Search", 0, QApplication::UnicodeUTF8)); | ||||
mFunctionHelGroup->setTitle(QApplication::translate("QgsExpressionB uilderWidgetBase", "Selected Function Help", 0, QApplication::UnicodeUTF8)) ; | mFunctionHelGroup->setTitle(QApplication::translate("QgsExpressionB uilderWidgetBase", "Selected Function Help", 0, QApplication::UnicodeUTF8)) ; | |||
mValueGroupBox->setTitle(QApplication::translate("QgsExpressionBuil derWidgetBase", "Field Values", 0, QApplication::UnicodeUTF8)); | mValueGroupBox->setTitle(QApplication::translate("QgsExpressionBuil derWidgetBase", "Field Values", 0, QApplication::UnicodeUTF8)); | |||
btnLoadAll->setText(QApplication::translate("QgsExpressionBuilderWi | ||||
dgetBase", "Load all unique values", 0, QApplication::UnicodeUTF8)); | ||||
btnLoadSample->setText(QApplication::translate("QgsExpressionBuilde | ||||
rWidgetBase", "Load 10 sample values", 0, QApplication::UnicodeUTF8)); | ||||
mOperatorsGroupBox->setTitle(QApplication::translate("QgsExpression BuilderWidgetBase", "Operators", 0, QApplication::UnicodeUTF8)); | mOperatorsGroupBox->setTitle(QApplication::translate("QgsExpression BuilderWidgetBase", "Operators", 0, QApplication::UnicodeUTF8)); | |||
#ifndef QT_NO_TOOLTIP | ||||
btnEqualPushButton->setToolTip(QApplication::translate("QgsExpressi | ||||
onBuilderWidgetBase", "Equal operator", 0, QApplication::UnicodeUTF8)); | ||||
#endif // QT_NO_TOOLTIP | ||||
btnEqualPushButton->setText(QApplication::translate("QgsExpressionB uilderWidgetBase", "=", 0, QApplication::UnicodeUTF8)); | btnEqualPushButton->setText(QApplication::translate("QgsExpressionB uilderWidgetBase", "=", 0, QApplication::UnicodeUTF8)); | |||
#ifndef QT_NO_TOOLTIP | ||||
btnPlusPushButton->setToolTip(QApplication::translate("QgsExpressio | ||||
nBuilderWidgetBase", "Addition operator", 0, QApplication::UnicodeUTF8)); | ||||
#endif // QT_NO_TOOLTIP | ||||
btnPlusPushButton->setText(QApplication::translate("QgsExpressionBu ilderWidgetBase", "+", 0, QApplication::UnicodeUTF8)); | btnPlusPushButton->setText(QApplication::translate("QgsExpressionBu ilderWidgetBase", "+", 0, QApplication::UnicodeUTF8)); | |||
#ifndef QT_NO_TOOLTIP | ||||
btnMinusPushButton->setToolTip(QApplication::translate("QgsExpressi | ||||
onBuilderWidgetBase", "Subtraction operator", 0, QApplication::UnicodeUTF8) | ||||
); | ||||
#endif // QT_NO_TOOLTIP | ||||
btnMinusPushButton->setText(QApplication::translate("QgsExpressionB uilderWidgetBase", "-", 0, QApplication::UnicodeUTF8)); | btnMinusPushButton->setText(QApplication::translate("QgsExpressionB uilderWidgetBase", "-", 0, QApplication::UnicodeUTF8)); | |||
#ifndef QT_NO_TOOLTIP | ||||
btnDividePushButton->setToolTip(QApplication::translate("QgsExpress | ||||
ionBuilderWidgetBase", "Division operator", 0, QApplication::UnicodeUTF8)); | ||||
#endif // QT_NO_TOOLTIP | ||||
btnDividePushButton->setText(QApplication::translate("QgsExpression BuilderWidgetBase", "/", 0, QApplication::UnicodeUTF8)); | btnDividePushButton->setText(QApplication::translate("QgsExpression BuilderWidgetBase", "/", 0, QApplication::UnicodeUTF8)); | |||
#ifndef QT_NO_TOOLTIP | ||||
btnMultiplyPushButton->setToolTip(QApplication::translate("QgsExpre | ||||
ssionBuilderWidgetBase", "Multiplication operator", 0, QApplication::Unicod | ||||
eUTF8)); | ||||
#endif // QT_NO_TOOLTIP | ||||
btnMultiplyPushButton->setText(QApplication::translate("QgsExpressi onBuilderWidgetBase", "*", 0, QApplication::UnicodeUTF8)); | btnMultiplyPushButton->setText(QApplication::translate("QgsExpressi onBuilderWidgetBase", "*", 0, QApplication::UnicodeUTF8)); | |||
#ifndef QT_NO_TOOLTIP | ||||
btnExpButton->setToolTip(QApplication::translate("QgsExpressionBuil | ||||
derWidgetBase", "Power operator", 0, QApplication::UnicodeUTF8)); | ||||
#endif // QT_NO_TOOLTIP | ||||
btnExpButton->setText(QApplication::translate("QgsExpressionBuilder WidgetBase", "^", 0, QApplication::UnicodeUTF8)); | btnExpButton->setText(QApplication::translate("QgsExpressionBuilder WidgetBase", "^", 0, QApplication::UnicodeUTF8)); | |||
#ifndef QT_NO_TOOLTIP | ||||
btnConcatButton->setToolTip(QApplication::translate("QgsExpressionB | ||||
uilderWidgetBase", "String Concatenation", 0, QApplication::UnicodeUTF8)); | ||||
#endif // QT_NO_TOOLTIP | ||||
btnConcatButton->setText(QApplication::translate("QgsExpressionBuil derWidgetBase", "||", 0, QApplication::UnicodeUTF8)); | btnConcatButton->setText(QApplication::translate("QgsExpressionBuil derWidgetBase", "||", 0, QApplication::UnicodeUTF8)); | |||
#ifndef QT_NO_TOOLTIP | ||||
btnOpenBracketPushButton->setToolTip(QApplication::translate("QgsEx | ||||
pressionBuilderWidgetBase", "Open Bracket ", 0, QApplication::UnicodeUTF8)) | ||||
; | ||||
#endif // QT_NO_TOOLTIP | ||||
btnOpenBracketPushButton->setText(QApplication::translate("QgsExpre ssionBuilderWidgetBase", "(", 0, QApplication::UnicodeUTF8)); | btnOpenBracketPushButton->setText(QApplication::translate("QgsExpre ssionBuilderWidgetBase", "(", 0, QApplication::UnicodeUTF8)); | |||
#ifndef QT_NO_TOOLTIP | ||||
btnCloseBracketPushButton->setToolTip(QApplication::translate("QgsE | ||||
xpressionBuilderWidgetBase", "Close Bracket ", 0, QApplication::UnicodeUTF8 | ||||
)); | ||||
#endif // QT_NO_TOOLTIP | ||||
btnCloseBracketPushButton->setText(QApplication::translate("QgsExpr essionBuilderWidgetBase", ")", 0, QApplication::UnicodeUTF8)); | btnCloseBracketPushButton->setText(QApplication::translate("QgsExpr essionBuilderWidgetBase", ")", 0, QApplication::UnicodeUTF8)); | |||
#ifndef QT_NO_TOOLTIP | #ifndef QT_NO_TOOLTIP | |||
label_2->setToolTip(QApplication::translate("QgsExpressionBuilderWi dgetBase", "Output preview is generated <br> using the first feature from t he layer.", 0, QApplication::UnicodeUTF8)); | label_2->setToolTip(QApplication::translate("QgsExpressionBuilderWi dgetBase", "Output preview is generated <br> using the first feature from t he layer.", 0, QApplication::UnicodeUTF8)); | |||
#endif // QT_NO_TOOLTIP | #endif // QT_NO_TOOLTIP | |||
label_2->setText(QApplication::translate("QgsExpressionBuilderWidge tBase", "Output preview: ", 0, QApplication::UnicodeUTF8)); | label_2->setText(QApplication::translate("QgsExpressionBuilderWidge tBase", "Output preview: ", 0, QApplication::UnicodeUTF8)); | |||
#ifndef QT_NO_TOOLTIP | #ifndef QT_NO_TOOLTIP | |||
lblPreview->setToolTip(QApplication::translate("QgsExpressionBuilde rWidgetBase", "Output preview is generated <br> using the first feature fro m the layer.", 0, QApplication::UnicodeUTF8)); | lblPreview->setToolTip(QApplication::translate("QgsExpressionBuilde rWidgetBase", "Output preview is generated <br> using the first feature fro m the layer.", 0, QApplication::UnicodeUTF8)); | |||
#endif // QT_NO_TOOLTIP | #endif // QT_NO_TOOLTIP | |||
lblPreview->setText(QString()); | lblPreview->setText(QString()); | |||
groupBox->setTitle(QApplication::translate("QgsExpressionBuilderWid getBase", "Expression", 0, QApplication::UnicodeUTF8)); | groupBox->setTitle(QApplication::translate("QgsExpressionBuilderWid getBase", "Expression", 0, QApplication::UnicodeUTF8)); | |||
btnSave->setText(QString()); | ||||
btnOpen->setText(QString()); | ||||
} // retranslateUi | } // retranslateUi | |||
}; | }; | |||
namespace Ui { | namespace Ui { | |||
class QgsExpressionBuilderWidgetBase: public Ui_QgsExpressionBuilderWid getBase {}; | class QgsExpressionBuilderWidgetBase: public Ui_QgsExpressionBuilderWid getBase {}; | |||
} // namespace Ui | } // namespace Ui | |||
QT_END_NAMESPACE | QT_END_NAMESPACE | |||
End of changes. 33 change blocks. | ||||
66 lines changed or deleted | 76 lines changed or added | |||
ui_qgsexpressionbuilderdialogbase.h | ui_qgsexpressionbuilderdialogbase.h | |||
---|---|---|---|---|
/************************************************************************** ****** | /************************************************************************** ****** | |||
** Form generated from reading UI file 'qgsexpressionbuilderdialogbase.ui' | ** Form generated from reading UI file 'qgsexpressionbuilderdialogbase.ui' | |||
** | ** | |||
** Created: Wed Jun 13 12:06:00 2012 | ** Created by: Qt User Interface Compiler version 4.8.5 | |||
** by: Qt User Interface Compiler version 4.7.4 | ||||
** | ** | |||
** WARNING! All changes made in this file will be lost when recompiling UI file! | ** WARNING! All changes made in this file will be lost when recompiling UI file! | |||
*************************************************************************** *****/ | *************************************************************************** *****/ | |||
#ifndef UI_QGSEXPRESSIONBUILDERDIALOGBASE_H | #ifndef UI_QGSEXPRESSIONBUILDERDIALOGBASE_H | |||
#define UI_QGSEXPRESSIONBUILDERDIALOGBASE_H | #define UI_QGSEXPRESSIONBUILDERDIALOGBASE_H | |||
#include <QtCore/QVariant> | #include <QtCore/QVariant> | |||
#include <QtGui/QAction> | #include <QtGui/QAction> | |||
#include <QtGui/QApplication> | #include <QtGui/QApplication> | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added | |||
ui_qgsgenericprojectionselectorbase.h | ui_qgsgenericprojectionselectorbase.h | |||
---|---|---|---|---|
/************************************************************************** ****** | /************************************************************************** ****** | |||
** Form generated from reading UI file 'qgsgenericprojectionselectorbase.ui ' | ** Form generated from reading UI file 'qgsgenericprojectionselectorbase.ui ' | |||
** | ** | |||
** Created: Wed Jun 13 12:06:01 2012 | ** Created by: Qt User Interface Compiler version 4.8.5 | |||
** by: Qt User Interface Compiler version 4.7.4 | ||||
** | ** | |||
** WARNING! All changes made in this file will be lost when recompiling UI file! | ** WARNING! All changes made in this file will be lost when recompiling UI file! | |||
*************************************************************************** *****/ | *************************************************************************** *****/ | |||
#ifndef UI_QGSGENERICPROJECTIONSELECTORBASE_H | #ifndef UI_QGSGENERICPROJECTIONSELECTORBASE_H | |||
#define UI_QGSGENERICPROJECTIONSELECTORBASE_H | #define UI_QGSGENERICPROJECTIONSELECTORBASE_H | |||
#include <QtCore/QVariant> | #include <QtCore/QVariant> | |||
#include <QtGui/QAction> | #include <QtGui/QAction> | |||
#include <QtGui/QApplication> | #include <QtGui/QApplication> | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added | |||
ui_qgsmessagelogviewer.h | ui_qgsmessagelogviewer.h | |||
---|---|---|---|---|
/************************************************************************** ****** | /************************************************************************** ****** | |||
** Form generated from reading UI file 'qgsmessagelogviewer.ui' | ** Form generated from reading UI file 'qgsmessagelogviewer.ui' | |||
** | ** | |||
** Created: Wed Jun 13 12:06:01 2012 | ** Created by: Qt User Interface Compiler version 4.8.5 | |||
** by: Qt User Interface Compiler version 4.7.4 | ||||
** | ** | |||
** WARNING! All changes made in this file will be lost when recompiling UI file! | ** WARNING! All changes made in this file will be lost when recompiling UI file! | |||
*************************************************************************** *****/ | *************************************************************************** *****/ | |||
#ifndef UI_QGSMESSAGELOGVIEWER_H | #ifndef UI_QGSMESSAGELOGVIEWER_H | |||
#define UI_QGSMESSAGELOGVIEWER_H | #define UI_QGSMESSAGELOGVIEWER_H | |||
#include <QtCore/QVariant> | #include <QtCore/QVariant> | |||
#include <QtGui/QAction> | #include <QtGui/QAction> | |||
#include <QtGui/QApplication> | #include <QtGui/QApplication> | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added | |||
ui_qgsmessageviewer.h | ui_qgsmessageviewer.h | |||
---|---|---|---|---|
/************************************************************************** ****** | /************************************************************************** ****** | |||
** Form generated from reading UI file 'qgsmessageviewer.ui' | ** Form generated from reading UI file 'qgsmessageviewer.ui' | |||
** | ** | |||
** Created: Wed Jun 13 12:05:58 2012 | ** Created by: Qt User Interface Compiler version 4.8.5 | |||
** by: Qt User Interface Compiler version 4.7.4 | ||||
** | ** | |||
** WARNING! All changes made in this file will be lost when recompiling UI file! | ** WARNING! All changes made in this file will be lost when recompiling UI file! | |||
*************************************************************************** *****/ | *************************************************************************** *****/ | |||
#ifndef UI_QGSMESSAGEVIEWER_H | #ifndef UI_QGSMESSAGEVIEWER_H | |||
#define UI_QGSMESSAGEVIEWER_H | #define UI_QGSMESSAGEVIEWER_H | |||
#include <QtCore/QVariant> | #include <QtCore/QVariant> | |||
#include <QtGui/QAction> | #include <QtGui/QAction> | |||
#include <QtGui/QApplication> | #include <QtGui/QApplication> | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added | |||
ui_qgsprojectionselectorbase.h | ui_qgsprojectionselectorbase.h | |||
---|---|---|---|---|
/************************************************************************** ****** | /************************************************************************** ****** | |||
** Form generated from reading UI file 'qgsprojectionselectorbase.ui' | ** Form generated from reading UI file 'qgsprojectionselectorbase.ui' | |||
** | ** | |||
** Created: Wed Jun 13 12:06:00 2012 | ** Created by: Qt User Interface Compiler version 4.8.5 | |||
** by: Qt User Interface Compiler version 4.7.4 | ||||
** | ** | |||
** WARNING! All changes made in this file will be lost when recompiling UI file! | ** WARNING! All changes made in this file will be lost when recompiling UI file! | |||
*************************************************************************** *****/ | *************************************************************************** *****/ | |||
#ifndef UI_QGSPROJECTIONSELECTORBASE_H | #ifndef UI_QGSPROJECTIONSELECTORBASE_H | |||
#define UI_QGSPROJECTIONSELECTORBASE_H | #define UI_QGSPROJECTIONSELECTORBASE_H | |||
#include <QtCore/QVariant> | #include <QtCore/QVariant> | |||
#include <QtGui/QAction> | #include <QtGui/QAction> | |||
#include <QtGui/QApplication> | #include <QtGui/QApplication> | |||
skipping to change at line 28 | skipping to change at line 27 | |||
#include <QtGui/QGridLayout> | #include <QtGui/QGridLayout> | |||
#include <QtGui/QHBoxLayout> | #include <QtGui/QHBoxLayout> | |||
#include <QtGui/QHeaderView> | #include <QtGui/QHeaderView> | |||
#include <QtGui/QLabel> | #include <QtGui/QLabel> | |||
#include <QtGui/QLineEdit> | #include <QtGui/QLineEdit> | |||
#include <QtGui/QSpacerItem> | #include <QtGui/QSpacerItem> | |||
#include <QtGui/QSplitter> | #include <QtGui/QSplitter> | |||
#include <QtGui/QTextEdit> | #include <QtGui/QTextEdit> | |||
#include <QtGui/QTreeWidget> | #include <QtGui/QTreeWidget> | |||
#include <QtGui/QWidget> | #include <QtGui/QWidget> | |||
#include "qgsfilterlineedit.h" | ||||
QT_BEGIN_NAMESPACE | QT_BEGIN_NAMESPACE | |||
class Ui_QgsProjectionSelectorBase | class Ui_QgsProjectionSelectorBase | |||
{ | { | |||
public: | public: | |||
QGridLayout *gridLayout_2; | QGridLayout *gridLayout_2; | |||
QHBoxLayout *horizontalLayout; | QHBoxLayout *horizontalLayout_2; | |||
QLabel *label_5; | QLabel *label; | |||
QLineEdit *leSearch; | QLineEdit *teSelected; | |||
QLabel *label_3; | ||||
QSplitter *splitter; | QSplitter *splitter; | |||
QTreeWidget *lstRecent; | QTreeWidget *lstRecent; | |||
QWidget *layoutWidget; | QWidget *layoutWidget; | |||
QGridLayout *gridLayout; | QGridLayout *gridLayout; | |||
QHBoxLayout *horizontalLayout_3; | QHBoxLayout *horizontalLayout_3; | |||
QLabel *label_4; | QLabel *label_4; | |||
QSpacerItem *horizontalSpacer_2; | QSpacerItem *horizontalSpacer_2; | |||
QCheckBox *cbxHideDeprecated; | QCheckBox *cbxHideDeprecated; | |||
QTreeWidget *lstCoordinateSystems; | QTreeWidget *lstCoordinateSystems; | |||
QHBoxLayout *horizontalLayout; | ||||
QLabel *label_5; | ||||
QgsFilterLineEdit *leSearch; | ||||
QLabel *label_3; | ||||
QTextEdit *teProjection; | QTextEdit *teProjection; | |||
void setupUi(QWidget *QgsProjectionSelectorBase) | void setupUi(QWidget *QgsProjectionSelectorBase) | |||
{ | { | |||
if (QgsProjectionSelectorBase->objectName().isEmpty()) | if (QgsProjectionSelectorBase->objectName().isEmpty()) | |||
QgsProjectionSelectorBase->setObjectName(QString::fromUtf8("Qgs ProjectionSelectorBase")); | QgsProjectionSelectorBase->setObjectName(QString::fromUtf8("Qgs ProjectionSelectorBase")); | |||
QgsProjectionSelectorBase->resize(574, 390); | QgsProjectionSelectorBase->resize(820, 591); | |||
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferr ed); | QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferr ed); | |||
sizePolicy.setHorizontalStretch(0); | sizePolicy.setHorizontalStretch(0); | |||
sizePolicy.setVerticalStretch(0); | sizePolicy.setVerticalStretch(0); | |||
sizePolicy.setHeightForWidth(QgsProjectionSelectorBase->sizePolicy( ).hasHeightForWidth()); | sizePolicy.setHeightForWidth(QgsProjectionSelectorBase->sizePolicy( ).hasHeightForWidth()); | |||
QgsProjectionSelectorBase->setSizePolicy(sizePolicy); | QgsProjectionSelectorBase->setSizePolicy(sizePolicy); | |||
QIcon icon; | QIcon icon; | |||
icon.addFile(QString::fromUtf8(""), QSize(), QIcon::Normal, QIcon:: Off); | icon.addFile(QString::fromUtf8(""), QSize(), QIcon::Normal, QIcon:: Off); | |||
QgsProjectionSelectorBase->setWindowIcon(icon); | QgsProjectionSelectorBase->setWindowIcon(icon); | |||
gridLayout_2 = new QGridLayout(QgsProjectionSelectorBase); | gridLayout_2 = new QGridLayout(QgsProjectionSelectorBase); | |||
gridLayout_2->setSpacing(6); | gridLayout_2->setSpacing(6); | |||
gridLayout_2->setContentsMargins(11, 11, 11, 11); | gridLayout_2->setContentsMargins(11, 11, 11, 11); | |||
gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2")); | gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2")); | |||
horizontalLayout = new QHBoxLayout(); | horizontalLayout_2 = new QHBoxLayout(); | |||
horizontalLayout->setSpacing(6); | horizontalLayout_2->setSpacing(6); | |||
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout | horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayo | |||
")); | ut_2")); | |||
label_5 = new QLabel(QgsProjectionSelectorBase); | label = new QLabel(QgsProjectionSelectorBase); | |||
label_5->setObjectName(QString::fromUtf8("label_5")); | label->setObjectName(QString::fromUtf8("label")); | |||
horizontalLayout->addWidget(label_5); | ||||
leSearch = new QLineEdit(QgsProjectionSelectorBase); | ||||
leSearch->setObjectName(QString::fromUtf8("leSearch")); | ||||
horizontalLayout->addWidget(leSearch); | ||||
gridLayout_2->addLayout(horizontalLayout, 0, 0, 1, 1); | ||||
label_3 = new QLabel(QgsProjectionSelectorBase); | ||||
label_3->setObjectName(QString::fromUtf8("label_3")); | ||||
QFont font; | QFont font; | |||
font.setBold(true); | font.setBold(true); | |||
font.setWeight(75); | font.setWeight(75); | |||
label_3->setFont(font); | label->setFont(font); | |||
gridLayout_2->addWidget(label_3, 1, 0, 1, 1); | horizontalLayout_2->addWidget(label); | |||
teSelected = new QLineEdit(QgsProjectionSelectorBase); | ||||
teSelected->setObjectName(QString::fromUtf8("teSelected")); | ||||
teSelected->setReadOnly(true); | ||||
horizontalLayout_2->addWidget(teSelected); | ||||
gridLayout_2->addLayout(horizontalLayout_2, 3, 0, 1, 1); | ||||
splitter = new QSplitter(QgsProjectionSelectorBase); | splitter = new QSplitter(QgsProjectionSelectorBase); | |||
splitter->setObjectName(QString::fromUtf8("splitter")); | splitter->setObjectName(QString::fromUtf8("splitter")); | |||
splitter->setOrientation(Qt::Vertical); | splitter->setOrientation(Qt::Vertical); | |||
splitter->setChildrenCollapsible(true); | splitter->setChildrenCollapsible(true); | |||
lstRecent = new QTreeWidget(splitter); | lstRecent = new QTreeWidget(splitter); | |||
lstRecent->setObjectName(QString::fromUtf8("lstRecent")); | lstRecent->setObjectName(QString::fromUtf8("lstRecent")); | |||
QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Minimu mExpanding); | QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Minimu mExpanding); | |||
sizePolicy1.setHorizontalStretch(0); | sizePolicy1.setHorizontalStretch(0); | |||
sizePolicy1.setVerticalStretch(0); | sizePolicy1.setVerticalStretch(0); | |||
skipping to change at line 153 | skipping to change at line 152 | |||
lstCoordinateSystems->setAlternatingRowColors(true); | lstCoordinateSystems->setAlternatingRowColors(true); | |||
lstCoordinateSystems->setUniformRowHeights(true); | lstCoordinateSystems->setUniformRowHeights(true); | |||
lstCoordinateSystems->setColumnCount(3); | lstCoordinateSystems->setColumnCount(3); | |||
gridLayout->addWidget(lstCoordinateSystems, 1, 0, 1, 1); | gridLayout->addWidget(lstCoordinateSystems, 1, 0, 1, 1); | |||
splitter->addWidget(layoutWidget); | splitter->addWidget(layoutWidget); | |||
gridLayout_2->addWidget(splitter, 2, 0, 1, 1); | gridLayout_2->addWidget(splitter, 2, 0, 1, 1); | |||
horizontalLayout = new QHBoxLayout(); | ||||
horizontalLayout->setSpacing(6); | ||||
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout | ||||
")); | ||||
label_5 = new QLabel(QgsProjectionSelectorBase); | ||||
label_5->setObjectName(QString::fromUtf8("label_5")); | ||||
horizontalLayout->addWidget(label_5); | ||||
leSearch = new QgsFilterLineEdit(QgsProjectionSelectorBase); | ||||
leSearch->setObjectName(QString::fromUtf8("leSearch")); | ||||
horizontalLayout->addWidget(leSearch); | ||||
gridLayout_2->addLayout(horizontalLayout, 0, 0, 1, 1); | ||||
label_3 = new QLabel(QgsProjectionSelectorBase); | ||||
label_3->setObjectName(QString::fromUtf8("label_3")); | ||||
label_3->setFont(font); | ||||
gridLayout_2->addWidget(label_3, 1, 0, 1, 1); | ||||
teProjection = new QTextEdit(QgsProjectionSelectorBase); | teProjection = new QTextEdit(QgsProjectionSelectorBase); | |||
teProjection->setObjectName(QString::fromUtf8("teProjection")); | teProjection->setObjectName(QString::fromUtf8("teProjection")); | |||
teProjection->setMinimumSize(QSize(0, 40)); | teProjection->setMinimumSize(QSize(0, 40)); | |||
teProjection->setMaximumSize(QSize(16777215, 90)); | teProjection->setMaximumSize(QSize(16777215, 90)); | |||
teProjection->setBaseSize(QSize(0, 40)); | teProjection->setBaseSize(QSize(0, 40)); | |||
teProjection->setAutoFormatting(QTextEdit::AutoBulletList); | teProjection->setAutoFormatting(QTextEdit::AutoBulletList); | |||
teProjection->setReadOnly(true); | teProjection->setReadOnly(true); | |||
gridLayout_2->addWidget(teProjection, 3, 0, 1, 1); | gridLayout_2->addWidget(teProjection, 6, 0, 1, 1); | |||
QWidget::setTabOrder(lstCoordinateSystems, teProjection); | QWidget::setTabOrder(lstCoordinateSystems, teProjection); | |||
QWidget::setTabOrder(teProjection, leSearch); | QWidget::setTabOrder(teProjection, leSearch); | |||
retranslateUi(QgsProjectionSelectorBase); | retranslateUi(QgsProjectionSelectorBase); | |||
QMetaObject::connectSlotsByName(QgsProjectionSelectorBase); | QMetaObject::connectSlotsByName(QgsProjectionSelectorBase); | |||
} // setupUi | } // setupUi | |||
void retranslateUi(QWidget *QgsProjectionSelectorBase) | void retranslateUi(QWidget *QgsProjectionSelectorBase) | |||
{ | { | |||
QgsProjectionSelectorBase->setWindowTitle(QApplication::translate(" QgsProjectionSelectorBase", "Coordinate Reference System Selector", 0, QApp lication::UnicodeUTF8)); | QgsProjectionSelectorBase->setWindowTitle(QApplication::translate(" QgsProjectionSelectorBase", "Coordinate Reference System Selector", 0, QApp lication::UnicodeUTF8)); | |||
label_5->setText(QApplication::translate("QgsProjectionSelectorBase | label->setText(QApplication::translate("QgsProjectionSelectorBase", | |||
", "Filter", 0, QApplication::UnicodeUTF8)); | "Selected CRS:", 0, QApplication::UnicodeUTF8)); | |||
label_3->setText(QApplication::translate("QgsProjectionSelectorBase | ||||
", "Recently used coordinate reference systems", 0, QApplication::UnicodeUT | ||||
F8)); | ||||
QTreeWidgetItem *___qtreewidgetitem = lstRecent->headerItem(); | QTreeWidgetItem *___qtreewidgetitem = lstRecent->headerItem(); | |||
___qtreewidgetitem->setText(2, QApplication::translate("QgsProjecti onSelectorBase", "ID", 0, QApplication::UnicodeUTF8)); | ___qtreewidgetitem->setText(2, QApplication::translate("QgsProjecti onSelectorBase", "ID", 0, QApplication::UnicodeUTF8)); | |||
___qtreewidgetitem->setText(1, QApplication::translate("QgsProjecti onSelectorBase", "Authority ID", 0, QApplication::UnicodeUTF8)); | ___qtreewidgetitem->setText(1, QApplication::translate("QgsProjecti onSelectorBase", "Authority ID", 0, QApplication::UnicodeUTF8)); | |||
___qtreewidgetitem->setText(0, QApplication::translate("QgsProjecti onSelectorBase", "Coordinate Reference System", 0, QApplication::UnicodeUTF 8)); | ___qtreewidgetitem->setText(0, QApplication::translate("QgsProjecti onSelectorBase", "Coordinate Reference System", 0, QApplication::UnicodeUTF 8)); | |||
label_4->setText(QApplication::translate("QgsProjectionSelectorBase ", "Coordinate reference systems of the world", 0, QApplication::UnicodeUTF 8)); | label_4->setText(QApplication::translate("QgsProjectionSelectorBase ", "Coordinate reference systems of the world", 0, QApplication::UnicodeUTF 8)); | |||
cbxHideDeprecated->setText(QApplication::translate("QgsProjectionSe lectorBase", "Hide deprecated CRSs", 0, QApplication::UnicodeUTF8)); | cbxHideDeprecated->setText(QApplication::translate("QgsProjectionSe lectorBase", "Hide deprecated CRSs", 0, QApplication::UnicodeUTF8)); | |||
QTreeWidgetItem *___qtreewidgetitem1 = lstCoordinateSystems->header Item(); | QTreeWidgetItem *___qtreewidgetitem1 = lstCoordinateSystems->header Item(); | |||
___qtreewidgetitem1->setText(2, QApplication::translate("QgsProject ionSelectorBase", "ID", 0, QApplication::UnicodeUTF8)); | ___qtreewidgetitem1->setText(2, QApplication::translate("QgsProject ionSelectorBase", "ID", 0, QApplication::UnicodeUTF8)); | |||
___qtreewidgetitem1->setText(1, QApplication::translate("QgsProject ionSelectorBase", "Authority ID", 0, QApplication::UnicodeUTF8)); | ___qtreewidgetitem1->setText(1, QApplication::translate("QgsProject ionSelectorBase", "Authority ID", 0, QApplication::UnicodeUTF8)); | |||
___qtreewidgetitem1->setText(0, QApplication::translate("QgsProject ionSelectorBase", "Coordinate Reference System", 0, QApplication::UnicodeUT F8)); | ___qtreewidgetitem1->setText(0, QApplication::translate("QgsProject ionSelectorBase", "Coordinate Reference System", 0, QApplication::UnicodeUT F8)); | |||
label_5->setText(QApplication::translate("QgsProjectionSelectorBase | ||||
", "Filter", 0, QApplication::UnicodeUTF8)); | ||||
label_3->setText(QApplication::translate("QgsProjectionSelectorBase | ||||
", "Recently used coordinate reference systems", 0, QApplication::UnicodeUT | ||||
F8)); | ||||
} // retranslateUi | } // retranslateUi | |||
}; | }; | |||
namespace Ui { | namespace Ui { | |||
class QgsProjectionSelectorBase: public Ui_QgsProjectionSelectorBase {} ; | class QgsProjectionSelectorBase: public Ui_QgsProjectionSelectorBase {} ; | |||
} // namespace Ui | } // namespace Ui | |||
QT_END_NAMESPACE | QT_END_NAMESPACE | |||
End of changes. 12 change blocks. | ||||
33 lines changed or deleted | 56 lines changed or added | |||
ui_qgsquerybuilderbase.h | ui_qgsquerybuilderbase.h | |||
---|---|---|---|---|
/* | /* | |||
Query builder for vector layers | Query builder for vector layers | |||
*/ | */ | |||
/************************************************************************** ****** | /************************************************************************** ****** | |||
** Form generated from reading UI file 'qgsquerybuilderbase.ui' | ** Form generated from reading UI file 'qgsquerybuilderbase.ui' | |||
** | ** | |||
** Created: Wed Jun 13 12:05:59 2012 | ** Created by: Qt User Interface Compiler version 4.8.5 | |||
** by: Qt User Interface Compiler version 4.7.4 | ||||
** | ** | |||
** WARNING! All changes made in this file will be lost when recompiling UI file! | ** WARNING! All changes made in this file will be lost when recompiling UI file! | |||
*************************************************************************** *****/ | *************************************************************************** *****/ | |||
#ifndef UI_QGSQUERYBUILDERBASE_H | #ifndef UI_QGSQUERYBUILDERBASE_H | |||
#define UI_QGSQUERYBUILDERBASE_H | #define UI_QGSQUERYBUILDERBASE_H | |||
#include <QtCore/QVariant> | #include <QtCore/QVariant> | |||
#include <QtGui/QAction> | #include <QtGui/QAction> | |||
#include <QtGui/QApplication> | #include <QtGui/QApplication> | |||
#include <QtGui/QButtonGroup> | #include <QtGui/QButtonGroup> | |||
#include <QtGui/QCheckBox> | ||||
#include <QtGui/QDialog> | #include <QtGui/QDialog> | |||
#include <QtGui/QDialogButtonBox> | #include <QtGui/QDialogButtonBox> | |||
#include <QtGui/QGridLayout> | #include <QtGui/QGridLayout> | |||
#include <QtGui/QGroupBox> | #include <QtGui/QGroupBox> | |||
#include <QtGui/QHeaderView> | #include <QtGui/QHeaderView> | |||
#include <QtGui/QLabel> | #include <QtGui/QLabel> | |||
#include <QtGui/QListView> | #include <QtGui/QListView> | |||
#include <QtGui/QPushButton> | #include <QtGui/QPushButton> | |||
#include <QtGui/QTextEdit> | #include <QtGui/QTextEdit> | |||
skipping to change at line 46 | skipping to change at line 46 | |||
QGridLayout *gridLayout; | QGridLayout *gridLayout; | |||
QLabel *lblDataUri; | QLabel *lblDataUri; | |||
QGroupBox *groupBox1; | QGroupBox *groupBox1; | |||
QGridLayout *gridLayout1; | QGridLayout *gridLayout1; | |||
QListView *lstFields; | QListView *lstFields; | |||
QGroupBox *groupBox2; | QGroupBox *groupBox2; | |||
QGridLayout *gridLayout2; | QGridLayout *gridLayout2; | |||
QListView *lstValues; | QListView *lstValues; | |||
QPushButton *btnSampleValues; | QPushButton *btnSampleValues; | |||
QPushButton *btnGetAllValues; | QPushButton *btnGetAllValues; | |||
QCheckBox *mUseUnfilteredLayer; | ||||
QGroupBox *groupBox4; | QGroupBox *groupBox4; | |||
QGridLayout *gridLayout3; | QGridLayout *gridLayout3; | |||
QPushButton *btnEqual; | QPushButton *btnEqual; | |||
QPushButton *btnLessThan; | QPushButton *btnLessThan; | |||
QPushButton *btnNot; | QPushButton *btnNot; | |||
QPushButton *btnOr; | QPushButton *btnOr; | |||
QPushButton *btnAnd; | QPushButton *btnAnd; | |||
QPushButton *btnPct; | QPushButton *btnPct; | |||
QPushButton *btnIn; | QPushButton *btnIn; | |||
QPushButton *btnNotIn; | QPushButton *btnNotIn; | |||
skipping to change at line 134 | skipping to change at line 135 | |||
btnSampleValues = new QPushButton(groupBox2); | btnSampleValues = new QPushButton(groupBox2); | |||
btnSampleValues->setObjectName(QString::fromUtf8("btnSampleValues") ); | btnSampleValues->setObjectName(QString::fromUtf8("btnSampleValues") ); | |||
gridLayout2->addWidget(btnSampleValues, 1, 0, 1, 1); | gridLayout2->addWidget(btnSampleValues, 1, 0, 1, 1); | |||
btnGetAllValues = new QPushButton(groupBox2); | btnGetAllValues = new QPushButton(groupBox2); | |||
btnGetAllValues->setObjectName(QString::fromUtf8("btnGetAllValues") ); | btnGetAllValues->setObjectName(QString::fromUtf8("btnGetAllValues") ); | |||
gridLayout2->addWidget(btnGetAllValues, 1, 1, 1, 1); | gridLayout2->addWidget(btnGetAllValues, 1, 1, 1, 1); | |||
mUseUnfilteredLayer = new QCheckBox(groupBox2); | ||||
mUseUnfilteredLayer->setObjectName(QString::fromUtf8("mUseUnfiltere | ||||
dLayer")); | ||||
mUseUnfilteredLayer->setEnabled(false); | ||||
gridLayout2->addWidget(mUseUnfilteredLayer, 2, 0, 1, 2); | ||||
gridLayout->addWidget(groupBox2, 1, 1, 1, 1); | gridLayout->addWidget(groupBox2, 1, 1, 1, 1); | |||
groupBox4 = new QGroupBox(QgsQueryBuilderBase); | groupBox4 = new QGroupBox(QgsQueryBuilderBase); | |||
groupBox4->setObjectName(QString::fromUtf8("groupBox4")); | groupBox4->setObjectName(QString::fromUtf8("groupBox4")); | |||
gridLayout3 = new QGridLayout(groupBox4); | gridLayout3 = new QGridLayout(groupBox4); | |||
gridLayout3->setSpacing(6); | gridLayout3->setSpacing(6); | |||
gridLayout3->setContentsMargins(11, 11, 11, 11); | gridLayout3->setContentsMargins(11, 11, 11, 11); | |||
gridLayout3->setObjectName(QString::fromUtf8("gridLayout3")); | gridLayout3->setObjectName(QString::fromUtf8("gridLayout3")); | |||
btnEqual = new QPushButton(groupBox4); | btnEqual = new QPushButton(groupBox4); | |||
btnEqual->setObjectName(QString::fromUtf8("btnEqual")); | btnEqual->setObjectName(QString::fromUtf8("btnEqual")); | |||
skipping to change at line 293 | skipping to change at line 300 | |||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig ht:0px; -qt-block-indent:0; text-indent:0px;\">Take a <span style=\" font-w eight:600;\">sample</span> of records in the vector file</p></body></html>" , 0, QApplication::UnicodeUTF8)); | "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig ht:0px; -qt-block-indent:0; text-indent:0px;\">Take a <span style=\" font-w eight:600;\">sample</span> of records in the vector file</p></body></html>" , 0, QApplication::UnicodeUTF8)); | |||
#endif // QT_NO_TOOLTIP | #endif // QT_NO_TOOLTIP | |||
btnSampleValues->setText(QApplication::translate("QgsQueryBuilderBa se", "Sample", 0, QApplication::UnicodeUTF8)); | btnSampleValues->setText(QApplication::translate("QgsQueryBuilderBa se", "Sample", 0, QApplication::UnicodeUTF8)); | |||
#ifndef QT_NO_TOOLTIP | #ifndef QT_NO_TOOLTIP | |||
btnGetAllValues->setToolTip(QApplication::translate("QgsQueryBuilde rBase", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\ "text/css\">\n" | btnGetAllValues->setToolTip(QApplication::translate("QgsQueryBuilde rBase", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\ "text/css\">\n" | |||
"p, li { white-space: pre-wrap; }\n" | "p, li { white-space: pre-wrap; }\n" | |||
"</style></head><body style=\" font-family:'Sans Serif'; font-size:9pt; fon t-weight:400; font-style:normal;\">\n" | "</style></head><body style=\" font-family:'Sans Serif'; font-size:9pt; fon t-weight:400; font-style:normal;\">\n" | |||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig ht:0px; -qt-block-indent:0; text-indent:0px;\">Retrieve <span style=\" font -weight:600;\">all</span> the record in the vector file (<span style=\" fon t-style:italic;\">if the table is big, the operation can consume some time< /span>)</p></body></html>", 0, QApplication::UnicodeUTF8)); | "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig ht:0px; -qt-block-indent:0; text-indent:0px;\">Retrieve <span style=\" font -weight:600;\">all</span> the record in the vector file (<span style=\" fon t-style:italic;\">if the table is big, the operation can consume some time< /span>)</p></body></html>", 0, QApplication::UnicodeUTF8)); | |||
#endif // QT_NO_TOOLTIP | #endif // QT_NO_TOOLTIP | |||
btnGetAllValues->setText(QApplication::translate("QgsQueryBuilderBa se", "All", 0, QApplication::UnicodeUTF8)); | btnGetAllValues->setText(QApplication::translate("QgsQueryBuilderBa se", "All", 0, QApplication::UnicodeUTF8)); | |||
mUseUnfilteredLayer->setText(QApplication::translate("QgsQueryBuild erBase", "Use unfiltered layer", 0, QApplication::UnicodeUTF8)); | ||||
groupBox4->setTitle(QApplication::translate("QgsQueryBuilderBase", "Operators", 0, QApplication::UnicodeUTF8)); | groupBox4->setTitle(QApplication::translate("QgsQueryBuilderBase", "Operators", 0, QApplication::UnicodeUTF8)); | |||
btnEqual->setText(QApplication::translate("QgsQueryBuilderBase", "= ", 0, QApplication::UnicodeUTF8)); | btnEqual->setText(QApplication::translate("QgsQueryBuilderBase", "= ", 0, QApplication::UnicodeUTF8)); | |||
btnLessThan->setText(QApplication::translate("QgsQueryBuilderBase", "<", 0, QApplication::UnicodeUTF8)); | btnLessThan->setText(QApplication::translate("QgsQueryBuilderBase", "<", 0, QApplication::UnicodeUTF8)); | |||
btnNot->setText(QApplication::translate("QgsQueryBuilderBase", "NOT ", 0, QApplication::UnicodeUTF8)); | btnNot->setText(QApplication::translate("QgsQueryBuilderBase", "NOT ", 0, QApplication::UnicodeUTF8)); | |||
btnOr->setText(QApplication::translate("QgsQueryBuilderBase", "OR", 0, QApplication::UnicodeUTF8)); | btnOr->setText(QApplication::translate("QgsQueryBuilderBase", "OR", 0, QApplication::UnicodeUTF8)); | |||
btnAnd->setText(QApplication::translate("QgsQueryBuilderBase", "AND ", 0, QApplication::UnicodeUTF8)); | btnAnd->setText(QApplication::translate("QgsQueryBuilderBase", "AND ", 0, QApplication::UnicodeUTF8)); | |||
btnPct->setText(QApplication::translate("QgsQueryBuilderBase", "%", 0, QApplication::UnicodeUTF8)); | btnPct->setText(QApplication::translate("QgsQueryBuilderBase", "%", 0, QApplication::UnicodeUTF8)); | |||
btnIn->setText(QApplication::translate("QgsQueryBuilderBase", "IN", 0, QApplication::UnicodeUTF8)); | btnIn->setText(QApplication::translate("QgsQueryBuilderBase", "IN", 0, QApplication::UnicodeUTF8)); | |||
btnNotIn->setText(QApplication::translate("QgsQueryBuilderBase", "N OT IN", 0, QApplication::UnicodeUTF8)); | btnNotIn->setText(QApplication::translate("QgsQueryBuilderBase", "N OT IN", 0, QApplication::UnicodeUTF8)); | |||
btnNotEqual->setText(QApplication::translate("QgsQueryBuilderBase", "!=", 0, QApplication::UnicodeUTF8)); | btnNotEqual->setText(QApplication::translate("QgsQueryBuilderBase", "!=", 0, QApplication::UnicodeUTF8)); | |||
btnGreaterThan->setText(QApplication::translate("QgsQueryBuilderBas e", ">", 0, QApplication::UnicodeUTF8)); | btnGreaterThan->setText(QApplication::translate("QgsQueryBuilderBas e", ">", 0, QApplication::UnicodeUTF8)); | |||
btnLike->setText(QApplication::translate("QgsQueryBuilderBase", "LI KE", 0, QApplication::UnicodeUTF8)); | btnLike->setText(QApplication::translate("QgsQueryBuilderBase", "LI KE", 0, QApplication::UnicodeUTF8)); | |||
btnILike->setText(QApplication::translate("QgsQueryBuilderBase", "I LIKE", 0, QApplication::UnicodeUTF8)); | btnILike->setText(QApplication::translate("QgsQueryBuilderBase", "I LIKE", 0, QApplication::UnicodeUTF8)); | |||
btnGreaterEqual->setText(QApplication::translate("QgsQueryBuilderBa se", ">=", 0, QApplication::UnicodeUTF8)); | btnGreaterEqual->setText(QApplication::translate("QgsQueryBuilderBa se", ">=", 0, QApplication::UnicodeUTF8)); | |||
btnLessEqual->setText(QApplication::translate("QgsQueryBuilderBase" , "<=", 0, QApplication::UnicodeUTF8)); | btnLessEqual->setText(QApplication::translate("QgsQueryBuilderBase" , "<=", 0, QApplication::UnicodeUTF8)); | |||
groupBox3->setTitle(QApplication::translate("QgsQueryBuilderBase", "SQL where clause", 0, QApplication::UnicodeUTF8)); | groupBox3->setTitle(QApplication::translate("QgsQueryBuilderBase", "Provider specific filter expression", 0, QApplication::UnicodeUTF8)); | |||
} // retranslateUi | } // retranslateUi | |||
}; | }; | |||
namespace Ui { | namespace Ui { | |||
class QgsQueryBuilderBase: public Ui_QgsQueryBuilderBase {}; | class QgsQueryBuilderBase: public Ui_QgsQueryBuilderBase {}; | |||
} // namespace Ui | } // namespace Ui | |||
QT_END_NAMESPACE | QT_END_NAMESPACE | |||
End of changes. 6 change blocks. | ||||
3 lines changed or deleted | 12 lines changed or added | |||