当前位置: 首页>>代码示例>>C++>>正文


C++ Geostat_grid类代码示例

本文整理汇总了C++中Geostat_grid的典型用法代码示例。如果您正苦于以下问题:C++ Geostat_grid类的具体用法?C++ Geostat_grid怎么用?C++ Geostat_grid使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Geostat_grid类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

bool Remove_group::init( std::string& parameters, GsTL_project* proj,
                     Error_messages_handler* errors ){
  std::vector< std::string > params =
      String_Op::decompose_string( parameters, Actions::separator,
				   Actions::unique );

  if( params.size() != 2 ) {
    errors->report( "Must have 2 parameters, name of the grid and name the group to be removed" );
    return false;
  }

  // Get the grid
  SmartPtr<Named_interface> ni = Root::instance()->interface( gridModels_manager + "/" + params[0] );
  Geostat_grid* grid = dynamic_cast<Geostat_grid*>( ni.raw_ptr() );
  if(!grid)  {
    errors->report( "The grid "+params[0]+" does not exist" );
    return false;
  }

  GsTLGridPropertyGroup* group = grid->get_group(params[1]);
  if(!group)  {
    errors->report( "The group "+params[1]+" does not exist" );
    return false;
  }

  grid->remove_group(params[1]);
  return true;
}
开发者ID:TUDz,项目名称:ar2tech-SGeMS-public,代码行数:28,代码来源:property_group_actions.cpp

示例2: selected_grid

void New_region_from_property_dialog::populate_categories(){
  if( !isCategorical_ ) return;

  QString grid_name = selected_grid();
  QString prop_name = selected_property();
  if(grid_name.isEmpty() || prop_name.isEmpty()) return;
  SmartPtr< Named_interface > ni =
	Root::instance()->interface( gridModels_manager + "/" + grid_name.toStdString() );
  Geostat_grid* grid = dynamic_cast<Geostat_grid*>(ni.raw_ptr());
  Grid_categorical_property *prop = grid->categorical_property(prop_name.toStdString());

  if(!prop) return;

  const CategoricalPropertyDefinition* cat_def = prop->get_category_definition();
  const CategoricalPropertyDefinitionName* cat_def_name =
	  dynamic_cast<const CategoricalPropertyDefinitionName*>(cat_def);

  if( cat_def_name ) {
    cat_selector_->show_categories( cat_def_name->name().c_str() );
  }
  else {
    cat_selector_->show_default_categories( prop->get_number_of_category() );
  }

}
开发者ID:DMachuca,项目名称:ar2tech-SGeMS-public,代码行数:25,代码来源:new_region_from_property_dialog.cpp

示例3: rename_diag

bool Rename_property_item_action::execute(GsTL_object_item* item) {

    Grid_continuous_property* prop = dynamic_cast<Grid_continuous_property*>(item);
    if(prop == 0) return false;

    std::string old_name = prop->name();
    Rename_dialog rename_diag("Property",old_name.c_str(), dynamic_cast<QWidget*>(this->parent()));
    int r = rename_diag.exec();
    if (r==1) {
        Geostat_grid* grid = dynamic_cast<Geostat_grid*>(item->parent()->parent());
        if(grid == 0) return false;
        return grid->reNameProperty(old_name, rename_diag.new_name().toStdString() );
    }
    else
        return false;

}
开发者ID:TUDz,项目名称:ar2tech-SGeMS-public,代码行数:17,代码来源:gstl_item_action.cpp

示例4: grid_name

Grid_continuous_property*
QPplot_control_panel::get_property( const PropertySelector* object_selector ) {
  std::string grid_name( qstring2string(object_selector->selectedGrid()) );
  if( grid_name.empty() ) return 0;

  Geostat_grid* grid = dynamic_cast<Geostat_grid*>(
                Root::instance()->interface(
                                            gridModels_manager + "/" + grid_name
                                            ).raw_ptr()
                );

  appli_assert( grid );

  std::string prop_name( qstring2string(object_selector->selectedProperty()) );
  Grid_continuous_property* prop = grid->property( prop_name );
  appli_assert( prop );
  return prop;
}
开发者ID:TUDz,项目名称:ar2tech-SGeMS-public,代码行数:18,代码来源:qpplot_control_panel.cpp

示例5: grid_name

Grid_region*
Scatterplot_control_panel::get_region( const GridSelector* object_selector ) {
  std::string grid_name(  object_selector->selectedGrid().toStdString() );
  std::string region_name( object_selector->selectedRegion().toStdString() );
  if( grid_name.empty() || region_name.empty() ) return 0;

  Geostat_grid* grid = dynamic_cast<Geostat_grid*>(
                Root::instance()->interface(
                                            gridModels_manager + "/" + grid_name
                                            ).raw_ptr()
                );

  appli_assert( grid );

  Grid_region* region = grid->region( region_name );
  appli_assert( region );
  return region;
}
开发者ID:DMachuca,项目名称:ar2tech-SGeMS-public,代码行数:18,代码来源:scatterplot_control_panel.cpp

