binary

package
v0.0.0-...-5bd9e96 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader handles parsing of binary TYP files

func NewReader

func NewReader(r io.ReaderAt, size int64) *Reader

NewReader creates a new binary TYP reader

func (*Reader) Parse

func (r *Reader) Parse() (*model.TYPFile, error)

Parse reads the entire TYP file and returns the internal model

func (*Reader) ReadHeader

func (r *Reader) ReadHeader() (*model.Header, error)

ReadHeader reads and parses the TYP file header Format based on QMapShack implementation

func (*Reader) ReadLineTypes

func (r *Reader) ReadLineTypes(section SectionInfo) ([]model.LineType, error)

ReadLineTypes reads all line type definitions using the index array

func (*Reader) ReadPointTypes

func (r *Reader) ReadPointTypes(section SectionInfo) ([]model.PointType, error)

ReadPointTypes reads all point type definitions using the index array

func (*Reader) ReadPolygonTypes

func (r *Reader) ReadPolygonTypes(section SectionInfo) ([]model.PolygonType, error)

ReadPolygonTypes reads all polygon type definitions using the index array

func (*Reader) ReadSectionDirectory

func (r *Reader) ReadSectionDirectory(offset int64) ([]Section, error)

ReadSectionDirectory reads the section directory table of contents

type Section

type Section struct {
	Type   byte   // Section type (1=points, 2=lines, 3=polygons, etc.)
	Offset uint32 // Offset from file start
	Length uint32 // Section length in bytes
}

Section represents a section in the TYP file

type SectionInfo

type SectionInfo struct {
	DataOffset  uint32 // Offset to data section
	DataLength  uint32 // Length of data section
	ArrayOffset uint32 // Offset to index array
	ArrayModulo uint16 // Size of each array entry (3, 4, or 5 bytes)
	ArraySize   uint32 // Total size of array in bytes
}

SectionInfo contains metadata for a TYP section (points, lines, polygons)

type TYPHeader

type TYPHeader struct {
	Descriptor uint16 // First field, often equals header length
	Version    uint16
	Year       uint16
	Month      uint8
	Day        uint8
	Hour       uint8
	Minutes    uint8
	Seconds    uint8
	CodePage   uint16
	PID        uint16 // Product ID
	FID        uint16 // Family ID

	// Section information
	Points    SectionInfo
	Polylines SectionInfo
	Polygons  SectionInfo
	Order     SectionInfo
}

TYPHeader represents the parsed header with section pointers

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer handles writing TYP files to binary format

func NewWriter

func NewWriter(w io.Writer) *Writer

NewWriter creates a new binary TYP writer

func (*Writer) Write

func (w *Writer) Write(typ *model.TYPFile) error

Write writes a complete TYP file to binary format

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL