automatic indentation update (r9220-r9281)

git-svn-id: http://svn.osgeo.org/qgis/trunk@9282 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
jef 2008-09-08 08:18:14 +00:00
parent 911038bb9d
commit 17d69a13df
36 changed files with 511 additions and 506 deletions

View File

@ -888,7 +888,7 @@ void QgsComposer::on_mActionExportAsImage_activated( void )
//find out the last used filter
QSettings myQSettings; // where we keep last used filter in persistant state
QString myLastUsedFormat = myQSettings.value( "/UI/lastSaveAsImageFormat", "png" ).toString();
QString myLastUsedFile = myQSettings.value( "/UI/lastSaveAsImageFile", "qgis.png").toString();
QString myLastUsedFile = myQSettings.value( "/UI/lastSaveAsImageFile", "qgis.png" ).toString();
QFileInfo file( myLastUsedFile );
// get a list of supported output image types
@ -959,21 +959,21 @@ void QgsComposer::on_mActionExportAsImage_activated( void )
if ( myOutputFileNameQString == "" ) return;
mComposition->setPlotStyle( QgsComposition::Print );
mView->setScene(0);
mView->setScene( 0 );
QImage image( QSize(width, height), QImage::Format_ARGB32 );
image.setDotsPerMeterX(mComposition->printoutResolution() / 25.4 * 1000);
image.setDotsPerMeterY(mComposition->printoutResolution() / 25.4 * 1000);
image.fill(0);
QImage image( QSize( width, height ), QImage::Format_ARGB32 );
image.setDotsPerMeterX( mComposition->printoutResolution() / 25.4 * 1000 );
image.setDotsPerMeterY( mComposition->printoutResolution() / 25.4 * 1000 );
image.fill( 0 );
QPainter p( &image );
QRectF sourceArea( 0, 0, mComposition->paperWidth(), mComposition->paperHeight());
QRectF targetArea(0, 0, width, height);
mComposition->render( &p, targetArea, sourceArea);
QRectF sourceArea( 0, 0, mComposition->paperWidth(), mComposition->paperHeight() );
QRectF targetArea( 0, 0, width, height );
mComposition->render( &p, targetArea, sourceArea );
p.end();
mComposition->setPlotStyle( QgsComposition::Preview );
image.save( myOutputFileNameQString, myFilterMap[myFilterString].toLocal8Bit().data() );
mView->setScene(mComposition);
mView->setScene( mComposition );
}
@ -1420,8 +1420,8 @@ void QgsComposer::readXML( const QDomDocument& doc )
mComposition->addItem( newLabel );
mComposition->update();
mComposition->clearSelection();
newLabel->setSelected(true);
showItemOptions(newLabel);
newLabel->setSelected( true );
showItemOptions( newLabel );
}
//composer maps
@ -1435,8 +1435,8 @@ void QgsComposer::readXML( const QDomDocument& doc )
mComposition->addItem( newMap );
mComposition->update();
mComposition->clearSelection();
newMap->setSelected(true);
showItemOptions(newMap);
newMap->setSelected( true );
showItemOptions( newMap );
}
//composer scalebars
@ -1450,8 +1450,8 @@ void QgsComposer::readXML( const QDomDocument& doc )
mComposition->addItem( newScaleBar );
mComposition->update();
mComposition->clearSelection();
newScaleBar->setSelected(true);
showItemOptions(newScaleBar);
newScaleBar->setSelected( true );
showItemOptions( newScaleBar );
}
//composer legends
@ -1465,8 +1465,8 @@ void QgsComposer::readXML( const QDomDocument& doc )
mComposition->addItem( newLegend );
mComposition->update();
mComposition->clearSelection();
newLegend->setSelected(true);
showItemOptions(newLegend);
newLegend->setSelected( true );
showItemOptions( newLegend );
}
//composer pictures
@ -1480,8 +1480,8 @@ void QgsComposer::readXML( const QDomDocument& doc )
mComposition->addItem( newPicture );
mComposition->update();
mComposition->clearSelection();
newPicture->setSelected(true);
showItemOptions(newPicture);
newPicture->setSelected( true );
showItemOptions( newPicture );
}
mComposition->sortZList();

View File

@ -363,9 +363,9 @@ void QgsComposerLegendWidget::on_mUpdatePushButton_clicked()
return;
}
if(mLegend->model())
if ( mLegend->model() )
{
mLegend->model()->updateItem(currentItem);
mLegend->model()->updateItem( currentItem );
}
mLegend->update();
mLegend->adjustBoxSize();

View File

@ -25,8 +25,8 @@ QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c )
createPaperEntries();
//unit (only mm at the moment, therefore disabled)
mPaperUnitsComboBox->addItem("mm");
mPaperUnitsComboBox->setEnabled(false);
mPaperUnitsComboBox->addItem( "mm" );
mPaperUnitsComboBox->setEnabled( false );
//orientation
mPaperOrientationComboBox->blockSignals( true );

View File

@ -253,15 +253,15 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
{
QLineEdit *le = new QLineEdit( myFieldValue.toString() );
QPushButton *pb = new QPushButton( tr("...") );
connect(pb, SIGNAL(clicked()), this, SLOT(selectFileName()));
QPushButton *pb = new QPushButton( tr( "..." ) );
connect( pb, SIGNAL( clicked() ), this, SLOT( selectFileName() ) );
QHBoxLayout *hbl = new QHBoxLayout();
hbl->addWidget(le);
hbl->addWidget(pb);
hbl->addWidget( le );
hbl->addWidget( pb );
myWidget = new QWidget;
myWidget->setLayout(hbl);
myWidget->setLayout( hbl );
}
break;
}
@ -296,22 +296,22 @@ QgsAttributeDialog::~QgsAttributeDialog()
void QgsAttributeDialog::selectFileName()
{
QPushButton *pb = dynamic_cast<QPushButton *>( sender() );
if(!pb)
if ( !pb )
return;
QWidget *hbox = dynamic_cast<QWidget *>( pb->parent() );
if(!hbox)
if ( !hbox )
return;
QLineEdit *le = hbox->findChild<QLineEdit *>();
if(!le)
if ( !le )
return;
QString fileName = QFileDialog::getOpenFileName(0 , tr("Select a file"));
if(fileName.isNull())
QString fileName = QFileDialog::getOpenFileName( 0 , tr( "Select a file" ) );
if ( fileName.isNull() )
return;
le->setText(fileName);
le->setText( fileName );
}
void QgsAttributeDialog::accept()
@ -368,8 +368,8 @@ void QgsAttributeDialog::accept()
myFieldValue = QString::number( dsb->value() );
}
le = mpWidgets.value( myIndex )->findChild<QLineEdit *>("lineEdit");
if(le)
le = mpWidgets.value( myIndex )->findChild<QLineEdit *>( "lineEdit" );
if ( le )
{
myFieldValue = le->text();
}

View File

@ -103,7 +103,7 @@ QgsAttributeTable::~QgsAttributeTable()
void QgsAttributeTable::setReadOnly( bool b )
{
blockSignals(true);
blockSignals( true );
setEditTriggers( b ? QAbstractItemView::NoEditTriggers :
QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed );
@ -112,7 +112,7 @@ void QgsAttributeTable::setReadOnly( bool b )
setColumnReadOnly( 0, true );
}
blockSignals(false);
blockSignals( false );
}
void QgsAttributeTable::setColumnReadOnly( int col, bool ro )
@ -439,7 +439,7 @@ void QgsAttributeTable::copySelectedRows()
void QgsAttributeTable::fillTable( QgsVectorLayer *layer )
{
blockSignals(true);
blockSignals( true );
const QgsFieldMap &fields = layer->pendingFields();
@ -489,7 +489,7 @@ void QgsAttributeTable::fillTable( QgsVectorLayer *layer )
for ( int i = 0; i < columnCount(); i++ )
resizeColumnToContents( i );
blockSignals(false);
blockSignals( false );
}
void QgsAttributeTable::putFeatureInTable( int row, const QgsFeature& fet )

View File

@ -89,9 +89,9 @@ void QgsPluginRegistry::removePlugin( QString name )
void QgsPluginRegistry::unloadAll()
{
for(std::map<QString, QgsPluginMetadata*>::iterator it=plugins.begin();
it!=plugins.end();
it++)
if( it->second->plugin() )
for ( std::map<QString, QgsPluginMetadata*>::iterator it = plugins.begin();
it != plugins.end();
it++ )
if ( it->second->plugin() )
it->second->plugin()->unload();
}

View File

