Commit 93abbb3a authored by Aaron Bray's avatar Aaron Bray

Merge 3 branchs ['unc/enviornment', 'unc/DataRequests',...

Merge 3 branchs ['unc/enviornment', 'unc/DataRequests', 'unc/idata_request_selection'] into unc/comp_523
parents fcfa3023 720a2f2a
......@@ -87,6 +87,8 @@ set(moc_sources
controls/ScenarioEditorWidget.h
controls/PlotSetWidget.h
controls/EnviornmentWidget.h
conditions/ConditionWidget.h
conditions/ChronicAnemiaWidget.h
conditions/ChronicObstructivePulmonaryDiseaseWidget.h
......@@ -111,6 +113,7 @@ set(UI_FILES
ui/DataRequestView.ui
ui/DynamicControls.ui
ui/Enviornment.ui
ui/ConditionsEditor.ui
ui/Condition.ui
......@@ -162,6 +165,9 @@ set(CONTROLS_FILES
controls/DataRequestViewWidget.h
controls/VitalsMonitorWidget.cxx
controls/VitalsMonitorWidget.h
controls/EnviornmentWidget.cxx
controls/EnviornmentWidget.h
)
source_group("Controls" FILES ${CONTROLS_FILES})
list(APPEND SOURCE ${CONTROLS_FILES})
......@@ -371,11 +377,35 @@ set(CPACK_PACKAGE_VERSION "${EXPLORER_VERSION}")
#set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/pulse_logo.png")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/AirDensity.jpeg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/AirPressure.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Blanket.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Clothing.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Emissivity.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Fan.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Heater.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Humidity.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/RadiantTemp.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Submerged.jpeg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Temp.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Wind.jpg")
#set(CPACK_DMG_DS_STORE "${CMAKE_CURRENT_SOURCE_DIR}/packaging/DS_Store")
if(APPLE)
set(CPACK_BUNDLE_STARTUP_COMMAND PulseExplorer)
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/pulse_logo.png")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/AirDensity.jpeg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/AirPressure.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Blanket.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Clothing.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Emissivity.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Fan.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Heater.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Humidity.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/RadiantTemp.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Submerged.jpeg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Temp.jpg")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resource/Wind.jpg")
set(CPACK_BUNDLE_ICON pulse.icns)
set(MACOSX_BUNDLE_ICON_FILE pulse.icns)
set(MACOSX_BUNDLE_BUNDLE_VERSION "${EXPLORER_VERSION}")
......
......@@ -18,7 +18,7 @@ public:
QChronicAnemiaWidget::QChronicAnemiaWidget(QWidget *parent, Qt::WindowFlags flags) : QConditionWidget(parent, flags)
{
m_Controls = new Controls();
m_Controls->ReductionFactor = new QScalarWidget("Reduction Factor", 0, 1, 0.1, false, this);
m_Controls->ReductionFactor = new QScalarWidget("Reduction Factor", 0, 1, 0.1, ScalarOptionWidget::None, this);
layout()->addWidget(m_Controls->ReductionFactor);
reset();
}
......
......@@ -19,8 +19,8 @@ public:
QChronicObstructivePulmonaryDiseaseWidget::QChronicObstructivePulmonaryDiseaseWidget(QWidget *parent, Qt::WindowFlags flags) : QConditionWidget(parent,flags)
{
m_Controls = new Controls();
m_Controls->BronchitisSeverity = new QScalarWidget("Bronchitis Severity", 0, 1, 0.1, false, this);
m_Controls->EmphysemaSeverity = new QScalarWidget("Emphysema Severity", 0, 1, 0.1, false, this);
m_Controls->BronchitisSeverity = new QScalarWidget("Bronchitis Severity", 0, 1, 0.1, ScalarOptionWidget::None, this);
m_Controls->EmphysemaSeverity = new QScalarWidget("Emphysema Severity", 0, 1, 0.1, ScalarOptionWidget::None, this);
layout()->addWidget(m_Controls->BronchitisSeverity);
layout()->addWidget(m_Controls->EmphysemaSeverity);
reset();
......
......@@ -22,7 +22,7 @@ public:
QChronicPericardialEffusionWidget::QChronicPericardialEffusionWidget(QWidget *parent, Qt::WindowFlags flags) : QConditionWidget(parent,flags)
{
m_Controls = new Controls();
m_Controls->AccumulatedVolume = new QScalarQuantityWidget<VolumeUnit>("Accumulated Volume", 0, 1000, 1, VolumeUnit::mL, false, this);
m_Controls->AccumulatedVolume = new QScalarQuantityWidget<VolumeUnit>("Accumulated Volume", 0, 1000, 1, VolumeUnit::mL, ScalarOptionWidget::None, this);
m_Controls->AccumulatedVolume->addUnit(VolumeUnit::L);
layout()->addWidget(m_Controls->AccumulatedVolume);
reset();
......
......@@ -19,8 +19,8 @@ public:
QChronicRenalStenosisWidget::QChronicRenalStenosisWidget(QWidget *parent, Qt::WindowFlags flags) : QConditionWidget(parent,flags)
{
m_Controls = new Controls();
m_Controls->LeftKidneySeverity = new QScalarWidget("Left Kidney Severity", 0, 1, 0.1, false, this);
m_Controls->RightKidneySeverity = new QScalarWidget("Right Kidney Severity", 0, 1, 0.1, false, this);
m_Controls->LeftKidneySeverity = new QScalarWidget("Left Kidney Severity", 0, 1, 0.1, ScalarOptionWidget::None, this);
m_Controls->RightKidneySeverity = new QScalarWidget("Right Kidney Severity", 0, 1, 0.1, ScalarOptionWidget::None, this);
layout()->addWidget(m_Controls->LeftKidneySeverity);
layout()->addWidget(m_Controls->RightKidneySeverity);
reset();
......
......@@ -21,9 +21,9 @@ public:
QImpairedAlveolarExchangeWidget::QImpairedAlveolarExchangeWidget(QWidget *parent, Qt::WindowFlags flags) : QConditionWidget(parent,flags)
{
m_Controls = new Controls();
m_Controls->ImpairedFraction = new QScalarWidget("Impaired Fraction", 0, 1, 0.1, false, this);
m_Controls->ImpairedFraction = new QScalarWidget("Impaired Fraction", 0, 1, 0.1, ScalarOptionWidget::None, this);
layout()->addWidget(m_Controls->ImpairedFraction);
m_Controls->ImpairedSurfaceArea = new QScalarQuantityWidget<AreaUnit>("Impaired Surface Area", 0, 100, 1, AreaUnit::m2, false, this);
m_Controls->ImpairedSurfaceArea = new QScalarQuantityWidget<AreaUnit>("Impaired Surface Area", 0, 100, 1, AreaUnit::m2, ScalarOptionWidget::None, this);
m_Controls->ImpairedSurfaceArea->addUnit(AreaUnit::cm2);
layout()->addWidget(m_Controls->ImpairedSurfaceArea);
reset();
......
......@@ -20,9 +20,9 @@ public:
QLobarPneumoniaWidget::QLobarPneumoniaWidget(QWidget *parent, Qt::WindowFlags flags) : QConditionWidget(parent,flags)
{
m_Controls = new Controls();
m_Controls->Severity = new QScalarWidget("Severity", 0, 1, 0.1, false, this);
m_Controls->LeftLungAffected = new QScalarWidget("Left Lung Affected", 0, 1, 0.1, false, this);
m_Controls->RightLungAffected = new QScalarWidget("Right Lung Affected", 0, 1, 0.1, false, this);
m_Controls->Severity = new QScalarWidget("Severity", 0, 1, 0.1, ScalarOptionWidget::None, this);
m_Controls->LeftLungAffected = new QScalarWidget("Left Lung Affected", 0, 1, 0.1, ScalarOptionWidget::None, this);
m_Controls->RightLungAffected = new QScalarWidget("Right Lung Affected", 0, 1, 0.1, ScalarOptionWidget::None, this);
layout()->addWidget(m_Controls->Severity);
layout()->addWidget(m_Controls->LeftLungAffected);
layout()->addWidget(m_Controls->RightLungAffected);
......
/* Distributed under the Apache License, Version 2.0.
See accompanying NOTICE file for details.*/
#include <QApplication>
#include <QDockWidget>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QLayout>
#include <QMainWindow>
#include <QWidget>
#include <QPlainTextEdit>
#include <QFile>
#include <QDoubleSpinBox>
#include <QGroupBox>
#include <QScrollBar>
#include <QTimer>
#include <QThread>
#include <QPointer>
#include <QtCharts/QChart>
#include <QtCharts/QChartView>
#include <QtCharts/QLineSeries>
#include <QtCharts/QValueAxis>
#include <QCloseEvent>
#include <QMessageBox>
#include "cdm/CommonDataModel.h"
#include "cdm/utils/FileUtils.h"
#ifdef PARAVIEW
#include <pqActiveObjects.h>
#include <pqAlwaysConnectedBehavior.h>
#include <pqApplicationCore.h>
#include <pqObjectBuilder.h>
#include <pqPersistentMainWindowStateBehavior.h>
#include <pqContextView.h>
#include <pqXYChartView.h>
#include <pqRenderView.h>
#include <vtkSMProxy.h>
#include <vtkSMPropertyHelper.h>
#include <vtkSMReaderFactory.h>
#include "GeometryView.h"
#endif
#include "AddPopup.h"
#include "ui_AddPopup.h"
#include "ExplorerIntroWidget.h"
#include "ui_AddPopup.h"
#include "DataRequestsWidget.h"
#include "VitalsMonitorWidget.h"
#include "DynamicControlsWidget.h"
#include "EnviornmentWidget.h"
#include "cdm/CommonDataModel.h"
#include "PulsePhysiologyEngine.h"
#include "cdm/engine/SEDataRequestManager.h"
#include "cdm/engine/SEEngineTracker.h"
#include "cdm/properties/SEScalarTime.h"
class AddPopup::Controls : public Ui::AddPopup
{
public:
virtual ~Controls()
{
}
#ifdef PARAVIEW
QPointer<GeometryView> GeometryView;
pqRenderView* ParaViewRenderView;
#endif
QPulse* Pulse = nullptr;
QPointer<QThread> Thread;
std::stringstream Status;
double CurrentSimTime_s;
InputMode Mode = InputMode::None;
QEnviornmentWidget* envir;
};
AddPopup::AddPopup(std::string name,QWidget *parent):QDialog(parent),Ui(new Ui::AddPopup)
{
QEnviornmentWidget* envir = dynamic_cast<QEnviornmentWidget*> (parent);
m_Controls = new Controls();
m_Controls->setupUi(this);
setWindowIcon(QIcon("resource/pulse.ico"));
QFont f("Arial", 18);
m_Controls->label->setFont(f);
m_Controls->label->setText(QString::fromUtf8(name.c_str()));
if (name == "Add Gases") {
m_Controls->Substance->addItem(QString("Oxygen"));
m_Controls->Substance->addItem(QString("Nitrogen"));
m_Controls->Substance->addItem(QString("Hydrogen"));
m_Controls->Substance->addItem(QString("Argon"));
m_Controls->Substance->addItem(QString("Carbon Dioxide"));
}
else {
m_Controls->Substance->addItem(QString("Dust"));
m_Controls->Substance->addItem(QString("Forest Exudates"));
m_Controls->Substance->addItem(QString("Geyesr Steam"));
m_Controls->Substance->addItem(QString("Smoke"));
m_Controls->Substance->addItem(QString("Particulates"));
}
connect(m_Controls->Add, SIGNAL(clicked()), this, SLOT(add()));
}
AddPopup::~AddPopup()
{
delete m_Controls;
}
void AddPopup::add() {
if (m_Controls->label->text() == "Add Gases") {
emit insertG(m_Controls->Substance->currentText(), m_Controls->Amount->value());
hide();
}
else {
emit insertA(m_Controls->Substance->currentText(), m_Controls->Amount->value());
hide();
}
}
/* Distributed under the Apache License, Version 2.0.
See accompanying NOTICE file for details.*/
#ifndef AddPopup_H
#define AddPopup_H
#include <qdialog.h>
#include <QMainWindow>
#include <QObject>
#include "QPulse.h"
namespace Ui {
class AddPopup;
}
class AddPopup : public QDialog
{
Q_OBJECT
public:
explicit AddPopup(std::string name,QWidget * parent = nullptr);
virtual ~AddPopup();
Ui::AddPopup *Ui;
//protected:
signals:
void insertG(QString substance, double amount);
signals:
void insertA(QString substance, double amount);
protected slots:
void add();
private:
class Controls;
Controls* m_Controls;
};
#endif // AddPopup_H
......@@ -42,11 +42,14 @@ QDataRequestViewWidget::~QDataRequestViewWidget()
void QDataRequestViewWidget::Reset()
{
QMdiSubWindow* item;
while ((item = m_Controls->mdiArea->subWindowList().takeAt(0)) != nullptr)
if (m_Controls->mdiArea->subWindowList().size() > 0)
{
QPlotSetWidget* plotSet = (QPlotSetWidget*)item->widget();
plotSet->Reset();
m_Controls->mdiArea->subWindowList().removeAt(0);
while ((item = m_Controls->mdiArea->subWindowList().takeAt(0)) != nullptr)
{
QPlotSetWidget* plotSet = (QPlotSetWidget*)item->widget();
plotSet->Reset();
m_Controls->mdiArea->subWindowList().removeAt(0);
}
}
m_Controls->TileButton->setEnabled(false);
m_Controls->NewPlotSetButton->setEnabled(false);
......
/* Distributed under the Apache License, Version 2.0.
See accompanying NOTICE file for details.*/
#include "EnviornmentWidget.h"
#include "ui_Enviornment.h"
#include <QLayout>
#include <QGroupBox.h>
#include <QFileDialog>
#include <qmessagebox.h>
#include "EnviornmentWidget.h"
#include "AddPopup.h"
#include "cdm/CommonDataModel.h"
#include "PulsePhysiologyEngine.h"
#include "substance/SESubstance.h"
#include "substance/SESubstanceManager.h"
#include "substance/SESubstanceFraction.h"
#include "substance/SESubstanceConcentration.h"
#include "system/environment/SEEnvironment.h"
#include "system/environment/SEEnvironmentalConditions.h"
#include "system/environment/SEActiveConditioning.h"
#include "system/environment/SEAppliedTemperature.h"
#include "system/environment/actions/SEThermalApplication.h"
#include "system/environment/actions/SEChangeEnvironmentConditions.h"
#include "controls/ScalarWidget.h"
#include "controls/ScalarQuantityWidget.h"
#include "cdm/utils/FileUtils.h"
#include "cdm/CommonDataModel.h"
#include "cdm/PhysiologyEngine.h"
#include "cdm/utils/FileUtils.h"
#include "cdm/engine/SEPatientConfiguration.h"
#include "cdm/patient/SEPatient.h"
#include "cdm/properties/SEScalar0To1.h"
#include "cdm/properties/SEScalarArea.h"
#include "cdm/properties/SEScalarFrequency.h"
#include "cdm/properties/SEScalarLength.h"
#include "cdm/properties/SEScalarMass.h"
#include "cdm/properties/SEScalarMassPerVolume.h"
#include "cdm/properties/SEScalarPower.h"
#include "cdm/properties/SEScalarPressure.h"
#include "cdm/properties/SEScalarTime.h"
#include "cdm/properties/SEScalarVolume.h"
#include "cdm/properties/SEScalarHeatResistanceArea.h"
#include "cdm/properties/SEScalarLengthPerTime.h"
#include "cdm/properties/SEScalarTemperature.h"
#include "cdm/properties/SEScalarPower.h"
class QEnviornmentWidget::Controls : public Ui::EnviornmentWidget
{
public:
Controls(QTextEdit& log) : LogBox(log) {}
QTextEdit& LogBox;
std::string type = "Enviornment";
// Environmental Conditions
QScalarQuantityWidget<MassPerVolumeUnit>* AirDensity;
QScalarQuantityWidget<LengthPerTimeUnit>* AirVelocity;
QScalarQuantityWidget<TemperatureUnit>* AmbientTemperature;
QScalarQuantityWidget<PressureUnit>* AtmosphericPressure;
QScalarQuantityWidget<HeatResistanceAreaUnit>* ClothingResistance;
QScalarWidget* Emissivity;
QScalarQuantityWidget<TemperatureUnit>* MeanRadiantTemperature;
QScalarWidget* RelativeHumidity;
QScalarQuantityWidget<TemperatureUnit>* RespirationAmbientTemperature;
// Eventually, These should be dynamic based on a list of substances
SESubstance* O2;
SESubstance* CO2;
SESubstance* N2;
SESubstance* CO;
QScalarWidget* AmbientO2;
QScalarWidget* AmbientCO2;
QScalarWidget* AmbientN2;
QScalarWidget* AmbientCO;
SEScalar0To1 invalidFraction;
// And we should add the ability to add new particulate definitions
SESubstance* Smoke;
QScalarQuantityWidget<MassPerVolumeUnit>* AmbientSmoke;
SEScalarMassPerVolume invalidConcentration;
QScalarQuantityWidget<PowerUnit>* CoolingPower;
QScalarWidget* CoolingFraction;
QScalarQuantityWidget<AreaUnit>* CoolingArea;
QScalarQuantityWidget<PowerUnit>* HeatingPower;
QScalarWidget* HeatingFraction;
QScalarQuantityWidget<AreaUnit>* HeatingArea;
QScalarWidget* AppliedFraction;
QScalarQuantityWidget<TemperatureUnit>* AppliedTemperature;
QScalarQuantityWidget<AreaUnit>* AppliedArea;
SEThermalApplication* ThermalApplication;
SEChangeEnvironmentConditions* EnvironmentalConditions;
bool sendEnvironment = false;
bool sendAction = false;
bool CoolingFracLast = false;
bool HeatingFracLast = false;
bool AppliedFracLast = false;
bool applied = false;
};
QEnviornmentWidget::QEnviornmentWidget(QPulse& qp, QWidget *parent, Qt::WindowFlags flags) : QDockWidget(parent,flags)
{
m_Controls = new Controls(qp.GetLogBox());
m_Controls->setupUi(this);
////////////////////////////////////
// Setup Environmental Conditions //
////////////////////////////////////
m_Controls->AirDensity = new QScalarQuantityWidget<MassPerVolumeUnit>("Air Density", 0.0, 10.0, 1, MassPerVolumeUnit::g_Per_L, ScalarOptionWidget::Check, this);
m_Controls->AirDensity->enableConverter(true);
m_Controls->AirDensity->enableInput(true);
m_Controls->AirDensity->addUnit(MassPerVolumeUnit::g_Per_m3);
m_Controls->ConditionsProperties->layout()->addWidget(m_Controls->AirDensity);
m_Controls->AirVelocity = new QScalarQuantityWidget<LengthPerTimeUnit>("Air Velocity", 0.0, 30.0, 1, LengthPerTimeUnit::ft_Per_s, ScalarOptionWidget::Check, this);
m_Controls->AirVelocity->enableConverter(true);
m_Controls->AirVelocity->enableInput(true);
m_Controls->AirVelocity->addUnit(LengthPerTimeUnit::m_Per_s);
m_Controls->ConditionsProperties->layout()->addWidget(m_Controls->AirVelocity);
m_Controls->AmbientTemperature = new QScalarQuantityWidget<TemperatureUnit>("Ambient Temperature", 0.0, 150.0, 1, TemperatureUnit::F, ScalarOptionWidget::Check, this);
m_Controls->AmbientTemperature->enableConverter(true);
m_Controls->AmbientTemperature->enableInput(true);
m_Controls->AmbientTemperature->addUnit(TemperatureUnit::C);
m_Controls->ConditionsProperties->layout()->addWidget(m_Controls->AmbientTemperature);
m_Controls->AtmosphericPressure = new QScalarQuantityWidget<PressureUnit>("Atmospheric Pressure", 0.0, 100.0, 1, PressureUnit::psi, ScalarOptionWidget::Check, this);
m_Controls->AtmosphericPressure->enableConverter(true);
m_Controls->AtmosphericPressure->enableInput(true);
m_Controls->AtmosphericPressure->addUnit(PressureUnit::mmHg);
m_Controls->AtmosphericPressure->addUnit(PressureUnit::Pa);
m_Controls->ConditionsProperties->layout()->addWidget(m_Controls->AtmosphericPressure);
m_Controls->ClothingResistance = new QScalarQuantityWidget<HeatResistanceAreaUnit>("Clothing Resistance", 0, 65, 1, HeatResistanceAreaUnit::clo, ScalarOptionWidget::Check, this);
m_Controls->ClothingResistance->enableConverter(true);
m_Controls->ClothingResistance->enableInput(true);
m_Controls->ClothingResistance->addUnit(HeatResistanceAreaUnit::clo);
m_Controls->ClothingResistance->addUnit(HeatResistanceAreaUnit::rsi);
m_Controls->ConditionsProperties->layout()->addWidget(m_Controls->ClothingResistance);
m_Controls->Emissivity = new QScalarWidget("Emissivity", 0.0, 1.0, .1, ScalarOptionWidget::Check, this);
m_Controls->Emissivity->enableInput(true);
m_Controls->ConditionsProperties->layout()->addWidget(m_Controls->Emissivity);
m_Controls->MeanRadiantTemperature = new QScalarQuantityWidget<TemperatureUnit>("Mean Radiant Temperature", 0.0, 150.0, 1, TemperatureUnit::F, ScalarOptionWidget::Check, this);
m_Controls->MeanRadiantTemperature->enableConverter(true);
m_Controls->MeanRadiantTemperature->enableInput(true);
m_Controls->MeanRadiantTemperature->addUnit(TemperatureUnit::C);
m_Controls->ConditionsProperties->layout()->addWidget(m_Controls->MeanRadiantTemperature);
m_Controls->RelativeHumidity = new QScalarWidget("Relative Humidity", 0.0, 1.0, 0.1, ScalarOptionWidget::Check, this);
m_Controls->RelativeHumidity->enableInput(true);
m_Controls->ConditionsProperties->layout()->addWidget(m_Controls->RelativeHumidity);
m_Controls->RespirationAmbientTemperature = new QScalarQuantityWidget<TemperatureUnit>("Respiration Ambient Temperature", 0.0, 150.0, 1, TemperatureUnit::F, ScalarOptionWidget::Check, this);
m_Controls->RespirationAmbientTemperature->enableConverter(true);
m_Controls->RespirationAmbientTemperature->enableInput(true);
m_Controls->RespirationAmbientTemperature->addUnit(TemperatureUnit::C);
m_Controls->RespirationAmbientTemperature->addUnit(TemperatureUnit::F);
m_Controls->RespirationAmbientTemperature->addUnit(TemperatureUnit::K);
m_Controls->ConditionsProperties->layout()->addWidget(m_Controls->RespirationAmbientTemperature);
////////////////////////////////////////////////
// Ambient Environment Gasses and Particulate //
////////////////////////////////////////////////
m_Controls->O2 = qp.GetEngine().GetSubstanceManager().GetSubstance("Oxygen");
m_Controls->AmbientO2 = new QScalarWidget("Oxygen", 0.0, 1.0, 0.1, ScalarOptionWidget::Check, this);
m_Controls->AmbientO2->setDecimals(5);
m_Controls->AmbientO2->enableInput(true);
m_Controls->AmbientGasses->layout()->addWidget(m_Controls->AmbientO2);
m_Controls->CO2 = qp.GetEngine().GetSubstanceManager().GetSubstance("CarbonDioxide");
m_Controls->AmbientCO2 = new QScalarWidget("Carbon Dioxide", 0.0, 1.0, 0.1, ScalarOptionWidget::Check, this);
m_Controls->AmbientCO2->setDecimals(5);
m_Controls->AmbientCO2->enableInput(true);
m_Controls->AmbientGasses->layout()->addWidget(m_Controls->AmbientCO2);
m_Controls->N2 = qp.GetEngine().GetSubstanceManager().GetSubstance("Nitrogen");
m_Controls->AmbientN2 = new QScalarWidget("Nitrogen", 0.0, 1.0, 0.1, ScalarOptionWidget::Check, this);
m_Controls->AmbientN2->setDecimals(5);
m_Controls->AmbientN2->enableInput(true);
m_Controls->AmbientGasses->layout()->addWidget(m_Controls->AmbientN2);
m_Controls->CO = qp.GetEngine().GetSubstanceManager().GetSubstance("CarbonMonoxide");
m_Controls->AmbientCO = new QScalarWidget("Carbon Monoxide", 0.0, 1.0, 0.1, ScalarOptionWidget::Check, this);
m_Controls->AmbientCO->setDecimals(5);
m_Controls->AmbientCO->enableInput(true);
m_Controls->AmbientGasses->layout()->addWidget(m_Controls->AmbientCO);
m_Controls->Smoke = qp.GetEngine().GetSubstanceManager().GetSubstance("ForestFireParticulate");
m_Controls->AmbientSmoke = new QScalarQuantityWidget<MassPerVolumeUnit>("Smoke", 0.0, 1.0, 0.1, MassPerVolumeUnit::mg_Per_m3, ScalarOptionWidget::Check, this);
m_Controls->AmbientSmoke->enableInput(true);
m_Controls->AmbientSmoke->enableConverter(true);
m_Controls->AmbientSmoke->addUnit(MassPerVolumeUnit::g_Per_mL);
m_Controls->AmbientSmoke->addUnit(MassPerVolumeUnit::g_Per_L);
m_Controls->AmbientAerosols->layout()->addWidget(m_Controls->AmbientSmoke);
///////////////////////////////
// Setup Environment Actions //
///////////////////////////////
m_Controls->ActiveCoolingCheck->setChecked(false);
m_Controls->ActiveCoolingCheck->setEnabled(false);
m_Controls->CoolingPower = new QScalarQuantityWidget<PowerUnit>("Power", 0.0, 150.0, 1, PowerUnit::J_Per_s, ScalarOptionWidget::None, this);
m_Controls->CoolingPower->setDisabled(true);
m_Controls->CoolingPower->addUnit(PowerUnit::kcal_Per_hr);
m_Controls->CoolingPower->addUnit(PowerUnit::BTU_Per_hr);
m_Controls->CoolingPower->addUnit(PowerUnit::W);
m_Controls->ActiveCoolingWidget->layout()->addWidget(m_Controls->CoolingPower);
m_Controls->CoolingFraction = new QScalarWidget("Surface Area Fraction", 0.0, 1.0, 0.1, ScalarOptionWidget::Radio, this);
m_Controls->CoolingFraction->setDisabled(true);
m_Controls->ActiveCoolingWidget->layout()->addWidget(m_Controls->CoolingFraction);
m_Controls->CoolingArea = new QScalarQuantityWidget<AreaUnit>("Surface Area", 0.0, 150.0, 1, AreaUnit::m2, ScalarOptionWidget::Radio, this);
m_Controls->CoolingArea->setDisabled(true);
m_Controls->CoolingArea->addUnit(AreaUnit::cm2);
m_Controls->ActiveCoolingWidget->layout()->addWidget(m_Controls->CoolingArea);
// Connect Signals/Slots
connect(m_Controls->ActiveCoolingCheck, SIGNAL(clicked()), this, SLOT(EnableCooling()));
connect(m_Controls->CoolingFraction->getRadioButton(), SIGNAL(clicked()), this, SLOT(EnableCoolingSurfaceAreaFraction()));
connect(m_Controls->CoolingArea->getRadioButton(), SIGNAL(clicked()), this, SLOT(EnableCoolingSurfaceArea()));
m_Controls->CoolingPower->enableConverter(true);
m_Controls->CoolingArea->enableConverter(true);
m_Controls->ActiveHeatingCheck->setChecked(false);
m_Controls->ActiveHeatingCheck->setEnabled(false);
m_Controls->HeatingPower = new QScalarQuantityWidget<PowerUnit>("Power", 0.0, 150.0, 1, PowerUnit::J_Per_s, ScalarOptionWidget::None, this);
m_Controls->HeatingPower->setDisabled(true);
m_Controls->HeatingPower->addUnit(PowerUnit::kcal_Per_hr);
m_Controls->HeatingPower->addUnit(PowerUnit::BTU_Per_hr);
m_Controls->HeatingPower->addUnit(PowerUnit::W);
m_Controls->ActiveHeatingWidget->layout()->addWidget(m_Controls->HeatingPower);
m_Controls->HeatingFraction = new QScalarWidget("Surface Area Fraction", 0.0, 1.0, 0.1, ScalarOptionWidget::Radio, this);
m_Controls->HeatingFraction->setDisabled(true);
m_Controls->ActiveHeatingWidget->layout()->addWidget(m_Controls->HeatingFraction);
m_Controls->HeatingArea = new QScalarQuantityWidget<AreaUnit>("Surface Area", 0.0, 150.0, 1, AreaUnit::m2, ScalarOptionWidget::Radio, this);
m_Controls->HeatingArea->setDisabled(true);
m_Controls->HeatingArea->addUnit(AreaUnit::cm2);
m_Controls->ActiveHeatingWidget->layout()->addWidget(m_Controls->HeatingArea);
// Connect Signals/Slots
connect(m_Controls->ActiveHeatingCheck, SIGNAL(clicked()), this, SLOT(EnableHeating()));
connect(m_Controls->HeatingFraction->getRadioButton(), SIGNAL(clicked()), this, SLOT(EnableHeatingSurfaceAreaFraction()));
connect(m_Controls->HeatingArea->getRadioButton(), SIGNAL(clicked()), this, SLOT(EnableHeatingSurfaceArea()));
m_Controls->HeatingPower->enableConverter(true);
m_Controls->HeatingArea->enableConverter(true);
m_Controls->AppliedTempCheck->setChecked(false);
m_Controls->AppliedTempCheck->setEnabled(false);
m_Controls->AppliedTemperature = new QScalarQuantityWidget<TemperatureUnit>("Temperature", 0.0, 150.0, 1, TemperatureUnit::F, ScalarOptionWidget::None, this);
m_Controls->AppliedTemperature->setDisabled(true);
m_Controls->AppliedTemperature->addUnit(TemperatureUnit::C);
m_Controls->AppliedTempWidget->layout()->addWidget(m_Controls->AppliedTemperature);
m_Controls->AppliedFraction = new QScalarWidget("Surface Area Fraction", 0.0, 1.0, 0.1, ScalarOptionWidget::Radio, this);
m_Controls->AppliedFraction->setDisabled(true);
m_Controls->AppliedTempWidget->layout()->addWidget(m_Controls->AppliedFraction);
m_Controls->AppliedArea = new QScalarQuantityWidget<AreaUnit>("Surface Area", 0.0, 150.0, 1, AreaUnit::m2, ScalarOptionWidget::Radio, this);
m_Controls->AppliedArea->setDisabled(true);
m_Controls->AppliedArea->addUnit(AreaUnit::cm2);
m_Controls->AppliedTempWidget->layout()->addWidget(m_Controls->AppliedArea);
// Connect Signals/Slots
connect(m_Controls->AppliedTempCheck, SIGNAL(clicked()), this, SLOT(EnableAppliedTemp()));
connect(m_Controls->AppliedFraction->getRadioButton(), SIGNAL(clicked()), this, SLOT(EnableAppliedSurfaceAreaFraction()));
connect(m_Controls->AppliedArea->getRadioButton(), SIGNAL(clicked()), this, SLOT(EnableAppliedTempSurfaceArea()));
m_Controls->AppliedTemperature->enableConverter(true);
m_Controls->AppliedArea->enableConverter(true);
m_Controls->ThermalApplication = new SEThermalApplication();
m_Controls->ThermalApplication->GetActiveCooling().GetPower().SetValue(0, PowerUnit::J_Per_s);
m_Controls->ThermalApplication->GetActiveHeating().GetPower().SetValue(0, PowerUnit::J_Per_s);
m_Controls->ThermalApplication->GetAppliedTemperature().SetState(eSwitch::Off);
m_Controls->EnvironmentalConditions = new SEChangeEnvironmentConditions(qp.GetEngine().GetSubstanceManager());
connect(m_Controls->ApplyAll, SIGNAL(clicked()), this, SLOT(ControlsToEnvironment()));
connect(m_Controls->LoadEnvironment, SIGNAL(clicked()), this, SLOT(LoadEnvironmentFile()));
connect(m_Controls->SaveEnviornment, SIGNAL(clicked()), this, SLOT(SaveEnvironmentFile()));
Reset();
}
QEnviornmentWidget::~QEnviornmentWidget()
{
// TODO Clean up all the widgets
m_Controls->Enviornment->close();
delete m_Controls;
}
void QEnviornmentWidget::Reset()
{
LoadEnvironmentFile("./environments/Standard.json");
m_Controls->sendEnvironment = false;
m_Controls->sendAction = false;
m_Controls->CoolingArea->reset();
m_Controls->CoolingFraction->reset();
m_Controls->CoolingPower->reset();
m_Controls->HeatingFraction->reset();
m_Controls->HeatingArea->reset();
m_Controls->HeatingPower->reset();
m_Controls->AppliedFraction->reset();
m_Controls->AppliedTemperature->reset();
m_Controls->AppliedArea->reset();
m_Controls->AppliedFracLast = false;
m_Controls->CoolingFracLast = false;
m_Controls->HeatingFracLast = false;
EnableControls(true, false);
}
void QEnviornmentWidget::EnableControls(bool conditions, bool actions)
{
m_Controls->AirDensity->enableInput(conditions);
m_Controls->AirVelocity->enableInput(conditions);
m_Controls->AmbientTemperature->enableInput(conditions);
m_Controls->AtmosphericPressure->enableInput(conditions);
m_Controls->ClothingResistance->enableInput(conditions);
m_Controls->Emissivity->enableInput(conditions);
m_Controls->MeanRadiantTemperature->enableInput(conditions);
m_Controls->RelativeHumidity->enableInput(conditions);
m_Controls->RespirationAmbientTemperature->enableInput(conditions);
m_Controls->AmbientO2->enableInput(conditions);
m_Controls->AmbientCO2->enableInput(conditions);
m_Controls->AmbientN2->enableInput(conditions);
m_Controls->AmbientCO->enableInput(conditions);
m_Controls->AmbientSmoke->enableInput(conditions);
m_Controls->LoadEnvironment->setEnabled(conditions);
m_Controls->SaveEnviornment->setEnabled(conditions);
m_Controls->ActiveCoolingCheck->setChecked(false);
m_Controls->ActiveCoolingCheck->setEnabled(actions);
m_Controls->ActiveHeatingCheck->setChecked(false);
m_Controls->ActiveHeatingCheck->setEnabled(actions);
m_Controls->AppliedTempCheck->setEnabled(actions);
m_Controls->AppliedTempCheck->setChecked(false);
EnableCooling();
EnableHeating();
EnableAppliedTemp();
m_Controls->ApplyAll->setEnabled(actions);
}
void QEnviornmentWidget::LoadEnvironmentFile()
{
QString fileName = QFileDialog::getOpenFileName(this,
"Open Environment", "./environments", "Environment Files (*.json)");
if (fileName.isEmpty())
return;
std::string s = fileName.toStdString();
LoadEnvironmentFile(s);
}
void QEnviornmentWidget::LoadEnvironmentFile(const std::string& fileName)
{
if(m_Controls->EnvironmentalConditions->GetConditions().SerializeFromFile(fileName, SerializationFormat::JSON))
EnvironmentToControls();
else
{
QMessageBox messageBox;
std::string message = "Unable to load Enviornment File";
messageBox.critical(0, "Error", QString::fromUtf8(message.c_str()));
messageBox.setFixedSize(500, 200);
}
}
void QEnviornmentWidget::SaveEnvironmentFile()
{
QString fileName = QFileDialog::getSaveFileName(this