Skip to content
Permalink
Browse files
Allow point symbol sizes to be specifed in double format and allow sy…
…mbols smaller than 3. Added some constants in qgis.h to default and minimum allowable point sizes.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8976 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Aug 2, 2008
1 parent ee34205 commit e0692efe4b976b9bd16dfbc95bb9497a91e2a017
@@ -108,3 +108,11 @@ public:
* 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;
@@ -51,9 +51,9 @@ class QgsSymbol
/**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();

@@ -184,7 +184,7 @@ QgsSingleSymbolDialog::QgsSingleSymbolDialog(QgsVectorLayer * layer, bool disabl
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 &)),
@@ -133,6 +133,15 @@ class CORE_EXPORT QGis
* 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
@@ -3658,6 +3658,8 @@ QString QgsRasterLayer::buildPyramids(RasterPyramidList const & theRasterPyramid
//
// 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)
//


@@ -40,7 +40,7 @@ QgsSymbol::QgsSymbol(QGis::VectorType t, QString lvalue, QString uvalue, QString
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 @@ QgsSymbol::QgsSymbol(QGis::VectorType t, QString lvalue, QString uvalue, QString
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(QGis::VectorType t, QString lvalue, QString uvalue, QString

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 @@ QgsSymbol::QgsSymbol(QColor c)
: 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 @@ QString QgsSymbol::pointSymbolName() const
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 @@ QImage QgsSymbol::getPointSymbolAsImage( double widthScale, bool selected, QCol
{
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 @@ bool QgsSymbol::readXML( QDomNode & synode )
if ( ! psizenode.isNull() )
{
QDomElement psizeelement = psizenode.toElement();
setPointSize( psizeelement.text().toInt() );
setPointSize( psizeelement.text().toFloat() );
}

mRotationClassificationField = -1;
@@ -83,9 +83,9 @@ class CORE_EXPORT QgsSymbol{
/**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 @@ class CORE_EXPORT QgsSymbol{
/* 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 */

0 comments on commit e0692ef

Please sign in to comment.