#region Copyright and GPL
/*************************************************************************
 * dataMagus - The open source database learning software
 * Copyright (C) 2007 by all authors
 * Authors: Monika Schwitter (monsy@gmx.ch)
 *          Jürg Zgraggen (j.zgraggen@ejaz.net)
 *          HSLU (Hochschule Luzern - Technik+Architektur)
 * 
 *     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, either version 3 of the License, or
 *     (at your option) any later version.
 * 
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY 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, see <http://www.gnu.org/licenses/>.
 *************************************************************************/
#endregion
#region Using
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using dataMagus.Common.PlugIn;
using dataMagus.Common.PlugIn.Notation;
using dataMagus.Common.Physical.Objectoriented;
#endregion

namespace dataMagus.PlugIns.Notations.Odlg
{
	/// <summary>
	/// This class is used to draw the ODLG notation.
	/// </summary>
    public class OdlgNotation : IPhysicalObjectorientedNotation
    {
        #region Members
        /// <summary>
        /// Name of the notation.
        /// </summary>
        private string _name = "ODLG";
        #endregion

        #region Properties
        /// <summary>
        /// Name of the notation.
        /// </summary>
        public string Name
        {
            get { return this._name; }
        }
        #endregion

        #region Methodes
        /// <summary>
        /// Tells the notation that the drawing of the associations will begin.
        /// </summary>
        public void BeginDrawingAssociations()
        {
        	AssociationDrawer.BeginDrawingAssociations();
        }
        
        /// <summary>
        /// Gets the control for a class.
        /// </summary>
        /// <param name="classElement">Physical class.</param>
        /// <returns>ElementControl if successfull, null to ignore.</returns>
        public ElementControl GetClassControl(PhysicalObjectorientedClass classElement)
        {
        	ClassControl ctrl = new ClassControl(classElement);
        	ctrl.AutoSize = true;
			return ctrl;
        }

        /// <summary>
        /// Tells the notation to draw a relationship.
        /// </summary>
        /// <param name="association">Physical association to draw.</param>
        /// <param name="element1">Control of the first element between the association.</param>
        /// <param name="element2">Control of the second element between the association.</param>
        /// <param name="showAssociationName">Indicator if the name of the association should show up.</param>
        /// <param name="showRolenames">Indicator if the name of the roles should show up.</param>
        /// <param name="showCardinalities">Indicator if the cardinalities should show up.</param>
        /// <param name="context">Graphics context</param>
        public void DrawAssociation(PhysicalObjectorientedAssociation association, ElementControl element1, ElementControl element2, 
			bool showAssociationName, bool showRolenames, bool showCardinalities, Graphics context)
        {
        	AssociationDrawer drawer = new AssociationDrawer(association, element1, element2);
        	drawer.ShowAssociationName = showAssociationName;
        	drawer.ShowRolenames = showRolenames;
        	drawer.ShowCardinalities = showCardinalities;
        	drawer.DrawAssociation(context);
        }
        
        /// <summary>
        /// Tells the notation that a MouseDown event has happend on the schema control.
        /// </summary>
        /// <param name="e">MouseEventArgs</param>
        public void OnMouseDown(MouseEventArgs e)
        {
        	// do nothing, not interessted in the event
        }
        #endregion
    }
}
