mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3924 Measurements : Rename, fix issues with points in multiple views
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -26,10 +26,8 @@
|
||||
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimMeasurement, "RimMeasurement");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -40,12 +38,9 @@ RimMeasurement::RimMeasurement()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMeasurement::~RimMeasurement()
|
||||
{
|
||||
|
||||
}
|
||||
RimMeasurement::~RimMeasurement() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -74,18 +69,27 @@ bool RimMeasurement::isInMeasurementMode() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMeasurement::addPointInDomain(const Vec3d& pointInDomain)
|
||||
void RimMeasurement::addPointInDomainCoords(const Vec3d& domainCoord)
|
||||
{
|
||||
m_pointsInDomain.push_back(pointInDomain);
|
||||
auto activeView = RiaApplication::instance()->activeReservoirView();
|
||||
|
||||
if (m_sourceView.p() != activeView)
|
||||
{
|
||||
removeAllPoints();
|
||||
}
|
||||
|
||||
m_pointsInDomainCoords.push_back(domainCoord);
|
||||
m_sourceView = activeView;
|
||||
|
||||
updateView();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<cvf::Vec3d> RimMeasurement::pointsInDomain() const
|
||||
std::vector<cvf::Vec3d> RimMeasurement::pointsInDomainCoords() const
|
||||
{
|
||||
return m_pointsInDomain;
|
||||
return m_pointsInDomainCoords;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -93,7 +97,7 @@ std::vector<cvf::Vec3d> RimMeasurement::pointsInDomain() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMeasurement::removeAllPoints()
|
||||
{
|
||||
m_pointsInDomain.clear();
|
||||
m_pointsInDomainCoords.clear();
|
||||
updateView();
|
||||
}
|
||||
|
||||
@@ -117,10 +121,10 @@ RimMeasurement::Lengths RimMeasurement::calculateLenghts() const
|
||||
{
|
||||
Lengths lengths;
|
||||
|
||||
for (size_t p = 1; p < m_pointsInDomain.size(); p++)
|
||||
for (size_t p = 1; p < m_pointsInDomainCoords.size(); p++)
|
||||
{
|
||||
const auto& p0 = m_pointsInDomain[p - 1];
|
||||
const auto& p1 = m_pointsInDomain[p];
|
||||
const auto& p0 = m_pointsInDomainCoords[p - 1];
|
||||
const auto& p1 = m_pointsInDomainCoords[p];
|
||||
|
||||
lengths.lastSegmentLength = (p1 - p0).length();
|
||||
|
||||
@@ -140,6 +144,8 @@ RimMeasurement::Lengths RimMeasurement::calculateLenghts() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMeasurement::updateView() const
|
||||
{
|
||||
auto view = RiaApplication::instance()->activeReservoirView();
|
||||
if (view) view->createDisplayModelAndRedraw();
|
||||
if (m_sourceView)
|
||||
{
|
||||
m_sourceView->createDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,28 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfVector3.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class Rim3dView;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -37,11 +39,13 @@ public:
|
||||
{
|
||||
public:
|
||||
Lengths()
|
||||
: totalLength(0),
|
||||
lastSegmentLength(0),
|
||||
totalHorizontalLength(0),
|
||||
lastSegmentHorisontalLength(0),
|
||||
area(0) {}
|
||||
: totalLength(0)
|
||||
, lastSegmentLength(0)
|
||||
, totalHorizontalLength(0)
|
||||
, lastSegmentHorisontalLength(0)
|
||||
, area(0)
|
||||
{
|
||||
}
|
||||
|
||||
double totalLength;
|
||||
double lastSegmentLength;
|
||||
@@ -53,24 +57,23 @@ public:
|
||||
RimMeasurement();
|
||||
~RimMeasurement() override;
|
||||
|
||||
void setMeasurementMode(bool measurementMode);
|
||||
bool isInMeasurementMode() const;
|
||||
void setMeasurementMode(bool measurementMode);
|
||||
bool isInMeasurementMode() const;
|
||||
|
||||
void addPointInDomain(const Vec3d& pointInDomain);
|
||||
std::vector<Vec3d> pointsInDomain() const;
|
||||
void addPointInDomainCoords(const Vec3d& pointInDomainCoord);
|
||||
std::vector<Vec3d> pointsInDomainCoords() const;
|
||||
|
||||
void removeAllPoints();
|
||||
void removeAllPoints();
|
||||
|
||||
QString label() const;
|
||||
QString label() const;
|
||||
|
||||
private:
|
||||
Lengths calculateLenghts() const;
|
||||
Lengths calculateLenghts() const;
|
||||
|
||||
void updateView() const;
|
||||
|
||||
void updateView() const;
|
||||
|
||||
bool m_isInMeasurementMode;
|
||||
|
||||
std::vector<Vec3d> m_pointsInDomain;
|
||||
private:
|
||||
bool m_isInMeasurementMode;
|
||||
std::vector<Vec3d> m_pointsInDomainCoords;
|
||||
caf::PdmPointer<Rim3dView> m_sourceView;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user