# tordanik/osm2world architecture

> Architecture diagram of the GitHub repository tordanik/osm2world, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tordanik/osm2world
- Repository: https://github.com/tordanik/osm2world

## Overview

##### Main Components and Architecture

The system should be represented as a pipeline with these major components:

a) Input Processing Layer
- OSM Data Readers (src/main/java/org/osm2world/core/osm/creation)
- Support for multiple input formats (.osm, .pbf, Overpass API, MBTiles)

b) Core Processing Pipeline
- Data Conversion (org.osm2world.core.map_data)
- Elevation Processing (org.osm2world.core.map_elevation)
- World Object Creation (org.osm2world.core.world)
- Mathematical Operations (org.osm2world.core.math)

c) Output Generation Layer
- Multiple target formats (GLTF, OBJ, POVRay, Frontend PBF)
- Rendering capabilities (JOGL-based)

##### Component Relationships

**[Input Sources] → [OSM Data Readers] → [Map Data Conversion] → [World Creation] → [Target Renderers]**
- ↑
- [Elevation Processing] --→

##### Detailed Component Breakdown

For each major component, include sub-components:

a) Input Processing:
- GeodeskReader
- MbtilesReader
- OSMFileReader
- OverpassReader

b) Core Processing:
- MapProjection
- TerrainElevation
- WorldModules (Buildings, Roads, etc.)
- Geometric Operations

c) Output Processing:
- GLTF Export
- OBJ Export
- POVRay Export
- JOGL Rendering

##### Additional Details

- Configuration system
- Resource management (textures, materials)
- Mathematical utilities
- Viewer application components
- Test framework integration

##### Implementation Notes

- The modular nature of the world modules
- The pipeline architecture
- The separation between core conversion and visualization
- The extensible target format system

##### Technical Specifications

Technical details:
- Java-based implementation
- OpenGL (JOGL) rendering
- Maven build system
- External dependencies

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef input fill:#a8d1f0,stroke:#333
    classDef core fill:#90EE90,stroke:#333
    classDef output fill:#FFE5B4,stroke:#333
    classDef viewer fill:#E6E6FA,stroke:#333
    classDef resource fill:#FFA07A,stroke:#333
    classDef cli fill:#DDA0DD,stroke:#333

    %% Input Layer
    subgraph InputLayer["Input Processing Layer"]
        OSMReaders["OSM Data Readers"]
        FileReader["File Reader"]
        OverpassAPI["Overpass API"]
        MBTiles["MBTiles Reader"]
    end

    %% Core Processing Layer
    subgraph CoreLayer["Core Processing Pipeline"]
        MapData["Map Data Conversion"]
        Elevation["Elevation Processing"]
        WorldObj["World Object Creation"]
        MathOps["Mathematical Operations"]
    end

    %% Output Layer
    subgraph OutputLayer["Output Generation Layer"]
        GLTF["GLTF Export"]
        OBJ["OBJ Export"]
        POVRay["POVRay Export"]
        JOGL["JOGL Rendering"]
    end

    %% Viewer Application
    subgraph ViewerApp["Viewer Application"]
        ViewerMain["Main Viewer"]
        ViewerCtrl["Viewer Controls"]
        ViewerUI["Viewer UI"]
    end

    %% Resource Management
    subgraph Resources["Resource Management"]
        Shaders["Shader Resources"]
        Materials["Material System"]
    end

    %% CLI
    CLI["Command Line Interface"]

    %% Relationships
    OSMReaders --> MapData
    FileReader --> OSMReaders
    OverpassAPI --> OSMReaders
    MBTiles --> OSMReaders
    
    MapData --> WorldObj
    Elevation --> WorldObj
    MathOps --> WorldObj
    
    WorldObj --> GLTF
    WorldObj --> OBJ
    WorldObj --> POVRay
    WorldObj --> JOGL
    
    JOGL --> ViewerMain
    ViewerCtrl --> ViewerMain
    ViewerUI --> ViewerMain
    
    Materials --> WorldObj
    Shaders --> JOGL
    
    CLI --> MapData

    %% Click events
    click OSMReaders "https://github.com/tordanik/OSM2World/tree/master/src/main/java/org/osm2world/core/osm/creation/"
    click FileReader "https://github.com/tordanik/OSM2World/blob/master/src/main/java/org/osm2world/core/osm/creation/OSMFileReader.java"
    click OverpassAPI "https://github.com/tordanik/OSM2World/blob/master/src/main/java/org/osm2world/core/osm/creation/OverpassReader.java"
    click MBTiles "https://github.com/tordanik/OSM2World/blob/master/src/main/java/org/osm2world/core/osm/creation/MbtilesReader.java"
    click MapData "https://github.com/tordanik/OSM2World/tree/master/src/main/java/org/osm2world/core/map_data/"
    click Elevation "https://github.com/tordanik/OSM2World/tree/master/src/main/java/org/osm2world/core/map_elevation/"
    click WorldObj "https://github.com/tordanik/OSM2World/tree/master/src/main/java/org/osm2world/core/world/"
    click MathOps "https://github.com/tordanik/OSM2World/tree/master/src/main/java/org/osm2world/core/math/"
    click GLTF "https://github.com/tordanik/OSM2World/tree/master/src/main/java/org/osm2world/core/target/gltf/"
    click OBJ "https://github.com/tordanik/OSM2World/tree/master/src/main/java/org/osm2world/core/target/obj/"
    click POVRay "https://github.com/tordanik/OSM2World/tree/master/src/main/java/org/osm2world/core/target/povray/"
    click JOGL "https://github.com/tordanik/OSM2World/tree/master/src/main/java/org/osm2world/core/target/jogl/"
    click ViewerMain "https://github.com/tordanik/OSM2World/tree/master/src/main/java/org/osm2world/viewer/"
    click ViewerCtrl "https://github.com/tordanik/OSM2World/tree/master/src/main/java/org/osm2world/viewer/control/"
    click ViewerUI "https://github.com/tordanik/OSM2World/tree/master/src/main/java/org/osm2world/viewer/view/"
    click CLI "https://github.com/tordanik/OSM2World/tree/master/src/main/java/org/osm2world/console/"
    click Shaders "https://github.com/tordanik/OSM2World/tree/master/resources/shaders/"
    click Materials "https://github.com/tordanik/OSM2World/tree/master/src/main/java/org/osm2world/core/target/common/material/"

    %% Style assignments
    class OSMReaders,FileReader,OverpassAPI,MBTiles input
    class MapData,Elevation,WorldObj,MathOps core
    class GLTF,OBJ,POVRay,JOGL output
    class ViewerMain,ViewerCtrl,ViewerUI viewer
    class Shaders,Materials resource
    class CLI cli
```
