DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Static Public Member Functions
DGtal::Display2DFactory Struct Reference

#include <Display2DFactory.h>

Static Public Member Functions

static void draw (DGtal::Board2D &board, const DGtal::AngleLinearMinimizer &)
template<typename TIterator , typename TInteger , int connectivity>
static void drawAsBoundingBox (DGtal::Board2D &aBoard, const DGtal::ArithmeticalDSS< TIterator, TInteger, connectivity > &)
template<typename TIterator , typename TInteger , int connectivity>
static void drawAsDigitalPoints (DGtal::Board2D &aBoard, const DGtal::ArithmeticalDSS< TIterator, TInteger, connectivity > &)
template<typename TIterator , typename TInteger , int connectivity>
static void draw (DGtal::Board2D &board, const DGtal::ArithmeticalDSS< TIterator, TInteger, connectivity > &)
template<typename TPoint >
static void draw (Board2D &aBoard, const DGtal::CircleFrom2Points< TPoint > &)
template<typename Point >
static void drawArc (Board2D &aBoard, const DGtal::CircleFrom3Points< Point > &, const Point &, const Point &, bool anOrientation=true)
template<typename Point >
static void drawSector (Board2D &aBoard, const DGtal::CircleFrom3Points< Point > &, const Point &, const Point &, bool anOrientation=true)
template<typename Point >
static void drawAnnulus (Board2D &aBoard, const DGtal::CircleFrom3Points< Point > &, const Point &, const Point &, const double &w=1.0, bool anOrientation=true)
template<typename Point >
static void draw (Board2D &aBoard, const DGtal::CircleFrom3Points< Point > &, const Point &, const Point &, bool anOrientation=true)
template<typename TPoint >
static void draw (Board2D &aBoard, const DGtal::CircleFrom3Points< TPoint > &)
template<typename Domain >
static void draw (DGtal::Board2D &board, const DGtal::DigitalSetBySTLSet< Domain > &)
template<typename Domain >
static void draw (DGtal::Board2D &board, const DGtal::DigitalSetBySTLVector< Domain > &)
template<typename TIterator , typename TInteger , int connectivity>
static void drawAsPolygon (DGtal::Board2D &aBoard, const DGtal::FP< TIterator, TInteger, connectivity > &)
template<typename TIterator , typename TInteger , int connectivity>
static void draw (DGtal::Board2D &board, const DGtal::FP< TIterator, TInteger, connectivity > &)
template<typename TInteger >
static void drawAsGrid (DGtal::Board2D &aBoard, const DGtal::FreemanChain< TInteger > &)
template<typename TInteger >
static void drawAsInterGrid (DGtal::Board2D &aBoard, const DGtal::FreemanChain< TInteger > &)
template<typename TInteger >
static void draw (DGtal::Board2D &aBoard, const DGtal::FreemanChain< TInteger > &)
template<typename TConstIterator >
static void draw (DGtal::Board2D &aBoard, const DGtal::GeometricalDSS< TConstIterator > &)
template<typename TConstIterator >
static void draw (DGtal::Board2D &aBoard, const DGtal::GeometricalDCA< TConstIterator > &)
template<typename TIterator , typename TInteger >
static void draw (DGtal::Board2D &aBoard, const DGtal::FrechetShortcut< TIterator, TInteger > &)
template<typename TKSpace >
static void draw (DGtal::Board2D &aBoard, const GridCurve< TKSpace > &object)
template<typename TIterator , typename TSCell >
static void draw (DGtal::Board2D &aBoard, const ConstRangeAdapter< TIterator, DefaultFunctor, TSCell > &object)
template<typename TIterator , typename TKSpace >
static void draw (DGtal::Board2D &aBoard, const ConstRangeAdapter< TIterator, SCellToPoint< TKSpace >, typename TKSpace::Point > &object)
template<typename TIterator , typename TKSpace >
static void draw (DGtal::Board2D &aBoard, const ConstRangeAdapter< TIterator, SCellToMidPoint< TKSpace >, typename TKSpace::Space::RealPoint > &object)
template<typename TIterator , typename TKSpace >
static void draw (DGtal::Board2D &aBoard, const ConstRangeAdapter< TIterator, SCellToArrow< TKSpace >, std::pair< typename TKSpace::Point, typename TKSpace::Vector > > &object)
template<typename TIterator , typename TKSpace >
static void draw (DGtal::Board2D &aBoard, const ConstRangeAdapter< TIterator, SCellToInnerPoint< TKSpace >, typename TKSpace::Point > &object)
template<typename TIterator , typename TKSpace >
static void draw (DGtal::Board2D &aBoard, const ConstRangeAdapter< TIterator, SCellToOuterPoint< TKSpace >, typename TKSpace::Point > &object)
template<typename TIterator , typename TKSpace >
static void draw (DGtal::Board2D &aBoard, const ConstRangeAdapter< TIterator, SCellToIncidentPoints< TKSpace >, std::pair< typename TKSpace::Point, typename TKSpace::Point > > &object)
template<typename TSpace >
static void drawAsGrid (DGtal::Board2D &aboard, const DGtal::HyperRectDomain< TSpace > &)
template<typename TSpace >
static void drawAsPaving (DGtal::Board2D &aboard, const DGtal::HyperRectDomain< TSpace > &)
template<typename TSpace >
static void draw (DGtal::Board2D &board, const DGtal::HyperRectDomain< TSpace > &)
template<typename C , typename Domain , typename Value , typename HashKey >
static void drawImageRecursive (DGtal::Board2D &aBoard, const DGtal::ImageContainerByHashTree< Domain, Value, HashKey > &i, HashKey key, const double p[2], const double len, LibBoard::Board &board, const C &cmap)
template<typename C , typename Domain , typename Value , typename HashKey >
static void drawImageHashTree (Board2D &board, const DGtal::ImageContainerByHashTree< Domain, Value, HashKey > &, const Value &, const Value &)
template<typename Colormap , typename Image >
static void drawImage (DGtal::Board2D &board, const Image &i, const typename Image::Value &minV, const typename Image::Value &maxV)
template<Dimension dim, typename TInteger >
static void draw (DGtal::Board2D &board, const DGtal::KhalimskyCell< dim, TInteger > &)
template<typename TDigitalTopology , typename TDigitalSet >
static void drawWithAdjacencies (DGtal::Board2D &aBoard, const DGtal::Object< TDigitalTopology, TDigitalSet > &)
template<typename TDigitalTopology , typename TDigitalSet >
static void draw (DGtal::Board2D &board, const DGtal::Object< TDigitalTopology, TDigitalSet > &)
template<Dimension dim, typename TComponent >
static void drawAsPaving (DGtal::Board2D &board, const DGtal::PointVector< dim, TComponent > &)
template<Dimension dim, typename TComponent >
static void drawAsGrid (DGtal::Board2D &board, const DGtal::PointVector< dim, TComponent > &)
template<Dimension dim, typename TComponent >
static void draw (DGtal::Board2D &board, const DGtal::PointVector< dim, TComponent > &)
template<Dimension dim, typename TComponent >
static void draw (DGtal::Board2D &board, const DGtal::PointVector< dim, TComponent > &, const DGtal::PointVector< dim, TComponent > &)
template<typename Shape >
static void draw (DGtal::Board2D &aBoard, const DGtal::Preimage2D< Shape > &)
template<Dimension dim, typename TInteger >
static void draw (DGtal::Board2D &board, const DGtal::SignedKhalimskyCell< dim, TInteger > &)
template<typename TPoint >
static void draw (Board2D &aBoard, const DGtal::StraightLineFrom2Points< TPoint > &)
static void draw (DGtal::Board2D &board, const DGtal::CustomStyle &)
static void draw (DGtal::Board2D &board, const DGtal::SetMode &)
template<typename TSpace , typename TSequence >
static void draw (DGtal::Board2D &aBoard, const DGtal::LatticePolytope2D< TSpace, TSequence > &cip)

