I. Types of Shapes A. Rectangular 1. Rectangles a. Squares b. Specification i. Top/Left/Width/Height ii. Top/Left and Bottom/Right corners 2. Ellipses a. Circles b. Specification i. Ellipses: Same as rectangles ii. Circles 1) same as rectangles 2) center + radius 3. Arcs a. Specification i. Start Angle/End Angle ii. Start Angle/Increment Angle b. Java i. Start Angle measured from 0 degress on X-axis (the horizontal) ii. Positive increment = counter-clockwise iii. Uses degrees, not radians c. Arc Types i. Chord: Line segment connects start and end points ii. Open: No line segment between start and end point iii. Pie: Line segments from start and end points to the center, thus creating a pie shape 4. Text 5. Images B. Lines 1. Arrows a. Specification--One technique (see paper notes) i. height - length along the line ii. width - width of the arrow b. Derivation of equations for the endpoints of an arrow (I will first assume that the origin is positioned at the lower left corner of the coordinate system, as is done in traditional math. At the end I will convert the equations to reflect the fact that the origin is actually at the upper left corner for computer monitors).) 1) Equation for a line = P1 + d*t where t goes from 0 to 1, d is a directional vector, and d = [P2.x - P1.x, P2.y - P1.y] 2) If d = (dx, dy), then the normal vector, n, to the line is (-dy, dx) 3) The unit directional vector is (dx / sqrt(dx*dx+dy*dy), dy / sqrt(dx*dx+dy*dy)) 4) ArrowPt1 = P2 - length * unit_d + width * unit_n ArrowPt2 = P2 - length * unit_d - width * unit_n 5) Arrow = Polyline(ArrowPt1, P2, ArrowPt2) 6) Pseudo-code dx = X2 - X1; dy = Y2 - Y1; line_length = sqrt(dx*dx + dy*dy) normalized_dx = dx / line_length; normalized_dy = dy / line_length; ArrowX1 = X2 - arrowLength * normalized_dx - arrowWidth * normalized_dy ArrowY1 = Y2 - arrowLength * normalized_dy + arrowWidth * normalized_dx ArrowX2 = X2 - arrowLength * normalized_dx + arrowWidth * normalized_dy ArrowY2 = Y2 - arrowLength * normalized_dy - arrowWidth * normalized_dx 7) Adjustment for Computer Monitors: Since the y-origin is at the top of the screen, rather than the bottom of the screen, I need to flip the signs for the length and width in the y-axis. In other words, to move down the line from P2 to P1, I needed to add the length in the y-direction, and then to move out toward the top of the screen, I need to subtract the width in the y-direction. Hence for a computer monitor, my final set of equations should be: ArrowX1 = X2 - arrowLength * normalized_dx - arrowWidth * normalized _dy ArrowY1 = Y2 + arrowLength * normalized_dy - arrowWidth * normalized_dx ArrowX2 = X2 - arrowLength * normalized_dx + arrowWidth * normalized_dy ArrowY2 = Y2 + arrowLength * normalized_dy + arrowWidth * normalized_dx 2. Polylines a. Polygon: closes polyline b. Join style is important attribute C. Curves 1. Quadratic curves 2. Cubic curves D. Areas: Union, Intersection, Difference, or Exclusive-Or of shapes II. Model A. Need 3 categories of methods 1. Accessor methods for querying state information 2. Settor methods for changing state information a. First notify all observers of the change and pass the old value as a parameter b. Second change the value 3. Registration/deregistration methods for observers B. Requirements for view classes should be specified using an interface