Exemplo n.º 1
0
 void add_path(T & path)
 {
     marker_placement_enum placement_method = get<marker_placement_enum>(sym_, keys::markers_placement_type, feature_, vars_, MARKER_POINT_PLACEMENT);
     double opacity = get<double>(sym_, keys::opacity, feature_, vars_,  1.0);
     double spacing = get<double>(sym_, keys::spacing, feature_, vars_,  100.0);
     double max_error = get<double>(sym_, keys::max_error, feature_, vars_,  0.2);
     bool allow_overlap = get<bool>(sym_, keys::allow_overlap, feature_, vars_,  false);
     bool ignore_placement = get<bool>(sym_, keys::ignore_placement, feature_, vars_,  false);
     box2d<double> bbox_(0,0, src_.width(),src_.height());
     markers_placement_finder<T, label_collision_detector4> placement_finder(
         placement_method,
         path,
         bbox_,
         marker_trans_,
         detector_,
         spacing * scale_factor_,
         max_error,
         allow_overlap);
     double x, y, angle = .0;
     while (placement_finder.get_point(x, y, angle, ignore_placement))
     {
         agg::trans_affine matrix = marker_trans_;
         matrix.rotate(angle);
         matrix.translate(x, y);
         ctx_.add_image(matrix, src_, opacity);
     }
 }
Exemplo n.º 2
0
 void add_path(T & path)
 {
     marker_placement_enum placement_method = get<marker_placement_enum, keys::markers_placement_type>(sym_, feature_, vars_);
     value_bool ignore_placement = get<value_bool, keys::ignore_placement>(sym_, feature_, vars_);
     value_bool allow_overlap = get<value_bool, keys::allow_overlap>(sym_, feature_, vars_);
     value_bool avoid_edges = get<value_bool, keys::avoid_edges>(sym_, feature_, vars_);
     value_double opacity = get<value_double,keys::opacity>(sym_, feature_, vars_);
     value_double spacing = get<value_double, keys::spacing>(sym_, feature_, vars_);
     value_double max_error = get<value_double, keys::max_error>(sym_, feature_, vars_);
     coord2d center = src_->bounding_box().center();
     agg::trans_affine_translation recenter(-center.x, -center.y);
     agg::trans_affine tr = recenter * marker_trans_;
     direction_enum direction = get<direction_enum, keys::direction>(sym_, feature_, vars_);
     markers_placement_params params { src_->bounding_box(), tr, spacing * scale_factor_, max_error, allow_overlap, avoid_edges, direction };
     markers_placement_finder<T, Detector> placement_finder(
         placement_method, path, detector_, params);
     double x, y, angle = .0;
     while (placement_finder.get_point(x, y, angle, ignore_placement))
     {
         agg::trans_affine matrix = tr;
         matrix.rotate(angle);
         matrix.translate(x, y);
         render_marker(matrix, opacity);
     }
 }
Exemplo n.º 3
0
 void add_path(T & path)
 {
     agg::scanline_u8 sl_;
     marker_placement_enum placement_method = get<marker_placement_enum>(sym_, keys::markers_placement_type, feature_, vars_, MARKER_POINT_PLACEMENT);
     bool ignore_placement = get<bool>(sym_, keys::ignore_placement, feature_, vars_, false);
     bool allow_overlap = get<bool>(sym_, keys::allow_overlap, feature_, vars_, false);
     bool avoid_edges = get<bool>(sym_, keys::avoid_edges, feature_, vars_, false);
     double opacity = get<double>(sym_,keys::opacity, feature_, vars_, 1.0);
     double spacing = get<double>(sym_, keys::spacing, feature_, vars_, 100.0);
     double max_error = get<double>(sym_, keys::max_error, feature_, vars_, 0.2);
     coord2d center = bbox_.center();
     agg::trans_affine_translation recenter(-center.x, -center.y);
     agg::trans_affine tr = recenter * marker_trans_;
     markers_placement_params params { bbox_, tr, spacing * scale_factor_, max_error, allow_overlap, avoid_edges };
     markers_placement_finder<T, Detector> placement_finder(
         placement_method, path, detector_, params);
     double x, y, angle = .0;
     while (placement_finder.get_point(x, y, angle, ignore_placement))
     {
         agg::trans_affine matrix = tr;
         matrix.rotate(angle);
         matrix.translate(x, y);
         if (snap_to_pixels_)
         {
             // https://github.com/mapnik/mapnik/issues/1316
             matrix.tx = std::floor(matrix.tx + .5);
             matrix.ty = std::floor(matrix.ty + .5);
         }
         svg_renderer_.render(ras_, sl_, renb_, matrix, opacity, bbox_);
     }
 }
