at.tuwien.ifs.somtoolbox.apps.viewer.controls.psomserver
Class PathMerger

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.apps.viewer.controls.psomserver.PathMerger

public class PathMerger
extends Object

Version:
$Id: PathMerger.java 3590 2010-05-21 10:43:45Z mayer $
Author:
Jakob Frank

Field Summary
private  edu.umd.cs.piccolo.PNode borderRoot
           
private  edu.umd.cs.piccolo.PNode circlesRoot
           
private  edu.umd.cs.piccolo.PNode connsRoot
           
private  boolean debug
           
private  List<edu.umd.cs.piccolo.PNode> drawedStuff
           
private  MapPNode map
           
private  edu.umd.cs.piccolo.PNode root
           
 
Constructor Summary
PathMerger(MapPNode map)
           
PathMerger(MapPNode map, boolean debug)
           
 
Method Summary
 void concatPaths(edu.umd.cs.piccolo.PNode[] paths)
           
private  List<GeneralUnitPNode> convertPathToUnits(edu.umd.cs.piccolo.PNode node)
           
private  edu.umd.cs.piccolo.nodes.PPath createCircle(Point2D center, float radius)
          Create a circle PNode
 void deleteAllDrawnStuff()
           
private  double dist(double[] d1, double[] d2)
           
private  double distSq(double[] d1, double[] d2)
           
private  void findBorder(edu.umd.cs.piccolox.nodes.PLine l1, edu.umd.cs.piccolox.nodes.PLine l2, Color c, edu.umd.cs.piccolox.nodes.PLine border)
          Find the border between two lines.
private
<A extends edu.umd.cs.piccolo.PNode>
A
findClosest(A unit, List<A> candidates)
           
private  Point2D findClosest(Point2D point, List<Point2D> candidates)
           
private  Point2D findClosest(Point2D point, edu.umd.cs.piccolox.nodes.PLine candidates)
           
 edu.umd.cs.piccolox.nodes.PLine getBorderLine()
           
private  double[] getMiddlePoint(double[] d1, double[] d2)
           
private  Point2D getMiddlePoint(Point2D p1, Point2D p2)
          Get the middle point between the Points.
 void highlightIntersectingUnits(edu.umd.cs.piccolo.PNode node, boolean target)
           
 void lineBasedMerge(edu.umd.cs.piccolo.PNode[] paths)
           
 void newIntermediateInputSpaceMerge(edu.umd.cs.piccolo.PNode[] paths)
           
 void newIntermediateMapMerge(edu.umd.cs.piccolo.PNode[] paths)
           
private  String printNode(edu.umd.cs.piccolo.PNode node)
           
 void setDebug(boolean debug)
           
 void unitBasedMerge(edu.umd.cs.piccolo.PNode[] paths)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

private final MapPNode map

root

private edu.umd.cs.piccolo.PNode root

borderRoot

private edu.umd.cs.piccolo.PNode borderRoot

connsRoot

private edu.umd.cs.piccolo.PNode connsRoot

circlesRoot

private edu.umd.cs.piccolo.PNode circlesRoot

drawedStuff

private List<edu.umd.cs.piccolo.PNode> drawedStuff

debug

private boolean debug
Constructor Detail

PathMerger

public PathMerger(MapPNode map)

PathMerger

public PathMerger(MapPNode map,
                  boolean debug)
Method Detail

setDebug

public void setDebug(boolean debug)

unitBasedMerge

public void unitBasedMerge(edu.umd.cs.piccolo.PNode[] paths)

deleteAllDrawnStuff

public void deleteAllDrawnStuff()

newIntermediateMapMerge

public void newIntermediateMapMerge(edu.umd.cs.piccolo.PNode[] paths)

newIntermediateInputSpaceMerge

public void newIntermediateInputSpaceMerge(edu.umd.cs.piccolo.PNode[] paths)

dist

private double dist(double[] d1,
                    double[] d2)

distSq

private double distSq(double[] d1,
                      double[] d2)

getMiddlePoint

private double[] getMiddlePoint(double[] d1,
                                double[] d2)

lineBasedMerge

public void lineBasedMerge(edu.umd.cs.piccolo.PNode[] paths)

findBorder

private void findBorder(edu.umd.cs.piccolox.nodes.PLine l1,
                        edu.umd.cs.piccolox.nodes.PLine l2,
                        Color c,
                        edu.umd.cs.piccolox.nodes.PLine border)
Find the border between two lines.

Parameters:
l1 - first Line
l2 - second Line
c - Color of the border
border - where to add the border

createCircle

private edu.umd.cs.piccolo.nodes.PPath createCircle(Point2D center,
                                                    float radius)
Create a circle PNode

Parameters:
center - the center of the circle
radius - the radius (size) of the circle
Returns:
a round PNode

getMiddlePoint

private Point2D getMiddlePoint(Point2D p1,
                               Point2D p2)
Get the middle point between the Points.

Parameters:
p1 - first Point
p2 - second Point
Returns:
the Point in the middle

findClosest

private Point2D findClosest(Point2D point,
                            edu.umd.cs.piccolox.nodes.PLine candidates)

findClosest

private Point2D findClosest(Point2D point,
                            List<Point2D> candidates)

findClosest

private <A extends edu.umd.cs.piccolo.PNode> A findClosest(A unit,
                                                           List<A> candidates)

convertPathToUnits

private List<GeneralUnitPNode> convertPathToUnits(edu.umd.cs.piccolo.PNode node)

printNode

private String printNode(edu.umd.cs.piccolo.PNode node)

highlightIntersectingUnits

public void highlightIntersectingUnits(edu.umd.cs.piccolo.PNode node,
                                       boolean target)

concatPaths

public void concatPaths(edu.umd.cs.piccolo.PNode[] paths)

getBorderLine

public edu.umd.cs.piccolox.nodes.PLine getBorderLine()