Skip to content
Permalink
Browse files

[FEATURE] Load and Save SLD & QML styles to DB

Replaced last occurence of "on database" with "in database"
Solved an issue loading the default style adding a layer
Work done for ARPA Piemonte - Dipartimento Tematico Geologia e Dissesto
  • Loading branch information
Emilio Loi authored and jef-n committed May 9, 2013
1 parent 6c51965 commit bfe2f9f8bf3a340516a61eb4804ce278d05fac21
Showing with 27 additions and 9 deletions.
  1. +4 −0 src/core/qgsvectorlayer.cpp
  2. +21 −7 src/core/qgsvectorlayer.h
  3. +2 −2 src/ui/qgssavetodbdialog.ui
@@ -3816,6 +3816,10 @@ void QgsVectorLayer::saveStyleToDatabase( QString name, QString description,



QString QgsVectorLayer::loadNamedStyle( const QString theURI, bool &theResultFlag )
{
return loadNamedStyle( theURI, theResultFlag, false );
}

QString QgsVectorLayer::loadNamedStyle( const QString theURI, bool &theResultFlag , bool loadFromLocalDB )
{
@@ -22,6 +22,7 @@
#include <QSet>
#include <QList>
#include <QStringList>
#include <QVector>

#include "qgis.h"
#include "qgsmaplayer.h"
@@ -712,16 +713,29 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
* @param msgError
* @return the number of styles related to current layer
*/
virtual int listStylesInDatabase( QStringList &ids, QStringList &names,
QStringList &descriptions, QString &msgError );
virtual int listStylesInDatabase( QVector<QString> &ids, QVector<QString> &names,
QVector<QString> &descriptions, QString &msgError );

/**
* Will return the named style corresponding to style id provided
*/
virtual QString getStyleFromDatabase( QString styleId, QString &msgError );

virtual QString loadNamedStyle( const QString theURI, bool &theResultFlag, bool loadFromLocalDb = false );
virtual bool applyNamedStyle( QString namedStyle , QString errorMsg );
/**
* Load a named style from file/local db/datasource db
* @param theURI the URI of the style or the URI of the layer
* @param theResultFlag will be set to true if a named style is correctly loaded
* @param loadFromLocalDb if true forces to load from local db instead of datasource one
*/
virtual QString loadNamedStyle( const QString theURI, bool &theResultFlag, bool loadFromLocalDb );

/**
* Calls loadNamedStyle( theURI, theResultFlag, false );
* Retained for backward compatibility
*/
virtual QString loadNamedStyle( const QString theURI, bool &theResultFlag );

virtual bool applyNamedStyle(QString namedStyle , QString errorMsg);

/** convert a saved attribute editor element into a AttributeEditor structure as it's used internally.
* @param elem the DOM element
@@ -1267,15 +1281,15 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
signals:

/**
* This signal is emitted when selection was changed
* This signal is emited when selection was changed
*
* @param selected Newly selected feature ids
* @param deselected Ids of all features which have previously been selected but are not any more
* @param clearAndSelect In case this is set to true, the old selection was dismissed and the new selection corresponds to selected
*/
void selectionChanged( const QgsFeatureIds selected, const QgsFeatureIds deselected, const bool clearAndSelect );

/** This signal is emitted when selection was changed */
/** This signal is emited when selection was changed */
void selectionChanged();

/** This signal is emitted when modifications has been done on layer */
@@ -1284,7 +1298,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
/** Is emitted, when editing on this layer has started*/
void editingStarted();

/** Is emitted, when edited changes successfully have been written to the data provider */
/** Is emitted, when edited changes succesfully have been written to the data provider */
void editingStopped();

/** Is emitted, before changes are commited to the data provider */
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>355</width>
<height>235</height>
<height>246</height>
</rect>
</property>
<property name="windowTitle">
@@ -94,7 +94,7 @@
<item row="2" column="0" rowspan="2" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Optionally pick an input form for attribute editing (QT Creator UI format), it will be stored on the db</string>
<string>Optionally pick an input form for attribute editing (QT Creator UI format), it will be stored in the db</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>

0 comments on commit bfe2f9f

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