#------------------------------------------------------------------------------
# Copyright (C) 2007 Richard W. Lincoln
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 dated June, 1991.
#
# This software is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANDABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#------------------------------------------------------------------------------

""" Defines an ellipse component.

References:
    Jose.R.Fonseca, 'XDot', http://code.google.com/p/jrfonseca/wiki/XDot

"""

#------------------------------------------------------------------------------
#  Imports:
#------------------------------------------------------------------------------

from math import pi, sqrt

from enthought.traits.api import Instance, Float, Int, Bool, on_trait_change
from enthought.traits.ui.api import View, Item, Group
from enthought.enable.api import Component, Pointer
from enthought.kiva import FILL_STROKE

from pen import Pen

#------------------------------------------------------------------------------
#  "Ellipse" class:
#------------------------------------------------------------------------------

class Ellipse(Component):
    """ Component with Ellipse traits """

    #--------------------------------------------------------------------------
    #  "Ellipse" interface:
    #--------------------------------------------------------------------------

    # Pen used to draw the ellipse
    pen = Instance(Pen, desc="Pen instance with which to draw the ellipse")

    # X-axis coordinate of ellipse origin
    x_origin = Float(desc="x-axis coordinate of ellipse origin")

    # Y-axis coordinate of ellipse origin
    y_origin = Float(desc="y-axis coordinate of ellipse origin")

    # Width of the ellipse (semi-major axis)
    e_width = Float(desc="Ellipse width")

    # Height of the ellipse (semi-minor axis)
    e_height = Float(desc="Ellipse height")

    # Is the ellipse filled?
    filled = Bool(False, desc="Fill the ellipse")