Skip to content

Commit ba2f075

Browse files
committed
WIP: Implement new handle and draw length definitions
1 parent d9d8a68 commit ba2f075

38 files changed

Lines changed: 513 additions & 271 deletions

gui/CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ add_executable(
6767
source/pre/models/CommentsModel.hpp
6868
source/pre/models/DampingModel.cpp
6969
source/pre/models/DampingModel.hpp
70-
source/pre/models/DimensionsModel.cpp
71-
source/pre/models/DimensionsModel.hpp
70+
source/pre/models/DrawModel.cpp
71+
source/pre/models/DrawModel.hpp
7272
source/pre/models/LayerModel.cpp
7373
source/pre/models/LayerModel.hpp
7474
source/pre/models/LayersModel.cpp
@@ -119,8 +119,8 @@ add_executable(
119119
source/pre/views/CommentsView.hpp
120120
source/pre/views/DampingView.cpp
121121
source/pre/views/DampingView.hpp
122-
source/pre/views/DimensionsView.cpp
123-
source/pre/views/DimensionsView.hpp
122+
source/pre/views/DrawView.cpp
123+
source/pre/views/DrawView.hpp
124124
source/pre/views/docks/EditDock.cpp
125125
source/pre/views/docks/EditDock.hpp
126126
source/pre/views/docks/PlotDock.cpp
@@ -153,6 +153,8 @@ add_executable(
153153
source/pre/views/MassesView.hpp
154154
source/pre/views/ArrowMassView.cpp
155155
source/pre/views/ArrowMassView.hpp
156+
source/pre/views/DrawLengthView.cpp
157+
source/pre/views/DrawLengthView.hpp
156158
source/pre/views/MaterialView.cpp
157159
source/pre/views/MaterialView.hpp
158160
source/pre/views/primitive/ColorView.cpp

gui/source/pre/Language.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ namespace Tooltips {
2121
inline const QString MassStringTip = QStringLiteral("Additional mass(es) at the string tip (e.g. serving)");
2222
inline const QString MassLimbTip = QStringLiteral("Additional mass(es) at the limb tip (e.g. tip overlay)");
2323

24+
inline const QString DrawLengthDefinition = QStringLiteral("Select how the draw length is to be defined");
25+
inline const QString DrawLengthStandard = QStringLiteral("Draw length as measured from the pivot point of the handle");
26+
inline const QString DrawLengthAMO = QStringLiteral("Draw length as measured from the pivot point of the handle + 1.75\" according to the AMO definition");
2427

2528
inline const QString LayerMaterialSelection = QStringLiteral("Material assigned to this layer");
2629
inline const QString LayerMaterialItem = QStringLiteral("Assign \"%1\" to this layer");

gui/source/pre/Main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
Q_DECLARE_METATYPE(LayerAlignment)
1111
Q_DECLARE_METATYPE(ArrowMass)
12+
Q_DECLARE_METATYPE(DrawLength)
1213

1314
int main(int argc, char* argv[]) {
1415
QApplication::setOrganizationName(Config::ORGANIZATION_NAME);
@@ -20,6 +21,7 @@ int main(int argc, char* argv[]) {
2021

2122
qRegisterMetaType<LayerAlignment>("LayerAlignment");
2223
qRegisterMetaType<ArrowMass>("ArrowMass");
24+
qRegisterMetaType<DrawLength>("DrawLength");
2325

2426
QApplication application(argc, argv);
2527
application.installEventFilter(new KeyEventFilter());

gui/source/pre/models/DimensionsModel.cpp

Lines changed: 0 additions & 11 deletions
This file was deleted.

gui/source/pre/models/DimensionsModel.hpp

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "DrawModel.hpp"
2+
#include "solver/BowModel.hpp"
3+
4+
DrawModel::DrawModel(Draw& draw) {
5+
BRACE_HEIGHT = addDouble(draw.brace_height);
6+
DRAW_LENGTH = addCustom(draw.draw_length);
7+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#pragma once
2+
#include "pre/models/PropertyListModel.hpp"
3+
4+
struct Draw;
5+
6+
class DrawModel: public PropertyListModel {
7+
public:
8+
QPersistentModelIndex BRACE_HEIGHT;
9+
QPersistentModelIndex DRAW_LENGTH;
10+
11+
DrawModel(Draw& draw);
12+
};

gui/source/pre/models/MainModel.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "MainTreeModel.hpp"
33
#include "CommentsModel.hpp"
44
#include "SettingsModel.hpp"
5-
#include "DimensionsModel.hpp"
5+
#include "DrawModel.hpp"
66
#include "MaterialModel.hpp"
77
#include "LayerModel.hpp"
88
#include "StringModel.hpp"
@@ -121,9 +121,9 @@ SettingsModel* MainModel::getSettingsModel() {
121121
return nullptr;
122122
}
123123

124-
DimensionsModel* MainModel::getDimensionsModel() {
124+
DrawModel* MainModel::getDrawModel() {
125125
if(bow.has_value()) {
126-
auto model = new DimensionsModel(bow->dimensions);
126+
auto model = new DrawModel(bow->draw);
127127
connectSubModel(model);
128128
return model;
129129
}
@@ -250,8 +250,8 @@ TableModel* MainModel::getSplineModel(int index) {
250250
}
251251

252252
void MainModel::newFile() {
253-
// Create default bow data, which is not linked to any file yet
254-
this->bow = new_model();
253+
// Create default bow data, which is not linked to any file yet
254+
this->bow = BowModel::example();
255255
this->modelTreeSelectionModel->clearSelection(); // Needs to be done before resetting the model in order to get a selection changed signal
256256
this->mainTreeModel->setBowModel(&bow.value());
257257
this->path = "";

gui/source/pre/models/MainModel.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class MainTreeModel;
1414
class CommentsModel;
1515
class SettingsModel;
16-
class DimensionsModel;
16+
class DrawModel;
1717
class MaterialModel;
1818
class LayerModel;
1919
class StringModel;
@@ -54,7 +54,7 @@ class MainModel: public QObject {
5454

5555
CommentsModel* getCommentsModel();
5656
SettingsModel* getSettingsModel();
57-
DimensionsModel* getDimensionsModel();
57+
DrawModel* getDrawModel();
5858
MaterialModel* getMaterialModel(int index);
5959
LayerModel* getLayerModel(int index);
6060
TableModel* getLayerHeightModel(int index);

gui/source/pre/models/MainTreeModel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ QString MainTreeModel::topLevelItemName(int row) const {
547547
switch(row) {
548548
case TopLevelItem::COMMENTS: return "Comments";
549549
case TopLevelItem::SETTINGS: return "Settings";
550-
case TopLevelItem::DIMENSIONS: return "Dimensions";
550+
case TopLevelItem::DRAW: return "Draw";
551551
case TopLevelItem::MATERIALS: return "Materials";
552552
case TopLevelItem::LAYERS: return "Layers";
553553
case TopLevelItem::PROFILE: return "Profile";
@@ -563,7 +563,7 @@ QString MainTreeModel::topLevelToolTip(int row) const {
563563
switch(row) {
564564
case TopLevelItem::COMMENTS: return "Comments about this bow";
565565
case TopLevelItem::SETTINGS: return "Settings for the simulation";
566-
case TopLevelItem::DIMENSIONS: return "Brace height, draw length and handle geometry";
566+
case TopLevelItem::DRAW: return "Brace height, draw length and handle geometry";
567567
case TopLevelItem::MATERIALS: return "Materials that can be assigned to the layers";
568568
case TopLevelItem::LAYERS: return "Layers that make up the bow limbs";
569569
case TopLevelItem::PROFILE: return "Initial profile shape of the bow";
@@ -579,7 +579,7 @@ QIcon MainTreeModel::topLevelItemIcon(int row) const {
579579
switch(row) {
580580
case TopLevelItem::COMMENTS: return QIcon(":/icons/model-comments.svg");
581581
case TopLevelItem::SETTINGS: return QIcon(":/icons/model-settings.svg");
582-
case TopLevelItem::DIMENSIONS: return QIcon(":/icons/model-dimensions.svg");
582+
case TopLevelItem::DRAW: return QIcon(":/icons/model-dimensions.svg");
583583
case TopLevelItem::MATERIALS: return QIcon(":/icons/model-materials.svg");
584584
case TopLevelItem::LAYERS: return QIcon(":/icons/model-layers.svg");
585585
case TopLevelItem::PROFILE: return QIcon(":/icons/model-profile.svg");

0 commit comments

Comments
 (0)