void ribi::pvdb::QtPvdbTestCreateSubConceptMapDialog::OnConceptMapChanged()
{
  const int i = ui->box_index->value();
  const std::vector<boost::shared_ptr<ribi::cmap::ConceptMap> > v = ribi::cmap::ConceptMapFactory::GetAllTests();
  assert(i < boost::numeric_cast<int>(v.size()));
  assert(v[i]);
  const boost::shared_ptr<ribi::cmap::ConceptMap> concept_map = v[i];
  assert(concept_map);

  if(!ui->widget_concept_map->layout())
  {
    QLayout * const my_layout = new QVBoxLayout;
    ui->widget_concept_map->setLayout(my_layout);
  }

  assert(ui->widget_concept_map->layout());
  m_concept_map.reset(new cmap::QtDisplayConceptMap(concept_map));
  ui->widget_concept_map->layout()->addWidget(m_concept_map.get());

  const std::vector<boost::shared_ptr<ribi::cmap::ConceptMap> > subs = concept_map->CreateSubs();
  const int n_subs = boost::numeric_cast<int>(subs.size());
  assert(n_subs != 0);
  ui->box_index_sub->setMaximum(n_subs - 1); //-1: 0-based counting
  ui->box_index_sub->setValue(0);
}
void ribi::pvdb::QtPvdbTestCreateSubConceptMapDialog::OnSubConceptMapChanged()
{
  const int i = ui->box_index->value();
  const std::vector<boost::shared_ptr<ribi::cmap::ConceptMap> > v = ribi::cmap::ConceptMapFactory::GetAllTests();
  assert(i < boost::numeric_cast<int>(v.size()));
  const boost::shared_ptr<ribi::cmap::ConceptMap> concept_map = v[i];
  const std::vector<boost::shared_ptr<ribi::cmap::ConceptMap> > subs = concept_map->CreateSubs();
  const int j = ui->box_index_sub->value();
  assert(j < boost::numeric_cast<int>(subs.size()));
  const boost::shared_ptr<ribi::cmap::ConceptMap> sub = subs[j];

  if(!ui->widget_sub_concept_map->layout())
  {
    QLayout * const my_layout = new QVBoxLayout;
    ui->widget_sub_concept_map->setLayout(my_layout);
  }

  assert(ui->widget_sub_concept_map->layout());
  m_sub_concept_map.reset(new cmap::QtDisplayConceptMap(sub));
  ui->widget_sub_concept_map->layout()->addWidget(m_sub_concept_map.get());
}