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

package rec.simulate.widgets;

// -*-Mode: Java-*- 
// WSimRectangle.java -- 
// Author: Christine Alvarado <calvarad@ai.mit.edu> 
// Maintainer: Christine Alvarado <calvarad@ai.mit.edu> 
// Version: 
// Created: <Mon Mar 29 17:14:15 1999> 
// Time-stamp: <99/03/30 16:08:41 calvarad> 
// Keywords: 

import java.awt.*;
import rec.util.*;
import rec.geo.*;
import rec.sys.*;
import rec.core.widgets.*;
import java.io.*;

public abstract class WSimPolygon extends WSimBody
{
  
  public WSimPolygon( PolygonInfo pi )
  {
    setEnglishName( "Polygonal body" );
    GPoint[] arrPoints = new GPoint[pi.getNumberOfSides()];

    for( int i = 0; i < arrPoints.length; ++i ) {
      arrPoints[i] = pi.getPointAt( i );
    }

    m_Polygon = new GPolygon( arrPoints );
    Location l = new Location( m_Polygon.getBounds() );
    //m_Center = l.getCenter();
    m_NumSides = pi.getNumberOfSides();
    m_Name = "Poly" + getId();
  }

  public WSimPolygon( GPolygon pi )
  {
    setEnglishName( "Polygonal body" );

    m_Polygon = new GPolygon( pi );

    Location l = new Location( m_Polygon.getBounds() );
    //m_Center = l.getCenter();
    m_NumSides = pi.getNumberOfSides();
    m_Name = "Poly" + getId();
  }

  public GShape getShape() 
  {
    return m_Polygon;
  }
  
  protected int m_NumSides;

}
