Skip to content

Commit b3d7dd4

Browse files
committed
Closes #55
1 parent 6edad80 commit b3d7dd4

File tree

4 files changed

+31
-17
lines changed

4 files changed

+31
-17
lines changed

ModelViewer/MvDoc.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ CMvDoc::CMvDoc()
137137
m_AnimationType = atTime;
138138
m_AnimationSteps = 10;
139139

140+
m_default_xorigin = 0.;
141+
m_default_yorigin = 0.;
142+
m_default_angrot = 0.;
143+
140144
// Get the models supported by this application
141145
m_NumberOfModels = mvModelList::GetNumberOfModels();
142146
m_ModelNames = new char *[m_NumberOfModels];
@@ -279,6 +283,12 @@ BOOL CMvDoc::OnOpenDocument(LPCTSTR lpszPathName)
279283
// If we are not at startup, then update the tool dialog boxes
280284
else
281285
{
286+
if (Modflow6DataSource *modflow6 = dynamic_cast<Modflow6DataSource *>(m_Manager->m_DataSource))
287+
{
288+
m_default_xorigin = modflow6->GetXOrigin();
289+
m_default_yorigin = modflow6->GetYOrigin();
290+
m_default_angrot = modflow6->GetAngRot();
291+
}
282292
UpdateToolDialogs(gui);
283293
delete gui;
284294
}
@@ -573,6 +583,10 @@ void CMvDoc::OnLoadData()
573583
m_Manager->ApplyDefaultSettings();
574584
if (Modflow6DataSource *modflow6 = dynamic_cast<Modflow6DataSource*>(m_Manager->m_DataSource))
575585
{
586+
m_default_xorigin = modflow6->GetXOrigin();
587+
m_default_yorigin = modflow6->GetYOrigin();
588+
m_default_angrot = modflow6->GetAngRot();
589+
576590
m_Manager->SetOverlayCoordinatesAtGridOrigin(modflow6->GetXOrigin(), modflow6->GetYOrigin());
577591
m_Manager->SetOverlayAngle(modflow6->GetAngRot());
578592
}
@@ -1306,6 +1320,11 @@ void CMvDoc::UpdateOverlayDlg()
13061320
}
13071321
else
13081322
{
1323+
m_OverlayDlg->m_ControlsPage->m_XOrig = m_default_xorigin;
1324+
m_OverlayDlg->m_ControlsPage->m_YOrig = m_default_yorigin;
1325+
m_OverlayDlg->m_ControlsPage->m_Angle = m_default_angrot;
1326+
m_OverlayDlg->m_ControlsPage->UpdateData(FALSE);
1327+
13091328
m_OverlayDlg->m_FilePage->m_Filename = _T("");
13101329
m_OverlayDlg->m_FilePage->m_TypeComboBox.SetCurSel(0);
13111330
m_OverlayDlg->m_FilePage->UpdateData(FALSE);

ModelViewer/MvDoc.h

+4
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ class CMvDoc : public CDocument
233233
BOOL m_IsAnimating;
234234
mvGUISettings* m_GUI;
235235

236+
double m_default_xorigin;
237+
double m_default_yorigin;
238+
double m_default_angrot;
239+
236240
// The visualization pipeline manager
237241
mvManager* m_Manager;
238242

mv/Modflow6DataSource.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,10 @@ char *Modflow6DataSource::CreateDisvGrid(char *gridFile)
966966
return "Error encountered while reading the binary grid file.";
967967
}
968968

969+
m_xorigin = xorigin;
970+
m_yorigin = yorigin;
971+
m_angrot = angrot;
972+
969973
// allocate arrays to contain read data
970974
m_Elev = new double[m_Ncpl + m_NumberOfModflowCells]; // first ncpl elements contains top of grid, remaining entries contain botm of layer
971975
vert = new double[2 * m_Nvert];
@@ -1490,6 +1494,10 @@ char *Modflow6DataSource::CreateDisuGrid(char *gridFile)
14901494
return "Error encountered while reading the binary grid file.";
14911495
}
14921496

1497+
m_xorigin = xorigin;
1498+
m_yorigin = yorigin;
1499+
m_angrot = angrot;
1500+
14931501
// allocate arrays
14941502
top = new double[m_NumberOfModflowCells];
14951503
bot = new double[m_NumberOfModflowCells];

mv/mvManager.cpp

-17
Original file line numberDiff line numberDiff line change
@@ -5143,23 +5143,6 @@ void mvManager::Deserialize(const char *fileName, mvGUISettings *gui, std::strin
51435143
return;
51445144
}
51455145

5146-
#if defined(_DEBUG)
5147-
// Set the working directory to the directory that contains
5148-
// the document (.mvmf6) file. We assume that model data files
5149-
// are also in this directory.
5150-
strcpy(buffer, fileName);
5151-
char *p = strrchr(buffer, '\\');
5152-
if (*(p + 1) == ':')
5153-
{
5154-
p++;
5155-
}
5156-
*p = '\0';
5157-
///_chdir(buffer);
5158-
char curdir[1024];
5159-
::GetCurrentDirectory(1023, curdir);
5160-
ASSERT(strcmp(curdir, buffer) == 0);
5161-
#endif
5162-
51635146
// Create a hash table and read the data file into the hash table
51645147
mvHashTable *hashTable = new mvHashTable;
51655148
while (!in.eof())

0 commit comments

Comments
 (0)