Sphinx docs WIP

This commit is contained in:
SiboVG 2024-05-10 05:50:55 +02:00
parent df396228aa
commit 549f3e1cb3
17 changed files with 822 additions and 52 deletions

@ -1 +1 @@
Subproject commit 93054dc2b40d5196433b1d91c636cee2e9dda424
Subproject commit 48eb2172d58c0db6042bd847a782835df056b287

View File

@ -64,4 +64,12 @@ html_context = {
html_css_files = [
'custom.css',
]
]
# -- Substitutions -----------------------------------------------------------
rst_prolog = """
.. |java_vers| replace:: 17
.. |br_no_pad| raw:: html
<div style="line-height: 0; padding: 0; margin: 0"></div>
"""

View File

@ -2,3 +2,92 @@
OpenRocket Architecture
=======================
This section describes the high-level architecture of OpenRocket, the important modules and their interactions, and the technology stack.
It is intended for developers who want to understand the structure of the code and how it works.
.. contents:: Table of Contents
:depth: 2
:local:
----
Introduction
------------
OpenRocket is a Java application that runs on the desktop. It is built using the Swing GUI toolkit. The choice of Java
was originally made because it is a platform-independent language, making it possible to run OpenRocket on Windows, macOS, and Linux.
While the popularity of Java has waned in recent years, it is still a good choice for desktop applications because of its
mature libraries and tools. Additionally, rewriting OpenRocket in another language would be a massive undertaking that is
not currently feasible given the size of the developer team. Of course, any suggestions and help in this area are welcome.
OpenRocket is released under the GNU General Public License (GPL) version 3.0. This means that the source code is open and
available for anyone to use, modify, and distribute. The only major restriction is that any derivative works must also be
released under the GNU GPL. This ensures that the code remains open and free for everyone. So, no one can take the code and
sell it as a proprietary product.
Java Platform Module System (JPMS)
--------------------------------------
OpenRocket leverages the **Java Platform Module System** (**JPMS**) to enhance modularity, encapsulation, and maintainability.
JPMS allows OpenRocket to be organized into two distinct modules, the ``core`` module and the ``swing`` module,
each with its own well-defined boundaries and dependencies.
Each module in OpenRocket is described by a `module-info.java` file located at the root of the module's source directory
(*<module>/src/main/java.module-info.java*). This file declares:
* **Module Name:** A unique identifier for the module (e.g., `info.openrocket.core`, `info.openrocket.swing`).
* **Dependencies:** The modules that this module depends on to function correctly. For example, the `info.openrocket.swing` module depends on the `info.openrocket.core` module.
* **Exported Packages:** The packages within the module that are accessible to other modules.
* **Services:** The services provided or consumed by the module (if applicable).
By embracing JPMS, OpenRocket gains several advantages:
* **Strong Encapsulation:** Modules explicitly control what packages are exposed, preventing accidental access to internal implementation details.
* **Reliable Configuration:** The module system verifies dependencies at compile time and runtime, reducing the risk of missing or incompatible components.
* **Improved Maintainability:** Modules can be developed and tested independently, making it easier to understand, modify, and evolve the codebase.
* **Scalability:** The modular structure facilitates the addition of new features or the replacement of existing components without impacting the entire application.
Core Module
-----------
The ``core`` module contains the core functionality of OpenRocket, such as the rocket simulation engine, the file format
parsers and writers, and the rocket design classes. This module is intended to be reusable and can be used in other
applications that need rocket simulation capabilities.
Swing Module
------------
The ``swing`` module contains the user interface of OpenRocket. It is built using the Swing GUI toolkit and provides a graphical
interface for designing rockets, running simulations, and viewing the results. This module depends on the core module
and uses its functionality to perform the simulations and display the results.
Rocket Components
-----------------
Aerodynamic Calculators and Simulators
--------------------------------------
Simulation Listeners
--------------------
Component Database
------------------
Thrust Curves
-------------
Scripts
-------
Plugins
-------
File Format
-----------

View File

