Removed old symbology dialogs.

This commit is contained in:
Martin Dobias 2013-04-06 18:10:14 +02:00
parent fa904dcebc
commit 37da713c7e
24 changed files with 31 additions and 3578 deletions

View File

@ -14,11 +14,6 @@ class QgsRendererV2PropertiesDialog : QDialog
void apply();
void onOK();
void useOldSymbology();
signals:
void useNewSymbology( bool );
protected:
//! Reimplements dialog keyPress event so we can ignore it

View File

@ -16,7 +16,6 @@ SET(QGIS_APP_SRCS
qgsbookmarks.cpp
qgsbrowserdockwidget.cpp
qgsclipboard.cpp
qgscontinuouscolordialog.cpp
qgsconfigureshortcutsdialog.cpp
qgscustomization.cpp
qgscustomprojectiondialog.cpp
@ -36,7 +35,6 @@ SET(QGIS_APP_SRCS
qgsdisplayangle.cpp
qgsfieldcalculator.cpp
qgsfieldsproperties.cpp
qgsgraduatedsymboldialog.cpp
qgsidentifyresultsdialog.cpp
qgsfeatureaction.cpp
qgslabeldialog.cpp
@ -104,13 +102,11 @@ SET(QGIS_APP_SRCS
qgsrasterlayerproperties.cpp
qgstextannotationdialog.cpp
qgsshortcutsmanager.cpp
qgssinglesymboldialog.cpp
qgssnappingdialog.cpp
qgssvgannotationdialog.cpp
qgsundowidget.cpp
qgstipgui.cpp
qgstipfactory.cpp
qgsuniquevaluedialog.cpp
qgsvectorlayerproperties.cpp
qgshandlebadlayers.cpp
@ -176,7 +172,6 @@ SET (QGIS_APP_MOC_HDRS
qgsbookmarks.h
qgsbrowserdockwidget.h
qgsconfigureshortcutsdialog.h
qgscontinuouscolordialog.h
qgscustomization.h
qgscustomprojectiondialog.h
qgsdecorationitem.h
@ -196,7 +191,6 @@ SET (QGIS_APP_MOC_HDRS
qgsfieldsproperties.h
qgsformannotationdialog.h
qgshtmlannotationdialog.h
qgsgraduatedsymboldialog.h
qgsidentifyresultsdialog.h
qgslabeldialog.h
qgslabelengineconfigdialog.h
@ -248,7 +242,6 @@ SET (QGIS_APP_MOC_HDRS
qgsprojectproperties.h
qgsrastercalcdialog.h
qgsrasterlayerproperties.h
qgssinglesymboldialog.h
qgssnappingdialog.h
qgssponsors.h
qgssvgannotationdialog.h
@ -256,7 +249,6 @@ SET (QGIS_APP_MOC_HDRS
qgstipgui.h
qgstipfactory.h
qgsundowidget.h
qgsuniquevaluedialog.h
qgsvectorlayerproperties.h
qgshandlebadlayers.h

View File

@ -1,203 +0,0 @@
/***************************************************************************
qgscontinuouscolordialog.cpp
Continuous color renderer dialog
-------------------
begin : 2004-02-11
copyright : (C) 2004 by Gary E.Sherman
email : sherman at mrcc.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgscontinuouscolordialog.h"
#include "qgscontinuouscolorrenderer.h"
#include "qgis.h"
#include "qgsfield.h"
#include "qgssymbol.h"
#include "qgsvectordataprovider.h"
#include "qgsvectorlayer.h"
#include "qgslogger.h"
#include <QColorDialog>
#include <QKeyEvent>
QgsContinuousColorDialog::QgsContinuousColorDialog( QgsVectorLayer * layer )
: QDialog(), mVectorLayer( layer )
{
setupUi( this );
QgsDebugMsg( "entered." );
QObject::connect( btnMinValue, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( selectMinimumColor( const QColor& ) ) );
QObject::connect( btnMaxValue, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( selectMaximumColor( const QColor& ) ) );
//find out the numerical fields of mVectorLayer
const QgsFields & fields = mVectorLayer->pendingFields();
QString displayName;
for ( int idx = 0; idx < fields.count(); ++idx )
{
QVariant::Type type = fields[idx].type();
if ( type == QVariant::Int || type == QVariant::Double || type == QVariant::LongLong )
{
displayName = mVectorLayer->attributeDisplayName( idx );
classificationComboBox->addItem( displayName, idx );
}
}
//restore the correct colors for minimum and maximum values
const QgsContinuousColorRenderer* renderer = dynamic_cast<const QgsContinuousColorRenderer *>( layer->renderer() );;
if ( renderer )
{
classificationComboBox->setCurrentIndex( classificationComboBox->findData( renderer->classificationField() ) );
const QgsSymbol* minsymbol = renderer->minimumSymbol();
const QgsSymbol* maxsymbol = renderer->maximumSymbol();
if ( mVectorLayer->geometryType() == QGis::Line || mVectorLayer->geometryType() == QGis::Point )
{
btnMinValue->setColor( minsymbol->pen().color() );
btnMaxValue->setColor( maxsymbol->pen().color() );
}
else
{
btnMinValue->setColor( minsymbol->brush().color() );
btnMaxValue->setColor( maxsymbol->brush().color() );
}
outlinewidthspinbox->setMinimum( 0 );
outlinewidthspinbox->setValue( minsymbol->pen().widthF() );
if ( renderer->drawPolygonOutline() )
{
cb_polygonOutline->setCheckState( Qt::Checked );
}
else
{
cb_polygonOutline->setCheckState( Qt::Unchecked );
}
if ( mVectorLayer->geometryType() != QGis::Polygon )
{
cb_polygonOutline->setVisible( false );
}
}
else
{
cb_polygonOutline->setCheckState( Qt::Checked );
outlinewidthspinbox->setValue( DEFAULT_LINE_WIDTH );
if ( mVectorLayer->geometryType() != QGis::Polygon )
cb_polygonOutline->setVisible( false );
btnMinValue->setColor( Qt::black );
btnMaxValue->setColor( Qt::white );
}
// Ensure that the state of other widgets is appropriate for the
// state of the polygonoutline checkbox.
on_cb_polygonOutline_clicked();
}
QgsContinuousColorDialog::QgsContinuousColorDialog()
{
setupUi( this );
QgsDebugMsg( "entered." );
}
QgsContinuousColorDialog::~QgsContinuousColorDialog()
{
QgsDebugMsg( "entered." );
}
void QgsContinuousColorDialog::apply()
{
int classfield = classificationComboBox->itemData( classificationComboBox->currentIndex() ).toInt();
//find the minimum and maximum for the classification variable
double minimum, maximum;
QgsVectorDataProvider *provider = dynamic_cast<QgsVectorDataProvider *>( mVectorLayer->dataProvider() );
if ( provider )
{
minimum = provider->minimumValue( classfield ).toDouble();
maximum = provider->maximumValue( classfield ).toDouble();
}
else
{
QgsDebugMsg( "Warning, provider is null" );
return;
}
//create the render items for minimum and maximum value
QgsSymbol* minsymbol = new QgsSymbol( mVectorLayer->geometryType(), QVariant( minimum ).toString(), "", "" );
QPen minPen;
minPen.setColor( btnMinValue->color() );
minPen.setWidthF( outlinewidthspinbox->value() );
if ( mVectorLayer->geometryType() == QGis::Line || mVectorLayer->geometryType() == QGis::Point )
{
minsymbol->setPen( minPen );
}
else
{
minsymbol->setBrush( QBrush( btnMinValue->color() ) );
minsymbol->setPen( minPen );
}
QgsSymbol* maxsymbol = new QgsSymbol( mVectorLayer->geometryType(), QVariant( maximum ).toString(), "", "" );
QPen maxPen;
maxPen.setColor( btnMaxValue->color() );
maxPen.setWidthF( outlinewidthspinbox->value() );
if ( mVectorLayer->geometryType() == QGis::Line || mVectorLayer->geometryType() == QGis::Point )
{
maxsymbol->setPen( maxPen );
}
else
{
maxsymbol->setBrush( QBrush( btnMaxValue->color() ) );
maxsymbol->setPen( maxPen );
}
QgsContinuousColorRenderer* renderer = new QgsContinuousColorRenderer( mVectorLayer->geometryType() );
mVectorLayer->setRenderer( renderer );
renderer->setMinimumSymbol( minsymbol );
renderer->setMaximumSymbol( maxsymbol );
renderer->setClassificationField( classfield );
bool drawOutline = ( cb_polygonOutline->checkState() == Qt::Checked ) ? true : false;
renderer->setDrawPolygonOutline( drawOutline );
}
void QgsContinuousColorDialog::selectMinimumColor( const QColor& color )
{
Q_UNUSED( color )
}
void QgsContinuousColorDialog::selectMaximumColor( const QColor& color )
{
Q_UNUSED( color )
}
void QgsContinuousColorDialog::on_cb_polygonOutline_clicked()
{
if ( cb_polygonOutline->checkState() == Qt::Checked )
outlinewidthspinbox->setEnabled( true );
else
outlinewidthspinbox->setEnabled( false );
}
void QgsContinuousColorDialog::keyPressEvent( QKeyEvent * e )
{
// Ignore the ESC key to avoid close the dialog without the properties window
if ( e->key() == Qt::Key_Escape )
{
e->ignore();
}
}

View File

@ -1,56 +0,0 @@
/***************************************************************************
qgscontinuouscolordialog.h
Continuous color renderer dialog
-------------------
begin : 2004-02-12
copyright : (C) 2004 by Gary E.Sherman
email : sherman at mrcc.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSCONTINUOUSCOLORDIALOG_H
#define QGSCONTINUOUSCOLORDIALOG_H
#include "ui_qgscontinuouscolordialogbase.h"
#include <map>
class QgsVectorLayer;
class QgsContinuousColorDialog: public QDialog, private Ui::QgsContinuousColorDialogBase
{
Q_OBJECT
public:
QgsContinuousColorDialog( QgsVectorLayer* layer );
~QgsContinuousColorDialog();
public slots:
void apply();
protected slots:
void selectMinimumColor( const QColor& color );
void selectMaximumColor( const QColor& color );
void on_cb_polygonOutline_clicked();
protected:
QgsVectorLayer* mVectorLayer;
// Reimplements dialog keyPress event so we can ignore it
void keyPressEvent( QKeyEvent * event );
private:
/** Default constructor is private, do not use this */
QgsContinuousColorDialog();
};
#endif

View File

@ -1,600 +0,0 @@
/***************************************************************************
qgsgraduatedsymboldialog.cpp - description
-------------------
begin : Oct 2003
copyright : (C) 2003 by Marco Hugentobler
email : mhugent@geo.unizh.ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <algorithm>
#include <cmath>
#include "qgsgraduatedsymboldialog.h"
#include "qgsfield.h"
#include "qgsgraduatedsymbolrenderer.h"
#include "qgsludialog.h"
#include "qgssymbol.h"
#include "qgsvectordataprovider.h"
#include "qgsvectorlayer.h"
#include "qgslogger.h"
#include <QKeyEvent>
QgsGraduatedSymbolDialog::QgsGraduatedSymbolDialog( QgsVectorLayer * layer ): QDialog(), mVectorLayer( layer ), sydialog( layer )
{
setupUi( this );
QgsDebugMsg( "entered." );
setOrientation( Qt::Vertical );
//find out the numerical fields of mVectorLayer
const QgsFields & fields = layer->pendingFields();
QString displayName;
for ( int idx = 0; idx < fields.count(); ++idx )
{
QVariant::Type type = fields[idx].type();
if ( type == QVariant::Int || type == QVariant::Double || type == QVariant::LongLong )
{
displayName = layer->attributeDisplayName( idx );
classificationComboBox->addItem( displayName );
mFieldMap.insert( std::make_pair( displayName, idx ) );
}
}
//restore the correct settings
const QgsGraduatedSymbolRenderer* renderer = dynamic_cast<const QgsGraduatedSymbolRenderer *>( layer->renderer() );
//
// Set up the mode combo
//
modeComboBox->addItem( tr( "Equal Interval" ) );
modeComboBox->addItem( tr( "Quantiles" ) );
modeComboBox->addItem( tr( "Empty" ) );
if ( renderer )
{
QString myMode = "";
if ( renderer->mode() == QgsGraduatedSymbolRenderer::Empty )
{
myMode = tr( "Empty" );
}
else if ( renderer->mode() == QgsGraduatedSymbolRenderer::Quantile )
{
myMode = tr( "Quantiles" );
}
else
{
myMode = tr( "Equal Interval" );
}
modeComboBox->setCurrentIndex( modeComboBox->findText( myMode ) );
}
//
// Set up the classfield combo
//
if ( renderer )
{
QList < QgsSymbol * >list = renderer->symbols();
//display the classification field
QString classfield = "";
for ( std::map<QString, int>::iterator it = mFieldMap.begin(); it != mFieldMap.end(); ++it )
{
if ( it->second == renderer->classificationField() )
{
classfield = it->first;
break;
}
}
classificationComboBox->setCurrentIndex( classificationComboBox->findText( classfield ) );
numberofclassesspinbox->setValue( list.size() );
//fill the items of the renderer into mValues
for ( QList<QgsSymbol*>::iterator it = list.begin(); it != list.end(); ++it )
{
//todo: make an assignment operator and a copy constructor for QgsSymbol
QString classbreak = ( *it )->lowerValue() + " - " + ( *it )->upperValue();
QgsSymbol* sym = new QgsSymbol( mVectorLayer->geometryType(), ( *it )->lowerValue(), ( *it )->upperValue(), ( *it )->label() );
sym->setPen(( *it )->pen() );
sym->setCustomTexture(( *it )->customTexture() );
sym->setBrush(( *it )->brush() );
sym->setNamedPointSymbol(( *it )->pointSymbolName() );
sym->setPointSize(( *it )->pointSize() );
sym->setPointSizeUnits(( *it )->pointSizeUnits() );
sym->setScaleClassificationField(( *it )->scaleClassificationField() );
sym->setRotationClassificationField(( *it )->rotationClassificationField() );
mEntries.insert( std::make_pair( classbreak, sym ) );
QListWidgetItem * mypItem = new QListWidgetItem( classbreak );
updateEntryIcon( sym , mypItem );
mClassListWidget->addItem( mypItem );
}
}
//do the necessary signal/slot connections
QObject::connect( mClassifyButton, SIGNAL( clicked() ), this, SLOT( adjustClassification() ) );
QObject::connect( mClassListWidget, SIGNAL( currentItemChanged( QListWidgetItem*, QListWidgetItem* ) ), this, SLOT( changeCurrentValue() ) );
QObject::connect( &sydialog, SIGNAL( settingsChanged() ), this, SLOT( applySymbologyChanges() ) );
QObject::connect( mClassListWidget, SIGNAL( itemDoubleClicked( QListWidgetItem* ) ), this, SLOT( modifyClass( QListWidgetItem* ) ) );
QObject::connect( mDeleteClassButton, SIGNAL( clicked() ), this, SLOT( deleteCurrentClass() ) );
mSymbolWidgetStack->addWidget( &sydialog );
mSymbolWidgetStack->setCurrentWidget( &sydialog );
mClassListWidget->setCurrentRow( 0 );
}
QgsGraduatedSymbolDialog::QgsGraduatedSymbolDialog(): QDialog(), mVectorLayer( 0 ), sydialog( 0 )
{
setupUi( this );
QgsDebugMsg( "entered." );
}
QgsGraduatedSymbolDialog::~QgsGraduatedSymbolDialog()
{
QgsDebugMsg( "entered." );
}
void QgsGraduatedSymbolDialog::adjustNumberOfClasses()
{
//find out the number of the classification field
QString fieldstring = classificationComboBox->currentText();
if ( fieldstring.isEmpty() ) //don't do anything, it there is no classification field
{
show();
return;
}
}
void QgsGraduatedSymbolDialog::apply()
{
if ( classificationComboBox->currentText().isEmpty() ) //don't do anything, it there is no classification field
{
return;
}
QgsGraduatedSymbolRenderer* renderer = new QgsGraduatedSymbolRenderer( mVectorLayer->geometryType() );
//
// First the mode
//
if ( modeComboBox->currentText() == tr( "Empty" ) )
{
renderer->setMode( QgsGraduatedSymbolRenderer::Empty );
}
else if ( modeComboBox->currentText() == tr( "Quantiles" ) )
{
renderer->setMode( QgsGraduatedSymbolRenderer::Quantile );
}
else //equal interval by default//equal interval by default
{
renderer->setMode( QgsGraduatedSymbolRenderer::EqualInterval );
}
//
// Now the class breaks
//
for ( int item = 0; item < mClassListWidget->count(); ++item )
{
QString classbreak = mClassListWidget->item( item )->text();
std::map<QString, QgsSymbol*>::iterator it = mEntries.find( classbreak );
if ( it == mEntries.end() )
{
continue;
}
QString lower_bound = it->second->lowerValue();
QString upper_bound = it->second->upperValue();
QString label = it->second->label();
QgsSymbol* sy = new QgsSymbol( mVectorLayer->geometryType(), lower_bound, upper_bound, label );
sy->setColor( it->second->pen().color() );
sy->setLineStyle( it->second->pen().style() );
sy->setLineWidth( it->second->pen().widthF() );
if ( mVectorLayer->geometryType() == QGis::Point )
{
sy->setNamedPointSymbol( it->second->pointSymbolName() );
sy->setPointSize( it->second->pointSize() );
sy->setPointSizeUnits( it->second->pointSizeUnits() );
sy->setScaleClassificationField( it->second->scaleClassificationField() );
sy->setRotationClassificationField( it->second->rotationClassificationField() );
}
if ( mVectorLayer->geometryType() != QGis::Line )
{
sy->setFillColor( it->second->brush().color() );
sy->setCustomTexture( it->second->customTexture() );//necessary?
sy->setFillStyle( it->second->brush().style() );
}
//test, if lower_bound is numeric or not (making a subclass of QString would be the proper solution)
bool lbcontainsletter = false;
for ( int j = 0; j < lower_bound.length(); j++ )
{
if ( lower_bound[j].isLetter() )
{
lbcontainsletter = true;
}
}
//test, if upper_bound is numeric or not (making a subclass of QString would be the proper solution)
bool ubcontainsletter = false;
for ( int j = 0; j < upper_bound.length(); j++ )
{
if ( upper_bound[j].isLetter() )
{
ubcontainsletter = true;
}
}
if ( !lbcontainsletter && !ubcontainsletter && lower_bound.length() > 0 && upper_bound.length() > 0 ) //only add the item if the value bounds do not contain letters and are not null strings
{
renderer->addSymbol( sy );
}
else
{
delete sy;
}
}
renderer->updateSymbolAttributes();
std::map<QString, int>::iterator iter = mFieldMap.find( classificationComboBox->currentText() );
if ( iter != mFieldMap.end() )
{
renderer->setClassificationField( iter->second );
}
mVectorLayer->setRenderer( renderer );
}
void QgsGraduatedSymbolDialog::adjustClassification()
{
mClassListWidget->clear();
QGis::GeometryType m_type = mVectorLayer->geometryType();
double minimum = 0;
double maximum = 0;
//delete all previous entries
for ( std::map<QString, QgsSymbol*>::iterator it = mEntries.begin(); it != mEntries.end(); ++it )
{
delete it->second;
}
mEntries.clear();
//find out the number of the classification field
QString fieldstring = classificationComboBox->currentText();
if ( fieldstring.isEmpty() ) //don't do anything, it there is no classification field
{
show();
return;
}
std::map < QString, int >::iterator iter = mFieldMap.find( fieldstring );
int field = iter->second;
if ( modeComboBox->currentText() == tr( "Equal Interval" ) ||
modeComboBox->currentText() == tr( "Quantiles" ) )
{
minimum = mVectorLayer->minimumValue( field ).toDouble();
maximum = mVectorLayer->maximumValue( field ).toDouble();
}
else //don't waste performance if mMode is QgsGraduatedSymbolDialog::EMPTY
{
minimum = 0;
maximum = 0;
}
//todo: setup a data structure which holds the symbols
std::list<QgsSymbol*> symbolList;
for ( int i = 0; i < numberofclassesspinbox->value(); ++i )
{
QgsSymbol* symbol = new QgsSymbol( m_type );
symbol->setLabel( "" );
QPen pen;
QBrush brush;
// todo: These color ramps should come from a dropdown list
QString ramp;
ramp = "red_to_green";
if ( m_type == QGis::Line )
{
pen.setColor( getColorFromRamp( ramp, i, numberofclassesspinbox->value() ) );
}
else //point or polygon
{
brush.setColor( getColorFromRamp( ramp, i, numberofclassesspinbox->value() ) );
pen.setColor( Qt::black );
}
pen.setWidthF( symbol->lineWidth() );
brush.setStyle( Qt::SolidPattern );
symbol->setPen( pen );
symbol->setBrush( brush );
symbolList.push_back( symbol );
}
QString listBoxText;
QString lowerString, upperString;
if ( modeComboBox->currentText() == tr( "Quantiles" ) )
{
//test: insert the values into mClassListWidget
std::list<double> quantileBorders;
quantilesFromVectorLayer( quantileBorders, field, numberofclassesspinbox->value() );
std::list<double>::const_iterator it;
std::list<double>::const_iterator last_it = quantileBorders.end();
std::list<QgsSymbol*>::const_iterator symbol_it = symbolList.begin();
for ( it = quantileBorders.begin(); symbol_it != symbolList.end() && it != quantileBorders.end(); ++it )
{
if ( last_it != quantileBorders.end() )
{
lowerString = QString::number( QVariant( *last_it ).toDouble(), 'f', 3 );
upperString = QString::number( QVariant( *it ).toDouble(), 'f', 3 );
( *symbol_it )->setLowerValue( lowerString );
( *symbol_it )->setUpperValue( upperString );
listBoxText = lowerString + " - " + upperString;
mEntries.insert( std::make_pair( listBoxText, *symbol_it ) );
QListWidgetItem *mypItem = new QListWidgetItem( listBoxText );
mClassListWidget->addItem( mypItem );
updateEntryIcon( *symbol_it, mypItem );
++symbol_it;
}
last_it = it;
}
}
else if ( modeComboBox->currentText() == tr( "Equal Interval" ) )
{
std::list<QgsSymbol*>::const_iterator symbol_it = symbolList.begin();
for ( int i = 0; i < numberofclassesspinbox->value(); ++i )
{
//switch if attribute is int or double
double lower = minimum + ( maximum - minimum ) / numberofclassesspinbox->value() * i;
double upper = minimum + ( maximum - minimum ) / numberofclassesspinbox->value() * ( i + 1 );
lowerString = QString::number( lower, 'f', 3 );
upperString = QString::number( upper, 'f', 3 );
( *symbol_it )->setLowerValue( lowerString );
( *symbol_it )->setUpperValue( upperString );
listBoxText = lowerString + " - " + upperString;
QListWidgetItem * mypItem = new QListWidgetItem( listBoxText );
updateEntryIcon( *symbol_it, mypItem );
mClassListWidget->addItem( mypItem );
mEntries.insert( std::make_pair( listBoxText, *symbol_it ) );
++symbol_it;
}
}
else if ( modeComboBox->currentText() == tr( "Empty" ) )
{
std::list<QgsSymbol*>::const_iterator symbol_it = symbolList.begin();
for ( int i = 0; i < numberofclassesspinbox->value(); ++i )
{
listBoxText = "Empty" + QString::number( i + 1 );
QListWidgetItem * mypItem = new QListWidgetItem( listBoxText );
updateEntryIcon( *symbol_it, mypItem );
mClassListWidget->addItem( mypItem );
mEntries.insert( std::make_pair( listBoxText, *symbol_it ) );
++symbol_it;
}
}
mClassListWidget->setCurrentRow( 0 );
}
void QgsGraduatedSymbolDialog::changeCurrentValue()
{
sydialog.blockSignals( true );//block signals to prevent sydialog from changing the current QgsRenderItem
QListWidgetItem* item = mClassListWidget->currentItem();
if ( item )
{
QString value = item->text();
std::map<QString, QgsSymbol*>::iterator it = mEntries.find( value );
if ( it != mEntries.end() )
{
sydialog.set(( *it ).second );
sydialog.setLabel(( *it ).second->label() );
updateEntryIcon(( *it ).second, item );
}
}
sydialog.blockSignals( false );
}
void QgsGraduatedSymbolDialog::applySymbologyChanges()
{
QListWidgetItem* item = mClassListWidget->currentItem();
if ( item )
{
QString value = item->text();
std::map<QString, QgsSymbol*>::iterator it = mEntries.find( value );
if ( it != mEntries.end() )
{
sydialog.apply(( *it ).second );
it->second->setLabel(( *it ).second->label() );
updateEntryIcon(( *it ).second, item );
}
}
}
void QgsGraduatedSymbolDialog::modifyClass( QListWidgetItem* item )
{
QString currenttext = item->text();
QgsSymbol* symbol = 0;
std::map<QString, QgsSymbol*>::iterator iter = mEntries.find( currenttext );
if ( iter != mEntries.end() )
{
symbol = iter->second;
}
QgsLUDialog dialog( this );
if ( symbol )
{
dialog.setLowerValue( symbol->lowerValue() );
dialog.setUpperValue( symbol->upperValue() );
}
if ( dialog.exec() == QDialog::Accepted )
{
if ( symbol )
{
mEntries.erase( currenttext );
symbol->setLowerValue( dialog.lowerValue() );
symbol->setUpperValue( dialog.upperValue() );
QString newclass = dialog.lowerValue() + "-" + dialog.upperValue();
mEntries.insert( std::make_pair( newclass, symbol ) );
item->setText( newclass );
updateEntryIcon( symbol, item );
}
}
}
void QgsGraduatedSymbolDialog::deleteCurrentClass()
{
QListWidgetItem* currentItem = mClassListWidget->currentItem();
if ( !currentItem )
{
return;
}
QString classValue = currentItem->text();
int currentIndex = mClassListWidget->currentRow();
mEntries.erase( classValue );
delete( mClassListWidget->takeItem( currentIndex ) );
QgsDebugMsg( QString( "numRows: %1" ).arg( mClassListWidget->count() ) );
//
if ( mClassListWidget->count() < ( currentIndex + 1 ) )
{
QgsDebugMsg( "selecting numRows - 1" );
mClassListWidget->setCurrentRow( mClassListWidget->count() - 1 );
}
else
{
QgsDebugMsg( "selecting currentIndex" );
mClassListWidget->setCurrentRow( currentIndex );
}
}
int QgsGraduatedSymbolDialog::quantilesFromVectorLayer( std::list<double>& result, int attributeIndex, int numQuantiles ) const
{
if ( mVectorLayer )
{
std::vector<double> attributeValues( mVectorLayer->featureCount() );
QgsAttributeList attList;
attList.push_back( attributeIndex );
QgsFeature currentFeature;
QgsAttributeMap currentAttributeMap;
double currentValue;
int index = 0;
QgsFeatureIterator fit = mVectorLayer->getFeatures( QgsFeatureRequest().setFlags( QgsFeatureRequest::NoGeometry ).setSubsetOfAttributes( attList ) );
while ( fit.nextFeature( currentFeature ) )
{
currentValue = currentFeature.attribute( attributeIndex ).toDouble();
attributeValues[index] = currentValue;
++index;
}
sort( attributeValues.begin(), attributeValues.end() );
return calculateQuantiles( result, attributeValues, numQuantiles );
}
return 1;
}
int QgsGraduatedSymbolDialog::calculateQuantiles( std::list<double>& result, const std::vector<double>& values, int numQuantiles ) const
{
result.clear();
double q;
double k;
double intPart;
result.push_back( values[0] );
for ( int i = 0; i < ( numQuantiles - 1 ); ++i )
{
q = 100 / numQuantiles * ( i + 1 );
k = values.size() * q / 100;
if ( std::modf( k, &intPart ) < 0.000000001 )
{
result.push_back((( 100 - q ) * values[( int )( k - 1 )] + q * values[( int )k] ) / 100 );
}
else
{
result.push_back( values[( int )k] );
}
}
result.push_back( values[values.size() - 1] );
return 0;
}
QColor QgsGraduatedSymbolDialog::getColorFromRamp( QString ramp, int step, int totalSteps )
{
Q_UNUSED( ramp );
QColor color;
/* To do:
Grab the ramp by name from a file or ramp registry
and apply determine the color for the given step.
Ideally there would be two types of ramps:
- discrete colors: the number of steps would have to match totalSteps
- continuous colors: (eg grass or gmt ramps) would need to code a method
for determining an RGB color for any point along the continuum
Color ramps should be plugin-able; should be defined in a simple text file format
and read from a directory where users can add their own ramps.
*/
if ( step == 0 )
{
color = QColor( 0, 255, 0 );
}
else
{
color = QColor( 0, 255 - (( 255 / totalSteps ) * step + 1 ), (( 255 / totalSteps ) * step + 1 ) );
}
return color;
}
void QgsGraduatedSymbolDialog::updateEntryIcon( QgsSymbol * thepSymbol,
QListWidgetItem * thepItem )
{
QGis::GeometryType myType = mVectorLayer->geometryType();
switch ( myType )
{
case QGis::Point:
{
int myWidthScale = 4; //magick no to try to make vector props dialog preview look same as legend
thepItem->setIcon( QIcon( QPixmap::fromImage( thepSymbol->getPointSymbolAsImage( myWidthScale ) ) ) );
}
break;
case QGis::Line:
thepItem->setIcon( QIcon( QPixmap::fromImage( thepSymbol->getLineSymbolAsImage() ) ) );
break;
case QGis::Polygon:
thepItem->setIcon( QIcon( QPixmap::fromImage( thepSymbol->getPolygonSymbolAsImage() ) ) );
break;
default: //unknown
//do nothing
;
}
}
void QgsGraduatedSymbolDialog::keyPressEvent( QKeyEvent * e )
{
// Ignore the ESC key to avoid close the dialog without the properties window
if ( e->key() == Qt::Key_Escape )
{
e->ignore();
}
}

View File

@ -1,89 +0,0 @@
/***************************************************************************
qgsgraduatedsymboldialog.h - description
-------------------
begin : Oct 2003
copyright : (C) 2003 by Marco Hugentobler
email : mhugent@geo.unizh.ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSGRADUATEDSYMBOLDIALOG_H
#define QGSGRADUATEDSYMBOLDIALOG_H
#include "ui_qgsgraduatedsymboldialogbase.h"
#include "qgssinglesymboldialog.h"
#include <map>
class QgsVectorLayer;
class QgsGraduatedSymbolDialog: public QDialog, private Ui::QgsGraduatedSymbolDialogBase
{
Q_OBJECT
public:
/**Enumeration describing the automatic settings of values*/
enum mode {EMPTY, EQUAL_INTERVAL, QUANTILES};
QgsGraduatedSymbolDialog( QgsVectorLayer* layer );
~QgsGraduatedSymbolDialog();
public slots:
void apply();
protected slots:
/**Changes only the number of classes*/
void adjustNumberOfClasses();
/**Sets a new classification field and a new classification mode*/
void adjustClassification();
/**Changes the display of the single symbol dialog*/
void changeCurrentValue();
/**Writes changes in the single symbol dialog to the corresponding QgsRangeRenderItem*/
void applySymbologyChanges();
/**Shows a dialog to modify lower and upper values*/
void modifyClass( QListWidgetItem* item );
protected:
/**Pointer to the associated vector layer*/
QgsVectorLayer* mVectorLayer;
/**Stores the names and numbers of the fields with numeric values*/
std::map<QString, int> mFieldMap;
/**Stores the classes*/
std::map<QString, QgsSymbol*> mEntries;
/**Dialog which shows the settings of the activated class*/
QgsSingleSymbolDialog sydialog;
int mClassificationField;
/**Calculates quantiles from mVectorLayer.
@return 0 in case of success*/
int quantilesFromVectorLayer( std::list<double>& result, int attributeIndex, int numQuantiles ) const;
/**A function that calculates the values of the quantiles
@param result the list where the function inserts the result values
@param values a _sorted_ vector of variable values
@param numQuantiles the number of quantiles, e.g. 4 calculates the quantiles for 25%, 50%, 75%, 100%
@return 0 in case of success*/
int calculateQuantiles( std::list<double>& result, const std::vector<double>& values, int numQuantiles ) const;
/**Gets the color value along a specified ramp**/
QColor getColorFromRamp( QString ramp, int step, int totalSteps );
// Reimplements dialog keyPress event so we can ignore it
void keyPressEvent( QKeyEvent * event );
protected slots:
/**Removes a class from the classification*/
void deleteCurrentClass();
private:
/** Update the list widget item icon with a preview for the symbol.
* @param QgsSymbol * - symbol holding the style info.
* @param QListWidgetItem * - item to get its icon updated.
*/
void updateEntryIcon( QgsSymbol * thepSymbol, QListWidgetItem * thepItem );
/**Default constructor is privat to not use is*/
QgsGraduatedSymbolDialog();
};
#endif

View File

@ -1,662 +0,0 @@
/***************************************************************************
qgssinglesymboldialog.cpp - description
-------------------
begin : Oct 2003
copyright : (C) 2003 by Marco Hugentobler
email : mhugent@geo.unizh.ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgssinglesymboldialog.h"
#include "qgsmarkercatalogue.h"
#include "qgssinglesymbolrenderer.h"
#include "qgsfield.h"
#include "qgssymbol.h"
#include "qgssymbologyutils.h"
#include "qgsvectorlayer.h"
#include "qgsvectordataprovider.h"
#include "qgslogger.h"
#include <QColorDialog>
#include <QPainter>
#include <QImage>
#include <QFileDialog>
#include <QKeyEvent>
#include <QAbstractListModel>
#include <QPixmapCache>
#define DO_NOT_USE_STR "<off>"
class QgsMarkerListModel : public QAbstractListModel
{
public:
QgsMarkerListModel( QObject* parent ) : QAbstractListModel( parent )
{
mMarkers = QgsMarkerCatalogue::instance()->list();
}
int rowCount( const QModelIndex &parent = QModelIndex() ) const
{
Q_UNUSED( parent );
return mMarkers.size();
}
QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const
{
QString marker = mMarkers.at( index.row() );
if ( role == Qt::DecorationRole ) // icon
{
QPixmap pixmap;
if ( !QPixmapCache::find( "ssd_" + marker, pixmap ) )
{
QPen pen( QColor( 0, 0, 255 ) );
QBrush brush( QColor( 220, 220, 220 ), Qt::SolidPattern );
pixmap = QPixmap::fromImage( QgsMarkerCatalogue::instance()->imageMarker( marker, 18, pen, brush ) );
QPixmapCache::insert( "ssd_" + marker, pixmap );
}
return pixmap;
}
else if ( role == Qt::UserRole || role == Qt::ToolTipRole )
{
return marker;
}
return QVariant();
}
protected:
QStringList mMarkers;
};
QgsSingleSymbolDialog::QgsSingleSymbolDialog(): QDialog(), mVectorLayer( 0 )
{
setupUi( this );
QgsDebugMsg( "entered." );
}
QgsSingleSymbolDialog::QgsSingleSymbolDialog( QgsVectorLayer * layer, bool disabled ): QDialog(), mVectorLayer( layer ), mDisabled( disabled )
{
setupUi( this );
QgsDebugMsg( "entered." );
//
//set point symbol list
//
// If this layer doesn't have points, break out of the following
// two loops after the first iteration. This gives one point
// symbol in the dialog, etc so that other code can rely on such a
// fact, but avoids the long time required to load all of the
// available symbols when they are not needed.
// NOTE BY Tim: I think the note above and the break out in the
// loops can be removed now with changes I have made to use combo
// boxes for line style and fill style...test and remove if poss.
QAction *refreshAction = new QAction( tr( "Refresh markers" ), lstSymbols );
lstSymbols->addAction( refreshAction );
connect( refreshAction, SIGNAL( triggered() ), QgsMarkerCatalogue::instance(), SLOT( refreshList() ) );
connect( QgsMarkerCatalogue::instance(), SIGNAL( markersRefreshed() ), this, SLOT( refreshMarkers() ) );
lstSymbols->setContextMenuPolicy( Qt::ActionsContextMenu );
//do the signal/slot connections
connect( btnOutlineColor, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( selectOutlineColor( const QColor& ) ) );
connect( btnFillColor, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( selectFillColor( const QColor& ) ) );
connect( outlinewidthspinbox, SIGNAL( valueChanged( double ) ), this, SLOT( resendSettingsChanged() ) );
connect( mLabelEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( resendSettingsChanged() ) );
connect( mPointSizeSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( resendSettingsChanged() ) );
connect( mPointSizeUnitsCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( resendSettingsChanged() ) );
connect( mRotationClassificationComboBox, SIGNAL( currentIndexChanged( const QString & ) ),
this, SLOT( resendSettingsChanged() ) );
connect( mScaleClassificationComboBox, SIGNAL( currentIndexChanged( const QString & ) ),
this, SLOT( resendSettingsChanged() ) );
connect( mSymbolComboBox, SIGNAL( currentIndexChanged( const QString & ) ),
this, SLOT( resendSettingsChanged() ) );
connect( cboOutlineStyle, SIGNAL(
currentIndexChanged( const QString & ) ), this, SLOT( resendSettingsChanged() ) );
connect( cboFillStyle, SIGNAL(
currentIndexChanged( const QString & ) ), this, SLOT( resendSettingsChanged() ) );
//need this to deal with when texture fill is selected or deselected
connect( cboFillStyle, SIGNAL(
currentIndexChanged( int ) ), this, SLOT( fillStyleChanged( int ) ) );
connect( toolSelectTexture, SIGNAL( clicked() ), this, SLOT( selectTextureImage() ) );
refreshMarkers();
}
void QgsSingleSymbolDialog::refreshMarkers()
{
QgsMarkerListModel *m = new QgsMarkerListModel( lstSymbols );
lstSymbols->setModel( m );
connect( lstSymbols->selectionModel(), SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ),
this, SLOT( symbolChanged( const QModelIndex &, const QModelIndex & ) ) );
// Find out the numerical fields of mVectorLayer, and populate the ComboBoxes
QgsVectorDataProvider *provider = mVectorLayer->dataProvider();
if ( provider )
{
const QgsFields & fields = provider->fields();
mRotationClassificationComboBox->addItem( DO_NOT_USE_STR, -1 );
mScaleClassificationComboBox->addItem( DO_NOT_USE_STR, -1 );
mSymbolComboBox->addItem( DO_NOT_USE_STR, -1 );
for ( int idx = 0; idx < fields.count(); ++idx )
{
QVariant::Type type = fields[idx].type();
QString fieldName = fields[idx].name();
if ( type == QVariant::Int || type == QVariant::Double )
{
mRotationClassificationComboBox->addItem( fieldName, idx );
mScaleClassificationComboBox->addItem( fieldName, idx );
}
else if ( type == QVariant::String )
{
mSymbolComboBox->addItem( fieldName, idx );
}
}
}
else
{
QgsDebugMsg( "Warning, data provider is null" );
return;
}
//
//set outline / line style
//
cboOutlineStyle->addItem( QIcon( QgsSymbologyUtils::char2LinePixmap( "SolidLine" ) ), "", "SolidLine" );
cboOutlineStyle->addItem( QIcon( QgsSymbologyUtils::char2LinePixmap( "NoPen" ) ), tr( "None" ), "NoPen" );
cboOutlineStyle->addItem( QIcon( QgsSymbologyUtils::char2LinePixmap( "DashLine" ) ), "", "DashLine" );
cboOutlineStyle->addItem( QIcon( QgsSymbologyUtils::char2LinePixmap( "DotLine" ) ), "", "DotLine" );
cboOutlineStyle->addItem( QIcon( QgsSymbologyUtils::char2LinePixmap( "DashDotLine" ) ), "" , "DashDotLine" );
cboOutlineStyle->addItem( QIcon( QgsSymbologyUtils::char2LinePixmap( "DashDotDotLine" ) ), "", "DashDotDotLine" );
//
//set pattern icons and state
//
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "SolidPattern" ) ), "", "SolidPattern" );
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "NoBrush" ) ), tr( "None" ), "NoBrush" );
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "HorPattern" ) ), "", "HorPattern" );
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "VerPattern" ) ), "", "VerPattern" );
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "CrossPattern" ) ), "", "CrossPattern" );
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "BDiagPattern" ) ), "", "BDiagPattern" );
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "FDiagPattern" ) ), "", "FDiagPattern" );
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "DiagCrossPattern" ) ), "", "DiagCrossPattern" );
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "Dense1Pattern" ) ), "", "Dense1Pattern" );
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "Dense2Pattern" ) ), "", "Dense2Pattern" );
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "Dense3Pattern" ) ), "", "Dense3Pattern" );
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "Dense4Pattern" ) ), "", "Dense4Pattern" );
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "Dense5Pattern" ) ), "", "Dense5Pattern" );
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "Dense6Pattern" ) ), "", "Dense6Pattern" );
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "Dense7Pattern" ) ), "", "Dense7Pattern" );
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "TexturePattern" ) ), tr( "Texture" ), "TexturePattern" );
if ( mVectorLayer && mVectorLayer->geometryType() != QGis::Point )
{
mGroupPoint->setVisible( false );
mGroupPoint->setEnabled( false );
mGroupDrawingByField->setVisible( false );
mGroupDrawingByField->setEnabled( false );
}
if ( mDisabled )
{
unset();
}
else
{
if ( mVectorLayer )
{
const QgsSingleSymbolRenderer *renderer = dynamic_cast<const QgsSingleSymbolRenderer *>( mVectorLayer->renderer() );
if ( renderer )
{
// Set from the existing renderer
set( renderer->symbols().first() );
}
else
{
// Take values from an example instance
QgsSingleSymbolRenderer exampleRenderer = QgsSingleSymbolRenderer( mVectorLayer->geometryType() );
set( exampleRenderer.symbols().first() );
}
}
else
{
QgsDebugMsg( "Warning, layer is a null pointer" );
}
}
lstSymbols->blockSignals( false );
}
QgsSingleSymbolDialog::~QgsSingleSymbolDialog()
{
QgsDebugMsg( "entered." );
}
void QgsSingleSymbolDialog::selectOutlineColor( const QColor& color )
{
Q_UNUSED( color )
emit settingsChanged();
}
void QgsSingleSymbolDialog::selectFillColor( const QColor& color )
{
Q_UNUSED( color )
emit settingsChanged();
}
//should this method have a different name?
void QgsSingleSymbolDialog::selectTextureImage()
{
QString fileName = QFileDialog::getOpenFileName( this,
tr( "Open File" ),
mTexturePath,
tr( "Images" ) + " (*.png *.xpm *.jpg)" ); //should we allow other types of images?
if ( !fileName.isNull() )
{ //only process the string if the user clicked OK
mTexturePath = fileName;
resendSettingsChanged();
}
}
void QgsSingleSymbolDialog::apply( QgsSymbol *sy )
{
//query the values of the widgets and set the symbology of the vector layer
if ( btnFillColor->isEnabled() )
sy->setFillColor( btnFillColor->color() );
if ( outlinewidthspinbox->isEnabled() )
sy->setLineWidth( outlinewidthspinbox->value() );
if ( btnOutlineColor->isEnabled() )
sy->setColor( btnOutlineColor->color() );
//
// Apply point symbol
//
if ( lstSymbols->isEnabled() && lstSymbols->currentIndex().isValid() )
{
QAbstractItemModel *m = lstSymbols->model();
sy->setNamedPointSymbol( m->data( lstSymbols->currentIndex(), Qt::UserRole ).toString() );
}
if ( mPointSizeSpinBox->isEnabled() )
sy->setPointSize( mPointSizeSpinBox->value() );
if ( mPointSizeUnitsCheckBox->isEnabled() )
sy->setPointSizeUnits( mPointSizeUnitsCheckBox->isChecked() );
std::map<QString, int>::iterator iter;
if ( mRotationClassificationComboBox->isEnabled() )
{
sy->setRotationClassificationField( mRotationClassificationComboBox->itemData( mRotationClassificationComboBox->currentIndex() ).toInt() );
}
if ( mScaleClassificationComboBox->isEnabled() )
{
sy->setScaleClassificationField( mScaleClassificationComboBox->itemData( mScaleClassificationComboBox->currentIndex() ).toInt() );
}
if ( mSymbolComboBox->isEnabled() )
{
sy->setSymbolField( mSymbolComboBox->itemData( mSymbolComboBox->currentIndex() ).toInt() );
}
//
// Apply the line style
//
if ( cboOutlineStyle->isEnabled() )
{
QString myLineStyle =
cboOutlineStyle->itemData( cboOutlineStyle->currentIndex(), Qt::UserRole ).toString();
sy->setLineStyle( QgsSymbologyUtils::qString2PenStyle( myLineStyle ) );
}
//
// Apply the pattern
//
//Store the file path, and set the brush to TexturePattern. If we have a different button selected,
// the below code will override it, but leave the file path alone.
sy->setCustomTexture( mTexturePath );
if ( cboFillStyle->isEnabled() )
{
QString myFillStyle =
cboFillStyle->itemData( cboFillStyle->currentIndex(), Qt::UserRole ).toString();
sy->setFillStyle( QgsSymbologyUtils::qString2BrushStyle( myFillStyle ) );
}
if ( mLabelEdit->isEnabled() )
sy->setLabel( mLabelEdit->text() );
}
void QgsSingleSymbolDialog::apply()
{
QgsSymbol* sy = new QgsSymbol( mVectorLayer->geometryType() );
apply( sy );
QgsSingleSymbolRenderer *renderer = new QgsSingleSymbolRenderer( mVectorLayer->geometryType() );
renderer->addSymbol( sy );
renderer->updateSymbolAttributes();
mVectorLayer->setRenderer( renderer );
}
void QgsSingleSymbolDialog::unset()
{
mLabelEdit->setEnabled( false );
lstSymbols->setEnabled( false );
mPointSizeSpinBox->setEnabled( false );
mPointSizeUnitsCheckBox->setEnabled( false );
mRotationClassificationComboBox->setEnabled( false );
mScaleClassificationComboBox->setEnabled( false );
mSymbolComboBox->setEnabled( false );
outlinewidthspinbox->setEnabled( false );
btnOutlineColor->setEnabled( false );
cboOutlineStyle->setEnabled( false );
cboFillStyle->setEnabled( false );
btnFillColor->setEnabled( false );
}
void QgsSingleSymbolDialog::set( const QgsSymbol *sy )
{
//set label
mLabelEdit->setText( sy->label() );
// Set point symbol
QString mySymbolName = sy->pointSymbolName();
QAbstractItemModel *m = lstSymbols->model();
for ( int i = 0; i < m->rowCount(); i++ )
{
QModelIndex idx( m->index( i, 0 ) );
if ( m->data( idx, Qt::UserRole ).toString() == mySymbolName )
{
lstSymbols->setCurrentIndex( idx );
// m->setData( idx, Qt::UserRole+1, Qt::cyan );
break;
}
}
mPointSizeSpinBox->setValue( sy->pointSize() );
mPointSizeUnitsCheckBox->setChecked( sy->pointSizeUnits() );
int index;
index = mRotationClassificationComboBox->findData( sy->rotationClassificationField() );
mRotationClassificationComboBox->setCurrentIndex( index < 0 ? 0 : index );
index = mScaleClassificationComboBox->findData( sy->scaleClassificationField() );
mScaleClassificationComboBox->setCurrentIndex( index < 0 ? 0 : index );
index = mSymbolComboBox->findData( sy->symbolField() );
mSymbolComboBox->setCurrentIndex( index < 0 ? 0 : index );
outlinewidthspinbox->setValue( sy->pen().widthF() );
//set line width 1 as minimum to avoid confusion between line width 0 and no pen line style
// ... but, drawLine is not correct with width > 0 -> until solved set to 0
outlinewidthspinbox->setMinimum( 0 );
btnFillColor->setColor( sy->brush().color() );
btnOutlineColor->setColor( sy->pen().color() );
//load the icons stored in QgsSymbologyUtils.cpp (to avoid redundancy)
//
// Set the line style combo
//
QPen myPen = sy->pen();
QString myLineStyle = QgsSymbologyUtils::penStyle2QString( myPen.style() );
for ( int i = 0; i < cboOutlineStyle->count(); ++i )
{
if ( cboOutlineStyle->itemData( i, Qt::UserRole ).toString() == myLineStyle )
{
cboOutlineStyle->setCurrentIndex( i );
break;
}
}
//
// Set the brush combo
//
QBrush myBrush = sy->brush();
QString myFillStyle = QgsSymbologyUtils::brushStyle2QString( myBrush.style() );
for ( int i = 0; i < cboFillStyle->count(); ++i )
{
if ( cboFillStyle->itemData( i, Qt::UserRole ).toString() == myFillStyle )
{
cboFillStyle->setCurrentIndex( i );
break;
}
}
//get and show the file path, even if we aren't using it.
mTexturePath = sy->customTexture();
//if the file path isn't empty, show the image on the button
if ( sy->customTexture().size() > 0 )
{
//show the current texture image
// texture->setPixmap(QPixmap(sy->customTexture()));
}
else
{
//show the default question mark
//texture->setPixmap(QgsSymbologyUtils::char2PatternPixmap("TexturePattern"));
}
mLabelEdit->setEnabled( true );
lstSymbols->setEnabled( true );
mPointSizeSpinBox->setEnabled( true );
mPointSizeUnitsCheckBox->setEnabled( true );
mRotationClassificationComboBox->setEnabled( true );
mScaleClassificationComboBox->setEnabled( true );
mSymbolComboBox->setEnabled( true );
outlinewidthspinbox->setEnabled( true );
btnOutlineColor->setEnabled( true );
cboOutlineStyle->setEnabled( true );
if ( mVectorLayer && mVectorLayer->geometryType() != QGis::Line )
{
btnFillColor->setEnabled( true );
cboFillStyle->setEnabled( true );
}
}
void QgsSingleSymbolDialog::updateSet( const QgsSymbol *sy )
{
if ( mLabelEdit->isEnabled() && mLabelEdit->text() != sy->label() )
mLabelEdit->setEnabled( false );
if ( lstSymbols->isEnabled() && lstSymbols->currentIndex().isValid() )
{
QAbstractItemModel *m = lstSymbols->model();
if ( m->data( lstSymbols->currentIndex(), Qt::UserRole ).toString() != sy->pointSymbolName() )
lstSymbols->setEnabled( false );
}
if ( mPointSizeSpinBox->isEnabled() && !doubleNear( mPointSizeSpinBox->value(), sy->pointSize() ) )
mPointSizeSpinBox->setEnabled( false );
if ( mPointSizeUnitsCheckBox->isEnabled() && mPointSizeUnitsCheckBox->isChecked() != sy->pointSizeUnits() )
mPointSizeUnitsCheckBox->setEnabled( false );
if ( mRotationClassificationComboBox->isEnabled() &&
mRotationClassificationComboBox->itemData( mRotationClassificationComboBox->currentIndex() ).toInt() != sy->rotationClassificationField() )
mRotationClassificationComboBox->setEnabled( false );
if ( mScaleClassificationComboBox->isEnabled() &&
mScaleClassificationComboBox->itemData( mScaleClassificationComboBox->currentIndex() ).toInt() != sy->scaleClassificationField() )
mScaleClassificationComboBox->setEnabled( false );
if ( mSymbolComboBox->isEnabled() &&
mSymbolComboBox->itemData( mSymbolComboBox->currentIndex() ).toInt() != sy->symbolField() )
mSymbolComboBox->setEnabled( false );
if ( outlinewidthspinbox->isEnabled() && !doubleNear( outlinewidthspinbox->value(), sy->pen().widthF() ) )
outlinewidthspinbox->setEnabled( false );
if ( btnFillColor->isEnabled() && btnFillColor->color() != sy->brush().color() )
btnFillColor->setEnabled( false );
if ( btnOutlineColor->isEnabled() && btnOutlineColor->color() != sy->pen().color() )
btnOutlineColor->setEnabled( false );
if ( cboOutlineStyle->isEnabled() )
{
QPen myPen = sy->pen();
QString myLineStyle = QgsSymbologyUtils::penStyle2QString( myPen.style() );
if ( cboOutlineStyle->itemData( cboOutlineStyle->currentIndex(), Qt::UserRole ).toString() != myLineStyle )
cboOutlineStyle->setEnabled( false );
}
if ( cboFillStyle->isEnabled() )
{
QBrush myBrush = sy->brush();
QString myFillStyle = QgsSymbologyUtils::brushStyle2QString( myBrush.style() );
if ( cboFillStyle->itemData( cboFillStyle->currentIndex(), Qt::UserRole ).toString() != myFillStyle )
cboFillStyle->setEnabled( false );
}
}
void QgsSingleSymbolDialog::setOutlineColor( QColor& c )
{
btnOutlineColor->setColor( c );
}
void QgsSingleSymbolDialog::setOutlineStyle( Qt::PenStyle pstyle )
{
QString myLineStyle = QgsSymbologyUtils::penStyle2QString( pstyle );
for ( int i = 0; i < cboOutlineStyle->count(); ++i )
{
if ( cboOutlineStyle->itemData( i, Qt::UserRole ).toString() == myLineStyle )
{
cboOutlineStyle->setCurrentIndex( i );
break;
}
}
}
void QgsSingleSymbolDialog::setFillColor( QColor& c )
{
btnFillColor->setColor( c );
}
void QgsSingleSymbolDialog::setFillStyle( Qt::BrushStyle fstyle )
{
QgsDebugMsg( QString( "Setting fill style: %1" ).arg( QgsSymbologyUtils::brushStyle2QString( fstyle ) ) );
QString myFillStyle = QgsSymbologyUtils::brushStyle2QString( fstyle );
for ( int i = 0; i < cboFillStyle->count(); ++i )
{
if ( cboFillStyle->itemData( i, Qt::UserRole ).toString() == myFillStyle )
{
cboFillStyle->setCurrentIndex( i );
break;
}
}
}
void QgsSingleSymbolDialog::setOutlineWidth( double width )
{
outlinewidthspinbox->setValue( width );
}
QColor QgsSingleSymbolDialog::getOutlineColor()
{
return btnOutlineColor->color();
}
Qt::PenStyle QgsSingleSymbolDialog::getOutlineStyle()
{
QString myLineStyle =
cboOutlineStyle->itemData( cboOutlineStyle->currentIndex(), Qt::UserRole ).toString();
return QgsSymbologyUtils::qString2PenStyle( myLineStyle );
}
double QgsSingleSymbolDialog::getOutlineWidth()
{
return outlinewidthspinbox->value();
}
QColor QgsSingleSymbolDialog::getFillColor()
{
return btnFillColor->color();
}
Qt::BrushStyle QgsSingleSymbolDialog::getFillStyle()
{
QString myFillStyle =
cboFillStyle->itemData( cboFillStyle->currentIndex(), Qt::UserRole ).toString();
return QgsSymbologyUtils::qString2BrushStyle( myFillStyle );
}
void QgsSingleSymbolDialog::resendSettingsChanged()
{
emit settingsChanged();
}
QString QgsSingleSymbolDialog::label()
{
return mLabelEdit->text();
}
void QgsSingleSymbolDialog::setLabel( QString label )
{
mLabelEdit->setText( label );
}
void QgsSingleSymbolDialog::symbolChanged( const QModelIndex &current, const QModelIndex &previous )
{
Q_UNUSED( current );
Q_UNUSED( previous );
emit settingsChanged();
}
void QgsSingleSymbolDialog::fillStyleChanged( int theIndex )
{
//if the new style is texture we need to enable the texture
//selection button, otherwise disable it
QString myFillStyle =
cboFillStyle->itemData( theIndex, Qt::UserRole ).toString();
if ( "TexturePattern" == myFillStyle )
{
toolSelectTexture->setEnabled( true );
}
else
{
toolSelectTexture->setEnabled( false );
}
}
void QgsSingleSymbolDialog::keyPressEvent( QKeyEvent * e )
{
// Ignore the ESC key to avoid close the dialog without the properties window
if ( e->key() == Qt::Key_Escape )
{
e->ignore();
}
}

View File

@ -1,87 +0,0 @@
/***************************************************************************
qgssinglesymboldialog.h - description
-------------------
begin : Oct 2003
copyright : (C) 2003 by Marco Hugentobler
email : mhugent@geo.unizh.ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSSINGLESYMBOLDIALOG_H
#define QGSSINGLESYMBOLDIALOG_H
#include "ui_qgssinglesymboldialogbase.h"
#include <vector>
class QgsSymbol;
class QgsVectorLayer;
/**QgsSingleSymbolDialog is a dialog to set symbology for the legend type 'single symbol'*/
class QgsSingleSymbolDialog: public QDialog, private Ui::QgsSingleSymbolDialogBase
{
Q_OBJECT
public:
QgsSingleSymbolDialog( QgsVectorLayer* layer, bool disabled = false );
~QgsSingleSymbolDialog();
QColor getOutlineColor();
Qt::PenStyle getOutlineStyle();
double getOutlineWidth();
QColor getFillColor();
Qt::BrushStyle getFillStyle();
void setOutlineColor( QColor& c );
void setOutlineStyle( Qt::PenStyle pstyle );
void setOutlineWidth( double width );
void setFillColor( QColor& c );
void setFillStyle( Qt::BrushStyle fstyle );
void setLabel( QString label );
QString label();
protected:
QgsVectorLayer* mVectorLayer;
bool mDisabled;
// Reimplements dialog keyPress event so we can ignore it
void keyPressEvent( QKeyEvent * event );
public slots:
/* arrange the widgets on this dialog to reflect the current state of QgsSymbol */
void unset();
void set( const QgsSymbol *sy );
void updateSet( const QgsSymbol *sy );
/**applies the changes to the vector layer*/
void apply();
/**applies the changes to the QgsSymbol */
void apply( QgsSymbol *sy );
/**emits the signal settingsChanged()*/
void resendSettingsChanged();
/**changes the texture selection button to enabled or
* disabled depending if the texture entry in the combo
*/
void fillStyleChanged( int theIndex );
void refreshMarkers();
protected slots:
void selectOutlineColor( const QColor& color );
void selectFillColor( const QColor& color );
void selectTextureImage();
void symbolChanged( const QModelIndex &current, const QModelIndex &previous );
private:
/** Default constructor is private, do not use this */
QgsSingleSymbolDialog();
QString mTexturePath;
signals:
void settingsChanged();
};
#endif

View File

@ -1,472 +0,0 @@
/***************************************************************************
qgsuniquevaluedialog.cpp - description
-------------------
begin : July 2004
copyright : (C) 2004 by Marco Hugentobler
email : marco.hugentobler@autoform.ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsuniquevaluedialog.h"
#include "qgsfeature.h"
#include "qgsfield.h"
#include "qgssymbol.h"
#include "qgsuniquevaluerenderer.h"
#include "qgsvectordataprovider.h"
#include "qgsvectorlayer.h"
#include "qgslogger.h"
#include <QMessageBox>
#include <QKeyEvent>
QgsUniqueValueDialog::QgsUniqueValueDialog( QgsVectorLayer* vl ): QDialog(), mVectorLayer( vl ), sydialog( vl, true )
{
setupUi( this );
setOrientation( Qt::Vertical );
//find out the fields of mVectorLayer
if ( mVectorLayer )
{
//we cannot use unique values for not-commited fields because QgsVectorLayer has no 'unique values' method...
QgsVectorDataProvider* provider = mVectorLayer->dataProvider();
if ( provider )
{
const QgsFields & fields = provider->fields();
QString str;
for ( int idx = 0; idx < fields.count(); ++idx )
{
str = fields[idx].name();
str = mVectorLayer->attributeDisplayName( idx );
mClassificationComboBox->addItem( str, idx );
}
}
}
mClassListWidget->setSelectionMode( QAbstractItemView::ExtendedSelection );
mClassListWidget->setEditTriggers( QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed | QAbstractItemView::AnyKeyPressed );
mClassListWidget->setSortingEnabled( true );
if ( mVectorLayer )
{
const QgsUniqueValueRenderer* renderer = dynamic_cast<const QgsUniqueValueRenderer *>( mVectorLayer->renderer() );
if ( renderer )
{
mClassListWidget->clear();
QString field = mVectorLayer->attributeDisplayName( renderer->classificationField() );
mOldClassificationAttribute = field;
mClassificationComboBox->setCurrentIndex( mClassificationComboBox->findText( field ) );
const QList<QgsSymbol*> list = renderer->symbols();
//fill the items of the renderer into mValues
for ( QList<QgsSymbol*>::const_iterator iter = list.begin(); iter != list.end(); ++iter )
{
QgsSymbol* symbol = *iter;
QString symbolvalue = symbol->lowerValue();
QgsSymbol* sym = new QgsSymbol( mVectorLayer->geometryType(), symbol->lowerValue(), symbol->upperValue(), symbol->label() );
sym->setPen( symbol->pen() );
sym->setCustomTexture( symbol->customTexture() );
sym->setBrush( symbol->brush() );
sym->setNamedPointSymbol( symbol->pointSymbolName() );
sym->setPointSize( symbol->pointSize() );
sym->setPointSizeUnits( symbol->pointSizeUnits() );
sym->setScaleClassificationField( symbol->scaleClassificationField() );
sym->setRotationClassificationField( symbol->rotationClassificationField() );
mValues.insert( symbolvalue, sym );
QListWidgetItem *item = new QListWidgetItem( symbolvalue );
mClassListWidget->addItem( item );
updateEntryIcon( symbol, item );
item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled );
item->setData( Qt::UserRole, symbol->lowerValue() );
item->setToolTip( symbol->label() );
}
}
}
mDeletePushButton->setEnabled( false );
connect( mClassifyButton, SIGNAL( clicked() ), this, SLOT( changeClassificationAttribute() ) );
connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addClass() ) );
connect( mDeletePushButton, SIGNAL( clicked() ), this, SLOT( deleteSelectedClasses() ) );
connect( mRandomizeColors, SIGNAL( clicked() ), this, SLOT( randomizeColors() ) );
connect( mResetColors, SIGNAL( clicked() ), this, SLOT( resetColors() ) );
connect( mClassListWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( selectionChanged() ) );
connect( mCommonPropertyLock, SIGNAL( clicked() ), this, SLOT( selectionChanged() ) );
connect( mClassListWidget, SIGNAL( itemChanged( QListWidgetItem * ) ), this, SLOT( itemChanged( QListWidgetItem * ) ) );
connect( &sydialog, SIGNAL( settingsChanged() ), this, SLOT( applySymbologyChanges() ) );
mSymbolWidgetStack->addWidget( &sydialog );
mSymbolWidgetStack->setCurrentWidget( &sydialog );
}
QgsUniqueValueDialog::~QgsUniqueValueDialog()
{
QgsDebugMsg( "called." );
QMap<QString, QgsSymbol *>::iterator myValueIterator = mValues.begin();
while ( myValueIterator != mValues.end() )
{
delete myValueIterator.value();
mValues.erase( myValueIterator );
myValueIterator = mValues.begin(); // since iterator invalidated due to
// erase(), reset to new first element
}
mClassListWidget->setCurrentItem( 0 );
}
void QgsUniqueValueDialog::apply()
{
QgsDebugMsg( "called." );
QgsUniqueValueRenderer *renderer = new QgsUniqueValueRenderer( mVectorLayer->geometryType() );
//go through mValues and add the entries to the renderer
for ( QMap<QString, QgsSymbol*>::iterator it = mValues.begin(); it != mValues.end(); ++it )
{
QgsSymbol* symbol = it.value();
QgsSymbol* newsymbol = new QgsSymbol( mVectorLayer->geometryType(), symbol->lowerValue(), symbol->upperValue(), symbol->label() );
newsymbol->setPen( symbol->pen() );
newsymbol->setCustomTexture( symbol->customTexture() );
newsymbol->setBrush( symbol->brush() );
newsymbol->setNamedPointSymbol( symbol->pointSymbolName() );
newsymbol->setPointSize( symbol->pointSize() );
newsymbol->setPointSizeUnits( symbol->pointSizeUnits() );
newsymbol->setScaleClassificationField( symbol->scaleClassificationField() );
newsymbol->setRotationClassificationField( symbol->rotationClassificationField() );
renderer->insertValue( it.key(), newsymbol );
}
renderer->updateSymbolAttributes();
QgsVectorDataProvider *provider = dynamic_cast<QgsVectorDataProvider *>( mVectorLayer->dataProvider() );
if ( provider )
{
int fieldIndex = mClassificationComboBox->itemData( mClassificationComboBox->currentIndex() ).toInt();
if ( fieldIndex != -1 )
{
renderer->setClassificationField( fieldIndex );
mVectorLayer->setRenderer( renderer );
return;
}
}
delete renderer; //something went wrong
}
QColor QgsUniqueValueDialog::randomColor()
{
QColor thecolor;
//insert a random color
int red = 1 + ( int )( 255.0 * rand() / ( RAND_MAX + 1.0 ) );
int green = 1 + ( int )( 255.0 * rand() / ( RAND_MAX + 1.0 ) );
int blue = 1 + ( int )( 255.0 * rand() / ( RAND_MAX + 1.0 ) );
thecolor.setRgb( red, green, blue );
return thecolor;
}
void QgsUniqueValueDialog::setSymbolColor( QgsSymbol *symbol, QColor thecolor )
{
QPen pen;
QBrush brush;
if ( mVectorLayer->geometryType() == QGis::Line )
{
pen.setColor( thecolor );
pen.setStyle( Qt::SolidLine );
pen.setWidthF( symbol->lineWidth() );
}
else
{
brush.setColor( thecolor );
brush.setStyle( Qt::SolidPattern );
pen.setColor( Qt::black );
pen.setStyle( Qt::SolidLine );
pen.setWidthF( symbol->lineWidth() );
}
symbol->setPen( pen );
symbol->setBrush( brush );
}
void QgsUniqueValueDialog::addClass( QString value )
{
QgsDebugMsg( "called." );
if ( mValues.contains( value ) )
{
int i;
for ( i = 0; mValues.contains( value + QString::number( i ) ); i++ )
;
value += QString::number( i );
}
QgsSymbol *symbol = new QgsSymbol( mVectorLayer->geometryType(), value, value, value.isNull() ? tr( "default" ) : "" );
mValues.insert( value, symbol );
QListWidgetItem *item = new QListWidgetItem( value );
item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled );
item->setData( Qt::UserRole, value );
item->setToolTip( symbol->label() );
mClassListWidget->addItem( item );
setSymbolColor( symbol, randomColor() );
updateEntryIcon( symbol, item );
}
void QgsUniqueValueDialog::randomizeColors()
{
QList<QListWidgetItem *> selection = mClassListWidget->selectedItems();
if ( selection.size() == 0 )
selection = mClassListWidget->findItems( "", Qt::MatchContains );
for ( int i = 0; i < selection.size(); i++ )
{
QListWidgetItem *item = selection[i];
if ( !item )
continue;
if ( !mValues.contains( item->text() ) )
continue;
QgsSymbol *symbol = mValues[ item->text()];
setSymbolColor( symbol, randomColor() );
updateEntryIcon( symbol, item );
}
selectionChanged();
}
void QgsUniqueValueDialog::resetColors()
{
QColor white;
white.setRgb( 255, 255, 255 );
QList<QListWidgetItem *> selection = mClassListWidget->selectedItems();
if ( selection.size() == 0 )
selection = mClassListWidget->findItems( "", Qt::MatchContains );
for ( int i = 0; i < selection.size(); i++ )
{
QListWidgetItem *item = selection[i];
if ( !item )
continue;
if ( !mValues.contains( item->text() ) )
continue;
QgsSymbol *symbol = mValues[ item->text()];
setSymbolColor( symbol, white );
updateEntryIcon( symbol, item );
}
selectionChanged();
}
void QgsUniqueValueDialog::changeClassificationAttribute()
{
QgsDebugMsg( "called." );
QString attributeName = mClassificationComboBox->currentText();
if ( !mOldClassificationAttribute.isEmpty() &&
attributeName != mOldClassificationAttribute &&
QMessageBox::question( this,
tr( "Confirm Delete" ),
tr( "The classification field was changed from '%1' to '%2'.\n"
"Should the existing classes be deleted before classification?" )
.arg( mOldClassificationAttribute ).arg( attributeName ),
QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
{
mClassListWidget->clearSelection();
deleteSelectedClasses();
}
mOldClassificationAttribute = attributeName;
if ( mVectorLayer )
{
int nr = mClassificationComboBox->itemData( mClassificationComboBox->currentIndex() ).toInt();
if ( nr == -1 )
{
return;
}
QList<QVariant> values;
mVectorLayer->uniqueValues( nr, values );
for ( int i = 0; i < values.size(); i++ )
{
if ( !mValues.contains( values[i].toString() ) )
addClass( values[i].toString() );
}
if ( !mValues.contains( QString::null ) )
addClass( QString::null );
}
}
void QgsUniqueValueDialog::itemChanged( QListWidgetItem *item )
{
QString oldValue = item->data( Qt::UserRole ).toString();
QString newValue = item->text();
if ( oldValue == newValue )
return;
if ( !mValues.contains( newValue ) )
{
QgsSymbol *sy = mValues[oldValue];
mValues.remove( oldValue );
mValues.insert( newValue, sy );
sy->setLowerValue( newValue );
item->setData( Qt::UserRole, newValue );
updateEntryIcon( sy, item );
}
else
item->setText( oldValue );
}
void QgsUniqueValueDialog::selectionChanged()
{
QgsDebugMsg( "called." );
sydialog.blockSignals( true );//block signal to prevent sydialog from changing the current QgsRenderItem
QList<QListWidgetItem *> selection = mClassListWidget->selectedItems();
if ( selection.size() == 0 )
{
mDeletePushButton->setEnabled( false );
sydialog.unset();
}
else
{
mDeletePushButton->setEnabled( true );
if ( selection.size() == 1 || !mCommonPropertyLock->isChecked() )
{
QListWidgetItem *item = selection[0];
if ( !item )
return;
if ( !mValues.contains( item->text() ) )
return;
QgsSymbol *symbol = mValues[ item->text()];
sydialog.set( symbol );
sydialog.setLabel( symbol->label() );
}
else if ( selection.size() > 1 && mCommonPropertyLock->isChecked() )
{
if ( !mValues.contains( selection[0]->text() ) )
return;
sydialog.set( mValues[ selection[0]->text()] );
for ( int i = 1; i < selection.size(); i++ )
{
if ( !mValues.contains( selection[i]->text() ) )
continue;
sydialog.updateSet( mValues[ selection[i]->text()] );
}
}
}
sydialog.blockSignals( false );
}
void QgsUniqueValueDialog::deleteSelectedClasses()
{
QgsDebugMsg( "called." );
QList<QListWidgetItem *> selection = mClassListWidget->selectedItems();
if ( selection.size() == 0 )
selection = mClassListWidget->findItems( "", Qt::MatchContains );
for ( int i = 0; i < selection.size(); i++ )
{
QListWidgetItem* currentItem = selection[i];
if ( !currentItem )
continue;
mValues.remove( currentItem->text() );
mClassListWidget->removeItemWidget( currentItem );
delete currentItem;
}
QgsDebugMsg( QString( "numRows: %1" ).arg( mClassListWidget->count() ) );
}
void QgsUniqueValueDialog::applySymbologyChanges()
{
QgsDebugMsg( "called." );
QList<QListWidgetItem *> selection = mClassListWidget->selectedItems();
for ( int i = 0; i < selection.size(); i++ )
{
QListWidgetItem* item = selection[i];
if ( !item )
{
QgsDebugMsg( QString( "selected item %1 not found" ).arg( i ) );
continue;
}
QString value = item->text();
if ( !mValues.contains( value ) )
{
QgsDebugMsg( QString( "value %1 not found" ).arg( value ) );
continue;
}
QgsSymbol *symbol = mValues[ value ];
symbol->setLowerValue( value );
sydialog.apply( symbol );
item->setToolTip( symbol->label() );
item->setData( Qt::UserRole, value );
updateEntryIcon( symbol, item );
}
}
void QgsUniqueValueDialog::updateEntryIcon( QgsSymbol *thepSymbol, QListWidgetItem *thepItem )
{
QGis::GeometryType myType = mVectorLayer->geometryType();
switch ( myType )
{
case QGis::Point:
{
double size = thepSymbol->pointSize();
if ( size > 50.0 )
thepSymbol->setPointSize( 50.0 );
thepItem->setIcon( QIcon( QPixmap::fromImage( thepSymbol->getPointSymbolAsImage( 4.0, false, Qt::yellow, 1.0, 0.0001 ) ) ) );
if ( size > 50.0 )
thepSymbol->setPointSize( size );
}
break;
case QGis::Line:
thepItem->setIcon( QIcon( QPixmap::fromImage( thepSymbol->getLineSymbolAsImage() ) ) );
break;
case QGis::Polygon:
thepItem->setIcon( QIcon( QPixmap::fromImage( thepSymbol->getPolygonSymbolAsImage() ) ) );
break;
default: //unknown
QgsDebugMsg( "Vector layer type unknown" );
//do nothing
}
}
void QgsUniqueValueDialog::keyPressEvent( QKeyEvent * e )
{
// Ignore the ESC key to avoid close the dialog without the properties window
if ( e->key() == Qt::Key_Escape )
{
e->ignore();
}
}

View File

@ -1,75 +0,0 @@
/***************************************************************************
qgsuniquevaluedialog.h - description
-------------------
begin : July 2004
copyright : (C) 2004 by Marco Hugentobler
email : marco.hugentobler@autoform.ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSUNIQUEVALUEDIALOG_H
#define QGSUNIQUEVALUEDIALOG_H
#include "ui_qgsuniquevaluedialogbase.h"
#include "qgssinglesymboldialog.h"
#include <map>
class QgsVectorLayer;
class QgsUniqueValueDialog: public QDialog, private Ui::QgsUniqueValueDialogBase
{
Q_OBJECT
public:
QgsUniqueValueDialog( QgsVectorLayer* vl );
~QgsUniqueValueDialog();
public slots:
void apply();
void itemChanged( QListWidgetItem *item );
void randomizeColors();
void resetColors();
protected:
/**Pointer to the associated vector layer*/
QgsVectorLayer* mVectorLayer;
/**Set to store the already entered values*/
QMap<QString, QgsSymbol*> mValues;
QgsSingleSymbolDialog sydialog;
// Reimplements dialog keyPress event so we can ignore it
void keyPressEvent( QKeyEvent * event );
protected slots:
/**Set new attribut for classification*/
void changeClassificationAttribute();
/**update single symbol dialog after selection changed*/
void selectionChanged();
/**add a new classes to the classification*/
void addClass( QString value = QString::null );
/**Removes the selected classes from the classification*/
void deleteSelectedClasses();
/**Writes changes in the single symbol dialog to the corresponding QgsSymbol*/
void applySymbologyChanges();
private:
/** Update the list widget item icon with a preview for the symbol.
* @param QgsSymbol * - symbol holding the style info.
* @param QListWidgetItem * - item to get its icon updated.
*/
void updateEntryIcon( QgsSymbol * thepSymbol, QListWidgetItem * thepItem );
QColor randomColor();
void setSymbolColor( QgsSymbol *symbol, QColor thecolor );
QString mOldClassificationAttribute;
};
#endif

View File

@ -25,13 +25,11 @@
#include "qgsattributeactiondialog.h"
#include "qgsapplydialog.h"
#include "qgscontexthelp.h"
#include "qgscontinuouscolordialog.h"
#include "qgscoordinatetransform.h"
#include "qgsdiagramproperties.h"
#include "qgsdiagramrendererv2.h"
#include "qgsfieldcalculator.h"
#include "qgsfieldsproperties.h"
#include "qgsgraduatedsymboldialog.h"
#include "qgslabeldialog.h"
#include "qgslabelinggui.h"
#include "qgslabel.h"
@ -42,8 +40,6 @@
#include "qgspluginmetadata.h"
#include "qgspluginregistry.h"
#include "qgsproject.h"
#include "qgssinglesymboldialog.h"
#include "qgsuniquevaluedialog.h"
#include "qgsvectorlayer.h"
#include "qgsvectorlayerproperties.h"
#include "qgsconfig.h"
@ -91,8 +87,6 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
connect( insertFieldButton, SIGNAL( clicked() ), this, SLOT( insertField() ) );
connect( insertExpressionButton, SIGNAL( clicked() ), this, SLOT( insertExpression() ) );
connect( btnUseNewSymbology, SIGNAL( clicked() ), this, SLOT( useNewSymbology() ) );
QVBoxLayout *layout;
if ( layer->hasGeometryType() )
@ -172,8 +166,6 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
leSpatialRefSys->setText( layer->crs().authid() + " - " + layer->crs().description() );
leSpatialRefSys->setCursorPosition( 0 );
connect( sliderTransparency, SIGNAL( valueChanged( int ) ), this, SLOT( sliderTransparency_valueChanged( int ) ) );
//insert existing join info
const QList< QgsVectorJoinInfo >& joins = layer->vectorJoins();
for ( int i = 0; i < joins.size(); ++i )
@ -239,49 +231,11 @@ void QgsVectorLayerProperties::toggleEditing()
}
}
void QgsVectorLayerProperties::sliderTransparency_valueChanged( int theValue )
{
//set the transparency percentage label to a suitable value
int myInt = static_cast < int >(( theValue / 255.0 ) * 100 ); //255.0 to prevent integer division
lblTransparencyPercent->setText( tr( "Transparency: %1%" ).arg( myInt ) );
}//sliderTransparency_valueChanged
void QgsVectorLayerProperties::setLabelCheckBox()
{
labelCheckBox->setCheckState( Qt::Checked );
}
void QgsVectorLayerProperties::alterLayerDialog( const QString & dialogString )
{
widgetStackRenderers->removeWidget( mRendererDialog );
delete mRendererDialog;
mRendererDialog = 0;
if ( dialogString == tr( "Single Symbol" ) )
{
mRendererDialog = new QgsSingleSymbolDialog( layer );
}
else if ( dialogString == tr( "Graduated Symbol" ) )
{
mRendererDialog = new QgsGraduatedSymbolDialog( layer );
}
else if ( dialogString == tr( "Continuous Color" ) )
{
mRendererDialog = new QgsContinuousColorDialog( layer );
}
else if ( dialogString == tr( "Unique Value" ) )
{
mRendererDialog = new QgsUniqueValueDialog( layer );
}
widgetStackRenderers->addWidget( mRendererDialog );
widgetStackRenderers->setCurrentWidget( mRendererDialog );
}
void QgsVectorLayerProperties::setLegendType( QString type )
{
legendtypecombobox->setItemText( legendtypecombobox->currentIndex(), type );
}
void QgsVectorLayerProperties::insertField()
{
// Convert the selected field to an expression and
@ -383,18 +337,6 @@ void QgsVectorLayerProperties::reset( void )
cbMinimumScale->setScale( 1.0 / layer->minimumScale() );
cbMaximumScale->setScale( 1.0 / layer->maximumScale() );
// symbology initialization
if ( legendtypecombobox->count() == 0 )
{
legendtypecombobox->addItem( tr( "Single Symbol" ) );
if ( myFields.size() > 0 )
{
legendtypecombobox->addItem( tr( "Graduated Symbol" ) );
legendtypecombobox->addItem( tr( "Continuous Color" ) );
legendtypecombobox->addItem( tr( "Unique Value" ) );
}
}
// load appropriate symbology page (V1 or V2)
updateSymbologyPage();
@ -412,11 +354,6 @@ void QgsVectorLayerProperties::reset( void )
mFieldsPropertiesDialog->init();
//set the transparency slider
sliderTransparency->setValue( 255 - layer->getTransparency() );
//update the transparency percentage label
sliderTransparency_valueChanged( 255 - layer->getTransparency() );
QObject::connect( labelCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( enableLabelOptions( bool ) ) );
} // reset()
@ -473,8 +410,6 @@ void QgsVectorLayerProperties::apply()
layer->enableLabels( labelCheckBox->isChecked() );
layer->setLayerName( mLayerOrigNameLineEdit->text() );
QSet<QString> excludeAttributesWMS, excludeAttributesWFS;
// Apply fields settings
mFieldsPropertiesDialog->apply();
@ -484,36 +419,6 @@ void QgsVectorLayerProperties::apply()
static_cast<QgsRendererV2PropertiesDialog*>( widgetStackRenderers->currentWidget() );
dlg->apply();
}
else
{
QgsSingleSymbolDialog *sdialog =
qobject_cast < QgsSingleSymbolDialog * >( widgetStackRenderers->currentWidget() );
QgsGraduatedSymbolDialog *gdialog =
qobject_cast < QgsGraduatedSymbolDialog * >( widgetStackRenderers->currentWidget() );
QgsContinuousColorDialog *cdialog =
qobject_cast < QgsContinuousColorDialog * >( widgetStackRenderers->currentWidget() );
QgsUniqueValueDialog* udialog =
qobject_cast< QgsUniqueValueDialog * >( widgetStackRenderers->currentWidget() );
if ( sdialog )
{
sdialog->apply();
}
else if ( gdialog )
{
gdialog->apply();
}
else if ( cdialog )
{
cdialog->apply();
}
else if ( udialog )
{
udialog->apply();
}
layer->setTransparency( static_cast < unsigned int >( 255 - sliderTransparency->value() ) );
}
//apply diagram settings
diagramPropertiesDialog->apply();
@ -794,20 +699,6 @@ QList<QgsVectorOverlayPlugin*> QgsVectorLayerProperties::overlayPlugins() const
return pluginList;
}
void QgsVectorLayerProperties::setUsingNewSymbology( bool useNewSymbology )
{
if ( useNewSymbology )
{
QgsSymbologyV2Conversion::rendererV1toV2( layer );
}
else
{
QgsSymbologyV2Conversion::rendererV2toV1( layer );
}
// update GUI!
updateSymbologyPage();
}
void QgsVectorLayerProperties::on_mButtonAddJoin_clicked()
{
@ -880,18 +771,6 @@ void QgsVectorLayerProperties::on_mButtonRemoveJoin_clicked()
}
void QgsVectorLayerProperties::useNewSymbology()
{
int res = QMessageBox::question( this, tr( "Symbology" ),
tr( "Do you wish to use the new symbology implementation for this layer?" ),
QMessageBox::Yes | QMessageBox::No );
if ( res != QMessageBox::Yes )
return;
setUsingNewSymbology( true );
}
void QgsVectorLayerProperties::updateSymbologyPage()
{
@ -899,57 +778,15 @@ void QgsVectorLayerProperties::updateSymbologyPage()
delete mRendererDialog;
mRendererDialog = 0;
bool v2 = layer->isUsingRendererV2();
// hide unused widgets
legendtypecombobox->setVisible( !v2 );
legendtypelabel->setVisible( !v2 );
lblTransparencyPercent->setVisible( !v2 );
sliderTransparency->setVisible( !v2 );
btnUseNewSymbology->setVisible( !v2 );
if ( v2 )
if ( layer->isUsingRendererV2() )
{
mRendererDialog = new QgsRendererV2PropertiesDialog( layer, QgsStyleV2::defaultStyle(), true );
connect( mRendererDialog, SIGNAL( useNewSymbology( bool ) ), this, SLOT( setUsingNewSymbology( bool ) ) );
// display the menu to choose the output format (fix #5136)
pbnSaveStyleAs->setText( tr( "Save Style" ) );
pbnSaveStyleAs->setMenu( mSaveAsMenu );
QObject::disconnect( pbnSaveStyleAs, SIGNAL( clicked() ), this, SLOT( on_pbnSaveStyleAs_clicked() ) );
}
else if ( layer->renderer() )
{
QString rtype = layer->renderer()->name();
if ( rtype == "Single Symbol" )
{
mRendererDialog = new QgsSingleSymbolDialog( layer );
legendtypecombobox->setCurrentIndex( 0 );
}
else if ( rtype == "Graduated Symbol" )
{
mRendererDialog = new QgsGraduatedSymbolDialog( layer );
legendtypecombobox->setCurrentIndex( 1 );
}
else if ( rtype == "Continuous Color" )
{
mRendererDialog = new QgsContinuousColorDialog( layer );
legendtypecombobox->setCurrentIndex( 2 );
}
else if ( rtype == "Unique Value" )
{
mRendererDialog = new QgsUniqueValueDialog( layer );
legendtypecombobox->setCurrentIndex( 3 );
}
QObject::connect( legendtypecombobox, SIGNAL( activated( const QString & ) ), this,
SLOT( alterLayerDialog( const QString & ) ) );
pbnSaveStyleAs->setText( tr( "Save Style..." ) );
pbnSaveStyleAs->setMenu( NULL );
QObject::connect( pbnSaveStyleAs, SIGNAL( clicked() ), this, SLOT( on_pbnSaveStyleAs_clicked() ) );
}
else
{
tabWidget->setTabEnabled( 0, false ); // hide symbology item

View File

@ -55,8 +55,6 @@ class QgsVectorLayerProperties : public QDialog, private Ui::QgsVectorLayerPrope
QgsVectorLayerProperties( QgsVectorLayer *lyr = 0, QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags );
~QgsVectorLayerProperties();
/**Sets the legend type to "single symbol", "graduated symbol" or "continuous color"*/
void setLegendType( QString type );
/**Returns the display name entered in the dialog*/
QString displayName();
void setRendererDirty( bool ) {}
@ -81,8 +79,6 @@ class QgsVectorLayerProperties : public QDialog, private Ui::QgsVectorLayerPrope
void insertExpression();
void alterLayerDialog( const QString& string );
/** Reset to original (vector layer) values */
void reset();
@ -94,9 +90,6 @@ class QgsVectorLayerProperties : public QDialog, private Ui::QgsVectorLayerPrope
*/
void on_mLayerOrigNameLineEdit_textEdited( const QString& text );
/** Set transparency based on slider position */
void sliderTransparency_valueChanged( int theValue );
/** Toggles on the label check box */
void setLabelCheckBox();
@ -120,9 +113,6 @@ class QgsVectorLayerProperties : public QDialog, private Ui::QgsVectorLayerPrope
void enableLabelOptions( bool theFlag );
void useNewSymbology();
void setUsingNewSymbology( bool useNewSymbology );
void on_mButtonAddJoin_clicked();
void on_mButtonRemoveJoin_clicked();

View File

@ -82,7 +82,6 @@ QgsRendererV2PropertiesDialog::QgsRendererV2PropertiesDialog( QgsVectorLayer* la
}
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( onOK() ) );
connect( btnOldSymbology, SIGNAL( clicked() ), this, SLOT( useOldSymbology() ) );
// initialize registry's widget functions
_initRendererWidgetFunctions();
@ -204,18 +203,3 @@ void QgsRendererV2PropertiesDialog::keyPressEvent( QKeyEvent * e )
QDialog::keyPressEvent( e );
}
}
void QgsRendererV2PropertiesDialog::useOldSymbology()
{
int res = QMessageBox::question( this, tr( "Symbology" ),
tr( "Do you wish to use the original symbology implementation for this layer?" ),
QMessageBox::Yes | QMessageBox::No );
if ( res != QMessageBox::Yes )
return;
emit useNewSymbology( false );
}

