-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCountryMapMouseListener.ctxt
37 lines (37 loc) · 4.59 KB
/
CountryMapMouseListener.ctxt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#BlueJ class context
comment0.params=model
comment0.target=void\ setModel(CountryMapModel)
comment0.text=\r\n\ Assocates\ a\ data\ model\ for\ this\ listener.\ \r\n\ Other\ methods\ of\ this\ class\ rely\ on\ the\ existence\ of\ associated\ model.\ \r\n\ User\ is\ responsible\ for\ providing\ the\ valid\ data\ model\ before\ the\ listener\ \r\n\ instance\ can\ be\ used.\r\n\ \r\n\ @param\ model\ the\ data\ model\ to\ be\ associated.\r\n
comment1.params=e
comment1.target=void\ mouseClicked(java.awt.event.MouseEvent)
comment1.text=\r\n\ Implements\ to\ process\ a\ mouse\ clicked\ event\ as\ defined\ in\ MouseListener.\ \r\n\ Implementation\ should\ check\ the\ current\ mode\ to\ determine\ and\ perform\ a\ suitable\ action,\ \r\n\ such\ as\ zooming\ in/out\ a\ photo\ in\ browse\ mode,\ adding\ a\ new\ photo\ in\ pin\ mode,\ or\ remove\ \r\n\ an\ existing\ photo\ in\ detele\ mode.\ See\ also\ CountryMapModel.MODE_BROWSE,\ CountryMapModel.MODE_PIN\ \r\n\ and\ CountryMapModel.MODE_DELETE.\r\n
comment10.params=image
comment10.target=double\ findRegularScale(comp102x.ColorImage)
comment10.text=\r\n\ Calculates\ a\ scale\ factor\ to\ fit\ the\ image\ in\ regular\ format.\r\n
comment11.params=imgWidth\ imgHeight\ targetWidth\ targetHeight
comment11.target=double\ findTargetScale(int,\ int,\ int,\ int)
comment11.text=\r\n\ Calculates\ a\ scale\ factor\ to\ fit\ the\ suggested\ target\ dimension.\ \r\n
comment12.params=x\ y\ image
comment12.target=boolean\ isInsideImage(int,\ int,\ comp102x.ColorImage)
comment12.text=\r\n\ Tests\ if\ a\ point\ lies\ inside\ the\ specified\ image.\ It\ also\ considers\ the\ current\ scale\ factor\ of\ the\ image.\r\n\ \r\n\ @return\ true\ if\ the\ point\ lies\ within\ the\ scaled\ bound\ of\ the\ input\ image.\r\n
comment2.params=e
comment2.target=void\ mouseEntered(java.awt.event.MouseEvent)
comment3.params=e
comment3.target=void\ mouseExited(java.awt.event.MouseEvent)
comment4.params=e
comment4.target=void\ mousePressed(java.awt.event.MouseEvent)
comment5.params=e
comment5.target=void\ mouseReleased(java.awt.event.MouseEvent)
comment6.params=e
comment6.target=void\ doBrowsePhoto(java.awt.event.MouseEvent)
comment6.text=\r\n\ Processes\ mouse\ clicks\ while\ the\ program\ is\ in\ browse\ mode.\ \r\n\ This\ method\ is\ called\ only\ after\ a\ mouse\ click\ is\ received\ while\ in\ browse\ mode.\ \r\n\ If\ a\ left\ mouse\ button\ click\ hits\ a\ photo,\ it\ enlarges\ the\ photo\ to\ a\ regular\ format.\ \r\n\ If\ a\ right\ mouse\ button\ click\ hits\ a\ photo,\ it\ shrinks\ the\ photo\ to\ a\ thumbnail\ format.\r\n\ \r\n\ Unknown\ issue\:\ there\ is\ no\ gurantee\ to\ determine\ the\ z-order\ of\ existing\ photos.\ \r\n\ Canvas\ provides\ no\ accessor\ to\ retrieve\ z-order\ information\ which\ might\ be\ altered\ by\ the\ user\ \r\n\ through\ its\ UI.\r\n\ \r\n\ Implementation\ is\ suggested\ to\ loop\ through\ all\ the\ photos\ and\ see\ if\ a\ hit\ is\ detected,\ and\ \r\n\ resize\ the\ target\ photo\ by\ setting\ an\ appropriate\ scale\ factor.\ Users\ may\ find\ the\ following\ \r\n\ methods\ useful.\ \r\n\ Methods\ from\ MouseEvent\ can\ gather\ information\ such\ as\ the\ coordinate\ of\ the\ event,\ \r\n\ the\ button\ which\ produces\ the\ event.\ Model.getPhotos()\ helps\ to\ get\ an\ array\ copy\ of\ the\ photos.\r\n\ Helper\ methods\ findRegularScale(ColorImage)\ and\ findThumbnailScale(ColorImage)\ calculate\r\n\ the\ scale\ factor\ values.\ isInsideImage(int,\ int,\ ColorImage)\ tests\ if\ a\ position\ lies\ inside\ \r\n\ an\ image.\r\n
comment7.params=e
comment7.target=void\ doPinNewPhoto(java.awt.event.MouseEvent)
comment7.text=\r\n\ Processes\ mouse\ clicks\ while\ the\ program\ is\ in\ pin\ mode.\ \r\n\ This\ method\ is\ called\ only\ after\ a\ mouse\ click\ is\ received\ while\ in\ pin\ mode.\ \r\n\ A\ new\ ColorImage\ will\ be\ loaded\ and\ pinned\ at\ the\ mouse\ location.\ \r\n\ The\ photo\ will\ be\ initially\ scaled\ to\ a\ thumbnail\ format.\r\n\ Before\ this\ method\ finishes,\ it\ updates\ the\ model\ back\ to\ browse\ mode.\r\n
comment8.params=e
comment8.target=void\ doRemovePhoto(java.awt.event.MouseEvent)
comment8.text=\r\n\ Processes\ mouse\ clicks\ while\ the\ program\ is\ in\ \ delete\ mode.\ \r\n\ This\ method\ is\ called\ only\ after\ a\ mouse\ click\ is\ received\ whlie\ in\ delete\ mode.\r\n\ If\ the\ moues\ click\ hits\ an\ existing\ photo,\ the\ target\ photo\ is\ removed\ from\ the\ \r\n\ model.\ This\ method\ ends\ by\ updaing\ the\ model\ to\ browse\ mode.\r\n
comment9.params=image
comment9.target=double\ findThumbnailScale(comp102x.ColorImage)
comment9.text=\r\n\ Calculates\ a\ scale\ factor\ to\ fit\ the\ image\ in\ thumbnail\ format.\r\n
numComments=13