public static Ldf1Header MvgHeaderToLdfHeader(MvgHeader mvgHeader) { Ldf1Header ldfHeader = new Ldf1Header(); FillLdfHeaderAttributes(mvgHeader, ldfHeader); return(ldfHeader); }
public static void FillMvgHeader(Ldf1Header ldfHeader, MvgHeader mvgHeader) { mvgHeader.CreatedDateTime = ldfHeader.YMDHM; mvgHeader.ProjectType = ldfHeader.ProjectType; mvgHeader.Width = (Int16)ldfHeader.Width; mvgHeader.Height = (Int16)ldfHeader.Height; mvgHeader.LongitudeResolution = ldfHeader.LonSolution; mvgHeader.LatitudeResolution = ldfHeader.LatSolution; mvgHeader.StandardLatitude1 = ldfHeader.StandardLat1; mvgHeader.StandardLatitude2 = ldfHeader.StandardLat2; mvgHeader.EarthRadius = ldfHeader.EarthRadius; mvgHeader.MinLat = ldfHeader.MinLat; mvgHeader.MaxLat = ldfHeader.MaxLat; mvgHeader.MinLon = ldfHeader.MinLon; mvgHeader.MaxLon = ldfHeader.MaxLon; mvgHeader.IsExtend = ldfHeader.IsExtended; mvgHeader.SpatialRef = ldfHeader.SpatialRef; if (ldfHeader.IsExtended) { mvgHeader.GeoDoIdentify = ldfHeader.GeoDoIdentify; mvgHeader.PrjId = ldfHeader.PrjId; mvgHeader.A = ldfHeader.A; mvgHeader.B = ldfHeader.B; mvgHeader.Sp1 = ldfHeader.Sp1; mvgHeader.Sp2 = ldfHeader.Sp2; mvgHeader.Lat0 = ldfHeader.Lat0; mvgHeader.Lon0 = ldfHeader.Lon0; mvgHeader.X0 = ldfHeader.X0; mvgHeader.Y0 = ldfHeader.Y0; mvgHeader.K0 = ldfHeader.K0; } }
private static void GetLdfHeaderSpatialRef(MvgHeader mvgHeader, Ldf1Header ldfHeader) { if (mvgHeader.Version == 3) { GetLdfHeaderSpatialRefByExtend(mvgHeader, ldfHeader); } }
//适用于打开文件的情况 public MvgDataProvider(string fileName, IGeoDataDriver dataDriver, bool isReadOnly) : base(fileName, dataDriver) { _driver = dataDriver; _fileName = fileName; string hdrfile = HdrFile.GetHdrFileName(_fileName); if (File.Exists(hdrfile)) { _filelist = new string[] { _fileName, hdrfile } } ; else { _filelist = new string[] { _fileName } }; _header = new MvgHeader(fileName); FillProviderAttributes(); _fsStream = new FileStream(_fileName, FileMode.Open, isReadOnly ? FileAccess.Read : FileAccess.ReadWrite); if (!isReadOnly) { _binaryWriter = new BinaryWriter(_fsStream); } _binaryReader = new BinaryReader(_fsStream); LoadBands(); }
private static void GetLdfHeaderSpatialRefByExtend(MvgHeader mvgHeader, Ldf1Header ldfHeader) { ldfHeader.GeoDoIdentify = mvgHeader.GeoDoIdentify; ldfHeader.PrjId = mvgHeader.PrjId; ldfHeader.A = mvgHeader.A; ldfHeader.B = mvgHeader.B; ldfHeader.Sp1 = mvgHeader.Sp1; ldfHeader.Sp2 = mvgHeader.Sp2; ldfHeader.Lat0 = mvgHeader.Lat0; ldfHeader.Lon0 = mvgHeader.Lon0; ldfHeader.X0 = mvgHeader.X0; ldfHeader.Y0 = mvgHeader.Y0; ldfHeader.K0 = mvgHeader.K0; }
public MvgRasterBand(IRasterDataProvider rasterDataProvider, BinaryReader binaryReader, BinaryWriter binaryWriter, FileStream fileStream) : base(rasterDataProvider) { _rasterDataProvider = rasterDataProvider; _fileStream = fileStream; _binaryReader = binaryReader; _binaryWriter = binaryWriter; _bandNo = 1; _dataType = enumDataType.Int16; _header = (rasterDataProvider as IMvgDataProvider).Header; _spatialRef = (rasterDataProvider as IMvgDataProvider).Header.SpatialRef; _width = (rasterDataProvider as IMvgDataProvider).Width; _height = (rasterDataProvider as IMvgDataProvider).Height; //_noDataValue //CoordTransform //MaxByMeasureBits }
private MvgHeader CreateMvgHeader(int xSize, int ySize, ISpatialReference spatialRef, HdrMapInfo mapInfo, Int16 valueCount, Int16[] values, string[] valueNames) { if (values == null || valueNames == null || valueCount == 0) { throw new NotSupportedException("所给参数(values,valueNames,valueCount)不完整!"); } MvgHeader mvgHeader = new MvgHeader(); mvgHeader.Width = (Int16)xSize; mvgHeader.Height = (Int16)ySize; mvgHeader.SpatialRef = spatialRef; mvgHeader.ValueCount = valueCount; mvgHeader.Values = values; mvgHeader.ValueNames = valueNames; mvgHeader.SetMapInfo(mapInfo); return(mvgHeader); }
private static void FillLdfHeaderAttributes(MvgHeader mvgHeader, Ldf1Header ldfHeader) { //ldfHeaderBase 成员 ldfHeader._channelCount = 1; ldfHeader._dataType = (Int16)LdfHeaderBase.DataTypeToIntValue(typeof(Int16)); ldfHeader._width = (UInt16)mvgHeader.Width; ldfHeader._height = (UInt16)mvgHeader.Height; ldfHeader._headerSize = 128; ldfHeader._interleave = (Int16)LdfHeaderBase.InterleaveToInt(enumInterleave.BSQ); //ldf1Header成员 ldfHeader.FileIdentify = "LA"; ldfHeader.YMDHM = mvgHeader.CreatedDateTime; ldfHeader.ProjectType = mvgHeader.ProjectType; ldfHeader.LonSolution = mvgHeader.LongitudeResolution; ldfHeader.LatSolution = mvgHeader.LatitudeResolution; ldfHeader.StandardLat1 = mvgHeader.StandardLatitude1; ldfHeader.StandardLat2 = mvgHeader.StandardLatitude2; ldfHeader.EarthRadius = mvgHeader.EarthRadius; ldfHeader.MinLat = mvgHeader.MinLat; ldfHeader.MaxLat = mvgHeader.MaxLat; ldfHeader.MinLon = mvgHeader.MinLon; ldfHeader.MaxLon = mvgHeader.MaxLon; GetLdfHeaderSpatialRef(mvgHeader, ldfHeader); }
protected override bool IsCompatible(string fileName, byte[] header1024, params object[] args) { string fileExtension = Path.GetExtension(fileName).ToUpper(); return(MvgHeader.IsMVG(header1024, fileExtension)); }
private IGeoDataProvider BuildDataProviderByArgs(string fileName, enumDataProviderAccess access, MvgHeader mvgHeader) { return(new MvgDataProvider(fileName, this as RasterDataDriver, mvgHeader, access == enumDataProviderAccess.ReadOnly)); }