[Developers] {Spam?} how to display a small 2D section
Helene Huck
helene.huck at dgb-group.com
Mon Jan 22 12:52:41 CET 2007
Hi all,
We are currently developing a brand-new 2D Viewer which can either be
displayed separately or be included in one of your pre-existing windows
or dialogs. It is already available in the latest development release
and will be in the next stable version 3.0.
First of all some description of the architecture:
*The basic needs for the viewer are split into two parts : the "Data"
and the "Context" which holds everything but the data itself (
annotations, positioning, colors...); you can have a look at those base
classes in /General/flatdisp.h /.
*The display of sections is handled by a new object, "uiSectionDisp"
(/uiFlatDisp/uisectiondisp.h/); although the display is nice and
'advanced' (!), this object is kind of dumb in that it only displays
data and annotations, no window menu... This is then the issue of
managing objects like the "VertViewer" for instance
(/uiFlatDisp/uiflatvertview.h/ ), but this is for more advanced usage
of the viewer, as for now let's just see how to create a small section
display :
You can see a nice example of usage by selecting in opendTect the menu
'Survey' (previously 'File') then 'Manage' and 'Wavelets...' ; here the
idea is basically to offer a preview of the selected wavelet. You can
find the corresponding code in /uiSeis/uiseiswvltman.cc/.
how do we set up the viewer? just by following 3 steps:
*1)//<set up the context : positioning, colors... a lot of those display
parameters are optional, here is a small example of what is possible,
for more options please have a look at file /flatdisp.h/>//
fdctxt_ = *new FlatDisp::Context(false);
//<the argument stands for the background color: false = black, true =
white>//
fdctxt_.ddpars_.dispvd_ = false; //<do not display variable density
data>//
fdctxt_.ddpars_.dispwva_ = true; //<display data as wiggles>//
fdctxt_.ddpars_.wva_.clipperc_ = 0;
fdctxt_.ddpars_.wva_.mid_= Color( 150, 150, 100 );
//< color of the middle line, if not specified there will be no middle
line drawn; the mid-level can be set to something else than 0, if set to
Undef it will be determined from the data.>//
*2)//< create the section display: give it the context, optional: give
your display a specific size, default will be 300*500 pixels >//
wvltfld_ = new uiSectionDisp( this, fdctxt_, uiSize(50,mUdf(int),true) );
*3)//< create and set data: >//
fddata_ = new FlatDisp::Data;
fda2d_ = new Array2DImpl<float>( 1, wvltsz );
memcpy( fda2d_->getData(), wvlt->samples(), wvltsz * sizeof(float) );
fddata_->set( true, fda2d_, wvlt->name() );
wvltfld_->setData( fddata_ );
where fdctxt_, wvltfld_ , fda2d_ and fddata_ are members of my class,
wvlt is my selected wavelet, and wvltsz is its size.
The section display can be positioned in your dialog as any other field:
wvltfld_->attach( ensureRightOf, selectiongrp );
that's it. In my opinion not to difficult to use and quite handy, in
this case it just creates a simple "thumbnail" view of the wavelet, as
shown in the actached picture.
/Helene
--
-- dGB Earth Sciences B.V.
-- Nijverheidstraat 11-2, 7511 JM Enschede, The Netherlands
-- mailto: helene.huck at dgb-group.com, http://www.dgb-group.com
-- Tel: +31 53 4315155 , Fax: +31 53 4315104
--
-- dGB Earth Sciences B.V.
-- Nijverheidstraat 11-2, 7511 JM Enschede, The Netherlands
-- mailto: helene.huck at dgb-group.com, http://www.dgb-group.com
-- Tel: +31 53 4315155 , Fax: +31 53 4315104
-------------- next part --------------
A non-text attachment was scrubbed...
Name: man_wvlt_sectiondisp.jpg
Type: image/jpeg
Size: 45644 bytes
Desc: not available
URL: <http://lists.opendtect.org/pipermail/developers/attachments/20070122/e7e99703/attachment.jpg>
More information about the Developers
mailing list