本文整理汇总了C++中Board2D::setLineWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ Board2D::setLineWidth方法的具体用法?C++ Board2D::setLineWidth怎么用?C++ Board2D::setLineWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Board2D
的用法示例。
在下文中一共展示了Board2D::setLineWidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 );
}
示例2: selfDraw
virtual void selfDraw(Board2D & aboard) const
{
aboard.setFillColor( myColor );
aboard.setPenColorRGBi( 0, 0, 0 );
aboard.setLineStyle( LibBoard::Shape::SolidStyle );
aboard.setLineWidth( 1.0 );
}
示例3: main
int main( int argc, char** argv )
{
// parse command line ----------------------------------------------
po::options_description general_opt("Allowed options are: ");
general_opt.add_options()
("help,h", "display this message")
("input,i", po::value<std::string>(), "input FreemanChain file name")
("SDP", po::value<std::string>(), "Import a contour as a Sequence of Discrete Points (SDP format)")
("SFP", po::value<std::string>(), "Import a contour as a Sequence of Floating Points (SFP format)")
("drawContourPoint", po::value<double>(), "<size> display contour points as disk of radius <size>")
("fillContour", "fill the contours with default color (gray)")
("lineWidth", po::value<double>()->default_value(1.0), "Define the linewidth of the contour (SDP format)")
("drawPointOfIndex", po::value<int>(), "<index> Draw the contour point of index <index> (default 0) ")
("pointSize", po::value<double>()->default_value(2.0), "<size> Set the display point size of the point displayed by drawPointofIndex option (default 2.0) ")
("noXFIGHeader", " to exclude xfig header in the resulting output stream (no effect with option -outputFile).")
("withProcessing", po::value<std::string>(), "Processing (used only when the input is a Freeman chain (--input)):\n\t DSS segmentation {DSS}\n\t Maximal segments {MS}\n\t Faithful Polygon {FP}\n\t Minimum Length Polygon {MLP}")
("outputFile,o", po::value<std::string>(), " <filename> save output file automatically according the file format extension.")
("outputStreamEPS", " specify eps for output stream format.")
("outputStreamSVG", " specify svg for output stream format.")
("outputStreamFIG", " specify fig for output stream format.")
("invertYaxis", " invertYaxis invert the Y axis for display contours (used only with --SDP)")
("backgroundImage", po::value<std::string>(), "backgroundImage <filename> : display image as background ")
("alphaBG", po::value<double>(), "alphaBG <value> 0-1.0 to display the background image in transparency (default 1.0), (transparency works only if cairo is available)")
("scale", po::value<double>(), "scale <value> 1: normal; >1 : larger ; <1 lower resolutions )");
bool parseOK=true;
po::variables_map vm;
try {
po::store(po::parse_command_line(argc, argv, general_opt), vm);
} catch(const std::exception& ex) {
parseOK=false;
trace.info()<< "Error checking program options: "<< ex.what()<< std::endl;
}
po::notify(vm);
if(!parseOK||vm.count("help")||argc<=1 || (!(vm.count("input")) && !(vm.count("SDP")) && !(vm.count("SFP"))&&
!(vm.count("backgroundImage")) ) )
{
trace.info()<< "Display discrete contours. " <<std::endl << "Basic usage: "<<std::endl
<< "\t displayContours [options] --input <fileName> "<<std::endl
<< general_opt << "\n";
return 0;
}
double lineWidth= vm["lineWidth"].as<double>();
bool filled = vm.count("fillContour");
double scale=1.0;
if(vm.count("scale")) {
scale = vm["scale"].as<double>();
}
Board2D aBoard;
aBoard.setUnit (0.05*scale, LibBoard::Board::UCentimeter);
double alpha=1.0;
if(vm.count("alphaBG")) {
alpha = vm["alphaBG"].as<double>();
}
if(vm.count("backgroundImage")) {
std::string imageName = vm["backgroundImage"].as<std::string>();
typedef ImageSelector<Z2i::Domain, unsigned char>::Type Image;
Image img = DGtal::GenericReader<Image>::import( imageName );
Z2i::Point ptInf = img.domain().lowerBound();
Z2i::Point ptSup = img.domain().upperBound();
unsigned int width = abs(ptSup[0]-ptInf[0]+1);
unsigned int height = abs(ptSup[1]-ptInf[1]+1);
aBoard.drawImage(imageName, 0-0.5,height-0.5, width, height, -1, alpha );
}
if(vm.count("input")) {
std::string fileName = vm["input"].as<std::string>();
std::vector< FreemanChain<int> > vectFc = PointListReader< Z2i::Point>:: getFreemanChainsFromFile<int> (fileName);
aBoard << CustomStyle( vectFc.at(0).className(),
new CustomColors( Color::Red , filled? Color::Gray: Color::None ) );
aBoard.setLineWidth (lineWidth);
for(unsigned int i=0; i<vectFc.size(); i++) {
aBoard << vectFc.at(i) ;
if(vm.count("drawPointOfIndex")) {
int index = vm["drawPointOfIndex"].as<int>();
double size = vm["pointSize"].as<double>();
aBoard.setPenColor(Color::Blue);
aBoard.fillCircle((double)(vectFc.at(i).getPoint(index)[0]), (double)(vectFc.at(i).getPoint(index)[1]), size);
}
//.........这里部分代码省略.........
示例4: 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());
}
}