Fréchet View  1.6.0
A Tool for Exploring Fréchet Distance Algorithms
frechet::view::CellView Class Reference

Detailed Description

displays one cell of the free-space diagram.

A cell is either empty, completely covered, or displays a section of an ellipse.

Content color is variable (k-Frechet uses colors for components).

Optionally, reachable intervals are shown at the border of the cell.

Optionally, the bounding rectangle of the content area is shown.

Ellipses are implemented as a circle object, that is applied an affine transformation (see FreeSpaceView::createEllipseTransform). The resulting ellipse is clipped at the bounds of each cell.

Degenerate ellipses, which become excessively large, are replaced by an approximated polygon (i.e. two parallel lines). The same is true if the ellipse covers the cell completely.

Author
Peter Schäfer

Definition at line 40 of file freespaceview.h.

#include <freespaceview.h>

Inherits QGraphicsItemGroup.

Public Types

typedef data::Array2D< CellView * > Matrix
 an array of cell views More...
 
typedef boost::shared_ptr< MatrixMatrixPtr
 pointer to an array of cell views More...
 

Public Member Functions

 CellView (FreeSpaceView *parent, int i, int j)
 default constructor More...
 
virtual ~CellView ()
 destructor More...
 
void setColor (QColor areaColor, QColor borderColor=QColor())
 update drawing colors More...
 
void update (double eps, bool showBounds, QLineF bounds[4])
 update display More...
 
virtual QPainterPath shape () const
 
virtual QRectF boundingRect () const
 
bool dropUnusedItems ()
 release graphics items that are not currently displayed More...
 

Private Types

enum  What {
  MASK = 0x00f, NOTHING = 0x00, POLY = 0x01, ELLIPSE = 0x02,
  BOUNDS = 0x10, ELLIPSE_AND_BOUNDS = ELLIPSE|BOUNDS, POLY_AND_BOUNDS = POLY|BOUNDS
}
 display mode; what is displayed? Flags can be combined (except Poly and Ellipse). More...
 

Private Member Functions

QPolygonF createPolygon (int i, int j, bool *thin)
 create a polygon that draws the content area More...
 
QGraphicsPolygonItem * getPoly ()
 
QGraphicsEllipseItem * getEllipse ()
 
QGraphicsLineItem * getBounds (int i)
 
void setBounds (QLineF bounds[4])
 update bounding rectangle More...
 
void dodraw (What what)
 update content More...
 
void dropUnusedItem (QGraphicsItem **item)
 release an unused item More...
 

Static Private Member Functions

static void setBrushColor (QAbstractGraphicsShapeItem *item, QColor col)
 update brush (fill) color of a graphics item More...
 
static void setPenColor (QAbstractGraphicsShapeItem *item, QColor col)
 update pen (edge) color of a graphics item More...
 
static void setBoundsPenColor (QGraphicsLineItem **bounds, int len, QColor col)
 update pen color of several graphics item More...
 
static void setPenStyle (QAbstractGraphicsShapeItem *item, Qt::PenStyle style)
 update pen style (dotted,solid,...) of a graphics item More...
 
static void setPenStyleWidth (QAbstractGraphicsShapeItem *item, Qt::PenStyle style, float width)
 update pen style and pen width of a graphics item More...
 

Private Attributes

int i
 column index in free-space grid More...
 
int j
 row index in free-space grid More...
 
FreeSpaceViewparent
 pointer to parent More...
 
QRectF cellBounds
 bounding rectangle More...
 
QPainterPath clipShape
 shape used for clipping ellipses More...
 
QGraphicsPolygonItem * _poly
 content area may be a polygon (created on demand) More...
 
QGraphicsEllipseItem * _ellipse
 
bool useEllipse
 true if an ellipse is to be shown More...
 
QGraphicsLineItem * _bounds [4]
 boundary lines of the content area More...
 
enum frechet::view::CellView::What what
 

