/***************************************************************************** * * 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 * *****************************************************************************/ #include #include #include #include #include "shape_featureset.hpp" #include "shape_index_featureset.hpp" #include "shape.hpp" DATASOURCE_PLUGIN(shape_datasource) shape_datasource::shape_datasource(const parameters ¶ms) : datasource (params) , shape_name_(params.get("file")), type_(datasource::Vector), file_length_(0), indexed_(false), desc_(params.get("name"),"utf-8") { try { std::string encoding = params.get("encoding"); if (encoding.length() > 0) desc_.set_encoding(encoding); shape_io shape(shape_name_); init(shape); for (int i=0;i0) { desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Double,false,8)); } else { desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Integer,false,4)); } break; } default: #ifdef MAPNIK_DEBUG std::clog << "unknown type "<