Skip to content
Permalink
Browse files

[FEATURE] [needs-docs] Metadata editor

Adds a new metadata tab to layer properties, representing the new metadata model from QEP #91
  • Loading branch information
Gustry authored and nyalldawson committed Sep 23, 2017
1 parent e267893 commit ba81068f495423380dde0a7a8f81135cf142865d
@@ -229,6 +229,13 @@ Returns the path to the translation directory.
:rtype: str
%End

static QString metadataPath();
%Docstring
Returns the path to the metadata directory.
.. versionadded:: 3.0
:rtype: str
%End

static QString qgisMasterDatabaseFilePath();
%Docstring
Returns the path to the master qgis.db file.
@@ -150,6 +150,7 @@
%Include qgsmessagebaritem.sip
%Include qgsmessagelogviewer.sip
%Include qgsmessageviewer.sip
%Include qgsmetadatawidget.sip
%Include qgsnewhttpconnection.sip
%Include qgsnewmemorylayerdialog.sip
%Include qgsnewnamedialog.sip
@@ -0,0 +1,88 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmetadatawidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsMetadataWidget : QWidget
{
%Docstring
A wizard to edit metadata on a map layer.

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsmetadatawidget.h"
%End
public:

QgsMetadataWidget( QWidget *parent, QgsMapLayer *layer = 0 );
%Docstring
Constructor for the wizard.
%End
~QgsMetadataWidget();

void saveMetadata( QgsLayerMetadata &layerMetadata ) const;
%Docstring
Save all fields in a QgsLayerMetadata object.
%End

bool checkMetadata() const;
%Docstring
Check if values in the wizard are correct.
:rtype: bool
%End

void acceptMetadata();
%Docstring
Saves the metadata to the layer.
%End

static QMap<QString, QString> parseLanguages();
%Docstring
Returns a list of languages available by default in the wizard.
:rtype: QMap<str, QString>
%End

static QStringList parseLicenses();
%Docstring
Returns a list of licences available by default in the wizard.
:rtype: list of str
%End

static QStringList parseLinkTypes();
%Docstring
Returns a list of link types available by default in the wizard.
.. seealso:: https://github.com/OSGeo/Cat-Interop/blob/master/LinkPropertyLookupTable.csv
:rtype: list of str
%End

static QStringList parseMimeTypes();
%Docstring
Returns a list of MIME types available by default in the wizard.
.. seealso:: https://fr.wikipedia.org/wiki/Type_MIME
:rtype: list of str
%End

static QMap<QString, QString> parseTypes();
%Docstring
Returns a list of types available by default in the wizard.
:rtype: QMap<str, QString>
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsmetadatawidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -0,0 +1,185 @@
alpha2,English
aa,Afar
ab,Abkhazian
ae,Avestan
af,Afrikaans
ak,Akan
am,Amharic
an,Aragonese
ar,Arabic
as,Assamese
av,Avaric
ay,Aymara
az,Azerbaijani
ba,Bashkir
be,Belarusian
bg,Bulgarian
bh,Bihari languages
bi,Bislama
bm,Bambara
bn,Bengali
bo,Tibetan
br,Breton
bs,Bosnian
ca,Catalan; Valencian
ce,Chechen
ch,Chamorro
co,Corsican
cr,Cree
cs,Czech
cu,Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic
cv,Chuvash
cy,Welsh
da,Danish
de,German
dv,Divehi; Dhivehi; Maldivian
dz,Dzongkha
ee,Ewe
el,"Greek, Modern (1453-)"
en,English
eo,Esperanto
es,Spanish; Castilian
et,Estonian
eu,Basque
fa,Persian
ff,Fulah
fi,Finnish
fj,Fijian
fo,Faroese
fr,French
fy,Western Frisian
ga,Irish
gd,Gaelic; Scottish Gaelic
gl,Galician
gn,Guarani
gu,Gujarati
gv,Manx
ha,Hausa
he,Hebrew
hi,Hindi
ho,Hiri Motu
hr,Croatian
ht,Haitian; Haitian Creole
hu,Hungarian
hy,Armenian
hz,Herero
ia,Interlingua (International Auxiliary Language Association)
id,Indonesian
ie,Interlingue; Occidental
ig,Igbo
ii,Sichuan Yi; Nuosu
ik,Inupiaq
io,Ido
is,Icelandic
it,Italian
iu,Inuktitut
ja,Japanese
jv,Javanese
ka,Georgian
kg,Kongo
ki,Kikuyu; Gikuyu
kj,Kuanyama; Kwanyama
kk,Kazakh
kl,Kalaallisut; Greenlandic
km,Central Khmer
kn,Kannada
ko,Korean
kr,Kanuri
ks,Kashmiri
ku,Kurdish
kv,Komi
kw,Cornish
ky,Kirghiz; Kyrgyz
la,Latin
lb,Luxembourgish; Letzeburgesch
lg,Ganda
li,Limburgan; Limburger; Limburgish
ln,Lingala
lo,Lao
lt,Lithuanian
lu,Luba-Katanga
lv,Latvian
mg,Malagasy
mh,Marshallese
mi,Maori
mk,Macedonian
ml,Malayalam
mn,Mongolian
mr,Marathi
ms,Malay
mt,Maltese
my,Burmese
na,Nauru
nb,"Bokmål, Norwegian; Norwegian Bokmål"
nd,"Ndebele, North; North Ndebele"
ne,Nepali
ng,Ndonga
nl,Dutch; Flemish
nn,"Norwegian Nynorsk; Nynorsk, Norwegian"
no,Norwegian
nr,"Ndebele, South; South Ndebele"
nv,Navajo; Navaho
ny,Chichewa; Chewa; Nyanja
oc,Occitan (post 1500); Provençal
oj,Ojibwa
om,Oromo
or,Oriya
os,Ossetian; Ossetic
pa,Panjabi; Punjabi
pi,Pali
pl,Polish
ps,Pushto; Pashto
pt,Portuguese
qu,Quechua
rm,Romansh
rn,Rundi
ro,Romanian; Moldavian; Moldovan
ru,Russian
rw,Kinyarwanda
sa,Sanskrit
sc,Sardinian
sd,Sindhi
se,Northern Sami
sg,Sango
si,Sinhala; Sinhalese
sk,Slovak
sl,Slovenian
sm,Samoan
sn,Shona
so,Somali
sq,Albanian
sr,Serbian
ss,Swati
st,"Sotho, Southern"
su,Sundanese
sv,Swedish
sw,Swahili
ta,Tamil
te,Telugu
tg,Tajik
th,Thai
ti,Tigrinya
tk,Turkmen
tl,Tagalog
tn,Tswana
to,Tonga (Tonga Islands)
tr,Turkish
ts,Tsonga
tt,Tatar
tw,Twi
ty,Tahitian
ug,Uighur; Uyghur
uk,Ukrainian
ur,Urdu
uz,Uzbek
ve,Venda
vi,Vietnamese
vo,Volapük
wa,Walloon
wo,Wolof
xh,Xhosa
yi,Yiddish
yo,Yoruba
za,Zhuang; Chuang
zh,Chinese
zu,Zulu
@@ -0,0 +1,7 @@
name,code
Creative Commons CC Zero,CC0
Open Data Commons Public Domain Dedication and Licence,PDDL
Creative Commons Attribution 4.0,CC-BY-4.0
Open Data Commons Attribution License,ODC-BY
Creative Commons Attribution Share-Alike 4.0,CC-BY-SA-4.0
Open Data Commons Open Database License,ODBL
@@ -0,0 +1,16 @@
attribute;information applies to the attribute class
attributeType;information applies to the characteristic of a feature
collectionHardware;information applies to the collection hardware class
collectionSession;information applies to the collection session
dataset;information applies to the dataset
series;information applies to the series
nonGeographicDataset;information applies to non-geographic data
dimensionGroup;information applies to a dimension group
feature;information applies to a feature
featureType;information applies to a feature type
propertyType;information applies to a property type
fieldSession;information applies to a field session
software;information applies to a computer program or routine
service;information applies to a capability which a service provider entity makes available to a service user entity through a set of interfaces that define a behavior, such as a use case
model;information applies to a copy or imitation of an existing or hypothetical object
tile;information applies to a tile, a spatial subset of geographic data
@@ -0,0 +1,25 @@
application/octet-stream
application/pdf
application/xhtml+xml
application/json
application/xml
application/zip
image/gif
image/jpeg
image/png
image/tiff
image/svg+xml
text/csv
text/html
text/plain
text/xml
application/vnd.oasis.opendocument.text
application/vnd.oasis.opendocument.spreadsheet
application/vnd.oasis.opendocument.presentation
application/vnd.oasis.opendocument.graphics
application/vnd.ms-excel
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
application/vnd.ms-powerpoint
application/vnd.openxmlformats-officedocument.presentationml.presentation
application/msword
application/vnd.openxmlformats-officedocument.wordprocessingml.document
@@ -31,6 +31,7 @@
#include "qgsmaplayerstyleguiutils.h"
#include "qgsmaptoolemitpoint.h"
#include "qgsmaptopixel.h"
#include "qgsmetadatawidget.h"
#include "qgsmultibandcolorrenderer.h"
#include "qgsmultibandcolorrendererwidget.h"
#include "qgspalettedrendererwidget.h"
@@ -231,6 +232,13 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer *lyr, QgsMapCanv
mOptsPage_Histogram->setEnabled( false );
}

