00001 /*************************************************************************** 00002 * SpikeStream Application * 00003 * Copyright (C) 2007 by David Gamez * 00004 * david@davidgamez.eu * 00005 * Version 0.1 * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program; if not, write to the * 00019 * Free Software Foundation, Inc., * 00020 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00021 ***************************************************************************/ 00022 00023 #ifndef LAYERPROPERTIESDIALOG_H 00024 #define LAYERPROPERTIESDIALOG_H 00025 00026 //SpikeStream includes 00027 #include "LayerManager.h" 00028 #include "DBInterface.h" 00029 #include "NeuronGroup.h" 00030 00031 //Qt includes 00032 #include <qdialog.h> 00033 #include <qcombobox.h> 00034 #include <qlineedit.h> 00035 00036 00037 /*! Default value of spacing between neurons. */ 00038 #define DEFAULT_NEURON_SPACING "1" 00039 00040 00041 //---------------------- Layer Properties Dialog -------------------------- 00042 /*! In non-editing mode this gathers information about the layer to be created. 00043 In editing mode it displays information about a layer so that it can be 00044 changed. This dialog is also used to create layers for SIMNOS components 00045 that are designed to connect to an input or output layer of sensors. */ 00046 //------------------------------------------------------------------------- 00047 00048 class LayerPropertiesDialog : public QDialog{ 00049 Q_OBJECT 00050 00051 public: 00052 LayerPropertiesDialog(QWidget *parent, const char *name, bool editMode, NeuronGroup&, DBInterface* netDBInter, DBInterface* devDBInter); 00053 ~LayerPropertiesDialog(); 00054 NeuronGroup getNeuronGroup(); 00055 00056 00057 private slots: 00058 void componentComboChanged(int comboIndex); 00059 void inputLayerComboChanged(int); 00060 void neuronGrpTypeChanged(int currentSelection); 00061 void okButtonPressed(); 00062 00063 00064 private: 00065 //========================== VARIABLES ============================ 00066 /*! Controls whether data from an existing layer is displayed 00067 or layer data is gathered from scratch.*/ 00068 bool editMode; 00069 00070 //Reference to databases 00071 DBInterface* networkDBInterface; 00072 DBInterface* deviceDBInterface; 00073 00074 /*! Stores link between a combo position and a neuron type ID.*/ 00075 map<int, unsigned short> neuronTypePositionMap; 00076 00077 //Pointers to widgets 00078 QLineEdit *nameText; 00079 QComboBox *neurGrpTypeCombo; 00080 QComboBox *neuronTypeCombo; 00081 QLineEdit *lengthText; 00082 QLineEdit *widthText; 00083 QLineEdit *neuronSpacingText; 00084 QLabel* neuronSpacingLabel; 00085 QLineEdit *xPosText; 00086 QLineEdit *yPosText; 00087 QLineEdit *zPosText; 00088 QComboBox* componentCombo; 00089 QComboBox* inputLayerCombo; 00090 QLabel* inputLayerLabel; 00091 QLabel* componentLabel; 00092 00093 /*! Map holding the widths of SIMNOS components.*/ 00094 map<unsigned int, unsigned int> componentWidthMap; 00095 00096 /*! Map holding the lengths of SIMNOS components.*/ 00097 map<unsigned int, unsigned int> componentLengthMap; 00098 00099 /*! Tracks when inputLayerCombo does not have any valid input 00100 layers (only text).*/ 00101 bool noInputLayers; 00102 00103 /*! Tracks whether there are any available components.*/ 00104 bool noComponents; 00105 00106 /*! When neuron type cannot be recognized for an existing layer store 00107 index of it here.*/ 00108 int unknownNeuronTypeIndex; 00109 00110 00111 //========================== METHODS ============================== 00112 /*! Declare copy constructor private so it cannot be used inadvertently.*/ 00113 LayerPropertiesDialog (const LayerPropertiesDialog&); 00114 00115 /*! Declare assignment private so it cannot be used inadvertently.*/ 00116 LayerPropertiesDialog operator = (const LayerPropertiesDialog&); 00117 00118 void fillNeurGrpTypeCombo(); 00119 void loadInputLayers(); 00120 00121 }; 00122 00123 00124 #endif//LAYERPROPERTIESDIALOG_H 00125 00126
1.4.4