Statistics
| Revision:

svn-document-layout / tags / 2059 / org.gvsig.app.document.layout.app.mainplugin / src / main / java / org / gvsig / app / project / documents / layout / tools / LayoutAddPolylineListenerImpl.java @ 46

History | View | Annotate | Download (3.07 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.app.project.documents.layout.tools;
23

    
24
import java.awt.Image;
25
import java.awt.event.MouseEvent;
26

    
27
import org.gvsig.andami.PluginServices;
28
import org.gvsig.app.project.documents.layout.geometryadapters.GeometryAdapter;
29
import org.gvsig.app.project.documents.layout.geometryadapters.PolyLineAdapter;
30
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
31
import org.gvsig.app.project.documents.layout.tools.listener.LayoutPointListener;
32
import org.gvsig.fmap.geom.Geometry;
33
import org.gvsig.fmap.mapcontrol.tools.Events.PointEvent;
34

    
35
/**
36
 * Implementaci�n de la interfaz LayoutPointListener como herramienta para
37
 * a�adir una polilinea.
38
 * 
39
 * @author Vicente Caballero Navarro
40
 */
41
public class LayoutAddPolylineListenerImpl extends
42
    AbstractLayoutGraphicListener implements LayoutPointListener {
43

    
44
    public static final Image iLine = PluginServices.getIconTheme()
45
        .get("cursor-layout-insert-polyline").getImage();
46

    
47
    /**
48
     * Crea un nuevo LayoutZoomOutListenerImpl.
49
     * 
50
     * @param mapControl
51
     *            MapControl.
52
     */
53
    public LayoutAddPolylineListenerImpl(LayoutPanel layoutPanel) {
54
        super(layoutPanel);
55
    }
56

    
57
    /**
58
     * @see org.gvsig.fmap.mapcontrol.tools.Listeners.PointListener#point(com.iver.cit.gvsig.fmap.tools.PointEvent)
59
     */
60
    public void point(PointEvent event) {
61
        if (event.getEvent().getButton() == MouseEvent.BUTTON1) {
62
            layoutPanel.getLayoutControl().addGeometryAdapterPoint();
63
        }
64
    }
65

    
66
    /**
67
     * @see org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener#getCursor()
68
     */
69
    public Image getImageCursor() {
70
        return iLine;
71
    }
72

    
73
    /**
74
     * @see org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener#cancelDrawing()
75
     */
76
    public boolean cancelDrawing() {
77
        System.out.println("cancelDrawing del ZoomOutListenerImpl");
78
        return true;
79
    }
80

    
81
    public void pointDoubleClick(PointEvent event) {
82
        layoutPanel.getLayoutControl().delLastPoint();
83
        endGraphic();
84
    }
85

    
86
    public GeometryAdapter createGeometryAdapter() {
87
        return new PolyLineAdapter();
88
    }
89

    
90
    @Override
91
    public int getFFrameGraphicsType() {
92
        return Geometry.TYPES.CURVE;
93
    }
94
}