Exemplo n.º 1
0
void CityLordView::moveVisitor(int id, Location location){
    //std::cout<<"=> view moving"<<std::endl;
    if(visitorItemMap.find(id) == visitorItemMap.end()){
        createVisitor(id, location);
    }else{
        visitorItemMap[id]->move(location);
    }
}
void RenderArea::paintEvent(QPaintEvent *) {
    // необходимо обязательно инитить _qpainter, перед созданием посетителя!
    // TODO: возможно следует переделать на shared_ptr или типа того
    _qpainter = new QPainter(this);

    CellsVisitor *cells_painter = createVisitor();

    _qpainter->setRenderHint(QPainter::Antialiasing, true);
    cellular()->storeSlice(currZ(), cells_painter);
    _qpainter->setRenderHint(QPainter::Antialiasing, false);

    delete cells_painter;
    delete _qpainter;
}
Exemplo n.º 3
0
	void PlantBlockActor::createPlantByPoint(const std::vector<osg::Vec3>& pointList, const std::vector<std::string>& nameList, PlantType type)
	{
		CreatePlantVisitor createVisitor(pointList, nameList, type);
		accept(createVisitor);
	}
Exemplo n.º 4
0
int main(int argc, char *argv[]) {
  std::string command,
              ucMode,
              volMode,
              inodeMapFile,
              diskMapFile;
  uint64_t    maxUcBlockSize;

  po::options_description desc("Allowed Options");
  po::positional_options_description posOpts;
  posOpts.add("command", 1);
  posOpts.add("ev-files", -1);
  desc.add_options()
    ("help", "produce help message")
    ("command", po::value< std::string >(&command), "command to perform [info|dumpimg|dumpfs|dumpfiles]")
    ("overview-file", po::value< std::string >(), "output disk overview information")
    ("unallocated", po::value< std::string >(&ucMode)->default_value("none"), "how to handle unallocated [none|fragment|block]")
    ("max-unallocated-block-size", po::value< uint64_t >(&maxUcBlockSize)->default_value(std::numeric_limits<uint64_t>::max()), "Maximum size of an unallocated entry, in blocks")
    ("ev-files", po::value< std::vector< std::string > >(), "evidence files")
    ("inode-map-file", po::value<std::string>(&inodeMapFile)->default_value(""), "optional file to output containing directory entry to inode map")
    ("disk-map-file", po::value<std::string>(&diskMapFile)->default_value(""), "optional file to output containing disk data to inode map");

  po::variables_map vm;
  try {
    po::store(po::command_line_parser(argc, argv).options(desc).positional(posOpts).run(), vm);
    po::notify(vm);

    std::shared_ptr<LbtTskAuto> walker;

    std::vector< std::string > imgSegs;
    if (vm.count("ev-files")) {
      imgSegs = vm["ev-files"].as< std::vector< std::string > >();
    }
    if (vm.count("help")) {
      printHelp(desc);
    }
    else if (vm.count("command") && vm.count("ev-files") && (walker = createVisitor(command, std::cout, imgSegs))) {
      std_binary_io();

      boost::scoped_array< const char* >  segments(new const char*[imgSegs.size()]);
      for (unsigned int i = 0; i < imgSegs.size(); ++i) {
        segments[i] = imgSegs[i].c_str();
      }
      if (0 == walker->openImageUtf8(imgSegs.size(), segments.get(), TSK_IMG_TYPE_DETECT, 0)) {
        if (vm.count("overview-file")) {
          std::ofstream file(vm["overview-file"].as<std::string>().c_str(), std::ios::out);
          file << *(walker->getImage(imgSegs));
          file.close();
        }

        walker->setVolFilterFlags((TSK_VS_PART_FLAG_ENUM)(TSK_VS_PART_FLAG_ALLOC | TSK_VS_PART_FLAG_UNALLOC | TSK_VS_PART_FLAG_META));
        walker->setFileFilterFlags((TSK_FS_DIR_WALK_FLAG_ENUM)(TSK_FS_DIR_WALK_FLAG_RECURSE | TSK_FS_DIR_WALK_FLAG_UNALLOC | TSK_FS_DIR_WALK_FLAG_ALLOC));
        if (ucMode == "fragment") {
          walker->setUnallocatedMode(LbtTskAuto::FRAGMENT);
          walker->setMaxUnallocatedBlockSize(maxUcBlockSize);
        }
        else if (ucMode == "block") {
          walker->setUnallocatedMode(LbtTskAuto::BLOCK);
        }
        else {
          walker->setUnallocatedMode(LbtTskAuto::NONE);
        }
        if (0 == walker->start()) {
          walker->startUnallocated();
          walker->finishWalk();
          std::vector<std::future<void>> futs;
          if (vm.count("disk-map-file") && command == "dumpfs") {
            futs.emplace_back(std::async(outputDiskMap, diskMapFile, walker));
          }
          if (vm.count("inode-map-file") && command == "dumpfs") {
            futs.emplace_back(std::async(outputInodeMap, inodeMapFile, walker));
          }
          for (auto& fut: futs) {
            fut.get();
          }
          return 0;
        }
        else {
          std::cout.flush();
          std::cerr << "Had an error parsing filesystem" << std::endl;
          for (auto& err: walker->getErrorList()) {
            std::cerr << err.msg1 << " " << err.msg2 << std::endl;
          }
        }
      }
      else {
        std::cerr << "Had an error opening the evidence file" << std::endl;
        for (unsigned int i = 0; i < imgSegs.size(); ++i) {
          std::cerr << " ** seg[" << i << "] = " << imgSegs[i] << std::endl;
        }
        return 1;
      }
    }
    else {
      std::cerr << "Error: did not understand arguments\n\n";
      printHelp(desc);
      return 1;
    }
  }
  catch (std::exception& err) {
    std::cerr << "Error: " << err.what() << "\n\n";
    printHelp(desc);
    return 1;
  }
  return 0;
}