Added commands for well path features

This commit is contained in:
Magne Sjaastad
2015-08-12 20:59:38 +02:00
parent 9f16c859c6
commit 9bee1b81fc
8 changed files with 344 additions and 11 deletions

View File

@@ -39,7 +39,10 @@ ${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceJ.h
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceK.h
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputProperty.h
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.h
${CEE_CURRENT_LIST_DIR}RicImportWellPathsSsihubFeature.h
${CEE_CURRENT_LIST_DIR}RicImportWellPathsFileFeature.h
${CEE_CURRENT_LIST_DIR}RicImportWellPathsDeleteAllFeature.h
# General delete of any object in a child array field
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.h
@@ -81,7 +84,10 @@ ${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceJ.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceK.cpp
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputProperty.cpp
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.cpp
${CEE_CURRENT_LIST_DIR}RicImportWellPathsSsihubFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportWellPathsFileFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportWellPathsDeleteAllFeature.cpp
# General delete of any object in a child array field
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.cpp

View File

@@ -0,0 +1,90 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2011-2013 Ceetron AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
// for more details.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#include "RicImportWellPathsDeleteAllFeature.h"
#include "RimWellPathCollection.h"
#include "cafSelectionManager.h"
#include <QAction>
namespace caf
{
CAF_CMD_SOURCE_INIT(RicWellPathsDeleteAllFeature, "RicWellPathsDeleteAllFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicWellPathsDeleteAllFeature::isCommandEnabled()
{
std::vector<RimWellPathCollection*> objects;
caf::SelectionManager::instance()->objectsByType(&objects);
if (objects.size() == 1)
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellPathsDeleteAllFeature::onActionTriggered(bool isChecked)
{
std::vector<RimWellPathCollection*> objects;
caf::SelectionManager::instance()->objectsByType(&objects);
RimWellPathCollection* wellPathCollection = objects[0];
wellPathCollection->wellPaths.deleteAllChildObjects();
uiObj(wellPathCollection)->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellPathsDeleteAllFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Delete All Well Paths");
//actionToSetup->setIcon(QIcon(":/WellCollection.png"));
}
} // end namespace caf

View File

@@ -0,0 +1,61 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2011-2013 Ceetron AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
// for more details.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#pragma once
#include "cafCmdFeature.h"
namespace caf
{
//==================================================================================================
///
//==================================================================================================
class RicWellPathsDeleteAllFeature : public CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};
} // end namespace caf

View File

@@ -0,0 +1,90 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2011-2013 Ceetron AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
// for more details.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#include "RicImportWellPathsFileFeature.h"
#include "RiaApplication.h"
#include "RimProject.h"
#include "RiuMainWindow.h"
#include <QAction>
#include <QFileDialog>
namespace caf
{
CAF_CMD_SOURCE_INIT(RicImportWellPathsFileFeature, "RicImportWellPathsFileFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicImportWellPathsFileFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportWellPathsFileFeature::onActionTriggered(bool isChecked)
{
// Open dialog box to select well path files
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->defaultFileDialogDirectory("WELLPATH_DIR");
QStringList wellPathFilePaths = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Import Well Paths", defaultDir, "Well Paths (*.json *.asc *.asci *.ascii *.dev);;All Files (*.*)");
if (wellPathFilePaths.size() < 1) return;
// Remember the path to next time
app->setDefaultFileDialogDirectory("WELLPATH_DIR", QFileInfo(wellPathFilePaths.last()).absolutePath());
app->addWellPathsToModel(wellPathFilePaths);
if (app->project())
{
app->project()->createDisplayModelAndRedrawAllViews();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportWellPathsFileFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Import &Well Paths from File");
actionToSetup->setIcon(QIcon(":/Well.png"));
}
} // end namespace caf

View File

@@ -0,0 +1,61 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2011-2013 Ceetron AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
// for more details.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#pragma once
#include "cafCmdFeature.h"
namespace caf
{
//==================================================================================================
///
//==================================================================================================
class RicImportWellPathsFileFeature : public CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};
} // end namespace caf