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

// -*-Mode: JDE-*- 
// $Id: Point.java,v 1.3 2003/03/06 00:40:49 moltmans Exp $
// Point.java -- 
// Author: Michael Oltmans <moltmans@ai.mit.edu> 
// Created: <Fri Jun 09 18:12:19 2000> 
// Time-stamp: <2000-07-19 16:59:33 moltmans> 
package rec.annotate.facts;

import rec.annotate.rules.*;
import java.util.*;
import rec.util.*;
import rec.sys.*;
import rec.annotate.widgets.*;
import rec.tms.*;

/**
 * This class is for storing information about points.  Actually it is
 * just a wrapper for WPoints, but hey, who cares?
 **/
public class Point extends Annotation
{
  protected Surface m_surface;
  protected WPoint m_point;

  public Point( Surface s, WPoint point )
  {
    super( point.getTime(), point.getTime() );
    Assert.notNull( point,
		    "Cannot make Point with null WPoint" );
    m_surface = s;
    m_point = point;
  }

  public WPoint getPoint()
  {
    return m_point;
  }

  public String getFactType() 
  {
    return Type.POINT;
  }

  public boolean sameFact( Fact fact ) 
  {
    if( fact instanceof Point ) {
      Point point = (Point)fact;
      return m_point.equals( point.m_point );
    }
    return false;
  }

  public String toEnglish() 
  {
    return "point " + m_point.getLocation().getCenter();
  }

  public String toString() 
  {
    return "<Point: [" + m_point.getLocation().getCenter() + "]>";
  }
}
