Skip to content
Permalink
Browse files
Fix for ticket #264 (polygon outlines obscure continuous colours for
small or zoomed out polygons).


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5815 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Sep 12, 2006
1 parent 5de35f3 commit c6c958533f1b27ce6820c88e15c1ee902f18b76e
@@ -87,6 +87,8 @@ QgsContinuousColorDialog::QgsContinuousColorDialog(QgsVectorLayer * layer)
outlinewidthspinbox->setValue(minsymbol->pen().width());
outlinewidthspinbox->setMinValue(1);
}

outlinewidthspinbox->setEnabled(true);
}

QgsContinuousColorDialog::QgsContinuousColorDialog()
@@ -138,7 +140,7 @@ void QgsContinuousColorDialog::apply()
else
{
minsymbol->setBrush(QBrush(lblMinValue->paletteBackgroundColor()));
minsymbol->setPen(QPen(QColor(0, 0, 0), outlinewidthspinbox->value()));
minsymbol->setPen(QPen(QColor(0, 0, 0), outlinewidthspinbox->value()));
}

QgsSymbol* maxsymbol = new QgsSymbol(mVectorLayer->vectorType(), QString::number(maximum, 'f'), "", "");
@@ -158,6 +160,8 @@ void QgsContinuousColorDialog::apply()
renderer->setMinimumSymbol(minsymbol);
renderer->setMaximumSymbol(maxsymbol);
renderer->setClassificationField(classfield);
bool drawOutline = (cb_polygonOutline->checkState() == Qt::Checked) ? true:false;
renderer->setDrawPolygonOutline(drawOutline);

mVectorLayer->refreshLegend();
}
@@ -181,3 +185,11 @@ void QgsContinuousColorDialog::selectMaximumColor()
}
setActiveWindow();
}

void QgsContinuousColorDialog::on_cb_polygonOutline_clicked()
{
if (cb_polygonOutline->checkState() == Qt::Checked)
outlinewidthspinbox->setEnabled(true);
else
outlinewidthspinbox->setEnabled(false);
}
@@ -37,6 +37,7 @@ class QgsContinuousColorDialog: public QDialog, private Ui::QgsContinuousColorDi
protected slots:
void selectMinimumColor();
void selectMaximumColor();
void on_cb_polygonOutline_clicked();
protected:
QgsVectorLayer* mVectorLayer;
/**Stores the names and numbers of the fields with numeric values*/
@@ -151,6 +151,10 @@ void QgsContinuousColorRenderer::renderFeature(QPainter * p, QgsFeature * f, QPi
else
{
p->setBrush(QColor(red, green, blue));
if (mDrawPolygonOutline)
p->setPen(QColor(0, 0, 0));
else
p->setPen(Qt::NoPen);
}
if(selected)
{
@@ -45,10 +45,14 @@ class QgsContinuousColorRenderer: public QgsRenderer
void setMinimumSymbol(QgsSymbol* sy);
/**Sets the symbol for the maximum value. The symbol has to be created using the new operator and is automatically deleted when inserting a new symbol or when the instance is destroyed*/
void setMaximumSymbol(QgsSymbol* sy);
/** Sets whether to draw the polygon outline*/
void setDrawPolygonOutline(bool draw) { mDrawPolygonOutline = draw;}
/**Returns the symbol for the minimum value*/
const QgsSymbol* minimumSymbol() const;
/**Returns the symbol for the maximum value*/
const QgsSymbol* maximumSymbol() const;
/** whether to draw a polygon outline*/
bool drawPolygonOutline() { return mDrawPolygonOutline; }
/**Reads the renderer configuration from an XML file
@param rnode the DOM node to read
@param vl the vector layer which will be associated with the renderer*/
@@ -72,6 +76,8 @@ class QgsContinuousColorRenderer: public QgsRenderer
QgsSymbol* mMinimumSymbol;
/**Item for the maximum value*/
QgsSymbol* mMaximumSymbol;
/** Whether to draw the polygon outline or not */
bool mDrawPolygonOutline;
};

inline int QgsContinuousColorRenderer::classificationField() const
@@ -9,7 +9,7 @@
<x>0</x>
<y>0</y>
<width>408</width>
<height>143</height>
<height>155</height>
</rect>
</property>
<property name="windowTitle" >
@@ -22,7 +22,30 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="3" >
<item row="3" column="3" >
<widget class="QCheckBox" name="cb_polygonOutline" >
<property name="text" >
<string>Draw polygon outline</string>
</property>
</widget>
</item>
<item row="3" column="4" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>21</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3" colspan="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
@@ -174,22 +197,6 @@
</property>
</widget>
</item>
<item row="3" column="2" colspan="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>111</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1" >
<widget class="QSpinBox" name="outlinewidthspinbox" />
</item>
@@ -241,6 +248,19 @@
</property>
</widget>
</item>
<item row="4" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />

0 comments on commit c6c9585

Please sign in to comment.