ResInsight/ApplicationLibCode/ModelVisualization/RivAnnotationTools.h
Magne Sjaastad 10189da362
Fix display of intersection lines in 3D view
* 10675 Fix missing intersection line geometry
* Change to list of visible surface intersection lines
* Enable surface intersection band for any intersection
* Show labels for intersection curves in 3D

The polylines are defined in the display coordinate system without Z-scaling. The z-scaling is applied to the visualization parts using Part::setTransform(Transform* transform)
The annotation objects are defined by display coordinates, so apply the Z-scaling to the coordinates.

* Improve naming of surfaces
* Use scaling factor of 1.0 for flat intersection views
2023-10-03 09:04:46 +02:00

83 lines
2.9 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023 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 "cvfCollection.h"
#include "cvfColor3.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include <string>
#include <vector>
namespace cvf
{
class Part;
class Camera;
class ModelBasicList;
class DrawableText;
class Font;
} // namespace cvf
class RivAnnotationTools
{
public:
enum class LabelPositionStrategy
{
RIGHT,
LEFT,
LEFT_AND_RIGHT,
COUNT_HINT,
ALL,
NONE,
UNDEFINED
};
RivAnnotationTools();
// By default, each annotation object has a label position strategy. Use this method to override the default.
void setOverrideLabelPositionStrategy( LabelPositionStrategy strategy );
// When using COUNT_HINT, this number is used to determine the number of labels to show.
void setCountHint( int countHint );
// Create labels for the given collection of parts. The labels are added to the given model.
void addAnnotationLabels( const cvf::Collection<cvf::Part>& partCollection,
const cvf::Camera* camera,
cvf::ModelBasicList* model,
bool computeScalingFactor );
static cvf::ref<cvf::Part> createPartFromPolyline( const cvf::Color3f& color, const std::vector<cvf::Vec3d>& polyLine );
static cvf::ref<cvf::DrawableText> createDrawableText( cvf::Font* font,
const cvf::Color3f& textColor,
const cvf::Color3f& backgroundColor,
const std::string& text,
const cvf::Vec3f& position );
static cvf::ref<cvf::DrawableText>
createDrawableTextNoBackground( cvf::Font* font, const cvf::Color3f& textColor, const std::string& text, const cvf::Vec3f& position );
static cvf::ref<cvf::Part> createPart( cvf::DrawableText* drawableText );
private:
LabelPositionStrategy m_overrideStrategy;
int m_labelCountHint;
};