void rspfVpfFeatureClassSchema::setFeatureClassMapping()
{
   if(!isClosed())
   {
      rspf_int32 featureIdx = getColumnPosition("feature_class");
      rspf_int32 table1Idx = getColumnPosition("table1");
      rspf_int32 table1KeyIdx = getColumnPosition("table1_key");
      rspf_int32 table2Idx = getColumnPosition("table2");
      rspf_int32 table2KeyIdx = getColumnPosition("table2_key");
      reset();
      if(getNumberOfRows() > 0)
      {
         row_type row;
         const int ROWS = getNumberOfRows();
         for(int rowIdx = 1; rowIdx <= ROWS; ++rowIdx)
         {
            if(rowIdx == 1)
            {
               row = read_row(rowIdx,
                              *theTableInformation);
            }
            else
            {
               row = read_next_row(*theTableInformation);
            }
            rspfFilename primitiveTable =  getColumnValueAsString(row,
                                                                   table2Idx);
            if(rspfVpfFeatureClass::isPrimitive(primitiveTable))
            {
               rspfString primitiveTableKey = getColumnValueAsString(row,
                                                                      table2KeyIdx);
               rspfFilename table = getColumnValueAsString(row,
                                                            table1Idx);
               rspfString tableKey = getColumnValueAsString(row,
                                                             table1KeyIdx);
               rspfString featureClass = getColumnValueAsString(row,
                                                                 featureIdx);
               rspfVpfFeatureClassSchemaNode node(table,
                                                   tableKey,
                                                   primitiveTable,
                                                   primitiveTableKey);
               
               theFeatureClassMap.insert(make_pair(featureClass,
                                                   node));
            }
            
            free_row(row, *theTableInformation);
         }
      }
   }
}
예제 #2
0
std::vector<ossimString> ossimVpfTable::getColumnValues(long columnNumber)const
{
  std::vector<ossimString> result;

   if(theTableInformation &&
      theTableInformation->status == OPENED)
   {
      if(columnNumber >=0 &&
         (columnNumber < theTableInformation->nfields))
      {
         row_type row;
         // start at the first row of the table
         reset();
         for (int rowIndex = 0;
              rowIndex < theTableInformation->nrows;
              ++rowIndex)
         {
            row = read_next_row(*theTableInformation);
            ossimString value = getColumnValueAsString(row,
                                                       columnNumber);
//            value = value.downcase();
            value = value.trim();
            result.push_back(value);
            free_row(row, *theTableInformation);
         }
      }
   }

   return result;
}
예제 #3
0
std::vector<ossimString> ossimVpfTable::getColumnValues(const ossimString& columnName)const
{
  std::vector<ossimString> result;

   if(theTableInformation &&
      theTableInformation->status == OPENED)
   {
      long int columnNumber = table_pos(const_cast<char*>(columnName.c_str()), *theTableInformation);

      if(columnNumber >=0 &&
         (columnNumber < theTableInformation->nfields))
      {
         row_type row;
         // start at the first row of the table
         reset();
         for (int rowIndex = 1;
              rowIndex <= theTableInformation->nrows;
              ++rowIndex)
         {
            row = read_next_row(*theTableInformation);
            ossimString value = getColumnValueAsString(row,
                                                       columnNumber);
      value.trim();
            result.push_back(value);
            free_row(row, *theTableInformation);
         }
      }
   }

   return result;
}
예제 #4
0
ossimString ossimVpfTable::getColumnValueAsString(ossim_int32 rowNumber,
                                                  long columnNumber)const
{
   row_type row = read_row( rowNumber, *theTableInformation);
   ossimString result = getColumnValueAsString(row,
                                               columnNumber);
   free_row(row, *theTableInformation);

   return result;
}
예제 #5
0
ossimString ossimVpfTable::getColumnValueAsString(const ossimString& columnName)
{
   if(theTableInformation &&
      (theTableInformation->status!=CLOSED))
   {
      long int columnNumber = table_pos(const_cast<char*>(columnName.c_str()),
                                        *theTableInformation);
      row_type row = read_next_row(*theTableInformation);
      ossimString result = getColumnValueAsString(row,
                                                  columnNumber);
      free_row(row, *theTableInformation);
      return result;
   }

   return "";
}