Osmium
0.1
|
#include <shapefile.hpp>
Classes | |
class | Field |
struct | JavascriptTemplate |
Public Member Functions | |
virtual | ~Shapefile () |
void | close () |
void | add_field (Field &field) |
void | add_field (const std::string &name, DBFFieldType type, int width=1, int decimals=0) |
void | add_field (const std::string &name, const std::string &type, int width=1, int decimals=0) |
void | add_geometry (SHPObject *shp_object) |
void | add_attribute (const int field, const bool value) const |
void | add_attribute (const int field, const int value) const |
void | add_attribute (const int field, const std::string &value) const |
void | add_attribute (const int field, const char *value) const |
void | add_attribute (const int field) const |
void | add_attribute_with_truncate (const int field, const char *value) |
void | add_attribute_with_truncate (const int field, const std::string &value) |
int | add_string_attribute (int n, v8::Local< v8::Value > value) const |
int | add_logical_attribute (int n, v8::Local< v8::Value > value) const |
bool | add (Osmium::Geometry::Geometry *geometry, v8::Local< v8::Object > attributes) |
v8::Local< v8::Object > | js_instance () const |
v8::Handle< v8::Value > | js_add_field (const v8::Arguments &args) |
v8::Handle< v8::Value > | js_add (const v8::Arguments &args) |
v8::Handle< v8::Value > | js_close (const v8::Arguments &) |
Protected Member Functions | |
Shapefile (const std::string &filename, int type) | |
Private Member Functions | |
void | open () |
Private Attributes | |
const std::string | m_filename_base |
base filename | |
std::vector< Field > | m_fields |
fields in DBF | |
SHPHandle | m_shp_handle |
DBFHandle | m_dbf_handle |
int | m_current_shape |
entity number of the shape we are currently writing | |
int | m_type |
shapefile type | |
int | m_sequence_number |
shapefile sequence number for auto-overflow (0=first) | |
Static Private Attributes | |
static const unsigned int | max_dbf_fields = 16 |
static const unsigned int | max_dbf_field_name_length = 11 |
static const int | max_dbf_field_length = 255 |
virtual Osmium::Export::Shapefile::~Shapefile | ( | ) | [inline, virtual] |
Osmium::Export::Shapefile::Shapefile | ( | const std::string & | filename, |
int | type | ||
) | [inline, protected] |
The constructor for Shapefile is protected. Use one of PointShapefile, LineShapefile, or PolygonShapefile.
bool Osmium::Export::Shapefile::add | ( | Osmium::Geometry::Geometry * | geometry, |
v8::Local< v8::Object > | attributes | ||
) | [inline] |
Add a geometry to the shapefile.
< a Javascript object (hash) with the attributes
geometry | the geometry |
void Osmium::Export::Shapefile::add_attribute | ( | const int | field, |
const bool | value | ||
) | const [inline] |
void Osmium::Export::Shapefile::add_attribute | ( | const int | field, |
const int | value | ||
) | const [inline] |
void Osmium::Export::Shapefile::add_attribute | ( | const int | field, |
const std::string & | value | ||
) | const [inline] |
void Osmium::Export::Shapefile::add_attribute | ( | const int | field, |
const char * | value | ||
) | const [inline] |
void Osmium::Export::Shapefile::add_attribute | ( | const int | field | ) | const [inline] |
void Osmium::Export::Shapefile::add_attribute_with_truncate | ( | const int | field, |
const char * | value | ||
) | [inline] |
void Osmium::Export::Shapefile::add_attribute_with_truncate | ( | const int | field, |
const std::string & | value | ||
) | [inline] |
void Osmium::Export::Shapefile::add_field | ( | Field & | field | ) | [inline] |
Add a field to a shapefile.
void Osmium::Export::Shapefile::add_field | ( | const std::string & | name, |
DBFFieldType | type, | ||
int | width = 1 , |
||
int | decimals = 0 |
||
) | [inline] |
Add a field to a shapefile.
name | The name of the field (1 to 11 characters long) |
type | The type of the field (FT_STRING, FT_INTEGER, FT_DOUBLE, or FT_BOOL) |
width | The width of the field (number of digits for ints and doubles) |
decimals | The precision of double fields (otherwise ignored) |
void Osmium::Export::Shapefile::add_field | ( | const std::string & | name, |
const std::string & | type, | ||
int | width = 1 , |
||
int | decimals = 0 |
||
) | [inline] |
Add a field to a shapefile.
name | The name of the field (1 to 11 characters long) |
type | The type of the field ("string", "integer", "double", or "bool") |
width | The width of the field (number of digits for ints and doubles) |
decimals | The precision of double fields (otherwise ignored) |
void Osmium::Export::Shapefile::add_geometry | ( | SHPObject * | shp_object | ) | [inline] |
Add a new geometry (shape object) to the Shapefile. You have to call this first for every new shape. After that you call add_attribute() for all the attributes.
shp_object | A pointer to the shape object to be added. The object will be freed for you by calling SHPDestroyObject()! |
Osmium::Exception::IllegalGeometry | If shp_object is NULL or the type of geometry does not fit the type of the shapefile. |
int Osmium::Export::Shapefile::add_logical_attribute | ( | int | n, |
v8::Local< v8::Value > | value | ||
) | const [inline] |
int Osmium::Export::Shapefile::add_string_attribute | ( | int | n, |
v8::Local< v8::Value > | value | ||
) | const [inline] |
void Osmium::Export::Shapefile::close | ( | ) | [inline] |
v8::Handle<v8::Value> Osmium::Export::Shapefile::js_add | ( | const v8::Arguments & | args | ) | [inline] |
v8::Handle<v8::Value> Osmium::Export::Shapefile::js_add_field | ( | const v8::Arguments & | args | ) | [inline] |
v8::Handle<v8::Value> Osmium::Export::Shapefile::js_close | ( | const v8::Arguments & | ) | [inline] |
v8::Local<v8::Object> Osmium::Export::Shapefile::js_instance | ( | ) | const [inline] |
void Osmium::Export::Shapefile::open | ( | ) | [inline, private] |
Open and initialize all files belonging to shapefile (.shp/shx/dbf/prj/cpg). Uses m_filename_base and m_sequence_number plus suffix to build filename.
int Osmium::Export::Shapefile::m_current_shape [private] |
entity number of the shape we are currently writing
DBFHandle Osmium::Export::Shapefile::m_dbf_handle [private] |
std::vector<Field> Osmium::Export::Shapefile::m_fields [private] |
fields in DBF
const std::string Osmium::Export::Shapefile::m_filename_base [private] |
base filename
int Osmium::Export::Shapefile::m_sequence_number [private] |
shapefile sequence number for auto-overflow (0=first)
SHPHandle Osmium::Export::Shapefile::m_shp_handle [private] |
int Osmium::Export::Shapefile::m_type [private] |
shapefile type
const int Osmium::Export::Shapefile::max_dbf_field_length = 255 [static, private] |
const unsigned int Osmium::Export::Shapefile::max_dbf_field_name_length = 11 [static, private] |
const unsigned int Osmium::Export::Shapefile::max_dbf_fields = 16 [static, private] |