~sgaflv/workcraft/trunk-refmodels

« back to all changes in this revision

Viewing changes to WorkcraftCore/src/org/workcraft/dom/visual/connections/Polyline.java

  • Committer: Danil Sokolov
  • Date: 2014-09-08 20:55:35 UTC
  • mfrom: (544.1.1 trunk-bug)
  • Revision ID: danilovesky@gmail.com-20140908205535-jwjj6lxz736a4ilz
Merge proposal for bug #1364023 approved.

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
        }
66
66
 
67
67
        public void draw(DrawRequest r) {
68
 
                
69
68
                Graphics2D g = r.getGraphics();
70
 
                
71
 
                if (!valid)
 
69
                if (!valid) {
72
70
                        update();
 
71
                }
73
72
                
74
73
                Path2D connectionPath = new Path2D.Double();
75
74
 
105
104
                }
106
105
        }
107
106
 
108
 
        public Rectangle2D getBoundingBox() {
 
107
        public Rectangle2D getBoundingBox() {
 
108
                if (!valid) {
 
109
                        update();
 
110
                }
109
111
                return boundingBox;
110
112
        }
111
113
        
112
114
        public void update() {
113
115
                int segments = getSegmentCount();
114
 
 
115
116
                for (int i=0; i < segments; i++) {
116
117
                        Line2D seg = getSegment(i);
117
 
 
118
 
                        if (i==0)
 
118
                        if (i==0) {
119
119
                                boundingBox = getSegmentBoundsWithThreshold(seg);
120
 
                        else
 
120
                        } else {
121
121
                                boundingBox.add(getSegmentBoundsWithThreshold(seg));
 
122
                        }
122
123
                }
123
124
                curveInfo = Geometry.buildConnectionCurveInfo(connectionInfo, this, 0);
124
125
                valid = true;
358
359
 
359
360
        @Override
360
361
        public void componentsTransformChanged() {
361
 
                if(scaler == null)
 
362
                if(scaler == null) {
362
363
                        System.err.print("error @ Polyline.componentsTransformChanged(): scaler == null");
363
 
                else
364
 
                {
 
364
                } else {
365
365
                        scaler.scale(connectionInfo.getFirstCenter(), connectionInfo
366
366
                                .getSecondCenter(), Hierarchy.filterNodesByType(getChildren(),
367
367
                                ControlPoint.class), connectionInfo.getScaleMode());