mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3773 Annotations. Set default color for line based annotations
This commit is contained in:
@@ -10,6 +10,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationLineAppearance.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimLineBasedAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationColorFactory.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -23,6 +24,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationLineAppearance.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimLineBasedAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationColorFactory.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimAnnotationColorFactory.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesFromFileAnnotation.h"
|
||||
@@ -134,7 +135,6 @@ RimPolylinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylines
|
||||
{
|
||||
QStringList newFileNames;
|
||||
std::vector<RimPolylinesFromFileAnnotation*> polyLinesObjsToReload;
|
||||
size_t formationListBeforeImportCount = m_polylineFromFileAnnotations.size();
|
||||
|
||||
for(const QString& newFileName : fileNames)
|
||||
{
|
||||
@@ -160,7 +160,7 @@ RimPolylinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylines
|
||||
{
|
||||
RimPolylinesFromFileAnnotation* newPolyLinesAnnot = new RimPolylinesFromFileAnnotation;
|
||||
|
||||
auto newColor = RiaColorTables::categoryPaletteColors().cycledColor3f(formationListBeforeImportCount + newLinesIdx);
|
||||
auto newColor = RimAnnotationColorFactory::getColor(lineBasedAnnotationsCount());
|
||||
|
||||
newPolyLinesAnnot->setFileName(newFileName);
|
||||
newPolyLinesAnnot->setDescriptionFromFileName();
|
||||
@@ -174,10 +174,9 @@ RimPolylinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylines
|
||||
|
||||
reloadPolylinesFromFile(polyLinesObjsToReload);
|
||||
|
||||
|
||||
if (m_polylineFromFileAnnotations.size() > formationListBeforeImportCount)
|
||||
if (!newFileNames.empty())
|
||||
{
|
||||
return m_polylineFromFileAnnotations[m_polylineFromFileAnnotations.size() - 1];
|
||||
return m_polylineFromFileAnnotations.childObjects().back();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimAnnotationColorFactory.h"
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RimAnnotationColorFactory::getColor(int index)
|
||||
{
|
||||
return RiaColorTables::categoryPaletteColors().cycledColor3f(index);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cvfBase.h>
|
||||
#include <cvfColor3.h>
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimAnnotationColorFactory
|
||||
{
|
||||
public:
|
||||
static cvf::Color3f getColor(int index);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user