Skip to content
Permalink
Browse files

apply #3258

git-svn-id: http://svn.osgeo.org/qgis/trunk@14778 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Nov 28, 2010
1 parent 4426308 commit e7428cd0a52b750850413ce73dfef8afa02ed242
@@ -107,29 +107,6 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
myColor = QColor( myRedInt, myGreenInt, myBlueInt );
pbnCanvasColor->setColor( myColor );

//read the digitizing settings
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
if ( topologicalEditing != 0 )
{
mEnableTopologicalEditingCheckBox->setCheckState( Qt::Checked );
}
else
{
mEnableTopologicalEditingCheckBox->setCheckState( Qt::Unchecked );
}

bool avoidIntersectionListOk;
mAvoidIntersectionsSettings.clear();
QStringList avoidIntersectionsList = QgsProject::instance()->readListEntry( "Digitizing", "/AvoidIntersectionsList", &avoidIntersectionListOk );
if ( avoidIntersectionListOk )
{
QStringList::const_iterator avoidIt = avoidIntersectionsList.constBegin();
for ( ; avoidIt != avoidIntersectionsList.constEnd(); ++avoidIt )
{
mAvoidIntersectionsSettings.insert( *avoidIt );
}
}

QgsMapLayer* currentLayer = 0;

QStringList noIdentifyLayerIdList = QgsProject::instance()->readListEntry( "Identify", "/disabledLayers" );
@@ -325,20 +302,6 @@ void QgsProjectProperties::apply()
QgsProject::instance()->writeEntry( "Gui", "/CanvasColorGreenPart", myColor.green() );
QgsProject::instance()->writeEntry( "Gui", "/CanvasColorBluePart", myColor.blue() );

//write the digitizing settings
int topologicalEditingEnabled = ( mEnableTopologicalEditingCheckBox->checkState() == Qt::Checked ) ? 1 : 0;
QgsProject::instance()->writeEntry( "Digitizing", "/TopologicalEditing", topologicalEditingEnabled );

//store avoid intersection layers
QStringList avoidIntersectionList;
QSet<QString>::const_iterator avoidIt = mAvoidIntersectionsSettings.constBegin();
for ( ; avoidIt != mAvoidIntersectionsSettings.constEnd(); ++avoidIt )
{
avoidIntersectionList.append( *avoidIt );
}
QgsProject::instance()->writeEntry( "Digitizing", "/AvoidIntersectionsList", avoidIntersectionList );


QStringList noIdentifyLayerList;
for ( int i = 0; i < twIdentifyLayers->rowCount(); i++ )
{
@@ -389,16 +352,6 @@ void QgsProjectProperties::on_pbnCanvasColor_clicked()
}
}

void QgsProjectProperties::on_mAvoidIntersectionsPushButton_clicked()
{
QgsAvoidIntersectionsDialog d( mMapCanvas, mAvoidIntersectionsSettings );
if ( d.exec() == QDialog::Accepted )
{
d.enabledLayers( mAvoidIntersectionsSettings );
}
}


void QgsProjectProperties::on_cbxProjectionEnabled_stateChanged( int state )
{
btnGrpMapUnits->setEnabled( state == Qt::Unchecked );
@@ -89,11 +89,6 @@ class QgsProjectProperties : public QDialog, private Ui::QgsProjectPropertiesBas
*/
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }

/*!
*
*/
void on_mAvoidIntersectionsPushButton_clicked();

void on_cbxProjectionEnabled_stateChanged( int state );

/*!
@@ -112,9 +107,6 @@ class QgsProjectProperties : public QDialog, private Ui::QgsProjectPropertiesBas
private:
QgsMapCanvas* mMapCanvas;

/**Stores ids of layers where intersections of new polygons is considered. Is passed to / read from QgsAvoidIntersectionsDialog*/
QSet<QString> mAvoidIntersectionsSettings;

/*!
* Function to save dialog window state
*/
@@ -16,12 +16,14 @@
***************************************************************************/

#include "qgssnappingdialog.h"
#include "qgsavoidintersectionsdialog.h"
#include "qgsmapcanvas.h"
#include "qgsmaplayer.h"
#include "qgsvectorlayer.h"
#include "qgsmaplayerregistry.h"
#include "qgisapp.h"
#include "qgsproject.h"
#include "qgslogger.h"
#include <QCheckBox>
#include <QDoubleValidator>
#include <QComboBox>
@@ -36,7 +38,7 @@ class QgsSnappingDock : public QDockWidget
QgsSnappingDock( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 )
: QDockWidget( title, parent, flags )
{
setObjectName( "Snapping Options" ); // set object name so the position can be saved
setObjectName( "Snapping and Digitizing Options" ); // set object name so the position can be saved
}

virtual void closeEvent( QCloseEvent * ev )
@@ -54,7 +56,7 @@ QgsSnappingDialog::QgsSnappingDialog( QWidget* parent, QgsMapCanvas* canvas ): Q
bool myDockFlag = myQsettings.value( "/qgis/dockSnapping", false ).toBool();
if ( myDockFlag )
{
mDock = new QgsSnappingDock( tr( "Snapping Options" ), QgisApp::instance() );
mDock = new QgsSnappingDock( tr( "Snapping and Digitizing Options" ), QgisApp::instance() );
mDock->setAllowedAreas( Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea );
mDock->setWidget( this );
connect( this, SIGNAL( destroyed() ), mDock, SLOT( close() ) );
@@ -67,6 +69,7 @@ QgsSnappingDialog::QgsSnappingDialog( QWidget* parent, QgsMapCanvas* canvas ): Q
connect( mButtonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
}
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer * ) ), this, SLOT( connectUpdate( QgsMapLayer * ) ) );
connect( cbxEnableTopologicalEditingCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( on_cbxEnableTopologicalEditingCheckBox_stateChanged( int ) ) );

