{"action":"created","comment":{"url":"https://api.github.com/repos/codice/alliance/pulls/comments/67713734","id":67713734,"diff_hunk":"@@ -0,0 +1,67 @@\n+/**\n+ * Copyright (c) Codice Foundation\n+ * <p/>\n+ * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser\n+ * General Public License as published by the Free Software Foundation, either version 3 of the\n+ * License, or any later version.\n+ * <p/>\n+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\n+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ * Lesser General Public License for more details. A copy of the GNU Lesser General Public License\n+ * is distributed along with this program and can be found at\n+ * <http://www.gnu.org/licenses/lgpl.html>.\n+ */\n+package org.codice.alliance.imaging.chip.transformer;\n+\n+import java.awt.image.BufferedImage;\n+import java.io.Serializable;\n+import java.util.Map;\n+\n+/**\n+ * Does the translation from chip coordinates of the overview image to the chip coordinates\n+ * on the full-size image.\n+ */\n+public class CropAdapter {\n+    /**\n+     *\n+     * @param original the full-sized image that the chip will be taken from.\n+     * @param overview a scaled-down version of the same image.\n+     * @param args A map containing values for the top left corner of the chip (x, y) and the\n+     *             height and width of the chip (w, h) as taken from the overview image.\n+     * @return a vector of [x, y, w, h] translated to the full size image.\n+     */\n+    public int[] scaleChip(BufferedImage original, BufferedImage overview, Map<String, Serializable> args) {\n+\n+        if (args == null) {\n+            throw new IllegalArgumentException(\"method argument 'args' may not be null.\");\n+        }\n+\n+        int x = getArg(args, \"x\");\n+        int y = getArg(args, \"y\");\n+        int w = getArg(args, \"w\");\n+        int h = getArg(args, \"h\");\n+\n+        double scaleFactor = 1.0;\n+\n+        if (original != null && overview != null) {\n+            scaleFactor = original.getWidth() / overview.getWidth();","path":"catalog/imaging/catalog-imaging-transformer-chip/src/main/java/org/codice/alliance/imaging/chip/transformer/CropAdapter.java","position":47,"original_position":47,"commit_id":"63694c1f8e1eaff624582b69051a5415448d19c2","original_commit_id":"63694c1f8e1eaff624582b69051a5415448d19c2","user":{"login":"dcruver","id":5922390,"avatar_url":"https://avatars.githubusercontent.com/u/5922390?v=3","gravatar_id":"","url":"https://api.github.com/users/dcruver","html_url":"https://github.com/dcruver","followers_url":"https://api.github.com/users/dcruver/followers","following_url":"https://api.github.com/users/dcruver/following{/other_user}","gists_url":"https://api.github.com/users/dcruver/gists{/gist_id}","starred_url":"https://api.github.com/users/dcruver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcruver/subscriptions","organizations_url":"https://api.github.com/users/dcruver/orgs","repos_url":"https://api.github.com/users/dcruver/repos","events_url":"https://api.github.com/users/dcruver/events{/privacy}","received_events_url":"https://api.github.com/users/dcruver/received_events","type":"User","site_admin":false},"body":"No, the amount that we scale on both sides is the same as a percentage of their overall length.  Differing x and y scale factors would result in an aspect ratio that differs from the original image.  So if the original image is 2048x1024 and we scale it down to a max of 1024, then we're scaling both sides by .5 even though it's not a square image.","created_at":"2016-06-20T15:47:50Z","updated_at":"2016-06-20T15:47:50Z","html_url":"https://github.com/codice/alliance/pull/68#discussion_r67713734","pull_request_url":"https://api.github.com/repos/codice/alliance/pulls/68","_links":{"self":{"href":"https://api.github.com/repos/codice/alliance/pulls/comments/67713734"},"html":{"href":"https://github.com/codice/alliance/pull/68#discussion_r67713734"},"pull_request":{"href":"https://api.github.com/repos/codice/alliance/pulls/68"}}},"pull_request":{"url":"https://api.github.com/repos/codice/alliance/pulls/68","id":74175901,"html_url":"https://github.com/codice/alliance/pull/68","diff_url":"https://github.com/codice/alliance/pull/68.diff","patch_url":"https://github.com/codice/alliance/pull/68.patch","issue_url":"https://api.github.com/repos/codice/alliance/issues/68","number":68,"state":"open","locked":false,"title":"Cal 67 - Modify Chipping Service to Chip by Pixel Instead of Lon/Lat.","user":{"login":"dcruver","id":5922390,"avatar_url":"https://avatars.githubusercontent.com/u/5922390?v=3","gravatar_id":"","url":"https://api.github.com/users/dcruver","html_url":"https://github.com/dcruver","followers_url":"https://api.github.com/users/dcruver/followers","following_url":"https://api.github.com/users/dcruver/following{/other_user}","gists_url":"https://api.github.com/users/dcruver/gists{/gist_id}","starred_url":"https://api.github.com/users/dcruver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcruver/subscriptions","organizations_url":"https://api.github.com/users/dcruver/orgs","repos_url":"https://api.github.com/users/dcruver/repos","events_url":"https://api.github.com/users/dcruver/events{/privacy}","received_events_url":"https://api.github.com/users/dcruver/received_events","type":"User","site_admin":false},"body":"#### What does this PR do?\r\nThis changes adds a method to the ChipService to chip by pixel.  There are also fixes to the original chip method implementation and changes to the Chip MetacardTransformer so that it now uses the chip-by-pixel method.\r\n\r\n#### Who is reviewing it?\r\n@jlcsmith \r\n@jaymcnallie \r\n@spearskw \r\n\r\n#### How should this be tested?\r\n1) ingest a NITF\r\n2) request a chip from the metacard transformer at https://localhost:8993/services/catalog/sources/ddf.distribution/{{resource-id}}?transform=chip&x={{top-left-corner-x}}&y={{top-left-corner-y}}&w={{chip-width}}&h={{chip-height}.\r\n  --verify that the returned image is the size requested and appears to be the right area.\r\n\r\n#### Any background context you want to provide?\r\n#### What are the relevant tickets?\r\n  CAL-67\r\n\r\n#### Screenshots (if appropriate)\r\n#### Checklist:\r\n- [ ] Documentation Updated\r\n- [ ] Update / Add Unit Tests\r\n- [ ] Update / Add Integration Tests","created_at":"2016-06-17T01:05:12Z","updated_at":"2016-06-20T15:47:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3ea372297152d964f04477261b7f3c6d61353602","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/codice/alliance/pulls/68/commits","review_comments_url":"https://api.github.com/repos/codice/alliance/pulls/68/comments","review_comment_url":"https://api.github.com/repos/codice/alliance/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codice/alliance/issues/68/comments","statuses_url":"https://api.github.com/repos/codice/alliance/statuses/63694c1f8e1eaff624582b69051a5415448d19c2","head":{"label":"dcruver:CAL-67","ref":"CAL-67","sha":"63694c1f8e1eaff624582b69051a5415448d19c2","user":{"login":"dcruver","id":5922390,"avatar_url":"https://avatars.githubusercontent.com/u/5922390?v=3","gravatar_id":"","url":"https://api.github.com/users/dcruver","html_url":"https://github.com/dcruver","followers_url":"https://api.github.com/users/dcruver/followers","following_url":"https://api.github.com/users/dcruver/following{/other_user}","gists_url":"https://api.github.com/users/dcruver/gists{/gist_id}","starred_url":"https://api.github.com/users/dcruver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcruver/subscriptions","organizations_url":"https://api.github.com/users/dcruver/orgs","repos_url":"https://api.github.com/users/dcruver/repos","events_url":"https://api.github.com/users/dcruver/events{/privacy}","received_events_url":"https://api.github.com/users/dcruver/received_events","type":"User","site_admin":false},"repo":{"id":53620821,"name":"alliance","full_name":"dcruver/alliance","owner":{"login":"dcruver","id":5922390,"avatar_url":"https://avatars.githubusercontent.com/u/5922390?v=3","gravatar_id":"","url":"https://api.github.com/users/dcruver","html_url":"https://github.com/dcruver","followers_url":"https://api.github.com/users/dcruver/followers","following_url":"https://api.github.com/users/dcruver/following{/other_user}","gists_url":"https://api.github.com/users/dcruver/gists{/gist_id}","starred_url":"https://api.github.com/users/dcruver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcruver/subscriptions","organizations_url":"https://api.github.com/users/dcruver/orgs","repos_url":"https://api.github.com/users/dcruver/repos","events_url":"https://api.github.com/users/dcruver/events{/privacy}","received_events_url":"https://api.github.com/users/dcruver/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dcruver/alliance","description":"","fork":true,"url":"https://api.github.com/repos/dcruver/alliance","forks_url":"https://api.github.com/repos/dcruver/alliance/forks","keys_url":"https://api.github.com/repos/dcruver/alliance/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dcruver/alliance/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dcruver/alliance/teams","hooks_url":"https://api.github.com/repos/dcruver/alliance/hooks","issue_events_url":"https://api.github.com/repos/dcruver/alliance/issues/events{/number}","events_url":"https://api.github.com/repos/dcruver/alliance/events","assignees_url":"https://api.github.com/repos/dcruver/alliance/assignees{/user}","branches_url":"https://api.github.com/repos/dcruver/alliance/branches{/branch}","tags_url":"https://api.github.com/repos/dcruver/alliance/tags","blobs_url":"https://api.github.com/repos/dcruver/alliance/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dcruver/alliance/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dcruver/alliance/git/refs{/sha}","trees_url":"https://api.github.com/repos/dcruver/alliance/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dcruver/alliance/statuses/{sha}","languages_url":"https://api.github.com/repos/dcruver/alliance/languages","stargazers_url":"https://api.github.com/repos/dcruver/alliance/stargazers","contributors_url":"https://api.github.com/repos/dcruver/alliance/contributors","subscribers_url":"https://api.github.com/repos/dcruver/alliance/subscribers","subscription_url":"https://api.github.com/repos/dcruver/alliance/subscription","commits_url":"https://api.github.com/repos/dcruver/alliance/commits{/sha}","git_commits_url":"https://api.github.com/repos/dcruver/alliance/git/commits{/sha}","comments_url":"https://api.github.com/repos/dcruver/alliance/comments{/number}","issue_comment_url":"https://api.github.com/repos/dcruver/alliance/issues/comments{/number}","contents_url":"https://api.github.com/repos/dcruver/alliance/contents/{+path}","compare_url":"https://api.github.com/repos/dcruver/alliance/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dcruver/alliance/merges","archive_url":"https://api.github.com/repos/dcruver/alliance/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dcruver/alliance/downloads","issues_url":"https://api.github.com/repos/dcruver/alliance/issues{/number}","pulls_url":"https://api.github.com/repos/dcruver/alliance/pulls{/number}","milestones_url":"https://api.github.com/repos/dcruver/alliance/milestones{/number}","notifications_url":"https://api.github.com/repos/dcruver/alliance/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dcruver/alliance/labels{/name}","releases_url":"https://api.github.com/repos/dcruver/alliance/releases{/id}","deployments_url":"https://api.github.com/repos/dcruver/alliance/deployments","created_at":"2016-03-10T22:13:58Z","updated_at":"2016-03-10T22:14:00Z","pushed_at":"2016-06-17T00:58:34Z","git_url":"git://github.com/dcruver/alliance.git","ssh_url":"git@github.com:dcruver/alliance.git","clone_url":"https://github.com/dcruver/alliance.git","svn_url":"https://github.com/dcruver/alliance","homepage":null,"size":18317,"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":"codice:master","ref":"master","sha":"f99a5c78497b93d2e8e90e62719c762cb2c0f9a7","user":{"login":"codice","id":2386734,"avatar_url":"https://avatars.githubusercontent.com/u/2386734?v=3","gravatar_id":"","url":"https://api.github.com/users/codice","html_url":"https://github.com/codice","followers_url":"https://api.github.com/users/codice/followers","following_url":"https://api.github.com/users/codice/following{/other_user}","gists_url":"https://api.github.com/users/codice/gists{/gist_id}","starred_url":"https://api.github.com/users/codice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codice/subscriptions","organizations_url":"https://api.github.com/users/codice/orgs","repos_url":"https://api.github.com/users/codice/repos","events_url":"https://api.github.com/users/codice/events{/privacy}","received_events_url":"https://api.github.com/users/codice/received_events","type":"Organization","site_admin":false},"repo":{"id":52804523,"name":"alliance","full_name":"codice/alliance","owner":{"login":"codice","id":2386734,"avatar_url":"https://avatars.githubusercontent.com/u/2386734?v=3","gravatar_id":"","url":"https://api.github.com/users/codice","html_url":"https://github.com/codice","followers_url":"https://api.github.com/users/codice/followers","following_url":"https://api.github.com/users/codice/following{/other_user}","gists_url":"https://api.github.com/users/codice/gists{/gist_id}","starred_url":"https://api.github.com/users/codice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codice/subscriptions","organizations_url":"https://api.github.com/users/codice/orgs","repos_url":"https://api.github.com/users/codice/repos","events_url":"https://api.github.com/users/codice/events{/privacy}","received_events_url":"https://api.github.com/users/codice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codice/alliance","description":"","fork":false,"url":"https://api.github.com/repos/codice/alliance","forks_url":"https://api.github.com/repos/codice/alliance/forks","keys_url":"https://api.github.com/repos/codice/alliance/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codice/alliance/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codice/alliance/teams","hooks_url":"https://api.github.com/repos/codice/alliance/hooks","issue_events_url":"https://api.github.com/repos/codice/alliance/issues/events{/number}","events_url":"https://api.github.com/repos/codice/alliance/events","assignees_url":"https://api.github.com/repos/codice/alliance/assignees{/user}","branches_url":"https://api.github.com/repos/codice/alliance/branches{/branch}","tags_url":"https://api.github.com/repos/codice/alliance/tags","blobs_url":"https://api.github.com/repos/codice/alliance/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codice/alliance/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codice/alliance/git/refs{/sha}","trees_url":"https://api.github.com/repos/codice/alliance/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codice/alliance/statuses/{sha}","languages_url":"https://api.github.com/repos/codice/alliance/languages","stargazers_url":"https://api.github.com/repos/codice/alliance/stargazers","contributors_url":"https://api.github.com/repos/codice/alliance/contributors","subscribers_url":"https://api.github.com/repos/codice/alliance/subscribers","subscription_url":"https://api.github.com/repos/codice/alliance/subscription","commits_url":"https://api.github.com/repos/codice/alliance/commits{/sha}","git_commits_url":"https://api.github.com/repos/codice/alliance/git/commits{/sha}","comments_url":"https://api.github.com/repos/codice/alliance/comments{/number}","issue_comment_url":"https://api.github.com/repos/codice/alliance/issues/comments{/number}","contents_url":"https://api.github.com/repos/codice/alliance/contents/{+path}","compare_url":"https://api.github.com/repos/codice/alliance/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codice/alliance/merges","archive_url":"https://api.github.com/repos/codice/alliance/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codice/alliance/downloads","issues_url":"https://api.github.com/repos/codice/alliance/issues{/number}","pulls_url":"https://api.github.com/repos/codice/alliance/pulls{/number}","milestones_url":"https://api.github.com/repos/codice/alliance/milestones{/number}","notifications_url":"https://api.github.com/repos/codice/alliance/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codice/alliance/labels{/name}","releases_url":"https://api.github.com/repos/codice/alliance/releases{/id}","deployments_url":"https://api.github.com/repos/codice/alliance/deployments","created_at":"2016-02-29T16:10:33Z","updated_at":"2016-06-14T21:40:26Z","pushed_at":"2016-06-20T14:33:23Z","git_url":"git://github.com/codice/alliance.git","ssh_url":"git@github.com:codice/alliance.git","clone_url":"https://github.com/codice/alliance.git","svn_url":"https://github.com/codice/alliance","homepage":null,"size":18596,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":7,"forks":20,"open_issues":7,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codice/alliance/pulls/68"},"html":{"href":"https://github.com/codice/alliance/pull/68"},"issue":{"href":"https://api.github.com/repos/codice/alliance/issues/68"},"comments":{"href":"https://api.github.com/repos/codice/alliance/issues/68/comments"},"review_comments":{"href":"https://api.github.com/repos/codice/alliance/pulls/68/comments"},"review_comment":{"href":"https://api.github.com/repos/codice/alliance/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codice/alliance/pulls/68/commits"},"statuses":{"href":"https://api.github.com/repos/codice/alliance/statuses/63694c1f8e1eaff624582b69051a5415448d19c2"}}}}
{"actor":{"display_login":"dcruver"}}