|
WXP C++ Library Version 6.74.9
|
This class reads data from a map database file. More...
#include "../include/MapFile.h"
Public Types | |
| enum | Type { UNK , BINARY , ASCII , KML , SHAPE } |
Public Member Functions | |
| MapFile () | |
| MapFile (const char *filename) | |
| MapFile (const char *filenamem, int raccess, int rtype) | |
| ~MapFile () | |
| int | checkType (const char *filename) |
| int | open (const char *filenamem, int raccess, int rtype) |
| int | open (const char *filename) |
| bool | isOpen () |
| int | rewind () |
| int | seek (int off) |
| int | tell () |
| int | close () |
| bool | isBinary () |
| int | readHeader (MapFileHeader &hdr) |
| int | skipData () |
| int | readData (EarthPoint &ept) |
| int | writeHeader (MapFileHeader &hdr) |
| int | writeData (EarthPoint &ept) |
| int | print () |
This class reads data from a map database file.
| enum WXP::MapFile::Type |
| Enumerator | |
|---|---|
| UNK | Unknown map type |
| BINARY | Binary map type |
| ASCII | ASCII map type |
| KML | KML map type |
| SHAPE | Shape File map type |
| MapFile::MapFile | ( | ) |
Constructor. Initializes values
| MapFile::MapFile | ( | const char * | filename | ) |
| MapFile::MapFile | ( | const char * | filename, |
| int | raccess, | ||
| int | rtype | ||
| ) |
Constructor. Opens the map database file
| filename | File to open |
| raccess | Access (FileAttr::READ, FileAttr::WRITE) |
| rtype | File type (BINARY, ASCII) |
References open().
| MapFile::~MapFile | ( | ) |
Destructor. Closes file
References close().
| int MapFile::checkType | ( | const char * | filename | ) |
Checks the type of data in the file
| filename | File to check |
References ASCII, BINARY, WXP::MapFileHeader::index, WXP::File::isOpen(), KML, WXP::MapFileHeader::maxlat, WXP::MapFileHeader::maxlon, WXP::MapFileHeader::minlat, WXP::MapFileHeader::minlon, WXP::MapFileHeader::num, WXP::File::read(), and SHAPE.
Referenced by open().
| int MapFile::close | ( | ) |
Closes the file and marks the class as closed
References WXP::File::close().
Referenced by ~MapFile().
|
inline |
Returns true if map file binary
References BINARY.
| bool MapFile::isOpen | ( | ) |
Returns true if file opened
Referenced by WXP::MapPlot::draw().
| int MapFile::open | ( | const char * | filename | ) |
Opens the map database file
| filename | File to open |
References open(), WXP::FileAttr::READ, and UNK.
| int MapFile::open | ( | const char * | filename, |
| int | raccess, | ||
| int | rtype | ||
| ) |
Opens the map database file
| filename | File to open |
| raccess | Access (FileAttr::READ, FileAttr::WRITE) |
| rtype | File type (BINARY, ASCII) |
References BINARY, checkType(), WXP::Swap::init(), WXP::File::isOpen(), KML, WXP::File::open(), WXP::KmlFile::open(), WXP::ShapeFile::open(), WXP::FileAttr::READ, SHAPE, UNK, and WXP::FileAttr::WRITE.
Referenced by WXP::MapPlot::draw(), MapFile(), MapFile(), and open().
| int MapFile::print | ( | ) |
Prints object parameters
References BINARY.
| int MapFile::readData | ( | EarthPoint & | ept | ) |
Reads in the map data
| ept | The location of a map vertex |
References ASCII, BINARY, KML, WXP::EarthPoint::lat, WXP::EarthPoint::lon, WXP::File::scanf(), and SHAPE.
Referenced by WXP::MapPlot::draw().
| int MapFile::readHeader | ( | MapFileHeader & | hdr | ) |
Reads the map header for each block of points
| hdr | Header structure to put header data |
References ASCII, BINARY, WXP::KmlData::getName(), WXP::ShapeData::getName(), WXP::MapFileHeader::index, WXP::MapFileHeader::init(), KML, WXP::MapFileHeader::maxlat, WXP::MapFileHeader::maxlon, WXP::MapFileHeader::minlat, WXP::MapFileHeader::minlon, WXP::MapFileHeader::num, WXP::FileAttr::READ, WXP::KmlFile::read(), WXP::ShapeFile::read(), WXP::File::scanf(), WXP::MapFileHeader::setLabel(), and SHAPE.
Referenced by WXP::MapPlot::draw().
| int MapFile::rewind | ( | ) |
Rewinds the file
References WXP::File::rewind().
| int MapFile::seek | ( | int | off | ) |
Seeks to a point in the file
References WXP::File::seek().
| int MapFile::skipData | ( | ) |
Skips the map data section (still need to read header)
References BINARY, WXP::File::scanf(), and WXP::File::seek().
|
inline |
Returns byte offset in map file
References WXP::File::tell().
| int MapFile::writeData | ( | EarthPoint & | ept | ) |
Writes map data to file
| ept | The map vertex |
References BINARY, WXP::EarthPoint::lat, WXP::EarthPoint::lon, and WXP::File::printf().
| int MapFile::writeHeader | ( | MapFileHeader & | hdr | ) |
Write the map header for each block of points
| hdr | Header structure to put header data |
References ASCII, WXP::MapFileHeader::index, WXP::MapFileHeader::maxlat, WXP::MapFileHeader::maxlon, WXP::MapFileHeader::minlat, WXP::MapFileHeader::minlon, WXP::MapFileHeader::num, and WXP::File::printf().