Changeset 1143 for trunk


Ignore:
Timestamp:
09/18/18 12:00:17 (6 years ago)
Author:
bln4
Message:

Used Eclipse refactoring to encapsulate Point.X and Point.Y

Location:
trunk/src/org/expeditee/items
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/Circle.java

    r1102 r1143  
    159159                double radius = getRadius();
    160160
    161                 double distance = Math.sqrt(Math.pow(Math.abs(_center.getX() - p.x), 2)
    162                                 + Math.pow(Math.abs(_center.getY() - p.y), 2));
     161                double distance = Math.sqrt(Math.pow(Math.abs(_center.getX() - p.getX()), 2)
     162                                + Math.pow(Math.abs(_center.getY() - p.getY()), 2));
    163163
    164164                return Math.abs(distance - radius) < getGravity() * 2;
  • trunk/src/org/expeditee/items/Item.java

    r1102 r1143  
    21492149
    21502150        public void setPosition(Point position) {
    2151                 setPosition(position.x, position.y);
     2151                setPosition(position.getX(), position.getY());
    21522152        }
    21532153
     
    28812881                invalidateCommonTraitForAll(ItemAppearence.PreMoved);
    28822882
    2883                 _x = (float) (origin.x + ratio * (_x - origin.x));
    2884                 _y = (float) (origin.y + ratio * (_y - origin.y));
     2883                _x = (float) (origin.getX() + ratio * (_x - origin.getX()));
     2884                _y = (float) (origin.getY() + ratio * (_y - origin.getY()));
    28852885                invalidateBounds();
    28862886                for (Line line : getLines())
  • trunk/src/org/expeditee/items/ItemUtils.java

    r1102 r1143  
    971971        private static void scaleItem(Vector v, Item item) {
    972972                Float scale = v.Scale;
    973                 int originX = v.Origin.x;
    974                 int originY = v.Origin.y;
     973                int originX = v.Origin.getX();
     974                int originY = v.Origin.getY();
    975975                Colour defaultForeground = v.Foreground;
    976976                Colour defaultBackground = v.Background;
  • trunk/src/org/expeditee/items/Line.java

    r1102 r1143  
    227227                         * else
    228228                         */{
    229                                 _startOffset.x = 0;
    230                                 _startOffset.y = 0;
     229                                _startOffset.setX(0);
     230                                _startOffset.setY(0);
    231231                        }
    232232
     
    245245                         * end.getX(); _endOffset.y = _end.getY() - end.getY(); } else
    246246                         */{
    247                                 _endOffset.x = 0;
    248                                 _endOffset.y = 0;
     247                                _endOffset.setX(0);
     248                                _endOffset.setY(0);
    249249                        }
    250250
     
    377377                        // Add all the x and y's to the array
    378378                        for (int j = 0; j < pointPath.size(); j++) {
    379                                 path.addPoint(pointPath.get(j).x, pointPath.get(j).y);
     379                                path.addPoint(pointPath.get(j).getX(), pointPath.get(j).getY());
    380380                        }
    381381                }
     
    447447                int x0, x1, y0, y1;
    448448
    449                 x1 = withArrow.getX() + startOffset.x;
    450                 y1 = withArrow.getY() + startOffset.y;
    451                 x0 = getOppositeEnd(withArrow).getX() + endOffset.x;
    452                 y0 = getOppositeEnd(withArrow).getY() + endOffset.y;
     449                x1 = withArrow.getX() + startOffset.getX();
     450                y1 = withArrow.getY() + startOffset.getY();
     451                x0 = getOppositeEnd(withArrow).getX() + endOffset.getX();
     452                y0 = getOppositeEnd(withArrow).getY() + endOffset.getY();
    453453
    454454                float arrowLength   = withArrow.getArrowheadLength();
     
    499499                arrowhead = arrowhead.clone();
    500500                double rad = calcAngle((float) x0, (float) y0, (float) x1, (float) y1);
    501                 arrowhead.translate((x0 + length) - arrowhead.toArray()[0].x, y0 - arrowhead.toArray()[0].y);
     501                arrowhead.translate((x0 + length) - arrowhead.toArray()[0].getX(), y0 - arrowhead.toArray()[0].getY());
    502502                arrowhead.rotate(rad, x0, y0);
    503503               
     
    609609        public Item getEndPointToDisconnect(Point p)
    610610        {
    611                 return getEndPointToDisconnect(p.x, p.y);
     611                return getEndPointToDisconnect(p.getX(), p.getY());
    612612        }
    613613
  • trunk/src/org/expeditee/items/Picture.java

    r1102 r1143  
    207207                String size = getImageSize();
    208208
    209                 if (_end.x != 0 || _end.y != 0)
     209                if (_end.getX() != 0 || _end.getY() != 0)
    210210                        return;
    211211
     
    280280        public void setStartCrop(Point p)
    281281        {
    282                 if (p != null) setStartCrop(p.x, p.y);
     282                if (p != null) setStartCrop(p.getX(), p.getY());
    283283        }
    284284       
     
    291291        public void setEndCrop(Point p)
    292292        {
    293                 if (p != null) setEndCrop(p.x, p.y);
     293                if (p != null) setEndCrop(p.getX(), p.getY());
    294294        }
    295295
     
    304304                        Point topLeft = getTopLeftCrop();
    305305                        Point bottomRight = getBottomRightCrop();
    306                         int startX = getX() + topLeft.x - _highlightThickness;
    307                         int startY = getY() + topLeft.y - _highlightThickness;
     306                        int startX = getX() + topLeft.getX() - _highlightThickness;
     307                        int startY = getY() + topLeft.getY() - _highlightThickness;
    308308                        int border = 2 * _highlightThickness;
    309309                        // TODO: Why invalidate specific area just before invalidateAll? cts16
    310310                        invalidate(new AxisAlignedBoxBounds(startX, startY,
    311                                         bottomRight.x - topLeft.x + 2 * border, bottomRight.y - topLeft.y + 2 * border));
     311                                        bottomRight.getX() - topLeft.getX() + 2 * border, bottomRight.getY() - topLeft.getY() + 2 * border));
    312312                        invalidateAll();
    313313                } else {
     
    317317
    318318        public Point getTopLeftCrop() {
    319                 return new Point(Math.min(_cropStart.x, _cropEnd.x), Math.min(
    320                                 _cropStart.y, _cropEnd.y));
     319                return new Point(Math.min(_cropStart.getX(), _cropEnd.getX()), Math.min(
     320                                _cropStart.getY(), _cropEnd.getY()));
    321321        }
    322322
    323323        public Point getBottomRightCrop()
    324324        {
    325                 return new Point(Math.max(_cropStart.x, _cropEnd.x), Math.max(_cropStart.y, _cropEnd.y));
     325                return new Point(Math.max(_cropStart.getX(), _cropEnd.getX()), Math.max(_cropStart.getY(), _cropEnd.getY()));
    326326        }
    327327
     
    341341                if (!isBeingCropped()) return true;
    342342
    343                 int cropWidth = Math.abs(_cropEnd.x - _cropStart.x);
    344                 int cropHeight = Math.abs(_cropEnd.y - _cropStart.y);
     343                int cropWidth = Math.abs(_cropEnd.getX() - _cropStart.getX());
     344                int cropHeight = Math.abs(_cropEnd.getY() - _cropStart.getY());
    345345
    346346                return cropWidth < MINIMUM_WIDTH || cropHeight < MINIMUM_WIDTH;
     
    371371                        int height = getHeight();
    372372                       
    373                         centre.x = base_x + width / 2;
    374                         centre.y = base_y + height / 2;
     373                        centre.setX(base_x + width / 2);
     374                        centre.setY(base_y + height / 2);
    375375
    376376                        int xdiff = -MARGIN_RIGHT; // -getLeftMargin();
     
    391391                        Point bottomRight = getBottomRightCrop();
    392392                       
    393                         centre.x = base_x + (bottomRight.x - topLeft.x) / 2;
    394                         centre.y = base_y + (bottomRight.y - topLeft.y) / 2;
    395                        
    396                         AxisAlignedBoxBounds clip = new AxisAlignedBoxBounds(topLeft.x + base_x,
    397                                         topLeft.y + base_y, bottomRight.x - topLeft.x,
    398                                         bottomRight.y - topLeft.y);
     393                        centre.setX(base_x + (bottomRight.getX() - topLeft.getX()) / 2);
     394                        centre.setY(base_y + (bottomRight.getY() - topLeft.getY()) / 2);
     395                       
     396                        AxisAlignedBoxBounds clip = new AxisAlignedBoxBounds(topLeft.getX() + base_x,
     397                                        topLeft.getY() + base_y, bottomRight.getX() - topLeft.getX(),
     398                                        bottomRight.getY() - topLeft.getY());
    399399//                      _poly.addPoint((int) clip.getMinX() - 1, (int) clip.getMinY() - 1);
    400400//                      _poly.addPoint((int) clip.getMinX() - 1, (int) clip.getMaxY());
     
    425425        @Override
    426426        public void setWidth(Integer width) {
    427                 _scale = width * 1F / (_end.x - _start.x);
     427                _scale = width * 1F / (_end.getX() - _start.getX());
    428428        }
    429429
     
    487487                int offY = (tmp.getHeight() - getHeight()) / 2;
    488488               
    489                 int cropStartX = _start.x;
    490                 int cropEndX = _end.x;
     489                int cropStartX = _start.getX();
     490                int cropEndX = _end.getX();
    491491        if(cropEndX > iw) {
    492492                cropEndX = iw;
     
    503503                        }
    504504                       
    505                         int cropStartY = _start.y;
    506                         int cropEndY = _end.y;
     505                        int cropStartY = _start.getY();
     506                        int cropEndY = _end.getY();
    507507                if(cropEndY > ih) {
    508508                        cropEndY = ih;
     
    569569                        int base_y = (_anchorTop != null) ? _anchorTop : _source.getY();
    570570                       
    571                         Clip clip = new Clip(new AxisAlignedBoxBounds(  base_x + topLeft.x,
    572                                                                                                                                         base_y + topLeft.y,
    573                                                                                                                                         bottomRight.x - topLeft.x,
    574                                                                                                                                         bottomRight.y - topLeft.y));
     571                        Clip clip = new Clip(new AxisAlignedBoxBounds(  base_x + topLeft.getX(),
     572                                                                                                                                        base_y + topLeft.getY(),
     573                                                                                                                                        bottomRight.getX() - topLeft.getX(),
     574                                                                                                                                        bottomRight.getY() - topLeft.getY()));
    575575                        EnforcedClipKey key = g.pushClip(clip);
    576576                        paintImageTiling();
     
    625625                        Point topLeft = getTopLeftCrop();
    626626                        Point bottomRight = getBottomRightCrop();
    627                         int startX = Math.round(topLeft.x / _scale) + _start.x;
    628                         int startY = Math.round(topLeft.y / _scale) + _start.y;
    629                         int endX = Math.round(bottomRight.x / _scale + _start.x);
    630                         int endY = Math.round(bottomRight.y / _scale + _start.y);
     627                        int startX = Math.round(topLeft.getX() / _scale) + _start.getX();
     628                        int startY = Math.round(topLeft.getY() / _scale) + _start.getY();
     629                        int endX = Math.round(bottomRight.getX() / _scale + _start.getX());
     630                        int endY = Math.round(bottomRight.getY() / _scale + _start.getY());
    631631                        int width = _image.getWidth();
    632632                        int height = _image.getHeight();
     
    649649                        int base_x = (_anchorLeft!=null) ? _anchorLeft : _source.getX();
    650650                        int base_y = (_anchorTop!=null) ? _anchorTop : _source.getY();
    651                         p._source.setPosition(topLeft.x + base_x, topLeft.y + base_y);
     651                        p._source.setPosition(topLeft.getX() + base_x, topLeft.getY() + base_y);
    652652                } else {
    653653                        p._start = new Point(_start);
     
    678678                int ih = _image.getHeight();
    679679                if(iw > 0 || ih > 0) {
    680                         while(_start.x >= iw) {
    681                         _start.x -= iw;
    682                         _end.x -= iw;
     680                        while(_start.getX() >= iw) {
     681                        _start.setX(_start.getX() - iw);
     682                        _end.setX(_end.getX() - iw);
    683683                }
    684                 while(_start.y >= ih) {
    685                         _start.y -= ih;
    686                         _end.y -= ih;
     684                while(_start.getY() >= ih) {
     685                        _start.setY(_start.getY() - ih);
     686                        _end.setY(_end.getY() - ih);
    687687                }
    688                 while(_start.x < 0) {
    689                         _start.x += iw;
    690                         _end.x += iw;
     688                while(_start.getX() < 0) {
     689                        _start.setX(_start.getX() + iw);
     690                        _end.setX(_end.getX() + iw);
    691691                }
    692                 while(_start.y < 0) {
    693                         _start.y += ih;
    694                         _end.y += ih;
     692                while(_start.getY() < 0) {
     693                        _start.setY(_start.getY() + ih);
     694                        _end.setY(_end.getY() + ih);
    695695                }
    696696                }
     
    749749                }
    750750               
    751                 return Image.createImageAsCroppedCopy(_image, _start.x, _start.y, getUnscaledWidth(), getUnscaledHeight());
     751                return Image.createImageAsCroppedCopy(_image, _start.getX(), _start.getY(), getUnscaledWidth(), getUnscaledHeight());
    752752        }
    753753
    754754        public int getUnscaledWidth() {
    755                 return _end.x - _start.x;
     755                return _end.getX() - _start.getX();
    756756        }
    757757
    758758        public int getUnscaledHeight() {
    759                 return _end.y - _start.y;
     759                return _end.getY() - _start.getY();
    760760        }
    761761
     
    764764         */
    765765        public boolean isCropped() {
    766                 return (_end.x != 0 && _end.x != _image.getWidth()) || (_end.y != 0 && _end.y != _image.getHeight()) || _start.y != 0 || _start.x != 0;
     766                return (_end.getX() != 0 && _end.getX() != _image.getWidth()) || (_end.getY() != 0 && _end.getY() != _image.getHeight()) || _start.getY() != 0 || _start.getX() != 0;
    767767        }
    768768
     
    888888                // If the image is cropped add the position for the start and finish of
    889889                // the crop to the soure text
    890                 if (_start.x > 0 || _start.y > 0 || _end.x != _image.getWidth()
    891                                 || _end.y != _image.getHeight()) {
    892                         newText.append(" ").append(_start.x).append(" ").append(_start.y);
    893                         newText.append(" ").append(_end.x).append(" ").append(_end.y);
     890                if (_start.getX() > 0 || _start.getY() > 0 || _end.getX() != _image.getWidth()
     891                                || _end.getY() != _image.getHeight()) {
     892                        newText.append(" ").append(_start.getX()).append(" ").append(_start.getY());
     893                        newText.append(" ").append(_end.getX()).append(" ").append(_end.getY());
    894894                }
    895895               
  • trunk/src/org/expeditee/items/Text.java

    r1125 r1143  
    727727        public void setSelectionStart(Point p)
    728728        {
    729                 setSelectionStart(p.x, p.y);
     729                setSelectionStart(p.getX(), p.getY());
    730730        }
    731731       
     
    746746        public void setSelectionEnd(Point p)
    747747        {
    748                 setSelectionEnd(p.x, p.y);
     748                setSelectionEnd(p.getX(), p.getY());
    749749        }
    750750
     
    11581158                }
    11591159               
    1160                 if (setSelection) setSelectionEnd(resultPos.x, resultPos.y);
     1160                if (setSelection) setSelectionEnd(resultPos.getX(), resultPos.getY());
    11611161               
    11621162                return resultPos;
     
    11781178
    11791179                TextLayout layout = _textLayouts.get(line);
    1180                 mouseX += getOffset().x;
     1180                mouseX += getOffset().getX();
    11811181                mouseX -= getJustOffset(layout);
    11821182
     
    11951195         */
    11961196        public int getLinePosition(float mouseY) {
    1197                 mouseY += getOffset().y;
     1197                mouseY += getOffset().getY();
    11981198
    11991199                float y = getY();
     
    15451545        @Override
    15461546        public boolean contains(Point mousePosition) {
    1547                 return contains(mousePosition.x, mousePosition.y, getGravity() * NEARBY_GRAVITY);
     1547                return contains(mousePosition.getX(), mousePosition.getY(), getGravity() * NEARBY_GRAVITY);
    15481548        }
    15491549       
     
    15551555        public boolean contains(int mouseX, int mouseY, int gravity)
    15561556        {
    1557                 mouseX += getOffset().x;
    1558                 mouseY += getOffset().y;
     1557                mouseX += getOffset().getX();
     1558                mouseY += getOffset().getY();
    15591559
    15601560                float textY = getY();
     
    18691869                        // return;
    18701870                }
    1871 
     1871               
    18721872                // check if its a vector item and paint all the vector stuff too if this
    18731873                // item is a free item
     
    20512051                                newPoint.set(insertText("\b", mouseX, mouseY, 1));
    20522052                                if (_text.length() > 0 && _text.charAt(0) == ' ')
    2053                                         newPoint.set(insertText("\b", newPoint.x, newPoint.y, 1));
     2053                                        newPoint.set(insertText("\b", newPoint.getX(), newPoint.getY(), 1));
    20542054                        } else {
    20552055                                newPoint.set(insertText("@", mouseX, mouseY, 0));
     
    20612061                        if (!isLineEnd() && _text.charAt(0) == '@') {
    20622062                                newPoint.set(insertText("\b", mouseX, mouseY, 1));
    2063                                 newPoint.set(insertText(DEFAULT_BULLET_STRING, newPoint.x, newPoint.y, 0));
     2063                                newPoint.set(insertText(DEFAULT_BULLET_STRING, newPoint.getX(), newPoint.getY(), 0));
    20642064                        } else {
    20652065                                newPoint.set(insertText("\b", mouseX, mouseY, 1));
     
    20682068                FrameUtils.setLastEdited(this);
    20692069                rebuild(true);
    2070                 DisplayController.setCursorPosition(newPoint.x, newPoint.y, false);
     2070                DisplayController.setCursorPosition(newPoint.getX(), newPoint.getY(), false);
    20712071        }
    20722072
     
    28382838
    28392839                Point newMouse = t.insertChar(start, DisplayController.getMouseX(), DisplayController.getMouseY());
    2840                 DisplayController.setCursorPosition(newMouse.x, newMouse.y, false);
     2840                DisplayController.setCursorPosition(newMouse.getX(), newMouse.getY(), false);
    28412841
    28422842                return t;
  • trunk/src/org/expeditee/items/widgets/HeavyDutyInteractiveWidget.java

    r1102 r1143  
    273273                // Render shaded window over widget
    274274                g.setColor(SwingConversions.toSwingColor(backgroundColor));
    275                 g.fillRect(getX(), getY(), getWidth(), getHeight());
    276                
     275                final int x = getX();
     276                final int y = getY();
     277                final int width = getWidth();
     278                final int height = getHeight();
     279                g.fillRect(x, y, width, height);
     280                               
    277281                // Center the bar
    278                 int barX = getX() + BAR_HOROZONTIAL_MARGIN;
    279                 int barY = getY() + (getHeight() >> 1) - (BAR_HEIGHT >> 1);
    280                
    281                 int barWidth = getWidth() - (BAR_HOROZONTIAL_MARGIN * 2);
     282                int barX = x + BAR_HOROZONTIAL_MARGIN;
     283                int barY = y + (height >> 1) - (BAR_HEIGHT >> 1);
     284               
     285                int barWidth = width - (BAR_HOROZONTIAL_MARGIN * 2);
    282286                if (barWidth <= 0) barWidth = 10;
    283287               
  • trunk/src/org/expeditee/items/widgets/SwingWidget.java

    r1098 r1143  
    44import java.awt.Container;
    55import java.awt.Graphics2D;
     6import java.awt.Point;
    67
    78import javax.swing.JComponent;
     
    109110                Graphics2D g = SwingMiscManager.getIfUsingSwingGraphicsManager().getCurrentSurface();
    110111
    111                 int x = getX();
    112                 int y = getY();
     112                final Point location = _swingComponent.getLocation();
     113                int x = location.x;
     114                int y = location.y;
    113115               
    114116                g.translate(x, y);
  • trunk/src/org/expeditee/items/widgets/Widget.java

    r1098 r1143  
    900900               
    901901                _settingPositionFlag = true;
    902 
     902               
    903903                invalidateLink();
    904904
  • trunk/src/org/expeditee/items/widgets/charts/AbstractChart.java

    r1102 r1143  
    175175                                Point origin = getOrigin();
    176176                                return new MouseEvent((Component) e.getSource(), e.getID(), e
    177                                                 .getWhen(), e.getModifiers(), origin.x + e.getX(),
    178                                                 origin.y + e.getY(), e.getXOnScreen(),
     177                                                .getWhen(), e.getModifiers(), origin.getX() + e.getX(),
     178                                                origin.getY() + e.getY(), e.getXOnScreen(),
    179179                                                e.getYOnScreen(), e.getClickCount(), false, e
    180180                                                                .getButton());
Note: See TracChangeset for help on using the changeset viewer.