2
** File: evisdatabaselayerfieldselectiongui.cpp
3
** Author: Peter J. Ersts ( ersts at amnh.org )
4
** Creation Date: 2007-03-07
6
** Copyright ( c ) 2007, American Museum of Natural History. All rights reserved.
8
** This library/program is free software; you can redistribute it
9
** and/or modify it under the terms of the GNU Library General Public
10
** License as published by the Free Software Foundation; either
11
** version 2 of the License, or ( at your option ) any later version.
13
** This library/program is distributed in the hope that it will be useful,
14
** but WITHOUT ANY WARRANTY; without even the implied warranty of
15
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
** Library General Public License for more details.
18
** This work was made possible through a grant by the the John D. and
19
** Catherine T. MacArthur Foundation. Additionally, this program was prepared by
20
** the American Museum of Natural History under award No. NA05SEC46391002
21
** from the National Oceanic and Atmospheric Administration, U.S. Department
22
** of Commerce. The statements, findings, conclusions, and recommendations
23
** are those of the author( s ) and do not necessarily reflect the views of the
24
** National Oceanic and Atmospheric Administration or the Department of Commerce.
28
#include "evisdatabaselayerfieldselectiongui.h"
32
* @param parent - Pointer the to parent QWidget for modality
33
* @param fl - Windown flags
35
eVisDatabaseLayerFieldSelectionGui::eVisDatabaseLayerFieldSelectionGui( QWidget* parent, Qt::WFlags fl )
36
: QDialog( parent, fl )
42
* Public method that will insert the values in fieldList into the x and y coordinate selection combo boxes.
43
* @param fileList - QStringList containing the field names to add to the combo boxes
45
void eVisDatabaseLayerFieldSelectionGui::setFieldList( QStringList* fieldList )
48
int xCoordinateIndex = -1;
49
int yCoordinateIndex = -1;
50
cboxXCoordinate->clear( );
51
cboxYCoordinate->clear( );
53
for ( int x = 0; x < fieldList->size( ); x++ )
55
cboxXCoordinate->addItem( fieldList->at( x ) );
56
cboxYCoordinate->addItem( fieldList->at( x ) );
58
//Take a guess in an attempt to auto select the currect field
59
if ( fieldList->at( x ).contains( QRegExp( "( ^x|^lon|^east )", Qt::CaseInsensitive ) ) )
64
if ( fieldList->at( x ).contains( QRegExp( "( ^y|^lat|^north )", Qt::CaseInsensitive ) ) )
71
cboxXCoordinate->setCurrentIndex( xCoordinateIndex );
72
cboxYCoordinate->setCurrentIndex( yCoordinateIndex );
77
* Public and Private Slots
81
* Slot called when the ok/accept button is pressed
83
void eVisDatabaseLayerFieldSelectionGui::on_buttonBox_accepted( )
85
//emit the signal to draw the layer
86
emit eVisDatabaseLayerFieldsSelected( leLayerName->text( ), cboxXCoordinate->currentText( ), cboxYCoordinate->currentText( ) );
88
//close the gui component
91
//reset the layer name line edit
92
leLayerName->setText( "" );
96
* Slot called then the cancel button is pressed
98
void eVisDatabaseLayerFieldSelectionGui::on_buttonBox_rejected( )
101
leLayerName->setText( "" );