見出し画像

TOPOS-Ξ アーキテクチャ依存関係図(ADD)仕様

# Architecture Dependency Diagram (ADD) Specification
Version: 1.0
Status: Stable
Last Updated: 2024-12-03

## 1. Core Visual Elements

```topology
space ADDVisualElements {
    shape SpaceElement {
        properties {
            shape_type: Topology<String> = "hexagon"
            minimum_size: Vector2D = (120, 100)
            fill_color: Color = "#4A90E2"
            fill_opacity: Number = 0.2
            stroke_color: Color = "#4A90E2"
            stroke_width: Number = 2
        }
        
        mapping validate() {
            properties {
                continuous: Boolean = true
            }
            
            path {
                verify_dimensions ->
                check_color_scheme ->
                validate_shape
            }
        }
    }

    shape ComponentElement {
        properties {
            shape_type: Topology<String> = "rectangle"
            minimum_size: Vector2D = (150, 200)
            fill_color: Color = "#50E3C2"
            fill_opacity: Number = 0.2
            stroke_color: Color = "#50E3C2"
            stroke_width: Number = 1
        }
    }

    shape TypeElement {
        properties {
            shape_type: Topology<String> = "rounded_rectangle"
            size: Vector2D = (100, 30)
            fill_color: Color = "#9013FE"
            fill_opacity: Number = 0.2
            stroke_color: Color = "#9013FE"
            corner_radius: Number = 5
        }
    }

    shape ConnectionLine {
        properties {
            line_type: String  // "dependency", "inheritance", "reference"
            stroke_color: Color = "#4A4A4A"
            stroke_width: Number = 1
            dash_pattern: Collection<Number> = [5, 5]  // for reference lines
        }
    }
}
```

## 2. Layout Rules

```topology
space ADDLayout {
    properties {
        grid_size: Number = 100
        sub_grid_size: Number = 25
        minimum_margin: Number = 50
    }

    shape GridSystem {
        properties {
            snap_to_grid: Boolean = true
            preserve_alignment: Boolean = true
        }
        
        mapping align_elements() {
            path {
                snap_to_major_grid ->
                align_horizontally ->
                verify_spacing ->
                minimize_crossings
            }
        }
    }

    shape ComponentPlacement {
        properties {
            horizontal_spacing: Number = 50
            vertical_spacing: Number = 30
            internal_margin: Number = 20
        }
        
        mapping place_components() {
            path {
                group_logically ->
                maintain_spacing ->
                verify_hierarchy ->
                optimize_layout
            }
        }
    }
}
```

## 3. Visual Styling

```topology
space ADDStyling {
    shape TextStyle {
        properties {
            space_font: Font = "Arial"
            space_size: Number = 16
            space_color: Color = "#4A90E2"
            
            component_font: Font = "Arial"
            component_size: Number = 14
            component_color: Color = "#000000"
            
            type_font: Font = "Arial"
            type_size: Number = 12
            type_color: Color = "#000000"
        }
    }

    shape Annotations {
        properties {
            position: String = "top-right"
            max_width: Percentage = 80
            min_font_size: Number = 10
        }
    }
}
```

## 4. Implementation Protocol

```topology
space ADDImplementation {
    shape DiagramCreator {
        properties {
            canvas_initialized: Boolean = false
            metadata_complete: Boolean = false
        }
        
        mapping create_diagram() {
            path {
                initialize_canvas ->
                place_spaces ->
                add_components ->
                draw_connections ->
                add_metadata ->
                verify_diagram
            }
        }
    }
}
```

## 5. Verification Protocol

```topology
space ADDVerification {
    shape VerificationChecklist {
        properties {
            shape_accuracy: Boolean = false
            dependency_clarity: Boolean = false
            text_legibility: Boolean = false
            grid_alignment: Boolean = false
            crossing_minimization: Boolean = false
            color_consistency: Boolean = false
            connection_clarity: Boolean = false
        }
        
        mapping verify() {
            path {
                check_shapes ->
                verify_dependencies ->
                validate_text ->
                check_alignment ->
                assess_crossings ->
                verify_colors ->
                check_connections
            }
        }
    }
}
```

## 6. Validation Rules

### 6.1 Spatial Constraints
1. All elements must maintain minimum spacing
2. Hierarchical relationships must be visually clear
3. Crossing minimization must be enforced

### 6.2 Visual Requirements
1. Color scheme consistency
2. Text legibility
3. Clear visual hierarchy

### 6.3 Topological Requirements
1. Continuous element placement
2. Preserved relationship visibility
3. Consistent spacing maintenance

## 7. Implementation Notes

### 7.1 Required Tools
1. SVG generation capability
2. Grid system implementation
3. Color management system

### 7.2 Performance Considerations
1. Efficient layout algorithm
2. Optimized rendering
3. Minimal redraw requirements

前記事の「情報ホライズン拡張のADD: