mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-10 07:26:03 -06:00
Added framework used to handle utm area of interest
p4#: 21775
This commit is contained in:
parent
ead2eac08b
commit
ea4491e987
@ -467,3 +467,39 @@ void RimProject::createDisplayModelAndRedrawAllViews()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::computeUtmAreaOfInterest(double* north, double* south, double* east, double* west)
|
||||
{
|
||||
CVF_ASSERT(north && south && east && west);
|
||||
std::vector<RimCase*> cases;
|
||||
allCases(cases);
|
||||
|
||||
cvf::BoundingBox projectBB;
|
||||
|
||||
for (size_t i = 0; i < cases.size(); i++)
|
||||
{
|
||||
RimCase* rimCase = cases[i];
|
||||
|
||||
if (rimCase && rimCase->reservoirData())
|
||||
{
|
||||
for (size_t gridIdx = 0; gridIdx < rimCase->reservoirData()->gridCount(); gridIdx++ )
|
||||
{
|
||||
RigGridBase* rigGrid = rimCase->reservoirData()->grid(gridIdx);
|
||||
|
||||
projectBB.add(rigGrid->boundingBox());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (projectBB.isValid())
|
||||
{
|
||||
*north = projectBB.max().y();
|
||||
*south = projectBB.min().y();
|
||||
|
||||
*west = projectBB.min().x();
|
||||
*east = projectBB.max().x();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,8 @@ public:
|
||||
void allCases(std::vector<RimCase*>& cases);
|
||||
void createDisplayModelAndRedrawAllViews();
|
||||
|
||||
void computeUtmAreaOfInterest(double* north, double* south, double* east, double* west);
|
||||
|
||||
private:
|
||||
RigMainGrid* registerCaseInGridCollection(RigCaseData* rigEclipseCase);
|
||||
|
||||
|
@ -511,6 +511,29 @@ void RigGridBase::coarseningBox(size_t coarseningBoxIndex, size_t* i1, size_t* i
|
||||
*k2 = box[5];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RigGridBase::boundingBox()
|
||||
{
|
||||
if (!m_boundingBox.isValid())
|
||||
{
|
||||
cvf::Vec3d cornerVerts[8];
|
||||
|
||||
for (size_t i = 0; i < cellCount(); i++)
|
||||
{
|
||||
cellCornerVertices(i, cornerVerts);
|
||||
|
||||
for (size_t j = 0; j < 8; j++)
|
||||
{
|
||||
m_boundingBox.add(cornerVerts[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return m_boundingBox;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "cvfBase.h"
|
||||
|
||||
#include "cvfVector3.h"
|
||||
#include "cvfBoundingBox.h"
|
||||
|
||||
#include "cvfStructGrid.h"
|
||||
#include "cvfStructGridGeometryGenerator.h"
|
||||
@ -69,6 +70,8 @@ public:
|
||||
size_t addCoarseningBox(size_t i1, size_t i2, size_t j1, size_t j2, size_t k1, size_t k2);
|
||||
|
||||
void coarseningBox(size_t coarseningBoxIndex, size_t* i1, size_t* i2, size_t* j1, size_t* j2, size_t* k1, size_t* k2) const;
|
||||
|
||||
cvf::BoundingBox boundingBox();
|
||||
|
||||
protected:
|
||||
friend class RigMainGrid;//::initAllSubGridsParentGridPointer();
|
||||
@ -106,6 +109,7 @@ private:
|
||||
size_t m_indexToStartOfCells; ///< Index into the global cell array stored in main-grid where this grids cells starts.
|
||||
size_t m_gridIndex; ///< The LGR index of this grid. Starts with 1. Main grid has index 0.
|
||||
RigMainGrid* m_mainGrid;
|
||||
cvf::BoundingBox m_boundingBox;
|
||||
|
||||
std::vector<caf::SizeTArray6> m_coarseningBoxInfo;
|
||||
};
|
||||
|
@ -1611,7 +1611,21 @@ void RiuMainWindow::slotImportWellPaths()
|
||||
|
||||
m_ssihubInterface->setWebServiceAddress(app->preferences()->ssihubAddress);
|
||||
m_ssihubInterface->setJsonDestinationFolder(wellPathsFolderPath);
|
||||
//m_ssihubInterface->setRegion(int east, int west, int north, int south);
|
||||
|
||||
double north = cvf::UNDEFINED_DOUBLE;
|
||||
double south = cvf::UNDEFINED_DOUBLE;
|
||||
double east = cvf::UNDEFINED_DOUBLE;
|
||||
double west = cvf::UNDEFINED_DOUBLE;
|
||||
|
||||
app->project()->computeUtmAreaOfInterest(&north, &south, &east, &west);
|
||||
|
||||
if (north != cvf::UNDEFINED_DOUBLE &&
|
||||
south != cvf::UNDEFINED_DOUBLE &&
|
||||
east != cvf::UNDEFINED_DOUBLE &&
|
||||
west != cvf::UNDEFINED_DOUBLE)
|
||||
{
|
||||
m_ssihubInterface->setRegion(north, south, east, west);
|
||||
}
|
||||
|
||||
QStringList wellPaths = m_ssihubInterface->jsonWellPaths();
|
||||
if (wellPaths.size() > 0)
|
||||
|
@ -63,11 +63,37 @@ FetchWellPathsDialog::FetchWellPathsDialog(QWidget *parent)
|
||||
m_wellPathsModel = new QStandardItemModel;
|
||||
m_wellPathsView->setModel(m_wellPathsModel);
|
||||
|
||||
// Filter by Utm coordinates
|
||||
m_filterWellsByUtmArea = new QCheckBox("Filter by UTM area");
|
||||
connect(m_filterWellsByUtmArea, SIGNAL(clicked()), this, SLOT(refreshButtonStatus()));
|
||||
|
||||
m_northLineEdit = new QLineEdit;
|
||||
m_southLineEdit = new QLineEdit;
|
||||
m_eastLineEdit = new QLineEdit;
|
||||
m_westLineEdit = new QLineEdit;
|
||||
|
||||
|
||||
QGroupBox* utmAreaGropBox = new QGroupBox("UTM filter by area");
|
||||
QGridLayout *utmAreaLayout = new QGridLayout;
|
||||
utmAreaLayout->addWidget(m_filterWellsByUtmArea, 0, 1);
|
||||
utmAreaLayout->addWidget(new QLabel("North"), 1, 0);
|
||||
utmAreaLayout->addWidget(m_northLineEdit, 1, 1);
|
||||
utmAreaLayout->addWidget(new QLabel("South"), 1, 2);
|
||||
utmAreaLayout->addWidget(m_southLineEdit, 1, 3);
|
||||
utmAreaLayout->addWidget(new QLabel("East"), 2, 0);
|
||||
utmAreaLayout->addWidget(m_eastLineEdit, 2, 1);
|
||||
utmAreaLayout->addWidget(new QLabel("West"), 2, 2);
|
||||
utmAreaLayout->addWidget(m_westLineEdit, 2, 3);
|
||||
utmAreaGropBox->setLayout(utmAreaLayout);
|
||||
|
||||
m_downloadWellPathsButton = new QPushButton(tr("Get well paths"));
|
||||
m_downloadWellPathsButton->setDefault(true);
|
||||
|
||||
m_downloadFilterInfo = new QPushButton(tr("Get UTM filter info"));
|
||||
|
||||
buttonBox = new QDialogButtonBox;
|
||||
buttonBox->addButton(m_downloadFieldsButton, QDialogButtonBox::ActionRole);
|
||||
buttonBox->addButton(m_downloadFilterInfo, QDialogButtonBox::ActionRole);
|
||||
buttonBox->addButton(m_downloadWellPathsButton, QDialogButtonBox::ActionRole);
|
||||
|
||||
QDialogButtonBox* buttonBox1 = new QDialogButtonBox;
|
||||
@ -91,6 +117,7 @@ FetchWellPathsDialog::FetchWellPathsDialog(QWidget *parent)
|
||||
|
||||
connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload()));
|
||||
connect(m_downloadWellPathsButton, SIGNAL(clicked()), this, SLOT(downloadWellPaths()));
|
||||
connect(m_downloadFilterInfo, SIGNAL(clicked()), this, SLOT(downloadUtmFilterInfo()));
|
||||
|
||||
QVBoxLayout *topLayout1 = new QVBoxLayout;
|
||||
QVBoxLayout *topLayout2 = new QVBoxLayout;
|
||||
@ -110,6 +137,7 @@ FetchWellPathsDialog::FetchWellPathsDialog(QWidget *parent)
|
||||
mainLayout->addLayout(topLayout);
|
||||
mainLayout->addLayout(ssihubLayout);
|
||||
mainLayout->addWidget(statusLabel);
|
||||
mainLayout->addWidget(utmAreaGropBox);
|
||||
mainLayout->addWidget(buttonBox);
|
||||
mainLayout->addWidget(m_wellPathsView);
|
||||
mainLayout->addWidget(buttonBox1);
|
||||
@ -121,6 +149,13 @@ FetchWellPathsDialog::FetchWellPathsDialog(QWidget *parent)
|
||||
refreshButtonStatus();
|
||||
|
||||
resize(600, 400);
|
||||
|
||||
m_north = HUGE_VAL;
|
||||
m_south = HUGE_VAL;
|
||||
m_east = HUGE_VAL;
|
||||
m_west = HUGE_VAL;
|
||||
|
||||
m_downloadFilterInfo->setEnabled(m_filterWellsByUtmArea->isChecked());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -244,6 +279,17 @@ void FetchWellPathsDialog::refreshButtonStatus()
|
||||
}
|
||||
|
||||
m_downloadFieldsButton->setEnabled(!urlSsiHubLineEdit->text().isEmpty());
|
||||
|
||||
|
||||
if (m_filterWellsByUtmArea->isChecked() &&
|
||||
m_fieldListView->selectionModel()->selectedIndexes().size() > 0)
|
||||
{
|
||||
m_downloadFilterInfo->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_downloadFilterInfo->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -307,12 +353,6 @@ void FetchWellPathsDialog::setUrl(const QString& httpAddress)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void FetchWellPathsDialog::downloadWellPaths()
|
||||
{
|
||||
QModelIndex mi = m_fieldListView->currentIndex();
|
||||
QString fieldName = m_fieldModel->data(mi, Qt::DisplayRole).toString();
|
||||
|
||||
QString completeUrlText = urlSsiHubLineEdit->text() + "/resinsight/projects/" + fieldName + "/wellpaths";
|
||||
setUrl(completeUrlText);
|
||||
|
||||
QString fileName = jsonWellPathsFilePath();
|
||||
if (QFile::exists(fileName))
|
||||
{
|
||||
@ -321,64 +361,63 @@ void FetchWellPathsDialog::downloadWellPaths()
|
||||
m_wellPathsModel->clear();
|
||||
}
|
||||
|
||||
m_file = new QFile(fileName);
|
||||
if (!m_file->open(QIODevice::WriteOnly)) {
|
||||
QMessageBox::information(this, tr("HTTP"),
|
||||
tr("Unable to save the file %1: %2.")
|
||||
.arg(fileName).arg(m_file->errorString()));
|
||||
delete m_file;
|
||||
m_file = 0;
|
||||
return;
|
||||
}
|
||||
QModelIndex mi = m_fieldListView->currentIndex();
|
||||
QString fieldName = m_fieldModel->data(mi, Qt::DisplayRole).toString();
|
||||
|
||||
progressDialog->setWindowTitle(tr("HTTP"));
|
||||
progressDialog->setLabelText(tr("Downloading %1.").arg(fileName));
|
||||
m_downloadWellPathsButton->setEnabled(false);
|
||||
|
||||
// schedule the request
|
||||
httpRequestAborted = false;
|
||||
startRequest(url);
|
||||
QString completeUrlText = urlSsiHubLineEdit->text() + "/resinsight/projects/" + fieldName + "/wellpaths";
|
||||
|
||||
issueHttpRequestToFile(completeUrlText, fileName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void FetchWellPathsDialog::downloadFields()
|
||||
{
|
||||
QString completeUrlText = urlSsiHubLineEdit->text() + "/resinsight/projects";
|
||||
setUrl(completeUrlText);
|
||||
|
||||
// Delete already wellPathList
|
||||
QString wellFileName = jsonWellPathsFilePath();
|
||||
if (QFile::exists(wellFileName))
|
||||
{
|
||||
QString wellFileName = jsonWellPathsFilePath();
|
||||
if (QFile::exists(wellFileName))
|
||||
{
|
||||
QFile::remove(wellFileName);
|
||||
QFile::remove(wellFileName);
|
||||
|
||||
m_wellPathsModel->clear();
|
||||
}
|
||||
m_wellPathsModel->clear();
|
||||
}
|
||||
|
||||
QString fieldsFileName = jsonFieldsFilePath();
|
||||
m_file = new QFile(fieldsFileName);
|
||||
if (!m_file->open(QIODevice::WriteOnly)) {
|
||||
QMessageBox::information(this, tr("HTTP"),
|
||||
tr("Unable to save the file %1: %2.")
|
||||
.arg(fieldsFileName).arg(m_file->errorString()));
|
||||
delete m_file;
|
||||
m_file = 0;
|
||||
return;
|
||||
QString completeUrlText = urlSsiHubLineEdit->text() + "/resinsight/projects";
|
||||
QString destinationFileName = jsonFieldsFilePath();
|
||||
|
||||
issueHttpRequestToFile(completeUrlText, destinationFileName);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void FetchWellPathsDialog::downloadUtmFilterInfo()
|
||||
{
|
||||
QString fileName = jsonWellsByArea();
|
||||
if (QFile::exists(fileName))
|
||||
{
|
||||
QFile::remove(fileName);
|
||||
}
|
||||
|
||||
progressDialog->setWindowTitle(tr("HTTP"));
|
||||
progressDialog->setLabelText(tr("Downloading %1.").arg(fieldsFileName));
|
||||
m_downloadFieldsButton->setEnabled(false);
|
||||
QModelIndex mi = m_fieldListView->currentIndex();
|
||||
QString fieldName = m_fieldModel->data(mi, Qt::DisplayRole).toString();
|
||||
|
||||
// schedule the request
|
||||
httpRequestAborted = false;
|
||||
startRequest(url);
|
||||
QString completeUrlText = urlSsiHubLineEdit->text() + "/resinsight/projects/" + fieldName + "/wellsByArea";
|
||||
|
||||
int north = m_northLineEdit->text().toInt();
|
||||
int south = m_southLineEdit->text().toInt();
|
||||
int east = m_eastLineEdit->text().toInt();
|
||||
int west = m_westLineEdit->text().toInt();
|
||||
|
||||
completeUrlText += QString("?north=%1").arg(north);
|
||||
completeUrlText += QString("&south=%1").arg(south);
|
||||
completeUrlText += QString("&east=%1").arg(east);
|
||||
completeUrlText += QString("&west=%1").arg(west);
|
||||
completeUrlText += QString("&utmZone=32S&format=json");
|
||||
|
||||
issueHttpRequestToFile(completeUrlText, fileName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -472,6 +511,17 @@ QString FetchWellPathsDialog::jsonWellPathsFilePath()
|
||||
return m_destinationFolder + "/wellpaths.json";
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString FetchWellPathsDialog::jsonWellsByArea()
|
||||
{
|
||||
return m_destinationFolder + "/wellsbyarea.json";
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -554,7 +604,6 @@ void FetchWellPathsDialog::extractAndUpdateSingleWellFiles()
|
||||
m_wellPathsModel->clear();
|
||||
m_wellPathsModel->setRowCount(wellPathFileNames.size());
|
||||
m_wellPathsModel->setColumnCount(2);
|
||||
//m_wellPathsView->hideColumn(1);
|
||||
|
||||
for (int i = 0; i < wellPathFileNames.size(); i++)
|
||||
{
|
||||
@ -615,6 +664,42 @@ QString FetchWellPathsDialog::getValue(const QString& key, const QString& wellPa
|
||||
return QString();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void FetchWellPathsDialog::setRegion(int north, int south, int east, int west)
|
||||
{
|
||||
m_north = north;
|
||||
m_south = south;
|
||||
m_east = east;
|
||||
m_west = west;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void FetchWellPathsDialog::issueHttpRequestToFile(QString completeUrlText, QString destinationFileName)
|
||||
{
|
||||
setUrl(completeUrlText);
|
||||
m_file = new QFile(destinationFileName);
|
||||
if (!m_file->open(QIODevice::WriteOnly)) {
|
||||
QMessageBox::information(this, tr("HTTP"),
|
||||
tr("Unable to save the file %1: %2.")
|
||||
.arg(destinationFileName).arg(m_file->errorString()));
|
||||
delete m_file;
|
||||
m_file = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
progressDialog->setWindowTitle(tr("HTTP"));
|
||||
progressDialog->setLabelText(tr("Downloading %1.").arg(destinationFileName));
|
||||
|
||||
// schedule the request
|
||||
httpRequestAborted = false;
|
||||
startRequest(url);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace ssihub
|
||||
|
@ -37,6 +37,7 @@ class QNetworkReply;
|
||||
class QStringListModel;
|
||||
class QListView;
|
||||
class QStandardItemModel;
|
||||
class QCheckBox;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
@ -54,6 +55,8 @@ public:
|
||||
|
||||
void setSsiHubUrl(const QString& httpAddress);
|
||||
void setDestinationFolder(const QString& folder);
|
||||
void setRegion(int north, int south, int east, int west);
|
||||
|
||||
QStringList downloadedJsonWellPathFiles();
|
||||
|
||||
protected:
|
||||
@ -65,6 +68,7 @@ private:
|
||||
|
||||
QString jsonFieldsFilePath();
|
||||
QString jsonWellPathsFilePath();
|
||||
QString jsonWellsByArea();
|
||||
|
||||
void updateFromDownloadedFiles();
|
||||
void updateFieldsModel();
|
||||
@ -73,8 +77,11 @@ private:
|
||||
QString getValue(const QString& key, const QString& wellPathFileContent);
|
||||
|
||||
private slots:
|
||||
void downloadUtmFilterInfo();
|
||||
void downloadWellPaths();
|
||||
void downloadFields();
|
||||
|
||||
void issueHttpRequestToFile( QString completeUrlText, QString fieldsFileName );
|
||||
void cancelDownload();
|
||||
void httpFinished();
|
||||
void httpReadyRead();
|
||||
@ -100,10 +107,18 @@ private:
|
||||
QPushButton* m_downloadFieldsButton;
|
||||
QListView* m_fieldListView;
|
||||
|
||||
QPushButton* m_downloadFilterInfo;
|
||||
|
||||
QListView* m_wellPathsView;
|
||||
QStandardItemModel* m_wellPathsModel;
|
||||
|
||||
|
||||
QCheckBox* m_filterWellsByUtmArea;
|
||||
QLineEdit* m_northLineEdit;
|
||||
QLineEdit* m_southLineEdit;
|
||||
QLineEdit* m_eastLineEdit;
|
||||
QLineEdit* m_westLineEdit;
|
||||
|
||||
QProgressDialog* progressDialog;
|
||||
QPushButton* m_downloadWellPathsButton;
|
||||
QDialogButtonBox* buttonBox;
|
||||
@ -118,6 +133,11 @@ private:
|
||||
|
||||
QString m_destinationFolder;
|
||||
QStringListModel* m_fieldModel;
|
||||
|
||||
double m_north;
|
||||
double m_south;
|
||||
double m_east;
|
||||
double m_west;
|
||||
};
|
||||
|
||||
} // namespace ssihub
|
||||
|
@ -29,6 +29,10 @@ namespace ssihub {
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Interface::Interface()
|
||||
{
|
||||
m_north = HUGE_VAL;
|
||||
m_south = HUGE_VAL;
|
||||
m_east = HUGE_VAL;
|
||||
m_west = HUGE_VAL;
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +55,7 @@ void Interface::setJsonDestinationFolder(const QString folder)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Interface::setRegion(int east, int west, int north, int south)
|
||||
void Interface::setRegion(int north, int south, int east, int west)
|
||||
{
|
||||
m_east = east;
|
||||
m_west = west;
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
|
||||
void setWebServiceAddress(const QString wsAdress);
|
||||
void setJsonDestinationFolder(const QString folder);
|
||||
void setRegion(int east, int west, int north, int south);
|
||||
void setRegion(int north, int south, int east, int west);
|
||||
|
||||
QStringList jsonWellPaths();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user