From f855b6a690535bc185a5c6e702cd6261ec7c4410 Mon Sep 17 00:00:00 2001 From: twanvl Date: Tue, 13 Feb 2007 18:17:45 +0000 Subject: [PATCH] some fixes to image import git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@204 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/data/format/image_to_symbol.cpp | 6 ++++-- src/gui/symbol/window.cpp | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/data/format/image_to_symbol.cpp b/src/data/format/image_to_symbol.cpp index 4cf78871..e2de3114 100644 --- a/src/data/format/image_to_symbol.cpp +++ b/src/data/format/image_to_symbol.cpp @@ -88,7 +88,7 @@ bool is_mse1_symbol(const Image& img) { } } if (delta > 5000) return false; // not black & white enough - // TODO : more checks + // TODO : more checks? return true; } @@ -350,7 +350,9 @@ void straighten(SymbolPart& part) { /// Remove unneeded points between straight lines void merge_lines(SymbolPart& part) { for (int i = 0 ; (size_t)i < part.points.size() ; ++i) { - Vector2D a = part.getPoint(i-1)->pos, b = part.getPoint(i)->pos, c = part.getPoint(i+1)->pos; + ControlPoint& cur = *part.getPoint(i); + if (cur.segment_before != cur.segment_after) continue; + Vector2D a = part.getPoint(i-1)->pos, b = cur.pos, c = part.getPoint(i+1)->pos; Vector2D ab = (a-b).normalized(); Vector2D bc = (b-c).normalized(); double angle_len = fabs( atan2(ab.x,ab.y) - atan2(bc.x,bc.y)) * (a-c).lengthSqr(); diff --git a/src/gui/symbol/window.cpp b/src/gui/symbol/window.cpp index 3c156841..e309b9b6 100644 --- a/src/gui/symbol/window.cpp +++ b/src/gui/symbol/window.cpp @@ -153,6 +153,7 @@ void SymbolWindow::onFileOpen(wxCommandEvent& ev) { Reader reader(new_shared1(name), name); reader.handle_greedy(symbol); } else { + wxBusyCursor busy; Image image(name); if (!image.Ok()) return; symbol = import_symbol(image);