[44d1e60] | 1 | #ifndef MAINWINDOW_H |
---|
| 2 | #define MAINWINDOW_H |
---|
| 3 | |
---|
| 4 | #include <QtGui> |
---|
[8daa049] | 5 | |
---|
[44d1e60] | 6 | #include <formloadmatrix.H> |
---|
| 7 | #include <formviewmatrix.H> |
---|
[9dd61b1] | 8 | #include <formvariablesexogenas.h> |
---|
[8daa049] | 9 | #include <formexportmatrix.h> |
---|
| 10 | #include <formencadenamientos.h> |
---|
[fa3f7a3] | 11 | #include <ui_formcompararresultados.h> |
---|
| 12 | #include <formcompararresultados.h> |
---|
[96b0c4a] | 13 | #include <ui_formcompararmnc.h> |
---|
| 14 | #include <formcompararmnc.h> |
---|
[fc268a0] | 15 | #include "ui_formincidenciai.h" |
---|
| 16 | #include <formincidenciai.h> |
---|
[04999c9] | 17 | #include <formpreciosnohomogeneos.h> |
---|
[8daa049] | 18 | |
---|
[44d1e60] | 19 | #include <sstream> |
---|
| 20 | #include <stackwidget.H> |
---|
[9dd61b1] | 21 | #include <stackvariablesexogenas.h> |
---|
[8daa049] | 22 | #include <stackencadenamientos.h> |
---|
[04999c9] | 23 | #include <stackpreciosnohomogeneos.h> |
---|
[8daa049] | 24 | |
---|
| 25 | #include <QTabWidget> |
---|
| 26 | |
---|
[9dd61b1] | 27 | #include <QMap> |
---|
[8daa049] | 28 | #include <QVector> |
---|
| 29 | |
---|
[96b0c4a] | 30 | #include <Eigen> |
---|
| 31 | |
---|
[44d1e60] | 32 | |
---|
| 33 | class MainWindow : public QMainWindow |
---|
| 34 | { |
---|
| 35 | Q_OBJECT |
---|
| 36 | |
---|
| 37 | QMenu menuFile; |
---|
| 38 | QMenu menuTools; |
---|
| 39 | QMenu menuViews; |
---|
| 40 | QMenu menuHelp; |
---|
[07b8f66] | 41 | |
---|
| 42 | QMenu CoeficientesTecnicos; |
---|
[b1ef0b1] | 43 | QMenu Encadenamientos; |
---|
[fc268a0] | 44 | |
---|
[96b0c4a] | 45 | QMenu Modelos; |
---|
[fc268a0] | 46 | QMenu PHClasico; |
---|
| 47 | QMenu PHClasicoIncidencia; |
---|
[cfbc36f] | 48 | QMenu PHNoClasico; |
---|
| 49 | QMenu PHNoClasicoIncidencia; |
---|
[04999c9] | 50 | QMenu PreciosNH; |
---|
| 51 | QMenu PreciosNHIncidencia; |
---|
[9dd61b1] | 52 | |
---|
[44d1e60] | 53 | QAction actionLoadMatrix; |
---|
| 54 | QAction actionExportMatrix; |
---|
| 55 | QAction actionQuit; |
---|
[fc268a0] | 56 | QAction actionNewProject; |
---|
[9dd61b1] | 57 | |
---|
| 58 | QAction actionCH; |
---|
| 59 | QAction actionCV; |
---|
| 60 | QAction actionVariableExogena; |
---|
[fa3f7a3] | 61 | |
---|
[fc268a0] | 62 | QAction actionEncadenamiento; |
---|
[b1ef0b1] | 63 | QAction actionClasificarCuentas; |
---|
[fc268a0] | 64 | |
---|
[fa3f7a3] | 65 | QAction actionModeloClasico; |
---|
| 66 | QAction actionCompararResultados; |
---|
[67c9f67] | 67 | QAction actionModeloNoClasico; |
---|
[96b0c4a] | 68 | QAction actionCompararResultadosMNC; |
---|
[9dd61b1] | 69 | |
---|
[fc268a0] | 70 | QAction actionPHClasicoIncidencia100; |
---|
| 71 | QAction actionPHCIncidenciaCuenta; |
---|
| 72 | QAction actionPHCIncidenciaComponente; |
---|
| 73 | |
---|
[cfbc36f] | 74 | QAction actionPHNoClasicoIncidencia100; |
---|
| 75 | QAction actionPHNCIncidenciaCuenta; |
---|
| 76 | QAction actionPHNCIncidenciaComponente; |
---|
[9dd61b1] | 77 | |
---|
[04999c9] | 78 | QAction actionPNHIncidencia100; |
---|
| 79 | QAction actionPNHIncidenciaCuenta; |
---|
| 80 | QAction actionPNHIncidenciaComponente; |
---|
| 81 | |
---|
[b1ef0b1] | 82 | QAction actionSeleccionarTabla; |
---|
| 83 | |
---|
[dfddb27] | 84 | QAction actionManual; |
---|
| 85 | QAction actionAcercaDe; |
---|
| 86 | |
---|
[44d1e60] | 87 | QTableWidget * tableWidget; |
---|
[9dd61b1] | 88 | QTabWidget * tabWidget; |
---|
| 89 | QMap<QString,QStringList> diccCuentasExogenas; |
---|
[8daa049] | 90 | QMap<int,QVector<QString> > diccCuentasEndogenas; |
---|
| 91 | QMap<int,QVector<QString> > espacioCuentasExogenas; |
---|
[32f758e] | 92 | QMap<int, QMap<QString,QStringList> > diccCuentasComponentes; |
---|
| 93 | QMap<int, QMap<QString,QStringList> > diccCuentasEncadenamientos; |
---|
[fc268a0] | 94 | QMap<QString,double> totalCuentas; |
---|
| 95 | |
---|
| 96 | QStringList ComponentesEndogenos; |
---|
[9dd61b1] | 97 | |
---|
[96b0c4a] | 98 | QTableWidget *MatrizExgEnd; |
---|
| 99 | |
---|
[9dd61b1] | 100 | stackVariablesExogenas *stackVE; |
---|
[8daa049] | 101 | stackEncadenamientos *stackEncadenamiento; |
---|
[04999c9] | 102 | StackPreciosNoHomogeneos *stackPNH; |
---|
[9dd61b1] | 103 | |
---|
[61e2bc2] | 104 | //Matriz con la tabla principal |
---|
| 105 | Eigen::MatrixXd PrincipalTable; |
---|
| 106 | //Tabla de Exogenas y Endogenas |
---|
| 107 | Eigen::MatrixXd EndogenasyExogenas; |
---|
| 108 | //Tabla del sector B (exogena/endogena) |
---|
| 109 | Eigen::MatrixXd ExoEndo; |
---|
| 110 | //Matriz del Coeficiente Técnico |
---|
| 111 | Eigen::MatrixXd An; |
---|
| 112 | Eigen::MatrixXd MBn; |
---|
| 113 | //Matrices de los múltiplicadores de lontief |
---|
[96b0c4a] | 114 | Eigen::MatrixXd MatrixMa; |
---|
| 115 | Eigen::MatrixXd MatrixMb; |
---|
[fc268a0] | 116 | Eigen::MatrixXd MatrizMat; |
---|
[cfbc36f] | 117 | Eigen::MatrixXd MatrizMbt; |
---|
[96b0c4a] | 118 | |
---|
[44d1e60] | 119 | |
---|
| 120 | QString csvFilePath; |
---|
| 121 | char csvSeparator; |
---|
| 122 | int numAccounts; |
---|
| 123 | int matrixSize; |
---|
[96b0c4a] | 124 | int precission; |
---|
[bd5e45b] | 125 | |
---|
[04999c9] | 126 | QString componentePNH; |
---|
| 127 | |
---|
[4d3d740] | 128 | Eigen::MatrixXd MatrizEndogenaEndogena; |
---|
[8daa049] | 129 | |
---|
[bd5e45b] | 130 | int opcionCuentaExogena; |
---|
| 131 | int opcionVentanaExogena; |
---|
| 132 | int opcionExportarMatriz; |
---|
[8daa049] | 133 | int opcionEncadenamientos; |
---|
| 134 | int opcionCuentaEncadenamientos; |
---|
[fa3f7a3] | 135 | int opcionMa; |
---|
[cfbc36f] | 136 | int opcionMb; |
---|
[fa3f7a3] | 137 | int opcionFormCompararResultados; |
---|
[96b0c4a] | 138 | int opcionFormCompararResultadosMNC; |
---|
[fc268a0] | 139 | int opcionMAT; |
---|
[cfbc36f] | 140 | int opcionMBT; |
---|
[04999c9] | 141 | int opcionPNHT; |
---|
| 142 | int opcionFormPNH; |
---|
[fa3f7a3] | 143 | |
---|
| 144 | QVector<double> subtotalEnd; |
---|
| 145 | QVector<double> subtotalExog; |
---|
[96b0c4a] | 146 | QVector<double> subtotalExogEnd; |
---|
[fc268a0] | 147 | QVector<double> Vpond; |
---|
[8daa049] | 148 | |
---|
[b1ef0b1] | 149 | int cantidadSelecciones; |
---|
[8daa049] | 150 | int cantidadEncadenamientos; |
---|
[fa3f7a3] | 151 | int cantidadEscenarios; |
---|
| 152 | int cantidadResultados; |
---|
[96b0c4a] | 153 | int cantidadMNC;//Cantidad de Modelos No Clasicos |
---|
| 154 | int cantidadResultadosMNC; |
---|
[04999c9] | 155 | //Cantidad de resultados de incidencia en modelo de precios homogéneos clásico |
---|
[fc268a0] | 156 | int cantidadPHCindidenciaiCuenta; |
---|
| 157 | int cantidadPHCindidenciaiComponente; |
---|
[04999c9] | 158 | //Cantidad de resultados de incidencia en modelo de precios homogéneos no clásico |
---|
[cfbc36f] | 159 | int cantidadPHNCindidenciaiCuenta; |
---|
| 160 | int cantidadPHNCindidenciaiComponente; |
---|
[04999c9] | 161 | //Cantidad de resultados de incidencia en modelo de precios no homogéneos |
---|
| 162 | int cantidadPNHincidencia100; |
---|
| 163 | int cantidadPNHincidenciaiCuenta; |
---|
| 164 | int cantidadPNHincidenciaiComponente; |
---|
[44d1e60] | 165 | |
---|
| 166 | FormLoadMatrix * formLoadMatrix; |
---|
| 167 | FormViewMatrix * formViewMatrix; |
---|
[9dd61b1] | 168 | FormVariablesExogenas * formVariablesExogenas; |
---|
[bd5e45b] | 169 | FormExportMatrix * formExportMatriz; |
---|
[8daa049] | 170 | FormEncadenamientos * formEncadenamientos; |
---|
[fa3f7a3] | 171 | FormCompararResultados *formCompararResultados; |
---|
[96b0c4a] | 172 | FormCompararMNC *formCompararMNC; |
---|
[fc268a0] | 173 | FormIncidenciaI *FI; |
---|
[04999c9] | 174 | FormPreciosNoHomogeneos * formPreciosNoHomogeneos; |
---|
[44d1e60] | 175 | |
---|
| 176 | void initGUI(); |
---|
| 177 | |
---|
| 178 | void createCentralWidget(); |
---|
| 179 | void createMatrixCentralWidget(); |
---|
[588814f] | 180 | void loadsAccounts(QTableWidget *); |
---|
| 181 | void hideStackedWidget(); |
---|
[44d1e60] | 182 | |
---|
| 183 | void createMenuBar(); |
---|
[9dd61b1] | 184 | void matricesMenuBar(); |
---|
[44d1e60] | 185 | void populateTable(QTableWidget *); |
---|
[95d916c] | 186 | |
---|
[32f758e] | 187 | void CalcularTotales(QTableWidget *, int inicio, bool &); |
---|
[61e2bc2] | 188 | void TotalPrincipalTable(QTableWidget *, Eigen::MatrixXd & , int init); |
---|
[95d916c] | 189 | bool comprobarNombreCuenta(QString, int indice); |
---|
[9dd61b1] | 190 | void clonarTabla(QTableWidget *,QTableWidget *, int cantidad); |
---|
| 191 | void noEditColZero(QTableWidget *); |
---|
| 192 | void setAccountTitle(QTableWidget *); |
---|
| 193 | void insertremoveRowCol(QTableWidget *, int rowcol, bool opcion); |
---|
[8daa049] | 194 | void crearDiccionario(QTableWidget *, bool endogena=true); |
---|
| 195 | QStringList obtenerCuentasEndogenas(QTableWidget *,QStringList); |
---|
| 196 | QStringList obtenerCuentasExogenas(QTableWidget *,QStringList ); |
---|
| 197 | void spanEndogenaCell(QTableWidget *, int inicio, int celda, bool endex=true); |
---|
| 198 | void spanExogenaCell(QTableWidget *,int celda); |
---|
[e506dab] | 199 | void tableItem(QTableWidget *, int inicio, int fin, QString texto); |
---|
[9dd61b1] | 200 | |
---|
[61e2bc2] | 201 | void TotalEndoExoTable(int elementos, int cantidad); |
---|
| 202 | |
---|
[9dd61b1] | 203 | QList<QString> llenarLista(QList<QString>, QTableWidget *, int valor, int opcion); |
---|
| 204 | void insertRowExogena(QList<QString>, QTableWidget *, int opcion); |
---|
| 205 | void setEndogenaExogenaCell(QTableWidget *, int inicioExogena, int elementos,bool condicion); |
---|
[67c9f67] | 206 | void CalcularAn(QTableWidget *, QTableWidget *, QTableWidget *, int count, bool endogena = false); |
---|
[bd5e45b] | 207 | QString Separador(QTableWidgetItem *,bool quitar); |
---|
[8daa049] | 208 | void ItemsNoEditable(QTableWidget *, int inicio, int fin, int col=0); |
---|
[aa628c3] | 209 | void CellStyle(QTableWidgetItem *); |
---|
[cfdcc67] | 210 | void CellStyleComponente(QTableWidgetItem *); |
---|
| 211 | void CellStyleExEn(QTableWidgetItem *); |
---|
[aa628c3] | 212 | void EndogenaAn(); |
---|
[9dd61b1] | 213 | |
---|
[fc268a0] | 214 | void calcularTotalCuentas(QTableWidget *); |
---|
[b1ef0b1] | 215 | void estimarVectorPonderacion(); |
---|
[fc268a0] | 216 | |
---|
[8daa049] | 217 | void obtenerCuentaComponentes(); |
---|
[fc268a0] | 218 | void crearTablaVaciaEncadenamiento(int filas, QTableWidget *, int columnas=4); |
---|
[8daa049] | 219 | void crearMatrizEncadenamiento(QTableWidget *, QTableWidget *); |
---|
| 220 | void crearMatrizEncadenamientoEndogena(QTableWidget *, QTableWidget *); |
---|
| 221 | void calcularTotalesEncadenamientos(QTableWidget *); |
---|
| 222 | void encademientosStyle(QTableWidgetItem *); |
---|
[32f758e] | 223 | void cuentacomponentesEncadenamiento(QTableWidget *, int count); |
---|
[37dd9aa] | 224 | void obtenerUiUj(QTableWidget *, QVector<double> &, QVector<double> &); |
---|
| 225 | void calcularClasificador(QTableWidget *, QVector<double>, QVector<double>, int init = 2); |
---|
| 226 | void agregarPrimeraCelda(QTableWidget *); |
---|
[8daa049] | 227 | |
---|
[cfbc36f] | 228 | void calcularSubtotal(QTableWidget *,int inicio, int fin,int exogena); |
---|
[96b0c4a] | 229 | void llenarEscenario(QTableWidget *, bool clasico=true); |
---|
[fa3f7a3] | 230 | void calcularFinEscenario(QTableWidget *); |
---|
| 231 | QVector<double> obtenerResultadoEscenario(QVector<double>); |
---|
| 232 | QStringList obtenerNombreResultadoEscenario(); |
---|
| 233 | void crearTablaComparar(QTableWidget *, QTableWidget *); |
---|
[96b0c4a] | 234 | void cuentacomponentesResultado(QTableWidget *, int count, bool clasico = true); |
---|
[fa3f7a3] | 235 | |
---|
[67c9f67] | 236 | void obtenerMatrizExgEnd(); |
---|
| 237 | void crearMatrizExgEnd(QTableWidget *,QTableWidget *,int elementos,int inicioExogena); |
---|
| 238 | void calcularMatrizExgEnd(QTableWidget *); |
---|
| 239 | void ctvMatrizExgEnd(QTableWidget *, QTableWidget *); |
---|
| 240 | void titlespanMatrizExgEnd(QTableWidget *); |
---|
| 241 | void estimarMb(QTableWidget *, QTableWidget *); |
---|
[96b0c4a] | 242 | void calcularSubtotalEndExg(); |
---|
| 243 | QVector<double> obtenerResultadoEscenarioMNC(QVector<double>); |
---|
| 244 | void calcularFinEscenarioMNC(QTableWidget *); |
---|
| 245 | QStringList obtenerNombreResultadoEscenarioMNC(); |
---|
[67c9f67] | 246 | |
---|
[8daa049] | 247 | void restarIdentidadAn(QTableWidget *); |
---|
| 248 | void titleEndogena(QTableWidget *); |
---|
[9dd61b1] | 249 | |
---|
[fc268a0] | 250 | void calcularMaT(); |
---|
| 251 | void calcularPHCIncidencia100(QTableWidget *); |
---|
| 252 | void calcularPHCIncidenciaI(QTableWidget *, QMap<QString, double>); |
---|
| 253 | void calcularPHCIncidenciaIComponente(QTableWidget *,QTableWidget *); |
---|
| 254 | |
---|
[cfbc36f] | 255 | void calcularMbT(); |
---|
| 256 | void calcularMb(); |
---|
[04999c9] | 257 | void calcularPHNCIncidencia100(QTableWidget *); |
---|
| 258 | void calcularVectorSend(QString componente, QVector<double> &); |
---|
| 259 | void multiplicarMatricesPNH(QTableWidget *, QVector<double>); |
---|
| 260 | void calcularPNHIncidencia100(QTableWidget *, Eigen::MatrixXd Diagonal); |
---|
| 261 | void crearFormularioPNH(); |
---|
[32f758e] | 262 | QStringList obtenerCuentas(); |
---|
[cfbc36f] | 263 | |
---|
[b1ef0b1] | 264 | void titleSeleccionar(QTableWidget *); |
---|
| 265 | |
---|
[9dd61b1] | 266 | bool ComprobarCuentas(); |
---|
| 267 | int ObtenerIndice(QString ); |
---|
| 268 | |
---|
| 269 | QStringList ObtenerNombreCuenta(int contador); |
---|
| 270 | QList<int> ObtenerLimitesCuenta(int contador,int opccion); |
---|
| 271 | QStringList ObtenerComponentes(QTableWidget *); |
---|
| 272 | void CrearTablaVacia(int contador,QTableWidget *); |
---|
[44d1e60] | 273 | |
---|
| 274 | protected: |
---|
| 275 | void closeEvent(QCloseEvent *); |
---|
| 276 | |
---|
| 277 | private slots: |
---|
[fc268a0] | 278 | void slotNuevoProyecto(); |
---|
[44d1e60] | 279 | void slotLoadMatrix(); |
---|
| 280 | void slotExportMatrix(); |
---|
[50550b0] | 281 | |
---|
[96b0c4a] | 282 | void slotFormLoadMatrixAccepted(const QString &, int, int); |
---|
[44d1e60] | 283 | void slotFormLoadMatrixClosed(); |
---|
[588814f] | 284 | void slotOnlyaccount(); |
---|
| 285 | void slotOnlycomponent(); |
---|
[44d1e60] | 286 | |
---|
[9dd61b1] | 287 | void AgregarCuenta(); |
---|
| 288 | void RestaurarCeldas(); |
---|
| 289 | void FinalizarCuentas(); |
---|
| 290 | void ModificarCuenta(); |
---|
| 291 | void slotCoeficienteHorizontal(); |
---|
| 292 | void slotCoeficienteVertical(); |
---|
[67c9f67] | 293 | void slotAccChange(); |
---|
[9dd61b1] | 294 | |
---|
| 295 | void slotVariableExogena(); |
---|
| 296 | void slotCloseExogena(); |
---|
| 297 | void slotAgregarExogena(); |
---|
| 298 | void slotFinalizarExogena(); |
---|
| 299 | void slotDeshacerExogena(); |
---|
[fa3f7a3] | 300 | |
---|
| 301 | void slotMa(); |
---|
[9dd61b1] | 302 | |
---|
[8daa049] | 303 | void slotEncadenamientos(); |
---|
| 304 | void slotCloseEncadenamiento(); |
---|
| 305 | void slotAgregarEncadenamiento(); |
---|
| 306 | void slotVerEncadenamiento(); |
---|
[37dd9aa] | 307 | void slotClasificarCuentas(); |
---|
[8daa049] | 308 | |
---|
[bd5e45b] | 309 | void slotCloseExport(); |
---|
| 310 | void slotSaveExport(); |
---|
| 311 | void slotSearchExport(); |
---|
| 312 | |
---|
[fa3f7a3] | 313 | void slotModeloClasico(); |
---|
[96b0c4a] | 314 | void calcularEscenario(bool clasico = true); |
---|
[fa3f7a3] | 315 | void finalizarEscenario(); |
---|
| 316 | |
---|
[67c9f67] | 317 | void slotModeloNoClasico(); |
---|
[96b0c4a] | 318 | void calcularEscenarioNC(); |
---|
| 319 | void finalizarEscenarioNC(); |
---|
| 320 | |
---|
| 321 | void slotCompararResultadosMNC(); |
---|
| 322 | void slotVerResultadoMNC(); |
---|
[67c9f67] | 323 | |
---|
[fc268a0] | 324 | void slotPHCIncidencia100(); |
---|
| 325 | void slotPHCIncidenciaiCuenta(); |
---|
| 326 | void slotCalcularPHCIncidenciaiCuenta(); |
---|
| 327 | void slotPHCIncidenciaiComponente(); |
---|
| 328 | void slotCalcularPHCIncidenciaiComponente(); |
---|
| 329 | |
---|
[fa3f7a3] | 330 | void slotCompararResultados(); |
---|
| 331 | void slotVerResultado(); |
---|
| 332 | |
---|
[cfbc36f] | 333 | void slotPHNCIncidencia100(); |
---|
| 334 | void slotPHNCIncidenciaiCuenta(); |
---|
| 335 | void slotCalcularPHNCIncidenciaiCuenta(); |
---|
| 336 | void slotPHNCIncidenciaiComponente(); |
---|
| 337 | void slotCalcularPHNCIncidenciaiComponente(); |
---|
| 338 | |
---|
[04999c9] | 339 | void slotPNHIncudencia100(); |
---|
| 340 | void slotCloseformPNH(); |
---|
| 341 | void slotSelectPNH(); |
---|
| 342 | void slotPNHIncidenciaiCuenta(); |
---|
| 343 | void slotPNHIncidenciaiComponente(); |
---|
| 344 | void slotSelectPNHi(); |
---|
| 345 | void slotCalcularPNHIncidenciaiCuenta(); |
---|
| 346 | void slotSelectPNHic(); |
---|
| 347 | void slotCalcularPNHIncidenciaiComponente(); |
---|
| 348 | |
---|
[b1ef0b1] | 349 | void slotSeleccionarTabla(); |
---|
| 350 | |
---|
[dfddb27] | 351 | void abrirManual(); |
---|
| 352 | void acercaDe(); |
---|
| 353 | |
---|
[44d1e60] | 354 | public: |
---|
| 355 | MainWindow(); |
---|
| 356 | QString numberFormat(double &); |
---|
[9dd61b1] | 357 | |
---|
[8daa049] | 358 | int contarElementosMap(QMap<QString, QStringList> diccionario); |
---|
[44d1e60] | 359 | }; |
---|
| 360 | |
---|
| 361 | #endif // MAINWINDOW_H |
---|