Giter Site home page Giter Site logo

geo-format's Introduction

TRUMPF GEO file format

License NPM version

This is a typescript library to read text in TRUMPF GEO file format.

It comes with a plain class model of the GEO file and a persistency layer to read this model from a string.

Additionally, it provides a SVG writer to output the GEO class model into a SVG string.

Installation

npm install @scalenc/geo-format
yarn add @scalenc/geo-format
pnpm add @scalenc/geo-format

Examples

Sample usage to read TRUMPF GEO file

import { GeoReader, SvgWriter } from '@scalenc/geo-format';

const geo =
  '#~1\n1.03\n0\n\n0.000000000 0.000000000 0.000000000\n724.264068712 848.528137424 0.000000000\n294860.320115468\n0\n0.000000000\n0\n1\n##~~\n#~11\n\n\n\n\n\n\n0.000000000\n\n\n\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\n##~~\n#~END\n#~3\n\n\n\n0.000000000 0.000000000 1.000000000\n1.000000000 0.000000000 0.000000000 0.000000000\n0.000000000 1.000000000 0.000000000 0.000000000\n0.000000000 0.000000000 1.000000000 0.000000000\n0.000000000 0.000000000 0.000000000 1.000000000\n0.000000000 0.000000000 0.000000000\n724.264068712 848.528137424 0.000000000\n275.546406035 424.264068712 0.000000000\n294860.320115468\n1\n0\n0\n0\n0\n##~~\n#~30\nIDENT@\n#~TTINFO_END\n#~31\nP\n1\n0.000000000 424.264068712 0.000000000\n|~\nP\n4\n308.036302695 424.264068712 0.000000000\n|~\nP\n3\n424.264068712 424.264068712 0.000000000\n|~\nP\n5\n624.264068712 424.264068712 0.000000000\n|~\nP\n2\n724.264068712 124.264068712 0.000000000\n|~\nP\n6\n724.264068712 724.264068712 0.000000000\n|~\n##~~\n#~33\n\n1 24 0\n0\n0.000000000 0.000000000 1.000000000\n0.000000000 0.000000000 0.000000000\n724.264068712 848.528137424 0.000000000\n275.546406035 424.264068712 0.000000000\n294860.320115468\n0\n##~~\n#~331\nARC\n1 0\n3 1 2\n1\n|~\nARC\n1 0\n5 2 4\n-1\n|~\nARC\n1 0\n5 4 6\n-1\n|~\nARC\n1 0\n3 6 1\n1\n|~\n##~~\n#~KONT_END\n#~END\n#~EOF\n';
const file = GeoReader.read(geo);
const svg = new SvgWriter().toSvg(file);
console.log(svg);

Development

Run yarn to setup project and install all dependencies.

Run yarn test to run all tests.

Run yarn lint to check for linting issues.

Run yarn build to build.

License

All rights reserved to ScaleNC GmbH.

Source Code and Binaries licensed under BSD-3-Clause.

geo-format's People

Contributors

daniel-scalenc avatar stephan-scalenc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.