/// <summary>
 /// Static function to open the filter dialog
 /// </summary>
 /// <param name="filter"></param>
 /// <returns></returns>
 public static bool RunFilter(IHeightmapFilter filter)
 {
     return RunFilter(filter, 0,0,-1,-1);
 }
 void RunHeightmapFilter(IHeightmapFilter filter)
 {
     // opens dialog...
       ApplyHeightmapFilterDlg.RunFilter(filter);
 }
        /// <summary>
        /// Static function to open the filter dialog with additional sample range
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="x1"></param>
        /// <param name="y1"></param>
        /// <param name="x2"></param>
        /// <param name="y2"></param>
        /// <returns></returns>
        public static bool RunFilter(IHeightmapFilter filter, int x1, int y1, int x2, int y2)
        {
            if (filter == null || TerrainEditor.CurrentTerrain == null || TerrainEditor.CurrentTerrain.EngineTerrain == null)
            return false;

              ApplyHeightmapFilterDlg dlg = new ApplyHeightmapFilterDlg();
              dlg.Filter = filter;
              dlg.x1 = x1;
              dlg.y1 = y1;
              dlg.x2 = x2;
              dlg.y2 = y2;
              return dlg.ShowDialog() == DialogResult.OK;
        }