[QGIS Commit] r8976 - in trunk/qgis: python/core src/app src/core
src/core/raster src/core/symbology
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sat Aug 2 03:54:32 EDT 2008
Author: timlinux
Date: 2008-08-02 03:54:31 -0400 (Sat, 02 Aug 2008)
New Revision: 8976
Modified:
trunk/qgis/python/core/qgis.sip
trunk/qgis/python/core/qgssymbol.sip
trunk/qgis/src/app/qgssinglesymboldialog.cpp
trunk/qgis/src/core/qgis.h
trunk/qgis/src/core/raster/qgsrasterlayer.cpp
trunk/qgis/src/core/symbology/qgssymbol.cpp
trunk/qgis/src/core/symbology/qgssymbol.h
Log:
Allow point symbol sizes to be specifed in double format and allow symbols smaller than 3. Added some constants in qgis.h to default and minimum allowable point sizes.
Modified: trunk/qgis/python/core/qgis.sip
===================================================================
--- trunk/qgis/python/core/qgis.sip 2008-08-02 05:47:37 UTC (rev 8975)
+++ trunk/qgis/python/core/qgis.sip 2008-08-02 07:54:31 UTC (rev 8976)
@@ -108,3 +108,11 @@
* or user (~/.qgis.qgis.db) defined projection. */
const int USER_PROJECTION_START_ID;
+ //
+ // Constants for point symbols
+ //
+
+ /** Magic number that determines the minimum allowable point size for point symbols */
+ const float MINIMUM_POINT_SIZE;
+ /** Magic number that determines the minimum allowable point size for point symbols */
+ const float DEFAULT_POINT_SIZE;
Modified: trunk/qgis/python/core/qgssymbol.sip
===================================================================
--- trunk/qgis/python/core/qgssymbol.sip 2008-08-02 05:47:37 UTC (rev 8975)
+++ trunk/qgis/python/core/qgssymbol.sip 2008-08-02 07:54:31 UTC (rev 8976)
@@ -51,9 +51,9 @@
/**Get point symbol*/
virtual QString pointSymbolName() const;
/**Set size*/
- virtual void setPointSize(int s);
+ virtual void setPointSize(double s);
/**Get size*/
- virtual int pointSize() const;
+ virtual double pointSize() const;
//! Destructor
virtual ~QgsSymbol();
Modified: trunk/qgis/src/app/qgssinglesymboldialog.cpp
===================================================================
--- trunk/qgis/src/app/qgssinglesymboldialog.cpp 2008-08-02 05:47:37 UTC (rev 8975)
+++ trunk/qgis/src/app/qgssinglesymboldialog.cpp 2008-08-02 07:54:31 UTC (rev 8976)
@@ -184,7 +184,7 @@
connect(mLabelEdit, SIGNAL(textChanged(const QString&)), this, SLOT(resendSettingsChanged()));
connect (lstSymbols,SIGNAL(currentItemChanged ( QListWidgetItem * , QListWidgetItem * )),
this, SLOT (symbolChanged (QListWidgetItem * , QListWidgetItem * )));
- connect(mPointSizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(resendSettingsChanged()));
+ connect(mPointSizeSpinBox, SIGNAL(valueChanged(double)), this, SLOT(resendSettingsChanged()));
connect(mRotationClassificationComboBox, SIGNAL(currentIndexChanged(const QString &)),
this, SLOT(resendSettingsChanged()));
connect(mScaleClassificationComboBox, SIGNAL(currentIndexChanged(const QString &)),
Modified: trunk/qgis/src/core/qgis.h
===================================================================
--- trunk/qgis/src/core/qgis.h 2008-08-02 05:47:37 UTC (rev 8975)
+++ trunk/qgis/src/core/qgis.h 2008-08-02 07:54:31 UTC (rev 8976)
@@ -133,6 +133,15 @@
* or user (~/.qgis.qgis.db) defined projection. */
const int USER_PROJECTION_START_ID=100000;
+//
+// Constants for point symbols
+//
+
+ /** Magic number that determines the minimum allowable point size for point symbols */
+ const float MINIMUM_POINT_SIZE=0.1;
+ /** Magic number that determines the minimum allowable point size for point symbols */
+ const float DEFAULT_POINT_SIZE=2.0;
+
// FIXME: also in qgisinterface.h
#ifndef QGISEXTERN
#ifdef WIN32
Modified: trunk/qgis/src/core/raster/qgsrasterlayer.cpp
===================================================================
--- trunk/qgis/src/core/raster/qgsrasterlayer.cpp 2008-08-02 05:47:37 UTC (rev 8975)
+++ trunk/qgis/src/core/raster/qgsrasterlayer.cpp 2008-08-02 07:54:31 UTC (rev 8976)
@@ -3658,6 +3658,8 @@
//
// Note: Make sure the raster is not opened in write mode
// in order to force overviews to be written to a separate file.
+ // Otherwise reoopen it in read/write mode to stick overviews
+ // into the same file (if supported)
//
Modified: trunk/qgis/src/core/symbology/qgssymbol.cpp
===================================================================
--- trunk/qgis/src/core/symbology/qgssymbol.cpp 2008-08-02 05:47:37 UTC (rev 8975)
+++ trunk/qgis/src/core/symbology/qgssymbol.cpp 2008-08-02 07:54:31 UTC (rev 8976)
@@ -40,7 +40,7 @@
mLabel(label),
mType(t),
mPointSymbolName( "hard:circle" ),
- mPointSize( 3 ),
+ mPointSize( DEFAULT_POINT_SIZE ),
mPointSymbolImage(1,1, QImage::Format_ARGB32_Premultiplied),
mWidthScale(1.0),
mCacheUpToDate( false ),
@@ -58,7 +58,7 @@
mPen( c ),
mBrush( c ),
mPointSymbolName( "hard:circle" ),
- mPointSize( 3 ),
+ mPointSize( DEFAULT_POINT_SIZE ),
mPointSymbolImage(1,1, QImage::Format_ARGB32_Premultiplied),
mWidthScale(1.0),
mCacheUpToDate( false ),
@@ -69,7 +69,7 @@
QgsSymbol::QgsSymbol()
: mPointSymbolName( "hard:circle" ),
- mPointSize( 3 ),
+ mPointSize( DEFAULT_POINT_SIZE ),
mPointSymbolImage(1,1, QImage::Format_ARGB32_Premultiplied),
mWidthScale(1.0),
mCacheUpToDate( false ),
@@ -83,7 +83,7 @@
: mPen( c ),
mBrush( c ),
mPointSymbolName( "hard:circle" ),
- mPointSize( 3 ),
+ mPointSize( DEFAULT_POINT_SIZE ),
mPointSymbolImage(1,1, QImage::Format_ARGB32_Premultiplied),
mWidthScale(1.0),
mCacheUpToDate( false ),
@@ -227,17 +227,17 @@
return mPointSymbolName;
}
-void QgsSymbol::setPointSize(int s)
+void QgsSymbol::setPointSize(double s)
{
- if ( s < 3 )
- mPointSize = 3;
- else
- mPointSize = s;
+ if ( s < MINIMUM_POINT_SIZE )
+ mPointSize = MINIMUM_POINT_SIZE;
+ else
+ mPointSize = s;
- mCacheUpToDate = mCacheUpToDate2 = false;
+ mCacheUpToDate = mCacheUpToDate2 = false;
}
-int QgsSymbol::pointSize() const
+double QgsSymbol::pointSize() const
{
return mPointSize;
}
@@ -343,12 +343,12 @@
{
pen.setColor ( selectionColor );
QBrush brush = mBrush;
- preRotateImage = QgsMarkerCatalogue::instance()->imageMarker ( mPointSymbolName, (int)(mPointSize * scale * widthScale * rasterScaleFactor),
+ preRotateImage = QgsMarkerCatalogue::instance()->imageMarker ( mPointSymbolName, (float)(mPointSize * scale * widthScale * rasterScaleFactor),
pen, mBrush );
}
else
{
- preRotateImage = QgsMarkerCatalogue::instance()->imageMarker ( mPointSymbolName, (int)(mPointSize * scale * widthScale * rasterScaleFactor),
+ preRotateImage = QgsMarkerCatalogue::instance()->imageMarker ( mPointSymbolName, (float)(mPointSize * scale * widthScale * rasterScaleFactor),
pen, mBrush );
}
@@ -517,7 +517,7 @@
if ( ! psizenode.isNull() )
{
QDomElement psizeelement = psizenode.toElement();
- setPointSize( psizeelement.text().toInt() );
+ setPointSize( psizeelement.text().toFloat() );
}
mRotationClassificationField = -1;
Modified: trunk/qgis/src/core/symbology/qgssymbol.h
===================================================================
--- trunk/qgis/src/core/symbology/qgssymbol.h 2008-08-02 05:47:37 UTC (rev 8975)
+++ trunk/qgis/src/core/symbology/qgssymbol.h 2008-08-02 07:54:31 UTC (rev 8976)
@@ -83,9 +83,9 @@
/**Get point symbol*/
virtual QString pointSymbolName() const;
/**Set size*/
- virtual void setPointSize(int s);
+ virtual void setPointSize(double s);
/**Get size*/
- virtual int pointSize() const;
+ virtual double pointSize() const;
//! Destructor
virtual ~QgsSymbol();
@@ -145,7 +145,7 @@
/* Point symbol name */
QString mPointSymbolName;
/* Point size */
- int mPointSize;
+ double mPointSize;
/* TODO Because for printing we always need a symbol without oversampling but with line width scale,
* we keep also separate picture with line width scale */
More information about the QGIS-commit
mailing list