Static Private Attributes

static const double DET_MINIMUM
 determines when a hige ellipse is replaced by two parallel lines More...
 
static const double MAX_DIAMETER = 1e5
 what's this? More...
 

Friends

class FreeSpaceView
 

Member Typedef Documentation

◆ Matrix

an array of cell views

Definition at line 83 of file freespaceview.h.

◆ MatrixPtr

typedef boost::shared_ptr<Matrix> frechet::view::CellView::MatrixPtr

pointer to an array of cell views

Definition at line 85 of file freespaceview.h.

Member Enumeration Documentation

◆ What

display mode; what is displayed? Flags can be combined (except Poly and Ellipse).

Enumerator
MASK 

bit mask

NOTHING 

empty cell. display nothing

POLY 

display a polygon

ELLIPSE 

display a clipped ellipse

BOUNDS 

display bounding rect

ELLIPSE_AND_BOUNDS 

display ellipse plus bounding rect

POLY_AND_BOUNDS 

display polygon plus bounding rect

Definition at line 69 of file freespaceview.h.

Constructor & Destructor Documentation

◆ CellView()

CellView::CellView ( FreeSpaceView parent,
int  i,
int  j 
)

default constructor

Parameters
parentparent widget
icolumn index in free-space grid
jrow index in free-space grid

Definition at line 660 of file freespaceview.cpp.

◆ ~CellView()

CellView::~CellView ( )
virtual

destructor

Definition at line 676 of file freespaceview.cpp.

Member Function Documentation

◆ boundingRect()

virtual QRectF frechet::view::CellView::boundingRect ( ) const
inlinevirtual
Returns
the bounding rect of the cell

Definition at line 117 of file freespaceview.h.

◆ createPolygon()

QPolygonF CellView::createPolygon ( int  i,
int  j,
bool *  thin 
)
private

create a polygon that draws the content area

Parameters
igrid column
jgrid row
thinwhen parallel lines are close
Returns
a closed polyg

Definition at line 1042 of file freespaceview.cpp.

◆ dodraw()

void CellView::dodraw ( What  what)
private

update content

Parameters
whatwhat should be displayed?

Definition at line 814 of file freespaceview.cpp.

◆ dropUnusedItem()

void CellView::dropUnusedItem ( QGraphicsItem **  item)
private

release an unused item

Parameters
itemhandle to graphics item

Definition at line 878 of file freespaceview.cpp.

◆ dropUnusedItems()

bool CellView::dropUnusedItems ( )

release graphics items that are not currently displayed

Returns
true if items were released

Definition at line 886 of file freespaceview.cpp.

◆ getBounds()

QGraphicsLineItem * CellView::getBounds ( int  i)
private
Returns
one line of the bounding rectangle (or nullptr)
Parameters
i0 through 3

Definition at line 714 of file freespaceview.cpp.

◆ getEllipse()

QGraphicsEllipseItem * CellView::getEllipse ( )
private
Returns
graphics item for drawing an ellipse (created on demand)

Definition at line 695 of file freespaceview.cpp.

◆ getPoly()

QGraphicsPolygonItem * CellView::getPoly ( )
private
Returns
graphics item for drawing a polygon (created on demand)

Definition at line 684 of file freespaceview.cpp.

◆ setBounds()

void CellView::setBounds ( QLineF  bounds[4])
private

update bounding rectangle

Definition at line 728 of file freespaceview.cpp.

◆ setBoundsPenColor()

void CellView::setBoundsPenColor ( QGraphicsLineItem **  bounds,
int  len,
QColor  col 
)
staticprivate

update pen color of several graphics item

Parameters
boundsarray of graphics items
lennumber of items
colnew pen color

Definition at line 771 of file freespaceview.cpp.

◆ setBrushColor()

void CellView::setBrushColor ( QAbstractGraphicsShapeItem *  item,
QColor  col 
)
staticprivate

update brush (fill) color of a graphics item

