Refactoring straighten.py -> DiagramAnalyzer