Remove unused code.

This commit is contained in:
Hermann Kraus 2012-07-22 02:11:15 +02:00
parent b53849d441
commit 0b16174ddb
19 changed files with 121 additions and 323 deletions

View file

@ -28,7 +28,7 @@
#include <mapnik/feature_type_style.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/layer.hpp>
#include <mapnik/metawriter.hpp>
#include <mapnik/metawriter/properties.hpp>
#include <mapnik/params.hpp>
// boost

View file

@ -27,11 +27,11 @@
#include <mapnik/feature.hpp>
#include <mapnik/ctrans.hpp>
#include <mapnik/projection.hpp>
#include <mapnik/metawriter/properties.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
#include <boost/concept_check.hpp>
// stl
@ -42,53 +42,6 @@
namespace mapnik {
class text_placement_info;
class text_path;
/** Implementation of std::map that also returns const& for operator[]. */
class metawriter_property_map
{
public:
typedef std::map<std::string, UnicodeString> property_map;
typedef property_map::const_iterator const_iterator;
metawriter_property_map() :
m_(),
not_found_() {}
UnicodeString const& operator[](std::string const& key) const;
UnicodeString& operator[](std::string const& key) {return m_[key];}
std::map<std::string, UnicodeString>::const_iterator find(std::string const& key) const
{
return m_.find(key);
}
std::map<std::string, UnicodeString>::const_iterator end() const
{
return m_.end();
}
UnicodeString const& get(std::string const& key) const
{
return (*this)[key];
}
private:
property_map m_;
UnicodeString not_found_;
};
/** All properties to be output by a metawriter. */
class metawriter_properties : public std::set<std::string>
{
public:
metawriter_properties(boost::optional<std::string> str);
metawriter_properties() {}
template <class InputIterator> metawriter_properties(
InputIterator first, InputIterator last) : std::set<std::string>(first, last) {}
std::string to_string() const;
};
/** Abstract baseclass for all metawriter classes. */
class metawriter
@ -110,11 +63,15 @@ public:
virtual void add_box(box2d<double> const& box, Feature const& feature,
CoordTransform const& t,
metawriter_properties const& properties)=0;
#if 0
virtual void add_text(boost::ptr_vector<text_path> const& placements,
box2d<double> const& extents,
Feature const& feature,
CoordTransform const& t,
metawriter_properties const& properties)=0;
#else
#warning MetaWriter: add_text disabled!
#endif
virtual void add_polygon(path_type & path,
Feature const& feature,
CoordTransform const& t,

View file

@ -0,0 +1,89 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2011 Artem Pavlenko
*
* 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_METAWRITER_PROPERTIES_HPP
#define MAPNIK_METAWRITER_PROPERTIES_HPP
// stl
#include <set>
#include <string>
// ICU
#include <unicode/unistr.h>
// boost
#include <boost/optional.hpp>
namespace mapnik {
/** All properties to be output by a metawriter. */
class metawriter_properties : public std::set<std::string>
{
public:
metawriter_properties(boost::optional<std::string> str);
metawriter_properties() {}
template <class InputIterator> metawriter_properties(
InputIterator first, InputIterator last) : std::set<std::string>(first, last) {}
std::string to_string() const;
};
class metawriter;
typedef boost::shared_ptr<metawriter> metawriter_ptr;
typedef std::pair<metawriter_ptr, metawriter_properties> metawriter_with_properties;
/** Implementation of std::map that also returns const& for operator[]. */
class metawriter_property_map
{
public:
typedef std::map<std::string, UnicodeString> property_map;
typedef property_map::const_iterator const_iterator;
metawriter_property_map() :
m_(),
not_found_() {}
UnicodeString const& operator[](std::string const& key) const;
UnicodeString& operator[](std::string const& key) {return m_[key];}
std::map<std::string, UnicodeString>::const_iterator find(std::string const& key) const
{
return m_.find(key);
}
std::map<std::string, UnicodeString>::const_iterator end() const
{
return m_.end();
}
UnicodeString const& get(std::string const& key) const
{
return (*this)[key];
}
private:
property_map m_;
UnicodeString not_found_;
};
}
#endif

View file

@ -65,11 +65,13 @@ public:
virtual void add_box(box2d<double> const& box, Feature const& feature,
CoordTransform const& t,
metawriter_properties const& properties);
#if 0
virtual void add_text(boost::ptr_vector<text_path> const& placements,
box2d<double> const& extents,
Feature const& feature,
CoordTransform const& t,
metawriter_properties const& properties);
#endif
virtual void add_polygon(path_type & path,
Feature const& feature,
CoordTransform const& t,

View file

@ -45,11 +45,13 @@ public:
virtual void add_box(box2d<double> const& box, Feature const& feature,
CoordTransform const& t,
metawriter_properties const& properties);
#if 0
virtual void add_text(boost::ptr_vector<text_path> const& placements,
box2d<double> const& extents,
Feature const& feature,
CoordTransform const& t,
metawriter_properties const& properties);
#endif
virtual void add_polygon(path_type & path,
Feature const& feature,
CoordTransform const& t,

View file

@ -26,9 +26,9 @@
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/parse_path.hpp>
#include <mapnik/metawriter.hpp>
#include <mapnik/image_compositing.hpp>
#include <mapnik/transform_expression.hpp>
#include <mapnik/metawriter/properties.hpp>
// boost
#include <boost/array.hpp>
@ -58,7 +58,7 @@ public:
* Call this function with an NULL writer_ptr to remove a metawriter.
*/
void add_metawriter(metawriter_ptr writer_ptr,
metawriter_properties const& properties = metawriter_properties(),
metawriter_properties const& properties,
std::string const& name = "");
/** Cache metawriter objects to avoid repeated lookups while processing.
*
@ -75,7 +75,7 @@ public:
/** Get metawriter properties.
* This functions returns the default attributes of the
* metawriter + symbolizer specific attributes.
* \note This function is a helperfunction for class attribute_collector.
* \note This function is a helper function for class attribute_collector.
*/
metawriter_properties const& get_metawriter_properties() const { return properties_complete_; }
/** Get metawriter properties which only apply to this symbolizer.

View file

@ -29,8 +29,9 @@
#include <mapnik/feature.hpp>
#include <mapnik/marker.hpp>
#include <mapnik/marker_cache.hpp>
#include <mapnik/text_path.hpp>
#include <mapnik/text/placement_finder_ng.hpp>
#include <mapnik/proj_transform.hpp>
#include <mapnik/ctrans.hpp>
//boost
#include <boost/shared_ptr.hpp>
@ -38,9 +39,6 @@
namespace mapnik {
typedef boost::ptr_vector<text_path> placements_type;
template <typename DetectorT> class placement_finder;
/** Helper object that does all the TextSymbolizer placment finding
* work except actually rendering the object. */
@ -95,8 +93,6 @@ protected:
std::list<position>::iterator point_itr_;
/** Text rotation. */
double angle_;
/** Text + formatting. */
string_info *info_;
/** Did last call to next_placement return true? */
bool placement_valid_;
/** Use point placement. Otherwise line placement is used. */
@ -139,7 +135,7 @@ public:
}
bool next();
pixel_position get_marker_position(text_path const& p);
pixel_position get_marker_position(glyph_positions_ptr p);
marker & get_marker() const;
agg::trans_affine const& get_image_transform() const;
protected:
@ -158,7 +154,6 @@ protected:
using text_symbolizer_helper<FaceManagerT, DetectorT>::geometries_to_process_;
using text_symbolizer_helper<FaceManagerT, DetectorT>::placement_;
using text_symbolizer_helper<FaceManagerT, DetectorT>::next_placement;
using text_symbolizer_helper<FaceManagerT, DetectorT>::info_;
using text_symbolizer_helper<FaceManagerT, DetectorT>::geo_itr_;
using text_symbolizer_helper<FaceManagerT, DetectorT>::point_itr_;
using text_symbolizer_helper<FaceManagerT, DetectorT>::points_;

View file

@ -77,8 +77,6 @@ private:
};
typedef boost::shared_ptr<glyph_positions> glyph_positions_ptr;
//typedef std::list<placement_positions_ptr> placement_positions_list;
class placement_finder_ng : boost::noncopyable
{
public:

View file

@ -1,202 +0,0 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2011 Artem Pavlenko
*
* 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_TEXT_PATH_HPP
#define MAPNIK_TEXT_PATH_HPP
// mapnik
#include <mapnik/char_info.hpp>
#include <mapnik/pixel_position.hpp>
//stl
#include <vector>
// boost
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
// uci
#include <unicode/unistr.h>
namespace mapnik
{
class string_info : private boost::noncopyable
{
protected:
typedef std::vector<char_info> characters_t;
characters_t characters_;
UnicodeString text_;
bool is_rtl;
public:
string_info(UnicodeString const& text)
: characters_(),
text_(text),
is_rtl(false)
{
}
string_info()
: characters_(),
text_(),
is_rtl(false)
{
}
void add_info(char_info const& info)
{
characters_.push_back(info);
}
void add_text(UnicodeString text)
{
text_ += text;
}
unsigned num_characters() const
{
return characters_.size();
}
void set_rtl(bool value)
{
is_rtl = value;
}
bool get_rtl() const
{
return is_rtl;
}
char_info const& at(unsigned i) const
{
return characters_[i];
}
char_info const& operator[](unsigned i) const
{
return at(i);
}
UnicodeString const& get_string() const
{
return text_;
}
bool has_line_breaks() const
{
UChar break_char = '\n';
return (text_.indexOf(break_char) >= 0);
}
/** Resets object to initial state. */
void clear(void)
{
text_ = "";
characters_.clear();
}
};
typedef char_info const * char_info_ptr;
/** List of all characters and their positions and formats for a placement. */
class text_path : boost::noncopyable
{
struct character_node
{
char_info_ptr c;
pixel_position pos;
double angle;
character_node(char_info_ptr c_, double x_, double y_, double angle_)
: c(c_),
pos(x_, y_),
angle(angle_)
{
}
~character_node() {}
void vertex(char_info_ptr *c_, double *x_, double *y_, double *angle_) const
{
*c_ = c;
*x_ = pos.x;
*y_ = pos.y;
*angle_ = angle;
}
};
mutable int itr_;
public:
typedef std::vector<character_node> character_nodes_t;
pixel_position center;
character_nodes_t nodes_;
text_path(double x, double y)
: itr_(0),
center(x,y),
nodes_()
{
}
~text_path() {}
/** Adds a new char to the list. */
void add_node(char_info_ptr c, double x, double y, double angle)
{
nodes_.push_back(character_node(c, x, y, angle));
}
/** Return node. Always returns a new node. Has no way to report that there are no more nodes. */
void vertex(char_info_ptr *c, double *x, double *y, double *angle) const
{
nodes_[itr_++].vertex(c, x, y, angle);
}
/** Start again at first node. */
void rewind() const
{
itr_ = 0;
}
/** Number of nodes. */
int num_nodes() const
{
return nodes_.size();
}
/** Delete all nodes. */
void clear()
{
nodes_.clear();
}
};
typedef boost::shared_ptr<text_path> text_path_ptr;
}
#endif // MAPNIK_TEXT_PATH_HPP

View file

@ -33,7 +33,7 @@ namespace mapnik
typedef std::pair<double,double> dimension_type;
class MAPNIK_DECL text_placements;
/** Generate a possible placement and store results of placement_finder.
/** Generate a possible placement.
* This placement has first to be tested by placement_finder to verify it
* can actually be used.
*/

View file

@ -130,7 +130,6 @@ source = Split(
parse_path.cpp
parse_transform.cpp
palette.cpp
placement_finder.cpp
plugin.cpp
png_reader.cpp
point_symbolizer.cpp

View file

@ -38,7 +38,6 @@
#include <mapnik/expression_evaluator.hpp>
#include <mapnik/warp.hpp>
#include <mapnik/config.hpp>
#include <mapnik/text_path.hpp>
#include <mapnik/vertex_converters.hpp>
// cairo
@ -683,7 +682,7 @@ public:
context_->glyph_path(glyphs);
}
void add_text(text_path const& path,
void add_text(glyph_positions_ptr path,
cairo_face_manager & manager,
face_manager<freetype_engine> &font_manager,
double scale_factor = 1.0)

View file

@ -32,6 +32,7 @@
#include <mapnik/scale_denominator.hpp>
#include <mapnik/agg_renderer.hpp>
#include <mapnik/grid/grid_renderer.hpp>
#include <mapnik/metawriter.hpp>
// boost
#include <boost/foreach.hpp>

View file

@ -209,54 +209,6 @@ stroker_ptr freetype_engine::create_stroker()
return stroker_ptr();
}
#if 0
void font_face_set::get_string_info(string_info & info, UnicodeString const& ustr, char_properties *format)
{
double avg_height = character_dimensions('X').height();
UErrorCode err = U_ZERO_ERROR;
UnicodeString reordered;
UnicodeString shaped;
int32_t length = ustr.length();
UBiDi *bidi = ubidi_openSized(length, 0, &err);
ubidi_setPara(bidi, ustr.getBuffer(), length, UBIDI_DEFAULT_LTR, 0, &err);
ubidi_writeReordered(bidi, reordered.getBuffer(length),
length, UBIDI_DO_MIRRORING, &err);
reordered.releaseBuffer(length);
u_shapeArabic(reordered.getBuffer(), length,
shaped.getBuffer(length), length,
U_SHAPE_LETTERS_SHAPE | U_SHAPE_LENGTH_FIXED_SPACES_NEAR |
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR, &err);
shaped.releaseBuffer(length);
if (U_SUCCESS(err)) {
StringCharacterIterator iter(shaped);
for (iter.setToStart(); iter.hasNext();) {
UChar ch = iter.nextPostInc();
char_info char_dim = character_dimensions(ch);
char_dim.format = format;
char_dim.avg_height = avg_height;
info.add_info(char_dim);
}
}
#if (U_ICU_VERSION_MAJOR_NUM*100 + U_ICU_VERSION_MINOR_NUM >= 406)
if (ubidi_getBaseDirection(ustr.getBuffer(), length) == UBIDI_RTL)
{
info.set_rtl(true);
}
#endif
ubidi_close(bidi);
}
#endif
template <typename T>
face_ptr face_manager<T>::get_face(const std::string &name)
{

View file

@ -25,7 +25,6 @@
#include <mapnik/metawriter.hpp>
#include <mapnik/metawriter_json.hpp>
#include <mapnik/text_placements/base.hpp>
#include <mapnik/text_path.hpp>
// Boost
#include <boost/foreach.hpp>
@ -176,6 +175,7 @@ void metawriter_json_stream::add_box(box2d<double> const &box, Feature const& fe
}
#if 0
void metawriter_json_stream::add_text(
boost::ptr_vector<text_path> const& placements, box2d<double> const& extents,
Feature const& feature, CoordTransform const& t,
@ -262,6 +262,7 @@ void metawriter_json_stream::add_text(
write_properties(feature, properties);
}
}
#endif
void metawriter_json_stream::add_polygon(path_type & path,
Feature const& feature,

View file

@ -69,6 +69,7 @@ metawriter_inmem::add_box(box2d<double> const& box, Feature const& feature,
instances_.push_back(inst);
}
#if 0
void
metawriter_inmem::add_text(
boost::ptr_vector<text_path> const& /*text*/,
@ -85,6 +86,7 @@ metawriter_inmem::add_text(
instances_.push_back(inst);
}
}
#endif
void
metawriter_inmem::add_polygon(path_type & path,

View file

@ -24,6 +24,7 @@
#include <mapnik/symbolizer.hpp>
#include <mapnik/map.hpp>
#include <mapnik/transform_processor.hpp>
#include <mapnik/metawriter.hpp>
namespace mapnik {

View file

@ -23,7 +23,6 @@
// mapnik
#include <mapnik/symbolizer_helpers.hpp>
#include <mapnik/label_collision_detector.hpp>
#include <mapnik/placement_finder.hpp>
#include <mapnik/font_engine_freetype.hpp>
#include <mapnik/text/layout.hpp>
#include "agg_conv_clip_polyline.h"
@ -264,8 +263,7 @@ bool text_symbolizer_helper<FaceManagerT, DetectorT>::next_placement()
placement_->properties.process(*layout_, feature_);
layout_->layout(placement_->properties.wrap_width);
//TODO
// info_ = &(text_.get_string_info());
if (placement_->properties.orientation)
{
angle_ = boost::apply_visitor(
@ -429,8 +427,9 @@ void shield_symbolizer_helper<FaceManagerT, DetectorT>::init_marker()
}
template <typename FaceManagerT, typename DetectorT>
pixel_position shield_symbolizer_helper<FaceManagerT, DetectorT>::get_marker_position(text_path const& p)
pixel_position shield_symbolizer_helper<FaceManagerT, DetectorT>::get_marker_position(glyph_positions_ptr p)
{
#if 0
position const& pos = placement_->properties.displacement;
if (placement_->properties.label_placement == LINE_PLACEMENT) {
double lx = p.center.x - pos.first;
@ -446,6 +445,9 @@ pixel_position shield_symbolizer_helper<FaceManagerT, DetectorT>::get_marker_pos
//collision_detector is already updated for point placement in get_point_placement()
return pixel_position(marker_x_, marker_y_);
}
#else
#warning get_marker_position() disabled!
#endif
}

View file

@ -36,8 +36,8 @@
#include <boost/make_shared.hpp>
/* TODO: Remove unused classes:
* string_info
* text_path
* string_info *
* text_path *
* char_info
*/