/* This file is part of Mapnik (c++ mapping toolkit) * Copyright (C) 2005 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "shp_index.hpp" #include "geom_util.hpp" template void shp_index::query(const filterT& filter,std::ifstream& file,std::set& pos) { file.seekg(16,std::ios::beg); query_node(filter,file,pos); } template void shp_index::query_node(const filterT& filter,std::ifstream& file,std::set& ids) { int offset=read_ndr_integer(file); Envelope node_ext; read_envelope(file,node_ext); int num_shapes=read_ndr_integer(file); if (!filter.pass(node_ext)) { file.seekg(offset+num_shapes*4+4,std::ios::cur); return; } for (int i=0;i int shp_index::read_ndr_integer(std::ifstream& file) { char b[4]; file.read(b,4); return (b[0]&0xff) | (b[1]&0xff)<<8 | (b[2]&0xff)<<16 | (b[3]&0xff)<<24; } template void shp_index::read_envelope(std::ifstream& file,Envelope& envelope) { file.read(reinterpret_cast(&envelope),sizeof(envelope)); } template class shp_index; template class shp_index;