Example #1
0
void QgsMarkerSymbolV2::setSize( double s )
{
  double origSize = size();

  for ( QgsSymbolLayerV2List::iterator it = mLayers.begin(); it != mLayers.end(); ++it )
  {
    QgsMarkerSymbolLayerV2* layer = static_cast<QgsMarkerSymbolLayerV2*>( *it );
    if ( layer->size() == origSize )
      layer->setSize( s );
    else
    {
      // proportionally scale size
      if ( origSize != 0 )
        layer->setSize( layer->size() * s / origSize );
    }
  }
}
Example #2
0
void QgsMarkerSymbolV2::setSize( double s )
{
  double origSize = size();

  for ( QgsSymbolLayerV2List::iterator it = mLayers.begin(); it != mLayers.end(); ++it )
  {
    QgsMarkerSymbolLayerV2* layer = static_cast<QgsMarkerSymbolLayerV2*>( *it );
    if ( layer->size() == origSize )
      layer->setSize( s );
    else if ( origSize != 0 )
    {
      // proportionally scale size
      layer->setSize( layer->size() * s / origSize );
    }
    // also scale offset to maintain relative position
    if ( origSize != 0 && ( layer->offset().x() || layer->offset().y() ) )
      layer->setOffset( QPointF( layer->offset().x() * s / origSize,
                                 layer->offset().y() * s / origSize ) );
  }
}