QGIS API Documentation 3.43.0-Master (32433f7016e)
qgslayoutelevationprofilewidget.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutelevationprofilewidget.cpp
3 ----------------------
4 begin : January 2023
5 copyright : (C) 2023 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
19#include "moc_qgslayoutelevationprofilewidget.cpp"
21#include "qgslayoutitemwidget.h"
23#include "qgsplot.h"
24#include "qgsfillsymbol.h"
25#include "qgslinesymbol.h"
26#include "qgsvectorlayer.h"
28#include "qgslayout.h"
29#include "qgslayertree.h"
33#include "qgscurve.h"
34#include "qgslayoutatlas.h"
36#include "qgsprofilerenderer.h"
37#include "qgsgui.h"
38#include <QMenu>
39
41
43 : QgsLayoutItemBaseWidget( nullptr, profile )
44 , mProfile( profile )
45 , mLayerTree( new QgsLayerTree() )
46 , mLayerTreeBridge( new QgsLayerTreeRegistryBridge( mLayerTree.get(), mProfile->layout() ? mProfile->layout()->project() : QgsProject::instance(), this ) )
47{
48 Q_ASSERT( mProfile );
49
50 setupUi( this );
51 setPanelTitle( tr( "Elevation Profile Properties" ) );
52
53 mCopyFromDockMenu = new QMenu( this );
54 connect( mCopyFromDockMenu, &QMenu::aboutToShow, this, [=] {
55 sBuildCopyMenuFunction( this, mCopyFromDockMenu );
56 } );
57
58 connect( mActionRefresh, &QAction::triggered, this, [=] {
59 if ( !mProfile )
60 {
61 return;
62 }
63 mProfile->invalidateCache();
64 mProfile->refresh();
65 } );
66
67 QToolButton *copyFromDockButton = new QToolButton();
68 copyFromDockButton->setAutoRaise( true );
69 copyFromDockButton->setToolTip( tr( "Copy From Profile" ) );
70 copyFromDockButton->setMenu( mCopyFromDockMenu );
71 copyFromDockButton->setPopupMode( QToolButton::InstantPopup );
72 copyFromDockButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionCopyProfileSettings.svg" ) ) );
73
74 mDockToolbar->addWidget( copyFromDockButton );
75
76 //add widget for general composer item properties
77 mItemPropertiesWidget = new QgsLayoutItemPropertiesWidget( this, profile );
78 mainLayout->addWidget( mItemPropertiesWidget );
79
80 connect( mLayerTree.get(), &QgsLayerTree::layerOrderChanged, this, &QgsLayoutElevationProfileWidget::updateItemLayers );
81 connect( mLayerTree.get(), &QgsLayerTreeGroup::visibilityChanged, this, &QgsLayoutElevationProfileWidget::updateItemLayers );
82
83 mSpinTolerance->setClearValue( 0 );
84 connect( mSpinTolerance, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
85 if ( !mProfile || mBlockChanges )
86 return;
87
88 mProfile->beginCommand( tr( "Change Profile Tolerance Distance" ), QgsLayoutItem::UndoElevationProfileTolerance );
89 mProfile->setTolerance( value );
90 mProfile->invalidateCache();
91 mProfile->update();
92 mProfile->endCommand();
93 } );
94
95 connect( mCheckControlledByAtlas, &QCheckBox::toggled, this, [=] {
96 if ( !mProfile || mBlockChanges )
97 return;
98
99 mProfile->beginCommand( tr( "Change Profile Atlas Control" ) );
100 mProfile->setAtlasDriven( mCheckControlledByAtlas->isChecked() );
101 mProfile->invalidateCache();
102 mProfile->update();
103 mProfile->endCommand();
104 } );
105
106 // subsections indicator
107 mSubsectionsSymbolButton->setSymbolType( Qgis::SymbolType::Line );
108 connect( mSubsectionsSymbolButton, &QgsSymbolButton::changed, this, [=] {
109 if ( !mProfile || mBlockChanges )
110 return;
111
112 mProfile->beginCommand( tr( "Change Profile Subsection Indicator" ), QgsLayoutItem::UndoElevationProfileSubsectionLines );
113 mProfile->setSubsectionsSymbol( mSubsectionsSymbolButton->clonedSymbol<QgsLineSymbol>() );
114 mProfile->invalidateCache();
115 mProfile->update();
116 mProfile->endCommand();
117 } );
118 mSubsectionsSymbolButton->setDefaultSymbol( QgsProfilePlotRenderer::defaultSubSectionsSymbol().release() );
119
120 connect( mSubsectionsActivateCheck, &QCheckBox::toggled, this, [=] {
121 if ( !mProfile || mBlockChanges )
122 return;
123
124 const bool subsectionsActivated = mSubsectionsActivateCheck->isChecked();
125 mProfile->beginCommand( tr( "Change Profile Subsection Indicator" ), QgsLayoutItem::UndoElevationProfileSubsectionLines );
126 mSubsectionsSymbolButton->setEnabled( subsectionsActivated );
127 mSubsectionsSymbolLabel->setEnabled( subsectionsActivated );
128 std::unique_ptr<QgsLineSymbol> subSectionsSymbol( subsectionsActivated ? mSubsectionsSymbolButton->clonedSymbol<QgsLineSymbol>() : nullptr );
129 mProfile->setSubsectionsSymbol( subSectionsSymbol.release() );
130
131 mProfile->invalidateCache();
132 mProfile->update();
133 mProfile->endCommand();
134 } );
135
136 mSpinMinDistance->setClearValue( 0 );
137 connect( mSpinMinDistance, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
138 if ( !mProfile || mBlockChanges )
139 return;
140
141 mProfile->beginCommand( tr( "Change Profile Chart Minimum Distance" ), QgsLayoutItem::UndoElevationProfileMinimumDistance );
142 mProfile->plot()->setXMinimum( value );
143 mProfile->invalidateCache();
144 mProfile->update();
145 mProfile->endCommand();
146 } );
147
148 connect( mSpinMaxDistance, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
149 if ( !mProfile || mBlockChanges )
150 return;
151
152 mProfile->beginCommand( tr( "Change Profile Chart Maximum Distance" ), QgsLayoutItem::UndoElevationProfileMaximumDistance );
153 mProfile->plot()->setXMaximum( value );
154 mProfile->invalidateCache();
155 mProfile->update();
156 mProfile->endCommand();
157 } );
158
159 mSpinMinElevation->setClearValue( 0 );
160 connect( mSpinMinElevation, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
161 if ( !mProfile || mBlockChanges )
162 return;
163
164 mProfile->beginCommand( tr( "Change Profile Chart Minimum Elevation" ), QgsLayoutItem::UndoElevationProfileMinimumElevation );
165 mProfile->plot()->setYMinimum( value );
166 mProfile->invalidateCache();
167 mProfile->update();
168 mProfile->endCommand();
169 } );
170
171 connect( mSpinMaxElevation, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
172 if ( !mProfile || mBlockChanges )
173 return;
174
175 mProfile->beginCommand( tr( "Change Profile Chart Maximum Elevation" ), QgsLayoutItem::UndoElevationProfileMaximumElevation );
176 mProfile->plot()->setYMaximum( value );
177 mProfile->invalidateCache();
178 mProfile->update();
179 mProfile->endCommand();
180 } );
181
182 mDistanceAxisMajorLinesSymbolButton->setSymbolType( Qgis::SymbolType::Line );
183 connect( mDistanceAxisMajorLinesSymbolButton, &QgsSymbolButton::changed, this, [=] {
184 if ( !mProfile || mBlockChanges )
185 return;
186
187 mProfile->beginCommand( tr( "Change Profile Chart Distance Major Gridlines" ), QgsLayoutItem::UndoElevationProfileDistanceMajorGridlines );
188 mProfile->plot()->xAxis().setGridMajorSymbol( mDistanceAxisMajorLinesSymbolButton->clonedSymbol<QgsLineSymbol>() );
189 mProfile->invalidateCache();
190 mProfile->update();
191 mProfile->endCommand();
192 } );
193 mDistanceAxisMajorLinesSymbolButton->setDefaultSymbol( QgsPlotDefaultSettings::axisGridMajorSymbol() );
194
195 mDistanceAxisMinorLinesSymbolButton->setSymbolType( Qgis::SymbolType::Line );
196 connect( mDistanceAxisMinorLinesSymbolButton, &QgsSymbolButton::changed, this, [=] {
197 if ( !mProfile || mBlockChanges )
198 return;
199
200 mProfile->beginCommand( tr( "Change Profile Chart Distance Minor Gridlines" ), QgsLayoutItem::UndoElevationProfileDistanceMinorGridlines );
201 mProfile->plot()->xAxis().setGridMinorSymbol( mDistanceAxisMinorLinesSymbolButton->clonedSymbol<QgsLineSymbol>() );
202 mProfile->invalidateCache();
203 mProfile->update();
204 mProfile->endCommand();
205 } );
206 mDistanceAxisMinorLinesSymbolButton->setDefaultSymbol( QgsPlotDefaultSettings::axisGridMinorSymbol() );
207
208 connect( mDistanceAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
209 if ( !mProfile || mBlockChanges )
210 return;
211
212 mProfile->beginCommand( tr( "Change Profile Chart Distance Major Gridlines" ), QgsLayoutItem::UndoElevationProfileDistanceMajorGridlines );
213 mProfile->plot()->xAxis().setGridIntervalMajor( value );
214 mProfile->invalidateCache();
215 mProfile->update();
216 mProfile->endCommand();
217 } );
218
219 connect( mDistanceAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
220 if ( !mProfile || mBlockChanges )
221 return;
222
223 mProfile->beginCommand( tr( "Change Profile Chart Distance Minor Gridlines" ), QgsLayoutItem::UndoElevationProfileDistanceMinorGridlines );
224 mProfile->plot()->xAxis().setGridIntervalMinor( value );
225 mProfile->invalidateCache();
226 mProfile->update();
227 mProfile->endCommand();
228 } );
229
230 connect( mDistanceAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
231 if ( !mProfile || mBlockChanges )
232 return;
233
234 mProfile->beginCommand( tr( "Change Profile Chart Distance Label" ), QgsLayoutItem::UndoElevationProfileDistanceLabels );
235 mProfile->plot()->xAxis().setLabelInterval( value );
236 mProfile->invalidateCache();
237 mProfile->update();
238 mProfile->endCommand();
239 } );
240
241 mElevationAxisMajorLinesSymbolButton->setSymbolType( Qgis::SymbolType::Line );
242 connect( mElevationAxisMajorLinesSymbolButton, &QgsSymbolButton::changed, this, [=] {
243 if ( !mProfile || mBlockChanges )
244 return;
245
246 mProfile->beginCommand( tr( "Change Profile Chart Elevation Major Gridlines" ), QgsLayoutItem::UndoElevationProfileElevationMajorGridlines );
247 mProfile->plot()->yAxis().setGridMajorSymbol( mElevationAxisMajorLinesSymbolButton->clonedSymbol<QgsLineSymbol>() );
248 mProfile->invalidateCache();
249 mProfile->update();
250 mProfile->endCommand();
251 } );
252 mElevationAxisMajorLinesSymbolButton->setDefaultSymbol( QgsPlotDefaultSettings::axisGridMajorSymbol() );
253
254 mElevationAxisMinorLinesSymbolButton->setSymbolType( Qgis::SymbolType::Line );
255 connect( mElevationAxisMinorLinesSymbolButton, &QgsSymbolButton::changed, this, [=] {
256 if ( !mProfile || mBlockChanges )
257 return;
258
259 mProfile->beginCommand( tr( "Change Profile Chart Elevation Minor Gridlines" ), QgsLayoutItem::UndoElevationProfileElevationMinorGridlines );
260 mProfile->plot()->yAxis().setGridMinorSymbol( mElevationAxisMinorLinesSymbolButton->clonedSymbol<QgsLineSymbol>() );
261 mProfile->invalidateCache();
262 mProfile->update();
263 mProfile->endCommand();
264 } );
265 mElevationAxisMinorLinesSymbolButton->setDefaultSymbol( QgsPlotDefaultSettings::axisGridMinorSymbol() );
266
267 connect( mElevationAxisLabelIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
268 if ( !mProfile || mBlockChanges )
269 return;
270
271 mProfile->beginCommand( tr( "Change Profile Chart Elevation Label" ), QgsLayoutItem::UndoElevationProfileElevationLabels );
272 mProfile->plot()->yAxis().setLabelInterval( value );
273 mProfile->invalidateCache();
274 mProfile->update();
275 mProfile->endCommand();
276 } );
277
278 connect( mElevationAxisMajorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
279 if ( !mProfile || mBlockChanges )
280 return;
281
282 mProfile->beginCommand( tr( "Change Profile Chart Elevation Major Gridlines" ), QgsLayoutItem::UndoElevationProfileElevationMajorGridlines );
283 mProfile->plot()->yAxis().setGridIntervalMajor( value );
284 mProfile->invalidateCache();
285 mProfile->update();
286 mProfile->endCommand();
287 } );
288
289 connect( mElevationAxisMinorIntervalSpin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
290 if ( !mProfile || mBlockChanges )
291 return;
292
293 mProfile->beginCommand( tr( "Change Profile Chart Distance Minor Gridlines" ), QgsLayoutItem::UndoElevationProfileElevationMinorGridlines );
294 mProfile->plot()->yAxis().setGridIntervalMinor( value );
295 mProfile->invalidateCache();
296 mProfile->update();
297 mProfile->endCommand();
298 } );
299
300 mChartBackgroundSymbolButton->setSymbolType( Qgis::SymbolType::Fill );
301 connect( mChartBackgroundSymbolButton, &QgsSymbolButton::changed, this, [=] {
302 if ( !mProfile || mBlockChanges )
303 return;
304
305 mProfile->beginCommand( tr( "Change Profile Chart Background" ), QgsLayoutItem::UndoElevationProfileChartBackground );
306 mProfile->plot()->setChartBackgroundSymbol( mChartBackgroundSymbolButton->clonedSymbol<QgsFillSymbol>() );
307 mProfile->invalidateCache();
308 mProfile->update();
309 mProfile->endCommand();
310 } );
311 mChartBackgroundSymbolButton->setDefaultSymbol( QgsPlotDefaultSettings::chartBackgroundSymbol() );
312
313 mChartBorderSymbolButton->setSymbolType( Qgis::SymbolType::Fill );
314 connect( mChartBorderSymbolButton, &QgsSymbolButton::changed, this, [=] {
315 if ( !mProfile || mBlockChanges )
316 return;
317
318 mProfile->beginCommand( tr( "Change Profile Chart Border" ), QgsLayoutItem::UndoElevationProfileChartBorder );
319 mProfile->plot()->setChartBorderSymbol( mChartBorderSymbolButton->clonedSymbol<QgsFillSymbol>() );
320 mProfile->invalidateCache();
321 mProfile->update();
322 mProfile->endCommand();
323 } );
324 mChartBorderSymbolButton->setDefaultSymbol( QgsPlotDefaultSettings::chartBorderSymbol() );
325
326 connect( mDistanceAxisLabelFormatButton, &QPushButton::clicked, this, [=] {
327 if ( !mProfile || mBlockChanges )
328 return;
329
331 widget->setPanelTitle( tr( "Distance Number Format" ) );
332 widget->setFormat( mProfile->plot()->xAxis().numericFormat() );
333 connect( widget, &QgsNumericFormatSelectorWidget::changed, this, [=] {
334 mProfile->beginCommand( tr( "Change Profile Chart Distance Format" ), QgsLayoutItem::UndoElevationProfileDistanceFormat );
335 mProfile->plot()->xAxis().setNumericFormat( widget->format() );
336 mProfile->invalidateCache();
337 mProfile->endCommand();
338 mProfile->update();
339 } );
340 openPanel( widget );
341 } );
342
343 connect( mElevationAxisLabelFormatButton, &QPushButton::clicked, this, [=] {
344 if ( !mProfile || mBlockChanges )
345 return;
346
348 widget->setPanelTitle( tr( "Elevation Number Format" ) );
349 widget->setFormat( mProfile->plot()->yAxis().numericFormat() );
350 connect( widget, &QgsNumericFormatSelectorWidget::changed, this, [=] {
351 mProfile->beginCommand( tr( "Change Profile Chart Elevation Format" ), QgsLayoutItem::UndoElevationProfileElevationFormat );
352 mProfile->plot()->yAxis().setNumericFormat( widget->format() );
353 mProfile->invalidateCache();
354 mProfile->endCommand();
355 mProfile->update();
356 } );
357 openPanel( widget );
358 } );
359
360 mDistanceAxisLabelFontButton->setDialogTitle( tr( "Distance Label Font" ) );
361 mElevationAxisLabelFontButton->setDialogTitle( tr( "Elevation Label Font" ) );
362 mDistanceAxisLabelFontButton->setMode( QgsFontButton::ModeTextRenderer );
363 mElevationAxisLabelFontButton->setMode( QgsFontButton::ModeTextRenderer );
364
365 connect( mDistanceAxisLabelFontButton, &QgsFontButton::changed, this, [=] {
366 if ( !mProfile || mBlockChanges )
367 return;
368
369 mProfile->beginCommand( tr( "Change Profile Chart Distance Font" ), QgsLayoutItem::UndoElevationProfileDistanceFont );
370 mProfile->plot()->xAxis().setTextFormat( mDistanceAxisLabelFontButton->textFormat() );
371 mProfile->invalidateCache();
372 mProfile->endCommand();
373 mProfile->update();
374 } );
375
376 connect( mElevationAxisLabelFontButton, &QgsFontButton::changed, this, [=] {
377 if ( !mProfile || mBlockChanges )
378 return;
379
380 mProfile->beginCommand( tr( "Change Profile Chart Elevation Font" ), QgsLayoutItem::UndoElevationProfileElevationFont );
381 mProfile->plot()->yAxis().setTextFormat( mElevationAxisLabelFontButton->textFormat() );
382 mProfile->invalidateCache();
383 mProfile->endCommand();
384 mProfile->update();
385 } );
386
387 mSpinLeftMargin->setClearValue( 0 );
388 connect( mSpinLeftMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
389 if ( !mProfile || mBlockChanges )
390 return;
391
392 mProfile->beginCommand( tr( "Change Profile Chart Left Margin" ), QgsLayoutItem::UndoMarginLeft );
393 QgsMargins margins = mProfile->plot()->margins();
394 margins.setLeft( value );
395 mProfile->plot()->setMargins( margins );
396 mProfile->invalidateCache();
397 mProfile->update();
398 mProfile->endCommand();
399 } );
400
401 mSpinRightMargin->setClearValue( 0 );
402 connect( mSpinRightMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
403 if ( !mProfile || mBlockChanges )
404 return;
405
406 mProfile->beginCommand( tr( "Change Profile Chart Right Margin" ), QgsLayoutItem::UndoMarginRight );
407 QgsMargins margins = mProfile->plot()->margins();
408 margins.setRight( value );
409 mProfile->plot()->setMargins( margins );
410 mProfile->invalidateCache();
411 mProfile->update();
412 mProfile->endCommand();
413 } );
414
415 mSpinTopMargin->setClearValue( 0 );
416 connect( mSpinTopMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
417 if ( !mProfile || mBlockChanges )
418 return;
419
420 mProfile->beginCommand( tr( "Change Profile Chart Top Margin" ), QgsLayoutItem::UndoMarginTop );
421 QgsMargins margins = mProfile->plot()->margins();
422 margins.setTop( value );
423 mProfile->plot()->setMargins( margins );
424 mProfile->invalidateCache();
425 mProfile->update();
426 mProfile->endCommand();
427 } );
428
429 mSpinBottomMargin->setClearValue( 0 );
430 connect( mSpinBottomMargin, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double value ) {
431 if ( !mProfile || mBlockChanges )
432 return;
433
434 mProfile->beginCommand( tr( "Change Profile Chart Bottom Margin" ), QgsLayoutItem::UndoMarginBottom );
435 QgsMargins margins = mProfile->plot()->margins();
436 margins.setBottom( value );
437 mProfile->plot()->setMargins( margins );
438 mProfile->invalidateCache();
439 mProfile->update();
440 mProfile->endCommand();
441 } );
442
443 for ( Qgis::DistanceUnit unit :
444 {
455 } )
456 {
457 QString title;
459 {
461 }
462 else
463 {
464 title = QgsUnitTypes::toString( unit );
465 }
466 mDistanceUnitCombo->addItem( title, QVariant::fromValue( unit ) );
467 }
468
469 connect( mDistanceUnitCombo, qOverload<int>( &QComboBox::currentIndexChanged ), this, [=]( int ) {
470 if ( !mProfile || mBlockChanges )
471 return;
472
473 mProfile->beginCommand( tr( "Change Profile Chart Units" ) );
474 mProfile->setDistanceUnit( mDistanceUnitCombo->currentData().value<Qgis::DistanceUnit>() );
475 mProfile->invalidateCache();
476 mProfile->update();
477 mProfile->endCommand();
478 } );
479
480 mDistanceLabelsCombo->addItem( tr( "None" ), QVariant::fromValue( Qgis::PlotAxisSuffixPlacement::NoLabels ) );
481 mDistanceLabelsCombo->addItem( tr( "Every Value" ), QVariant::fromValue( Qgis::PlotAxisSuffixPlacement::EveryLabel ) );
482 mDistanceLabelsCombo->addItem( tr( "First Value" ), QVariant::fromValue( Qgis::PlotAxisSuffixPlacement::FirstLabel ) );
483 mDistanceLabelsCombo->addItem( tr( "Last Value" ), QVariant::fromValue( Qgis::PlotAxisSuffixPlacement::LastLabel ) );
484 mDistanceLabelsCombo->addItem( tr( "First and Last Values" ), QVariant::fromValue( Qgis::PlotAxisSuffixPlacement::FirstAndLastLabels ) );
485 connect( mDistanceLabelsCombo, qOverload<int>( &QComboBox::currentIndexChanged ), this, [=]( int ) {
486 if ( !mProfile || mBlockChanges )
487 return;
488
489 mProfile->beginCommand( tr( "Change Profile Chart Label Placement" ) );
490 mProfile->plot()->xAxis().setLabelSuffixPlacement( mDistanceLabelsCombo->currentData().value<Qgis::PlotAxisSuffixPlacement>() );
491 mProfile->invalidateCache();
492 mProfile->update();
493 mProfile->endCommand();
494 } );
495
496
512
513 mLayerTreeView = new QgsElevationProfileLayerTreeView( mLayerTree.get() );
514
515 QVBoxLayout *vl = new QVBoxLayout();
516 vl->setContentsMargins( 0, 0, 0, 0 );
517 vl->addWidget( mLayerTreeView );
518 mTreeViewContainer->setLayout( vl );
519
520 mBlockChanges++;
521 mLayerTreeView->populateInitialLayers( mProfile->layout() && mProfile->layout()->project() ? mProfile->layout()->project() : QgsProject::instance() );
522 mBlockChanges--;
523
524 setGuiElementValues();
525
526 mSubsectionsSymbolButton->registerExpressionContextGenerator( mProfile );
527 mDistanceAxisMajorLinesSymbolButton->registerExpressionContextGenerator( mProfile );
528 mDistanceAxisMinorLinesSymbolButton->registerExpressionContextGenerator( mProfile );
529 mElevationAxisMajorLinesSymbolButton->registerExpressionContextGenerator( mProfile );
530 mElevationAxisMinorLinesSymbolButton->registerExpressionContextGenerator( mProfile );
531 mChartBackgroundSymbolButton->registerExpressionContextGenerator( mProfile );
532 mChartBorderSymbolButton->registerExpressionContextGenerator( mProfile );
533 mDistanceAxisLabelFontButton->registerExpressionContextGenerator( mProfile );
534 mElevationAxisLabelFontButton->registerExpressionContextGenerator( mProfile );
535
536 mSubsectionsSymbolButton->setLayer( coverageLayer() );
537 mDistanceAxisMajorLinesSymbolButton->setLayer( coverageLayer() );
538 mDistanceAxisMinorLinesSymbolButton->setLayer( coverageLayer() );
539 mElevationAxisMajorLinesSymbolButton->setLayer( coverageLayer() );
540 mElevationAxisMinorLinesSymbolButton->setLayer( coverageLayer() );
541 mDistanceAxisLabelFontButton->setLayer( coverageLayer() );
542 mElevationAxisLabelFontButton->setLayer( coverageLayer() );
543 mChartBackgroundSymbolButton->setLayer( coverageLayer() );
544 mChartBorderSymbolButton->setLayer( coverageLayer() );
545
546 if ( mProfile->layout() )
547 {
548 connect( &mProfile->layout()->reportContext(), &QgsLayoutReportContext::layerChanged, this, [=]( QgsVectorLayer *layer ) {
549 mSubsectionsSymbolButton->setLayer( layer );
550 mDistanceAxisMajorLinesSymbolButton->setLayer( layer );
551 mDistanceAxisMinorLinesSymbolButton->setLayer( layer );
552 mElevationAxisMajorLinesSymbolButton->setLayer( layer );
553 mElevationAxisMinorLinesSymbolButton->setLayer( layer );
554 mDistanceAxisLabelFontButton->setLayer( layer );
555 mElevationAxisLabelFontButton->setLayer( layer );
556 mChartBackgroundSymbolButton->setLayer( layer );
557 mChartBorderSymbolButton->setLayer( layer );
558 } );
559
560 connect( &mProfile->layout()->reportContext(), &QgsLayoutReportContext::layerChanged, this, &QgsLayoutElevationProfileWidget::atlasLayerChanged );
561 }
562
563 if ( QgsLayoutAtlas *atlas = layoutAtlas() )
564 {
565 connect( atlas, &QgsLayoutAtlas::toggled, this, &QgsLayoutElevationProfileWidget::layoutAtlasToggled );
566 layoutAtlasToggled( atlas->enabled() );
567 }
568}
569
571
573{
574 if ( mItemPropertiesWidget )
575 mItemPropertiesWidget->setMasterLayout( masterLayout );
576}
577
579{
580 return mProfile->createExpressionContext();
581}
582
588
590{
591 mCheckControlledByAtlas->setText( tr( "Controlled by %1" ).arg( string == tr( "atlas" ) ? tr( "Atlas" ) : tr( "Report" ) ) );
592}
593
595{
596 mBlockChanges++;
597
598 mProfile->setCrs( canvas->crs() );
599
600 mSpinTolerance->setValue( canvas->tolerance() );
601 mProfile->setTolerance( canvas->tolerance() );
602
603 mProfile->setDistanceUnit( canvas->distanceUnit() );
604 mDistanceUnitCombo->setCurrentIndex( mDistanceUnitCombo->findData( QVariant::fromValue( canvas->distanceUnit() ) ) );
605
606 mProfile->plot()->xAxis().setLabelSuffixPlacement( canvas->plot().xAxis().labelSuffixPlacement() );
607 mDistanceLabelsCombo->setCurrentIndex( mDistanceLabelsCombo->findData( QVariant::fromValue( canvas->plot().xAxis().labelSuffixPlacement() ) ) );
608
609 if ( const QgsCurve *curve = canvas->profileCurve() )
610 mProfile->setProfileCurve( curve->clone() );
611
612 mSpinMinDistance->setValue( canvas->plot().xMinimum() );
613 mSpinMinDistance->setClearValue( canvas->plot().xMinimum() );
614 mProfile->plot()->setXMinimum( canvas->plot().xMinimum() );
615
616 mSpinMaxDistance->setValue( canvas->plot().xMaximum() );
617 mSpinMaxDistance->setClearValue( canvas->plot().xMaximum() );
618 mProfile->plot()->setXMaximum( canvas->plot().xMaximum() );
619
620 mDistanceAxisMajorIntervalSpin->setValue( canvas->plot().xAxis().gridIntervalMajor() );
621 mDistanceAxisMajorIntervalSpin->setClearValue( canvas->plot().xAxis().gridIntervalMajor() );
622 mProfile->plot()->xAxis().setGridIntervalMajor( canvas->plot().xAxis().gridIntervalMajor() );
623
624 mDistanceAxisMinorIntervalSpin->setValue( canvas->plot().xAxis().gridIntervalMinor() );
625 mDistanceAxisMinorIntervalSpin->setClearValue( canvas->plot().xAxis().gridIntervalMinor() );
626 mProfile->plot()->xAxis().setGridIntervalMinor( canvas->plot().xAxis().gridIntervalMinor() );
627
628 mDistanceAxisLabelIntervalSpin->setValue( canvas->plot().xAxis().labelInterval() );
629 mDistanceAxisLabelIntervalSpin->setClearValue( canvas->plot().xAxis().labelInterval() );
630 mProfile->plot()->xAxis().setLabelInterval( canvas->plot().xAxis().labelInterval() );
631
632 mSpinMinElevation->setValue( canvas->plot().xMinimum() );
633 mSpinMinElevation->setClearValue( canvas->plot().yMinimum() );
634 mProfile->plot()->setYMinimum( canvas->plot().yMinimum() );
635
636 mSpinMaxElevation->setValue( canvas->plot().yMaximum() );
637 mSpinMaxElevation->setClearValue( canvas->plot().yMaximum() );
638 mProfile->plot()->setYMaximum( canvas->plot().yMaximum() );
639
640 mElevationAxisMajorIntervalSpin->setValue( canvas->plot().yAxis().gridIntervalMajor() );
641 mElevationAxisMajorIntervalSpin->setClearValue( canvas->plot().yAxis().gridIntervalMajor() );
642 mProfile->plot()->yAxis().setGridIntervalMajor( canvas->plot().yAxis().gridIntervalMajor() );
643
644 mElevationAxisMinorIntervalSpin->setValue( canvas->plot().yAxis().gridIntervalMinor() );
645 mElevationAxisMinorIntervalSpin->setClearValue( canvas->plot().yAxis().gridIntervalMinor() );
646 mProfile->plot()->yAxis().setGridIntervalMinor( canvas->plot().yAxis().gridIntervalMinor() );
647
648 mElevationAxisLabelIntervalSpin->setValue( canvas->plot().yAxis().labelInterval() );
649 mElevationAxisLabelIntervalSpin->setClearValue( canvas->plot().yAxis().labelInterval() );
650 mProfile->plot()->yAxis().setLabelInterval( canvas->plot().yAxis().labelInterval() );
651
652 const QgsLineSymbol *subSectionsSymbol = canvas->subsectionsSymbol() ? canvas->subsectionsSymbol() : nullptr;
653 const bool subSectionsEnabled = static_cast< bool >( subSectionsSymbol );
654 mSubsectionsSymbolLabel->setEnabled( subSectionsEnabled );
655 mSubsectionsSymbolButton->setEnabled( subSectionsEnabled );
656 mSubsectionsActivateCheck->setChecked( subSectionsEnabled );
657 if ( subSectionsSymbol )
658 {
659 mSubsectionsSymbolButton->setSymbol( subSectionsSymbol->clone() );
660 mProfile->setSubsectionsSymbol( subSectionsSymbol->clone() );
661 }
662
663 QList<QgsMapLayer *> canvasLayers = canvas->layers();
664 // canvas layers are in opposite direction to what the layout item requires
665 std::reverse( canvasLayers.begin(), canvasLayers.end() );
666 mProfile->setLayers( canvasLayers );
667 const QList<QgsLayerTreeLayer *> layers = mLayerTree->findLayers();
668 for ( QgsLayerTreeLayer *layer : layers )
669 {
670 layer->setItemVisibilityChecked( mProfile->layers().contains( layer->layer() ) );
671 }
672 mLayerTree->reorderGroupLayers( mProfile->layers() );
673
674 mProfile->invalidateCache();
675 mProfile->update();
676 mBlockChanges--;
677}
678
680{
682 return false;
683
684 if ( mProfile )
685 {
686 disconnect( mProfile, &QgsLayoutObject::changed, this, &QgsLayoutElevationProfileWidget::setGuiElementValues );
687 }
688
689 mProfile = qobject_cast<QgsLayoutItemElevationProfile *>( item );
690 mItemPropertiesWidget->setItem( mProfile );
691
692 if ( mProfile )
693 {
694 connect( mProfile, &QgsLayoutObject::changed, this, &QgsLayoutElevationProfileWidget::setGuiElementValues );
695 mSubsectionsSymbolButton->registerExpressionContextGenerator( mProfile );
696 mDistanceAxisMajorLinesSymbolButton->registerExpressionContextGenerator( mProfile );
697 mDistanceAxisMinorLinesSymbolButton->registerExpressionContextGenerator( mProfile );
698 mElevationAxisMajorLinesSymbolButton->registerExpressionContextGenerator( mProfile );
699 mElevationAxisMinorLinesSymbolButton->registerExpressionContextGenerator( mProfile );
700 mDistanceAxisLabelFontButton->registerExpressionContextGenerator( mProfile );
701 mElevationAxisLabelFontButton->registerExpressionContextGenerator( mProfile );
702 mChartBackgroundSymbolButton->registerExpressionContextGenerator( mProfile );
703 mChartBorderSymbolButton->registerExpressionContextGenerator( mProfile );
704 }
705
706 setGuiElementValues();
707
708 return true;
709}
710
711void QgsLayoutElevationProfileWidget::setGuiElementValues()
712{
713 mBlockChanges++;
714
715 mSpinTolerance->setValue( mProfile->tolerance() );
716 mCheckControlledByAtlas->setChecked( mProfile->atlasDriven() );
717
718 mSpinMinDistance->setValue( mProfile->plot()->xMinimum() );
719 mSpinMaxDistance->setValue( mProfile->plot()->xMaximum() );
720 mSpinMinElevation->setValue( mProfile->plot()->yMinimum() );
721 mSpinMaxElevation->setValue( mProfile->plot()->yMaximum() );
722
723 mSubsectionsActivateCheck->setChecked( mProfile->subsectionsSymbol() );
724 if ( mProfile->subsectionsSymbol() )
725 {
726 mSubsectionsSymbolButton->setSymbol( mProfile->subsectionsSymbol()->clone() );
727 }
728
729 if ( mProfile->plot()->xAxis().gridMajorSymbol() )
730 mDistanceAxisMajorLinesSymbolButton->setSymbol( mProfile->plot()->xAxis().gridMajorSymbol()->clone() );
731 if ( mProfile->plot()->xAxis().gridMinorSymbol() )
732 mDistanceAxisMinorLinesSymbolButton->setSymbol( mProfile->plot()->xAxis().gridMinorSymbol()->clone() );
733 if ( mProfile->plot()->yAxis().gridMajorSymbol() )
734 mElevationAxisMajorLinesSymbolButton->setSymbol( mProfile->plot()->yAxis().gridMajorSymbol()->clone() );
735 if ( mProfile->plot()->yAxis().gridMinorSymbol() )
736 mElevationAxisMinorLinesSymbolButton->setSymbol( mProfile->plot()->yAxis().gridMinorSymbol()->clone() );
737
738 mDistanceAxisLabelFontButton->setTextFormat( mProfile->plot()->xAxis().textFormat() );
739 mElevationAxisLabelFontButton->setTextFormat( mProfile->plot()->yAxis().textFormat() );
740
741 mDistanceUnitCombo->setCurrentIndex( mDistanceUnitCombo->findData( QVariant::fromValue( mProfile->distanceUnit() ) ) );
742 mDistanceLabelsCombo->setCurrentIndex( mDistanceLabelsCombo->findData( QVariant::fromValue( mProfile->plot()->xAxis().labelSuffixPlacement() ) ) );
743
744 mDistanceAxisMajorIntervalSpin->setValue( mProfile->plot()->xAxis().gridIntervalMajor() );
745 mDistanceAxisMinorIntervalSpin->setValue( mProfile->plot()->xAxis().gridIntervalMinor() );
746 mDistanceAxisLabelIntervalSpin->setValue( mProfile->plot()->xAxis().labelInterval() );
747
748 mElevationAxisMajorIntervalSpin->setValue( mProfile->plot()->yAxis().gridIntervalMajor() );
749 mElevationAxisMinorIntervalSpin->setValue( mProfile->plot()->yAxis().gridIntervalMinor() );
750 mElevationAxisLabelIntervalSpin->setValue( mProfile->plot()->yAxis().labelInterval() );
751
752 if ( mProfile->plot()->chartBackgroundSymbol() )
753 mChartBackgroundSymbolButton->setSymbol( mProfile->plot()->chartBackgroundSymbol()->clone() );
754 if ( mProfile->plot()->chartBorderSymbol() )
755 mChartBorderSymbolButton->setSymbol( mProfile->plot()->chartBorderSymbol()->clone() );
756
757 mSpinLeftMargin->setValue( mProfile->plot()->margins().left() );
758 mSpinRightMargin->setValue( mProfile->plot()->margins().right() );
759 mSpinTopMargin->setValue( mProfile->plot()->margins().top() );
760 mSpinBottomMargin->setValue( mProfile->plot()->margins().bottom() );
761
762 const QList<QgsLayerTreeLayer *> layers = mLayerTree->findLayers();
763 for ( QgsLayerTreeLayer *layer : layers )
764 {
765 layer->setItemVisibilityChecked( mProfile->layers().contains( layer->layer() ) );
766 }
767 mLayerTree->reorderGroupLayers( mProfile->layers() );
768
769 updateDataDefinedButton( mDDBtnTolerance );
770 updateDataDefinedButton( mDDBtnMinDistance );
771 updateDataDefinedButton( mDDBtnMaxDistance );
772 updateDataDefinedButton( mDDBtnMinElevation );
773 updateDataDefinedButton( mDDBtnMaxElevation );
774 updateDataDefinedButton( mDDBtnDistanceMajorInterval );
775 updateDataDefinedButton( mDDBtnDistanceMinorInterval );
776 updateDataDefinedButton( mDDBtnDistanceLabelInterval );
777 updateDataDefinedButton( mDDBtnElevationMajorInterval );
778 updateDataDefinedButton( mDDBtnElevationMinorInterval );
779 updateDataDefinedButton( mDDBtnElevationLabelInterval );
780 updateDataDefinedButton( mDDBtnLeftMargin );
781 updateDataDefinedButton( mDDBtnRightMargin );
782 updateDataDefinedButton( mDDBtnTopMargin );
783 updateDataDefinedButton( mDDBtnBottomMargin );
784
785 mBlockChanges--;
786}
787
788void QgsLayoutElevationProfileWidget::updateItemLayers()
789{
790 if ( mBlockChanges )
791 return;
792
793 QList<QgsMapLayer *> layers;
794 const QList<QgsMapLayer *> layerOrder = mLayerTree->layerOrder();
795 layers.reserve( layerOrder.size() );
796 for ( QgsMapLayer *layer : layerOrder )
797 {
798 if ( mLayerTree->findLayer( layer )->isVisible() )
799 layers << layer;
800 }
801
802 mProfile->setLayers( layers );
803 mProfile->update();
804}
805
806void QgsLayoutElevationProfileWidget::layoutAtlasToggled( bool atlasEnabled )
807{
808 if ( atlasEnabled && mProfile && mProfile->layout() && mProfile->layout()->reportContext().layer()
809 && mProfile->layout()->reportContext().layer()->geometryType() == Qgis::GeometryType::Line )
810 {
811 mCheckControlledByAtlas->setEnabled( true );
812 }
813 else
814 {
815 mCheckControlledByAtlas->setEnabled( false );
816 mCheckControlledByAtlas->setChecked( false );
817 }
818}
819
820void QgsLayoutElevationProfileWidget::atlasLayerChanged( QgsVectorLayer *layer )
821{
822 if ( !layer || layer->geometryType() != Qgis::GeometryType::Line )
823 {
824 //non-line layer, disable atlas control
825 mCheckControlledByAtlas->setChecked( false );
826 mCheckControlledByAtlas->setEnabled( false );
827 return;
828 }
829 else
830 {
831 mCheckControlledByAtlas->setEnabled( true );
832 }
833}
PlotAxisSuffixPlacement
Placement options for suffixes in the labels for axis of plots.
Definition qgis.h:3212
@ FirstAndLastLabels
Place suffix after the first and last label values only.
@ EveryLabel
Place suffix after every value label.
@ FirstLabel
Place suffix after the first label value only.
@ LastLabel
Place suffix after the last label value only.
@ NoLabels
Do not place suffixes.
DistanceUnit
Units of distance.
Definition qgis.h:4843
@ Feet
Imperial feet.
@ Centimeters
Centimeters.
@ Millimeters
Millimeters.
@ Miles
Terrestrial miles.
@ Yards
Imperial yards.
@ Degrees
Degrees, for planar geographic CRS distance measurements.
@ NauticalMiles
Nautical miles.
@ Kilometers
Kilometers.
@ TitleCase
Simple title case conversion - does not fully grammatically parse the text and uses simple rules only...
@ Line
Line symbol.
@ Fill
Fill symbol.
double yMaximum() const
Returns the maximum value of the y axis.
Definition qgsplot.h:383
QgsPlotAxis & xAxis()
Returns a reference to the plot's x axis.
Definition qgsplot.h:397
double xMaximum() const
Returns the maximum value of the x axis.
Definition qgsplot.h:369
double xMinimum() const
Returns the minimum value of the x axis.
Definition qgsplot.h:341
QgsPlotAxis & yAxis()
Returns a reference to the plot's y axis.
Definition qgsplot.h:411
double yMinimum() const
Returns the minimum value of the y axis.
Definition qgsplot.h:355
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
Abstract base class for curved geometry type.
Definition qgscurve.h:35
A canvas for elevation profiles.
QgsCurve * profileCurve() const
Returns the profile curve.
QgsCoordinateReferenceSystem crs() const override
Returns the coordinate reference system (CRS) for map coordinates used by the canvas.
QList< QgsMapLayer * > layers() const
Returns the list of layers included in the profile.
const Qgs2DPlot & plot() const
Returns a reference to the 2D plot used by the widget.
Qgis::DistanceUnit distanceUnit() const
Returns the distance unit used by the canvas.
double tolerance() const
Returns the tolerance of the profile (in crs() units).
QgsLineSymbol * subsectionsSymbol()
Returns the symbol used to draw the subsections.
A layer tree view for elevation profiles.
void populateInitialLayers(QgsProject *project)
Initially populates the tree view using layers from a project.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
@ ModeTextRenderer
Configure font settings for use with QgsTextRenderer.
void changed()
Emitted when the widget's text format settings are changed.
@ HigDialogTitleIsTitleCase
Dialog titles should be title case.
Definition qgsgui.h:278
static QgsGui::HigFlags higFlags()
Returns the platform's HIG flags.
Definition qgsgui.cpp:239
Layer tree node points to a map layer.
void visibilityChanged(QgsLayerTreeNode *node)
Emitted when check state of a node within the tree has been changed.
Listens to layer changes from a QgsProject and applies changes to a QgsLayerTree.
Namespace with helper functions for layer tree operations.
void layerOrderChanged()
Emitted when the layer order has changed.
Used to render QgsLayout as an atlas, by iterating over the features from an associated vector layer.
void toggled(bool enabled)
Emitted when atlas is enabled or disabled.
A common interface for layout designer dialogs and widgets.
A widget for layout elevation profile item settings.
void setReportTypeString(const QString &string) override
Sets the string to use to describe the current report type (e.g.
void copySettingsFromProfileCanvas(QgsElevationProfileCanvas *canvas)
Copies selected settings from a elevation profile canvas.
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
void setMasterLayout(QgsMasterLayoutInterface *masterLayout) override
Sets the master layout associated with the item.
bool setNewItem(QgsLayoutItem *item) override
Attempts to update the widget to show the properties for the specified item.
static std::function< void(QgsLayoutElevationProfileWidget *, QMenu *)> sBuildCopyMenuFunction
QgsLayoutElevationProfileWidget(QgsLayoutItemElevationProfile *profile)
constructor
void setDesignerInterface(QgsLayoutDesignerInterface *iface) override
Sets the the layout designer interface in which the widget is being shown.
A base class for property widgets for layout items.
void updateDataDefinedButton(QgsPropertyOverrideButton *button)
Updates a previously registered data defined button to reflect the item's current properties.
QgsVectorLayer * coverageLayer() const
Returns the current layout context coverage layer (if set).
void registerDataDefinedButton(QgsPropertyOverrideButton *button, QgsLayoutObject::DataDefinedProperty property)
Registers a data defined button, setting up its initial value, connections and description.
virtual void setDesignerInterface(QgsLayoutDesignerInterface *iface)
Sets the the layout designer interface in which the widget is being shown.
QgsLayoutAtlas * layoutAtlas() const
Returns the atlas for the layout (if available)
A layout item subclass for elevation profile plots.
A widget for controlling the common properties of layout items (e.g.
void setMasterLayout(QgsMasterLayoutInterface *masterLayout)
Sets the master layout associated with the item.
void setItem(QgsLayoutItem *item)
Sets the layout item.
@ LayoutElevationProfile
Elevation profile item.
Base class for graphical items within a QgsLayout.
@ UndoElevationProfileElevationMajorGridlines
Change elevation profile elevation axis major gridlines.
@ UndoElevationProfileMaximumDistance
Change elevation profile maximum distance.
@ UndoElevationProfileChartBackground
Change elevation profile chart background.
@ UndoElevationProfileDistanceMinorGridlines
Change elevation profile distance axis minor gridlines.
@ UndoMarginTop
Top margin.
@ UndoElevationProfileChartBorder
Change elevation profile chart border.
@ UndoElevationProfileMaximumElevation
Change elevation profile maximum elevation.
@ UndoMarginLeft
Left margin.
@ UndoMarginRight
Right margin.
@ UndoElevationProfileTolerance
Change elevation profile distance tolerance.
@ UndoElevationProfileElevationFormat
Change elevation profile elevation axis number format.
@ UndoElevationProfileMinimumElevation
Change elevation profile minimum elevation.
@ UndoElevationProfileDistanceLabels
Change elevation profile distance axis label interval.
@ UndoMarginBottom
Bottom margin.
@ UndoElevationProfileElevationFont
Change elevation profile elevation axis number font.
@ UndoElevationProfileDistanceFormat
Change elevation profile distance axis number format.
@ UndoElevationProfileElevationMinorGridlines
Change elevation profile elevation axis minor gridlines.
@ UndoElevationProfileDistanceFont
Change elevation profile distance axis number font.
@ UndoElevationProfileElevationLabels
Change elevation profile elevation axis label interval.
@ UndoElevationProfileDistanceMajorGridlines
Change elevation profile distance axis major gridlines.
@ UndoElevationProfileMinimumDistance
Change elevation profile minimum distance.
@ UndoElevationProfileSubsectionLines
Change elevation profile subsection indicator symbol.
int type() const override
Returns a unique graphics item type identifier.
void changed()
Emitted when the object's properties change.
@ ElevationProfileMaximumDistance
Maximum distance value for elevation profile.
@ ElevationProfileElevationMinorInterval
Minor grid line interval for elevation profile elevation axis.
@ ElevationProfileDistanceMinorInterval
Minor grid line interval for elevation profile distance axis.
@ ElevationProfileMinimumDistance
Minimum distance value for elevation profile.
@ ElevationProfileMaximumElevation
Maximum elevation value for elevation profile.
@ ElevationProfileDistanceLabelInterval
Label interval for elevation profile distance axis.
@ ElevationProfileTolerance
Tolerance distance for elevation profiles.
@ ElevationProfileMinimumElevation
Minimum elevation value for elevation profile.
@ ElevationProfileElevationLabelInterval
Label interval for elevation profile elevation axis.
@ ElevationProfileDistanceMajorInterval
Major grid line interval for elevation profile distance axis.
@ ElevationProfileElevationMajorInterval
Major grid line interval for elevation profile elevation axis.
void layerChanged(QgsVectorLayer *layer)
Emitted when the context's layer is changed.
A line symbol type, for rendering LineString and MultiLineString geometries.
QgsLineSymbol * clone() const override
Returns a deep copy of this symbol.
Base class for all map layer types.
Definition qgsmaplayer.h:77
Defines the four margins of a rectangle.
Definition qgsmargins.h:37
void setBottom(double bottom)
Sets the bottom margin to bottom.
Definition qgsmargins.h:113
void setLeft(double left)
Sets the left margin to left.
Definition qgsmargins.h:95
void setRight(double right)
Sets the right margin to right.
Definition qgsmargins.h:107
void setTop(double top)
Sets the top margin to top.
Definition qgsmargins.h:101
Interface for master layout type objects, such as print layouts and reports.
A widget which allows choice of numeric formats and the properties of them.
QgsNumericFormat * format() const
Returns a new format object representing the settings currently configured in the widget.
void changed()
Emitted whenever the format configured55 in the widget is changed.
void setFormat(const QgsNumericFormat *format)
Sets the format to show in the widget.
void openPanel(QgsPanelWidget *panel)
Open a panel or dialog depending on dock mode setting If dock mode is true this method will emit the ...
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.
double gridIntervalMinor() const
Returns the interval of minor grid lines for the axis.
Definition qgsplot.h:99
double gridIntervalMajor() const
Returns the interval of major grid lines for the axis.
Definition qgsplot.h:113
double labelInterval() const
Returns the interval of labels for the axis.
Definition qgsplot.h:127
Qgis::PlotAxisSuffixPlacement labelSuffixPlacement() const
Returns the placement for the axis label suffixes.
Definition qgsplot.cpp:124
static QgsFillSymbol * chartBorderSymbol()
Returns the default fill symbol to use for the chart area border.
Definition qgsplot.cpp:805
static QgsLineSymbol * axisGridMinorSymbol()
Returns the default line symbol to use for axis minor grid lines.
Definition qgsplot.cpp:792
static QgsFillSymbol * chartBackgroundSymbol()
Returns the default fill symbol to use for the chart area background fill.
Definition qgsplot.cpp:799
static QgsLineSymbol * axisGridMajorSymbol()
Returns the default line symbol to use for axis major grid lines.
Definition qgsplot.cpp:785
static std::unique_ptr< QgsLineSymbol > defaultSubSectionsSymbol()
Returns the default line symbol to use for subsections lines.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107
static QgsProject * instance()
Returns the QgsProject singleton instance.
static QString capitalize(const QString &string, Qgis::Capitalization capitalization)
Converts a string by applying capitalization rules to the string.
void changed()
Emitted when the symbol's settings are changed.
static Q_INVOKABLE QString toString(Qgis::DistanceUnit unit)
Returns a translated string representing a distance unit.
Represents a vector layer which manages a vector based dataset.
Q_INVOKABLE Qgis::GeometryType geometryType() const
Returns point, line or polygon.