2018-11-27 07:27:02 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2018-11-27 07:43:25 -06:00
|
|
|
// Copyright (C) 2018- Equinor ASA
|
2018-11-27 07:27:02 -06:00
|
|
|
//
|
|
|
|
// 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 "RimAnnotationLineAppearance.h"
|
2018-11-27 10:53:56 -06:00
|
|
|
#include "RimAnnotationCollection.h"
|
2018-11-27 07:27:02 -06:00
|
|
|
|
|
|
|
namespace caf
|
|
|
|
{
|
|
|
|
template<>
|
|
|
|
void RimAnnotationLineAppearance::LineStyle::setUp()
|
|
|
|
{
|
|
|
|
addItem(RimAnnotationLineAppearance::STYLE_SOLID, "STYLE_SOLID", "Solid");
|
|
|
|
addItem(RimAnnotationLineAppearance::STYLE_DASH, "STYLE_DASH", "Dashes");
|
|
|
|
|
|
|
|
setDefault(RimAnnotationLineAppearance::STYLE_SOLID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CAF_PDM_SOURCE_INIT(RimAnnotationLineAppearance, "RimAnnotationLineAppearance");
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimAnnotationLineAppearance::RimAnnotationLineAppearance()
|
|
|
|
{
|
|
|
|
CAF_PDM_InitObject("TextAnnotation", ":/WellCollection.png", "", "");
|
|
|
|
|
2018-11-27 10:53:56 -06:00
|
|
|
CAF_PDM_InitField(&m_color, "Color", cvf::Color3f(cvf::Color3f::BLACK), "Color", "", "", "");
|
|
|
|
CAF_PDM_InitField(&m_thickness, "Thickness", 2, "Thickness", "", "", "");
|
2018-11-27 07:27:02 -06:00
|
|
|
|
2018-11-27 10:53:56 -06:00
|
|
|
// Stippling not yet supported. Needs new stuff in VizFwk
|
|
|
|
CAF_PDM_InitField(&m_style, "Style", LineStyle(), "Style", "", "", "");
|
|
|
|
m_style.uiCapability()->setUiHidden(true);
|
|
|
|
m_style.xmlCapability()->disableIO();
|
2018-11-27 07:27:02 -06:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-11-27 10:53:56 -06:00
|
|
|
///
|
2018-11-27 07:27:02 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-11-27 10:53:56 -06:00
|
|
|
void RimAnnotationLineAppearance::setColor(const cvf::Color3f& newColor)
|
2018-11-27 07:27:02 -06:00
|
|
|
{
|
2018-11-27 10:53:56 -06:00
|
|
|
m_color = newColor;
|
2018-11-27 07:27:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-11-27 10:53:56 -06:00
|
|
|
cvf::Color3f RimAnnotationLineAppearance::color() const
|
2018-11-27 07:27:02 -06:00
|
|
|
{
|
2018-11-27 10:53:56 -06:00
|
|
|
return m_color();
|
2018-11-27 07:27:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-11-27 10:53:56 -06:00
|
|
|
bool RimAnnotationLineAppearance::isDashed() const
|
2018-11-27 07:27:02 -06:00
|
|
|
{
|
2018-11-27 10:53:56 -06:00
|
|
|
return m_style() == STYLE_DASH;
|
2018-11-27 07:27:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-11-27 10:53:56 -06:00
|
|
|
int RimAnnotationLineAppearance::thickness() const
|
2018-11-27 07:27:02 -06:00
|
|
|
{
|
2018-11-27 10:53:56 -06:00
|
|
|
return m_thickness();
|
2018-11-27 07:27:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimAnnotationLineAppearance::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
|
|
|
{
|
|
|
|
uiOrdering.add(&m_color);
|
|
|
|
uiOrdering.add(&m_style);
|
|
|
|
uiOrdering.add(&m_thickness);
|
|
|
|
|
|
|
|
uiOrdering.skipRemainingFields(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimAnnotationLineAppearance::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
|
|
|
const QVariant& oldValue,
|
|
|
|
const QVariant& newValue)
|
|
|
|
{
|
2018-11-27 10:53:56 -06:00
|
|
|
RimAnnotationCollection* annColl = nullptr;
|
|
|
|
this->firstAncestorOrThisOfTypeAsserted(annColl);
|
|
|
|
annColl->scheduleRedrawOfRelevantViews();
|
2018-11-27 07:27:02 -06:00
|
|
|
}
|