当前位置: 首页>>代码示例>>C++>>正文


C++ Board2D::fillCircle方法代码示例

本文整理汇总了C++中Board2D::fillCircle方法的典型用法代码示例。如果您正苦于以下问题:C++ Board2D::fillCircle方法的具体用法?C++ Board2D::fillCircle怎么用?C++ Board2D::fillCircle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Board2D的用法示例。


在下文中一共展示了Board2D::fillCircle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
}
开发者ID:Jeremy-Gaillard,项目名称:DGtal,代码行数:49,代码来源:testSimpleBoard.cpp

示例2: 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);
            }
//.........这里部分代码省略.........
开发者ID:vanthonguyen,项目名称:DGtalTools,代码行数:101,代码来源:displayContours.cpp

示例3: main

int main( int argc, char** argv )
{
  
  // Contour import
  args.addOption("-fc", "-fc <freemanChain.fc> : FreemanChain file name", "freeman.fc" );
  args.addOption("-sdp", "-sdp <contour.sdp> : Import a contour as a Sequence of Discrete Points (SDP format)", "contour.sdp" );
  args.addOption("-sfp", "-sdp <contour.sdp> : Import a contour as a Sequence of Floating Points (SFP format)", "contour.sdp" );
  
  // Display options
  args.addOption("-drawContourPoint", "-drawContourPoint <size> (double): display contour points as disk of radius <size> (default 1.0) ", "1.0" );
  args.addBooleanOption("-fillContour", "-fillContour fill the contours with default color");
  args.addOption("-lineWidth", "-lineWidth <width> : define the linewidth <width> of the contour (default 1.0) (SDP format)", "1.0");
  
  args.addOption("-outputEPS", "-outputEPS <filename> specify eps format (default format output.eps)", "output.eps");
  args.addOption("-outputSVG", "-outputSVG <filename> specify svg format. (default name output.svg)", "output.svg");
  args.addOption("-outputFIG", "-outputFIG <filename> specify svg format. (default name output.fig)", "output.fig");
  
#ifdef WITH_CAIRO
  args.addOption("-outputPDF", "-outputPDF <filename> specify svg format. (default name output.pdf)", "output.pdf");
  args.addOption("-outputPNG", "-outputPNG <filename> specify png format. (default name output.png)", "output.png");
  args.addBooleanOption("-invertYaxis", "-invertYaxis: invert the Y axis for display contours (used only with --SDP) ");  
#endif
  
#ifdef WITH_MAGICK
  args.addOption("-backgroundImage", "-backgroundImage <filename> <alpha> : display image as background with transparency alpha (defaut 1) (transparency works only if cairo is available)", "imageBG.png", "1.0"  );
#endif

  args.addOption("-backgroundImageXFIG", "-backgroundImageXFIG <filename> <width> <height> : display image as background in XFIG format", "imageBG.png", "256","256"  );
  args.addOption("-scale", "-scale <value> 1: normal; >1 : larger ; <1 lower resolutions  ) (default 1.0) ", "1.0");
  
  bool parseOK=  args.readArguments( argc, argv );
  
  
  if(!parseOK || args.check("-h") || (! args.check("-fc") && ! args.check("-sdp") && ! args.check("-sfp"))){
    trace.info()<<args.usage("displayContours", "Display discrete contours. \n Basic usage: \n \t displayContours [options] -fc  <fileName>  \n", "");
    
      return 1;
  } 


  
  double lineWidth =  args.getOption("-lineWidth")->getFloatValue(0);
  double scale = args.getOption("-scale")->getIntValue(0);
  bool filled = args.check("-fillContour");
  Board2D aBoard;
  aBoard.setUnit (0.05*scale, LibBoard::Board::UCentimeter);
  
  
  
#ifdef WITH_MAGICK
  double alpha=args.getOption("-alphaBG")->getFloatValue(0);
  if(args.check("-backgroundImage")){
    string imageName = args.check("-backgroundImage")->getValue(0);
    typedef ImageSelector<Z2i::Domain, unsigned char>::Type Image;
    DGtal::MagickReader<Image> reader;
    Image img = reader.importImage( imageName );
    Z2i::Point ptInf = img.domain().lowerBound(); 
    Z2i::Point ptSup = img.domain().upperBound(); 
    unsigned int width = abs(ptSup.at(0)-ptInf.at(0)+1);
    unsigned int height = abs(ptSup.at(1)-ptInf.at(1)+1);
    aBoard.drawImage(imageName, 0-0.5,height-0.5, width, height, -1, alpha );
  }
#endif
 
  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);
//.........这里部分代码省略.........
开发者ID:kerautret,项目名称:DGtal-forIPOL,代码行数:101,代码来源:displayContours.cpp


注:本文中的Board2D::fillCircle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。