本文整理汇总了C++中Board2D::drawPolyline方法的典型用法代码示例。如果您正苦于以下问题:C++ Board2D::drawPolyline方法的具体用法?C++ Board2D::drawPolyline怎么用?C++ Board2D::drawPolyline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Board2D
的用法示例。
在下文中一共展示了Board2D::drawPolyline方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
drawVectorOfPointsAsPolygon( const vector<PointVector<2,Coordinate> >& v, Board2D & aBoard)
{
//polyline to draw
vector<LibBoard::Point> polyline;
typename vector<PointVector<2,Coordinate> >::const_iterator i = v.begin();
for ( ;i != v.end();++i) {
PointVector<2,Coordinate> p = (*i);
double xp = (double) p[0];
double yp = (double) p[1];
polyline.push_back(LibBoard::Point(xp,yp));
}
aBoard.drawPolyline(polyline);
}
示例2: main
//.........这里部分代码省略.........
new CustomPenColor( DGtal::Color::Gray ) );
aBoard << segment; // draw each segment
}
} else if (processingName == "FP") {
typedef FP<std::vector<Z2i::Point>::iterator,int,4> FP;
FP theFP( vPts.begin(),vPts.end() );
aBoard << CustomStyle( theFP.className(),
new CustomPenColor( DGtal::Color::Black ) );
aBoard << theFP;
} else if (processingName == "MLP") {
typedef FP<std::vector<Z2i::Point>::iterator,int,4> FP;
FP theFP( vPts.begin(),vPts.end() );
std::vector<FP::RealPoint> v( theFP.size() );
theFP.copyMLP( v.begin() );
//polyline to draw
std::vector<LibBoard::Point> polyline;
std::vector<FP::RealPoint>::const_iterator it = v.begin();
for ( ; it != v.end(); ++it) {
FP::RealPoint p = (*it);
polyline.push_back(LibBoard::Point(p[0],p[1]));
}
if (isClosed) {
FP::RealPoint p = (*v.begin());
polyline.push_back(LibBoard::Point(p[0],p[1]));
}
aBoard.setPenColor(DGtal::Color::Black);
aBoard.drawPolyline(polyline);
} else if (processingName == "MDCA") {
typedef KhalimskySpaceND<2,int> KSpace;
typedef GridCurve<KSpace> Curve;
Curve curve; //grid curve
curve.initFromPointsVector( vPts );
typedef Curve::IncidentPointsRange Range; //range
Range r = curve.getIncidentPointsRange(); //range
typedef Range::ConstCirculator ConstCirculator; //iterator
typedef StabbingCircleComputer<ConstCirculator> SegmentComputer; //segment computer
//typedef GeometricalDCA<ConstIterator> SegmentComputer; //segment computer
typedef SaturatedSegmentation<SegmentComputer> Segmentation;
//Segmentation theSegmentation( r.begin(), r.end(), SegmentComputer() );
Segmentation theSegmentation( r.c(), r.c(), SegmentComputer() );
theSegmentation.setMode("Last");
// board << curve;
Segmentation::SegmentComputerIterator it = theSegmentation.begin();
Segmentation::SegmentComputerIterator itEnd = theSegmentation.end();
Board2D otherBoard;
otherBoard.setPenColor(DGtal::Color::Black);
otherBoard << curve;
for ( ; it != itEnd; ++it ) {
aBoard << SetMode(SegmentComputer().className(), "") << (*it);
otherBoard << SetMode(SegmentComputer().className(), "") << (*it);
}
otherBoard.saveSVG("mdca.svg", Board2D::BoundingBox, 5000 );
}
}
}
示例3: main
//.........这里部分代码省略.........
if(args.check("-backgroundImageXFIG")){
string imageName = args.getOption("-backgroundImageXFIG")->getValue(0);
unsigned int width = args.getOption("-backgroundImageXFIG")->getIntValue(1);
unsigned int height = args.getOption("-backgroundImageXFIG")->getIntValue(2);
aBoard.drawImage(imageName, 0,height-1, width, height, -1, 1.0 );
}
if(args.check("-fc")){
string fileName = args.getOption("-fc")->getValue(0);
vector< FreemanChain<int> > vectFc = PointListReader< Z2i::Point>:: getFreemanChainsFromFile<int> (fileName);
//aBoard << SetMode( vectFc.at(0).className(), "InterGrid" );
aBoard << CustomStyle( vectFc.at(0).className(),
new CustomColors( Color::Red , (filled ? (Color::Black) : (Color::None)) ) );
for(unsigned int i=0; i<vectFc.size(); i++){
aBoard << vectFc.at(i) ;
}
}
if( args.check("-sdp") || args.check("-sfp")){
bool drawPoints= args.check("-drawContourPoint");
bool invertYaxis = args.check("-invertYaxis");
double pointSize = args.getOption("-drawContourPoint")->getFloatValue(0);
vector<LibBoard::Point> contourPt;
if(args.check("-sdp")){
string fileName = args.getOption("-sdp")->getValue(0);
vector< Z2i::Point > contour =
PointListReader< Z2i::Point >::getPointsFromFile(fileName);
for(unsigned int j=0; j<contour.size(); j++){
LibBoard::Point pt((double)(contour.at(j)[0]),
(invertYaxis? (double)(-contour.at(j)[1]+contour.at(0)[1]):(double)(contour.at(j)[1])));
contourPt.push_back(pt);
if(drawPoints){
aBoard.fillCircle(pt.x, pt.y, pointSize);
}
}
}
if(args.check("-sfp")){
string fileName = args.getOption("-sfp")->getValue(0);
vector< PointVector<2,double> > contour =
PointListReader< PointVector<2,double> >::getPointsFromFile(fileName);
for(unsigned int j=0; j<contour.size(); j++){
LibBoard::Point pt((double)(contour.at(j)[0]),
(invertYaxis? (double)(-contour.at(j)[1]+contour.at(0)[1]):(double)(contour.at(j)[1])));
contourPt.push_back(pt);
if(drawPoints){
aBoard.fillCircle(pt.x, pt.y, pointSize);
}
}
}
aBoard.setPenColor(Color::Red);
aBoard.setLineStyle (LibBoard::Shape::SolidStyle );
aBoard.setLineWidth (lineWidth);
if(!filled){
aBoard.drawPolyline(contourPt);
}else{
aBoard.fillPolyline(contourPt);
}
}
if (args.check("-outputSVG")){
string outputFileName= args.getOption("-outputSVG")->getValue(0);
aBoard.saveSVG(outputFileName.c_str());
} else
if (args.check("-outputFIG")){
string outputFileName= args.getOption("-outputFIG")->getValue(0);
aBoard.saveFIG(outputFileName.c_str());
} else
if (args.check("-outputEPS")){
string outputFileName= args.getOption("-outputEPS")->getValue(0);
aBoard.saveEPS(outputFileName.c_str());
}
#ifdef WITH_CAIRO
else
if (args.check("-outputEPS")){
string outputFileName= args.getOption("-outputSVG")->getValue(0);
aBoard.saveCairo(outputFileName.c_str(),Board2D::CairoEPS );
} else
if (args.check("-outputPDF")){
string outputFileName= args.getOption("-outputPDF")->getValue(0);
aBoard.saveCairo(outputFileName.c_str(),Board2D::CairoPDF );
} else
if (args.check("-outputPNG")){
string outputFileName= args.getOption("-outputPNG")getValue(0);
aBoard.saveCairo(outputFileName.c_str(),Board2D::CairoPNG );
}
#endif
else { //default output
string outputFileName= "output.eps";
aBoard.saveEPS(outputFileName.c_str());
}
}