OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Attributes | Friends | List of all members
ossimVpfTable Class Reference

#include <ossimVpfTable.h>

Inheritance diagram for ossimVpfTable:
ossimVpfBoundingRecordTable ossimVpfFeatureClassSchema

Public Member Functions

 ossimVpfTable ()
 
virtual ~ossimVpfTable ()
 
virtual bool openTable (const ossimFilename &tableName)
 
virtual void closeTable ()
 
virtual void print (std::ostream &out) const
 
int getNumberOfRows () const
 
int getNumberOfColumns () const
 
ossimString getColumnName (int idx) const
 
virtual bool isClosed () const
 
virtual void reset () const
 
virtual bool goToRow (long row) const
 
vpf_table_typegetVpfTableData ()
 
std::vector< ossimStringgetColumnValues (const ossimString &columnName) const
 
std::vector< ossimStringgetColumnValues (long columnNumber) const
 
ossimString getColumnValueAsString (row_type &row, long columnNumber) const
 
ossimString getColumnValueAsString (ossim_int32 rowNumber, long columnNumber) const
 
ossimString getColumnValueAsString (const ossimString &columnName)
 
ossim_int32 getColumnPosition (const ossimString &columnName) const
 

Protected Attributes

vpf_table_typetheTableInformation
 
ossimFilename theTableName
 

Friends

OSSIM_DLL std::ostream & operator<< (std::ostream &out, const ossimVpfTable &data)
 

Detailed Description

Definition at line 22 of file ossimVpfTable.h.

Constructor & Destructor Documentation

◆ ossimVpfTable()

ossimVpfTable::ossimVpfTable ( )

Definition at line 26 of file ossimVpfTable.cpp.

27  :theTableInformation(NULL)
28 {
29 }
vpf_table_type * theTableInformation
Definition: ossimVpfTable.h:81

◆ ~ossimVpfTable()

ossimVpfTable::~ossimVpfTable ( )
virtual

Definition at line 31 of file ossimVpfTable.cpp.

References closeTable(), and theTableInformation.

32 {
34  {
35  closeTable();
36  delete theTableInformation;
37  theTableInformation = NULL;
38  }
39 }
vpf_table_type * theTableInformation
Definition: ossimVpfTable.h:81
virtual void closeTable()

Member Function Documentation

◆ closeTable()

void ossimVpfTable::closeTable ( )
virtual

Closes the table.

Reimplemented in ossimVpfFeatureClassSchema.

Definition at line 72 of file ossimVpfTable.cpp.

References CLOSED, vpf_table_type::status, theTableInformation, and vpf_close_table().

Referenced by ossimVpfFeatureClassSchema::closeTable(), ossimVpfBoundingRecordTable::openTable(), openTable(), and ~ossimVpfTable().

73 {
75  {
77  }
78 }
vpf_table_type * theTableInformation
Definition: ossimVpfTable.h:81
unsigned char status
Definition: vpftable.h:121
#define CLOSED
Definition: vpftable.h:82
void vpf_close_table(vpf_table_type *table)

◆ getColumnName()

ossimString ossimVpfTable::getColumnName ( int  idx) const

Definition at line 94 of file ossimVpfTable.cpp.

References getNumberOfColumns(), vpf_table_type::header, header_cell::name, and theTableInformation.

95 {
96  if((idx < 0) || idx > getNumberOfColumns())
97  {
98  return ossimString("");
99  }
101 }
vpf_table_type * theTableInformation
Definition: ossimVpfTable.h:81
char * name
Definition: vpftable.h:63
header_type header
Definition: vpftable.h:109
int getNumberOfColumns() const

◆ getColumnPosition()

ossim_int32 ossimVpfTable::getColumnPosition ( const ossimString columnName) const

Definition at line 430 of file ossimVpfTable.cpp.

References ossimString::c_str(), table_pos(), and theTableInformation.

Referenced by ossimVpfAnnotationFeatureInfo::buildEdgFeature(), ossimVpfAnnotationFeatureInfo::buildFaceFeature(), ossimVpfAnnotationFeatureInfo::buildPointFeature(), ossimVpfAnnotationFeatureInfo::buildTxtFeature(), ossimVpfBoundingRecordTable::openTable(), ossimVpfAnnotationFeatureInfo::readGeoPolygon(), ossimVpfFeatureClassSchema::setFeatureClassMapping(), ossimVpfLibrary::setTileNames(), and ossimVpfFeatureClassSchema::validateColumnNames().

