svn-document-layout / tags / 2059 / org.gvsig.app.document.layout.app.mainplugin / src / main / java / org / gvsig / app / project / documents / layout / tools / LayoutAddRectangleListenerImpl.java @ 46
History | View | Annotate | Download (3.16 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.RectangleAdapter; |
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 |
* realizar
|
38 |
* un rect?ngulo.
|
39 |
*
|
40 |
* @author Vicente Caballero Navarro
|
41 |
*/
|
42 |
public class LayoutAddRectangleListenerImpl extends |
43 |
AbstractLayoutGraphicListener implements LayoutPointListener {
|
44 |
|
45 |
public static final Image iRectangle = PluginServices.getIconTheme() |
46 |
.get("cursor-layout-insert-rectangle").getImage();
|
47 |
|
48 |
/**
|
49 |
* Crea un nuevo LayoutAddRectagleListenerImpl.
|
50 |
*
|
51 |
* @param l
|
52 |
* Layout.
|
53 |
*/
|
54 |
public LayoutAddRectangleListenerImpl(LayoutPanel layoutPanel) {
|
55 |
super(layoutPanel);
|
56 |
} |
57 |
|
58 |
/**
|
59 |
* @see org.gvsig.fmap.mapcontrol.tools.Listeners.PointListener#point(com.iver.cit.gvsig.fmap.tools.PointEvent)
|
60 |
*/
|
61 |
public void point(PointEvent event) { |
62 |
if (event.getEvent().getButton() == MouseEvent.BUTTON1) { |
63 |
if (event.getEvent().getButton() == MouseEvent.BUTTON1) { |
64 |
if (layoutPanel.getLayoutControl().addGeometryAdapterPoint() == 2) { |
65 |
endGraphic(); |
66 |
} |
67 |
} |
68 |
} |
69 |
} |
70 |
|
71 |
/**
|
72 |
* @see org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener#getCursor()
|
73 |
*/
|
74 |
public Image getImageCursor() { |
75 |
return iRectangle;
|
76 |
} |
77 |
|
78 |
/**
|
79 |
* @see org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener#cancelDrawing()
|
80 |
*/
|
81 |
public boolean cancelDrawing() { |
82 |
System.out.println("cancelDrawing del ZoomOutListenerImpl"); |
83 |
return true; |
84 |
} |
85 |
|
86 |
public void pointDoubleClick(PointEvent event) { |
87 |
|
88 |
} |
89 |
|
90 |
public GeometryAdapter createGeometryAdapter() {
|
91 |
return new RectangleAdapter(); |
92 |
} |
93 |
|
94 |
@Override
|
95 |
public int getFFrameGraphicsType() { |
96 |
return Geometry.TYPES.SURFACE;
|
97 |
} |
98 |
} |