indexing description: "[ import an image as an IMAGE_PANE ]" date: "$Date$" revision: "$Revision$" class IMPORT_IMAGE inherit COMMAND create make feature -- Initialization make is -- creation procedure. do end feature {HISTORY} -- Access execute (args: TUPLE) is -- creates an image from a path -- args.item (1) :: image_panes: HEAP_PRIORITY_QUEUE_WALKABLE [IMAGE_PANE] -- args.item (2) :: image_path: STRING -- args.item (3) :: scene.scale: DOUBLE local a_str: STRING scale: DOUBLE_REF do execute_successful := False if args.count = 3 then ref ?= args.item (1) a_str ?= args.item (2) scale ?= args.item (3) create pane.make (a_str) if pane.error_code = 0 then -- no errors occurred if ref.extendible then execute_successful := True ref.put (pane) pane.generate_image_scaled (scale.item) else -- heap is full! error_code := 3 end elseif pane.error_code = 1 then -- file not found error_code := 1 else -- file invalid error_code := 2 end end end undo (args: TUPLE) is -- Undo command require else ref_not_void: ref /= Void pane_not_void: pane /= Void do ref.prune (pane) execute_successful := False undo_successful := True redo_successful := False end redo (args: TUPLE) is -- Redo command require else ref_not_void: ref /= Void pane_not_void: pane /= Void do ref.put (pane) execute_successful := False undo_successful := False redo_successful := True end name: STRING is "import image" -- The nama of the current command feature -- Implementation ref: HEAP_PRIORITY_QUEUE_WALKABLE [IMAGE_PANE] -- reference to the list of image panes pane: IMAGE_PANE -- reference to the image pane feature {SCENE_SAVER} -- Execution scene_saver_execute (args: STRING) is -- creates an image from a path -- args :: image_path: STRING require args_not_void: args /= Void do execute_successful := False create pane.make (args) if pane.error_code = 0 then -- no errors occurred execute_successful := True elseif pane.error_code = 1 then -- file not found error_code := 1 else -- file invalid error_code := 2 end end end