本文整理汇总了C++中Board2D::saveSVG方法的典型用法代码示例。如果您正苦于以下问题:C++ Board2D::saveSVG方法的具体用法?C++ Board2D::saveSVG怎么用?C++ Board2D::saveSVG使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Board2D
的用法示例。
在下文中一共展示了Board2D::saveSVG方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: testDigitalSetBoardSnippet
bool testDigitalSetBoardSnippet()
{
typedef SpaceND<2> Z2;
typedef HyperRectDomain<Z2> Domain;
typedef Z2::Point Point;
Point p1( -10, -10 );
Point p2( 10, 10 );
Domain domain( p1, p2 );
typedef DigitalSetSelector < Domain, BIG_DS + HIGH_ITER_DS + HIGH_BEL_DS >::Type SpecificSet;
BOOST_CONCEPT_ASSERT(( concepts::CDigitalSet< SpecificSet > ));
SpecificSet mySet( domain );
Point c( 0, 0 );
mySet.insert( c );
Point d( 5, 2 );
mySet.insert( d );
Point e( 1, -3 );
mySet.insert( e );
Board2D board;
board.setUnit(LibBoard::Board::UCentimeter);
board << mySet;
board.saveSVG("myset-export.svg");
board.clear();
board.setUnit(LibBoard::Board::UCentimeter);
board << SetMode( domain.className(), "Grid" ) << domain << mySet;
board.saveSVG("simpleSet-grid.svg");
board.clear();
board.setUnit(LibBoard::Board::UCentimeter);
board << SetMode( domain.className(), "Paving" ) << domain;
board << mySet;
board.saveSVG("simpleSet-paving.svg");
board.clear();
board.setUnit(LibBoard::Board::UCentimeter);
board << CustomStyle( mySet.className(), new MyDomainStyleCustomRed );
board << mySet;
board.saveSVG("simpleSet-color.svg");
return true;
}
示例3: main
int main()
{
trace.beginBlock ( "Example dgtalBoard2D-1-points" );
Point p1( -3, -2 );
Point p2( 7, 3 );
Point p3( 0, 0 );
Domain domain( p1, p2 );
Board2D board;
board << domain << p1 << p2 << p3;
board.saveSVG("dgtalBoard2D-1-points.svg");
board.saveEPS("dgtalBoard2D-1-points.eps");
board.saveTikZ("dgtalBoard2D-1-points.tikz");
#ifdef WITH_CAIRO
board.saveCairo("dgtalBoard2D-1-points-cairo.pdf", Board2D::CairoPDF);
board.saveCairo("dgtalBoard2D-1-points-cairo.png", Board2D::CairoPNG);
board.saveCairo("dgtalBoard2D-1-points-cairo.ps", Board2D::CairoPS);
board.saveCairo("dgtalBoard2D-1-points-cairo.svg", Board2D::CairoSVG);
#endif
trace.endBlock();
return 0;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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();
}
示例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 << 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;
}
示例8: 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;
}
示例9: testDigitalSetBoardSnippet
bool testDigitalSetBoardSnippet()
{
typedef SpaceND<2> Z2;
typedef HyperRectDomain<Z2> Domain;
typedef Z2::Point Point;
Point p1( -10, -10 );
Point p2( 10, 10 );
Domain domain( p1, p2 );
typedef DigitalSetSelector < Domain, BIG_DS + HIGH_ITER_DS + HIGH_BEL_DS >::Type SpecificSet;
SpecificSet mySet( domain );
Point c( 0, 0 );
mySet.insert( c );
Point d( 5, 2 );
mySet.insert( d );
Point e( 1, -3 );
mySet.insert( e );
Board2D board;
board.setUnit(Board::UCentimeter);
board << mySet;
board.saveSVG("myset-export.svg");
board.clear();
board.setUnit(Board::UCentimeter);
board << DrawDomainGrid() << domain << mySet;
board.saveSVG("simpleSet-grid.svg");
board.clear();
board.setUnit(Board::UCentimeter);
board << DrawDomainPaving() << domain;
board << mySet;
board.saveSVG("simpleSet-paving.svg");
board.clear();
board.setUnit(Board::UCentimeter);
board << CustomStyle( mySet.styleName(), new MyDomainStyleCustomRed );
board << mySet;
board.saveSVG("simpleSet-color.svg");
return true;
}
示例10: testSimpleBoard
/**
* Example of a test. To be completed.
*
*/
bool testSimpleBoard()
{
unsigned int nbok = 0;
unsigned int nb = 2;
trace.beginBlock ( "Testing class SimpleBoard" );
Board2D board;
board.setPenColorRGBi( 0, 0, 0);
board.drawRectangle( -1, 1, 2.0, 2.0 );
board.setPenColorRGBi( 0, 0, 255 );
board.fillCircle( 2, 2, 1 );
board.saveSVG( "simpleboard.svg" );
board.saveFIG( "simpleboard.fig" );
board.saveEPS( "simpleboard.eps" );
board.saveTikZ( "simpleboard.tikz" );
nbok++;
typedef PointVector<2,int> Point2D;
Point2D apoint, p2;
apoint[0] = 5;
p2[0] = 1;
apoint[1] = 8;
p2[1] = 1;
board.setPenColorRGBi( 255, 0, 255 );
board << apoint;
board.setPenColorRGBi( 255, 0, 0 );
Display2DFactory::draw(board, apoint, p2);
board.scale(10);
board.saveSVG( "pointsimpleboard.svg" );
board.saveFIG( "pointsimpleboard.fig" );
board.saveEPS( "pointsimpleboard.eps" );
board.saveTikZ( "pointsimpleboard.tikz" );
nbok++;
trace.endBlock();
return nbok == nb;
}
示例11: 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;
}
示例12: main
int main( int argc, char** argv )
{
trace.beginBlock ( "Example exampleBezierCurve" );
trace.info() << "Args:";
for ( int i = 0; i < argc; ++i )
trace.info() << " " << argv[ i ];
trace.info() << endl;
//control points
typedef PointVector<2,int> Point;
Point P(0,0), Q(4,4), R(8,0);
//display
Board2D board;
//with fill
board << SetMode(P.className(), "Grid") << P << Q << R;
board.drawQuadraticBezierCurve(P[0], P[1], Q[0], Q[1], R[0], R[1]);
board.saveSVG("BezierCurve.svg", Board2D::BoundingBox, 5000 );
board.saveEPS("BezierCurve.eps", Board2D::BoundingBox, 5000 );
board.saveTikZ("BezierCurve.tikz", Board2D::BoundingBox, 5000 );
board.saveFIG("BezierCurve.fig", Board2D::BoundingBox, 5000 );
#ifdef WITH_CAIRO
board.saveCairo("BezierCurve.pdf", Board2D::CairoPDF);
#endif
board.clear();
//without fill
board << SetMode(P.className(), "Grid") << P << Q << R;
board.setFillColor(Color::None);
board.drawQuadraticBezierCurve(P[0], P[1], Q[0], Q[1], R[0], R[1]);
board.saveSVG("BezierCurve2.svg", Board2D::BoundingBox, 5000 );
board.saveEPS("BezierCurve2.eps", Board2D::BoundingBox, 5000 );
board.saveTikZ("BezierCurve2.tikz", Board2D::BoundingBox, 5000 );
board.saveFIG("BezierCurve2.fig", Board2D::BoundingBox, 5000 );
#ifdef WITH_CAIRO
board.saveCairo("BezierCurve2.pdf", Board2D::CairoPDF);
#endif
trace.endBlock();
return 0;
}
示例13: testBIGINTEGERSpace
/**
* Example of a test. To be completed.
*
*/
bool testBIGINTEGERSpace()
{
unsigned int nbok = 0;
unsigned int nb = 0;
trace.beginBlock ( "BIGINTEGER Space test..." );
//This space is weird...
typedef SpaceND<2, DGtal::BigInteger> Space2;
typedef Space2::Point Point;
typedef Space2::Point::Coordinate Coordinate;
typedef HyperRectDomain<Space2> Domain;
DGtal::BigInteger a, b, c;
a = 1234;
b = "-5678";
Point p(a,b);
typedef FreemanChain<Coordinate> Contour;
typedef ArithmeticalDSS<Contour::ConstIterator,Coordinate,4> DSS4;
typedef GreedySegmentation<DSS4> Decomposition;
// Construct the Freeman chain
std::stringstream ss(stringstream::in | stringstream::out);
ss << "31 16 11121212121212212121212212122122222322323233323333333323333323303330330030300000100010010010001000101010101111" << endl;
Contour theContour( ss );
//Segmentation
Decomposition theDecomposition( theContour.begin(),theContour.end(),DSS4() );
Decomposition::SegmentComputerIterator i = theDecomposition.begin();
DSS4 segment(*i);
Point p1( 0, 0 );
Point p2( 31, 31 );
trace.info() <<"p2.norm()= "<< p2.norm()<<endl;
Domain domain( p1, p2 );
Board2D aBoard;
aBoard << SetMode( domain.className(), "Grid" )
<< domain
<< theContour
<< segment;
aBoard.saveSVG("testgmpcontour.svg");
nbok += true ? 1 : 0;
nb++;
trace.info() << "(" << nbok << "/" << nb << ") "
<< "true == true" << std::endl;
trace.endBlock();
return nbok == nb;
}
示例14: testDSS4drawing
/**
* Test for 4-connected points
*
*/
bool testDSS4drawing()
{
typedef PointVector<2,int> Point;
typedef std::vector<Point>::iterator Iterator;
typedef ArithmeticalDSS<Iterator,int,4> DSS4;
std::vector<Point> contour;
contour.push_back(Point(0,0));
contour.push_back(Point(1,0));
contour.push_back(Point(1,1));
contour.push_back(Point(2,1));
contour.push_back(Point(3,1));
contour.push_back(Point(3,2));
contour.push_back(Point(4,2));
contour.push_back(Point(5,2));
contour.push_back(Point(6,2));
contour.push_back(Point(6,3));
contour.push_back(Point(6,4));
// Adding step
trace.beginBlock("Add points while it is possible and draw the result");
DSS4 theDSS4;
theDSS4.init( contour.begin() );
trace.info() << theDSS4 << " " << theDSS4.isValid() << std::endl;
while ( (theDSS4.end() != contour.end())
&&(theDSS4.extendForward()) ) {}
trace.info() << theDSS4 << " " << theDSS4.isValid() << std::endl;
HyperRectDomain< SpaceND<2,int> > domain( Point(0,0), Point(10,10) );
Board2D board;
board.setUnit(Board::UCentimeter);
board << SetMode(domain.className(), "Grid")
<< domain;
board << SetMode("PointVector", "Grid");
board << SetMode(theDSS4.className(), "Points")
<< theDSS4;
board << SetMode(theDSS4.className(), "BoundingBox")
<< theDSS4;
board.saveSVG("DSS4.svg");
trace.endBlock();
return true;
}
示例15: testPNMWriter
/**
* Example of a test. To be completed.
*
*/
bool testPNMWriter()
{
trace.beginBlock ( "Testing block ..." );
typedef SpaceND<2> TSpace;
typedef TSpace::Point Point;
typedef HyperRectDomain<TSpace> Domain;
typedef HueShadeColorMap<unsigned char> Hue;
typedef HueShadeColorMap<unsigned char,2> HueTwice;
typedef GrayscaleColorMap<unsigned char> Gray;
// Gradient using the "Jet" preset.
typedef GradientColorMap<unsigned char, CMAP_JET > Jet;
// Gradient from black to red.
const int BlackColor = DGTAL_RGB2INT(0,0,0);
const int RedColor = DGTAL_RGB2INT(255,0,0);
typedef GradientColorMap< unsigned char, CMAP_CUSTOM, BlackColor, RedColor > RedShade1;
// Gradient from black to red, using a ColorBrightnessColorMap.
typedef ColorBrightnessColorMap< unsigned char, RedColor > RedShade2;
Point a ( 1, 1);
Point b ( 16, 16);
typedef ImageSelector<Domain, unsigned char>::Type Image;
Image image(Domain(a,b));
for(unsigned int i=0 ; i < 256; i++)
image[i] = i;
PPMWriter<Image,Hue>::exportPPM("export-hue.ppm",image, Hue(0,255) );
PPMWriter<Image,HueTwice>::exportPPM("export-hue-twice.ppm",image,HueTwice(0,255));
PGMWriter<Image>::exportPGM("export-hue-twice.pgm",image);
PPMWriter<Image,Gray>::exportPPM("export-gray.ppm",image, Gray(0,255));
PPMWriter<Image,Jet>::exportPPM("export-jet.ppm",image,Jet(0,255));
PPMWriter<Image,RedShade1>::exportPPM("export-red1.ppm",image,RedShade1(0,255));
PPMWriter<Image,RedShade2>::exportPPM("export-red2.ppm",image,RedShade2(0,255));
//TestingFunctor
typedef DGtal::functors::Composer< Jet, functors::RedChannel, unsigned char> RedFunctor;
RedFunctor redFunctor( Jet(0,255), functors::RedChannel() ) ;
PGMWriter<Image, RedFunctor>::exportPGM("export-jet-red.pgm",image, redFunctor);
//test Raw export
RawWriter<Image>::exportRaw8("export-hue-twice.raw",image);
//test Image export with libboard
Board2D board;
board.setUnit(LibBoard::Board::UCentimeter);
Display2DFactory::drawImage<HueTwice>(board, image, (unsigned char)0, (unsigned char)255);
board.saveSVG("export-hue-twice.svg");
trace.endBlock();
return true;
}