source: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp @ 985

Revision 985, 73.5 KB checked in by gumbau, 18 years ago (diff)
Line 
1// generated by Fast Light User Interface Designer (fluid) version 2.0100
2
3#include "GeoMeshViewUI.h"
4#include "resource.h"
5#include "GeoLodTreeConstructor.h"
6
7using   namespace       Geometry;
8using   namespace       std;
9
10//---------------------------------------------------------------------------
11//      Menu File Open Callback
12//---------------------------------------------------------------------------
13inline void GeoMeshViewUI::cb_menuFileOpen_i(fltk::Item*, void*)
14{
15        //      Sets menus application state to NONE.
16        mApplicationState       =       NONE;
17
18        //      Loads a mesh file.
19        openMeshFile();
20       
21        //      Deactive Lod strip visualization.
22        geoMeshView->deactiveLodStrip();
23
24        //      Deactive Lod tree visualization.
25        geoMeshView->deactiveLodTree();
26
27        //      Repaint the window.
28        mMainWindow->redraw();
29}
30
31//---------------------------------------------------------------------------
32//      Repaint the FPS label.
33//---------------------------------------------------------------------------
34void    GeoMeshViewUI::refreshFPS(int fps)
35{
36        static char     char_value[10];
37       
38        //      Translate the FPS count to a char value.
39        sprintf(char_value,"FPS %d",fps);
40
41        mFPS->label(char_value);
42
43        //      Repaint the window.
44        mMainWindow->redraw();
45}
46
47void GeoMeshViewUI::cb_menuFileOpen(fltk::Item* o, void* v)
48{
49  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
50                                                                                ->
51                                                                                cb_menuFileOpen_i(o,v);
52}
53
54//---------------------------------------------------------------------------
55//      Save callback
56//---------------------------------------------------------------------------
57inline void GeoMeshViewUI::cb_menuFileSave_i(fltk::Item*, void*)
58{
59        GeoMeshSaver    *mesh_saver;
60
61        //      If there is a mesh object created.
62        if (mGeoMesh    != NULL)
63        {
64                //      Create a mesh saver with mesh bounds.
65                mesh_saver      =       new     GeoMeshSaver();
66
67                //      Save the file mesh.
68                mesh_saver->save(mGeoMesh, mFileName);
69
70                //      Free memory.
71                delete  mesh_saver;
72        }
73}
74
75void GeoMeshViewUI::cb_menuFileSave(fltk::Item* o, void* v)
76{
77  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
78                                                                                ->
79                                                                                cb_menuFileSave_i(o,v);
80}
81
82//---------------------------------------------------------------------------
83//      Save As Callback
84//---------------------------------------------------------------------------
85inline void GeoMeshViewUI::cb_menuOpenSaveAs_i(fltk::Item*, void*)
86{
87        fltk::FileChooser *fcho;
88        GeoMeshSaver                    *mesh_saver;
89       
90        if (mGeoMesh != NULL)
91        {
92                fcho    =       new fltk::FileChooser("",
93                                "*.mesh",
94                                fltk::FileChooser::CREATE,
95                                "Save Mesh as");
96
97                fcho->exec();
98
99                if (fcho->value())
100                {
101                        mesh_saver      =       new     GeoMeshSaver();
102                        mesh_saver->save(mGeoMesh,filename_name(fcho->value()));
103                        delete  mesh_saver;
104                }
105
106                //      Repaint the window.
107                mMainWindow->redraw();
108
109                delete  fcho;
110        }
111}
112
113void GeoMeshViewUI::cb_menuOpenSaveAs(fltk::Item* o, void* v)
114{
115  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
116                                                                                ->
117                                                                                cb_menuOpenSaveAs_i(o,v);
118}
119
120//---------------------------------------------------------------------------
121//      Mesh info callback
122//---------------------------------------------------------------------------
123inline void GeoMeshViewUI::cb_menuMeshInfo_i(fltk::Item*, void*)
124{
125        //      Show title.
126        mProcessTitle->label("Mesh Info");
127
128        showMeshInfo();
129        mMainWindow->redraw();
130}
131
132void GeoMeshViewUI::cb_menuMeshInfo(fltk::Item* o, void* v)
133{
134  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
135                                                                                ->
136                                                                                cb_menuMeshInfo_i(o,v);
137}
138
139//---------------------------------------------------------------------------
140//      Mesh Export to OBJ callback
141//---------------------------------------------------------------------------
142inline void GeoMeshViewUI::cb_menuMeshExportOBJ_i(fltk::Item*, void*)
143{
144        char *p;
145       
146        //      Sets menus application state to NONE.
147        mApplicationState       =       NONE;
148 
149        //      Open file chooser dialog.
150        p       =       fltk::file_chooser("Export to OBJ","*.obj","");
151        if (p && mGeoMesh)
152        {
153                mGeoMesh->exportToOBJ(p);
154        }
155}
156
157void GeoMeshViewUI::cb_menuMeshExportOBJ(fltk::Item* o, void* v)
158{
159  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
160                                                                                ->
161                                                                                cb_menuMeshExportOBJ_i(o,v);
162}
163
164//---------------------------------------------------------------------------
165//      Transform to Shared Vertex callback
166//---------------------------------------------------------------------------
167inline void GeoMeshViewUI::cb_menuTransformSharedVertex_i(fltk::Item*, void*)
168{
169        Mesh    *mesh_aux;
170       
171        //      if the undo mesh is not initialized.
172        if      (mGeoMesh != NULL)
173        {
174                //      Deletes the actual mesh.
175                delete  mUndoMesh;
176
177                mUndoMesh       =       new Mesh();
178
179                //      Restore the previous mesh.
180                *mUndoMesh      =       *mGeoMesh;
181
182                //      Transform NoSV Mesh to a SV Mesh.
183                mesh_aux        =       mGeoMesh->toSharedVertex();
184
185                //      Deletes the mesh No Shared Vertex.
186                delete  mGeoMesh;
187
188                //      Gets the mesh Shared Vertex.
189                mGeoMesh        =       mesh_aux;
190
191                //      Visualize the mesh stripified.
192                geoMeshView->setMesh(mGeoMesh);
193
194                //      Refresh mesh information.
195                showMeshInfo();
196               
197                //      Repaint the window.
198                mMainWindow->redraw();
199        }
200}
201
202void GeoMeshViewUI::cb_menuFileTransformSharedVertex(fltk::Item* o, void* v)
203{
204  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
205                                                                                ->
206                                                                                cb_menuTransformSharedVertex_i(o,v);
207}
208
209//---------------------------------------------------------------------------
210//      Quit Callback
211//---------------------------------------------------------------------------
212inline void GeoMeshViewUI::cb_menuOpenQuit_i(fltk::Item*, void*)
213{
214        delete  this;
215}
216
217void GeoMeshViewUI::cb_menuOpenQuit(fltk::Item* o, void* v)
218{
219  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
220                                                                                ->
221                                                                                cb_menuOpenQuit_i(o,v);
222}
223
224//---------------------------------------------------------------------------
225//      Undo Callback
226//---------------------------------------------------------------------------
227inline void GeoMeshViewUI::cb_menuEditUndo_i(fltk::Item*, void*)
228{
229        //      Undo the mesh changes.
230        undo();
231}
232
233void GeoMeshViewUI::cb_menuEditUndo(fltk::Item* o, void* v)
234{
235  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
236                                                                                ->
237                                                                                cb_menuEditUndo_i(o,v);
238}
239
240//---------------------------------------------------------------------------
241//      Fit Callback
242//---------------------------------------------------------------------------
243inline void GeoMeshViewUI::cb_menuEditFit_i(fltk::Item*, void*)
244{
245        geoMeshView->fit();
246        mMainWindow->redraw();
247}
248
249void GeoMeshViewUI::cb_menuEditFit(fltk::Item* o, void* v)
250{
251  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
252                                                                                ->
253                                                                                cb_menuEditFit_i(o,v);
254}
255
256//---------------------------------------------------------------------------
257//      Rotate Callback
258//---------------------------------------------------------------------------
259inline void GeoMeshViewUI::cb_menuEditRotate_i(fltk::Item       *item, void*)
260{       
261        //      If the item is activated.
262        if (item->value())
263        {
264                menuEditPan->clear_value();
265                geoMeshView->deactivePan();
266               
267                geoMeshView->activeRotate();
268        }
269        else
270        {
271                menuEditPan->set_value();
272                geoMeshView->activePan();
273
274                geoMeshView->deactiveRotate();
275        }
276
277        //      Repaint the main window.
278        mMainWindow->redraw();
279}
280
281void GeoMeshViewUI::cb_menuEditRotate(fltk::Item* o, void* v)
282{
283  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
284                                                                                ->
285                                                                                cb_menuEditRotate_i(o,v);
286}
287
288//---------------------------------------------------------------------------
289//      Pan Callback
290//---------------------------------------------------------------------------
291inline void GeoMeshViewUI::cb_menuEditPan_i(fltk::Item  *item, void*)
292{       
293        //      If the item is activated.
294        if (item->value())
295        {
296                geoMeshView->activePan();
297               
298                menuEditRotate->clear_value();
299                geoMeshView->deactiveRotate();
300        }
301        else
302        {
303                geoMeshView->deactivePan();
304               
305                menuEditRotate->set_value();
306                geoMeshView->activeRotate();
307        }
308
309        //      Repaint the main window.
310        mMainWindow->redraw();
311}
312
313void GeoMeshViewUI::cb_menuEditPan(fltk::Item* o, void* v)
314{
315  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
316                                                                                ->
317                                                                                cb_menuEditPan_i(o,v);
318}
319
320//---------------------------------------------------------------------------
321//      Zoom Callback
322//---------------------------------------------------------------------------
323inline void GeoMeshViewUI::cb_menuEditZoom_i(fltk::Item*, void*)
324{
325}
326
327void GeoMeshViewUI::cb_menuEditZoom(fltk::Item* o, void* v)
328{
329  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
330                                                                                ->
331                                                                                cb_menuEditZoom_i(o,v);
332}
333
334//---------------------------------------------------------------------------
335//      Wire Callback
336//---------------------------------------------------------------------------
337inline void GeoMeshViewUI::cb_menuRenderWire_i(fltk::Item *item, void*)
338{
339        if (item->value())
340        {
341                geoMeshView->activeWire();
342        }
343        else
344        {
345                geoMeshView->deactiveWire();
346        }
347
348        //      Repaint the canvas.
349        //geoMeshView->redraw();
350
351        //      Repaint the main window.
352        mMainWindow->redraw();
353}
354
355void GeoMeshViewUI::cb_menuRenderWire(fltk::Item* o, void* v)
356{
357  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
358                                                                                ->
359                                                                                cb_menuRenderWire_i(o,v);
360}
361
362//---------------------------------------------------------------------------
363//      Solid Callback
364//---------------------------------------------------------------------------
365inline void GeoMeshViewUI::cb_menuRenderSolid_i(fltk::Item      *item, void*)
366{
367        if (item->value())
368        {
369                geoMeshView->activeSolid();
370        }
371        else
372        {
373                geoMeshView->deactiveSolid();
374        }
375                                                                       
376        //      Repaint the canvas.
377        //geoMeshView->redraw();
378       
379        //      Repaint the main window.
380        mMainWindow->redraw();
381}
382
383void GeoMeshViewUI::cb_menuRenderSolid(fltk::Item* o, void* v)
384{
385  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
386                                                                                ->
387                                                                                cb_menuRenderSolid_i(o,v);
388}
389
390//---------------------------------------------------------------------------
391//      CW callback
392//---------------------------------------------------------------------------
393inline void GeoMeshViewUI::cb_menuRenderCW_i(fltk::Item *item, void*)
394{
395        //      Clear the CCW state.
396        menuRenderCCW->clear_value();
397        geoMeshView->deactiveCCW();
398       
399        //      If the item is activated.
400        if (item->value())
401        {
402                geoMeshView->activeCW();
403        }
404        else
405        {
406                geoMeshView->deactiveCW();
407        }
408
409        //      Repaint the main window.
410        mMainWindow->redraw();
411}
412
413void GeoMeshViewUI::cb_menuRenderCW(fltk::Item* o, void* v)
414{
415  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
416                                                                                ->
417                                                                                cb_menuRenderCW_i(o,v);
418}
419
420//---------------------------------------------------------------------------
421//      CCW callback
422//---------------------------------------------------------------------------
423inline void GeoMeshViewUI::cb_menuRenderCCW_i(fltk::Item        *item, void*)
424{
425        //      Clear the CW state.
426        menuRenderCW->clear_value();
427        geoMeshView->deactiveCW();
428       
429        //      If the item is activated.
430        if (item->value())
431        {
432                geoMeshView->activeCCW();
433        }
434        else
435        {
436                geoMeshView->deactiveCCW();
437        }
438
439        //      Repaint the main window.
440        mMainWindow->redraw();
441}
442
443void GeoMeshViewUI::cb_menuRenderCCW(fltk::Item* o, void* v)
444{
445  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
446                                                                                ->
447                                                                                cb_menuRenderCCW_i(o,v);
448}
449
450//---------------------------------------------------------------------------
451//      Flat callback
452//---------------------------------------------------------------------------
453inline void GeoMeshViewUI::cb_menuRenderFlat_i(fltk::Item*, void*)
454{
455        //      Deactive smooth flag.
456        menuRenderSmooth->clear_value();
457       
458        //      Sets flat lighting.
459        geoMeshView->flat();
460
461        //      Repaint the main window.
462        mMainWindow->redraw();
463}
464
465void GeoMeshViewUI::cb_menuRenderFlat(fltk::Item* o, void* v)
466{
467  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
468                                                                                ->
469                                                                                cb_menuRenderFlat_i(o,v);
470}
471
472//---------------------------------------------------------------------------
473//      Smooth Callback
474//---------------------------------------------------------------------------
475inline void GeoMeshViewUI::cb_menuRenderSmooth_i(fltk::Item*, void*)
476{
477        //      Deactive flat flag.
478        menuRenderFlat->clear_value();
479
480        //      Sets smooth lighting.
481        geoMeshView->smooth();
482
483        //      Repaint the main window.
484        mMainWindow->redraw();
485}
486
487void GeoMeshViewUI::cb_menuRenderSmooth(fltk::Item* o, void* v)
488{
489  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
490                                                                                ->
491                                                                                cb_menuRenderSmooth_i(o,v);
492}
493
494//---------------------------------------------------------------------------
495//      Textures callback
496//---------------------------------------------------------------------------
497inline void GeoMeshViewUI::cb_menuRenderTextures_i(fltk::Item*, void*)
498{
499        //      Repaint the main window.
500        mMainWindow->redraw();
501}
502
503void GeoMeshViewUI::cb_menuRenderTextures(fltk::Item* o, void* v)
504{
505  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
506                                                                                ->
507                                                                                cb_menuRenderTextures_i(o,v);
508}
509
510//---------------------------------------------------------------------------
511//      Stripify Callback
512//---------------------------------------------------------------------------
513inline void GeoMeshViewUI::cb_menuStripify_i(fltk::Item*, void*)
514{
515        //      Show title.
516        mProcessTitle->label("Stripify");
517        mProcessBar->position(0);
518
519        //      Hide the right panel.
520        hideRightPanel();
521
522        //      Show the stripify panel.
523        showStripify();
524       
525        //      Sets menus application state to STRIPIFY.
526        mApplicationState       =       STRIPIFY;
527
528        //      Repaint the window.
529        mMainWindow->redraw();
530}
531
532void GeoMeshViewUI::cb_menuStripify(fltk::Item* o, void* v)
533{
534  ((GeoMeshViewUI*)     (o->parent()->parent()->user_data()))
535                                                                                ->
536                                                                                cb_menuStripify_i(o,v);
537}
538
539//---------------------------------------------------------------------------
540//      Simplify Callback
541//---------------------------------------------------------------------------
542inline void GeoMeshViewUI::cb_menuSimplify_i(fltk::ItemGroup*, void*)
543{
544}
545
546void GeoMeshViewUI::cb_menuSimplify(fltk::ItemGroup* o, void* v)
547{
548  ((GeoMeshViewUI*)     (o->parent()->parent()->user_data()))
549                                                                                ->
550                                                                                cb_menuSimplify_i(o,v);
551}
552
553//---------------------------------------------------------------------------
554//      Edge collapse Callback
555//---------------------------------------------------------------------------
556inline void GeoMeshViewUI::cb_menuSimplifyEdgeCollapse_i(fltk::Item*, void*)
557{
558        //      Show title.
559        mProcessTitle->label("Mesh Simplification");
560        mProcessBar->position(0);
561
562        //      Hide the right panel.
563        hideRightPanel();
564
565        //      Show the edge collapse panel.
566        showEdgeCollapse();
567       
568        //      Sets menus application state to EDGE_COLLAPSE.
569        mApplicationState       =       EDGE_COLLAPSE;
570
571        //      Repaint the window.
572        mMainWindow->redraw();
573
574}
575
576void GeoMeshViewUI::cb_menuSimplifyEdgeCollapse(fltk::Item* o, void* v)
577{
578  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
579                                                                                ->
580                                                                                cb_menuSimplifyEdgeCollapse_i(o,v);
581}
582
583//---------------------------------------------------------------------------
584//      Leaves collapse Callback
585//---------------------------------------------------------------------------
586inline void GeoMeshViewUI::cb_menuSimplifyLeavesCollapse_i(fltk::Item*, void*)
587{
588        //      Show title.
589        mProcessTitle->label("Leaves Simplification");
590        mProcessBar->position(0);
591
592        //      Hide the right panel.
593        hideRightPanel();
594
595        //      Show the leaves collapse panel.
596        showLeavesCollapse();
597       
598        //      Sets menus application state to LEAVES_COLLAPSE.
599        mApplicationState       =       LEAVES_COLLAPSE;
600
601        //      Repaint the window.
602        mMainWindow->redraw();
603}
604
605void GeoMeshViewUI::cb_menuSimplifyLeavesCollapse(fltk::Item* o, void* v)
606{
607  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
608                                                                                ->
609                                                                                cb_menuSimplifyLeavesCollapse_i(o,v);
610}
611
612//---------------------------------------------------------------------------
613//      Tree select leaves simplification Callback
614//---------------------------------------------------------------------------
615inline void GeoMeshViewUI::cb_menuSelectLeaves_i(fltk::Item*, void*)
616{
617        //      Show title.
618        mProcessTitle->label("Select Leaves");
619
620        showMeshInfo();
621        mButtonProcess->show();
622        mButtonProcess->activate();
623        mApplicationState       =       SELECT_LEAVES;
624}
625
626void GeoMeshViewUI::cb_menuSelectLeaves(fltk::Item* o, void* v)
627{
628  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
629                                                                                ->
630                                                                                cb_menuSelectLeaves_i(o,v);
631}
632
633//---------------------------------------------------------------------------
634//      Auto Generate LodStrips Callback
635//---------------------------------------------------------------------------
636inline void GeoMeshViewUI::cb_menuLodStripsGenerate_i(fltk::Item*, void*)
637{
638        //      Show title.
639        mProcessTitle->label("Generate LodStrips");
640        mProcessBar->position(0);
641        mBuildBar->position(0);
642
643        //      Hide the right panel.
644        hideRightPanel();
645
646        //      Show the LodStrips panel.
647        showAutoGenerateLodStrips();
648       
649        //      Sets menus application state to LODSTRIPS_AUTO.
650        mApplicationState       =       LODSTRIPS_AUTO;
651
652        //      Repaint the window.
653        mMainWindow->redraw();
654}
655
656void GeoMeshViewUI::cb_menuLodStripsGenerate(fltk::Item* o, void* v)
657{
658  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
659                                                                                ->
660                                                                                cb_menuLodStripsGenerate_i(o,v);
661}
662
663//---------------------------------------------------------------------------
664//      Auto Generate LodStrips Callback
665//---------------------------------------------------------------------------
666inline void GeoMeshViewUI::cb_menuLodTreesGenerate_i(fltk::Item*, void*)
667{
668        //      Show title.
669        mProcessTitle->label("Generate LodTree");
670        mProcessBar->position(0);
671        mBuildBar->position(0);
672
673        //      Hide the right panel.
674        hideRightPanel();
675
676        //      Show the LodStrips panel.
677        showAutoGenerateLodTrees();
678       
679        //      Sets menus application state to LODSTRIPS_AUTO.
680        mApplicationState       =       LODTREES_AUTO;
681
682        //      Repaint the window.
683        mMainWindow->redraw();
684}
685
686void GeoMeshViewUI::cb_menuLodTreesGenerate(fltk::Item* o, void* v)
687{
688  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
689                                                                                ->
690                                                                                cb_menuLodTreesGenerate_i(o,v);
691}
692
693
694//---------------------------------------------------------------------------
695//      Visualize LodStrips Callback
696//---------------------------------------------------------------------------
697inline void GeoMeshViewUI::cb_menuLodStripsVisualize_i(fltk::Item*, void*)
698{
699        fltk::FileChooser *fcho;
700        const   char                            *lod_file;
701       
702        //      Sets menus application state to NONE.
703        mApplicationState       =       NONE;
704
705        //      Deactive Lod strip visualization.
706        geoMeshView->deactiveLodStrip();
707        geoMeshView->deactiveLodTree();
708
709        //      Loads a mesh file.
710        openMeshFile();
711       
712        //      Show title.
713        mProcessTitle->label("Visualize LodStrips");
714
715        //      If an object is loaded.
716        if (mGeoMesh != NULL)
717        {
718                fcho    =       new fltk::FileChooser("",
719                                "*.lod",
720                                fltk::FileChooser::CREATE,
721                                "Open Lod file");
722
723                fcho->exec();
724
725                //      If a file was selected.
726                if (fcho->value())
727                {
728                        //      Build lod strips library.
729                        setLodStripsLibrary(string(fcho->value()), mGeoMesh);
730
731                        //      Sets the aplication mode.
732                        mApplicationState       =       VISUALIZE_LODSTRIPS;
733                }
734
735                //      Free memory.
736                delete  fcho;
737        }
738
739        //      Hide the right panel.
740        hideRightPanel();
741
742        //      Show the Visulize LodStrips panel.
743        showLodStripSlider();
744       
745        //      Repaint the window.
746        mMainWindow->redraw();
747}
748
749
750inline void GeoMeshViewUI::cb_menuLodTreesVisualize_i(fltk::Item*, void*)
751{
752        fltk::FileChooser *fcho;
753        const   char                            *lod_file;
754       
755        //      Sets menus application state to NONE.
756        mApplicationState       =       NONE;
757
758        //      Deactive Lod strip visualization.
759        geoMeshView->deactiveLodTree();
760        geoMeshView->deactiveLodStrip();
761
762        //      Loads a mesh file.
763        openMeshFile();
764       
765        //      Show title.
766        mProcessTitle->label("Visualize LodTrees");
767
768        /*if (geoMeshView->getLeavesSubmesh()==-1)
769        {
770                fltk::alert("No se ha seleccionado el submesh de hojas!");
771                return;
772        }*/
773
774        // POR AHORA SE SELECCIONA EL PRIMER SUBMESH QUE NO ES STRIPS COMO HOJAS
775        int leafsSubMeshID = -1;
776        for (int i=0; i<mGeoMesh->mSubMeshCount; i++)
777                if (mGeoMesh->mSubMesh[i].mType==GEO_TRIANGLE_LIST)
778                {
779                        leafsSubMeshID=i;
780                        break;
781                }
782
783
784
785        //      If an object is loaded.
786        if (mGeoMesh != NULL)
787        {
788                fcho    =       new fltk::FileChooser("",
789                                "*.lod",
790                                fltk::FileChooser::CREATE,
791                                "Open Lod file");
792
793                fcho->exec();
794
795                //      If a file was selected.
796                if (fcho->value())
797                {
798                        //      Build lod strips library.
799
800                        std::string lodstripFile(fcho->value());
801                        delete fcho;
802                        fcho    =       new fltk::FileChooser("",
803                                        "*.leafseq",
804                                        fltk::FileChooser::CREATE,
805                                        "Open LeafSeq file");
806
807                        fcho->exec();
808
809                        if (fcho->value())
810                        {
811                                std::string leafseqFile(fcho->value());
812
813                                setLodTreesLibrary(lodstripFile, leafseqFile, mGeoMesh, leafsSubMeshID);
814
815                                //      Sets the aplication mode.
816                                mApplicationState       =       VISUALIZE_LODTREES;
817                        }
818                }
819
820                //      Free memory.
821                delete  fcho;
822        }
823
824        //      Hide the right panel.
825        hideRightPanel();
826
827        //      Show the Visulize LodTree panel.
828        showLodStripSlider();
829        showLodTreeSlider();
830       
831        //      Repaint the window.
832        mMainWindow->redraw();
833}
834void GeoMeshViewUI::cb_menuLodTreesVisualize(fltk::Item *o, void *v)
835{
836  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
837                                                                                ->
838                                                                                cb_menuLodTreesVisualize_i(o,v);
839}
840
841void GeoMeshViewUI::cb_menuLodStripsVisualize(fltk::Item* o, void* v)
842{
843  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
844                                                                                ->
845                                                                                cb_menuLodStripsVisualize_i(o,v);
846}
847
848//---------------------------------------------------------------------------
849//      Open LodStrip trunk Callback
850//---------------------------------------------------------------------------
851inline void GeoMeshViewUI::cb_menuLodTreesOpenLodStripTrunk_i(fltk::Item*, void*)
852{
853}
854
855void GeoMeshViewUI::cb_menuLodTreesOpenLodStripTrunk(fltk::Item* o, void* v)
856{
857  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
858                                                                                ->
859                                                                                cb_menuLodTreesOpenLodStripTrunk_i(o,v);
860}
861
862//---------------------------------------------------------------------------
863//      Open leaves simplification Callback
864//---------------------------------------------------------------------------
865inline void GeoMeshViewUI::cb_menuLodTreesOpenLeavesSimplification_i(fltk::Item*, void*)
866{
867        //      Hide the right panel.
868        hideRightPanel();
869
870        //      Show the LodTrees panel.
871        showOpenLeavesSimplification();
872
873        //      Sets menus application state to LODTREES.
874        mApplicationState       =       LODTREES;
875
876        //      Repaint the window.
877        mMainWindow->redraw();
878}
879
880void GeoMeshViewUI::cb_menuLodTreesOpenLeavesSimplification(fltk::Item* o, void* v)
881{
882  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
883                                                                                ->
884                                                                                cb_menuLodTreesOpenLeavesSimplification_i(o,v);
885}
886
887
888
889//---------------------------------------------------------------------------
890//      About Callback
891//---------------------------------------------------------------------------
892inline void GeoMeshViewUI::cb_menuHelpAbout_i(fltk::Item*, void*)
893{
894        new     GTAboutDialog();
895}
896
897void GeoMeshViewUI::cb_menuHelpAbout(fltk::Item* o, void* v)
898{
899  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
900                                                                                ->
901                                                                                cb_menuHelpAbout_i(o,v);
902}
903
904//---------------------------------------------------------------------------
905//      Button Process Callback
906//---------------------------------------------------------------------------
907inline void GeoMeshViewUI::cb_mButtonProcess_i(fltk::Button*, void*)
908{
909        bool    error;
910        Mesh    *mesh_aux;
911       
912        //      Sets the progress bar to process bar.
913        progressBarType =       PROCESS;
914        mProcessBar->position(0);
915
916        //      Initialize error flag.
917        error   =       false;
918       
919        //      If there is a mesh object.
920        if (mGeoMesh != NULL)
921        {
922                //      Choose between aplication state.
923                switch(mApplicationState)
924                {
925                        //      Stripify state.
926                        case    STRIPIFY:
927
928                                //      Stripify the mesh object.
929                                stripify();
930
931                                break;
932
933                                //      Simplify edge collapse state.
934                        case    EDGE_COLLAPSE:
935
936                                //      Check submeshes for triangles strips.
937                                for (int i = 0; i < mGeoMesh->mSubMeshCount; i++)
938                                {
939                                        //      If current submesh is in triangle strips.
940                                        if (mGeoMesh->mSubMesh[i].mType == GEO_TRIANGLE_STRIPS)
941                                        {
942                                                error   =       true;
943                                        }
944                                }
945                               
946                                //      if the mesh is stripified.
947                                if (error)
948                                {
949                                        fltk::alert("Can't simplify a mesh in triagle strips.");
950                                }
951                                else
952                                {
953                                        //      Simplify the mesh object.
954                                        simplifyEdgeCollapse();
955                                       
956                                        delete  mMeshSimplifier;
957                                        geoMeshView->restoreContext();
958                                }
959                                break;
960
961                                // Simplify leaves
962                        case    LEAVES_COLLAPSE:
963
964                                //      Simplify the mesh object.
965                                simplifyLeavesCollapse();
966
967                                //      Create the leaves simplification sequence.
968                                createLeavesSequence("leavesSimplification.txt");
969                               
970                                break;
971
972                                //      Simplify and generate simplification sequence.
973                        case    LODTREES_AUTO:
974                                if (idMeshLeaves==(unsigned short)-1)
975                                {
976                                        fltk::alert("Leaves submesh not selected!");
977                                }
978                                else
979                                {
980                                        std::cout << "Simplificando hojas...";
981                                        simplifyLeavesCollapse();
982                                        std::cout << "OK!" << std::endl;
983
984//                                      std::cout << "Creando secuencia de simplificacion de hojas...";
985//                                      createLeavesSequence("leavesSimplification.txt");
986//                                      std::cout << "OK!" << std::endl;
987
988                                        undo();
989
990
991                                        std::cout << "Simplificando tronco...";
992                                        std::cout << "OK!" << std::endl;
993
994                                        //      Transform NoSV Mesh to a SV Mesh.
995                                        mesh_aux        =       mGeoMesh->toSharedVertex();
996
997                                        //      Deletes the mesh No Shared Vertex.
998                                        delete  mGeoMesh;
999
1000                                        //      Gets the mesh Shared Vertex.
1001                                        mGeoMesh        =       mesh_aux;
1002
1003                                        geoMeshView->setMesh(mGeoMesh);
1004
1005                                        //      Simplify the mesh object.
1006                                        simplifyEdgeCollapse();
1007
1008                                        //      Create the simplification sequence.
1009                                        createSimplificationSequence();
1010
1011                                }
1012                               
1013                                break;
1014
1015                        case    LODSTRIPS_AUTO:
1016
1017                                //      Check submeshes for triangles strips.
1018                                for (int i = 0; i < mGeoMesh->mSubMeshCount; i++)
1019                                {
1020                                        //      If current submesh is in triangle strips.
1021                                        if (mGeoMesh->mSubMesh[i].mType == GEO_TRIANGLE_STRIPS)
1022                                        {
1023                                                error   =       true;
1024                                        }
1025                                }
1026                               
1027                                //      if the mesh is stripified.
1028                                if (error)
1029                                {
1030                                        fltk::alert("Can't simplify a mesh in triagle strips.");
1031                                }
1032                                else
1033                                {
1034                                        //      Transform NoSV Mesh to a SV Mesh.
1035                                        mesh_aux        =       mGeoMesh->toSharedVertex();
1036
1037                                        //      Deletes the mesh No Shared Vertex.
1038                                        delete  mGeoMesh;
1039
1040                                        //      Gets the mesh Shared Vertex.
1041                                        mGeoMesh        =       mesh_aux;
1042
1043                                        //      Simplify the mesh object.
1044                                        simplifyEdgeCollapse();
1045
1046                                        //      Create the simplification sequence.
1047                                        createSimplificationSequence();
1048                                       
1049                                        delete  mMeshSimplifier;
1050                                        geoMeshView->restoreContext();
1051                                }
1052
1053                                break;
1054
1055                                // Añadido 23-12-2005
1056                        case    SELECT_LEAVES:
1057
1058                                idMeshLeaves    =       paintMesh();
1059
1060                                //      Set the leaves submesh.
1061                                geoMeshView->setLeavesSubMesh(idMeshLeaves);
1062
1063                                //      Refresh mesh info.
1064                                showMeshInfo();
1065
1066                                break;
1067                }
1068
1069                //      Refresh geometry attributes.
1070                refreshApplicationBar();
1071        }
1072       
1073        //      Repaint the GL Window.
1074        mMainWindow->redraw();
1075}
1076
1077void GeoMeshViewUI::cb_mButtonProcess(fltk::Button* o, void* v)
1078{
1079  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
1080                                                                                ->
1081                                                                                cb_mButtonProcess_i(o,v);
1082}
1083
1084//---------------------------------------------------------------------------
1085//      Button Sort Callback
1086//---------------------------------------------------------------------------
1087inline void GeoMeshViewUI::cb_mButtonSort_i(fltk::Button*, void*)
1088{
1089}
1090
1091void GeoMeshViewUI::cb_mButtonSort(fltk::Button* o, void* v)
1092{
1093  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
1094                                                                                ->
1095                                                                                cb_mButtonSort_i(o,v);
1096}
1097
1098//---------------------------------------------------------------------------
1099//      Button Build Callback
1100//---------------------------------------------------------------------------
1101inline void GeoMeshViewUI::cb_mButtonBuild_i(fltk::Button*, void*)
1102{
1103        char                    *file_name=NULL;
1104        GeoMeshSaver    *mesh_saver;
1105        Serializer              *oSerializer;
1106       
1107        //      Sets the progress bar to process bar.
1108        progressBarType =       BUILD;
1109
1110        //      Reset the build bar.
1111        mBuildBar->position(0);
1112
1113        //      If there is a mesh object.
1114        if (mGeoMesh != NULL)
1115        {
1116                //      Choose between aplication state.
1117                switch(mApplicationState)
1118                {
1119                        //      Build the LOD file.
1120                        case    LODTREES_AUTO:                 
1121                               
1122                                //      Open file chooser dialog.
1123                                file_name       =       fltk::file_chooser("Build LOD","*","");
1124                                if (!file_name)
1125                                        break;
1126
1127                                std::cout << "Creando secuencia de simplificacion de hojas...";
1128                                createLeavesSequence(file_name+std::string(".leafseq"));
1129                                std::cout << "OK!" << std::endl;
1130
1131/*                              TreeSimplificationSequence * auxTreeSimpSequence = new TreeSimplificationSequence();
1132                                auxTreeSimpSequence->Load(Serializer("leavesSimplification.txt",Serializer::READ));
1133
1134                                if (auxTreeSimpSequence && mGeoMesh)
1135                                {
1136                                        LodTreeConstructor * auxLodTreeConstructor = new LodTreeConstructor(mGeoMesh,auxTreeSimpSequence);
1137                                        delete auxLodTreeConstructor;
1138                                }
1139                                else
1140                                {
1141                                        fltk::alert("There is no leaf simplification sequence.");
1142                                        break;
1143                                }
1144
1145
1146                                delete auxTreeSimpSequence;*/
1147                               
1148
1149                        case    LODSTRIPS_AUTO:
1150
1151                                // Builder                                     
1152                                if (!file_name)
1153                                        file_name       =       fltk::file_chooser("Build LOD","*","");
1154                                //      If a file was selected.
1155                                if (file_name)
1156                                {
1157                                        //      Undo the simplification changes.
1158                                        undo();
1159
1160                                        //      Stripify the mesh object.
1161                                        stripify();
1162
1163                                        //      Reset the build bar.
1164                                        mBuildBar->position(0);
1165
1166                                        //      Simplification sequence.
1167                                        oMeshSimpSequence = new MeshSimplificationSequence();
1168
1169                                        //      Loads a simplification sequence file.
1170                                        oMeshSimpSequence->Load(Serializer("SimplifSequence.txt",Serializer::READ));
1171
1172                                        //      If the simplification sequence and the mesh exist.
1173                                        if (oMeshSimpSequence && mGeoMesh)
1174                                        {
1175                                                oLodStrip               =       new LodStripsConstructor(       mGeoMesh,
1176                                                                oMeshSimpSequence,
1177                                                                idMeshLeaves,
1178                                                                progress_function);
1179
1180                                                oSerializer     =       new Serializer(strcat(file_name,".lod"),Serializer::Mode::WRITE);
1181
1182                                                oLodStrip->Save(*oSerializer);
1183
1184                                                //      Close file.
1185                                                delete  oSerializer;
1186
1187                                                //      Deletes the previous mesh.
1188                                                delete mUndoMesh;
1189
1190                                                mUndoMesh       =       new Mesh();
1191
1192                                                //      Sets the undo mesh.
1193                                                *mUndoMesh      =       *mGeoMesh;
1194
1195                                                delete  mGeoMesh;
1196
1197                                                mGeoMesh        =       oLodStrip->GetMesh();
1198
1199                                                geoMeshView->setMesh(mGeoMesh);
1200
1201                                                mesh_saver      =       new     GeoMeshSaver();
1202                                                file_name[strlen(file_name) - 4]        =       '\0';
1203                                                mesh_saver->save(mGeoMesh, strcat(file_name,".mesh"));
1204                                                delete  mesh_saver;
1205
1206                                        }
1207                                        else
1208                                        {
1209                                                //      Error message.
1210                                                fltk::alert("There is no simplification sequence.");
1211                                        }
1212
1213                                        //      Deletes the siplification sequence object.
1214                                        delete  oMeshSimpSequence;
1215                                }
1216                                break;
1217                }
1218                //      Refresh data aplication.
1219                refreshApplicationBar();
1220        }       
1221}
1222
1223void GeoMeshViewUI::cb_mButtonBuild(fltk::Button        *o, void        *v)
1224{
1225  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
1226                                                                                ->
1227                                                                                cb_mButtonBuild_i(o,v);
1228}
1229
1230//---------------------------------------------------------------------------
1231//      Lod Slider Callback
1232//---------------------------------------------------------------------------
1233inline void GeoMeshViewUI::cb_mLodStripSlider_i(fltk::Slider    *o, void        *)
1234{
1235        //      Change the lod.
1236        geoMeshView->GoToLod_LodStrip((unsigned int)o->value());
1237
1238        //      Refresh data aplication.
1239        refreshApplicationBar();
1240               
1241        mMainWindow->flush();
1242}
1243
1244void GeoMeshViewUI::cb_mLodStripSlider(fltk::Slider     *o, void        *v)
1245{
1246  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
1247                                                                                ->
1248                                                                                cb_mLodStripSlider_i(o,v);
1249}
1250
1251
1252//---------------------------------------------------------------------------
1253//      Lod Slider Callback for the foliage
1254//---------------------------------------------------------------------------
1255inline void GeoMeshViewUI::cb_mLodTreeSlider_i(fltk::Slider     *o, void        *)
1256{
1257        //      Change the lod.
1258        geoMeshView->GoToLod_LodTree((unsigned int)o->value());
1259
1260        //      Refresh data aplication.
1261        refreshApplicationBar();
1262               
1263        mMainWindow->flush();
1264}
1265
1266void GeoMeshViewUI::cb_mLodTreeSlider(fltk::Slider      *o, void        *v)
1267{
1268  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
1269                                                                                ->
1270                                                                                cb_mLodTreeSlider_i(o,v);
1271}
1272
1273
1274
1275//---------------------------------------------------------------------------
1276//      Mesh Info Callback
1277//---------------------------------------------------------------------------
1278inline void GeoMeshViewUI::cb_mMeshInfo_i(fltk::Browser *, void *)
1279{       
1280        paintMesh();
1281}
1282
1283void GeoMeshViewUI::cb_mMeshInfo(fltk::Browser* o, void* v)
1284{
1285  ((GeoMeshViewUI*)     (o->parent()->parent()->parent()->user_data()))
1286                                                                                ->
1287                                                                                cb_mMeshInfo_i(o,v);
1288}
1289
1290//---------------------------------------------------------------------------
1291//      Logo Callback
1292//---------------------------------------------------------------------------
1293inline void GeoMeshViewUI::cb_mLogo_i(fltk::InvisibleBox*, void*)
1294{
1295}
1296
1297void GeoMeshViewUI::cb_mLogo(fltk::InvisibleBox* o, void* v)
1298{
1299  ((GeoMeshViewUI*)     (o->parent()->parent()->user_data()))
1300                                                                                ->
1301                                                                                cb_mLogo_i(o,v);
1302}
1303
1304//---------------------------------------------------------------------------
1305//      Show the stripify panel
1306//---------------------------------------------------------------------------
1307void    GeoMeshViewUI::showStripify()
1308{
1309        /*
1310        mTypeLabel->set_visible();
1311        mTypeLabel->activate();
1312
1313        mOneCacheStrip->set_visible();
1314        mOneCacheStrip->activate();
1315
1316        mQualityStrips->set_visible();
1317        mQualityStrips->activate();
1318        */
1319
1320        mButtonProcess->set_visible();
1321        mButtonProcess->activate();
1322
1323        mProcessBar->set_visible();
1324        mProcessBar->activate();
1325}
1326
1327//---------------------------------------------------------------------------
1328//      Hide the stripify panel
1329//---------------------------------------------------------------------------
1330void    GeoMeshViewUI::hideStripify()
1331{
1332        /*
1333        mTypeLabel->hide();
1334        mTypeLabel->deactivate();
1335        */
1336       
1337        mOneCacheStrip->hide();
1338        mOneCacheStrip->deactivate();
1339
1340        mQualityStrips->hide();
1341        mQualityStrips->deactivate();
1342
1343        mButtonProcess->hide();
1344        mButtonProcess->deactivate();
1345
1346        mProcessBar->hide();
1347        mProcessBar->deactivate();
1348}
1349
1350//---------------------------------------------------------------------------
1351//      Show the Simplify Edge Collapse panel
1352//---------------------------------------------------------------------------
1353void    GeoMeshViewUI::showEdgeCollapse()
1354{
1355        mMetricLabel->set_visible();
1356        mMetricLabel->activate();
1357
1358        mGeometryBased->set_visible();
1359        mGeometryBased->activate();
1360        mGeometryBased->set();
1361
1362        mViewPointDriven->set_visible();
1363        mViewPointDriven->activate();
1364
1365        /*
1366        mTypeLabel->set_visible();
1367        mTypeLabel->activate();
1368
1369        mChangeVertices->set_visible();
1370        mChangeVertices->activate();
1371        */
1372       
1373        mMeshReductionLabel->set_visible();
1374        mMeshReductionLabel->activate();
1375
1376        mPercent->set_visible();
1377        mPercent->activate();
1378        mPercent->set();
1379
1380        mVerticesNumber->set_visible();
1381        mVerticesNumber->activate();
1382
1383        mMeshReduction->set_visible();
1384
1385        // Allows floating point.
1386        mMeshReduction->type(fltk::FloatInput::FLOAT);
1387
1388        mMeshReduction->activate();
1389
1390        mButtonProcess->set_visible();
1391        mButtonProcess->activate();
1392
1393        mProcessBar->set_visible();
1394        mProcessBar->activate();
1395}
1396
1397//---------------------------------------------------------------------------
1398//      Hide the Simplify Edge Collapse
1399//---------------------------------------------------------------------------
1400void    GeoMeshViewUI::hideEdgeCollapse()
1401{
1402        mMetricLabel->hide();
1403        mMetricLabel->deactivate();
1404
1405        mGeometryBased->hide();
1406        mGeometryBased->deactivate();
1407
1408        mViewPointDriven->hide();
1409        mViewPointDriven->deactivate();
1410
1411        /*
1412        mTypeLabel->hide();
1413        mTypeLabel->deactivate();
1414
1415        mChangeVertices->hide();
1416        mChangeVertices->deactivate();
1417        */
1418       
1419        mMeshReductionLabel->hide();
1420        mMeshReductionLabel->deactivate();
1421
1422        mPercent->hide();
1423        mPercent->deactivate();
1424
1425        mVerticesNumber->hide();
1426        mVerticesNumber->deactivate();
1427
1428        mMeshReduction->hide();
1429        mMeshReduction->deactivate();
1430       
1431        mButtonProcess->hide();
1432        mButtonProcess->deactivate();
1433
1434        mProcessBar->hide();
1435        mProcessBar->deactivate();
1436}
1437
1438//---------------------------------------------------------------------------
1439//      Show the Simlify Leaves Collapse
1440//---------------------------------------------------------------------------
1441void    GeoMeshViewUI::showLeavesCollapse()
1442{
1443        mMetricLabel->set_visible();
1444        mMetricLabel->activate();
1445
1446        mGeometryBased->set_visible();
1447        mGeometryBased->activate();
1448        mGeometryBased->set();
1449
1450        mViewPointDriven->set_visible();
1451        mViewPointDriven->activate();
1452
1453        /*
1454        mTypeLabel->set_visible();
1455        mTypeLabel->activate();
1456
1457        mChangeTexture->set_visible();
1458        mChangeTexture->activate();
1459        */
1460
1461        mMeshReductionLabel->set_visible();
1462        mMeshReductionLabel->activate();
1463
1464        mPercent->set_visible();
1465        mPercent->activate();
1466        mPercent->set();
1467
1468        mVerticesNumber->set_visible();
1469        mVerticesNumber->activate();
1470
1471        mMeshReduction->set_visible();
1472        mMeshReduction->type(fltk::FloatInput::FLOAT);
1473        mMeshReduction->activate();
1474
1475        mButtonProcess->set_visible();
1476        mButtonProcess->activate();
1477
1478        mProcessBar->set_visible();
1479        mProcessBar->activate();
1480}
1481
1482//---------------------------------------------------------------------------
1483//      Hide the Simplify Leaves Collapse
1484//---------------------------------------------------------------------------
1485void    GeoMeshViewUI::hideLeavesCollapse()
1486{
1487        mMetricLabel->hide();
1488        mMetricLabel->deactivate();
1489
1490        mGeometryBased->hide();
1491        mGeometryBased->deactivate();
1492
1493        mViewPointDriven->hide();
1494        mViewPointDriven->deactivate();
1495
1496        /*
1497        mTypeLabel->hide();
1498        mTypeLabel->deactivate();
1499
1500        mChangeTexture->hide();
1501        mChangeTexture->deactivate();
1502        */
1503       
1504        mMeshReductionLabel->hide();
1505        mMeshReductionLabel->deactivate();
1506
1507        mPercent->hide();
1508        mPercent->deactivate();
1509
1510        mVerticesNumber->hide();
1511        mVerticesNumber->deactivate();
1512
1513        mMeshReduction->hide();
1514        mMeshReduction->deactivate();
1515
1516        mButtonProcess->hide();
1517        mButtonProcess->deactivate();
1518
1519        mProcessBar->hide();
1520        mProcessBar->deactivate();
1521}
1522
1523//---------------------------------------------------------------------------
1524//      Show the LodStrips Panel
1525//---------------------------------------------------------------------------
1526void    GeoMeshViewUI::showOpenMeshSimplification()
1527{
1528        mButtonProcess->set_visible();
1529        mButtonProcess->activate();
1530
1531        mProcessBar->set_visible();
1532        mProcessBar->activate();
1533
1534        mButtonBuild->set_visible();
1535        mButtonBuild->activate();
1536
1537        mBuildBar->set_visible();
1538        mBuildBar->activate();
1539}
1540
1541//---------------------------------------------------------------------------
1542//      Hide the LodStrips Panel
1543//---------------------------------------------------------------------------
1544void    GeoMeshViewUI::hideOpenMeshSimplification()
1545{
1546        mButtonProcess->hide();
1547        mButtonProcess->deactivate();
1548
1549        mProcessBar->hide();
1550        mProcessBar->deactivate();
1551
1552        mButtonBuild->hide();
1553        mButtonBuild->deactivate();
1554
1555        mBuildBar->hide();
1556        mBuildBar->deactivate();
1557}
1558
1559//---------------------------------------------------------------------------
1560//      Shows the auto generate LodStrips panel
1561//---------------------------------------------------------------------------
1562void    GeoMeshViewUI::showAutoGenerateLodStrips()
1563{
1564        //      Shows the simplify panel.
1565        showEdgeCollapse();
1566
1567        mButtonBuild->set_visible();
1568        mButtonBuild->activate();
1569
1570        mBuildBar->set_visible();
1571        mBuildBar->activate();
1572}
1573//---------------------------------------------------------------------------
1574//      Shows the auto generate LodStrips panel
1575//---------------------------------------------------------------------------
1576void    GeoMeshViewUI::showAutoGenerateLodTrees()
1577{
1578        //      Shows the simplify panel.
1579        showEdgeCollapse();
1580
1581        mButtonBuild->set_visible();
1582        mButtonBuild->activate();
1583
1584        mBuildBar->set_visible();
1585        mBuildBar->activate();
1586}
1587
1588//---------------------------------------------------------------------------
1589//      Show the LodStrips visulization panel
1590//---------------------------------------------------------------------------
1591void    GeoMeshViewUI::showLodStripSlider()
1592{
1593        mLodStripSlider->set_visible();
1594        mLodStripSlider->activate();
1595}
1596
1597//---------------------------------------------------------------------------
1598//      Hide the LodStrips visualization panel
1599//---------------------------------------------------------------------------
1600void    GeoMeshViewUI::hideLodStripSlider()
1601{
1602        mLodStripSlider->hide();
1603        mLodStripSlider->deactivate();
1604}
1605
1606//---------------------------------------------------------------------------
1607//      Show the LodTree visulization panel
1608//---------------------------------------------------------------------------
1609void    GeoMeshViewUI::showLodTreeSlider()
1610{
1611        mLodTreeSlider->set_visible();
1612        mLodTreeSlider->activate();
1613}
1614
1615//---------------------------------------------------------------------------
1616//      Hide the LodTree visualization panel
1617//---------------------------------------------------------------------------
1618void    GeoMeshViewUI::hideLodTreeSlider()
1619{
1620        mLodTreeSlider->hide();
1621        mLodTreeSlider->deactivate();
1622}
1623
1624
1625//---------------------------------------------------------------------------
1626//      Show the LodTrees Panel
1627//---------------------------------------------------------------------------
1628void    GeoMeshViewUI::showOpenLeavesSimplification()
1629{
1630        mButtonBuild->set_visible();
1631        mButtonBuild->activate();
1632
1633        mBuildBar->set_visible();
1634        mBuildBar->activate();
1635}
1636
1637//---------------------------------------------------------------------------
1638//      Hide the LodTrees Panel
1639//---------------------------------------------------------------------------
1640void    GeoMeshViewUI::hideOpenLeavesSimplification()
1641{
1642        mButtonBuild->hide();
1643        mButtonBuild->deactivate();
1644
1645        mBuildBar->hide();
1646        mBuildBar->deactivate();
1647}
1648
1649//---------------------------------------------------------------------------
1650//      Show the mesh info browser
1651//---------------------------------------------------------------------------
1652void    GeoMeshViewUI::showMeshInfo()
1653{
1654        char    type[10];
1655       
1656        if (mGeoMesh)
1657        {
1658                // Remove previous mesh information
1659                this->mMeshInfo->remove_all();
1660                ogeometry = new fltk::ItemGroup("Geometry");
1661                ogeometry->begin();
1662
1663                fltk::ItemGroup **oprueba;
1664                oprueba=new fltk::ItemGroup*[mGeoMesh->mSubMeshCount];
1665                for(int i=0; i<mGeoMesh->mSubMeshCount;i++)
1666                {
1667                        char *cadena=new char[12];
1668
1669                        if (geoMeshView->getLeavesSubMesh() >= 0)
1670                        {
1671                                if (geoMeshView->getLeavesSubMesh() == i)
1672                                {
1673                                        strcpy(type,"(Leaves)");
1674                                }
1675                                else
1676                                {
1677                                        strcpy(type,"(Trunc)");
1678                                }
1679                        }
1680                        else
1681                        {
1682                                strcpy(type,"");
1683                        }
1684
1685                        //      Submesh identifier.
1686                        sprintf(cadena,"SubMesh %d %s",i,type);
1687                       
1688                        oprueba[i] = new fltk::ItemGroup(cadena);
1689                        oprueba[i]->begin();
1690                        fltk::Item *sharedGeometry;
1691                        if (mGeoMesh->mSubMesh[i].mSharedVertexBuffer)
1692                        {
1693                                sharedGeometry = new fltk::Item("Shared Geometry: Yes");
1694                        }
1695                        else
1696                        {
1697                                sharedGeometry = new fltk::Item("Shared Geometry: No");
1698                        }
1699
1700                        //      Adds material name.
1701                        char *cadena2=new char[100];
1702                        sprintf(cadena2, "Material: %s",mGeoMesh->mSubMesh[i].mMaterialName);
1703                       
1704                        fltk::Item      *geomaterial    =       new fltk::Item(cadena2);
1705                       
1706                        char *cadena3=new char[100];
1707                       
1708                        sprintf(cadena3, "Number of indexes: %d",mGeoMesh->mSubMesh[i].mIndexCount);
1709                        fltk::Item *numberIndex = new fltk::Item(cadena3);
1710                        if (mGeoMesh->mSubMesh[i].mType==Geometry::GEO_TRIANGLE_LIST)
1711                        {
1712                                fltk::Item *type = new fltk::Item("Triangle List");
1713                        }
1714                        else
1715                        {
1716                                fltk::Item *type = new fltk::Item("Triangle Strips");
1717                        }
1718
1719                        char *cadenavertex=new char[30];
1720                        sprintf(cadenavertex, "Number of vertices: %d",mGeoMesh->mSubMesh[i].mVertexBuffer->mVertexCount);
1721                        fltk::Item *numberVertex = new fltk::Item(cadenavertex);
1722
1723                        if (mGeoMesh->mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
1724                        {
1725                                fltk::Item *normals = new fltk::Item("Normals: Yes");
1726                        }
1727                        else
1728                        {
1729                                fltk::Item *normals = new fltk::Item("Normals: No");
1730                        }
1731
1732                        if (mGeoMesh->mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
1733                        {
1734                                fltk::Item *textures = new fltk::Item("Textures: Yes");
1735                        }
1736                        else
1737                        {
1738                                fltk::Item *textures = new fltk::Item("Textures: No");
1739                        }
1740
1741
1742                        oprueba[i]->end();
1743                }
1744                ogeometry->end();
1745                this->mMeshInfo->add(ogeometry);
1746        }
1747
1748        //      Hide the right panel.
1749        hideRightPanel();
1750       
1751        mMeshInfo->set_visible();
1752        mMeshInfo->activate();
1753}
1754
1755//---------------------------------------------------------------------------
1756//      Hide the mesh info browser
1757//---------------------------------------------------------------------------
1758void    GeoMeshViewUI::hideMeshInfo()
1759{
1760        mMeshInfo->hide();
1761        mMeshInfo->deactivate();
1762}
1763
1764//---------------------------------------------------------------------------
1765//      Hide the right panel
1766//---------------------------------------------------------------------------
1767void    GeoMeshViewUI::hideRightPanel()
1768{
1769        hideStripify();
1770        hideEdgeCollapse();
1771        hideLeavesCollapse();
1772        hideOpenMeshSimplification();
1773        hideOpenLeavesSimplification();
1774        hideLodStripSlider();
1775        hideLodTreeSlider();
1776        hideMeshInfo();
1777}
1778
1779//---------------------------------------------------------------------------
1780//      Get the number of vertices
1781//---------------------------------------------------------------------------
1782size_t  GeoMeshViewUI::getVertexCount(Mesh      *geoMesh)
1783{
1784        size_t  vertex_count;
1785        SubMesh *geoSubMesh;
1786
1787        vertex_count    =       geoMesh->mVertexBuffer->mVertexCount;
1788
1789        //      For each submesh.
1790        for (int submesh        =       0; submesh < geoMesh->mSubMeshCount; submesh++)
1791        {
1792                //      Gets the actual submesh.
1793                geoSubMesh      =       &geoMesh->mSubMesh[submesh];
1794
1795                //      If the mesh does not have shared vertex.
1796                if (!geoSubMesh->mSharedVertexBuffer)
1797                {                       
1798                        //      Adds the vertex of the submesh to the total count.
1799                        vertex_count    +=      geoSubMesh->mVertexBuffer->mVertexCount;
1800                }
1801        }
1802
1803        return  vertex_count;
1804}
1805
1806//---------------------------------------------------------------------------
1807//      Get the number of triangles
1808//---------------------------------------------------------------------------
1809size_t  GeoMeshViewUI::getTriangleCount(Geometry::Mesh  *geoMesh)
1810{
1811        size_t  triangle_count;
1812        SubMesh *geoSubMesh;
1813
1814        //      Initialize the triangle count.
1815        triangle_count  =       0;
1816       
1817        //      If the application is in visualize lodstrips mode.
1818        if (mApplicationState == VISUALIZE_LODSTRIPS)
1819        {
1820                triangle_count  =       geoMeshView->getLodStripsTriangleCount();
1821        }
1822        else
1823        {
1824                //      For each submesh.
1825                for (int submesh        =       0; submesh < geoMesh->mSubMeshCount; submesh++)
1826                {
1827                        //      Gets the actual submesh.
1828                        geoSubMesh      =       &geoMesh->mSubMesh[submesh];
1829
1830                        switch (geoSubMesh->mType)
1831                        {
1832                                case    GEO_TRIANGLE_LIST:
1833                                        triangle_count  +=      geoSubMesh->mIndexCount / 3;
1834                                        break;
1835                                case    GEO_TRIANGLE_STRIPS:
1836                                        triangle_count  +=      geoSubMesh->mIndexCount - 2;
1837                                        break;
1838                        }
1839                }
1840        }
1841
1842        return  triangle_count;
1843}
1844
1845//---------------------------------------------------------------------------
1846//      Get the number of strips
1847//---------------------------------------------------------------------------
1848size_t  GeoMeshViewUI::getStripCount(Geometry::Mesh     *geoMesh)
1849{
1850        size_t  strip_count;
1851        SubMesh *geoSubMesh;
1852
1853        //      Initialize the triangle count.
1854        strip_count     =       0;
1855       
1856        //      For each submesh.
1857        for (int submesh        =       0; submesh < geoMesh->mSubMeshCount; submesh++)
1858        {
1859                //      Gets the actual submesh.
1860                geoSubMesh      =       &geoMesh->mSubMesh[submesh];
1861
1862                if (geoSubMesh->mType == GEO_TRIANGLE_STRIPS)
1863                {
1864                        strip_count     +=      geoSubMesh->mStripCount;
1865                }       
1866        }
1867
1868        return  strip_count;
1869}
1870
1871//---------------------------------------------------------------------------
1872//      It paints the submesh selected by the mMeshInfo tree
1873//      Trate the mMeshInfo event       
1874//---------------------------------------------------------------------------
1875int GeoMeshViewUI::paintMesh(void)
1876{
1877        char selectedTag[100];
1878        char *pch;
1879        char *p;
1880        int meshNumber;
1881
1882        //      Initializa mesh to not selected.
1883        meshNumber      =       -1;
1884
1885        // Shows the selected object label
1886        strcpy(selectedTag,mMeshInfo->goto_focus()->label());
1887       
1888        p=strstr(selectedTag,"SubMesh ");
1889
1890        // If the item begins with string "SubMesh"
1891        if (p!=NULL)
1892        {
1893                pch = strtok (selectedTag," ");
1894                pch = strtok (NULL, " ");
1895                sscanf(pch,"%d",&meshNumber);
1896        }
1897       
1898        geoMeshView->setSubMeshSelected(meshNumber);
1899        geoMeshView->redraw();
1900       
1901        return meshNumber;
1902}
1903
1904//---------------------------------------------------------------------------
1905//      Simplify the mesh object.
1906//---------------------------------------------------------------------------
1907void    GeoMeshViewUI::simplifyEdgeCollapse()
1908{
1909        Real    percent;
1910
1911        //-----------------
1912        geoMeshView->saveContext();
1913
1914        //      Gets simplify option.
1915        if (mGeometryBased->value())
1916        {
1917                simplificationState     =       MESHSIMP;
1918                mMeshSimplifier                 = new GeometryBasedSimplifier(mGeoMesh,
1919                                                                                                                                                                                                                        progress_function);
1920        }
1921        else
1922        {
1923                simplificationState     =       VIEWPOINTDRIVEN;
1924                mMeshSimplifier                 = new ViewPointDrivenSimplifier(mGeoMesh,
1925                                                                                                                                                                                                                                progress_function);
1926        }
1927
1928        mMeshSimplifier->setMeshLeaves(idMeshLeaves);
1929
1930        if (mPercent->value())
1931        {
1932                // Simplificación por porcentaje
1933                if (mMeshReduction->fvalue() <= 100.0 && mMeshReduction->fvalue()>0.0)
1934                {
1935                        percent = mMeshReduction->fvalue();
1936                        percent =       percent / 100.0;
1937                       
1938
1939                        // Simplifica el geomesh -> Parámetro es un factor LOD [0,1].
1940                        mMeshSimplifier->Simplify(percent);
1941
1942                        //      Deletes the previous mesh.
1943                        delete mUndoMesh;
1944
1945                        mUndoMesh       =       new Mesh();
1946
1947                        //      Sets the undo mesh.
1948                        *mUndoMesh      =       *mGeoMesh;
1949
1950                        delete  mGeoMesh;
1951
1952                        mGeoMesh        =       mMeshSimplifier->GetMesh();
1953
1954                        //      Visualize mesh.
1955                        geoMeshView->setMesh(mGeoMesh);
1956
1957                }
1958                else
1959                {
1960                        fltk::alert("Wrong value for simplification.\n"
1961                                        "Valid values [0..100]");
1962                }
1963        }
1964        else
1965        {
1966                // Simplificar hasta un número de vértices.
1967                uint32 v        =       (uint32)mMeshReduction->fvalue();
1968
1969                // Simplifica el geomesh -> Parámetro es un factor LOD [0,1].
1970                mMeshSimplifier->Simplify(v);
1971
1972                //      Deletes the previous mesh.
1973                delete mUndoMesh;
1974
1975                mUndoMesh       =       new Mesh();
1976
1977                //      Sets the undo mesh.
1978                *mUndoMesh      =       *mGeoMesh;
1979
1980                delete  mGeoMesh;
1981
1982                mGeoMesh        =       mMeshSimplifier->GetMesh();
1983
1984                //      Visualize the mesh.
1985                geoMeshView->setMesh(mGeoMesh);
1986        }
1987}
1988
1989//---------------------------------------------------------------------------
1990//      Simplify the mesh object.
1991//---------------------------------------------------------------------------
1992void    GeoMeshViewUI::simplifyLeavesCollapse()
1993{
1994        bool            error;
1995        uint32  vi;
1996
1997        //      Initialize      error flag.
1998        error   =       false;
1999
2000        //      Check submeshes for triangles strips.
2001        for (int i = 0; i < mGeoMesh->mSubMeshCount; i++)
2002        {
2003                //      If current submesh is in triangle strips.
2004                if (mGeoMesh->mSubMesh[i].mType == GEO_TRIANGLE_STRIPS)
2005                {
2006                        error   =       true;
2007                }
2008        }
2009
2010        //      if the mesh is stripified.
2011        if (error)
2012        {
2013                fltk::alert("Can't simplify a tree in triagle strips.");
2014        }
2015        //      if the mesh is in triangle list.
2016        else
2017        {
2018                simplificationState     =       HOJAS;
2019               
2020                mTreeSimplifier =       new TreeSimplifier(mGeoMesh, progress_function);
2021                vi      =       (uint32)mMeshReduction->fvalue();
2022
2023                // Simplify
2024                if(idMeshLeaves !=      (unsigned short)-1)
2025                {
2026                        // Simplify
2027                        mTreeSimplifier->Simplify(vi, idMeshLeaves);
2028
2029                        //      Deletes the previous mesh.
2030                        delete mUndoMesh;
2031
2032                        mUndoMesh       =       new Mesh();
2033                       
2034                        //      Sets the undo mesh.
2035                        *mUndoMesh      =       *mGeoMesh;
2036
2037                        delete  mGeoMesh;
2038
2039                        mGeoMesh        =       mTreeSimplifier->GetMesh();
2040                       
2041                        geoMeshView->setMesh(mGeoMesh);
2042                }
2043                else
2044                {
2045                        fltk::alert("You must select the mesh that contains the leaves.");
2046                }
2047        }
2048}
2049
2050//---------------------------------------------------------------------------
2051//      Create a simplification sequence of the simplification method.
2052//---------------------------------------------------------------------------
2053void    GeoMeshViewUI::createSimplificationSequence()
2054{
2055        MeshSimplificationSequence      *secsimpl;
2056       
2057        secsimpl        =       mMeshSimplifier->GetSimplificationSequence();
2058       
2059        secsimpl->putMeshName(nombremesh); // Nombre del mesh para guardar la secuencia de simplificación
2060        secsimpl->Save(Geometry::Serializer("SimplifSequence.txt",Serializer::WRITE));
2061
2062        delete  secsimpl;
2063}
2064
2065//---------------------------------------------------------------------------
2066//      Create a simplification sequence of the leaves.
2067//---------------------------------------------------------------------------
2068void    GeoMeshViewUI::createLeavesSequence(const std::string &filename)
2069{
2070        TreeSimplificationSequence      *tree_sequencer;
2071       
2072        tree_sequencer  =       mTreeSimplifier->GetSimplificationSequence();
2073       
2074        tree_sequencer->putMeshName(nombremesh);
2075        tree_sequencer->Save(Serializer(filename,Serializer::WRITE));
2076
2077        delete  tree_sequencer;
2078}
2079
2080//---------------------------------------------------------------------------
2081//      Stripify the mesh object.
2082//---------------------------------------------------------------------------
2083void    GeoMeshViewUI::stripify()
2084{       
2085        bool                                                    error;
2086        char                                                    char_value[10];
2087        CustomStripifier        *geoStripifier;
2088
2089        //      Initialize error flag.
2090        error   =       false;
2091
2092        //      Check submeshes for triangles strips.
2093        for (int i = 0; i < mGeoMesh->mSubMeshCount; i++)
2094        {
2095                //      If current submesh is in triangle strips.
2096                if (mGeoMesh->mSubMesh[i].mType == GEO_TRIANGLE_STRIPS)
2097                {
2098                        error   =       true;
2099                }
2100        }
2101                               
2102        //      if the mesh is stripified.
2103        if (error)
2104        {
2105                fltk::alert("The mesh is already in strips.");
2106        }
2107        //      if the mesh is in triangle list.
2108        else
2109        {
2110                //Stripify.
2111                geoStripifier   =       new CustomStripifier(mGeoMesh);
2112
2113                //      Set the progress bar function. 
2114                geoStripifier->SetProgressFunc(progress_function);
2115               
2116                //      Sets the leaves submesh if exists.
2117                geoStripifier->SetSubMeshLeaves(idMeshLeaves);
2118               
2119                if (geoStripifier->Stripify())
2120                {
2121                        //      Deletes the mesh object.
2122                        delete  mUndoMesh;
2123
2124                        mUndoMesh       =       new Mesh();
2125
2126                        *mUndoMesh      =       *mGeoMesh;
2127
2128                        delete  mGeoMesh;
2129
2130                        //      Gets the mesh stripified.
2131                        mGeoMesh        =       geoStripifier->GetMesh();
2132
2133                        //      Visualize the mesh stripified.
2134                        geoMeshView->setMesh(mGeoMesh);
2135
2136                        //      Store the color of the strips.
2137                        geoMeshView->setStripColors();
2138                }
2139                else
2140                {
2141                        //      Error message.
2142                        fltk::alert("Impossible to stripify. The mesh is not manifold");
2143                }
2144
2145                //      Deletes the stripifier object.
2146                delete  geoStripifier;
2147        }
2148}
2149
2150//---------------------------------------------------------------------------
2151//      Method that undo then mesh changes.
2152//---------------------------------------------------------------------------
2153void    GeoMeshViewUI::undo()
2154{
2155        //      if the undo mesh is not initialized.
2156        if      (mUndoMesh != NULL)
2157        {
2158                //      Deletes the actual mesh.
2159                delete  mGeoMesh;
2160
2161                mGeoMesh        =       new Mesh();
2162
2163                //      Restore the previous mesh.
2164                *mGeoMesh       =       *mUndoMesh;
2165
2166                //      Visualize the mesh.
2167                geoMeshView->setMesh(mGeoMesh);
2168
2169                //      Refresh geometry attributes.
2170                refreshApplicationBar();
2171
2172                //      Repaint the window.
2173                mMainWindow->redraw();
2174        }
2175}
2176
2177//---------------------------------------------------------------------------
2178//      Refresh number of vertices, triangles, strips, ...
2179//---------------------------------------------------------------------------
2180void    GeoMeshViewUI::refreshApplicationBar()
2181{
2182        static char     vertices_value[50];
2183        static char     triangles_value[50];
2184        static char     strips_value[50];
2185       
2186        //      Translate the vertex count to a char value.
2187        sprintf(vertices_value,"Vertices %d",getVertexCount(mGeoMesh));
2188
2189        mVertices->label(vertices_value);
2190
2191        //      Translate the triangle count to a char value.
2192        sprintf(triangles_value,"Triangles %d",getTriangleCount(mGeoMesh));
2193
2194        mTriangles->label(triangles_value);
2195
2196        //      Translate the triangle count to a char value.
2197        sprintf(strips_value,"Strips %d",getStripCount(mGeoMesh));
2198
2199        mStrips->label(strips_value);
2200}
2201
2202//      Method that updates the porgress bar.
2203float GeoMeshViewUI::updateProgressBar(float v)
2204{
2205        fltk::ProgressBar               *progressBar;
2206       
2207        //      Choose progress bar to update.
2208        switch(progressBarType)
2209        {
2210                case    PROCESS:
2211                        progressBar     =       mProcessBar;
2212                        break;
2213                case    BUILD:
2214                        progressBar     =       mBuildBar;
2215                        break;
2216        }
2217       
2218        //      Update progress bar.
2219        progressBar->step(v);
2220        progressBar->step();
2221        mMainWindow->flush();
2222        //mMainWindow->redraw();
2223       
2224        return 0;
2225}
2226
2227//---------------------------------------------------------------------------
2228//      Initialize the lodstripslibrary for visualization.
2229//---------------------------------------------------------------------------
2230void    GeoMeshViewUI::setLodStripsLibrary(std::string lodfile, Mesh    *geomesh)
2231{
2232        //      If there is no lod strips object.
2233        if (lodStripsLib)
2234        {
2235                delete  lodStripsLib;
2236        }
2237
2238        //      New lod strips object.
2239        lodStripsLib    =       new     LodStripsLibrary(lodfile, geomesh);
2240
2241        //      Sets the slider range.
2242        mLodStripSlider->range(lodStripsLib->MaxLod(),
2243                                                                                lodStripsLib->MinLod());
2244
2245        //      Pass to geomeshview the lod strips object.
2246        geoMeshView->setLodStripsLibrary(lodStripsLib);
2247       
2248        //      Puts the slider in the max position.
2249        mLodStripSlider->value(lodStripsLib->MinLod());
2250}
2251
2252//---------------------------------------------------------------------------
2253//      Initialize the lodTreelibrary for visualization.
2254//---------------------------------------------------------------------------
2255//void  GeoMeshViewUI::setLodTreesLibrary(std::string lodfile, Mesh     *geomesh)
2256void    GeoMeshViewUI::setLodTreesLibrary(std::string lodfile, std::string leafseqfile, Mesh *geomesh, uint32 ileafSubMesh)
2257
2258{
2259        //      If there is no lod strips object.
2260        if (lodTreeLib)
2261        {
2262                delete  lodTreeLib;
2263        }
2264
2265        //      New lod strips object.
2266/*      lodTreeLib      =       new     Geometry::LodTreeLibrary(lodfile, geomesh,"\\\\quake\\home\\\Modelos\\betula_populifolia\\vertices.obj",
2267                                                                                "\\\\quake\\home\\\Modelos\\betula_populifolia\\hojas.obj",
2268                                                                                "\\\\quake\\home\\\Modelos\\betula_populifolia\\simplifica.obj");*/
2269
2270        lodTreeLib = new Geometry::LodTreeLibrary(lodfile,leafseqfile,geomesh,ileafSubMesh);
2271
2272        //      Sets the slider range.
2273        mLodStripSlider->range(lodTreeLib->MaxTrunkLod(), lodTreeLib->MinTrunkLod());
2274        mLodTreeSlider->range(lodTreeLib->MaxFoliageLod(), lodTreeLib->MinFoliageLod());
2275
2276        //      Pass to geomeshview the lod strips object.
2277        geoMeshView->setLodTreesLibrary(lodTreeLib);
2278       
2279        //      Puts the slider in the max position.
2280        mLodStripSlider->value(lodTreeLib->MinTrunkLod());
2281        mLodTreeSlider->value(lodTreeLib->MinFoliageLod());
2282}
2283
2284//---------------------------------------------------------------------------
2285//      Open a mesh file.
2286//---------------------------------------------------------------------------
2287void    GeoMeshViewUI::openMeshFile()
2288{
2289        fltk::FileChooser       *fcho;
2290        static  char                    char_value[10];
2291        static  char                    title[256];
2292
2293        fcho    =       new fltk::FileChooser("",
2294                                                                                                                                "*.mesh",
2295                                                                                                                                fltk::FileChooser::CREATE,
2296                                                                                                                                "Open mesh file");
2297
2298        fcho->exec();
2299
2300        //      File name.
2301        mFileName       =       (char *)fcho->value();
2302
2303        if (mFileName)
2304        {
2305                //      Set Window Title.
2306                strcpy(title,mFileName);
2307                mMainWindow->label(strcat(title," - GeoTool"));
2308
2309                //      Identify the mesh that stores the leaves
2310                idMeshLeaves    =       -1;
2311
2312                //      Stores the name of the mesh.
2313                nombremesh      =       new char[255];
2314                strcpy(nombremesh,mFileName);
2315
2316                //      Delete  the current mesh.
2317                delete  mGeoMesh;
2318                delete  mUndoMesh;
2319
2320                //      Loads a new mesh.
2321                mGeoMesh                =       geoMeshLoader->load(mFileName);
2322
2323                //      Reset the undo mesh.
2324                mUndoMesh               =       new Mesh();
2325                *mUndoMesh      =       *mGeoMesh;
2326
2327                //      Translate the MB count to a char value.
2328                sprintf(char_value,
2329                                "MB %.3f",
2330                                (float)geoMeshLoader->getFileSize()/1024/1024);
2331
2332                mMB->label(char_value);
2333
2334                //      Visualize mesh.
2335                geoMeshView->setMesh(mGeoMesh);
2336
2337                //      Hide right panel.
2338                hideRightPanel();
2339
2340                //      Quit culling.
2341                menuRenderCW->clear_value();
2342                menuRenderCCW->clear_value();
2343                geoMeshView->deactiveCW();
2344                geoMeshView->deactiveCCW();
2345
2346                //      Deactive solid mode and wire.
2347                menuRenderSolid->clear_value();
2348                menuRenderWire->clear_value();
2349                geoMeshView->deactiveSolid();
2350                geoMeshView->deactiveWire();
2351
2352                //      Fit model in midle.
2353                geoMeshView->fit();
2354
2355                //      Lighting smooth.
2356                menuRenderFlat->clear_value();
2357                menuRenderSmooth->set_value();
2358                geoMeshView->smooth();
2359
2360                //      Show title.
2361                mProcessTitle->label("Mesh Info");
2362
2363                //      Shows the mesh info.
2364                showMeshInfo();
2365
2366                //      if the mesh is stripified.
2367                geoMeshView->setStripColors();
2368
2369                //      Refresh geometry attributes.
2370                refreshApplicationBar();
2371        }
2372       
2373        //      Free memory.
2374        delete  fcho;
2375}
2376
2377/******************/
2378/*      Constructor             */
2379/******************/
2380GeoMeshViewUI::GeoMeshViewUI(TIPOFUNC fun)
2381{
2382        progress_function       =       fun;
2383        fltk::gifImage  *logo;
2384       
2385        //      Initialize the file name.
2386        mFileName       =       NULL;
2387
2388        //      Initialize the 3D object.
2389        mGeoMesh        =       NULL;
2390        mUndoMesh       =       NULL;
2391
2392        //      Initialize the lod strip object.
2393        lodStripsLib    =       NULL;
2394        lodTreeLib      =       NULL;
2395
2396        //      Identify the mesh that stores the leaves
2397        idMeshLeaves    =       -1;
2398
2399        //      Initialize the loader of meshes.
2400        geoMeshLoader   =       new     GeoMeshLoader();
2401
2402        //      Initialize the menus application state.
2403        mApplicationState       =       NONE;
2404       
2405        {
2406                fltk::Window*   o       =       new fltk::Window(800, 600,"GeoTool");
2407
2408                mMainWindow     =       o;
2409
2410                //      Program Icon for Win32.
2411                mMainWindow->icon((char *)LoadIcon(     GetModuleHandle(0),
2412                                        MAKEINTRESOURCE(GEOICON)));
2413
2414                //      Double buffer.
2415                mMainWindow->set_double_buffer();
2416
2417                o->user_data((void*)(this));
2418                o->begin();
2419
2420                {
2421                        fltk::Group* o = new fltk::Group(0, 27, 806, 559);
2422                        o->begin();
2423
2424                        {
2425                                fltk::Group* o;
2426                                o = MainView = new fltk::Group(0, 0, 500, 530);
2427                                o->begin();
2428
2429                                {
2430                                        fltk::InvisibleBox* o;
2431                                        o = cframe = new fltk::InvisibleBox(0, 0, 500, 530);
2432                                        o->box(fltk::FLAT_BOX);
2433                                        o->color((fltk::Color)0xffffff00);
2434                                        //fltk::Group::current()->resizable(o);
2435                                }
2436
2437                                {
2438                                        GeoMeshView* o;
2439                                        o = geoMeshView = new GeoMeshView(      0,0,500,530,0,this);
2440                                }
2441
2442                                o->end();
2443
2444                                fltk::Group::current()->resizable(o);
2445
2446                        }
2447
2448                        {
2449                                fltk::Group* o;
2450                                o = MainView = new fltk::Group(500, 0, 300, 530);
2451                                o->begin();
2452
2453                                {
2454                                        fltk::Button* o;
2455                                        //o = mButtonProcess = new fltk::Button(665, 410, 73, 25, "Process");
2456                                        o = mButtonProcess = new fltk::Button(65, 410, 73, 25, "Process");
2457                                        o->callback((fltk::Callback*)cb_mButtonProcess);
2458                                        o->hide();
2459                                        o->deactivate();
2460                                }
2461
2462                                {
2463                                        fltk::ProgressBar* o;
2464                                        //o = mProcessBar = new fltk::ProgressBar(616, 435, 175, 18);
2465                                        o = mProcessBar = new fltk::ProgressBar(16, 435, 175, 18);
2466                                        o->hide();
2467                                        o->deactivate();
2468                                }
2469
2470                                {
2471                                        fltk::Button* o;
2472                                        o = mButtonSort = new fltk::Button(65, 375, 73, 25, "Sort");
2473                                        o->callback((fltk::Callback*)cb_mButtonSort);
2474                                        o->hide();
2475                                        o->deactivate();
2476                                }
2477
2478                                {
2479                                        fltk::ProgressBar* o;
2480                                        o = mSortBar = new fltk::ProgressBar(16, 390, 175, 18);
2481                                        o->hide();
2482                                        o->deactivate();
2483                                }
2484
2485                                {
2486                                        fltk::Button* o;
2487                                        o = mButtonBuild = new fltk::Button(65, 455, 73, 25, "Build");
2488                                        o->callback((fltk::Callback*)cb_mButtonBuild);
2489                                        o->hide();
2490                                        o->deactivate();
2491                                }
2492
2493                                {
2494                                        fltk::ProgressBar* o;
2495                                        o = mBuildBar = new fltk::ProgressBar(16, 480, 175, 18);
2496                                        o->hide();
2497                                        o->deactivate();
2498                                }
2499
2500                                {
2501                                        fltk::Slider* o;
2502                                        o = mLodStripSlider = new fltk::Slider(16, 50, 30, 450);
2503                                        o->type(fltk::Slider::TICK_BELOW);
2504                                        o->set_vertical();
2505                                        o->callback((fltk::Callback*)cb_mLodStripSlider);
2506                                        o->hide();
2507                                        o->deactivate();
2508                                }
2509                                {
2510                                        fltk::Slider* o;
2511                                        o = mLodTreeSlider = new fltk::Slider(46, 50, 30, 450);
2512                                        o->type(fltk::Slider::TICK_BELOW);
2513                                        o->set_vertical();
2514                                        o->callback((fltk::Callback*)cb_mLodTreeSlider);
2515                                        o->hide();
2516                                        o->deactivate();
2517                                }
2518
2519                                {
2520                                        mMetricLabel    = new fltk::Output(26, 28, 5, 25, "Metric");
2521                                        fltk::Output* o =       mMetricLabel;
2522                                        o->set_vertical();
2523                                        o->box(fltk::NO_BOX);
2524                                        o->labelfont(fltk::HELVETICA_BOLD);
2525                                        o->color((fltk::Color)0xe0dfe300);
2526                                        o->align(fltk::ALIGN_RIGHT);
2527                                }
2528
2529                                {
2530                                        fltk::Group* o;
2531                                        o = MainView = new fltk::Group(30, 40, 30, 60);
2532                                        o->begin();
2533                                        {
2534                                                mGeometryBased = new fltk::RadioButton(0, 8, 25, 25, "Geometry based");
2535                                                mViewPointDriven = new fltk::RadioButton(0, 23, 25, 25, "Viewpoint driven");
2536                                        }
2537                                        o->end();
2538                                }
2539
2540                                //mChangeVertices = new fltk::CheckButton(30, 104, 25, 25, "Change vertices");
2541
2542                                {
2543                                        mProcessTitle           = new fltk::Widget(0, 0, 300, 25, "");
2544                                        fltk::Widget* o =       mProcessTitle;
2545                                        o->set_vertical();
2546                                        o->box(fltk::NO_BOX);
2547                                        o->labelfont(fltk::HELVETICA_BOLD);
2548                                        o->labelsize(15.0);
2549                                        o->color((fltk::Color)0xe0dfe300);
2550                                        o->align(fltk::ALIGN_CENTER);
2551                                }
2552
2553                                /*
2554                                         {
2555                                         mTypeLabel                     = new fltk::Output(26, 82, 5, 25, "Type");
2556                                         fltk::Output* o        =       mTypeLabel;
2557                                         o->set_vertical();
2558                                         o->box(fltk::NO_BOX);
2559                                         o->labelfont(fltk::HELVETICA_BOLD);
2560                                         o->color((fltk::Color)0xe0dfe300);
2561                                         o->align(fltk::ALIGN_RIGHT);
2562                                         }
2563                                         */
2564
2565                                {
2566                                        mMeshReductionLabel     = new fltk::Output(26, 124, 5, 25, "Mesh Reduction");
2567                                        fltk::Output* o =       mMeshReductionLabel;
2568                                        o->set_vertical();
2569                                        o->box(fltk::NO_BOX);
2570                                        o->labelfont(fltk::HELVETICA_BOLD);
2571                                        o->color((fltk::Color)0xe0dfe300);
2572                                        o->align(fltk::ALIGN_RIGHT);
2573                                }
2574
2575                                //mChangeTexture = new fltk::CheckButton(30, 104, 25, 25, "Change texture");
2576
2577                                {
2578                                        fltk::Group* o;
2579                                        o = MainView = new fltk::Group(30, 140, 30, 60);
2580                                        o->begin();
2581
2582                                        {
2583                                                mPercent = new fltk::RadioButton(0, 5, 25, 25, "%");
2584                                                mVerticesNumber = new fltk::RadioButton(0, 20, 25, 25, "Vertices number");
2585                                        }
2586                                        o->end();
2587                                }
2588
2589                                {
2590                                        mMeshReduction = new fltk::FloatInput(75, 181, 75, 21, "Value:");
2591                                        fltk::FloatInput* o = mMeshReduction;
2592                                        o->type(1);
2593                                }
2594
2595                                {
2596                                        fltk::Group* o;
2597                                        o = MainView = new fltk::Group(30, 100, 30, 60);
2598                                        o->begin();
2599
2600                                        {
2601                                                mOneCacheStrip = new fltk::RadioButton(0, 4, 25, 25, "One cache strip");
2602                                                mQualityStrips = new fltk::RadioButton(0, 23, 25, 25, "Quality strips");
2603                                        }
2604                                        o->end();
2605                                }
2606
2607                                {
2608                                        fltk::Browser* o = mMeshInfo = new fltk::Browser(0, 20, 300, 380);
2609                                        o->set_vertical();
2610                                        o->callback((fltk::Callback*)cb_mMeshInfo);
2611                                }
2612                                o->end();
2613                        }       
2614
2615                        o->end();
2616
2617                        fltk::Group::current()->resizable(o);
2618                }
2619
2620                {
2621                        fltk::MenuBar* o = menuBar = new fltk::MenuBar(1, 2, 801, 21);
2622                        o->begin();
2623
2624                        //      Menu File.
2625                        {
2626                                fltk::ItemGroup* o = menuFile = new fltk::ItemGroup("File");
2627                                o->begin();
2628
2629                                {
2630                                        fltk::Item* o = menuFileOpen = new fltk::Item("Open");
2631                                        o->callback((fltk::Callback*)cb_menuFileOpen);
2632                                }
2633
2634                                {
2635                                        fltk::Item* o = menuFileSave = new fltk::Item("Save");
2636                                        o->callback((fltk::Callback*)cb_menuFileSave);
2637                                }
2638
2639                                {
2640                                        fltk::Item* o = menuOpenSaveAs = new fltk::Item("Save As");
2641                                        o->callback((fltk::Callback*)cb_menuOpenSaveAs);
2642                                }
2643
2644                                {
2645                                        fltk::Item* o = menuMeshExportOBJ = new fltk::Item("Export to OBJ");
2646                                        o->callback((fltk::Callback*)cb_menuMeshExportOBJ);
2647                                }
2648
2649                                //{
2650                                //      fltk::Item* o = menuFileTransformSharedVertex = new fltk::Item("Transform to Shared Vertex");
2651                                //      o->callback((fltk::Callback*)cb_menuFileTransformSharedVertex);
2652                                //}
2653
2654                                {
2655                                        fltk::Item* o = menuOpenQuit = new fltk::Item("Quit");
2656                                        o->callback((fltk::Callback*)cb_menuOpenQuit);
2657                                }
2658
2659                                o->end();
2660                        }
2661
2662                        //      Menu Edit.
2663                        {
2664                                fltk::ItemGroup* o = menuEdit = new fltk::ItemGroup("Edit");
2665                                o->begin();
2666
2667                                {
2668                                        fltk::Item* o = menuEditUndo = new fltk::Item("Undo");
2669                                        o->callback((fltk::Callback*)cb_menuEditUndo);
2670                                }
2671
2672                                {
2673                                        fltk::Item* o = menuEditFit = new fltk::Item("Fit");
2674                                        o->callback((fltk::Callback*)cb_menuEditFit);
2675
2676                                }
2677
2678                                {
2679                                        fltk::Item* o = menuEditRotate = new fltk::Item("Rotate");
2680                                        o->type(fltk::Item::RADIO);
2681                                        o->set_value();
2682                                        o->callback((fltk::Callback*)cb_menuEditRotate);
2683                                }
2684
2685                                {
2686                                        fltk::Item* o = menuEditPan = new fltk::Item("Pan");
2687                                        o->type(fltk::Item::RADIO);
2688                                        o->callback((fltk::Callback*)cb_menuEditPan);
2689                                }
2690
2691                                //{
2692                                //      fltk::Item* o = menuEditZoom = new fltk::Item("Zoom");
2693                                //      o->callback((fltk::Callback*)cb_menuEditZoom);
2694                                //}
2695
2696                                new fltk::Divider();
2697
2698                                {
2699                                        fltk::Item* o = menuMeshInfo = new fltk::Item("Mesh info");
2700                                        o->callback((fltk::Callback*)cb_menuMeshInfo);
2701                                }
2702
2703                                {
2704                                        fltk::Item* o;
2705                                        o = menuSelectLeaves = new fltk::Item("Select leaves");
2706                                        o->callback((fltk::Callback*)cb_menuSelectLeaves);
2707                                }
2708
2709                                o->end();
2710                        }
2711
2712                        //      Menu Render.
2713                        {
2714                                fltk::ItemGroup* o = menuRender = new fltk::ItemGroup("Render");
2715                                o->begin();
2716
2717                                {
2718                                        fltk::Item* o = menuRenderWire = new fltk::Item("Wire");
2719                                        o->type(fltk::Item::RADIO);
2720                                        o->callback((fltk::Callback*)cb_menuRenderWire);
2721                                }
2722
2723                                {
2724                                        fltk::Item* o = menuRenderSolid = new fltk::Item("Solid");
2725                                        o->type(fltk::Item::RADIO);
2726                                        o->callback((fltk::Callback*)cb_menuRenderSolid);
2727                                }
2728
2729                                //new fltk::Divider();
2730
2731                                {
2732                                        fltk::Item* o = menuRenderCW = new fltk::Item("CW");
2733                                        o->type(fltk::Item::RADIO);
2734                                        o->callback((fltk::Callback*)cb_menuRenderCW);
2735
2736                                        o->hide();
2737                                }
2738
2739                                {
2740                                        fltk::Item* o = menuRenderCCW = new fltk::Item("CCW");
2741                                        o->type(fltk::Item::RADIO);
2742                                        o->set_value();
2743                                        o->callback((fltk::Callback*)cb_menuRenderCCW);
2744
2745                                        o->hide();
2746                                }
2747
2748                                new fltk::Divider();
2749
2750                                {
2751                                        fltk::Item* o = menuRenderFlat = new fltk::Item("Flat");
2752                                        o->type(fltk::Item::RADIO);
2753                                        o->clear_value();
2754                                        o->callback((fltk::Callback*)cb_menuRenderFlat);
2755                                }
2756
2757                                {
2758                                        fltk::Item* o = menuRenderSmooth = new fltk::Item("Smooth");
2759                                        o->type(fltk::Item::RADIO);
2760                                        o->set_value();
2761                                        o->callback((fltk::Callback*)cb_menuRenderSmooth);
2762                                }
2763
2764                                //new fltk::Divider();
2765
2766                                //{
2767                                //      fltk::Item* o = menuRenderTextures = new fltk::Item("Textures");
2768                                //      o->callback((fltk::Callback*)cb_menuRenderTextures);
2769                                //}
2770
2771                                o->end();
2772                        }
2773
2774                        //      Menu Stripify.
2775                        {
2776                                fltk::Item* o = menuStripify = new fltk::Item("Stripify");
2777                                o->callback((fltk::Callback*)cb_menuStripify);
2778                        }
2779
2780                        //      Menu Simplify.
2781                        {
2782                                fltk::ItemGroup* o = menuSimplify = new fltk::ItemGroup("Simplify");
2783                                o->callback((fltk::Callback*)cb_menuSimplify);
2784                                o->begin();
2785
2786                                {
2787                                        fltk::Item* o;
2788                                        o = menuSimplifyEdgeCollapse = new fltk::Item("Mesh Simplification");
2789                                        o->callback((fltk::Callback*)cb_menuSimplifyEdgeCollapse);
2790                                }
2791
2792                                {
2793                                        fltk::Item* o;
2794                                        o = menuSimplifyLeavesCollapse = new fltk::Item("Leaves Simplification");
2795                                        o->callback((fltk::Callback*)cb_menuSimplifyLeavesCollapse);
2796                                }
2797
2798                                o->end();
2799                        }
2800
2801                        //      Menu LodStrips.
2802                        {
2803                                fltk::ItemGroup* o;
2804                                o = menuLodStrips = new fltk::ItemGroup("LodStrips");
2805                                o->begin();
2806
2807                                {
2808                                        fltk::Item* o;
2809                                        o = menuLodStripsGenerate       = new fltk::Item("Generate");
2810                                        o->callback((fltk::Callback*)cb_menuLodStripsGenerate);
2811                                }
2812
2813                                {
2814                                        fltk::Item* o;
2815                                        o = menuLodStripsVisualize      = new fltk::Item("Visualize");
2816                                        o->callback((fltk::Callback*)cb_menuLodStripsVisualize);
2817                                }
2818
2819                                o->end();
2820                        }
2821
2822                        //      Menu LodTrees.
2823                       
2824                        {
2825                                fltk::ItemGroup* o;
2826                                o = menuLodTrees = new fltk::ItemGroup("LodTrees");
2827                                o->begin();
2828
2829                                {
2830                                        fltk::Item* o;
2831                                        o = menuLodTreesGenerate = new fltk::Item("Generate");
2832                                        o->callback((fltk::Callback*)cb_menuLodTreesGenerate);
2833                                }
2834                                {
2835                                        fltk::Item* o;
2836                                        o = menuLodTreesVisualize = new fltk::Item("Visualize");
2837                                        o->callback((fltk::Callback*)cb_menuLodTreesVisualize);
2838                                }
2839
2840                                o->end();
2841                        }
2842                       
2843                       
2844                        {
2845                                fltk::ItemGroup* o = new fltk::ItemGroup("?");
2846                                o->begin();
2847
2848                                {
2849                                        fltk::Item* o = menuHelpAbout = new fltk::Item("About");
2850                                        o->callback((fltk::Callback*)cb_menuHelpAbout);
2851                                }       
2852
2853                                o->end();
2854                        }
2855
2856/*                      {
2857                                fltk::SharedImage *gifLogo = logo->get("media\\logos\\logo.gif");
2858                               
2859                                //o->callback((fltk::Callback*)cb_mLogo);
2860                               
2861                                mLogo   =       new fltk::InvisibleBox(406, 1, 43, 13);                         
2862                                mLogo->image(gifLogo);
2863                        }*/
2864
2865                        o->end();
2866                }
2867
2868                {
2869                        fltk::Group* o;
2870                        o = ApplicationBar = new fltk::Group(0, 570, 807, 28);
2871                        o->box(fltk::BORDER_BOX);
2872                        o->begin();
2873
2874                        {
2875                                fltk::Widget* o;
2876                                o = mFPS = new fltk::Widget(10, 4, 30, 15, "FPS ");
2877                                o->box(fltk::NO_BOX);
2878                                o->labelfont(fltk::HELVETICA_BOLD);
2879                                o->color((fltk::Color)0xe0dfe300);
2880                        }
2881
2882                        {
2883                                fltk::Widget* o;
2884                                o = mVertices = new fltk::Widget(154, 4, 40, 15, "Vertices");
2885                                o->box(fltk::NO_BOX);
2886                                o->labelfont(fltk::HELVETICA_BOLD);
2887                                o->color((fltk::Color)0xe0dfe300);
2888                        }
2889
2890                        {
2891                                fltk::Widget* o;
2892                                o = mTriangles = new fltk::Widget(254, 3, 40, 15, "Triangles");
2893                                o->box(fltk::NO_BOX);
2894                                o->labelfont(fltk::HELVETICA_BOLD);
2895                                o->color((fltk::Color)0xe0dfe300);
2896
2897                                //      Hide triangle count.
2898                                o->hide();
2899                        }
2900
2901                        {
2902                                fltk::Widget* o;
2903                                o = mStrips = new fltk::Widget(354, 3, 30, 15, "Strips");
2904                                o->box(fltk::NO_BOX);
2905                                o->labelfont(fltk::HELVETICA_BOLD);
2906                                o->color((fltk::Color)0xe0dfe300);
2907                        }
2908
2909                        //{
2910                        //      fltk::Widget* o;
2911                        //      o = mQuads = new fltk::Widget(454, 4, 40, 15, "Quads");
2912                        //      o->box(fltk::NO_BOX);
2913                        //      o->labelfont(fltk::HELVETICA_BOLD);
2914                        //      o->color((fltk::Color)0xe0dfe300);
2915                        //}
2916
2917                        {
2918                                fltk::Widget* o;
2919                                o = mMB = new fltk::Widget(740, 3, 30, 15, "MB");
2920                                o->box(fltk::NO_BOX);
2921                                o->labelfont(fltk::HELVETICA_BOLD);
2922                                o->color((fltk::Color)0xe0dfe300);
2923                        }
2924                        o->end();
2925                }
2926
2927
2928                o->end();
2929        }
2930       
2931        fltk::focus(geoMeshView);
2932       
2933
2934        /*Hide Right Panel*/
2935        hideRightPanel();
2936       
2937        mMainWindow->show();
2938}
2939
2940/****************/
2941/*      Destroyer               */
2942/****************/
2943GeoMeshViewUI::~GeoMeshViewUI()
2944{
2945        delete  geoMeshLoader;
2946        mMainWindow->destroy();
2947}
2948
2949//      Shows the main window.
2950void GeoMeshViewUI::show()
2951{
2952}
2953
Note: See TracBrowser for help on using the repository browser.