861
873
Rectangle2D no2Bounds = no2pi.getPoly().getBounds2D();
862
874
Point2D no2Pt = new Point2D.Double(no2Bounds.getCenterX(), no2Bounds.getCenterY());
864
ArcInst ar1 = ArcInst.newInstanceBase(ap, wid, fpi, no2pi, headPt, no2Pt, null, 0);
865
// ArcInst ar1 = ArcInst.newInstanceFull(ap, wid, fpi, no2pi, headPt, no2Pt, null, 0);
876
int arcFlags = ai.getD().flags;
877
String arcName = ai.getName();
878
ai.kill(); // !!! See ai2.copyVarsFrom(ai) below
880
int flags1 = ImmutableArcInst.TAIL_NEGATED.set(arcFlags, false);
881
ArcInst ar1 = ArcInst.newInstanceBase(ap, wid, fpi, no2pi, headPt, no2Pt, null, 0, flags1);
866
882
if (ar1 == null) return;
867
ar1.copyConstraintsFrom(ai);
868
// ar1.copyStateBits(ai);
883
// ar1.copyConstraintsFrom(ai);
869
884
// if (ai.isHeadNegated()) ar1.setHeadNegated(true);
870
ArcInst ar2 = ArcInst.newInstanceBase(ap, wid, no2pi, no1pi, no2Pt, no1Pt, null, 0);
871
// ArcInst ar2 = ArcInst.newInstanceFull(ap, wid, no2pi, no1pi, no2Pt, no1Pt, null, 0);
886
int flags2 = ImmutableArcInst.TAIL_NEGATED.set(arcFlags, false);
887
flags2 = ImmutableArcInst.HEAD_NEGATED.set(flags2, false);
888
ArcInst ar2 = ArcInst.newInstanceBase(ap, wid, no2pi, no1pi, no2Pt, no1Pt, arcName, 0, flags2);
872
889
if (ar2 == null) return;
873
ar2.copyPropertiesFrom(ai);
874
// ar2.copyStateBits(ai);
875
ArcInst ar3 = ArcInst.newInstanceBase(ap, wid, no1pi, tpi, no1Pt, tailPt, null, 0);
876
// ArcInst ar3 = ArcInst.newInstanceFull(ap, wid, no1pi, tpi, no1Pt, tailPt, null, 0);
890
ar2.copyVarsFrom(ai); // !!! Referencing killed ai may cause problem in future versions
891
ar2.copyTextDescriptorFrom(ai, ArcInst.ARC_NAME);
892
// ar2.copyPropertiesFrom(ai);
894
int flags3 = ImmutableArcInst.HEAD_NEGATED.set(arcFlags, false);
895
ArcInst ar3 = ArcInst.newInstanceBase(ap, wid, no1pi, tpi, no1Pt, tailPt, null, flags3);
877
896
if (ar3 == null) return;
878
ar3.copyConstraintsFrom(ai);
879
// ar3.copyStateBits(ai);
880
if (ai.isTailNegated()) ar3.setTailNegated(true);
897
// ar3.copyConstraintsFrom(ai);
898
// if (ai.isTailNegated()) ar3.setTailNegated(true);
881
899
if (ar1 == null || ar2 == null || ar3 == null)
883
901
System.out.println("Problem creating jog arcs");
1030
1048
if (oldD == null) return false;
1031
1049
return ai.getHeadLocation() != oldD.headLocation || ai.getTailLocation() != oldD.tailLocation;
1052
private boolean hasExports(NodeInst ni) {
1053
return m.hasExports(ni.getD().nodeId);
1056
* Method to return an Iterator over all Connections on this NodeInst.
1057
* @return an Iterator over all Connections on this NodeInst.
1059
private Iterator<Connection> getConnections(NodeInst ni) {
1060
return new ConnectionIterator(ni.getD().nodeId);
1064
* Method to return an Iterator over Connections on this PortInst since portIndex.
1065
* @return an Iterator over Connections on this NodeInst since portIndex.
1067
Iterator<Connection> getConnections(PortInst pi) {
1068
return new ConnectionIterator(pi.getNodeInst().getD().nodeId, pi.getPortProto().getId().getChronIndex());
1071
private class ConnectionIterator implements Iterator<Connection> {
1072
private final ImmutableArrayList<ImmutableArcInst> arcs;
1073
private final int nodeId;
1074
private final int chronIndex;
1079
ConnectionIterator(int nodeId) {
1082
this.nodeId = nodeId;
1083
i = m.searchConnectionByPort(nodeId, 0);
1086
ConnectionIterator(int nodeId, int chronIndex) {
1088
this.nodeId = nodeId;
1089
this.chronIndex = chronIndex;
1090
i = m.searchConnectionByPort(nodeId, chronIndex);
1093
public boolean hasNext() { return nextAi != null; }
1094
public Connection next() {
1096
throw new NoSuchElementException();
1097
Connection con = nextAi.getConnection(nextConnIndex);
1101
public void remove() { throw new UnsupportedOperationException(); }
1103
private void findNext() {
1104
for (; i < m.connections.length; i++) {
1105
int con = m.connections[i];
1106
ImmutableArcInst a = arcs.get(con >>> 1);
1107
int endIndex = con & 1;
1108
int endNodeId = endIndex != 0 ? a.headNodeId : a.tailNodeId;
1109
if (endNodeId != nodeId) break;
1110
if (chronIndex >= 0) {
1111
PortProtoId endProtoId = endIndex != 0 ? a.headPortId : a.tailPortId;
1112
if (endProtoId.getChronIndex() != chronIndex) break;
1114
ArcInst ai = cell.getArcById(a.arcId);
1117
nextConnIndex = endIndex;
1035
1128
// private HashMap/*<NodeInst,RigidCluster>*/ makeRigidClusters() {