431 {
432  return ((ossim_int32)table_pos(const_cast<char*>(columnName.c_str()), *theTableInformation));
433 }
vpf_table_type * theTableInformation
Definition: ossimVpfTable.h:81
ossim_int32 table_pos(const char *field_name, vpf_table_type table)
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
int ossim_int32

◆ getColumnValueAsString() [1/3]

ossimString ossimVpfTable::getColumnValueAsString ( row_type row,
long  columnNumber 
) const

Definition at line 204 of file ossimVpfTable.cpp.

References id_triplet_type::exid, format_date(), get_table_element(), vpf_table_type::header, id_triplet_type::id, is_vpf_null_double(), is_vpf_null_float(), n, theTableInformation, id_triplet_type::tile, ossimString::toString(), ossimString::trim(), header_cell::type, id_triplet_type::type, coordinate_type::x, x, coordinate_type::y, and y.

Referenced by ossimVpfAnnotationFeatureInfo::buildTxtFeature(), getColumnValueAsString(), getColumnValues(), ossimVpfLibrary::getExtent(), ossimVpfAnnotationFeatureInfo::readAttributes(), ossimVpfAnnotationFeatureInfo::readGeoPolygon(), ossimVpfAnnotationFeatureInfo::readRngId(), ossimVpfAnnotationFeatureInfo::readStartEdgeId(), ossimVpfAnnotationFeatureInfo::readTableCellAsInt(), ossimVpfFeatureClassSchema::setFeatureClassMapping(), and ossimVpfLibrary::setTileNames().

206 {
207  ossimString result;
208  ossim_int32 n=1;
209  switch(theTableInformation->header[columnNumber].type)
210  {
211  case 'T': // it's of type text so
212  {
213  char c;
214  char *buf = (char *)get_table_element(columnNumber,
215  row,
217  &c,
218  &n);
219  if(buf)
220  {
221  result = buf;
222  free(buf);
223  }
224  else
225  {
226  result = c;
227  }
228  break;
229  }
230  case 'I':
231  {
232  ossim_int32 value;
233  ossim_int32* v = (ossim_int32*)get_table_element(columnNumber,
234  row,
236  &value,
237  &n);
238  if(v)
239  {
240  result = ossimString::toString(v[0]);
241 
242  free(v);
243  }
244  else
245  {
246  result = ossimString::toString(value);
247  }
248  break;
249  }
250  case 'S':
251  {
252  short int value;
253  short int* v = (short int*)get_table_element(columnNumber,
254  row,
256  &value,
257  &n);
258  if(v)
259  {
260  result = ossimString::toString(v[0]);
261 
262  free(v);
263  }
264  else
265  {
266  result = ossimString::toString(value);
267  }
268  break;
269  }
270  case 'F':
271  {
272  float value;
273  float* v = (float*)get_table_element(columnNumber,
274  row,
276  &value,
277  &n);
278  if(v)
279  {
280  value = v[0];
281  free(v);
282  }
283  if (!is_vpf_null_float(value))
284  {
285  result = ossimString::toString(value);
286  }
287  else
288  {
289  result = "nan";
290  }
291  break;
292  }
293  case 'B':
294  {
295  double value;
296  double* tempBuf = (double*)get_table_element(columnNumber,
297  row,
299  &value,
300  &n);
301  if(tempBuf)
302  {
303  value = tempBuf[0];
304  free(tempBuf);
305  }
306  if (!is_vpf_null_double(value))
307  {
308  result = ossimString::toString(value);
309  }
310  else
311  {
312  result = "nan";
313  }
314 
315  break;
316  }
317  case 'C':
318  {
319  coordinate_type coordType;
320  coordinate_type* temp = (coordinate_type*)get_table_element(columnNumber,
321  row,
323  &coordType,
324  &n);
325  if(temp)
326  {
327  coordType = temp[0];
328  free(temp);
329  }
330  result = ossimString::toString(coordType.x)+
331  ossimString(" ") +
332  ossimString::toString(coordType.y);
333  break;
334  }
335  case 'K':
336  {
337  id_triplet_type idTripletType;
338  id_triplet_type* tempType = (id_triplet_type*)get_table_element(columnNumber,
339  row,
341  &idTripletType,
342  &n);
343  if(tempType)
344  {
345  idTripletType = tempType[0];
346  free (tempType);
347  }
348  result = ossimString(idTripletType.type) +
349  ossimString(" ") +
350  ossimString::toString(static_cast<ossim_int32>(idTripletType.id)) +
351  ossimString(" ") +
352  ossimString::toString(static_cast<ossim_int32>(idTripletType.tile))+
353  ossimString(" ") +
354  ossimString::toString(static_cast<ossim_int32>(idTripletType.exid));
355  break;
356  }
357  case 'D':
358  {
359  date_type date, formatDate;
360  date_type* temp = (date_type*)get_table_element(columnNumber,
361  row,
363  &date,
364  &n);
365  if(temp)
366  {
367  free(temp);
368  }
369  format_date(date, formatDate);
370  result = formatDate;
371  break;
372  }
373  case 'Z': // tri coordinate types x, y, z
374  {
375  tri_coordinate_type *tcptr=NULL;
376  tcptr = (tri_coordinate_type *) get_table_element(columnNumber,row,
377  *theTableInformation, NULL,&n);
378  result = "";
379  for (int k=0;k<n;k++)
380  {
381 
382  result = result + " (" +
383  ossimString::toString(tcptr[k].x) +
384  ossimString(" ") +
385  ossimString::toString(tcptr[k].y) +
386  ossimString(" ") +
387  ossimString::toString(tcptr[k].z) +
388  ossimString(") ") ;
389  }
390 
391  if (tcptr)
392  {
393  free(tcptr);
394  }
395  break;
396  }
397  }
398  result.trim();
399  return result;
400 }
vpf_table_type * theTableInformation
Definition: ossimVpfTable.h:81
ossim_uint32 x
ossim_int32 id
Definition: vpftable.h:216
void format_date(date_type date, char *fmtdate)
ossim_uint32 y
header_type header
Definition: vpftable.h:109
static ossimString toString(bool aValue)
Numeric to string methods.
os2<< "> n<< " > nendobj n
ossim_int32 tile
Definition: vpftable.h:216
int is_vpf_null_float(float num)
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
void * get_table_element(ossim_int32 field_number, row_type row, vpf_table_type table, void *value, ossim_int32 *count)
unsigned char type
Definition: vpftable.h:215
int is_vpf_null_double(double num)
char date_type[21]
Definition: vpftable.h:47
ossim_int32 exid
Definition: vpftable.h:216
char type
Definition: vpftable.h:68
int ossim_int32

◆ getColumnValueAsString() [2/3]

ossimString ossimVpfTable::getColumnValueAsString ( ossim_int32  rowNumber,
long  columnNumber 
) const

Definition at line 402 of file ossimVpfTable.cpp.

References free_row(), getColumnValueAsString(), read_row(), and theTableInformation.

404 {
405  row_type row = read_row( rowNumber, *theTableInformation);
406  ossimString result = getColumnValueAsString(row,
407  columnNumber);
409 
410  return result;
411 }
vpf_table_type * theTableInformation
Definition: ossimVpfTable.h:81
void free_row(row_type row, vpf_table_type table)
row_type read_row(ossim_int32 row_number, vpf_table_type table)
ossimString getColumnValueAsString(row_type &row, long columnNumber) const

◆ getColumnValueAsString() [3/3]

ossimString ossimVpfTable::getColumnValueAsString ( const ossimString columnName)

Definition at line 413 of file ossimVpfTable.cpp.

References ossimString::c_str(), CLOSED, free_row(), getColumnValueAsString(), read_next_row(), vpf_table_type::status, table_pos(), and theTableInformation.

414 {
415  if(theTableInformation &&
417  {
418  long int columnNumber = table_pos(const_cast<char*>(columnName.c_str()),
421  ossimString result = getColumnValueAsString(row,
422  columnNumber);
424  return result;
425  }
426 
427  return "";
428 }
vpf_table_type * theTableInformation
Definition: ossimVpfTable.h:81
void free_row(row_type row, vpf_table_type table)
unsigned char status
Definition: vpftable.h:121
ossim_int32 table_pos(const char *field_name, vpf_table_type table)
#define CLOSED
Definition: vpftable.h:82
ossimString getColumnValueAsString(row_type &row, long columnNumber) const
row_type read_next_row(vpf_table_type table)
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396

◆ getColumnValues() [1/2]

std::vector< ossimString > ossimVpfTable::getColumnValues ( const ossimString columnName) const

Definition at line 139 of file ossimVpfTable.cpp.

References ossimString::c_str(), free_row(), getColumnValueAsString(), vpf_table_type::nrows, OPENED, ossimString::push_back(), read_next_row(), reset(), vpf_table_type::status, table_pos(), theTableInformation, and ossimString::trim().

Referenced by ossimVpfAnnotationFeatureInfo::buildEdgFeature(), ossimVpfAnnotationFeatureInfo::buildFaceFeature(), ossimVpfAnnotationFeatureInfo::buildPointFeature(), ossimVpfAnnotationFeatureInfo::buildTxtFeature(), ossimVpfDatabase::getLibraryNames(), ossimVpfDatabase::getLibraryNamesFullPath(), and ossimVpfLibrary::setCoverageNames().

140 {
141  std::vector<ossimString> result;
142 
143  if(theTableInformation &&
145  {
146  long int columnNumber = table_pos(const_cast<char*>(columnName.c_str()), *theTableInformation);
147 
148  if(columnNumber >=0 &&
149  (columnNumber < theTableInformation->nfields))
150  {
151  row_type row;
152  // start at the first row of the table
153  reset();
154  for (int rowIndex = 1;
155  rowIndex <= theTableInformation->nrows;
156  ++rowIndex)
157  {
160  columnNumber);
161  value.trim();
162  result.push_back(value);
164  }
165  }
166  }
167 
168  return result;
169 }
vpf_table_type * theTableInformation
Definition: ossimVpfTable.h:81
void free_row(row_type row, vpf_table_type table)
unsigned char status
Definition: vpftable.h:121
void push_back(char c)
Equivalent to insert(end(), c).
Definition: ossimString.h:905
#define OPENED
Definition: vpftable.h:83
ossim_int32 table_pos(const char *field_name, vpf_table_type table)
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
ossim_int32 nrows
Definition: vpftable.h:114
virtual void reset() const
ossimString getColumnValueAsString(row_type &row, long columnNumber) const
row_type read_next_row(vpf_table_type table)
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396

◆ getColumnValues() [2/2]

std::vector< ossimString > ossimVpfTable::getColumnValues ( long  columnNumber) const

Definition at line 171 of file ossimVpfTable.cpp.

References free_row(), getColumnValueAsString(), vpf_table_type::nrows, OPENED, ossimString::push_back(), read_next_row(), reset(), vpf_table_type::status, theTableInformation, and ossimString::trim().

172 {
173  std::vector<ossimString> result;
174 
175  if(theTableInformation &&
177  {
178  if(columnNumber >=0 &&
179  (columnNumber < theTableInformation->nfields))
180  {
181  row_type row;
182  // start at the first row of the table
183  reset();
184  for (int rowIndex = 0;
185  rowIndex < theTableInformation->nrows;
186  ++rowIndex)
187  {
190  columnNumber);
191 // value = value.downcase();
192  value = value.trim();
193  result.push_back(value);
195  }
196  }
197  }
198 
199  return result;
200 }
vpf_table_type * theTableInformation
Definition: ossimVpfTable.h:81
void free_row(row_type row, vpf_table_type table)
unsigned char status
Definition: vpftable.h:121
void push_back(char c)
Equivalent to insert(end(), c).
Definition: ossimString.h:905
#define OPENED
Definition: vpftable.h:83
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
ossim_int32 nrows
Definition: vpftable.h:114
virtual void reset() const
ossimString getColumnValueAsString(row_type &row, long columnNumber) const
row_type read_next_row(vpf_table_type table)

◆ getNumberOfColumns()

int ossimVpfTable::getNumberOfColumns ( ) const

Definition at line 87 of file ossimVpfTable.cpp.

References vpf_table_type::nfields, and theTableInformation.

Referenced by getColumnName(), and ossimVpfAnnotationFeatureInfo::readAttributes().

88 {
90 
91  return 0;
92 }
vpf_table_type * theTableInformation
Definition: ossimVpfTable.h:81
ossim_int32 nfields
Definition: vpftable.h:106

◆ getNumberOfRows()

int ossimVpfTable::getNumberOfRows ( ) const

◆ getVpfTableData()

vpf_table_type* ossimVpfTable::getVpfTableData ( )
inline

◆ goToRow()

bool ossimVpfTable::goToRow ( long  row) const
virtual

Definition at line 121 of file ossimVpfTable.cpp.

References CLOSED, vpf_table_type::fp, index_pos(), vpf_table_type::status, and theTableInformation.

122 {
123  if(theTableInformation &&
125  {
126  long fpos;
127 
128  fpos = index_pos(row, *theTableInformation);
129  if(fpos < 0)
130  {
131  return false;
132  }
133  fseek(theTableInformation->fp, fpos, SEEK_SET);
134  }
135 
136  return true;
137 }
vpf_table_type * theTableInformation
Definition: ossimVpfTable.h:81
unsigned char status
Definition: vpftable.h:121
ossim_int32 index_pos(ossim_int32 row_number, vpf_table_type table)
#define CLOSED
Definition: vpftable.h:82

◆ isClosed()

bool ossimVpfTable::isClosed ( ) const
virtual

◆ openTable()

bool ossimVpfTable::openTable ( const ossimFilename tableName)
virtual

Will open the table. Will return OSSIM_OK if it was successful or OSSIM_ERROR if unsuccessful.

Reimplemented in ossimVpfBoundingRecordTable.

Definition at line 41 of file ossimVpfTable.cpp.

References ossimString::c_str(), closeTable(), disk, is_vpf_table(), theTableInformation, theTableName, and vpf_open_table().

Referenced by ossimVpfAnnotationFeatureInfo::buildEdgFeature(), ossimVpfAnnotationFeatureInfo::buildFaceFeature(), ossimVpfAnnotationFeatureInfo::buildPointFeature(), ossimVpfAnnotationFeatureInfo::buildTxtFeature(), ossimVpfLibrary::getExtent(), ossimVpfDatabase::getLibraryNames(), ossimVpfDatabase::getLibraryNamesFullPath(), ossimVpfDatabase::openDatabase(), ossimVpfFeatureClass::openFeatureClass(), ossimVpfFeatureClassSchema::openSchema(), ossimVpfBoundingRecordTable::openTable(), ossimVpfCoverage::print(), ossimVpfLibrary::setCoverageNames(), and ossimVpfLibrary::setTileNames().

42 {
43  closeTable();
44 
45  if(is_vpf_table(const_cast<char*>(tableName.c_str())))
46  {
48  {
49  delete theTableInformation;
50  theTableInformation = NULL;
51  }
53  memset(theTableInformation, 0, sizeof(vpf_table_type));
54 
55  theTableName = tableName;
56  *theTableInformation = vpf_open_table(const_cast<char*>(tableName.c_str()),
57  disk,
58  "rb",
59  NULL);
60  }
61  else
62  {
63  delete theTableInformation;
64  theTableInformation = NULL;
65 
66  return false;
67  }
68 
69  return true;
70 }
vpf_table_type * theTableInformation
Definition: ossimVpfTable.h:81
virtual void closeTable()
vpf_table_type vpf_open_table(const char *tablename, storage_type storage, const char *mode, char *defstr)
ossim_int32 is_vpf_table(const char *fname)
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
ossimFilename theTableName
Definition: ossimVpfTable.h:86
Definition: vpftable.h:74

◆ print()

void ossimVpfTable::print ( std::ostream &  out) const
virtual

This code is going to be cut paste from the vpf_dump_table found in vpf_util/vpf_dump_table.c. This function only allows you to output to a file. We need to re-write it to go to a stream. the best way to do this is to cut and paste the code.

Definition at line 435 of file ossimVpfTable.cpp.

References CLOSED, header_cell::count, header_cell::description, vpf_table_type::description, id_triplet_type::exid, format_date(), free_row(), get_table_element(), vpf_table_type::header, id_triplet_type::id, is_vpf_null_double(), is_vpf_null_float(), n, header_cell::name, vpf_table_type::nfields, vpf_table_type::nrows, read_next_row(), reset(), vpf_table_type::status, theTableInformation, theTableName, id_triplet_type::tile, header_cell::type, coordinate_type::x, double_coordinate_type::x, tri_coordinate_type::x, double_tri_coordinate_type::x, x, coordinate_type::y, double_coordinate_type::y, tri_coordinate_type::y, double_tri_coordinate_type::y, y, tri_coordinate_type::z, and double_tri_coordinate_type::z.

Referenced by operator<<(), and ossimVpfCoverage::print().

436 {
437  if(theTableInformation &&
439  {
440  // make sure we are at the beginning of the table.
441  this->reset();
442 
443 
444  // the rest of this code is from the vpfutil. The vpfutil
445  // was grabbed from the vhcl map server software.
447 
448  ossim_int32 i,j,k,n;
449  ossim_int16 ival=0,*iptr=NULL;
450  ossim_int32 lval=0,*lptr=NULL;
451  ossim_float32 fval=0,*fptr=NULL;
452  date_type dval,*dptr=NULL;
453  id_triplet_type kval={0,0,0}, *kptr=NULL;
454  coordinate_type cval={0,0}, *cptr=NULL;
455  char *buf, ch, date[40];
456  row_type row;
457 
458 
459  out << "table name: " << theTableName << std::endl
460  << "desciption: " << table.description << std::endl
461  << std::endl;
462 
463  out << "Definition:" << std::endl;
464  for (i=0;i<table.nfields;i++) {
465  if (table.header[i].count < 0)
466  {
467 
468  out << table.header[i].name << " ("
469  << table.header[i].type << ",*) "
470  << table.header[i].description << std::endl;
471  }
472  else
473  {
474  out << table.header[i].name << " ("
475  << table.header[i].type << ","
476  << table.header[i].count << ") "
477  << table.header[i].description << std::endl;
478  }
479  }
480 
481  out << "\nContents:" << std::endl;
482  for (i=1;i<=table.nrows;i++)
483  {
484  row = read_next_row(table);
485  for (j=0;j<table.nfields;j++)
486  {
487  out << table.header[j].name << ": ";
488  switch (table.header[j].type) {
489  case 'T':
490  if (table.header[j].count==1)
491  {
492  get_table_element(j,row,table,&ch,&n);
493 
494  out << ch << std::endl;
495  }
496  else
497  {
498  buf = (char *)get_table_element(j,row,table,NULL,&n);
499  n = (long)strlen(table.header[j].name) + 2;
500  for (k=0;k<(long)strlen(buf);k++)
501  {
502  out << buf[k];
503  n++;
504  if (n>80)
505  {
506  out << std::endl;
507  n = 0;
508  }
509  }
510  out << std::endl;
511  free(buf);
512  }
513  break;
514  case 'I': // long
515  if (table.header[j].count==1)
516  {
517  get_table_element(j,row,table,&lval,&n);
518  if (!is_vpf_null_float(lval))
519  {
520  out << lval << std::endl;
521  }
522  else
523  {
524  out << "null" << std::endl;
525  }
526  }
527  else
528  {
529  lptr = (ossim_int32*)get_table_element(j,row,table,NULL,&n);
530  for (k=0;k<n;k++)
531  {
532  if (!is_vpf_null_float(lptr[k]))
533  {
534  out << lptr[k];
535  }
536  else
537  {
538  out << "null";
539  }
540  }
541  out << std::endl;
542  free(lptr);
543  }
544  break;
545  case 'R': // for double
546  {
547  double *dptr=NULL;
548  double value = 0;
549  if (table.header[j].count==1)
550  {
551  get_table_element(j,row,table,&value,&n);
552  if(!is_vpf_null_double(value))
553  {
554  out << "null" << std::endl;
555  }
556  else
557  {
558  out << value << std::endl;
559  }
560  }
561  else
562  {
563  dptr = (double*)get_table_element(j,row,table,NULL,&n);
564  for (k=0;k<n;k++)
565  {
566  if (!is_vpf_null_double(dptr[k]))
567  {
568  out << dptr[k];
569  }
570  else
571  {
572  out << "null ";
573  }
574  }
575  out << std::endl;
576  free(dptr);
577  }
578  }
579  case 'S': // integer
580  if (table.header[j].count==1)
581  {
582  get_table_element(j,row,table,&ival,&n);
583  if (ival != (short int)INT_MAX)
584  {
585  out << ival << std::endl;
586  }
587  else
588  {
589  out << "null" << std::endl;
590  }
591  }
592  else
593  {
594  iptr = (short int*)get_table_element(j,row,table,NULL,&n);
595  for (k=0;k<n;k++)
596  {
597  if (iptr[k] != (short int)INT_MAX)
598  {
599  out << iptr[k];
600  }
601  else
602  {
603  out << "null ";
604  }
605  }
606  out << std::endl;
607  free(iptr);
608  }
609  break;
610  case 'F': // float type
611  if (table.header[j].count==1)
612  {
613  get_table_element(j,row,table,&fval,&n);
614  if (!is_vpf_null_float(fval))
615  {
616  out << fval << std::endl;
617  }
618  else
619  {
620  out << "null" << std::endl;
621  }
622  }
623  else
624  {
625  fptr = (float*)get_table_element(j,row,table,NULL,&n);
626  for (k=0;k<n;k++)
627  {
628  if (!is_vpf_null_float(fptr[k]))
629  {
630  out << fptr[k] << " ";
631  }
632  else
633  {
634  out << "null ";
635  }
636  }
637  out << std::endl;
638  free(fptr);
639  }
640  break;
641  case 'Y':
642  {
643  double_tri_coordinate_type dtctValue, *dtctPtr;
644  if (table.header[j].count==1)
645  {
646  get_table_element(j,row,table,&dtctValue,&n);
647  out << "(";
648  if(is_vpf_null_double(dtctValue.x))
649  {
650  out << "null, ";
651  }
652  else
653  {
654  out << dtctValue.x << ", ";
655  }
656  if(is_vpf_null_double(dtctValue.y))
657  {
658  out << "null, ";
659  }
660  else
661  {
662  out << dtctValue.y << ", ";
663  }
664  if(is_vpf_null_double(dtctValue.z))
665  {
666  out << "null, ";
667  }
668  else
669  {
670  out << dtctValue.z << ", ";
671  }
672  }
673  else
674  {
675  dtctPtr = (double_tri_coordinate_type*)get_table_element(j,row,table,NULL,&n);
676  for (k=0;k<n;k++)
677  {
678  out << "(";
679  if(is_vpf_null_double(dtctPtr[k].x))
680  {
681  out << "null, ";
682  }
683  else
684  {
685  out << dtctPtr[k].x << ", ";
686  }
687  if(is_vpf_null_double(dtctPtr[k].y))
688  {
689  out << "null, ";
690  }
691  else
692  {
693  out << dtctPtr[k].y << ", ";
694  }
695  if(is_vpf_null_double(dtctPtr[k].z))
696  {
697  out << "null, ";
698  }
699  else
700  {
701  out << dtctPtr[k].z << ", ";
702  }
703  }
704  free(dtctPtr);
705  }
706  break;
707  }
708  case 'Z': // tri coordinate types x, y, z
709  {
710  tri_coordinate_type tcval={0,0,0}, *tcptr=NULL;
711  if (table.header[j].count==1)
712  {
713  get_table_element(j,row,table,&tcval,&n);
714  out << "(";
715  if(is_vpf_null_float(tcval.x))
716  {
717  out << "null" << ",";
718  }
719  else
720  {
721  out << tcval.x << ", ";
722  }
723  if(is_vpf_null_float(tcval.y))
724  {
725  out << "null" << ", ";
726  }
727  else
728  {
729  out << tcval.y << ", ";
730  }
731  if(is_vpf_null_float(tcval.z))
732  {
733  out << "null)" << std::endl;
734  }
735  else
736  {
737  out << tcval.z << ")" << std::endl;
738  }
739  }
740  else
741  {
742  tcptr = (tri_coordinate_type*)get_table_element(j,row,table,NULL,&n);
743  for (k=0;k<n;k++)
744  {
745  out << "(";
746  if(is_vpf_null_float(tcptr[k].x))
747  {
748  out << "null, ";
749  }
750  else
751  {
752  out << tcptr[k].x << ", ";
753  }
754  if(is_vpf_null_float(tcptr[k].y))
755  {
756  out << "null, ";
757  }
758  else
759  {
760  out << tcptr[k].y << ", ";
761  }
762  if(is_vpf_null_float(tcptr[k].z))
763  {
764  out << "null)";
765  }
766  else
767  {
768  out << tcptr[k].z << ")";
769  }
770  }
771  out << std::endl;
772  free(tcptr);
773  }
774  break;
775  }
776  case 'C': // coordinate type x, y
777  if (table.header[j].count==1)
778  {
779  get_table_element(j,row,table,&cval,&n);
780  out << "(";
781  if(is_vpf_null_float(cval.x))
782  {
783  out << "null, ";
784  }
785  else
786  {
787  out << cval.x << ", ";
788  }
789  if(is_vpf_null_float(cval.y))
790  {
791  out << "null, ";
792  }
793  else
794  {
795  out << cval.y << ")";
796  }
797  }
798  else
799  {
800  cptr = (coordinate_type*)get_table_element(j,row,table,NULL,&n);
801  for (k=0;k<n;k++)
802  {
803 
804  out << "(" << cptr[k].x << "," << cptr[k].y << ") ";
805  }
806  out << std::endl;
807  free(cptr);
808  }
809  break;
810  case 'B': // double coordinate type
811  {
812  double_coordinate_type dct, *dctPtr;
813 
814  if (table.header[j].count==1)
815  {
816  get_table_element(j,row,table,&dct,&n);
817 
818  out << "(";
819  if(is_vpf_null_double(dct.x))
820  {
821  out << "null, ";
822  }
823  else
824  {
825  out << dct.x << ", ";
826  }
827  if(is_vpf_null_double(dct.y))
828  {
829  out << "null, ";
830  }
831  else
832  {
833  out << dct.y << ")";
834  }
835  }
836  else
837  {
838  dctPtr = (double_coordinate_type*)get_table_element(j,row,table,NULL,&n);
839  for (k=0;k<n;k++)
840  {
841  out << "(";
842  if(is_vpf_null_double(dctPtr[k].x))
843  {
844  out << "null,";
845  }
846  else
847  {
848  out << dctPtr[k].x << ", ";
849  }
850  if(is_vpf_null_double(dctPtr[k].y))
851  {
852  out << "null,";
853  }
854  else
855  {
856  out << dctPtr[k].y << ", ";
857  }
858  }
859  out << std::endl;
860  free(dctPtr);
861  }
862 
863  }
864  case 'K': //id triplet
865  if (table.header[j].count==1)
866  {
867  get_table_element(j,row,table,&kval,&n);
868  out << "(" << kval.id
869  << ", " << kval.tile
870  << ", " << kval.exid
871  << ")" << std::endl;
872  }
873  else
874  {
875  kptr = (id_triplet_type*)get_table_element(j,row,table,NULL,&n);
876  for (k=0;k<n;k++)
877  {
878  out << "(" << kptr[k].id
879  << ", " << kptr[k].tile
880  << ", " << kptr[k].exid
881  << ") " << std::endl;
882 
883  }
884  out << std::endl;
885  free(kptr);
886  }
887  break;
888  case 'D': /* Date */
889  if (table.header[j].count==1)
890  {
891  get_table_element(j,row,table,&dval,&n);
892  format_date(dval,date);
893  out << date << std::endl;
894  }
895  else
896  {
897  dptr = (date_type*)get_table_element(j,row,table,NULL,&n);
898  for (k=0;k<n;k++)
899  {
900  format_date((char*)(&dptr[k]),date);
901  out << dptr[k] << " ";
902  }
903  out << std::endl;
904  free(dptr);
905  }
906  break;
907  }
908  }
909  out << std::endl;
910  free_row( row, table );
911  }
912  }
913 }
vpf_table_type * theTableInformation
Definition: ossimVpfTable.h:81
ossim_uint32 x
void free_row(row_type row, vpf_table_type table)
ossim_int32 id
Definition: vpftable.h:216
void format_date(date_type date, char *fmtdate)
char * name
Definition: vpftable.h:63
ossim_uint32 y
unsigned char status
Definition: vpftable.h:121
float ossim_float32
char description[81]
Definition: vpftable.h:107
header_type header
Definition: vpftable.h:109
#define CLOSED
Definition: vpftable.h:82
os2<< "> n<< " > nendobj n
ossim_int32 tile
Definition: vpftable.h:216
int is_vpf_null_float(float num)
ossim_int32 nrows
Definition: vpftable.h:114
char description[81]
Definition: vpftable.h:64
virtual void reset() const
void * get_table_element(ossim_int32 field_number, row_type row, vpf_table_type table, void *value, ossim_int32 *count)
short ossim_int16
ossim_int32 nfields
Definition: vpftable.h:106
int is_vpf_null_double(double num)
row_type read_next_row(vpf_table_type table)
ossimFilename theTableName
Definition: ossimVpfTable.h:86
ossim_int32 count
Definition: vpftable.h:69
char date_type[21]
Definition: vpftable.h:47
ossim_int32 exid
Definition: vpftable.h:216
char type
Definition: vpftable.h:68
int ossim_int32

◆ reset()

void ossimVpfTable::reset ( void  ) const
virtual

This method will set the row pointer back to the start of the table.

Definition at line 109 of file ossimVpfTable.cpp.

References CLOSED, vpf_table_type::fp, index_pos(), vpf_table_type::status, and theTableInformation.

Referenced by ossimVpfAnnotationFeatureInfo::buildTxtFeature(), getColumnValues(), ossimVpfBoundingRecordTable::openTable(), print(), ossimVpfFeatureClassSchema::setFeatureClassMapping(), and ossimVpfLibrary::setTileNames().

110 {
111  if(theTableInformation &&
113  {
114  long fpos;
115 
116  fpos = index_pos(0, *theTableInformation);
117  fseek(theTableInformation->fp, fpos, SEEK_SET);
118  }
119 }
vpf_table_type * theTableInformation
Definition: ossimVpfTable.h:81
unsigned char status
Definition: vpftable.h:121
ossim_int32 index_pos(ossim_int32 row_number, vpf_table_type table)
#define CLOSED
Definition: vpftable.h:82

Friends And Related Function Documentation

◆ operator<<

OSSIM_DLL std::ostream& operator<< ( std::ostream &  out,
const ossimVpfTable data 
)
friend

Definition at line 19 of file ossimVpfTable.cpp.

21 {
22  data.print(out);
23  return out;
24 }
virtual void print(std::ostream &out) const

Member Data Documentation

◆ theTableInformation

vpf_table_type* ossimVpfTable::theTableInformation
protected

◆ theTableName

ossimFilename ossimVpfTable::theTableName
protected

Will hold the complete path and name to this table.

Definition at line 86 of file ossimVpfTable.h.

Referenced by openTable(), and print().


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