108 changes: 54 additions & 54 deletions doc/TRANSLATORS

Large diffs are not rendered by default.

53 changes: 37 additions & 16 deletions doc/osx.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,23 @@ which can be used in build shell scripts like:
make -j $(/usr/sbin/sysctl -n hw.ncpu)
```

__Note:__ if you get an error in parallel compilation, try removing the -j # flag,
so it's just 'make', or using a smaller number. Sometimes make can hiccup on too
many threads.

== Install Developer Tools ==

Developer tools are not a part of a standard OS X installation. Up through
Snow Leopard, the Developer Tools, later called Xcode, were included with the
system install disks, though it's best to download the latest version compatible
with your system to get important updates fixing various issues.
Starting with Lion, Xcode is available as a download and from the App Store.
BUT, there is really no need for the full Xcode on Lion, and in fact could be
tricky to use for compiling QGIS.

Downloading Xcode/Developer Tools requires a free developer account at
Downloading Xcode/Developer Tools for up through Snow Leopard requires a free developer account at
developer.apple.com. Up through Snow Leopard, get the latest __Xcode__ that is
supported for your system. For Lion, all you need is the much smaller
__Command Line Tools for Xcode__ (you don't get the IDE or system SDKs but they are not
necessary for QGIS). When installing Xcode up through Snow Leopard, make sure to
supported for your system. For Lion and above, you can get Xcode from either a
free developer account or for a minimal fee from the app store.
When installing Xcode up through Snow Leopard, make sure to
do a custom install and install the Unix Development or Command Line Tools option.

On Lion, if you have installed Xcode 4.0 - 4.2 and are upgrading to 4.3, it's
Expand All @@ -73,8 +75,7 @@ sudo /Developer/Library/uninstall-devtools
```

On Lion and Mt. Lion, using Xcode 4.4+, the developer command line tools can be
installed via the Xcode preferences. The tools now appear to require an install
of Xcode, regardless of using a separate DMG installer for just the tools.
installed via the Xcode preferences.

Xcode 4.3+ also introduces the clang frontend to the LLVM compiler as default.

Expand Down Expand Up @@ -273,7 +274,7 @@ Double-click the source tarball to unpack, then, in Terminal.app, cd to the
source folder and:

```
./configure
./configure --disable-dependency-tracking CFLAGS=-Os
make
sudo make install
```
Expand All @@ -295,6 +296,9 @@ your own risk.

=== Additional dependencies: SIP ===

__Mt Lion note:__ SIP 4.15.7 appears to not work on Mt Lion. Install 4.14.6.
(or a later working version when available)

Retrieve the python bindings toolkit SIP from

http://www.riverbankcomputing.com/software/sip/download
Expand Down Expand Up @@ -345,11 +349,20 @@ python2.6 configure.py -n -d /Library/Python/2.6/site-packages -b /usr/local/bin
__Lion+ system Python__

Similar to Snow Leopard, you should install outside the system Python path.
There is no need for the SDK option or arch option:
The SDK option should match the system you are compiling on:

for Lion:

```
python2.7 configure.py -d /Library/Python/2.7/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip
-e /usr/local/include -v /usr/local/share/sip --arch=x86_64 -s MacOSX10.7.sdk
```

for Mt. Lion:

```
python2.7 configure.py -d /Library/Python/2.7/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip --arch=x86_64 -s MacOSX10.8.sdk
```

__continue...__
Expand Down Expand Up @@ -397,6 +410,7 @@ sudo make install
sudo install_name_tool -id /usr/local/lib/libqscintilla2.9.dylib \
/usr/local/lib/libqscintilla2.9.dylib
```

This installs QScintilla2's dylib in /usr/local/lib/ and the header files in
/usr/local/include/Qsci/, both of which should be automatically found when
building QGIS.
Expand Down Expand Up @@ -465,7 +479,7 @@ python2.6 configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin \
__Lion and Mt. Lion system Python__

Similar to Snow Leopard, you should install outside the system Python path.
But you don't need the arch option:
But you don't need the use-arch option:

```
python2.7 configure.py -d /Library/Python/2.7/site-packages -b /usr/local/bin -n /usr/local/Qt4.8/qsci -v /usr/local/share/sip/PyQt4
Expand Down Expand Up @@ -494,7 +508,11 @@ cd <QScintilla2 source dir>
cd Python
python2.7 configure.py -o /usr/local/lib -n /usr/local/include \
-d /Library/Python/2.7/site-packages/PyQt4 -v /usr/local/share/sip/PyQt4 \
--pyqt-sipdir=/usr/local/share/sip/PyQt4
--sip-incdir=/usr/local/include --pyqt-sipdir=/usr/local/share/sip/PyQt4
cat >>Qsci.pro <<EOF
QMAKE_LFLAGS_PLUGIN -= -dynamiclib
QMAKE_LFLAGS_PLUGIN += -bundle
EOF
qmake -spec macx-g++ Qsci.pro
make -j [#cpus]
sudo make install
Expand Down Expand Up @@ -651,7 +669,7 @@ make install
sudo mkdir -p "/Library/Application Support/OpenSceneGraph/PlugIns"
```

Enter the staging path you chose for the CMAKE_INSTALL_PREFIX option above.
Open the staging folder you chose for the CMAKE_INSTALL_PREFIX option above.

Now move all .frameworks from the lib/ folder in the staging area to /Library/Frameworks. Move the files in the osgPlugins folder in the lib/ folder
to /Library/Application Support/OpenSceneGraph/PlugIns. The bin/ executables
Expand Down Expand Up @@ -679,6 +697,8 @@ http://github.com/gwaldron/osgearth/tags
Download a tarball for the latest stable release (sorting can be confusing here).
Double-click the source tarball to unpack it.

__Note:__ for now stick with version 2.3. There are compile errors in 2.4 that need attention.

This one also needs an intermediate staging area. Choose a folder similar to OSG.

In a new Terminal cd to the source folder and:
Expand All @@ -696,13 +716,14 @@ make install
sudo mkdir -p "/Library/Application Support/OpenSceneGraph/Headers"
```

Enter the staging path you chose for the CMAKE_INSTALL_PREFIX option above.
Also enter the OSG staging path /bin folder in the export above.
Open the staging folder you chose for the CMAKE_INSTALL_PREFIX option above.
Also open the OSG staging path /bin folder from the OSG build.

Move all the .frameworks from the lib/ folder to /Library/Frameworks.
Move the files in the osgPlugins folder in the lib/ folder to
/Library/Application Support/OpenSceneGraph/PlugIns. Move the osgEarthDrivers
folder in the include/ folder to /Library/Application Support/OpenSceneGraph/Headers.
(you may need to create this folder)
And as for OSG, you can leave the bin/ executables where they are.

== API documentation ==
Expand Down
2 changes: 1 addition & 1 deletion i18n/qgis_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13386,7 +13386,7 @@ SQL: %1</translation>
<message>
<location filename="../src/app/qgisapp.cpp" line="308"/>
<source>QGIS </source>
<translation>QGIS</translation>
<translation>QGIS </translation>
</message>
<message>
<location filename="../src/app/qgisapp.cpp" line="410"/>
Expand Down
1,043 changes: 530 additions & 513 deletions i18n/qgis_ja.ts

Large diffs are not rendered by default.

6,138 changes: 4,607 additions & 1,531 deletions i18n/qgis_ko_KR.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions python/console/console_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ def restoreSettings(self):
self.fontComboBox.setCurrentFont(QFont(settings.value("pythonConsole/fontfamilytext",
"Monospace")))
self.fontComboBoxEditor.setCurrentFont(QFont(settings.value("pythonConsole/fontfamilytextEditor",
"Monospace")))
"Monospace")))
self.preloadAPI.setChecked(settings.value("pythonConsole/preloadAPI", True, type=bool))
self.lineEdit.setText(settings.value("pythonConsole/preparedAPIFile"))
self.lineEdit.setText(settings.value("pythonConsole/preparedAPIFile", "", type=str))
itemTable = settings.value("pythonConsole/userAPI", [])
if itemTable:
for i in range(len(itemTable)):
Expand Down
6 changes: 3 additions & 3 deletions python/core/composer/qgscomposertable.sip
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ class QgsComposerTable: QgsComposerItem

