indexing description: "[ a notion of Vertex, which is attached to an EM_VECTOR_2D of a certain object ]" date: "$Date$" revision: "$Revision$" deferred class VERTEX feature -- creation make (a_vector: EM_VECTOR_2D; obj: OBJECT) is -- creation procedure do vector := a_vector object := obj end feature -- Access vector: EM_VECTOR_2D -- reference to a vector cursor: MOUSE_CURSOR is -- the cursor deferred end is_selected: BOOLEAN -- is the vertex selected? drag_button_size: INTEGER is 2 -- the size of the drag buttons in pixels from the center -- so the actual size will be 2x`drag_button_size'+1 is_point_over_vertex (an_x, a_y: INTEGER): BOOLEAN is -- is `an_x', `a_y' over the vertex? local t1, t2: INTEGER do t2 := vector.x.rounded t1 := t2 - drag_button_size t2 := t2 + drag_button_size if an_x >= t1 and an_x <= t2 then t2 := vector.y.rounded t1 := t2 - drag_button_size t2 := t2 + drag_button_size if a_y >= t1 and a_y <= t2 then Result := True end end end object: OBJECT -- the object, the vertex belongs to command: COMMAND is -- the command for this vertex movement deferred end args: TUPLE is -- the arguments to the given `command' deferred end feature -- Element Change set_vector (v: EM_VECTOR_2D) is -- sets `vector' require v_not_void: v /= Void do vector := v end set_selected (b: BOOLEAN) is -- sets `is_selected' do is_selected := b ensure is_selected_set: is_selected = b end end