- added new et input plugin
- add missing files to plugins Makefile.am - split debugging and tracing - documentation
This commit is contained in:
parent
570fe611f4
commit
cab469eefb
18 changed files with 728 additions and 31 deletions
18
configure.ac
18
configure.ac
|
@ -26,7 +26,7 @@ AC_ARG_ENABLE(debug,
|
|||
|
||||
if [ ! test "x$enable_debug" != "xyes"]; then
|
||||
AC_DEFINE(DEBUG, 1, [Define to enable debug build])
|
||||
CXXFLAGS="-ggdb -O0 -DDEBUG -DMAPNIK_DEBUG"
|
||||
CXXFLAGS="-ggdb -O0 -DDEBUG"
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
CXXFLAGS="-O3"
|
||||
|
@ -42,12 +42,25 @@ AC_ARG_ENABLE(profiling,
|
|||
|
||||
if [ ! test "x$enable_profiling" != "xyes"]; then
|
||||
AC_DEFINE(PROFILING, 1, [Define to enable profiling build])
|
||||
#PKG_CHECK_MODULES(PROFILING, StopClock >= 0.1)
|
||||
PROFILING_CFLAGS="$PROFILING_CFLAGS -pg"
|
||||
AC_SUBST(PROFILING_CFLAGS)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
dnl Check for option to enable tracing
|
||||
AC_MSG_CHECKING(whether to enable tracing)
|
||||
AC_ARG_ENABLE(tracing,
|
||||
[ --enable-tracing=[no/yes] enables tracing build (default=no)],,
|
||||
enable_tracing=no)
|
||||
|
||||
if [ ! test "x$enable_tracing" != "xyes"]; then
|
||||
TRACING_CFLAGS="-DMAPNIK_DEBUG"
|
||||
AC_SUBST(TRACING_CFLAGS)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
dnl Check for boost
|
||||
AX_BOOST_BASE
|
||||
|
@ -224,6 +237,7 @@ plugins/input/shape/Makefile
|
|||
plugins/input/osm/Makefile
|
||||
plugins/input/ogr/Makefile
|
||||
plugins/input/sqlite/Makefile
|
||||
plugins/input/kismet/Makefile
|
||||
src/Makefile
|
||||
mapnik.pc
|
||||
mapnik-uninstalled.pc
|
||||
|
|
|
@ -31,6 +31,18 @@
|
|||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
/*!
|
||||
* From wikipedia.com:
|
||||
*
|
||||
* Well-known text (WKT) is a text markup language for representing vector
|
||||
* geometry objects on a map, spatial reference systems of spatial objects
|
||||
* and transformations between spatial reference systems. A binary equivalent,
|
||||
* known as well-known binary (WKB) is used to transfer and store the same
|
||||
* information on databases, such as PostGIS. The formats are regulated by
|
||||
* the Open Geospatial Consortium (OGC) and described in their Simple Feature
|
||||
* Access and Coordinate Transformation Service specifications.
|
||||
*/
|
||||
enum wkbFormat
|
||||
{
|
||||
wkbGeneric=1,
|
||||
|
|
|
@ -6,6 +6,7 @@ SUBDIRS = \
|
|||
raster \
|
||||
shape \
|
||||
osm \
|
||||
sqlite
|
||||
sqlite \
|
||||
kismet
|
||||
|
||||
## File created by the gnome-build tools
|
||||
|
|
|
@ -5,12 +5,17 @@ pkglib_LTLIBRARIES = \
|
|||
|
||||
gdal_la_SOURCES = \
|
||||
gdal_datasource.cpp\
|
||||
gdal_featureset.cpp
|
||||
gdal_datasource.hpp\
|
||||
gdal_featureset.cpp\
|
||||
gdal_featureset.hpp
|
||||
|
||||
gdal_la_LIBADD = \
|
||||
${GDAL_LDFLAGS}
|
||||
|
||||
gdal_la_CXXFLAGS = \
|
||||
-Wall \
|
||||
${PROFILING_CFLAGS} \
|
||||
${TRACING_CFLAGS} \
|
||||
${GDAL_CFLAGS} \
|
||||
-I../../../include
|
||||
|
||||
|
|
30
plugins/input/kismet/Makefile.am
Normal file
30
plugins/input/kismet/Makefile.am
Normal file
|
@ -0,0 +1,30 @@
|
|||
if HAVE_SQLITE3
|
||||
|
||||
pkglib_LTLIBRARIES = \
|
||||
kismet.la
|
||||
|
||||
kismet_la_SOURCES = \
|
||||
kismet_datasource.cpp\
|
||||
kismet_datasource.hpp\
|
||||
kismet_featureset.cpp\
|
||||
kismet_featureset.hpp\
|
||||
kismet_types.hpp
|
||||
|
||||
kismet_la_LIBADD = \
|
||||
${SQLITE3_LDFLAGS}
|
||||
|
||||
kismet_la_CXXFLAGS = \
|
||||
-Wall \
|
||||
${PROFILING_CFLAGS} \
|
||||
${TRACING_CFLAGS} \
|
||||
${SQLITE3_CFLAGS} \
|
||||
-I../../../include
|
||||
|
||||
kismet_la_LDFLAGS = \
|
||||
-module \
|
||||
-avoid-version \
|
||||
-shrext .input
|
||||
|
||||
endif
|
||||
|
||||
## File created by the gnome-build tools
|
302
plugins/input/kismet/kismet_datasource.cpp
Normal file
302
plugins/input/kismet/kismet_datasource.cpp
Normal file
|
@ -0,0 +1,302 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2007 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$
|
||||
|
||||
#include "kismet_datasource.hpp"
|
||||
#include "kismet_featureset.hpp"
|
||||
|
||||
// network
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/ptree_helpers.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/tokenizer.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#define MAX_TCP_BUFFER 4096 // maximum accepted TCP data block size
|
||||
|
||||
// If you change this also change the according sscanf line!
|
||||
#define MAX_KISMET_LINE 1024 // maximum length of a kismet command (assumed)
|
||||
|
||||
using boost::lexical_cast;
|
||||
using boost::bad_lexical_cast;
|
||||
|
||||
using mapnik::datasource;
|
||||
using mapnik::parameters;
|
||||
|
||||
DATASOURCE_PLUGIN(kismet_datasource)
|
||||
|
||||
using mapnik::Envelope;
|
||||
using mapnik::coord2d;
|
||||
using mapnik::query;
|
||||
using mapnik::featureset_ptr;
|
||||
using mapnik::layer_descriptor;
|
||||
using mapnik::attribute_descriptor;
|
||||
using mapnik::datasource_exception;
|
||||
|
||||
using namespace std;
|
||||
|
||||
boost::mutex knd_list_mutex;
|
||||
std::list<kismet_network_data> knd_list;
|
||||
const unsigned int queue_size = 20;
|
||||
|
||||
kismet_datasource::kismet_datasource(parameters const& params)
|
||||
: datasource(params),
|
||||
extent_(),
|
||||
extent_initialized_(false),
|
||||
type_(datasource::Vector),
|
||||
desc_(*params.get<std::string>("type"),
|
||||
*params.get<std::string>("encoding","utf-8"))
|
||||
{
|
||||
cout << "kismet_datasource::kismet_datasource()" << endl;
|
||||
|
||||
boost::optional<std::string> host = params.get<std::string>("host");
|
||||
if (!host) throw datasource_exception("missing <host> paramater");
|
||||
|
||||
boost::optional<std::string> port = params.get<std::string>("port");
|
||||
if (!port) throw datasource_exception("missing <port> paramater");
|
||||
|
||||
unsigned int portnr = atoi ((*port).c_str () );
|
||||
kismet_thread.reset (new boost::thread (boost::bind (&kismet_datasource::run, this, *host, portnr)));
|
||||
|
||||
boost::optional<std::string> ext = params_.get<std::string>("extent");
|
||||
if (ext)
|
||||
{
|
||||
boost::char_separator<char> sep(",");
|
||||
boost::tokenizer<boost::char_separator<char> > tok(*ext,sep);
|
||||
unsigned i = 0;
|
||||
bool success = false;
|
||||
double d[4];
|
||||
for (boost::tokenizer<boost::char_separator<char> >::iterator beg=tok.begin();
|
||||
beg!=tok.end();++beg)
|
||||
{
|
||||
try
|
||||
{
|
||||
d[i] = boost::lexical_cast<double>(*beg);
|
||||
}
|
||||
catch (boost::bad_lexical_cast & ex)
|
||||
{
|
||||
std::clog << ex.what() << "\n";
|
||||
break;
|
||||
}
|
||||
if (i==3)
|
||||
{
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
if (success)
|
||||
{
|
||||
extent_.init(d[0],d[1],d[2],d[3]);
|
||||
extent_initialized_ = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
kismet_datasource::~kismet_datasource()
|
||||
{
|
||||
}
|
||||
|
||||
std::string const kismet_datasource::name_="kismet";
|
||||
|
||||
std::string kismet_datasource::name()
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
int kismet_datasource::type() const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
Envelope<double> kismet_datasource::envelope() const
|
||||
{
|
||||
cout << "kismet_datasource::envelope()" << endl;
|
||||
return extent_;
|
||||
}
|
||||
|
||||
layer_descriptor kismet_datasource::get_descriptor() const
|
||||
{
|
||||
return desc_;
|
||||
}
|
||||
|
||||
featureset_ptr kismet_datasource::features(query const& q) const
|
||||
{
|
||||
cout << "kismet_datasource::features()" << endl;
|
||||
|
||||
// TODO: use Envelope to filter bbox before adding to featureset_ptr
|
||||
mapnik::Envelope<double> const& e = q.get_bbox();
|
||||
|
||||
boost::mutex::scoped_lock lock(knd_list_mutex);
|
||||
return featureset_ptr (new kismet_featureset(knd_list, desc_.get_encoding()));
|
||||
|
||||
// TODO: if illegal:
|
||||
// return featureset_ptr();
|
||||
}
|
||||
|
||||
featureset_ptr kismet_datasource::features_at_point(coord2d const& pt) const
|
||||
{
|
||||
cout << "kismet_datasource::features_at_point()" << endl;
|
||||
|
||||
#if 0
|
||||
if (dataset_ && layer_)
|
||||
{
|
||||
OGRPoint point;
|
||||
point.setX (pt.x);
|
||||
point.setY (pt.y);
|
||||
|
||||
layer_->SetSpatialFilter (&point);
|
||||
|
||||
return featureset_ptr(new ogr_featureset(*dataset_, *layer_, desc_.get_encoding()));
|
||||
}
|
||||
#endif
|
||||
|
||||
return featureset_ptr();
|
||||
}
|
||||
|
||||
void kismet_datasource::run (const std::string &ip_host, const unsigned int port)
|
||||
{
|
||||
cout << "+run" << endl;
|
||||
|
||||
int sockfd, n;
|
||||
struct sockaddr_in sock_addr;
|
||||
struct in_addr inadr;
|
||||
struct hostent *host;
|
||||
char buffer[MAX_TCP_BUFFER]; // TCP data send from kismet_server
|
||||
string command;
|
||||
|
||||
if (inet_aton(ip_host.c_str (), &inadr))
|
||||
{
|
||||
host = gethostbyaddr((char *) &inadr, sizeof(inadr), AF_INET);
|
||||
}
|
||||
else
|
||||
{
|
||||
host = gethostbyname(ip_host.c_str ());
|
||||
}
|
||||
|
||||
if (host == NULL)
|
||||
{
|
||||
herror ("Error while searching host");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
sock_addr.sin_family = AF_INET;
|
||||
sock_addr.sin_port = htons(port);
|
||||
memcpy(&sock_addr.sin_addr, host->h_addr_list[0],
|
||||
sizeof(sock_addr.sin_addr));
|
||||
|
||||
if ( (sockfd = socket(PF_INET, SOCK_STREAM, 0)) < 0)
|
||||
{
|
||||
cerr << "Error while creating socket" << endl;
|
||||
}
|
||||
|
||||
if (connect(sockfd, (struct sockaddr *) &sock_addr, sizeof(sock_addr)))
|
||||
{
|
||||
cerr << "Error while connecting" << endl;
|
||||
}
|
||||
|
||||
command = "!1 ENABLE NETWORK ssid,bssid,bestlat,bestlon\n";
|
||||
|
||||
if (write(sockfd, command.c_str (), command.length ()) != (signed) command.length ())
|
||||
{
|
||||
cerr << "Error sending command to " << ip_host << endl;
|
||||
close(sockfd);
|
||||
// TODO: what to do now?
|
||||
}
|
||||
|
||||
char ssid[MAX_KISMET_LINE] = {};
|
||||
char bssid[MAX_KISMET_LINE] = {};
|
||||
double bestlat = 0;
|
||||
double bestlon = 0;
|
||||
|
||||
while ( (n = read(sockfd, buffer, sizeof(buffer))) > 0)
|
||||
{
|
||||
assert (n < MAX_TCP_BUFFER);
|
||||
|
||||
buffer[n] = '\0';
|
||||
string bufferObj (buffer); // TCP data send from kismet_server as STL string
|
||||
|
||||
//cout << "BufferObj: " << endl << bufferObj << "[END]" << endl;
|
||||
|
||||
string::size_type found = 0;
|
||||
string::size_type search_start = 0;
|
||||
string kismet_line; // contains a line from kismet_server
|
||||
do
|
||||
{
|
||||
found = bufferObj.find ('\n', search_start);
|
||||
if (found != string::npos)
|
||||
{
|
||||
kismet_line.assign (bufferObj, search_start, found - search_start);
|
||||
|
||||
//cout << "Line: " << kismet_line << "[ENDL]" << endl;
|
||||
|
||||
int param_number = 4; // the number of parameters to parse
|
||||
|
||||
// Attention: string length specified to the constant!
|
||||
if (sscanf (kismet_line.c_str (), "*NETWORK: \001%1024[^\001]\001 %1024s %lf %lf", ssid, bssid, &bestlat, &bestlon) == param_number)
|
||||
{
|
||||
//printf ("ssid=%s, bssid=%s, bestlat=%f, bestlon=%f\n", ssid, bssid, bestlat, bestlon);
|
||||
|
||||
kismet_network_data knd (ssid, bssid, bestlat, bestlon);
|
||||
|
||||
boost::mutex::scoped_lock lock(knd_list_mutex);
|
||||
|
||||
// the queue only grows to a max size
|
||||
if (knd_list.size () >= queue_size)
|
||||
{
|
||||
knd_list.pop_front ();
|
||||
}
|
||||
|
||||
knd_list.push_back (knd);
|
||||
}
|
||||
else
|
||||
{
|
||||
// do nothing if not matched!
|
||||
}
|
||||
|
||||
search_start = found + 1;
|
||||
}
|
||||
}
|
||||
while (found != string::npos);
|
||||
}
|
||||
|
||||
if (n < 0)
|
||||
{
|
||||
cerr << "Error while reading from socket" << endl;
|
||||
}
|
||||
|
||||
close(sockfd);
|
||||
|
||||
cout << "-run" << endl;
|
||||
}
|
68
plugins/input/kismet/kismet_datasource.hpp
Normal file
68
plugins/input/kismet/kismet_datasource.hpp
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2007 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$
|
||||
|
||||
#ifndef KISMET_DATASOURCE_HPP
|
||||
#define KISMET_DATASOURCE_HPP
|
||||
|
||||
// STL
|
||||
#include <list>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/datasource.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/feature_layer_desc.hpp>
|
||||
#include <mapnik/wkb.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
// sqlite
|
||||
#include "kismet_types.hpp"
|
||||
|
||||
class kismet_datasource : public mapnik::datasource
|
||||
{
|
||||
public:
|
||||
kismet_datasource(mapnik::parameters const& params);
|
||||
virtual ~kismet_datasource ();
|
||||
int type() const;
|
||||
static std::string name();
|
||||
mapnik::featureset_ptr features(mapnik::query const& q) const;
|
||||
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const;
|
||||
mapnik::Envelope<double> envelope() const;
|
||||
mapnik::layer_descriptor get_descriptor() const;
|
||||
|
||||
private:
|
||||
void run (const std::string &host, const unsigned int port);
|
||||
|
||||
static const std::string name_;
|
||||
mapnik::Envelope<double> extent_;
|
||||
mutable bool extent_initialized_;
|
||||
int type_;
|
||||
mapnik::layer_descriptor desc_;
|
||||
boost::shared_ptr<boost::thread> kismet_thread;
|
||||
};
|
||||
|
||||
|
||||
#endif // KISMET_DATASOURCE_HPP
|
95
plugins/input/kismet/kismet_featureset.cpp
Normal file
95
plugins/input/kismet/kismet_featureset.cpp
Normal file
|
@ -0,0 +1,95 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2007 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$
|
||||
|
||||
#include <mapnik/global.hpp>
|
||||
#include <mapnik/datasource.hpp>
|
||||
#include <mapnik/envelope.hpp>
|
||||
#include <mapnik/geometry.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/feature_layer_desc.hpp>
|
||||
#include <mapnik/wkb.hpp>
|
||||
#include <mapnik/unicode.hpp>
|
||||
|
||||
#include "kismet_featureset.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace mapnik;
|
||||
|
||||
kismet_featureset::kismet_featureset(const std::list<kismet_network_data> &knd_list,
|
||||
std::string const& encoding)
|
||||
: knd_list_(knd_list),
|
||||
tr_(new transcoder(encoding)),
|
||||
feature_id (0),
|
||||
knd_list_it(knd_list_.begin ()),
|
||||
source_("+proj=latlong +datum=WGS84")
|
||||
{
|
||||
cout << "kismet_featureset::kismet_featureset()" << endl;
|
||||
}
|
||||
|
||||
kismet_featureset::~kismet_featureset() {}
|
||||
|
||||
feature_ptr kismet_featureset::next()
|
||||
{
|
||||
cout << "kismet_featureset::next()" << endl;
|
||||
|
||||
cout << "create wlan feature: " << knd_list_.size () << endl;
|
||||
|
||||
if (knd_list_it != knd_list_.end ())
|
||||
{
|
||||
const kismet_network_data &knd = *knd_list_it;
|
||||
|
||||
feature_ptr feature(new Feature(feature_id));
|
||||
string key = "internet_access";
|
||||
string value = "wlan";
|
||||
double outMercLongitude = 0;
|
||||
double outMercLatitude = 0;
|
||||
|
||||
wgs84ToMercator (knd.bestlon_, knd.bestlat_, outMercLongitude, outMercLatitude);
|
||||
|
||||
mapnik::geometry2d * pt = new mapnik::point_impl;
|
||||
pt->move_to(outMercLongitude, outMercLatitude);
|
||||
feature->add_geometry(pt);
|
||||
(*feature)[key] = tr_->transcode(value.c_str ());
|
||||
|
||||
++feature_id;
|
||||
++knd_list_it;
|
||||
|
||||
return feature;
|
||||
}
|
||||
|
||||
// returns empty object to mark end
|
||||
return feature_ptr();
|
||||
}
|
||||
|
||||
void kismet_featureset::wgs84ToMercator (double inWGS84Longitude, double inWGS84Latitude,
|
||||
double &outMercLongitude, double &outMercLatitude)
|
||||
{
|
||||
projection dest ("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over"); // initialize to your Map projection
|
||||
proj_transform proj_tr (source_, dest);
|
||||
|
||||
double z = 0.0;
|
||||
proj_tr.forward (inWGS84Longitude, inWGS84Latitude, z);
|
||||
|
||||
outMercLongitude = inWGS84Longitude;
|
||||
outMercLatitude = inWGS84Latitude;
|
||||
}
|
62
plugins/input/kismet/kismet_featureset.hpp
Normal file
62
plugins/input/kismet/kismet_featureset.hpp
Normal file
|
@ -0,0 +1,62 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2007 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$
|
||||
|
||||
#ifndef KISMET_FEATURESET_HPP
|
||||
#define KISMET_FEATURESET_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/datasource.hpp>
|
||||
#include <mapnik/unicode.hpp>
|
||||
#include <mapnik/wkb.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
//STL
|
||||
#include <list>
|
||||
|
||||
#include "kismet_types.hpp"
|
||||
|
||||
|
||||
class kismet_featureset : public mapnik::Featureset
|
||||
{
|
||||
public:
|
||||
kismet_featureset(const std::list<kismet_network_data> &knd_list,
|
||||
std::string const& encoding);
|
||||
virtual ~kismet_featureset();
|
||||
mapnik::feature_ptr next();
|
||||
|
||||
private:
|
||||
void wgs84ToMercator (double inWGS84Longitude, double inWGS84Latitude,
|
||||
double &outMercLongitude, double &outMercLatitude);
|
||||
const std::list<kismet_network_data> &knd_list_;
|
||||
boost::scoped_ptr<mapnik::transcoder> tr_;
|
||||
mapnik::wkbFormat format_;
|
||||
bool multiple_geometries_;
|
||||
int feature_id;
|
||||
std::list<kismet_network_data>::const_iterator knd_list_it;
|
||||
mapnik::projection source_;
|
||||
};
|
||||
|
||||
#endif // KISMET_FEATURESET_HPP
|
49
plugins/input/kismet/kismet_types.hpp
Normal file
49
plugins/input/kismet/kismet_types.hpp
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2007 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$
|
||||
|
||||
#ifndef KISMET_TYPES_HPP
|
||||
#define KISMET_TYPES_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/datasource.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
class kismet_network_data
|
||||
{
|
||||
public:
|
||||
kismet_network_data() : bestlat_(0), bestlon_(0) {}
|
||||
kismet_network_data(std::string ssid, std::string bssid,
|
||||
double bestlat, double bestlon) :
|
||||
ssid_(ssid), bssid_(bssid),
|
||||
bestlat_(bestlat), bestlon_(bestlon) {}
|
||||
|
||||
std::string ssid_;
|
||||
std::string bssid_;
|
||||
double bestlat_;
|
||||
double bestlon_;
|
||||
};
|
||||
|
||||
#endif //KISMET_TYPES_HPP
|
||||
|
|
@ -5,14 +5,23 @@ pkglib_LTLIBRARIES = \
|
|||
|
||||
occi_la_SOURCES = \
|
||||
occi_datasource.cpp\
|
||||
occi_datasource.hpp\
|
||||
occi_featureset.cpp\
|
||||
occi_featureset.hpp\
|
||||
spatial_classesm.cpp\
|
||||
spatial_classeso.cpp
|
||||
spatial_classesm.h\
|
||||
spatial_classeso.cpp\
|
||||
spatial_classesh.h\
|
||||
occi_types.cpp\
|
||||
occi_types.hpp
|
||||
|
||||
occi_la_LIBADD = \
|
||||
${OCCI_LDFLAGS}
|
||||
|
||||
occi_la_CXXFLAGS = \
|
||||
-Wall \
|
||||
${PROFILING_CFLAGS} \
|
||||
${TRACING_CFLAGS} \
|
||||
${OCCI_CFLAGS} \
|
||||
-I../../../include
|
||||
|
||||
|
|
|
@ -5,12 +5,18 @@ pkglib_LTLIBRARIES = \
|
|||
|
||||
ogr_la_SOURCES = \
|
||||
ogr_datasource.cpp\
|
||||
ogr_featureset.cpp
|
||||
ogr_datasource.hpp\
|
||||
ogr_featureset.cpp\
|
||||
ogr_featureset.hpp
|
||||
|
||||
|
||||
ogr_la_LIBADD = \
|
||||
${GDAL_LDFLAGS}
|
||||
|
||||
ogr_la_CXXFLAGS = \
|
||||
-Wall \
|
||||
${PROFILING_CFLAGS} \
|
||||
${TRACING_CFLAGS} \
|
||||
${GDAL_CFLAGS} \
|
||||
-I../../../include
|
||||
|
||||
|
|
|
@ -5,12 +5,25 @@ pkglib_LTLIBRARIES = \
|
|||
osm.la
|
||||
|
||||
osm_la_SOURCES = \
|
||||
basiccurl.cpp\
|
||||
basiccurl.h\
|
||||
dataset_deliverer.cpp\
|
||||
dataset_deliverer.h\
|
||||
osm.cpp \
|
||||
osm.h\
|
||||
osm_datasource.cpp \
|
||||
osm_datasource.hpp \
|
||||
osm_featureset.cpp \
|
||||
osmparser.cpp
|
||||
osm_featureset.hpp \
|
||||
osmparser.cpp\
|
||||
osmparser.h\
|
||||
osmtagtypes.h\
|
||||
renderer.cpp
|
||||
|
||||
osm_la_CXXFLAGS = \
|
||||
-Wall \
|
||||
${PROFILING_CFLAGS} \
|
||||
${TRACING_CFLAGS} \
|
||||
-I../../../include \
|
||||
${LIBXML2_CFLAGS}
|
||||
|
||||
|
|
|
@ -5,13 +5,22 @@ pkglib_LTLIBRARIES = \
|
|||
postgis.la
|
||||
|
||||
postgis_la_SOURCES = \
|
||||
postgis.cpp \
|
||||
postgisfs.cpp
|
||||
connection.hpp\
|
||||
connection_manager.hpp\
|
||||
corsorresultset.hpp\
|
||||
postgis.cpp\
|
||||
postgis.hpp\
|
||||
postgisfs.cpp\
|
||||
property_index.hpp\
|
||||
resultset.hpp
|
||||
|
||||
postgis_la_LIBADD = \
|
||||
${POSTGRESQL_LDFLAGS}
|
||||
|
||||
postgis_la_CXXFLAGS = \
|
||||
-Wall \
|
||||
${PROFILING_CFLAGS} \
|
||||
${TRACING_CFLAGS} \
|
||||
${POSTGRESQL_CFLAGS} \
|
||||
-I../../../include
|
||||
|
||||
|
|
|
@ -4,10 +4,16 @@ pkglib_LTLIBRARIES = \
|
|||
|
||||
raster_la_SOURCES = \
|
||||
raster_datasource.cpp\
|
||||
raster_datasource.hpp\
|
||||
raster_featureset.cpp\
|
||||
raster_info.cpp
|
||||
raster_featureset.hpp\
|
||||
raster_info.cpp\
|
||||
raster_info.hpp
|
||||
|
||||
raster_la_CXXFLAGS = \
|
||||
-Wall \
|
||||
${PROFILING_CFLAGS} \
|
||||
${TRACING_CFLAGS} \
|
||||
-I../../../include
|
||||
|
||||
raster_la_LDFLAGS = \
|
||||
|
|
|
@ -3,15 +3,24 @@ pkglib_LTLIBRARIES = \
|
|||
shape.la
|
||||
|
||||
shape_la_SOURCES = \
|
||||
dbffile.cpp \
|
||||
dbf_test.cpp \
|
||||
shape.cpp \
|
||||
shape_featureset.cpp \
|
||||
shapefile.cpp \
|
||||
shape_index_featureset.cpp \
|
||||
shape_io.cpp
|
||||
dbffile.cpp\
|
||||
dbffile.hpp\
|
||||
shape.cpp\
|
||||
shape.hpp\
|
||||
shape_featureset.cpp\
|
||||
shape_featureset.hpp\
|
||||
shapefile.cpp\
|
||||
shapefile.hpp\
|
||||
shape_index_featureset.cpp\
|
||||
shape_index_featureset.hpp\
|
||||
shape_io.cpp\
|
||||
shape_io.hpp\
|
||||
shp_index.hpp
|
||||
|
||||
shape_la_CXXFLAGS = \
|
||||
-Wall \
|
||||
${PROFILING_CFLAGS} \
|
||||
${TRACING_CFLAGS} \
|
||||
-I../../../include
|
||||
|
||||
shape_la_LDFLAGS = \
|
||||
|
|
|
@ -5,12 +5,18 @@ pkglib_LTLIBRARIES = \
|
|||
|
||||
sqlite_la_SOURCES = \
|
||||
sqlite_datasource.cpp\
|
||||
sqlite_featureset.cpp
|
||||
sqlite_datasource.hpp\
|
||||
sqlite_featureset.cpp\
|
||||
sqlite_featureset.hpp\
|
||||
sqlite_types.hpp
|
||||
|
||||
sqlite_la_LIBADD = \
|
||||
${SQLITE3_LDFLAGS}
|
||||
|
||||
sqlite_la_CXXFLAGS = \
|
||||
-Wall \
|
||||
${PROFILING_CFLAGS} \
|
||||
${TRACING_CFLAGS} \
|
||||
${SQLITE3_CFLAGS} \
|
||||
-I../../../include
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ libmapnik_la_LIBADD = \
|
|||
libmapnik_la_CXXFLAGS = \
|
||||
-I../include \
|
||||
${PROFILING_CFLAGS} \
|
||||
${TRACING_CFLAGS} \
|
||||
${PNG_CFLAGS} \
|
||||
${FREETYPE2_CFLAGS} \
|
||||
${AGG_CFLAGS} \
|
||||
|
|
Loading…
Reference in a new issue