patch_for_bug__3430.diff
src/gui/symbology-ng/qgssymbollayerv2widget.h (working copy) | ||
---|---|---|
4 | 4 | |
5 | 5 |
#include <QWidget> |
6 | 6 | |
7 |
#define DEFAULT_SIMPLEFILL_STYLE Qt::SolidPattern |
|
7 | 8 |
class QgsSymbolLayerV2; |
8 | 9 | |
9 | 10 | |
... | ... | |
80 | 81 |
void setName(); |
81 | 82 |
void setColorBorder(); |
82 | 83 |
void setColorFill(); |
84 |
void setBrushStyle(); |
|
83 | 85 |
void setSize(); |
84 | 86 |
void setAngle(); |
85 | 87 |
void setOffset(); |
src/gui/symbology-ng/qgssymbollayerv2widget.cpp (working copy) | ||
---|---|---|
168 | 168 |
names << "circle" << "rectangle" << "diamond" << "pentagon" << "cross" << "cross2" << "triangle" |
169 | 169 |
<< "equilateral_triangle" << "star" << "regular_star" << "arrow" << "line" << "arrowhead" << "filled_arrowhead"; |
170 | 170 |
double markerSize = DEFAULT_POINT_SIZE * 2; |
171 |
Qt::BrushStyle brushStyle = DEFAULT_SIMPLEFILL_STYLE ; |
|
171 | 172 |
for ( int i = 0; i < names.count(); ++i ) |
172 | 173 |
{ |
173 |
QgsSimpleMarkerSymbolLayerV2* lyr = new QgsSimpleMarkerSymbolLayerV2( names[i], QColor( 200, 200, 200 ), QColor( 0, 0, 0 ), markerSize ); |
|
174 |
QgsSimpleMarkerSymbolLayerV2* lyr = new QgsSimpleMarkerSymbolLayerV2( names[i], QColor( 200, 200, 200 ),brushStyle, QColor( 0, 0, 0 ), markerSize );
|
|
174 | 175 |
QIcon icon = QgsSymbolLayerV2Utils::symbolLayerPreviewIcon( lyr, QgsSymbolV2::MM, size ); |
175 | 176 |
QListWidgetItem* item = new QListWidgetItem( icon, QString(), lstNames ); |
176 | 177 |
item->setData( Qt::UserRole, names[i] ); |
... | ... | |
181 | 182 |
connect( btnChangeColorBorder, SIGNAL( clicked() ), this, SLOT( setColorBorder() ) ); |
182 | 183 |
connect( btnChangeColorFill, SIGNAL( clicked() ), this, SLOT( setColorFill() ) ); |
183 | 184 |
connect( spinSize, SIGNAL( valueChanged( double ) ), this, SLOT( setSize() ) ); |
184 |
connect( spinAngle, SIGNAL( valueChanged( double ) ), this, SLOT( setAngle() ) ); |
|
185 |
connect( spinSize, SIGNAL( valueChanged( double ) ), this, SLOT( setSize() ) ); |
|
186 |
connect( cboFillStyleMarker,SIGNAL( currentIndexChanged( int ) ), this, SLOT( setBrushStyle() )) ; |
|
185 | 187 |
connect( spinOffsetX, SIGNAL( valueChanged( double ) ), this, SLOT( setOffset() ) ); |
186 | 188 |
connect( spinOffsetY, SIGNAL( valueChanged( double ) ), this, SLOT( setOffset() ) ); |
187 | 189 |
} |
... | ... | |
208 | 210 |
btnChangeColorFill->setColor( mLayer->color() ); |
209 | 211 |
spinSize->setValue( mLayer->size() ); |
210 | 212 |
spinAngle->setValue( mLayer->angle() ); |
213 |
cboFillStyleMarker->setBrushStyle( mLayer->brushStyle() ); |
|
211 | 214 | |
212 | 215 |
// without blocking signals the value gets changed because of slot setOffset() |
213 | 216 |
spinOffsetX->blockSignals( true ); |
... | ... | |
259 | 262 |
emit changed(); |
260 | 263 |
} |
261 | 264 | |
265 |
void QgsSimpleMarkerSymbolLayerV2Widget::setBrushStyle() |
|
266 |
{ |
|
267 |
mLayer->setBrushStyle( cboFillStyleMarker->brushStyle() ); |
|
268 |
emit changed(); |
|
269 |
} |
|
270 | ||
262 | 271 |
void QgsSimpleMarkerSymbolLayerV2Widget::setSize() |
263 | 272 |
{ |
264 | 273 |
mLayer->setSize( spinSize->value() ); |
src/core/symbology-ng/qgssymbologyv2conversion.cpp (working copy) | ||
---|---|---|
32 | 32 |
QColor color = s->fillColor(); |
33 | 33 |
QColor borderColor = s->color(); |
34 | 34 |
QString name = symbolName.mid( 5 ); |
35 |
sl = new QgsSimpleMarkerSymbolLayerV2( name, color, borderColor, size, angle ); |
|
35 |
Qt::BrushStyle brushStyle = s->brush().style(); |
|
36 |
sl = new QgsSimpleMarkerSymbolLayerV2( name, color, brushStyle, borderColor, size, angle ); |
|
36 | 37 |
} |
37 | 38 |
else |
38 | 39 |
{ |
src/core/symbology-ng/qgsmarkersymbollayerv2.h (working copy) | ||
---|---|---|
6 | 6 | |
7 | 7 |
#define DEFAULT_SIMPLEMARKER_NAME "circle" |
8 | 8 |
#define DEFAULT_SIMPLEMARKER_COLOR QColor(255,0,0) |
9 |
#define DEFAULT_SIMPLEMARKER_STYLE Qt::SolidPattern |
|
9 | 10 |
#define DEFAULT_SIMPLEMARKER_BORDERCOLOR QColor(0,0,0) |
10 | 11 |
#define DEFAULT_SIMPLEMARKER_SIZE DEFAULT_POINT_SIZE |
11 | 12 |
#define DEFAULT_SIMPLEMARKER_ANGLE 0 |
... | ... | |
21 | 22 |
public: |
22 | 23 |
QgsSimpleMarkerSymbolLayerV2( QString name = DEFAULT_SIMPLEMARKER_NAME, |
23 | 24 |
QColor color = DEFAULT_SIMPLEMARKER_COLOR, |
25 |
Qt::BrushStyle style = DEFAULT_SIMPLEMARKER_STYLE, |
|
24 | 26 |
QColor borderColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR, |
25 | 27 |
double size = DEFAULT_SIMPLEMARKER_SIZE, |
26 | 28 |
double angle = DEFAULT_SIMPLEMARKER_ANGLE ); |
... | ... | |
42 | 44 |
QgsStringMap properties() const; |
43 | 45 | |
44 | 46 |
QgsSymbolLayerV2* clone() const; |
47 |
|
|
48 |
Qt::BrushStyle brushStyle() const { return mBrushStyle; } |
|
49 |
void setBrushStyle( Qt::BrushStyle style ) { mBrushStyle = style; } |
|
45 | 50 | |
46 | 51 |
QString name() const { return mName; } |
47 | 52 |
void setName( QString name ) { mName = name; } |
... | ... | |
64 | 69 |
QPolygonF mPolygon; |
65 | 70 |
QPainterPath mPath; |
66 | 71 |
QString mName; |
72 |
Qt::BrushStyle mBrushStyle; |
|
67 | 73 |
QImage mCache; |
68 | 74 |
QPen mSelPen; |
69 | 75 |
QBrush mSelBrush; |
src/core/symbology-ng/qgsmarkersymbollayerv2.cpp (working copy) | ||
---|---|---|
31 | 31 | |
32 | 32 |
////// |
33 | 33 | |
34 |
QgsSimpleMarkerSymbolLayerV2::QgsSimpleMarkerSymbolLayerV2( QString name, QColor color, QColor borderColor, double size, double angle ) |
|
34 |
QgsSimpleMarkerSymbolLayerV2::QgsSimpleMarkerSymbolLayerV2( QString name, QColor color, Qt::BrushStyle style, QColor borderColor, double size, double angle )
|
|
35 | 35 |
{ |
36 | 36 |
mName = name; |
37 | 37 |
mColor = color; |
38 | 38 |
mBorderColor = borderColor; |
39 | 39 |
mSize = size; |
40 | 40 |
mAngle = angle; |
41 |
mBrushStyle = style; |
|
41 | 42 |
mOffset = QPointF( 0, 0 ); |
42 | 43 |
} |
43 | 44 | |
... | ... | |
45 | 46 |
{ |
46 | 47 |
QString name = DEFAULT_SIMPLEMARKER_NAME; |
47 | 48 |
QColor color = DEFAULT_SIMPLEMARKER_COLOR; |
49 |
Qt::BrushStyle style = DEFAULT_SIMPLEMARKER_STYLE; |
|
48 | 50 |
QColor borderColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR; |
49 | 51 |
double size = DEFAULT_SIMPLEMARKER_SIZE; |
50 | 52 |
double angle = DEFAULT_SIMPLEMARKER_ANGLE; |
... | ... | |
53 | 55 |
name = props["name"]; |
54 | 56 |
if ( props.contains( "color" ) ) |
55 | 57 |
color = QgsSymbolLayerV2Utils::decodeColor( props["color"] ); |
58 |
if ( props.contains( "style" ) ) |
|
59 |
style = QgsSymbolLayerV2Utils::decodeBrushStyle( props["style"] ); |
|
56 | 60 |
if ( props.contains( "color_border" ) ) |
57 | 61 |
borderColor = QgsSymbolLayerV2Utils::decodeColor( props["color_border"] ); |
58 | 62 |
if ( props.contains( "size" ) ) |
... | ... | |
60 | 64 |
if ( props.contains( "angle" ) ) |
61 | 65 |
angle = props["angle"].toDouble(); |
62 | 66 | |
63 |
QgsSimpleMarkerSymbolLayerV2* m = new QgsSimpleMarkerSymbolLayerV2( name, color, borderColor, size, angle ); |
|
67 |
QgsSimpleMarkerSymbolLayerV2* m = new QgsSimpleMarkerSymbolLayerV2( name, color, style, borderColor, size, angle );
|
|
64 | 68 |
if ( props.contains( "offset" ) ) |
65 | 69 |
m->setOffset( QgsSymbolLayerV2Utils::decodePoint( props["offset"] ) ); |
66 | 70 |
return m; |
... | ... | |
75 | 79 |
void QgsSimpleMarkerSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context ) |
76 | 80 |
{ |
77 | 81 |
QColor brushColor = mColor; |
82 |
mBrush = QBrush( mColor, mBrushStyle ); |
|
78 | 83 |
QColor penColor = mBorderColor; |
79 | 84 |
if ( context.alpha() < 1 ) |
80 | 85 |
{ |
81 | 86 |
penColor.setAlphaF( context.alpha() ); |
82 | 87 |
brushColor.setAlphaF( context.alpha() ); |
83 | 88 |
} |
84 |
mBrush = QBrush( brushColor ); |
|
89 |
//mBrush = QBrush( brushColor );
|
|
85 | 90 |
mPen = QPen( penColor ); |
86 | 91 |
mPen.setWidthF( context.outputLineWidth( mPen.widthF() ) ); |
87 | 92 | |
93 |
QColor selColor = context.selectionColor(); |
|
94 |
// selColor.setAlphaF( context.alpha() ); |
|
95 |
mSelBrush = QBrush( selColor ); |
|
96 |
if ( selectFillStyle ) mSelBrush.setStyle( mBrushStyle ); |
|
97 |
|
|
88 | 98 |
QColor selBrushColor = context.selectionColor(); |
89 | 99 |
QColor selPenColor = selBrushColor == mColor ? selBrushColor : mBorderColor; |
90 | 100 |
if ( context.alpha() < 1 ) |
... | ... | |
410 | 420 |
QgsStringMap map; |
411 | 421 |
map["name"] = mName; |
412 | 422 |
map["color"] = QgsSymbolLayerV2Utils::encodeColor( mColor ); |
423 |
map["style"] = QgsSymbolLayerV2Utils::encodeBrushStyle( mBrushStyle ); |
|
413 | 424 |
map["color_border"] = QgsSymbolLayerV2Utils::encodeColor( mBorderColor ); |
414 | 425 |
map["size"] = QString::number( mSize ); |
415 | 426 |
map["angle"] = QString::number( mAngle ); |
... | ... | |
419 | 430 | |
420 | 431 |
QgsSymbolLayerV2* QgsSimpleMarkerSymbolLayerV2::clone() const |
421 | 432 |
{ |
422 |
QgsSimpleMarkerSymbolLayerV2* m = new QgsSimpleMarkerSymbolLayerV2( mName, mColor, mBorderColor, mSize, mAngle ); |
|
433 |
QgsSimpleMarkerSymbolLayerV2* m = new QgsSimpleMarkerSymbolLayerV2( mName, mColor, mBrushStyle, mBorderColor, mSize, mAngle );
|
|
423 | 434 |
m->setOffset( mOffset ); |
424 | 435 |
return m; |
425 | 436 |
} |
src/ui/symbollayer/widget_simplemarker.ui (working copy) | ||
---|---|---|
7 | 7 |
<x>0</x> |
8 | 8 |
<y>0</y> |
9 | 9 |
<width>394</width> |
10 |
<height>275</height>
|
|
10 |
<height>305</height>
|
|
11 | 11 |
</rect> |
12 | 12 |
</property> |
13 | 13 |
<property name="windowTitle"> |
... | ... | |
60 | 60 |
</property> |
61 | 61 |
</widget> |
62 | 62 |
</item> |
63 |
<item row="2" column="0">
|
|
63 |
<item row="3" column="0">
|
|
64 | 64 |
<widget class="QLabel" name="label_3"> |
65 | 65 |
<property name="text"> |
66 | 66 |
<string>Size</string> |
67 | 67 |
</property> |
68 | 68 |
</widget> |
69 | 69 |
</item> |
70 |
<item row="3" column="0">
|
|
70 |
<item row="5" column="0">
|
|
71 | 71 |
<widget class="QLabel" name="label_4"> |
72 | 72 |
<property name="text"> |
73 | 73 |
<string>Angle</string> |
74 | 74 |
</property> |
75 | 75 |
</widget> |
76 | 76 |
</item> |
77 |
<item row="3" column="1">
|
|
77 |
<item row="5" column="1">
|
|
78 | 78 |
<widget class="QDoubleSpinBox" name="spinAngle"> |
79 | 79 |
<property name="decimals"> |
80 | 80 |
<number>1</number> |
... | ... | |
87 | 87 |
</property> |
88 | 88 |
</widget> |
89 | 89 |
</item> |
90 |
<item row="4" column="0">
|
|
90 |
<item row="6" column="0">
|
|
91 | 91 |
<widget class="QLabel" name="label_5"> |
92 | 92 |
<property name="text"> |
93 | 93 |
<string>Offset X,Y</string> |
94 | 94 |
</property> |
95 | 95 |
</widget> |
96 | 96 |
</item> |
97 |
<item row="4" column="1">
|
|
97 |
<item row="6" column="1">
|
|
98 | 98 |
<layout class="QHBoxLayout" name="horizontalLayout"> |
99 | 99 |
<item> |
100 | 100 |
<widget class="QDoubleSpinBox" name="spinOffsetX"> |
... | ... | |
118 | 118 |
</item> |
119 | 119 |
</layout> |
120 | 120 |
</item> |
121 |
<item row="2" column="1">
|
|
121 |
<item row="3" column="1">
|
|
122 | 122 |
<widget class="QDoubleSpinBox" name="spinSize"> |
123 | 123 |
<property name="decimals"> |
124 | 124 |
<number>2</number> |
... | ... | |
131 | 131 |
</property> |
132 | 132 |
</widget> |
133 | 133 |
</item> |
134 |
<item row="2" column="0"> |
|
135 |
<widget class="QLabel" name="label_6"> |
|
136 |
<property name="text"> |
|
137 |
<string>Fill Style</string> |
|
138 |
</property> |
|
139 |
</widget> |
|
140 |
</item> |
|
141 |
<item row="2" column="1"> |
|
142 |
<widget class="QgsBrushStyleComboBox" name="cboFillStyleMarker"/> |
|
143 |
</item> |
|
134 | 144 |
</layout> |
135 | 145 |
</item> |
136 | 146 |
<item> |
... | ... | |
156 | 166 |
<property name="flow"> |
157 | 167 |
<enum>QListView::LeftToRight</enum> |
158 | 168 |
</property> |
159 |
<property name="resizeMode"> |
|
160 |
<enum>QListView::Adjust</enum> |
|
161 |
</property> |
|
162 | 169 |
<property name="spacing"> |
163 | 170 |
<number>4</number> |
164 | 171 |
</property> |
... | ... | |
196 | 203 |
</widget> |
197 | 204 |
<customwidgets> |
198 | 205 |
<customwidget> |
206 |
<class>Q3ComboBox</class> |
|
207 |
<extends>QWidget</extends> |
|
208 |
<header>Qt3Support/Q3ComboBox</header> |
|
209 |
</customwidget> |
|
210 |
<customwidget> |
|
199 | 211 |
<class>QgsColorButtonV2</class> |
200 | 212 |
<extends>QPushButton</extends> |
201 | 213 |
<header>qgscolorbutton.h</header> |