move svg transform to symbolizer_base
This commit is contained in:
parent
ba270e07f2
commit
831538b522
2 changed files with 45 additions and 39 deletions
|
@ -35,16 +35,31 @@
|
|||
namespace mapnik
|
||||
{
|
||||
|
||||
typedef boost::array<double,6> transform_type;
|
||||
|
||||
class Map;
|
||||
|
||||
class MAPNIK_DECL symbolizer_base {
|
||||
class MAPNIK_DECL symbolizer_base
|
||||
{
|
||||
public:
|
||||
symbolizer_base():
|
||||
properties_(),
|
||||
symbolizer_base()
|
||||
: properties_(),
|
||||
properties_complete_(),
|
||||
writer_name_(),
|
||||
writer_ptr_(),
|
||||
comp_op_(clear) {}
|
||||
comp_op_(clear)
|
||||
{
|
||||
affine_transform_[0] = 1.0;
|
||||
affine_transform_[1] = 0.0;
|
||||
affine_transform_[2] = 0.0;
|
||||
affine_transform_[3] = 1.0;
|
||||
affine_transform_[4] = 0.0;
|
||||
affine_transform_[5] = 0.0;
|
||||
}
|
||||
|
||||
symbolizer_base(symbolizer_base const& other)
|
||||
: comp_op_(other.comp_op_),
|
||||
affine_transform_(other.affine_transform_) {}
|
||||
|
||||
/** Add a metawriter to this symbolizer using a name. */
|
||||
void add_metawriter(std::string const& name, metawriter_properties const& properties);
|
||||
|
@ -82,23 +97,24 @@ public:
|
|||
|
||||
void set_comp_op(composite_mode_e comp_op);
|
||||
composite_mode_e comp_op() const;
|
||||
void set_transform(transform_type const& );
|
||||
transform_type const& get_transform() const;
|
||||
std::string get_transform_string() const;
|
||||
private:
|
||||
metawriter_properties properties_;
|
||||
metawriter_properties properties_complete_;
|
||||
std::string writer_name_;
|
||||
metawriter_ptr writer_ptr_;
|
||||
composite_mode_e comp_op_;
|
||||
transform_type affine_transform_;
|
||||
};
|
||||
|
||||
typedef boost::array<double,6> transform_type;
|
||||
|
||||
class MAPNIK_DECL symbolizer_with_image {
|
||||
class MAPNIK_DECL symbolizer_with_image
|
||||
{
|
||||
public:
|
||||
path_expression_ptr get_filename() const;
|
||||
void set_filename(path_expression_ptr filename);
|
||||
void set_transform(transform_type const& );
|
||||
transform_type const& get_transform() const;
|
||||
std::string const get_transform_string() const;
|
||||
void set_opacity(float opacity);
|
||||
float get_opacity() const;
|
||||
protected:
|
||||
|
@ -106,7 +122,6 @@ protected:
|
|||
symbolizer_with_image(symbolizer_with_image const& rhs);
|
||||
path_expression_ptr image_filename_;
|
||||
float image_opacity_;
|
||||
transform_type matrix_;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ void symbolizer_base::cache_metawriters(Map const &m)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
metawriter_with_properties symbolizer_base::get_metawriter() const
|
||||
{
|
||||
return metawriter_with_properties(writer_ptr_, properties_complete_);
|
||||
|
@ -81,24 +80,36 @@ composite_mode_e symbolizer_base::comp_op() const
|
|||
return comp_op_;
|
||||
}
|
||||
|
||||
void symbolizer_base::set_transform(transform_type const& affine_transform)
|
||||
{
|
||||
affine_transform_ = affine_transform;
|
||||
}
|
||||
|
||||
transform_type const& symbolizer_base::get_transform() const
|
||||
{
|
||||
return affine_transform_;
|
||||
}
|
||||
|
||||
std::string symbolizer_base::get_transform_string() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "matrix(" << affine_transform_[0] << ", " << affine_transform_[1] << ", "
|
||||
<< affine_transform_[2] << ", " << affine_transform_[3] << ", "
|
||||
<< affine_transform_[4] << ", " << affine_transform_[5] << ")";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
|
||||
symbolizer_with_image::symbolizer_with_image(path_expression_ptr file)
|
||||
: image_filename_( file ),
|
||||
image_opacity_(1.0f)
|
||||
|
||||
{
|
||||
matrix_[0] = 1.0;
|
||||
matrix_[1] = 0.0;
|
||||
matrix_[2] = 0.0;
|
||||
matrix_[3] = 1.0;
|
||||
matrix_[4] = 0.0;
|
||||
matrix_[5] = 0.0;
|
||||
}
|
||||
|
||||
symbolizer_with_image::symbolizer_with_image( symbolizer_with_image const& rhs)
|
||||
: image_filename_(rhs.image_filename_),
|
||||
image_opacity_(rhs.image_opacity_),
|
||||
matrix_(rhs.matrix_) {}
|
||||
image_opacity_(rhs.image_opacity_) {}
|
||||
|
||||
path_expression_ptr symbolizer_with_image::get_filename() const
|
||||
{
|
||||
|
@ -110,26 +121,6 @@ void symbolizer_with_image::set_filename(path_expression_ptr image_filename)
|
|||
image_filename_ = image_filename;
|
||||
}
|
||||
|
||||
void symbolizer_with_image::set_transform(transform_type const& matrix)
|
||||
{
|
||||
matrix_ = matrix;
|
||||
}
|
||||
|
||||
transform_type const& symbolizer_with_image::get_transform() const
|
||||
{
|
||||
return matrix_;
|
||||
}
|
||||
|
||||
std::string const symbolizer_with_image::get_transform_string() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "matrix(" << matrix_[0] << ", " << matrix_[1] << ", "
|
||||
<< matrix_[2] << ", " << matrix_[3] << ", "
|
||||
<< matrix_[4] << ", " << matrix_[5] << ")";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
|
||||
void symbolizer_with_image::set_opacity(float opacity)
|
||||
{
|
||||
image_opacity_ = opacity;
|
||||
|
|
Loading…
Add table
Reference in a new issue