All Packages Class Hierarchy This Package Previous Next Index
Class jschem.connectionList
java.lang.Object
|
+----jschem.connectionList
- public class connectionList
- extends Object
This is one of the important informations for a schematic -
the connectivity list.
It sets up the datastructures for keeping segment-wise the
wires of the schematic including the graphical information.
The segments are always drawn in the horizontal direction first,
then in vertical direction. On the both ends knots are added.
Examples:
"x1/y1 o----+ x2/y2 o x2/y2 o"
" | | x1/y1 o----o x2/y2 |"
" x2/y2 o +----o x1/y1 x1/y1 o"
-
connectionList(int, int, int)
-
Build new connectivity list for a schematic.
-
add(int, int, int, int)
-
Adds a new segment.
-
checkJoinNet(int, int, int, int)
-
Checks if given path joins to the existing wires.
-
deleteSelection()
-
Delete a selection
-
fromString(String)
-
Setup connectivity list from GRAPHICS line.
-
getNetAt(int, int)
-
Checks if given coordinate hits an existing wire.
-
paint(Graphics)
-
Can be called to allow the connections to draw them themselves.
-
selectFullNetAt(int, int)
-
Select a whole net at a given coordinate
-
selectNetAt(int, int)
-
Select a net segment at a given coordinate
-
toString()
-
Creates GRAPHICS line.
connectionList
public connectionList(int gr,
int size,
int subsize)
- Build new connectivity list for a schematic.
- Parameters:
- gr - gridsize in pixel
- size - amount of nets
- subsize - allowed amount of segments per net
add
public String add(int x1,
int y1,
int x2,
int y2)
- Adds a new segment.
It is joined to an existing net if:
- the start/end point of this segment hits any other segment path
- the start/endpoints of other segments hit this segment path
It may happen that two or more existing nets are connected together,
the first one which is found is reference for every other found.
- Parameters:
- x1,y1 - the given start coordinates (pixel)
- x2,y2 - the given end coordinates (pixel)
- Returns:
- name of the net created or joined
checkJoinNet
public int[] checkJoinNet(int x1,
int y1,
int x2,
int y2)
- Checks if given path joins to the existing wires.
It checks if:
- the start/end point of this segment hits any other segment path
- the start/endpoints of other segments hit this segment path
We suppose not to have more than 20 matches....
- Parameters:
- x1,y1 - the given start coordinate (pixel)
- x2,y2 - the given end coordinate (pixel)
- Returns:
- indices of the nets to join (idx=0 is # of hits)
getNetAt
public String getNetAt(int x,
int y)
- Checks if given coordinate hits an existing wire.
- Parameters:
- x,y - the given coordinate (pixel)
- Returns:
- net name (or null if not hit)
selectNetAt
public String selectNetAt(int x,
int y)
- Select a net segment at a given coordinate
- Parameters:
- x,y - the given coordinate (pixel)
- Returns:
- net name (or null if not hit)
selectFullNetAt
public String selectFullNetAt(int x,
int y)
- Select a whole net at a given coordinate
- Parameters:
- x,y - the given coordinate (pixel)
- Returns:
- net name (or null if not hit)
deleteSelection
public void deleteSelection()
- Delete a selection
- Parameters:
- x,y - the given coordinate (pixel)
- Returns:
- net name (or null if not hit)
toString
public String toString()
- Creates GRAPHICS line.
- Overrides:
- toString in class Object
fromString
public boolean fromString(String s)
- Setup connectivity list from GRAPHICS line.
paint
public void paint(Graphics g)
- Can be called to allow the connections to draw them themselves.
It draws the lines in blue, with knots at every segment end.
- Parameters:
- g - Graphics context to draw to
All Packages Class Hierarchy This Package Previous Next Index