mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
indentation update (r9780-r10009)
git-svn-id: http://svn.osgeo.org/qgis/trunk@10010 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
b25bf892e8
commit
7e04f3e212
@ -14,82 +14,82 @@
|
||||
file: fToosl.py
|
||||
---------------------*/
|
||||
|
||||
translate( "fTools", "Quantum GIS version detected: " )
|
||||
translate( "fTools", "This version of fTools requires at least QGIS version 1.0.0" )
|
||||
translate( "fTools", "Plugin will not be enabled." )
|
||||
translate( "fTools", "&Tools" )
|
||||
translate( "fTools", "&Analysis Tools" )
|
||||
translate( "fTools", "Distance matrix" )
|
||||
translate( "fTools", "Sum line lengths" )
|
||||
translate( "fTools", "Points in polygon" )
|
||||
translate( "fTools", "Basic statistics" )
|
||||
translate( "fTools", "List unique values" )
|
||||
translate( "fTools", "Nearest neighbour analysis" )
|
||||
translate( "fTools", "Mean coordinate(s)" )
|
||||
translate( "fTools", "Line intersections" )
|
||||
translate( "fTools", "&Sampling Tools" )
|
||||
translate( "fTools", "Random selection" )
|
||||
translate( "fTools", "Random selection within subsets" )
|
||||
translate( "fTools", "Random points" )
|
||||
translate( "fTools", "Regular points" )
|
||||
translate( "fTools", "Vector grid" )
|
||||
translate( "fTools", "Select by location" )
|
||||
translate( "fTools", "&Geoprocessing Tools" )
|
||||
translate( "fTools", "Convex hull(s)" )
|
||||
translate( "fTools", "Buffer(s)" )
|
||||
translate( "fTools", "Intersect" )
|
||||
translate( "fTools", "Union" )
|
||||
translate( "fTools", "Symetrical difference" )
|
||||
translate( "fTools", "Clip" )
|
||||
translate( "fTools", "Dissolve" )
|
||||
translate( "fTools", "Difference" )
|
||||
translate( "fTools", "G&eometry Tools" )
|
||||
translate( "fTools", "Export/Add geometry columns" )
|
||||
translate( "fTools", "Check geometry validity" )
|
||||
translate( "fTools", "Polygon centroids" )
|
||||
translate( "fTools", "Extract nodes" )
|
||||
translate( "fTools", "Simplify geometries" )
|
||||
translate( "fTools", "Multipart to singleparts" )
|
||||
translate( "fTools", "Singleparts to multipart" )
|
||||
translate( "fTools", "Polygons to lines" )
|
||||
translate( "fTools", "&Data Management Tools")
|
||||
translate( "fTools", "Export to new projection" )
|
||||
translate( "fTools", "Define current projection" )
|
||||
translate( "fTools", "Join attributes" )
|
||||
translate( "fTools", "Join attributes by location" )
|
||||
translate( "fTools", "Split vector layer" )
|
||||
translate( "fTools", "About fTools" )
|
||||
|
||||
translate( "fTools", "Quantum GIS version detected: " )
|
||||
translate( "fTools", "This version of fTools requires at least QGIS version 1.0.0" )
|
||||
translate( "fTools", "Plugin will not be enabled." )
|
||||
translate( "fTools", "&Tools" )
|
||||
translate( "fTools", "&Analysis Tools" )
|
||||
translate( "fTools", "Distance matrix" )
|
||||
translate( "fTools", "Sum line lengths" )
|
||||
translate( "fTools", "Points in polygon" )
|
||||
translate( "fTools", "Basic statistics" )
|
||||
translate( "fTools", "List unique values" )
|
||||
translate( "fTools", "Nearest neighbour analysis" )
|
||||
translate( "fTools", "Mean coordinate(s)" )
|
||||
translate( "fTools", "Line intersections" )
|
||||
translate( "fTools", "&Sampling Tools" )
|
||||
translate( "fTools", "Random selection" )
|
||||
translate( "fTools", "Random selection within subsets" )
|
||||
translate( "fTools", "Random points" )
|
||||
translate( "fTools", "Regular points" )
|
||||
translate( "fTools", "Vector grid" )
|
||||
translate( "fTools", "Select by location" )
|
||||
translate( "fTools", "&Geoprocessing Tools" )
|
||||
translate( "fTools", "Convex hull(s)" )
|
||||
translate( "fTools", "Buffer(s)" )
|
||||
translate( "fTools", "Intersect" )
|
||||
translate( "fTools", "Union" )
|
||||
translate( "fTools", "Symetrical difference" )
|
||||
translate( "fTools", "Clip" )
|
||||
translate( "fTools", "Dissolve" )
|
||||
translate( "fTools", "Difference" )
|
||||
translate( "fTools", "G&eometry Tools" )
|
||||
translate( "fTools", "Export/Add geometry columns" )
|
||||
translate( "fTools", "Check geometry validity" )
|
||||
translate( "fTools", "Polygon centroids" )
|
||||
translate( "fTools", "Extract nodes" )
|
||||
translate( "fTools", "Simplify geometries" )
|
||||
translate( "fTools", "Multipart to singleparts" )
|
||||
translate( "fTools", "Singleparts to multipart" )
|
||||
translate( "fTools", "Polygons to lines" )
|
||||
translate( "fTools", "&Data Management Tools" )
|
||||
translate( "fTools", "Export to new projection" )
|
||||
translate( "fTools", "Define current projection" )
|
||||
translate( "fTools", "Join attributes" )
|
||||
translate( "fTools", "Join attributes by location" )
|
||||
translate( "fTools", "Split vector layer" )
|
||||
translate( "fTools", "About fTools" )
|
||||
|
||||
/*---------------------
|
||||
file: doGeoprocessing.py
|
||||
---------------------*/
|
||||
|
||||
GeoprocessingDialog::foo()
|
||||
{
|
||||
tr( "Dissolve all" )
|
||||
tr( "Please specify an input layer" )
|
||||
tr( "Please specify a difference/intersect/union layer" )
|
||||
tr( "Please specify valid buffer value" )
|
||||
tr( "Please specify dissolve field" )
|
||||
tr( "Please specify output shapefile" )
|
||||
tr( "Unable to create geoprocessing result." )
|
||||
tr( "Created output shapefile" )
|
||||
tr( "Would you like to add the new layer to the TOC?" )
|
||||
tr( "Buffer(s)" )
|
||||
tr( "Create single minimum convex hull" )
|
||||
tr( "Create convex hulls based on input field" )
|
||||
tr( "Convex hull(s)" )
|
||||
tr( "Dissolve" )
|
||||
tr( "Erase layer" )
|
||||
tr( "Difference" )
|
||||
tr( "Intersect layer" )
|
||||
tr( "Intersect" )
|
||||
tr( "Difference layer" )
|
||||
tr( "Symetrical difference" )
|
||||
tr( "Clip layer" )
|
||||
tr( "Clip" )
|
||||
tr( "Union layer" )
|
||||
tr( "Union" )
|
||||
tr( "Dissolve all" )
|
||||
tr( "Please specify an input layer" )
|
||||
tr( "Please specify a difference/intersect/union layer" )
|
||||
tr( "Please specify valid buffer value" )
|
||||
tr( "Please specify dissolve field" )
|
||||
tr( "Please specify output shapefile" )
|
||||
tr( "Unable to create geoprocessing result." )
|
||||
tr( "Created output shapefile" )
|
||||
tr( "Would you like to add the new layer to the TOC?" )
|
||||
tr( "Buffer(s)" )
|
||||
tr( "Create single minimum convex hull" )
|
||||
tr( "Create convex hulls based on input field" )
|
||||
tr( "Convex hull(s)" )
|
||||
tr( "Dissolve" )
|
||||
tr( "Erase layer" )
|
||||
tr( "Difference" )
|
||||
tr( "Intersect layer" )
|
||||
tr( "Intersect" )
|
||||
tr( "Difference layer" )
|
||||
tr( "Symetrical difference" )
|
||||
tr( "Clip layer" )
|
||||
tr( "Clip" )
|
||||
tr( "Union layer" )
|
||||
tr( "Union" )
|
||||
}
|
||||
|
||||
/*---------------------
|
||||
@ -98,34 +98,34 @@ file: doGeometry.py
|
||||
|
||||
GeometryDialog::foo()
|
||||
{
|
||||
tr( "Merge all" )
|
||||
tr( "Please specify input vector layer" )
|
||||
tr( "Please specify output shapefile" )
|
||||
tr( "Please specify valid tolerance value" )
|
||||
tr( "Please specify valid UID field" )
|
||||
tr( "Created output shapefile" )
|
||||
tr( "Would you like to add the new layer to the TOC?" )
|
||||
tr( "Singleparts to multipart" )
|
||||
tr( "Output shapefile" )
|
||||
tr( "Multipart to singleparts" )
|
||||
tr( "Output shapefile" )
|
||||
tr( "Extract nodes" )
|
||||
tr( "Polygons to lines" )
|
||||
tr( "Output shapefile" )
|
||||
tr( "Input polygon vector layer" )
|
||||
tr( "Export/Add geometry columns" )
|
||||
tr( "Output shapefile" )
|
||||
tr( "Input vector layer" )
|
||||
tr( "Simplify geometries" )
|
||||
tr( "Output shapefile" )
|
||||
tr( "Polygon centroids" )
|
||||
tr( "Output point shapefile" )
|
||||
tr( "Input polygon vector layer" )
|
||||
tr( "Error processing specified tolerance!" )
|
||||
tr( "Please choose larger tolerance..." )
|
||||
tr( "Function not found" )
|
||||
tr( "Error writing output shapefile" )
|
||||
tr( "Unable to delete existing layer..." )
|
||||
tr( "Merge all" )
|
||||
tr( "Please specify input vector layer" )
|
||||
tr( "Please specify output shapefile" )
|
||||
tr( "Please specify valid tolerance value" )
|
||||
tr( "Please specify valid UID field" )
|
||||
tr( "Created output shapefile" )
|
||||
tr( "Would you like to add the new layer to the TOC?" )
|
||||
tr( "Singleparts to multipart" )
|
||||
tr( "Output shapefile" )
|
||||
tr( "Multipart to singleparts" )
|
||||
tr( "Output shapefile" )
|
||||
tr( "Extract nodes" )
|
||||
tr( "Polygons to lines" )
|
||||
tr( "Output shapefile" )
|
||||
tr( "Input polygon vector layer" )
|
||||
tr( "Export/Add geometry columns" )
|
||||
tr( "Output shapefile" )
|
||||
tr( "Input vector layer" )
|
||||
tr( "Simplify geometries" )
|
||||
tr( "Output shapefile" )
|
||||
tr( "Polygon centroids" )
|
||||
tr( "Output point shapefile" )
|
||||
tr( "Input polygon vector layer" )
|
||||
tr( "Error processing specified tolerance!" )
|
||||
tr( "Please choose larger tolerance..." )
|
||||
tr( "Function not found" )
|
||||
tr( "Error writing output shapefile" )
|
||||
tr( "Unable to delete existing layer..." )
|
||||
}
|
||||
|
||||
/*---------------------
|
||||
@ -134,24 +134,24 @@ file: doVisual.py
|
||||
|
||||
VisualDialog::foo()
|
||||
{
|
||||
tr( "Please specify input vector layer" )
|
||||
tr( "Please specify input field" )
|
||||
tr( "Check geometry validity" )
|
||||
tr( "Geometry errors" )
|
||||
tr( "Total encountered errors" )
|
||||
tr( "List unique values" )
|
||||
tr( "Unique values:" )
|
||||
tr( "Total unique values:" )
|
||||
tr( "Basics statistics" )
|
||||
tr( "Statistics output" )
|
||||
tr( "Nearest neighbour analysis" )
|
||||
tr( "Nearest neighbour statistics" )
|
||||
tr( "Observed mean distance : " )
|
||||
tr( "Expected mean distance : " )
|
||||
tr( "Nearest neighbour index : " )
|
||||
tr( "Feature " )
|
||||
tr( " contains an unested hole" ) )
|
||||
tr( " is not closed" )
|
||||
tr( " is self intersecting" )
|
||||
tr( " has incorrect node ordering" )
|
||||
tr( "Please specify input vector layer" )
|
||||
tr( "Please specify input field" )
|
||||
tr( "Check geometry validity" )
|
||||
tr( "Geometry errors" )
|
||||
tr( "Total encountered errors" )
|
||||
tr( "List unique values" )
|
||||
tr( "Unique values:" )
|
||||
tr( "Total unique values:" )
|
||||
tr( "Basics statistics" )
|
||||
tr( "Statistics output" )
|
||||
tr( "Nearest neighbour analysis" )
|
||||
tr( "Nearest neighbour statistics" )
|
||||
tr( "Observed mean distance : " )
|
||||
tr( "Expected mean distance : " )
|
||||
tr( "Nearest neighbour index : " )
|
||||
tr( "Feature " )
|
||||
tr( " contains an unested hole" ) )
|
||||
tr( " is not closed" )
|
||||
tr( " is self intersecting" )
|
||||
tr( " has incorrect node ordering" )
|
||||
}
|
||||
|
@ -70,34 +70,34 @@ QgsComposer::QgsComposer( QgisApp *qgis ): QMainWindow()
|
||||
setupUi( this );
|
||||
setupTheme();
|
||||
|
||||
QToolButton* orderingToolButton = new QToolButton(this);
|
||||
orderingToolButton->setPopupMode(QToolButton::InstantPopup);
|
||||
orderingToolButton->setAutoRaise(true);
|
||||
orderingToolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
QToolButton* orderingToolButton = new QToolButton( this );
|
||||
orderingToolButton->setPopupMode( QToolButton::InstantPopup );
|
||||
orderingToolButton->setAutoRaise( true );
|
||||
orderingToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
|
||||
|
||||
orderingToolButton->addAction(mActionRaiseItems);
|
||||
orderingToolButton->addAction(mActionLowerItems);
|
||||
orderingToolButton->addAction(mActionMoveItemsToTop);
|
||||
orderingToolButton->addAction(mActionMoveItemsToBottom);
|
||||
orderingToolButton->setDefaultAction(mActionRaiseItems);
|
||||
toolBar->addWidget(orderingToolButton);
|
||||
|
||||
QToolButton* alignToolButton = new QToolButton(this);
|
||||
alignToolButton->setPopupMode(QToolButton::InstantPopup);
|
||||
alignToolButton->setAutoRaise(true);
|
||||
alignToolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
orderingToolButton->addAction( mActionRaiseItems );
|
||||
orderingToolButton->addAction( mActionLowerItems );
|
||||
orderingToolButton->addAction( mActionMoveItemsToTop );
|
||||
orderingToolButton->addAction( mActionMoveItemsToBottom );
|
||||
orderingToolButton->setDefaultAction( mActionRaiseItems );
|
||||
toolBar->addWidget( orderingToolButton );
|
||||
|
||||
alignToolButton->addAction(mActionAlignLeft);
|
||||
alignToolButton->addAction(mActionAlignHCenter);
|
||||
alignToolButton->addAction(mActionAlignRight);
|
||||
alignToolButton->addAction(mActionAlignTop);
|
||||
alignToolButton->addAction(mActionAlignVCenter);
|
||||
alignToolButton->addAction(mActionAlignBottom);
|
||||
alignToolButton->setDefaultAction(mActionAlignLeft);
|
||||
toolBar->addWidget(alignToolButton);
|
||||
QToolButton* alignToolButton = new QToolButton( this );
|
||||
alignToolButton->setPopupMode( QToolButton::InstantPopup );
|
||||
alignToolButton->setAutoRaise( true );
|
||||
alignToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
|
||||
|
||||
alignToolButton->addAction( mActionAlignLeft );
|
||||
alignToolButton->addAction( mActionAlignHCenter );
|
||||
alignToolButton->addAction( mActionAlignRight );
|
||||
alignToolButton->addAction( mActionAlignTop );
|
||||
alignToolButton->addAction( mActionAlignVCenter );
|
||||
alignToolButton->addAction( mActionAlignBottom );
|
||||
alignToolButton->setDefaultAction( mActionAlignLeft );
|
||||
toolBar->addWidget( alignToolButton );
|
||||
|
||||
QActionGroup* toggleActionGroup = new QActionGroup( this );
|
||||
toggleActionGroup->addAction( mActionMoveItemContent);
|
||||
toggleActionGroup->addAction( mActionMoveItemContent );
|
||||
toggleActionGroup->addAction( mActionAddNewMap );
|
||||
toggleActionGroup->addAction( mActionAddNewLabel );
|
||||
toggleActionGroup->addAction( mActionAddNewLegend );
|
||||
@ -235,8 +235,8 @@ void QgsComposer::setupTheme()
|
||||
{
|
||||
//now set all the icons - getThemeIcon will fall back to default theme if its
|
||||
//missing from active theme
|
||||
mActionLoadFromTemplate->setIcon(QgisApp::getThemeIcon("/mActionFileOpen.png"));
|
||||
mActionSaveAsTemplate->setIcon(QgisApp::getThemeIcon("/mActionFileSaveAs.png"));
|
||||
mActionLoadFromTemplate->setIcon( QgisApp::getThemeIcon( "/mActionFileOpen.png" ) );
|
||||
mActionSaveAsTemplate->setIcon( QgisApp::getThemeIcon( "/mActionFileSaveAs.png" ) );
|
||||
mActionExportAsImage->setIcon( QgisApp::getThemeIcon( "/mActionExportMapServer.png" ) );
|
||||
mActionExportAsSVG->setIcon( QgisApp::getThemeIcon( "/mActionSaveAsSVG.png" ) );
|
||||
mActionPrint->setIcon( QgisApp::getThemeIcon( "/mActionFilePrint.png" ) );
|
||||
@ -250,19 +250,19 @@ void QgsComposer::setupTheme()
|
||||
mActionAddNewLegend->setIcon( QgisApp::getThemeIcon( "/mActionAddLegend.png" ) );
|
||||
mActionAddNewScalebar->setIcon( QgisApp::getThemeIcon( "/mActionScaleBar.png" ) );
|
||||
mActionSelectMoveItem->setIcon( QgisApp::getThemeIcon( "/mActionSelectPan.png" ) );
|
||||
mActionMoveItemContent->setIcon( QgisApp::getThemeIcon("/mActionMoveItemContent.png"));
|
||||
mActionGroupItems->setIcon( QgisApp::getThemeIcon("/mActionGroupItems.png"));
|
||||
mActionUngroupItems->setIcon( QgisApp::getThemeIcon("/mActionUngroupItems.png"));
|
||||
mActionRaiseItems->setIcon( QgisApp::getThemeIcon("/mActionRaiseItems.png"));
|
||||
mActionLowerItems->setIcon( QgisApp::getThemeIcon("/mActionLowerItems.png"));
|
||||
mActionMoveItemsToTop->setIcon( QgisApp::getThemeIcon("/mActionMoveItemsToTop.png"));
|
||||
mActionMoveItemsToBottom->setIcon( QgisApp::getThemeIcon("/mActionMoveItemsToBottom.png"));
|
||||
mActionAlignLeft->setIcon(QgisApp::getThemeIcon("/mActionAlignLeft.png"));
|
||||
mActionAlignHCenter->setIcon(QgisApp::getThemeIcon("/mActionAlignHCenter.png"));
|
||||
mActionAlignRight->setIcon(QgisApp::getThemeIcon("/mActionAlignRight.png"));
|
||||
mActionAlignTop->setIcon(QgisApp::getThemeIcon("/mActionAlignTop.png"));
|
||||
mActionAlignVCenter->setIcon(QgisApp::getThemeIcon("/mActionAlignVCenter.png"));
|
||||
mActionAlignBottom->setIcon(QgisApp::getThemeIcon("/mActionAlignBottom.png"));
|
||||
mActionMoveItemContent->setIcon( QgisApp::getThemeIcon( "/mActionMoveItemContent.png" ) );
|
||||
mActionGroupItems->setIcon( QgisApp::getThemeIcon( "/mActionGroupItems.png" ) );
|
||||
mActionUngroupItems->setIcon( QgisApp::getThemeIcon( "/mActionUngroupItems.png" ) );
|
||||
mActionRaiseItems->setIcon( QgisApp::getThemeIcon( "/mActionRaiseItems.png" ) );
|
||||
mActionLowerItems->setIcon( QgisApp::getThemeIcon( "/mActionLowerItems.png" ) );
|
||||
mActionMoveItemsToTop->setIcon( QgisApp::getThemeIcon( "/mActionMoveItemsToTop.png" ) );
|
||||
mActionMoveItemsToBottom->setIcon( QgisApp::getThemeIcon( "/mActionMoveItemsToBottom.png" ) );
|
||||
mActionAlignLeft->setIcon( QgisApp::getThemeIcon( "/mActionAlignLeft.png" ) );
|
||||
mActionAlignHCenter->setIcon( QgisApp::getThemeIcon( "/mActionAlignHCenter.png" ) );
|
||||
mActionAlignRight->setIcon( QgisApp::getThemeIcon( "/mActionAlignRight.png" ) );
|
||||
mActionAlignTop->setIcon( QgisApp::getThemeIcon( "/mActionAlignTop.png" ) );
|
||||
mActionAlignVCenter->setIcon( QgisApp::getThemeIcon( "/mActionAlignVCenter.png" ) );
|
||||
mActionAlignBottom->setIcon( QgisApp::getThemeIcon( "/mActionAlignBottom.png" ) );
|
||||
}
|
||||
|
||||
void QgsComposer::connectSlots()
|
||||
@ -750,71 +750,71 @@ void QgsComposer::on_mActionAddImage_activated( void )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposer::on_mActionSaveAsTemplate_activated(void)
|
||||
void QgsComposer::on_mActionSaveAsTemplate_activated( void )
|
||||
{
|
||||
//show file dialog
|
||||
QSettings settings;
|
||||
QString lastSaveDir = settings.value("UI/lastComposerTemplateDir", "").toString();
|
||||
QString saveFileName = QFileDialog::getSaveFileName( 0, tr("save template"), lastSaveDir, "*.qpt");
|
||||
if(saveFileName.isEmpty())
|
||||
QString lastSaveDir = settings.value( "UI/lastComposerTemplateDir", "" ).toString();
|
||||
QString saveFileName = QFileDialog::getSaveFileName( 0, tr( "save template" ), lastSaveDir, "*.qpt" );
|
||||
if ( saveFileName.isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//save directory
|
||||
QFileInfo saveFileInfo(saveFileName);
|
||||
settings.setValue("UI/LastComposerTemplateDir", saveFileInfo.absolutePath());
|
||||
QFileInfo saveFileInfo( saveFileName );
|
||||
settings.setValue( "UI/LastComposerTemplateDir", saveFileInfo.absolutePath() );
|
||||
|
||||
QFile templateFile(saveFileName);
|
||||
if(!templateFile.open(QIODevice::WriteOnly))
|
||||
QFile templateFile( saveFileName );
|
||||
if ( !templateFile.open( QIODevice::WriteOnly ) )
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
QDomDocument saveDocument;
|
||||
writeXML(saveDocument, saveDocument);
|
||||
writeXML( saveDocument, saveDocument );
|
||||
|
||||
if(templateFile.write (saveDocument.toByteArray()) == -1)
|
||||
if ( templateFile.write( saveDocument.toByteArray() ) == -1 )
|
||||
{
|
||||
QMessageBox::warning(0, tr("Save error"), tr("Error, could not save file"));
|
||||
QMessageBox::warning( 0, tr( "Save error" ), tr( "Error, could not save file" ) );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposer::on_mActionLoadFromTemplate_activated(void)
|
||||
void QgsComposer::on_mActionLoadFromTemplate_activated( void )
|
||||
{
|
||||
QSettings settings;
|
||||
QString openFileDir = settings.value("UI/lastComposerTemplateDir", "").toString();
|
||||
QString openFileString = QFileDialog::getOpenFileName(0, tr("Load template"), openFileDir, "*.qpt");
|
||||
QString openFileDir = settings.value( "UI/lastComposerTemplateDir", "" ).toString();
|
||||
QString openFileString = QFileDialog::getOpenFileName( 0, tr( "Load template" ), openFileDir, "*.qpt" );
|
||||
|
||||
if(openFileString.isEmpty())
|
||||
if ( openFileString.isEmpty() )
|
||||
{
|
||||
return; //canceled by the user
|
||||
}
|
||||
|
||||
QFileInfo openFileInfo(openFileString);
|
||||
settings.setValue("UI/LastComposerTemplateDir", openFileInfo.absolutePath());
|
||||
QFileInfo openFileInfo( openFileString );
|
||||
settings.setValue( "UI/LastComposerTemplateDir", openFileInfo.absolutePath() );
|
||||
|
||||
QFile templateFile(openFileString);
|
||||
if(!templateFile.open(QIODevice::ReadOnly))
|
||||
QFile templateFile( openFileString );
|
||||
if ( !templateFile.open( QIODevice::ReadOnly ) )
|
||||
{
|
||||
QMessageBox::warning(0, tr("Read error"), tr("Error, could not read file"));
|
||||
return;
|
||||
}
|
||||
|
||||
QDomDocument templateDocument;
|
||||
if(!templateDocument.setContent(&templateFile, false))
|
||||
{
|
||||
QMessageBox::warning(0, tr("Read error"), tr("Content of template file is not valid"));
|
||||
QMessageBox::warning( 0, tr( "Read error" ), tr( "Error, could not read file" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
readXML(templateDocument);
|
||||
QDomDocument templateDocument;
|
||||
if ( !templateDocument.setContent( &templateFile, false ) )
|
||||
{
|
||||
QMessageBox::warning( 0, tr( "Read error" ), tr( "Content of template file is not valid" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
readXML( templateDocument );
|
||||
|
||||
//clean up after template read (e.g. legend and map extent)
|
||||
cleanupAfterTemplateRead();
|
||||
}
|
||||
|
||||
void QgsComposer::on_mActionMoveItemContent_activated(void)
|
||||
void QgsComposer::on_mActionMoveItemContent_activated( void )
|
||||
{
|
||||
if ( mView )
|
||||
{
|
||||
@ -846,7 +846,7 @@ void QgsComposer::on_mActionRaiseItems_activated( void )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposer::on_mActionLowerItems_activated(void)
|
||||
void QgsComposer::on_mActionLowerItems_activated( void )
|
||||
{
|
||||
if ( mComposition )
|
||||
{
|
||||
@ -854,7 +854,7 @@ void QgsComposer::on_mActionLowerItems_activated(void)
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposer::on_mActionMoveItemsToTop_activated(void)
|
||||
void QgsComposer::on_mActionMoveItemsToTop_activated( void )
|
||||
{
|
||||
if ( mComposition )
|
||||
{
|
||||
@ -862,7 +862,7 @@ void QgsComposer::on_mActionMoveItemsToTop_activated(void)
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposer::on_mActionMoveItemsToBottom_activated(void)
|
||||
void QgsComposer::on_mActionMoveItemsToBottom_activated( void )
|
||||
{
|
||||
if ( mComposition )
|
||||
{
|
||||
@ -870,52 +870,52 @@ void QgsComposer::on_mActionMoveItemsToBottom_activated(void)
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposer::on_mActionAlignLeft_activated(void)
|
||||
void QgsComposer::on_mActionAlignLeft_activated( void )
|
||||
{
|
||||
if(mComposition)
|
||||
{
|
||||
mComposition->alignSelectedItemsLeft();
|
||||
}
|
||||
if ( mComposition )
|
||||
{
|
||||
mComposition->alignSelectedItemsLeft();
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposer::on_mActionAlignHCenter_activated(void)
|
||||
void QgsComposer::on_mActionAlignHCenter_activated( void )
|
||||
{
|
||||
if(mComposition)
|
||||
{
|
||||
mComposition->alignSelectedItemsHCenter();
|
||||
}
|
||||
if ( mComposition )
|
||||
{
|
||||
mComposition->alignSelectedItemsHCenter();
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposer::on_mActionAlignRight_activated(void)
|
||||
void QgsComposer::on_mActionAlignRight_activated( void )
|
||||
{
|
||||
if(mComposition)
|
||||
{
|
||||
mComposition->alignSelectedItemsRight();
|
||||
}
|
||||
if ( mComposition )
|
||||
{
|
||||
mComposition->alignSelectedItemsRight();
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposer::on_mActionAlignTop_activated(void)
|
||||
void QgsComposer::on_mActionAlignTop_activated( void )
|
||||
{
|
||||
if(mComposition)
|
||||
{
|
||||
mComposition->alignSelectedItemsTop();
|
||||
}
|
||||
if ( mComposition )
|
||||
{
|
||||
mComposition->alignSelectedItemsTop();
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposer::on_mActionAlignVCenter_activated(void)
|
||||
void QgsComposer::on_mActionAlignVCenter_activated( void )
|
||||
{
|
||||
if(mComposition)
|
||||
{
|
||||
mComposition->alignSelectedItemsVCenter();
|
||||
}
|
||||
if ( mComposition )
|
||||
{
|
||||
mComposition->alignSelectedItemsVCenter();
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposer::on_mActionAlignBottom_activated(void)
|
||||
void QgsComposer::on_mActionAlignBottom_activated( void )
|
||||
{
|
||||
if(mComposition)
|
||||
{
|
||||
mComposition->alignSelectedItemsBottom();
|
||||
}
|
||||
if ( mComposition )
|
||||
{
|
||||
mComposition->alignSelectedItemsBottom();
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposer::moveEvent( QMoveEvent *e ) { saveWindowState(); }
|
||||
@ -976,10 +976,10 @@ void QgsComposer::writeXML( QDomDocument& doc )
|
||||
return;
|
||||
}
|
||||
|
||||
writeXML(qgisElem, doc);
|
||||
writeXML( qgisElem, doc );
|
||||
}
|
||||
|
||||
void QgsComposer::writeXML(QDomNode& parentNode, QDomDocument& doc)
|
||||
void QgsComposer::writeXML( QDomNode& parentNode, QDomDocument& doc )
|
||||
{
|
||||
QDomElement composerElem = doc.createElement( "Composer" );
|
||||
parentNode.appendChild( composerElem );
|
||||
@ -1146,7 +1146,7 @@ void QgsComposer::addComposerMap( QgsComposerMap* map )
|
||||
}
|
||||
|
||||
QgsComposerMapWidget* mapWidget = new QgsComposerMapWidget( map );
|
||||
connect(this, SIGNAL(zoomLevelChanged()), map, SLOT(renderModeUpdateCachedImage()));
|
||||
connect( this, SIGNAL( zoomLevelChanged() ), map, SLOT( renderModeUpdateCachedImage() ) );
|
||||
mItemWidgetMap.insert( map, mapWidget );
|
||||
}
|
||||
|
||||
@ -1259,27 +1259,27 @@ void QgsComposer::cleanupAfterTemplateRead()
|
||||
for ( ; itemIt != mItemWidgetMap.constEnd(); ++itemIt )
|
||||
{
|
||||
//update all legends completely
|
||||
QgsComposerLegend* legendItem = dynamic_cast<QgsComposerLegend*>(itemIt.key());
|
||||
if(legendItem)
|
||||
QgsComposerLegend* legendItem = dynamic_cast<QgsComposerLegend*>( itemIt.key() );
|
||||
if ( legendItem )
|
||||
{
|
||||
legendItem->updateLegend();
|
||||
continue;
|
||||
}
|
||||
|
||||
//update composer map extent if it does not intersect the full extent of all layers
|
||||
QgsComposerMap* mapItem = dynamic_cast<QgsComposerMap*>(itemIt.key());
|
||||
if(mapItem)
|
||||
QgsComposerMap* mapItem = dynamic_cast<QgsComposerMap*>( itemIt.key() );
|
||||
if ( mapItem )
|
||||
{
|
||||
//test if composer map extent intersects extent of all layers
|
||||
bool intersects = false;
|
||||
QgsRectangle composerMapExtent = mapItem->extent();
|
||||
if(mQgis)
|
||||
if ( mQgis )
|
||||
{
|
||||
QgsMapCanvas* canvas = mQgis->mapCanvas();
|
||||
if(canvas)
|
||||
if ( canvas )
|
||||
{
|
||||
QgsRectangle mapCanvasExtent = mQgis->mapCanvas()->fullExtent();
|
||||
if(composerMapExtent.intersects(mapCanvasExtent))
|
||||
if ( composerMapExtent.intersects( mapCanvasExtent ) )
|
||||
{
|
||||
intersects = true;
|
||||
}
|
||||
@ -1287,16 +1287,16 @@ void QgsComposer::cleanupAfterTemplateRead()
|
||||
}
|
||||
|
||||
//if not: apply current canvas extent
|
||||
if(!intersects)
|
||||
if ( !intersects )
|
||||
{
|
||||
double currentWidth = mapItem->rect().width();
|
||||
double currentHeight = mapItem->rect().height();
|
||||
if(currentWidth - 0 > 0.0) //don't divide through zero
|
||||
if ( currentWidth - 0 > 0.0 ) //don't divide through zero
|
||||
{
|
||||
QgsRectangle canvasExtent = mapItem->mapRenderer()->extent();
|
||||
//adapt min y of extent such that the size of the map item stays the same
|
||||
double newCanvasExtentHeight = currentHeight / currentWidth * canvasExtent.width();
|
||||
canvasExtent.setYMinimum(canvasExtent.yMaximum() - newCanvasExtentHeight);
|
||||
canvasExtent.setYMinimum( canvasExtent.yMaximum() - newCanvasExtentHeight );
|
||||
mapItem->setNewExtent( canvasExtent );
|
||||
}
|
||||
}
|
||||
|
@ -138,12 +138,12 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
|
||||
void on_mActionAddImage_activated( void );
|
||||
|
||||
//! Save composer as template
|
||||
void on_mActionSaveAsTemplate_activated(void);
|
||||
void on_mActionSaveAsTemplate_activated( void );
|
||||
|
||||
void on_mActionLoadFromTemplate_activated(void);
|
||||
void on_mActionLoadFromTemplate_activated( void );
|
||||
|
||||
//! Set tool to move item content
|
||||
void on_mActionMoveItemContent_activated(void);
|
||||
void on_mActionMoveItemContent_activated( void );
|
||||
|
||||
//! Group selected items
|
||||
void on_mActionGroupItems_activated( void );
|
||||
@ -152,34 +152,34 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
|
||||
void on_mActionUngroupItems_activated( void );
|
||||
|
||||
//! Move selected items one position up
|
||||
void on_mActionRaiseItems_activated(void);
|
||||
void on_mActionRaiseItems_activated( void );
|
||||
|
||||
//!Move selected items one position down
|
||||
void on_mActionLowerItems_activated(void);
|
||||
void on_mActionLowerItems_activated( void );
|
||||
|
||||
//!Move selected items to top
|
||||
void on_mActionMoveItemsToTop_activated(void);
|
||||
void on_mActionMoveItemsToTop_activated( void );
|
||||
|
||||
//!Move selected items to bottom
|
||||
void on_mActionMoveItemsToBottom_activated(void);
|
||||
void on_mActionMoveItemsToBottom_activated( void );
|
||||
|
||||
//!Align selected composer items left
|
||||
void on_mActionAlignLeft_activated(void);
|
||||
void on_mActionAlignLeft_activated( void );
|
||||
|
||||
//!Align selected composere items horizontally centered
|
||||
void on_mActionAlignHCenter_activated(void);
|
||||
void on_mActionAlignHCenter_activated( void );
|
||||
|
||||
//!Align selected composer items right
|
||||
void on_mActionAlignRight_activated(void);
|
||||
void on_mActionAlignRight_activated( void );
|
||||
|
||||
//!Align selected composer items to top
|
||||
void on_mActionAlignTop_activated(void);
|
||||
void on_mActionAlignTop_activated( void );
|
||||
|
||||
//!Align selected composer items vertically centered
|
||||
void on_mActionAlignVCenter_activated(void);
|
||||
void on_mActionAlignVCenter_activated( void );
|
||||
|
||||
//!Align selected composer items to bottom
|
||||
void on_mActionAlignBottom_activated(void);
|
||||
void on_mActionAlignBottom_activated( void );
|
||||
|
||||
//! Save window state
|
||||
void saveWindowState();
|
||||
@ -243,8 +243,8 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
|
||||
//! Changes elements that are not suitable for this project
|
||||
void cleanupAfterTemplateRead();
|
||||
|
||||
//! Writes state under DOM element
|
||||
void writeXML(QDomNode& parentNode, QDomDocument& doc);
|
||||
//! Writes state under DOM element
|
||||
void writeXML( QDomNode& parentNode, QDomDocument& doc );
|
||||
//! Pointer to composer view
|
||||
QgsComposerView *mView;
|
||||
|
||||
|
@ -152,11 +152,11 @@ void QgsComposerItemWidget::setValuesForGuiElements()
|
||||
|
||||
void QgsComposerItemWidget::on_mPositionButton_clicked()
|
||||
{
|
||||
if(!mItem)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( !mItem )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QgsItemPositionDialog d(mItem, 0);
|
||||
QgsItemPositionDialog d( mItem, 0 );
|
||||
d.exec();
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QWidg
|
||||
mYMaxLineEdit->setValidator( new QDoubleValidator( 0 ) );
|
||||
|
||||
mPreviewModeComboBox->insertItem( 0, tr( "Cache" ) );
|
||||
mPreviewModeComboBox->insertItem(1, tr("Render"));
|
||||
mPreviewModeComboBox->insertItem( 1, tr( "Render" ) );
|
||||
mPreviewModeComboBox->insertItem( 2, tr( "Rectangle" ) );
|
||||
|
||||
if ( composerMap )
|
||||
|
@ -41,7 +41,7 @@ QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture
|
||||
|
||||
setGuiElementValues();
|
||||
|
||||
mPreviewListWidget->setIconSize(QSize(30, 30));
|
||||
mPreviewListWidget->setIconSize( QSize( 30, 30 ) );
|
||||
|
||||
//add preview icons
|
||||
addStandardDirectoriesToPreview();
|
||||
@ -155,45 +155,45 @@ void QgsComposerPictureWidget::on_mRotationSpinBox_valueChanged( double d )
|
||||
|
||||
void QgsComposerPictureWidget::on_mPreviewListWidget_currentItemChanged( QListWidgetItem* current, QListWidgetItem* previous )
|
||||
{
|
||||
if(!mPicture || !current)
|
||||
if ( !mPicture || !current )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString absoluteFilePath = current->data(Qt::UserRole).toString();
|
||||
mPicture->setPictureFile(absoluteFilePath);
|
||||
mPictureLineEdit->setText(absoluteFilePath);
|
||||
QString absoluteFilePath = current->data( Qt::UserRole ).toString();
|
||||
mPicture->setPictureFile( absoluteFilePath );
|
||||
mPictureLineEdit->setText( absoluteFilePath );
|
||||
mPicture->update();
|
||||
}
|
||||
|
||||
void QgsComposerPictureWidget::on_mAddDirectoryButton_clicked()
|
||||
{
|
||||
//let user select a directory
|
||||
QString directory = QFileDialog::getExistingDirectory(0, tr("Select new preview directory"));
|
||||
if(directory.isNull())
|
||||
QString directory = QFileDialog::getExistingDirectory( 0, tr( "Select new preview directory" ) );
|
||||
if ( directory.isNull() )
|
||||
{
|
||||
return; //dialog canceled by user
|
||||
}
|
||||
|
||||
//add entry to mSearchDirectoriesComboBox
|
||||
mSearchDirectoriesComboBox->addItem(directory);
|
||||
mSearchDirectoriesComboBox->addItem( directory );
|
||||
|
||||
//and add icons to the preview
|
||||
addDirectoryToPreview(directory);
|
||||
addDirectoryToPreview( directory );
|
||||
}
|
||||
|
||||
void QgsComposerPictureWidget::on_mRemoveDirectoryButton_clicked()
|
||||
{
|
||||
QString directoryToRemove = mSearchDirectoriesComboBox->currentText();
|
||||
mSearchDirectoriesComboBox->removeItem(mSearchDirectoriesComboBox->currentIndex());
|
||||
mSearchDirectoriesComboBox->removeItem( mSearchDirectoriesComboBox->currentIndex() );
|
||||
|
||||
//remove entries from back to front (to have the indices of existing items constant)
|
||||
for(int i = (mPreviewListWidget->count() - 1); i >=0; --i)
|
||||
for ( int i = ( mPreviewListWidget->count() - 1 ); i >= 0; --i )
|
||||
{
|
||||
QListWidgetItem* currentItem = mPreviewListWidget->item(i);
|
||||
if(currentItem && currentItem->data(Qt::UserRole).toString().startsWith(directoryToRemove))
|
||||
QListWidgetItem* currentItem = mPreviewListWidget->item( i );
|
||||
if ( currentItem && currentItem->data( Qt::UserRole ).toString().startsWith( directoryToRemove ) )
|
||||
{
|
||||
delete(mPreviewListWidget->takeItem(i));
|
||||
delete( mPreviewListWidget->takeItem( i ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -221,30 +221,30 @@ void QgsComposerPictureWidget::setGuiElementValues()
|
||||
}
|
||||
}
|
||||
|
||||
int QgsComposerPictureWidget::addDirectoryToPreview(const QString& path)
|
||||
int QgsComposerPictureWidget::addDirectoryToPreview( const QString& path )
|
||||
{
|
||||
//go through all files of a directory
|
||||
QDir directory(path);
|
||||
if(!directory.exists() || !directory.isReadable())
|
||||
QDir directory( path );
|
||||
if ( !directory.exists() || !directory.isReadable() )
|
||||
{
|
||||
return 1; //error
|
||||
}
|
||||
|
||||
QFileInfoList fileList = directory.entryInfoList(QDir::Files);
|
||||
QFileInfoList fileList = directory.entryInfoList( QDir::Files );
|
||||
QFileInfoList::const_iterator fileIt = fileList.constBegin();
|
||||
|
||||
QProgressDialog progress("Adding Icons...", "Abort", 0, fileList.size() - 1, this);
|
||||
QProgressDialog progress( "Adding Icons...", "Abort", 0, fileList.size() - 1, this );
|
||||
//cancel button does not seem to work properly with modal dialog
|
||||
//progress.setWindowModality(Qt::WindowModal);
|
||||
|
||||
int counter = 0;
|
||||
for(; fileIt != fileList.constEnd(); ++fileIt)
|
||||
for ( ; fileIt != fileList.constEnd(); ++fileIt )
|
||||
{
|
||||
|
||||
progress.setLabelText(tr("Creating icon for file ") + fileIt->fileName());
|
||||
progress.setValue(counter);
|
||||
progress.setLabelText( tr( "Creating icon for file " ) + fileIt->fileName() );
|
||||
progress.setValue( counter );
|
||||
QCoreApplication::processEvents();
|
||||
if(progress.wasCanceled())
|
||||
if ( progress.wasCanceled() )
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -252,45 +252,45 @@ int QgsComposerPictureWidget::addDirectoryToPreview(const QString& path)
|
||||
|
||||
//test if file is svg or pixel format
|
||||
bool fileIsPixel = false;
|
||||
bool fileIsSvg = testSvgFile(filePath);
|
||||
if(!fileIsSvg)
|
||||
{
|
||||
fileIsPixel = testImageFile(filePath);
|
||||
}
|
||||
bool fileIsSvg = testSvgFile( filePath );
|
||||
if ( !fileIsSvg )
|
||||
{
|
||||
fileIsPixel = testImageFile( filePath );
|
||||
}
|
||||
|
||||
//exclude files that are not svg or image
|
||||
if(!fileIsSvg && !fileIsPixel)
|
||||
if ( !fileIsSvg && !fileIsPixel )
|
||||
{
|
||||
++counter; continue;
|
||||
}
|
||||
|
||||
QListWidgetItem * listItem = new QListWidgetItem(mPreviewListWidget);
|
||||
QListWidgetItem * listItem = new QListWidgetItem( mPreviewListWidget );
|
||||
|
||||
if(fileIsSvg)
|
||||
if ( fileIsSvg )
|
||||
{
|
||||
QIcon icon(filePath);
|
||||
listItem->setIcon(icon);
|
||||
QIcon icon( filePath );
|
||||
listItem->setIcon( icon );
|
||||
}
|
||||
else if(fileIsPixel) //for pixel formats: create icon from scaled pixmap
|
||||
else if ( fileIsPixel ) //for pixel formats: create icon from scaled pixmap
|
||||
{
|
||||
QPixmap iconPixmap(filePath);
|
||||
if(iconPixmap.isNull())
|
||||
QPixmap iconPixmap( filePath );
|
||||
if ( iconPixmap.isNull() )
|
||||
{
|
||||
++counter; continue; //unknown file format or other problem
|
||||
}
|
||||
//set pixmap hardcoded to 30/30, same as icon size for mPreviewListWidget
|
||||
QPixmap scaledPixmap(iconPixmap.scaled(QSize(30, 30), Qt::KeepAspectRatio));
|
||||
QIcon icon(scaledPixmap);
|
||||
listItem->setIcon(icon);
|
||||
QPixmap scaledPixmap( iconPixmap.scaled( QSize( 30, 30 ), Qt::KeepAspectRatio ) );
|
||||
QIcon icon( scaledPixmap );
|
||||
listItem->setIcon( icon );
|
||||
}
|
||||
else
|
||||
{
|
||||
++counter; continue;
|
||||
}
|
||||
{
|
||||
++counter; continue;
|
||||
}
|
||||
|
||||
listItem->setText( "" );
|
||||
//store the absolute icon file path as user data
|
||||
listItem->setData( Qt::UserRole, fileIt->absoluteFilePath());
|
||||
listItem->setData( Qt::UserRole, fileIt->absoluteFilePath() );
|
||||
++counter;
|
||||
}
|
||||
|
||||
@ -300,37 +300,37 @@ int QgsComposerPictureWidget::addDirectoryToPreview(const QString& path)
|
||||
void QgsComposerPictureWidget::addStandardDirectoriesToPreview()
|
||||
{
|
||||
//list all directories in $prefix/share/qgis/svg
|
||||
QDir svgDirectory(QgsApplication::svgPath());
|
||||
if(!svgDirectory.exists() || !svgDirectory.isReadable())
|
||||
QDir svgDirectory( QgsApplication::svgPath() );
|
||||
if ( !svgDirectory.exists() || !svgDirectory.isReadable() )
|
||||
{
|
||||
return; //error
|
||||
return; //error
|
||||
}
|
||||
|
||||
QFileInfoList directoryList = svgDirectory.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
QFileInfoList directoryList = svgDirectory.entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );
|
||||
QFileInfoList::const_iterator dirIt = directoryList.constBegin();
|
||||
for(; dirIt != directoryList.constEnd(); ++dirIt)
|
||||
for ( ; dirIt != directoryList.constEnd(); ++dirIt )
|
||||
{
|
||||
if(addDirectoryToPreview(dirIt->absoluteFilePath()) == 0)
|
||||
if ( addDirectoryToPreview( dirIt->absoluteFilePath() ) == 0 )
|
||||
{
|
||||
mSearchDirectoriesComboBox->addItem(dirIt->absoluteFilePath());
|
||||
mSearchDirectoriesComboBox->addItem( dirIt->absoluteFilePath() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool QgsComposerPictureWidget::testSvgFile(const QString& filename) const
|
||||
bool QgsComposerPictureWidget::testSvgFile( const QString& filename ) const
|
||||
{
|
||||
QSvgRenderer svgRenderer(filename);
|
||||
if(svgRenderer.isValid())
|
||||
QSvgRenderer svgRenderer( filename );
|
||||
if ( svgRenderer.isValid() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QgsComposerPictureWidget::testImageFile(const QString& filename) const
|
||||
bool QgsComposerPictureWidget::testImageFile( const QString& filename ) const
|
||||
{
|
||||
QString formatName = QString(QImageReader::imageFormat(filename));
|
||||
if(!formatName.isEmpty())
|
||||
QString formatName = QString( QImageReader::imageFormat( filename ) );
|
||||
if ( !formatName.isEmpty() )
|
||||
{
|
||||
return true; //file is in a supported pixel format
|
||||
}
|
||||
|
@ -48,13 +48,13 @@ class QgsComposerPictureWidget: public QWidget, private Ui::QgsComposerPictureWi
|
||||
private:
|
||||
QgsComposerPicture* mPicture;
|
||||
/**Add the icons of a directory to the preview. Returns 0 in case of success*/
|
||||
int addDirectoryToPreview(const QString& path);
|
||||
int addDirectoryToPreview( const QString& path );
|
||||
/**Add the icons of the standard directories to the preview*/
|
||||
void addStandardDirectoriesToPreview();
|
||||
/**Tests if a file is valid svg*/
|
||||
bool testSvgFile(const QString& filename) const;
|
||||
bool testSvgFile( const QString& filename ) const;
|
||||
/**Tests if a file is a valid pixel format*/
|
||||
bool testImageFile(const QString& filename) const;
|
||||
bool testImageFile( const QString& filename ) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -45,13 +45,13 @@ QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c )
|
||||
mResolutionLineEdit->setText( QString::number( mComposition->printResolution() ) );
|
||||
|
||||
//snap grid
|
||||
if( mComposition->snapToGridEnabled() )
|
||||
if ( mComposition->snapToGridEnabled() )
|
||||
{
|
||||
mSnapToGridCheckBox->setCheckState(Qt::Checked);
|
||||
mSnapToGridCheckBox->setCheckState( Qt::Checked );
|
||||
}
|
||||
else
|
||||
{
|
||||
mSnapToGridCheckBox->setCheckState(Qt::Unchecked);
|
||||
mSnapToGridCheckBox->setCheckState( Qt::Unchecked );
|
||||
}
|
||||
mResolutionSpinBox->setValue( mComposition->snapGridResolution() );
|
||||
mOffsetXSpinBox->setValue( mComposition->snapGridOffsetX() );
|
||||
@ -59,26 +59,26 @@ QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c )
|
||||
|
||||
|
||||
//grid pen width
|
||||
mPenWidthSpinBox->blockSignals(true);
|
||||
mPenWidthSpinBox->setValue(mComposition->gridPen().widthF());
|
||||
mPenWidthSpinBox->blockSignals(false);
|
||||
mPenWidthSpinBox->blockSignals( true );
|
||||
mPenWidthSpinBox->setValue( mComposition->gridPen().widthF() );
|
||||
mPenWidthSpinBox->blockSignals( false );
|
||||
|
||||
//grid pen color
|
||||
mGridColorButton->blockSignals(true);
|
||||
mGridColorButton->setColor(mComposition->gridPen().color());
|
||||
mGridColorButton->blockSignals(false);
|
||||
mGridColorButton->blockSignals( true );
|
||||
mGridColorButton->setColor( mComposition->gridPen().color() );
|
||||
mGridColorButton->blockSignals( false );
|
||||
|
||||
mGridStyleComboBox->blockSignals(true);
|
||||
mGridStyleComboBox->insertItem( 0, tr("Solid"));
|
||||
mGridStyleComboBox->insertItem( 1, tr("Dots"));
|
||||
mGridStyleComboBox->insertItem( 2, tr("Crosses"));
|
||||
mGridStyleComboBox->blockSignals( true );
|
||||
mGridStyleComboBox->insertItem( 0, tr( "Solid" ) );
|
||||
mGridStyleComboBox->insertItem( 1, tr( "Dots" ) );
|
||||
mGridStyleComboBox->insertItem( 2, tr( "Crosses" ) );
|
||||
|
||||
QgsComposition::GridStyle snapGridStyle = mComposition->gridStyle();
|
||||
if(snapGridStyle == QgsComposition::Solid)
|
||||
if ( snapGridStyle == QgsComposition::Solid )
|
||||
{
|
||||
mGridStyleComboBox->setCurrentIndex( 0 );
|
||||
}
|
||||
else if(snapGridStyle == QgsComposition::Dots)
|
||||
else if ( snapGridStyle == QgsComposition::Dots )
|
||||
{
|
||||
mGridStyleComboBox->setCurrentIndex( 1 );
|
||||
}
|
||||
@ -86,7 +86,7 @@ QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c )
|
||||
{
|
||||
mGridStyleComboBox->setCurrentIndex( 2 );
|
||||
}
|
||||
mGridStyleComboBox->blockSignals(false);
|
||||
mGridStyleComboBox->blockSignals( false );
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,33 +322,33 @@ void QgsCompositionWidget::displayCompositionWidthHeight()
|
||||
|
||||
void QgsCompositionWidget::displaySnapingSettings()
|
||||
{
|
||||
if(!mComposition)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( !mComposition )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mSnapToGridCheckBox->blockSignals(true);
|
||||
mResolutionSpinBox->blockSignals(true);
|
||||
mOffsetXSpinBox->blockSignals(true);
|
||||
mOffsetYSpinBox->blockSignals(true);
|
||||
|
||||
if(mComposition->snapToGridEnabled())
|
||||
{
|
||||
mSnapToGridCheckBox->setCheckState(Qt::Checked);
|
||||
}
|
||||
mSnapToGridCheckBox->blockSignals( true );
|
||||
mResolutionSpinBox->blockSignals( true );
|
||||
mOffsetXSpinBox->blockSignals( true );
|
||||
mOffsetYSpinBox->blockSignals( true );
|
||||
|
||||
if ( mComposition->snapToGridEnabled() )
|
||||
{
|
||||
mSnapToGridCheckBox->setCheckState( Qt::Checked );
|
||||
}
|
||||
else
|
||||
{
|
||||
mSnapToGridCheckBox->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
{
|
||||
mSnapToGridCheckBox->setCheckState( Qt::Unchecked );
|
||||
}
|
||||
|
||||
mResolutionSpinBox->setValue(mComposition->snapGridResolution());
|
||||
mOffsetXSpinBox->setValue(mComposition->snapGridOffsetX());
|
||||
mOffsetYSpinBox->setValue(mComposition->snapGridOffsetY());
|
||||
mResolutionSpinBox->setValue( mComposition->snapGridResolution() );
|
||||
mOffsetXSpinBox->setValue( mComposition->snapGridOffsetX() );
|
||||
mOffsetYSpinBox->setValue( mComposition->snapGridOffsetY() );
|
||||
|
||||
mSnapToGridCheckBox->blockSignals(false);
|
||||
mResolutionSpinBox->blockSignals(false);
|
||||
mOffsetXSpinBox->blockSignals(false);
|
||||
mOffsetYSpinBox->blockSignals(false);
|
||||
mSnapToGridCheckBox->blockSignals( false );
|
||||
mResolutionSpinBox->blockSignals( false );
|
||||
mOffsetXSpinBox->blockSignals( false );
|
||||
mOffsetYSpinBox->blockSignals( false );
|
||||
}
|
||||
|
||||
void QgsCompositionWidget::on_mResolutionLineEdit_textChanged( const QString& text )
|
||||
@ -367,87 +367,87 @@ void QgsCompositionWidget::on_mResolutionLineEdit_textChanged( const QString& te
|
||||
}
|
||||
}
|
||||
|
||||
void QgsCompositionWidget::on_mSnapToGridCheckBox_stateChanged(int state)
|
||||
void QgsCompositionWidget::on_mSnapToGridCheckBox_stateChanged( int state )
|
||||
{
|
||||
if(mComposition)
|
||||
if ( mComposition )
|
||||
{
|
||||
if ( state == Qt::Checked )
|
||||
{
|
||||
if(state == Qt::Checked)
|
||||
{
|
||||
mComposition->setSnapToGridEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
mComposition->setSnapToGridEnabled(false);
|
||||
}
|
||||
mComposition->setSnapToGridEnabled( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
mComposition->setSnapToGridEnabled( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QgsCompositionWidget::on_mResolutionSpinBox_valueChanged(double d)
|
||||
void QgsCompositionWidget::on_mResolutionSpinBox_valueChanged( double d )
|
||||
{
|
||||
if(mComposition)
|
||||
{
|
||||
mComposition->setSnapGridResolution(d);
|
||||
}
|
||||
if ( mComposition )
|
||||
{
|
||||
mComposition->setSnapGridResolution( d );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsCompositionWidget::on_mOffsetXSpinBox_valueChanged(double d)
|
||||
void QgsCompositionWidget::on_mOffsetXSpinBox_valueChanged( double d )
|
||||
{
|
||||
if(mComposition)
|
||||
{
|
||||
mComposition->setSnapGridOffsetX(d);
|
||||
}
|
||||
if ( mComposition )
|
||||
{
|
||||
mComposition->setSnapGridOffsetX( d );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsCompositionWidget::on_mOffsetYSpinBox_valueChanged(double d)
|
||||
void QgsCompositionWidget::on_mOffsetYSpinBox_valueChanged( double d )
|
||||
{
|
||||
if(mComposition)
|
||||
{
|
||||
mComposition->setSnapGridOffsetY(d);
|
||||
}
|
||||
if ( mComposition )
|
||||
{
|
||||
mComposition->setSnapGridOffsetY( d );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsCompositionWidget::on_mGridColorButton_clicked()
|
||||
{
|
||||
QColor newColor = QColorDialog::getColor(mGridColorButton->color());
|
||||
if( !newColor.isValid() )
|
||||
QColor newColor = QColorDialog::getColor( mGridColorButton->color() );
|
||||
if ( !newColor.isValid() )
|
||||
{
|
||||
return ; //dialog canceled by user
|
||||
}
|
||||
mGridColorButton->setColor(newColor);
|
||||
mGridColorButton->setColor( newColor );
|
||||
|
||||
if(mComposition)
|
||||
if ( mComposition )
|
||||
{
|
||||
QPen pen = mComposition->gridPen();
|
||||
pen.setColor(newColor);
|
||||
mComposition->setGridPen(pen);
|
||||
pen.setColor( newColor );
|
||||
mComposition->setGridPen( pen );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsCompositionWidget::on_mGridStyleComboBox_currentIndexChanged( const QString& text )
|
||||
{
|
||||
if(mComposition)
|
||||
if ( mComposition )
|
||||
{
|
||||
if( mGridStyleComboBox->currentText() == tr("Solid") )
|
||||
if ( mGridStyleComboBox->currentText() == tr( "Solid" ) )
|
||||
{
|
||||
mComposition->setGridStyle(QgsComposition::Solid);
|
||||
mComposition->setGridStyle( QgsComposition::Solid );
|
||||
}
|
||||
else if( mGridStyleComboBox->currentText() == tr("Dots") )
|
||||
else if ( mGridStyleComboBox->currentText() == tr( "Dots" ) )
|
||||
{
|
||||
mComposition->setGridStyle(QgsComposition::Dots);
|
||||
mComposition->setGridStyle( QgsComposition::Dots );
|
||||
}
|
||||
else if( mGridStyleComboBox->currentText() == tr("Crosses"))
|
||||
else if ( mGridStyleComboBox->currentText() == tr( "Crosses" ) )
|
||||
{
|
||||
mComposition->setGridStyle(QgsComposition::Crosses);
|
||||
mComposition->setGridStyle( QgsComposition::Crosses );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QgsCompositionWidget::on_mPenWidthSpinBox_valueChanged(double d)
|
||||
void QgsCompositionWidget::on_mPenWidthSpinBox_valueChanged( double d )
|
||||
{
|
||||
if(mComposition)
|
||||
if ( mComposition )
|
||||
{
|
||||
QPen pen = mComposition->gridPen();
|
||||
pen.setWidthF(d);
|
||||
mComposition->setGridPen(pen);
|
||||
pen.setWidthF( d );
|
||||
mComposition->setGridPen( pen );
|
||||
}
|
||||
}
|
||||
|
@ -46,13 +46,13 @@ class QgsCompositionWidget: public QWidget, private Ui::QgsCompositionWidgetBase
|
||||
void on_mPaperHeightLineEdit_editingFinished();
|
||||
void on_mResolutionLineEdit_textChanged( const QString& text );
|
||||
|
||||
void on_mSnapToGridCheckBox_stateChanged(int state);
|
||||
void on_mResolutionSpinBox_valueChanged(double d);
|
||||
void on_mOffsetXSpinBox_valueChanged(double d);
|
||||
void on_mOffsetYSpinBox_valueChanged(double d);
|
||||
void on_mSnapToGridCheckBox_stateChanged( int state );
|
||||
void on_mResolutionSpinBox_valueChanged( double d );
|
||||
void on_mOffsetXSpinBox_valueChanged( double d );
|
||||
void on_mOffsetYSpinBox_valueChanged( double d );
|
||||
void on_mGridColorButton_clicked();
|
||||
void on_mGridStyleComboBox_currentIndexChanged( const QString& text );
|
||||
void on_mPenWidthSpinBox_valueChanged(double d);
|
||||
void on_mPenWidthSpinBox_valueChanged( double d );
|
||||
|
||||
private:
|
||||
QgsComposition* mComposition;
|
||||
|
@ -20,93 +20,93 @@
|
||||
#include <QButtonGroup>
|
||||
#include <QDoubleValidator>
|
||||
|
||||
QgsItemPositionDialog::QgsItemPositionDialog(QgsComposerItem* item, QWidget* parent): QDialog(parent), mItem(item)
|
||||
QgsItemPositionDialog::QgsItemPositionDialog( QgsComposerItem* item, QWidget* parent ): QDialog( parent ), mItem( item )
|
||||
{
|
||||
setupUi(this);
|
||||
setupUi( this );
|
||||
|
||||
//make button exclusive
|
||||
QButtonGroup* buttonGroup = new QButtonGroup(this);
|
||||
buttonGroup->addButton(mUpperLeftCheckBox);
|
||||
buttonGroup->addButton(mUpperMiddleCheckBox);
|
||||
buttonGroup->addButton(mUpperRightCheckBox);
|
||||
buttonGroup->addButton(mMiddleLeftCheckBox);
|
||||
buttonGroup->addButton(mMiddleCheckBox);
|
||||
buttonGroup->addButton(mMiddleRightCheckBox);
|
||||
buttonGroup->addButton(mLowerLeftCheckBox);
|
||||
buttonGroup->addButton(mLowerMiddleCheckBox);
|
||||
buttonGroup->addButton(mLowerRightCheckBox);
|
||||
buttonGroup->setExclusive(true);
|
||||
QButtonGroup* buttonGroup = new QButtonGroup( this );
|
||||
buttonGroup->addButton( mUpperLeftCheckBox );
|
||||
buttonGroup->addButton( mUpperMiddleCheckBox );
|
||||
buttonGroup->addButton( mUpperRightCheckBox );
|
||||
buttonGroup->addButton( mMiddleLeftCheckBox );
|
||||
buttonGroup->addButton( mMiddleCheckBox );
|
||||
buttonGroup->addButton( mMiddleRightCheckBox );
|
||||
buttonGroup->addButton( mLowerLeftCheckBox );
|
||||
buttonGroup->addButton( mLowerMiddleCheckBox );
|
||||
buttonGroup->addButton( mLowerRightCheckBox );
|
||||
buttonGroup->setExclusive( true );
|
||||
|
||||
mXLineEdit->setValidator(new QDoubleValidator(0));
|
||||
mYLineEdit->setValidator(new QDoubleValidator(0));
|
||||
mXLineEdit->setValidator( new QDoubleValidator( 0 ) );
|
||||
mYLineEdit->setValidator( new QDoubleValidator( 0 ) );
|
||||
|
||||
//set lower left position of item
|
||||
mUpperLeftCheckBox->setCheckState(Qt::Checked);
|
||||
mUpperLeftCheckBox->setCheckState( Qt::Checked );
|
||||
}
|
||||
|
||||
QgsItemPositionDialog::QgsItemPositionDialog(): mItem(0)
|
||||
QgsItemPositionDialog::QgsItemPositionDialog(): mItem( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
QgsItemPositionDialog::~QgsItemPositionDialog()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
int QgsItemPositionDialog::position(QgsPoint& point) const
|
||||
int QgsItemPositionDialog::position( QgsPoint& point ) const
|
||||
{
|
||||
bool convXSuccess, convYSuccess;
|
||||
double x = mXLineEdit->text().toDouble(&convXSuccess);
|
||||
double y = mYLineEdit->text().toDouble(&convYSuccess);
|
||||
double x = mXLineEdit->text().toDouble( &convXSuccess );
|
||||
double y = mYLineEdit->text().toDouble( &convYSuccess );
|
||||
|
||||
if(!convXSuccess || !convYSuccess)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if ( !convXSuccess || !convYSuccess )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
point.setX(x);
|
||||
point.setY(y);
|
||||
point.setX( x );
|
||||
point.setY( y );
|
||||
return 0;
|
||||
}
|
||||
|
||||
QgsComposerItem::ItemPositionMode QgsItemPositionDialog::positionMode() const
|
||||
{
|
||||
if(mUpperLeftCheckBox->checkState() == Qt::Checked)
|
||||
{
|
||||
return QgsComposerItem::UpperLeft;
|
||||
}
|
||||
else if(mUpperMiddleCheckBox->checkState() == Qt::Checked)
|
||||
{
|
||||
return QgsComposerItem::UpperMiddle;
|
||||
}
|
||||
else if(mUpperRightCheckBox->checkState() == Qt::Checked)
|
||||
{
|
||||
return QgsComposerItem::UpperRight;
|
||||
}
|
||||
else if(mMiddleLeftCheckBox->checkState() == Qt::Checked)
|
||||
{
|
||||
return QgsComposerItem::MiddleLeft;
|
||||
}
|
||||
else if(mMiddleCheckBox->checkState() == Qt::Checked)
|
||||
{
|
||||
return QgsComposerItem::Middle;
|
||||
}
|
||||
else if(mMiddleRightCheckBox->checkState() == Qt::Checked)
|
||||
{
|
||||
return QgsComposerItem::MiddleRight;
|
||||
}
|
||||
else if(mLowerLeftCheckBox->checkState() == Qt::Checked)
|
||||
{
|
||||
return QgsComposerItem::LowerLeft;
|
||||
}
|
||||
else if(mLowerMiddleCheckBox->checkState() == Qt::Checked)
|
||||
{
|
||||
return QgsComposerItem::LowerMiddle;
|
||||
}
|
||||
else if(mLowerRightCheckBox->checkState() == Qt::Checked)
|
||||
{
|
||||
return QgsComposerItem::LowerRight;
|
||||
}
|
||||
if ( mUpperLeftCheckBox->checkState() == Qt::Checked )
|
||||
{
|
||||
return QgsComposerItem::UpperLeft;
|
||||
}
|
||||
else if ( mUpperMiddleCheckBox->checkState() == Qt::Checked )
|
||||
{
|
||||
return QgsComposerItem::UpperMiddle;
|
||||
}
|
||||
else if ( mUpperRightCheckBox->checkState() == Qt::Checked )
|
||||
{
|
||||
return QgsComposerItem::UpperRight;
|
||||
}
|
||||
else if ( mMiddleLeftCheckBox->checkState() == Qt::Checked )
|
||||
{
|
||||
return QgsComposerItem::MiddleLeft;
|
||||
}
|
||||
else if ( mMiddleCheckBox->checkState() == Qt::Checked )
|
||||
{
|
||||
return QgsComposerItem::Middle;
|
||||
}
|
||||
else if ( mMiddleRightCheckBox->checkState() == Qt::Checked )
|
||||
{
|
||||
return QgsComposerItem::MiddleRight;
|
||||
}
|
||||
else if ( mLowerLeftCheckBox->checkState() == Qt::Checked )
|
||||
{
|
||||
return QgsComposerItem::LowerLeft;
|
||||
}
|
||||
else if ( mLowerMiddleCheckBox->checkState() == Qt::Checked )
|
||||
{
|
||||
return QgsComposerItem::LowerMiddle;
|
||||
}
|
||||
else if ( mLowerRightCheckBox->checkState() == Qt::Checked )
|
||||
{
|
||||
return QgsComposerItem::LowerRight;
|
||||
}
|
||||
return QgsComposerItem::UpperLeft;
|
||||
}
|
||||
|
||||
@ -117,98 +117,98 @@ void QgsItemPositionDialog::on_mCloseButton_clicked()
|
||||
|
||||
void QgsItemPositionDialog::on_mSetPositionButton_clicked()
|
||||
{
|
||||
if(!mItem)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( !mItem )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QgsPoint itemPosition;
|
||||
if(position(itemPosition) == 0)
|
||||
{
|
||||
//query position and mode from dialog
|
||||
mItem->setItemPosition(itemPosition.x(), itemPosition.y(), positionMode());
|
||||
mItem->update();
|
||||
}
|
||||
if ( position( itemPosition ) == 0 )
|
||||
{
|
||||
//query position and mode from dialog
|
||||
mItem->setItemPosition( itemPosition.x(), itemPosition.y(), positionMode() );
|
||||
mItem->update();
|
||||
}
|
||||
}
|
||||
|
||||
void QgsItemPositionDialog::on_mUpperLeftCheckBox_stateChanged(int state)
|
||||
void QgsItemPositionDialog::on_mUpperLeftCheckBox_stateChanged( int state )
|
||||
{
|
||||
if(state == Qt::Checked && mItem)
|
||||
{
|
||||
mXLineEdit->setText(QString::number(mItem->transform().dx()));
|
||||
mYLineEdit->setText(QString::number(mItem->transform().dy()));
|
||||
}
|
||||
if ( state == Qt::Checked && mItem )
|
||||
{
|
||||
mXLineEdit->setText( QString::number( mItem->transform().dx() ) );
|
||||
mYLineEdit->setText( QString::number( mItem->transform().dy() ) );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsItemPositionDialog::on_mUpperMiddleCheckBox_stateChanged(int state)
|
||||
void QgsItemPositionDialog::on_mUpperMiddleCheckBox_stateChanged( int state )
|
||||
{
|
||||
|
||||
if(state == Qt::Checked && mItem)
|
||||
{
|
||||
mXLineEdit->setText(QString::number(mItem->transform().dx() + mItem->rect().width() / 2.0));
|
||||
mYLineEdit->setText(QString::number(mItem->transform().dy()));
|
||||
}
|
||||
}
|
||||
|
||||
void QgsItemPositionDialog::on_mUpperRightCheckBox_stateChanged(int state)
|
||||
{
|
||||
if(state == Qt::Checked && mItem)
|
||||
{
|
||||
mXLineEdit->setText(QString::number(mItem->transform().dx() + mItem->rect().width()));
|
||||
mYLineEdit->setText(QString::number(mItem->transform().dy()));
|
||||
}
|
||||
|
||||
if ( state == Qt::Checked && mItem )
|
||||
{
|
||||
mXLineEdit->setText( QString::number( mItem->transform().dx() + mItem->rect().width() / 2.0 ) );
|
||||
mYLineEdit->setText( QString::number( mItem->transform().dy() ) );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsItemPositionDialog::on_mMiddleLeftCheckBox_stateChanged(int state)
|
||||
void QgsItemPositionDialog::on_mUpperRightCheckBox_stateChanged( int state )
|
||||
{
|
||||
if(state == Qt::Checked && mItem)
|
||||
{
|
||||
mXLineEdit->setText(QString::number(mItem->transform().dx()));
|
||||
mYLineEdit->setText(QString::number(mItem->transform().dy() + mItem->rect().height() / 2.0));
|
||||
}
|
||||
if ( state == Qt::Checked && mItem )
|
||||
{
|
||||
mXLineEdit->setText( QString::number( mItem->transform().dx() + mItem->rect().width() ) );
|
||||
mYLineEdit->setText( QString::number( mItem->transform().dy() ) );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsItemPositionDialog::on_mMiddleCheckBox_stateChanged(int state)
|
||||
void QgsItemPositionDialog::on_mMiddleLeftCheckBox_stateChanged( int state )
|
||||
{
|
||||
if(state == Qt::Checked && mItem)
|
||||
{
|
||||
mXLineEdit->setText(QString::number(mItem->transform().dx() + mItem->rect().width() / 2.0));
|
||||
mYLineEdit->setText(QString::number(mItem->transform().dy() + mItem->rect().height() / 2.0));
|
||||
}
|
||||
if ( state == Qt::Checked && mItem )
|
||||
{
|
||||
mXLineEdit->setText( QString::number( mItem->transform().dx() ) );
|
||||
mYLineEdit->setText( QString::number( mItem->transform().dy() + mItem->rect().height() / 2.0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsItemPositionDialog::on_mMiddleRightCheckBox_stateChanged(int state)
|
||||
void QgsItemPositionDialog::on_mMiddleCheckBox_stateChanged( int state )
|
||||
{
|
||||
if(state == Qt::Checked && mItem)
|
||||
{
|
||||
mXLineEdit->setText(QString::number(mItem->transform().dx() + mItem->rect().width()));
|
||||
mYLineEdit->setText(QString::number(mItem->transform().dy() + mItem->rect().height() / 2.0));
|
||||
}
|
||||
if ( state == Qt::Checked && mItem )
|
||||
{
|
||||
mXLineEdit->setText( QString::number( mItem->transform().dx() + mItem->rect().width() / 2.0 ) );
|
||||
mYLineEdit->setText( QString::number( mItem->transform().dy() + mItem->rect().height() / 2.0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsItemPositionDialog::on_mLowerLeftCheckBox_stateChanged(int state)
|
||||
void QgsItemPositionDialog::on_mMiddleRightCheckBox_stateChanged( int state )
|
||||
{
|
||||
if(state == Qt::Checked && mItem)
|
||||
{
|
||||
mXLineEdit->setText(QString::number(mItem->transform().dx()));
|
||||
mYLineEdit->setText(QString::number(mItem->transform().dy() + mItem->rect().height()));
|
||||
}
|
||||
if ( state == Qt::Checked && mItem )
|
||||
{
|
||||
mXLineEdit->setText( QString::number( mItem->transform().dx() + mItem->rect().width() ) );
|
||||
mYLineEdit->setText( QString::number( mItem->transform().dy() + mItem->rect().height() / 2.0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsItemPositionDialog::on_mLowerMiddleCheckBox_stateChanged(int state)
|
||||
void QgsItemPositionDialog::on_mLowerLeftCheckBox_stateChanged( int state )
|
||||
{
|
||||
if(state == Qt::Checked && mItem)
|
||||
{
|
||||
mXLineEdit->setText(QString::number(mItem->transform().dx() + mItem->rect().width() / 2.0));
|
||||
mYLineEdit->setText(QString::number(mItem->transform().dy() + mItem->rect().height()));
|
||||
}
|
||||
if ( state == Qt::Checked && mItem )
|
||||
{
|
||||
mXLineEdit->setText( QString::number( mItem->transform().dx() ) );
|
||||
mYLineEdit->setText( QString::number( mItem->transform().dy() + mItem->rect().height() ) );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsItemPositionDialog::on_mLowerRightCheckBox_stateChanged(int state)
|
||||
void QgsItemPositionDialog::on_mLowerMiddleCheckBox_stateChanged( int state )
|
||||
{
|
||||
if(state == Qt::Checked && mItem)
|
||||
{
|
||||
mXLineEdit->setText(QString::number(mItem->transform().dx() + mItem->rect().width()));
|
||||
mYLineEdit->setText(QString::number(mItem->transform().dy() + mItem->rect().height()));
|
||||
}
|
||||
if ( state == Qt::Checked && mItem )
|
||||
{
|
||||
mXLineEdit->setText( QString::number( mItem->transform().dx() + mItem->rect().width() / 2.0 ) );
|
||||
mYLineEdit->setText( QString::number( mItem->transform().dy() + mItem->rect().height() ) );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsItemPositionDialog::on_mLowerRightCheckBox_stateChanged( int state )
|
||||
{
|
||||
if ( state == Qt::Checked && mItem )
|
||||
{
|
||||
mXLineEdit->setText( QString::number( mItem->transform().dx() + mItem->rect().width() ) );
|
||||
mYLineEdit->setText( QString::number( mItem->transform().dy() + mItem->rect().height() ) );
|
||||
}
|
||||
}
|
||||
|
@ -25,37 +25,37 @@ class QgsPoint;
|
||||
/**A dialog to set the position of upper/middle/lower left/middle/lower point of an item*/
|
||||
class QgsItemPositionDialog: public QDialog, private Ui::QgsItemPositionDialogBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QgsItemPositionDialog(QgsComposerItem* item, QWidget* parent = 0);
|
||||
~QgsItemPositionDialog();
|
||||
Q_OBJECT
|
||||
public:
|
||||
QgsItemPositionDialog( QgsComposerItem* item, QWidget* parent = 0 );
|
||||
~QgsItemPositionDialog();
|
||||
|
||||
/**Get selected x- and y-coordinate as point. Returns 0 in case of success*/
|
||||
int position(QgsPoint& point) const;
|
||||
/**A combination of upper/middle/lower and left/middle/right*/
|
||||
QgsComposerItem::ItemPositionMode positionMode() const;
|
||||
/**Get selected x- and y-coordinate as point. Returns 0 in case of success*/
|
||||
int position( QgsPoint& point ) const;
|
||||
/**A combination of upper/middle/lower and left/middle/right*/
|
||||
QgsComposerItem::ItemPositionMode positionMode() const;
|
||||
|
||||
public slots:
|
||||
public slots:
|
||||
|
||||
void on_mCloseButton_clicked();
|
||||
void on_mSetPositionButton_clicked();
|
||||
void on_mCloseButton_clicked();
|
||||
void on_mSetPositionButton_clicked();
|
||||
|
||||
//adjust coordinates in line edits
|
||||
void on_mUpperLeftCheckBox_stateChanged(int state);
|
||||
void on_mUpperMiddleCheckBox_stateChanged(int state);
|
||||
void on_mUpperRightCheckBox_stateChanged(int state);
|
||||
void on_mMiddleLeftCheckBox_stateChanged(int state);
|
||||
void on_mMiddleCheckBox_stateChanged(int state);
|
||||
void on_mMiddleRightCheckBox_stateChanged(int state);
|
||||
void on_mLowerLeftCheckBox_stateChanged(int state);
|
||||
void on_mLowerMiddleCheckBox_stateChanged(int state);
|
||||
void on_mLowerRightCheckBox_stateChanged(int state);
|
||||
//adjust coordinates in line edits
|
||||
void on_mUpperLeftCheckBox_stateChanged( int state );
|
||||
void on_mUpperMiddleCheckBox_stateChanged( int state );
|
||||
void on_mUpperRightCheckBox_stateChanged( int state );
|
||||
void on_mMiddleLeftCheckBox_stateChanged( int state );
|
||||
void on_mMiddleCheckBox_stateChanged( int state );
|
||||
void on_mMiddleRightCheckBox_stateChanged( int state );
|
||||
void on_mLowerLeftCheckBox_stateChanged( int state );
|
||||
void on_mLowerMiddleCheckBox_stateChanged( int state );
|
||||
void on_mLowerRightCheckBox_stateChanged( int state );
|
||||
|
||||
private:
|
||||
QgsComposerItem* mItem;
|
||||
private:
|
||||
QgsComposerItem* mItem;
|
||||
|
||||
//default constructor forbidden
|
||||
QgsItemPositionDialog();
|
||||
//default constructor forbidden
|
||||
QgsItemPositionDialog();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -241,7 +241,7 @@ int QgsAttributeTable::compareItems( QString s1, QString s2, bool ascending, boo
|
||||
{
|
||||
if ( alphanumeric )
|
||||
{
|
||||
int compareValue = QString::localeAwareCompare(s1, s2);
|
||||
int compareValue = QString::localeAwareCompare( s1, s2 );
|
||||
if ( compareValue > 0 )
|
||||
{
|
||||
if ( ascending )
|
||||
|
@ -460,14 +460,14 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
|
||||
if ( isDisabledAttributeValuesDlg )
|
||||
{
|
||||
if ( vlayer->addFeature( *f ) )
|
||||
{
|
||||
//add points to other features to keep topology up-to-date
|
||||
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
|
||||
if ( topologicalEditing )
|
||||
{
|
||||
//add points to other features to keep topology up-to-date
|
||||
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
|
||||
if ( topologicalEditing )
|
||||
{
|
||||
vlayer->addTopologicalPoints( f->geometry() );
|
||||
}
|
||||
vlayer->addTopologicalPoints( f->geometry() );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -64,26 +64,26 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
|
||||
leProxyPassword->setText( settings.value( "proxy/proxyPassword", "" ).toString() );
|
||||
|
||||
//available proxy types
|
||||
mProxyTypeComboBox->insertItem(0, "DefaultProxy");
|
||||
mProxyTypeComboBox->insertItem(1, "Socks5Proxy");
|
||||
mProxyTypeComboBox->insertItem(2, "HttpProxy");
|
||||
mProxyTypeComboBox->insertItem(3, "HttpCachingProxy");
|
||||
mProxyTypeComboBox->insertItem(4, "FtpCachingProxy");
|
||||
QString settingProxyType = settings.value("proxy/proxyType", "DefaultProxy").toString();
|
||||
mProxyTypeComboBox->setCurrentIndex(mProxyTypeComboBox->findText(settingProxyType));
|
||||
mProxyTypeComboBox->insertItem( 0, "DefaultProxy" );
|
||||
mProxyTypeComboBox->insertItem( 1, "Socks5Proxy" );
|
||||
mProxyTypeComboBox->insertItem( 2, "HttpProxy" );
|
||||
mProxyTypeComboBox->insertItem( 3, "HttpCachingProxy" );
|
||||
mProxyTypeComboBox->insertItem( 4, "FtpCachingProxy" );
|
||||
QString settingProxyType = settings.value( "proxy/proxyType", "DefaultProxy" ).toString();
|
||||
mProxyTypeComboBox->setCurrentIndex( mProxyTypeComboBox->findText( settingProxyType ) );
|
||||
|
||||
//URLs excluded not going through proxies
|
||||
QString proxyExcludedURLs = settings.value( "proxy/proxyExcludedUrls", "").toString();
|
||||
if(!proxyExcludedURLs.isEmpty())
|
||||
QString proxyExcludedURLs = settings.value( "proxy/proxyExcludedUrls", "" ).toString();
|
||||
if ( !proxyExcludedURLs.isEmpty() )
|
||||
{
|
||||
QStringList splittedUrls = proxyExcludedURLs.split("|");
|
||||
QStringList splittedUrls = proxyExcludedURLs.split( "|" );
|
||||
QStringList::const_iterator urlIt = splittedUrls.constBegin();
|
||||
for(; urlIt != splittedUrls.constEnd(); ++urlIt)
|
||||
for ( ; urlIt != splittedUrls.constEnd(); ++urlIt )
|
||||
{
|
||||
QListWidgetItem* newItem = new QListWidgetItem(mExcludeUrlListWidget);
|
||||
newItem->setText(*urlIt);
|
||||
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
mExcludeUrlListWidget->addItem(newItem);
|
||||
QListWidgetItem* newItem = new QListWidgetItem( mExcludeUrlListWidget );
|
||||
newItem->setText( *urlIt );
|
||||
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
|
||||
mExcludeUrlListWidget->addItem( newItem );
|
||||
}
|
||||
}
|
||||
|
||||
@ -288,19 +288,19 @@ void QgsOptions::saveOptions()
|
||||
settings.setValue( "proxy/proxyPort", leProxyPort->text() );
|
||||
settings.setValue( "proxy/proxyUser", leProxyUser->text() );
|
||||
settings.setValue( "proxy/proxyPassword", leProxyPassword->text() );
|
||||
settings.setValue( "proxy/proxyType", mProxyTypeComboBox->currentText());
|
||||
settings.setValue( "proxy/proxyType", mProxyTypeComboBox->currentText() );
|
||||
|
||||
//url to exclude from proxys
|
||||
QString proxyExcludeString;
|
||||
for(int i = 0; i < mExcludeUrlListWidget->count(); ++i)
|
||||
for ( int i = 0; i < mExcludeUrlListWidget->count(); ++i )
|
||||
{
|
||||
if(i != 0)
|
||||
if ( i != 0 )
|
||||
{
|
||||
proxyExcludeString += "|";
|
||||
}
|
||||
proxyExcludeString += mExcludeUrlListWidget->item(i)->text();
|
||||
proxyExcludeString += mExcludeUrlListWidget->item( i )->text();
|
||||
}
|
||||
settings.setValue( "proxy/proxyExcludedUrls", proxyExcludeString);
|
||||
settings.setValue( "proxy/proxyExcludedUrls", proxyExcludeString );
|
||||
|
||||
//general settings
|
||||
settings.setValue( "/Map/identifyRadius", spinBoxIdentifyValue->value() );
|
||||
@ -577,16 +577,16 @@ QStringList QgsOptions::i18nList()
|
||||
|
||||
void QgsOptions::on_mAddUrlPushButton_clicked()
|
||||
{
|
||||
QListWidgetItem* newItem = new QListWidgetItem(mExcludeUrlListWidget);
|
||||
newItem->setText("URL");
|
||||
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
mExcludeUrlListWidget->addItem(newItem);
|
||||
mExcludeUrlListWidget->setCurrentItem(newItem);
|
||||
QListWidgetItem* newItem = new QListWidgetItem( mExcludeUrlListWidget );
|
||||
newItem->setText( "URL" );
|
||||
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
|
||||
mExcludeUrlListWidget->addItem( newItem );
|
||||
mExcludeUrlListWidget->setCurrentItem( newItem );
|
||||
}
|
||||
|
||||
void QgsOptions::on_mRemoveUrlPushButton_clicked()
|
||||
{
|
||||
int currentRow = mExcludeUrlListWidget->currentRow();
|
||||
QListWidgetItem* itemToRemove = mExcludeUrlListWidget->takeItem(currentRow);
|
||||
QListWidgetItem* itemToRemove = mExcludeUrlListWidget->takeItem( currentRow );
|
||||
delete itemToRemove;
|
||||
}
|
||||
|
@ -187,15 +187,15 @@ void QgsServerSourceSelect::on_btnHelp_clicked()
|
||||
}
|
||||
|
||||
QgsNumericSortTreeWidgetItem *QgsServerSourceSelect::createItem(
|
||||
int id, const QStringList &names, QMap<int, QgsNumericSortTreeWidgetItem *> &items, int &layerAndStyleCount,
|
||||
const QMap<int,int> &layerParents, const QMap<int, QStringList> &layerParentNames )
|
||||
int id, const QStringList &names, QMap<int, QgsNumericSortTreeWidgetItem *> &items, int &layerAndStyleCount,
|
||||
const QMap<int, int> &layerParents, const QMap<int, QStringList> &layerParentNames )
|
||||
|
||||
{
|
||||
if( items.contains(id) )
|
||||
if ( items.contains( id ) )
|
||||
return items[id];
|
||||
|
||||
QgsNumericSortTreeWidgetItem *item;
|
||||
if( layerParents.contains( id ) )
|
||||
if ( layerParents.contains( id ) )
|
||||
{
|
||||
int parent = layerParents[ id ];
|
||||
item = new QgsNumericSortTreeWidgetItem( createItem( parent, layerParentNames[ parent ], items, layerAndStyleCount, layerParents, layerParentNames ) );
|
||||
@ -236,10 +236,10 @@ bool QgsServerSourceSelect::populateLayerList( QgsWmsProvider *wmsProvider )
|
||||
layer != layers.end();
|
||||
layer++ )
|
||||
{
|
||||
QgsNumericSortTreeWidgetItem *lItem = createItem(layer->orderId, QStringList() << layer->name << layer->title << layer->abstract, items, layerAndStyleCount, layerParents, layerParentNames );
|
||||
QgsNumericSortTreeWidgetItem *lItem = createItem( layer->orderId, QStringList() << layer->name << layer->title << layer->abstract, items, layerAndStyleCount, layerParents, layerParentNames );
|
||||
|
||||
lItem->setData( 0, Qt::UserRole, layer->name );
|
||||
lItem->setData( 0, Qt::UserRole+1, "" );
|
||||
lItem->setData( 0, Qt::UserRole + 1, "" );
|
||||
|
||||
// Also insert the styles
|
||||
// Layer Styles
|
||||
@ -254,7 +254,7 @@ bool QgsServerSourceSelect::populateLayerList( QgsWmsProvider *wmsProvider )
|
||||
lItem2->setText( 3, layer->style[j].abstract.simplified() );
|
||||
|
||||
lItem2->setData( 0, Qt::UserRole, layer->name );
|
||||
lItem2->setData( 0, Qt::UserRole+1, layer->style[j].name );
|
||||
lItem2->setData( 0, Qt::UserRole + 1, layer->style[j].name );
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,9 +263,9 @@ bool QgsServerSourceSelect::populateLayerList( QgsWmsProvider *wmsProvider )
|
||||
{
|
||||
btnAdd->setEnabled( TRUE );
|
||||
|
||||
if( lstLayers->topLevelItemCount()==1 )
|
||||
if ( lstLayers->topLevelItemCount() == 1 )
|
||||
{
|
||||
lstLayers->expandItem( lstLayers->topLevelItem(0) );
|
||||
lstLayers->expandItem( lstLayers->topLevelItem( 0 ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -467,12 +467,12 @@ void QgsServerSourceSelect::on_lstLayers_itemSelectionChanged()
|
||||
{
|
||||
QTreeWidgetItem *item = *it;
|
||||
|
||||
QString layerName = item->data(0, Qt::UserRole).toString();
|
||||
if( layerName.isEmpty() )
|
||||
QString layerName = item->data( 0, Qt::UserRole ).toString();
|
||||
if ( layerName.isEmpty() )
|
||||
continue;
|
||||
|
||||
newSelectedLayers << layerName;
|
||||
newSelectedStylesForSelectedLayers << item->data( 0, Qt::UserRole+1 ).toString();
|
||||
newSelectedStylesForSelectedLayers << item->data( 0, Qt::UserRole + 1 ).toString();
|
||||
|
||||
newSelectedStyleIdForLayer[layerName] = item->text( 0 );
|
||||
|
||||
|
@ -141,7 +141,7 @@ class QgsServerSourceSelect : public QDialog, private Ui::QgsServerSourceSelectB
|
||||
void populateImageEncodingGroup( QgsWmsProvider* wmsProvider );
|
||||
|
||||
//! create an item including possible parents
|
||||
QgsNumericSortTreeWidgetItem *createItem(int id, const QStringList &names, QMap<int, QgsNumericSortTreeWidgetItem *> &items, int &layerAndStyleCount, const QMap<int,int> &layerParents, const QMap<int, QStringList> &layerParentNames );
|
||||
QgsNumericSortTreeWidgetItem *createItem( int id, const QStringList &names, QMap<int, QgsNumericSortTreeWidgetItem *> &items, int &layerAndStyleCount, const QMap<int, int> &layerParents, const QMap<int, QStringList> &layerParentNames );
|
||||
|
||||
//! Returns a textual description for the EpsgCrsId number
|
||||
QString descriptionForEpsg( long epsg );
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#define FONT_WORKAROUND_SCALE 10 //scale factor for upscaling fontsize and downscaling painter
|
||||
|
||||
QgsComposerItem::QgsComposerItem( QgsComposition* composition, bool manageZValue): QGraphicsRectItem( 0 ), mComposition( composition ), mBoundingResizeRectangle( 0 ), mFrame( true )
|
||||
QgsComposerItem::QgsComposerItem( QgsComposition* composition, bool manageZValue ): QGraphicsRectItem( 0 ), mComposition( composition ), mBoundingResizeRectangle( 0 ), mFrame( true )
|
||||
{
|
||||
setFlag( QGraphicsItem::ItemIsSelectable, true );
|
||||
setAcceptsHoverEvents( true );
|
||||
@ -41,13 +41,13 @@ QgsComposerItem::QgsComposerItem( QgsComposition* composition, bool manageZValue
|
||||
setPen( defaultPen );
|
||||
|
||||
//let z-Value be managed by composition
|
||||
if ( mComposition && manageZValue)
|
||||
if ( mComposition && manageZValue )
|
||||
{
|
||||
mComposition->addItemToZList( this );
|
||||
}
|
||||
}
|
||||
|
||||
QgsComposerItem::QgsComposerItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition, bool manageZValue): QGraphicsRectItem( 0, 0, width, height, 0 ), mComposition( composition ), mBoundingResizeRectangle( 0 ), mFrame( true )
|
||||
QgsComposerItem::QgsComposerItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition, bool manageZValue ): QGraphicsRectItem( 0, 0, width, height, 0 ), mComposition( composition ), mBoundingResizeRectangle( 0 ), mFrame( true )
|
||||
{
|
||||
setFlag( QGraphicsItem::ItemIsSelectable, true );
|
||||
setAcceptsHoverEvents( true );
|
||||
@ -63,7 +63,7 @@ QgsComposerItem::QgsComposerItem( qreal x, qreal y, qreal width, qreal height, Q
|
||||
setPen( defaultPen );
|
||||
|
||||
//let z-Value be managed by composition
|
||||
if ( mComposition && manageZValue)
|
||||
if ( mComposition && manageZValue )
|
||||
{
|
||||
mComposition->addItemToZList( this );
|
||||
}
|
||||
@ -226,7 +226,7 @@ void QgsComposerItem::mouseMoveEvent( QGraphicsSceneMouseEvent * event )
|
||||
double diffY = event->lastScenePos().y() - mLastMouseEventPos.y();
|
||||
|
||||
double mx, my, rx, ry;
|
||||
changeItemRectangle(event->lastScenePos(), mMouseMoveStartPos, this, diffX, diffY, mBoundingResizeRectangle);
|
||||
changeItemRectangle( event->lastScenePos(), mMouseMoveStartPos, this, diffX, diffY, mBoundingResizeRectangle );
|
||||
}
|
||||
mLastMouseEventPos = event->lastScenePos();
|
||||
}
|
||||
@ -236,7 +236,7 @@ void QgsComposerItem::mousePressEvent( QGraphicsSceneMouseEvent * event )
|
||||
//set current position and type of mouse move action
|
||||
mMouseMoveStartPos = event->lastScenePos();
|
||||
mLastMouseEventPos = event->lastScenePos();
|
||||
mCurrentMouseMoveAction = mouseMoveActionForPosition(event->pos());
|
||||
mCurrentMouseMoveAction = mouseMoveActionForPosition( event->pos() );
|
||||
|
||||
//create and show bounding rectangle
|
||||
mBoundingResizeRectangle = new QGraphicsRectItem( 0 );
|
||||
@ -273,7 +273,7 @@ void QgsComposerItem::mouseReleaseEvent( QGraphicsSceneMouseEvent * event )
|
||||
}
|
||||
|
||||
double mx, my, rx, ry;
|
||||
changeItemRectangle(mouseMoveStopPoint, mMouseMoveStartPos, this, diffX, diffY, this);
|
||||
changeItemRectangle( mouseMoveStopPoint, mMouseMoveStartPos, this, diffX, diffY, this );
|
||||
|
||||
//reset default action
|
||||
mCurrentMouseMoveAction = QgsComposerItem::MoveItem;
|
||||
@ -370,15 +370,15 @@ QgsComposerItem::MouseMoveAction QgsComposerItem::mouseMoveActionForPosition( co
|
||||
return QgsComposerItem::MoveItem; //default
|
||||
}
|
||||
|
||||
void QgsComposerItem::changeItemRectangle(const QPointF& currentPosition, const QPointF& mouseMoveStartPos, const QGraphicsRectItem* originalItem, double dx, double dy, QGraphicsRectItem* changeItem)
|
||||
void QgsComposerItem::changeItemRectangle( const QPointF& currentPosition, const QPointF& mouseMoveStartPos, const QGraphicsRectItem* originalItem, double dx, double dy, QGraphicsRectItem* changeItem )
|
||||
{
|
||||
if(!changeItem || !originalItem || !mComposition)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( !changeItem || !originalItem || !mComposition )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double mx, my, rx, ry;
|
||||
QPointF snappedPosition = mComposition->snapPointToGrid(currentPosition);
|
||||
QPointF snappedPosition = mComposition->snapPointToGrid( currentPosition );
|
||||
//double diffX = snappedPosition.x() - mouseMoveStartPos.x();
|
||||
//double diffY = snappedPosition.y() - mouseMoveStartPos.y();
|
||||
double diffX = 0;
|
||||
@ -393,7 +393,7 @@ void QgsComposerItem::changeItemRectangle(const QPointF& currentPosition, const
|
||||
break;
|
||||
|
||||
case QgsComposerItem::ResizeDown:
|
||||
diffY = snappedPosition.y() - (originalItem->transform().dy() + originalItem->rect().height());
|
||||
diffY = snappedPosition.y() - ( originalItem->transform().dy() + originalItem->rect().height() );
|
||||
mx = 0; my = 0; rx = 0; ry = diffY;
|
||||
break;
|
||||
|
||||
@ -404,7 +404,7 @@ void QgsComposerItem::changeItemRectangle(const QPointF& currentPosition, const
|
||||
break;
|
||||
|
||||
case QgsComposerItem::ResizeRight:
|
||||
diffX = snappedPosition.x() - (originalItem->transform().dx() + originalItem->rect().width());
|
||||
diffX = snappedPosition.x() - ( originalItem->transform().dx() + originalItem->rect().width() );
|
||||
mx = 0; my = 0; rx = diffX, ry = 0;
|
||||
break;
|
||||
|
||||
@ -416,46 +416,46 @@ void QgsComposerItem::changeItemRectangle(const QPointF& currentPosition, const
|
||||
break;
|
||||
|
||||
case QgsComposerItem::ResizeRightDown:
|
||||
diffX = snappedPosition.x() - (originalItem->transform().dx() + originalItem->rect().width());
|
||||
diffY = snappedPosition.y() - (originalItem->transform().dy() + originalItem->rect().height());
|
||||
diffX = snappedPosition.x() - ( originalItem->transform().dx() + originalItem->rect().width() );
|
||||
diffY = snappedPosition.y() - ( originalItem->transform().dy() + originalItem->rect().height() );
|
||||
mx = 0; my = 0; rx = diffX, ry = diffY;
|
||||
break;
|
||||
|
||||
case QgsComposerItem::ResizeRightUp:
|
||||
diffX = snappedPosition.x() - (originalItem->transform().dx() + originalItem->rect().width());
|
||||
diffX = snappedPosition.x() - ( originalItem->transform().dx() + originalItem->rect().width() );
|
||||
diffY = snappedPosition.y() - originalItem->transform().dy();
|
||||
mx = 0; my = diffY, rx = diffX, ry = -diffY;
|
||||
break;
|
||||
|
||||
case QgsComposerItem::ResizeLeftDown:
|
||||
diffX = snappedPosition.x() - originalItem->transform().dx();
|
||||
diffY = snappedPosition.y() - (originalItem->transform().dy() + originalItem->rect().height());
|
||||
diffY = snappedPosition.y() - ( originalItem->transform().dy() + originalItem->rect().height() );
|
||||
mx = diffX, my = 0; rx = -diffX; ry = diffY;
|
||||
break;
|
||||
|
||||
case QgsComposerItem::MoveItem:
|
||||
|
||||
|
||||
//calculate total move difference
|
||||
double moveX = currentPosition.x() - mouseMoveStartPos.x();
|
||||
double moveY = currentPosition.y() - mouseMoveStartPos.y();
|
||||
|
||||
QPointF upperLeftPoint(originalItem->transform().dx() + moveX, originalItem->transform().dy() + moveY);
|
||||
QPointF snappedLeftPoint = mComposition->snapPointToGrid(upperLeftPoint);
|
||||
QPointF upperLeftPoint( originalItem->transform().dx() + moveX, originalItem->transform().dy() + moveY );
|
||||
QPointF snappedLeftPoint = mComposition->snapPointToGrid( upperLeftPoint );
|
||||
|
||||
double moveRectX = snappedLeftPoint.x() - originalItem->transform().dx();
|
||||
double moveRectY = snappedLeftPoint.y() - originalItem->transform().dy();
|
||||
|
||||
|
||||
QTransform moveTransform;
|
||||
moveTransform.translate(originalItem->transform().dx() + moveRectX, originalItem->transform().dy() + moveRectY);
|
||||
changeItem->setTransform(moveTransform);
|
||||
moveTransform.translate( originalItem->transform().dx() + moveRectX, originalItem->transform().dy() + moveRectY );
|
||||
changeItem->setTransform( moveTransform );
|
||||
return;
|
||||
}
|
||||
|
||||
QTransform itemTransform;
|
||||
itemTransform.translate(originalItem->transform().dx() + mx, originalItem->transform().dy() + my);
|
||||
changeItem->setTransform(itemTransform);
|
||||
QRectF itemRect(0, 0, originalItem->rect().width() + rx, originalItem->rect().height() + ry);
|
||||
changeItem->setRect(itemRect);
|
||||
itemTransform.translate( originalItem->transform().dx() + mx, originalItem->transform().dy() + my );
|
||||
changeItem->setTransform( itemTransform );
|
||||
QRectF itemRect( 0, 0, originalItem->rect().width() + rx, originalItem->rect().height() + ry );
|
||||
changeItem->setRect( itemRect );
|
||||
}
|
||||
|
||||
void QgsComposerItem::drawSelectionBoxes( QPainter* p )
|
||||
@ -497,7 +497,7 @@ void QgsComposerItem::move( double dx, double dy )
|
||||
setSceneRect( newSceneRect );
|
||||
}
|
||||
|
||||
void QgsComposerItem::setItemPosition(double x, double y, ItemPositionMode itemPoint)
|
||||
void QgsComposerItem::setItemPosition( double x, double y, ItemPositionMode itemPoint )
|
||||
{
|
||||
double width = rect().width();
|
||||
double height = rect().height();
|
||||
@ -506,26 +506,26 @@ void QgsComposerItem::setItemPosition(double x, double y, ItemPositionMode itemP
|
||||
double upperLeftY = y;
|
||||
|
||||
//adjust x-coordinate if placement is not done to a left point
|
||||
if(itemPoint == UpperMiddle || itemPoint == Middle || itemPoint == LowerMiddle)
|
||||
{
|
||||
upperLeftX -= width / 2.0;
|
||||
}
|
||||
else if(itemPoint == UpperRight || itemPoint == MiddleRight || itemPoint == LowerRight)
|
||||
{
|
||||
upperLeftX -= width;
|
||||
}
|
||||
if ( itemPoint == UpperMiddle || itemPoint == Middle || itemPoint == LowerMiddle )
|
||||
{
|
||||
upperLeftX -= width / 2.0;
|
||||
}
|
||||
else if ( itemPoint == UpperRight || itemPoint == MiddleRight || itemPoint == LowerRight )
|
||||
{
|
||||
upperLeftX -= width;
|
||||
}
|
||||
|
||||
//adjust y-coordinate if placement is not done to an upper point
|
||||
if(itemPoint == MiddleLeft || itemPoint == Middle || itemPoint == MiddleRight)
|
||||
{
|
||||
upperLeftY -= height / 2.0;
|
||||
}
|
||||
else if(itemPoint == LowerLeft || itemPoint == LowerMiddle || itemPoint == LowerRight)
|
||||
{
|
||||
upperLeftY -= height;
|
||||
}
|
||||
if ( itemPoint == MiddleLeft || itemPoint == Middle || itemPoint == MiddleRight )
|
||||
{
|
||||
upperLeftY -= height / 2.0;
|
||||
}
|
||||
else if ( itemPoint == LowerLeft || itemPoint == LowerMiddle || itemPoint == LowerRight )
|
||||
{
|
||||
upperLeftY -= height;
|
||||
}
|
||||
|
||||
setSceneRect(QRectF(upperLeftX, upperLeftY, width, height));
|
||||
setSceneRect( QRectF( upperLeftX, upperLeftY, width, height ) );
|
||||
}
|
||||
|
||||
void QgsComposerItem::setSceneRect( const QRectF& rectangle )
|
||||
|
@ -49,24 +49,24 @@ class CORE_EXPORT QgsComposerItem: public QGraphicsRectItem
|
||||
};
|
||||
|
||||
enum ItemPositionMode
|
||||
{
|
||||
UpperLeft,
|
||||
UpperMiddle,
|
||||
UpperRight,
|
||||
MiddleLeft,
|
||||
Middle,
|
||||
MiddleRight,
|
||||
LowerLeft,
|
||||
LowerMiddle,
|
||||
LowerRight
|
||||
};
|
||||
{
|
||||
UpperLeft,
|
||||
UpperMiddle,
|
||||
UpperRight,
|
||||
MiddleLeft,
|
||||
Middle,
|
||||
MiddleRight,
|
||||
LowerLeft,
|
||||
LowerMiddle,
|
||||
LowerRight
|
||||
};
|
||||
|
||||
/**Constructor
|
||||
/**Constructor
|
||||
@param manageZValue true if the z-Value of this object should be managed by mComposition*/
|
||||
QgsComposerItem( QgsComposition* composition, bool manageZValue = true);
|
||||
QgsComposerItem( QgsComposition* composition, bool manageZValue = true );
|
||||
/**Constructor with box position and composer object
|
||||
@param manageZValue true if the z-Value of this object should be managed by mComposition*/
|
||||
QgsComposerItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition, bool manageZValue = true);
|
||||
QgsComposerItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition, bool manageZValue = true );
|
||||
virtual ~QgsComposerItem();
|
||||
|
||||
/** \brief Set selected, selected item should be highlighted */
|
||||
@ -99,7 +99,7 @@ class CORE_EXPORT QgsComposerItem: public QGraphicsRectItem
|
||||
virtual void zoomContent( int delta, double x, double y ) {}
|
||||
|
||||
/**Moves the item to a new position (in canvas coordinates)*/
|
||||
void setItemPosition(double x, double y, ItemPositionMode itemPoint = UpperLeft);
|
||||
void setItemPosition( double x, double y, ItemPositionMode itemPoint = UpperLeft );
|
||||
|
||||
/**Sets this items bound in scene coordinates such that 1 item size units
|
||||
corresponds to 1 scene size unit*/
|
||||
@ -192,7 +192,7 @@ class CORE_EXPORT QgsComposerItem: public QGraphicsRectItem
|
||||
@param dy y-Change of mouse cursor
|
||||
@param changeItem Item to change size (can be the same as originalItem or a differen one)
|
||||
*/
|
||||
void changeItemRectangle(const QPointF& currentPosition, const QPointF& mouseMoveStartPos, const QGraphicsRectItem* originalItem, double dx, double dy, QGraphicsRectItem* changeItem);
|
||||
void changeItemRectangle( const QPointF& currentPosition, const QPointF& mouseMoveStartPos, const QGraphicsRectItem* originalItem, double dx, double dy, QGraphicsRectItem* changeItem );
|
||||
|
||||
/**Draw selection boxes around item*/
|
||||
virtual void drawSelectionBoxes( QPainter* p );
|
||||
|
@ -338,7 +338,7 @@ void QgsComposerLegend::drawPolygonSymbol( QPainter* p, QgsSymbol* s, double cur
|
||||
if ( paintDevice )
|
||||
{
|
||||
double rasterScaleFactor = ( paintDevice->logicalDpiX() + paintDevice->logicalDpiY() ) / 2.0 / 25.4;
|
||||
QgsRenderer::scaleBrush(symbolBrush, rasterScaleFactor);
|
||||
QgsRenderer::scaleBrush( symbolBrush, rasterScaleFactor );
|
||||
}
|
||||
p->setBrush( symbolBrush );
|
||||
p->setPen( s->pen() );
|
||||
|
@ -118,7 +118,7 @@ void QgsComposerMap::draw( QPainter *painter, const QgsRectangle& extent, const
|
||||
|
||||
//set antialiasing if enabled in options
|
||||
QSettings settings;
|
||||
if(settings.value( "/qgis/enable_anti_aliasing", false ).toBool())
|
||||
if ( settings.value( "/qgis/enable_anti_aliasing", false ).toBool() )
|
||||
{
|
||||
painter->setRenderHint( QPainter::Antialiasing );
|
||||
}
|
||||
@ -247,7 +247,7 @@ void QgsComposerMap::updateCachedImage( void )
|
||||
|
||||
void QgsComposerMap::renderModeUpdateCachedImage()
|
||||
{
|
||||
if(mPreviewMode == Render)
|
||||
if ( mPreviewMode == Render )
|
||||
{
|
||||
updateCachedImage();
|
||||
}
|
||||
|
@ -23,12 +23,12 @@
|
||||
#include <QGraphicsRectItem>
|
||||
#include <QSettings>
|
||||
|
||||
QgsComposition::QgsComposition( QgsMapRenderer* mapRenderer ): QGraphicsScene( 0 ), mMapRenderer( mapRenderer ), mPlotStyle( QgsComposition::Preview ), mPaperItem( 0 ), mSnapToGrid(false), mSnapGridResolution(0.0), mSnapGridOffsetX(0.0), mSnapGridOffsetY(0.0)
|
||||
QgsComposition::QgsComposition( QgsMapRenderer* mapRenderer ): QGraphicsScene( 0 ), mMapRenderer( mapRenderer ), mPlotStyle( QgsComposition::Preview ), mPaperItem( 0 ), mSnapToGrid( false ), mSnapGridResolution( 0.0 ), mSnapGridOffsetX( 0.0 ), mSnapGridOffsetY( 0.0 )
|
||||
{
|
||||
setBackgroundBrush( Qt::gray );
|
||||
|
||||
//set paper item
|
||||
mPaperItem = new QgsPaperItem( 0, 0, 297, 210, this); //default size A4
|
||||
mPaperItem = new QgsPaperItem( 0, 0, 297, 210, this ); //default size A4
|
||||
mPaperItem->setBrush( Qt::white );
|
||||
addItem( mPaperItem );
|
||||
mPaperItem->setZValue( 0 );
|
||||
@ -36,7 +36,7 @@ QgsComposition::QgsComposition( QgsMapRenderer* mapRenderer ): QGraphicsScene( 0
|
||||
loadGridAppearanceSettings();
|
||||
}
|
||||
|
||||
QgsComposition::QgsComposition(): QGraphicsScene( 0 ), mMapRenderer( 0 ), mPlotStyle( QgsComposition::Preview ), mPaperItem( 0 ), mSnapToGrid(false), mSnapGridResolution(0.0), mSnapGridOffsetX(0.0), mSnapGridOffsetY(0.0)
|
||||
QgsComposition::QgsComposition(): QGraphicsScene( 0 ), mMapRenderer( 0 ), mPlotStyle( QgsComposition::Preview ), mPaperItem( 0 ), mSnapToGrid( false ), mSnapGridResolution( 0.0 ), mSnapGridOffsetX( 0.0 ), mSnapGridOffsetY( 0.0 )
|
||||
{
|
||||
saveGridAppearanceSettings();
|
||||
}
|
||||
@ -166,17 +166,17 @@ bool QgsComposition::writeXML( QDomElement& composerElem, QDomDocument& doc )
|
||||
}
|
||||
|
||||
//snapping
|
||||
if(mSnapToGrid)
|
||||
if ( mSnapToGrid )
|
||||
{
|
||||
compositionElem.setAttribute( "snapping", "1");
|
||||
compositionElem.setAttribute( "snapping", "1" );
|
||||
}
|
||||
else
|
||||
{
|
||||
compositionElem.setAttribute( "snapping", "0");
|
||||
compositionElem.setAttribute( "snapping", "0" );
|
||||
}
|
||||
compositionElem.setAttribute("snapGridResolution", mSnapGridResolution);
|
||||
compositionElem.setAttribute("snapGridOffsetX", mSnapGridOffsetX);
|
||||
compositionElem.setAttribute("snapGridOffsetY", mSnapGridOffsetY);
|
||||
compositionElem.setAttribute( "snapGridResolution", mSnapGridResolution );
|
||||
compositionElem.setAttribute( "snapGridOffsetX", mSnapGridOffsetX );
|
||||
compositionElem.setAttribute( "snapGridOffsetY", mSnapGridOffsetY );
|
||||
|
||||
composerElem.appendChild( compositionElem );
|
||||
|
||||
@ -198,14 +198,14 @@ bool QgsComposition::readXML( const QDomElement& compositionElem, const QDomDocu
|
||||
if ( widthConversionOk && heightConversionOk )
|
||||
{
|
||||
delete mPaperItem;
|
||||
mPaperItem = new QgsPaperItem( 0, 0, paperWidth, paperHeight, this);
|
||||
mPaperItem = new QgsPaperItem( 0, 0, paperWidth, paperHeight, this );
|
||||
mPaperItem->setBrush( Qt::white );
|
||||
addItem( mPaperItem );
|
||||
mPaperItem->setZValue( 0 );
|
||||
}
|
||||
|
||||
//snapping
|
||||
if(compositionElem.attribute("snapping") == "0")
|
||||
if ( compositionElem.attribute( "snapping" ) == "0" )
|
||||
{
|
||||
mSnapToGrid = false;
|
||||
}
|
||||
@ -213,11 +213,11 @@ bool QgsComposition::readXML( const QDomElement& compositionElem, const QDomDocu
|
||||
{
|
||||
mSnapToGrid = true;
|
||||
}
|
||||
mSnapGridResolution = compositionElem.attribute("snapGridResolution").toDouble();
|
||||
mSnapGridOffsetX = compositionElem.attribute("snapGridOffsetX").toDouble();
|
||||
mSnapGridOffsetY = compositionElem.attribute("snapGridOffsetY").toDouble();
|
||||
mSnapGridResolution = compositionElem.attribute( "snapGridResolution" ).toDouble();
|
||||
mSnapGridOffsetX = compositionElem.attribute( "snapGridOffsetX" ).toDouble();
|
||||
mSnapGridOffsetY = compositionElem.attribute( "snapGridOffsetY" ).toDouble();
|
||||
|
||||
if(mPaperItem)
|
||||
if ( mPaperItem )
|
||||
{
|
||||
mPaperItem->update();
|
||||
}
|
||||
@ -357,151 +357,151 @@ void QgsComposition::moveItemToBottom( QgsComposerItem* item )
|
||||
void QgsComposition::alignSelectedItemsLeft()
|
||||
{
|
||||
QList<QgsComposerItem*> selectedItems = selectedComposerItems();
|
||||
if(selectedItems.size() < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( selectedItems.size() < 2 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QRectF selectedItemBBox;
|
||||
if(boundingRectOfSelectedItems(selectedItemBBox) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( boundingRectOfSelectedItems( selectedItemBBox ) != 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double minXCoordinate = selectedItemBBox.left();
|
||||
|
||||
//align items left to minimum x coordinate
|
||||
QList<QgsComposerItem*>::iterator align_it = selectedItems.begin();
|
||||
for(; align_it != selectedItems.end(); ++align_it)
|
||||
{
|
||||
QTransform itemTransform = (*align_it)->transform();
|
||||
itemTransform.translate( minXCoordinate - itemTransform.dx(), 0);
|
||||
(*align_it)->setTransform(itemTransform);
|
||||
}
|
||||
for ( ; align_it != selectedItems.end(); ++align_it )
|
||||
{
|
||||
QTransform itemTransform = ( *align_it )->transform();
|
||||
itemTransform.translate( minXCoordinate - itemTransform.dx(), 0 );
|
||||
( *align_it )->setTransform( itemTransform );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposition::alignSelectedItemsHCenter()
|
||||
{
|
||||
QList<QgsComposerItem*> selectedItems = selectedComposerItems();
|
||||
if(selectedItems.size() < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( selectedItems.size() < 2 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QRectF selectedItemBBox;
|
||||
if(boundingRectOfSelectedItems(selectedItemBBox) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( boundingRectOfSelectedItems( selectedItemBBox ) != 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double averageXCoord = (selectedItemBBox.left() + selectedItemBBox.right()) / 2.0;
|
||||
double averageXCoord = ( selectedItemBBox.left() + selectedItemBBox.right() ) / 2.0;
|
||||
|
||||
//place items
|
||||
QList<QgsComposerItem*>::iterator align_it = selectedItems.begin();
|
||||
for(; align_it != selectedItems.end(); ++align_it)
|
||||
{
|
||||
QTransform itemTransform = (*align_it)->transform();
|
||||
itemTransform.translate( averageXCoord - itemTransform.dx() - (*align_it)->rect().width() / 2.0, 0);
|
||||
(*align_it)->setTransform(itemTransform);
|
||||
}
|
||||
for ( ; align_it != selectedItems.end(); ++align_it )
|
||||
{
|
||||
QTransform itemTransform = ( *align_it )->transform();
|
||||
itemTransform.translate( averageXCoord - itemTransform.dx() - ( *align_it )->rect().width() / 2.0, 0 );
|
||||
( *align_it )->setTransform( itemTransform );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposition::alignSelectedItemsRight()
|
||||
{
|
||||
QList<QgsComposerItem*> selectedItems = selectedComposerItems();
|
||||
if(selectedItems.size() < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( selectedItems.size() < 2 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QRectF selectedItemBBox;
|
||||
if(boundingRectOfSelectedItems(selectedItemBBox) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( boundingRectOfSelectedItems( selectedItemBBox ) != 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double maxXCoordinate = selectedItemBBox.right();
|
||||
|
||||
//align items right to maximum x coordinate
|
||||
QList<QgsComposerItem*>::iterator align_it = selectedItems.begin();
|
||||
for(; align_it != selectedItems.end(); ++align_it)
|
||||
{
|
||||
QTransform itemTransform = (*align_it)->transform();
|
||||
itemTransform.translate( maxXCoordinate - itemTransform.dx() - (*align_it)->rect().width(), 0);
|
||||
(*align_it)->setTransform(itemTransform);
|
||||
}
|
||||
for ( ; align_it != selectedItems.end(); ++align_it )
|
||||
{
|
||||
QTransform itemTransform = ( *align_it )->transform();
|
||||
itemTransform.translate( maxXCoordinate - itemTransform.dx() - ( *align_it )->rect().width(), 0 );
|
||||
( *align_it )->setTransform( itemTransform );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposition::alignSelectedItemsTop()
|
||||
{
|
||||
QList<QgsComposerItem*> selectedItems = selectedComposerItems();
|
||||
if(selectedItems.size() < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( selectedItems.size() < 2 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QRectF selectedItemBBox;
|
||||
if(boundingRectOfSelectedItems(selectedItemBBox) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( boundingRectOfSelectedItems( selectedItemBBox ) != 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double minYCoordinate = selectedItemBBox.top();
|
||||
QList<QgsComposerItem*>::iterator align_it = selectedItems.begin();
|
||||
for(; align_it != selectedItems.end(); ++align_it)
|
||||
{
|
||||
QTransform itemTransform = (*align_it)->transform();
|
||||
itemTransform.translate(0, minYCoordinate - itemTransform.dy());
|
||||
(*align_it)->setTransform(itemTransform);
|
||||
}
|
||||
for ( ; align_it != selectedItems.end(); ++align_it )
|
||||
{
|
||||
QTransform itemTransform = ( *align_it )->transform();
|
||||
itemTransform.translate( 0, minYCoordinate - itemTransform.dy() );
|
||||
( *align_it )->setTransform( itemTransform );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposition::alignSelectedItemsVCenter()
|
||||
{
|
||||
QList<QgsComposerItem*> selectedItems = selectedComposerItems();
|
||||
if(selectedItems.size() < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( selectedItems.size() < 2 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QRectF selectedItemBBox;
|
||||
if(boundingRectOfSelectedItems(selectedItemBBox) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( boundingRectOfSelectedItems( selectedItemBBox ) != 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double averageYCoord = (selectedItemBBox.top() + selectedItemBBox.bottom()) / 2.0;
|
||||
double averageYCoord = ( selectedItemBBox.top() + selectedItemBBox.bottom() ) / 2.0;
|
||||
QList<QgsComposerItem*>::iterator align_it = selectedItems.begin();
|
||||
for(; align_it != selectedItems.end(); ++align_it)
|
||||
{
|
||||
QTransform itemTransform = (*align_it)->transform();
|
||||
itemTransform.translate(0, averageYCoord - itemTransform.dy() - (*align_it)->rect().height() / 2);
|
||||
(*align_it)->setTransform(itemTransform);
|
||||
}
|
||||
for ( ; align_it != selectedItems.end(); ++align_it )
|
||||
{
|
||||
QTransform itemTransform = ( *align_it )->transform();
|
||||
itemTransform.translate( 0, averageYCoord - itemTransform.dy() - ( *align_it )->rect().height() / 2 );
|
||||
( *align_it )->setTransform( itemTransform );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposition::alignSelectedItemsBottom()
|
||||
{
|
||||
QList<QgsComposerItem*> selectedItems = selectedComposerItems();
|
||||
if(selectedItems.size() < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( selectedItems.size() < 2 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QRectF selectedItemBBox;
|
||||
if(boundingRectOfSelectedItems(selectedItemBBox) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
QRectF selectedItemBBox;
|
||||
if ( boundingRectOfSelectedItems( selectedItemBBox ) != 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double maxYCoord = selectedItemBBox.bottom();
|
||||
QList<QgsComposerItem*>::iterator align_it = selectedItems.begin();
|
||||
for(; align_it != selectedItems.end(); ++align_it)
|
||||
{
|
||||
QTransform itemTransform = (*align_it)->transform();
|
||||
itemTransform.translate(0, maxYCoord - itemTransform.dy() - (*align_it)->rect().height());
|
||||
(*align_it)->setTransform(itemTransform);
|
||||
}
|
||||
for ( ; align_it != selectedItems.end(); ++align_it )
|
||||
{
|
||||
QTransform itemTransform = ( *align_it )->transform();
|
||||
itemTransform.translate( 0, maxYCoord - itemTransform.dy() - ( *align_it )->rect().height() );
|
||||
( *align_it )->setTransform( itemTransform );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposition::updateZValues()
|
||||
@ -587,30 +587,30 @@ void QgsComposition::sortZList()
|
||||
}
|
||||
}
|
||||
|
||||
QPointF QgsComposition::snapPointToGrid(const QPointF& scenePoint) const
|
||||
QPointF QgsComposition::snapPointToGrid( const QPointF& scenePoint ) const
|
||||
{
|
||||
if(!mSnapToGrid || (!mSnapGridResolution > 0))
|
||||
{
|
||||
return scenePoint;
|
||||
}
|
||||
if ( !mSnapToGrid || ( !mSnapGridResolution > 0 ) )
|
||||
{
|
||||
return scenePoint;
|
||||
}
|
||||
|
||||
//snap x coordinate //todo: add support for x- and y- offset
|
||||
int xRatio = (int)((scenePoint.x() - mSnapGridOffsetX) / mSnapGridResolution + 0.5);
|
||||
int yRatio = (int)((scenePoint.y() - mSnapGridOffsetY) / mSnapGridResolution + 0.5);
|
||||
int xRatio = ( int )(( scenePoint.x() - mSnapGridOffsetX ) / mSnapGridResolution + 0.5 );
|
||||
int yRatio = ( int )(( scenePoint.y() - mSnapGridOffsetY ) / mSnapGridResolution + 0.5 );
|
||||
|
||||
return QPointF(xRatio * mSnapGridResolution + mSnapGridOffsetX, yRatio * mSnapGridResolution + mSnapGridOffsetY);
|
||||
return QPointF( xRatio * mSnapGridResolution + mSnapGridOffsetX, yRatio * mSnapGridResolution + mSnapGridOffsetY );
|
||||
}
|
||||
|
||||
int QgsComposition::boundingRectOfSelectedItems(QRectF& bRect)
|
||||
int QgsComposition::boundingRectOfSelectedItems( QRectF& bRect )
|
||||
{
|
||||
QList<QgsComposerItem*> selectedItems = selectedComposerItems();
|
||||
if(selectedItems.size() < 1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if ( selectedItems.size() < 1 )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
//set the box to the first item
|
||||
QgsComposerItem* currentItem = selectedItems.at(0);
|
||||
QgsComposerItem* currentItem = selectedItems.at( 0 );
|
||||
double minX = currentItem->transform().dx();
|
||||
double minY = currentItem->transform().dy();
|
||||
double maxX = minX + currentItem->rect().width();
|
||||
@ -618,108 +618,108 @@ int QgsComposition::boundingRectOfSelectedItems(QRectF& bRect)
|
||||
|
||||
double currentMinX, currentMinY, currentMaxX, currentMaxY;
|
||||
|
||||
for(int i = 1; i < selectedItems.size(); ++i)
|
||||
{
|
||||
currentItem = selectedItems.at(i);
|
||||
currentMinX = currentItem->transform().dx();
|
||||
currentMinY = currentItem->transform().dy();
|
||||
currentMaxX = currentMinX + currentItem->rect().width();
|
||||
currentMaxY = currentMinY + currentItem->rect().height();
|
||||
for ( int i = 1; i < selectedItems.size(); ++i )
|
||||
{
|
||||
currentItem = selectedItems.at( i );
|
||||
currentMinX = currentItem->transform().dx();
|
||||
currentMinY = currentItem->transform().dy();
|
||||
currentMaxX = currentMinX + currentItem->rect().width();
|
||||
currentMaxY = currentMinY + currentItem->rect().height();
|
||||
|
||||
if(currentMinX < minX)
|
||||
minX = currentMinX;
|
||||
if(currentMaxX > maxX)
|
||||
maxX = currentMaxX;
|
||||
if(currentMinY < minY)
|
||||
minY = currentMinY;
|
||||
if(currentMaxY > maxY)
|
||||
maxY = currentMaxY;
|
||||
}
|
||||
if ( currentMinX < minX )
|
||||
minX = currentMinX;
|
||||
if ( currentMaxX > maxX )
|
||||
maxX = currentMaxX;
|
||||
if ( currentMinY < minY )
|
||||
minY = currentMinY;
|
||||
if ( currentMaxY > maxY )
|
||||
maxY = currentMaxY;
|
||||
}
|
||||
|
||||
bRect.setTopLeft(QPointF(minX, minY));
|
||||
bRect.setBottomRight(QPointF(maxX, maxY));
|
||||
bRect.setTopLeft( QPointF( minX, minY ) );
|
||||
bRect.setBottomRight( QPointF( maxX, maxY ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QgsComposition::setSnapToGridEnabled(bool b)
|
||||
void QgsComposition::setSnapToGridEnabled( bool b )
|
||||
{
|
||||
mSnapToGrid = b;
|
||||
if(mPaperItem)
|
||||
{
|
||||
mPaperItem->update();
|
||||
}
|
||||
if ( mPaperItem )
|
||||
{
|
||||
mPaperItem->update();
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposition::setSnapGridResolution(double r)
|
||||
void QgsComposition::setSnapGridResolution( double r )
|
||||
{
|
||||
mSnapGridResolution = r;
|
||||
if(mPaperItem)
|
||||
{
|
||||
mPaperItem->update();
|
||||
}
|
||||
if ( mPaperItem )
|
||||
{
|
||||
mPaperItem->update();
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposition::setSnapGridOffsetX(double offset)
|
||||
void QgsComposition::setSnapGridOffsetX( double offset )
|
||||
{
|
||||
mSnapGridOffsetX = offset;
|
||||
if(mPaperItem)
|
||||
{
|
||||
mPaperItem->update();
|
||||
}
|
||||
if ( mPaperItem )
|
||||
{
|
||||
mPaperItem->update();
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposition::setSnapGridOffsetY(double offset)
|
||||
void QgsComposition::setSnapGridOffsetY( double offset )
|
||||
{
|
||||
mSnapGridOffsetY = offset;
|
||||
if(mPaperItem)
|
||||
{
|
||||
mPaperItem->update();
|
||||
}
|
||||
if ( mPaperItem )
|
||||
{
|
||||
mPaperItem->update();
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposition::setGridPen(const QPen& p)
|
||||
void QgsComposition::setGridPen( const QPen& p )
|
||||
{
|
||||
mGridPen = p;
|
||||
if(mPaperItem)
|
||||
{
|
||||
mPaperItem->update();
|
||||
}
|
||||
if ( mPaperItem )
|
||||
{
|
||||
mPaperItem->update();
|
||||
}
|
||||
saveGridAppearanceSettings();
|
||||
}
|
||||
|
||||
void QgsComposition::setGridStyle(GridStyle s)
|
||||
void QgsComposition::setGridStyle( GridStyle s )
|
||||
{
|
||||
mGridStyle = s;
|
||||
if(mPaperItem)
|
||||
{
|
||||
mPaperItem->update();
|
||||
}
|
||||
if ( mPaperItem )
|
||||
{
|
||||
mPaperItem->update();
|
||||
}
|
||||
saveGridAppearanceSettings();
|
||||
}
|
||||
|
||||
void QgsComposition::loadGridAppearanceSettings()
|
||||
{
|
||||
//read grid style, grid color and pen width from settings
|
||||
//read grid style, grid color and pen width from settings
|
||||
QSettings s;
|
||||
|
||||
QString gridStyleString;
|
||||
int red, green, blue;
|
||||
double penWidth;
|
||||
|
||||
gridStyleString = s.value("/qgis/composerGridStyle", "Dots").toString();
|
||||
penWidth = s.value("/qgis/composerGridWidth", 0.5).toDouble();
|
||||
red = s.value("/qgis/composerGridRed", 0).toInt();
|
||||
green = s.value("/qgis/composerGridGreen", 0).toInt();
|
||||
blue = s.value("/qgis/composerGridBlue", 0).toInt();
|
||||
gridStyleString = s.value( "/qgis/composerGridStyle", "Dots" ).toString();
|
||||
penWidth = s.value( "/qgis/composerGridWidth", 0.5 ).toDouble();
|
||||
red = s.value( "/qgis/composerGridRed", 0 ).toInt();
|
||||
green = s.value( "/qgis/composerGridGreen", 0 ).toInt();
|
||||
blue = s.value( "/qgis/composerGridBlue", 0 ).toInt();
|
||||
|
||||
mGridPen.setColor(QColor(red, green, blue));
|
||||
mGridPen.setWidthF(penWidth);
|
||||
mGridPen.setColor( QColor( red, green, blue ) );
|
||||
mGridPen.setWidthF( penWidth );
|
||||
|
||||
if(gridStyleString == "Dots")
|
||||
if ( gridStyleString == "Dots" )
|
||||
{
|
||||
mGridStyle = Dots;
|
||||
}
|
||||
else if(gridStyleString == "Crosses")
|
||||
else if ( gridStyleString == "Crosses" )
|
||||
{
|
||||
mGridStyle = Crosses;
|
||||
}
|
||||
@ -731,23 +731,23 @@ void QgsComposition::loadGridAppearanceSettings()
|
||||
|
||||
void QgsComposition::saveGridAppearanceSettings()
|
||||
{
|
||||
//store grid appearance settings
|
||||
//store grid appearance settings
|
||||
QSettings s;
|
||||
s.setValue("/qgis/composerGridWidth", mGridPen.widthF());
|
||||
s.setValue("/qgis/composerGridRed", mGridPen.color().red());
|
||||
s.setValue("/qgis/composerGridGreen", mGridPen.color().green());
|
||||
s.setValue("/qgis/composerGridBlue", mGridPen.color().blue());
|
||||
s.setValue( "/qgis/composerGridWidth", mGridPen.widthF() );
|
||||
s.setValue( "/qgis/composerGridRed", mGridPen.color().red() );
|
||||
s.setValue( "/qgis/composerGridGreen", mGridPen.color().green() );
|
||||
s.setValue( "/qgis/composerGridBlue", mGridPen.color().blue() );
|
||||
|
||||
if(mGridStyle == Solid)
|
||||
if ( mGridStyle == Solid )
|
||||
{
|
||||
s.setValue("/qgis/composerGridStyle", "Solid");
|
||||
s.setValue( "/qgis/composerGridStyle", "Solid" );
|
||||
}
|
||||
else if(mGridStyle == Dots)
|
||||
else if ( mGridStyle == Dots )
|
||||
{
|
||||
s.setValue("/qgis/composerGridStyle", "Dots");
|
||||
s.setValue( "/qgis/composerGridStyle", "Dots" );
|
||||
}
|
||||
else if(mGridStyle == Crosses)
|
||||
else if ( mGridStyle == Crosses )
|
||||
{
|
||||
s.setValue("/qgis/composerGridStyle", "Crosses");
|
||||
s.setValue( "/qgis/composerGridStyle", "Crosses" );
|
||||
}
|
||||
}
|
||||
|
@ -66,22 +66,22 @@ class CORE_EXPORT QgsComposition: public QGraphicsScene
|
||||
/**Returns width of paper item*/
|
||||
double paperWidth() const;
|
||||
|
||||
void setSnapToGridEnabled(bool b);
|
||||
void setSnapToGridEnabled( bool b );
|
||||
bool snapToGridEnabled() const {return mSnapToGrid;}
|
||||
|
||||
void setSnapGridResolution(double r);
|
||||
void setSnapGridResolution( double r );
|
||||
double snapGridResolution() const {return mSnapGridResolution;}
|
||||
|
||||
void setSnapGridOffsetX(double offset);
|
||||
void setSnapGridOffsetX( double offset );
|
||||
double snapGridOffsetX() const {return mSnapGridOffsetX;}
|
||||
|
||||
void setSnapGridOffsetY(double offset);
|
||||
void setSnapGridOffsetY( double offset );
|
||||
double snapGridOffsetY() const {return mSnapGridOffsetY;}
|
||||
|
||||
void setGridPen(const QPen& p);
|
||||
void setGridPen( const QPen& p );
|
||||
const QPen& gridPen() const {return mGridPen;}
|
||||
|
||||
void setGridStyle(GridStyle s);
|
||||
void setGridStyle( GridStyle s );
|
||||
GridStyle gridStyle() const {return mGridStyle;}
|
||||
|
||||
/**Returns the topmose composer item. Ignores mPaperItem*/
|
||||
@ -147,7 +147,7 @@ class CORE_EXPORT QgsComposition: public QGraphicsScene
|
||||
void sortZList();
|
||||
|
||||
/**Snaps a scene coordinate point to grid*/
|
||||
QPointF snapPointToGrid(const QPointF& scenePoint) const;
|
||||
QPointF snapPointToGrid( const QPointF& scenePoint ) const;
|
||||
|
||||
|
||||
private:
|
||||
@ -177,7 +177,7 @@ class CORE_EXPORT QgsComposition: public QGraphicsScene
|
||||
|
||||
/**Returns the bounding rectangle of the selected items in scene coordinates
|
||||
@return 0 in case of success*/
|
||||
int boundingRectOfSelectedItems(QRectF& bRect);
|
||||
int boundingRectOfSelectedItems( QRectF& bRect );
|
||||
|
||||
void loadGridAppearanceSettings();
|
||||
void saveGridAppearanceSettings();
|
||||
|
@ -18,26 +18,26 @@
|
||||
#include "qgspaperitem.h"
|
||||
#include <QPainter>
|
||||
|
||||
QgsPaperItem::QgsPaperItem(QgsComposition* c): QgsComposerItem(c, false)
|
||||
QgsPaperItem::QgsPaperItem( QgsComposition* c ): QgsComposerItem( c, false )
|
||||
{
|
||||
setFlag( QGraphicsItem::ItemIsSelectable, false );
|
||||
setZValue(0);
|
||||
setZValue( 0 );
|
||||
}
|
||||
|
||||
QgsPaperItem::QgsPaperItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition ): QgsComposerItem(x, y, width, height, composition, false)
|
||||
QgsPaperItem::QgsPaperItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition ): QgsComposerItem( x, y, width, height, composition, false )
|
||||
{
|
||||
setFlag( QGraphicsItem::ItemIsSelectable, false );
|
||||
setZValue(0);
|
||||
setZValue( 0 );
|
||||
}
|
||||
|
||||
QgsPaperItem::QgsPaperItem(): QgsComposerItem(0, false)
|
||||
QgsPaperItem::QgsPaperItem(): QgsComposerItem( 0, false )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QgsPaperItem::~QgsPaperItem()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void QgsPaperItem::paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget )
|
||||
@ -51,63 +51,63 @@ void QgsPaperItem::paint( QPainter* painter, const QStyleOptionGraphicsItem* ite
|
||||
|
||||
//draw grid
|
||||
|
||||
if(mComposition)
|
||||
if ( mComposition )
|
||||
{
|
||||
if ( mComposition->snapToGridEnabled() && mComposition->plotStyle() == QgsComposition::Preview
|
||||
&& mComposition->snapGridResolution() > 0 )
|
||||
{
|
||||
if(mComposition->snapToGridEnabled() && mComposition->plotStyle() == QgsComposition::Preview
|
||||
&& mComposition->snapGridResolution() > 0)
|
||||
int gridMultiplyX = ( int )( mComposition->snapGridOffsetX() / mComposition->snapGridResolution() );
|
||||
int gridMultiplyY = ( int )( mComposition->snapGridOffsetY() / mComposition->snapGridResolution() );
|
||||
double currentXCoord = mComposition->snapGridOffsetX() - gridMultiplyX * mComposition->snapGridResolution();
|
||||
double currentYCoord;
|
||||
double minYCoord = mComposition->snapGridOffsetY() - gridMultiplyY * mComposition->snapGridResolution();
|
||||
|
||||
if ( mComposition->gridStyle() == QgsComposition::Solid )
|
||||
{
|
||||
int gridMultiplyX = (int)(mComposition->snapGridOffsetX() / mComposition->snapGridResolution());
|
||||
int gridMultiplyY = (int)(mComposition->snapGridOffsetY() / mComposition->snapGridResolution());
|
||||
double currentXCoord = mComposition->snapGridOffsetX() - gridMultiplyX * mComposition->snapGridResolution();
|
||||
double currentYCoord;
|
||||
double minYCoord = mComposition->snapGridOffsetY() - gridMultiplyY * mComposition->snapGridResolution();
|
||||
painter->setPen( mComposition->gridPen() );
|
||||
|
||||
if(mComposition->gridStyle() == QgsComposition::Solid)
|
||||
//draw vertical lines
|
||||
|
||||
|
||||
for ( ; currentXCoord <= rect().width(); currentXCoord += mComposition->snapGridResolution() )
|
||||
{
|
||||
painter->setPen(mComposition->gridPen());
|
||||
|
||||
//draw vertical lines
|
||||
|
||||
|
||||
for(; currentXCoord <= rect().width(); currentXCoord += mComposition->snapGridResolution())
|
||||
{
|
||||
painter->drawLine(QPointF(currentXCoord, 0), QPointF(currentXCoord, rect().height()));
|
||||
}
|
||||
|
||||
//draw horizontal lines
|
||||
currentYCoord = minYCoord;
|
||||
for(; currentYCoord <= rect().height(); currentYCoord += mComposition->snapGridResolution())
|
||||
{
|
||||
painter->drawLine(QPointF(0, currentYCoord), QPointF(rect().width(), currentYCoord));
|
||||
}
|
||||
painter->drawLine( QPointF( currentXCoord, 0 ), QPointF( currentXCoord, rect().height() ) );
|
||||
}
|
||||
else //'Dots' or 'Crosses'
|
||||
{
|
||||
QPen gridPen = mComposition->gridPen();
|
||||
painter->setPen(gridPen);
|
||||
painter->setBrush(QBrush(gridPen.color()));
|
||||
double halfCrossLength = mComposition->snapGridResolution() / 6;
|
||||
|
||||
for(; currentXCoord <= rect().width(); currentXCoord += mComposition->snapGridResolution())
|
||||
//draw horizontal lines
|
||||
currentYCoord = minYCoord;
|
||||
for ( ; currentYCoord <= rect().height(); currentYCoord += mComposition->snapGridResolution() )
|
||||
{
|
||||
painter->drawLine( QPointF( 0, currentYCoord ), QPointF( rect().width(), currentYCoord ) );
|
||||
}
|
||||
}
|
||||
else //'Dots' or 'Crosses'
|
||||
{
|
||||
QPen gridPen = mComposition->gridPen();
|
||||
painter->setPen( gridPen );
|
||||
painter->setBrush( QBrush( gridPen.color() ) );
|
||||
double halfCrossLength = mComposition->snapGridResolution() / 6;
|
||||
|
||||
for ( ; currentXCoord <= rect().width(); currentXCoord += mComposition->snapGridResolution() )
|
||||
{
|
||||
currentYCoord = minYCoord;
|
||||
for ( ; currentYCoord <= rect().height(); currentYCoord += mComposition->snapGridResolution() )
|
||||
{
|
||||
currentYCoord = minYCoord;
|
||||
for(; currentYCoord <= rect().height(); currentYCoord += mComposition->snapGridResolution())
|
||||
if ( mComposition->gridStyle() == QgsComposition::Dots )
|
||||
{
|
||||
if(mComposition->gridStyle() == QgsComposition::Dots)
|
||||
{
|
||||
QRectF pieRect(currentXCoord - gridPen.widthF() / 2, currentYCoord - gridPen.widthF() / 2, gridPen.widthF(), gridPen.widthF());
|
||||
painter->drawChord(pieRect, 0, 5760);
|
||||
}
|
||||
else if(mComposition->gridStyle() == QgsComposition::Crosses)
|
||||
{
|
||||
painter->drawLine(QPointF(currentXCoord - halfCrossLength, currentYCoord), QPointF(currentXCoord + halfCrossLength, currentYCoord));
|
||||
painter->drawLine(QPointF(currentXCoord, currentYCoord - halfCrossLength), QPointF(currentXCoord, currentYCoord + halfCrossLength));
|
||||
}
|
||||
QRectF pieRect( currentXCoord - gridPen.widthF() / 2, currentYCoord - gridPen.widthF() / 2, gridPen.widthF(), gridPen.widthF() );
|
||||
painter->drawChord( pieRect, 0, 5760 );
|
||||
}
|
||||
else if ( mComposition->gridStyle() == QgsComposition::Crosses )
|
||||
{
|
||||
painter->drawLine( QPointF( currentXCoord - halfCrossLength, currentYCoord ), QPointF( currentXCoord + halfCrossLength, currentYCoord ) );
|
||||
painter->drawLine( QPointF( currentXCoord, currentYCoord - halfCrossLength ), QPointF( currentXCoord, currentYCoord + halfCrossLength ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool QgsPaperItem::writeXML( QDomElement& elem, QDomDocument & doc ) const
|
||||
|
@ -20,22 +20,22 @@
|
||||
|
||||
#include "qgscomposeritem.h"
|
||||
|
||||
/**Item representing the paper. May draw the snapping grid lines if composition is in
|
||||
/**Item representing the paper. May draw the snapping grid lines if composition is in
|
||||
preview mode*/
|
||||
class QgsPaperItem: public QgsComposerItem
|
||||
{
|
||||
public:
|
||||
QgsPaperItem(QgsComposition* c);
|
||||
QgsPaperItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition );
|
||||
~QgsPaperItem();
|
||||
public:
|
||||
QgsPaperItem( QgsComposition* c );
|
||||
QgsPaperItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition );
|
||||
~QgsPaperItem();
|
||||
|
||||
/** \brief Reimplementation of QCanvasItem::paint*/
|
||||
void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
|
||||
/** \brief Reimplementation of QCanvasItem::paint*/
|
||||
void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
|
||||
|
||||
/** stores state in Dom node
|
||||
* @param node is Dom node corresponding to 'Composer' tag
|
||||
* @param temp write template file
|
||||
*/
|
||||
/** stores state in Dom node
|
||||
* @param node is Dom node corresponding to 'Composer' tag
|
||||
* @param temp write template file
|
||||
*/
|
||||
bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
|
||||
|
||||
/** sets state from Dom document
|
||||
@ -43,8 +43,8 @@ class QgsPaperItem: public QgsComposerItem
|
||||
*/
|
||||
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
|
||||
|
||||
private:
|
||||
QgsPaperItem();
|
||||
private:
|
||||
QgsPaperItem();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -63,12 +63,12 @@ QgsFeature & QgsFeature::operator=( QgsFeature const & rhs )
|
||||
mTypeName = rhs.mTypeName;
|
||||
|
||||
// make sure to delete the old geometry (if exists)
|
||||
if (mGeometry && mOwnsGeometry)
|
||||
if ( mGeometry && mOwnsGeometry )
|
||||
delete mGeometry;
|
||||
|
||||
|
||||
mGeometry = 0;
|
||||
mOwnsGeometry = false;
|
||||
|
||||
|
||||
if ( rhs.mGeometry )
|
||||
setGeometry( *rhs.mGeometry );
|
||||
|
||||
|
@ -39,14 +39,14 @@ QgsHttpTransaction::QgsHttpTransaction( QString uri,
|
||||
int proxyPort,
|
||||
QString proxyUser,
|
||||
QString proxyPass,
|
||||
QNetworkProxy::ProxyType proxyType)
|
||||
QNetworkProxy::ProxyType proxyType )
|
||||
: httpresponsecontenttype( 0 ),
|
||||
httpurl( uri ),
|
||||
httphost( proxyHost ),
|
||||
httpport( proxyPort ),
|
||||
httpuser( proxyUser ),
|
||||
httppass( proxyPass ),
|
||||
mProxyType(proxyType),
|
||||
mProxyType( proxyType ),
|
||||
mError( 0 )
|
||||
{
|
||||
|
||||
@ -98,7 +98,7 @@ bool QgsHttpTransaction::getSynchronously( QByteArray &respondedContent, int red
|
||||
// Set the host in the QHttp object
|
||||
http->setHost( qurl.host(), qurl.port( HTTP_PORT_DEFAULT ) );
|
||||
|
||||
if(!QgsHttpTransaction::applyProxySettings(*http, httpurl))
|
||||
if ( !QgsHttpTransaction::applyProxySettings( *http, httpurl ) )
|
||||
{
|
||||
httphost = qurl.host();
|
||||
httpport = qurl.port( HTTP_PORT_DEFAULT );
|
||||
@ -187,8 +187,8 @@ bool QgsHttpTransaction::getSynchronously( QByteArray &respondedContent, int red
|
||||
// QgsDebugMsg("Response received; being '" + httpresponsestring + "'.");
|
||||
#endif
|
||||
|
||||
delete http;
|
||||
http = 0;
|
||||
delete http;
|
||||
http = 0;
|
||||
|
||||
// Did we get an error? If so, bail early
|
||||
if ( !mError.isNull() )
|
||||
@ -291,8 +291,8 @@ void QgsHttpTransaction::dataProgress( int done, int total )
|
||||
// We saw something come back, therefore restart the watchdog timer
|
||||
mWatchdogTimer->start( NETWORK_TIMEOUT_MSEC );
|
||||
|
||||
emit dataReadProgress(done);
|
||||
emit totalSteps(total);
|
||||
emit dataReadProgress( done );
|
||||
emit totalSteps( total );
|
||||
|
||||
QString status;
|
||||
|
||||
@ -471,25 +471,25 @@ QString QgsHttpTransaction::errorString()
|
||||
return mError;
|
||||
}
|
||||
|
||||
bool QgsHttpTransaction::applyProxySettings(QHttp& http, const QString& url)
|
||||
bool QgsHttpTransaction::applyProxySettings( QHttp& http, const QString& url )
|
||||
{
|
||||
QSettings settings;
|
||||
//check if proxy is enabled
|
||||
bool proxyEnabled = settings.value( "proxy/proxyEnabled", false ).toBool();
|
||||
if(!proxyEnabled)
|
||||
if ( !proxyEnabled )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//check if the url should go through proxy
|
||||
QString proxyExcludedURLs = settings.value( "proxy/proxyExcludedUrls", "").toString();
|
||||
if(!proxyExcludedURLs.isEmpty())
|
||||
QString proxyExcludedURLs = settings.value( "proxy/proxyExcludedUrls", "" ).toString();
|
||||
if ( !proxyExcludedURLs.isEmpty() )
|
||||
{
|
||||
QStringList excludedURLs = proxyExcludedURLs.split("|");
|
||||
QStringList excludedURLs = proxyExcludedURLs.split( "|" );
|
||||
QStringList::const_iterator exclIt = excludedURLs.constBegin();
|
||||
for(; exclIt != excludedURLs.constEnd(); ++exclIt)
|
||||
for ( ; exclIt != excludedURLs.constEnd(); ++exclIt )
|
||||
{
|
||||
if(url.startsWith(*exclIt))
|
||||
if ( url.startsWith( *exclIt ) )
|
||||
{
|
||||
return false; //url does not go through proxy
|
||||
}
|
||||
@ -504,36 +504,36 @@ bool QgsHttpTransaction::applyProxySettings(QHttp& http, const QString& url)
|
||||
|
||||
QString proxyTypeString = settings.value( "proxy/proxyType", "" ).toString();
|
||||
QNetworkProxy::ProxyType proxyType = QNetworkProxy::NoProxy;
|
||||
if(proxyTypeString == "DefaultProxy")
|
||||
{
|
||||
proxyType = QNetworkProxy::DefaultProxy;
|
||||
}
|
||||
else if(proxyTypeString == "Socks5Proxy")
|
||||
{
|
||||
proxyType = QNetworkProxy::Socks5Proxy;
|
||||
}
|
||||
else if(proxyTypeString == "HttpProxy")
|
||||
{
|
||||
proxyType = QNetworkProxy::HttpProxy;
|
||||
}
|
||||
else if(proxyTypeString == "HttpCachingProxy")
|
||||
{
|
||||
proxyType = QNetworkProxy::HttpCachingProxy;
|
||||
}
|
||||
else if(proxyTypeString == "FtpCachingProxy")
|
||||
{
|
||||
proxyType = QNetworkProxy::FtpCachingProxy;
|
||||
}
|
||||
http.setProxy( QNetworkProxy(proxyType, proxyHost, proxyPort, proxyUser, proxyPassword) );
|
||||
if ( proxyTypeString == "DefaultProxy" )
|
||||
{
|
||||
proxyType = QNetworkProxy::DefaultProxy;
|
||||
}
|
||||
else if ( proxyTypeString == "Socks5Proxy" )
|
||||
{
|
||||
proxyType = QNetworkProxy::Socks5Proxy;
|
||||
}
|
||||
else if ( proxyTypeString == "HttpProxy" )
|
||||
{
|
||||
proxyType = QNetworkProxy::HttpProxy;
|
||||
}
|
||||
else if ( proxyTypeString == "HttpCachingProxy" )
|
||||
{
|
||||
proxyType = QNetworkProxy::HttpCachingProxy;
|
||||
}
|
||||
else if ( proxyTypeString == "FtpCachingProxy" )
|
||||
{
|
||||
proxyType = QNetworkProxy::FtpCachingProxy;
|
||||
}
|
||||
http.setProxy( QNetworkProxy( proxyType, proxyHost, proxyPort, proxyUser, proxyPassword ) );
|
||||
return true;
|
||||
}
|
||||
|
||||
void QgsHttpTransaction::abort()
|
||||
{
|
||||
if(http)
|
||||
{
|
||||
http->abort();
|
||||
}
|
||||
if ( http )
|
||||
{
|
||||
http->abort();
|
||||
}
|
||||
}
|
||||
|
||||
// ENDS
|
||||
|
@ -48,7 +48,7 @@ class CORE_EXPORT QgsHttpTransaction : public QObject
|
||||
int proxyPort = 80,
|
||||
QString proxyUser = QString(),
|
||||
QString proxyPass = QString(),
|
||||
QNetworkProxy::ProxyType proxyType = QNetworkProxy::NoProxy);
|
||||
QNetworkProxy::ProxyType proxyType = QNetworkProxy::NoProxy );
|
||||
|
||||
//! Destructor
|
||||
virtual ~QgsHttpTransaction();
|
||||
@ -84,7 +84,7 @@ class CORE_EXPORT QgsHttpTransaction : public QObject
|
||||
|
||||
/**Apply proxy settings from QSettings to a http object
|
||||
@param return true if proxy settings was applied, false else*/
|
||||
static bool applyProxySettings(QHttp& http, const QString& url);
|
||||
static bool applyProxySettings( QHttp& http, const QString& url );
|
||||
|
||||
|
||||
public slots:
|
||||
@ -111,12 +111,12 @@ class CORE_EXPORT QgsHttpTransaction : public QObject
|
||||
signals:
|
||||
|
||||
/**legacy code. This signal is currently not emitted and only kept for API compatibility*/
|
||||
void setProgress(int done, int total);
|
||||
void setProgress( int done, int total );
|
||||
|
||||
/**Signal for progress update */
|
||||
void dataReadProgress( int theProgress);
|
||||
void dataReadProgress( int theProgress );
|
||||
/**Signal for adjusted number of steps*/
|
||||
void totalSteps(int theTotalSteps);
|
||||
void totalSteps( int theTotalSteps );
|
||||
|
||||
/** \brief emit a signal to be caught by qgisapp and display a msg on status bar */
|
||||
void statusChanged( QString theStatusQString );
|
||||
|
@ -701,12 +701,12 @@ bool QgsLabel::readLabelField( QDomElement &el, int attr, QString prefix = "fiel
|
||||
name = el.attribute( name );
|
||||
|
||||
QgsFieldMap::const_iterator field_it = mField.constBegin();
|
||||
for(; field_it != mField.constEnd(); ++field_it)
|
||||
for ( ; field_it != mField.constEnd(); ++field_it )
|
||||
{
|
||||
if(field_it.value().name() == name)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if ( field_it.value().name() == name )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( field_it != mField.constEnd() )
|
||||
|
@ -158,7 +158,7 @@ bool QgsRectangle::intersects( const QgsRectangle& rect ) const
|
||||
|
||||
bool QgsRectangle::contains( const QgsRectangle& rect ) const
|
||||
{
|
||||
return (rect.xmin >= xmin && rect.xmax <= xmax && rect.ymin >= ymin && rect.ymax <= ymax);
|
||||
return ( rect.xmin >= xmin && rect.xmax <= xmax && rect.ymin >= ymin && rect.ymax <= ymax );
|
||||
}
|
||||
|
||||
|
||||
|
@ -697,7 +697,7 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
|
||||
{
|
||||
// Destroy all cached geometries and clear the references to them
|
||||
deleteCachedGeometries();
|
||||
|
||||
|
||||
mCachedGeometriesRect = rendererContext.extent();
|
||||
}
|
||||
|
||||
@ -787,9 +787,9 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
|
||||
|
||||
if ( mEditable )
|
||||
{
|
||||
QgsDebugMsg(QString("Cached %1 geometries.").arg(mCachedGeometries.count()));
|
||||
QgsDebugMsg( QString( "Cached %1 geometries." ).arg( mCachedGeometries.count() ) );
|
||||
}
|
||||
|
||||
|
||||
return TRUE; // Assume success always
|
||||
}
|
||||
|
||||
@ -3143,19 +3143,19 @@ int QgsVectorLayer::snapWithContext( const QgsPoint& startPoint, double snapping
|
||||
QgsRectangle searchRect( startPoint.x() - snappingTolerance, startPoint.y() - snappingTolerance,
|
||||
startPoint.x() + snappingTolerance, startPoint.y() + snappingTolerance );
|
||||
double sqrSnappingTolerance = snappingTolerance * snappingTolerance;
|
||||
|
||||
|
||||
int n = 0;
|
||||
QgsFeature f;
|
||||
|
||||
if (mCachedGeometriesRect.contains(searchRect))
|
||||
|
||||
if ( mCachedGeometriesRect.contains( searchRect ) )
|
||||
{
|
||||
QgsDebugMsg("Using cached geometries for snapping.");
|
||||
|
||||
QgsDebugMsg( "Using cached geometries for snapping." );
|
||||
|
||||
QgsGeometryMap::iterator it = mCachedGeometries.begin();
|
||||
for ( ; it != mCachedGeometries.end() ; ++it)
|
||||
for ( ; it != mCachedGeometries.end() ; ++it )
|
||||
{
|
||||
QgsGeometry* g = &(it.value());
|
||||
if (g->boundingBox().intersects(searchRect))
|
||||
QgsGeometry* g = &( it.value() );
|
||||
if ( g->boundingBox().intersects( searchRect ) )
|
||||
{
|
||||
snapToGeometry( startPoint, it.key(), g, sqrSnappingTolerance, snappingResults, snap_to );
|
||||
++n;
|
||||
@ -3165,9 +3165,9 @@ int QgsVectorLayer::snapWithContext( const QgsPoint& startPoint, double snapping
|
||||
else
|
||||
{
|
||||
// snapping outside cached area
|
||||
|
||||
|
||||
select( QgsAttributeList(), searchRect, true, true );
|
||||
|
||||
|
||||
while ( nextFeature( f ) )
|
||||
{
|
||||
snapToGeometry( startPoint, f.id(), f.geometry(), sqrSnappingTolerance, snappingResults, snap_to );
|
||||
|
@ -576,7 +576,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
|
||||
|
||||
/** cache of the committed geometries retrieved *for the current display* */
|
||||
QgsGeometryMap mCachedGeometries;
|
||||
|
||||
|
||||
/** extent for which there are cached geometries */
|
||||
QgsRectangle mCachedGeometriesRect;
|
||||
|
||||
|
@ -41,8 +41,8 @@ void QgsComposerView::mousePressEvent( QMouseEvent* e )
|
||||
return;
|
||||
}
|
||||
|
||||
QPointF scenePoint = mapToScene( e->pos());
|
||||
QPointF snappedScenePoint = composition()->snapPointToGrid(scenePoint);
|
||||
QPointF scenePoint = mapToScene( e->pos() );
|
||||
QPointF snappedScenePoint = composition()->snapPointToGrid( scenePoint );
|
||||
|
||||
switch ( mCurrentTool )
|
||||
{
|
||||
|
@ -48,10 +48,10 @@ QRectF QgsMapCanvasMap::boundingRect() const
|
||||
|
||||
void QgsMapCanvasMap::resize( QSize size )
|
||||
{
|
||||
prepareGeometryChange(); // to keep QGraphicsScene indexes up to date on size change
|
||||
prepareGeometryChange(); // to keep QGraphicsScene indexes up to date on size change
|
||||
|
||||
mPixmap = QPixmap( size );
|
||||
mImage = QImage( size, QImage::Format_RGB32 ); // temporary image - build it here so it is available when switching from QPixmap to QImage rendering
|
||||
mImage = QImage( size, QImage::Format_RGB32 ); // temporary image - build it here so it is available when switching from QPixmap to QImage rendering
|
||||
mCanvas->mapRenderer()->setOutputSize( size, mPixmap.logicalDpiX() );
|
||||
}
|
||||
|
||||
|
@ -148,15 +148,15 @@ void QgsMapOverviewCanvas::drawExtentRect()
|
||||
QRect r( x1, y1, x2 - x1 + 1, y2 - y1 + 1 );
|
||||
|
||||
// allow for 5 pixel minimum widget size
|
||||
if ( r.width() < 5 && x1 > INT_MIN + 2 ) // make sure no underflow occurs (2 is largest adjustment)
|
||||
if ( r.width() < 5 && x1 > INT_MIN + 2 ) // make sure no underflow occurs (2 is largest adjustment)
|
||||
{
|
||||
r.setX( r.x() - ( ( 5 - r.width() ) / 2 ) ); // adjust x by 1/2 the difference of calculated and min. width
|
||||
r.setWidth(5);
|
||||
r.setX( r.x() - (( 5 - r.width() ) / 2 ) ); // adjust x by 1/2 the difference of calculated and min. width
|
||||
r.setWidth( 5 );
|
||||
}
|
||||
if ( r.height() < 5 && y1 > INT_MIN + 2 )
|
||||
if ( r.height() < 5 && y1 > INT_MIN + 2 )
|
||||
{
|
||||
r.setY( r.y() - ( ( 5 - r.height() ) / 2 ) ); // adjust y
|
||||
r.setHeight(5);
|
||||
r.setY( r.y() - (( 5 - r.height() ) / 2 ) ); // adjust y
|
||||
r.setHeight( 5 );
|
||||
}
|
||||
|
||||
QgsDebugMsg( QString( "panning: extent to widget: [%1,%2] [%3x%4]" ).arg( x1 ).arg( y1 ).arg( r.width() ).arg( r.height() ) );
|
||||
|
@ -80,13 +80,13 @@ CoordinateCapture::~CoordinateCapture()
|
||||
*/
|
||||
void CoordinateCapture::initGui()
|
||||
{
|
||||
mCrs.createFromSrsId( GEOCRS_ID ); // initialize the CRS object
|
||||
mCrs.createFromSrsId( GEOCRS_ID ); // initialize the CRS object
|
||||
|
||||
connect( mQGisIface->mapCanvas()->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( setSourceCrs() ) );
|
||||
|
||||
setSourceCrs(); //set up the source CRS
|
||||
mTransform.setDestCRS( mCrs ); // set the CRS in the transform
|
||||
mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QGis::Degrees ) ? 8 : 3; // precision depends on CRS units
|
||||
setSourceCrs(); //set up the source CRS
|
||||
mTransform.setDestCRS( mCrs ); // set the CRS in the transform
|
||||
mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QGis::Degrees ) ? 8 : 3; // precision depends on CRS units
|
||||
|
||||
// Create the action for tool
|
||||
mQActionPointer = new QAction( QIcon( ":/coordinatecapture/coordinate_capture.png" ), tr( "Coordinate Capture" ), this );
|
||||
@ -170,14 +170,14 @@ void CoordinateCapture::setCRS()
|
||||
{
|
||||
mCrs.createFromSrsId( mySelector.selectedCrsId() );
|
||||
mTransform.setDestCRS( mCrs );
|
||||
mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QGis::Degrees ) ? 8 : 3; //precision depends on CRS units
|
||||
mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QGis::Degrees ) ? 8 : 3; //precision depends on CRS units
|
||||
}
|
||||
}
|
||||
|
||||
void CoordinateCapture::setSourceCrs()
|
||||
{
|
||||
mTransform.setSourceCrs( mQGisIface->mapCanvas()->mapRenderer()->destinationSrs() );
|
||||
mCanvasDisplayPrecision = ( mQGisIface->mapCanvas()->mapRenderer()->destinationSrs().mapUnits() == QGis::Degrees ) ? 8 : 3; // for the map canvas coordinate display
|
||||
mCanvasDisplayPrecision = ( mQGisIface->mapCanvas()->mapRenderer()->destinationSrs().mapUnits() == QGis::Degrees ) ? 8 : 3; // for the map canvas coordinate display
|
||||
}
|
||||
|
||||
void CoordinateCapture::mouseClicked( QgsPoint thePoint )
|
||||
|
@ -293,7 +293,7 @@ bool QgsGrassProvider::nextFeature( QgsFeature& feature )
|
||||
int cat, type, id;
|
||||
unsigned char *wkb;
|
||||
int wkbsize;
|
||||
|
||||
|
||||
QgsDebugMsgLevel( "entered.", 3 );
|
||||
|
||||
if ( isEdited() || isFrozen() || !mValid )
|
||||
@ -318,7 +318,7 @@ bool QgsGrassProvider::nextFeature( QgsFeature& feature )
|
||||
QgsDebugMsg( QString( "cat = %1 type = %2 id = %3" ).arg( cat ).arg( type ).arg( id ) );
|
||||
#endif
|
||||
|
||||
feature.setFeatureId(id);
|
||||
feature.setFeatureId( id );
|
||||
|
||||
// TODO int may be 64 bits (memcpy)
|
||||
if ( type & ( GV_POINTS | GV_LINES ) ) /* points or lines */
|
||||
|
@ -336,7 +336,7 @@ QImage* QgsWmsProvider::draw( QgsRectangle const & viewExtent, int pixelWidth,
|
||||
// Width in WMS format
|
||||
QString width;
|
||||
width = width.setNum( pixelWidth );
|
||||
|
||||
|
||||
// Height in WMS format
|
||||
QString height;
|
||||
height = height.setNum( pixelHeight );
|
||||
@ -550,19 +550,19 @@ QImage* QgsWmsProvider::draw( QgsRectangle const & viewExtent, int pixelWidth,
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
#if 0
|
||||
void QgsWmsProvider::getServerCapabilities()
|
||||
{
|
||||
QgsDebugMsg("entering.");
|
||||
QgsDebugMsg( "entering." );
|
||||
|
||||
retrieveServerCapabilities();
|
||||
|
||||
// TODO: Return generic server capabilities here
|
||||
|
||||
QgsDebugMsg("exiting.");
|
||||
QgsDebugMsg( "exiting." );
|
||||
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
bool QgsWmsProvider::retrieveServerCapabilities( bool forceRefresh )
|
||||
{
|
||||
@ -640,47 +640,47 @@ QByteArray QgsWmsProvider::retrieveUrl( QString url )
|
||||
|
||||
#if 0 //MH: not necessary any more
|
||||
//read proxy settings
|
||||
QSettings settings;
|
||||
QString proxyHost, proxyUser, proxyPassword;
|
||||
int proxyPort;
|
||||
QNetworkProxy::ProxyType proxyType = QNetworkProxy::NoProxy;
|
||||
QSettings settings;
|
||||
QString proxyHost, proxyUser, proxyPassword;
|
||||
int proxyPort;
|
||||
QNetworkProxy::ProxyType proxyType = QNetworkProxy::NoProxy;
|
||||
|
||||
bool proxyEnabled = settings.value( "proxy/proxyEnabled", "0" ).toBool();
|
||||
if(proxyEnabled)
|
||||
{
|
||||
proxyHost = settings.value( "proxy/proxyHost", "" ).toString();
|
||||
proxyPort = settings.value( "proxy/proxyPort", "" ).toString().toInt();
|
||||
proxyUser = settings.value( "proxy/proxyUser", "" ).toString();
|
||||
proxyPassword = settings.value( "proxy/proxyPassword", "" ).toString();
|
||||
QString proxyTypeString = settings.value( "proxy/proxyType", "" ).toString();
|
||||
if(proxyTypeString == "DefaultProxy")
|
||||
bool proxyEnabled = settings.value( "proxy/proxyEnabled", "0" ).toBool();
|
||||
if ( proxyEnabled )
|
||||
{
|
||||
proxyHost = settings.value( "proxy/proxyHost", "" ).toString();
|
||||
proxyPort = settings.value( "proxy/proxyPort", "" ).toString().toInt();
|
||||
proxyUser = settings.value( "proxy/proxyUser", "" ).toString();
|
||||
proxyPassword = settings.value( "proxy/proxyPassword", "" ).toString();
|
||||
QString proxyTypeString = settings.value( "proxy/proxyType", "" ).toString();
|
||||
if ( proxyTypeString == "DefaultProxy" )
|
||||
{
|
||||
proxyType = QNetworkProxy::DefaultProxy;
|
||||
}
|
||||
else if(proxyTypeString == "Socks5Proxy")
|
||||
{
|
||||
proxyType = QNetworkProxy::Socks5Proxy;
|
||||
proxyType = QNetworkProxy::DefaultProxy;
|
||||
}
|
||||
else if(proxyTypeString == "HttpProxy")
|
||||
{
|
||||
proxyType = QNetworkProxy::HttpProxy;
|
||||
}
|
||||
else if(proxyTypeString == "HttpCachingProxy")
|
||||
{
|
||||
proxyType = QNetworkProxy::HttpCachingProxy;
|
||||
}
|
||||
else if(proxyTypeString == "FtpCachingProxy")
|
||||
{
|
||||
proxyType = QNetworkProxy::FtpCachingProxy;
|
||||
}
|
||||
}
|
||||
else if ( proxyTypeString == "Socks5Proxy" )
|
||||
{
|
||||
proxyType = QNetworkProxy::Socks5Proxy;
|
||||
}
|
||||
else if ( proxyTypeString == "HttpProxy" )
|
||||
{
|
||||
proxyType = QNetworkProxy::HttpProxy;
|
||||
}
|
||||
else if ( proxyTypeString == "HttpCachingProxy" )
|
||||
{
|
||||
proxyType = QNetworkProxy::HttpCachingProxy;
|
||||
}
|
||||
else if ( proxyTypeString == "FtpCachingProxy" )
|
||||
{
|
||||
proxyType = QNetworkProxy::FtpCachingProxy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
QgsHttpTransaction http(url, proxyHost, proxyPort, proxyUser, proxyPassword, proxyType );
|
||||
QgsHttpTransaction http( url, proxyHost, proxyPort, proxyUser, proxyPassword, proxyType );
|
||||
#endif //0
|
||||
|
||||
QgsHttpTransaction http(url);
|
||||
QgsHttpTransaction http( url );
|
||||
|
||||
// Do a passthrough for the status bar text
|
||||
connect(
|
||||
@ -822,8 +822,8 @@ bool QgsWmsProvider::parseCapabilitiesDom( QByteArray const & xml, QgsWmsCapabil
|
||||
{
|
||||
mErrorCaption = tr( "Dom Exception" );
|
||||
mError = tr( "Could not get WMS capabilities: %1 at line %2 column %3\n" )
|
||||
.arg( errorMsg ).arg( errorLine ).arg( errorColumn )
|
||||
+ tr( "This is probably due to an incorrect WMS Server URL." );
|
||||
.arg( errorMsg ).arg( errorLine ).arg( errorColumn )
|
||||
+ tr( "This is probably due to an incorrect WMS Server URL." );
|
||||
|
||||
QgsLogger::debug( "Dom Exception: " + mError );
|
||||
|
||||
@ -846,8 +846,8 @@ bool QgsWmsProvider::parseCapabilitiesDom( QByteArray const & xml, QgsWmsCapabil
|
||||
mErrorCaption = tr( "Dom Exception" );
|
||||
mError = tr( "Could not get WMS capabilities in the "
|
||||
"expected format (DTD): no %1 or %2 found\n" )
|
||||
.arg( "WMS_Capabilities" ).arg( "WMT_MS_Capabilities" )
|
||||
+ tr( "This is probably due to an incorrect WMS Server URL." );
|
||||
.arg( "WMS_Capabilities" ).arg( "WMT_MS_Capabilities" )
|
||||
+ tr( "This is probably due to an incorrect WMS Server URL." );
|
||||
|
||||
QgsLogger::debug( "Dom Exception: " + mError );
|
||||
|
||||
@ -957,7 +957,7 @@ void QgsWmsProvider::parseCapability( QDomElement const & e, QgsWmsCapabilityPro
|
||||
QDomElement e1 = n1.toElement(); // try to convert the node to an element.
|
||||
if ( !e1.isNull() )
|
||||
{
|
||||
QgsDebugMsg(" " + e1.tagName() ); // the node really is an element.
|
||||
QgsDebugMsg( " " + e1.tagName() ); // the node really is an element.
|
||||
|
||||
if ( e1.tagName() == "Request" )
|
||||
{
|
||||
@ -1517,7 +1517,7 @@ void QgsWmsProvider::parseLayer( QDomElement const & e, QgsWmsLayerProperty& lay
|
||||
n1 = n1.nextSibling();
|
||||
}
|
||||
|
||||
if(parentProperty)
|
||||
if ( parentProperty )
|
||||
{
|
||||
mLayerParents[ layerProperty.orderId ] = parentProperty->orderId;
|
||||
}
|
||||
@ -1600,10 +1600,10 @@ bool QgsWmsProvider::parseServiceExceptionReportDom( QByteArray const & xml )
|
||||
{
|
||||
mErrorCaption = tr( "Dom Exception" );
|
||||
mError = tr( "Could not get WMS Service Exception at %1: %2 at line %3 column %4" )
|
||||
.arg( baseUrl )
|
||||
.arg( errorMsg )
|
||||
.arg( errorLine )
|
||||
.arg( errorColumn );
|
||||
.arg( baseUrl )
|
||||
.arg( errorMsg )
|
||||
.arg( errorLine )
|
||||
.arg( errorColumn );
|
||||
|
||||
QgsLogger::debug( "Dom Exception: " + mError );
|
||||
|
||||
@ -1702,7 +1702,7 @@ void QgsWmsProvider::parseServiceException( QDomElement const & e )
|
||||
{
|
||||
mError = tr( "Request is for an optional operation that is not supported by the server." );
|
||||
}
|
||||
else if( seCode.isEmpty() )
|
||||
else if ( seCode.isEmpty() )
|
||||
{
|
||||
mError = tr( "(No error code was reported)" );
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ struct QgsWmsFeatureListUrlProperty
|
||||
struct QgsWmsLayerProperty
|
||||
{
|
||||
// WMS layer properties
|
||||
int orderId;
|
||||
int orderId;
|
||||
QString name;
|
||||
QString title;
|
||||
QString abstract;
|
||||
@ -359,7 +359,7 @@ class QgsWmsProvider : public QgsRasterDataProvider
|
||||
virtual bool supportedLayers( QVector<QgsWmsLayerProperty> & layers );
|
||||
|
||||
/**
|
||||
* \brief Returns a map for the hierachy of layers
|
||||
* \brief Returns a map for the hierachy of layers
|
||||
*/
|
||||
virtual void layerParents( QMap<int, int> &parents, QMap<int, QStringList> &parentNames ) const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user