drawing_tools.helpers.visualization package#

Submodules#

drawing_tools.helpers.visualization.detected_table module#

DetectedTable methods for visualization.

class drawing_tools.helpers.visualization.detected_table.TableCellSketcher(cell: TableCell)#

Bases: object

Handles visualization and debugging display for TableCell.

This class encapsulates all plotting and visualization logic, keeping the TableCell class focused on core functionality.

__init__(cell: TableCell)#

Initialize the visualizer with a TableCell instance.

Parameters:

cell – The TableCell to visualize

plot_data_primitives(color_legend_map: dict[str, tuple[float, float, float]] | None = None, opacity: float = 0.4, detailed: bool = False) list[PlotDataObject]#

Get the plot data representation for the detected table.

class drawing_tools.helpers.visualization.detected_table.DetectedTableSketcher(detected_table: DetectedTable)#

Bases: object

Handles visualization and debugging display for DetectedTable.

This class encapsulates all plotting and visualization logic, keeping the DetectedTable class focused on core functionality.

__init__(detected_table: DetectedTable)#

Initialize the visualizer with a DetectedTable instance.

Parameters:

detected_table – The DetectedTable to visualize

property bounds: BoundingRectangle#

Mirror DetecedTable bounds attribute.

plot_data_primitives(extra_primitives: list[PlotDataObject] | None = None, color_legend: bool = True, opacity: float = 0.4, detailed: bool = False) list[PlotDataObject]#

Get the plot data representation for the detected table.

Parameters:
  • extra_primitives – Optional plot data primitives to be integrated in the table plot

  • color_legend – If activated, table cells will be differentiated in the plot by their merge status.

  • opacity – The opacity of the table regions.

  • detailed – If activated, add cells information texts.

drawing_tools.helpers.visualization.edge_constraint_graph module#

Edge Constraint Graph Visualizer for Technical Drawings.

This module provides visualization tools for EdgeConstraintGraph and EdgeRelationship objects detected by EdgeRelationshipDetector using plot_data.

class drawing_tools.helpers.visualization.edge_constraint_graph.LabelParameters(symbol: str, point_key: str, offset_x: float, offset_y: float, tooltip: str | None = None)#

Bases: object

Parameters for creating point-based labels.

symbol: str#
point_key: str#
offset_x: float#
offset_y: float#
tooltip: str | None = None#
__init__(symbol: str, point_key: str, offset_x: float, offset_y: float, tooltip: str | None = None) None#
class drawing_tools.helpers.visualization.edge_constraint_graph.RelationshipVisualizationConfig#

Bases: object

Configuration for relationship visualization appearance.

RELATIONSHIP_COLORS: ClassVar = {GeometricRelationType.ANGULAR: <plot_data.colors.Color object>, GeometricRelationType.COINCIDENT: <plot_data.colors.Color object>, GeometricRelationType.COLLINEAR: <plot_data.colors.Color object>, GeometricRelationType.CONCENTRIC: <plot_data.colors.Color object>, GeometricRelationType.OFFSET: <plot_data.colors.Color object>, GeometricRelationType.PARALLEL: <plot_data.colors.Color object>, GeometricRelationType.PERPENDICULAR: <plot_data.colors.Color object>, GeometricRelationType.SYMMETRIC: <plot_data.colors.Color object>, GeometricRelationType.TANGENT: <plot_data.colors.Color object>}#
RELATIONSHIP_LINE_STYLES: ClassVar = {GeometricRelationType.ANGULAR: [8, 3, 3, 3], GeometricRelationType.COINCIDENT: [], GeometricRelationType.COLLINEAR: [5, 5], GeometricRelationType.CONCENTRIC: [20, 5], GeometricRelationType.OFFSET: [12, 3], GeometricRelationType.PARALLEL: [10, 5], GeometricRelationType.PERPENDICULAR: [], GeometricRelationType.SYMMETRIC: [12, 3, 3, 3, 3, 3], GeometricRelationType.TANGENT: [15, 5, 5, 5]}#
CONNECTION_POINT_SIZE = 6.0#
EDGE_LINE_WIDTH = 2.0#
RELATIONSHIP_LINE_WIDTH = 1.5#
SYMBOL_SIZE = 1.0#
TEXT_SIZE = 10.0#
HIGHLIGHT_WIDTH = 3.0#
ANNOTATION_OFFSET = 0.5#
LEGEND_START_X = 50#
LEGEND_START_Y = 50#
LEGEND_ROW_HEIGHT = 25#
LEGEND_LINE_LENGTH = 30#
LEGEND_TEXT_OFFSET = 40#
TITLE_FONT_SIZE = 16#
TITLE_OFFSET_Y = 50#
DEFAULT_TITLE_X = 400#
DEFAULT_TITLE_Y = 50#
SYMMETRY_AXIS_EXTENT = 10#
SYMMETRY_AXIS_PATTERN: ClassVar[list[int]] = [10, 5, 2, 5]#
ARROW_SIZE_FACTOR = 0.3#
ARROW_HEAD_SIZE_FACTOR = 0.5#
ARROW_PERPENDICULAR_FACTOR = 0.3#
INTERSECTION_TOLERANCE = 0.001#
class drawing_tools.helpers.visualization.edge_constraint_graph.BaseRelationshipVisualizer(config: RelationshipVisualizationConfig | None = None)#