update();

@@ -87,6 +90,29 @@ QgsSnappingDialog::~QgsSnappingDialog()
{
}

void QgsSnappingDialog::on_cbxEnableTopologicalEditingCheckBox_stateChanged( int state )
{
int topologicalEditingEnabled = ( state == Qt::Checked ) ? 1 : 0;
QgsProject::instance()->writeEntry( "Digitizing", "/TopologicalEditing", topologicalEditingEnabled );
}

void QgsSnappingDialog::on_mAvoidIntersectionsPushButton_clicked()
{
QgsAvoidIntersectionsDialog d( mMapCanvas, mAvoidIntersectionsSettings );
if ( d.exec() == QDialog::Accepted )
{
d.enabledLayers( mAvoidIntersectionsSettings );
//store avoid intersection layers
QStringList avoidIntersectionList;
QSet<QString>::const_iterator avoidIt = mAvoidIntersectionsSettings.constBegin();
for ( ; avoidIt != mAvoidIntersectionsSettings.constEnd(); ++avoidIt )
{
avoidIntersectionList.append( *avoidIt );
}
QgsProject::instance()->writeEntry( "Digitizing", "/AvoidIntersectionsList", avoidIntersectionList );
}
}

void QgsSnappingDialog::closeEvent( QCloseEvent* event )
{
QDialog::closeEvent( event );
@@ -201,6 +227,29 @@ void QgsSnappingDialog::update()
cbxUnits->setCurrentIndex( toleranceUnitList[idx].toInt() );
}

// read the digitizing settings
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
if ( topologicalEditing != 0 )
{
cbxEnableTopologicalEditingCheckBox->setCheckState( Qt::Checked );
}
else
{
cbxEnableTopologicalEditingCheckBox->setCheckState( Qt::Unchecked );
}

bool avoidIntersectionListOk;
mAvoidIntersectionsSettings.clear();
QStringList avoidIntersectionsList = QgsProject::instance()->readListEntry( "Digitizing", "/AvoidIntersectionsList", &avoidIntersectionListOk );
if ( avoidIntersectionListOk )
{
QStringList::const_iterator avoidIt = avoidIntersectionsList.constBegin();
for ( ; avoidIt != avoidIntersectionsList.constEnd(); ++avoidIt )
{
mAvoidIntersectionsSettings.insert( *avoidIt );
}
}

if ( myDockFlag )
{
for ( int i = 0; i < mLayerTreeWidget->topLevelItemCount(); ++i )
@@ -48,11 +48,15 @@ class QgsSnappingDialog: public QDialog, private Ui::QgsSnappingDialogBase
//! connect to the layers destroyed() and then update()
void connectUpdate( QgsMapLayer* theMapLayer );

void on_cbxEnableTopologicalEditingCheckBox_stateChanged( int );
void on_mAvoidIntersectionsPushButton_clicked();

protected:
/**Constructor
@param canvas pointer to the map canvas (for detecting which vector layers are loaded
*/
//QgsSnappingDialog( QgsMapCanvas* canvas );

/**
* Handle closing of the window
* @param event unused
@@ -64,6 +68,9 @@ class QgsSnappingDialog: public QDialog, private Ui::QgsSnappingDialogBase
/**Default constructor forbidden*/
QgsSnappingDialog();

/**Stores ids of layers where intersections of new polygons is considered. Is passed to / read from QgsAvoidIntersectionsDialog*/
QSet<QString> mAvoidIntersectionsSettings;

/**Used to query the loaded layers*/
QgsMapCanvas* mMapCanvas;

@@ -23,7 +23,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<property name="iconSize">
<size>
@@ -285,35 +285,6 @@
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="grpDigitizing">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Digitizing</string>
</property>
<layout class="QGridLayout" name="gridLayout_1">
<item row="0" column="0">
<widget class="QCheckBox" name="mEnableTopologicalEditingCheckBox">
<property name="text">
<string>Enable topological editing</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="mAvoidIntersectionsPushButton">
<property name="text">
<string>Avoid intersections of new polygons...</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab2">
@@ -422,8 +393,6 @@
<tabstop>radAutomatic</tabstop>
<tabstop>radManual</tabstop>
<tabstop>spinBoxDP</tabstop>
<tabstop>mEnableTopologicalEditingCheckBox</tabstop>
<tabstop>mAvoidIntersectionsPushButton</tabstop>
<tabstop>cbxProjectionEnabled</tabstop>
<tabstop>twIdentifyLayers</tabstop>
<tabstop>tabWidget</tabstop>
@@ -13,14 +13,8 @@
<property name="windowTitle">
<string>Snapping options</string>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTreeWidget" name="mLayerTreeWidget">
<property name="indentation">
<number>0</number>
@@ -55,7 +49,31 @@
</column>
</widget>
</item>
<item row="1" column="0">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="cbxEnableTopologicalEditingCheckBox">
<property name="text">
<string>Enable topological editing</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mAvoidIntersectionsPushButton">
<property name="text">
<string>Avoid intersections of new polygons...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="mButtonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>

0 comments on commit e7428cd

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