示例6: grid_name

GsTLGridProperty*
Histogram_control_panel::get_property( const PropertySelector* object_selector ) {
  if( object_selector->selectedGrid().isEmpty() ||
      object_selector->selectedProperty().isEmpty() ) return 0;
  
  std::string grid_name( object_selector->selectedGrid().latin1() );
  Geostat_grid* grid = dynamic_cast<Geostat_grid*>(
                Root::instance()->interface(
                                            gridModels_manager + "/" + grid_name
                                            ).raw_ptr()
                );

  appli_assert( grid );

  std::string prop_name( object_selector->selectedProperty().latin1() );
  GsTLGridProperty* prop = grid->property( prop_name );
  appli_assert( prop );
  return prop;
}
开发者ID:ahinoamp,项目名称:Research,代码行数:19,代码来源:histogram_control_panel.cpp

示例7: gridChanged

void Save_grid_dialog::gridChanged(const QString & s)
{
	SmartPtr<Named_interface> grid_ni =
    Root::instance()->interface( gridModels_manager + "/" + s.toStdString() );
	Geostat_grid* grid = dynamic_cast<Geostat_grid*>( grid_ni.raw_ptr() );
	appli_assert( grid );

  std::list<std::string> pn = grid->property_list();
	propList_->clear();
	for (std::list<std::string>::iterator it = pn.begin(); it != pn.end(); ++it){
	        QListWidgetItem * nitem = new QListWidgetItem(it->c_str(), propList_);
		propList_->addItem(nitem);
		nitem->setSelected(true);
	}

	if (dynamic_cast<Reduced_grid*>(grid)) {
		masked_as_regular_frame_->setVisible(true);
  }
	else{
		masked_as_regular_frame_->setVisible(false);
  }
}
开发者ID:sayantanx,项目名称:ar2tech-SGeMS-public,代码行数:22,代码来源:save_grid_dialog.cpp

示例8: init

bool Show_histogram::init( std::string& parameters, GsTL_project* proj,
                           Error_messages_handler* errors ) {
  std::vector< std::string > params = 
    String_Op::decompose_string( parameters, Actions::separator,
                      				   Actions::unique );

  if( params.size() < 2 ) {
	  // TL modified
    errors->report( "Usage: ShowHistogram grid prop [#bins " 
                    "logscaling_flag cdf_flag]" );  
    return false;
  }


  SmartPtr<Named_interface> grid_ni =
    Root::instance()->interface( gridModels_manager + "/" + params[0] );
  Geostat_grid* grid = dynamic_cast<Geostat_grid*>( grid_ni.raw_ptr() );
  if( !grid ) {
    std::ostringstream message;
    message << "No grid called \"" << params[0] << "\" was found";
    errors->report( message.str() ); 
    return false;
  }

  GsTLGridProperty* prop = grid->property( params[1] );
  if( !prop ) {
    std::ostringstream message;
    message << "Grid \"" << params[0] << "\" has no property called \"" 
            << params[1] << "\"";
    errors->report( message.str() ); 
    return false;
  }

  //TL modified
  bool cdf_flag = true;
  if (params.size() == 5) {
	  if (params[4] == "0") {
		  appli_message("Turning off cdf");
		  cdf_flag = false;
	  }
  }

  Histogram_gui* histog = new Histogram_gui( proj, 0 );
  if (cdf_flag)
	  histog->changeCurve("pdf+cdf");
  else
	  histog->changeCurve("pdf");
  histog->get_data_from( prop );


  // check if other options were input
  if( params.size() >= 3 ) {
    int bins = String_Op::to_number<int>( params[2] );
    histog->update_bins( bins );

    if( params.size() >= 4 ) {
      bool logscale = String_Op::to_number<bool>( params[3] );
      histog->set_x_axis_logscale( logscale );
    }
  }

  histog->show();
  return true;
}
开发者ID:ahinoamp,项目名称:Research,代码行数:64,代码来源:visu_actions.cpp

示例9: doc


//.........这里部分代码省略.........
                        subNode = subNode.nextSibling();
                    }

                    // Ensure number of time and values are the same
                    if (time.size() != value.size())
                        std::cerr << "ERROR: time and values do not align"
                                  << std::endl;

                    // GENERATE NEW METRIC DATA HERE
                    // Need: Pointer to property
                    //       -QDomElement metaDataXml
                    // which has <algorithm name = "whatever">
                    // and       <Name value = "whatever">

                    // Find pointer to appropiate property
                    // Obtain smart point to current grid


                    SmartPtr<Named_interface> grid_ni =
                            Root::instance()->interface(gridModels_manager +
                                                        "/" +
                                                        gridStr.toStdString());

                    if (grid_ni.raw_ptr() == 0)
                    {
                        std::cerr << "Grid not found" << std::endl;
                        file.close();
                        return;

                    }



                    Geostat_grid* grid =
                            dynamic_cast<Geostat_grid*> (grid_ni.raw_ptr());

                    // Grab GsTLGridProperty from Grid
                    GsTLGridProperty* currentProperty =
                            grid->select_property(propStr.toStdString());

                    // Generate the required metaDataXml
                    QDomDocument doc("metaDataXml");
                    QDomElement metaDataXml = doc.createElement("metaRoot");
                    doc.appendChild(metaDataXml);

                    QDomElement algoXml = doc.createElement("algorithm");
                    algoXml.setAttribute("name",nameStr);
                    metaDataXml.appendChild(algoXml);

                    QDomElement nameXml = doc.createElement("Name");
                    nameXml.setAttribute("value",nameStr);
                    metaDataXml.appendChild(nameXml);

                    SmartPtr<Named_interface> ni =
                            Root::instance()->interface(
                                metricData_manager + "/metricRegistrar");

                    MetricDataManager* mDataRegistrar =
                            dynamic_cast<MetricDataManager*>(ni.raw_ptr());

                    MetricTimeSeriesData *metric = new
                            MetricTimeSeriesData(currentProperty,
                                                 metaDataXml,value,time);

                    mDataRegistrar->registerMetricData(gridStr.toStdString(),
                                                       propStr.toStdString(),
开发者ID:ckjeong,项目名称:SGEMS-UQ,代码行数:67,代码来源:externalresponseinputfilter.cpp

示例10: init

/* Convert_continuous_to_categorical_property grid_name::prop1::[prop2::]
* will copy convert the property from continuous to categorical
*/
bool Convert_continuous_to_categorical_property::
init( std::string& parameters, GsTL_project* proj,
      Error_messages_handler* errors ) {

  std::vector< std::string > params =
    String_Op::decompose_string( parameters, Actions::separator,
                      				   Actions::unique );

  if( params.size() <2 ) {
    errors->report( "some parameters are missing, Needs at least two parameters (grid + property)" );
    return false;
  }

  SmartPtr<Named_interface> grid_ni =
    Root::instance()->interface( gridModels_manager + "/" + params[0] );
  Geostat_grid* grid = dynamic_cast<Geostat_grid*>( grid_ni.raw_ptr() );
  if( !grid ) {
    std::ostringstream message;
    message << "No grid called \"" << params[0] << "\" was found";
    errors->report( message.str() );
    return false;
  }

  for(int i=1; i<params.size(); ++i) {
    Grid_categorical_property* cprop = grid->categorical_property(params[i]);
    if(cprop) continue;
    Grid_continuous_property* prop = grid->property(params[i]);
    if(prop == 0) continue;
    std::set<int> cat_codes;
    std::string prop_name = prop->name()+" - categorical";
    cprop = grid->add_categorical_property(prop_name);
    while(!cprop) {
      prop_name.append("_0");
      cprop = grid->add_categorical_property(prop_name);
    }
    for(int nodeid=0; nodeid < prop->size(); ++nodeid) {
      if( prop->is_informed(nodeid)) {
        int code = static_cast<int>(prop->get_value(nodeid));
        cprop->set_value(code,nodeid);
        cat_codes.insert(code);
      }
    }
    // Check is sequential coding
    bool is_sequential_coding = false;
    std::set<int>::iterator it = cat_codes.begin();
    if( *it == 0  ) {
      std::advance(it, cat_codes.size()-1);
      if( *it == cat_codes.size()-1 ) {
        is_sequential_coding = true;
      }
      
    }

    if( !is_sequential_coding  ) {  // Need to build a categorical definition
      CategoricalPropertyDefinitionName* cat_def = 0;
      std::string catdef_name = grid->name()+"-"+prop->name();
      while(!cat_def) {
        SmartPtr<Named_interface> ni = Root::instance()->new_interface( "categoricaldefinition://"+catdef_name,categoricalDefinition_manager +"/"+catdef_name );
        cat_def = dynamic_cast<CategoricalPropertyDefinitionName*>(ni.raw_ptr());
          if(!cat_def) catdef_name.append("_0");
      }

      std::set<int>::iterator it_cat_codes = cat_codes.begin();
      for(; it_cat_codes != cat_codes.end(); ++it_cat_codes) {
        cat_def->add_category(*it_cat_codes, QString("Code %1").arg(*it_cat_codes).toStdString() );
      }
      cprop->set_category_definition( cat_def );
    }

  }

  proj->update( params[0] );
  return true;
}
开发者ID:DMachuca,项目名称:ar2tech-SGeMS-public,代码行数:77,代码来源:categorical_property_actions.cpp

示例11: QString

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);
}
开发者ID:TUDz,项目名称:ar2tech-SGeMS-public,代码行数:61,代码来源:project_ItemModel.cpp


注:本文中的Geostat_grid类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。