/* ----------------------------------------------------------------------------- This source file is part of OpenSpace3D For the latest info, see http://www.openspace3d.com Copyright (c) 2012 I-maginer This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser 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, or go to http://www.gnu.org/copyleft/lesser.txt ----------------------------------------------------------------------------- */ /* Version : 1.0 First version : 05/08/2010 Author : Bourineau Bastien */ /*! \brief Callback on plugIT instance editor closed * * Prototype: fun [] [[S S] r1] * * \return [[S S] r1] : parameters to save in the instance XML data **/ fun cbCloseEdit(p)= let p -> [ctrlmindist ctrlminrepeat ctrlthreshstep ctrlminthresh ctrlmaxthresh ctrlfilterarea ctrlminarea ctrlmaxarea ctrlfiltercirc ctrlmincirc ctrlmaxcirc ctrlfiltercolor ctrlcolorvalue ctrlfilterconvex ctrlminconvex ctrlmaxconvex ctrlfilterinertia ctrlmininertia ctrlmaxinertia ctrlinit] in ["mindist" itoa (ftoi getEdCtrlFloatValue ctrlmindist)]:: ["minrepeat" itoa (ftoi getEdCtrlFloatValue ctrlminrepeat)]:: ["threshstep" itoa (ftoi getEdCtrlFloatValue ctrlthreshstep)]:: ["minthresh" itoa (ftoi getEdCtrlFloatValue ctrlminthresh)]:: ["maxthresh" itoa (ftoi getEdCtrlFloatValue ctrlmaxthresh)]:: ["filterarea" itoa (getEdCtrlCheckState ctrlfilterarea)]:: ["minarea" itoa (ftoi getEdCtrlFloatValue ctrlminarea)]:: ["maxarea" itoa (ftoi getEdCtrlFloatValue ctrlmaxarea)]:: ["filtercirc" itoa (getEdCtrlCheckState ctrlfiltercirc)]:: ["mincirc" (ftoa getEdCtrlFloatValue ctrlmincirc)]:: ["maxcirc" (ftoa getEdCtrlFloatValue ctrlmaxcirc)]:: ["filtercolor" itoa (getEdCtrlCheckState ctrlfiltercolor)]:: ["colorvalue" itoa (ftoi getEdCtrlFloatValue ctrlcolorvalue)]:: ["filterconvex" itoa (getEdCtrlCheckState ctrlfilterconvex)]:: ["minconvex" (ftoa getEdCtrlFloatValue ctrlminconvex)]:: ["maxconvex" (ftoa getEdCtrlFloatValue ctrlmaxconvex)]:: ["filterinertia" itoa (getEdCtrlCheckState ctrlfilterinertia)]:: ["mininertia" (ftoa getEdCtrlFloatValue ctrlmininertia)]:: ["maxinertia" (ftoa getEdCtrlFloatValue ctrlmaxinertia)]:: ["init" itoa (getEdCtrlCheckState ctrlinit)]:: nil;; /*! \brief Callback on plugIT instance editor opened * * Prototype: fun [EdWindow PInstance V3Dview] I * * \param EdWindow : editor window structure * \param PInstance : plugIT instance * \param V3Dview : default 3D view structure * * \return @fun [] [[S S] r1] : Callback to call on close **/ fun dynamicedit(ewinstr, inst, viewstr, applybtn)= let [400 600] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize ewinstr iw ih; let atoi (getPluginInstanceParam inst "mindist") -> mindist in let if mindist == nil then 10 else mindist -> mindist in let atoi (getPluginInstanceParam inst "minrepeat") -> minrepeat in let if minrepeat == nil then 1 else minrepeat -> minrepeat in let atoi (getPluginInstanceParam inst "threshstep") -> threshstep in let if threshstep == nil then 10 else threshstep -> threshstep in let atoi (getPluginInstanceParam inst "minthresh") -> minthresh in let if minthresh == nil then 50 else minthresh -> minthresh in let atoi (getPluginInstanceParam inst "maxthresh") -> maxthresh in let if maxthresh == nil then 220 else maxthresh -> maxthresh in let atoi (getPluginInstanceParam inst "filterarea") -> filterarea in let if filterarea == nil then 0 else filterarea -> filterarea in let atoi (getPluginInstanceParam inst "minarea") -> minarea in let if minarea == nil then 25 else minarea -> minarea in let atoi (getPluginInstanceParam inst "maxarea") -> maxarea in let if maxarea == nil then 5000 else maxarea -> maxarea in let atoi (getPluginInstanceParam inst "filtercirc") -> filtercirc in let if filtercirc == nil then 1 else filtercirc -> filtercirc in let atof (getPluginInstanceParam inst "mincirc") -> mincirc in let if mincirc == nil then 0.8 else mincirc -> mincirc in let atof (getPluginInstanceParam inst "maxcirc") -> maxcirc in let if maxcirc == nil then 1.0 else maxcirc -> maxcirc in let atoi (getPluginInstanceParam inst "filtercolor") -> filtercolor in let if filtercolor == nil then 0 else filtercolor -> filtercolor in let atoi (getPluginInstanceParam inst "colorvalue") -> colorvalue in let if colorvalue == nil then 0 else colorvalue -> colorvalue in let atoi (getPluginInstanceParam inst "filterconvex") -> filterconvex in let if filterconvex == nil then 1 else filterconvex -> filterconvex in let atof (getPluginInstanceParam inst "minconvex") -> minconvex in let if minconvex == nil then 0.95 else minconvex -> minconvex in let atof (getPluginInstanceParam inst "maxconvex") -> maxconvex in let if maxconvex == nil then 1.0 else maxconvex -> maxconvex in let atoi (getPluginInstanceParam inst "filterinertia") -> filterinertia in let if filterinertia == nil then 1 else filterinertia -> filterinertia in let atof (getPluginInstanceParam inst "mininertia") -> mininertia in let if mininertia == nil then 0.01 else mininertia -> mininertia in let atof (getPluginInstanceParam inst "maxinertia") -> maxinertia in let if maxinertia == nil then 1.0 else maxinertia -> maxinertia in let atoi (getPluginInstanceParam inst "init") -> init in let if (init == nil) then 1 else init -> init in let crEdFrameWindow _channel ewinstr 0 0 iw 540 EDWIN_RESIZE_MW nil (loc "OS3DBLOBDETECTOR_0021") (loc "OS3DBLOBDETECTOR_0001") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 520 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 (ypos + 2) (iw - 110) 20 (loc "OS3DBLOBDETECTOR_0002") nil -> labelmindist in let crEdCtrlFloat winstr (iw - 90) ypos 80 20 itof mindist 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlmindist in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) (iw - 110) 20 (loc "OS3DBLOBDETECTOR_0003") nil -> labelmindist in let crEdCtrlFloat winstr (iw - 90) ypos 80 20 itof minrepeat 1.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlminrepeat in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 30) + 2) (iw - 110) 20 (loc "OS3DBLOBDETECTOR_0004") nil -> labelthreshstep in let crEdCtrlFloat winstr (iw - 90) ypos 80 20 itof threshstep 1.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlthreshstep in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) (iw - 110) 20 (loc "OS3DBLOBDETECTOR_0005") nil -> labelminthresh in let crEdCtrlFloat winstr (iw - 90) ypos 80 20 itof minthresh 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlminthresh in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) (iw - 110) 20 (loc "OS3DBLOBDETECTOR_0006") nil -> labelmaxthresh in let crEdCtrlFloat winstr (iw - 90) ypos 80 20 itof maxthresh 1.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlmaxthresh in let crEdCtrlCheck winstr 10 (set ypos = ypos + 30) (iw - 20) 20 (loc "OS3DBLOBDETECTOR_0007") EDWIN_RESIZE_MW -> ctrlfilterarea in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) (iw - 110) 20 (loc "OS3DBLOBDETECTOR_0008") nil -> labelminarea in let crEdCtrlFloat winstr (iw - 90) ypos 80 20 itof minarea 1.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlminarea in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) (iw - 110) 20 (loc "OS3DBLOBDETECTOR_0009") nil -> labelmaxarea in let crEdCtrlFloat winstr (iw - 90) ypos 80 20 itof maxarea 1.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlmaxarea in let crEdCtrlCheck winstr 10 (set ypos = ypos + 30) (iw - 20) 20 (loc "OS3DBLOBDETECTOR_0010") EDWIN_RESIZE_MW -> ctrlfiltercirc in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) (iw - 110) 20 (loc "OS3DBLOBDETECTOR_0011") nil -> labelmincirc in let crEdCtrlFloat winstr (iw - 90) ypos 80 20 mincirc 0.0 1.0 0.1 3 nil EDWIN_RESIZE_MW -> ctrlmincirc in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) (iw - 110) 20 (loc "OS3DBLOBDETECTOR_0012") nil -> labelmaxcirc in let crEdCtrlFloat winstr (iw - 90) ypos 80 20 maxcirc 0.0 1.0 0.1 3 nil EDWIN_RESIZE_MW -> ctrlmaxcirc in let crEdCtrlCheck winstr 10 (set ypos = ypos + 30) (iw - 20) 20 (loc "OS3DBLOBDETECTOR_0013") EDWIN_RESIZE_MW -> ctrlfiltercolor in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) (iw - 110) 20 (loc "OS3DBLOBDETECTOR_0014") nil -> labelcolorvalue in let crEdCtrlFloat winstr (iw - 90) ypos 80 20 itof colorvalue 0.0 255.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlcolorvalue in let crEdCtrlCheck winstr 10 (set ypos = ypos + 30) (iw - 20) 20 (loc "OS3DBLOBDETECTOR_0015") EDWIN_RESIZE_MW -> ctrlfilterconvex in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) (iw - 110) 20 (loc "OS3DBLOBDETECTOR_0016") nil -> labelminconvex in let crEdCtrlFloat winstr (iw - 90) ypos 80 20 minconvex 0.0 1.0 0.1 3 nil EDWIN_RESIZE_MW -> ctrlminconvex in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) (iw - 110) 20 (loc "OS3DBLOBDETECTOR_0017") nil -> labelmaxconvex in let crEdCtrlFloat winstr (iw - 90) ypos 80 20 maxconvex 0.0 1.0 0.1 3 nil EDWIN_RESIZE_MW -> ctrlmaxconvex in let crEdCtrlCheck winstr 10 (set ypos = ypos + 30) (iw - 20) 20 (loc "OS3DBLOBDETECTOR_0018") EDWIN_RESIZE_MW -> ctrlfilterinertia in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) (iw - 110) 20 (loc "OS3DBLOBDETECTOR_0019") nil -> labelmininertia in let crEdCtrlFloat winstr (iw - 90) ypos 80 20 mininertia 0.0 1.0 0.1 3 nil EDWIN_RESIZE_MW -> ctrlmininertia in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) (iw - 110) 20 (loc "OS3DBLOBDETECTOR_0020") nil -> labelmaxinertia in let crEdCtrlFloat winstr (iw - 90) ypos 80 20 maxinertia 0.0 1.0 0.1 3 nil EDWIN_RESIZE_MW -> ctrlmaxinertia in let crEdFrameWindow _channel ewinstr 0 0 iw 60 EDWIN_RESIZE_MW nil (loc "OS3DBLOBDETECTOR_0022") (loc "OS3DBLOBDETECTOR_0001") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 35 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlCheck winstr 10 (set ypos = 10) 280 20 (loc "OS3DBLOBDETECTOR_0023") EDWIN_RESIZE_MW -> ctrlinit in ( setEdCtrlCheckState ctrlfilterarea filterarea; setEdCtrlCheckState ctrlfiltercirc filtercirc; setEdCtrlCheckState ctrlfiltercolor filtercolor; setEdCtrlCheckState ctrlfilterconvex filterconvex; setEdCtrlCheckState ctrlfilterinertia filterinertia; setEdCtrlCheckState ctrlinit init; [mkfun1 @cbCloseEdit [ctrlmindist ctrlminrepeat ctrlthreshstep ctrlminthresh ctrlmaxthresh ctrlfilterarea ctrlminarea ctrlmaxarea ctrlfiltercirc ctrlmincirc ctrlmaxcirc ctrlfiltercolor ctrlcolorvalue ctrlfilterconvex ctrlminconvex ctrlmaxconvex ctrlfilterinertia ctrlmininertia ctrlmaxinertia ctrlinit] nil]; ); );;