|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmain.GenerateMap
public abstract class GenerateMap
The abstract class GenerateMap
generates a map according to
the specifications implemented in its subclasses in the abstract methods
defining how to draw the map and the nodes and edges on it.
Field Summary | |
---|---|
private java.util.Vector<java.lang.String> |
allowedGroups
|
protected java.lang.String |
description
A String containing the map description. |
private boolean |
drawEdges
|
private boolean |
drawOnlyScenarioNodes
|
protected DrawingParameters |
edgeParameters
The DrawingParamebers by which the edges are drawn. |
protected ImageParameters |
imageParameters
The ImageParameters |
protected NodeEdgeMap |
map
The NodeEdgeMap of nodes and edges. |
private boolean |
mapCreated
|
protected DrawingParameters |
nodeParameters
The DrawingParamebers by which the nodes are drawn. |
private double |
nodeSizeFactor
|
static double |
ORIGINAL_NODE_SIZE_FACTOR
|
protected ScenarioConfig |
scenarioConfig
|
Constructor Summary | |
---|---|
protected |
GenerateMap()
Create a new, uninitialized GenerteMap . |
Method Summary | |
---|---|
private boolean |
checkIsNodeDrawingAllowed(Node node)
Checks whether a Node may be drawn on the map. |
protected abstract void |
clearData()
removes the previously generated data ie all nodes of the mapImage |
int |
compare(DrawableNode drawableNode1,
DrawableNode drawableNode2)
Compares two instances of DrawableNode by comparing their
sizes. |
void |
createMap(NodeEdgeMap map,
DrawingParameters nodeParameters,
DrawingParameters edgeParameters,
ImageParameters imageParameters,
java.lang.String description)
Calls the abstract methods drawNode and drawEdge to generate a map according to their specifications. |
protected abstract void |
drawEdge(DrawableEdge drawableEdge)
Draws an edge on the map. |
protected void |
drawEdges()
Puts the edges on the map object as specified by the drawEdge method. |
protected abstract void |
drawLabel(DrawableLabel drawableLabel)
Draws a label on the map. |
protected void |
drawLables()
Puts the nodes on the map object as specified by the drawNode method. |
protected abstract void |
drawNode(DrawableNode drawableNode)
Draws a node on the map. |
protected void |
drawNodes()
Puts the nodes on the map object as specified by the drawNode method. |
private int |
findCityInDrawableNodes(java.util.ArrayList<DrawableNode> drawableNodes,
City city)
counts the number of nodes having the given city |
java.util.Vector<java.lang.String> |
getAllowedGroups()
|
protected java.lang.String |
getDescription()
Returns the description of the map to be generator. |
protected java.lang.String |
getImageName()
Returns the name of the image file to which the map is to be generated. |
abstract java.lang.Object |
getMap()
Finishes creating the map and returns it. |
double |
getNodeSizeFactor()
|
ScenarioConfig |
getScenarioConfig()
|
protected abstract void |
initialize()
Initializes the map. |
boolean |
isDrawEdges()
|
boolean |
isDrawOnlyScenarioNodes()
|
protected boolean |
positionInRange(Position position,
ImageParameters imageParameters)
Returns true if the position specified is within the range
specified in the ImageParameters . |
void |
recreateMap()
Calls the abstract methods drawNode and drawEdge to generate a map according to their specifications. |
void |
setAllowedGroups(java.util.Vector<java.lang.String> allowedGroups)
|
void |
setDrawEdges(boolean drawEdges)
|
void |
setDrawOnlyScenarioNodes(boolean drawOnlyScenarioNodes)
|
void |
setNodeSizeFactor(double nodeSizeFactor)
|
void |
setScenarioConfig(ScenarioConfig scenarioConfig)
|
protected double |
transformLatitude(double latitude,
ImageParameters imageParameters)
Returns the vertical pixel-coordinate of the latitude on the map by a transformation determined by values set in image parameters. |
protected double |
transformLongitude(double longitude,
ImageParameters imageParameters)
Returns the horizontal pixel-coordinate of the longitude on the map by a transformation determined by values set in image parameters. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Field Detail |
---|
protected ScenarioConfig scenarioConfig
protected NodeEdgeMap map
NodeEdgeMap
of nodes and edges.
protected DrawingParameters nodeParameters
DrawingParamebers
by which the nodes are drawn.
protected DrawingParameters edgeParameters
DrawingParamebers
by which the edges are drawn.
protected ImageParameters imageParameters
ImageParameters specifying image information.
protected java.lang.String description
String
containing the map description.
private boolean mapCreated
private boolean drawOnlyScenarioNodes
private boolean drawEdges
private double nodeSizeFactor
public static final double ORIGINAL_NODE_SIZE_FACTOR
private java.util.Vector<java.lang.String> allowedGroups
Constructor Detail |
---|
protected GenerateMap()
GenerteMap
.
Method Detail |
---|
protected java.lang.String getImageName()
protected java.lang.String getDescription()
public void createMap(NodeEdgeMap map, DrawingParameters nodeParameters, DrawingParameters edgeParameters, ImageParameters imageParameters, java.lang.String description) throws java.io.FileNotFoundException, java.io.IOException, java.text.ParseException
map
- a SophiaNodesEdgesMap
nodeParameters
- a DrawingParameters
edgeParameters
- a DrawingParameters
imageParameters
- an ImageParameters
description
- a String
java.io.FileNotFoundException
- if a file is not found
java.io.IOException
- if an I/O error occurs
java.text.ParseException
- if a parse error occurspublic void recreateMap() throws java.io.FileNotFoundException, java.io.IOException, java.text.ParseException
java.io.FileNotFoundException
- if a file is not found
java.io.IOException
- if an I/O error occurs
java.text.ParseException
- if a parse error occursprotected void drawEdges()
private boolean checkIsNodeDrawingAllowed(Node node)
Node
may be drawn on the map.
node
- protected void drawNodes() throws java.io.FileNotFoundException, java.io.IOException, java.text.ParseException
java.io.FileNotFoundException
java.io.IOException
java.text.ParseException
protected void drawLables() throws java.io.FileNotFoundException, java.io.IOException, java.text.ParseException
java.io.FileNotFoundException
java.io.IOException
java.text.ParseException
private int findCityInDrawableNodes(java.util.ArrayList<DrawableNode> drawableNodes, City city)
city
- - The city to look for
protected double transformLatitude(double latitude, ImageParameters imageParameters)
latitude
- a double
imageParameters
- an ImageParameters
protected double transformLongitude(double longitude, ImageParameters imageParameters)
longitude
- a double
imageParameters
- an ImageParameters
protected boolean positionInRange(Position position, ImageParameters imageParameters)
true
if the position specified is within the range
specified in the ImageParameters
. Otherwise returns
false
.
position
- a Position
imageParameters
- an ImageParameters
public int compare(DrawableNode drawableNode1, DrawableNode drawableNode2)
DrawableNode
by comparing their
sizes.
compare
in interface java.util.Comparator<DrawableNode>
drawableNode1
- a DrawableNode
drawableNode2
- a DrawableNode
protected abstract void clearData()
protected abstract void drawNode(DrawableNode drawableNode)
drawableNode
- a DrawableNode
protected abstract void drawLabel(DrawableLabel drawableLabel)
drawableLabel
- a DrawableLabel
protected abstract void drawEdge(DrawableEdge drawableEdge)
drawableEdge
- a DrawableEdge
protected abstract void initialize() throws java.io.FileNotFoundException, java.io.IOException, java.text.ParseException
java.io.FileNotFoundException
- if a file is not found
java.io.IOException
- if an I/O error occurs
java.text.ParseException
- if a parse error occurspublic abstract java.lang.Object getMap()
Object
public boolean isDrawOnlyScenarioNodes()
public void setDrawOnlyScenarioNodes(boolean drawOnlyScenarioNodes)
drawOnlyScenarioNodes
- the drawOnlyScenarioNodes to setpublic ScenarioConfig getScenarioConfig()
public void setScenarioConfig(ScenarioConfig scenarioConfig)
scenarioConfig
- the scenarioConfig to setpublic boolean isDrawEdges()
public void setDrawEdges(boolean drawEdges)
public double getNodeSizeFactor()
public void setNodeSizeFactor(double nodeSizeFactor)
public java.util.Vector<java.lang.String> getAllowedGroups()
public void setAllowedGroups(java.util.Vector<java.lang.String> allowedGroups)
allowedGroups
- the allowedGroups to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |