本文整理汇总了C++中Geostat_grid::get_group_names方法的典型用法代码示例。如果您正苦于以下问题:C++ Geostat_grid::get_group_names方法的具体用法?C++ Geostat_grid::get_group_names怎么用?C++ Geostat_grid::get_group_names使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geostat_grid
的用法示例。
在下文中一共展示了Geostat_grid::get_group_names方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: begin_add_item
void Project_ItemModel::begin_add_item(std::string type_hierarchy,std::string type_name){
QStringList types = QString(type_hierarchy.c_str()).split("/");
QStringList names = QString(type_name.c_str()).split("/");
if(types.isEmpty() || names.isEmpty() || types.size() != names.size()) return;
QModelIndex insert_parent_index;
int position;
// can either add a grid, a group, a property (in the all_group and/or in a specific group) or a region
QModelIndex root_index = this->root_index();
if(types.size() == 1) { // Adding a grid, always at the end
insert_parent_index = root_index;
position = rootItem_->childCount();
}
else {
QString grid_name = names.at(0);
Geostat_grid* grid = dynamic_cast<Geostat_grid*>(
Root::instance()->interface(
gridModels_manager + "/" + grid_name.toStdString()
).raw_ptr()
);
if(grid == 0) return;
GsTL_root_item *root_item = dynamic_cast<GsTL_root_item*>(rootItem_);
GsTL_grid_item * grid_item = new GsTL_grid_item(root_item->project(), grid, grid_name, rootItem_ );
QModelIndex grid_index = root_index.child(grid_item->row(),0);
if(types.size() == 2) { // adding a group or a property
if(types.at(1) == "group") {
insert_parent_index = grid_index;
std::string new_group_name = names.at(1).toStdString();
std::list<std::string> group_names = grid->get_group_names();
std::list<std::string>::iterator it = group_names.begin();
for(int i=0 ; it != group_names.end() ; ++it) {
if( *it > new_group_name ) {
position = i;
break;
}
}
}
else if(types.at(1) == "property") {
insert_parent_index = grid_index.child(0,0);
//Need to add it to the all property group and the specific group
std::string new_prop_name = names.at(1).toStdString();
std::list<std::string> props = grid->property_list();
std::list<std::string>::const_iterator it_prop = props.begin();
for(int i=0;it_prop != props.end(); ++it_prop, ++i) {
if(*it_prop > new_prop_name) {
position = i;
break;
}
}
}
}
}
this->beginInsertRows(insert_parent_index,position, position);
}