コード例 #1
0
bool rspfVpfFeatureClassSchema::validateColumnNames()const
{
   if(isClosed()) return false;
   return ((getColumnPosition("feature_class")>=0)&&
           (getColumnPosition("table1")>=0)&&
           (getColumnPosition("table1_key")>=0)&&
           (getColumnPosition("table2")>=0)&&
           (getColumnPosition("table2_key")>=0));
}
コード例 #2
0
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);
         }
      }
   }
}
コード例 #3
0
/**
 * @brief       This method has been reimplemented. It manages the following actions:
 *               - Column resizing
 *               - Header button
 *
 * @param[in]   event       Mouse event
 *
 * @return      Nothing.
 */
void AbstractTableView::mousePressEvent(QMouseEvent* event)
{
    if(((event->buttons() & Qt::LeftButton) != 0) && ((event->buttons() & Qt::RightButton) == 0))
    {
        if(mColResizeData.splitHandle == true)
        {
            int wColIndex = getColumnIndexFromX(event->x());
            int wStartPos = getColumnPosition(wColIndex); // Position X of the start of column

            mGuiState = AbstractTableView::ResizeColumnState;

            if(event->x() <= (wStartPos + 2))
            {
                mColResizeData.index = wColIndex - 1;
            }
            else
            {
                mColResizeData.index = wColIndex;
            }

            mColResizeData.lastPosX = event->x();
        }
        else if(mHeader.isVisible && getColumnCount() && (event->y() <= getHeaderHeight()) && (event->y() >= 0))
        {
            int wColIndex = getColumnIndexFromX(event->x());

            //qDebug() << "Button " << wColIndex << "has been pressed.";
            emit headerButtonPressed(wColIndex);

            mColumnList[wColIndex].header.isPressed = true;
            mColumnList[wColIndex].header.isMouseOver = true;

            mHeader.activeButtonIndex = wColIndex;

            mGuiState = AbstractTableView::HeaderButtonPressed;

            updateViewport();
        }
    }

    //QWidget::mousePressEvent(event);
}
コード例 #4
0
bool ossimVpfBoundingRecordTable::openTable(const ossimFilename& tableName)
{
   bool result = false;
   theExtent = ossimVpfExtent(0,0,0,0);
   bool firstOneSetFlag = false;
   
   if(ossimVpfTable::openTable(tableName))
   {
      ossim_int32 xminIdx = getColumnPosition("XMIN");
      ossim_int32 yminIdx = getColumnPosition("YMIN");
      ossim_int32 xmaxIdx = getColumnPosition("XMAX");
      ossim_int32 ymaxIdx = getColumnPosition("YMAX");
      
      if((xminIdx < 0)||
         (yminIdx < 0)||
         (xmaxIdx < 0)||
         (ymaxIdx < 0))
      {
         closeTable();
      }
      else
      {
         if(getNumberOfRows() > 0)
         {
            result = true;
            reset();
            ossim_int32 n = 1;
            
            ossim_float32 xmin;
            ossim_float32 ymin;
            ossim_float32 xmax;
            ossim_float32 ymax;
            
            row_type row;
            for(int rowIdx = 1; rowIdx < getNumberOfRows(); ++rowIdx)
            {
               if(rowIdx == 1)
               {
                  row = read_row(rowIdx,
                                 *theTableInformation);
               }
               else
               {
                  row = read_next_row(*theTableInformation);
               }
               get_table_element(xminIdx,
                                 row,
                                 *theTableInformation,
                                 &xmin,
                                 &n);
               get_table_element(yminIdx,
                                 row,
                                 *theTableInformation,
                                 &ymin,
                                 &n);
               get_table_element(xmaxIdx,
                                 row,
                                 *theTableInformation,
                                 &xmax,
                                 &n);
               get_table_element(ymaxIdx,
                                 row,
                                 *theTableInformation,
                                 &ymax,
                                 &n);
               if(!is_vpf_null_float(xmin)&&
                  !is_vpf_null_float(ymin)&&
                  !is_vpf_null_float(xmax)&&
                  !is_vpf_null_float(ymax))
               {
                  if(!firstOneSetFlag)
                  {
                     theExtent = ossimVpfExtent(xmin,
                                                ymin,
                                                xmax,
                                                ymax);
                     firstOneSetFlag = true;
                  }
                  else
                  {
                     theExtent = theExtent + ossimVpfExtent(xmin,
                                                            ymin,
                                                            xmax,
                                                            ymax);
                  }                  
               }
               free_row(row, *theTableInformation);
            }
         }
      }
   }
   return result;
}
コード例 #5
0
/**
 * @brief       This method has been reimplemented. It manages the following actions:
 *               - Column resizing
 *               - Header button
 *
 * @param[in]   event       Mouse event
 *
 * @return      Nothing.
 */
void AbstractTableView::mouseMoveEvent(QMouseEvent* event)
{
    int wColIndex = getColumnIndexFromX(event->x());
    int wStartPos = getColumnPosition(wColIndex); // Position X of the start of column
    int wEndPos = getColumnPosition(wColIndex) + getColumnWidth(wColIndex); // Position X of the end of column
    bool wHandle = ((wColIndex != 0) && (event->x() >= wStartPos) && (event->x() <= (wStartPos + 2))) || ((event->x() <= wEndPos) && (event->x() >= (wEndPos - 2)));
    if(wColIndex == getColumnCount() - 1 && event->x() > viewport()->width()) //last column
        wHandle = false;

    switch(mGuiState)
    {
    case AbstractTableView::NoState:
    {
        if(event->buttons() == Qt::NoButton)
        {
            bool wHasCursor = cursor().shape() == Qt::SplitHCursor ? true : false;

            if((wHandle == true) && (wHasCursor == false))
            {
                setCursor(Qt::SplitHCursor);
                mColResizeData.splitHandle = true;
                mGuiState = AbstractTableView::ReadyToResize;
            }
            if((wHandle == false) && (wHasCursor == true))
            {
                unsetCursor();
                mColResizeData.splitHandle = false;
                mGuiState = AbstractTableView::NoState;
            }
        }
        else
        {
            QWidget::mouseMoveEvent(event);
        }
    }
    break;

    case AbstractTableView::ReadyToResize:
    {
        if(event->buttons() == Qt::NoButton)
        {
            if((wHandle == false) && (mGuiState == AbstractTableView::ReadyToResize))
            {
                unsetCursor();
                mColResizeData.splitHandle = false;
                mGuiState = AbstractTableView::NoState;
            }
        }
    }
    break;

    case AbstractTableView::ResizeColumnState:
    {
        int delta = event->x() - mColResizeData.lastPosX;
        bool bCanResize = (getColumnWidth(mColResizeData.index) + delta) >= 20;
        if(bCanResize)
        {
            int wNewSize = getColumnWidth(mColResizeData.index) + delta;
            setColumnWidth(mColResizeData.index, wNewSize);
            mColResizeData.lastPosX = event->x();
            updateViewport();
        }
    }
    break;

    case AbstractTableView::HeaderButtonPressed:
    {
        int wColIndex = getColumnIndexFromX(event->x());

        if((wColIndex == mHeader.activeButtonIndex) && (event->y() <= getHeaderHeight()) && (event->y() >= 0))
        {
            mColumnList[mHeader.activeButtonIndex].header.isMouseOver = true;
        }
        else
        {
            mColumnList[mHeader.activeButtonIndex].header.isMouseOver = false;
        }
    }
    break;

    default:
        break;
    }
}