Exemplo n.º 4
0
 void add_path(T & path)
 {
     agg::scanline_bin sl_;
     marker_placement_enum placement_method = get<marker_placement_enum>(sym_, keys::markers_placement_type, feature_, vars_, MARKER_POINT_PLACEMENT);
     bool ignore_placement = get<bool>(sym_, keys::ignore_placement, feature_, vars_, false);
     bool allow_overlap = get<bool>(sym_, keys::allow_overlap, feature_, vars_, false);
     box2d<double> bbox(0,0, src_.width(), src_.height());
     double spacing = get<double>(sym_, keys::spacing, feature_, vars_, 100.0);
     double max_error = get<double>(sym_, keys::max_error, feature_, vars_, 0.2);
     markers_placement_params params { bbox, marker_trans_, spacing * scale_factor_, max_error, allow_overlap };
     markers_placement_finder<T, label_collision_detector4> placement_finder(
         placement_method, path, detector_, params);
     double x, y, angle = .0;
     while (placement_finder.get_point(x, y, angle, ignore_placement))
     {
         agg::trans_affine matrix = marker_trans_;
         matrix.rotate(angle);
         matrix.translate(x, y);
         render_raster_marker(matrix);
         if (!placed_)
         {
             pixmap_.add_feature(feature_);
             placed_ = true;
         }
     }
 }
Exemplo n.º 5
0
 void add_path(T & path)
 {
     agg::scanline_bin sl_;
     marker_placement_enum placement_method =
         get<marker_placement_enum>(sym_, keys::markers_placement_type, feature_, vars_, MARKER_POINT_PLACEMENT);
     bool ignore_placement = get<bool>(sym_, keys::ignore_placement, feature_, vars_, false);
     double opacity = get<double>(sym_,keys::opacity, feature_, vars_, 1.0);
     bool allow_overlap = get<bool>(sym_, keys::allow_overlap, feature_, vars_, false);
     coord2d center = bbox_.center();
     agg::trans_affine_translation recenter(-center.x, -center.y);
     double spacing = get<double>(sym_, keys::spacing, feature_, vars_, 100.0);
     double max_error = get<double>(sym_, keys::max_error, feature_, vars_, 0.2);
     markers_placement_params params { bbox_, marker_trans_, spacing * scale_factor_, max_error, allow_overlap };
     markers_placement_finder<T, Detector> placement_finder(
         placement_method, path, detector_, params);
     double x, y, angle = .0;
     while (placement_finder.get_point(x, y, angle, ignore_placement))
     {
         agg::trans_affine matrix = recenter * marker_trans_;
         matrix.rotate(angle);
         matrix.translate(x, y);
         svg_renderer_.render_id(ras_, sl_, renb_, feature_.id(), matrix, opacity, bbox_);
         if (!placed_)
         {
             pixmap_.add_feature(feature_);
             placed_ = true;
         }
     }
 }
