mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-15 09:52:11 -05:00
Remove duplicated code
* Use annotation tools from part manager * Set version to 2023.06.01-dev.06
This commit is contained in:
1 parent
f4c61c9edb
commit
c22b8b2e1f
7 files changed
+65
-95
No files matched your search
@@ -88,15 +88,12 @@ void RivAnnotationTools::setCountHint( int countHint )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::Part> RivAnnotationTools::createPartFromPolyline( const std::string& partName,
|
||||
const cvf::Color3f& color,
|
||||
const std::vector<cvf::Vec3d>& polyLine )
|
||||
cvf::ref<cvf::Part> RivAnnotationTools::createPartFromPolyline( const cvf::Color3f& color, const std::vector<cvf::Vec3d>& polyLine )
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> drawableGeo = RivPolylineGenerator::createLineAlongPolylineDrawable( polyLine );
|
||||
if ( drawableGeo.isNull() ) return nullptr;
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName( partName );
|
||||
part->setDrawable( drawableGeo.p() );
|
||||
|
||||
caf::MeshEffectGenerator colorEffgen( color );
|
||||
@@ -333,9 +330,11 @@ void RivAnnotationTools::addAnnotationLabels( const cvf::Collection<cvf::Part>&
|
||||
std::vector<cvf::Vec3d> points = { lineAnchorPosition, labelPosition };
|
||||
|
||||
auto anchorLineColor = cvf::Color3f::BLACK;
|
||||
auto part = RivAnnotationTools::createPartFromPolyline( "AnnotationObjectAnchorPoints", anchorLineColor, points );
|
||||
auto part = RivAnnotationTools::createPartFromPolyline( anchorLineColor, points );
|
||||
|
||||
if ( part.notNull() )
|
||||
{
|
||||
part->setName( "AnnotationObjectAnchorPoints" );
|
||||
model->addPart( part.p() );
|
||||
}
|
||||
}
|
||||
@@ -365,11 +364,11 @@ void RivAnnotationTools::addAnnotationLabels( const cvf::Collection<cvf::Part>&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableText> RivAnnotationTools::createDrawableText( cvf::Font* font,
|
||||
cvf::Color3f textColor,
|
||||
cvf::Color3f backgroundColor,
|
||||
const std::string& text,
|
||||
const cvf::Vec3f& position )
|
||||
cvf::ref<cvf::DrawableText> RivAnnotationTools::createDrawableText( cvf::Font* font,
|
||||
const cvf::Color3f& textColor,
|
||||
const cvf::Color3f& backgroundColor,
|
||||
const std::string& text,
|
||||
const cvf::Vec3f& position )
|
||||
{
|
||||
auto drawableText = new cvf::DrawableText;
|
||||
|
||||
@@ -387,6 +386,27 @@ cvf::ref<cvf::DrawableText> RivAnnotationTools::createDrawableText( cvf::Font*
|
||||
return drawableText;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableText> RivAnnotationTools::createDrawableTextNoBackground( cvf::Font* font,
|
||||
const cvf::Color3f& textColor,
|
||||
const std::string& text,
|
||||
const cvf::Vec3f& position )
|
||||
{
|
||||
cvf::ref<cvf::DrawableText> drawableText = new cvf::DrawableText;
|
||||
|
||||
drawableText->setFont( font );
|
||||
drawableText->setCheckPosVisible( false );
|
||||
drawableText->setDrawBorder( false );
|
||||
drawableText->setDrawBackground( false );
|
||||
drawableText->setVerticalAlignment( cvf::TextDrawer::CENTER );
|
||||
drawableText->setTextColor( textColor );
|
||||
drawableText->addText( cvf::String( text ), position );
|
||||
|
||||
return drawableText;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user