View File

@ -43,11 +43,6 @@ class GUI_EXPORT QgsRendererV2PropertiesDialog : public QDialog, private Ui::Qgs
void apply();
void onOK();
void useOldSymbology();
signals:
void useNewSymbology( bool );
protected:
//! Reimplements dialog keyPress event so we can ignore it

View File

@ -57,6 +57,7 @@ QgsSingleSymbolRendererV2Widget::QgsSingleSymbolRendererV2Widget( QgsVectorLayer
connect( mSelector, SIGNAL( symbolModified() ), this, SLOT( changeSingleSymbol() ) );
QVBoxLayout* layout = new QVBoxLayout;
layout->setContentsMargins( 0, 0, 0, 0 );
layout->addWidget( mSelector );
setLayout( layout );

View File

@ -6,11 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>599</width>
<height>298</height>
<width>597</width>
<height>296</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>

View File

@ -1,152 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QgsContinuousColorDialogBase</class>
<widget class="QDialog" name="QgsContinuousColorDialogBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>263</width>
<height>175</height>
</rect>
</property>
<property name="windowTitle">
<string>Continuous color</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="classvarlabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Classification field</string>
</property>
<property name="buddy">
<cstring>classificationComboBox</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="classificationComboBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mincolorlabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Minimum value</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="maxcolorlabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Maximum value</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="outlinewidthlabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Outline width</string>
</property>
<property name="buddy">
<cstring>outlinewidthspinbox</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="outlinewidthspinbox"/>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="cb_polygonOutline">
<property name="text">
<string>Draw polygon outline</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QgsColorButton" name="btnMinValue">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QgsColorButton" name="btnMaxValue">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QgsColorButton</class>
<extends>QPushButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>classificationComboBox</tabstop>
<tabstop>outlinewidthspinbox</tabstop>
<tabstop>cb_polygonOutline</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@ -1,241 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QgsGraduatedSymbolDialogBase</class>
<widget class="QDialog" name="QgsGraduatedSymbolDialogBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>548</width>
<height>479</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32767</width>
<height>32767</height>
</size>
</property>
<property name="windowTitle">
<string>graduated Symbol</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="classvarlabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Classification field</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>classificationComboBox</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="classificationComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="modelabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Mode</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>modeComboBox</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="modeComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="numberofclasseslabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Number of classes</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>numberofclassesspinbox</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="numberofclassesspinbox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="mClassifyButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Classify</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="mDeleteClassButton">
<property name="text">
<string>Delete class</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="0" column="1" rowspan="2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QStackedWidget" name="mSymbolWidgetStack">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page"/>
<widget class="QWidget" name="page_2"/>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QListWidget" name="mClassListWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<tabstops>
<tabstop>classificationComboBox</tabstop>
<tabstop>modeComboBox</tabstop>
<tabstop>numberofclassesspinbox</tabstop>
<tabstop>mClassifyButton</tabstop>
<tabstop>mDeleteClassButton</tabstop>
<tabstop>mClassListWidget</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@ -6,11 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>507</width>
<height>341</height>
<width>505</width>
<height>339</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout">
<item row="0" column="0">

View File

@ -6,14 +6,17 @@
<rect>
<x>0</x>
<y>0</y>
<width>383</width>
<height>532</height>
<width>381</width>
<height>530</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>529</width>
<height>324</height>
<width>525</width>
<height>320</height>
</rect>
</property>
<property name="windowTitle">
@ -42,13 +42,6 @@
<item>
<widget class="QgsBlendModeComboBox" name="mBlendModeComboBox"/>
</item>
<item>
<widget class="QPushButton" name="btnOldSymbology">
<property name="text">
<string>Old symbology</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -67,6 +60,9 @@
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">

View File

@ -1,437 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QgsSingleSymbolDialogBase</class>
<widget class="QDialog" name="QgsSingleSymbolDialogBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>372</width>
<height>620</height>
</rect>
</property>
<property name="windowTitle">
<string>Single Symbol</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>-37</y>
<width>358</width>
<height>640</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QGroupBox" name="mGroupPoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Point Symbol</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="0">
<widget class="QLabel" name="textLabel1_2">
<property name="text">
<string>Size</string>
</property>
<property name="buddy">
<cstring>mPointSizeSpinBox</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="mPointSizeSpinBox">
<property name="decimals">
<number>5</number>
</property>
<property name="maximum">
<double>1000000.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="mPointSizeUnitsCheckBox">
<property name="text">
<string>In map units</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QListView" name="lstSymbols">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::DragDrop</enum>
</property>
<property name="alternatingRowColors">
<bool>false</bool>
</property>
<property name="iconSize">
<size>
<width>0</width>
<height>-1</height>
</size>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
<property name="layoutMode">
<enum>QListView::Batched</enum>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Label</string>
</property>
<property name="buddy">
<cstring>mLabelEdit</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLineEdit" name="mLabelEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Fill options</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QComboBox" name="cboFillStyle">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>172</width>
<height>16777215</height>
</size>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolSelectTexture">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QgsColorButton" name="btnFillColor">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Outline options</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QComboBox" name="cboOutlineStyle">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QgsColorButton" name="btnOutlineColor">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="outlinewidthlabel">
<property name="text">
<string>Width</string>
</property>
<property name="buddy">
<cstring>outlinewidthspinbox</cstring>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="outlinewidthspinbox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>172</width>
<height>16777215</height>
</size>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="5" column="0">
<widget class="QGroupBox" name="mGroupDrawingByField">
<property name="title">
<string>Drawing by field</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="mLblRotationField">
<property name="text">
<string>Rotation</string>
</property>
<property name="buddy">
<cstring>mRotationClassificationComboBox</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="mRotationClassificationComboBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="textLabel9">
<property name="text">
<string>Area scale</string>
</property>
<property name="buddy">
<cstring>mScaleClassificationComboBox</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="mScaleClassificationComboBox"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Symbol</string>
</property>
<property name="buddy">
<cstring>mSymbolComboBox</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="mSymbolComboBox"/>
</item>
</layout>
</widget>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QgsColorButton</class>
<extends>QPushButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>lstSymbols</tabstop>
<tabstop>mPointSizeSpinBox</tabstop>
<tabstop>mPointSizeUnitsCheckBox</tabstop>
<tabstop>mLabelEdit</tabstop>
<tabstop>cboFillStyle</tabstop>
<tabstop>toolSelectTexture</tabstop>
<tabstop>btnFillColor</tabstop>
<tabstop>cboOutlineStyle</tabstop>
<tabstop>btnOutlineColor</tabstop>
<tabstop>outlinewidthspinbox</tabstop>
<tabstop>mRotationClassificationComboBox</tabstop>
<tabstop>mScaleClassificationComboBox</tabstop>
<tabstop>mSymbolComboBox</tabstop>
<tabstop>scrollArea</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@ -1,191 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QgsUniqueValueDialogBase</class>
<widget class="QDialog" name="QgsUniqueValueDialogBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>661</width>
<height>408</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form1</string>
</property>
<layout class="QGridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>8</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="mClassVarLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>Classification field</string>
</property>
<property name="buddy">
<cstring>mClassificationComboBox</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="mClassificationComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout">
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>111</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="mClassifyButton">
<property name="text">
<string>Classify</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mAddButton">
<property name="text">
<string>Add class</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mDeletePushButton">
<property name="text">
<string>Delete classes</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mRandomizeColors">
<property name="text">
<string>Randomize Colors</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mResetColors">
<property name="text">
<string>Reset Colors</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" rowspan="3">
<widget class="QListWidget" name="mClassListWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QStackedWidget" name="mSymbolWidgetStack">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="page"/>
<widget class="QWidget" name="page_2"/>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="mCommonPropertyLock">
<property name="text">
<string>Restrict changes to common properties</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<tabstops>
<tabstop>mClassificationComboBox</tabstop>
<tabstop>mClassifyButton</tabstop>
<tabstop>mAddButton</tabstop>
<tabstop>mDeletePushButton</tabstop>
<tabstop>mRandomizeColors</tabstop>
<tabstop>mResetColors</tabstop>
<tabstop>mClassListWidget</tabstop>
<tabstop>mCommonPropertyLock</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>936</width>
<height>860</height>
<width>932</width>
<height>856</height>
</rect>
</property>
<property name="windowTitle">
@ -83,80 +83,7 @@
<string>Style</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="legendtypelabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>32767</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Legend type</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="legendtypecombobox">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32767</width>
<height>22</height>
</size>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lblTransparencyPercent">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Transparency</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QSlider" name="sliderTransparency">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="0" colspan="5">
<item row="0" column="0" colspan="2">
<widget class="QStackedWidget" name="widgetStackRenderers">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -175,13 +102,6 @@
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="btnUseNewSymbology">
<property name="text">
<string>New symbology</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="labelingTab">
@ -300,8 +220,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>914</width>
<height>746</height>
<width>680</width>
<height>393</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
@ -799,8 +719,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>896</width>
<height>728</height>
<width>94</width>
<height>211</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -911,8 +831,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>896</width>
<height>728</height>
<width>96</width>
<height>112</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_17">
@ -1020,7 +940,6 @@ p, li { white-space: pre-wrap; }
</tabstops>
<resources>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
</resources>
<connections>
<connection>