/// <summary> /// Attempts to open a file using the specified parameters. Given the popularity of the /// float data type, the grid will make an effort to open everything as a float data type. /// </summary> /// <param name="Filename">The Filename of the grid to open</param> /// <param name="InRam">Specifies whether or not the grid is in ram.</param> /// <param name="FileType">The file format as specified by a MapWindow.Interfaces.Types.GridFileType</param> /// <exception cref="System.ApplicationException">Returns an exception if there is a failure</exception> public void Open(string Filename, bool InRam, GridFileType FileType) { if (m_Grid.Open(Filename, MapWinGIS.GridDataType.FloatDataType, InRam, Convert.mwGridFileType(FileType), m_ICallBack) == false) { throw new MapWinException(m_Grid.LastErrorCode); } }
/// <summary> /// Saves the grid using the specified parameters /// </summary> /// <param name="Filename">The name of the file to save this raster to</param> /// <param name="newFileFormat">The file format to use when saving the grid</param> /// <returns>bool - always true - (throws exceptions)</returns> public bool Save(string Filename, GridFileType newFileFormat) { if (m_Grid.Save(Filename, Convert.mwGridFileType(newFileFormat), m_ICallBack) == false) { MapWinUtility.Logger.Dbg("MapWinGIs.Grid.Save threw an Exception."); throw new MapWinException(m_Grid.LastErrorCode); } return(true); }
public void SaveTest() { SuperGrid target = new SuperGrid(); // TODO: Initialize to an appropriate value string Filename = string.Empty; // TODO: Initialize to an appropriate value GridFileType GridFileType = new GridFileType(); // TODO: Initialize to an appropriate value ICallback cBack = null; // TODO: Initialize to an appropriate value bool expected = false; // TODO: Initialize to an appropriate value bool actual; actual = target.Save(Filename, GridFileType, cBack); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public void CreateNewTest() { SuperGrid target = new SuperGrid(); // TODO: Initialize to an appropriate value string Filename = string.Empty; // TODO: Initialize to an appropriate value GridHeader Header = null; // TODO: Initialize to an appropriate value GridDataType DataType = new GridDataType(); // TODO: Initialize to an appropriate value object InitialValue = null; // TODO: Initialize to an appropriate value bool InRam = false; // TODO: Initialize to an appropriate value GridFileType FileType = new GridFileType(); // TODO: Initialize to an appropriate value ICallback cBack = null; // TODO: Initialize to an appropriate value bool expected = false; // TODO: Initialize to an appropriate value bool actual; actual = target.CreateNew(Filename, Header, DataType, InitialValue, InRam, FileType, cBack); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
/// <summary> /// Creates a new instance of a MapWinGIS Grid according to the parameters required by IRaster /// </summary> /// <param name="Filename">The string full path filename of the grid</param> /// <param name="newFileType">A MapWindow.Interfaces.Type.GridFileType specifying a file format</param> /// <param name="dX">Double, specifies the cell width of a single "pixel" for the grid</param> /// <param name="dY">Double, specifies the cell height of a single pixel of the grid</param> /// <param name="xllCenter">Double, The longitude/X-coordinate of the lower left pixel in the grid</param> /// <param name="yllCenter">Double, The latitude/Y-coordinate of the lower left pixel of the grid</param> /// <param name="noDataVal">Double, The value to use as a no-data value in the grid</param> /// <param name="projection">String: the proj-4 string to use to describe the grid projection</param> /// <param name="nCols">Int, the number of columns in the grid</param> /// <param name="nrows">Int, the number of rows in the grid</param> /// <param name="DataType">A MapWindow.Interfaces.Type.GridDataType that specifies the numeric data format</param> /// <param name="CreateINRam">Boolean, if true, the entire element will be created in ram</param> /// <param name="initialValue">The intial value for the grid</param> /// <param name="applyinitialValue">I'm not sure this is an option in the old grid</param> public void CreateNew(string Filename, GridFileType newFileType, double dX, double dY, double xllCenter, double yllCenter, double noDataVal, string projection, int nCols, int nrows, GridDataType DataType, bool CreateINRam, double initialValue, bool applyinitialValue) { MapWinGIS.GridHeader gh = new MapWinGIS.GridHeader(); gh.dX = dX; gh.dY = dY; gh.XllCenter = xllCenter; gh.YllCenter = yllCenter; gh.Projection = projection; gh.NumberCols = nCols; gh.NumberRows = nrows; gh.NodataValue = noDataVal; if (m_Grid.CreateNew(Filename, gh, MapWinGeoProc.Compatibility.Convert.mwGridDataType(DataType), initialValue, CreateINRam, MapWinGeoProc.Compatibility.Convert.mwGridFileType(newFileType), null) == false) { MapWinUtility.Logger.Dbg("Error calling CreateNew in MapWinGIS.Grid"); throw new MapWinException(m_Grid.LastErrorCode); } }
/// <summary> /// Merges multiple grids into a single output grid. /// </summary> /// <param name="Grids">An array of grid objects to be merged into one grid.</param> /// <param name="MergeFilename">The filename to use for the new merged grid. </param> /// <param name="InRam">Optional. A boolean value representing whether to create the merged grid in RAM or on disk</param> /// <param name="GrdFileType">Optional. The file type of the new merged grid. </param> /// <param name="cBack">Optional. The ICallback object which will receive progress and error messages while the grids are being merged.</param> /// <returns>The new merged grid.</returns> public Grid GridMerge(object Grids, string MergeFilename, bool InRam, GridFileType GrdFileType, ICallback cBack) { throw new NotImplementedException(); }
/// <summary> /// Saves the grid. /// </summary> /// <param name="Filename">Optional. The filename the grid will be saved under. /// If no filename is specified the filename in the grid's Filename property is used.</param> /// <param name="GridFileType">Optional. The file type to save the grid as. /// If no type is specified, the type stored in the grid object is used. </param> /// <param name="cBack">Optional. The ICallback object that will receive the progress and error events during the creation of the new grid.</param> /// <returns>A boolean value representing the success or failure of saving the grid. </returns> public bool Save(string Filename, GridFileType GridFileType, ICallback cBack) { throw new NotImplementedException(); }
/// <summary> /// Opens a grid. /// </summary> /// <param name="Filename">The filename of the grid to be opened.</param> /// <param name="DataType">Optional. The data type of the grid to be opened. </param> /// <param name="InRam">Optional. A boolean value representing whether the grid will be stored in RAM or on disk.</param> /// <param name="fileType">Optional. The file type of the grid. The default file type is "Use Extension". </param> /// <param name="cBack">Optional. The ICallback object that will receive the progress and error events during the creation /// of the new grid.</param> /// <returns>A boolean value that represents the success or failure of opening the grid. </returns> public bool Open(string Filename, GridDataType DataType, bool InRam, GridFileType fileType, ICallback cBack) { throw new NotImplementedException(); }
/// <summary> /// Creates a new grid. /// </summary> /// <param name="Filename">The filename for the new grid. </param> /// <param name="Header">The header defining the attributes of the new grid.</param> /// <param name="DataType">The data type of the new grid.</param> /// <param name="InitialValue">The initial value for each cell of the new grid.</param> /// <param name="InRam">Optional. A boolean value representing the grid being stored in memory(RAM) when True, and the /// grid being stored on disk when False. </param> /// <param name="fileType">Optional. The grid file type.</param> /// <param name="cBack">Optional. The ICallback object that will receive the progress and error events during the creation of the new grid.</param> /// <returns>A boolean value representing the success or failure of the creation of the new grid.</returns> public bool CreateNew(string Filename, GridHeader Header, GridDataType DataType, object InitialValue, bool InRam, GridFileType fileType, ICallback cBack) { throw new NotImplementedException(); }
/// <summary> /// Returns a new MapWindow.Interfaces.Types.GridFileType that corresponds to the /// older MapWinGIS.GridFileType /// </summary> /// <param name="MapWinGIS_GridFileType">A MapWinGIS.GridFileType</param> /// <returns>A MapWindow.Interfaces.Types.GridFileType</returns> public static GridFileType GetGridFileType(MapWinGIS.GridFileType MapWinGIS_GridFileType) { GridFileType retVal = GridFileType.USE_EXTENSION; switch (MapWinGIS_GridFileType) { case MapWinGIS.GridFileType.Ascii: retVal = GridFileType.ASCII_GRID; break; case MapWinGIS.GridFileType.Bil: retVal = GridFileType.BIL; break; case MapWinGIS.GridFileType.Binary: retVal = GridFileType.BINARY_GRID; break; case MapWinGIS.GridFileType.DTed: retVal = GridFileType.DTED; break; case MapWinGIS.GridFileType.Ecw: retVal = GridFileType.ECW; break; case MapWinGIS.GridFileType.Esri: retVal = GridFileType.ESRI_GRID; break; case MapWinGIS.GridFileType.Flt: retVal = GridFileType.FLT; break; case MapWinGIS.GridFileType.GeoTiff: retVal = GridFileType.GEOTIFF_GRID; break; case MapWinGIS.GridFileType.InvalidGridFileType: retVal = GridFileType.INVALID_GRID_TYPE; break; case MapWinGIS.GridFileType.MrSid: retVal = GridFileType.MRSID; break; case MapWinGIS.GridFileType.PAux: retVal = GridFileType.PAUX; break; case MapWinGIS.GridFileType.PCIDsk: retVal = GridFileType.PCIDSK; break; case MapWinGIS.GridFileType.Sdts: retVal = GridFileType.SDTS_GRID; break; case MapWinGIS.GridFileType.UseExtension: retVal = GridFileType.USE_EXTENSION; break; default: retVal = GridFileType.USE_EXTENSION; break; } return(retVal); }
/// <summary> /// Converts a newer Mapwindow.Interfaces.Types.GridFileType to an older /// MapWinGIS.GridFileType /// </summary> /// <param name="Types_GridFileType">A MapWindow.Interfaces.Types.GridFileType</param> /// <returns>A MapWinGIS.GridFiletype</returns> public static MapWinGIS.GridFileType mwGridFileType(GridFileType Types_GridFileType) { MapWinGIS.GridFileType retVal = MapWinGIS.GridFileType.UseExtension; switch (Types_GridFileType) { case GridFileType.ASCII_GRID: retVal = MapWinGIS.GridFileType.Ascii; break; case GridFileType.BIL: retVal = MapWinGIS.GridFileType.Bil; break; case GridFileType.BINARY_GRID: retVal = MapWinGIS.GridFileType.Binary; break; case GridFileType.DTED: retVal = MapWinGIS.GridFileType.DTed; break; case GridFileType.ECW: retVal = MapWinGIS.GridFileType.Ecw; break; case GridFileType.ESRI_GRID: retVal = MapWinGIS.GridFileType.Esri; break; case GridFileType.FLT: retVal = MapWinGIS.GridFileType.Flt; break; case GridFileType.GEOTIFF_GRID: retVal = MapWinGIS.GridFileType.GeoTiff; break; case GridFileType.INVALID_GRID_TYPE: retVal = MapWinGIS.GridFileType.InvalidGridFileType; break; case GridFileType.MRSID: retVal = MapWinGIS.GridFileType.MrSid; break; case GridFileType.PAUX: retVal = MapWinGIS.GridFileType.PAux; break; case GridFileType.PCIDSK: retVal = MapWinGIS.GridFileType.PCIDsk; break; case GridFileType.SDTS_GRID: retVal = MapWinGIS.GridFileType.Sdts; break; case GridFileType.USE_EXTENSION: retVal = MapWinGIS.GridFileType.UseExtension; break; } return(retVal); }