Skip to content

Commit

Permalink
finish prog3
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean M Widmier authored and Sean M Widmier committed Apr 10, 2019
1 parent 98bc1af commit 4f68bd7
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 33 deletions.
29 changes: 2 additions & 27 deletions Release/Wells.log
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
Build started 4/8/2019 11:01:01 AM.
1>Project "C:\Users\smw0025\Documents\Wells\Wells.vcxproj" on node 2 (Build target(s)).
1>ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\CL.exe /c /Zi /nologo /W3 /WX- /sdl /O2 /Oi /Oy- /GL /D WIN32 /D _WINDOWS /D NDEBUG /D _AFXDLL /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Yu"stdafx.h" /Fp"Release\Wells.pch" /Fo"Release\\" /Fd"Release\vc110.pdb" /Gd /TP /wd4996 /analyze- /errorReport:prompt WellsDlg.cpp
WellsDlg.cpp
1>WellsDlg.cpp(74): warning C4002: too many actual parameters for macro 'ON_WM_TIMER'
Link:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"C:\Users\smw0025\Documents\Wells\Release\Wells.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /manifestinput:"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\Include\Manifest\dpiaware.manifest" /DEBUG /PDB:"C:\Users\smw0025\Documents\Wells\Release\Wells.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Users\smw0025\Documents\Wells\Release\Wells.lib" /MACHINE:X86 /SAFESEH Release\Wells.res
Release\DataGen.obj
Release\DataGenFactory.obj
Release\Display.obj
Release\Sensor.obj
Release\SensorConfig.obj
Release\SensorFactory.obj
Release\Simulation.obj
Release\stdafx.obj
Release\OilFieldDataParser.obj
Release\Wells.obj
Release\WellsDlg.obj
Release\Well.obj
Release\WellFactory.obj
Release\WellMsg.obj
Generating code
Finished generating code
Wells.vcxproj -> C:\Users\smw0025\Documents\Wells\Release\Wells.exe
1>Done Building Project "C:\Users\smw0025\Documents\Wells\Wells.vcxproj" (Build target(s)).
Build started 4/10/2019 11:08:04 AM.

Build succeeded.

