本文整理汇总了C++中Board2D类的典型用法代码示例。如果您正苦于以下问题:C++ Board2D类的具体用法?C++ Board2D怎么用?C++ Board2D使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Board2D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selfDraw
virtual void selfDraw(Board2D & aboard) const
{
aboard.setFillColor( myColor );
aboard.setPenColorRGBi( 0, 0, 0 );
aboard.setLineStyle( LibBoard::Shape::SolidStyle );
aboard.setLineWidth( 1.0 );
}
示例2: testDomain
bool testDomain()
{
typedef SpaceND<2> TSpace;
typedef TSpace::Point Point;
Point a ( 1, 1);
Point b ( 15, 15);
trace.beginBlock ( "HyperRectDomain Iterator" );
HyperRectDomain<TSpace> myDomain ( a,b );
Board2D board;
board << DrawDomainGrid() << myDomain;
board.scale(10);
board.saveSVG( "domain-grid.svg" );
Board2D b2;
b2 << DrawDomainPaving() << myDomain;
b2.scale(10);
b2.saveSVG( "domain-paving.svg" );
trace.endBlock();
PointVector<3,int> pl;
//An assert should be raised
//pl.selfDraw(b2);
return true;
}
示例3: drawingTestStabbingCircleComputer
bool drawingTestStabbingCircleComputer(const TCurve& curve, const string& suffix)
{
typedef typename TCurve::IncidentPointsRange Range; //range
Range r = curve.getIncidentPointsRange(); //range
{
typedef typename Range::ConstIterator ConstIterator; //iterator
StabbingCircleComputer<ConstIterator> s;
longestSegment(s,r.begin(),r.end());
Board2D board;
board << r << s;
std::stringstream ss;
ss << "StabbingCircleComputerDrawingTest" << suffix << ".eps";
board.saveEPS(ss.str().c_str());
}
{
typedef typename Range::ConstReverseIterator ConstReverseIterator; //iterator
StabbingCircleComputer<ConstReverseIterator> s;
longestSegment(s,r.rbegin(),r.rend());
Board2D board;
board << r << s;
std::stringstream ss;
ss << "StabbingCircleComputerDrawingTest" << suffix << "2.eps";
board.saveEPS(ss.str().c_str());
}
return true;
}
示例4: main
int main( int argc, char** argv )
{
trace.beginBlock ( "Example convex-and-concave-parts" );
trace.info() << "Args:";
for ( int i = 0; i < argc; ++i )
trace.info() << " " << argv[ i ];
trace.info() << endl;
string codes;
if (argc >= 2) codes = argv[1];
else codes = "0300303303033030303000010101011010110100000303303033030303000010101101010110100000333";
stringstream ss(stringstream::in | stringstream::out);
ss << "0 0 " << codes << endl;
Range theContour( ss );
trace.info() << "Processing of " << ss.str() << endl;
//Maximal Segments
Board2D aBoard;
aBoard
<< SetMode( "PointVector", "Grid" )
<< theContour;
segmentationIntoMaximalDSSs(theContour.begin(), theContour.end(), aBoard);
aBoard.saveSVG("convex-and-concave-parts.svg");
trace.endBlock();
return 0;
}
示例5: selfDraw
virtual void selfDraw(Board2D & aboard) const
{
aboard.setFillColorRGBi(150, 150, 160);
aboard.setPenColorRGBi(150, 150, 160);
aboard.setLineStyle(Board2D::Shape::DashStyle);
aboard.setLineWidth( 1.0 );
}
示例6: main
int main()
{
KSpace K;
Point plow(-3,-2);
Point pup(5,3);
Domain domain( plow, pup );
Board2D board; // for 2D display
K.init( plow, pup, true );
board << SetMode( domain.styleName(), "Paving" )
<< domain;
Cell pixlow = K.uSpel( plow ); // pixel (-3*2+1,-2*2+1)
Cell ptlow = K.uPointel( plow ); // pointel (-3*2,-2*2)
Cell pixup = K.uSpel( pup ); // pixel (5*2+1,3*2+1)
Cell ptup1 = K.uPointel( pup ); // pointel (5*2,3*2)
Cell ptup2 = K.uTranslation( ptup1, Point::diagonal() ); // pointel (6*2,4*2)
Cell linelb = K.uCell( Point( 1, 0 ) ); // linel (1,0) bottom
Cell linelt = K.uCell( Point( 1, 2 ) ); // linel (1,2) top
Cell linell = K.uCell( Point( 0, 1 ) ); // linel (0,1) left
Cell linelr = K.uCell( Point( 2, 1 ) ); // linel (2,1) right
board << CustomStyle( ptlow.styleName(),
new CustomColors( Color( 0, 0, 200 ),
Color( 100, 100, 255 ) ) )
<< ptlow << ptup2;
board << CustomStyle( pixlow.styleName(),
new CustomColors( Color( 200, 0, 0 ),
Color( 255, 100, 100 ) ) )
<< pixlow << pixup;
board << CustomStyle( linelb.styleName(),
new CustomColors( Color( 0, 200, 0 ),
Color( 100, 255, 100 ) ) )
<< linelb << linelt << linell << linelr;
board.saveSVG("ctopo-1.svg");
board.saveEPS("ctopo-1.eps");
return 0;
}
示例7: testDomain
bool testDomain()
{
typedef SpaceND<2> TSpace;
typedef TSpace::Point Point;
Point a ( 1, 1);
Point b ( 15, 15);
trace.beginBlock ( "HyperRectDomain Iterator" );
HyperRectDomain<TSpace> myDomain ( a,b );
Board2D board;
board << SetMode( myDomain.className(), "Grid" ) << myDomain;
board.scale(10);
board.saveSVG( "domain-grid.svg" );
board.saveTikZ( "domain-grid.tikz" );
Board2D b2;
b2 << SetMode( myDomain.className(), "Paving" ) << myDomain;
b2.scale(10);
b2.saveSVG( "domain-paving.svg" );
b2.saveTikZ( "domain-paving.tikz" );
trace.endBlock();
PointVector<3,int> pl;
//An assert should be raised
//Display2DFactory::draw(b2, pl);
return true;
}
示例8: testBadKeySizes
bool testBadKeySizes()
{
typedef SpaceND<2> SpaceType;
typedef HyperRectDomain<SpaceType> TDomain;
typedef TDomain::Point Point;
Board2D board;
typedef HueShadeColorMap<unsigned char,2> HueTwice;
board.setUnit(Board2D::UCentimeter);
//Default image selector = STLVector
typedef ImageContainerByHashTree<TDomain, char> Image;
Point d(128,128);
trace.beginBlock ( "Test maximal depth > number of bits of the HashKey type" );
Image myImage ( 3, 80, 0 );
trace.info() << myImage;
trace.endBlock();
trace.beginBlock ( "Test morton hash size > number of bits of the HashKey type" );
///This should raise an ASSERT abort if uncommented
// Image myImage2 ( 80, 8, 0 );
//trace.info() << myImage2;
trace.endBlock();
//Default image selector = STLVector
typedef ImageContainerByHashTree<TDomain, unsigned int, DGtal::uint32_t> Image2;
trace.beginBlock ( "Changing the HashKey type" );
Image2 myImage3( 3, 80, 0 );
trace.info() << myImage3;
trace.endBlock();
return true;
}
示例9: draw
void draw( const TImage aImg, const double& aMaxValue, std::string aBasename)
{
typedef typename TImage::Domain::ConstIterator ConstIteratorOnPoints;
typedef typename TImage::Domain::Point Point;
HueShadeColorMap<double, 2> colorMap(0,aMaxValue);
Board2D b;
b.setUnit ( LibBoard::Board::UCentimeter );
for (ConstIteratorOnPoints it = aImg.domain().begin(), itEnd = aImg.domain().end();
it != itEnd; ++it)
{
Point p = *it;
b << CustomStyle( p.className(), new CustomFillColor( colorMap( aImg(p) ) ) );
b << p;
}
{
std::stringstream s;
s << aBasename << ".eps";
b.saveEPS(s.str().c_str());
}
#ifdef WITH_CAIRO
{
std::stringstream s;
s << aBasename << ".png";
b.saveCairo(s.str().c_str(), Board2D::CairoPNG);
}
#endif
}
示例10: testDrawGridCurve
/**
* Display
*
*/
bool testDrawGridCurve(const string &filename)
{
GridCurve<KhalimskySpaceND<2> > c; //grid curve
trace.info() << endl;
trace.info() << "Displaying GridCurve " << endl;
//reading grid curve
fstream inputStream;
inputStream.open (filename.c_str(), ios::in);
c.initFromVectorStream(inputStream);
inputStream.close();
//displaying it
Board2D aBoard;
aBoard.setUnit(Board2D::UCentimeter);
aBoard << c;
aBoard.saveEPS( "GridCurve.eps", Board2D::BoundingBox, 5000 );
#ifdef WITH_CAIRO
aBoard.saveCairo("GridCurve-cairo.pdf", Board2D::CairoPDF, Board2D::BoundingBox, 5000);
#endif
return true;
}
示例11: testDrawRange
bool testDrawRange(const Range &aRange, const string &aName, const string& aDomainMode)
{
std::stringstream s;
s << aName << "Range.eps";
trace.info() << endl;
trace.info() << "Drawing " << s.str() << " (" << aRange.size() << " elts)" << endl;
//board
Board2D aBoard;
aBoard.setUnit(Board2D::UCentimeter);
//displaying domain
PointVector<2,int> low(-1,-1);
PointVector<2,int> up(3,3);
if (aDomainMode == "Paving") up = PointVector<2,int>(4,4);
HyperRectDomain< SpaceND<2,int> > aDomain( low,up );
aBoard << SetMode(aDomain.className(), aDomainMode) << aDomain;
//displaying range
aBoard << aRange;
//save
aBoard.saveEPS( s.str().c_str(), Board2D::BoundingBox, 5000 );
return true;
}
示例12: testPNMReader
/**
* Example of a test. To be completed.
*
*/
bool testPNMReader()
{
unsigned int nbok = 0;
unsigned int nb = 0;
trace.beginBlock ( "Testing pgm reader ..." );
nbok += true ? 1 : 0;
nb++;
std::string filename = testPath + "samples/circleR10.pgm";
trace.info() << "Loading filename: "<< filename<<std::endl;
typedef ImageSelector < Z2i::Domain, unsigned int>::Type Image;
Image image = PNMReader<Image>::importPGM( filename );
Z2i::DigitalSet set2d (image.domain());
SetFromImage<Z2i::DigitalSet>::append<Image>(set2d, image, 0, 255);
Board2D board;
board << image.domain() << set2d; // display domain and set
board.saveEPS( "testPNMReader.eps");
trace.info() << "(" << nbok << "/" << nb << ") "
<< "true == true" << std::endl;
trace.endBlock();
return nbok == nb;
}
示例13: exampleNaiveDSS
/**
* @brief Function that illustrates the basic usage of
* a naive DSS.
*/
void exampleNaiveDSS()
{
trace.beginBlock ( "Naive DSS" );
using namespace Z2i;
//! [ArithmeticalDSSNaiveCtor]
// Construct a naive DSS
NaiveDSS8<Integer> segment( 5, 8, //slope
Point(0,0), Point(8,5), //ending points
Point(0,0), Point(8,5), //upper points
Point(3,1), Point(3,1) //lower points
);
//! [ArithmeticalDSSNaiveCtor]
// Trace to the standard output
trace.info() << segment << std::endl;
//! [ArithmeticalDSSIteration]
// Trace the position and remainder of each point
for (NaiveDSS8<Integer>::ConstIterator
it = segment.begin(),
ite = segment.end();
it != ite; ++it )
{
trace.info() << "("
<< segment.position( *it ) << ","
<< segment.remainder( *it )
<< ") ";
}
//! [ArithmeticalDSSIteration]
trace.info() << std::endl;
//! [NaiveDSS8DrawingUsage]
Board2D board;
// Draw the grid
Domain domain( Point(0,0), Point(8,5) );
board << SetMode(domain.className(), "Grid")
<< domain;
//Draw the points of the DSS
board << SetMode("PointVector", "Both");
board << SetMode(segment.className(), "Points")
<< segment;
// Draw the bounding box
board << SetMode(segment.className(), "BoundingBox")
<< segment;
//! [NaiveDSS8DrawingUsage]
// Save
board.saveSVG("NaiveDSS8.svg");
#ifdef WITH_CAIRO
board.saveCairo("NaiveDSS8.png", Board2D::CairoPNG);
#endif
trace.endBlock();
}
示例14: testImplicitShape
/**
* Example of a test. To be completed.
*
*/
bool testImplicitShape()
{
unsigned int nbok = 0;
unsigned int nb = 0;
trace.beginBlock ( "Testing implicit shaper ..." );
Z2i::Point a(0,0);
Z2i::Point b(64,64);
Z2i::Point c(32,32);
Board2D board;
Z2i::Domain domain(a,b);
Z2i::DigitalSet set(domain);
Shapes<Z2i::Domain>::shaper( set,
ImplicitBall<Z2i::Space>( c, 10));
board << set;
board.saveSVG("implicitball.svg");
set.clear();
board.clear();
Shapes<Z2i::Domain>::shaper( set,
ImplicitHyperCube<Z2i::Space>( c, 10));
board << set;
board.saveSVG("implicitcube.svg");
set.clear();
board.clear();
Shapes<Z2i::Domain>::shaper( set,
ImplicitNorm1Ball<Z2i::Space>( c, 10));
board << set;
board.saveSVG("implicitlosange.svg");
set.clear();
board.clear();
Shapes<Z2i::Domain>::shaper( set,
ImplicitRoundedHyperCube<Z2i::Space>( c, 10, 1));
board << set;
board.saveSVG("implicitrounded-1.svg");
set.clear();
board.clear();
Shapes<Z2i::Domain>::shaper( set,
ImplicitRoundedHyperCube<Z2i::Space>( c, 10, 2.5));
board << set;
board.saveSVG("implicitrounded-2.5.svg");
nbok += true ? 1 : 0;
nb++;
trace.info() << "(" << nbok << "/" << nb << ") "
<< "true == true" << std::endl;
trace.endBlock();
return nbok == nb;
}
示例15: testDSS8drawing
/**
* Test for 8-connected points
*
*/
bool testDSS8drawing()
{
typedef PointVector<2,int> Point;
typedef std::vector<Point>::iterator Iterator;
typedef ArithmeticalDSS<Iterator,int,8> DSS8;
std::vector<Point> boundary;
boundary.push_back(Point(0,0));
boundary.push_back(Point(1,1));
boundary.push_back(Point(2,1));
boundary.push_back(Point(3,2));
boundary.push_back(Point(4,2));
boundary.push_back(Point(5,2));
boundary.push_back(Point(6,3));
boundary.push_back(Point(6,4));
// Good Initialisation
trace.beginBlock("Add points while it is possible and draw the result");
DSS8 theDSS8;
theDSS8.init( boundary.begin() );
trace.info() << theDSS8 << " " << theDSS8.isValid() << std::endl;
{
while ( (theDSS8.end()!=boundary.end())
&&(theDSS8.extendForward()) ) {}
trace.info() << theDSS8 << " " << theDSS8.isValid() << std::endl;
HyperRectDomain< SpaceND<2,int> > domain( Point(0,0), Point(10,10) );
Board2D board;
board.setUnit(Board::UCentimeter);
board << SetMode(domain.className(), "Paving")
<< domain;
board << SetMode("PointVector", "Both");
board << SetMode(theDSS8.className(), "Points")
<< theDSS8;
board << SetMode(theDSS8.className(), "BoundingBox")
<< theDSS8;
board.saveSVG("DSS8.svg");
}
trace.endBlock();
return true;
}