void powerLawEllipsoid::load(host_state_t &hstate, const peyton::system::Config &cfg) { // turn off density truncation rminSq = rmaxSq = 0.f; load_geometry(hstate, cfg); // radial functional dependence cfg.get(n, "n", -3.f); // power law index // component ID int userComp = cfg.get("comp"); comp = componentMap.seqIdx(userComp); // Load luminosity function std::string lffile; hstate.lf = load_lf(*this, cfg, lffile); // limits (\rho = 0 for d < rminSq || d > rmaxSq) // NOTE: This is intentionally after LF normalization computation, so // that normalizing to the values of the profile in the regions // excluded by this cut would still be possible. cfg.get(rminSq, "rmin", 0.f); rminSq *= rminSq; cfg.get(rmaxSq, "rmax", 0.f); rmaxSq *= rmaxSq; if(lffile.empty()) { lffile = "-"; } MLOG(verb1) << "Component " << userComp << " : " << "power law ellipsoid {" << n << ", " << ca << ", " << ba << ", " << lffile << "}"; }
void canvashdl::init_opengl() { glEnable(GL_TEXTURE_2D); glViewport(0, 0, width, height); load_texture(); load_geometry(); load_shader(); initialized = true; }
void load_elements(GtkWidget *dash, xmlNode *a_node) { xmlNode *cur_node = NULL; /* Iterate though all nodes... */ for (cur_node = a_node;cur_node;cur_node = cur_node->next) { if (cur_node->type == XML_ELEMENT_NODE) { if (g_strcasecmp((gchar *)cur_node->name,"dash_geometry") == 0) load_geometry(dash,cur_node); if (g_strcasecmp((gchar *)cur_node->name,"gauge") == 0) load_gauge(dash,cur_node); } load_elements(dash,cur_node->children); } }
void GridComponent::load(clan::DomElement &element, clan::GUIComponent *parent) { clan::DomElement e = element.get_first_child().to_element(); while (e.is_element()) { std::string tag = e.get_tag_name(); if (tag == "dialog") { int w = clan::StringHelp::text_to_int(e.get_attribute("width")); int h = clan::StringHelp::text_to_int(e.get_attribute("height")); boundary.width = w; boundary.height = h; } else { ComponentType *component_type = ComponentTypes::find_from_xml(tag); if(component_type) { clan::Rect object_g = load_geometry(e); GridObject *object = new GridObject(this, parent, component_type->id, object_g.get_top_left()); object->set_geometry(object_g); clan::GUIComponent *new_comp = object->get_component(); if (tag == "button") { clan::PushButton *co = dynamic_cast<clan::PushButton*>(new_comp); co->set_text(e.get_attribute("text")); } else if (tag == "checkbox") { clan::CheckBox *co = dynamic_cast<clan::CheckBox*>(new_comp); co->set_text(e.get_attribute("text")); } else if (tag == "radiobutton") { clan::RadioButton *co = dynamic_cast<clan::RadioButton*>(new_comp); co->set_text(e.get_attribute("text")); co->set_group_name(e.get_attribute("group")); } else if (tag == "label") { clan::Label *co = dynamic_cast<clan::Label*>(new_comp); co->set_text(e.get_attribute("text")); } else if (tag == "statusbar") { clan::StatusBar *co = dynamic_cast<clan::StatusBar*>(new_comp); } else if (tag == "lineedit") { clan::LineEdit *co = dynamic_cast<clan::LineEdit*>(new_comp); co->set_text(e.get_attribute("text")); } else if (tag == "textedit") { clan::TextEdit *co = dynamic_cast<clan::TextEdit*>(new_comp); co->set_text(e.get_attribute("text")); } else if (tag == "imageview") { clan::ImageView *co = dynamic_cast<clan::ImageView*>(new_comp); } else if (tag == "slider") { clan::Slider *co = dynamic_cast<clan::Slider*>(new_comp); co->set_min(clan::StringHelp::text_to_int(e.get_attribute("min"))); co->set_max(clan::StringHelp::text_to_int(e.get_attribute("max"))); co->set_tick_count(clan::StringHelp::text_to_int(e.get_attribute("ticks"))); co->set_page_step(clan::StringHelp::text_to_int(e.get_attribute("page_step"))); } else if (tag == "listview") { clan::ListView *co = dynamic_cast<clan::ListView*>(new_comp); clan::ListViewHeader *header = co->get_header(); std::vector<clan::DomNode> columns_nodes = e.select_nodes("listview_header/listview_column"); for(size_t i = 0; i < columns_nodes.size(); ++i) { clan::DomElement column_element = columns_nodes[i].to_element(); std::string id = column_element.get_attribute("col_id"); std::string caption = column_element.get_attribute("caption"); int width = column_element.get_attribute_int("width"); clan::ListViewColumnHeader column = header->create_column(id, caption); column.set_width(width); header->append(column); } } else if (tag == "tab") { clan::Tab *co = dynamic_cast<clan::Tab*>(new_comp); clan::DomElement tab_child = e.get_first_child().to_element(); while (tab_child.is_element()) { if (tab_child.get_tag_name() == "tabpage") { std::string label = tab_child.get_attribute("label", "Error: NO LABEL!"); int id = clan::StringHelp::text_to_int(tab_child.get_attribute("id", "0")); clan::TabPage *tab_page = co->add_page(label, id); load(tab_child, tab_page); } tab_child = tab_child.get_next_sibling().to_element(); } } else if (tag == "frame") { clan::Frame *co = dynamic_cast<clan::Frame*>(new_comp); co->set_header_text(e.get_attribute("text")); clan::DomElement frame_child = e.get_first_child().to_element(); load(e, co); } else if (tag == "combobox") { clan::ComboBox *co = dynamic_cast<clan::ComboBox*>(new_comp); } else if (tag == "spin") { clan::Spin *co = dynamic_cast<clan::Spin*>(new_comp); } else if (tag == "toolbar") { clan::ToolBar *co = dynamic_cast<clan::ToolBar*>(new_comp); } else { CustomComponent *co = dynamic_cast<CustomComponent*>(new_comp); co->set_tag_name(tag); } int dist_tl_x = clan::StringHelp::text_to_int(e.get_attribute("dist_tl_x")); int dist_tl_y = clan::StringHelp::text_to_int(e.get_attribute("dist_tl_y")); int dist_rb_x = clan::StringHelp::text_to_int(e.get_attribute("dist_br_x")); int dist_rb_y = clan::StringHelp::text_to_int(e.get_attribute("dist_br_y")); std::string pos_equation_x = e.get_attribute("eq-x", ""); std::string pos_equation_y = e.get_attribute("eq-y", ""); std::string pos_equation_x2 = e.get_attribute("eq-x2", ""); std::string pos_equation_y2 = e.get_attribute("eq-y2", ""); object->set_position_equations(pos_equation_x, pos_equation_y); object->set_position_equations2(pos_equation_x2, pos_equation_y2); clan::ComponentAnchorPoint ap_tl = (clan::ComponentAnchorPoint)clan::StringHelp::text_to_int(e.get_attribute("anchor_tl")); clan::ComponentAnchorPoint ap_br = (clan::ComponentAnchorPoint)clan::StringHelp::text_to_int(e.get_attribute("anchor_br")); object->set_anchor_tl(ap_tl); object->set_anchor_br(ap_br); objects.push_back(object); new_comp->set_enabled(e.get_attribute_bool("enabled", true)); new_comp->set_id(e.get_attribute("id")); new_comp->set_class(e.get_attribute("class"), true); } } e = e.get_next_sibling().to_element(); } }