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);
     }
 }
示例#2
0
 void add_path(T & path)
 {
     marker_placement_e placement_method = sym_.get_marker_placement();
     box2d<double> bbox_(0,0, src_.width(),src_.height());
     if (placement_method != MARKER_LINE_PLACEMENT)
     {
         double x = 0;
         double y = 0;
         if (placement_method == MARKER_INTERIOR_PLACEMENT)
         {
             if (!label::interior_position(path, x, y))
                 return;
         }
         else
         {
             if (!label::centroid(path, x, y))
                 return;
         }
         agg::trans_affine matrix = marker_trans_;
         matrix.translate(x,y);
         box2d<double> transformed_bbox = bbox_ * matrix;
         if (sym_.get_allow_overlap() ||
             detector_.has_placement(transformed_bbox))
         {
             render_raster_marker(matrix);
             if (!sym_.get_ignore_placement())
             {
                 detector_.insert(transformed_bbox);
             }
             if (!placed_)
             {
                 pixmap_.add_feature(feature_);
                 placed_ = true;
             }
         }
     }
     else
     {
         markers_placement<T, label_collision_detector4> placement(path, bbox_, marker_trans_, detector_,
                                                                   sym_.get_spacing() * scale_factor_,
                                                                   sym_.get_max_error(),
                                                                   sym_.get_allow_overlap());
         double x, y, angle;
         while (placement.get_point(x, y, angle))
         {
             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;
             }
         }
     }
 }