本文整理汇总了C++中box2d::minx方法的典型用法代码示例。如果您正苦于以下问题:C++ box2d::minx方法的具体用法?C++ box2d::minx怎么用?C++ box2d::minx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类box2d
的用法示例。
在下文中一共展示了box2d::minx方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: envelope_points
void envelope_points(std::vector< coord<double,2> > & coords, box2d<double>& env, int points)
{
double width = env.width();
double height = env.height();
int steps;
if (points <= 4) {
steps = 0;
} else {
steps = static_cast<int>(std::ceil((points - 4) / 4.0));
}
steps += 1;
double xstep = width / steps;
double ystep = height / steps;
for (int i=0; i<=steps; i++) {
coords.push_back(coord<double,2>(env.minx() + i * xstep, env.miny()));
coords.push_back(coord<double,2>(env.minx() + i * xstep, env.maxy()));
}
for (int i=1; i<steps; i++) {
coords.push_back(coord<double,2>(env.minx(), env.miny() + i * ystep));
coords.push_back(coord<double,2>(env.maxx(), env.miny() + i * ystep));
}
}
示例2: has_placement
bool has_placement(box2d<double> const& box, double margin, mapnik::value_unicode_string const& text, double repeat_distance)
{
// Don't bother with any of the repeat checking unless the repeat distance is greater than the margin
if (repeat_distance <= margin) {
return has_placement(box, margin);
}
box2d<double> repeat_box(box.minx() - repeat_distance, box.miny() - repeat_distance,
box.maxx() + repeat_distance, box.maxy() + repeat_distance);
box2d<double> const& margin_box = (margin > 0
? box2d<double>(box.minx() - margin, box.miny() - margin,
box.maxx() + margin, box.maxy() + margin)
: box);
tree_t::query_iterator tree_itr = tree_.query_in_box(repeat_box);
tree_t::query_iterator tree_end = tree_.query_end();
for ( ;tree_itr != tree_end; ++tree_itr)
{
if (tree_itr->get().box.intersects(margin_box) || (text == tree_itr->get().text && tree_itr->get().box.intersects(repeat_box)))
{
return false;
}
}
return true;
}
示例3: has_placement
bool has_placement(box2d<double> const& box, double minimum_distance, mapnik::value_unicode_string const& text, double repeat_distance)
{
box2d<double> const& minimum_box = (minimum_distance > 0
? box2d<double>(box.minx() - minimum_distance, box.miny() - minimum_distance,
box.maxx() + minimum_distance, box.maxy() + minimum_distance)
: box);
box2d<double> const& repeat_box = (repeat_distance > 0
? box2d<double>(box.minx() - repeat_distance, box.miny() - repeat_distance,
box.maxx() + repeat_distance, box.maxy() + repeat_distance)
: box);
tree_t::query_iterator itr = tree_.query_in_box(repeat_distance > minimum_distance ? repeat_box : minimum_box);
tree_t::query_iterator end = tree_.query_end();
for ( ;itr != end; ++itr)
{
if (itr->box.intersects(minimum_box) || (text == itr->text && itr->box.intersects(repeat_box)))
{
return false;
}
}
return true;
}
示例4: transform
inline box2d<double> transform(box2d<double>& box) const
{
int x_offset = int(std::floor(box.minx() / tile_size_));
int y_offset = int(std::floor(box.miny() / tile_size_));
box2d<double> rem(x_offset * tile_size_,
y_offset * tile_size_,
x_offset * tile_size_,
y_offset * tile_size_);
box.init(box.minx() - rem.minx(),
box.miny() - rem.miny(),
box.maxx() - rem.maxx(),
box.maxy() - rem.maxy());
return rem;
}
示例5: info
tiled_multi_file_policy(std::string const& file_pattern,
std::string const& format,
unsigned tile_size,
box2d<double> extent,
box2d<double> bbox,
unsigned width,
unsigned height,
unsigned tile_stride)
: image_width_(width),
image_height_(height),
tile_size_(tile_size),
tile_stride_(tile_stride)
{
double lox = extent.minx();
double loy = extent.miny();
//int max_x = int(std::ceil(double(width) / double(tile_size)));
//int max_y = int(std::ceil(double(height) / double(tile_size)));
double pixel_x = extent.width() / double(width);
double pixel_y = extent.height() / double(height);
#ifdef MAPNIK_DEBUG
std::clog << "Raster Plugin: PIXEL SIZE("<< pixel_x << "," << pixel_y << ")" << std::endl;
#endif
// intersection of query with extent => new query
box2d<double> e = bbox.intersect(extent);
const int x_min = int(std::floor((e.minx() - lox) / (tile_size * pixel_x)));
const int y_min = int(std::floor((e.miny() - loy) / (tile_size * pixel_y)));
const int x_max = int(std::ceil((e.maxx() - lox) / (tile_size * pixel_x)));
const int y_max = int(std::ceil((e.maxy() - loy) / (tile_size * pixel_y)));
for (int x = x_min; x < x_max; ++x)
{
for (int y = y_min; y < y_max; ++y)
{
// x0, y0, x1, y1 => projection-space image coordinates.
double x0 = lox + x*tile_size*pixel_x;
double y0 = loy + y*tile_size*pixel_y;
double x1 = x0 + tile_size*pixel_x;
double y1 = y0 + tile_size*pixel_y;
// check if it intersects the query
if (e.intersects(box2d<double>(x0,y0,x1,y1)))
{
// tile_box => intersection of tile with query in projection-space.
box2d<double> tile_box = e.intersect(box2d<double>(x0,y0,x1,y1));
std::string file = interpolate(file_pattern, x, y);
raster_info info(file,format,tile_box,tile_size,tile_size);
infos_.push_back(info);
}
}
}
#ifdef MAPNIK_DEBUG
std::clog << "Raster Plugin: INFO SIZE=" << infos_.size() << " " << file_pattern << std::endl;
#endif
}
示例6: backward
inline box2d<double> backward(box2d<double> const& e) const
{
double x0 = e.minx();
double y0 = e.miny();
double x1 = e.maxx();
double y1 = e.maxy();
backward(&x0, &y0);
backward(&x1, &y1);
return box2d<double>(x0, y0, x1, y1);
}
示例7: sql_bbox
std::string occi_datasource::sql_bbox(box2d<double> const& env) const
{
std::ostringstream b;
b << std::setprecision(16);
b << "MDSYS.SDO_GEOMETRY(" << SDO_GTYPE_2DPOLYGON << "," << srid_ << ",NULL,";
b << " MDSYS.SDO_ELEM_INFO_ARRAY(1," << SDO_ETYPE_POLYGON << "," << SDO_INTERPRETATION_RECTANGLE << "),";
b << " MDSYS.SDO_ORDINATE_ARRAY(";
b << env.minx() << "," << env.miny() << ", ";
b << env.maxx() << "," << env.maxy() << "))";
return b.str();
}
示例8: sql_bbox
std::string postgis_datasource::sql_bbox(box2d<double> const& env) const
{
std::ostringstream b;
if (srid_ > 0)
b << "SetSRID(";
b << "'BOX3D(";
b << std::setprecision(16);
b << env.minx() << " " << env.miny() << ",";
b << env.maxx() << " " << env.maxy() << ")'::box3d";
if (srid_ > 0)
b << ", " << srid_ << ")";
return b.str();
}
示例9: split_box
void split_box(box2d<double> const& node_extent,box2d<double> * ext)
{
double width=node_extent.width();
double height=node_extent.height();
double lox=node_extent.minx();
double loy=node_extent.miny();
double hix=node_extent.maxx();
double hiy=node_extent.maxy();
ext[0]=box2d<double>(lox,loy,lox + width * ratio_,loy + height * ratio_);
ext[1]=box2d<double>(hix - width * ratio_,loy,hix,loy + height * ratio_);
ext[2]=box2d<double>(lox,hiy - height*ratio_,lox + width * ratio_,hiy);
ext[3]=box2d<double>(hix - width * ratio_,hiy - height*ratio_,hix,hiy);
}
示例10: pixf
void agg_renderer<T0,T1>::debug_draw_box(R& buf, box2d<double> const& box,
double x, double y, double angle)
{
using pixfmt = agg::pixfmt_rgba32_pre;
using renderer_base = agg::renderer_base<pixfmt>;
using renderer_type = agg::renderer_scanline_aa_solid<renderer_base>;
agg::scanline_p8 sl_line;
pixfmt pixf(buf);
renderer_base renb(pixf);
renderer_type ren(renb);
// compute tranformation matrix
agg::trans_affine tr = agg::trans_affine_rotation(angle).translate(x, y);
// prepare path
agg::path_storage pbox;
pbox.start_new_path();
pbox.move_to(box.minx(), box.miny());
pbox.line_to(box.maxx(), box.miny());
pbox.line_to(box.maxx(), box.maxy());
pbox.line_to(box.minx(), box.maxy());
pbox.line_to(box.minx(), box.miny());
// prepare stroke with applied transformation
using conv_transform = agg::conv_transform<agg::path_storage>;
using conv_stroke = agg::conv_stroke<conv_transform>;
conv_transform tbox(pbox, tr);
conv_stroke sbox(tbox);
sbox.generator().width(1.0 * common_.scale_factor_);
// render the outline
ras_ptr->reset();
ras_ptr->add_path(sbox);
ren.color(agg::rgba8_pre(0x33, 0x33, 0xff, 0xcc)); // blue is fine
agg::render_scanlines(*ras_ptr, sl_line, ren);
}
示例11: has_placement
bool has_placement(box2d<double> const& box, mapnik::value_unicode_string const& text, double distance)
{
box2d<double> bigger_box(box.minx() - distance, box.miny() - distance, box.maxx() + distance, box.maxy() + distance);
tree_t::query_iterator itr = tree_.query_in_box(bigger_box);
tree_t::query_iterator end = tree_.query_end();
for ( ;itr != end; ++itr)
{
if (itr->box.intersects(box) || (text == itr->text && itr->box.intersects(bigger_box)))
{
return false;
}
}
return true;
}
示例12: has_point_placement
bool has_point_placement(box2d<double> const& box, double distance)
{
box2d<double> bigger_box(box.minx() - distance, box.miny() - distance, box.maxx() + distance, box.maxy() + distance);
tree_t::query_iterator itr = tree_.query_in_box(bigger_box);
tree_t::query_iterator end = tree_.query_end();
for ( ;itr != end; ++itr)
{
if (itr->box.intersects(bigger_box))
{
return false;
}
}
return true;
}
示例13: backward
bool proj_transform::backward (box2d<double> & box) const
{
if (is_source_equal_dest_)
return true;
double minx = box.minx();
double miny = box.miny();
double maxx = box.maxx();
double maxy = box.maxy();
double z = 0.0;
if (!backward(minx,miny,z))
return false;
if (!backward(maxx,maxy,z))
return false;
box.init(minx,miny,maxx,maxy);
return true;
}
示例14: result
/** Rotates the size_ box and translates the position. */
box2d<double> perform_transform(double angle, double dx, double dy)
{
double x1 = size_.minx();
double x2 = size_.maxx();
double y1 = size_.miny();
double y2 = size_.maxy();
agg::trans_affine tr = tr_ * agg::trans_affine_rotation(angle).translate(dx, dy);
double xA = x1, yA = y1, xB = x2, yB = y1, xC = x2, yC = y2, xD = x1, yD = y2;
tr.transform(&xA, &yA);
tr.transform(&xB, &yB);
tr.transform(&xC, &yC);
tr.transform(&xD, &yD);
box2d<double> result(xA, yA, xC, yC);
result.expand_to_include(xB, yB);
result.expand_to_include(xD, yD);
return result;
}
示例15: draw_rect
void draw_rect(image_32 &pixmap, box2d<double> const& box)
{
double x0 = box.minx();
double x1 = box.maxx();
double y0 = box.miny();
double y1 = box.maxy();
unsigned color1 = 0xff0000ff;
for (double x=x0; x<x1; x++)
{
pixmap.setPixel(x, y0, color1);
pixmap.setPixel(x, y1, color1);
}
for (double y=y0; y<y1; y++)
{
pixmap.setPixel(x0, y, color1);
pixmap.setPixel(x1, y, color1);
}
}