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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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               
Note: See TracChangeset for help on using the changeset viewer.