Detailed Description

Factory for Display2D:

Description of struct 'Display2DFactory'

Definition at line 83 of file Display2DFactory.h.


Member Function Documentation

void DGtal::Display2DFactory::draw ( DGtal::Board2D board,
const DGtal::AngleLinearMinimizer a 
)
inlinestatic

Definition at line 39 of file Display2DFactory.ih.

References DGtal::AngleLinearMinimizer::ValueInfo::distToNext, LibBoard::Board::drawArc(), LibBoard::Board::drawDot(), LibBoard::Board::drawLine(), DGtal::AngleLinearMinimizer::ValueInfo::max, DGtal::AngleLinearMinimizer::ValueInfo::min, DGtal::AngleLinearMinimizer::ro(), LibBoard::Board::setLineWidth(), LibBoard::Board::setPenColor(), DGtal::AngleLinearMinimizer::size(), and DGtal::AngleLinearMinimizer::ValueInfo::value.

Referenced by DGtal::CDrawableWithBoard2D< T >::BOOST_CONCEPT_USAGE(), and DGtal::Board2D::operator<<().

{
double distance=5.0;
board.setLineWidth(3.0);
board.setPenColor(Color(20,20,200));
// now with accessor
for(int i=0; i< (int)a.size(); i++){
board.drawArc(0.0, 0.0, distance, a.ro(i).min, a.ro(i).max, false, 1);
board.drawDot(cos(a.ro(i).value)*distance, sin(a.ro(i).value)*distance );
distance+=a.ro(i).distToNext;
}
distance=5.0;
double distanceNext;
// now with accessor
for(int i=0; i< (int) (a.size()-1); i++){
distanceNext= distance+ a.ro(i).distToNext;
board.setPenColor(Color(200,20,20));
board.drawLine(cos(a.ro(i).value)*distance, sin(a.ro(i).value)*distance,
cos(a.ro(i+1).value)*distanceNext, sin(a.ro(i+1).value)*distanceNext);
distance=distanceNext;
}
}
template<typename TIterator , typename TInteger , int connectivity>
void DGtal::Display2DFactory::draw ( DGtal::Board2D board,
const DGtal::ArithmeticalDSS< TIterator, TInteger, connectivity > &  a 
)
inlinestatic

Definition at line 126 of file Display2DFactory.ih.

References DGtal::ArithmeticalDSS< TIterator, TInteger, connectivity >::className(), and DGtal::Board2D::getMode().

{
std::string mode = board.getMode( a.className() );
if ( mode == "BoundingBox" )
drawAsBoundingBox( board, a );
else if ( mode == "Points" )
drawAsDigitalPoints( board, a );
else if ( ( mode == "" ) )
{
drawAsDigitalPoints( board, a );
drawAsBoundingBox( board, a );
}
else
ASSERT(false && ("draw( DGtal::Board2D & board, const DGtal::ArithmeticalDSS<TIterator,TInteger,connectivity> & a ): Unknown mode "+mode)=="" );
}
template<typename TPoint >
void DGtal::Display2DFactory::draw ( Board2D aBoard,
const DGtal::CircleFrom2Points< TPoint > &  cf2p 
)
inlinestatic

Definition at line 149 of file Display2DFactory.ih.

References DGtal::CircleFrom2Points< TPoint >::p(), DGtal::CircleFrom2Points< TPoint >::pole(), and DGtal::CircleFrom2Points< TPoint >::q().

{
// now with accessor
CircleFrom3Points<TPoint> c(cf2p.pole(),cf2p.p(),cf2p.q());
drawArc(aBoard,c,cf2p.p(),cf2p.q(),true);
}
template<typename Point >
void DGtal::Display2DFactory::draw ( Board2D aBoard,
const DGtal::CircleFrom3Points< Point > &  cf3p,
const Point aPoint1,
const Point aPoint2,
bool  anOrientation = true 
)
inlinestatic

Definition at line 288 of file Display2DFactory.ih.

References DGtal::CircleFrom3Points< TPoint >::className(), and DGtal::Board2D::getMode().

{
std::string mode = aBoard.getMode( cf3p.className() );
ASSERT( (mode=="Arc" || mode=="" || mode=="Sector"|| mode=="Annulus") ||
("draw(Board2D & aBoard, const DGtal::CircleFrom3Points<Point> & cf3p, const Point& aPoint1, const Point& aPoint2): Unknown mode "+mode)=="" );
if ( mode == "Arc" || ( mode == "" ) )
drawArc( aBoard, cf3p, aPoint1, aPoint2, anOrientation);
else if ( mode == "Sector" )
drawSector( aBoard, cf3p, aPoint1, aPoint2, anOrientation);
else if ( mode == "Annulus" )
drawAnnulus( aBoard, cf3p, aPoint1, aPoint2, anOrientation);
}
template<typename TPoint >
void DGtal::Display2DFactory::draw ( Board2D aBoard,
const DGtal::CircleFrom3Points< TPoint > &  cf3p 
)
inlinestatic

Definition at line 304 of file Display2DFactory.ih.

References LibBoard::Board::drawCircle(), LibBoard::Board::drawLine(), DGtal::CircleFrom3Points< TPoint >::getParameters(), DGtal::CircleFrom3Points< TPoint >::myP, and DGtal::CircleFrom3Points< TPoint >::myR.

{
typedef typename TPoint::Coordinate Coordinate;
double cx = 0, cy = 0, radius = 1;
try
{
cf3p.getParameters(cx,cy,radius);
aBoard.drawCircle (cx,cy,radius);
}
catch ( InfiniteNumberException e )
{
aBoard.drawLine( NumberTraits<Coordinate>::castToDouble(cf3p.myP[0]),
NumberTraits<Coordinate>::castToDouble(cf3p.myP[1]),
NumberTraits<Coordinate>::castToDouble(cf3p.myR[0]),
NumberTraits<Coordinate>::castToDouble(cf3p.myR[1]) );
}
}
template<typename Domain >
void DGtal::Display2DFactory::draw ( DGtal::Board2D board,
const DGtal::DigitalSetBySTLSet< Domain > &  s 
)
inlinestatic

Definition at line 328 of file Display2DFactory.ih.

References DGtal::DigitalSetBySTLSet< TDomain >::begin(), and DGtal::DigitalSetBySTLSet< TDomain >::end().

{
typedef typename Domain::Point Point;
typedef typename Point::Coordinate Coordinate;
typedef typename std::set<Point>::const_iterator ConstIterator;
ASSERT(Domain::Space::dimension == 2);
for(ConstIterator it = s.begin(); it != s.end(); ++it)
// <<<<<<< HEAD
// board.drawRectangle( NumberTraits<Coordinate>::castToDouble( (*it)[0] ) - 0.5,
// NumberTraits<Coordinate>::castToDouble( (*it)[1] ) + 0.5,
// 1,
// 1 );
// =======
draw(board, *it);
//>>>>>>> master
}
template<typename Domain >
void DGtal::Display2DFactory::draw ( DGtal::Board2D board,
const DGtal::DigitalSetBySTLVector< Domain > &  v 
)
inlinestatic

Definition at line 353 of file Display2DFactory.ih.

References DGtal::DigitalSetBySTLVector< TDomain >::begin(), and DGtal::DigitalSetBySTLVector< TDomain >::end().