Bases: ABC

Abstract base class for relationship visualizers.

__init__(config: RelationshipVisualizationConfig | None = None)#

Initialize the visualizer with configuration.

visualize_relationship(relationship: EdgeRelationship, show_edges: bool = True, show_symbols: bool = True, show_labels: bool = True) list[PlotDataObject]#

Template method that orchestrates the visualization process.

Parameters:
  • relationship – The EdgeRelationship to visualize

  • show_edges – Whether to highlight relationship edges

  • show_symbols – Whether to show relationship symbols

  • show_labels – Whether to show relationship labels

Returns:

List of plot data objects

class drawing_tools.helpers.visualization.edge_constraint_graph.CoincidentRelationshipVisualizer(config: RelationshipVisualizationConfig | None = None)#

Bases: BaseRelationshipVisualizer

Visualizer for coincident (connection point) relationships.

class drawing_tools.helpers.visualization.edge_constraint_graph.TangentRelationshipVisualizer(config: RelationshipVisualizationConfig | None = None)#

Bases: BaseRelationshipVisualizer

Visualizer for tangent (connection point) relationships.

class drawing_tools.helpers.visualization.edge_constraint_graph.ConcentricRelationshipVisualizer(config: RelationshipVisualizationConfig | None = None)#

Bases: BaseRelationshipVisualizer

Visualizer for concentric relationships.

class drawing_tools.helpers.visualization.edge_constraint_graph.ParallelRelationshipVisualizer(config: RelationshipVisualizationConfig | None = None)#

Bases: BaseRelationshipVisualizer

Visualizer for parallel relationships.

class drawing_tools.helpers.visualization.edge_constraint_graph.PerpendicularRelationshipVisualizer(config: RelationshipVisualizationConfig | None = None)#

Bases: BaseRelationshipVisualizer

Visualizer for perpendicular relationships.

class drawing_tools.helpers.visualization.edge_constraint_graph.SymmetricRelationshipVisualizer(config: RelationshipVisualizationConfig | None = None)#

Bases: BaseRelationshipVisualizer

Visualizer for symmetric relationships.

class drawing_tools.helpers.visualization.edge_constraint_graph.EdgeConstraintGraphVisualizer(config: RelationshipVisualizationConfig | None = None)#

Bases: object

Main visualizer for EdgeConstraintGraph objects.

__init__(config: RelationshipVisualizationConfig | None = None)#

Initialize the graph visualizer.

visualize_graph(graph: EdgeConstraintGraph, show_edges: bool = True, show_symbols: bool = True, show_labels: bool = True, relationship_filter: list[GeometricRelationType] | None = None) list[PlotDataObject]#

Visualize the entire constraint graph.

Parameters:
  • graph – EdgeConstraintGraph to visualize

  • show_edges – Whether to highlight relationship edges

  • show_symbols – Whether to show relationship symbols

  • show_labels – Whether to show relationship labels

  • relationship_filter – Optional filter for relationship types

Returns:

List of plot data objects

create_relationship_legend(relationship_types: list[GeometricRelationType]) list[PlotDataObject]#

Create a legend for relationship types.

plot_constraint_graph(graph: EdgeConstraintGraph, show_background_edges: bool = True, show_edges: bool = True, show_symbols: bool = True, show_labels: bool = True, show_legend: bool = True, relationship_filter: list[GeometricRelationType] | None = None, filename: str | None = None) None#

Create a complete constraint graph visualization plot.

Parameters:
  • graph – EdgeConstraintGraph to visualize

  • show_background_edges – Whether to show all edges as background

  • show_edges – Whether to highlight relationship edges

  • show_symbols – Whether to show relationship symbols

  • show_labels – Whether to show relationship labels

  • show_legend – Whether to show relationship type legend

  • relationship_filter – Optional filter for relationship types

  • filename – Optional filename to save plot

