# pana-g/flutter_earth_globe architecture

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

- Interactive diagram: https://gitdiagram.com/pana-g/flutter_earth_globe
- Repository: https://github.com/pana-g/flutter_earth_globe

## Overview

##### Main Components

a) Core Components:
- Globe Renderer System
- Controller Layer
- Interaction Handler
- Asset Management System
- Rendering Pipeline

b) Supporting Components:
- Point Management System
- Connection Management System
- Background Rendering System

**┌─ Application Layer ─────────────────────────────┐**

- ┌─ Widget Interface ─┐                     │
- FlutterEarthGlobe │                     │
- ┬────────┘                     │
- ▼                              │
- ┌─ Controller Layer ─┐                    │
- FlutterEarthGlobe │                    │
- Controller     │                    │
- ┬────────┘                    │
- ▼                              │
- ┤
- ┌─ Rendering Core ──────────────────┐     │

- ┌─ Painters ─────────────────┐   │     │
- SpherePainter           │   │     │
- ForegroundPainter       │   │     │
- StarryBackgroundPainter │   │     │
- ┘   │     │

- ┌─ Globe Elements ───────────┐   │     │
- Points                   │   │     │
- Connections             │   │     │
- Labels                  │   │     │
- ┘   │     │
- ┘     │
- ┤
- ┌─ Utilities ────────────────────────┐    │
- MathHelper                       │    │
- LineHelper                       │    │
- GlobeCoordinates                │    │
- ┘    │
- ┘

##### Component Relationships

- Data flow between components
- Inheritance relationships
- Dependencies between modules
- Event propagation paths

##### Implementation Details

- The separation between the widget interface and the rendering core
- How the controller manages state and coordinates updates
- The relationship between different painters
- How coordinate systems are transformed and managed

##### Notes for Scale

- How the system handles multiple points and connections
- Where performance optimizations are implemented
- Areas where future extensibility is considered

Remember to include notes about the cross-platform nature of the implementation, as evidenced by the various platform-specific directories in the project structure (android, ios, linux, macos, web, windows).

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Application
        WI[Widget Interface]
        RG[Rotating Globe]
        FEGC[FlutterEarthGlobe Controller]
        
        WI --> RG
        RG --> FEGC
    end

    subgraph "Rendering Core"
        direction TB
        subgraph Painters
            SP[Sphere Painter]
            FP[Foreground Painter]
            SBP[Starry Background Painter]
            SI[Sphere Image]
        end

        subgraph "Globe Elements"
            direction TB
            PM[Point Management]
            CM[Connection Management]
            LM[Label Management]
            
            subgraph "Point System"
                P[Point]
                VP[Visible Point]
                P --> VP
            end
            
            subgraph "Connection System"
                PC[Point Connection]
                VC[Visible Connection]
                PCS[Point Connection Style]
                PC --> VC
                PC --> PCS
            end
        end
    end

    subgraph Utilities
        MH[Math Helper]
        LH[Line Helper]
        GC[Globe Coordinates]
        SS[Sphere Style]
        MISC[Miscellaneous]
    end

    %% Relationships
    FEGC --> SP
    FEGC --> FP
    FEGC --> SBP
    SP --> SI
    
    PM --> P
    CM --> PC
    
    %% Utility Relationships
    P --> MH
    PC --> LH
    P --> GC
    SP --> SS

    %% Click Events
    click WI "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/flutter_earth_globe.dart"
    click RG "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/rotating_globe.dart"
    click FEGC "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/flutter_earth_globe_controller.dart"
    click SP "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/sphere_painter.dart"
    click SI "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/sphere_image.dart"
    click FP "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/foreground_painter.dart"
    click SBP "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/starry_background_painter.dart"
    click P "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/point.dart"
    click VP "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/visible_point.dart"
    click PC "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/point_connection.dart"
    click VC "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/visible_connection.dart"
    click PCS "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/point_connection_style.dart"
    click MH "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/math_helper.dart"
    click LH "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/line_helper.dart"
    click GC "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/globe_coordinates.dart"
    click SS "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/sphere_style.dart"
    click MISC "https://github.com/Pana-g/flutter_earth_globe/blob/master/lib/misc.dart"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef application fill:#bbdefb,stroke:#1976d2
    classDef rendering fill:#c8e6c9,stroke:#388e3c
    classDef elements fill:#ffcc80,stroke:#f57c00
    classDef utility fill:#e1bee7,stroke:#7b1fa2
    
    class WI,RG,FEGC application
    class SP,FP,SBP,SI rendering
    class PM,CM,LM,P,VP,PC,VC,PCS elements
    class MH,LH,GC,SS,MISC utility
```
