#ifndef TransformIntfH
#define TransformIntfH


// Version number of this interface. A transform creator function should check
// this value against the value passed to the function.
#define TRANSFORM_INTF_VERSION 2


//
// ISelection
// ~~~~~~~~~~
// Interface for querying the current selection.
//
struct ISelection
{
  // Gets the x co-ord of the leftmost selected vertex
  virtual int __stdcall GetLeftBound() const = 0;

  // Gets the y co-ord of the topmost selected vertex
  virtual int __stdcall GetTopBound() const = 0;

  // Gets the x co-ord of the rightmost selected vertex
  virtual int __stdcall GetRightBound() const = 0;

  // Gets the y co-ord of the bottommost selected vertex
  virtual int __stdcall GetBottomBound() const = 0;

  // Determines whether a particular vertex is currently selected
  virtual bool __stdcall IsSelected(int x, int y) const = 0;

  // Selects an individual vertex
  virtual void __stdcall Select(int x, int y, bool sel = true) = 0;
};


//
// ITerrain
// ~~~~~~~~
// Interface for querying and modifying the terrain.
//
struct ITerrain
{
  // Gets the width of the terrain in vertexes
  virtual int __stdcall GetWidth() const = 0;

  // Gets the height of the terrain in vertexes
  virtual int __stdcall GetHeight() const = 0;

  // Gets the value (height above sea-level) for a vertex
  virtual int __stdcall GetValue(int x, int y) const = 0;

  // Sets the value (height above sea-level) for a vertex
  virtual void __stdcall SetValue(int x, int y, int v) = 0;

  // Gets the default value to use when a vertex is becoming "empty"
  virtual int __stdcall GetDefaultValue() const = 0;
};


//
// ITransform
// ~~~~~~~~~~
// Interface provided by a transformation tool to the application.
//
struct ITransform
{
  // Ask the transform to delete itself
  virtual void __stdcall Release() = 0;

  // Get the resource ID of the bitmap to use on the toolbar
  virtual int __stdcall GetBitmapResId() const = 0;

  // Display the options dialog for the transform. Returns true if the user
  // pressed OK, false if the user pressed cancel
  virtual bool __stdcall ShowOptions(HWND parent) = 0;

  // Apply the transform to the specified terrain and selection. A typical
  // transform will only modify those vertexes which are currently selected.
  virtual bool __stdcall Apply(ITerrain* terrain, ISelection* sel) = 0;
};


// Function pointer type for function used to create a particular transform.
// These functions are resolved by name from the DLL containing the transform.
typedef ITransform* (__stdcall *TTransformInitFunc)(int version);


#endif
