mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge remote-tracking branch 'refs/remotes/origin/dev'
Conflicts: ApplicationCode/ProjectDataModel/CMakeLists_files.cmake ApplicationCode/UserInterface/RiuViewerCommands.cpp
This commit is contained in:
commit
1753449772
@ -23,6 +23,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseInputPropertyFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.h
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicApplyPropertyFilterAsCellResultFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -44,6 +45,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseInputPropertyFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicApplyPropertyFilterAsCellResultFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -0,0 +1,121 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicApplyPropertyFilterAsCellResultFeature.h"
|
||||
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
#include "RimEclipseView.h"
|
||||
|
||||
#include "RimGeoMechPropertyFilter.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
#include "RimGeoMechView.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicApplyPropertyFilterAsCellResultFeature, "RicApplyPropertyFilterAsCellResultFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicApplyPropertyFilterAsCellResultFeature::isCommandEnabled()
|
||||
{
|
||||
{
|
||||
std::vector<RimEclipsePropertyFilter*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType(&objects);
|
||||
|
||||
if (objects.size() == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<RimGeoMechPropertyFilter*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType(&objects);
|
||||
|
||||
if (objects.size() == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicApplyPropertyFilterAsCellResultFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
{
|
||||
std::vector<RimEclipsePropertyFilter*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType(&objects);
|
||||
|
||||
if (objects.size() == 1)
|
||||
{
|
||||
RimEclipsePropertyFilter* propertyFilter = objects[0];
|
||||
if (!propertyFilter) return;
|
||||
|
||||
RimEclipseView* rimEclipseView = nullptr;
|
||||
propertyFilter->firstAncestorOrThisOfType(rimEclipseView);
|
||||
if (!rimEclipseView) return;
|
||||
|
||||
rimEclipseView->cellResult()->simpleCopy(propertyFilter->resultDefinition());
|
||||
rimEclipseView->cellResult()->updateConnectedEditors();
|
||||
|
||||
rimEclipseView->scheduleCreateDisplayModelAndRedraw();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<RimGeoMechPropertyFilter*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType(&objects);
|
||||
|
||||
if (objects.size() == 1)
|
||||
{
|
||||
RimGeoMechPropertyFilter* propertyFilter = objects[0];
|
||||
if (!propertyFilter) return;
|
||||
|
||||
RimGeoMechView* geoMechView = nullptr;
|
||||
propertyFilter->firstAncestorOrThisOfType(geoMechView);
|
||||
if (!geoMechView) return;
|
||||
|
||||
geoMechView->cellResultResultDefinition()->setResultAddress(propertyFilter->resultDefinition()->resultAddress());
|
||||
geoMechView->cellResultResultDefinition()->updateConnectedEditors();
|
||||
|
||||
geoMechView->scheduleCreateDisplayModelAndRedraw();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicApplyPropertyFilterAsCellResultFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Apply As Cell Result");
|
||||
actionToSetup->setIcon(QIcon(":/CellResult.png"));
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicApplyPropertyFilterAsCellResultFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
};
|
||||
|
@ -7,12 +7,14 @@ endif()
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFromPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFromPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.cpp
|
||||
)
|
||||
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
@ -76,6 +78,13 @@ void RicAddStoredWellAllocationPlotFeature::onActionTriggered(bool isChecked)
|
||||
wellAllocationPlot->loadDataAndUpdate();
|
||||
|
||||
flowPlotColl->updateConnectedEditors();
|
||||
|
||||
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
if (mainPlotWindow)
|
||||
{
|
||||
mainPlotWindow->selectAsCurrentItem(wellAllocationPlot);
|
||||
mainPlotWindow->setExpanded(wellAllocationPlot, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,18 +18,7 @@
|
||||
|
||||
#include "RicShowContributingWellsFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimDefines.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWell.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "cafCmdFeatureManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -40,12 +29,6 @@ CAF_CMD_SOURCE_INIT(RicShowContributingWellsFeature, "RicShowContributingWellsFe
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowContributingWellsFeature::isCommandEnabled()
|
||||
{
|
||||
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
|
||||
if (!wellAllocationPlot) return false;
|
||||
|
||||
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
||||
if (!activeView) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -54,56 +37,20 @@ bool RicShowContributingWellsFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowContributingWellsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
|
||||
if (!wellAllocationPlot) return;
|
||||
// First, shot the well allocation plot
|
||||
// Then, use the feature to show contributing wells as this is based on the previous feature
|
||||
|
||||
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
||||
std::vector<std::string> commandIds;
|
||||
commandIds.push_back("RicShowWellAllocationPlotFeature");
|
||||
commandIds.push_back("RicShowContributingWellsFromPlotFeature");
|
||||
|
||||
if (activeView)
|
||||
for (auto commandId : commandIds)
|
||||
{
|
||||
activeView->cellResult()->setResultType(RimDefines::FLOW_DIAGNOSTICS);
|
||||
activeView->cellResult()->setResultVariable("MaxFractionTracer");
|
||||
activeView->cellResult()->loadDataAndUpdate();
|
||||
|
||||
activeView->cellResult()->updateConnectedEditors();
|
||||
|
||||
const std::vector<QString> contributingTracers = wellAllocationPlot->contributingTracerNames();
|
||||
|
||||
for (RimEclipseWell* well : activeView->wellCollection()->wells())
|
||||
auto* feature = caf::CmdFeatureManager::instance()->getCommandFeature(commandId);
|
||||
if (feature)
|
||||
{
|
||||
if (std::find(contributingTracers.begin(), contributingTracers.end(), well->name()) != contributingTracers.end()
|
||||
|| wellAllocationPlot->wellName() == well->name())
|
||||
{
|
||||
well->showWell = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
well->showWell = false;
|
||||
}
|
||||
feature->actionTriggered(false);
|
||||
}
|
||||
|
||||
// Disable all existing property filters, and
|
||||
// create a new property filter based on TOF for current well
|
||||
|
||||
RimEclipsePropertyFilterCollection* propertyFilterCollection = activeView->eclipsePropertyFilterCollection();
|
||||
|
||||
for (RimEclipsePropertyFilter* f : propertyFilterCollection->propertyFilters())
|
||||
{
|
||||
f->isActive = false;
|
||||
}
|
||||
|
||||
RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter();
|
||||
propertyFilterCollection->propertyFilters().push_back(propertyFilter);
|
||||
|
||||
propertyFilter->resultDefinition()->setEclipseCase(activeView->eclipseCase());
|
||||
propertyFilter->resultDefinition()->setTofAndSelectTracer(wellAllocationPlot->wellName());
|
||||
propertyFilter->resultDefinition()->loadDataAndUpdate();
|
||||
|
||||
propertyFilterCollection->updateConnectedEditors();
|
||||
|
||||
RiuMainWindow::instance()->setExpanded(propertyFilterCollection, true);
|
||||
|
||||
activeView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,6 +59,6 @@ void RicShowContributingWellsFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowContributingWellsFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
//actionToSetup->setIcon(QIcon(":/new_icon16x16.png"));
|
||||
actionToSetup->setIcon(QIcon(":/new_icon16x16.png"));
|
||||
actionToSetup->setText("Show Contributing Wells");
|
||||
}
|
||||
|
@ -0,0 +1,117 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicShowContributingWellsFromPlotFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimDefines.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWell.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicShowContributingWellsFromPlotFeature, "RicShowContributingWellsFromPlotFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
|
||||
{
|
||||
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
|
||||
if (!wellAllocationPlot) return false;
|
||||
|
||||
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
||||
if (!activeView) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
|
||||
if (!wellAllocationPlot) return;
|
||||
|
||||
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
||||
|
||||
if (activeView)
|
||||
{
|
||||
activeView->cellResult()->setResultType(RimDefines::FLOW_DIAGNOSTICS);
|
||||
activeView->cellResult()->setResultVariable("MaxFractionTracer");
|
||||
activeView->cellResult()->loadDataAndUpdate();
|
||||
|
||||
activeView->cellResult()->updateConnectedEditors();
|
||||
|
||||
const std::vector<QString> contributingTracers = wellAllocationPlot->contributingTracerNames();
|
||||
|
||||
for (RimEclipseWell* well : activeView->wellCollection()->wells())
|
||||
{
|
||||
if (std::find(contributingTracers.begin(), contributingTracers.end(), well->name()) != contributingTracers.end()
|
||||
|| wellAllocationPlot->wellName() == well->name())
|
||||
{
|
||||
well->showWell = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
well->showWell = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Disable all existing property filters, and
|
||||
// create a new property filter based on TOF for current well
|
||||
|
||||
RimEclipsePropertyFilterCollection* propertyFilterCollection = activeView->eclipsePropertyFilterCollection();
|
||||
|
||||
for (RimEclipsePropertyFilter* f : propertyFilterCollection->propertyFilters())
|
||||
{
|
||||
f->isActive = false;
|
||||
}
|
||||
|
||||
RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter();
|
||||
propertyFilterCollection->propertyFilters().push_back(propertyFilter);
|
||||
|
||||
propertyFilter->resultDefinition()->setEclipseCase(activeView->eclipseCase());
|
||||
propertyFilter->resultDefinition()->setTofAndSelectTracer(wellAllocationPlot->wellName());
|
||||
propertyFilter->resultDefinition()->loadDataAndUpdate();
|
||||
|
||||
propertyFilterCollection->updateConnectedEditors();
|
||||
|
||||
RiuMainWindow::instance()->setExpanded(propertyFilterCollection, true);
|
||||
|
||||
activeView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowContributingWellsFromPlotFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
//actionToSetup->setIcon(QIcon(":/new_icon16x16.png"));
|
||||
actionToSetup->setText("Show Contributing Wells");
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicShowContributingWellsFromPlotFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
|
@ -75,6 +75,6 @@ void RicShowWellAllocationPlotFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowWellAllocationPlotFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/new_icon16x16.png"));
|
||||
actionToSetup->setIcon(QIcon(":/WellAllocPlot16x16.png"));
|
||||
actionToSetup->setText("Show Well Allocation Plot");
|
||||
}
|
||||
|
@ -63,6 +63,10 @@ namespace caf
|
||||
|
||||
bool isDeletable(PdmUiItem * uiItem)
|
||||
{
|
||||
// Enable delete of well allocation plots
|
||||
if (dynamic_cast<RimWellAllocationPlot*>(uiItem)) return true;
|
||||
|
||||
// Disable delete of all sub objects of a well allocation plot
|
||||
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(uiItem);
|
||||
if (destinationObject)
|
||||
{
|
||||
|
@ -84,6 +84,7 @@ ${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.h
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.h
|
||||
${CEE_CURRENT_LIST_DIR}RimMultiSnapshotDefinition.h
|
||||
${CEE_CURRENT_LIST_DIR}RimMdiWindowController.h
|
||||
${CEE_CURRENT_LIST_DIR}RimPropertyFilter.h
|
||||
${CEE_CURRENT_LIST_DIR}RimEllipseFractureTemplate.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFractureTemplateCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFracture.h
|
||||
@ -178,6 +179,7 @@ ${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimMultiSnapshotDefinition.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimMdiWindowController.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimPropertyFilter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimEllipseFractureTemplate.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFractureTemplateCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFracture.cpp
|
||||
|
@ -18,8 +18,6 @@
|
||||
|
||||
#include "RimCellFilter.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
namespace caf
|
||||
@ -47,8 +45,6 @@ RimCellFilter::RimCellFilter()
|
||||
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
|
||||
isActive.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedCategoryValues, "SelectedValues", "Values", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&filterMode, "FilterType", "Filter Type", "", "", "");
|
||||
}
|
||||
|
||||
@ -67,14 +63,6 @@ caf::PdmFieldHandle* RimCellFilter::userDescriptionField()
|
||||
return &name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<int> RimCellFilter::selectedCategoryValues() const
|
||||
{
|
||||
return m_selectedCategoryValues;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -123,67 +111,3 @@ caf::PdmFieldHandle* RimCellFilter::objectToggleField()
|
||||
return &isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimCellFilter::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if (&m_selectedCategoryValues == fieldNeedingOptions)
|
||||
{
|
||||
if (useOptionsOnly) *useOptionsOnly = true;
|
||||
|
||||
if (m_categoryValues.size() == m_categoryNames.size())
|
||||
{
|
||||
for (size_t i = 0; i < m_categoryValues.size(); i++)
|
||||
{
|
||||
int categoryValue = m_categoryValues[i];
|
||||
QString categoryName = m_categoryNames[i];
|
||||
|
||||
options.push_back(caf::PdmOptionItemInfo(categoryName, categoryValue));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto it : m_categoryValues)
|
||||
{
|
||||
QString str = QString::number(it);
|
||||
options.push_back(caf::PdmOptionItemInfo(str, it));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilter::setCategoryValues(const std::vector<int>& categoryValues)
|
||||
{
|
||||
m_categoryValues = categoryValues;
|
||||
m_categoryNames.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilter::setCategoryNames(const std::vector<QString>& categoryNames)
|
||||
{
|
||||
m_categoryNames = categoryNames;
|
||||
|
||||
for (size_t i = 0; i < m_categoryNames.size(); i++)
|
||||
{
|
||||
m_categoryValues.push_back(static_cast<int>(i));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilter::clearCategories()
|
||||
{
|
||||
m_categoryValues.clear();
|
||||
m_categoryNames.clear();
|
||||
}
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
|
||||
@ -45,22 +44,9 @@ public:
|
||||
caf::PdmField<bool> isActive;
|
||||
caf::PdmField< caf::AppEnum< FilterModeType > > filterMode;
|
||||
|
||||
std::vector<int> selectedCategoryValues() const;
|
||||
|
||||
void updateIconState();
|
||||
|
||||
protected:
|
||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
|
||||
|
||||
void setCategoryValues(const std::vector<int>& categoryValues);
|
||||
void setCategoryNames(const std::vector<QString>& categoryNames);
|
||||
void clearCategories();
|
||||
|
||||
protected:
|
||||
std::vector<int> m_categoryValues;
|
||||
std::vector<QString> m_categoryNames;
|
||||
|
||||
caf::PdmField< std::vector<int> > m_selectedCategoryValues;
|
||||
};
|
||||
|
@ -197,6 +197,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
else if (dynamic_cast<RimEclipsePropertyFilter*>(uiItem))
|
||||
{
|
||||
commandIds << "RicEclipsePropertyFilterInsertFeature";
|
||||
commandIds << "RicApplyPropertyFilterAsCellResultFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimGeoMechPropertyFilterCollection*>(uiItem))
|
||||
{
|
||||
@ -205,6 +206,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
else if (dynamic_cast<RimGeoMechPropertyFilter*>(uiItem))
|
||||
{
|
||||
commandIds << "RicGeoMechPropertyFilterInsertFeature";
|
||||
commandIds << "RicApplyPropertyFilterAsCellResultFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellPathCollection*>(uiItem))
|
||||
{
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimCellFilter.h"
|
||||
#include "RimPropertyFilter.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
|
||||
@ -36,7 +36,7 @@ class RigCaseCellResultsData;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimEclipsePropertyFilter : public RimCellFilter
|
||||
class RimEclipsePropertyFilter : public RimPropertyFilter
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimCellFilter.h"
|
||||
#include "RimPropertyFilter.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
|
||||
@ -31,7 +31,7 @@ class RimGeoMechPropertyFilterCollection;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimGeoMechPropertyFilter : public RimCellFilter
|
||||
class RimGeoMechPropertyFilter : public RimPropertyFilter
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
|
112
ApplicationCode/ProjectDataModel/RimPropertyFilter.cpp
Normal file
112
ApplicationCode/ProjectDataModel/RimPropertyFilter.cpp
Normal file
@ -0,0 +1,112 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil ASA
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimPropertyFilter.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimPropertyFilter, "PropertyFilter");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPropertyFilter::RimPropertyFilter()
|
||||
{
|
||||
CAF_PDM_InitObject("Property Filter", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedCategoryValues, "SelectedValues", "Values", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPropertyFilter::~RimPropertyFilter()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<int> RimPropertyFilter::selectedCategoryValues() const
|
||||
{
|
||||
return m_selectedCategoryValues;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimPropertyFilter::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if (&m_selectedCategoryValues == fieldNeedingOptions)
|
||||
{
|
||||
if (useOptionsOnly) *useOptionsOnly = true;
|
||||
|
||||
if (m_categoryValues.size() == m_categoryNames.size())
|
||||
{
|
||||
for (size_t i = 0; i < m_categoryValues.size(); i++)
|
||||
{
|
||||
int categoryValue = m_categoryValues[i];
|
||||
QString categoryName = m_categoryNames[i];
|
||||
|
||||
options.push_back(caf::PdmOptionItemInfo(categoryName, categoryValue));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto it : m_categoryValues)
|
||||
{
|
||||
QString str = QString::number(it);
|
||||
options.push_back(caf::PdmOptionItemInfo(str, it));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPropertyFilter::setCategoryValues(const std::vector<int>& categoryValues)
|
||||
{
|
||||
m_categoryValues = categoryValues;
|
||||
m_categoryNames.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPropertyFilter::setCategoryNames(const std::vector<QString>& categoryNames)
|
||||
{
|
||||
m_categoryNames = categoryNames;
|
||||
|
||||
for (size_t i = 0; i < m_categoryNames.size(); i++)
|
||||
{
|
||||
m_categoryValues.push_back(static_cast<int>(i));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPropertyFilter::clearCategories()
|
||||
{
|
||||
m_categoryValues.clear();
|
||||
m_categoryNames.clear();
|
||||
}
|
49
ApplicationCode/ProjectDataModel/RimPropertyFilter.h
Normal file
49
ApplicationCode/ProjectDataModel/RimPropertyFilter.h
Normal file
@ -0,0 +1,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil ASA
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
// ResInsight 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimCellFilter.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPropertyFilter : public RimCellFilter
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimPropertyFilter();
|
||||
virtual ~RimPropertyFilter();
|
||||
|
||||
std::vector<int> selectedCategoryValues() const;
|
||||
|
||||
protected:
|
||||
void setCategoryValues(const std::vector<int>& categoryValues);
|
||||
void setCategoryNames(const std::vector<QString>& categoryNames);
|
||||
void clearCategories();
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
||||
protected:
|
||||
caf::PdmField< std::vector<int> > m_selectedCategoryValues;
|
||||
|
||||
std::vector<int> m_categoryValues;
|
||||
std::vector<QString> m_categoryNames;
|
||||
};
|
@ -553,8 +553,6 @@ void RiuMainWindow::createDockPanels()
|
||||
m_pdmUiPropertyView = new caf::PdmUiPropertyView(dockWidget);
|
||||
dockWidget->setWidget(m_pdmUiPropertyView);
|
||||
|
||||
m_pdmUiPropertyView->layout()->setContentsMargins(5,0,0,0);
|
||||
|
||||
addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
|
||||
}
|
||||
|
||||
|
@ -111,8 +111,7 @@ QSize RiuNightchartsWidget::sizeHint() const
|
||||
|
||||
if ( m_showLegend )
|
||||
{
|
||||
QPainter painter;
|
||||
int lineHeight = painter.fontMetrics().height();
|
||||
int lineHeight = this->fontMetrics().height();
|
||||
int lineCount = m_chart.pieceCount();
|
||||
|
||||
int exactLegendHeight = (lineCount + lineCount-1) * lineHeight;
|
||||
@ -186,8 +185,7 @@ void RiuNightchartsWidget::paintEvent(QPaintEvent* e)
|
||||
void RiuNightchartsWidget::addItem(const QString& name, const QColor& color, float value)
|
||||
{
|
||||
m_chart.addPiece(name, color, value);
|
||||
QPainter painter;
|
||||
int textWidth = painter.fontMetrics().width(name + " (00 %)");
|
||||
int textWidth = this->fontMetrics().width(name + " (00 %)");
|
||||
|
||||
m_maxNameWidth = textWidth > m_maxNameWidth ? textWidth: m_maxNameWidth;
|
||||
}
|
||||
|
@ -321,6 +321,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
|
||||
commandIds << "RicNewSimWellIntersectionFeature";
|
||||
commandIds << "RicShowWellAllocationPlotFeature";
|
||||
commandIds << "RicShowContributingWellsFeature";
|
||||
|
||||
RiuSelectionItem* selItem = new RiuSimWellSelectionItem(eclipseWellSourceInfo->well(), m_currentPickPositionInDomainCoords, eclipseWellSourceInfo->branchIndex());
|
||||
RiuSelectionManager::instance()->setSelectedItem(selItem, RiuSelectionManager::RUI_TEMPORARY);
|
||||
|
@ -171,7 +171,7 @@ void RiuWellAllocationPlot::contextMenuEvent(QContextMenuEvent* event)
|
||||
QMenu menu;
|
||||
QStringList commandIds;
|
||||
|
||||
commandIds << "RicShowContributingWellsFeature";
|
||||
commandIds << "RicShowContributingWellsFromPlotFeature";
|
||||
|
||||
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
|
||||
|
||||
|
@ -45,14 +45,15 @@
|
||||
#include "cafPdmUiOrdering.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QIntValidator>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QMessageBox>
|
||||
#include <QString>
|
||||
#include <QMainWindow>
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
#include <QPalette>
|
||||
#include <QStatusBar>
|
||||
#include <QString>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
@ -179,7 +180,21 @@ void PdmUiLineEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
|
||||
if (!m_lineEdit.isNull())
|
||||
{
|
||||
m_lineEdit->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
bool isReadOnly = field()->isUiReadOnly(uiConfigName);
|
||||
if (isReadOnly)
|
||||
{
|
||||
m_lineEdit->setReadOnly(true);
|
||||
|
||||
m_lineEdit->setStyleSheet("QLineEdit {"
|
||||
"color: #808080;"
|
||||
"background-color: #F0F0F0;}");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_lineEdit->setReadOnly(false);
|
||||
m_lineEdit->setStyleSheet("");
|
||||
}
|
||||
|
||||
m_lineEdit->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
{
|
||||
@ -255,7 +270,9 @@ void PdmUiLineEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
QWidget* PdmUiLineEditor::createEditorWidget(QWidget * parent)
|
||||
{
|
||||
m_lineEdit = new QLineEdit(parent);
|
||||
|
||||
connect(m_lineEdit, SIGNAL(editingFinished()), this, SLOT(slotEditingFinished()));
|
||||
|
||||
return m_lineEdit;
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "cafPdmUiDefaultObjectEditor.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QScrollArea>
|
||||
|
||||
|
||||
namespace caf
|
||||
@ -53,12 +54,20 @@ namespace caf
|
||||
PdmUiPropertyView::PdmUiPropertyView(QWidget* parent, Qt::WindowFlags f)
|
||||
: QWidget (parent, f)
|
||||
{
|
||||
m_layout = new QVBoxLayout(this);
|
||||
m_layout->insertStretch(1, 1);
|
||||
m_layout->setContentsMargins(0, 0, 0, 0);
|
||||
m_layout->setSpacing(0);
|
||||
QScrollArea* scrollArea = new QScrollArea(this);
|
||||
scrollArea->setFrameStyle(QFrame::NoFrame);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
|
||||
setLayout(m_layout);
|
||||
m_placeholder = new QWidget();
|
||||
scrollArea->setWidget(m_placeholder);
|
||||
|
||||
m_placeHolderLayout = new QVBoxLayout();
|
||||
m_placeHolderLayout->setContentsMargins(5,0,0,0);
|
||||
m_placeholder->setLayout(m_placeHolderLayout);
|
||||
|
||||
QVBoxLayout* dummy = new QVBoxLayout(this);
|
||||
dummy->setContentsMargins(0,0,0,0);
|
||||
dummy->addWidget(scrollArea);
|
||||
|
||||
m_currentObjectView = NULL;
|
||||
}
|
||||
@ -123,12 +132,11 @@ void PdmUiPropertyView::showProperties( PdmObjectHandle* object)
|
||||
// Remove Widget from layout
|
||||
if (m_currentObjectView)
|
||||
{
|
||||
layout()->removeWidget(m_currentObjectView->widget());
|
||||
this->m_placeHolderLayout->removeWidget(m_currentObjectView->widget());
|
||||
delete m_currentObjectView;
|
||||
m_currentObjectView = NULL;
|
||||
}
|
||||
|
||||
//m_currentObjectView = PdmObjViewFactory::instance()->create(object->editorType(m_uiConfigName));
|
||||
if (!m_currentObjectView)
|
||||
{
|
||||
PdmUiDefaultObjectEditor* defaultEditor = new PdmUiDefaultObjectEditor();
|
||||
@ -136,12 +144,15 @@ void PdmUiPropertyView::showProperties( PdmObjectHandle* object)
|
||||
}
|
||||
|
||||
// Create widget to handle this
|
||||
QWidget * page = NULL;
|
||||
page = m_currentObjectView->getOrCreateWidget(this);
|
||||
QWidget* propertyWidget = NULL;
|
||||
propertyWidget = m_currentObjectView->getOrCreateWidget(m_placeholder);
|
||||
|
||||
assert(propertyWidget);
|
||||
|
||||
assert(page);
|
||||
this->m_placeHolderLayout->insertWidget(0, propertyWidget);
|
||||
|
||||
this->m_layout->insertWidget(0, page);
|
||||
// Add stretch to make sure the property widget is not stretched
|
||||
this->m_placeHolderLayout->insertStretch(-1, 1);
|
||||
}
|
||||
|
||||
m_currentObjectView->setPdmObject(object);
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
@ -69,7 +70,8 @@ public:
|
||||
private:
|
||||
PdmUiObjectEditorHandle* m_currentObjectView;
|
||||
QString m_uiConfigName;
|
||||
QVBoxLayout* m_layout;
|
||||
QVBoxLayout* m_placeHolderLayout;
|
||||
QWidget* m_placeholder;
|
||||
};
|
||||
|
||||
|
||||
|
11
ThirdParty/nightcharts/nightcharts.cpp
vendored
11
ThirdParty/nightcharts/nightcharts.cpp
vendored
@ -37,7 +37,13 @@ Nightcharts::Nightcharts()//QPainter *painter)
|
||||
lX = cX+cW+20;
|
||||
lY = cY;
|
||||
shadows = true;
|
||||
|
||||
// NOTE: This value is accumulated, and might end up with overflow
|
||||
// Was originally uninitialized, and caused overflow issues and invalid drawing when running debug
|
||||
// Suggest rewrite and use locally defined aggregatedAngle (see below for usage)
|
||||
palpha = 0.0;
|
||||
}
|
||||
|
||||
Nightcharts::~Nightcharts()
|
||||
{
|
||||
pieces.clear();
|
||||
@ -143,6 +149,7 @@ int Nightcharts::draw(QPainter *painter)
|
||||
QPen pen;
|
||||
pen.setWidth(2);
|
||||
|
||||
double aggregatedAngle = 0.0;
|
||||
for (int i=0;i<pieces.size();i++)
|
||||
{
|
||||
gradient.setColorAt(0,pieces[i].rgbColor);
|
||||
@ -155,8 +162,8 @@ int Nightcharts::draw(QPainter *painter)
|
||||
pen.setColor(pieces[i].rgbColor);
|
||||
painter->setPen(pen);
|
||||
pdegree = 3.6*pieces[i].pPerc;
|
||||
painter->drawPie(cX,cY,cW,cH,palpha*16,pdegree*16);
|
||||
palpha += pdegree;
|
||||
painter->drawPie(cX,cY,cW,cH,aggregatedAngle*16,pdegree*16);
|
||||
aggregatedAngle += pdegree;
|
||||
}
|
||||
}
|
||||
else if (this->ctype==Nightcharts::Dpie)
|
||||
|
Loading…
Reference in New Issue
Block a user