-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add annotation label data structures
- Loading branch information
Showing
5 changed files
with
659 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
ApplicationLibCode/ModelVisualization/RivAnnotationSourceInfo.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
///////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// 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. | ||
// | ||
///////////////////////////////////////////////////////////////////////////////// | ||
|
||
#include "RivAnnotationSourceInfo.h" | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
RivAnnotationSourceInfo::RivAnnotationSourceInfo( const std::string& text, const std::vector<cvf::Vec3d>& displayCoords ) | ||
: m_text( text ) | ||
, m_showColor( false ) | ||
, m_color( cvf::Color3f( cvf::Color3f::BLACK ) ) | ||
, m_labelPositionHint( RivAnnotationTools::LabelPositionStrategy::RIGHT ) | ||
, m_anchorPointsInDisplayCoords( displayCoords ) | ||
{ | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
RivAnnotationSourceInfo::RivAnnotationSourceInfo( const std::vector<std::string>& texts, const std::vector<cvf::Vec3d>& displayCoords ) | ||
: m_showColor( false ) | ||
, m_color( cvf::Color3f( cvf::Color3f::BLACK ) ) | ||
, m_labelPositionHint( RivAnnotationTools::LabelPositionStrategy::COUNT_HINT ) | ||
, m_anchorPointsInDisplayCoords( displayCoords ) | ||
, m_texts( texts ) | ||
{ | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
RivAnnotationTools::LabelPositionStrategy RivAnnotationSourceInfo::labelPositionStrategyHint() const | ||
{ | ||
return m_labelPositionHint; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
void RivAnnotationSourceInfo::setLabelPositionStrategyHint( RivAnnotationTools::LabelPositionStrategy strategy ) | ||
{ | ||
m_labelPositionHint = strategy; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
std::string RivAnnotationSourceInfo::text() const | ||
{ | ||
return m_text; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
std::vector<std::string> RivAnnotationSourceInfo::texts() const | ||
{ | ||
return m_texts; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
std::vector<cvf::Vec3d> RivAnnotationSourceInfo::anchorPointsInDisplayCoords() const | ||
{ | ||
return m_anchorPointsInDisplayCoords; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
bool RivAnnotationSourceInfo::showColor() const | ||
{ | ||
return m_showColor; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
void RivAnnotationSourceInfo::setShowColor( bool showColor ) | ||
{ | ||
m_showColor = showColor; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
cvf::Color3f RivAnnotationSourceInfo::color() const | ||
{ | ||
return m_color; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
void RivAnnotationSourceInfo::setColor( const cvf::Color3f& color ) | ||
{ | ||
m_color = color; | ||
} |
60 changes: 60 additions & 0 deletions
60
ApplicationLibCode/ModelVisualization/RivAnnotationSourceInfo.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
///////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// 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 "RivAnnotationTools.h" | ||
|
||
#include "cvfObject.h" | ||
#include "cvfVector3.h" | ||
|
||
//================================================================================================== | ||
/// | ||
/// | ||
//================================================================================================== | ||
class RivAnnotationSourceInfo : public cvf::Object | ||
{ | ||
public: | ||
// Construct an object used to display a single text that can be positioned at several candidate positions. Can be used to display a | ||
// label for a long and narrow structure like a surface intersection line. | ||
RivAnnotationSourceInfo( const std::string& text, const std::vector<cvf::Vec3d>& displayCoords ); | ||
|
||
// Construct an object used to display a text at a single position. Can be used to display measured depth as labels along a well path. | ||
RivAnnotationSourceInfo( const std::vector<std::string>& texts, const std::vector<cvf::Vec3d>& displayCoords ); | ||
|
||
RivAnnotationTools::LabelPositionStrategy labelPositionStrategyHint() const; | ||
void setLabelPositionStrategyHint( RivAnnotationTools::LabelPositionStrategy strategy ); | ||
|
||
std::string text() const; | ||
std::vector<std::string> texts() const; | ||
std::vector<cvf::Vec3d> anchorPointsInDisplayCoords() const; | ||
|
||
bool showColor() const; | ||
void setShowColor( bool showColor ); | ||
|
||
cvf::Color3f color() const; | ||
void setColor( const cvf::Color3f& color ); | ||
|
||
private: | ||
std::string m_text; | ||
bool m_showColor; | ||
cvf::Color3f m_color; | ||
RivAnnotationTools::LabelPositionStrategy m_labelPositionHint; | ||
std::vector<cvf::Vec3d> m_anchorPointsInDisplayCoords; | ||
std::vector<std::string> m_texts; | ||
}; |
Oops, something went wrong.