|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
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.
description
protected java.lang.String description
- A
String
containing the map description.
mapCreated
private boolean mapCreated
drawOnlyScenarioNodes
private boolean drawOnlyScenarioNodes
drawEdges
private boolean drawEdges
nodeSizeFactor
private double nodeSizeFactor
ORIGINAL_NODE_SIZE_FACTOR
public static final double ORIGINAL_NODE_SIZE_FACTOR
- See Also:
- Constant Field Values
allowedGroups
private java.util.Vector<java.lang.String> allowedGroups
Constructor Detail
GenerateMap
protected GenerateMap()
- Create a new, uninitialized
GenerteMap
.
Method Detail
getImageName
protected java.lang.String getImageName()
- Returns the name of the image file to which the map is to be generated.
This may be used in the methods defining how to generate the map.
- Returns:
- the image name
getDescription
protected java.lang.String getDescription()
- Returns the description of the map to be generator. This may be used in
the methods defining to to generate the map.
- Returns:
- the image name
createMap
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
- Calls the abstract methods drawNode and drawEdge to generate a map
according to their specifications. This method can be overridden to
create specialized maps.
- Parameters:
map
- a SophiaNodesEdgesMap
nodeParameters
- a DrawingParameters
edgeParameters
- a DrawingParameters
imageParameters
- an ImageParameters
description
- a String
- Throws:
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 occurs
recreateMap
public void recreateMap()
throws java.io.FileNotFoundException,
java.io.IOException,
java.text.ParseException
- Calls the abstract methods drawNode and drawEdge to generate a map
according to their specifications. This method can be overridden to
create specialized maps.
This method should be called, when a createMap() call was done before
and the map needs to be updated.
- Throws:
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 occurs
drawEdges
protected void drawEdges()
- Puts the edges on the map object as specified by the drawEdge method.
checkIsNodeDrawingAllowed
private boolean checkIsNodeDrawingAllowed(Node node)
- Checks whether a
Node
may be drawn on the map.
- Parameters:
node
-
drawNodes
protected void drawNodes()
throws java.io.FileNotFoundException,
java.io.IOException,
java.text.ParseException
- Puts the nodes on the map object as specified by the drawNode method.
- Throws:
java.io.FileNotFoundException
java.io.IOException
java.text.ParseException
drawLables
protected void drawLables()
throws java.io.FileNotFoundException,
java.io.IOException,
java.text.ParseException
- Puts the nodes on the map object as specified by the drawNode method.
- Throws:
java.io.FileNotFoundException
java.io.IOException
java.text.ParseException
findCityInDrawableNodes
private int findCityInDrawableNodes(java.util.ArrayList<DrawableNode> drawableNodes,
City city)
- counts the number of nodes having the given city
- Parameters:
city
- - The city to look for
- Returns:
- int - The number of nodes having the given city
transformLatitude
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.
- Parameters:
latitude
- a double
imageParameters
- an ImageParameters
- Returns:
- the y-pixel coordinate of the latitude
transformLongitude
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.
- Parameters:
longitude
- a double
imageParameters
- an ImageParameters
- Returns:
- the x-pixel coordinate of the longitude
positionInRange
protected boolean positionInRange(Position position,
ImageParameters imageParameters)
- Returns
true
if the position specified is within the range
specified in the ImageParameters
. Otherwise returns
false
.
- Parameters:
position
- a Position
imageParameters
- an ImageParameters
- Returns:
- if the position is within the spefified range
compare
public int compare(DrawableNode drawableNode1,
DrawableNode drawableNode2)
- Compares two instances of
DrawableNode
by comparing their
sizes.
- Specified by:
compare
in interface java.util.Comparator<DrawableNode>
- Parameters:
drawableNode1
- a DrawableNode
drawableNode2
- a DrawableNode
clearData
protected abstract void clearData()
- removes the previously generated data
ie all nodes of the mapImage
drawNode
protected abstract void drawNode(DrawableNode drawableNode)
- Draws a node on the map.
- Parameters:
drawableNode
- a DrawableNode
drawLabel
protected abstract void drawLabel(DrawableLabel drawableLabel)
- Draws a label on the map.
- Parameters:
drawableLabel
- a DrawableLabel
drawEdge
protected abstract void drawEdge(DrawableEdge drawableEdge)
- Draws an edge on the map.
- Parameters:
drawableEdge
- a DrawableEdge
initialize
protected abstract void initialize()
throws java.io.FileNotFoundException,
java.io.IOException,
java.text.ParseException
- Initializes the map.
- Throws:
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 occurs
getMap
public abstract java.lang.Object getMap()
- Finishes creating the map and returns it.
- Returns:
- the map
Object
isDrawOnlyScenarioNodes
public boolean isDrawOnlyScenarioNodes()
- Returns:
- the drawOnlyScenarioNodes
setDrawOnlyScenarioNodes
public void setDrawOnlyScenarioNodes(boolean drawOnlyScenarioNodes)
- Parameters:
drawOnlyScenarioNodes
- the drawOnlyScenarioNodes to set
getScenarioConfig
public ScenarioConfig getScenarioConfig()
- Returns:
- the scenarioConfig
setScenarioConfig
public void setScenarioConfig(ScenarioConfig scenarioConfig)
- Parameters:
scenarioConfig
- the scenarioConfig to set
isDrawEdges
public boolean isDrawEdges()
setDrawEdges
public void setDrawEdges(boolean drawEdges)
getNodeSizeFactor
public double getNodeSizeFactor()
setNodeSizeFactor
public void setNodeSizeFactor(double nodeSizeFactor)
getAllowedGroups
public java.util.Vector<java.lang.String> getAllowedGroups()
- Returns:
- the allowedGroups
setAllowedGroups
public void setAllowedGroups(java.util.Vector<java.lang.String> allowedGroups)
- Parameters:
allowedGroups
- the allowedGroups to set
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD