qgsabstractgeopdfexporter.cpp (QGIS-final-3_10_11) | : | qgsabstractgeopdfexporter.cpp (QGIS-final-3_10_12) | ||
---|---|---|---|---|
skipping to change at line 362 | skipping to change at line 362 | |||
layer.setAttribute( QStringLiteral( "name" ), it.value() ); | layer.setAttribute( QStringLiteral( "name" ), it.value() ); | |||
layer.setAttribute( QStringLiteral( "initiallyVisible" ), QStringLiteral( "t rue" ) ); | layer.setAttribute( QStringLiteral( "initiallyVisible" ), QStringLiteral( "t rue" ) ); | |||
layerTree.appendChild( layer ); | layerTree.appendChild( layer ); | |||
} | } | |||
compositionElem.appendChild( layerTree ); | compositionElem.appendChild( layerTree ); | |||
// pages | // pages | |||
QDomElement page = doc.createElement( QStringLiteral( "Page" ) ); | QDomElement page = doc.createElement( QStringLiteral( "Page" ) ); | |||
QDomElement dpi = doc.createElement( QStringLiteral( "DPI" ) ); | QDomElement dpi = doc.createElement( QStringLiteral( "DPI" ) ); | |||
dpi.appendChild( doc.createTextNode( QString::number( details.dpi ) ) ); | dpi.appendChild( doc.createTextNode( qgsDoubleToString( details.dpi ) ) ); | |||
page.appendChild( dpi ); | page.appendChild( dpi ); | |||
// assumes DPI of 72, which is an assumption on GDALs/PDF side. It's only rela ted to the PDF coordinate space and doesn't affect the actual output DPI! | // assumes DPI of 72, which is an assumption on GDALs/PDF side. It's only rela ted to the PDF coordinate space and doesn't affect the actual output DPI! | |||
QDomElement width = doc.createElement( QStringLiteral( "Width" ) ); | QDomElement width = doc.createElement( QStringLiteral( "Width" ) ); | |||
const double pageWidthPdfUnits = std::ceil( details.pageSizeMm.width() / 25.4 * 72 ); | const double pageWidthPdfUnits = std::ceil( details.pageSizeMm.width() / 25.4 * 72 ); | |||
width.appendChild( doc.createTextNode( QString::number( pageWidthPdfUnits ) ) ); | width.appendChild( doc.createTextNode( qgsDoubleToString( pageWidthPdfUnits ) ) ); | |||
page.appendChild( width ); | page.appendChild( width ); | |||
QDomElement height = doc.createElement( QStringLiteral( "Height" ) ); | QDomElement height = doc.createElement( QStringLiteral( "Height" ) ); | |||
const double pageHeightPdfUnits = std::ceil( details.pageSizeMm.height() / 25. 4 * 72 ); | const double pageHeightPdfUnits = std::ceil( details.pageSizeMm.height() / 25. 4 * 72 ); | |||
height.appendChild( doc.createTextNode( QString::number( pageHeightPdfUnits ) ) ); | height.appendChild( doc.createTextNode( qgsDoubleToString( pageHeightPdfUnits ) ) ); | |||
page.appendChild( height ); | page.appendChild( height ); | |||
// georeferencing | // georeferencing | |||
int i = 0; | int i = 0; | |||
for ( const QgsAbstractGeoPdfExporter::GeoReferencedSection §ion : details .georeferencedSections ) | for ( const QgsAbstractGeoPdfExporter::GeoReferencedSection §ion : details .georeferencedSections ) | |||
{ | { | |||
QDomElement georeferencing = doc.createElement( QStringLiteral( "Georeferenc ing" ) ); | QDomElement georeferencing = doc.createElement( QStringLiteral( "Georeferenc ing" ) ); | |||
georeferencing.setAttribute( QStringLiteral( "id" ), QStringLiteral( "georef erenced_%1" ).arg( i++ ) ); | georeferencing.setAttribute( QStringLiteral( "id" ), QStringLiteral( "georef erenced_%1" ).arg( i++ ) ); | |||
georeferencing.setAttribute( QStringLiteral( "OGCBestPracticeFormat" ), deta ils.useOgcBestPracticeFormatGeoreferencing ? QStringLiteral( "true" ) : QStringL iteral( "false" ) ); | georeferencing.setAttribute( QStringLiteral( "OGCBestPracticeFormat" ), deta ils.useOgcBestPracticeFormatGeoreferencing ? QStringLiteral( "true" ) : QStringL iteral( "false" ) ); | |||
georeferencing.setAttribute( QStringLiteral( "ISO32000ExtensionFormat" ), de tails.useIso32000ExtensionFormatGeoreferencing ? QStringLiteral( "true" ) : QStr ingLiteral( "false" ) ); | georeferencing.setAttribute( QStringLiteral( "ISO32000ExtensionFormat" ), de tails.useIso32000ExtensionFormatGeoreferencing ? QStringLiteral( "true" ) : QStr ingLiteral( "false" ) ); | |||
skipping to change at line 428 | skipping to change at line 428 | |||
georeferencing.appendChild( boundingPolygon ); | georeferencing.appendChild( boundingPolygon ); | |||
} | } | |||
else | else | |||
{ | { | |||
/* Define the viewport where georeferenced coordinates are available. | /* Define the viewport where georeferenced coordinates are available. | |||
If not specified, the extent of BoundingPolygon will be used instead. | If not specified, the extent of BoundingPolygon will be used instead. | |||
If none of BoundingBox and BoundingPolygon are specified, | If none of BoundingBox and BoundingPolygon are specified, | |||
the whole PDF page will be assumed to be georeferenced. | the whole PDF page will be assumed to be georeferenced. | |||
*/ | */ | |||
QDomElement boundingBox = doc.createElement( QStringLiteral( "BoundingBox" ) ); | QDomElement boundingBox = doc.createElement( QStringLiteral( "BoundingBox" ) ); | |||
boundingBox.setAttribute( QStringLiteral( "x1" ), QString::number( section | boundingBox.setAttribute( QStringLiteral( "x1" ), qgsDoubleToString( secti | |||
.pageBoundsMm.xMinimum() / 25.4 * 72 ) ); | on.pageBoundsMm.xMinimum() / 25.4 * 72 ) ); | |||
boundingBox.setAttribute( QStringLiteral( "y1" ), QString::number( section | boundingBox.setAttribute( QStringLiteral( "y1" ), qgsDoubleToString( secti | |||
.pageBoundsMm.yMinimum() / 25.4 * 72 ) ); | on.pageBoundsMm.yMinimum() / 25.4 * 72 ) ); | |||
boundingBox.setAttribute( QStringLiteral( "x2" ), QString::number( section | boundingBox.setAttribute( QStringLiteral( "x2" ), qgsDoubleToString( secti | |||
.pageBoundsMm.xMaximum() / 25.4 * 72 ) ); | on.pageBoundsMm.xMaximum() / 25.4 * 72 ) ); | |||
boundingBox.setAttribute( QStringLiteral( "y2" ), QString::number( section | boundingBox.setAttribute( QStringLiteral( "y2" ), qgsDoubleToString( secti | |||
.pageBoundsMm.yMaximum() / 25.4 * 72 ) ); | on.pageBoundsMm.yMaximum() / 25.4 * 72 ) ); | |||
georeferencing.appendChild( boundingBox ); | georeferencing.appendChild( boundingBox ); | |||
} | } | |||
for ( const ControlPoint &point : section.controlPoints ) | for ( const ControlPoint &point : section.controlPoints ) | |||
{ | { | |||
QDomElement cp1 = doc.createElement( QStringLiteral( "ControlPoint" ) ); | QDomElement cp1 = doc.createElement( QStringLiteral( "ControlPoint" ) ); | |||
cp1.setAttribute( QStringLiteral( "x" ), QString::number( point.pagePoint. | cp1.setAttribute( QStringLiteral( "x" ), qgsDoubleToString( point.pagePoin | |||
x() / 25.4 * 72 ) ); | t.x() / 25.4 * 72 ) ); | |||
cp1.setAttribute( QStringLiteral( "y" ), QString::number( ( details.pageSi | cp1.setAttribute( QStringLiteral( "y" ), qgsDoubleToString( ( details.page | |||
zeMm.height() - point.pagePoint.y() ) / 25.4 * 72 ) ); | SizeMm.height() - point.pagePoint.y() ) / 25.4 * 72 ) ); | |||
cp1.setAttribute( QStringLiteral( "GeoX" ), QString::number( point.geoPoin | cp1.setAttribute( QStringLiteral( "GeoX" ), qgsDoubleToString( point.geoPo | |||
t.x() ) ); | int.x() ) ); | |||
cp1.setAttribute( QStringLiteral( "GeoY" ), QString::number( point.geoPoin | cp1.setAttribute( QStringLiteral( "GeoY" ), qgsDoubleToString( point.geoPo | |||
t.y() ) ); | int.y() ) ); | |||
georeferencing.appendChild( cp1 ); | georeferencing.appendChild( cp1 ); | |||
} | } | |||
page.appendChild( georeferencing ); | page.appendChild( georeferencing ); | |||
} | } | |||
// content | // content | |||
QDomElement content = doc.createElement( QStringLiteral( "Content" ) ); | QDomElement content = doc.createElement( QStringLiteral( "Content" ) ); | |||
for ( const ComponentLayerDetail &component : components ) | for ( const ComponentLayerDetail &component : components ) | |||
{ | { | |||
End of changes. 5 change blocks. | ||||
19 lines changed or deleted | 19 lines changed or added |