Permalink
Browse files

remove camel-case names from layer.[h,c]pp

  • Loading branch information...
1 parent 5ec3fb1 commit 207ecfd597d70a9fcc1b3c8e768049658e4085fc @artemp artemp committed Mar 12, 2012
@@ -54,7 +54,7 @@ struct layer_pickle_suite : boost::python::pickle_suite
{
s.append(style_names[i]);
}
- return boost::python::make_tuple(l.clear_label_cache(),l.getMinZoom(),l.getMaxZoom(),l.isQueryable(),l.datasource()->params(),l.cache_features(),s);
+ return boost::python::make_tuple(l.clear_label_cache(),l.min_zoom(),l.max_zoom(),l.queryable(),l.datasource()->params(),l.cache_features(),s);
}
static void
@@ -72,11 +72,11 @@ struct layer_pickle_suite : boost::python::pickle_suite
l.set_clear_label_cache(extract<bool>(state[0]));
- l.setMinZoom(extract<double>(state[1]));
+ l.set_min_zoom(extract<double>(state[1]));
- l.setMaxZoom(extract<double>(state[2]));
+ l.set_max_zoom(extract<double>(state[2]));
- l.setQueryable(extract<bool>(state[3]));
+ l.set_queryable(extract<bool>(state[3]));
mapnik::parameters params = extract<parameters>(state[4]);
l.set_datasource(datasource_cache::instance()->create(params));
@@ -128,7 +128,7 @@ void export_layer()
"box2d(-1.0,-1.0,0.0,0.0) # default until a datasource is loaded\n"
)
- .def("visible", &layer::isVisible,
+ .def("visible", &layer::visible,
"Return True if this layer's data is active and visible at a given scale.\n"
"\n"
"Otherwise returns False.\n"
@@ -149,8 +149,8 @@ void export_layer()
)
.add_property("active",
- &layer::isActive,
- &layer::setActive,
+ &layer::active,
+ &layer::set_active,
"Get/Set whether this layer is active and will be rendered.\n"
"\n"
"Usage:\n"
@@ -199,8 +199,8 @@ void export_layer()
)
.add_property("maxzoom",
- &layer::getMaxZoom,
- &layer::setMaxZoom,
+ &layer::max_zoom,
+ &layer::set_max_zoom,
"Get/Set the maximum zoom lever of the layer.\n"
"\n"
"Usage:\n"
@@ -214,8 +214,8 @@ void export_layer()
)
.add_property("minzoom",
- &layer::getMinZoom,
- &layer::setMinZoom,
+ &layer::min_zoom,
+ &layer::set_min_zoom,
"Get/Set the minimum zoom lever of the layer.\n"
"\n"
"Usage:\n"
@@ -244,8 +244,8 @@ void export_layer()
)
.add_property("queryable",
- &layer::isQueryable,
- &layer::setQueryable,
+ &layer::queryable,
+ &layer::set_queryable,
"Get/Set whether this layer is queryable.\n"
"\n"
"Usage:\n"
@@ -49,7 +49,7 @@ QVariant LayerListModel::data(QModelIndex const& index,int role) const
else if (role == Qt::DecorationRole)
{
double scale = map_->scale();
- if (map_->layers().at(index.row()).isVisible(scale))
+ if (map_->layers().at(index.row()).visible(scale))
{
return QIcon(":/images/globe.png");
}
@@ -60,7 +60,7 @@ QVariant LayerListModel::data(QModelIndex const& index,int role) const
}
else if (role == Qt::CheckStateRole)
{
- if (map_->layers().at(index.row()).isActive())
+ if (map_->layers().at(index.row()).active())
return QVariant(Qt::Checked);
else
return QVariant(Qt::Unchecked);
@@ -92,7 +92,7 @@ bool LayerListModel::setData(const QModelIndex &index,
{
int status = value.toInt();
std::vector<mapnik::layer> & layers = const_cast<std::vector<mapnik::layer>& >(map_->layers());
- layers.at(index.row()).setActive(status);
+ layers.at(index.row()).set_active(status);
emit dataChanged(index, index);
return true;
}
@@ -157,7 +157,7 @@ void MapWidget::mousePressEvent(QMouseEvent* e)
if (int(index) != selectedLayer_) continue;
layer & layer = map_->layers()[index];
- if (!layer.isVisible(scale_denom)) continue;
+ if (!layer.visible(scale_denom)) continue;
std::string name = layer.name();
double x = e->x();
double y = e->y();
View
@@ -88,44 +88,44 @@ class MAPNIK_DECL layer
std::vector<std::string>& styles();
/*!
- * @param maxZoom The minimum zoom level to set
+ * @param max_zoom The minimum zoom level to set
*/
- void setMinZoom(double minZoom);
+ void set_min_zoom(double min_zoom);
/*!
- * @param maxZoom The maximum zoom level to set
+ * @param max_zoom The maximum zoom level to set
*/
- void setMaxZoom(double maxZoom);
+ void set_max_zoom(double max_zoom);
/*!
* @return the minimum zoom level of the layer.
*/
- double getMinZoom() const;
+ double min_zoom() const;
/*!
* @return the maximum zoom level of the layer.
*/
- double getMaxZoom() const;
+ double max_zoom() const;
/*!
* @brief Set whether this layer is active and will be rendered.
*/
- void setActive(bool active);
+ void set_active(bool active);
/*!
* @return whether this layer is active and will be rendered.
*/
- bool isActive() const;
+ bool active() const;
/*!
* @brief Set whether this layer is queryable.
*/
- void setQueryable(bool queryable);
+ void set_queryable(bool queryable);
/*!
* @return whether this layer is queryable or not.
*/
- bool isQueryable() const;
+ bool queryable() const;
/*!
* @brief Get the visability for a specific scale.
@@ -139,7 +139,7 @@ class MAPNIK_DECL layer
* or
* scale < maxzoom + 1e-6
*/
- bool isVisible(double scale) const;
+ bool visible(double scale) const;
/*!
* @param clear_cache Set whether this layer's labels are cached.
@@ -195,8 +195,8 @@ class MAPNIK_DECL layer
std::string name_;
std::string srs_;
- double minZoom_;
- double maxZoom_;
+ double min_zoom_;
+ double max_zoom_;
bool active_;
bool queryable_;
bool clear_label_cache_;
@@ -112,7 +112,7 @@ void feature_style_processor<Processor>::apply()
BOOST_FOREACH ( layer const& lyr, m_.layers() )
{
- if (lyr.isVisible(scale_denom))
+ if (lyr.visible(scale_denom))
{
std::set<std::string> names;
apply_to_layer(lyr, p, proj, scale_denom, names);
@@ -146,7 +146,7 @@ void feature_style_processor<Processor>::apply(mapnik::layer const& lyr, std::se
double scale_denom = mapnik::scale_denominator(m_,proj.is_geographic());
scale_denom *= scale_factor_;
- if (lyr.isVisible(scale_denom))
+ if (lyr.visible(scale_denom))
{
apply_to_layer(lyr, p, proj, scale_denom, names);
}
View
@@ -38,8 +38,8 @@ namespace mapnik
layer::layer(std::string const& name, std::string const& srs)
: name_(name),
srs_(srs),
- minZoom_(0),
- maxZoom_(std::numeric_limits<double>::max()),
+ min_zoom_(0),
+ max_zoom_(std::numeric_limits<double>::max()),
active_(true),
queryable_(false),
clear_label_cache_(false),
@@ -50,8 +50,8 @@ layer::layer(std::string const& name, std::string const& srs)
layer::layer(const layer& rhs)
: name_(rhs.name_),
srs_(rhs.srs_),
- minZoom_(rhs.minZoom_),
- maxZoom_(rhs.maxZoom_),
+ min_zoom_(rhs.min_zoom_),
+ max_zoom_(rhs.max_zoom_),
active_(rhs.active_),
queryable_(rhs.queryable_),
clear_label_cache_(rhs.clear_label_cache_),
@@ -76,8 +76,8 @@ void layer::swap(const layer& rhs)
{
name_=rhs.name_;
srs_ = rhs.srs_;
- minZoom_=rhs.minZoom_;
- maxZoom_=rhs.maxZoom_;
+ min_zoom_=rhs.min_zoom_;
+ max_zoom_=rhs.max_zoom_;
active_=rhs.active_;
queryable_=rhs.queryable_;
clear_label_cache_ = rhs.clear_label_cache_;
@@ -124,47 +124,47 @@ std::vector<std::string> & layer::styles()
return styles_;
}
-void layer::setMinZoom(double minZoom)
+void layer::set_min_zoom(double min_zoom)
{
- minZoom_=minZoom;
+ min_zoom_=min_zoom;
}
-void layer::setMaxZoom(double maxZoom)
+void layer::set_max_zoom(double max_zoom)
{
- maxZoom_=maxZoom;
+ max_zoom_=max_zoom;
}
-double layer::getMinZoom() const
+double layer::min_zoom() const
{
- return minZoom_;
+ return min_zoom_;
}
-double layer::getMaxZoom() const
+double layer::max_zoom() const
{
- return maxZoom_;
+ return max_zoom_;
}
-void layer::setActive(bool active)
+void layer::set_active(bool active)
{
active_=active;
}
-bool layer::isActive() const
+bool layer::active() const
{
return active_;
}
-bool layer::isVisible(double scale) const
+bool layer::visible(double scale) const
{
- return isActive() && scale >= minZoom_ - 1e-6 && scale < maxZoom_ + 1e-6;
+ return active() && scale >= min_zoom_ - 1e-6 && scale < max_zoom_ + 1e-6;
}
-void layer::setQueryable(bool queryable)
+void layer::set_queryable(bool queryable)
{
queryable_=queryable;
}
-bool layer::isQueryable() const
+bool layer::queryable() const
{
return queryable_;
}
View
@@ -678,25 +678,25 @@ void map_parser::parse_layer( Map & map, ptree const & lay )
optional<boolean> status = get_opt_attr<boolean>(lay, "status");
if (status)
{
- lyr.setActive( * status );
+ lyr.set_active( * status );
}
- optional<double> minZoom = get_opt_attr<double>(lay, "minzoom");
- if (minZoom)
+ optional<double> min_zoom = get_opt_attr<double>(lay, "minzoom");
+ if (min_zoom)
{
- lyr.setMinZoom( * minZoom );
+ lyr.set_min_zoom( * min_zoom );
}
- optional<double> maxZoom = get_opt_attr<double>(lay, "maxzoom");
- if (maxZoom)
+ optional<double> max_zoom = get_opt_attr<double>(lay, "maxzoom");
+ if (max_zoom)
{
- lyr.setMaxZoom( * maxZoom );
+ lyr.set_max_zoom( * max_zoom );
}
optional<boolean> queryable = get_opt_attr<boolean>(lay, "queryable");
if (queryable)
{
- lyr.setQueryable( * queryable );
+ lyr.set_queryable( * queryable );
}
optional<boolean> clear_cache =
View
@@ -399,7 +399,7 @@ void Map::zoom_all()
std::vector<layer>::const_iterator end = layers_.end();
while (itr != end)
{
- if (itr->isActive())
+ if (itr->active())
{
std::string const& layer_srs = itr->srs();
projection proj1(layer_srs);
View
@@ -631,29 +631,29 @@ void serialize_layer( ptree & map_node, const layer & layer, bool explicit_defau
set_attr( layer_node, "srs", layer.srs() );
}
- if ( !layer.isActive() || explicit_defaults )
+ if ( !layer.active() || explicit_defaults )
{
- set_attr/*<bool>*/( layer_node, "status", layer.isActive() );
+ set_attr/*<bool>*/( layer_node, "status", layer.active() );
}
if ( layer.clear_label_cache() || explicit_defaults )
{
set_attr/*<bool>*/( layer_node, "clear-label-cache", layer.clear_label_cache() );
}
- if ( layer.getMinZoom() )
+ if ( layer.min_zoom() )
{
- set_attr( layer_node, "minzoom", layer.getMinZoom() );
+ set_attr( layer_node, "minzoom", layer.min_zoom() );
}
- if ( layer.getMaxZoom() != std::numeric_limits<double>::max() )
+ if ( layer.max_zoom() != std::numeric_limits<double>::max() )
{
- set_attr( layer_node, "maxzoom", layer.getMaxZoom() );
+ set_attr( layer_node, "maxzoom", layer.max_zoom() );
}
- if ( layer.isQueryable() || explicit_defaults )
+ if ( layer.queryable() || explicit_defaults )
{
- set_attr( layer_node, "queryable", layer.isQueryable() );
+ set_attr( layer_node, "queryable", layer.queryable() );
}
if ( layer.cache_features() || explicit_defaults )

0 comments on commit 207ecfd

Please sign in to comment.