/*
 * JaamSim Discrete Event Simulation
 * Copyright (C) 2018 JaamSim Software Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.jaamsim.Graphics;

import com.jaamsim.DisplayModels.ShapeModel;
import com.jaamsim.input.BooleanInput;
import com.jaamsim.input.ColourInput;
import com.jaamsim.input.IntegerInput;
import com.jaamsim.input.Keyword;
import com.jaamsim.math.Color4d;

public class Shape extends DisplayEntity {

	@Keyword(description = "Determines whether or not the shape is filled. "
	                     + "If TRUE, it is filled with a specified colour. "
	                     + "If FALSE, it is hollow.",
	         exampleList = {"FALSE"})
	private final BooleanInput filled;

	@Keyword(description = "The colour with which the shape is filled.",
	         exampleList = {"red"})
	private final ColourInput fillColour;

	@Keyword(description = "Determines whether or not the shape is outlined. "
	                     + "If TRUE, it is outlined with a specified colour. "
	                     + "If FALSE, it is drawn without an outline.",
	         exampleList = {"FALSE"})
	private final BooleanInput outlined;

	@Keyword(description = "Width of the outline in pixels.",
	         exampleList = { "3" })
	private final IntegerInput lineWidth;

	@Keyword(description = "The colour with which the shape is outlined.",
	         exampleList = {"red"})
	private final ColourInput lineColour;

	{
		displayModelListInput.clearValidClasses();
		displayModelListInput.addValidClass(ShapeModel.class);

		fillColour = new ColourInput("FillColour", FORMAT, null);
		fillColour.setDefaultText("ShapeModel");
		this.addInput(fillColour);

		lineColour = new ColourInput("LineColour", FORMAT, null);
		lineColour.setDefaultText("ShapeModel");
		this.addInput(lineColour);

		filled = new BooleanInput("Filled", FORMAT, true);
		filled.setDefaultText("ShapeModel");
		this.addInput(filled);

		outlined = new BooleanInput("Outlined", FORMAT, true);
		outlined.setDefaultText("ShapeModel");
		this.addInput(outlined);

		lineWidth = new IntegerInput("LineWidth", FORMAT, 1);
		lineWidth.setValidRange(0, Integer.MAX_VALUE);
		lineWidth.setDefaultText("ShapeModel");
		this.addInput(lineWidth);
	}

	public Shape() {}

	public ShapeModel getShapeModel() {
		return (ShapeModel) getDisplayModel();
	}

	public boolean isFilled() {
		if (filled.isDefault())
			return getShapeModel().isFilled();
		return filled.getValue();
	}

	public boolean isOutlined() {
		if (outlined.isDefault())
			return getShapeModel().isOutlined();
		return outlined.getValue();
	}

	public int getLineWidth() {
		if (lineWidth.isDefault())
			return getShapeModel().getLineWidth();
		return lineWidth.getValue();
	}

	public Color4d getFillColour() {
		if (fillColour.isDefault())
			return getShapeModel().getFillColour();
		return fillColour.getValue();
	}

	public Color4d getLineColour() {
		if (lineColour.isDefault())
			return getShapeModel().getLineColour();
		return lineColour.getValue();
	}

}

@@ -940,16 +940,50 @@
 yEntity 
+implements LineEntity, FillEntity 
 %7B%0A%0A%09@Key
@@ -2852,32 +2852,43 @@
 layModel();%0A%09%7D%0A%0A
+%09@Override%0A
 %09public boolean 
@@ -2896,24 +2896,24 @@
 sFilled() %7B%0A
-
 %09%09if (filled
@@ -2988,32 +2988,43 @@
 getValue();%0A%09%7D%0A%0A
+%09@Override%0A
 %09public boolean 
@@ -3132,32 +3132,43 @@
 getValue();%0A%09%7D%0A%0A
+%09@Override%0A
 %09public int getL
@@ -3278,32 +3278,43 @@
 getValue();%0A%09%7D%0A%0A
+%09@Override%0A
 %09public Color4d 
@@ -3436,24 +3436,35 @@
 alue();%0A%09%7D%0A%0A
+%09@Override%0A
 %09public Colo

modify Shape to implement FillEntity and LineEntity