@@ -50,7 +50,7 @@ void HeightPlotView::updatePlot() {
5050 return ;
5151 }
5252
53- xAxis-> setLabel ( " Length " + Quantities::ratio. getUnit (). getLabel ());
53+ // Y axis always shows the width in length units
5454 yAxis->setLabel (" Height " + Quantities::length.getUnit ().getLabel ());
5555
5656 graphLine->data ()->clear ();
@@ -60,41 +60,40 @@ void HeightPlotView::updatePlot() {
6060 int iLayer = index.row (); // Layer index comes from row of the model index
6161
6262 if (model->hasGeometry ()) {
63+ // If the geometry is valid, the x axis shows the length in length units
64+ xAxis->setLabel (" Length " + Quantities::length.getUnit ().getLabel ());
65+
66+ // Line
6367 for (size_t i = 0 ; i < model->getGeometry ().ratio .size (); ++i) {
6468 graphLine->addData (
65- Quantities::ratio .getUnit ().fromBase (model->getGeometry ().ratio [i]),
69+ Quantities::length .getUnit ().fromBase (model->getGeometry ().length [i]),
6670 Quantities::length.getUnit ().fromBase (model->getGeometry ().heights [i][iLayer])
6771 );
6872 }
69- }
7073
71- if (model->hasBow ()) {
74+ // Points
75+ double length = model->getGeometry ().length .back (); // Total length for scaling of the control points
7276 const Layer& layer = *std::next (model->getBow ().section .layers .begin (), iLayer);
7377 for (auto & point: layer.height ) {
7478 graphPoints->addData (
75- Quantities::ratio .getUnit ().fromBase (point[0 ]),
79+ Quantities::length .getUnit ().fromBase (length* point[0 ]),
7680 Quantities::length.getUnit ().fromBase (point[1 ])
7781 );
7882 }
7983 }
84+ else if (model->hasBow ()) {
85+ // If the geometry is invalid, the x axis shows the length in relative units, so that the control points can still be shown
86+ xAxis->setLabel (" Length " + Quantities::ratio.getUnit ().getLabel ());
8087
81- /*
82- // Control points
83- for(int i = 0; i < input.size(); ++i) {
84- if(selection.contains(i)) {
85- this->graph(2)->addData(
86- x_quantity.getUnit().fromBase(input[i][0]),
87- y_quantity.getUnit().fromBase(input[i][1])
88- );
89- }
90- else {
91- this->graph(1)->addData(
92- x_quantity.getUnit().fromBase(input[i][0]),
93- y_quantity.getUnit().fromBase(input[i][1])
88+ // Points
89+ const Layer& layer = *std::next (model->getBow ().section .layers .begin (), iLayer);
90+ for (auto & point: layer.height ) {
91+ graphPoints->addData (
92+ Quantities::ratio.getUnit ().fromBase (point[0 ]),
93+ Quantities::length.getUnit ().fromBase (point[1 ])
9494 );
9595 }
9696 }
97- */
9897
9998 this ->rescaleAxes (true , true , 1.0 , 1.05 );
10099 this ->replot ();
0 commit comments