Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[mesh] option to add mesh layer from data source manager dialog
- Loading branch information
Showing
with
448 additions
and 0 deletions.
- +1 −0 images/images.qrc
- +106 −0 images/themes/default/mActionAddMeshLayer.svg
- +7 −0 python/gui/auto_generated/qgsabstractdatasourcewidget.sip.in
- +49 −0 src/app/qgisapp.cpp
- +6 −0 src/app/qgisapp.h
- +6 −0 src/gui/qgsabstractdatasourcewidget.h
- +2 −0 src/gui/qgsdatasourcemanagerdialog.cpp
- +5 −0 src/gui/qgsdatasourcemanagerdialog.h
- +19 −0 src/providers/mdal/CMakeLists.txt
- +34 −0 src/providers/mdal/qgsmdalprovider.cpp
- +59 −0 src/providers/mdal/qgsmdalsourceselect.cpp
- +46 −0 src/providers/mdal/qgsmdalsourceselect.h
- +108 −0 src/ui/mesh/qgsmdalsourceselectbase.ui
@@ -0,0 +1,106 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<svg | ||
xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
xmlns:cc="http://creativecommons.org/ns#" | ||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
xmlns:svg="http://www.w3.org/2000/svg" | ||
xmlns="http://www.w3.org/2000/svg" | ||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||
height="24" | ||
width="24" | ||
version="1.1" | ||
id="svg22" | ||
sodipodi:docname="mActionAddMeshLayer.svg" | ||
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"> | ||
<metadata | ||
id="metadata28"> | ||
<rdf:RDF> | ||
<cc:Work | ||
rdf:about=""> | ||
<dc:format>image/svg+xml</dc:format> | ||
<dc:type | ||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||
<dc:title /> | ||
</cc:Work> | ||
</rdf:RDF> | ||
</metadata> | ||
<defs | ||
id="defs26" /> | ||
<sodipodi:namedview | ||
pagecolor="#ffffff" | ||
bordercolor="#666666" | ||
borderopacity="1" | ||
objecttolerance="10" | ||
gridtolerance="10" | ||
guidetolerance="10" | ||
inkscape:pageopacity="0" | ||
inkscape:pageshadow="2" | ||
inkscape:window-width="1920" | ||
inkscape:window-height="1015" | ||
id="namedview24" | ||
showgrid="false" | ||
inkscape:zoom="27.812867" | ||
inkscape:cx="12.444503" | ||
inkscape:cy="11.691578" | ||
inkscape:window-x="0" | ||
inkscape:window-y="0" | ||
inkscape:window-maximized="1" | ||
inkscape:current-layer="g20" /> | ||
<g | ||
transform="translate(0 -8)" | ||
id="g20"> | ||
<g | ||
transform="matrix(.69230769 0 0 .69230769 1.8461539 9.8461539)" | ||
id="g18"> | ||
<rect | ||
fill="#5a8c5a" | ||
height="13" | ||
rx="2.6149371" | ||
ry="2.6149368" | ||
width="13" | ||
x="19" | ||
y="19" | ||
id="rect10" /> | ||
<path | ||
d="m21.6 25.499999l7.8 0" | ||
style="fill:#fff;fill-rule:evenodd;stroke:#fff;stroke-width:2.5999999;stroke-linecap:round;stroke-linejoin:round;overflow:visible" | ||
id="path12" /> | ||
<path | ||
d="m25.5 29.399999l0-7.799999" | ||
style="fill:#fff;fill-rule:evenodd;stroke:#fff;stroke-width:2.5999999;stroke-linecap:round;stroke-linejoin:round;overflow:visible" | ||
id="path14" /> | ||
<path | ||
d="m20.3 25.499999h10.4c0 0 0 0 0-2.6 0-2.599999-.65-2.599999-5.2-2.599999-4.55 0-5.2 0-5.2 2.599999 0 2.6 0 2.6 0 2.6z" | ||
fill="#fcffff" | ||
fill-rule="evenodd" | ||
opacity=".3" | ||
id="path16" /> | ||
</g> | ||
<path | ||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" | ||
d="M 1.5100924,9.3486136 1.0426829,30.202271 13.482968,30.022498 13.626786,21.393398 1.114592,21.24958 23.118796,21.501262 23.082841,8.629522 1.4381833,8.9171586 1.5100924,9.8519778 13.698696,21.429353 13.806559,8.8452495 v 0 0 -0.035955" | ||
id="path829" | ||
inkscape:connector-curvature="0" /> | ||
<path | ||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" | ||
d="M 22.615432,8.5935674 14.166105,20.961943" | ||
id="path831" | ||
inkscape:connector-curvature="0" /> | ||
<path | ||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" | ||
d="M 7.9819171,21.429353 7.8740534,30.166316" | ||
id="path833" | ||
inkscape:connector-curvature="0" /> | ||
<path | ||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" | ||
d="M 1.0067283,25.887721 H 13.482968" | ||
id="path835" | ||
inkscape:connector-curvature="0" /> | ||
<path | ||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" | ||
d="M 1.5100924,21.177671 13.806559,8.8452495" | ||
id="path837" | ||
inkscape:connector-curvature="0" /> | ||
</g> | ||
</svg> |
@@ -0,0 +1,59 @@ | ||
/*************************************************************************** | ||
qgsmdalsourceselect.cpp | ||
----------------------- | ||
begin : July 2018 | ||
copyright : (C) 2018 by Peter Petrik | ||
email : zilolv at gmail dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include <QMessageBox> | ||
|
||
#include "qgsmdalsourceselect.h" | ||
#include "qgsproviderregistry.h" | ||
#include "ogr/qgsogrhelperfunctions.h" | ||
|
||
QgsMdalSourceSelect::QgsMdalSourceSelect( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode ): | ||
QgsAbstractDataSourceWidget( parent, fl, widgetMode ) | ||
{ | ||
setupUi( this ); | ||
setupButtons( buttonBox ); | ||
|
||
mFileWidget->setDialogTitle( tr( "Open MDAL Supported Mesh Dataset(s)" ) ); | ||
mFileWidget->setFilter( QStringLiteral( "Mesh File (*.2dm);;All files (*.*)" ) ); | ||
mFileWidget->setStorageMode( QgsFileWidget::GetMultipleFiles ); | ||
connect( mFileWidget, &QgsFileWidget::fileChanged, this, [ = ]( const QString & path ) | ||
{ | ||
mMeshPath = path; | ||
emit enableButtons( ! mMeshPath.isEmpty() ); | ||
} ); | ||
} | ||
|
||
void QgsMdalSourceSelect::addButtonClicked() | ||
{ | ||
if ( mMeshPath.isEmpty() ) | ||
{ | ||
QMessageBox::information( this, | ||
tr( "Add mesh layer" ), | ||
tr( "No layers selected." ) ); | ||
return; | ||
} | ||
|
||
for ( const QString &path : QgsFileWidget::splitFilePaths( mMeshPath ) ) | ||
{ | ||
emit addMeshLayer( path, QStringLiteral( "mdal" ) ); | ||
} | ||
} | ||
|
||
QGISEXTERN QgsMdalSourceSelect *selectWidget( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode ) | ||
{ | ||
return new QgsMdalSourceSelect( parent, fl, widgetMode ); | ||
} |
Oops, something went wrong.