Time Elapsed 00:00:02.03
Time Elapsed 00:00:00.01
4 changes: 2 additions & 2 deletions Well/Well.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ void Well::setEnabled(bool e) {
* @param e new enabled state for the sensor
* @return Indicates success of search.
*/
bool Well::setEnabledSensor(char *type, bool e) {
bool Well::setEnabledSensor(char *name, bool e) {
for (Sensor *sensor: _sensors) {
if (strcmp(sensor->getType(), type) == 0) {
if (strcmp(sensor->getDisplayName(), name) == 0) {
sensor->setEnabled(e);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion Well/Well.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Well {

void setEnabled(bool e);

bool setEnabledSensor(char *type, bool e);
bool setEnabledSensor(char *name, bool e);

bool getEnabled();

Expand Down
Binary file modified Wells.aps
Binary file not shown.
Binary file modified Wells.rc
Binary file not shown.
Binary file modified Wells.sdf
Binary file not shown.
Binary file modified Wells.v11.suo
Binary file not shown.
59 changes: 56 additions & 3 deletions WellsDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ void CWellsDlg::DoDataExchange(CDataExchange* pDX)
DDX_Control(pDX, RUN_SIM, _run_sim);
DDX_Control(pDX, AVAILABLE_WELLS, _available_wells);
DDX_Control(pDX, SELECTED_WELLS, _selected_wells);
DDX_Control(pDX, IDC_OP, _sel_operator);
DDX_Control(pDX, IDC_SELWELL, _sel_well);
DDX_Control(pDX, AVAILABLE_SENSORS, _available_sensors);
DDX_Control(pDX, SELECTED_SENSORS, _selected_sensors);
}

BEGIN_MESSAGE_MAP(CWellsDlg, CDialogEx)
Expand All @@ -72,6 +76,8 @@ BEGIN_MESSAGE_MAP(CWellsDlg, CDialogEx)
ON_BN_CLICKED(ADD_WELL, &CWellsDlg::OnBnClickedWell)
ON_BN_CLICKED(REMOVE_WELL, &CWellsDlg::OnBnClickedRemoveWell)
ON_WM_TIMER(&CWellsDlg::OnTimer)
ON_BN_CLICKED(ADD_SENSOR, &CWellsDlg::OnBnClickedAddSensor)
ON_BN_CLICKED(REMOVE_SENSOR, &CWellsDlg::OnBnClickedRemoveSensor)
END_MESSAGE_MAP()


Expand Down Expand Up @@ -208,7 +214,6 @@ void CWellsDlg::OnLbnSelchangeWells()

void CWellsDlg::OnLbnSelchangeSelectedWells()
{
// TODO: Add your control notification handler code here
CString selection;
_selected_wells.GetText(_selected_wells.GetCurSel(), selection);

Expand All @@ -217,6 +222,20 @@ void CWellsDlg::OnLbnSelchangeSelectedWells()
if(strcmp(well->getid(), selection) == 0)
{
_selected_well = well;

_sel_well.SetWindowText(well->getid());
_sel_operator.SetWindowText(well->getCompany());

_selected_sensors.ResetContent();
_available_sensors.ResetContent();

for(Sensor *sensor: _selected_well->getSensors()) {
if(sensor->getEnabled())
_selected_sensors.AddString(sensor->getDisplayName());
else
_available_sensors.AddString(sensor->getDisplayName());
}

OnPaint();
}
}
Expand All @@ -225,7 +244,6 @@ void CWellsDlg::OnLbnSelchangeSelectedWells()

void CWellsDlg::OnBnClickedWell()
{
// TODO: Add your control notification handler code here
CString selection;
_available_wells.GetText(_available_wells.GetCurSel(), selection);
_available_wells.DeleteString(_available_wells.GetCurSel());
Expand All @@ -235,9 +253,44 @@ void CWellsDlg::OnBnClickedWell()

void CWellsDlg::OnBnClickedRemoveWell()
{
// TODO: Add your control notification handler code
CString selection;
_selected_wells.GetText(_selected_wells.GetCurSel(), selection);
_selected_wells.DeleteString(_selected_wells.GetCurSel());
_available_wells.AddString(selection);
}


void CWellsDlg::OnBnClickedAddSensor()
{
CString selection;
_available_sensors.GetText(_available_sensors.GetCurSel(), selection);
_available_sensors.DeleteString(_available_sensors.GetCurSel());
_selected_sensors.AddString(selection);

// convert selection to char*
char *sel_ptr = 0;
sel_ptr = selection.GetBuffer(selection.GetLength());
selection.ReleaseBuffer();

_selected_well->setEnabledSensor(sel_ptr,true);

OnPaint();
}


void CWellsDlg::OnBnClickedRemoveSensor()
{
CString selection;
_selected_sensors.GetText(_selected_sensors.GetCurSel(), selection);
_selected_sensors.DeleteString(_selected_sensors.GetCurSel());
_available_sensors.AddString(selection);

// convert selection to char*
char *sel_ptr = 0;
sel_ptr = selection.GetBuffer(selection.GetLength());
selection.ReleaseBuffer();

_selected_well->setEnabledSensor(sel_ptr,false);

OnPaint();
}
7 changes: 7 additions & 0 deletions WellsDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,11 @@ class CWellsDlg : public CDialogEx

CListBox _available_wells;

public:
CEdit _sel_operator;
CEdit _sel_well;
CListBox _available_sensors;
CListBox _selected_sensors;
afx_msg void OnBnClickedAddSensor();
afx_msg void OnBnClickedRemoveSensor();
};
Binary file modified resource.h
Binary file not shown.

0 comments on commit 4f68bd7

Please sign in to comment.