WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
WXP::MapFile Class Reference

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 ()
 

Detailed Description

This class reads data from a map database file.

Author
Dan Vietor

Member Enumeration Documentation

◆ Type

Enumerator
UNK 

Unknown map type

BINARY 

Binary map type

ASCII 

ASCII map type

KML 

KML map type

SHAPE 

Shape File map type

Constructor & Destructor Documentation

◆ MapFile() [1/3]

MapFile::MapFile ( )

Constructor. Initializes values

◆ MapFile() [2/3]

MapFile::MapFile ( const char *  filename)

Constructor. Opens file.

Parameters
filenameFile to open

References open().

◆ MapFile() [3/3]

MapFile::MapFile ( const char *  filename,
int  raccess,
int  rtype 
)

Constructor. Opens the map database file

Parameters
filenameFile to open
raccessAccess (FileAttr::READ, FileAttr::WRITE)
rtypeFile type (BINARY, ASCII)

References open().

◆ ~MapFile()

MapFile::~MapFile ( )

Destructor. Closes file

References close().

Member Function Documentation

◆ checkType()

int MapFile::checkType ( const char *  filename)

◆ close()

int MapFile::close ( )

Closes the file and marks the class as closed

References WXP::File::close().

Referenced by ~MapFile().

◆ isBinary()

bool WXP::MapFile::isBinary ( )
inline

Returns true if map file binary

References BINARY.

◆ isOpen()

bool MapFile::isOpen ( )

Returns true if file opened

Referenced by WXP::MapPlot::draw().

◆ open() [1/2]

int MapFile::open ( const char *  filename)

Opens the map database file

Parameters
filenameFile to open

References open(), WXP::FileAttr::READ, and UNK.

◆ open() [2/2]

int MapFile::open ( const char *  filename,
int  raccess,
int  rtype 
)

Opens the map database file

Parameters
filenameFile to open
raccessAccess (FileAttr::READ, FileAttr::WRITE)
rtypeFile 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().

◆ print()

int MapFile::print ( )

Prints object parameters

References BINARY.

◆ readData()

int MapFile::readData ( EarthPoint ept)

Reads in the map data

Parameters
eptThe 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().

◆ readHeader()

int MapFile::readHeader ( MapFileHeader hdr)

◆ rewind()

int MapFile::rewind ( )

Rewinds the file

References WXP::File::rewind().

◆ seek()

int MapFile::seek ( int  off)

Seeks to a point in the file

References WXP::File::seek().

◆ skipData()

int MapFile::skipData ( )

Skips the map data section (still need to read header)

References BINARY, WXP::File::scanf(), and WXP::File::seek().

◆ tell()

int WXP::MapFile::tell ( )
inline

Returns byte offset in map file

References WXP::File::tell().

◆ writeData()

int MapFile::writeData ( EarthPoint ept)

Writes map data to file

Parameters
eptThe map vertex

References BINARY, WXP::EarthPoint::lat, WXP::EarthPoint::lon, and WXP::File::printf().

◆ writeHeader()

int MapFile::writeHeader ( MapFileHeader hdr)

Write the map header for each block of points

Parameters
hdrHeader 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().


The documentation for this class was generated from the following files: