FloorDialog::FloorDialog(const QString &name, int z,
                         QList<Room*> rooms, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::FloorDialog),
    selectedTile(NULL)
{
    ui->setupUi(this);

    ui->name->setText(name);
    setWindowTitle(name);

    ui->z->setText(QString::number(z));
    ui->z->setValidator(new QIntValidator());

    getMinAndMax(rooms);

    createBlankTiles();

    foreach (Room *r, rooms) {
        addRoom(r);
    }
示例#2
0
void UniformGrid::populateCells(const std::list<Model>& models) {
  // Populate the cells with the models
  std::cerr << "Populating the cells: " << cells.size() << std::endl;
  for (const auto& model : models) {
    auto bbox = model.getBoundingBox();
    Point3D min = bbox.front();
    Point3D max = bbox.front();
    getMinAndMax(bbox, &min, &max);
    auto minCoord = coordAt(min);
    auto maxCoord = coordAt(max);
    for (size_t x = minCoord[0]; x <= maxCoord[0]; ++x) {
      for (size_t y = minCoord[1]; y <= maxCoord[1]; ++y) {
        for (size_t z = minCoord[2]; z <= maxCoord[2]; ++z) {
          UniformGrid::CellCoord coord(x, y, z);
          if (intersectsCell(model, coord)) {
            cells[indexFor(coord)].models.push_back(&model);
          }
        }
      }
    }
  }
  std::cerr << "Done populating cells" << std::endl;
}