<commit_before>/*****************************************************************************
 *
 * This file is part of Mapnik (c++ mapping toolkit)
 *
 * Copyright (C) 2014 <NAME>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *****************************************************************************/

#ifndef MAPNIK_MARKERS_PLACEMENTS_POINT_HPP
#define MAPNIK_MARKERS_PLACEMENTS_POINT_HPP

#include <mapnik/markers_placements/point.hpp>
#include <mapnik/geom_util.hpp>

#include "agg_basics.h"
#include "agg_trans_affine.h"

namespace mapnik {

template <typename Locator, typename Detector>
class markers_point_placement
{
public:
    markers_point_placement(
        Locator &locator,
        box2d<double> const& size,
        agg::trans_affine const& tr,
        Detector &detector,
        double spacing,
        double max_error,
        bool allow_overlap)
        : locator_(locator),
          size_(size),
          tr_(tr),
          detector_(detector),
          spacing_(spacing),
          max_error_(max_error),
          allow_overlap_(allow_overlap),
          marker_width_((size_ * tr_).width()),
          done_(false)
    {
        rewind();

        coord2d center = size.center();
        tr_ = agg::trans_affine_translation(-center.x, -center.y) * tr_;
    }

    /** Start again at first marker.
     * \note Returns the same list of markers only works when they were NOT added
     *       to the detector.
     */
    virtual void rewind()
    {
        locator_.rewind(0);
        done_ = false;
    }

    /** Get a point where the marker should be placed.
     * Each time this function is called a new point is returned.<commit_msg>Avoid -Wdelete-non-virtual-dtor warning<commit_after>/*****************************************************************************
 *
 * This file is part of Mapnik (c++ mapping toolkit)
 *
 * Copyright (C) 2014 <NAME>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *****************************************************************************/

#ifndef MAPNIK_MARKERS_PLACEMENTS_POINT_HPP
#define MAPNIK_MARKERS_PLACEMENTS_POINT_HPP

#include <mapnik/markers_placements/point.hpp>
#include <mapnik/geom_util.hpp>

#include "agg_basics.h"
#include "agg_trans_affine.h"

namespace mapnik {

template <typename Locator, typename Detector>
class markers_point_placement
{
public:
    markers_point_placement(
        Locator &locator,
        box2d<double> const& size,
        agg::trans_affine const& tr,
        Detector &detector,
        double spacing,
        double max_error,
        bool allow_overlap)
        : locator_(locator),
          size_(size),
          tr_(tr),
          detector_(detector),
          spacing_(spacing),
          max_error_(max_error),
          allow_overlap_(allow_overlap),
          marker_width_((size_ * tr_).width()),
          done_(false)
    {
        rewind();

        coord2d center = size.center();
        tr_ = agg::trans_affine_translation(-center.x, -center.y) * tr_;
    }
    virtual ~markers_point_placement() {}

    /** Start again at first marker.
     * \note Returns the same list of markers only works when they were NOT added
     *       to the detector.
     */
    virtual void rewind()
    {
        locator_.rewind(0);
        done_ = false;
    }

    /** Get a point where the marker should be placed.
     * Each time this function is called a new point is returned.
{'fraction_non_alphanumeric': 0.13955906821963393, 'fraction_numerical': 0.008319467554076539, 'mean_word_length': 3.1243567753001713, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6334602', 'n_tokens_mistral': 1358, 'n_tokens_neox': 1287, 'n_words': 473}