Exemple #1
0
int main()
{
    std::vector<std::string> vec;
    vec.push_back("This sentence");
    vec.push_back("So will this");
    vec.push_back("And this");
    vec.push_back("This too");
    Picture p = vec;
    Picture q = frame(p);
    reframe(q, '*', '*', '*');
    Picture r = hcat(p, q);
    Picture s = vcat(q, r);
    std::cout << r << std::endl;
    std::cout << "\n\n\n\n\n\n\n\n\n" << std::endl;
    std::cout << frame(hcat(s, vcat(r, q))) << std::endl;
}
int main(){

    std::vector<std::string> pic1;
    pic1.push_back("Some tests with");
    pic1.push_back("this framing suite");
    pic1.push_back("we are building as");
    pic1.push_back("an exercise");
    pic1 = frame(pic1);

    std::vector<std::string> pic2;
    pic2.push_back("haha man I");
    pic2.push_back("enjoy coding");
    pic2.push_back("quite a lot!");
    pic2 = frame(pic2);

    std::cout << std::endl;
    std::cout << "Picture 1:" << std::endl;
    std::cout << std::endl;
    printPic(pic1);
    std::cout << std::endl;
    std::cout << "Picture 2:" << std::endl;
    std::cout << std::endl;
    printPic(pic2);
    std::cout << std::endl;
    std::cout << "Vertical concatenation:" << std::endl;
    std::cout << std::endl;
    printPic(vcat(pic1,pic2));
    std::cout << std::endl;
    std::cout << "Horizontal concatenation:" << std::endl;
    std::cout << std::endl;
    printPic(hcat(pic1,pic2));
    std::cout << std::endl;

    return 0;
}
bool RobotBrainServiceService::start(int argc, char* argv[])
{
  char adapterStr[255];

  //Create the adapter
  int port = RobotBrainObjects::RobotBrainPort;
  bool connected = false;

  while(!connected)
    {
      try
        {
          LINFO("Trying Port:%d", port);
          sprintf(adapterStr, "default -p %i", port);
          itsAdapter = communicator()->createObjectAdapterWithEndpoints("SeaBee3SimulatorAdapter",
                                                                        adapterStr);
          connected = true;
        }
      catch(Ice::SocketException)
        {
          port++;
        }
    }

  //Create the manager and its objects
  itsMgr = new ModelManager("SeaBee3SimulatorServiceManager");

  nub::ref<OutputFrameSeries> ofs(new OutputFrameSeries(*itsMgr));
  itsMgr->addSubComponent(ofs);


  LINFO("Starting SeaBee3 Simulator");
  nub::ref<SeaBee3Simulator> subSim(new SeaBee3Simulator(*itsMgr, "SeaBee3Simulator", "SeaBee3Simulator"));
  itsMgr->addSubComponent(subSim);
  subSim->init(communicator(), itsAdapter);

  itsMgr->parseCommandLine((const int)argc, (const char**)argv, "", 0, 0);

  itsAdapter->activate();

  itsMgr->start();

  while(1){
    Layout<PixRGB<byte> > outDisp;

    subSim->simLoop();
    Image<PixRGB<byte> > forwardCam = flipVertic(subSim->getFrame(1));
    Image<PixRGB<byte> > downwardCam = flipVertic(subSim->getFrame(2));

    outDisp = vcat(outDisp, hcat(forwardCam, downwardCam));

    ofs->writeRgbLayout(outDisp, "subSim", FrameInfo("subSim", SRC_POS));

    handle_keys(ofs, subSim);
  }


  return true;
}
int main()
{
	std::vector<std::string> test;
	std::string s;

	while(std::getline(std::cin,s))
	{
		test.push_back(s);
	}

	std::vector<std::string> result = vcat(hcat(test,frame(test)),hcat(frame(test),test));

	for(std::vector<std::string>::const_iterator i=result.begin(),e=result.end();i!=e;++i)
	{
		std::cout << *i << std::endl;
	}

	return 0;
}