QVBoxLayout *layout = new QVBoxLayout( metadataFrame );
layout->setMargin( 0 );
mMetadataWidget = new QgsMetadataWidget( this, mRasterLayer );
mMetadataWidget->layout()->setContentsMargins( -1, 0, -1, 0 );
layout->addWidget( mMetadataWidget );
metadataFrame->setLayout( layout );

QgsDebugMsg( "Setting crs to " + mRasterLayer->crs().toWkt() );
QgsDebugMsg( "Setting crs to " + mRasterLayer->crs().authid() + " - " + mRasterLayer->crs().description() );
mCrsSelector->setCrs( mRasterLayer->crs() );
@@ -829,6 +837,9 @@ void QgsRasterLayerProperties::apply()
mRasterLayer->setRenderer( rendererWidget->renderer() );
}

mMetadataWidget->acceptMetadata();
mMetadataFilled = false;

//transparency settings
QgsRasterRenderer *rasterRenderer = mRasterLayer->renderer();
if ( rasterRenderer )
@@ -31,6 +31,7 @@ class QgsMapLayer;
class QgsMapCanvas;
class QgsRasterLayer;
class QgsMapToolEmitPoint;
class QgsMetadataWidget;
class QgsRasterRenderer;
class QgsRasterRendererWidget;
class QgsRasterHistogramWidget;
@@ -154,6 +155,7 @@ class APP_EXPORT QgsRasterLayerProperties : public QgsOptionsDialogBase, private
//bool mRasterLayerIsInternal;

QgsRasterRendererWidget *mRendererWidget = nullptr;
QgsMetadataWidget *mMetadataWidget = nullptr;

bool rasterIsMultiBandColor();

0 comments on commit ba81068

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