~ubuntu-branches/ubuntu/quantal/libjgraph-java/quantal

« back to all changes in this revision

Viewing changes to src/org/jgraph/graph/DefaultEdge.java

  • Committer: Bazaar Package Importer
  • Author(s): gregor herrmann
  • Date: 2008-05-09 18:29:56 UTC
  • mfrom: (1.1.5 upstream) (4.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080509182956-n9mkbgtt36kkj2h0
Tags: 5.12.1.0.dfsg-1
* New upstream release.
* Switch from dpatch to quilt.
* Change my email address in several files under debian/.
* debian/copyright: update and compact.
* debian/control: build depend on default-jdk-builddep, depend on
  default-jre instead of specifying a specific JDK/JRE; change JAVA_HOME
  in debian/rules accordingly.
* Install API documentation to /usr/share/doc/libjgraph-java-doc/api/
  instead of directly under libjgraph-java-doc/

Show diffs side-by-side

added added

removed removed

Lines of Context:
185
185
                                double x2 = from.getX() + ((to.getX() - from.getX()) / 2);
186
186
                                double y2 = from.getY() + ((to.getY() - from.getY()) / 2);
187
187
                                routed = new Point2D[2];
188
 
                                if (dx > dy) {
189
 
                                        routed[0] = edge.getAttributes().createPoint(x2,
190
 
                                                        from.getY());
191
 
                                        routed[1] = edge.getAttributes().createPoint(x2, to.getY());
192
 
                                } else {
193
 
                                        routed[0] = edge.getAttributes().createPoint(from.getX(),
194
 
                                                        y2);
195
 
                                        routed[1] = edge.getAttributes().createPoint(to.getX(), y2);
 
188
                                Rectangle2D targetBounds = null;
 
189
                                Rectangle2D sourceBounds = null;
 
190
                                if ((edge.getTarget() != null && edge.getTarget()
 
191
                                                .getParentView() != null)
 
192
                                                && (edge.getSource() != null && edge.getSource()
 
193
                                                                .getParentView() != null)) {
 
194
                                        targetBounds = edge.getTarget().getParentView().getBounds();
 
195
                                        sourceBounds = edge.getSource().getParentView().getBounds();
196
196
                                }
197
 
                                // Set/Add Points
198
 
                                for (int i = 0; i < routed.length; i++) {
199
 
                                        if ((edge.getTarget() == null
200
 
                                                        || edge.getTarget().getParentView() == null || !edge
201
 
                                                        .getTarget().getParentView().getBounds().contains(
202
 
                                                                        routed[i]))
203
 
                                                        && (edge.getSource() == null
204
 
                                                                        || edge.getSource().getParentView() == null || !edge
205
 
                                                                        .getSource().getParentView().getBounds()
206
 
                                                                        .contains(routed[i])))
207
 
                                        {
208
 
                                                newPoints.add(routed[i]);
 
197
                                if (targetBounds != null && sourceBounds != null) {
 
198
                                        if (dx > dy) {
 
199
                                                routed[0] = edge.getAttributes().createPoint(x2,
 
200
                                                                from.getY());
 
201
                                                routed[1] = edge.getAttributes().createPoint(x2,
 
202
                                                                to.getY());
 
203
                                                if (targetBounds.contains(routed[0])
 
204
                                                                || (sourceBounds.contains(routed[0]))
 
205
                                                                || targetBounds.contains(routed[1])
 
206
                                                                || (sourceBounds.contains(routed[1]))) {
 
207
                                                        routed[0] = edge.getAttributes().createPoint(
 
208
                                                                        from.getX(), y2);
 
209
                                                        routed[1] = edge.getAttributes().createPoint(
 
210
                                                                        to.getX(), y2);
 
211
                                                }
 
212
                                        } else {
 
213
                                                routed[0] = edge.getAttributes().createPoint(
 
214
                                                                from.getX(), y2);
 
215
                                                routed[1] = edge.getAttributes().createPoint(to.getX(),
 
216
                                                                y2);
 
217
                                                if (targetBounds.contains(routed[0])
 
218
                                                                || (sourceBounds.contains(routed[0]))
 
219
                                                                || targetBounds.contains(routed[1])
 
220
                                                                || (sourceBounds.contains(routed[1]))) {
 
221
                                                        routed[0] = edge.getAttributes().createPoint(x2,
 
222
                                                                        from.getY());
 
223
                                                        routed[1] = edge.getAttributes().createPoint(x2,
 
224
                                                                        to.getY());
 
225
                                                }
 
226
                                        }
 
227
                                        // Set/Add Points
 
228
                                        for (int i = 0; i < routed.length; i++) {
 
229
                                                if (!targetBounds.contains(routed[i])
 
230
                                                                && (!sourceBounds.contains(routed[i]))) {
 
231
                                                        newPoints.add(routed[i]);
 
232
                                                }
209
233
                                        }
210
234
                                }
211
235
 
218
242
                        }
219
243
                        return null;
220
244
                }
221
 
 
222
245
        }
223
246
 
224
247
}
 
 
b'\\ No newline at end of file'