Skip to content
Permalink
Browse files

Merge branch 'master' of github.com:qgis/Quantum-GIS

  • Loading branch information
timlinux committed Sep 22, 2012
2 parents 2b1443f + 1b95cdc commit f7af2defa93b72d9e557e5aa7dac15796b67df5f
Showing with 751 additions and 386 deletions.
  1. +12 −18 python/console_sci.py
  2. +132 −58 python/core/qgsdiagramrendererv2.sip
  3. +22 −0 python/gui/qgsscalecombobox.sip
  4. +38 −37 src/app/legend/qgsapplegendinterface.cpp
  5. +1 −1 src/app/legend/qgsapplegendinterface.h
  6. +6 −39 src/app/qgisapp.cpp
  7. +0 −2 src/app/qgisapp.h
  8. +3 −3 src/app/qgsdiagramproperties.cpp
  9. +13 −6 src/app/qgsrasterlayerproperties.cpp
  10. +11 −6 src/app/qgsvectorlayerproperties.cpp
  11. +7 −2 src/core/qgscoordinatereferencesystem.h
  12. +110 −110 src/core/qgsdiagramrendererv2.h
  13. +1 −1 src/core/qgsmaprenderer.cpp
  14. +14 −14 src/core/qgsmaprenderer.h
  15. +2 −2 src/core/raster/qgsmultibandcolorrenderer.cpp
  16. +1 −1 src/core/raster/qgspalettedrasterrenderer.cpp
  17. +1 −1 src/core/raster/qgssinglebandcolordatarenderer.cpp
  18. +126 −1 src/gui/qgsscalecombobox.cpp
  19. +33 −0 src/gui/qgsscalecombobox.h
  20. +1 −1 src/mapserver/qgsprojectparser.cpp
  21. +1 −1 src/mapserver/qgssldparser.h
  22. +5 −5 src/mapserver/qgswfsserver.cpp
  23. +1 −1 src/plugins/georeferencer/qgsgcplistmodel.cpp
  24. +11 −11 src/plugins/georeferencer/qgsgeorefplugingui.cpp
  25. +5 −5 src/plugins/georeferencer/qgsgeoreftransform.cpp
  26. +2 −2 src/plugins/georeferencer/qgsgeoreftransform.h
  27. +34 −34 src/plugins/georeferencer/qgsrasterchangecoords.cpp
  28. +4 −4 src/plugins/georeferencer/qgsrasterchangecoords.h
  29. +1 −1 src/providers/postgres/qgspostgresprovider.cpp
  30. +6 −6 src/ui/qgsrasterlayerpropertiesbase.ui
  31. +6 −6 src/ui/qgsvectorlayerpropertiesbase.ui
  32. +4 −4 tests/src/core/testqgsdiagram.cpp
  33. +1 −0 tests/src/gui/CMakeLists.txt
  34. +3 −3 tests/src/gui/testprojectionissues.cpp
  35. +133 −0 tests/src/gui/testqgsscalecombobox.cpp
@@ -124,6 +124,8 @@ def clearConsole(self):
self.setFocus()

def commandConsole(self, command):
if not self.is_cursor_on_last_line():
self.move_cursor_to_end()
line, pos = self.getCurLine()
selCmd= self.text(line).length()
self.setSelection(line, 4, line, selCmd)
@@ -324,7 +326,6 @@ def showPrevious(self):
self.move_cursor_to_end()
#self.SendScintilla(QsciScintilla.SCI_DELETEBACK)


