public class Highlighter extends java.lang.Object implements DatabaseChangeListener
Modifier and Type | Class and Description |
---|---|
static class |
Highlighter.TextHighlightBound
Class to define an R-Tree leaf node for cell text.
|
Modifier and Type | Field and Description |
---|---|
static int |
EXACTSELECTDISTANCE
the max pixel distance that's acceptable selection
|
static int |
MOUSEOVER_HIGHLIGHTER
the mouse over highlighter type
|
static int |
RULER_HIGHLIGHTER
the "measurement" highlighter type
|
static int |
SELECT_HIGHLIGHTER
the selection highlighter type
|
Constructor and Description |
---|
Highlighter(int type,
WindowFrame wf)
Create a new Highlighter object
|
Modifier and Type | Method and Description |
---|---|
Highlight |
addArea(java.awt.geom.Rectangle2D area,
Cell cell)
Method to add an area to the list of highlighted objects.
|
Highlight |
addArea(java.awt.geom.Rectangle2D area,
java.awt.Color col,
Cell cell)
Method to add an area to the list of highlighted objects.
|
Highlight |
addElectricObject(ElectricObject eobj,
boolean isError,
Cell cell) |
Highlight |
addElectricObject(ElectricObject eobj,
Cell cell)
Method to add an ElectricObject to the list of highlighted objects.
|
Highlight |
addElectricObject(ElectricObject eobj,
Cell cell,
boolean highlightConnected,
java.awt.Color col)
Method to add an ElectricObject to the list of highlighted objects.
|
Highlight |
addElectricObject(ElectricObject eobj,
Cell cell,
java.awt.Color col)
Method to add an ElectricObject to the list of highlighted objects.
|
void |
addHighlight(Highlight h)
Add a Highlight
|
static void |
addHighlightListener(HighlightListener l)
Add a Highlight listener
|
Highlight |
addLine(java.awt.geom.Point2D start,
java.awt.geom.Point2D end,
Cell cell)
Method to add a line to the list of highlighted objects.
|
Highlight |
addLine(java.awt.geom.Point2D start,
java.awt.geom.Point2D end,
Cell cell,
boolean thick,
boolean isError)
Method to add a line to the list of highlighted objects.
|
Highlight |
addLine(java.awt.geom.Point2D start,
java.awt.geom.Point2D end,
Cell cell,
boolean thick,
java.awt.Color col,
boolean isError)
Method to add a line to the list of highlighted objects.
|
Highlight |
addLine(java.awt.geom.Point2D start,
java.awt.geom.Point2D end,
Cell cell,
WindowFrame wf)
Method to add a line to the list of highlighted objects in a specific WindowFrame.
|
Highlight |
addMessage(Cell cell,
java.lang.String message,
java.awt.geom.Point2D loc)
Method to add a message display to the list of highlighted objects.
|
Highlight |
addMessage(Cell cell,
java.lang.String message,
java.awt.geom.Point2D loc,
int corner,
java.awt.Color backgroundColor)
Method to add a message display to the list of highlighted objects.
|
void |
addNetwork(Network net,
Cell cell)
Method to add a network to the list of highlighted objects.
|
Highlight |
addObject(java.lang.Object obj,
Cell cell)
Method to generic Object.
|
Highlight |
addPoly(Poly poly,
Cell cell,
java.awt.Color color)
Method to add a Poly to the list of highlighted objects
|
Highlight |
addText(ElectricObject eobj,
Cell cell,
Variable.Key varKey)
Method to add a text selection to the list of highlighted objects.
|
Highlight |
addThickLine(java.awt.geom.Point2D start,
java.awt.geom.Point2D end,
Cell cell,
boolean isError)
Method to add a line to the list of highlighted objects.
|
static java.util.List<Highlight> |
checkOutObject(Geometric geom,
boolean findPort,
boolean findPoint,
boolean findSpecial,
java.awt.geom.Rectangle2D bounds,
EditWindow wnd,
double directHitDist,
boolean areaMustEnclose,
boolean showTempNames)
Method to determine whether an object is in a bounds.
|
void |
clear()
Method to clear the list of all highlighted objects in
|
void |
copyState(Highlighter highlighter)
Inherits the last selected object from the specified highlighter.
|
void |
databaseChanged(DatabaseChangeEvent e)
Invoked in the java AWT Event thread when the database state changes.
|
void |
delete()
Destructor
|
static java.awt.geom.Point2D[] |
describeHighlightText(EditWindow wnd,
ElectricObject eObj,
Variable.Key varKey)
Method to describe an object/variable-key pair as a set of points to draw.
|
static double |
distToArc(java.awt.geom.Rectangle2D bounds,
ArcInst ai,
EditWindow wnd,
boolean showTempNames)
Method to return the distance from a bounds to an ArcInst.
|
static double |
distToNode(java.awt.geom.Rectangle2D bounds,
NodeInst ni,
EditWindow wnd,
boolean showTempNames)
Method to return the distance from a bound to a NodeInst.
|
void |
ensureHighlightingSeen(WindowFrame wf)
Method to ensure that the highlighting is visible.
|
static java.util.List<Highlight> |
findAllInArea(Highlighter highlighter,
Cell cell,
boolean exclusively,
boolean findPort,
boolean findPoint,
boolean findSpecial,
boolean findText,
java.awt.geom.Rectangle2D bounds,
EditWindow wnd)
Method to search a Cell for all objects at a point.
|
Highlight |
findObject(java.awt.geom.Point2D pt,
EditWindow wnd,
boolean exclusively,
boolean another,
boolean invert,
boolean findPort,
boolean findPoint,
boolean findSpecial,
boolean findText,
boolean change)
Method to handle a click in a window and select the appropriate objects.
|
void |
finished()
Method to indicate that changes to highlighting are finished.
|
void |
gainedFocus()
Called when the Highlighter owner has gained focus, and the
current highlighter switches to this.
|
java.util.List<Highlight> |
getDifficultHighlights()
Method to return a list that is a copy of the list of current highlights.
|
java.util.List<ArcInst> |
getHighlightedArcs()
Method to return a List of all highlighted ArcInsts.
|
java.awt.geom.Rectangle2D |
getHighlightedArea(EditWindow wnd)
Method to return the bounds of the highlighted objects.
|
java.awt.geom.Rectangle2D |
getHighlightedArea(EditWindow wnd,
boolean onlyEObjects)
Method to return the bounds of the highlighted objects.
|
java.util.List<Geometric> |
getHighlightedEObjs(boolean wantNodes,
boolean wantArcs)
Method to return a List of all highlighted Geometrics.
|
java.util.Set<Network> |
getHighlightedNetworks()
Method to return a set of the currently selected networks.
|
java.util.List<NodeInst> |
getHighlightedNodes()
Method to return a List of all highlighted NodeInsts.
|
java.util.List<DisplayedText> |
getHighlightedText(boolean unique)
Method to return a List of all highlighted text.
|
java.awt.geom.Point2D |
getHighlightOffset()
Method to return the screen offset for the display of highlighting
|
java.util.List<Highlight> |
getHighlights()
Method to return a list that is a copy of the list of current highlights.
|
int |
getNumHighlights()
Method to return the number of highlighted objects.
|
ElectricObject |
getOneElectricObject(java.lang.Class<?> type)
Method to return the only highlighted object.
|
Highlight |
getOneHighlight()
Method to return the only highlight that encompasses an object in Cell cell.
|
static Highlight |
getSimiliarHighlight(java.util.List<Highlight> highlights,
Highlight exampleHigh)
Chooses a single Highlight from the list of Highlights 'highlights' that is most
similar to Highlight 'exampleHigh'.
|
Highlight |
overHighlighted(EditWindow wnd,
int x,
int y,
boolean change)
Method to tell whether a point is over this Highlight.
|
void |
popHighlight()
Method to pop the current highlight list from the stack.
|
void |
pushHighlight()
Method to push the current highlight list onto a stack.
|
void |
remove(Highlight h)
Removes a Highlight object from the current set of highlights.
|
static void |
removeHighlightListener(HighlightListener l)
Remove a Highlight listener
|
void |
selectArea(EditWindow wnd,
double minSelX,
double maxSelX,
double minSelY,
double maxSelY,
boolean invertSelection,
boolean findSpecial)
Method to add everything in an area to the selection.
|
void |
setHighlightList(java.util.List<Highlight> newHighlights)
Method to load a list of Highlights into the highlighting.
|
void |
setHighlightListGeneral(java.util.List<Highlight> newHighlights)
Method to load a list of Highlights into the highlighting.
|
void |
setHighlightOffset(long offX,
long offY)
Method to set a screen offset for the display of highlighting.
|
Highlight |
setPoint(Highlight oldHighlight,
ElectricObject eobj,
int point)
Method to replace a given HighlightEOBJ by new HighlighEOBJ with specified eObj and point.
|
void |
showHighlights(EditWindow wnd,
java.awt.Graphics g,
boolean onlyDifficult)
Shows highlights for the current EditWindow
|
void |
showHighlights(java.util.List<Highlight> popable) |
void |
showNetworks(Cell cell)
This is the show network command.
|
public static final int SELECT_HIGHLIGHTER
public static final int MOUSEOVER_HIGHLIGHTER
public static final int RULER_HIGHLIGHTER
public static final int EXACTSELECTDISTANCE
public Highlighter(int type, WindowFrame wf)
type
- public void delete()
public Highlight addElectricObject(ElectricObject eobj, Cell cell)
eobj
- the ElectricObject to add to the list of highlighted objects.cell
- the Cell in which the ElectricObject resides.public Highlight addElectricObject(ElectricObject eobj, boolean isError, Cell cell)
public Highlight addElectricObject(ElectricObject eobj, Cell cell, java.awt.Color col)
eobj
- the ElectricObject to add to the list of highlighted objects.cell
- the Cell in which the ElectricObject resides.public Highlight addElectricObject(ElectricObject eobj, Cell cell, boolean highlightConnected, java.awt.Color col)
eobj
- the ElectricObject to add to the list of highlighted objects.cell
- the Cell in which the ElectricObject resides.highlightConnected
- if true, highlight all objects that are in some way connected
to this object. If false, do not. This is used by addNetwork to prevent extra
things from being highlighted later that are not connected to the network.public Highlight setPoint(Highlight oldHighlight, ElectricObject eobj, int point)
oldHighlight
- given Highlighteobj
- new ElectricObject.point
- new point.public Highlight addText(ElectricObject eobj, Cell cell, Variable.Key varKey)
cell
- the Cell in which this area resides.varKey
- the Variable.Key associated with the text (text is then a visual of that variable).public Highlight addMessage(Cell cell, java.lang.String message, java.awt.geom.Point2D loc)
cell
- the Cell in which this area resides.message
- the String to display.loc
- the location of the string (in database units).public Highlight addMessage(Cell cell, java.lang.String message, java.awt.geom.Point2D loc, int corner, java.awt.Color backgroundColor)
cell
- the Cell in which this area resides.message
- the String to display.loc
- the location of the string (in database units).corner
- 0=lowerLeft, 1=upperLeft, 2=upperRight, 3=lowerRight.backgroundColor
- the text background color.public Highlight addArea(java.awt.geom.Rectangle2D area, Cell cell)
area
- the Rectangular area to add to the list of highlighted objects.cell
- the Cell in which this area resides.public Highlight addArea(java.awt.geom.Rectangle2D area, java.awt.Color col, Cell cell)
area
- the Rectangular area to add to the list of highlighted objects.col
- color of the areacell
- the Cell in which this area resides.public Highlight addObject(java.lang.Object obj, Cell cell)
obj
- object to add.cell
- the Cell in which this object resides.public Highlight addLine(java.awt.geom.Point2D start, java.awt.geom.Point2D end, Cell cell)
start
- the start point of the line to add to the list of highlighted objects.end
- the end point of the line to add to the list of highlighted objects.cell
- the Cell in which this line resides.public Highlight addLine(java.awt.geom.Point2D start, java.awt.geom.Point2D end, Cell cell, WindowFrame wf)
start
- the start point of the line to add to the list of highlighted objects.end
- the end point of the line to add to the list of highlighted objects.cell
- the Cell in which this line resides.wf
- the WindowFrame in which this line resides.public Highlight addLine(java.awt.geom.Point2D start, java.awt.geom.Point2D end, Cell cell, boolean thick, boolean isError)
start
- the start point of the line to add to the list of highlighted objects.end
- the end point of the line to add to the list of highlighted objects.cell
- the Cell in which this line resides.thick
- true for a thick line.public Highlight addLine(java.awt.geom.Point2D start, java.awt.geom.Point2D end, Cell cell, boolean thick, java.awt.Color col, boolean isError)
start
- the start point of the line to add to the list of highlighted objects.end
- the end point of the line to add to the list of highlighted objects.cell
- the Cell in which this line resides.thick
- true for a thick line.col
- color of the lineisError
- line can pulsatepublic Highlight addThickLine(java.awt.geom.Point2D start, java.awt.geom.Point2D end, Cell cell, boolean isError)
start
- the start point of the line to add to the list of highlighted objects.end
- the end point of the line to add to the list of highlighted objects.cell
- the Cell in which this line resides.public Highlight addPoly(Poly poly, Cell cell, java.awt.Color color)
poly
- the poly to addcell
- the cell in which to display the polycolor
- the color to draw the poly with (if null, uses default)public void addNetwork(Network net, Cell cell)
net
- the network to highlight.cell
- the Cell in which this line resides.public void showNetworks(Cell cell)
cell
- the cell in which to create the highlightspublic void addHighlight(Highlight h)
public void clear()
public void finished()
public void ensureHighlightingSeen(WindowFrame wf)
public void copyState(Highlighter highlighter)
highlighter
- public void showHighlights(EditWindow wnd, java.awt.Graphics g, boolean onlyDifficult)
wnd
- g
- public static void addHighlightListener(HighlightListener l)
public static void removeHighlightListener(HighlightListener l)
public void gainedFocus()
public void pushHighlight()
public void popHighlight()
public void showHighlights(java.util.List<Highlight> popable)
public void remove(Highlight h)
h
- the Highlight to removepublic int getNumHighlights()
public java.util.List<Highlight> getHighlights()
public java.util.List<Highlight> getDifficultHighlights()
public void setHighlightListGeneral(java.util.List<Highlight> newHighlights)
newHighlights
- a List of Highlight objects.public void setHighlightList(java.util.List<Highlight> newHighlights)
newHighlights
- a List of Highlight objects.public java.util.List<Geometric> getHighlightedEObjs(boolean wantNodes, boolean wantArcs)
wantNodes
- true if NodeInsts should be included in the list.wantArcs
- true if ArcInsts should be included in the list.public java.util.List<NodeInst> getHighlightedNodes()
public java.util.List<ArcInst> getHighlightedArcs()
public java.util.Set<Network> getHighlightedNetworks()
public java.util.List<DisplayedText> getHighlightedText(boolean unique)
unique
- true to request that the text objects be unique,
and not attached to another object that is highlighted.
For example, if a node and an export on that node are selected,
the export text will not be included if "unique" is true.public java.awt.geom.Rectangle2D getHighlightedArea(EditWindow wnd)
wnd
- the window in which to get bounds.public java.awt.geom.Rectangle2D getHighlightedArea(EditWindow wnd, boolean onlyEObjects)
wnd
- the window in which to get bounds.onlyEObjects
- true to get the bounds of only the Electric Objects that are highlighted.public Highlight getOneHighlight()
public ElectricObject getOneElectricObject(java.lang.Class<?> type)
public void setHighlightOffset(long offX, long offY)
offX
- the X offset (in pixels) of the highlighting.offY
- the Y offset (in pixels) of the highlighting.public java.awt.geom.Point2D getHighlightOffset()
public void selectArea(EditWindow wnd, double minSelX, double maxSelX, double minSelY, double maxSelY, boolean invertSelection, boolean findSpecial)
wnd
- the window being examined.minSelX
- the low X coordinate of the area in database units.maxSelX
- the high X coordinate of the area in database units.minSelY
- the low Y coordinate of the area in database units.maxSelY
- the high Y coordinate of the area in database units.invertSelection
- is true to invert the selection (remove what is already highlighted and add what is new).findSpecial
- is true to find hard-to-select objects.public Highlight overHighlighted(EditWindow wnd, int x, int y, boolean change)
wnd
- the window being examined.x
- the X screen coordinate of the point.y
- the Y screen coordinate of the point.change
- true to update the highlight; false to leave things alone.public static java.awt.geom.Point2D[] describeHighlightText(EditWindow wnd, ElectricObject eObj, Variable.Key varKey)
wnd
- the EditWindow in which the object/variable-key is displayed.eObj
- the object.varKey
- the variable-key.public Highlight findObject(java.awt.geom.Point2D pt, EditWindow wnd, boolean exclusively, boolean another, boolean invert, boolean findPort, boolean findPoint, boolean findSpecial, boolean findText, boolean change)
pt
- the coordinates of the click (in database units).wnd
- the window being examined.exclusively
- true if the currently selected object must remain selected.
This happens during "outline edit" when the node doesn't change, just the point on it.another
- true to find another object under the point (when there are multiple ones).invert
- true to invert selection (add if not selected, remove if already selected).findPort
- true to also show the closest port on a selected node.findPoint
- true to also show the closest point on a selected outline node.findSpecial
- true to select hard-to-find objects.findText
- true to select text objects.change
- true to update this Highlighter with the result; false to leave Highlighter alone (just return next selection).
The name of an unexpanded cell instance is always hard-to-select.
Other objects are set this way by the user (although the cell-center is usually set this way).public static java.util.List<Highlight> findAllInArea(Highlighter highlighter, Cell cell, boolean exclusively, boolean findPort, boolean findPoint, boolean findSpecial, boolean findText, java.awt.geom.Rectangle2D bounds, EditWindow wnd)
cell
- the cell to search.exclusively
- true if the currently selected object must remain selected.
This happens during "outline edit" when the node doesn't change, just the point on it.findPort
- true to also show the closest port on a selected node.findPoint
- true to also show the closest point on a selected outline node.findSpecial
- true to select hard-to-find objects.findText
- true to select text objects.
The name of an unexpanded cell instance is always hard-to-select.
Other objects are set this way by the user (although the cell-center is usually set this way).bounds
- the area of the search (in database units).wnd
- the window being examined (null to ignore window scaling).public static java.util.List<Highlight> checkOutObject(Geometric geom, boolean findPort, boolean findPoint, boolean findSpecial, java.awt.geom.Rectangle2D bounds, EditWindow wnd, double directHitDist, boolean areaMustEnclose, boolean showTempNames)
geom
- the Geometric being tested for selection.findPort
- true if a port should be selected with a NodeInst.findPoint
- true if a point should be selected with an outline NodeInst.findSpecial
- true if hard-to-select and other special selection is being done.bounds
- the selected area or point.wnd
- the window being examined (null to ignore window scaling).directHitDist
- the slop area to forgive when searching (a few pixels in screen space, transformed to database units).areaMustEnclose
- true if the object must be completely inside of the selection area.showTempNames
- consider temporary names on nodes and arcs.public static Highlight getSimiliarHighlight(java.util.List<Highlight> highlights, Highlight exampleHigh)
highlights
- a list of Highlight ObjectsexampleHigh
- the Highlight that serves as an example of what type
of Highlight should be retrieved from the highlights list.public static double distToNode(java.awt.geom.Rectangle2D bounds, NodeInst ni, EditWindow wnd, boolean showTempNames)
bounds
- the bounds in question.ni
- the NodeInst.wnd
- the window being examined (null to ignore text/window scaling).showTempNames
- consider temporary names on nodes and arcspublic static double distToArc(java.awt.geom.Rectangle2D bounds, ArcInst ai, EditWindow wnd, boolean showTempNames)
bounds
- the bounds in question.ai
- the ArcInst.wnd
- the window being examined.showTempNames
- consider temporary names on nodes and arcspublic void databaseChanged(DatabaseChangeEvent e)
DatabaseChangeListener
databaseChanged
in interface DatabaseChangeListener
e
- database change event.