Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/22/10 00:44:01 (14 years ago)
Author:
swagner
Message:

Sorted usings and removed unused usings in entire solution (#1094)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Diagram elements/Shapes/SimpleEllipse.cs

    r3038 r4068  
    1 using System;
    21using System.Drawing;
    32using System.Drawing.Drawing2D;
    4 namespace Netron.Diagramming.Core
    5 {
    6   /// <summary>
    7   /// A simple elliptic shape
    8   /// </summary>
    9     [Shape("Ellipse", "SimpleEllipse", "Standard", "A simple elliptic shape.")]
    10     partial class SimpleEllipse : SimpleShapeBase
    11   {
    12         #region Fields
     3namespace Netron.Diagramming.Core {
     4  /// <summary>
     5  /// A simple elliptic shape
     6  /// </summary>
     7  [Shape("Ellipse", "SimpleEllipse", "Standard", "A simple elliptic shape.")]
     8  partial class SimpleEllipse : SimpleShapeBase {
     9    #region Fields
    1310
    14         // ------------------------------------------------------------------
    15         /// <summary>
    16         /// Implementation of IVersion - the current version of
    17         /// SimpleEllipse.
    18         /// </summary>
    19         // ------------------------------------------------------------------
    20         protected const double simpleEllipseVersion = 1.0;
     11    // ------------------------------------------------------------------
     12    /// <summary>
     13    /// Implementation of IVersion - the current version of
     14    /// SimpleEllipse.
     15    /// </summary>
     16    // ------------------------------------------------------------------
     17    protected const double simpleEllipseVersion = 1.0;
    2118
    22     /// <summary>
    23     /// the connectors
    24     /// </summary>
     19    /// <summary>
     20    /// the connectors
     21    /// </summary>
    2522    //Connector cBottom, cLeft, cRight, cTop;
    26     #endregion
     23    #endregion
    2724
    28         #region Properties
     25    #region Properties
    2926
    30         // ------------------------------------------------------------------
    31         /// <summary>
    32         /// Gets the current version.
    33         /// </summary>
    34         // ------------------------------------------------------------------
    35         public override double Version
    36         {
    37             get
    38             {
    39                 return simpleEllipseVersion;
    40             }
     27    // ------------------------------------------------------------------
     28    /// <summary>
     29    /// Gets the current version.
     30    /// </summary>
     31    // ------------------------------------------------------------------
     32    public override double Version {
     33      get {
     34        return simpleEllipseVersion;
     35      }
     36    }
     37
     38    /// <summary>
     39    /// Gets the friendly name of the entity to be displayed in the UI
     40    /// </summary>
     41    /// <value></value>
     42    public override string EntityName {
     43      get { return "Simple Ellipse"; }
     44    }
     45    #endregion
     46
     47    #region Constructor
     48    /// <summary>
     49    /// Default ctor
     50    /// </summary>
     51    /// <param name="s"></param>
     52    public SimpleEllipse(IModel s)
     53      : base(s) {
     54    }
     55
     56    /// <summary>
     57    /// Initializes a new instance of the <see cref="T:SimpleEllipse"/> class.
     58    /// </summary>
     59    public SimpleEllipse()
     60      : base() {
     61    }
     62
     63    #endregion
     64
     65    #region Methods
     66
     67    // -----------------------------------------------------------------
     68    /// <summary>
     69    /// Initializes this instance.
     70    /// </summary>
     71    // -----------------------------------------------------------------
     72    protected override void Initialize() {
     73      base.Initialize();
     74
     75      //the initial size
     76      Transform(0, 0, 200, 50);
     77      this.mTextArea = Rectangle;
     78
     79      // I'm changing the "simple" shapes to have no connectors.
     80      #region Connectors
     81      //cTop = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Top), Model);
     82      //cTop.Name = "Top connector";
     83      //cTop.Parent = this;
     84      //Connectors.Add(cTop);
     85
     86      //cRight = new Connector(new Point(Rectangle.Right, (int)(Rectangle.Top + Rectangle.Height / 2)), Model);
     87      //cRight.Name = "Right connector";
     88      //cRight.Parent = this;
     89      //Connectors.Add(cRight);
     90
     91      //cBottom = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Bottom), Model);
     92      //cBottom.Name = "Bottom connector";
     93      //cBottom.Parent = this;
     94      //Connectors.Add(cBottom);
     95
     96      //cLeft = new Connector(new Point(Rectangle.Left, (int)(Rectangle.Top + Rectangle.Height / 2)), Model);
     97      //cLeft.Name = "Left connector";
     98      //cLeft.Parent = this;
     99      //Connectors.Add(cLeft);
     100      #endregion
     101    }
     102
     103    /// <summary>
     104    /// Tests whether the mouse hits this shape.
     105    /// </summary>
     106    /// <param name="p"></param>
     107    /// <returns></returns>
     108    public override bool Hit(Point p) {
     109      GraphicsPath path = new GraphicsPath();
     110      path.AddEllipse(Rectangle);
     111      return path.IsVisible(p);
     112    }
     113
     114    /// <summary>
     115    /// Paints the bundle on the canvas
     116    /// </summary>
     117    /// <param name="g"></param>
     118    public override void Paint(Graphics g) {
     119      g.SmoothingMode = SmoothingMode.HighQuality;
     120      //the shadow
     121      if (ArtPalette.EnableShadows) {
     122        g.FillEllipse(
     123            ArtPalette.ShadowBrush,
     124            Rectangle.X + 5,
     125            Rectangle.Y + 5,
     126            Rectangle.Width,
     127            Rectangle.Height);
     128      }
     129
     130      //the actual bundle
     131      g.FillEllipse(mPaintStyle.GetBrush(Rectangle), Rectangle);
     132
     133      //the edge of the bundle
     134      if (Hovered) {
     135        g.DrawEllipse(ArtPalette.HighlightPen, Rectangle);
     136      } else {
     137        g.DrawEllipse(mPenStyle.DrawingPen(), Rectangle);
     138      }
     139      //the connectors
     140      if (this.ShowConnectors) {
     141        for (int k = 0; k < Connectors.Count; k++) {
     142          Connectors[k].Paint(g);
    41143        }
     144      }
    42145
    43         /// <summary>
    44         /// Gets the friendly name of the entity to be displayed in the UI
    45         /// </summary>
    46         /// <value></value>
    47         public override string EntityName
    48         {
    49             get { return "Simple Ellipse"; }
    50         }
    51         #endregion
     146      //here we keep it really simple:
     147      if (!string.IsNullOrEmpty(Text)) {
     148        //g.DrawString(
     149        //    Text,
     150        //    ArtPalette.DefaultFont,
     151        //    Brushes.Black,
     152        //    TextArea);
     153        g.DrawString(
     154            mTextStyle.GetFormattedText(Text),
     155            mTextStyle.Font,
     156            mTextStyle.GetBrush(),
     157            TextArea,
     158            mTextStyle.StringFormat);
     159      }
     160    }
    52161
    53     #region Constructor
    54     /// <summary>
    55     /// Default ctor
    56     /// </summary>
    57     /// <param name="s"></param>
    58     public SimpleEllipse(IModel s) : base(s)
    59     {
    60     }
    61162
    62         /// <summary>
    63         /// Initializes a new instance of the <see cref="T:SimpleEllipse"/> class.
    64         /// </summary>
    65          public SimpleEllipse()
    66              : base()
    67          {
    68          }
    69163
    70     #endregion
    71164
    72     #region Methods
    73165
    74          // -----------------------------------------------------------------
    75          /// <summary>
    76          /// Initializes this instance.
    77          /// </summary>
    78          // -----------------------------------------------------------------
    79          protected override void Initialize()
    80          {
    81              base.Initialize();
    82              
    83              //the initial size
    84              Transform(0, 0, 200, 50);
    85              this.mTextArea = Rectangle;
    86 
    87              // I'm changing the "simple" shapes to have no connectors.
    88              #region Connectors
    89              //cTop = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Top), Model);
    90              //cTop.Name = "Top connector";
    91              //cTop.Parent = this;
    92              //Connectors.Add(cTop);
    93 
    94              //cRight = new Connector(new Point(Rectangle.Right, (int)(Rectangle.Top + Rectangle.Height / 2)), Model);
    95              //cRight.Name = "Right connector";
    96              //cRight.Parent = this;
    97              //Connectors.Add(cRight);
    98 
    99              //cBottom = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Bottom), Model);
    100              //cBottom.Name = "Bottom connector";
    101              //cBottom.Parent = this;
    102              //Connectors.Add(cBottom);
    103 
    104              //cLeft = new Connector(new Point(Rectangle.Left, (int)(Rectangle.Top + Rectangle.Height / 2)), Model);
    105              //cLeft.Name = "Left connector";
    106              //cLeft.Parent = this;
    107              //Connectors.Add(cLeft);
    108              #endregion
    109          }
    110 
    111     /// <summary>
    112     /// Tests whether the mouse hits this shape.
    113     /// </summary>
    114     /// <param name="p"></param>
    115     /// <returns></returns>
    116     public override bool Hit(Point p)
    117     {           
    118             GraphicsPath path = new GraphicsPath();
    119             path.AddEllipse(Rectangle);
    120             return path.IsVisible(p);
    121     }
    122 
    123     /// <summary>
    124     /// Paints the bundle on the canvas
    125     /// </summary>
    126     /// <param name="g"></param>
    127     public override void Paint(Graphics g)
    128     {
    129       g.SmoothingMode = SmoothingMode.HighQuality;
    130       //the shadow
    131             if (ArtPalette.EnableShadows)
    132             {
    133                 g.FillEllipse(
    134                     ArtPalette.ShadowBrush,
    135                     Rectangle.X + 5,
    136                     Rectangle.Y + 5,
    137                     Rectangle.Width,
    138                     Rectangle.Height);
    139             }
    140 
    141       //the actual bundle
    142       g.FillEllipse(mPaintStyle.GetBrush(Rectangle), Rectangle);
    143 
    144       //the edge of the bundle
    145             if (Hovered)
    146             {
    147                 g.DrawEllipse(ArtPalette.HighlightPen, Rectangle);
    148             }
    149             else
    150             {
    151                 g.DrawEllipse(mPenStyle.DrawingPen(), Rectangle);
    152             }
    153       //the connectors
    154             if (this.ShowConnectors)
    155             {
    156                 for (int k = 0; k < Connectors.Count; k++)
    157                 {
    158                     Connectors[k].Paint(g);
    159                 }
    160             }
    161      
    162       //here we keep it really simple:
    163             if (!string.IsNullOrEmpty(Text))
    164             {
    165                 //g.DrawString(
    166                 //    Text,
    167                 //    ArtPalette.DefaultFont,
    168                 //    Brushes.Black,
    169                 //    TextArea);
    170                 g.DrawString(
    171                     mTextStyle.GetFormattedText(Text),
    172                     mTextStyle.Font,
    173                     mTextStyle.GetBrush(),
    174                     TextArea,
    175                     mTextStyle.StringFormat);
    176             }
    177     }
    178 
    179  
    180 
    181  
    182 
    183     #endregion 
    184   }
     166    #endregion
     167  }
    185168}
Note: See TracChangeset for help on using the changeset viewer.