public class TikzTopologySerializer extends Object implements TopologySerializer
The TikzTopologySerializer
exports a JBotSim Topology
into TikZ format.
Note: importFromString(Topology, String)
is not supported.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_EOL
The default End-Of-Line delimiter.
|
static double |
DEFAULT_SCALE_FACTOR
The default scale factor that must be applied to the distance between nodes.
|
protected String |
eol |
protected double |
scaleFactor |
Constructor and Description |
---|
TikzTopologySerializer()
Creates
TikzTopologySerializer with the default values. |
TikzTopologySerializer(String eol,
double scaleFactor)
Creates A
TikzTopologySerializer according to the provided parameters. |
Modifier and Type | Method and Description |
---|---|
protected String |
exportTopology(Topology topology,
double scaleFactor) |
String |
exportToString(Topology topology)
Returns a string representation of this topology.
|
static String |
getTikzStringColor(Color color)
Converts a JBotSim
Color into a color string displayable with TikZ. |
void |
importFromString(Topology topology,
String data)
Imports nodes and wired links from the specified string representation of a
topology.
|
public static final String DEFAULT_EOL
public static final double DEFAULT_SCALE_FACTOR
protected String eol
protected double scaleFactor
public TikzTopologySerializer()
TikzTopologySerializer
with the default values.DEFAULT_EOL
,
DEFAULT_SCALE_FACTOR
public TikzTopologySerializer(String eol, double scaleFactor)
TikzTopologySerializer
according to the provided parameters.eol
- The String to append at the end of each line.scaleFactor
- The scale factor to apply to each Node
location, as a double.DEFAULT_EOL
,
DEFAULT_SCALE_FACTOR
public static String getTikzStringColor(Color color)
Converts a JBotSim Color
into a color string displayable with TikZ.
color
- a Color
to be converterpublic void importFromString(Topology topology, String data)
TopologySerializer
importFromString
in interface TopologySerializer
topology
- The Topology
object which must be populateddata
- The String
representation.public String exportToString(Topology topology)
TopologySerializer
TopologySerializer.importFromString(Topology, String)
method. Only the nodes and wired links are exported
here (not the topology's properties).exportToString
in interface TopologySerializer
topology
- The Topology
object which must be exportedString
representation of the Topology