{
typedef typename Domain::Point Point;
typedef typename std::vector<Point>::const_iterator ConstIterator;
if (Domain::dimension == 2)
{
for(ConstIterator it = v.begin(); it != v.end(); ++it)
draw(board, *it);
}
else
ASSERT(false && ("draw-NOT-YET-IMPLEMENTED-in-ND"));
}
template<typename TIterator , typename TInteger , int connectivity>
void DGtal::Display2DFactory::draw ( DGtal::Board2D board,
const DGtal::FP< TIterator, TInteger, connectivity > &  fp 
)
inlinestatic

Definition at line 405 of file Display2DFactory.ih.

References DGtal::FP< TIterator, TInteger, connectivity >::className(), and DGtal::Board2D::getMode().

{
std::string mode = board.getMode( fp.className() );
if ( mode == "Polygon" )
drawAsPolygon( board, fp );
else if ( ( mode == "Both" ) || ( mode == "" ) )
{
drawAsPolygon( board, fp );
}
else
{
mode = "draw( DGtal::Board2D & board, const DGtal::FP<TIterator,TInteger,connectivity> & fp ): Unknown mode "+mode;
ASSERT2(false, mode );
}
}
template<typename TInteger >
void DGtal::Display2DFactory::draw ( DGtal::Board2D aBoard,
const DGtal::FreemanChain< TInteger > &  f 
)
inlinestatic

Definition at line 469 of file Display2DFactory.ih.

References DGtal::FreemanChain< TInteger >::className(), and DGtal::Board2D::getMode().

{
std::string mode = aBoard.getMode( f.className() );
ASSERT( (mode=="Grid" || mode=="" || mode=="InterGrid") ||
("draw( DGtal::Board2D & board, const DGtal::FreemanChain<TInteger> & f ): Unknown mode "+mode)=="" );
if ( mode == "Grid" || ( mode == "" ) )
drawAsGrid( aBoard, f );
else if ( mode == "InterGrid" )
drawAsInterGrid( aBoard, f );
}
template<typename TConstIterator >
void DGtal::Display2DFactory::draw ( DGtal::Board2D aBoard,
const DGtal::GeometricalDSS< TConstIterator > &  g 
)
inlinestatic

Definition at line 487 of file Display2DFactory.ih.

References DGtal::GeometricalDSS< TConstIterator >::begin(), DGtal::NumberTraits< T >::castToDouble(), LibBoard::Board::drawLine(), DGtal::GeometricalDSS< TConstIterator >::end(), DGtal::GeometricalDSS< TConstIterator >::getParameters(), and DGtal::GeometricalDSS< TConstIterator >::projects().

{
typedef TConstIterator ConstIterator;
typedef typename Pair::first_type Point;
double alpha, beta, gamma;
g.getParameters(alpha, beta, gamma);
typedef typename Point::Coordinate Coordinate;
// now with accessor
Pair firstPair( *g.begin() );
double fx1 = NumberTraits<Coordinate>::castToDouble(firstPair.first[0]);
double fx2 = NumberTraits<Coordinate>::castToDouble(firstPair.second[0]);
double fy1 = NumberTraits<Coordinate>::castToDouble(firstPair.first[1]);
double fy2 = NumberTraits<Coordinate>::castToDouble(firstPair.second[1]);
double fx = (fx1+fx2)/2.0;
double fy = (fy1+fy2)/2.0;
g.projects(fx, fy, alpha, beta, gamma);
// now with accessor
ConstIterator it (g.end());
--it;
Pair lastPair( *it );
double lx1 = NumberTraits<Coordinate>::castToDouble(lastPair.first[0]);
double lx2 = NumberTraits<Coordinate>::castToDouble(lastPair.second[0]);
double ly1 = NumberTraits<Coordinate>::castToDouble(lastPair.first[1]);
double ly2 = NumberTraits<Coordinate>::castToDouble(lastPair.second[1]);
double lx = (lx1+lx2)/2.0;
double ly = (ly1+ly2)/2.0;
g.projects(lx, ly, alpha, beta, gamma);
aBoard.drawLine(fx,fy,lx,ly);
}
template<typename TConstIterator >
void DGtal::Display2DFactory::draw ( DGtal::Board2D aBoard,
const DGtal::GeometricalDCA< TConstIterator > &  g 
)
inlinestatic

Definition at line 528 of file Display2DFactory.ih.

References DGtal::GeometricalDCA< TConstIterator >::begin(), DGtal::NumberTraits< T >::castToDouble(), DGtal::GeometricalDCA< TConstIterator >::className(), DGtal::GeometricalDCA< TConstIterator >::end(), DGtal::GeometricalDCA< TConstIterator >::getGeometricalDSSPtr(), DGtal::Board2D::getMode(), DGtal::GeometricalDCA< TConstIterator >::getSeparatingCircle(), DGtal::GeometricalDCA< TConstIterator >::isStraight(), DGtal::GeometricalDCA< TConstIterator >::isValid(), DGtal::CircleFrom3Points< TPoint >::p(), DGtal::CircleFrom3Points< TPoint >::q(), and DGtal::CircleFrom3Points< TPoint >::r().

{
typedef TConstIterator ConstIterator;
typedef typename Pair::first_type Point;
if (g.isValid())
{
if (!g.isStraight())
{
typedef typename Point::Coordinate Coordinate;
//points
Pair firstPair( *g.begin() );
double fx1 = NumberTraits<Coordinate>::castToDouble(firstPair.first[0]);
double fx2 = NumberTraits<Coordinate>::castToDouble(firstPair.second[0]);
double fy1 = NumberTraits<Coordinate>::castToDouble(firstPair.first[1]);
double fy2 = NumberTraits<Coordinate>::castToDouble(firstPair.second[1]);
PointVector<2,double> p1( (fx1+fx2)/2.0, (fy1+fy2)/2.0 );
ConstIterator it (g.end());
--it;
Pair lastPair( *it );
double lx1 = NumberTraits<Coordinate>::castToDouble(lastPair.first[0]);
double lx2 = NumberTraits<Coordinate>::castToDouble(lastPair.second[0]);
double ly1 = NumberTraits<Coordinate>::castToDouble(lastPair.first[1]);
double ly2 = NumberTraits<Coordinate>::castToDouble(lastPair.second[1]);
PointVector<2,double> p2( (lx1+lx2)/2.0, (ly1+ly2)/2.0 );
//circle
CircleFrom3Points<Point> separatingCircle = g.getSeparatingCircle();
double px = NumberTraits<Coordinate>::castToDouble(separatingCircle.p()[0]);
double py = NumberTraits<Coordinate>::castToDouble(separatingCircle.p()[1]);
double qx = NumberTraits<Coordinate>::castToDouble(separatingCircle.q()[0]);
double qy = NumberTraits<Coordinate>::castToDouble(separatingCircle.q()[1]);
double rx = NumberTraits<Coordinate>::castToDouble(separatingCircle.r()[0]);
double ry = NumberTraits<Coordinate>::castToDouble(separatingCircle.r()[1]);
CircleFrom3Points<PointVector<2,double> > circleToDraw;
circleToDraw.init( PointVector<2,double>(px,py),
PointVector<2,double>(qx,qy),
PointVector<2,double>(rx,ry) );
//orientation
ASSERT( g.getGeometricalDSSPtr().get() != 0 );
bool orientation = g.getGeometricalDSSPtr()->isClockwiseOriented();
//mode
std::string mode = aBoard.getMode( g.className() );
if ( mode == "Sector" )
drawSector( aBoard, circleToDraw, p1, p2, orientation );
else if ( mode == "Annulus" )
drawAnnulus( aBoard, circleToDraw, p1, p2, orientation );
else
drawArc( aBoard, circleToDraw, p1, p2, orientation );
}
else
{
ASSERT( g.getGeometricalDSSPtr().get() != 0 );
aBoard << ( *(g.getGeometricalDSSPtr()) );
}
}
}
template<typename TIterator , typename TInteger >
void DGtal::Display2DFactory::draw ( DGtal::Board2D aBoard,
const DGtal::FrechetShortcut< TIterator, TInteger > &  f 
)
inlinestatic

