Skip to content

Commit

Permalink
Merge pull request #56 from scharlton2/develop-issue-55
Browse files Browse the repository at this point in the history
Closes #55
  • Loading branch information
scharlton2 authored Jun 26, 2022
2 parents 6edad80 + b3d7dd4 commit 242a71a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
19 changes: 19 additions & 0 deletions ModelViewer/MvDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ CMvDoc::CMvDoc()
m_AnimationType = atTime;
m_AnimationSteps = 10;

m_default_xorigin = 0.;
m_default_yorigin = 0.;
m_default_angrot = 0.;

// Get the models supported by this application
m_NumberOfModels = mvModelList::GetNumberOfModels();
m_ModelNames = new char *[m_NumberOfModels];
Expand Down Expand Up @@ -279,6 +283,12 @@ BOOL CMvDoc::OnOpenDocument(LPCTSTR lpszPathName)
// If we are not at startup, then update the tool dialog boxes
else
{
if (Modflow6DataSource *modflow6 = dynamic_cast<Modflow6DataSource *>(m_Manager->m_DataSource))
{
m_default_xorigin = modflow6->GetXOrigin();
m_default_yorigin = modflow6->GetYOrigin();
m_default_angrot = modflow6->GetAngRot();
}
UpdateToolDialogs(gui);
delete gui;
}
Expand Down Expand Up @@ -573,6 +583,10 @@ void CMvDoc::OnLoadData()
m_Manager->ApplyDefaultSettings();
if (Modflow6DataSource *modflow6 = dynamic_cast<Modflow6DataSource*>(m_Manager->m_DataSource))
{
m_default_xorigin = modflow6->GetXOrigin();
m_default_yorigin = modflow6->GetYOrigin();
m_default_angrot = modflow6->GetAngRot();

m_Manager->SetOverlayCoordinatesAtGridOrigin(modflow6->GetXOrigin(), modflow6->GetYOrigin());
m_Manager->SetOverlayAngle(modflow6->GetAngRot());
}
Expand Down Expand Up @@ -1306,6 +1320,11 @@ void CMvDoc::UpdateOverlayDlg()
}
else
{
m_OverlayDlg->m_ControlsPage->m_XOrig = m_default_xorigin;
m_OverlayDlg->m_ControlsPage->m_YOrig = m_default_yorigin;
m_OverlayDlg->m_ControlsPage->m_Angle = m_default_angrot;
m_OverlayDlg->m_ControlsPage->UpdateData(FALSE);

m_OverlayDlg->m_FilePage->m_Filename = _T("");
m_OverlayDlg->m_FilePage->m_TypeComboBox.SetCurSel(0);
m_OverlayDlg->m_FilePage->UpdateData(FALSE);
Expand Down
4 changes: 4 additions & 0 deletions ModelViewer/MvDoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ class CMvDoc : public CDocument
BOOL m_IsAnimating;
mvGUISettings* m_GUI;

double m_default_xorigin;
double m_default_yorigin;
double m_default_angrot;

// The visualization pipeline manager
mvManager* m_Manager;

Expand Down
8 changes: 8 additions & 0 deletions mv/Modflow6DataSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,10 @@ char *Modflow6DataSource::CreateDisvGrid(char *gridFile)
return "Error encountered while reading the binary grid file.";
}

m_xorigin = xorigin;
m_yorigin = yorigin;
m_angrot = angrot;

// allocate arrays to contain read data
m_Elev = new double[m_Ncpl + m_NumberOfModflowCells]; // first ncpl elements contains top of grid, remaining entries contain botm of layer
vert = new double[2 * m_Nvert];
Expand Down Expand Up @@ -1490,6 +1494,10 @@ char *Modflow6DataSource::CreateDisuGrid(char *gridFile)
return "Error encountered while reading the binary grid file.";
}

m_xorigin = xorigin;
m_yorigin = yorigin;
m_angrot = angrot;

// allocate arrays
top = new double[m_NumberOfModflowCells];
bot = new double[m_NumberOfModflowCells];
Expand Down
17 changes: 0 additions & 17 deletions mv/mvManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5143,23 +5143,6 @@ void mvManager::Deserialize(const char *fileName, mvGUISettings *gui, std::strin
return;
}

#if defined(_DEBUG)
// Set the working directory to the directory that contains
// the document (.mvmf6) file. We assume that model data files
// are also in this directory.
strcpy(buffer, fileName);
char *p = strrchr(buffer, '\\');
if (*(p + 1) == ':')
{
p++;
}
*p = '\0';
///_chdir(buffer);
char curdir[1024];
::GetCurrentDirectory(1023, curdir);
ASSERT(strcmp(curdir, buffer) == 0);
#endif

// Create a hash table and read the data file into the hash table
mvHashTable *hashTable = new mvHashTable;
while (!in.eof())
Expand Down

0 comments on commit 242a71a

Please sign in to comment.