Added sim folder and skeleton atmospheric, wind, and gravity models. Cleaned up main window a little

This commit is contained in:
Travis Hunter 2023-02-11 18:41:09 -07:00
parent afb2ff85cf
commit 2d0980fdd6
9 changed files with 122 additions and 24 deletions

View File

@ -24,6 +24,7 @@ endif()
enable_testing() enable_testing()
add_subdirectory(src/gui) add_subdirectory(src/gui)
add_subdirectory(src/sim)
#find_package(wxWidgets REQUIRED gl core base) #find_package(wxWidgets REQUIRED gl core base)
#include(${wxWidgets_USE_FILE}) #include(${wxWidgets_USE_FILE})

View File

@ -41,52 +41,40 @@ MainWindowFrame::MainWindowFrame()
// Create the layout // Create the layout
// Create the splitter window, then we can add panels to it // Create the splitter window, then we can add panels to it
wxSplitterWindow* windowSplitter = new wxSplitterWindow(this, wxSplitterWindow* mainSplitter = new wxSplitterWindow(this,
wxID_ANY,
wxDefaultPosition,
wxDefaultSize,
wxSP_BORDER | wxSP_LIVE_UPDATE);
wxSplitterWindow* designSplitter = new wxSplitterWindow(mainSplitter,
wxID_ANY, wxID_ANY,
wxDefaultPosition, wxDefaultPosition,
wxDefaultSize, wxDefaultSize,
wxSP_BORDER | wxSP_LIVE_UPDATE); wxSP_BORDER | wxSP_LIVE_UPDATE);
windowSplitter->SetMinimumPaneSize(200); designSplitter->SetMinimumPaneSize(200);
//wxSplitterWindow* topSplitter = new wxSplitterWindow(this);
// NOTE, we never call delete manually on the panel since setting the parent pointer (this) // NOTE, we never call delete manually on the panel since setting the parent pointer (this)
// will put the onus on the parent to manage the resource. It'll get deleted // will put the onus on the parent to manage the resource. It'll get deleted
// when the parent gets deleted. In this case the MainWindowFrame // when the parent gets deleted. In this case the MainWindowFrame
wxPanel* rocketTreePanel = new wxPanel(windowSplitter, wxPanel* rocketTreePanel = new wxPanel(designSplitter,
wxID_ANY, wxID_ANY,
wxDefaultPosition, wxDefaultPosition,
wxSize(200, 100)); wxSize(200, 100));
rocketTreePanel->SetBackgroundColour(wxColor(100, 100, 200)); rocketTreePanel->SetBackgroundColour(wxColor(100, 100, 200));
wxPanel* rocketComponentPanel = new wxPanel(windowSplitter, wxPanel* rocketComponentPanel = new wxPanel(designSplitter,
wxID_ANY, wxID_ANY,
wxDefaultPosition, wxDefaultPosition,
wxSize(200, 100)); wxSize(200, 100));
rocketComponentPanel->SetBackgroundColour(wxColor(200, 100, 100)); rocketComponentPanel->SetBackgroundColour(wxColor(200, 100, 100));
windowSplitter->SplitVertically(rocketTreePanel, rocketComponentPanel); designSplitter->SplitVertically(rocketTreePanel, rocketComponentPanel);
/*
wxSizer* rocketDesignSizer = new wxBoxSizer(wxHORIZONTAL);
rocketDesignSizer->Add(rocketTreePanel, 1, wxEXPAND | wxRIGHT, 2);
rocketDesignSizer->Add(rocketComponentPanel, 1, wxEXPAND);
*/
/* wxPanel* rocketVisPanel = new wxPanel(mainSplitter, wxID_ANY);
wxPanel* rocketVisPanel = new wxPanel(this, wxID_ANY);
rocketVisPanel->SetBackgroundColour(wxColor(100, 200, 100)); rocketVisPanel->SetBackgroundColour(wxColor(100, 200, 100));
*/
// wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
// mainSizer->Add(rocketDesignSizer, 2, wxEXPAND | wxALL, 2);
// mainSizer->Add(rocketVisPanel, 1, wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT, 2);
// this->SetSizerAndFit(mainSizer);
/*
SetSizer(mainSizer);
wxTextCtrl* firstNameBox = new wxTextCtrl(this, wxID_ANY);
mainSizer->Add(firstNameBox, 1, wxEXPAND);
*/
mainSplitter->SplitHorizontally(designSplitter, rocketVisPanel);
Bind(wxEVT_MENU, &MainWindowFrame::onAbout, this, wxID_ABOUT); Bind(wxEVT_MENU, &MainWindowFrame::onAbout, this, wxID_ABOUT);
Bind(wxEVT_MENU, &MainWindowFrame::onExit, this, wxID_EXIT); Bind(wxEVT_MENU, &MainWindowFrame::onExit, this, wxID_EXIT);

View File

@ -0,0 +1,14 @@
#include "AtmosphericModel.h"
namespace sim
{
AtmosphericModel::AtmosphericModel()
{
}
AtmosphericModel::~AtmosphericModel()
{
}
} // namespace sim

View File

@ -0,0 +1,17 @@
#ifndef SIM_ATMOSPHERICMODEL_H
#define SIM_ATMOSPHERICMODEL_H
namespace sim
{
class AtmosphericModel
{
public:
AtmosphericModel();
virtual ~AtmosphericModel();
virtual double getDensity(double altitude) = 0;
};
} // namespace sim
#endif // SIM_ATMOSPHERICMODEL_H

5
src/sim/CMakeLists.txt Normal file
View File

@ -0,0 +1,5 @@
add_library(sim
AtmosphericModel.cpp
GravityModel.cpp
WindModel.cpp)

14
src/sim/GravityModel.cpp Normal file
View File

@ -0,0 +1,14 @@
#include "GravityModel.h"
namespace sim
{
GravityModel::GravityModel()
{
}
GravityModel::~GravityModel()
{
}
} // namespace sim

19
src/sim/GravityModel.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef SIM_GRAVITYMODEL_H
#define SIM_GRAVITYMODEL_H
#include <tuple>
namespace sim
{
class GravityModel
{
public:
GravityModel();
virtual ~GravityModel();
virtual std::tuple<double, double, double> getAccel(double x, double y, double z) = 0;
};
} // namespace sim
#endif // SIM_GRAVITYMODEL_H

19
src/sim/WindModel.cpp Normal file
View File

@ -0,0 +1,19 @@
#include "WindModel.h"
namespace sim
{
WindModel::WindModel()
{
}
WindModel::~WindModel()
{
}
std::tuple<double, double, double> WindModel::getWindSpeed(double x, double y, double z)
{
return std::make_tuple<double, double, double>(0.0, 0.0, 0.0);
}
} // namespace sim

21
src/sim/WindModel.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef SIM_WINDMODEL_H
#define SIM_WINDMODEL_H
#include <tuple>
namespace sim
{
class WindModel
{
public:
WindModel();
virtual ~WindModel();
virtual std::tuple<double, double, double> getWindSpeed(double x, double y, double z);
};
} // namespace sim
#endif // SIM_WINDMODEL_H