ImageFileSettings::ImageFileSettings(const Glib::RefPtr<ImageFile>& imagefile, const Glib::ustring& name, const Glib::ustring& label, const Glib::ustring& tooltip)
{
  set_label_widget(_label);

  image_file  = imagefile;

  set_expanded(true);

  _n_entries  = 0;

  _label.show();
  _hbox.show();
  table.show();

  _label.set_label(label);
  set_tooltip_text(tooltip);

  add(table);

  Gtk::FileFilter img_filter;
  img_filter.set_name(_("Image Files"));
  img_filter.add_pixbuf_formats();

  SettingsWidget::append_filename_widget(table, _n_entries, name, label, tooltip, img_filter,
                                         sigc::mem_fun(*image_file.operator->(), &ImageFile::get_filename),
                                         sigc::mem_fun(*image_file.operator->(), &ImageFile::set_filename),
                                         image_file->signal_imagefile_changed());
  SettingsWidget::append_boolean_widget(table, _n_entries, name+"-needs-to-be-warped", "Warp?", "Decides, whether the Image needs to be warped before beeing used",
                                       sigc::mem_fun(*image_file.operator->(), &ImageFile::get_needs_to_be_warped),
                                       sigc::mem_fun(*image_file.operator->(), &ImageFile::set_needs_to_be_warped),
                                       image_file->signal_needs_to_be_warped_changed());

  if(imagefile->correction_curve_type==ImageFile::COLOR_CURVE)
    SettingsWidget::append_colorcurve_widget(table, _n_entries, name+"-color-curve", _("ColorCurve"), _("Allows you to modify the Rexture's Contrast, Brightness, Color ..."), imagefile->get_color_curve());
  else if(imagefile->correction_curve_type==ImageFile::CONTRAST_CURVE)
    SettingsWidget::append_curve_widget(table, _n_entries, name+"-contrast-curve", _("ConstrastCurve"), _("Allows you to modify the Rexture's Contrast, Brightness, ..."), imagefile->get_contrast_curve());
}
Exemple #2
0
ToolboxItemWidget::ToolboxItemWidget(const Glib::ustring & title)
    : Gtk::Expander(Glib::ustring("<b>") + title + "</b>")
{
    set_expanded(true);
    set_use_markup(true);
}
Exemple #3
0
bool Dstar::search(Graph* graph,
                   const Position& start,
                   const Position& goal)
{

  auto s = graph->get_state(start);
  s->set_rhs(MAX_WEIGHT);
  s->set_g(MAX_WEIGHT);

  auto g = graph->get_state(goal);
  auto g_elem = std::find(open_.begin(), open_.end(), g);
  if(g_elem == open_.end())
  {
    g->set_rhs(0);
    g->set_g(MAX_WEIGHT);
    open_.push_back(g);
  }
  g->set_h(graph->get_h(start, g->get_position()));


  auto current = g;

  auto search_limit = graph->get_states().size() * 2;

  std::size_t cnt = 0;
  while((current->get_key() < s->get_key()) || (s->rhs() != s->g()))
  {
    if(cnt > search_limit)
    {
      emit report_exp_dst(cnt);
      return false;
    }

    ++cnt;
    current->set_expanded();

    if(current->g() > current->rhs())
    {
      current->set_g(current->rhs());
      for(auto& pred : graph->get_succ(current)) // succ = pred
        update_state(pred, start, goal, graph);
    }
    else
    {
      current->set_g(MAX_WEIGHT);
      update_state(current, start, goal, graph);
      for(auto& pred : graph->get_succ(current)) // succ = pred
        update_state(pred, start, goal, graph);
    }

    auto it_elem = std::find(open_.begin(), open_.end(), current);
    if(it_elem != open_.end())
      open_.erase(it_elem);

    current = *(std::min_element(open_.begin(),
                                 open_.end(),
                                 [](State * l, State * r)
    { return l->get_key() < r->get_key(); }));

  }

  emit report_exp_dst(cnt);

  return true;
}