protected:
/**Retrieves feature attributes*/
// virtual bool getFeatureAttributes( QList<QgsAttributeMap>& attributes );
// virtual bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps );
virtual QMap<int, QString> getHeaderLabels() const;
/**Calculate the maximum width values of the vector attributes*/
// virtual bool calculateMaxColumnWidths( QMap<int, double>& maxWidthMap, const QList< QMap<int, QVariant> >& attributeList ) const;
// virtual bool calculateMaxColumnWidths( QMap<int, double>& maxWidthMap, const QList< QMap<int, QVariant> >& attributeMaps ) const;
/**Adapts the size of the item frame to match the content*/
// void adaptItemFrame( const QMap<int, double>& maxWidthMap, const QList< QMap<int, QVariant> >& attributeList );
// void adaptItemFrame( const QMap<int, double>& maxWidthMap, const QList< QMap<int, QVariant> >& attributeMaps );
void drawHorizontalGridLines( QPainter* p, int nAttributes );
// void drawVerticalGridLines( QPainter* p, const QMap<int, double>& maxWidthMap );

Expand Down
83 changes: 0 additions & 83 deletions python/core/qgsfeature.sip
Original file line number Diff line number Diff line change
Expand Up @@ -116,89 +116,6 @@ class QgsFeature

public:

SIP_PYOBJECT __getattr__(const QString& name);
%MethodCode
int fieldIdx = sipCpp->fieldNameIndex(*a0);
QString altname = QString(*a0).replace("_"," ");
int altfieldIdx = sipCpp->fieldNameIndex(altname);

if (fieldIdx >= 0)
{
QVariant v = sipCpp->attribute(fieldIdx);
if ( v.isNull() )
{
Py_INCREF( Py_None );
sipRes = Py_None;
}
else
sipRes = sipConvertFromType( &v, sipType_QVariant, Py_None );
}
else if( altfieldIdx >= 0 )
{
QVariant v = sipCpp->attribute(altfieldIdx);
if ( v.isNull() )
{
Py_INCREF( Py_None );
sipRes = Py_None;
}
else
sipRes = sipConvertFromType( &v, sipType_QVariant, Py_None );
}
else
{
PyObject* key = PyString_FromString(a0->toStdString().c_str());
sipRes = PyObject_GenericGetAttr(sipSelf, key );
}
%End

void __setattr__(const QString& key, QVariant value /GetWrapper/);
%MethodCode
int fieldIdx = sipCpp->fieldNameIndex(*a0);
QString altname = QString(*a0).replace("_"," ");
int altfieldIdx = sipCpp->fieldNameIndex(altname);

if (fieldIdx >= 0)
{
if ( a1Wrapper == Py_None )
{
sipCpp->setAttribute(fieldIdx, QVariant( QVariant::Int ) );
}
else
{
sipCpp->setAttribute(fieldIdx, *a1);
}
}
else if( altfieldIdx >= 0 )
{
if ( a1Wrapper == Py_None )
{
sipCpp->setAttribute(altfieldIdx, QVariant( QVariant::Int ) );
}
else
{
sipCpp->setAttribute(altfieldIdx, *a1);
}
}
else
{
PyObject* key = PyString_FromString(a0->toStdString().c_str());
PyObject* value = sipConvertFromType( a1, sipType_QVariant, sipSelf);
PyObject_GenericSetAttr(sipSelf, key, value);
}
%End

void __delattr__(const QString& key);
%MethodCode
int fieldIdx = sipCpp->fieldNameIndex(*a0);
if (fieldIdx == -1)
{
PyErr_SetString(PyExc_KeyError, a0->toAscii());
sipIsErr = 1;
}
else
sipCpp->deleteAttribute(fieldIdx);
%End

SIP_PYOBJECT __getitem__(int key);
%MethodCode
const QgsAttributes& attrs = sipCpp->attributes();
Expand Down
2 changes: 1 addition & 1 deletion python/pyplugin_installer/installer_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def fetchingInProgress(self):
# ----------------------------------------- #
def killConnection(self, key):
""" kill the fetching on demand """
if self.mRepositories[key]["xmlData"] and self.mRepositories[key]["xmlData"].isRunning():
if self.mRepositories[key]["state"]==1 and self.mRepositories[key]["xmlData"] and self.mRepositories[key]["xmlData"].isRunning():
self.mRepositories[key]["xmlData"].finished.disconnect()
self.mRepositories[key]["xmlData"].abort()

Expand Down
8 changes: 7 additions & 1 deletion src/app/composer/qgsattributeselectiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@
#include <QLineEdit>
#include <QPushButton>
#include <QScrollArea>
#include <QSettings>

QgsAttributeSelectionDialog::QgsAttributeSelectionDialog( const QgsVectorLayer* vLayer, const QSet<int>& enabledAttributes, const QMap<int, QString>& aliasMap,
const QList< QPair<int, bool> >& sortColumns, QWidget* parent, Qt::WindowFlags f ): QDialog( parent, f ), mVectorLayer( vLayer )
{
setupUi( this );

QSettings settings;
restoreGeometry( settings.value( "/Windows/AttributeSelectionDialog/geometry" ).toByteArray() );

if ( vLayer )
{
const QgsFields& fieldMap = vLayer->pendingFields();
Expand Down Expand Up @@ -79,7 +84,8 @@ QgsAttributeSelectionDialog::QgsAttributeSelectionDialog( const QgsVectorLayer*

QgsAttributeSelectionDialog::~QgsAttributeSelectionDialog()
{

QSettings settings;
settings.setValue( "/Windows/AttributeSelectionDialog/geometry", saveGeometry() );
}

QSet<int> QgsAttributeSelectionDialog::enabledAttributes() const
Expand Down
35 changes: 23 additions & 12 deletions src/app/nodetool/qgsmaptoolnodetool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ void QgsMapToolNodeTool::createMovingRubberBands()
{
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );

QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( mCanvas->currentLayer() );
Q_ASSERT( mSelectedFeature );

QgsVectorLayer *vlayer = mSelectedFeature->vlayer();
Q_ASSERT( vlayer );

QList<QgsVertexEntry*> &vertexMap = mSelectedFeature->vertexMap();
QgsGeometry* geometry = mSelectedFeature->geometry();
int beforeVertex, afterVertex;
Expand Down Expand Up @@ -84,7 +88,7 @@ void QgsMapToolNodeTool::createMovingRubberBands()
int index = 0;
if ( beforeVertex != -1 ) // adding first point which is not moving
{
rb->addPoint( toMapCoordinates( mCanvas->currentLayer(), vertexMap[beforeVertex]->point() ), false );
rb->addPoint( toMapCoordinates( vlayer, vertexMap[beforeVertex]->point() ), false );
vertexMap[beforeVertex]->setRubberBandValues( true, lastRubberBand, index );
index++;
}
Expand All @@ -96,15 +100,15 @@ void QgsMapToolNodeTool::createMovingRubberBands()
createTopologyRubberBands( vlayer, vertexMap, vertex );
}
// adding point which will be moved
rb->addPoint( toMapCoordinates( mCanvas->currentLayer(), vertexMap[vertex]->point() ), false );
rb->addPoint( toMapCoordinates( vlayer, vertexMap[vertex]->point() ), false );
// setting values about added vertex
vertexMap[vertex]->setRubberBandValues( true, lastRubberBand, index );
index++;
geometry->adjacentVertices( vertex, beforeVertex, vertex );
}
if ( vertex != -1 && !vertexMap[vertex]->isSelected() ) // add last point not moving if exists
{
rb->addPoint( toMapCoordinates( mCanvas->currentLayer(), vertexMap[vertex]->point() ), true );
rb->addPoint( toMapCoordinates( vlayer, vertexMap[vertex]->point() ), true );
vertexMap[vertex]->setRubberBandValues( true, lastRubberBand, index );
index++;
}
Expand Down Expand Up @@ -225,9 +229,8 @@ void QgsMapToolNodeTool::canvasMoveEvent( QMouseEvent * e )
if ( !mSelectedFeature || !mClicked )
return;

QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( mCanvas->currentLayer() );
if ( !vlayer )
return;
QgsVectorLayer* vlayer = mSelectedFeature->vlayer();
Q_ASSERT( vlayer );

mSelectAnother = false;

Expand Down Expand Up @@ -347,13 +350,15 @@ void QgsMapToolNodeTool::canvasPressEvent( QMouseEvent * e )
{
QgsDebugCall;

QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mCanvas->currentLayer() );

mClicked = true;
mPressCoordinates = e->pos();
QList<QgsSnappingResult> snapResults;
if ( !mSelectedFeature )
{
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mCanvas->currentLayer() );
if ( !vlayer )
return;

mSelectAnother = false;
mSnapper.snapToCurrentLayer( e->pos(), snapResults, QgsSnapper::SnapToVertexAndSegment, -1 );

Expand All @@ -369,6 +374,9 @@ void QgsMapToolNodeTool::canvasPressEvent( QMouseEvent * e )
}
else
{
QgsVectorLayer *vlayer = mSelectedFeature->vlayer();
Q_ASSERT( vlayer );

// some feature already selected
QgsPoint layerCoordPoint = toLayerCoordinates( vlayer, e->pos() );

Expand Down Expand Up @@ -488,7 +496,8 @@ void QgsMapToolNodeTool::canvasReleaseEvent( QMouseEvent * e )

removeRubberBands();

QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mCanvas->currentLayer() );
QgsVectorLayer *vlayer = mSelectedFeature->vlayer();
Q_ASSERT( vlayer );