Definition at line 600 of file Display2DFactory.ih.

References DGtal::FrechetShortcut< TIterator, TInteger >::begin(), DGtal::NumberTraits< T >::castToDouble(), LibBoard::Board::drawLine(), and DGtal::FrechetShortcut< TIterator, TInteger >::end().

{
typedef TIterator Iterator;
typedef PointVector<2,TInteger> Point;
typedef typename Point::Coordinate Coordinate;
// get first point of the shortcut
Point p1 = *(f.begin());
double px1 = NumberTraits<Coordinate>::castToDouble(p1[0]);
double py1 = NumberTraits<Coordinate>::castToDouble(p1[1]);
// get last point of the shortcut
Iterator it (f.end());
--it;
Point p2(*it);
double px2 = NumberTraits<Coordinate>::castToDouble(p2[0]);
double py2 = NumberTraits<Coordinate>::castToDouble(p2[1]);
aBoard.drawLine(px1,py1,px2,py2);
}
template<typename TKSpace >
void DGtal::Display2DFactory::draw ( DGtal::Board2D aBoard,
const GridCurve< TKSpace > &  object 
)
static

Definition at line 626 of file Display2DFactory.ih.

{
typedef typename GridCurve<TKSpace>::ConstIterator ConstIterator;
ConstIterator it ( object.begin() );
ConstIterator itEnd ( object.end() );
for( ; it != itEnd; ++it)
{
aBoard << *it;
}
}
template<typename TIterator , typename TSCell >
void DGtal::Display2DFactory::draw ( DGtal::Board2D aBoard,
const ConstRangeAdapter< TIterator, DefaultFunctor, TSCell > &  object 
)
static

Definition at line 641 of file Display2DFactory.ih.

{
typedef ConstRangeAdapter<TIterator, DefaultFunctor, TSCell> Range;
typedef typename Range::ConstIterator ConstIterator;
ConstIterator it ( object.begin() );
ConstIterator itEnd ( object.end() );
for( ; it != itEnd; ++it)
{
aBoard << *it;
}
}
template<typename TIterator , typename TKSpace >
void DGtal::Display2DFactory::draw ( DGtal::Board2D aBoard,
const ConstRangeAdapter< TIterator, SCellToPoint< TKSpace >, typename TKSpace::Point > &  object 
)
static

Definition at line 658 of file Display2DFactory.ih.

{
typedef ConstRangeAdapter<TIterator, SCellToPoint<TKSpace>, typename TKSpace::Point> Range;
typedef typename Range::ConstIterator ConstIterator;
ConstIterator it ( object.begin() );
ConstIterator itEnd ( object.end() );
for( ; it != itEnd; ++it)
{
aBoard << SetMode(it->className(),"Grid");
aBoard << *it;
}
}
template<typename TIterator , typename TKSpace >
void DGtal::Display2DFactory::draw ( DGtal::Board2D aBoard,
const ConstRangeAdapter< TIterator, SCellToMidPoint< TKSpace >, typename TKSpace::Space::RealPoint > &  object 
)
static

Definition at line 676 of file Display2DFactory.ih.

References LibBoard::Board::drawLine().

{
typedef typename TKSpace::Space::RealPoint RPoint;
typedef ConstRangeAdapter<TIterator, SCellToMidPoint<TKSpace>, RPoint > Range;
typedef typename Range::ConstIterator ConstIterator;
ConstIterator it ( object.begin() );
ConstIterator itEnd ( object.end() );
for( ; it != itEnd; ++it)
{
RPoint p(*it);
double s = 0.1;
aBoard.drawLine( p[0]-s, p[1]-s, p[0]+s, p[1]+s );
aBoard.drawLine( p[0]-s, p[1]+s, p[0]+s, p[1]-s );
}
}
template<typename TIterator , typename TKSpace >
void DGtal::Display2DFactory::draw ( DGtal::Board2D aBoard,
const ConstRangeAdapter< TIterator, SCellToArrow< TKSpace >, std::pair< typename TKSpace::Point, typename TKSpace::Vector > > &  object 
)
static

Definition at line 698 of file Display2DFactory.ih.

References DGtal::Color::Black, LibBoard::Shape::RoundCap, LibBoard::Shape::RoundJoin, and LibBoard::Shape::SolidStyle.

