svn-document-layout / trunk / org.gvsig.app.document.layout2.app / org.gvsig.app.document.layout2.app.mainplugin / src / main / java / org / gvsig / app / project / documents / layout / tools / LayoutAddLineListenerImpl.java @ 168
History | View | Annotate | Download (3.08 KB)
1 | 5 | jldominguez | /* 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 | * realizar
|
||
38 | * una l�nea.
|
||
39 | *
|
||
40 | * @author Vicente Caballero Navarro
|
||
41 | */
|
||
42 | public class LayoutAddLineListenerImpl extends AbstractLayoutGraphicListener |
||
43 | implements LayoutPointListener {
|
||
44 | |||
45 | public static final Image iLine = PluginServices.getIconTheme() |
||
46 | 24 | jldominguez | .get("cursor-layout-insert-polyline").getImage();
|
47 | 5 | jldominguez | |
48 | /**
|
||
49 | * Crea un nuevo LayoutAddLineListenerImpl.
|
||
50 | *
|
||
51 | * @param l
|
||
52 | * Layout.
|
||
53 | */
|
||
54 | public LayoutAddLineListenerImpl(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 (layoutPanel.getLayoutControl().addGeometryAdapterPoint() == 2) { |
||
64 | endGraphic(); |
||
65 | } |
||
66 | } |
||
67 | } |
||
68 | |||
69 | /**
|
||
70 | * @see org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener#getCursor()
|
||
71 | */
|
||
72 | public Image getImageCursor() { |
||
73 | return iLine;
|
||
74 | } |
||
75 | |||
76 | /**
|
||
77 | * @see org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener#cancelDrawing()
|
||
78 | */
|
||
79 | public boolean cancelDrawing() { |
||
80 | System.out.println("cancelDrawing del ZoomOutListenerImpl"); |
||
81 | return true; |
||
82 | } |
||
83 | |||
84 | public void pointDoubleClick(PointEvent event) { |
||
85 | // TODO Auto-generated method stub
|
||
86 | |||
87 | } |
||
88 | |||
89 | public GeometryAdapter createGeometryAdapter() {
|
||
90 | return new PolyLineAdapter(); |
||
91 | } |
||
92 | |||
93 | @Override
|
||
94 | public int getFFrameGraphicsType() { |
||
95 | return Geometry.TYPES.CURVE;
|
||
96 | } |
||
97 | } |