Parameters
itema graphics item
colnew brush color

Definition at line 783 of file freespaceview.cpp.

◆ setColor()

void CellView::setColor ( QColor  areaColor,
QColor  borderColor = QColor() 
)

update drawing colors

Parameters
areaColorcolor for content area
borderColorcolor for borders (by default is equal to areaColor)

Definition at line 744 of file freespaceview.cpp.

◆ setPenColor()

void CellView::setPenColor ( QAbstractGraphicsShapeItem *  item,
QColor  col 
)
staticprivate

update pen (edge) color of a graphics item

Parameters
itema graphics item
colnew pen color

Definition at line 762 of file freespaceview.cpp.

◆ setPenStyle()

void CellView::setPenStyle ( QAbstractGraphicsShapeItem *  item,
Qt::PenStyle  style 
)
staticprivate

update pen style (dotted,solid,...) of a graphics item

Parameters
itema graphics item
stylenew style

Definition at line 792 of file freespaceview.cpp.

◆ setPenStyleWidth()

void CellView::setPenStyleWidth ( QAbstractGraphicsShapeItem *  item,
Qt::PenStyle  style,
float  width 
)
staticprivate

update pen style and pen width of a graphics item

Parameters
itema graphics item
stylenew style
widthnew pen width

Definition at line 801 of file freespaceview.cpp.

◆ shape()

virtual QPainterPath frechet::view::CellView::shape ( ) const
inlinevirtual
Returns
the clip shape

Definition at line 113 of file freespaceview.h.

◆ update()

void CellView::update ( double  eps,
bool  showBounds,
QLineF  bounds[4] 
)

update display

Parameters
epsnew value of epsilon
showBoundsshow bounding rect?
boundscontent area bounding rectangle

Definition at line 899 of file freespaceview.cpp.

Friends And Related Function Documentation

◆ FreeSpaceView

friend class FreeSpaceView
friend

Definition at line 125 of file freespaceview.h.

Member Data Documentation

◆ _bounds

QGraphicsLineItem* frechet::view::CellView::_bounds[4]
private

boundary lines of the content area

Definition at line 63 of file freespaceview.h.

◆ _ellipse

QGraphicsEllipseItem* frechet::view::CellView::_ellipse
private

content area may be a (clipped) ellipse (created on demand). this is a circle with an affine transform

Definition at line 59 of file freespaceview.h.

◆ _poly

QGraphicsPolygonItem* frechet::view::CellView::_poly
private

content area may be a polygon (created on demand)

Definition at line 56 of file freespaceview.h.

◆ cellBounds

QRectF frechet::view::CellView::cellBounds
private

bounding rectangle

Definition at line 51 of file freespaceview.h.

◆ clipShape

QPainterPath frechet::view::CellView::clipShape
private

shape used for clipping ellipses

Definition at line 53 of file freespaceview.h.

◆ DET_MINIMUM

const double frechet::view::CellView::DET_MINIMUM
staticprivate

determines when a hige ellipse is replaced by two parallel lines

Definition at line 127 of file freespaceview.h.

◆ i

int frechet::view::CellView::i
private

column index in free-space grid

Definition at line 44 of file freespaceview.h.

◆ j

int frechet::view::CellView::j
private

row index in free-space grid

Definition at line 46 of file freespaceview.h.

◆ MAX_DIAMETER

const double CellView::MAX_DIAMETER = 1e5
staticprivate

what's this?

Definition at line 129 of file freespaceview.h.

◆ parent

FreeSpaceView* frechet::view::CellView::parent
private

pointer to parent

Definition at line 48 of file freespaceview.h.

◆ useEllipse

bool frechet::view::CellView::useEllipse
private

true if an ellipse is to be shown

Definition at line 61 of file freespaceview.h.

◆ what

enum frechet::view::CellView::What frechet::view::CellView::what
private

The documentation for this class was generated from the following files: