DGtal  1.3.beta
Functions
testBoard2DCustomStyle.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/kernel/SpaceND.h"
#include "DGtal/kernel/domains/HyperRectDomain.h"
#include "DGtal/kernel/sets/DigitalSetBySTLVector.h"
#include "DGtal/kernel/sets/DigitalSetBySTLSet.h"
#include "DGtal/kernel/sets/DigitalSetSelector.h"
#include "DGtal/io/boards/Board2D.h"
Include dependency graph for testBoard2DCustomStyle.cpp:

Go to the source code of this file.

Functions

bool testBoard2DCustomStyle ()
 
int main (int argc, char **argv)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
davidcoeurjolly (login) (Unknown ) Unknown
Date
2010/10/24

Functions for testing class Board2DCustomStyle.

This file is part of the DGtal library.

Definition in file testBoard2DCustomStyle.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 114 of file testBoard2DCustomStyle.cpp.

115 {
116  trace.beginBlock ( "Testing class Board2DCustomStyle" );
117  trace.info() << "Args:";
118  for ( int i = 0; i < argc; ++i )
119  trace.info() << " " << argv[ i ];
120  trace.info() << endl;
121 
122  bool res = testBoard2DCustomStyle(); // && ... other tests
123  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
124  trace.endBlock();
125  return res ? 0 : 1;
126 }

References DGtal::Trace::beginBlock(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::Trace::info(), testBoard2DCustomStyle(), and DGtal::trace.

◆ testBoard2DCustomStyle()

bool testBoard2DCustomStyle ( )

Example of a test. To be completed.

Definition at line 67 of file testBoard2DCustomStyle.cpp.

68 {
69  unsigned int nbok = 0;
70  unsigned int nb = 0;
71 
72  typedef SpaceND<2> Z2;
73 
75  typedef Z2::Point Point;
76  Point p1( -10, -10 );
77  Point p2( 10, 10 );
78  Domain domain( p1, p2 );
79  typedef DigitalSetSelector
80  < Domain, BIG_DS + HIGH_ITER_DS + HIGH_BEL_DS >::Type SpecificSet;
81  SpecificSet mySet( domain );
82 
83  Point c( 0, 0 );
84  mySet.insert( c );
85  Point d( 5, 2 );
86  mySet.insert( d );
87  Point e( 1, -3 );
88  mySet.insert( e );
89 
90 
91  Board2D board;
93 
94  board << SetMode( domain.className(), "Grid" ) << domain
95  << domain
96  << mySet;
97  board.saveSVG("testcustom-prev.svg");
98 
99  board.clear();
100 
101  board << SetMode( domain.className(), "Grid" ) << domain
102  << domain
103  << CustomStyle( mySet.className(), new MyDrawStyleCustomGreen )
104  << mySet;
105  board.saveSVG("testcustom-next.svg");
106 
107 
108  return nbok == nb;
109 }

References DGtal::BIG_DS, DGtal::HyperRectDomain< TSpace >::className(), LibBoard::Board::clear(), domain, DGtal::HIGH_BEL_DS, DGtal::HIGH_ITER_DS, LibBoard::Board::saveSVG(), LibBoard::Board::setUnit(), and LibBoard::Board::UCentimeter.

Referenced by main().

LibBoard::Board::setUnit
void setUnit(Unit unit)
Definition: Board.cpp:240
DGtal::HyperRectDomain
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
Definition: HyperRectDomain.h:99
DGtal::Trace::endBlock
double endBlock()
DGtal::DigitalSetSelector
Aim: Automatically defines an adequate digital set type according to the hints given by the user.
Definition: DigitalSetSelector.h:88
DGtal::Z2i::Z2
Space Z2
Definition: StdDefs.h:76
LibBoard::Board::UCentimeter
@ UCentimeter
Definition: Board.h:43
DGtal::Trace::emphase
std::ostream & emphase()
DGtal::trace
Trace trace
Definition: Common.h:154
DGtal::HyperRectDomain::className
std::string className() const
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
LibBoard::Board::clear
void clear(const DGtal::Color &color=DGtal::Color::None)
Definition: Board.cpp:152
DGtal::HIGH_BEL_DS
@ HIGH_BEL_DS
Definition: DigitalSetSelector.h:63
DGtal::SpaceND
Definition: SpaceND.h:95
DGtal::CustomStyle
Definition: Board2D.h:217
DGtal::Trace::info
std::ostream & info()
Domain
HyperRectDomain< Space > Domain
Definition: testSimpleRandomAccessRangeFromPoint.cpp:44
LibBoard::Board::saveSVG
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1012
DGtal::BIG_DS
@ BIG_DS
Definition: DigitalSetSelector.h:60
DGtal::Board2D
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:70
domain
Domain domain
Definition: testProjection.cpp:88
DGtal::HIGH_ITER_DS
@ HIGH_ITER_DS
Definition: DigitalSetSelector.h:62
DGtal::SetMode
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
Definition: Board2D.h:247
testBoard2DCustomStyle
bool testBoard2DCustomStyle()
Definition: testBoard2DCustomStyle.cpp:67
Point
MyPointD Point
Definition: testClone2.cpp:383