boolean isSimpleConnection;
boolean needsUpdate = false;
+ public void updateTerminals() {
+ boolean changed = false;
+ for(RouteTerminal terminal : terminals)
+ changed |= terminal.updateDynamicPosition();
+ if(changed) update();
+ }
+
/**
* Adds a route line to the graph.
* @param isHorizontal true, if the line is horizontal
* </pre>
* @param style Tells what kind of line end is drawn
* to the connection.
+ * @param position a provider for a dynamic position for the terminal or
+ * <code>null</code> if terminal position is not dynamic
* @return The new terminal.
*/
+ public RouteTerminal addTerminal(double x, double y,
+ double minX, double minY,
+ double maxX, double maxY,
+ int allowedDirections,
+ ILineEndStyle style, RouteTerminalPosition position) {
+ return addTerminal(x, y, minX, minY, maxX, maxY, allowedDirections, style, null, position);
+ }
+
public RouteTerminal addTerminal(double x, double y,
double minX, double minY,
double maxX, double maxY,
int allowedDirections,
ILineEndStyle style) {
- return addTerminal(x, y, minX, minY, maxX, maxY, allowedDirections, style, null);
-
+ return addTerminal(x, y, minX, minY, maxX, maxY, allowedDirections, style, null, null);
}
+
public RouteTerminal addTerminal(double x, double y,
double minX, double minY,
double maxX, double maxY,
int allowedDirections,
- ILineEndStyle style, ILineEndStyle dynamicStyle) {
+ ILineEndStyle style, ILineEndStyle dynamicStyle, RouteTerminalPosition position) {
if(CHECK_PARAMERS) {
if(allowedDirections > 0x1f)
throw new IllegalArgumentException("Illegal allowedDirection flags.");
if(style == null)
style = PlainLineEndStyle.INSTANCE;
RouteTerminal terminal = new RouteTerminal(x, y, minX, minY,
- maxX, maxY, allowedDirections, false, style);
+ maxX, maxY, allowedDirections, false, style, position);
terminal.setDynamicStyle(dynamicStyle);
terminals.add(terminal);
return terminal;
0.5*(minX+maxX), 0.5*(minY+maxY),
minX, minY,
maxX, maxY,
- 0xf, true, style);
+ 0xf, true, style, null);
terminal.setDynamicStyle(dynamicStyle);
terminals.add(terminal);
ILineEndStyle style) {
return addTerminal(x, y,
bounds.getMinX(), bounds.getMinY(), bounds.getMaxX(), bounds.getMaxY(),
- allowedDirections, style);
+ allowedDirections, style, null);
}
/**
RouteTerminal newTerminal = addTerminal(terminal.x, terminal.y,
terminal.getMinX(), terminal.getMinY(),
terminal.getMaxX(), terminal.getMaxY(),
- terminal.getAllowedDirections(), terminal.getStyle(), terminal.getDynamicStyle());
+ terminal.getAllowedDirections(), terminal.getStyle(), terminal.getDynamicStyle(), terminal.getDynamicPosition());
newTerminal.setData(terminal.getData());
return terminal;
}
double maxX, double maxY,
int allowedDirections) {
return addTerminal(x, y, minX, minY, maxX, maxY, allowedDirections,
- PlainLineEndStyle.INSTANCE);
+ PlainLineEndStyle.INSTANCE, null);
}
/**