Beispiel #1
0
 static inline void apply(Polygon const& poly, Point& centroid,
         Strategy const& strategy)
 {
     if (range_ok(exterior_ring(poly), centroid))
     {
         typename Strategy::state_type state;
         centroid_polygon_state::apply(poly, strategy, state);
         strategy.result(state, centroid);
     }
 }
Beispiel #2
0
 static inline void apply(Range const& range, Point& centroid,
         Strategy const& strategy)
 {
     if (range_ok(range, centroid))
     {
         typename Strategy::state_type state;
         centroid_range_state<Closure>::apply(range, strategy, state);
         strategy.result(state, centroid);
     }
 }
Beispiel #3
0
 static inline void apply(Ring const& ring, Point& centroid,
         Strategy const& strategy)
 {
     if (range_ok(ring, centroid))
     {
         typename Strategy::state_type state;
         centroid_ring_state
             <
                 Ring,
                 Strategy
             >::apply(ring, strategy, state);
         Strategy::result(state, centroid);
     }
 }
Beispiel #4
0
    static inline bool apply(Polygon const& poly, Point& centroid,
                             Strategy const& strategy)
    {
        if (range_ok(exterior_ring(poly), centroid))
        {
            // prepare translation transformer
            translating_transformer<Polygon>
                transformer(*boost::begin(exterior_ring(poly)));
            
            typename Strategy::state_type state;
            centroid_polygon_state::apply(poly, transformer, strategy, state);
            
            if ( strategy.result(state, centroid) )
            {
                // translate the result back
                transformer.apply_reverse(centroid);
                return true;
            }
        }

        return false;
    }
Beispiel #5
0
    static inline bool apply(Range const& range, Point& centroid,
                             Strategy const& strategy)
    {
        if (range_ok(range, centroid))
        {
            // prepare translation transformer
            translating_transformer<Range> transformer(*boost::begin(range));
            
            typename Strategy::state_type state;
            centroid_range_state<Closure>::apply(range, transformer,
                                                 strategy, state);
            
            if ( strategy.result(state, centroid) )
            {
                // translate the result back
                transformer.apply_reverse(centroid);
                return true;
            }
        }

        return false;
    }