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

////////////////////////////////////////////////////////////////////////////////
//
// FILE:	WMChain.java
//
// AUTHOR:	Manoj D. Muzumdar
//		archon@ai.mit.edu
//
// DATE:	April 99
//
// COPYRIGHT:	Massachusetts Institute of Technology
//		All rights reserved.
//
// PURPOSE:     Chain widget
//
// HISTORY:     April 99  archon  created
//
////////////////////////////////////////////////////////////////////////////////

package rec.meche;

import rec.geo.*;

public class WMChain extends WPart
{
  public WMChain( WMBelt belt )
  {
    super( belt.getCenter(), belt.getAngle(), belt.size(),
	   new CloneableArray( belt.getComponents() ) );
  }

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

  public Object clone()
  {
    return( new WMChain( (WMBelt)getData() ) );
  }

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

  protected GShape[] create( double size, Cloneable data )
  {
    GShape[] shapes = (GShape[])((CloneableArray)data).getArray();

    GShape[] newShapes = new GShape[shapes.length];

    for( int i = 0; i < shapes.length; ++i ) {
      newShapes[i] = new GCircledSegment( (GSegment)shapes[i], 3.0 );
    }

    return( newShapes );
  }
}

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