seeyou-cupx

Crates.ioseeyou-cupx
lib.rsseeyou-cupx
version0.1.0
created_at2025-10-05 10:13:22.173987+00
updated_at2025-10-06 10:01:03.336683+00
descriptionA Rust library for parsing and writing SeeYou CUPX files, commonly used in aviation and gliding for waypoints with attached pictures
homepage
repositoryhttps://github.com/Turbo87/seeyou-cupx-rs
max_upload_size
id1868863
size61,048
Tobias Bieniek (Turbo87)

documentation

README

seeyou-cupx

A Rust library for parsing and writing SeeYou CUPX files, commonly used in aviation and gliding for waypoints with attached pictures.

CUPX files consist of two concatenated ZIP archives: a "pics" archive containing images and a "points" archive containing a POINTS.CUP file with waypoint and task data. For more details, see the official CUPX file format specification.

Installation

Add this to your Cargo.toml:

[dependencies]
seeyou-cupx = "0.1.0"

Usage

Reading CUPX files

use seeyou_cupx::CupxFile;
use std::io::Read;

let (mut cupx, warnings) = CupxFile::from_path("waypoints.cupx")?;

// Access waypoint data
for waypoint in cupx.waypoints() {
    println!("{}: {}, {}", waypoint.name, waypoint.latitude, waypoint.longitude);
}

// Access pictures
for pic_name in cupx.picture_names() {
    println!("Picture: {}", pic_name);
}

// Read a specific picture
let mut reader = cupx.read_picture("airport.jpg")?;
let mut buffer = Vec::new();
reader.read_to_end(&mut buffer)?;

# Ok::<(), seeyou_cupx::Error>(())

Writing CUPX files

use seeyou_cupx::cup::CupFile;
use seeyou_cupx::CupxWriter;
use std::path::Path;

CupxWriter::new(CupFile::default())
    .add_picture("airport.jpg", Path::new("images/airport.jpg"))
    .add_picture("runway.jpg", Path::new("images/runway.jpg"))
    .write_to_path("output.cupx")?;

# Ok::<(), seeyou_cupx::Error>(())

Encoding Support

By default, the library automatically detects the text encoding of CUP files. If you know the encoding beforehand:

use seeyou_cupx::cup::Encoding;
use seeyou_cupx::CupxFile;

let (cupx, warnings) = CupxFile::from_path_with_encoding("waypoints.cupx", Encoding::Utf8)?;

# Ok::<(), seeyou_cupx::Error>(())

Dependencies

This library uses seeyou-cup for parsing and writing the underlying CUP file format.

License

Licensed under either of:

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dually licensed as above, without any additional terms or conditions.

Commit count: 0

cargo fmt