static public byte[] GetBytebufferWithValue(GarminCore.DataBlock v) { byte[] buff = new byte[8]; SetValueToBuffer(buff, v.Offset, 0, false); SetValueToBuffer(buff, v.Length, 4, false); return(buff); }
public Content4DataRange(GarminCore.DataBlock v, long rangeadr, string infotext) : this(GetBytebufferWithValue(v), 0, -1, DataType.DataBlock, rangeadr, infotext) { }
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()); } }
public GarminCore.DataBlock GetDataBlock4ExtArea(int idx) { GarminCore.DataBlock block = new GarminCore.DataBlock(); block.Offset = 0; for (int i = 0; i < idx; i++) { block.Offset += SubdivData.ExtAreaList[i].DataLength; } block.Length = SubdivData.ExtAreaList[idx].DataLength; return(block); }
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))); } } }
/// <summary> /// schreibt Infos zur Subdiv aus der TRE-Datei in den StringBuilder und liefert den Datenblock (bzgl. des SubdivisionBlocks) /// </summary> /// <param name="info"></param> /// <param name="tre"></param> /// <param name="subdividx"></param> /// <returns></returns> public static GarminCore.DataBlock SampleInfo4SubdivInfo(StringBuilder info, GarminCore.Files.StdFile_TRE tre, int subdividx) { GarminCore.Files.StdFile_TRE.SubdivInfoBasic subdiv = tre.SubdivInfoList[subdividx]; if (!(subdiv is GarminCore.Files.StdFile_TRE.SubdivInfo)) { info.AppendLine("SubdivInfoBasic"); } int tab = 40; int count = 0; for (int i = 0; i < tre.MaplevelList.Count; i++) { count += tre.MaplevelList[i].SubdivInfos; if (subdividx < count) { info.AppendLine(FillWithSpace("SubdivInfo for maplevel", tab, false, i.ToString())); break; } } info.AppendLine(FillWithSpace("Offset in RGN (3 Byte)", tab, false, DecimalAndHexAndBinary((ulong)subdiv.Data.Offset))); info.AppendLine(FillWithSpace(" calculated length", tab, false, DecimalAndHexAndBinary((ulong)subdiv.Data.Length))); info.AppendLine(FillWithSpace("Content (1 Byte)", tab, false, DecimalAndHexAndBinary((ulong)(byte)subdiv.Content) + "; " + subdiv.Content.ToString())); info.AppendLine(FillWithSpace("Center Longitude (3 Byte)", tab, false, DecimalAndHexAndBinary(subdiv.Center.Longitude) + "; " + subdiv.Center.LongitudeDegree.ToString() + "°")); info.AppendLine(FillWithSpace("Center Latitude (3 Byte)", tab, false, DecimalAndHexAndBinary(subdiv.Center.Latitude) + "; " + subdiv.Center.LatitudeDegree.ToString() + "°")); info.AppendLine(FillWithSpace("HalfWidth (2 Byte) (Bit 0..14)", tab, false, DecimalAndHexAndBinary(subdiv.HalfWidth) + "; " + GarminCore.Coord.MapUnits2Degree(subdiv.HalfWidth).ToString() + "°")); info.AppendLine(FillWithSpace("LastSubdiv (Bit 15)", tab, false, subdiv.LastSubdiv.ToString())); info.AppendLine(FillWithSpace("HalfHeight (2 Byte)", tab, false, DecimalAndHexAndBinary(subdiv.HalfHeight) + "; " + GarminCore.Coord.MapUnits2Degree(subdiv.HalfHeight).ToString() + "°")); if (subdiv is GarminCore.Files.StdFile_TRE.SubdivInfo) { info.AppendLine(FillWithSpace("FirstChildSubdivIdx, 1 based (2 Byte)", tab, false, DecimalAndHexAndBinary((subdiv as GarminCore.Files.StdFile_TRE.SubdivInfo).FirstChildSubdivIdx1) + "; " + GarminCore.Coord.MapUnits2Degree(subdiv.HalfHeight).ToString() + "°")); info.AppendLine(FillWithSpace(" calculated ChildSubdivCount", tab, false, (subdiv as GarminCore.Files.StdFile_TRE.SubdivInfo).ChildSubdivInfos.ToString())); } GarminCore.DataBlock block = new GarminCore.DataBlock(); for (int i = 0; i < subdividx; i++) { block.Offset += tre.SubdivInfoList[i] is GarminCore.Files.StdFile_TRE.SubdivInfo ? GarminCore.Files.StdFile_TRE.SubdivInfo.DataLength : GarminCore.Files.StdFile_TRE.SubdivInfoBasic.DataLength; } block.Length = (tre.SubdivInfoList[subdividx]) is GarminCore.Files.StdFile_TRE.SubdivInfo ? GarminCore.Files.StdFile_TRE.SubdivInfo.DataLength : GarminCore.Files.StdFile_TRE.SubdivInfoBasic.DataLength; return(block); }
/// <summary> /// liefert den Datenbereich für den SubdivInfo-Tabelleneintrag (in TRE) /// </summary> /// <param name="idx"></param> /// <returns></returns> public GarminCore.DataBlock GetSubdivInfoBlock(int idx = -1) { if (idx < 0) { idx = subdividx; } GarminCore.DataBlock block = new GarminCore.DataBlock(); for (int i = 0; i < idx; i++) { block.Offset += rgn.TREFile.SubdivInfoList[i] is GarminCore.Files.StdFile_TRE.SubdivInfo ? GarminCore.Files.StdFile_TRE.SubdivInfo.DataLength : GarminCore.Files.StdFile_TRE.SubdivInfoBasic.DataLength; } block.Length = (rgn.TREFile.SubdivInfoList[idx]) is GarminCore.Files.StdFile_TRE.SubdivInfo ? GarminCore.Files.StdFile_TRE.SubdivInfo.DataLength : GarminCore.Files.StdFile_TRE.SubdivInfoBasic.DataLength; return(block); }
/// <summary> /// liefert den Datenbereich in der Datei für einen bestimmten Block /// </summary> /// <param name="tdb"></param> /// <param name="tdbblocktype"></param> /// <param name="count">0 für den 1. Block dieses Typs, 1 für den 2. usw.</param> /// <returns></returns> static GarminCore.DataBlock TDBBlock(GarminCore.Files.File_TDB tdb, GarminCore.Files.File_TDB.BlockHeader.Typ tdbblocktype, int count = 0) { GarminCore.DataBlock block = new GarminCore.DataBlock(); for (int i = 0; i < tdb.BlockHeaderTypList.Count; i++) { block.Offset += 3; // Def. des Blockes if (tdb.BlockHeaderTypList[i] == tdbblocktype) { if (count == 0) { block.Length = (uint)tdb.BlockLength[i]; break; } count--; } block.Offset += (uint)tdb.BlockLength[i]; } return(block); }
/// <summary> /// liefert Pos. und Länge des Entrys /// </summary> /// <param name="mps"></param> /// <param name="idx"></param> /// <returns></returns> static GarminCore.DataBlock MapEntryBlock(GarminCore.Files.File_MPS mps, int idx) { GarminCore.DataBlock block = new GarminCore.DataBlock(); for (int i = 0; i < mps.Maps.Count && i < idx; i++) { GarminCore.Files.File_MPS.MapEntry mapentry = mps.Maps[i]; block.Offset = block.Length; block.Length = 3; // Typ, Länge switch (mapentry.Typ) { case 'L': block.Length += 3 * 2; for (int j = 0; j < mapentry.Name.Count; j++) { block.Length += (uint)(mapentry.Name[j].Length + 1); } block.Length += 2 * 4; break; case 'P': block.Length += 8; break; case 'F': block.Length += 2 * 2; for (int j = 0; j < mapentry.Name.Count; j++) { block.Length += (uint)(mapentry.Name[j].Length + 1); } break; case 'V': for (int j = 0; j < mapentry.Name.Count; j++) { block.Length += (uint)(mapentry.Name[j].Length + 1); } break; } } return(block); }
/// <summary> /// liefert den Datenblock in RGN bzgl. des SubdivContentBlock in RGN für das Objekt /// </summary> /// <param name="contenttype"></param> /// <param name="idx"></param> /// <returns></returns> public GarminCore.DataBlock GetDataBlock4Object(GarminCore.Files.StdFile_TRE.SubdivInfoBasic.SubdivContent contenttype, int idx) { GarminCore.DataBlock block = new GarminCore.DataBlock(); block.Offset = SubdivfInfo.Data.Offset; block.Offset += (uint)GetOffset4ObjectType(contenttype); switch (contenttype) { case GarminCore.Files.StdFile_TRE.SubdivInfoBasic.SubdivContent.poi: for (int i = 0; i < idx; i++) { block.Offset += SubdivData.PointList1[i].DataLength; } block.Length = SubdivData.PointList1[idx].DataLength; break; case GarminCore.Files.StdFile_TRE.SubdivInfoBasic.SubdivContent.idxpoi: for (int i = 0; i < idx; i++) { block.Offset += SubdivData.PointList2[i].DataLength; } block.Length = SubdivData.PointList2[idx].DataLength; break; case GarminCore.Files.StdFile_TRE.SubdivInfoBasic.SubdivContent.line: for (int i = 0; i < idx; i++) { block.Offset += SubdivData.LineList[i].DataLength; } block.Length = SubdivData.LineList[idx].DataLength; break; case GarminCore.Files.StdFile_TRE.SubdivInfoBasic.SubdivContent.area: for (int i = 0; i < idx; i++) { block.Offset += SubdivData.AreaList[i].DataLength; } block.Length = SubdivData.AreaList[idx].DataLength; break; } return(block); }
/// <summary> /// Funktion für alle RGN-Datei-Infos /// </summary> /// <param name="info"></param> /// <param name="hex"></param> /// <param name="firsthexadr"></param> /// <param name="filedata"></param> /// <param name="nodetype"></param> /// <param name="idx"></param> /// <param name="tvd"></param> public static void SectionAndIndex(StringBuilder info, out byte[] hex, out long firsthexadr, NodeContent.Content4File filedata, NodeContent.NodeType nodetype, int idx, TreeViewData tvd) { GarminCore.Files.StdFile_RGN rgn = filedata.GetGarminFileAsRGN(tvd.GetTRE(filedata.Basename)); int hexlen = 0; firsthexadr = 0; hex = null; AllSubdivInfo asi = null; switch (nodetype) { case NodeContent.NodeType.RGN_PostHeaderData: firsthexadr = rgn.PostHeaderDataBlock.Offset; if (idx < 0) { info.AppendLine("PostHeaderDataBlock: " + rgn.PostHeaderDataBlock.ToString()); hexlen = (int)rgn.PostHeaderDataBlock.Length; } break; case NodeContent.NodeType.RGN_SubdivContentBlock: firsthexadr = rgn.SubdivContentBlock.Offset; if (idx < 0) { int tab = 22; info.AppendLine(FillWithSpace("SubdivContent", tab, false, rgn.SubdivList.Count.ToString())); info.AppendLine(FillWithSpace(" Block", tab, false, rgn.SubdivContentBlock.ToString())); hexlen = (int)rgn.SubdivContentBlock.Length; if (hexlen > 0 && rgn.SubdivList.Count == 0) { info.AppendLine("data propably encrypted"); } } else { asi = new AllSubdivInfo(rgn, filedata.BinaryReader, idx); info.AppendLine("Info from TRE:"); DataTRE.SampleInfo4SubdivInfo(info, rgn.TREFile, idx); info.AppendLine(); info.AppendLine("Info from RGN:"); GarminCore.DataBlock block = SampleInfo4SubdivData(info, rgn, asi); firsthexadr += block.Offset; hexlen = (int)block.Length; } break; case NodeContent.NodeType.RGN_ExtAreasBlock: firsthexadr = rgn.ExtAreasBlock.Offset; if (idx < 0) { info.AppendLine("ExtAreas"); info.AppendLine(" Block: " + rgn.ExtAreasBlock.ToString()); hexlen = (int)rgn.ExtAreasBlock.Length; } else { int subdividx = -1; int count = 0; idx &= RGN_IDX_MASK; // Gesamt-Index des ExtArea for (subdividx = 0; subdividx < rgn.SubdivList.Count; subdividx++) { count += rgn.SubdivList[subdividx].ExtAreaList.Count; if (idx < count) { break; } } if (subdividx < rgn.SubdivList.Count) { asi = new AllSubdivInfo(rgn, filedata.BinaryReader, subdividx); int idx2 = asi.SubdivData.ExtAreaList.Count - (count - idx); info.AppendLine("ExtArea " + idx2.ToString() + " from Subdiv " + subdividx.ToString()); ShowExtAreaInfo(info, asi, rgn, tvd, filedata, idx2, 40, out hexlen, out firsthexadr); } } break; case NodeContent.NodeType.RGN_ExtLinesBlock: firsthexadr = rgn.ExtLinesBlock.Offset; if (idx < 0) { info.AppendLine("ExtLines"); info.AppendLine(" Block: " + rgn.ExtLinesBlock.ToString()); hexlen = (int)rgn.ExtLinesBlock.Length; } else { int subdividx = -1; int count = 0; idx &= RGN_IDX_MASK; // Gesamt-Index des ExtArea for (subdividx = 0; subdividx < rgn.SubdivList.Count; subdividx++) { count += rgn.SubdivList[subdividx].ExtLineList.Count; if (idx < count) { break; } } if (subdividx < rgn.SubdivList.Count) { asi = new AllSubdivInfo(rgn, filedata.BinaryReader, subdividx); int idx2 = asi.SubdivData.ExtLineList.Count - (count - idx); info.AppendLine("ExtLine " + idx2.ToString() + " from Subdiv " + subdividx.ToString()); ShowExtLineInfo(info, asi, rgn, tvd, filedata, idx2, 40, out hexlen, out firsthexadr); } } break; case NodeContent.NodeType.RGN_ExtPointsBlock: firsthexadr = rgn.ExtPointsBlock.Offset; if (idx < 0) { info.AppendLine("ExtPoints"); info.AppendLine(" Block: " + rgn.ExtPointsBlock.ToString()); hexlen = (int)rgn.ExtPointsBlock.Length; } else { int subdividx = -1; int count = 0; idx &= RGN_IDX_MASK; // Gesamt-Index des ExtArea for (subdividx = 0; subdividx < rgn.SubdivList.Count; subdividx++) { count += rgn.SubdivList[subdividx].ExtPointList.Count; if (idx < count) { break; } } if (subdividx < rgn.SubdivList.Count) { asi = new AllSubdivInfo(rgn, filedata.BinaryReader, subdividx); int idx2 = asi.SubdivData.ExtPointList.Count - (count - idx); info.AppendLine("ExtPoint " + idx2.ToString() + " from Subdiv " + subdividx.ToString()); ShowExtPointInfo(info, asi, rgn, tvd, filedata, idx2, 40, out hexlen, out firsthexadr); } } break; case NodeContent.NodeType.RGN_UnknownBlock_0x71: firsthexadr = rgn.UnknownBlock_0x71.Offset; if (idx < 0) { info.AppendLine("UnknownBlock 0x71"); info.AppendLine(" Block: " + rgn.UnknownBlock_0x71.ToString()); hexlen = (int)rgn.UnknownBlock_0x71.Length; } break; case NodeContent.NodeType.Index: if (tvd.TreeView.SelectedNode != null) { int subdividx = -1; // etwas tricky ... NodeContent nc = NodeContent4TreeNode(tvd.TreeView.SelectedNode.Parent); switch (nc.Type) { case NodeContent.NodeType.Index: // wenn der übergeordnete Knoten ein Index ist, dann ist es ein Subdiv-Index subdividx = (int)nc.Data; if (subdividx >= 0) { asi = new AllSubdivInfo(rgn, filedata.BinaryReader, subdividx); } break; } } if (asi != null) { if ((idx & RGN_IDX_POINT1) != 0) { idx &= RGN_IDX_MASK; int tab = 40; GarminCore.Files.StdFile_RGN.RawPointData point = asi.GetPoint(idx); GarminCore.Files.StdFile_LBL lbl = tvd.GetLBL(filedata.Basename); info.AppendLine(FillWithSpace("Type (1 Byte)", tab, false, DecimalAndHexAndBinary(point.Type))); info.AppendLine(FillWithSpace("LabelOffsetInLBL (3 Byte) (Bit 0..21)", tab, false, DecimalAndHexAndBinary(point.LabelOffsetInLBL))); if (lbl != null) { info.AppendLine(FillWithSpace(" Text (from LBL)", tab, true, point.GetText(lbl, true))); } info.AppendLine(FillWithSpace("HasSubtype (Bit 23)", tab, false, point.HasSubtype.ToString())); info.AppendLine(FillWithSpace("IsPoiOffset (Bit 22)", tab, false, point.IsPoiOffset.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.HasSubtype) { info.AppendLine(FillWithSpace("Subtype (1 Byte)", tab, false, DecimalAndHexAndBinary(point.Subtype))); } GarminCore.DataBlock block = asi.GetDataBlock4Object(GarminCore.Files.StdFile_TRE.SubdivInfoBasic.SubdivContent.poi, idx); firsthexadr = rgn.SubdivContentBlock.Offset; firsthexadr += block.Offset; hexlen = (int)block.Length; } else if ((idx & RGN_IDX_POINT2) != 0) { idx &= RGN_IDX_MASK; int tab = 40; GarminCore.Files.StdFile_RGN.RawPointData point = asi.GetIdxPoint(idx); GarminCore.Files.StdFile_LBL lbl = tvd.GetLBL(filedata.Basename); info.AppendLine(FillWithSpace("Type (1 Byte)", tab, false, DecimalAndHexAndBinary(point.Type))); info.AppendLine(FillWithSpace("LabelOffsetInLBL (3 Byte) (Bit 0..21)", tab, false, DecimalAndHexAndBinary(point.LabelOffsetInLBL))); if (lbl != null) { info.AppendLine(FillWithSpace(" Text (from LBL)", tab, true, point.GetText(lbl, true))); } info.AppendLine(FillWithSpace("HasSubtype (Bit 23)", tab, false, point.HasSubtype.ToString())); info.AppendLine(FillWithSpace("IsPoiOffset (Bit 22)", tab, false, point.IsPoiOffset.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.HasSubtype) { info.AppendLine(FillWithSpace("Subtype (1 Byte)", tab, false, DecimalAndHexAndBinary(point.Subtype))); } GarminCore.DataBlock block = asi.GetDataBlock4Object(GarminCore.Files.StdFile_TRE.SubdivInfoBasic.SubdivContent.idxpoi, idx); firsthexadr = rgn.SubdivContentBlock.Offset; firsthexadr += block.Offset; hexlen = (int)block.Length; } else if ((idx & RGN_IDX_LINE) != 0) { idx &= RGN_IDX_MASK; int tab = 40; GarminCore.Files.StdFile_RGN.RawPolyData poly = asi.GetLine(idx); GarminCore.Files.StdFile_LBL lbl = tvd.GetLBL(filedata.Basename); GarminCore.Files.StdFile_NET net = tvd.GetNET(filedata.Basename); info.AppendLine(FillWithSpace("Type (1 Byte) (Bit 0..5)", tab, false, DecimalAndHexAndBinary(poly.Type))); info.AppendLine(FillWithSpace("TwoByteLength (Bit 7)", tab, false, poly.TwoByteLength.ToString())); if (!poly.IsPolygon) { info.AppendLine(FillWithSpace("Direction (Bit 6)", tab, false, poly.DirectionIndicator.ToString())); } info.AppendLine(FillWithSpace("LabelOffsetInLBL (3 Byte) (Bit 0..21)", tab, false, DecimalAndHexAndBinary(poly.LabelOffsetInLBL))); if (!poly.LabelInNET) { if (lbl != null) { info.AppendLine(FillWithSpace("Text (from LBL)", tab, true, poly.GetText(lbl, true))); } } else { if (net != null) { GarminCore.Files.StdFile_NET.RoadData rd = net.GetRoadData(poly.LabelOffsetInLBL); if (rd != null) { info.AppendLine(FillWithSpace("Text (from NET, LBL)", tab, true, rd.GetText(lbl, true))); } } } info.AppendLine(FillWithSpace("WithExtraBit (Bit 22)", tab, false, poly.WithExtraBit.ToString())); info.AppendLine(FillWithSpace("LabelInNET (Bit 23)", tab, false, poly.LabelInNET.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("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))); info.AppendLine(FillWithSpace("BitstreamLength (" + (poly.TwoByteLength ? "2" : "1") + " Byte)", tab, false, DecimalAndHexAndBinary(poly.bitstream.Length))); if (poly.WithExtraBit) { info.AppendLine(FillWithSpace("ExtraBitList", tab, false, AllSubdivInfo.ExtraBits(poly))); } 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()); } GarminCore.DataBlock block = asi.GetDataBlock4Object(GarminCore.Files.StdFile_TRE.SubdivInfoBasic.SubdivContent.line, idx); firsthexadr = rgn.SubdivContentBlock.Offset; firsthexadr += block.Offset; hexlen = (int)block.Length; } else if ((idx & RGN_IDX_AREA) != 0) { idx &= RGN_IDX_MASK; int tab = 40; GarminCore.Files.StdFile_RGN.RawPolyData poly = asi.GetArea(idx); GarminCore.Files.StdFile_LBL lbl = tvd.GetLBL(filedata.Basename); GarminCore.Files.StdFile_NET net = tvd.GetNET(filedata.Basename); info.AppendLine(FillWithSpace("Type (1 Byte) (Bit 0..6) ", tab, false, DecimalAndHexAndBinary(poly.Type))); info.AppendLine(FillWithSpace("TwoByteLength (Bit 7)", tab, false, poly.TwoByteLength.ToString())); info.AppendLine(FillWithSpace("LabelOffsetInLBL (3 Byte) (Bit 0..21)", tab, false, DecimalAndHexAndBinary(poly.LabelOffsetInLBL))); if (!poly.LabelInNET) { if (lbl != null) { info.AppendLine(FillWithSpace("Text (from LBL)", tab, true, poly.GetText(lbl, true))); } } else { if (net != null) { GarminCore.Files.StdFile_NET.RoadData rd = net.GetRoadData(poly.LabelOffsetInLBL); if (rd != null) { info.AppendLine(FillWithSpace("Text (from NET, LBL)", tab, true, rd.GetText(lbl, true))); } } } info.AppendLine(FillWithSpace("WithExtraBit (Bit 22)", tab, false, poly.WithExtraBit.ToString())); info.AppendLine(FillWithSpace("LabelInNET (Bit 23)", tab, false, poly.LabelInNET.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("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))); info.AppendLine(FillWithSpace("BitstreamLength (" + (poly.TwoByteLength ? "2" : "1") + " Byte)", tab, false, DecimalAndHexAndBinary(poly.bitstream.Length))); if (poly.WithExtraBit) { info.AppendLine(FillWithSpace("ExtraBitList", tab, false, AllSubdivInfo.ExtraBits(poly))); } 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()); } GarminCore.DataBlock block = asi.GetDataBlock4Object(GarminCore.Files.StdFile_TRE.SubdivInfoBasic.SubdivContent.area, idx); firsthexadr = rgn.SubdivContentBlock.Offset; firsthexadr += block.Offset; hexlen = (int)block.Length; } else if ((idx & RGN_IDX_EXTPOINT) != 0) { ShowExtPointInfo(info, asi, rgn, tvd, filedata, idx & RGN_IDX_MASK, 40, out hexlen, out firsthexadr); } else if ((idx & RGN_IDX_EXTLINE) != 0) { ShowExtLineInfo(info, asi, rgn, tvd, filedata, idx & RGN_IDX_MASK, 40, out hexlen, out firsthexadr); } else if ((idx & RGN_IDX_EXTAREA) != 0) { ShowExtAreaInfo(info, asi, rgn, tvd, filedata, idx & RGN_IDX_MASK, 40, out hexlen, out firsthexadr); } } break; default: info.AppendLine("internal error: no info for nodetype '" + nodetype.ToString() + "'"); break; } if (hexlen > 0) { hex = HexRange(firsthexadr, filedata.BinaryReader, hexlen); } }