Ignore:
Timestamp:
2011-11-28T11:47:56+01:00 (13 years ago)
Author:
larry0ua
Message:

'PicLayer - now markers are visible only when they are needed - active Layer and transform/add marker mapmode'

Location:
applications/editors/josm/plugins/piclayer
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/piclayer/build.xml

    r27166 r27168  
    2222-->
    2323<project name="PicLayer" default="dist" basedir=".">
    24     <property name="commit.message" value="PicLayer - removed hiding buttons from PicLayer main menu - this is in core responsibility now"/>
     24    <property name="commit.message" value="PicLayer - now markers are visible only when they are needed - active Layer and transform/add marker mapmode"/>
    2525    <property name="plugin.main.version" value="4549"/>
    2626    <!--
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java

    r27166 r27168  
    130130                btn.setVisible(false);
    131131            }
     132            if (oldLayer != null)
     133                ((PicLayerAbstract)oldLayer).setDrawPoints(false);
    132134        }
    133135        if (!oldPic && newPic) { // enter picture layer - reset visibility of controls
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/GenericPicTransformAction.java

    r27120 r27168  
    5454            if ( Main.map.mapView.getActiveLayer() instanceof PicLayerAbstract ) {
    5555                currentLayer = (PicLayerAbstract)Main.map.mapView.getActiveLayer();
    56        
     56
    5757                if ( currentLayer != null && e.getButton() == MouseEvent.BUTTON1 ) {
    5858                    isDragging = true;
     
    8888                return l instanceof PicLayerAbstract;
    8989        }
    90        
    91        
     90
     91        protected void updateDrawPoints(boolean value) {
     92            Layer active = Main.map.mapView.getActiveLayer();
     93        if (active instanceof PicLayerAbstract) {
     94            ((PicLayerAbstract)active).setDrawPoints(value);
     95        }
     96        Main.map.mapView.repaint();
     97        }
     98
    9299}
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/MovePointAction.java

    r27120 r27168  
    3232                }
    3333        }
    34        
     34
    3535        @Override
    3636        public void mouseClicked(MouseEvent e) {
    3737                if (currentLayer == null)
    3838                        return;
    39                
     39
    4040                try {
    4141                        Point2D pressed = currentLayer.transformPoint(e.getPoint());
     
    4747                Main.map.mapView.repaint();
    4848        }
     49
     50        @Override
     51        public void enterMode() {
     52            super.enterMode();
     53            updateDrawPoints(true);
     54        }
     55
     56        @Override
     57        public void exitMode() {
     58            super.exitMode();
     59            updateDrawPoints(false);
     60        }
    4961}
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/TransformPointAction.java

    r27120 r27168  
    3434                }
    3535        }
     36    @Override
     37    public void enterMode() {
     38        super.enterMode();
     39        updateDrawPoints(true);
     40    }
    3641
     42    @Override
     43    public void exitMode() {
     44        super.exitMode();
     45        updateDrawPoints(false);
     46    }
    3747}
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerAbstract.java

    r27154 r27168  
    7777    private Icon layerIcon = null;
    7878
     79    private boolean drawPoints = true;
     80
     81    public void setDrawPoints(boolean value) {
     82        drawPoints = value;
     83    }
     84
    7985    private PictureTransform transformer;
    8086
     
    239245                );
    240246            }
    241             // draw points for selection
    242             Graphics2D gPoints = (Graphics2D)g2.create();
    243 
    244             gPoints.translate(pic_offset_x, pic_offset_y);
    245 
    246             gPoints.setColor(Color.RED); // red color for points output
    247 
    248             AffineTransform tr = AffineTransform.getScaleInstance(scalex, scaley);
    249             tr.concatenate(transformer.getTransform());
    250 
    251             for (Point2D p : transformer.getOriginPoints()) {
    252                Point2D trP = tr.transform(p, null);
    253                int x = (int)trP.getX(), y = (int)trP.getY();
    254                gPoints.drawOval(x-2, y-2, 5, 5);
    255                gPoints.drawImage(pinImage, x, y, null);
     247            if (drawPoints ) {
     248                // draw points for selection
     249                Graphics2D gPoints = (Graphics2D)g2.create();
     250
     251                gPoints.translate(pic_offset_x, pic_offset_y);
     252
     253                gPoints.setColor(Color.RED); // red color for points output
     254
     255                AffineTransform tr = AffineTransform.getScaleInstance(scalex, scaley);
     256                tr.concatenate(transformer.getTransform());
     257
     258                for (Point2D p : transformer.getOriginPoints()) {
     259                   Point2D trP = tr.transform(p, null);
     260                   int x = (int)trP.getX(), y = (int)trP.getY();
     261                   gPoints.drawOval(x-2, y-2, 5, 5);
     262                   gPoints.drawImage(pinImage, x, y, null);
     263                }
    256264            }
    257 
    258265        } else {
    259266            // TODO: proper logging
Note: See TracChangeset for help on using the changeset viewer.