@ -822,7 +822,7 @@ void QgsRasterLayerProperties::sync()
pixmapLegend->repaint();
//set the palette pixmap
pixmapPalette->setPixmap( mRasterLayer->getPaletteAsPixmap(mRasterLayer->getRasterBandNumber(mRasterLayer->getGrayBandName())));
pixmapPalette->setPixmap( mRasterLayer->getPaletteAsPixmap( mRasterLayer->getRasterBandNumber( mRasterLayer->getGrayBandName() ) ) );
pixmapPalette->setScaledContents( true );
pixmapPalette->repaint();
@ -1988,7 +1988,7 @@ void QgsRasterLayerProperties::on_pbnHistRefresh_clicked()
QgsDebugMsg( QString( "myMiddle = %1" ).arg( myMiddle ) );
if ( myRasterShaderFunction->generateShadedValue(myMiddle, &c1, &c2, &c3))
if ( myRasterShaderFunction->generateShadedValue( myMiddle, &c1, &c2, &c3 ) )
{
QgsDebugMsg( "Color not found" );
c1 = c2 = c3 = 180; // grey

View File

@ -525,58 +525,58 @@ void QgsComposerItem::hoverMoveEvent( QGraphicsSceneHoverEvent * event )
}
}
void QgsComposerItem::drawText(QPainter* p, int x, int y, const QString& text, const QFont& font) const
void QgsComposerItem::drawText( QPainter* p, int x, int y, const QString& text, const QFont& font ) const
{
QFont textFont = scaledFontPixelSize(font);
QFont textFont = scaledFontPixelSize( font );
p->save();
p->setFont(textFont);
p->setPen(QColor(0, 0, 0)); //draw text always in black
p->setFont( textFont );
p->setPen( QColor( 0, 0, 0 ) ); //draw text always in black
double scaleFactor = 1.0 / FONT_WORKAROUND_SCALE;
p->scale(scaleFactor, scaleFactor);
p->drawText(x * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE, text);
p->scale( scaleFactor, scaleFactor );
p->drawText( x * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE, text );
p->restore();
}
void QgsComposerItem::drawText(QPainter* p, const QRectF& rect, const QString& text, const QFont& font) const
void QgsComposerItem::drawText( QPainter* p, const QRectF& rect, const QString& text, const QFont& font ) const
{
QFont textFont = scaledFontPixelSize(font);
QFont textFont = scaledFontPixelSize( font );
QRectF scaledRect(rect.x() * FONT_WORKAROUND_SCALE, rect.y() * FONT_WORKAROUND_SCALE,
rect.width() * FONT_WORKAROUND_SCALE, rect.height() * FONT_WORKAROUND_SCALE);
QRectF scaledRect( rect.x() * FONT_WORKAROUND_SCALE, rect.y() * FONT_WORKAROUND_SCALE,
rect.width() * FONT_WORKAROUND_SCALE, rect.height() * FONT_WORKAROUND_SCALE );
p->save();
p->setFont(textFont);
p->setPen(QColor(0, 0, 0)); //draw text always in black
p->setFont( textFont );
p->setPen( QColor( 0, 0, 0 ) ); //draw text always in black
double scaleFactor = 1.0 / FONT_WORKAROUND_SCALE;
p->scale(scaleFactor, scaleFactor);
p->drawText(scaledRect, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, text);
p->scale( scaleFactor, scaleFactor );
p->drawText( scaledRect, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, text );
p->restore();
}
double QgsComposerItem::textWidthMM(const QFont& font, const QString& text) const
double QgsComposerItem::textWidthMM( const QFont& font, const QString& text ) const
{
QFont metricsFont = scaledFontPixelSize(font);
QFontMetrics fontMetrics(metricsFont);
return (fontMetrics.width(text) / FONT_WORKAROUND_SCALE);
QFont metricsFont = scaledFontPixelSize( font );
QFontMetrics fontMetrics( metricsFont );
return ( fontMetrics.width( text ) / FONT_WORKAROUND_SCALE );
}
double QgsComposerItem::fontAscentMM(const QFont& font) const
double QgsComposerItem::fontAscentMM( const QFont& font ) const
{
QFont metricsFont = scaledFontPixelSize(font);
QFontMetrics fontMetrics(metricsFont);
return (fontMetrics.ascent() / FONT_WORKAROUND_SCALE);
QFont metricsFont = scaledFontPixelSize( font );
QFontMetrics fontMetrics( metricsFont );
return ( fontMetrics.ascent() / FONT_WORKAROUND_SCALE );
}
double QgsComposerItem::pixelFontSize(double pointSize) const
double QgsComposerItem::pixelFontSize( double pointSize ) const
{
return (pointSize * 0.3527);
return ( pointSize * 0.3527 );
}
QFont QgsComposerItem::scaledFontPixelSize(const QFont& font) const
QFont QgsComposerItem::scaledFontPixelSize( const QFont& font ) const
{
QFont scaledFont = font;
double pixelSize = pixelFontSize(font.pointSizeF()) * FONT_WORKAROUND_SCALE + 0.5;
scaledFont.setPixelSize(pixelSize);
double pixelSize = pixelFontSize( font.pointSizeF() ) * FONT_WORKAROUND_SCALE + 0.5;
scaledFont.setPixelSize( pixelSize );
return scaledFont;
}

View File

@ -110,22 +110,22 @@ class CORE_EXPORT QgsComposerItem: public QGraphicsRectItem
/**Draws Text. Takes care about all the composer specific issues (calculation to pixel, scaling of font and painter
to work arount the Qt font bug)*/
void drawText(QPainter* p, int x, int y, const QString& text, const QFont& font) const;
void drawText( QPainter* p, int x, int y, const QString& text, const QFont& font ) const;
/**Like the above, but with a rectangle for multiline text*/
void drawText(QPainter* p, const QRectF& rect, const QString& text, const QFont& font) const;
void drawText( QPainter* p, const QRectF& rect, const QString& text, const QFont& font ) const;
/**Returns the font width in MM (considers upscaling and downscaling with FONT_WORKAROUND_SCALE*/
double textWidthMM(const QFont& font, const QString& text) const;
double textWidthMM( const QFont& font, const QString& text ) const;
/**Returns the font ascent in MM (considers upscaling and downscaling with FONT_WORKAROUND_SCALE*/
double fontAscentMM(const QFont& font) const;
double fontAscentMM( const QFont& font ) const;
/**Calculates font to from point size to pixel size*/
double pixelFontSize(double pointSize) const;
double pixelFontSize( double pointSize ) const;
/**Returns a font where size is in pixel and font size is upscaled with FONT_WORKAROUND_SCALE*/
QFont scaledFontPixelSize(const QFont& font) const;
QFont scaledFontPixelSize( const QFont& font ) const;
protected:

View File

@ -22,7 +22,7 @@
QgsComposerLabel::QgsComposerLabel( QgsComposition *composition ): QgsComposerItem( composition ), mMargin( 1.0 )
{
//default font size is 10 point
mFont.setPointSizeF(10);
mFont.setPointSizeF( 10 );
}
QgsComposerLabel::~QgsComposerLabel()
@ -45,9 +45,9 @@ void QgsComposerLabel::paint( QPainter* painter, const QStyleOptionGraphicsItem*
//support multiline labels
double penWidth = pen().widthF();
QRectF painterRect( penWidth + mMargin, penWidth + mMargin, rect().width() - 2 * penWidth - 2 * mMargin,
rect().height() - 2 * penWidth - 2 * mMargin);
rect().height() - 2 * penWidth - 2 * mMargin );
//painter->drawText( painterRect, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, mText );
drawText(painter, painterRect, mText, mFont);
drawText( painter, painterRect, mText, mFont );
drawFrame( painter );
if ( isSelected() )
@ -68,11 +68,11 @@ void QgsComposerLabel::setFont( const QFont& f )
void QgsComposerLabel::adjustSizeToText()
{
double textWidth = textWidthMM(mFont, mText);
double fontAscent = fontAscentMM(mFont);
double textWidth = textWidthMM( mFont, mText );
double fontAscent = fontAscentMM( mFont );
setSceneRect( QRectF( transform().dx(), transform().dy(), textWidth + 2 * mMargin + 2 * pen().widthF() + 1, \
fontAscent + 2 * mMargin + 2 * pen().widthF() + 1) );
fontAscent + 2 * mMargin + 2 * pen().widthF() + 1 ) );
}
QFont QgsComposerLabel::font() const

View File

