Esempio n. 1
0
void chooseProtoWidget::changeProto(int value) {
    Cell* old_cell = this->proto->cell->clone();
    string datadir = this->proto->datadir;
    string cellStateDir = this->proto->cellStateDir;
    if(old_cell->type == string("gridCell")) {
        cell_type->setEnabled(true);
        cell_type->removeItem(cell_type->count() -1);
    }
    switch(value) {
    case 0:
        this->proto = new CurrentClamp();
        this->proto->cell = old_cell;
    break;
    case 1:
        this->proto = new voltageClamp();
        this->proto->cell = old_cell;
    break;
    case 2:
        this->proto = new gridProtocol();
        cell_type->addItem("gridCell");
        cell_type->setEnabled(false);
        emit cell_type_changed();
    break;
    }

    if(old_cell->type == string("gridCell")) {
        changeCell(defaultCell);
    }
    this->proto->datadir = datadir;
    this->proto->cellStateDir = cellStateDir;
    emit protocolChanged(this->proto);
}
Esempio n. 2
0
    void Scene::changeToExteriorCell (const ESM::Position& position)
    {
        int x = 0;
        int y = 0;

        MWBase::Environment::get().getWorld()->positionToIndex (position.pos[0], position.pos[1], x, y);

        changeCell (x, y, position, true);
    }
Esempio n. 3
0
    void Scene::changeToExteriorCell (const ESM::Position& position)
    {
        int x = 0;
        int y = 0;

        mWorld->positionToIndex (position.pos[0], position.pos[1], x, y);

        changeCell (x, y, position, true);
    }
Esempio n. 4
0
void chooseProtoWidget::Initialize() {
    this->proto = new CurrentClamp();
    this->defaultCell = this->proto->cell->type;
    QStringList cell_options;
    cell_type = new QComboBox();
    QHBoxLayout* cellLayout = new QHBoxLayout();
    QLabel* simvars_label = new QLabel("Cell Type");
    auto cell_opitons_stl = proto->cellOptions();
    for(auto im = cell_opitons_stl.begin(); im != cell_opitons_stl.end(); im++) {
        cell_options << im->c_str();
    }
    cell_type->addItems(cell_options);
    cellLayout->addWidget(simvars_label);
    cellLayout->addWidget(cell_type);
    this->cellChangedSlot();

    clampType = new QButtonGroup();
    QGroupBox* clampTypeBox = new QGroupBox("Simulation Protocol Type");
    auto nextToAdd = new QRadioButton("Current Clamp - Single Cell");
    nextToAdd->setChecked(true);
    nextToAdd->setToolTip("Apply current stimulus");
    clampType->addButton(nextToAdd, 0);
    nextToAdd = new QRadioButton("Voltage Clamp - Single Cell");
    nextToAdd->setToolTip("Clamp cell membrane to specified voltage");
    clampType->addButton(nextToAdd, 1);
    nextToAdd = new QRadioButton("2D Grid Protocol");
    nextToAdd->setToolTip("Multicellular simulation");
    clampType->addButton(nextToAdd, 2);
    QVBoxLayout* clampLayout = new QVBoxLayout();
    {    
    auto list = clampType->buttons();
    for(auto it = list.begin(); it != list.end(); it++) {
        clampLayout->addWidget(*it);
    }
    }
    clampTypeBox->setLayout(clampLayout);

    QVBoxLayout* centralLayout = new QVBoxLayout();
    centralLayout->addLayout(cellLayout);
    centralLayout->addWidget(clampTypeBox);
    this->setLayout(centralLayout);
    connect(clampType, SIGNAL(buttonPressed(int)), this, SLOT(changeProto(int)));
    connect(cell_type, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeCell(QString)));
}