mClicked = false;
mSelectionRectangle = false;
Expand Down Expand Up @@ -626,10 +635,12 @@ void QgsMapToolNodeTool::removeRubberBands()

void QgsMapToolNodeTool::canvasDoubleClickEvent( QMouseEvent * e )
{
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mCanvas->currentLayer() );
if ( !vlayer )
if ( !mSelectedFeature )
return;

QgsVectorLayer *vlayer = mSelectedFeature->vlayer();
Q_ASSERT( vlayer );

int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
QMultiMap<double, QgsSnappingResult> currentResultList;

Expand Down
7 changes: 5 additions & 2 deletions src/app/qgsaddattrdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@

QgsAddAttrDialog::QgsAddAttrDialog( QgsVectorLayer *vlayer, QWidget *parent, Qt::WFlags fl )
: QDialog( parent, fl )
, mIsShapeFile( vlayer && vlayer->providerType() == "ogr" && vlayer->storageType() == "ESRI Shapefile" )
{
setupUi( this );

//fill data types into the combo box
const QList< QgsVectorDataProvider::NativeType > &typelist = vlayer->dataProvider()->nativeTypes();
mLayerType = vlayer->storageType();

for ( int i = 0; i < typelist.size(); i++ )
{
Expand All @@ -50,6 +50,9 @@ QgsAddAttrDialog::QgsAddAttrDialog( QgsVectorLayer *vlayer, QWidget *parent, Qt:
}

on_mTypeBox_currentIndexChanged( 0 );

if ( mIsShapeFile )
mNameEdit->setMaxLength( 10 );
}

void QgsAddAttrDialog::on_mTypeBox_currentIndexChanged( int idx )
Expand Down Expand Up @@ -86,7 +89,7 @@ void QgsAddAttrDialog::setPrecisionMinMax()

void QgsAddAttrDialog::accept()
{
if ( mLayerType == "ESRI Shapefile" && mNameEdit->text().toLower() == "shape" )
if ( mIsShapeFile && mNameEdit->text().toLower() == "shape" )
{
QMessageBox::warning( this, tr( "Warning" ),
tr( "Invalid field name. This field name is reserved and cannot be used." ) );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsaddattrdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class QgsAddAttrDialog: public QDialog, private Ui::QgsAddAttrDialogBase
void accept();

private:
QString mLayerType;
bool mIsShapeFile;

void setPrecisionMinMax();
};
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsbrowserdockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void QgsBrowserDockWidget::showContextMenu( const QPoint & pt )
QStringList favDirs = settings.value( "/browser/favourites" ).toStringList();
bool inFavDirs = favDirs.contains( item->path() );

if ( item->parent() != NULL && !inFavDirs )
if ( item->parent() && !inFavDirs )
{
// only non-root directories can be added as favourites
menu->addAction( tr( "Add as a favourite" ), this, SLOT( addFavourite() ) );
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgsfieldcalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ QgsFieldCalculator::QgsFieldCalculator( QgsVectorLayer* vl )
mOutputFieldWidthSpinBox->setValue( 10 );
mOutputFieldPrecisionSpinBox->setValue( 3 );

if ( vl->providerType() == "ogr" && vl->storageType() == "ESRI Shapefile" )
{
mOutputFieldNameLineEdit->setMaxLength( 10 );
}

mUpdateExistingGroupBox->setEnabled( vl->dataProvider()->capabilities() & QgsVectorDataProvider::ChangeAttributeValues );
mNewFieldGroupBox->setEnabled( vl->dataProvider()->capabilities() & QgsVectorDataProvider::AddAttributes );

Expand Down
48 changes: 27 additions & 21 deletions src/core/composer/qgscomposerattributetable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
#include "qgsmaplayerregistry.h"
#include "qgsvectorlayer.h"

QgsComposerAttributeTableCompare::QgsComposerAttributeTableCompare(): mCurrentSortColumn( 0 ), mAscending( true )
QgsComposerAttributeTableCompare::QgsComposerAttributeTableCompare()
: mCurrentSortColumn( 0 ), mAscending( true )
{
}


bool QgsComposerAttributeTableCompare::operator()( const QgsAttributes& m1, const QgsAttributes& m2 )
bool QgsComposerAttributeTableCompare::operator()( const QgsAttributeMap& m1, const QgsAttributeMap& m2 )
{
QVariant v1 = m1[mCurrentSortColumn];
QVariant v2 = m2[mCurrentSortColumn];
Expand All @@ -44,8 +45,11 @@ bool QgsComposerAttributeTableCompare::operator()( const QgsAttributes& m1, cons


QgsComposerAttributeTable::QgsComposerAttributeTable( QgsComposition* composition )
: QgsComposerTable( composition ), mVectorLayer( 0 ), mComposerMap( 0 ),
mMaximumNumberOfFeatures( 5 ), mShowOnlyVisibleFeatures( true )
: QgsComposerTable( composition )
, mVectorLayer( 0 )
, mComposerMap( 0 )
, mMaximumNumberOfFeatures( 5 )
, mShowOnlyVisibleFeatures( true )
{
//set first vector layer from layer registry as default one
QMap<QString, QgsMapLayer*> layerMap = QgsMapLayerRegistry::instance()->mapLayers();
Expand All @@ -64,7 +68,6 @@ QgsComposerAttributeTable::QgsComposerAttributeTable( QgsComposition* compositio

QgsComposerAttributeTable::~QgsComposerAttributeTable()
{

}

void QgsComposerAttributeTable::paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget )
Expand Down Expand Up @@ -116,13 +119,14 @@ void QgsComposerAttributeTable::setComposerMap( const QgsComposerMap* map )
}
}

bool QgsComposerAttributeTable::getFeatureAttributes( QList<QgsAttributes>& attributes )
bool QgsComposerAttributeTable::getFeatureAttributes( QList<QgsAttributeMap> &attributeMaps )
{
if ( !mVectorLayer )
{
return false;
}
attributes.clear();

attributeMaps.clear();

QgsRectangle selectionRect;
if ( mComposerMap && mShowOnlyVisibleFeatures )
Expand All @@ -147,19 +151,29 @@ bool QgsComposerAttributeTable::getFeatureAttributes( QList<QgsAttributes>& attr

QgsFeatureRequest req;
if ( !selectionRect.isEmpty() )
{
req.setFilterRect( selectionRect );
}

req.setFlags( mShowOnlyVisibleFeatures ? QgsFeatureRequest::ExactIntersect : QgsFeatureRequest::NoGeometry );
if ( mDisplayAttributes.size() > 0 )

if ( !mDisplayAttributes.isEmpty() )
req.setSubsetOfAttributes( mDisplayAttributes.toList() );

QgsFeature f;
int counter = 0;
QgsFeatureIterator fit = mVectorLayer->getFeatures( req );

while ( fit.nextFeature( f ) && counter < mMaximumNumberOfFeatures )
{
attributes.push_back( f.attributes() );
attributeMaps.push_back( QgsAttributeMap() );

for ( int i = 0; i < f.attributes().size(); i++ )
{
if ( !mDisplayAttributes.isEmpty() && !mDisplayAttributes.contains( i ) )
continue;

attributeMaps.last().insert( i, f.attributes()[i] );
}

++counter;
}

Expand All @@ -169,7 +183,7 @@ bool QgsComposerAttributeTable::getFeatureAttributes( QList<QgsAttributes>& attr
{
c.setSortColumn( mSortInformation.at( i ).first );
c.setAscending( mSortInformation.at( i ).second );
qStableSort( attributes.begin(), attributes.end(), c );
qStableSort( attributeMaps.begin(), attributeMaps.end(), c );
}
return true;
}
Expand All @@ -194,15 +208,7 @@ QMap<int, QString> QgsComposerAttributeTable::getHeaderLabels() const

QString QgsComposerAttributeTable::attributeDisplayName( int attributeIndex, const QString& name ) const
{
QMap<int, QString>::const_iterator it = mFieldAliasMap.find( attributeIndex );
if ( it != mFieldAliasMap.constEnd() )
{
return it.value();
}
else
{
return name;
}
return mFieldAliasMap.value( attributeIndex, name );
}

void QgsComposerAttributeTable::removeLayer( QString layerId )
Expand Down
6 changes: 3 additions & 3 deletions src/core/composer/qgscomposerattributetable.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CORE_EXPORT QgsComposerAttributeTableCompare
{
public:
QgsComposerAttributeTableCompare();
bool operator()( const QgsAttributes& m1, const QgsAttributes& m2 );
bool operator()( const QgsAttributeMap& m1, const QgsAttributeMap& m2 );
void setSortColumn( int col ) { mCurrentSortColumn = col; }
void setAscending( bool asc ) { mAscending = asc; }
private:
Expand Down Expand Up @@ -66,7 +66,7 @@ class CORE_EXPORT QgsComposerAttributeTable: public QgsComposerTable
bool displayOnlyVisibleFeatures() const { return mShowOnlyVisibleFeatures; }

QSet<int> displayAttributes() const { return mDisplayAttributes; }
void setDisplayAttributes( const QSet<int>& attr ) { mDisplayAttributes = attr;}
void setDisplayAttributes( const QSet<int>& attr ) { mDisplayAttributes = attr; }

QMap<int, QString> fieldAliasMap() const { return mFieldAliasMap; }
void setFieldAliasMap( const QMap<int, QString>& map ) { mFieldAliasMap = map; }
Expand All @@ -84,7 +84,7 @@ class CORE_EXPORT QgsComposerAttributeTable: public QgsComposerTable
/**Retrieves feature attributes
* @note not available in python bindings
*/
bool getFeatureAttributes( QList<QgsAttributes>& attributes );
bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps );

//! @note not available in python bindings
QMap<int, QString> getHeaderLabels() const;
Expand Down
54 changes: 25 additions & 29 deletions src/core/composer/qgscomposertable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*
}

//getFeatureAttributes
QList<QgsAttributes> attributeList;
if ( !getFeatureAttributes( attributeList ) )
QList<QgsAttributeMap> attributeMaps;
if ( !getFeatureAttributes( attributeMaps ) )
{
return;
}

QMap<int, double> maxColumnWidthMap;
//check how much space each column needs
calculateMaxColumnWidths( maxColumnWidthMap, attributeList );
calculateMaxColumnWidths( maxColumnWidthMap, attributeMaps );
//adapt item frame to max width / height
adaptItemFrame( maxColumnWidthMap, attributeList );
adaptItemFrame( maxColumnWidthMap, attributeMaps );

drawBackground( painter );
painter->setPen( Qt::SolidLine );
Expand All @@ -77,14 +77,14 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*
currentY += mGridStrokeWidth;

//draw the attribute values
QList<QgsAttributes>::const_iterator attIt = attributeList.begin();
for ( ; attIt != attributeList.end(); ++attIt )
QList<QgsAttributeMap>::const_iterator attIt = attributeMaps.begin();
for ( ; attIt != attributeMaps.end(); ++attIt )
{
currentY += fontAscentMillimeters( mContentFont );
currentY += mLineTextDistance;

QgsAttributes currentAttributeMap = *attIt;
QString str = currentAttributeMap.at( columnIt.key() ).toString();
const QgsAttributeMap &currentAttributeMap = *attIt;
QString str = currentAttributeMap[ columnIt.key()].toString();
drawText( painter, currentX, currentY, str, mContentFont );
currentY += mLineTextDistance;
currentY += mGridStrokeWidth;
Expand All @@ -102,7 +102,7 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*
gridPen.setWidthF( mGridStrokeWidth );
gridPen.setColor( mGridColor );
painter->setPen( gridPen );
drawHorizontalGridLines( painter, attributeList.size() );
drawHorizontalGridLines( painter, attributeMaps.size() );
drawVerticalGridLines( painter, maxColumnWidthMap );
}

Expand All @@ -116,17 +116,14 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*

void QgsComposerTable::adjustFrameToSize()
{
QList<QgsAttributes> attributes;
QList<QgsAttributeMap> attributes;
if ( !getFeatureAttributes( attributes ) )
{
return;
}

QMap<int, double> maxWidthMap;
if ( !calculateMaxColumnWidths( maxWidthMap, attributes ) )
{
return;
}

adaptItemFrame( maxWidthMap, attributes );
}

Expand Down Expand Up @@ -172,7 +169,7 @@ bool QgsComposerTable::tableReadXML( const QDomElement& itemElem, const QDomDocu
return true;
}

bool QgsComposerTable::calculateMaxColumnWidths( QMap<int, double>& maxWidthMap, const QList<QgsAttributes>& attributeList ) const
bool QgsComposerTable::calculateMaxColumnWidths( QMap<int, double>& maxWidthMap, const QList<QgsAttributeMap>& attributeMaps ) const
{
maxWidthMap.clear();
QMap<int, QString> headerMap = getHeaderLabels();
Expand All @@ -183,34 +180,33 @@ bool QgsComposerTable::calculateMaxColumnWidths( QMap<int, double>& maxWidthMap,
}

//go through all the attributes and adapt the max width values
QList<QgsAttributes>::const_iterator attIt = attributeList.constBegin();
QList<QgsAttributeMap>::const_iterator attIt = attributeMaps.constBegin();

QgsAttributeMap currentAttributeMap;
double currentAttributeTextWidth;

for ( ; attIt != attributeList.constEnd(); ++attIt )
for ( ; attIt != attributeMaps.constEnd(); ++attIt )
{
for ( int i = 0; i < attIt->size(); ++i )
QgsAttributeMap::const_iterator attIt2 = attIt->constBegin();
for ( ; attIt2 != attIt->constEnd(); ++attIt2 )
{
currentAttributeTextWidth = textWidthMillimeters( mContentFont, attIt->at( i ).toString() );
if ( currentAttributeTextWidth > maxWidthMap[i] )
currentAttributeTextWidth = textWidthMillimeters( mContentFont, attIt2.value().toString() );
if ( currentAttributeTextWidth > maxWidthMap[ attIt2.key()] )
{
maxWidthMap[i] = currentAttributeTextWidth;
maxWidthMap[ attIt2.key()] = currentAttributeTextWidth;
}
}
}
return true;
}





void QgsComposerTable::adaptItemFrame( const QMap<int, double>& maxWidthMap, const QList<QgsAttributes>& attributeList )
void QgsComposerTable::adaptItemFrame( const QMap<int, double>& maxWidthMap, const QList<QgsAttributeMap>& attributeMaps )
{
//calculate height
double totalHeight = fontAscentMillimeters( mHeaderFont ) + attributeList.size() * fontAscentMillimeters( mContentFont )
+ ( attributeList.size() + 1 ) * mLineTextDistance * 2 + ( attributeList.size() + 2 ) * mGridStrokeWidth;
int n = attributeMaps.size();
double totalHeight = fontAscentMillimeters( mHeaderFont )
+ n * fontAscentMillimeters( mContentFont )
+ ( n + 1 ) * mLineTextDistance * 2
+ ( n + 2 ) * mGridStrokeWidth;

//adapt frame to total width
double totalWidth = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/core/composer/qgscomposertable.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ class CORE_EXPORT QgsComposerTable: public QgsComposerItem

/**Retrieves feature attributes*/
//! @note not available in python bindings
virtual bool getFeatureAttributes( QList<QgsAttributes>& attributes ) { Q_UNUSED( attributes ); return false; }
virtual bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps ) { Q_UNUSED( attributeMaps ); return false; }
virtual QMap<int, QString> getHeaderLabels() const { return QMap<int, QString>(); } //= 0;
/**Calculate the maximum width values of the vector attributes*/
virtual bool calculateMaxColumnWidths( QMap<int, double>& maxWidthMap, const QList<QgsAttributes>& attributeList ) const;
virtual bool calculateMaxColumnWidths( QMap<int, double>& maxWidthMap, const QList<QgsAttributeMap>& attributeMaps ) const;
/**Adapts the size of the item frame to match the content*/
//! @note not available in python bindings
void adaptItemFrame( const QMap<int, double>& maxWidthMap, const QList<QgsAttributes>& attributeList );
void adaptItemFrame( const QMap<int, double>& maxWidthMap, const QList<QgsAttributeMap>& attributeMaps );
void drawHorizontalGridLines( QPainter* p, int nAttributes );
//! @note not available in python bindings
void drawVerticalGridLines( QPainter* p, const QMap<int, double>& maxWidthMap );
Expand Down
9 changes: 6 additions & 3 deletions src/core/qgsbrowsermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ QgsBrowserModel::~QgsBrowserModel()

void QgsBrowserModel::updateProjectHome()
{
int idx = mRootItems.indexOf( mProjectHome );
QString home = QgsProject::instance()->homePath();

delete mProjectHome;
if ( mProjectHome && mProjectHome->path() == home )
return;

emit layoutAboutToBeChanged();

int idx = mRootItems.indexOf( mProjectHome );
delete mProjectHome;
mProjectHome = home.isNull() ? 0 : new QgsDirectoryItem( NULL, tr( "Project home" ), home );
if ( mProjectHome )
{
Expand All @@ -64,6 +66,7 @@ void QgsBrowserModel::updateProjectHome()
{
mRootItems.remove( idx );
}

emit layoutChanged();
}

Expand Down
18 changes: 17 additions & 1 deletion src/core/qgscontexthelp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <QTextStream>

#include "qgscontexthelp.h"
#include "qgsmessagelog.h"
#include "qgsapplication.h"
#include "qgslogger.h"

Expand Down Expand Up @@ -56,17 +57,32 @@ QProcess *QgsContextHelp::start()
QgsDebugMsg( QString( "Help path is %1" ).arg( helpPath ) );

QProcess *process = new QProcess;
process->start( helpPath );

// Delete this object if the process terminates
connect( process, SIGNAL( finished( int, QProcess::ExitStatus ) ), SLOT( processExited() ) );

// Delete the process if the application quits
connect( qApp, SIGNAL( aboutToQuit() ), process, SLOT( terminate() ) );

connect( process, SIGNAL( error( QProcess::ProcessError ) ), this, SLOT( error( QProcess::ProcessError ) ) );

#ifdef Q_OS_WIN
if ( QgsApplication::isRunningFromBuildDir() )
{
process->setEnvironment( QStringList() << QString( "PATH=%1;%2" ).arg( getenv( "PATH" ) ).arg( QApplication::applicationDirPath() ) );
}
#endif

process->start( helpPath );

return process;
}

void QgsContextHelp::error( QProcess::ProcessError error )
{
QgsMessageLog::logMessage( tr( "Error starting help viewer [%1]" ).arg( error ), tr( "Context help" ) );
}

void QgsContextHelp::showContext( QString context )
{
init();
Expand Down
12 changes: 2 additions & 10 deletions src/core/qgscontexthelp.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@

#include <QObject>
#include <QHash>
#include <QProcess>

class QProcess;

#ifdef Q_OS_MACX
#define QGSCONTEXTHELP_REUSE 1
#endif
/** \ingroup core
* Provides a context based help browser for a dialog.
*
Expand All @@ -35,11 +31,6 @@ class QProcess;
* viewer using QProcess and ensures that only one viewer is open.
* The viewer will be terminated if open when the main application quits.
*
* If the compile-time flag QGSCONTEXTHELP_REUSE is defined, the help viewer
* will be reused if it is still open. If this flag is not set, the viewer
* process will be terminated if open and restarted; this makes it the top
* window for window managers such as Linux/GNOME which will make a window
* active but not bring it to the top if raised programatically.
*/
class CORE_EXPORT QgsContextHelp : public QObject
{
Expand All @@ -49,6 +40,7 @@ class CORE_EXPORT QgsContextHelp : public QObject

private slots:
void processExited();
void error( QProcess::ProcessError error );

private:
//! Constructor
Expand Down
9 changes: 8 additions & 1 deletion src/core/qgsdataitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,14 @@ void QgsFavouritesItem::removeDirectory( QgsDirectoryItem *item )
favDirs.removeAll( item->path() );
settings.setValue( "/browser/favourites", favDirs );

deleteChildItem( item );
int idx = findItem( mChildren, item );
if ( idx < 0 )
{
QgsDebugMsg( QString( "favourites item %1 not found" ).arg( item->path() ) );
return;
}

deleteChildItem( mChildren[idx] );
}

//-----------------------------------------------------------------------
Expand Down
8 changes: 5 additions & 3 deletions src/core/qgsvectorlayereditbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ bool QgsVectorLayerEditBuffer::addFeature( QgsFeature& f )
{
return false;
}

int layerFieldCount = L->dataProvider()->fields().count() + mAddedAttributes.count() - mDeletedAttributeIds.count();
if ( layerFieldCount != f.attributes().count() )
if ( L->mUpdatedFields.count() != f.attributes().count() )
return false;

// TODO: check correct geometry type
Expand Down Expand Up @@ -412,6 +410,10 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors )
}
}
}
else
{
success = false;
}

//
// update geometries
Expand Down
307 changes: 113 additions & 194 deletions src/plugins/globe/globe_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,227 +498,146 @@ void GlobePlugin::setupControls()
{

std::string imgDir = QDir::cleanPath( QgsApplication::pkgDataPath() + "/globe/gui" ).toStdString();

//MOVE CONTROLS
//Horizontal container
HBox* moveHControls = new HBox();
moveHControls->setFrame( new RoundedFrame() );
moveHControls->getFrame()->setBackColor( 1, 1, 1, 0.5 );
moveHControls->setMargin( 0 );
#if HAVE_OSGEARTH_CHILD_SPACING
moveHControls->setChildSpacing( 47 );
#else
moveHControls->setSpacing( 47 );
#endif
moveHControls->setVertAlign( Control::ALIGN_CENTER );
moveHControls->setHorizAlign( Control::ALIGN_CENTER );
moveHControls->setPosition( 5, 30 );
moveHControls->setPadding( 6 );

osgEarth::Util::EarthManipulator* manip = dynamic_cast<osgEarth::Util::EarthManipulator*>( mOsgViewer->getCameraManipulator() );
//Move Left
osg::Image* moveLeftImg = osgDB::readImageFile( imgDir + "/move-left.png" );
ImageControl* moveLeft = new NavigationControl( moveLeftImg );
moveLeft->addEventHandler( new PanControlHandler( manip, -MOVE_OFFSET, 0 ) );

//Move Right
osg::Image* moveRightImg = osgDB::readImageFile( imgDir + "/move-right.png" );
ImageControl* moveRight = new NavigationControl( moveRightImg );
moveRight->addEventHandler( new PanControlHandler( manip, MOVE_OFFSET, 0 ) );

//Vertical container
VBox* moveVControls = new VBox();
moveVControls->setFrame( new RoundedFrame() );
moveVControls->getFrame()->setBackColor( 1, 1, 1, 0.5 );
moveVControls->setMargin( 0 );
#if HAVE_OSGEARTH_CHILD_SPACING
moveVControls->setChildSpacing( 36 );
#else
moveVControls->setSpacing( 36 );
#endif
moveVControls->setVertAlign( Control::ALIGN_CENTER );
moveVControls->setHorizAlign( Control::ALIGN_CENTER );
moveVControls->setPosition( 35, 5 );
moveVControls->setPadding( 6 );

//Move Up
osg::Image* moveUpImg = osgDB::readImageFile( imgDir + "/move-up.png" );
ImageControl* moveUp = new NavigationControl( moveUpImg );
moveUp->addEventHandler( new PanControlHandler( manip, 0, MOVE_OFFSET ) );

//Move Down
osg::Image* moveDownImg = osgDB::readImageFile( imgDir + "/move-down.png" );
ImageControl* moveDown = new NavigationControl( moveDownImg );
moveDown->addEventHandler( new PanControlHandler( manip, 0, -MOVE_OFFSET ) );

//add controls to moveControls group
moveHControls->addControl( moveLeft );
moveHControls->addControl( moveRight );
moveVControls->addControl( moveUp );
moveVControls->addControl( moveDown );

//END MOVE CONTROLS

//ROTATE CONTROLS
//Horizontal container
HBox* rotateControls = new HBox();
rotateControls->setFrame( new RoundedFrame() );
rotateControls->getFrame()->setBackColor( 1, 1, 1, 0.5 );
rotateControls->setMargin( 0 );
#if HAVE_OSGEARTH_CHILD_SPACING
rotateControls->setChildSpacing( 10 );
#else
rotateControls->setSpacing( 10 );
#endif
rotateControls->setVertAlign( Control::ALIGN_CENTER );
rotateControls->setHorizAlign( Control::ALIGN_CENTER );
rotateControls->setPosition( 5, 113 );
rotateControls->setPadding( 6 );

//Rotate CCW
osg::Image* rotateCCWImg = osgDB::readImageFile( imgDir + "/rotate-ccw.png" );
ImageControl* rotateCCW = new NavigationControl( rotateCCWImg );
osg::Image* yawPitchWheelImg = osgDB::readImageFile( imgDir + "/YawPitchWheel.png" );
ImageControl* yawPitchWheel = new ImageControl( yawPitchWheelImg );
int imgLeft = 16;
int imgTop = 20;
yawPitchWheel->setPosition( imgLeft, imgTop );
mControlCanvas->addControl( yawPitchWheel );

//ROTATE CONTROLS
Control* rotateCCW = new NavigationControl();
rotateCCW->setHeight( 22 );
rotateCCW->setWidth( 20 );
rotateCCW->setPosition( imgLeft+0, imgTop+18 );
rotateCCW->addEventHandler( new RotateControlHandler( manip, MOVE_OFFSET, 0 ) );
mControlCanvas->addControl( rotateCCW );

//Rotate CW
osg::Image* rotateCWImg = osgDB::readImageFile( imgDir + "/rotate-cw.png" );
ImageControl* rotateCW = new NavigationControl( rotateCWImg );
Control* rotateCW = new NavigationControl();
rotateCW->setHeight( 22 );
rotateCW->setWidth( 20 );
rotateCW->setPosition( imgLeft+36, imgTop+18 );
rotateCW->addEventHandler( new RotateControlHandler( manip, -MOVE_OFFSET , 0 ) );
mControlCanvas->addControl( rotateCW );

//Rotate Reset
osg::Image* rotateResetImg = osgDB::readImageFile( imgDir + "/rotate-reset.png" );
ImageControl* rotateReset = new NavigationControl( rotateResetImg );
Control* rotateReset = new NavigationControl();
rotateReset->setHeight( 22 );
rotateReset->setWidth( 16 );
rotateReset->setPosition( imgLeft+20, imgTop+18 );
rotateReset->addEventHandler( new RotateControlHandler( manip, 0, 0 ) );
mControlCanvas->addControl( rotateReset );

//add controls to rotateControls group
rotateControls->addControl( rotateCCW );
rotateControls->addControl( rotateReset );
rotateControls->addControl( rotateCW );

//END ROTATE CONTROLS

//TILT CONTROLS
//Vertical container
VBox* tiltControls = new VBox();
tiltControls->setFrame( new RoundedFrame() );
tiltControls->getFrame()->setBackColor( 1, 1, 1, 0.5 );
tiltControls->setMargin( 0 );
#if HAVE_OSGEARTH_CHILD_SPACING
tiltControls->setChildSpacing( 30 );
#else
tiltControls->setSpacing( 30 );
#endif
tiltControls->setVertAlign( Control::ALIGN_CENTER );
tiltControls->setHorizAlign( Control::ALIGN_CENTER );
tiltControls->setPosition( 35, 90 );
tiltControls->setPadding( 6 );

//tilt Up
osg::Image* tiltUpImg = osgDB::readImageFile( imgDir + "/tilt-up.png" );
ImageControl* tiltUp = new NavigationControl( tiltUpImg );
//TILT CONTROLS
Control* tiltUp = new NavigationControl();
tiltUp->setHeight( 19 );
tiltUp->setWidth( 24 );
tiltUp->setPosition( imgLeft+20, imgTop+0 );
tiltUp->addEventHandler( new RotateControlHandler( manip, 0, MOVE_OFFSET ) );
mControlCanvas->addControl( tiltUp );

//tilt Down
osg::Image* tiltDownImg = osgDB::readImageFile( imgDir + "/tilt-down.png" );
ImageControl* tiltDown = new NavigationControl( tiltDownImg );
Control* tiltDown = new NavigationControl();
tiltDown->setHeight( 19 );
tiltDown->setWidth( 24 );
tiltDown->setPosition( imgLeft+16, imgTop+36 );
tiltDown->addEventHandler( new RotateControlHandler( manip, 0, -MOVE_OFFSET ) );
mControlCanvas->addControl( tiltDown );

//add controls to tiltControls group
tiltControls->addControl( tiltUp );
tiltControls->addControl( tiltDown );
// -------

//END TILT CONTROLS
osg::Image* moveWheelImg = osgDB::readImageFile( imgDir + "/MoveWheel.png" );
ImageControl* moveWheel = new ImageControl( moveWheelImg );
imgTop = 80;
moveWheel->setPosition( imgLeft, imgTop );
mControlCanvas->addControl( moveWheel );

//ZOOM CONTROLS
//Vertical container
VBox* zoomControls = new VBox();
zoomControls->setFrame( new RoundedFrame() );
zoomControls->getFrame()->setBackColor( 1, 1, 1, 0.5 );
zoomControls->setMargin( 0 );
#if HAVE_OSGEARTH_CHILD_SPACING
zoomControls->setChildSpacing( 5 );
#else
zoomControls->setSpacing( 5 );
#endif
zoomControls->setVertAlign( Control::ALIGN_CENTER );
zoomControls->setHorizAlign( Control::ALIGN_CENTER );
zoomControls->setPosition( 35, 170 );
zoomControls->setPadding( 6 );

//Zoom In
osg::Image* zoomInImg = osgDB::readImageFile( imgDir + "/zoom-in.png" );
ImageControl* zoomIn = new NavigationControl( zoomInImg );
zoomIn->addEventHandler( new ZoomControlHandler( manip, 0, -MOVE_OFFSET ) );
//MOVE CONTROLS
Control* moveLeft = new NavigationControl();
moveLeft->setHeight( 22 );
moveLeft->setWidth( 20 );
moveLeft->setPosition( imgLeft+0, imgTop+18 );
moveLeft->addEventHandler( new PanControlHandler( manip, -MOVE_OFFSET, 0 ) );
mControlCanvas->addControl( moveLeft );

//Zoom Out
osg::Image* zoomOutImg = osgDB::readImageFile( imgDir + "/zoom-out.png" );
ImageControl* zoomOut = new NavigationControl( zoomOutImg );
zoomOut->addEventHandler( new ZoomControlHandler( manip, 0, MOVE_OFFSET ) );
Control* moveRight = new NavigationControl();
moveRight->setHeight( 22 );
moveRight->setWidth( 20 );
moveRight->setPosition( imgLeft+36, imgTop+18 );
moveRight->addEventHandler( new PanControlHandler( manip, MOVE_OFFSET, 0 ) );
mControlCanvas->addControl( moveRight );

//add controls to zoomControls group
zoomControls->addControl( zoomIn );
zoomControls->addControl( zoomOut );
Control* moveUp = new NavigationControl();
moveUp->setHeight( 19 );
moveUp->setWidth( 24 );
moveUp->setPosition( imgLeft+20, imgTop+0 );
moveUp->addEventHandler( new PanControlHandler( manip, 0, MOVE_OFFSET ) );
mControlCanvas->addControl( moveUp );

//END ZOOM CONTROLS
Control* moveDown = new NavigationControl();
moveDown->setHeight( 19 );
moveDown->setWidth( 24 );
moveDown->setPosition( imgLeft+16, imgTop+36 );
moveDown->addEventHandler(new PanControlHandler( manip, 0, -MOVE_OFFSET ) );
mControlCanvas->addControl( moveDown );

//EXTRA CONTROLS
//#define ENABLE_SYNC_BUTTON 1
#if ENABLE_SYNC_BUTTON
//Horizontal container
HBox* extraControls = new HBox();
#else
VBox* extraControls = new VBox();
#endif
extraControls->setFrame( new RoundedFrame() );
extraControls->getFrame()->setBackColor( 1, 1, 1, 0.5 );
extraControls->setMargin( 0 );
#if HAVE_OSGEARTH_CHILD_SPACING
extraControls->setChildSpacing( 10 );
#else
extraControls->setSpacing( 10 );
#endif
extraControls->setVertAlign( Control::ALIGN_CENTER );
extraControls->setHorizAlign( Control::ALIGN_CENTER );
#if ENABLE_SYNC_BUTTON
extraControls->setPosition( 5, 231 );
#else
extraControls->setPosition( 35, 231 );
#endif
extraControls->setPadding( 6 );
//Zoom Reset
Control* zoomHome = new NavigationControl();
zoomHome->setHeight( 22 );
zoomHome->setWidth( 16 );
zoomHome->setPosition( imgLeft+20, imgTop+18 );
zoomHome->addEventHandler( new HomeControlHandler( manip ) );
mControlCanvas->addControl( zoomHome );

// -------

osg::Image* backgroundImg = osgDB::readImageFile( imgDir + "/button-background.png" );
ImageControl* backgroundGrp1 = new ImageControl( backgroundImg );
imgTop = imgTop+62;
backgroundGrp1->setPosition( imgLeft+12, imgTop );
mControlCanvas->addControl( backgroundGrp1 );

osg::Image* plusImg = osgDB::readImageFile( imgDir + "/zoom-in.png" );
ImageControl* zoomIn = new NavigationControl( plusImg );
zoomIn->setPosition( imgLeft+12+3, imgTop+3 );
zoomIn->addEventHandler( new ZoomControlHandler( manip, 0, -MOVE_OFFSET ) );
mControlCanvas->addControl( zoomIn );

//Sync Extent
#if ENABLE_SYNC_BUTTON
osg::Image* extraSyncImg = osgDB::readImageFile( imgDir + "/sync-extent.png" );
ImageControl* extraSync = new NavigationControl( extraSyncImg );
extraSync->addEventHandler( new SyncExtentControlHandler( this ) );
#endif
osg::Image* minusImg = osgDB::readImageFile( imgDir + "/zoom-out.png" );
ImageControl* zoomOut = new NavigationControl( minusImg );
zoomOut->setPosition( imgLeft+12+3, imgTop+3+23+2 );
zoomOut->addEventHandler( new ZoomControlHandler( manip, 0, MOVE_OFFSET ) );
mControlCanvas->addControl( zoomOut );

// -------

ImageControl* backgroundGrp2 = new ImageControl( backgroundImg );
imgTop = imgTop+60;
backgroundGrp2->setPosition( imgLeft+12, imgTop );
mControlCanvas->addControl( backgroundGrp2 );

//Zoom Reset
osg::Image* extraHomeImg = osgDB::readImageFile( imgDir + "/zoom-home.png" );
ImageControl* extraHome = new NavigationControl( extraHomeImg );
extraHome->addEventHandler( new HomeControlHandler( manip ) );
osg::Image* homeImg = osgDB::readImageFile( imgDir + "/zoom-home.png" );
ImageControl* home = new NavigationControl( homeImg );
home->setPosition( imgLeft+12+3, imgTop+2 );
home->addEventHandler( new HomeControlHandler( manip ) );
mControlCanvas->addControl( home );

//refresh layers
osg::Image* extraRefreshImg = osgDB::readImageFile( imgDir + "/refresh-view.png" );
ImageControl* extraRefresh = new NavigationControl( extraRefreshImg );
extraRefresh->addEventHandler( new RefreshControlHandler( this ) );
osg::Image* refreshImg = osgDB::readImageFile( imgDir + "/refresh-view.png" );
ImageControl* refresh = new NavigationControl( refreshImg );
refresh->setPosition( imgLeft+12+3, imgTop+2+23+2 );
refresh->addEventHandler( new RefreshControlHandler( this ) );
mControlCanvas->addControl( refresh );

//add controls to extraControls group
//Sync Extent
#if ENABLE_SYNC_BUTTON
extraControls->addControl( extraSync );
osg::Image* syncImg = osgDB::readImageFile( imgDir + "/sync-extent.png" );
ImageControl* sync = new NavigationControl( syncImg );
sync->addEventHandler( new SyncExtentControlHandler( this ) );
mControlCanvas->addControl( sync );
#endif
extraControls->addControl( extraHome );
extraControls->addControl( extraRefresh );

//END EXTRA CONTROLS

//add controls groups to canavas
mControlCanvas->addControl( moveHControls );
mControlCanvas->addControl( moveVControls );
mControlCanvas->addControl( tiltControls );
mControlCanvas->addControl( rotateControls );
mControlCanvas->addControl( zoomControls );
mControlCanvas->addControl( extraControls );
}

void GlobePlugin::setupProxy()
Expand Down
Binary file added src/plugins/globe/images/gui/MoveWheel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/plugins/globe/images/gui/YawPitchWheel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/plugins/globe/images/gui/button-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/plugins/globe/images/gui/move-down.png
Binary file not shown.
Binary file removed src/plugins/globe/images/gui/move-left.png
Binary file not shown.
Binary file removed src/plugins/globe/images/gui/move-right.png
Binary file not shown.
Binary file removed src/plugins/globe/images/gui/move-up.png
Binary file not shown.
Binary file modified src/plugins/globe/images/gui/refresh-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/plugins/globe/images/gui/rotate-ccw.png
Binary file not shown.
Binary file removed src/plugins/globe/images/gui/rotate-cw.png
Binary file not shown.
Binary file removed src/plugins/globe/images/gui/rotate-reset.png
Binary file not shown.
Binary file removed src/plugins/globe/images/gui/tilt-down.png
Binary file not shown.
Binary file removed src/plugins/globe/images/gui/tilt-up.png
Binary file not shown.
Binary file modified src/plugins/globe/images/gui/zoom-home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/plugins/globe/images/gui/zoom-in.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/plugins/globe/images/gui/zoom-out.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ void QgsDelimitedTextProvider::fetchAttribute( QgsFeature& feature, int fieldIdx
{
case QVariant::Int:
{
int ivalue;
int ivalue = 0;
bool ok = false;
if ( ! value.isEmpty() ) ivalue = value.toInt( &ok );
if ( ok )
Expand All @@ -1217,7 +1217,7 @@ void QgsDelimitedTextProvider::fetchAttribute( QgsFeature& feature, int fieldIdx
}
case QVariant::Double:
{
double dvalue;
double dvalue = 0.0;
bool ok = false;
if ( ! value.isEmpty() )
{
Expand Down
52 changes: 46 additions & 6 deletions src/providers/ogr/qgsogrprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ bool QgsOgrProvider::addFeatures( QgsFeatureList & flist )
{
returnvalue = false;
}

recalculateFeatureCount();

if ( returnvalue )
Expand Down Expand Up @@ -1139,7 +1140,10 @@ bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap & attr
}
}

OGR_L_SyncToDisk( ogrLayer );
if ( OGR_L_SyncToDisk( ogrLayer ) != OGRERR_NONE )
{
pushError( tr( "OGR error syncing to disk: %1" ).arg( CPLGetLastErrorMsg() ) );
}
return true;
}

Expand Down Expand Up @@ -1254,11 +1258,39 @@ bool QgsOgrProvider::deleteFeatures( const QgsFeatureIds & id )
returnvalue = false;
}

QString layerName = FROM8( OGR_FD_GetName( OGR_L_GetLayerDefn( ogrOrigLayer ) ) );
// run REPACK on shape files
if ( ogrDriverName == "ESRI Shapefile" )
{
QString layerName = FROM8( OGR_FD_GetName( OGR_L_GetLayerDefn( ogrOrigLayer ) ) );

QString sql = QString( "REPACK %1" ).arg( layerName ); // don't quote the layer name as it works with spaces in the name and won't work if the name is quoted
QgsDebugMsg( QString( "SQL: %1" ).arg( sql ) );
OGR_DS_ExecuteSQL( ogrDataSource, mEncoding->fromUnicode( sql ).constData(), NULL, NULL );
QString sql = QString( "REPACK %1" ).arg( layerName ); // don't quote the layer name as it works with spaces in the name and won't work if the name is quoted
QgsDebugMsg( QString( "SQL: %1" ).arg( sql ) );
OGR_DS_ExecuteSQL( ogrDataSource, mEncoding->fromUnicode( sql ).constData(), NULL, NULL );

if ( mFilePath.endsWith( ".shp", Qt::CaseInsensitive ) || mFilePath.endsWith( ".dbf", Qt::CaseInsensitive ) )
{
QString packedDbf( mFilePath.left( mFilePath.size() - 4 ) + "_packed.dbf" );
if ( QFile::exists( packedDbf ) )
{
QgsMessageLog::logMessage( tr( "Possible corruption after REPACK detected. %1 still exists. This may point to a permission or locking problem of the original DBF." ).arg( packedDbf ), tr( "OGR" ), QgsMessageLog::CRITICAL );

OGR_DS_Destroy( ogrDataSource );

ogrDataSource = OGROpen( TO8F( mFilePath ), true, NULL );

if ( mLayerName.isNull() )
{
ogrOrigLayer = OGR_DS_GetLayer( ogrDataSource, mLayerIndex );
}
else
{
ogrOrigLayer = OGR_DS_GetLayerByName( ogrDataSource, TO8( mLayerName ) );
}

ogrLayer = ogrOrigLayer;
}
}
}

recalculateFeatureCount();

Expand Down Expand Up @@ -2122,6 +2154,10 @@ void QgsOgrProvider::uniqueValues( int index, QList<QVariant> &uniqueValues, int
return; //not a provider field
}

#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM < 1910
// avoid GDAL #4509
return QgsVectorDataProvider::uniqueValues( index, uniqueValues, limit );
#else
QString theLayerName = FROM8( OGR_FD_GetName( OGR_L_GetLayerDefn( ogrLayer ) ) );

QString sql = QString( "SELECT DISTINCT %1 FROM %2" )
Expand Down Expand Up @@ -2151,6 +2187,7 @@ void QgsOgrProvider::uniqueValues( int index, QList<QVariant> &uniqueValues, int
}

OGR_DS_ReleaseResultSet( ogrDataSource, l );
#endif
}

QVariant QgsOgrProvider::minimumValue( int index )
Expand Down Expand Up @@ -2249,7 +2286,10 @@ QString QgsOgrProvider::quotedIdentifier( QString field )

bool QgsOgrProvider::syncToDisc()
{
OGR_L_SyncToDisk( ogrLayer );
if ( OGR_L_SyncToDisk( ogrLayer ) != OGRERR_NONE )
{
pushError( tr( "OGR error syncing to disk: %1" ).arg( CPLGetLastErrorMsg() ) );
}

//for shapefiles: is there already a spatial index?
if ( !mFilePath.isEmpty() )
Expand Down
4 changes: 2 additions & 2 deletions src/providers/postgres/qgspostgresconn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,11 +794,11 @@ PGresult *QgsPostgresConn::PQexec( QString query, bool logError )
}
else if ( logError )
{
QgsMessageLog::logMessage( tr( "Query failed: %1\nError: no result buffer" ).arg( query ) );
QgsMessageLog::logMessage( tr( "Query failed: %1\nError: no result buffer" ).arg( query ), tr( "PostGIS" ) );
}
else
{
QgsDebugMsg( tr( "Not logged query failed: %1\nError: no result buffer" ).arg( query ) );
QgsDebugMsg( QString( "Not logged query failed: %1\nError: no result buffer" ).arg( query ) );
}

return res;
Expand Down
4 changes: 2 additions & 2 deletions src/providers/postgres/qgspostgresprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ QgsPostgresProvider::QgsPostgresProvider( QString const & uri )
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (decimal)" ), "decimal", QVariant::Double, 1, 20, 0, 20 )

// floating point
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), "real", QVariant::Double )
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (double)" ), "double precision", QVariant::Double )
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), "real", QVariant::Double, -1, -1, -1, -1 )
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (double)" ), "double precision", QVariant::Double, -1, -1, -1, -1 )

// string types
<< QgsVectorDataProvider::NativeType( tr( "Text, fixed length (char)" ), "char", QVariant::String, 1, 255 )
Expand Down