Java Reference
In-Depth Information
MapLayer
CartographicMap
1..n
Image mapImage
void addSite(MapSite)
void addLink(MapLink)
void addArea(MapArea)
void setVisible(boolean)
void createMap()
void saveMap()
void addLayer()
void setCurrentLayer()
3..3
MapEntitySet
MapEntity
1..n
void addEntity()
MapEntity getEntity(x, y)
void toXML(line)
void paint()
void addPoint(x, y)
boolean contains(x,y)
String toXML()
void paint()
MapSite
MapLink
MapArea
Polygon area
Point2D point
ArrayList path
Figure 15.3 The class diagram of the graphical editor
Every subclass of MapEntity adopts a specific data structure for the defi-
nition of the corresponding geometric figure (circles, lines, polygons). Each
figure is represented in 2D Cartesian coordinates related to the image
reference frame. Even the position of the mouse pointer is expressed in 2D
coordinates related to the same reference frame. When the user clicks the
left button of the mouse, the graphical editor (or one of the other GIS tools)
grabs the coordinates of the point that corresponds to the mouse position on
the screen and searches for the entity that includes it within its boundary or
is close enough to it. This is achieved by defining method contains() in class
MapEntity and implementing it specifically in every concrete subclass. We
assume that geometric figures of entities belonging to the same layer do not
overlap.
Decision point
How is entity persistence handled?
 
Search WWH ::




Custom Search