computational.geometry.pointlocation
Class PointLocation

java.lang.Object
  extended by computational.geometry.pointlocation.PointLocation
Direct Known Subclasses:
ChainsMethod, Kirkpatrick

public abstract class PointLocation
extends java.lang.Object

Abstract class that contains basic method used for problem of point location. It has basic constructors, update method and query method used to localize triangle that contains given point.


Field Summary
protected  LogManager history
           
protected  java.util.List points
           
 
Constructor Summary
PointLocation()
          Default constructor
PointLocation(java.util.Collection ps)
          Constructor with collection of points
PointLocation(java.util.Collection ps, LogManager history)
          Constructor with collection of points and history
 
Method Summary
 void addPoint(Point p)
          Adds point to triangulation
abstract  void checkPreconditions()
          Method used to verify if preconditions are satisfied
 void clear()
          Clears points from triangulation
 void deletePoint(Point p)
          Deletes point from triangulation
 void draw(java.awt.Graphics gfx)
          Draws triangulation to the graphics
 void draw(Point point, java.awt.Graphics gfx)
          Draws point to the graphics
 LogManager getLogManager()
          Returns log manager used for tracking changes.
 java.util.List getPoints()
          Returns list of points of triangulation.
protected  java.awt.Polygon getPolygon(Triangle triangle)
          Creates polygon from triangle
abstract  java.util.Collection getSegments()
          Returns collection of segments that compose the triangulation.
abstract  Triangle getTriangle(Point point)
          Method executes query - localizes triangle that contains point.
 boolean isUpdated()
          Checks if structure is updated.
 void movePoint(Point p, int dx, int dy)
          Moves point in triangulation
 void setLogManager(LogManager history)
          Sets log manager used for tracking changes.
 void setPoints(java.util.Collection cp)
          Sets points of triangulation
 void setUpdated(boolean updated)
          Sets state of structure used for solving problem
abstract  void update()
          Method executed every time when is needed to update the structure used in Kirkpatrick's method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

history

protected LogManager history

points

protected java.util.List points
Constructor Detail

PointLocation

public PointLocation()
Default constructor


PointLocation

public PointLocation(java.util.Collection ps)
Constructor with collection of points

Parameters:
ps - collection of input points

PointLocation

public PointLocation(java.util.Collection ps,
                     LogManager history)
Constructor with collection of points and history

Parameters:
ps - collection of input points
history - log used for tracking changes
Method Detail

addPoint

public void addPoint(Point p)
Adds point to triangulation

Parameters:
p -

checkPreconditions

public abstract void checkPreconditions()
                                 throws PreconditionViolatedException
Method used to verify if preconditions are satisfied

Throws:
PreconditionViolatedException - this exception is thrown if some points is outside limiting box

clear

public void clear()
Clears points from triangulation


deletePoint

public void deletePoint(Point p)
Deletes point from triangulation

Parameters:
p -

draw

public void draw(java.awt.Graphics gfx)
Draws triangulation to the graphics

Parameters:
gfx -

draw

public void draw(Point point,
                 java.awt.Graphics gfx)
Draws point to the graphics

Parameters:
point -
gfx -

getLogManager

public LogManager getLogManager()
Returns log manager used for tracking changes.


getPoints

public java.util.List getPoints()
Returns list of points of triangulation. It DOESN'T return border points.

Returns:
list of points in triangulation

getPolygon

protected java.awt.Polygon getPolygon(Triangle triangle)
Creates polygon from triangle


getSegments

public abstract java.util.Collection getSegments()
Returns collection of segments that compose the triangulation. It DOESN'T return segment connecting border points.

Returns:
collection of segments in triangulation

getTriangle

public abstract Triangle getTriangle(Point point)
Method executes query - localizes triangle that contains point.

Parameters:
point - point for which query is executed

isUpdated

public boolean isUpdated()
Checks if structure is updated.

Returns:
true if structure used for solving problem is updated, false otherwise

movePoint

public void movePoint(Point p,
                      int dx,
                      int dy)
Moves point in triangulation

Parameters:
p -
dx -
dy -

setLogManager

public void setLogManager(LogManager history)
Sets log manager used for tracking changes.

Parameters:
history -

setPoints

public void setPoints(java.util.Collection cp)
Sets points of triangulation

Parameters:
cp -

setUpdated

public void setUpdated(boolean updated)
Sets state of structure used for solving problem

Parameters:
updated -

update

public abstract void update()
Method executed every time when is needed to update the structure used in Kirkpatrick's method. It does preprocessing by creating rooted tree of triangles used later in queries to localize triangle.