Skip to content
Permalink
Browse files

indentation update

  • Loading branch information
jef-n committed Jan 9, 2014
1 parent 1b02969 commit 129bd987d5f3265a66a0cb0d4de8f014a959f87f
@@ -185,7 +185,7 @@ def getExtendedLayerName(self, layer):
return layer.name()

def getWidgetFromParameter(self, param):
# TODO Create Parameter widget class that holds the logic
# TODO Create Parameter widget class that holds the logic
# for creating a widget that belongs to the parameter.
if isinstance(param, ParameterRaster):
layers = dataobjects.getRasterLayers()
@@ -723,7 +723,8 @@ void QgsMapToolNodeTool::keyPressEvent( QKeyEvent* e )
if ( mSelectedFeature && ( e->key() == Qt::Key_Backspace || e->key() == Qt::Key_Delete ) )
{
int firstSelectedIndex = firstSelectedVertex();
if ( firstSelectedIndex == -1 ) return;
if ( firstSelectedIndex == -1 )
return;

mSelectedFeature->deleteSelectedVertexes();
safeSelectVertex( firstSelectedIndex );
@@ -732,21 +733,21 @@ void QgsMapToolNodeTool::keyPressEvent( QKeyEvent* e )
// Override default shortcut management in MapCanvas
e->ignore();
}
else
if ( mSelectedFeature && ( e->key() == Qt::Key_Less || e->key() == Qt::Key_Comma ) )
else if ( mSelectedFeature && ( e->key() == Qt::Key_Less || e->key() == Qt::Key_Comma ) )
{
int firstSelectedIndex = firstSelectedVertex();
if ( firstSelectedIndex == -1) return;
if ( firstSelectedIndex == -1 )
return;

mSelectedFeature->deselectAllVertexes();
safeSelectVertex( firstSelectedIndex - 1 );
mCanvas->refresh();
}
else
if ( mSelectedFeature && ( e->key() == Qt::Key_Greater || e->key() == Qt::Key_Period ) )
else if ( mSelectedFeature && ( e->key() == Qt::Key_Greater || e->key() == Qt::Key_Period ) )
{
int firstSelectedIndex = firstSelectedVertex();
if ( firstSelectedIndex == -1) return;
if ( firstSelectedIndex == -1 )
return;

mSelectedFeature->deselectAllVertexes();
safeSelectVertex( firstSelectedIndex + 1 );
@@ -161,19 +161,19 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap<QString, QVariant>& opts )

if ( sidebar )
{
QString style = "QListWidget#mOptionsListWidget {"
"background-color: rgb(69, 69, 69, 220);"
"}"
"QListWidget#mOptionsListWidget::item {"
" color: white;"
" padding: 3px;"
"}"
"QListWidget#mOptionsListWidget::item::selected {"
" color: black;"
" background-color:palette(Window);"
" padding-right: 0px; "
"}";
ss += style;
QString style = "QListWidget#mOptionsListWidget {"
"background-color: rgb(69, 69, 69, 220);"
"}"
"QListWidget#mOptionsListWidget::item {"
" color: white;"
" padding: 3px;"
"}"
"QListWidget#mOptionsListWidget::item::selected {"
" color: black;"
" background-color:palette(Window);"
" padding-right: 0px; "
"}";
ss += style;
}

