{"action":"created","comment":{"url":"https://api.github.com/repos/triplea-game/triplea/pulls/comments/54357558","id":54357558,"diff_hunk":"@@ -0,0 +1,256 @@\n+package util.triplea.MapXMLCreator;\r\n+\r\n+import games.strategy.util.AlphanumComparator;\r\n+\r\n+import java.awt.Color;\r\n+import java.awt.FontMetrics;\r\n+import java.awt.Graphics;\r\n+import java.awt.Point;\r\n+import java.awt.Polygon;\r\n+import java.awt.Shape;\r\n+import java.awt.event.ActionEvent;\r\n+import java.awt.event.MouseEvent;\r\n+import java.awt.geom.Area;\r\n+import java.awt.geom.Rectangle2D;\r\n+import java.util.ArrayList;\r\n+import java.util.Collection;\r\n+import java.util.Collections;\r\n+import java.util.HashMap;\r\n+import java.util.LinkedHashSet;\r\n+import java.util.List;\r\n+import java.util.Map;\r\n+import java.util.Map.Entry;\r\n+\r\n+import javax.swing.AbstractAction;\r\n+import javax.swing.JOptionPane;\r\n+import javax.swing.JPanel;\r\n+import javax.swing.SwingUtilities;\r\n+\r\n+import util.image.ConnectionFinder;\r\n+\r\n+/**\r\n+ * \r\n+ * @author Erik von der Osten\r\n+ * \r\n+ */\r\n+public class TerritoryConnectionsPanel extends ImageScrollPanePanel\r\n+{\r\n+\t\r\n+\tString m_selectedTerritory = null;\r\n+\r\n+\tprivate TerritoryConnectionsPanel()\r\n+\t{\r\n+\t\ts_instance = this;\r\n+\t}\r\n+\t\r\n+\tpublic static void layout(final MapXMLCreator mapXMLCreator, final JPanel stepActionPanel)\r\n+\t{\r\n+\t\ts_mapXMLCreator = mapXMLCreator;\r\n+\t\tfinal TerritoryConnectionsPanel panel = new TerritoryConnectionsPanel();\r\n+\t\tpanel.layout(stepActionPanel);\r\n+\t\tmapXMLCreator.setAutoFillAction(new AbstractAction()\r\n+\t\t{\r\n+\t\t\tprivate static final long serialVersionUID = -8508734371454749752L;\r\n+\r\n+\t\t\t@Override\r\n+\t\t\tpublic void actionPerformed(ActionEvent arg0)\r\n+\t\t\t{\r\n+\t\t\t\tpanel.paintPreparation(null);\r\n+\t\t\t\tpanel.repaint();\r\n+\t\t\t}\r\n+\t\t});\r\n+\t}\r\n+\r\n+\tprotected void paintCenterSpecifics(final Graphics g, final String centerName, final FontMetrics fontMetrics, final Point item, final int x_text_start)\r\n+\t{\r\n+\t\tif (centerName.equals(m_selectedTerritory))\r\n+\t\t{\r\n+\t\t\tfinal Rectangle2D stringBounds = fontMetrics.getStringBounds(centerName, g);\r\n+\t\t\tg.setColor(Color.yellow);\r\n+\t\t\tg.fillRect(Math.max(0, x_text_start - 2), Math.max(0, item.y - 6), (int) stringBounds.getWidth() + 4, (int) stringBounds.getHeight());\r\n+\t\t\tg.setColor(Color.red);\r\n+\t\t\tg.drawString(centerName, Math.max(0, x_text_start), item.y + 5);\r\n+\t\t}\r\n+\t\tg.setColor(Color.red);\r\n+\t}\r\n+\t\r\n+\tprotected void paintPreparation(final Map<String, Point> centers)\r\n+\t{\r\n+\t\tif (centers != null && !MapXMLHelper.s_territoyConnections.isEmpty())\r\n+\t\t\treturn;\r\n+\t\tfinal Map<String, List<Area>> territoryAreas = new HashMap<String, List<Area>>();\r\n+\t\tfor (final String territoryName : s_polygons.keySet())\r\n+\t\t{\r\n+\t\t\tfinal List<Polygon> listOfPolygons = s_polygons.get(territoryName);\r\n+\t\t\tfinal List<Area> listOfAreas = new ArrayList<Area>();\r\n+\t\t\tfor (final Polygon p : listOfPolygons)\r\n+\t\t\t{\r\n+\t\t\t\tlistOfAreas.add(new Area(p));\r\n+\t\t\t}\r\n+\t\t\tterritoryAreas.put(territoryName, listOfAreas);\r\n+\r\n+\t\t}\r\n+\t\tfinal String lineWidth = JOptionPane.showInputDialog(null, \"Enter the width of territory border lines on your map? \\r\\n(eg: 1, or 2, etc.)\", \"1\");\r\n+\t\tif (lineWidth == null)\r\n+\t\t\treturn;\r\n+\t\tint scalePixels = 8;\r\n+\t\tdouble minOverlap = 32;\r\n+\t\ttry\r\n+\t\t{\r\n+\t\t\tfinal int lineThickness = Integer.parseInt(lineWidth);\r\n+\t\t\tscalePixels = lineThickness * 4;\r\n+\t\t\tminOverlap = scalePixels * 4;\r\n+\t\t} catch (final NumberFormatException ex)\r\n+\t\t{\r\n+\t\t}\r\n+\t\tif (JOptionPane.showConfirmDialog(null, \"Scale set to \" + scalePixels + \" pixels larger, and minimum overlap set to \" + minOverlap + \" pixels. \\r\\n\"\r\n+\t\t\t\t\t+ \"Do you wish to continue with this? \\r\\nSelect Yes to continue, Select No to override and change the size.\", \"Scale and Overlap Size\", JOptionPane.YES_NO_OPTION) == 1)\r\n+\t\t{\r\n+\t\t\tfinal String scale = JOptionPane.showInputDialog(null,\r\n+\t\t\t\t\t\t\"Enter the number of pixels larger each territory should become? \\r\\n(Normally 4x bigger than the border line width. eg: 4, or 8, etc)\", \"4\");\r\n+\t\t\tif (scale == null)\r\n+\t\t\t\treturn;\r\n+\t\t\ttry\r\n+\t\t\t{\r\n+\t\t\t\tscalePixels = Integer.parseInt(scale);\r\n+\t\t\t} catch (final NumberFormatException ex)\r\n+\t\t\t{\r\n+\t\t\t}\r\n+\t\t\tfinal String overlap = JOptionPane.showInputDialog(null,\r\n+\t\t\t\t\t\t\"Enter the minimum number of overlapping pixels for a connection? \\r\\n(Normally 16x bigger than the border line width. eg: 16, or 32, etc.)\", \"16\");\r\n+\t\t\tif (overlap == null)\r\n+\t\t\t\treturn;\r\n+\t\t\ttry\r\n+\t\t\t{\r\n+\t\t\t\tminOverlap = Integer.parseInt(overlap);\r\n+\t\t\t} catch (final NumberFormatException ex)\r\n+\t\t\t{\r\n+\t\t\t}\r\n+\t\t}\r\n+\t\t\r\n+\t\tMapXMLHelper.s_territoyConnections.clear();\r\n+\t\tSystem.out.print(\"Now Scanning for Connections ... \");\r","path":"src/util/triplea/MapXMLCreator/TerritoryConnectionsPanel.java","position":132,"original_position":132,"commit_id":"2ca68809159145d90fd6f5091de63811d65f7e9f","original_commit_id":"2ca68809159145d90fd6f5091de63811d65f7e9f","user":{"login":"DanVanAtta","id":12397753,"avatar_url":"https://avatars.githubusercontent.com/u/12397753?v=3","gravatar_id":"","url":"https://api.github.com/users/DanVanAtta","html_url":"https://github.com/DanVanAtta","followers_url":"https://api.github.com/users/DanVanAtta/followers","following_url":"https://api.github.com/users/DanVanAtta/following{/other_user}","gists_url":"https://api.github.com/users/DanVanAtta/gists{/gist_id}","starred_url":"https://api.github.com/users/DanVanAtta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanVanAtta/subscriptions","organizations_url":"https://api.github.com/users/DanVanAtta/orgs","repos_url":"https://api.github.com/users/DanVanAtta/repos","events_url":"https://api.github.com/users/DanVanAtta/events{/privacy}","received_events_url":"https://api.github.com/users/DanVanAtta/received_events","type":"User","site_admin":false},"body":"Please remove the System.out","created_at":"2016-02-28T22:13:38Z","updated_at":"2016-02-28T22:13:38Z","html_url":"https://github.com/triplea-game/triplea/pull/485#discussion_r54357558","pull_request_url":"https://api.github.com/repos/triplea-game/triplea/pulls/485","_links":{"self":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/comments/54357558"},"html":{"href":"https://github.com/triplea-game/triplea/pull/485#discussion_r54357558"},"pull_request":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/485"}}},"pull_request":{"url":"https://api.github.com/repos/triplea-game/triplea/pulls/485","id":60989697,"html_url":"https://github.com/triplea-game/triplea/pull/485","diff_url":"https://github.com/triplea-game/triplea/pull/485.diff","patch_url":"https://github.com/triplea-game/triplea/pull/485.patch","issue_url":"https://api.github.com/repos/triplea-game/triplea/issues/485","number":485,"state":"open","locked":false,"title":"Java MapXMLCreator (beta)","user":{"login":"frigoref","id":10353640,"avatar_url":"https://avatars.githubusercontent.com/u/10353640?v=3","gravatar_id":"","url":"https://api.github.com/users/frigoref","html_url":"https://github.com/frigoref","followers_url":"https://api.github.com/users/frigoref/followers","following_url":"https://api.github.com/users/frigoref/following{/other_user}","gists_url":"https://api.github.com/users/frigoref/gists{/gist_id}","starred_url":"https://api.github.com/users/frigoref/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frigoref/subscriptions","organizations_url":"https://api.github.com/users/frigoref/orgs","repos_url":"https://api.github.com/users/frigoref/repos","events_url":"https://api.github.com/users/frigoref/events{/privacy}","received_events_url":"https://api.github.com/users/frigoref/received_events","type":"User","site_admin":false},"body":"Initial version of\r\nJava map XML creator based on previous C/C++ based XML creator.\r\nRun util.triplea.MapXMLCreator.MapXMLCreator.main()\n\n<!-- Reviewable:start -->\n[<img src=\"https://reviewable.io/review_button.svg\" height=\"40\" alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/triplea-game/triplea/485)\n<!-- Reviewable:end -->\n","created_at":"2016-02-28T12:23:20Z","updated_at":"2016-02-28T22:13:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7de61bafbd0c66ebd5018f4dea5714fbe8b38d5c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/triplea-game/triplea/pulls/485/commits","review_comments_url":"https://api.github.com/repos/triplea-game/triplea/pulls/485/comments","review_comment_url":"https://api.github.com/repos/triplea-game/triplea/pulls/comments{/number}","comments_url":"https://api.github.com/repos/triplea-game/triplea/issues/485/comments","statuses_url":"https://api.github.com/repos/triplea-game/triplea/statuses/2ca68809159145d90fd6f5091de63811d65f7e9f","head":{"label":"frigoref:MapXMLCreator_Java","ref":"MapXMLCreator_Java","sha":"2ca68809159145d90fd6f5091de63811d65f7e9f","user":{"login":"frigoref","id":10353640,"avatar_url":"https://avatars.githubusercontent.com/u/10353640?v=3","gravatar_id":"","url":"https://api.github.com/users/frigoref","html_url":"https://github.com/frigoref","followers_url":"https://api.github.com/users/frigoref/followers","following_url":"https://api.github.com/users/frigoref/following{/other_user}","gists_url":"https://api.github.com/users/frigoref/gists{/gist_id}","starred_url":"https://api.github.com/users/frigoref/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frigoref/subscriptions","organizations_url":"https://api.github.com/users/frigoref/orgs","repos_url":"https://api.github.com/users/frigoref/repos","events_url":"https://api.github.com/users/frigoref/events{/privacy}","received_events_url":"https://api.github.com/users/frigoref/received_events","type":"User","site_admin":false},"repo":{"id":52717775,"name":"triplea","full_name":"frigoref/triplea","owner":{"login":"frigoref","id":10353640,"avatar_url":"https://avatars.githubusercontent.com/u/10353640?v=3","gravatar_id":"","url":"https://api.github.com/users/frigoref","html_url":"https://github.com/frigoref","followers_url":"https://api.github.com/users/frigoref/followers","following_url":"https://api.github.com/users/frigoref/following{/other_user}","gists_url":"https://api.github.com/users/frigoref/gists{/gist_id}","starred_url":"https://api.github.com/users/frigoref/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frigoref/subscriptions","organizations_url":"https://api.github.com/users/frigoref/orgs","repos_url":"https://api.github.com/users/frigoref/repos","events_url":"https://api.github.com/users/frigoref/events{/privacy}","received_events_url":"https://api.github.com/users/frigoref/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/frigoref/triplea","description":"TripleA is a turn based strategy game and board game engine, similar to Axis & Allies or Risk.","fork":true,"url":"https://api.github.com/repos/frigoref/triplea","forks_url":"https://api.github.com/repos/frigoref/triplea/forks","keys_url":"https://api.github.com/repos/frigoref/triplea/keys{/key_id}","collaborators_url":"https://api.github.com/repos/frigoref/triplea/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/frigoref/triplea/teams","hooks_url":"https://api.github.com/repos/frigoref/triplea/hooks","issue_events_url":"https://api.github.com/repos/frigoref/triplea/issues/events{/number}","events_url":"https://api.github.com/repos/frigoref/triplea/events","assignees_url":"https://api.github.com/repos/frigoref/triplea/assignees{/user}","branches_url":"https://api.github.com/repos/frigoref/triplea/branches{/branch}","tags_url":"https://api.github.com/repos/frigoref/triplea/tags","blobs_url":"https://api.github.com/repos/frigoref/triplea/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/frigoref/triplea/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/frigoref/triplea/git/refs{/sha}","trees_url":"https://api.github.com/repos/frigoref/triplea/git/trees{/sha}","statuses_url":"https://api.github.com/repos/frigoref/triplea/statuses/{sha}","languages_url":"https://api.github.com/repos/frigoref/triplea/languages","stargazers_url":"https://api.github.com/repos/frigoref/triplea/stargazers","contributors_url":"https://api.github.com/repos/frigoref/triplea/contributors","subscribers_url":"https://api.github.com/repos/frigoref/triplea/subscribers","subscription_url":"https://api.github.com/repos/frigoref/triplea/subscription","commits_url":"https://api.github.com/repos/frigoref/triplea/commits{/sha}","git_commits_url":"https://api.github.com/repos/frigoref/triplea/git/commits{/sha}","comments_url":"https://api.github.com/repos/frigoref/triplea/comments{/number}","issue_comment_url":"https://api.github.com/repos/frigoref/triplea/issues/comments{/number}","contents_url":"https://api.github.com/repos/frigoref/triplea/contents/{+path}","compare_url":"https://api.github.com/repos/frigoref/triplea/compare/{base}...{head}","merges_url":"https://api.github.com/repos/frigoref/triplea/merges","archive_url":"https://api.github.com/repos/frigoref/triplea/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/frigoref/triplea/downloads","issues_url":"https://api.github.com/repos/frigoref/triplea/issues{/number}","pulls_url":"https://api.github.com/repos/frigoref/triplea/pulls{/number}","milestones_url":"https://api.github.com/repos/frigoref/triplea/milestones{/number}","notifications_url":"https://api.github.com/repos/frigoref/triplea/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/frigoref/triplea/labels{/name}","releases_url":"https://api.github.com/repos/frigoref/triplea/releases{/id}","deployments_url":"https://api.github.com/repos/frigoref/triplea/deployments","created_at":"2016-02-28T11:27:20Z","updated_at":"2016-02-28T11:27:28Z","pushed_at":"2016-02-28T16:37:54Z","git_url":"git://github.com/frigoref/triplea.git","ssh_url":"git@github.com:frigoref/triplea.git","clone_url":"https://github.com/frigoref/triplea.git","svn_url":"https://github.com/frigoref/triplea","homepage":null,"size":685888,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"triplea-game:master","ref":"master","sha":"6082762121a7dc1109f29e4b23452024a8a6e5b3","user":{"login":"triplea-game","id":13318615,"avatar_url":"https://avatars.githubusercontent.com/u/13318615?v=3","gravatar_id":"","url":"https://api.github.com/users/triplea-game","html_url":"https://github.com/triplea-game","followers_url":"https://api.github.com/users/triplea-game/followers","following_url":"https://api.github.com/users/triplea-game/following{/other_user}","gists_url":"https://api.github.com/users/triplea-game/gists{/gist_id}","starred_url":"https://api.github.com/users/triplea-game/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/triplea-game/subscriptions","organizations_url":"https://api.github.com/users/triplea-game/orgs","repos_url":"https://api.github.com/users/triplea-game/repos","events_url":"https://api.github.com/users/triplea-game/events{/privacy}","received_events_url":"https://api.github.com/users/triplea-game/received_events","type":"Organization","site_admin":false},"repo":{"id":39766308,"name":"triplea","full_name":"triplea-game/triplea","owner":{"login":"triplea-game","id":13318615,"avatar_url":"https://avatars.githubusercontent.com/u/13318615?v=3","gravatar_id":"","url":"https://api.github.com/users/triplea-game","html_url":"https://github.com/triplea-game","followers_url":"https://api.github.com/users/triplea-game/followers","following_url":"https://api.github.com/users/triplea-game/following{/other_user}","gists_url":"https://api.github.com/users/triplea-game/gists{/gist_id}","starred_url":"https://api.github.com/users/triplea-game/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/triplea-game/subscriptions","organizations_url":"https://api.github.com/users/triplea-game/orgs","repos_url":"https://api.github.com/users/triplea-game/repos","events_url":"https://api.github.com/users/triplea-game/events{/privacy}","received_events_url":"https://api.github.com/users/triplea-game/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/triplea-game/triplea","description":"TripleA is a turn based strategy game and board game engine, similar to Axis & Allies or Risk.","fork":false,"url":"https://api.github.com/repos/triplea-game/triplea","forks_url":"https://api.github.com/repos/triplea-game/triplea/forks","keys_url":"https://api.github.com/repos/triplea-game/triplea/keys{/key_id}","collaborators_url":"https://api.github.com/repos/triplea-game/triplea/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/triplea-game/triplea/teams","hooks_url":"https://api.github.com/repos/triplea-game/triplea/hooks","issue_events_url":"https://api.github.com/repos/triplea-game/triplea/issues/events{/number}","events_url":"https://api.github.com/repos/triplea-game/triplea/events","assignees_url":"https://api.github.com/repos/triplea-game/triplea/assignees{/user}","branches_url":"https://api.github.com/repos/triplea-game/triplea/branches{/branch}","tags_url":"https://api.github.com/repos/triplea-game/triplea/tags","blobs_url":"https://api.github.com/repos/triplea-game/triplea/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/triplea-game/triplea/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/triplea-game/triplea/git/refs{/sha}","trees_url":"https://api.github.com/repos/triplea-game/triplea/git/trees{/sha}","statuses_url":"https://api.github.com/repos/triplea-game/triplea/statuses/{sha}","languages_url":"https://api.github.com/repos/triplea-game/triplea/languages","stargazers_url":"https://api.github.com/repos/triplea-game/triplea/stargazers","contributors_url":"https://api.github.com/repos/triplea-game/triplea/contributors","subscribers_url":"https://api.github.com/repos/triplea-game/triplea/subscribers","subscription_url":"https://api.github.com/repos/triplea-game/triplea/subscription","commits_url":"https://api.github.com/repos/triplea-game/triplea/commits{/sha}","git_commits_url":"https://api.github.com/repos/triplea-game/triplea/git/commits{/sha}","comments_url":"https://api.github.com/repos/triplea-game/triplea/comments{/number}","issue_comment_url":"https://api.github.com/repos/triplea-game/triplea/issues/comments{/number}","contents_url":"https://api.github.com/repos/triplea-game/triplea/contents/{+path}","compare_url":"https://api.github.com/repos/triplea-game/triplea/compare/{base}...{head}","merges_url":"https://api.github.com/repos/triplea-game/triplea/merges","archive_url":"https://api.github.com/repos/triplea-game/triplea/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/triplea-game/triplea/downloads","issues_url":"https://api.github.com/repos/triplea-game/triplea/issues{/number}","pulls_url":"https://api.github.com/repos/triplea-game/triplea/pulls{/number}","milestones_url":"https://api.github.com/repos/triplea-game/triplea/milestones{/number}","notifications_url":"https://api.github.com/repos/triplea-game/triplea/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/triplea-game/triplea/labels{/name}","releases_url":"https://api.github.com/repos/triplea-game/triplea/releases{/id}","deployments_url":"https://api.github.com/repos/triplea-game/triplea/deployments","created_at":"2015-07-27T09:32:58Z","updated_at":"2016-02-25T23:17:40Z","pushed_at":"2016-02-28T16:37:59Z","git_url":"git://github.com/triplea-game/triplea.git","ssh_url":"git@github.com:triplea-game/triplea.git","clone_url":"https://github.com/triplea-game/triplea.git","svn_url":"https://github.com/triplea-game/triplea","homepage":null,"size":690780,"stargazers_count":20,"watchers_count":20,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":62,"forks":9,"open_issues":62,"watchers":20,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/485"},"html":{"href":"https://github.com/triplea-game/triplea/pull/485"},"issue":{"href":"https://api.github.com/repos/triplea-game/triplea/issues/485"},"comments":{"href":"https://api.github.com/repos/triplea-game/triplea/issues/485/comments"},"review_comments":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/485/comments"},"review_comment":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/485/commits"},"statuses":{"href":"https://api.github.com/repos/triplea-game/triplea/statuses/2ca68809159145d90fd6f5091de63811d65f7e9f"}}}}