|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.electric.tool.routing.Router
com.sun.electric.tool.routing.InteractiveRouter
public abstract class InteractiveRouter
An Interactive Router has several methods that build on Router methods to provide interactive control to user. It also provides methods for highlighting routes to provide visual feedback to the user. Finally, non-interactive routing is done only from PortInst to PortInst, whereas interactive routing can start and end on any arc, and can end in space.
Note: 'Interactive' is somewhat of a misnomer, as it would imply the route can be incremently built or changed by the user. In reality, it is expected that the route simply be rebuilt whenever the user input changes, until the user decides that the route is acceptable, at which point the route can be made.
User: gainsley Date: Feb 24, 2004 Time: 4:58:24 PM
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.sun.electric.tool.routing.Router |
---|
Router.ArcWidth, Router.CreateRouteJob |
Field Summary |
---|
Fields inherited from class com.sun.electric.tool.routing.Router |
---|
tool, verbose |
Constructor Summary | |
---|---|
InteractiveRouter()
|
Method Summary | |
---|---|
protected RouteElementPort |
bisectArc(Route route,
ArcInst arc,
java.awt.geom.Point2D bisectPoint,
PolyMerge stayInside)
Splits an arc at bisectPoint and updates the route to reflect the change. |
void |
cancelInteractiveRoute()
Cancels interative routing and restores original highlights |
protected static ElectricObject |
filterRouteObject(ElectricObject routeObj,
java.awt.geom.Point2D clicked)
If routeObj is a NodeInst, first thing we do is get the nearest PortInst to where the user clicked, and use that instead. |
protected RouteElementPort |
findArcConnectingPoint(Route route,
ArcInst arc,
java.awt.geom.Point2D point,
PolyMerge stayInside)
If drawing to/from an ArcInst, we may connect to some point along the arc. |
protected static double |
getArcWidthToUse(ElectricObject routeObj,
ArcProto ap)
|
protected static java.awt.geom.Point2D |
getClosestAngledPoint(java.awt.geom.Point2D startPoint,
java.awt.geom.Point2D clicked,
int angleIncrement)
Use to find the closest point to clicked to route a wire from startPoint. |
protected static java.awt.geom.Point2D |
getClosestOrthogonalPoint(java.awt.geom.Point2D startPoint,
java.awt.geom.Point2D clicked)
Gets the closest orthogonal point from the startPoint to the clicked point. |
protected static double |
getClosestValue(double min,
double max,
double clicked)
Get closest value to clicked within a range from min to max |
protected static void |
getConnectingPoints(ElectricObject startObj,
ElectricObject endObj,
java.awt.geom.Point2D clicked,
java.awt.geom.Point2D startPoint,
java.awt.geom.Point2D endPoint,
Poly startPoly,
Poly endPoly,
ArcProto startArc,
ArcProto endArc)
Get the connecting points for the start and end objects of the route. |
protected static Poly |
getConnectingSite(ElectricObject obj,
java.awt.geom.Point2D clicked,
double arcWidth)
Get the connecting site of the electric object. |
protected static PortProto |
getRoutePort(ElectricObject routeObj)
Get the PortProto associated with routeObj (it should be either a ArcInst or a PortInst, otherwise this will return null). |
void |
highlightRoute(EditWindow wnd,
Cell cell,
ElectricObject startObj,
ElectricObject endObj,
java.awt.geom.Point2D clicked)
Make a route and highlight it in the window. |
void |
highlightRoute(EditWindow wnd,
Route route,
Cell cell)
Highlight a route in the window |
void |
makeRoute(EditWindow wnd,
Cell cell,
ElectricObject startObj,
ElectricObject endObj,
java.awt.geom.Point2D clicked)
Make a route between startObj and endObj in the EditWindow_ wnd. |
boolean |
makeVerticalRoute(EditWindow wnd,
PortInst startPort,
ArcProto arc)
Make a vertical route. |
protected boolean |
onSegment(java.awt.geom.Point2D point,
java.awt.geom.Line2D line)
Returns true if point is on the line segment, false otherwise. |
Route |
planRoute(Cell cell,
ElectricObject startObj,
ElectricObject endObj,
java.awt.geom.Point2D clicked,
PolyMerge stayInside,
boolean extendArcHead,
boolean extendArcTail)
Plan a route from startObj to endObj, taking into account where the user clicked in the cell. |
Route |
planRoute(Cell cell,
ElectricObject startObj,
ElectricObject endObj,
java.awt.geom.Point2D clicked,
PolyMerge stayInside,
boolean extendArcHead,
boolean extendArcTail,
java.awt.geom.Rectangle2D contactArea)
Plan a route from startObj to endObj, taking into account where the user clicked in the cell. |
protected abstract boolean |
planRoute(Route route,
Cell cell,
RouteElementPort endRE,
java.awt.geom.Point2D startLoc,
java.awt.geom.Point2D endLoc,
java.awt.geom.Point2D clicked,
PolyMerge stayInside,
VerticalRoute vroute,
boolean contactsOnEndObject,
boolean extendArcHead,
boolean extendArcTail,
java.awt.geom.Rectangle2D contactArea)
|
void |
startInteractiveRoute(EditWindow wnd)
This stores the currently highlighted objects to highlight in addition to route highlighting. |
java.lang.String |
toString()
|
protected boolean |
withinBounds(double point,
double bound1,
double bound2)
|
Methods inherited from class com.sun.electric.tool.routing.Router |
---|
createRoute, createRouteNoJob, getArcToUse, getArcWidthToUse, getArcWidthToUse, getArcWidthToUse, getContactSize, getContactSize, reportRoutingResults, setTool, useWidestWire |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public InteractiveRouter()
Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
protected abstract boolean planRoute(Route route, Cell cell, RouteElementPort endRE, java.awt.geom.Point2D startLoc, java.awt.geom.Point2D endLoc, java.awt.geom.Point2D clicked, PolyMerge stayInside, VerticalRoute vroute, boolean contactsOnEndObject, boolean extendArcHead, boolean extendArcTail, java.awt.geom.Rectangle2D contactArea)
public void startInteractiveRoute(EditWindow wnd)
public void cancelInteractiveRoute()
public void makeRoute(EditWindow wnd, Cell cell, ElectricObject startObj, ElectricObject endObj, java.awt.geom.Point2D clicked)
wnd
- the EditWindow_ the user is editingcell
- the cell in which to create the routestartObj
- a PortInst or ArcInst from which to start the routeendObj
- a PortInst or ArcInst to end the route on. May be null
if the user is drawing to empty space.clicked
- the point where the user clickedpublic boolean makeVerticalRoute(EditWindow wnd, PortInst startPort, ArcProto arc)
wnd
- the EditWindow_ the user is editingstartPort
- the start of the routearc
- the arc type that the last contact will be able to connect to
public void highlightRoute(EditWindow wnd, Cell cell, ElectricObject startObj, ElectricObject endObj, java.awt.geom.Point2D clicked)
cell
- the cell in which to create the routestartObj
- a PortInst or ArcInst from which to start the routeendObj
- a PortInst or ArcInst to end the route on. May be null
if the user is drawing to empty space.clicked
- the point where the user clickedpublic void highlightRoute(EditWindow wnd, Route route, Cell cell)
route
- the route to be highlightedpublic Route planRoute(Cell cell, ElectricObject startObj, ElectricObject endObj, java.awt.geom.Point2D clicked, PolyMerge stayInside, boolean extendArcHead, boolean extendArcTail)
cell
- the cell in which to create the arcstartObj
- a PortInst or ArcInst from which to start the routeendObj
- a PortInst or ArcInst to end the route on. May be null
if the user is drawing to empty space.clicked
- the point where the user clickedstayInside
- the area in which to route (null if not applicable).extendArcHead
- true to use default arc extension; false to force no arc extension.extendArcTail
- true to use default arc extension; false to force no arc extension.
public Route planRoute(Cell cell, ElectricObject startObj, ElectricObject endObj, java.awt.geom.Point2D clicked, PolyMerge stayInside, boolean extendArcHead, boolean extendArcTail, java.awt.geom.Rectangle2D contactArea)
cell
- the cell in which to create the arcstartObj
- a PortInst or ArcInst from which to start the routeendObj
- a PortInst or ArcInst to end the route on. May be null
if the user is drawing to empty space.clicked
- the point where the user clickedstayInside
- the area in which to route (null if not applicable).extendArcHead
- true to use default arc extension; false to force no arc extension.extendArcTail
- true to use default arc extension; false to force no arc extension.
protected static ElectricObject filterRouteObject(ElectricObject routeObj, java.awt.geom.Point2D clicked)
routeObj
- the route object (possibly a NodeInst).clicked
- where the user clicked
protected static PortProto getRoutePort(ElectricObject routeObj)
routeObj
- the route object
protected static double getArcWidthToUse(ElectricObject routeObj, ArcProto ap)
protected static void getConnectingPoints(ElectricObject startObj, ElectricObject endObj, java.awt.geom.Point2D clicked, java.awt.geom.Point2D startPoint, java.awt.geom.Point2D endPoint, Poly startPoly, Poly endPoly, ArcProto startArc, ArcProto endArc)
startObj
- the start route objectendObj
- the end route objectclicked
- where the user clickedstartPoint
- point inside startPoly on startObj to connect arc toendPoint
- point inside endPoly on endObj to connect arc tostartPoly
- valid port site on startObjendPoly
- valid port site on endObjprotected static Poly getConnectingSite(ElectricObject obj, java.awt.geom.Point2D clicked, double arcWidth)
obj
- the object to get a connection site forclicked
- used to find the nearest portinst on a nodeinst, and nearest
site on a multisite portarcWidth
- contacts port sites are restricted by the size of arcs connecting
to them, such that the arc width does extend beyond the contact edges.
protected RouteElementPort findArcConnectingPoint(Route route, ArcInst arc, java.awt.geom.Point2D point, PolyMerge stayInside)
Note that this method adds the returned RouteElement to the route, and updates the route if the arc is bisected. This method should NOT add the returned RouteElement to the route.
route
- the route so fararc
- the arc to draw from/topoint
- point on or near arcstayInside
- the area in which to route (null if not applicable).
protected RouteElementPort bisectArc(Route route, ArcInst arc, java.awt.geom.Point2D bisectPoint, PolyMerge stayInside)
route
- the current routearc
- the arc to splitbisectPoint
- point on arc from which to split itstayInside
- the area in which to route (null if not applicable).
protected static double getClosestValue(double min, double max, double clicked)
protected static java.awt.geom.Point2D getClosestOrthogonalPoint(java.awt.geom.Point2D startPoint, java.awt.geom.Point2D clicked)
startPoint
- start point of the arcclicked
- where the user clicked
protected static java.awt.geom.Point2D getClosestAngledPoint(java.awt.geom.Point2D startPoint, java.awt.geom.Point2D clicked, int angleIncrement)
startPoint
- clicked
- angleIncrement
-
protected boolean withinBounds(double point, double bound1, double bound2)
protected boolean onSegment(java.awt.geom.Point2D point, java.awt.geom.Line2D line)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |