コード例 #1
0
ファイル: AmrAdvIO.cpp プロジェクト: BoxLib-Codes/BoxLib
void
AmrAdv::WritePlotFile () const
{
    const std::string& plotfilename = PlotFileName(istep[0]);
    const auto& mf = PlotFileMF();
    const auto& varnames = PlotFileVarNames();
    
    BoxLib::WriteMultiLevelPlotfile(plotfilename, finest_level+1, mf, varnames,
				    Geom(), t_new[0], istep, refRatio());
}
コード例 #2
0
ファイル: edges.cpp プロジェクト: cran/magick
// [[Rcpp::export]]
XPtrImage magick_image_houghline( XPtrImage input, std::string geomstr,
                                  std::string col, std::string bg, double lwd){
#if MagickLibVersion >= 0x689
  Magick::Geometry geom(Geom(geomstr.c_str()));
  XPtrImage output = copy(input);
  for(size_t i = 0; i < output->size(); i++){
    output->at(i).strokeColor(Magick::Color(col.c_str()));
    output->at(i).backgroundColor(Magick::Color(bg.c_str()));
    output->at(i).strokeWidth(lwd);
    output->at(i).houghLine(geom.width(), geom.height(), geom.xOff());
  }
  return output;
#else
  throw std::runtime_error("houghline not supported, ImageMagick too old");
#endif
}
コード例 #3
0
ファイル: edges.cpp プロジェクト: cran/magick
// [[Rcpp::export]]
XPtrImage magick_image_canny( XPtrImage input, std::string geomstr){
#if MagickLibVersion >= 0x689
  Magick::Geometry geom(Geom(geomstr.c_str()));
  if(!geom.percent())
    throw std::runtime_error("Canny edge upper/lower must be specified in percentage");
  double radius = geom.width();
  double sigma = geom.height();
  double lower = geom.xOff() / 100.0;
  double upper = geom.yOff() / 100.0;
  XPtrImage output = copy(input);
  for(size_t i = 0; i < output->size(); i++)
    output->at(i).cannyEdge(radius, sigma, lower, upper);
  return output;
#else
  throw std::runtime_error("cany edge not supported, ImageMagick too old");
#endif
}
コード例 #4
0
void SpatiaLiteDB::queryGeometry(
		std::string table,
		std::string geometry_col,
		double left,
		double bottom,
		double right,
		double top,
		std::string label_col) {

	_pointlist.clear();
	_linestringlist.clear();
	_polygonlist.clear();
	bool getLabel = label_col.size() != 0;

	// Search for geometry and name

	// The query will be either
	//
	// SELECT Geometry FROM  table WHERE MbrWithin(Column, BuildMbr(left, bottom, right, top));
	//    or
	// SELECT Geometry,Label FROM  table WHERE MbrWithin(Column, BuildMbr(left, bottom, right, top));
	//
	// where Geometry is the geometry column name and Label is the column containing a name or label.
	std::string label;
	if (getLabel) {
		label = "," + label_col;
	}
	std::stringstream s;
	s <<
		 "SELECT "           <<
		 geometry_col        <<
		 label               <<
		 " FROM "            <<
		 table               <<
		 " WHERE  MbrIntersects(" <<
		 geometry_col        <<
		 ", BuildMbr("         <<
		 left                <<
		 ","                 <<
		 bottom              <<
		 ","                 <<
		 right               <<
		 ","                 <<
		 top                 <<
		 "));";

	// prepare the query
	prepare(s.str());

	// fetch the next result row
	while (step()) {
		// get the geometry
		gaiaGeomCollPtr geom = Geom(0);
		// get the label, if we asked for it
		std::string label;
		if (getLabel) {
			label = Text(1);
		}
		// the following will create lists for points, lines and polygons found in
		// a single geometry. In practice it seems that only one of those types
		// exists for a given geometry, but it's not clear if this is a requirement
		// or just occurs in the sample databases we have been working with.
		PointList points = point_list(geom, label);
		for (PointList::iterator i = points.begin(); i != points.end(); i++) {
			_pointlist.push_back(*i);
		}
		LinestringList lines = linestring_list(geom, label);
		for (LinestringList::iterator i = lines.begin(); i != lines.end(); i++) {
			_linestringlist.push_back(*i);
		}
		PolygonList polys = polygon_list(geom, label);
		for (PolygonList::iterator i = polys.begin(); i != polys.end(); i++) {
			_polygonlist.push_back(*i);
		}
	}

	// finish with this query
	finalize();
}