//fix background issue for gnome desktop
@@ -1058,10 +1058,11 @@ void QgsProjectProperties::on_pbnWMSAddSRS_clicked()
{
QgsGenericProjectionSelector *mySelector = new QgsGenericProjectionSelector( this );
mySelector->setMessage();
if ( mWMSList->count() > 0 ) {
mySelector->setSelectedAuthId( mWMSList->item( mWMSList->count()-1 )->text() );
if ( mWMSList->count() > 0 )
{
mySelector->setSelectedAuthId( mWMSList->item( mWMSList->count() - 1 )->text() );
}
if ( mySelector->exec() && mySelector->selectedCrsId()!=0 )
if ( mySelector->exec() && mySelector->selectedCrsId() != 0 )
{
QString authid = mySelector->selectedAuthId();

@@ -2517,7 +2517,7 @@ bool QgsVectorLayer::changeGeometry( QgsFeatureId fid, QgsGeometry* geom )
bool QgsVectorLayer::changeAttributeValue( QgsFeatureId fid, int field, QVariant value, bool emitSignal )
{
Q_UNUSED( emitSignal );
return changeAttributeValue ( fid, field, value );
return changeAttributeValue( fid, field, value );
}

bool QgsVectorLayer::changeAttributeValue( QgsFeatureId fid, int field, QVariant value )
@@ -55,11 +55,11 @@ void QgsOptionsDialogBase::initOptionsBase( bool restoreUi )

// start with copy of qgsoptionsdialog_template.ui to ensure existence of these objects
mOptListWidget = findChild<QListWidget*>( "mOptionsListWidget" );
QFrame* optionsFrame = findChild<QFrame*>("mOptionsFrame");
QFrame* optionsFrame = findChild<QFrame*>( "mOptionsFrame" );
mOptStackedWidget = findChild<QStackedWidget*>( "mOptionsStackedWidget" );
mOptSplitter = findChild<QSplitter*>( "mOptionsSplitter" );
mOptButtonBox = findChild<QDialogButtonBox*>( "buttonBox" );
QFrame* buttonBoxFrame = findChild<QFrame*>("mButtonBoxFrame");
QFrame* buttonBoxFrame = findChild<QFrame*>( "mButtonBoxFrame" );

if ( !mOptListWidget || !mOptStackedWidget || !mOptSplitter || !optionsFrame )
{
@@ -68,20 +68,20 @@ void QgsOptionsDialogBase::initOptionsBase( bool restoreUi )

QSettings settings;
int size = settings.value( "/IconSize", 24 ).toInt();
mOptListWidget->setIconSize( QSize(size, size) );
mOptListWidget->setIconSize( QSize( size, size ) );
mOptListWidget->setFrameStyle( QFrame::NoFrame );

optionsFrame->layout()->setContentsMargins(0,3,3,3);
QVBoxLayout* layout = static_cast<QVBoxLayout*>(optionsFrame->layout());
optionsFrame->layout()->setContentsMargins( 0, 3, 3, 3 );
QVBoxLayout* layout = static_cast<QVBoxLayout*>( optionsFrame->layout() );

if ( buttonBoxFrame )
{
buttonBoxFrame->layout()->setContentsMargins(0,0,0,0);
layout->insertWidget(layout->count() + 1, buttonBoxFrame );
buttonBoxFrame->layout()->setContentsMargins( 0, 0, 0, 0 );
layout->insertWidget( layout->count() + 1, buttonBoxFrame );
}
else
{
layout->insertWidget( layout->count() + 1, mOptButtonBox );
layout->insertWidget( layout->count() + 1, mOptButtonBox );
}

if ( mOptButtonBox )
@@ -708,12 +708,15 @@ int main( int argc, char * argv[] )
delete theServer;
continue;
}
else if ( request.compare( "GetStyles", Qt::CaseInsensitive ) == 0 )
else if ( request.compare( "GetStyles", Qt::CaseInsensitive ) == 0 )
{
// GetStyles is only defined for WMS1.1.1/SLD1.0
if ( version != "1.1.1") {
if ( version != "1.1.1" )
{
theRequestHandler->sendServiceException( QgsMapServiceException( "OperationNotSupported", "GetStyles method is only available in WMS version 1.1.1" ) );
} else {
}
else
{
try
{
QDomDocument doc = theServer->getStyles();
@@ -1939,52 +1939,52 @@ QDomDocument QgsProjectParser::getStyle( const QString& styleName, const QString

QDomDocument QgsProjectParser::getStyles( QStringList& layerList ) const
{
QDomDocument myDocument = QDomDocument();

QDomNode header = myDocument.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" );
myDocument.appendChild( header );

// Create the root element
QDomElement root = myDocument.createElementNS( "http://www.opengis.net/sld", "StyledLayerDescriptor" );
root.setAttribute( "version", "1.1.0" );
root.setAttribute( "xsi:schemaLocation", "http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" );
root.setAttribute( "xmlns:ogc", "http://www.opengis.net/ogc" );
root.setAttribute( "xmlns:se", "http://www.opengis.net/se" );
root.setAttribute( "xmlns:xlink", "http://www.w3.org/1999/xlink" );
root.setAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
myDocument.appendChild( root );

for ( int i = 0; i < layerList.size(); i++)
QDomDocument myDocument = QDomDocument();

QDomNode header = myDocument.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" );
myDocument.appendChild( header );

// Create the root element
QDomElement root = myDocument.createElementNS( "http://www.opengis.net/sld", "StyledLayerDescriptor" );
root.setAttribute( "version", "1.1.0" );
root.setAttribute( "xsi:schemaLocation", "http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" );
root.setAttribute( "xmlns:ogc", "http://www.opengis.net/ogc" );
root.setAttribute( "xmlns:se", "http://www.opengis.net/se" );
root.setAttribute( "xmlns:xlink", "http://www.w3.org/1999/xlink" );
root.setAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
myDocument.appendChild( root );

for ( int i = 0; i < layerList.size(); i++ )
{
QString layerName;
QString typeName;
layerName = layerList.at( i );
typeName = layerName.replace( " ", "_" );
QList<QgsMapLayer*> currentLayerList = mapLayerFromTypeName( typeName );
if ( currentLayerList.size() < 1 )
{
throw QgsMapServiceException( "Error", QString( "The layer for the TypeName '%1' is not found" ).arg( layerName ) );
}
for ( int j = 0; j < currentLayerList.size(); j++ )
{
QString layerName;
QString typeName;
layerName = layerList.at( i );
typeName = layerName.replace(" ", "_");
QList<QgsMapLayer*> currentLayerList = mapLayerFromTypeName( typeName );
if ( currentLayerList.size() < 1 )
QgsMapLayer* currentLayer = currentLayerList.at( j );
QgsVectorLayer* layer = dynamic_cast<QgsVectorLayer*>( currentLayer );
if ( !layer )
{
throw QgsMapServiceException( "Error", QString( "The layer for the TypeName '%1' is not found" ).arg( layerName ) );
throw QgsMapServiceException( "Error", QString( "Could not get style because:\n%1" ).arg( "Non-vector layers not supported yet" ) );
}
for ( int j = 0; j < currentLayerList.size(); j++)
{
QgsMapLayer* currentLayer = currentLayerList.at( j );
QgsVectorLayer* layer = dynamic_cast<QgsVectorLayer*>( currentLayer );
if ( !layer )
{
throw QgsMapServiceException( "Error", QString( "Could not get style because:\n%1" ).arg( "Non-vector layers not supported yet" ) );
}
// Create the NamedLayer element
QDomElement namedLayerNode = myDocument.createElement( "NamedLayer" );
root.appendChild( namedLayerNode );
// Create the NamedLayer element
QDomElement namedLayerNode = myDocument.createElement( "NamedLayer" );
root.appendChild( namedLayerNode );

QString errorMsg;
if ( !layer->writeSld( namedLayerNode, myDocument, errorMsg ) )
{
throw QgsMapServiceException( "Error", QString( "Could not get style because:\n%1" ).arg( errorMsg ) );
}
QString errorMsg;
if ( !layer->writeSld( namedLayerNode, myDocument, errorMsg ) )
{
throw QgsMapServiceException( "Error", QString( "Could not get style because:\n%1" ).arg( errorMsg ) );
}
}
return myDocument;
}
return myDocument;
}


@@ -1415,7 +1415,7 @@ QDomDocument QgsSLDParser::getStyle( const QString& styleName, const QString& la
QDomDocument QgsSLDParser::getStyles( QStringList& layerList ) const
{
QDomDocument styleDoc;
for ( int i = 0; i < layerList.size(); i++)
for ( int i = 0; i < layerList.size(); i++ )
{
QString layerName;
QString typeName;
@@ -1426,7 +1426,7 @@ QDomDocument QgsSLDParser::getStyles( QStringList& layerList ) const
throw QgsMapServiceException( "LayerNotDefined", "Operation request is for a Layer not offered by the server." );
}
QDomNodeList userStyleList = userLayerElement.elementsByTagName( "UserStyle" );
for ( int j = 0; j < userStyleList.size(); j++)
for ( int j = 0; j < userStyleList.size(); j++ )
{
QDomElement userStyleElement = userStyleList.item( i ).toElement();
styleDoc.appendChild( styleDoc.importNode( userStyleElement, true ) );
@@ -603,7 +603,7 @@ QDomDocument QgsWMSServer::getStyle()

// GetStyles is only defined for WMS1.1.1/SLD1.0
QDomDocument QgsWMSServer::getStyles()
{
{
QDomDocument doc;
if ( !mParameterMap.contains( "LAYERS" ) )
{
@@ -613,7 +613,7 @@ QDomDocument QgsWMSServer::getStyles()
QStringList layersList = mParameterMap[ "LAYERS" ].split( ",", QString::SkipEmptyParts );
if ( layersList.size() < 1 )
{
throw QgsMapServiceException( "LayerNotSpecified", "Layers is mandatory for GetStyles operation" );
throw QgsMapServiceException( "LayerNotSpecified", "Layers is mandatory for GetStyles operation" );
}

return mConfigParser->getStyles( layersList );
@@ -74,7 +74,7 @@ QgsWcsCapabilities::QgsWcsCapabilities( QgsDataSourceURI const &theUri ):
retrieveServerCapabilities();
}

QgsWcsCapabilities::QgsWcsCapabilities()
QgsWcsCapabilities::QgsWcsCapabilities()
: mCoverageCount( 0 )
{
}
@@ -49,8 +49,8 @@ class TestQgsComposerPaper: public QObject
QgsMarkerLineSymbolLayerV2* mMarkerLine;
QgsFillSymbolV2* mFillSymbol;
QgsFillSymbolV2* mMarkerLineSymbol;
QgsSingleSymbolRendererV2* mSymbolRenderer;
QgsSingleSymbolRendererV2* mSymbolRenderer;

};

void TestQgsComposerPaper::initTestCase()
@@ -61,17 +61,17 @@ void TestQgsComposerPaper::initTestCase()
//create empty composition
mComposition = new QgsComposition( 0 );
mComposition->setPaperSize( 297, 210 ); //A4 landscape

//setup simple fill
mSimpleFill = new QgsSimpleFillSymbolLayerV2();
mFillSymbol = new QgsFillSymbolV2();
mFillSymbol->changeSymbolLayer( 0, mSimpleFill );

//setup marker line fill
mMarkerLine = new QgsMarkerLineSymbolLayerV2();
mMarkerLineSymbol = new QgsFillSymbolV2();
mMarkerLineSymbol->changeSymbolLayer( 0, mMarkerLine );
mMarkerLineSymbol->changeSymbolLayer( 0, mMarkerLine );

mReport = "<h1>Composer Paper Tests</h1>\n";
}

@@ -109,7 +109,7 @@ void TestQgsComposerPaper::transparentPaper()
{
mSimpleFill->setColor( Qt::transparent );
mSimpleFill->setBorderColor( Qt::transparent );
mComposition->setPageStyleSymbol( mFillSymbol );
mComposition->setPageStyleSymbol( mFillSymbol );
QgsCompositionChecker checker( "composerpaper_transparent", mComposition );
QVERIFY( checker.testComposition( mReport ) );
}
@@ -118,14 +118,14 @@ void TestQgsComposerPaper::borderedPaper()
{
mSimpleFill->setColor( Qt::white );
mSimpleFill->setBorderColor( Qt::black );
mSimpleFill->setBorderWidth( 6 );
mSimpleFill->setBorderWidth( 6 );
QgsCompositionChecker checker( "composerpaper_bordered", mComposition );
QVERIFY( checker.testComposition( mReport ) );
}

void TestQgsComposerPaper::markerLinePaper()
{
mComposition->setPageStyleSymbol( mMarkerLineSymbol );
{
mComposition->setPageStyleSymbol( mMarkerLineSymbol );
QgsCompositionChecker checker( "composerpaper_markerborder", mComposition );
QVERIFY( checker.testComposition( mReport ) );
}

0 comments on commit 129bd98

Please sign in to comment.
You can’t perform that action at this time.