45 #define strcasecmp _stricmp
49 #define fdopen _fdopen
95 FILE *file = fopen(
_source,
"r" );
107 int num_attributes = 0;
118 const int line_len = 600;
122 while ( fgets( line, line_len, file ) ) {
125 pos = strchr( line,
'\r' );
132 if ( *line !=
'#' && sscanf( line,
"%[^\t] %[^\t] %lf %lf %u",
id, label, &x, &y, &abundance ) == 5 ) {
139 else if ( *line !=
'#' && sscanf( line,
"%[^\t] %[^\t] %lf %lf",
id, label, &x, &y ) == 4 ) {
146 _addOccurrence(
id, label, lg, lt, error, 1.0, num_attributes, attributes );
148 else if ( *line !=
'#' && sscanf( line,
"%[^,],%[^,],%lf,%lf,%u",
id, label, &x, &y, &abundance ) == 5 ) {
155 else if ( *line !=
'#' && sscanf( line,
"%[^,],%[^,],%lf,%lf",
id, label, &x, &y ) == 4 ) {
162 _addOccurrence(
id, label, lg, lt, error, 1.0, num_attributes, attributes );
DelimitedTextOccurrences(const char *source, const char *coordSystem)
double Scalar
Type of map values.
static Log * instance()
Returns the instance pointer, creating the object on the first call.
int _addOccurrence(const char *id, const char *groupId, Coord lg, Coord lt, Scalar error, Scalar abundance, int num_attributes, Scalar *attributes)
~DelimitedTextOccurrences()
void error(const char *format,...)
'Error' level.
static OccurrencesReader * CreateOccurrencesReaderCallback(const char *source, const char *coordSystem)
double Coord
Type of map coordinates.
void debug(const char *format,...)
'Debug' level.