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