Java Reference
In-Depth Information
int indexEnd # docLine.indexOf('"');
this .name # docLine.substring(0, indexEnd);
try {
String entityType # "";
while ((docLine # lineReader.readLine())! # null ) {
if ((indexInit # docLine.indexOf("</LAYER")) > -1)
return ; // end of this layer description
else if ((indexInit # docLine.indexOf("<LIST")) > -1) {
// extracts the type of entity list
indexInit # docLine.indexOf("TYPE # ");
. . .
}
. . .
}
} catch (IOException ioe) { ioe.printStackTrace(); }
}
// sets the visibility of the entire layer
public void setVisible( boolean visible) {
this .visible # visible;
}
// sets the visibility of the entities' type
public void setEntityVisibility(String t, boolean v) {
if (t.equalsIgnoreCase("SITE"))
siteSet.setVisible(v);
. . .
}
public void paint(Graphics2D g, boolean sites,
boolean links, boolean areas) { ...}
public String toXML() {
StringBuffer stream # new StringBuffer();
stream.append(" <LAYER NAME # " ! '"' ! name ! '"' !
" COLOR # " ! '"' ! colorName ! '"' ! ">");
stream.append(siteSet.toXML("SITE"));
. . .
}
public void addSite(MapSite s) { siteSet.addEntity(s); }
public void addLink(MapLink l) { linkSet.addEntity(l); }
public void addArea(MapArea a) { areaSet.addEntity(a); }
// gets the entity of a given type located at x,y
public MapEntity getEntity(String type, int x, int y) {
if (type.equalsIgnoreCase("SITE"))
return siteSet.getEntity(x, y);
. . .
return null ;
}
}
Search WWH ::




Custom Search