#3773 Annotations. Set default color for line based annotations

This commit is contained in:
Bjørn Erik Jensen
2018-11-28 15:00:10 +01:00
parent 0148fc2279
commit bbec88b5d1
6 changed files with 77 additions and 5 deletions

View File

@@ -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

View File

@@ -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
{

View File

@@ -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);
}

View File

@@ -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);
};