Skip to content
Permalink
Browse files

Followup 0548f4, fixes to layer metadata and metadata widget

Address outstanding review requests so that this PR can be merged
  • Loading branch information
nyalldawson committed Feb 20, 2018
1 parent 0548f42 commit 3d4f6f82bbbc525ea6cb797e6397bb6d588abca6
@@ -223,6 +223,8 @@ will be performed on the x/y extent of the box only.
Converts the box to a 2D rectangle.
%End

bool operator==( const QgsBox3d &other ) const;

};

/************************************************************************
@@ -50,6 +50,8 @@ using QgsNativeMetadataValidator.
QgsCoordinateReferenceSystem extentCrs;

QgsBox3d bounds;

bool operator==( const QgsLayerMetadata::SpatialExtent &other ) const;
};

struct Extent
@@ -87,6 +89,8 @@ Sets the temporal ``extents`` of the resource.
.. seealso:: :py:func:`temporalExtents`
%End

bool operator==( const Extent &other ) const;


};

@@ -101,6 +105,9 @@ Constructor for Constraint.
QString type;

QString constraint;

bool operator==( const QgsLayerMetadata::Constraint &other ) const;

};

typedef QList< QgsLayerMetadata::Constraint > ConstraintList;
@@ -125,6 +132,8 @@ Constructor for Address.
QString postalCode;

QString country;

bool operator==( const QgsLayerMetadata::Address &other ) const;
};

struct Contact
@@ -150,6 +159,8 @@ Constructor for Contact.
QString email;

QString role;

bool operator==( const QgsLayerMetadata::Contact &other ) const;
};

typedef QList< QgsLayerMetadata::Contact > ContactList;
@@ -176,6 +187,8 @@ Constructor for Link.
QString mimeType;

QString size;

bool operator==( const QgsLayerMetadata::Link &other ) const;
};

typedef QList< QgsLayerMetadata::Link > LinkList;
@@ -618,6 +631,7 @@ Stores state in Dom node
:return: true if successful
%End

bool operator==( const QgsLayerMetadata &metadataOther ) const;

};

@@ -364,19 +364,21 @@ The default implementation does nothing.

virtual QgsLayerMetadata layerMetadata() const;
%Docstring
Retrieve collected Metadata from the Provider source
A structured metadata store for a map layer.
\note
Returns layer metadata collected from the provider's source.

Individual data providers must implement this method if they support collecting metadata.

.. seealso:: :py:func:`setLayerMetadata`
.. seealso:: :py:func:`writeLayerMetadata`

.. versionadded:: 3.0
%End
virtual bool setLayerMetadata( const QgsLayerMetadata &layerMetadata );

virtual bool writeLayerMetadata( const QgsLayerMetadata &metadata );
%Docstring
Set collected Metadata from the Provider source
A structured metadata store for a map layer.
\note
Writes layer ``metadata`` to the underlying provider source. Support depends
on individual provider capabilities.

Returns true if metadata was successfully written to the data provider.

.. seealso:: :py:func:`layerMetadata`

@@ -243,6 +243,8 @@ Returns true if this range contains a specified ``element``.
Returns true if this range overlaps another range.
%End

bool operator==( const QgsTemporalRange<T> &other ) const;

};


@@ -48,6 +48,8 @@ of feature and attribute information from a spatial datasource.
ChangeFeatures,
RenameAttributes,
FastTruncate,
ReadLayerMetadata,
WriteLayerMetadata,
};

typedef QFlags<QgsVectorDataProvider::Capability> Capabilities;
@@ -69,13 +69,31 @@ Base class for raster data providers.
#include "qgsrasterdataprovider.h"
%End
public:

enum ProviderCapability
{
NoProviderCapabilities,
ReadLayerMetadata,
WriteLayerMetadata,
};

typedef QFlags<QgsRasterDataProvider::ProviderCapability> ProviderCapabilities;


QgsRasterDataProvider();

QgsRasterDataProvider( const QString &uri );

virtual QgsRasterInterface *clone() const = 0;


virtual QgsRasterDataProvider::ProviderCapabilities providerCapabilities() const;
%Docstring
Returns flags containing the supported capabilities of the data provider.

.. versionadded:: 3.0
%End

virtual bool setInput( QgsRasterInterface *input );
%Docstring
It makes no sense to set input on provider */
@@ -425,6 +443,9 @@ Copy member variables from other raster data provider. Useful for implementation

};

QFlags<QgsRasterDataProvider::ProviderCapability> operator|(QgsRasterDataProvider::ProviderCapability f1, QFlags<QgsRasterDataProvider::ProviderCapability> f2);



/************************************************************************
* This file has been generated automatically from *
@@ -26,30 +26,26 @@ class QgsMetadataWidget : QWidget
QgsMetadataWidget( QWidget *parent, QgsMapLayer *layer = 0 );
%Docstring
Constructor for the wizard.
\note
For use with a source \layer. This constructor automatically sets the widget's metadata() if the ``layer`` pointer is valid.
calls setMetadata, using mMetadata

:param layer: to set the main QgsLayerMetadata with mLayer->metadata() when not None
If ``layer`` is set, then this constructor automatically sets the widget's metadata() to match
the layer's metadata..

.. seealso:: :py:func:`setMetadata`
%End

void setMetadata( const QgsLayerMetadata &layerMetadata );
void setMetadata( const QgsLayerMetadata &metadata );
%Docstring
Sets the ``metadata`` to display in the widget
\note
Called from constructor and initializes child widget on first use
Can be called from outside to change the QgsLayerMetadata object.
Sets the ``metadata`` to display in the widget.

This method can be called after constructing a QgsMetadataWidget in order
to set the displayed metadata to custom, non-layer based metadata.

.. seealso:: :py:func:`metadata`
%End

QgsLayerMetadata metadata();
%Docstring
Retrieves a QgsLayerMetadata object representing the current state of the widget.
\note
saveMetdata is called before returning :py:class:`QgsLayerMetadata`
Returns a QgsLayerMetadata object representing the current state of the widget.

.. seealso:: :py:func:`saveMetadata`
%End
@@ -58,7 +54,7 @@ saveMetdata is called before returning :py:class:`QgsLayerMetadata`
%Docstring
Save all fields in a QgsLayerMetadata object.

.. seealso:: :py:func:`getMetadata`
.. seealso:: :py:func:`metadata`

.. seealso:: :py:func:`acceptMetadata`

@@ -69,8 +65,6 @@ Save all fields in a QgsLayerMetadata object.
%Docstring
Check if values in the wizard are correct.

.. seealso:: :py:func:`updatePanel`

.. seealso:: :py:func:`saveMetadata`
%End

@@ -82,11 +76,6 @@ If the CRS is updated.
void acceptMetadata();
%Docstring
Saves the metadata to the layer.
%End

virtual void setMetadata( const QgsLayerMetadata &metadata );
%Docstring
Sets the layer's ``metadata`` store.
%End

static QMap<QString, QString> parseLanguages();
@@ -117,3 +117,10 @@ bool QgsBox3d::contains( const QgsPoint &p ) const
else
return true;
}

bool QgsBox3d::operator==( const QgsBox3d &other ) const
{
return mBounds2d == other.mBounds2d &&
qgsDoubleNear( mZmin, other.mZmin ) &&
qgsDoubleNear( mZmax, other.mZmax );
}
@@ -202,6 +202,8 @@ class CORE_EXPORT QgsBox3d
*/
QgsRectangle toRectangle() const { return mBounds2d; }

bool operator==( const QgsBox3d &other ) const;

private:

QgsRectangle mBounds2d;
@@ -768,25 +768,72 @@ void QgsLayerMetadata::Extent::setTemporalExtents( const QList<QgsDateTimeRange>
mTemporalExtents = temporalExtents;
}

bool QgsLayerMetadata::Extent::operator==( const QgsLayerMetadata::Extent &other ) const
{
return mSpatialExtents == other.mSpatialExtents && mTemporalExtents == other.mTemporalExtents;
}

bool QgsLayerMetadata::operator==( const QgsLayerMetadata &metadataOther ) const
{
return ( ( parentIdentifier() == metadataOther.parentIdentifier() ) &&
( identifier() == metadataOther.identifier() ) &&
( language() == metadataOther.language() ) &&
( type() == metadataOther.type() ) &&
( title() == metadataOther.title() ) &&
( abstract() == metadataOther.abstract() ) &&
( fees() == metadataOther.fees() ) &&
( rights() == metadataOther.rights() ) &&
( licenses() == metadataOther.licenses() ) &&
( history() == metadataOther.history() ) &&
( encoding() == metadataOther.encoding() ) &&
( crs() == metadataOther.crs() ) &&
( keywords() == metadataOther.keywords() ) &&
( categories() == metadataOther.categories() ) &&
// QgsLayerMetadata::ConstraintList, LinkList, Extent, ContactList need to be delt with properly
( constraints().count() == metadataOther.constraints().count() ) &&
( extent().spatialExtents().count() == metadataOther.extent().spatialExtents().count() ) &&
( contacts().count() == metadataOther.contacts().count() ) &&
( links().count() == metadataOther.links().count() ) );
return ( ( mIdentifier == metadataOther.mIdentifier ) &&
( mParentIdentifier == metadataOther.mParentIdentifier ) &&
( mLanguage == metadataOther.mLanguage ) &&
( mType == metadataOther.mType ) &&
( mTitle == metadataOther.mTitle ) &&
( mAbstract == metadataOther.mAbstract ) &&
( mFees == metadataOther.mFees ) &&
( mConstraints == metadataOther.mConstraints ) &&
( mRights == metadataOther.mRights ) &&
( mLicenses == metadataOther.mLicenses ) &&
( mHistory == metadataOther.mHistory ) &&
( mEncoding == metadataOther.mEncoding ) &&
( mCrs == metadataOther.mCrs ) &&
( mExtent == metadataOther.mExtent ) &&
( mKeywords == metadataOther.mKeywords ) &&
( mContacts == metadataOther.mContacts ) &&
( mLinks == metadataOther.mLinks ) );
}

bool QgsLayerMetadata::SpatialExtent::operator==( const QgsLayerMetadata::SpatialExtent &other ) const
{
return extentCrs == other.extentCrs &&
bounds == other.bounds;
}

bool QgsLayerMetadata::Constraint::operator==( const QgsLayerMetadata::Constraint &other ) const
{
return type == other.type && constraint == other.constraint;
}

bool QgsLayerMetadata::Contact::operator==( const QgsLayerMetadata::Contact &other ) const
{
return name == other.name &&
organization == other.organization &&
position == other.position &&
addresses == other.addresses &&
voice == other.voice &&
fax == other.fax &&
email == other.email &&
role == other.role;
}

bool QgsLayerMetadata::Link::operator==( const QgsLayerMetadata::Link &other ) const
{
return name == other.name &&
type == other.type &&
description == other.description &&
url == other.url &&
format == other.format &&
mimeType == other.mimeType &&
size == other.size;
}

bool QgsLayerMetadata::Address::operator==( const QgsLayerMetadata::Address &other ) const
{
return type == other.type &&
address == other.address &&
city == other.city &&
administrativeArea == other.administrativeArea &&
postalCode == other.postalCode &&
country == other.country;
}

0 comments on commit 3d4f6f8

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