
NB. Created app def file is as follows

NB. ====================================================================================================
NB. ====  (1/4) name of application =======
NB./*/APP_FOLDER_NAME/52_hokusai_komon_image_galary

NB. ====================================================================================================
NB. ====  (2/4) design of HTML doc  =======

NB./*/HTML_TITLE/Hokusai Komon
NB./*/HTML_REMARK/All the images of hokusai komon are those created by form application created by M. Shimura (JAPL Workshop 8 Dec 2012). The images were saved as png files and each png file is converted to a bmp file to display in inline frame of html document. This viewing application is written by Y. Suda.
NB. 
NB./*/HORIZONTALLINE
NB./*/RADIOBUTTON/00/HORIZONTAL/Select Type/Polygon+1000/Straight lines+100/Geometric+10/Bezier curves+1
NB./*/HORIZONTALLINE
NB./*/DROPDOWN/04/HORIZONTAL/Polygon/01 Wellframe Gammadion+01/02 6 summit Gammadion+02/03 Diamond Rhino+03/04 Connected Gammadion+04/05 Diamond Gammadion+05/06 Line-up Hemp leaves+06/07 Many Hemp leaves+07/08 8 hand Hemp leaves+08/09 Pine Hemp leaves+09
NB.
NB./*/DROPDOWN/05/HORIZONTAL/Straight lines/01 Go and Back+01/02 Suspending 4 Eyes+02/03 Candle-power Gammadion+03/04 Diamond Gammadion+04/05 Broken basket+05/06 Pine Cone+06/07 Go board(0)+07/08 Tatami Mat+08/09 Chinese sliding paper Door+09/10 NO79+10/11 Go board(1)+11/12 Triple Lattice+12/13 Screw Top+13/14 Suspended Lightning+14/15 Basket for green+15
NB.
NB./*/DROPDOWN/06/HORIZONTAL/Geometric/01 Conflict Helm leaves+01/02 Cherry blossom+02/03 Hexagonal+03/04 Cloisonne+04/05 quick patarn+05/06 Turtle+06
NB.
NB./*/DROPDOWN/07/HORIZONTAL/Bezier curves/01 Pine leaves+01/02 Banksia roses+02/03 Cloisonne+03/04 Bracken(0)+04/05 Bracken(1)+05/06 Bracken(2)+06/07 frown gammadian+07/08 random lengthways+08/09 buildin lengthways+09/10 Many Tails+10/11 Net+11/12 Holland patarn+12/13 twisted 4 hands+13/14 Rose mallow+14/15 Character Bun+15/16 Character Ra+16/17 Roof Tile+17/18 Go board+18/19 4 hands+19/20 Wisteria seeds+20/21 Korean Crest+21
NB.
NB./*/HORIZONTALLINE
NB./*/DROPDOWN/08/HORIZONTAL/Size(komon row fixed at 7)/07+07
NB./*/DROPDOWN/09/VERTICAL/Size of image display/400+400/600+600/800+800/1000+1000
NB.

NB. ====================================================================================================
NB. ====  (3/4) descrition of J function  =======
NB.define your J function(s) which will be used in YOUR_JOB function
 
NB. nothing in this application. YOUR_JOB takes care of everything.

NB. ====================================================================================================
NB. ====  (4/4) desctiption of your job based on POSTed data as argument of J function =======
YOUR_JOB =: 3 : 0

a_collection =. monitor_entry_ID_values 0

try.
   
if. J_VERSION -: 'j602' do.
  require 'bmp media/platimg'
end.

if. J_VERSION -: 'j9.4' do.
  require 'bmp png'
end.
if. J_VERSION -: 'j903' do.
  require 'bmp png'
end.
if. J_VERSION -: 'j902' do.
  require 'bmp png'
end.

   SEL0 =: ". RADIO_00_VALUE  NB. default Poly i.e. 1000
   LANG =: 'ENG' NB.RADIO_01_VALUE

   select. SEL0
      case. 1000 do. komonType =: 'P'
                     komon_type =: 'P1000_'
      case.  100 do. komonType =: 'S'
                     komon_type =: 'S0100_'
      case.   10 do. komonType =: 'G'
                     komon_type =: 'G0010_'
      case.    1 do. komonType =: 'B'
                     komon_type =: 'B0001_'
   end.

 if. LANG -: 'ENG' do.
   select. SEL0
      case. 1000 do. COLOR =: 1 }. ". (komonType, DROPDOWN_04_VALUE)
      case.  100 do. COLOR =: 1 }. ". (komonType, DROPDOWN_05_VALUE)
      case.   10 do. COLOR =: 1 }. ". (komonType, DROPDOWN_06_VALUE)
      case.    1 do. COLOR =: 1 }. ". (komonType, DROPDOWN_07_VALUE)
   end.

   select. SEL0
      case. 1000 do. KOMON =: ". DROPDOWN_04_VALUE
      case.  100 do. KOMON =: ". DROPDOWN_05_VALUE
      case.   10 do. KOMON =: ". DROPDOWN_06_VALUE
      case.    1 do. KOMON =: ". DROPDOWN_07_VALUE
   end.
 end.

   NB. calculate SIZE based on web form posted value
   sizeFromWeb =. ". DROPDOWN_08_VALUE
   SIZE =: <. 1.3 1.6 * 2 # sizeFromWeb 

   NB. ". 'COLOR hokusai_draw SEL0;KOMON;SIZE'

   NB. save drawing image to 'response_image.bmp' to include html doc

   NB. save_current_hokusai_komon_img_as_bmpfile 0
   NB. wd 'pclose'  NB. close after saving...

      process_msg =. '' 
      process_msg =. process_msg, 'komon type = ',komon_type
      process_msg =. process_msg, CRLF
      process_msg =. process_msg, 'KOMON      = ',": KOMON
      process_msg =. process_msg, CRLF
      process_msg =. process_msg, 'filename   = ','hokusai_komon_in_png/',komon_type,(_2{.'000',":KOMON),'.png'
      process_msg =. process_msg, CRLF, '''',('hokusai_komon_in_png/',komon_type,(_2{.'000',":KOMON),'.png'),'''', CRLF
      process_msg =. process_msg, CRLF
      
      if. J_VERSION -: 'j602' do.
         a_cmd =. 'a_img =. readimg ','''',('hokusai_komon_in_png/',komon_type,(_2{.'000',":KOMON),'.png'),''''
      else.
         a_cmd =. 'a_img =. readpng ','''',('hokusai_komon_in_png/',komon_type,(_2{.'000',":KOMON),'.png'),''''
      end.

      print a_cmd, CRLF
      ". a_cmd
      process_msg =. process_msg, 'png file read ok',CRLF

      a_img writebmp 'response_image.bmp'
      process_msg =. process_msg, 'png ->bmp conversion ok',CRLF
      print 'png -> bmp file conversion ok', CRLF

      RESPONSE_IMG_FLG =: 1  NB. image response flg can be set in app def file
      IFRAME_SIZE_H =: DROPDOWN_09_VALUE
      IFRAME_SIZE_W =: DROPDOWN_09_VALUE
catch.
   process_msg =. 'Error occurred during the operation'
end.

process_msg
)
NB. end of file
