void ChangeParameters::undo() {
	NodeItem *item = scene->findItem(id);
	Q_ASSERT(item != 0);
	item->getNode()->deinit();
	item->restoreParameters(before);
	SimulationParameters sp = scene->simulation->getSimulationParameters();
	item->getNode()->init(sp.start + seconds(sp.dt), sp.stop, sp.dt);
	item->updatePorts();
	//scene->update();
	scene->updateConnections(item);
}
void ChangeParameters::redo() {
	if (first_redo) {
		first_redo = false;
		return;
	}
	NodeItem *item = scene->findItem(id);
	Q_ASSERT(item != 0);
	item->getNode()->deinit();
	item->restoreParameters(after);
	SimulationParameters sp = scene->simulation->getSimulationParameters();
	item->getNode()->init(sp.start + seconds(sp.dt), sp.stop, sp.dt);
	item->updatePorts();
	//scene->update();
	scene->updateConnections(item);
}
void DeleteNode::redo() {
	NodeItem *item = scene->findItem(QString::fromStdString(node_id));
	Q_ASSERT(item != 0);
	scene->disconnect(item);
	scene->node_items.remove(item->getId());
	Node *n = item->getNode();
	delete item;
	scene->model->removeNode(n); //deletes n
}