move building_symbolizer into separate hpp/cpp

This commit is contained in:
Artem Pavlenko 2012-01-19 18:26:15 -05:00
parent 9bb9a34323
commit 748adf8229
6 changed files with 192 additions and 94 deletions

View file

@ -0,0 +1,53 @@
/*****************************************************************************
*
* 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_BUILDING_SYMBOLIZER_HPP
#define MAPNIK_BUILDING_SYMBOLIZER_HPP
// mapnik
#include <mapnik/color.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/filter_factory.hpp>
namespace mapnik
{
struct MAPNIK_DECL building_symbolizer : public symbolizer_base
{
building_symbolizer();
building_symbolizer(color const& fill, expression_ptr height);
color const& get_fill() const;
void set_fill(color const& fill);
expression_ptr height() const;
void set_height(expression_ptr height);
void set_opacity(double opacity);
double get_opacity() const;
private:
color fill_;
expression_ptr height_;
double opacity_;
};
}
#endif // MAPNIK_BUILDING_SYMBOLIZER_HPP

View file

@ -29,61 +29,22 @@
#include <mapnik/filter_factory.hpp>
#include <mapnik/enumeration.hpp>
#include <mapnik/gamma_method.hpp>
// stl
#include <string>
namespace mapnik
{
struct MAPNIK_DECL polygon_symbolizer : public symbolizer_base
{
polygon_symbolizer()
: symbolizer_base(),
fill_(color(128,128,128)),
opacity_(1.0),
gamma_(1.0),
gamma_method_(GAMMA_POWER) {}
polygon_symbolizer(color const& fill)
: symbolizer_base(),
fill_(fill),
opacity_(1.0),
gamma_(1.0),
gamma_method_(GAMMA_POWER) {}
color const& get_fill() const
{
return fill_;
}
void set_fill(color const& fill)
{
fill_ = fill;
}
void set_opacity(double opacity)
{
opacity_ = opacity;
}
double get_opacity() const
{
return opacity_;
}
void set_gamma(double gamma)
{
gamma_ = gamma;
}
double get_gamma() const
{
return gamma_;
}
void set_gamma_method(gamma_method_e gamma_method)
{
gamma_method_ = gamma_method;
}
gamma_method_e get_gamma_method() const
{
return gamma_method_;
}
polygon_symbolizer();
polygon_symbolizer(color const& fill);
color const& get_fill() const;
void set_fill(color const& fill);
void set_opacity(double opacity);
double get_opacity() const;
void set_gamma(double gamma);
double get_gamma() const;
void set_gamma_method(gamma_method_e gamma_method);
gamma_method_e get_gamma_method() const;
private:
color fill_;
@ -91,50 +52,7 @@ private:
double gamma_;
gamma_method_e gamma_method_;
};
struct MAPNIK_DECL building_symbolizer : public symbolizer_base
{
explicit building_symbolizer()
: symbolizer_base(),
fill_(color(128,128,128)),
opacity_(1.0)
{}
building_symbolizer(color const& fill, expression_ptr height)
: symbolizer_base(),
fill_(fill),
height_(height),
opacity_(1.0) {}
color const& get_fill() const
{
return fill_;
}
void set_fill(color const& fill)
{
fill_ = fill;
}
expression_ptr height() const
{
return height_;
}
void set_height(expression_ptr height)
{
height_=height;
}
void set_opacity(double opacity)
{
opacity_ = opacity;
}
double get_opacity() const
{
return opacity_;
}
private:
color fill_;
expression_ptr height_;
double opacity_;
};
}
#endif // MAPNIK_POLYGON_SYMBOLIZER_HPP

View file

@ -23,7 +23,8 @@
#ifndef MAPNIK_RULE_HPP
#define MAPNIK_RULE_HPP
// mapnik
// mapni
#include <mapnik/building_symbolizer.hpp>
#include <mapnik/line_symbolizer.hpp>
#include <mapnik/line_pattern_symbolizer.hpp>
#include <mapnik/polygon_symbolizer.hpp>

View file

@ -105,6 +105,7 @@ source = Split(
"""
color.cpp
box2d.cpp
building_symbolizer.cpp
datasource_cache.cpp
deepcopy.cpp
expression_string.cpp

View file

@ -0,0 +1,72 @@
/*****************************************************************************
*
* 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
*
*****************************************************************************/
//$Id$
// mapnik
#include <mapnik/building_symbolizer.hpp>
namespace mapnik
{
building_symbolizer::building_symbolizer()
: symbolizer_base(),
fill_(color(128,128,128)),
opacity_(1.0)
{}
building_symbolizer::building_symbolizer(color const& fill, expression_ptr height)
: symbolizer_base(),
fill_(fill),
height_(height),
opacity_(1.0) {}
color const& building_symbolizer::get_fill() const
{
return fill_;
}
void building_symbolizer::set_fill(color const& fill)
{
fill_ = fill;
}
expression_ptr building_symbolizer::height() const
{
return height_;
}
void building_symbolizer::set_height(expression_ptr height)
{
height_=height;
}
void building_symbolizer::set_opacity(double opacity)
{
opacity_ = opacity;
}
double building_symbolizer::get_opacity() const
{
return opacity_;
}
}

View file

@ -27,5 +27,58 @@
namespace mapnik
{
polygon_symbolizer::polygon_symbolizer()
: symbolizer_base(),
fill_(color(128,128,128)),
opacity_(1.0),
gamma_(1.0),
gamma_method_(GAMMA_POWER) {}
polygon_symbolizer::polygon_symbolizer(color const& fill)
: symbolizer_base(),
fill_(fill),
opacity_(1.0),
gamma_(1.0),
gamma_method_(GAMMA_POWER) {}
color const& polygon_symbolizer::get_fill() const
{
return fill_;
}
void polygon_symbolizer::set_fill(color const& fill)
{
fill_ = fill;
}
void polygon_symbolizer::set_opacity(double opacity)
{
opacity_ = opacity;
}
double polygon_symbolizer::get_opacity() const
{
return opacity_;
}
void polygon_symbolizer::set_gamma(double gamma)
{
gamma_ = gamma;
}
double polygon_symbolizer::get_gamma() const
{
return gamma_;
}
void polygon_symbolizer::set_gamma_method(gamma_method_e gamma_method)
{
gamma_method_ = gamma_method;
}
gamma_method_e polygon_symbolizer::get_gamma_method() const
{
return gamma_method_;
}
}