@ -28,9 +28,9 @@ QgsComposerLegend::QgsComposerLegend( QgsComposition* composition ): QgsComposer
QStringList idList = layerIdList();
mLegendModel.setLayerSet( idList );
mTitleFont.setPointSizeF(14.0);
mLayerFont.setPointSizeF(12.0);
mItemFont.setPointSizeF(12.0);
mTitleFont.setPointSizeF( 14.0 );
mLayerFont.setPointSizeF( 12.0 );
mItemFont.setPointSizeF( 12.0 );
mSymbolWidth = 7;
mSymbolHeight = 4;
@ -83,13 +83,13 @@ QSizeF QgsComposerLegend::paintAndDetermineSize( QPainter* painter )
//font metrics
//draw title
currentYCoordinate += fontAscentMM(mTitleFont);
currentYCoordinate += fontAscentMM( mTitleFont );
if ( painter )
{
drawText(painter, mBoxSpace, currentYCoordinate, mTitle, mTitleFont);
drawText( painter, mBoxSpace, currentYCoordinate, mTitle, mTitleFont );
}
maxXCoord = 2 * mBoxSpace + textWidthMM(mTitleFont, mTitle);
maxXCoord = 2 * mBoxSpace + textWidthMM( mTitleFont, mTitle );
//draw layer items
for ( int i = 0; i < numLayerItems; ++i )
@ -98,15 +98,15 @@ QSizeF QgsComposerLegend::paintAndDetermineSize( QPainter* painter )
if ( currentLayerItem )
{
currentYCoordinate += mLayerSpace;
currentYCoordinate += fontAscentMM(mLayerFont);
currentYCoordinate += fontAscentMM( mLayerFont );
//draw layer Item
if ( painter )
{
drawText(painter, mBoxSpace, currentYCoordinate, currentLayerItem->text(), mLayerFont);
drawText( painter, mBoxSpace, currentYCoordinate, currentLayerItem->text(), mLayerFont );
}
maxXCoord = std::max( maxXCoord, 2 * mBoxSpace + textWidthMM(mLayerFont, currentLayerItem->text()));
maxXCoord = std::max( maxXCoord, 2 * mBoxSpace + textWidthMM( mLayerFont, currentLayerItem->text() ) );
//and child items
drawLayerChildItems( painter, currentLayerItem, currentYCoordinate, maxXCoord );
@ -149,7 +149,7 @@ void QgsComposerLegend::drawLayerChildItems( QPainter* p, QStandardItem* layerIt
}
//standerd item height
double itemHeight = std::max( mSymbolHeight, fontAscentMM(mItemFont));
double itemHeight = std::max( mSymbolHeight, fontAscentMM( mItemFont ) );
QStandardItem* currentItem;
@ -201,10 +201,10 @@ void QgsComposerLegend::drawLayerChildItems( QPainter* p, QStandardItem* layerIt
//finally draw text
if ( p )
{
drawText(p, currentXCoord, currentYCoord + fontAscentMM(mItemFont) + ( realItemHeight - fontAscentMM(mItemFont)) / 2, currentItem->text(), mItemFont);
drawText( p, currentXCoord, currentYCoord + fontAscentMM( mItemFont ) + ( realItemHeight - fontAscentMM( mItemFont ) ) / 2, currentItem->text(), mItemFont );
}
maxXCoord = std::max( maxXCoord, currentXCoord + textWidthMM(mItemFont, currentItem->text()) + mBoxSpace );
maxXCoord = std::max( maxXCoord, currentXCoord + textWidthMM( mItemFont, currentItem->text() ) + mBoxSpace );
currentYCoord += realItemHeight;
}

View File

@ -183,12 +183,12 @@ void QgsComposerMap::paint( QPainter* painter, const QStyleOptionGraphicsItem* i
if ( mComposition->plotStyle() == QgsComposition::Preview && mPreviewMode == Rectangle )
{
QFont messageFont("", 12);
painter->setFont(messageFont);
painter->setPen(QColor(0, 0, 0));
painter->drawText(thisPaintRect, tr("Map will be printed here"));
QFont messageFont( "", 12 );
painter->setFont( messageFont );
painter->setPen( QColor( 0, 0, 0 ) );
painter->drawText( thisPaintRect, tr( "Map will be printed here" ) );
}
else if ( mComposition->plotStyle() == QgsComposition::Preview)
else if ( mComposition->plotStyle() == QgsComposition::Preview )
{
//draw cached pixmap. This function does not call cache() any more because
//Qt 4.4.0 and 4.4.1 have problems with recursive paintings

View File

@ -50,7 +50,7 @@ void QgsComposerScaleBar::paint( QPainter* painter, const QStyleOptionGraphicsIt
//x-offset is half of first label width because labels are drawn centered
QString firstLabel = firstLabelString();
double firstLabelWidth = textWidthMM(mFont, firstLabel);
double firstLabelWidth = textWidthMM( mFont, firstLabel );
mStyle->draw( painter, firstLabelWidth / 2 );
@ -126,7 +126,7 @@ void QgsComposerScaleBar::applyDefaultSettings()
mBrush.setColor( QColor( 0, 0, 0 ) );
mBrush.setStyle( Qt::SolidPattern );
mFont.setPointSizeF(12.0);
mFont.setPointSizeF( 12.0 );
mLabelBarSpace = 3.0;
mBoxContentSpace = 1.0;
@ -321,7 +321,7 @@ bool QgsComposerScaleBar::readXML( const QDomElement& itemElem, const QDomDocume
mNumSegments = itemElem.attribute( "numSegments", "2" ).toInt();
mNumSegmentsLeft = itemElem.attribute( "numSegmentsLeft", "0" ).toInt();
mNumUnitsPerSegment = itemElem.attribute( "numUnitsPerSegment", "1.0" ).toDouble();
mSegmentMM = itemElem.attribute("segmentMM", "0.0").toDouble();
mSegmentMM = itemElem.attribute( "segmentMM", "0.0" ).toDouble();
mNumMapUnitsPerScaleBarUnit = itemElem.attribute( "numMapUnitsPerScaleBarUnit", "1.0" ).toDouble();
mPen.setWidthF( itemElem.attribute( "outlineWidth", "1.0" ).toDouble() );
mUnitLabeling = itemElem.attribute( "unitLabel" );

View File

@ -139,7 +139,7 @@ int QgsComposition::pixelFontSize( double pointSize ) const
{
//in QgsComposition, one unit = one mm
double sizeMM = pointSize * 0.3527;
return (sizeMM + 0.5); //round to nearest mm
return ( sizeMM + 0.5 ); //round to nearest mm
}
double QgsComposition::pointFontSize( int pixelSize ) const

View File

@ -45,7 +45,7 @@ void QgsDoubleBoxScaleBarStyle::draw( QPainter* p, double xOffset ) const
{
return;
}
double barTopPosition = mScaleBar->fontAscentMM(mScaleBar->font()) + mScaleBar->labelBarSpace() + mScaleBar->boxContentSpace();
double barTopPosition = mScaleBar->fontAscentMM( mScaleBar->font() ) + mScaleBar->labelBarSpace() + mScaleBar->boxContentSpace();
double segmentHeight = mScaleBar->height() / 2;
p->save();

View File

@ -174,8 +174,8 @@ int QgsLegendModel::addVectorLayerItems( QStandardItem* layerItem, QgsMapLayer*
currentSymbolItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
#endif //0
QStandardItem* currentSymbolItem = itemFromSymbol(*symbolIt);
if(!currentSymbolItem)
QStandardItem* currentSymbolItem = itemFromSymbol( *symbolIt );
if ( !currentSymbolItem )
{
continue;
}
@ -233,19 +233,19 @@ void QgsLegendModel::removeAllSymbols()
mSymbols.clear();
}
void QgsLegendModel::updateItem(QStandardItem* item)
void QgsLegendModel::updateItem( QStandardItem* item )
{
if(!item)
if ( !item )
{
return;
}
//is it a toplevel layer item?
QModelIndex itemIndex = indexFromItem(item);
QModelIndex itemIndex = indexFromItem( item );
QModelIndex parentIndex = itemIndex.parent();
if ( !parentIndex.isValid() ) // a layer item?
{
updateLayer(item);
updateLayer( item );
}
//take QgsSymbol* from user data
@ -259,40 +259,40 @@ void QgsLegendModel::updateItem(QStandardItem* item)
if ( symbol ) //vector classification item
{
updateVectorClassificationItem(item, symbol, item->text());
updateVectorClassificationItem( item, symbol, item->text() );
}
else if(!item->icon().isNull()) //raster classification item
else if ( !item->icon().isNull() ) //raster classification item
{
updateRasterClassificationItem(item);
updateRasterClassificationItem( item );
}
}
void QgsLegendModel::updateLayer(QStandardItem* layerItem)
void QgsLegendModel::updateLayer( QStandardItem* layerItem )
{
if(!layerItem)
if ( !layerItem )
{
return;
}
QString layerId = layerItem->data().toString();
QgsMapLayer* mapLayer = QgsMapLayerRegistry::instance()->mapLayer(layerId);
if(mapLayer)
QgsMapLayer* mapLayer = QgsMapLayerRegistry::instance()->mapLayer( layerId );
if ( mapLayer )
{
//delete all the entries under layer item
int currentRowCount = layerItem->rowCount();
for(int i = currentRowCount - 1; i >= 0; --i)
for ( int i = currentRowCount - 1; i >= 0; --i )
{
layerItem->removeRow(i);
layerItem->removeRow( i );
}
//and add the new ones...
switch(mapLayer->type())
switch ( mapLayer->type() )
{
case QgsMapLayer::VECTOR:
addVectorLayerItems(layerItem, mapLayer);
addVectorLayerItems( layerItem, mapLayer );
break;
case QgsMapLayer::RASTER:
addRasterLayerItem(layerItem, mapLayer);
addRasterLayerItem( layerItem, mapLayer );
break;
default:
break;
@ -300,7 +300,7 @@ void QgsLegendModel::updateLayer(QStandardItem* layerItem)
}
}
void QgsLegendModel::updateVectorClassificationItem(QStandardItem* classificationItem, QgsSymbol* symbol, QString itemText)
void QgsLegendModel::updateVectorClassificationItem( QStandardItem* classificationItem, QgsSymbol* symbol, QString itemText )
{
//this function uses the following logic to find a classification match:
//first test if there is a symbol where lowerbound - upperbound equels itemText
@ -309,25 +309,25 @@ void QgsLegendModel::updateVectorClassificationItem(QStandardItem* classificatio
//get parent item
QStandardItem* parentItem = classificationItem->parent();
if(!parentItem)
if ( !parentItem )
{
return;
}
//get maplayer object from parent item
QgsMapLayer* ml = QgsMapLayerRegistry::instance()->mapLayer(parentItem->data().toString());
if(!ml)
QgsMapLayer* ml = QgsMapLayerRegistry::instance()->mapLayer( parentItem->data().toString() );
if ( !ml )
{
return;
}
QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>(ml);
if(!vl)
QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( ml );
if ( !vl )
{
return;
}
const QgsRenderer* layerRenderer = vl->renderer();
if(!layerRenderer)
if ( !layerRenderer )
{
return;
}
@ -338,76 +338,76 @@ void QgsLegendModel::updateVectorClassificationItem(QStandardItem* classificatio
//try to find a symbol where lowerbound - upperbound matches item text
symbolIt = symbolList.begin();
for(; symbolIt != symbolList.end(); ++symbolIt)
for ( ; symbolIt != symbolList.end(); ++symbolIt )
{
currentSymbol = *symbolIt;
if(currentSymbol->lowerValue() + " - " + currentSymbol->upperValue() == itemText)
if ( currentSymbol->lowerValue() + " - " + currentSymbol->upperValue() == itemText )
{
removeSymbol(symbol);
parentItem->insertRow(classificationItem->row(), itemFromSymbol(currentSymbol));
parentItem->removeRow(classificationItem->row());
removeSymbol( symbol );
parentItem->insertRow( classificationItem->row(), itemFromSymbol( currentSymbol ) );
parentItem->removeRow( classificationItem->row() );
return;
}
}
//try to find a symbol where lower value matches item text (non-numeric classifications)
symbolIt = symbolList.begin();
for(; symbolIt != symbolList.end(); ++symbolIt)
for ( ; symbolIt != symbolList.end(); ++symbolIt )
{
currentSymbol = *symbolIt;
if(currentSymbol->lowerValue() == itemText)
if ( currentSymbol->lowerValue() == itemText )
{
removeSymbol(symbol);
parentItem->insertRow(classificationItem->row(), itemFromSymbol(currentSymbol));
parentItem->removeRow(classificationItem->row());
removeSymbol( symbol );
parentItem->insertRow( classificationItem->row(), itemFromSymbol( currentSymbol ) );
parentItem->removeRow( classificationItem->row() );
return;
}
}
//try to find a symbol where label matches item text
symbolIt = symbolList.begin();
for(; symbolIt != symbolList.end(); ++symbolIt)
for ( ; symbolIt != symbolList.end(); ++symbolIt )
{
currentSymbol = *symbolIt;
if(currentSymbol->label() == itemText)
if ( currentSymbol->label() == itemText )
{
removeSymbol(symbol);
parentItem->insertRow(classificationItem->row(), itemFromSymbol(currentSymbol));
parentItem->removeRow(classificationItem->row());
removeSymbol( symbol );
parentItem->insertRow( classificationItem->row(), itemFromSymbol( currentSymbol ) );
parentItem->removeRow( classificationItem->row() );
return;
}
}
}
void QgsLegendModel::updateRasterClassificationItem(QStandardItem* classificationItem)
void QgsLegendModel::updateRasterClassificationItem( QStandardItem* classificationItem )
{
if(!classificationItem)
if ( !classificationItem )
{
return;
}
QStandardItem* parentItem = classificationItem->parent();
if(!parentItem)
if ( !parentItem )
{
return;
}
QgsMapLayer* ml = QgsMapLayerRegistry::instance()->mapLayer(parentItem->data().toString());
if(!ml)
QgsMapLayer* ml = QgsMapLayerRegistry::instance()->mapLayer( parentItem->data().toString() );
if ( !ml )
{
return;
}
QgsRasterLayer* rl = dynamic_cast<QgsRasterLayer*>(ml);
if(!rl)
QgsRasterLayer* rl = dynamic_cast<QgsRasterLayer*>( ml );
if ( !rl )
{
return;
}
QStandardItem* currentSymbolItem = new QStandardItem( QIcon( rl->getLegendQPixmap( true ) ), "" );
parentItem->insertRow(0, currentSymbolItem);
parentItem->removeRow(1);
parentItem->insertRow( 0, currentSymbolItem );
parentItem->removeRow( 1 );
}
void QgsLegendModel::removeLayer( const QString& layerId )
@ -462,7 +462,7 @@ void QgsLegendModel::addLayer( QgsMapLayer* theMapLayer )
emit layersChanged();
}
QStandardItem* QgsLegendModel::itemFromSymbol(QgsSymbol* s)
QStandardItem* QgsLegendModel::itemFromSymbol( QgsSymbol* s )
{
QStandardItem* currentSymbolItem = 0;
@ -481,29 +481,29 @@ QStandardItem* QgsLegendModel::itemFromSymbol(QgsSymbol* s)
}
//icon item
switch (s->type())
switch ( s->type() )
{
case QGis::Point:
currentSymbolItem = new QStandardItem( QIcon( QPixmap::fromImage(s->getPointSymbolAsImage() ) ), label );
currentSymbolItem = new QStandardItem( QIcon( QPixmap::fromImage( s->getPointSymbolAsImage() ) ), label );
break;
case QGis::Line:
currentSymbolItem = new QStandardItem( QIcon( QPixmap::fromImage(s->getLineSymbolAsImage() ) ), label );
currentSymbolItem = new QStandardItem( QIcon( QPixmap::fromImage( s->getLineSymbolAsImage() ) ), label );
break;
case QGis::Polygon:
currentSymbolItem = new QStandardItem( QIcon( QPixmap::fromImage(s->getPolygonSymbolAsImage() ) ), label );
currentSymbolItem = new QStandardItem( QIcon( QPixmap::fromImage( s->getPolygonSymbolAsImage() ) ), label );
break;
default:
currentSymbolItem = 0;
break;
}
if(!currentSymbolItem)
if ( !currentSymbolItem )
{
return 0;
}
//Pass deep copy of QgsSymbol as user data. Cast to void* necessary such that QMetaType handles it
QgsSymbol* symbolCopy = new QgsSymbol(*s);
QgsSymbol* symbolCopy = new QgsSymbol( *s );
currentSymbolItem->setData( QVariant::fromValue(( void* )symbolCopy ) );
insertSymbol( symbolCopy );

View File

@ -42,12 +42,12 @@ class CORE_EXPORT QgsLegendModel: public QStandardItemModel
void setLayerSet( const QStringList& layerIds );
/**Tries to automatically update a model entry (e.g. a whole layer or only a single item)*/
void updateItem(QStandardItem* item);
void updateItem( QStandardItem* item );
/**Updates the whole symbology of a layer*/
void updateLayer(QStandardItem* layerItem);
void updateLayer( QStandardItem* layerItem );
/**Tries to update a single classification item*/
void updateVectorClassificationItem(QStandardItem* classificationItem, QgsSymbol* symbol, QString itemText);
void updateRasterClassificationItem(QStandardItem* classificationItem);
void updateVectorClassificationItem( QStandardItem* classificationItem, QgsSymbol* symbol, QString itemText );
void updateRasterClassificationItem( QStandardItem* classificationItem );
bool writeXML( QDomElement& composerLegendElem, QDomDocument& doc );
bool readXML( const QDomElement& legendModelElem, const QDomDocument& doc );
@ -76,7 +76,7 @@ class CORE_EXPORT QgsLegendModel: public QStandardItemModel
void removeAllSymbols();
/**Creates a model item for a vector symbol. The calling function takes ownership*/
QStandardItem* itemFromSymbol(QgsSymbol* s);
QStandardItem* itemFromSymbol( QgsSymbol* s );
/**Keep track of copied symbols to delete them if not used anymore*/
QSet<QgsSymbol*> mSymbols;

View File

@ -50,7 +50,7 @@ void QgsNumericScaleBarStyle::draw( QPainter* p, double xOffset ) const
p->save();
p->setFont( mScaleBar->font() );
mScaleBar->drawText(p, mScaleBar->pen().widthF() + mScaleBar->boxContentSpace(), mScaleBar->boxContentSpace() + mScaleBar->fontAscentMM(mScaleBar->font()), scaleText(), mScaleBar->font());
mScaleBar->drawText( p, mScaleBar->pen().widthF() + mScaleBar->boxContentSpace(), mScaleBar->boxContentSpace() + mScaleBar->fontAscentMM( mScaleBar->font() ), scaleText(), mScaleBar->font() );
p->restore();
}
@ -63,8 +63,8 @@ QRectF QgsNumericScaleBarStyle::calculateBoxSize() const
return rect;
}
double textWidth = mScaleBar->textWidthMM(mScaleBar->font(), scaleText());
double textHeight = mScaleBar->fontAscentMM(mScaleBar->font());
double textWidth = mScaleBar->textWidthMM( mScaleBar->font(), scaleText() );
double textHeight = mScaleBar->fontAscentMM( mScaleBar->font() );
return QRectF( mScaleBar->transform().dx(), mScaleBar->transform().dy(), 2 * mScaleBar->boxContentSpace()
+ 2 * mScaleBar->pen().width() + textWidth,

View File

@ -43,10 +43,10 @@ void QgsScaleBarStyle::drawLabels( QPainter* p ) const
p->save();
p->setFont(mScaleBar->font());
p->setFont( mScaleBar->font() );
QString firstLabel = mScaleBar->firstLabelString();
double xOffset = mScaleBar->textWidthMM(mScaleBar->font(), firstLabel) / 2;
double xOffset = mScaleBar->textWidthMM( mScaleBar->font(), firstLabel ) / 2;
//double mCurrentXCoord = mScaleBar->pen().widthF() + mScaleBar->boxContentSpace();
QList<QPair<double, double> > segmentInfo;
@ -78,7 +78,7 @@ void QgsScaleBarStyle::drawLabels( QPainter* p ) const
if ( segmentCounter == 0 || segmentCounter >= nSegmentsLeft ) //don't draw label for intermediate left segments
{
mScaleBar->drawText(p, segmentIt->first - mScaleBar->textWidthMM(mScaleBar->font(), currentNumericLabel) / 2 + xOffset, mScaleBar->fontAscentMM(mScaleBar->font()) + mScaleBar->boxContentSpace(), currentNumericLabel, mScaleBar->font());
mScaleBar->drawText( p, segmentIt->first - mScaleBar->textWidthMM( mScaleBar->font(), currentNumericLabel ) / 2 + xOffset, mScaleBar->fontAscentMM( mScaleBar->font() ) + mScaleBar->boxContentSpace(), currentNumericLabel, mScaleBar->font() );
}
if ( segmentCounter >= nSegmentsLeft )
@ -92,7 +92,7 @@ void QgsScaleBarStyle::drawLabels( QPainter* p ) const
if ( !segmentInfo.isEmpty() )
{
currentNumericLabel = QString::number( currentLabelNumber / mScaleBar->numMapUnitsPerScaleBarUnit() );
mScaleBar->drawText(p, segmentInfo.last().first + mScaleBar->segmentMM() - mScaleBar->textWidthMM(mScaleBar->font(), currentNumericLabel) / 2 + xOffset, mScaleBar->fontAscentMM(mScaleBar->font()) + mScaleBar->boxContentSpace(), currentNumericLabel + " " + mScaleBar->unitLabeling(), mScaleBar->font());
mScaleBar->drawText( p, segmentInfo.last().first + mScaleBar->segmentMM() - mScaleBar->textWidthMM( mScaleBar->font(), currentNumericLabel ) / 2 + xOffset, mScaleBar->fontAscentMM( mScaleBar->font() ) + mScaleBar->boxContentSpace(), currentNumericLabel + " " + mScaleBar->unitLabeling(), mScaleBar->font() );
}
p->restore();
@ -106,14 +106,14 @@ QRectF QgsScaleBarStyle::calculateBoxSize() const
}
//consider centered first label
double firstLabelLeft = mScaleBar->textWidthMM(mScaleBar->font(), mScaleBar->firstLabelString()) / 2;
double firstLabelLeft = mScaleBar->textWidthMM( mScaleBar->font(), mScaleBar->firstLabelString() ) / 2;
//consider last number and label
double largestLabelNumber = mScaleBar->numSegments() * mScaleBar->numUnitsPerSegment() / mScaleBar->numMapUnitsPerScaleBarUnit();
QString largestNumberLabel = QString::number( largestLabelNumber );
QString largestLabel = QString::number( largestLabelNumber ) + " " + mScaleBar->unitLabeling();
double largestLabelWidth = mScaleBar->textWidthMM(mScaleBar->font(), largestLabel) - mScaleBar->textWidthMM(mScaleBar->font(), largestNumberLabel) / 2;
double largestLabelWidth = mScaleBar->textWidthMM( mScaleBar->font(), largestLabel ) - mScaleBar->textWidthMM( mScaleBar->font(), largestNumberLabel ) / 2;
double totalBarLength = 0.0;
@ -127,7 +127,7 @@ QRectF QgsScaleBarStyle::calculateBoxSize() const
}
double width = firstLabelLeft + totalBarLength + 2 * mScaleBar->pen().widthF() + largestLabelWidth + 2 * mScaleBar->boxContentSpace();
double height = mScaleBar->height() + mScaleBar->labelBarSpace() + 2 * mScaleBar->boxContentSpace() + mScaleBar->fontAscentMM(mScaleBar->font());
double height = mScaleBar->height() + mScaleBar->labelBarSpace() + 2 * mScaleBar->boxContentSpace() + mScaleBar->fontAscentMM( mScaleBar->font() );
return QRectF( mScaleBar->transform().dx(), mScaleBar->transform().dy(), width, height );
}

View File

@ -40,7 +40,7 @@ void QgsSingleBoxScaleBarStyle::draw( QPainter* p, double xOffset ) const
{
return;
}
double barTopPosition = mScaleBar->fontAscentMM(mScaleBar->font()) + mScaleBar->labelBarSpace() + mScaleBar->boxContentSpace();
double barTopPosition = mScaleBar->fontAscentMM( mScaleBar->font() ) + mScaleBar->labelBarSpace() + mScaleBar->boxContentSpace();
p->save();
p->setPen( p->pen() );

View File

@ -53,7 +53,7 @@ void QgsTicksScaleBarStyle::draw( QPainter* p, double xOffset ) const
{
return;
}
double barTopPosition = mScaleBar->fontAscentMM(mScaleBar->font()) + mScaleBar->labelBarSpace() + mScaleBar->boxContentSpace();
double barTopPosition = mScaleBar->fontAscentMM( mScaleBar->font() ) + mScaleBar->labelBarSpace() + mScaleBar->boxContentSpace();
double middlePosition = barTopPosition + mScaleBar->height() / 2.0;
double bottomPosition = barTopPosition + mScaleBar->height();

View File

@ -33,7 +33,7 @@ bool QgsColorRampShader::generateShadedValue( double theValue, int* theReturnRed
{
//Get the shaded value from the cache if it exists already
QColor myColor = mColorCache.value(theValue);
QColor myColor = mColorCache.value( theValue );
if ( myColor.isValid() )
{
*theReturnRedValue = myColor.red();
@ -204,9 +204,9 @@ bool QgsColorRampShader::getInterpolatedColor( double theValue, int* theReturnRe
myCurrentRampRange = myColorRampItem.value - myPreviousColorRampItem.value;
myOffsetInRange = theValue - myPreviousColorRampItem.value;
*theReturnRedValue = ( int )(( double ) myPreviousColorRampItem.color.red() + ((( double ) (myColorRampItem.color.red() - myPreviousColorRampItem.color.red()) / myCurrentRampRange ) * myOffsetInRange ));
*theReturnGreenValue = ( int )(( double ) myPreviousColorRampItem.color.green() + ((( double ) (myColorRampItem.color.green() - myPreviousColorRampItem.color.green()) / myCurrentRampRange) * myOffsetInRange ));
*theReturnBlueValue = ( int )(( double ) myPreviousColorRampItem.color.blue() + ((( double ) (myColorRampItem.color.blue() - myPreviousColorRampItem.color.blue()) / myCurrentRampRange ) * myOffsetInRange));
*theReturnRedValue = ( int )(( double ) myPreviousColorRampItem.color.red() + ((( double )( myColorRampItem.color.red() - myPreviousColorRampItem.color.red() ) / myCurrentRampRange ) * myOffsetInRange ) );
*theReturnGreenValue = ( int )(( double ) myPreviousColorRampItem.color.green() + ((( double )( myColorRampItem.color.green() - myPreviousColorRampItem.color.green() ) / myCurrentRampRange ) * myOffsetInRange ) );
*theReturnBlueValue = ( int )(( double ) myPreviousColorRampItem.color.blue() + ((( double )( myColorRampItem.color.blue() - myPreviousColorRampItem.color.blue() ) / myCurrentRampRange ) * myOffsetInRange ) );
if ( mMaximumColorCacheSize >= mColorCache.size() )
{
QColor myNewColor( *theReturnRedValue, *theReturnGreenValue, *theReturnBlueValue );

View File

@ -76,7 +76,7 @@ class CORE_EXPORT QgsColorRampShader : public QgsRasterShaderFunction
void setColorRampType( QString );
/**Set the maximum size the color cache can be */
void setMaximumColorCacheSize(int theSize) { mMaximumColorCacheSize = theSize; }
void setMaximumColorCacheSize( int theSize ) { mMaximumColorCacheSize = theSize; }

View File

@ -522,7 +522,7 @@ bool QgsRasterLayer::readFile( QString const & fileName )
myRasterBandStats.statsGatheredFlag = false;
myRasterBandStats.histogramVector = new QgsRasterBandStats::HistogramVector();
//Store the default color table
readColorTable(i, &myRasterBandStats.colorTable);
readColorTable( i, &myRasterBandStats.colorTable );
mRasterStatsList.push_back( myRasterBandStats );
@ -566,7 +566,7 @@ bool QgsRasterLayer::readFile( QString const & fileName )
setColorShadingAlgorithm( COLOR_RAMP );
QgsColorRampShader* myColorRampShader = ( QgsColorRampShader* ) mRasterShader->getRasterShaderFunction();
myColorRampShader->setColorRampType( QgsColorRampShader::INTERPOLATED );
myColorRampShader->setColorRampItemList( *getColorTable(1) );
myColorRampShader->setColorRampItemList( *getColorTable( 1 ) );
}
else if ( rasterLayerType == MULTIBAND )
{
@ -883,23 +883,23 @@ void QgsRasterLayer::drawThumbnail( QPixmap * theQPixmap )
QPixmap QgsRasterLayer::getPaletteAsPixmap(int theBandNumber)
QPixmap QgsRasterLayer::getPaletteAsPixmap( int theBandNumber )
{
QgsDebugMsg( "entered." );
// Only do this for the non-provider (hard-coded GDAL) scenario...
// Maybe WMS can do this differently using QImage::numColors and QImage::color()
if (mProviderKey.isEmpty() && hasBand( "Palette" ) && theBandNumber > 0) //dont tr() this its a gdal word!
if ( mProviderKey.isEmpty() && hasBand( "Palette" ) && theBandNumber > 0 ) //dont tr() this its a gdal word!
{
QgsDebugMsg( "....found paletted image" );
QgsColorRampShader myShader;
QList<QgsColorRampShader::ColorRampItem> myColorRampItemList = myShader.getColorRampItemList();
if(readColorTable(1, &myColorRampItemList))
if ( readColorTable( 1, &myColorRampItemList ) )
{
QgsDebugMsg( "....got color ramp item list" );
myShader.setColorRampItemList(myColorRampItemList);
myShader.setColorRampType(QgsColorRampShader::DISCRETE);
myShader.setColorRampItemList( myColorRampItemList );
myShader.setColorRampType( QgsColorRampShader::DISCRETE );
// Draw image
int mySize = 100;
QPixmap myPalettePixmap( mySize, mySize );
@ -909,14 +909,14 @@ QPixmap QgsRasterLayer::getPaletteAsPixmap(int theBandNumber)
myQImage.fill( 0 );
myPalettePixmap.fill();
double myStep = ( (double)myColorRampItemList.size() - 1 ) / (double)( mySize * mySize );
double myStep = (( double )myColorRampItemList.size() - 1 ) / ( double )( mySize * mySize );
double myValue = 0.0;
for ( int myRow = 0; myRow < mySize; myRow++ )
{
for ( int myCol = 0; myCol < mySize; myCol++ )
{
myValue = myStep * (double)( myCol + myRow * mySize );
myValue = myStep * ( double )( myCol + myRow * mySize );
int c1, c2, c3;
myShader.generateShadedValue( myValue, &c1, &c2, &c3 );
myQImage.setPixel( myCol, myRow, qRgb( c1, c2, c3 ) );
@ -1247,7 +1247,7 @@ void QgsRasterLayer::draw( QPainter * theQPainter,
int myBandNo = 1;
drawPalettedSingleBandGray( theQPainter, theRasterViewPort,
theQgsMapToPixel, myBandNo);
theQgsMapToPixel, myBandNo );
break;
}
@ -1629,7 +1629,7 @@ void QgsRasterLayer::drawPalettedSingleBandColor( QPainter * theQPainter, QgsRas
* @param theColorQString - QString containing either 'Red' 'Green' or 'Blue' indicating which part of the rgb triplet will be used to render gray.
*/
void QgsRasterLayer::drawPalettedSingleBandGray( QPainter * theQPainter, QgsRasterViewPort * theRasterViewPort,
const QgsMapToPixel* theQgsMapToPixel, int theBandNo)
const QgsMapToPixel* theQgsMapToPixel, int theBandNo )
{
QgsDebugMsg( "entered." );
//Invalid band number, segfault prevention
@ -1692,14 +1692,14 @@ void QgsRasterLayer::drawPalettedSingleBandGray( QPainter * theQPainter, QgsRast
if ( mInvertPixelsFlag )
{
//Invert flag, flip blue and read
double myGrayValue = (0.3 * (double)myRedValue) + (0.59 * (double)myGreenValue) + (0.11 * (double)myBlueValue);
myQImage.setPixel( myRow, myColumn, qRgba( (int)myGrayValue, (int)myGrayValue, (int)myGrayValue, myAlphaValue ) );
double myGrayValue = ( 0.3 * ( double )myRedValue ) + ( 0.59 * ( double )myGreenValue ) + ( 0.11 * ( double )myBlueValue );
myQImage.setPixel( myRow, myColumn, qRgba(( int )myGrayValue, ( int )myGrayValue, ( int )myGrayValue, myAlphaValue ) );
}
else
{
//Normal
double myGrayValue = (0.3 * (double)myBlueValue) + (0.59 * (double)myGreenValue) + (0.11 * (double)myRedValue);
myQImage.setPixel( myRow, myColumn, qRgba( (int)myGrayValue, (int)myGrayValue, (int)myGrayValue, myAlphaValue ) );
double myGrayValue = ( 0.3 * ( double )myBlueValue ) + ( 0.59 * ( double )myGreenValue ) + ( 0.11 * ( double )myRedValue );
myQImage.setPixel( myRow, myColumn, qRgba(( int )myGrayValue, ( int )myGrayValue, ( int )myGrayValue, myAlphaValue ) );
}
}
}

View File

@ -275,7 +275,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
void drawThumbnail( QPixmap * theQPixmap );
/** \brief Get an 8x8 pixmap of the color palette. If the layer has no palette a white pixmap will be returned. */
QPixmap getPaletteAsPixmap(int theBand=1);
QPixmap getPaletteAsPixmap( int theBand = 1 );
/** \brief This is called when the view on the raster layer needs to be refreshed (redrawn).
*/
@ -946,7 +946,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
void drawPalettedSingleBandGray( QPainter * theQPainter,
QgsRasterViewPort * theRasterViewPort,
const QgsMapToPixel* theQgsMapToPixel,
int theBandNoInt);
int theBandNoInt );
/** \brief Drawing routine for paletted image, rendered as a single band image in pseudocolor. */
void drawPalettedSingleBandPseudoColor( QPainter * theQPainter,

View File

@ -142,11 +142,11 @@ void QgsGraduatedSymbolRenderer::renderFeature( QPainter * p, QgsFeature & f, QI
pen.setWidthF( widthScale * pen.widthF() );
p->setPen( pen );
if(mVectorType == QGis::Polygon)
if ( mVectorType == QGis::Polygon )
{
QBrush brush = theSymbol->brush();
scaleBrush(brush, rasterScaleFactor); //scale brush content for printout
p->setBrush(brush);
scaleBrush( brush, rasterScaleFactor ); //scale brush content for printout
p->setBrush( brush );
}
}
else
@ -156,10 +156,10 @@ void QgsGraduatedSymbolRenderer::renderFeature( QPainter * p, QgsFeature & f, QI
pen.setWidthF( widthScale * pen.widthF() );
p->setPen( pen );
if(mVectorType == QGis::Polygon)
if ( mVectorType == QGis::Polygon )
{
QBrush brush = theSymbol->brush();
scaleBrush(brush, rasterScaleFactor); //scale brush content for printout
scaleBrush( brush, rasterScaleFactor ); //scale brush content for printout
brush.setColor( mSelectionColor );
p->setBrush( brush );
}

View File

@ -51,12 +51,12 @@ bool QgsRenderer::containsPixmap() const
}
}
void QgsRenderer::scaleBrush(QBrush& b, double rasterScaleFactor) const
void QgsRenderer::scaleBrush( QBrush& b, double rasterScaleFactor ) const
{
if(rasterScaleFactor != 1.0)
if ( rasterScaleFactor != 1.0 )
{
QMatrix m;
m.scale(1.0 / rasterScaleFactor, 1.0 / rasterScaleFactor);
b.setMatrix(m);
m.scale( 1.0 / rasterScaleFactor, 1.0 / rasterScaleFactor );
b.setMatrix( m );
}
}

View File

@ -96,7 +96,7 @@ class CORE_EXPORT QgsRenderer
QGis::VectorType mVectorType;
/**Scales a brush to a given raster scale factor (e.g. for printing)*/
void scaleBrush(QBrush& b, double rasterScaleFactor) const;
void scaleBrush( QBrush& b, double rasterScaleFactor ) const;
};
#endif // QGSRENDERER_H

View File

@ -126,11 +126,11 @@ void QgsSingleSymbolRenderer::renderFeature( QPainter * p, QgsFeature & f, QImag
pen.setWidthF( widthScale * pen.widthF() );
p->setPen( pen );
if(mVectorType == QGis::Polygon)
if ( mVectorType == QGis::Polygon )
{
QBrush brush = mSymbol->brush();
scaleBrush(brush, rasterScaleFactor); //scale brush content for printout
p->setBrush(brush);
scaleBrush( brush, rasterScaleFactor ); //scale brush content for printout
p->setBrush( brush );
}
}
else
@ -142,10 +142,10 @@ void QgsSingleSymbolRenderer::renderFeature( QPainter * p, QgsFeature & f, QImag
pen.setColor( mSelectionColor );
p->setPen( pen );
if(mVectorType == QGis::Polygon)
if ( mVectorType == QGis::Polygon )
{
QBrush brush = mSymbol->brush();
scaleBrush(brush, rasterScaleFactor); //scale brush content for printout
scaleBrush( brush, rasterScaleFactor ); //scale brush content for printout
brush.setColor( mSelectionColor );
p->setBrush( brush );
}

View File

@ -150,11 +150,11 @@ void QgsUniqueValueRenderer::renderFeature( QPainter* p, QgsFeature& f, QImage*
QPen pen = symbol->pen();
pen.setWidthF( widthScale * pen.widthF() );
p->setPen( pen );
if(mVectorType == QGis::Polygon)
if ( mVectorType == QGis::Polygon )
{
QBrush brush = symbol->brush();
scaleBrush(brush, rasterScaleFactor); //scale brush content for printout
p->setBrush(brush);
scaleBrush( brush, rasterScaleFactor ); //scale brush content for printout
p->setBrush( brush );
}
}
else
@ -163,10 +163,10 @@ void QgsUniqueValueRenderer::renderFeature( QPainter* p, QgsFeature& f, QImage*
pen.setWidthF( widthScale * pen.widthF() );
pen.setColor( mSelectionColor );
p->setPen( pen );
if(mVectorType == QGis::Polygon)
if ( mVectorType == QGis::Polygon )
{
QBrush brush = symbol->brush();
scaleBrush(brush, rasterScaleFactor); //scale brush content for printout
scaleBrush( brush, rasterScaleFactor ); //scale brush content for printout
brush.setColor( mSelectionColor );
p->setBrush( brush );
}

View File

@ -454,16 +454,16 @@ QString GRASS_EXPORT QgsGrass::openMapset( QString gisdbase, QString location, Q
QFile lockFile( lock );
#if WIN32
// lock on Windows doesn't support locking (see #808)
if( lockFile.exists() )
if ( lockFile.exists() )
return QObject::tr( "Mapset is already in use." );
lockFile.open(QIODevice::WriteOnly);
lockFile.open( QIODevice::WriteOnly );
#ifndef _MSC_VER
int pid = getpid();
#else
int pid = GetCurrentProcessId();
#endif
lockFile.write( QString("%1").arg( pid ).toLocal8Bit() );
lockFile.write( QString( "%1" ).arg( pid ).toLocal8Bit() );
lockFile.close();
#else
Q3Process *process = new Q3Process();

View File

@ -69,38 +69,38 @@ void TestContrastEnhancements::clipMinMaxEnhancementTest()
{
//Clips 0 < x < 10, 240 < X < 256
//Stretch no stretch is applied
QgsClipToMinMaxEnhancement myEnhancement(QgsContrastEnhancement::QGS_Byte, 10.0, 240.0);
QgsClipToMinMaxEnhancement myEnhancement( QgsContrastEnhancement::QGS_Byte, 10.0, 240.0 );
// Original pixel value 0.0 Should be out of range thus clipped
QVERIFY(!myEnhancement.isValueInDisplayableRange(0.0));
QVERIFY( !myEnhancement.isValueInDisplayableRange( 0.0 ) );
//Original pixel value of 10.0 should be scaled to 10.0
QVERIFY(10.0 == myEnhancement.enhanceValue(10.0)) ;
QVERIFY( 10.0 == myEnhancement.enhanceValue( 10.0 ) ) ;
//Original pixel value of 240 should be scaled to 240
QVERIFY(240.0 == myEnhancement.enhanceValue(240.0)) ;
QVERIFY( 240.0 == myEnhancement.enhanceValue( 240.0 ) ) ;
}
void TestContrastEnhancements::linearMinMaxEnhancementWithClipTest()
{
//First clips 0 < x < 10, 240 < X < 256
//Then stretch 10 = 0, 240 = 255 linearly distribute values 10 -> 240 between 0 -> 255
QgsLinearMinMaxEnhancementWithClip myEnhancement(QgsContrastEnhancement::QGS_Byte, 10.0, 240.0);
QgsLinearMinMaxEnhancementWithClip myEnhancement( QgsContrastEnhancement::QGS_Byte, 10.0, 240.0 );
// Original pixel value 0.0 Should be out of range thus clipped
QVERIFY(!myEnhancement.isValueInDisplayableRange(0.0));
QVERIFY( !myEnhancement.isValueInDisplayableRange( 0.0 ) );
//Original pixel value of 10.0 should be scaled to 0.0
QVERIFY(0.0 == myEnhancement.enhanceValue(10.0)) ;
QVERIFY( 0.0 == myEnhancement.enhanceValue( 10.0 ) ) ;
//Original pixel value of 240 should be scaled to 255
QVERIFY(255.0 == myEnhancement.enhanceValue(240.0)) ;
QVERIFY( 255.0 == myEnhancement.enhanceValue( 240.0 ) ) ;
}
void TestContrastEnhancements::linearMinMaxEnhancementTest()
{
//Stretch 10 = 0, 240 = 255 linearly distribute values 10 -> 240 between 0 -> 255
QgsLinearMinMaxEnhancement myEnhancement(QgsContrastEnhancement::QGS_Byte, 10.0, 240.0);
QgsLinearMinMaxEnhancement myEnhancement( QgsContrastEnhancement::QGS_Byte, 10.0, 240.0 );
//0 should be scaled to 10 and not clipped
QVERIFY(myEnhancement.isValueInDisplayableRange(0.0));
QVERIFY( myEnhancement.isValueInDisplayableRange( 0.0 ) );
//Original pixel value of 10.0 should be scaled to 0.0
QVERIFY(0.0 == myEnhancement.enhanceValue(10.0)) ;
QVERIFY( 0.0 == myEnhancement.enhanceValue( 10.0 ) ) ;
//Original pixel value of 240 should be scaled to 255
QVERIFY(255.0 == myEnhancement.enhanceValue(240.0)) ;
QVERIFY( 255.0 == myEnhancement.enhanceValue( 240.0 ) ) ;
}
QTEST_MAIN( TestContrastEnhancements )
#include "moc_testcontrastenhancements.cxx"

View File

@ -37,19 +37,19 @@ email : sherman at mrcc.com
// constructor
QgsMapserverExport::QgsMapserverExport(QWidget * parent, Qt::WFlags fl)
: QDialog(parent, fl)
QgsMapserverExport::QgsMapserverExport( QWidget * parent, Qt::WFlags fl )
: QDialog( parent, fl )
{
setupUi(this);
connect(this, SIGNAL(accepted()), this, SLOT(apply()));
setupUi( this );
connect( this, SIGNAL( accepted() ), this, SLOT( apply() ) );
// drag and drop filter
txtQgisFilePath->setSuffixFilter("qgs");
txtQgisFilePath->setSuffixFilter( "qgs" );
// initialize python
initPy();
qDebug("Reading settings");
qDebug( "Reading settings" );
QSettings mySettings;
txtMapFilePath->setText(mySettings.value("mapserverExport/lastMapFile","").toString());
txtQgisFilePath->setText(mySettings.value("mapserverExport/lastQgsFile","").toString());
txtMapFilePath->setText( mySettings.value( "mapserverExport/lastMapFile", "" ).toString() );
txtQgisFilePath->setText( mySettings.value( "mapserverExport/lastQgsFile", "" ).toString() );
}
@ -65,122 +65,126 @@ QgsMapserverExport::~QgsMapserverExport()
// Get the base name for the map file
QString QgsMapserverExport::baseName()
{
QFileInfo fi(txtMapFilePath->text());
return fi.baseName(true);
QFileInfo fi( txtMapFilePath->text() );
return fi.baseName( true );
}
/** Auto-connected slots are here **/
// Choose the map file to create
void QgsMapserverExport::on_btnChooseFile_clicked()
{
mapFile = QFileDialog::getSaveFileName(this, tr("Name for the map file"),
".", tr("MapServer map files (*.map);;All files (*.*)","Filter list for selecting files from a dialog box"));
txtMapFilePath->setText(mapFile);
mapFile = QFileDialog::getSaveFileName( this, tr( "Name for the map file" ),
".", tr( "MapServer map files (*.map);;All files (*.*)", "Filter list for selecting files from a dialog box" ) );
txtMapFilePath->setText( mapFile );
}
// Chooose the project file to process
void QgsMapserverExport::on_btnChooseProjectFile_clicked()
{
qgisProjectFile = QFileDialog::getOpenFileName(this, tr("Choose the QGIS project file"),
".", tr("QGIS Project Files (*.qgs);;All files (*.*)", "Filter list for selecting files from a dialog box"));
txtQgisFilePath->setText(qgisProjectFile);
qgisProjectFile = QFileDialog::getOpenFileName( this, tr( "Choose the QGIS project file" ),
".", tr( "QGIS Project Files (*.qgs);;All files (*.*)", "Filter list for selecting files from a dialog box" ) );
txtQgisFilePath->setText( qgisProjectFile );
}
// Toggle controls based on the "layer only" checkbox
void QgsMapserverExport::on_chkExpLayersOnly_clicked(bool isChecked)
void QgsMapserverExport::on_chkExpLayersOnly_clicked( bool isChecked )
{
// disable other sections if only layer export is desired
txtMapName->setEnabled(!isChecked);
txtMapWidth->setEnabled(!isChecked);
txtMapHeight->setEnabled(!isChecked);
cmbMapUnits->setEnabled(!isChecked);
cmbMapImageType->setEnabled(!isChecked);
txtMapName->setEnabled( !isChecked );
txtMapWidth->setEnabled( !isChecked );
txtMapHeight->setEnabled( !isChecked );
cmbMapUnits->setEnabled( !isChecked );
cmbMapImageType->setEnabled( !isChecked );
//txtMinScale->setEnabled(!isChecked);
//txtMaxScale->setEnabled(!isChecked);
txtWebTemplate->setEnabled(!isChecked);
txtWebHeader->setEnabled(!isChecked);
txtWebFooter->setEnabled(!isChecked);
btnChooseFooterFile->setEnabled(!isChecked);
btnChooseHeaderFile->setEnabled(!isChecked);
btnChooseTemplateFile->setEnabled(!isChecked);
txtWebTemplate->setEnabled( !isChecked );
txtWebHeader->setEnabled( !isChecked );
txtWebFooter->setEnabled( !isChecked );
btnChooseFooterFile->setEnabled( !isChecked );
btnChooseHeaderFile->setEnabled( !isChecked );
btnChooseTemplateFile->setEnabled( !isChecked );
}
void QgsMapserverExport::apply()
{
qDebug("Writing settings");
qDebug( "Writing settings" );
QSettings mySettings;
mySettings.setValue("mapserverExport/lastMapFile",txtMapFilePath->text());
mySettings.setValue("mapserverExport/lastQgsFile",txtQgisFilePath->text());
mySettings.setValue( "mapserverExport/lastMapFile", txtMapFilePath->text() );
mySettings.setValue( "mapserverExport/lastQgsFile", txtQgisFilePath->text() );
char *cstr;
PyObject *pstr, *pmod, *pclass, *pinst, *pmeth, *pargs;
//TODO Need to append the path to the qgis python files using the path to the
// Python files in the QGIS install directory
PyRun_SimpleString("import sys");
PyRun_SimpleString( "import sys" );
// Setup up path to the python script directory
QString scriptDir = QgsApplication::pkgDataPath() + QDir::separator() + "python";
qDebug("Python scripts directory: " + scriptDir.toLocal8Bit());
qDebug( "Python scripts directory: " + scriptDir.toLocal8Bit() );
//QString curdir = "/home/gsherman/development/qgis_qt_port/tools/mapserver_export";
QString sysCmd = QString("sys.path.append('%1')").arg(scriptDir);
PyRun_SimpleString(sysCmd.ascii());
QString sysCmd = QString( "sys.path.append('%1')" ).arg( scriptDir );
PyRun_SimpleString( sysCmd.ascii() );
// Import the module
std::cout << "Importing module" << std::endl;
pmod = PyImport_ImportModule("ms_export");
if(!pmod) {
QMessageBox::warning(this, "Map Export Error", "ms_export python module not found");
pmod = PyImport_ImportModule( "ms_export" );
if ( !pmod )
{
QMessageBox::warning( this, "Map Export Error", "ms_export python module not found" );
return;
}
std::cout << "Getting Qgis2Map constructor as python obj" << std::endl;
pclass = PyObject_GetAttrString(pmod, "Qgis2Map");
Py_DECREF(pmod);
pclass = PyObject_GetAttrString( pmod, "Qgis2Map" );
Py_DECREF( pmod );
std::cout << "Creating args to pass to the constructor" << std::endl;
pargs = Py_BuildValue("(ss)", txtQgisFilePath->text().ascii(),txtMapFilePath->text().ascii());
pargs = Py_BuildValue( "(ss)", txtQgisFilePath->text().ascii(), txtMapFilePath->text().ascii() );
//XXX for testing: pargs = Py_BuildValue("(ss)", "foo", "bar");
pinst = PyEval_CallObject(pclass, pargs);
pinst = PyEval_CallObject( pclass, pargs );
Py_DECREF(pclass);
Py_DECREF(pargs);
Py_DECREF( pclass );
Py_DECREF( pargs );
// Set the various options for the conversion only if we are doing a full
// export (ie more than just layer info)
if(!chkExpLayersOnly->isChecked())
if ( !chkExpLayersOnly->isChecked() )
{
std::cout << "Initializing all options" << std::endl;
pmeth = PyObject_GetAttrString(pinst, "setOptions");
pargs = Py_BuildValue("(ssssssss)",
pmeth = PyObject_GetAttrString( pinst, "setOptions" );
pargs = Py_BuildValue( "(ssssssss)",
cmbMapUnits->currentText().ascii(), cmbMapImageType->currentText().ascii(),
txtMapName->text().ascii(), txtMapWidth->text().ascii(), txtMapHeight->text().ascii(),
txtWebTemplate->text().ascii(), txtWebFooter->text().ascii(),txtWebHeader->text().ascii());
pstr = PyEval_CallObject(pmeth, pargs);
txtWebTemplate->text().ascii(), txtWebFooter->text().ascii(), txtWebHeader->text().ascii() );
pstr = PyEval_CallObject( pmeth, pargs );
Py_DECREF(pargs);
Py_DECREF(pmeth);
Py_DECREF( pargs );
Py_DECREF( pmeth );
}
// Get the writeMapFile method from the Qgis2Map class
pmeth = PyObject_GetAttrString(pinst, "writeMapFile");
pargs = Py_BuildValue("()");
pmeth = PyObject_GetAttrString( pinst, "writeMapFile" );
pargs = Py_BuildValue( "()" );
// Execute the writeMapFile method to parse the QGIS project file and create the .map file
pstr = PyEval_CallObject(pmeth, pargs);
if(pstr) {
pstr = PyEval_CallObject( pmeth, pargs );
if ( pstr )
{
// Show the return value
PyArg_Parse(pstr, "s", &cstr);
PyArg_Parse( pstr, "s", &cstr );
std::cout << "Result: " << std::endl << cstr << std::endl;
// Show the results to the user
QMessageBox::information(this, "Results of Export", QString(cstr));
Py_DECREF(pstr);
} else {
QMessageBox::warning(this, "Mapfile Export Error", "method call failed");
QMessageBox::information( this, "Results of Export", QString( cstr ) );
Py_DECREF( pstr );
}
else
{
QMessageBox::warning( this, "Mapfile Export Error", "method call failed" );
}
}
void QgsMapserverExport::on_buttonBox_helpRequested()
{
QgsContextHelp::run(context_id);
QgsContextHelp::run( context_id );
}
/** End of Auto-connected Slots **/
@ -192,26 +196,27 @@ bool QgsMapserverExport::write()
//QMessageBox::information(0,"Full Path",fullPath);
QMessageBox::StandardButton okToSave = QMessageBox::Ok;
// Check for file and prompt for overwrite if it exists
if (QFile::exists(txtMapFilePath->text()))
if ( QFile::exists( txtMapFilePath->text() ) )
{
okToSave = QMessageBox::warning(0, tr("Overwrite File?"), txtMapFilePath->text() +
tr(" exists. \nDo you want to overwrite it?",
"a fileName is prepended to this text, and appears in a dialog box"),
QMessageBox::Ok | QMessageBox::Cancel);
okToSave = QMessageBox::warning( 0, tr( "Overwrite File?" ), txtMapFilePath->text() +
tr( " exists. \nDo you want to overwrite it?",
"a fileName is prepended to this text, and appears in a dialog box" ),
QMessageBox::Ok | QMessageBox::Cancel );
}
if (okToSave == QMessageBox::Ok)
if ( okToSave == QMessageBox::Ok )
{
// write the project information to the selected file
writeMapFile();
return true;
} else
}
else
{
return false;
}
}
void QgsMapserverExport::setFileName(QString fn)
void QgsMapserverExport::setFileName( QString fn )
{
//fullPath = fn;
}
@ -226,9 +231,9 @@ void QgsMapserverExport::writeMapFile()
{
/*
// write the map file, making massive assumptions about default values
#ifdef QGISDEBUG
#ifdef QGISDEBUG
std::cout << "Opening map file " << txtMapFilePath->text().toLocal8Bit().data() << std::endl;
#endif
#endif
std::ofstream mapFile(txtMapFilePath->text().toLocal8Bit().data());
if (!mapFile.fail())
{
@ -318,9 +323,9 @@ void QgsMapserverExport::writeMapFile()
bool isPolygon = false;
bool isLine = false;
QgsMapLayer *lyr = map->getZpos(i);
#ifdef QGISDEBUG
#ifdef QGISDEBUG
std::cout << "Mapsrver Export Processing Layer" << std::endl;
#endif
#endif
mapFile << "LAYER" << std::endl;
QString name = lyr->name().lower();
// MapServer NAME must be < 20 char and unique
@ -330,9 +335,9 @@ void QgsMapserverExport::writeMapFile()
name.replace(QRegExp("\\)"), "_");
mapFile << " NAME " << name.toLocal8Bit().data() << std::endl;
// feature type
#ifdef QGISDEBUG
#ifdef QGISDEBUG
std::cout << "\tMapsrver Export checking feature type" << std::endl;
#endif
#endif
mapFile << " TYPE ";
switch (lyr->featureType())
{
@ -358,9 +363,9 @@ void QgsMapserverExport::writeMapFile()
}
mapFile << std::endl;
#ifdef QGISDEBUG
#ifdef QGISDEBUG
std::cout << "\tMapsrver Export checking visibility" << std::endl;
#endif
#endif
// set visibility (STATUS)
mapFile << " STATUS ";
if (lyr->isVisible())
@ -374,9 +379,9 @@ void QgsMapserverExport::writeMapFile()
// data source (DATA)
// Data source spec depends on layer type
#ifdef QGISDEBUG
#ifdef QGISDEBUG
std::cout << "\tMapsrver Export checking layer type" << std::endl;
#endif
#endif
switch (lyr->type())
{
case QgsMapLayer::VECTOR:
@ -419,25 +424,25 @@ void QgsMapserverExport::writeMapFile()
break;
}
#ifdef QGISDEBUG
#ifdef QGISDEBUG
std::cout << "\tMapsrver Export creating symbol entries" << std::endl;
#endif
#endif
// create a simple class entry based on red fill color and black outline color
//TODO: adapt the following section to the new symbology
mapFile << " CLASS" << std::endl;
//QListViewItem *li = map->getLegend()->currentItem();
// return li->text(0);
#ifdef QGISDEBUG
#ifdef QGISDEBUG
std::cout << "\tMapsrver Export symbol name" << std::endl;
#endif
#endif
mapFile << " NAME \"" << lyr->name().toLocal8Bit().data() << "\"" << std::endl;
mapFile << " # TEMPLATE" << std::endl;
if (isPolygon)
{
#ifdef QGISDEBUG
#ifdef QGISDEBUG
std::cout << "\tMapsrver Export symbol fill color" << std::endl;
#endif
#endif
// use random fill colors
// TODO Get fill color from the renderer
// TODO Figure out what to do for layers that are
@ -449,9 +454,9 @@ void QgsMapserverExport::writeMapFile()
mapFile << " COLOR " << red << " " << green << " " << blue << std::endl;
}
#ifdef QGISDEBUG
#ifdef QGISDEBUG
std::cout << "\tMapsrver Export checking for line symbol " << std::endl;
#endif
#endif
if (isPolygon || isLine)
{
// use line color
@ -464,9 +469,9 @@ void QgsMapserverExport::writeMapFile()
}
mapFile << " END" << std::endl;
mapFile << "END" << std::endl;
#ifdef QGISDEBUG
#ifdef QGISDEBUG
std::cout << "\tMapsrver Export layer definition done..." << std::endl;
#endif
#endif
}
if (!chkExpLayersOnly->isChecked())
{
@ -477,7 +482,7 @@ void QgsMapserverExport::writeMapFile()
} else
{
}
*/
*/
}
void QgsMapserverExport::showHelp()
{
@ -494,6 +499,6 @@ void QgsMapserverExport::initPy()
// init the python interpreter
Py_Initialize();
// spit something to stdout
PyRun_SimpleString("print '>>>>>>>>>>>>>>>>>>> Python initialized <<<<<<<<<<<<<<<<<<<'");
PyRun_SimpleString( "print '>>>>>>>>>>>>>>>>>>> Python initialized <<<<<<<<<<<<<<<<<<<'" );
}