Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuelemaz authored Dec 23, 2022
1 parent 46be2fa commit 043318c
Show file tree
Hide file tree
Showing 17 changed files with 350 additions and 143 deletions.
19 changes: 17 additions & 2 deletions diagview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ DiagView::DiagView(Context &ctx, QWidget *parent) :
ui(new Ui::DiagView)
{
ui->setupUi(this);

ui->doubleSpinBox->setDecimals(4);
ui->doubleSpinBox->setMaximum(ctx.beam.length);
ui->doubleSpinBox->setMinimum(0);

lCtx = ctx;

std::pair<std::vector<double>,std::vector<double>> xyH = ctx.getHpair();
std::pair<std::vector<double>,std::vector<double>> xyT = ctx.getTpair();
std::pair<std::vector<double>,std::vector<double>> xyM = ctx.getMpair();
Expand All @@ -24,7 +31,7 @@ DiagView::DiagView(Context &ctx, QWidget *parent) :
ui->diagHPlot->replot();
ui->diagHPlot->rescaleAxes(true);
ui->diagHPlot->xAxis->setLabel("Beam");
ui->diagHPlot->yAxis->setLabel("Shear force");
ui->diagHPlot->yAxis->setLabel("Axial force");
ui->diagHPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);

ui->diagTPlot->addGraph();
Expand All @@ -46,11 +53,19 @@ DiagView::DiagView(Context &ctx, QWidget *parent) :
ui->diagMPlot->replot();
ui->diagMPlot->rescaleAxes(true);
ui->diagMPlot->xAxis->setLabel("Beam");
ui->diagMPlot->yAxis->setLabel("Shear force");
ui->diagMPlot->yAxis->setLabel("Bending moment");
ui->diagMPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
}

DiagView::~DiagView()
{
delete ui;
}

void DiagView::on_doubleSpinBox_valueChanged(double x)
{
ui->axialIn->setText(QString::fromStdString(std::to_string(lCtx.pointH(x))));
ui->shearIn->setText(QString::fromStdString(std::to_string(lCtx.pointV(x))));
ui->momentIn->setText(QString::fromStdString(std::to_string(lCtx.pointM(x)*(-1))));
}

5 changes: 5 additions & 0 deletions diagview.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ class DiagView : public QDialog
DiagView(Context &ctx, QWidget *parent = nullptr);
~DiagView();

Context lCtx;

private slots:
void on_doubleSpinBox_valueChanged(double arg1);

private:
Ui::DiagView *ui;
};
Expand Down
128 changes: 117 additions & 11 deletions diagview.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,128 @@
<rect>
<x>0</x>
<y>0</y>
<width>1347</width>
<height>588</height>
<width>1082</width>
<height>497</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Diagrams</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCustomPlot" name="diagHPlot" native="true"/>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<widget class="QCustomPlot" name="diagHPlot" native="true">
<property name="minimumSize">
<size>
<width>350</width>
<height>350</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QCustomPlot" name="diagTPlot" native="true">
<property name="minimumSize">
<size>
<width>350</width>
<height>350</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QCustomPlot" name="diagMPlot" native="true">
<property name="minimumSize">
<size>
<width>350</width>
<height>350</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCustomPlot" name="diagTPlot" native="true"/>
</item>
<item>
<widget class="QCustomPlot" name="diagMPlot" native="true"/>
<item row="1" column="0">
<layout class="QFormLayout" name="formLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Point (distance from left)</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox">
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Axial force</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="axialIn">
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Shear force</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="shearIn">
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Bending moment</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="momentIn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
Expand Down
11 changes: 9 additions & 2 deletions distributedloaddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

#include "easydiag.h"

DistributedLoadDialog::DistributedLoadDialog(QWidget *parent) :
DistributedLoadDialog::DistributedLoadDialog(double &beamL, QWidget *parent) :
QDialog(parent),
ui(new Ui::DistributedLoadDialog)
{
ui->setupUi(this);
lbeamL = beamL;

ui->q1SpinBox->setDecimals(4);
ui->q1SpinBox->setMaximum(std::numeric_limits<double>::max());
Expand All @@ -16,7 +17,7 @@ DistributedLoadDialog::DistributedLoadDialog(QWidget *parent) :
ui->q2SpinBox->setMaximum(std::numeric_limits<double>::max());
ui->q2SpinBox->setMinimum(std::numeric_limits<double>::max()*(-1));
ui->distanceSpinBox->setDecimals(4);
ui->distanceSpinBox->setMaximum(std::numeric_limits<double>::max());
ui->distanceSpinBox->setMaximum(lbeamL);
ui->distanceSpinBox->setMinimum(0);
ui->lengthSpinBox->setDecimals(4);
ui->lengthSpinBox->setMaximum(std::numeric_limits<double>::max());
Expand All @@ -33,3 +34,9 @@ void DistributedLoadDialog::on_buttonBox_accepted()
load[0] = DistributedLoad(ui->q1SpinBox->value(),ui->q2SpinBox->value(),ui->distanceSpinBox->value(),ui->lengthSpinBox->value());
}


void DistributedLoadDialog::on_distanceSpinBox_valueChanged(double d)
{
ui->lengthSpinBox->setMaximum(lbeamL-d);
}

6 changes: 4 additions & 2 deletions distributedloaddialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ class DistributedLoadDialog : public QDialog
Q_OBJECT

public:
explicit DistributedLoadDialog(QWidget *parent = nullptr);
explicit DistributedLoadDialog(double &beamL, QWidget *parent = nullptr);
~DistributedLoadDialog();

double lbeamL;
DistributedLoad load[1];

private slots:
void on_buttonBox_accepted();

void on_distanceSpinBox_valueChanged(double arg1);

private:
Ui::DistributedLoadDialog *ui;
};
Expand Down
28 changes: 22 additions & 6 deletions distributedloaddialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>184</width>
<height>173</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -24,7 +24,11 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="q1SpinBox"/>
<widget class="QDoubleSpinBox" name="q1SpinBox">
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
Expand All @@ -34,7 +38,11 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="q2SpinBox"/>
<widget class="QDoubleSpinBox" name="q2SpinBox">
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
Expand All @@ -44,7 +52,11 @@
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="distanceSpinBox"/>
<widget class="QDoubleSpinBox" name="distanceSpinBox">
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
Expand All @@ -54,7 +66,11 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="lengthSpinBox"/>
<widget class="QDoubleSpinBox" name="lengthSpinBox">
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
</widget>
</item>
</layout>
</item>
Expand Down
1 change: 1 addition & 0 deletions easydiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ DistributedLoad::DistributedLoad(double val1, double val2, double d, double l) {
length = l;
}

Context::Context() {};
Context::Context(Beam b,
std::vector<PointLoad> v,
std::vector<PointLoad> h,
Expand Down
1 change: 1 addition & 0 deletions easydiag.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class Context {
std::vector<DistributedLoad> distributedLoads;
std::vector<PointMoment> pointMoments;
double dx = 0.0005;
Context();
Context(Beam b,
std::vector<PointLoad> v,
std::vector<PointLoad> h,
Expand Down
Loading

0 comments on commit 043318c

Please sign in to comment.