{
typedef typename TKSpace::Point Point;
typedef typename TKSpace::Vector Vector;
typedef std::pair<Point, Vector> Arrow;
typedef ConstRangeAdapter<TIterator, SCellToArrow<TKSpace>, Arrow > Range;
typedef typename Range::ConstIterator ConstIterator;
ConstIterator it ( object.begin() );
ConstIterator itEnd ( object.end() );
for( ; it != itEnd; ++it)
{
Arrow a(*it);
Vector shift( a.second );
aBoard << CustomStyle( shift.className(),
new CustomPen( Color::Black, Color::Black, 1.0,
draw(aBoard, shift, a.first);
}
}
template<typename TIterator , typename TKSpace >
void DGtal::Display2DFactory::draw ( DGtal::Board2D aBoard,
const ConstRangeAdapter< TIterator, SCellToInnerPoint< TKSpace >, typename TKSpace::Point > &  object 
)
static

Definition at line 726 of file Display2DFactory.ih.

References DGtal::Color::Blue.

{
typedef typename TKSpace::Point Point;
typedef ConstRangeAdapter<TIterator, SCellToInnerPoint<TKSpace>, Point > Range;
typedef typename Range::ConstIterator ConstIterator;
ConstIterator it ( object.begin() );
ConstIterator itEnd ( object.end() );
for( ; it != itEnd; ++it)
{
aBoard << SetMode( it->className(), "Both" )
<< CustomStyle( it->className(),
new CustomFillColor( Color::Blue ) )
<< *it;
}
}
template<typename TIterator , typename TKSpace >
void DGtal::Display2DFactory::draw ( DGtal::Board2D aBoard,
const ConstRangeAdapter< TIterator, SCellToOuterPoint< TKSpace >, typename TKSpace::Point > &  object 
)
static

Definition at line 748 of file Display2DFactory.ih.

References DGtal::Color::Green.

{
typedef typename TKSpace::Point Point;
typedef ConstRangeAdapter<TIterator, SCellToOuterPoint<TKSpace>, Point > Range;
typedef typename Range::ConstIterator ConstIterator;
ConstIterator it ( object.begin() );
ConstIterator itEnd ( object.end() );
for( ; it != itEnd; ++it)
{
aBoard << SetMode( it->className(), "Both" )
<< CustomStyle( it->className(),
new CustomFillColor( Color::Green ) )
<< *it;
}
}
template<typename TIterator , typename TKSpace >
void DGtal::Display2DFactory::draw ( DGtal::Board2D aBoard,
const ConstRangeAdapter< TIterator, SCellToIncidentPoints< TKSpace >, std::pair< typename TKSpace::Point, typename TKSpace::Point > > &  object 
)
static

Definition at line 770 of file Display2DFactory.ih.

References DGtal::Color::Blue, and DGtal::Color::Green.

{
typedef typename TKSpace::Point Point;
typedef std::pair<Point, Point> Pair;
typedef ConstRangeAdapter<TIterator, SCellToIncidentPoints<TKSpace>, Pair > Range;
typedef typename Range::ConstIterator ConstIterator;
ConstIterator it ( object.begin() );
ConstIterator itEnd ( object.end() );
for( ; it != itEnd; ++it)
{
Pair pair(*it);
aBoard << SetMode( pair.first.className(), "Both" )
<< CustomStyle( pair.first.className(),
new CustomFillColor( Color::Blue ) )
<< pair.first
<< CustomStyle( pair.second.className(),
new CustomFillColor( Color::Green ) )
<< pair.second;
}
}
template<typename TSpace >
void DGtal::Display2DFactory::draw ( DGtal::Board2D board,
const DGtal::HyperRectDomain< TSpace > &  h 
)
inlinestatic

Definition at line 854 of file Display2DFactory.ih.

References DGtal::HyperRectDomain< TSpace >::className(), and DGtal::Board2D::getMode().

{
std::string mode = board.getMode( h.className() );
ASSERT((mode=="" || mode=="Grid" || mode=="Paving") ||
("draw( DGtal::Board2D & board, const DGtal::HyperRectDomain<TSpace> & h ): Unknown mode "+mode)=="");
if ( ( mode == "" ) || ( mode == "Grid" ) )
drawAsGrid( board, h );
else if ( mode == "Paving" )
drawAsPaving( board, h );
}
template<Dimension dim, typename TInteger >
void DGtal::Display2DFactory::draw ( DGtal::Board2D board,
const DGtal::KhalimskyCell< dim, TInteger > &  k 
)
inlinestatic

Definition at line 980 of file Display2DFactory.ih.

References LibBoard::Board::drawRectangle(), and DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
ASSERT( dim == 2 );
float x = (float)
float y = (float)
float retract = 0.05f;
bool xodd = ( k.myCoordinates[ 0 ] & 1 );
bool yodd = ( k.myCoordinates[ 1 ] & 1 );
float dx = xodd ? 1.0f - 2.0f*retract : 2.0f*retract;
float dy = yodd ? 1.0f - 2.0f*retract : 2.0f*retract;
board.drawRectangle( !xodd ? x - retract - 0.5 : x + retract - 0.5,
!yodd ? y + retract - 0.5 : y - retract + 0.5,
dx, dy );
}
template<typename TDigitalTopology, typename TDigitalSet >
void DGtal::Display2DFactory::draw ( DGtal::Board2D board,
const DGtal::Object< TDigitalTopology, TDigitalSet > &  o 
)
inlinestatic

Definition at line 1036 of file Display2DFactory.ih.

References DGtal::Object< TDigitalTopology, TDigitalSet >::className(), DGtal::Board2D::getMode(), and DGtal::Object< TDigitalTopology, TDigitalSet >::pointSet().

{
std::string mode = board.getMode( o.className() );
if ( mode == "" )
draw( board, o.pointSet() );
else
if ( mode == "DrawAdjacencies" )
{
draw( board, o.pointSet() );
drawWithAdjacencies( board, o );
}
else
ASSERT(false && (("draw( DGtal::Board2D & board, const DGtal::Object<TDigitalTopology, TDigitalSet> & o ): Unknown mode " + mode) == ""));
}
template<Dimension dim, typename TComponent >
void DGtal::Display2DFactory::draw ( DGtal::Board2D board,
const DGtal::PointVector< dim, TComponent > &  p 
)
inlinestatic

Definition at line 1077 of file Display2DFactory.ih.

References DGtal::PointVector< dim, TEuclideanRing >::className(), and DGtal::Board2D::getMode().

{
std::string mode = board.getMode( p.className() );
ASSERT( (mode=="Paving" || mode=="Grid" || mode=="Both" || mode=="") ||
("draw( DGtal::Board2D & board, const DGtal::PointVector<dim,TComponent> & p ): Unknown mode "+mode)=="" );
if ( mode == "Paving" || ( mode == "" ) )
drawAsPaving( board, p );
else if ( mode == "Grid" )
drawAsGrid( board, p );
else if ( ( mode == "Both" ))
{
drawAsPaving( board, p );
drawAsGrid( board, p );
}
}
template<Dimension dim, typename TComponent >
void DGtal::Display2DFactory::draw ( DGtal::Board2D board,
const DGtal::PointVector< dim, TComponent > &  p,
const DGtal::PointVector< dim, TComponent > &  apoint 
)
inlinestatic

Definition at line 1097 of file Display2DFactory.ih.

References LibBoard::Board::drawArrow(), and DGtal::PointVector< dim, TEuclideanRing >::myArray.

{
ASSERT(dim == 2);
board.drawArrow((float)apoint[0], (float) apoint[1],
(float) apoint[0] + p.myArray[0], (float)apoint[1] + p.myArray[1],
true);
}
template<typename Shape>
void DGtal::Display2DFactory::draw ( DGtal::Board2D aBoard,
const DGtal::Preimage2D< Shape > &  p 
)
inlinestatic

Definition at line 1113 of file Display2DFactory.ih.

References DGtal::Preimage2D< Shape >::pHull(), DGtal::Preimage2D< Shape >::qHull(), and DGtal::Preimage2D< Shape >::shape().

{
typedef typename Shape::Point Point;
typedef typename std::list<Point>::const_iterator ConstForwardIterator;
// now with accessor
Shape s( p.shape() );
ConstForwardIterator i = p.pHull().begin();
Point pt(*i);
++i;
while ( i != p.pHull().end() ) {
s.init(pt, *i);
draw(aBoard, s); //s.setStyle(aBoard);
pt = Point(*i);
++i;
}
i = p.qHull().begin();
pt = Point(*i);
++i;
while ( i != p.qHull().end() ) {
s.init(pt, *i);
draw(aBoard, s); //s.setStyle(aBoard);
pt = Point(*i);
++i;
}
Point Pf(*p.pHull().begin());
Point Pl(*p.pHull().rbegin());
Point Qf(*p.qHull().begin());
Point Ql(*p.qHull().rbegin());
s.init(Pf, Ql);
draw(aBoard, s); //s.setStyle(aBoard);
s.init(Qf, Pl);
draw(aBoard, s); //s.setStyle(aBoard);
}
template<Dimension dim, typename TInteger >
void DGtal::Display2DFactory::draw ( DGtal::Board2D board,
const DGtal::SignedKhalimskyCell< dim, TInteger > &  sk 
)
inlinestatic

Definition at line 1157 of file Display2DFactory.ih.

References LibBoard::Board::drawRectangle(), and DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
ASSERT( dim == 2 );
float x = (float)
float y = (float)
float retract = 0.05f;
bool xodd = ( sk.myCoordinates[ 0 ] & 1 );
bool yodd = ( sk.myCoordinates[ 1 ] & 1 );
float dx = xodd ? 1.0f - 2.0f*retract : 2.0f*retract;
float dy = yodd ? 1.0f - 2.0f*retract : 2.0f*retract;
board.drawRectangle( !xodd ? x - retract - 0.5 : x + retract - 0.5,
!yodd ? y + retract - 0.5 : y - retract + 0.5,
dx, dy );
}
template<typename TPoint>
void DGtal::Display2DFactory::draw ( Board2D aBoard,
const DGtal::StraightLineFrom2Points< TPoint > &  slf2p 
)
inlinestatic

Definition at line 1180 of file Display2DFactory.ih.

References LibBoard::Board::drawLine(), DGtal::StraightLineFrom2Points< TPoint >::p(), and DGtal::StraightLineFrom2Points< TPoint >::q().

{
// now with accessor
aBoard.drawLine(slf2p.p()[0],slf2p.p()[1],slf2p.q()[0],slf2p.q()[1]);
}
void DGtal::Display2DFactory::draw ( DGtal::Board2D board,
const DGtal::CustomStyle cs 
)
inlinestatic
void DGtal::Display2DFactory::draw ( DGtal::Board2D board,
const DGtal::SetMode sm 
)
inlinestatic
template<typename TSpace, typename TSequence >
void DGtal::Display2DFactory::draw ( DGtal::Board2D aBoard,
const DGtal::LatticePolytope2D< TSpace, TSequence > &  cip 
)
inlinestatic

Draw method on Board for LatticePolytope2D.

