added option to change the outline width in continuous color renderer

git-svn-id: http://svn.osgeo.org/qgis/trunk@993 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
mhugent 2004-03-08 06:44:45 +00:00
parent c7dc6118f2
commit c7efec252e
3 changed files with 80 additions and 36 deletions

View File

@ -31,6 +31,7 @@
#include "qgsdlgvectorlayerproperties.h"
#include "qgsdataprovider.h"
#include "qgsfield.h"
#include <qspinbox.h>
QgsContColDialog::QgsContColDialog(QgsVectorLayer * layer):QgsContColDialogBase(), m_vectorlayer(layer)
{
@ -92,6 +93,8 @@ QgsContColDialog::QgsContColDialog(QgsVectorLayer * layer):QgsContColDialogBase(
mincolorbutton->setPaletteBackgroundColor(minitem->getSymbol()->brush().color());
maxcolorbutton->setPaletteBackgroundColor(maxitem->getSymbol()->brush().color());
}
outlinewidthspinbox->setValue(minitem->getSymbol()->pen().width());
outlinewidthspinbox->setMinValue(1);
}
}
@ -137,22 +140,25 @@ void QgsContColDialog::apply()
QgsSymbol minsymbol;
if (m_vectorlayer->vectorType() == QGis::Line)
{
minsymbol.setPen(QPen(mincolorbutton->paletteBackgroundColor()));
} else
minsymbol.setPen(QPen(mincolorbutton->paletteBackgroundColor(),outlinewidthspinbox->value()));
}
else
{
minsymbol.setBrush(QBrush(mincolorbutton->paletteBackgroundColor()));
minsymbol.setPen(QPen(QColor(0, 0, 0), 1));
minsymbol.setPen(QPen(QColor(0, 0, 0), outlinewidthspinbox->value()));
}
QgsRenderItem *minimumitem = new QgsRenderItem(minsymbol, QString::number(minimum, 'f'), " ");
QgsSymbol maxsymbol;
if (m_vectorlayer->vectorType() == QGis::Line)
{
maxsymbol.setPen(QPen(maxcolorbutton->paletteBackgroundColor()));
} else
maxsymbol.setPen(QPen(maxcolorbutton->paletteBackgroundColor(),outlinewidthspinbox->value()));
}
else
{
maxsymbol.setBrush(QBrush(maxcolorbutton->paletteBackgroundColor()));
maxsymbol.setPen(QPen(QColor(0, 0, 0), 1));
maxsymbol.setPen(QPen(QColor(0, 0, 0), outlinewidthspinbox->value()));
}
QgsRenderItem *maximumitem = new QgsRenderItem(maxsymbol, QString::number(maximum, 'f'), " ");

View File

@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>442</width>
<height>96</height>
<width>408</width>
<height>143</height>
</rect>
</property>
<property name="caption">
@ -19,7 +19,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QComboBox" row="0" column="1">
<widget class="QComboBox" row="0" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>classificationComboBox</cstring>
</property>
@ -44,6 +44,48 @@
<string>Classification Field:</string>
</property>
</widget>
<widget class="QPushButton" row="1" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>mincolorbutton</cstring>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="paletteBackgroundColor">
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</property>
<property name="text">
<string></string>
</property>
</widget>
<widget class="QPushButton" row="2" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>maxcolorbutton</cstring>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="paletteBackgroundColor">
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</property>
<property name="text">
<string></string>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>mincolorlabel</cstring>
@ -72,9 +114,9 @@
<string>Maximum Value:</string>
</property>
</widget>
<widget class="QPushButton" row="1" column="1">
<widget class="QLabel" row="3" column="0">
<property name="name">
<cstring>mincolorbutton</cstring>
<cstring>outlinewidthlabel</cstring>
</property>
<property name="minimumSize">
<size>
@ -82,38 +124,32 @@
<height>20</height>
</size>
</property>
<property name="paletteBackgroundColor">
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</property>
<property name="text">
<string></string>
<string>Outline Width:</string>
</property>
</widget>
<widget class="QPushButton" row="2" column="1">
<widget class="QSpinBox" row="3" column="1">
<property name="name">
<cstring>maxcolorbutton</cstring>
<cstring>outlinewidthspinbox</cstring>
</property>
<property name="minimumSize">
</widget>
<spacer row="3" column="2">
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>0</width>
<width>111</width>
<height>20</height>
</size>
</property>
<property name="paletteBackgroundColor">
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</property>
<property name="text">
<string></string>
</property>
</widget>
</spacer>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>

View File

@ -67,6 +67,7 @@ void QgsContinuousColRenderer::initializeSymbology(QgsVectorLayer * layer, QgsDl
QgsSymbol sy;
sy.brush().setStyle(Qt::SolidPattern);
sy.pen().setStyle(Qt::SolidLine);
sy.pen().setWidth(1);
//random fill colors for points and polygons and pen colors for lines
int red = 1 + (int) (255.0 * rand() / (RAND_MAX + 1.0));
@ -190,8 +191,9 @@ void QgsContinuousColRenderer::renderFeature(QPainter * p, QgsFeature * f, QgsCo
if (wkbType == QGis::WKBLineString || wkbType == QGis::WKBMultiLineString)
{
p->setPen(QColor(red, green, blue));
} else
p->setPen(QPen(QColor(red, green, blue),m_minimumItem->getSymbol()->pen().width()));//make sure the correct line width is used
}
else
{
p->setBrush(QColor(red, green, blue));
}