static void ShowExtLineInfo(StringBuilder info, AllSubdivInfo asi, GarminCore.Files.StdFile_RGN rgn, TreeViewData tvd, NodeContent.Content4File filedata, int lineidx, int tab, out int hexlen, out long firsthexadr) { GarminCore.Files.StdFile_RGN.ExtRawPolyData poly = asi.GetExtLine(lineidx); GarminCore.DataBlock block = asi.GetDataBlock4ExtLine(lineidx); firsthexadr = rgn.ExtLinesBlock.Offset; firsthexadr += block.Offset; hexlen = (int)block.Length; info.AppendLine(FillWithSpace("Type (1 Byte) (Bit 0..6)", tab, false, DecimalAndHexAndBinary(poly.Type))); info.AppendLine(FillWithSpace("Subtype (1 Byte) (Bit 0..4)", tab, false, DecimalAndHexAndBinary(poly.Subtype))); info.AppendLine(FillWithSpace("HasLabel (Bit 5)", tab, false, poly.HasLabel.ToString())); info.AppendLine(FillWithSpace("HasUnknownFlag (Bit 6)", tab, false, poly.HasUnknownFlag.ToString())); info.AppendLine(FillWithSpace("HasExtraBytes (Bit 7)", tab, false, poly.HasExtraBytes.ToString())); info.AppendLine(FillWithSpace("DeltaLongitude (2 Byte)", tab, false, DecimalAndHexAndBinary((short)poly.RawDeltaLongitude.Value) + ", " + poly.RawDeltaLongitude.ValueDegree.ToString() + "°")); info.AppendLine(FillWithSpace("DeltaLatitude (2 Byte)", tab, false, DecimalAndHexAndBinary((short)poly.RawDeltaLatitude.Value) + ", " + poly.RawDeltaLatitude.ValueDegree.ToString() + "°")); info.AppendLine(FillWithSpace("RawBitStreamLengthBytes (" + poly.RawBitStreamLengthBytes.Length.ToString() + " Byte)", tab, false, HexString(poly.RawBitStreamLengthBytes))); info.AppendLine(FillWithSpace(" BitStreamLength", tab, false, poly.BitstreamLength.ToString())); info.AppendLine(FillWithSpace("BitstreamInfo (1 Byte)", tab, false, DecimalAndHexAndBinary(poly.bitstreamInfo))); info.AppendLine(FillWithSpace(" basebits4lat", tab, false, DecimalAndHexAndBinary(poly.bitstreamInfo >> 4))); info.AppendLine(FillWithSpace(" basebits4lon", tab, false, DecimalAndHexAndBinary(poly.bitstreamInfo & 0xF))); if (poly.HasLabel) { info.AppendLine(FillWithSpace("LabelOffsetInLBL (3 Byte) (Bit 0..21)", tab, false, DecimalAndHexAndBinary(poly.LabelOffsetInLBL))); GarminCore.Files.StdFile_LBL lbl = tvd.GetLBL(filedata.Basename); if (lbl != null) { info.AppendLine(FillWithSpace(" Text (from LBL)", tab, true, lbl.GetText(poly.LabelOffsetInLBL, true) + "'")); } } if (poly.HasExtraBytes) { int len = 7 + poly.RawBitStreamLengthBytes.Length; if (poly.HasLabel) { len += 3; } filedata.BinaryReader.Seek(block.Offset + (uint)len); info.AppendLine(FillWithSpace("ExtraBytes", tab, false, HexString(filedata.BinaryReader.ReadBytes((int)block.Length - len)))); } info.AppendLine("Deltas:"); List <GarminCore.Files.StdFile_RGN.GeoDataBitstream.RawPoint> points = poly.GetRawPoints(); for (int i = 0; i < points.Count; i++) { info.AppendLine(" " + points[i].ToString() + " / " + points[0].GetMapUnitPoint(rgn.TREFile.MaplevelList[asi.MaplevelNo].CoordBits, asi.SubdivfInfo.Center).ToString()); } }
static void ShowExtPointInfo(StringBuilder info, AllSubdivInfo asi, GarminCore.Files.StdFile_RGN rgn, TreeViewData tvd, NodeContent.Content4File filedata, int pointidx, int tab, out int hexlen, out long firsthexadr) { GarminCore.Files.StdFile_RGN.ExtRawPointData point = asi.GetExtPoint(pointidx); GarminCore.DataBlock block = asi.GetDataBlock4ExtPoint(pointidx); firsthexadr = rgn.ExtLinesBlock.Offset; firsthexadr += block.Offset; hexlen = (int)block.Length; info.AppendLine(FillWithSpace("Type (1 Byte) (Bit 0..6)", tab, false, DecimalAndHexAndBinary(point.Type))); info.AppendLine(FillWithSpace("Subtype (1 Byte) (Bit 0..4)", tab, false, DecimalAndHexAndBinary(point.Subtype))); info.AppendLine(FillWithSpace("HasLabel (Bit 5)", tab, false, point.HasLabel.ToString())); info.AppendLine(FillWithSpace("HasUnknownFlag (Bit 6)", tab, false, point.HasUnknownFlag.ToString())); info.AppendLine(FillWithSpace("HasExtraBytes (Bit 7)", tab, false, point.HasExtraBytes.ToString())); info.AppendLine(FillWithSpace("DeltaLongitude (2 Byte)", tab, false, DecimalAndHexAndBinary((short)point.RawDeltaLongitude.Value) + ", " + point.RawDeltaLongitude.ValueDegree.ToString() + "°")); info.AppendLine(FillWithSpace("DeltaLatitude (2 Byte)", tab, false, DecimalAndHexAndBinary((short)point.RawDeltaLatitude.Value) + ", " + point.RawDeltaLatitude.ValueDegree.ToString() + "°")); if (point.HasLabel) { info.AppendLine(FillWithSpace("LabelOffsetInLBL (3 Byte) (Bit 0..21)", tab, false, DecimalAndHexAndBinary(point.LabelOffsetInLBL))); GarminCore.Files.StdFile_LBL lbl = tvd.GetLBL(filedata.Basename); if (lbl != null) { info.AppendLine(FillWithSpace(" Text (from LBL)", tab, true, lbl.GetText(point.LabelOffsetInLBL, true))); } } if (point.HasExtraBytes) { int len = 6; if (point.HasLabel) { len += 3; } filedata.BinaryReader.Seek(firsthexadr + (uint)len); info.AppendLine(FillWithSpace("ExtraBytes", tab, false, HexString(filedata.BinaryReader.ReadBytes(point.ExtraBytes)))); } if (point.HasUnknownFlag) { info.AppendLine(FillWithSpace("UnknownKey", tab, false, HexString(point.UnknownKey))); if (point.UnknownBytes != null && point.UnknownBytes.Length > 0) { info.AppendLine(FillWithSpace("UnknownBytes", tab, false, HexString(point.UnknownBytes))); } } }