Parameters:
aBoardan instance of Board2D.
cipan instance of convex integer polygon.

Definition at line 1209 of file Display2DFactory.ih.

References DGtal::LatticePolytope2D< TSpace, TSequence >::begin(), DGtal::LatticePolytope2D< TSpace, TSequence >::className(), LibBoard::Board::drawClosedPolyline(), DGtal::LatticePolytope2D< TSpace, TSequence >::end(), and DGtal::Board2D::getMode().

{
typedef typename LibBoard::Point BoardPoint;
typedef typename DGtal::LatticePolytope2D<TSpace>::Point CIPPoint;
typedef typename DGtal::LatticePolytope2D<TSpace>::ConstIterator ConstIterator;
std::string mode = aBoard.getMode( cip.className() );
ASSERT( mode=="Filled" || mode=="" || mode=="Transparent" ||
("draw(Board2D & aBoard, const DGtal::LatticePolytope2D<Space,Sequence> & cip): Unknown mode "+mode)=="" );
std::vector<BoardPoint> pts;
for ( ConstIterator it = cip.begin(), it_end = cip.end(); it != it_end; ++it )
{
CIPPoint p = *it;
pts.push_back( BoardPoint( NumberTraits<Integer>::castToDouble( p[ 0 ] ),
}
aBoard.drawClosedPolyline( pts );
// if ( mode == "Transparent" || ( mode == "" ) )
// {
// aBoard.drawClosedPolyline( pts );
// }
// else
// {
// aBoard.fillPolyline( pts );
// }
}
template<typename Point >
void DGtal::Display2DFactory::drawAnnulus ( Board2D aBoard,
const DGtal::CircleFrom3Points< Point > &  cf3p,
const Point aPoint1,
const Point aPoint2,
const double &  w = 1.0,
bool  anOrientation = true 
)
inlinestatic

Definition at line 239 of file Display2DFactory.ih.

References LibBoard::Board::drawArc(), LibBoard::Board::drawLine(), DGtal::CircleFrom3Points< TPoint >::getParameters(), M_PI, DGtal::CircleFrom3Points< TPoint >::p(), DGtal::CircleFrom3Points< TPoint >::q(), and DGtal::CircleFrom3Points< TPoint >::r().

{
typedef typename Point::Coordinate Coordinate;
typedef Point Vector;
double cx = 0, cy = 0, radius = 1;
try
{
//circle parameters
cf3p.getParameters(cx, cy, radius);
//angle parameters
double alpha1 = std::atan2( NumberTraits<Coordinate>::castToDouble(aPoint1[1])-cy,
NumberTraits<Coordinate>::castToDouble(aPoint1[0])-cx );
alpha1 = (alpha1<0)?(alpha1+2.0*M_PI):alpha1;
double alpha2 = std::atan2( NumberTraits<Coordinate>::castToDouble(aPoint2[1])-cy,
NumberTraits<Coordinate>::castToDouble(aPoint2[0])-cx );
alpha2 = (alpha2<0)?(alpha2+2.0*M_PI):alpha2;
// now with accessor
Vector u(cf3p.p() - cf3p.q());
Vector v(cf3p.r() - cf3p.p());
bool orientation = ( ( (u[0] * v[1]) - (u[1] * v[0]) ) < 0 )?(!anOrientation):anOrientation;
//inner arc
aBoard.drawArc (cx, cy, radius-w, alpha1, alpha2, orientation);
//outer arc
aBoard.drawArc (cx, cy, radius+w, alpha1, alpha2, orientation);
//first segment
double ifx = cx + (radius-w)*std::cos(alpha1);
double ify = cy + (radius-w)*std::sin(alpha1);
double ofx = cx + (radius+w)*std::cos(alpha1);
double ofy = cy + (radius+w)*std::sin(alpha1);
aBoard.drawLine(ifx, ify, ofx, ofy);
//second segment
double ilx = cx + (radius-w)*std::cos(alpha2);
double ily = cy + (radius-w)*std::sin(alpha2);
double olx = cx + (radius+w)*std::cos(alpha2);
double oly = cy + (radius+w)*std::sin(alpha2);
aBoard.drawLine(ilx, ily, olx, oly);
}
catch ( InfiniteNumberException e )
{
aBoard.drawLine( NumberTraits<Coordinate>::castToDouble(aPoint1[0]),
NumberTraits<Coordinate>::castToDouble(aPoint1[1]),
NumberTraits<Coordinate>::castToDouble(aPoint2[0]),
NumberTraits<Coordinate>::castToDouble(aPoint2[1]) );
}
}
template<typename Point >
void DGtal::Display2DFactory::drawArc ( Board2D aBoard,
const DGtal::CircleFrom3Points< Point > &  cf3p,
const Point aPoint1,
const Point aPoint2,
bool  anOrientation = true 
)
inlinestatic

Definition at line 161 of file Display2DFactory.ih.

References LibBoard::Board::drawArc(), LibBoard::Board::drawLine(), DGtal::CircleFrom3Points< TPoint >::getParameters(), M_PI, DGtal::CircleFrom3Points< TPoint >::p(), DGtal::CircleFrom3Points< TPoint >::q(), and DGtal::CircleFrom3Points< TPoint >::r().

{
typedef typename Point::Coordinate Coordinate;
typedef Point Vector;
double cx = 0, cy = 0, radius = 1;
try
{
//circle parameters
cf3p.getParameters(cx, cy, radius);
//angle parameters
double alpha1 = std::atan2( NumberTraits<Coordinate>::castToDouble(aPoint1[1])-cy,
NumberTraits<Coordinate>::castToDouble(aPoint1[0])-cx );
alpha1 = (alpha1<0)?(alpha1+2.0*M_PI):alpha1;
double alpha2 = std::atan2( NumberTraits<Coordinate>::castToDouble(aPoint2[1])-cy,
NumberTraits<Coordinate>::castToDouble(aPoint2[0])-cx );
alpha2 = (alpha2<0)?(alpha2+2.0*M_PI):alpha2;
// now with accessor
Vector u(cf3p.p() - cf3p.q());
Vector v(cf3p.r() - cf3p.p());
bool orientation = ( ( (u[0] * v[1]) - (u[1] * v[0]) ) < 0 )?(!anOrientation):anOrientation;
//drawing
aBoard.drawArc (cx, cy, radius, alpha1, alpha2, orientation);
}
catch ( InfiniteNumberException e )
{
aBoard.drawLine( NumberTraits<Coordinate>::castToDouble(aPoint1[0]),
NumberTraits<Coordinate>::castToDouble(aPoint1[1]),
NumberTraits<Coordinate>::castToDouble(aPoint2[0]),
NumberTraits<Coordinate>::castToDouble(aPoint2[1]) );
}
}
template<typename TIterator , typename TInteger , int connectivity>
void DGtal::Display2DFactory::drawAsBoundingBox ( DGtal::Board2D aBoard,
const DGtal::ArithmeticalDSS< TIterator, TInteger, connectivity > &  a 
)
inlinestatic

Definition at line 68 of file Display2DFactory.ih.

References LibBoard::Board::drawClosedPolyline(), DGtal::ArithmeticalDSS< TIterator, TInteger, connectivity >::myF, DGtal::ArithmeticalDSS< TIterator, TInteger, connectivity >::myL, DGtal::ArithmeticalDSS< TIterator, TInteger, connectivity >::myLf, DGtal::ArithmeticalDSS< TIterator, TInteger, connectivity >::myUf, and DGtal::ArithmeticalDSS< TIterator, TInteger, connectivity >::project().

{
//draw bounding box
PointD topLeft = a.project(*a.myF, a.myUf);
PointD bottomLeft = a.project(*a.myF, a.myLf);
PointD bottomRight = a.project(*a.myL, a.myLf);
PointD topRight = a.project(*a.myL, a.myUf);
LibBoard::Point topLeftBoard(topLeft[0],topLeft[1]);
LibBoard::Point bottomLeftBoard(bottomLeft[0],bottomLeft[1]);
LibBoard::Point bottomRightBoard(bottomRight[0],bottomRight[1]);
LibBoard::Point topRightBoard(topRight[0],topRight[1]);
vector<LibBoard::Point> bb;
bb.push_back(topLeftBoard);
bb.push_back(bottomLeftBoard);
bb.push_back(bottomRightBoard);
bb.push_back(topRightBoard);
aBoard.drawClosedPolyline(bb);
}
template<typename TIterator , typename TInteger , int connectivity>
void DGtal::Display2DFactory::drawAsDigitalPoints ( DGtal::Board2D aBoard,
const DGtal::ArithmeticalDSS< TIterator, TInteger, connectivity > &  a 
)
inlinestatic

Definition at line 96 of file Display2DFactory.ih.

References DGtal::NumberTraits< T >::castToDouble(), LibBoard::Board::drawPolyline(), DGtal::Board2D::getMode(), DGtal::ArithmeticalDSS< TIterator, TInteger, connectivity >::myF, and DGtal::ArithmeticalDSS< TIterator, TInteger, connectivity >::myL.

{
typedef TIterator ConstIterator;
ConstIterator itend = a.myL; ++itend;
// Draw a linking polygonal line if the pixels are drawn as points.
if(aBoard.getMode("PointVector")=="Grid" || aBoard.getMode("PointVector")=="")
{
vector<LibBoard::Point> contour;
for (ConstIterator i = a.myF; i != itend; ++i) {
Point p = *i;
contour.push_back(LibBoard::Point(xp,yp));
}
aBoard.drawPolyline(contour);
}
// Draw points
for (ConstIterator i = a.myF; i != itend; ++i) {
Point p = *i;
aBoard << p;
}
}
template<typename TInteger >
void DGtal::Display2DFactory::drawAsGrid ( DGtal::Board2D aBoard,
const DGtal::FreemanChain< TInteger > &  f 
)
inlinestatic

Definition at line 427 of file Display2DFactory.ih.

References DGtal::FreemanChain< TInteger >::computeBoundingBox(), LibBoard::Board::drawPolyline(), and DGtal::FreemanChain< TInteger >::getContourPoints().

{
typedef TInteger Integer;
typedef PointVector<2, Integer> Point;
vector<Point> aVContour;
FreemanChain<TInteger>::getContourPoints(f, aVContour);
TInteger minX, minY, maxX, maxY;
f.computeBoundingBox(minX, minY, maxX, maxY);
vector<LibBoard::Point> contour;
for(unsigned int i=0; i< aVContour.size(); i++){
contour.push_back(LibBoard::Point(NumberTraits<TInteger>::castToDouble(aVContour[i][0]),
}
aBoard.drawPolyline(contour);
}
template<typename TSpace >
void DGtal::Display2DFactory::drawAsGrid ( DGtal::Board2D aboard,
const DGtal::HyperRectDomain< TSpace > &  h 
)
inlinestatic
template<Dimension dim, typename TComponent >
void DGtal::Display2DFactory::drawAsGrid ( DGtal::Board2D board,
const DGtal::PointVector< dim, TComponent > &  p 
)
inlinestatic

Definition at line 1067 of file Display2DFactory.ih.

References LibBoard::Board::fillCircle(), and DGtal::PointVector< dim, TEuclideanRing >::myArray.

{
ASSERT(dim == 2);
board.fillCircle((float) NumberTraits<TComponent>::castToDouble(p.myArray[0]),
(float) NumberTraits<TComponent>::castToDouble(p.myArray[1]),0.1);
}
template<typename TInteger >
void DGtal::Display2DFactory::drawAsInterGrid ( DGtal::Board2D aBoard,
const DGtal::FreemanChain< TInteger > &  f 
)
inlinestatic

Definition at line 448 of file Display2DFactory.ih.

References DGtal::FreemanChain< TInteger >::computeBoundingBox(), LibBoard::Board::drawPolyline(), and DGtal::FreemanChain< TInteger >::getContourPoints().

{
typedef TInteger Integer;
typedef PointVector<2, Integer> Point;
vector<Point> aVContour;
FreemanChain<TInteger>::getContourPoints(f, aVContour);
TInteger minX, minY, maxX, maxY;
f.computeBoundingBox(minX, minY, maxX, maxY);
vector<LibBoard::Point> contour;
for(unsigned int i=0; i< aVContour.size(); i++){
contour.push_back(LibBoard::Point(NumberTraits<TInteger>::castToInt64_t(aVContour[i][0])-0.5,
NumberTraits<TInteger>::castToInt64_t(aVContour[i][1])+0.5));
}
aBoard.drawPolyline(contour);
}
template<typename TSpace >
void DGtal::Display2DFactory::drawAsPaving ( DGtal::Board2D aboard,
const DGtal::HyperRectDomain< TSpace > &  h 
)
inlinestatic

Definition at line 835 of file Display2DFactory.ih.

References LibBoard::Board::drawRectangle(), DGtal::HyperRectDomain< TSpace >::myLowerBound, and DGtal::HyperRectDomain< TSpace >::myUpperBound.

{
typedef typename TSpace::Integer Integer;
ASSERT(TSpace::dimension==2 || "drawAsPaving-NOT-YET-IMPLEMENTED-in-ND" );
if (TSpace::dimension == 2)
{
aboard.drawRectangle(x - 0.5, y + 0.5, 1, 1);
}
}
template<Dimension dim, typename TComponent >
void DGtal::Display2DFactory::drawAsPaving ( DGtal::Board2D board,
const DGtal::PointVector< dim, TComponent > &  p 
)
inlinestatic

Definition at line 1057 of file Display2DFactory.ih.

References LibBoard::Board::drawRectangle(), and DGtal::PointVector< dim, TEuclideanRing >::myArray.

{
ASSERT(dim == 2);
board.drawRectangle( (float) NumberTraits<TComponent>::castToDouble(p.myArray[0]) - 0.5f,
(float) NumberTraits<TComponent>::castToDouble(p.myArray[1]) + 0.5f, 1, 1 );
}
template<typename TIterator , typename TInteger , int connectivity>
void DGtal::Display2DFactory::drawAsPolygon ( DGtal::Board2D aBoard,
const DGtal::FP< TIterator, TInteger, connectivity > &  fp 
)
inlinestatic

Definition at line 373 of file Display2DFactory.ih.

References LibBoard::Board::drawPolyline(), DGtal::FP< TIterator, TInteger, connectivity >::flagIsClosed(), and DGtal::FP< TIterator, TInteger, connectivity >::polygon().

{
typedef std::list<Point> Polygon;
typedef typename Polygon::const_iterator ConstIterator;
//polyline to draw
vector<LibBoard::Point> polyline;
// now with accessor
ConstIterator i = fp.polygon().begin();
for ( ;i != fp.polygon().end();++i) {
Point p = (*i);
double xp = (double)NumberTraits<TInteger>::castToInt64_t(p[0]);
double yp = (double)NumberTraits<TInteger>::castToInt64_t(p[1]);
polyline.push_back(LibBoard::Point(xp,yp));
}
// now with accessor
if (fp.flagIsClosed()) {
Point p = (*fp.polygon().begin());
double xp = (double)NumberTraits<TInteger>::castToInt64_t(p[0]);
double yp = (double)NumberTraits<TInteger>::castToInt64_t(p[1]);
polyline.push_back(LibBoard::Point(xp,yp));
}
aBoard.drawPolyline(polyline);
}
template<typename Colormap , typename Image >
void DGtal::Display2DFactory::drawImage ( DGtal::Board2D board,
const Image i,
const typename Image::Value minV,
const typename Image::Value maxV 
)
inlinestatic

Definition at line 947 of file Display2DFactory.ih.

References DGtal::Color::blue(), DGtal::Image< TImageContainer >::domain(), LibBoard::Board::drawRectangle(), DGtal::Color::green(), DGtal::Color::red(), and LibBoard::Board::setFillColorRGBi().

{
typedef typename Image::Domain D;
typedef typename Image::Value V;
ASSERT(D::Space::dimension == 2);
Colormap colormap(minV, maxV);
Color c;
V val;
D ldomain(i.domain());
for (typename D::ConstIterator it = ldomain.begin();
it != ldomain.end(); ++it)
{
val = i.operator()( (*it) );
c = colormap( val );
board.setFillColorRGBi( c.red(), c.green(), c.blue());
board.drawRectangle( NumberTraits<typename D::Integer>::
castToInt64_t((*it)[0]) - 0.5,
NumberTraits<typename D::Integer>::
castToInt64_t((*it)[1]) + 0.5, 1, 1);
}
}
template<typename C , typename Domain , typename Value , typename HashKey >
void DGtal::Display2DFactory::drawImageHashTree ( Board2D board,
const DGtal::ImageContainerByHashTree< Domain, Value, HashKey > &  i,
const Value &  minV,
const Value &  maxV 
)
inlinestatic

Definition at line 921 of file Display2DFactory.ih.

References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getSpanSize(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myOrigin.

{
static const HashKey ROOT_KEY = static_cast<HashKey>(1);
ASSERT ( Domain::dimension == 2 );
C colormap ( minV, maxV );
double p[2];
double len;
p[0] = i.myOrigin[0];
p[1] = i.myOrigin[1] + i.getSpanSize();
len = i.getSpanSize();
drawImageRecursive<C>( board, i, ROOT_KEY, p, len, board, colormap );
}
template<typename C , typename Domain , typename Value , typename HashKey >
void DGtal::Display2DFactory::drawImageRecursive ( DGtal::Board2D aBoard,
const DGtal::ImageContainerByHashTree< Domain, Value, HashKey > &  i,
HashKey  key,
const double  p[2],
const double  len,
LibBoard::Board board,
const C &  cmap 
)
inlinestatic

Definition at line 872 of file Display2DFactory.ih.

References DGtal::Color::blue(), DGtal::Morton< THashKey, TPoint >::childrenKeys(), LibBoard::Board::drawRectangle(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNode(), DGtal::Color::green(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myMorton, DGtal::Color::red(), and LibBoard::Board::setFillColorRGBi().

{
ASSERT ( Domain::dimension == 2 );
double np[2], nlen;
//Node* n = i.getNode ( key );
if ( i.getNode ( key ) )
{
Color c;
c = cmap ( i.getNode ( key )->getObject() );
board.setFillColorRGBi ( c.red(), c.green(), c.blue() );
board.drawRectangle ( p[0], p[1], len, len );
}
else
{
HashKey children[4];
i.myMorton.childrenKeys ( key, children );
nlen = len / 2.0;
np[0] = p[0];
np[1] = p[1] - nlen;
drawImageRecursive<C>( aBoard, i, children[0], np, nlen, board, cmap );
np[0] = p[0] + nlen;
np[1] = p[1] - nlen;
drawImageRecursive<C>( aBoard, i, children[1], np, nlen, board, cmap );
np[0] = p[0];
np[1] = p[1];
drawImageRecursive<C>( aBoard, i, children[2], np, nlen, board, cmap );
np[0] = p[0] + nlen;
np[1] = p[1];
drawImageRecursive<C>( aBoard, i, children[3], np, nlen, board, cmap );
}
}
template<typename Point >
void DGtal::Display2DFactory::drawSector ( Board2D aBoard,
const DGtal::CircleFrom3Points< Point > &  cf3p,
const Point aPoint1,
const Point aPoint2,
bool  anOrientation = true 
)
inlinestatic

Definition at line 196 of file Display2DFactory.ih.

References LibBoard::Board::drawArc(), LibBoard::Board::drawLine(), DGtal::CircleFrom3Points< TPoint >::getParameters(), M_PI, DGtal::CircleFrom3Points< TPoint >::p(), DGtal::CircleFrom3Points< TPoint >::q(), and DGtal::CircleFrom3Points< TPoint >::r().

{
typedef typename Point::Coordinate Coordinate;
typedef Point Vector;
double cx = 0, cy = 0, radius = 1;
try
{
//circle parameters
cf3p.getParameters(cx, cy, radius);
//angle parameters
double alpha1 = std::atan2( NumberTraits<Coordinate>::castToDouble(aPoint1[1])-cy,
NumberTraits<Coordinate>::castToDouble(aPoint1[0])-cx );
alpha1 = (alpha1<0)?(alpha1+2.0*M_PI):alpha1;
double alpha2 = std::atan2( NumberTraits<Coordinate>::castToDouble(aPoint2[1])-cy,
NumberTraits<Coordinate>::castToDouble(aPoint2[0])-cx );
alpha2 = (alpha2<0)?(alpha2+2.0*M_PI):alpha2;
// now with accessor
Vector u(cf3p.p() - cf3p.q());
Vector v(cf3p.r() - cf3p.p());
bool orientation = ( ( (u[0] * v[1]) - (u[1] * v[0]) ) < 0 )?(!anOrientation):anOrientation;
//arc drawing
aBoard.drawArc (cx, cy, radius, alpha1, alpha2, orientation);
//draw the segments tied to the center
double fx = cx + radius*std::cos(alpha1);
double fy = cy + radius*std::sin(alpha1);
double lx = cx + radius*std::cos(alpha2);
double ly = cy + radius*std::sin(alpha2);
aBoard.drawLine(fx, fy, cx, cy );
aBoard.drawLine(lx, ly, cx, cy );
}
catch ( InfiniteNumberException e )
{
aBoard.drawLine( NumberTraits<Coordinate>::castToDouble(aPoint1[0]),
NumberTraits<Coordinate>::castToDouble(aPoint1[1]),
NumberTraits<Coordinate>::castToDouble(aPoint2[0]),
NumberTraits<Coordinate>::castToDouble(aPoint2[1]) );
}
}
template<typename TDigitalTopology , typename TDigitalSet >
void DGtal::Display2DFactory::drawWithAdjacencies ( DGtal::Board2D aBoard,
const DGtal::Object< TDigitalTopology, TDigitalSet > &  o 
)
inlinestatic

Definition at line 1003 of file Display2DFactory.ih.

References DGtal::HIGH_ITER_DS, DGtal::Object< TDigitalTopology, TDigitalSet >::pointSet(), DGtal::Object< TDigitalTopology, TDigitalSet >::properNeighborhood(), and DGtal::SMALL_DS.

{
typedef TDigitalSet DigitalSet;
typedef typename DigitalSet::Point Point;
typedef TDigitalTopology DigitalTopology;
typedef typename DigitalSet::Domain Domain;
typedef
typename DigitalSetSelector < Domain,
SMALL_DS + HIGH_ITER_DS >::Type SmallSet;
typedef Object<DigitalTopology, SmallSet> SmallObject;
Point p;
for (typename TDigitalSet::ConstIterator it = o.pointSet().begin();
it != o.pointSet().end();
++it)
{
//Brute-force scan of the neighborhood.
SmallObject neig = o.properNeighborhood(*it);
for (typename SmallObject::DigitalSet::ConstIterator it2 = neig.pointSet().begin();
it2 != neig.pointSet().end();
++it2)
{
p = (*it2) - (*it);
draw(aBoard, p, (*it));
}
}
}

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