Exemplo n.º 6
0
 void add_path(T & path)
 {
     markers_placement_finder<T, Detector> placement_finder(
         params_.placement_method, path, detector_, params_.placement_params);
     double x, y, angle = .0;
     while (placement_finder.get_point(x, y, angle, params_.ignore_placement))
     {
         agg::trans_affine matrix = params_.placement_params.tr;
         matrix.rotate(angle);
         matrix.translate(x, y);
         renderer_context_.render_marker(src_, path_, attrs_, params_, matrix);
     }
 }
Exemplo n.º 7
0
 void add_path(T & path)
 {
     markers_placement_finder<T, Detector> placement_finder(
         params_.placement_method, path, detector_, params_.placement_params);
     double x, y, angle = .0;
     box2d<double> box;
     while (placement_finder.get_point(x, y, angle, box, params_.ignore_placement))
     {
         agg::trans_affine matrix = params_.placement_params.tr;
         matrix.rotate(angle);
         matrix.translate(x, y);
         renderer_context_.render_marker(src_, params_, matrix);
         if (params_.key)
         {
             symbol_cache_.insert(*params_.key, box);
         }
     }
 }
Exemplo n.º 8
0
 void add_path(T & path)
 {
     marker_placement_enum placement_method = get<marker_placement_enum>(
         sym_, keys::markers_placement_type, feature_, vars_, MARKER_POINT_PLACEMENT);
     bool ignore_placement = get<bool>(sym_, keys::ignore_placement, feature_, vars_, false);
     bool allow_overlap = get<bool>(sym_, keys::allow_overlap, feature_, vars_, false);
     double opacity = get<double>(sym_, keys::opacity, feature_, vars_, 1.0);
     double spacing = get<double>(sym_, keys::spacing, feature_, vars_, 100.0);
     double max_error = get<double>(sym_, keys::max_error, feature_, vars_, 0.2);
     coord2d center = bbox_.center();
     agg::trans_affine_translation recenter(-center.x, -center.y);
     agg::trans_affine tr = recenter * marker_trans_;
     markers_placement_finder<T, label_collision_detector4> placement_finder(
         placement_method,
         path,
         bbox_,
         tr,
         detector_,
         spacing * scale_factor_,
         max_error,
         allow_overlap);
     double x, y, angle = .0;
     while (placement_finder.get_point(x, y, angle, ignore_placement))
     {
         agg::trans_affine matrix = tr;
         matrix.rotate(angle);
         matrix.translate(x, y);
         render_vector_marker(
             ctx_,
             pixel_position(x, y),
             marker_,
             bbox_,
             attributes_,
             matrix,
             opacity,
             false);
     }
 }
Exemplo n.º 9
0
 void add_path(T & path)
 {
     marker_placement_enum placement_method = get<marker_placement_enum, keys::markers_placement_type>(sym_, feature_, vars_);
     value_bool allow_overlap = get<value_bool, keys::allow_overlap>(sym_, feature_, vars_);
     value_bool avoid_edges = get<value_bool, keys::avoid_edges>(sym_, feature_, vars_);
     value_double opacity = get<value_double, keys::opacity>(sym_, feature_, vars_);
     value_bool ignore_placement = get<value_bool, keys::ignore_placement>(sym_, feature_, vars_);
     value_double spacing = get<value_double, keys::spacing>(sym_, feature_, vars_);
     value_double max_error = get<value_double, keys::max_error>(sym_, feature_, vars_);
     box2d<double> bbox(0,0, src_.width(),src_.height());
     direction_enum direction = get<direction_enum, keys::direction>(sym_, feature_, vars_);
     markers_placement_params params { bbox, marker_trans_, spacing * scale_factor_, max_error, allow_overlap, avoid_edges, direction };
     markers_placement_finder<T, Detector> placement_finder(
         placement_method, path, detector_, params);
     double x, y, angle = .0;
     while (placement_finder.get_point(x, y, angle, ignore_placement))
     {
         agg::trans_affine matrix = marker_trans_;
         matrix.rotate(angle);
         matrix.translate(x, y);
         render_marker(matrix, opacity);
     }
 }