2007-09-25 20:47:12 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
*
|
|
|
|
* This file is part of Mapnik (c++ mapping toolkit)
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 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
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
//$Id$
|
|
|
|
|
2009-12-16 21:02:06 +01:00
|
|
|
//mapnik
|
2007-09-25 20:47:12 +02:00
|
|
|
#include <mapnik/symbolizer.hpp>
|
2010-07-06 02:37:05 +02:00
|
|
|
#include <mapnik/map.hpp>
|
2007-09-25 20:47:12 +02:00
|
|
|
|
|
|
|
namespace mapnik {
|
|
|
|
|
2010-07-06 02:37:05 +02:00
|
|
|
void symbolizer_base::add_metawriter(std::string name, expression_ptr expression)
|
|
|
|
{
|
|
|
|
expression_ = expression;
|
|
|
|
writer_name_ = name;
|
2010-07-06 07:49:48 +02:00
|
|
|
#ifdef MAPNIK_DEBUG
|
2010-07-06 02:37:05 +02:00
|
|
|
std::clog << "adding metawriter" << name << "\n";
|
2010-07-06 07:49:48 +02:00
|
|
|
#endif
|
2010-07-06 02:37:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void symbolizer_base::cache_metawriters(Map const &m)
|
|
|
|
{
|
2010-07-06 07:49:48 +02:00
|
|
|
#ifdef MAPNIK_DEBUG
|
2010-07-06 02:37:05 +02:00
|
|
|
std::clog << "Caching metawriters\n";
|
2010-07-06 07:49:48 +02:00
|
|
|
#endif
|
2010-07-06 02:37:05 +02:00
|
|
|
writer_ptr_ = m.find_metawriter(writer_name_);
|
2010-07-06 07:49:48 +02:00
|
|
|
#ifdef MAPNIK_DEBUG
|
2010-07-06 02:37:05 +02:00
|
|
|
std::clog << writer_ptr_ << "name:" << writer_name_ << "\n";
|
2010-07-06 07:49:48 +02:00
|
|
|
#endif
|
2010-07-06 02:37:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
std::pair<metawriter_ptr, expression_ptr> symbolizer_base::get_metawriter() const
|
|
|
|
{
|
|
|
|
return std::pair<metawriter_ptr, expression_ptr>(writer_ptr_, expression_);
|
|
|
|
}
|
|
|
|
|
2009-12-16 21:02:06 +01:00
|
|
|
symbolizer_with_image::symbolizer_with_image(path_expression_ptr file)
|
2010-06-15 15:43:27 +02:00
|
|
|
: image_filename_( file ),
|
|
|
|
opacity_(1.0f)
|
2010-06-03 14:35:02 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
matrix_[0] = 1.0;
|
|
|
|
matrix_[1] = 0.0;
|
|
|
|
matrix_[2] = 0.0;
|
|
|
|
matrix_[3] = 1.0;
|
|
|
|
matrix_[4] = 0.0;
|
|
|
|
matrix_[5] = 0.0;
|
|
|
|
}
|
2007-09-25 20:47:12 +02:00
|
|
|
|
2009-12-16 21:02:06 +01:00
|
|
|
symbolizer_with_image::symbolizer_with_image( symbolizer_with_image const& rhs)
|
2010-06-03 14:35:02 +02:00
|
|
|
: image_filename_(rhs.image_filename_),
|
2010-06-15 15:36:41 +02:00
|
|
|
opacity_(rhs.opacity_),
|
2010-06-03 14:35:02 +02:00
|
|
|
matrix_(rhs.matrix_) {}
|
2007-12-10 20:59:17 +01:00
|
|
|
|
2009-12-16 21:02:06 +01:00
|
|
|
path_expression_ptr symbolizer_with_image::get_filename() const
|
|
|
|
{
|
|
|
|
return image_filename_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void symbolizer_with_image::set_filename(path_expression_ptr image_filename)
|
|
|
|
{
|
|
|
|
image_filename_ = image_filename;
|
|
|
|
}
|
2009-05-15 00:54:36 +02:00
|
|
|
|
2010-06-03 14:35:02 +02:00
|
|
|
void symbolizer_with_image::set_transform(transform_type const& matrix)
|
|
|
|
{
|
|
|
|
matrix_ = matrix;
|
|
|
|
}
|
|
|
|
|
|
|
|
transform_type const& symbolizer_with_image::get_transform() const
|
|
|
|
{
|
|
|
|
return matrix_;
|
|
|
|
}
|
|
|
|
|
2010-06-15 14:27:50 +02:00
|
|
|
void symbolizer_with_image::set_opacity(float opacity)
|
|
|
|
{
|
|
|
|
opacity_ = opacity;
|
|
|
|
}
|
|
|
|
|
|
|
|
float symbolizer_with_image::get_opacity() const
|
|
|
|
{
|
|
|
|
return opacity_;
|
|
|
|
}
|
|
|
|
|
2007-09-25 20:47:12 +02:00
|
|
|
} // end of namespace mapnik
|
|
|
|
|
|
|
|
|
|
|
|
|