Example #1
0
bool IAttributes::isLockedAttributeColumn(const char *attribute)
{
   AttributeTable *table = (AttributeTable *)m_data;
   int n = table->getColumnIndex(pstring(attribute));
   if (n != -1 && !table->isColumnLocked(n)) {
      return table->isColumnLocked(n);
   }
   // n.b., this should really throw an exception:
   return false;
}
Example #2
0
bool IAttributes::renameAttributeColumn(const char *oldname, const char *newname)
{
   AttributeTable *table = (AttributeTable *)m_data;
   int n = table->getColumnIndex(pstring(oldname));
   if (n != -1 && !table->isColumnLocked(n)) {
      table->renameColumn(n,newname);
      return true;
   }
   return false;
}
Example #3
0
bool IAttributes::insertAttributeColumn(const char *attribute)
{
   if (strcmp(attribute,"Ref Number") != 0) {
      AttributeTable *table = (AttributeTable *)m_data;
      int n = table->getColumnIndex(pstring(attribute));
      if (n == -1 || !table->isColumnLocked(n)) {
         table->insertColumn(pstring(attribute));
         return true;
      }
   }
   return false;
}
Example #4
0
bool IAttributes::deleteAttributeColumn(const char *attribute)
{
   AttributeTable *table = (AttributeTable *)m_data;
   int n = table->getColumnIndex(pstring(attribute));
   if (n != -1 && !table->isColumnLocked(n)) {
      table->removeColumn(n);
      if (n >= table->getDisplayColumn()) {
         // there is a problem here: the associated geometry layer will be out of step when it comes to display
         // this is corrected in "getDisplayedAttribute" (untidy, but works)
         table->setDisplayColumn(n-1,true);
      }
      return true;
   }
   return false;
}