void QgsLineSymbolV2::setWidth( double w ) { double origWidth = width(); for ( QgsSymbolLayerV2List::iterator it = mLayers.begin(); it != mLayers.end(); ++it ) { QgsLineSymbolLayerV2* layer = ( QgsLineSymbolLayerV2* ) * it; if ( layer->width() == origWidth ) { layer->setWidth( w ); } else { // proportionally scale the width if ( origWidth != 0 ) layer->setWidth( layer->width() * w / origWidth ); } } }
void QgsLineSymbolV2::setWidth( double w ) { double origWidth = width(); for ( QgsSymbolLayerV2List::iterator it = mLayers.begin(); it != mLayers.end(); ++it ) { QgsLineSymbolLayerV2* layer = ( QgsLineSymbolLayerV2* ) * it; if ( layer->width() == origWidth ) { layer->setWidth( w ); } else if ( origWidth != 0 ) { // proportionally scale the width layer->setWidth( layer->width() * w / origWidth ); } // also scale offset to maintain relative position if ( origWidth != 0 && layer->offset() ) layer->setOffset( layer->offset() * w / origWidth ); } }