drawing_tools.helpers.visualization.edge_constraint_graph.visualize_view_constraint_graph(view: View, tolerance: float = 0.5, angle_tolerance: float = 0.01, relationship_filter: list[GeometricRelationType] | None = None, filename: str | None = None) None#

Complete workflow to build and visualize constraint graph for a view.

Parameters:
  • view – View to analyze

  • tolerance – Distance tolerance for relationships

  • angle_tolerance – Angular tolerance for relationships

  • relationship_filter – Optional filter for specific relationship types

  • filename – Optional filename to save visualization

drawing_tools.helpers.visualization.edge_constraint_graph.analyze_constraint_graph_patterns(constraint_graph: EdgeConstraintGraph) dict[str, Any]#

Analyze patterns in the constraint graph.

Parameters:

constraint_graph – EdgeConstraintGraph to analyze

Returns:

Dictionary with pattern analysis results

drawing_tools.helpers.visualization.sheet_table_detector module#

Visualization helpers for debugging SheetTableDetector operations.

This module provides visualization classes for different aspects of table detection: - ConnectivityFilterVisualizer: Debug connectivity density filtering

class drawing_tools.helpers.visualization.sheet_table_detector.VisualizationColors#

Bases: object

Centralized color scheme for all table detection visualizations.

KEPT_LINE = <plot_data.colors.Color object>#
REJECTED_LINE = <plot_data.colors.Color object>#
PROCESSED_LINE = <plot_data.colors.Color object>#
NEIGHBORHOOD = <plot_data.colors.Color object>#
CONNECTION = <plot_data.colors.Color object>#
CLUSTER = <plot_data.colors.Color object>#
TEXT = <plot_data.colors.Color object>#
BORDER = <plot_data.colors.Color object>#
BACKGROUND = <plot_data.colors.Color object>#
class drawing_tools.helpers.visualization.sheet_table_detector.VisualizationLayout#

Bases: object

Layout constants for visualization elements.

PANEL_MARGIN_X = 100#
PANEL_MARGIN_Y = 50#
PANEL_SPACING_Y = 250#
LINE_HEIGHT = 15#
ITEM_SPACING = 20#
LABEL_OFFSET_Y = 5#
COLOR_SAMPLE_LABEL_OFFSET_X = 35#
HEADER_FONT_SIZE = 12#
NORMAL_FONT_SIZE = 10#
INFO_FONT_SIZE = 11#
COLOR_SAMPLE_WIDTH = 30#
COLOR_SAMPLE_HEIGHT = 10#
ELLIPSE_SEGMENTS = 36#
KEPT_LINE_WIDTH = 3#
REJECTED_LINE_WIDTH = 2#
NEIGHBORHOOD_LINE_WIDTH = 2#
CONNECTION_LINE_WIDTH = 0.5#
CENTER_MARKER_WIDTH = 2#
NEIGHBORHOOD_DASH: ClassVar[list[int]] = [10, 5]#
CONNECTION_DASH: ClassVar[list[int]] = [3, 3]#
STATS_HEADER = 'Connectivity Density Filter Analysis'#
STATS_SEPARATOR = '========================================'#
class drawing_tools.helpers.visualization.sheet_table_detector.ConnectivityFilterVisualizer(debug_info: dict, use_elliptical: bool = True)#

Bases: object

Visualizer for debugging connectivity density filtering operations.

Provides comprehensive visualization of: - LineSegment filtering results (kept vs rejected) - Neighborhood boundaries - Connection analysis - Statistical information

__init__(debug_info: dict, use_elliptical: bool = True)#

Initialize the connectivity filter visualizer.

Parameters:
  • debug_info – Debug information from connectivity filtering

  • use_elliptical – Whether elliptical neighborhoods were used

generate_plot(output_path: str = 'connectivity_filter_debug.html') None#

Generate the complete connectivity filter visualization.

Parameters:

output_path – Path to save the visualization

draw_lines() list[PlotDataObject]#

Draw all lines with color coding and labels.

draw_neighborhoods() list[PlotDataObject]#

Draw neighborhood boundaries for representative lines.

draw_connections() list[PlotDataObject]#

Draw connection lines between neighboring lines.

add_statistics_panel() list[PlotDataObject]#

Add comprehensive statistics panel.

add_color_legend() list[PlotDataObject]#

Add color coding legend.

add_rejected_lines_info() list[PlotDataObject]#

Add information about rejected lines.

Module contents#

Package initialization.