note
	description: "[
		Widget that represents this VITP sea area
		]"
	author: "Jimmy J. Johnson"

class
	CORAL_SEA_WIDGET

inherit

	SEA_AREA_WIDGET
		redefine
			create_interface_objects,
			position_widgets,
			build_land,
			build_ocean
--			build_bounding_figure
		end

create
	make

feature {NONE} -- Initialization

	create_interface_objects
			-- Initialize attributes
		do
			Precursor {SEA_AREA_WIDGET}
			new_caledonia := new_caledonia_imp
		end

	position_widgets
			-- Move Current and contained widgets to correct
			-- location and set their their sizes
		do
			Precursor {SEA_AREA_WIDGET}
			translate_widget (Current, 284, 554)
			translate_widget (dot, 100, -45)
			translate_widget (text_group, 85, -75)
			translate_widget (land, 5, 0)
--			flag.center_on_dot (dot)
			flag.set_x_y (dot.x, dot.y)
		end

	build_land
			-- Add `land' to Current
		do
			Precursor {SEA_AREA_WIDGET}
				-- This land was used to help position the
				-- brown land in the {SOLOMANS_WIDGET} or
				-- [or SOUTH_PACIFIC_OCEAN_WIDGET if fixed].
--			land.extend (new_caledonia)
		end

	build_ocean
			-- Create the polygon representing the `ocean' here
			-- Redefined to add the points
		do
			Precursor {SEA_AREA_WIDGET}

				-- start at bottom edge of board at west end measuring from bottom
				-- The first two points are hidden by Australia, but should still be
				-- close to those points, 3mm away.
			ocean.extend_point (create {EV_COORDINATE}.make (0, 0))
					-- Under Lae
			ocean.extend_point (create {EV_COORDINATE}.make (28, -165))		-- estimated
			ocean.extend_point (create {EV_COORDINATE}.make (66, -123))		--
				-- Under Guadalcanale
			ocean.extend_point (create {EV_COORDINATE}.make (114, -100))	-- estimated
					-- x is 39 left of bottom (measured from right)
			ocean.extend_point (create {EV_COORDINATE}.make (123, -109))	-- estimate
					-- x is 5 more than bottom (measured from right)
			ocean.extend_point (create {EV_COORDINATE}.make (167, -112))
				-- 704, board width, - 258 measured from bottom/right = 446
				-- 446 - (281, Indian Ocean point, + 3) = 162
			ocean.extend_point (create {EV_COORDINATE}.make (162, 1))  --0))
		end

--	build_bounding_figure
--			-- Add points to the `jj_bounding_figure'.
--			-- Redefined to use the tile edges as the bounding area
--		local
--			t: EV_MODEL_TRANSFORMATION
--		do
--			if has (jj_bounding_figure) then
--				prune_all (jj_bounding_figure)
--			end
--			create jj_bounding_figure
--			extend (jj_bounding_figure)
--			jj_bounding_figure.extend_point (create {EV_COORDINATE}.make (60, 0))
--			jj_bounding_figure.extend_point (create {EV_COORDINATE}.make (65, -40))
--			jj_bounding_figure.extend_point (create {EV_COORDINATE}.make (30, -90))
--			jj_bounding_figure.extend_point (create {EV_COORDINATE}.make (23, -140))
--			jj_bounding_figure.extend_point (create {EV_COORDINATE}.make (120, -80))
--			jj_bounding_figure.extend_point (create {EV_COORDINATE}.make (167, -112))
--			jj_bounding_figure.extend_point (create {EV_COORDINATE}.make (162, 0))
--			jj_bounding_figure.enable_closed
--			jj_bounding_figure.set_line_width (2)
--				-- Make adjustments
--			translate_widget (jj_bounding_figure, 284, 553)
----			show_bounding_figure
--		end

feature -- Access

	new_caledonia: EV_MODEL_POLYGON
			-- Island (brown on the board) south-west of New Heberdies

feature {NONE} -- Implementation

	new_caledonia_imp: EV_MODEL_POLYGON
			-- Create the polygon island north of Australia

		local
			t: EV_MODEL_TRANSFORMATION
		do
			create Result
				-- Start at north-west tip
			Result.extend_point (create {EV_COORDINATE}.make_precise (0, 0))
			Result.extend_point (create {EV_COORDINATE}.make_precise (1, 0.5))
			Result.extend_point (create {EV_COORDINATE}.make_precise (1.5, 1))
			Result.extend_point (create {EV_COORDINATE}.make_precise (5, 3))
			Result.extend_point (create {EV_COORDINATE}.make_precise (5.5, 5))
			Result.extend_point (create {EV_COORDINATE}.make_precise (7, 5.5))
			Result.extend_point (create {EV_COORDINATE}.make_precise (9, 9))
			Result.extend_point (create {EV_COORDINATE}.make_precise (12.5, 11))
				-- South-east tip
			Result.extend_point (create {EV_COORDINATE}.make_precise (17, 19))
			Result.extend_point (create {EV_COORDINATE}.make_precise (16, 19.5))
			Result.extend_point (create {EV_COORDINATE}.make_precise (14, 19))
			Result.extend_point (create {EV_COORDINATE}.make_precise (10, 16))
			Result.extend_point (create {EV_COORDINATE}.make_precise (7, 15))
			Result.extend_point (create {EV_COORDINATE}.make_precise (6, 16))
			Result.extend_point (create {EV_COORDINATE}.make_precise (6, 15))
			Result.extend_point (create {EV_COORDINATE}.make_precise (2, 8))
			Result.extend_point (create {EV_COORDINATE}.make_precise (1, 3))
			Result.extend_point (create {EV_COORDINATE}.make_precise (0, 2))
			create t.make_zero
			t.translate (130, -48)	-- 553 is the board height (not including black boarder)
			Result.transform (t)
		end

invariant

	is_valid_sea_area: attached target_imp implies sea_area = game.coral_sea

end