@ -2,3 +2,284 @@
Building and Releasing
======================
This guide explains the build system of OpenRocket (Gradle), and how to release a new version of OpenRocket.
.. contents:: Table of Contents
:depth: 2
:local:
----
Gradle
------
`Gradle <http://www.gradle.org/>`__ is the build system for OpenRocket. It is used to compile the source code, run tests, and create the JAR file.
Key features of Gradle are:
- **Incremental builds**: Gradle only rebuilds what is necessary, which makes the build process faster.
- **Dependency management**: Gradle has a robust dependency management system capable of handling project and third-party libraries.
- **Performance**: Gradle uses techniques like build caching and parallel execution to improve performance of the build process.
The root directory of the OpenRocket repository contains several Gradle files:
- ``build.gradle``: This is the main build script file where you define your project configuration and tasks such as compile and run tasks, dependency management, plugins usage, and more.
- ``settings.gradle``: Used for multi-project build configurations to include which sub-projects should be part of the build.
For OpenRocket, this file is used to identify the ``core`` and ``swing`` sub-projects.
- ``gradle.properties``: Contains project-wide properties that can be accessed from the build script. For example, the version number of OpenRocket can be defined here.
- ``gradlew`` and ``gradlew.bat``: These are Gradle Wrapper scripts for Unix-based and Windows systems respectively.
It allows users to run Gradle builds without requiring Gradle to be installed on the system.
The ``core`` and ``swing`` sub-projects contain their own ``build.gradle`` and ``gradle.properties`` files that define the tasks specific to those sub-projects.
Gradle in IntelliJ
~~~~~~~~~~~~~~~~~~
If you use IntelliJ IDEA, you can access the Gradle tasks within the IDE. First, open the Gradle tool window by going to
*View -> Tool Windows -> Gradle* or by clicking on the Gradle icon in the right-hand side of the window:
.. figure:: /img/dev_guide/gradle_in_intellij.png
:align: center
:width: 80%
:alt: Opening the Gradle tool window in IntelliJ IDEA.
Opening the Gradle tool window in IntelliJ IDEA.
This shows the following window:
.. figure:: /img/dev_guide/intellij_gradle_window.png
:align: center
:width: 30%
:alt: The Gradle tool window in IntelliJ IDEA.
The Gradle tool window in IntelliJ IDEA.
Here's a breakdown of the Gradle tasks:
- *info.openrocket*: the root project
- *Tasks*: Gradle tasks specific to the root project.
- *application*: Contains tasks related to running or debugging your application from within the IDE.
- *build*: Includes tasks for building the entire project.
- *build setup*: Tasks for initializing a new Gradle build, such as creating new Gradle files.
- *distribution*: Tasks for assembling the application distribution, like creating zips or tarballs of the build outputs.
- *documentation*: Tasks for generating documentation, typically using tools like Javadoc.
- *help*: Provides tasks that list other tasks or project properties.
- *info.openrocket*: Custom tasks specific to the 'info.openrocket' module.
- *other*: Any other tasks that do not fit into the predefined categories.
- *shadow*: Related to the Shadow plugin, which packages the projects artifacts along with its dependencies into a single "fat" JAR.
- *verification*: Tasks for testing and verifying the project, such as running unit tests.
- *Dependencies*: Lists the dependencies of the project.
- *Run Configurations*: Gradle run configurations that can be used in IntelliJ.
- *core*: the core module
- *Tasks*: Gradle tasks specific to the 'core' module.
- *Dependencies*: Lists the dependencies of the 'core' module.
- *swing*: the swing module
- *Tasks*: Gradle tasks specific to the 'swing' module.
- *Dependencies*: Lists the dependencies of the 'swing' module.
Most Important Gradle Tasks
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here are some of the most important Gradle tasks for OpenRocket:
.. list-table:: Most Important Gradle Tasks
:widths: 25 25 50
:header-rows: 1
* - Module
- Task
- Description
* - root (*info.openrocket*)
- ``clean``
- Deletes the build directory and all its contents (basically cleans up the project).
* - root (*info.openrocket*)
- ``run``
- Runs the OpenRocket application.
* - root (*info.openrocket*)
- ``check``
- Runs the unit tests and checks the code quality using the Checkstyle static analysis tool.
* - root (*info.openrocket*)
- ``build``
- Compiles the source code, runs the unit tests, and creates the JAR file for the *core* and *swing* module.
* - root (*info.openrocket*)
- ``dist``
- Creates a distributable JAR file of OpenRocket (a combination of the *core* and *swing* JAR) at ``openrocket/build/libs/OpenRocket-<build-version>.jar``.
* - core
- ``serializeEngines``
- Fetch the latest thrust curves from ThrustCurve.org and serialize them to the OpenRocket format. The resulting serialized file is saved in the ``src`` dir so it can be used for a build.
* - core
- ``serializeEnginesDist``
- Same as ``serializeEngines``, but loads the serialized file to the distribution directory (*openrocket/build*) so it can be used in the final build.
* - core
- ``submoduleUpdate``
- Updates the submodule dependencies of the *core* module.
You can run these tasks from the command line using the Gradle Wrapper scripts. For example for the task ``run``, run the
following command in the root directory of the OpenRocket repository:
.. code-block:: bash
# On macOS and Linux:
./gradlew run
# On Windows:
gradlew.bat run
install4j
---------
`install4j <http://www.ej-technologies.com/products/install4j/overview.html>`__ is used to create the packaged installers for OpenRocket from the JAR file.
install4j generously provides a free license for open source projects, including OpenRocket. Currently, only the OpenRocket administrators have access
to the install4j license.
Code Signing
~~~~~~~~~~~~
An important part of generating the installers is `code signing <https://en.wikipedia.org/wiki/Code_signing>`__.
This is done to ensure that the installer is not tampered with between the time it is created and the time it is run by the user.
Once the OpenRocket installer has been code signed, users will receive no more (or the minimum amount of) warnings from
their operating system that the installer is from an unknown source and may contain malware.
More information on how to do code signing in install4j can be found `here <https://www.ej-technologies.com/resources/install4j/help/doc/concepts/codeSigning.html>`__.
Only the OpenRocket administrators have access to the code signing certificates.
Code signing for Windows is done using a digital certificate from Sectigo. More information on the code signing procedure,
including whitelisting OpenRocket by Microsoft, see the `README file on GitHub <https://github.com/openrocket/openrocket/blob/unstable/install4j/README.md>`__.
For macOS, the code signing is done using an Apple Developer ID. Besides code signing, the OpenRocket app also needs to
be notarized. Luckily, install4j takes care of this. More information on the code signing procedure for macOS can be found in the
`README file on GitHub <https://github.com/openrocket/openrocket/blob/unstable/install4j/README.md>`__.
Linux does not require code signing.
Creating the Installers
~~~~~~~~~~~~~~~~~~~~~~~
First you need to build the project using Gradle (see above). This will create the JAR file that will be used to create the installers.
Then, open install4j (requires a license) and load the project file *openrocket/install4j/<build-version>/openrocket-<build-version>.install4j*
from the repository. Go to the ``Build`` tab and click on the ``Start Build`` button. This will create the installers in
the *openrocket/install4j/<build-version>/media/* directory.
.. figure:: /img/dev_guide/install4j_build.png
:align: center
:width: 80%
:alt: Building the installers in install4j.
Building the installers in install4j.
If you do not have access to the code signing certificates, you can create the installers without code signing by
enabling the checkboxes ``Disable code signing`` and ``Disable notarization`` in the ``Build`` tab.
Release Procedure
-----------------
The release procedure for OpenRocket is as follows:
1. Update the `ReleaseNotes.md <https://github.com/openrocket/openrocket/blob/unstable/ReleaseNotes.md>`__ with the changes that are part of the new release.
This includes new features, bug fixes, and other changes that are part of the release. Make sure to include the version number and the release date.
Take a look at the previous release notes to see how it should be formatted.
2. **Update the version number** in ``openrocket/core/src/main/resources/build.properties`` to the correct version number.
For official releases, the version number should use the format ``YY.MM`` (*year.month*). For example, if the software is released in
September 2023, the version number should be ``23.09``. If there are multiple releases in the same month, add an incremental number
to the version number, e.g. ``23.09.01``.
If a new release contains significant changes, it may be necessary to release alpha or beta versions first. In that case, the version
number should be appended with ``.alpha.`` or ``.beta.`` plus an incremental number. For example, if the software is in beta stage
in September 2023, the version number should be ``23.09.beta.01``. In general, alpha releases are not necessary. This is only for very rough releases.
Beta releases are only necessary if there are significant changes that need to be tested by the community before the final release.
One final option is to release a release candidate (RC) version. This is a version that is considered to be the final version,
but needs to be tested by the community before the final release. The version number should be appended with ``.RC.`` plus an incremental number.
For example, if the software is in RC stage in September 2023, the version number should be ``23.09.RC.01``.
The official release that comes after the beta release should have the same version number as the beta release, but without the ``.beta.`` part.
For instance, if the beta testing started in September 2023 with version number ``23.09.beta.01``, the final release should have version number ``23.09``,
even if the final release is in November 2023. This is to ensure consistency in the version numbering and to link the beta release(s) to the final release.
3. **Build the project JAR file** using Gradle (see above).
4. **Test the JAR file** to ensure that it works correctly and that the new version number is applied to the splash screen and under *Help -> About*.
5. **Create the packaged installers** using install4j (see above).
.. warning::
Make sure to **enable code signing** for the installers.
Make sure that `DS_Store <https://github.com/openrocket/openrocket/blob/unstable/install4j/23.09/macOS_resources/DS_Store>`__ for the macOS
installer is updated. Instructions can be found `here <https://github.com/openrocket/openrocket/blob/unstable/install4j/README.md>`__.
6. **Test the installers** to ensure that they work correctly.
7. **Prepare the website** *(for official releases only, not for alpha, beta, or release candidate releases)*.
The `source code for the website <https://github.com/openrocket/openrocket.github.io>`__ needs to be updated to point to the new release.
Follow these steps:
- Add the release to `downloads_config.json <https://github.com/openrocket/openrocket.github.io/blob/development/assets/downloads_config.json>`__.
- Update the ``current_version`` in `_config <https://github.com/openrocket/openrocket.github.io/blob/development/_config.yml>`__.
- Add a new entry to `_whats_new <https://github.com/openrocket/openrocket.github.io/tree/development/_whats-new>`__ for the new release.
Create a ``wn-<version number>.md`` file with the changes that are part of the new release. Please take a close look to the previous entries to see how it should be formatted.
- Update the `release notes <https://github.com/openrocket/openrocket.github.io/blob/development/_includes/ReleaseNotes.md>`__
(which is a link to the What's new file that you just created). Again, take a close look at the previous entries to see how it should be formatted.
.. warning::
Make sure to **update the website on the** ``development`` **branch**. The ``master`` branch is the branch that is live
on the website. First update the ``development`` branch and test the changes on the website. In a later step, the
changes will be merged to the ``master`` branch.
8. **Publish the release on GitHub**.
Go to the `releases page <https://github.com/openrocket/openrocket/releases>`__. Click *Draft a new release*.
Select *Choose a tag* and enter a new tag name, following the format ``release-<version number>``, e.g. ``release-23.09``.
The title should follow the format ``OpenRocket <version number> (<release date as YYYY-MM-DD>)``, e.g. ``OpenRocket 23.09 (2023-11-16)``.
Fill in the release text, following the `ReleaseNotes.md <https://github.com/openrocket/openrocket/blob/unstable/ReleaseNotes.md>`__.
If you want to credit the developers who contributed to the release, you can tag them anywhere in the release text using the `@username` syntax.
They will then be automatically displayed in the contributors list on the release page.
Finally, upload all the packaged installers and the JAR file to the release. The source code (zip and tar.gz) is
automatically appended to each release, you do not need to upload it manually.
If this is an alpha, beta, or release candidate release, tick the *Set as a pre-release* checkbox.
Click *Publish release*.
9. **Push the changes to the website**
First, build the ``development`` branch locally to verify that the changes that you made in step 7 are correct.
If everything is working (test the download links, the release notes, and the What's new page), create a new PR
that merges the changes from the ``development`` branch to the ``master`` branch.
10. **Send out the release announcement**.
Send out the release announcement to the OpenRocket mailing list, the TRF forum, and the OpenRocket social media channels
(Discord, Facebook...).
The announcement should include the new features, bug fixes, and other changes that are part of the new release.
Make sure to include the download links to the new release. Here is an `example announcement <https://www.rocketryforum.com/threads/announcement-openrocket-23-09-is-now-available-for-download.183186/>`__.
11. **Merge the** ``unstable``` **branch to the** ``master``` **branch**.
After the release is published, merge the changes from the `unstable <https://github.com/openrocket/openrocket>`__ branch
to the `master <https://github.com/openrocket/openrocket/tree/master>`__ branch.
12. **Upload the new release to** `SourceForge <https://sourceforge.net/projects/openrocket/>`__.
The downloads page on SourceForge is still very actively used, so be sure to upload the new release there as well.
13. **Update package managers** (e.g. snap, Chocolatey, Homebrew) with the new release.

View File

@ -2,12 +2,175 @@
Codebase Walkthrough
====================
Repository Structure
--------------------
Important Modules and Packages
------------------------------
Explanation of the Build System
-------------------------------
Root Directory Structure
------------------------
Module Folder Structure
-----------------------
OpenRocket uses the Gradle build system, where each modules (``info.openrocket.core`` and ``info.openrocket.swing``) adheres to the following folder structure:
.. code-block:: none
├── gradle # Gradle Wrapper
├── libs # (optional) Library JAR files that cannot be obtained from the gradle dependency system
├── resources-src # Source files for the resources in the src dir (e.g. InkScape project file for the splash screen)
├── scripts # Utility scripts
├── src # Source code and resources
│ ├── main # Application source code and resources
│ │ ├── java # Java source code
│ │ ├── resources # Resource files (e.g. images, configuration files, data files)
│ ├── test # Test source code and resources
│ │ ├── java # Java test source code
│ │ ├── resources # Resource files for testing
├── src-extra # Extra source code, not part of the main application (e.g. template code for an OpenRocket plugin)
Core Module
~~~~~~~~~~~
The following is an overview of the packages in the ``info.openrocket.core`` module (*openrocket/core/src/main/java/info/openrocket/core*):
.. code-block:: none
├── aerodynamics # Calculation of aerodynamic properties (e.g. drag)
│ └── barrowman # Barrowman method for calculating coefficient of drag (CD)
├── appearance # Appearance of components (e.g. color, texture)
│ └── defaults # Default appearance settings
├── arch # Get info on the system architecture (macOS, Windows, Linux)
├── communication # Communication with external sites/programs (e.g. retrieve the latest version of OpenRocket from GitHub)
├── database # Database handling (component database, motor database)
│ └── motor # Thrust curve database
├── document # OpenRocket document and simulation handling
│ ├── attachments # Attachments to OpenRocket documents
│ └── events # OpenRocket events (e.g. document changed, simulation changed)
├── file # File handling
│ ├── configuration
│ ├── iterator # Iterate files in e.g. a directory or a zip file
│ ├── motor # Motor files handling
│ ├── openrocket # OpenRocket file handling
│ │ ├── importt # Import OpenRocket files
│ │ └── savers # Save OpenRocket files
│ ├── rasaero # RASAero II file handling
│ │ ├── export # Export OpenRocket files to RASAero II
│ │ └── importt # Import RASAero II files to OpenRocket
│ ├── rocksim # RockSim file handling
│ │ ├── export # Export OpenRocket files to RockSim
│ │ └── importt # Import RockSim files to OpenRocket
│ ├── simplesax # XML file handling
│ ├── svg # SVG file handling
│ │ └── export # SVG export
│ └── wavefrontobj # Wavefront OBJ file handling
│ └── export # Export OpenRocket components to Wavefront OBJ
│ ├── components # Export OpenRocket components
│ └── shapes # Export general geometry shapes
├── formatting # Formatting of e.g. motor config names
├── gui
│ └── util
├── l10n # Translation of OpenRocket
├── logging # Logging and message handling (e.g. error and warning messages)
├── masscalc # Calculation of mass properties (weight and center of gravity)
├── material # Material properties (physical properties of materials)
├── models # Physical models (e.g. atmosphere, gravity, wind)
│ ├── atmosphere # Atmosphere models
│ ├── gravity # Gravity models
│ └── wind # Wind models
├── motor
├── optimization # Optimization algorithms
│ ├── general
│ │ ├── multidim
│ │ └── onedim
│ ├── rocketoptimization
│ │ ├── domains
│ │ ├── goals
│ │ ├── modifiers
│ │ └── parameters
│ └── services
├── plugin
├── preset
│ ├── loader
│ └── xml
├── rocketcomponent # Rocket components (e.g. fins, nose cone, tube)
│ └── position # Position of rocket components
├── rocketvisitors
├── scripting
├── simulation
│ ├── customexpression
│ ├── exception
│ ├── extension
│ │ ├── example
│ │ └── impl
│ └── listeners
│ ├── example
│ └── system
├── startup
├── thrustcurve
├── unit
├── util
│ └── enums
└── utils
Swing Module
~~~~~~~~~~~~
The following is an overview of the packages in the ``info.openrocket.swing`` module (*openrocket/swing/src/main/java/info/openrocket/swing*):
.. code-block:: none
├── communication
├── file
│ ├── motor
│ ├── photo
│ └── wavefrontobj
├── gui
│ ├── adaptors
│ ├── components
│ │ └── compass
│ ├── configdialog
│ ├── customexpression
│ ├── dialogs
│ │ ├── flightconfiguration
│ │ ├── motor
│ │ │ └── thrustcurve
│ │ ├── optimization
│ │ ├── preferences
│ │ └── preset
│ ├── figure3d
│ │ ├── geometry
│ │ └── photo
│ │ ├── exhaust
│ │ └── sky
│ │ └── builtin
│ ├── figureelements
│ ├── help
│ │ └── tours
│ ├── main
│ │ ├── componenttree
│ │ └── flightconfigpanel
│ ├── plot
│ ├── preset
│ ├── print
│ │ ├── components
│ │ └── visitor
│ ├── rocketfigure
│ ├── scalefigure
│ ├── simulation
│ ├── theme
│ ├── util
│ ├── watcher
│ └── widgets
├── logging
├── simulation
│ └── extension
│ ├── example
│ └── impl
├── startup
│ ├── jij
│ └── providers
└── utils

View File

@ -0,0 +1,22 @@
=================================
Contributing to the Documentation
=================================
This documentation is generated using `Sphinx <https://www.sphinx-doc.org/en/master/>`__. If you would like to contribute
to the documentation, you can do so by editing the reStructuredText files in the ``docs/source`` directory of the OpenRocket repo.
You can then build the documentation by first `installing Sphinx <https://www.sphinx-doc.org/en/master/usage/installation.html>`__
and then running the following command from the ``docs`` directory:
.. code-block:: bash
make html
This will generate the documentation in the ``docs/build/html`` directory. You can then view the documentation by opening the
``index.html`` file in your web browser.
If you would like to contribute to the documentation, please submit a pull request with your changes. If you are not sure how to
do this, please see the ``Obtaining the Source Code`` section in :doc:`Development Environment Setup </dev_guide/development_setup>`.
Also check out the `GitHub documentation <https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request>`__
on how to submit a pull request. If you don't want to go through the hassle of setting up a development environment, you can also
`submit an issue <https://github.com/openrocket/openrocket/issues/new/choose>`__ with your proposed changes and we will take care of the rest,
or you can `contact us <https://openrocket.info/contact.html>`__.

View File

@ -0,0 +1,107 @@
============================
Contributing to Translations
============================
OpenRocket is translated into multiple languages. If you want to help with translations, this document will guide you through the process.
.. contents:: Table of Contents
:depth: 2
:local:
----
..
TODO: reference a doc in user_guide for changing the language
..
TODO: add current state of translations?
How Translations Work
---------------------
OpenRocket's GUI elements do not (*should not*) display hard-coded text. Instead, they use a `Translator <https://github.com/openrocket/openrocket/blob/unstable/core/src/main/java/info/openrocket/core/l10n/Translator.java>`__
object with a certain key to look up the text to display. The Translator object is responsible for looking up the text
in the appropriate language file and returning the translated text.
The language files are located in the ``core/src/main/resources/l10n`` directory. The base file for all translations is
``messages.properties``, which contains the English text. Each language has its own file, named ``messages_xx.properties``,
where ``xx`` is the language code (e.g. ``messages_nl.properties`` for Dutch). The l10n files are a simple key-value pair
where the key is the text to be translated and the value is the translated text. For example, this is a snippet from the
``messages.properties`` file:
.. code-block:: properties
! RocketPanel
RocketPanel.lbl.ViewType = View Type:
RocketPanel.lbl.Zoom = Zoom:
RocketPanel.lbl.Stability = Stability:
Comments start with a ``!`` and are ignored. The key is the text to be translated, and the value is the translated text.
The key should be unique within the file and should start with the name of the class that uses the text, followed by the type
of widget that uses the text, followed by a representation of the text. For example, the key ``RocketPanel.lbl.ViewType``
is used by the ``RocketPanel`` class in a label widget to display the text "View Type:". The value for this key is "View Type:".
Other language files use the exact same keys as the ``messages.properties`` base file, but with the translated text as the value.
For example, this is a snippet from the ``messages_nl.properties`` file:
.. code-block:: properties
! RocketPanel
RocketPanel.lbl.ViewType = Weergavetype:
RocketPanel.lbl.Zoom = Zoom:
RocketPanel.lbl.Stability = Stabiliteit:
When you now create a widget in the GUI, you should use the Translator object to get the translated text. For example, to
create a label widget with the text "View Type:", you would use the following code:
.. code-block:: java
private static final Translator trans = Application.getTranslator();
JLabel label = new JLabel(trans.get("RocketPanel.lbl.ViewType"));
When the GUI is displayed, the Translator object will look up the key ``RocketPanel.lbl.ViewType`` in the appropriate language
file and return the translated text. If the key is not found in the language file, the Translator object will return the English.
This way, the GUI can be easily translated into different languages by simply adding a new language file with the translated text.
Modifying an Existing Translation
---------------------------------
Open the l10n file for the language you want to modify in the ``core/src/main/resources/l10n`` directory. For example, to modify
the French translation, open the ``messages_fr.properties`` file, since ``fr`` corresponds to the language code of French.
Find the key for the text you want to modify and change the value.
When you are done, create a pull request with your changes. The maintainers will review your changes and merge them if they are
appropriate.
Creating a New Translation
--------------------------
If you want to create a new translation for a language that is not yet supported, you can create a new language file in the
``core/src/main/resources/l10n`` directory. The file should be named ``messages_xx.properties``, where ``xx`` is the language code
of the language you want to translate to. For example, to create a translation for Finnish, you would create a file named
``messages_fi.properties``.
Copy the contents of the ``messages.properties`` file into the new file. Translate the English text into the new language and
save the file.
Edit the ``swing/src/main/java/info/openrocket/swing/gui/util/SwingPreferences.java`` file and add the new language to the
``SUPPORTED_LOCALES`` array. For example, to add Finnish, you would change this line:
.. code-block:: java
for (String lang : new String[] { "en", "ar", "de", "es", "fr", "it", "nl", "ru", "cs", "pl", "ja", "pt", "tr" }) {
To this (notice the addition of ``"fi"`` at the end)
.. code-block:: java
for (String lang : new String[] { "en", "ar", "de", "es", "fr", "it", "nl", "ru", "cs", "pl", "ja", "pt", "tr", "fi" }) {
Finally, add yourself to the list of translation contributors (you deserve some fame! 🙂). This is done in the
``swing/src/main/java/info/openrocket/swing/gui/dialogs/AboutDialog.java`` file.
In this file, edit the String 'CREDITS' and add your details to the list after the 'Translations by:'-tag.
When you are done, create a pull request with your changes. The maintainers will review your changes and merge them if they are.
If you are not at all familiar with git, you can also `create an issue <https://github.com/openrocket/openrocket/issues/new/choose>`__
with your changes and the maintainers will create the pull request for you.

View File

@ -2,11 +2,32 @@
Development Guidelines
======================
In order to maintain a high level of code quality and improve the efficiency for other developers to verify your code,
we have established the following guidelines for contributing to the project.
.. contents:: Table of Contents
:depth: 2
:local:
----
Coding Standards
----------------
Commit Message Guidelines
-------------------------
Where possible, write unit tests for your code (see :doc:`Testing and Debugging </dev_guide/testing_and_debugging>`).
This will help to ensure that your code is correct, and will help to prevent regressions in the future.
Also include edge cases in your tests.
Use `atomic commits <https://en.wikipedia.org/wiki/Atomic_commit>`__. Each commit should be a single logical change.
Don't make several logical changes in one commit. For example, if a patch fixes a bug and optimizes the performance of a
feature, it should be split into two separate commits.
Commit messages should be clear, concise, and useful. The first line should be a short description of the commit, then a blank line,
then a more detailed explanation. The commit message should be in the present tense. For example, "Fix bug" and not "Fixed bug".
If applicable, include a reference to the issue that the commit addresses. For example, if you're working on a fix for GitHub
issue #123, then format your commit message like this: "[#123] Fix bug". This makes it easier to track which commits are
associated with which issues.
Pull Request Process
--------------------

View File

@ -6,34 +6,68 @@ Welcome to the OpenRocket Development Guide! This documentation is designed for
This guide covers the architecture, codebase, and development workflows in detail. To dive deeper into specific topics,
use the links below to navigate to different sections of this development guide. To learn more about the technical aspects
of OpenRocket, such as the aerodynamic calculations, refer to the `Technical documentation <https://openrocket.info/documentation.html>`_.
of OpenRocket, such as the aerodynamic calculations, refer to the `Technical documentation <https://openrocket.info/documentation.html>`__.
Code structure
--------------
OpenRocket is a Java application organized using the Java Platform Module System (JPMS) and built with `Gradle <https://gradle.org/>`_.
OpenRocket is a Java application organized using the Java Platform Module System (JPMS) and built with `Gradle <https://gradle.org/>`__.
The code is organized in the following two packages:
- `info.openrocket.core <https://github.com/openrocket/openrocket/tree/unstable/core>`_ - The backend of OpenRocket. \
- `info.openrocket.core <https://github.com/openrocket/openrocket/tree/unstable/core>`__ - The backend of OpenRocket. \
This package contains the classes that represent the rocket and its components, as well as the simulation engine. \
The classes in this package are not dependent on any GUI libraries and can be used in other applications.
- `info.openrocket.swing <https://github.com/openrocket/openrocket/tree/unstable/swing>`_ - The GUI of OpenRocket. \
- `info.openrocket.swing <https://github.com/openrocket/openrocket/tree/unstable/swing>`__ - The GUI of OpenRocket. \
This package contains the classes that create the user interface. OpenRocket uses the Java Swing library for the GUI.
Further Reading
---------------
Explore the following sections to learn more about OpenRocket's development:
- :doc:`Development Setup </dev_guide/development_setup>`
- :doc:`Development Environment Setup </dev_guide/development_setup>`
|br_no_pad|
*How to set up your development environment to build and run OpenRocket.*
- :doc:`OpenRocket Architecture </dev_guide/architecture>`
|br_no_pad|
*An overview of the high-level code architecture of OpenRocket.*
- :doc:`Codebase Walkthrough </dev_guide/codebase_walkthrough>`
|br_no_pad|
*A detailed guide to the codebase of OpenRocket.*
- :doc:`Development Guidelines </dev_guide/development_guidelines>`
|br_no_pad|
*Guidelines for contributing to OpenRocket.*
- :doc:`Testing and Debugging </dev_guide/testing_and_debugging>`
|br_no_pad|
*How to test and debug the OpenRocket code.*
- :doc:`API Documentation </dev_guide/api_documentation>`
|br_no_pad|
*Documentation for the OpenRocket API.*
- :doc:`Building and Releasing </dev_guide/building_releasing>`
|br_no_pad|
*How to build and release new OpenRocket versions.*
- :doc:`Contributing to the Website </dev_guide/contributing_to_the_website>`
|br_no_pad|
*How to contribute to the* `openrocket.info <https://openrocket.info/>`__ *website.*
- :doc:`Contributing to Translations </dev_guide/contributing_to_translations>`
|br_no_pad|
*How to contribute to translating the OpenRocket UI into different languages.*
- :doc:`Contributing to the Documentation </dev_guide/contributing_to_the_docs>`
|br_no_pad|
*How to contribute to this OpenRocket documentation.*
- :doc:`FAQ and Troubleshooting </dev_guide/faq_troubleshooting>`
|br_no_pad|
*Frequently asked questions and troubleshooting tips for developers.*
We encourage contributions from everyone and hope this guide helps you get started with developing OpenRocket.
**We encourage contributions from everyone and hope this guide helps you get started with developing OpenRocket. ❤️**

View File

@ -1,26 +1,34 @@
==================================
Setting Up Development Environment
==================================
=============================
Development Environment Setup
=============================
This guide will walk you through setting up the development environment to build OpenRocket from the source code.
.. contents:: Table of Contents
:depth: 2
:local:
----
Prerequisites
-------------
- `JDK 17 <https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html>`_. OpenRocket is developed using Java 17,
- `JDK 17 <https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html>`__. OpenRocket is developed using Java 17,
so you will need to install it to build and run OpenRocket. If you have multiple versions of Java installed, ensure that
Java 17 is the default version.
Java |java_vers| is the default version.
- `Git <https://git-scm.com/downloads>`_. Git is a version control system that is used to manage the source code for OpenRocket.
- `Git <https://git-scm.com/downloads>`__. Git is a version control system that is used to manage the source code for OpenRocket.
You will need to install Git to clone the OpenRocket repository.
- `GitHub Account <https://github.com>`_. GitHub is a platform for hosting Git repositories. You will need a GitHub account to
- `GitHub Account <https://github.com>`__. GitHub is a platform for hosting Git repositories. You will need a GitHub account to
fork the OpenRocket repository and submit pull requests.
- `Gradle <https://gradle.org/install/>`_. OpenRocket uses Gradle as its build system. You will need to install Gradle to build OpenRocket.
- `Gradle <https://gradle.org/install/>`__. OpenRocket uses Gradle as its build system. You will need to install Gradle to build OpenRocket.
Obtaining the Source Code
-------------------------
The source code for OpenRocket is hosted on `GitHub <https://github.com/openrocket/openrocket>`_. However, you cannot change
The source code for OpenRocket is hosted on `GitHub <https://github.com/openrocket/openrocket>`__. However, you cannot change
this code directly. This is because the OpenRocket repository is the official repository for the project, and only the project
maintainers can make changes to it. This is to ensure that the codebase remains stable and consistent.
Instead, you must fork the OpenRocket repository, which creates a personal copy of the repository that you can make changes to.
@ -32,14 +40,14 @@ Forking the Repository
The first step is to fork the OpenRocket repository. As mentioned earlier, the OpenRocket repository is the official repository
for the project, and only the project maintainers can make changes to it.
Go to the OpenRocket repository on GitHub (`link <https://github.com/openrocket/openrocket>`_) and click the ``Fork`` button:
Go to the OpenRocket repository on GitHub (`link <https://github.com/openrocket/openrocket>`__) and click the ``Fork`` button:
.. figure:: /img/dev_guide/fork_repo.png
:align: center
:width: 90%
:alt: Forking the official OpenRocket repository.
Forking the official OpenRocket repository on `github.com/openrocket/openrocket <https://github.com/openrocket/openrocket>`_.
Forking the official OpenRocket repository on `github.com/openrocket/openrocket <https://github.com/openrocket/openrocket>`__.
You can leave the default settings and click ``Create fork``. This will create a copy of the OpenRocket repository in your GitHub account:
@ -57,14 +65,28 @@ with your actual username).
Cloning the Repository
~~~~~~~~~~~~~~~~~~~~~~
Now that you have forked the OpenRocket repository, you can clone it to your local machine. To do this, open a terminal and run the following command:
Now that you have forked the OpenRocket repository, you can clone it to your local machine. To do this, open a terminal
and run the following command (replace ``[YOUR USERNAME]`` with your GitHub username):
.. code-block:: bash
git clone
# Use the following command if you have set up SSH keys with GitHub
git clone git@github.com:[YOUR USERNAME]/openrocket.git
# Otherwise, clone the repository using HTTPS
git clone https://github.com/[YOUR USERNAME]/openrocket.git
This will clone the OpenRocket repository to your local machine. You can now make changes to the code and push them to your forked repository.
One final step you need to do is to initialize the submodules. OpenRocket uses submodules for some of its dependencies.
To initialize the submodules, run the following commands:
.. code-block:: bash
git submodule init
git submodule update
Keeping your Fork in Sync
~~~~~~~~~~~~~~~~~~~~~~~~~
@ -120,9 +142,9 @@ This section will guide you through setting up the development environment to bu
IntelliJ IDEA
~~~~~~~~~~~~~
`IntelliJ IDEA <https://www.jetbrains.com/idea/>`_ is a popular Java IDE that is used by many developers. It has a lot of
`IntelliJ IDEA <https://www.jetbrains.com/idea/>`__ is a popular Java IDE that is used by many developers. It has a lot of
features that make it easier to develop Java applications. We **highly** recommend using IntelliJ IDEA for developing
OpenRocket. You can download the Community Edition for free from the `JetBrains website <https://www.jetbrains.com/idea/download>`_
OpenRocket. You can download the Community Edition for free from the `JetBrains website <https://www.jetbrains.com/idea/download>`__
(scroll down to “IntelliJ IDEA Community Edition” and click the download button).
Once you have downloaded and installed IntelliJ IDEA, you can open the OpenRocket project:
@ -145,29 +167,29 @@ Once you have downloaded and installed IntelliJ IDEA, you can open the OpenRocke
4. **Configure JDK for the Project**
- Go to *File -> Project Structure -> (Project Settings ->) Project*.
- Set the Project SDK to JDK 17.
- Set the Project SDK to JDK |java_vers|.
.. figure:: /img/dev_guide/project_sdk.png
:align: center
:width: 80%
:alt: Set the project SDK.
Set the project SDK to JDK 17.
Set the project SDK to JDK |java_vers|.
If JDK 17 is not listed, you can download it from the Project Structure dialog by \
If JDK |java_vers| is not listed, you can download it from the Project Structure dialog by \
going to *(Platform Settings ->) SDKs*, clicking the ``+`` button, and selecting ``Download JDK...``. Then select \
version 17 and any vendor (e.g. OpenJDK, Amazon Corretto, ...).
version |java_vers| and any vendor (e.g. OpenJDK, Amazon Corretto, ...).
- Confirm in the Project Structure dialog under *(Project Settings ->) Modules* that the SDK in each module is set to JDK 17. \
- Confirm in the Project Structure dialog under *(Project Settings ->) Modules* that the SDK in each module is set to JDK |java_vers|. \
If not, you can change it by selecting the module and setting the SDK in the right pane. Ensure that the list view on the bottom-right \
does not show ``<No SDK>``. If it does, click the *Module SDK* dropdown and click (again) on the JDK 17 SDK.
does not show ``<No SDK>``. If it does, click the *Module SDK* dropdown and click (again) on the JDK |java_vers| SDK.
.. figure:: /img/dev_guide/modules_sdk.png
:align: center
:width: 80%
:alt: Set the module SDK.
Set the module SDK to JDK 17.
Set the module SDK to JDK |java_vers|.
5. **Run the Application**
By default, IntelliJ should be set up with 3 run configurations:
@ -198,3 +220,24 @@ Once you have downloaded and installed IntelliJ IDEA, you can open the OpenRocke
Running OpenRocket directly from IntelliJ IDEA.
6. **That's it!** You can now start developing OpenRocket. 🚀
Command Line Interface
~~~~~~~~~~~~~~~~~~~~~~
It is also possible to develop in a text editor and build OpenRocket from the command line using Gradle. Please refer to the :doc:`Building and Releasing </dev_guide/building_releasing>`
section for all the possible Gradle tasks. To run OpenRocket, you can use:
.. code-block:: bash
./gradlew run
Troubleshooting
---------------
1. **JDK Not Recognized**
Ensure that the JDK path is correctly configured in *File -> Project Structure -> SDKs*.
2. **Gradle Sync Issues**
- If IntelliJ fails to import Gradle projects correctly, try refreshing the Gradle project by clicking on the "Reload All Gradle Projects" icon in the Gradle tool window.
- Ensure the `gradle-wrapper.properties` file points to the correct Gradle version which supports Java |java_vers|.

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

View File

@ -47,6 +47,8 @@ Welcome to OpenRocket's documentation!
/dev_guide/testing_and_debugging
/dev_guide/api_documentation
/dev_guide/building_releasing
/dev_guide/contributing_to_translations
/dev_guide/contributing_to_the_docs
/dev_guide/contributing_to_the_website
/dev_guide/faq_troubleshooting

View File

@ -9,9 +9,9 @@ General
* Fully cross-platform, written in Java
* `Fully documented simulation methods <https://openrocket.info/documentation.html>`_
* `Fully documented simulation methods <https://openrocket.info/documentation.html>`__
* Open Source (see our `GitHub repository <https://github.com/openrocket/openrocket>`), source code available under the `GNU GPL <https://www.gnu.org/licenses/gpl-3.0.txt>`_
* Open Source (see our `GitHub repository <https://github.com/openrocket/openrocket>`), source code available under the `GNU GPL <https://www.gnu.org/licenses/gpl-3.0.txt>`__
* Export OpenRocket design file to other simulation programs (RockSim, RASAero II)
@ -80,7 +80,7 @@ Below are a few major features that are under consideration:
* Better support for transonic and supersonic simulations (:doc:`help needed! </introduction/contribute>`)
* Monte Carlo simulation for uncertainty analysis
* Monte Carlo simulation for dispersion analysis
* Simulate fin flutter
@ -96,7 +96,7 @@ Below are a few major features that are under consideration:
* Import CD and CP data from other programs (e.g. RASAero)
For a full overview of the planned features, please refer to the `GitHub issue tracker <https://github.com/openrocket/openrocket/issues>`_.
For a full overview of the planned features, please refer to the `GitHub issue tracker <https://github.com/openrocket/openrocket/issues>`__.
.. raw:: html
@ -105,13 +105,13 @@ For a full overview of the planned features, please refer to the `GitHub issue t
Comparison to RockSim
-----------------------
`RockSim <https://www.apogeerockets.com/Rocket_Software/RockSim>`_ is a very powerful, commercial rocket design and simulation program.
`RockSim <https://www.apogeerockets.com/Rocket_Software/RockSim>`__ is a very powerful, commercial rocket design and simulation program.
It is more advanced than OpenRocket in some regards, but its price tag of $124 makes it inaccessible to many hobbyists.
OpenRocket is free, and the source code is available for modification by anyone.
To help you decide which program is right for you, we have compiled a comparison of the features of OpenRocket 23.09 and RockSim 10 below.
While hosted on the OpenRocket documentation, we have attempted to make this an objective comparison between the functionality
of the two software products. If you think something is wrong or omitted, please `contact us <https://openrocket.info/contact.html>`_.
of the two software products. If you think something is wrong or omitted, please `contact us <https://openrocket.info/contact.html>`__.
General
~~~~~~~
@ -167,7 +167,7 @@ General
- .. cssclass:: or-table-cell, or-table-okay
| `PACE <http://www.paceap.com/>`_
| `PACE <http://www.paceap.com/>`__
UI Features
~~~~~~~~~~~

View File

@ -12,8 +12,8 @@ What is OpenRocket?
The OpenRocket Logo
Welcome! OpenRocket is an open-source model rocket simulation software application. It was originally developed by
Sampo Niskanen in 2009 as part of his master thesis at what was then `Helsinki University of Technology <https://www.aalto.fi/en/aalto-university/history>`_.
If you want to have a look at his thesis you can download it from `OpenRocket's technical documentation page <http://openrocket.info/documentation.html>`_.
Sampo Niskanen in 2009 as part of his master thesis at what was then `Helsinki University of Technology <https://www.aalto.fi/en/aalto-university/history>`__.
If you want to have a look at his thesis you can download it from `OpenRocket's technical documentation page <http://openrocket.info/documentation.html>`__.
Written entirely in Java, OpenRocket is fully cross-platform. To install the software, please refer to the :doc:`Installation Instructions </setup/installation>`
.. rst-class:: clear-both
@ -33,10 +33,10 @@ The program can be roughly divided into two sections:
* **Flight simulation**: In this phase, you can run one or more simulations of your rocket's flight, choosing from one \
or more **motor configurations**. Each simulation, calculated using the Runge-Kutta 4 simulator, returns a wide range \
of data about the rocket's flight. Unfortunately, for the moment, a graphical visualization of the rocket's flight is \
not available (`help needed <https://openrocket.info/contribute.html>`_).
not available (`help needed <https://openrocket.info/contribute.html>`__).
For more information about OpenRocket's features and a few screenshots you can have a look `here <https://openrocket.info/features.html>`_.
For more information about OpenRocket's features and a few screenshots you can have a look `here <https://openrocket.info/features.html>`__.
How this Documentation is Organized
-----------------------------------

View File

@ -14,7 +14,7 @@ OpenRocket is released in two forms: as a *packaged application* and as a *JAR f
The packaged installers come with everything needed, including the correct version of Java;
*you will not need to install, update or downgrade Java on your device to run them.*
Download the latest version from `our downloads page <https://openrocket.info/downloads.html?vers=latest>`_.
Download the latest version from `our downloads page <https://openrocket.info/downloads.html?vers=latest>`__.
.. raw:: html
@ -49,7 +49,7 @@ before installing the updated release. This is *not required*, but is suggested
Installing OpenRocket 🚀
------------------------
**Download the latest version from `our downloads page** <https://openrocket.info/downloads.html?vers=latest>`_.
**Download the latest version from `our downloads page** <https://openrocket.info/downloads.html?vers=latest>`__.
Scroll down to download the correct installer for your platform (Windows, macOS, or Linux).
Each platform has a different installation process. Click on the ``Show <your platform> installation instructions`` header under your
@ -191,11 +191,11 @@ Troubleshooting
---------------
When you have issues with your installation, ensure that you have **read the installation instructions** for your platform.
When you download the installer from our `downloads page <https://openrocket.info/downloads.html?vers=latest>`_, you can
When you download the installer from our `downloads page <https://openrocket.info/downloads.html?vers=latest>`__, you can
click on the ``Show <your platform> installation instructions`` header under your platform's download button to see the
installation instructions.
If you have further issues, please `contact us <https://openrocket.info/contact.html>`_.
If you have further issues, please `contact us <https://openrocket.info/contact.html>`__.
Uninstalling
------------