indexing description: "Parent class for classes that use an" "EM_PROCEDURE to fill a field with values" author: "" date: "$Date$" revision: "$Revision$" deferred class EM_2D_PROC_FIELD_GENERATOR inherit EM_PROC_FIELD_GENERATOR[EM_VECTOR2I, EM_VECTOR2D, EM_2D_PROCEDURE] feature start_generating_field is do global_x := 0 is_finished := false progress := 0.0 on_start end continue_generating_field is local x_step, y_step: DOUBLE x, y: DOUBLE screen_x, screen_y: INTEGER value: DOUBLE process_end_ticks: INTEGER time_ticks: INTEGER do -- This makes sure that I loop at least once time_ticks := time.ticks process_end_ticks := time_ticks + time_for_processing x_step := (eval_to.x - eval_from.x) / field_dimension.x y_step := (eval_to.y - eval_from.y) / field_dimension.y from screen_x := global_x x := eval_from.x + y_step * global_x until time_ticks > process_end_ticks or else screen_x >= field_dimension.x loop from screen_y := 0 y := eval_from.y until screen_y >= field_dimension.y loop value := procedure.evaluate_at ([x, y]) store_field_value([screen_x, screen_y], value) y := y + y_step screen_y := screen_y + 1 end x := x + x_step screen_x := screen_x + 1 global_x := global_x + 1 time_ticks := time.ticks end progress := (100.0 / field_dimension.x * screen_x) / 100.0 if screen_x = field_dimension.x then is_finished := true on_finish end end feature {NONE} -- Implementation global_x: INTEGER -- Variable to remember where field generation stopped invariant procedure_set: procedure /= void color_mapper_set: color_mapper /= void is_finished_implies_full_progress: is_finished implies progress = 1.0 progress_valid: progress >= 0 and progress <= 1.0 field_set_when_finished: is_finished implies last_field /= void end