本文整理汇总了C++中box2d类的典型用法代码示例。如果您正苦于以下问题:C++ box2d类的具体用法?C++ box2d怎么用?C++ box2d使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了box2d类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: 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;
}
开发者ID:agemsa,项目名称:mapnik,代码行数:25,代码来源:label_collision_detector.hpp
示例2: setup_label_transform
void setup_label_transform(agg::trans_affine & tr, box2d<double> const& bbox, mapnik::feature_impl const& feature, T const& sym)
{
double width = 0;
double height = 0;
expression_ptr const& width_expr = sym.get_width();
if (width_expr)
width = boost::apply_visitor(evaluate<Feature,value_type>(feature), *width_expr).to_double();
expression_ptr const& height_expr = sym.get_height();
if (height_expr)
height = boost::apply_visitor(evaluate<Feature,value_type>(feature), *height_expr).to_double();
if (width > 0 && height > 0)
{
double sx = width/bbox.width();
double sy = height/bbox.height();
tr *= agg::trans_affine_scaling(sx,sy);
}
else if (width > 0)
{
double sx = width/bbox.width();
tr *= agg::trans_affine_scaling(sx);
}
else if (height > 0)
{
double sy = height/bbox.height();
tr *= agg::trans_affine_scaling(sy);
}
else
{
evaluate_transform(tr, feature, sym.get_image_transform());
}
}
开发者ID:rjw57,项目名称:mapnik,代码行数:34,代码来源:marker_helpers.hpp
示例3: clip_line
bool clip_line(T& x0,T& y0,T& x1,T& y1,box2d<T> const& box)
{
double tmin=0.0;
double tmax=1.0;
double dx=x1-x0;
if (clip_test<double>(-dx,x0,tmin,tmax))
{
if (clip_test<double>(dx,box.width()-x0,tmin,tmax))
{
double dy=y1-y0;
if (clip_test<double>(-dy,y0,tmin,tmax))
{
if (clip_test<double>(dy,box.height()-y0,tmin,tmax))
{
if (tmax<1.0)
{
x1=static_cast<T>(x0+tmax*dx);
y1=static_cast<T>(y0+tmax*dy);
}
if (tmin>0.0)
{
x0+=static_cast<T>(tmin*dx);
y0+=static_cast<T>(tmin*dy);
}
return true;
}
}
}
}
return false;
}
开发者ID:ParveenArora,项目名称:mapnik,代码行数:31,代码来源:geom_util.hpp
示例4: tiled_multi_file_policy
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
}
开发者ID:ParveenArora,项目名称:mapnik,代码行数:59,代码来源:raster_featureset.hpp
示例5: border
keypoint_container<P, F>::keypoint_container(const box2d& d)
: index2d_(d, border(10))
{
fill_with_border(index2d_, -1);
keypoint_vector_.reserve((d.nrows() * d.ncols()) / 10);
feature_vector_.reserve((d.nrows() * d.ncols()) / 10);
compact_has_run_ = false;
}
开发者ID:Knight-X,项目名称:vpp,代码行数:8,代码来源:keypoint_container.hpp
示例6: transform
agg::trans_affine transform(box2d<double> & bbox) const
{
bbox *= image_tr_;
coord<double, 2> c = bbox.center();
agg::trans_affine mtx = agg::trans_affine_translation(
0.5 * bbox.width() - c.x,
0.5 * bbox.height() - c.y);
return image_tr_ * mtx;
}
开发者ID:haroldzmli,项目名称:mapnik,代码行数:9,代码来源:render_polygon_pattern.hpp
示例7: view_transform
view_transform(int _width, int _height, box2d<double> const& _extent,
double _offset_x = 0.0, double _offset_y = 0.0)
: width_(_width),
height_(_height),
extent_(_extent),
sx_(extent_.width() > 0 ? static_cast<double>(width_) / extent_.width() : 1.0),
sy_(extent_.height() > 0 ? static_cast<double>(height_) / extent_.height() : 1.0),
offset_x_(_offset_x),
offset_y_(_offset_y),
offset_(0) {}
开发者ID:DavidLiuGitHub,项目名称:mapnik,代码行数:10,代码来源:view_transform.hpp
示例8: 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);
}
开发者ID:DavidLiuGitHub,项目名称:mapnik,代码行数:10,代码来源:view_transform.hpp
示例9: 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();
}
开发者ID:gischen,项目名称:mapnik,代码行数:11,代码来源:occi_datasource.cpp
示例10: 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();
}
开发者ID:bygreencn,项目名称:mapnik,代码行数:13,代码来源:postgis_datasource.cpp
示例11: 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;
}
开发者ID:JesseCrocker,项目名称:mapnik,代码行数:28,代码来源:label_collision_detector.hpp
示例12: 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));
}
}
开发者ID:Blaxxun,项目名称:mapnik,代码行数:27,代码来源:proj_transform.cpp
示例13: 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;
}
开发者ID:FlavioFalcao,项目名称:mapnik,代码行数:16,代码来源:label_collision_detector.hpp
示例14: 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;
}
开发者ID:FlavioFalcao,项目名称:mapnik,代码行数:16,代码来源:label_collision_detector.hpp
示例15: MAPNIK_LOG_DEBUG
void grid_renderer<T>::start_layer_processing(layer const& lay, box2d<double> const& query_extent)
{
MAPNIK_LOG_DEBUG(grid_renderer) << "grid_renderer: Start processing layer=" << lay.name();
MAPNIK_LOG_DEBUG(grid_renderer) << "grid_renderer: datasource=" << lay.datasource().get();
MAPNIK_LOG_DEBUG(grid_renderer) << "grid_renderer: query_extent = " << query_extent;
if (lay.clear_label_cache())
{
detector_->clear();
}
query_extent_ = query_extent;
int buffer_size = lay.buffer_size();
if (buffer_size != 0 )
{
double padding = buffer_size * (double)(query_extent.width()/pixmap_.width());
double x0 = query_extent_.minx();
double y0 = query_extent_.miny();
double x1 = query_extent_.maxx();
double y1 = query_extent_.maxy();
query_extent_.init(x0 - padding, y0 - padding, x1 + padding , y1 + padding);
}
boost::optional<box2d<double> > const& maximum_extent = lay.maximum_extent();
if (maximum_extent)
{
query_extent_.clip(*maximum_extent);
}
}
开发者ID:LeadsPlus,项目名称:mapnik,代码行数:28,代码来源:grid_renderer.cpp
示例16: query
const_iterator query(const box2d<double>& box)
{
if (box.intersects(info_.envelope()))
{
return begin();
}
return end();
}
开发者ID:ParveenArora,项目名称:mapnik,代码行数:8,代码来源:raster_featureset.hpp
示例17: perform_transform
/** 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;
}
开发者ID:Kotaimen,项目名称:mapnik,代码行数:18,代码来源:markers_placement.hpp
示例18: 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;
}
开发者ID:Blaxxun,项目名称:mapnik,代码行数:17,代码来源:proj_transform.cpp
示例19: offset
coord<unsigned, 2> offset(Sym const & sym,
mapnik::feature_impl const & feature,
proj_transform const & prj_trans,
renderer_common const & common,
box2d<double> const & clip_box)
{
coord<unsigned, 2> off(0, 0);
pattern_alignment_enum alignment = get<pattern_alignment_enum, keys::alignment>(sym, feature, common.vars_);
if (alignment == LOCAL_ALIGNMENT)
{
coord<double, 2> alignment(0, 0);
apply_local_alignment apply(common.t_, prj_trans, clip_box, alignment.x, alignment.y);
util::apply_visitor(geometry::vertex_processor<apply_local_alignment>(apply), feature.get_geometry());
off.x = std::abs(clip_box.width() - alignment.x);
off.y = std::abs(clip_box.height() - alignment.y);
}
return off;
}
开发者ID:,项目名称:,代码行数:18,代码来源:
示例20: 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);
}
}
开发者ID:ake-koomsin,项目名称:mapnik_nvpr,代码行数:18,代码来源:process_debug_symbolizer.cpp
注:本文中的box2d类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论