From c5feadbb145eecf6d73f793535b7e23eb18db2cb Mon Sep 17 00:00:00 2001 From: casallas Date: Fri, 31 Oct 2008 16:31:30 +0000 Subject: [PATCH 1/1] creaMaracasVisu Library --- CMakeLists.txt | 34 + appli/template_appli/CMakeLists.txt | 33 + appli/template_wx_appli/CMakeLists.txt | 40 + lib/CMakeLists.txt | 2 + lib/maracasVisuLib/CMakeLists.txt | 276 + lib/maracasVisuLib/include/Maracas.iss | 48 + .../include/Modules/FindCrea.cmake | 3 + .../include/Modules/FindGDCM.cmake | 104 + .../include/Modules/FindGLIB.cmake | 57 + .../include/Modules/FindGSL.cmake | 85 + .../include/Modules/FindGSLobj.cmake | 62 + .../include/Modules/FindGTK.cmake | 97 + .../include/Modules/FindGTK2.cmake | 328 + .../include/Modules/FindKGFO.cmake | 85 + .../include/Modules/FindLibido.cmake | 71 + .../include/Modules/FindMySQL.cmake | 49 + .../include/Modules/FindwxGlade.cmake | 54 + .../include/Modules/FindwxW.cmake | 573 ++ .../include/Modules/GDCMConfig.cmake | 113 + .../include/Modules/MARACAS_Find_GDCM.cmake | 16 + .../include/Modules/MARACAS_Find_ITK.cmake | 71 + .../include/Modules/MARACAS_Find_LIBIDO.cmake | 4 + .../include/Modules/MARACAS_Find_VTK.cmake | 16 + .../Modules/MARACAS_Find_WXWIDGETS.cmake | 51 + .../include/Modules/UseGDCM.cmake | 51 + lib/maracasVisuLib/include/mathdefs.h | 70 + lib/maracasVisuLib/include/matrix.h | 431 ++ lib/maracasVisuLib/include/vector.h | 382 + lib/maracasVisuLib/include/vmfuncs.h | 733 ++ lib/maracasVisuLib/src/CMakeLists.txt | 5 + lib/maracasVisuLib/src/CMakeListsWorking.txt | 5 + .../src/interface/CMakeLists.txt | 1 + .../src/interface/tcl/Makefile.am | 43 + .../src/interface/tcl/Makefile.in | 517 ++ .../src/interface/tcl/general.tcl | 135 + .../src/interface/tcl/icons/3D.gif | Bin 0 -> 1836 bytes .../src/interface/tcl/icons/add.gif | Bin 0 -> 1836 bytes .../src/interface/tcl/icons/area.gif | Bin 0 -> 862 bytes .../src/interface/tcl/icons/back.gif | Bin 0 -> 1294 bytes .../src/interface/tcl/icons/bright.gif | Bin 0 -> 1294 bytes .../src/interface/tcl/icons/clear.gif | Bin 0 -> 862 bytes .../src/interface/tcl/icons/connect.gif | Bin 0 -> 2192 bytes .../src/interface/tcl/icons/continue.gif | Bin 0 -> 1836 bytes .../src/interface/tcl/icons/del_axis.gif | Bin 0 -> 1836 bytes .../src/interface/tcl/icons/excel.gif | Bin 0 -> 1844 bytes .../src/interface/tcl/icons/extract.gif | Bin 0 -> 1836 bytes .../src/interface/tcl/icons/help.gif | Bin 0 -> 1294 bytes .../src/interface/tcl/icons/imagebrowser.gif | Bin 0 -> 1844 bytes .../src/interface/tcl/icons/intensity.gif | Bin 0 -> 862 bytes .../src/interface/tcl/icons/linear.gif | Bin 0 -> 862 bytes .../src/interface/tcl/icons/loadexp.gif | Bin 0 -> 1844 bytes .../src/interface/tcl/icons/pan.gif | Bin 0 -> 1532 bytes .../src/interface/tcl/icons/params.gif | Bin 0 -> 1844 bytes .../src/interface/tcl/icons/plans.gif | Bin 0 -> 1844 bytes .../src/interface/tcl/icons/quant.gif | Bin 0 -> 2233 bytes .../src/interface/tcl/icons/redblue.gif | Bin 0 -> 1312 bytes .../src/interface/tcl/icons/redgreen.gif | Bin 0 -> 1312 bytes .../src/interface/tcl/icons/rotate.gif | Bin 0 -> 1836 bytes .../src/interface/tcl/icons/save.gif | Bin 0 -> 1844 bytes .../src/interface/tcl/icons/subtract.gif | Bin 0 -> 1844 bytes .../src/interface/tcl/icons/wizard.gif | Bin 0 -> 2460 bytes .../src/interface/tcl/icons/zoom.gif | Bin 0 -> 1532 bytes .../src/interface/tcl/marTcl.dsp | 142 + .../src/interface/tcl/marTclInterface.h | 469 ++ .../src/interface/tcl/maracas_start.tcl | 42 + .../src/interface/tcl/string_table.tcl | 185 + .../src/interface/tcl/tclexe.dsp | 241 + .../src/interface/tcl/tkwidgets/Makefile.am | 9 + .../src/interface/tcl/tkwidgets/Makefile.in | 224 + .../src/interface/tcl/tkwidgets/combobox.tcl | 1989 +++++ .../src/interface/tcl/tkwidgets/ibrowser.tcl | 1453 ++++ .../src/interface/tcl/tkwidgets/imagepp.tcl | 1697 +++++ .../src/interface/tcl/tkwidgets/mclistbox.tcl | 2604 +++++++ .../src/interface/tcl/to_change/Makefile.am | 11 + .../src/interface/tcl/to_change/Makefile.in | 224 + .../tcl/to_change/TkImageViewerInteractor.tcl | 258 + .../interface/tcl/to_change/TkInteractor.tcl | 580 ++ .../interface/tcl/to_change/WidgetObject.tcl | 52 + .../interface/tcl/to_change/ev_userzoom.tcl | 496 ++ .../tcl/to_change/volTkInteractor.tcl | 431 ++ .../src/interface/tcl/to_change/vtkInt.tcl | 99 + .../src/interface/tcl/windows/Makefile.am | 20 + .../src/interface/tcl/windows/Makefile.in | 330 + .../tcl/windows/choose_direction.tcl | 118 + .../interface/tcl/windows/data_browser.tcl | 416 ++ .../interface/tcl/windows/dlg_name_axis.tcl | 83 + .../src/interface/tcl/windows/dlg_params.tcl | 1301 ++++ .../interface/tcl/windows/global_window.tcl | 900 +++ .../src/interface/tcl/windows/help_wnd.tcl | 68 + .../interface/tcl/windows/image_browser.tcl | 591 ++ .../interface/tcl/windows/planes_window.tcl | 2932 ++++++++ .../src/interface/tcl/windows/subtract.tcl | 182 + .../src/interface/tcl/windows/u_3D.tcl | 293 + .../src/interface/tcl/windows/u_mip.tcl | 237 + .../src/interface/tcl/windows/u_mpr.tcl | 687 ++ .../src/interface/tcl/windows/u_surf.tcl | 1655 +++++ .../src/interface/tcl/wrap_maracas.i | 216 + .../src/interface/wxWindows/CMakeLists.txt | 631 ++ .../wxWindows/Contour/AutoControlPoints.cxx | 1723 +++++ .../wxWindows/Contour/AutoControlPoints.h | 112 + .../wxWindows/Contour/ContourCrownWidget.cxx | 686 ++ .../wxWindows/Contour/ContourCrownWidget.h | 112 + .../wxWindows/Contour/ContourExtractData.cxx | 469 ++ .../wxWindows/Contour/ContourExtractData.h | 71 + .../wxWindows/Contour/ContourPropagation.cxx | 316 + .../wxWindows/Contour/ContourPropagation.h | 73 + .../wxWindows/Contour/ContourVOIWidget.cxx | 211 + .../wxWindows/Contour/ContourVOIWidget.h | 72 + .../Contour/ExtractControlPoints2D.cxx | 113 + .../Contour/ExtractControlPoints2D.h | 37 + .../wxWindows/Contour/Propagation.cxx | 1237 ++++ .../interface/wxWindows/Contour/Propagation.h | 101 + .../Contour/contoursIntersection.cxx | 38 + .../wxWindows/Contour/contoursIntersection.h | 50 + .../wxWindows/Contour/vectorFunctions.cxx | 176 + .../wxWindows/Contour/vectorFunctions.h | 30 + .../src/interface/wxWindows/MaracasDll.cpp | 195 + .../src/interface/wxWindows/MaracasDll.h | 68 + .../src/interface/wxWindows/StdAfx.cpp | 8 + .../src/interface/wxWindows/StdAfx.h | 29 + .../src/interface/wxWindows/manualContour.cpp | 5127 +++++++++++++ .../src/interface/wxWindows/manualContour.h | 978 +++ .../wxWindows/manualContourContainer.cxx | 738 ++ .../wxWindows/manualContourContainer.h | 113 + .../src/interface/wxWindows/marDict.txt | 277 + .../src/interface/wxWindows/marDictionary.cxx | 455 ++ .../src/interface/wxWindows/marDictionary.h | 50 + .../interface/wxWindows/res/bitmaps/3D.bmp | Bin 0 -> 2038 bytes .../interface/wxWindows/res/bitmaps/3D.xpm | 87 + .../wxWindows/res/bitmaps/Axis_JF.bmp | Bin 0 -> 3278 bytes .../wxWindows/res/bitmaps/Axis_JF.xpm | 309 + .../wxWindows/res/bitmaps/Axis_JF_MH1.bmp | Bin 0 -> 3278 bytes .../wxWindows/res/bitmaps/Axis_JF_MH1.xpm | 309 + .../wxWindows/res/bitmaps/Axis_JF_MH2.bmp | Bin 0 -> 3278 bytes .../wxWindows/res/bitmaps/Axis_JF_MH2.xpm | 309 + .../interface/wxWindows/res/bitmaps/MPR.bmp | Bin 0 -> 3278 bytes .../interface/wxWindows/res/bitmaps/MPR.xpm | 309 + .../wxWindows/res/bitmaps/ProcessingCT.bmp | Bin 0 -> 3278 bytes .../wxWindows/res/bitmaps/ProcessingCT.xpm | 309 + .../res/bitmaps/QuantificationCT.bmp | Bin 0 -> 3278 bytes .../res/bitmaps/QuantificationCT.xpm | 309 + .../interface/wxWindows/res/bitmaps/add.bmp | Bin 0 -> 2878 bytes .../interface/wxWindows/res/bitmaps/add.xpm | 101 + .../interface/wxWindows/res/bitmaps/area.bmp | Bin 0 -> 2558 bytes .../interface/wxWindows/res/bitmaps/area.xpm | 47 + .../wxWindows/res/bitmaps/authors.bmp | Bin 0 -> 900054 bytes .../wxWindows/res/bitmaps/authors.xpm | 860 +++ .../interface/wxWindows/res/bitmaps/back.bmp | Bin 0 -> 2038 bytes .../interface/wxWindows/res/bitmaps/back.xpm | 72 + .../wxWindows/res/bitmaps/bright.bmp | Bin 0 -> 2878 bytes .../wxWindows/res/bitmaps/bright.xpm | 71 + .../interface/wxWindows/res/bitmaps/clear.bmp | Bin 0 -> 2558 bytes .../interface/wxWindows/res/bitmaps/clear.xpm | 47 + .../wxWindows/res/bitmaps/colours.bmp | Bin 0 -> 122 bytes .../wxWindows/res/bitmaps/colours.xpm | 13 + .../wxWindows/res/bitmaps/connect.bmp | Bin 0 -> 3278 bytes .../wxWindows/res/bitmaps/connect.xpm | 87 + .../wxWindows/res/bitmaps/continue.bmp | Bin 0 -> 2878 bytes .../wxWindows/res/bitmaps/continue.xpm | 94 + .../wxWindows/res/bitmaps/creatis_logo.bmp | Bin 0 -> 2758 bytes .../wxWindows/res/bitmaps/creatis_logo.xpm | 279 + .../wxWindows/res/bitmaps/creatis_logo2.bmp | Bin 0 -> 7638 bytes .../interface/wxWindows/res/bitmaps/cross.bmp | Bin 0 -> 198 bytes .../interface/wxWindows/res/bitmaps/cross.xpm | 18 + .../wxWindows/res/bitmaps/cutter.bmp | Bin 0 -> 3534 bytes .../wxWindows/res/bitmaps/cutter.xpm | 322 + .../wxWindows/res/bitmaps/del_axis.bmp | Bin 0 -> 4678 bytes .../wxWindows/res/bitmaps/del_axis.xpm | 95 + .../wxWindows/res/bitmaps/disable.bmp | Bin 0 -> 630 bytes .../wxWindows/res/bitmaps/disable.xpm | 40 + .../interface/wxWindows/res/bitmaps/excel.bmp | Bin 0 -> 3278 bytes .../interface/wxWindows/res/bitmaps/excel.xpm | 77 + .../interface/wxWindows/res/bitmaps/exit.bmp | Bin 0 -> 246 bytes .../interface/wxWindows/res/bitmaps/exit.xpm | 27 + .../wxWindows/res/bitmaps/extract.bmp | Bin 0 -> 4678 bytes .../wxWindows/res/bitmaps/extract.xpm | 95 + .../interface/wxWindows/res/bitmaps/help.bmp | Bin 0 -> 2038 bytes .../interface/wxWindows/res/bitmaps/help.xpm | 65 + .../wxWindows/res/bitmaps/imagebrowser.bmp | Bin 0 -> 3278 bytes .../wxWindows/res/bitmaps/imagebrowser.xpm | 76 + .../wxWindows/res/bitmaps/intensity.bmp | Bin 0 -> 2558 bytes .../wxWindows/res/bitmaps/intensity.xpm | 47 + .../wxWindows/res/bitmaps/linear.bmp | Bin 0 -> 2558 bytes .../wxWindows/res/bitmaps/linear.xpm | 48 + .../wxWindows/res/bitmaps/loadexp.bmp | Bin 0 -> 3278 bytes .../wxWindows/res/bitmaps/loadexp.xpm | 73 + .../interface/wxWindows/res/bitmaps/logo.bmp | Bin 0 -> 3878 bytes .../interface/wxWindows/res/bitmaps/logo.xpm | 94 + .../wxWindows/res/bitmaps/logocreatis.bmp | Bin 0 -> 150490 bytes .../interface/wxWindows/res/bitmaps/pan.bmp | Bin 0 -> 2878 bytes .../interface/wxWindows/res/bitmaps/pan.xpm | 74 + .../wxWindows/res/bitmaps/params.bmp | Bin 0 -> 2038 bytes .../wxWindows/res/bitmaps/params.xpm | 74 + .../interface/wxWindows/res/bitmaps/plans.bmp | Bin 0 -> 2038 bytes .../interface/wxWindows/res/bitmaps/plans.xpm | 83 + .../interface/wxWindows/res/bitmaps/quant.bmp | Bin 0 -> 2038 bytes .../interface/wxWindows/res/bitmaps/quant.xpm | 78 + .../wxWindows/res/bitmaps/redblue.bmp | Bin 0 -> 3318 bytes .../wxWindows/res/bitmaps/redblue.xpm | 37 + .../wxWindows/res/bitmaps/redgreen.bmp | Bin 0 -> 3318 bytes .../wxWindows/res/bitmaps/redgreen.xpm | 37 + .../wxWindows/res/bitmaps/rotate.bmp | Bin 0 -> 2878 bytes .../wxWindows/res/bitmaps/rotate.xpm | 95 + .../interface/wxWindows/res/bitmaps/save.bmp | Bin 0 -> 3278 bytes .../interface/wxWindows/res/bitmaps/save.xpm | 73 + .../interface/wxWindows/res/bitmaps/stl.bmp | Bin 0 -> 1474 bytes .../interface/wxWindows/res/bitmaps/stl.xpm | 55 + .../wxWindows/res/bitmaps/subtract.bmp | Bin 0 -> 3278 bytes .../wxWindows/res/bitmaps/subtract.xpm | 79 + .../interface/wxWindows/res/bitmaps/tick.bmp | Bin 0 -> 198 bytes .../interface/wxWindows/res/bitmaps/tick.xpm | 18 + .../wxWindows/res/bitmaps/vessels.bmp | Bin 0 -> 2774 bytes .../wxWindows/res/bitmaps/vessels.xpm | 56 + .../wxWindows/res/bitmaps/wizard.bmp | Bin 0 -> 2038 bytes .../wxWindows/res/bitmaps/wizard.xpm | 95 + .../interface/wxWindows/res/bitmaps/zoom.bmp | Bin 0 -> 2038 bytes .../interface/wxWindows/res/bitmaps/zoom.xpm | 76 + .../wxWindows/res/bitmaps2/maracas_01.xcf | Bin 0 -> 107860 bytes .../wxWindows/res/bitmaps2/maracas_02.xcf | Bin 0 -> 49112 bytes .../bitmaps2/v2_bi_bl_CTQuantification.bmp | Bin 0 -> 30054 bytes .../bitmaps2/v2_bi_bl_CTQuantification.xpm | 820 +++ .../bitmaps2/v2_bi_bl_IRMQuantification.bmp | Bin 0 -> 30054 bytes .../bitmaps2/v2_bi_bl_IRMQuantification.xpm | 820 +++ .../res/bitmaps2/v2_bi_bl_Information.bmp | Bin 0 -> 30054 bytes .../res/bitmaps2/v2_bi_bl_Information.xpm | 977 +++ .../res/bitmaps2/v2_bi_bl_ListPatient_Voi.bmp | Bin 0 -> 11078 bytes .../res/bitmaps2/v2_bi_bl_ListPatient_Voi.xpm | 359 + .../wxWindows/res/bitmaps2/v2_bi_bl_Logo.bmp | Bin 0 -> 30054 bytes .../wxWindows/res/bitmaps2/v2_bi_bl_Logo.xpm | 355 + .../bitmaps2/v2_bi_bl_ManualRegistration.bmp | Bin 0 -> 30054 bytes .../bitmaps2/v2_bi_bl_ManualRegistration.xpm | 738 ++ .../res/bitmaps2/v2_bi_bl_Params.bmp | Bin 0 -> 30054 bytes .../res/bitmaps2/v2_bi_bl_Params.xpm | 405 ++ .../res/bitmaps2/v2_bi_bl_Processing.bmp | Bin 0 -> 30054 bytes .../res/bitmaps2/v2_bi_bl_Processing.xpm | 476 ++ .../res/bitmaps2/v2_bi_bl_STLFormat.bmp | Bin 0 -> 30054 bytes .../res/bitmaps2/v2_bi_bl_STLFormat.xpm | 576 ++ .../wxWindows/res/bitmaps2/v2_bi_bl_Tests.bmp | Bin 0 -> 30054 bytes .../wxWindows/res/bitmaps2/v2_bi_bl_Tests.xpm | 660 ++ .../res/bitmaps2/v2_bi_bl_VascularTree.bmp | Bin 0 -> 30054 bytes .../res/bitmaps2/v2_bi_bl_VascularTree.xpm | 541 ++ .../wxWindows/res/bitmaps2/v2_bi_mask.bmp | Bin 0 -> 1662 bytes .../wxWindows/res/bitmaps2/v2_bi_mask.xpm | 105 + .../bitmaps2/v2_bi_re_CTQuantification.bmp | Bin 0 -> 30054 bytes .../bitmaps2/v2_bi_re_CTQuantification.xpm | 823 +++ .../bitmaps2/v2_bi_re_IRMQuantification.bmp | Bin 0 -> 30054 bytes .../bitmaps2/v2_bi_re_IRMQuantification.xpm | 823 +++ .../res/bitmaps2/v2_bi_re_ListPatient_Voi.bmp | Bin 0 -> 8290 bytes .../res/bitmaps2/v2_bi_re_ListPatient_Voi.xpm | 358 + .../wxWindows/res/bitmaps2/v2_bi_re_Logo.bmp | Bin 0 -> 30054 bytes .../wxWindows/res/bitmaps2/v2_bi_re_Logo.xpm | 359 + .../bitmaps2/v2_bi_re_ManualRegistration.bmp | Bin 0 -> 30054 bytes .../bitmaps2/v2_bi_re_ManualRegistration.xpm | 742 ++ .../res/bitmaps2/v2_bi_re_Params.bmp | Bin 0 -> 30054 bytes .../res/bitmaps2/v2_bi_re_Params.xpm | 406 ++ .../res/bitmaps2/v2_bi_re_Processing.bmp | Bin 0 -> 30054 bytes .../res/bitmaps2/v2_bi_re_Processing.xpm | 429 ++ .../res/bitmaps2/v2_bi_re_STLFormat.bmp | Bin 0 -> 30054 bytes .../res/bitmaps2/v2_bi_re_STLFormat.xpm | 580 ++ .../wxWindows/res/bitmaps2/v2_bi_re_Tests.bmp | Bin 0 -> 30054 bytes .../wxWindows/res/bitmaps2/v2_bi_re_Tests.xpm | 662 ++ .../res/bitmaps2/v2_bi_re_VascularTree.bmp | Bin 0 -> 30054 bytes .../res/bitmaps2/v2_bi_re_VascularTree.xpm | 546 ++ .../res/bitmaps2/v2_sm_bl_AddAllPatients.bmp | Bin 0 -> 7654 bytes .../res/bitmaps2/v2_sm_bl_AddAllPatients.xpm | 1156 +++ .../res/bitmaps2/v2_sm_bl_AddPatient.bmp | Bin 0 -> 7654 bytes .../res/bitmaps2/v2_sm_bl_AddPatient.xpm | 1120 +++ .../res/bitmaps2/v2_sm_bl_AxisExtraction.bmp | Bin 0 -> 7654 bytes .../res/bitmaps2/v2_sm_bl_AxisExtraction.xpm | 808 +++ .../res/bitmaps2/v2_sm_bl_CreateDICOMDIR.bmp | Bin 0 -> 7654 bytes .../res/bitmaps2/v2_sm_bl_CreateDICOMDIR.xpm | 1152 +++ .../res/bitmaps2/v2_sm_bl_ListPatient.bmp | Bin 0 -> 7654 bytes .../res/bitmaps2/v2_sm_bl_ListPatient.xpm | 791 ++ .../wxWindows/res/bitmaps2/v2_sm_bl_MPR.bmp | Bin 0 -> 7654 bytes .../wxWindows/res/bitmaps2/v2_sm_bl_MPR.xpm | 824 +++ .../res/bitmaps2/v2_sm_bl_OpenDICOMDIR.bmp | Bin 0 -> 7654 bytes .../res/bitmaps2/v2_sm_bl_OpenDICOMDIR.xpm | 1068 +++ .../res/bitmaps2/v2_sm_bl_OpenDirectory.bmp | Bin 0 -> 7654 bytes .../res/bitmaps2/v2_sm_bl_OpenDirectory.xpm | 814 +++ .../res/bitmaps2/v2_sm_bl_Processing.bmp | Bin 0 -> 7654 bytes .../res/bitmaps2/v2_sm_bl_Processing.xpm | 791 ++ .../res/bitmaps2/v2_sm_bl_ProcessingCT.bmp | Bin 0 -> 7654 bytes .../res/bitmaps2/v2_sm_bl_ProcessingCT.xpm | 921 +++ .../res/bitmaps2/v2_sm_bl_Quantification.bmp | Bin 0 -> 7654 bytes .../res/bitmaps2/v2_sm_bl_Quantification.xpm | 948 +++ .../res/bitmaps2/v2_sm_bl_STLFormat.bmp | Bin 0 -> 7654 bytes .../res/bitmaps2/v2_sm_bl_STLFormat.xpm | 915 +++ .../v2_sm_bl_TreeExtraction_JF_MH.bmp | Bin 0 -> 7654 bytes .../v2_sm_bl_TreeExtraction_JF_MH.xpm | 1167 +++ .../wxWindows/res/bitmaps2/v2_sm_bl_voi.bmp | Bin 0 -> 7654 bytes .../wxWindows/res/bitmaps2/v2_sm_bl_voi.xpm | 865 +++ .../wxWindows/res/bitmaps2/v2_sm_mask.bmp | Bin 0 -> 462 bytes .../wxWindows/res/bitmaps2/v2_sm_mask.xpm | 55 + .../res/bitmaps2/v2_sm_re_ListPatient.bmp | Bin 0 -> 7654 bytes .../res/bitmaps2/v2_sm_re_ListPatient.xpm | 804 +++ .../wxWindows/res/bitmaps2/v2_sm_re_voi.bmp | Bin 0 -> 7654 bytes .../wxWindows/res/bitmaps2/v2_sm_re_voi.xpm | 874 +++ .../wxWindows/res/bitmaps2/v2_sm_tr_MPR.bmp | Bin 0 -> 7654 bytes .../wxWindows/res/bitmaps2/v2_sm_tr_MPR.xpm | 566 ++ .../res/bitmaps2/v2_sm_tr_Processing.bmp | Bin 0 -> 7654 bytes .../res/bitmaps2/v2_sm_tr_Processing.xpm | 576 ++ .../res/bitmaps2/v2_sm_tr_Quantification.bmp | Bin 0 -> 7654 bytes .../res/bitmaps2/v2_sm_tr_Quantification.xpm | 615 ++ .../res/bitmaps2/v2_sm_tr_STLFormat.bmp | Bin 0 -> 7654 bytes .../res/bitmaps2/v2_sm_tr_STLFormat.xpm | 594 ++ .../wxWindows/res/bitmaps2/v2_sm_tr_VOI.bmp | Bin 0 -> 7654 bytes .../wxWindows/res/bitmaps2/v2_sm_tr_VOI.xpm | 577 ++ .../wxWindows/res/dialogs/marDiagParameters.h | 172 + .../res/dialogs/marDiagParameters.wxr | 264 + .../wxWindows/res/dialogs/ressource.wxg | 1133 +++ .../interface/wxWindows/res/icons/maracas.ico | Bin 0 -> 766 bytes .../interface/wxWindows/res/icons/maracas.xpm | 44 + .../interface/wxWindows/res/wxInterface.rc | 84 + .../interface/wxWindows/tools/CMakeLists.txt | 31 + .../wxWindows/tools/MaracasTools.cpp | 245 + .../interface/wxWindows/tools/MaracasTools.h | 83 + .../wxWindows/widgets/ContourView.cxx | 88 + .../interface/wxWindows/widgets/ContourView.h | 49 + .../widgets/InterfaceVtkPanelWidgets.cxx | 28 + .../widgets/InterfaceVtkPanelWidgets.h | 30 + .../interface/wxWindows/widgets/LineView.cxx | 94 + .../interface/wxWindows/widgets/LineView.h | 37 + .../interface/wxWindows/widgets/PointView.cxx | 92 + .../interface/wxWindows/widgets/PointView.h | 47 + .../src/interface/wxWindows/widgets/README | 10 + .../widgets/UtilVtk3DGeometriSelection.cxx | 284 + .../widgets/UtilVtk3DGeometriSelection.h | 51 + .../src/interface/wxWindows/widgets/chart.cpp | 1034 +++ .../src/interface/wxWindows/widgets/chart.h | 213 + .../wxWindows/widgets/pPlotter/Histogram.cxx | 153 + .../wxWindows/widgets/pPlotter/Histogram.h | 81 + .../widgets/pPlotter/HistogramDialog.cxx | 490 ++ .../widgets/pPlotter/HistogramDialog.h | 178 + .../widgets/pPlotter/HistogramWidget.cxx | 345 + .../widgets/pPlotter/HistogramWidget.h | 167 + .../widgets/pPlotter/LogicalColorBar.cxx | 308 + .../widgets/pPlotter/LogicalColorBar.h | 113 + .../widgets/pPlotter/MaximumsDialog.cxx | 77 + .../widgets/pPlotter/MaximumsDialog.h | 94 + .../wxWindows/widgets/pPlotter/mBarRange.cxx | 1397 ++++ .../wxWindows/widgets/pPlotter/mBarRange.h | 449 ++ .../wxWindows/widgets/pPlotter/mathplot.cxx | 739 ++ .../wxWindows/widgets/pPlotter/mathplot.h | 887 +++ .../wxWindows/widgets/pPlotter/pColorBar.cxx | 1526 ++++ .../wxWindows/widgets/pPlotter/pColorBar.h | 762 ++ .../widgets/pPlotter/pColorPoint.cxx | 71 + .../wxWindows/widgets/pPlotter/pColorPoint.h | 98 + .../wxWindows/widgets/pPlotter/pFigure.cxx | 288 + .../wxWindows/widgets/pPlotter/pFigure.h | 163 + .../widgets/pPlotter/pFunctionPoint.cxx | 69 + .../widgets/pPlotter/pFunctionPoint.h | 99 + .../widgets/pPlotter/pGraphicalFunction.cxx | 847 +++ .../widgets/pPlotter/pGraphicalFunction.h | 1021 +++ .../wxWindows/widgets/pPlotter/pHistogram.cxx | 270 + .../wxWindows/widgets/pPlotter/pHistogram.h | 156 + .../widgets/pPlotter/pLogicalFunction.cxx | 806 +++ .../widgets/pPlotter/pLogicalFunction.h | 368 + .../wxWindows/widgets/pPlotter/pPlotter.cxx | 721 ++ .../wxWindows/widgets/pPlotter/pPlotter.h | 246 + .../widgets/pPlotter/pPlotterLayer.cxx | 628 ++ .../widgets/pPlotter/pPlotterLayer.h | 257 + .../widgets/pPlotter/pPlotterScaleX.cxx | 103 + .../widgets/pPlotter/pPlotterScaleX.h | 49 + .../widgets/pPlotter/pPlotterScaleY.cxx | 103 + .../widgets/pPlotter/pPlotterScaleY.h | 50 + .../widgets/pPlotter/pPlotterWindow.cxx | 1856 +++++ .../widgets/pPlotter/pPlotterWindow.h | 404 ++ .../interface/wxWindows/widgets/res/area.xpm | 297 + .../wxWindows/widgets/res/bright.xpm | 310 + .../wxWindows/widgets/res/cine_loop.xpm | 310 + .../interface/wxWindows/widgets/res/clear.xpm | 297 + .../wxWindows/widgets/res/intensity.xpm | 297 + .../wxWindows/widgets/res/linear.xpm | 297 + .../widgets/vtk2DQuantSliceWidget.cxx | 189 + .../wxWindows/widgets/vtk2DQuantSliceWidget.h | 78 + .../widgets/vtk3DQuantSurfaceWidget.cxx | 610 ++ .../widgets/vtk3DQuantSurfaceWidget.h | 161 + .../widgets/vtk3DSurfaceSTLWidget.cxx | 817 +++ .../wxWindows/widgets/vtk3DSurfaceSTLWidget.h | 136 + .../wxWindows/widgets/vtk3DSurfaceWidget.cxx | 515 ++ .../wxWindows/widgets/vtk3DSurfaceWidget.h | 134 + .../wxWindows/widgets/vtkClosePolyData.cxx | 94 + .../wxWindows/widgets/vtkClosePolyData.h | 57 + .../vtkImagePolyDataSeedConnectivity.cxx | 423 ++ .../vtkImagePolyDataSeedConnectivity.h | 69 + .../widgets/vtkInteractorStyleCutter.cxx | 192 + .../widgets/vtkInteractorStyleCutter.h | 82 + .../interface/wxWindows/widgets/wxChart.cxx | 954 +++ .../src/interface/wxWindows/widgets/wxChart.h | 219 + .../wxWindows/widgets/wxEmptyPanelWidget.cxx | 282 + .../wxWindows/widgets/wxEmptyPanelWidget.h | 63 + .../widgets/wxEmptyPanelWidget_2.cxx | 1075 +++ .../wxWindows/widgets/wxEmptyPanelWidget_2.h | 149 + .../widgets/wxEmptyPanel_3_Widget.cxx | 283 + .../wxWindows/widgets/wxEmptyPanel_3_Widget.h | 59 + .../wxWindows/widgets/wxImageBrowserWdg.cxx | 257 + .../wxWindows/widgets/wxImageBrowserWdg.h | 74 + .../wxWindows/widgets/wxImageViewerWidget.cxx | 630 ++ .../wxWindows/widgets/wxImageViewerWidget.h | 138 + .../wxWindows/widgets/wxMPRBaseData.cxx | 1112 +++ .../wxWindows/widgets/wxMPRBaseData.h | 344 + .../wxWindows/widgets/wxMPRWidget.cxx | 6365 +++++++++++++++++ .../interface/wxWindows/widgets/wxMPRWidget.h | 1029 +++ .../widgets/wxManualRegistration3D.cxx | 504 ++ .../widgets/wxManualRegistration3D.h | 122 + .../wxManualSegmentation_MPRWidget.cxx | 207 + .../widgets/wxManualSegmentation_MPRWidget.h | 79 + .../widgets/wxManualTree_MPRWidget.cxx | 353 + .../widgets/wxManualTree_MPRWidget.h | 117 + .../widgets/wxMaracas_N_ViewersWidget.cxx | 249 + .../widgets/wxMaracas_N_ViewersWidget.h | 95 + .../widgets/wxMaracas_ViewerWidget.cxx | 248 + .../widgets/wxMaracas_ViewerWidget.h | 99 + .../wxWindows/widgets/wxParametersDialog.cpp | 379 + .../wxWindows/widgets/wxParametersDialog.h | 156 + .../widgets/wxPathologyWidget_01.cxx | 1316 ++++ .../wxWindows/widgets/wxPathologyWidget_01.h | 201 + .../widgets/wxProcessingCTWidget.cxx | 597 ++ .../wxWindows/widgets/wxProcessingCTWidget.h | 116 + .../widgets/wxQuantificationWidget.cxx | 2298 ++++++ .../widgets/wxQuantificationWidget.h | 371 + .../widgets/wxQuantificationWidgetCT.cxx | 2149 ++++++ .../widgets/wxQuantificationWidgetCT.h | 452 ++ .../widgets/wxQuantificationWidget_base.cxx | 1339 ++++ .../widgets/wxQuantificationWidget_base.h | 312 + .../widgets/wxReadingPriorityPanel.cpp | 1172 +++ .../widgets/wxReadingPriorityPanel.h | 299 + .../wxWindows/widgets/wxSTLWidget_02.cxx | 726 ++ .../wxWindows/widgets/wxSTLWidget_02.h | 167 + .../wxWindows/widgets/wxSTLWidget_03.cxx | 1033 +++ .../wxWindows/widgets/wxSTLWidget_03.h | 197 + .../widgets/wxSegmentationFM3DWidget.cxx | 426 ++ .../widgets/wxSegmentationFM3DWidget.h | 144 + .../wxWindows/widgets/wxSurfaceMPR.cxx | 1226 ++++ .../wxWindows/widgets/wxSurfaceMPR.h | 287 + .../wxWindows/widgets/wxSurfaceSTLWidget.cxx | 310 + .../wxWindows/widgets/wxSurfaceSTLWidget.h | 111 + .../wxWindows/widgets/wxSurfaceWidget.cxx | 455 ++ .../wxWindows/widgets/wxSurfaceWidget.h | 116 + .../widgets/wxVTKRenderWindowInteractor.cxx | 768 ++ .../widgets/wxVTKRenderWindowInteractor.h | 176 + ...wxVTKRenderWindowInteractorEditContour.cxx | 328 + .../wxVTKRenderWindowInteractorEditContour.h | 221 + .../wxWindows/widgets/wxVtkBaseView.cxx | 1737 +++++ .../wxWindows/widgets/wxVtkBaseView.h | 449 ++ .../interface/wxWindows/wxILPDwithImage.cxx | 452 ++ .../src/interface/wxWindows/wxILPDwithImage.h | 63 + .../wxWindows/wxMaracas3DBrowser.cxx | 76 + .../interface/wxWindows/wxMaracas3DBrowser.h | 48 + .../src/interface/wxWindows/wxMaracasApp.cxx | 1180 +++ .../src/interface/wxWindows/wxMaracasApp.h | 69 + .../interface/wxWindows/wxMaracasApp02.cxx | 253 + .../src/interface/wxWindows/wxMaracasApp02.h | 61 + .../wxWindows/wxMaracasDataBrowser.cxx | 389 + .../wxWindows/wxMaracasDataBrowser.h | 70 + .../wxWindows/wxMaracasEmptyPanel.cxx | 50 + .../interface/wxWindows/wxMaracasEmptyPanel.h | 41 + .../wxWindows/wxMaracasEmptyPanel_2.cxx | 47 + .../wxWindows/wxMaracasEmptyPanel_2.h | 42 + .../wxWindows/wxMaracasEmptyPanel_3.cxx | 867 +++ .../wxWindows/wxMaracasEmptyPanel_3.h | 106 + .../interface/wxWindows/wxMaracasFrame.cxx | 476 ++ .../src/interface/wxWindows/wxMaracasFrame.h | 106 + .../interface/wxWindows/wxMaracasFrame02.cxx | 4241 +++++++++++ .../interface/wxWindows/wxMaracasFrame02.h | 661 ++ .../wxWindows/wxMaracasHelpDialog.cxx | 197 + .../interface/wxWindows/wxMaracasHelpDialog.h | 44 + .../wxWindows/wxMaracasImageBrowser.cxx | 62 + .../wxWindows/wxMaracasImageBrowser.h | 50 + .../wxWindows/wxMaracasImageBrowser02.cxx | 291 + .../wxWindows/wxMaracasImageBrowser02.h | 96 + .../src/interface/wxWindows/wxMaracasMPR.cxx | 71 + .../src/interface/wxWindows/wxMaracasMPR.h | 47 + .../wxWindows/wxMaracasParametersDialog.cxx | 578 ++ .../wxWindows/wxMaracasParametersDialog.h | 69 + .../wxWindows/wxMaracasPathology_01.cxx | 53 + .../wxWindows/wxMaracasPathology_01.h | 42 + .../wxWindows/wxMaracasProcessingCT.cxx | 66 + .../wxWindows/wxMaracasProcessingCT.h | 47 + .../wxWindows/wxMaracasQuantification.cxx | 92 + .../wxWindows/wxMaracasQuantification.h | 47 + .../wxWindows/wxMaracasQuantificationCT.cxx | 106 + .../wxWindows/wxMaracasQuantificationCT.h | 49 + .../wxMaracas_ManualContour_Panel.cxx | 175 + .../wxWindows/wxMaracas_ManualContour_Panel.h | 64 + .../wxMaracas_ManualSegmentation_MPR.cxx | 72 + .../wxMaracas_ManualSegmentation_MPR.h | 48 + .../wxWindows/wxMaracas_ManualTree_MPR.cxx | 78 + .../wxWindows/wxMaracas_ManualTree_MPR.h | 49 + .../wxWindows/wxMaracas_ManualTree_MPRDlg.cxx | 121 + .../wxWindows/wxMaracas_ManualTree_MPRDlg.h | 51 + .../wxWindows/wxMaracas_SegmentationFM3D.cxx | 73 + .../wxWindows/wxMaracas_SegmentationFM3D.h | 48 + lib/maracasVisuLib/src/kernel/CMakeLists.txt | 96 + lib/maracasVisuLib/src/kernel/README | 8 + .../src/kernel/axisExtractor.cxx | 1143 +++ lib/maracasVisuLib/src/kernel/axisExtractor.h | 166 + .../src/kernel/axisExtractor02.cxx | 4026 +++++++++++ .../src/kernel/axisExtractor02.h | 385 + .../src/kernel/carotidaBifurcacion.cxx | 1054 +++ .../src/kernel/carotidaBifurcacion.h | 123 + lib/maracasVisuLib/src/kernel/curve.cxx | 580 ++ lib/maracasVisuLib/src/kernel/curve.hxx | 104 + lib/maracasVisuLib/src/kernel/gslobj.hxx | 261 + lib/maracasVisuLib/src/kernel/itkFM3D.cxx | 416 ++ lib/maracasVisuLib/src/kernel/itkFM3D.h | 36 + .../src/kernel/itkImageToVTKImageFilter.h | 103 + .../src/kernel/itkImageToVTKImageFilter.txx | 144 + .../src/kernel/itkVTKImageToImageFilter.h | 107 + .../src/kernel/itkVTKImageToImageFilter.txx | 144 + lib/maracasVisuLib/src/kernel/marAxis.cpp | 1552 ++++ lib/maracasVisuLib/src/kernel/marAxis.h | 273 + lib/maracasVisuLib/src/kernel/marAxisCT.cpp | 2543 +++++++ lib/maracasVisuLib/src/kernel/marAxisCT.h | 123 + .../src/kernel/marAxisContours.cpp | 87 + .../src/kernel/marAxisContours.h | 51 + lib/maracasVisuLib/src/kernel/marContour.cpp | 503 ++ lib/maracasVisuLib/src/kernel/marContour.h | 130 + .../src/kernel/marContourVO.cpp | 183 + lib/maracasVisuLib/src/kernel/marContourVO.h | 100 + lib/maracasVisuLib/src/kernel/marDicom.cpp | 436 ++ lib/maracasVisuLib/src/kernel/marDicom.h | 181 + .../src/kernel/marDicomBase.cpp | 713 ++ lib/maracasVisuLib/src/kernel/marDicomBase.h | 110 + lib/maracasVisuLib/src/kernel/marDynData.cpp | 204 + lib/maracasVisuLib/src/kernel/marDynData.h | 59 + .../src/kernel/marExperiment.cpp | 392 + lib/maracasVisuLib/src/kernel/marExperiment.h | 126 + .../src/kernel/marExperimentCT.cpp | 226 + .../src/kernel/marExperimentCT.h | 66 + .../src/kernel/marGdcmDicom.cpp | 1060 +++ lib/maracasVisuLib/src/kernel/marGdcmDicom.h | 148 + .../src/kernel/marImageData.cpp | 133 + lib/maracasVisuLib/src/kernel/marImageData.h | 45 + .../src/kernel/marInterface.cpp | 227 + lib/maracasVisuLib/src/kernel/marInterface.h | 63 + .../src/kernel/marInterfaceCT.cpp | 506 ++ .../src/kernel/marInterfaceCT.h | 145 + .../src/kernel/marIsocontour.cpp | 138 + lib/maracasVisuLib/src/kernel/marIsocontour.h | 52 + lib/maracasVisuLib/src/kernel/marKVolume.cpp | 60 + lib/maracasVisuLib/src/kernel/marKVolume.h | 43 + lib/maracasVisuLib/src/kernel/marLine.cpp | 82 + lib/maracasVisuLib/src/kernel/marLine.h | 27 + lib/maracasVisuLib/src/kernel/marMathConst.h | 12 + lib/maracasVisuLib/src/kernel/marMatrix.cpp | 425 ++ lib/maracasVisuLib/src/kernel/marMatrix.h | 57 + lib/maracasVisuLib/src/kernel/marObject.cpp | 82 + lib/maracasVisuLib/src/kernel/marObject.h | 84 + .../src/kernel/marParameters.cpp | 509 ++ lib/maracasVisuLib/src/kernel/marParameters.h | 236 + lib/maracasVisuLib/src/kernel/marPoint.cpp | 102 + lib/maracasVisuLib/src/kernel/marPoint.h | 54 + .../src/kernel/marSimpleDicom.cpp | 596 ++ .../src/kernel/marSimpleDicom.h | 208 + lib/maracasVisuLib/src/kernel/marTypes.h | 96 + lib/maracasVisuLib/src/kernel/marUtils.cpp | 49 + lib/maracasVisuLib/src/kernel/marUtils.h | 21 + lib/maracasVisuLib/src/kernel/marVector.cpp | 720 ++ lib/maracasVisuLib/src/kernel/marVector.h | 97 + lib/maracasVisuLib/src/kernel/matrix.cxx | 488 ++ lib/maracasVisuLib/src/kernel/vector.cxx | 375 + lib/maracasVisuLib/src/kernel/volume.cxx | 1087 +++ lib/maracasVisuLib/src/kernel/volume.hxx | 259 + .../src/kernel/vtkDijkstraImageData.cxx | 734 ++ .../src/kernel/vtkDijkstraImageData.h | 162 + lib/maracasVisuLib/src/kernel/vtkJoiner.cxx | 40 + lib/maracasVisuLib/src/kernel/vtkJoiner.h | 17 + lib/maracasVisuLib/src/kernel/vtkOtsu.cxx | 162 + lib/maracasVisuLib/src/kernel/vtkOtsu.h | 32 + .../src/kernel/vtkOtsuImageData.cxx | 152 + .../src/kernel/vtkOtsuImageData.h | 28 + .../src/kernel/vtkOtsuSphereSource.cxx | 154 + .../src/kernel/vtkOtsuSphereSource.h | 29 + .../src/kernel/vtkSTLExtractor.cpp | 105 + .../src/kernel/vtkSTLExtractor.h | 48 + 576 files changed, 176400 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 appli/template_appli/CMakeLists.txt create mode 100644 appli/template_wx_appli/CMakeLists.txt create mode 100644 lib/CMakeLists.txt create mode 100644 lib/maracasVisuLib/CMakeLists.txt create mode 100644 lib/maracasVisuLib/include/Maracas.iss create mode 100644 lib/maracasVisuLib/include/Modules/FindCrea.cmake create mode 100644 lib/maracasVisuLib/include/Modules/FindGDCM.cmake create mode 100644 lib/maracasVisuLib/include/Modules/FindGLIB.cmake create mode 100644 lib/maracasVisuLib/include/Modules/FindGSL.cmake create mode 100644 lib/maracasVisuLib/include/Modules/FindGSLobj.cmake create mode 100644 lib/maracasVisuLib/include/Modules/FindGTK.cmake create mode 100644 lib/maracasVisuLib/include/Modules/FindGTK2.cmake create mode 100644 lib/maracasVisuLib/include/Modules/FindKGFO.cmake create mode 100644 lib/maracasVisuLib/include/Modules/FindLibido.cmake create mode 100644 lib/maracasVisuLib/include/Modules/FindMySQL.cmake create mode 100644 lib/maracasVisuLib/include/Modules/FindwxGlade.cmake create mode 100644 lib/maracasVisuLib/include/Modules/FindwxW.cmake create mode 100644 lib/maracasVisuLib/include/Modules/GDCMConfig.cmake create mode 100644 lib/maracasVisuLib/include/Modules/MARACAS_Find_GDCM.cmake create mode 100644 lib/maracasVisuLib/include/Modules/MARACAS_Find_ITK.cmake create mode 100644 lib/maracasVisuLib/include/Modules/MARACAS_Find_LIBIDO.cmake create mode 100644 lib/maracasVisuLib/include/Modules/MARACAS_Find_VTK.cmake create mode 100644 lib/maracasVisuLib/include/Modules/MARACAS_Find_WXWIDGETS.cmake create mode 100644 lib/maracasVisuLib/include/Modules/UseGDCM.cmake create mode 100644 lib/maracasVisuLib/include/mathdefs.h create mode 100644 lib/maracasVisuLib/include/matrix.h create mode 100644 lib/maracasVisuLib/include/vector.h create mode 100644 lib/maracasVisuLib/include/vmfuncs.h create mode 100644 lib/maracasVisuLib/src/CMakeLists.txt create mode 100644 lib/maracasVisuLib/src/CMakeListsWorking.txt create mode 100644 lib/maracasVisuLib/src/interface/CMakeLists.txt create mode 100644 lib/maracasVisuLib/src/interface/tcl/Makefile.am create mode 100644 lib/maracasVisuLib/src/interface/tcl/Makefile.in create mode 100644 lib/maracasVisuLib/src/interface/tcl/general.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/3D.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/add.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/area.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/back.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/bright.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/clear.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/connect.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/continue.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/del_axis.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/excel.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/extract.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/help.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/imagebrowser.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/intensity.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/linear.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/loadexp.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/pan.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/params.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/plans.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/quant.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/redblue.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/redgreen.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/rotate.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/save.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/subtract.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/wizard.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/icons/zoom.gif create mode 100644 lib/maracasVisuLib/src/interface/tcl/marTcl.dsp create mode 100644 lib/maracasVisuLib/src/interface/tcl/marTclInterface.h create mode 100644 lib/maracasVisuLib/src/interface/tcl/maracas_start.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/string_table.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/tclexe.dsp create mode 100644 lib/maracasVisuLib/src/interface/tcl/tkwidgets/Makefile.am create mode 100644 lib/maracasVisuLib/src/interface/tcl/tkwidgets/Makefile.in create mode 100644 lib/maracasVisuLib/src/interface/tcl/tkwidgets/combobox.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/tkwidgets/ibrowser.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/tkwidgets/imagepp.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/tkwidgets/mclistbox.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/to_change/Makefile.am create mode 100644 lib/maracasVisuLib/src/interface/tcl/to_change/Makefile.in create mode 100644 lib/maracasVisuLib/src/interface/tcl/to_change/TkImageViewerInteractor.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/to_change/TkInteractor.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/to_change/WidgetObject.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/to_change/ev_userzoom.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/to_change/volTkInteractor.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/to_change/vtkInt.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/windows/Makefile.am create mode 100644 lib/maracasVisuLib/src/interface/tcl/windows/Makefile.in create mode 100644 lib/maracasVisuLib/src/interface/tcl/windows/choose_direction.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/windows/data_browser.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/windows/dlg_name_axis.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/windows/dlg_params.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/windows/global_window.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/windows/help_wnd.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/windows/image_browser.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/windows/planes_window.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/windows/subtract.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/windows/u_3D.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/windows/u_mip.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/windows/u_mpr.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/windows/u_surf.tcl create mode 100644 lib/maracasVisuLib/src/interface/tcl/wrap_maracas.i create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/CMakeLists.txt create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/AutoControlPoints.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/AutoControlPoints.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourCrownWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourCrownWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourPropagation.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourPropagation.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourVOIWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourVOIWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/ExtractControlPoints2D.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/ExtractControlPoints2D.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/Propagation.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/Propagation.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/contoursIntersection.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/contoursIntersection.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/vectorFunctions.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/Contour/vectorFunctions.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/MaracasDll.cpp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/MaracasDll.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/StdAfx.cpp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/StdAfx.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/manualContour.cpp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/manualContour.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/manualContourContainer.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/manualContourContainer.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/marDict.txt create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/marDictionary.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/marDictionary.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/3D.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/3D.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/Axis_JF.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/Axis_JF.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/Axis_JF_MH1.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/Axis_JF_MH1.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/Axis_JF_MH2.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/Axis_JF_MH2.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/MPR.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/MPR.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/ProcessingCT.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/ProcessingCT.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/QuantificationCT.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/QuantificationCT.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/add.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/add.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/area.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/area.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/authors.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/authors.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/back.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/back.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/bright.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/bright.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/clear.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/clear.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/colours.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/colours.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/connect.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/connect.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/continue.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/continue.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/creatis_logo.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/creatis_logo.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/creatis_logo2.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/cross.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/cross.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/cutter.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/cutter.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/del_axis.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/del_axis.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/disable.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/disable.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/excel.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/excel.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/exit.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/exit.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/extract.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/extract.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/help.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/help.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/imagebrowser.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/imagebrowser.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/intensity.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/intensity.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/linear.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/linear.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/loadexp.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/loadexp.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/logo.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/logo.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/logocreatis.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/pan.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/pan.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/params.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/params.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/plans.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/plans.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/quant.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/quant.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/redblue.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/redblue.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/redgreen.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/redgreen.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/rotate.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/rotate.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/save.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/save.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/stl.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/stl.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/subtract.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/subtract.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/tick.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/tick.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/vessels.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/vessels.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/wizard.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/wizard.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/zoom.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps/zoom.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/maracas_01.xcf create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/maracas_02.xcf create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_CTQuantification.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_CTQuantification.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_IRMQuantification.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_IRMQuantification.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_Information.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_Information.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_ListPatient_Voi.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_ListPatient_Voi.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_Logo.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_Logo.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_ManualRegistration.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_ManualRegistration.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_Params.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_Params.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_Processing.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_Processing.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_STLFormat.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_STLFormat.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_Tests.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_Tests.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_VascularTree.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_bl_VascularTree.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_mask.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_mask.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_CTQuantification.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_CTQuantification.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_IRMQuantification.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_IRMQuantification.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_ListPatient_Voi.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_ListPatient_Voi.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_Logo.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_Logo.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_ManualRegistration.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_ManualRegistration.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_Params.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_Params.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_Processing.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_Processing.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_STLFormat.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_STLFormat.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_Tests.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_Tests.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_VascularTree.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_bi_re_VascularTree.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_AddAllPatients.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_AddAllPatients.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_AddPatient.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_AddPatient.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_AxisExtraction.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_AxisExtraction.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_CreateDICOMDIR.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_CreateDICOMDIR.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_ListPatient.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_ListPatient.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_MPR.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_MPR.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_OpenDICOMDIR.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_OpenDICOMDIR.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_OpenDirectory.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_OpenDirectory.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_Processing.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_Processing.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_ProcessingCT.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_ProcessingCT.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_Quantification.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_Quantification.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_STLFormat.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_STLFormat.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_TreeExtraction_JF_MH.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_TreeExtraction_JF_MH.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_voi.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_bl_voi.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_mask.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_mask.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_re_ListPatient.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_re_ListPatient.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_re_voi.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_re_voi.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_tr_MPR.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_tr_MPR.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_tr_Processing.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_tr_Processing.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_tr_Quantification.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_tr_Quantification.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_tr_STLFormat.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_tr_STLFormat.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_tr_VOI.bmp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/bitmaps2/v2_sm_tr_VOI.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/dialogs/marDiagParameters.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/dialogs/marDiagParameters.wxr create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/dialogs/ressource.wxg create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/icons/maracas.ico create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/icons/maracas.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/res/wxInterface.rc create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/tools/CMakeLists.txt create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/tools/MaracasTools.cpp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/tools/MaracasTools.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/ContourView.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/ContourView.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/InterfaceVtkPanelWidgets.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/InterfaceVtkPanelWidgets.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/LineView.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/LineView.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/PointView.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/PointView.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/README create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/UtilVtk3DGeometriSelection.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/UtilVtk3DGeometriSelection.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/chart.cpp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/chart.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/Histogram.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/Histogram.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialog.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialog.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/LogicalColorBar.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/LogicalColorBar.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/MaximumsDialog.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/MaximumsDialog.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/mBarRange.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/mBarRange.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/mathplot.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/mathplot.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pColorBar.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pColorBar.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pColorPoint.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pColorPoint.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFigure.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFigure.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFunctionPoint.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFunctionPoint.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotter.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotter.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterScaleX.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterScaleX.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/res/area.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/res/bright.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/res/cine_loop.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/res/clear.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/res/intensity.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/res/linear.xpm create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk2DQuantSliceWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk2DQuantSliceWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DQuantSurfaceWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DQuantSurfaceWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceSTLWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceSTLWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImagePolyDataSeedConnectivity.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImagePolyDataSeedConnectivity.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleCutter.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleCutter.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxChart.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxChart.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanelWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanelWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanelWidget_2.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanelWidget_2.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanel_3_Widget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanel_3_Widget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxImageBrowserWdg.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxImageBrowserWdg.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxImageViewerWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxImageViewerWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxManualRegistration3D.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxManualRegistration3D.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxManualSegmentation_MPRWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxManualSegmentation_MPRWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxManualTree_MPRWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxManualTree_MPRWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxParametersDialog.cpp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxParametersDialog.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxPathologyWidget_01.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxPathologyWidget_01.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxProcessingCTWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxProcessingCTWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxQuantificationWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxQuantificationWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxQuantificationWidgetCT.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxQuantificationWidgetCT.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxQuantificationWidget_base.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxQuantificationWidget_base.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxReadingPriorityPanel.cpp create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxReadingPriorityPanel.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_02.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_02.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_03.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_03.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSegmentationFM3DWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSegmentationFM3DWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSurfaceMPR.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSurfaceMPR.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSurfaceSTLWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSurfaceSTLWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSurfaceWidget.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSurfaceWidget.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractorEditContour.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractorEditContour.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxILPDwithImage.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxILPDwithImage.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracas3DBrowser.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracas3DBrowser.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasApp.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasApp.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasApp02.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasApp02.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasDataBrowser.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasDataBrowser.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasEmptyPanel.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasEmptyPanel.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasEmptyPanel_2.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasEmptyPanel_2.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasEmptyPanel_3.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasEmptyPanel_3.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasFrame.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasFrame.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasFrame02.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasFrame02.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasHelpDialog.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasHelpDialog.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasImageBrowser.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasImageBrowser.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasImageBrowser02.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasImageBrowser02.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasMPR.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasMPR.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasParametersDialog.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasParametersDialog.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasPathology_01.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasPathology_01.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasProcessingCT.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasProcessingCT.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasQuantification.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasQuantification.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasQuantificationCT.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracasQuantificationCT.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracas_ManualContour_Panel.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracas_ManualContour_Panel.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracas_ManualSegmentation_MPR.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracas_ManualSegmentation_MPR.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracas_ManualTree_MPR.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracas_ManualTree_MPR.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracas_ManualTree_MPRDlg.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracas_ManualTree_MPRDlg.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracas_SegmentationFM3D.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/wxMaracas_SegmentationFM3D.h create mode 100644 lib/maracasVisuLib/src/kernel/CMakeLists.txt create mode 100644 lib/maracasVisuLib/src/kernel/README create mode 100644 lib/maracasVisuLib/src/kernel/axisExtractor.cxx create mode 100644 lib/maracasVisuLib/src/kernel/axisExtractor.h create mode 100644 lib/maracasVisuLib/src/kernel/axisExtractor02.cxx create mode 100644 lib/maracasVisuLib/src/kernel/axisExtractor02.h create mode 100644 lib/maracasVisuLib/src/kernel/carotidaBifurcacion.cxx create mode 100644 lib/maracasVisuLib/src/kernel/carotidaBifurcacion.h create mode 100644 lib/maracasVisuLib/src/kernel/curve.cxx create mode 100644 lib/maracasVisuLib/src/kernel/curve.hxx create mode 100644 lib/maracasVisuLib/src/kernel/gslobj.hxx create mode 100644 lib/maracasVisuLib/src/kernel/itkFM3D.cxx create mode 100644 lib/maracasVisuLib/src/kernel/itkFM3D.h create mode 100644 lib/maracasVisuLib/src/kernel/itkImageToVTKImageFilter.h create mode 100644 lib/maracasVisuLib/src/kernel/itkImageToVTKImageFilter.txx create mode 100644 lib/maracasVisuLib/src/kernel/itkVTKImageToImageFilter.h create mode 100644 lib/maracasVisuLib/src/kernel/itkVTKImageToImageFilter.txx create mode 100644 lib/maracasVisuLib/src/kernel/marAxis.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marAxis.h create mode 100644 lib/maracasVisuLib/src/kernel/marAxisCT.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marAxisCT.h create mode 100644 lib/maracasVisuLib/src/kernel/marAxisContours.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marAxisContours.h create mode 100644 lib/maracasVisuLib/src/kernel/marContour.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marContour.h create mode 100644 lib/maracasVisuLib/src/kernel/marContourVO.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marContourVO.h create mode 100644 lib/maracasVisuLib/src/kernel/marDicom.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marDicom.h create mode 100644 lib/maracasVisuLib/src/kernel/marDicomBase.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marDicomBase.h create mode 100644 lib/maracasVisuLib/src/kernel/marDynData.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marDynData.h create mode 100644 lib/maracasVisuLib/src/kernel/marExperiment.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marExperiment.h create mode 100644 lib/maracasVisuLib/src/kernel/marExperimentCT.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marExperimentCT.h create mode 100644 lib/maracasVisuLib/src/kernel/marGdcmDicom.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marGdcmDicom.h create mode 100644 lib/maracasVisuLib/src/kernel/marImageData.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marImageData.h create mode 100644 lib/maracasVisuLib/src/kernel/marInterface.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marInterface.h create mode 100644 lib/maracasVisuLib/src/kernel/marInterfaceCT.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marInterfaceCT.h create mode 100644 lib/maracasVisuLib/src/kernel/marIsocontour.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marIsocontour.h create mode 100644 lib/maracasVisuLib/src/kernel/marKVolume.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marKVolume.h create mode 100644 lib/maracasVisuLib/src/kernel/marLine.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marLine.h create mode 100644 lib/maracasVisuLib/src/kernel/marMathConst.h create mode 100644 lib/maracasVisuLib/src/kernel/marMatrix.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marMatrix.h create mode 100644 lib/maracasVisuLib/src/kernel/marObject.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marObject.h create mode 100644 lib/maracasVisuLib/src/kernel/marParameters.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marParameters.h create mode 100644 lib/maracasVisuLib/src/kernel/marPoint.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marPoint.h create mode 100644 lib/maracasVisuLib/src/kernel/marSimpleDicom.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marSimpleDicom.h create mode 100644 lib/maracasVisuLib/src/kernel/marTypes.h create mode 100644 lib/maracasVisuLib/src/kernel/marUtils.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marUtils.h create mode 100644 lib/maracasVisuLib/src/kernel/marVector.cpp create mode 100644 lib/maracasVisuLib/src/kernel/marVector.h create mode 100644 lib/maracasVisuLib/src/kernel/matrix.cxx create mode 100644 lib/maracasVisuLib/src/kernel/vector.cxx create mode 100644 lib/maracasVisuLib/src/kernel/volume.cxx create mode 100644 lib/maracasVisuLib/src/kernel/volume.hxx create mode 100644 lib/maracasVisuLib/src/kernel/vtkDijkstraImageData.cxx create mode 100644 lib/maracasVisuLib/src/kernel/vtkDijkstraImageData.h create mode 100644 lib/maracasVisuLib/src/kernel/vtkJoiner.cxx create mode 100644 lib/maracasVisuLib/src/kernel/vtkJoiner.h create mode 100644 lib/maracasVisuLib/src/kernel/vtkOtsu.cxx create mode 100644 lib/maracasVisuLib/src/kernel/vtkOtsu.h create mode 100644 lib/maracasVisuLib/src/kernel/vtkOtsuImageData.cxx create mode 100644 lib/maracasVisuLib/src/kernel/vtkOtsuImageData.h create mode 100644 lib/maracasVisuLib/src/kernel/vtkOtsuSphereSource.cxx create mode 100644 lib/maracasVisuLib/src/kernel/vtkOtsuSphereSource.h create mode 100644 lib/maracasVisuLib/src/kernel/vtkSTLExtractor.cpp create mode 100644 lib/maracasVisuLib/src/kernel/vtkSTLExtractor.h diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..f4f1ace --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,34 @@ +PROJECT(creaMaracasVisu) + +SET(PROJECT_MAJOR_VERSION 1) +SET(PROJECT_MINOR_VERSION 0) +SET(PROJECT_BUILD_VERSION 0) + +SET(CREA_VERBOSE_CMAKE TRUE) + +FIND_PACKAGE(crea REQUIRED) +IF (crea_FOUND) + INCLUDE(${crea_USE_FILE}) +ENDIF(crea_FOUND) +CREA_PREVENT_IN_SOURCE_BUILD() + +SET(USE_GDCM ON) +SET(USE_GDCM_VTK ON) +SET(USE_WXWIDGETS ON) +SET(USE_VTK ON) +SET(USE_ITK ON) +SET(USE_BOOST OFF) + +CREA_FIND_AND_USE_LIBRARIES() + +SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}) +SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}) +MARK_AS_ADVANCED( + CMAKE_BACKWARDS_COMPATIBILITY + EXECUTABLE_OUTPUT_PATH + LIBRARY_OUTPUT_PATH + ) + +#SUBDIRS(appli) +#SUBDIRS(lib) +SUBDIRS(lib) diff --git a/appli/template_appli/CMakeLists.txt b/appli/template_appli/CMakeLists.txt new file mode 100644 index 0000000..3b02804 --- /dev/null +++ b/appli/template_appli/CMakeLists.txt @@ -0,0 +1,33 @@ +#---------------------------------------------------------------------------- +# SET THE NAME OF YOUR EXECUTABLE +SET ( EXE_NAME MyExe ) +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# EXECUTABLE SOURCES (TO BE COMPILED) +# EITHER LIST ALL .cxx, *.cpp, *.cc IN CURRENT DIR USING NEXT LINE: +FILE(GLOB ${EXE_NAME}_SOURCES *.cxx *.cpp *.cc) +# OR MANUALLY LIST YOUR FILES WITH NEXT COMMAND (WITHOUT EXTENSION) +# SET ( ${EXE_NAME}_SOURCES +# +# ) +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# DEPENDENCIES (LIBRARIES TO LINK WITH) +SET ( ${EXE_NAME}_LINK_LIBRARIES + ${crea_LIBRARIES} + # ${WXWIDGETS_LIBRARIES} + # ${VTK_LIBRARIES} + # ${ITK_LIBRARIES} + # ${GDCM_LIBRARIES} + # ${BOOST_LIBRARIES} + ) +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# CREATES AND INSTALLS THE EXE +CREA_ADD_EXECUTABLE( ${EXE_NAME} ) +#---------------------------------------------------------------------------- + + diff --git a/appli/template_wx_appli/CMakeLists.txt b/appli/template_wx_appli/CMakeLists.txt new file mode 100644 index 0000000..fd728c2 --- /dev/null +++ b/appli/template_wx_appli/CMakeLists.txt @@ -0,0 +1,40 @@ +#---------------------------------------------------------------------------- +# SET THE NAME OF YOUR EXECUTABLE +SET ( EXE_NAME MyExe ) +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# EXECUTABLE SOURCES (TO BE COMPILED) +# EITHER LIST ALL .cxx, *.cpp, *.cc IN CURRENT DIR USING NEXT LINE: +FILE(GLOB ${EXE_NAME}_SOURCES *.cxx *.cpp *.cc) +# OR MANUALLY LIST YOUR FILES WITH NEXT COMMAND (WITHOUT EXTENSION) +# SET ( ${EXE_NAME}_SOURCES +# +# ) +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# DEPENDENCIES (LIBRARIES TO LINK WITH) +SET ( ${EXE_NAME}_LINK_LIBRARIES + ${crea_LIBRARIES} + # ${WXWIDGETS_LIBRARIES} + # ${VTK_LIBRARIES} + # ${ITK_LIBRARIES} + # ${GDCM_LIBRARIES} + # ${BOOST_LIBRARIES} + ) +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# UNCOMMENT NEXT LINE IF YOU WANT A CONSOLE ON WINDOWS +# NB : YOUR MAIN MUST BE ADAPTED ALSO +# SEE THE MACRO CREA_WXMAIN_WITH_CONSOLE IN creaWx.h +#SET(${EXE_NAME}_CONSOLE TRUE) +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# CREATES AND INSTALLS THE EXE +CREA_ADD_WX_EXECUTABLE( ${EXE_NAME} ) +#---------------------------------------------------------------------------- + + diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt new file mode 100644 index 0000000..0aca18d --- /dev/null +++ b/lib/CMakeLists.txt @@ -0,0 +1,2 @@ +# Add a SUBDIRS command for each of your libraries +SUBDIRS(maracasVisuLib) diff --git a/lib/maracasVisuLib/CMakeLists.txt b/lib/maracasVisuLib/CMakeLists.txt new file mode 100644 index 0000000..c9ea732 --- /dev/null +++ b/lib/maracasVisuLib/CMakeLists.txt @@ -0,0 +1,276 @@ +#---------------------------------------------------------------------------- +# SET THE NAME OF YOUR LIBRARY +SET ( LIBRARY_NAME maracasVisuLib ) +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# CREATES A USER OPTION IN CMAKE +OPTION ( BUILD_${LIBRARY_NAME} "Build ${LIBRARY_NAME} library ?" ON) + +#OPTION ( EXPORTS_MaracasKernel "Build ${LIBRARY_NAME} library ?" ON) +#IF (EXPORTS_MaracasKernel) +# SET(MaracasKernel_EXPORTS) +# ADD_DEFINITIONS (-DMaracasKernel_EXPORTS) +#ENDIF(EXPORTS_MaracasKernel) + +#---------------------------------------------------------------------------- +IF ( BUILD_${LIBRARY_NAME} ) +#---------------------------------------------------------------------------- + + #---------------------------------------------------------------------------- + # BUILD LIBRARY + #---------------------------------------------------------------------------- +#jhcl-Start=========================================================================== + INCLUDE_DIRECTORIES( + include + src + #${MARACAS_SOURCE_DIR}/src/axe3DVTK + # ${MARACAS_SOURCE_DIR}/src/interface + src/kernel + #${MARACAS_SOURCE_DIR}/src/SnakeIsoContour+Deriche + src/interface/wxWindows + src/interface/wxWindows/widgets + src/interface/wxWindows/widgets/pPlotter + ../../../ +) + #message(jhcl\n\n ${crea_LIBRARIES}) + INCLUDE(include/Modules/MARACAS_Find_LIBIDO.cmake) + SET(CREA_LIBRARIES C:/creaBin/Debug/crea.lib) + FIND_PACKAGE(crea) +#jhcl-End=========================================================================== + #---------------------------------------------------------------------------- + # LIBRARY HEADERS (TO BE INSTALLED) + # EITHER LIST ALL .h IN CURRENT DIR USING NEXT LINE: + #FILE(GLOB ${LIBRARY_NAME}_HEADERS "*.h") + # OR MANUALLY LIST YOUR HEADERS WITH NEXT COMMAND + SET ( ${LIBRARY_NAME}_HEADERS + src/interface/wxWindows/manualContour.h + src/interface/wxWindows/Contour/ContourCrownWidget.h + src/interface/wxWindows/Contour/ContourVOIWidget.h + src/interface/wxWindows/Contour/Propagation.h + src/interface/wxWindows/Contour/ExtractControlPoints2D.h + src/interface/wxWindows/Contour/AutoControlPoints.h + src/interface/wxWindows/Contour/ContourPropagation.h + src/interface/wxWindows/Contour/contoursIntersection.h + src/interface/wxWindows/Contour/vectorFunctions.h + src/interface/wxWindows/wxMaracasImageBrowser02.h + src/interface/wxWindows/widgets/wxReadingPriorityPanel.h + src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.h + src/interface/wxWindows/widgets/InterfaceVtkPanelWidgets.h + src/interface/wxWindows/widgets/vtkClosePolyData.h + src/interface/wxWindows/wxMaracasMPR.h + src/interface/wxWindows/widgets/wxMPRWidget.h + src/interface/wxWindows/widgets/wxMPRBaseData.h + src/interface/wxWindows/widgets/wxVtkBaseView.h + src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h + src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h + src/interface/wxWindows/wxMaracas_ManualTree_MPR.h + src/interface/wxWindows/widgets/wxManualTree_MPRWidget.h + src/interface/wxWindows/widgets/ContourView.h + src/interface/wxWindows/widgets/PointView.h + src/interface/wxWindows/widgets/LineView.h + src/interface/wxWindows/widgets/UtilVtk3DGeometriSelection.h + src/interface/wxWindows/widgets/pPlotter/HistogramDialog.h + src/interface/wxWindows/widgets/pPlotter/HistogramWidget.h + src/interface/wxWindows/widgets/pPlotter/pHistogram.h + src/interface/wxWindows/widgets/pPlotter/mBarRange.h + src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.h + src/interface/wxWindows/widgets/pPlotter/LogicalColorBar.h + src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.h + src/interface/wxWindows/widgets/pPlotter/pFunctionPoint.h + src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.h + src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.h + src/interface/wxWindows/widgets/pPlotter/pPlotterScaleX.h + src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.h + src/interface/wxWindows/widgets/pPlotter/pColorBar.h + src/interface/wxWindows/widgets/pPlotter/pFigure.h + src/interface/wxWindows/widgets/pPlotter/pColorPoint.h + src/interface/wxWindows/widgets/pPlotter/pPlotter.h + src/interface/wxWindows/widgets/pPlotter/mathplot.h + src/interface/wxWindows/widgets/pPlotter/MaximumsDialog.h + src/interface/wxWindows/widgets/pPlotter/Histogram.h + /../include/matrix.h + src/kernel/marImageData.h + src/kernel/marDicomBase.h + src/kernel/marGdcmDicom.h + src/kernel/marObject.h + src/kernel/volume.hxx + src/kernel/marTypes.h + src/kernel/marParameters.h + src/kernel/marDynData.h + ) + #---------------------------------------------------------------------------- + + #---------------------------------------------------------------------------- + # LIBRARY SOURCES (TO BE COMPILED) + # EITHER LIST ALL .cxx, *.cpp, *.cc IN CURRENT DIR USING NEXT LINE: + #FILE(GLOB ${LIBRARY_NAME}_SOURCES *.cxx *.cpp *.cc) + # OR MANUALLY LIST YOUR FILES WITH NEXT COMMAND (WITHOUT EXTENSION) + SET ( ${LIBRARY_NAME}_SOURCES + src/interface/wxWindows/manualContour.cpp + src/interface/wxWindows/Contour/ContourCrownWidget.cxx + src/interface/wxWindows/Contour/ContourExtractData.cxx + src/interface/wxWindows/Contour/ContourVOIWidget.cxx + src/interface/wxWindows/Contour/Propagation.cxx + src/interface/wxWindows/Contour/ExtractControlPoints2D.cxx + src/interface/wxWindows/Contour/AutoControlPoints.cxx + src/interface/wxWindows/Contour/ContourPropagation.cxx + src/interface/wxWindows/Contour/contoursIntersection.cxx + src/interface/wxWindows/Contour/vectorFunctions.cxx + src/interface/wxWindows/wxMaracasImageBrowser02.cxx + src/interface/wxWindows/widgets/wxReadingPriorityPanel.cpp + src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx + src/interface/wxWindows/widgets/InterfaceVtkPanelWidgets.cxx + src/interface/wxWindows/widgets/vtkClosePolyData.cxx + src/interface/wxWindows/wxMaracasMPR.cxx + src/interface/wxWindows/widgets/wxMPRWidget.cxx + src/interface/wxWindows/widgets/wxMPRBaseData.cxx + src/interface/wxWindows/widgets/wxVtkBaseView.cxx + src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx + src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx + src/interface/wxWindows/wxMaracas_ManualTree_MPR.cxx + src/interface/wxWindows/widgets/wxManualTree_MPRWidget.cxx + src/interface/wxWindows/res/wxInterface.rc + src/interface/wxWindows/widgets/ContourView.cxx + src/interface/wxWindows/widgets/PointView.cxx + src/interface/wxWindows/widgets/LineView.cxx + src/interface/wxWindows/widgets/UtilVtk3DGeometriSelection.cxx +#####pPlotter classes + src/interface/wxWindows/widgets/pPlotter/HistogramDialog.cxx + src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx + src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx + src/interface/wxWindows/widgets/pPlotter/mBarRange.cxx + src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.cxx + src/interface/wxWindows/widgets/pPlotter/LogicalColorBar.cxx + src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.cxx + src/interface/wxWindows/widgets/pPlotter/pFunctionPoint.cxx + src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx + src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.cxx + src/interface/wxWindows/widgets/pPlotter/pPlotterScaleX.cxx + src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.cxx + src/interface/wxWindows/widgets/pPlotter/pColorBar.cxx + src/interface/wxWindows/widgets/pPlotter/pFigure.cxx + src/interface/wxWindows/widgets/pPlotter/pColorPoint.cxx + src/interface/wxWindows/widgets/pPlotter/pPlotter.cxx + src/interface/wxWindows/widgets/pPlotter/mathplot.cxx + src/interface/wxWindows/widgets/pPlotter/MaximumsDialog.cxx + src/interface/wxWindows/widgets/pPlotter/Histogram.cxx +### + src/kernel/marImageData.cpp + src/kernel/marDicomBase.cpp + src/kernel/marGdcmDicom.cpp + src/kernel/marObject.cpp + src/kernel/volume.cxx + src/kernel/marParameters.cpp + src/kernel/marDynData.cpp + ) + #---------------------------------------------------------------------------- +#jhcl-Start=========================================================================== +#message(jhcl4${LIBIDO_LIBRARIES}) +#jhcl-End=========================================================================== + + #---------------------------------------------------------------------------- + # LIBRARY DEPENDENCIES (LIBRARIES TO LINK WITH) + SET ( ${LIBRARY_NAME}_LINK_LIBRARIES + ${crea_LIBRARIES} + ${WXWIDGETS_LIBRARIES} + ${VTK_LIBRARIES} + ${ITK_LIBRARIES} + ${GDCM_LIBRARIES} + # ${BOOST_LIBRARIES} + #jhcl-Start=========================================================================== + + ${LIBIDO_LIBRARIES} + ${CREA_LIBRARIES} + #${BOOST_LIBRARIES} + #jhcl-End=========================================================================== + ) + #---------------------------------------------------------------------------- + + + #---------------------------------------------------------------------------- + # MACRO WHICH DOES ALL THE JOB : BUILD AND INSTALL +#JHCL + #CREA_ADD_LIBRARY( ${LIBRARY_NAME} ) +#JHCL + +# Ya esta hecho arriba +# SET(LIBRARY_NAME ******NOMBRE*******) + + IF(CREA_VERBOSE_CMAKE) + MESSAGE(STATUS "** Creating library ${LIBRARY_NAME}") + MESSAGE(STATUS " Headers : ${${LIBRARY_NAME}_HEADERS}") + MESSAGE(STATUS " Sources : ${${LIBRARY_NAME}_SOURCES}") + MESSAGE(STATUS " Link libs: ${${LIBRARY_NAME}_LINK_LIBRARIES}") + ENDIF(CREA_VERBOSE_CMAKE) + + + # MANAGE SHARED LIB + CREA_MANAGE_SHARED_LIBRARY(${LIBRARY_NAME}) + + # CREATE THE TARGET + ADD_LIBRARY(${LIBRARY_NAME} ${${LIBRARY_NAME}_SHARED} ${${LIBRARY_NAME}_SOURCES}) + + # LINK + TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${${LIBRARY_NAME}_LINK_LIBRARIES}) + + # Sets the settings for macro CREA_ADVANCED_INSTALL_LIBRARY_FOR_CMAKE + SET(${LIBRARY_NAME}_INSTALL_FOLDER ${LIBRARY_NAME}) + SET(${LIBRARY_NAME}_LIBRARIES ${LIBRARY_NAME}) + +# FILE(RELATIVE_PATH + # ${LIBRARY_NAME}_BUILD_TREE_RELATIVE_INCLUDE_PATHS + # ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} + # ) + +SET(${LIBRARY_NAME}_BUILD_TREE_RELATIVE_INCLUDE_PATHS +#lib/THIS_DIR/toto +#lib/THIS_DIR/other_headers + lib/maracasVisuLib/src + #${MARACAS_SOURCE_DIR}/src/axe3DVTK + # ${MARACAS_SOURCE_DIR}/src/interface + lib/maracasVisuLib/src/kernel + #${MARACAS_SOURCE_DIR}/src/SnakeIsoContour+Deriche + lib/maracasVisuLib/src/interface/wxWindows + lib/maracasVisuLib/src/interface/wxWindows/widgets + lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter + lib/maracasVisuLib/../../../ +) + +IF(UNIX) + SET(${LIBRARY_NAME}_BUILD_TREE_RELATIVE_LIBRARY_PATHS + ${EXECUTABLE_OUTPUT_REL_PATH}) + SET(${LIBRARY_NAME}_INSTALL_TREE_RELATIVE_LIBRARY_PATHS lib) +ELSE(UNIX) + SET(${LIBRARY_NAME}_BUILD_TREE_RELATIVE_LIBRARY_PATHS + ${EXECUTABLE_OUTPUT_REL_PATH}/Debug + ${EXECUTABLE_OUTPUT_REL_PATH}/Release) + SET(${LIBRARY_NAME}_INSTALL_TREE_RELATIVE_LIBRARY_PATHS bin) +ENDIF(UNIX) + SET(${LIBRARY_NAME}_INSTALL_TREE_RELATIVE_INCLUDE_PATHS include/${LIBRARY_NAME}) + SET(${LIBRARY_NAME}_HAS_ADDITIONAL_CONFIG_FILE FALSE) +# SET(${LIBRARY_NAME}_ADDITIONAL_CONFIG_FILE +# ${PROJECT_SOURCE_DIR}/src/AdditionalcreaImageIOConfig.cmake.in) +# SET(${LIBRARY_NAME}_ADDITIONAL_USE_FILE +# ${PROJECT_SOURCE_DIR}/src/AdditionalUsecreaImageIO.cmake.in) + +# Invoke the advanced macro +CREA_ADVANCED_INSTALL_LIBRARY_FOR_CMAKE(${LIBRARY_NAME}) + +# INSTALLS LIBRARY +INSTALL( + FILES ${${LIBRARY_NAME}_HEADERS} + DESTINATION ${${LIBRARY_NAME}_INSTALL_TREE_RELATIVE_INCLUDE_PATHS} + ) +INSTALL( + TARGETS ${LIBRARY_NAME} + DESTINATION lib) + + + + + #---------------------------------------------------------------------------- + + + #--------------------------------------------------------------------------- +ENDIF ( BUILD_${LIBRARY_NAME} ) diff --git a/lib/maracasVisuLib/include/Maracas.iss b/lib/maracasVisuLib/include/Maracas.iss new file mode 100644 index 0000000..ff1e12e --- /dev/null +++ b/lib/maracasVisuLib/include/Maracas.iss @@ -0,0 +1,48 @@ +; Script generated by the Inno Setup Script Wizard. +; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! + +[Setup] +AppName=Maracas +AppVerName=Maracas 2.0 +AppPublisher=CREATIS +AppPublisherURL=http://www.creatis.insa-lyon.fr/maracas +AppSupportURL=http://www.creatis.insa-lyon.fr/maracas +AppUpdatesURL=http://www.creatis.insa-lyon.fr/maracas +DefaultDirName={pf}\Maracas +DefaultGroupName=Maracas +AllowNoIcons=yes + +[Tasks] +; NOTE: The following entry contains English phrases ("Create a desktop icon" and "Additional icons"). You are free to translate them into another language if required. +Name: "desktopicon"; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:" +; NOTE: The following entry contains English phrases ("Create a Quick Launch icon" and "Additional icons"). You are free to translate them into another language if required. +Name: "quicklaunchicon"; Description: "Create a &Quick Launch icon"; GroupDescription: "Additional icons:"; Flags: unchecked + +[Files] +Source: "C:\Mathieu\Maracas\bin\Release\maracas.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "C:\Mathieu\Maracas\bin\Release\gsl.dll"; DestDir: "{app}"; Flags: ignoreversion +Source: "C:\Mathieu\Maracas\bin\Release\gslcblas.dll"; DestDir: "{app}"; Flags: ignoreversion +Source: "C:\Mathieu\Maracas\bin\Release\idodllvc.dll"; DestDir: "{app}"; Flags: ignoreversion +Source: "C:\Mathieu\Maracas\bin\Release\glib-1.3.dll"; DestDir: "{app}"; Flags: ignoreversion +Source: "C:\Mathieu\gdcm\Dicts\dicomV3.dic"; DestDir: "{app}"; Flags: ignoreversion +; NOTE: Don't use "Flags: ignoreversion" on any shared system files + +[INI] +Filename: "{app}\maracas.url"; Section: "InternetShortcut"; Key: "URL"; String: "http://www.creatis.insa-lyon.fr/maracas" + +[Icons] +Name: "{group}\Maracas"; Filename: "{app}\maracas.exe" +; NOTE: The following entry contains an English phrase ("on the Web"). You are free to translate it into another language if required. +Name: "{group}\Maracas on the Web"; Filename: "{app}\maracas.url" +; NOTE: The following entry contains an English phrase ("Uninstall"). You are free to translate it into another language if required. +Name: "{group}\Uninstall Maracas"; Filename: "{uninstallexe}" +Name: "{userdesktop}\Maracas"; Filename: "{app}\maracas.exe"; Tasks: desktopicon +Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\Maracas"; Filename: "{app}\maracas.exe"; Tasks: quicklaunchicon + +[Run] +; NOTE: The following entry contains an English phrase ("Launch"). You are free to translate it into another language if required. +Filename: "{app}\maracas.exe"; Description: "Launch Maracas"; Flags: nowait postinstall skipifsilent + +[UninstallDelete] +Type: files; Name: "{app}\maracas.url" + diff --git a/lib/maracasVisuLib/include/Modules/FindCrea.cmake b/lib/maracasVisuLib/include/Modules/FindCrea.cmake new file mode 100644 index 0000000..5782e21 --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/FindCrea.cmake @@ -0,0 +1,3 @@ +FIND_PATH( crea_DIR creabin $ENV{CREA_PATH} ) +FIND_PACKAGE(crea) +INCLUDE_DIRECTORIES(${CREA_INCLUDE_PATH}) \ No newline at end of file diff --git a/lib/maracasVisuLib/include/Modules/FindGDCM.cmake b/lib/maracasVisuLib/include/Modules/FindGDCM.cmake new file mode 100644 index 0000000..4920ff7 --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/FindGDCM.cmake @@ -0,0 +1,104 @@ +# - Find a GDCM installation or build tree. +# The following variables are set if GDCM is found. If GDCM is not +# found, GDCM_FOUND is set to false. +# GDCM_FOUND - Set to true when GDCM is found. +# GDCM_USE_FILE - CMake file to use GDCM. +# GDCM_MAJOR_VERSION - The GDCM major version number. +# GDCM_MINOR_VERSION - The GDCM minor version number +# (odd non-release). +# GDCM_BUILD_VERSION - The GDCM patch level +# (meaningless for odd minor). +# GDCM_INCLUDE_DIRS - Include directories for GDCM +# GDCM_LIBRARY_DIRS - Link directories for GDCM libraries +# GDCM_KITS - List of GDCM kits, in CAPS +# (COMMON,IO,) etc. +# GDCM_LANGUAGES - List of wrapped languages, in CAPS +# (TCL, PYHTON,) etc. +# The following cache entries must be set by the user to locate GDCM: +# GDCM_DIR - The directory containing GDCMConfig.cmake. +# This is either the root of the build tree, +# or the lib/vtk directory. This is the +# only cache entry. + + +# Construct consitent error messages for use below. +SET(GDCM_DIR_DESCRIPTION "directory containing GDCMConfig.cmake. This is either the root of the build tree, or PREFIX/lib/GDCM for an installation.") +SET(GDCM_DIR_MESSAGE "GDCM not found. Set the GDCM_DIR cmake cache entry to the ${GDCM_DIR_DESCRIPTION}") + +# Search only if the location is not already known. +IF(NOT GDCM_DIR) + # Get the system search path as a list. + IF(UNIX) + STRING(REGEX MATCHALL "[^:]+" GDCM_DIR_SEARCH1 "$ENV{PATH}") + ELSE(UNIX) + STRING(REGEX REPLACE "\\\\" "/" GDCM_DIR_SEARCH1 "$ENV{PATH}") + ENDIF(UNIX) + STRING(REGEX REPLACE "/;" ";" GDCM_DIR_SEARCH2 "${GDCM_DIR_SEARCH1}") + + # Construct a set of paths relative to the system search path. + SET(GDCM_DIR_SEARCH "") + FOREACH(dir ${GDCM_DIR_SEARCH2}) + SET(GDCM_DIR_SEARCH ${GDCM_DIR_SEARCH} + ${dir}/../lib/GDCM + ) + ENDFOREACH(dir) + + # + # Look for an installation or build tree. + # + FIND_PATH(GDCM_DIR GDCMConfig.cmake + # Look for an environment variable GDCM_DIR. + $ENV{GDCM_DIR} + + # Look in places relative to the system executable search path. + ${GDCM_DIR_SEARCH} + + # Look in standard UNIX install locations. + /usr/local/lib/GDCM + /usr/lib/GDCM + + # Read from the CMakeSetup registry entries. It is likely that + # GDCM will have been recently built. + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10] + + # Help the user find it if we cannot. + DOC "The ${GDCM_DIR_DESCRIPTION}" + ) +ENDIF(NOT GDCM_DIR) + +# If GDCM was found, load the configuration file to get the rest of the +# settings. +IF(GDCM_DIR) + # Make sure the GDCMConfig.cmake file exists in the directory provided. + IF(EXISTS ${GDCM_DIR}/GDCMConfig.cmake) + + # We found GDCM. Load the settings. + SET(GDCM_FOUND 1) + INCLUDE(${GDCM_DIR}/GDCMConfig.cmake) + + ENDIF(EXISTS ${GDCM_DIR}/GDCMConfig.cmake) +ELSE(GDCM_DIR) + # We did not find GDCM. + SET(GDCM_FOUND 0) +ENDIF(GDCM_DIR) + +#----------------------------------------------------------------------------- +IF(NOT GDCM_FOUND) + # GDCM not found, explain to the user how to specify its location. + IF(NOT GDCM_FIND_QUIETLY) + MESSAGE(FATAL_ERROR ${GDCM_DIR_MESSAGE}) + ELSE(NOT GDCM_FIND_QUIETLY) + IF(GDCM_FIND_REQUIRED) + MESSAGE(FATAL_ERROR ${GDCM_DIR_MESSAGE}) + ENDIF(GDCM_FIND_REQUIRED) + ENDIF(NOT GDCM_FIND_QUIETLY) +ENDIF(NOT GDCM_FOUND) diff --git a/lib/maracasVisuLib/include/Modules/FindGLIB.cmake b/lib/maracasVisuLib/include/Modules/FindGLIB.cmake new file mode 100644 index 0000000..392833c --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/FindGLIB.cmake @@ -0,0 +1,57 @@ +# +# This module finds if GLIB is installed and determines where the +# include files and libraries are. It also determines what the name of +# the library is. This code sets the following variables: +# +# GLIB_FOUND = system has GLIB and it should be used +# GLIB_LIBRARIES = full path to the GLIB library and linker flags on unix +# CMAKE_GLIB_CXX_FLAGS = compiler flags for building GLIB +# GLIB_INCLUDE_DIR = include path of GLIB + +IF(WIN32) + IF(CYGWIN) + + FIND_PROGRAM(CMAKE_GLIB_CONFIG glib-config ../glib/bin ../../glib/bin) + SET(CMAKE_GLIB_CXX_FLAGS "`${CMAKE_GLIB_CONFIG} --cflags`") + SET(GLIB_LIBRARIES "`${CMAKE_GLIB_CONFIG} --libs`") + + ELSE(CYGWIN) + + SET (GLIB_POSSIBLE_PATHS + $ENV{GLIB}/src/glib + $ENV{CREATIS}/glib-1.3/src/glib + "C:/glib-1.3/src/glib" + ) + FIND_LIBRARY(GLIB_SHARED_LIBRARY + NAMES glib-1.3 + PATHS ${GLIB_POSSIBLE_PATHS} + ) + + FIND_PATH(GLIB_INCLUDE_DIR + glib.h + ${GLIB_POSSIBLE_PATHS} + ) + + ENDIF(CYGWIN) +ELSE(WIN32) + + FIND_PROGRAM(CMAKE_GLIB_CONFIG glib-config ../glib/bin ../../glib/bin) + SET(CMAKE_GLIB_CXX_FLAGS "`${CMAKE_GLIB_CONFIG} --cflags`") + SET(GLIB_LIBRARIES "`${CMAKE_GLIB_CONFIG} --libs`") + +ENDIF(WIN32) + +MARK_AS_ADVANCED( + GLIB_SHARED_LIBRARY + CMAKE_GLIB_CONFIG + CMAKE_GLIB_CXX_FLAGS + GLIB_INCLUDE_DIR +) + +IF(GLIB_LIBRARIES) + IF(GLIB_INCLUDE_DIR OR CMAKE_GLIB_CXX_FLAGS) + SET(CMAKE_GLIB_CAN_COMPILE 1) + SET(GLIB_FOUND 1) + ENDIF(GLIB_INCLUDE_DIR OR CMAKE_GLIB_CXX_FLAGS) +ENDIF(GLIB_LIBRARIES) + diff --git a/lib/maracasVisuLib/include/Modules/FindGSL.cmake b/lib/maracasVisuLib/include/Modules/FindGSL.cmake new file mode 100644 index 0000000..145ec92 --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/FindGSL.cmake @@ -0,0 +1,85 @@ +# +# This module finds if GSL is installed and determines where the +# include files and libraries are. It also determines what the name of +# the library is. This code sets the following variables: +# +# GSL_FOUND = system has GSL and it should be used +# GSL_LIBRARIES = full path to the GSL library and linker flags on unix +# CMAKE_GSL_CXX_FLAGS = compiler flags for building GSL +# GSL_INCLUDE_DIR = include path of GSL + +IF(WIN32) + IF(CYGWIN) + + FIND_PROGRAM(CMAKE_GSL_CONFIG gsl-config ../GSL/bin ../../GSL/bin) + SET(CMAKE_GSL_CXX_FLAGS "`${CMAKE_GSL_CONFIG} --cflags`") + SET(GSL_LIBRARIES "`${CMAKE_GSL_CONFIG} --libs`") + + ELSE(CYGWIN) + + SET (GSL_POSSIBLE_LIB_PATHS + $ENV{GSL}/lib + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GNU Scientific Library_is1;Inno Setup: App Path]/lib" + ) + + FIND_LIBRARY(GSL_STATIC_LIBRARY + NAMES gsl + PATHS ${GSL_POSSIBLE_LIB_PATHS} + ) + + FIND_LIBRARY(GSL_SHARED_LIBRARY + NAMES gsl + PATHS ${GSL_POSSIBLE_LIB_PATHS} + ) + + SET (GSL_POSSIBLE_INCLUDE_PATHS + $ENV{GSL}/include + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GNU Scientific Library_is1;Inno Setup: App Path]/include" + ) + + FIND_PATH(GSL_INCLUDE_DIR + gsl/gsl_version.h + ${GSL_POSSIBLE_INCLUDE_PATHS} + ) + + IF(GSL_SHARED_LIBRARY) + OPTION(GSL_USE_SHARED_LIBS + "Use shared versions of GSL libraries" ON) + MARK_AS_ADVANCED(GSL_USE_SHARED_LIBS) + ENDIF(GSL_SHARED_LIBRARY) + + SET(CMAKE_GSL_LIBRARIES ${CMAKE_GSL_LIBRARIES}) # comctl32 ctl3d32 wsock32 rpcrt4) + + IF(GSL_USE_SHARED_LIBS) + SET(GSL_LIBRARIES ${GSL_SHARED_LIBRARY} ${CMAKE_GSL_LIBRARIES}) + ELSE(GSL_USE_SHARED_LIBS) + SET(GSL_LIBRARIES ${GSL_STATIC_LIBRARY} ${CMAKE_GSL_LIBRARIES}) + ENDIF(GSL_USE_SHARED_LIBS) + + MARK_AS_ADVANCED( + GSL_STATIC_LIBRARY + GSL_SHARED_LIBRARY + GSL_INCLUDE_DIR + ) + ENDIF(CYGWIN) +ELSE(WIN32) + + FIND_PROGRAM(CMAKE_GSL_CONFIG gsl-config ../GSL/bin ../../GSL/bin) + SET(CMAKE_GSL_CXX_FLAGS "`${CMAKE_GSL_CONFIG} --cflags`") + SET(GSL_LIBRARIES "`${CMAKE_GSL_CONFIG} --libs`") + +ENDIF(WIN32) + +MARK_AS_ADVANCED( + CMAKE_GSL_CONFIG + CMAKE_GSL_CXX_FLAGS + GSL_INCLUDE_DIR +) + +IF(GSL_LIBRARIES) + IF(GSL_INCLUDE_DIR OR CMAKE_GSL_CXX_FLAGS) + SET(CMAKE_GSL_CAN_COMPILE 1) + SET(GSL_FOUND 1) + ENDIF(GSL_INCLUDE_DIR OR CMAKE_GSL_CXX_FLAGS) +ENDIF(GSL_LIBRARIES) + diff --git a/lib/maracasVisuLib/include/Modules/FindGSLobj.cmake b/lib/maracasVisuLib/include/Modules/FindGSLobj.cmake new file mode 100644 index 0000000..a129ca9 --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/FindGSLobj.cmake @@ -0,0 +1,62 @@ +# +# This module finds if GSLOBJ is installed and determines where the +# include files and libraries are. It also determines what the name of +# the library is. This code sets the following variables: +# +# GSLOBJ_FOUND = system has GSLOBJ and it should be used +# GSLOBJ_LIBRARIES = full path to the GSLOBJ library and linker flags on unix +# CMAKE_GSLOBJ_CXX_FLAGS = compiler flags for building GSLOBJ +# GSLOBJ_INCLUDE_DIR = include path of GSLOBJ + +IF(WIN32) +IF(NOT UNIX) + SET (GSLOBJ_POSSIBLE_LIB_PATHS + $ENV{GSLOBJ}/lib + $ENV{CREATIS}/gslobj/win32inst/lib + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GSLobj_is1;Inno Setup: App Path]/lib" + ) + + FIND_LIBRARY(GSLOBJ_STATIC_LIBRARY + NAMES gslobj + PATHS ${GSLOBJ_POSSIBLE_LIB_PATHS} + ) + + SET (GSLOBJ_POSSIBLE_INCLUDE_PATHS + $ENV{GSLOBJ}/include + $ENV{CREATIS}/gslobj/win32inst/include + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GSLobj_is1;Inno Setup: App Path]/include" + ) + + FIND_PATH(GSLOBJ_INCLUDE_DIR + gslobj/gslobj.hxx + ${GSLOBJ_POSSIBLE_INCLUDE_PATHS} + ) + + SET(GSLOBJ_LIBRARIES ${GSLOBJ_STATIC_LIBRARY} ${CMAKE_GSLOBJ_LIBRARIES}) + + MARK_AS_ADVANCED( + GSLOBJ_STATIC_LIBRARY + GSLOBJ_INCLUDE_DIR + ) +ENDIF(NOT UNIX) +ENDIF(WIN32) + +IF(UNIX) + + FIND_PROGRAM(CMAKE_GSLOBJ_CONFIG gslobj-config ../gslobj/bin ../../gslobj/bin) + SET(CMAKE_GSLOBJ_CXX_FLAGS "`${CMAKE_GSLOBJ_CONFIG} --cflags`") + SET(GSLOBJ_LIBRARIES "`${CMAKE_GSLOBJ_CONFIG} --libs`") + +ENDIF(UNIX) + +MARK_AS_ADVANCED( + CMAKE_GSLOBJ_CXX_FLAGS + GSLOBJ_INCLUDE_DIR +) + +IF(GSLOBJ_LIBRARIES) + IF(GSLOBJ_INCLUDE_DIR OR CMAKE_GSLOBJ_CXX_FLAGS) + SET(CMAKE_GSLOBJ_CAN_COMPILE 1) + SET(GSLOBJ_FOUND 1) + ENDIF(GSLOBJ_INCLUDE_DIR OR CMAKE_GSLOBJ_CXX_FLAGS) +ENDIF(GSLOBJ_LIBRARIES) diff --git a/lib/maracasVisuLib/include/Modules/FindGTK.cmake b/lib/maracasVisuLib/include/Modules/FindGTK.cmake new file mode 100644 index 0000000..334c138 --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/FindGTK.cmake @@ -0,0 +1,97 @@ +# +# try to find GTK (and glib) and GTKGLArea +# + +# GTK_INCLUDE_DIR - Directories to include to use GTK +# GTK_LIBRARIES - Files to link against to use GTK +# GTK_VERSION_2 - Use this Version +# GTK_VERSION_1 - Use this Version +# GTK_FOUND - If false, don't try to use GTK + +OPTION(GTK_VERSION_1 "Use GTK version 1.x" 1) +OPTION(GTK_VERSION_2 "Use GTK version 2.x" 2) + +# Exclusion between the two version + +IF(GTK_VERSION_2) + SET(GTK_VERSION_1 0) +ENDIF(GTK_VERSION_2) + +IF(WIN32) + #win sucks ! + +ELSE(WIN32) + + #Find new pkg-config + #FIND_PACKAGE(PKG) #don't know how to register ! + FIND_PROGRAM(CMAKE_PKG_CONFIG pkg-config ../gtk2/bin ../../gtk2/bin) + + #if PKG is found + IF(CMAKE_PKG_CONFIG) + + SET(CMAKE_GTK1_CXX_FLAGS "`${CMAKE_PKG_CONFIG} --cflags gtk`") + SET(GTK1_LIBRARIES "`${CMAKE_PKG_CONFIG} --libs gtk`") + + SET(CMAKE_GTK2_CXX_FLAGS "`${CMAKE_PKG_CONFIG} --cflags gtk+-2.0`") + SET(GTK2_LIBRARIES "`${CMAKE_PKG_CONFIG} --libs gtk+-2.0`") + + ELSE(CMAKE_PKG_CONFIG) + #we were not able to find to, lets try with: + #old gtk-config + FIND_PROGRAM(CMAKE_GTK_CONFIG gtk-config ../gtk/bin ../../gtk/bin) + + SET(CMAKE_GTK1_CXX_FLAGS "`${CMAKE_GTK_CONFIG} --cflags`") + SET(GTK1_LIBRARIES "`${CMAKE_GTK_CONFIG} --libs`") + + MESSAGE(FATAL_ERROR "GTK2.x was not found but GTK1.x was, please set GTK_VERSION_1 + to ON") + ENDIF(CMAKE_PKG_CONFIG) + +ENDIF(WIN32) + +MARK_AS_ADVANCED( + CMAKE_GTK_CXX_FLAGS + CMAKE_GTK2_CXX_FLAGS + GTK_INCLUDE_DIR +) + +#IF(GTK_LIBRARIES OR GTK2_LIBRARIES) + #only one gtk version was found ! + #default GTK to this one (even if it GTK2) +# OPTION() +#ENDIF(GTK_LIBRARIES OR GTK2_LIBRARIES) + +#IF(GTK_LIBRARIES) +# IF((GTK_INCLUDE_DIR OR CMAKE_GTK_CXX_FLAGS) AND GTK_VERSION_2) +# SET(GTK_FOUND 1) +# SET (GTK_LIBRARIES ${GTK1_LIBRARIES}) +# SET(CMAKE_GTK_CXX_FLAGS ${CMAKE_GTK2_CXX_FLAGS}) +# ENDIF((GTK_INCLUDE_DIR OR CMAKE_GTK_CXX_FLAGS) AND GTK_VERSION_2) +# +# IF(GTK2_INCLUDE_DIR OR CMAKE_GTK2_CXX_FLAGS) +# SET(GTK2_FOUND 1) +# ENDIF(GTK2_INCLUDE_DIR OR CMAKE_GTK2_CXX_FLAGS) +# +#ENDIF(GTK_LIBRARIES) + + + + +IF(GTK1_LIBRARIES OR GTK2_LIBRARIES) + + IF(GTK_VERSION_2) + #looking for GTK2.x + IF(CMAKE_GTK2_CXX_FLAGS) + SET(GTK_FOUND 1) + SET (GTK_LIBRARIES ${GTK2_LIBRARIES}) + SET(CMAKE_GTK_CXX_FLAGS ${CMAKE_GTK2_CXX_FLAGS}) + ENDIF(CMAKE_GTK2_CXX_FLAGS) + ELSE(GTK_VERSION_2) + #looking for GTK1.x + IF(CMAKE_GTK1_CXX_FLAGS) + SET(GTK_FOUND 1) + SET (GTK_LIBRARIES ${GTK1_LIBRARIES}) + SET(CMAKE_GTK_CXX_FLAGS ${CMAKE_GTK1_CXX_FLAGS}) + ENDIF(CMAKE_GTK1_CXX_FLAGS) + ENDIF(GTK_VERSION_2) +ENDIF(GTK1_LIBRARIES OR GTK2_LIBRARIES) diff --git a/lib/maracasVisuLib/include/Modules/FindGTK2.cmake b/lib/maracasVisuLib/include/Modules/FindGTK2.cmake new file mode 100644 index 0000000..468702b --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/FindGTK2.cmake @@ -0,0 +1,328 @@ + +IF (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS) + # in cache already + SET(GTK2_FOUND TRUE) +ELSE (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS) + IF(UNIX) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + INCLUDE(UsePkgConfig) + + PKGCONFIG(gtk-2.0 _GTK22IncDir _GTK22LinkDir _GTK22LinkFlags _GTK22Cflags) + + FIND_PATH(GTK2_GTK_INCLUDE_PATH gtk/gtk.h + $ENV{GTK2_HOME} + ${_GTK22IncDir} + /usr/include/gtk-2.0 + /usr/local/include/gtk-2.0 + /opt/include/gtk-2.0 + /opt/gnome/include/gtk-2.0 + /sw/include/gtk-2.0 + ) + + # Some Linux distributions (e.g. Red Hat) have glibconfig.h + # and glib.h in different directories, so we need to look + # for both. + # - Atanas Georgiev + PKGCONFIG(glib-2.0 _GLIB2IncDir _GLIB2inkDir _GLIB2LinkFlags _GLIB2Cflags) + PKGCONFIG(gmodule-2.0 _GMODULE2IncDir _GMODULE2inkDir _GMODULE2LinkFlags _GMODULE2Cflags) + SET(GDIR /opt/gnome/lib/glib-2.0/include) + + FIND_PATH(GTK2_GLIBCONFIG_INCLUDE_PATH glibconfig.h + ${_GLIB2IncDir} + /opt/gnome/lib64/glib-2.0/include + /opt/gnome/lib/glib-2.0/include + /opt/lib/glib-2.0/include + /usr/lib64/glib-2.0/include + /usr/lib/glib-2.0/include + /sw/lib/glib-2.0/include + ) + #MESSAGE(STATUS "DEBUG: GTK2_GLIBCONFIG_INCLUDE_PATH = ${GTK2_GLIBCONFIG_INCLUDE_PATH}") + + FIND_PATH(GTK2_GLIB_INCLUDE_PATH glib.h + ${_GLIB2IncDir} + /opt/include/glib-2.0 + /opt/gnome/include/glib-2.0 + /usr/include/glib-2.0 + /sw/include/glib-2.0 + ) + #MESSAGE(STATUS "DEBUG: GTK2_GLIBCONFIG_INCLUDE_PATH = ${GTK2_GLIBCONFIG_INCLUDE_PATH}") + + FIND_PATH(GTK2_GTKGL_INCLUDE_PATH gtkgl/gtkglarea.h + ${_GLIB2IncDir} + /usr/include + /usr/local/include + /usr/openwin/share/include + /opt/gnome/include + /opt/include + /sw/include + ) + + PKGCONFIG(pango _PANGOIncDir _PANGOinkDir _PANGOLinkFlags _PANGOCflags) + + FIND_PATH(GTK2_PANGO_INCLUDE_PATH pango/pango.h + ${_PANGOIncDir} + /opt/gnome/include/pango-1.0 + /opt/include/pango-1.0 + /usr/include/pango-1.0 + /sw/include/pango-1.0 + ) + + PKGCONFIG(gdk-2.0 _GDK2IncDir _GDK2inkDir _GDK2LinkFlags _GDK2Cflags) + + FIND_PATH(GTK2_GDKCONFIG_INCLUDE_PATH gdkconfig.h + ${_GDK2IncDir} + /opt/gnome/lib/gtk-2.0/include + /opt/gnome/lib64/gtk-2.0/include + /opt/lib/gtk-2.0/include + /usr/lib/gtk-2.0/include + /usr/lib64/gtk-2.0/include + /sw/lib/gtk-2.0/include + ) + + # Dave: + FIND_PATH(GTK2_GDK_INCLUDE_PATH gdk.h + ${_GDK2IncDir} + /usr/include/gtk-2.0 + /usr/include/gtk-2.0/gdk + ) + #MESSAGE(STATUS "DEBUG: GTK2_GLIBCONFIG_INCLUDE_PATH = ${GTK2_GLIBCONFIG_INCLUDE_PATH}") + + PKGCONFIG(cairo _CAIROIncDir _CAIROinkDir _CAIROLinkFlags _CAIROCflags) + + FIND_PATH(GTK2_CAIRO_INCLUDE_PATH cairo.h + ${_CAIROIncDir} + /opt/gnome/include/cairo + /usr/include + /usr/include/cairo + /opt/include + /opt/include/cairo + /sw/include + /sw/include/cairo + ) + #MESSAGE(STATUS "DEBUG: GTK2_CAIRO_INCLUDE_PATH = ${GTK2_CAIRO_INCLUDE_PATH}") + + PKGCONFIG(atk _ATKIncDir _ATKinkDir _ATKLinkFlags _ATKCflags) + + FIND_PATH(GTK2_ATK_INCLUDE_PATH atk/atk.h + ${_ATKIncDir} + /opt/gnome/include/atk-1.0 + /usr/include/atk-1.0 + /opt/include/atk-1.0 + /sw/include/atk-1.0 + ) + #MESSAGE(STATUS "DEBUG: GTK2_ATK_INCLUDE_PATH = ${GTK2_ATK_INCLUDE_PATH}") + + FIND_LIBRARY(GTK2_GTKGL_LIBRARY + NAMES + gtkgl + PATHS + ${_GTK22IncDir} + /usr/lib + /usr/local/lib + /usr/openwin/lib + /usr/X11R6/lib + /opt/gnome/lib + /opt/lib + /sw/lib + ) + + FIND_LIBRARY(GTK2_GTK_LIBRARY + NAMES + gtk-x11-2.0 + PATHS + ${_GTK22LinkDir} + /usr/lib + /usr/local/lib + /usr/openwin/lib + /usr/X11R6/lib + /opt/gnome/lib + /opt/lib + /sw/lib + ) + + FIND_LIBRARY(GTK2_GDK_LIBRARY + NAMES + gdk-x11-2.0 + PATHS + ${_GDK2LinkDir} + /usr/lib + /usr/local/lib + /usr/openwin/lib + /usr/X11R6/lib + /opt/gnome/lib + /opt/lib + /sw/lib + ) + + FIND_LIBRARY(GTK2_GMODULE_LIBRARY + NAMES + gmodule-2.0 + PATHS + ${_GMODULE2inkDir} + /usr/lib + /usr/local/lib + /usr/openwin/lib + /usr/X11R6/lib + /opt/gnome/lib + /opt/lib + /sw/lib + ) + + FIND_LIBRARY(GTK2_GLIB_LIBRARY + NAMES + glib-2.0 + PATHS + ${_GLIB2inkDir} + /usr/lib + /usr/local/lib + /usr/openwin/lib + /usr/X11R6/lib + /opt/gnome/lib + /opt/lib + /sw/lib + ) + + FIND_LIBRARY(GTK2_Xi_LIBRARY + NAMES + Xi + PATHS + /usr/lib + /usr/local/lib + /usr/openwin/lib + /usr/X11R6/lib + /opt/gnome/lib + /opt/lib + /sw/lib + ) + + FIND_LIBRARY(GTK2_GTHREAD_LIBRARY + NAMES + gthread-2.0 + PATHS + /usr/lib + /usr/local/lib + /usr/openwin/lib + /usr/X11R6/lib + /opt/gnome/lib + /opt/lib + /sw/lib + ) + + + FIND_LIBRARY(GTK2_GOBJECT_LIBRARY + NAMES + gobject-2.0 + PATHS + /usr/lib + /usr/local/lib + /usr/openwin/lib + /usr/X11R6/lib + /opt/gnome/lib + /opt/lib + /sw/lib + ) + + IF(GTK2_GTK_INCLUDE_PATH) + IF(GTK2_GLIBCONFIG_INCLUDE_PATH) + IF(GTK2_GLIB_INCLUDE_PATH) + IF(GTK2_GTK_LIBRARY) + IF(GTK2_GLIB_LIBRARY) + IF(GTK2_PANGO_INCLUDE_PATH) + IF(GTK2_ATK_INCLUDE_PATH) + IF(GTK2_CAIRO_INCLUDE_PATH) + # Assume that if gtk and glib were found, the other + # supporting libraries have also been found. + + SET(GTK2_FOUND TRUE) + + SET(GTK2_INCLUDE_DIRS + ${GTK2_GTK_INCLUDE_PATH} + ${GTK2_GLIBCONFIG_INCLUDE_PATH} + ${GTK2_GLIB_INCLUDE_PATH} + ${GTK2_PANGO_INCLUDE_PATH} + ${GTK2_GDKCONFIG_INCLUDE_PATH} + # Dave: + ${GTK2_GDK_INCLUDE_PATH} + ${GTK2_ATK_INCLUDE_PATH} + ${GTK2_CAIRO_INCLUDE_PATH} + ) + + SET(GTK2_LIBRARIES + ${GTK2_GTK_LIBRARY} + ${GTK2_GDK_LIBRARY} + ${GTK2_GLIB_LIBRARY} + ) + #${GTK2_GOBJECT_LIBRARY}) + + IF(GTK2_GMODULE_LIBRARY) + SET(GTK2_LIBRARIES + ${GTK2_LIBRARIES} + ${GTK2_GMODULE_LIBRARY} + ) + ENDIF(GTK2_GMODULE_LIBRARY) + + IF(GTK2_GTHREAD_LIBRARY) + SET(GTK2_LIBRARIES + ${GTK2_LIBRARIES} + ${GTK2_GTHREAD_LIBRARY} + ) + SET(GTK2_LIBRARIES ${GTK2_LIBRARIES}) + ENDIF(GTK2_GTHREAD_LIBRARY) + ELSE(GTK2_CAIRO_INCLUDE_PATH) + MESSAGE(STATUS "Can not find cairo") + ENDIF(GTK2_CAIRO_INCLUDE_PATH) + ELSE(GTK2_ATK_INCLUDE_PATH) + MESSAGE(STATUS "Can not find atk") + ENDIF(GTK2_ATK_INCLUDE_PATH) + ELSE(GTK2_PANGO_INCLUDE_PATH) + MESSAGE(STATUS "Can not find pango includes") + ENDIF(GTK2_PANGO_INCLUDE_PATH) + ELSE(GTK2_GLIB_LIBRARY) + MESSAGE(STATUS "Can not find glib lib") + ENDIF(GTK2_GLIB_LIBRARY) + ELSE(GTK2_GTK_LIBRARY) + MESSAGE(STATUS "Can not find gtk lib") + ENDIF(GTK2_GTK_LIBRARY) + ELSE(GTK2_GLIB_INCLUDE_PATH) + MESSAGE(STATUS "Can not find glib includes") + ENDIF(GTK2_GLIB_INCLUDE_PATH) + ELSE(GTK2_GLIBCONFIG_INCLUDE_PATH) + MESSAGE(STATUS "Can not find glibconfig") + ENDIF(GTK2_GLIBCONFIG_INCLUDE_PATH) + ELSE (GTK2_GTK_INCLUDE_PATH) + MESSAGE(STATUS "Can not find gtk includes") + ENDIF (GTK2_GTK_INCLUDE_PATH) + + IF (GTK2_FOUND) + IF (NOT GTK2_FIND_QUIETLY) + MESSAGE(STATUS "Found GTK2: ${GTK2_LIBRARIES}") + ENDIF (NOT GTK2_FIND_QUIETLY) + ELSE (GTK2_FOUND) + IF (GTK2_FIND_REQUIRED) + MESSAGE(SEND_ERROR "Could NOT find GTK2") + ENDIF (GTK2_FIND_REQUIRED) + ENDIF (GTK2_FOUND) + + MARK_AS_ADVANCED( + GTK2_GDK_LIBRARY + GTK2_GLIB_INCLUDE_PATH + GTK2_GLIB_LIBRARY + GTK2_GLIBCONFIG_INCLUDE_PATH + GTK2_GMODULE_LIBRARY + GTK2_GTHREAD_LIBRARY + GTK2_Xi_LIBRARY + GTK2_GTK_INCLUDE_PATH + GTK2_GTK_LIBRARY + GTK2_GTKGL_INCLUDE_PATH + GTK2_GTKGL_LIBRARY + GTK2_ATK_INCLUDE_PATH + GTK2_GDKCONFIG_INCLUDE_PATH + # Dave: + GTK2_GDK_INCLUDE_PATH + #GTK2_GOBJECT_LIBRARY + GTK2_PANGO_INCLUDE_PATH + ) + ENDIF(UNIX) +ENDIF (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS) + diff --git a/lib/maracasVisuLib/include/Modules/FindKGFO.cmake b/lib/maracasVisuLib/include/Modules/FindKGFO.cmake new file mode 100644 index 0000000..2f4d3d9 --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/FindKGFO.cmake @@ -0,0 +1,85 @@ +# +# This module finds if kgfo is installed and determines where the +# include files and libraries are. It also determines what the name of +# the library is. This code sets the following variables: +# +# KGFO_FOUND = system has kgfo and it should be used +# KGFO_LIBRARIES = full path to the kgfo library and linker flags on unix +# CMAKE_KGFO_CXX_FLAGS = compiler flags for building kgfo +# KGFO_INCLUDE_DIR = include path of kgfo + +IF(WIN32) + IF(NOT UNIX) + + SET (KGFO_POSSIBLE_LIB_PATHS + $ENV{KGFO}/lib + $ENV{CREATIS}/kgfo/win32inst/lib + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\kgfo_is1;Inno Setup: App Path]/lib" + ) + + FIND_LIBRARY(KGFO_STATIC_LIBRARY + NAMES kgfo + PATHS ${KGFO_POSSIBLE_LIB_PATHS} + ) + + FIND_LIBRARY(KGFO_SHARED_LIBRARY + NAMES kgfo + PATHS ${KGFO_POSSIBLE_LIB_PATHS} + ) + + SET (KGFO_POSSIBLE_INCLUDE_PATHS + $ENV{KGFO}/include + $ENV{CREATIS}/kgfo/win32inst/include + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\kgfo_is1;Inno Setup: App Path]/include" + ) + + FIND_PATH(KGFO_INCLUDE_DIR + kgfo/kgfo-setup.hxx + ${KGFO_POSSIBLE_INCLUDE_PATHS} + ) + + IF(KGFO_SHARED_LIBRARY) + OPTION(KGFO_USE_SHARED_LIBS + "Use shared versions of kgfo libraries" ON) + MARK_AS_ADVANCED(KGFO_USE_SHARED_LIBS) + ENDIF(KGFO_SHARED_LIBRARY) + + SET(CMAKE_KGFO_LIBRARIES ${CMAKE_KGFO_LIBRARIES}) # comctl32 ctl3d32 wsock32 rpcrt4) + + IF(KGFO_USE_SHARED_LIBS) + SET(KGFO_LIBRARIES ${KGFO_SHARED_LIBRARY} ${CMAKE_KGFO_LIBRARIES}) + ADD_DEFINITIONS(-DKGFO_USING_DLL) + ELSE(KGFO_USE_SHARED_LIBS) + SET(KGFO_LIBRARIES ${KGFO_STATIC_LIBRARY} ${CMAKE_KGFO_LIBRARIES}) + ENDIF(KGFO_USE_SHARED_LIBS) + + MARK_AS_ADVANCED( + KGFO_STATIC_LIBRARY + KGFO_SHARED_LIBRARY + KGFO_INCLUDE_DIR + ) + + ENDIF(NOT UNIX) +ENDIF(WIN32) + +IF(UNIX) + + FIND_PROGRAM(CMAKE_KGFO_CONFIG kgfo-config ../kgfo/bin ../../kgfo/bin) + SET(CMAKE_KGFO_CXX_FLAGS "`${CMAKE_KGFO_CONFIG} --cflags`") + SET(KGFO_LIBRARIES "`${CMAKE_KGFO_CONFIG} --libs`") + +ENDIF(UNIX) + +MARK_AS_ADVANCED( + CMAKE_KGFO_CONFIG + CMAKE_KGFO_CXX_FLAGS + KGFO_INCLUDE_DIR +) + +IF(KGFO_LIBRARIES) + IF(KGFO_INCLUDE_DIR OR CMAKE_KGFO_CXX_FLAGS) + SET(CMAKE_KGFO_CAN_COMPILE 1) + SET(KGFO_FOUND 1) + ENDIF(KGFO_INCLUDE_DIR OR CMAKE_KGFO_CXX_FLAGS) +ENDIF(KGFO_LIBRARIES) + diff --git a/lib/maracasVisuLib/include/Modules/FindLibido.cmake b/lib/maracasVisuLib/include/Modules/FindLibido.cmake new file mode 100644 index 0000000..047eb69 --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/FindLibido.cmake @@ -0,0 +1,71 @@ +# +# This module finds if Python is installed and determines where the +# include files and libraries are. It also determines what the name of +# the library is. This code sets the following variables: +# +# LIBIDO_SOURCE_DIR = the full path containing the sources +# LIBIDO_BINARY_DIR = the full path containing the binaries +# LIBIDO_INCLUDE_PATHS = the paths to where .h files can be found +# LIBIDO_LIBRARIES = the full path to the library found +# LIBIDO_DEBUG_LIBRARIES = the full path to the debug library found +# + +#----------------------------------------------------------------------------- +INCLUDE(${CMAKE_ROOT}/Modules/CMakeFindFrameworks.cmake) + +#----------------------------------------------------------------------------- +IF(${libIdo_DIR}) + SET(LIBIDO_SOURCE_DIR ${libIdo_DIR} CACHE PATH "libIdo source directory") + SET(LIBIDO_BINARY_DIR ${libIdo_DIR} CACHE PATH "libIdo binary directory") +ENDIF(${libIdo_DIR}) + +IF(NOT LIBIDO_SOURCE_DIR) + FIND_PATH( LIBIDO_SOURCE_DIR libido.spec.in $ENV{LIBIDO_SRC} ) + SET(LIBIDO_SOURCE_DIR ${LIBIDO_SOURCE_DIR} CACHE PATH "libIdo source directory") +ELSE(NOT LIBIDO_SOURCE_DIR) + INCLUDE_DIRECTORIES(${LIBIDO_SOURCE_DIR}) +ENDIF(NOT LIBIDO_SOURCE_DIR) + + + +IF(NOT LIBIDO_BINARY_DIR) + FIND_PATH( LIBIDO_BINARY_DIR libIdoConfig.cmake paths $ENV{LIBIDO_PATH} ) + SET(LIBIDO_BINARY_DIR ${LIBIDO_BINARY_DIR} CACHE PATH "libIdo binary directory") +ENDIF(NOT LIBIDO_BINARY_DIR) + + +#----------------------------------------------------------------------------- +# Set libIdo compilation variables +FIND_PATH(LIBIDO_INCLUDE_PATH NAME idima.h + PATHS ${LIBIDO_SOURCE_DIR}/src + DOC "libIdo include path" +) +FIND_LIBRARY(LIBIDO_LIBRARY name Ido libIdo + PATHS ${LIBIDO_BINARY_DIR}/lib/release + ${LIBIDO_BINARY_DIR}/lib + DOC "libIdo library" +) +FIND_LIBRARY(LIBIDO_DEBUG_LIBRARY name Ido libIdo + PATHS ${LIBIDO_BINARY_DIR}/lib/debug + ${LIBIDO_BINARY_DIR}/lib + DOC "libIdo debug library" +) + +IF(WIN32) + MARK_AS_ADVANCED(FORCE + GLIB_INCLUDE_PATH + GLIB_LIBRARY + ) +ENDIF(WIN32) +MARK_AS_ADVANCED(FORCE + LIBIDO_SOURCE_DIR + LIBIDO_BINARY_DIR + LIBIDO_INCLUDE_PATH + LIBIDO_LIBRARY + LIBIDO_DEBUG_LIBRARY +) + +SET(LIBIDO_INCLUDE_PATHS "${LIBIDO_INCLUDE_PATH}") +SET(LIBIDO_LIBRARIES "${LIBIDO_LIBRARY}") +SET(LIBIDO_DEBUG_LIBRARIES "${LIBIDO_DEBUG_LIBRARY}") + diff --git a/lib/maracasVisuLib/include/Modules/FindMySQL.cmake b/lib/maracasVisuLib/include/Modules/FindMySQL.cmake new file mode 100644 index 0000000..1492482 --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/FindMySQL.cmake @@ -0,0 +1,49 @@ +# - Find MySQL +# Find the MySQL includes and client library +# This module defines +# MYSQL_INCLUDE_DIR, where to find mysql.h +# MYSQL_LIBRARIES, the libraries needed to use MySQL. +# MYSQL_FOUND, If false, do not try to use MySQL. +# +# Copyright (c) 2006, Jaroslaw Staniek, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) + set(MYSQL_FOUND TRUE) + +else(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) + + find_path(MYSQL_INCLUDE_DIR mysql.h + /usr/include/mysql + /usr/local/include/mysql + $ENV{ProgramFiles}/MySQL/*/include + $ENV{SystemDrive}/MySQL/*/include + ) + +if(WIN32 AND MSVC) + find_library(MYSQL_LIBRARIES NAMES libmysql + PATHS + $ENV{ProgramFiles}/MySQL/*/lib/opt + $ENV{SystemDrive}/MySQL/*/lib/opt + ) +else(WIN32 AND MSVC) + find_library(MYSQL_LIBRARIES NAMES mysqlclient + PATHS + /usr/lib/mysql + /usr/local/lib/mysql + ) +endif(WIN32 AND MSVC) + + if(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) + set(MYSQL_FOUND TRUE) + message(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}") + else(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) + set(MYSQL_FOUND FALSE) + message(STATUS "MySQL not found.") + endif(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) + + mark_as_advanced(MYSQL_INCLUDE_DIR MYSQL_LIBRARIES) + +endif(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) diff --git a/lib/maracasVisuLib/include/Modules/FindwxGlade.cmake b/lib/maracasVisuLib/include/Modules/FindwxGlade.cmake new file mode 100644 index 0000000..68789b5 --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/FindwxGlade.cmake @@ -0,0 +1,54 @@ +# +# This module finds if WXGLADE is installed and determines where the +# include files and libraries are. It also determines what the name of +# the library is. This code sets the following variables: +# +# WXGLADE_FOUND = system has WXGLADE and it should be used +# WXGLADE_EXECUTABLE = path to the program itself + +IF(WIN32) +IF(NOT UNIX) + SET (WXGLADE_POSSIBLE_LIB_PATHS + $ENV{WXGLADE} + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxGlade_is1;Inno Setup: App Path]" + ) + + FIND_PROGRAM(WXGLADE_EXECUTABLE + wxglade + ${WXGLADE_POSSIBLE_LIB_PATHS} + ) + +ENDIF(NOT UNIX) +ENDIF(WIN32) + +IF(UNIX) + + #rpm put a /usr/bin/wxglade which link to: + #/usr/lib/wxGlade/wxglade.py + +# FIND_PROGRAM(WXGLADE_EXECUTABLE +# wxglade +# /usr/bin +# ) + + FIND_PROGRAM(WXGLADE_EXECUTABLE + wxglade.py + /usr/lib/wxGlade + /usr/local/lib/wxGlade + ) + + FIND_PROGRAM(XRC2WXG_EXECUTABLE + xrc2wxg.py + /usr/lib/wxGlade + /usr/local/lib/wxGlade + ) + +ENDIF(UNIX) + +MARK_AS_ADVANCED( + WXGLADE_EXECUTABLE +) + +IF(WXGLADE_EXECUTABLE) + SET(WXGLADE_FOUND 1) +ENDIF(WXGLADE_EXECUTABLE) diff --git a/lib/maracasVisuLib/include/Modules/FindwxW.cmake b/lib/maracasVisuLib/include/Modules/FindwxW.cmake new file mode 100644 index 0000000..a03d731 --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/FindwxW.cmake @@ -0,0 +1,573 @@ +# +# FindwxW.cmake +# v1.06 2006-03-27 +# Jerry Fath 2005 +# Based on work by Jorgen Bodde +# +# This module finds if wxWindows is installed and determines where the +# include files and libraries are. It also determines what the name of +# the library is. This code sets the following variables: +# +# WXWIDGETS_FOUND = wxWidgets was found +# WXWIDGETS_ROOT_DIR = base wxWidgets directory +# WXWIDGETS_LINK_DIRECTORIES = link directories, useful for rpath on Unix +# WXWIDGETS_LIBRARIES = all the wxWindows libraries ( and linker flags on unix ) +# WXWIDGETS_CXX_FLAGS = compiler flags for building wxWindows +# WXWIDGETS_EXE_LINKER_FLAGS = compiler flags for building wxWindows +# WXWIDGETS_INCLUDE_DIR = all include path of wxWindows +# WXWIDGETS_DEFINITIONS = all flags of wxWindows +# +# WXWIDGETS_RELEASE_LIBRARIES = release wxWindows libraries (Win32 only) +# WXWIDGETS_DEBUG_LIBRARIES = debug wxWindows libraries (Win32 only) +# WXWIDGETS_COMMON_LIBRARIES = libraries common to Release and Debug (Win32 only) + +# NOTE: This module REQUIRES that an environment variable named WXWIN +# be set to the base wxWidgets installation directory. +# Under Unix, you must also set and environment variable named WXWINCFG +# to the name of the active build subdirectory (eg buildgtk). As an alternative +# to the WXWINCFG environment variable, you can set a sym link in the wxWidgets +# root directory called wx-config which points to the active build subdirectory. +# + +# These variable should be set before including this module +# +# WXWIDGETS_FILE_VERSION (26) +# WXWIDGETS_VERSION (2.6) +# +# + +####################### EXAMPLE CMakeLists.txt ################### +# +##Required project specific settings +#PROJECT( myprojectname ) +#SET(PROJECT_SOURCE_FILES myfile.cpp myfile2.cpp) +#IF( WIN32) +# SET(PROJECT_RC_FILE myresfile.rc) +#ELSE( WIN32) +# SET(PROJECT_RC_FILE "") +#ENDIF( WIN32) +# +##Optional project specific settings +#SET(PROJECT_DEFINITIONS -D_MYPROJECT_ -D_MYPROJECT2_) +#SET(PROJECT_INCLUDE_PATH e:/myproject/include e:/myproject2/include) +#SET(PROJECT_LINK_DIRECTORIES e:/myproject/lib e:/myproject2/lib) +#SET(PROJECT_LIBRARIES myprojectlib myproject2lib) +# +##wxWidgets build related stuff +#SET(WXW_USE_DEBUG OFF) +#SET(WXW_USE_UNICODE OFF) +#SET(WXW_USE_SHARED OFF) +#SET(WXW_USE_UNIV OFF) +#SET(WXW_USE_MONO OFF) +#SET(WXW_FILE_VERSION "26") +#SET(WXW_VERSION "2.6") +# +#INCLUDE (FindwxW) +#INCLUDE (UsewxW) +# +####################### END EXAMPLE CMakeLists.txt ################### + +# +# Set WX_USE vars in CMakeLists if you don't want to default to all off +# +SET(WXWIDGETS_USE_DEBUG ${WXW_USE_DEBUG} CACHE BOOL "Use Debug versions of wxWindows libraries") +SET(WXWIDGETS_USE_UNICODE ${WXW_USE_UNICODE} CACHE BOOL "Use Unicode versions of wxWindows libraries") +SET(WXWIDGETS_USE_SHARED ${WXW_USE_SHARED} CACHE BOOL "Use shared versions of wxWindows libraries") +SET(WXWIDGETS_USE_UNIV ${WXW_USE_UNIV} CACHE BOOL "Use Universal versions of wxWindows libraries") +SET(WXWIDGETS_USE_MONO ${WXW_USE_MONO} CACHE BOOL "Use monolithic versions of wxWindows libraries") + +# +# Style can be non-Win32 even under Windows when using MinGW +# +IF(WIN32) + SET(WIN32_STYLE_FIND 1) +ENDIF(WIN32) +IF(MINGW) + SET(WIN32_STYLE_FIND 0) + SET(UNIX_STYLE_FIND 1) +ENDIF(MINGW) +IF(UNIX) + SET(UNIX_STYLE_FIND 1) +ENDIF(UNIX) + +# +# Versions should be set before this file is included. If not, +# default to 2.6 +# +IF(WXW_FILE_VERSION) + SET( WXVERSIONSUFFIX ${WXW_FILE_VERSION}) +ELSE(WXW_FILE_VERSION) + SET( WXVERSIONSUFFIX "26") +ENDIF(WXW_FILE_VERSION) + +IF(WXW_VERSION) + SET( WXVERSION ${WXW_VERSION}) +ELSE(WXW_VERSION) + SET( WXVERSION "2.6") +ENDIF(WXW_VERSION) + +# +# Find the base wxWidgets install path +# NOTE: WXWIN must be set +# +FIND_PATH( WXWIDGETS_ROOT_DIR + wx-config.in + $ENV{WXWIN} +) +IF(WXWIDGETS_ROOT_DIR STREQUAL "WXWIDGETS_ROOT_DIR-NOTFOUND") + MESSAGE( FATAL_ERROR "FATAL_ERROR: wx-config.in NOT found. Set WXWIN") +ENDIF(WXWIDGETS_ROOT_DIR STREQUAL "WXWIDGETS_ROOT_DIR-NOTFOUND") +SET(WXWIDGETS_CONFIG_PATH ${WXWIDGETS_ROOT_DIR}) + +# +# Find library path (platform specific) +# +IF( WIN32_STYLE_FIND ) + + IF( WXWIDGETS_USE_SHARED ) + SET(WXWIDGETS_LIB_PATH "${WXWIDGETS_ROOT_DIR}/lib/vc_dll" ) + ELSE( WXWIDGETS_USE_SHARED ) + SET(WXWIDGETS_LIB_PATH "${WXWIDGETS_ROOT_DIR}/lib/vc_lib" ) + ENDIF( WXWIDGETS_USE_SHARED ) + SET( WXWIDGETS_LINK_DIRECTORIES ${WXWIDGETS_LIB_PATH} ) + +ELSE( WIN32_STYLE_FIND ) + IF (UNIX_STYLE_FIND) + + # + # Unix uses a config specific directory under the install path + # specified in the WXWINCFG environment variable. + # If the WXWINCFG variable isn't set, we try a sym link within + # the WX root dir called wx-config, or the current PATH + # + FIND_PROGRAM( WX_WXCONFIG_EXECUTABLE + wx-config + "${WXWIDGETS_ROOT_DIR}/$ENV{WXWINCFG}" + "${WXWIDGETS_ROOT_DIR}/wx-config" ) + # + # Check wether wx-config can be found + # + IF(NOT EXISTS ${WX_WXCONFIG_EXECUTABLE}) + # we really need wx-config... + MESSAGE(FATAL_ERROR "FATAL_ERROR: Cannot find wx-config. Set WXWIN and WXWINCFG environment variables.") + ENDIF(NOT EXISTS ${WX_WXCONFIG_EXECUTABLE}) + + GET_FILENAME_COMPONENT( WXWIDGETS_CONFIG_PATH + WX_WXCONFIG_EXECUTABLE + PATH ) + + SET(WXWIDGETS_LIB_PATH "${WXWIDGETS_CONFIG_PATH}/lib" ) + SET( WXWIDGETS_LINK_DIRECTORIES ${WXWIDGETS_LIB_PATH} ) + + ELSE(UNIX_STYLE_FIND) + MESSAGE(FATAL_ERROR "FATAL_ERROR: FindwxWindows.cmake: Platform unsupported by FindwxW.cmake. It's neither WIN32 nor UNIX") + ENDIF(UNIX_STYLE_FIND) +ENDIF( WIN32_STYLE_FIND ) + +# +# Check options against installed libraries +# +SET(WX_CONFIG_ARGS "") +SET( LIBRARYWANT "${WXWIDGETS_LIB_PATH}/msw" ) + +IF( WXWIDGETS_USE_UNIV ) + SET( LIBRARYWANT "${LIBRARYWANT}univ") + SET( PFUNIV "univ" ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --universal=yes") +ELSE( WXWIDGETS_USE_UNIV ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --universal=no") +ENDIF( WXWIDGETS_USE_UNIV ) + +IF( WXWIDGETS_USE_UNICODE ) + SET( LIBRARYWANT "${LIBRARYWANT}u" ) + SET( PFUNICODE "u" ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --unicode=yes") +ELSE( WXWIDGETS_USE_UNICODE ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --unicode=no") +ENDIF( WXWIDGETS_USE_UNICODE ) + +IF( WXWIDGETS_USE_DEBUG ) + SET( PFDEBUG "d" ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --debug=yes") +ELSE( WXWIDGETS_USE_DEBUG ) + SET( PFDEBUG "" ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --debug=no") +ENDIF( WXWIDGETS_USE_DEBUG ) + +IF( WXWIDGETS_USE_SHARED ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --static=no") +ELSE( WXWIDGETS_USE_SHARED ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --static=yes") +ENDIF( WXWIDGETS_USE_SHARED ) + +# Not sure how to check this yet!!!!! +IF( WXWIDGETS_USE_MONO ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS}") +ELSE( WXWIDGETS_USE_MONO ) + SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS}") +ENDIF( WXWIDGETS_USE_MONO ) + +SET(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS} --libs") + +# +# Platform specific method for testing installed wx Builds +# +IF( WIN32_STYLE_FIND ) + + # + # See if we have both release and debug wx versions + # + SET ( WX_DEBUGANDRELEASE FALSE ) + IF( EXISTS "${LIBRARYWANT}/wx/setup.h" ) + IF( EXISTS "${LIBRARYWANT}d/wx/setup.h" ) + SET ( WX_DEBUGANDRELEASE TRUE ) + ENDIF( EXISTS "${LIBRARYWANT}d/wx/setup.h" ) + ENDIF( EXISTS "${LIBRARYWANT}/wx/setup.h" ) + + SET( LIBRARYWANT "${LIBRARYWANT}${PFDEBUG}" ) + IF( NOT EXISTS "${LIBRARYWANT}/wx/setup.h" ) + MESSAGE( SEND_ERROR "ERROR: WXWidgets config NOT found ${WX_CONFIG_ARGS}") + ENDIF( NOT EXISTS "${LIBRARYWANT}/wx/setup.h" ) + +ELSE( WIN32_STYLE_FIND ) + + EXEC_PROGRAM(${WX_WXCONFIG_EXECUTABLE} + ARGS ${WX_CONFIG_ARGS_LIBS} + OUTPUT_VARIABLE WXWIDGETS_LIBRARIES + RETURN_VALUE BAD_WXCONFIG ) + IF(BAD_WXCONFIG) + MESSAGE( SEND_ERROR "ERROR: WXWidgets config NOT found ${WX_CONFIG_ARGS}") + ENDIF(BAD_WXCONFIG) + +ENDIF( WIN32_STYLE_FIND ) + +# +# Get compiler flags +# +IF( WIN32_STYLE_FIND ) + # Not used for Windows + SET( WXWIDGETS_CXX_FLAGS "" ) +ELSE( WIN32_STYLE_FIND ) + # + # Get CXXFLAGS from wx-config + # + EXEC_PROGRAM(${WX_WXCONFIG_EXECUTABLE} + ARGS "--cxxflags" + OUTPUT_VARIABLE WXWIDGETS_CXX_FLAGS + RETURN_VALUE BAD_WXCONFIG ) + IF (BAD_WXCONFIG) + MESSAGE( SEND_ERROR "ERROR: wx-config --cxxflags returned an error") + ENDIF (BAD_WXCONFIG) +ENDIF( WIN32_STYLE_FIND ) + +# +# Find include directories (platform specific) +# +IF( WIN32_STYLE_FIND ) + # + # Set non-build specific include directories + # + SET ( WX_INCLUDE_PATH ${WXWIDGETS_ROOT_DIR}/include ) + SET ( WXWIDGETS_INCLUDE_DIR ${WX_INCLUDE_PATH} ) + SET( WXWIDGETS_INCLUDE_DIR ${WXWIDGETS_INCLUDE_DIR} ${WXWIDGETS_INCLUDE_DIR}/../contrib/include ) + # + # Append the build specific include dir for wx/setup.h: + # + IF ( EXISTS ${LIBRARYWANT}/wx/setup.h ) + SET( WX_INCLUDE_LIB_PATH ${LIBRARYWANT}) + SET( WXWIDGETS_INCLUDE_DIR ${WXWIDGETS_INCLUDE_DIR} ${LIBRARYWANT} ) + ELSE ( EXISTS ${LIBRARYWANT}/wx/setup.h ) + SET( WX_INCLUDE_LIB_PATH, "") + MESSAGE(SEND_ERROR "ERROR: Can't find ${LIBRARYWANT}/wx/setup.h") + ENDIF ( EXISTS ${LIBRARYWANT}/wx/setup.h ) + +ELSE( WIN32_STYLE_FIND ) + + # Pull out -I options + # evaluate wx-config output to separate include dirs + SET(WX_INCLUDE_DIR ${WXWIDGETS_CXX_FLAGS}) + # extract include dirs (-I) + # use regular expression to match wildcard equivalent "-I*" + # with is a space or a semicolon + STRING(REGEX MATCHALL "[-][I]([^ ;])+" WX_INCLUDE_DIRS_WITH_PREFIX "${WX_INCLUDE_DIR}" ) + # remove prefix -I because we need the pure directory + IF(WX_INCLUDE_DIRS_WITH_PREFIX) + STRING(REGEX REPLACE "[-][I]" ";" WXWIDGETS_INCLUDE_DIR ${WX_INCLUDE_DIRS_WITH_PREFIX} ) + ENDIF(WX_INCLUDE_DIRS_WITH_PREFIX) + # replace space separated string by semicolon separated vector + SEPARATE_ARGUMENTS(WXWIDGETS_INCLUDE_DIR) + # Remove the -I options from the CXX_FLAGS no need to duplicate + STRING(REGEX REPLACE "[-][I]([^ ;])+" "" WXWIDGETS_CXX_FLAGS ${WXWIDGETS_CXX_FLAGS} ) + + # + # Find XWindows + # + IF( NOT CYGWIN OR MINGW ) + INCLUDE( ${CMAKE_ROOT}/Modules/FindX11.cmake ) + SET( WXWIDGETS_INCLUDE_DIR ${WXWIDGETS_INCLUDE_DIR} ${X11_INCLUDE_DIR} ) + ENDIF( NOT CYGWIN OR MINGW ) +ENDIF( WIN32_STYLE_FIND ) + +# +# Find library list (platform specific) +# +IF( WIN32_STYLE_FIND ) + # + #Misc vars used to build lib names + # + SET( PFLIBEXT ${CMAKE_STATIC_LIBRARY_SUFFIX} ) + SET( WXPF "${WXPF}${WXVERSIONSUFFIX}" ) + SET( PFVERSION ${WXVERSIONSUFFIX} ) + SET( PFCOMPILER "" ) + + # + # Build the libraries list + # + SET( WX_TOKEN_LIBS "" ) + SET( WX_MULTI_LIBRARIES "" ) + SET( WX_MONO_LIBRARIES "" ) + SET( WX_DEBUG_TOKEN "@1" ) + + #start filling library string with needed libraries for the choosen configuration. + #note we use tokens for debug/release and the debug suffix so we can replace later + SET( WXPF "${PFVERSION}${PFUNICODE}${WX_DEBUG_TOKEN}" ) + SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES} + wxbase${WXPF}${PFCOMPILER}${PFLIBEXT} + wxbase${WXPF}_net${PFCOMPILER}${PFLIBEXT} + wxbase${WXPF}_xml${PFCOMPILER}${PFLIBEXT} + ) + + SET( WXPF "${PFVERSION}${PFUNICODE}${WX_DEBUG_TOKEN}" ) + SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES} + wxmsw${WXPF}_adv${PFCOMPILER}${PFLIBEXT} + wxmsw${WXPF}_core${PFCOMPILER}${PFLIBEXT} + wxmsw${WXPF}_html${PFCOMPILER}${PFLIBEXT} + wxmsw${WXPF}_xrc${PFCOMPILER}${PFLIBEXT} + ) + IF (WXWIDGETS_USE_MEDIA) + SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES} + wxmsw${WXPF}_media${PFCOMPILER}${PFLIBEXT} + ) + ENDIF (WXWIDGETS_USE_MEDIA) + + IF( NOT WXWIDGETS_USE_SHARED ) + SET( WXPF "${PFVERSION}${PFUNICODE}${WX_DEBUG_TOKEN}" ) + IF (WXWIDGETS_USE_ODBC) + SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES} + wxbase${WXPF}_odbc${PFCOMPILER}${PFLIBEXT} + ) + ENDIF (WXWIDGETS_USE_ODBC) + + SET( WXPF "${PFVERSION}${PFUNICODE}${WX_DEBUG_TOKEN}" ) + IF (WXWIDGETS_USE_DBGRID) + SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES} + wxmsw${WXPF}_dbgrid${PFLIBEXT} + ) + ENDIF (WXWIDGETS_USE_DBGRID) + IF (WXWIDGETS_USE_GL) + SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES} + wxmsw${WXPF}_gl${PFCOMPILER}${PFLIBEXT} + ) + ENDIF (WXWIDGETS_USE_GL) + ENDIF( NOT WXWIDGETS_USE_SHARED ) + + IF ( WXWIDGETS_USE_UNIV ) + SET( WXPF "${PFUNIV}${PFVERSION}${PFUNICODE}${WX_DEBUG_TOKEN}" ) + SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES} + wxmsw${WXPF}_core${PFCOMPILER}${PFLIBEXT} + ) + ENDIF ( WXWIDGETS_USE_UNIV ) + + SET(WX_MONO_LIBRARIES ${WX_MONO_LIBRARIES} + wxmsw${WXPF}${PFCOMPILER}${PFLIBEXT} + ) + + IF ( WXWIDGETS_USE_MONO ) + SET(WX_TOKEN_LIBS ${WX_TOKEN_LIBS} ${WX_MONO_LIBRARIES}) + ELSE ( WXWIDGETS_USE_MONO ) + SET(WX_TOKEN_LIBS ${WX_TOKEN_LIBS} ${WX_MULTI_LIBRARIES}) + ENDIF ( WXWIDGETS_USE_MONO ) + + SET( WXPF "${PFUNICODE}${WX_DEBUG_TOKEN}" ) + SET(WX_TOKEN_LIBS ${WX_TOKEN_LIBS} + wxregex${WXPF}.lib + ) + + SET( WXPF "${WX_DEBUG_TOKEN}" ) + SET(WX_TOKEN_LIBS ${WX_TOKEN_LIBS} + wxexpat${WXPF}.lib + wxpng${WXPF}.lib + wxtiff${WXPF}.lib + wxjpeg${WXPF}.lib + wxzlib${WXPF}.lib + ) + + + SET( WXWIDGETS_COMMON_LIBRARIES + comctl32${PFLIBEXT} wsock32${PFLIBEXT} rpcrt4${PFLIBEXT} + ) + # + #Build release/debug lists by replacing tokens + # + SET( WXWIDGETS_RELEASE_LIBRARIES "" ) + FOREACH(LOOPLIB ${WX_TOKEN_LIBS}) + SET(WX_TMPLIB ${LOOPLIB}) + STRING(REGEX REPLACE "[@][1]" "" WX_TMPLIB ${WX_TMPLIB} ) + SET( WXWIDGETS_RELEASE_LIBRARIES ${WXWIDGETS_RELEASE_LIBRARIES} + ${WX_TMPLIB} + ) + ENDFOREACH(LOOPLIB ${WX_TOKEN_LIBS}) + SET( WXWIDGETS_DEBUG_LIBRARIES "" ) + FOREACH(LOOPLIB ${WX_TOKEN_LIBS}) + SET(WX_TMPLIB ${LOOPLIB}) + STRING(REGEX REPLACE "[@][1]" "d" WX_TMPLIB ${WX_TMPLIB} ) + SET( WXWIDGETS_DEBUG_LIBRARIES ${WXWIDGETS_DEBUG_LIBRARIES} + ${WX_TMPLIB} + ) + ENDFOREACH(LOOPLIB ${WX_TOKEN_LIBS}) + + # + # Set full lib list to requested type + # + IF( WXWIDGETS_USE_DEBUG ) + SET( WXWIDGETS_LIBRARIES ${WXWIDGETS_COMMON_LIBRARIES} + ${WXWIDGETS_DEBUG_LIBRARIES} + ) + ELSE( WXWIDGETS_USE_DEBUG ) + SET( WXWIDGETS_LIBRARIES ${WXWIDGETS_COMMON_LIBRARIES} + ${WXWIDGETS_RELEASE_LIBRARIES} + ) + ENDIF( WXWIDGETS_USE_DEBUG ) + + #Not used under Windows + SET( WXWIDGETS_EXE_LINKER_FLAGS "" ) + +ELSE( WIN32_STYLE_FIND ) + # + # Get Library list from wx-config + # + # do we need additionial wx GL stuff like GLCanvas ? + IF(WXWIDGETS_USE_GL) + SET(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS_LIBS} --gl-libs" ) + ENDIF(WXWIDGETS_USE_GL) + + EXEC_PROGRAM(${WX_WXCONFIG_EXECUTABLE} + ARGS ${WX_CONFIG_ARGS_LIBS} + OUTPUT_VARIABLE WX_CONFIGARGS + RETURN_VALUE BAD_WXCONFIG ) + IF (BAD_WXCONFIG) + MESSAGE( SEND_ERROR "ERROR: Specified WXWidgets config NOT found") + ENDIF (BAD_WXCONFIG) + + #Pull lib dirs, linker opts, and libs from wx-config --libs return + SET(WXWIDGETS_LINK_DIRECTORIES "") + SET(WXWIDGETS_EXE_LINKER_FLAGS "") + SET(WXWIDGETS_LIBRARIES "") + SEPARATE_ARGUMENTS(WX_CONFIGARGS) + FILE( WRITE "${PROJECT_BINARY_DIR}/findwxw-args.log" "WXWIDGETS ARGS\n" ) + FOREACH(WXARG ${WX_CONFIGARGS}) + FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw-args.log" "WXARG: ${WXARG}\n" ) + IF(WXARG MATCHES "^-L") + SET(WXWIDGETS_LINK_DIRECTORIES ${WXWIDGETS_LINK_DIRECTORIES} ${WXARG}) + ELSE(WXARG MATCHES "^-L") + IF(WXARG MATCHES "^-l") + SET(WXWIDGETS_LIBRARIES "${WXWIDGETS_LIBRARIES} ${WXARG}") + ELSE(WXARG MATCHES "^-l") + IF(WXARG MATCHES "^-") + SET(WXWIDGETS_EXE_LINKER_FLAGS "${WXWIDGETS_EXE_LINKER_FLAGS} ${WXARG}") + ELSE(WXARG MATCHES "^-") + SET(WXWIDGETS_LIBRARIES "${WXWIDGETS_LIBRARIES} ${WXARG}") + ENDIF(WXARG MATCHES "^-") + ENDIF(WXARG MATCHES "^-l") + ENDIF(WXARG MATCHES "^-L") + ENDFOREACH(WXARG ${WX_CONFIGARGS}) + + #Separate library names with ; + SEPARATE_ARGUMENTS(WXWIDGETS_LIBRARIES) + + # remove prefix -L because we need the pure directory for LINK_DIRECTORIES + # replace -L by ; because the separator seems to be lost otherwise (bug or + # feature?) + SET(WX_LINK_DIRECTORIES_WITH_PREFIX ${WXWIDGETS_LINK_DIRECTORIES}) + IF(WX_LINK_DIRECTORIES_WITH_PREFIX) + STRING(REGEX REPLACE "[-][L]" ";" WXWIDGETS_LINK_DIRECTORIES ${WX_LINK_DIRECTORIES_WITH_PREFIX} ) + #MESSAGE("DBG WXWIDGETS_LINK_DIRECTORIES=${WXWIDGETS_LINK_DIRECTORIES}") + ENDIF(WX_LINK_DIRECTORIES_WITH_PREFIX) + # replace space separated string by semicolon separated vector to make it + # work with LINK_DIRECTORIES + SEPARATE_ARGUMENTS(WXWIDGETS_LINK_DIRECTORIES) + + + # + # Unix puts all the libs in the WXWIDGETS_LIBRARIES var + # We don't know debug/release libs under unix, so we set the + # common var to full set as well and leave debug/release sets blank + # + SET( WXWIDGETS_RELEASE_LIBRARIES "" ) + SET( WXWIDGETS_DEBUG_LIBRARIES "" ) + SET(WXWIDGETS_COMMON_LIBRARIES ${WXWIDGETS_LIBRARIES}) + +ENDIF( WIN32_STYLE_FIND ) + + +# +# Find wx.rc +# +SET( WXWIDGETS_RC ${WXWIDGETS_ROOT_DIR}/include/wx/msw/wx.rc ) +IF( NOT WIN32_STYLE_FIND ) + IF( NOT CYGWIN OR MINGW ) + SET( WXWIDGETS_RC "" ) + ENDIF( NOT CYGWIN OR MINGW ) +ENDIF( NOT WIN32_STYLE_FIND ) + +# +# Set preprocessor defs +# +STRING(TOUPPER ${CMAKE_SYSTEM_NAME} WX_SYSNAME) +SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} "-D${WX_SYSNAME}" ) + +IF(WIN32_STYLE_FIND) + SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -DWIN32 -D__WXMSW__ ) +ELSE(WIN32_STYLE_FIND) + IF( CYGWIN ) + SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -D__GNUWIN32__ -O2 -D_WIN32_IE=0x400 -MMD -Wall ) + ENDIF( CYGWIN ) +ENDIF(WIN32_STYLE_FIND) + +IF( WXWIDGETS_USE_SHARED ) + SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -DWXUSINGDLL ) +ENDIF( WXWIDGETS_USE_SHARED ) + +IF( WXWIDGETS_USE_DEBUG ) + SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -D_DEBUG_ -D__WXDEBUG__ -DWXDEBUG=1 ) +ENDIF( WXWIDGETS_USE_DEBUG ) + +IF ( WXWIDGETS_USE_UNICODE ) + SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -DwxUSE_UNICODE ) +ENDIF ( WXWIDGETS_USE_UNICODE ) + +# +# Set the WXWIDGETS_FOUND var +# +IF(WXWIDGETS_LIBRARIES AND WXWIDGETS_INCLUDE_DIR) + SET(WXWIDGETS_FOUND 1) +ENDIF(WXWIDGETS_LIBRARIES AND WXWIDGETS_INCLUDE_DIR) + +# +# Mark advanced vars +# +MARK_AS_ADVANCED(WXWIDGETS_ROOT_DIR) + +# +# Log results +# +FILE( WRITE "${PROJECT_BINARY_DIR}/findwxw.log" "FindwxW.cmake version 1.06\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_FOUND: ${WXWIDGETS_FOUND}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_LINK_DIRECTORIES: ${WXWIDGETS_LINK_DIRECTORIES}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_LIBRARIES: ${WXWIDGETS_LIBRARIES}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_RELEASE_LIBRARIES: ${WXWIDGETS_RELEASE_LIBRARIES}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_DEBUG_LIBRARIES: ${WXWIDGETS_DEBUG_LIBRARIES}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_CXX_FLAGS: ${WXWIDGETS_CXX_FLAGS}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_EXE_LINKER_FLAGS: ${WXWIDGETS_EXE_LINKER_FLAGS}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_INCLUDE_DIR: ${WXWIDGETS_INCLUDE_DIR}\n" ) +FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_DEFINITIONS: ${WXWIDGETS_DEFINITIONS}\n" ) diff --git a/lib/maracasVisuLib/include/Modules/GDCMConfig.cmake b/lib/maracasVisuLib/include/Modules/GDCMConfig.cmake new file mode 100644 index 0000000..ed36f84 --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/GDCMConfig.cmake @@ -0,0 +1,113 @@ +#----------------------------------------------------------------------------- +# +# GDCMConfig.cmake - CMake configuration file for external projects. +# +# This file is configured by GDCM and used by the UseGDCM.cmake +# module to load GDCM's settings for an external project. + +# Compute the installation prefix from GDCM_DIR. +SET(GDCM_INSTALL_PREFIX "${GDCM_DIR}") +GET_FILENAME_COMPONENT(GDCM_INSTALL_PREFIX "${GDCM_INSTALL_PREFIX}" PATH) +GET_FILENAME_COMPONENT(GDCM_INSTALL_PREFIX "${GDCM_INSTALL_PREFIX}" PATH) + +# The GDCM version number. +SET(GDCM_MAJOR_VERSION "1") +SET(GDCM_MINOR_VERSION "3") +SET(GDCM_BUILD_VERSION "1") +SET(GDCM_VERSION "1.3.1") + +# The libraries. +SET(GDCM_LIBRARIES "gdcm") + +# The list of available languages. +#SET(GDCM_LANGUAGES "Python") + +# The CMake macros dir. +SET(GDCM_CMAKE_DIR "${GDCM_INSTALL_PREFIX}/lib/gdcm/CMake") + +# The configuration options. +SET(GDCM_BUILD_SHARED_LIBS "") +#SET(GDCM_USE_HTML_HELP "") + +# The C and C++ flags added to the cmake-configured flags. +SET(GDCM_REQUIRED_C_FLAGS + "") +SET(GDCM_REQUIRED_CXX_FLAGS + "") +SET(GDCM_REQUIRED_EXE_LINKER_FLAGS + "") +SET(GDCM_REQUIRED_SHARED_LINKER_FLAGS + "") +SET(GDCM_REQUIRED_MODULE_LINKER_FLAGS + "") + +# The "use" file. +SET(GDCM_USE_FILE "${GDCM_INSTALL_PREFIX}/lib/gdcm/UseGDCM.cmake") + +# The build settings file. +SET(GDCM_BUILD_SETTINGS_FILE "${GDCM_INSTALL_PREFIX}/lib/gdcm/GDCMBuildSettings.cmake") + +# The library directories. +SET(GDCM_LIBRARY_DIRS "${GDCM_INSTALL_PREFIX}/lib/gdcm") + +# The runtime directories. +# Note that if GDCM_CONFIGURATION_TYPES is set (see below) then +# these directories will be the parent directories under which there will +# be a directory of runtime binaries for each configuration type. +SET(GDCM_RUNTIME_DIRS "${GDCM_INSTALL_PREFIX}/bin") + +# The include directories. +SET(GDCM_INCLUDE_DIRS "${GDCM_INSTALL_PREFIX}/include/gdcm") + +# The library dependencies file. +IF(NOT GDCM_NO_LIBRARY_DEPENDS) + INCLUDE("${GDCM_INSTALL_PREFIX}/lib/gdcm/GDCMLibraryDepends.cmake") +ENDIF(NOT GDCM_NO_LIBRARY_DEPENDS) + +# The data dir. +SET(GDCM_DATA_DIR "${GDCM_INSTALL_PREFIX}/share/gdcm/Data") + +# The examples dir. +SET(GDCM_EXAMPLES_DIR "${GDCM_INSTALL_PREFIX}/share/gdcm/Examples") + +# The resources dir. +SET(GDCM_RESOURCES_DIR "") +SET(GDCM_RESOURCE_MAJOR_VERSION + "") +SET(GDCM_RESOURCE_MINOR_VERSION + "") +SET(GDCM_RESOURCE_APPLICATION_NAME + "") +SET(GDCM_RESOURCE_FILE_NAME + "") +SET(GDCM_RESOURCE_COMPANY_NAME + "") + +# The Tcl/Tk options. +#SET(GDCM_TCL_PACKAGE_INDEX_DIR +# "") + +# The Python options. +SET(GDCM_PYTHON_MODULE_DIR + "") + +# The Doxygen options. +SET(GDCM_DOXYGEN_DIR "${GDCM_INSTALL_PREFIX}") + +# The VTK options. +SET(GDCM_VTK_DIR "C:/Creatis/VTKBin") + +# An install tree always provides one build configuration. +# A build tree may provide either one or multiple build +# configurations depending on the CMake generator used. Since +# this project can be used either from a build tree or an install tree it +# is useful for outside projects to know the configurations available. +# If this GDCMConfig.cmake is in an install tree +# GDCM_CONFIGURATION_TYPES will be empty and GDCM_BUILD_TYPE +# will be set to the value of CMAKE_BUILD_TYPE used to build +# GDCM. If GDCMConfig.cmake is in a build tree +# then GDCM_CONFIGURATION_TYPES and GDCM_BUILD_TYPE will +# have values matching CMAKE_CONFIGURATION_TYPES and CMAKE_BUILD_TYPE +# for that build tree (only one will ever be set). +SET(GDCM_CONFIGURATION_TYPES ) +SET(GDCM_BUILD_TYPE Release) diff --git a/lib/maracasVisuLib/include/Modules/MARACAS_Find_GDCM.cmake b/lib/maracasVisuLib/include/Modules/MARACAS_Find_GDCM.cmake new file mode 100644 index 0000000..f2fdb7d --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/MARACAS_Find_GDCM.cmake @@ -0,0 +1,16 @@ +#Interface02Wx need gdcm +OPTION(GDCM "GDCM." ON ) +IF(GDCM) + FIND_PACKAGE(GDCM) +# 4 Juin 2007 +# INCLUDE_DIRECTORIES(${GDCM_INCLUDE_DIR}) + IF(GDCM_FOUND) + INCLUDE(${GDCM_USE_FILE}) + set(GDCM_LIBRARIES + ${GDCM_LIBRARIES} + " vtkgdcm" + ) + + ENDIF(GDCM_FOUND) + +ENDIF(GDCM) diff --git a/lib/maracasVisuLib/include/Modules/MARACAS_Find_ITK.cmake b/lib/maracasVisuLib/include/Modules/MARACAS_Find_ITK.cmake new file mode 100644 index 0000000..3d1d4c6 --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/MARACAS_Find_ITK.cmake @@ -0,0 +1,71 @@ +#----------------------------------------------------------------------------- +OPTION(USE_ITK "Build ITK-based " ON) +IF(USE_ITK) + # Search ITK + FIND_PACKAGE(ITK) + # If itk found + IF(ITK_FOUND) + INCLUDE(${ITK_USE_FILE}) +# ADD_DEF( _USE_ITK_ ) + SET(MARACAS_ITK_LIBRARIES + ${MARACAS_ITK_LIBRARIES} + ITKCommon + ITKBasicFilters + ITKIO + ITKNumerics + ITKAlgorithms + # itkvnl + ) + MARK_AS_ADVANCED(ITK_DIR) + + # images compilation option + OPTION ( itk_IMAGE_DIM_2 "itk : Compile 2D images" ON) + OPTION ( itk_IMAGE_DIM_3 "itk : Compile 3D images" ON) + OPTION ( itk_IMAGE_TYPE_UCHAR "itk : Compile unsigned char images" ON) + OPTION ( itk_IMAGE_TYPE_SHORT "itk : Compile short images" ON) + OPTION ( itk_IMAGE_TYPE_USHORT "itk : Compile unsigned short images" ON) + OPTION ( itk_IMAGE_TYPE_INT "itk : Compile int images" ON) + OPTION ( itk_IMAGE_TYPE_FLOAT "itk : Compile float images" ON) + +# IF ( itk_IMAGE_DIM_2 ) +# ADD_DEF( BBTK_ITK_IMAGE_DIM_2 ) +# ENDIF ( itk_IMAGE_DIM_2 ) + +# IF ( itk_IMAGE_DIM_3 ) +# ADD_DEF( BBTK_ITK_IMAGE_DIM_3 ) +# ENDIF ( itk_IMAGE_DIM_3 ) + +# IF ( itk_IMAGE_TYPE_UCHAR ) +# ADD_DEF( BBTK_ITK_IMAGE_TYPE_UCHAR ) +# ENDIF ( itk_IMAGE_TYPE_UCHAR ) + +# IF ( itk_IMAGE_TYPE_SHORT ) +# ADD_DEF( BBTK_ITK_IMAGE_TYPE_SHORT ) +# ENDIF ( itk_IMAGE_TYPE_SHORT ) + +# IF ( itk_IMAGE_TYPE_USHORT ) +# ADD_DEF( BBTK_ITK_IMAGE_TYPE_USHORT ) +# ENDIF ( itk_IMAGE_TYPE_USHORT ) + +# IF ( itk_IMAGE_TYPE_INT ) +# ADD_DEF( BBTK_ITK_IMAGE_TYPE_INT ) +# ENDIF ( itk_IMAGE_TYPE_INT ) + +# IF ( itk_IMAGE_TYPE_FLOAT ) +# ADD_DEF( BBTK_ITK_IMAGE_TYPE_FLOAT ) +# ENDIF ( itk_IMAGE_TYPE_FLOAT ) + + + ELSE(ITK_FOUND) + MESSAGE(FATAL_ERROR + "Cannot build MARACAS without ITK. Please set ITK_DIR.") + ENDIF(ITK_FOUND) + + + + + + +ENDIF(USE_ITK) +MARK_AS_ADVANCED(USE_ITK) +#----------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/include/Modules/MARACAS_Find_LIBIDO.cmake b/lib/maracasVisuLib/include/Modules/MARACAS_Find_LIBIDO.cmake new file mode 100644 index 0000000..4ffc57e --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/MARACAS_Find_LIBIDO.cmake @@ -0,0 +1,4 @@ + +FIND_PATH( libIdo_DIR libidobin $ENV{LIBIDO_PATH} ) +FIND_PACKAGE(libIdo) +INCLUDE_DIRECTORIES(${LIBIDO_INCLUDE_PATH}) \ No newline at end of file diff --git a/lib/maracasVisuLib/include/Modules/MARACAS_Find_VTK.cmake b/lib/maracasVisuLib/include/Modules/MARACAS_Find_VTK.cmake new file mode 100644 index 0000000..0cf3c62 --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/MARACAS_Find_VTK.cmake @@ -0,0 +1,16 @@ +FIND_PATH( VTK_DIR vtkbin $ENV{VTK_PATH} ) + +FIND_PACKAGE(VTK) +IF(VTK_FOUND) + INCLUDE(${VTK_USE_FILE}) + INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIRS}) + set ( maracas_VTK_LIBRARIES + vtkCommon vtkFiltering vtkGraphics vtkIO vtkImaging + vtkRendering vtkHybrid vtkWidgets vtkVolumeRendering + ) + +ELSE(VTK_FOUND) + MESSAGE(FATAL_ERROR + "Cannot build MARACAS without VTK. Please set VTK_DIR.") +ENDIF(VTK_FOUND) + diff --git a/lib/maracasVisuLib/include/Modules/MARACAS_Find_WXWIDGETS.cmake b/lib/maracasVisuLib/include/Modules/MARACAS_Find_WXWIDGETS.cmake new file mode 100644 index 0000000..9ab329a --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/MARACAS_Find_WXWIDGETS.cmake @@ -0,0 +1,51 @@ + + +IF(WIN32) + + # WXWINDOWS_LIBRARY = full path to the wxWindows library and linker flags on unix + # CMAKE_WX_CXX_FLAGS = compiler flags for building wxWindows + # WXWINDOWS_INCLUDE_PATH = include path of wxWindows + SET(WXWINDOWS_USE_GL 1) #wxWidgets build related stuff + SET(WXW_USE_DEBUG ON ) + SET(WXW_USE_UNICODE OFF ) + SET(WXW_USE_SHARED ON ) + SET(WXW_USE_UNIV OFF ) + SET(WXW_USE_MONO OFF ) + SET(WXW_FILE_VERSION "28" ) + SET(WXW_VERSION "2.8" ) + + #CMake Options + SET(CMAKE_VERBOSE_MAKEFILE TRUE) + + INCLUDE (FindwxW) + # + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${WXWIDGETS_CXX_FLAGS}") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}${WXWIDGETS_EXE_LINKER_FLAGS}") + ADD_DEFINITIONS( ${WXWIDGETS_DEFINITIONS} ) + # + INCLUDE_DIRECTORIES(${WXWIDGETS_INCLUDE_DIR}) + LINK_DIRECTORIES( ${WXWIDGETS_LINK_DIRECTORIES} ) + SET(maracas_WXWIDGETS_LIBRARIES + ${WXWIDGETS_LIBRARIES} + wxmsw28d_aui + ) + + +ENDIF(WIN32) +IF(UNIX) + # GTK2 + FIND_PACKAGE(GTK2) + INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS}) + LINK_DIRECTORIES(${GTK2_LIBRARY_DIRS}) +# LINK_LIBRARIES(${GTK2_LIBRARIES}) + # WX + SET(wxWidgets_USE_LIBS base core gl) + FIND_PACKAGE( wxWidgets REQUIRED) + INCLUDE( ${wxWidgets_USE_FILE} ) + SET(maracas_WXWIDGETS_LIBRARIES + ${wxWidgets_LIBRARIES} + ${GTK2_LIBRARIES} + ) + +ENDIF(UNIX) + diff --git a/lib/maracasVisuLib/include/Modules/UseGDCM.cmake b/lib/maracasVisuLib/include/Modules/UseGDCM.cmake new file mode 100644 index 0000000..c673e9c --- /dev/null +++ b/lib/maracasVisuLib/include/Modules/UseGDCM.cmake @@ -0,0 +1,51 @@ +# +# This module is provided as GDCM_USE_FILE by GDCMConfig.cmake. +# It can be INCLUDEd in a project to load the needed compiler and linker +# settings to use GDCM: +# FIND_PACKAGE(GDCM REQUIRED) +# INCLUDE(${GDCM_USE_FILE}) +# + +IF(NOT GDCM_USE_FILE_INCLUDED) + SET(GDCM_USE_FILE_INCLUDED 1) + + # Load the compiler settings used for GDCM. + IF(GDCM_BUILD_SETTINGS_FILE) + INCLUDE(${CMAKE_ROOT}/Modules/CMakeImportBuildSettings.cmake) + CMAKE_IMPORT_BUILD_SETTINGS(${GDCM_BUILD_SETTINGS_FILE}) + ENDIF(GDCM_BUILD_SETTINGS_FILE) + + # Add compiler flags needed to use GDCM. + SET(CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} ${GDCM_REQUIRED_C_FLAGS}") + SET(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} ${GDCM_REQUIRED_CXX_FLAGS}") + SET(CMAKE_EXE_LINKER_FLAGS + "${CMAKE_EXE_LINKER_FLAGS} ${GDCM_REQUIRED_EXE_LINKER_FLAGS}") + SET(CMAKE_SHARED_LINKER_FLAGS + "${CMAKE_SHARED_LINKER_FLAGS} ${GDCM_REQUIRED_SHARED_LINKER_FLAGS}") + SET(CMAKE_MODULE_LINKER_FLAGS + "${CMAKE_MODULE_LINKER_FLAGS} ${GDCM_REQUIRED_MODULE_LINKER_FLAGS}") + + # Add include directories needed to use GDCM. + INCLUDE_DIRECTORIES( BEFORE ${GDCM_INCLUDE_DIRS}) + + # Add link directories needed to use GDCM. + LINK_DIRECTORIES(${GDCM_LIBRARY_DIRS}) + + # Add cmake module path. + SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${GDCM_CMAKE_DIR}") + + # Use VTK. + IF(GDCM_VTK) + SET(VTK_DIR ${GDCM_VTK_DIR}) + FIND_PACKAGE(VTK) + IF(VTK_FOUND) + INCLUDE(${VTK_USE_FILE}) + set(GDCM_LIBRARIES ${GDCM_LIBRARIES} " vtkgdcm" ) + ELSE(VTK_FOUND) + MESSAGE("VTK not found in GDCM_VTK_DIR=\"${GDCM_VTK_DIR}\".") + ENDIF(VTK_FOUND) + ENDIF(GDCM_VTK) + +ENDIF(NOT GDCM_USE_FILE_INCLUDED) diff --git a/lib/maracasVisuLib/include/mathdefs.h b/lib/maracasVisuLib/include/mathdefs.h new file mode 100644 index 0000000..47c9f5f --- /dev/null +++ b/lib/maracasVisuLib/include/mathdefs.h @@ -0,0 +1,70 @@ +//////////////////////////////////////////////////////////////////////////////// +// matrix.h +// Creation : 20/01/2000 +// Author : Leonardo FLOREZ VALENCIA +// l-florez@uniandes.edu.co +// lflorez@creatis.insa-lyon.fr +// Copyright (C) 2000-2002 Leonardo FLOREZ VALENCIA +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +//////////////////////////////////////////////////////////////////////////////// + +#ifndef GTMLIB__MATH__MATHDEFS__HXX +#define GTMLIB__MATH__MATHDEFS__HXX + +#include + +/// PI constant. +#define GTM_PI 3.14159265359 +/// 2 * PI constant. +#define GTM_PI2 6.28318530717 +/// ln1 constant. +#define GTM_NE 2.71828182846 + +/// Minimum. +#define GTM_MIN( a, b ) ( ( ( a ) < ( b ) )? ( a ): ( b ) ) +/// Maximum. +#define GTM_MAX( a, b ) ( ( ( a ) > ( b ) )? ( a ): ( b ) ) +#define GTM_POW2( a ) ( ( a ) * ( a ) ) + +// Useful typedefs. +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned int uint; + +namespace gtm +{ + + /** Rounds a double number. + * + * @param n Number. + */ + inline + double round( double n ) + { + double tmp; + tmp = floor( n ); + if ( ( n - tmp ) < 0.5 ) + return( tmp ); + else + return( ceil( n ) ); + + } + +} + +#endif // GTMLIB__MATH__MATHDEFS__HXX + +// EOF - mathdefs.h diff --git a/lib/maracasVisuLib/include/matrix.h b/lib/maracasVisuLib/include/matrix.h new file mode 100644 index 0000000..9689f59 --- /dev/null +++ b/lib/maracasVisuLib/include/matrix.h @@ -0,0 +1,431 @@ +//////////////////////////////////////////////////////////////////////////////// +// matrix.h +// Creation : 19/03/2000 +// Author : Leonardo FLOREZ VALENCIA +// l-florez@uniandes.edu.co +// lflorez@creatis.insa-lyon.fr +// Copyright (C) 2000-2002 Leonardo FLOREZ VALENCIA +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +//////////////////////////////////////////////////////////////////////////////// + +#ifndef GTMLIB__MATH__MATRIX__HXX +#define GTMLIB__MATH__MATRIX__HXX + +#include "mathdefs.h" +#include "vmfuncs.h" +#include "vector.h" + +namespace gtm +{ + /** TMatrix class. + * + * This class defines a C++ template to use mathematical matrices of NxM. + * @see TVector + */ + template< class T > + class TMatrix + { + public: + + /** Constructors. + * + * @param N Columns. + * @param M Rows. + * @param data Initial data. + * @param r Copy object (matrix or vector). + * @param block Memory block. + */ + //@{ + /// Default constructor. + TMatrix( uint N = 3, uint M = 3, T data = ( T )0 ); + /// Copy constructor. + TMatrix( const TMatrix< T >& r ); + /// ANSI casting constructor. + TMatrix( T** block, uint N, uint M ); + //@} + + /// Destructor. + ~TMatrix( ) { + MatrixFreeMemory< T >( _matrix, _N ); + }; + + /** Assignation operators. + * + * @param r Right object (matrix, vector or scalar). + */ + //@{ + /// Natural assignation. + TMatrix< T >& operator=( const TMatrix< T >& r ); + /// Vector assignation. + TMatrix< T >& operator=( TVector< T >& r ); + /// Scalar assignation. + TMatrix< T >& operator=( T r ); + //@} + + /** Comparation operators. + * + * @param Right matrix. + */ + //@{ + /// Equality. + bool operator==( const TMatrix< T >& r ); + /// Inequality. + bool operator!=( const TMatrix< T >& r ); + //@} + + /// Reference operator. + T& operator()( uint i, uint j ) { + return( _matrix[ i ][ j ] ); + }; + /// Columns + uint GetN( ) { + return( _N ); + }; + /// Rows + uint GetM( ) { + return( _M ); + }; + /// Returns the ANSI (C/C++) reference. + T** GetAnsiRef( ) { + return( _matrix ); + }; + /// Determinant. + T Det( ) { + return( MatrixDeterminant< T >( _matrix, _N ) ); + }; + /// Loads identity. + void LoadIdentity( ) { + MatrixLoadIdentity< T >( _matrix, GTM_MIN( _N, _M ) ); + }; + + /** Binary operators. + * + * @param r Right objet (matrix, vector or scalar). + */ + //@{ + /// Addition. + TMatrix< T > operator+( const TMatrix< T >& r ); + /// Substraction. + TMatrix< T > operator-( const TMatrix< T >& r ); + /// Product. + TMatrix< T > operator*( const TMatrix< T >& r ); + /// Product (vector). + TMatrix< T > operator*( TVector< T >& r ); + /// Scalar product + TMatrix< T > operator*( T r ); + //@} + + /** Self-assignation binary operators. + * + * @param r Right object (matrix, vector or scalar). + */ + //@{ + /// Addition. + TMatrix< T >& operator+=( const TMatrix< T >& r ) { + *this = *this + r; + return( *this ); + }; + /// Substraction. + TMatrix< T >& operator-=( const TMatrix< T >& r ) { + *this = *this - r; + return( *this ); + }; + /// Product. + TMatrix< T >& operator*=( const TMatrix< T >& r ) { + *this = *this * r; + return( *this ); + }; + /// Product (vector). + TMatrix< T >& operator*=( TVector< T >& r ) { + *this = *this * r; + return( *this ); + }; + /// Scalar product. + TMatrix< T >& operator*=( T r ) { + *this = *this * r; + return( *this ); + }; + //@} + + /** Unary operators. + */ + //@{ + /// Additive inverse. + TMatrix< T > operator-( ); + /// Matrix inverse. + TMatrix< T > operator!( ); + /// Matrix transpose. + TMatrix< T > operator~( ); + //@} + + private: + + /// Matrix' internal state. + //@{ + /// Memory block. + T** _matrix; + /// Columns. + uint _N; + /// Rows. + uint _M; + //@} + + }; + +// ----------------------------------------------------------------------------- + template< class T > + TVector< T >& TVector< T >::operator=( TMatrix< T >& r ) + { + uint i, j, k, min; + + // This min calc. avoids to reserve temporary memory, so, be careful. + min = GTM_MIN( r.GetN( ) * r.GetM( ), _N ); + _type = ( r.GetN( ) == 1 )? COL_VECTOR: ROW_VECTOR; + for( i = 0, k = 0; i < r.GetN( ) && k < min; i++ ) + for( j = 0; j < r.GetM( ) && k < min; _vector[ k++ ] = r( i, j ), j++ ); + return( *this ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TMatrix< T > TVector< T >::operator*( TMatrix< T >& r ) + { + TMatrix< T > m = *this; + return( m * r ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TMatrix< T >::TMatrix( uint N, uint M, T data ) + { + _N = N; + _M = M; + _matrix = MatrixAllocateMemory< T >( _N, _M ); + MatrixAssignScalar< T >( _matrix, data, _N, _M ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TMatrix< T >::TMatrix( const TMatrix< T >& r ) + { + _N = r._N; + _M = r._M; + _matrix = MatrixCopyMemory< T >( r._matrix, _N, _M ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TMatrix< T >::TMatrix( T** block, uint N, uint M ) + { + _N = N; + _M = M; + _matrix = MatrixCopyMemory< T >( block, N, M ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TMatrix< T >& TMatrix< T >::operator=( const TMatrix< T >& r ) + { + if( _N != r._N || _M != r._M ) { + + MatrixFreeMemory< T >( _matrix, _N ); + _N = r._N; + _M = r._M; + _matrix = MatrixCopyMemory< T >( r._matrix, _N, _M ); + + } else MatrixAssignMemory< T >( _matrix, r._matrix, _N, _M ); + return( *this ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TMatrix< T >& TMatrix< T >::operator=( TVector< T >& r ) + { + uint i; + uint n = r.GetN( ); + bool column = ( r.GetType( ) == COL_VECTOR ); + + MatrixFreeMemory< T >( _matrix, _N ); + _N = ( column )? 1: n; + _M = ( column )? n: 1; + _matrix = MatrixAllocateMemory< T >( _N, _M ); + for( i = 0; i < n; _matrix[ ( column )? 0: i ][ ( column )? i: 0 ] = r( i ), i++ ); + return( *this ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TMatrix< T >& TMatrix< T >::operator=( T r ) + { + MatrixAssignScalar< T >( _matrix, r, _N, _M ); + return( *this ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + bool TMatrix< T >::operator==( const TMatrix< T >& r ) + { + uint i, j; + bool ret; + + for( + i = 0, ret = ( _N == r._N && _M == r._M ); + i < _N && ret; + i++ + ) for( + j = 0; + j < _M && ret; + ret &= ( _matrix[ i ][ j ] == r._matrix[ i ][ j ] ), j++ + ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + bool TMatrix< T >::operator!=( const TMatrix< T >& r ) + { + uint i, j; + bool ret; + + for( + i = 0, ret = ( _N != r._N || _M != r._M ); + i < _N && !ret; + i++ + ) for( + j = 0; + j < _M && !ret; + ret |= ( _matrix[ i ][ j ] != r._matrix[ i ][ j ] ), j++ + ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TMatrix< T > TMatrix< T >::operator+( const TMatrix< T >& r ) + { + TMatrix< T > ret( _N, _M ); + + MatrixAdd< T >( + ret._matrix, + _matrix, + r._matrix, + GTM_MIN( _N, r._N ), + GTM_MIN( _M, r._M ) + ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TMatrix< T > TMatrix< T >::operator-( const TMatrix< T >& r ) + { + TMatrix< T > ret( _N, _M ); + + MatrixSubtract< T >( + ret._matrix, + _matrix, + r._matrix, + GTM_MIN( _N, r._N ), + GTM_MIN( _M, r._M ) + ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TMatrix< T > TMatrix< T >::operator*( const TMatrix< T >& r ) + { + TMatrix< T > ret( r._N, _M ); + + MatrixProduct< T >( ret._matrix, _matrix, r._matrix, _N, _M, r._N ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TMatrix< T > TMatrix< T >::operator*( T r ) + { + TMatrix< T > ret( _N, _M ); + + MatrixScalarProduct< T >( ret._matrix, _matrix, r, _N, _M ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TMatrix< T > TMatrix< T >::operator*( TVector< T >& r ) + { + TMatrix< T > m; + m = r; + return( *this * m ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TMatrix< T > TMatrix< T >::operator-( ) + { + TMatrix< T > ret( _N, _M ); + uint i, j; + + for( i = 0; i < _N; i++ ) + for( j = 0; j < _M; ret._matrix[ i ][ j ] = ( T )0 - _matrix[ i ][ j ], j++ ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TMatrix< T > TMatrix< T >::operator!( ) + { + TMatrix< T > ret( _N, _N ); + + if( _N <= 4 ) MatrixInverseAdjoint< T >( ret._matrix, _matrix, _N ); + else MatrixInverseGauss< T >( ret._matrix, _matrix, _N ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TMatrix< T > TMatrix< T >::operator~( ) + { + TMatrix< T > ret( _M, _N ); + + MatrixTranspose< T >( ret._matrix, _matrix, _N, _M ); + return( ret ); + + } + +} // namespace + +#endif // GTMLIB__MATH__MATRIX__HXX + +// EOF - matrix.h diff --git a/lib/maracasVisuLib/include/vector.h b/lib/maracasVisuLib/include/vector.h new file mode 100644 index 0000000..edadd11 --- /dev/null +++ b/lib/maracasVisuLib/include/vector.h @@ -0,0 +1,382 @@ +//////////////////////////////////////////////////////////////////////////////// +// vector.h +// Creation : 24/02/2000 +// Author : Leonardo FLOREZ VALENCIA +// l-florez@uniandes.edu.co +// lflorez@creatis.insa-lyon.fr +// Copyright (C) 2000-2002 Leonardo FLOREZ VALENCIA +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +//////////////////////////////////////////////////////////////////////////////// + +#ifndef GTMLIB__MATH__VECTOR__HXX +#define GTMLIB__MATH__VECTOR__HXX + +#include "mathdefs.h" +#include "vmfuncs.h" + +/// Vector type IDs +//@{ +#define ROW_VECTOR 0x01 +#define COL_VECTOR 0x02 +//@} + +namespace gtm +{ + template< class T > + class TMatrix; + + /** TVector class. + * + * This class defines a C++ template to use mathematical vectors + * in a N space. + * @see TMatrix + */ + template< class T > + class TVector + { + public: + + /** Contructors. + * + * @param N Cardinality. + * @param data Initial data. + * @param type Vector type (ROW_VECTOR/COL_VECTOR). + * @param r Right object (vector or matrix). + * @param block ANSI array. + * @param copy Make a copy of given array? + */ + //@{ + /// Default constructor. + TVector( uint N = 3, T data = ( T )0, int type = COL_VECTOR ); + /// Copy constructor. + TVector( const TVector< T >& r ); + /// Use this to treat an ANSI array as a TVector. + TVector( T* block, uint N, bool copy = true, int type = COL_VECTOR ); + //@} + + /// Destructor. + ~TVector( ) { + if( _myMemory ) VectorFreeMemory< T >( _vector ); + }; + + /// Size change + void SetN( uint N ); + + /** Assignation operators. + * + * @param r Right object (vector or matrix). + */ + //@{ + /// Vector assignation. + TVector< T >& operator=( const TVector< T >& r ); + /// Matrix assignation (defined in class TMatrix). + TVector< T >& operator=( TMatrix< T >& r ); + /// ANSI assignation (r size must be, at least, N). + TVector< T >& operator=( T* r ) { + VectorAssignMemory< T >( _vector, r, _N ); + return( *this ); + }; + /// Scalar assignation. + TVector< T >& operator=( T r ) { + VectorAssignScalar< T >( _vector, r, _N ); + return( *this ); + }; + //@} + + /** Comparation operators. + * + * @param r Right object. + */ + //@{ + /// Equality. + bool operator==( const TVector< T >& r ); + /// Inequality. + bool operator!=( const TVector< T >& r ); + //@} + + /// Reference operator. + T& operator()( uint i ) { + return( _vector[ i ] ); + }; + /// ANSI (C/C++ array) reference. + T* GetAnsiRef( ) { + return( _vector ); + }; + /// Vector's cardinality. + uint GetN( ) { + return( _N ); + }; + /// Vector's type (ROW_VECTOR/COL_VECTOR). + int GetType( ) { + return( _type ); + }; + /// Mathematical norm (L2). + T GetNorm( ) { + return( VectorNorm< T >( _vector, _N ) ); + }; + /// Normalizes the vector. + void Normalize( ) { + VectorNormalize< T >( _vector, _vector, _N ); + }; + /// Dot product. + T Dot( const TVector< T >& r ) { + return( VectorDotProduct< T >( _vector, r._vector, GTM_MIN( _N, r._N ) ) ); + }; + + /** Binary operators. + * + * @param r Right object (vector, matrix or scalar). + */ + //@{ + /// Addition. + TVector< T > operator+( const TVector< T >& r ); + /// Substraction. + TVector< T > operator-( const TVector< T >& r ); + /// Cross product. + TVector< T > operator*( const TVector< T >& r ); + /// Matrix product (defined in class TMatrix). + TMatrix< T > operator*( TMatrix< T >& r ); + /// Scalar product. + TVector< T > operator*( T r ); + //@} + + /** Self-assignation binary operators. + * + * @param r Right object (vector, matrix or scalar). + */ + //@{ + /// Addition. + TVector< T >& operator+=( const TVector< T >& r ) { + *this = *this + r; + return( *this ); + }; + /// Substraction. + TVector< T >& operator-=( const TVector< T >& r ) { + *this = *this - r; + return( *this ); + }; + /// Cross product. + TVector< T >& operator*=( const TVector< T >& r ) { + *this = *this * r; + return( *this ); + }; + /// Scalar product. + TVector< T >& operator*=( T r ) { + *this = *this * r; + return( *this ); + }; + //@} + + /// Unary operators. + //@{ + /// Additive inverse. + TVector< T > operator-( ); + /// Normalized vector. + TVector< T > operator!( ); + /// Transposed vector. + TVector< T > operator~( ); + //@} + + private: + + /// Vector's internal state. + //@{ + /// Memory block. + T* _vector; + /// Cardinality. + uint _N; + /// Type (ROW_VECTOR/COL_VECTOR). + int _type; + /// Have I created _vector? + bool _myMemory; + //@} + + }; + +// ----------------------------------------------------------------------------- + template< class T > + TVector< T >::TVector( uint N, T data, int type ) + { + _N = N; + _type = type; + _vector = VectorAllocateMemory< T >( _N ); + _myMemory = true; + VectorAssignScalar< T >( _vector, data, _N ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TVector< T >::TVector( const TVector< T >& r ) + { + _N = r._N; + _type = r._type; + _myMemory = true; + _vector = VectorCopyMemory< T >( r._vector, _N ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TVector< T >::TVector( T* block, uint N, bool copy, int type ) + { + _N = N; + _type = type; + _myMemory = copy; + _vector = ( copy )? VectorCopyMemory< T >( block, _N ): block; + + } + +// ----------------------------------------------------------------------------- + template< class T > + void TVector< T >::SetN( uint N ) + { + if( _myMemory ) VectorFreeMemory< T >( _vector ); + _N = N; + _vector = VectorAllocateMemory< T >( _N ); + _myMemory = true; + VectorAssignScalar< T >( _vector, ( T )0, _N ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TVector< T >& TVector< T >::operator=( const TVector< T >& r ) + { + /* + * Only assigns the minimum cardinality (WARNING WITH NON-LOCAL MEMORY). + */ + _type = r._type; + VectorAssignMemory< T >( _vector, r._vector, GTM_MIN( _N, r._N ) ); + return( *this ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + bool TVector< T >::operator==( const TVector< T >& r ) + { + uint i; + bool ret; + + for( + i = 0, ret = ( _N == r._N ); + i < _N && ret; + ret &= ( _vector[ i ] == r._vector[ i ] ), i++ + ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + bool TVector< T >::operator!=( const TVector< T >& r ) + { + uint i; + bool ret; + + for( + i = 0, ret = ( _N != r._N ); + i < _N && !ret; + ret |= ( _vector[ i ] != r._vector[ i ] ), i++ + ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TVector< T > TVector< T >::operator+( const TVector< T >& r ) + { + TVector< T > ret( GTM_MIN( _N, r._N ) ); + + VectorAdd< T >( ret._vector, _vector, r._vector, GTM_MIN( _N, r._N ) ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TVector< T > TVector< T >::operator-( const TVector< T >& r ) + { + TVector< T > ret( GTM_MIN( _N, r._N ) ); + + VectorSubtract< T >( ret._vector, _vector, r._vector, GTM_MIN( _N, r._N ) ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TVector< T > TVector< T >::operator*( const TVector< T >& r ) + { + TVector< T > ret( GTM_MIN( _N, r._N ) ); + + VectorCrossProduct< T >( ret._vector, _vector, r._vector ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TVector< T > TVector< T >::operator*( T r ) + { + TVector< T > ret( _N ); + + VectorScalarProduct< T >( ret._vector, _vector, r, _N ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TVector< T > TVector< T >::operator-( ) + { + TVector< T > ret( _N ); + uint i; + + for( i = 0; i < _N; ret._vector[ i ] = ( T )0 - _vector[ i ], i++ ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TVector< T > TVector< T >::operator!( ) + { + TVector< T > ret( _N ); + + VectorNormalize< T >( ret._vector, _vector, _N ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + template< class T > + TVector< T > TVector< T >::operator~( ) + { + TVector< T > ret = *this; + + ret._type = ( _type == COL_VECTOR )? ROW_VECTOR: COL_VECTOR; + return( ret ); + + } + +} // namespace + +#endif // GTMLIB__MATH__VECTOR__HXX + +// EOF - vector.h diff --git a/lib/maracasVisuLib/include/vmfuncs.h b/lib/maracasVisuLib/include/vmfuncs.h new file mode 100644 index 0000000..976cd2c --- /dev/null +++ b/lib/maracasVisuLib/include/vmfuncs.h @@ -0,0 +1,733 @@ +//////////////////////////////////////////////////////////////////////////////// +// vmfuncs.h +// Creation : 02/02/2000 +// Author : Leonardo FLOREZ VALENCIA +// l-florez@uniandes.edu.co +// lflorez@creatis.insa-lyon.fr +// Copyright (C) 2000-2002 Leonardo FLOREZ VALENCIA +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +//////////////////////////////////////////////////////////////////////////////// + +#ifndef GTMLIB__MATH__VMFUNCS__HXX +#define GTMLIB__MATH__VMFUNCS__HXX + +#include +#include +#include +#include "mathdefs.h" + +using namespace std; + +namespace gtm +{ +// ----------------------------------------------------------------------------- +// +/// Functions for vectors. +//@{ +// ----------------------------------------------------------------------------- + /** Stream out function for vectors. + * + * @param o Output stream. + * @param v ANSI array. + * @param n Cardinality. + * @param col Should I print it in column format? + */ + template< class T > + inline + void VectorPrint( std::ostream& o, T* v, uint n, bool col ) + { + uint i; + + o << n << ": ["; + if( col ) o << endl; + else o << " "; + for( uint i = 0; i < n; i++ ) { + + o << v[ i ]; + if( col ) o << endl; + else o << " "; + + } // rof + o << "]" << endl; + + } + +// ----------------------------------------------------------------------------- + /** Allocation function. + * + * @param n Cardinality. + */ + template< class T > + inline + T* VectorAllocateMemory( uint n ) + { + T* v = new T[ n ]; + + memset( v, 0, sizeof( T ) * n ); + return( v ); + + } + +// ----------------------------------------------------------------------------- + /** Frees vector's memory. + * + * @param v Vector. + */ + template< class T > + inline + void VectorFreeMemory( T* v ) + { + if( v ) delete [] v; + + } + +// ----------------------------------------------------------------------------- + /** Copy. + * + * @param v Target vector. + * @param v_o Source vector. + * @param n Cardinality. + */ + template< class T > + inline + void VectorAssignMemory( T* v, T* v_o, uint n ) + { + memcpy( v, v_o, sizeof( T ) * n ); + + } + +// ----------------------------------------------------------------------------- + /** Allocation & copy. + * + * @param v Vector to be copied. + * @param n Cardinality. + */ + template< class T > + inline + T* VectorCopyMemory( T* v, uint n ) + { + T* n_v = VectorAllocateMemory< T >( n ); + VectorAssignMemory< T >( n_v, v, n ); + return( n_v ); + + } + +// ----------------------------------------------------------------------------- + /** Scalar assignation. + * + * @param v Vector. + * @param s Scalar value. + * @param n Cardinality. + */ + template< class T > + inline + void VectorAssignScalar( T* v, T s, uint n ) + { + uint i; + + for( i = 0; i < n; v[ i ] = s, i++ ); + + } + +// ----------------------------------------------------------------------------- + /** Convert a vector in a matrix. + * + * @param ma Matrix. + * @param v Vector. + * @param n Columns. + * @param m Rows. + * @param col Is it a column vector? + */ + template< class T > + inline + void VectorMatrixCast( T** ma, T* v, uint n, uint m, bool col ) + { + uint i; + + for( i = 0; i < ( ( col )? m: n ); i++ ) + ma[ ( col )? n: i ][ ( col )? i: m ] = v[ i ]; + + } + +// ----------------------------------------------------------------------------- + /** Performs a vectorial addition. + * + * @param v Result. + * @param v_l Left operand. + * @param v_r Right operand. + * @param n Cardinality. + */ + template< class T > + inline + void VectorAdd( T* v, T* v_l, T* v_r, uint n ) + { + uint i; + + for( i = 0; i < n; v[ i ] = v_l[ i ] + v_r[ i ], i++ ); + + } + +// ----------------------------------------------------------------------------- + /** Performs a vectorial substraction. + * + * @param v Result. + * @param v_l Left operand. + * @param v_r Right operand. + * @param n Cardinality. + */ + template< class T > + inline + void VectorSubtract( T* v, T* v_l, T* v_r, uint n ) + { + uint i; + + for( i = 0; i < n; v[ i ] = v_l[ i ] - v_r[ i ], i++ ); + + } + +// ----------------------------------------------------------------------------- + /** Performs a vectorial cross product. + * + * @param v Result. + * @param v_l Left operand. + * @param v_r Right operand. + */ + template< class T > + inline + void VectorCrossProduct( T* v, T* v_l, T* v_r ) + { + v[ 0 ] = ( v_l[ 1 ] * v_r[ 2 ] ) - ( v_l[ 2 ] * v_r[ 1 ] ); + v[ 1 ] = ( v_l[ 2 ] * v_r[ 0 ] ) - ( v_l[ 0 ] * v_r[ 2 ] ); + v[ 2 ] = ( v_l[ 0 ] * v_r[ 1 ] ) - ( v_l[ 1 ] * v_r[ 0 ] ); + + } + +// ----------------------------------------------------------------------------- + /** Performs a vectorial dot product. + * + * @param v_l Left operand. + * @param v_r Right operand. + * @param n Cardinality. + * @return Dot product. + */ + template< class T > + inline + T VectorDotProduct( T* v_l, T* v_r, uint n ) + { + T ret; + uint i; + + for( i = 0, ret = ( T )0; i < n; ret = ret + ( v_l[ i ] * v_r[ i ] ), i++ ); + return( ret ); + + } + +// ----------------------------------------------------------------------------- + /** Performs a vector-scalar product. + * + * @param v Result. + * @param v_l Left operand. + * @param s Scalar. + * @param n Cardinality. + */ + template< class T > + inline + void VectorScalarProduct( T* v, T* v_l, T s, uint n ) + { + uint i; + + for( i = 0; i < n; v[ i ] = v_l[ i ] * s, i++ ); + + } + +// ----------------------------------------------------------------------------- + /** Calculates vectorial L2 norm. + * + * @param v Vector. + * @param n Cardinality. + */ + template< class T > + inline + T VectorNorm( T* v, uint n ) + { + return( ( T )( sqrt( ( double )( VectorDotProduct< T >( v, v, n ) ) ) ) ); + + } + +// ----------------------------------------------------------------------------- + /** Calculates a normal vector, usign the L2 norm. + * + * @param v Result. + * @param v_o Original vector. + * @param n Cardinality. + */ + template< class T > + inline + void VectorNormalize( T* v, T* v_o, uint n ) + { + uint i; + T norm = VectorNorm< T >( v_o, n ); + + norm = ( norm == ( T )0 )? ( T )1: norm; + for( i = 0; i < n; v[ i ] = v_o[ i ] / norm, i++ ); + + } + +// ----------------------------------------------------------------------------- +//@} +/// Functions for matrices. +//@{ +// ----------------------------------------------------------------------------- + /** Stream out function for matrices. + * + * @param o Output stream. + * @param ma Matrix. + * @param n Columns. + * @param m Rows. + */ + template< class T > + inline + void MatrixPrint( std::ostream& o, T** ma, uint n, uint m ) + { + uint i, j; + + o << n << " x " << m << endl; + for( j = 0; j < m; j++ ) { + + for( i = 0; i < n; o << ma[ i ][ j ] << " ", i++ ); + o << endl; + + } // rof + + } + +// ----------------------------------------------------------------------------- + /** Allocates memory for a matrix. + * + * @param n Columns. + * @param m Rows. + */ + template< class T > + inline + T** MatrixAllocateMemory( uint n, uint m ) + { + uint i; + T** ma = new T*[ n ]; + + for( i = 0; i < n; i++ ) { + + ma[ i ] = new T[ m ]; + memset( ma[ i ], 0, sizeof( T ) * m ); + + } // rof + return( ma ); + + } + +// ----------------------------------------------------------------------------- + /** Copies. + * + * @param ma Target matrix. + * @param ma_o Source matrix. + * @param n Columns. + * @param m Rows. + */ + template< class T > + inline + void MatrixAssignMemory( T** ma, T** ma_o, uint n, uint m ) + { + uint i; + + for( i = 0; i < n; i++ ) + memcpy( ma[ i ], ma_o[ i ], sizeof( T ) * m ); + + } + +// ----------------------------------------------------------------------------- + /** Allocates & copies. + * + * @param ma Matrix. + * @param n Columns. + * @param m Rows. + */ + template< class T > + inline + T** MatrixCopyMemory( T** ma, uint n, uint m ) + { + T** n_ma = MatrixAllocateMemory< T >( n, m ); + MatrixAssignMemory< T >( n_ma, ma, n, m ); + return( n_ma ); + + } + +// ----------------------------------------------------------------------------- + /** Scalar assignation. + * + * @param ma Matrix. + * @param s Scalar. + * @param n Columns. + * @param m Rows. + */ + template< class T > + inline + void MatrixAssignScalar( T** ma, T s, uint n, uint m ) + { + uint i, j; + + for( i = 0; i < n; i++ ) + for( j = 0; j < m; j++ ) + ma[ i ][ j ] = s; + + } + +// ----------------------------------------------------------------------------- + /** Converts a matrix in a vector. + * + * @param v Vector. + * @param ma Matrix. + * @param n Columns. + * @param m Rows. + * @param col Convert to a column vector? + */ + template< class T > + inline + void MatrixVectorCast( T* v, T** ma, uint n, uint m, bool col ) + { + uint i; + + for( i = 0; i < ( ( col )? m: n ); i++ ) + v[ i ] = ma[ ( col )? n: i ][ ( col )? i: m ]; + + } + +// ----------------------------------------------------------------------------- + /** Frees matrix memory. + * + * @param ma Matrix. + * @param n Columns. + */ + template< class T > + inline + void MatrixFreeMemory( T** ma, uint n ) + { + uint i; + + if( ma ) { + + for( i = 0; i < n; i++ ) + if( ma[ i ] ) delete [] ma[ i ]; + delete [] ma; + + } // fi + + } + +// ----------------------------------------------------------------------------- + /** Performs a matricial addition. + * + * @param ma Result. + * @param ma_l Left operand. + * @param ma_r Right operand. + * @param n Columns. + * @param m Rows. + */ + template< class T > + inline + void MatrixAdd( T** ma, T** ma_l, T** ma_r, uint n, uint m ) + { + uint i, j; + + for( i = 0; i < n; i++ ) + for( j = 0; j < m; ma[ i ][ j ] = ma_l[ i ][ j ] + ma_r[ i ][ j ], j++ ); + + } + +// ----------------------------------------------------------------------------- + /** Performs a matricial substraction. + * + * @param ma Result. + * @param ma_l Left operand. + * @param ma_r Right operand. + * @param n Columns. + * @param m Rows. + */ + template< class T > + inline + void MatrixSubtract( T** ma, T** ma_l, T** ma_r, uint n, uint m ) + { + uint i, j; + + for( i = 0; i < n; i++ ) + for( j = 0; j < m; ma[ i ][ j ] = ma_l[ i ][ j ] - ma_r[ i ][ j ], j++ ); + + } + +// ----------------------------------------------------------------------------- + /** Performs a matricial product. + * + * @param ma Result. + * @param ma_l Left operand. + * @param ma_r Right operand. + * @param n Left columns. + * @param m Left rows/right columns. + * @param nr Right columns. + */ + template< class T > + inline + void MatrixProduct( T** ma, T** ma_l, T** ma_r, uint n, uint m, uint nr ) + { + unsigned i, j, k; + + for( i = 0; i < nr; i++ ) + for( j = 0; j < m; j++ ) + for( + k = 0, ma[ i ][ j ] = ( T )0; + k < n; + ma[ i ][ j ] = ma[ i ][ j ] + ( ma_l[ k ][ j ] * ma_r[ i ][ k ] ), k++ + ); + + } + +// ----------------------------------------------------------------------------- + /** Performs a scalar-matrix product. + * + * @param ma Result. + * @param ma_l Left operand. + * @param s Scalar. + * @param n Columns. + * @param m Rows. + */ + template< class T > + inline + void MatrixScalarProduct( T** ma, T** ma_l, T s, uint n, uint m ) + { + uint i, j; + + for( i = 0; i < n; i++ ) + for( j = 0; j < m; ma[ i ][ j ] = ma_l[ i ][ j ] * s, j++ ); + + } + +// ----------------------------------------------------------------------------- + /** Gets the matrix cofactor. + * + * @param ma Result. + * @param ma_o Matrix. + * @param i Column index. + * @param j Row index. + * @param n Columns. + * @param m Rows. + */ + template< class T > + inline + void MatrixCofactor( T** ma, T** ma_o, uint i, uint j, uint n, uint m ) + { + uint k, l; + + for( k = 0; k < i; k++ ) { + + for( l = 0; l < j; l++ ) ma[ k ][ l ] = ma_o[ k ][ l ]; + for( l = j + 1; l < m; l++ ) ma[ k ][ l - 1 ] = ma_o[ k ][ l ]; + + } // rof + + for( k = i + 1; k < n; k++ ) { + + for( l = 0; l < j; l++ ) ma[ k - 1 ][ l ] = ma_o[ k ][ l ]; + for( l = j + 1; l < m; l++ ) ma[ k - 1 ][ l - 1 ] = ma_o[ k ][ l ]; + + } // rof + + } + +// ----------------------------------------------------------------------------- + /** Gets the matrix determinant (square matrices only). + * + * @param ma Matrix. + * @param n Dimension. + */ + template< class T > + inline + T MatrixDeterminant( T** ma, uint n ) + { + uint k; + T** tmp = NULL; + T ret = ( T )0, c; + + // All these cases are for speed-up calculations. + if( n == 1 ) { + + ret = ma[ 0 ][ 0 ]; + + } else if( n == 2 ) { + + ret = + ( ma[ 0 ][ 0 ] * ma[ 1 ][ 1 ] ) - + ( ma[ 1 ][ 0 ] * ma[ 0 ][ 1 ] ); + + } else if( n == 3 ) { + + ret = + ( ma[ 0 ][ 0 ] * ma[ 1 ][ 1 ] * ma[ 2 ][ 2 ] ) - + ( ma[ 0 ][ 0 ] * ma[ 2 ][ 1 ] * ma[ 1 ][ 2 ] ) - + ( ma[ 1 ][ 0 ] * ma[ 0 ][ 1 ] * ma[ 2 ][ 2 ] ) + + ( ma[ 1 ][ 0 ] * ma[ 2 ][ 1 ] * ma[ 0 ][ 2 ] ) + + ( ma[ 2 ][ 0 ] * ma[ 0 ][ 1 ] * ma[ 1 ][ 2 ] ) - + ( ma[ 2 ][ 0 ] * ma[ 1 ][ 1 ] * ma[ 0 ][ 2 ] ); + + } else { + + tmp = MatrixAllocateMemory< T >( n - 1, n - 1 ); + for( k = 0, c = ( T )1, ret = ( T )0; k < n; k++ ) { + + MatrixCofactor< T >( tmp, ma, k, 0, n, n ); + ret = ret + ( c * ( ma[ k ][ 0 ] * MatrixDeterminant< T >( tmp, n - 1 ) ) ); + c = c * ( T )( 0 - 1 ); + + } // rof + MatrixFreeMemory< T >( tmp, n - 1 ); + + } // fi + return( ret ); + + } + +// ----------------------------------------------------------------------------- + /** Calculates the inverse using the adjoint method (only square matrices). + * + * @param ma Result. + * @param ma_o Matrix. + * @param n Dimension. + */ + template< class T > + inline + void MatrixInverseAdjoint( T** ma, T** ma_o, uint n ) + { + uint i, j; + T** tmp; + T c; + + tmp = MatrixAllocateMemory< T >( n - 1, n - 1 ); + for( i = 0; i < n; i++ ) { + + for( j = 0; j < n; j++ ) { + + c = ( ( i + j ) % 2 == 0 )? ( T )1: ( T )( 0 - 1 ); + MatrixCofactor< T >( tmp, ma_o, i, j, n, n ); + ma[ j ][ i ] = c * MatrixDeterminant< T >( tmp, n - 1 ); + + } // rof + + } // rof + MatrixFreeMemory< T >( tmp, n - 1 ); + + c = ( T )1 / MatrixDeterminant< T >( ma_o, n ); + MatrixScalarProduct< T >( ma, ma, c, n, n ); + + } + +// ----------------------------------------------------------------------------- + /** Calculates the inverse using the gauss method (only square matrices). + * + * @param ma Result. + * @param ma_o Matrix. + * @param n Dimension. + * @warning Adapted from a java-implementation: http://www.nauticom.net/www/jdtaft/JavaMatrix.htm + */ + template< class T > + inline + void MatrixInverseGauss( T** ma, T** ma_o, uint n ) + { + uint i, j, k, n2 = 2 * n; + T** ma_a = MatrixAllocateMemory< T >( n2, n ); + T a, b; + + // Augmented matrix initialization + for( i = 0; i < n; i++ ) + for( j = 0; j < n; ma_a[ i ][ j ] = ma_o[ i ][ j ], j++ ); + for( i = n; i < n2; i++ ) + for( j = 0; j < n; ma_a[ i ][ j ] = ( i - n == j )? ( T )1: ( T )0, j++ ); + + // Reduction + for( j = 0; j < n; j++ ) { + + a = ma_a[ j ][ j ]; + if( a != 0 ) for( i = 0; i < n2; ma_a[ i ][ j ] = ma_a[ i ][ j ] / a, i++ ); + for( k = 0; k < n; k++ ) { + + if( ( k - j ) != 0 ) { + + b = ma_a[ j ][ k ]; + for( + i = 0; + i < n2; + ma_a[ i ][ k ] = ma_a[ i ][ k ] - ( b * ma_a[ i ][ j ] ), i++ + ); + + } // fi + + } // rof + + } // rof + + // Result assignation + MatrixAssignMemory< T >( ma, ma_a, n, n ); + MatrixFreeMemory< T >( ma_a, n2 ); + + } + +// ----------------------------------------------------------------------------- + /** Gets the transpose matrix. + * + * @param ma Matrix result. + * @param ma_o Matrix. + * @param n Columns. + * @param m Rows. + */ + template< class T > + inline + void MatrixTranspose( T** ma, T** ma_o, uint n, uint m ) + { + uint i, j; + + for( i = 0; i < m; i++ ) + for( j = 0; j < n; ma[ i ][ j ] = ma_o[ j ][ i ], j++ ); + + } + +// ----------------------------------------------------------------------------- + /** Load a square matrix with the identity. + * + * @param ma Matrix. + * @param n Dimension. + */ + template< class T > + inline + void MatrixLoadIdentity( T** ma, uint n ) + { + uint i, j; + + for( i = 0; i < n; i++ ) + for( j = 0; j < n; ma[ i ][ j ] = ( i == j )? ( T )1: ( T )0, j++ ); + + } + +} +//@} + +#endif // GTMLIB__MATH__VMFUNCS__HXX + +// EOF - vmfuncs.h diff --git a/lib/maracasVisuLib/src/CMakeLists.txt b/lib/maracasVisuLib/src/CMakeLists.txt new file mode 100644 index 0000000..d3ac9a1 --- /dev/null +++ b/lib/maracasVisuLib/src/CMakeLists.txt @@ -0,0 +1,5 @@ +SUBDIRS( +#SnakeIsoContour+Deriche +#kernel +#interface +) diff --git a/lib/maracasVisuLib/src/CMakeListsWorking.txt b/lib/maracasVisuLib/src/CMakeListsWorking.txt new file mode 100644 index 0000000..9e8488a --- /dev/null +++ b/lib/maracasVisuLib/src/CMakeListsWorking.txt @@ -0,0 +1,5 @@ +SUBDIRS( +SnakeIsoContour+Deriche +kernel +interface +) diff --git a/lib/maracasVisuLib/src/interface/CMakeLists.txt b/lib/maracasVisuLib/src/interface/CMakeLists.txt new file mode 100644 index 0000000..be0a96d --- /dev/null +++ b/lib/maracasVisuLib/src/interface/CMakeLists.txt @@ -0,0 +1 @@ +SUBDIRS(wxWindows) diff --git a/lib/maracasVisuLib/src/interface/tcl/Makefile.am b/lib/maracasVisuLib/src/interface/tcl/Makefile.am new file mode 100644 index 0000000..4e7d439 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/tcl/Makefile.am @@ -0,0 +1,43 @@ +## Makefile.am -- Process this file with automake to produce Makefile.in + +SUBDIRS = tkwidgets to_change windows + +lib_LTLIBRARIES = libmarTcl.la + +INCLUDES = \ + $(VTK_CFLAGS) $(IDO_CFLAGS) \ + $(WX_CFLAGS) $(GSL_CFLAGS) $(KGFO_CFLAGS) \ + -I$(TCL_INC_DIR) -I$(TK_INC_DIR) \ + -I../include +libmarTcl_la_SOURCES = marTclInterface.h wrap_maracas.cxx +libmarTcl_la_LDFLAGS = \ + -version-info $(MARACAS_TCL_VER) \ + $(VTK_LIBS) -lvtkCommonTCL \ + $(IDO_LIBS) $(WX_LIBS) \ + $(TCLTK_LIBS) \ + $(GSL_LIBS) $(KGFO_LIBS) + +libmarTcl_la_LIBADD = ../kernel/libmarKernel.la + +EXTRA_DIST = tclexe.dsp \ + wrap_maracas.i \ + maracas_start.tcl \ + general.tcl \ + string_table.tcl + +# Special compilation commands +wrap_maracas.cxx: wrap_maracas.i + swig -tcl8 -c++ -o wrap_maracas.cxx wrap_maracas.i + +# Special targets +maracas.tcl : + echo "#!/usr/bin/wish" > maracas.tcl + echo "" >> maracas.tcl + echo "load $(libdir)/libmarTcl.so maracas" >> maracas.tcl + echo "source ./maracas_start.tcl" >> maracas.tcl + echo "" >> maracas.tcl + echo "# eof - maracas.tcl" >> maracas.tcl + echo "" >> maracas.tcl + chmod +x maracas.tcl + +## eof - Makefile.am \ No newline at end of file diff --git a/lib/maracasVisuLib/src/interface/tcl/Makefile.in b/lib/maracasVisuLib/src/interface/tcl/Makefile.in new file mode 100644 index 0000000..a8f0538 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/tcl/Makefile.in @@ -0,0 +1,517 @@ +# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AS = @AS@ +CC = @CC@ +CFLAGS_DEBUG = @CFLAGS_DEBUG@ +CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@ +CFLAGS_WARNING = @CFLAGS_WARNING@ +CPP = @CPP@ +CXX = @CXX@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +GSL_CFLAGS = @GSL_CFLAGS@ +GSL_CONFIG = @GSL_CONFIG@ +GSL_LIBS = @GSL_LIBS@ +IDO_CFLAGS = @IDO_CFLAGS@ +IDO_LIBS = @IDO_LIBS@ +KGFO_CFLAGS = @KGFO_CFLAGS@ +KGFO_CONFIG = @KGFO_CONFIG@ +KGFO_LIBS = @KGFO_LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +MAKEINFO = @MAKEINFO@ +MARACAS_ALGORITHM_VER = @MARACAS_ALGORITHM_VER@ +MARACAS_ALGORITHM_VER_STR = @MARACAS_ALGORITHM_VER_STR@ +MARACAS_KERNEL_VER = @MARACAS_KERNEL_VER@ +MARACAS_KERNEL_VER_STR = @MARACAS_KERNEL_VER_STR@ +MARACAS_TCL_VER = @MARACAS_TCL_VER@ +MARACAS_TCL_VER_STR = @MARACAS_TCL_VER_STR@ +MARACAS_VER = @MARACAS_VER@ +MARACAS_VER_STR = @MARACAS_VER_STR@ +MATH_LIBS = @MATH_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +TCLTK_LIBS = @TCLTK_LIBS@ +TCL_BIN_DIR = @TCL_BIN_DIR@ +TCL_INC_DIR = @TCL_INC_DIR@ +TCL_LIBS = @TCL_LIBS@ +TCL_LIB_FILE = @TCL_LIB_FILE@ +TCL_SRC_DIR = @TCL_SRC_DIR@ +TK_BIN_DIR = @TK_BIN_DIR@ +TK_INC_DIR = @TK_INC_DIR@ +TK_LIB_FILE = @TK_LIB_FILE@ +TK_SRC_DIR = @TK_SRC_DIR@ +VERSION = @VERSION@ +VTK_CFLAGS = @VTK_CFLAGS@ +VTK_LIBS = @VTK_LIBS@ +WX_CFLAGS = @WX_CFLAGS@ +WX_CONFIG = @WX_CONFIG@ +WX_LIBS = @WX_LIBS@ + +SUBDIRS = tkwidgets to_change windows + +lib_LTLIBRARIES = libmarTcl.la + +INCLUDES = $(VTK_CFLAGS) $(IDO_CFLAGS) $(WX_CFLAGS) $(GSL_CFLAGS) $(KGFO_CFLAGS) -I$(TCL_INC_DIR) -I$(TK_INC_DIR) -I../include + +libmarTcl_la_SOURCES = marTclInterface.h wrap_maracas.cxx +libmarTcl_la_LDFLAGS = -version-info $(MARACAS_TCL_VER) $(VTK_LIBS) -lvtkCommonTCL $(IDO_LIBS) $(WX_LIBS) $(TCLTK_LIBS) $(GSL_LIBS) $(KGFO_LIBS) + + +libmarTcl_la_LIBADD = ../kernel/libmarKernel.la + +EXTRA_DIST = tclexe.dsp wrap_maracas.i maracas_start.tcl general.tcl string_table.tcl + +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I.. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +libmarTcl_la_DEPENDENCIES = ../kernel/libmarKernel.la +libmarTcl_la_OBJECTS = wrap_maracas.lo +CXXFLAGS = @CXXFLAGS@ +CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +DEP_FILES = .deps/wrap_maracas.P +SOURCES = $(libmarTcl_la_SOURCES) +OBJECTS = $(libmarTcl_la_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .cxx .lo .o .obj .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu tcl/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-libLTLIBRARIES: + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + +distclean-libLTLIBRARIES: + +maintainer-clean-libLTLIBRARIES: + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +# FIXME: We should only use cygpath when building on Windows, +# and only if it is available. +.c.obj: + $(COMPILE) -c `cygpath -w $<` + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + -rm -f *.$(OBJEXT) + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +libmarTcl.la: $(libmarTcl_la_OBJECTS) $(libmarTcl_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libmarTcl_la_LDFLAGS) $(libmarTcl_la_OBJECTS) $(libmarTcl_la_LIBADD) $(LIBS) +.cxx.o: + $(CXXCOMPILE) -c $< +.cxx.obj: + $(CXXCOMPILE) -c `cygpath -w $<` +.cxx.lo: + $(LTCXXCOMPILE) -c $< + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" = "." && dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = tcl + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu tcl/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp + +%.o: %.cxx + @echo '$(CXXCOMPILE) -c $<'; \ + $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.cxx + @echo '$(LTCXXCOMPILE) -c $<'; \ + $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: all-am +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +install-exec-am: install-libLTLIBRARIES +install-exec: install-exec-recursive + +install-data-am: +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: uninstall-libLTLIBRARIES +uninstall: uninstall-recursive +all-am: Makefile $(LTLIBRARIES) +all-redirect: all-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(libdir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \ + clean-depend clean-generic mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-libLTLIBRARIES distclean-compile \ + distclean-libtool distclean-tags distclean-depend \ + distclean-generic clean-am + -rm -f libtool + +distclean: distclean-recursive + +maintainer-clean-am: maintainer-clean-libLTLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-tags maintainer-clean-depend \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-recursive + +.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \ +clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \ +uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \ +distclean-compile clean-compile maintainer-clean-compile \ +mostlyclean-libtool distclean-libtool clean-libtool \ +maintainer-clean-libtool install-data-recursive \ +uninstall-data-recursive install-exec-recursive \ +uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ +all-recursive check-recursive installcheck-recursive info-recursive \ +dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir \ +mostlyclean-depend distclean-depend clean-depend \ +maintainer-clean-depend info-am info dvi-am dvi check check-am \ +installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs-am installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +# Special compilation commands +wrap_maracas.cxx: wrap_maracas.i + swig -tcl8 -c++ -o wrap_maracas.cxx wrap_maracas.i + +# Special targets +maracas.tcl : + echo "#!/usr/bin/wish" > maracas.tcl + echo "" >> maracas.tcl + echo "load $(libdir)/libmarTcl.so maracas" >> maracas.tcl + echo "source ./maracas_start.tcl" >> maracas.tcl + echo "" >> maracas.tcl + echo "# eof - maracas.tcl" >> maracas.tcl + echo "" >> maracas.tcl + chmod +x maracas.tcl + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/maracasVisuLib/src/interface/tcl/general.tcl b/lib/maracasVisuLib/src/interface/tcl/general.tcl new file mode 100644 index 0000000..7c6c1c4 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/tcl/general.tcl @@ -0,0 +1,135 @@ +proc swig_cast { pointer newType } { + + set pt [ split $pointer "_"] + return "_[ lindex $pt 1 ]_$newType" + +} + +proc DistPoints { x1 y1 z1 x2 y2 z2 } { + + set carre [ expr ( ( $x2 - $x1 ) * ( $x2 - $x1 ) ) + ( ( $y2 - $y1 ) * ( $y2 - $y1 ) ) + ( ( $z2 - $z1 ) * ( $z2 - $z1 ) ) ] + set carre [ expr sqrt( $carre ) ] + return $carre + +} + +proc VoxelCoord { xPto yPto zPto xOrig yOrig zOrig dimXVoxel dimYVoxel dimZVoxel } { + + set d [ expr $xPto - $xOrig ] + set d [ expr $d + 0.0 ] + set floatLoc [ expr $d / $dimXVoxel ] + set xVoxel [ expr round( $floatLoc ) ] + + set d [ expr $yPto - $yOrig ] + set d [ expr $d + 0.0 ] + set floatLoc [ expr $d / $dimYVoxel ] + set yVoxel [ expr round( $floatLoc ) ] + + set d [ expr $zPto - $zOrig ] + set d [ expr $d + 0.0 ] + set floatLoc [ expr $d / $dimZVoxel ] + set zVoxel [ expr round( $floatLoc ) ] + return "$xVoxel $yVoxel $zVoxel" + +} + +proc PointCoord { xVoxel yVoxel zVoxel xOrig yOrig zOrig dimXVoxel dimYVoxel dimZVoxel } { + + + set floatLoc [ expr $xVoxel * $dimXVoxel ] + set xPto [ expr $floatLoc + $xOrig ] + + set floatLoc [ expr $yVoxel * $dimYVoxel ] + set yPto [ expr $floatLoc + $yOrig ] + + set floatLoc [ expr $zVoxel * $dimZVoxel ] + set zPto [ expr $floatLoc + $zOrig ] + + return "$xPto $yPto $zPto" +} + +proc DrawSphere { name radius xc yc zc r g b } { + + vtkSphereSource $name + $name SetRadius $radius + $name SetCenter $xc $yc $zc + vtkPolyDataMapper mapper_sphere_$name + mapper_sphere_$name SetInput [ $name GetOutput ] + mapper_sphere_$name ImmediateModeRenderingOn + vtkActor actor_sphere_$name + actor_sphere_$name SetMapper mapper_sphere_$name + [ actor_sphere_$name GetProperty ] SetColor $r $g $b + + return "actor_sphere_$name" + +} + +proc GetSphereActorName { name } { + + return "actor_sphere_$name" + +} + +proc DeleteSphere { name } { + + catch { actor_sphere_$name Delete } + catch { mapper_sphere_$name Delete } + catch { $name Delete } + +} + +proc pick_point_local_actor { x y renderer actor { tol 0.025 } } { + +# catch { pick_point_local_cell_picker Delete } +# +# vtkWorldPointPicker pick_point_local_cell_picker +# pick_point_local_cell_picker Pick $x $y 0 $renderer +# set pickWPPos [ pick_point_local_cell_picker GetPickPosition ] +# +# catch { pick_point_local_cell_picker Delete } +# return $pickWPPos +# + catch { pick_point_local_cell_picker Delete } + + set actors [ $renderer GetActors ] + vtkCellPicker pick_point_local_cell_picker + pick_point_local_cell_picker SetTolerance $tol + pick_point_local_cell_picker Pick $x $y 0 $renderer + set positions [ pick_point_local_cell_picker GetPickedPositions ] + + set ret {} + for { set i 0 } { $i < [ $actors GetNumberOfItems ] } { incr i } { + + set act [ $actors GetItemAsObject $i ] + if { [ string compare $act $actor ] == 0 } { + + set ret [ $positions GetPoint $i ] + break + + } + + } + catch { pick_point_local_cell_picker Delete } + return $ret + +} + +proc change_float_precision { number decimals } { + + set l [ split $number . ] + set ret $number + if { [ llength $l ] == 2 } { + + set ret "[ lindex $l 0 ]." + for { set i 0 } { $i < $decimals } { incr i } { + + set ret "$ret[ string index [ lindex $l 1 ] $i ]" + + } + + } + return $ret + +} + +# EOF - general.tcl diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/3D.gif b/lib/maracasVisuLib/src/interface/tcl/icons/3D.gif new file mode 100644 index 0000000000000000000000000000000000000000..df0ac920a0e073e5f3cbc2a410fcfa930bd92169 GIT binary patch literal 1836 zcmcIk&1>6c82?F@YgKVwZ73yVN|D+QwBkdU!cfv2gab*oj8+35T-d?cK}&aXTOV@R zK`C~ULKk*uLj@~TZ9{hqJMHK!tSwZO5dQ-%%gA!8vxkcmW^dFB5FpumRhqKlZR`@7uOdAK0{m@7q5A`F7}serWrl?}rFOI}H6W zw!_$tV?T`jn9gAs(>IRe@c8(cr};mY`L`qhCh`=VIN?OQ;aQqeFGTF2Y_2}`$@tFQk}kq0PvjVg~^3^*7&sGWt>+2@}Z#BmYxJk2{y2H>0d_ zCJ_W5GJ+?Pql%z9{oqv!O8^2A>Wtu3+EyF@^J~r5IxvI^G{9v9&GHMze&!HPW$K6A z??5S+;UPB|!HeuLenGmO**~fn+4a;{1Qzg?`UsZYm8vy%W$h-AS6xbuwOPh*nEZ8Q zUhLp#Ie3t1?Lp51hiF?GBY1;nqxIR--4#7|CRMu*2f;JmLDn7yQl6h4dsYAK=jv2u zT>u<~5u9YzrX_AQBi+~-dV*zLgnM2SS7|srrUWc`YAp9P%3m6HcB5{6>I(0-yo?&f6C89#TLos?t%%%ohv@*m4nDjKgXvJc89lj)@n zJS5TS%WEkCmP~uConJ|&Sl#9W2+X^Nx(csC20QO}Z$|!}BrsV@`qR=;7Xi5>n&sZ* z8P1=2o&;&ZnE-Cp)vi0M^2MS)L}7u(?iNrI`SdegVp%BZX#mdWIu<&Yr=wHq0XckA z8cn0Mx6M2Eb_RYr*q%6d-|hJcGlPlN_pDkWY7boDo(IRoS~nn+07NQr=!e}!fyk2~ z)ev|x-t``VOF9Gtq2&=4MFwgGxRwMq+P%=7d?pOiAt9)a_nWAOrU)=$XyQ8ng6ROm zX!kn~fccNSiOE~<%Z_lsUB$o1v(_mBxFtI1dx=C|S1OtcRRrgW855u};;fURAyA=m zo)Wl_-m0vw|eq6_jEs^`vMNMZ%RD3)8I=)kMlNgjC;dLb@u01beV~&qkEA HfJ^@XnzEH? literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/add.gif b/lib/maracasVisuLib/src/interface/tcl/icons/add.gif new file mode 100644 index 0000000000000000000000000000000000000000..b46a8e674901e07ba4c9f53e7cf1ecc7c39118f4 GIT binary patch literal 1836 zcmbVMPiWg#82_xs(>i5x+JXbIr^UsGz|08o2rAREG&Y?JBQZM+6?$+)t1vJ_J`8Ng zz)PrI$E0@BZlJ9gms|$x!JZkcH)o#XCI~VHJFKTVcDr@E)XsM34)*w-VnvBN*!Dp0 z>65-czu)hB@4a*J0)KAa4HNL^Ye0qDLi`XD;Vy?5PzHZuMxlk&f`COB3$BB4W` z`O5iLSl}|rrt2fmFuUz*M<;EynX&=G&eB&)t+3#>ZC5rg^RD$;sTFokCk{n>g=Oh# z>F226wk4N0m051RR=UHFSPez4@=lgrS!lGfaqh=QOZDiiJ5%#@Qal2+n)gz<(Yh@R z4<;I}YeMej>ZVi_;j>C>4c;DIZSG$@2e(!ieC;ehJeX{{VuHh-u2Kb-T{}52qh7H6 zWXUT*!7+E;zjt~3_RVC|^0nx(!#A>7?h3||xGRg0epj~Oq ze;gdW^<@84420zmsCmO40z z`l;(#`bRw+pe$Ly192-90PGAvK?GpRQV{^ip#xwbWO9Kr1%QH50E7g_kt`$}FS8-+ z2U_O1gVZQJp-aLU0K`eKz-YRIKS{yokw2oZ$uhUDKaSMx*GDq$OMt%in6l_32x|md z?z=B_xI_aAL@+eh0U|*FNLzu@)jGaaFo47{5Sr7KF_%wU2QUIfM_0TSp2ww+Aah@` ITHwvU0b^>Npa1{> literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/area.gif b/lib/maracasVisuLib/src/interface/tcl/icons/area.gif new file mode 100644 index 0000000000000000000000000000000000000000..7e27d0c2725d497a77b251281d03732e4e62d9a0 GIT binary patch literal 862 zcmb_ZyH3O~5FFN5n37aiZbmxfg2K`^LG&O#gFms7AG>d&qsbx1u}={ZRkj)JXdkn) zAD{2T>(>Prd^-T?23)V#+Y+eJ|C}Cx6J9crYvJZVjwBC+?rCpWANs$Gy7LanGy5G$ zeYZod;(-K}KuJoeB$-GFf|1amZF??}CG(uM4wc3R$&JMkt)+o7%1R17YhR+S-f2*& z!&FvM0(I2V*GT#-t@Je#9!Mha`H0%y-ja{FXNSFP-V9B^qM|}s7%dLbO|F0y*Q!BX<%$TGc9fA%$XoObLN>dXJ(!`^Z);U z5LW!j!pOkD&!7X+2r`3#<==1x)0e^*DpA-PyCAP!S#E;-^+f#Qt-h)4&@175k8c10{KuW zy(iI0BKZJV;yc)fCmi1IH9aIzz|qVn*|-KCSX+hJV&3-}c4!{i(Dpzgc?~!uK!LST zpwCKKAYxL|D_fCc98chZ#nESYOyY>d)qB+&78)K?cm@skIOoJ3LpBpnkZl@0h6x7H z7+{x|O71aaDFV65I=RP@2Nv#Sha{N$1Ouwy?=3$jQNWYbQw51aTajZ5$t;`XYVzkA z9Fu64SiArdasI4K+=6Wr7Tr@y=CNQiJhTGj(u3ds-K+LDJUS(bYu5LBl8HTzK0$~$ ze76@8mI5+~JqcGp#-JsK3lc3H*pkEb3kpZ~e7}d89NM@{u%;~AV0iDyaG;vOhCz;jzv;Ui z14yhwpn)AC*6@Jw0|Uc@z3dDuAcElm#Ah8Mt8-|0`?`;|67~V5-+^Ys##BhN9 x07&*;H9yk_kOaelY5}kvwhRmn{0(?LxF77m!JVaH2_BLSp_v;T?)pp&)&L~%H^u+} literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/bright.gif b/lib/maracasVisuLib/src/interface/tcl/icons/bright.gif new file mode 100644 index 0000000000000000000000000000000000000000..ed07e5bf2cf50dac2d92c853d3081ce542a2c090 GIT binary patch literal 1294 zcmbW0ziZn-6vw~*fo%dg45dr)kV1$2YKIDgE?JyX651g{h8jG%ODL#An(H5+(5@Xj z7!+`Zj0zs&rAwS49a<2cOoj{@3d-K8i&NgaQ*?5br6+t6es`aH@B6;D^=i|VZ=c{f ze$Ru4qaVkC<2buCdd{u0+oPw)zgr#v9{(v90D)E7NDP#xV;Ki3l5y~fCi-f8OuqUY zP?4-2CSNytv5Ge0Kna(oH3Lv7YLt&^?A?R%HQquMtgJX{vJ!6GR{#PP6*5@~x7zZ; z^NO$da0_)X>3HF=GFxCN98S7Zj$|urdEt<@oL5Y(hBfYZ0}d22Vu@4cPr4ojQdB8y zUedvnjyEE)SX30z&~2;JO8|FiRZ-RvU}4X6fGgyGYdjm>IV#qY<#kwM1xf%0HIkVY zQUE{=2EP$c)3j(@+dYhA?32#hV#11690H`fB17JJY!q1`tism}2WNOVgix0PY zXqi;!l8e&9ME{`jO&ZCm*6sgUUw2+FUEFtfD3IDAO>2e4GCfR;F_!JtlAnV*IeoM6 zf&w$Bm2h}aU;cjQtVFDqH+cBD-X(nIMz`k{`~FVb;WSPXo` literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/clear.gif b/lib/maracasVisuLib/src/interface/tcl/icons/clear.gif new file mode 100644 index 0000000000000000000000000000000000000000..e63a2d1af99cebeb47689580d2b95e5c6a90d573 GIT binary patch literal 862 zcmd^6yKaOq5F9WC=~!r7f~AYDNMSUMqw5ppGx8@8{}|ttE)93`a^W7LNPEgQs~xXA zkA44m3$LF$?C@;>3`by^rlS^qtNST3pukH4(k{%rckatM_n%rVi`&|E^OgD9c4<1d zH4*7HKquqfCQt&Spt2bTpjC>T!JF7fWqT71&BE)0;lN64#(|!tULX%-^lWUO8bhnf zN-~m-l|GUTW|8X`u$M7`Z1sS7qD}0hsFurB)ln_0BjrlUYL|h zPE|ApL>YCp&1@P!vVQ<+59JMkwl1BgB>%w#f^2V4Gij-&c)Hg~9JBE_OVQ1>zI)F1 zopW+C{!qIA-dr3w_%jOl8N`n=s0t>QY}+tR+cr(xv~B#cZQJ4apPrryMF21mNBC$aXswDtnj+I8gO`v$NRRF$ zYrAU~Yw9D7c~yR}qg`8qFjouZTvFw?0?TBbff#m(n$JzAgssB(UQrdI{uXLC84LNF zS`wMy$_OznGQqQxN=n$uj_j0DLg-c5s-ys#n-`xKJ{uwK3emz#tCA8{mnGldDSmTZ z()Xd6kDL;|3oO5`q=vS#RRk0AXC%F(az;DUq@Z!XE3Zqar&H^XB_UcUTa{S2JHzHm za=(W+7R^Yx%2Mok;QR!E7RuICjNeSKi-bp?-4x%Qk*rEGwiPH_7pQW4uPF0fOr6$Y zKh2d?zB_YvvXjKL7kKJ_4ho zDYx>A!`)1pHdmU3Z?nBuZ$?XGAMh@lpmkCzinCN|i zz+}!yoRNR=uzI7_N2av~CcCgV!x`&+oe`{vo|pNqgEEmE2;J;($DQNCYd_BC;m*dy z@h5qei%hcmJ_!Ew$OWRUHayeOoNHs9pVOfIGKP8EfAfJq1iy)$_AJY9ndFH7iI{l*79rQn+8}??O&M=vITz$tJsSZzdjY>m!_q(JnKLlw+h+fpuJeB{obMDLQm2}%i#}PD^sczjh zqSYqD?9C+%LUHeYKw)H%BDm{X^GIHBUy=lfHPO%k5Pxul#Z!~W5Ii-8aeP4w)>lJ0 x!iM03O-ABbTw!qzu*~QjF^sjZg@eHMIJN=~02&FiUr9{EIXg6=bQ^JI2VF@p69pxWNY$YH3pD_0#-y$FgAF;yuUKDUEcf1 zZT-U&G}R3|#FpO8OMGG4Uv|Qfcd%6I=aoC;hf@KzEVo+UveNP9XoyB z71f9#nIzfiPaC9F?Dj1qwNaYf%vPl#zIAQu3fbvn8FT8$GL#$hZYUFSQGQQ5ubT62 z^+zMoDrGirC6$L#CfTU?w;yu!eXoA^%C8lPP!0gm<92WD%y`3`{B!Z;n|oniq!H4c zex}`+?e-tbJRhf48^R?zvCsZN5{?omLG+vKG}e@(780D^Ghg#ibhKt+KvENGCA zfjoil9AZ&|JQ=d>SMg8#*l&G#Uj;y9DzwXx?hMpnCq(}qDMCNrXC1aUshIp<<{*&b zlzu)Wr0Wxe{HS#jeW1aJ%09tBUInm*{2 literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/del_axis.gif b/lib/maracasVisuLib/src/interface/tcl/icons/del_axis.gif new file mode 100644 index 0000000000000000000000000000000000000000..3809984b862f5b42156f0f0ae9edcd92bb3812af GIT binary patch literal 1836 zcmb_c&ubGw6n-0%m~A7Lq=p!OHCnel1X(hB@E1!7wW+YBEqZ7VLQ=x8h&K^DtPtBq zDzQX}Vn&d()C%6T{sR$I3~Xtm{sA6D?A63WbI8ifcGFE0LBWCDVP@X20}VU21Yt&#{?0A ziH>!Gbb<|n2_Zx$Iw87Fblorv`Wc2{di^gWyzS%w1c*>JniIGiL-}$lN)+KAr}W${!bHa+SKAqHJ6C0{l(yt1vz%em3&?Tg2c480tVK30a@a~u@R${qG*Gv8J!nq1sJP`!Nv zRwv7~q}b&GOV_Jn(A!;(SNXB@lOE4aP8(f42uqFWh{s-#qXFOg`=2yjfF96d#at?B z6~ru^7!e-lzWeL*=a(3v*+eIbaOLFMLrp4f4mi8+#Fi#JHSTF^Z+RAGli>_VZ?4-}ZgcWRs;8&Q`vl?|x>aTG3+9avxh7hgWyP4Fv-<-R%Y0o?o-K zg#7))M5NJQ+!$bZ|7Ht~8Pn&!*Hfx=qBX&mmHTTlJiSu_8@DYb&%KOoW#wYObce0Y zR_acxf4FpZc&AH8!)@3DRfIebP=K9VNAZr`($NQ_0FdW_HtZf;IpqKb7YRVV?3CI} z{E&ze1)$^vpi?T!F)}D9kmeI~mF88-!WtHU0ode#rdud6M*tvlz`~`ESr4P8Zv_X` zkpn0vjnmr9mz^|z%E?Ta+dgRQ`0bq1AL`jsy0$!-rw;l=cS{FMigpQ2GN+}o8K~G+ zIw~O(jcL%l-c2|irIf>A$_uc^ktsc68K?EMfEHddg{AJ9+U+KtgyGewi-QZl0WzzK A>Hq)$ literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/excel.gif b/lib/maracasVisuLib/src/interface/tcl/icons/excel.gif new file mode 100644 index 0000000000000000000000000000000000000000..4c46834c7d7e319178664a67bb59dccda329ff28 GIT binary patch literal 1844 zcmaJ>O^X^q5Un2V=z{ESVh3`VgbA3N3$EkBgj{BmokT%l#$S+J=DcEr9LEqar-gW% zzacESy5t~>A_V;b%3g8|Bst`wq55M!MAEd-*1UT4`c-$oX}q?czbiu(eiwlc(=_pC znm+ix@0-5wLm0w#8~XkXAPoK4%nxzQX0vd+4Y%9bmJgBtpYil>mH;p)BL-^%-58F? z_RRitnb`)HW%F&wD_mNzeS1RIPPlU|0K4qW@dlTfY#zP zkXbwZpl#N(2HobO)>?EDT}k>90cx$)WdajX^@90YfAGu`Gk4BQZyYb-`s4Xp_ljp? z-v97uVkfQg7zY?OHhx}&SqE){ zY8%$5lEg)dx{Yql*TJA`313u`IUu^F>Y<@+1LY=9V@$=RQvlgy0@B}I=`w}3!S;4G zkDrp{qR#+~fbzoXtBj}L7rYu= zWB|BjY06h7Y@|-eP>iS!0EDHbt9?f2<)H>I{sBO8s$l>C literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/extract.gif b/lib/maracasVisuLib/src/interface/tcl/icons/extract.gif new file mode 100644 index 0000000000000000000000000000000000000000..cb3733ce08f39d57bbaec8cac52d60922a7f38c8 GIT binary patch literal 1836 zcmb_dL2KMb6#lfxi?uAl(r%0?hGb_|v4kANjt^T3VPj7lxm9T0=FsCVm}z`-O0R)6 zc5MmVVp)`W3MD;+wm&0|)53x%A-|w;Le9PPkjtvf$nmbC4K&bM*x`-d_ul*7_eQ$0 z`eEn2zKu5iaUd53C{=%Qr%^&QH2%t-3kVdu`#}+kbb(irAvLcigL2e%Uf^t167Hd3_G?&?cdG@8cIMR>1}()|a;%<{d_&z$X1`&BNc9t*~PaTKAE`+rp~u?wpu+n7tN0+w3g<6nXmG zH%nb;z)_~$#Y%OTJ$f22viIe)&9A*`*V7K%s(zLs9p9k3>8DSAr<%Zna!z-n_xA=$dVAFe_w>`KEtP9v%c8 zau_U;&}&*7cIn6bY?Wu1w;E5S%WpRMmf45J@vBt-Ska#cEQ^wdE2~nsjPhRdH1IC1 z<>6<_4cD#uf~0GG&x!-57;Sv|g*&oI6ezRyc-s73KJIOHNSlEoU&4 zb&g%ep?%0_N4`_b4zpUEpN)~M7f=a{lgY4u~7u7pOH|tLg za0}8QBR_6oE|{*q6A#u)C8>urUaKY3N=5lZHTE_9QYO||9`%NObG;edxZR%7@czFq Cgl&ER literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/help.gif b/lib/maracasVisuLib/src/interface/tcl/icons/help.gif new file mode 100644 index 0000000000000000000000000000000000000000..0f51e1eeb8b5ef795c7e68174321aec9f6babd96 GIT binary patch literal 1294 zcmd6mPfHs?7{=dCR(BK$6Ou!O9CoB=gdS{8nKp;)Q2GZ%Qv3pzhR~zUTyk8KQF16H zhaOBBC7%2kjZ&zHjQt3)pzBfSsh6b8%qG(M1-gf2*=P5+&-=X3zI^?nMBhGwBK-0I z0P6KRz_?!T^?LR37<#?l*c@7WaFE}w1AySMRx|_L5hj`SwG%h99xm^1B^V+CKi4N# zkbFoZ$rX+ANyi8bkq%}z=H5UHZW1%JB(xx^r8^@?u6DlXv=E~%G{vIkyctMOP&pOj z2mBNDX2J=o$5RYz2a(J`2%rUxD#ZBM74lt+Dn|L{JxT?j-$hHJS~Bh@u5f6^LZp@| zdyBPhFuN%FqW~Se1BQrZ9c}Abr>u%=Kg`eu2ckOXOee=*`@Z!Ad(GHs-icF7JPwQS2m(ds(dXo-_k9)Iiv$$bZKP5 zI;tvqoo{w>$CA$@6o}EO<$HVloF3V%0>$P@CBYXbm2 z*fcFYA=n2o0h^^QJaR&C5doY45I)#H&9FcNpaT`~0mBppkN{xj9(Dlq>J17i$O*9v bPN?6w&mA0wK&ya&*1gh5T3PerHh~lwzoHuBT=NnDU2Y}9>_sgplsmgl+rZ!1U!H(Dw_NW3O@!C z5-(wiD6f!LFa?c`zL`Dy5}bmOt-HOO`{tW(e%|Is!xta-={YUBL_`BvHK+!Is;Y=^ z#U1`tHJcI5s%k!X*P>II|D^=oD}L=#8i2AqPxh&(gfQr!R>*hv&-<5B>!EjA#Q zTrfR+SRh<5-U0^>-zGa9coG#F#Uo-t)M9ut^WF#d#51BeS`wv^tFNgu?{!B!{)E^Y zei9~9XXf`Oh1>H81M^mNkxXEL*^L~JOxhsbFcm#-k51Ye1?FfXS7ZWA=AEzo{G!jc z6t1GXh!T%!!9{j__3TS0k=!ENail7WxV-!O)%or4B1{!i%fq6VUov}JULL&b+H806 z_>P<@6pk)>Wh&W!6OH0?6UcGK+oc9@|JwG(09QcrGJK_tpj z7*VUc;Gz9eqB9$$)tdVSv1B@gIVN9@2AvoTv+)2oUIJ-*I)dolwq%MUNm>S@ zyTPRxLUg;#n5-f^8RLn32~eO5=v0%`sCXiKg{ahhp{0(*Yh5-L^N+gR*UL_@K{wtU z{iW5>Xl(SQYNWcX^`gM~ZBum73#^!@3a-QZ(`o)eONtDYjciV&P3by+SR8dwUw31H qRjdn7&_yq1)I`b%bxH`QtPus14>S=S6DI}Hk_z}%tNX>Z=;dFbfOt^= literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/intensity.gif b/lib/maracasVisuLib/src/interface/tcl/icons/intensity.gif new file mode 100644 index 0000000000000000000000000000000000000000..2a963cc8ffe175e31b28c79ce12191a7a0efbcbe GIT binary patch literal 862 zcmbu5v1-IH5JV@dE1WV{rCcvuP?18gjY9f_d`A96$Uo+9N|(kLR%_uqa1pSYL64PY zc0Rv8^4s?X7yJYOstsE^ekI!A2}{dU$^~jbq!{?iW??PIfW^>sD~j9IcU-35e=hFQd2s literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/linear.gif b/lib/maracasVisuLib/src/interface/tcl/icons/linear.gif new file mode 100644 index 0000000000000000000000000000000000000000..0b5c79c06f9f89291baab47106d8fbc5ecd26938 GIT binary patch literal 862 zcmb_ZyH3L}6urnrDx+l&S)nTGz+mSrMogBjAbdvuq*nT2`6f1&6va0UHVP60UXFZp zeID0u@2}zcxTigRY$%`8g=iRtOFlx~e{ODwZs}>dPP3%O0Q3O<2x@IoQT2THFo`Lp zD$O>ulaZ^)-650pBo1h&NZUGDyURJ{@kHFz?~ zC(k6?|XkF*&Zq+aXvlo^FH^x^Q+$J^OLv<&*0BK(A93Y z@oBdQg8@Dnz;rsuvcVLuEX$^=)pWJWR&?o_|GXamKbEg znk&JV%0@pd^i$rvL&E;K?_NzNMW4btVBSS%FahCYHYW*Dv zelVWP#a(A{CiAZ)=vHvoxoH#EPEG?-i7qNhg~R{kRaH5A85_aNOW7^QX&^* z5y0CZ?T6w`<9i~yt;BXAUL^SHv&4In#w`)c^r%`AR21-oz1uKh2T3eb6mTf)D7Kpg z`?ulJYc&N=NL2N}?uJ=X1T$FpRpB39doqoyObbfXS@OBF@SX}D%wqYmyj1cT3DWHQ zY#i0U<$@eK$zc2&#pfFmkuW+7T;9CLfA*8=wY}zyYNxQYf7l(|e7J z1xnG8k(6t9(b;l=(j=Cz?I^`#012)F6JqQyWR1V+z~K4`0WDrHyTS-FzG-bl uhp1bkSb`w1inuslIMB%=64R0}s0OW|qFL)bP-bT~q7!#CH&7mV@Zuj0%MFnL literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/pan.gif b/lib/maracasVisuLib/src/interface/tcl/icons/pan.gif new file mode 100644 index 0000000000000000000000000000000000000000..eb65bfd932a72679e8d5948e98ebf9f51f5854da GIT binary patch literal 1532 zcma)*y^hmB5P;WVZMob9Te43nY$-*Gt1tx!3NMNiXdvbZa*?&7y?X$Jr4%kGlG5e9 z0Z(y?sP0iHXs&V4%=%~jgM{Nqo1L9+XTIHRKCWNCxml2xax_Gb)Z;!L@W4hm7WoiVwqisNC8IjQYjRN~@>p=oS^{+j$$)z3`bh z-m0{=blCXJlQfIjVV=@8f8Hy_x?4dtws?RwL5oeD#LnhBCpj5{;TlarelkRndqp0z zEU@;0r4*nSJ`;@g->-EifYL$%jvEDG69O;lg_5xTQ)LKic2(pah{?Ue5YQ6FxR=-m z&|y=YJj5!k_L6xU>;b*_XFl?BsJ)zOak?G9_R^b#1v>}(1TXq}1rMz~dTB*#_eCjC zhcvn`sNim;pQz$jDfE!DtULB@W2D=oP)F~F#&ksWybR#o&!*cB-pr`Mzu_*dXwIz8 z(!8XO+oDGBDoHVOl5TFlo4*I=fE&M=%2e_dB`Vl7tbB?0pt{t;*t_h zU9_2!A#(|I_149cln>w`AHho(r@SY}J~^hHB3?_!>-V1Lz2BYmLB4P7f850@j2!^z z03EurPS)vUSq9LPM)b?FVK&UN;gD|nad$Vo(-%$t-?j6HS%8aODkM*=Oh!>$EQ#*2 zWL&V;(!ASPDiSY>AFu!ZRQr-7w(s2s@|n99KjBhU1K~T<)b*zY{aG0c=OWbkQ^f$! z)UkTi&d<1|m`LnNh%2o2v34QczA$Y@TsWRgW*%IAB^#5=_S}XYDlT&#Cw>Kl9hyzZ z+&^%%%bd%1VXU^RBAG^3Z$^X$tBToxP<(|duf@f+C|%~zcVxmXr_a_rJh?#I4xI{- zxQK+~bsbN3X*qGuU*uf7OpGnNsUGjY=Zrf=e#jM{TAy zb-}erFGb2)3q(%%v+m||CzLrq$f=bnkrF*|ITlWvowBV2wE=1g)^nCriEJt+EKla_ zFeP5pjOpSw=!^i+G<88lYnemWL==}370GWmi3;i}sOLcyJZqh47Dqvx^Vp%NC%!>F zirpQ;se)Jq_5N6#k43rw{x~66H-dsuqvyAv#TcjYGneVDpcspd@C|uYPonF~5wGVI zFLQoy6zu0ym)T+5sJ{6&0FwwU_%d9(3VT0{_&Iqyr#{_A^YqTt&19u@bCz2J&@?j- z#H|5EnO`mrv|Ka`2C8ID7bqC8XQ2_(nA|Bt=+Oi)DhGSkfPp5GxCJBw%447_L0`P4 zu4!S9+{;RLQf8wVweoK*aepuL*Q=bYMQ1gMu?z!&v85)3`CDohKm0WQlgnd>|GKw) M6!pgv-?H)gFV+vFd;kCd literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/plans.gif b/lib/maracasVisuLib/src/interface/tcl/icons/plans.gif new file mode 100644 index 0000000000000000000000000000000000000000..f7a5a295963886116fc9a22a9477bbda8fa5b23f GIT binary patch literal 1844 zcmZuxL2DC16n>ke%OZuWf^FT?#&d=0UMg;+DQ&fgh+ss;f}v#D>Dh|MNvWX)A@!g* zbK2T6^y)#p3I+AB7;llDM1O%K6uqSKW_EVB)nyYVZ(hFlz3+W9*A^G1FE=LP5)2#w z01sc!lb^uz0tkY@3xa?_z`TG3LF_?{KN<5F3s?*+_E;P+#)6myM+{dnV{y!mj*bv9 z_f-Cr3;+ivF@`l^WEcs;|9KB~TK@(yVy@_TRWC5^>=7Hf*!WRHQI|e2(~j zx0r9CZEw07_t6 zckhoqS?aF22tL#!?I>Nrw$|Jm%k^)o73-MlC_xD;*zRoOWxd{8CDxm2C#!*eDbGnJ zwff!qh3hRW&@HBZL81pca(YvD&OTkT4Cw{)n2#bcucr6mt@{ap%JF_F=FM0+HLLoy zi>OQJ4E%Dbnzz9C)7z4&daQ2W-;y}rQ=7bMj!TaWQ8JfqY6m(4Ukl%y7&)&1=%eY) z#JAXkjaHY=5NJx33AD~Ml7$fhIBK*nmf zeoREkJ^;;uNYS~dzUXV4;o~OYW-T4htrD?nkeU&XkEng^5B;t@A<~WWvSbDGP?gXb z&~D$icQYz4)U@#ms8}_7T~y1ZZ1+FZWqxXP{AmItrz1bo41}8nDoA$3^j02RA>ia8 zbRh%)E)0m!VpU9x-=PJ$yPgCcW-O0gg!?^E{L zFiI*}My)N`zb5D4fkdSv6XYaOH8lrWyOsPa!Wuc@@d`-0l1harv=t(thDsAoQctRD Jzl;^&%3lX=#k>Fj literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/quant.gif b/lib/maracasVisuLib/src/interface/tcl/icons/quant.gif new file mode 100644 index 0000000000000000000000000000000000000000..af0c0711e8bcecce70902690db37829e8729f24d GIT binary patch literal 2233 zcmb_dJ#X7a7=BLSL0TLi0v_Oj1A{IdGNh$d$fz5fYST>y3&)seXjB)^68s0mu^rkW z&ftGTAcH#?b_>Tppm6&O+zwsj;(bpPDJe#mJ`l)P)WheVdp}O!y*cRZeE$``#9tv8 z2@)Vl=)$)oNs^N!IXU4A-GK)@B$r6eaZb2Af4F?`@Dh*V`9FaGG+q#a)`Xmm+$T}2 zKh;5B1>Y*V@+Yq;dRWKKIUUR$#C&fzn2cIn2c{Ne@g*UK7uSJlZmSgTG3UfwnB>4Z z=j8FavcgQLPE$4_Dq}@mK`8W9P&DjT)Ma&Min%C@m!iRBc=07BqEbwORVG0mFEPha zDS%w8B%RSmVB%`^i%EoWgaC$qtCPN9Vn&5(wL#QUM94*$X7kT*=V_X8gLNAgY?ahwj(>Ra@X%XytUzeSEWQ8kx`+5O+-K3_1XvyMn;<=yxq=kY|aign5lz4 zf|jBVQ5Qu7pqvCrlhYCu&{!Gz*DI4MSeX(Zz4uhd0~Ib&zk@m;^oS zn{m`;(wxa_$5orKCPS{y5f)A7#XYToMXT3LekERv>k`O$ZN$T_9RaiIorSswPYYq? z2&k|!NEJSHz;IqF0t3~E|ChKhu6E+&F>PQC?3|dq;amg830M~cPC_Gx6;As3cTP^3 zDGdKKgB51}rA1WwXQ)nUNe7W0&Z!M1#gug>5GbHEG^T#NO4GmPoNQGIrBlnXKUjgG zgLU*og7rE6-;+MyJSD}8gL33tU425~vqd52#s}+J_X$F$W|9`Cz(|ZFWt}R(rQn?A zJV&&AlSw*M(s_P4akM4{9sUofG_|iPi*ua&o%q;0cU4Ijg21uY65WW^+zOp0RM!2xyi kKX7=E6nLaX3rP`9T2jIubNEvtT4Mi7lImfin3cgA0Q`EM&Hw-a literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/redgreen.gif b/lib/maracasVisuLib/src/interface/tcl/icons/redgreen.gif new file mode 100644 index 0000000000000000000000000000000000000000..003e98e911337e30f629897f8d14d0f06a5b4ec6 GIT binary patch literal 1312 zcmZ?wbhEHb3}BF9_{hw_@Sov71H-Xn$NvBSulSRNk%57kL5G2XfdM4X!1Qm5M&Kfs zP9asV5y|*RvFDGpa0=rOI{^iU4ruruYT*=i!xzvT0tyZd5XDI##cFsIi+~jifMYHZ zthfhvT(W=_Gk_EuA{76_9`jt7s(o-84O6U$FxqE^0mKdr1{>65WW^+zOp0RM!2xyi kKX7=E6nLaX3rP`9T2jIubNEvtT4Mi7lImfin3cgA0R4HM&Hw-a literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/rotate.gif b/lib/maracasVisuLib/src/interface/tcl/icons/rotate.gif new file mode 100644 index 0000000000000000000000000000000000000000..da9c2b6495a01a4d2601da51ac83b0242cb807e8 GIT binary patch literal 1836 zcmb_b&u z-nL*DSF&SQ$Suo>7zN4aUUI}ZwT#38DLLe5%Tbkopod;?_1?nTP^+gte!MsH=9`&s zX5PZXdG)iE7*hD_4(O601F}s1=q8i1AquvUkW9 zEK9a5!|KUaPww>$t7r6xY*{_>?e%)r1zmR3|7A`8%`re6cZoN`3Bo|DcJnDK6Sp^h z>F80SHj;+Q;npgBdJg#bg}K*##oQ=e#l@@LH+@A4`GxW!O|@81Q_r@V`p|V!O}PQI zF%$9&4ws-3w!_|7YT8Pne5ij+EXi7G_9c?pL6f;B+A1mJ5q^I}&!;CrVB1bYd)|0j z2v=CRn2mIl;1z`jz^OF(H44ZkRH?qR5cJ)KS!yvvXAX`D`IeJX^X=yRCp*H+&2Q{@ z2vhP;hY~{biJ0$+z~2}uv{gdzvC9?%Xlv>H?0W_Z0F5X`N|1<9BY;1~`F<2(3Q*w# z8kAt8`;Oe3)89karnB$Y0Hrc?=@(WzwaiDbzE`_FqRhyvn zQcwT3o8V@FuqR4_!!ML)EUD(FshF-mb#vX^@4Jcxhyt)aAo#6rzN6CsfQ0s)AbVeQ zZ!;YgQb;@3JGD%FN+>fR6*Czwu^%Y7*1k(WcM)ZTrvxLspGXMd>;vBuF+k=(7a25G z*g9!JE&-5aNIZKB9G_*K`eb;!=bZoartjydaB|Fkp+$FG4HWHROwtO%qht5WO^%6# zesKdHfFBM(byzOJqpm-g_TaP_B#gBFXqE{+3rMCr!IgjyIdVPl)lGYVruuK}3YbhR z8t}{^p%S)@8RuoxGbIq+7Q_A!6wNdPa0=77@(6tOpUweV$s!_Q;QkyP-%FEQsb@SL zHLbn!7*Loicf&x_N{s~&xhtBj(c>B2Stc3Aj-qU{C>9F7@#i^`{KxsVLipxaZ3o9J zjqYeXDOBw~Chbcw0mI>*h}-L=weM64X0LHTdXR{2_=-h$&(9Lv{XW~bY7 zoffg~D5v@pxy)wbm1S?hapqXs@JctooY-4*M_&ylfI|eENml0$a_nV@u`+3|&!9py zkC<<-4{>Yp#qvQe>Ag3GqphQWhuP#FG0`q(Ys^xl@I5g=!cMe~SmqKG9(y|)?QwXf ww0w|be_edR{xM=Sk>_m^J-_?)HF%D;&Py}I$t2K;%7l5*`BxMCl4O_dpN+aEvTd2 zZqu*b9t;Nbi-GZY5XXZt9dR6wSF7=A6|dBxYyR`N_nR|7V2||F6B|p5d!k~5i=kUJ z-^nH~hRy6+m{lgn%}Z7_&%>;++$A^91k|O{oO@~VokgijZmvx(hRwyWxnLFMf-jTk zq$n>qb@%F;&aoD(y9@3`2U4i$B_g^?MSnGwqn1=NJ9<7d*S942;heOBq-uRXI-+k! zJ?H$&Iq?g-Qsj~f&aa%yqk<;0>Ib8#y#3wPqpp!H>2U_;&S)y1ecRRJ){E^q@_kT7 zB(M%;_w6B#=VBv7+92T)_3WtUUL5Uq-|TjK4U^qxWfKyd+Vyu@BYDRO|iu>GVVra?n__J_p=x(r^!U$p4C{rkI0viFXw^;Md-n)GppTL z&fdEM0f|~BGE~Wh5g5+azT5cXZXU^~#S=l1I>+dzv-!~#6FKo4MtP~qC)An-w{M2L zmJ2fIN(TFD&5rzrVdgB-7<56=VFw?qumG$09ceKp_Gc25&9il>WhrDp0} z@v5u&f4S$)(ynE5h6KT1%>nP)PL%&&K${7;0P>A2RgkU$Ug}O3s;h3CM^|k?i78Wuas$*dGg*sXm@jilxTAs#6pj>nY5x;0 zdbO$f`m3ITV4&}aHb8UvL=4oudSUb;T}3EmW-=rc6)?RvxE8HBL95ZIs*uh(Y_d|x eIyqKKugyJ}npCoT3LIs<#)UHEullxuM}GjWlpCc0 literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/subtract.gif b/lib/maracasVisuLib/src/interface/tcl/icons/subtract.gif new file mode 100644 index 0000000000000000000000000000000000000000..00a8e525bbbf6ee12685a170cf0cbff46f53da65 GIT binary patch literal 1844 zcmbVM-D(p-6#gb;AYKT@CX1I(=r&Wmk4!etczYIMc5 zxK@kf7@%KT(I<|_V_+P|(;Ak*G{!Q6(|GOvv58Jd)oREu& zR`!~EaNR>?fKV5>>!z;gzs2 zLo36pAZntOhtM$2z6?RZ%8tyfjg?5*GurJIjwPy*vf4lM%S1=_f}}eUM)n8`q1ArB zuO@GD(OyRw*<-n;FG=h1%l^psQxs)oVa*Ziw~lp7lvbqViIH@xRqH|P`P~&37zUwC zz>c)ewpt&yQqz^yg_w1q}BBcT;&<3iqO`BsM5YD?!Bif(Vh0!Aa$g5 zR0+EE=J&VEk~Cuy>|U8wg7Uqfe7QSFpC|81Z1T!F5N28MI|D1>DxWlhCX{aRu#-1Z z-l#aGwe{QGa`0oeX|*EDUMWJ46#GR@OEg~&x}OatlNb-@CL-aXfJoVT@T}52Uu7wU zbQY+^m?h1D`eoi2&S{rSiG*v$ya9F20-U7IlB5hIJEW;23%3aWYXs!DjvzzN_}pR* zoX?lCH_sOjp|>L1YPCLJ_yBr19@#|`Up0(u%b<1!Fv=$t|xaM zA;SqBvlR#?vwD!3N;F!KJ}MfOl;i0;!}&*FD4r(VUvt;hFrB*&HWxs1S8#e+^0Zhp z-LQ$IoYExAyhwZ{OIW%?ccRlAxZz7#@&uY>B{AXoPk+fE>M<5X=g8@EF7RJrWP!U> b&^OIjiXk0*jvQUu^VdjEeN26+7V!8F)rd3I literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/wizard.gif b/lib/maracasVisuLib/src/interface/tcl/icons/wizard.gif new file mode 100644 index 0000000000000000000000000000000000000000..69b1603b1a900dfb7e30cd7ade8d5f945c48fc03 GIT binary patch literal 2460 zcmcIlO-vI(6nlAc2cFS|AaQMh{*(X13ekT~_zye@_BLWcmDeZ!#dTq(i`312)KfiTlv`eyDyfh&MJGDF?O`f&6vjdH#&L| zU)8_fUJ+??w`Nb1lpE^?_u4q-)Xle!to63T|!Z@D{l13l7v9x>rl<4!#Af7W1*+U0B#` z0Fw~gqNO3{S%43ko+hBumVKsXDDNw3f9r2sdGtN@fp-Nb(?`_SvC`@IN}z4FBgC}S zHkNJ2OYW#eD9-JSddA%IedeDS2tKspDfGxULJGRnlGl$bE)Ou+b zzZ$Av^o5-Eu?F*Dt|6LvmhV>YTV8f8?#6S9rm{{UVm5r9#qjH+372Nk@`sKu+g;t- zxL+AGrNcGlj(QBetYrD|aj)4}Nuf@dM*NOl{os$`qW52)F zwmg{}Ni$_jk~x!8N|O;FTeb77%L&jz$+u4Ph}KPN-QS=!;`H8^MgSQznF=&QPQ2PW zfS5Y7{4#@>vd#g+6wE=Z1t40|3oOVeMgWj3bjM0N3@iXR_87XO3MW+HLQT7x{dVy9dNhYGS$&?C8&j5H?+LZJm?ah=>MFkS` u)4ix6|G_$)MpZkfuX9uBD%I3!wUhd0YU=bUwE9-(Q>O=}9y+TL?)?FeWW1dK literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/icons/zoom.gif b/lib/maracasVisuLib/src/interface/tcl/icons/zoom.gif new file mode 100644 index 0000000000000000000000000000000000000000..9211b1f1938e0908e1dc47ec487ed31943ef525a GIT binary patch literal 1532 zcmaJ>F>l&H6n-veDNBQdjl{rU6b~6X(AcUR)vY`P!c~B9=??%Qp{|iSS4NS#)v2zN zxBP_ugs4O4K$Qgg1CZ#@v8_9_3smpUJ`6=YAL#hLd*8kL{2r&Y?i}|`ID%gV;KLG+ zWr1Z`Lmbg?xUyE(Fv2I|pD3C{(P}b@CXn9BLe5&xdtQ6#PozZxryDI z*uBU-F$`KrZmwWdeDeHNd3+X(&)jeUj3mhfrV=jW@+o=BBOBu%PGBl;?$9&MpzzHd zbH)5mcN&-T1`Y0nFA6i2aqNDI-J1hCjomz+7t{wB2nH>D$2^dY-8?*F1nL6})aHOr z#qM3~=6|~YcqMPZT_esudI7>0w3RsfJ&~vqE&_Ba@tPLE33H{og|Aebqf;rX0RMUa zrFiX1xNv-35mtu_=W^kAgQ}|n(Gc7nd0R*Mp9HJ{Xd^O$kJy@8}! z+8+3N&DUx870;HGs22^8We3Om0B`%v*=DJ0BA1?h&HE@lZoQCwv_;8c+{8ySyIAw} z+QUtJL%b+M{t;icx;%2Hy4nfU+f4t+EJ?dtp*04w+65)lyA?WpXHvX*g0IC%gS{~6 zJz?e6UqDgqfZEY_`f@J%=)+obEpGBgvkxW07ec(qOQtCME9=X-N!e?Yemuf}Eo0vE nVw+wz*QuwMnW5;2os=_3nhk05-c~0P;fqwf=qY-Zs=(vFPBJz$ literal 0 HcmV?d00001 diff --git a/lib/maracasVisuLib/src/interface/tcl/marTcl.dsp b/lib/maracasVisuLib/src/interface/tcl/marTcl.dsp new file mode 100644 index 0000000..99ba8a0 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/tcl/marTcl.dsp @@ -0,0 +1,142 @@ +# Microsoft Developer Studio Project File - Name="marTcl" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=marTcl - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "marTcl.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "marTcl.mak" CFG="marTcl - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "marTcl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "marTcl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "marTcl - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../lib" +# PROP Intermediate_Dir "tmp" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MARTCL_EXPORTS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MARTCL_EXPORTS" /D "MAR_KERNEL_USING_DLL" /D "KGFO_USING_DLL" /D "__WIN95__" /D "__WXMSW__" /D WXUSINGDLL=1 /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40c /d "NDEBUG" +# ADD RSC /l 0x40c /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kgfo.lib tcl83.lib tk83.lib wxmsw240.lib vtkCommon.lib vtkCommonTCL.lib /nologo /dll /machine:I386 + +!ELSEIF "$(CFG)" == "marTcl - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../lib" +# PROP Intermediate_Dir "tmp" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MARTCL_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "__WIN95__" /D "__WXMSW__" /D WXUSINGDLL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MARTCL_EXPORTS" /D "MAR_KERNEL_USING_DLL" /D "KGFO_USING_DLL" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40c /d "_DEBUG" +# ADD RSC /l 0x40c /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kgfo.lib tcl83.lib tk83.lib wxmsw240d.lib vtkCommon.lib vtkCommonTCL.lib /nologo /dll /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "marTcl - Win32 Release" +# Name "marTcl - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\wrap_maracas.cxx +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=..\lib\marKernel.lib +# End Source File +# End Group +# Begin Group "Swig Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\wrap_maracas.i + +!IF "$(CFG)" == "marTcl - Win32 Release" + +# Begin Custom Build +InputPath=.\wrap_maracas.i + +"wrap_maracas.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + C:\Swig1.1\swig.exe -tcl8 -c++ -o wrap_maracas.cxx wrap_maracas.i + +# End Custom Build + +!ELSEIF "$(CFG)" == "marTcl - Win32 Debug" + +# Begin Custom Build +InputPath=.\wrap_maracas.i + +"wrap_maracas.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + C:\Swig1.1\swig.exe -tcl8 -c++ -o wrap_maracas.cxx wrap_maracas.i + +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# End Target +# End Project diff --git a/lib/maracasVisuLib/src/interface/tcl/marTclInterface.h b/lib/maracasVisuLib/src/interface/tcl/marTclInterface.h new file mode 100644 index 0000000..6291206 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/tcl/marTclInterface.h @@ -0,0 +1,469 @@ +#ifndef MAR__INTERFACE__TCL__HXX +#define MAR__INTERFACE__TCL__HXX + +#include "../kernel/marInterface.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// ---------------------------------------------------------------------------- +static marInterface MyMaracasData; +static kVolume* _ucharVol = NULL; + +// ---------------------------------------------------------------------------- +void freeAllMaracasInterfaces_dll( ) +{ + MyMaracasData.reset( ); + if( _ucharVol ) delete _ucharVol; + _ucharVol = NULL; +} + +// ---------------------------------------------------------------------------- +wxStringList params_dll( ) +{ + return( MyMaracasData._parameters->getRelationalArray( ) ); + +} + +// ---------------------------------------------------------------------------- +void setParams_dll( wxStringList& raParams ) +{ + MyMaracasData._parameters->setRelationalArray( raParams ); + +} + +// ---------------------------------------------------------------------------- +bool saveParams_dll( std::string& fName ) +{ + return( MyMaracasData.saveParameters( std::string( fName ) ) ); + +} + +// ---------------------------------------------------------------------------- +bool loadParams_dll( std::string& fName ) +{ + return( MyMaracasData.loadParameters( std::string( fName ) ) ); + +} + +// ---------------------------------------------------------------------------- +void SetROIStep_dll( double vWidth ) +{ + MyMaracasData._parameters->setROIStep( vWidth ); + +} + +// ---------------------------------------------------------------------------- +double GetActualVoxelSize_dll( ) { + + return( MyMaracasData._parameters->getVoxelSize( ) ); + +} + +// ---------------------------------------------------------------------------- +wxStringList studies_dll( ) +{ + return( MyMaracasData._dicom->getStudies( ) ); +} + +// ---------------------------------------------------------------------------- +wxStringList studyData_dll( std::string& study ) +{ + MyMaracasData._dicom->setActualStudy( study ); + return( MyMaracasData._dicom->getRelationalArrayStudyData( ) ); + +} + +// ---------------------------------------------------------------------------- +wxStringList series_dll( std::string& study ) +{ + MyMaracasData._dicom->setActualStudy( study ); + return( MyMaracasData._dicom->getSeries( ) ); + +} + +// ---------------------------------------------------------------------------- +wxStringList serieData_dll( std::string& study, std::string& serie ) +{ + MyMaracasData._dicom->setActualStudy( study ); + MyMaracasData._dicom->setActualSerie( serie ); + return( MyMaracasData._dicom->getRelationalArraySerieData( ) ); + +} + +// ---------------------------------------------------------------------------- +void SubtractSeries_dll( std::string& sl, std::string& sr, std::string& ss, std::string& description ) +{/* + marDicom::SubtractSeries( + MyMaracasData._parameters, + MyMaracasData._dicom->getActualStudy( ), + sl, sr, + ss, description + ); + */ +} + +// ---------------------------------------------------------------------------- +bool LoadImages_dll( ) +{ + MyMaracasData._dicom->loadActualSerie( ); + return( true ); + +} + +// ---------------------------------------------------------------------------- +void CastVolume_dummy( ) +{ + if( _ucharVol ) delete _ucharVol; + _ucharVol = new kVolume( *( MyMaracasData._dicom->getVolume( ) ) ); + + _ucharVol->convertScale( kVolume::UCHAR, 0, 255 ); + +} + +// ---------------------------------------------------------------------------- +void LoadTkImage_dummy( uchar** image, int w, int h, + std::string& tkName, Tcl_Interp* interp ) +{ + Tk_PhotoHandle hnd; + Tk_PhotoImageBlock bl; + + hnd = Tk_FindPhoto( interp, ( char* )tkName.c_str( ) ); + if( hnd != NULL ) { + + // Image size + bl.width = w; + bl.height = h; + + // One pixel is represented with one unsigned short value + bl.pixelSize = sizeof( uchar ); + + // We're working on intensity images i.e. no RGB + bl.offset[ 0 ] = 0; + bl.offset[ 1 ] = 0; + bl.offset[ 2 ] = 0; + bl.offset[ 3 ] = 0; + + // To go to next in vertical value + bl.pitch = bl.pixelSize * bl.width; + + // Menory block + bl.pixelPtr = ( uchar* )image[ 0 ]; + + // Ok, lets do it! + Tk_PhotoPutBlock( hnd, &bl, 0, 0, bl.width, bl.height ); + + } // fi + +} + +// ---------------------------------------------------------------------------- +void LoadTkImages_dll( wxStringList& tkNames, Tcl_Interp* interp ) +{ + int k, w, h, d; + std::string tmp; + + w = MyMaracasData._dicom->getVolume( )->getXdim( ); + h = MyMaracasData._dicom->getVolume( )->getYdim( ); + d = MyMaracasData._dicom->getVolume( )->getZdim( ); + + CastVolume_dummy( ); + uchar*** vol = ( uchar*** )( _ucharVol->getData3D( ) ); + for( k = 0; k < d; k++ ) { + + tmp = tkNames[ k ]; + LoadTkImage_dummy( vol[ k ], + w, h, tmp, interp ); + + } // rof + +} + +// ---------------------------------------------------------------------------- +int GetNumberOfImages_dll( ) +{ + return( MyMaracasData._dicom->getVolume( )->getZdim( ) ); + +} + +// ---------------------------------------------------------------------------- +wxStringList GetImagesNumbers_dll( ) +{ + return( MyMaracasData._dicom->getImageNumbers( ) ); + +} + +// ---------------------------------------------------------------------------- +double GetImageIntensity_dll( int x, int y, int z ) +{ + return( MyMaracasData._dicom->getVolume( )->getPixel( x, y, z ) ); + +} + +// ---------------------------------------------------------------------------- +ushort* GetProfilFromTotalVolume_dll( int xO, int yO, int zO, + int xF, int yF, int zF ) +{ + int i; + kVolumeStat* stats = new kVolumeStat( MyMaracasData._dicom-> + getVolume( ) ); + + stats->profile( xO, yO, zO, xF, yF, zF ); + + ushort* r = new ushort[ stats->getSize( ) + 6 ]; + + r[ 0 ] = stats->getSize( ) + 6; + r[ 1 ] = ( ushort )stats->getMin( ); + r[ 2 ] = ( ushort )stats->getMax( ); + r[ 3 ] = ( ushort )stats->getAvg( ); + r[ 4 ] = ( ushort )stats->getSD( ); + r[ 5 ] = ( ushort )stats->getSize( ); + for( i = 0; i < stats->getSize( ); i++ ) + r[ i + 6 ] = ( ushort )( stats->getValues( ) )[ i ]; + return( r ); + +} + +// ---------------------------------------------------------------------------- +void GetAreaValuesFromTotalVolume_dll( int xO, int yO, int zO, + int xF, int yF, int zF, + int* min, int* max, int* avg, + int* sd, int* size ) +{ + kVolumeStat* stats = new kVolumeStat( MyMaracasData._dicom->getVolume( ) ); + + stats->stats( xO, yO, zO, xF, yF, zF ); + + *min = ( int )stats->getMin( ); + *max = ( int )stats->getMax( ); + *avg = ( int )stats->getAvg( ); + *sd = ( int )stats->getSD( ); + *size = stats->getSize( ); + +} + +// ---------------------------------------------------------------------------- +bool SaveExperiment_dll ( std::string& fName ) +{ + return( MyMaracasData.saveExperiment( fName ) ); + +} + +// ---------------------------------------------------------------------------- +bool LoadExperiment_dll ( std::string& fName ) +{ + return( MyMaracasData.loadExperiment( fName ) ); + +} + +// ---------------------------------------------------------------------------- +void InitExperiment_dll ( int* voi ) +{ + MyMaracasData._experiment->setVOI( voi ); + MyMaracasData._experiment->initExperiment( MyMaracasData._dicom-> + getVolume( ) ); + //if( _ucharVol ) delete _ucharVol; + //_ucharVol = NULL; + MyMaracasData._dicom->freeVolume( ); +} + +// ---------------------------------------------------------------------------- +void SetStartPoint_dll( int x, int y, int z ) +{ + MyMaracasData._experiment->setStartPoint( x, y, z ); +} + +// ---------------------------------------------------------------------------- +void ExtractAxes_dll( ) +{ + MyMaracasData._experiment->extractVascularTree( ); +} + +// ---------------------------------------------------------------------------- +int GetNumberOfAxes_dll( ) +{ + return( MyMaracasData._experiment->getNumberOfAxes( ) ); +} + +// ---------------------------------------------------------------------------- +vtkPolyData* GetAllAxes_dll( ) +{ + int i, n, j; + double p[ marAxis::INDX_count ]; + marAxis* tmp; + + vtkPoints* allPoints = vtkPoints::New( ); + vtkCellArray* allTopology = vtkCellArray::New( ); + + j = 0; + for( n = 0; n < MyMaracasData._experiment->getNumberOfAxes( ); n++ ) { + + tmp = MyMaracasData._experiment->getAxis( ); + allTopology->InsertNextCell( tmp->getNumberOfControlPoints( ) ); + for( i = 0; i < tmp->getNumberOfControlPoints( ); i++ ) { + + tmp->getControlPoint( i, p, p + 3 ); + allPoints->InsertNextPoint( p[ 0 ], p[ 1 ], p[ 2 ] ); + allTopology->InsertCellPoint( j ); + j++; + + } // rof + + } // rof + + vtkPolyData* allData = vtkPolyData::New( ); + allData->SetPoints( allPoints ); + allData->SetLines( allTopology ); + + allPoints->Delete(); + allTopology->Delete(); + + return( allData ); + +} + +// ---------------------------------------------------------------------------- +vtkPolyData* GetActualAxis_dll( ) +{ + int i, j, h; + double p[ marAxis::INDX_count ]; + marAxis* tmp; + + vtkPoints* points = vtkPoints::New( ); + vtkCellArray* topology = vtkCellArray::New( ); + + j = 0; + h = MyMaracasData._experiment->getDynData( )->getVolume( )->getYdim( ); + tmp = MyMaracasData._experiment->getAxis( ); + topology->InsertNextCell( tmp->getNumberOfControlPoints( ) ); + for( i = 0; i < tmp->getNumberOfControlPoints( ); i++ ) { + + tmp->getControlPoint( i, p, p + 3 ); + topology->InsertCellPoint( j++ ); + points->InsertNextPoint( p[ 0 ], h - 1 - p[ 1 ], p[ 2 ] ); + + } // rof + + vtkPolyData* data = vtkPolyData::New( ); + data->SetPoints( points ); + data->SetLines( topology ); + + points->Delete(); + topology->Delete(); + + return( data ); +} + +// ---------------------------------------------------------------------------- +int GetActualAxisNumberOfPoints_dll( ) +{ + return( MyMaracasData._experiment->getAxis( )->getNumberOfControlPoints( ) ); + +} + +// ---------------------------------------------------------------------------- +double* GetActualAxisPoint_dll( int i ) +{ + double* ret = new double[ marAxis::INDX_count + 1 ]; + + ret[ 0 ] = marAxis::INDX_count; + MyMaracasData._experiment->getAxis( )->getControlPoint( i, ret + 1, ret + 4 ); + return( ret ); +} + +// ---------------------------------------------------------------------------- +vtkImageData* GetActualAxisSlice_dll( int i ) +{ + // return( MyMaracasData._experiment->GetSliceImage( i ) ); + return( NULL ); + +} + +// ---------------------------------------------------------------------------- +void PrepareQuantification_dll( int i ) +{ + /* + MyMaracasData._experiment->SetAxis( i ); + MyMaracasData._experiment->PrepareQuantification( ); + */ +} + +// ---------------------------------------------------------------------------- +double GetAxisLength_dll( ) +{ + return( MyMaracasData._experiment->getAxis( )->length( ) ); + +} + +// ---------------------------------------------------------------------------- +void GetImageRange_dll( int* min, int* max ) +{ + double m, M; + + MyMaracasData._experiment->getDynData( )->getVolume( )->getMinMax( m, M ); + *min = ( int )m; + *max = ( int )M; + +} + +// ---------------------------------------------------------------------------- +vtkImageData* GetVTKVolume_dll( ) +{ + return( MyMaracasData._experiment->getDynData( )->getVolume( )->castVtk( ) ); + +} + +// ---------------------------------------------------------------------------- +int IntersectWithLine_dll( + vtkCellLocator* iCellLocator, + double x1, double y1, double z1, + double x2, double y2, double z2, + double tol, double *xI, double *yI, double *zI + ) +{ + float a0[ 3 ], a1[ 3 ], x[ 3 ], t, pcoords[ 3 ]; + int subId; + + int returnVal; + + iCellLocator->Update( ); + + a0[ 0 ] = x1; a0[ 1 ] = y1; a0[ 2 ] = z1; + a1[ 0 ] = x2; a1[ 1 ] = y2; a1[ 2 ] = z2; + + returnVal = iCellLocator->IntersectWithLine( a0, a1, tol, t, x, pcoords, subId ); + ( *xI ) = x[ 0 ]; ( *yI ) = x[ 1 ]; ( *zI ) = x[ 2 ]; + + return( returnVal ); +} + +// ---------------------------------------------------------------------------- +void TclPerpendiculars_dll( + double xN, double yN, double zN, double angle, + double *xP1, double *yP1, double *zP1, + double *xP2, double *yP2, double *zP2 + ) +{ + double x[ 3 ], y[ 3 ], z[ 3 ]; + vtkMath* math; + + x[ 0 ] = xN; x[ 1 ] = yN; x[ 2 ] = zN; + math = vtkMath::New( ); + math->Perpendiculars( x, y, z,angle ); + ( *xP1 ) = y[ 0 ]; ( *yP1 ) = y[ 1 ]; ( *zP1 ) = y[ 2 ]; + ( *xP2 ) = z[ 0 ]; ( *yP2 ) = z[ 1 ]; ( *zP2 ) = z[ 2 ]; + math->Delete( ); +} + +#endif // MAR__INTERFACE__TCL__HXX + +// EOF - interfaceTCL.hxx diff --git a/lib/maracasVisuLib/src/interface/tcl/maracas_start.tcl b/lib/maracasVisuLib/src/interface/tcl/maracas_start.tcl new file mode 100644 index 0000000..bf46cde --- /dev/null +++ b/lib/maracasVisuLib/src/interface/tcl/maracas_start.tcl @@ -0,0 +1,42 @@ +# Tcl/Tk code loading +source ./general.tcl +source ./string_table.tcl +source ./tkwidgets/combobox.tcl +source ./tkwidgets/mclistbox.tcl +source ./tkwidgets/ibrowser.tcl +source ./tkwidgets/imagepp.tcl +#source ./to_change/vtkInt.tcl +source ./to_change/WidgetObject.tcl +source ./to_change/volTkInteractor.tcl +source ./to_change/TkImageViewerInteractor.tcl +source ./to_change/ev_userzoom.tcl +source ./windows/to_change/wizardpostcontour.tcl +source ./windows/to_change/wizardpostaxis.tcl +source ./windows/dlg_name_axis.tcl +source ./windows/help_wnd.tcl +source ./windows/subtract.tcl +source ./windows/choose_direction.tcl +source ./windows/dlg_params.tcl +source ./windows/global_window.tcl +source ./windows/data_browser.tcl +source ./windows/image_browser.tcl +source ./windows/u_3D.tcl +source ./windows/u_mpr.tcl +source ./windows/u_mip.tcl +source ./windows/u_surf.tcl +source ./windows/planes_window.tcl + +# Package invocation +package require vtk +package require BLT + +# Namespace includes +catch { namespace import blt::* } +catch { namespace import data_model::* } +catch { namespace import data_browser::* } +catch { namespace import global_window::* } + +# Start maracas +global_window::show ../icons + +# eof - maracas_start.tcl diff --git a/lib/maracasVisuLib/src/interface/tcl/string_table.tcl b/lib/maracasVisuLib/src/interface/tcl/string_table.tcl new file mode 100644 index 0000000..19b7191 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/tcl/string_table.tcl @@ -0,0 +1,185 @@ + +namespace eval string_table { + + variable str_3D_back_color {3D world background color:} + variable str_accept_changes {Accept changes?} + variable str_algorithm {Algorithm} + variable str_all_slices_selected {All slices selected by default?} + variable str_area {Area} + variable str_avg {Average} + variable str_axial {Axial} + variable str_axis {Axis} + variable str_axis_color {Axis color:} + variable str_axis_step {Axis discret step (1/N):} + variable str_bright {bright} + variable str_browse {Browse...} + variable str_calculate_mip_default {Calculate MIP default?} + variable str_calculated {Contour calculated} + variable str_cancel {Cancel} + variable str_choose_a_file {Choose a file} + variable str_choose_order {Choose order} + variable str_chooseadirectory {chooseadirectory} + variable str_choose_a_name {Choose a name...} + variable str_clean {clean} + variable str_clean_contours {Recalculate contours} + variable str_coef_ballon {Ballon coeficient:} + variable str_coef_cell {Cell coeficient:} + variable str_coef_flex {Flexion coeficient:} + variable str_coef_extern {Extern coeficient:} + variable str_coef_grad {Gradient coeficient:} + variable str_coef_pas {Step coeficient (1/N):} + variable str_coef_tension {Tension coeficient:} + variable str_color {Color} + variable str_colormap {Colormap} + variable str_console_window_visible {Console window visible?} + variable str_contour {Contour} + variable str_coronal {Coronal} + variable str_data_types {data types} + variable str_debug {Debug} + variable str_debug_window_visible {Debug window visible?} + variable str_delta {Delta:} + variable str_description {Description} + variable str_diam_area {Diameter from area} + variable str_diam_avg {Average diameter} + variable str_diam_max {Maximum diameter} + variable str_diam_min {Minimum diameter} + variable str_diam_peri {Diameter from perimeter} + variable str_diameters {Diameters} + variable str_dim_voxel_x {Dimension VXx:} + variable str_dim_voxel_y {Dimension VXy:} + variable str_dim_voxel_z {Dimension VXz:} + variable str_directories {Configure Directories} + variable str_dist_int {Distance max. int:} + variable str_distance {Distance:} + variable str_distance_cdg {Distance cdg:} + variable str_edge {edge} + variable str_edge_points {Edge points} + variable str_erase_extracted_contours {Delete extracted contours?} + variable str_erase_quant {Delete quantification} + variable str_erase_quant_q {Delete all quantification?} + variable str_filled_contour {Filled contour} + variable str_general {General} + variable str_generate_new_axis {Generate a new axis?} + variable str_green_red {green red} + variable str_greyscale {Greyscale} + variable str_healthy_slice {Healthy slice} + variable str_if_name_exists_will_erase {This name already exists. Remplace it?} + variable str_images_directory {DICOM Images Directory:} + variable str_institution {Institution} + variable str_int {Intensity} + variable str_interpolation_type {Interpolation type} + variable str_isocontour {IsoContour} + variable str_isocontours {IsoContours} + variable str_isoval {isoval} + variable str_isovalue {isovalue} + variable str_iter {No. iterations:} + variable str_maracas_title {MARACAS - MAgnetic Resonance Angiography Computer ASsisted analysis} + variable str_mask_size {Mask size:} + variable str_mass_power {Mass power:} + variable str_max {Maximum} + variable str_min {Minimum} + variable str_mip {MIP} + variable str_mip_controls {MIP controls} + variable str_mm_length {Length(mm)} + variable str_mpr_controls {MPR controls} + variable str_mpr_type {MPR type} + variable str_near_neighbor {Near neighbor} + variable str_new_axis_name {New axis name:} + variable str_no_name_choose_yet {No name choose yet!} + variable str_nro_pix {Number of pixels} + variable str_ok {Ok} + variable str_opacity {Opacity} + variable str_opaque {Opaque} + variable str_partial_axis_delete {partial axis delete} + variable str_patient_id {Patient ID} + variable str_patient_name {Patient Name} + variable str_pause {Pause} + variable str_peri {Perimeter} + variable str_perpendicular_section {Perpendicular section} + variable str_play {Play} + variable str_please_select_a_different_point {please select a different point} + variable str_please_select_a_point {please select a point} + variable str_quantification {Quantification} + variable str_quant_will_be_erased {Quantification will be erased} + variable str_rec_surface {Reconstructed surface} + variable str_recalculate_contours {Recalculate any contour?} + variable str_red_blue {red blue} + variable str_refresh {Refresh} + variable str_rings_visible {Visible rings} + variable str_roi_dim {ROI dimension:} + variable str_sagital {Sagital} + variable str_sample {Sample:} + variable str_scale {Scale:} + variable str_select_the_segment_to_delete {select the segment to delete} + variable str_serie {Serie} + variable str_serie_bodypart {Body Part} + variable str_serie_date {Date} + variable str_serie_description {Description} + variable str_serie_diagnostic {Diagnostic} + variable str_serie_modality {Modality} + variable str_serie_name {Name} + variable str_serie_number {Number} + variable str_serie_time {Time} + variable str_series {Series} + variable str_showtype {Show type:} + variable str_show_surf {Show surface} + variable str_sigma {Sigma:} + variable str_slice {Slice} + variable str_slices {Slices} + variable str_snake {Snake} + variable str_snake_der {Snake + Deriche} + variable str_snake_iso {Snake + IsoContour} + variable str_std {Standard deviation} + variable str_stenosis_type {Stenosis type} + variable str_stenosis {Stenosis} + variable str_step {Step:} + variable str_stop_quantification {Stop quantification?} + variable str_study_date {Study Date} + variable str_study_id {Study ID} + variable str_study_name {Study Name} + variable str_study_time {Study Time} + variable str_subtract_series {subtract series} + variable str_sure_to_stop {sure to stop \n(stop/pause/continue)} + variable str_surface {Surface} + variable str_surface_color {Surface color:} + variable str_surface_values {Surface values} + variable str_threshold {Threshold:} + variable str_title_params {Parameters for MARACAS...} + variable str_transparent {Transparent} + variable str_trilinear {Trilinear} + variable str_user_defined {User configuration} + variable str_work_directory {Work Directory:} + variable str_renal {Renal} + variable str_aorta {Aorta} + variable str_carotid {Carotid} + variable str_llimbs {Lower Limbs} + variable str_yes {Yes} + variable str_no {No} + + variable str_postcontour_wizard {Post-Contour Wizard...} + + variable str_postaxis_wizard {Post-Axis Wizard...} + variable str_artery_types {Artery types} + variable str_questions {Questions} + variable str_other {Other} + variable str_correct_result {Correct results?} + variable str_out_of_lumen {Out of lumen?} + variable str_not_centered {Not centered?} + variable str_zig_zag_axis {Zig-zag axis?} + variable str_out_of_bifurcation {Out of bifurcation?} + variable str_out_of_curve {Out of curve?} + variable str_jump_to_vein {Jump to vein?} + variable str_overestimated {Over-estimated?} + variable str_underestimated {Under-estimated?} + variable str_extraconcave {Extraconcave?} + variable str_more_than_one_artery {More than one artery?} + variable str_minimum_voxel {Minimum voxel} + variable str_normal_voxel {Normal voxel} + + variable str_coef_cell_max_int {Cell Max. Int. Coef (1/N):} + variable str_show_cell {Show cell?} + variable str_show_i_cell {Show intensity cell?} + +} + +# EOF - string_table.tcl diff --git a/lib/maracasVisuLib/src/interface/tcl/tclexe.dsp b/lib/maracasVisuLib/src/interface/tcl/tclexe.dsp new file mode 100644 index 0000000..1ad8785 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/tcl/tclexe.dsp @@ -0,0 +1,241 @@ +# Microsoft Developer Studio Project File - Name="tclexe" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=tclexe - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "tclexe.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "tclexe.mak" CFG="tclexe - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "tclexe - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "tclexe - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "tclexe - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../bin" +# PROP Intermediate_Dir "tmp" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /u /D "NDEBUG" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40c /d "NDEBUG" +# ADD RSC /l 0x40c /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /machine:I386 /nodefaultlib /out:"./maracas.exe" +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=Installing... +PostBuild_Cmds=copy *.exe C:\Users\Florez\local\bin +# End Special Build Tool + +!ELSEIF "$(CFG)" == "tclexe - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../bin" +# PROP Intermediate_Dir "tmp" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /u /D "_DEBUG" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40c /d "_DEBUG" +# ADD RSC /l 0x40c /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib /out:"./maracas.exe" /pdbtype:sept +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=Installing... +PostBuild_Cmds=copy *.exe C:\Users\Florez\local\bin +# End Special Build Tool + +!ENDIF + +# Begin Target + +# Name "tclexe - Win32 Release" +# Name "tclexe - Win32 Debug" +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Group "Tcl Files" + +# PROP Default_Filter "" +# Begin Group "tkwidgets" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\tkwidgets\combobox.tcl +# End Source File +# Begin Source File + +SOURCE=.\tkwidgets\ibrowser.tcl +# End Source File +# Begin Source File + +SOURCE=.\tkwidgets\imagepp.tcl +# End Source File +# Begin Source File + +SOURCE=.\tkwidgets\mclistbox.tcl +# End Source File +# End Group +# Begin Group "to_change" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\to_change\ev_userzoom.tcl +# End Source File +# Begin Source File + +SOURCE=.\to_change\TkImageViewerInteractor.tcl +# End Source File +# Begin Source File + +SOURCE=.\to_change\TkInteractor.tcl +# End Source File +# Begin Source File + +SOURCE=.\to_change\volTkInteractor.tcl +# End Source File +# Begin Source File + +SOURCE=.\to_change\vtkInt.tcl +# End Source File +# Begin Source File + +SOURCE=.\to_change\WidgetObject.tcl +# End Source File +# End Group +# Begin Group "windows" + +# PROP Default_Filter "" +# Begin Group "to_change No. 1" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\windows\to_change\wizardpostaxis.tcl +# End Source File +# Begin Source File + +SOURCE=.\windows\to_change\wizardpostcontour.tcl +# End Source File +# End Group +# Begin Source File + +SOURCE=.\windows\choose_direction.tcl +# End Source File +# Begin Source File + +SOURCE=.\windows\data_browser.tcl +# End Source File +# Begin Source File + +SOURCE=.\windows\dlg_name_axis.tcl +# End Source File +# Begin Source File + +SOURCE=.\windows\dlg_params.tcl +# End Source File +# Begin Source File + +SOURCE=.\windows\global_window.tcl +# End Source File +# Begin Source File + +SOURCE=.\windows\help_wnd.tcl +# End Source File +# Begin Source File + +SOURCE=.\windows\image_browser.tcl +# End Source File +# Begin Source File + +SOURCE=.\windows\planes_window.tcl +# End Source File +# Begin Source File + +SOURCE=.\windows\subtract.tcl +# End Source File +# Begin Source File + +SOURCE=.\windows\u_3D.tcl +# End Source File +# Begin Source File + +SOURCE=.\windows\u_mip.tcl +# End Source File +# Begin Source File + +SOURCE=.\windows\u_mpr.tcl +# End Source File +# Begin Source File + +SOURCE=.\windows\u_surf.tcl +# End Source File +# End Group +# Begin Source File + +SOURCE=.\general.tcl +# End Source File +# Begin Source File + +SOURCE=.\maracas_start.tcl +# End Source File +# Begin Source File + +SOURCE=.\maracas_w32.tcl +# End Source File +# Begin Source File + +SOURCE=.\string_table.tcl +# End Source File +# End Group +# End Target +# End Project diff --git a/lib/maracasVisuLib/src/interface/tcl/tkwidgets/Makefile.am b/lib/maracasVisuLib/src/interface/tcl/tkwidgets/Makefile.am new file mode 100644 index 0000000..4809fb3 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/tcl/tkwidgets/Makefile.am @@ -0,0 +1,9 @@ +## Makefile.am -- Process this file with automake to produce Makefile.in + +EXTRA_DIST = \ + combobox.tcl \ + ibrowser.tcl \ + imagepp.tcl \ + mclistbox.tcl + +## eof - Makefile.am diff --git a/lib/maracasVisuLib/src/interface/tcl/tkwidgets/Makefile.in b/lib/maracasVisuLib/src/interface/tcl/tkwidgets/Makefile.in new file mode 100644 index 0000000..6705062 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/tcl/tkwidgets/Makefile.in @@ -0,0 +1,224 @@ +# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = ../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AS = @AS@ +CC = @CC@ +CFLAGS_DEBUG = @CFLAGS_DEBUG@ +CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@ +CFLAGS_WARNING = @CFLAGS_WARNING@ +CPP = @CPP@ +CXX = @CXX@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +GSL_CFLAGS = @GSL_CFLAGS@ +GSL_CONFIG = @GSL_CONFIG@ +GSL_LIBS = @GSL_LIBS@ +IDO_CFLAGS = @IDO_CFLAGS@ +IDO_LIBS = @IDO_LIBS@ +KGFO_CFLAGS = @KGFO_CFLAGS@ +KGFO_CONFIG = @KGFO_CONFIG@ +KGFO_LIBS = @KGFO_LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +MAKEINFO = @MAKEINFO@ +MARACAS_ALGORITHM_VER = @MARACAS_ALGORITHM_VER@ +MARACAS_ALGORITHM_VER_STR = @MARACAS_ALGORITHM_VER_STR@ +MARACAS_KERNEL_VER = @MARACAS_KERNEL_VER@ +MARACAS_KERNEL_VER_STR = @MARACAS_KERNEL_VER_STR@ +MARACAS_TCL_VER = @MARACAS_TCL_VER@ +MARACAS_TCL_VER_STR = @MARACAS_TCL_VER_STR@ +MARACAS_VER = @MARACAS_VER@ +MARACAS_VER_STR = @MARACAS_VER_STR@ +MATH_LIBS = @MATH_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +TCLTK_LIBS = @TCLTK_LIBS@ +TCL_BIN_DIR = @TCL_BIN_DIR@ +TCL_INC_DIR = @TCL_INC_DIR@ +TCL_LIBS = @TCL_LIBS@ +TCL_LIB_FILE = @TCL_LIB_FILE@ +TCL_SRC_DIR = @TCL_SRC_DIR@ +TK_BIN_DIR = @TK_BIN_DIR@ +TK_INC_DIR = @TK_INC_DIR@ +TK_LIB_FILE = @TK_LIB_FILE@ +TK_SRC_DIR = @TK_SRC_DIR@ +VERSION = @VERSION@ +VTK_CFLAGS = @VTK_CFLAGS@ +VTK_LIBS = @VTK_LIBS@ +WX_CFLAGS = @WX_CFLAGS@ +WX_CONFIG = @WX_CONFIG@ +WX_LIBS = @WX_LIBS@ + +EXTRA_DIST = combobox.tcl ibrowser.tcl imagepp.tcl mclistbox.tcl + +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../config.h +CONFIG_CLEAN_FILES = +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu tcl/tkwidgets/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = tcl/tkwidgets + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu tcl/tkwidgets/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: tags distdir info-am info dvi-am dvi check check-am \ +installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/maracasVisuLib/src/interface/tcl/tkwidgets/combobox.tcl b/lib/maracasVisuLib/src/interface/tcl/tkwidgets/combobox.tcl new file mode 100644 index 0000000..4f008e3 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/tcl/tkwidgets/combobox.tcl @@ -0,0 +1,1989 @@ +# Copyright (c) 1998-1999, Bryan Oakley +# All Rights Reservered +# +# Bryan Oakley +# oakley@channelpoint.com +# +# combobox v2.0b2 April 14, 1999 +# +# a combobox / dropdown listbox (pick your favorite name) widget +# written in pure tcl +# +# this code is freely distributable without restriction, but is +# provided as-is with no waranty expressed or implied. +# +# thanks to the following people who provided beta test support or +# patches to the code (in no particular order): +# +# Scott Beasley Alexandre Ferrieux Todd Helfter +# Matt Gushee Laurent Duperval John Jackson +# Fred Rapp Christopher Nelson +# Eric Galluzzo Jean-Francois Moine + +# A special thanks to Martin M. Hunt who provided several good ideas, +# and always with a patch to implement them. Jean-Francois Moine, +# Todd Helfter and John Jackson were also kind enough to send in some +# code patches. + +package require Tk 8.0 +package provide combobox 2.0 + +namespace eval ::combobox { + + # this is the public interface + namespace export combobox + + # these contain references to available options + variable widgetOptions + + # these contain references to available commands and subcommands + variable widgetCommands + variable scanCommands + variable listCommands + +} + +# ::combobox::combobox -- +# +# This is the command that gets exported. It creates a new +# combobox widget. +# +# Arguments: +# +# w path of new widget to create +# args additional option/value pairs (eg: -background white, etc.) +# +# Results: +# +# It creates the widget and sets up all of the default bindings +# +# Returns: +# +# The name of the newly create widget + +proc ::combobox::combobox {w args} { + variable widgetOptions + variable widgetCommands + variable scanCommands + variable listCommands + + # perform a one time initialization + if {![info exists widgetOptions]} { + Init + } + + # build it... + eval Build $w $args + + # set some bindings... + SetBindings $w + + # and we are done! + return $w +} + + +# ::combobox::Init -- +# +# Initialize the global (well, namespace) variables. This should +# only be called once, immediately prior to creating the first +# instance of the widget +# +# Arguments: +# +# none +# +# Results: +# +# All state variables are set to their default values; all of +# the option database entries will exist. +# +# Returns: +# +# empty string + +proc ::combobox::Init {} { + variable widgetOptions + variable widgetCommands + variable scanCommands + variable listCommands + variable defaultEntryCursor + + array set widgetOptions [list \ + -background {background Background} \ + -bd -borderwidth \ + -bg -background \ + -borderwidth {borderWidth BorderWidth} \ + -command {command Command} \ + -commandstate {commandState State} \ + -cursor {cursor Cursor} \ + -editable {editable Editable} \ + -fg -foreground \ + -font {font Font} \ + -foreground {foreground Foreground} \ + -height {height Height} \ + -highlightbackground {highlightBackground HighlightBackground} \ + -highlightcolor {highlightColor HighlightColor} \ + -highlightthickness {highlightThickness HighlightThickness} \ + -image {image Image} \ + -maxheight {maxHeight Height} \ + -relief {relief Relief} \ + -selectbackground {selectBackground Foreground} \ + -selectborderwidth {selectBorderWidth BorderWidth} \ + -selectforeground {selectForeground Background} \ + -state {state State} \ + -takefocus {takeFocus TakeFocus} \ + -textvariable {textVariable Variable} \ + -value {value Value} \ + -width {width Width} \ + -xscrollcommand {xScrollCommand ScrollCommand} \ + ] + + + set widgetCommands [list \ + bbox cget configure curselection \ + delete get icursor index \ + insert list scan selection \ + xview select toggle open \ + close \ + ] + + set listCommands [list \ + delete get \ + index insert size \ + ] + + set scanCommands [list mark dragto] + + # why check for the Tk package? This lets us be sourced into + # an interpreter that doesn't have Tk loaded, such as the slave + # interpreter used by pkg_mkIndex. In theory it should have no + # side effects when run + if {[lsearch -exact [package names] "Tk"] != -1} { + + ################################################################## + #- this initializes the option database. Kinda gross, but it works + #- (I think). + ################################################################## + + # the image used for the button... + if {$::tcl_platform(platform) == "windows"} { + image create bitmap ::combobox::bimage -data { + #define down_arrow_width 12 + #define down_arrow_height 12 + static char down_arrow_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xfc,0xf1,0xf8,0xf0,0x70,0xf0,0x20,0xf0, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00; + } + } + } else { + image create bitmap ::combobox::bimage -data { + #define down_arrow_width 15 + #define down_arrow_height 15 + static char down_arrow_bits[] = { + 0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80, + 0x00,0x80,0xf8,0x8f,0xf0,0x87,0xe0,0x83, + 0xc0,0x81,0x80,0x80,0x00,0x80,0x00,0x80, + 0x00,0x80,0x00,0x80,0x00,0x80 + } + } + } + + # compute a widget name we can use to create a temporary widget + set tmpWidget ".__tmp__" + set count 0 + while {[winfo exists $tmpWidget] == 1} { + set tmpWidget ".__tmp__$count" + incr count + } + + # get the scrollbar width. Because we try to be clever and draw our + # own button instead of using a tk widget, we need to know what size + # button to create. This little hack tells us the width of a scroll + # bar. + # + # NB: we need to be sure and pick a window that doesn't already + # exist... + scrollbar $tmpWidget + set sb_width [winfo reqwidth $tmpWidget] + destroy $tmpWidget + + # steal options from the entry widget + # we want darn near all options, so we'll go ahead and do + # them all. No harm done in adding the one or two that we + # don't use. + entry $tmpWidget + foreach foo [$tmpWidget configure] { + # the cursor option is special, so we'll save it in + # a special way + if {[lindex $foo 0] == "-cursor"} { + set defaultEntryCursor [lindex $foo 4] + } + if {[llength $foo] == 5} { + set option [lindex $foo 1] + set value [lindex $foo 4] + option add *Combobox.$option $value widgetDefault + + # these options also apply to the dropdown listbox + if {[string compare $option "foreground"] == 0 \ + || [string compare $option "background"] == 0 \ + || [string compare $option "font"] == 0} { + option add *Combobox*ComboboxListbox.$option $value \ + widgetDefault + } + } + } + destroy $tmpWidget + + # these are unique to us... + option add *Combobox.cursor {} + option add *Combobox.commandState normal widgetDefault + option add *Combobox.editable 1 widgetDefault + option add *Combobox.maxHeight 10 widgetDefault + option add *Combobox.height 0 + } + + # set class bindings + SetClassBindings +} + +# ::combobox::SetClassBindings -- +# +# Sets up the default bindings for the widget class +# +# this proc exists since it's The Right Thing To Do, but +# I haven't had the time to figure out how to do all the +# binding stuff on a class level. The main problem is that +# the entry widget must have focus for the insertion cursor +# to be visible. So, I either have to have the entry widget +# have the Combobox bindtag, or do some fancy juggling of +# events or some such. What a pain. +# +# Arguments: +# +# none +# +# Returns: +# +# empty string + +proc ::combobox::SetClassBindings {} { + + # make sure we clean up after ourselves... + bind Combobox [list ::combobox::DestroyHandler %W] + + # this will (hopefully) close (and lose the grab on) the + # listbox if the user clicks anywhere outside of it. Note + # that on Windows, you can click on some other app and + # the listbox will still be there, because tcl won't see + # that button click + set this {[::combobox::convert %W -W]} + bind Combobox "$this close" + bind Combobox "$this close" + + # this helps (but doesn't fully solve) focus issues. The general + # idea is, whenever the frame gets focus it gets passed on to + # the entry widget + bind Combobox {tkTabToWindow [::combobox::convert %W -W].entry} + + # this closes the listbox if we get hidden + bind Combobox {[::combobox::convert %W -W] close} + + return "" +} + +# ::combobox::SetBindings -- +# +# here's where we do most of the binding foo. I think there's probably +# a few bindings I ought to add that I just haven't thought +# about... +# +# I'm not convinced these are the proper bindings. Ideally all +# bindings should be on "Combobox", but because of my juggling of +# bindtags I'm not convinced thats what I want to do. But, it all +# seems to work, its just not as robust as it could be. +# +# Arguments: +# +# w widget pathname +# +# Returns: +# +# empty string + +proc ::combobox::SetBindings {w} { + upvar ::combobox::${w}::widgets widgets + upvar ::combobox::${w}::options options + + # juggle the bindtags. The basic idea here is to associate the + # widget name with the entry widget, so if a user does a bind + # on the combobox it will get handled properly since it is + # the entry widget that has keyboard focus. + bindtags $widgets(entry) \ + [concat $widgets(this) [bindtags $widgets(entry)]] + + bindtags $widgets(button) \ + [concat $widgets(this) [bindtags $widgets(button)]] + + # override the default bindings for tab and shift-tab. The + # focus procs take a widget as their only parameter and we + # want to make sure the right window gets used (for shift- + # tab we want it to appear as if the event was generated + # on the frame rather than the entry. I + + bind $widgets(entry) \ + "tkTabToWindow \[tk_focusNext $widgets(entry)\]; break" + bind $widgets(entry) \ + "tkTabToWindow \[tk_focusPrev $widgets(this)\]; break" + + # this makes our "button" (which is actually a label) + # do the right thing + bind $widgets(button) [list $widgets(this) toggle] + + # this lets the autoscan of the listbox work, even if they + # move the cursor over the entry widget. + bind $widgets(entry) "break" + + bind $widgets(listbox) \ + "::combobox::Select $widgets(this) \[$widgets(listbox) nearest %y\]; break" + + bind $widgets(vsb) {continue} + bind $widgets(vsb) {continue} + + bind $widgets(listbox) { + %W selection clear 0 end + %W activate @%x,%y + %W selection anchor @%x,%y + %W selection set @%x,%y @%x,%y + # need to do a yview if the cursor goes off the top + # or bottom of the window... (or do we?) + } + + # these events need to be passed from the entry + # widget to the listbox, or need some sort of special + # handling.... + foreach event [list \ + <1> \ + ] { + bind $widgets(entry) $event \ + "::combobox::HandleEvent $widgets(this) $event" + } + +} + +# ::combobox::Build -- +# +# This does all of the work necessary to create the basic +# combobox. +# +# Arguments: +# +# w widget name +# args additional option/value pairs +# +# Results: +# +# Creates a new widget with the given name. Also creates a new +# namespace patterened after the widget name, as a child namespace +# to ::combobox +# +# Returns: +# +# the name of the widget + +proc ::combobox::Build {w args } { + variable widgetOptions + + if {[winfo exists $w]} { + error "window name \"$w\" already exists" + } + + # create the namespace for this instance, and define a few + # variables + namespace eval ::combobox::$w { + + variable ignoreTrace 0 + variable oldFocus {} + variable oldGrab {} + variable oldValue {} + variable options + variable this + variable widgets + + set widgets(foo) foo ;# coerce into an array + set options(foo) foo ;# coerce into an array + + unset widgets(foo) + unset options(foo) + } + + # import the widgets and options arrays into this proc so + # we don't have to use fully qualified names, which is a + # pain. + upvar ::combobox::${w}::widgets widgets + upvar ::combobox::${w}::options options + + # this is our widget -- a frame of class Combobox. Naturally, + # it will contain other widgets. We create it here because + # we need it to be able to set our default options. + set widgets(this) [frame $w -class Combobox -takefocus 0] + set widgets(entry) [entry $w.entry -takefocus 1] + set widgets(button) [label $w.button -takefocus 0] + + # this defines all of the default options. We get the + # values from the option database. Note that if an array + # value is a list of length one it is an alias to another + # option, so we just ignore it + foreach name [array names widgetOptions] { + if {[llength $widgetOptions($name)] == 1} continue + set optName [lindex $widgetOptions($name) 0] + set optClass [lindex $widgetOptions($name) 1] + set value [option get $w $optName $optClass] + set options($name) $value + } + + # if -value is set to null, we'll remove it from our + # local array. The assumption is, if the user sets it from + # the option database, they will set it to something other + # than null (since it's impossible to determine the difference + # between a null value and no value at all). + if {[info exists options(-value)] \ + && [string length $options(-value)] == 0} { + unset options(-value) + } + + # we will later rename the frame's widget proc to be our + # own custom widget proc. We need to keep track of this + # new name, so we'll define and store it here... + set widgets(frame) ::combobox::${w}::$w + + # gotta do this sooner or later. Might as well do it now + pack $widgets(entry) -side left -fill both -expand yes + pack $widgets(button) -side right -fill y -expand no + + # I should probably do this in a catch, but for now it's + # good enough... What it does, obviously, is put all of + # the option/values pairs into an array. Make them easier + # to handle later on... + array set options $args + + # now, the dropdown list... the same renaming nonsense + # must go on here as well... + set widgets(popup) [toplevel $w.top] + set widgets(listbox) [listbox $w.top.list] + set widgets(vsb) [scrollbar $w.top.vsb] + + pack $widgets(listbox) -side left -fill both -expand y + + # fine tune the widgets based on the options (and a few + # arbitrary values...) + + # NB: we are going to use the frame to handle the relief + # of the widget as a whole, so the entry widget will be + # flat. This makes the button which drops down the list + # to appear "inside" the entry widget. + + $widgets(vsb) configure \ + -command "$widgets(listbox) yview" \ + -highlightthickness 0 + + $widgets(button) configure \ + -highlightthickness 0 \ + -borderwidth 1 \ + -relief raised \ + -width [expr {[winfo reqwidth $widgets(vsb)] - 2}] + + $widgets(entry) configure \ + -borderwidth 0 \ + -relief flat \ + -highlightthickness 0 + + $widgets(popup) configure \ + -borderwidth 1 \ + -relief sunken + + $widgets(listbox) configure \ + -selectmode browse \ + -background [$widgets(entry) cget -bg] \ + -yscrollcommand "$widgets(vsb) set" \ + -exportselection false \ + -borderwidth 0 + + +# trace variable ::combobox::${w}::entryTextVariable w \ +# [list ::combobox::EntryTrace $w] + + # do some window management foo on the dropdown window + wm overrideredirect $widgets(popup) 1 + wm transient $widgets(popup) [winfo toplevel $w] + wm group $widgets(popup) [winfo parent $w] + wm resizable $widgets(popup) 0 0 + wm withdraw $widgets(popup) + + # this moves the original frame widget proc into our + # namespace and gives it a handy name + rename ::$w $widgets(frame) + + # now, create our widget proc. Obviously (?) it goes in + # the global namespace. All combobox widgets will actually + # share the same widget proc to cut down on the amount of + # bloat. + proc ::$w {command args} \ + "eval ::combobox::WidgetProc $w \$command \$args" + + + # ok, the thing exists... let's do a bit more configuration. + if {[catch "::combobox::Configure $widgets(this) [array get options]" error]} { + catch {destroy $w} + error $error + } + + return "" + +} + +# ::combobox::HandleEvent -- +# +# this proc handles events from the entry widget that we want +# handled specially (typically, to allow navigation of the list +# even though the focus is in the entry widget) +# +# Arguments: +# +# w widget pathname +# event a string representing the event (not necessarily an +# actual event) + +proc ::combobox::HandleEvent {w event} { + upvar ::combobox::${w}::widgets widgets + upvar ::combobox::${w}::options options + upvar ::combobox::${w}::oldValue oldValue + + # for all of these events, if we have a special action we'll + # do that and do a "return -code break" to keep additional + # bindings from firing. Otherwise we'll let the event fall + # on through. + switch $event { + + "" { + # if the widget is editable, clear the selection. + # this makes it more obvious what will happen if the + # user presses (and helps our code know what + # to do if the user presses return) + if {$options(-editable)} { + $widgets(listbox) see 0 + $widgets(listbox) selection clear 0 end + $widgets(listbox) selection anchor 0 + $widgets(listbox) activate 0 + } + } + + "" { + set oldValue [$widgets(entry) get] + } + + "" { + if {![winfo ismapped $widgets(popup)]} { + # did the value change? +# set newValue [set ::combobox::${w}::entryTextVariable] + set newValue [$widgets(entry) get] + if {$oldValue != $newValue} { + CallCommand $widgets(this) $newValue + } + } + } + + "<1>" { + set editable [::combobox::GetBoolean $options(-editable)] + if {!$editable} { + if {[winfo ismapped $widgets(popup)]} { + $widgets(this) close + return -code break; + + } else { + if {$options(-state) != "disabled"} { + $widgets(this) open + return -code break; + } + } + } + } + + "" { + if {$options(-state) != "disabled"} { + $widgets(this) toggle + return -code break; + } + } + + "" { + if {[winfo ismapped $widgets(popup)]} { + ::combobox::Find $widgets(this) 0 + return -code break; + } else { + ::combobox::SetValue $widgets(this) [$widgets(this) get] + } + } + + "" { +# $widgets(entry) delete 0 end +# $widgets(entry) insert 0 $oldValue + if {[winfo ismapped $widgets(popup)]} { + $widgets(this) close + return -code break; + } + } + + "" { + # did the value change? +# set newValue [set ::combobox::${w}::entryTextVariable] + set newValue [$widgets(entry) get] + if {$oldValue != $newValue} { + CallCommand $widgets(this) $newValue + } + + if {[winfo ismapped $widgets(popup)]} { + ::combobox::Select $widgets(this) \ + [$widgets(listbox) curselection] + return -code break; + } + + } + + "" { + $widgets(listbox) yview scroll 1 pages + set index [$widgets(listbox) index @0,0] + $widgets(listbox) see $index + $widgets(listbox) activate $index + $widgets(listbox) selection clear 0 end + $widgets(listbox) selection anchor $index + $widgets(listbox) selection set $index + + } + + "" { + $widgets(listbox) yview scroll -1 pages + set index [$widgets(listbox) index @0,0] + $widgets(listbox) activate $index + $widgets(listbox) see $index + $widgets(listbox) selection clear 0 end + $widgets(listbox) selection anchor $index + $widgets(listbox) selection set $index + } + + "" { + if {[winfo ismapped $widgets(popup)]} { + tkListboxUpDown $widgets(listbox) 1 + return -code break; + + } else { + if {$options(-state) != "disabled"} { + $widgets(this) open + return -code break; + } + } + } + "" { + if {[winfo ismapped $widgets(popup)]} { + tkListboxUpDown $widgets(listbox) -1 + return -code break; + + } else { + if {$options(-state) != "disabled"} { + $widgets(this) open + return -code break; + } + } + } + } + + return "" +} + +# ::combobox::DestroyHandler {w} -- +# +# Cleans up after a combobox widget is destroyed +# +# Arguments: +# +# w widget pathname +# +# Results: +# +# The namespace that was created for the widget is deleted, +# and the widget proc is removed. + +proc ::combobox::DestroyHandler {w} { + + # if the widget actually being destroyed is of class Combobox, + # crush the namespace and kill the proc. Get it? Crush. Kill. + # Destroy. Heh. Danger Will Robinson! Oh, man! I'm so funny it + # brings tears to my eyes. + if {[string compare [winfo class $w] "Combobox"] == 0} { + upvar ::combobox::${w}::widgets widgets + upvar ::combobox::${w}::options options + + # delete the namespace and the proc which represents + # our widget + namespace delete ::combobox::$w + rename $w {} + } + + return "" +} + +# ::combobox::Find +# +# finds something in the listbox that matches the pattern in the +# entry widget and selects it +# +# N.B. I'm not convinced this is working the way it ought to. It +# works, but is the behavior what is expected? I've also got a gut +# feeling that there's a better way to do this, but I'm too lazy to +# figure it out... +# +# Arguments: +# +# w widget pathname +# exact boolean; if true an exact match is desired +# +# Returns: +# +# Empty string + +proc ::combobox::Find {w {exact 0}} { + upvar ::combobox::${w}::widgets widgets + upvar ::combobox::${w}::options options + + ## *sigh* this logic is rather gross and convoluted. Surely + ## there is a more simple, straight-forward way to implement + ## all this. As the saying goes, I lack the time to make it + ## shorter... + + # use what is already in the entry widget as a pattern + set pattern [$widgets(entry) get] + + if {[string length $pattern] == 0} { + # clear the current selection + $widgets(listbox) see 0 + $widgets(listbox) selection clear 0 end + $widgets(listbox) selection anchor 0 + $widgets(listbox) activate 0 + return + } + + # we're going to be searching this list... + set list [$widgets(listbox) get 0 end] + + # if we are doing an exact match, try to find, + # well, an exact match + set exactMatch -1 + if {$exact} { + set exactMatch [lsearch -exact $list $pattern] + } + + # search for it. We'll try to be clever and not only + # search for a match for what they typed, but a match for + # something close to what they typed. We'll keep removing one + # character at a time from the pattern until we find a match + # of some sort. + set index -1 + while {$index == -1 && [string length $pattern]} { + set index [lsearch -glob $list "$pattern*"] + if {$index == -1} { + regsub {.$} $pattern {} pattern + } + } + + # this is the item that most closely matches... + set thisItem [lindex $list $index] + + # did we find a match? If so, do some additional munging... + if {$index != -1} { + + # we need to find the part of the first item that is + # unique WRT the second... I know there's probably a + # simpler way to do this... + + set nextIndex [expr {$index + 1}] + set nextItem [lindex $list $nextIndex] + + # we don't really need to do much if the next + # item doesn't match our pattern... + if {[string match $pattern* $nextItem]} { + # ok, the next item matches our pattern, too + # now the trick is to find the first character + # where they *don't* match... + set marker [string length $pattern] + while {$marker <= [string length $pattern]} { + set a [string index $thisItem $marker] + set b [string index $nextItem $marker] + if {[string compare $a $b] == 0} { + append pattern $a + incr marker + } else { + break + } + } + } else { + set marker [string length $pattern] + } + + } else { + set marker end + set index 0 + } + + # ok, we know the pattern and what part is unique; + # update the entry widget and listbox appropriately + if {$exact && $exactMatch == -1} { + # this means we didn't find an exact match + $widgets(listbox) selection clear 0 end + $widgets(listbox) see $index + + } elseif {!$exact} { + # this means we found something, but it isn't an exact + # match. If we find something that *is* an exact match we + # don't need to do the following, since it would merely + # be replacing the data in the entry widget with itself + set oldstate [$widgets(entry) cget -state] + $widgets(entry) configure -state normal + $widgets(entry) delete 0 end + $widgets(entry) insert end $thisItem + $widgets(entry) selection clear + $widgets(entry) selection range $marker end + $widgets(listbox) activate $index + $widgets(listbox) selection clear 0 end + $widgets(listbox) selection anchor $index + $widgets(listbox) selection set $index + $widgets(listbox) see $index + $widgets(entry) configure -state $oldstate + } +} + +# ::combobox::Select -- +# +# selects an item from the list and sets the value of the combobox +# to that value +# +# Arguments: +# +# w widget pathname +# index listbox index of item to be selected +# +# Returns: +# +# empty string + +proc ::combobox::Select {w index} { + upvar ::combobox::${w}::widgets widgets + upvar ::combobox::${w}::options options + + catch { + set data [$widgets(listbox) get [lindex $index 0]] + ::combobox::SetValue $widgets(this) $data + + $widgets(listbox) selection clear 0 end + $widgets(listbox) selection anchor $index + $widgets(listbox) selection set $index + + $widgets(entry) selection range 0 end + } + + $widgets(this) close + + return "" +} + +# ::combobox::HandleScrollbar -- +# +# causes the scrollbar of the dropdown list to appear or disappear +# based on the contents of the dropdown listbox +# +# Arguments: +# +# w widget pathname +# action the action to perform on the scrollbar +# +# Returns: +# +# an empty string + +proc ::combobox::HandleScrollbar {w {action "unknown"}} { + upvar ::combobox::${w}::widgets widgets + upvar ::combobox::${w}::options options + + if {$options(-height) == 0} { + set hlimit $options(-maxheight) + } else { + set hlimit $options(-height) + } + + switch $action { + "grow" { + if {$hlimit > 0 && [$widgets(listbox) size] > $hlimit} { + pack $widgets(vsb) -side right -fill y -expand n + } + } + + "shrink" { + if {$hlimit > 0 && [$widgets(listbox) size] <= $hlimit} { + pack forget $widgets(vsb) + } + } + + "crop" { + # this means the window was cropped and we definitely + # need a scrollbar no matter what the user wants + pack $widgets(vsb) -side right -fill y -expand n + } + + default { + if {$hlimit > 0 && [$widgets(listbox) size] > $hlimit} { + pack $widgets(vsb) -side right -fill y -expand n + } else { + pack forget $widgets(vsb) + } + } + } + + return "" +} + +# ::combobox::ComputeGeometry -- +# +# computes the geometry of the popup list based on the size of the +# combobox... +# +# Arguments: +# +# w widget pathname +# +# Returns: +# +# the desired geometry of the listbox + +proc ::combobox::ComputeGeometry {w} { + upvar ::combobox::${w}::widgets widgets + upvar ::combobox::${w}::options options + + if {$options(-height) == 0 && $options(-maxheight) != "0"} { + # if this is the case, count the items and see if + # it exceeds our maxheight. If so, set the listbox + # size to maxheight... + set nitems [$widgets(listbox) size] + if {$nitems > $options(-maxheight)} { + # tweak the height of the listbox + $widgets(listbox) configure -height $options(-maxheight) + } else { + # un-tweak the height of the listbox + $widgets(listbox) configure -height 0 + } + update idletasks + } + + # compute height and width of the dropdown list + set bd [$widgets(popup) cget -borderwidth] + set height [expr {[winfo reqheight $widgets(popup)] + $bd + $bd}] + set width [winfo width $widgets(this)] + + # figure out where to place it on the screen, trying to take into + # account we may be running under some virtual window manager + set screenWidth [winfo screenwidth $widgets(this)] + set screenHeight [winfo screenheight $widgets(this)] + set rootx [winfo rootx $widgets(this)] + set rooty [winfo rooty $widgets(this)] + set vrootx [winfo vrootx $widgets(this)] + set vrooty [winfo vrooty $widgets(this)] + + # the x coordinate is simply the rootx of our widget, adjusted for + # the virtual window. We won't worry about whether the window will + # be offscreen to the left or right -- we want the illusion that it + # is part of the entry widget, so if part of the entry widget is off- + # screen, so will the list. If you want to change the behavior, + # simply change the if statement... (and be sure to update this + # comment!) + set x [expr {$rootx + $vrootx}] + if {0} { + set rightEdge [expr {$x + $width}] + if {$rightEdge > $screenWidth} { + set x [expr {$screenWidth - $width}] + } + if {$x < 0} {set x 0} + } + + # the y coordinate is the rooty plus vrooty offset plus + # the height of the static part of the widget plus 1 for a + # tiny bit of visual separation... + set y [expr {$rooty + $vrooty + [winfo reqheight $widgets(this)] + 1}] + set bottomEdge [expr {$y + $height}] + + if {$bottomEdge >= $screenHeight} { + # ok. Fine. Pop it up above the entry widget isntead of + # below. + set y [expr {($rooty - $height - 1) + $vrooty}] + + if {$y < 0} { + # this means it extends beyond our screen. How annoying. + # Now we'll try to be real clever and either pop it up or + # down, depending on which way gives us the biggest list. + # then, we'll trim the list to fit and force the use of + # a scrollbar + + # (sadly, for windows users this measurement doesn't + # take into consideration the height of the taskbar, + # but don't blame me -- there isn't any way to detect + # it or figure out its dimensions. The same probably + # applies to any window manager with some magic windows + # glued to the top or bottom of the screen) + + if {$rooty > [expr {$screenHeight / 2}]} { + # we are in the lower half of the screen -- + # pop it up. Y is zero; that parts easy. The height + # is simply the y coordinate of our widget, minus + # a pixel for some visual separation. The y coordinate + # will be the topof the screen. + set y 1 + set height [expr {$rooty - 1 - $y}] + + } else { + # we are in the upper half of the screen -- + # pop it down + set y [expr {$rooty + $vrooty + \ + [winfo reqheight $widgets(this)] + 1}] + set height [expr {$screenHeight - $y}] + + } + + # force a scrollbar + HandleScrollbar $widgets(this) crop + } + } + + if {$y < 0} { + # hmmm. Bummer. + set y 0 + set height $screenheight + } + + set geometry [format "=%dx%d+%d+%d" $width $height $x $y] + + return $geometry +} + +# ::combobox::DoInternalWidgetCommand -- +# +# perform an internal widget command, then mung any error results +# to look like it came from our megawidget. A lot of work just to +# give the illusion that our megawidget is an atomic widget +# +# Arguments: +# +# w widget pathname +# subwidget pathname of the subwidget +# command subwidget command to be executed +# args arguments to the command +# +# Returns: +# +# The result of the subwidget command, or an error + +proc ::combobox::DoInternalWidgetCommand {w subwidget command args} { + upvar ::combobox::${w}::widgets widgets + upvar ::combobox::${w}::options options + + set subcommand $command + set command [concat $widgets($subwidget) $command $args] + if {[catch $command result]} { + # replace the subwidget name with the megawidget name + regsub $widgets($subwidget) $result $widgets(this) result + + # replace specific instances of the subwidget command + # with out megawidget command + switch $subwidget,$subcommand { + listbox,index {regsub "index" $result "list index" result} + listbox,insert {regsub "insert" $result "list insert" result} + listbox,delete {regsub "delete" $result "list delete" result} + listbox,get {regsub "get" $result "list get" result} + listbox,size {regsub "size" $result "list size" result} + } + error $result + + } else { + return $result + } +} + + +# ::combobox::WidgetProc -- +# +# This gets uses as the widgetproc for an combobox widget. +# Notice where the widget is created and you'll see that the +# actual widget proc merely evals this proc with all of the +# arguments intact. +# +# Note that some widget commands are defined "inline" (ie: +# within this proc), and some do most of their work in +# separate procs. This is merely because sometimes it was +# easier to do it one way or the other. +# +# Arguments: +# +# w widget pathname +# command widget subcommand +# args additional arguments; varies with the subcommand +# +# Results: +# +# Performs the requested widget command + +proc ::combobox::WidgetProc {w command args} { + upvar ::combobox::${w}::widgets widgets + upvar ::combobox::${w}::options options + upvar ::combobox::${w}::oldFocus oldFocus + upvar ::combobox::${w}::oldFocus oldGrab + + set command [::combobox::Canonize $w command $command] + + # this is just shorthand notation... + set doWidgetCommand \ + [list ::combobox::DoInternalWidgetCommand $widgets(this)] + + if {$command == "list"} { + # ok, the next argument is a list command; we'll + # rip it from args and append it to command to + # create a unique internal command + # + # NB: because of the sloppy way we are doing this, + # we'll also let the user enter our secret command + # directly (eg: listinsert, listdelete), but we + # won't document that fact + set command "list-[lindex $args 0]" + set args [lrange $args 1 end] + } + + set result "" + + # many of these commands are just synonyms for specific + # commands in one of the subwidgets. We'll get them out + # of the way first, then do the custom commands. + switch $command { + bbox - + delete - + get - + icursor - + index - + insert - + scan - + selection - + xview { + set result [eval $doWidgetCommand entry $command $args] + } + list-get {set result [eval $doWidgetCommand listbox get $args]} + list-index {set result [eval $doWidgetCommand listbox index $args]} + list-size {set result [eval $doWidgetCommand listbox size $args]} + + select { + if {[llength $args] == 1} { + set index [lindex $args 0] + set result [Select $widgets(this) $index] + } else { + error "usage: $w select index" + } + } + + subwidget { + set knownWidgets [list button entry listbox popup vsb] + if {[llength $args] == 0} { + return $knownWidgets + } + + set name [lindex $args 0] + if {[lsearch $knownWidgets $name] != -1} { + set result $widgets($name) + } else { + error "unknown subwidget $name" + } + } + + curselection { + set result [eval $doWidgetCommand listbox curselection] + } + + list-insert { + eval $doWidgetCommand listbox insert $args + set result [HandleScrollbar $w "grow"] + } + + list-delete { + eval $doWidgetCommand listbox delete $args + set result [HandleScrollbar $w "shrink"] + } + + toggle { + # ignore this command if the widget is disabled... + if {$options(-state) == "disabled"} return + + # pops down the list if it is not, hides it + # if it is... + if {[winfo ismapped $widgets(popup)]} { + set result [$widgets(this) close] + } else { + set result [$widgets(this) open] + } + } + + open { + + # if this is an editable combobox, the focus should + # be set to the entry widget + if {$options(-editable)} { + focus $widgets(entry) + $widgets(entry) select range 0 end + $widgets(entry) icur end + } + + # if we are disabled, we won't allow this to happen + if {$options(-state) == "disabled"} { + return 0 + } + + # compute the geometry of the window to pop up, and set + # it, and force the window manager to take notice + # (even if it is not presently visible). + # + # this isn't strictly necessary if the window is already + # mapped, but we'll go ahead and set the geometry here + # since its harmless and *may* actually reset the geometry + # to something better in some weird case. + set geometry [::combobox::ComputeGeometry $widgets(this)] + wm geometry $widgets(popup) $geometry + update idletasks + + # if we are already open, there's nothing else to do + if {[winfo ismapped $widgets(popup)]} { + return 0 + } + + # save the widget that currently has the focus; we'll restore + # the focus there when we're done + set oldFocus [focus] + + # ok, tweak the visual appearance of things and + # make the list pop up + $widgets(button) configure -relief sunken + raise $widgets(popup) [winfo parent $widgets(this)] + wm deiconify $widgets(popup) + + # force focus to the entry widget so we can handle keypress + # events for traversal + focus -force $widgets(entry) + + # select something by default, but only if its an + # exact match... + ::combobox::Find $widgets(this) 1 + + # save the current grab state for the display containing + # this widget. We'll restore it when we close the dropdown + # list + set status "none" + set grab [grab current $widgets(this)] + if {$grab != ""} {set status [grab status $grab]} + set oldGrab [list $grab $status] + unset grab status + + # *gasp* do a global grab!!! Mom always told not to + # do things like this, but these are desparate times. + grab -global $widgets(this) + + # fake the listbox into thinking it has focus. This is + # necessary to get scanning initialized properly in the + # listbox. + event generate $widgets(listbox) + + return 1 + } + + close { + # if we are already closed, don't do anything... + if {![winfo ismapped $widgets(popup)]} { + return 0 + } + + # restore the focus and grab, but ignore any errors... + # we're going to be paranoid and release the grab before + # trying to set any other grab because we really really + # really want to make sure the grab is released. + catch {focus $oldFocus} result + catch {grab release $widgets(this)} + catch { + set status [lindex $oldGrab 1] + if {$status == "global"} { + grab -global [lindex $oldGrab 0] + } elseif {$status == "local"} { + grab [lindex $oldGrab 0] + } + unset status + } + + # hides the listbox + $widgets(button) configure -relief raised + wm withdraw $widgets(popup) + + # select the data in the entry widget. Not sure + # why, other than observation seems to suggest that's + # what windows widgets do. + set editable [::combobox::GetBoolean $options(-editable)] + if {$editable} { + $widgets(entry) selection range 0 end + $widgets(button) configure -relief raised + } + + + # magic tcl stuff (see tk.tcl in the distribution + # lib directory) + tkCancelRepeat + + return 1 + } + + cget { + if {[llength $args] != 1} { + error "wrong # args: should be $w cget option" + } + set opt [::combobox::Canonize $w option [lindex $args 0]] + + if {$opt == "-value"} { + set result [$widget(entry) get] + } else { + set result $options($opt) + } + } + + configure { + set result [eval ::combobox::Configure {$w} $args] + } + + default { + error "bad option \"$command\"" + } + } + + return $result +} + +# ::combobox::Configure -- +# +# Implements the "configure" widget subcommand +# +# Arguments: +# +# w widget pathname +# args zero or more option/value pairs (or a single option) +# +# Results: +# +# Performs typcial "configure" type requests on the widget + +proc ::combobox::Configure {w args} { + variable widgetOptions + variable defaultEntryCursor + + upvar ::combobox::${w}::widgets widgets + upvar ::combobox::${w}::options options + + if {[llength $args] == 0} { + # hmmm. User must be wanting all configuration information + # note that if the value of an array element is of length + # one it is an alias, which needs to be handled slightly + # differently + set results {} + foreach opt [lsort [array names widgetOptions]] { + if {[llength $widgetOptions($opt)] == 1} { + set alias $widgetOptions($opt) + set optName $widgetOptions($alias) + lappend results [list $opt $optName] + } else { + set optName [lindex $widgetOptions($opt) 0] + set optClass [lindex $widgetOptions($opt) 1] + set default [option get $w $optName $optClass] + lappend results [list $opt $optName $optClass \ + $default $options($opt)] + } + } + + return $results + } + + # one argument means we are looking for configuration + # information on a single option + if {[llength $args] == 1} { + set opt [::combobox::Canonize $w option [lindex $args 0]] + + set optName [lindex $widgetOptions($opt) 0] + set optClass [lindex $widgetOptions($opt) 1] + set default [option get $w $optName $optClass] + set results [list $opt $optName $optClass \ + $default $options($opt)] + return $results + } + + # if we have an odd number of values, bail. + if {[expr {[llength $args]%2}] == 1} { + # hmmm. An odd number of elements in args + error "value for \"[lindex $args end]\" missing" + } + + # Great. An even number of options. Let's make sure they + # are all valid before we do anything. Note that Canonize + # will generate an error if it finds a bogus option; otherwise + # it returns the canonical option name + foreach {name value} $args { + set name [::combobox::Canonize $w option $name] + set opts($name) $value + } + + # process all of the configuration options + # some (actually, most) options require us to + # do something, like change the attributes of + # a widget or two. Here's where we do that... + foreach option [array names opts] { + set newValue $opts($option) + if {[info exists options($option)]} { + set oldValue $options($option) + } + + switch -- $option { + -background { + $widgets(frame) configure -background $newValue + $widgets(entry) configure -background $newValue + $widgets(listbox) configure -background $newValue + $widgets(vsb) configure -background $newValue + $widgets(vsb) configure -troughcolor $newValue + set options($option) $newValue + } + + -borderwidth { + $widgets(frame) configure -borderwidth $newValue + set options($option) $newValue + } + + -command { + # nothing else to do... + set options($option) $newValue + } + + -commandstate { + # do some value checking... + if {$newValue != "normal" && $newValue != "disabled"} { + set options($option) $oldValue + set message "bad state value \"$newValue\";" + append message " must be normal or disabled" + error $message + } + set options($option) $newValue + } + + -cursor { + $widgets(frame) configure -cursor $newValue + $widgets(entry) configure -cursor $newValue + $widgets(listbox) configure -cursor $newValue + set options($option) $newValue + } + + -editable { + if {$newValue} { + # it's editable... + $widgets(entry) configure \ + -state normal \ + -cursor $defaultEntryCursor + } else { + $widgets(entry) configure \ + -state disabled \ + -cursor $options(-cursor) + } + set options($option) $newValue + } + + -font { + $widgets(entry) configure -font $newValue + $widgets(listbox) configure -font $newValue + set options($option) $newValue + } + + -foreground { + $widgets(entry) configure -foreground $newValue + $widgets(button) configure -foreground $newValue + $widgets(listbox) configure -foreground $newValue + set options($option) $newValue + } + + -height { + $widgets(listbox) configure -height $newValue + HandleScrollbar $w + set options($option) $newValue + } + + -highlightbackground { + $widgets(frame) configure -highlightbackground $newValue + set options($option) $newValue + } + + -highlightcolor { + $widgets(frame) configure -highlightcolor $newValue + set options($option) $newValue + } + + -highlightthickness { + $widgets(frame) configure -highlightthickness $newValue + set options($option) $newValue + } + + -image { + if {[string length $newValue] > 0} { + $widgets(button) configure -image $newValue + } else { + $widgets(button) configure -image ::combobox::bimage + } + set options($option) $newValue + } + + -maxheight { + # ComputeGeometry may dork with the actual height + # of the listbox, so let's undork it + $widgets(listbox) configure -height $options(-height) + HandleScrollbar $w + set options($option) $newValue + } + + -relief { + $widgets(frame) configure -relief $newValue + set options($option) $newValue + } + + -selectbackground { + $widgets(entry) configure -selectbackground $newValue + $widgets(listbox) configure -selectbackground $newValue + set options($option) $newValue + } + + -selectborderwidth { + $widgets(entry) configure -selectborderwidth $newValue + $widgets(listbox) configure -selectborderwidth $newValue + set options($option) $newValue + } + + -selectforeground { + $widgets(entry) configure -selectforeground $newValue + $widgets(listbox) configure -selectforeground $newValue + set options($option) $newValue + } + + -state { + if {$newValue == "normal"} { + # it's enabled + set editable [::combobox::GetBoolean \ + $options(-editable)] + if {$editable} { + $widgets(entry) configure -state normal + $widgets(entry) configure -takefocus 1 + } + } elseif {$newValue == "disabled"} { + # it's disabled + $widgets(entry) configure -state disabled + $widgets(entry) configure -takefocus 0 + + } else { + set options($option) $oldValue + set message "bad state value \"$newValue\";" + append message " must be normal or disabled" + error $message + } + + set options($option) $newValue + } + + -takefocus { + $widgets(entry) configure -takefocus $newValue + set options($option) $newValue + } + + -textvariable { + $widgets(entry) configure -textvariable $newValue + set options($option) $newValue + } + + -value { + ::combobox::SetValue $widgets(this) $newValue + set options($option) $newValue + } + + -width { + $widgets(entry) configure -width $newValue + $widgets(listbox) configure -width $newValue + set options($option) $newValue + } + + -xscrollcommand { + $widgets(entry) configure -xscrollcommand $newValue + set options($option) $newValue + } + + } + } +} + +# ::combobox::VTrace -- +# +# this proc is called whenever the user changes the value of +# the -textvariable associated with a widget +# +# Arguments: +# +# w widget pathname +# args standard stuff from a variable trace +# +# Returns: +# +# Empty String + +proc ::combobox::VTrace {w args} { + upvar ::combobox::${w}::widgets widgets + upvar ::combobox::${w}::options options + upvar ::combobox::${w}::ignoreTrace ignoreTrace + + if {[info exists ignoreTrace]} return + ::combobox::SetValue $widgets(this) [set ::$options(-textvariable)] + + return "" +} + +# ::combobox::SetValue -- +# +# sets the value of the combobox and calls the -command, +# if defined +# +# Arguments: +# +# w widget pathname +# newValue the new value of the combobox +# +# Returns +# +# Empty string + +proc ::combobox::SetValue {w newValue} { + + upvar ::combobox::${w}::widgets widgets + upvar ::combobox::${w}::options options + upvar ::combobox::${w}::ignoreTrace ignoreTrace + upvar ::combobox::${w}::oldValue oldValue + + if {[info exists options(-textvariable)] \ + && [string length $options(-textvariable)] > 0} { + set variable ::$options(-textvariable) + set $variable $newValue + } else { + set oldstate [$widgets(entry) cget -state] + $widgets(entry) configure -state normal + $widgets(entry) delete 0 end + $widgets(entry) insert 0 $newValue + $widgets(entry) configure -state $oldstate + } + + # set our internal textvariable; this will cause any public + # textvariable (ie: defined by the user) to be updated as + # well +# set ::combobox::${w}::entryTextVariable $newValue + + # redefine our concept of the "old value". Do it before running + # any associated command so we can be sure it happens even + # if the command somehow fails. + set oldValue $newValue + + + # call the associated command. The proc will handle whether or + # not to actually call it, and with what args + CallCommand $w $newValue + + return "" +} + +# ::combobox::CallCommand -- +# +# calls the associated command, if any, appending the new +# value to the command to be called. +# +# Arguments: +# +# w widget pathname +# newValue the new value of the combobox +# +# Returns +# +# empty string + +proc ::combobox::CallCommand {w newValue} { + upvar ::combobox::${w}::widgets widgets + upvar ::combobox::${w}::options options + + # call the associated command, if defined and -commandstate is + # set to "normal" + if {$options(-commandstate) == "normal" && \ + [string length $options(-command)] > 0} { + set args [list $widgets(this) $newValue] + uplevel \#0 $options(-command) $args + } +} + + +# ::combobox::GetBoolean -- +# +# returns the value of a (presumably) boolean string (ie: it should +# do the right thing if the string is "yes", "no", "true", 1, etc +# +# Arguments: +# +# value value to be converted +# errorValue a default value to be returned in case of an error +# +# Returns: +# +# a 1 or zero, or the value of errorValue if the string isn't +# a proper boolean value + +proc ::combobox::GetBoolean {value {errorValue 1}} { + if {[catch {expr {([string trim $value])?1:0}} res]} { + return $errorValue + } else { + return $res + } +} + +# ::combobox::convert -- +# +# public routine to convert %x, %y and %W binding substitutions. +# Given an x, y and or %W value relative to a given widget, this +# routine will convert the values to be relative to the combobox +# widget. For example, it could be used in a binding like this: +# +# bind .combobox {doSomething [::combobox::convert %W -x %x]} +# +# Note that this procedure is *not* exported, but is indented for +# public use. It is not exported because the name could easily +# clash with existing commands. +# +# Arguments: +# +# w a widget path; typically the actual result of a %W +# substitution in a binding. It should be either a +# combobox widget or one of its subwidgets +# +# args should one or more of the following arguments or +# pairs of arguments: +# +# -x will convert the value ; typically will +# be the result of a %x substitution +# -y will convert the value ; typically will +# be the result of a %y substitution +# -W (or -w) will return the name of the combobox widget +# which is the parent of $w +# +# Returns: +# +# a list of the requested values. For example, a single -w will +# result in a list of one items, the name of the combobox widget. +# Supplying "-x 10 -y 20 -W" (in any order) will return a list of +# three values: the converted x and y values, and the name of +# the combobox widget. + +proc ::combobox::convert {w args} { + set result {} + if {![winfo exists $w]} { + error "window \"$w\" doesn't exist" + } + + while {[llength $args] > 0} { + set option [lindex $args 0] + set args [lrange $args 1 end] + + switch -exact -- $option { + -x { + set value [lindex $args 0] + set args [lrange $args 1 end] + set win $w + while {[winfo class $win] != "Combobox"} { + incr value [winfo x $win] + set win [winfo parent $win] + if {$win == "."} break + } + lappend result $value + } + + -y { + set value [lindex $args 0] + set args [lrange $args 1 end] + set win $w + while {[winfo class $win] != "Combobox"} { + incr value [winfo y $win] + set win [winfo parent $win] + if {$win == "."} break + } + lappend result $value + } + + -w - + -W { + set win $w + while {[winfo class $win] != "Combobox"} { + set win [winfo parent $win] + if {$win == "."} break; + } + lappend result $win + } + } + } + return $result +} + +# ::combobox::Canonize -- +# +# takes a (possibly abbreviated) option or command name and either +# returns the canonical name or an error +# +# Arguments: +# +# w widget pathname +# object type of object to canonize; must be one of "command", +# "option", "scan command" or "list command" +# opt the option (or command) to be canonized +# +# Returns: +# +# Returns either the canonical form of an option or command, +# or raises an error if the option or command is unknown or +# ambiguous. + +proc ::combobox::Canonize {w object opt} { + variable widgetOptions + variable columnOptions + variable widgetCommands + variable listCommands + variable scanCommands + + switch $object { + command { + if {[lsearch -exact $widgetCommands $opt] >= 0} { + return $opt + } + + # command names aren't stored in an array, and there + # isn't a way to get all the matches in a list, so + # we'll stuff the commands in a temporary array so + # we can use [array names] + set list $widgetCommands + foreach element $list { + set tmp($element) "" + } + set matches [array names tmp ${opt}*] + } + + {list command} { + if {[lsearch -exact $listCommands $opt] >= 0} { + return $opt + } + + # command names aren't stored in an array, and there + # isn't a way to get all the matches in a list, so + # we'll stuff the commands in a temporary array so + # we can use [array names] + set list $listCommands + foreach element $list { + set tmp($element) "" + } + set matches [array names tmp ${opt}*] + } + + {scan command} { + if {[lsearch -exact $scanCommands $opt] >= 0} { + return $opt + } + + # command names aren't stored in an array, and there + # isn't a way to get all the matches in a list, so + # we'll stuff the commands in a temporary array so + # we can use [array names] + set list $scanCommands + foreach element $list { + set tmp($element) "" + } + set matches [array names tmp ${opt}*] + } + + option { + if {[info exists widgetOptions($opt)] \ + && [llength $widgetOptions($opt)] == 2} { + return $opt + } + set list [array names widgetOptions] + set matches [array names widgetOptions ${opt}*] + } + + } + + if {[llength $matches] == 0} { + set choices [HumanizeList $list] + error "unknown $object \"$opt\"; must be one of $choices" + + } elseif {[llength $matches] == 1} { + set opt [lindex $matches 0] + + # deal with option aliases + switch $object { + option { + set opt [lindex $matches 0] + if {[llength $widgetOptions($opt)] == 1} { + set opt $widgetOptions($opt) + } + } + } + + return $opt + + } else { + set choices [HumanizeList $list] + error "ambiguous $object \"$opt\"; must be one of $choices" + } +} + +# ::combobox::HumanizeList -- +# +# Returns a human-readable form of a list by separating items +# by columns, but separating the last two elements with "or" +# (eg: foo, bar or baz) +# +# Arguments: +# +# list a valid tcl list +# +# Results: +# +# A string which as all of the elements joined with ", " or +# the word " or " + +proc ::combobox::HumanizeList {list} { + + if {[llength $list] == 1} { + return [lindex $list 0] + } else { + set list [lsort $list] + set secondToLast [expr {[llength $list] -2}] + set most [lrange $list 0 $secondToLast] + set last [lindex $list end] + + return "[join $most {, }] or $last" + } +} + +# end of combobox.tcl diff --git a/lib/maracasVisuLib/src/interface/tcl/tkwidgets/ibrowser.tcl b/lib/maracasVisuLib/src/interface/tcl/tkwidgets/ibrowser.tcl new file mode 100644 index 0000000..a373a56 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/tcl/tkwidgets/ibrowser.tcl @@ -0,0 +1,1453 @@ +#************************************************************************* +#* * * +#* NAME : ibrowser.tcl * PROJECT : MARACAS * +#* AUTHOR : Leonardo Flórez/Kyron * TYPE : TCL/TK widget def. * +#* VERSION : v2.0 * CREATION : 06/05/2001 * +#* LANGUAGE : TCL * REVISION : 16/07/2001 * +#* * * +#************************************************************************* +#* * +#* Description : This file defines a new TCL/TK widget that allows the * +#* user to browse a serie of image thumbnails. It has a * +#* dinamical scroll bar, so, don't worry about use one. * +#* * +#* The basic use of this widget is: * +#* * +#* 1. Create a new widget: "ibrowser " * +#* Options given are a list of '-Go to the screenshots page. + +@section overview Overview +The heart of wxMathPlot is mpWindow, which is a 2D canvas for plot layers. +mpWindow can be embedded as subwindow in a wxPane, a wxFrame, or any other wxWindow. +mpWindow provides a zoomable and moveable view of the layers. The current view can +be controlled with the mouse, the scrollbars, and a context menu. + +Plot layers are implementations of the abstract base class mpLayer. Those can +be function plots, scale rulers, or any other vector data visualisation. wxMathPlot provides +two mpLayer implementations for plotting horizontal and vertical rulers: mpScaleX and mpScaleY. +For convenient function plotting three more abstract base classes derived from mpLayer +are provided: mpFX, mpFY and mpFXY. These base classes already come with plot code, own +functions can be implemented by overiding just one member for retrieving a function value. + +@section coding Coding conventions +wxMathPlot sticks to wxWindow's coding conventions. All entities defined by wxMathPlot +have the prefix mp. + +@section author Author and license +wxMathPlot is published under the terms of the wxWindow license. +The author David Schalig can be contacted via the wxMathPlot's homepage at +http://sourceforge.net/projects/wxmathplot +*/ + +/* +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma interface "mathplot.h" +#endif +*/ + +#include "wx/defs.h" +#include + +/* +#include "wx/menu.h" +#include "wx/scrolwin.h" +#include "wx/event.h" +#include "wx/dynarray.h" +*/ + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class mpLayer; +class mpFX; +class mpFY; +class mpFXY; +class mpScaleX; +class mpScaleY; +class mpWindow; + +/** Command IDs used by mpWindow */ +enum +{ + mpID_FIT = 2000, //!< Fit view to match bounding box of all layers + mpID_ZOOM_IN, //!< Zoom into view at clickposition / window center + mpID_ZOOM_OUT, //!< Zoom out + mpID_CENTER, //!< Center view on click position + mpID_LOCKASPECT, //!< Lock x/y scaling aspect + mpID_LINE_GUIDES, //!< Enables or disables the line guides drawing condition +}; + +//----------------------------------------------------------------------------- +// mpLayer +//----------------------------------------------------------------------------- + +/** Plot layer, abstract base class. +Any number of mpLayer implementations can be attached to mpWindow. +Examples for mpLayer implementations are function graphs, or scale rulers. + +For convenience mpLayer defines a name, a font (wxFont), and a pen (wxPen) +as class members. These may or may not be used by implementations. +*/ +class mpLayer : public wxObject +{ +public: + mpLayer(); + + /** Check whether this layer has a bounding box. + The default implementation returns \a TRUE. Overide and return + FALSE if your mpLayer implementation should be ignored by the calculation + of the global bounding box for all layers in a mpWindow. + @retval TRUE Has bounding box + @retval FALSE Has not bounding box + */ + virtual bool HasBBox() { return TRUE; } + + /** Get inclusive left border of bounding box. + @return Value + */ + virtual double GetMinX() { return -1.0; } + + /** Get inclusive right border of bounding box. + @return Value + */ + virtual double GetMaxX() { return 1.0; } + + /** Get inclusive bottom border of bounding box. + @return Value + */ + virtual double GetMinY() { return -1.0; } + + /** Get inclusive top border of bounding box. + @return Value + */ + virtual double GetMaxY() { return 1.0; } + + /** Plot given view of layer to the given device context. + An implementation of this function has to transform layer coordinates to + wxDC coordinates based on the view parameters retrievable from the mpWindow + passed in \a w. The passed device context \a dc has its coordinate origin set + to the center of the visible area. The coordinate orientation is as show in the + following picture: +
+	+--------------------------------------------------+
+	|                                                  |
+	|                                                  |
+	|                (wxDC origin 0,0)                 |
+	|                       x-------------> acending X |
+	|                       |                          |
+	|                       |                          |
+	|                       V ascending Y              |
+	+--------------------------------------------------+
+	
+ Note that Y ascends in downward direction, whereas the usual vertical orientation + for mathematical plots is vice versa. Thus Y-orientation will be swapped usually, + when transforming between wxDC and mpLayer coordinates. + + Rules for transformation between mpLayer and wxDC coordinates + @code + dc_X = (layer_X - mpWindow::GetPosX()) * mpWindow::GetScaleX() + dc_Y = (mpWindow::GetPosY() - layer_Y) * mpWindow::GetScaleY() // swapping Y-orientation + + layer_X = (dc_X / mpWindow::GetScaleX()) + mpWindow::GetPosX() // scale guaranted to be not 0 + layer_Y = mpWindow::GetPosY() - (dc_Y / mpWindow::GetScaleY()) // swapping Y-orientation + @endcode + + @param dc Device context to plot to. + @param w View to plot. The visible area can be retrieved from this object. + */ + virtual void Plot(wxDC & dc, mpWindow & w) = 0; + + /** Get layer name. + @return Name + */ + wxString GetName() const { return m_name; } + + /** Get font set for this layer. + @return Font + */ + const wxFont& GetFont() const { return m_font; } + + /** Get pen set for this layer. + @return Pen + */ + const wxPen& GetPen() const { return m_pen; } + + /** Set layer name + @param name Name, will be copied to internal class member + */ + void SetName(wxString name) { m_name = name; } + + /** Set layer font + @param font Font, will be copied to internal class member + */ + void SetFont(wxFont& font) { m_font = font; } + + /** Set layer pen + @param pen Pen, will be copied to internal class member + */ + void SetPen(wxPen& pen) { m_pen = pen; } + +protected: + wxFont m_font; //!< Layer's font + wxPen m_pen; //!< Layer's pen + wxString m_name; //!< Layer's name + + DECLARE_CLASS(mpLayer) +}; + +//----------------------------------------------------------------------------- +// mpLayer implementations - functions +//----------------------------------------------------------------------------- + +/** @name Label alignment constants +@{*/ + +/** @internal */ +#define mpALIGNMASK 0x03 +/** Aligns label to the right. For use with mpFX. */ +#define mpALIGN_RIGHT 0x00 +/** Aligns label to the center. For use with mpFX and mpFY. */ +#define mpALIGN_CENTER 0x01 +/** Aligns label to the left. For use with mpFX. */ +#define mpALIGN_LEFT 0x02 +/** Aligns label to the top. For use with mpFY. */ +#define mpALIGN_TOP mpALIGN_RIGHT +/** Aligns label to the bottom. For use with mpFY. */ +#define mpALIGN_BOTTOM mpALIGN_LEFT +/** Aligns label to north-east. For use with mpFXY. */ +#define mpALIGN_NE 0x00 +/** Aligns label to north-west. For use with mpFXY. */ +#define mpALIGN_NW 0x01 +/** Aligns label to south-west. For use with mpFXY. */ +#define mpALIGN_SW 0x02 +/** Aligns label to south-east. For use with mpFXY. */ +#define mpALIGN_SE 0x03 + +/*@}*/ + +/** @name mpLayer implementations - functions +@{*/ + +/** Abstract base class providing plot and labeling functionality for functions F:X->Y. +Override mpFX::GetY to implement a function. +Optionally implement a constructor and pass a name (label) and a label alignment +to the constructor mpFX::mpFX. If the layer name is empty, no label will be plotted. +*/ +class mpFX : public mpLayer +{ +public: + /** @param name Label + @param flags Label alignment, pass one of #mpALIGN_RIGHT, #mpALIGN_CENTER, #mpALIGN_LEFT. + */ + mpFX(wxString name = wxEmptyString, int flags = mpALIGN_RIGHT); + + /** Get function value for argument. + Override this function in your implementation. + @param x Argument + @return Function value + */ + virtual double GetY( double x ) = 0; + + /** Layer plot handler. + This implementation will plot the function in the visible area and + put a label according to the aligment specified. + */ + virtual void Plot(wxDC & dc, mpWindow & w); + +protected: + int m_flags; //!< Holds label alignment + + DECLARE_CLASS(mpFX) +}; + +/** Abstract base class providing plot and labeling functionality for functions F:Y->X. +Override mpFY::GetX to implement a function. +Optionally implement a constructor and pass a name (label) and a label alignment +to the constructor mpFY::mpFY. If the layer name is empty, no label will be plotted. +*/ +class mpFY : public mpLayer +{ +public: + /** @param name Label + @param flags Label alignment, pass one of #mpALIGN_BOTTOM, #mpALIGN_CENTER, #mpALIGN_TOP. + */ + mpFY(wxString name = wxEmptyString, int flags = mpALIGN_TOP); + + /** Get function value for argument. + Override this function in your implementation. + @param y Argument + @return Function value + */ + virtual double GetX( double y ) = 0; + + /** Layer plot handler. + This implementation will plot the function in the visible area and + put a label according to the aligment specified. + */ + virtual void Plot(wxDC & dc, mpWindow & w); + +protected: + int m_flags; //!< Holds label alignment + + DECLARE_CLASS(mpFY) +}; + +/** Abstract base class providing plot and labeling functionality for a locus plot F:N->X,Y. +Locus argument N is assumed to be in range 0 .. MAX_N, and implicitely derived by enumrating +all locus values. Override mpFXY::Rewind and mpFXY::GetNextXY to implement a locus. +Optionally implement a constructor and pass a name (label) and a label alignment +to the constructor mpFXY::mpFXY. If the layer name is empty, no label will be plotted. +*/ +class mpFXY : public mpLayer +{ +public: + /** @param name Label + @param flags Label alignment, pass one of #mpALIGN_NE, #mpALIGN_NW, #mpALIGN_SW, #mpALIGN_SE. + */ + mpFXY(wxString name = wxEmptyString, int flags = mpALIGN_NE); + + /** Rewind value enumeration with mpFXY::GetNextXY. + Override this function in your implementation. + */ + virtual void Rewind() = 0; + + /** Get locus value for next N. + Override this function in your implementation. + @param x Returns X value + @param y Returns Y value + */ + virtual bool GetNextXY(double & x, double & y) = 0; + + /** Layer plot handler. + This implementation will plot the locus in the visible area and + put a label according to the aligment specified. + */ + virtual void Plot(wxDC & dc, mpWindow & w); + +protected: + int m_flags; //!< Holds label alignment + + DECLARE_CLASS(mpFXY) +}; + +/*@}*/ + +//----------------------------------------------------------------------------- +// mpLayer implementations - furniture (scales, ...) +//----------------------------------------------------------------------------- + +/** @name mpLayer implementations - furniture (scales, ...) +@{*/ + +/** Plot layer implementing a x-scale ruler. +The ruler is fixed at Y=0 in the coordinate system. A label is plottet at +the bottom-right hand of the ruler. The scale numbering automatically +adjusts to view and zoom factor. +*/ +class mpScaleX : public mpLayer +{ +public: + /** @param name Label to plot by the ruler */ + mpScaleX(wxString name = wxT("X")); + + /** Layer plot handler. + This implementation will plot the ruler adjusted to the visible area. + */ + virtual void Plot(wxDC & dc, mpWindow & w); + + /** Check whether this layer has a bounding box. + This implementation returns \a FALSE thus making the ruler invisible + to the plot layer bounding box calculation by mpWindow. + */ + virtual bool HasBBox() { return FALSE; } + + DECLARE_CLASS(mpScaleX) +}; + +/** Plot layer implementing a y-scale ruler. +The ruler is fixed at X=0 in the coordinate system. A label is plottet at +the top-right hand of the ruler. The scale numbering automatically +adjusts to view and zoom factor. +*/ +class mpScaleY : public mpLayer +{ +public: + /** @param name Label to plot by the ruler */ + mpScaleY(wxString name = wxT("Y")); + + /** Layer plot handler. + This implementation will plot the ruler adjusted to the visible area. + */ + virtual void Plot(wxDC & dc, mpWindow & w); + + /** Check whether this layer has a bounding box. + This implementation returns \a FALSE thus making the ruler invisible + to the plot layer bounding box calculation by mpWindow. + */ + virtual bool HasBBox() { return FALSE; } + +protected: + + DECLARE_CLASS(mpScaleY) +}; + +//----------------------------------------------------------------------------- +// mpWindow +//----------------------------------------------------------------------------- + +/** @name Constants defining mouse modes for mpWindow +@{*/ + +/** Mouse panning drags the view. Mouse mode for mpWindow. */ +#define mpMOUSEMODE_DRAG 0 +/** Mouse panning creates a zoom box. Mouse mode for mpWindow. */ +#define mpMOUSEMODE_ZOOMBOX 1 + +/*@}*/ + +/** Canvas for plotting mpLayer implementations. + +This class defines a zoomable and moveable 2D plot canvas. Any number +of mpLayer implementations (scale rulers, function plots, ...) can be +attached using mpWindow::AddLayer. + +The canvas window provides a context menu with actions for navigating the view. +The context menu can be retrieved with mpWindow::GetPopupMenu, e.g. for extending it +externally. +*/ +class mpWindow : public wxScrolledWindow +{ +public: + mpWindow() {} + mpWindow( wxWindow *parent, wxWindowID id, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + int flags = 0); + ~mpWindow(); + + /** Get reference to context menu of the plot canvas. + @return Pointer to menu. The menu can be modified. + */ + wxMenu* GetPopupMenu() { return &m_popmenu; } + + //----------------------- + // new methods for plotter + //----------------------- + /* + Set Type + */ + void setType(int t) + { + type=t; + } + /* + Get Type + */ + int getType() + { + return type; + } + + + /** + set the max value in the x axis + @param maxX + */ + void setMaxScrX(int maxX) + { + maxScrX=maxX; + } + /** + set the max value in the y axis + @param maxY + */ + void setMaxScrY(int maxY) + { + maxScrY=maxY; + } + + + /**Get maximum value in x + @return maxScrX + */ + double getMaxScrX() + { + return maxScrX; + } + /**Get maximum value in y + @return maxScrY + */ + double getMaxScrY() + { + return maxScrY; + } + /* + returns the zoomFactor + */ + float getZoomFactor() + { + return zoomFactor; + } + /** + set the min value in the x axis + @param minX + */ + void setMinScrX(int minX) + { + minScrX=minX; + } + /** + set the min value in the y axis + @param minY + */ + void setMinScrY(int minY) + { + minScrY=minY; + } + + + /**Get miniimum value in x + @return minScrX + */ + double getMinScrX() + { + return minScrX; + } + /**Get minimum value in y + @return minScrY + */ + double getMinScrY() + { + return minScrY; + } + + /** + Get the x-clicked by the user + @return m_clickedX + */ + int getClickedX() + { + return m_clickedX; + } + + /** + Get the y-clicked by the user + @return m_clickedY + */ + int getClickedY() + { + return m_clickedY; + } + + /** + Gets the x-offset of the zoom + in pixels + */ + int getOffsetPixelsX() + { + return offsetPixelX; + } + + /** + Gets the offset of the zoom + in pixels + */ + int getOffsetPixelsY() + { + return offsetPixelY; + } + /** + Set the x-offset of the zoom + */ + void setOffsetPixelX(int offX) + { + offsetPixelX=offX; + } + /** + Set the y-offset of the zoom + */ + void setOffsetPixelY(int offY) + { + offsetPixelY=offY; + } + + /** + Gets the x-offset of the zoom + */ + int getOffsetX() + { + return offsetX; + } + + /** + Gets the offset of the zoom + */ + int getOffsetY() + { + return offsetY; + } + /** + Set the x-offset of the zoom + */ + void setOffsetX(int offX) + { + offsetX=offX; + } + /** + Set the y-offset of the zoom + */ + void setOffsetY(int offY) + { + offsetY=offY; + } + + /* + * Sets real value of the y-coord for the vertical guide line + * @param newX_realGuide The new value to assing for the vertical guide + */ + void setRealGuideX(int newX_realGuide) + { + real_guideLine_X = newX_realGuide; + if(real_guideLine_X!=-1) + UpdateAll(); + } + + /* + * Gets the real value of the y-coord for the vertical guide line + * @retval real_guideLine_X The assigned value for the vertical guide + */ + int getRealGuideX() + { + return real_guideLine_X; + } + + /* + * Sets real value of the y-coord for the vertical guide line + * @param newY_realGuide The new value to assing for the vertical guide + */ + void setRealGuideY(int newY_realGuide) + { + real_guideLine_Y = newY_realGuide; + if(real_guideLine_Y!=-1) + UpdateAll(); + } + + /* + * Gets the real value of the y-coord for the vertical guide line + * @retval real_guideLine_Y The assigned value for the vertical guide + */ + int getRealGuideY() + { + return real_guideLine_Y; + } + + /* + * Sets the condition for drawing or not the guide lines + * @param ifDrawing The new condition to assing + */ + /*void setLineGuidesCondition(bool ifDrawing) + { + drawGuides = ifDrawing; + } + + /* + * Gets the condition for drawing or not the guide lines + * @retval drawGuides The assigned condition + */ + bool drawGuideLines(); + + /* + * Guide lines menu handler method that reacts to the mpID_LINE_GUIDES cimmand event + * event The corresponding event to handle + */ + + //void OnGuideLines (wxCommandEvent &event); + + //---------------------------------------------------------------------------------- + // Previous methods + //---------------------------------------------------------------------------------- + + + /** Add a plot layer to the canvas. + @param layer Pointer to layer. The mpLayer object will get under control of mpWindow, + i.e. it will be delete'd on mpWindow destruction + @retval TRUE Success + @retval FALSE Failure due to out of memory. + */ + bool AddLayer( mpLayer* layer); + + /** Remove a plot layer from the canvas. + @param layer Pointer to layer. The mpLayer object will be destructed using delete. + */ + void DelLayer( mpLayer* layer); + + /** Get current view's X scale. + See @ref mpLayer::Plot "rules for coordinate transformation" + @return Scale + */ + double GetScaleX(void) const { return m_scaleX; } + + /** Get current view's Y scale. + See @ref mpLayer::Plot "rules for coordinate transformation" + @return Scale + */ + double GetScaleY(void) const { return m_scaleY; } + + /** Get current view's X position. + See @ref mpLayer::Plot "rules for coordinate transformation" + @return X Position in layer coordinate system, that corresponds to the center point of the view. + */ + double GetPosX(void) const { return m_posX; } + + /** Get current view's Y position. + See @ref mpLayer::Plot "rules for coordinate transformation" + @return Y Position in layer coordinate system, that corresponds to the center point of the view. + */ + double GetPosY(void) const { return m_posY; } + + /** Get current view's X dimension in device context units. + Usually this is equal to wxDC::GetSize, but it might differ thus mpLayer + implementations should rely on the value returned by the function. + See @ref mpLayer::Plot "rules for coordinate transformation" + @return X dimension. + */ + int GetScrX(void) const { return m_scrX; } + + /** Get current view's Y dimension in device context units. + Usually this is equal to wxDC::GetSize, but it might differ thus mpLayer + implementations should rely on the value returned by the function. + See @ref mpLayer::Plot "rules for coordinate transformation" + @return Y dimension. + */ + int GetScrY(void) const { return m_scrY; } + //void SetScrY(int x) const { return m_scrY; } + + /** Set current view's X scale and refresh display. + @param scaleX New scale, must not be 0. + */ + void SetScaleX(double scaleX) { if (scaleX!=0) m_scaleX=scaleX; /*UpdateAll();*/ } + + /** Set current view's Y scale and refresh display. + @param scaleY New scale, must not be 0. + */ + void SetScaleY(double scaleY) { if (scaleY!=0) m_scaleY=scaleY; /*UpdateAll();*/ } + + /** Set current view's X position and refresh display. + @param posX New position that corresponds to the center point of the view. + */ + void SetPosX(double posX) { m_posX=posX; UpdateAll(); } + + /** Set current view's Y position and refresh display. + @param posY New position that corresponds to the center point of the view. + */ + void SetPosY(double posY) { m_posY=posY; UpdateAll(); } + + /** Set current view's X and Y position and refresh display. + @param posX New position that corresponds to the center point of the view. + @param posY New position that corresponds to the center point of the view. + */ + void SetPos( double posX, double posY) { m_posX=posX; m_posY=posY; UpdateAll(); } + + /** Enable or disable X/Y scale aspect locking for the view. + @note Explicit calls to mpWindow::SetScaleX and mpWindow::SetScaleY will set + an unlocked apect, but any other action changing the view scale will + lock the aspect again. + */ + void LockAspect(bool enable = TRUE); + + /** Checks whether the X/Y scale aspect is locked. + @retval TRUE Locked + @retval FALSE Unlocked + */ + inline bool IsAspectLocked() { return m_lockaspect; } + + /** Set view to fit global bounding box of all plot layers and refresh display. + Scale and position will be set to a show all attached mpLayers. + The X/Y scale aspect lock is taken into account. + */ + void Fit(); + + /** Zoom into current view and refresh display */ + void ZoomIn(); + + /** Zoom out current view and refresh display */ + void ZoomOut(); + + /** Refresh display */ + void UpdateAll(); + +protected: + + void Refresh(bool eraseBackground = true, const wxRect* rect = NULL); + void OnPaint (wxPaintEvent &event); //!< Paint handler, will plot all attached layers + void OnSize (wxSizeEvent &event); //!< Size handler, will update scroll bar sizes + void OnScroll2 (wxScrollWinEvent &event); //!< Scroll handler, will move canvas + void OnShowPopupMenu (wxMouseEvent &event); //!< Mouse handler, will show context menu + void OnCenter (wxCommandEvent &event); //!< Context menu handler + void OnFit (wxCommandEvent &event); //!< Context menu handler + void OnZoomIn (wxCommandEvent &event); //!< Context menu handler + void OnZoomOut (wxCommandEvent &event); //!< Context menu handler + void OnLockAspect (wxCommandEvent &event); //!< Context menu handler + + + bool UpdateBBox(); //!< Recalculate global layer bounding box + + wxList m_layers; //!< List of attached plot layers + wxMenu m_popmenu; //!< Canvas' context menu + bool m_lockaspect;//!< Scale aspect is locked or not + + double m_minX; //!< Global layer bounding box, left border incl. + double m_maxX; //!< Global layer bounding box, right border incl. + double m_minY; //!< Global layer bounding box, bottom border incl. + double m_maxY; //!< Global layer bounding box, top border incl. + double m_scaleX; //!< Current view's X scale + double m_scaleY; //!< Current view's Y scale + double m_posX; //!< Current view's X position + double m_posY; //!< Current view's Y position + int m_scrX; //!< Current view's X dimension + int m_scrY; //!< Current view's Y dimension + int m_clickedX; //!< Last mouse click X position, for centering and zooming the view + int m_clickedY; //!< Last mouse click Y position, for centering and zooming the view + + //---------------------------------------------- + //NEW ATTRIBUTES FOR COMPATIBILITY WITH PPlotter + //---------------------------------------------- + /** + the max value in the x axis + */ + int maxScrX; + + /** + the max value in the y axis + */ + int maxScrY; + /** + the min value in the x axis + */ + int minScrX; + + /** + the min value in the y axis + */ + int minScrY; + /* + the zoom factor + of the zoom + */ + float zoomFactor; + + + /** + offset in pixels where the user has clicked + before changing the scale (in the actual function) + */ + int offsetPixelX; + int offsetPixelY; + /* + Offsets in real value according to the actual function + */ + int offsetX; + int offsetY; + + /* + * The real value of the y-coord for the horizontal guide line + */ + int real_guideLine_X; + /* + * The real value of the y-coord for the vertical guide line + */ + int real_guideLine_Y; + + /* + * Represents the condition for drawing or not the line guides, default color is red and assigned to draw them + */ + bool drawGuides; + /* + Use to know which type of plotter is + 1= default Plotter + 2= histogram plotter + */ + int type; + + private: + //bitmap of functions + wxBitmap *_bitmap_functions; + + + DECLARE_CLASS(mpWindow) + DECLARE_EVENT_TABLE() +}; + +#endif // _MP_MATHPLOT_H_ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pColorBar.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pColorBar.cxx new file mode 100644 index 0000000..22a156d --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pColorBar.cxx @@ -0,0 +1,1526 @@ +//------------------------------------------------------------------------------------------------------------ +// Class definition include +//------------------------------------------------------------------------------------------------------------ +#include "pColorBar.h" +#include + +//------------------------------------------------------------------------------------------------------------ +// Generated events declaration and definition +//------------------------------------------------------------------------------------------------------------ +/* +* How to catch generated event: EVT_COMMAND(ID_CONTAINER_WINDOW_LISTENER, wxEVT_TYPE_EVENT, ContainerClass :: determinedEventFor) +*/ +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE( wxEVT_ADDED_POINT, -1 ) + DECLARE_EVENT_TYPE( wxEVT_REMOVED_POINT, -1 ) + DECLARE_EVENT_TYPE( wxEVT_MOVED_POINT, -1 ) + DECLARE_EVENT_TYPE( wxEVT_CHANGED_POINT, -1 ) + DECLARE_EVENT_TYPE( wxEVT_ON_COLOR_BAR, -1 ) +END_DECLARE_EVENT_TYPES() + + +DEFINE_EVENT_TYPE( wxEVT_ADDED_POINT ) +DEFINE_EVENT_TYPE( wxEVT_REMOVED_POINT ) +DEFINE_EVENT_TYPE( wxEVT_MOVED_POINT ) +DEFINE_EVENT_TYPE( wxEVT_CHANGED_POINT ) +DEFINE_EVENT_TYPE( wxEVT_ON_COLOR_BAR ) + +//------------------------------------------------------------------------------------------------------------ +// Class implementation +//------------------------------------------------------------------------------------------------------------ +/** file pColorBar.cxx */ +IMPLEMENT_CLASS(pColorBar, wxScrolledWindow) + +//------------------------------------------------------------------------------------------------------------ +// Handled events table +//------------------------------------------------------------------------------------------------------------ +BEGIN_EVENT_TABLE(pColorBar, wxScrolledWindow) + EVT_PAINT( pColorBar :: onPaint) + EVT_SIZE ( pColorBar :: OnSize ) + EVT_MOTION ( pColorBar :: onMouseMove) + EVT_RIGHT_DOWN( pColorBar :: onShowPopupMenu) + EVT_LEFT_DCLICK( pColorBar :: onLeftButtonDClick) + EVT_LEFT_DOWN( pColorBar :: onLeftClicDown) + EVT_LEFT_UP( pColorBar :: onLeftClickUp) + EVT_MENU( cntID_DEL_COLOR_POINT, pColorBar :: onDeleteColorPoint) + EVT_MENU( cntID_ADD_COLOR_POINT, pColorBar :: onAddColorPoint) + EVT_MENU( cntID_CHANGE_COLOR_POINT, pColorBar :: onChangeColourSelectedPoint) + EVT_MENU( cntID_TRIANGLES_UP, pColorBar :: onTrianglesUp_Figure) + EVT_MENU( cntID_TRIANGLES_DOWN, pColorBar :: onTrianglesDown_Figure) + EVT_MENU( cntID_TRIANGLES_LEFT, pColorBar :: onTrianglesLeft_Figure) + EVT_MENU( cntID_TRIANGLES_RIGHT, pColorBar :: onTrianglesRight_Figure) + EVT_MENU( cntID_RECTANGLES, pColorBar :: onRectangles_Figure) + EVT_MENU( cntID_DEGRADE_CONTROL, pColorBar :: onDegradeControl) + EVT_MIDDLE_UP( pColorBar :: onShowPopupMenu ) + EVT_RIGHT_UP ( pColorBar :: onShowPopupMenu ) +END_EVENT_TABLE() + +//------------------------------------------------------------------------------------------------------------ +// Constructors & Destructors +//------------------------------------------------------------------------------------------------------------ + +/* +* Creates a colorBar instance +* param *parent Container event listener window +* param _w Width of the color bar drawing area +* param _h Height of the color bar drawing area +* param _bar_orientation VERTICAL (false) or HORIZONTAL (true) direction to set +*/ +pColorBar :: pColorBar (wxWindow *parent, int _w, int _h, bool _bar_orientation) +:wxScrolledWindow(parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL) +{ + _logicalBar = new LogicalColorBar(); + colourParent = GetParent()->GetBackgroundColour(); + deviceEndMargin = 0; + acceptedClick = true; + setGapValues (0,6); + setWidth(_w); + setHeight(_h); + + // Setting the default represented values + setDegradeState(true); + setStaticLimitsTo(false); + viewingRange = false; + accumTemporalPoints = 0; + deviceEndMargin = 0; + activeState = false; + avaliablePointToMove = -1; + + movingPointIndex = -1; + movingNodePoint = NULL; + realX_vertical_line = -1; + guideLineColor = wxColour(255,0,0); + + //TRIANGLES UP + figure = new pFigure( RECTANGLE, FIGURE_WIDTH, bar_height, -2, _bar_orientation ); + setOrientation ( _bar_orientation ); + + // Appending menu items to the pop-menu + c_popmenu.Append( cntID_ADD_COLOR_POINT, _T("Add color point"), _T("Adds a color point in the clicked point")); + c_popmenu.Append( cntID_DEL_COLOR_POINT, _T("Delete color point"), _T("Deletes the color point at the clicked point")); + c_popmenu.Append( cntID_CHANGE_COLOR_POINT, _T("Change color"), _T("Changes the color at the clicked point")); + c_popmenu.Append ( cntID_DEGRADE_CONTROL, _T("Turn off degrade"), _T("Turns on/off the degrade"),wxITEM_SEPARATOR); + + changesMenu = new wxMenu; + changesMenu->AppendCheckItem ( cntID_TRIANGLES_UP, _T("Triangles up"),_T("Sets triangles up figure")); + changesMenu->AppendCheckItem ( cntID_TRIANGLES_DOWN, _T("Triangles down"),_T("Sets triangles down figure")); + changesMenu->AppendCheckItem ( cntID_TRIANGLES_LEFT, _T("Triangles left"),_T("Sets triangles left figure")); + changesMenu->AppendCheckItem ( cntID_TRIANGLES_RIGHT, _T("Triangles right"),_T("Sets triangles right figure")); + changesMenu->AppendCheckItem ( cntID_RECTANGLES, _T("Rectangles"),_T("Sets rectangle figure")); + c_popmenu.Append(cntID_CHANGE_FIGURE, _T("Change figure"),changesMenu, _T("Changes the figure of the color points")); + changesMenu->Check (cntID_TRIANGLES_UP, true); +} + +pColorBar :: ~pColorBar() +{ + +} + //------------------------------------------------------------------------------------------------------------ + // Color bar proccessed events methods implementation + //------------------------------------------------------------------------------------------------------------ + + void pColorBar :: OnSize ( wxSizeEvent &WXUNUSED(event) ) + { + wxRect rectTotal = GetClientRect(); + if(getOrientation()) + { + setWidth( rectTotal.GetWidth() - deviceEndMargin ); + } + else + { + setWidth( rectTotal.GetHeight() - deviceEndMargin); + } + Refresh(); + } + /** + * Reacts to the mouse movement inside the color bar for moving the clicked color point in the x-axis. + * Informs the result of the handled event like a wxCommandEvent wxEVT_MOVED_COL_POINT if a point was moved. + * param event The mouse actioned event + */ + void pColorBar :: onMouseMove ( wxMouseEvent& event ) + { + if(!event.LeftIsDown()) + avaliablePointToMove = -1; + + if (acceptedClick && activeState && _logicalBar->getCount()>0) + { + bool movedPoint = false; + wxPoint point = event.GetPosition(); + double realClicked = getOrientation() ? convertToRealValue(point.x) : convertToRealValue(point.y); + bool rangeToMove = realClicked<=maxX_represented_Tshow && realClicked>=minX_represented_Tshow;//getOrientation() ? (point.x >=deviceStart_x && point.x<=bar_width+deviceStart_x-deviceEndMargin ) : ( point.y>=deviceStart_y && point.y<=bar_width+deviceStart_x-deviceEndMargin); + if ( rangeToMove && acceptedClick && showedColorPoints.size()>0 ) + { + if ( movingPointIndex == -1 ) + { + startNode_show = showedColorPoints.front(); + lastNode_show = showedColorPoints.back(); + + int numberEdges = figure->getNumberEdges(); + wxPoint points [4]; + int i=0; + int a; + for (a=0; a getRealX()); + point_pixelX+= deviceStart_x; + if ( getOrientation() ) + movingPointIndex = (figure ->isPointInside (point_pixelX,point.x))? a : -1; + else + movingPointIndex = (figure ->isPointInside (point_pixelX,point.y))? a : -1; + + if(movingPointIndex != -1) + { + movingNodePoint = nodePoint; + if(avaliablePointToMove ==-1) + avaliablePointToMove = movingPointIndex; + } + } + } + if (event.LeftIsDown() && movingNodePoint && movingPointIndex!=-1 && avaliablePointToMove==movingPointIndex) + { + bool hasPrevPoint = movingPointIndex > 0; + bool hasNextPoint = movingPointIndex < showedColorPoints.size()-1; + + pColorPoint * prevPoint = hasPrevPoint? showedColorPoints[movingPointIndex-1]: NULL; + pColorPoint * nextPoint = hasNextPoint ? showedColorPoints[movingPointIndex+1]: NULL; + + if ( hasPrevPoint && prevPoint!=NULL ) + { + if ( hasNextPoint && nextPoint!=NULL ) + { + double previousValue = prevPoint->getRealX(); + double nextValue = nextPoint->getRealX(); + movedPoint = prevPoint->isTemporalColor() ? + ( nextPoint->isTemporalColor() ? (realClicked>=previousValue)&&(realClicked<=nextValue) : (realClicked>=previousValue)&&(realClickedpreviousValue)&&(realClickednextValue) + { + realClicked = nextValue-1; + movedPoint = true; + } + } + else + { + if ( !staticLimits ) + { + // Is the last point + double previousValue = prevPoint->getRealX(); + movedPoint = prevPoint->isTemporalColor() ? + ( realClicked>=previousValue ) && ( realClicked<= maxX_represented_Tshow ) + : ( realClicked>previousValue ) && ( realClicked<= maxX_represented_Tshow ); + if(!movedPoint) + avaliablePointToMove = movingPointIndex; + if(!movedPoint && realClickedisTemporalColor()? previousValue: previousValue+1; + movedPoint = true; + } + else if (!movedPoint && realClicked>=maxX_represented_Tshow) + { + realClicked = maxX_represented_Tshow; + movedPoint = true; + } + } + } + } + else + { + if ( hasNextPoint && nextPoint!=NULL ) + { + if ( !staticLimits ) + { + // Is the first point + double nextValue = nextPoint->getRealX(); + movedPoint = ( nextPoint->isTemporalColor() ? (realClicked<=nextValue) && ( realClicked>= minX_represented_Tshow ) + :( realClicked= minX_represented_Tshow )); + + if(!movedPoint) + avaliablePointToMove = movingPointIndex; + if(!movedPoint && realClicked>nextValue) + { + realClicked = nextPoint->isTemporalColor() ? nextValue : nextValue-1; + movedPoint = true; + } + else if (!movedPoint && realClicked<=minX_represented_Tshow) + { + realClicked = minX_represented_Tshow; + movedPoint = true; + } + } + } + else + { + //Is the only point in the color bar + movedPoint = ( realClicked<= maxX_represented_Tshow ) && ( realClicked>= minX_represented_Tshow ); + if(!movedPoint) + avaliablePointToMove = movingPointIndex; + if (!movedPoint && realClicked<=minX_represented_Tshow) + { + realClicked = minX_represented_Tshow; + movedPoint = true; + } + else if(!movedPoint && realClicked>=maxX_represented_Tshow) + { + realClicked = maxX_represented_Tshow; + movedPoint = true; + } + } + } + if(viewingRange) + { + bool movingTempStart = movingNodePoint->getRealX() == startNode_show->getRealX() && movingNodePoint->isTemporalColor(); + bool movingTempEnd = movingNodePoint->getRealX()== lastNode_show->getRealX() && movingNodePoint->isTemporalColor(); + if( movingTempStart || movingTempEnd ) + movedPoint = false; + } + } + // Inform movedPoint event + if ( movedPoint ) + { + movingNodePoint->setRealX ( realClicked ); + RefreshForce();//Refresh to show the point is moved + createAndSendEvent(wxEVT_MOVED_POINT); + } + else + { + movingPointIndex = -1; + //Creating a general event of mouse move to actualize views + createAndSendEvent( wxEVT_ON_COLOR_BAR ); + } + } + else + { + movingPointIndex = -1; + //Creating a general event of mouse move to actualize views + createAndSendEvent( wxEVT_ON_COLOR_BAR ); + } + if ( movingPointIndex ==-1 ) + { + RefreshForce();//Refresh to show the point is not selected anymore + } + } + } + + void pColorBar :: Refresh(bool eraseBackground , const wxRect* rect ) + { + wxScrolledWindow::Refresh(false); + } + + + /* + * Reacts to the event of drawing the bar and draws it + * param &WXUNUSED(event) The correspondig wxPaintEvent actioned event + */ + void pColorBar :: onPaint ( wxPaintEvent &WXUNUSED(event) ) + { + repaintView(); + if ( getOrientation() ) // HORIZONTAL + { + wxMemoryDC temp_dc; + temp_dc.SelectObject( * colorBar_Bitmap ); + wxPaintDC dc( this ); + +// dc.Blit(deviceStart_x, deviceStart_y, bar_width+deviceStart_x, bar_height+deviceStart_y, &temp_dc, deviceStart_x, deviceStart_y); + + dc.Blit(deviceStart_x, deviceStart_y, bar_width/*-deviceEndMargin*/, bar_height, &temp_dc, 0, 0); + + // Bitmap for posible needed information to be shown + /* + temp_dc.SelectObject( * information_Bitmap ); + dc.Blit(0,bar_height, width, height, &temp_dc, 0, height); + */ + } + else + { + wxMemoryDC temp_dc; + temp_dc.SelectObject( * colorBar_Bitmap ); + wxPaintDC dc( this ); +// dc.Blit(deviceStart_y,deviceStart_x, bar_height+deviceStart_y, bar_width+deviceStart_x, &temp_dc, deviceStart_y, deviceStart_x); + + dc.Blit(deviceStart_y,deviceStart_x, bar_height, bar_width-deviceEndMargin, &temp_dc, 0, 0); + // Bitmap for posible needed information to be shown + /* + temp_dc.SelectObject( * information_Bitmap ); + dc.Blit(0,bar_width, height, width, &temp_dc, 0, width ); + */ + temp_dc.SelectObject(wxNullBitmap); + } + } + + /** + * Reacts to the cntID_ADD_COLOR_POINT wxCommandEvent and adds a color degrade point to the color bar. + * Informs the result of the handled event like a wxCommandEvent wxEVT_ADDED_COL_POINT if the point was inserted succesfully. + * param & anEvent The wxCommandEvent actioned event + */ + void pColorBar :: onAddColorPoint ( wxCommandEvent& anEvent ) + { + bool addedPoint = false; + double real_x = getOrientation() ? convertToRealValue( clickedX ) : convertToRealValue( clickedY );; + wxColour selectedColor = getSelectedColour(); + if (okSelectedColor) + { + addedPoint = addColorPoint (real_x, selectedColor); + } + // Inform addedPoint event + if ( addedPoint ) + { + //RefreshForce(); + createAndSendEvent( wxEVT_ADDED_POINT ); + } + } + + /** + * Reacts to the cntID_DEL_COLOR_POINT wxCommandEvent and deletes a color degrade point of the color bar. + * Informs the result of the handled event like a wxCommandEvent wxEVT_REMOVED_COL_POINT if the point was succesfully removed. + * param & anEvent The wxCommandEvent actioned event + */ + void pColorBar :: onDeleteColorPoint ( wxCommandEvent& anEvent ) + { + bool deletedPoint = false; + double real_x = getOrientation() ? convertToRealValue( clickedX ) : convertToRealValue( clickedY ); + deletedPoint = deleteColorPoint(real_x); + // Inform deletedPoint event + if ( deletedPoint ) + { + //RefreshForce(); + createAndSendEvent( wxEVT_REMOVED_POINT ); + } + } + + /** + * Reacts to the cntID_CHANGE_COLOR_POINT wxCommandEvent and changes the assigned color to the selected color degrade point of the color bar. + * Informs the result of the handled event like a wxCommandEvent wxEVT_CHANGED_POINT if the point was succesfully removed. + * param & anEvent The wxCommandEvent actioned event + */ + void pColorBar :: onChangeColourSelectedPoint ( wxCommandEvent& anEvent ) + { + bool changedColour = false; + changedColour = getOrientation() ? changeColor( clickedX ) : changeColor( clickedY ); + // Inform deletedPoint event + if ( changedColour ) + { + //RefreshForce(); + createAndSendEvent( wxEVT_CHANGED_POINT ); + } + } + /** + * Reacts to the cntID_TRIANGLES_UP wxCommandEvent and changes the assigned figure to -triangles up- for the color points of the color bar. + * param & anEvent The wxCommandEvent actioned event + */ + void pColorBar :: onTrianglesUp_Figure ( wxCommandEvent& anEvent ) + { + if( !changesMenu->IsChecked(cntID_TRIANGLES_UP) ) + { + changeFigure (-8); + changesMenu->Check (cntID_TRIANGLES_UP, true); + changesMenu->Check (cntID_TRIANGLES_DOWN, false); + changesMenu->Check (cntID_TRIANGLES_LEFT, false); + changesMenu->Check (cntID_TRIANGLES_RIGHT, false); + changesMenu->Check (cntID_RECTANGLES, false); + } + } + /** + * Reacts to the cntID_TRIANGLES_DOWN wxCommandEvent and changes the assigned figure to -triangles down- for the color points of the color bar. + * param & anEvent The wxCommandEvent actioned event + */ + void pColorBar :: onTrianglesDown_Figure ( wxCommandEvent& anEvent ) + { + if( !changesMenu->IsChecked(cntID_TRIANGLES_DOWN) ) + { + changeFigure (-2); + changesMenu->Check (cntID_TRIANGLES_UP, false); + changesMenu->Check (cntID_TRIANGLES_DOWN, true); + changesMenu->Check (cntID_TRIANGLES_LEFT, false); + changesMenu->Check (cntID_TRIANGLES_RIGHT, false); + changesMenu->Check (cntID_RECTANGLES, false); + } + } + /** + * Reacts to the cntID_TRIANGLES_LEFT wxCommandEvent and changes the assigned figure to -triangles left- for the color points of the color bar. + * param & anEvent The wxCommandEvent actioned event + */ + void pColorBar :: onTrianglesLeft_Figure ( wxCommandEvent& anEvent ) + { + if( !changesMenu->IsChecked(cntID_TRIANGLES_LEFT) ) + { + changeFigure (-4); + changesMenu->Check (cntID_TRIANGLES_UP, false); + changesMenu->Check (cntID_TRIANGLES_DOWN, false); + changesMenu->Check (cntID_TRIANGLES_LEFT, true); + changesMenu->Check (cntID_TRIANGLES_RIGHT, false); + changesMenu->Check (cntID_RECTANGLES, false); + } + } + /** + * Reacts to the cntID_TRIANGLES_RIGHT wxCommandEvent and changes the assigned figure to -triangles right- for the color points of the color bar. + * param & anEvent The wxCommandEvent actioned event + */ + void pColorBar :: onTrianglesRight_Figure ( wxCommandEvent& anEvent ) + { + if( !changesMenu->IsChecked(cntID_TRIANGLES_RIGHT) ) + { + changeFigure (-6); + changesMenu->Check (cntID_TRIANGLES_UP, false); + changesMenu->Check (cntID_TRIANGLES_DOWN, false); + changesMenu->Check (cntID_TRIANGLES_LEFT, false); + changesMenu->Check (cntID_TRIANGLES_RIGHT, true); + changesMenu->Check (cntID_RECTANGLES, false); + } + } + /** + * Reacts to the cntID_RECTANGLES wxCommandEvent and changes the assigned figure to -rectangles- for the color points of the color bar. + * param & anEvent The wxCommandEvent actioned event + */ + void pColorBar :: onRectangles_Figure ( wxCommandEvent& anEvent ) + { + if( !changesMenu->IsChecked(cntID_TRIANGLES_RIGHT) ) + { + changeFigure (RECTANGLE);// RECTANGLE = 4 + changesMenu->Check (cntID_TRIANGLES_UP, false); + changesMenu->Check (cntID_TRIANGLES_DOWN, false); + changesMenu->Check (cntID_TRIANGLES_LEFT, false); + changesMenu->Check (cntID_TRIANGLES_RIGHT, false); + changesMenu->Check (cntID_RECTANGLES, true); + } + } + + /** + * Reacts to the cntID_DEGRADE_CONTROL wxCommandEvent and turns on/off the degrade in the color bar. + * param & anEvent The wxCommandEvent actioned event + */ + void pColorBar :: onDegradeControl ( wxCommandEvent& anEvent ) + { + bool degrade = getDegradeState(); + wxString nextAction_text; + if(degrade) + { + nextAction_text = _T("Turn on degrade"); + setDegradeState (false); + } + else + { + nextAction_text = _T("Turn off degrade"); + setDegradeState (true); + } + c_popmenu.SetLabel ( cntID_DEGRADE_CONTROL, nextAction_text ); + } + + /** + * Reacts to the wxEVT_RIGHT_DCLICK wxMouseEvent and adds a color degrade point to the color bar. + * Informs the result of the handled event like a wxCommandEvent wxEVT_ADDED_COL_POINT if the point was succesfully inserted. + * param & event The wxMouseEvent actioned event + */ + void pColorBar :: onLeftButtonDClick (wxMouseEvent& event) + { + if (activeState) + { + bool addedPoint = false; + wxPoint point = event.GetPosition(); + bool posiblePoint = false; + if( getOrientation() ) + { + posiblePoint = point.x>=deviceStart_x && point.y<= (bar_height + deviceStart_y); + } + else + { + posiblePoint = point.x>=deviceStart_y && point.x<= (bar_height+deviceStart_y) && point.y>deviceStart_x; + } + + if (posiblePoint) + { + double real_x = getOrientation() ? convertToRealValue( point.x ) : convertToRealValue( point.y ); + wxColour selectedColor = getSelectedColour(); + if (okSelectedColor) + { + addedPoint = addColorPoint (real_x, selectedColor); + } + // Inform addedPoint event + if ( addedPoint ) + { + //RefreshForce(); Is all ready refreshed on the adition of the point method + createAndSendEvent( wxEVT_ADDED_POINT ); + } + } + } + } + + void pColorBar ::onLeftClicDown(wxMouseEvent& event ) + { + acceptedClick = true; + } + + void pColorBar ::onLeftClickUp(wxMouseEvent& event ) + { + movingPointIndex = -1; + acceptedClick = false; + } + /* + * Shows the popup menu + */ + void pColorBar :: onShowPopupMenu (wxMouseEvent &event) + { + if (activeState) + { + if(showedColorPoints.empty()) + { + c_popmenu.Enable(cntID_DEL_COLOR_POINT, false); + } + else + { + c_popmenu.Enable(cntID_DEL_COLOR_POINT, true); + } + bool setClickedValues = false; + if( getOrientation() ) + { + setClickedValues = event.GetX()>=deviceStart_x && event.GetY()<= (bar_height + deviceStart_y); + } + else + { + setClickedValues = event.GetX()>=deviceStart_y && event.GetX()<= (bar_height+deviceStart_y) && event.GetY()>deviceStart_x; + } + if (setClickedValues) + { + setClickedX ( event.GetX() ); + setClickedY ( event.GetY() ); + RefreshForce(); + PopupMenu( &c_popmenu, event.GetX(), event.GetY()); + } + } + } + //------------------------------------------------------------------------------------------------------------ + // Other methods implementation + //------------------------------------------------------------------------------------------------------------ + + /* + * Method that reinitiates attributes of the color bar to the given points + * param minRealValue The minimum represented value (real value) + * param maxRealValue The maximum represented value (real value) + */ + void pColorBar :: reinitiateColorBar(double minRealValue, double maxRealValue) + { + + _logicalBar -> clearPoints(); + showedColorPoints.clear(); + + movingPointIndex = -1; + realX_vertical_line = -1; + activeState = true; + accumTemporalPoints = 0; + viewingRange = false; + setDegradeState(true); + setRepresentedValues(minRealValue, maxRealValue); + } + + /* + * Method that reinitiates attributes of the color bar and set the points given by parameter + * param pointsVector The the vector of the new points, the color points must have at least two points. + */ + void pColorBar :: reinitiateColorBarTo (std::vector pointsVector) + { + _logicalBar -> clearPoints(); + _logicalBar -> setColorPoints(pointsVector); + showedColorPoints.clear(); + + movingPointIndex = -1; + realX_vertical_line = -1; + activeState = true; + accumTemporalPoints = 0; + viewingRange = false; + setDegradeState(true); + + double minRealValue = _logicalBar -> getMinValue(); + double maxRealvalue = _logicalBar -> getMaxValue(); + + setRepresentedValues(minRealValue, maxRealvalue); + } + + /* + * Method that sets a copy of the points of the color bar to the given pointer parameter + * param pointsList The list for getting the points + */ + void pColorBar :: getPointsListWithTemps (std::vector &pointsVector) + { + pColorPoint* cPoint; + for (int a =0; agetRealX(), cPoint->getColor( ), (cPoint->isTemporalColor())); + pointsVector.push_back(copyPoint); + } + } + + /* + * Method that sets a copy of the points of the color bar to the given pointer parameter, and sets the default values to the needeed attributes, it doesn't + * includes the teporal points created + * param pointsList The list for getting the points + */ + + void pColorBar :: getAddedColorsPointsList (std::vector &pointsVector) + { + pColorPoint* cPoint; + for (int a =0; a<_logicalBar->getCount(); a++) + { + cPoint = _logicalBar ->getPointAtIndex(a); + pColorPoint* copyPoint = new pColorPoint(cPoint->getRealX(), cPoint->getColor( ), (cPoint->isTemporalColor())); + pointsVector.push_back(copyPoint); + } + } + + + /** + * Adds a color degrade point to the color bar. + * param xRealValue The real xValue of the point + * param theColour The assigned color for the point + * param temporalStart Indicates if the inserted point is the temporal startShowing point + * param temporalEnd Indicates if the inserted point is the temporal startShowing point + * return Returns true if the point was succesfully inserted. + */ + bool pColorBar :: addColorPoint (double xRealValue, wxColour theColour/*, bool temporalStart, bool temporalEnd*/) + { + bool addedPoint = false; + addedPoint = _logicalBar->addColorPoint(xRealValue,theColour); + if (addedPoint) + RefreshForce(); + return addedPoint; + } + + + /** + * Delets a color degrade point to the color bar. + * param xRealValue The real xValue of the point to delete + * return Returns true if the point was succesfully inserted. + */ + bool pColorBar :: deleteColorPoint (double xRealValue) + { + pColorPoint* actualPoint; + bool deletedPoint = false; + for (int a =0; a getRealX(); + bool isInsideActual = figure -> isPointInside (convertToPixelValue(actualX), convertToPixelValue(xRealValue)); + if( actualX == xRealValue || isInsideActual) + { + movingPointIndex=-1; + deletedPoint = _logicalBar->deleteColorPoint(actualPoint -> getRealX()); + } + } + if (deletedPoint) + RefreshForce(); + return deletedPoint; + } + + /** + * Changes the color degrade point color value. + * Informs the result of the handled event like a wxCommandEvent wxEVT_CHANGED_COLOR_POINT if the point changed its colour. + * param clickedValue The x-coord pixel value of the point to which the color change interests + * return Returns true if the color point was succesfully updated. + */ + bool pColorBar :: changeColor ( int clickedValue ) + { + bool colourUpdated = false; + double xRealValue = convertToRealValue( clickedValue ); + pColorPoint* actualPoint; + for (int a =0; a getRealX(); + bool isInsideActual = figure -> isPointInside (convertToPixelValue(actualX), clickedValue); + if( actualX == xRealValue || isInsideActual) + { + wxColour newColour = getSelectedColour(); + if (okSelectedColor) + { + actualPoint -> setColor(newColour); + colourUpdated = true; + } + } + } + if(colourUpdated) + RefreshForce(); + return colourUpdated; + } + + /* + * Repaints the color bar in horizontal direction mode + */ + void pColorBar :: repaintView( ) + { + wxMemoryDC temp_dc; + temp_dc.SelectObject( * colorBar_Bitmap ); + temp_dc.SetBrush(wxBrush( colourParent ,wxSOLID )); + temp_dc.SetPen(wxPen( colourParent,1,wxSOLID )); + if (getOrientation()) + { + temp_dc.DrawRectangle(0, 0, bar_width, bar_height); + temp_dc.SetPen(wxPen( wxColour(167,165,191),1,wxSOLID )); + temp_dc.DrawRectangle(0, 0, bar_width-deviceEndMargin, bar_height); + } + else + { + temp_dc.DrawRectangle(0, 0, bar_height, bar_width); + temp_dc.SetPen(wxPen( wxColour(167,165,191),1,wxSOLID )); + temp_dc.DrawRectangle(0, 0, bar_height, bar_width-deviceEndMargin); + } + wxPoint figPoints[4]; + + if( _logicalBar -> getCount() >0) + { + updatePointsToDraw(); + + int numberEdges = figure->getNumberEdges(); + wxPoint points [4]; + figure->getVertexPoints(points); + figure ->setVertexPoints (points); + + int maxValue = showedColorPoints.size(); + pColorPoint * iniPoint; + pColorPoint * endPoint; + wxColor intialColor, finalColor; + for (int a=0; a getRealX()); + intialColor = iniPoint -> getColor(); + + if( a getRealX()); + finalColor = endPoint -> getColor(); + + int rectangle_width = end_pixelX - ini_pixelX; + + //************************************************************************************* + int initial_r = intialColor.Red(); + int final_r = finalColor.Red() ; + int initial_g = intialColor.Green(); + int final_g= finalColor.Green(); + int initial_b = intialColor.Blue(); + int final_b= finalColor.Blue(); + + float m_scope_r = (float)(final_r-initial_r)/rectangle_width; + float m_scope_g = (float)(final_g-initial_g)/rectangle_width; + float m_scope_b = (float)(final_b-initial_b)/rectangle_width; + + int next_r = initial_r; + int next_g = initial_g; + int next_b = initial_b; + + float nxt_r = (float)next_r; + float nxt_g = (float)next_g; + float nxt_b = (float)next_b; + + for (int Xi =ini_pixelX; Xi<= end_pixelX; Xi++) + { + temp_dc.SetBrush(wxBrush( wxColour(next_r, next_g, next_b),wxSOLID )); + temp_dc.SetPen(wxPen( wxColour(next_r, next_g, next_b),1,wxSOLID )); + if( getOrientation() ) + temp_dc.DrawLine(Xi, 0, Xi, bar_height); + else + temp_dc.DrawLine(0, Xi, bar_height, Xi); + + nxt_r = (m_scope_r + nxt_r); + nxt_g = (m_scope_g + nxt_g); + nxt_b = (m_scope_b + nxt_b); + + next_r = (int)(nxt_r); + next_g = (int)(nxt_g); + next_b = (int)(nxt_b); + } + } + } + if( movingPointIndex!=-1 && movingNodePoint!=NULL ) + { + if ( !(movingNodePoint -> isTemporalColor()) ) + { + if( movingNodePoint==iniPoint && movingPointIndex!=-1 ) + { + temp_dc.SetBrush(wxBrush( wxColour(5,36,180), wxSOLID )); + temp_dc.SetPen(wxPen( wxColour(239,239,239), 1, wxSOLID )); + if (getOrientation()) + temp_dc.DrawPolygon(numberEdges, points, ini_pixelX, 0); + else + temp_dc.DrawPolygon(numberEdges, points, 0, ini_pixelX); + } + else + { + temp_dc.SetBrush(wxBrush( intialColor, wxSOLID )); + if(iniPoint->isTemporalColor()) + temp_dc.SetPen(wxPen( intialColor, 1, wxSOLID )); + else + temp_dc.SetPen(wxPen( wxColour(0,0,0), 1, wxSOLID )); + if (getOrientation()) + temp_dc.DrawPolygon(numberEdges, points, ini_pixelX, 0); + else + temp_dc.DrawPolygon(numberEdges, points, 0, ini_pixelX); + } + } + } + else + { + if ( !(iniPoint -> isTemporalColor()) ) + { + temp_dc.SetBrush(wxBrush( intialColor, wxSOLID )); + temp_dc.SetPen(wxPen( wxColour(0,0,0), 1, wxSOLID )); + if (getOrientation()) + temp_dc.DrawPolygon(numberEdges, points, ini_pixelX, 0); + else + temp_dc.DrawPolygon(numberEdges, points, 0, ini_pixelX); + } + } + } + if (realX_vertical_line!=-1) + { + temp_dc.SetPen(wxPen( guideLineColor,1,wxDOT )); + int pixelX_guide = convertToPixelValue(realX_vertical_line); + if (getOrientation()) + temp_dc.DrawLine(pixelX_guide, 0, pixelX_guide, bar_height); + else + temp_dc.DrawLine(0, pixelX_guide, bar_height, pixelX_guide); + } + } + } + + /* + * Forces the refresh view of the color bar + */ + void pColorBar :: RefreshForce () + { + Refresh(false); + } + + /* + * Draws the color bar with its degrades + * param recentlyChangedOrientation indicates if the orientation has been changed before calling this method + */ + void pColorBar :: drawColorBar (bool recentlyChangedOrientation) + { + wxRect rectTotal = GetClientRect(); + if (recentlyChangedOrientation) + { + if ( getOrientation() ) // HORIZONTAL + { + //SetSize(width, height ); + wxWindow::SetSize( width, height ); + //SetSize( rectTotal.GetWidth(), rectTotal.GetHeight() ); + setWidth(GetClientRect().GetWidth()- deviceEndMargin); + //setHeight(GetClientRect().GetHeight()); + + colorBar_Bitmap = new wxBitmap( bar_width+1280, bar_height+1280 ); + //information_Bitmap = new wxBitmap( width-bar_width, height-bar_height ); + } + else // VERTICAL + { + wxWindow::SetSize( height, width ); + //SetSize( rectTotal.GetHeight(), rectTotal.GetWidth() ); + setWidth(GetClientRect().GetHeight()- deviceEndMargin); + //setHeight(GetClientRect().GetWidth()); + + //SetWindowStyle( wxNO_FULL_REPAINT_ON_RESIZE ); + colorBar_Bitmap = new wxBitmap( bar_height+1280, bar_width+1280 ); + //information_Bitmap = new wxBitmap( height-bar_height, width-bar_width ); + } + } + } + + /* + * Changes the figure of the color points according to the parameter + * param figureOrientation Is the corresponding number for identifying the figure + * RECTANGLE = 4,TRIANGLE LEFT = -4, TRIANGLE RIGHT = -6, TRIANGLE UP = -8, TRIANGLE DOWN = -2 + */ + void pColorBar :: changeFigure(int figureOrientation) + { + if ( figureOrientation<1 ) //The figure is a a rotated triangle + { + changePointsFigure_Edges(3); + figure -> setFigureOrientation ( figureOrientation ); + + } + else //The figure is a rectangle + { + changePointsFigure_Edges(4); + } + RefreshForce(); + } + + /** + * Changes the figure used for the degreade color points to the indicated one by parameter + * param figEdges Is the constant that represents the figure number of edges (TRIANGLE | RECTANGLE) + */ + void pColorBar :: changePointsFigure_Edges(int figEdges) + { + figure->setNumberEdges( figEdges); + } + + /** + * Gets the constant that represents the figure used for the degreade color points + * return figureEdges Is the constant that represents the figure number of edges (TRIANGLE | RECTANGLE) + */ + int pColorBar :: getPointsFigure_Edges () + { + return (figure -> getNumberEdges()); + } + + /** + * Sets the height of the drawing bar area + * param _h The height to set + */ + void pColorBar :: setHeight (int _h) + { + height = _h; + bar_height = height-gapY; + } + + /** + * Sets the height of the drawing bar area + * return _h The height to get + */ + int pColorBar :: getHeight() + { + return height; + } + + /** + * Sets the width of the drawing bar area + * param _w The width to set + */ + void pColorBar :: setWidth (int _w) + { + width = _w; + bar_width = width-gapX; + } + + /** + * Gets the width of the drawing bar area + * param width The width to get + */ + int pColorBar :: getWidth () + { + return width; + } + + /** + * Sets the height of the containing rectangle bar + * param _h The height to set + */ + void pColorBar :: setBarHeight (int _h) + { + bar_height = _h; + } + + /** + * Gets the height of the containing rectangle bar + * return bar_height The height to get + */ + int pColorBar :: getBarHeight() + { + return bar_height; + } + + /** + * Sets the width of the containing rectangle bar + * param _w The width to set + */ + void pColorBar :: setBarWidth (int _w) + { + bar_width = _w; + } + + /** + * Gets the width of the containing rectangle bar + * return bar_width The width to get + */ + int pColorBar :: getBarWidth () + { + return bar_width; + } + + /** + * Sets the orientation of the color bar + * param _orientation The orientation to set VERTICAL = false, HORIZONTAL = true + */ + void pColorBar :: setOrientation (bool _orientation) + { + _logicalBar -> setOrientation(_orientation); + figure -> setBarOrientation (_orientation); + } + + /** + * Gets the orientation of the color bar + * return bar_orientation The bar orientation assigned + */ + bool pColorBar :: getOrientation () + { + return _logicalBar->getOrientation(); + } + + /** + * Sets the collection of color points + * param _points The new points to set, each one of data type pColorPoint ( xValue, wxColour_assigned) + */ + void pColorBar :: setPoints (std::vector _points) + { + _logicalBar->clearPoints(); + showedColorPoints.clear(); + _logicalBar->setColorPoints(_points); + //posible needed to update + } + + /** + * Gets the last clickedX pixel coord inside the bar. + * return clickedX The x-coord pixel value + */ + int pColorBar :: getClickedX() + { + return clickedX; + } + + /** + * Sets the last clickedX pixel coord inside the bar. + * param xCoordPixel The x-coord value to set + */ + void pColorBar :: setClickedX(int xCoordPixel) + { + clickedX = xCoordPixel; + } + + /** + * Gets the last clickedY pixel coord inside the bar. + * return clickedY The y-coord pixel value + */ + int pColorBar :: getClickedY() + { + return clickedY; + } + + /** + * Sets the last clickedY pixel coord inside the bar. + * param yCoordPixel The y-coord pixel value to set + */ + void pColorBar :: setClickedY(int yCoordPixel) + { + clickedY = yCoordPixel; + } + + /** + * Gets the real x value for a given x-pixel value using the rule real_x = minX_represented_Tshow + ((x_Pixel * (maxX_represented_Tshow - minX_represented_Tshow) ) / bar_width) + * param x_Pixel The pixel value to convert into real value with respect to the x scale + * return realX The real-x value corresponding to the xPixel + */ + double pColorBar :: convertToRealValue ( int x_Pixel ) + { + /** + int newPixel = x_Pixel*(bar_width - deviceEndMargin - deviceStart_x)/(bar_width) ; + return newPixel*(maxX_represented_Tshow - minX_represented_Tshow)/(bar_width); +*/ + return minX_represented_Tshow + ((x_Pixel-deviceStart_x) * (maxX_represented_Tshow - minX_represented_Tshow) ) /( bar_width-deviceEndMargin); + } + + /** + * Gets the x-pixel value for a given x_real value using the rule x_pixel = ((x_real - minX_represented_Tshow) * bar_width)/(maxX_represented_Tshow - minX_represented_Tshow) + * param x_Pixel The pixel value to convert into real value with respect to the x scale + * return realX The real-x value corresponding to the xPixel + */ + int pColorBar :: convertToPixelValue (double x_real ) + { + return (int)( ((x_real - minX_represented_Tshow) * (bar_width-deviceEndMargin))/(maxX_represented_Tshow - minX_represented_Tshow) ); + } + + /** + * Gets the selected color and updates the state of the okSelectedColor + * return selectedColor Is the selected rbg color + */ + wxColour pColorBar :: getSelectedColour() + { + okSelectedColor = false; + wxColour col; + wxColourData data; + wxColourDialog dialog( GetParent(), &data); + + if ( dialog.ShowModal() == wxID_OK ) + { + col = dialog.GetColourData().GetColour(); + okSelectedColor = true; + } + return col; + } + + /** + * Sets the represented minimum and maximunm values + * param minRealValue The minimum represented value (real value) + * param maxRealValue The maximum represented value (real value) + */ + void pColorBar :: setRepresentedValues ( double minRealValue, double maxRealValue ) + { + temporalMinXToShow = minRealValue; + temporalMaxXToShow = maxRealValue; + + minX_represented_Tshow = minRealValue; + maxX_represented_Tshow = maxRealValue; + _logicalBar->setMinValue(minX_represented_Tshow); + _logicalBar->setMaxValue(maxX_represented_Tshow); + } + + /** + * Gets the data of the last point moving in a pColorPoint copy + * return pointData Is a pColorPoint with the data of las moved color + */ + pColorPoint * pColorBar :: getLastMovedColorPoint() + { + pColorPoint * dataPoint = new pColorPoint ( 0, wxColor (0,0,0), false); + if (movingNodePoint) + { + dataPoint ->setColor(movingNodePoint->getColor()); + dataPoint ->setRealX(movingNodePoint->getRealX()); + } + return dataPoint; + } + + /** + * Sets the gap values for the color bar bitmap + * param gap_x Gap in x + * param gap_y Gap in y + */ + void pColorBar :: setGapValues (int gap_x, int gap_y) + { + gapX = gap_x; + gapY = gap_y; + } + + /** + * Sets the degrade state of the color bar + * param newState The degrade stare to set + */ + void pColorBar :: setDegradeState(bool newState) + { + doingDegrade = newState; + } + + /** + * Gets the degrade state of the color bar + * return doingDegrade is the actual degrade state of the bar + */ + bool pColorBar :: getDegradeState() + { + return doingDegrade; + } + + /** + * Sets the visible range of the bar and repaints the bar according to it, the min value must be less than the max value. + * param minToShow Is the minimum value to show in the colorbar + * param maxToShow Is the maximum value to show in the colorbar + */ + void pColorBar :: setVisibleRange(int minToShow, int maxToShow) + { + minX_represented_Tshow = minToShow; + maxX_represented_Tshow = maxToShow; + viewingRange = true; + RefreshForce(); + } + + /** + * Sets the state of static or not for the limit color points + * pamar areStatic Is the state to set for the limits + */ + void pColorBar :: setStaticLimitsTo(bool areStatic) + { + staticLimits = areStatic; + } + + /** + * Gets the state of static or not for the limit color points + * return staticLimits Is the state for limits + */ + bool pColorBar :: getStaticLimits() + { + return staticLimits; + } + + /** + * Sets the device start drawing left-superior (pixel) start point and draws automatically the color bar + * param deviceStart_x Pixel start for x-coord + * param deviceStart_y Pixel start for y-coord + */ + void pColorBar :: setDeviceBlitStart ( wxCoord devStart_x, wxCoord devStart_y ) + { + deviceStart_x = devStart_x; + deviceStart_y = devStart_y; + if (getOrientation()) + width += deviceStart_x; + else + height += deviceStart_y; + drawColorBar(true); + } + + /** + * Clears the temporal color points of the list + */ + void pColorBar :: clearTemporalColors() + { + + } + + /** + * Set active state + * param activeNow The new state + */ + void pColorBar :: setActiveStateTo (bool activeNow) + { + activeState = activeNow; + } + + /** + * Gets the active state of the bar + * return isActive The actual state + */ + bool pColorBar :: isActive() + { + return activeState; + } + + /** + * Gets the real-x value to draw a vertical line + * return realX_vertical_line The real x value for the vertical line + */ + int pColorBar :: getRealX_vertical_line() + { + return realX_vertical_line; + } + + /** + * Sets the real-x value to draw a vertical line + * param realX_vertical_line The new real x value for the vertical line + */ + void pColorBar :: setRealX_vertical_line(int newReal_x) + { + realX_vertical_line = newReal_x; + } + + /** + * Sets the new device (deviceEndMargin) value form the end of this panel to the end of the drawing area in the device + * param newDeviceEnd_pixels The new pixel value to asign to the right(horizontal view), underneath(vertical view) margin in pixels + */ + void pColorBar :: setDeviceEndMargin(int newDeviceEnd_pixels) + { + deviceEndMargin = newDeviceEnd_pixels; + } + + void pColorBar :: createAndSendEvent(WXTYPE theEventType) + { + wxCommandEvent cevent( theEventType, GetId() ); + cevent.SetEventObject( this ); + GetEventHandler()->ProcessEvent( cevent ); + } + + + /** + Returns the number of points that the bar color has + */ + int pColorBar::getColorPointsSize() + { + return _logicalBar->getCount(); + } + + /* + Get the RGB values of the color point that is in the + index given with respecto to the + */ + void pColorBar::getDataAt(int index, double& x,int& red,int& green,int& blue) + { + //****************************** + _logicalBar->getDataAt(index, x, red, green, blue); + } + + /* + * Sets the guide line color + * param theNwGuideLineColor The color to set to the guideLineColor + */ + void pColorBar :: setGuideLineColour(wxColour theNwGuideLineColor) + { + guideLineColor = theNwGuideLineColor; + } + + /* + * Gets the guide line color + * return guideLineColor The color of the guideLine + */ + wxColour pColorBar :: getGuideLineColour() + { + return guideLineColor; + } + + /* + * Sets the guide line color + * param theNwGuideLineColor The color to set to the guideLineColor + */ + void pColorBar :: setBackGroundColour(wxColour theNwBackColor) + { + colourParent = theNwBackColor; + } + + /* + * Gets the guide line color + * return guideLineColor The color of the guideLine + */ + wxColour pColorBar :: getBackGroundColour() + { + return colourParent; + } + + /* + * Gets the min value of the color bar + */ + double pColorBar :: getMinValue() + { + return (double)minX_represented_Tshow; + } + + /* + * Gets the max value of the color bar + */ + double pColorBar :: getMaxValue() + { + return (double)maxX_represented_Tshow; + } + + + void pColorBar :: updatePointsToDraw() + { + accumTemporalPoints = 0; + if (_logicalBar->getCount()>0) + { + showedColorPoints.clear(); + + int startIndex, endIndex; + _logicalBar -> getPointersToRangeLimits( showedColorPoints, startIndex, endIndex, minX_represented_Tshow, maxX_represented_Tshow ); + + int internalCount = _logicalBar->getCount(); + std::deque ::iterator iterStart = showedColorPoints.begin( ); + std::deque ::iterator iterEnd = showedColorPoints.end( ); + + int pixelTmpStart = convertToPixelValue (minX_represented_Tshow); + int pixelTmpEnd = convertToPixelValue (maxX_represented_Tshow); + int initial_r, final_r, initial_g, final_g, initial_b, final_b, rectangle_width; + double realINI, realEND; + + bool includeTempStart = false; + bool includeTempEnd = false; + //-----------------Adding the first visible point of the list + if(showedColorPoints.size()>0) + { + includeTempStart = (int)(showedColorPoints.front()->getRealX())>minX_represented_Tshow ; + includeTempEnd = (int)(showedColorPoints.back()->getRealX())= 0 ) + { + if( startIndex == 0 ) + { + //The temporal showing point for the start should have the same color of the initial point in range at startIndex + _logicalBar -> getDataAt( startIndex, realINI, initial_r, initial_g, initial_b ); + realINI = minX_represented_Tshow; + _logicalBar -> getDataAt( startIndex, realEND, final_r, final_g, final_b ); + } + else if( startIndex > 0 ) + { + _logicalBar -> getDataAt( startIndex-1, realINI, initial_r, initial_g, initial_b ); + _logicalBar -> getDataAt( startIndex, realEND, final_r, final_g, final_b ); + } + + if( includeTempStart ) + { + int ini_pixelX = convertToPixelValue( realINI ); + int end_pixelX = convertToPixelValue( realEND ); + + rectangle_width = end_pixelX - ini_pixelX; + + float m_scope_r = (float)(final_r-initial_r)/rectangle_width; + float m_scope_g = (float)(final_g-initial_g)/rectangle_width; + float m_scope_b = (float)(final_b-initial_b)/rectangle_width; + + + float bRed = initial_r - m_scope_r*pixelTmpStart; + float bGreen = initial_g - m_scope_g*pixelTmpStart; + float bBlue = initial_b - m_scope_b*pixelTmpStart; + + showedColorPoints.push_front( new pColorPoint ( minX_represented_Tshow, wxColour( (m_scope_r*pixelTmpStart)+bRed, (m_scope_g*pixelTmpStart)+bGreen, (m_scope_b*pixelTmpStart)+bBlue ), true)); + + accumTemporalPoints ++; + } + } + if( includeTempEnd && minX_represented_Tshow < maxX_represented_Tshow ) + { + if( internalCount>0 ) + { + if( endIndex == internalCount-1 ) + { + _logicalBar -> getDataAt( endIndex, realINI, initial_r, initial_g, initial_b ); + _logicalBar -> getDataAt( endIndex, realEND, final_r, final_g, final_b ); + realEND = maxX_represented_Tshow; + } + else + { + _logicalBar -> getDataAt( endIndex, realINI, initial_r, initial_g, initial_b ); + _logicalBar -> getDataAt( endIndex+1, realEND, final_r, final_g, final_b ); + } + + int ini_pixelX = convertToPixelValue( realINI ); + int end_pixelX = convertToPixelValue( realEND ); + + rectangle_width = end_pixelX - ini_pixelX; + + float m_scope_r = (float)(final_r-initial_r)/rectangle_width; + float m_scope_g = (float)(final_g-initial_g)/rectangle_width; + float m_scope_b = (float)(final_b-initial_b)/rectangle_width; + + float bRed = initial_r - m_scope_r*pixelTmpEnd; + float bGreen = initial_g - m_scope_g*pixelTmpEnd; + float bBlue = initial_b - m_scope_b*pixelTmpEnd; + showedColorPoints.push_back( new pColorPoint ( maxX_represented_Tshow, wxColour( ( m_scope_r*pixelTmpEnd)+bRed, (m_scope_g*pixelTmpEnd)+bGreen, (m_scope_b*pixelTmpEnd)+bBlue ), true)); + accumTemporalPoints ++; + } + } + } + else + { + if(_logicalBar->getCount()>0) + { + if ( minX_represented_Tshow > _logicalBar->getMaxAddedValue() ) + { + endIndex = _logicalBar->getCount()-1; + } + else if ( maxX_represented_Tshow < _logicalBar->getMinAddedValue() ) + { + endIndex = 0; + } + + _logicalBar -> getDataAt( endIndex, realINI, initial_r, initial_g, initial_b ); + _logicalBar -> getDataAt( endIndex, realEND, final_r, final_g, final_b ); + + realINI = minX_represented_Tshow; + realEND = maxX_represented_Tshow; + + showedColorPoints.push_back( new pColorPoint ( realINI, wxColour( initial_r, initial_g, initial_b ), true)); + accumTemporalPoints ++; + showedColorPoints.push_back( new pColorPoint ( realEND, wxColour( initial_r, initial_g, initial_b ), true)); + accumTemporalPoints ++; + } + } + } + + if ( !showedColorPoints.empty() ) + { + startNode_show = showedColorPoints.front(); + lastNode_show = showedColorPoints.back(); + } + } + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pColorBar.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pColorBar.h new file mode 100644 index 0000000..794ff50 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pColorBar.h @@ -0,0 +1,762 @@ + +#ifndef __pCOLOR_BAR__ +#define __pCOLOR_BAR__ + +// ----------------------------------------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ----------------------------------------------------------------------------------------------------------- +#include +#ifdef __BORLANDC__ +#pragma hdrstop +#endif +#ifndef WX_PRECOMP +#include +#endif + +//------------------------------------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------------------------------------ +#include +#include +#include + +#include "marTypes.h" +#include "pColorPoint.h" +#include "LogicalColorBar.h" +//#include "DegradeRectangle.h" +#include "pFigure.h" +#include "wx/colordlg.h" + + +#define TRIANGLE 3 +#define RECTANGLE 4 +//in pixels +/* +* Attribute that determines the width of each color point +*/ +#define FIGURE_WIDTH 3 + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE( wxEVT_ADDED_POINT, -1 ) + DECLARE_EVENT_TYPE( wxEVT_REMOVED_POINT, -1 ) + DECLARE_EVENT_TYPE( wxEVT_MOVED_POINT, -1 ) + DECLARE_EVENT_TYPE( wxEVT_CHANGED_POINT, -1 ) + DECLARE_EVENT_TYPE( wxEVT_ON_COLOR_BAR, -1 ) +END_DECLARE_EVENT_TYPES() + + +//------------------------------------------------------------------------------------------------------------- +// Enum declarations +//------------------------------------------------------------------------------------------------------------- +/** Command IDs used by pColorPoint */ +enum +{ + cntID_ADD_COLOR_POINT = 6000, + cntID_DEL_COLOR_POINT, + cntID_CHANGE_COLOR_POINT, + cntID_DEGRADE_CONTROL, + cntID_CHANGE_FIGURE, + cntID_TRIANGLES_UP, + cntID_TRIANGLES_DOWN, + cntID_TRIANGLES_LEFT, + cntID_TRIANGLES_RIGHT, + cntID_RECTANGLES, +}; + +/** file pColorBar.h */ +class MARACASVISULIB_EXPORTS pColorBar :public wxScrolledWindow{ +public: + + //------------------------------------------------------------------------------------------------------------ + // Constructors & Destructors + //------------------------------------------------------------------------------------------------------------ + /** + * Creates a colorBar instance + * param *parent Container event listener window + * param _w Width of the color bar drawing area + * param _h Height of the color bar drawing area + * param _bar_orientation VERTICAL (false) or HORIZONTAL (true) direction to set + */ + pColorBar (wxWindow *parent, int _w, int _h, bool _bar_orientation); + + ~pColorBar (); + + //------------------------------------------------------------------------------------------------------------ + // Color bar proccessed events methods + //------------------------------------------------------------------------------------------------------------ + void OnSize( wxSizeEvent &WXUNUSED(event) ); + + /** + * Reacts to the mouse movement inside the color bar for moving the clicked color point in the x-axis. + * Informs the result of the handled event like a wxCommandEvent wxEVT_MOVED_POINT if a point was moved. + * param event The mouse actioned event + */ + void onMouseMove ( wxMouseEvent& event ); + /* + * Reacts to the event of drawing the bar and draws it + * param &WXUNUSED(event) The correspondig wxPaintEvent actioned event + */ + void onPaint ( wxPaintEvent &WXUNUSED(event) ); + + /** + * Reacts to the cntID_ADD_COLOR_POINT wxCommandEvent and adds a color degrade point to the color bar. + * Informs the result of the handled event like a wxCommandEvent wxEVT_ADDED_POINT if the point was inserted succesfully. + * param & anEvent The wxCommandEvent actioned event + */ + void onAddColorPoint ( wxCommandEvent& anEvent ); + + /** + * Reacts to the cntID_DEL_POINT wxCommandEvent and deletes a color degrade point of the color bar. + * Informs the result of the handled event like a wxCommandEvent wxEVT_REMOVED_POINT if the point was succesfully removed. + * param & anEvent The wxCommandEvent actioned event + */ + void onDeleteColorPoint ( wxCommandEvent& anEvent ); + + /** + * Reacts to the cntID_CHANGE_COLOR_POINT wxCommandEvent and changes the assigned color to the selected color degrade point of the color bar. + * Informs the result of the handled event like a wxCommandEvent wxEVT_CHANGED_POINT if the point was succesfully removed. + * param & anEvent The wxCommandEvent actioned event + */ + void onChangeColourSelectedPoint ( wxCommandEvent& anEvent ); + + /** + * Reacts to the cntID_TRIANGLES_UP wxCommandEvent and changes the assigned figure to -triangles up- for the color points of the color bar. + * param & anEvent The wxCommandEvent actioned event + */ + void onTrianglesUp_Figure ( wxCommandEvent& anEvent ); + /** + * Reacts to the cntID_TRIANGLES_DOWN wxCommandEvent and changes the assigned figure to -triangles down- for the color points of the color bar. + * param & anEvent The wxCommandEvent actioned event + */ + void onTrianglesDown_Figure ( wxCommandEvent& anEvent ); + /** + * Reacts to the cntID_TRIANGLES_LEFT wxCommandEvent and changes the assigned figure to -triangles left- for the color points of the color bar. + * param & anEvent The wxCommandEvent actioned event + */ + void onTrianglesLeft_Figure ( wxCommandEvent& anEvent ); + /** + * Reacts to the cntID_TRIANGLES_RIGHT wxCommandEvent and changes the assigned figure to -triangles right- for the color points of the color bar. + * param & anEvent The wxCommandEvent actioned event + */ + void onTrianglesRight_Figure ( wxCommandEvent& anEvent ); + /** + * Reacts to the cntID_RECTANGLES wxCommandEvent and changes the assigned figure to -rectangles- for the color points of the color bar. + * param & anEvent The wxCommandEvent actioned event + */ + void onRectangles_Figure ( wxCommandEvent& anEvent ); + + /** + * Reacts to the cntID_DEGRADE_CONTROL wxCommandEvent and turns on/off the degrade in the color bar. + * param & anEvent The wxCommandEvent actioned event + */ + void onDegradeControl ( wxCommandEvent& anEvent ); + + /** + * Reacts to the wxEVT_RIGHT_DCLICK wxMouseEvent and adds a color degrade point to the color bar. + * Informs the result of the handled event like a wxCommandEvent wxEVT_ADDED_POINT if the point was succesfully inserted. + * param & event The wxMouseEvent actioned event + */ + void onLeftButtonDClick (wxMouseEvent& event); + + /** + * Shows the popup menu + */ + void onShowPopupMenu (wxMouseEvent& event); + + + //------------------------------------------------------------------------------------------------------------ + // Other methods + //------------------------------------------------------------------------------------------------------------ + + /** + * Set active state + * param activeNow The new state + */ + void setActiveStateTo (bool activeNow); + + /** + * Gets the active state of the bar + * return activeState The actual state + */ + bool isActive(); + + + /** + * Gets the real-x value to draw a vertical line + * return realX_vertical_line The real x value for the vertical line + */ + int getRealX_vertical_line(); + + /** + * Sets the real-x value to draw a vertical line + * param realX_vertical_line The new real x value for the vertical line + */ + void setRealX_vertical_line(int newReal_x); + + + /** + * Method that reinitiates attributes of the color bar to the given points + * param minRealValue The minimum represented value (real value) + * param maxRealValue The maximum represented value (real value) + */ + void reinitiateColorBar(double minRealValue, double maxRealValue); + + /** + * Method that reinitiates attributes of the color bar and set the points given by parameter + * param newPointsList Pointer to the list of the new points + */ + void reinitiateColorBarTo (std::vector pointsVector); + + /** + *Method that sets a copy of the points of the color bar to the given pointer parameter + * param pointsList The list for getting the points + */ + void getPointsListWithTemps (std::vector &pointsVector); + + /** + * Method that sets a copy of the points of the color bar to the given pointer parameter, and sets the default values to the needeed attributes, it doesn't + * includes the teporal points created + * param pointsVector The list for getting the points + */ + void getAddedColorsPointsList (std::vector& pointsVector); + + /** + * Adds a color degrade point to the color bar. + * param xRealValue The real xValue of the point + * param theColour The assigned color for the point + * param temporalStart Indicates if the inserted point is the temporal startShowing point + * param temporalEnd Indicates if the inserted point is the temporal startShowing point + * return Returns true if the point was succesfully inserted. + */ + bool addColorPoint (double xRealValue, wxColour theColour/*, bool temporalStart=false, bool temporalEnd=false*/); + + /** + * Delets a color degrade point to the color bar. + * param xRealValue The real xValue of the point to delete + * return Returns true if the point was succesfully inserted. + */ + bool deleteColorPoint (double xRealValue); + + /** + * Changes the color degrade point color value. + * Informs the result of the handled event like a wxCommandEvent wxEVT_CHANGED_COLOR_POINT if the point changed its colour. + * param clickedValue The x-coord pixel value of the point to which the color change interests + * return Returns true if the color point was succesfully updated. + */ + bool changeColor ( int clickedValue ); + + /** + * Repaints the color bar in direction mode of the orientation assigned + * param createTempPoints True for creating temporal points for start and end when a visible range changes + */ + void repaintView ( ); + + /** + * Forces the refresh view of the color bar + */ + void RefreshForce (); + + void Refresh(bool eraseBackground = true, const wxRect* rect = NULL); + + /** + * Draws the color bar with its degrades + * param recentlyChangedOrientation indicates if the orientation has been changed before calling this method + */ + void drawColorBar ( bool recentlyChangedOrientation); + + /** + * Changes the figure of the color points according to the parameter + * param theFigure Is the corresponding number for identifying the figure + * RECTANGLE = 4,TRIANGLE LEFT = -4, TRIANGLE RIGHT = -6, TRIANGLE UP = -8, TRIANGLE DOWN = -2 + */ + void changeFigure(int theFigure); + /** + * Changes the figure number of edges used for the degreade color points to the indicated one by parameter + * param figEdges Is the constant that represents the figure number of edges (TRIANGLE | RECTANGLE) + */ + void changePointsFigure_Edges (int figEdges); + + /** + * Gets the constant that represents the figure number of edges used for the degreade color points + * return figureEdges Is the constant that represents the figure number of edges (TRIANGLE | RECTANGLE) + */ + int getPointsFigure_Edges (); + + /** + * Sets the height of the drawing bar area + * param _h The height to set + */ + void setHeight (int _h); + + /** + * Sets the height of the drawing bar area + * return _h The height to get + */ + int getHeight(); + + /** + * Sets the width of the drawing bar area + * param _w The width to set + */ + void setWidth (int _w); + + /** + * Gets the width of the drawing bar area + * param width The width to get + */ + int getWidth (); + + /** + * Sets the height of the containing rectangle bar + * param _h The height to set + */ + void setBarHeight (int _h); + + /** + * Gets the height of the containing rectangle bar + * return bar_height The height to get + */ + int getBarHeight(); + + /** + * Sets the width of the containing rectangle bar + * param _w The width to set + */ + void setBarWidth (int _w); + + /** + * Gets the width of the containing rectangle bar + * return bar_width The width to get + */ + int getBarWidth (); + + /** + * Sets the orientation of the color bar + * param _orientation The orientation to set VERTICAL = false, HORIZONTAL = true + */ + void setOrientation (bool _orientation); + + /** + * Gets the orientation of the color bar + * return bar_orientation The bar orientation assigned + */ + bool getOrientation (); + + /** + * Sets the collection of color points + * param _points The new points to set, each one of data type pColorPoint ( xValue, wxColour_assigned) + */ + void setPoints (std::vector _points); + + /** + * Gets the last clickedX pixel coord inside the bar. + * return clickedX The x-coord pixel value + */ + int getClickedX(); + + /** + * Sets the last clickedX pixel coord inside the bar. + * param xCoordPixel The x-coord value to set + */ + void setClickedX(int xCoordPixel); + + /** + * Gets the last clickedY pixel coord inside the bar. + * return clickedY The y-coord pixel value + */ + int getClickedY(); + + /** + * Sets the last clickedY pixel coord inside the bar. + * param yCoordPixel The y-coord pixel value to set + */ + void setClickedY(int yCoordPixel); + + /** + * Gets the real x value for a givex x-pixel value using the rule real_x = (x_pixel * (maxX_represented_Tshow - minXRepresented) ) / bar_width + * param x_Pixel The pixel value to convert into real value with respect to the x scale + * return realX The real-x value corresponding to the xPixel + */ + double convertToRealValue ( int x_Pixel ); + + /** + * Gets the x-pixel value for a given x_real value using the rule x_pixel = (x_real * bar_width)/(maxX_represented_Tshow - minX_represented_Tshow) + * param x_Pixel The pixel value to convert into real value with respect to the x scale + * return realX The real-x value corresponding to the xPixel + */ + int convertToPixelValue ( double x_real ); + + /** + * Gets the selected color and updates the state of the okSelectedColor + * return selectedColor Is the selected rbg color + */ + wxColour getSelectedColour(); + + /** + * Sets the represented minimum and maximunm values + * param minRealValue The minimum represented value (real value) + * param maxRealValue The maximum represented value (real value) + */ + void setRepresentedValues ( double minRealValue, double maxRealValue); + + /** + * Gets the data of the last point moving + * return pointData Is a pColorPoint with the data of las moved color + */ + pColorPoint * getLastMovedColorPoint(); + + /** + * Sets the gap values for the color bar bitmap + * param gap_x Gap in x + * param gap_y Gap in y + */ + void setGapValues (int gap_x, int gap_y); + + /** + * Sets the degrade state of the color bar + * param newState The degrade stare to set + */ + void setDegradeState(bool newState); + + /* + * Sets the visible range of the bar and repaints the bar according to it, the min value must be less than the max value. + * param minToShow Is the minimum value to show in the colorbar + * param maxToShow Is the maximum value to show in the colorbar + */ + void setVisibleRange(int minToShow, int maxToShow); + + /** + * Gets the degrade state of the color bar + * return doingDegrade is the actual degrade state of the bar + */ + bool getDegradeState(); + + /** + * Sets the state of static or not for the limit color points + * pamar areStatic Is the state to set for the limits + */ + void setStaticLimitsTo(bool areStatic); + + /** + * Gets the state of static or not for the limit color points + * return staticLimits Is the state for limits + */ + bool getStaticLimits(); + + /** + * Sets the device start drawing left-superior (pixel) start point and draws automatically the color bar + * param deviceStart_x Pixel start for x-coord + * param deviceStart_y Pixel start for y-coord + */ + void setDeviceBlitStart ( wxCoord deviceStart_x, wxCoord deviceStart_y ); + + /** + * Clears the temporal color points of the list + */ + void clearTemporalColors(); + + /** + * Gets the device value form the end of this panel to the end of the drawing area in the device in pixels + * return deviceEndMargin The value asigned to the right margin + */ + int getDeviceEndX(); + + + /** + * Sets the new device (deviceEndMargin) value form the end of this panel to the end of the drawing area in the device + * param newDeviceEnd_pixels The new pixel value to asign to the right margin in pixels + */ + void setDeviceEndX(int newDeviceEnd_pixels); + + + /** + * Sets the new device (deviceEndMargin) value form the end of this panel to the end of the drawing area in the device + * param newDeviceEnd_pixels The new pixel value to asign to the right(horizontal view), underneath(vertical view) margin in pixels + */ + void setDeviceEndMargin(int newDeviceEnd_pixels); + + /** + * Method that creates and send the given id-event to the event handler + * param theEventType Is the event id type identification for generating the event + */ + void createAndSendEvent(WXTYPE theEventType); + + + /** + * Returns the number of points that the bar color has + * return + */ + int getColorPointsSize(); + + /** + Get the RGB values of the color point that is in the + index given + */ + void getDataAt(int index, double& x,int& red,int& green,int& blue); + + + /** + * Sets the guide line color + * param theNwGuideLineColor The color to set to the guideLineColor + */ + void setGuideLineColour(wxColour theNwGuideLineColor); + + /** + * Gets the guide line color + * return guideLineColor The color of the guideLine + */ + wxColour getGuideLineColour(); + + /** + * Sets the background color + * param theNwBackColor The color to set to the colourParent + */ + void setBackGroundColour(wxColour theNwBackColor); + + /** + * Gets the background color + * return colourParent The color of the background + */ + wxColour getBackGroundColour(); + + /** + * Gets the min value of the color bar + */ + double getMinValue(); + + /** + * Gets the max value of the color bar + */ + double getMaxValue(); + + /** + * Updates the colors of the first nonTemporal point in the list and the last nonTemporal point + * That logically corresponds always to the the first and last nodes of the color bar + */ + void updateExtremeColors(); + + void onLeftClicDown(wxMouseEvent& event ); + + void onLeftClickUp(wxMouseEvent& event ); + + void updatePointsToDraw(); + + //------------------------------------------------------------------------------------------------------------ + // Attributes declaration + //------------------------------------------------------------------------------------------------------------ + +private: + + /* + * + */ + bool acceptedClick; + + /* + * Represents the logical bar instance + */ + LogicalColorBar * _logicalBar; + + /* + * Represents the margin gap on x + */ + int gapX; + + /* + * Represents the margin gap on x + */ + int gapY; + /* + * Represents the height of the color bar drawing area + */ + int height; + /* + * Represents the width of the color bar drawing area + */ + int width; + + /* + * Represents the height of the bar + */ + int bar_height; + + /* + * Represents the width of the bar + */ + int bar_width; + + /* + * Represents the collection of degrade definition points + */ + std::deque showedColorPoints; + + /* + * The orientation of the rectangule is true when is horizontal, false for vertical + */ + //bool bar_orientation; + + /* + * The points figure orientation UP, DOWN, LEFT, or RIGTH + */ + int points_orientation; + + /* + * The minimum represented real value used for calculating the scaling for point by the rule real_x = (x_pixel * (maxX_represented_Tshow_Tshow - minX_represented_Tshow) ) / bar_width + */ + int minX_represented_Tshow; + + /** + * The maximum represented real value used for calculating the scaling for point by the rule real_x = (x_pixel * (maxX_represented_Tshow_Tshow - minXRepresented_Tshow) ) / bar_width + */ + int maxX_represented_Tshow; + + /** + * The minimum represented real value used for calculating the scaling for point by the rule real_x = (x_pixel * (maxX_represented_Tshow_Tshow - minX_represented_Tshow) ) / bar_width + */ + int temporalMinXToShow; + + /* + * The maximum represented real value used for calculating the scaling for point by the rule real_x = (x_pixel * (maxX_represented_Tshow_Tshow - minXRepresented_Tshow) ) / bar_width + */ + int temporalMaxXToShow; + + /** + * Indicates the first node to show + */ + pColorPoint * startNode_show; + + /** + * Indicates the last node to show + */ + pColorPoint * lastNode_show; + + /** + * Indicates the amount of temporal initial color points + */ + int accumTemporalPoints; + + /** + * Represents the state of viewing a range + */ + bool viewingRange; + + /** + * Is the constant that represents the figure number of edges (TRIANGLE | RECTANGLE) + */ + pFigure* figure; + /** + * Represents the last clickedX coord inside the bar. + */ + int clickedX; + + /* + * Represents the last clickedY coord inside the bar. + */ + int clickedY; + + /** + * Represents the movind index of the last moving point in the colorPoints list + */ + int movingPointIndex; + + /** + * Indicates if in the last colour selection the ok button was clicked + */ + bool okSelectedColor; + + /** + * Represents the statc or movable state of limit start and end color points, default value true for static + */ + bool staticLimits; + + /** + * Indicates the last node moving in the coloPoints list + */ + pColorPoint * movingNodePoint; + +// pDegradeRectangle * degrade; + + /** + * Is the bitmap for the bar color + */ + wxBitmap * colorBar_Bitmap; + /** + * Is the bitmap of the information associated to the bar color + */ + wxBitmap * information_Bitmap; + /** + * Represents the state of doing or not the degrade in the bar (default value true for doing degrade) + */ + bool doingDegrade; + + /** + * Represents that the minimum value for the visible range has been found in the original color points + */ + bool minFound; + + /** + * Represents that the maximum value for the visible range has been found in the original color points + */ + bool maxFound; + + /** + * X-Coord for left-superior device visible drawing + */ + wxCoord deviceStart_x; + + /** + * Y-Coord for left-superior device visible drawing + */ + wxCoord deviceStart_y; + + /* + * X-Coord for left-superior device margin, important for horizontal view + */ + wxCoord deviceEndMargin; + + /** + * Y-Coord for left-superior device margin, important for vertical view + */ + wxCoord deviceEnd_y; + /** + * Represents the active state of the bar + */ + bool activeState; + + int avaliablePointToMove; + + /** + * Represents the real-x value to draw a vertical line + */ + int realX_vertical_line; + + /** + * Represents the color of the dot-line use as guides. The default color is RED. + */ + wxColour guideLineColor; + + /* + * Represents the color of the backGround. Default color is the parent color. + */ + wxColour colourParent; + + /* + * The color bar pop menu + */ + wxMenu c_popmenu; + /* + * The figure changes submenu + */ + wxMenu * changesMenu; + + + DECLARE_CLASS(pColorBar) + // any class wishing to process wxWindows events must use this macro + DECLARE_EVENT_TABLE() +}; + + +#endif + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pColorPoint.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pColorPoint.cxx new file mode 100644 index 0000000..2a8b2b3 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pColorPoint.cxx @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------------------------------------ +// Class definition include +//------------------------------------------------------------------------------------------------------------ +#include "pColorPoint.h" + +// ----------------------------------------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ----------------------------------------------------------------------------------------------------------- + +#ifndef WX_PRECOMP +#include +#endif + +//------------------------------------------------------------------------------------------------------------ +// Class implementation +//------------------------------------------------------------------------------------------------------------ + +IMPLEMENT_CLASS(pColorPoint, wxObject) + +//------------------------------------------------------------------------------------------------------------ +// Constructors and destructors +//------------------------------------------------------------------------------------------------------------ + +/** +* Create a point of the function. +* @param x The x real value +* @param _color The asigned colour +* @param isTemp The temporal o fixed asignation to the color +*/ +pColorPoint :: pColorPoint(double x , wxColour col, bool isTemp) +{ + realX = x; + colour = col; + isTemporal = isTemp; +} + +pColorPoint :: ~pColorPoint() +{ + +} +//------------------------------------------------------------------------------------------------------------ +// Methods implementation +//------------------------------------------------------------------------------------------------------------ +/* +* Returns the x-value of the point +* @ realX +*/ +double pColorPoint :: getRealX () +{ + return realX; +} +/** + * Returns the colour of the point + * @retval colour + */ +wxColor pColorPoint :: getColor () +{ + return colour; +} + +/** +* Indicates if the colour point is temporal or not +* @retval isTemporal +*/ +bool pColorPoint :: isTemporalColor () +{ + return isTemporal; +} + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pColorPoint.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pColorPoint.h new file mode 100644 index 0000000..ec832f8 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pColorPoint.h @@ -0,0 +1,98 @@ +#ifndef __pColorPoint_h__ +#define __pColorPoint_h__ + +//------------------------------------------------------------------------------------------------------------ +// WX headers inclusion. +// For compilers that support precompilation, includes . +//------------------------------------------------------------------------------------------------------------ + +#include +#ifdef __BORLANDC__ +#pragma hdrstop +#endif +#ifndef WX_PRECOMP +#include +#endif + +//------------------------------------------------------------------------------------------------------------ +// Class definition +//------------------------------------------------------------------------------------------------------------ + +class pColorPoint : public wxObject { + +public: + //------------------------------------------------------------------------------------------------------------ + // Constructors and destructors + //------------------------------------------------------------------------------------------------------------ + + /** + * Create a point of the function. + * @param x The x real value + * @param _color The asigned colour + * @param isTemp The temporal o fixed asignation to the color + */ + pColorPoint(double x , wxColour col, bool isTemp); + + ~pColorPoint(); + + //------------------------------------------------------------------------------------------------------------ + // Methods definition + //------------------------------------------------------------------------------------------------------------ + + /* + * Returns the x-value of the point + * @retval realX + */ + double getRealX (); + /** + * Returns the colour of the point + * @retval colour + */ + wxColor getColor (); + /** + * Sets the x-value of the point + * @param x + */ + void setRealX(double x) + { + realX = x; + } + /** + * Sets the colour of the point + * @param _col + */ + void setColor(wxColour _col) + { + colour = _col; + } + + /** + * Indicates if the colour point is temporal or not + * @retval isTemporal + */ + bool isTemporalColor (); + + //------------------------------------------------------------------------------------------------------------ + // Attributes declration + //------------------------------------------------------------------------------------------------------------ + +private: + /* + * The x-value of the point + */ + double realX; + /* + * The colour of the point + */ + wxColour colour; + /* + * Represents the attibute of being temporal or not + */ + bool isTemporal; + + DECLARE_CLASS (pColorPoint) +}; + +#endif + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFigure.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFigure.cxx new file mode 100644 index 0000000..d3ad630 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFigure.cxx @@ -0,0 +1,288 @@ + +//---------------------------------------------------------------------------------------------------------------- +// Class definition include +//---------------------------------------------------------------------------------------------------------------- +#include "pFigure.h" + +// --------------------------------------------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// --------------------------------------------------------------------------------------------------------------- + +#ifndef WX_PRECOMP +#include +#endif + +//---------------------------------------------------------------------------------------------------------------- +// Class implementation +//---------------------------------------------------------------------------------------------------------------- +/** @file pFigure.cxx */ +IMPLEMENT_CLASS(pFigure, wxObject) + + //------------------------------------------------------------------------------------------------------------ + // Constructors & Destructors + //------------------------------------------------------------------------------------------------------------ + /** + * Create a figure with edges_n edges + * @param edges_n The number of edges of the new figure + * @param _w The width to set + * @param _h The height to set + * @param _orientation The orientation to set + */ + pFigure :: pFigure(int edges_n, int _w, int _h, int _orientation, bool bar_orientation) + { + edges = edges_n; + orientation = _orientation; + width = _w; + heigth = _h; + setBarOrientation( bar_orientation ); + } + + pFigure :: ~pFigure() + { + + } + + //------------------------------------------------------------------------------------------------------------ + // Methods + //------------------------------------------------------------------------------------------------------------ + + /** + * Gets the number of edges of the figure + * @retval edges Number of edges in the figure + */ + int pFigure :: getNumberEdges() + { + return edges; + } + + /** + * Sets the vertex points of the figure + * @param edges Number of edges in the figure to set + */ + void pFigure :: setNumberEdges(int n_edges) + { + edges = n_edges; + } + + /** + * Gets the vertex points of the figure + * @param wxPoint The vector to get the points + * @retval points Vertex points distribution in the figure + */ + void pFigure :: getVertexPoints(wxPoint thePoints[]) + { + if (edges == TRIANGLE) + { + int halfWidth = 0; + int halfHeigth = 0; + if ( barOrientation ) // HORIZONTAL + { + halfWidth = (int)(width/2); + halfHeigth = (int)(heigth/2); + switch ( orientation ) + { + case UP : + thePoints[0].x = halfWidth; + thePoints[0].y = 0; + thePoints[1].x = width; + thePoints[1].y = heigth; + thePoints[2].x = -halfWidth; + thePoints[2].y = heigth; + break; + + case DOWN : + thePoints[0].x = halfWidth; + thePoints[0].y = heigth; + thePoints[1].x = width; + thePoints[1].y = 0; + thePoints[2].x = -halfWidth; + thePoints[2].y = 0; + break; + + case LEFT : + thePoints[0].x = 0; + thePoints[0].y = halfHeigth; + thePoints[1].x = width; + thePoints[1].y = 0; + thePoints[2].x = width; + thePoints[2].y = heigth; + break; + + case RIGHT : + thePoints[0].x = width; + thePoints[0].y = halfHeigth; + thePoints[1].x = 0; + thePoints[1].y = 0; + thePoints[2].x = 0; + thePoints[2].y = heigth; + break; + } + } + else // VERTICAL + { + halfWidth = (int)(heigth/2); + halfHeigth = (int)(width/2); + switch ( orientation ) + { + case UP : + thePoints[0].x = halfWidth; + thePoints[0].y = 0; + thePoints[1].x = heigth; + thePoints[1].y = width; + thePoints[2].x = -halfWidth; + thePoints[2].y = width; + break; + + case DOWN : + thePoints[0].x = halfWidth; + thePoints[0].y = width; + thePoints[1].x = heigth; + thePoints[1].y = 0; + thePoints[2].x = -halfWidth; + thePoints[2].y = 0; + break; + + case LEFT : + thePoints[0].x = 0; + thePoints[0].y = halfHeigth; + thePoints[1].x = heigth; + thePoints[1].y = -halfHeigth; + thePoints[2].x = heigth; + thePoints[2].y = width; + break; + + case RIGHT : + thePoints[0].x = heigth; + thePoints[0].y = halfHeigth; + thePoints[1].x = 0; + thePoints[1].y = -halfHeigth; + thePoints[2].x = 0; + thePoints[2].y = width; + break; + } + } + } + else if (edges == RECTANGLE) + { + if ( barOrientation ) // HORIZONTAL + { + thePoints[0].x = 0; + thePoints[0].y = 0; + thePoints[1].x = width; + thePoints[1].y = 0; + thePoints[2].x = width; + thePoints[2].y = heigth; + thePoints[3].x = 0; + thePoints[3].y = heigth; + } + else // VERTICAL + { + thePoints[0].x = 0; + thePoints[0].y = 0; + thePoints[1].x = heigth; + thePoints[1].y = 0; + thePoints[2].x = heigth; + thePoints[2].y = width; + thePoints[3].x = 0; + thePoints[3].y = width; + } + } + } + + /** + * Sets the vertex points of the figure + * @param edges Vertex points distribution in the figure to set + */ + void pFigure :: setVertexPoints(wxPoint * n_points) + { + v_points = n_points; + } + + /* + * Sets the heigth of the figure + * @param _h The heigth to set + */ + void pFigure :: setHeigth(int _h) + { + heigth = _h; + } + + /* + * Gets the heigth of the figure + * @retval heigth The heigth of the figure + */ + int pFigure :: getHeigth() + { + return heigth; + } + + /* + * Sets the width of the figure + * @param _w The width to set + */ + void pFigure :: setWidth(int _w) + { + width = _w; + } + + /* + * Gets the width of the figure + * @retval width The width of the figure + */ + int pFigure :: getWidth() + { + return width; + } + + /* + * Indicates if a pixel point is inside the figure + * @param xFig_PixelPoint The known reference point inside the figure + * @param xPixel The x-pixel coord asking for + * @retval Returns true if the point is inside + */ + bool pFigure :: isPointInside(int xFig_PixelPoint, int xPixel) + { + bool isInside = false; + + if (edges == TRIANGLE) + { + int halfWidth = (int)(width/2)+1; + int halfHeigth = (int)(heigth/2)+1; + if ( orientation == UP || orientation == DOWN ) + { + isInside = (xPixel>=xFig_PixelPoint-halfWidth) && (xPixel<=xFig_PixelPoint+halfWidth); + } + else if( orientation == LEFT || orientation == RIGHT ) + { + isInside = (xPixel>=xFig_PixelPoint-halfHeigth) && (xPixel<=xFig_PixelPoint+halfHeigth); + } + } + else if (edges == RECTANGLE) + { + isInside = (xPixel >= xFig_PixelPoint) && (xPixel<=xFig_PixelPoint+width); + } + return isInside; + } + + /* + * Sets the bar orientation + * @ bar_orientation The orientation to set (true for horizontal, false for vertical) + */ + void pFigure :: setBarOrientation(bool bar_orientation) + { + barOrientation = bar_orientation; + } + + /* + * Sets the bar orientation used for triangles + * @ bar_orientation The orientation to set (LEFT = -4, RIGHT = -6, UP = -8, DOWN = -2) + */ + void pFigure :: setFigureOrientation(int fig_orientation) + { + orientation = fig_orientation; + } + + + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFigure.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFigure.h new file mode 100644 index 0000000..85ca33f --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFigure.h @@ -0,0 +1,163 @@ +#ifndef __pFIGURE__ +#define __pFIGURE__ + +// ---------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ---------------------------------------------------------------------------- +#include +#ifdef __BORLANDC__ +#pragma hdrstop +#endif +#ifndef WX_PRECOMP +#include +#endif + +/** @file pFigure.h */ +class pFigure :public wxObject{ + +public: + + //------------------------------------------------------------------------------------------------------------ + // Constructors & Destructors + //------------------------------------------------------------------------------------------------------------ + /** + * Create a figure with edges_n edges + * @param edges_n The number of edges of the new figure + * @param _w The width to set + * @param _h The height to set + * @param _orientation The figure orientation to set + * @param bar_orientation The figure orientation to set + */ + pFigure(int edges_n, int _w, int _h,int _orientation, bool bar_orientation); + ~pFigure(); + + //------------------------------------------------------------------------------------------------------------ + // Methods + //------------------------------------------------------------------------------------------------------------ + + /** + * Gets the number of edges of the figure + * @retval edges Number of edges in the figure + */ + int getNumberEdges(); + + /** + * Sets the vertex points of the figure + * @param edges Number of edges in the figure to set + */ + void setNumberEdges(int n_edges); + + /** + * Gets the vertex points of the figure + * @param wxPoint The vector to get the points + * @retval points Vertex points distribution in the figure + */ + void getVertexPoints(wxPoint thePoints[]); + + /** + * Sets the vertex points of the figure + * @param edges Vertex points distribution in the figure to set + */ + void setVertexPoints(wxPoint * n_points); + + /* + * Sets the heigth of the figure + * @param _h The heigth to set + */ + void setHeigth(int _h); + + /* + * Gets the heigth of the figure + * @retval heigth The heigth of the figure + */ + int getHeigth(); + + /* + * Sets the width of the figure + * @param _w The width to set + */ + void setWidth(int _w); + + /* + * Gets the width of the figure + * @retval width The width of the figure + */ + int getWidth(); + + /* + * Indicates if a pixel point is inside the figure + * @param xFig_PixelPoint The known reference point inside the figure + * @param xPixel The x-pixel coord asking for + * @retval Returns true if the point is inside + */ + bool isPointInside(int xFig_PixelPoint, int xPixel); + + /* + * Sets the bar orientation + * @ bar_orientation The orientation to set (true for horizontal, false for vertical) + */ + void setBarOrientation(bool bar_orientation); + + /* + * Sets the bar orientation used for triangles + * @ bar_orientation The orientation to set (LEFT = -4, RIGHT = -6, UP = -8, DOWN = -2) + */ + void setFigureOrientation(int fig_orientation); + + //------------------------------------------------------------------------------------------------------------ + // Constants + //------------------------------------------------------------------------------------------------------------ + + enum + { + TRIANGLE = 3, + RECTANGLE = 4, + LEFT = -4, + RIGHT = -6, + UP = -8, + DOWN = -2, + }; + +private: + + //------------------------------------------------------------------------------------------------------------ + // Attributes + //------------------------------------------------------------------------------------------------------------ + + /* + * Represents the heigth of the figure + */ + int heigth; + + /* + * Represents the width of the figure + */ + int width; + + /* + * Represents the edges of the figure + */ + int edges; + + /** + * Represents the orientation UP, DOWN, LEFT, RIGTH of the figure + */ + int orientation; + + /* + * Is the bar orientation (true for HORIZONTAL, false VERTICAL) + */ + bool barOrientation; + + /* + * Represents the vertex points distribution of the figure in pixels scale + */ + wxPoint *v_points; + +DECLARE_CLASS(pColorBar) + +}; +#endif + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFunctionPoint.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFunctionPoint.cxx new file mode 100644 index 0000000..ab7e248 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFunctionPoint.cxx @@ -0,0 +1,69 @@ +//---------------------------------------------------------------------------- +// Class definition include +//---------------------------------------------------------------------------- +#include "pFunctionPoint.h" + +// ---------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ---------------------------------------------------------------------------- + +#ifndef WX_PRECOMP +#include +#endif + +//---------------------------------------------------------------------------- +// Class implementation +//---------------------------------------------------------------------------- + +IMPLEMENT_CLASS(pFunctionPoint, wxObject) + +//---------------------------------------------------------------------------- +// Constructors +//---------------------------------------------------------------------------- +/** +* Create a point of the function. +* @param x The x value +* @param y The y value +*/ +pFunctionPoint :: pFunctionPoint(int x , int y ) +{ + realX = x; + realY = y; + hasColorForLevel = false; +} +//---------------------------------------------------------------------------- +// Methods +//---------------------------------------------------------------------------- +/* +* Returns the x-value of the point +* @ realX +*/ +int pFunctionPoint ::getRealX () +{ + return realX; +} +/** +* Returns the x-value of the point +* @ realY +*/ +int pFunctionPoint :: getRealY () +{ + return realY; +} +/* +* Sets the state of having an asigned color +*/ +void pFunctionPoint :: setHasColor (bool hasColor) +{ + hasColorForLevel = hasColor; +} +/* +* Indicates if the point has an asigned color for the level +*/ +bool pFunctionPoint :: getHasColorForLevel() +{ + return hasColorForLevel; +} + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFunctionPoint.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFunctionPoint.h new file mode 100644 index 0000000..720c11d --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFunctionPoint.h @@ -0,0 +1,99 @@ +#ifndef __pFunctionPoint_h__ +#define __pFunctionPoint_h__ + +// ---------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ---------------------------------------------------------------------------- + +#include +#ifdef __BORLANDC__ +#pragma hdrstop +#endif +#ifndef WX_PRECOMP +#include +#endif + + +//---------------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------- +// Class definition +//---------------------------------------------------------------------------- + +class pFunctionPoint : public wxObject { + + //---------------------------------------------------------------------------- + // Methods definition + //---------------------------------------------------------------------------- +public: + /** + * Create a point of the function. + * @param x The x value + * @param y The y value + */ + pFunctionPoint(int x , int y ) ; + + /* + * Returns the x-value of the point + * @ realX + */ + int getRealX (); + /** + * Returns the y-value of the point + * @ realY + */ + int getRealY (); + /** + * Sets the x-value of the point + * @param x + */ + void setRealX(int x) + { + realX=x; + } + /** + * Sets the y-value of the point + * @param y + */ + void setRealY(int y) + { + realY=y; + } + /* + * Sets the state of having an asigned color + */ + void setHasColor (bool hasColor); + /* + * Indicates if the point has an asigned color for the level + */ + bool getHasColorForLevel(); + + + //---------------------------------------------------------------------------- + // Attributes declration + //---------------------------------------------------------------------------- + +private: + /* + * The x-value of the point + */ + int realX; + /* + * The y-value of the point + */ + int realY; + /* + * Indicates if the point has an asigned color for the level + */ + bool hasColorForLevel; + + DECLARE_CLASS (pFunctionPoint) +}; + +#endif + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.cxx new file mode 100644 index 0000000..81f843b --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.cxx @@ -0,0 +1,847 @@ + +//---------------------------------------------------------------------------- +// Class definition include +//---------------------------------------------------------------------------- +#include "pGraphicalFunction.h" +#include "math.h" +#include +#include +#include +#include + +// ---------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ---------------------------------------------------------------------------- + +#ifndef WX_PRECOMP +#include +#endif + +//---------------------------------------------------------------------------- +// Class implementation +//---------------------------------------------------------------------------- + +IMPLEMENT_CLASS(pGraphicalFunction, pPlotterLayer) + +pGraphicalFunction:: pGraphicalFunction(wxString name, int flags) +{ + SetName(name); + showPointsF = false; + validPointRange = 5; + logicFunction = new pLogicalFunction (); + fromWindow=false; + factorZoom=1; + drawing=false; + editable=true; + ifActual=false; + zoomIn=false; + setOffsetX(0); + setOffsetY(0); + initialDrawingPoint=NULL; + finalDrawingPoint=NULL; + //type=1 means that is going to be a piecewise function + _type=1; + xKSpline=NULL; + yKSpline=NULL; + offsetPixelX=0; + offsetPixelY=0; + xTraslation=0; + mType=DEFAULT; +} + +/** +* Is the destructor!!! +*/ +pGraphicalFunction :: ~ pGraphicalFunction () +{ + +} + +//set if the function has to draw the points +void pGraphicalFunction::SetShowPoints(bool showPoints) +{ + showPointsF = showPoints; +} +//get the paramater showPointsF +bool pGraphicalFunction::getShowPoints() +{ + return showPointsF; +} +/* + * Set Up startPoint, endPoint, maxY,maxX points +*/ +void pGraphicalFunction::setUp() +{ + logicFunction->setUp(); + setMaxX(logicFunction->getMaxX()); + setMinX(logicFunction->getMinX()); + setMaxY(logicFunction->getMaxY()); + setMinY(logicFunction->getMinY()); + setStartX(logicFunction->getStartX()); + setEndX(logicFunction->getEndX()); + setStartY(logicFunction->getStartY()); + setEndY(logicFunction->getEndY()); + +} + +/* +* validate if the function has that point in a sensible area returning the index where the point was found or -1 if is in not part of the function: define the sensible area is +* x1-validPointRange validPointOnFunction (realPoint)); +} +/* +* returns the index in the list of the point +*/ +int pGraphicalFunction::getIndexOf(wxPoint realpoint) +{ + return logicFunction -> getIndexOf( realpoint ); +} + +/* +* This metohd returns the node of the point that is the movingPointIndex position in the list of points. +* @param: int movingPointIndex, Is the index value of the searched node. +* @return: Return a pointer to the node corresponding to the index value by parameter. +*/ +wxNode* pGraphicalFunction::GetPointAt( int movingPointIndex ) +{ + return logicFunction -> GetPointAt ( movingPointIndex ); +} +/* + * Set the scales of the function in x and y + * + */ +void pGraphicalFunction::setScales() +{ + //int dx= logicFunction->getMaxX()-logicFunction->getMinX(); + //int dy= logicFunction->getMaxY()-logicFunction->getMinY(); + int dx= maxShowedX-minShowedX; + int dy= maxShowedY-minShowedY; + + + if(dx!=0 && dy!=0) + { + double scaleX=(((float)(screenX-100))/dx)*factorZoom; + double scaleY=(((float)(screenY-50))/dy)*factorZoom; + setScaleX(scaleX); + setScaleY(scaleY); + logicFunction->setScaleX(scaleX); + logicFunction->setScaleY(scaleY); + + } +} +/* +* Includes a point between two existing points of this function. The new point (x,y) was not defined when the function was created. +* @return Returns true is the point was succcesfully added to the funcion. +*/ +bool pGraphicalFunction:: AddNewPoint(int x,int y) +{ + bool added= logicFunction -> AddNewPoint ( x, y ); + if(!fromWindow) + setUp(); + else + { + logicFunction->setEndPoints(); + logicFunction->setStartPoints(); + } + return added; +} + +/* +* This tries to Add a point to the function if possible it returns true. +* @pre: The list of existing points is ordered. +* @param: int aX, The x value of the point. +* @param: int aY, The y value of the point. +* @param: return Returns TRUE if the point was succesfuly included in the realPoints list. +*/ +bool pGraphicalFunction::AddPoint(int aX, int aY,bool order) +{ + + bool added=logicFunction -> AddPoint( aX, aY,order ); + if(!fromWindow) + setUp(); + else + { + logicFunction->setEndPoints(); + logicFunction->setStartPoints(); + } + return added; +} + +/** +* deletes the point given by the user from the collection of logical points of the function +* is not used +*/ + +bool pGraphicalFunction::DeletePoint(int aX, int aY) +{ + bool added= logicFunction -> DeletePoint( aX, aY ); + if(!fromWindow) + setUp(); + else + { + logicFunction->setEndPoints(); + logicFunction->setStartPoints(); + } + return added; +} + +/** +* deletes a point of the functio given its index +*/ +bool pGraphicalFunction::deletePointAt(int index) +{ + bool added=logicFunction -> deletePointAt( index ); + if(!fromWindow) + setUp(); + else + { + logicFunction->setEndPoints(); + logicFunction->setStartPoints(); + } + return added; +} + +/** +* Change de coordinates of the given index point to the newCoords, if it is possible and return the result of the invoked action. +* @retun Return TRUE if it was possible to do the change. A valid change is when the new x value of the point is still between the previous and next point, when condition. +*/ +bool pGraphicalFunction::changePoint(wxPoint newCoords, int movingIndexPoint) +{ + bool added= (logicFunction -> changePoint( newCoords, movingIndexPoint )); + if(!fromWindow) + setUp(); + else + { + logicFunction->setEndPoints(); + logicFunction->setStartPoints(); + } + return added; +} +/** +* Evaluates if the given point belongs to the function. +*/ +/* +bool pGraphicalFunction::hasPoint(wxPoint aPoint) +{ + return logicFunction -> hasPoint( aPoint ); +} + +/** +* Returns the real x values of the control points of the function. It dont includes the points calculated by interpolation. +*/ +double* pGraphicalFunction::getX_RealValues() +{ + return (logicFunction -> getX_RealValues( )); +} + +/** +* Returns the real y values of the control points of the function. It dont includes the points calculated by interpolation. +*/ +double * pGraphicalFunction::getY_RealValues() +{ + + return (logicFunction -> getY_RealValues()); +} + +//---------------------------------- +// Asking if it has a point (x,y) +//---------------------------------- + +/* +* returns true if the point is along the function +* false otherway +*/ +bool pGraphicalFunction:: isInFunction(int x, int y) +{ + wxNode* before; + wxNode* next; + pFunctionPoint* point= new pFunctionPoint(x,y); + bool inLine; + before=getBefore(point); + + if(before && before->GetNext()) + { + next = before->GetNext(); + //next = (before->GetNext())->GetNext(); + inLine= isInLine((pFunctionPoint*)before->GetData(),(pFunctionPoint*)next->GetData(),point); + } + else + inLine=false; + return inLine; +} +/* +* give us the point that is in the function and is exactly before +* the point we are giving +*/ +wxNode* pGraphicalFunction:: getBefore(pFunctionPoint* point) +{ + int minDiference=10000000; + wxNode* node=logicFunction->GetPointAt(0); + wxNode* before=NULL; + while(node) + { + pFunctionPoint* before1=(pFunctionPoint*)node->GetData(); + int beforeX=before1->getRealX(); + int pointX=point->getRealX(); + if(beforeXGetNext(); + } + return before; +} +/* +* Returns true if the point is in the line +*/ +bool pGraphicalFunction::isInLine(pFunctionPoint* before,pFunctionPoint* next, pFunctionPoint* point) +{ + int x1,x2,x,y1,y2,y; + + x1=(float)before->getRealX(); + x2=(float)next->getRealX(); + y1=(float)before->getRealY(); + y2=(float)next->getRealY(); + x=(float)point->getRealX(); + y=(float)point->getRealY(); + + + float d1= (float)sqrt(pow(float(x1-x),2)+ pow(float(y1-y),2)); + float d2= (float)sqrt(pow(float(x2-x),2)+ pow(float(y2-y),2)); + float d=(float)sqrt(pow(float(x2-x1),2)+ pow(float(y2-y1),2)); + if(d1+d2<=(d*1.1) && d1<=d && d2<=d) + return true; + return false; +} +/** +* give us the value of y in the line define by the arguments +*/ +double pGraphicalFunction::interpolateY(double m, int x1,int y1,int x) +{ + return m*(x-x1)+y1; +} + +//---------------------------- +//NEW METHODS +//---------------------------- + +//---------------------------- +// Spline Methods +//---------------------------- + + + /* + * clear the spline vectors + */ + void pGraphicalFunction:: clearSplineVectors() + { + xSpline.clear(); + ySpline.clear(); + } + + /* + Initiliaze xSpline and ySpline vectors + */ + void pGraphicalFunction:: initializeSplines() + { + if(xKSpline==NULL) + xKSpline = vtkKochanekSpline::New(); + if(yKSpline==NULL) + yKSpline= vtkKochanekSpline::New(); + addSplinesPoints(); + + } + + /* + Add the (x,y) points of the function to the + spline + */ + void pGraphicalFunction::addSplinesPoints() + { + xKSpline->RemoveAllPoints(); + yKSpline->RemoveAllPoints(); + wxNode *node= logicFunction->GetPointAt(0); + pFunctionPoint* p; + int i=0; + while(node) + { + p=(pFunctionPoint*)node->GetData(); + xKSpline->AddPoint(i,p->getRealX()); + yKSpline->AddPoint(i,p->getRealY()); + i++; + node=node->GetNext(); + } + } + /* + This Method adds the point calculated by + the splines to the vectors + */ + void pGraphicalFunction:: initializeSplineVectors() + { + double x=0,y=0,t,delta; + int i,np,nps; + //realPoints.DeleteC + + np = logicFunction->getSizePoints(); + nps = 100; + delta=( double ) ( np ) / ( double ) ( nps ); + for( i = 0; i < nps; i++ ) + { + t = delta * (double)i; + GetSplinePoint(t,x,y); + xSpline.push_back(x); + ySpline.push_back(y); + } + } + /* + get the spline point for t, in xKSpline and yKSpline + */ + void pGraphicalFunction::GetSplinePoint(double t, double &x, double &y) + { + if (logicFunction->getSizePoints()==0) + { + x = 0; + y = 0; + } + if (logicFunction->getSizePoints()>=2) + { + x = xKSpline->Evaluate(t); + y = yKSpline->Evaluate(t); + } + } + +//------------------------------ +// Zoom Methods +//------------------------------ + +/** +This method set the initial point and the final point of drawing +according with the width of the square around the point clicked +@param clickedX +@param clickedY +@param width: width of the square +Note: all the parameters are pixels +Pre: screenX, screenY, zoom are set! with the actual data. +DEPRECATED! +*/ +void pGraphicalFunction::zooming(int clickedX,int clickedY,int width) +{ + int xS,yS,x1,x2,y1,y2; + setScales(); + xS=clickedX/_scaleX+_offsetX; + yS=clickedY/_scaleY+_offsetY; + //square + x1=(clickedX-width)/_scaleX+_offsetX; + x2=(clickedX+width)/_scaleX+_offsetX; + y1=(clickedY-width)/_scaleY+_offsetY; + y2=(clickedY+width)/_scaleY+_offsetY; + + int numberPoints=getSizePoints(); + pFunctionPoint* point; + wxNode* p; + bool inSquare=false,first=false; + + //if the user made a zoom + if(zoomIn) + { + int i; + for(i=0; iGetPointAt(i); + point=(pFunctionPoint*)p->GetData(); + int rx=point->getRealX(); + int ry=point->getRealY(); + inSquare= rx>=x1 && rx<=x2; //&& ry>=y1 && ry<=y2; + if(inSquare) + { + if(!first) + { + initialDrawingPoint=point; + _offsetX=rx; + _offsetY=ry; + first=true; + } + finalDrawingPoint=point; + } + } + } + else + { + //We extend the range of vision in x and y,20 and 10 respectively + if((_offsetX-20)>=0) + { + _offsetX=_offsetX-20; + } + else + _offsetX=0; + if((_offsetY-10)>=0) + { + _offsetY=_offsetY-10; + } + else + _offsetY=0; + } +} + + /* + This method sets the offsets according with the point + clicked on the window + @param offx: x-value of the point clicked + @param offx: y-value of the point clicked + Note: all the parameters are pixels + Pre: screenX, screenY are set! with the actual data. + Pos: Sets the value of minXshowed,minYshowed + */ + void pGraphicalFunction::setOffsets(int offx,int offy) + { + int xS,yS; + + setScales(); + + xS=(offx-offsetPixelX)/_scaleX+_offsetX + minShowedX; + yS=(offy-offsetPixelY)/_scaleY+_offsetY+ minShowedY; + + setOffsetX(xS); + setOffsetY(yS); + + //setMinShowedX(xS); + //setMinShowedY(yS); + + setOffsetPixelX(offx); + setOffsetPixelY(offy); + //setMinShowed(); + } + /* + * This method sets the minShowedX + * and the minShowedY, accordig to the offset in + * x-axis and y-axis respectively + * pre: _offsetX>=0,_offsetY>=0 + * screenX and screenY are set with the actual size of the window + * scaleX and scaleY are set to the actual size of the window + * DEPRECATED! + */ + void pGraphicalFunction::setMinShowed() + { + bool firstX=false,firstY=false; + + wxNode* node=logicFunction->GetPointAt(0); + pFunctionPoint* p; + + float middleWX=(((float)(screenX-100))/2)/scaleX; + float middleWY=(((float)(screenY-50))/2)/scaleY; + + //node=node->GetNext(); + while(node) + { + p=(pFunctionPoint*)node->GetData(); + int px=p->getRealX(); + int py=p->getRealY(); + int x=(px-_offsetX);//+middleWX; + int y=(py-_offsetY);//+middleWY; + if(!firstX && x>=0) + { + firstX=true; + setMinShowedX(px); + } + if(!firstY && y>=0) + { + firstY=true; + setMinShowedY(py); + } + node=node->GetNext(); + } + } + +//----------------------- +// Persistence +//----------------------- + +/* + Save the points of the function +*/ +void pGraphicalFunction::save(wxString fileName) +{ + + logicFunction->save(fileName); + +} +/* + Load the points of a function +*/ +void pGraphicalFunction::load(wxString fileName) +{ + logicFunction->load(fileName); + logicFunction->setUp(); + setMaxShowedX(logicFunction->getMaxX()); + setMinShowedX(logicFunction->getMinX()); + setMaxShowedY(logicFunction->getMaxY()); + setMinShowedY(logicFunction->getMinY()); +} + +//-------------------------- +//GETTERS AND SETTERS +//--------------------------- +/** +* actual +*/ +void pGraphicalFunction::setActual(bool act) +{ + ifActual=act; +} +bool pGraphicalFunction:: getActual() +{ + return ifActual; +} +/** +* SCALE WAY +* DEFECT_SCALE 1 +* MAX_SCALE 2 +* USER_SCALE 3 +*/ +void pGraphicalFunction::setScaleWay(int typeS) +{ + scaleWay=typeS; +} + +int pGraphicalFunction:: getScaleWay() +{ + return scaleWay; +} + + +/* +* SCREEN +*/ +void pGraphicalFunction::setScreenX(int scrX) +{ + this->screenX=scrX; +} +int pGraphicalFunction::getScreenX() +{ + return this->screenX; +} +void pGraphicalFunction::setScreenY(int scrY) +{ + this->screenY=scrY; +} +int pGraphicalFunction::getScreenY() +{ + return this->screenY; +} + + +/* +* STARTS +*/ +void pGraphicalFunction::setStartX(double aStartX) { + + logicFunction->setStartX(aStartX); + this->_startX =logicFunction->getStartX(); +} + +double pGraphicalFunction::getStartX() +{ + return logicFunction->getStartX(); +} + +void pGraphicalFunction::setStartY(double aStartY) +{ + logicFunction->setStartY(aStartY); + this->_startY = aStartY; +} + +double pGraphicalFunction::getStartY() { + return logicFunction->getStartY(); +} +/* +* ENDs +*/ +void pGraphicalFunction::setEndX(double aEndX) +{ + logicFunction->setEndX(aEndX); + this->_endX = aEndX; +} + +double pGraphicalFunction::getEndX() { + return logicFunction->getEndX(); +} + +void pGraphicalFunction::setEndY(double aEndY) { + logicFunction->setEndY(aEndY); + this->_endY = aEndY; +} + +double pGraphicalFunction::getEndY() { + return logicFunction->getEndY(); +} +/* + * SCALES + */ +void pGraphicalFunction::setScaleX(double aScaleX) +{ + logicFunction->setScaleX(aScaleX); + this->_scaleX = aScaleX; +} + +double pGraphicalFunction::getScaleX() +{ + return this->_scaleX; +} + +void pGraphicalFunction::setScaleY(double aScaleY) +{ + logicFunction->setScaleY(aScaleY); + this->_scaleY = aScaleY; +} + +double pGraphicalFunction::getScaleY() { + return this->_scaleY; +} +/* + * Mins + */ +void pGraphicalFunction::setMinX(double aMinX) +{ + logicFunction->setMinX(aMinX); + this->_minX = aMinX; +} + +double pGraphicalFunction::getMinX() +{ + return logicFunction->getMinX(); +} + +void pGraphicalFunction::setMinY(double aMinY) +{ + logicFunction->setMinY(aMinY); + this->_minY = aMinY; +} + +double pGraphicalFunction::getMinY() { + return logicFunction->getMinY(); +} +/* + * MAXS + */ +void pGraphicalFunction::setMaxX(double aMaxX) +{ + logicFunction->setMaxX(aMaxX); + this->_maxX = aMaxX; +} + +double pGraphicalFunction::getMaxX() +{ + return logicFunction->getMaxX(); +} + +void pGraphicalFunction::setMaxY(double aMaxY) +{ + logicFunction->setMaxY(aMaxY); + this->_maxY = aMaxY; +} + +double pGraphicalFunction::getMaxY() { + return logicFunction->getMaxY(); +} + +/* + * OFFSETS + */ +void pGraphicalFunction::setOffsetX(double aOffsetX) +{ + logicFunction->setOffsetX(aOffsetX); + this->_offsetX = aOffsetX; +} + +double pGraphicalFunction:: getOffsetX() +{ + + return this->_offsetX; +} + +void pGraphicalFunction:: setOffsetY(double aOffsetY) +{ + logicFunction->setOffsetY(aOffsetY); + this->_offsetY = aOffsetY; +} + +double pGraphicalFunction:: getOffsetY() { + return this->_offsetY; +} + +/* + * TYPE + */ +void pGraphicalFunction:: setType(int aType) +{ + logicFunction->setType(aType); + this->_type = aType; +} + +int pGraphicalFunction :: getType() { + return this->_type; +} + +/* + * validPoint + */ +int pGraphicalFunction :: getValidPointRange() +{ + return validPointRange; +} + +void pGraphicalFunction :: setValidPointRange(int theRange) +{ + logicFunction->setValidPointRange(theRange); + validPointRange = theRange; +} +/* +* Returns the number of points that the function +* has +*/ +int pGraphicalFunction :: getSizePoints() +{ + return logicFunction->getSizePoints(); +} + +/* +* Sets the color points of the function by teh given parameter +* @param colorVector Is the color points vector to set +*/ +void pGraphicalFunction :: setColorPoints(std::vector &colorVector) +{ + f_colorPoints.clear(); + int i = 0; + while(i &colorVector) +{ + int i = 0; + while(igetRealX(), originaslPoint->getColor(), originaslPoint->isTemporalColor()); + colorVector.push_back(copyPoint); + i++; + } +} + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.h new file mode 100644 index 0000000..5e4c844 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.h @@ -0,0 +1,1021 @@ + + +#ifndef __pGraphicalFunction_h__ +#define __pGraphicalFunction_h__ + +// ---------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ---------------------------------------------------------------------------- + +#include +#ifdef __BORLANDC__ +#pragma hdrstop +#endif +#ifndef WX_PRECOMP +#include +#endif + + +//---------------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------------- + + +#include "pPlotterLayer.h" +#include "pFunctionPoint.h" +#include "pLogicalFunction.h" +#include "pColorPoint.h" +#include "vtkKochanekSpline.h" +#include +#include +#include + +/** + this scale, scales each function with its maximum x, and maximum y + in its points +*/ +#define DEFECT_SCALE 1 +/** + this scale with the maximun x and y of all the functions defined +*/ +#define MAX_SCALE 2 +/** + this scales with the scale giving by the user of the widget +*/ +#define USER_SCALE 3 + +/* + Types of Plotter +*/ +/* + Lets to the user to plot any number of the + functions +*/ +#define DEFAULT 1 +/* + Dont let draw on the plotter, but lets to edit + the functions that are editables in the plotter +*/ +#define HISTOGRAM 2 + +class pGraphicalFunction; +//---------------------------------------------------------------------------- +// Class definition +//---------------------------------------------------------------------------- + + +class pGraphicalFunction: public pPlotterLayer +{ +public: + + //constructor + pGraphicalFunction(wxString name= wxEmptyString, int flags= mpALIGN_RIGHT); + + ~pGraphicalFunction( ); + + //--------------------------- + //Virtual Mehods + //--------------------------- + + /** + Get the value of the traslation + in the x-axis + */ + virtual int getXTraslation() + { + return xTraslation; + } + + + + + /** + Get the type of the curve + 1=normal function + 2=Histogram + */ + virtual int getmType() + { + return mType; + } + + /** + Get the type of the curve + 1=piecewise functio + 2= smooth + */ + virtual int vGetType() + { + return _type; + } + + /** + Get _offsetX and _offsetY + */ + + virtual void getOffsets(int &offsetX,int &offSetY ) + { + offsetX=_offsetX; + offsetY=_offsetY; + } + + /* + * Get the factor zoom + */ + virtual void getFactorZoom(float & fz) + { + fz=factorZoom; + } + + + /* + * Get the value of fromWindow + */ + virtual void getFromWindowV(bool &fw) + { + fw=fromWindow; + } + + + /** + * if the function that is drawing is the actual + */ + virtual void getIfActual(bool &actual) + { + actual=ifActual; + } + + /** + * get the max of the function in x and y + */ + virtual void getMax(int & maxX, int &maxY) + { + maxX=(int)getMaxX(); + maxY=(int)getMaxY(); + } + /** + * get the maxShowed of the function in x and y + */ + virtual void getMaxShowed(int & maxX, int &maxY) + { + maxX=(int)getMaxXShowed(); + maxY=(int)getMaxYShowed(); + } + /** + * get the minShowed of the function in x and y + */ + virtual void getMinShowed(int & minX, int &minY) + { + minX=(int)getMinXShowed(); + minY=(int)getMinYShowed(); + } + + /** + * Get screens of the function + */ + virtual void getScreens(int & scrX, int & scrY) + { + scrX=screenX; + scrY=screenY; + } + + /** + * Set screens value + */ + virtual void setScreens(int scrX,int scrY) + { + screenX=scrX; + screenY=scrY; + } + + /** + * Let us know the scale of the function + */ + virtual void getScales(double & scaleX,double & scaleY) + { + scaleX=_scaleX; + scaleY=_scaleY; + } + + + /** + * Let us Know if the user has finished the drawing + * that starts before. + */ + + virtual void getDrawing(bool &draw) + { + draw = drawing; + } + + /** + Let us Know if the user want to see the points of the function + of other color than the color of the lines + */ + virtual void ifShowPoints(bool & show) + { + show = showPointsF; + } + + /** + *Rewind + */ + virtual void Rewind() + { + + node = logicFunction->GetPointAt(0); + + } + + /** Get locus value for next N. + Override this function in your implementation. + @param x Returns X value + @param y Returns Y value + */ + virtual bool GetNextXY(double & x, double & y) + { + if(node) + { + pFunctionPoint* p=(pFunctionPoint*)node->GetData(); + x=p->getRealX(); + y=p->getRealY(); + node=node->GetNext(); + return true; + } + return false; + } + /** + Get Point list of the funcion + @param return points + */ + virtual void GetPoints(wxList &points) + { + logicFunction->GetPoints(points); + //points = realPoints; + } + + /** + Get the point where the user + made a click + */ + + virtual void getMousePoint(int &x,int &y) + { + x=mousePoint.x; + y=mousePoint.y; + } + + /** + * Get the number of points of the function + */ + virtual void getSize(int &size) + { + size=getSizePoints(); + } + + /** + * this method gets the direction of the drawing + */ + virtual void getDirection(bool &dir) + { + logicFunction -> getDirection (dir); + } + + //--------------------------- + // Methods + //--------------------------- + /* + * validate if the function has that point in a sensible area returning the index where the point was found or -1 if is in not part of the function: define the sensible area is + * x1-validPointRange getXSpline() + { + return xSpline; + } + /* + returns the ySpline to plotter + */ + virtual std::vector getYSpline() + { + return ySpline; + } + + + /** + Gets the x-offset of the zoom + in pixels + */ + virtual int getOffsetPixelsXv() + { + return offsetPixelX; + } + + /** + Gets the offset of the zoom + in pixels + */ + virtual int getOffsetPixelsYv() + { + return offsetPixelY; + } + + //----------------------- + // Persistence + //----------------------- + + /* + Save the points of the function + */ + void save(wxString fileName); + /* + Load the points of a function + */ + void load(wxString fileName); + + //------------------------------ + // Getters and Setters + //------------------------------ + + //set if the function has to draw the points + void SetShowPoints(bool showPoints); + + //get the paramater showPointsF + bool getShowPoints(); + + void setScreenX(int scrX); + + int getScreenX(); + + void setScreenY(int scrY); + + int getScreenY(); + + void setStartX(double aStartX); + + double getStartX(); + + void setStartY(double aStartY); + + double getStartY(); + + void setEndX(double aEndX); + + double getEndX(); + + void setEndY(double aEndY); + + double getEndY(); + + void setScaleX(double aScaleX); + + double getScaleX(); + + void setScaleY(double aScaleY); + + double getScaleY(); + + void setMinX(double aMinX); + + double getMinX(); + + void setMinY(double aMinY); + + double getMinY(); + + void setMaxX(double aMaxX); + + double getMaxX(); + + void setMaxY(double aMaxY); + + double getMaxY(); + + void setOffsetX(double aOffsetX); + + double getOffsetX(); + + void setOffsetY(double aOffsetY); + + double getOffsetY(); + + void setType(int aType); + + int getType(); + + int getValidPointRange(); + + void setValidPointRange(int theRange); + + void SetDrawing(bool d) + { + drawing = d; + } + //get if the function is being drawed + bool GetDrawing() + { + return drawing; + } + + //set the mouse point + void SetMousePoint(wxPoint p) + { + mousePoint = p; + } + //get the mousePoint + wxPoint getMousePoint() + { + return mousePoint; + } + /** + * actual + */ + void setActual(bool act); + + bool getActual(); + + /** + * SCALE WAY + * DEFECT_SCALE 1 + * MAX_SCALE 2 + * USER_SCALE 3 + */ + void setScaleWay(int typeS); + + int getScaleWay(); + + /** + * set fromWindow: it is set to true if the + * function was created interactively + */ + void setFromWindow(bool w) + { + fromWindow=w; + } + + /* + * Get the value of fromWindow + */ + bool getFromWindow() + { + return fromWindow; + } + /* + * Set factor zoom + */ + void setFactorZoom(float factor) + { + factorZoom=factor; + } + /* + * Set editable + */ + void setEditable(bool edit) + { + editable=edit; + } + /** + * Get editable + */ + bool getEditable() + { + return editable; + } + + //---------------------------- + // Zoom + //---------------------------- + + /* + * Get boolean zoom + */ + bool getZoomB() + { + return zoomIn; + } + /* * + * Set boolean zoom + * @param z: the new value + */ + void setZoomIn(bool z) + { + zoomIn=z; + } + /** + * Set the initial drawing point + * @param pFunctionPoint* initialPoint + */ + void setInitialDrawPoint(pFunctionPoint* initialPoint) + { + initialDrawingPoint=initialPoint; + } + /** + * Get the initial drawing point + * @return initialDrawingPoint + */ + pFunctionPoint* getInitialDrawPoint() + { + return initialDrawingPoint; + } + /** + * Set the final drawing point + * @param pFunctionPoint* finalPoint + */ + void setFinalDrawPoint(pFunctionPoint* finalPoint) + { + finalDrawingPoint=finalPoint; + } + /** + * Get the final drawing point + * @return finalDrawingPoint + */ + pFunctionPoint* getFinallDrawPoint() + { + return finalDrawingPoint; + } + /** + This method set the initial point and the final point of drawing + according with the width of the square around the point clicked + @param clickedX + @param clickedY + @param width: width of the square + */ + + void zooming(int clickedX,int clickedY,int width); + + /* + * This method sets the offset + */ + void setOffsets(int offx,int offy); + + /* + * This method sets the minShowedX + * and the minShowedY, accordig to the offset in + * x-axis and y-axis respectively + * pre: _offsetX>=0,_offsetY>=0 + */ + void setMinShowed(); + + /** + Get the minX Showed + */ + int getMinXShowed() + { + return minShowedX; + } + /** + Get the minY Showed + */ + int getMinYShowed() + { + return minShowedY; + } + /** + Get the maxX Showed + */ + int getMaxXShowed() + { + return maxShowedX; + } + /** + Get the maxY Showed + */ + int getMaxYShowed() + { + return maxShowedY; + } + /** + Set the minShowedX + */ + void setMinShowedX(int msx) + { + minShowedX=msx; + } + /** + Set the minShowedY + */ + void setMinShowedY(int msy) + { + minShowedY=msy; + } + /** + Set the maxShowedX + */ + void setMaxShowedX(int msx) + { + maxShowedX=msx; + } + /** + Set the minShowedY + */ + void setMaxShowedY(int msy) + { + maxShowedY=msy; + } + + //------------------------ + // Offsets in pixels + //------------------------ + + /** + Gets the x-offset of the zoom + in pixels + */ + int getOffsetPixelsX() + { + return offsetPixelX; + } + + /** + Gets the offset of the zoom + in pixels + */ + int getOffsetPixelsY() + { + return offsetPixelY; + } + /** + Set the x-offset of the zoom + */ + void setOffsetPixelX(int offX) + { + offsetPixelX=offX; + } + /** + Set the y-offset of the zoom + */ + void setOffsetPixelY(int offY) + { + offsetPixelY=offY; + } + + + + /* + * Sets the color points of the function by teh given parameter + * @param colorVector Is the color points vector to set + */ + void setColorPoints(std::vector &colorVector); + + /* + * Gets the color points of the function in the given parameter + * @param colorVector Is the color points list to get the points + */ + void getColorPoints(std::vector &colorVector); + /* + Setter the mType + */ + void setmType(int mt) + { + mType=mt; + } + //----------------------- + //TRASLATION + //----------------------- + /** + Set the value of the traslation + in the x-axis + @param xT value in pixels of the traslation in x-axis + */ + void setXTraslation(int xT) + { + xTraslation=xT; + } + + + +private: + + /** + * Represents the logical function asociated to this graphical function. + */ + pLogicalFunction* logicFunction; + /** + * If the function has to showpoints + */ + bool showPointsF; + + /** + * Is the initial discrete point on x axis of the drawed function. + */ + double _startX; + /** + * Is the initial discrete point on y axis of the drawed function. + */ + double _startY; + /** + * Is the last discrete point on x axis of the drawed function. + */ + double _endX; + /** + * Is the last discrete point on y axis of the drawed function. + */ + double _endY; + /** + * Is the x-scale percentage according to the context device. + */ + double _scaleX; + /** + * Is the y-scale percentage according to the context device. + */ + double _scaleY; + /** + * Is the minimun x-real value reacheable by the function. + */ + double _minX; + /** + * Is the minimun y-real value reacheable by the function. + */ + double _minY; + /** + * Is the maximun x-real value reacheable by the function. + */ + double _maxX; + /** + * Is the maximun y-real value reacheable by the function. + */ + double _maxY; + /** + * Is the logical x-offset of the drawed function. + */ + double _offsetX; + /** + * Is the logical y-offset of the drawed function. + */ + double _offsetY; + /** + * Is the way of how points are going to be connected. It could be smooth, line. + */ + int _type; + /** + * The list of the function points + */ + wxList realPoints; + /* + * The list of the color points of the function associated to the color bar + */ + std::vector f_colorPoints; + + /** + * node of the realPoints where are we + */ + wxNode* node; + /** + * Number that determines the radius range for the valid area the point (sensible radius). Default value 5. + */ + int validPointRange; + + /** + * Indicates if the user is drawing the function + */ + bool drawing; + + /** + * this is for the graphical function + * Mouse Point + */ + wxPoint mousePoint; + + /** + * The size of the screen in X + */ + int screenX; + + /** + * The size of the screen in Y + */ + int screenY; + /** + if is the actual + */ + bool ifActual; + + /** + the way we scale + DEFECT_SCALE 1 + MAX_SCALE 2 + USER_SCALE 3 + */ + + int scaleWay; + + /** + if the function comes from window + */ + bool fromWindow; + /** + * factorZoom + */ + float factorZoom; + /** + * The function is editable + */ + bool editable; + /** + * if the user did a zoom in/out + */ + bool zoomIn; + /** + * initial drawing point + */ + pFunctionPoint* initialDrawingPoint; + /** + * final drawing point + */ + pFunctionPoint* finalDrawingPoint; + /** + Minimum point showed to the user + (zoom)X + */ + int minShowedX; + /** + Maximum point showed to the user + (zoom)X + */ + int maxShowedX; + /** + Minimum point showed to the user + (zoom)Y + */ + int minShowedY; + /** + Maximum point showed to the user + (zoom)X + */ + int maxShowedY; + + + /* + Vectors where the spline is stored + */ + std::vector xSpline; + + std::vector ySpline; + + /* + Kochanek splines + */ + vtkKochanekSpline* xKSpline; + + vtkKochanekSpline* yKSpline; + + + /** + offset in pixels where the user has clicked + before changing the scale + */ + int offsetPixelX; + int offsetPixelY; + /* + type of the meaning of the function + DEFAULT=1; the function has no meaning + HISTOGRAM=2. The function represents an histogram + */ + + int mType; + + /* + is use for lets the user move the function + */ + int xTraslation; + + DECLARE_CLASS (pGraphicalFunction) +}; + +#endif + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx new file mode 100644 index 0000000..7a395e0 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx @@ -0,0 +1,270 @@ + +//---------------------------------------------------------------------------- +// Class definition include +//---------------------------------------------------------------------------- + +#include "pHistogram.h" +//#include "vtkJPEGReader.h" +#include "vtkImageData.h" +#include "vtkImageCast.h" +//----------------- +// C++ +//----------------- +#include +#include +#include +#include + +// ---------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ---------------------------------------------------------------------------- + +/* +#ifndef WX_PRECOMP +#include +#endif +*/ +//---------------------------------------------------------------------------- +// Class implementation +//---------------------------------------------------------------------------- + +//IMPLEMENT_CLASS(pHistogram, wxObject) + +//---------------------------------------------------------------------------- +// Constructors +//---------------------------------------------------------------------------- +pHistogram::pHistogram(std::string filePath) +{ + path=filePath; + points= vtkImageData::New(); + size=100; + sizeImage=0; + buildHistogram(); +} + +pHistogram::pHistogram(vtkImageData* imageData) +{ + points= vtkImageData::New(); + size=100; + sizeImage=0; + //cast + /* + vtkImageCast* cast= vtkImageCast::New(); + cast->SetInput(imageData); + cast->SetOutputScalarTypeToInt(); + cast->Update(); + */ + //build the histogram + buildHistogram(imageData); +} + +pHistogram::~pHistogram() +{ + if(points!=NULL)points->Delete(); +} +//---------------------------------------------------------------------------- +// Methods +//---------------------------------------------------------------------------- + +void pHistogram::setImagePath(std::string filePath) +{ + path=filePath; +} + +void pHistogram::buildHistogram() +{ + /* + reader: is the reader of the image + histogramVector:Is the image data of the original image + imageData: vtkImageData of the image that we are reading + range :it has the (min/max) range of the levels of grey + */ + points= vtkImageData::New(); + vtkMetaImageReader *reader = vtkMetaImageReader::New(); + vtkImageData* imageData=NULL; + double range[2]; + + //reading + reader->SetFileName(path.c_str()); + reader->Update(); + + + // getting the data + imageData=reader->GetOutput(); + imageData->GetScalarRange(range); + initializePoints(size); + setPoints(imageData); + +} + +/* +Calculate the histogram and save it in the attribute points +it is used if the user had given the imageData +Pre: Size had to be setted if the user wants +another value that 100 +*/ +void pHistogram::buildHistogram(vtkImageData* imageData) +{ + initializePoints(size); + setPoints(imageData); +} + +/* + getting ready the points +*/ +void pHistogram::initializePoints(int xDimension) +{ + //setting image data of the points + points->SetDimensions(xDimension,1,1); + points->SetScalarTypeToUnsignedShort(); + points->AllocateScalars(); + points->Update(); +} + +/* + constructing the histogram +*/ +void pHistogram::setPoints(vtkImageData* imageData) +{ + /* + Pointers + */ + unsigned short* dataImagePointer=NULL; + unsigned short* dataHistogramPointer=NULL; + + dataImagePointer=(unsigned short*)imageData->GetScalarPointer(0,0,0); + dataHistogramPointer=(unsigned short*)points->GetScalarPointer(0,0,0); + + /* + Range of greys + */ + double range[2]; + if(imageData==NULL) + range[1]=1; + else + imageData->GetScalarRange(range); + /* + Setting the minimun and maximum levels of grey + */ + maxLevelOfGrey=(int)range[1]; + minLevelOfGrey=(int)range[0]; + /* + Image Size + */ + int ext[6]; + imageData->GetExtent(ext); + int sx,sy,sz; + sx=ext[1]+1; + sy=ext[3]+1; + sz=ext[5]+1; + + sizeImage=sx*sy*sz; + + int i; + /* + getting ready the histogram + */ + for(i=0;iGetScalarPointer(0,0,0); + + return dataHistogramPointer[gValue]; +} + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.h new file mode 100644 index 0000000..3ef66b7 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.h @@ -0,0 +1,156 @@ +/* +#ifndef __pHistogram_h__ +#define __pHistogram_h__ + +// -------------------------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// -------------------------------------------------------------------------------------------- + +#include +#ifdef __BORLANDC__ +#pragma hdrstop +#endif +#ifndef WX_PRECOMP +#include +#endif +*/ + +//-------------------------------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------------------------------- + +//--------------------- +// VTK +//--------------------- + +#include "vtkImageData.h" +#include "vtkMetaImageReader.h" + + +//----------------- +// C++ +//----------------- +#include +#include +#include +//-------------------------------------------------------------------------------------------- +// Class definition +//-------------------------------------------------------------------------------------------- + +class pHistogram //:public wxObject +{ + + //---------------------------------------------------------------------------------------- + // Methods definition + //---------------------------------------------------------------------------------------- + public: + + /* + Constructor + */ + pHistogram(std::string filePath); + /* + Constructor + */ + pHistogram(vtkImageData* imageData); + ~pHistogram(); + /* + @param filePath: is the path where the image is + */ + void setImagePath(std::string filePath); + /* + Return the points of the histogram of the image + */ + std::vector getPoints(); + /* + Calculate the histogram and save it in the attribute points + it is used if the user had given the file's path + */ +//private: + void buildHistogram(); + /* + Calculate the histogram and save it in the attribute points + it is used if the user had given the imageData + */ + void buildHistogram(vtkImageData* imageData); + /* + getting ready the points + */ + void initializePoints(int xDimension); + /* + constructing the histogram + */ + void setPoints(vtkImageData* imageData); + /* + Returns the poins of the histograms + */ + vtkImageData* getHistogram(); + /* + hash por getting the index for the histogram vector of the original + image + */ + int getIndex(int gValue); + /* + Setting the size + */ + void setSize(int nSize); + /* + Get Image Size + */ + int getImageSize(); + /* + Get Size of the histogram + */ + int getSize(); + /* + Get the maximum value of grey of the histogram + */ + int getMaximumLevelOfGrey(); + /* + Get the minimum value of grey of the histogram + */ + int getMinimumLevelOfGrey(); + /* + get a point of the Histogram + given the grey value + */ + int getHistogramPoint(int gValue); + + + //---------------------------------------------------------------------------------------- + // Attributes declaration + //---------------------------------------------------------------------------------------- + private: + /* + Points of the histogram of + the image + */ + vtkImageData* points; + /* + The path of the image + */ + std::string path; + /* + the size of histogram vector + */ + int size; + /* + Maximum Level of grey + */ + int maxLevelOfGrey; + /* + Minimum Level of grey + */ + int minLevelOfGrey; + /* + image size + */ + int sizeImage; + + //DECLARE_CLASS (pHistogram) +}; + +//#endif + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.cxx new file mode 100644 index 0000000..0c3f03b --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.cxx @@ -0,0 +1,806 @@ + +//---------------------------------------------------------------------------- +// Class definition include +//---------------------------------------------------------------------------- +#include "pLogicalFunction.h" +#include +#include +#include + + +// ---------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ---------------------------------------------------------------------------- + +#ifndef WX_PRECOMP +#include +#endif + +//---------------------------------------------------------------------------- +// Class implementation +//---------------------------------------------------------------------------- + +IMPLEMENT_CLASS(pLogicalFunction, wxObject) + +//---------------------------------------------------------------------------- +// Constructors +//---------------------------------------------------------------------------- +pLogicalFunction:: pLogicalFunction( ) +{ + + realPoints.DeleteContents(TRUE); + validPointRange = 5; + leftToRigthDef = true; + _maxX=0; + _maxY=0; + _minX=0; + _minY=0; +} +/** +* Is the destructor!!! +*/ +pLogicalFunction:: ~pLogicalFunction () +{ + realPoints.DeleteContents(TRUE); +} +/* +* validate if the function has that point in a sensible area returning the index where the point was found or -1 if is in not part of the function: define the sensible area is +* x1-validPointRangeGetData(); + int x = point->getRealX(); + int y = point->getRealY(); + double vx=SENSIBLE_REGION/_scaleX; + double vy=SENSIBLE_REGION/_scaleY; + + bool isInXRange= realPoint.x <= x + vx + SENSIBLE_REGION && realPoint.x >= x - vx-SENSIBLE_REGION; + bool isInYRange= realPoint.y <= y + vy + SENSIBLE_REGION && realPoint.y >= y - vy-SENSIBLE_REGION; + if(isInXRange && isInYRange) + pointIndex = realPoints.IndexOf(point); + + node = node->GetNext(); + } + return pointIndex; +} + + + +/* +* returns the index in the list of the point +*/ +int pLogicalFunction::getIndexOf(wxPoint realpoint) +{ + wxNode* node= realPoints.GetFirst(); + while(node) + { + pFunctionPoint* point=(pFunctionPoint*)node->GetData(); + if(point->getRealX()==realpoint.x && point->getRealY()==realpoint.y ) + { + return realPoints.IndexOf(point); + } + + node= node->GetNext(); + } + return -1; + +} + +/* +* This metohd returns the node of the point that is the movingPointIndex position in the list of points. +* @param: int movingPointIndex, Is the index value of the searched node. +* @return: Return a pointer to the node corresponding to the index value by parameter. +*/ +wxNode* pLogicalFunction::GetPointAt( int movingPointIndex ) +{ + if(!realPoints.IsEmpty()) + { + wxNode* node= realPoints.Item(movingPointIndex); + return node; + } + else + return NULL; +} + +/* +* Includes a point between two existing points of this function. The new point (x,y) was not defined when the function was created. +* @return Returns true is the point was succcesfully added to the funcion. +*/ +bool pLogicalFunction:: AddNewPoint(int x,int y) +{ + pFunctionPoint * newPoint = new pFunctionPoint ( x, y); + bool includedPoint = realPoints.Append(newPoint)!=NULL; + if(includedPoint) + { + bool order=orderPoints(); + return order; + } + return includedPoint; +} +/* +* This method orders the list of points taking into account that the last appended node in the list (realPoint) is the only one disordered. +* @return Returns true if the last point included has a valid value for x and was ordered, according to the definition of function. +*/ +bool pLogicalFunction::orderPoints() +{ + bool lastOrdered = false; + bool validToContinue = false; + + wxNode* lastNodeIncluded = realPoints.GetLast(); + + wxNode* node = realPoints.GetFirst(); + pFunctionPoint* lastPointIncluded = (pFunctionPoint*)lastNodeIncluded -> GetData(); + int xToOrder = lastPointIncluded -> getRealX(); + int actualX; + int nextX; + + // Used for validating 'leftToRigthDef' + pFunctionPoint* ordFirstPoint = (pFunctionPoint*)realPoints.GetFirst()-> GetData(); + pFunctionPoint* ordLastPoint = (pFunctionPoint*)(lastNodeIncluded->GetPrevious())-> GetData(); + + + // Normal drawing + if (leftToRigthDef) + { + validToContinue = ordFirstPoint->getRealX() < xToOrder; + } + else + { + //validToContinue =ordFirstPoint->getRealX() > xToOrder; + validToContinue =ordLastPoint->getRealX() > xToOrder; + } + + if ( validToContinue) + { + + while( node && !lastOrdered ) + { + pFunctionPoint* prevPoint =(pFunctionPoint*)node->GetData(); + actualX = prevPoint ->getRealX(); + if( actualX == xToOrder) + { + realPoints.DeleteNode(lastNodeIncluded); + lastOrdered = false; + } + else if ( actualX < xToOrder ) + { + //firstNode + wxNode* nextNode = node->GetNext(); + pFunctionPoint* nextPoint; + if( nextNode != lastNodeIncluded ) + { + nextPoint = (pFunctionPoint*)nextNode -> GetData(); + nextX = nextPoint->getRealX(); + int nextIndex = realPoints.IndexOf(nextPoint); + if( nextX > xToOrder ) + { + //we need to change the direction in memory of our node + pFunctionPoint* pointToInsert=new pFunctionPoint(lastPointIncluded->getRealX(),lastPointIncluded->getRealY()); + // The last inserted point is ordered like: prevPoint - lastPointIncluded - nextPoint + lastOrdered = (realPoints.Insert(nextIndex, pointToInsert))!= NULL; + bool lastNodeDeleted=realPoints.DeleteNode(lastNodeIncluded); + return lastOrdered && lastNodeDeleted; + + } + + } + else + { + lastOrdered = true; + } + } + else + { + //firstNode + wxNode* prevNode = node->GetPrevious(); + int insertIndex=realPoints.IndexOf(prevPoint); + pFunctionPoint* prPoint; + if(prevNode) + { + prPoint = (pFunctionPoint*)prevNode -> GetData(); + int beforeX =prPoint->getRealX(); + if( beforeX < xToOrder) + { + //we need to change the direction in memory of our node + pFunctionPoint* pointToInsert=new pFunctionPoint(lastPointIncluded->getRealX(),lastPointIncluded->getRealY()); + // The last inserted point is ordered like: prevPoint - lastPointIncluded - nextPoint + lastOrdered = (realPoints.Insert(insertIndex, pointToInsert))!= NULL; + bool lastNodeDeleted=realPoints.DeleteNode(lastNodeIncluded); + return lastOrdered && lastNodeDeleted; + } + } + //is just the second point + else + { + //we need to change the direction in memory of our node + pFunctionPoint* pointToInsert=new pFunctionPoint(lastPointIncluded->getRealX(),lastPointIncluded->getRealY()); + // The last inserted point is ordered like: prevPoint - lastPointIncluded - nextPoint + lastOrdered = (realPoints.Insert(insertIndex, pointToInsert))!= NULL; + bool lastNodeDeleted=realPoints.DeleteNode(lastNodeIncluded); + return lastOrdered && lastNodeDeleted; + } + } + + node = node->GetNext(); + } + + } + else + { + bool lastNodeDeleted = realPoints.DeleteNode(lastNodeIncluded); + lastOrdered = lastOrdered && lastNodeDeleted; + } + return lastOrdered; +} +/* +* This tries to Add a point to the function if possible it returns true. +* @pre: The list of existing points is ordered. +* @param: int aX, The x value of the point. +* @param: int aY, The y value of the point. +* @param: return Returns TRUE if the point was succesfuly included in the realPoints list. +*/ +bool pLogicalFunction::AddPoint(int aX, int aY,bool order) +{ + pFunctionPoint * newPoint = new pFunctionPoint (aX, aY); + wxNode* lastNode = realPoints.GetLast(); + bool addedPoint = false; + if (lastNode) + { + pFunctionPoint* lastPoint = (pFunctionPoint*)lastNode->GetData(); + if( lastPoint->getRealX() != aX ) + { + addedPoint = realPoints.Append(newPoint)!=NULL; + //In case that the definition of points is being done backwards. + if( (aX < (lastPoint->getRealX()) ) && addedPoint ) + { + if( realPoints.GetCount() == 2 ) + { + leftToRigthDef = false; + } + if(order) + addedPoint = orderPoints(); + + } + else + { + if( realPoints.GetCount() == 2 ) + { + leftToRigthDef = true; + } + } + } + } + else + { + addedPoint = realPoints.Append(newPoint)!=NULL; + } + + return addedPoint; +} + +/* + * Set Up startPoint, endPoint, maxY,maxX points +*/ +void pLogicalFunction::setUp() +{ + //sets the start point of the function + setStartPoints(); + //set the Last point of the function + setEndPoints(); + //set the min value in x and y between all the points of the function + setMinPoints(); + //set the max value in x and y between all the points of the function + setMaxPoints(); +} + + +/* + * sets the start point of the function + */ +void pLogicalFunction:: setStartPoints() +{ + wxNode* first=realPoints.GetFirst(); + if(first) + { + pFunctionPoint* startPoint=(pFunctionPoint*)first->GetData(); + setStartX(startPoint->getRealX()); + setStartY(startPoint->getRealY()); + } + else + { + setStartX(-1); + setStartY(-1); + } +} +/* + * sets the end point of the function + */ +void pLogicalFunction:: setEndPoints() +{ + wxNode* last=realPoints.GetLast(); + if(last) + { + pFunctionPoint* lastPoint=(pFunctionPoint*)last->GetData(); + setEndX(lastPoint->getRealX()); + setEndY(lastPoint->getRealY()); + } + else + { + setEndX(-1); + setEndY(-1); + + } +} + +/* + * set the min value in x and y between all the points of the function + */ +void pLogicalFunction::setMinPoints() +{ + int minX,minY; + wxNode* node=realPoints.GetFirst(); + if(node) + { + pFunctionPoint* point=(pFunctionPoint*)node->GetData(); + minX=point->getRealX(); + minY=point->getRealY(); + wxNode* nextNode=node->GetNext(); + while(nextNode) + { + point=(pFunctionPoint*)nextNode->GetData(); + int x=point->getRealX(); + int y=point->getRealY(); + if(xGetNext(); + } + setMinX(minX); + setMinY(minY); + } + else + { + setMinX(0); + setMinY(0); + } + +} +/* + * set the max value in x and y between all the points of the function + */ +void pLogicalFunction::setMaxPoints() +{ + int maxX,maxY; + wxNode* node=realPoints.GetFirst(); + if(node) + { + pFunctionPoint* point=(pFunctionPoint*)node->GetData(); + maxX=point->getRealX(); + maxY=point->getRealY(); + wxNode* nextNode=node->GetNext(); + while(nextNode) + { + point=(pFunctionPoint*)nextNode->GetData(); + int x=point->getRealX(); + int y=point->getRealY(); + if(x>maxX) + maxX=x; + if(y>maxY) + maxY=y; + nextNode=nextNode->GetNext(); + } + setMaxX(maxX); + setMaxY(maxY); + } + else + { + setMaxX(0); + setMaxY(0); + } +} + +/** +* deletes the point given by the user from the collection of logical points of the function +* IS NOT USE +*/ + +bool pLogicalFunction::DeletePoint(int aX, int aY) +{ + wxNode* node= realPoints.GetFirst(); + while(node) + { + pFunctionPoint* point=(pFunctionPoint*)node->GetData(); + if(point->getRealX()==aX && point->getRealY()==aY) + { + realPoints.Erase(node); + return true; + } + node= node->GetNext(); + } + + return false; +} + +/** +* deletes a point of the functio given its index +*/ +bool pLogicalFunction::deletePointAt(int index) +{ + if(index!=-1) + { + wxNode* node=GetPointAt(index); + + if(node)//point!=NULL) + { + pFunctionPoint* point=(pFunctionPoint*)node->GetData(); + bool deleted=realPoints.DeleteNode(node); + //delete point; + //delete node; + /* + if(index==0) + realPoints=realPoints.; + */ + return deleted; + } + } + return false; +} + +/** +* Change de coordinates of the given index point to the newCoords, if it is possible and return the result of the invoked action. +* @retun Return TRUE if it was possible to do the change. A valid change is when the new x value of the point is still between the previous and next point, when condition. +*/ +bool pLogicalFunction::changePoint(wxPoint newCoords, int movingIndexPoint) +{ + wxNode* changingNode = GetPointAt(movingIndexPoint); + bool validChange = false; + int newX = newCoords.x; + int newY = newCoords.y; + pFunctionPoint* changingPoint = (pFunctionPoint*)changingNode -> GetData(); + bool hasPrevious = movingIndexPoint>0; + bool hasNext = movingIndexPoint < realPoints.size()-1; + + wxNode* prevNode = hasPrevious ? changingNode ->GetPrevious() : NULL; + wxNode* nextNode = hasNext ? changingNode -> GetNext() : NULL; + + if( hasPrevious ) + { + pFunctionPoint* prevPoint = (pFunctionPoint*)prevNode -> GetData(); + if ( hasNext ) + { + pFunctionPoint* nextPoint = (pFunctionPoint*) nextNode -> GetData(); + validChange = ((prevPoint->getRealX()) < newX) && ((nextPoint->getRealX()) > newX); + if ( (prevPoint->getRealX()) > newX ) + { + newX = prevPoint->getRealX()+1; + validChange = true; + } + else if ( (nextPoint->getRealX()) < newX ) + { + newX = nextPoint->getRealX()-1; + validChange = true; + } + } + else + { + // Is the last point of the function. + if ( (prevPoint->getRealX()) < newX ) + { + validChange = true; + } + else + { + newX = prevPoint->getRealX(); + validChange = true; + } + } + } + else + { + if ( hasNext ) + { + // Is the first point of the function. + pFunctionPoint* nextPoint = (pFunctionPoint*) nextNode -> GetData(); + if ((nextPoint->getRealX()) > newX ) + { + validChange = true; + } + else + { + newX = nextPoint->getRealX(); + validChange = true; + } + } + } + if( validChange ) + { + changingPoint -> setRealX( newX ); + changingPoint -> setRealY( newY ); + } + return validChange; +} +/** +* Evaluates if the given point belongs to the function. +*/ +/* +bool pLogicalFunction::hasPoint(wxPoint aPoint) +{ + bool existPoint = false; + wxNode *nextNode = realPoints.GetFirst(); + + while (nextNode && !existPoint) + { + pFunctionPoint* nextPoint = (pFunctionPoint*)nextNode->GetData(); + if( nextPoint -> getRealX() == aPoint.x && nextPoint-> getRealY() == aPoint.y) + { + existPoint = true; + } + nextNode = nextNode->GetNext(); + } + return existPoint; +} +*/ +/** +* Returns the real x values of the control points of the function. It dont includes the points calculated by interpolation. +*/ +double* pLogicalFunction::getX_RealValues() +{ + wxNode *nextNode = realPoints.GetFirst(); + int size = realPoints.GetCount(); + double * x_Values; + int i=0; + + x_Values= new double[size]; + + while (nextNode) + { + pFunctionPoint* nextPoint = (pFunctionPoint*)nextNode->GetData(); + x_Values[i] = nextPoint-> getRealX(); + nextNode = nextNode->GetNext(); + i++; + } + return x_Values; +} + +/** +* Returns the real y values of the control points of the function. It dont includes the points calculated by interpolation. +*/ +double * pLogicalFunction::getY_RealValues() +{ + wxNode *nextNode = realPoints.GetFirst(); + int i =0; + int size = realPoints.GetCount(); + double * y_Values; + + y_Values= new double[size]; + + while (nextNode) + { + pFunctionPoint* nextPoint = (pFunctionPoint*)nextNode->GetData(); + y_Values[i] = nextPoint-> getRealY(); + nextNode = nextNode->GetNext(); + i++; + } + return y_Values; +} + +//----------------------- +// Persistence +//----------------------- + +/* + Save the points of the function + format: + #number of points + x<<"\t"<GetData(); + file <getRealX()<<"\t"<getRealY()<GetNext(); + } + } + file.close(); +} +/* + Load the points of a function +*/ +void pLogicalFunction::load(wxString fileName) +{ + std::string line; + std::ifstream file; + file.open( (const char*)(fileName.mb_str()) ); + + if(file.is_open()) + { + std::getline(file,line); + int nPoints=atoi(line.c_str()); + int i=0; + while(!file.eof() && i_startX = aStartX; +} + +double pLogicalFunction::getStartX() { + return this->_startX; +} + +void pLogicalFunction::setStartY(double aStartY) { + this->_startY = aStartY; +} + +double pLogicalFunction::getStartY() { + return this->_startY; +} + +/* + * ENDS + */ +void pLogicalFunction::setEndX(double aEndX) { + this->_endX = aEndX; +} + +double pLogicalFunction::getEndX() { + return this->_endX; +} + +void pLogicalFunction::setEndY(double aEndY) { + this->_endY = aEndY; +} + +double pLogicalFunction::getEndY() { + return this->_endY; +} +/* + * SCALES + */ +void pLogicalFunction::setScaleX(double aScaleX) { + this->_scaleX = aScaleX; +} + +double pLogicalFunction::getScaleX() { + return this->_scaleX; +} + +void pLogicalFunction::setScaleY(double aScaleY) { + this->_scaleY = aScaleY; +} + +double pLogicalFunction::getScaleY() { + return this->_scaleY; +} +/* + * MINS + */ +void pLogicalFunction::setMinX(double aMinX) { + this->_minX = aMinX; +} + +double pLogicalFunction::getMinX() { + return this->_minX; +} + +void pLogicalFunction::setMinY(double aMinY) { + this->_minY = aMinY; +} + +double pLogicalFunction::getMinY() { + return this->_minY; +} +/* + * MAXS + */ +void pLogicalFunction::setMaxX(double aMaxX) { + this->_maxX = aMaxX; +} + +double pLogicalFunction::getMaxX() { + return this->_maxX; +} + +void pLogicalFunction::setMaxY(double aMaxY) { + this->_maxY = aMaxY; +} + +double pLogicalFunction::getMaxY() { + return this->_maxY; +} + +/* + * OFFSETS + */ +void pLogicalFunction::setOffsetX(double aOffsetX) { + this->_offsetX = aOffsetX; +} + +double pLogicalFunction:: getOffsetX() { + return this->_offsetX; +} + +void pLogicalFunction:: setOffsetY(double aOffsetY) { + this->_offsetY = aOffsetY; +} + +double pLogicalFunction:: getOffsetY() { + return this->_offsetY; +} + +/* + * TYPE + */ +void pLogicalFunction:: setType(int aType) { + this->_type = aType; +} + +int pLogicalFunction :: getType() { + return this->_type; +} + +/* + * ValidPoint + */ +int pLogicalFunction :: getValidPointRange() +{ + return validPointRange; +} + +void pLogicalFunction :: setValidPointRange(int theRange) +{ + validPointRange = theRange; +} +/* +* Returns the number of points that the function +* has +*/ +int pLogicalFunction::getSizePoints() +{ + return realPoints.GetCount(); +} +void pLogicalFunction::getDirection(bool &dir) +{ + dir = leftToRigthDef; +} + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.h new file mode 100644 index 0000000..b36ccbe --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.h @@ -0,0 +1,368 @@ + +#ifndef __pLogicalFunction_h__ +#define __pLogicalFunction_h__ + +// ---------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ---------------------------------------------------------------------------- + +#include +#ifdef __BORLANDC__ +#pragma hdrstop +#endif +#ifndef WX_PRECOMP +#include +#endif + + +//---------------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------------- + +#include "pFunctionPoint.h" +#include +#include +#include + + + +class pLogicalFunction; +//---------------------------------------------------------------------------- +// Class definition +//---------------------------------------------------------------------------- +#define MAX_POINTS 50 + +//if your are going to change se sensible region you have to change MOVE in pPlotterLayer +#define SENSIBLE_REGION 5 + + +class pLogicalFunction: public wxObject +{ +public: + + //---------------------------------------------------------------------------- + // Constructors + //---------------------------------------------------------------------------- + pLogicalFunction( ); + + ~pLogicalFunction( ); + + /** + *Rewind + */ + /*virtual void Rewind() + { + node = realPoints.GetFirst(); + } + */ + + /** Get locus value for next N. + Override this function in your implementation. + @param x Returns X value + @param y Returns Y value + */ + /*virtual bool GetNextXY(double & x, double & y) + { + if(node) + { + pFunctionPoint* p=(pFunctionPoint*)node->GetData(); + x=p->getRealX(); + y=p->getRealY(); + node=node->GetNext(); + return true; + } + return false; + } + /** + Get Point list of the funcion + @param return points + */ + /*virtual*/ + void GetPoints(wxList &points) + { + points = realPoints; + } + /* + * validate if the function has that point in a sensible area returning the index where the point was found or -1 if is in not part of the function: define the sensible area is + * x1-validPointRange. +// -------------------------------------------------------------------------------------------- + +#ifndef WX_PRECOMP +#include +#endif + +//--------------------------------------------------------------------------------------------- +// Class implementation +//--------------------------------------------------------------------------------------------- + +IMPLEMENT_CLASS(pPlotter, wxPanel) + +//------------------------------------------------------------------------------------------------------------ +// Generated events declaration and definition +//------------------------------------------------------------------------------------------------------------ +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE( wxEVT_NW_TEXT_MESAGGE, -1 ) +END_DECLARE_EVENT_TYPES() + +DEFINE_EVENT_TYPE( wxEVT_NW_TEXT_MESAGGE ) + +// ---------------------------------------------------------------------------------------------------- +// Handdled events from pColorBar +// ---------------------------------------------------------------------------------------------------- +DECLARE_EVENT_TYPE(wxEVT_ADDED_POINT, -1) +DECLARE_EVENT_TYPE(wxEVT_REMOVED_POINT, -1) +DECLARE_EVENT_TYPE(wxEVT_MOVED_POINT, -1) +DECLARE_EVENT_TYPE(wxEVT_CHANGED_POINT, -1) +DECLARE_EVENT_TYPE(wxEVT_ON_COLOR_BAR, -1) + +// ---------------------------------------------------------------------------------------------------- +// Handdled events from plotter +// ---------------------------------------------------------------------------------------------------- +DECLARE_EVENT_TYPE(wxEVT_PPLOTTER_CHANGED_FUNCTION, -1) +DECLARE_EVENT_TYPE(wxEVT_PPLOTTER_POINT_MOVE, -1) +DECLARE_EVENT_TYPE(wxEVT_PPLOTTER_POINT_ADD, -1) +DECLARE_EVENT_TYPE(wxEVT_PPLOTTER_POINT_DELETE, -1) +DECLARE_EVENT_TYPE(wxEVT_PPLOTTER_GUIDELINES, -1) + +// ---------------------------------------------------------------------------------------------------- +// Handdled events from max-min barrange +// ---------------------------------------------------------------------------------------------------- +DECLARE_EVENT_TYPE(wxEVT_TSBAR, -1) +DECLARE_EVENT_TYPE(wxEVT_TSBAR_ACTUAL, -1) +DECLARE_EVENT_TYPE(wxEVT_TSBAR_START, -1) +DECLARE_EVENT_TYPE(wxEVT_TSBAR_END, -1) +DECLARE_EVENT_TYPE(wxEVT_TSBAR_MOVED, -1) +DECLARE_EVENT_TYPE(wxEVT_SELECTION_END, -1) + + +// ---------------------------------------------------------------------------------------------------- +// EVENT TABLE (->Connect: analogous) +//----------------------------------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(pPlotter, wxPanel) + //OnSize + //EVT_SIZE (pPlotter::OnSize) + + // Connectting the handled envents for the plotter to the corresponding methods + EVT_COMMAND (-1,wxEVT_PPLOTTER_CHANGED_FUNCTION, pPlotter::onChangeFunction) + EVT_COMMAND (-1,wxEVT_PPLOTTER_POINT_MOVE, pPlotter::onMovePoint_Plotter) + EVT_COMMAND (-1,wxEVT_PPLOTTER_POINT_ADD, pPlotter::onAddedPoint_Plotter) + EVT_COMMAND (-1,wxEVT_PPLOTTER_POINT_DELETE, pPlotter::onRemovedPoint_Plotter) + EVT_COMMAND (-1,wxEVT_PPLOTTER_GUIDELINES, pPlotter::onGuideLines) + + // Connectting the handled envents for the color bar to the corresponding methods + EVT_COMMAND (-1,wxEVT_ADDED_POINT, pPlotter :: onAdded_ColorPoint ) + EVT_COMMAND (-1,wxEVT_REMOVED_POINT, pPlotter :: onRemoved_ColorPoint ) + EVT_COMMAND (-1,wxEVT_MOVED_POINT, pPlotter :: onMoved_ColorPoint ) + EVT_COMMAND (-1,wxEVT_CHANGED_POINT, pPlotter :: onChanged_ColorPoint ) + EVT_COMMAND (-1,wxEVT_ON_COLOR_BAR, pPlotter :: onColorBar ) + + // Connectting the handled envents from the max-min barrange to the corresponding methods + EVT_COMMAND (-1,wxEVT_TSBAR, pPlotter::onBarrange) + EVT_COMMAND (-1,wxEVT_SELECTION_END, pPlotter::onSelectionEnd) + EVT_COMMAND (-1,wxEVT_TSBAR_MOVED, pPlotter::onMovedBar) + EVT_COMMAND (-1,wxEVT_TSBAR_ACTUAL, pPlotter:: onActualChange_Bar) + EVT_COMMAND (-1,wxEVT_TSBAR_START, pPlotter::onStartChange_Bar) + EVT_COMMAND (-1,wxEVT_TSBAR_END, pPlotter::onEndChange_Bar) + +END_EVENT_TABLE() + + +//--------------------------------------------------------------------------------------------- +// Constructors & Destructors +//--------------------------------------------------------------------------------------------- + /* + * Creates an integrated plotter instance + * @param *parent Container window + */ + pPlotter :: pPlotter (wxWindow *parent,int nWidth, int nHeight) + :wxPanel(parent,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL) + { + SetBackgroundColour(wxColour(255,255,255)); + m_plot = new pPlotterWindow( this, -1, wxPoint(0,0), wxSize(nWidth,nHeight), wxSUNKEN_BORDER ); + + // Adding the axis layers to the plotter + m_plot->AddLayer( new pPlotterScaleX() ); + m_plot->AddLayer( new pPlotterScaleY() ); + + // Creating the log window + /* + + m_log = new wxTextCtrl( panel, -1, wxT("This is the log window.\n"), wxPoint(0,0), wxSize(400,100), wxTE_MULTILINE ); + // Sharing the log window of the application with the plotter widget + m_plot->setmLog(m_log); + + */ + + + // Creating a function for the plotter with given points x-vector and y-vector + + /* + double vectX_F1 [] = { 0, 20, 50, 80, 100, 115, 120, 210, 220,250 }; + + +// double vectX_F1 [] = { 0, 20, 50, 80, 100, 115, 120, 210, 220,250 }; + + double vectY_F1 [] = { 0, 40, 70, 100, 200, 100, 40, 170, 0, 50 }; + pGraphicalFunction * f1 = m_plot ->getFunctionForVectors( vectX_F1, 10, vectY_F1, 10 ); + // Including and drawing the created function in the plotter + if (f1) + { + m_plot->addFunction( f1 ); + m_plot->addFunctionToMove(f1); + //m_plot->addFunctionToMove(f1); + wxPen mypen1(*wxBLUE, 2, wxDOT_DASH ); + mypen1.SetWidth(2); + f1->SetPen( mypen1 ); + } + */ + + //=================== lines to sychronyze the bars width with the drawed plotter-------------------------- + + mpWindow* mplotWindow = ((mpWindow*)m_plot); + float minReal_X = 0; //(float)mplotWindow->getMinScrX(); + float maxReal_X =(float)mplotWindow->getMaxScrX(); + float scrX=(float)mplotWindow->GetScrX()-100; + double scaleX=(scrX/(maxReal_X))* (mplotWindow->getZoomFactor()); // ........ + + // Creating the color bar with values according to the plotter added widget + color_bar = new pColorBar(this, (m_plot->GetSize()).GetWidth(),40, true); + color_bar -> setRepresentedValues (minReal_X, maxReal_X); + color_bar -> setDeviceBlitStart (70,0); + color_bar -> setVisibleRange (minReal_X, maxReal_X); + color_bar -> setDeviceEndMargin (50); + + + // Creating the min-max barrange bar with values according to the plotter added widget + barrange = new mBarRange(this, (m_plot->GetSize()).GetWidth(),30); + barrange -> setVisibleLabels (false); + barrange -> setRepresentedValues (minReal_X, maxReal_X); + barrange -> setDeviceBlitStart (70,0); + barrange -> setDeviceEndMargin (50); + + // Adding the components to the sizer + /* + if(m_plot->getActualFunction()) + setAll(); + */ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + sizer->Add( m_plot, 4, wxEXPAND); + sizer->Add( color_bar,0, wxEXPAND ); + sizer->Add( barrange, 0, wxEXPAND ); + + // sizer->Add( m_log, 0, wxEXPAND); + + // Stablishing the layout and sizer of the panel + /*panel->*/SetAutoLayout(true); + /*panel->*/SetSizer(sizer); + /*panel->*/Layout(); + + /*panel->*/Refresh(); + } + + + pPlotter :: ~pPlotter () + { + + } + +//--------------------------------------------------------------------------------------------- +// Methods +//--------------------------------------------------------------------------------------------- +/* +Set the bars according to the actual function +*/ + + void pPlotter::setAll() +{ + actualFunction = m_plot->getActualFunction(); + + if (actualFunction != NULL) + { + barrange -> setActiveStateTo(true); + color_bar -> setActiveStateTo(true); + + text.Clear(); + text = _T("minX="); + double realMin_X = actualFunction->getMinX(); + text = text + realMin_X; + text = text + _T(" maxX="); + double realMax_X = actualFunction->getMaxX(); + text = text + realMax_X; + + int minShowed = actualFunction->getMinXShowed(); + int maxShowed = actualFunction->getMaxXShowed(); + + barrange -> setRepresentedValues (realMin_X, realMax_X); + barrange->SetStart( minShowed ); + barrange->SetEnd( maxShowed ); + + + std::vector actualColorPoints; + actualFunction -> getColorPoints(actualColorPoints); + if(actualColorPoints.empty()) + color_bar ->reinitiateColorBar (realMin_X, realMax_X); + else + color_bar ->reinitiateColorBarTo(actualColorPoints); + + color_bar -> setVisibleRange (minShowed, maxShowed); + + // Refresh + color_bar -> RefreshForce(); + barrange -> RefreshForce(); + + sendTMessage(text); + } +} + + +//***************************************************************************************************** +// Color bar control methods +//***************************************************************************************************** + +//----------------------------------------------------------------------------------------------------- +// Updating methods for occured events in the color bar +//----------------------------------------------------------------------------------------------------- +void pPlotter :: onAdded_ColorPoint(wxCommandEvent& event) +{ + text.Clear(); + text = _T( "Last event was on color bar: Color point added, total#"); + + actualFunction = m_plot->getActualFunction(); + if(actualFunction!=NULL) + { + std::vector actualColorPoints; + color_bar ->getAddedColorsPointsList(actualColorPoints); + actualFunction -> setColorPoints(actualColorPoints); + text << actualColorPoints.size(); + + sendTMessage(text); + } +} +void pPlotter :: onRemoved_ColorPoint(wxCommandEvent& event) +{ + text.Clear(); + text = _T( "Last event on color bar: Color point removed total#"); + + actualFunction = m_plot->getActualFunction(); + std::vector actualColorPoints; + color_bar ->getAddedColorsPointsList(actualColorPoints); + actualFunction -> setColorPoints(actualColorPoints); + text << actualColorPoints.size(); + + sendTMessage(text); +} +void pPlotter :: onMoved_ColorPoint(wxCommandEvent& event) +{ + text.Clear(); + text = _T( "Last event was on color bar: Color point moved to: "); + int lastReal_X = (color_bar->getLastMovedColorPoint())->getRealX(); + text << lastReal_X; + + barrange ->setRealX_vertical_line (lastReal_X); + barrange -> RefreshForce(); + + m_plot->setRealGuideX (lastReal_X); + m_plot->UpdateAll(); + + sendTMessage(text); +} +void pPlotter:: onChanged_ColorPoint(wxCommandEvent& event) +{ + text.Clear(); + sendTMessage(_T("Last event was on color bar: Color point changed color")); +} + +void pPlotter :: onColorBar( wxCommandEvent& event ) +{ + if( (barrange->getRealX_vertical_line())!=-1) + { + barrange ->setRealX_vertical_line (-1); + m_plot->setRealGuideX (-1); + + barrange -> RefreshForce(); + m_plot->UpdateAll(); + } +} + +//***************************************************************************************************** +// Plotter control methods +//***************************************************************************************************** + + +/* +* Method called when actual function is changed +*/ +void pPlotter :: onChangeFunction (wxCommandEvent& event) +{ + actualFunction = m_plot->getActualFunction(); + + if (actualFunction != NULL) + { + if( !barrange->isActive() ) + { + barrange -> setActiveStateTo(true); + color_bar -> setActiveStateTo(true); + } + + text.Clear(); + text = _T("Last event was on plotter: function changed, minX="); + double realMin_X = actualFunction->getMinX(); + text << realMin_X; + text << _T(" maxX="); + double realMax_X = actualFunction->getMaxX(); + text << realMax_X; + + int minShowed = actualFunction->getMinXShowed(); + int maxShowed = actualFunction->getMaxXShowed(); + + barrange -> setRepresentedValues (realMin_X, realMax_X); + barrange->SetStart( minShowed ); + barrange->SetEnd( maxShowed ); + + std::vector actualColorPoints; + actualFunction -> getColorPoints(actualColorPoints); + if(actualColorPoints.empty()) + color_bar ->reinitiateColorBar (realMin_X, realMax_X); + else + color_bar ->reinitiateColorBarTo(actualColorPoints); + + color_bar -> setVisibleRange (realMin_X, maxShowed); + + // Refresh + color_bar -> RefreshForce(); + barrange -> RefreshForce(); + + sendTMessage(text); + } +} + + +/* +* Method called when a point is added to the actual function on the plotter +*/ + +void pPlotter :: onAddedPoint_Plotter (wxCommandEvent& event) +{ + text.Clear(); + m_plot->writeInText(text); + sendTMessage(text); +} + +/* +* Method called when a point is removed to the actual function on the plotter +*/ +void pPlotter :: onRemovedPoint_Plotter (wxCommandEvent& event) +{ + text.Clear(); + m_plot->writeInText(text); + sendTMessage(text); +} + +/* +* Method called when a point is moved from the actual function on the plotter +*/ +void pPlotter :: onMovePoint_Plotter (wxCommandEvent& event) +{ + text.Clear(); + m_plot->writeInText(text); + sendTMessage(text); +} +/* +* Method called when turn off the guide line from the actual function on the plotter +*/ +void pPlotter::onGuideLines(wxCommandEvent& event) +{ + +} + + + +//***************************************************************************************************** +// Max-Min Barrange control methods +//***************************************************************************************************** +/* +* +*/ +void pPlotter::onBarrange(wxCommandEvent& event) +{ + +} +/* +* +*/ +void pPlotter::onActualChange_Bar(wxCommandEvent& event) +{ + text.Clear(); + text = _T( "Last event was on min-max bar: Actual triangle moved to: " ); + int lastActual_X = barrange->GetActual(); + + text << lastActual_X; + + color_bar ->setRealX_vertical_line (lastActual_X); + m_plot->setRealGuideX (lastActual_X); + + color_bar -> RefreshForce(); + m_plot->UpdateAll(); + + sendTMessage(text); +} + +/* +* Method called when the start triangle is moved. Adjusts the plotter and color bar view-range. +*/ +void pPlotter::onStartChange_Bar(wxCommandEvent& event) +{ + text.Clear(); + + text = _T( "Last event was on min-max bar: Start triangle moved to: "); + int realMin_X = barrange->GetStart(); + text += wxString::Format(_T("%d"), realMin_X); + double realMax_X = m_plot->getMaxScrX(); + + color_bar -> setVisibleRange (realMin_X, realMax_X); + + m_plot->actualizeViewRange(realMin_X,realMax_X); + + //setting the plotter for draw the functions that + //it has to move. + + float startP=(float)barrange->getStartShowPorcentage(); + float endP=(float)barrange->getEndShowPorcentage(); + m_plot->moveFunctions(startP,endP); + + //Updating + color_bar -> RefreshForce(); + m_plot -> UpdateAll(); + sendTMessage(text); +} + +void pPlotter::onEndChange_Bar(wxCommandEvent& event) +{ + text.Clear(); + text += _T("Last event was on min-max bar: End triangle moved to: "); + int realMax_X = barrange->GetEnd(); + text += wxString::Format(_T("%d"),realMax_X); + double realMin_X = m_plot->getMinScrX(); + color_bar -> setVisibleRange (realMin_X, realMax_X); + m_plot->actualizeViewRange(realMin_X,realMax_X); + + float startP=(float)barrange->getStartShowPorcentage(); + float endP=(float)barrange->getEndShowPorcentage(); + m_plot->moveFunctions(startP,endP); + + color_bar -> RefreshForce(); + m_plot -> UpdateAll(); + + sendTMessage(text); +} + +void pPlotter :: onSelectionEnd(wxCommandEvent& event) +{ + if( (color_bar->getRealX_vertical_line())!=-1) + { + color_bar ->setRealX_vertical_line (-1); + m_plot->setRealGuideX (-1); + + color_bar -> RefreshForce(); + m_plot->UpdateAll(); + } +} +void pPlotter :: onMovedBar(wxCommandEvent& event) +{ + text.Clear(); + text = _T( "Last event was on min-max bar: Moved bar to min:" ); + + int realMin_X = barrange->GetStart(); + text += wxString::Format(_T("%d"),realMin_X); + text += _T(" max:"); + + int realMax_X = barrange->GetEnd(); + text += wxString::Format(_T("%d"),realMax_X); + + color_bar -> setVisibleRange (realMin_X, realMax_X); + + float startP=(float)barrange->getStartShowPorcentage(); + float endP=(float)barrange->getEndShowPorcentage(); + m_plot->moveFunctions(startP,endP); + + color_bar -> RefreshForce(); + m_plot -> UpdateAll(); + + sendTMessage(text); +} + +/* + * Method for sending a text message to the container window + * @param theText Is the text of the message + */ +void pPlotter :: sendTMessage(wxString theText) +{ + //Creating a message event + wxCommandEvent puntualMSG_Event( wxEVT_NW_TEXT_MESAGGE, GetId() ); + puntualMSG_Event.SetEventObject(this); + //Sending the event + GetEventHandler()->ProcessEvent( puntualMSG_Event ); +} + +/* + * Sets the text message + * @param nMessage Is the text message to set + */ + void pPlotter :: setTextMessage(wxString nMessage) + { + text = nMessage; + } + + /* + * Gets the text message + * @param text Is the actual text message + */ + wxString pPlotter :: getTextMessage() + { + return text; + } + /** + * Add a function to the plotter + * when the function doesnt come from window + */ + int pPlotter:: addFunction(pGraphicalFunction * function) + { + return m_plot->addFunction(function); + } + /** + * Creates and returns a graphical funcion according to the indicated vectors. + */ + pGraphicalFunction* pPlotter::getFunctionForVectors( double* vectorX, int sizeX,double * vectorY, int sizeY ) + { + return m_plot->getFunctionForVectors(vectorX,sizeX, vectorY, sizeY ); + } + /* + Set Type + */ + void pPlotter::setType(int t) + { + m_plot->setType(t); + } + /* + Get a function in the plotter given the index + */ + pGraphicalFunction* pPlotter:: getFunction(int index) + { + return m_plot->getFunction(index); + } + /* + Adds function to move with the bar min max + */ + int pPlotter::addFunctionToMove(pGraphicalFunction * function) + { + return m_plot->addFunctionToMove(function); + } + + /* + move the functions that the user wants to move + and that were setted in functionsToMove + @param porcentageMinX:the porcentage that the minShowed + of the funcntions have to be move + @param porcentageMaxX:the porcentage that the maxShowed + of the funcntions have to be move + + */ + void pPlotter:: moveFunctions(float porcentageMinX,float porcentageMaxX) + { + m_plot->moveFunctions(porcentageMinX,porcentageMaxX); + } + /* + * deletes the function from the plotter + */ + /* + bool pPlotter::deleteFunction(pGraphicalFunction * function); + { + return m_plot->deleteFunction(function); + + } + + */ + //-------------------- + // Color information + //--------------------- + /** + Returns the number of points that the bar color has + */ + int pPlotter::getColorPointsSize() + { + return color_bar->getColorPointsSize(); + } + /* + Get the RGB values of the color point that is in the + index given + */ + void pPlotter::getBarColorDataAt(int index,double& x, int& red,int& green,int& blue) + { + color_bar->getDataAt(index,x,red,green,blue); + } + /* + add a color Point + returns true if the point was succesfully added + PRE: 0<=red<=255 0<=green<=255 0<=blue<=255 + */ + bool pPlotter::addColorPoint(int x,int red,int green, int blue) + { + wxColour color= wxColour(red,green,blue); + return color_bar->addColorPoint((double)x, color); + } + void pPlotter::eraseColorPoints() + { + int min=color_bar->getMinValue(); + int max=color_bar->getMaxValue(); + color_bar->reinitiateColorBar(min,max); + } + + //-------------------- + // bar Information + //--------------------- + float pPlotter::getMaxShowedPorcentage() + { + return barrange->getEndShowPorcentage(); + } + float pPlotter::getMinShowedPorcentage() + { + return barrange->getStartShowPorcentage(); + } + float pPlotter::getActualShowedPorcentage() + { + return barrange->getActualShowPorcentage(); + } + + //-------------------- + // plotter Information + //--------------------- + void pPlotter::setActual(pGraphicalFunction* nActual) + { + m_plot->setActualFunction(nActual); + } + void pPlotter::update() + { + //if it is a plotter of histograms + if(m_plot->getType()==2) + { + pGraphicalFunction* tf= m_plot->getActualFunction(); + if(tf->getType()==2) + { + tf->clearSplineVectors(); + tf->addSplinesPoints(); + tf->initializeSplineVectors(); + } + } + + m_plot->UpdateAll(); + } + //---------------------------- + //Handling Options Menu + //---------------------------- + + void pPlotter::setPopUpMenu(bool startD,bool stopD,bool smooth,bool line, bool zoomIn, + bool zoomOut,bool showPoints,bool noShowPoints,bool changeColor, bool addP, + bool delPoint,bool load,bool save) + { + m_plot->setPopUpMenu(startD, stopD, smooth, line, zoomIn, + zoomOut, showPoints, noShowPoints, changeColor, addP, + delPoint, load, save); + } + + + /* + if the user resize the window + */ + + + + /* + void pPlotter::OnSize( wxSizeEvent &WXUNUSED(event) ) + { + int scrX,scrY; + GetClientSize(&scrX,&scrY); + m_plot->SetSize(scrX,scrY); + + + pGraphicalFunction* actual=m_plot->getActualFunction(); + if(actual!=NULL) + { + actual->setScreens(scrX,scrY); + actual->setScales(); + } + + + } + */ + + + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotter.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotter.h new file mode 100644 index 0000000..5049e85 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotter.h @@ -0,0 +1,246 @@ +#ifndef __pPlotter_h__ +#define __pPlotter_h__ + +// -------------------------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// -------------------------------------------------------------------------------------------- + +#include +#ifdef __BORLANDC__ +#pragma hdrstop +#endif +#ifndef WX_PRECOMP +#include +#endif + + +//-------------------------------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------------------------------- + +#include "pColorBar.h" +#include "mBarRange.h" +#include "mathplot.h" +#include "pFunctionPoint.h" +#include "pGraphicalFunction.h" +#include "pPlotterLayer.h" +#include "pPlotterWindow.h" +#include "pPlotterScaleY.h" +#include "pPlotterScaleX.h" +#include +#include + +//------------------------------------------------------------------------------------------------------------- +// Enum declarations +//------------------------------------------------------------------------------------------------------------- +/** Command IDs used by pColorPoint */ + +//-------------------------------------------------------------------------------------------- +// Class definition +//-------------------------------------------------------------------------------------------- + +/* +* Represents the integrated plotter that consists of the a drawing area, and control bars (min-max bar, degrade bar) +*/ +/** @file pPlotter.h */ +class pPlotter : public wxPanel{ + +public: + + //------------------------------------------------------------------------------------------------------------ + // Constructors & Destructors + //------------------------------------------------------------------------------------------------------------ + /* + * Creates an integrated plotter instance + * @param *parent Container window + */ + pPlotter (wxWindow *parent,int nWidth, int nHeight); + + ~pPlotter (); + + //---------------------------------------------------------------------------------------- + // Methods definition + //---------------------------------------------------------------------------------------- + + // Plotter received events + void onChangeFunction (wxCommandEvent& event); + void onAddedPoint_Plotter (wxCommandEvent& event); + void onRemovedPoint_Plotter (wxCommandEvent& event); + void onMovePoint_Plotter (wxCommandEvent& event); + void onGuideLines (wxCommandEvent& event); + + // Color bar received events + void onAdded_ColorPoint ( wxCommandEvent& event ); + void onRemoved_ColorPoint ( wxCommandEvent& event ); + void onMoved_ColorPoint( wxCommandEvent& event ); + void onChanged_ColorPoint( wxCommandEvent& event ); + void onColorBar( wxCommandEvent& event ); + + // Min-Max Barrange received events + void onBarrange(wxCommandEvent& event); + void onActualChange_Bar(wxCommandEvent& event); + void onStartChange_Bar(wxCommandEvent& event); + void onEndChange_Bar(wxCommandEvent& event); + void onSelectionEnd(wxCommandEvent& event); + void onMovedBar(wxCommandEvent& event); + + /* + * Method for sending a text message to the container window + * @param theText Is the text of the message + */ + void sendTMessage(wxString theText); + + // Other methods + wxWindow* initialize(wxWindow *parent); + + /* + * Sets the text message + * @param nMessage Is the text message to set + */ + void setTextMessage(wxString nMessage); + + /* + * Gets the text message + * @param text Is the actual text message + */ + wxString getTextMessage(); + /** + * Creates and returns a graphical funcion according to the indicated vectors. + */ + pGraphicalFunction* getFunctionForVectors( double* vectorX, int sizeX,double * vectorY, int sizeY ); + /** + * Add a function to the plotter + * when the function doesnt come from window + */ + int addFunction(pGraphicalFunction * function); + /* + Set Type + */ + void setType(int t); + /* + Get a function in the plotter given the index + */ + pGraphicalFunction* getFunction(int index); + + /* + if the user resize the window + */ + void OnSize( wxSizeEvent &WXUNUSED(event) ); + /* + Get a function in the plotter given the index + */ + //pGraphicalFunction* getFunction(int index); + + /* + move the functions that the user wants to move + and that were setted in functionsToMove + @param porcentageMinX:the porcentage that the minShowed + of the funcntions have to be move + @param porcentageMaxX:the porcentage that the maxShowed + of the funcntions have to be move + + */ + void moveFunctions(float porcentageMinX,float porcentageMaxX); + + /* + Adds function to move with the bar min max + */ + int addFunctionToMove(pGraphicalFunction * function); + /* + Set the bars according to the actual function + */ + + void setAll(); + /* + * deletes the function from the plotter + */ + //bool deleteFunction(pGraphicalFunction* function); + + + //-------------------- + // Color information + //--------------------- + + /** + Returns the number of points that the bar color has + */ + int getColorPointsSize(); + + /* + Get the RGB values of the color point that is in the + index given + */ + void getBarColorDataAt(int index,double&x,int& red,int& green,int& blue); + /* + add a color Point + returns true if the point was succesfully added + PRE: 0<=red<=255 0<=green<=255 0<=blue<=255 + */ + bool addColorPoint (int x,int red,int green, int blue); + + void eraseColorPoints(); + + + //-------------------- + // bar Information + //--------------------- + float getMaxShowedPorcentage(); + float getMinShowedPorcentage(); + float getActualShowedPorcentage(); + //-------------------- + // plotter Information + //--------------------- + void setActual(pGraphicalFunction* nActual); + void update(); + + //---------------------------- + //Handling Options Menu + //---------------------------- + /* + if any parameter is true, is going to be remove from the popUp menu + */ + void setPopUpMenu(bool startD,bool stopD,bool smooth,bool line, bool zoomIn, + bool zoomOut,bool showPoints,bool noShowPoints,bool changeColor, bool addP, + bool delPoint,bool load,bool save); + + //---------------------------------------------------------------------------------------- + // Attributes declration + //---------------------------------------------------------------------------------------- +private: + + /* + * Represents the plotter widget drawing area + */ + pPlotterWindow *m_plot; + /* + * Represents the color bar instance + */ + pColorBar *color_bar; + /* + * Represents the barrange instance + */ + mBarRange *barrange; + /* + * Represents the pointer to the actual funtion in the unified plotter + */ + pGraphicalFunction* actualFunction; + + /* + * Represents the text message + */ + wxString text; + + /* + * Declaring the existence of the class + */ + DECLARE_CLASS (pPlotter) + /* + * Declaring the use of events + */ + DECLARE_EVENT_TABLE() +}; + +#endif + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.cxx new file mode 100644 index 0000000..a1a04ef --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.cxx @@ -0,0 +1,628 @@ +//---------------------------------------------------------------------------- +// Class definition include +//---------------------------------------------------------------------------- +#include "pPlotterLayer.h" + +// ---------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ---------------------------------------------------------------------------- + +#ifndef WX_PRECOMP +#include +#endif + +#include +#include +#include +//---------------------------------------------------------------------------- +// Class implementation +//---------------------------------------------------------------------------- + +IMPLEMENT_ABSTRACT_CLASS(pPlotterLayer, mpLayer) +//---------------------------------------------------------------------------- +// Methods +//---------------------------------------------------------------------------- + +/** +*@param name Label +*@param flags Label alignment, pass one of #mpALIGN_NE, #mpALIGN_NW, #mpALIGN_SW, #mpALIGN_SE. +*/ +pPlotterLayer:: pPlotterLayer(wxString name , int flags ) +{ + SetName(name); + m_flags = flags; + points.DeleteContents(TRUE); + offsetX=0; + offsetY=0; +} + +/* +Draw the line from (x1,y1) to (x2,y2) only passing by the +positive points in the line +*/ +void pPlotterLayer::draw(wxDC & dc,mpWindow & w,double x1,double y1,double x2,double y2) +{ + + //intercepts + float m=((float)(y2-y1))/(x2-x1); + float x0=-y1/m+x1; + float y0=-m*x1+y1; + + + //analyzing the curve + + if(x1<=0 && x2>=0) + { + if(y2>=0 && y1>=0) + dc.DrawLine(0,y0, x2,y2); + + else if(y2<=0 && y1>=0) + { + if(y0>=0 && x0>=0) + dc.DrawLine(0,y0,x0,0 ); + } + else if(y2>=0 && y1<=0) + { + if(y0>=0) + dc.DrawLine(0,y0,x2,y2 ); + } + + } + + if(x1>=0 && x2>=0) + { + if(y1>=0 && y2>=0 ) + dc.DrawLine(x1,y1, x2,y2); + else if(y1>=0 && y2<=0) + dc.DrawLine(x1,y1,x0,0 ); + else if(y1<=0 && y2>=0) + dc.DrawLine(x0,0,x2,y2); + } + + +} + +/** +* Draw the function with th spline points +* +*/ +void pPlotterLayer::drawSplineCurve(wxDC & dc,mpWindow & w) +{ + std::vector vx=getXSpline(); + std::vector vy=getYSpline(); + wxPoint* ppoints; + + int counter=0,minX,maxX,minY,maxY; + /* + This is the offset of every point scale to the window + pixel + */ + int offsetpx=getOffsetPixelsXv(); + int offsetpy=getOffsetPixelsYv(); + + // type of plotter + int type=getmType(); + + wxPoint point; + /***********/ + getMaxShowed(maxX,maxY); + getMinShowed(minX,minY); + /***********/ + + + if(type==2) + { + /* + Fill the function if it represented an histogram + */ + ppoints=(wxPoint*)malloc(sizeof(int)*2*(vx.size()+2)); + //initialize points + point.x=-5000; + point.y=-5000; + ppoints[0]=point; + ppoints[1]=point; + } + + int size=vx.size(); + int j=2; + + for(int i=0;(i+1)< size;i++) + { + + + double cxi=(vx.at(i)-minX-offsetX)*scaleX+offsetpx; + double cyi=(vy.at(i)-minY-offsetY)*scaleY+offsetpy; + + double cxj=(vx.at(i+1)-minX-offsetX)*scaleX+offsetpx; + double cyj=(vy.at(i+1)-minY-offsetY)*scaleY+offsetpy; + + + if(type!=2) + draw(dc,w,cxi,cyi,cxj,cyj); + else if(type==2) + { + if(!initializePolygon(ppoints,cxi,cyi,cxj,cyj) && ((cxi<=0 && cxj>=0)||(cxi>=0 && cxj>=0))) + { + point.x=cxj; + point.y=cyj; + ppoints[j]=point; + j++; + + } + } + + } + if(type==2) + { + //point.x=vx.at(size-1)* scaleX + offsetpx; + point.x=ppoints[j-1].x; + point.y=0; + //ppoints[vx.size()]=point; + ppoints[j]=point; + /* + Fill the function if it represented an histogram + */ + //ppoints=(wxPoint*)malloc(sizeof(int)*2*(vx.size()+1)); + //settings for fill + //point.x=vx.at(0)*scaleX + offsetpx; + point.x=ppoints[0].x; + point.y=0; + //ppoints[vx.size()+1]=point; + ppoints[j+1]=point; + + dc.SetBrush(wxBrush( wxColour(239,238,242) ,wxSOLID )); + dc.SetPen(wxPen( wxColour(0,0,0) ,1,wxSOLID )); + //dc.DrawPolygon(vx.size()+2,ppoints,0,0); + dc.DrawPolygon(j+2,ppoints,0,0); + } + + +} + +/* + it define the first point of the polygon for be drawing + returs true if the first and second point of the polygon are setted +*/ +bool pPlotterLayer::initializePolygon(wxPoint* points,double x1, double y1,double x2, double y2) +{ + bool setted=false; + + //intercepts + float m=((float)(y2-y1))/(x2-x1); + float x0=-y1/m+x1; + float y0=-m*x1+y1; + + if(points[0].x<=0&& points[1].x<=0 && points[0].y<=0&& points[1].y<=0) + { + + int offsetpx=getOffsetPixelsXv(); + + //analyzing the curve + + if(x1<=0 && x2>=0) + { + if(y2>=0 && y1>=0) + { + //dc.DrawLine(0,y0, x2,y2); + points[0].x=0; + points[0].y=y0; + points[1].x=x2; + points[1].y=y2; + setted=true; + + } + else if(y2<=0 && y1>=0) + { + if(y0>=0 && x0>=0) + { + //dc.DrawLine(0,y0,x0,0 ); + points[0].x=0; + points[0].y=y0; + points[1].x=x0; + points[1].y=0; + setted=true; + + } + + } + else if(y2>=0 && y1<=0) + { + if(y0>=0) + { + //dc.DrawLine(0,y0,x2,y2 ); + points[0].x=0; + points[0].y=y0; + points[1].x=x2; + points[1].y=y2; + setted=true; + } + } + + } + + if(x1>=0 && x2>=0) + { + if(y1>=0 && y2>=0 ) + { + //dc.DrawLine(x1,y1, x2,y2); + points[0].x=x1; + points[0].y=y1; + points[1].x=x2; + points[1].y=y2; + setted=true; + } + else if(y1>=0 && y2<=0) + { + //dc.DrawLine(x1,y1,x0,0 ); + points[0].x=x1; + points[0].y=y1; + points[1].x=x0; + points[1].y=0; + setted=true; + } + else if(y1<=0 && y2>=0) + { + //dc.DrawLine(x0,0,x2,y2); + points[0].x=x0; + points[0].y=0; + points[1].x=x2; + points[1].y=y2; + setted=true; + } + } + else + return setted; + } + else + return setted; +} + +/** +* Draw le lines between the points of the function +*/ +void pPlotterLayer::drawFunction(wxDC & dc,mpWindow & w) +{ + + + int scrwX,scrwY,offsetpx,offsetpy,maxX,minX,maxY,minY; + wxPoint* ppoints=NULL; + + /* + This is the offset of every point scale to the window + pixel + */ + offsetpx=getOffsetPixelsXv(); + offsetpy=getOffsetPixelsYv(); + + + Rewind(); + + + dc.GetSize(&scrwX, &scrwY); + + //Lines between the points + + GetPoints(points); + + // type of plotter + int type=getmType(); + /***********/ + getMaxShowed(maxX,maxY); + getMinShowed(minX,minY); + /***********/ + + //traslation + int xTraslation=getXTraslation(); + wxNode* node= points.GetFirst(); + int i=1;//points.GetCount()+1; + int j=2; + /* + Fill it if it is an histogram + */ + wxPoint point; + pFunctionPoint* pointk; + if(type==2) + { + /* + Fill the function if it represented an histogram + */ + ppoints=(wxPoint*)malloc(sizeof(int)*2*(points.GetCount()+2)); + //initialize points + point.x=-5000; + point.y=-5000; + ppoints[0]=point; + ppoints[1]=point; + + } + + + while (node!=NULL && node->GetNext()!=NULL) + { + pFunctionPoint* pointi=(pFunctionPoint*)node->GetData(); + wxNode* nextNode=node->GetNext(); + pFunctionPoint* pointj=(pFunctionPoint*)nextNode->GetData(); + + // we do the offset + int pxi=(pointi->getRealX()-minX)-offsetX; + int pyi=(pointi->getRealY()-minY)-offsetY; + int pxj=(pointj->getRealX()-minX)-offsetX; + int pyj=(pointj->getRealY()-minY)-offsetY; + + + int cxi=pxi* scaleX + offsetpx; //+ xTraslation; + int cxj=pxj* scaleX + offsetpx; //+ xTraslation; + int cyi=pyi* scaleY+ offsetpy ; + int cyj=pyj* scaleY+ offsetpy ; + //dc.DrawLine(pxi* scaleX + offsetpx,pyi* scaleY+ offsetpy, pxj* scaleX + offsetpx,pyj* scaleY+ offsetpy ); + if(type!=2) + draw(dc,w,pxi* scaleX + offsetpx,pyi* scaleY+ offsetpy, pxj* scaleX + offsetpx,pyj* scaleY+ offsetpy ); + //dc.DrawLine(pxi* scaleX + offsetpx,pyi* scaleY+ offsetpy, pxj* scaleX + offsetpx,pyj* scaleY+ offsetpy ); + else if(type==2) + { + if(!initializePolygon(ppoints,cxi,cyi,cxj,cyj) && ((cxi<=0 && cxj>=0)||(cxi>=0 && cxj>=0))) + { + point.x=cxj; + point.y=cyj; + ppoints[j]=point; + j++; + + } + } + + node=node->GetNext(); + + } + if(type==2) + { + //point.x=vx.at(size-1)* scaleX + offsetpx; + point.x=ppoints[j-1].x; + point.y=0; + //ppoints[vx.size()]=point; + ppoints[j]=point; + /* + Fill the function if it represented an histogram + */ + //ppoints=(wxPoint*)malloc(sizeof(int)*2*(vx.size()+1)); + //settings for fill + //point.x=vx.at(0)*scaleX + offsetpx; + point.x=ppoints[0].x; + point.y=0; + //ppoints[vx.size()+1]=point; + ppoints[j+1]=point; + + dc.SetBrush(wxBrush( wxColour(239,238,242) ,wxSOLID )); + dc.SetPen(wxPen( wxColour(0,0,0) ,1,wxSOLID )); + //dc.DrawPolygon(vx.size()+2,ppoints,0,0); + dc.DrawPolygon(j+2,ppoints,0,0); + + } + +} + +/** +* Draw the points of the function +*/ +void pPlotterLayer::drawPoints(wxDC & dc,mpWindow & w) +{ + + Rewind(); + double x, y; + int minX,maxX,minY,maxY; + + + /* + This is the offset of every point scale to the window + pixel + */ + int offsetpx=getOffsetPixelsXv(); + int offsetpy=getOffsetPixelsYv(); + //traslation + int xTraslation=getXTraslation(); + /*wxPen mypen(*wxBLACK, 5, wxSOLID); + dc.SetPen(mypen);*/ + /***********/ + getMaxShowed(maxX,maxY); + getMinShowed(minX,minY); + /***********/ + //we have to draw the points + + while (GetNextXY(x, y)) + { + //GetNextXY(x, y); + //set the points of the polygons + wxPoint points[4]; + dc.SetBrush(wxBrush( wxColour(255,0,0),wxSOLID )); + //dc.SetPen(wxPen(wxColour(0,0,0),1,wxSOLID) ); + points[0].x=((x-minX-offsetX)*scaleX + offsetpx-MOVE); + points[0].y=((y-minY-offsetY)*scaleY+ offsetpy-MOVE); + points[1].x=((x-minX-offsetX)*scaleX+ offsetpx+MOVE); + points[1].y=((y-minY-offsetY)*scaleY+ offsetpy-MOVE); + points[2].x=((x-minX-offsetX)*scaleX+ offsetpx+MOVE); + points[2].y=((y-minY-offsetY)*scaleY+ offsetpy+MOVE); + points[3].x=((x-minX-offsetX)*scaleX+ offsetpx-MOVE); + points[3].y=((y-minY-offsetY)*scaleY+ offsetpy+MOVE); + if((x-minX-offsetX)*scaleX >=0 && (y-minY-offsetY/*w.getMinScrY()*/)*scaleY>=0) + dc.DrawPolygon(4,points,0,0); + } +} + +/** +* Draw the line between the last point of the function +* and the position of the mouse +*/ +void pPlotterLayer::drawLineToMousePoint(wxDC & dc,mpWindow & w) +{ + int x,y,sizeP,maxX,maxY,minX,minY; + bool direction; + + Rewind(); + + getMousePoint(x,y); + getDirection(direction); + getSize(sizeP); + //Lines betwen the points + GetPoints(points); + + wxNode *node=points.GetLast(); + wxNode *node1=points.GetFirst(); + + + /* + This is the offset of every point scale to the window + pixel + */ + int offsetpx = getOffsetPixelsXv(); + int offsetpy = getOffsetPixelsYv(); + /***********/ + getMaxShowed(maxX,maxY); + getMinShowed(minX,minY); + /***********/ + //traslation + int xTraslation=getXTraslation(); + + if(node) + { + pFunctionPoint* lastPoint=(pFunctionPoint*)node->GetData(); + pFunctionPoint* firstPoint=(pFunctionPoint*)node1->GetData(); + + //LeftDrawing + if(lastPoint->getRealX()=2) + + dc.DrawLine((lastPoint->getRealX()-minX-offsetX)*scaleX + offsetpx,(lastPoint->getRealY()-minY-offsetY)*scaleY+ offsetpy, (x-minX)*scaleX + offsetpx, (y-minY)*scaleY + offsetpy); + + //right drawing + else if(firstPoint->getRealX()>x && !direction && sizeP >=2 ) + + dc.DrawLine((firstPoint->getRealX()-minX-offsetX)*scaleX+ offsetpx,(firstPoint->getRealY()-minY-offsetY)*scaleY+ offsetpy,(x-minX)*scaleX+ offsetpx, (y-minY)*scaleY+ offsetpy); + + //just a point + else if(sizeP==1 ) + { + dc.DrawLine((lastPoint->getRealX()-minX-offsetX)*scaleX + offsetpx,(lastPoint->getRealY()-minY-offsetY)*scaleY+ offsetpy, (x-minX)*scaleX+ offsetpx, (y-minY)*scaleY+ offsetpy); + } + } + + if( w.drawGuideLines() ) + { + dc.SetPen(wxPen( wxColour(255,0,0),1,wxDOT )); + // Drawing the horizontal guide line + dc.DrawLine( 0, (y-minY)*scaleY + offsetpy, (x-minX)*scaleX + offsetpx, (y-minY)*scaleY + offsetpy); + // Drawing the vertical guide line + dc.DrawLine( (x-minX)*scaleX + offsetpx,0, (x-minX)*scaleX + offsetpx, (y-minY)*scaleY + offsetpy); + } +} + + +/** +Layer plot handler. +This implementation will plot the locus in the visible area and +put a label according to the aligment specified. +*/ +void pPlotterLayer::Plot(wxDC & dc, mpWindow & w) +{ + bool show,drawing,actual; + int scrwX,scrwY,maxX,maxY,minX,minY,type; + float factorZoom; + + ifShowPoints(show); + getDrawing(drawing); + type=vGetType(); + + dc.SetPen( m_pen); + + /* + * Managing the scale and zoom + */ + + dc.GetSize(&scrwX, &scrwY); + getIfActual(actual); + //getMax(maxX, maxY); + /***********/ + getMaxShowed(maxX,maxY); + getMinShowed(minX,minY); + /***********/ + getFactorZoom(factorZoom); + getOffsets(offsetX,offsetY); + /* + maxX=w.getMaxScrX(); + maxY=w.getMaxScrY(); + minX=w.getMinScrX(); + minY=w.getMinScrY(); + */ + if((maxX-minX)!=0 && (maxY-minY)!=0) + { + + scaleX=(((double)scrwX-100)/(maxX-minX))*factorZoom; + scaleY=(((double)scrwY-50)/(maxY-minY))*factorZoom; + + if(actual) + { + w.SetScaleX(scaleX); + w.SetScaleY(scaleY); + //w.setMinScrX(offsetX); + //w.setMinScrY(offsetY); + } + + } + /* + Managing the drawing + */ + int orgx=70; + int orgy=w.GetScrY()-40; + dc.SetDeviceOrigin( orgx ,orgy); + dc.SetAxisOrientation(true,true); + + + //if the user dont want to see the points of the function and if he stops drawing + //we have to draw the function + if(!show && !drawing && type==1) + drawFunction(dc,w); + else if(!show && !drawing && type==2) + drawSplineCurve(dc,w); + //we just draw the point that the user just clicked + else if(drawing && type==1) + { + drawFunction(dc,w); + drawLineToMousePoint(dc,w); + drawPoints(dc,w); + } + else if(drawing && type==1) + { + drawSplineCurve(dc,w); + drawLineToMousePoint(dc,w); + drawPoints(dc,w); + } + else if(show && type==1) + { + drawFunction(dc,w); + drawPoints(dc,w); + } + else if(show && type==2) + { + drawSplineCurve(dc,w); + drawPoints(dc,w); + } + + // Drawing the guides according to real values entered according to the integrated interaction (IS NOT WORKING!!!) + if ( actual ) + { + dc.SetPen(wxPen( wxColour(255,0,0),1,wxDOT )); + int offsetpx = getOffsetPixelsXv(); + int offsetpy = getOffsetPixelsYv(); + + int realX_guide = w.getRealGuideX(); + if( realX_guide!=-1 ) + { + dc.DrawLine( (realX_guide/*-w.getMinScrX()*/-offsetX)*scaleX + offsetpx, 0, (realX_guide/*-w.getMinScrX()*/-offsetX)*scaleX + offsetpx, scrwY); + } + + int realY_guide = w.getRealGuideY(); + if( realY_guide!=-1 ) + { + dc.DrawLine( 0,(realY_guide/*-w.getMinScrY()*/-offsetX)*scaleX + offsetpx, scrwX, (realY_guide/*-w.getMinScrY()*/-offsetX)*scaleX + offsetpx); + } + } + +} + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.h new file mode 100644 index 0000000..f43b0fc --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.h @@ -0,0 +1,257 @@ + +#ifndef __pPlotterLayer_h__ +#define __pPlotterLayer_h__ +// ---------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ---------------------------------------------------------------------------- + +#include +#ifdef __BORLANDC__ +#pragma hdrstop +#endif +#ifndef WX_PRECOMP +#include +#endif + + +//---------------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------------- +#include "mathplot.h" +#include "pFunctionPoint.h" +#include + +#define MAX_POINTS 50 +#define MOVE 5 + + +//using namespace std; +//---------------------------------------------------------------------------- +// Class definition +//---------------------------------------------------------------------------- +class pPlotterLayer: public mpLayer +{ + +public: + /** @param name Label + @param flags Label alignment, pass one of #mpALIGN_NE, #mpALIGN_NW, #mpALIGN_SW, #mpALIGN_SE. + */ + pPlotterLayer(wxString name = wxEmptyString, int flags = mpALIGN_NE); + /* + it define the first point of the polygon for be drawing + returs true if the first and second point of the polygon are setted + */ + bool initializePolygon(wxPoint* points,double x1, double y1,double x2, double y2); + /* + Draw the line from (x1,y1) to (x2,y2) only passing by the + positive points in the line + */ +void draw(wxDC & dc,mpWindow & w,double x1,double y1,double x2,double y2); + + /** + * Draw the function with th spline points + * + */ + void drawSplineCurve(wxDC & dc,mpWindow & w); + + /** + * Draw the line between the last point of the function + * and the position of the mouse + */ + void drawLineToMousePoint(wxDC & dc,mpWindow & w); + /** + * Draw le lines between the points of the function + */ + void drawFunction(wxDC & dc,mpWindow & w); + /** + * Draw the points of the function + */ + void drawPoints(wxDC & dc,mpWindow & w); + + /** + Get the value of the traslation + in the x-axis + */ + virtual int getXTraslation() + { + return -1; + } + /** + Get the type of the curve + 1=normal function + 2=Histogram + */ + virtual int getmType() + { + return -1; + } + /** + * get the maxShowed of the function in x and y + */ + virtual void getMaxShowed(int & maxX, int &maxY) + { + } + /** + * get the minShowed of the function in x and y + */ + virtual void getMinShowed(int & minX, int &minY) + { + } + + /** + Gets the x-offset of the zoom + in pixels + */ + virtual int getOffsetPixelsXv(){return -1;} + + + /** + Gets the Y-offset of the zoom + in pixels + */ + virtual int getOffsetPixelsYv(){ return -1;} + + + /* + returns the xSpline to plotter + */ + virtual std::vector getXSpline() + { + std::vector v; + return v; + } + /* + returns the ySpline to plotter + */ + virtual std::vector getYSpline() + { + std::vector v; + return v; + } + + /** + Get the type of the curve + 1=piecewise functio + 2= smooth + */ + virtual int vGetType() + { return -1;} + + + /** + Get _offsetX and _offsetY + */ + + virtual void getOffsets(int &offsetX,int &offSetY ) + {} + + /* + * Get the factor zoom + */ + virtual void getFactorZoom(float & fz){} + /** + * if the function that is drawing is the actual + */ + virtual void getIfActual(bool &actual){} + + + /** + * get the max of the function in x and y + */ + virtual void getMax(int & maxX, int &maxY){} + + /** + * Get screens of the function + */ + virtual void getScreens(int & scrX, int & scrY){} + + /** + * Set screens value + */ + virtual void setScreens(int scrX,int scrY){} + + /** + * Let us know the scale of the function + */ + virtual void getScales(double & scaleX,double & scaleY){} + + /** + *Rewind the value of node + */ + virtual void Rewind(){} + + /** Get locus value for next N. + Override this function in your implementation. + @param x Returns X value + @param y Returns Y value + */ + virtual bool GetNextXY(double & x, double & y){return false;} + + /** + Get Point list of the funcion + @param return points + */ + virtual void GetPoints(wxList &points){} + + /** Layer plot handler. + This implementation will plot the locus in the visible area and + put a label according to the aligment specified. + */ + virtual void Plot(wxDC & dc, mpWindow & w); + /** + Let us Know if the user want to see the points of the function + of other color than the color of the lines + */ + virtual void ifShowPoints(bool & show){} + + /** + * Let us Know if the user has finished the drawing + * that starts before. + */ + virtual void getDrawing(bool &draw){} + /* + * Gets the point of the mouse where the user is + */ + virtual void getMousePoint(int &x,int &y){} + /** + * this method gets the direction of the drawing + */ + virtual void getDirection(bool &dir){} + /** + * Get the number of points of the function + */ + virtual void getSize(int &size){}; + +protected: + int m_flags; //!< Holds label alignment + /* + * Points of the function thats is drawing + */ + wxList points; + /* + * the scale in x, with wich it must draw + */ + double scaleX; + /* + * the scale in y, with wich it must draw + */ + double scaleY; + + /** + * offset X + */ + int offsetX; + + /** + * offset Y + */ + int offsetY; + + + DECLARE_CLASS (pPlotterLayer) +}; + +#endif + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterScaleX.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterScaleX.cxx new file mode 100644 index 0000000..1f95b6b --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterScaleX.cxx @@ -0,0 +1,103 @@ +//---------------------------------------------------------------------------- +// Class definition include +//---------------------------------------------------------------------------- +#include "pPlotterScaleX.h" + +// ---------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ---------------------------------------------------------------------------- + +#ifndef WX_PRECOMP +#include +#endif + +//---------------------------------------------------------------------------- +// Class implementation +//---------------------------------------------------------------------------- +#define mpLN10 2.3025850929940456840179914546844 + +IMPLEMENT_CLASS(pPlotterScaleX, pPlotterLayer) +//---------------------------------------------------------------------------- +// Methods +//---------------------------------------------------------------------------- +pPlotterScaleX::pPlotterScaleX(wxString aName,int flags) { + + SetName(aName);/* + SetFont(*wxSMALL_FONT); + SetPen(*wxGREY_PEN);*/ + wxFont ff( *wxSMALL_FONT); + wxPen pp( *wxGREY_PEN); + SetPen( pp ); + SetFont( ff ); +} + +void pPlotterScaleX::Plot(wxDC& dc, mpWindow& w) +{ + + int divisions=20; + + + dc.SetPen( m_pen); + dc.SetFont( m_font); + + //data + float min=(float)w.getMinScrX(); + float max=(float)w.getMaxScrX(); + float scrX=(float)w.GetScrX()-100; + double scaleX=(scrX/(max-min))*w.getZoomFactor(); + int offsetpx=w.getOffsetPixelsX(); + int offsetX=w.getOffsetX(); + + //setting origins + const int orgy = w.GetScrY()-40; + const int extend = w.GetScrX()-100; + + dc.SetDeviceOrigin(70,orgy); + dc.SetAxisOrientation(true,true); + + //draw the axe + dc.DrawLine(0,0,(max-min)*scaleX,0); + + //maximum value in x + int d=max-min; + if(d<20) + { + int k=d/divisions; + while(k==0) + { + divisions--; + k=d/divisions; + } + } + float step=(max-min)/divisions; + + //drawing the axe with the numbers + wxString s; + + + //drawing the first line + dc.DrawLine(0,0,0,-10); + s.Printf(_T("%d"),(int)(min)); + dc.DrawText(s,(wxCoord)0,(wxCoord)-20); + + for(float i=0;i<=(max);i+=step) + { + + int p=(i-min-offsetX)*scaleX+offsetpx; + if(p>=0) + { + dc.DrawLine(p,0,p,-10); + s.Printf(_T("%d"),(int)(i)); + dc.DrawText(s,(wxCoord)p,(wxCoord)-20); + } + } + //drawing the last line + int p=(max-min-offsetX)*scaleX+offsetpx; + dc.DrawLine(p,0,p,-10); + s.Printf(_T("%d"),(int)(max)); + dc.DrawText(s,(wxCoord)p,(wxCoord)-20); + +} + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterScaleX.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterScaleX.h new file mode 100644 index 0000000..9623e2f --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterScaleX.h @@ -0,0 +1,49 @@ + +#ifndef __pPlotterScaleX_h__ +#define __pPlotterScaleX_h__ +// ---------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ---------------------------------------------------------------------------- + +#include +#ifdef __BORLANDC__ +#pragma hdrstop +#endif +#ifndef WX_PRECOMP +#include +#endif + +//---------------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------------- + +#include "pPlotterLayer.h" + +//---------------------------------------------------------------------------- +// Class definition +//---------------------------------------------------------------------------- +class pPlotterScaleX: public pPlotterLayer +{ +public: + /** + * This is the constructor of the class + */ + pPlotterScaleX(wxString aName = wxT("X"),int flags = mpALIGN_NE); + /** + * This is how the x-axis draw itself + */ + virtual void Plot(wxDC& dc, mpWindow& w); + /** Check whether this layer has a bounding box. + This implementation returns \a FALSE thus making the ruler invisible + to the plot layer bounding box calculation by mpWindow. + */ + virtual bool HasBBox() { return FALSE; } + + DECLARE_CLASS (pPlotterScaleX) +}; + +#endif + + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.cxx new file mode 100644 index 0000000..96cf2cf --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.cxx @@ -0,0 +1,103 @@ +//---------------------------------------------------------------------------- +// Class definition include +//---------------------------------------------------------------------------- +#include "pPlotterScaleY.h" + +// ---------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ---------------------------------------------------------------------------- + +#ifndef WX_PRECOMP +#include +#endif + +//---------------------------------------------------------------------------- +// Class implementation +//---------------------------------------------------------------------------- + +#define mpLN10 2.3025850929940456840179914546844 + +IMPLEMENT_CLASS(pPlotterScaleY, pPlotterLayer) +//---------------------------------------------------------------------------- +// Methods +//---------------------------------------------------------------------------- +pPlotterScaleY::pPlotterScaleY(wxString aName,int flags) { + + SetName(aName);/* + SetFont(*wxSMALL_FONT); + SetPen(*wxGREY_PEN);*/ + wxFont ff( *wxSMALL_FONT); + wxPen pp( *wxGREY_PEN); + SetPen( pp ); + SetFont( ff ); +} + +void pPlotterScaleY::Plot(wxDC& dc, mpWindow& w) +{ + + int divisions=20; + + dc.SetPen( m_pen); + dc.SetFont( m_font); + + //data + float min= (float)w.getMinScrY(); + float max=(float)w.getMaxScrY(); + float scrY=(float)w.GetScrY()-50; + double scaleY=(scrY/(max-min))*w.getZoomFactor(); + int offsetpy=w.getOffsetPixelsY(); + int offsetY=w.getOffsetY(); + + + //setting origins + const int orgy = w.GetScrY()-40; + const int extend = w.GetScrY()-50; + dc.SetDeviceOrigin(70,orgy); + dc.SetAxisOrientation(true,true); + + //draw the axe + dc.DrawLine( 0,0, 0, (max-min)*scaleY); + + //maximum value in Y + int d=max-min; + if(d<20) + { + int k=d/divisions; + while(k==0) + { + divisions--; + k=d/divisions; + } + } + float step=(max-min)/divisions; + + + //drawing the axe with the numbers + wxString s; + //drawing the first line + dc.DrawLine(0,0,-10,0); + s.Printf(_T("%d"),(int)(min)); + dc.DrawText(s,(wxCoord)-20,(wxCoord)0); + + + for(float i=0;i<=(max);i+=step) + { + + int p=(i-min-offsetY)*scaleY+offsetpy; + if(p>=0) + { + dc.DrawLine(0,p,-10,p); + s.Printf(_T("%d"),(int)(i)); + dc.DrawText(s,(wxCoord)-20,(wxCoord)p); + } + } + //drawing the last line + int p=(max-min-offsetY)*scaleY+offsetpy; + dc.DrawLine(0,p,-10,p); + s.Printf(_T("%d"),(int)(max)); + dc.DrawText(s,(wxCoord)-20,(wxCoord)p); +} + + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.h new file mode 100644 index 0000000..035a8b3 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.h @@ -0,0 +1,50 @@ + +#ifndef __pPlotterScaleY_h__ +#define __pPlotterScaleY_h__ + +// ---------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ---------------------------------------------------------------------------- + +#include +#ifdef __BORLANDC__ +#pragma hdrstop +#endif +#ifndef WX_PRECOMP +#include +#endif + +//---------------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------------- + +#include "pPlotterLayer.h" + +//---------------------------------------------------------------------------- +// Class definition +//---------------------------------------------------------------------------- +class pPlotterScaleY: public pPlotterLayer +{ +public: + /** + * Constructor of the class + */ + pPlotterScaleY(wxString aName = wxT("Y"),int flags = mpALIGN_NE); + + /** + * This is how the y-axis plot itself + */ + virtual void Plot(wxDC& dc, mpWindow& w); + /** Check whether this layer has a bounding box. + This implementation returns \a FALSE thus making the ruler invisible + to the plot layer bounding box calculation by mpWindow. + */ + virtual bool HasBBox() { return FALSE; } + + DECLARE_CLASS (pPlotterScaleY) +}; + +#endif + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx new file mode 100644 index 0000000..57c5e2b --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx @@ -0,0 +1,1856 @@ +//---------------------------------------------------------------------------- +// Class definition include +//---------------------------------------------------------------------------- +#include "pPlotterWindow.h" +#include "MaximumsDialog.h" +#include +#include +#include + +// ---------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ---------------------------------------------------------------------------- + +#ifndef WX_PRECOMP +#include +#endif + +#include "wx/colordlg.h" +//---------------------------------------------------------------------------- +//DECLARING THE NEW EVENT +//wxEVT_TSBAR= event of the two side bar +//---------------------------------------------------------------------------- +BEGIN_DECLARE_EVENT_TYPES() +DECLARE_EVENT_TYPE(wxEVT_PPLOTTER, -1) +DECLARE_EVENT_TYPE(wxEVT_PPLOTTER_CHANGED_FUNCTION, -1) +DECLARE_EVENT_TYPE(wxEVT_PPLOTTER_POINT_MOVE, -1) +DECLARE_EVENT_TYPE(wxEVT_PPLOTTER_POINT_ADD, -1) +DECLARE_EVENT_TYPE(wxEVT_PPLOTTER_POINT_DELETE, -1) +DECLARE_EVENT_TYPE(wxEVT_PPLOTTER_GUIDELINES, -1) +END_DECLARE_EVENT_TYPES() + +//definitions +DEFINE_EVENT_TYPE(wxEVT_PPLOTTER) +DEFINE_EVENT_TYPE(wxEVT_PPLOTTER_CHANGED_FUNCTION) +DEFINE_EVENT_TYPE(wxEVT_PPLOTTER_POINT_MOVE) +DEFINE_EVENT_TYPE(wxEVT_PPLOTTER_POINT_ADD) +DEFINE_EVENT_TYPE(wxEVT_PPLOTTER_POINT_DELETE) +DEFINE_EVENT_TYPE(wxEVT_PPLOTTER_GUIDELINES) + + +//---------------------------------------------------------------------------- +// Class implementation +//---------------------------------------------------------------------------- + +IMPLEMENT_CLASS(pPlotterWindow, mpWindow) + +//---------------------------------------------------------------------------- +// Event Table +//---------------------------------------------------------------------------- + +BEGIN_EVENT_TABLE(pPlotterWindow,mpWindow) +EVT_MOTION (pPlotterWindow::onMouseMove) +EVT_LEFT_DCLICK(pPlotterWindow::onChangeActual) +EVT_LEFT_DOWN(pPlotterWindow::onAddPoint) +EVT_MENU(pwID_DELPOINT, pPlotterWindow::onDeletePoint) +EVT_MENU(pwID_SHOWPOINTS, pPlotterWindow::onShowPoints) +EVT_MENU(pwID_STARTDRAWING, pPlotterWindow::onStartDrawing) +//EVT_MENU(pwID_DELFUNCTION,pPlotterWindow::onDeleteFunction) +EVT_MENU(pwID_STOPDRAWING, pPlotterWindow::onStopDrawing) +EVT_MENU(pwID_ADDNEWPOINT, pPlotterWindow::onAddNewPoint) +EVT_MENU(pwID_NOSHOWPOINTS, pPlotterWindow::onNoShowPoints) +EVT_MENU(pwID_MYZOOMOUT,pPlotterWindow::onMyZoomOut) +EVT_MENU(pwID_MYZOOMIN,pPlotterWindow::onMyZoomIn) +EVT_MENU(pwID_SPLINE,pPlotterWindow::onSplinePoints) +EVT_MENU(pwID_LINE,pPlotterWindow::onLine) +EVT_MENU(pwID_SAVE,pPlotterWindow::onSave) +EVT_MENU(pwID_LOAD,pPlotterWindow::onLoad) +EVT_MENU(pwID_CHANGECOLOR,pPlotterWindow::onChangeColor) +EVT_MENU( mpID_LINE_GUIDES, pPlotterWindow::OnGuideLines) +EVT_MENU( pwID_TRASLATEACTUALFUNCTION, pPlotterWindow::onMoveFunction) +EVT_LEFT_UP(pPlotterWindow::onLeftUp) +END_EVENT_TABLE() + +//---------------------------------------------------------------------------- +// Constructors +//---------------------------------------------------------------------------- + +pPlotterWindow::pPlotterWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flag ) +: mpWindow( parent, id, pos, size, flag) +{ + drawing=false; + movingPointIndex=-1; + actual=NULL; + scaleWay=DEFAULT_SCALE; + zoomFactor=1; + //drawGuideLines=true; + type=DEFAULT_PLOTTER; + drawGuides=false; + movingFunction=false; + initialMovingCLick=-1; + movingPoints=false; + + /* + PopMenu options + */ + m_popmenu.Remove( mpID_ZOOM_IN); + m_popmenu.Remove( mpID_ZOOM_OUT); + m_popmenu.Remove( mpID_CENTER); + m_popmenu.Remove( mpID_FIT); + m_popmenu.Remove( mpID_LOCKASPECT); + + m_popmenu.Append(pwID_STARTDRAWING , _("Start Drawing"), _("Starts to draw a new function"));//it changes the actual function + m_popmenu.Append(pwID_STOPDRAWING , _("Stop drawing"), _("Stops of drawing the new function")); + m_popmenu.Append(pwID_LOAD, _("Load"), _("Load the actual function from a plane file")); + m_popmenu.Append(pwID_SHOWPOINTS , _("Show Points"), _("shows the discrete points of the function")); + m_popmenu.Append(pwID_NOSHOWPOINTS, _("No show Points"), _("Dont show the points of the function")); + m_popmenu.Append(pwID_ADDNEWPOINT, _("Add point"), _("Add New point to the actual function")); + m_popmenu.Append(pwID_DELPOINT , _("Delete point"), _("Deletes a point from the actual function.")); + m_popmenu.Append(pwID_MYZOOMIN, _("Zoom in"), _("Zoom in the points of the function")); + m_popmenu.Append(pwID_MYZOOMOUT, _("Zoom out"), _("Zoom out the points of the function")); + m_popmenu.Append(pwID_SPLINE, _("Smooth"), _("Splines the points ofthe actual curve")); + m_popmenu.Append(pwID_LINE, _("Line"), _("Piecewise the points ofthe actual curve")); + m_popmenu.Append(pwID_SAVE, _("Save"), _("Save the actual function in plane file")); + m_popmenu.Append(pwID_CHANGECOLOR, _("Change Color"), _("Change the color of the function")); + m_popmenu.Append(pwID_TRASLATEACTUALFUNCTION, _("Start Moving Function"), _("Move the actual Function")); + + m_popmenu.Enable(pwID_NOSHOWPOINTS,false); + m_popmenu.Enable(pwID_ADDNEWPOINT,false); + m_popmenu.Enable(pwID_SHOWPOINTS,false); + m_popmenu.Enable(pwID_DELPOINT,false); + m_popmenu.Enable(pwID_STOPDRAWING,false); + m_popmenu.Enable(pwID_MYZOOMIN,false); + m_popmenu.Enable(pwID_MYZOOMOUT,false); + m_popmenu.Enable(pwID_SPLINE,false); + m_popmenu.Enable(pwID_LINE,false); + m_popmenu.Enable(pwID_SAVE,false); + m_popmenu.Enable(pwID_LOAD,true); + m_popmenu.Enable(pwID_CHANGECOLOR,false); + m_popmenu.Enable(pwID_STARTDRAWING,true); + m_popmenu.Enable(pwID_LOAD,true); + //m_popmenu.Enable(pwID_STARTDRAWING,false); + m_popmenu.Enable(mpID_LINE_GUIDES,false); + m_popmenu.Enable(pwID_TRASLATEACTUALFUNCTION,false); + + +} + + +pPlotterWindow::~pPlotterWindow() +{ +} +//---------------------------------------------------------------------------- +// Methods +//---------------------------------------------------------------------------- + +/** +* Sets the actual function +*/ +void pPlotterWindow::setActualFunction(pGraphicalFunction* newActual) +{ + if(actual!=NULL) + actual->setActual(false); + newActual->setActual(true); + actual=newActual; +} + +/** +* Gets the actual function +*/ +pGraphicalFunction* pPlotterWindow:: getActualFunction() +{ + return actual; +} + +/** +* Transform the point clicked from window +* to the real value,given by the scale +* Pre: m_scaleX and m_scaleY are already actualized +* with setActualScales() method +*/ +wxPoint pPlotterWindow:: getRealPoint(wxPoint pixelPoint) +{ + int x,y; + x=pixelPoint.x-70; + y=pixelPoint.y-40; + //real point on the function + wxPoint realPoint; + int xS=(x-offsetPixelX)/m_scaleX + offsetX + minScrX; + int yS=(y-offsetPixelY)/m_scaleY + offsetY + minScrY; + + if(xS<=maxScrX && yS<=maxScrY ) + { + //setActualScales(); + realPoint.x= xS; + realPoint.y= yS; + } + else + { + realPoint.x= -1; + realPoint.y= -1; + } + return realPoint; +} +/* + Set the scales according to the size of the window + and the maximum given by the user +*/ + +void pPlotterWindow::setActualScales() +{ + int maxX,maxY;//,minX,minY; + /* + if the function is drawed interactively the maxX and the + maxY in actual are sets by the user + */ + /* + maxX=actual->getMaxX(); + maxY=actual->getMaxY(); + + int dx=maxX; + int dy=maxY; + + */ + int dx=actual->getMaxXShowed()-actual->getMinXShowed(); + int dy=actual->getMaxYShowed()-actual->getMinYShowed(); + + if(dx!=0 && dy!=0) + { + m_scaleX= (((float)m_scrX-100)/dx)*zoomFactor; + m_scaleY= (((float)m_scrY-50)/dy)*zoomFactor; + } + //setting the maximums and minimums showed in the window + /* + setMaxScrX(maxX); + setMaxScrY(maxY); + */ + setMaxScrX(actual->getMaxXShowed()); + setMinScrX(actual->getMinXShowed()); + setMaxScrY(actual->getMaxYShowed()); + setMinScrY(actual->getMinYShowed()); + actual->setScreens(m_scrX,m_scrY); + actual->setScales(); +} +//------------------------- +// Methods for interaction +//------------------------- + + //------------------------------------ + // Manipulating clicks on the plotter + //------------------------------------- + + + /* + Manipulating clicks on the plotter + */ + void pPlotterWindow::onLeftUp(wxMouseEvent& event) + { + movingPoints=false; + movingPointIndex=-1; + } + + + + //------------------------------- + //Traslating the actual function + //------------------------------- + /* + Move the actual function when the user + is moving the mouse + */ + void pPlotterWindow::onMoveFunction(wxCommandEvent& aEvent) + { + if(movingFunction) + { + movingFunction=false; + m_popmenu.SetLabel(pwID_TRASLATEACTUALFUNCTION, _("Start Moving Function")); + } + else + { + movingFunction=true; + m_popmenu.SetLabel(pwID_TRASLATEACTUALFUNCTION, _("Stop Moving Function")); + } + } + +//----------------------- +// Color Function +//----------------------- + + + /** + * Change the color of the function + */ +void pPlotterWindow::onChangeColor(wxCommandEvent& aEvent) + { + + wxColour colour; + wxColourData data; + wxColourDialog dialog(this, &data); + + if ( dialog.ShowModal() == wxID_OK ) + { + colour = dialog.GetColourData().GetColour(); + } + + wxPen mypen(colour); + mypen.SetWidth(2); + actual->SetPen( mypen); + UpdateAll(); + } + + +//---------------------- +//Persistence +//---------------------- + + + /** + * Load the function from a .txt file + */ + void pPlotterWindow::onLoad(wxCommandEvent& aEvent) + { + + actual=new pGraphicalFunction(wxT("f(x) = function1(x)"),mpALIGN_NE); + actual->setActual(true); + actual->setFromWindow(false); + actual->SetDrawing(drawing); + actual->setFactorZoom(zoomFactor); + + wxPen mypen(*wxRED, 5, wxSOLID); + mypen.SetWidth(2); + actual->SetPen( mypen); + + wxString nameF=wxFileSelector(_T("Save Function")); + actual->load(nameF); + AddLayer(actual); + + functions.Append(actual); + addFunctionToMove(actual); + + m_popmenu.Enable(pwID_STARTDRAWING,true); + + UpdateAll(); + + //------------------------------------------ + //Sending the paarticular event of changed actual function + //------------------------------------------- + wxCommandEvent cevent( wxEVT_PPLOTTER_CHANGED_FUNCTION, GetId() ); + cevent.SetEventObject(this); + GetEventHandler()->ProcessEvent( cevent ); + } + + + /** + * Save the points of the function in a .txt file + */ + void pPlotterWindow::onSave(wxCommandEvent& aEvent) + { + wxString nameF=wxFileSelector(_T("Save Function")); + actual->save(nameF); + } + +//----------------------- +// Spline +//---------------------- +/** +* Spline the points of the actual curve +*/ + +void pPlotterWindow::onSplinePoints(wxCommandEvent& aEvent) +{ + actual->setType(2); + actual->initializeSplines(); + actual->initializeSplineVectors(); + UpdateAll(); + m_popmenu.Enable(pwID_SPLINE,false); + m_popmenu.Enable(pwID_LINE,true); +} + +/** +* Change the type of drawing of the actual function +* to a piecewise function +*/ +void pPlotterWindow::onLine(wxCommandEvent& aEvent) +{ + actual->clearSplineVectors(); + actual->setType(1); + UpdateAll(); + m_popmenu.Enable(pwID_SPLINE,true); + m_popmenu.Enable(pwID_LINE,false); + +} + +//-------------------------- +// Zooming +//--------------------------- + +/** +* Zoom out the functions +*/ +void pPlotterWindow::onMyZoomOut(wxCommandEvent& aEvent) +{ + wxNode* node=functions.GetFirst(); + zoomFactor=zoomFactor*(float)(1/(float)ZOOM_FACTOR); + while(node) + { + pGraphicalFunction* f= (pGraphicalFunction*)node->GetData(); + + f->setScreenX(m_scrX); + f->setScreenY(m_scrY); + + + if(zoomFactor>1.01) + { + f->setOffsets(m_clickedX-70,m_scrY-m_clickedY-40); + f->setFactorZoom(zoomFactor); + } + + else + { + f->setOffsetPixelX(0); + f->setOffsetPixelY(0); + f->setOffsetX(0); + f->setOffsetY(0); + f->setFactorZoom(zoomFactor); + } + + + if(f->getActual()) + { + //TODO: send a event of resize + //setMinScrX(f->getMinXShowed()); + //setMinScrY(f->getMinYShowed()); + setOffsetPixelX(f->getOffsetPixelsX()); + setOffsetPixelY(f->getOffsetPixelsY()); + setOffsetX(f->getOffsetX()); + setOffsetY(f->getOffsetY()); + } + node=node->GetNext(); + } + UpdateAll(); +} +/** +* Zoom in the functions +*/ +void pPlotterWindow::onMyZoomIn(wxCommandEvent& aEvent) +{ + + zoomFactor=zoomFactor*(float)ZOOM_FACTOR; + wxNode* node=functions.GetFirst(); + while(node) + { + pGraphicalFunction* f= (pGraphicalFunction*)node->GetData(); + if(zoomFactor > 1.01) + { + f->setScreenX(m_scrX); + f->setScreenY(m_scrY); + f->setOffsets(m_clickedX-70,m_scrY-m_clickedY-40); + f->setFactorZoom(zoomFactor); + } + else + { + f->setOffsetPixelX(0); + f->setOffsetPixelY(0); + f->setOffsetX(0); + f->setOffsetY(0); + f->setFactorZoom(zoomFactor); + } + if(f->getActual()) + { + //TODO: send an event of resize + //setMinScrX(f->getMinXShowed()); + //setMinScrY(f->getMinYShowed()); + setOffsetPixelX(f->getOffsetPixelsX()); + setOffsetPixelY(f->getOffsetPixelsY()); + setOffsetX(f->getOffsetX()); + setOffsetY(f->getOffsetY()); + + } + + node=node->GetNext(); + } + + UpdateAll(); +} + + +//------------------------- +// Drawing +//------------------------- + + +/** +* Let to the user to start drawing +*/ +void pPlotterWindow::onStartDrawing(wxCommandEvent& aEvent) +{ + + if(actual!=NULL) + { + actual->setActual(false); + if(actual->getShowPoints()) + actual->SetShowPoints(false); + } + m_popmenu.Enable(pwID_NOSHOWPOINTS,false); + m_popmenu.Enable(pwID_ADDNEWPOINT,false); + m_popmenu.Enable(pwID_SHOWPOINTS,false); + m_popmenu.Enable(pwID_DELPOINT,false); + m_popmenu.Enable(pwID_MYZOOMIN,false); + m_popmenu.Enable(pwID_MYZOOMOUT,false); + m_popmenu.Enable(pwID_STARTDRAWING,false); + m_popmenu.Enable(pwID_SPLINE,false); + m_popmenu.Enable(pwID_LINE,false); + m_popmenu.Enable(pwID_STOPDRAWING,true); + m_popmenu.Enable(pwID_SAVE,false); + m_popmenu.Enable(pwID_LOAD,false); + m_popmenu.Enable(pwID_CHANGECOLOR,false); + m_popmenu.Enable(pwID_TRASLATEACTUALFUNCTION,false); + + if(!drawing) + { + drawing=true; + + + actual=new pGraphicalFunction(wxT("f(x) = function1(x)"),mpALIGN_NE); + actual->setActual(true); + actual->setFromWindow(true); + actual->setScaleWay(USER_SCALE); + actual->SetDrawing(drawing); + actual->setFactorZoom(zoomFactor); + + //we change the offsets + setOffsetPixelX(actual->getOffsetPixelsX()); + setOffsetPixelY(actual->getOffsetPixelsY()); + setOffsetX(actual->getOffsetX()); + setOffsetY(actual->getOffsetY()); + + AddLayer(actual); + wxPen mypen(*wxRED, 5, wxSOLID); + mypen.SetWidth(2); + actual->SetPen( mypen); + + /* + int result = wxMessageBox("Do you Want a Smooth Curve?", "Spline Points", wxYES_NO | wxCANCEL); + if(result==wxYES) + { + actual->setType(2); + } + */ + + /**************************************************************************/ + // Setting Maximums + /**************************************************************************/ + + //opening the dialog of maximums + float maxX=0,maxY=0; + MaximumsDialog *dlg=new MaximumsDialog(this,_T("Set Maximums")); + + if(dlg->ShowModal()== wxID_OK ) + { + maxX=dlg->getXValue(); + maxY=dlg->getYValue(); + if(maxX>0 && maxY>0 && actual->getFromWindow()) + { + setMaxScrX(maxX); + setMaxScrY(maxY); + + actual->setMaxX(maxScrX); + actual->setMinX(minScrX); + actual->setMaxY(maxY); + actual->setMinY(0); + + actual->setMinShowedX(0); + actual->setMinShowedY(0); + actual->setMaxShowedX(maxX); + actual->setMaxShowedY(maxY); + + setActualScales(); + } + else if(maxX<0 || maxY<0) + { + wxMessageBox(_T("Both numbers have to be positive, please enter valid numbers"), _T("Error"), + wxOK); + + DelLayer(actual); + actual=NULL; + + m_popmenu.Enable(pwID_NOSHOWPOINTS,false); + m_popmenu.Enable(pwID_ADDNEWPOINT,false); + m_popmenu.Enable(pwID_SHOWPOINTS,false); + m_popmenu.Enable(pwID_DELPOINT,false); + m_popmenu.Enable(pwID_MYZOOMIN,false); + m_popmenu.Enable(pwID_MYZOOMOUT,false); + m_popmenu.Enable(pwID_STARTDRAWING,true); + m_popmenu.Enable(pwID_SPLINE,false); + m_popmenu.Enable(pwID_LINE,false); + m_popmenu.Enable(pwID_STOPDRAWING,false); + m_popmenu.Enable(pwID_SAVE,false); + m_popmenu.Enable(pwID_LOAD,true); + m_popmenu.Enable(pwID_CHANGECOLOR,false); + m_popmenu.Enable(pwID_TRASLATEACTUALFUNCTION,false); + drawing=false; + //actual->SetDrawing(false); + + } + + else if(maxX==0 && maxY==0) + { + actual->setMaxX(100); + actual->setMinX(0); + actual->setMaxY(100); + actual->setMinY(0); + + actual->setMinShowedX(0); + actual->setMinShowedY(0); + actual->setMaxShowedX(100); + actual->setMaxShowedY(100); + + maxScrX=100; + maxScrY=100; + minScrX=0; + minScrY=0; + + setActualScales(); + } + + } + + else if(dlg->ShowModal()== wxID_CANCEL) + { + DelLayer(actual); + actual=NULL; + + m_popmenu.Enable(pwID_NOSHOWPOINTS,false); + m_popmenu.Enable(pwID_ADDNEWPOINT,false); + m_popmenu.Enable(pwID_SHOWPOINTS,false); + m_popmenu.Enable(pwID_DELPOINT,false); + m_popmenu.Enable(pwID_MYZOOMIN,false); + m_popmenu.Enable(pwID_MYZOOMOUT,false); + m_popmenu.Enable(pwID_STARTDRAWING,true); + m_popmenu.Enable(pwID_SPLINE,false); + m_popmenu.Enable(pwID_LINE,false); + m_popmenu.Enable(pwID_STOPDRAWING,false); + m_popmenu.Enable(pwID_SAVE,false); + m_popmenu.Enable(pwID_LOAD,true); + m_popmenu.Enable(pwID_CHANGECOLOR,false); + m_popmenu.Enable(pwID_TRASLATEACTUALFUNCTION,false); + drawing=false; + //actual->SetDrawing(false); + + } + dlg->Destroy(); + if(drawing) + { + //------------------------------------------ + //Sending the paarticular event of changed actual function + //------------------------------------------- + wxCommandEvent cevent( wxEVT_PPLOTTER_CHANGED_FUNCTION, GetId() ); + cevent.SetEventObject(this); + GetEventHandler()->ProcessEvent( cevent ); + } + } + +} +/** +Stop the drawing of the actual function +*/ +void pPlotterWindow::onStopDrawing(wxCommandEvent& aEvent) +{ + drawing=false; + actual->SetDrawing(drawing); + functions.Append(actual); + addFunctionToMove(actual); + m_popmenu.Enable(pwID_ADDNEWPOINT,true); + m_popmenu.Enable(pwID_DELPOINT,true); + m_popmenu.Enable(pwID_SHOWPOINTS,true); + m_popmenu.Enable(pwID_MYZOOMIN,true); + m_popmenu.Enable(pwID_MYZOOMOUT,true); + m_popmenu.Enable(pwID_STARTDRAWING,true); + m_popmenu.Enable(pwID_SPLINE,true); + m_popmenu.Enable(pwID_STOPDRAWING,false); + m_popmenu.Enable(pwID_LINE,false); + m_popmenu.Enable(pwID_CHANGECOLOR,true); + m_popmenu.Enable(pwID_TRASLATEACTUALFUNCTION,true); + + if(actual->getSizePoints()==0||actual->getSizePoints()==1) + { + + m_popmenu.Enable(pwID_ADDNEWPOINT,false); + //functions.DeleteObject(actual); + DelLayer(actual); + actual=NULL; + + } + + UpdateAll(); +} +/** +* The user wants to see the points(given) of the function +*/ +void pPlotterWindow::onShowPoints(wxCommandEvent& aEvent) +{ + actual->SetShowPoints(true); + m_popmenu.Enable(pwID_NOSHOWPOINTS,true); + m_popmenu.Enable(pwID_SHOWPOINTS,false); + UpdateAll(); +} +/** +* The user doesnt want see the points of the function +*/ +void pPlotterWindow::onNoShowPoints(wxCommandEvent& aEvent) +{ + actual->SetShowPoints(false); + m_popmenu.Enable(pwID_NOSHOWPOINTS,false); + m_popmenu.Enable(pwID_SHOWPOINTS,true); + UpdateAll(); +} +/** +* if the user is going to add a point to the function +*/ +void pPlotterWindow::onAddPoint(wxMouseEvent& aEvent) +{ + + wxPoint point=aEvent.GetPosition(); + + point.y=m_scrY-point.y; + wxPoint realPoint=getRealPoint(point); + + bool isAValidPoint=realPoint.x>=0 && realPoint.y>=0; + + if(isAValidPoint && drawing) + { + if(actual->AddPoint(realPoint.x,realPoint.y)) + { + text = wxString::Format(_T("added point ( %d, %d)\n"), realPoint.x, realPoint.y); + + //m_log->AppendText(text); + + //if the function is smooth + if(actual->getType()==2) + { + actual->clearSplineVectors(); + actual->addSplinesPoints(); + actual->initializeSplineVectors(); + } + + UpdateAll(); + } + } + else if(isAValidPoint && !drawing && aEvent.m_shiftDown && actual!=NULL) + { + if(actual->AddNewPoint(realPoint.x,realPoint.y)) + { + text = wxString::Format(_T("added point ( %d, %d)\n"), realPoint.x, realPoint.y); + //if the function is smooth + if(actual->getType()==2) + { + actual->clearSplineVectors(); + actual->addSplinesPoints(); + actual->initializeSplineVectors(); + } + + UpdateAll(); + } + } + //made a click for moving the points + else if(!movingPoints) + { + if(actual) + movingPointIndex=actual->validPointOnFunction(realPoint); + if(movingPointIndex>=0) + movingPoints=true; + } + + //------------------------------------------ + //Sending the event + //------------------------------------------- + wxCommandEvent cevent( wxEVT_PPLOTTER_POINT_ADD, GetId() ); + cevent.SetEventObject(this); + + //------------------------------------------ + //Sending the general event + //------------------------------------------- + wxCommandEvent pevent( wxEVT_PPLOTTER, GetId() ); + pevent.SetEventObject(this); + //send the events + GetEventHandler()->ProcessEvent( cevent ); + GetEventHandler()->ProcessEvent( pevent ); +} + +/** +* Adds a point to the function after the definition of the initial points of the function +* know this point is a point of the function +* +*/ +void pPlotterWindow::onAddNewPoint(wxCommandEvent& aEvent) +{ + wxPoint point; + point.x=m_clickedX; + point.y=m_scrY-m_clickedY; + + wxPoint realPoint=getRealPoint(point); + bool isAValidPoint=realPoint.x>=0 && realPoint.y>=0; + + + if(isAValidPoint && actual->AddNewPoint(realPoint.x,realPoint.y)) + { + text = wxString::Format(_T("added point ( %d, %d)\n"), realPoint.x, realPoint.y); + //if the function is smooth + if(actual->getType()==2) + { + actual->clearSplineVectors(); + actual->addSplinesPoints(); + actual->initializeSplineVectors(); + + } + UpdateAll(); + //------------------------------------------ + //Sending the event + //------------------------------------------- + wxCommandEvent cevent( wxEVT_PPLOTTER_POINT_ADD, GetId() ); + cevent.SetEventObject(this); + + //------------------------------------------ + //Sending the general event + //------------------------------------------- + wxCommandEvent pevent( wxEVT_PPLOTTER, GetId() ); + pevent.SetEventObject(this); + //send the events + GetEventHandler()->ProcessEvent( cevent ); + GetEventHandler()->ProcessEvent( pevent ); + + } +} + +/** +* if the user is going to delete a point of the function +*/ +void pPlotterWindow::onDeletePoint(wxCommandEvent& aEvent) +{ + wxPoint point; + point.x=m_clickedX; + point.y=m_scrY-m_clickedY; + + //actual->setScreenX(m_scrX); + //actual->setScreenY(m_scrY); + + wxPoint realPoint=getRealPoint(point); + + bool isAValidPoint=realPoint.x>=0 && realPoint.y>=0; + + //this method verify a sensible region in every point of actual + int pointIndex=actual->validPointOnFunction(realPoint); + if(isAValidPoint && actual->deletePointAt(pointIndex)) + { + setActualScales(); + if(actual->getSizePoints()==0) + { + //functions.DeleteObject(actual); + //DelLayer(actual); + //actual=NULL; + } + //if the function is smooth + if(actual->getType()==2) + { + actual->clearSplineVectors(); + actual->addSplinesPoints(); + actual->initializeSplineVectors(); + + } + text = wxString::Format(_T("deleted point ( %d, %d)\n"), realPoint.x, realPoint.y); + UpdateAll(); + //------------------------------------------ + //Sending the event + //------------------------------------------- + wxCommandEvent cevent( wxEVT_PPLOTTER_POINT_DELETE, GetId() ); + cevent.SetEventObject(this); + //------------------------------------------ + //Sending the general event + //------------------------------------------- + wxCommandEvent pevent( wxEVT_PPLOTTER, GetId() ); + pevent.SetEventObject(this); + //send the events + GetEventHandler()->ProcessEvent( cevent ); + GetEventHandler()->ProcessEvent( pevent ); + } +} + + +/** +* If the mouse is moving in the plot area +* is because the user is moving a point of the current curve +* the user has to call before show points, to see the points of the +* function +*/ + +void pPlotterWindow::onMouseMove(wxMouseEvent& event) +{ + wxPoint point=event.GetPosition(); + bool change=false; + point.y=m_scrY-point.y; + + wxPoint realPoint=getRealPoint(point); + bool isAValidPoint=realPoint.x>=0 && realPoint.y>=0; + + if(isAValidPoint && !drawing && actual!=NULL && !movingFunction && movingPoints) + { + //never is going to get in + if(movingPointIndex==-1) + { + //this method verify a sensible region in every point of _actualFunction + movingPointIndex=actual->validPointOnFunction(realPoint); + + } + else if(event.LeftIsDown()) + { + + /*if((movingPointIndex-1)>=0 && (movingPointIndex+1)getSizePoints() && actual->getEditable()) + { + wxNode* next= actual->GetPointAt(movingPointIndex+1); + wxNode* before=actual->GetPointAt(movingPointIndex-1); + if(next) + { + pFunctionPoint* np=(pFunctionPoint*)(next->GetData()); + if(np) + { + int n=np->getRealX(); + if(realPoint.x>n) + { + wxPoint p; + p.x=np->getRealX()-1; + p.y=realPoint.y; + change=actual->changePoint(p,movingPointIndex); + if(change) + { + setActualScales(); + + //if the function is smooth + if(actual->getType()==2) + { + actual->clearSplineVectors(); + actual->addSplinesPoints(); + actual->initializeSplineVectors(); + + } + + text = wxString::Format(_T("Moved point ( %d, %d)\n"), p.x, p.y); + UpdateAll(); + //------------------------------------------ + //Sending the particular event + //------------------------------------------- + wxCommandEvent cevent( wxEVT_PPLOTTER_POINT_MOVE, GetId() ); + cevent.SetEventObject(this); + + //------------------------------------------ + //Sending the general event + //------------------------------------------- + wxCommandEvent pevent( wxEVT_PPLOTTER, GetId() ); + pevent.SetEventObject(this); + + //send the events + GetEventHandler()->ProcessEvent( cevent ); + GetEventHandler()->ProcessEvent( pevent ); + } + } + } + } + if(before) + { + pFunctionPoint* bp=(pFunctionPoint*)(before->GetData()); + if(bp) + { + int b=bp->getRealX(); + if(realPoint.xgetRealX()+1; + p.y=realPoint.y; + change=actual->changePoint(p,movingPointIndex); + if(change) + { + setActualScales(); + //if the function is smooth + if(actual->getType()==2) + { + actual->clearSplineVectors(); + actual->addSplinesPoints(); + actual->initializeSplineVectors(); + + } + text = wxString::Format(_T("Moved point ( %d, %d)\n"), p.x, p.y); + UpdateAll(); + //------------------------------------------ + //Sending the particular event + //------------------------------------------- + wxCommandEvent cevent( wxEVT_PPLOTTER_POINT_MOVE, GetId() ); + cevent.SetEventObject(this); + + //------------------------------------------ + //Sending the general event + //------------------------------------------- + wxCommandEvent pevent( wxEVT_PPLOTTER, GetId() ); + pevent.SetEventObject(this); + + //send the events + GetEventHandler()->ProcessEvent( cevent ); + GetEventHandler()->ProcessEvent( pevent ); + } + + } + } + } + } */ + // SIL ******************************************************************* // SIL + if((movingPointIndex-1)>=0 && (movingPointIndex+1)getSizePoints() && actual->getEditable()) + { + change=actual->changePoint(realPoint,movingPointIndex); + } + if(change) + { + setActualScales(); + //if the function is smooth + if(actual->getType()==2) + { + actual->clearSplineVectors(); + actual->addSplinesPoints(); + actual->initializeSplineVectors(); + } + text = wxString::Format(_T("Moved point ( %d, %d)\n"), realPoint.x, realPoint.y); + UpdateAll(); + //------------------------------------------ + //Sending the particular event + //------------------------------------------- + wxCommandEvent cevent( wxEVT_PPLOTTER_POINT_MOVE, GetId() ); + cevent.SetEventObject(this); + + //------------------------------------------ + //Sending the general event + //------------------------------------------- + wxCommandEvent pevent( wxEVT_PPLOTTER, GetId() ); + pevent.SetEventObject(this); + + //send the events + GetEventHandler()->ProcessEvent( cevent ); + GetEventHandler()->ProcessEvent( pevent ); + } + // SIL ******************************************************************* // SIL + + //change the point that is in the index, returns true if could be changed. + if(!change && actual->changePoint(realPoint,movingPointIndex)&& actual->getEditable()) + { + setActualScales(); + //if the function is smooth + if(actual->getType()==2) + { + actual->clearSplineVectors(); + actual->addSplinesPoints(); + actual->initializeSplineVectors(); + + } + text = wxString::Format(_T("Moved point ( %d, %d)\n"), realPoint.x,realPoint.y); + + UpdateAll(); + + //------------------------------------------ + //Sending the particular event + //------------------------------------------- + wxCommandEvent cevent( wxEVT_PPLOTTER_POINT_MOVE, GetId() ); + cevent.SetEventObject(this); + + //------------------------------------------ + //Sending the general event + //------------------------------------------- + wxCommandEvent pevent( wxEVT_PPLOTTER, GetId() ); + pevent.SetEventObject(this); + + //send the events + GetEventHandler()->ProcessEvent( cevent ); + GetEventHandler()->ProcessEvent( pevent ); + } + } + else + { + movingPointIndex=-1; + movingPoints=false; + } + } + //if the user is drawing + else if(isAValidPoint && drawing) + { + + actual->SetMousePoint(realPoint); + UpdateAll(); + } + //is moving the function + else if(isAValidPoint && movingFunction && actual!=NULL) + { + actual->setScreenX(m_scrX); + actual->setScreenY(m_scrY); + int j=0; + if((initialMovingCLick==-1) && event.LeftIsDown() ) + { + if(actual->isInFunction(realPoint.x,realPoint.y)) + { + initialMovingCLick=event.GetPosition().x; + int numPoints=actual->getSizePoints(); + int i=0; + backUpActualVector.clear(); + while(i0 && i< (numPoints-1)) + //{ + wxNode* pointNode=actual->GetPointAt(i); + pFunctionPoint* point= (pFunctionPoint*)pointNode->GetData(); + backUpActualVector.push_back(point->getRealX()); + + //} + i++; + } + } + } + else if(event.LeftIsDown()) + { + wxPoint aux(initialMovingCLick,0); + + wxPoint p1r=getRealPoint(event.GetPosition()); + wxPoint p2r=getRealPoint(aux); + + double delta = p1r.x-p2r.x; + int numPoints=actual->getSizePoints(); + int i=0; + wxPoint p; + if(type==HISTOGRAM) + { + while(i0 && i<(numPoints-1)) + { + wxNode* pointNode=actual->GetPointAt(i); + pFunctionPoint* point= (pFunctionPoint*)pointNode->GetData(); + int xNew=backUpActualVector[i]+delta; + //it has to preserve the state of functin + if(backUpActualVector[0]xNew) + point->setRealX(xNew); + } + i++; + } + } + else + { + i=0; + while(iGetPointAt(i); + pFunctionPoint* point= (pFunctionPoint*)pointNode->GetData(); + int xNew=backUpActualVector[i]+delta; + point->setRealX(xNew); + i++; + } + } + //If is a spline + if(actual->getType()==2) + { + actual->clearSplineVectors(); + actual->addSplinesPoints(); + actual->initializeSplineVectors(); + + } + UpdateAll(); + + } + else + { + initialMovingCLick=-1; + } + + } +} +/** +* if the user give us a double click is because he wants to change +* the actual function to the function that has that point +*/ +void pPlotterWindow::onChangeActual(wxMouseEvent& event) +{ + wxString text = _T("\n points \n"); + + + if(!drawing) + { + //we have to call showpoints before changing the function + wxPoint point=event.GetPosition(); + /*****************************/ + point.y=m_scrY-point.y; + /*****************************/ + + + + //real point on the function + wxPoint realPoint;//=getRealPoint(point); + bool isAValidPoint=realPoint.x>=0 && realPoint.y>=0; + if(isAValidPoint) + { + wxNode * node= functions.GetFirst(); + while (node) + { + pGraphicalFunction* fnode=(pGraphicalFunction*)node->GetData(); + + + int maxX=fnode->getMaxXShowed(); + int maxY=fnode->getMaxYShowed(); + int minX=fnode->getMinXShowed(); + int minY=fnode->getMinYShowed(); + + + /* + float sx=(((float)m_scrX-100)/(maxScrX-minScrX))*zoomFactor; + float sy=(((float)m_scrY-50)/(maxScrY-minScrY))*zoomFactor; + */ + + + float sx=(((float)m_scrX-100)/(maxX-minX))*zoomFactor; + float sy=(((float)m_scrY-50)/(maxY-minY))*zoomFactor; + + + realPoint.x=((point.x-70-fnode->getOffsetPixelsX())/sx)+ fnode->getOffsetX()+ minX; + realPoint.y=((point.y-40-fnode->getOffsetPixelsY())/sy)+ fnode->getOffsetY()+ minY; + /* + LOG + */ + if(fnode->getActual()) + text = wxString::Format(_T("Selected point ( %d, %d)\n"), realPoint.x, realPoint.y); + //m_log->AppendText(text); + + bool hasIt=fnode->isInFunction(realPoint.x,realPoint.y); + /* + if(fnode->getEditable()) + hasIt=fnode->isInFunction(realPoint.x,realPoint.y); + else + hasIt=false; + */ + if(hasIt) + { + if(actual!=fnode) + { + setActualFunction(fnode); + //we change the offsets + setOffsetPixelX(fnode->getOffsetPixelsX()); + setOffsetPixelY(fnode->getOffsetPixelsY()); + setOffsetX(fnode->getOffsetX()); + setOffsetY(fnode->getOffsetY()); + + + setActualScales(); + if(!actual->getFromWindow() && actual->getEditable()||actual->getFromWindow() && actual->getEditable()) + { + m_popmenu.Enable(pwID_ADDNEWPOINT,true); + m_popmenu.Enable(pwID_DELPOINT,true); + if(actual->getShowPoints()) + { + m_popmenu.Enable(pwID_SHOWPOINTS,false); + m_popmenu.Enable(pwID_NOSHOWPOINTS,true); + } + else + { + m_popmenu.Enable(pwID_SHOWPOINTS,true); + m_popmenu.Enable(pwID_NOSHOWPOINTS,false); + } + m_popmenu.Enable(pwID_MYZOOMIN,true); + m_popmenu.Enable(pwID_MYZOOMOUT,true); + if(actual->getType()==2)//Smoothed function + { + m_popmenu.Enable(pwID_SPLINE,false); + m_popmenu.Enable(pwID_LINE,true); + } + else + { + m_popmenu.Enable(pwID_SPLINE,true); + m_popmenu.Enable(pwID_LINE,false); + + } + if(type==2) + { + m_popmenu.Enable(pwID_LOAD,false); + m_popmenu.Enable(pwID_STARTDRAWING,false); + } + else + { + m_popmenu.Enable(pwID_LOAD,true); + m_popmenu.Enable(pwID_STARTDRAWING,true); + } + + m_popmenu.Enable(pwID_SAVE,true); + m_popmenu.Enable(pwID_LOAD,false); + m_popmenu.Enable(pwID_STOPDRAWING,false); + m_popmenu.Enable(pwID_CHANGECOLOR,true); + m_popmenu.Enable(mpID_LINE_GUIDES,true); + m_popmenu.Enable(pwID_TRASLATEACTUALFUNCTION,true); + } + //for the functions that came from data and arent editables + else if(!actual->getFromWindow() && !actual->getEditable()||actual->getFromWindow() && !actual->getEditable()) + { + if(actual->getShowPoints()) + { + m_popmenu.Enable(pwID_SHOWPOINTS,false); + m_popmenu.Enable(pwID_NOSHOWPOINTS,true); + } + else + { + m_popmenu.Enable(pwID_SHOWPOINTS,true); + m_popmenu.Enable(pwID_NOSHOWPOINTS,false); + } + if(actual->getType()==2)//Smoothed function + { + m_popmenu.Enable(pwID_SPLINE,false); + m_popmenu.Enable(pwID_LINE,true); + } + else + { + m_popmenu.Enable(pwID_SPLINE,true); + m_popmenu.Enable(pwID_LINE,false); + + } + if(type==2) + { + m_popmenu.Enable(pwID_LOAD,false); + m_popmenu.Enable(pwID_STARTDRAWING,false); + } + m_popmenu.Enable(pwID_SAVE,false); + m_popmenu.Enable(pwID_LOAD,false); + m_popmenu.Enable(pwID_STOPDRAWING,false); + m_popmenu.Enable(pwID_MYZOOMIN,true); + m_popmenu.Enable(pwID_MYZOOMOUT,true); + m_popmenu.Enable(pwID_CHANGECOLOR,true); + m_popmenu.Enable(mpID_LINE_GUIDES,true); + m_popmenu.Enable(pwID_SAVE,true); + m_popmenu.Enable(pwID_TRASLATEACTUALFUNCTION,true); + + } + //if the function is smooth + if(actual->getType()==2) + { + actual->clearSplineVectors(); + actual->addSplinesPoints(); + actual->initializeSplineVectors(); + + } + + UpdateAll(); + //------------------------------------------ + //Sending the particular event + //------------------------------------------- + wxCommandEvent cevent( wxEVT_PPLOTTER_CHANGED_FUNCTION, GetId() ); + cevent.SetEventObject(this); + + //------------------------------------------ + //Sending the general event + //------------------------------------------- + wxCommandEvent pevent( wxEVT_PPLOTTER, GetId() ); + pevent.SetEventObject(this); + //send the events + GetEventHandler()->ProcessEvent( cevent ); + GetEventHandler()->ProcessEvent( pevent ); + } + } + node=node->GetNext(); + } + } + } + //the user is finishing the drawing of the function + else + { + drawing=false; + functions.Append(actual); + } +} + +/** +* The user wants to change the type of function: line, smooth +* TODO is an extension +*/ +void pPlotterWindow::changeFuntionType(int aTheType, bool aForAll) +{ + +} +//------------------------------------------ +//If the data doesnt come from interaction +//------------------------------------------- +/** +* Add a function to the window, given its points +*/ +int pPlotterWindow:: addFunction(pGraphicalFunction * function) +{ + if(function->getType()==2) + { + function->initializeSplines(); + function->initializeSplineVectors(); + UpdateAll(); + } + bool added1=functions.Append(function)!=NULL; + int id=functions.IndexOf(function); + bool added2=AddLayer(function); + UpdateAll(); + return id;//added1 && added2; +} +/** +* Delete a point of a function +* @param point: is the real value that the functon takes, and is gointg to be deleted +*/ + +bool pPlotterWindow::DeletePointFunction(pGraphicalFunction* function,wxPoint point) +{ + + wxNode* node= functions.GetFirst(); + while(node) + { + pGraphicalFunction* f= (pGraphicalFunction*)node->GetData(); + if(f==function) + { + return function->DeletePoint(point.x,point.y); + } + node=node->GetNext(); + } + return false; +} +/** +* Delete a function of the plotter +*/ +bool pPlotterWindow::deleteFunction(pGraphicalFunction * f) +{ + functions.DeleteObject(f); + functionsToMove.DeleteObject(f); + return true; +} +/** +* Creates and returns a graphical funcion according to the indicated vectors. +*/ +pGraphicalFunction * pPlotterWindow::getFunctionForVectors( std::vector *vectorX, std::vector *vectorY ) +{ + double coordX = -1 ; + double coordY = -1; + + pGraphicalFunction * ff = new pGraphicalFunction( _T(" "), 1); + + int i=0; + int sizeX = vectorX->size(); + int sizeY = vectorY->size(); + if( sizeX == sizeY ) + { + while ( i < sizeX ) + { + coordX = (*vectorX)[i]; + coordY = (*vectorY)[i]; + ff -> AddPoint( coordX, coordY); + i++; + } + } + + InitFunctionForVectors( ff ); + return ff; +} + +pGraphicalFunction * pPlotterWindow::getFunctionForVectors( double * vectorX, int sizeX, double * vectorY, int sizeY ) +{ + double coordX = -1 ; + double coordY = -1; + + pGraphicalFunction * ff = new pGraphicalFunction( _T(" "), 1); + + /*wxString text = "\n Including points from two vectors \n"; + m_log->AppendText(text);*/ + + int i=0; + if(sizeX == sizeY) + { + while ( i < sizeX ) + { + coordX = *vectorX; + coordY = *vectorY; + ff -> AddPoint( coordX, coordY); + /* text = wxString::Format("Included point ( %d, %d)\n", coordX, coordY); + m_log->AppendText(text);*/ + + vectorX++; + vectorY++; + i++; + } + } + + InitFunctionForVectors( ff ); + return ff; +} + + + +void pPlotterWindow::InitFunctionForVectors( pGraphicalFunction *ff ) +{ + int maxX,maxY,minX,minY; + /* + if the function is not drawed interactively the maxX and the + maxY are the from the points of the function + */ + maxX=ff->getMaxX(); + maxY=ff->getMaxY(); + minX= ff->getMinX(); + minY= ff->getMinY(); + + + ff->setMinShowedX(minX); + ff->setMinShowedY(minY); + ff->setMaxShowedX(maxX); + ff->setMaxShowedY(maxY); + + GetClientSize(&m_scrX,&m_scrY); + //set + + if((maxX-minX)!=0 && (maxY-minY)!=0) + { + m_scaleX= ((float)m_scrX-100)/(maxX-minX); + m_scaleY= ((float)m_scrY-50)/(maxY-minY); + } + maxScrX=maxX; + maxScrY=maxY; + minScrX=minX; + minScrY=minY; + + + if(type==HISTOGRAM) + { + actual=ff; + setActualScales(); + m_popmenu.Enable(pwID_NOSHOWPOINTS,true); + m_popmenu.Enable(pwID_ADDNEWPOINT,true); + m_popmenu.Enable(pwID_SHOWPOINTS,false); + m_popmenu.Enable(pwID_DELPOINT,true); + //m_popmenu.Enable(pwID_SPLINE,false); + //m_popmenu.Enable(pwID_LINE,true); + m_popmenu.Enable(pwID_SAVE,true); + m_popmenu.Enable(pwID_LOAD,false); + m_popmenu.Enable(pwID_CHANGECOLOR,true); + //m_popmenu.Enable(pwID_STARTDRAWING,false); + m_popmenu.Enable(mpID_LINE_GUIDES,true); + m_popmenu.Enable(pwID_TRASLATEACTUALFUNCTION,true); + //------------------------------------------ + //Sending the paarticular event of changed actual function + //------------------------------------------- + wxCommandEvent cevent( wxEVT_PPLOTTER_CHANGED_FUNCTION, GetId() ); + cevent.SetEventObject(this); + GetEventHandler()->ProcessEvent( cevent ); + } + + /* + maxScrX=100; + minScrX=50; + offsetX=50; + ff->setOffsetX(50); + */ + //actual->setScreens(scrX,scrY); + //actual->setScales(); + //setActualScales(); +} +/* +bool pPlotterWindow::AddFunction(wxPoint realPoints[],int numberOfPoints,wxString name,int flags) +{ +pGraphicalFunction* function= new pGraphicalFunction(name,flags); + +for(int i= 0; iAddPoint(x,y); +if(!added ) +return added; +} +functions.Append(function); +bool addL=mpWindow::AddLayer(function); +if(addL) +{ +mpWindow::UpdateAll(); +} +return addL; +} +*/ + +/* +* Actualizes the view range of the plotter and the actual function +* @param newMinX Is the min-value to be shown in the x-scale +* @param newMaxX Is the max-value to be shown in the x-scale +*/ +/* +DEPRECATED +*/ +void pPlotterWindow :: actualizeViewRange(int newMinX, int newMaxX) +{ + int minPixX,maxPixX,min,max; + double sx; + /* + getiing pixels + */ + int dx=newMaxX-newMinX; + + if(dx!=0) + { + sx= (((float)m_scrX-100)/dx)*zoomFactor; + } + + minPixX=newMinX*sx; + maxPixX=newMaxX*sx; + + //vx.at(i)-offsetX)*scaleX+offsetpx + if(minScrX!=newMinX) + { + setOffsetX(newMinX); + setMinScrX(newMinX); + actual->setOffsetX(newMinX); + actual->setMinShowedX(newMinX); + /* + wxNode * node= functions.GetFirst(); + while (node) + { + pGraphicalFunction* fnode=(pGraphicalFunction*)node->GetData(); + if(fnode) + { + if(!fnode->getActual()) + { + fnode->setScreens(m_scrX,m_scrY); + fnode->setScales(); + //max=minPixX/fnode->getScaleX(); + min=minPixX/fnode->getScaleX(); + fnode->setOffsetX(min); + fnode->setMinShowedX(min); + + } + } + node=node->GetNext(); + } + */ + + } + if(maxScrX!=newMaxX) + { + setMaxScrX(newMaxX); + actual->setMaxShowedX(newMaxX); + /* + wxNode * node= functions.GetFirst(); + while (node) + { + + pGraphicalFunction* fnode=(pGraphicalFunction*)node->GetData(); + if(fnode) + { + if(!fnode->getActual()) + { + fnode->setScreens(m_scrX,m_scrY); + fnode->setScales(); + max=maxPixX/fnode->getScaleX(); + //min=maxPixX/fnode->getScaleX(); + //fnode->setOffsetX(max); + //fnode->setMinShowedX(min); + fnode->setMaxShowedX(max); + } + } + + node=node->GetNext(); + } + */ + } + /* + if(actual->getMinXShowed()!=actual->getMinX() || actual->getMinYShowed()!=actual->getMinY()|| + actual->getMaxXShowed()!=actual->getMaxX() || actual->getMaxYShowed()!=actual->getMaxY()) + { + m_popmenu.Enable(pwID_MYZOOMIN,false); + m_popmenu.Enable(pwID_MYZOOMOUT,false); + } + else if(actual->getMinXShowed()==actual->getMinX() && actual->getMaxXShowed()==actual->getMaxX()) + { + + m_popmenu.Enable(pwID_MYZOOMIN,true); + m_popmenu.Enable(pwID_MYZOOMOUT,true); + } + */ + + UpdateAll(); +} +/* +* Guide lines menu handler method that reacts to the mpID_LINE_GUIDES cimmand event +* event The corresponding event to handle +*/ +void pPlotterWindow :: OnGuideLines (wxCommandEvent &event) +{ + wxString nextAction_text; + if( drawGuides ) + { + setLineGuidesCondition(false); +// nextAction_text << "Turn on guide lines"; + nextAction_text = _T("Turn on guide lines"); + UpdateAll(); + } + else + { + setLineGuidesCondition(true); +// nextAction_text << "Turn off guide lines"; + nextAction_text = _T("Turn off guide lines"); + UpdateAll(); + } + //------------------------------------------ + //Sending the paarticular event of changed actual function + //------------------------------------------- + wxCommandEvent cevent( wxEVT_PPLOTTER_GUIDELINES, GetId() ); + cevent.SetEventObject(this); + GetEventHandler()->ProcessEvent( cevent ); + + //SETTING LABEL + m_popmenu.SetLabel ( mpID_LINE_GUIDES, nextAction_text ); +} +/* + Get a function in the plotter given the index +*/ +pGraphicalFunction* pPlotterWindow::getFunction(int index) +{ + wxNode* node=functions.Item(index); + return (pGraphicalFunction*)node->GetData(); +} +/* + move the functions that the user wants to move + and that were setted in functionsToMove + @param porcentageMinX:the porcentage that the minShowed + of the funcntions have to be move + 0<=porcentageMinX<=1 + @param porcentageMaxX:the porcentage that the maxShowed + of the funcntions have to be move + 0<=porcentageMaxX<=1 + + */ + +void pPlotterWindow::moveFunctions( float porcentageMinX,float porcentageMaxX) + { + //Adding the actual function + + //functionsToMove.Append(actual); + + // + //float minShowed,maxShowed,fMaxXShowed,fMinXShowed; + float x,y; + + + int minShowed,maxShowed,fMaxXShowed,fMinXShowed; + wxNode* fnode=functionsToMove.GetFirst(); + while(fnode) + { + pGraphicalFunction* fg=(pGraphicalFunction*)fnode->GetData(); + x=porcentageMaxX*(fg->getMaxX()-fg->getMinX()); + y=porcentageMinX*(fg->getMaxX()-fg->getMinX()); + + maxShowed=fg->getMinX()+ x; + minShowed=fg->getMinX()+ y; + + fMinXShowed=fg->getMinXShowed(); + fMaxXShowed=fg->getMaxXShowed(); + + if(fMinXShowed!=minShowed) + { + if(fg->getActual()) + { + setOffsetX(minShowed); + setMinScrX(minShowed); + } + fg->setOffsetX(minShowed); + fg->setMinShowedX(minShowed); + } + if(fMaxXShowed!=maxShowed) + { + if(fg->getActual()) + { + setMaxScrX(maxShowed); + } + fg->setMaxShowedX(maxShowed); + } + if(fg->getActual()&& (fg->getMinXShowed()!=fg->getMinX() || fg->getMinYShowed()!=fg->getMinY()|| + fg->getMaxXShowed()!=fg->getMaxX() || fg->getMaxYShowed()!=fg->getMaxY())) + { + if(type!=HISTOGRAM) + { + m_popmenu.Enable(pwID_MYZOOMIN,false); + m_popmenu.Enable(pwID_MYZOOMOUT,false); + } + } + else if(fg->getActual()&& fg->getMinXShowed()==fg->getMinX() && fg->getMaxXShowed()==fg->getMaxX()) + { + if(type!=HISTOGRAM) + { + m_popmenu.Enable(pwID_MYZOOMIN,true); + m_popmenu.Enable(pwID_MYZOOMOUT,true); + } + } + + + fnode=fnode->GetNext(); + } +} + +/* + adds a function such that when the min or max of the bar + changes it is going to that function +*/ +int pPlotterWindow::addFunctionToMove(pGraphicalFunction *function) +{ + bool added1=functionsToMove.Append(function)!=NULL; + int id=functionsToMove.IndexOf(function); + UpdateAll(); + return id; +} +//---------------------------- +//Handling Options Menu +//---------------------------- +void pPlotterWindow::setPopUpMenu(bool startD,bool stopD,bool smooth,bool line, bool zoomIn, + bool zoomOut,bool showPoints,bool noShowPoints,bool changeColor, bool addP, + bool delPoint,bool load,bool save) +{ + /* + pwID_ADDPOINT = 2010, //!< add a point to the function + pwID_DELPOINT, //!< delete a point of the function + pwID_SHOWPOINTS, //!. +// ---------------------------------------------------------------------------- + +#include +#ifdef __BORLANDC__ +#pragma hdrstop +#endif +#ifndef WX_PRECOMP +#include +#endif + +//---------------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------------- + + +#include "pPlotterLayer.h" +#include "pGraphicalFunction.h" +#include "mathplot.h" + + + +/** Command IDs used by pPlotterWindow */ +enum +{ + pwID_ADDPOINT = 2010, //!< add a point to the function + pwID_DELPOINT, //!< delete a point of the function + pwID_SHOWPOINTS, //! *vectorX, std::vector *vectorY ); + + /* + Set the scales according to the size of the window + and the maximum given by the user + */ + + void setActualScales(); + + + + //erase + + void setmLog(wxTextCtrl *m_log1) + { + m_log=m_log1; + } + + /* + * Actualizes the view range of the plotter and the actual function + * @param newMinX Is the min-value to be shown in the x-scale + * @param newMaxX Is the max-value to be shown in the x-scale + */ + void actualizeViewRange(int newMinX, int newMaxX); + + /* + * Sets the condition for drawing or not the guide lines + * @param ifDrawing The new condition to assing + */ + void setLineGuidesCondition(bool ifDrawing) + { + drawGuides = ifDrawing; + } + + + /* + * Gets the condition for drawing or not the guide lines + * @retval drawGuides The assigned condition + */ + bool drawGuideLines() + { + return drawGuides; + } + /* + * Guide lines menu handler method that reacts to the mpID_LINE_GUIDES cimmand event + * event The corresponding event to handle + */ + void OnGuideLines (wxCommandEvent &event); + + /* + writes in t information + */ + void writeInText(wxString &t) + { + t=text; + } + + /* + Get a function in the plotter given the index + */ + pGraphicalFunction* getFunction(int index); + + /* + move the functions that the user wants to move + and that were setted in functionsToMove + @param porcentageMinX:the porcentage that the minShowed + of the funcntions have to be move + @param porcentageMaxX:the porcentage that the maxShowed + of the funcntions have to be move + + */ + void moveFunctions(float porcentageMinX,float porcentageMaxX); +/** + * Add a function to the plotter + * when the function doesnt come from window + */ + int addFunctionToMove(pGraphicalFunction * function); + + +private: + + /** + * Actual Function + */ + pGraphicalFunction* actual; + /** + * layers + */ + wxList functions; + + /** + * If is drawing the function + */ + bool drawing; + /** + * Index of the movig point, if the user is moving + * a poit + */ + int movingPointIndex; + + /** + * the way we scale + DEFAULT_SCALE 1 + MAX_SCALE 2 + USER_SCALE 3 + */ + int scaleWay; + + + /* + Use to Show Information + */ + + wxTextCtrl *m_log; + wxString text; + + /* + Functions to be move at the same time + */ + wxList functionsToMove; + /* + the user is moving the function + */ + bool movingFunction; + /* + */ + int initialMovingCLick; + + /* + saving the initial function + */ + std::vector backUpActualVector; + /* + wants to move the points of the function + */ + bool movingPoints; + + DECLARE_CLASS (pPlotterWindow) + //---------------------------------------------------------------------------- + // wxWidget macro use declaration for handdling events + //---------------------------------------------------------------------------- + DECLARE_EVENT_TABLE() +}; + +#endif + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/area.xpm b/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/area.xpm new file mode 100644 index 0000000..f3e6861 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/area.xpm @@ -0,0 +1,297 @@ +/* XPM */ +static char * area_xpm[] = { +"37 37 257 2", +" c None", +". c #000000", +"+ c #800000", +"@ c #008000", +"# c #808000", +"$ c #000080", +"% c #800080", +"& c #008080", +"* c #C0C0C0", +"= c #C0DCC0", +"- c #A6CAF0", +"; c #000000", +"> c #00002A", +", c #000055", +"' c #00007F", +") c #0000AA", +"! c #0000D4", +"~ c #002A00", +"{ c #002A2A", +"] c #002A55", +"^ c #002A7F", +"/ c #002AAA", +"( c #002AD4", +"_ c #005500", +": c #00552A", +"< c #005555", +"[ c #00557F", +"} c #0055AA", +"| c #0055D4", +"1 c #007F00", +"2 c #007F2A", +"3 c #007F55", +"4 c #007F7F", +"5 c #007FAA", +"6 c #007FD4", +"7 c #00AA00", +"8 c #00AA2A", +"9 c #00AA55", +"0 c #00AA7F", +"a c #00AAAA", +"b c #00AAD4", +"c c #00D400", +"d c #00D42A", +"e c #00D455", +"f c #00D47F", +"g c #00D4AA", +"h c #00D4D4", +"i c #2A0000", +"j c #2A002A", +"k c #2A0055", +"l c #2A007F", +"m c #2A00AA", +"n c #2A00D4", +"o c #2A2A00", +"p c #2A2A2A", +"q c #2A2A55", +"r c #2A2A7F", +"s c #2A2AAA", +"t c #2A2AD4", +"u c #2A5500", +"v c #2A552A", +"w c #2A5555", +"x c #2A557F", +"y c #2A55AA", +"z c #2A55D4", +"A c #2A7F00", +"B c #2A7F2A", +"C c #2A7F55", +"D c #2A7F7F", +"E c #2A7FAA", +"F c #2A7FD4", +"G c #2AAA00", +"H c #2AAA2A", +"I c #2AAA55", +"J c #2AAA7F", +"K c #2AAAAA", +"L c #2AAAD4", +"M c #2AD400", +"N c #2AD42A", +"O c #2AD455", +"P c #2AD47F", +"Q c #2AD4AA", +"R c #2AD4D4", +"S c #550000", +"T c #55002A", +"U c #550055", +"V c #55007F", +"W c #5500AA", +"X c #5500D4", +"Y c #552A00", +"Z c #552A2A", +"` c #552A55", +" . c #552A7F", +".. c #552AAA", +"+. c #552AD4", +"@. c #555500", +"#. c #55552A", +"$. c #555555", +"%. c #55557F", +"&. c #5555AA", +"*. c #5555D4", +"=. c #557F00", +"-. c #557F2A", +";. c #557F55", +">. c #557F7F", +",. c #557FAA", +"'. c #557FD4", +"). c #55AA00", +"!. c #55AA2A", +"~. c #55AA55", +"{. c #55AA7F", +"]. c #55AAAA", +"^. c #55AAD4", +"/. c #55D400", +"(. c #55D42A", +"_. c #55D455", +":. c #55D47F", +"<. c #55D4AA", +"[. c #55D4D4", +"}. c #7F0000", +"|. c #7F002A", +"1. c #7F0055", +"2. c #7F007F", +"3. c #7F00AA", +"4. c #7F00D4", +"5. c #7F2A00", +"6. c #7F2A2A", +"7. c #7F2A55", +"8. c #7F2A7F", +"9. c #7F2AAA", +"0. c #7F2AD4", +"a. c #7F5500", +"b. c #7F552A", +"c. c #7F5555", +"d. c #7F557F", +"e. c #7F55AA", +"f. c #7F55D4", +"g. c #7F7F00", +"h. c #7F7F2A", +"i. c #7F7F55", +"j. c #7F7F7F", +"k. c #7F7FAA", +"l. c #7F7FD4", +"m. c #7FAA00", +"n. c #7FAA2A", +"o. c #7FAA55", +"p. c #7FAA7F", +"q. c #7FAAAA", +"r. c #7FAAD4", +"s. c #7FD400", +"t. c #7FD42A", +"u. c #7FD455", +"v. c #7FD47F", +"w. c #7FD4AA", +"x. c #7FD4D4", +"y. c #AA0000", +"z. c #AA002A", +"A. c #AA0055", +"B. c #AA007F", +"C. c #AA00AA", +"D. c #AA00D4", +"E. c #AA2A00", +"F. c #AA2A2A", +"G. c #AA2A55", +"H. c #AA2A7F", +"I. c #AA2AAA", +"J. c #AA2AD4", +"K. c #AA5500", +"L. c #AA552A", +"M. c #AA5555", +"N. c #AA557F", +"O. c #AA55AA", +"P. c #AA55D4", +"Q. c #AA7F00", +"R. c #AA7F2A", +"S. c #AA7F55", +"T. c #AA7F7F", +"U. c #AA7FAA", +"V. c #AA7FD4", +"W. c #AAAA00", +"X. c #AAAA2A", +"Y. c #AAAA55", +"Z. c #AAAA7F", +"`. c #AAAAAA", +" + c #AAAAD4", +".+ c #AAD400", +"++ c #AAD42A", +"@+ c #AAD455", +"#+ c #AAD47F", +"$+ c #AAD4AA", +"%+ c #AAD4D4", +"&+ c #D40000", +"*+ c #D4002A", +"=+ c #D40055", +"-+ c #D4007F", +";+ c #D400AA", +">+ c #D400D4", +",+ c #D42A00", +"'+ c #D42A2A", +")+ c #D42A55", +"!+ c #D42A7F", +"~+ c #D42AAA", +"{+ c #D42AD4", +"]+ c #D45500", +"^+ c #D4552A", +"/+ c #D45555", +"(+ c #D4557F", +"_+ c #D455AA", +":+ c #D455D4", +"<+ c #D47F00", +"[+ c #D47F2A", +"}+ c #D47F55", +"|+ c #D47F7F", +"1+ c #D47FAA", +"2+ c #D47FD4", +"3+ c #D4AA00", +"4+ c #D4AA2A", +"5+ c #D4AA55", +"6+ c #D4AA7F", +"7+ c #D4AAAA", +"8+ c #D4AAD4", +"9+ c #D4D400", +"0+ c #D4D42A", +"a+ c #D4D455", +"b+ c #D4D47F", +"c+ c #D4D4AA", +"d+ c #D4D4D4", +"e+ c #000000", +"f+ c #0C0C0C", +"g+ c #191919", +"h+ c #262626", +"i+ c #333333", +"j+ c #3F3F3F", +"k+ c #4C4C4C", +"l+ c #595959", +"m+ c #666666", +"n+ c #727272", +"o+ c #7F7F7F", +"p+ c #8C8C8C", +"q+ c #999999", +"r+ c #A5A5A5", +"s+ c #B2B2B2", +"t+ c #BFBFBF", +"u+ c #CCCCCC", +"v+ c #D8D8D8", +"w+ c #E5E5E5", +"x+ c #F2F2F2", +"y+ c #FFFBF0", +"z+ c #A0A0A4", +"A+ c #808080", +"B+ c #FF0000", +"C+ c #00FF00", +"D+ c #FFFF00", +"E+ c #0000FF", +"F+ c #FF00FF", +"G+ c #00FFFF", +"H+ c #FFFFFF", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * B+B+B+* * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * B+* * B+* * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * B+B+B+* * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * B+* * B+* * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * B+* * B+* * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * $ $ $ $ $ $ $ $ * * $ * * * * $ $ $ * * * * $ * * * * * * * * * * ", +"* * * * * * * $ * * * * * $ * * $ $ $ * * * $ $ $ * * $ * * * * * * * * * ", +"* * * * * * * $ * * * * $ * * $ * * * * * * * * * $ * * $ * * * * * * * * ", +"* * * * * * * $ * * * $ * * $ * * * * * * * * * * * $ * * $ * * * * * * * ", +"* * * * * * * $ * * $ * * $ * * * * * * * * * * * * * $ * * $ * * * * * * ", +"* * * * * * * $ * * $ * * $ * * * * * * * * * * * * * $ * * $ * * * * * * ", +"* * * * * * * $ * * $ * * $ * * * * * * * * * * * * * $ * * $ * * * * * * ", +"* * * * * * * $ * * * $ * * $ * * * * * * * * * * * $ * * $ * * * * * * * ", +"* * * * * * * $ * * * * $ * * $ * * * * * * * * * $ * * $ * * * * * * * * ", +"* * * * $ $ $ $ $ $ $ $ * $ * $ $ $ $ * * * $ $ $ * * $ * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * $ $ $ * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ * * * * * ", +"* * * * * $ H+H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+H+$ * * * * * ", +"* * * * * $ H+H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+H+$ * * * * * ", +"* * * * * $ H+H+H+H+H+H+$ H+H+H+H+H+$ H+H+H+H+H+$ H+H+H+H+H+H+$ * * * * * ", +"* * * * * $ H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+$ * * * * * ", +"* * * * * $ H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+$ * * * * * ", +"* * * * * $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "}; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/bright.xpm b/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/bright.xpm new file mode 100644 index 0000000..855ecdd --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/bright.xpm @@ -0,0 +1,310 @@ +/* XPM */ +static char * bright_xpm[] = { +"36 50 257 2", +" c None", +". c #000000", +"+ c #000033", +"@ c #000066", +"# c #000099", +"$ c #0000CC", +"% c #0000FF", +"& c #330000", +"* c #330033", +"= c #330066", +"- c #330099", +"; c #3300CC", +"> c #3300FF", +", c #660000", +"' c #660033", +") c #660066", +"! c #660099", +"~ c #6600CC", +"{ c #6600FF", +"] c #990000", +"^ c #990033", +"/ c #990066", +"( c #990099", +"_ c #9900CC", +": c #9900FF", +"< c #CC0000", +"[ c #CC0033", +"} c #CC0066", +"| c #CC0099", +"1 c #CC00CC", +"2 c #CC00FF", +"3 c #FF0000", +"4 c #FF0033", +"5 c #FF0066", +"6 c #FF0099", +"7 c #FF00CC", +"8 c #FF00FF", +"9 c #003300", +"0 c #003333", +"a c #003366", +"b c #003399", +"c c #0033CC", +"d c #0033FF", +"e c #333300", +"f c #333333", +"g c #333366", +"h c #333399", +"i c #3333CC", +"j c #3333FF", +"k c #663300", +"l c #663333", +"m c #663366", +"n c #663399", +"o c #6633CC", +"p c #6633FF", +"q c #993300", +"r c #993333", +"s c #993366", +"t c #993399", +"u c #9933CC", +"v c #9933FF", +"w c #CC3300", +"x c #CC3333", +"y c #CC3366", +"z c #CC3399", +"A c #CC33CC", +"B c #CC33FF", +"C c #FF3300", +"D c #FF3333", +"E c #FF3366", +"F c #FF3399", +"G c #FF33CC", +"H c #FF33FF", +"I c #006600", +"J c #006633", +"K c #006666", +"L c #006699", +"M c #0066CC", +"N c #0066FF", +"O c #336600", +"P c #336633", +"Q c #336666", +"R c #336699", +"S c #3366CC", +"T c #3366FF", +"U c #666600", +"V c #666633", +"W c #666666", +"X c #666699", +"Y c #6666CC", +"Z c #6666FF", +"` c #996600", +" . c #996633", +".. c #996666", +"+. c #996699", +"@. c #9966CC", +"#. c #9966FF", +"$. c #CC6600", +"%. c #CC6633", +"&. c #CC6666", +"*. c #CC6699", +"=. c #CC66CC", +"-. c #CC66FF", +";. c #FF6600", +">. c #FF6633", +",. c #FF6666", +"'. c #FF6699", +"). c #FF66CC", +"!. c #FF66FF", +"~. c #009900", +"{. c #009933", +"]. c #009966", +"^. c #009999", +"/. c #0099CC", +"(. c #0099FF", +"_. c #339900", +":. c #339933", +"<. c #339966", +"[. c #339999", +"}. c #3399CC", +"|. c #3399FF", +"1. c #669900", +"2. c #669933", +"3. c #669966", +"4. c #669999", +"5. c #6699CC", +"6. c #6699FF", +"7. c #999900", +"8. c #999933", +"9. c #999966", +"0. c #999999", +"a. c #9999CC", +"b. c #9999FF", +"c. c #CC9900", +"d. c #CC9933", +"e. c #CC9966", +"f. c #CC9999", +"g. c #CC99CC", +"h. c #CC99FF", +"i. c #FF9900", +"j. c #FF9933", +"k. c #FF9966", +"l. c #FF9999", +"m. c #FF99CC", +"n. c #FF99FF", +"o. c #00CC00", +"p. c #00CC33", +"q. c #00CC66", +"r. c #00CC99", +"s. c #00CCCC", +"t. c #00CCFF", +"u. c #33CC00", +"v. c #33CC33", +"w. c #33CC66", +"x. c #33CC99", +"y. c #33CCCC", +"z. c #33CCFF", +"A. c #66CC00", +"B. c #66CC33", +"C. c #66CC66", +"D. c #66CC99", +"E. c #66CCCC", +"F. c #66CCFF", +"G. c #99CC00", +"H. c #99CC33", +"I. c #99CC66", +"J. c #99CC99", +"K. c #99CCCC", +"L. c #99CCFF", +"M. c #CCCC00", +"N. c #CCCC33", +"O. c #CCCC66", +"P. c #CCCC99", +"Q. c #CCCCCC", +"R. c #CCCCFF", +"S. c #FFCC00", +"T. c #FFCC33", +"U. c #FFCC66", +"V. c #FFCC99", +"W. c #FFCCCC", +"X. c #FFCCFF", +"Y. c #00FF00", +"Z. c #00FF33", +"`. c #00FF66", +" + c #00FF99", +".+ c #00FFCC", +"++ c #00FFFF", +"@+ c #33FF00", +"#+ c #33FF33", +"$+ c #33FF66", +"%+ c #33FF99", +"&+ c #33FFCC", +"*+ c #33FFFF", +"=+ c #66FF00", +"-+ c #66FF33", +";+ c #66FF66", +">+ c #66FF99", +",+ c #66FFCC", +"'+ c #66FFFF", +")+ c #99FF00", +"!+ c #99FF33", +"~+ c #99FF66", +"{+ c #99FF99", +"]+ c #99FFCC", +"^+ c #99FFFF", +"/+ c #CCFF00", +"(+ c #CCFF33", +"_+ c #CCFF66", +":+ c #CCFF99", +"<+ c #CCFFCC", +"[+ c #CCFFFF", +"}+ c #FFFF00", +"|+ c #FFFF33", +"1+ c #FFFF66", +"2+ c #FFFF99", +"3+ c #FFFFCC", +"4+ c #FFFFFF", +"5+ c #000000", +"6+ c #000000", +"7+ c #000000", +"8+ c #000000", +"9+ c #000000", +"0+ c #000000", +"a+ c #000000", +"b+ c #000000", +"c+ c #000000", +"d+ c #000000", +"e+ c #000000", +"f+ c #000000", +"g+ c #000000", +"h+ c #000000", +"i+ c #000000", +"j+ c #000000", +"k+ c #000000", +"l+ c #000000", +"m+ c #000000", +"n+ c #000000", +"o+ c #000000", +"p+ c #000000", +"q+ c #000000", +"r+ c #000000", +"s+ c #000000", +"t+ c #000000", +"u+ c #000000", +"v+ c #000000", +"w+ c #000000", +"x+ c #000000", +"y+ c #000000", +"z+ c #000000", +"A+ c #000000", +"B+ c #000000", +"C+ c #000000", +"D+ c #000000", +"E+ c #000000", +"F+ c #000000", +"G+ c #000000", +"H+ c #000000", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.. Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. Q.Q.Q.Q.Q.. . . . . Q.Q.Q.Q.Q.. Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. Q.Q.. . 4+4+4+4+4+. . Q.Q.. Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. 4+4+4+4+4+4+4+4+4+. Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. 4+4+4+4+4+4+4+4+4+4+4+. Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. 4+4+4+4+4+4+4+4+4+4+4+4+4+. Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. 4+4+4+4+4+4+4+4+4+4+4+4+4+. Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. 4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+. Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. 4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+. Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.. . . . Q.. . . . . . . . . . . . . . . . . Q.. . . . Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. . . . . . . . . . . . . . . . . Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. . . . . . . . . . . . . . . . . Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. . . . . . . . . . . . . . . Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. . . . . . . . . . . . . . . Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. . . . . . . . . . . . . Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. . . . . . . . . . . Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. Q.Q.. . . . . . . . . Q.Q.. Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. Q.Q.Q.Q.Q.. . . . . Q.Q.Q.Q.Q.. Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.. Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.f f f f f f f Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f . f f . 0.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f 4+4+f #+#+. 0.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f 4+4+4+* #+#+#+f W Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. 4+4+4+f #+#+#+. 0.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f f . f . f . f f W Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.* 4+4+4+4+4+4+4+9 +.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.9 4+4+4+4+4+4+4+* 3.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f 4+4+4+4+4+4+4+f W Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.* 4+4+4+4+4+4+4+9 +.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.9 4+4+4+4+4+4+4+* 3.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f 4+4+4+4+4+e X Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. 4+4+4+4+4++ 9.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f . f . f 9.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q."}; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/cine_loop.xpm b/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/cine_loop.xpm new file mode 100644 index 0000000..9f61511 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/cine_loop.xpm @@ -0,0 +1,310 @@ +/* XPM */ +static char * cine_loop_xpm[] = { +"36 50 257 2", +" c None", +". c #000000", +"+ c #000033", +"@ c #000066", +"# c #000099", +"$ c #0000CC", +"% c #0000FF", +"& c #330000", +"* c #330033", +"= c #330066", +"- c #330099", +"; c #3300CC", +"> c #3300FF", +", c #660000", +"' c #660033", +") c #660066", +"! c #660099", +"~ c #6600CC", +"{ c #6600FF", +"] c #990000", +"^ c #990033", +"/ c #990066", +"( c #990099", +"_ c #9900CC", +": c #9900FF", +"< c #CC0000", +"[ c #CC0033", +"} c #CC0066", +"| c #CC0099", +"1 c #CC00CC", +"2 c #CC00FF", +"3 c #FF0000", +"4 c #FF0033", +"5 c #FF0066", +"6 c #FF0099", +"7 c #FF00CC", +"8 c #FF00FF", +"9 c #003300", +"0 c #003333", +"a c #003366", +"b c #003399", +"c c #0033CC", +"d c #0033FF", +"e c #333300", +"f c #333333", +"g c #333366", +"h c #333399", +"i c #3333CC", +"j c #3333FF", +"k c #663300", +"l c #663333", +"m c #663366", +"n c #663399", +"o c #6633CC", +"p c #6633FF", +"q c #993300", +"r c #993333", +"s c #993366", +"t c #993399", +"u c #9933CC", +"v c #9933FF", +"w c #CC3300", +"x c #CC3333", +"y c #CC3366", +"z c #CC3399", +"A c #CC33CC", +"B c #CC33FF", +"C c #FF3300", +"D c #FF3333", +"E c #FF3366", +"F c #FF3399", +"G c #FF33CC", +"H c #FF33FF", +"I c #006600", +"J c #006633", +"K c #006666", +"L c #006699", +"M c #0066CC", +"N c #0066FF", +"O c #336600", +"P c #336633", +"Q c #336666", +"R c #336699", +"S c #3366CC", +"T c #3366FF", +"U c #666600", +"V c #666633", +"W c #666666", +"X c #666699", +"Y c #6666CC", +"Z c #6666FF", +"` c #996600", +" . c #996633", +".. c #996666", +"+. c #996699", +"@. c #9966CC", +"#. c #9966FF", +"$. c #CC6600", +"%. c #CC6633", +"&. c #CC6666", +"*. c #CC6699", +"=. c #CC66CC", +"-. c #CC66FF", +";. c #FF6600", +">. c #FF6633", +",. c #FF6666", +"'. c #FF6699", +"). c #FF66CC", +"!. c #FF66FF", +"~. c #009900", +"{. c #009933", +"]. c #009966", +"^. c #009999", +"/. c #0099CC", +"(. c #0099FF", +"_. c #339900", +":. c #339933", +"<. c #339966", +"[. c #339999", +"}. c #3399CC", +"|. c #3399FF", +"1. c #669900", +"2. c #669933", +"3. c #669966", +"4. c #669999", +"5. c #6699CC", +"6. c #6699FF", +"7. c #999900", +"8. c #999933", +"9. c #999966", +"0. c #999999", +"a. c #9999CC", +"b. c #9999FF", +"c. c #CC9900", +"d. c #CC9933", +"e. c #CC9966", +"f. c #CC9999", +"g. c #CC99CC", +"h. c #CC99FF", +"i. c #FF9900", +"j. c #FF9933", +"k. c #FF9966", +"l. c #FF9999", +"m. c #FF99CC", +"n. c #FF99FF", +"o. c #00CC00", +"p. c #00CC33", +"q. c #00CC66", +"r. c #00CC99", +"s. c #00CCCC", +"t. c #00CCFF", +"u. c #33CC00", +"v. c #33CC33", +"w. c #33CC66", +"x. c #33CC99", +"y. c #33CCCC", +"z. c #33CCFF", +"A. c #66CC00", +"B. c #66CC33", +"C. c #66CC66", +"D. c #66CC99", +"E. c #66CCCC", +"F. c #66CCFF", +"G. c #99CC00", +"H. c #99CC33", +"I. c #99CC66", +"J. c #99CC99", +"K. c #99CCCC", +"L. c #99CCFF", +"M. c #CCCC00", +"N. c #CCCC33", +"O. c #CCCC66", +"P. c #CCCC99", +"Q. c #CCCCCC", +"R. c #CCCCFF", +"S. c #FFCC00", +"T. c #FFCC33", +"U. c #FFCC66", +"V. c #FFCC99", +"W. c #FFCCCC", +"X. c #FFCCFF", +"Y. c #00FF00", +"Z. c #00FF33", +"`. c #00FF66", +" + c #00FF99", +".+ c #00FFCC", +"++ c #00FFFF", +"@+ c #33FF00", +"#+ c #33FF33", +"$+ c #33FF66", +"%+ c #33FF99", +"&+ c #33FFCC", +"*+ c #33FFFF", +"=+ c #66FF00", +"-+ c #66FF33", +";+ c #66FF66", +">+ c #66FF99", +",+ c #66FFCC", +"'+ c #66FFFF", +")+ c #99FF00", +"!+ c #99FF33", +"~+ c #99FF66", +"{+ c #99FF99", +"]+ c #99FFCC", +"^+ c #99FFFF", +"/+ c #CCFF00", +"(+ c #CCFF33", +"_+ c #CCFF66", +":+ c #CCFF99", +"<+ c #CCFFCC", +"[+ c #CCFFFF", +"}+ c #FFFF00", +"|+ c #FFFF33", +"1+ c #FFFF66", +"2+ c #FFFF99", +"3+ c #FFFFCC", +"4+ c #FFFFFF", +"5+ c #000000", +"6+ c #000000", +"7+ c #000000", +"8+ c #000000", +"9+ c #000000", +"0+ c #000000", +"a+ c #000000", +"b+ c #000000", +"c+ c #000000", +"d+ c #000000", +"e+ c #000000", +"f+ c #000000", +"g+ c #000000", +"h+ c #000000", +"i+ c #000000", +"j+ c #000000", +"k+ c #000000", +"l+ c #000000", +"m+ c #000000", +"n+ c #000000", +"o+ c #000000", +"p+ c #000000", +"q+ c #000000", +"r+ c #000000", +"s+ c #000000", +"t+ c #000000", +"u+ c #000000", +"v+ c #000000", +"w+ c #000000", +"x+ c #000000", +"y+ c #000000", +"z+ c #000000", +"A+ c #000000", +"B+ c #000000", +"C+ c #000000", +"D+ c #000000", +"E+ c #000000", +"F+ c #000000", +"G+ c #000000", +"H+ c #000000", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.# Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.@ 4+@ Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.# 4+4+4+# Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.@ 4+4+4+4+4+@ Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.# 4+4+4+4+4+4+4+# Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.@ # @ # 4+4+4+@ # @ @ Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.@ 4+4+4+# W W W Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.# 4+4+4+@ W Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.# W Q.Q.Q.Q.@ 4+4+4+# W Q.Q.Q.Q.# Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.@ # W Q.Q.Q.Q.# 4+4+4+@ W Q.Q.Q.Q.@ # Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.# 4+@ W Q.Q.Q.Q.@ 4+4+4+# W Q.Q.Q.Q.# 4+@ Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.@ 4+4+# @ # @ # @ # 4+4+4+@ # @ # @ # @ 4+4+# Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.# 4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+@ Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.@ 4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+# Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.# 4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+@ W Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.@ 4+4+@ # @ # @ # @ 4+4+4+@ # @ # @ # @ 4+4+# W Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.# 4+# W Q.Q.Q.Q.# 4+4+4+# W Q.Q.Q.Q.# 4+@ W Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.@ @ W Q.Q.Q.Q.@ 4+4+4+@ W Q.Q.Q.Q.@ # W Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.# W Q.Q.Q.Q.# 4+4+4+# W Q.Q.Q.Q.@ W Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.@ 4+4+4+@ W Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.# 4+4+4+# W Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.# @ # @ 4+4+4+@ # @ # Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.@ 4+4+4+4+4+4+4+@ W Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.# 4+4+4+4+4+# W Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.@ 4+4+4+@ W Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.# 4+@ W Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.@ W Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.f f f f f f f Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f . f f . 0.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f #+#+f 4+4+. 0.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f #+#+#+* 4+4+4+f W Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. #+;+#+f 4+4+4+. 0.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f f . f . f . f f W Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.* 4+4+4+4+4+4+4+9 +.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.9 4+4+4+4+4+4+4+* 3.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f 4+4+4+4+4+4+4+f W Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.* 4+4+4+4+4+4+4+9 +.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.9 4+4+4+4+4+4+4+* 3.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f 4+4+4+4+4+e X Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.. 4+4+4+4+4++ 9.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.", +"Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.f . f . f 9.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q."}; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/clear.xpm b/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/clear.xpm new file mode 100644 index 0000000..1f0a4f2 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/clear.xpm @@ -0,0 +1,297 @@ +/* XPM */ +static char * clear_xpm[] = { +"37 37 257 2", +" c None", +". c #000000", +"+ c #800000", +"@ c #008000", +"# c #808000", +"$ c #000080", +"% c #800080", +"& c #008080", +"* c #C0C0C0", +"= c #C0DCC0", +"- c #A6CAF0", +"; c #000000", +"> c #00002A", +", c #000055", +"' c #00007F", +") c #0000AA", +"! c #0000D4", +"~ c #002A00", +"{ c #002A2A", +"] c #002A55", +"^ c #002A7F", +"/ c #002AAA", +"( c #002AD4", +"_ c #005500", +": c #00552A", +"< c #005555", +"[ c #00557F", +"} c #0055AA", +"| c #0055D4", +"1 c #007F00", +"2 c #007F2A", +"3 c #007F55", +"4 c #007F7F", +"5 c #007FAA", +"6 c #007FD4", +"7 c #00AA00", +"8 c #00AA2A", +"9 c #00AA55", +"0 c #00AA7F", +"a c #00AAAA", +"b c #00AAD4", +"c c #00D400", +"d c #00D42A", +"e c #00D455", +"f c #00D47F", +"g c #00D4AA", +"h c #00D4D4", +"i c #2A0000", +"j c #2A002A", +"k c #2A0055", +"l c #2A007F", +"m c #2A00AA", +"n c #2A00D4", +"o c #2A2A00", +"p c #2A2A2A", +"q c #2A2A55", +"r c #2A2A7F", +"s c #2A2AAA", +"t c #2A2AD4", +"u c #2A5500", +"v c #2A552A", +"w c #2A5555", +"x c #2A557F", +"y c #2A55AA", +"z c #2A55D4", +"A c #2A7F00", +"B c #2A7F2A", +"C c #2A7F55", +"D c #2A7F7F", +"E c #2A7FAA", +"F c #2A7FD4", +"G c #2AAA00", +"H c #2AAA2A", +"I c #2AAA55", +"J c #2AAA7F", +"K c #2AAAAA", +"L c #2AAAD4", +"M c #2AD400", +"N c #2AD42A", +"O c #2AD455", +"P c #2AD47F", +"Q c #2AD4AA", +"R c #2AD4D4", +"S c #550000", +"T c #55002A", +"U c #550055", +"V c #55007F", +"W c #5500AA", +"X c #5500D4", +"Y c #552A00", +"Z c #552A2A", +"` c #552A55", +" . c #552A7F", +".. c #552AAA", +"+. c #552AD4", +"@. c #555500", +"#. c #55552A", +"$. c #555555", +"%. c #55557F", +"&. c #5555AA", +"*. c #5555D4", +"=. c #557F00", +"-. c #557F2A", +";. c #557F55", +">. c #557F7F", +",. c #557FAA", +"'. c #557FD4", +"). c #55AA00", +"!. c #55AA2A", +"~. c #55AA55", +"{. c #55AA7F", +"]. c #55AAAA", +"^. c #55AAD4", +"/. c #55D400", +"(. c #55D42A", +"_. c #55D455", +":. c #55D47F", +"<. c #55D4AA", +"[. c #55D4D4", +"}. c #7F0000", +"|. c #7F002A", +"1. c #7F0055", +"2. c #7F007F", +"3. c #7F00AA", +"4. c #7F00D4", +"5. c #7F2A00", +"6. c #7F2A2A", +"7. c #7F2A55", +"8. c #7F2A7F", +"9. c #7F2AAA", +"0. c #7F2AD4", +"a. c #7F5500", +"b. c #7F552A", +"c. c #7F5555", +"d. c #7F557F", +"e. c #7F55AA", +"f. c #7F55D4", +"g. c #7F7F00", +"h. c #7F7F2A", +"i. c #7F7F55", +"j. c #7F7F7F", +"k. c #7F7FAA", +"l. c #7F7FD4", +"m. c #7FAA00", +"n. c #7FAA2A", +"o. c #7FAA55", +"p. c #7FAA7F", +"q. c #7FAAAA", +"r. c #7FAAD4", +"s. c #7FD400", +"t. c #7FD42A", +"u. c #7FD455", +"v. c #7FD47F", +"w. c #7FD4AA", +"x. c #7FD4D4", +"y. c #AA0000", +"z. c #AA002A", +"A. c #AA0055", +"B. c #AA007F", +"C. c #AA00AA", +"D. c #AA00D4", +"E. c #AA2A00", +"F. c #AA2A2A", +"G. c #AA2A55", +"H. c #AA2A7F", +"I. c #AA2AAA", +"J. c #AA2AD4", +"K. c #AA5500", +"L. c #AA552A", +"M. c #AA5555", +"N. c #AA557F", +"O. c #AA55AA", +"P. c #AA55D4", +"Q. c #AA7F00", +"R. c #AA7F2A", +"S. c #AA7F55", +"T. c #AA7F7F", +"U. c #AA7FAA", +"V. c #AA7FD4", +"W. c #AAAA00", +"X. c #AAAA2A", +"Y. c #AAAA55", +"Z. c #AAAA7F", +"`. c #AAAAAA", +" + c #AAAAD4", +".+ c #AAD400", +"++ c #AAD42A", +"@+ c #AAD455", +"#+ c #AAD47F", +"$+ c #AAD4AA", +"%+ c #AAD4D4", +"&+ c #D40000", +"*+ c #D4002A", +"=+ c #D40055", +"-+ c #D4007F", +";+ c #D400AA", +">+ c #D400D4", +",+ c #D42A00", +"'+ c #D42A2A", +")+ c #D42A55", +"!+ c #D42A7F", +"~+ c #D42AAA", +"{+ c #D42AD4", +"]+ c #D45500", +"^+ c #D4552A", +"/+ c #D45555", +"(+ c #D4557F", +"_+ c #D455AA", +":+ c #D455D4", +"<+ c #D47F00", +"[+ c #D47F2A", +"}+ c #D47F55", +"|+ c #D47F7F", +"1+ c #D47FAA", +"2+ c #D47FD4", +"3+ c #D4AA00", +"4+ c #D4AA2A", +"5+ c #D4AA55", +"6+ c #D4AA7F", +"7+ c #D4AAAA", +"8+ c #D4AAD4", +"9+ c #D4D400", +"0+ c #D4D42A", +"a+ c #D4D455", +"b+ c #D4D47F", +"c+ c #D4D4AA", +"d+ c #D4D4D4", +"e+ c #000000", +"f+ c #0C0C0C", +"g+ c #191919", +"h+ c #262626", +"i+ c #333333", +"j+ c #3F3F3F", +"k+ c #4C4C4C", +"l+ c #595959", +"m+ c #666666", +"n+ c #727272", +"o+ c #7F7F7F", +"p+ c #8C8C8C", +"q+ c #999999", +"r+ c #A5A5A5", +"s+ c #B2B2B2", +"t+ c #BFBFBF", +"u+ c #CCCCCC", +"v+ c #D8D8D8", +"w+ c #E5E5E5", +"x+ c #F2F2F2", +"y+ c #FFFBF0", +"z+ c #A0A0A4", +"A+ c #808080", +"B+ c #FF0000", +"C+ c #00FF00", +"D+ c #FFFF00", +"E+ c #0000FF", +"F+ c #FF00FF", +"G+ c #00FFFF", +"H+ c #FFFFFF", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * B+B+B+* * * * * * * * * * * B+B+B+* * * * * * * * * * ", +"* * * * * * * * * * * B+B+B+* * * * * * * * * B+B+B+* * * * * * * * * * * ", +"* * * * * * * * * * * * B+B+B+* * * * * * * B+B+B+* * * * * * * * * * * * ", +"* * * * * * * * * * * * * B+B+B+* * * * * B+B+B+* * * * * * * * * * * * * ", +"* * * * * $ $ $ $ $ $ $ $ $ B+B+B+$ $ $ B+B+B+$ $ $ $ $ $ $ $ $ * * * * * ", +"* * * * * $ H+H+H+$ H+H+$ H+H+B+B+B+$ B+B+B+H+H+$ H+H+$ H+H+H+$ * * * * * ", +"* * * * * $ H+H+H+$ H+H+$ H+H+$ B+B+B+B+B+$ H+H+$ H+H+$ H+H+H+$ * * * * * ", +"* * * * * $ H+H+H+H+H+H+$ H+H+H+H+B+B+B+H+H+H+H+$ H+H+H+H+H+H+$ * * * * * ", +"* * * * * $ H+H+H+H+H+H+H+H+H+H+B+B+B+B+B+H+H+H+H+H+H+H+H+H+H+$ * * * * * ", +"* * * * * $ H+H+H+H+H+H+H+H+H+B+B+B+H+B+B+B+H+H+H+H+H+H+H+H+H+$ * * * * * ", +"* * * * * $ $ $ $ $ $ $ $ $ B+B+B+$ $ $ B+B+B+$ $ $ $ $ $ $ $ $ * * * * * ", +"* * * * * * * * * * * * * B+B+B+* * * * * B+B+B+* * * * * * * * * * * * * ", +"* * * * * * * * * * * * B+B+B+* * * * * * * B+B+B+* * * * * * * * * * * * ", +"* * * * * * * * * * * B+B+B+* * * * * * * * * B+B+B+* * * * * * * * * * * ", +"* * * * * * * * * * B+B+B+* * * * * * * * * * * B+B+B+* * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "}; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/intensity.xpm b/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/intensity.xpm new file mode 100644 index 0000000..9545546 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/intensity.xpm @@ -0,0 +1,297 @@ +/* XPM */ +static char * intensity_xpm[] = { +"37 37 257 2", +" c None", +". c #000000", +"+ c #800000", +"@ c #008000", +"# c #808000", +"$ c #000080", +"% c #800080", +"& c #008080", +"* c #C0C0C0", +"= c #C0DCC0", +"- c #A6CAF0", +"; c #000000", +"> c #00002A", +", c #000055", +"' c #00007F", +") c #0000AA", +"! c #0000D4", +"~ c #002A00", +"{ c #002A2A", +"] c #002A55", +"^ c #002A7F", +"/ c #002AAA", +"( c #002AD4", +"_ c #005500", +": c #00552A", +"< c #005555", +"[ c #00557F", +"} c #0055AA", +"| c #0055D4", +"1 c #007F00", +"2 c #007F2A", +"3 c #007F55", +"4 c #007F7F", +"5 c #007FAA", +"6 c #007FD4", +"7 c #00AA00", +"8 c #00AA2A", +"9 c #00AA55", +"0 c #00AA7F", +"a c #00AAAA", +"b c #00AAD4", +"c c #00D400", +"d c #00D42A", +"e c #00D455", +"f c #00D47F", +"g c #00D4AA", +"h c #00D4D4", +"i c #2A0000", +"j c #2A002A", +"k c #2A0055", +"l c #2A007F", +"m c #2A00AA", +"n c #2A00D4", +"o c #2A2A00", +"p c #2A2A2A", +"q c #2A2A55", +"r c #2A2A7F", +"s c #2A2AAA", +"t c #2A2AD4", +"u c #2A5500", +"v c #2A552A", +"w c #2A5555", +"x c #2A557F", +"y c #2A55AA", +"z c #2A55D4", +"A c #2A7F00", +"B c #2A7F2A", +"C c #2A7F55", +"D c #2A7F7F", +"E c #2A7FAA", +"F c #2A7FD4", +"G c #2AAA00", +"H c #2AAA2A", +"I c #2AAA55", +"J c #2AAA7F", +"K c #2AAAAA", +"L c #2AAAD4", +"M c #2AD400", +"N c #2AD42A", +"O c #2AD455", +"P c #2AD47F", +"Q c #2AD4AA", +"R c #2AD4D4", +"S c #550000", +"T c #55002A", +"U c #550055", +"V c #55007F", +"W c #5500AA", +"X c #5500D4", +"Y c #552A00", +"Z c #552A2A", +"` c #552A55", +" . c #552A7F", +".. c #552AAA", +"+. c #552AD4", +"@. c #555500", +"#. c #55552A", +"$. c #555555", +"%. c #55557F", +"&. c #5555AA", +"*. c #5555D4", +"=. c #557F00", +"-. c #557F2A", +";. c #557F55", +">. c #557F7F", +",. c #557FAA", +"'. c #557FD4", +"). c #55AA00", +"!. c #55AA2A", +"~. c #55AA55", +"{. c #55AA7F", +"]. c #55AAAA", +"^. c #55AAD4", +"/. c #55D400", +"(. c #55D42A", +"_. c #55D455", +":. c #55D47F", +"<. c #55D4AA", +"[. c #55D4D4", +"}. c #7F0000", +"|. c #7F002A", +"1. c #7F0055", +"2. c #7F007F", +"3. c #7F00AA", +"4. c #7F00D4", +"5. c #7F2A00", +"6. c #7F2A2A", +"7. c #7F2A55", +"8. c #7F2A7F", +"9. c #7F2AAA", +"0. c #7F2AD4", +"a. c #7F5500", +"b. c #7F552A", +"c. c #7F5555", +"d. c #7F557F", +"e. c #7F55AA", +"f. c #7F55D4", +"g. c #7F7F00", +"h. c #7F7F2A", +"i. c #7F7F55", +"j. c #7F7F7F", +"k. c #7F7FAA", +"l. c #7F7FD4", +"m. c #7FAA00", +"n. c #7FAA2A", +"o. c #7FAA55", +"p. c #7FAA7F", +"q. c #7FAAAA", +"r. c #7FAAD4", +"s. c #7FD400", +"t. c #7FD42A", +"u. c #7FD455", +"v. c #7FD47F", +"w. c #7FD4AA", +"x. c #7FD4D4", +"y. c #AA0000", +"z. c #AA002A", +"A. c #AA0055", +"B. c #AA007F", +"C. c #AA00AA", +"D. c #AA00D4", +"E. c #AA2A00", +"F. c #AA2A2A", +"G. c #AA2A55", +"H. c #AA2A7F", +"I. c #AA2AAA", +"J. c #AA2AD4", +"K. c #AA5500", +"L. c #AA552A", +"M. c #AA5555", +"N. c #AA557F", +"O. c #AA55AA", +"P. c #AA55D4", +"Q. c #AA7F00", +"R. c #AA7F2A", +"S. c #AA7F55", +"T. c #AA7F7F", +"U. c #AA7FAA", +"V. c #AA7FD4", +"W. c #AAAA00", +"X. c #AAAA2A", +"Y. c #AAAA55", +"Z. c #AAAA7F", +"`. c #AAAAAA", +" + c #AAAAD4", +".+ c #AAD400", +"++ c #AAD42A", +"@+ c #AAD455", +"#+ c #AAD47F", +"$+ c #AAD4AA", +"%+ c #AAD4D4", +"&+ c #D40000", +"*+ c #D4002A", +"=+ c #D40055", +"-+ c #D4007F", +";+ c #D400AA", +">+ c #D400D4", +",+ c #D42A00", +"'+ c #D42A2A", +")+ c #D42A55", +"!+ c #D42A7F", +"~+ c #D42AAA", +"{+ c #D42AD4", +"]+ c #D45500", +"^+ c #D4552A", +"/+ c #D45555", +"(+ c #D4557F", +"_+ c #D455AA", +":+ c #D455D4", +"<+ c #D47F00", +"[+ c #D47F2A", +"}+ c #D47F55", +"|+ c #D47F7F", +"1+ c #D47FAA", +"2+ c #D47FD4", +"3+ c #D4AA00", +"4+ c #D4AA2A", +"5+ c #D4AA55", +"6+ c #D4AA7F", +"7+ c #D4AAAA", +"8+ c #D4AAD4", +"9+ c #D4D400", +"0+ c #D4D42A", +"a+ c #D4D455", +"b+ c #D4D47F", +"c+ c #D4D4AA", +"d+ c #D4D4D4", +"e+ c #000000", +"f+ c #0C0C0C", +"g+ c #191919", +"h+ c #262626", +"i+ c #333333", +"j+ c #3F3F3F", +"k+ c #4C4C4C", +"l+ c #595959", +"m+ c #666666", +"n+ c #727272", +"o+ c #7F7F7F", +"p+ c #8C8C8C", +"q+ c #999999", +"r+ c #A5A5A5", +"s+ c #B2B2B2", +"t+ c #BFBFBF", +"u+ c #CCCCCC", +"v+ c #D8D8D8", +"w+ c #E5E5E5", +"x+ c #F2F2F2", +"y+ c #FFFBF0", +"z+ c #A0A0A4", +"A+ c #808080", +"B+ c #FF0000", +"C+ c #00FF00", +"D+ c #FFFF00", +"E+ c #0000FF", +"F+ c #FF00FF", +"G+ c #00FFFF", +"H+ c #FFFFFF", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * B+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * B+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * B+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * B+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * B+B+B+B+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * $ $ $ $ $ $ $ $ * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * $ * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * $ * * * * * * * $ * * * * * * * * * * * * * * $ * * * * ", +"* * * * * * * * * $ * * * * * * $ * $ * * $ * $ * * $ * $ $ $ $ * $ * * * ", +"* * * * * * * * * $ * * * * * $ * * * $ $ * * * $ $ * * * * $ * * * $ * * ", +"* * * * * * * * * $ * * * * * $ * * * $ $ * * * $ * * * * $ * * * * $ * * ", +"* * * * * * * * * $ * * * * * $ * * $ * * $ * $ * * * * $ $ $ $ * * $ * * ", +"* * * * * * * * * $ * * * * * * $ * * * * * * * * * * * * * * * * $ * * * ", +"* * * * * * * * * $ * * * * * * * $ * * * * * * * * * * * * * * $ * * * * ", +"* * * * * * $ $ $ $ $ $ $ $ * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ * * * * * ", +"* * * * * $ H+H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+H+$ * * * * * ", +"* * * * * $ H+H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+H+$ * * * * * ", +"* * * * * $ H+H+H+H+H+H+$ H+H+H+H+H+$ H+H+H+H+H+$ H+H+H+H+H+H+$ * * * * * ", +"* * * * * $ H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+$ * * * * * ", +"* * * * * $ H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+$ * * * * * ", +"* * * * * $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "}; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/linear.xpm b/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/linear.xpm new file mode 100644 index 0000000..c173565 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/res/linear.xpm @@ -0,0 +1,297 @@ +/* XPM */ +static char * linear_xpm[] = { +"37 37 257 2", +" c None", +". c #000000", +"+ c #800000", +"@ c #008000", +"# c #808000", +"$ c #000080", +"% c #800080", +"& c #008080", +"* c #C0C0C0", +"= c #C0DCC0", +"- c #A6CAF0", +"; c #000000", +"> c #00002A", +", c #000055", +"' c #00007F", +") c #0000AA", +"! c #0000D4", +"~ c #002A00", +"{ c #002A2A", +"] c #002A55", +"^ c #002A7F", +"/ c #002AAA", +"( c #002AD4", +"_ c #005500", +": c #00552A", +"< c #005555", +"[ c #00557F", +"} c #0055AA", +"| c #0055D4", +"1 c #007F00", +"2 c #007F2A", +"3 c #007F55", +"4 c #007F7F", +"5 c #007FAA", +"6 c #007FD4", +"7 c #00AA00", +"8 c #00AA2A", +"9 c #00AA55", +"0 c #00AA7F", +"a c #00AAAA", +"b c #00AAD4", +"c c #00D400", +"d c #00D42A", +"e c #00D455", +"f c #00D47F", +"g c #00D4AA", +"h c #00D4D4", +"i c #2A0000", +"j c #2A002A", +"k c #2A0055", +"l c #2A007F", +"m c #2A00AA", +"n c #2A00D4", +"o c #2A2A00", +"p c #2A2A2A", +"q c #2A2A55", +"r c #2A2A7F", +"s c #2A2AAA", +"t c #2A2AD4", +"u c #2A5500", +"v c #2A552A", +"w c #2A5555", +"x c #2A557F", +"y c #2A55AA", +"z c #2A55D4", +"A c #2A7F00", +"B c #2A7F2A", +"C c #2A7F55", +"D c #2A7F7F", +"E c #2A7FAA", +"F c #2A7FD4", +"G c #2AAA00", +"H c #2AAA2A", +"I c #2AAA55", +"J c #2AAA7F", +"K c #2AAAAA", +"L c #2AAAD4", +"M c #2AD400", +"N c #2AD42A", +"O c #2AD455", +"P c #2AD47F", +"Q c #2AD4AA", +"R c #2AD4D4", +"S c #550000", +"T c #55002A", +"U c #550055", +"V c #55007F", +"W c #5500AA", +"X c #5500D4", +"Y c #552A00", +"Z c #552A2A", +"` c #552A55", +" . c #552A7F", +".. c #552AAA", +"+. c #552AD4", +"@. c #555500", +"#. c #55552A", +"$. c #555555", +"%. c #55557F", +"&. c #5555AA", +"*. c #5555D4", +"=. c #557F00", +"-. c #557F2A", +";. c #557F55", +">. c #557F7F", +",. c #557FAA", +"'. c #557FD4", +"). c #55AA00", +"!. c #55AA2A", +"~. c #55AA55", +"{. c #55AA7F", +"]. c #55AAAA", +"^. c #55AAD4", +"/. c #55D400", +"(. c #55D42A", +"_. c #55D455", +":. c #55D47F", +"<. c #55D4AA", +"[. c #55D4D4", +"}. c #7F0000", +"|. c #7F002A", +"1. c #7F0055", +"2. c #7F007F", +"3. c #7F00AA", +"4. c #7F00D4", +"5. c #7F2A00", +"6. c #7F2A2A", +"7. c #7F2A55", +"8. c #7F2A7F", +"9. c #7F2AAA", +"0. c #7F2AD4", +"a. c #7F5500", +"b. c #7F552A", +"c. c #7F5555", +"d. c #7F557F", +"e. c #7F55AA", +"f. c #7F55D4", +"g. c #7F7F00", +"h. c #7F7F2A", +"i. c #7F7F55", +"j. c #7F7F7F", +"k. c #7F7FAA", +"l. c #7F7FD4", +"m. c #7FAA00", +"n. c #7FAA2A", +"o. c #7FAA55", +"p. c #7FAA7F", +"q. c #7FAAAA", +"r. c #7FAAD4", +"s. c #7FD400", +"t. c #7FD42A", +"u. c #7FD455", +"v. c #7FD47F", +"w. c #7FD4AA", +"x. c #7FD4D4", +"y. c #AA0000", +"z. c #AA002A", +"A. c #AA0055", +"B. c #AA007F", +"C. c #AA00AA", +"D. c #AA00D4", +"E. c #AA2A00", +"F. c #AA2A2A", +"G. c #AA2A55", +"H. c #AA2A7F", +"I. c #AA2AAA", +"J. c #AA2AD4", +"K. c #AA5500", +"L. c #AA552A", +"M. c #AA5555", +"N. c #AA557F", +"O. c #AA55AA", +"P. c #AA55D4", +"Q. c #AA7F00", +"R. c #AA7F2A", +"S. c #AA7F55", +"T. c #AA7F7F", +"U. c #AA7FAA", +"V. c #AA7FD4", +"W. c #AAAA00", +"X. c #AAAA2A", +"Y. c #AAAA55", +"Z. c #AAAA7F", +"`. c #AAAAAA", +" + c #AAAAD4", +".+ c #AAD400", +"++ c #AAD42A", +"@+ c #AAD455", +"#+ c #AAD47F", +"$+ c #AAD4AA", +"%+ c #AAD4D4", +"&+ c #D40000", +"*+ c #D4002A", +"=+ c #D40055", +"-+ c #D4007F", +";+ c #D400AA", +">+ c #D400D4", +",+ c #D42A00", +"'+ c #D42A2A", +")+ c #D42A55", +"!+ c #D42A7F", +"~+ c #D42AAA", +"{+ c #D42AD4", +"]+ c #D45500", +"^+ c #D4552A", +"/+ c #D45555", +"(+ c #D4557F", +"_+ c #D455AA", +":+ c #D455D4", +"<+ c #D47F00", +"[+ c #D47F2A", +"}+ c #D47F55", +"|+ c #D47F7F", +"1+ c #D47FAA", +"2+ c #D47FD4", +"3+ c #D4AA00", +"4+ c #D4AA2A", +"5+ c #D4AA55", +"6+ c #D4AA7F", +"7+ c #D4AAAA", +"8+ c #D4AAD4", +"9+ c #D4D400", +"0+ c #D4D42A", +"a+ c #D4D455", +"b+ c #D4D47F", +"c+ c #D4D4AA", +"d+ c #D4D4D4", +"e+ c #000000", +"f+ c #0C0C0C", +"g+ c #191919", +"h+ c #262626", +"i+ c #333333", +"j+ c #3F3F3F", +"k+ c #4C4C4C", +"l+ c #595959", +"m+ c #666666", +"n+ c #727272", +"o+ c #7F7F7F", +"p+ c #8C8C8C", +"q+ c #999999", +"r+ c #A5A5A5", +"s+ c #B2B2B2", +"t+ c #BFBFBF", +"u+ c #CCCCCC", +"v+ c #D8D8D8", +"w+ c #E5E5E5", +"x+ c #F2F2F2", +"y+ c #FFFBF0", +"z+ c #A0A0A4", +"A+ c #808080", +"B+ c #FF0000", +"C+ c #00FF00", +"D+ c #FFFF00", +"E+ c #0000FF", +"F+ c #FF00FF", +"G+ c #00FFFF", +"H+ c #FFFFFF", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * . . . * * * * * * * * * * * * * * * * * * * * * * * B+B+B+* * * * ", +"* * * . * . * . * * * * * * * * * * * * * * * * * * * * * * B+* * B+* * * ", +"* * * * * . * * * * * * * * * * * * * * * * * * * * * * * * B+B+B+* * * * ", +"* * * * * . * * * * * * * * * * * * * * * * * * * * * * * * B+* * B+* * * ", +"* * * * * . * * * * * * * * * * * * * * * * * * * * * * * * B+* * B+* * * ", +"* * * * * . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * . * * * * * * * * * * $ * * * * $ * * * * * * * * * * * * * * * ", +"* * * * * . * * * * * * * * * $ $ * * * * $ $ * * * * * * * * * * * * * * ", +"* * * * * . * * * * $ * * * $ * * $ * * $ * $ * * * * * * * * * * * * * * ", +"* * * * * . * * * $ $ * * * $ * * $ $ $ * * * $ $ * * * * * * * * * * * * ", +"* * * * * . * * * $ * $ * $ $ * * * * * * * * * $ * * $ $ * * * * * * * * ", +"* * * * * . * * $ $ * * $ * * * * * * * * * * * $ $ $ * * $ * * * * * * * ", +"* * * * * . * * $ * * * * * * * * * * * * * * * * * * * * $ * * * * * * * ", +"* * * * * . * $ $ * * * * * * * * * * * * * * * * * * * * $ . * * * * * * ", +"* * * * * . * $ * * * * * * * * * * * * * * * * * * * * * * $ . * * * * * ", +"* * * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . * * * * ", +"* * * * * . * * * * * * * * * * * * * * * * * * * * * * * * * . * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * . * * * * * * ", +"* * * * * $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ * * * * * ", +"* * * * * $ H+H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+H+$ * * * * * ", +"* * * * * $ H+H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+$ H+H+H+$ * * * * * ", +"* * * * * $ H+H+H+H+H+H+$ H+H+H+H+H+$ H+H+H+H+H+$ H+H+H+H+H+H+$ * * * * * ", +"* * * * * $ H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+$ * * * * * ", +"* * * * * $ H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+H+$ * * * * * ", +"* * * * * $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ", +"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "}; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk2DQuantSliceWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk2DQuantSliceWidget.cxx new file mode 100644 index 0000000..3189621 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk2DQuantSliceWidget.cxx @@ -0,0 +1,189 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: vtk2DQuantSliceWidget.cxx,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:41 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +#include "vtk2DQuantSliceWidget.h" +#include +#include + +/** + * Again wxVTK is an hybrid class, double click was done using wxWindows, simply + * because VTK doesn't provide such facility (as opposed to wheel support that is + * supposed to be merged in VTK trunk sooner or later: + * + * http://public.kitware.com/pipermail/vtkusers/2003-August/019548.html + * http://www.creatis.insa-lyon.fr/~malaterre/vtk/wheel.patch + */ + +vtk2DQuantSliceWidget::vtk2DQuantSliceWidget( wxWindow* parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name) + : wxImageViewerWidget( parent, id, pos, size, style, name) +{ + // Contour + _cntActor = NULL; + _cntMapper = NULL; + + // Diameter Min + _diameterMinvtkActor = NULL; + _diameterMinvtkPolyLine = NULL; + _diameterMinvtkDataSetMapper = NULL; + _diameterMinvtkUnstructuredGrid = NULL; + + // Diameter Max + _diameterMaxvtkActor = NULL; + _diameterMaxvtkPolyLine = NULL; + _diameterMaxvtkDataSetMapper = NULL; + _diameterMaxvtkUnstructuredGrid = NULL; +} + + +vtk2DQuantSliceWidget::~vtk2DQuantSliceWidget( ) +{ + // Contour + if( _cntActor ) _cntActor->Delete(); + if( _cntMapper ) _cntMapper->Delete(); + + // Diameter Min + if( _diameterMinvtkActor ) _diameterMinvtkActor->Delete(); + if( _diameterMinvtkPolyLine ) _diameterMinvtkPolyLine->Delete(); + if( _diameterMinvtkDataSetMapper ) _diameterMinvtkDataSetMapper->Delete(); + if( _diameterMinvtkUnstructuredGrid ) _diameterMinvtkUnstructuredGrid->Delete(); + + // Diameter Max + if( _diameterMaxvtkActor ) _diameterMaxvtkActor->Delete(); + if( _diameterMaxvtkPolyLine ) _diameterMaxvtkPolyLine->Delete(); + if( _diameterMaxvtkDataSetMapper ) _diameterMaxvtkDataSetMapper->Delete(); + if( _diameterMaxvtkUnstructuredGrid ) _diameterMaxvtkUnstructuredGrid->Delete(); +} + +//---------------------------------------------------------------------------- + +//void vtk2DQuantSliceWidget::SetContour( vtkUnstructuredGrid *cnt ) +void vtk2DQuantSliceWidget::SetContour( vtkPolyData *cnt ) +{ +// _cntMapper = vtkDataSetMapper::New( ); +// _cntMapper = vtkDataSetMapper::New( ); + + _cnt = cnt; + + if( !_cntMapper ) { + _cntMapper = vtkPolyDataMapper::New( ); + _cntMapper->ScalarVisibilityOff( ); + _cntMapper->ImmediateModeRenderingOn(); + } + _cntMapper->SetInput( _cnt ); +// _cntMapper->SetInput( _cnt->GetOutput( ) ); + + if( !_cntActor ) { + _cntActor = vtkActor::New( ); + _cntActor->SetMapper( _cntMapper ); + (_cntActor->GetProperty( ))->SetColor( 0 , 1 , 0 ); + (_cntActor->GetProperty( ))->SetLineWidth( 2 ); + (_cntActor->GetProperty( ))->BackfaceCullingOff( ); + } + else{ + _imageViewer->GetRenderer()->RemoveActor( _cntActor ); + } + + _cntActor->SetPosition(0,0,100); + _imageViewer->GetRenderer()->AddActor( _cntActor ); + _imageViewer->Render( ); + +} + + +//---------------------------------------------------------------------------- +void vtk2DQuantSliceWidget::SetDiameterMin(vtkPoints *diameterMin, bool showActor){ + if (_diameterMinvtkActor!=NULL) _imageViewer->GetRenderer()->RemoveActor( _diameterMinvtkActor ); + if (_diameterMinvtkActor!=NULL) _diameterMinvtkActor->Delete(); + if (_diameterMinvtkPolyLine!=NULL) _diameterMinvtkPolyLine->Delete(); + if (_diameterMinvtkDataSetMapper!=NULL) _diameterMinvtkDataSetMapper->Delete(); + if (_diameterMinvtkUnstructuredGrid!=NULL) _diameterMinvtkUnstructuredGrid->Delete(); + + _diameterMinvtkActor = vtkActor::New(); + _diameterMinvtkPolyLine = vtkPolyLine::New(); + _diameterMinvtkDataSetMapper = vtkDataSetMapper::New(); + _diameterMinvtkUnstructuredGrid = vtkUnstructuredGrid::New(); + + // generate new actor + (_diameterMinvtkPolyLine->GetPointIds() )->SetNumberOfIds(2); + ( _diameterMinvtkPolyLine->GetPointIds() )->SetId(0,0); + ( _diameterMinvtkPolyLine->GetPointIds() )->SetId(1,1); + _diameterMinvtkUnstructuredGrid->Allocate(1,1); + _diameterMinvtkUnstructuredGrid->InsertNextCell(_diameterMinvtkPolyLine->GetCellType() , + _diameterMinvtkPolyLine->GetPointIds() ); + _diameterMinvtkUnstructuredGrid->SetPoints( diameterMin ); + _diameterMinvtkDataSetMapper->SetInput(_diameterMinvtkUnstructuredGrid); + _diameterMinvtkDataSetMapper->ImmediateModeRenderingOn(); + _diameterMinvtkActor->SetMapper(_diameterMinvtkDataSetMapper); + _diameterMinvtkActor->GetProperty()->BackfaceCullingOn(); + _diameterMinvtkActor->GetProperty()->SetDiffuseColor(1,0,0); + // add new actor + if (showActor==true) _imageViewer->GetRenderer()->AddActor( _diameterMinvtkActor ); + // Refresh Widget + _imageViewer->Render( ); +} +//---------------------------------------------------------------------------- +void vtk2DQuantSliceWidget::SetDiameterMax(vtkPoints *diameterMax, bool showActor){ + if (_diameterMaxvtkActor!=NULL) _imageViewer->GetRenderer()->RemoveActor( _diameterMaxvtkActor ); + if (_diameterMaxvtkActor!=NULL) _diameterMaxvtkActor->Delete(); + if (_diameterMaxvtkPolyLine!=NULL) _diameterMaxvtkPolyLine->Delete(); + if (_diameterMaxvtkDataSetMapper!=NULL) _diameterMaxvtkDataSetMapper->Delete(); + if (_diameterMaxvtkUnstructuredGrid!=NULL) _diameterMaxvtkUnstructuredGrid->Delete(); + + _diameterMaxvtkActor = vtkActor::New(); + _diameterMaxvtkPolyLine = vtkPolyLine::New(); + _diameterMaxvtkDataSetMapper = vtkDataSetMapper::New(); + _diameterMaxvtkUnstructuredGrid = vtkUnstructuredGrid::New(); + + // generate new actor + (_diameterMaxvtkPolyLine->GetPointIds() )->SetNumberOfIds(2); + ( _diameterMaxvtkPolyLine->GetPointIds() )->SetId(0,0); + ( _diameterMaxvtkPolyLine->GetPointIds() )->SetId(1,1); + _diameterMaxvtkUnstructuredGrid->Allocate(1,1); + _diameterMaxvtkUnstructuredGrid->InsertNextCell(_diameterMaxvtkPolyLine->GetCellType() , + _diameterMaxvtkPolyLine->GetPointIds() ); + _diameterMaxvtkUnstructuredGrid->SetPoints( diameterMax ); + _diameterMaxvtkDataSetMapper->SetInput(_diameterMaxvtkUnstructuredGrid); + _diameterMaxvtkDataSetMapper->ImmediateModeRenderingOn(); + _diameterMaxvtkActor->SetMapper(_diameterMaxvtkDataSetMapper); + _diameterMaxvtkActor->GetProperty()->BackfaceCullingOn(); + _diameterMaxvtkActor->GetProperty()->SetDiffuseColor(0,0,1); + // add new actor + if (showActor==true) _imageViewer->GetRenderer()->AddActor( _diameterMaxvtkActor ); + // Refresh Widget + _imageViewer->Render( ); +} +//---------------------------------------------------------------------------- +void vtk2DQuantSliceWidget::Show2DContourDiameters( ){ + if (_cntActor!=NULL) _imageViewer->GetRenderer()->AddActor( _cntActor ); + if (_diameterMinvtkActor!=NULL) _imageViewer->GetRenderer()->AddActor( _diameterMinvtkActor ); + if (_diameterMaxvtkActor!=NULL) _imageViewer->GetRenderer()->AddActor( _diameterMaxvtkActor ); + _imageViewer->Render( ); +} +//---------------------------------------------------------------------------- +void vtk2DQuantSliceWidget::Hide2DContourDiameters( ){ + if ( _cntActor != NULL ) { _imageViewer->GetRenderer()->RemoveActor( _cntActor ); } + if ( _diameterMinvtkActor != NULL ) { _imageViewer->GetRenderer()->RemoveActor( _diameterMinvtkActor ); } + if ( _diameterMaxvtkActor != NULL ) { _imageViewer->GetRenderer()->RemoveActor( _diameterMaxvtkActor ); } + _imageViewer->Render( ); +} + +//---------------------------------------------------------------------------- +/*BEGIN_EVENT_TABLE( vtk2DQuantSliceWidget, wxVTKRenderWindowInteractor ) + EVT_LEFT_DCLICK( vtk2DQuantSliceWidget::OnLeftDClick ) +END_EVENT_TABLE( ); +*/ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk2DQuantSliceWidget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk2DQuantSliceWidget.h new file mode 100644 index 0000000..1ea8024 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk2DQuantSliceWidget.h @@ -0,0 +1,78 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: vtk2DQuantSliceWidget.h,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:41 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +#ifndef __VTK2DQUANTSLICEWIDGET__ +#define __VTK2DQUANTSLICEWIDGET__ + +#include "wxImageViewerWidget.h" + +#include +#include +#include +#include +#include + + +/** + * \brief Class that brigde to VTK, override double click... + */ +class vtk2DQuantSliceWidget : public wxImageViewerWidget +{ +public: + + vtk2DQuantSliceWidget( wxWindow* parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSUNKEN_BORDER, //wxTAB_TRAVERSAL, + const wxString& name = wxPanelNameStr + ); + ~vtk2DQuantSliceWidget( ); + + //void SetContour( vtkUnstructuredGrid *cnt ); + void SetContour( vtkPolyData *cnt ); + void SetDiameterMin(vtkPoints *diameterMin, bool showActor); + void SetDiameterMax(vtkPoints *diameterMax, bool showActor); + void Show2DContourDiameters(); + void Hide2DContourDiameters(); + +protected: + +private: + + // Contour + vtkPolyData *_cnt; + vtkPolyDataMapper *_cntMapper; + vtkActor *_cntActor; + + // Diameter Min + vtkActor *_diameterMinvtkActor; + vtkPolyLine *_diameterMinvtkPolyLine; + vtkDataSetMapper *_diameterMinvtkDataSetMapper; + vtkUnstructuredGrid *_diameterMinvtkUnstructuredGrid; + + // Diameter Max + vtkActor *_diameterMaxvtkActor; + vtkPolyLine *_diameterMaxvtkPolyLine; + vtkDataSetMapper *_diameterMaxvtkDataSetMapper; + vtkUnstructuredGrid *_diameterMaxvtkUnstructuredGrid; + + +// DECLARE_EVENT_TABLE( ); + +}; + +#endif //__VTK2DQUANTSLICEWIDGET__ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DQuantSurfaceWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DQuantSurfaceWidget.cxx new file mode 100644 index 0000000..03278f4 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DQuantSurfaceWidget.cxx @@ -0,0 +1,610 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: vtk3DQuantSurfaceWidget.cxx,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:41 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +#include "vtk3DQuantSurfaceWidget.h" +#include +#include +#include +// EED +#include +#include + + + +//---------------------------------------------------------------------------- +RectangleGuideVtk::RectangleGuideVtk(){ + _showActor = false; + _grid = NULL; + _actor = NULL; + _points = NULL; + _mapper = NULL; + _poly_line = NULL; + _iSlice = -1; +} +//---------------------------------------------------------------------------- +RectangleGuideVtk::~RectangleGuideVtk(){ + if( _grid ) _grid->Delete(); + if( _actor ) _actor->Delete(); + if( _points ) _points->Delete(); + if( _mapper ) _mapper->Delete(); + if( _poly_line ) _poly_line->Delete(); +} + +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +listContourVTK::listContourVTK(vtk3DQuantSurfaceWidget *quantSurfaceWidget){ + _r=1; + _g=1; + _b=1; + _vtk3DQuantSurfaceWidget=quantSurfaceWidget; +} +//---------------------------------------------------------------------------- +listContourVTK::~listContourVTK(){ + EraseListContourActor(); +} +//---------------------------------------------------------------------------- +void listContourVTK::SetColour(int r,int g,int b){ + _r=r; + _g=g; + _b=b; +} +//---------------------------------------------------------------------------- +void listContourVTK::InitListContourActor(int nos){ + EraseListContourActor(); + int i; + for (i=0;iQuantSurfaceWidget_GetRenderWindow(); +// pRenderWindow->Render( ); +} +//---------------------------------------------------------------------------- +void listContourVTK::EraseListContourActor(){ + int i; + for (i=0;i<_lst3DContoursVtkActor.size();i++){ + EraseSliceContourActor(i,false); + } + _lst3DContoursVtkActor.clear(); + _lst3DContoursVtkUnstructuredGrid.clear(); + _lst3DContoursVtkDataSetMapper.clear(); + _lst3DContoursVtkPolyLine.clear(); +} +//---------------------------------------------------------------------------- +void listContourVTK::EraseSliceContourActor(int slice, bool refresh){ + if (_lst3DContoursVtkActor[slice]!=NULL){ + vtkRenderer *pRenderer = _vtk3DQuantSurfaceWidget->QuantSurfaceWidget_GetRenderer(); + if (_lst3DContoursVtkActor[slice]) pRenderer->RemoveActor(_lst3DContoursVtkActor[slice]); + if (_lst3DContoursVtkUnstructuredGrid[slice]) _lst3DContoursVtkUnstructuredGrid[slice]->Delete(); + if (_lst3DContoursVtkDataSetMapper[slice]) _lst3DContoursVtkDataSetMapper[slice]->Delete(); + if (_lst3DContoursVtkPolyLine[slice]) _lst3DContoursVtkPolyLine[slice]->Delete(); + if (_lst3DContoursVtkActor[slice]) _lst3DContoursVtkActor[slice]->Delete(); + _lst3DContoursVtkUnstructuredGrid[slice]=NULL; + _lst3DContoursVtkDataSetMapper[slice]=NULL; + _lst3DContoursVtkPolyLine[slice]=NULL; + _lst3DContoursVtkActor[slice]=NULL; + } + if (refresh==true){ + // Refresh 3DWidget + vtkRenderWindow* pRenderWindow = _vtk3DQuantSurfaceWidget->QuantSurfaceWidget_GetRenderWindow(); + pRenderWindow->Render( ); + } +} +//---------------------------------------------------------------------------- +void listContourVTK::Set3DContourActor( int slice, vtkPoints* contour3D, bool showActor){ + // Erase old actor + EraseSliceContourActor(slice); + // generate new actor + int id,numberOfPoints; + numberOfPoints=contour3D->GetNumberOfPoints (); + _lst3DContoursVtkPolyLine[slice] = vtkPolyLine::New(); + + ( _lst3DContoursVtkPolyLine[slice]->GetPointIds() )->SetNumberOfIds(numberOfPoints); + for (id=0;idGetPointIds() )->SetId(id,id); + } + _lst3DContoursVtkUnstructuredGrid[slice]=vtkUnstructuredGrid::New(); + _lst3DContoursVtkUnstructuredGrid[slice]->Allocate(1,1); + _lst3DContoursVtkUnstructuredGrid[slice]->InsertNextCell( _lst3DContoursVtkPolyLine[slice]->GetCellType() , + _lst3DContoursVtkPolyLine[slice]->GetPointIds() ); + _lst3DContoursVtkUnstructuredGrid[slice]->SetPoints( contour3D ); + _lst3DContoursVtkDataSetMapper[slice] = vtkDataSetMapper::New(); + _lst3DContoursVtkDataSetMapper[slice]->SetInput(_lst3DContoursVtkUnstructuredGrid[slice]); + _lst3DContoursVtkDataSetMapper[slice]->ImmediateModeRenderingOn(); + _lst3DContoursVtkActor[slice]=vtkActor::New(); + _lst3DContoursVtkActor[slice]->SetMapper(_lst3DContoursVtkDataSetMapper[slice]); + _lst3DContoursVtkActor[slice]->GetProperty()->BackfaceCullingOn(); + _lst3DContoursVtkActor[slice]->GetProperty()->SetDiffuseColor(_r,_g,_b); + _lst3DContoursVtkActor[slice]->PickableOff( ); + // add new actor + vtkRenderer *pRenderer = _vtk3DQuantSurfaceWidget->QuantSurfaceWidget_GetRenderer(); + vtkRenderWindow* pRenderWindow = _vtk3DQuantSurfaceWidget->QuantSurfaceWidget_GetRenderWindow(); + + if (showActor==true){ + pRenderer->AddActor( _lst3DContoursVtkActor[slice] ); + } + // Refresh 3DWidget + pRenderWindow->Render( ); + + +} +//---------------------------------------------------------------------------- +void listContourVTK::Show3DContourActor( ){ + vtkRenderer *pRenderer = _vtk3DQuantSurfaceWidget->QuantSurfaceWidget_GetRenderer(); + vtkRenderWindow* pRenderWindow = _vtk3DQuantSurfaceWidget->QuantSurfaceWidget_GetRenderWindow(); + int i; + for (i=0;i<_lst3DContoursVtkActor.size();i++){ + if (_lst3DContoursVtkActor[i]!=NULL) pRenderer->AddActor( _lst3DContoursVtkActor[i] ); + } + // Refresh 3DWidget + pRenderWindow->Render( ); +} +//---------------------------------------------------------------------------- +void listContourVTK::Hide3DContourActor( ){ + vtkRenderer *pRenderer = _vtk3DQuantSurfaceWidget->QuantSurfaceWidget_GetRenderer(); + vtkRenderWindow* pRenderWindow = _vtk3DQuantSurfaceWidget->QuantSurfaceWidget_GetRenderWindow(); + int i; + for (i=0;i<_lst3DContoursVtkActor.size();i++){ + if (_lst3DContoursVtkActor[i]!=NULL) pRenderer->RemoveActor( _lst3DContoursVtkActor[i] ); + } + // Refresh 3DWidget + pRenderWindow->Render( ); +} + + +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- + + + + + +/** + * Again wxVTK is an hybrid class, double click was done using wxWindows, simply + * because VTK doesn't provide such facility (as opposed to wheel support that is + * supposed to be merged in VTK trunk sooner or later: + * + * http://public.kitware.com/pipermail/vtkusers/2003-August/019548.html + * http://www.creatis.insa-lyon.fr/~malaterre/vtk/wheel.patch + */ + +//---------------------------------------------------------------------------- +/* +BEGIN_EVENT_TABLE( vtk3DQuantSurfaceWidget, vtk3DSurfaceWidget ) + // EVT_LEFT_DCLICK( vtk3DQuantSurfaceWidget::OnLeftDClick ) + // EVT_MOUSEWHEEL( vtk3DQuantSurfaceWidget::OnMouseWheel ) +END_EVENT_TABLE( ); +*/ +//---------------------------------------------------------------------------- +vtk3DQuantSurfaceWidget::vtk3DQuantSurfaceWidget( + wxWindow* parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) + : vtk3DSurfaceWidget( parent, id, pos, size, style, name ){ + _3DSliceMapper = NULL; + _3DSliceActor = NULL; + _bwlookup = NULL; + _collookup = NULL; + _hs_rectGuide = new RectangleGuideVtk(); + _s1_rectGuide = new RectangleGuideVtk(); + _s2_rectGuide = new RectangleGuideVtk(); + _sA_rectGuide = new RectangleGuideVtk(); + _sB_rectGuide = new RectangleGuideVtk(); + + _lstContVtk = new listContourVTK(this); + _lstContHealtyVtk = new listContourVTK(this); + _lstContVtk->SetColour(1,1,0); + _lstContHealtyVtk->SetColour(0,0,1); + +} + +vtk3DQuantSurfaceWidget::~vtk3DQuantSurfaceWidget() +{ + if( _3DSliceActor ) _3DSliceActor ->Delete(); + if( _3DSliceMapper) _3DSliceMapper ->Delete(); + if( _bwlookup ) _bwlookup ->Delete(); + if( _collookup ) _collookup ->Delete(); + + delete _hs_rectGuide; + delete _s1_rectGuide; + delete _s2_rectGuide; + delete _sA_rectGuide; + delete _sB_rectGuide; + + delete _lstContVtk; + delete _lstContHealtyVtk; +} + + +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::ShowMARACASDataAndAxe( marInterface* mar ) +{ + marAxis *temp; + vtkPolyData *allData; + int nos; + vtkProbeFilter *pFilter; + + this->ShowMARACASData( mar ); + this->ConfigureVTK(); + + _pRenderer->SetBackground( 0.35, 0.35, 0.35 ); + + // Axis + _mar->_experiment->setAxis( 0 ); + temp = _mar->_experiment->getAxis( ); // ??? getActualAxis ?? + allData = temp->Draw( ); + + nos = _mar->_experiment->getNumberOfSlices( ); + pFilter = _mar->_experiment->get3DSlice( (int) (nos-1)/2 ); + + _bwlookup = vtkWindowLevelLookupTable::New( ); + _bwlookup->SetHueRange( 0 , 1 ); + _bwlookup->SetNumberOfColors( (int)(_range[1] - _range[0] + 1) ); + _bwlookup->SetTableRange( _range[0] , _range[1] ); + _bwlookup->SetSaturationRange( 0 , 0 ); + _bwlookup->SetValueRange( 0 , 1 ); + _bwlookup->SetAlphaRange( 1 , 1 ); + _bwlookup->Build( ); + + _collookup = vtkLookupTable::New( ); + _collookup->SetNumberOfColors( 256 ); + _collookup->SetTableRange( 0 , 255 ); + _collookup->Build( ); + _collookup->SetTableValue( 0 , 1 , 0 , 0 , 1 ); + _collookup->SetTableValue(128 , 0 , 0 , 1 , 1 ); + _collookup->SetTableValue(255 , 0 , 1 , 0 , 1 ); + + _3DSliceMapper = vtkDataSetMapper::New( ); + _3DSliceMapper->SetInput(pFilter->GetOutput( ) ); + _3DSliceMapper->SetLookupTable( _bwlookup ); + _3DSliceMapper->SetScalarRange( _range ); + _3DSliceMapper->ImmediateModeRenderingOn( ); + + _3DSliceActor = vtkActor::New( ); + _3DSliceActor->SetMapper( _3DSliceMapper ); + _pRenderer->AddActor( _3DSliceActor); + + _lstContVtk->InitListContourActor(nos); + _lstContHealtyVtk->InitListContourActor(nos); + + this->SetAxis( allData ); +} + +//---------------------------------------------------------------------------- + +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::ShowMARACASDataAndAxeCT( marInterfaceCT* mar ) +{ + marAxis *temp; + vtkPolyData *allData; + int nos; + vtkProbeFilter *pFilter; + + this->ShowMARACASDataCT( mar ); + this->ConfigureVTK(); + + _pRenderer->SetBackground( 0.75, 0.75, 0.75 ); + + // Axis + _marCT->setAxis( 0 ); + temp = _marCT->getAxis( ); // ??? getActualAxis ?? + allData = temp->Draw( ); + + nos = _marCT->getNumberOfSlices( ); + pFilter = _marCT->get3DSlice( (int) (nos-1)/2 ); + + _bwlookup = vtkWindowLevelLookupTable::New( ); + _bwlookup->SetHueRange( 0 , 1 ); + _bwlookup->SetNumberOfColors( (int)(_range[1] - _range[0] + 1) ); + _bwlookup->SetTableRange( _range[0] , _range[1] ); + _bwlookup->SetSaturationRange( 0 , 0 ); + _bwlookup->SetValueRange( 0 , 1 ); + _bwlookup->SetAlphaRange( 1 , 1 ); + _bwlookup->Build( ); + + _collookup = vtkLookupTable::New( ); + _collookup->SetNumberOfColors( 256 ); + _collookup->SetTableRange( 0 , 255 ); + _collookup->Build( ); + _collookup->SetTableValue( 0 , 1 , 0 , 0 , 1 ); + _collookup->SetTableValue(128 , 0 , 0 , 1 , 1 ); + _collookup->SetTableValue(255 , 0 , 1 , 0 , 1 ); + + _3DSliceMapper = vtkDataSetMapper::New( ); + _3DSliceMapper->SetInput(pFilter->GetOutput( ) ); + _3DSliceMapper->SetLookupTable( _bwlookup ); + _3DSliceMapper->SetScalarRange( _range ); + _3DSliceMapper->ImmediateModeRenderingOn( ); + + _3DSliceActor = vtkActor::New( ); + _3DSliceActor->SetMapper( _3DSliceMapper ); + _pRenderer->AddActor( _3DSliceActor); + + _lstContVtk->InitListContourActor(nos); + _lstContHealtyVtk->InitListContourActor(nos); + + this->SetAxis( allData ); +} + +//---------------------------------------------------------------------------- + +void vtk3DQuantSurfaceWidget::SetBWLookUp(){ + _3DSliceMapper->SetLookupTable( _bwlookup ); + _pRenderWindow->Render( ); +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::SetColorLookUp(){ + _3DSliceMapper->SetLookupTable( _collookup ); + _pRenderWindow->Render( ); +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::SetImage( vtkProbeFilter* pFilter ) +{ + _3DSliceMapper->SetInput(pFilter->GetOutput( ) ); +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Show3DSliceActor( ) +{ + _pRenderer->AddActor( _3DSliceActor ); + _pRenderWindow->Render( ); +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Hide3DSliceActor( ) +{ + _pRenderer->RemoveActor( _3DSliceActor ); + _pRenderWindow->Render( ); +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::InitListContourActor(int type, int nos){ + if ((type==0) || (type==-1)){ _lstContVtk->InitListContourActor(nos); } + if ((type==1) || (type==-1)){ _lstContHealtyVtk->InitListContourActor(nos); } +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Show3DContourActor( int type ){ + if (type==0){ _lstContVtk->Show3DContourActor(); } + if (type==1){ _lstContHealtyVtk->Show3DContourActor(); } +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Hide3DContourActor( int type ){ + if (type==0){ _lstContVtk->Hide3DContourActor(); } + if (type==1){ _lstContHealtyVtk->Hide3DContourActor(); } +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Set3DContourActor( int slice, vtkPoints* contour3D, bool showActor , int type){ + if (type==0) { _lstContVtk->Set3DContourActor(slice,contour3D,showActor); } + if (type==1) { _lstContHealtyVtk->Set3DContourActor(slice,contour3D,showActor); } +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Erase3DContourActor( int slice){ + _lstContVtk->EraseSliceContourActor(slice); +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Show3DHealthySliceActor( ) +{ + _pRenderer->AddActor( _hs_rectGuide->_actor ); + _pRenderWindow->Render( ); +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Hide3DHealthySliceActor( ) +{ + _pRenderer->RemoveActor( _hs_rectGuide->_actor ); + _pRenderWindow->Render( ); +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Set3DSliceActor( RectangleGuideVtk *_rectGuide ,float scale, int k,int r,int g,int b){ + int sizeIma; + double dimIma; + double *o; // Origen + double *c; // Center + double *n; // Normal + + double ori[3]; + double p1[3]; + double p2[3]; + + sizeIma = _mar->_experiment->getAxis( )->getParameters( )->getSizeIma( ); + dimIma = _mar->_experiment->getAxis( )->getParameters( )->getDimIma( ); + o = _mar->_experiment->getAxis( )->getSplinePoint(k); + c = _mar->_experiment->getAxis( )->getSplinePoint(k); + n = _mar->_experiment->getAxis( )->getNormal(k); + + vtkPlaneSource* pSource = vtkPlaneSource::New( ); + pSource->SetOrigin( o[0] , o[1], o[2] ); + pSource->SetPoint1( o[0]+dimIma*scale - 1.0 , o[1], o[2] ); + pSource->SetPoint2( o[0] , o[1], o[2]+dimIma*scale - 1.0 ); + pSource->SetResolution( sizeIma - 1 , sizeIma - 1 ); + pSource->Update( ); + pSource->SetCenter( c[ 0 ], c[ 1 ], c[ 2 ] ); + pSource->SetNormal( n[ 0 ], n[ 1 ], n[ 2 ] ); + pSource->Update( ); + pSource->GetOrigin( ori ); + pSource->GetPoint1( p1 ); + pSource->GetPoint2( p2 ); + + if (_rectGuide->_actor) _pRenderer->RemoveActor(_rectGuide->_actor); + if (_rectGuide->_grid) _rectGuide->_grid->Delete(); + if (_rectGuide->_actor) _rectGuide->_actor->Delete(); + if (_rectGuide->_points) _rectGuide->_points->Delete(); + if (_rectGuide->_mapper) _rectGuide->_mapper->Delete(); + if (_rectGuide->_poly_line) _rectGuide->_poly_line->Delete(); + + _rectGuide->_poly_line = vtkPolyLine::New(); + ( _rectGuide->_poly_line->GetPointIds() )->SetNumberOfIds(8); + ( _rectGuide->_poly_line->GetPointIds() )->SetId(0,0); + ( _rectGuide->_poly_line->GetPointIds() )->SetId(1,1); + ( _rectGuide->_poly_line->GetPointIds() )->SetId(2,2); + ( _rectGuide->_poly_line->GetPointIds() )->SetId(3,3); + ( _rectGuide->_poly_line->GetPointIds() )->SetId(4,4); + ( _rectGuide->_poly_line->GetPointIds() )->SetId(5,5); + ( _rectGuide->_poly_line->GetPointIds() )->SetId(6,6); + ( _rectGuide->_poly_line->GetPointIds() )->SetId(7,7); + + _rectGuide->_points=vtkPoints::New(); + _rectGuide->_points->InsertNextPoint( ori[0] , ori[1] , ori[2] ); + _rectGuide->_points->InsertNextPoint( p1[0] , p1[1] , p1[2] ); + _rectGuide->_points->InsertNextPoint( p2[0]+p1[0]-ori[0], p2[1]+p1[1]-ori[1] , p2[2]+p1[2]-ori[2]); + _rectGuide->_points->InsertNextPoint( p2[0] , p2[1] , p2[2] ); + _rectGuide->_points->InsertNextPoint( ori[0] , ori[1] , ori[2] ); + _rectGuide->_points->InsertNextPoint( p2[0]+p1[0]-ori[0], p2[1]+p1[1]-ori[1] , p2[2]+p1[2]-ori[2]); + _rectGuide->_points->InsertNextPoint( p1[0] , p1[1] , p1[2] ); + _rectGuide->_points->InsertNextPoint( p2[0] , p2[1] , p2[2] ); + + _rectGuide->_grid=vtkUnstructuredGrid::New(); + _rectGuide->_grid->Allocate(1,1); + _rectGuide->_grid->InsertNextCell( _rectGuide->_poly_line->GetCellType() , _rectGuide->_poly_line->GetPointIds() ); + _rectGuide->_grid->SetPoints( _rectGuide->_points ); + + _rectGuide->_mapper = vtkDataSetMapper::New(); + _rectGuide->_mapper->SetInput(_rectGuide->_grid); + _rectGuide->_mapper->ImmediateModeRenderingOn(); + + _rectGuide->_actor=vtkActor::New(); + _rectGuide->_actor->SetMapper(_rectGuide->_mapper); + _rectGuide->_actor->GetProperty()->BackfaceCullingOn(); + _rectGuide->_actor->GetProperty()->SetDiffuseColor(r,g,b); + _rectGuide->_actor->PickableOff( ); + _rectGuide->_iSlice = k; +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Set3DHealthySliceActor( ){ + int k = _mar->_experiment->getAxis( )->getHealthySlice(); + Set3DSliceActor( _hs_rectGuide , 1.0 , k ,0,0,1); +} + +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Set3DRegionSliceActor( int type , int k1, int k2 ){ + Set3DStartRegionSliceActor(type, k1); + Set3DEndRegionSliceActor(type, k2); +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Set3DStartRegionSliceActor( int type , int k ){ + if (type==0){ + Set3DSliceActor( _s1_rectGuide , 0.3 , k ,1,0,0); + _mar->_experiment->getAxis()->setStartQuant(k); + } + if (type==1){ + Set3DSliceActor( _sA_rectGuide , 0.3 , k ,1,1,0); + } +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Set3DEndRegionSliceActor( int type , int k ){ + if (type==0){ + Set3DSliceActor( _s2_rectGuide , 0.3 , k ,1,0,0); + _mar->_experiment->getAxis()->setFinishQuant(k); + } + if (type==1){ + Set3DSliceActor( _sB_rectGuide , 0.3 , k ,1,1,0); + } +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Show3DRegionSliceActor( int type ){ + Show3DStartRegionSliceActor(type); + Show3DEndRegionSliceActor(type); +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Show3DStartRegionSliceActor( int type ){ + if ((type==0) && (_s1_rectGuide->_iSlice!=-1)){ + _pRenderer->AddActor( _s1_rectGuide->_actor ); + _s1_rectGuide->_showActor=true; + } + if ((type==1) && (_sA_rectGuide->_iSlice!=-1)){ + _pRenderer->AddActor( _sA_rectGuide->_actor ); + _sA_rectGuide->_showActor=true; + } + _pRenderWindow->Render( ); +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Show3DEndRegionSliceActor( int type ){ + if ((type==0) && (_s2_rectGuide->_iSlice!=-1)){ + _pRenderer->AddActor( _s2_rectGuide->_actor ); + _s2_rectGuide->_showActor=true; + } + if ((type==1) && (_sB_rectGuide->_iSlice!=-1)){ + _pRenderer->AddActor( _sB_rectGuide->_actor ); + _sB_rectGuide->_showActor=true; + } + _pRenderWindow->Render( ); +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Hide3DRegionSliceActor( int type ){ + Hide3DStartRegionSliceActor(type ); + Hide3DEndRegionSliceActor(type ); +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Hide3DStartRegionSliceActor( int type ){ + if (type==0){ + if (_s1_rectGuide->_showActor==true){ + _pRenderer->RemoveActor( _s1_rectGuide->_actor ); + _s1_rectGuide->_showActor=false; + } + } + if (type==1){ + if (_sA_rectGuide->_showActor==true){ + _pRenderer->RemoveActor( _sA_rectGuide->_actor ); + _sA_rectGuide->_showActor=false; + } + } + _pRenderWindow->Render( ); +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::Hide3DEndRegionSliceActor( int type ){ + if (type==0){ + if (_s2_rectGuide->_showActor==true){ + _pRenderer->RemoveActor( _s2_rectGuide->_actor ); + _s2_rectGuide->_showActor=false; + } + } + if (type==1){ + if (_sB_rectGuide->_showActor==true){ + _pRenderer->RemoveActor( _sB_rectGuide->_actor ); + _sB_rectGuide->_showActor=false; + } + } + _pRenderWindow->Render( ); +} +//---------------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::GetSliceLimites(int type, int &sliceStart,int &sliceEnd){ + if (type==0){ + sliceStart = _s1_rectGuide->_iSlice; + sliceEnd = _s2_rectGuide->_iSlice; + } + if (type==1){ + sliceStart = _sA_rectGuide->_iSlice; + sliceEnd = _sB_rectGuide->_iSlice; + } +} +//-------------------------------------------------------------------- +int vtk3DQuantSurfaceWidget::GetAnalysisTypeStenosis(){ + return _analysisTypeStenosis; +} +//-------------------------------------------------------------------- +void vtk3DQuantSurfaceWidget::SetAnalysisTypeStenosis(int analysisTypeStenosis){ + _analysisTypeStenosis=analysisTypeStenosis; +} + + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DQuantSurfaceWidget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DQuantSurfaceWidget.h new file mode 100644 index 0000000..c871c1d --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DQuantSurfaceWidget.h @@ -0,0 +1,161 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: vtk3DQuantSurfaceWidget.h,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:41 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +#ifndef __VTK3DQUANTSURFACEWIDGET__ +#define __VTK3DQUANTSURFACEWIDGET__ + + + + + +#include "vtk3DSurfaceWidget.h" +#include "kernel/marInterface.h" +#include "kernel/marInterfaceCT.h" +#include +#include +#include +#include +#include + +#include + +//---------------------------------------------------------------------------- + +class RectangleGuideVtk{ +public: + RectangleGuideVtk(); + ~RectangleGuideVtk(); + bool _showActor; + vtkActor* _actor; + vtkPoints* _points; + vtkPolyLine* _poly_line; + vtkDataSetMapper* _mapper; + vtkUnstructuredGrid* _grid; + int _iSlice; +}; + +//---------------------------------------------------------------------------- + +class vtk3DQuantSurfaceWidget; + +class listContourVTK { +public: + listContourVTK(vtk3DQuantSurfaceWidget *quantSurfaceWidget); + ~listContourVTK(); + void EraseListContourActor(); + void EraseSliceContourActor(int slice, bool refresh=true); + void InitListContourActor(int nos); + void Set3DContourActor( int slice, vtkPoints* contour3D, bool showActor); + void Show3DContourActor(); + void Hide3DContourActor(); + void SetColour(int r,int g,int b); + +private: + int _r,_g,_b; + vtk3DQuantSurfaceWidget *_vtk3DQuantSurfaceWidget; + std::vector< vtkActor* > _lst3DContoursVtkActor; + std::vector< vtkUnstructuredGrid* > _lst3DContoursVtkUnstructuredGrid; + std::vector< vtkDataSetMapper* > _lst3DContoursVtkDataSetMapper; + std::vector< vtkPolyLine* > _lst3DContoursVtkPolyLine; +}; +//---------------------------------------------------------------------------- + + +/** + * \brief Class that brigde to VTK, override double click... + */ +class vtk3DQuantSurfaceWidget : public vtk3DSurfaceWidget +{ +public: + + vtk3DQuantSurfaceWidget( + wxWindow* parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr + ); + ~vtk3DQuantSurfaceWidget(); + void ShowMARACASDataAndAxe( marInterface* mar ); + void ShowMARACASDataAndAxeCT( marInterfaceCT* mar); + + void SetImage( vtkProbeFilter* pFilter ); + + + void InitListContourActor( int type, int nos); + void Show3DContourActor( int type=0 ); + void Hide3DContourActor( int type=0 ); + void Set3DContourActor( int slice, vtkPoints* contour3D, bool showActor, int type=0 ); + void Erase3DContourActor( int slice); + + void Show3DSliceActor( ); + void Hide3DSliceActor( ); + + void SetColorLookUp( ); + void SetBWLookUp( ); + + void Show3DHealthySliceActor(); + void Hide3DHealthySliceActor(); + void Set3DHealthySliceActor( ); + + void Set3DRegionSliceActor( int type, int k1,int k2 ); + void Set3DStartRegionSliceActor( int type, int k ); + void Set3DEndRegionSliceActor( int type, int k ); + + void Show3DRegionSliceActor(int type ); + void Show3DStartRegionSliceActor(int type ); + void Show3DEndRegionSliceActor(int type ); + + void Hide3DRegionSliceActor(int type ); + void Hide3DStartRegionSliceActor(int type ); + void Hide3DEndRegionSliceActor(int type ); + + void GetSliceLimites(int type, int &sliceStart,int &sliceEnd); + + int GetAnalysisTypeStenosis(); + void SetAnalysisTypeStenosis(int analysisTypeStenosis); + + + vtkRenderer* QuantSurfaceWidget_GetRenderer() {return _pRenderer; }; + vtkRenderWindow* QuantSurfaceWidget_GetRenderWindow() {return _pRenderWindow; }; + +protected: + + vtkDataSetMapper *_3DSliceMapper; + vtkActor *_3DSliceActor; + + RectangleGuideVtk *_hs_rectGuide; + RectangleGuideVtk *_s1_rectGuide; + RectangleGuideVtk *_s2_rectGuide; + RectangleGuideVtk *_sA_rectGuide; + RectangleGuideVtk *_sB_rectGuide; + + vtkWindowLevelLookupTable* _bwlookup; + vtkLookupTable* _collookup; + + +private: + + int _analysisTypeStenosis; + listContourVTK *_lstContVtk; + listContourVTK *_lstContHealtyVtk; + +// DECLARE_EVENT_TABLE( ); + void Set3DSliceActor( RectangleGuideVtk *_rectGuide ,float scale, int k,int r,int g,int b); +}; + +#endif //__VTK3DQUANTSURFACEWIDGET__ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceSTLWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceSTLWidget.cxx new file mode 100644 index 0000000..0acfb7d --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceSTLWidget.cxx @@ -0,0 +1,817 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: vtk3DSurfaceSTLWidget.cxx,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:41 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + +#include "vtkClosePolyData.h" + +#include +#include +#include +#include +#include +#include +#include +//For STL +#include +#include +#include +#include +//For rubber stuff: +#include +#include +#include +#include + +#include "vtk3DSurfaceSTLWidget.h" + +#include "volume.hxx" +#include "marInterface.h" +#include "matrix.h" + + + +/** + * Again wxVTK is an hybrid class, double click was done using wxWindows, simply + * because VTK doesn't provide such facility (as opposed to wheel support that is + * supposed to be merged in VTK trunk sooner or later: + * + * http://public.kitware.com/pipermail/vtkusers/2003-August/019548.html + * http://www.creatis.insa-lyon.fr/~malaterre/vtk/wheel.patch + */ + +//---------------------------------------------------------------------------- +BEGIN_EVENT_TABLE( vtk3DSurfaceSTLWidget, wxVTKRenderWindowInteractor ) +//EED EVT_LEFT_DCLICK( vtk3DSurfaceSTLWidget::OnLeftDClick ) +END_EVENT_TABLE( ); + +//---------------------------------------------------------------------------- +vtk3DSurfaceSTLWidget::vtk3DSurfaceSTLWidget( + wxWindow* parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) + : wxVTKRenderWindowInteractor( parent, id, pos, size, style, name ){ + + + //make current interactor style be trackbal camera, asked by radiologists. +// vtkInteractorStyleSwitch *iss = dynamic_cast(this->GetInteractorStyle()); +// iss->SetCurrentStyleToTrackballCamera(); + + + vtkInteractorStyle3DMaracas *interactorStyle3DMaracas = vtkInteractorStyle3DMaracas::New(); + interactorStyle3DMaracas->SetInteractor (this); + this->SetInteractorStyle(interactorStyle3DMaracas); + + + _pRenderer = vtkRenderer::New( ); + InitialSphere = 0; + _centralLine = NULL; + _centralLineMapper = NULL; + _centralLineActor = NULL; + _axesMapper = NULL; + _axesActor = NULL; + for(int i=0; i<4; i++) + { + _spheres[ i ] = NULL; + _spheresMapper[ i ] = NULL; + _spheresActor[ i ] = NULL; + } + _axesActor = NULL; + _axesMapper = NULL; + _psc = NULL; + _stlExternalVessel = _stlInternalVessel = NULL; + _surfMapper = NULL; + _actorExternalVessel= _actorVessel = NULL; + _iasc = NULL; +} +//---------------------------------------------------------------------------- +vtk3DSurfaceSTLWidget::~vtk3DSurfaceSTLWidget() +{ + //good luck: + if( _outActor ) _outActor ->Delete( ); + if( _outMapper ) _outMapper ->Delete( ); + if( _outLine ) _outLine ->Delete( ); + if( _surfActor ) _surfActor ->Delete( ); + if( _surfMapper ) _surfMapper ->Delete( ); + if( _mCubes ) _mCubes ->Delete( ); + if( _centralLine ) _centralLine ->Delete( ); + if( _centralLineMapper ) _centralLineMapper->Delete( ); + if( _centralLineActor ) _centralLineActor ->Delete( ); + if( _axesActor ) _axesActor ->Delete(); + if( _axesMapper ) _axesMapper ->Delete(); + if( _actorVessel ) _actorVessel ->Delete(); + if( _actorExternalVessel )_actorExternalVessel->Delete(); +// if( _stlExternalVessel ) _stlExternalVessel->Delete(); +// if( _stlInternalVessel ) _stlInternalVessel->Delete(); + if( _psc ) _psc ->Delete(); + if(_iasc) _iasc ->Delete(); + for(int i=0; i<4; i++) + { + if( _spheres[ i ] ) _spheres[ i ] ->Delete( ); + if( _spheresMapper[ i ] ) _spheresMapper[ i ] ->Delete( ); + if( _spheresActor[ i ] ) _spheresActor[ i ] ->Delete( ); + } + if( _pRenderer ) _pRenderer ->Delete( ); +} + +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::SetSurfaceColor( float red, float green, float blue ) +{ + _surfActor->GetProperty()->SetColor(red, green, blue ); + _pRenderWindow->Render(); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::SetSurfaceVisibility( bool visible ) +{ + _surfActor->SetVisibility( visible ); + _pRenderWindow->Render(); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::SetSTLSurfaceVisibility( bool intvisible , bool extvisible) +{ + ///\todo : STL visibility: both internal and external mold: + _actorVessel->SetVisibility( intvisible ); + _actorExternalVessel->SetVisibility( extvisible ); + _pRenderWindow->Render(); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::SetSurfaceIsoValue( int isoval ) +{ + _mCubes->SetValue(0, isoval); + _pRenderWindow->Render(); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::SetSurfaceOpacity( int opaval ) +{ + //There is no way in Win32 to specify a slider different than 0->100 + _surfActor->GetProperty()->SetOpacity( (float)opaval/100 ); + _pRenderWindow->Render(); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::GetSphereCenter( double center[3] ) +{ + _spheres[ 3 ]->GetCenter( center ); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::SetAxis( vtkPolyData *axis ) +{ + _axesMapper = vtkPolyDataMapper::New( ); + _axesMapper->SetInput( axis ); + axis->Delete(); + + _axesActor = vtkActor::New( ); + _axesActor->SetMapper( _axesMapper ); + _axesActor->GetProperty()->SetColor( 1, 0, 0 ); + _pRenderer->AddActor( _axesActor ); + + _pRenderWindow->Render( ); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::RemoveAxis( ) +{ + if (_axesActor) + { + _pRenderer->RemoveActor(_axesActor); + _axesActor->Delete(); + _axesActor = NULL; + _pRenderWindow->Render( ); + } +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::SetCuttingMode( bool mode ) +{ + if( mode ) + { + //start rubber/cutter mode + if(!_iasc) + { + _iasc = vtkInteractorStyleCutter::New(); + } + this->SetInteractorStyle( _iasc ); + } + else + { + /** + * Copy / paste from vtkPolyDataCutter + */ + if( _iasc ) + { + _iasc->VisibilityOff(); //turn off the vtkInteractorStyleCutter + vtkImplicitSelectionLoop *loop = vtkImplicitSelectionLoop::New(); + loop->SetLoop( _iasc->GetLoopPoints() ); + loop->SetNormal( _iasc->GetDirection() ); + + vtkTriangleFilter *tf = vtkTriangleFilter::New(); + tf->SetInput( _stlInternalVessel ); + + vtkExtractPolyDataGeometry *extract = vtkExtractPolyDataGeometry::New (); + extract->SetInput ( tf->GetOutput()); + extract->SetImplicitFunction ( loop ); + extract->ExtractInsideOff (); + extract->ExtractBoundaryCellsOff (); + tf->Delete(); + loop->Delete(); + + //#connectivity filter to keep only the largest part + vtkPolyDataConnectivityFilter *connect = vtkPolyDataConnectivityFilter::New(); + connect->SetInput( extract->GetOutput() ); + connect->SetExtractionModeToLargestRegion (); + extract->Delete(); + + vtkClosePolyData *close = vtkClosePolyData::New(); + close->SetInput( connect->GetOutput() ); + connect->Delete(); + + vtkStripper *strip = vtkStripper::New(); + strip->SetInput( close->GetOutput() ); + close->Delete(); + + //If vtkClosePolyData was well written we wouldn't had to recompute the normals + vtkPolyDataNormals *normals = vtkPolyDataNormals::New(); + normals->SetInput( strip->GetOutput() ); + strip->Delete(); + + /*vtkPolyDataWriter *polywriter = vtkPolyDataWriter::New(); + polywriter->SetInput( normals->GetOutput() ); + polywriter->SetFileName( "cutter.vtk" ); + polywriter->SetFileTypeToBinary(); + polywriter->Write(); + polywriter->Delete();*/ + + normals->Update(); //important before a ShallowCopy Or DeepCopy + _stlInternalVessel->DeepCopy( normals->GetOutput() ); //Use DeepCopy when using ShallowCopy afterwards + + tf->SetInput( _stlExternalVessel ); + normals->Update(); //important before a ShallowCopy + _stlExternalVessel->ShallowCopy( normals->GetOutput() ); + _pRenderWindow->Render( ); + } + //make current interactor style be trackbal camera, asked by radiologists. + vtkInteractorStyleTrackballCamera *istc = vtkInteractorStyleTrackballCamera::New(); + this->SetInteractorStyle( istc ); + istc->Delete(); + } + +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::ExportSurfaceAsSTL( const char* fileprefix ) +{ + std::string prefix; + + //Now save for real in STL format + //Don't forget to go through a triangle filter + vtkTriangleFilter *triangle = vtkTriangleFilter::New(); + triangle->SetInput( _stlInternalVessel ); + //In difficult case (such as BESSON) mesh can be more than one piece: + vtkPolyDataConnectivityFilter *pdcf = vtkPolyDataConnectivityFilter::New(); + pdcf->SetInput( triangle->GetOutput() ); + //In difficult case (such as BESSON) mesh can still be open...close it ! + vtkClosePolyData *close = vtkClosePolyData::New(); + close->SetInput( pdcf->GetOutput() ); + + vtkSTLWriter *internal_mold_stl = vtkSTLWriter::New(); + internal_mold_stl->SetInput( close->GetOutput() ); + prefix = fileprefix; + prefix += "-internal.stl"; + internal_mold_stl->SetFileName( prefix.c_str() ); + internal_mold_stl->SetFileTypeToBinary(); + internal_mold_stl->Write(); + internal_mold_stl->Delete(); + + //convert to triangles first: + triangle->SetInput( _stlExternalVessel ); + + vtkSTLWriter *external_mold_stl = vtkSTLWriter::New(); + external_mold_stl->SetInput( close->GetOutput() ); + prefix = fileprefix; + prefix += "-external.stl"; + external_mold_stl->SetFileName( prefix.c_str() ); + external_mold_stl->SetFileTypeToBinary(); + external_mold_stl->Write(); + external_mold_stl->Delete(); + + triangle->Delete(); + close->Delete(); + pdcf->Delete(); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::ShowMARACASData( marInterface* mar ){ + int whd[3]; + double minmax[2]; + + _mar = mar; + _marImageData = _mar->_experiment->getDynData( )->getVolume( )->castVtk(); + _marImageData->GetDimensions( whd ); + _width = whd[0]; + _height = whd[1]; + _depth = whd[2]; + + _marImageData->GetScalarRange( minmax ); + + //Outline v2: + // An outline provides context around the data. + _outLine = vtkOutlineFilter::New( ); + _outLine->SetInput( _marImageData ); + _outMapper = vtkPolyDataMapper::New( ); + _outMapper->SetInput( _outLine->GetOutput( ) ); + _outActor = vtkActor::New( ); + _outActor->SetMapper( _outMapper ); + _outActor->GetProperty( )->SetColor( 0.7, 0.0, 0.9 ); + //_outActor->PickableOff( ); + _pRenderer->AddActor( _outActor ); + + // Surface + _mCubes = vtkMarchingCubes::New( ); + _surfMapper = vtkPolyDataMapper::New( ); + _surfActor = vtkActor::New( ); + + _mCubes->SetInput( _marImageData ); + _mCubes->SetValue( 0, minmax[1] / 4 ); + + vtkStripper *stripper = vtkStripper::New(); + stripper->SetInput( _mCubes->GetOutput( ) ); + + _surfMapper->SetInput( stripper->GetOutput() ); + _surfMapper->ScalarVisibilityOff( ); + stripper->Delete(); + + _surfActor->SetMapper( _surfMapper ); + _surfActor->PickableOff( ); + _surfActor->GetProperty( )->SetColor( 0.9803, 0.9215, 0.8392 ); + _surfActor->GetProperty( )->SetOpacity( 0.5 ); + _pRenderer->AddActor( _surfActor ); + + // 1. ParallelProjectionOn should be set after AddActor (otherwise call vtkRenderer::ResetCameraClippingRange + // 2. ParallelProjectionOn is *necessary* for the vtkImplicitSelectionLoop + // otherwise this give a cone instead of a cylinder cutting. + _pRenderer->GetActiveCamera()->ParallelProjectionOn(); + + this->ConfigureVTK( ); +} + +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::ShowMARACASDataAndAxe( marInterface* mar ){ + marAxis* temp; + vtkPolyData* allData; + + + this->ShowMARACASData( mar ); + + _pRenderer->SetBackground( 0.75, 0.75, 0.75 ); + + // Axis + _mar->_experiment->setAxis( 0 ); + temp = _mar->_experiment->getAxis( ); // ??? getActualAxis ?? + allData = temp->Draw( ); + this->SetAxis( allData ); +} + +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::SetInitialPoint( double* pickPoint, double* cameraPos ) +{ + gtm::TVector< double > pO( 3 ), pF( 3 ), pp( 3 ), cp( 3 ); + gtm::TVector< double > xc( 3 ); + gtm::TVector< double > x1( 3 ), n1( 3 ); + gtm::TVector< double > x2( 3 ), n2( 3 ); + gtm::TVector< double > tmp( 3 ); + double fac; + bool success = true; + + if( _centralLineActor ) + { + _pRenderer->RemoveActor( _centralLineActor ); + _centralLineActor->Delete( ); + } // fi + if( _centralLineMapper ) _centralLineMapper->Delete( ); + if( _centralLine ) _centralLine->Delete( ); + + _centralLine = NULL; + _centralLineMapper = NULL; + _centralLineActor = NULL; + + for(int i=0; i<4; i++) + { + if( _spheresActor[ i ] ) + { + _pRenderer->RemoveActor( _spheresActor[ i ] ); + _spheresActor[ i ]->Delete( ); + } // fi + if( _spheresMapper[ i ] ) _spheresMapper[ i ]->Delete( ); + if( _spheres[ i ] ) _spheres[ i ]->Delete( ); + _spheres[ i ] = NULL; + _spheresMapper[ i ] = NULL; + _spheresActor[ i ] = NULL; + } //rof + + fac = GTM_MAX( _width, _height ); + fac = 2 * GTM_MAX( fac, _depth ); + pp( 0 ) = pickPoint[ 0 ]; pp( 1 ) = pickPoint[ 1 ]; pp( 2 ) = pickPoint[ 2 ]; + cp( 0 ) = cameraPos[ 0 ]; cp( 1 ) = cameraPos[ 1 ]; cp( 2 ) = cameraPos[ 2 ]; + + if( this->FindCubePointsFromPoints( + pO.GetAnsiRef( ), pF.GetAnsiRef( ), + pp.GetAnsiRef( ), cp.GetAnsiRef( ) + ) ) { + + if( this->GetPointAndNormalIntersection( + x1.GetAnsiRef( ), n1.GetAnsiRef( ), + pO.GetAnsiRef( ), pF.GetAnsiRef( ) + ) ) { + + if( this->GetPointAndNormalIntersection( + x2.GetAnsiRef( ), n2.GetAnsiRef( ), + ( x1 - n1 ).GetAnsiRef( ), ( x1 - ( n1 * fac ) ).GetAnsiRef( ) + ) ) { + + xc = ( x2 + x1 ) * 0.5; + _mar->_experiment->setStartPoint( (int)xc( 0 ), (int)xc( 1 ), (int)xc( 2 ) ); + + for(int i=0; i<4; i++) + { + _spheres[ i ] = vtkSphereSource::New( ); + _spheresMapper[ i ] = vtkPolyDataMapper::New( ); + _spheresMapper[ i ]->SetInput( _spheres[ i ]->GetOutput( ) ); + _spheresActor[ i ] = vtkActor::New( ); + _spheresActor[ i ]->SetMapper( _spheresMapper[ i ] ); + _spheresActor[ i ]->PickableOff( ); + _pRenderer->AddActor( _spheresActor[ i ] ); + } + + _spheres[ 0 ]->SetCenter( x1( 0 ), x1( 1 ), x1( 2 ) ); + _spheres[ 1 ]->SetCenter( x2( 0 ), x2( 1 ), x2( 2 ) ); + _spheres[ 2 ]->SetCenter( xc( 0 ), xc( 1 ), xc( 2 ) ); + _spheres[ 3 ]->SetCenter( xc( 0 ), xc( 1 ), xc( 2 ) ); + + _spheres[ 0 ]->SetRadius( 0.5 ); + _spheres[ 1 ]->SetRadius( 0.5 ); + _spheres[ 2 ]->SetRadius( 0.5 ); + _spheres[ 3 ]->SetRadius( ( xc - x1 ).GetNorm( ) ); + + _spheresActor[ 0 ]->GetProperty( )->SetColor( 1.0, 0.0, 0.0 ); + _spheresActor[ 1 ]->GetProperty( )->SetColor( 0.0, 1.0, 0.0 ); + _spheresActor[ 2 ]->GetProperty( )->SetColor( 0.0, 0.0, 1.0 ); + _spheresActor[ 3 ]->GetProperty( )->SetColor( 1.0, 0.0, 0.0 ); + _spheresActor[ 3 ]->GetProperty( )->SetOpacity( 0.3 ); + + vtkPoints* points = vtkPoints::New( ); + points->InsertNextPoint( x1.GetAnsiRef( ) ); + points->InsertNextPoint( x2.GetAnsiRef( ) ); + + vtkCellArray* array = vtkCellArray::New( ); + array->InsertNextCell( 2 ); + array->InsertCellPoint( 0 ); + array->InsertCellPoint( 1 ); + + _centralLine = vtkPolyData::New( ); + _centralLine->SetPoints( points ); + _centralLine->SetLines( array ); + points->Delete(); + array->Delete(); + + _centralLineMapper = vtkPolyDataMapper::New( ); + _centralLineMapper->SetInput( _centralLine ); + + _centralLineActor = vtkActor::New( ); + _centralLineActor->SetMapper( _centralLineMapper ); + _centralLineActor->GetProperty( )->SetColor( 1.0, 1.0, 1.0 ); + _centralLineActor->PickableOff( ); + _pRenderer->AddActor( _centralLineActor ); + + } // fi + + } else success = false; + + } else success = false; + + // Show a message, if any. + if( !success ) + wxMessageBox( + _T("Error: Initial point can't be set.\nPlease choose another point."), + _T("Error"), wxOK | wxCENTRE | wxICON_HAND, this + ); + + // Finish + _pRenderWindow->Render( ); + InitialSphere = success; +} + +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::SetInitialPoint( double* point ) +{ +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::ConfigureVTK( ) +{ + // get render window + _pRenderWindow = this->GetRenderWindow( ); + + // connect renderer and render window and configure render window + _pRenderWindow->AddRenderer( _pRenderer ); + + // configure renderer + _pRenderer->SetBackground( 0.0, 0.0, 0.0 ); + //_pRenderer->SetBackground( 1, 1, 0); //FIXME + _pRenderer->GetActiveCamera( )->Zoom( 1.0 ); + _pRenderer->GetActiveCamera( )->SetClippingRange( 1, 1000 ); +} + + +//---------------------------------------------------------------------------- +bool vtk3DSurfaceSTLWidget::IntersectPlaneWithLine( double* p, double* x1, double* x2, double* x3, double* x4, double* x5 ) +{ + gtm::TVector< double > vx1( 3 ), vx2( 3 ), vx3( 3 ); + gtm::TVector< double > vx4( 3 ), vx5( 3 ), vx6( p, 3, false ); + gtm::TMatrix< double > mU( 4, 4 ), mD( 4, 4 ); + double t; + bool ret; + + vx1 = x1; + vx2 = x2; + vx3 = x3; + vx4 = x4; + vx5 = x5; + vx6 = vx5 - vx4; + + mD( 0, 0 ) = mU( 0, 0 ) = 1; + mD( 0, 1 ) = mU( 0, 1 ) = vx1( 0 ); + mD( 0, 2 ) = mU( 0, 2 ) = vx1( 1 ); + mD( 0, 3 ) = mU( 0, 3 ) = vx1( 2 ); + mD( 1, 0 ) = mU( 1, 0 ) = 1; + mD( 1, 1 ) = mU( 1, 1 ) = vx2( 0 ); + mD( 1, 2 ) = mU( 1, 2 ) = vx2( 1 ); + mD( 1, 3 ) = mU( 1, 3 ) = vx2( 2 ); + mD( 2, 0 ) = mU( 2, 0 ) = 1; + mD( 2, 1 ) = mU( 2, 1 ) = vx3( 0 ); + mD( 2, 2 ) = mU( 2, 2 ) = vx3( 1 ); + mD( 2, 3 ) = mU( 2, 3 ) = vx3( 2 ); + mU( 3, 0 ) = 1; + mU( 3, 1 ) = vx4( 0 ); + mU( 3, 2 ) = vx4( 1 ); + mU( 3, 3 ) = vx4( 2 ); + mD( 3, 0 ) = 0; + mD( 3, 1 ) = vx6( 0 ); + mD( 3, 2 ) = vx6( 1 ); + mD( 3, 3 ) = vx6( 2 ); + + ret = ( mD.Det( ) != 0 ); + if( ret ) { + + t = mU.Det( ) / mD.Det( ); + vx6 = ( ( vx4 - vx5 ) * t ) + vx4; + + } // fi + return( ret ); + +} + +//---------------------------------------------------------------------------- +bool vtk3DSurfaceSTLWidget::FindCubePointsFromPoints( double* pO, double* pF, double* pickPoint, double* cameraPos ) +{ + gtm::TVector< double > p1( 3 ), p2( 3 ), p3( 3 ), p4( 3 ), p5( 3 ), p6( 3 ); + gtm::TVector< double > c( 3 ); + gtm::TVector< double >* swp; + gtm::TVector< double > tpO( pO, 3, false ), tpF( pF, 3, false ); + std::vector< gtm::TVector< double >* > points; + double x1[ 3 ], x2[ 3 ], x3[ 3 ], d1, d2; + int i, j; + + // 1st plane intersection + x1[ 0 ] = 0; x1[ 1 ] = _height; x1[ 2 ] = 0; + x2[ 0 ] = 0; x2[ 1 ] = 0; x2[ 2 ] = 0; + x3[ 0 ] = 0; x3[ 1 ] = 0; x3[ 2 ] = _depth; + if( this->IntersectPlaneWithLine( p1.GetAnsiRef( ), x1, x2, x3, cameraPos, pickPoint ) ) + points.push_back( &p1 ); + + // 2nd plane intersection + x1[ 0 ] = 0; x1[ 1 ] = _height; x1[ 2 ] = _depth; + x2[ 0 ] = 0; x2[ 1 ] = 0; x2[ 2 ] = _depth; + x3[ 0 ] = _width; x3[ 1 ] = 0; x3[ 2 ] = _depth; + if( this->IntersectPlaneWithLine( p2.GetAnsiRef( ), x1, x2, x3, cameraPos, pickPoint ) ) + points.push_back( &p2 ); + + // 3rd plane intersection + x1[ 0 ] = 0; x1[ 1 ] = 0; x1[ 2 ] = _depth; + x2[ 0 ] = 0; x2[ 1 ] = 0; x2[ 2 ] = 0; + x3[ 0 ] = _width; x3[ 1 ] = 0; x3[ 2 ] = 0; + if( this->IntersectPlaneWithLine( p3.GetAnsiRef( ), x1, x2, x3, cameraPos, pickPoint ) ) + points.push_back( &p3 ); + + // 4th plane intersection + x1[ 0 ] = _width; x1[ 1 ] = _height; x1[ 2 ] = _depth; + x2[ 0 ] = _width; x2[ 1 ] = 0; x2[ 2 ] = _depth; + x3[ 0 ] = _width; x3[ 1 ] = 0; x3[ 2 ] = 0; + if( this->IntersectPlaneWithLine( p4.GetAnsiRef( ), x1, x2, x3, cameraPos, pickPoint ) ) + points.push_back( &p4 ); + + // 5th plane intersection + x1[ 0 ] = _width; x1[ 1 ] = 0; x1[ 2 ] = 0; + x2[ 0 ] = 0; x2[ 1 ] = 0; x2[ 2 ] = 0; + x3[ 0 ] = 0; x3[ 1 ] = _height; x3[ 2 ] = 0; + if( this->IntersectPlaneWithLine( p5.GetAnsiRef( ), x1, x2, x3, cameraPos, pickPoint ) ) + points.push_back( &p5 ); + + // 6th plane intersection + x1[ 0 ] = 0; x1[ 1 ] = _height; x1[ 2 ] = 0; + x2[ 0 ] = 0; x2[ 1 ] = _height; x2[ 2 ] = _depth; + x3[ 0 ] = _width; x3[ 1 ] = _height; x3[ 2 ] = _depth; + if( this->IntersectPlaneWithLine( p6.GetAnsiRef( ), x1, x2, x3, cameraPos, pickPoint ) ) + points.push_back( &p6 ); + + if( points.size( ) >= 2 ) { // Did I find at least 2 points? + + c( 0 ) = ( double )_width / 2.0; + c( 1 ) = ( double )_height / 2.0; + c( 2 ) = ( double )_depth / 2.0; + + // Sort with bubble sort. Only 30 iterations! + for( i = 0; i < points.size( ); i++ ) { + for( j = 0; j < points.size( ) - 1; j++ ) { + + d1 = ( c - *points[ j ] ).GetNorm( ); + d2 = ( c - *points[ j + 1 ] ).GetNorm( ); + if( d2 < d1 ) { + + swp = points[ j ]; + points[ j ] = points[ j + 1 ]; + points[ j + 1 ] = swp; + + } // fi + + } // rof + + } // rof + + // Order the two points according to distance to camera. + c = cameraPos; + d1 = ( c - *points[ 0 ] ).GetNorm( ); + d2 = ( c - *points[ 1 ] ).GetNorm( ); + tpO = ( d1 < d2 )? *points[ 0 ]: *points[ 1 ]; + tpF = ( d1 > d2 )? *points[ 0 ]: *points[ 1 ]; + return( true ); + + } else return( false ); + +} + +//---------------------------------------------------------------------------- +bool vtk3DSurfaceSTLWidget::GetPointAndNormalIntersection( double* p, double* n, double* pO, double* pF ) +{ + gtm::TVector< double > n1( 3 ), n2( 3 ), n3( 3 ); + int subId, cellId, returnVal; + double t, pcoords[ 3 ], x[ 3 ]; + double fpO[ 3 ], fpF[ 3 ]; + double p1[ 3 ], p2[ 3 ], p3[ 3 ]; + vtkPolyData* data = _mCubes->GetOutput( ); + vtkCellLocator* locator = vtkCellLocator::New( ); + + locator->SetDataSet( data ); + locator->Initialize( ); + locator->Update( ); + + fpO[ 0 ] = pO[ 0 ]; fpO[ 1 ] = pO[ 1 ]; fpO[ 2 ] = pO[ 2 ]; + fpF[ 0 ] = pF[ 0 ]; fpF[ 1 ] = pF[ 1 ]; fpF[ 2 ] = pF[ 2 ]; + returnVal = locator->IntersectWithLine( fpO, fpF, 0.1, t, x, pcoords, subId, cellId ); + locator->Delete( ); + + if( returnVal ) + { + vtkCell* cell = data->GetCell( cellId ); + vtkPoints* points = cell->GetPoints( ); + + data->GetPointData( )->GetNormals( )->GetTuple( cell->GetPointIds( )->GetId( 0 ), n1.GetAnsiRef( ) ); + data->GetPointData( )->GetNormals( )->GetTuple( cell->GetPointIds( )->GetId( 1 ), n2.GetAnsiRef( ) ); + data->GetPointData( )->GetNormals( )->GetTuple( cell->GetPointIds( )->GetId( 2 ), n3.GetAnsiRef( ) ); + + n1 += n2 + n3; + n1 *= ( 1.0 / 3.0 ); + n1.Normalize( ); + n[ 0 ] = n1( 0 ); n[ 1 ] = n1( 1 ); n[ 2 ] = n1( 2 ); + + points->GetPoint( 0, p1 ); + points->GetPoint( 1, p2 ); + points->GetPoint( 2, p3 ); + this->IntersectPlaneWithLine( p, p1, p2, p3, pO, pF ); + return( true ); + } else return( false ); + +} +//---------------------------------------------------------------------------- + /** + * What we are doing here is from a LFV marAxis to turn it into a vtkPolyData + * Therefore it should be a lot more easier to integrate in a real vtk class + * for filtering : vtkMaracasImageToSTL + */ +vtkPolyData* vtk3DSurfaceSTLWidget::ConvertMarAxisToPolyData() +{ + double p1[marAxis::INDX_count]; + //retrieve the actual axis + marAxis* ax = _mar->_experiment->getAxis(); + //Number of axis points + int numPoints = ax->getNumberOfControlPoints(); + + vtkPolyData *axis = vtkPolyData::New(); + vtkPoints *points = vtkPoints::New(); + vtkFloatArray *scalars = vtkFloatArray::New(); + scalars->SetNumberOfComponents (2); + //Field are : 1. radius (=INDX_RAYON) , 2. average (=INDX_SIGNALVALUE) + + double tmp1,tmp2; + for(int i=0; igetControlPoint(i, p1, p1+3); + points->InsertPoint(i, p1); + tmp1 = p1[marAxis::INDX_RAYON]; +// tmp2 = p1[marAxis::INDX_SIGNALVALUE]; + tmp2 = (double)ax->getSignal(i); + scalars->InsertTuple2(i,tmp1, tmp2); + + } + + // We now assign the pieces to the vtkPolyData. + axis->SetPoints(points); + points->Delete(); + axis->GetPointData()->SetScalars(scalars); + scalars->Delete(); + + return axis; +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::ConstructVessel( ) +{ + vtkPolyData *axis = this->ConvertMarAxisToPolyData( ); + + //retrieve the vtk image data + + if( !_psc) this->_psc = vtkImagePolyDataSeedConnectivity::New(); + this->_psc->SetInput( _marImageData ); + this->_psc->SetAxis( axis ); + this->_psc->Update(); + axis->Delete(); + +/* vtkStripper *strip = vtkStripper::New(); + strip->SetInput( this->_psc->GetOutput() ); //GetOutput() -> inner mold + strip->Update(); //Important before a ShallowCopy !!! + + if( !_stlInternalVessel) _stlInternalVessel = vtkPolyData::New(); + _stlInternalVessel->ShallowCopy( strip->GetOutput() ); + strip->Delete();*/ + _stlInternalVessel = this->_psc->GetOutput(); + +/* if( !_stlExternalVessel) _stlExternalVessel = vtkPolyData::New(); + _stlExternalVessel->ShallowCopy( this->_psc->GetOuterMold() ); + //this->_psc->GetOuterMold()->Delete();*/ + _stlExternalVessel = this->_psc->GetOuterMold(); + + vtkPolyDataMapper *dsm1 = vtkPolyDataMapper ::New(); + dsm1->SetInput ( _stlInternalVessel ); //fasten stuff + dsm1->ScalarVisibilityOff(); + + _actorVessel = vtkActor::New(); + _actorVessel->SetMapper (dsm1); + + //improve visibility: + _actorVessel->GetProperty()->SetColor (1,0,0); + + vtkPolyDataMapper *dsm2 = vtkPolyDataMapper ::New(); + dsm2->SetInput ( _stlExternalVessel ); + dsm2->ScalarVisibilityOff(); + + _actorExternalVessel = vtkActor::New(); + _actorExternalVessel->SetMapper (dsm2); + + //improve visibility: + _actorExternalVessel->GetProperty()->SetRepresentationToWireframe(); + + _pRenderer->AddActor( _actorVessel ); + _pRenderer->AddActor( _actorExternalVessel ); + _pRenderWindow->Render( ); + + dsm1->Delete(); + dsm2->Delete(); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceSTLWidget::SetSTLThresholdRatio(double ratio) +{ + this->_psc->SetThresholdRatio( (double)(ratio/100) ); + _pRenderWindow->Render( ); +} +//---------------------------------------------------------------------------- +float vtk3DSurfaceSTLWidget::GetSTLThreshold() +{ + return 100*this->_psc->GetThresholdRatio( ); +} +//---------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceSTLWidget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceSTLWidget.h new file mode 100644 index 0000000..1b5eb98 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceSTLWidget.h @@ -0,0 +1,136 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: vtk3DSurfaceSTLWidget.h,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:41 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +#ifndef __VTK3DSURFACESTLWIDGET__ +#define __VTK3DSURFACESTLWIDGET__ + +#include "wxVTKRenderWindowInteractorEditContour.h" + +#include "vtkImagePolyDataSeedConnectivity.h" +#include "vtkInteractorStyleCutter.h" +#include "kernel/marInterface.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * \brief Class that brigde to VTK, override double click... + */ +class vtk3DSurfaceSTLWidget : public wxVTKRenderWindowInteractor +{ +public: + + vtk3DSurfaceSTLWidget( + wxWindow* parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr + ); + ~vtk3DSurfaceSTLWidget(); + +//EED Borrame +// void OnLeftDClick( wxMouseEvent& event ); + + void ConfigureVTK( ); + + bool IntersectPlaneWithLine( double* p, double* x1, double* x2, double* x3, double* x4, double* x5 ); + bool FindCubePointsFromPoints( double* pO, double* pF, double* pickPoint, double* cameraPos ); + bool GetPointAndNormalIntersection( double* p, double* n, double* pO, double* pF ); + + void ShowMARACASData( marInterface* mar ); + void ShowMARACASDataAndAxe( marInterface* mar ); + void SetSurfaceColor(float red, float green, float blue ); + void SetSurfaceVisibility( bool visible ); + void SetSTLSurfaceVisibility( bool intvisible , bool extvisible); + void SetSurfaceIsoValue( int isoval ); + void SetSurfaceOpacity( int opaval ); + + void GetSphereCenter( double center[3] ); + void SetAxis( vtkPolyData *axis ); + void RemoveAxis( ); + + void ConstructVessel(); + void SetCuttingMode( bool mode ); + void ExportSurfaceAsSTL( const char* fileprefix ); + + ///\todo remove + vtkImageData *_marImageData; + vtkPolyData *_marPolyData; + + void SetSTLThresholdRatio(double ratio); + float GetSTLThreshold(); + vtkGetMacro(InitialSphere, int); + +protected: + + void SetInitialPoint( double* pickPoint, double* cameraPos ); + void SetInitialPoint( double* point ); + vtkPolyData* ConvertMarAxisToPolyData(); + + vtkImagePolyDataSeedConnectivity *_psc; + + marInterface *_mar; + vtkRenderer *_pRenderer; + vtkRenderWindow *_pRenderWindow; + vtkOutlineFilter *_outLine; + vtkPolyDataMapper *_outMapper; + vtkActor *_outActor; + vtkMarchingCubes *_mCubes; + vtkPolyDataMapper *_surfMapper; + vtkActor *_surfActor; + + vtkPolyData *_centralLine; + vtkPolyDataMapper *_centralLineMapper; + vtkActor *_centralLineActor; + + vtkSphereSource *_spheres[ 4 ]; + vtkPolyDataMapper *_spheresMapper[ 4 ]; + vtkActor *_spheresActor[ 4 ]; + + vtkPolyDataMapper *_axesMapper; + vtkActor *_axesActor; + + vtkActor *_actorVessel; + vtkActor *_actorExternalVessel; + //We should keep internal and external as different mesh to be able + //to save them in difference files at the end of process: + vtkPolyData *_stlInternalVessel; + vtkPolyData *_stlExternalVessel; + vtkInteractorStyleCutter *_iasc; + +private: + + int _width; + int _height; + int _depth; + int InitialSphere; + + DECLARE_EVENT_TABLE( ); + +}; + +#endif //__VTK3DSURFACESTLWIDGET__ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceWidget.cxx new file mode 100644 index 0000000..103aaa7 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceWidget.cxx @@ -0,0 +1,515 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: vtk3DSurfaceWidget.cxx,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:41 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +#include "vtk3DSurfaceWidget.h" +#include "../marDictionary.h" +#include +#include +#include +#include +#include +#include +#include +#include "matrix.h" + + +#include "UtilVtk3DGeometriSelection.h" + + + +/** + * Again wxVTK is an hybrid class, double click was done using wxWindows, simply + * because VTK doesn't provide such facility (as opposed to wheel support that is + * supposed to be merged in VTK trunk sooner or later: + * + * http://public.kitware.com/pipermail/vtkusers/2003-August/019548.html + * http://www.creatis.insa-lyon.fr/~malaterre/vtk/wheel.patch + */ + +//---------------------------------------------------------------------------- +BEGIN_EVENT_TABLE( vtk3DSurfaceWidget, wxVTKRenderWindowInteractor ) + EVT_LEFT_DCLICK( vtk3DSurfaceWidget::OnLeftDClick ) + EVT_MOUSEWHEEL( vtk3DSurfaceWidget::OnMouseWheel ) +END_EVENT_TABLE( ); + +//---------------------------------------------------------------------------- +vtk3DSurfaceWidget::vtk3DSurfaceWidget( wxWindow* parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name) + : wxVTKRenderWindowInteractor( parent, id, pos, size, style, name ) +{ + //make current interactor style be trackbal camera, asked by radiologists. + + /* + vtkInteractorStyleSwitch *iss = dynamic_cast(this->GetInteractorStyle()); + iss->SetCurrentStyleToTrackballCamera(); + */ + + + vtkInteractorStyle3DMaracas *interactorStyle3DMaracas = vtkInteractorStyle3DMaracas::New(); +// interactorStyle3DMaracas->SetInteractor (this); + this->SetInteractorStyle(interactorStyle3DMaracas); + + + _pRenderer = vtkRenderer::New( ); + InitialSphere = 0; + _centralLine = NULL; + _centralLineMapper = NULL; + _centralLineActor = NULL; + _axesMapper = NULL; + _axesActor = NULL; + for(int i=0; i<4; i++) { + _spheres[ i ] = NULL; + _spheresMapper[ i ] = NULL; + _spheresActor[ i ] = NULL; + } + _axesActor = NULL; + _axesMapper = NULL; + _surfActor = NULL; + _surfMapper = NULL; + _intVtkPanWid = NULL; + _outActor = NULL; + _outMapper = NULL; + _outLine = NULL; + _mCubes = NULL; +} +//---------------------------------------------------------------------------- +vtk3DSurfaceWidget::~vtk3DSurfaceWidget(){ + + //good luck: + if( _outActor ) _outActor -> Delete( ); + if( _outMapper ) _outMapper -> Delete( ); + if( _outLine ) _outLine -> Delete( ); + if( _surfActor ) _surfActor -> Delete( ); + if( _surfMapper ) _surfMapper -> Delete( ); + if( _mCubes ) _mCubes -> Delete( ); + if( _centralLine ) _centralLine -> Delete( ); + if( _centralLineMapper ) _centralLineMapper -> Delete( ); + if( _centralLineActor ) _centralLineActor -> Delete( ); + if( _axesActor ) _axesActor -> Delete(); + if( _axesMapper ) _axesMapper -> Delete(); + for(int i=0; i<4; i++) + { + if( _spheres[ i ] ) _spheres[ i ] ->Delete( ); + if( _spheresMapper[ i ] ) _spheresMapper[ i ] ->Delete( ); + if( _spheresActor[ i ] ) _spheresActor[ i ] ->Delete( ); + } + if( _pRenderer ) _pRenderer -> Delete( ); +} + + + +//---------------------------------------------------------------------------- +// virtual +void vtk3DSurfaceWidget::OnMouseWheel( wxMouseEvent& event ){ + if (_intVtkPanWid!=NULL) { _intVtkPanWid->CallBackOnMouseWheel(event);} +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::OnLeftDClick( wxMouseEvent& event ){ + double pp[ 3 ], cp[ 3 ]; + int eventrwi[2]; + vtkPointPicker* picker = vtkPointPicker::New( ); + this->GetEventPosition( eventrwi ); + picker->Pick( eventrwi[0], eventrwi[1], 0.0, _pRenderer ); + _pRenderer->GetActiveCamera( )->GetPosition( cp ); + picker->GetPickPosition( pp ); + + picker->Delete( ); + this->SetLast3DClickPoint( pp, cp ); + if (_intVtkPanWid!=NULL) { _intVtkPanWid->CallBackOnLeftDClick(event); } +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::GetLast3DClickPoint( double *pp, double *cp ){ + pp[0]=_lastPickPoint[0]; + pp[1]=_lastPickPoint[1]; + pp[2]=_lastPickPoint[2]; + cp[0]=_lastCameraPos[0]; + cp[1]=_lastCameraPos[1]; + cp[2]=_lastCameraPos[2]; +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::SetLast3DClickPoint( double *pp, double *cp ){ + _lastPickPoint[0]=pp[0]; + _lastPickPoint[1]=pp[1]; + _lastPickPoint[2]=pp[2]; + _lastCameraPos[0]=cp[0]; + _lastCameraPos[1]=cp[1]; + _lastCameraPos[2]=cp[2]; +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::Render( ){ + _pRenderWindow->Render(); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::InitCameraReset( ){ + _pRenderer->ResetCameraClippingRange(); + vtkCamera *cam=_pRenderer->GetActiveCamera(); + cam->Zoom(1.8); +// EED 31 Mai 2007 +// Render(); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::SetSurfaceColor( float red, float green, float blue ) +{ + _surfActor->GetProperty()->SetColor(red, green, blue ); + _pRenderWindow->Render(); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::SetSurfaceVisibility( bool visible ) +{ + _surfActor->SetVisibility( visible ); + _pRenderWindow->Render(); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::SetSurfaceIsoValue( int isoval ) +{ + _mCubes->SetValue(0, isoval); + _pRenderWindow->Render(); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::SetSurfaceOpacity( int opaval ) +{ + //There is no way in Win32 to specify a slider different than 0->100 + _surfActor->GetProperty()->SetOpacity( (double)opaval/100.0 ); + _pRenderWindow->Render(); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::GetSphereCenter( double center[3] ) +{ + _spheres[ 3 ]->GetCenter( center ); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::SetAxis( vtkPolyData *axis ) +{ + _axesMapper = vtkPolyDataMapper::New( ); + _axesMapper->SetInput( axis ); + _axesMapper->Update(); + //axis->Delete(); + + _axesActor = vtkActor::New( ); + _axesActor->SetMapper( _axesMapper ); + _axesActor->GetProperty()->SetColor( 1, 0, 0 ); + _axesActor->GetProperty()->SetLineWidth( 2.0 ); + _pRenderer->AddActor( _axesActor ); + + //Generate a new vtkwindow ??? +//EED 31 Mai 2007 +// _pRenderWindow->Render( ); + } +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::RemoveAxis( ) +{ + if (_axesActor) + { + _pRenderer->RemoveActor(_axesActor); + _axesActor->Delete(); + _axesActor = NULL; + _pRenderWindow->Render( ); + } +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::ShowMARACASData( marInterface* mar ){ + int whd[3]; + + _mar = mar; + _marImageData = _mar->_experiment->getDynData( )->getVolume( )->castVtk(); + _marImageData->GetDimensions( whd ); + _width = whd[0]; + _height = whd[1]; + _depth = whd[2]; + + _marImageData->GetScalarRange( _range ); + + //Outline v2: + // An outline provides context around the data. + _outLine = vtkOutlineFilter::New( ); + _outLine->SetInput( _marImageData ); + _outMapper = vtkPolyDataMapper::New( ); + _outMapper->SetInput( _outLine->GetOutput( ) ); + _outActor = vtkActor::New( ); + _outActor->SetMapper( _outMapper ); + _outActor->GetProperty( )->SetColor( 0.7, 0.0, 0.9 ); + //_outActor->PickableOff( ); + _pRenderer->AddActor( _outActor ); + + // Surface + _mCubes = vtkMarchingCubes::New( ); + _surfMapper = vtkPolyDataMapper::New( ); + _surfActor = vtkActor::New( ); + + _mCubes->SetInput( _marImageData ); + _mCubes->SetValue( 0, _range[1] / 4 ); + + vtkStripper *stripper = vtkStripper::New(); + stripper->SetInput( _mCubes->GetOutput( ) ); + + _surfMapper->SetInput( stripper->GetOutput() ); + _surfMapper->ScalarVisibilityOff( ); + stripper->Delete(); + + _surfActor->SetMapper( _surfMapper ); + _surfActor->PickableOff( ); + _surfActor->GetProperty( )->SetColor( 0.9803, 0.9215, 0.8392 ); + _surfActor->GetProperty( )->SetOpacity( 0.5 ); + _pRenderer->AddActor( _surfActor ); + + // 1. ParallelProjectionOn should be set after AddActor (otherwise call vtkRenderer::ResetCameraClippingRange + // 2. ParallelProjectionOn is *necessary* for the vtkImplicitSelectionLoop + // otherwise this give a cone instead of a cylinder cutting. + _pRenderer->GetActiveCamera()->ParallelProjectionOn(); + +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::ShowMARACASDataCT( marInterfaceCT* mar ){ + int whd[3]; + + + _marCT = mar; + _marImageData = _marCT->getDynData()->getVolume()->castVtk(); + _marImageData->GetDimensions( whd ); + _width = whd[0]; + _height = whd[1]; + _depth = whd[2]; + + _marImageData->GetScalarRange( _range ); + + int a = (_marCT->GetExperiment())->getQuantStart(); + //Outline v2: + // An outline provides context around the data. + _outLine = vtkOutlineFilter::New( ); + _outLine->SetInput( _marImageData ); + _outMapper = vtkPolyDataMapper::New( ); + _outMapper->SetInput( _outLine->GetOutput( ) ); + _outActor = vtkActor::New( ); + _outActor->SetMapper( _outMapper ); + _outActor->GetProperty( )->SetColor( 0.7, 0.0, 0.9 ); + //_outActor->PickableOff( ); + _pRenderer->AddActor( _outActor ); + + // Surface + _mCubes = vtkMarchingCubes::New( ); + _surfMapper = vtkPolyDataMapper::New( ); + _surfActor = vtkActor::New( ); + + _mCubes->SetInput( _marImageData ); + _mCubes->SetValue( 0, _range[1] / 4 ); + + vtkStripper *stripper = vtkStripper::New(); + stripper->SetInput( _mCubes->GetOutput( ) ); + + _surfMapper->SetInput( stripper->GetOutput() ); + _surfMapper->ScalarVisibilityOff( ); + stripper->Delete(); + + _surfActor->SetMapper( _surfMapper ); + _surfActor->PickableOff( ); + _surfActor->GetProperty( )->SetColor( 0.9803, 0.9215, 0.8392 ); + _surfActor->GetProperty( )->SetOpacity( 0.5 ); + _pRenderer->AddActor( _surfActor ); + + // 1. ParallelProjectionOn should be set after AddActor (otherwise call vtkRenderer::ResetCameraClippingRange + // 2. ParallelProjectionOn is *necessary* for the vtkImplicitSelectionLoop + // otherwise this give a cone instead of a cylinder cutting. + _pRenderer->GetActiveCamera()->ParallelProjectionOn(); + +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::SetInitialPoint(){ + this->SetInitialPoint( _lastPickPoint, _lastCameraPos ); +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::SetInitialPoint( float* pickPoint, float* cameraPos ){ + marDictionary marDict; + char ttmp[256]; + + gtm::TVector< double > pO( 3 ), pF( 3 ), pp( 3 ), cp( 3 ); + gtm::TVector< double > xc( 3 ); + gtm::TVector< double > x1( 3 ), n1( 3 ); + gtm::TVector< double > x2( 3 ), n2( 3 ); + gtm::TVector< double > tmp( 3 ); + double fac; + bool success = true; + int notSuccessType = 0; + + if( _centralLineActor ) + { + _pRenderer->RemoveActor( _centralLineActor ); + _centralLineActor->Delete( ); + } // fi + if( _centralLineMapper ) _centralLineMapper->Delete( ); + if( _centralLine ) _centralLine->Delete( ); + + _centralLine = NULL; + _centralLineMapper = NULL; + _centralLineActor = NULL; + + for(int i=0; i<4; i++) + { + if( _spheresActor[ i ] ) + { + _pRenderer->RemoveActor( _spheresActor[ i ] ); + _spheresActor[ i ]->Delete( ); + } // fi + if( _spheresMapper[ i ] ) _spheresMapper[ i ]->Delete( ); + if( _spheres[ i ] ) _spheres[ i ]->Delete( ); + _spheres[ i ] = NULL; + _spheresMapper[ i ] = NULL; + _spheresActor[ i ] = NULL; + } //rof + + fac = GTM_MAX( _width, _height ); + fac = 2 * GTM_MAX( fac, _depth ); + pp( 0 ) = pickPoint[ 0 ]; pp( 1 ) = pickPoint[ 1 ]; pp( 2 ) = pickPoint[ 2 ]; + cp( 0 ) = cameraPos[ 0 ]; cp( 1 ) = cameraPos[ 1 ]; cp( 2 ) = cameraPos[ 2 ]; + + + UtilVtk3DGeometriSelection utilVtk3DGeometriSelection; + utilVtk3DGeometriSelection.SetDimentions(_width,_height,_depth); + utilVtk3DGeometriSelection.SetMarchingCube(_mCubes); + + if( utilVtk3DGeometriSelection.FindCubePointsFromPoints( + pO.GetAnsiRef( ), pF.GetAnsiRef( ), + pp.GetAnsiRef( ), cp.GetAnsiRef( ) + ) ) { + + if( utilVtk3DGeometriSelection.GetPointAndNormalIntersection( + x1.GetAnsiRef( ), n1.GetAnsiRef( ), + pO.GetAnsiRef( ), pF.GetAnsiRef( ) + ) ) { + + if( utilVtk3DGeometriSelection.GetPointAndNormalIntersection( + x2.GetAnsiRef( ), n2.GetAnsiRef( ), + ( x1 - n1 ).GetAnsiRef( ), ( x1 - ( n1 * fac ) ).GetAnsiRef( ) + ) ) { + + xc = ( x2 + x1 ) * 0.5; + + + double dd=12; // EED ****** ATENTION **************** + + if (!( + (xc(0)_experiment->setStartPoint( (int)xc( 0 ), (int)xc( 1 ), (int)xc( 2 ) ); + _mar->_experiment->getParameters( )->setROIStep( 2*( xc - x1 ).GetNorm( ) ); + + for(int i=0; i<4; i++) + { + _spheres[ i ] = vtkSphereSource::New( ); + _spheresMapper[ i ] = vtkPolyDataMapper::New( ); + _spheresMapper[ i ]->SetInput( _spheres[ i ]->GetOutput( ) ); + _spheresActor[ i ] = vtkActor::New( ); + _spheresActor[ i ]->SetMapper( _spheresMapper[ i ] ); + _spheresActor[ i ]->PickableOff( ); + _pRenderer->AddActor( _spheresActor[ i ] ); + } + + _spheres[ 0 ]->SetCenter( x1( 0 ), x1( 1 ), x1( 2 ) ); + _spheres[ 1 ]->SetCenter( x2( 0 ), x2( 1 ), x2( 2 ) ); + _spheres[ 2 ]->SetCenter( xc( 0 ), xc( 1 ), xc( 2 ) ); + _spheres[ 3 ]->SetCenter( xc( 0 ), xc( 1 ), xc( 2 ) ); + + _spheres[ 0 ]->SetRadius( 0.5 ); + _spheres[ 1 ]->SetRadius( 0.5 ); + _spheres[ 2 ]->SetRadius( 0.5 ); + _spheres[ 3 ]->SetRadius( ( xc - x1 ).GetNorm( ) ); + + _spheresActor[ 0 ]->GetProperty( )->SetColor( 1.0, 0.0, 0.0 ); + _spheresActor[ 1 ]->GetProperty( )->SetColor( 0.0, 1.0, 0.0 ); + _spheresActor[ 2 ]->GetProperty( )->SetColor( 0.0, 0.0, 1.0 ); + _spheresActor[ 3 ]->GetProperty( )->SetColor( 1.0, 0.0, 0.0 ); + _spheresActor[ 3 ]->GetProperty( )->SetOpacity( 0.3 ); + + vtkPoints* points = vtkPoints::New( ); + points->InsertNextPoint( x1.GetAnsiRef( ) ); + points->InsertNextPoint( x2.GetAnsiRef( ) ); + + vtkCellArray* array = vtkCellArray::New( ); + array->InsertNextCell( 2 ); + array->InsertCellPoint( 0 ); + array->InsertCellPoint( 1 ); + + _centralLine = vtkPolyData::New( ); + _centralLine->SetPoints( points ); + _centralLine->SetLines( array ); + points->Delete(); + array->Delete(); + + _centralLineMapper = vtkPolyDataMapper::New( ); + _centralLineMapper->SetInput( _centralLine ); + + _centralLineActor = vtkActor::New( ); + _centralLineActor->SetMapper( _centralLineMapper ); + _centralLineActor->GetProperty( )->SetColor( 1.0, 1.0, 1.0 ); + _centralLineActor->PickableOff( ); + _pRenderer->AddActor( _centralLineActor ); + + + } else {success = false; notSuccessType=1; } + + } // fi + + } else success = false; + + } else success = false; + + // Show a message, if any. + if (( !success ) && (notSuccessType==0)) { + strcpy( ttmp , marDict.GetString(905) ); strcat( ttmp , "\n \n" ); strcat( ttmp , marDict.GetString(910) ); + wxMessageBox( wxString(ttmp, wxConvUTF8) , // "Set an initial point.\n \n (Double click over the interest artery.)" + _T("DxMM : MARACAS"), wxOK | wxCENTRE | wxICON_INFORMATION, this); + } + if ((!success ) && (notSuccessType==1)) { + strcpy( ttmp , marDict.GetString(915) ); strcat( ttmp , "\n \n" ); strcat( ttmp , marDict.GetString(920) ); + wxMessageBox( wxString(ttmp, wxConvUTF8), //"The initial point should be far \n of the limits of the volume." + _T("DxMM : MARACAS"), wxOK | wxCENTRE | wxICON_INFORMATION, this); + } + // Finish + _pRenderWindow->Render( ); + InitialSphere = success; + +} +//---------------------------------------------------------------------------- +void vtk3DSurfaceWidget::ConfigureVTK( ) +{ + // get render window + _pRenderWindow = this->GetRenderWindow( ); + + // connect renderer and render window and configure render window + _pRenderWindow->AddRenderer( _pRenderer ); + + // configure renderer + _pRenderer->SetBackground( 0.0, 0.0, 0.0 ); + //_pRenderer->SetBackground( 1, 1, 0); //FIXME + _pRenderer->GetActiveCamera( )->Zoom( 1.0 ); + _pRenderer->GetActiveCamera( )->SetClippingRange( 1, 1000 ); + _pRenderer->ResetCamera( ); + +//EED 22Mai2007 +// AttachRenderWindow(); + +} + + +//---------------------------------------------------------------------------- +vtkRenderer* vtk3DSurfaceWidget::GetRenderer(){ + return _pRenderer; +} +//---------------------------------------------------------------------------- + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceWidget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceWidget.h new file mode 100644 index 0000000..0b43218 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtk3DSurfaceWidget.h @@ -0,0 +1,134 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: vtk3DSurfaceWidget.h,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:41 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +#ifndef __VTK3DSURFACEWIDGET__ +#define __VTK3DSURFACEWIDGET__ + +#include "wxVTKRenderWindowInteractorEditContour.h" + +#include "vtkImagePolyDataSeedConnectivity.h" +#include "vtkInteractorStyleCutter.h" +#include "kernel/marInterface.h" +#include "kernel/marInterfaceCT.h" +#include "InterfaceVtkPanelWidgets.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//------------------------------------------------------------------ +//------------------------------------------------------------------ +//------------------------------------------------------------------ + +/** + * \brief Class that brigde to VTK, override double click... + */ +class vtk3DSurfaceWidget : public wxVTKRenderWindowInteractor +{ +public: + + vtk3DSurfaceWidget( + wxWindow* parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr + ); + ~vtk3DSurfaceWidget(); + void OnLeftDClick( wxMouseEvent& event ); + virtual void OnMouseWheel( wxMouseEvent& event ); + void Render( ); + + void ConfigureVTK( ); + + void ShowMARACASData( marInterface* mar ); + void ShowMARACASDataCT( marInterfaceCT* mar ); + void SetSurfaceColor(float red, float green, float blue ); + void SetSurfaceVisibility( bool visible ); + void SetSurfaceIsoValue( int isoval ); + void SetSurfaceOpacity( int opaval ); + + void GetSphereCenter( double center[3] ); + void SetAxis( vtkPolyData *axis ); + void RemoveAxis( ); + + ///\todo remove + vtkImageData* _marImageData; + vtkPolyData* _marPolyData; + + vtkGetMacro(InitialSphere, int); + + void SetInterfaceVtkPanelWidgets(InterfaceVtkPanelWidgets * intVtkPanWid) {_intVtkPanWid=intVtkPanWid;}; + void SetInitialPoint(); + void GetLast3DClickPoint( double *pp, double *cp ); + void InitCameraReset( ); + vtkRenderer *GetRenderer(); + +protected: + + void SetInitialPoint( float* pickPoint, float* cameraPos ); + void SetLast3DClickPoint( double *pp, double *cp ); + + marInterface *_mar; + marInterfaceCT *_marCT; + vtkRenderer *_pRenderer; + vtkRenderWindow *_pRenderWindow; + vtkOutlineFilter *_outLine; + vtkPolyDataMapper *_outMapper; + vtkActor *_outActor; + vtkMarchingCubes *_mCubes; + vtkPolyDataMapper *_surfMapper; + vtkActor *_surfActor; + + vtkPolyData *_centralLine; + vtkPolyDataMapper *_centralLineMapper; + vtkActor *_centralLineActor; + + vtkSphereSource *_spheres[ 4 ]; + vtkPolyDataMapper *_spheresMapper[ 4 ]; + vtkActor *_spheresActor[ 4 ]; + + vtkPolyDataMapper *_axesMapper; + vtkActor *_axesActor; + + double _range[2]; + + InterfaceVtkPanelWidgets *_intVtkPanWid; + +private: + + int _width; + int _height; + int _depth; + int InitialSphere; + float _lastPickPoint[3]; + float _lastCameraPos[3]; + + DECLARE_EVENT_TABLE( ); + +}; + +#endif //__VTK3DSURFACEWIDGET__ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.cxx new file mode 100644 index 0000000..82f6591 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.cxx @@ -0,0 +1,94 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: $RCSfile: vtkClosePolyData.cxx,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:41 $ + Version: $Revision: 1.1 $ + + Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +#include "vtkClosePolyData.h" + +#include "vtkObjectFactory.h" +#include "vtkPolyData.h" +#include "vtkFeatureEdges.h" +#include "vtkStripper.h" +#include "vtkTriangleFilter.h" +//#include "vtkGLUTesselatorTriangleFilter.h" +#include "vtkAppendPolyData.h" +#include "vtkCleanPolyData.h" + +vtkCxxRevisionMacro(vtkClosePolyData, "$Revision: 1.1 $"); +vtkStandardNewMacro(vtkClosePolyData); + +//---------------------------------------------------------------------------- +vtkClosePolyData::vtkClosePolyData() +{ +} + +//---------------------------------------------------------------------------- +vtkClosePolyData::~vtkClosePolyData() +{ +} + +//---------------------------------------------------------------------------- +// This method is much too long, and has to be broken up! +// Furthermore we are loosing the normals !!! +void vtkClosePolyData::Execute() +{ + vtkPolyData *input = this->GetInput(); + vtkPolyData *output = this->GetOutput(); + + //#closing the polydata see : close.py for details + vtkFeatureEdges *boundary = vtkFeatureEdges::New(); + boundary->SetInput( input ); + boundary->BoundaryEdgesOn (); + boundary->FeatureEdgesOff (); + boundary->NonManifoldEdgesOff (); + boundary->ManifoldEdgesOff (); + //boundary->ColoringOff (); + + vtkStripper *stripper = vtkStripper::New(); + stripper->SetInput( boundary->GetOutput() ); + stripper->Update(); //important + boundary->Delete(); + + vtkPolyData *pd = vtkPolyData::New(); + pd->SetPoints ( stripper->GetOutput()->GetPoints() ); + pd->SetPolys ( stripper->GetOutput()->GetLines() ); + stripper->Delete(); + + //vtkGLUTesselatorTriangleFilter *triangle = vtkGLUTesselatorTriangleFilter::New(); + vtkTriangleFilter *triangle = vtkTriangleFilter::New(); + triangle->SetInput( pd ); + pd->Delete(); + + vtkAppendPolyData *append = vtkAppendPolyData::New(); + append->AddInput( input ); + append->AddInput( triangle->GetOutput()); + triangle->Delete(); + + vtkCleanPolyData *clean = vtkCleanPolyData::New(); + clean->SetInput( append->GetOutput()); + append->Delete(); + + // When all optimizations are complete, this squeeze will be unecessary. + // (But it does not seem to cost much.) + clean->Update(); //important before ShallowCopy + output->ShallowCopy( clean->GetOutput() ); + clean->Delete(); +} + +//---------------------------------------------------------------------------- +void vtkClosePolyData::PrintSelf(ostream& os, vtkIndent indent) +{ + this->Superclass::PrintSelf(os,indent); +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.h new file mode 100644 index 0000000..d7ca0fe --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.h @@ -0,0 +1,57 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: $RCSfile: vtkClosePolyData.h,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:41 $ + Version: $Revision: 1.1 $ + + Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +// .NAME vtkClosePolyData - close a polygonal dataset +// .SECTION Description +// +// vtkClosePolyData is a filter that blabla + +// .SECTION Thanks +// Thanks to Goodwin Lawlor for http://public.kitware.com/pipermail/vtkusers/2003-March/016420.html +// and Mathieu Malaterre for this class. + +// .SECTION See Also +// vtkAppendFilter + +#ifndef __vtkClosePolyData_h +#define __vtkClosePolyData_h + +#include "vtkPolyDataToPolyDataFilter.h" + +class vtkClosePolyData : public vtkPolyDataToPolyDataFilter +{ +public: + static vtkClosePolyData *New(); + + vtkTypeRevisionMacro(vtkClosePolyData,vtkPolyDataToPolyDataFilter); + void PrintSelf(ostream& os, vtkIndent indent); + +protected: + vtkClosePolyData(); + ~vtkClosePolyData(); + + // Usual data generation method + void Execute(); + +private: + vtkClosePolyData(const vtkClosePolyData&); // Not implemented. + void operator=(const vtkClosePolyData&); // Not implemented. +}; + +#endif + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImagePolyDataSeedConnectivity.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImagePolyDataSeedConnectivity.cxx new file mode 100644 index 0000000..9efc451 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImagePolyDataSeedConnectivity.cxx @@ -0,0 +1,423 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: vtkImagePolyDataSeedConnectivity.cxx,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:41 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +#include "vtkImagePolyDataSeedConnectivity.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +vtkCxxRevisionMacro(vtkImagePolyDataSeedConnectivity, "$Revision: 1.1 $"); +vtkStandardNewMacro(vtkImagePolyDataSeedConnectivity); +vtkCxxSetObjectMacro(vtkImagePolyDataSeedConnectivity, Axis,vtkPolyData); + +//---------------------------------------------------------------------------- +vtkImagePolyDataSeedConnectivity::vtkImagePolyDataSeedConnectivity() +{ + this->Axis = NULL; + this->ClipImageData = vtkImageData::New(); + this->OuterMold = vtkPolyData::New(); + this->ThresholdRatio = 0.45; +} +//---------------------------------------------------------------------------- +vtkImagePolyDataSeedConnectivity::~vtkImagePolyDataSeedConnectivity() +{ + if(this->Axis) + { + this->Axis->Delete(); + } + this->ClipImageData->Delete(); + this->ClipImageData = NULL; + this->OuterMold->Delete(); + this->OuterMold = NULL; +} + /** + * Utilisation de static pour accelérer l'execution ? + * cf: vtkDividingCubes.cxx + */ + +//Macros definitions +#define PSC_MIN(x,y) ((x)<(y) ? (x) : (y)) +#define PSC_MAX(x,y) ((x)>(y) ? (x) : (y)) +//---------------------------------------------------------------------------- +void vtkImagePolyDataSeedConnectivity::Execute() +{ + vtkImageData *input = this->GetInput(); + vtkPolyData *output = this->GetOutput(); + int intervalle = 2; + int dim[3]; + + vtkDebugMacro(<< "Executing polydata seed connectivity..."); + + if (input == NULL) + { + vtkErrorMacro(<<"Input is NULL"); + return; + } + + // just deal with volumes + if ( input->GetDataDimension() != 3 ) + { + vtkErrorMacro("Bad input: only treats 3D structured point datasets"); + return; + } + + input->GetDimensions(dim); + + //Allocate a temporary image that will be filled in b&w + //this is the base of the algothm, from a graysccale input + an axis + //we produce a b&w image the the marching cubes can contour: + + vtkImageData *imagedata = vtkImageData::New(); + imagedata->SetOrigin( input->GetOrigin() ); + imagedata->SetSpacing( input->GetSpacing() ); + imagedata->SetExtent( input->GetExtent() ); + imagedata->SetScalarTypeToUnsignedChar (); //for connectityseed + reduce mem usage + imagedata->AllocateScalars(); + + /* + Result: piece of crap !! + There was some leakage from another vessel that was near enough from the heart. + */ + + vtkImageSeedConnectivity *seed = vtkImageSeedConnectivity::New(); + seed->SetInput( imagedata ); + seed->SetInputConnectValue( 255 ); //If 0 -> inverse video, 255 -> rien ! + + // Before starting the loop we should make sure the image has been clipped + // with the polydata: + this->ClipImageWithAxis(); + + vtkPoints *points = this->Axis->GetPoints(); + vtkDataArray* scalars = this->Axis->GetPointData()->GetScalars(); + + int numPts = points->GetNumberOfPoints(); + double p1[3], p2[3], p3[3], tuple[2]; + double radius, signalvalue; + int region[6]; + int i_p2; //allow saving of p2 index + unsigned short* inSI, *inSIEnd; + unsigned char* outSI,*outSIEnd; + + for(int i=0; iGetPoint(i, p1); + if(numPts <= i+2*intervalle) + { + i_p2 = i+intervalle; + points->GetPoint(numPts - 1, p3); + i = numPts; //no more iteration + } + else + { + points->GetPoint(i+intervalle, p3); + } + points->GetPoint(i_p2, p2); + + //Now we can add p2 point to the see list: + //seed->AddSeed( 3, p2); //too bad :( + seed->AddSeed( (int)p2[0], (int)p2[1], (int)p2[2] ); + + //this parameter seems to be ok for most image + //furthermore it doesn't make any change to make it bigger. + scalars->GetTuple(i_p2, tuple); + radius = tuple[0]; + signalvalue = tuple[1]; + radius *= 4; //multiply for a factor 4 for aneurism case + + region[0] = (int)PSC_MAX(p2[0] - radius, 0); + region[2] = (int)PSC_MAX(p2[1] - radius, 0); + region[4] = (int)PSC_MAX(p2[2] - radius, 0); + + region[1] = (int)PSC_MIN(p2[0] + radius, dim[0] - 1); + region[3] = (int)PSC_MIN(p2[1] + radius, dim[1] - 1); + region[5] = (int)PSC_MIN(p2[2] + radius, dim[2] - 1); + + // multiply signal by a factor this allow user to accuratley find the best + // range + signalvalue *= ThresholdRatio; + + /** + * Instead of working on the real image, we might take advantage of + * class Stencil made by dgobbi + * + * Steps: + * - Create a fake disk (black) of radius ~ Optimale sphere and normal + * orientation = last point first eigen vector + * See: Disk-Stencil.py for more info + */ + //Solution: this is too much a trouble: rather do it once on the entry (=first axis point) + + vtkImageIterator inIt(this->ClipImageData, region);//image_woheart + vtkImageIterator outIt(imagedata, region); + // vtkImageProgressIterator should be nicer in conjonction with a wxGauge + + // Loop through ouput pixels + while (!inIt.IsAtEnd()) + { + inSI = inIt.BeginSpan(); inSIEnd = inIt.EndSpan(); + outSI = outIt.BeginSpan(); outSIEnd = outIt.EndSpan(); + + // Pixel operation + while (inSI != inSIEnd) + *outSI++ = (signalvalue <= *inSI++) ? 255 : 0; + + inIt.NextSpan(); outIt.NextSpan(); + } + } + + //NEW: introduced by Maciek/Marcela: use a vtkImageGaussian to get rid + //of the crenelage/steps introduced by MarchingCubes + + vtkImageGaussianSmooth *gauss = vtkImageGaussianSmooth::New(); + gauss->SetInput( seed->GetOutput() ); + gauss->SetDimensionality(3); + //gauss->SetStandardDeviation(1.0); + //gauss->SetRadiusFactor(3.); + + vtkMarchingCubes *contour = vtkMarchingCubes::New(); + contour->SetInput ( gauss->GetOutput() ); + contour->SetNumberOfContours( 1 ); + contour->SetValue(0, 128); + contour->ComputeGradientsOn (); + contour->ComputeScalarsOn (); + + vtkCleanPolyData *clean = vtkCleanPolyData::New(); + clean->SetInput ( contour->GetOutput() ); + + vtkTriangleFilter *tf = vtkTriangleFilter::New(); + tf->SetInput( clean->GetOutput() ); + tf->Update(); + + //Need to do a deep copy as we'll do a ShallowCopy afterwards + output->DeepCopy( tf->GetOutput() ); + + //output->Squeeze(); //usefull ? + + // Now we do a dilatation of seed->GetOutput() in order to have inner (=output) + // and outer mold (=OuterMold): + /** + * Internal function that take an input of a b&w or grayscale image (should be + * unsigned short/ unsigned char and apply a dilatation (see math morpho for + * info). + * NB: dilation o gaussian = gaussian o dilatation + */ + + //First apply a morpho math: dilatation of 2mm: + vtkImageContinuousDilate3D *dilate = vtkImageContinuousDilate3D ::New(); + dilate->SetInput ( seed->GetOutput() ); + //TODO: determine real kernel based on scale = cm/pixel + //See: http://public.kitware.com/pipermail/vtkusers/2000-September/004210.html + //[Spacing is x and y is the distance between the samples. The units of measure + //are your choice. Often medical images use millimeters. Let's say your medical + //data resolution is 512 x 512 and your study has a 250 mm field of view. Then + //the spacing in x and y would be 250/512 or .488 mm.] + //therefore we have here: + + int kernelsize[3]; + double spacing[3]; + seed->GetOutput()->GetSpacing( spacing ); //beware input should be Update() + for(int j=0; j<3; j++) + { + //2mm thickness, we assume spacing units is in mm !! + kernelsize[j] = 3; //(int) (2. / spacing[i]); + //std::cout << "kernel=" << kernelsize[i] << ",et:" << (int)(2./0.3334) << ","; + //beware if spacing=0.3334 -> 2/0.3334 = 5 !!!! bad bad +/-0.5 to see + } + dilate->SetKernelSize (kernelsize[0], kernelsize[1], kernelsize[2]); + + //VTK filters rules !!! + gauss->SetInput( dilate->GetOutput()); + tf->Update(); + // shallow copy result into output. + // Could be re-written, as we know there is no vert neither strips... + OuterMold->ShallowCopy( tf->GetOutput() ); + + //OuterMold->Squeeze(); //usefull ? + + //Delete temp stuff: + imagedata -> Delete(); + seed -> Delete(); + gauss -> Delete(); + contour -> Delete(); + clean -> Delete(); + tf -> Delete(); + dilate -> Delete(); + + //TODO: if this filter is used many times when working on different image size + //I guess we need to find something brighter for this->ClipImageData +} +//end of macros use +#undef PSC_MAX +#undef PSC_MIN +//---------------------------------------------------------------------------- +//We need to add a function that from the raw data is able to clip with +//the begining and ending of polydata to produce sharp edge. +void vtkImagePolyDataSeedConnectivity::ClipImageWithAxis() +{ + //no input need we'll work with member data: + //Now we only need the region growing part: + /** + * Instead of working directly on leo we might remove the heart by a trick: + * If we could cut with a disk at place where the last(first) axis point is + * we could avoid the flood fill algo to spread in the heart...smart ! + */ + + /** + * First we construct a virtual disk (=half sphere for now) + * See: Disk-Stencil.py + */ + double normal[3]; + + /** + * What we do here: + * Get first point (p2) and second point (p1) : assume it exists ! + * Then calculate vector p2->p1 + * normalize it + * use it to define intersection plane between sphere and plane + */ + this->Axis->Update(); + vtkPoints *points = this->Axis->GetPoints(); + int numPts = points->GetNumberOfPoints(); + double p1[3]; + double p2[3]; + + points->GetPoint( 0, p2 ); + points->GetPoint( 1, p1 ); + + normal[0] = p1[0] - p2[0]; + normal[1] = p1[1] - p2[1]; + normal[2] = p1[2] - p2[2]; + vtkMath::Normalize( normal ); + + vtkPlane *plane1 = vtkPlane::New(); + plane1->SetOrigin( p2[ 0 ], p2[ 1 ], p2[ 2 ] ); + plane1->SetNormal( normal[0], normal[1], normal[2]); + + vtkDataArray* scalars = this->Axis->GetPointData()->GetScalars(); + double tuple[2]; + scalars->GetTuple(0, tuple); + double radius = tuple[0]; + + vtkSphere *sphere1 = vtkSphere::New(); + sphere1->SetCenter( p2[ 0 ], p2[ 1 ], p2[ 2 ] ); + sphere1->SetRadius( radius + 1); + + vtkImplicitBoolean *disk1 = vtkImplicitBoolean::New(); + disk1->SetOperationTypeToIntersection(); + disk1->AddFunction(sphere1); + disk1->AddFunction(plane1); + + /** + * What we do here: + * Get last point (p2) and before last point (p1) : assume it exists ! + * Then calculate vector p2->p1 + * normalize it + * use it to define intersection plane between sphere and plane + */ + + //ax->getControlPoint(numPts - 1, p2, p2+3); + points->GetPoint( numPts - 1, p2); + //ax->getControlPoint(numPts - 2, p1, p1+3); //assume it exists + points->GetPoint( numPts - 2, p1); + normal[0] = p1[0] - p2[0]; + normal[1] = p1[1] - p2[1]; + normal[2] = p1[2] - p2[2]; + vtkMath::Normalize( normal ); + + vtkPlane *plane2 = vtkPlane::New(); + plane2->SetOrigin( p2[ 0 ], p2[ 1 ], p2[ 2 ] ); + plane2->SetNormal( normal[0], normal[1], normal[2]); + + vtkSphere *sphere2 = vtkSphere::New(); + sphere2->SetCenter( p2[ 0 ], p2[ 1 ], p2[ 2 ] ); + sphere2->SetRadius( radius + 1 ); + + vtkImplicitBoolean *disk2 = vtkImplicitBoolean::New(); + disk2->SetOperationTypeToIntersection(); + disk2->AddFunction(sphere2); + disk2->AddFunction(plane2); + + vtkImplicitBoolean *disk = vtkImplicitBoolean::New(); + disk->SetOperationTypeToUnion(); + disk->AddFunction(disk1); + disk->AddFunction(disk2); + + /** + * Now use dgobbi class: Stencil stuff to remove the 'bad' heart part + */ + + vtkImplicitFunctionToImageStencil *functionToStencil = vtkImplicitFunctionToImageStencil::New (); + functionToStencil->SetInput ( disk ); + + vtkImageStencil *stencil = vtkImageStencil::New(); + stencil->SetInput( this->GetInput() ); + stencil->SetStencil( functionToStencil->GetOutput() ); + stencil->ReverseStencilOn(); + stencil->SetBackgroundValue (0); + //don't forget to call ->Update before using an iterator !!! + stencil->Update(); + + this->ClipImageData->ShallowCopy( stencil->GetOutput() ); + + /** + * Should I do my own vtkCappedCylinder ?? + * solution: no , cause ... I can't remember why... :p + */ + + //Delete stuff: + plane1 -> Delete(); + sphere1 -> Delete(); + disk1 -> Delete(); + plane2 -> Delete(); + sphere2 -> Delete(); + disk2 -> Delete(); + disk -> Delete(); + functionToStencil -> Delete(); + stencil -> Delete(); +} +//---------------------------------------------------------------------------- +void vtkImagePolyDataSeedConnectivity::PrintSelf(ostream& os, vtkIndent indent) +{ + this->Superclass::PrintSelf(os,indent); + if ( this->Axis ) + { + os << indent << "Axis of " << this->Axis->GetNumberOfPoints() + << "points defined\n"; + } + else + { + os << indent << "Axis not defined\n"; + } +} + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImagePolyDataSeedConnectivity.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImagePolyDataSeedConnectivity.h new file mode 100644 index 0000000..a200c24 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImagePolyDataSeedConnectivity.h @@ -0,0 +1,69 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: vtkImagePolyDataSeedConnectivity.h,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:41 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +// .NAME vtkImagePolyDataSeedConnectivity - create +// .SECTION Description +// + +#ifndef __vtkImagePolyDataSeedConnectivity_h +#define __vtkImagePolyDataSeedConnectivity_h + +#include + +class vtkPolyData; + +class vtkImagePolyDataSeedConnectivity : public vtkStructuredPointsToPolyDataFilter +{ +public: + static vtkImagePolyDataSeedConnectivity *New(); + vtkTypeRevisionMacro(vtkImagePolyDataSeedConnectivity,vtkStructuredPointsToPolyDataFilter); + void PrintSelf(ostream& os, vtkIndent indent); + + // Description: + // Set axis + virtual void SetAxis(vtkPolyData*); + vtkGetObjectMacro(Axis,vtkPolyData); + + // Description: + // Set threshold ratio, by default .45 + vtkSetMacro(ThresholdRatio,double); + vtkGetMacro(ThresholdRatio,double); + + // Description: + // Get outer mold + vtkGetObjectMacro(OuterMold,vtkPolyData); + +protected: + vtkImagePolyDataSeedConnectivity(); + ~vtkImagePolyDataSeedConnectivity(); + + void Execute(); + void ClipImageWithAxis(); + + double ThresholdRatio; + + vtkPolyData *Axis; + //image data that has been clip with polydata + vtkImageData *ClipImageData; + vtkPolyData *OuterMold; +private: + vtkImagePolyDataSeedConnectivity(const vtkImagePolyDataSeedConnectivity&); // Not implemented. + void operator=(const vtkImagePolyDataSeedConnectivity&); // Not implemented. +}; + +#endif + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleCutter.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleCutter.cxx new file mode 100644 index 0000000..a5698ab --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleCutter.cxx @@ -0,0 +1,192 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: $RCSfile: vtkInteractorStyleCutter.cxx,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:41 $ + Version: $Revision: 1.1 $ + + Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +#include "vtkInteractorStyleCutter.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +vtkCxxRevisionMacro(vtkInteractorStyleCutter, "$Revision: 1.1 $"); +vtkStandardNewMacro(vtkInteractorStyleCutter); + +//---------------------------------------------------------------------------- +vtkInteractorStyleCutter::vtkInteractorStyleCutter() +{ + this->CurrentPosition[0] = this->CurrentPosition[1] = 0; + this->Direction[0] = this->Direction[1] = this->Direction[2] = 0.; + this->Moving = 0; + + this->Points = vtkPoints::New(); + this->Lines = vtkCellArray::New(); + this->LoopPoints = vtkPoints::New(); + + vtkPolyData *pd = vtkPolyData::New(); + pd->SetPoints( Points ); + pd->SetLines( Lines ); + + vtkPolyDataMapper2D *bboxMapper = vtkPolyDataMapper2D::New(); + bboxMapper->SetInput( pd ); + + this->BboxActor = vtkActor2D::New(); + this->BboxActor->SetMapper( bboxMapper ); + this->BboxActor->GetProperty()->SetColor(1, 0, 0); + this->BboxActor->VisibilityOff(); + + //thanks + pd->Delete(); + bboxMapper->Delete(); +} + +//---------------------------------------------------------------------------- +vtkInteractorStyleCutter::~vtkInteractorStyleCutter() +{ + this->Points->Delete(); + this->BboxActor->Delete(); + this->Lines->Delete(); + this->LoopPoints->Delete(); +} + +//---------------------------------------------------------------------------- +void vtkInteractorStyleCutter::OnMouseMove() +{ + if (!this->Interactor || !this->Moving) + { + return; + } + + this->CurrentPosition[0] = this->Interactor->GetEventPosition()[0]; + this->CurrentPosition[1] = this->Interactor->GetEventPosition()[1]; + + //mouse move event + this->Points->SetPoint(this->PointID, this->CurrentPosition[0], + this->CurrentPosition[1], 0); + + this->Interactor->Render(); +} + +//---------------------------------------------------------------------------- +void vtkInteractorStyleCutter::OnLeftButtonDown() +{ + if (!this->Interactor) + { + return; + } + + this->CurrentPosition[0] = this->Interactor->GetEventPosition()[0]; + this->CurrentPosition[1] = this->Interactor->GetEventPosition()[1]; + + if(!this->Moving) + { + this->Initialize(); + + //Call this before accessing CurrentRenderer + this->FindPokedRenderer(this->CurrentPosition[0], this->CurrentPosition[1]); + this->CurrentRenderer->AddProp( BboxActor ); + } + + this->Moving = 1; + + this->Points->SetPoint(this->PointID, this->CurrentPosition[0], + this->CurrentPosition[1], 0); + this->PointID = this->Points->InsertNextPoint( this->CurrentPosition[0], + this->CurrentPosition[1], 0); + + this->Lines->InsertCellPoint( this->PointID ); + this->Lines->UpdateCellCount( this->PointID + 1 ); + this->BboxActor->VisibilityOn(); + + this->Interactor->Render(); +} + +//---------------------------------------------------------------------------- +void vtkInteractorStyleCutter::OnRightButtonDown() +{ + if (!this->Interactor || !this->Moving) + { + return; + } + + double xyz[3]; + this->Points->GetPoint( 0, xyz ); + this->Points->SetPoint(this->PointID, xyz); + + //Save current state + this->EndLoop(); + + this->Interactor->Render(); + this->Moving = 0; +} + +//---------------------------------------------------------------------------- +void vtkInteractorStyleCutter::Initialize() +{ + this->Points->Reset(); + this->Lines->Reset(); + + this->PointID = this->Points->InsertNextPoint( 0, 0, 0); + this->Lines->InsertNextCell( 1 ); + this->Lines->InsertCellPoint( 0 ); +} +//---------------------------------------------------------------------------- +void vtkInteractorStyleCutter::EndLoop() +{ + double pi[3],fpi[4]; + int numPts = this->Points->GetNumberOfPoints()-1; + this->LoopPoints->SetNumberOfPoints( numPts ); + vtkCamera *camera = this->CurrentRenderer->GetActiveCamera(); + int state = camera->GetParallelProjection (); + camera->ParallelProjectionOn(); + + for (int i=0; i < numPts; i++) + { + this->Points->GetPoint(i, pi); + this->CurrentRenderer->SetDisplayPoint(pi[0], pi[1], 0); + this->CurrentRenderer->DisplayToWorld(); + + this->CurrentRenderer->GetWorldPoint( fpi ); + if ( fpi[3] ) + { + fpi[0] /= fpi[3]; + fpi[1] /= fpi[3]; + fpi[2] /= fpi[3]; + } + this->LoopPoints->SetPoint( i, fpi[0], fpi[1], fpi[2] ); + } + + //Set direction of extrusion, should save this state before camera moves + camera->GetDirectionOfProjection( this->Direction ); + //camera->SetParallelProjection( state ); +} +//---------------------------------------------------------------------------- +//Just a quick hack: +void vtkInteractorStyleCutter::VisibilityOff() +{ + this->BboxActor->VisibilityOff(); +} +//---------------------------------------------------------------------------- +void vtkInteractorStyleCutter::PrintSelf(ostream& os, vtkIndent indent) +{ + this->Superclass::PrintSelf(os, indent); +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleCutter.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleCutter.h new file mode 100644 index 0000000..cc6d92a --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleCutter.h @@ -0,0 +1,82 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: $RCSfile: vtkInteractorStyleCutter.h,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:41 $ + Version: $Revision: 1.1 $ + + Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +// .NAME vtkInteractorStyleCutter - +// .SECTION Description +// This interactor style allows the user to draw a rectangle in the render +// window using the left mouse button. + +#ifndef __vtkInteractorStyleCutter_h +#define __vtkInteractorStyleCutter_h + +#include + +class vtkPoints; +class vtkActor2D; +class vtkCellArray; + +class vtkInteractorStyleCutter : public vtkInteractorStyle +{ +public: + // Description: + // Instantiate the object. + static vtkInteractorStyleCutter *New(); + vtkTypeRevisionMacro(vtkInteractorStyleCutter, vtkInteractorStyle); + void PrintSelf(ostream& os, vtkIndent indent); + + // Description: + // Event bindings controlling the effects of pressing mouse buttons + // or moving the mouse. + virtual void OnMouseMove(); + virtual void OnLeftButtonDown(); + virtual void OnRightButtonDown(); + void VisibilityOff(); + + vtkGetObjectMacro(LoopPoints,vtkPoints); + vtkGetVector3Macro(Direction,double); + +protected: + vtkInteractorStyleCutter(); + ~vtkInteractorStyleCutter(); + + //This method is designed for vtkImplicitSelectionLoop where the loop + //should not be closed, the function is virtual to override this behavior + virtual void EndLoop(); + void Initialize(); + + int CurrentPosition[2]; + double Direction[3]; + + //Points selected by the user + vtkPoints *Points; + + //Current point id: + vtkIdType PointID; + + //bool which determine if user has press the left button first + int Moving; + + vtkActor2D *BboxActor; + vtkCellArray *Lines; + vtkPoints *LoopPoints; + +private: + vtkInteractorStyleCutter(const vtkInteractorStyleCutter&); // Not implemented + void operator=(const vtkInteractorStyleCutter&); // Not implemented +}; + +#endif diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxChart.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxChart.cxx new file mode 100644 index 0000000..39ce6e6 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxChart.cxx @@ -0,0 +1,954 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: wxChart.cxx,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:42 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + +#include "wxChart.h" + +#include + +//---------------------------------------------------------------- +// DataSet : Constructor & Destructor +//------------------------------------------------------------------- +wxDataSet::wxDataSet(wxPen *lStyle, wxBrush *dStyle, int dWidth, + int lWidth, int dGap, int pMark, int disValues) +{ + m_lineStyle = lStyle; + m_dataStyle = dStyle; + m_dataWidth = dWidth; + m_lineWidth = lWidth; + m_pointMark = pMark; + m_displayValues = disValues; + m_display = false; + m_rowsList = NULL; + m_text = NULL; +} + +wxDataSet::wxDataSet(wxPen *lStyle, wxBrush *dStyle, + wxString *lText, bool lDisplay) +{ + m_lineStyle = lStyle; + m_dataStyle = dStyle; + m_display = lDisplay; + m_text = lText; + m_rowsList = NULL; + m_dataWidth = 0; + m_lineWidth = 0; + m_pointMark = 0; + m_displayValues = 0; +} + + + +wxDataSet::wxDataSet() +{ + m_lineStyle = NULL; + m_dataStyle = NULL; + m_dataWidth = 0; + m_lineWidth = 0; + m_pointMark = 0; + m_displayValues = 0; + m_display = false; + m_rowsList = NULL; + m_text = NULL; +} + + +wxDataSet::~wxDataSet() +{ + // Nothing +} + + + + +//----------------------------------------------------------------- +// Chart +//------------------------------------------------------------------- +BEGIN_EVENT_TABLE(wxChart, wxPanel) + EVT_PAINT(wxChart::OnPaint) +END_EVENT_TABLE() + +//--------------------------------------------------------------------- +// Constructor & Destructor +wxChart::wxChart(wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name) + : wxPanel(parent, id, pos, size, style, name) +{ + SetMaxWidthHeight(size.GetWidth(), size.GetHeight()); + SetCenterChart(pos.x + (GetLargeur()/2), pos.y + (GetHauteur()/2)); + InitDataSet(); + InitChart(); +} + + + +wxChart::~wxChart() +{ + for(int i=0; i 1) { + if ( result.rem == 0 ) { + if (val - (int)val > 0 ) + retour = (multi - result.rem) - (val - int(val)); + } + else { + retour = (multi - result.rem) - (val - int(val)); + } + } + } + // multiple inf + else + retour = result.rem + (val - (int)val); + return retour; +} + +static double st_decalage(double IncX, double MinX) +{ + double retour = 0.00; + div_t result; + + if (IncX >= 1) { + result = div((int)MinX, (int)IncX); + if ( result.rem == 0 ) { + if (MinX - (int)MinX > 0 ) + retour = ((result.quot + 1) * IncX) - MinX; + } + else { + retour = ((result.quot+1) * IncX) - MinX; + } + } + return retour; +} + +static double st_origine(double IncX, double MinX) +{ + double retour = MinX; + div_t result; + + if (IncX >=1) { + result = div((int)MinX, (int)IncX); + if (result.rem == 0) { + if (MinX - (int)MinX > 0 ) + retour = (result.quot + 1) * IncX; + } + else { + retour = (result.quot + 1) * IncX; + } + } + return retour; +} + + +static void st_Inverse(double *l_MinCol, double *l_MaxCol) +{ + if (*l_MinCol > *l_MaxCol) { + int tempo = (int)(*l_MaxCol); + *l_MaxCol = *l_MinCol; + *l_MinCol = tempo; + } +} + + +//-------------------------------------------------------------- +void wxChart::SetInfX(double inf) +{ + m_InfX = inf; +} + +void wxChart::SetSupX(double sup) +{ + m_SupX = sup; +} + + +void wxChart::SetSupY(double sup) +{ + m_SupY = sup; +} + + +void wxChart::SetIncAxisX(double minor, double major) +{ + m_MinorIncX = minor; + m_MajorIncX = major; +} + +void wxChart::SetIncAxisY(double minor, double major) +{ + m_MinorIncY = minor; + m_MajorIncY = major; +} + + +void wxChart::SetInitEdge() +{ + + SetEdgeTop(15); + SetEdgeBottom(35); + SetEdgeLeft(37); + SetEdgeRight(15); +} + + + +void wxChart::SetChartBounds() +{ + m_Top = m_CenterY - (m_MaxHauteur/2) + m_EdgeTop; + m_Bottom = m_CenterY + (m_MaxHauteur/2) - m_EdgeBottom; + m_Left = m_CenterX - (m_MaxLargeur/2) + m_EdgeLeft; + m_Right = m_CenterX + (m_MaxLargeur/2) - m_EdgeRight; +} + +void wxChart::SetChartBoundsLegend() +{ + m_TopLegend = m_CenterY - (m_MaxHauteur/2) + m_EdgeTopLegend; + m_BottomLegend = m_CenterY + (m_MaxHauteur/2) - m_EdgeBottomLegend; + m_LeftLegend = m_CenterX - (m_MaxLargeur/2) + m_EdgeLeftLegend; + m_RightLegend = m_CenterX + (m_MaxLargeur/2) - m_EdgeRightLegend; +} + + +void wxChart::SetCadreLegend(int nbr, int *bottom) +{ + int val=GetEdgeBottom(); + div_t result = div(nbr, 2); + if (result.rem == 0) + val+= (nbr * 10) + 5; + else + val+= (( nbr + 1 ) * 10) + 5; + + *bottom = val; + SetEdgeTopLegend(m_CenterY + (m_MaxHauteur/2) - val + 33); + SetEdgeBottomLegend(8); + + int l_left = GetEdgeLeft(); + int l_right = GetEdgeRight(); + + // more small for only 1 line + if (nbr == 1) { + l_left+=m_CenterX - (m_MaxLargeur/3); + l_right+=m_CenterX - (m_MaxLargeur/3); + } + + SetEdgeLeftLegend(l_left); + SetEdgeRightLegend(l_right); +} + + +void wxChart::SetShowPer(bool per) +{ + m_ShowPer = per; +} + + +void wxChart::SetMaxValue(double max) +{ + // Axe Y + m_MaxValue = max; +} + +double wxChart::MaxValue() +{ + double data, val = 1.00; + int maxdata = GetNumDataSet()-1; + int maxitem = GetNumItem(); + + // Exclure Stenosis for calcul MaxValue + for(int a=0; a < maxdata; a++) { + if (GetShowDataSet(a)) { + for(int j=0; j<=maxitem; j++) { + if ( IsEmpty(a,j) == false ) { + data = GetDataY(a,j); + if (data > val) + val = data; + } + } + } + } + + return val; +} + + +double wxChart::MinCol(double min) +{ + double retour = 0.00; + int maxdata = GetNumDataSet()-1; + + // Exclure Stenosis for calcul MaxValue + for(int a=0; a < maxdata; a++) { + if (GetShowDataSet(a)) { + if (min > retour) + retour = min; + a = maxdata - 1; + } + } + + return retour; +} + + +double wxChart::MaxCol(double max) +{ + double retour = 1.00; + int maxdata = GetNumDataSet()-1; + + // Exclure Stenosis for calcul MaxValue + for(int a=0; a < maxdata; a++) { + if (GetShowDataSet(a)) { + if (max > retour) + retour = max; + a = maxdata - 1; + } + } + + return retour; +} + +void wxChart::SetStepSizeX(double stepX) +{ + m_StepSizeX = stepX; +} + +void wxChart::SetStepSizeY(double stepY) +{ + m_StepSizeY = stepY; +} + + +void wxChart::SetStepSizePer(double stepPer) +{ + m_StepSizePer = stepPer; +} + + +void wxChart::SetCenterChart(int x, int y) +{ + m_CenterX = x; + m_CenterY = y; +} + +void wxChart::SetMaxWidthHeight(int x,int y) +{ + m_MaxLargeur = x; + m_MaxHauteur = y; +} + + +void wxChart::SetMinX(double MinX) +{ + m_MinX = MinX; +} + + +void wxChart::SetMaxX(double MaxX) +{ + m_MaxX = MaxX; +} + + + +void wxChart::SetEdgeTop(int top) +{ + m_EdgeTop = top; +} + +void wxChart::SetEdgeBottom(int bottom) +{ + m_EdgeBottom = bottom; +} + +void wxChart::SetEdgeLeft(int left) +{ + m_EdgeLeft = left; +} + +void wxChart::SetEdgeRight(int right) +{ + m_EdgeRight = right; +} + + +void wxChart::SetEdgeTopLegend(int top) +{ + m_EdgeTopLegend = top; +} + +void wxChart::SetEdgeBottomLegend(int bottom) +{ + m_EdgeBottomLegend = bottom; +} + +void wxChart::SetEdgeLeftLegend(int left) +{ + m_EdgeLeftLegend = left; +} + + +void wxChart::SetEdgeRightLegend(int right) +{ + m_EdgeRightLegend = right; +} + + + +void wxChart::SetNumDataSet(int num) +{ + m_NumDataSet = num; +} + +void wxChart::SetNumItem(int num) +{ + m_NumItem = num; +} + + +int wxChart::GetShow() +{ + int retour = 0; + + for(int i=0; i < m_NumDataSet ; i++) { + if (GetShowDataSet(i)) + retour++; + } + return retour; +} + + +void wxChart::InitDataSet() +{ + + // Initialization + SetNumDataSet(8); + for(int i=0; i 0) { + SetCadreLegend(nbr, &m_EdgeBottom); + SetChartBoundsLegend(); + DrawLegend(dc, nbr); + } + + //------------------------------------------------------------------- + // Valeur Min et Max des abscisses + SetMinX(MinCol(0)); + SetMaxX(MaxCol(1)); + SetInfX(st_difference(m_MinX,10,false)); + SetSupX(st_difference(m_MaxX,10,true)); + + //------------------------------------------------------------------ + // Data + // Stenosis + SetNumItem(6); + SetData(wxStenosis, 0, 0, -45); + SetData(wxStenosis, 1, 0.4, 0); + SetData(wxStenosis, 2, 0.6, -15); + SetData(wxStenosis, 3, 0.8, 0); + SetData(wxStenosis, 4, 0.9, 100); + SetData(wxStenosis, 5, 1, 0); + + // Area + SetData(wxArea,0, 0, 0.8); + SetData(wxArea,1, 0.2, 0.6); + SetData(wxArea,2, 0.3, 0.8); + SetData(wxArea,3, 0.4, 1); + SetData(wxArea,4, 0.8, 0.4); + SetData(wxArea,5, 1, 0.2); + + //----------------------------------------------------------------- + // Valeur Max du chart + SetMaxValue(MaxValue()); + SetSupY(st_difference(m_MaxValue, 10, true)); + + //------------------------------------------------------------------------------- + // Scale + SetIncAxisX((m_MaxX + m_SupX - (m_MinX - m_InfX)) / (double)MINOR_STEP, + (m_MaxX + m_SupX - (m_MinX - m_InfX)) / (double)MAJOR_STEP); + SetIncAxisY((m_MaxValue + m_SupY) / (double)MINOR_STEP, + (m_MaxValue + m_SupY) / (double)MAJOR_STEP); + SetStepSizeX(( m_MaxLargeur - (m_EdgeLeft + m_EdgeRight + m_SupX + m_InfX)) / + (m_MaxX - m_MinX)); + SetStepSizeY(( m_MaxHauteur - (m_EdgeBottom + m_EdgeTop + m_SupY )) / + (m_MaxValue)); + SetStepSizePer(( m_MaxHauteur - (m_EdgeBottom + m_EdgeTop)) / + (double)MAX_PER); + + //----------------------------------------------------------------------------- + // Empty Chart + //--------------------------------------------------------------------------- + SetChartBounds(); + DrawGrille(dc); + DrawAxe(dc); + if (m_ShowPer) + DrawAxePer(dc); + + //----------------------------------------------------------------------------- + // Clipping + //--------------------------------------------------------------------------- + dc.DestroyClippingRegion(); + dc.SetClippingRegion(m_Left , m_Top , + GetLargeur() - (m_EdgeRight + m_EdgeLeft ), + GetHauteur() - (m_EdgeTop + m_EdgeBottom )); + + //--------------------------------------------------------------------------- + // Draw line + //--------------------------------------------------------------------------- + int maxdataset = GetNumDataSet(); + for(int a=0; a < maxdataset; a++) { + if(m_dataSetArray[a] && m_dataSetArray[a]->GetShow()) { + dataBrush = m_dataSetArray[a]->GetDataStyle(); + dataPen = m_dataSetArray[a]->GetLineStyle(); + dc.SetBrush(*dataBrush); + dc.SetPen(*dataPen); + DrawLine(dc, a); + } + } + + //--------------------------------------- + // end + dc.DestroyClippingRegion(); + dc.EndDrawing(); +} + + +void wxChart::DrawAxe(wxDC& dc) +{ + double x,y; + double val, supx; + char text[20]; + int widthx,heighty; + + double minorIncStepY= m_MinorIncY * m_StepSizeY; + double majorIncStepY= m_MajorIncY * m_StepSizeY; + double minorIncStepX= m_MinorIncX * m_StepSizeX; + double majorIncStepX= m_MajorIncX * m_StepSizeX; + + dc.SetPen(*wxBLACK_PEN); + dc.SetBrush(*wxBLACK_BRUSH); + + // Axe X + dc.DrawLine(m_Left, m_Bottom+(7*MARGE/4), m_Right, m_Bottom+(7*MARGE/4)); + // Axe Y + dc.DrawLine(m_Left-(7*MARGE/4), m_Bottom, m_Left-(7*MARGE/4), m_Top); + + // AXE Y + // Major Tick Marks with values + val=0.00; + for(x=m_Left,y=m_Bottom; y >= m_Top; y-=majorIncStepY, val+=m_MajorIncY) { + dc.DrawLine( (int)(m_Left-7-(7*MARGE/4)) , (int)(y) , (int)(m_Left-(7*MARGE/4)) , (int)(y) ); + sprintf(text,"%g", val); + dc.GetTextExtent(wxString(text, wxConvUTF8),&widthx,&heighty); + dc.DrawText(wxString(text, wxConvUTF8), (int)(m_Left-10-widthx-(7*MARGE/4)) , (int)(y-(heighty/2)) ); + } + // Ne pas Depasser + if (m_SupY == 0 ) { + dc.DrawLine(m_Left-7-(7*MARGE/4),m_Top,m_Left-(7*MARGE/4),m_Top); + sprintf(text,"%g", val); + dc.GetTextExtent(wxString(text, wxConvUTF8),&widthx,&heighty); + dc.DrawText( wxString(text, wxConvUTF8),m_Left-10-widthx-(7*MARGE/4),m_Top-(heighty/2)); + } + + // Minor Tick Marks + for(x=m_Left,y=m_Bottom; y >= m_Top; y-=minorIncStepY) { + dc.DrawLine((int)(m_Left-3-(7*MARGE/4)) , (int)(y) , (int)(m_Left-(7*MARGE/4)) , (int)(y) ); + } + + // AXE X + // Major Tick Marks with values + supx = st_decalage(m_MajorIncX, m_MinX) * m_StepSizeX; + val = st_origine(m_MajorIncX, m_MinX); + for(y=m_Bottom,x=m_Left + supx; x <= m_Right; x+=majorIncStepX, val+=m_MajorIncX) { + dc.DrawLine((int)x,(int)(m_Bottom+7+(7*MARGE/4)),(int)(x),(int)(m_Bottom+(7*MARGE/4))); + sprintf(text,"%g", val); + dc.GetTextExtent(wxString(text, wxConvUTF8),&widthx,&heighty); + dc.DrawText(wxString(text, wxConvUTF8), (int)(x-(widthx/2)) , (int)(y+3+heighty) ); + } + + // Ne pas Depasser + if ( m_SupX == 0 ) { + dc.DrawLine(m_Right,m_Bottom+7+(7*MARGE/4),m_Right,m_Bottom+(7*MARGE/4)); + sprintf(text,"%g", val); + dc.GetTextExtent(wxString(text, wxConvUTF8),&widthx,&heighty); + dc.DrawText(wxString(text, wxConvUTF8), (int)(m_Right-(widthx/2)), (int)(m_Right+3+heighty)); + } + + supx = st_decalage(m_MinorIncX, m_MinX) * m_StepSizeX; + //Minor Tick Marks + for(y=m_Bottom,x=m_Left + supx; x <= m_Right; x+=minorIncStepX) { + dc.DrawLine((int)(x),(int)(m_Bottom+3+(7*MARGE/4)),(int)(x),(int)(m_Bottom+(7*MARGE/4))); + } +} + + +void wxChart::DrawAxePer(wxDC& dc) +{ + double x,y; + double val; + char text[20]; + int widthx,heighty; + + double minorIncStepPer= MINOR_PER * m_StepSizePer; + double majorIncStepPer= MAJOR_PER * m_StepSizePer; + + dc.SetPen(*wxBLACK_PEN); + dc.SetBrush(*wxBLACK_BRUSH); + + // AXE Per + dc.DrawLine((int)(m_Right+(7*MARGE/4)) , m_Bottom, (int)(m_Right+(7*MARGE/4)), m_Top); + + // Major Tick Marks with values + val=0.00; + for(x=m_Right,y=m_Bottom; y >= m_Top; y-=majorIncStepPer, val+=MAJOR_PER) { + dc.DrawLine( (int)(m_Right+(7*MARGE/4)) , (int)y , (int)(m_Right+7+(7*MARGE/4)) , (int)(y) ); + sprintf(text,"%g",(val-(MAX_PER/2))); + dc.GetTextExtent(wxString(text, wxConvUTF8),&widthx,&heighty); + dc.DrawText(wxString(text, wxConvUTF8) , (int)(m_Right+10+(7*MARGE/4)) , (int)(y-(heighty/2)) ); + } + dc.DrawLine(m_Right+(7*MARGE/4),m_Top,m_Right+7+(7*MARGE/4),m_Top); + sprintf(text,"%g",(val-(MAX_PER/2))); + dc.GetTextExtent(wxString(text, wxConvUTF8),&widthx,&heighty); + dc.DrawText(wxString(text, wxConvUTF8),(int) (m_Right+10+(7*MARGE/4) ), (int) (m_Top-(heighty/2) )); + + // Minor Tick Marks + for(x=m_Right,y=m_Bottom; y >= m_Top; y-=minorIncStepPer) { + dc.DrawLine((int)(m_Right+(7*MARGE/4)),(int)y,(int)(m_Right+3+(7*MARGE/4)),(int)(y) ); + } +} + + +void wxChart::DrawGrille(wxDC& dc) +{ + double x,y; + double val; + double minorIncStepY = m_MinorIncY * m_StepSizeY; + double minorIncStepX = m_MinorIncX * m_StepSizeX; + + dc.SetBrush(*wxLIGHT_GREY_BRUSH); + + // Tracer DOT + wxPen *Pen = new wxPen(*wxLIGHT_GREY, 1, wxDOT); + dc.SetPen(*Pen); + + // quadrillage en point + // axe Y + for(x=m_Left,y=m_Bottom; y >= m_Top; y-=minorIncStepY) + dc.DrawLine((int)(m_Left-MARGE),(int)y,(int)(m_Right+MARGE),(int)y); + if (m_SupY == 0) + dc.DrawLine(m_Left-MARGE,m_Top,m_Right+MARGE,m_Top); + + // axe X + val = st_decalage(m_MinorIncX, m_MinX) * m_StepSizeX; + for(y=m_Bottom, x=m_Left + val ; x <= m_Right; x+=minorIncStepX) + dc.DrawLine((int)x,(int)(m_Bottom+MARGE),(int)x,(int)(m_Top-MARGE)); + if (m_SupX == 0) + dc.DrawLine(m_Right,m_Bottom+MARGE,m_Right,m_Top-MARGE); + + // Contour + Pen->SetStyle(wxSOLID); + dc.SetPen(*Pen); + dc.DrawLine(m_Left-MARGE, m_Top-MARGE, m_Right+MARGE, m_Top-MARGE); + dc.DrawLine(m_Right+MARGE, m_Top-MARGE, m_Right+MARGE, m_Bottom+MARGE); + dc.DrawLine(m_Right+MARGE, m_Bottom+MARGE, m_Left-MARGE, m_Bottom+MARGE); + dc.DrawLine(m_Left-MARGE, m_Bottom+MARGE, m_Left-MARGE, m_Top-MARGE); +} + + +void wxChart::DrawLegend(wxDC& dc, int nbre) +{ + // Init + wxString *string; + wxPen *dataPen; + wxBrush *dataBrush; + int widthx, heighty, l_posx, l_posy; + char text[30]; + int haut_ligne, compt = 0; + int l_haut = m_BottomLegend - m_TopLegend; + int l_larg = m_RightLegend - m_LeftLegend; + + div_t result = div(nbre,2); + div_t resulta; + int l_debut = 30, l_trait = 15, l_space = 10; + + if (result.rem == 0) + haut_ligne = l_haut / result.quot; + else + haut_ligne = l_haut / (result.quot+1); + + // Contour + dc.SetPen(*wxBLACK_PEN); + dc.SetBrush(*wxBLACK_BRUSH); + dc.DrawLine(m_LeftLegend, m_TopLegend, m_RightLegend, m_TopLegend); + dc.DrawLine(m_RightLegend, m_TopLegend, m_RightLegend, m_BottomLegend); + dc.DrawLine(m_RightLegend, m_BottomLegend, m_LeftLegend, m_BottomLegend); + dc.DrawLine(m_LeftLegend, m_BottomLegend, m_LeftLegend, m_TopLegend); + + // For each dataset + int maxdataset = GetNumDataSet(); + for (int a=0; a < maxdataset; a++) { + if (m_dataSetArray[a] && m_dataSetArray[a]->GetShow()) { + compt++; + // Text + string = m_dataSetArray[a]->GetText(); + sprintf(text,"%s",string); + dc.GetTextExtent(wxString(text, wxConvUTF8),&widthx,&heighty); + resulta = div(compt, 2); + l_posx = m_LeftLegend; + l_posy = m_TopLegend; + if (resulta.rem == 0) { + l_posx+= l_larg/2; + l_posy+= (haut_ligne * resulta.quot); + } + else + l_posy+= (haut_ligne * (resulta.quot+1)); + l_posy-= (haut_ligne/2); + + // proportion + if (nbre==1) + l_posx = m_LeftLegend + ((l_larg - l_trait - l_space - widthx)/2) - l_debut; + + // ligne + dataBrush = m_dataSetArray[a]->GetDataStyle(); + dataPen = m_dataSetArray[a]->GetLineStyle(); + dataPen->SetWidth(2); + dc.SetBrush(*dataBrush); + dc.SetPen(*dataPen); + dc.DrawLine(l_posx + l_debut, l_posy, l_posx + l_debut + 15, l_posy); + dataPen->SetWidth(1); + + // text + dc.SetFont(*(new wxFont(1, wxDEFAULT, wxNORMAL, wxBOLD))); + dc.SetPen(*wxBLACK_PEN); + dc.SetBrush(*wxBLACK_BRUSH); + dc.DrawText(wxString(text, wxConvUTF8),l_posx + l_debut + l_trait + l_space ,l_posy - (heighty/2)); + dc.SetFont(*(new wxFont(1, wxDEFAULT, wxNORMAL, wxLIGHT))); + } + } +} + + +void wxChart::DrawLine(wxDC &dc, int a) +{ + int compt=0; + double val; + double mid = m_Bottom - ((m_Bottom-m_Top)/2); + int maxitem = GetNumItem(); + + float yprec, xprec; + float xsuiv, ysuiv; + + for(int j=0; j < maxitem; j++) { + if ( IsEmpty(a,j) == false ) { + compt++; + xsuiv = m_Left + ((GetDataX(a,j) - m_MinX ) * m_StepSizeX); + val = GetDataY(a,j); + if ( a == wxStenosis) + // Axe Per for Stenosis + ysuiv = mid - (val * m_StepSizePer); + else + // Axe X + ysuiv = m_Bottom - (val * m_StepSizeY); + + // Draw line + if (compt > 1) + dc.DrawLine((int)xprec, (int)yprec, (int)xsuiv, (int)ysuiv); + + // save point prec + xprec = xsuiv; + yprec = ysuiv; + } + } +} + + +// Click Mouse +//----------------------------------------------------------------- +void wxChart::OnLeftClick(wxDC &dc, double x, double y, int keys) +{ + // TO IMPLEMENT +} + +void wxChart::OnRightClick(wxDC &dc, double x, double y, int keys) +{ + // TO IMPLEMENT +} + + +// Data +//-------------------------------------------------------------------- +void wxChart::InitData() +{ + SetNumItem(0); + for(int a=0; aShow(show); +} + +bool wxChart::GetShowDataSet(int dataset) +{ + if(m_dataSetArray[dataset]) + return m_dataSetArray[dataset]->GetShow(); + else + return 1; +} + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxChart.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxChart.h new file mode 100644 index 0000000..1d0317a --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxChart.h @@ -0,0 +1,219 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: wxChart.h,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:42 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + +#ifndef __WX__MARACAS__CHART__HXX__ +#define __WX__MARACAS__CHART__HXX__ + +#include + +//--------------------------------------------------------------------- +#define MAX_DATASET 10 +#define MAX_ITEM 50 +#define MARGE 5 +#define MINOR_STEP 10 +#define MAJOR_STEP 5 +#define MAX_PER 200 +#define MINOR_PER 25 +#define MAJOR_PER 50 + +enum +{ + wxArea = 0, + wxPerimeter = 1, + wxDiameterArea = 2, + wxDiameterPerimeter = 3, + wxMinimumDiameter = 4, + wxMaximumDiameter = 5, + wxAverageDiameter = 6, + wxStenosis = 7 +}; + + +//------------------------------------------------------------------- +class wxDataSet: public wxObject +{ + protected: + wxBrush *m_dataStyle; + wxPen *m_lineStyle; + wxString *m_text; + int m_dataWidth; // Scaled|Fixed + int m_lineWidth; + int m_pointMark; + int m_displayValues; // def=NONE |IN | OUT + bool m_display; + + public: + wxList *m_rowsList; + + public : + // Constructor & Destructor + wxDataSet(wxPen *lStype, wxBrush *dStyle, + int dWidth, int lWidth, int dGap, int pMark, + int disValues); + wxDataSet(wxPen *lStype, wxBrush *dStyle, + wxString *lText, bool lDisplay=false); + wxDataSet(); + ~wxDataSet(); + + // Set + void SetDataStyle(wxBrush* brush) { m_dataStyle = brush; } + void SetDataWidth(int width) { m_dataWidth = width; } + void SetLineStyle(wxPen* style) { m_lineStyle = style; } + void SetPointMark(int mark) { m_pointMark = mark; } + void SetText(wxString* string) { m_text = string;} + void Show(bool show) { m_display = show; } + + // Get + bool GetShow() { return m_display; } + wxBrush* GetDataStyle() { return m_dataStyle; } + int GetDataWidth() { return m_dataWidth; } + wxPen* GetLineStyle() { return m_lineStyle; } + int GetPointMark() { return m_pointMark; } + wxString* GetText() { return m_text; } + +}; +//--------------------------------------------------------------- + + +class Table +{ + public : + double x,y; + bool empty; +}; + +//---------------------------------------------------------------------- +class wxChart: public wxPanel +{ +private: + + int m_NumDataSet; + int m_NumItem; + Table m_table[MAX_DATASET][MAX_ITEM]; + wxDataSet *m_dataSetArray[MAX_DATASET]; + + double m_MinX, m_MaxX; + double m_InfX, m_SupX, m_SupY; + + double m_StepSizeX, m_StepSizeY, m_StepSizePer; + double m_MaxValue; + + double m_MinorIncX, m_MajorIncX; + double m_MinorIncY, m_MajorIncY; + + bool m_ShowPer; + + int m_ValueCol; + + int m_MaxHauteur, m_MaxLargeur; + int m_CenterX, m_CenterY; + int m_EdgeTop, m_EdgeBottom, m_EdgeLeft, m_EdgeRight; + int m_Top,m_Bottom, m_Left, m_Right; + + int m_EdgeTopLegend, m_EdgeBottomLegend, m_EdgeLeftLegend, m_EdgeRightLegend; + int m_TopLegend, m_BottomLegend, m_LeftLegend, m_RightLegend; + + void DrawLine(wxDC &dc, int a); + void DrawFond(wxDC& dc); + void DrawAxe(wxDC& dc); + void DrawAxePer(wxDC& dc); + void DrawLegend(wxDC& dc, int nbr); + void DrawGrille(wxDC& dc); + void SetInitEdge(); + void SetChartBounds(); + void SetChartBoundsLegend(); + void SetCadreLegend(int nbr, int* bottom); + void InitDataSet(); + void InitData(); + double MaxValue(); + double MinCol(double inf); + double MaxCol(double sup); + void SetInfX(double sup); + void SetSupX(double sup); + void SetSupY(double sup); + void InitChart(); + int GetShow(); + +public: + // Constructor et Destructor + wxChart(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxPanelNameStr); + ~wxChart(); + + void OnPaint(wxPaintEvent& event); + void OnLeftClick(wxDC &dc, double x, double y, int keys); + void OnRightClick(wxDC &dc, double x, double y, int keys); + + void Draw(wxDC& dc); + bool IsEmpty(int a, int item); + double GetDataX(int a, int item); + double GetDataY(int a, int item); + void SetData(int a, int item, double x, double y); + + void SetMinX(double MinX); + void SetMaxX(double MaxX); + void SetMaxWidthHeight(int x,int y); + void SetCenterChart(int x, int y); + void SetShowPer(bool per); + void SetMaxValue(double max); + void SetStepSizeX(double sizeX); + void SetStepSizeY(double sizeY); + void SetStepSizePer(double sizePer); + void SetNumDataSet(int NumDataSet); + void SetNumItem(int NumItem); + void SetIncAxisX(double minor, double major); + void SetIncAxisY(double minor, double major); + void SetEdgeTop(int top); + void SetEdgeBottom(int bottom); + void SetEdgeLeft(int left); + void SetEdgeRight(int right); + void SetEdgeTopLegend(int top); + void SetEdgeBottomLegend(int bottom); + void SetEdgeLeftLegend(int left); + void SetEdgeRightLegend(int right); + void ShowDataSet(bool show,int dataset); + + bool GetShowDataSet(int dataset); + double GetMinX() { return m_MinX; } + double GetMaxX() { return m_MaxX; } + int GetMaxValue() { return (int)m_MaxValue; } + double GetStepSizeX() { return m_StepSizeX; } + double GetStepSizeY() { return m_StepSizeY; } + double GetStepSizePer() { return m_StepSizePer; } + int GetValueCol() { return m_ValueCol; } + int GetNumDataSet() { return m_NumDataSet; } + int GetNumItem() { return m_NumItem; } + bool GetShowPer() { return m_ShowPer; } + int GetLargeur() { return m_MaxLargeur; } + int GetHauteur() { return m_MaxHauteur; } + int GetEdgeTop() { return m_EdgeTop; } + int GetEdgeBottom() { return m_EdgeBottom; } + int GetEdgeLeft() { return m_EdgeLeft; } + int GetEdgeRight() { return m_EdgeRight; } + int GetEdgeTopLegend() { return m_EdgeTopLegend; } + int GetEdgeBottomLegend() { return m_EdgeBottomLegend; } + int GetEdgeLeftLegend() { return m_EdgeLeftLegend; } + int GetEdgeRightLegend() { return m_EdgeRightLegend; } + + DECLARE_EVENT_TABLE() +}; + + + +#endif + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanelWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanelWidget.cxx new file mode 100644 index 0000000..7814c78 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanelWidget.cxx @@ -0,0 +1,282 @@ + +#include "vtkActor.h" +#include "vtkCylinderSource.h" +#include "vtkPolyDataMapper.h" +#include "vtkRenderer.h" +#include "vtkRenderWindow.h" +#include "vtkRenderWindowInteractor.h" +#include "vtkProperty.h" +#include "vtkCamera.h" +#include "vtkPoints.h" +#include "vtkCellArray.h" +#include "vtkPolyData.h" +#include "vtkPolyDataMapper.h" +#include "vtkPolyDataWriter.h" +#include "vtkPolyDataReader.h" +#include "vtkImageReader.h" +#include "vtkImageViewer.h" +#include "vtkImageViewer2.h" +#include "vtkImageToStructuredPoints.h" + + +#include "vtkExtractVOI.h" +#include "vtkImageClip.h" +#include "vtkImageResample.h" +#include "vtkImageThreshold.h" +#include "vtkImageCast.h" +#include "vtkImageSeedConnectivity.h" +#include "vtkImageData.h" +#include "vtkMarchingCubes.h" +#include "vtkImageReslice.h" +#include "vtkTransform.h" +#include "vtkSphereSource.h" +#include "vtkDoubleArray.h" +#include "vtkPointData.h" +#include "vtkCommand.h" +#include "vtkCallbackCommand.h" +#include "vtkImageResample.h" +#include "vtkMath.h" +#include "vtkStripper.h" + + +#include "wxEmptyPanelWidget.h" + +#include + +//------------------------------------------------------------------- +//------------------------------------------------------------------- +//------------------------------------------------------------------- +wxEmptyPanelWidget::wxEmptyPanelWidget(wxWindow *parent) +: wxPanel( parent, -1) +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL ); + wxSplitterWindow *pnlSplitter = new wxSplitterWindow( this , -1); + wxPanel *viewPanel = CreateViewPanel(pnlSplitter); + wxPanel *controlPanel = CreateControlPanel(pnlSplitter); + + sizer -> Add( pnlSplitter ,1,wxGROW ,0); + pnlSplitter -> SetMinimumPaneSize( 150 ); + pnlSplitter -> SplitVertically( viewPanel, controlPanel, 600 ); + this -> SetSizer(sizer); + + // Original Volule + _mCubes = NULL; + _surfMapper = NULL; + _surfActor = NULL; + + // Result: Volume + Axis + _prgov = NULL; + _mapfinal = NULL; + _stripfinal = NULL; + _isoMapperMC6 = NULL; + _isoActorMC6 = NULL; + _isoMC6 = NULL; +} +//------------------------------------------------------------------- +wxEmptyPanelWidget::~wxEmptyPanelWidget(){ + + // Original Volule + _mCubes -> Delete(); + _surfMapper -> Delete(); + _surfActor -> Delete(); + + // Result: Volume + Axis + _prgov -> Delete(); + _mapfinal -> Delete(); + _stripfinal -> Delete(); + _isoMapperMC6 -> Delete(); + _isoActorMC6 -> Delete(); + _isoMC6 -> Delete(); +} +//------------------------------------------------------------------- +wxPanel* wxEmptyPanelWidget::CreateViewPanel(wxWindow *parent) +{ + wxPanel *panel = new wxPanel(parent,-1); + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + _imageviewer3D = new wxVtk3DBaseView(panel); + wxVTKRenderWindowInteractor *iren = _imageviewer3D->GetWxVTKRenderWindowInteractor(); + sizer->Add(iren , 1, wxEXPAND, 0); + + panel->SetSizer(sizer); + panel->SetAutoLayout(true); + panel->SetSize(400,400); + panel->Layout(); + return panel; +} +//------------------------------------------------------------------- +wxPanel* wxEmptyPanelWidget::CreateControlPanel(wxWindow *parent) +{ + wxPanel *panel = new wxPanel(parent,-1); + _opacity1 = new wxSlider( panel, -1, 50, 0, 100 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS ); + _isoValue = new wxSlider( panel, -1, 0 , 0, 3000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS ); + _opacity2 = new wxSlider( panel, -1, 50, 0, 100 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS ); + _opacity1->SetSize(250,20); // Original Volume + _isoValue->SetSize(250,20); + _opacity2->SetSize(250,20); // Result Volume + wxFlexGridSizer *sizer = new wxFlexGridSizer(1); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T("Isovalue - Original Volume"))); + sizer->Add(_isoValue); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T("Opacity - Original Volume"))); + sizer->Add(_opacity1); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T("Opacity - Result Volume"))); + sizer->Add(_opacity2); + + panel->SetSizer(sizer); + panel->SetAutoLayout(true); + panel->SetSize(400,400); + panel->Layout(); + Connect(_opacity1->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxEmptyPanelWidget::OnOpacity1 ); + Connect(_isoValue->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxEmptyPanelWidget::OnIsoValue ); + Connect(_opacity2->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxEmptyPanelWidget::OnOpacity2 ); + return panel; +} +//------------------------------------------------------------------------ +void wxEmptyPanelWidget::Refresh() +{ + _imageviewer3D->Refresh(); +} +//------------------------------------------------------------------------ + +void wxEmptyPanelWidget::ConfigureVTK(vtkImageData *imagedata, int x, int y, int z) +{ + wxBusyCursor wait; + _imageviewer3D->Configure(); + + double puntoactualprov[3]; + puntoactualprov[0]=x; + puntoactualprov[1]=y; + puntoactualprov[2]=z; + + double espprin[3]; + int extprin[6]; + + imagedata->GetSpacing(espprin); + imagedata->GetExtent(extprin); + + puntoactualprov[0]=puntoactualprov[0]*espprin[0]; + puntoactualprov[1]=puntoactualprov[1]*espprin[1]; + puntoactualprov[2]=puntoactualprov[2]*espprin[2]; + + /* Old + // Juan Francisco Carrillo Filter + _prgov= axisExtractor::New(); + _prgov->SetHumbral(0.45); + _prgov->SetInput(imagedata); + _prgov->SetPoint(puntoactualprov); + _prgov->Update(); + */ + + // Juan Francisco Carrillo Filter + _prgov= axisExtractor02::New(); + _prgov->SetParam(1); + _prgov->SetParam2(1); + _prgov->SetParam3(0.5); + _prgov->SetMaxant(20); + _prgov->SetMinant(5); + _prgov->SetInput(imagedata); + _prgov->SetPoint(puntoactualprov); + _prgov->Update(); + + + vtkPolyDataWriter *writer = vtkPolyDataWriter::New(); + writer->SetInput(_prgov->GetOutput()); + writer->SetFileName("c:/temp/salida_JF.vtk"); + writer->SetFileTypeToASCII(); + writer->Write(); + + + // Visualisation - result vascular tree + _mapfinal = vtkPolyDataMapper::New(); + _mapfinal->SetInput(_prgov->GetOutput()); + + _stripfinal = vtkActor::New(); + _stripfinal->SetMapper(_mapfinal); + _stripfinal->GetProperty()->SetColor(1, 1, 1); + _stripfinal->GetProperty()->SetLineWidth(2); + + _stripfinal->GetProperty()->BackfaceCullingOff(); + + // Visualisation - result volume + vtkImageData *imageOut = _prgov->GetVolumen(); + imageOut->Update(); + + _isoMC6 = vtkMarchingCubes::New(); + _isoMC6->SetInput(imageOut); + _isoMC6->SetValue(0, 1); + _isoMC6->Update(); + + _isoMapperMC6 = vtkPolyDataMapper::New(); + _isoMapperMC6->SetInput(_isoMC6->GetOutput()); + _isoMapperMC6->ScalarVisibilityOff(); + _isoMapperMC6->ImmediateModeRenderingOn(); + + _isoActorMC6 = vtkActor::New(); + _isoActorMC6->SetMapper(_isoMapperMC6); + _isoActorMC6->GetProperty()->SetColor( 0, 1, 0); + _isoActorMC6->GetProperty()->SetOpacity(0.25); + + // Visualisation - original volume + double range[2]; + imagedata->GetScalarRange( range ); + + _mCubes = vtkMarchingCubes::New( ); + _mCubes->SetInput( imagedata ); + _mCubes->SetValue( 0, range[1] / 4 ); + + vtkStripper *stripper = vtkStripper::New(); + stripper->SetInput( _mCubes->GetOutput( ) ); + + _surfMapper = vtkPolyDataMapper::New( ); + _surfMapper->SetInput( stripper->GetOutput() ); + _surfMapper->ScalarVisibilityOff( ); + stripper->Delete(); + + _surfActor = vtkActor::New( ); + _surfActor->SetMapper( _surfMapper ); + _surfActor->PickableOff( ); + _surfActor->GetProperty( )->SetColor( 0.9803, 0.9215, 0.8392 ); + _surfActor->GetProperty( )->SetOpacity( 0.3 ); + + + // Update Controls + _isoValue->SetRange( (int)(range[0]), (int)(range[1]) ); + _isoValue->SetValue( (int)(range[1]/4) ); + _opacity1->SetValue( (int)(_surfActor->GetProperty( )->GetOpacity( )*100) ); + _opacity2->SetValue( (int)(_isoActorMC6->GetProperty( )->GetOpacity( )*100)); + + // Interface Update + vtkRenderer *ren = _imageviewer3D->GetRenderer(); + ren->AddActor(_surfActor); + ren->AddActor(_isoActorMC6); + ren->AddActor(_stripfinal); + +} + + + +//------------------------------------------------------------------------ +void wxEmptyPanelWidget::OnOpacity1(wxScrollEvent& event){ + double value = ((double)_opacity1->GetValue())/100; + _surfActor->GetProperty( )->SetOpacity( value ); + Refresh(); +} +//------------------------------------------------------------------------ +void wxEmptyPanelWidget::OnOpacity2(wxScrollEvent& event){ + double value = ((double)_opacity2->GetValue())/100; + _isoActorMC6->GetProperty( )->SetOpacity( value ); + Refresh(); +} +//------------------------------------------------------------------------ +void wxEmptyPanelWidget::OnIsoValue(wxScrollEvent& event){ + wxBusyCursor wait; + _mCubes->SetValue(0, _isoValue->GetValue()); + Refresh(); +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanelWidget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanelWidget.h new file mode 100644 index 0000000..eb23ad6 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanelWidget.h @@ -0,0 +1,63 @@ + + +#ifndef EMPTY_PANEL_WIDGET_H +#define EMPTY_PANEL_WIDGET_H + + + +#include +#include +#include +#include + + + +#include "wxVtkBaseView.h" +#include "wxVTKRenderWindowInteractor.h" +#include + +#include +#include + +//------------------------------------------------------------------ +//------------------------------------------------------------------ +//------------------------------------------------------------------ + +class wxEmptyPanelWidget: public wxPanel{ +public: + wxEmptyPanelWidget(wxWindow *parent); + ~wxEmptyPanelWidget(); + void ConfigureVTK(vtkImageData *imagedata, int x, int y, int z); + void Refresh(); + void OnOpacity1(wxScrollEvent& event); // Original Volume + void OnOpacity2(wxScrollEvent& event); // Result Volume + void OnIsoValue(wxScrollEvent& event); +private: + + // Original Volume + vtkMarchingCubes *_mCubes; + vtkPolyDataMapper *_surfMapper; + vtkActor *_surfActor; + + // Result volume + Axis + axisExtractor02 *_prgov; + vtkPolyDataMapper *_mapfinal; + vtkActor *_stripfinal; + vtkPolyDataMapper *_isoMapperMC6; + vtkActor *_isoActorMC6; + vtkMarchingCubes *_isoMC6; + + + wxSlider *_opacity1; + wxSlider *_opacity2; + wxSlider *_isoValue; + wxVtk3DBaseView *_imageviewer3D; + wxPanel *CreateControlPanel(wxWindow *parent); + wxPanel *CreateViewPanel(wxWindow *parent); +}; + +#endif // EMPTY_PANEL_WIDGET_H + + + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanelWidget_2.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanelWidget_2.cxx new file mode 100644 index 0000000..2ac2d4e --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanelWidget_2.cxx @@ -0,0 +1,1075 @@ + +#include "vtkObjectFactory.h" + +#include "vtkActor.h" +#include "vtkCylinderSource.h" +#include "vtkPolyDataMapper.h" +#include "vtkRenderer.h" +#include "vtkRenderWindow.h" +#include "vtkRenderWindowInteractor.h" +#include "vtkProperty.h" +#include "vtkCamera.h" +#include "vtkPoints.h" +#include "vtkCellArray.h" +#include "vtkPolyData.h" +#include "vtkPolyDataMapper.h" +#include "vtkPolyDataWriter.h" +#include "vtkPolyDataReader.h" +#include "vtkImageReader.h" +#include "vtkImageViewer.h" +#include "vtkImageViewer2.h" +#include "vtkImageToStructuredPoints.h" +#include + +#include "vtkExtractVOI.h" +#include "vtkImageClip.h" +#include "vtkImageResample.h" +#include "vtkImageThreshold.h" +#include "vtkImageCast.h" +#include "vtkImageSeedConnectivity.h" +#include "vtkImageData.h" +#include "vtkMarchingCubes.h" +#include "vtkImageReslice.h" +#include "vtkTransform.h" +#include "vtkSphereSource.h" +#include "vtkDoubleArray.h" +#include "vtkPointData.h" +#include "vtkCommand.h" +#include "vtkCallbackCommand.h" +#include "vtkImageResample.h" +#include "vtkMath.h" +#include "vtkStripper.h" + +#include "wxEmptyPanelWidget_2.h" + +#include + + + +//------------------------------------------------------------------- +//------------------------------------------------------------------- +//------------------------------------------------------------------- +vtkStandardNewMacro(TreeExtraction_MH_JFC); +//------------------------------------------------------------------- + +TreeExtraction_MH_JFC::TreeExtraction_MH_JFC(){ + _branchLevel = 2; + _imagedataResult = NULL; + _cleanLevel = 400; +} +//------------------------------------------------------------------- +TreeExtraction_MH_JFC::~TreeExtraction_MH_JFC(){ + Reset(); +} +//------------------------------------------------------------------- +void TreeExtraction_MH_JFC::Reset(){ + if (_imagedataResult!=NULL){ + _imagedataResult->Delete(); + } +} +//------------------------------------------------------------------- +void TreeExtraction_MH_JFC::SetInput(marExperiment *input){ + _marExperiment = input; +} + +//------------------------------------------------------------------- +void TreeExtraction_MH_JFC::BruleVolume(vtkImageData *imagedata, int x,int y,int z,int r , int value) +{ + int ext[6]; + int i, j, k, ii,jj,kk; + imagedata->GetExtent(ext); + unsigned short *ptr; + int x1=x-r; + int x2=x+r; + int y1=y-r; + int y2=y+r; + int z1=z-r; + int z2=z+r; + double tmpsqrt; + for(i=x1;i<=x2;i++){ + for(j=y1;j<=y2;j++){ + for(k=z1;k<=z2;k++){ + ptr=(unsigned short *) imagedata->GetScalarPointer(i,j,k); + ii=i-x; + jj=j-y; + kk=k-z; + tmpsqrt=ii*ii + jj*jj + kk*kk; + if ((ptr!=NULL) && ( sqrt(tmpsqrt)<=r)) + { + if (value==0){ + *ptr=value; + } else { + if (*ptr==0) { + *ptr=value; + } + } + } + } // for z + } // for y + } // fox x +} + +//------------------------------------------------------------------- +void TreeExtraction_MH_JFC::BruleVolume(vtkImageData *imagedata,vtkPolyData *inputAxisRadio, int value) +{ + int x,y,z,r; + double point[3],radio; + double fractpart, intpart; + int i,maxPoints=inputAxisRadio->GetPoints()->GetNumberOfPoints(); + vtkDoubleArray *allRadios = (vtkDoubleArray*)(inputAxisRadio->GetPointData()->GetScalars("radio")); + for (i=0; iGetPoints()->GetPoint(i,point); + radio=allRadios->GetValue(i); + x = (int)(point[0]); + y = (int)(point[1]); + z = (int)(point[2]); + fractpart = modf (radio , &intpart); + if (fractpart>=0.5){ + intpart++; + } + r = (int)( intpart ); + BruleVolume(imagedata,x,y,z,r,value); + } +} + + +//------------------------------------------------------------------- + +void TreeExtraction_MH_JFC::FindVit( marExperiment *newExperiment , int actualAxis , double *pointBif , double *vit ) +{ + double dist,min=-1; + double point[3]; + double dx,dy,dz; + int jPoint,maxPoints; + int iAxis,maxAxis; + + maxAxis=newExperiment->getNumberOfAxes(); + for (iAxis=0;iAxissetAxis(iAxis); + marAxis *maraxis = newExperiment->getAxis( ); + if (maraxis!=NULL) { + vtkPolyData *axisVtk = maraxis->GetAxisData(); + maxPoints=axisVtk->GetPoints()->GetNumberOfPoints(); + for (jPoint=0; jPointGetPoints()->GetPoint(jPoint,point); + dx = pointBif[0]-point[0]; + dy = pointBif[1]-point[1]; + dz = pointBif[2]-point[2]; + dist = sqrt( dx*dx + dy*dy + dz*dz ); + if ((min==-1) || (distgetNumberOfAxes(); + _marExperiment->extractVascularTree( sens , vit, cleanLevel ); +/* +time (&end); +dif = difftime (end,start); +FILE *ff; +ff=fopen("c:/temp/MaracasTIME.txt","a+"); +fprintf(ff,"\n TreeExtraction_MH_JFC::Execute %d \n",count); +fprintf(ff,"evt %.2lf \n",dif); +fclose(ff); +*/ + int idActualAxis = _marExperiment->getNumberOfAxes(); + // Bifurcation Detection JFC + marAxis *maraxis = _marExperiment->getAxis( ); + if ((maraxis!=NULL) && (idActualAxis_Before!=idActualAxis)) { + vtkImageData *imagedata = _marExperiment->getDynData( )->getVolume( )->castVtk(); + vtkPolyData *inputAxisRadio = maraxis->GetAxisData(); + + if (count>0){ +/* +time (&start); +*/ + _prgov = carotidaBifurcacion::New(); + _prgov->SetMaxPropRadio(5); + _prgov->SetHumbral(0.45); + _prgov->SetMaxPropMasa(10); + _prgov->SetMinPropMasa(0.01); + _prgov->SetInput( inputAxisRadio ); + _prgov->SetInput2( imagedata ); + _prgov->Update(); +/* +time (&end); +dif = difftime (end,start); +ff=fopen("c:/temp/MaracasTIME.txt","a+"); +fprintf(ff,"\tcB %.2lf \n",dif); +fclose(ff); +*/ + } + + // Brule Volume + BruleVolume(imagedata , inputAxisRadio , 0 ); + BruleVolume(_imagedataResult , inputAxisRadio , idActualAxis ); + inputAxisRadio->Delete(); + + + if (count>0){ + // LOOP for branch extraction + vtkPolyData *bifurcations = _prgov->GetOutput(); + int i,maxPoints = bifurcations->GetPoints()->GetNumberOfPoints(); + int x,y,z; + double point[3], vit[3]; + for (i=0; iGetPoints()->GetPoint(i,point); + x = (int)(point[0]); + y = (int)(point[1]); + z = (int)(point[2]); + FindVit( _marExperiment , idActualAxis , point , vit ); + _marExperiment->setStartPoint( x , y , z ); + //Branch extraction; + Execute(count, 0 , vit , (int)_cleanLevel ); + } + bifurcations->Delete(); +// _prgov->Delete(); +// _prgov = NULL; + } // of count>0 + + } // maraxi=NULL +} + +//------------------------------------------------------------------- +void TreeExtraction_MH_JFC::InitImagaDataResult(){ + Reset(); + vtkImageData *imagedata = _marExperiment->getDynData( )->getVolume( )->castVtk(); + imagedata->Update(); + _imagedataResult = vtkImageData::New(); + int dim[3]; + imagedata->GetDimensions(dim); + _imagedataResult->SetScalarType(imagedata->GetScalarType()); + + _imagedataResult->SetDimensions(dim[0],dim[1],dim[2]); + _imagedataResult->SetExtent( 0 , dim[0]-1 , 0 , dim[1]-1 , 0 , dim[2]-1 ); + _imagedataResult->SetWholeExtent(0 , dim[0]-1 , 0 , dim[1]-1 , 0 , dim[2]-1 ); + _imagedataResult->SetSpacing( imagedata->GetSpacing() ); + _imagedataResult->SetOrigin( 0,0,0 ); + _imagedataResult->Update(); + _imagedataResult->UpdateData(); + unsigned short *ptr; + int i,j,k; + for ( i=0 ; iGetScalarPointer(i,j,k); + *ptr = 0; + } + } + } +} +//------------------------------------------------------------------- +void TreeExtraction_MH_JFC::Update(){ +/* +FILE *ff; +ff=fopen("c:/temp/MaracasTIME.txt","w"); +fclose(ff); +*/ + InitImagaDataResult(); + Execute(_branchLevel); +} +//------------------------------------------------------------------- +marExperiment* TreeExtraction_MH_JFC::GetInput(){ + return _marExperiment; +} +//------------------------------------------------------------------- +vtkImageData* TreeExtraction_MH_JFC::GetVolume(){ + return _imagedataResult; +} +//------------------------------------------------------------------- +void TreeExtraction_MH_JFC::SetBranchLevel(int branchLevel){ + _branchLevel = branchLevel; +} +//------------------------------------------------------------------- +void TreeExtraction_MH_JFC::SetCleanTreeLevel( int cleanLevel ){ + _cleanLevel = (double)cleanLevel; +} + +//------------------------------------------------------------------- +//------------------------------------------------------------------- +//------------------------------------------------------------------- +wxEmptyPanelWidget_2::wxEmptyPanelWidget_2(wxWindow *parent, marInterface* mar) +: wxPanel( parent, -1) +{ + + _sensibility_JF = 0.5; + + _mar = mar; + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL ); + wxSplitterWindow *pnlSplitter = new wxSplitterWindow( this , -1); + wxPanel *viewPanel = CreateViewPanel(pnlSplitter); + wxPanel *controlPanel = CreateControlPanel(pnlSplitter); + + sizer -> Add( pnlSplitter ,1,wxGROW ,0); + pnlSplitter -> SetMinimumPaneSize( 150 ); + pnlSplitter -> SplitVertically( viewPanel, controlPanel, 600 ); + this -> SetSizer(sizer); + + // Original Volume + _mCubes = NULL; + _surfMapper = NULL; + _surfActor = NULL; + + // Result 1: Volume + Axis + _1_prgov = NULL; + _1_mapfinal = NULL; + _1_stripfinal = NULL; + _1_isoMapperMC6 = NULL; + _1_isoActorMC6 = NULL; + _1_isoMC6 = NULL; + + // Result 2: Volume + Axis + _2_prgov = NULL; + _2_mapfinal = NULL; + _2_stripfinal = NULL; + _2_isoMapperMC6 = NULL; + _2_isoActorMC6 = NULL; + _2_isoMC6 = NULL; + + // + _isoMapperMC1 = NULL; + _isoActorMC1 = NULL; + _isoMC1 = NULL; + _imageThresholdMC1 = NULL; + + // + _treeExtraction = NULL; + +} +//------------------------------------------------------------------- +wxEmptyPanelWidget_2::~wxEmptyPanelWidget_2(){ + // Erase Original Volule + if (_mCubes ) { _mCubes -> Delete(); } + if (_surfMapper ) { _surfMapper -> Delete(); } + if (_surfActor ) { _surfActor -> Delete(); } + + // Erase result: Volume + Axis + ResetTree1_JF(); + ResetTree2_JF(); + ResetTree_MH_JFC(); +} +//------------------------------------------------------------------- +wxPanel* wxEmptyPanelWidget_2::CreateViewPanel(wxWindow *parent) +{ + wxPanel *panel = new wxPanel(parent,-1); + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + _maracasSurfaceWidget = new wxSurfaceWidget(panel); + sizer->Add(_maracasSurfaceWidget , 1, wxEXPAND, 0); + panel->SetSizer(sizer); + panel->SetAutoLayout(true); + panel->SetSize(400,400); + panel->Layout(); + return panel; +} +//------------------------------------------------------------------- +wxPanel* wxEmptyPanelWidget_2::CreateControlPanel(wxWindow *parent) +{ + wxPanel *panel = new wxPanel(parent,-1); + _opacity_OrigVol = new wxSlider( panel, -1, 30, 0, 100 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS ); + _isoValue = new wxSlider( panel, -1, 0 , 0, 3000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS ); + _opacity_Res1VolJF = new wxSlider( panel, -1, 25, 0, 100 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS ); + _opacity_Res2VolJF = new wxSlider( panel, -1, 25, 0, 100 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS ); + _sl_sensibility_JF = new wxSlider( panel, -1, 0 , 0, 100 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS ); + _branchLevel = new wxSlider( panel, -1, 2 , 1, 10 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS ); + _opacity_ResVolMHJF = new wxSlider( panel, -1, 25, 0, 100 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS ); + _isoValue_MH_JFC = new wxSlider( panel, -1, 0 , 0, 100 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS ); + _cleanTree_MH_JFC = new wxSlider( panel, -1, 400 , 0, 1000 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS ); + + int tmp_sensibility= (int)(_sensibility_JF*100.0); + _sl_sensibility_JF->SetValue( tmp_sensibility ); + + + _opacity_OrigVol ->SetSize(250,20); // Original Volume + _isoValue ->SetSize(250,20); + _opacity_Res1VolJF ->SetSize(250,20); // Result 1 Volume JF + _opacity_Res2VolJF ->SetSize(250,20); // Result 2 Volume JF + _branchLevel ->SetSize(250,20); + _opacity_ResVolMHJF ->SetSize(250,20); // Result Volume MH+JFC + + //Extract Tree 1 JF + wxButton *btnExtractTree1_JF = new wxButton(panel,-1,_T("Extract Tree 1 JF")); + wxButton *btnEraseTree1_JF = new wxButton(panel,-1,_T("Erase Tree 1 JF")); + + //Extract Tree 2 JF + wxButton *btnExtractTree2_JF = new wxButton(panel,-1,_T("Extract Tree 2 JF")); + wxButton *btnEraseTree2_JF = new wxButton(panel,-1,_T("Erase Tree 2 JF")); + + //Extract Tree MH + JF + wxButton *btnExtractTree_MH_JFC = new wxButton(panel,-1,_T("Extract Tree MH + JFC")); + wxButton *btnEraseTree_MH_JFC = new wxButton(panel,-1,_T("Erase Tree MH + JFC")); + + + wxFlexGridSizer *sizer = new wxFlexGridSizer(1); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T("Isovalue - Original Volume"))); + sizer->Add(_isoValue); + sizer->Add(new wxStaticText(panel,-1,_T("Opacity - Original Volume"))); + sizer->Add(_opacity_OrigVol); + + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T(" - - - Juan Francisco Module 1 - - - "))); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(btnExtractTree1_JF); + sizer->Add(btnEraseTree1_JF); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T("Opacity - Result Volume"))); + sizer->Add(_opacity_Res1VolJF); + + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T(" - - - Juan Francisco Module 2 - - - "))); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T(" % Sensibility"))); + sizer->Add(_sl_sensibility_JF); + sizer->Add(btnExtractTree2_JF); + sizer->Add(btnEraseTree2_JF); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T("Opacity - Result Volume"))); + sizer->Add(_opacity_Res2VolJF); + + + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T(" - - - MH + JFC - - - "))); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(btnExtractTree_MH_JFC); + sizer->Add(btnEraseTree_MH_JFC); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T("Branch Level MH+JFC"))); + sizer->Add(_branchLevel); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T("Opacity - Result Volume MH+JFC"))); + sizer->Add(_opacity_ResVolMHJF); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T("IsoValue - Result Volume MH+JFC"))); + sizer->Add(_isoValue_MH_JFC); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T("signal level (Clean Tree)"))); + sizer->Add(_cleanTree_MH_JFC); + + panel->SetSizer(sizer); + panel->SetAutoLayout(true); + panel->SetSize(400,400); + panel->Layout(); + Connect(_opacity_OrigVol->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxEmptyPanelWidget_2::OnOpacity_OrigVol ); + Connect(_isoValue->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxEmptyPanelWidget_2::OnIsoValue ); + Connect(_opacity_Res1VolJF->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxEmptyPanelWidget_2::OnOpacity_Res1VolJF ); + Connect(_opacity_Res2VolJF->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxEmptyPanelWidget_2::OnOpacity_Res2VolJF ); + Connect(_sl_sensibility_JF->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxEmptyPanelWidget_2::OnSensibility ); + + Connect(btnExtractTree1_JF->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxEmptyPanelWidget_2::OnBtnExtractTree1_JF ); + Connect(btnEraseTree1_JF->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxEmptyPanelWidget_2::OnBtnEraseTree1_JF ); + Connect(btnExtractTree2_JF->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxEmptyPanelWidget_2::OnBtnExtractTree2_JF ); + Connect(btnEraseTree2_JF->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxEmptyPanelWidget_2::OnBtnEraseTree2_JF ); + + Connect(btnExtractTree_MH_JFC->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxEmptyPanelWidget_2::OnBtnExtractTree_MH_JFC); + Connect(btnEraseTree_MH_JFC->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxEmptyPanelWidget_2::OnBtnEraseTree_MH_JFC ); + Connect(_branchLevel->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxEmptyPanelWidget_2::OnBranchLevel ); + Connect(_opacity_ResVolMHJF->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxEmptyPanelWidget_2::OnOpacity_ResVolMHJF ); + Connect(_isoValue_MH_JFC->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxEmptyPanelWidget_2::OnIsoValue_MH_JFC ); + Connect(_cleanTree_MH_JFC->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxEmptyPanelWidget_2::OnCleanTree_MH_JFC ); + + return panel; +} +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::Refresh() +{ + _maracasSurfaceWidget->GetVtk3DSurfaceWidget()->Render(); +} +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::ConfigureVTK() +{ + wxBusyCursor wait; +// _imageviewer3D->Configure(); + vtkImageData *imagedata = _mar->_experiment->getDynData( )->getVolume( )->castVtk(); + double opacity_OrigVol = ((double)(_opacity_OrigVol->GetValue()))/100; + double isoValue; + + // Visualisation - original volume + double range[2]; + imagedata->GetScalarRange( range ); + isoValue=range[1] / 8; + + _mCubes = vtkMarchingCubes::New( ); + _mCubes->SetInput( imagedata ); + _mCubes->SetValue( 0, isoValue ); + + vtkStripper *stripper = vtkStripper::New(); + stripper->SetInput( _mCubes->GetOutput( ) ); + + _surfMapper = vtkPolyDataMapper::New( ); + _surfMapper->SetInput( stripper->GetOutput() ); + _surfMapper->ScalarVisibilityOff( ); + stripper->Delete(); + + _surfActor = vtkActor::New( ); + _surfActor->SetMapper( _surfMapper ); + _surfActor->PickableOff( ); + _surfActor->GetProperty( )->SetColor( 0, 0, 0.8 ); + _surfActor->GetProperty( )->SetOpacity( opacity_OrigVol ); + + // Update Controls + _isoValue->SetRange( (int)(range[0]), (int)(range[1]) ); + _isoValue->SetValue( (int)isoValue ); + + // Interface Update + vtkRenderer *ren = _maracasSurfaceWidget->GetVtk3DSurfaceWidget()->GetRenderer(); + ren->AddActor(_surfActor); + + //-Maracas- + _maracasSurfaceWidget->ShowMARACASData( _mar ); +} + + +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::ResetTree1_JF() +{ + // Remove + vtkRenderer *ren = _maracasSurfaceWidget->GetVtk3DSurfaceWidget()->GetRenderer(); + if (_1_isoActorMC6){ + ren->RemoveActor(_1_isoActorMC6); + } + if (_1_stripfinal){ + ren->RemoveActor(_1_stripfinal); + } + + // Delete + if (_1_prgov ) { _1_prgov -> Delete(); } + if (_1_mapfinal ) { _1_mapfinal -> Delete(); } + if (_1_stripfinal ) { _1_stripfinal -> Delete(); } + if (_1_isoMapperMC6 ) { _1_isoMapperMC6 -> Delete(); } + if (_1_isoActorMC6 ) { _1_isoActorMC6 -> Delete(); } + if (_1_isoMC6 ) { _1_isoMC6 -> Delete(); } + + // Init + _1_prgov = NULL; + _1_mapfinal = NULL; + _1_stripfinal = NULL; + _1_isoMapperMC6 = NULL; + _1_isoActorMC6 = NULL; + _1_isoMC6 = NULL; +} + +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::ResetTree2_JF() +{ + // Remove + vtkRenderer *ren = _maracasSurfaceWidget->GetVtk3DSurfaceWidget()->GetRenderer(); + if (_2_isoActorMC6){ + ren->RemoveActor(_2_isoActorMC6); + } + if (_2_stripfinal){ + ren->RemoveActor(_2_stripfinal); + } + + // Delete + if (_2_prgov ) { _2_prgov -> Delete(); } + if (_2_mapfinal ) { _2_mapfinal -> Delete(); } + if (_2_stripfinal ) { _2_stripfinal -> Delete(); } + if (_2_isoMapperMC6 ) { _2_isoMapperMC6 -> Delete(); } + if (_2_isoActorMC6 ) { _2_isoActorMC6 -> Delete(); } + if (_2_isoMC6 ) { _2_isoMC6 -> Delete(); } + + // Init + _2_prgov = NULL; + _2_mapfinal = NULL; + _2_stripfinal = NULL; + _2_isoMapperMC6 = NULL; + _2_isoActorMC6 = NULL; + _2_isoMC6 = NULL; +} + + + +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::ExtractTree1_JF(int x, int y, int z) +{ + double opacity_Res1VolJF = ((double)_opacity_Res1VolJF->GetValue())/100; + vtkImageData *imagedata = _mar->_experiment->getDynData( )->getVolume( )->castVtk(); + + double puntoactualprov[3]; + double espprin[3]; + int extprin[6]; + + puntoactualprov[0]=x; + puntoactualprov[1]=y; + puntoactualprov[2]=z; + + imagedata->GetSpacing(espprin); + imagedata->GetExtent(extprin); + + puntoactualprov[0]=puntoactualprov[0]*espprin[0]; + puntoactualprov[1]=puntoactualprov[1]*espprin[1]; + puntoactualprov[2]=puntoactualprov[2]*espprin[2]; + + // Juan Francisco Carrillo Filter + _1_prgov= axisExtractor::New(); + _1_prgov->SetHumbral(0.45); + _1_prgov->SetInput(imagedata); + _1_prgov->SetPoint(puntoactualprov); + _1_prgov->Update(); + + // Visualisation - result vascular tree + _1_mapfinal = vtkPolyDataMapper::New(); + _1_mapfinal->SetInput(_1_prgov->GetOutput()); + + _1_stripfinal = vtkActor::New(); + _1_stripfinal->SetMapper(_1_mapfinal); + _1_stripfinal->GetProperty()->SetColor(1, 1, 1); + _1_stripfinal->GetProperty()->SetLineWidth(2); + _1_stripfinal->GetProperty()->BackfaceCullingOff(); + + // Visualisation - result volume + vtkImageData *imageOut = _1_prgov->GetVolumen(); + imageOut->Update(); + + _1_isoMC6 = vtkMarchingCubes::New(); + _1_isoMC6->SetInput(imageOut); + _1_isoMC6->SetValue(0, 1); + _1_isoMC6->Update(); + + _1_isoMapperMC6 = vtkPolyDataMapper::New(); + _1_isoMapperMC6->SetInput(_1_isoMC6->GetOutput()); + _1_isoMapperMC6->ScalarVisibilityOff(); + _1_isoMapperMC6->ImmediateModeRenderingOn(); + + _1_isoActorMC6 = vtkActor::New(); + _1_isoActorMC6->SetMapper(_1_isoMapperMC6); + _1_isoActorMC6->GetProperty()->SetColor( 0, 1, 0); + _1_isoActorMC6->GetProperty()->SetOpacity( opacity_Res1VolJF ); + + + // Interface Update + vtkRenderer *ren = _maracasSurfaceWidget->GetVtk3DSurfaceWidget()->GetRenderer(); + ren->AddActor(_1_isoActorMC6); + ren->AddActor(_1_stripfinal); +} + + +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::ExtractTree2_JF(int x, int y, int z) +{ + double opacity_Res2VolJF = ((double)_opacity_Res2VolJF->GetValue())/100; + vtkImageData *imagedata = _mar->_experiment->getDynData( )->getVolume( )->castVtk(); + + double puntoactualprov[3]; + double espprin[3]; + int extprin[6]; + + puntoactualprov[0]=x; + puntoactualprov[1]=y; + puntoactualprov[2]=z; + + imagedata->GetSpacing(espprin); + imagedata->GetExtent(extprin); + + puntoactualprov[0]=puntoactualprov[0]*espprin[0]; + puntoactualprov[1]=puntoactualprov[1]*espprin[1]; + puntoactualprov[2]=puntoactualprov[2]*espprin[2]; + + _2_prgov= axisExtractor02::New(); + _2_prgov->SetParam(1); + _2_prgov->SetParam2(1); + _2_prgov->SetParam3(_sensibility_JF); + _2_prgov->SetMaxant(20); + _2_prgov->SetMinant(5); + _2_prgov->SetInput(imagedata); + _2_prgov->SetPoint(puntoactualprov); + _2_prgov->Update(); + + // Visualisation - result vascular tree + _2_mapfinal = vtkPolyDataMapper::New(); + _2_mapfinal->SetInput(_2_prgov->GetOutput()); + + _2_stripfinal = vtkActor::New(); + _2_stripfinal->SetMapper(_2_mapfinal); + _2_stripfinal->GetProperty()->SetColor(0.3, 0.3, 0.3); + _2_stripfinal->GetProperty()->SetLineWidth(2); + _2_stripfinal->GetProperty()->BackfaceCullingOff(); + + // Visualisation - result volume + vtkImageData *imageOut = _2_prgov->GetVolumen(); + imageOut->Update(); + + _2_isoMC6 = vtkMarchingCubes::New(); + _2_isoMC6->SetInput(imageOut); + _2_isoMC6->SetValue(0, 1); + _2_isoMC6->Update(); + + _2_isoMapperMC6 = vtkPolyDataMapper::New(); + _2_isoMapperMC6->SetInput(_2_isoMC6->GetOutput()); + _2_isoMapperMC6->ScalarVisibilityOff(); + _2_isoMapperMC6->ImmediateModeRenderingOn(); + + _2_isoActorMC6 = vtkActor::New(); + _2_isoActorMC6->SetMapper(_2_isoMapperMC6); + _2_isoActorMC6->GetProperty()->SetColor( 1, 1, 0); + _2_isoActorMC6->GetProperty()->SetOpacity( opacity_Res2VolJF ); + + // Interface Update + vtkRenderer *ren = _maracasSurfaceWidget->GetVtk3DSurfaceWidget()->GetRenderer(); + ren->AddActor(_2_isoActorMC6); + ren->AddActor(_2_stripfinal); +} + +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::OnOpacity_OrigVol(wxScrollEvent& event) +{ + double value = ((double)_opacity_OrigVol->GetValue())/100; + _surfActor->GetProperty( )->SetOpacity( value ); + Refresh(); +} +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::OnOpacity_Res1VolJF(wxScrollEvent& event) +{ + if (_1_isoActorMC6!=NULL){ + double value = ((double)_opacity_Res1VolJF->GetValue())/100; + _1_isoActorMC6->GetProperty( )->SetOpacity( value ); + Refresh(); + } +} +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::OnOpacity_Res2VolJF(wxScrollEvent& event) +{ + if (_2_isoActorMC6!=NULL){ + double value = ((double)_opacity_Res2VolJF->GetValue())/100; + _2_isoActorMC6->GetProperty( )->SetOpacity( value ); + Refresh(); + } +} + +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::OnIsoValue(wxScrollEvent& event) +{ + wxBusyCursor wait; + _mCubes->SetValue(0, _isoValue->GetValue()); + Refresh(); +} +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::OnBtnExtractTree1_JF(wxCommandEvent& event) +{ + if (_1_prgov==NULL){ + wxBusyCursor wait; + vtk3DSurfaceWidget *world3D = _maracasSurfaceWidget->GetVtk3DSurfaceWidget(); + if( world3D->GetInitialSphere() ){ + double point[3]; + world3D->GetSphereCenter( point ); + ExtractTree1_JF((int)point[0],(int)point[1],(int)point[2]); + } + Refresh(); + } +} +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::OnBtnExtractTree2_JF(wxCommandEvent& event) +{ + if (_2_prgov==NULL){ + wxBusyCursor wait; + vtk3DSurfaceWidget *world3D = _maracasSurfaceWidget->GetVtk3DSurfaceWidget(); + if( world3D->GetInitialSphere() ){ + double point[3]; + world3D->GetSphereCenter( point ); + ExtractTree2_JF((int)point[0],(int)point[1],(int)point[2]); + } + Refresh(); + } +} +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::OnBtnEraseTree1_JF(wxCommandEvent& event) +{ + ResetTree1_JF(); + Refresh(); +} +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::OnBtnEraseTree2_JF(wxCommandEvent& event) +{ + ResetTree2_JF(); + Refresh(); +} + +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::PaintVascularTree_MH_JFC(marExperiment * newExperiment) +{ + vtkActor *branchActor; + vtkPolyData *axisVtk; + vtkPolyDataMapper *branchMapper; + vtkRenderer *ren = _maracasSurfaceWidget->GetVtk3DSurfaceWidget()->GetRenderer(); + + int i,maxAxis=newExperiment->getNumberOfAxes(); + for (i=0;isetAxis(i); + marAxis *maraxis =newExperiment->getAxis( ); + if (maraxis!=NULL) { + axisVtk = maraxis->Draw(); + branchMapper = vtkPolyDataMapper::New( ); + branchMapper->SetInput( axisVtk ); + branchMapper->Update(); + branchActor = vtkActor::New( ); + branchActor->SetMapper( branchMapper ); + branchActor->GetProperty()->SetColor( 1, 1, 1 ); + if (i== 0) { branchActor->GetProperty()->SetColor( 0 , 0 , 0.3 ); } + if (i== 1) { branchActor->GetProperty()->SetColor( 0 , 0.3 , 0.3 ); } + if (i== 2) { branchActor->GetProperty()->SetColor( 0.3, 0.3 , 0.3 ); } + if (i== 3) { branchActor->GetProperty()->SetColor( 0.0, 0.0 , 0.6 ); } + if (i== 4) { branchActor->GetProperty()->SetColor( 0.0, 0.6 , 0.6 ); } + if (i== 5) { branchActor->GetProperty()->SetColor( 0.6, 0.6 , 0.6 ); } + if (i== 7) { branchActor->GetProperty()->SetColor( 0.0, 0.0 , 0.9 ); } + if (i== 8) { branchActor->GetProperty()->SetColor( 0.0, 0.9 , 0.9 ); } + if (i== 9) { branchActor->GetProperty()->SetColor( 0.9, 0.9 , 0.9 ); } + if (i==10) { branchActor->GetProperty()->SetColor( 0.9, 0.0 , 0.0 ); } + if (i==11) { branchActor->GetProperty()->SetColor( 0.6, 0.0 , 0.0 ); } + if (i==12) { branchActor->GetProperty()->SetColor( 0.3, 0.0 , 0.0 ); } + if (i==13) { branchActor->GetProperty()->SetColor( 0.6, 0.6 , 0.0 ); } + if (i==14) { branchActor->GetProperty()->SetColor( 0.3, 0.3 , 0.0 ); } + if (i==15) { branchActor->GetProperty()->SetColor( 0.9, 0.9 , 0.0 ); } + branchActor->GetProperty()->SetLineWidth( 2.0 ); + ren->AddActor( branchActor ); + + _lstAxisVtk.push_back( axisVtk ); + _lstBranchActor.push_back( branchActor ); + _lstBranchMapper.push_back( branchMapper ); + } + } +} + + +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::PaintVascularVolume_MH_JFC(vtkImageData * image) +{ + + // Visualisation - result volume + image->Update(); + + _imageThresholdMC1=vtkImageThreshold::New(); + _imageThresholdMC1->SetInput(image); + _imageThresholdMC1->ThresholdBetween(0,100); + _imageThresholdMC1->SetOutValue ( 0 ); + _imageThresholdMC1->Update(); + + _isoMC1 = vtkMarchingCubes::New(); + _isoMC1->SetInput(_imageThresholdMC1->GetOutput() ); + _isoMC1->SetValue(0, 1); + _isoMC1->Update(); + + _isoMapperMC1 = vtkPolyDataMapper::New(); + _isoMapperMC1->SetInput(_isoMC1->GetOutput()); + _isoMapperMC1->ScalarVisibilityOff(); + _isoMapperMC1->ImmediateModeRenderingOn(); + _isoMapperMC1->Update(); + + _isoActorMC1 = vtkActor::New(); + _isoActorMC1->SetMapper(_isoMapperMC1); + _isoActorMC1->GetProperty()->SetColor( 1, 0, 0); + _isoActorMC1->GetProperty()->SetOpacity( 0.4 ); + + // Interface Update + vtkRenderer *ren = _maracasSurfaceWidget->GetVtk3DSurfaceWidget()->GetRenderer(); + ren->AddActor(_isoActorMC1); +} + +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::WriteSignals(marExperiment *newExperiment){ + int i = 0; + int j = 0; + bool ok = true; + int value = 0; + int maxAxis = newExperiment->getNumberOfAxes(); + + FILE *ff; + ff=fopen("c:/Temp/MaracasTEMP.TXT", "w"); + + while (ok==true){ + ok=false; + for (i=0;isetAxis(i); + marAxis *maraxis =newExperiment->getAxis( ); + if (maraxis!=NULL) { + if ( j < maraxis->getNumberOfControlPoints() ){ + ok=true; + value= (int) (maraxis->getSignal((uint)j) ); + fprintf(ff,"%d\t", value ); + } else { + fprintf(ff,"\t"); + } + } + } + fprintf(ff,"\n" ); + j++; + } + fclose(ff); + +} + + +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::OnBtnExtractTree_MH_JFC(wxCommandEvent& event) +{ + if ((_lstBranchActor.size()==0) + && + (_maracasSurfaceWidget->GetVtk3DSurfaceWidget()->GetInitialSphere() ) ) + { + wxBusyCursor wait; + + // Copie Volume + int voiA[6]; + int voiB[6]; + _mar->_experiment->getVOI(voiA); + voiB[0]=0; + voiB[1]=voiA[1]-voiA[0]; + voiB[2]=0; + voiB[3]=voiA[3]-voiA[2]; + voiB[4]=0; + voiB[5]=voiA[5]-voiA[4]; + marExperiment *newExperiment = new marExperiment( _mar->_experiment->getParameters() ); + newExperiment->setVOI( voiB ); + newExperiment->initExperiment( _mar->_experiment->getDynData( )->getVolume() ); + + double point[3]; + int extent[ 6 ]; + _mar->_experiment->getDynData( )->getVolume( )->castVtk()->GetExtent( extent ); + _maracasSurfaceWidget->GetVtk3DSurfaceWidget()->GetSphereCenter( point ); + int x = (int)point[0] - extent[0]; + int y = (int)point[1] - extent[2]; + int z = (int)point[2] - extent[4]; + newExperiment->setStartPoint( x, y, z); + + // Vascular tree extraction + _treeExtraction = TreeExtraction_MH_JFC::New(); + _treeExtraction->SetInput(newExperiment); + _treeExtraction->SetCleanTreeLevel( _cleanTree_MH_JFC->GetValue() ); + _treeExtraction->SetBranchLevel( _branchLevel->GetValue() ); + _treeExtraction->Update(); + + //Paint Vascular Tree + PaintVascularTree_MH_JFC(newExperiment); + //Paint Vascular Volume + PaintVascularVolume_MH_JFC( _treeExtraction->GetVolume() ); + Refresh( ); + + WriteSignals(newExperiment); + + // Clening memory + delete newExperiment; + } +} +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::OnBtnEraseTree_MH_JFC(wxCommandEvent& event) +{ + ResetTree_MH_JFC(); + Refresh(); +} + +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::ResetTree_MH_JFC() +{ + // Remove + vtkRenderer *ren = _maracasSurfaceWidget->GetVtk3DSurfaceWidget()->GetRenderer(); + int i,size; + size=_lstAxisVtk.size(); + size=_lstBranchMapper.size(); + size=_lstBranchActor.size(); + for (i=0;iRemoveActor( _lstBranchActor[i] ); + } + } + for (i=0;i Delete(); } +// if (_lstBranchMapper[i] != NULL ) { _lstBranchMapper[i] -> Delete(); } + if (_lstBranchActor[i] != NULL ) { _lstBranchActor[i] -> Delete(); } + // Init + _lstAxisVtk[i] = NULL; + _lstBranchActor[i] = NULL; + _lstBranchMapper[i] = NULL; + } + _lstAxisVtk.clear(); + _lstBranchActor.clear(); + _lstBranchMapper.clear(); + + // Remove + if (_isoActorMC1){ + ren->RemoveActor(_isoActorMC1); + } + + // Delete + if (_isoMapperMC1 ) { _isoMapperMC1 -> Delete(); } + if (_isoActorMC1 ) { _isoActorMC1 -> Delete(); } + if (_isoMC1 ) { _isoMC1 -> Delete(); } + if (_imageThresholdMC1 ) { _imageThresholdMC1 -> Delete(); } + + + // Init + _isoMapperMC1 = NULL; + _isoActorMC1 = NULL; + _isoMC1 = NULL; + _imageThresholdMC1 = NULL; + + // +// if (_treeExtraction ) { _treeExtraction -> Delete(); } // EED +// _treeExtraction=NULL; + +} + +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::OnOpacity_ResVolMHJF(wxScrollEvent& event) +{ + if (_isoActorMC1!=NULL){ + double value = ((double)_opacity_ResVolMHJF->GetValue())/100; + _isoActorMC1->GetProperty( )->SetOpacity( value ); + } + Refresh(); +} +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::OnBranchLevel(wxScrollEvent& event) +{ + // +} +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::OnIsoValue_MH_JFC(wxScrollEvent& event) +{ + if (_imageThresholdMC1!=NULL){ + wxBusyCursor wait; + double threshold = _isoValue_MH_JFC->GetValue(); + if (threshold!=0){ + _imageThresholdMC1->ThresholdBetween(threshold, threshold ); + } else { + _imageThresholdMC1->ThresholdBetween(0, 1000 ); + } + Refresh(); + } +} +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::OnCleanTree_MH_JFC(wxScrollEvent& event) +{ +// +} +//------------------------------------------------------------------------ +void wxEmptyPanelWidget_2::OnSensibility(wxScrollEvent& event) +{ + _sensibility_JF = (double)(_sl_sensibility_JF->GetValue())/100; +} + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanelWidget_2.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanelWidget_2.h new file mode 100644 index 0000000..831a951 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanelWidget_2.h @@ -0,0 +1,149 @@ + +#ifndef EMPTY_PANEL_WIDGET_2_H +#define EMPTY_PANEL_WIDGET_2_H + +#include + +#include +#include +#include +#include + +#include "wxVTKRenderWindowInteractor.h" +#include "wxSurfaceWidget.h" +#include "wxVtkBaseView.h" +#include +#include +#include +#include + +//------------------------------------------------------------------ +//------------------------------------------------------------------ +//------------------------------------------------------------------ + +class TreeExtraction_MH_JFC : public vtkObject +{ +public: + static TreeExtraction_MH_JFC *New(); + virtual void SetInput(marExperiment *input); + void SetBranchLevel(int branchLevel); + marExperiment *GetInput(); + vtkImageData *GetVolume(); + void Update(); + void SetCleanTreeLevel( int cleanLevel ); + +protected: + TreeExtraction_MH_JFC(); + ~TreeExtraction_MH_JFC(); + void Execute( int count , int sens=1 , double *vit=NULL , int cleanLevel=0); + +private: + double _cleanLevel; + int _branchLevel; + carotidaBifurcacion *_prgov; + vtkImageData *_imagedataResult; + marExperiment *_marExperiment; + void Reset(); + void InitImagaDataResult(); + void BruleVolume( vtkImageData *imagedata, int x,int y,int z,int r,int value ); + void BruleVolume( vtkImageData *imagedata, vtkPolyData *inputAxisRadio,int value ); + void FindVit( marExperiment *newExperiment , int actualAxis , double *pointBif , double *vit ); +}; + +//------------------------------------------------------------------ +//------------------------------------------------------------------ +//------------------------------------------------------------------ + +class wxEmptyPanelWidget_2: public wxPanel{ +public: + wxEmptyPanelWidget_2(wxWindow *parentmar,marInterface *mar); + ~wxEmptyPanelWidget_2(); + void ConfigureVTK(); + void Refresh(); + void OnOpacity_OrigVol(wxScrollEvent& event); // Original Volume + void OnOpacity_Res1VolJF(wxScrollEvent& event); // Result 1 Volume JF + void OnOpacity_Res2VolJF(wxScrollEvent& event); // Result 2 Volume JF + void OnIsoValue(wxScrollEvent& event); + void OnBtnExtractTree1_JF(wxCommandEvent& event); + void OnBtnExtractTree2_JF(wxCommandEvent& event); + void OnBtnEraseTree1_JF(wxCommandEvent& event); + void OnBtnEraseTree2_JF(wxCommandEvent& event); + void OnBtnExtractTree_MH_JFC(wxCommandEvent& event); + void OnBtnEraseTree_MH_JFC(wxCommandEvent& event); + void OnOpacity_ResVolMHJF(wxScrollEvent& event); // Result Volume MH+JFC + void OnBranchLevel(wxScrollEvent& event); // MH+JFC + void OnIsoValue_MH_JFC(wxScrollEvent& event); + void OnCleanTree_MH_JFC(wxScrollEvent& event); + void OnSensibility(wxScrollEvent& event); + +private: + + TreeExtraction_MH_JFC *_treeExtraction; + + // Original Volume + vtkMarchingCubes *_mCubes; + vtkPolyDataMapper *_surfMapper; + vtkActor *_surfActor; + + // Result 1 volume + Axis + axisExtractor *_1_prgov; + vtkPolyDataMapper *_1_mapfinal; + vtkActor *_1_stripfinal; + vtkPolyDataMapper *_1_isoMapperMC6; + vtkActor *_1_isoActorMC6; + vtkMarchingCubes *_1_isoMC6; + + // Result 2 volume + Axis + axisExtractor02 *_2_prgov; + vtkPolyDataMapper *_2_mapfinal; + vtkActor *_2_stripfinal; + vtkPolyDataMapper *_2_isoMapperMC6; + vtkActor *_2_isoActorMC6; + vtkMarchingCubes *_2_isoMC6; + double _sensibility_JF; + + + // Result tree MH_JFC + vtkPolyDataMapper *_isoMapperMC1; + vtkActor *_isoActorMC1; + vtkMarchingCubes *_isoMC1; + vtkImageThreshold *_imageThresholdMC1; + + std::vector< vtkActor* > _lstBranchActor; + std::vector< vtkPolyData* > _lstAxisVtk; + std::vector< vtkPolyDataMapper* > _lstBranchMapper; + + wxSlider *_opacity_OrigVol; + wxSlider *_opacity_Res1VolJF; + wxSlider *_opacity_Res2VolJF; + wxSlider *_sl_sensibility_JF; + wxSlider *_isoValue; + wxSlider *_branchLevel; + wxSlider *_opacity_ResVolMHJF; + wxSlider *_isoValue_MH_JFC; + wxSlider *_cleanTree_MH_JFC; + + wxVtk3DBaseView *_imageviewer3D; + wxPanel *CreateControlPanel(wxWindow *parent); + wxPanel *CreateViewPanel(wxWindow *parent); + + //Maracas + marInterface *_mar; + wxSurfaceWidget *_maracasSurfaceWidget; + + void ResetTree1_JF(); + void ResetTree2_JF(); + void ExtractTree1_JF(int x, int y, int z); + void ExtractTree2_JF(int x, int y, int z); + + void ResetTree_MH_JFC(); + void PaintVascularTree_MH_JFC(marExperiment * newExperiment); + void PaintVascularVolume_MH_JFC(vtkImageData * image); + void WriteSignals(marExperiment *newExperiment); +}; + +#endif // EMPTY_PANEL_WIDGET_2_H + + + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanel_3_Widget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanel_3_Widget.cxx new file mode 100644 index 0000000..3c03db8 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanel_3_Widget.cxx @@ -0,0 +1,283 @@ + + + +//EED 29Dic2006 Borrame prueba mara Michael + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include "vtkActor.h" +#include "vtkSphereSource.h" +#include "vtkPolyDataMapper.h" +#include "vtkImageData.h" +#include "vtkImageCast.h" + +#include "wxEmptyPanel_3_Widget.h" + + + +#include + +//------------------------------------------------------------------- +//------------------------------------------------------------------- +//------------------------------------------------------------------- +BEGIN_EVENT_TABLE( wxEmptyPanel_3_Widget, wxPanel ) + EVT_MENU( 12121, wxEmptyPanel_3_Widget::OnRefreshView ) +END_EVENT_TABLE( ); +//------------------------------------------------------------------- +wxEmptyPanel_3_Widget::wxEmptyPanel_3_Widget(wxWindow *parent) +: wxPanel( parent, -1) +{ + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL ); + wxSplitterWindow *pnlSplitter = new wxSplitterWindow( this , -1); + wxPanel *viewPanel = CreateViewPanel(pnlSplitter); + wxPanel *controlPanel = CreateControlPanel(pnlSplitter); + + sizer -> Add( pnlSplitter ,1,wxGROW ,0); + pnlSplitter -> SetMinimumPaneSize( 50 ); + pnlSplitter -> SplitVertically( viewPanel, controlPanel ); + this -> SetSizer(sizer); +//EEDxx2.4 +// FitInside(); +} +//------------------------------------------------------------------- +wxEmptyPanel_3_Widget::~wxEmptyPanel_3_Widget(){ + delete _imageviewer2D_1; +} +//------------------------------------------------------------------- +wxPanel* wxEmptyPanel_3_Widget::CreateViewPanel(wxWindow *parent) +{ + wxPanel *panel = new wxPanel(parent,-1); + wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); + + _imageviewer2D_1 = new wxVtk2DBaseView(panel); + wxVTKRenderWindowInteractor *iren = _imageviewer2D_1->GetWxVTKRenderWindowInteractor(); + sizer->Add(iren , 1, wxEXPAND, 0); + + + panel->SetSizer(sizer); + panel->SetAutoLayout(true); + panel->SetSize(400,400); + panel->Layout(); + return panel; +} +//------------------------------------------------------------------- +wxPanel* wxEmptyPanel_3_Widget::CreateControlPanel(wxWindow *parent) +{ + _parent=parent; + wxPanel *panel = new wxPanel(parent,-1); + + wxButton *btnContourA = new wxButton( panel, -1, _T("Active Contour A")); + wxButton *btnContourB = new wxButton( panel, -1, _T("Active Contour B")); + wxButton *btnContourAB = new wxButton( panel, -1, _T("Active Contour AB")); + + + wxFlexGridSizer *sizer = new wxFlexGridSizer(1); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(new wxStaticText(panel,-1,_T(" "))); + sizer->Add(btnContourA); + sizer->Add(btnContourB); + sizer->Add(btnContourAB); + + panel->SetSizer(sizer); + panel->SetAutoLayout(true); + panel->SetSize(400,400); + panel->Layout(); + Connect(btnContourA->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxEmptyPanel_3_Widget::OnContourA ); + Connect(btnContourB->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxEmptyPanel_3_Widget::OnContourB ); + Connect(btnContourAB->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxEmptyPanel_3_Widget::OnContourAB ); + return panel; +} +//------------------------------------------------------------------------ +void wxEmptyPanel_3_Widget::Refresh() +{ + _imageviewer2D_1->Refresh(); +} +//---------------------------------------------------------------------------- +void wxEmptyPanel_3_Widget::OnRefreshView(wxCommandEvent & event) +{ + Refresh(); +} + + +//------------------------------------------------------------------------ + +void wxEmptyPanel_3_Widget::ConfigureVTK(marImageData *marimagedata) +{ + wxBusyCursor wait; + double spc[3]; + + vtkImageData *vtkimagedata = marimagedata->GetImageData(); // image t=0 + vtkimagedata->UpdateInformation(); + vtkimagedata->SetUpdateExtent(vtkimagedata->GetWholeExtent()); + vtkimagedata->Update(); + _data = vtkimagedata; + _data->GetSpacing(spc); + _vtkbasedata_1 = new vtkBaseData(); + _vtkbasedata_1->SetMarImageData(marimagedata); + _imageviewer2D_1->SetVtkBaseData( _vtkbasedata_1 ); + _imageviewer2D_1->Configure(); + +// vtkImageViewer2 *_imageViewer=_imageviewer2D_1->_imageViewer2XYZ->GetVtkImageViewer2(); + + // Contorno 1 + _manContourControl_1 = new manualContourControler(); + _mContourModel_1 = new manualContourModel(); + _mViewContour_1 = new manualViewContour(); + _mViewContour_1->SetModel( _mContourModel_1 ); + _mViewContour_1->SetWxVtkBaseView( _imageviewer2D_1 ); + _mViewContour_1->SetRange( 2 ); + _mViewContour_1->SetZ( 1000 ); + + +//EED 3 oct 2006 + _mViewContour_1->SetSpacing(spc); + + +//EED 3 oct 2006 + _mViewContour_1->SetColorNormalContour(0, 0, 1); + _mViewContour_1->SetColorEditContour(0, 0.5, 0.5); + + + _manContourControl_1->SetModelView( _mContourModel_1 , _mViewContour_1 ); + _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContourControl_1 ); + _manContourControl_1->CreateNewManualContour(); + _manContourControl_1->SetActive(false); + _mViewContour_1->RefreshContour(); + + // Rectangulo + _manRoiControl = new manualRoiControler(); + _mContourModel = new manualContourModel(); + _mViewRoi = new manualViewRoi(); + _mViewRoi->SetModel( _mContourModel ); + _mViewRoi->SetWxVtkBaseView( _imageviewer2D_1 ); + _mViewRoi->SetRange( 2 ); + _mViewRoi->SetZ( 1000 ); + +//EED 3 oct 2006 + _mViewRoi->SetSpacing(spc); + + _manRoiControl->SetModelView( _mContourModel , _mViewRoi ); + _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manRoiControl ); + _manRoiControl->CreateNewManualContour(); + _manRoiControl->SetActive(true); + _mViewRoi->RefreshContour(); + + // Contorno 2 + _manContourControl_2 = new manualContourControler(); + _mContourModel_2 = new manualContourModel(); + _mViewContour_2 = new manualViewContour(); + _mViewContour_2->SetModel( _mContourModel_2 ); + _mViewContour_2->SetWxVtkBaseView( _imageviewer2D_1 ); + _mViewContour_2->SetRange( 2 ); + _mViewContour_2->SetZ( 1000 ); + +//EED 3 oct 2006 + _mViewContour_2->SetSpacing(spc); + +//EED 3 oct 2006 + _mViewContour_2->SetColorNormalContour(1, 1, 1); + _mViewContour_2->SetColorEditContour(0.5, 0.5, 0.5); + + + _manContourControl_2->SetModelView( _mContourModel_2 , _mViewContour_2 ); + _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContourControl_2 ); + _manContourControl_2->CreateNewManualContour(); + _manContourControl_2->SetActive(false); + _mViewContour_2->RefreshContour(); + +CreateNewPoint( 0,0); + + Refresh(); +} + + +//---------------------------------------------------------------------------- +//eedx21 +void wxEmptyPanel_3_Widget::CreateNewPoint(double x, double y) +{ +/* + + vtkSphereSource* aSphere =vtkSphereSource::New(); + aSphere->SetRadius(0.2); + aSphere->SetCenter(x,y,0.5); + + point_mapped.push_back(vtkPolyDataMapper::New()); + point_mapped.back()->ImmediateModeRenderingOn(); + //point_mapped.back()->ScalarVisibilityOff( ); + point_mapped.back()->SetInput(aSphere->GetOutput()); + + point_actor.push_back(vtkActor::New()); + point_actor.back()->SetMapper(point_mapped.back()); + point_actor.back()->GetProperty()->BackfaceCullingOff(); + point_actor.back()->GetProperty()->SetColor(0, 1, 0); + + point_actor.back()->ApplyProperties(); + + _wxvtkbaseview->GetRenderer()->AddActor(point_actor.back()); + _wxvtkbaseview->GetRenWin()->Render(); +*/ + +/* + vtkActor *spheresActor = vtkActor::New( ); + vtkSphereSource *spheres = vtkSphereSource::New( ); + vtkPolyDataMapper *spheresMapper = vtkPolyDataMapper::New( ); + spheresMapper -> SetInput( spheres->GetOutput( ) ); + spheresActor -> SetMapper( spheresMapper ); + _imageviewer2D_1 -> GetRenderer() -> AddActor( spheresActor ); + spheres->SetCenter( x,y,0 ); + spheres->SetRadius( 10 ); +*/ + + vtkSphereSource *spheres = vtkSphereSource::New( ); + spheres->SetCenter( x,y,0 ); + spheres->SetRadius( 5 ); + vtkPolyDataMapper *spheresMapper = vtkPolyDataMapper::New( ); + spheresMapper ->ImmediateModeRenderingOn(); + spheresMapper -> SetInput( spheres->GetOutput( ) ); + vtkActor *spheresActor = vtkActor::New( ); + spheresActor -> SetMapper( spheresMapper ); + spheresActor ->GetProperty()->BackfaceCullingOff(); + spheresActor ->GetProperty()->SetColor(0, 1, 0); + spheresActor ->ApplyProperties(); + _imageviewer2D_1 -> GetRenderer() -> AddActor( spheresActor ); + + +} + + + + +//------------------------------------------------------------------------ +void wxEmptyPanel_3_Widget::OnContourA(wxCommandEvent& event) +{ + _manRoiControl -> SetActive(false); + _manContourControl_1 -> SetActive(true); + _manContourControl_2 -> SetActive(false); +} +//------------------------------------------------------------------------ +void wxEmptyPanel_3_Widget::OnContourB(wxCommandEvent& event) +{ + _manRoiControl -> SetActive(false); + _manContourControl_1 -> SetActive(false); + _manContourControl_2 -> SetActive(true); +} +//------------------------------------------------------------------------ +void wxEmptyPanel_3_Widget::OnContourAB(wxCommandEvent& event) +{ + _manRoiControl -> SetActive(false); + _manContourControl_1 -> SetActive(true); + _manContourControl_2 -> SetActive(true); +} +//------------------------------------------------------------------------ + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanel_3_Widget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanel_3_Widget.h new file mode 100644 index 0000000..e305fa2 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxEmptyPanel_3_Widget.h @@ -0,0 +1,59 @@ + + +#ifndef __WX__EMPTY__PANEL__3__WIDGET +#define __WX__EMPTY__PANEL__3__WIDGET + + + +#include +#include "../manualContour.h" +#include "wxMPRWidget.h" + + +#include +#include + +//------------------------------------------------------------------ +//------------------------------------------------------------------ +//------------------------------------------------------------------ + +class wxEmptyPanel_3_Widget: public wxPanel{ +public: + wxEmptyPanel_3_Widget(wxWindow *parent); + ~wxEmptyPanel_3_Widget(); + void ConfigureVTK(marImageData *marimagedata); + void OnContourA(wxCommandEvent& event); + void OnContourB(wxCommandEvent& event); + void OnContourAB(wxCommandEvent& event); + void Refresh(); + void OnRefreshView(wxCommandEvent & event); +void CreateNewPoint(double x, double y); + +private: + wxWindow *_parent; + vtkImageData *_data; + wxVtk2DBaseView *_imageviewer2D_1; + vtkBaseData *_vtkbasedata_1; + wxPanel *CreateControlPanel(wxWindow *parent); + wxPanel *CreateViewPanel(wxWindow *parent); + + manualRoiControler *_manRoiControl; + manualContourModel *_mContourModel; + manualViewRoi *_mViewRoi; + + manualContourControler *_manContourControl_1; + manualContourModel *_mContourModel_1; + manualViewContour *_mViewContour_1; + + manualContourControler *_manContourControl_2; + manualContourModel *_mContourModel_2; + manualViewContour *_mViewContour_2; + + DECLARE_EVENT_TABLE( ); +}; + +#endif // __WX__EMPTY__PANEL__3__WIDGET + + + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxImageBrowserWdg.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxImageBrowserWdg.cxx new file mode 100644 index 0000000..55048ce --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxImageBrowserWdg.cxx @@ -0,0 +1,257 @@ + +#include "wxImageBrowserWdg.h" + +#include +//#include +#include + +BEGIN_EVENT_TABLE( wxImageBrowserWdg, wxScrolledWindow ) + EVT_LEFT_UP( wxImageBrowserWdg::OnMouseLeftClick ) + EVT_RIGHT_UP( wxImageBrowserWdg::OnMouseRightClick ) + EVT_SIZE( wxImageBrowserWdg::OnSize ) + END_EVENT_TABLE( ); + +wxImageBrowserWdg::wxImageBrowserWdg( + wxWindow* parent, + wxWindowID id, + int sx, + int sy, + int gap, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name + ) + : wxScrolledWindow( parent, id, pos, size, style, name ) +{ + _sx = sx; + _sy = sy; + _gap = gap; + _first_selected = -1; + _last_selected = -1; + _ima_list.RemoveAll( ); + _ima_list.Create( _sx, _sy ); + _nrs_list.Clear( ); + +} + +void wxImageBrowserWdg::SetVolume( + unsigned short*** volume, + wxArrayString& names, + int width, + int height, + int depth, + int min, + int max + ) +{ + wxImage tmpI; + unsigned char value; + unsigned char* data; //pointeur sur mon image +// int i, j, k; + + tmpI.Create( width, height ); + _nrs_list = names; + + // Canvas creation + _ima_list.RemoveAll( ); + _ima_list.Create( _sx, _sy ); + + for( int k = 0; k < depth; k++ ) + { + + data = tmpI.GetData(); + data += 3*width*height; +// unsigned short** voltemp = volume[k]; + for ( int i = 0; i < width; i++ ) + { + for ( int j = 0; j < height; j++ ) + { + value = ( unsigned char )( 0x00ff*( volume[ k ][ i ][ height - j - 1] - min) / (max - min)); + data -= 3; + data[0] = value; + data[1] = value; + data[2] = value; + //memset( data, value, 3); + } //rof + } //rof + + //image is set, add it to the list + //another image is created so allocation is not a problem + _ima_list.Add( wxBitmap( tmpI.Scale( _sx, _sy ) ) ); + } // rof + +//FIXME: +#ifdef __WXMSW__ + this->OnSize( wxSizeEvent( ) ); +#else + wxSizeEvent myevent(wxSize(-1, -1), this->GetId()); + this->OnSize(myevent); + this->Show(true); +#endif +} + + + +void wxImageBrowserWdg::SetScaleX( int sx ) +{ + _sx = sx; + +} + +void wxImageBrowserWdg::SetScaleY( int sy ) +{ + _sy = sy; + +} + +void wxImageBrowserWdg::SetGap( int gap ) +{ + _gap = gap; + +} + +int wxImageBrowserWdg::GetScaleX( ) +{ + return( _sx ); + +} + +int wxImageBrowserWdg::GetScaleY( ) +{ + return( _sy ); + +} + +int wxImageBrowserWdg::GetGap( ) +{ + return( _gap ); + +} + +int wxImageBrowserWdg::GetFirst( ) +{ + return( GTM_MIN( _first_selected, _last_selected ) ); + +} + +int wxImageBrowserWdg::GetLast( ) +{ + return( GTM_MAX( _first_selected, _last_selected ) ); + +} + +void wxImageBrowserWdg::GetSizeParameters( int* n, int* c, int* r ) +{ + wxSize sz = this->GetClientSize( ); + + *n = _ima_list.GetImageCount( ); + *c = ( int )floor( ( double )( sz.GetWidth( ) ) / ( double )( _gap + _sx ) ); + *c = ( *c <= 0 )? 1: *c; + *r = ( int )ceil( ( double )( *n ) / ( double )( *c ) ); + +} + +void wxImageBrowserWdg::OnDraw( wxDC& dc ) +{ + int r, c, i, x, y, n, rt; + wxSize sz = this->GetClientSize( ); + + dc.SetTextForeground( wxColour( 255, 255, 0 ) ); + dc.SetBrush( *wxTRANSPARENT_BRUSH ); + + this->GetSizeParameters( &n, &c, &r ); + for( i = 0; i < n; i++ ) + { + rt = ( int )floor( ( double )i / ( double )c ); + x = ( _sx * ( i % c ) ) + ( ( ( i % c ) + 1 ) * _gap ); + y = ( _sy * ( rt % r ) ) + ( ( ( rt % r ) + 1 ) * _gap ); + _ima_list.Draw( i, dc, x, y, wxIMAGELIST_DRAW_NORMAL, true ); + dc.DrawText( _nrs_list[ i ], x, y ); + if( _first_selected == i && _last_selected != i ) + { + dc.SetPen( *wxRED_PEN ); + dc.DrawRectangle( x - ( _gap / 2 ), y - ( _gap / 2 ), _sx + _gap, _sy + _gap ); + + } + else if( _first_selected != i && _last_selected == i ) + { + dc.SetPen( *wxGREEN_PEN ); + dc.DrawRectangle( x - ( _gap / 2 ), y - ( _gap / 2 ), _sx + _gap, _sy + _gap ); + + } + else if( _first_selected == i && _last_selected == i ) + { + dc.SetPen( *wxCYAN_PEN ); + dc.DrawRectangle( x - ( _gap / 2 ), y - ( _gap / 2 ), _sx + _gap, _sy + _gap ); + + } // fi + + } // rof + +} + +void wxImageBrowserWdg::OnSize( wxSizeEvent& event ) +{ + int r, c, n; + wxSize sz = this->GetClientSize( ); + + this->GetSizeParameters( &n, &c, &r ); + + // Scroll bars + this->SetScrollbars( _sx + _gap, _sy + ( _gap * 2 ), c, r ); + +} + +int wxImageBrowserWdg::GetIndexClicked( wxMouseEvent& event ) +{ + double re; + int x, y, n, c, r, i; + wxClientDC dc( this ); + this->PrepareDC( dc ); + wxPoint pos = event.GetLogicalPosition( dc ); + + this->GetSizeParameters( &n, &c, &r ); + + // Image index calculation (Help!!, Mr. wizard!) + x = -1; + re = ( double )( pos.x ) / ( double )( _gap + _sx ); + if( ( re - floor( re ) ) >= ( ( double )( _gap ) / ( double )( _gap + _sx ) ) ) x = ( int )floor( re ); + x = ( x >= 0 && x < c )? x: -1; + y = -1; + re = ( double )( pos.y ) / ( double )( _gap + _sy ); + if( ( re - floor( re ) ) >= ( ( double )( _gap ) / ( double )( _gap + _sy ) ) ) y = ( int )floor( re ); + y = ( y >= 0 && y < r )? y: -1; + i = ( x != -1 && y != -1 )? x + ( y * c ): -1; + return( ( i < n )? i: -1 ); + +} + +void wxImageBrowserWdg::OnMouseLeftClick( wxMouseEvent& event ) +{ + // Select! + _first_selected = this->GetIndexClicked( event ); + + // Drawing + this->Refresh( ); + +} + +void wxImageBrowserWdg::OnMouseRightClick( wxMouseEvent& event ) +{ + // Select! + _last_selected = this->GetIndexClicked( event ); + + // Drawing + this->Refresh( ); + +} + +/* +void wxImageBrowserWdg::Add( const wxImage& ima, const wxString& nrs ) +{ +_ima_list.Add( wxBitmap( ima.Scale( _sx, _sy ) ) ); +_nrs_list.Add( nrs ); +this->OnSize( wxSizeEvent( ) ); +} +*/ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxImageBrowserWdg.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxImageBrowserWdg.h new file mode 100644 index 0000000..31378d2 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxImageBrowserWdg.h @@ -0,0 +1,74 @@ +#ifndef __WX__IMAGE__BROWSER__WDG__ +#define __WX__IMAGE__BROWSER__WDG__ + +#include +#include +#include +#include +#include + +/** + * \brief Widget class that shows thumbnails images + */ +class wxImageBrowserWdg : public wxScrolledWindow +{ +public: + wxImageBrowserWdg( + wxWindow* parent, + wxWindowID id = -1, + int sx = 100, + int sy = 100, + int gap = 10, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxScrolledWindowStyle, + const wxString& name = wxPanelNameStr + ); + + void SetVolume( + unsigned short*** volume, + wxArrayString& names, + int width, + int height, + int depth, + int min, + int max + ); + + void SetScaleX( int sx ); + void SetScaleY( int sy ); + void SetGap( int gap ); + int GetScaleX( ); + int GetScaleY( ); + int GetGap( ); + + int GetFirst( ); + int GetLast( ); + + void GetSizeParameters( int* n, int* c, int* r ); + + void OnDraw( wxDC& dc ); + void OnSize( wxSizeEvent& event ); + + void OnMouseLeftClick( wxMouseEvent& event ); + void OnMouseRightClick( wxMouseEvent& event ); + +// void Add( const wxImage& ima, const wxString& nrs ); + +private: + + int GetIndexClicked( wxMouseEvent& event ); + + wxImageList _ima_list; + wxArrayString _nrs_list; + int _sx; + int _sy; + int _gap; + int _first_selected; + int _last_selected; + + DECLARE_EVENT_TABLE( ); + +}; + +#endif // __WX__IMAGE__BROWSER__WDG__ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxImageViewerWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxImageViewerWidget.cxx new file mode 100644 index 0000000..fa75fac --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxImageViewerWidget.cxx @@ -0,0 +1,630 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: wxImageViewerWidget.cxx,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:42 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + +#include "wxImageViewerWidget.h" + +#include "vtkRenderer.h" +#include "vtkRenderWindowInteractor.h" //extremely important with VC++ don't remove ! +#include "vtkCommand.h" +#include "vtkPolyData.h" +#include "vtkCellArray.h" +#include "vtkPolyDataMapper.h" +#include "vtkInteractorObserver.h" +#include "vtkInteractorStyleImage.h" + +#include +#include +#include +#include + +#include +//---------------------------------------------------------------------------- +// Callback for the interaction +class marZoomROIObserver : public vtkCommand{ + public: + virtual char const *GetClassName() const { return "marZoomROIObserver";} + static marZoomROIObserver *New(){ + marZoomROIObserver * result; + result = new marZoomROIObserver; + return result; + } +// PS -> { return new marZoomROIObserver; } + + marZoomROIObserver() { this->ImageViewerWdg = NULL; } + virtual void Execute(vtkObject *wdg, unsigned long event, void* calldata) { + if ( this->ImageViewerWdg ) { + this->ImageViewerWdg->ExecuteEvent(wdg, event, calldata); + } + } + wxImageViewerWidget *ImageViewerWdg; +}; +/** +Most of the class was done thanks to this mail, thank you James !! +http://public.kitware.com/pipermail/vtkusers/2003-April/017063.html +*/ + + + +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- + +wxVtk2DView_TMP::wxVtk2DView_TMP(vtkImageViewer2 *imageviewer2) +{ + _imageviewer2 = imageviewer2; +} +//---------------------------------------------------------------------------- +wxVtk2DView_TMP::~wxVtk2DView_TMP() +{ +} +//---------------------------------------------------------------------------- +vtkRenderer* wxVtk2DView_TMP::GetRenderer() +{ + return _imageviewer2->GetRenderer(); +} +//---------------------------------------------------------------------------- +vtkRenderWindow* wxVtk2DView_TMP::GetRenWin() +{ + return _imageviewer2->GetRenderWindow(); +} +//---------------------------------------------------------------------------- +void wxVtk2DView_TMP::Configure() // virtual +{ + vtkInteractorStyleBaseView *interactorstylebaseview; + interactorstylebaseview = vtkInteractorStyleBaseView2D::New(); + + SetInteractorStyleBaseView(interactorstylebaseview); + wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor(); + interactorstylebaseview->SetInteractor ( iren ); + iren->SetInteractorStyle(interactorstylebaseview); + interactorstylebaseview->SetwxVtkBaseView(this); +} +//---------------------------------------------------------------------------- +void wxVtk2DView_TMP::SetWxVTKRenderWindowInteractor( wxVTKRenderWindowInteractor *wxVTKiren) +{ + _wxVTKiren = wxVTKiren; +} +//---------------------------------------------------------------------------- +wxVTKRenderWindowInteractor *wxVtk2DView_TMP::GetWxVTKRenderWindowInteractor() // virtual +{ + return _wxVTKiren; +} + +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- + +wxImageViewerWidget::wxImageViewerWidget(wxWindow* parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) : + wxPanel( parent, id, pos, size, style, name ) +{ + _manContControl = NULL; + _mContourModel = NULL; + _mViewContour = NULL; + _Observer = NULL; + + _state=1; + //vtkOutputWindow::GetInstance()->PromptUserOff(); + _wxVTKiren = new wxVTKRenderWindowInteractorEditContour( this, -1 ); + _imageViewer = vtkImageViewer2::New(); + + wxBoxSizer* sizer_1 = new wxBoxSizer(wxVERTICAL); + sizer_1->Add(_wxVTKiren, 1, wxGROW, 0); + SetAutoLayout(true); + SetSizer(sizer_1); + Layout(); + + _intVtkPanWid = NULL; + + +} + +//---------------------------------------------------------------------------- +wxImageViewerWidget::~wxImageViewerWidget(){ + + //imageViewer->GetInput()->Delete(); + if ( _Observer !=NULL ) { _Observer->Delete(); } + + ///\todo I can't find a way to delete a renderWindow on Win32 + ///\todo The following two lines shouldn't be commented + + if ( _imageViewer !=NULL ) { _imageViewer->Delete(); } + //wxVTKiren->SetRenderWhenDisabled( false ); + + if ( _wxVTKiren !=NULL ) { _wxVTKiren->Delete(); } + + + if ( _manContControl !=NULL ) { delete _manContControl; } + if ( _mContourModel !=NULL ) { delete _mContourModel; } + if ( _mViewContour !=NULL ) { delete _mViewContour; } +} + + +//---------------------------------------------------------------------------- +void wxImageViewerWidget::ConstructVTK(vtkImageData *imageData) +{ + _imageViewer->SetInput ( imageData ); + _imageViewer->SetupInteractor ( _wxVTKiren ); + vtkCamera *camera =_imageViewer->GetRenderer()->GetActiveCamera(); + camera->Zoom(2.5); + _imageViewer->GetRenderer()->ResetCamera (); + +// int ww=2000; +// _imageViewer->GetRenderer()->ResetCameraClippingRange(-ww,ww,-ww,ww,-ww,ww); + + //imageViewer->Render(); //NEVER call it explicitely !!! + + //Some images have a bad range, rescale it by default: + imageData->UpdateInformation(); + imageData->SetUpdateExtent( imageData->GetWholeExtent()); + imageData->Update(); + double *range = imageData->GetScalarRange(); +// _imageViewer->SetColorWindow( range[1] - range[0] ); +// _imageViewer->SetColorLevel( 0.5*(range[1] + range[0]) ); + + _Observer = marZoomROIObserver::New(); + _Observer->ImageViewerWdg = this; + + SetState(1); // observer 1 + AddObserver_1(); + _wxVTKiren->SetObserver(_Observer); + + /** + This doesn't seems to be straight forward to overload left button mouse evtn + as vtkImageViewer2 overload window Level event / which is bind to left + mouse click -> as a hack use Middle mouse, (doesn't seems to usefull) + */ + +// wxVTKiren->GetInteractorStyle()->AddObserver(vtkCommand::LeftButtonPressEvent, _Observer); + + + _manContControl = new manualContourControler(); + _mContourModel = new manualContourModel(); + _mViewContour = new manualViewContour(); + + _manContControl->SetZ(100); + _mViewContour->SetModel(_mContourModel); + wxVtk2DView_TMP *wxvtkbaseview_tmp =new wxVtk2DView_TMP(_imageViewer); + _mViewContour->SetWxVtkBaseView( wxvtkbaseview_tmp ); + _mViewContour->SetRange( 2 ); + _manContControl->SetActive(false); + _manContControl->SetModelView(_mContourModel,_mViewContour); + wxvtkbaseview_tmp->SetWxVTKRenderWindowInteractor(_wxVTKiren); + wxvtkbaseview_tmp->Configure(); + wxvtkbaseview_tmp->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContControl ); + + _interactorStyle2DMaracas = vtkInteractorStyle2DMaracas::New(); + _interactorStyle2DMaracas->SetInteractor ( _wxVTKiren ); + _wxVTKiren->SetInteractorStyle(_interactorStyle2DMaracas); + vtkMaracasImageViewer2Callback *cbk = vtkMaracasImageViewer2Callback::New(); + cbk->IV = _imageViewer; + _interactorStyle2DMaracas->AddObserver( vtkCommand::WindowLevelEvent, cbk); + _interactorStyle2DMaracas->AddObserver( vtkCommand::StartWindowLevelEvent, cbk); + _interactorStyle2DMaracas->AddObserver( vtkCommand::ResetWindowLevelEvent, cbk); + cbk->Delete(); + +} + +//---------------------------------------------------------------------------- +void wxImageViewerWidget::SetState(int state){ + _state=state; + _wxVTKiren->SetState(state); +} +//---------------------------------------------------------------------------- +void wxImageViewerWidget::SetStateManualContour(int state){ + _manContControl->SetState(state); +} +//---------------------------------------------------------------------------- +void wxImageViewerWidget::CreateNewManualContour(){ + _manContControl->CreateNewManualContour(); + _manContControl->SetActive(true); + _mViewContour->Refresh(); + Refresh(); +} +//---------------------------------------------------------------------------- +void wxImageViewerWidget::EraseManualContour(){ + _manContControl->DeleteContour(); +} +//---------------------------------------------------------------------------- + +void wxImageViewerWidget::AddObserver_1(){ + + //wxVTKiren->AddObserver(vtkCommand::MiddleButtonPressEvent, _Observer); + //use interactor style to override -for real- the default behavior + _wxVTKiren->GetInteractorStyle()->AddObserver( vtkCommand::MiddleButtonPressEvent , _Observer); + _wxVTKiren->AddObserver(vtkCommand::MouseMoveEvent, _Observer); + //wxVTKiren->AddObserver(vtkCommand::MiddleButtonReleaseEvent, _Observer); + _wxVTKiren->GetInteractorStyle()->AddObserver( vtkCommand::MiddleButtonReleaseEvent , _Observer); + + //EED _wxVTKiren->AddObserver(vtkCommand::MouseWheelForwardEvent, _Observer); + _wxVTKiren->AddObserver( wxEVT_MOUSEWHEEL+10000 , _Observer); + + //EED _wxVTKiren->AddObserver(vtkCommand::MouseWheelBackwardEvent, _Observer); + _wxVTKiren->AddObserver( wxEVT_MOUSEWHEEL+10001 , _Observer); + +} + + +//---------------------------------------------------------------------------- + +void wxImageViewerWidget::AddObserver_2(){ +/* +// _wxVTKiren->AddObserver(vtkCommand::LeftButtonPressEvent , _Observer); +// _wxVTKiren->AddObserver(vtkCommand::LeftButtonReleaseEvent, _Observer); + + _wxVTKiren->AddObserver(vtkCommand::MiddleButtonPressEvent , _Observer); + _wxVTKiren->AddObserver(vtkCommand::MiddleButtonReleaseEvent, _Observer); + +// _wxVTKiren->AddObserver(vtkCommand::RightButtonPressEvent , _Observer); + _wxVTKiren->AddObserver(vtkCommand::MouseMoveEvent , _Observer); +*/ +} + +//---------------------------------------------------------------------------- + +void wxImageViewerWidget::ExecuteEvent(vtkObject *wdg, unsigned long event, void* calldata){ + if (_state==1) { ExecuteEvent1(wdg,event,calldata); } + if (_state==2) { ExecuteEvent2(wdg,event,calldata); } +} + +//---------------------------------------------------------------------------- + +void wxImageViewerWidget::ExecuteEvent1(vtkObject *wdg, unsigned long event, void* calldata){ + + if ( event == vtkCommand::MiddleButtonPressEvent ){ + }else if ( event == vtkCommand::MouseMoveEvent ){ + } + + if ( event == vtkCommand::MiddleButtonReleaseEvent ){ + //EED } else if ( event == vtkCommand::MouseWheelForwardEvent ){ + } else if ( event == wxEVT_MOUSEWHEEL+10000 ){ + wxMouseEvent mouseEvent; + mouseEvent.m_wheelRotation=130; + if (_intVtkPanWid!=NULL) { _intVtkPanWid->CallBackOnMouseWheel(mouseEvent);} + //EED }else if ( event == vtkCommand::MouseWheelBackwardEvent ){ + }else if ( event == wxEVT_MOUSEWHEEL+10001 ){ + wxMouseEvent mouseEvent; + mouseEvent.m_wheelRotation=-130; + if (_intVtkPanWid!=NULL) { _intVtkPanWid->CallBackOnMouseWheel(mouseEvent);} + } +} + +//---------------------------------------------------------------------------- + +void wxImageViewerWidget::ExecuteEvent2(vtkObject *wdg, unsigned long event, void* calldata){ + int X,Y; + _wxVTKiren->GetEventPosition(X, Y); + if (event==wxEVT_LEFT_DOWN ){ + _manContControl->MouseClickLeft(X,Y); + } + + if (event==wxEVT_RIGHT_DOWN ){ + _manContControl->MouseClickRight(X,Y); + } + + if (event==wxEVT_LEFT_UP){ + _manContControl->MouseReleaseLeft(X,Y); + } + + if (event==wxEVT_LEFT_DCLICK){ + _manContControl->MouseDLeft(X,Y); + } + + if (event==wxEVT_MOTION){ + _manContControl->MouseMove(X,Y); + } + + if (event==WXK_CLEAR){ + _manContControl->DeleteActualMousePoint(X,Y); + } +} + +//---------------------------------------------------------------------------- + +void wxImageViewerWidget::SetImage(vtkImageData* imagedata){ + _imageViewer->SetInput(imagedata); + _imageViewer->Render( ); +} + +//---------------------------------------------------------------------------- +int wxImageViewerWidget::GetNumberOfPointsSplineManualContour(){ + return _manContControl->GetNumberOfPointsSplineManualContour(); +} +//---------------------------------------------------------------------------- +double* wxImageViewerWidget::GetVectorPointsXManualContour(){ + return _manContControl->GetVectorPointsXManualContour(); +} +//---------------------------------------------------------------------------- +double* wxImageViewerWidget::GetVectorPointsYManualContour(){ + return _manContControl->GetVectorPointsYManualContour(); +} +//---------------------------------------------------------------------------- +void wxImageViewerWidget::SetZSlice(int z){ +#if (VTK_MAJOR_VERSION >= 5) + _imageViewer->SetSlice( z ); +#else + _imageViewer->SetZSlice( z ); +#endif + +} +//---------------------------------------------------------------------------- +int wxImageViewerWidget::GetZSlice(){ + return _imageViewer->GetZSlice(); +} +//---------------------------------------------------------------------------- +void wxImageViewerWidget::Render(){ + _imageViewer->Render(); +} + +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- + + +wxImageViewerWidgetRoi::wxImageViewerWidgetRoi(wxWindow* parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) : + wxImageViewerWidget( parent, id, pos, size, style, name ) +{ + _bboxEnabled = false; + _sliceEnabled = false; + _RoiSelected = false; +} +//---------------------------------------------------------------------------- +wxImageViewerWidgetRoi::~wxImageViewerWidgetRoi() +{ + _pts ->Delete(); + _bboxActor ->Delete(); + _bboxMapper ->Delete(); + _pd ->Delete(); +} +//---------------------------------------------------------------------------- +void wxImageViewerWidgetRoi::GetROI( int extent[6] ) +{ + //retrieve a point + double P[3]; + double Q[3]; + _pts->GetPoint(0, P); + _pts->GetPoint(2, Q); + if (P[0]GetInput()->GetExtent( border ); + + if (extent[0] < border[0]) extent[0]=border[0]; + if (extent[1] > border[1]) extent[1]=border[1]; + if (extent[2] < border[2]) extent[2]=border[2]; + if (extent[3] > border[3]) extent[3]=border[3]; + extent[4] = border[4]; + extent[5] = border[5]; + + //grrrrr do not forget about image with spacing <> 1 !! + double spacing[3]; + _imageViewer->GetInput()->GetSpacing( spacing ); + extent[0] = (int)( extent[0]/spacing[0] ); + extent[1] = (int)( extent[1]/spacing[0] ); + extent[2] = (int)( extent[2]/spacing[1] ); + extent[3] = (int)( extent[3]/spacing[1] ); +// extent[4] /= spacing[2]; +// extent[5] /= spacing[2]; + + //Now we should take care of the difficult cases: + //1. The user forgot to select a region, or want the whole region + //2. The user only click one point (-> extent ~ x,x,y,y !!) + + if(extent[1]<=extent[0] || extent[3]<=extent[2]){ + extent[0] = border[0]; + extent[1] = border[1]; + extent[2] = border[2]; + extent[3] = border[3]; + } +} +//---------------------------------------------------------------------------- +void wxImageViewerWidgetRoi::TransfromeCoordViewWorld(int &X, int &Y, int &Z) +{ + _imageViewer->GetRenderer()->SetDisplayPoint(X, Y, Z); + _imageViewer->GetRenderer()->DisplayToWorld(); + double fP[4]; + _imageViewer->GetRenderer()->GetWorldPoint( fP ); + if ( fP[3] ){ + fP[0] /= fP[3]; + fP[1] /= fP[3]; + fP[2] /= fP[3]; + } + X=(int)(fP[0]); + Y=(int)(fP[1]); + Z=(int)(fP[2]); +} +//---------------------------------------------------------------------------- +void wxImageViewerWidgetRoi::ExecuteEvent(vtkObject *wdg, unsigned long event, void* calldata) +{ + int X, Y, Z=0; + int XX,YY,ZZ; + int slice = _imageViewer->GetZSlice(); + int min,max; + min = _imageViewer->GetWholeZMin(); + max = _imageViewer->GetWholeZMax(); + +// EED Borrame if ( event == vtkCommand::MiddleButtonPressEvent ) { + if ( event == vtkCommand::LeftButtonPressEvent ) { +// Dans l'absolu il faudrait 2 modes, un par defaut celui de imageViewer2 qui semble pas mal +// et un deuxieme pour la manipulation exclusive du polydata 2D... + +// if( wxVTKiren->GetShiftKey () ) + { + //def StartZoom(obj, event): + _wxVTKiren->GetEventPosition( X, Y ); + XX=X; YY=Y; ZZ=Z; + TransfromeCoordViewWorld(XX,YY,ZZ); + _pts->SetPoint(0, XX, YY, ZZ); + _pts->SetPoint(1, XX, YY, ZZ); + _pts->SetPoint(2, XX, YY, ZZ); + _pts->SetPoint(3, XX, YY, ZZ); + + _bboxEnabled = true; + _bboxActor->VisibilityOn(); + + _imageViewer->Render(); + } + } else if ( event == vtkCommand::MouseMoveEvent ){ + if ( _bboxEnabled ){ + _RoiSelected=true; + double p0[3]; + _pts->GetPoint(0, p0); + _wxVTKiren->GetEventPosition(X, Y); + XX=X; YY=Y; ZZ=Z; + TransfromeCoordViewWorld(XX,YY,ZZ); + _pts->SetPoint(1, XX , p0[1] , p0[2]); + _pts->SetPoint(2, XX , YY , p0[2]); + _pts->SetPoint(3, p0[0] , YY , p0[2]); + _imageViewer->Render(); + } + } + if ( event == vtkCommand::LeftButtonReleaseEvent ){ + _bboxEnabled = false; + //EED} else if ( event == vtkCommand::MouseWheelForwardEvent ){ + } else if ( event == wxEVT_MOUSEWHEEL+10000 ){ + +// mouse wheel: +// * if no ctrl or shift is press then 5 slices are done +// * if ctrl is press -> 10 slices are done +// * if shirt id press -> 1 slice is done + + if( _wxVTKiren->GetControlKey () ){ + slice += 10; + } else if( _wxVTKiren->GetShiftKey () ) { + slice++; + } else { + //neither ctrl nor shift has been pressed: + slice += 5; + } + + slice = slice > min ? slice : min; + slice = slice < max ? slice : max; + +#if (VTK_MAJOR_VERSION >= 5) + _imageViewer->SetSlice( slice ); +#else + _imageViewer->SetZSlice( slice ); +#endif + + + //This is not nedeed any more since vtkImageViewer2.cxx -r1.9 + //imageViewer->GetRenderer()->ResetCameraClippingRange(); + + wxMouseEvent mouseEvent; + mouseEvent.m_wheelRotation=130; + if (_intVtkPanWid!=NULL) { + _intVtkPanWid->CallBackOnMouseWheel(mouseEvent); + } + _imageViewer->Render(); + + //EED } else if ( event == vtkCommand::MouseWheelBackwardEvent ){ + } else if ( event == wxEVT_MOUSEWHEEL+10001 ){ + +// _sliceEnabled = false; + if( _wxVTKiren->GetControlKey () ){ + slice -= 10; + } else if( _wxVTKiren->GetShiftKey () ) { + slice--; + } else { + //neither ctrl nor shift has been pressed: + slice -= 5; + slice = (slice /5) * 5; + } + + slice = slice > min ? slice : min; + slice = slice < max ? slice : max; + + +#if (VTK_MAJOR_VERSION >= 5) + _imageViewer->SetSlice( slice ); +#else + _imageViewer->SetZSlice( slice ); +#endif + + + //This is not nedeed any more since vtkImageViewer2.cxx -r1.9 + //imageViewer->GetRenderer()->ResetCameraClippingRange(); + + wxMouseEvent mouseEvent; + mouseEvent.m_wheelRotation=-130; + if (_intVtkPanWid!=NULL) { + _intVtkPanWid->CallBackOnMouseWheel(mouseEvent); + } + _imageViewer->Render(); + + } + +} +//---------------------------------------------------------------------------- +void wxImageViewerWidgetRoi::ConstructVTK(vtkImageData *imageData){ + + wxImageViewerWidget::ConstructVTK(imageData); + _interactorStyle2DMaracas->SetObserver(_Observer); + + //Supporting data for callbacks + _pts = vtkPoints::New(); + _pts->SetNumberOfPoints(4); + _pts->SetPoint(0, -1000 , -1000 , -1000 ); + _pts->SetPoint(1, 1000 , -1000 , 0 ); + _pts->SetPoint(2, 1000 , 1000 , 1000 ); + _pts->SetPoint(3, -1000 , 1000 , 0 ); + + + vtkCellArray *lines = vtkCellArray::New(); + lines->InsertNextCell(5); + lines->InsertCellPoint(0); + lines->InsertCellPoint(1); + lines->InsertCellPoint(2); + lines->InsertCellPoint(3); + lines->InsertCellPoint(0); + + _pd = vtkPolyData::New(); + _pd->SetPoints( _pts ); + _pd->SetLines( lines ); + lines->Delete(); //do not delete lines ?? + + + _bboxActor = vtkActor::New(); + _bboxMapper = vtkPolyDataMapper::New(); + + _bboxMapper->SetInput(_pd); + _bboxMapper->ImmediateModeRenderingOn(); + _bboxActor->SetMapper(_bboxMapper); + _bboxActor->GetProperty()->BackfaceCullingOn(); + _bboxActor->GetProperty()->SetDiffuseColor(1,0,0); + _bboxActor->GetProperty()->SetLineWidth(2); + + _imageViewer->GetRenderer()->AddActor( _bboxActor ); +// _imageViewer->Render( ); + +} + +//---------------------------------------------------------------------------- +bool wxImageViewerWidgetRoi::GetRoiSelected(){ + return _RoiSelected; +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxImageViewerWidget.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxImageViewerWidget.h new file mode 100644 index 0000000..c01f915 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxImageViewerWidget.h @@ -0,0 +1,138 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: wxImageViewerWidget.h,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:42 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + +#ifndef __WX__IMAGE__VIEWER__WIDGET__ +#define __WX__IMAGE__VIEWER__WIDGET__ + +//As it is extremely easy to use vtkImageViewer/ vtkImageViewer2, I gave up with +//vtkImagePlaneWidget +#include + +#include "InterfaceVtkPanelWidgets.h" +// #include "vtk3DSurfaceWidget.h" //EED pour avoir access a la classe "InterfaceVtkPanelWidgets" + +#include "../manualContour.h" +#include "wxVTKRenderWindowInteractorEditContour.h" + +#include "wxVTKRenderWindowInteractor.h" +#include "vtkImageViewer2.h" +#include "vtkImageData.h" +#include "vtkActor.h" +#include "vtkPoints.h" + +class marZoomROIObserver; + + +class wxVtk2DView_TMP : public wxVtkBaseView{ +public: + wxVtk2DView_TMP(vtkImageViewer2 *imageviewer2); + ~wxVtk2DView_TMP(); + virtual vtkRenderer *GetRenderer(); + virtual vtkRenderWindow *GetRenWin(); + virtual void Configure(); + void SetWxVTKRenderWindowInteractor( wxVTKRenderWindowInteractor *wxVTKiren); + virtual wxVTKRenderWindowInteractor *GetWxVTKRenderWindowInteractor(); + +private: + wxVTKRenderWindowInteractor *_wxVTKiren; + vtkImageViewer2 *_imageviewer2; +}; + + +/** + * \brief Panel class composed of a vtk renderwindow with double click available + * and add some buttons + */ +class wxImageViewerWidget : public wxPanel{ +public: + + wxImageViewerWidget( + wxWindow *parent, + wxWindowID id = -1, + const wxPoint &pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSUNKEN_BORDER, //wxTAB_TRAVERSAL, + const wxString& name = wxPanelNameStr + ); + ~wxImageViewerWidget( ); + + virtual void ConstructVTK(vtkImageData *imageData); + virtual void ExecuteEvent(vtkObject *wdg, unsigned long event, void* calldata); + void ExecuteEvent1(vtkObject *wdg, unsigned long event, void* calldata); + void ExecuteEvent2(vtkObject *wdg, unsigned long event, void* calldata); + void SetImage(vtkImageData* imagedata); + void SetInterfaceVtkPanelWidgets(InterfaceVtkPanelWidgets * intVtkPanWid) { _intVtkPanWid = intVtkPanWid; }; + + void SetState(int state); + void SetStateManualContour(int state); + void CreateNewManualContour(); + int GetNumberOfPointsSplineManualContour(); + double* GetVectorPointsXManualContour(); + double* GetVectorPointsYManualContour(); + void EraseManualContour(); + void SetZSlice(int z); + int GetZSlice(); + void Render(); + + + void AddObserver_1(); + void AddObserver_2(); + +protected: + int _state; + marZoomROIObserver *_Observer; + vtkInteractorStyle2DMaracas *_interactorStyle2DMaracas; + vtkImageViewer2 *_imageViewer; + InterfaceVtkPanelWidgets *_intVtkPanWid; + wxVTKRenderWindowInteractorEditContour *_wxVTKiren; + +private: + manualContourControler *_manContControl; + manualContourModel *_mContourModel; + manualViewContour *_mViewContour; + +}; + +//---------------------------------------------------------------------------- + +class wxImageViewerWidgetRoi : public wxImageViewerWidget{ +public : + wxImageViewerWidgetRoi( + wxWindow* parent, + wxWindowID id = -1, + const wxPoint &pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSUNKEN_BORDER, //wxTAB_TRAVERSAL, + const wxString& name = wxPanelNameStr + ); + ~wxImageViewerWidgetRoi( ); + void GetROI( int extent[6] ); + virtual void ConstructVTK(vtkImageData *imageData); + void TransfromeCoordViewWorld(int &X, int &Y, int &Z); + bool GetRoiSelected(); + +private : + virtual void ExecuteEvent(vtkObject *wdg, unsigned long event, void* calldata); + bool _bboxEnabled; + bool _sliceEnabled; + bool _RoiSelected; + vtkPoints *_pts; + vtkActor *_bboxActor; + vtkPolyDataMapper *_bboxMapper; + vtkPolyData *_pd; +}; +#endif // __WX__IMAGE__VIEWER__WIDGET__ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx new file mode 100644 index 0000000..67dfe61 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx @@ -0,0 +1,1112 @@ + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wxMPRBaseData.h" +#include "pPlotter/HistogramDialog.h" + + + +//------------------------------------------------------------------- +//------------------------------------------------------------------- +//------------------------------------------------------------------- + +vtkBaseData::vtkBaseData() +{ + + _z = 0; + _t = 0; + _marImageData = NULL; +} + +//------------------------------------------------------------------- +vtkBaseData::~vtkBaseData() +{ +} + +//------------------------------------------------------------------- +void vtkBaseData::SetMarImageData(marImageData *marimagedata) +{ + _marImageData = marimagedata; + Configure(); +} + +//------------------------------------------------------------------- +vtkImageData* vtkBaseData::GetImageData() +{ + return _marImageData->GetImageDataT(_t); +} +//------------------------------------------------------------------- +marImageData* vtkBaseData::GetMarImageData() +{ + return _marImageData; +} + +//------------------------------------------------------------------- + +void vtkBaseData::Configure() // virtual +{ +} + +//------------------------------------------------------------------- +void vtkBaseData::SetZ(double z){ + int maxZ; + +// int dim[3]; +// _marImageData->GetDimensions(dim); +// maxZ=dim[2]; + + int ext[6]; + _marImageData->GetImageData()->GetWholeExtent(ext); + maxZ=ext[5]-ext[4]+1; + + if (z>=maxZ) + { + z=maxZ-1; + } + if (z<=0) + { + z=0; + } + + _z=z; +} +//------------------------------------------------------------------- +double vtkBaseData::GetZ() +{ + return _z; +} +//------------------------------------------------------------------- +int vtkBaseData::GetT() +{ + return _t; +} +//------------------------------------------------------------------- +void vtkBaseData::SetT(double t) +{ + int maxT = _marImageData->GetMaxT(); + if (t>=maxT) + { + t=maxT-1; + } + if (t<=0) + { + t=0; + } + _t=t; +} + +//------------------------------------------------------------------- +//------------------------------------------------------------------- +//------------------------------------------------------------------- +vtkMPRBaseData::vtkMPRBaseData() +{ + _x=0; + _y=0; + _z=0; + _transformOrientation = NULL; +} +//------------------------------------------------------------------- +vtkMPRBaseData::~vtkMPRBaseData() +{ + if (_marImageData) delete _marImageData; + if (_transformOrientation) _transformOrientation ->Delete(); +} +//------------------------------------------------------------------- +void vtkMPRBaseData::Configure() +{ + _marImageData->GetImageData()->GetExtent (_x1,_x2,_y1,_y2,_z1,_z2); + _transformOrientation=vtkTransform::New(); + _transformOrientation->Identity(); +} +//------------------------------------------------------------------- +void vtkMPRBaseData::GetDimensionExtention(int *x1,int *x2,int *y1,int *y2,int *z1,int *z2) +{ + *x1=_x1; + *x2=_x2; + *y1=_y1; + *y2=_y2; + *z1=_z1; + *z2=_z2; +} + + +//------------------------------------------------------------------------ +int vtkMPRBaseData::GetMaxPositionX( ) +{ + return _x2; +} +//------------------------------------------------------------------------ +int vtkMPRBaseData::GetMaxPositionY( ) +{ + return _y2; +} +//------------------------------------------------------------------------ +int vtkMPRBaseData::GetMaxPositionZ( ) +{ + return _z2; +} +//------------------------------------------------------------------- +double vtkMPRBaseData::GetX() +{ + return _x; +} +//------------------------------------------------------------------- +double vtkMPRBaseData::GetY() +{ + return _y; +} +//------------------------------------------------------------------- +void vtkMPRBaseData::SetX(double x) +{ + int dim[3]; + _marImageData->GetImageData()->GetDimensions(dim); + if (x<0) + { + x=0; + } + if (x>=dim[0]) + { + x=dim[0]-1; + }; + _x=x; +} +//------------------------------------------------------------------- +void vtkMPRBaseData::SetY(double y) +{ + int dim[3]; + _marImageData->GetImageData()->GetDimensions(dim); + if (y<0) + { + y=0; + } + if (y>=dim[1]) + { + y=dim[1]-1; + }; + _y=y; +} +//------------------------------------------------------------------- +vtkTransform *vtkMPRBaseData::GetTransformOrientation() +{ + return _transformOrientation; +} +//------------------------------------------------------------------- +void vtkMPRBaseData::SetNormal(double nx, double ny, double nz) +{ + double alfa = atan2(ny,nx) * 180.0 / 3.1416; + double beta = atan2( nz, sqrt( nx*nx + ny*ny ) ) * 180.0 / 3.1416; + _transformOrientation->Identity(); + _transformOrientation->RotateWXYZ(alfa,0,0,1); + _transformOrientation->RotateWXYZ(-beta,0,1,0); +} +//------------------------------------------------------------------- +void vtkMPRBaseData::InitTransformOrientation(vtkTransform *trans) +{ + _transformOrientation->SetMatrix( trans->GetMatrix() ); +} + + + +//------------------------------------------------------------------- +//------------------------------------------------------------------- +//------------------------------------------------------------------- + + +vtkMPR3DDataViewer::vtkMPR3DDataViewer() +{ + _visiblePosition[0]=false; + _visiblePosition[1]=false; + _visiblePosition[2]=false; + _ctfun = NULL; +} +//------------------------------------------------------------------- +vtkMPR3DDataViewer::~vtkMPR3DDataViewer() +{ + _outlineData -> Delete(); + _mapOutline -> Delete(); + _outline -> Delete(); + +// if (_bwLut) _bwLut -> Delete(); +// if (_hueLut) _hueLut -> Delete(); +// if (_satLut) _satLut -> Delete(); + if (_ctfun) _ctfun -> Delete(); + if (_saggitalColors) _saggitalColors -> Delete(); + if (_saggital) _saggital -> Delete(); + if (_axialColors) _axialColors -> Delete(); + if (_axial) _axial -> Delete(); + if (_coronalColors) _coronalColors -> Delete(); + if (_coronal) _coronal -> Delete(); + +} +//------------------------------------------------------------------- +vtkActor* vtkMPR3DDataViewer::GetOutlineActor() +{ + return _outline; +} +//------------------------------------------------------------------- +vtkImageActor* vtkMPR3DDataViewer::GetImageActor(int id) +{ + vtkImageActor *tmpVtkActor=NULL; + if (id==0){ + tmpVtkActor = GetvtkActor_saggital(); + } + if (id==1){ + tmpVtkActor = GetvtkActor_coronal(); + } + if (id==2){ + tmpVtkActor = GetvtkActor_axial(); + } + return tmpVtkActor; +} +//------------------------------------------------------------------- +void vtkMPR3DDataViewer::Refresh() +{ + int x = (int)(_vtkmprbasedata->GetX()); + int y = (int)(_vtkmprbasedata->GetY()); + int z = (int)(_vtkmprbasedata->GetZ()); + + SetPositionX( x ); + SetPositionY( y ); + SetPositionZ( z ); +} +//------------------------------------------------------------------- +void vtkMPR3DDataViewer::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata) +{ + _vtkmprbasedata=vtkmprbasedata; +} +//------------------------------------------------------------------- +vtkMPRBaseData* vtkMPR3DDataViewer::GetVtkMPRBaseData() +{ + return _vtkmprbasedata; +} +//------------------------------------------------------------------- + +vtkColorTransferFunction *vtkMPR3DDataViewer::GetvtkColorTransferFunction() +{ + return _ctfun; +} +//------------------------------------------------------------------- + +std::vector* vtkMPR3DDataViewer::GetctFunVectorPoint() +{ + return &_ctFunVectorPoint; +} +//------------------------------------------------------------------- +std::vector* vtkMPR3DDataViewer::GetctFunVectorRed() +{ + return &_ctFunVectorRed; +} + +//------------------------------------------------------------------- +std::vector* vtkMPR3DDataViewer::GetctFunVectorGreen() +{ + return &_ctFunVectorGreen; +} + +//------------------------------------------------------------------- +std::vector* vtkMPR3DDataViewer::GetctFunVectorBlue() +{ + return &_ctFunVectorBlue; +} + +//------------------------------------------------------------------- +void vtkMPR3DDataViewer::Configure() +{ +/* + // Start by creatin a black/white lookup table. + _bwLut = vtkLookupTable::New(); + _bwLut->SetTableRange (0, 2000); + _bwLut->SetSaturationRange (0, 0); + _bwLut->SetHueRange (0, 0); + _bwLut->SetValueRange (0, 1); + + // Now create a lookup table that consists of the full hue circle + // (from HSV). + _hueLut = vtkLookupTable::New(); + _hueLut->SetTableRange (0, 2000); + _hueLut->SetHueRange (0, 1); + _hueLut->SetSaturationRange (1, 1); + _hueLut->SetValueRange (1, 1); + + // Finally, create a lookup table with a single hue but having a range + // in the saturation of the hue. + _satLut = vtkLookupTable::New(); + _satLut->SetTableRange (0, 2000); + _satLut->SetHueRange (.6, .6); + _satLut->SetSaturationRange (0, 1); + _satLut->SetValueRange (1, 1); +*/ + + + double range[2]; + _vtkmprbasedata->GetImageData()->GetScalarRange(range); + double max = range[1]; + + + _ctFunVectorPoint.push_back(max*0/4); + _ctFunVectorPoint.push_back(max*1/4); + _ctFunVectorPoint.push_back(max*2/4); + _ctFunVectorPoint.push_back(max*3/4); + _ctFunVectorPoint.push_back(max*4/4); + + _ctFunVectorRed.push_back(0.0); + _ctFunVectorRed.push_back(1.0); + _ctFunVectorRed.push_back(0.0); + _ctFunVectorRed.push_back(0.0); + _ctFunVectorRed.push_back(0.0); + + _ctFunVectorGreen.push_back(0.0); + _ctFunVectorGreen.push_back(0.0); + _ctFunVectorGreen.push_back(0.0); + _ctFunVectorGreen.push_back(1.0); + _ctFunVectorGreen.push_back(0.2); + + _ctFunVectorBlue.push_back(0.0); + _ctFunVectorBlue.push_back(0.0); + _ctFunVectorBlue.push_back(1.0); + _ctFunVectorBlue.push_back(0.0); + _ctFunVectorBlue.push_back(0.0); + + + _ctfun = vtkColorTransferFunction::New(); + + int i,size=_ctFunVectorPoint.size(); + for (i=0;iAddRGBPoint( _ctFunVectorPoint[i] , _ctFunVectorRed[i],_ctFunVectorGreen[i],_ctFunVectorBlue[i]); + + } +/* + _ctfun->AddRGBPoint( 100 ,0 ,0,0); + _ctfun->AddRGBPoint( 200 ,1 ,0,0); + _ctfun->AddRGBPoint( 300 ,0 ,1,0); + _ctfun->AddRGBPoint( 400 ,0 ,0,1); +*/ + void *p=this; + + // Create the first of the three planes. The filter vtkImageMapToColors + // maps the data through the corresponding lookup table created above. The + // vtkImageActor is a type of vtkProp and conveniently displays an image on + // a single quadrilateral plane. It does this using texture mapping and as + // a result is quite fast. (Note: the input image has to be unsigned char + // values, which the vtkImageMapToColors produces.) Note also that by + // specifying the DisplayExtent, the pipeline requests data of this extent + // and the vtkImageMapToColors only processes a slice of data. + _saggitalColors = vtkImageMapToColors::New(); + _saggitalColors->SetInput( _vtkmprbasedata->GetImageData() ); +// _saggitalColors->SetLookupTable(_bwLut); + _saggitalColors->SetLookupTable(_ctfun); + _saggital = vtkImageActor::New(); + _saggital->SetInput(_saggitalColors->GetOutput()); + + + // Create the second (axial) plane of the three planes. We use the + // same approach as before except that the extent differs. + _axialColors = vtkImageMapToColors::New(); + _axialColors->SetInput( _vtkmprbasedata->GetImageData() ); +// _axialColors->SetLookupTable(_hueLut); + _axialColors->SetLookupTable(_ctfun); + _axial = vtkImageActor::New(); + _axial->SetInput(_axialColors->GetOutput()); + + // Create the third (coronal) plane of the three planes. We use + // the same approach as before except that the extent differs. + _coronalColors = vtkImageMapToColors::New(); + _coronalColors->SetInput( _vtkmprbasedata->GetImageData() ); +// _coronalColors->SetLookupTable(_satLut); + _coronalColors->SetLookupTable(_ctfun); + _coronal = vtkImageActor::New(); + _coronal->SetInput(_coronalColors->GetOutput()); + + // An outline provides context around the data. + // + _outlineData = vtkOutlineFilter::New(); + _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() ); + _mapOutline = vtkPolyDataMapper::New(); + _mapOutline->SetInput(_outlineData->GetOutput()); + _outline = vtkActor::New(); + _outline->SetMapper(_mapOutline); + _outline->GetProperty()->SetColor(0,0,0); + + int ext[6]; + _vtkmprbasedata->GetImageData()->GetExtent(ext); + + + +} + +//------------------------------------------------------------------- +vtkImageActor * vtkMPR3DDataViewer::GetvtkActor_saggital() +{ + return _saggital; +} +//------------------------------------------------------------------- +vtkImageActor * vtkMPR3DDataViewer::GetvtkActor_coronal() +{ + return _coronal; +} +//------------------------------------------------------------------- +vtkImageActor * vtkMPR3DDataViewer::GetvtkActor_axial() +{ + return _axial; +} + +//------------------------------------------------------------------------ +void vtkMPR3DDataViewer::SetPositionX(int pos){ + int x1,x2,y1,y2,z1,z2; + _vtkmprbasedata->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2); + _saggital->SetDisplayExtent( pos , pos , y1 ,y2 , z1 , z2 ); +} +//------------------------------------------------------------------------ +void vtkMPR3DDataViewer::SetPositionY(int pos){ + int x1,x2,y1,y2,z1,z2; + _vtkmprbasedata->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2); + _coronal->SetDisplayExtent(x1,x2, pos,pos, z1,z2); +} +//------------------------------------------------------------------------ +void vtkMPR3DDataViewer::SetPositionZ(int pos){ + int x1,x2,y1,y2,z1,z2; + _vtkmprbasedata->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2); + _axial->SetDisplayExtent(x1,x2, y1,y2, pos,pos); +} +//------------------------------------------------------------------- +void vtkMPR3DDataViewer::SetVisiblePosition(int idPosition, bool visible) +{ + _visiblePosition[idPosition]=visible; +} +//------------------------------------------------------------------- +bool vtkMPR3DDataViewer::GetVisiblePosition(int idPosition) +{ + return _visiblePosition[idPosition]; +} +//------------------------------------------------------------------- +//------------------------------------------------------------------- +//------------------------------------------------------------------- + + +vtkClipping3DDataViewer::vtkClipping3DDataViewer() +{ + int i; + for (i=0; iDelete(); + _tissueStripper[i] ->Delete(); + _tissueMapper[i] ->Delete(); + _tissuePlanes[i] ->Delete(); + _tissueClipper[i] ->Delete(); + } + _outlineData ->Delete(); + _mapOutline ->Delete(); + _outline ->Delete(); + // Volume + _tfun ->Delete(); + _ctfun ->Delete(); + _compositeFunction ->Delete(); + _volumeMapper ->Delete(); + _volumeProperty ->Delete(); + _newvol ->Delete(); + _volumePlanes ->Delete(); + + for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){ + _tissue[i] -> Delete(); + _observerS[i] -> Delete(); + } + _observerV -> Delete(); +} +//------------------------------------------------------------------- +vtkActor* vtkClipping3DDataViewer::GetOutlineActor() +{ + return _outline; +} +//------------------------------------------------------------------- +vtkClipPolyData* vtkClipping3DDataViewer::GetTissueClipper(int id) +{ + return this->_tissueClipper[id]; +} +//------------------------------------------------------------------- +vtkPolyDataMapper* vtkClipping3DDataViewer::GetTissueMapper(int id) +{ + return _tissueMapper[id]; +} +//------------------------------------------------------------------- +vtkPlanes* vtkClipping3DDataViewer::GetTissuePlanes(int id) +{ + return _tissuePlanes[id]; +} +//------------------------------------------------------------------- +vtkStripper* vtkClipping3DDataViewer::GetTissueStripper(int id) +{ + return _tissueStripper[id]; +} +//------------------------------------------------------------------- +void vtkClipping3DDataViewer::Refresh() +{ +// _volumeMapper->SetClippingPlanes(_volumePlanes); + +// this->_volumeMapper->Update(); +// this->_newvol->Update(); + +// _newvol->VisibilityOn(); + + +// _volumeMapper = vtkVolumeRayCastMapper::New(); +// _volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() ); +// _volumeMapper->SetVolumeRayCastFunction(_compositeFunction); +// _volumeMapper->SetClippingPlanes( _volumePlanes ); +// _newvol->SetMapper(_volumeMapper ); + + +} +//------------------------------------------------------------------- +void vtkClipping3DDataViewer::RefreshSurface() +{ + int i; + for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++) + { + SetIsovalue(i, (int) (GetIsovalue(i)+1) ); +// this->GetMCubes(i)->Update(); + } +} +//------------------------------------------------------------------- +void vtkClipping3DDataViewer::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata) +{ + _vtkmprbasedata=vtkmprbasedata; +} +//------------------------------------------------------------------- +vtkMPRBaseData* vtkClipping3DDataViewer::GetVtkMPRBaseData() +{ + return _vtkmprbasedata; +} + + +//------------------------------------------------------------------- +void vtkClipping3DDataViewer::SetVisibleTissue(int idTissue, bool visible) +{ + _visibleTissue[idTissue]=visible; +} +//------------------------------------------------------------------- +bool vtkClipping3DDataViewer::GetVisibleTissue(int idTissue){ + return _visibleTissue[idTissue]; +} +//------------------------------------------------------------------- +void vtkClipping3DDataViewer::SetRepresentationType(int idTissue, bool representationType) +{ + _representationType[idTissue]=representationType; +} +//------------------------------------------------------------------- +bool vtkClipping3DDataViewer::GetRepresentationType(int idTissue) +{ + return _representationType[idTissue]; +} + +//------------------------------------------------------------------- +vtkActor* vtkClipping3DDataViewer::GetTissueActor(int id){ + return _tissue[id]; +} + +//------------------------------------------------------------------- +boxSurfaceObserver *vtkClipping3DDataViewer::GetObserverS(int idObserverS) +{ + return _observerS[idObserverS]; +} +//------------------------------------------------------------------- +boxSurfaceObserver *vtkClipping3DDataViewer::GetObserverV() +{ + return _observerV; +} + +//------------------------------------------------------------------- +bool vtkClipping3DDataViewer::GetVisibleVolume() +{ + return _visibleVolume; +} +//------------------------------------------------------------------- +void vtkClipping3DDataViewer::SetVisibleVolume(bool visiblevolume) +{ + _visibleVolume = visiblevolume; +} + + +//------------------------------------------------------------------- +void vtkClipping3DDataViewer::Configure_Tissue() +{ + + double range[2]; + int i; + for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){ + // Visualisation - original volume + vtkImageData *imagedata=_vtkmprbasedata->GetImageData(); + imagedata->GetScalarRange( range ); + _mCubes[i] = vtkMarchingCubes::New( ); + _mCubes[i]->SetInput( imagedata ); + + _mCubes[i]->SetValue( 0, range[1]*(4+i) / 8 ); +// _mCubes[i]->SetValue( 0, 1500 ); + + _tissueStripper[i] = vtkStripper::New(); + _tissueStripper[i]->SetInput( _mCubes[i]->GetOutput( ) ); + + + + _tissuePlanes[i] = vtkPlanes::New(); + + int x1,x2,y1,y2,z1,z2; + imagedata->GetExtent(x1,x2,y1,y2,z1,z2); + _tissuePlanes[i]->SetBounds (x1,x2,y1,y2,z1,z2); + + _tissueClipper[i] = vtkClipPolyData::New(); + _tissueClipper[i]->SetInput( _tissueStripper[i]->GetOutput() ); + _tissueClipper[i]->SetClipFunction( _tissuePlanes[i] ); + _tissueClipper[i]->InsideOutOn( ); + + _tissueMapper[i] = vtkPolyDataMapper::New( ); + _tissueMapper[i]->SetInput( _tissueClipper[i]->GetOutput() ); + _tissueMapper[i]->ScalarVisibilityOff( ); +// _tissueMapper[i]->Update(); + + } + + + + // vtkActor tissue + for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){ + // tissue + _tissue[i] = vtkActor::New(); + _tissue[i]->SetMapper( GetTissueMapper(i) ); + float cr=1,cg=0.5,cb=0.5; + _tissue[i]->GetProperty()->SetDiffuseColor(cr/255, cg/255 , cb/255 ); + _tissue[i]->GetProperty()->SetSpecular(.3); + _tissue[i]->GetProperty()->SetSpecularPower(20); + _tissue[i]->GetProperty()->SetOpacity(0.5); + if (i==0) _tissue[i]->GetProperty()->SetColor(0.85, 0.85 , 0.85 ); + if (i==1) _tissue[i]->GetProperty()->SetColor(0, 0 , 1 ); + if (i==2) _tissue[i]->GetProperty()->SetColor(0.85, 0.20 , 0.20 ); + if (i==3) _tissue[i]->GetProperty()->SetColor(0, 1 , 0 ); + } + + for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++) + { + _observerS[i] = boxSurfaceObserver::New(); + _observerS[i]->SetPlanes( GetTissuePlanes(i) ); + _observerS[i]->SetActor( _tissue[i] ); + } + +} + +//----------------------------------------------------------------------------- + +void vtkClipping3DDataViewer::Configure_Volume() +{ + // Volume + + _tfun = vtkPiecewiseFunction::New(); + _ctfun = vtkColorTransferFunction::New(); + + double range[2]; + this->_vtkmprbasedata->GetImageData()->GetScalarRange(range); + double max = range[1]; + + /* + adding the poinst of the transference function + */ + //X + greyValuesTransferenceFVector.push_back(max * 0/2); + greyValuesTransferenceFVector.push_back(max * 1/2); + greyValuesTransferenceFVector.push_back(max * 2/2); + //Y + intensityValuesTransferenceFVector.push_back(0.0); + intensityValuesTransferenceFVector.push_back(1.0); + intensityValuesTransferenceFVector.push_back(1.0); + + _tfun->AddPoint(max * 0/2 , 0.0); + _tfun->AddPoint(max * 1/2 , 1.0); + _tfun->AddPoint(max * 2/2 , 1.0); + + /* + Adding the colors to the vectors + */ + //RED + redColorsOfColorTransferenceFVector.push_back(0.0); + redColorsOfColorTransferenceFVector.push_back(1.0); + redColorsOfColorTransferenceFVector.push_back(0.0); + redColorsOfColorTransferenceFVector.push_back(0.0); + redColorsOfColorTransferenceFVector.push_back(0.0); + + //GREEN + greenColorsOfColorTransferenceFVector.push_back(0.0); + greenColorsOfColorTransferenceFVector.push_back(0.0); + greenColorsOfColorTransferenceFVector.push_back(0.0); + greenColorsOfColorTransferenceFVector.push_back(1.0); + greenColorsOfColorTransferenceFVector.push_back(0.2); + + //BLUE + blueColorsOfColorTransferenceFVector.push_back(0.0); + blueColorsOfColorTransferenceFVector.push_back(0.0); + blueColorsOfColorTransferenceFVector.push_back(1.0); + blueColorsOfColorTransferenceFVector.push_back(0.0); + blueColorsOfColorTransferenceFVector.push_back(0.0); + //GREY VALUE + greyValueColorsOfColorTransferenceFVector.push_back(max*0/4); + greyValueColorsOfColorTransferenceFVector.push_back(max*1/4); + greyValueColorsOfColorTransferenceFVector.push_back(max*2/4); + greyValueColorsOfColorTransferenceFVector.push_back(max*3/4); + greyValueColorsOfColorTransferenceFVector.push_back(max*4/4); + + _ctfun->AddRGBPoint( max*0/4 , 0.0, 0.0, 0.0); + _ctfun->AddRGBPoint( max*1/4 , 1.0, 0.0, 0.0); + _ctfun->AddRGBPoint( max*2/4 , 0.0, 0.0, 1.0); + _ctfun->AddRGBPoint( max*3/4 , 0.0, 1.0, 0.0); + _ctfun->AddRGBPoint( max*4/4 , 0.0, 0.2, 0.0); + + _volumePlanes = vtkPlanes::New(); +// int x1,x2,y1,y2,z1,z2; +// vtkImageData *imagedata=_vtkmprbasedata->GetImageData(); +// imagedata->GetExtent(x1,x2,y1,y2,z1,z2); +// _volumePlanes->SetBounds(x1,x2,y1,y2,z1,z2); + + _compositeFunction = vtkVolumeRayCastCompositeFunction::New(); + + _volumeMapper = vtkVolumeRayCastMapper::New(); + _volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() ); + _volumeMapper->SetVolumeRayCastFunction(_compositeFunction); + _volumeMapper->SetClippingPlanes( _volumePlanes ); + _volumeMapper->AutoAdjustSampleDistancesOn(); + + _volumeProperty = vtkVolumeProperty::New(); + _volumeProperty->SetColor(_ctfun); + _volumeProperty->SetScalarOpacity( _tfun ); +// EED 31/03/2008 + _volumeProperty->SetInterpolationTypeToLinear(); + _volumeProperty->ShadeOn(); + _volumeProperty->DisableGradientOpacityOn(); + +// _volumeProperty->SetInterpolationTypeToNearest(); +// _volumeProperty->ShadeOff(); +// _volumeProperty->SetAmbient(0.3); +// _volumeProperty->SetDiffuse(0.1); +// _volumeProperty->SetSpecular(0.8); +// _volumeProperty->DisableGradientOpacityOn(); + + _newvol = vtkVolume::New(); + _newvol->SetMapper(_volumeMapper ); + _newvol->SetProperty(_volumeProperty ); + + _observerV = boxSurfaceObserver::New(); + _observerV->SetPlanes( _volumePlanes ); + _observerV->SetActor( _newvol ); + _observerV->SetvtkVolumeRayCastMapper( _volumeMapper ); +} + + +//------------------------------------------------------------------- +void vtkClipping3DDataViewer::Configure() +{ + Configure_Tissue(); + Configure_Volume(); + + // An outline provides context around the data. + // + _outlineData = vtkOutlineFilter::New(); + _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() ); + _mapOutline = vtkPolyDataMapper::New(); + _mapOutline->SetInput(_outlineData->GetOutput()); + _outline = vtkActor::New(); + _outline->SetMapper(_mapOutline); + _outline->GetProperty()->SetColor(0,0,0); +} + + +//------------------------------------------------------------------- +void vtkClipping3DDataViewer::SetIsovalue(int idTissue, int isoValue) +{ + _mCubes[idTissue]->SetValue(0, isoValue); +} +//------------------------------------------------------------------- +double vtkClipping3DDataViewer::GetIsovalue(int idTissue) +{ + return _mCubes[idTissue]->GetValue(0); +} +//------------------------------------------------------------------- +vtkVolume* vtkClipping3DDataViewer::GetVolumeActor() +{ + return _newvol; +} +//------------------------------------------------------------------- +vtkVolumeRayCastMapper* vtkClipping3DDataViewer::GetVolumeMapper(){ + return _volumeMapper; +} +//------------------------------------------------------------------- +vtkPlanes* vtkClipping3DDataViewer::GetVolumePlanes() +{ + return _volumePlanes; +} + +//------------------------------------------------------------------- +vtkMarchingCubes *vtkClipping3DDataViewer::GetMCubes(int idTissue) +{ + return _mCubes[idTissue]; +} +//-------------------------------------------------------------------- +//------------------- +//Getters Vectors +//------------------- + +std::vector* vtkClipping3DDataViewer::GetGreyValuesTransferenceFVector() +{ + return &greyValuesTransferenceFVector; +} +//-------------------------------------------------------------------- +std::vector* vtkClipping3DDataViewer::GetIntensityValuesTransferenceFVector() +{ + return &intensityValuesTransferenceFVector; +} +//-------------------------------------------------------------------- +std::vector* vtkClipping3DDataViewer::GetRedColorsOfColorTransferenceFVector() +{ + return &redColorsOfColorTransferenceFVector; +} +//-------------------------------------------------------------------- +std::vector* vtkClipping3DDataViewer::GetGreenColorsOfColorTransferenceFVector() +{ + return &greenColorsOfColorTransferenceFVector; +} +//-------------------------------------------------------------------- +std::vector* vtkClipping3DDataViewer::GetBlueColorsOfColorTransferenceFVector() +{ + return &blueColorsOfColorTransferenceFVector; +} +//-------------------------------------------------------------------- +std::vector* vtkClipping3DDataViewer::GetGreyValueColorsOfColorTransferenceFVector() +{ + return &greyValueColorsOfColorTransferenceFVector; +} +//-------------------------------------------------------------------- +//-------------------------------------- +//Getters transference function +//and color of the transference function +//--------------------------------------- +vtkPiecewiseFunction* vtkClipping3DDataViewer::GetTransferencefunction() +{ + return this->_tfun; +} +//-------------------------------------------------------------------- +vtkColorTransferFunction* vtkClipping3DDataViewer::GetColorTransferenceFunction() +{ + return this->_ctfun; +} + +//------------------------------------------------------------------- + +void vtkClipping3DDataViewer::ReadVolumeFunctions() +{ +/* + int i=0,xi,yi,r,g,b,gValue; + vtkImageData *imagedata = this->_vtkmprbasedata->GetImageData(); + + HistogramDialog* hDlg=new HistogramDialog(NULL,_T("Histogram Dialog"),imagedata); + // + // put in a method + // + int tfSize=this->greyValuesTransferenceFVector.size(); + if(tfSize>0) + { + int i=0,y; + hDlg->erasePointsTransferenceFunction(); + while(iaddPointToTransferenceFunction(g,in*100); + i++; + } + + } + + int ctfSize=this->redColorsOfColorTransferenceFVector.size(); + if(ctfSize>0) + { + int i=0,y; + while(iaddColorPoint(gr,r*255,g*255,b*255); + i++; + } + } + //If it is smooth activate next line + //hDlg->updatePlotter(); + //setting variables if the user wants to do refresh + hDlg->setCTF(_ctfun); + hDlg->setTF(_tfun); + + // + // when the user had changed the transference Function + // + if(hDlg->ShowModal()== wxID_OK ) + { + // -- vtkPiecewiseFunction -- + this->_tfun->RemoveAllPoints(); + greyValuesTransferenceFVector.clear(); + intensityValuesTransferenceFVector.clear(); + + int nTFPoints=hDlg->getSizeTransferenceFunction(); + i=0; + while(igetTransferenceFunctionPoint(i,xi,yi); + this->_tfun->AddPoint( xi , yi/100.0 ); + greyValuesTransferenceFVector.push_back(xi); + intensityValuesTransferenceFVector.push_back(yi/100.0); + i++; + } + // -- vtkColorTransferFunction -- + this->_ctfun->RemoveAllPoints (); + //clean colors + redColorsOfColorTransferenceFVector.clear(); + greenColorsOfColorTransferenceFVector.clear(); + blueColorsOfColorTransferenceFVector.clear(); + greyValueColorsOfColorTransferenceFVector.clear(); + + int nCTFpoints=hDlg->getSizeBarColor(); + i=0; + while(igetDataBarColorPoint(i,xi,r,g,b); + this->_ctfun->AddRGBPoint(xi,r/255.0,g/255.0,b/255.0 ); + redColorsOfColorTransferenceFVector.push_back(r/255.0); + greenColorsOfColorTransferenceFVector.push_back(g/255.0); + blueColorsOfColorTransferenceFVector.push_back(b/255.0); + greyValueColorsOfColorTransferenceFVector.push_back(xi); + i++; + } + + this->_volumeMapper->Update(); + this->_newvol->Update(); + } + + else + { + + if(hDlg->getRefreshed()) + { + int i=0,size; + //--Transference Function---- + this->_tfun->RemoveAllPoints(); + i=0; + size=greyValuesTransferenceFVector.size(); + for(i=0;i_tfun->AddPoint( grey1 , in2 ); + } + + // -- vtkColorTransferFunction -- + _ctfun->RemoveAllPoints (); + + i=0; + size=greyValueColorsOfColorTransferenceFVector.size(); + for(i=0;iAddRGBPoint(grey2,red,green,blue); + } + this->_volumeMapper->Update(); + this->_newvol->Update(); + } + + } + hDlg->Destroy(); +*/ +} +/* +void vtkClipping3DDataViewer::ReadVolumeFunctions(char *namefile) +{ + char tmp[256]; + short int max; + double range[2]; + double x,val,r,g,b; + + FILE *ff = fopen ( namefile ,"r"); + + // -- MAX -- + fscanf(ff,"%s",tmp); + if (strcmp(tmp,"MAX")==0) + { + vtkImageData *vtkimagedata = this->_vtkmprbasedata->GetImageData(); + vtkimagedata->GetScalarRange(range); + max = (int) (range[1]); + } else { + max = atoi(tmp); + } + + fscanf(ff,"%s",tmp); // -- + + // -- vtkPiecewiseFunction -- + this->_tfun->RemoveAllPoints(); + fscanf(ff,"%s",tmp); + while ( strcmp(tmp,"--")!=0 ) + { + x=atof(tmp); + fscanf(ff,"%s",tmp); + val=atof(tmp); + this->_tfun->AddPoint( x*max , val ); + fscanf(ff,"%s",tmp); + } + + this->_ctfun->RemoveAllPoints (); + // -- vtkColorTransferFunction -- + while ( !feof(ff)) + { + fscanf(ff,"%s",tmp); + x=atof(tmp); + fscanf(ff,"%s",tmp); + r=atof(tmp); + fscanf(ff,"%s",tmp); + g=atof(tmp); + fscanf(ff,"%s",tmp); + b=atof(tmp); + this->_ctfun->AddRGBPoint( x*max , r,g,b ); + } + + + this->_volumeMapper->Update(); + this->_newvol->Update(); + + + fclose(ff); +} +*/ + +//------------------------------------------------------------------- +// EED 23 Mai 2007 +void vtkClipping3DDataViewer::ReadMeshVTK(char *namefile) +{ + vtkDataSetReader *reader = vtkDataSetReader::New(); + reader->SetFileName(namefile); + reader->Update(); + _tissueStripper[3]->SetInput( reader->GetPolyDataOutput() ); +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.h new file mode 100644 index 0000000..37a4ff8 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.h @@ -0,0 +1,344 @@ + +#ifndef __WX__MPR__BASE__DATA__H +#define __WX__MPR__BASE__DATA__H + +#include +#include "vtkRenderWindow.h" +#include +#include "vtkImageActor.h" +#include "vtkProp.h" +#include "vtkActor.h" +#include "vtkPolyDataMapper.h" +#include "vtkStripper.h" +#include +#include "vtkLODActor.h" + +//#include "vtkContourFilter.h" +//#include "vtkPolyDataNormals.h" +#include + +#include +#include "vtkOutlineFilter.h" +#include +#include +#include +#include +#include +#include +#include + +#include "vtkImageData.h" +#include "vtkLookupTable.h" +//#include "vtkImageActor.h" +#include +#include + +#include "marImageData.h" +//#include "./pPlotter/HistogramDialog.h" + + +#include "marTypes.h" +//------------------------------------------------------------------ + + +#define VTKMPRDATA_MAXTISSUE 4 + + +//------------------------------------------------------------------ +//------------------------------------------------------------------ +//------------------------------------------------------------------ + +class MARACASVISULIB_EXPORTS vtkBaseData { +public: + vtkBaseData(); + ~vtkBaseData(); + vtkImageData* GetImageData(); + marImageData* GetMarImageData(); + void SetMarImageData(marImageData *marimagedata); + virtual void Configure(); + double GetZ(); + void SetZ(double z); + + int GetT(); + void SetT(double t); + +protected: + marImageData *_marImageData; + double _z; + int _t; +}; + + +//------------------------------------------------------------------ +//------------------------------------------------------------------ +//------------------------------------------------------------------ + +class MARACASVISULIB_EXPORTS vtkMPRBaseData: public vtkBaseData{ +public: + vtkMPRBaseData(); + ~vtkMPRBaseData(); + virtual void Configure(); + int GetMaxPositionX( ); + int GetMaxPositionY( ); + int GetMaxPositionZ( ); + double GetX(); + double GetY(); + void SetX(double x); + void SetY(double y); + void GetDimensionExtention(int *x1,int *x2,int *y1,int *y2,int *z1,int *z2); + vtkTransform *GetTransformOrientation(); + void SetNormal(double nx, double ny, double nz); + void InitTransformOrientation(vtkTransform *trans); + +protected: + int _x1,_x2,_y1,_y2,_z1,_z2; + +private: + double _x,_y; + vtkTransform *_transformOrientation; +}; + + +//------------------------------------------------------------------ +//------------------------------------------------------------------ +//------------------------------------------------------------------ + +class MARACASVISULIB_EXPORTS vtkMPR3DDataViewer { +public: + vtkMPR3DDataViewer(); + ~vtkMPR3DDataViewer(); + vtkImageActor* GetImageActor(int id); + vtkActor* GetOutlineActor(); + virtual void Refresh(); + virtual void Configure(); + void SetVisiblePosition(int idPosition, bool visible); + bool GetVisiblePosition(int idPosition); + vtkImageActor* GetvtkActor_saggital(); + vtkImageActor* GetvtkActor_axial(); + vtkImageActor* GetvtkActor_coronal(); + void SetPositionX(int pos); + void SetPositionY(int pos); + void SetPositionZ(int pos); + void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata); + vtkMPRBaseData* GetVtkMPRBaseData(); + + vtkColorTransferFunction *GetvtkColorTransferFunction(); + std::vector *GetctFunVectorPoint(); + std::vector *GetctFunVectorRed(); + std::vector *GetctFunVectorGreen(); + std::vector *GetctFunVectorBlue(); + +private: + + bool _visiblePosition[3]; + + // outline + vtkOutlineFilter *_outlineData; + vtkPolyDataMapper *_mapOutline; + vtkActor *_outline; + + // + vtkColorTransferFunction *_ctfun; + std::vector _ctFunVectorPoint; + std::vector _ctFunVectorRed; + std::vector _ctFunVectorGreen; + std::vector _ctFunVectorBlue; + +// vtkLookupTable *_bwLut; +// vtkLookupTable *_hueLut; +// vtkLookupTable *_satLut; + + vtkImageMapToColors *_saggitalColors; + vtkImageActor *_saggital; + vtkImageMapToColors *_axialColors; + vtkImageActor *_axial; + vtkImageMapToColors *_coronalColors; + vtkImageActor *_coronal; + vtkMPRBaseData *_vtkmprbasedata; + + +}; + + + + +//------------------------------------------------------------------ +//------------------------------------------------------------------ +//------------------------------------------------------------------ + +// Callback for the interaction +//class boxVolumeObserver : public vtkCommand +//{ +// public: +// vtkRenderWindow *_renWin; +// vtkVolumeRayCastMapper *_volumeMapper; +// +// +// boxVolumeObserver() { } +// +// virtual char const *GetClassName() const { return "boxVolumeObserver";} +// +// static boxVolumeObserver *New(){ +// boxVolumeObserver * result; +// result = new boxVolumeObserver(); +// return result; +// } +// +// virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ; +// void SetRenWin( vtkRenderWindow *renWin ); +// void SetVolumeMapper(vtkVolumeRayCastMapper *volumeMapper); +//}; + +//------------------------------------------------------------------ +//------------------------------------------------------------------ +//------------------------------------------------------------------ + +// Callback for the interaction +class boxSurfaceObserver : public vtkCommand +{ + public: + vtkPlanes *_planes; + vtkProp *_actor; + vtkVolumeRayCastMapper *_vtkVolumeRayCastMapper; + + boxSurfaceObserver() + { + _vtkVolumeRayCastMapper = NULL; + } + + virtual char const *GetClassName() const { return "boxSurfaceObserver";} + + static boxSurfaceObserver *New(){ + boxSurfaceObserver * result; + result = new boxSurfaceObserver(); + return result; + } + + virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ; + void SetPlanes(vtkPlanes *planes); + void SetActor(vtkProp *actor); + void SetvtkVolumeRayCastMapper(vtkVolumeRayCastMapper *vtkvolumeraycastmapper); +}; + + + +//------------------------------------------------------------------ +//------------------------------------------------------------------ +//------------------------------------------------------------------ + +class vtkClipping3DDataViewer { +public: + //---------------------- + //Constructo-Destructor + //---------------------- + vtkClipping3DDataViewer(); + ~vtkClipping3DDataViewer(); + +// vtkImageActor* GetImageActor(int id); + vtkActor* GetOutlineActor(); + vtkClipPolyData* GetTissueClipper(int id); + vtkPolyDataMapper* GetTissueMapper(int id); + vtkPlanes* GetTissuePlanes(int id); + vtkStripper* GetTissueStripper(int id); +// vtkGlyph3D* GetGlyph(int id); + vtkLODActor* GetMaceActor(int id); + + vtkMarchingCubes *GetMCubes(int idTissue); + + virtual void Refresh(); + void RefreshSurface(); + + virtual void Configure(); + void Configure_Tissue(); + void Configure_Volume(); + + void SetIsovalue(int idTissue, int isoValue); + double GetIsovalue(int idTissue); + + vtkVolume *GetVolumeActor(); + vtkVolumeRayCastMapper *GetVolumeMapper(); + vtkPlanes *GetVolumePlanes(); + + void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata); + vtkMPRBaseData* GetVtkMPRBaseData(); + + vtkActor *GetTissueActor(int id); + void SetVisibleTissue(int idTissue, bool visible); + bool GetVisibleTissue(int idTissue); + bool GetVisibleVolume(); + void SetVisibleVolume(bool visibleVolume); + + void SetRepresentationType(int idTissue, bool representationType); + bool GetRepresentationType(int idTissue); + + boxSurfaceObserver *GetObserverS(int idObserverS); + boxSurfaceObserver *GetObserverV(); + + //void ReadVolumeFunctions(char *namefile); + void ReadVolumeFunctions(); + void ReadMeshVTK(char *namefile); + + + //------------------- + //Getters Vectors + //------------------- + + std::vector* GetGreyValuesTransferenceFVector(); + std::vector* GetIntensityValuesTransferenceFVector(); + std::vector* GetRedColorsOfColorTransferenceFVector(); + std::vector* GetGreenColorsOfColorTransferenceFVector(); + std::vector* GetBlueColorsOfColorTransferenceFVector(); + std::vector* GetGreyValueColorsOfColorTransferenceFVector(); + + //-------------------------------------- + //Getters transference function + //and color of the transference function + //--------------------------------------- + vtkPiecewiseFunction *GetTransferencefunction(); + vtkColorTransferFunction *GetColorTransferenceFunction(); + + + +private: + + vtkMarchingCubes *_mCubes[ VTKMPRDATA_MAXTISSUE ]; + vtkStripper *_tissueStripper[ VTKMPRDATA_MAXTISSUE ]; + vtkPolyDataMapper *_tissueMapper[ VTKMPRDATA_MAXTISSUE ]; + vtkPlanes *_tissuePlanes[ VTKMPRDATA_MAXTISSUE ]; + vtkClipPolyData *_tissueClipper[ VTKMPRDATA_MAXTISSUE ]; + + // outline + vtkOutlineFilter *_outlineData; + vtkPolyDataMapper *_mapOutline; + vtkActor *_outline; + + /// Volume + vtkPiecewiseFunction *_tfun; + vtkColorTransferFunction *_ctfun; + vtkVolumeRayCastCompositeFunction *_compositeFunction; + vtkPlanes *_volumePlanes; + vtkVolumeRayCastMapper *_volumeMapper; + vtkVolumeProperty *_volumeProperty; + vtkVolume *_newvol; + + vtkMPRBaseData *_vtkmprbasedata; + + bool _visibleVolume; + bool _representationType[VTKMPRDATA_MAXTISSUE]; + bool _visibleTissue[VTKMPRDATA_MAXTISSUE]; + vtkActor *_tissue[VTKMPRDATA_MAXTISSUE]; + boxSurfaceObserver *_observerV; + boxSurfaceObserver *_observerS[VTKMPRDATA_MAXTISSUE]; + + std::vector greyValuesTransferenceFVector; + std::vector intensityValuesTransferenceFVector; + std::vector redColorsOfColorTransferenceFVector; + std::vector greenColorsOfColorTransferenceFVector; + std::vector blueColorsOfColorTransferenceFVector; + std::vector greyValueColorsOfColorTransferenceFVector; +}; + + +#endif // __WX__MPR__BASE__DATA__H + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx new file mode 100644 index 0000000..92b188c --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx @@ -0,0 +1,6365 @@ +/*========================================================================= + + Program: wxMaracas + Module: $RCSfile: wxMPRWidget.cxx,v $ + Language: C++ + Date: $Date: 2008/10/31 16:32:42 $ + Version: $Revision: 1.1 $ + + Copyright: (c) 2002, 2003 + License: + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ + + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +#include "vtkClosePolyData.h" +#include +#include +#include + +// EED 25 Janvier 2007 - TestLoic +#include +#include +#include +#include + + + +#include "wxMPRWidget.h" +#include "wxVTKRenderWindowInteractor.h" +#include "UtilVtk3DGeometriSelection.h" +#include "../kernel/marDicomBase.h" + + +#include +#include +#include + +#include "matrix.h" +#include + + +#include "pPlotter/HistogramDialog.h" + +//------------------------------------------------------------------- +//------------------------------------------------------------------- +//------------------------------------------------------------------- + +idAlBeRa::idAlBeRa(int id, double radio,int deltavoxel) +{ + _id = id; + _radio = radio; + _deltavoxel = deltavoxel; +} + + +//------------------------------------------------------------------- +//------------------------------------------------------------------- +//------------------------------------------------------------------- + +vtkInteractorStyleSphere::vtkInteractorStyleSphere() +{ + _stateRadio = false; + _stateRotate = false; +} + +//--------------------------------------------------------------------------- + +vtkInteractorStyleSphere::~vtkInteractorStyleSphere() +{ +} + + +//--------------------------------------------------------------------------- + +bool vtkInteractorStyleSphere::OnRightButtonDown() +{ + if ((_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) && (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ) + { + _stateRadio = true; + //_fordwareX = this->Interactor->GetEventPosition()[0]; + _fordwareY = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1]; + + wxSphereView *wxsphereview = (wxSphereView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()); + + _radio = wxsphereview->GetRadio(); + } + + return true; +} + +//--------------------------------------------------------------------------- + +bool vtkInteractorStyleSphere::OnRightButtonUp() +{ + if (_stateRadio==true) + { + wxSphereView *wxsphereview = (wxSphereView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()); + wxsphereview->SetDeltaVoxel(1); + double radio=wxsphereview->GetRadio(); + wxsphereview->GetIdOfImage(radio+0.1); + wxsphereview->GetIdOfImage(radio+0.2); + wxsphereview->GetIdOfImage(radio-0.1); + wxsphereview->GetIdOfImage(radio-0.2); + + wxsphereview->RefreshView(); + _stateRadio = false; + } + + return true; +} +//--------------------------------------------------------------------------- + +bool vtkInteractorStyleSphere::OnLeftButtonDown() +{ + _stateRotate = true; + _fordwareX = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0]; + _fordwareY = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1]; + return true; +} + + +//--------------------------------------------------------------------------- + +bool vtkInteractorStyleSphere::OnLeftButtonUp() +{ + wxSphereView *wxsphereview = (wxSphereView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()); + if (_stateRotate==true){ + int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0]; + int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1]; + + if ((_fordwareX==fx)&&(_fordwareY==fy)){ + double x=fx,y=fy,z=1; + _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z); + wxsphereview->SetXYZtoParent(x,y); + wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121); + wxsphereview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent); + } else { + wxsphereview->RotationEnd(); + } + wxsphereview->RefreshView(); + _stateRotate = false; + } + + return true; +} + + +//--------------------------------------------------------------------------- + +bool vtkInteractorStyleSphere::OnMouseMove () +{ + wxSphereView *wxsphereview = (wxSphereView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()); + if (_stateRotate==true) + { + bool ok_v, ok_ang; + ok_v=false; + ok_ang=false; + if (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==1) + { + ok_v = true; + } + if (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==1) + { + ok_ang = true; + } + int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0]; + int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1]; + wxsphereview->RotationStart( fx - _fordwareX , -(fy - _fordwareY) , ok_v, ok_ang); + wxsphereview->RefreshView(); + } + if (_stateRadio==true) + { + //int fx = this->Interactor->GetEventPosition()[0]; + int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1]; + double dif=(fy-_fordwareY) / 10.0; + wxsphereview->SetRadio( _radio + dif ); + wxsphereview->SetDeltaVoxel(3); + wxsphereview->RefreshView(); + } + + return true; +} + + + +//------------------------------------------------------------------- +//------------------------------------------------------------------- +//------------------------------------------------------------------- + +wxSphereView::wxSphereView( wxWindow *parent, vtkMPRBaseData *vtkmprbasedata, vtkImageData *imageData ) +: wxVtk2DBaseView(parent) +{ + _delta = 1; + _vtkmprbasedata = vtkmprbasedata; + _imageDataOriginal = imageData; + + _imageSphere = vtkImageData::New(); + _imageSphere->SetDimensions (150,150,500); + _imageSphere->SetScalarTypeToUnsignedShort(); + _imageSphere->AllocateScalars(); + _imageSphere->Update(); + + + vtkBaseData *vtkbasedata = new vtkBaseData(); + vtkbasedata->SetMarImageData( new marImageData(_imageSphere) ); + this->SetVtkBaseData(vtkbasedata); + + _transform = vtkTransform::New(); + _transform1 = vtkTransform::New(); + _transform2 = vtkTransform::New(); + _transform ->Identity(); + _transform1->Identity(); + _transform2->Identity(); + + _radio=25; +} + +//------------------------------------------------------------------- + +wxSphereView::~wxSphereView() +{ + _transform -> Delete(); + _transform1 -> Delete(); + _transform2 -> Delete(); + ResetlstId(); +} + +//---------------------------------------------------------------------------- + +double wxSphereView::GetRadio() +{ + return _radio; +} + +//---------------------------------------------------------------------------- + +void wxSphereView::SetRadio(double radio) +{ + if (radio<0) + { + radio=0; + } + _radio=radio; +} + +//---------------------------------------------------------------------------- + +void wxSphereView::Configure() +{ + wxVtk2DBaseView::Configure(); + + _vtkinteractorstylesphere = new vtkInteractorStyleSphere(); + GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _vtkinteractorstylesphere ); + double points[4][3]; + +// EED purify 12/sep/2006 + int i,j; + for (i=0;i<4;i++) + { + for (j=0;j<3;j++) + { + points[i][j]=0; + } + } + + InitSphere(points); + DefineImageSphere(); +} + +//---------------------------------------------------------------------------- + +void wxSphereView::RefreshPoint() +{ + double x = _vtkmprbasedata->GetX() - _centerX; + double y = _vtkmprbasedata->GetY() - _centerY; + double z = _vtkmprbasedata->GetZ() - _centerZ; + double alpha= atan2(x,z); + double beta = atan2( y , sqrt(z*z+x*x) ); + + alpha = alpha*180/3.1416; + beta = beta*180/3.1416; + + _transform1->Identity(); + _transform1->RotateY(alpha); + _transform1->RotateX(-beta); + + _radio= sqrt(x*x + y*y +z*z); + + RefreshView(); +} + +//---------------------------------------------------------------------------- + +void wxSphereView::RefreshView() +{ + DefineImageSphere(); + wxVtk2DBaseView::Refresh(); +} + +//---------------------------------------------------------------------------- + +void wxSphereView::RotationEnd() +{ + _transform1->RotateWXYZ(_ang,_vxb,_vyb,0); + _transform2->Identity(); + SetDeltaVoxel(1); + ResetlstId(); +} + +//---------------------------------------------------------------------------- + +void wxSphereView::RotationStart(double vx, double vy, bool ok_v, bool ok_ang) +{ + if (ok_ang==false) + { + _ang = -sqrt( vx*vx + vy*vy ) / 1.0; + } + + if (ok_v==false){ + _vxb=-vy; + _vyb=vx; + } + + _transform2->Identity(); + _transform2->RotateWXYZ(_ang,_vxb,_vyb,0); + SetDeltaVoxel(3); + ResetlstId(); +} + +//---------------------------------------------------------------------------- + +void wxSphereView::GetPointSphere(double p[3],double r1,double angA,double angB) +{ + double in[3],out[3]; + in[0]=0; + in[1]=r1; + in[2]=0; + vtkTransform *transform = vtkTransform::New(); + transform->Identity(); + transform->RotateX(angB); + transform->RotateZ(angA); + transform->TransformPoint(in,out); + p[0]=out[0]; + p[1]=out[1]; + p[2]=out[2]; + transform->Delete(); +} + +//---------------------------------------------------------------------------- + +void wxSphereView::RotatePointOverTheSphere( double pp[3], double p[3],double cc[3]) +{ + + double out[3]; + _transform->TransformPoint(p,out); + pp[0] = out[0] + cc[0]; + pp[1] = out[1] + cc[1]; + pp[2] = out[2] + cc[2]; + +} + +//---------------------------------------------------------------------------- + +void wxSphereView::TransferePoints(double pp1[3],double pp2[3],double AngX,double AngY,vtkImageData *image) +{ + double t; + double difX = pp2[0]-pp1[0]; + double difY = pp2[1]-pp1[1]; + double difZ = pp2[2]-pp1[2]; + + double max = 200; + + int dimOrg[3]; + int dimRes[3]; + int z; + _imageDataOriginal->GetDimensions(dimOrg); + image->GetDimensions(dimRes); + + int i; + double x1=pp1[0]; + double y1=pp1[1]; + double z1=pp1[2]; + int xx=-1,yy=-1,zz=-1; + + for (i=0;i=0) && (xx=0) && (yy=0) && (zz=0) && (AngX=0) && (AngY=0) && (zGetScalarPointer (xx,yy,zz); + unsigned short *pRes=(unsigned short*)image->GetScalarPointer( (int)AngX , (int)AngY , z ); + *pRes=*pOrg; + } + } +} + +//---------------------------------------------------------------------------- + +void wxSphereView::ResetlstId() +{ + int i,size=_lstId.size(); + for (i=size-1;i>=0;i--) + { + delete _lstId[i]; + } + _lstId.clear(); +} + +//---------------------------------------------------------------------------- + +int wxSphereView::GetIdOfImage(double radio) +{ + int id=0; + int dim[3]; + _imageSphere->GetDimensions(dim); + int sizeMaxList = dim[2]; + // Search in list >> alpha beta radio + int i,size=_lstId.size(); + for (i=0; i_radio==radio) && (_lstId[i]->_deltavoxel==_delta)) + { + return _lstId[i]->_id; + } + } + if (size>sizeMaxList) + { + delete _lstId[size-1]; + _lstId.pop_back(); + } + if (size!=0){ + id=_lstId[0]->_id+1; + id = id % sizeMaxList; + } else { + id = 0; + } + + FiltreImage(id,radio); + _lstId.insert(_lstId.begin(),1,new idAlBeRa(id,radio,_delta) ); + + return id; +} + +//---------------------------------------------------------------------------- + +void wxSphereView::DefineImageSphere() +{ + int id; + id=GetIdOfImage( _radio ); + GetVtkBaseData()->SetZ( id ); +} + + +//---------------------------------------------------------------------------- +void wxSphereView::SetDeltaVoxel(int delta) +{ + _delta=delta; +} + +//---------------------------------------------------------------------------- +void wxSphereView::SetVoxel(double i, double j, int delta,double id, unsigned short gris) +{ + int ii,jj,delta2; + unsigned short *pRes; + int dimRes[3]; + _imageSphere->GetDimensions(dimRes); + + delta2=delta-1; + for ( ii=(int)(i-delta2) ; ii<=(int)(i+delta2) ; ii++ ) + { + for ( jj=(int)(j-delta2) ; jj<=(int)(j+delta2) ; jj++ ) + { + if ( (ii>=0)&&(ii=0)&&(jjGetScalarPointer( ii , jj , (int)id ); + *pRes=gris; + } + } + } + +} + +//---------------------------------------------------------------------------- + +void wxSphereView::SetXYZtoParent(double i, double j) +{ + + double factor = 0.75; + double radio2 = _radio*_radio; + double pxx,pyy,d2x,d2y; + double cc[3],p[3],pp[3]; + cc[0]=_centerX; + cc[1]=_centerY; + cc[2]=_centerZ; + double aa; + int dimRes[3],dimOrig[3]; + _imageSphere->GetDimensions(dimRes); + d2x=dimRes[0]/2; + d2y=dimRes[1]/2; + _imageDataOriginal->GetDimensions(dimOrig); + + p[0] = (i - d2x)*factor; + pxx=p[0]*p[0]; + p[1] = (j - d2y)*factor; + pyy=p[1]*p[1]; + aa = pxx + pyy; + if (radio2>aa){ + aa=radio2-aa; + p[2] = sqrt(aa); + RotatePointOverTheSphere( pp, p,cc); + if ( (pp[0]>=0) && (pp[0]=0) && (pp[1]=0) && (pp[2]SetX(pp[0]); + _vtkmprbasedata->SetY(pp[1]); + _vtkmprbasedata->SetZ(pp[2]); + } + } + } +} + + +//---------------------------------------------------------------------------- + +void wxSphereView::FiltreImageB(int id, double radio, bool ok,int deltaTMP) +{ + double factor = 0.75; + double radioB = radio/3; + double radio2 = radio*radio; + double pxx,pyy,d2x,d2y; + double cc[3],p[3],pp[3]; + cc[0]=_centerX; + cc[1]=_centerY; + cc[2]=_centerZ; + double aa; + unsigned short *pOrig; + int dimRes[3],dimOrig[3]; + double i,j; + _imageSphere->GetDimensions(dimRes); + _imageSphere->SetExtent(0,dimRes[0]-1,0,dimRes[1]-1,0,dimRes[2]-1); + d2x=dimRes[0]/2; + d2y=dimRes[1]/2; +// double deltaTMP=_delta; + _imageDataOriginal->GetDimensions(dimOrig); + + int start,end; + int limitA,limitB; + limitA = (int) ( (-radioB/factor)+d2x ); + limitB = (int) ( (radioB/factor)+d2x ); + if (ok==true){ + start = limitA; + end = limitB; + } else { + start=0; + end=dimRes[0]; + } + + for ( i=start ; ilimitA) && (ilimitA) && (jaa){ + aa=radio2-aa; + p[2] = sqrt(aa); + RotatePointOverTheSphere( pp, p,cc); + if ( (pp[0]>=0) && (pp[0]=0) && (pp[1]=0) && (pp[2]GetScalarPointer( (int)(pp[0]) , (int)(pp[1]) , (int)(pp[2]) ); + SetVoxel(i,j,deltaTMP,id,*pOrig); + } else { + SetVoxel(i,j,deltaTMP,id,2000); + } + } else { + SetVoxel(i,j,deltaTMP,id,0); + } + } + } + } + + _imageSphere->Modified(); + _imageSphere->Update(); +} + + + + +//---------------------------------------------------------------------------- + +void wxSphereView::FiltreImage(int id, double radio) +{ + + _transform -> Identity(); + _transform -> Concatenate(_transform1); + _transform -> Concatenate(_transform2); + + FiltreImageB(id,radio,false, _delta); + FiltreImageB(id,radio,true, 1); +} + + +//---------------------------------------------------------------------------- + +/* +void wxSphereView::FiltreImage(int id, double radio) +{ + double radio2 = radio*radio; + double radio2TMP= (radio/2)*(radio/2); + double pxx,pyy,d2x,d2y; + double cc[3],p[3],pp[3]; + cc[0]=_centerX; + cc[1]=_centerY; + cc[2]=_centerZ; + double aa; + unsigned short *pOrig; + int dimRes[3],dimOrig[3]; + double i,j; + _imageSphere->GetDimensions(dimRes); + _imageSphere->SetExtent(0,dimRes[0]-1,0,dimRes[1]-1,0,dimRes[2]-1); + d2x=dimRes[0]/2; + d2y=dimRes[1]/2; + double deltaTMP=_delta; + _imageDataOriginal->GetDimensions(dimOrig); + + for ( i=0 ; iradio2TMP) + { + if (radio2>aa){ + aa=radio2-aa; + p[2] = sqrt(aa); + RotatePointOverTheSphere( pp, p,cc); + if ( (pp[0]>=0) && (pp[0]=0) && (pp[1]=0) && (pp[2]GetScalarPointer( pp[0] , pp[1] , pp[2] ); + SetVoxel(i,j,deltaTMP,id,*pOrig); + } else { + SetVoxel(i,j,deltaTMP,id,2000); + } + } else { + SetVoxel(i,j,deltaTMP,id,0); + } + } + } + } + + + deltaTMP=1; + for ( i=0 ; iaa){ + aa=radio2-aa; + p[2] = sqrt(aa); + RotatePointOverTheSphere( pp, p,cc); + if ( (pp[0]>=0) && (pp[0]=0) && (pp[1]=0) && (pp[2]GetScalarPointer( pp[0] , pp[1] , pp[2] ); + SetVoxel(i,j,deltaTMP,id,*pOrig); + } else { + SetVoxel(i,j,deltaTMP,id,2000); + } + } else { + SetVoxel(i,j,deltaTMP,id,0); + } + } + } + } + + _imageSphere->Modified(); + _imageSphere->Update(); +} +*/ +/* +void wxSphereView::FiltreImage(vtkImageData *imageSphere) +{ + int dim[3],i,j,k; + imageSphere->GetDimensions(dim); + for (i=0;iGetScalarPointer (i,j,k); + *pRes=0; + } + } + } + + double deltaA=90; + double cc[3],p1[3],p2[3],pp1[3],pp2[3]; + cc[0]=_centerX; + cc[1]=_centerY; + cc[2]=_centerZ; + double r1 = _sl_radio->GetValue() - _sl_thickness->GetValue()/2; + double r2 = _sl_radio->GetValue() + _sl_thickness->GetValue()/2; + if (r1<10) + { + r1=10; + } + double alpha= _sl_alpha->GetValue(); + double beta = _sl_beta->GetValue(); + + double angA,angB; + for (angA=-deltaA;angA 0) + { + _centerX = (int)(cc[0]); + _centerY = (int)(cc[1]); + _centerZ = (int)(cc[2]); + } else { + int dim[3]; + _imageDataOriginal->GetDimensions(dim); + _centerX = (int)(dim[0]/2); + _centerY = (int)(dim[1]/2); + _centerZ = (int)(dim[2]/2); + } +} + +//---------------------------------------------------------------------------- + +// Calculate center and radius of sphere given four points +// http://home.att.net/~srschmitt/script_sphere_solver.html +// source code HTML