def showNext(self):
if self.historyIndex > 0 and not self.history.isEmpty():
line, pos = self.getCurLine()
@@ -365,7 +366,6 @@ def keyPressEvent(self, e):
QsciScintilla.keyPressEvent(self, e)
elif e.key() == Qt.Key_Delete:
if self.hasSelectedText():
self.check_selection()
self.removeSelectedText()
elif self.is_cursor_on_last_line():
self.SendScintilla(QsciScintilla.SCI_CLEAR)
@@ -405,13 +405,6 @@ def keyPressEvent(self, e):
self.SendScintilla(QsciScintilla.SCI_WORDRIGHT)
else:
self.SendScintilla(QsciScintilla.SCI_CHARRIGHT)
elif e.key() == Qt.Key_Delete:
if self.hasSelectedText():
self.check_selection()
self.removeSelectedText()
elif self.is_cursor_on_last_line():
self.SendScintilla(QsciScintilla.SCI_CLEAR)
event.accept()
## TODO: press event for auto-completion file directory
#elif e.key() == Qt.Key_Tab:
#self.show_file_completion()
@@ -423,28 +416,29 @@ def keyPressEvent(self, e):
def paste(self):
"""Reimplement QScintilla method"""
stringPaste = unicode(QApplication.clipboard().text())
if self.hasSelectedText():
self.removeSelectedText()
self.insertFromDropPaste(stringPaste)

## Drag and drop
def dragEnterEvent(self, e):
if e.mimeData().hasFormat('text/plain'):
def dropEvent(self, e):
if e.mimeData().hasText():
stringDrag = e.mimeData().text()
self.insertFromDropPaste(stringDrag)
e.setDropAction(Qt.MoveAction)
e.accept()
else:
e.ignore()
QsciScintillaCompat.dropEvent(self, e)

def dropEvent(self, e):
stringDrag = e.mimeData().text()
self.insertFromDropPaste(stringDrag)

def insertFromDropPaste(self, textDP):
pasteList = QStringList()
pasteList = textDP.split("\n")
for line in pasteList[:-1]:
self.append(line)
self.insert(line)
self.move_cursor_to_end()
#self.SendScintilla(QsciScintilla.SCI_DELETEBACK)
self.runCommand(unicode(self.currentCommand()))
self.append(unicode(pasteList[-1]))
self.insert(unicode(pasteList[-1]))
self.move_cursor_to_end()

def getTextFromEditor(self):
@@ -3,70 +3,108 @@ struct QgsDiagramLayerSettings
%TypeHeaderCode
#include <qgsdiagramrendererv2.h>
%End
//avoid inclusion of QgsPalLabeling
enum Placement
{
AroundPoint, // Point / Polygon
OverPoint, // Point / Polygon
Line, // Line / Polygon
Curved, // Line
Horizontal, // Polygon
Free // Polygon
};

enum LinePlacementFlags
{
OnLine = 1,
AboveLine = 2,
BelowLine = 4,
MapOrientation = 8
};

QgsDiagramLayerSettings();

//pal placement properties
Placement placement;
LinePlacementFlags placementFlags;
int priority; // 0 = low, 10 = high
bool obstacle; // whether it's an obstacle
double dist; // distance from the feature (in mm)
QgsDiagramRendererV2* renderer;
int xPosColumn; //attribute index for x coordinate (or -1 if position not data defined)
int yPosColumn;//attribute index for y coordinate (or -1 if position not data defined)

//avoid inclusion of QgsPalLabeling
enum Placement
{
AroundPoint, // Point / Polygon
OverPoint, // Point / Polygon
Line, // Line / Polygon
Curved, // Line
Horizontal, // Polygon
Free // Polygon
};

enum LinePlacementFlags
{
OnLine = 1,
AboveLine = 2,
BelowLine = 4,
MapOrientation = 8
};

QgsDiagramLayerSettings();

//pal placement properties
Placement placement;
LinePlacementFlags placementFlags;
int priority; // 0 = low, 10 = high
bool obstacle; // whether it's an obstacle
double dist; // distance from the feature (in mm)
QgsDiagramRendererV2* renderer;
int xPosColumn; //attribute index for x coordinate (or -1 if position not data defined)
int yPosColumn;//attribute index for y coordinate (or -1 if position not data defined)

void readXML( const QDomElement& elem );
void writeXML( QDomElement& layerElem, QDomDocument& doc ) const;
void readXML( const QDomElement& elem );
void writeXML( QDomElement& layerElem, QDomDocument& doc ) const;
};

//diagram settings for rendering
struct QgsDiagramSettings
class QgsDiagramSettings
{
%TypeHeaderCode
#include <qgsdiagramrendererv2.h>
%End
public:
enum SizeType
{
MM,
MapUnits
};

enum LabelPlacementMethod
{
Height,
XHeight
};

//! Orientation of histogram
enum DiagramOrientation
{
Up,
Down,
Left,
Right
};

QgsDiagramSettings();
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;

//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 writeXML( QDomElement& rendererElem, QDomDocument& doc ) const;
};

