Coder Social home page Coder Social logo

bauhausluftfahrt / java-cpacs-parser Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 2.32 MB

Read and write CPACS files. Create an object structure out of CPACS and develop faster.

License: GNU General Public License v3.0

Java 100.00%
cpacs xml xsd-schema aircraft-design eclipse emf eclipse-modeling java xml-parser

java-cpacs-parser's Introduction

JAVA CPACS Parser

Read and write CPACS files. Create an object structure out of CPACS and develop faster. Created by Bauhaus Luftfahrt.

What is CPACS?

Common Parametric Aircraft Configuration Schema (CPACS) is an open-source data exchange format for aircraft design. It supports all aspects of an aircraft and enables a swift and easy interdisciplinary file transfer. CPACS is developed by DLR. For more information, see CPACS on GitHub or the official website www.cpacs.de.

Description

This tool enables the CPACS file format to be used natively within Java. The CPACS structure has been transformed into an EMF ecore model which can be used to build with CPACS natively. It supports auto-completion without the need to use specific strings to access CPACS paths within the xml structure. Additionally, use the built-in functions to read CPACS files and turn them into JAVA objects and save CPACS objects back to an xml file. Currently, CPACS version 3.4 is implemented here.

Usage

  • Download the latest Eclipse Modelling Tools version from www.eclipse.org and install it.
  • Make sure to have at least Java JDK 8 installed.
  • Checkout this repository, import the projects and you are ready to go.
  • You can find a demo use case below and under the functions plugin at the Demo.java file.

Example

  1. You can use the following code to import a CPACS file:
// Import 
File inputFile = new File("C:/cpacs.xml");

// Load the CPACS file
CpacsType cpacs = CPACSInitializer.run(inputFile);
  1. Then, access the CPACS object with functions from the model extensions plugin doing the following:
// Set the string object at the desired location.
String cpacsFileTitle = "Demo CPACS created with Java CPACS parser by Bauhaus Luftfahrt";
cpacs.setHeader(HeaderExtensions.init(cpacsFileTitle, "1.0");
  1. Lastly, save the CPACS object back to xml:
String exportPath = "C:/cpacs_new.xml";
CPACSWriter.run(exportPath, cpacs);
  1. The output will look like this:
<?xml version="1.0" encoding="UTF-8"?>
<cpacs>
    <header>
        <name>Demo CPACS created with Java CPACS parser by Bauhaus Luftfahrt</name>
        <version>1.0</version>
        <versionInfos>
            <versionInfo version="1.0">
                <cpacsVersion>3.4</cpacsVersion>
                <description>Demo CPACS created with Java CPACS parser by Bauhaus Luftfahrt</description>
                <timestamp>2023-04-05T10:10:41.196</timestamp>
                <creator>Marc Engelmann</creator>
            </versionInfo>
        </versionInfos>
    </header>
</cpacs>

About

Copyright (c) 2021 Bauhaus Luftfahrt e.V.. All rights reserved. This program and the accompanying materials are made available under the terms of the GNU General Public License v3.0 which accompanies this distribution, and is available at https://www.gnu.org/licenses/gpl-3.0.html.en. All rights reserved.

About CPACS

Copyright (c) 2018 Deutsches Zentrum für Luft- und Raumfahrt e.V., Institute of System Architectures in Aeronautics, www.cpacs.de.

java-cpacs-parser's People

Contributors

marcengelmann avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

java-cpacs-parser's Issues

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.