Skip to content
Permalink
Browse files

do not display geometry, spatial extent and CRS for non spatial layer

  • Loading branch information
Gustry authored and nyalldawson committed Sep 4, 2018
1 parent 6a80069 commit c4918721133cd3e441d6198f8f0418e64774b943
Showing with 31 additions and 27 deletions.
  1. +31 −27 src/core/qgsvectorlayer.cpp
@@ -4231,37 +4231,41 @@ QString QgsVectorLayer::htmlMetadata() const
// encoding
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Encoding" ) + QStringLiteral( "</td><td>" ) + dataProvider()->encoding() + QStringLiteral( "</td></tr>\n" );

// geom type
QgsWkbTypes::GeometryType type = geometryType();
if ( type < 0 || type > QgsWkbTypes::NullGeometry )
{
QgsDebugMsgLevel( QStringLiteral( "Invalid vector type" ), 2 );
}
else
{
QString typeString( QStringLiteral( "%1 (%2)" ).arg( QgsWkbTypes::geometryDisplayString( geometryType() ),
QgsWkbTypes::displayString( wkbType() ) ) );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Geometry" ) + QStringLiteral( "</td><td>" ) + typeString + QStringLiteral( "</td></tr>\n" );
}

// EPSG
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "CRS" ) + QStringLiteral( "</td><td>" );
if ( crs().isValid() )
if ( isSpatial() )
{
myMetadata += crs().authid() + QStringLiteral( " - " );
myMetadata += crs().description() + QStringLiteral( " - " );
if ( crs().isGeographic() )
myMetadata += tr( "Geographic" );
// geom type
QgsWkbTypes::GeometryType type = geometryType();
if ( type < 0 || type > QgsWkbTypes::NullGeometry )
{
QgsDebugMsgLevel( QStringLiteral( "Invalid vector type" ), 2 );
}
else
myMetadata += tr( "Projected" );
}
myMetadata += QLatin1String( "</td></tr>\n" );
{
QString typeString( QStringLiteral( "%1 (%2)" ).arg( QgsWkbTypes::geometryDisplayString( geometryType() ),
QgsWkbTypes::displayString( wkbType() ) ) );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Geometry" ) + QStringLiteral( "</td><td>" ) + typeString + QStringLiteral( "</td></tr>\n" );
}

// Extent
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Extent" ) + QStringLiteral( "</td><td>" ) + extent().toString() + QStringLiteral( "</td></tr>\n" );
// EPSG
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "CRS" ) + QStringLiteral( "</td><td>" );
if ( crs().isValid() )
{
myMetadata += crs().authid() + QStringLiteral( " - " );
myMetadata += crs().description() + QStringLiteral( " - " );
if ( crs().isGeographic() )
myMetadata += tr( "Geographic" );
else
myMetadata += tr( "Projected" );
}
myMetadata += QLatin1String( "</td></tr>\n" );

// Extent
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Extent" ) + QStringLiteral( "</td><td>" ) + extent().toString() + QStringLiteral( "</td></tr>\n" );

// unit
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Unit" ) + QStringLiteral( "</td><td>" ) + QgsUnitTypes::toString( crs().mapUnits() ) + QStringLiteral( "</td></tr>\n" );
// unit
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Unit" ) + QStringLiteral( "</td><td>" ) + QgsUnitTypes::toString( crs().mapUnits() ) + QStringLiteral( "</td></tr>\n" );

}

// feature count
QLocale locale = QLocale();

0 comments on commit c491872

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