//additional diagram settings for interpolated size rendering
class QgsDiagramInterpolationSettings
{
%TypeHeaderCode
#include <qgsdiagramrendererv2.h>
%End
enum SizeType
{
MM,
MapUnits
};

QgsDiagramSettings();
QFont font;
QList< QColor > categoryColors;
QList< int > categoryIndices;
QSizeF size; //size
SizeType sizeType; //mm or map units
QColor backgroundColor;
QColor penColor;
double penWidth;

//scale range (-1 if no lower / upper bound )
double minScaleDenominator;
double maxScaleDenominator;

void readXML( const QDomElement& elem );
void writeXML( QDomElement& rendererElem, QDomDocument& doc ) const;
public:
QSizeF lowerSize;
QSizeF upperSize;
double lowerValue;
double upperValue;
/**Index of the classification attribute*/
int classificationAttribute;
};

/**Returns diagram settings for a feature*/
@@ -98,10 +136,36 @@ class QgsDiagramRendererV2

virtual void readXML( const QDomElement& elem ) = 0;
virtual void writeXML( QDomElement& layerElem, QDomDocument& doc ) const = 0;


protected:

/**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 c render context
* @param s out: diagram settings for the feature
*/
virtual bool diagramSettings( const QgsAttributeMap& att, const QgsRenderContext& c, QgsDiagramSettings& s ) = 0;

/**Returns size of the diagram (in painter units) or an invalid size in case of error*/
virtual QSizeF diagramSize( const QgsAttributeMap& attributes, const QgsRenderContext& c ) = 0;

/**Converts size from mm to map units*/
void convertSizeToMapUnits( QSizeF& size, const QgsRenderContext& context ) const;

/**Returns the paint device dpi (or -1 in case of error*/
static int dpiPaintDevice( const QPainter* );

//read / write diagram
void _readXML( const QDomElement& elem );
void _writeXML( QDomElement& rendererElem, QDomDocument& doc ) const;

/**Reference to the object that does the real diagram rendering*/
QgsDiagram* mDiagram;
};

/**Renders the diagrams for all features with the same settings*/
class QgsSingleCategoryDiagramRenderer: QgsDiagramRendererV2
class QgsSingleCategoryDiagramRenderer : QgsDiagramRendererV2
{
%TypeHeaderCode
#include <qgsdiagramrendererv2.h>
@@ -120,9 +184,14 @@ class QgsSingleCategoryDiagramRenderer: QgsDiagramRendererV2

void readXML( const QDomElement& elem );
void writeXML( QDomElement& layerElem, QDomDocument& doc ) const;

protected:
bool diagramSettings( const QgsAttributeMap&, const QgsRenderContext& c, QgsDiagramSettings& s );

QSizeF diagramSize( const QgsAttributeMap& attributes, const QgsRenderContext& c );
};

class QgsLinearlyInterpolatedDiagramRenderer: QgsDiagramRendererV2
class QgsLinearlyInterpolatedDiagramRenderer : QgsDiagramRendererV2
{
%TypeHeaderCode
#include <qgsdiagramrendererv2.h>
@@ -157,4 +226,9 @@ class QgsLinearlyInterpolatedDiagramRenderer: QgsDiagramRendererV2

void readXML( const QDomElement& elem );
void writeXML( QDomElement& layerElem, QDomDocument& doc ) const;

protected:
bool diagramSettings( const QgsAttributeMap&, const QgsRenderContext& c, QgsDiagramSettings& s );

QSizeF diagramSize( const QgsAttributeMap& attributes, const QgsRenderContext& c );
};
@@ -12,6 +12,28 @@ class QgsScaleComboBox : QComboBox
QgsScaleComboBox(QWidget * parent = 0);
~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 );

public slots:
void updateScales( const QStringList &scales = QStringList() );
};

0 comments on commit f7af2de

Please sign in to comment.
You can’t perform that action at this time.