Skip to content

Commit

Permalink
[FEATURE] Load and Save SLD & QML styles to DB
Browse files Browse the repository at this point in the history
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 bfe2f9f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down
28 changes: 21 additions & 7 deletions src/core/qgsvectorlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <QSet>
#include <QList>
#include <QStringList>
#include <QVector>

#include "qgis.h"
#include "qgsmaplayer.h"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 */
Expand All @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions src/ui/qgssavetodbdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>355</width>
<height>235</height>
<height>246</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit bfe2f9f

Please sign in to comment.