00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <cmath>
00020
00021 #include "qgis.h"
00022 #include "qgssymbol.h"
00023 #include "qgslogger.h"
00024 #include "qgssymbologyutils.h"
00025 #include "qgsmarkercatalogue.h"
00026 #include "qgsapplication.h"
00027 #include "qgsvectorlayer.h"
00028 #include "qgsproject.h"
00029
00030 #include <QPainter>
00031 #include <QDomNode>
00032 #include <QDomDocument>
00033 #include <QImage>
00034 #include <QDir>
00035 #include <QFileInfo>
00036
00037 #include "qgslogger.h"
00038
00039
00040 QgsSymbol::QgsSymbol( QGis::GeometryType t, QString lvalue, QString uvalue, QString label ) :
00041 mLowerValue( lvalue ),
00042 mUpperValue( uvalue ),
00043 mLabel( label ),
00044 mType( t ),
00045 mPointSymbolName( "hard:circle" ),
00046 mSize( DEFAULT_POINT_SIZE ),
00047 mSizeInMapUnits( false ),
00048 mPointSymbolImage( 1, 1, QImage::Format_ARGB32_Premultiplied ),
00049 mWidthScale( -1.0 ),
00050 mCacheUpToDate( false ),
00051 mCacheUpToDate2( false ),
00052 mRotationClassificationField( -1 ),
00053 mScaleClassificationField( -1 ),
00054 mSymbolField( -1 )
00055 {
00056 mPen.setWidthF( DEFAULT_LINE_WIDTH );
00057 }
00058
00059
00060 QgsSymbol::QgsSymbol( QGis::GeometryType t, QString lvalue, QString uvalue, QString label, QColor c ) :
00061 mLowerValue( lvalue ),
00062 mUpperValue( uvalue ),
00063 mLabel( label ),
00064 mType( t ),
00065 mPen( c ),
00066 mBrush( c ),
00067 mPointSymbolName( "hard:circle" ),
00068 mSize( DEFAULT_POINT_SIZE ),
00069 mSizeInMapUnits( false ),
00070 mPointSymbolImage( 1, 1, QImage::Format_ARGB32_Premultiplied ),
00071 mWidthScale( -1.0 ),
00072 mCacheUpToDate( false ),
00073 mCacheUpToDate2( false ),
00074 mRotationClassificationField( -1 ),
00075 mScaleClassificationField( -1 ),
00076 mSymbolField( -1 )
00077 {
00078 mPen.setWidthF( DEFAULT_LINE_WIDTH );
00079 }
00080
00081 QgsSymbol::QgsSymbol()
00082 : mPointSymbolName( "hard:circle" ),
00083 mSize( DEFAULT_POINT_SIZE ),
00084 mSizeInMapUnits( false ),
00085 mPointSymbolImage( 1, 1, QImage::Format_ARGB32_Premultiplied ),
00086 mWidthScale( -1.0 ),
00087 mCacheUpToDate( false ),
00088 mCacheUpToDate2( false ),
00089 mRotationClassificationField( -1 ),
00090 mScaleClassificationField( -1 ),
00091 mSymbolField( -1 )
00092 {
00093 mPen.setWidthF( DEFAULT_LINE_WIDTH );
00094 }
00095
00096
00097 QgsSymbol::QgsSymbol( QColor c )
00098 : mPen( c ),
00099 mBrush( c ),
00100 mPointSymbolName( "hard:circle" ),
00101 mSize( DEFAULT_POINT_SIZE ),
00102 mSizeInMapUnits( false ),
00103 mPointSymbolImage( 1, 1, QImage::Format_ARGB32_Premultiplied ),
00104 mWidthScale( -1.0 ),
00105 mCacheUpToDate( false ),
00106 mCacheUpToDate2( false ),
00107 mRotationClassificationField( -1 ),
00108 mScaleClassificationField( -1 ),
00109 mSymbolField( -1 )
00110 {
00111 mPen.setWidthF( DEFAULT_LINE_WIDTH );
00112 }
00113
00114 QgsSymbol::QgsSymbol( const QgsSymbol& s )
00115 {
00116 if ( this != &s )
00117 {
00118 mLowerValue = s.mLowerValue;
00119 mUpperValue = s.mUpperValue;
00120 mLabel = s.mLabel;
00121 mType = s.mType;
00122 mPen = s.mPen;
00123 mBrush = s.mBrush;
00124 mTextureFilePath = s.mTextureFilePath;
00125 mPointSymbolName = s.mPointSymbolName;
00126 mSize = s.mSize;
00127 mSizeInMapUnits = s.mSizeInMapUnits;
00128 mPointSymbolImage = s.mPointSymbolImage;
00129 mPointSymbolImageSelected = s.mPointSymbolImageSelected;
00130 mWidthScale = s.mWidthScale;
00131 mPointSymbolImage2 = s.mPointSymbolImage2;
00132 mPointSymbolImageSelected2 = s.mPointSymbolImageSelected2;
00133 mCacheUpToDate = s.mCacheUpToDate;
00134 mCacheUpToDate2 = s.mCacheUpToDate2;
00135 mSelectionColor = s.mSelectionColor;
00136 mSelectionColor2 = s.mSelectionColor2;
00137 mRotationClassificationField = s.mRotationClassificationField;
00138 mScaleClassificationField = s.mScaleClassificationField;
00139 mSymbolField = s.mSymbolField;
00140 }
00141 }
00142
00143 QgsSymbol::~QgsSymbol()
00144 {
00145 }
00146
00147
00148 QColor QgsSymbol::color() const
00149 {
00150 return mPen.color();
00151 }
00152
00153 void QgsSymbol::setColor( QColor c )
00154 {
00155 mPen.setColor( c );
00156 mCacheUpToDate = mCacheUpToDate2 = false;
00157 }
00158
00159 QColor QgsSymbol::fillColor() const
00160 {
00161 return mBrush.color();
00162 }
00163
00164 void QgsSymbol::setFillColor( QColor c )
00165 {
00166 mBrush.setColor( c );
00167 mCacheUpToDate = mCacheUpToDate2 = false;
00168 }
00169
00170 double QgsSymbol::lineWidth() const
00171 {
00172 return mPen.widthF();
00173 }
00174
00175 void QgsSymbol::setLineWidth( double w )
00176 {
00177 mPen.setWidthF( w );
00178 mCacheUpToDate = mCacheUpToDate2 = false;
00179 }
00180
00181 void QgsSymbol::setLineStyle( Qt::PenStyle s )
00182 {
00183 mPen.setStyle( s );
00184 mCacheUpToDate = mCacheUpToDate2 = false;
00185 }
00186
00187 void QgsSymbol::setFillStyle( Qt::BrushStyle s )
00188 {
00189 mBrush.setStyle( s );
00190 mCacheUpToDate = mCacheUpToDate2 = false;
00191 }
00192
00193 QString QgsSymbol::customTexture() const
00194 {
00195 return mTextureFilePath;
00196 }
00197
00198 void QgsSymbol::setCustomTexture( QString path )
00199 {
00200 mTextureFilePath = path;
00201 mBrush.setTextureImage( QImage( path ) );
00202 mCacheUpToDate = mCacheUpToDate2 = false;
00203 }
00204
00205
00206
00207 void QgsSymbol::setNamedPointSymbol( QString name )
00208 {
00209 if ( name.startsWith( "svg:" ) )
00210 {
00211
00212 QString myTempName = name;
00213 myTempName.replace( "svg:", "" );
00214 QFile myFile( myTempName );
00215 if ( !myFile.exists() )
00216 {
00217 QgsDebugMsg( "\n\n\n *** Svg Symbol not found on fs ***" );
00218 QgsDebugMsg( "Name: " + name );
00219
00220
00221
00222 QStringList svgPaths = QgsApplication::svgPaths();
00223 for ( int i = 0; i < svgPaths.size(); i++ )
00224 {
00225 QgsDebugMsg( "SvgPath: " + svgPaths[i] );
00226 QFileInfo myInfo( myTempName );
00227 QString myFileName = myInfo.fileName();
00228 QString myLowestDir = myInfo.dir().dirName();
00229 QString myLocalPath = svgPaths[i] + "/" + myLowestDir + "/" + myFileName;
00230
00231 QgsDebugMsg( "Alternative svg path: " + myLocalPath );
00232 if ( QFile( myLocalPath ).exists() )
00233 {
00234 name = "svg:" + myLocalPath;
00235 QgsDebugMsg( "Svg found in alternative path" );
00236 }
00237 else if ( myInfo.isRelative() )
00238 {
00239 QFileInfo pfi( QgsProject::instance()->fileName() );
00240 if ( pfi.exists() && QFile( pfi.canonicalPath() + QDir::separator() + myTempName ).exists() )
00241 {
00242 name = "svg:" + pfi.canonicalPath() + QDir::separator() + myTempName;
00243 QgsDebugMsg( "Svg found in alternative path" );
00244 break;
00245 }
00246 else
00247 {
00248 QgsDebugMsg( "Svg not found in project path" );
00249 }
00250 }
00251 else
00252 {
00253
00254 QgsDebugMsg( "Computed alternate path but no svg there either" );
00255 }
00256 }
00257 }
00258 }
00259 mPointSymbolName = name;
00260 mCacheUpToDate = mCacheUpToDate2 = false;
00261 }
00262
00263 QString QgsSymbol::pointSymbolName() const
00264 {
00265 return mPointSymbolName;
00266 }
00267
00268 void QgsSymbol::setPointSizeUnits( bool sizeInMapUnits )
00269 {
00270 mSizeInMapUnits = sizeInMapUnits;
00271 }
00272
00273 bool QgsSymbol::pointSizeUnits() const
00274 {
00275 return mSizeInMapUnits;
00276 }
00277
00278 void QgsSymbol::setPointSize( double s )
00279 {
00280 if ( mSizeInMapUnits )
00281 {
00282 mSize = s;
00283 }
00284 else if ( s < MINIMUM_POINT_SIZE )
00285 mSize = MINIMUM_POINT_SIZE;
00286 else
00287 mSize = s;
00288
00289 mCacheUpToDate = mCacheUpToDate2 = false;
00290 }
00291
00292 double QgsSymbol::pointSize() const
00293 {
00294 return mSize;
00295 }
00296
00297 QImage QgsSymbol::getLineSymbolAsImage()
00298 {
00299
00300
00301 QImage img( 15, 15, QImage::Format_ARGB32 );
00302
00303 img.fill( QColor( 255, 255, 255, 0 ).rgba() );
00304 QPainter p( &img );
00305 p.setRenderHints( QPainter::Antialiasing );
00306 p.setPen( mPen );
00307
00308
00309 QPainterPath myPath;
00310 myPath.moveTo( 0, 0 );
00311 myPath.cubicTo( 15, 0, 5, 7, 15, 15 );
00312 p.drawPath( myPath );
00313
00314 return img;
00315 }
00316
00317 QImage QgsSymbol::getPolygonSymbolAsImage()
00318 {
00319
00320
00321 QImage img( 15, 15, QImage::Format_ARGB32 );
00322
00323 img.fill( QColor( 255, 255, 255, 0 ).rgba() );
00324 QPainter p( &img );
00325 p.setRenderHints( QPainter::Antialiasing );
00326 p.setPen( mPen );
00327 p.setBrush( mBrush );
00328 QPolygon myPolygon;
00329
00330
00331 myPolygon << QPoint( 2, 2 )
00332 << QPoint( 1, 5 )
00333 << QPoint( 1, 10 )
00334 << QPoint( 2, 12 )
00335 << QPoint( 5, 13 )
00336 << QPoint( 6, 13 )
00337 << QPoint( 8, 12 )
00338 << QPoint( 8, 12 )
00339 << QPoint( 10, 12 )
00340 << QPoint( 12, 13 )
00341 << QPoint( 13, 11 )
00342 << QPoint( 12, 8 )
00343 << QPoint( 11, 6 )
00344 << QPoint( 12, 5 )
00345 << QPoint( 13, 2 )
00346 << QPoint( 11, 1 )
00347 << QPoint( 10, 1 )
00348 << QPoint( 8, 2 )
00349 << QPoint( 6, 4 )
00350 << QPoint( 4, 2 )
00351 ;
00352 p.drawPolygon( myPolygon );
00353
00354 return img;
00355 }
00356
00357 QImage QgsSymbol::getCachedPointSymbolAsImage( double widthScale, bool selected, QColor selectionColor, double opacity )
00358 {
00359 if ( !mCacheUpToDate2
00360 || ( selected && mSelectionColor != selectionColor ) || ( opacity != mOpacity ) )
00361 {
00362 if ( selected )
00363 {
00364 cache2( widthScale, selectionColor, opacity );
00365 }
00366 else
00367 {
00368
00369 cache2( widthScale, mSelectionColor, opacity );
00370 }
00371 }
00372
00373 if ( selected )
00374 {
00375 return mPointSymbolImageSelected2;
00376 }
00377 else
00378 {
00379 return mPointSymbolImage2;
00380 }
00381 }
00382
00383 QImage QgsSymbol::getPointSymbolAsImage( double widthScale, bool selected, QColor selectionColor, double scale,
00384 double rotation, double rasterScaleFactor, double opacity )
00385 {
00386 double scaleProduct = scale * rasterScaleFactor;
00387
00388
00389 if ( scaleProduct > 0.9 && scaleProduct < 1.1 && 0 == rotation )
00390 {
00391 if ( mWidthScale < 0 || widthScale == mWidthScale )
00392 {
00393
00394 return getCachedPointSymbolAsImage( widthScale, selected, selectionColor, opacity );
00395 }
00396 }
00397
00398 QImage preRotateImage;
00399 QPen pen = mPen;
00400 double newWidth = mPen.widthF() * widthScale * rasterScaleFactor;
00401 pen.setWidthF( newWidth );
00402
00403 if ( selected )
00404 {
00405 pen.setColor( selectionColor );
00406 QBrush brush = mBrush;
00407 preRotateImage = QgsMarkerCatalogue::instance()->imageMarker(
00408 mPointSymbolName,
00409 ( float )( mSize * scale * widthScale * rasterScaleFactor ),
00410 pen, mBrush, opacity );
00411 }
00412 else
00413 {
00414 QgsDebugMsgLevel( QString( "marker:%1 mPointSize:%2 mPointSizeUnits:%3 scale:%4 widthScale:%5 rasterScaleFactor:%6 opacity:%7" )
00415 .arg( mPointSymbolName ).arg( mSize ).arg( mSizeInMapUnits ? "true" : "false" )
00416 .arg( scale ).arg( widthScale ).arg( rasterScaleFactor ).arg( opacity ), 3 );
00417
00418
00419 preRotateImage = QgsMarkerCatalogue::instance()->imageMarker(
00420 mPointSymbolName,
00421 ( float )( mSize * scale * widthScale * rasterScaleFactor ),
00422 pen, mBrush, opacity );
00423 }
00424
00425 QMatrix rotationMatrix;
00426 rotationMatrix = rotationMatrix.rotate( rotation );
00427
00428 return preRotateImage.transformed( rotationMatrix, Qt::SmoothTransformation );
00429 }
00430
00431
00432 void QgsSymbol::cache( QColor selectionColor )
00433 {
00434 QPen pen = mPen;
00435 pen.setColor( selectionColor );
00436 QBrush brush = mBrush;
00437
00438
00439
00440
00441
00442 mPointSymbolImage = QgsMarkerCatalogue::instance()->imageMarker( mPointSymbolName, mSize,
00443 mPen, mBrush );
00444
00445 mPointSymbolImageSelected = QgsMarkerCatalogue::instance()->imageMarker(
00446 mPointSymbolName, mSize, pen, brush );
00447
00448 mSelectionColor = selectionColor;
00449 mCacheUpToDate = true;
00450 }
00451
00452 void QgsSymbol::cache2( double widthScale, QColor selectionColor, double opacity )
00453 {
00454
00455
00456 QPen pen = mPen;
00457 pen.setWidthF( widthScale * pen.widthF() );
00458
00459 mPointSymbolImage2 = QgsMarkerCatalogue::instance()->imageMarker( mPointSymbolName, mSize * widthScale,
00460 pen, mBrush, opacity );
00461
00462 QBrush brush = mBrush;
00463 brush.setColor( selectionColor );
00464 pen.setColor( selectionColor );
00465
00466 mPointSymbolImageSelected2 = QgsMarkerCatalogue::instance()->imageMarker(
00467 mPointSymbolName, mSize * widthScale, pen, brush, opacity );
00468
00469 mSelectionColor2 = selectionColor;
00470
00471 mWidthScale = widthScale;
00472
00473 mOpacity = opacity;
00474
00475 mCacheUpToDate2 = true;
00476 }
00477
00478 void QgsSymbol::appendField( QDomElement &symbol, QDomDocument &document, const QgsVectorLayer &vl, QString name, int idx ) const
00479 {
00480 appendText( symbol, document, name, vl.pendingFields().contains( idx ) ? vl.pendingFields()[idx].name() : "" );
00481 }
00482
00483 void QgsSymbol::appendText( QDomElement &symbol, QDomDocument &document, QString name, QString value ) const
00484 {
00485 QDomElement node = document.createElement( name );
00486 QDomText txt = document.createTextNode( value );
00487 if ( value.isNull() )
00488 {
00489 node.setAttribute( "null", "1" );
00490 }
00491 symbol.appendChild( node );
00492 node.appendChild( txt );
00493 }
00494
00495 bool QgsSymbol::writeXML( QDomNode & item, QDomDocument & document, const QgsVectorLayer *vl ) const
00496 {
00497 bool returnval = false;
00498 returnval = true;
00499 QDomElement symbol = document.createElement( "symbol" );
00500 item.appendChild( symbol );
00501
00502 appendText( symbol, document, "lowervalue", mLowerValue );
00503 appendText( symbol, document, "uppervalue", mUpperValue );
00504 appendText( symbol, document, "label", mLabel );
00505
00506 QString name = pointSymbolName();
00507 if ( name.startsWith( "svg:" ) )
00508 {
00509 name = name.mid( 4 );
00510
00511 QFileInfo fi( name );
00512 if ( fi.exists() )
00513 {
00514 name = fi.canonicalFilePath();
00515
00516 QStringList svgPaths = QgsApplication::svgPaths();
00517
00518 for ( int i = 0; i < svgPaths.size(); i++ )
00519 {
00520 QString dir = QFileInfo( svgPaths[i] ).canonicalFilePath();
00521
00522 if ( !dir.isEmpty() && name.startsWith( dir ) )
00523 {
00524 name = name.mid( dir.size() );
00525 break;
00526 }
00527 }
00528 }
00529
00530 name = "svg:" + name;
00531 }
00532
00533 appendText( symbol, document, "pointsymbol", name );
00534 appendText( symbol, document, "pointsize", QString::number( pointSize() ) );
00535 appendText( symbol, document, "pointsizeunits", pointSizeUnits() ? "mapunits" : "pixels" );
00536
00537 if ( vl )
00538 {
00539 appendField( symbol, document, *vl, "rotationclassificationfieldname", mRotationClassificationField );
00540 appendField( symbol, document, *vl, "scaleclassificationfieldname", mScaleClassificationField );
00541 appendField( symbol, document, *vl, "symbolfieldname", mSymbolField );
00542 }
00543
00544 QDomElement outlinecolor = document.createElement( "outlinecolor" );
00545 outlinecolor.setAttribute( "red", QString::number( mPen.color().red() ) );
00546 outlinecolor.setAttribute( "green", QString::number( mPen.color().green() ) );
00547 outlinecolor.setAttribute( "blue", QString::number( mPen.color().blue() ) );
00548 symbol.appendChild( outlinecolor );
00549
00550 appendText( symbol, document, "outlinestyle", QgsSymbologyUtils::penStyle2QString( mPen.style() ) );
00551 appendText( symbol, document, "outlinewidth", QString::number( mPen.widthF() ) );
00552
00553 QDomElement fillcolor = document.createElement( "fillcolor" );
00554 fillcolor.setAttribute( "red", QString::number( mBrush.color().red() ) );
00555 fillcolor.setAttribute( "green", QString::number( mBrush.color().green() ) );
00556 fillcolor.setAttribute( "blue", QString::number( mBrush.color().blue() ) );
00557 symbol.appendChild( fillcolor );
00558
00559 appendText( symbol, document, "fillpattern", QgsSymbologyUtils::brushStyle2QString( mBrush.style() ) );
00560 appendText( symbol, document, "texturepath", QgsProject::instance()->writePath( mTextureFilePath ) );
00561
00562 return returnval;
00563 }
00564
00565 int QgsSymbol::readFieldName( QDomNode &synode, QString name, const QgsVectorLayer &vl )
00566 {
00567 QDomNode node = synode.namedItem( name + "name" );
00568
00569 if ( !node.isNull() )
00570 {
00571 const QgsFieldMap &fields = vl.pendingFields();
00572 QString name = node.toElement().text();
00573
00574 for ( QgsFieldMap::const_iterator it = fields.begin(); it != fields.end(); it++ )
00575 if ( it->name() == name )
00576 return it.key();
00577
00578 return -1;
00579 }
00580
00581 node = synode.namedItem( name );
00582
00583 return node.isNull() ? -1 : node.toElement().text().toInt();
00584 }
00585
00586 bool QgsSymbol::readXML( QDomNode &synode, const QgsVectorLayer *vl )
00587 {
00588
00589
00590
00591
00592 QDomNode lvalnode = synode.namedItem( "lowervalue" );
00593 if ( ! lvalnode.isNull() )
00594 {
00595 QDomElement lvalelement = lvalnode.toElement();
00596 if ( lvalelement.attribute( "null" ).toInt() == 1 )
00597 {
00598 mLowerValue = QString::null;
00599 }
00600 else
00601 {
00602 mLowerValue = lvalelement.text();
00603 }
00604 }
00605
00606 QDomNode uvalnode = synode.namedItem( "uppervalue" );
00607 if ( ! uvalnode.isNull() )
00608 {
00609 QDomElement uvalelement = uvalnode.toElement();
00610 mUpperValue = uvalelement.text();
00611 }
00612
00613 QDomNode labelnode = synode.namedItem( "label" );
00614 if ( ! labelnode.isNull() )
00615 {
00616 QDomElement labelelement = labelnode.toElement();
00617 mLabel = labelelement.text();
00618 }
00619
00620 QDomNode psymbnode = synode.namedItem( "pointsymbol" );
00621
00622 if ( ! psymbnode.isNull() )
00623 {
00624 QDomElement psymbelement = psymbnode.toElement();
00625 setNamedPointSymbol( psymbelement.text() );
00626 }
00627
00628 QDomNode psizenode = synode.namedItem( "pointsize" );
00629
00630 if ( ! psizenode.isNull() )
00631 {
00632 QDomElement psizeelement = psizenode.toElement();
00633 setPointSize( psizeelement.text().toFloat() );
00634 }
00635
00636 QDomNode psizeunitnodes = synode.namedItem( "pointsizeunits" );
00637 if ( ! psizeunitnodes.isNull() )
00638 {
00639 QDomElement psizeunitelement = psizeunitnodes.toElement();
00640 QgsDebugMsg( QString( "psizeunitelement:%1" ).arg( psizeunitelement.text() ) );
00641 setPointSizeUnits( psizeunitelement.text().compare( "mapunits", Qt::CaseInsensitive ) == 0 );
00642 }
00643
00644 if ( vl )
00645 {
00646 mRotationClassificationField = readFieldName( synode, "rotationclassificationfield", *vl );
00647 mScaleClassificationField = readFieldName( synode, "scaleclassificationfield", *vl );
00648 mSymbolField = readFieldName( synode, "symbolfield", *vl );
00649 }
00650 else
00651 {
00652 mRotationClassificationField = -1;
00653 mScaleClassificationField = -1;
00654 }
00655
00656 QDomNode outlcnode = synode.namedItem( "outlinecolor" );
00657 QDomElement oulcelement = outlcnode.toElement();
00658 int red = oulcelement.attribute( "red" ).toInt();
00659 int green = oulcelement.attribute( "green" ).toInt();
00660 int blue = oulcelement.attribute( "blue" ).toInt();
00661 setColor( QColor( red, green, blue ) );
00662
00663 QDomNode outlstnode = synode.namedItem( "outlinestyle" );
00664 QDomElement outlstelement = outlstnode.toElement();
00665 setLineStyle( QgsSymbologyUtils::qString2PenStyle( outlstelement.text() ) );
00666
00667 QDomNode outlwnode = synode.namedItem( "outlinewidth" );
00668 QDomElement outlwelement = outlwnode.toElement();
00669 setLineWidth( outlwelement.text().toDouble() );
00670
00671 QDomNode fillcnode = synode.namedItem( "fillcolor" );
00672 QDomElement fillcelement = fillcnode.toElement();
00673 red = fillcelement.attribute( "red" ).toInt();
00674 green = fillcelement.attribute( "green" ).toInt();
00675 blue = fillcelement.attribute( "blue" ).toInt();
00676 setFillColor( QColor( red, green, blue ) );
00677
00678 QDomNode texturepathnode = synode.namedItem( "texturepath" );
00679 QDomElement texturepathelement = texturepathnode.toElement();
00680 setCustomTexture( QgsProject::instance()->readPath( texturepathelement.text() ) );
00681
00682
00683 QDomNode fillpnode = synode.namedItem( "fillpattern" );
00684 QDomElement fillpelement = fillpnode.toElement();
00685 setFillStyle( QgsSymbologyUtils::qString2BrushStyle( fillpelement.text() ) );
00686
00687 return true;
00688 }
00689
00690 int QgsSymbol::rotationClassificationField() const
00691 {
00692 return mRotationClassificationField;
00693 }
00694
00695 void QgsSymbol::setRotationClassificationField( int field )
00696 {
00697 mRotationClassificationField = field;
00698 }
00699
00700 int QgsSymbol::scaleClassificationField() const
00701 {
00702 return mScaleClassificationField;
00703 }
00704
00705 void QgsSymbol::setScaleClassificationField( int field )
00706 {
00707 mScaleClassificationField = field;
00708 }
00709
00710 int QgsSymbol::symbolField() const
00711 {
00712 return mSymbolField;
00713 }
00714
00715 void QgsSymbol::setSymbolField( int field )
00716 {
00717 mSymbolField = field;
00718 }