// (c) MIT 2003.  All rights reserved.

////////////////////////////////////////////////////////////////////////////////
//
// FILE:	WMFrame.java
//
// AUTHOR:	Manoj D. Muzumdar
//		archon@ai.mit.edu
//
// DATE:	Mar 99
//
// COPYRIGHT:	Massachusetts Institute of Technology
//		All rights reserved.
//
// PURPOSE:     Mechanical engineering drawing recognition
//
// HISTORY:     Mar 99  archon  created
//
////////////////////////////////////////////////////////////////////////////////

package rec.meche;

import rec.geo.*;

public class WMFrame extends WPart
{
  public WMFrame( GPoint center, double angle, double size, Cloneable data )
  {
    super( center, angle, size, data );
  }

  //////////////////////////////////////////////////////////////////////////////

  public Object clone()
  {
    return( new WMFrame( getCenter(), getAngle(), size(), getData() ) );
  }

  //////////////////////////////////////////////////////////////////////////////

  protected GShape[] create( double size, Cloneable data )
  {
    GShape[] shapes = new GShape[7];

    double unit = size / 7.0;
    double angle = Math.PI * 4.0 / 3.0;

    // Set the center as the midpoint of the base line.

    setCenter( new GPoint( 3.5 * unit, 0.0 ) );

    // Create the base line.

    shapes[0] = new GSegment( GPoint.ORIGIN,
			      new GPoint( 7.0 * unit, 0.0 ) );

    // Create the diagonal strokes.

    shapes[1] = new GSegment( new GPoint( unit, 0.0 ),
			      Geometry.locatePoint( new GPoint( unit, 0.0 ),
						    1.5 * unit,
						    angle ) );
    shapes[2] = new GSegment( new GPoint( 2.0 * unit, 0.0 ),
			      Geometry.locatePoint( new GPoint( 2.0 * unit,
								0.0 ),
						    1.5 * unit,
						    angle ) );
    shapes[3] = new GSegment( new GPoint( 3.0 * unit, 0.0 ),
			      Geometry.locatePoint( new GPoint( 3.0 * unit,
								0.0 ),
						    1.5 * unit,
						    angle ) );
    shapes[4] = new GSegment( new GPoint( 4.0 * unit, 0.0 ),
			      Geometry.locatePoint( new GPoint( 4.0 * unit,
								0.0 ),
						    1.5 * unit,
						    angle ) );
    shapes[5] = new GSegment( new GPoint( 5.0 * unit, 0.0 ),
			      Geometry.locatePoint( new GPoint( 5.0 * unit,
								0.0 ),
						    1.5 * unit,
						    angle ) );
    shapes[6] = new GSegment( new GPoint( 6.0 * unit, 0.0 ),
			      Geometry.locatePoint( new GPoint( 6.0 * unit,
								0.0 ),
						    1.5 * unit,
						    angle ) );

    return( shapes );
  }
}

////////////////////////////////////////////////////////////////////////////////
