OpendTect-6_4  6.4
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
uiWorld2Ui Class Reference

Class to provide coordinate conversion between a cartesian coordinate system (or any other transformed cartesian) and UI coordinate system(screen coordinate system.) More...

Public Member Functions

 uiWorld2Ui ()
 
 uiWorld2Ui (const uiSize &sz, const uiWorldRect &wr)
 
 uiWorld2Ui (const uiRect &rc, const uiWorldRect &wr)
 
 uiWorld2Ui (const uiWorldRect &wr, const uiSize &sz)
 
 uiWorld2Ui (const World2UiData &w)
 
bool operator== (const uiWorld2Ui &) const
 
void set (const World2UiData &w)
 
void set (const uiWorldRect &wr, const uiSize &sz)
 
void set (const uiSize &sz, const uiWorldRect &wr)
 
void set (const uiRect &rc, const uiWorldRect &wr)
 
void set (uiRect rc, const SurveyInfo &si)
 
void setRemap (const uiSize &sz, const uiWorldRect &wrdrc)
 Quite useful for survey level maps. More...
 
void setRemap (const uiRect &rc, const uiWorldRect &wrdrc)
 
void setCartesianRemap (const uiSize &sz, float minx, float maxx, float miny, float maxy)
 
void setCartesianRemap (const uiRect &rc, float minx, float maxx, float miny, float maxy)
 
void resetUiRect (const uiRect &rc)
 
const World2UiDataworld2UiData () const
 
uiWorldPoint transform (uiPoint p) const
 
uiWorldRect transform (uiRect area) const
 
uiPoint transform (uiWorldPoint p) const
 
uiRect transform (uiWorldRect area) const
 
void transform (const uiPoint &upt, Geom::Point2D< float > &pt) const
 
void transform (const Geom::Point2D< float > &pt, uiPoint &upt) const
 
int toUiX (float wrdx) const
 
int toUiY (float wrdy) const
 
float toWorldX (int uix) const
 
float toWorldY (int uiy) const
 
uiWorldPoint origin () const
 
uiWorldPoint worldPerPixel () const
 numbers may be negative More...
 
void getWorldXRange (float &xmin, float &xmax) const
 
void getWorldYRange (float &ymin, float &ymax) const
 

Protected Attributes

World2UiData w2ud
 
uiWorldPoint p0
 
uiWorldPoint fac
 
uiWorldRect wrdrect_
 the world rect used for coord. conv. More...
 
uiSize uisize_
 
uiPoint uiorigin
 

Private Member Functions

void getAppropriateRange (float min, float max, float &newmin, float &newmax)
 

Detailed Description

Class to provide coordinate conversion between a cartesian coordinate system (or any other transformed cartesian) and UI coordinate system(screen coordinate system.)

Use the constructor or call set() to set up the two coordinate systems. 1) If the origin of UI is not at (0,0), use uiRect instead of uiSize to set up the UI coordinates. 2) In many cases the 'border' of world coordinate system is not at a good place, e.x. X ( 0.047 - 0.987 ). we would prefer to set it to an more appropriate range ( 0 - 1 ) and re-map this range to the UI window. This is done by calling setRemap() or setCartesianRemap(). The proper range is estimated by these functions and coordinate conversion will be based on the new world X/Y range.

Constructor & Destructor Documentation

uiWorld2Ui::uiWorld2Ui ( )
uiWorld2Ui::uiWorld2Ui ( const uiSize sz,
const uiWorldRect wr 
)
uiWorld2Ui::uiWorld2Ui ( const uiRect rc,
const uiWorldRect wr 
)
uiWorld2Ui::uiWorld2Ui ( const uiWorldRect wr,
const uiSize sz 
)
uiWorld2Ui::uiWorld2Ui ( const World2UiData w)

Member Function Documentation

void uiWorld2Ui::getAppropriateRange ( float  min,
float  max,
float &  newmin,
float &  newmax 
)
private
void uiWorld2Ui::getWorldXRange ( float &  xmin,
float &  xmax 
) const

If the world X/Y range has been re-calculated by calling setRemap() or setCartesianRemap(), call these two functions to get the new value

void uiWorld2Ui::getWorldYRange ( float &  ymin,
float &  ymax 
) const
bool uiWorld2Ui::operator== ( const uiWorld2Ui ) const
uiWorldPoint uiWorld2Ui::origin ( ) const
void uiWorld2Ui::resetUiRect ( const uiRect rc)

The following reset...() functions must be called ONLY AFTER a call to set...() is made.

void uiWorld2Ui::set ( const World2UiData w)
void uiWorld2Ui::set ( const uiWorldRect wr,
const uiSize sz 
)
void uiWorld2Ui::set ( const uiSize sz,
const uiWorldRect wr 
)
void uiWorld2Ui::set ( const uiRect rc,
const uiWorldRect wr 
)
void uiWorld2Ui::set ( uiRect  rc,
const SurveyInfo si 
)
void uiWorld2Ui::setCartesianRemap ( const uiSize sz,
float  minx,
float  maxx,
float  miny,
float  maxy 
)

For most cases we are dealing with cartesian coord. system. Just pass the X/Y range to set up

void uiWorld2Ui::setCartesianRemap ( const uiRect rc,
float  minx,
float  maxx,
float  miny,
float  maxy 
)
void uiWorld2Ui::setRemap ( const uiSize sz,
const uiWorldRect wrdrc 
)

Quite useful for survey level maps.

void uiWorld2Ui::setRemap ( const uiRect rc,
const uiWorldRect wrdrc 
)
int uiWorld2Ui::toUiX ( float  wrdx) const
int uiWorld2Ui::toUiY ( float  wrdy) const
float uiWorld2Ui::toWorldX ( int  uix) const
float uiWorld2Ui::toWorldY ( int  uiy) const
uiWorldPoint uiWorld2Ui::transform ( uiPoint  p) const
uiWorldRect uiWorld2Ui::transform ( uiRect  area) const
uiPoint uiWorld2Ui::transform ( uiWorldPoint  p) const
uiRect uiWorld2Ui::transform ( uiWorldRect  area) const
void uiWorld2Ui::transform ( const uiPoint upt,
Geom::Point2D< float > &  pt 
) const
void uiWorld2Ui::transform ( const Geom::Point2D< float > &  pt,
uiPoint upt 
) const
const World2UiData& uiWorld2Ui::world2UiData ( ) const
uiWorldPoint uiWorld2Ui::worldPerPixel ( ) const

numbers may be negative

Member Data Documentation

uiWorldPoint uiWorld2Ui::fac
protected
uiWorldPoint uiWorld2Ui::p0
protected
uiPoint uiWorld2Ui::uiorigin
protected
uiSize uiWorld2Ui::uisize_
protected
World2UiData uiWorld2Ui::w2ud
protected
uiWorldRect uiWorld2Ui::wrdrect_
protected

the world rect used for coord. conv.


Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019