Skip to content
Browse files

tagging release 0.3.0

  • Loading branch information...
2 parents 8154e21 + 1107927 commit 3ae046ebe23194a5a95f9d8b44b9a29acd74d987 @artemp artemp committed May 22, 2006
View
3 bindings/python/mapnik/ogcserver/cgiserver.py
@@ -73,7 +73,8 @@ def process(self, req):
raise OGCException('Unsupported service "%s".' % service)
ServiceHandlerFactory = getattr(mapnikmodule.ogcserver, service).ServiceHandlerFactory
servicehandler = ServiceHandlerFactory(self.conf, self.mapfactory, onlineresource, reqparams.get('version', None))
- del reqparams['version']
+ if reqparams.has_key('version'):
+ del reqparams['version']
if request not in servicehandler.SERVICE_PARAMS.keys():
raise OGCException('Operation "%s" not supported.' % request, 'OperationNotSupported')
ogcparams = servicehandler.processParameters(request, reqparams)
View
3 bindings/python/mapnik/ogcserver/common.py
@@ -81,9 +81,6 @@ class BaseServiceHandler:
def processParameters(self, requestname, params):
finalparams = {}
- for paramname in params.keys():
- if paramname not in self.SERVICE_PARAMS[requestname].keys():
- raise OGCException('Unknown request parameter "%s".' % paramname)
for paramname, paramdef in self.SERVICE_PARAMS[requestname].items():
if paramname not in params.keys() and paramdef.mandatory:
raise OGCException('Mandatory parameter "%s" missing from request.' % paramname)
View
11 bindings/python/mapnik/ogcserver/wms111.py
@@ -144,8 +144,6 @@ def __init__(self, conf, mapfactory, opsonlineresource):
for layer in self.mapfactory.layers.values():
layername = ElementTree.Element('Name')
layername.text = layer.name()
- layertitle = ElementTree.Element('Title')
- layertitle.text = layer.name()
env = layer.envelope()
llp = self.crs.Inverse(env.minx, env.miny)
urp = self.crs.Inverse(env.maxx, env.maxy)
@@ -162,7 +160,14 @@ def __init__(self, conf, mapfactory, opsonlineresource):
layerbbox.set('maxy', str(env.maxy))
layere = ElementTree.Element('Layer')
layere.append(layername)
- layere.append(layertitle)
+ if layer.title():
+ layertitle = ElementTree.Element('Title')
+ layertitle.text = layer.title()
+ layere.append(layertitle)
+ if layer.abstract():
+ layerabstract = ElementTree.Element('Abstract')
+ layerabstract.text = layer.abstract()
+ layere.append(layerabstract)
layere.append(latlonbb)
layere.append(layerbbox)
if len(layer.wmsextrastyles) > 0:
View
11 bindings/python/mapnik/ogcserver/wms130.py
@@ -150,8 +150,6 @@ def __init__(self, conf, mapfactory, opsonlineresource):
for layer in self.mapfactory.layers.values():
layername = ElementTree.Element('Name')
layername.text = layer.name()
- layertitle = ElementTree.Element('Title')
- layertitle.text = layer.name()
env = layer.envelope()
layerexgbb = ElementTree.Element('EX_GeographicBoundingBox')
ll = self.crs.Inverse(env.minx, env.miny)
@@ -176,7 +174,14 @@ def __init__(self, conf, mapfactory, opsonlineresource):
layerbbox.set('maxy', str(env.maxy))
layere = ElementTree.Element('Layer')
layere.append(layername)
- layere.append(layertitle)
+ if layer.title():
+ layertitle = ElementTree.Element('Title')
+ layertitle.text = layer.title()
+ layere.append(layertitle)
+ if layer.abstract():
+ layerabstract = ElementTree.Element('Abstract')
+ layerabstract.text = layer.abstract()
+ layere.append(layerabstract)
layere.append(layerexgbb)
layere.append(layerbbox)
if len(layer.wmsextrastyles) > 0:
View
2 bindings/python/mapnik_layer.cpp
@@ -109,6 +109,8 @@ void export_layer()
class_<Layer>("Layer","A map layer.",no_init)
.def("name",&Layer::name,return_value_policy<copy_const_reference>(), "Return the name of the layer.")
+ .def("title",&Layer::title,return_value_policy<copy_const_reference>(), "Return the title of the layer.")
+ .def("abstract",&Layer::abstract,return_value_policy<copy_const_reference>(), "Return the abstract of the layer.")
.def("params",&Layer::params,return_value_policy<reference_existing_object>(), "The configuration parameters of the layer. These vary depending on the type of data source.")
.def("envelope",&Layer::envelope, "Return the geographic envelope/bounding box of the data in the layer.")
.add_property("minzoom",&Layer::getMinZoom,&Layer::setMinZoom)
View
5 docs/ogcserver/readme.txt
@@ -100,7 +100,7 @@ class WMSFactory(BaseWMSFactory):
...
self.register_style('stylename', sty)
- lyr = Layer(name='layername')
+ lyr = Layer(name='layername', title='Highways', abstract='Highways')
...
lyr.styles.append('stylename')
self.register_layer(lyr)
@@ -114,6 +114,8 @@ The rules for writing this class are:
- Layers MUST be named with the 'name' parameter to the constructor.
- style and layer names are meant for machine readability, not human. Keep
them short and simple, without spaces or special characters.
+- For human readable info, pass title='' and abstract='' parameters to the
+ Layer() call.
- The layers must have at least one style associated with them (a default).
- No Map() object is used or needed here.
- Be sure to call self.finalize() once you've registered everything! This will
@@ -127,7 +129,6 @@ To Do
- Named style support.
- Improve configuration to allow for full server metadata.
-- Add support for richer layer metadata.
- Investigate moving to cElementTree from lxml.
- Add some internal "caching" for performance improvements.
- Support GetFeatureInfo (Requires core changes).
View
160 include/image_data.hpp
@@ -32,93 +32,93 @@ namespace mapnik
template <class T> class ImageData
{
private:
- const unsigned width_;
- const unsigned height_;
- T *pData_;
- ImageData& operator=(const ImageData&);
+ const unsigned width_;
+ const unsigned height_;
+ T *pData_;
+ ImageData& operator=(const ImageData&);
public:
- ImageData(unsigned width,unsigned height)
- : width_(width),
- height_(height),
- pData_((width!=0 && height!=0)? static_cast<T*>(::operator new(sizeof(T)*width*height)):0)
- {
- if (pData_) memset(pData_,0,sizeof(T)*width_*height_);
- }
+ ImageData(unsigned width,unsigned height)
+ : width_(width),
+ height_(height),
+ pData_((width!=0 && height!=0)? static_cast<T*>(::operator new(sizeof(T)*width*height)):0)
+ {
+ if (pData_) memset(pData_,0,sizeof(T)*width_*height_);
+ }
- ImageData(const ImageData<T>& rhs)
- :width_(rhs.width_),
- height_(rhs.height_),
- pData_((rhs.width_!=0 && rhs.height_!=0)? new T[rhs.width_*rhs.height_]:0)
- {
- if (pData_) memcpy(pData_,rhs.pData_,sizeof(T)*rhs.width_* rhs.height_);
- }
- inline T& operator() (unsigned i,unsigned j)
- {
- assert(i<width_ && j<height_);
- return pData_[j*width_+i];
- }
- inline const T& operator() (unsigned i,unsigned j) const
- {
- assert(i<width_ && j<height_);
- return pData_[j*width_+i];
- }
- inline unsigned width() const
- {
- return width_;
- }
- inline unsigned height() const
- {
- return height_;
- }
- inline void set(const T& t)
- {
- for (unsigned i=0;i<width_;++i)
- {
- for (unsigned j=0;j<height_;++j)
- {
- (*this)(i,j)=t;
- }
- }
- }
- inline const T* getData() const
- {
- return pData_;
- }
+ ImageData(const ImageData<T>& rhs)
+ :width_(rhs.width_),
+ height_(rhs.height_),
+ pData_((rhs.width_!=0 && rhs.height_!=0)? new T[rhs.width_*rhs.height_]:0)
+ {
+ if (pData_) memcpy(pData_,rhs.pData_,sizeof(T)*rhs.width_* rhs.height_);
+ }
+ inline T& operator() (unsigned i,unsigned j)
+ {
+ assert(i<width_ && j<height_);
+ return pData_[j*width_+i];
+ }
+ inline const T& operator() (unsigned i,unsigned j) const
+ {
+ assert(i<width_ && j<height_);
+ return pData_[j*width_+i];
+ }
+ inline unsigned width() const
+ {
+ return width_;
+ }
+ inline unsigned height() const
+ {
+ return height_;
+ }
+ inline void set(const T& t)
+ {
+ for (unsigned i=0;i<width_;++i)
+ {
+ for (unsigned j=0;j<height_;++j)
+ {
+ (*this)(i,j)=t;
+ }
+ }
+ }
+ inline const T* getData() const
+ {
+ return pData_;
+ }
- inline T* getData()
- {
- return pData_;
- }
+ inline T* getData()
+ {
+ return pData_;
+ }
- inline const unsigned char* getBytes() const
- {
- return (unsigned char*)pData_;
- }
+ inline const unsigned char* getBytes() const
+ {
+ return (unsigned char*)pData_;
+ }
- inline unsigned char* getBytes()
- {
- return (unsigned char*)pData_;
- }
+ inline unsigned char* getBytes()
+ {
+ return (unsigned char*)pData_;
+ }
- inline const T* getRow(unsigned row) const
- {
- return pData_+row*width_;
- }
- inline void setRow(unsigned row,const T* buf,unsigned size)
- {
- assert(row<height_);
- assert(size<=(width_*sizeof(T)));
- memcpy(pData_+row*width_,buf,size*sizeof(T));
- }
- inline void setRow(unsigned row,unsigned x0,unsigned x1,const T* buf)
- {
- memcpy(pData_+row*width_+x0,buf,(x1-x0)*sizeof(T));
- }
+ inline const T* getRow(unsigned row) const
+ {
+ return pData_+row*width_;
+ }
+ inline void setRow(unsigned row,const T* buf,unsigned size)
+ {
+ assert(row<height_);
+ assert(size<=(width_*sizeof(T)));
+ memcpy(pData_+row*width_,buf,size*sizeof(T));
+ }
+ inline void setRow(unsigned row,unsigned x0,unsigned x1,const T* buf)
+ {
+ memcpy(pData_+row*width_+x0,buf,(x1-x0)*sizeof(T));
+ }
- inline ~ImageData()
- {
- ::operator delete(pData_),pData_=0;
- }
+ inline ~ImageData()
+ {
+ ::operator delete(pData_),pData_=0;
+ }
};
View
8 include/layer.hpp
@@ -39,6 +39,8 @@ namespace mapnik
void serialize(Archive & ar, const unsigned int /*version*/)
{
ar & boost::serialization::make_nvp("name",name_)
+ & boost::serialization::make_nvp("title",title_)
+ & boost::serialization::make_nvp("abstract",abstract_)
& boost::serialization::make_nvp("params",params_)
& boost::serialization::make_nvp("min_zoom",minZoom_)
& boost::serialization::make_nvp("max_zoom",maxZoom_)
@@ -49,6 +51,8 @@ namespace mapnik
}
parameters params_;
std::string name_;
+ std::string title_;
+ std::string abstract_;
double minZoom_;
double maxZoom_;
bool active_;
@@ -69,6 +73,10 @@ namespace mapnik
parameters const& params() const;
void set_name(std::string const& name);
const std::string& name() const;
+ void set_title(std::string const& title);
+ const std::string& title() const;
+ void set_abstract(std::string const& abstract);
+ const std::string& abstract() const;
void add_style(std::string const& stylename);
std::vector<std::string> const& styles() const;
void selection_style(const std::string& name);
View
1 include/point_symbolizer.hpp
@@ -31,6 +31,7 @@ namespace mapnik
{
struct MAPNIK_DECL point_symbolizer
{
+ explicit point_symbolizer();
point_symbolizer(std::string const& file,
std::string const& type,
unsigned width,unsigned height);
View
28 src/layer.cpp
@@ -37,6 +37,8 @@ namespace mapnik
Layer::Layer()
: params_(),
name_("unknown"),
+ title_(""),
+ abstract_(""),
minZoom_(0),
maxZoom_(std::numeric_limits<double>::max()),
active_(true),
@@ -47,6 +49,8 @@ namespace mapnik
Layer::Layer(const parameters& params)
:params_(params),
name_(params_["name"]),
+ title_(params_["title"]),
+ abstract_(params_["abstract"]),
minZoom_(0),
maxZoom_(std::numeric_limits<double>::max()),
active_(true),
@@ -57,6 +61,8 @@ namespace mapnik
Layer::Layer(const Layer& rhs)
:params_(rhs.params_),
name_(rhs.name_),
+ title_(rhs.title_),
+ abstract_(rhs.abstract_),
minZoom_(rhs.minZoom_),
maxZoom_(rhs.maxZoom_),
active_(rhs.active_),
@@ -81,6 +87,8 @@ namespace mapnik
{
params_=rhs.params_;
name_=rhs.name_;
+ title_=rhs.title_;
+ abstract_=rhs.abstract_;
minZoom_=rhs.minZoom_;
maxZoom_=rhs.maxZoom_;
active_=rhs.active_;
@@ -107,6 +115,26 @@ namespace mapnik
return name_;
}
+ void Layer::set_title( std::string const& title)
+ {
+ title_ = title;
+ }
+
+ string const& Layer::title() const
+ {
+ return title_;
+ }
+
+ void Layer::set_abstract( std::string const& abstract)
+ {
+ abstract_ = abstract;
+ }
+
+ string const& Layer::abstract() const
+ {
+ return abstract_;
+ }
+
void Layer::add_style(std::string const& stylename)
{
styles_.push_back(stylename);
View
42 src/point_symbolizer.cpp
@@ -22,38 +22,46 @@
//$Id$
+#include <boost/scoped_ptr.hpp>
#include "point_symbolizer.hpp"
#include "image_data.hpp"
#include "image_reader.hpp"
namespace mapnik
{
+ point_symbolizer::point_symbolizer()
+ : symbol_(new ImageData32(4,4))
+ {
+ //default point symbol is black 4x4px square
+ symbol_->set(0xff000000);
+ }
+
point_symbolizer::point_symbolizer(std::string const& file,
- std::string const& type,
- unsigned width,unsigned height)
- : symbol_(new ImageData32(width,height))
+ std::string const& type,
+ unsigned width,unsigned height)
+ : symbol_(new ImageData32(width,height))
{
- try
- {
- std::auto_ptr<ImageReader> reader(get_image_reader(type,file));
- if (reader.get())
- {
- reader->read(0,0,*symbol_);
- }
- }
- catch (...)
- {
- std::clog<<"exception caught..." << std::endl;
- }
+ try
+ {
+ boost::scoped_ptr<ImageReader> reader(get_image_reader(type,file));
+ if (reader.get())
+ {
+ reader->read(0,0,*symbol_);
+ }
+ }
+ catch (...)
+ {
+ std::clog<<"exception caught..." << std::endl;
+ }
}
point_symbolizer::point_symbolizer(point_symbolizer const& rhs)
- : symbol_(rhs.symbol_)
+ : symbol_(rhs.symbol_)
{}
ImageData32 const& point_symbolizer::get_data() const
{
- return *(symbol_.get());
+ return *(symbol_.get());
}
}

0 comments on commit 3ae046e

Please sign in to comment.
Something went wrong with that request. Please try again.