patch_for_bug__3430_alister_21-8-12.diff
src/app/qgsdecorationgrid.cpp | ||
---|---|---|
158 | 158 |
// set default symbol : cross with width=20 |
159 | 159 |
QgsSymbolLayerV2List symbolList; |
160 | 160 |
symbolList << new QgsSimpleMarkerSymbolLayerV2( "cross", DEFAULT_SIMPLEMARKER_COLOR, |
161 |
DEFAULT_SIMPLEMARKER_BORDERCOLOR, 20, 0 ); |
|
161 |
DEFAULT_SIMPLEMARKER_STYLE , DEFAULT_SIMPLEMARKER_BORDERCOLOR, 20, 0 );
|
|
162 | 162 |
mMarkerSymbol = new QgsMarkerSymbolV2( symbolList ); |
163 | 163 |
// mMarkerSymbol = new QgsMarkerSymbolV2(); |
164 | 164 |
} |
src/core/symbology-ng/qgsfillsymbollayerv2.cpp | ||
---|---|---|
80 | 80 |
} |
81 | 81 |
|
82 | 82 |
QColor selColor = context.selectionColor(); |
83 |
// selColor.setAlphaF( context.alpha() ); |
|
83 |
QColor selPenColor = selColor == mColor ? selColor : mBorderColor; |
|
84 |
if ( ! selectionIsOpaque ) selColor.setAlphaF( context.alpha() ); |
|
84 | 85 |
mSelBrush = QBrush( selColor ); |
86 |
// N.B. unless a "selection line colour" is implemented in addition to the "selection colour" option |
|
87 |
// this would mean symbols with "no fill" look the same whether or not they are selected |
|
85 | 88 |
if ( selectFillStyle ) |
86 | 89 |
mSelBrush.setStyle( mBrushStyle ); |
87 | 90 |
mBorderColor.setAlphaF( context.alpha() ); |
88 | 91 |
mPen = QPen( mBorderColor ); |
92 |
mSelPen = QPen( selPenColor ); |
|
89 | 93 |
mPen.setStyle( mBorderStyle ); |
90 | 94 |
mPen.setWidthF( context.outputLineWidth( mBorderWidth ) ); |
91 | 95 |
} |
... | ... | |
105 | 109 |
|
106 | 110 |
p->setBrush( context.selected() ? mSelBrush : mBrush ); |
107 | 111 |
p->setPen( mPen ); |
112 |
p->setPen( context.selected() ? mSelPen : mPen ); |
|
108 | 113 |
|
109 | 114 |
if ( !mOffset.isNull() ) |
110 | 115 |
p->translate( mOffset ); |
... | ... | |
213 | 218 |
if ( context.selected() ) |
214 | 219 |
{ |
215 | 220 |
QColor selColor = context.selectionColor(); |
216 |
if ( ! selectionIsOpaque ) |
|
217 |
selColor.setAlphaF( context.alpha() ); |
|
221 |
// Alister - this doesn't seem to work here |
|
222 |
//if ( ! selectionIsOpaque ) |
|
223 |
// selColor.setAlphaF( context.alpha() ); |
|
218 | 224 |
p->setBrush( QBrush( selColor ) ); |
219 | 225 |
_renderPolygon( p, points, rings ); |
220 | 226 |
} |
src/core/symbology-ng/qgsfillsymbollayerv2.h | ||
---|---|---|
80 | 80 |
Qt::PenStyle mBorderStyle; |
81 | 81 |
double mBorderWidth; |
82 | 82 |
QPen mPen; |
83 |
QPen mSelPen; |
|
83 | 84 |
|
84 | 85 |
QPointF mOffset; |
85 | 86 |
}; |
src/core/symbology-ng/qgsmarkersymbollayerv2.cpp | ||
---|---|---|
48 | 48 |
|
49 | 49 |
////// |
50 | 50 |
|
51 |
QgsSimpleMarkerSymbolLayerV2::QgsSimpleMarkerSymbolLayerV2( QString name, QColor color, QColor borderColor, double size, double angle ) |
|
51 |
QgsSimpleMarkerSymbolLayerV2::QgsSimpleMarkerSymbolLayerV2( QString name, QColor color, Qt::BrushStyle style, QColor borderColor, double size, double angle )
|
|
52 | 52 |
{ |
53 | 53 |
mName = name; |
54 | 54 |
mColor = color; |
55 | 55 |
mBorderColor = borderColor; |
56 | 56 |
mSize = size; |
57 |
mBrushStyle = style; |
|
57 | 58 |
mAngle = angle; |
58 | 59 |
mOffset = QPointF( 0, 0 ); |
59 | 60 |
} |
... | ... | |
62 | 63 |
{ |
63 | 64 |
QString name = DEFAULT_SIMPLEMARKER_NAME; |
64 | 65 |
QColor color = DEFAULT_SIMPLEMARKER_COLOR; |
66 |
Qt::BrushStyle style = DEFAULT_SIMPLEMARKER_STYLE; |
|
65 | 67 |
QColor borderColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR; |
66 | 68 |
double size = DEFAULT_SIMPLEMARKER_SIZE; |
67 | 69 |
double angle = DEFAULT_SIMPLEMARKER_ANGLE; |
... | ... | |
70 | 72 |
name = props["name"]; |
71 | 73 |
if ( props.contains( "color" ) ) |
72 | 74 |
color = QgsSymbolLayerV2Utils::decodeColor( props["color"] ); |
75 |
if ( props.contains( "style" ) ) |
|
76 |
style = QgsSymbolLayerV2Utils::decodeBrushStyle( props["style"] ); |
|
73 | 77 |
if ( props.contains( "color_border" ) ) |
74 | 78 |
borderColor = QgsSymbolLayerV2Utils::decodeColor( props["color_border"] ); |
75 | 79 |
if ( props.contains( "size" ) ) |
... | ... | |
77 | 81 |
if ( props.contains( "angle" ) ) |
78 | 82 |
angle = props["angle"].toDouble(); |
79 | 83 |
|
80 |
QgsSimpleMarkerSymbolLayerV2* m = new QgsSimpleMarkerSymbolLayerV2( name, color, borderColor, size, angle ); |
|
84 |
QgsSimpleMarkerSymbolLayerV2* m = new QgsSimpleMarkerSymbolLayerV2( name, color, style, borderColor, size, angle );
|
|
81 | 85 |
if ( props.contains( "offset" ) ) |
82 | 86 |
m->setOffset( QgsSymbolLayerV2Utils::decodePoint( props["offset"] ) ); |
83 | 87 |
return m; |
... | ... | |
93 | 97 |
{ |
94 | 98 |
QColor brushColor = mColor; |
95 | 99 |
QColor penColor = mBorderColor; |
100 |
QColor selColor = context.selectionColor(); |
|
101 |
QColor selPenColor = selColor == mColor ? selColor : mBorderColor; |
|
96 | 102 |
if ( context.alpha() < 1 ) |
97 | 103 |
{ |
98 |
penColor.setAlphaF( context.alpha() ); |
|
99 | 104 |
brushColor.setAlphaF( context.alpha() ); |
105 |
penColor.setAlphaF( context.alpha() ); |
|
106 |
if ( ! selectionIsOpaque ) |
|
107 |
{ |
|
108 |
selColor.setAlphaF( context.alpha() ); |
|
109 |
// N.B. this doesn't work right if transparency is set to 100%. But then why would you use 100% transparency? |
|
110 |
selPenColor.setAlphaF( context.alpha() ); |
|
111 |
} |
|
100 | 112 |
} |
101 |
mBrush = QBrush( brushColor ); |
|
113 |
// Alister - Sunil used `QBrush ( mColor, mBrushStyle )` whereas previously it was `QBrush( brushColor)` |
|
114 |
// What are the implications of using brushColor vs using mColor? |
|
115 |
mBrush = QBrush( brushColor, mBrushStyle ); |
|
102 | 116 |
mPen = QPen( penColor ); |
117 |
mSelBrush = QBrush( selColor ); |
|
118 |
mSelPen = QPen( selPenColor ); |
|
103 | 119 |
mPen.setWidthF( context.outputLineWidth( mPen.widthF() ) ); |
104 | 120 |
|
105 |
QColor selBrushColor = context.selectionColor(); |
|
106 |
QColor selPenColor = selBrushColor == mColor ? selBrushColor : mBorderColor; |
|
107 |
if ( context.alpha() < 1 ) |
|
108 |
{ |
|
109 |
selBrushColor.setAlphaF( context.alpha() ); |
|
110 |
selPenColor.setAlphaF( context.alpha() ); |
|
111 |
} |
|
112 |
mSelBrush = QBrush( selBrushColor ); |
|
113 |
mSelPen = QPen( selPenColor ); |
|
114 | 121 |
mSelPen.setWidthF( context.outputLineWidth( mPen.widthF() ) ); |
115 | 122 |
|
123 |
// N.B. unless a "selection line colour" is implemented in addition to the "selection colour" option |
|
124 |
// this would mean symbols with "no fill" look the same whether or not they are selected... |
|
125 |
// except, at the moment it doesn't work right if fill style is set to "no fill" :) |
|
126 |
// e.g. if the symbol is a circle, it and the square area it fits in are filled with the selection colour |
|
127 |
if ( selectFillStyle ) mSelBrush.setStyle( mBrushStyle ); |
|
128 |
|
|
116 | 129 |
bool hasDataDefinedRotation = context.renderHints() & QgsSymbolV2::DataDefinedRotation; |
117 | 130 |
bool hasDataDefinedSize = context.renderHints() & QgsSymbolV2::DataDefinedSizeScale; |
118 | 131 |
|
... | ... | |
131 | 144 |
// For these set the selected border color to the selected color |
132 | 145 |
|
133 | 146 |
if ( mName != "circle" ) |
134 |
mSelPen.setColor( selBrushColor );
|
|
147 |
mSelPen.setColor( selColor ); |
|
135 | 148 |
} |
136 | 149 |
else |
137 | 150 |
{ |
... | ... | |
428 | 441 |
QgsStringMap map; |
429 | 442 |
map["name"] = mName; |
430 | 443 |
map["color"] = QgsSymbolLayerV2Utils::encodeColor( mColor ); |
444 |
map["style"] = QgsSymbolLayerV2Utils::encodeBrushStyle( mBrushStyle ); |
|
431 | 445 |
map["color_border"] = QgsSymbolLayerV2Utils::encodeColor( mBorderColor ); |
432 | 446 |
map["size"] = QString::number( mSize ); |
433 | 447 |
map["angle"] = QString::number( mAngle ); |
... | ... | |
437 | 451 |
|
438 | 452 |
QgsSymbolLayerV2* QgsSimpleMarkerSymbolLayerV2::clone() const |
439 | 453 |
{ |
440 |
QgsSimpleMarkerSymbolLayerV2* m = new QgsSimpleMarkerSymbolLayerV2( mName, mColor, mBorderColor, mSize, mAngle ); |
|
454 |
QgsSimpleMarkerSymbolLayerV2* m = new QgsSimpleMarkerSymbolLayerV2( mName, mColor, mBrushStyle,mBorderColor, mSize, mAngle );
|
|
441 | 455 |
m->setOffset( mOffset ); |
442 | 456 |
return m; |
443 | 457 |
} |
... | ... | |
496 | 510 |
QPointF offset; |
497 | 511 |
QgsSymbolLayerV2Utils::displacementFromSldElement( graphicElem, offset ); |
498 | 512 |
|
499 |
QgsMarkerSymbolLayerV2 *m = new QgsSimpleMarkerSymbolLayerV2( name, color, borderColor, size ); |
|
500 |
m->setAngle( angle ); |
|
513 |
QgsMarkerSymbolLayerV2 *m = new QgsSimpleMarkerSymbolLayerV2( name, color, DEFAULT_SIMPLEMARKER_STYLE, borderColor, size); |
|
501 | 514 |
m->setOffset( offset ); |
502 | 515 |
return m; |
503 | 516 |
} |
src/core/symbology-ng/qgsmarkersymbollayerv2.h | ||
---|---|---|
20 | 20 |
|
21 | 21 |
#define DEFAULT_SIMPLEMARKER_NAME "circle" |
22 | 22 |
#define DEFAULT_SIMPLEMARKER_COLOR QColor(255,0,0) |
23 |
#define DEFAULT_SIMPLEMARKER_STYLE Qt::SolidPattern |
|
23 | 24 |
#define DEFAULT_SIMPLEMARKER_BORDERCOLOR QColor(0,0,0) |
24 | 25 |
#define DEFAULT_SIMPLEMARKER_SIZE DEFAULT_POINT_SIZE |
25 | 26 |
#define DEFAULT_SIMPLEMARKER_ANGLE 0 |
... | ... | |
35 | 36 |
public: |
36 | 37 |
QgsSimpleMarkerSymbolLayerV2( QString name = DEFAULT_SIMPLEMARKER_NAME, |
37 | 38 |
QColor color = DEFAULT_SIMPLEMARKER_COLOR, |
39 |
Qt::BrushStyle style = DEFAULT_SIMPLEMARKER_STYLE, |
|
38 | 40 |
QColor borderColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR, |
39 | 41 |
double size = DEFAULT_SIMPLEMARKER_SIZE, |
40 | 42 |
double angle = DEFAULT_SIMPLEMARKER_ANGLE ); |
... | ... | |
58 | 60 |
|
59 | 61 |
QgsSymbolLayerV2* clone() const; |
60 | 62 |
|
63 |
Qt::BrushStyle brushStyle() const { return mBrushStyle; } |
|
64 |
void setBrushStyle( Qt::BrushStyle style ) { mBrushStyle = style; } |
|
65 |
|
|
61 | 66 |
void writeSldMarker( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const; |
62 | 67 |
|
63 | 68 |
QString name() const { return mName; } |
... | ... | |
81 | 86 |
QPolygonF mPolygon; |
82 | 87 |
QPainterPath mPath; |
83 | 88 |
QString mName; |
89 |
Qt::BrushStyle mBrushStyle; |
|
84 | 90 |
QImage mCache; |
85 | 91 |
QPen mSelPen; |
86 | 92 |
QBrush mSelBrush; |
src/core/symbology-ng/qgssymbologyv2conversion.cpp | ||
---|---|---|
46 | 46 |
QColor color = s->fillColor(); |
47 | 47 |
QColor borderColor = s->color(); |
48 | 48 |
QString name = symbolName.mid( 5 ); |
49 |
sl = new QgsSimpleMarkerSymbolLayerV2( name, color, borderColor, size, angle ); |
|
49 |
Qt::BrushStyle brushStyle = s->brush().style(); |
|
50 |
sl = new QgsSimpleMarkerSymbolLayerV2( name, color, brushStyle, borderColor, size, angle ); |
|
50 | 51 |
} |
51 | 52 |
else |
52 | 53 |
{ |
src/gui/symbology-ng/qgssymbollayerv2widget.cpp | ||
---|---|---|
192 | 192 |
names << "circle" << "rectangle" << "diamond" << "pentagon" << "cross" << "cross2" << "triangle" |
193 | 193 |
<< "equilateral_triangle" << "star" << "regular_star" << "arrow" << "line" << "arrowhead" << "filled_arrowhead"; |
194 | 194 |
double markerSize = DEFAULT_POINT_SIZE * 2; |
195 |
Qt::BrushStyle brushStyle = DEFAULT_SIMPLEFILL_STYLE ; |
|
195 | 196 |
for ( int i = 0; i < names.count(); ++i ) |
196 | 197 |
{ |
197 |
QgsSimpleMarkerSymbolLayerV2* lyr = new QgsSimpleMarkerSymbolLayerV2( names[i], QColor( 200, 200, 200 ), QColor( 0, 0, 0 ), markerSize ); |
|
198 |
QgsSimpleMarkerSymbolLayerV2* lyr = new QgsSimpleMarkerSymbolLayerV2( names[i], QColor( 200, 200, 200 ), brushStyle, QColor( 0, 0, 0 ), markerSize );
|
|
198 | 199 |
QIcon icon = QgsSymbolLayerV2Utils::symbolLayerPreviewIcon( lyr, QgsSymbolV2::MM, size ); |
199 | 200 |
QListWidgetItem* item = new QListWidgetItem( icon, QString(), lstNames ); |
200 | 201 |
item->setData( Qt::UserRole, names[i] ); |
... | ... | |
206 | 207 |
connect( btnChangeColorFill, SIGNAL( clicked() ), this, SLOT( setColorFill() ) ); |
207 | 208 |
connect( spinSize, SIGNAL( valueChanged( double ) ), this, SLOT( setSize() ) ); |
208 | 209 |
connect( spinAngle, SIGNAL( valueChanged( double ) ), this, SLOT( setAngle() ) ); |
210 |
connect( cboFillStyleMarker,SIGNAL( currentIndexChanged( int ) ), this, SLOT( setBrushStyle() )) ; |
|
209 | 211 |
connect( spinOffsetX, SIGNAL( valueChanged( double ) ), this, SLOT( setOffset() ) ); |
210 | 212 |
connect( spinOffsetY, SIGNAL( valueChanged( double ) ), this, SLOT( setOffset() ) ); |
211 | 213 |
} |
... | ... | |
232 | 234 |
btnChangeColorFill->setColor( mLayer->color() ); |
233 | 235 |
spinSize->setValue( mLayer->size() ); |
234 | 236 |
spinAngle->setValue( mLayer->angle() ); |
237 |
cboFillStyleMarker->setBrushStyle( mLayer->brushStyle() ); |
|
235 | 238 |
|
236 | 239 |
// without blocking signals the value gets changed because of slot setOffset() |
237 | 240 |
spinOffsetX->blockSignals( true ); |
... | ... | |
287 | 290 |
emit changed(); |
288 | 291 |
} |
289 | 292 |
|
293 |
void QgsSimpleMarkerSymbolLayerV2Widget::setBrushStyle() |
|
294 |
{ |
|
295 |
mLayer->setBrushStyle( cboFillStyleMarker->brushStyle() ); |
|
296 |
emit changed(); |
|
297 |
} |
|
298 |
|
|
290 | 299 |
void QgsSimpleMarkerSymbolLayerV2Widget::setSize() |
291 | 300 |
{ |
292 | 301 |
mLayer->setSize( spinSize->value() ); |
src/gui/symbology-ng/qgssymbollayerv2widget.h | ||
---|---|---|
19 | 19 |
|
20 | 20 |
#include <QWidget> |
21 | 21 |
|
22 |
#define DEFAULT_SIMPLEFILL_STYLE Qt::SolidPattern |
|
22 | 23 |
class QgsSymbolLayerV2; |
23 | 24 |
class QgsVectorLayer; |
24 | 25 |
|
... | ... | |
99 | 100 |
void setName(); |
100 | 101 |
void setColorBorder(); |
101 | 102 |
void setColorFill(); |
103 |
void setBrushStyle(); |
|
102 | 104 |
void setSize(); |
103 | 105 |
void setAngle(); |
104 | 106 |
void setOffset(); |
src/ui/symbollayer/widget_simplemarker.ui | ||
---|---|---|
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"> |
... | ... | |
63 | 63 |
</property> |
64 | 64 |
</widget> |
65 | 65 |
</item> |
66 |
<item row="2" column="0">
|
|
66 |
<item row="3" column="0">
|
|
67 | 67 |
<widget class="QLabel" name="label_3"> |
68 | 68 |
<property name="text"> |
69 | 69 |
<string>Size</string> |
70 | 70 |
</property> |
71 | 71 |
</widget> |
72 | 72 |
</item> |
73 |
<item row="3" column="0">
|
|
73 |
<item row="5" column="0">
|
|
74 | 74 |
<widget class="QLabel" name="label_4"> |
75 | 75 |
<property name="text"> |
76 | 76 |
<string>Angle</string> |
77 | 77 |
</property> |
78 | 78 |
</widget> |
79 | 79 |
</item> |
80 |
<item row="3" column="1">
|
|
80 |
<item row="5" column="1">
|
|
81 | 81 |
<widget class="QDoubleSpinBox" name="spinAngle"> |
82 | 82 |
<property name="decimals"> |
83 | 83 |
<number>2</number> |
... | ... | |
90 | 90 |
</property> |
91 | 91 |
</widget> |
92 | 92 |
</item> |
93 |
<item row="4" column="0">
|
|
93 |
<item row="6" column="0">
|
|
94 | 94 |
<widget class="QLabel" name="label_5"> |
95 | 95 |
<property name="text"> |
96 | 96 |
<string>Offset X,Y</string> |
97 | 97 |
</property> |
98 | 98 |
</widget> |
99 | 99 |
</item> |
100 |
<item row="4" column="1">
|
|
100 |
<item row="6" column="1">
|
|
101 | 101 |
<layout class="QHBoxLayout" name="horizontalLayout"> |
102 | 102 |
<item> |
103 | 103 |
<widget class="QDoubleSpinBox" name="spinOffsetX"> |
... | ... | |
121 | 121 |
</item> |
122 | 122 |
</layout> |
123 | 123 |
</item> |
124 |
<item row="2" column="1">
|
|
124 |
<item row="3" column="1">
|
|
125 | 125 |
<widget class="QDoubleSpinBox" name="spinSize"> |
126 | 126 |
<property name="decimals"> |
127 | 127 |
<number>5</number> |
... | ... | |
134 | 134 |
</property> |
135 | 135 |
</widget> |
136 | 136 |
</item> |
137 |
<item row="2" column="0"> |
|
138 |
<widget class="QLabel" name="label_6"> |
|
139 |
<property name="text"> |
|
140 |
<string>Fill Style</string> |
|
141 |
</property> |
|
142 |
</widget> |
|
143 |
</item> |
|
144 |
<item row="2" column="1"> |
|
145 |
<widget class="QgsBrushStyleComboBox" name="cboFillStyleMarker"/> |
|
146 |
</item> |
|
137 | 147 |
</layout> |
138 | 148 |
</item> |
139 | 149 |
<item> |
... | ... | |
159 | 169 |
<property name="flow"> |
160 | 170 |
<enum>QListView::LeftToRight</enum> |
161 | 171 |
</property> |
162 |
<property name="resizeMode"> |
|
163 |
<enum>QListView::Adjust</enum> |
|
164 |
</property> |
|
165 | 172 |
<property name="spacing"> |
166 | 173 |
<number>4</number> |
167 | 174 |
</property> |
... | ... | |
199 | 206 |
</widget> |
200 | 207 |
<customwidgets> |
201 | 208 |
<customwidget> |
209 |
<class>Q3ComboBox</class> |
|
210 |
<extends>QWidget</extends> |
|
211 |
<header>Qt3Support/Q3ComboBox</header> |
|
212 |
</customwidget> |
|
213 |
<customwidget> |
|
202 | 214 |
<class>QgsColorButtonV2</class> |
203 | 215 |
<extends>QPushButton</extends> |
204 | 216 |
<header>qgscolorbutton.h</header> |