{"id":1836,"date":"2013-05-18T10:33:09","date_gmt":"2013-05-18T10:33:09","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=1836"},"modified":"2017-01-27T14:32:29","modified_gmt":"2017-01-27T05:32:29","slug":"javascript-%ed%81%b4%eb%9e%98%ec%8a%a4-%ec%a0%95%ec%9d%98-api-%e3%85%a1-23","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=1836","title":{"rendered":"[JavaScript] \ud074\ub798\uc2a4 \uc815\uc758 API \u3161 2\/3"},"content":{"rendered":"<p><P>\ucd1d 5\uac1c\uc758 \ud074\ub798\uc2a4\uac00 \uc874\uc7ac\ud558\ub294\ub370 \uba3c\uc800 \uac00\uc7a5 \uac04\ub2e8\ud55c Coordinate \ud074\ub798\uc2a4\ub97c \uc815\uc758\ud558\uba74 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<pre>var Coordinate = Class({\r\n    name: \"Coordinate\",\r\n    construct: function(x, y) {\r\n        this._x = x;\r\n        this._y = y;\r\n    },\r\n    methods: {\r\n        getX: function() {\r\n            return this._x;\r\n        },\r\n        getY: function() {\r\n            return this._y;\r\n        },\r\n        toString: function() {\r\n            return \"(\" + this._x + \", \" + this._y + \")\";\r\n        }\r\n    }\r\n});<\/pre>\n<p>\uc55e\uc11c \uc5b8\uae09\ud588\ub4ef\uc774 \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8\uc5d0\uc11c \ud074\ub798\uc2a4\uc758 \uc815\uc758\ub294 \uac1c\ubc1c\uc790 \uc2a4\uc2a4\ub85c\uc5d0 \ub300\ud55c \uc57d\uc18d\uc774 \ud544\uc694\ud558\ub2e4\uace0 \ud558\uc600\uc2b5\ub2c8\ub2e4. \uadf8 \uc57d\uc18d\uc5d0 \ud574\ub2f9\ud558\ub294 \ubd80\ubd84\uc774 \ubc14\ub85c 4,5\ubc88 \ucf54\ub4dc\uc5d0 \uc788\ub294 _x, _y \ubcc0\uc218\uc785\ub2c8\ub2e4. \ubcc0\uc218\uba85 \uc55e\uc5d0 \ubc11\uc904(_)\uc744 \ud558\uc600\uc74c\uc73c\ub85c \ud574\uc11c \uc774 \ubcc0\uc218\ub294 private \ubcc0\uc218\ub77c\ub294 \uc57d\uc18d\uc744 \uc815\ud55c \uac83\uc785\ub2c8\ub2e4. \uac1c\ubc1c\uc790 \uc2a4\uc2a4\ub85c\uc758 \uc57d\uc18d\uc774\ubbc0\ub85c \uc774 \uc57d\uc18d\uc744 \uae7c\ub2e4\uace0 \ud558\uc5ec\ub3c4 \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8\ub294 \uc5b4\ub5a4\ud55c \uc624\ub958\ub97c \uc81c\uacf5\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \ubb3c\ub860 \uc774\ub7ec\ud55c \uc57d\uc18d\uc5d0 \ub300\ud574\uc11c \uacbd\uace0\ub97c \uc81c\uacf5\ud558\ub3c4\ub85d \ud560 \uc218 \uc788\uc73c\ub098 \uadf8\ub807\uac8c \ub418\uba74 \ud074\ub798\uc2a4 \uc815\uc758 API\uac00 \ub354\uc6b1 \ubcf5\uc7a1\ud574\uc9c0\uac8c \ub420 \uac83\uc785\ub2c8\ub2e4. \uadf8\ub9ac\uace0 7\ubc88\uc758 methods \uac1d\uccb4\uc5d0 \ud544\uc694\ud55c \ub9e4\uc11c\ub4dc\ub97c \ucd94\uac00\ud558\uc600\uc2b5\ub2c8\ub2e4. <BR><BR>\uc774\uc81c \ub2e4\uc74c\uc740 \ucd94\uc0c1 \ud074\ub798\uc2a4\uc778 Shape \ud074\ub798\uc2a4\uc5d0 \ub300\ud55c \ucf54\ub4dc\uc785\ub2c8\ub2e4.<\/p>\n<pre>var aShape = Class({\r\n    name: \"aShape\",\r\n    methods: { \r\n        draw: function() { throw \"abstract method\"; }\r\n    }\r\n});<\/pre>\n<p>\ucf54\ub4dc\ub97c \uc0b4\ud3b4\ubcf4\uba74, 4\ubc88\uc5d0 draw\ub77c\ub294 \ucd94\uc0c1 \ub9e4\uc11c\ub4dc\ub97c \uc81c\uacf5\ud558\uc600\uc2b5\ub2c8\ub2e4. draw \ub9e4\uc11c\ub4dc \uc5ed\uc2dc \ucd94\uc0c1 \ub9e4\uc11c\ub4dc\ub2e4\ub77c\ub294 \uc57d\uc18d\uc774\uc9c0 \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \uc5b8\uc5b4 \ucc28\uc6d0\uc5d0\uc11c \ucd94\uc0c1 \ub9e4\uc11c\ub4dc\ub85c \uac15\uc81c\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \ub300\uc2e0 \uc774 \ub9e4\uc11c\ub4dc\ub97c \ud638\ucd9c\ud558\uac8c \ub418\uba74 \uc608\uc678\ub97c \ubc1c\uc0dd\ud558\ub3c4\ub85d \ud558\uc600\uc2b5\ub2c8\ub2e4.<BR><BR>\ub2e4\uc74c\uc73c\ub85c \uc704\uc758 \ucd94\uc0c1\ud074\ub798\uc2a4\uc778 Shape\ub97c \uad6c\ud604\ud558\ub294 Rectangle\uc640 Circle \ud074\ub798\uc2a4\uc5d0 \ub300\ud55c \ucf54\ub4dc\ub97c \uc0b4\ud3b4\ubcf4\uaca0\uc2b5\ub2c8\ub2e4.<\/p>\n<pre>var Rectangle = Class({\r\n    name: \"Rectangle\",\r\n    construct: function(w, h) {\r\n        this._width = w;\r\n        this._height = h;\r\n    },\r\n    methods: {  \r\n        draw: function() { \r\n            alert(\"draw Rectangle\");\r\n        },\r\n        getWidth: function() {\r\n            return this._width;\r\n        },  \r\n        getHeight: function() {\r\n            return this._height;\r\n        }\r\n    },\r\n    requires: [aShape]\r\n});\r\n\r\nvar Circle = Class({\r\n    name: \"Circle\",\r\n    construct: function(x, y, r) {\r\n        this._x = x;\r\n        this._y = y;\r\n        this._r = r;\r\n    },\r\n    methods: {\r\n        draw: function() {\r\n            alert(\"draw Circle\");\r\n        },\r\n        getCenter: function() {\r\n            return new Coordinate(this._x, this._y);\r\n        },\r\n        getRadius: function() {\r\n            return this._r;\r\n        }\r\n    },\r\n    requires: [aShape] \r\n});<\/pre>\n<p>\ub3d9\uc2dc\uc5d0 Rectangle\uc640 Circle \ud074\ub798\uc2a4\uc5d0 \ub300\ud55c \ucf54\ub4dc\ub97c \ubcf4\uc774\ub294 \uc774\uc720\ub294 \uc774 \ub450\uac1c\uac00 \uc11c\ub85c \ub3d9\uc77c\ud55c \uad6c\uc870\ub97c \uac16\uace0 \uc788\uc74c\uc744 \uac15\uc870\ud558\uae30 \uc704\ud568\uc785\ub2c8\ub2e4. \uc774 \ub450 \ud074\ub798\uc2a4\ub294 Shape\uc758 \ucd94\uc0c1 \ub9e4\uc11c\ub4dc\uc778 draw\ub97c \ubd84\uba85\ud788 \uad6c\ud604\ud558\uace0 \uc788\uc73c\uba70 \uac01\uae30 \uc790\uc2e0\uc5d0\uac8c \ub9de\ub294 \ub9e4\uc11c\ub4dc\ub97c \ucd94\uac00\uc801\uc73c\ub85c \uc815\uc758\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. \uc5ec\uae30\uc11c \ucd94\uc0c1\ub9e4\uc11c\ub4dc\ub97c \uad6c\ud604\ud558\uace0 \uc788\ub294\uc9c0\uc5d0 \ub300\ud55c \uac80\uc0ac\ub294 18\ubc88\uacfc 39\ubc88\uc758 \ucf54\ub4dc\uc5d0\uc11c\ucc98\ub7fc requires \uc18d\uc131\uc744 \ud1b5\ud574 \uac80\uc0ac\ub97c \ud574\uc8fc\uac8c \ub429\ub2c8\ub2e4. \ub9cc\uc57d \uc774 requires \uc18d\uc131\uc744 \ud1b5\ud574 \ucd94\uc0c1 \ub9e4\uc11c\ub4dc\ub97c \uad6c\ud604\ud558\uc9c0 \uc54a\uc558\uc744 \uacbd\uc6b0 \uc608\uc678\ub97c \uce5c\uc808\ud558\uac8c \uc608\uc678\ub97c \ubc1c\uc0dd\ud574 \uc8fc\ub3c4\ub85d \ud074\ub798\uc2a4 \uc815\uc758 API\ub97c \uad6c\ud604\ud558\uc600\uc2b5\ub2c8\ub2e4.<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ucd1d 5\uac1c\uc758 \ud074\ub798\uc2a4\uac00 \uc874\uc7ac\ud558\ub294\ub370 \uba3c\uc800 \uac00\uc7a5 \uac04\ub2e8\ud55c Coordinate \ud074\ub798\uc2a4\ub97c \uc815\uc758\ud558\uba74 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4. var Coordinate = Class({ name: &#8220;Coordinate&#8221;, construct: function(x, y) { this._x = x; this._y = y; }, methods: { getX: function() { return this._x; }, getY: function() { return this._y; }, toString: function() { return &#8220;(&#8221; + this._x + &#8220;, &#8221; + this._y &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=1836\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;[JavaScript] \ud074\ub798\uc2a4 \uc815\uc758 API \u3161 2\/3&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[88],"tags":[],"class_list":["post-1836","post","type-post","status-publish","format-standard","hentry","category-javascript"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/1836","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1836"}],"version-history":[{"count":1,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/1836\/revisions"}],"predecessor-version":[{"id":2984,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/1836\/revisions\/2984"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1836"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1836"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1836"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}