Revision 330
tags/org.gvsig.app.document.layout2.app-2.0.43/org.gvsig.app.document.layout2.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Sun Feb 08 18:08:59 CET 2015 |
|
2 |
buildNumber=62 |
tags/org.gvsig.app.document.layout2.app-2.0.43/org.gvsig.app.document.layout2.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
</files> |
|
17 |
|
|
18 |
<fileSets> |
|
19 |
<fileSet> |
|
20 |
<directory>src/main/resources-plugin</directory> |
|
21 |
<outputDirectory>.</outputDirectory> |
|
22 |
</fileSet> |
|
23 |
</fileSets> |
|
24 |
|
|
25 |
<dependencySets> |
|
26 |
|
|
27 |
<!-- |
|
28 |
<dependencySet> |
|
29 |
<useProjectArtifact>false</useProjectArtifact> |
|
30 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
31 |
<outputDirectory>lib</outputDirectory> |
|
32 |
<includes> |
|
33 |
</includes> |
|
34 |
</dependencySet> |
|
35 |
|
|
36 |
--> |
|
37 |
|
|
38 |
</dependencySets> |
|
39 |
|
|
40 |
</assembly> |
|
0 | 41 |
tags/org.gvsig.app.document.layout2.app-2.0.43/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/gui/preferencespage/PrintPropertiesPage.java | ||
---|---|---|
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.gui.preferencespage; |
|
23 |
|
|
24 |
import java.awt.Dimension; |
|
25 |
import java.awt.GridLayout; |
|
26 |
|
|
27 |
import javax.swing.ButtonGroup; |
|
28 |
import javax.swing.ImageIcon; |
|
29 |
import javax.swing.JCheckBox; |
|
30 |
import javax.swing.JLabel; |
|
31 |
import javax.swing.JPanel; |
|
32 |
import javax.swing.JRadioButton; |
|
33 |
import javax.swing.JTextField; |
|
34 |
|
|
35 |
import org.gvsig.andami.PluginServices; |
|
36 |
import org.gvsig.andami.preferences.AbstractPreferencePage; |
|
37 |
import org.gvsig.andami.preferences.StoreException; |
|
38 |
|
|
39 |
public class PrintPropertiesPage extends AbstractPreferencePage { |
|
40 |
|
|
41 |
private static final long serialVersionUID = 5806304468312341691L; |
|
42 |
private static final boolean FACTORY_DEFAULT_LANDSCAPED_PAGE = true; |
|
43 |
protected static String id = PrintPropertiesPage.class.getName(); |
|
44 |
private ImageIcon icon; |
|
45 |
private JRadioButton rdBtnPortraitPage; |
|
46 |
private JRadioButton rdBtnLandscapePage; |
|
47 |
private JCheckBox chkCustomMargins; |
|
48 |
private JTextField txtTopMargin; |
|
49 |
private JTextField txtLeftMargin; |
|
50 |
private JTextField txtBottomMargin; |
|
51 |
private JTextField txtRightMargin; |
|
52 |
|
|
53 |
public PrintPropertiesPage() { |
|
54 |
super(); |
|
55 |
setParentID(LayoutPage.class.getName()); |
|
56 |
icon = PluginServices.getIconTheme().get("prepare-page-icon"); |
|
57 |
rdBtnPortraitPage = |
|
58 |
new JRadioButton(PluginServices.getText(this, |
|
59 |
"options.layout.paper_properties.portrait")); |
|
60 |
ImageIcon portrait = |
|
61 |
PluginServices.getIconTheme().get("portrait-page-setup"); |
|
62 |
rdBtnLandscapePage = |
|
63 |
new JRadioButton(PluginServices.getText(this, |
|
64 |
"options.layout.paper_properties.landscaped")); |
|
65 |
ImageIcon landscape = |
|
66 |
PluginServices.getIconTheme().get("landscape-page-setup"); |
|
67 |
|
|
68 |
ButtonGroup group = new ButtonGroup(); |
|
69 |
group.add(rdBtnLandscapePage); |
|
70 |
group.add(rdBtnPortraitPage); |
|
71 |
|
|
72 |
JPanel aux = new JPanel(new GridLayout(2, 2, 10, 0)); |
|
73 |
aux.setPreferredSize(new Dimension(200, 150)); |
|
74 |
aux.setSize(200, 150); |
|
75 |
aux.add(new JLabel(landscape)); |
|
76 |
aux.add(new JLabel(portrait)); |
|
77 |
aux.add(rdBtnLandscapePage); |
|
78 |
aux.add(rdBtnPortraitPage); |
|
79 |
|
|
80 |
addComponent(new JLabel(PluginServices.getText(this, |
|
81 |
"options.layout.paper_properties.paper_direction"))); |
|
82 |
addComponent("", aux); |
|
83 |
addComponent(chkCustomMargins = |
|
84 |
new JCheckBox(PluginServices.getText(this, "personalizar_margenes"))); |
|
85 |
|
|
86 |
JPanel aux2 = new JPanel(new GridLayout(2, 4, 10, 3)); |
|
87 |
aux2.add(new JLabel(PluginServices.getText(this, "Superior"))); |
|
88 |
aux2.add(txtTopMargin = new JTextField(10)); |
|
89 |
aux2.add(new JLabel(PluginServices.getText(this, "Izquierdo"))); |
|
90 |
aux2.add(txtLeftMargin = new JTextField(10)); |
|
91 |
aux2.add(new JLabel(PluginServices.getText(this, "Inferior"))); |
|
92 |
aux2.add(txtBottomMargin = new JTextField(10)); |
|
93 |
aux2.add(new JLabel(PluginServices.getText(this, "Derecho"))); |
|
94 |
aux2.add(txtRightMargin = new JTextField(10)); |
|
95 |
addComponent("", aux2); |
|
96 |
} |
|
97 |
|
|
98 |
public void storeValues() throws StoreException { |
|
99 |
// TODO Auto-generated method stub |
|
100 |
|
|
101 |
} |
|
102 |
|
|
103 |
public void setChangesApplied() { |
|
104 |
// TODO Auto-generated method stub |
|
105 |
|
|
106 |
} |
|
107 |
|
|
108 |
public String getID() { |
|
109 |
return id; |
|
110 |
} |
|
111 |
|
|
112 |
public String getTitle() { |
|
113 |
return PluginServices.getText(this, |
|
114 |
"options.layout.paper_properties.title"); |
|
115 |
} |
|
116 |
|
|
117 |
public JPanel getPanel() { |
|
118 |
return this; |
|
119 |
} |
|
120 |
|
|
121 |
public void initializeValues() { |
|
122 |
// TODO Auto-generated method stub |
|
123 |
|
|
124 |
} |
|
125 |
|
|
126 |
public void initializeDefaults() { |
|
127 |
rdBtnLandscapePage.setSelected(FACTORY_DEFAULT_LANDSCAPED_PAGE); |
|
128 |
rdBtnPortraitPage.setSelected(!FACTORY_DEFAULT_LANDSCAPED_PAGE); |
|
129 |
} |
|
130 |
|
|
131 |
public ImageIcon getIcon() { |
|
132 |
return icon; |
|
133 |
} |
|
134 |
|
|
135 |
public boolean isValueChanged() { |
|
136 |
// TODO Auto-generated method stub |
|
137 |
return false; |
|
138 |
} |
|
139 |
|
|
140 |
} |
tags/org.gvsig.app.document.layout2.app-2.0.43/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/gui/preferencespage/LayoutPage.java | ||
---|---|---|
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.gui.preferencespage; |
|
23 |
|
|
24 |
import java.awt.GridBagConstraints; |
|
25 |
import java.awt.Insets; |
|
26 |
|
|
27 |
import javax.swing.BorderFactory; |
|
28 |
import javax.swing.ImageIcon; |
|
29 |
import javax.swing.JCheckBox; |
|
30 |
import javax.swing.JComboBox; |
|
31 |
import javax.swing.JLabel; |
|
32 |
import javax.swing.JPanel; |
|
33 |
import javax.swing.JTextField; |
|
34 |
|
|
35 |
import org.gvsig.andami.IconThemeHelper; |
|
36 |
import org.gvsig.andami.PluginServices; |
|
37 |
import org.gvsig.andami.PluginsLocator; |
|
38 |
import org.gvsig.andami.preferences.AbstractPreferencePage; |
|
39 |
import org.gvsig.andami.preferences.StoreException; |
|
40 |
import org.gvsig.app.project.ProjectManager; |
|
41 |
import org.gvsig.app.project.documents.layout.Attributes; |
|
42 |
import org.gvsig.app.project.documents.layout.DefaultLayoutManager; |
|
43 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
44 |
import org.gvsig.gui.beans.swing.GridBagLayoutPanel; |
|
45 |
import org.gvsig.i18n.Messages; |
|
46 |
import org.gvsig.utils.XMLEntity; |
|
47 |
|
|
48 |
/** |
|
49 |
* Layout preference page where the user can establish default values for |
|
50 |
* <ol> |
|
51 |
* <li><b>grid horizontal gap</b></li> |
|
52 |
* <li><b>grid vertical gap</b></li> |
|
53 |
* <li><b>show or hide grid</b></li> |
|
54 |
* <li><b>adjust elements to grid</b></li> |
|
55 |
* <li><b>show or hide rules</b></li> |
|
56 |
* </ol> |
|
57 |
* |
|
58 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
|
59 |
* |
|
60 |
*/ |
|
61 |
public class LayoutPage extends AbstractPreferencePage { |
|
62 |
|
|
63 |
private static final long serialVersionUID = -8225970409668105935L; |
|
64 |
static String id = LayoutPage.class.getName();; |
|
65 |
private ImageIcon icon; |
|
66 |
private JCheckBox chkGridEnabled; |
|
67 |
private JCheckBox chkShowRules; |
|
68 |
private JCheckBox chkShowGrid; |
|
69 |
private JTextField txtVGap; |
|
70 |
private JTextField txtHGap; |
|
71 |
private JCheckBox chkShowInitialPageConfig; |
|
72 |
private JCheckBox chkShowLayoutTOC; |
|
73 |
private JComboBox cbHGapUnit; |
|
74 |
private JComboBox cbVGapUnit; |
|
75 |
|
|
76 |
private static DefaultLayoutManager layoutManager = null; |
|
77 |
|
|
78 |
/** |
|
79 |
* Builds preference page where the user can establish default values for |
|
80 |
* <ol> |
|
81 |
* <li><b>grid horizontal gap</b></li> |
|
82 |
* <li><b>grid vertical gap</b></li> |
|
83 |
* <li><b>show or hide grid</b></li> |
|
84 |
* <li><b>adjust elements to grid</b></li> |
|
85 |
* <li><b>show or hide rules</b></li> |
|
86 |
* </ol> |
|
87 |
*/ |
|
88 |
public LayoutPage() { |
|
89 |
super(); |
|
90 |
layoutManager = |
|
91 |
(DefaultLayoutManager) ProjectManager.getInstance() |
|
92 |
.getDocumentManager(DefaultLayoutManager.TYPENAME); |
|
93 |
|
|
94 |
icon = IconThemeHelper.getImageIcon("document-map-icon"); |
|
95 |
|
|
96 |
GridBagLayoutPanel gridRulerPanel = new GridBagLayoutPanel(); |
|
97 |
Insets topInsets = new Insets(10, 10, 0, 10); |
|
98 |
Insets insets = new Insets(8, 10, 0, 10); |
|
99 |
Insets lastInsets = new Insets(8, 10, 12, 10); |
|
100 |
gridRulerPanel.setBorder(BorderFactory.createTitledBorder(Messages.getText("Grid_and_ruler"))); |
|
101 |
|
|
102 |
// horizontal gap text field and units combo |
|
103 |
cbHGapUnit = new JComboBox(); |
|
104 |
String[] names = MapContext.getDistanceNames(); |
|
105 |
for (int i = 0; i < names.length; i++) { |
|
106 |
cbHGapUnit.addItem(PluginServices.getText(this, names[i])); |
|
107 |
} |
|
108 |
gridRulerPanel.addComponent(new JLabel(PluginServices.getText(this, "espaciado_horizontal")), |
|
109 |
txtHGap = new JTextField(5), cbHGapUnit, GridBagConstraints.NONE, insets); |
|
110 |
|
|
111 |
// vertical gap text field and units combo |
|
112 |
cbVGapUnit = new JComboBox(); |
|
113 |
for (int i = 0; i < names.length; i++) { |
|
114 |
cbVGapUnit.addItem(PluginServices.getText(this, names[i])); |
|
115 |
} |
|
116 |
gridRulerPanel.addComponent(new JLabel(PluginServices.getText(this, "espaciado_vertical")), |
|
117 |
txtVGap = new JTextField(5), cbVGapUnit, GridBagConstraints.NONE, insets); |
|
118 |
|
|
119 |
// show/hide show check |
|
120 |
gridRulerPanel.addComponent(chkShowGrid = |
|
121 |
new JCheckBox(PluginServices.getText(this, "visualizar_cuadricula")), insets); |
|
122 |
|
|
123 |
// enable/disable grid |
|
124 |
gridRulerPanel.addComponent(chkGridEnabled = |
|
125 |
new JCheckBox(PluginServices.getText(this, "malla_activada")), insets); |
|
126 |
|
|
127 |
// show/hide rules |
|
128 |
gridRulerPanel.addComponent(chkShowRules = |
|
129 |
new JCheckBox(PluginServices.getText(this, "activar_regla")), lastInsets); |
|
130 |
|
|
131 |
addComponent(gridRulerPanel, topInsets); |
|
132 |
|
|
133 |
GridBagLayoutPanel behaviourPanel = new GridBagLayoutPanel(); |
|
134 |
behaviourPanel.setBorder(BorderFactory.createTitledBorder(Messages.getText("User_interface"))); |
|
135 |
|
|
136 |
behaviourPanel.addComponent( |
|
137 |
chkShowInitialPageConfig = new JCheckBox(Messages.getText("Show_page_config_dialog_when_layout_document_is_created")), |
|
138 |
insets); |
|
139 |
|
|
140 |
behaviourPanel.addComponent( |
|
141 |
chkShowLayoutTOC = new JCheckBox(Messages.getText("Show_table_of_contents_TOC_for_Layout_views")), |
|
142 |
insets); |
|
143 |
|
|
144 |
addComponent(behaviourPanel, lastInsets); |
|
145 |
|
|
146 |
} |
|
147 |
|
|
148 |
public void storeValues() throws StoreException { |
|
149 |
double hGap, vGap; |
|
150 |
boolean gridEnabled, showRules, showGrid, showInitPageConfig, |
|
151 |
showLayoutToc; |
|
152 |
String hGapUnits, vGapUnits; |
|
153 |
try { |
|
154 |
hGap = Double.parseDouble(txtHGap.getText()); |
|
155 |
hGapUnits = MapContext.getDistanceAbbr()[cbHGapUnit.getSelectedIndex()]; |
|
156 |
vGap = Double.parseDouble(txtVGap.getText()); |
|
157 |
vGapUnits = MapContext.getDistanceAbbr()[cbVGapUnit.getSelectedIndex()]; |
|
158 |
gridEnabled = chkGridEnabled.isSelected(); |
|
159 |
showGrid = chkShowGrid.isSelected(); |
|
160 |
showRules = chkShowRules.isSelected(); |
|
161 |
showInitPageConfig = chkShowInitialPageConfig.isSelected(); |
|
162 |
showLayoutToc = chkShowLayoutTOC.isSelected(); |
|
163 |
} catch (Exception e) { |
|
164 |
throw new StoreException(PluginServices.getText(this, |
|
165 |
"invalid_value_for_gap")); |
|
166 |
} |
|
167 |
layoutManager.setDefaultShowGrid(showGrid); |
|
168 |
layoutManager.setDefaultAdjustToGrid(gridEnabled); |
|
169 |
layoutManager.setDefaultShowRulers(showRules); |
|
170 |
Attributes.setDefaultGridGap(hGap, vGap, hGapUnits, vGapUnits); |
|
171 |
PluginServices ps = PluginsLocator.getManager().getPlugin(this); |
|
172 |
XMLEntity xml = ps.getPersistentXML(); |
|
173 |
xml.putProperty(PreferenceKeys.DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_KEY_NAME, hGap); |
|
174 |
xml.putProperty(PreferenceKeys.DEFAULT_LAYOUT_GRID_VERTICAL_GAP_KEY_NAME, vGap); |
|
175 |
xml.putProperty(PreferenceKeys.DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_UNITS_KEY_NAME, hGapUnits); |
|
176 |
xml.putProperty(PreferenceKeys.DEFAULT_LAYOUT_GRID_VERTICAL_GAP_UNITS_KEY_NAME, vGapUnits); |
|
177 |
xml.putProperty(PreferenceKeys.DEFAULT_SHOW_LAYOUT_GRID_KEY_NAME, showGrid); |
|
178 |
xml.putProperty(PreferenceKeys.DEFAULT_ENABLE_LAYOUT_GRID_KEY_NAME, gridEnabled); |
|
179 |
xml.putProperty(PreferenceKeys.DEFAULT_SHOW_LAYOUT_RULERS_KEY_NAME, showRules); |
|
180 |
xml.putProperty(PreferenceKeys.DEFAULT_SHOW_INITIAL_CONFIG_DIALOG_KEY_NAME, showInitPageConfig); |
|
181 |
xml.putProperty(PreferenceKeys.DEFAULT_SHOW_LAYOUT_TOC_KEY_NAME, showLayoutToc); |
|
182 |
} |
|
183 |
|
|
184 |
public String getID() { |
|
185 |
return id; |
|
186 |
} |
|
187 |
|
|
188 |
public String getTitle() { |
|
189 |
return PluginServices.getText(this, "Mapa"); |
|
190 |
} |
|
191 |
|
|
192 |
public JPanel getPanel() { |
|
193 |
return this; |
|
194 |
} |
|
195 |
|
|
196 |
public void initializeValues() { |
|
197 |
PluginServices ps = PluginsLocator.getManager().getPlugin(this); |
|
198 |
XMLEntity xml = ps.getPersistentXML(); |
|
199 |
double hGap = PreferenceKeys.FACTORY_DEFAULT_HORIZONTAL_GAP; |
|
200 |
double vGap = PreferenceKeys.FACTORY_DEFAULT_VERTICAL_GAP; |
|
201 |
boolean showGrid = PreferenceKeys.FACTORY_DEFAULT_LAYOUT_GRID_SHOW; |
|
202 |
boolean gridEnabled = PreferenceKeys.FACTORY_DEFAULT_LAYOUT_GRID_ENABLE; |
|
203 |
boolean showRules = PreferenceKeys.FACTORY_DEFAULT_LAYOUT_ENABLE_RULERS; |
|
204 |
boolean showInitPageConfig = PreferenceKeys.FACTORY_DEFAULT_SHOW_INITIAL_CONFIG_DIALOG_FOR_LAYOUT; |
|
205 |
boolean showLayoutToc = PreferenceKeys.FACTORY_DEFAULT_SHOW_LAYOUT_TOC; |
|
206 |
// horizontal gap |
|
207 |
if (xml.contains(PreferenceKeys.DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_KEY_NAME)) { |
|
208 |
hGap = |
|
209 |
xml.getDoubleProperty(PreferenceKeys.DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_KEY_NAME); |
|
210 |
} |
|
211 |
txtHGap.setText(String.valueOf(hGap)); |
|
212 |
|
|
213 |
// vertical gap |
|
214 |
if (xml.contains(PreferenceKeys.DEFAULT_LAYOUT_GRID_VERTICAL_GAP_KEY_NAME)) { |
|
215 |
vGap = |
|
216 |
xml.getDoubleProperty(PreferenceKeys.DEFAULT_LAYOUT_GRID_VERTICAL_GAP_KEY_NAME); |
|
217 |
} |
|
218 |
txtVGap.setText(String.valueOf(vGap)); |
|
219 |
|
|
220 |
String hGapUnit = xml.contains(PreferenceKeys.DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_UNITS_KEY_NAME)? |
|
221 |
xml.getStringProperty(PreferenceKeys.DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_UNITS_KEY_NAME): |
|
222 |
PreferenceKeys.FACTORY_DEFAULT_HORIZONTAL_GAP_UNIT; |
|
223 |
cbHGapUnit.setSelectedIndex(Attributes.getDistanceAbbrPosition(hGapUnit)); |
|
224 |
|
|
225 |
String vGapUnit = xml.contains(PreferenceKeys.DEFAULT_LAYOUT_GRID_VERTICAL_GAP_UNITS_KEY_NAME)? |
|
226 |
xml.getStringProperty(PreferenceKeys.DEFAULT_LAYOUT_GRID_VERTICAL_GAP_UNITS_KEY_NAME): |
|
227 |
PreferenceKeys.FACTORY_DEFAULT_VERTICAL_GAP_UNIT; |
|
228 |
cbVGapUnit.setSelectedIndex(Attributes.getDistanceAbbrPosition(vGapUnit)); |
|
229 |
|
|
230 |
// show/hide grid check |
|
231 |
if (xml.contains(PreferenceKeys.DEFAULT_SHOW_LAYOUT_GRID_KEY_NAME)) { |
|
232 |
showGrid = |
|
233 |
xml.getBooleanProperty(PreferenceKeys.DEFAULT_SHOW_LAYOUT_GRID_KEY_NAME); |
|
234 |
} |
|
235 |
chkShowGrid.setSelected(showGrid); |
|
236 |
|
|
237 |
// enable/disable grid check |
|
238 |
if (xml.contains(PreferenceKeys.DEFAULT_ENABLE_LAYOUT_GRID_KEY_NAME)) { |
|
239 |
gridEnabled = |
|
240 |
xml.getBooleanProperty(PreferenceKeys.DEFAULT_ENABLE_LAYOUT_GRID_KEY_NAME); |
|
241 |
} |
|
242 |
chkGridEnabled.setSelected(gridEnabled); |
|
243 |
|
|
244 |
// enable/disable rules |
|
245 |
if (xml.contains(PreferenceKeys.DEFAULT_SHOW_LAYOUT_RULERS_KEY_NAME)) { |
|
246 |
showRules = |
|
247 |
xml.getBooleanProperty(PreferenceKeys.DEFAULT_SHOW_LAYOUT_RULERS_KEY_NAME); |
|
248 |
} |
|
249 |
chkShowRules.setSelected(showRules); |
|
250 |
|
|
251 |
if (xml.contains(PreferenceKeys.DEFAULT_SHOW_INITIAL_CONFIG_DIALOG_KEY_NAME)) { |
|
252 |
showInitPageConfig = xml.getBooleanProperty(PreferenceKeys.DEFAULT_SHOW_INITIAL_CONFIG_DIALOG_KEY_NAME); |
|
253 |
} |
|
254 |
chkShowInitialPageConfig.setSelected(showInitPageConfig); |
|
255 |
|
|
256 |
if (xml.contains(PreferenceKeys.DEFAULT_SHOW_LAYOUT_TOC_KEY_NAME)) { |
|
257 |
showLayoutToc = xml.getBooleanProperty(PreferenceKeys.DEFAULT_SHOW_LAYOUT_TOC_KEY_NAME); |
|
258 |
} |
|
259 |
chkShowLayoutTOC.setSelected(showLayoutToc); |
|
260 |
|
|
261 |
layoutManager.setDefaultShowGrid(showGrid); |
|
262 |
layoutManager.setDefaultAdjustToGrid(gridEnabled); |
|
263 |
layoutManager.setDefaultShowRulers(showRules); |
|
264 |
Attributes.setDefaultGridGap(hGap, vGap, hGapUnit, vGapUnit); |
|
265 |
} |
|
266 |
|
|
267 |
public void initializeDefaults() { |
|
268 |
txtHGap.setText(String.valueOf(PreferenceKeys.FACTORY_DEFAULT_HORIZONTAL_GAP)); |
|
269 |
txtVGap.setText(String.valueOf(PreferenceKeys.FACTORY_DEFAULT_VERTICAL_GAP)); |
|
270 |
cbHGapUnit.setSelectedIndex(Attributes.getDistanceAbbrPosition(PreferenceKeys.FACTORY_DEFAULT_HORIZONTAL_GAP_UNIT)); |
|
271 |
cbVGapUnit.setSelectedIndex(Attributes.getDistanceAbbrPosition(PreferenceKeys.FACTORY_DEFAULT_VERTICAL_GAP_UNIT)); |
|
272 |
chkShowGrid.setSelected(PreferenceKeys.FACTORY_DEFAULT_LAYOUT_GRID_SHOW); |
|
273 |
chkGridEnabled.setSelected(PreferenceKeys.FACTORY_DEFAULT_LAYOUT_GRID_ENABLE); |
|
274 |
chkShowRules.setSelected(PreferenceKeys.FACTORY_DEFAULT_LAYOUT_ENABLE_RULERS); |
|
275 |
chkShowInitialPageConfig.setSelected(PreferenceKeys.FACTORY_DEFAULT_SHOW_INITIAL_CONFIG_DIALOG_FOR_LAYOUT); |
|
276 |
} |
|
277 |
|
|
278 |
public ImageIcon getIcon() { |
|
279 |
return icon; |
|
280 |
} |
|
281 |
|
|
282 |
public boolean isValueChanged() { |
|
283 |
return super.hasChanged(); |
|
284 |
} |
|
285 |
|
|
286 |
public void setChangesApplied() { |
|
287 |
setChanged(false); |
|
288 |
} |
|
289 |
} |
tags/org.gvsig.app.document.layout2.app-2.0.43/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/gui/preferencespage/PreferenceKeys.java | ||
---|---|---|
1 |
package org.gvsig.app.gui.preferencespage; |
|
2 |
|
|
3 |
/** |
|
4 |
* The purpose of this interface is to define the keys used for the |
|
5 |
* persistence of this plugin in order to make these keys available |
|
6 |
* on library level, instead of defining them within the |
|
7 |
* preference page (which has UI dependences). |
|
8 |
* |
|
9 |
* @author Cesar Martinez Izquierdo <cesar.izq@gmail.com> |
|
10 |
* |
|
11 |
*/ |
|
12 |
public interface PreferenceKeys { |
|
13 |
String DEFAULT_SHOW_LAYOUT_GRID_KEY_NAME = "DefaultShowLayoutGrid"; |
|
14 |
String DEFAULT_ENABLE_LAYOUT_GRID_KEY_NAME = "DefaultEnableLayoutGrid"; |
|
15 |
String DEFAULT_SHOW_LAYOUT_RULERS_KEY_NAME = "DefaultShowLayoutRules"; |
|
16 |
String DEFAULT_LAYOUT_GRID_VERTICAL_GAP_KEY_NAME = "DefaultGridVerticalGap"; |
|
17 |
String DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_KEY_NAME = "DefaultGridHorizontalGap"; |
|
18 |
String DEFAULT_LAYOUT_GRID_VERTICAL_GAP_UNITS_KEY_NAME = "DefaultGridVerticalGapUnits"; |
|
19 |
String DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_UNITS_KEY_NAME = "DefaultGridHorizontalGapUnits"; |
|
20 |
String DEFAULT_SHOW_INITIAL_CONFIG_DIALOG_KEY_NAME = "DefaulShowInitialPageConfigLayout"; |
|
21 |
String DEFAULT_SHOW_LAYOUT_TOC_KEY_NAME = "DefaultShowLayoutToc"; |
|
22 |
boolean FACTORY_DEFAULT_LAYOUT_ENABLE_RULERS = true; |
|
23 |
boolean FACTORY_DEFAULT_LAYOUT_GRID_SHOW = true; |
|
24 |
double FACTORY_DEFAULT_VERTICAL_GAP = 1.0d; |
|
25 |
double FACTORY_DEFAULT_HORIZONTAL_GAP = 1.0d; |
|
26 |
String FACTORY_DEFAULT_VERTICAL_GAP_UNIT = "cm"; |
|
27 |
String FACTORY_DEFAULT_HORIZONTAL_GAP_UNIT = "cm"; |
|
28 |
boolean FACTORY_DEFAULT_LAYOUT_GRID_ENABLE = false; |
|
29 |
boolean FACTORY_DEFAULT_SHOW_INITIAL_CONFIG_DIALOG_FOR_LAYOUT = true; |
|
30 |
boolean FACTORY_DEFAULT_SHOW_LAYOUT_TOC = true; |
|
31 |
|
|
32 |
} |
|
0 | 33 |
tags/org.gvsig.app.document.layout2.app-2.0.43/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/FLayoutUtilities.java | ||
---|---|---|
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; |
|
23 |
|
|
24 |
import java.awt.Dimension; |
|
25 |
import java.awt.Point; |
|
26 |
import java.awt.geom.AffineTransform; |
|
27 |
import java.awt.geom.NoninvertibleTransformException; |
|
28 |
import java.awt.geom.Point2D; |
|
29 |
import java.awt.geom.Rectangle2D; |
|
30 |
import java.util.ArrayList; |
|
31 |
import java.util.List; |
|
32 |
|
|
33 |
import org.cresques.cts.IProjection; |
|
34 |
import org.slf4j.Logger; |
|
35 |
import org.slf4j.LoggerFactory; |
|
36 |
|
|
37 |
import org.gvsig.app.project.documents.Document; |
|
38 |
import org.gvsig.app.project.documents.layout.fframes.FFrameView; |
|
39 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
|
40 |
import org.gvsig.app.project.documents.layout.fframes.IFFrameUseFMap; |
|
41 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
42 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
43 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
44 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
45 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
46 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
47 |
|
|
48 |
/** |
|
49 |
* Clase que recoge m?todos est?ticos sobre el Layout. |
|
50 |
* |
|
51 |
* @author Vicente Caballero Navarro |
|
52 |
*/ |
|
53 |
public class FLayoutUtilities { |
|
54 |
|
|
55 |
private static Logger logger = LoggerFactory.getLogger( |
|
56 |
FLayoutUtilities.class); |
|
57 |
|
|
58 |
/** |
|
59 |
* Devuelve true si las dos ArrayList que se le pasan como parametro son |
|
60 |
* iguales. |
|
61 |
* |
|
62 |
* @param n |
|
63 |
* lista anterior |
|
64 |
* @param l |
|
65 |
* lista actual |
|
66 |
* |
|
67 |
* @return true si los ArrayList son iguales. |
|
68 |
*/ |
|
69 |
public static boolean isEqualList(ArrayList n, ArrayList l) { |
|
70 |
if (n.size() != l.size()) { |
|
71 |
return false; |
|
72 |
} |
|
73 |
|
|
74 |
for (int i = 0; i < n.size(); i++) { |
|
75 |
if (l.get(i) != n.get(i)) { |
|
76 |
return false; |
|
77 |
} |
|
78 |
} |
|
79 |
|
|
80 |
return true; |
|
81 |
} |
|
82 |
|
|
83 |
/** |
|
84 |
* Pasa una distancia en pixels a unidades del folio. |
|
85 |
* |
|
86 |
* @param d |
|
87 |
* distancia en pixels. |
|
88 |
* @param at |
|
89 |
* Matriz de transformaci?n. |
|
90 |
* |
|
91 |
* @return distancia en unidades de folio. |
|
92 |
*/ |
|
93 |
public static double toSheetDistance(double d, AffineTransform at) { |
|
94 |
double dist = d / at.getScaleX(); // pProv.x; |
|
95 |
|
|
96 |
return dist; |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* Pasa una distancia de coordenadas del folio a pixels. |
|
101 |
* |
|
102 |
* @param d |
|
103 |
* distancia en coordenadas de folio. |
|
104 |
* @param at |
|
105 |
* Matriz de transformaci?n. |
|
106 |
* |
|
107 |
* @return double en pixels. |
|
108 |
*/ |
|
109 |
public static double fromSheetDistance(double d, AffineTransform at) { |
|
110 |
Point2D.Double pSheet1 = new Point2D.Double(0, 0); |
|
111 |
Point2D.Double pSheet2 = new Point2D.Double(1, 0); |
|
112 |
Point2D.Double pScreen1 = new Point2D.Double(); |
|
113 |
Point2D.Double pScreen2 = new Point2D.Double(); |
|
114 |
|
|
115 |
try { |
|
116 |
at.transform(pSheet1, pScreen1); |
|
117 |
at.transform(pSheet2, pScreen2); |
|
118 |
} catch (Exception e) { |
|
119 |
System.err.print(e.getMessage()); |
|
120 |
} |
|
121 |
|
|
122 |
return pScreen1.distance(pScreen2) * d; |
|
123 |
} |
|
124 |
|
|
125 |
/** |
|
126 |
* Pasa un punto en pixels a coordenadas del folio. |
|
127 |
* |
|
128 |
* @param pScreen |
|
129 |
* pixels. |
|
130 |
* @param at |
|
131 |
* Matriz de transformaci?n. |
|
132 |
* |
|
133 |
* @return Point2D en coordenadas de folio. |
|
134 |
*/ |
|
135 |
public static Point2D.Double toSheetPoint(Point2D pScreen, |
|
136 |
AffineTransform at) { |
|
137 |
Point2D.Double pWorld = new Point2D.Double(); |
|
138 |
AffineTransform at1; |
|
139 |
|
|
140 |
try { |
|
141 |
at1 = at.createInverse(); |
|
142 |
at1.transform(pScreen, pWorld); |
|
143 |
} catch (NoninvertibleTransformException e) { |
|
144 |
} |
|
145 |
|
|
146 |
return pWorld; |
|
147 |
} |
|
148 |
|
|
149 |
/** |
|
150 |
* Pasa un ret?ngulo de pixels a coordenadas del folio. |
|
151 |
* |
|
152 |
* @param r |
|
153 |
* rect?ngulo en coordenadas de pixels a coordenadas de folio. |
|
154 |
* @param at |
|
155 |
* Matriz de transformaci?n. |
|
156 |
* |
|
157 |
* @return Rectangle2D en coordenadas de folio. |
|
158 |
*/ |
|
159 |
public static Rectangle2D.Double toSheetRect(Rectangle2D r, |
|
160 |
AffineTransform at) { |
|
161 |
Point2D.Double pSheet = |
|
162 |
toSheetPoint(new Point2D.Double(r.getX(), r.getY()), at); |
|
163 |
Point2D.Double pSheetX = |
|
164 |
toSheetPoint(new Point2D.Double(r.getMaxX(), r.getMinY()), at); |
|
165 |
Point2D.Double pSheetY = |
|
166 |
toSheetPoint(new Point2D.Double(r.getMinX(), r.getMaxY()), at); |
|
167 |
Rectangle2D.Double res = new Rectangle2D.Double(); |
|
168 |
res.setRect(pSheet.getX(), pSheet.getY(), pSheet.distance(pSheetX), |
|
169 |
pSheet.distance(pSheetY)); |
|
170 |
|
|
171 |
return res; |
|
172 |
} |
|
173 |
|
|
174 |
/** |
|
175 |
* Pasa de un punto en coordenadas del folio a pixels. |
|
176 |
* |
|
177 |
* @param pSheet |
|
178 |
* punto en coordenadas de folio. |
|
179 |
* @param at |
|
180 |
* Matriz de transformaci?n. |
|
181 |
* |
|
182 |
* @return Point2D en pixels. |
|
183 |
*/ |
|
184 |
public static Point2D.Double fromSheetPoint(Point2D pSheet, |
|
185 |
AffineTransform at) { |
|
186 |
Point2D.Double pScreen = new Point2D.Double(); |
|
187 |
|
|
188 |
try { |
|
189 |
at.transform(pSheet, pScreen); |
|
190 |
} catch (Exception e) { |
|
191 |
System.err.print(e.getMessage()); |
|
192 |
} |
|
193 |
|
|
194 |
return pScreen; |
|
195 |
} |
|
196 |
|
|
197 |
/** |
|
198 |
* Pasa un rect?ngulo en coordenadas del folio a pixels. |
|
199 |
* |
|
200 |
* @param r |
|
201 |
* rect?ngulo en coordenadas de folio. |
|
202 |
* @param at |
|
203 |
* Matriz de transformaci?n. |
|
204 |
* |
|
205 |
* @return Rectangle2D en pixels. |
|
206 |
*/ |
|
207 |
public static Rectangle2D.Double fromSheetRect(Rectangle2D r, |
|
208 |
AffineTransform at) { |
|
209 |
Point2D.Double pSheet = new Point2D.Double(r.getX(), r.getY()); |
|
210 |
Point2D.Double pSX = new Point2D.Double(r.getMaxX(), r.getMinY()); |
|
211 |
Point2D.Double pSY = new Point2D.Double(r.getMinX(), r.getMaxY()); |
|
212 |
Point2D.Double pScreen = new Point2D.Double(); |
|
213 |
Point2D.Double pScreenX = new Point2D.Double(); |
|
214 |
Point2D.Double pScreenY = new Point2D.Double(); |
|
215 |
|
|
216 |
try { |
|
217 |
at.transform(pSheet, pScreen); |
|
218 |
at.transform(pSX, pScreenX); |
|
219 |
at.transform(pSY, pScreenY); |
|
220 |
} catch (Exception e) { |
|
221 |
System.err.print(e.getMessage()); |
|
222 |
} |
|
223 |
|
|
224 |
Rectangle2D.Double res = new Rectangle2D.Double(); |
|
225 |
res.setRect(pScreen.getX(), pScreen.getY(), pScreen.distance(pScreenX), |
|
226 |
pScreen.distance(pScreenY)); |
|
227 |
|
|
228 |
return res; |
|
229 |
} |
|
230 |
|
|
231 |
/** |
|
232 |
* Obtiene el punto ajustado al grid del layout. |
|
233 |
* |
|
234 |
* @param p |
|
235 |
* Punto a ajustar. |
|
236 |
* @param distX |
|
237 |
* Distancia m?nima en cm de X. |
|
238 |
* @param distY |
|
239 |
* Distancia m?nima en cm de Y. |
|
240 |
* @param at |
|
241 |
* Matriz de transformaci?n. |
|
242 |
*/ |
|
243 |
public static Point getPointGrid(Point p, double distX, double distY, |
|
244 |
AffineTransform at) { |
|
245 |
|
|
246 |
if (distX * at.getScaleX() < 2 && distY * at.getScaleY() < 2) { |
|
247 |
/* |
|
248 |
* In this case, it makes no sense to care about snapping |
|
249 |
* because snapping would mean to move the position by one pixel |
|
250 |
*/ |
|
251 |
return p; |
|
252 |
} |
|
253 |
|
|
254 |
Point2D.Double auxp = |
|
255 |
FLayoutUtilities.fromSheetPoint(new Point2D.Double(0, 0), at); |
|
256 |
|
|
257 |
double gridintx = distX * at.getScaleX(); |
|
258 |
double gridinty = distY * at.getScaleY(); |
|
259 |
|
|
260 |
double seppx = p.x - Math.round(auxp.x); |
|
261 |
double seppy = p.y - Math.round(auxp.y); |
|
262 |
|
|
263 |
long round_int_p_x = Math.round(seppx / gridintx); |
|
264 |
long round_int_p_y = Math.round(seppy / gridinty); |
|
265 |
|
|
266 |
// Rounded |
|
267 |
seppx = round_int_p_x * gridintx; |
|
268 |
seppy = round_int_p_y * gridinty; |
|
269 |
|
|
270 |
return new Point( |
|
271 |
(int) (auxp.x + seppx), |
|
272 |
(int) (auxp.y + seppy)); |
|
273 |
} |
|
274 |
|
|
275 |
/** |
|
276 |
* Cuando se dibuja sobre el graphics todo se tiene que situar en enteros y |
|
277 |
* aqu? lo que se comprueba es que si los valores que contiene el |
|
278 |
* Rectangle2D, que toma como par?metro, supera los valores soportados por |
|
279 |
* un entero. |
|
280 |
* |
|
281 |
* @param r |
|
282 |
* Rectangle2D a comprobar si los valores que contiene no superan |
|
283 |
* a los que puede tener un entero. |
|
284 |
* |
|
285 |
* @return true si no se han superado los l?mites. |
|
286 |
*/ |
|
287 |
public static boolean isPosible(Rectangle2D.Double r) { |
|
288 |
if ((r.getMaxX() > Integer.MAX_VALUE) |
|
289 |
|| (r.getMaxY() > Integer.MAX_VALUE) |
|
290 |
|| (r.getMinX() < Integer.MIN_VALUE) |
|
291 |
|| (r.getMinY() < Integer.MIN_VALUE) |
|
292 |
|| (r.getWidth() > Integer.MAX_VALUE) |
|
293 |
|| (r.getHeight() > Integer.MAX_VALUE)) { |
|
294 |
return false; |
|
295 |
} |
|
296 |
|
|
297 |
return true; |
|
298 |
} |
|
299 |
|
|
300 |
public static List<Document> removeEditing(List<Document> list) { |
|
301 |
|
|
302 |
List<Document> resp = new ArrayList<Document>(); |
|
303 |
|
|
304 |
Document item = null; |
|
305 |
ViewDocument viewdoc = null; |
|
306 |
for (int i=0; i<list.size(); i++) { |
|
307 |
item = list.get(i); |
|
308 |
if (item instanceof ViewDocument) { |
|
309 |
viewdoc = (ViewDocument) item; |
|
310 |
if (!hasEditingLayers(viewdoc)) { |
|
311 |
resp.add(item); |
|
312 |
} |
|
313 |
} |
|
314 |
} |
|
315 |
return resp; |
|
316 |
} |
|
317 |
|
|
318 |
|
|
319 |
public static boolean hasEditingLayers(ViewDocument viewdoc) { |
|
320 |
return hasEditingLayers(viewdoc.getMapContext().getLayers()); |
|
321 |
} |
|
322 |
|
|
323 |
/** |
|
324 |
* Recursively find out if any layer is in editing mode |
|
325 |
* |
|
326 |
* @param lyrs |
|
327 |
* @return |
|
328 |
*/ |
|
329 |
public static boolean hasEditingLayers(FLayers lyrs) { |
|
330 |
|
|
331 |
int len = lyrs.getLayersCount(); |
|
332 |
FLayer lyr = null; |
|
333 |
FLyrVect vlyr = null; |
|
334 |
for (int i=0; i<len; i++) { |
|
335 |
lyr = lyrs.getLayer(i); |
|
336 |
if (lyr instanceof FLyrVect) { |
|
337 |
vlyr = (FLyrVect) lyr; |
|
338 |
if (vlyr.isEditing()) { |
|
339 |
return true; |
|
340 |
} |
|
341 |
} else { |
|
342 |
if (lyr instanceof FLayers) { |
|
343 |
if (hasEditingLayers((FLayers) lyr)) { |
|
344 |
return true; |
|
345 |
} |
|
346 |
} |
|
347 |
} |
|
348 |
} |
|
349 |
return false; |
|
350 |
} |
|
351 |
|
|
352 |
public static Point2D screenCoordinatesToViewportImageCoordinates( |
|
353 |
Point2D screenp, IFFrame frame) { |
|
354 |
|
|
355 |
if (screenp == null || frame == null || !(frame instanceof IFFrameUseFMap)) { |
|
356 |
|
|
357 |
logger.info("Bad parameters in screenCoordinatesToViewportImageCoordinates", |
|
358 |
new Exception("Null values or Frame has no MapContext")); |
|
359 |
return screenp; |
|
360 |
} |
|
361 |
|
|
362 |
Rectangle2D.Double rect = frame.getBoundingBox(null); |
|
363 |
|
|
364 |
double screenRectWidth = rect.width; |
|
365 |
double vpWidth = ((IFFrameUseFMap) frame).getMapContext().getViewPort().getImageWidth(); |
|
366 |
if (screenRectWidth < 1 || vpWidth < 1) { |
|
367 |
logger.info("Bad size in screen/viewport (" |
|
368 |
+ "screenRectWidth = " + screenRectWidth + ", " |
|
369 |
+ "vpWidth = " + vpWidth + ")"); |
|
370 |
return screenp; |
|
371 |
} |
|
372 |
|
|
373 |
/* |
|
374 |
* Get coordinates in the rectangle (remove offset) |
|
375 |
*/ |
|
376 |
Point2D po = new Point2D.Double( |
|
377 |
screenp.getX() - rect.x, screenp.getY() - rect.y); |
|
378 |
|
|
379 |
double ratio = (vpWidth * 1d) / (screenRectWidth * 1d); |
|
380 |
Point2D resp = new Point2D.Double(ratio * po.getX(), ratio * po.getY()); |
|
381 |
return resp; |
|
382 |
} |
|
383 |
|
|
384 |
|
|
385 |
|
|
386 |
} |
tags/org.gvsig.app.document.layout2.app-2.0.43/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/tools/LayoutAddPictureListenerImpl.java | ||
---|---|---|
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 |
|
|
26 |
import org.gvsig.andami.PluginServices; |
|
27 |
import org.gvsig.app.project.documents.layout.fframes.FFramePicture; |
|
28 |
import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
|
29 |
import org.gvsig.app.project.documents.layout.tools.listener.LayoutAddRectangleWithDialogListener; |
|
30 |
|
|
31 |
/** |
|
32 |
* Implementaci๏ฟฝn de la interfaz LayoutRectangleListener como herramienta para |
|
33 |
* realizar una inserci๏ฟฝn por rect๏ฟฝngulo. |
|
34 |
* |
|
35 |
* @author Vicente Caballero Navarro |
|
36 |
*/ |
|
37 |
public class LayoutAddPictureListenerImpl extends |
|
38 |
LayoutAddRectangleWithDialogListener { |
|
39 |
|
|
40 |
private final Image img = PluginServices.getIconTheme() |
|
41 |
.get("cursor-selection-by-rectangle").getImage(); |
|
42 |
|
|
43 |
/** |
|
44 |
* Crea un nuevo LayoutAddRectangleListener. |
|
45 |
* |
|
46 |
* @param l |
|
47 |
* Layout. |
|
48 |
*/ |
|
49 |
public LayoutAddPictureListenerImpl(LayoutPanel l) { |
|
50 |
super(l); |
|
51 |
} |
|
52 |
|
|
53 |
/** |
|
54 |
* @see org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener#getCursor() |
|
55 |
*/ |
|
56 |
public Image getImageCursor() { |
|
57 |
return img; |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* @see org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener#cancelDrawing() |
|
62 |
*/ |
|
63 |
public boolean cancelDrawing() { |
|
64 |
return false; |
|
65 |
} |
|
66 |
|
|
67 |
@Override |
|
68 |
public String getFFrameName() { |
|
69 |
return FFramePicture.PERSISTENCE_DEFINITION_NAME; |
|
70 |
} |
|
71 |
} |
tags/org.gvsig.app.document.layout2.app-2.0.43/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/tools/behavior/LayoutBehavior.java | ||
---|---|---|
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.behavior; |
|
23 |
|
|
24 |
import java.awt.Color; |
|
25 |
import java.awt.Graphics; |
|
26 |
import java.awt.Graphics2D; |
|
27 |
import java.awt.Image; |
|
28 |
import java.awt.event.MouseEvent; |
|
29 |
import java.awt.event.MouseWheelEvent; |
|
30 |
|
|
31 |
import org.gvsig.app.project.documents.layout.LayoutControl; |
|
32 |
import org.gvsig.app.project.documents.layout.tools.listener.LayoutToolListener; |
|
33 |
import org.gvsig.fmap.mapcontrol.tools.BehaviorException; |
|
34 |
|
|
35 |
/** |
|
36 |
* Ejecuta acciones respondiendo a eventos, por |
|
37 |
* delegaci?n desde el Layout. |
|
38 |
* |
|
39 |
* @author Vicente Caballero Navarro |
|
40 |
*/ |
|
41 |
public abstract class LayoutBehavior implements ILayoutBehavior { |
|
42 |
|
|
43 |
private LayoutControl layout; |
|
44 |
|
|
45 |
public abstract LayoutToolListener getListener(); |
|
46 |
|
|
47 |
public void paintComponent(Graphics g) { |
|
48 |
g.drawImage(getLayoutControl().getImage(), 0, 0, layout.getComponent()); |
|
49 |
|
|
50 |
getLayoutControl().getLayoutDraw().drawGrid((Graphics2D) g); |
|
51 |
getLayoutControl().getLayoutDraw().drawRuler((Graphics2D) g, |
|
52 |
Color.black); |
|
53 |
getLayoutControl().getGeometryAdapter().paint((Graphics2D) g, |
|
54 |
layout.getAT(), true); |
|
55 |
getLayoutControl().getLayoutDraw().drawHandlers((Graphics2D) g, |
|
56 |
Color.black); |
|
57 |
} |
|
58 |
|
|
59 |
public void setLayoutControl(LayoutControl lc) { |
|
60 |
layout = lc; |
|
61 |
} |
|
62 |
|
|
63 |
public Image getImageCursor() { |
|
64 |
return getListener().getImageCursor(); |
|
65 |
} |
|
66 |
|
|
67 |
public LayoutControl getLayoutControl() { |
|
68 |
return layout; |
|
69 |
} |
|
70 |
|
|
71 |
public void mouseClicked(MouseEvent e) throws BehaviorException { |
|
72 |
} |
|
73 |
|
|
74 |
public void mouseEntered(MouseEvent e) throws BehaviorException { |
|
75 |
} |
|
76 |
|
|
77 |
public void mouseExited(MouseEvent e) throws BehaviorException { |
|
78 |
} |
|
79 |
|
|
80 |
public void mousePressed(MouseEvent e) throws BehaviorException { |
|
81 |
if (e.getButton() == MouseEvent.BUTTON1) { |
|
82 |
layout.setPointAnt(); |
|
83 |
layout.setFirstPoint(); |
|
84 |
} |
|
85 |
} |
|
86 |
|
|
87 |
public void mouseReleased(MouseEvent e) throws BehaviorException { |
|
88 |
if (e.getButton() != MouseEvent.BUTTON3) { |
|
89 |
layout.setLastPoint(); |
|
90 |
layout.setPointAnt(); |
|
91 |
} |
|
92 |
} |
|
93 |
|
|
94 |
public void mouseDragged(MouseEvent e) throws BehaviorException { |
|
95 |
if (e.getButton() != MouseEvent.BUTTON3) { |
|
96 |
layout.setLastPoint(); |
|
97 |
} |
|
98 |
} |
|
99 |
|
|
100 |
public void mouseMoved(MouseEvent e) throws BehaviorException { |
|
101 |
} |
|
102 |
|
|
103 |
public void mouseWheelMoved(MouseWheelEvent e) throws BehaviorException { |
|
104 |
} |
|
105 |
|
|
106 |
public boolean isAdjustable() { |
|
107 |
return false; |
|
108 |
} |
|
109 |
} |
tags/org.gvsig.app.document.layout2.app-2.0.43/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/tools/behavior/LayoutSelectBehavior.java | ||
---|---|---|
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.behavior; |
|
23 |
|
|
24 |
import java.awt.Color; |
|
25 |
import java.awt.Graphics; |
|
26 |
import java.awt.Graphics2D; |
|
27 |
import java.awt.Rectangle; |
|
28 |
import java.awt.event.MouseEvent; |
|
29 |
import java.awt.geom.Rectangle2D; |
|
30 |
|
|
31 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
|
32 |
import org.gvsig.app.project.documents.layout.tools.listener.LayoutMoveListener; |
|
33 |
import org.gvsig.app.project.documents.layout.tools.listener.LayoutToolListener; |
|
34 |
import org.gvsig.fmap.mapcontrol.tools.BehaviorException; |
|
35 |
import org.gvsig.fmap.mapcontrol.tools.Events.PointEvent; |
|
36 |
|
|
37 |
/** |
|
38 |
* Behaviour que espera un listener de tipo LayoutMoveListener. |
|
39 |
* |
|
40 |
* @author Vicente Caballero Navarro |
|
41 |
*/ |
|
42 |
public class LayoutSelectBehavior extends LayoutBehavior { |
|
43 |
|
|
44 |
private LayoutMoveListener listener; |
|
45 |
private boolean dragged = false; |
|
46 |
|
|
47 |
/** |
|
48 |
* Crea un nuevo LayoutSelectBehavior. |
|
49 |
* |
|
50 |
* @param pli |
|
51 |
* listener. |
|
52 |
*/ |
|
53 |
public LayoutSelectBehavior(LayoutMoveListener lpl) { |
|
54 |
listener = lpl; |
|
55 |
} |
|
56 |
|
|
57 |
/** |
|
58 |
* @see org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior#paintComponent(java.awt.Graphics) |
|
59 |
*/ |
|
60 |
public void paintComponent(Graphics g) { |
|
61 |
getLayoutControl().getLayoutDraw().drawRectangle((Graphics2D) g); |
|
62 |
|
|
63 |
g.drawImage(getLayoutControl().getImage(), 0, 0, getLayoutControl() |
|
64 |
.getComponent()); |
|
65 |
|
|
66 |
if (getLayoutControl().isReSel()) { |
|
67 |
Rectangle reSel = getLayoutControl().getReSel(); |
|
68 |
reSel = new Rectangle(); |
|
69 |
reSel.setFrameFromDiagonal(getLayoutControl().getFirstPoint(), |
|
70 |
getLayoutControl().getLastPoint()); |
|
71 |
g.drawRect(reSel.x, reSel.y, reSel.width, reSel.height); |
|
72 |
} |
|
73 |
IFFrame[] frames = |
|
74 |
getLayoutControl().getLayoutContext().getSelectedFFrames(); |
|
75 |
for (int i = 0; i < frames.length; i++) { |
|
76 |
g.setColor(Color.black); |
|
77 |
frames[i].drawHandlers((Graphics2D) g); |
|
78 |
int difx = |
|
79 |
(getLayoutControl().getLastPoint().x - getLayoutControl() |
|
80 |
.getFirstPoint().x); |
|
81 |
int dify = |
|
82 |
(getLayoutControl().getLastPoint().y - getLayoutControl() |
|
83 |
.getFirstPoint().y); |
|
84 |
if ((Math.abs(difx) > 3) || (Math.abs(dify) > 3)) { |
|
85 |
Rectangle2D rectangle = frames[i].getMovieRect(difx, dify); |
|
86 |
if (rectangle == null) |
|
87 |
return; |
|
88 |
((Graphics2D) g).rotate( |
|
89 |
Math.toRadians(frames[i].getRotation()), rectangle.getX() |
|
90 |
+ (rectangle.getWidth() / 2), rectangle.getY() |
|
91 |
+ (rectangle.getHeight() / 2)); |
|
92 |
|
|
93 |
if (rectangle != null && dragged |
|
94 |
&& !getLayoutControl().isReSel()) { |
|
95 |
g.drawRect((int) rectangle.getMinX(), |
|
96 |
(int) rectangle.getMinY(), (int) rectangle.getWidth(), |
|
97 |
(int) rectangle.getHeight()); |
|
98 |
} |
|
99 |
|
|
100 |
((Graphics2D) g).rotate( |
|
101 |
Math.toRadians(-frames[i].getRotation()), rectangle.getX() |
|
102 |
+ (rectangle.getWidth() / 2), rectangle.getY() |
|
103 |
+ (rectangle.getHeight() / 2)); |
|
104 |
|
|
105 |
} |
|
106 |
} |
|
107 |
|
|
108 |
g.drawImage(getLayoutControl().getImgRuler(), 0, 0, getLayoutControl() |
|
109 |
.getComponent()); |
|
110 |
} |
|
111 |
|
|
112 |
/** |
|
113 |
* @throws BehaviorException |
|
114 |
* @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent) |
|
115 |
*/ |
|
116 |
public void mousePressed(MouseEvent e) throws BehaviorException { |
|
117 |
super.mousePressed(e); |
|
118 |
PointEvent event = new PointEvent(e.getPoint(), e); |
|
119 |
listener.press(event); |
|
120 |
} |
|
121 |
|
|
122 |
/** |
|
123 |
* Reimplementaci?n del m?todo mouseReleased de Behavior. |
|
124 |
* |
|
125 |
* @param e |
|
126 |
* MouseEvent |
|
127 |
* |
|
128 |
* @throws BehaviorException |
|
129 |
* Excepci?n lanzada cuando el Behavior. |
|
130 |
*/ |
|
131 |
public void mouseReleased(MouseEvent e) throws BehaviorException { |
|
132 |
super.mouseReleased(e); |
|
133 |
PointEvent event = new PointEvent(e.getPoint(), e); |
|
134 |
listener.release(event); |
|
135 |
dragged = false; |
|
136 |
|
|
137 |
} |
|
138 |
|
|
139 |
/** |
|
140 |
* Reimplementaci?n del m?todo mouseDragged de Behavior. |
|
141 |
* |
|
142 |
* @param e |
|
143 |
* MouseEvent |
|
144 |
* @throws BehaviorException |
|
145 |
*/ |
|
146 |
public void mouseDragged(MouseEvent e) throws BehaviorException { |
|
147 |
super.mouseDragged(e); |
|
148 |
PointEvent event = new PointEvent(e.getPoint(), e); |
|
149 |
listener.drag(event); |
|
150 |
dragged = true; |
|
151 |
} |
|
152 |
|
|
153 |
/** |
|
154 |
* @see org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior#setListener(com.iver.cit.gvsig.fmap.tools.ToolListener) |
|
155 |
*/ |
|
156 |
public void setListener(LayoutToolListener listener) { |
|
157 |
this.listener = (LayoutMoveListener) listener; |
|
158 |
} |
|
159 |
|
|
160 |
/** |
|
161 |
* @see org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior#getListener() |
|
162 |
*/ |
|
163 |
public LayoutToolListener getListener() { |
|
164 |
return listener; |
|
165 |
} |
|
166 |
|
|
167 |
public void mouseClicked(MouseEvent e) throws BehaviorException { |
|
168 |
super.mouseClicked(e); |
|
169 |
PointEvent event = new PointEvent(e.getPoint(), e); |
|
170 |
listener.click(event); |
|
171 |
} |
|
172 |
|
|
173 |
public void mouseMoved(MouseEvent e) throws BehaviorException { |
|
174 |
super.mouseMoved(e); |
|
175 |
PointEvent event = new PointEvent(e.getPoint(), e); |
|
176 |
listener.move(event); |
|
177 |
} |
|
178 |
} |
tags/org.gvsig.app.document.layout2.app-2.0.43/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/tools/behavior/LayoutViewZoomBehavior.java | ||
---|---|---|
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.behavior; |
|
23 |
|
|
24 |
import java.awt.Color; |
|
25 |
import java.awt.Graphics; |
|
26 |
import java.awt.Graphics2D; |
|
27 |
import java.awt.Rectangle; |
|
28 |
import java.awt.event.MouseEvent; |
|
29 |
import java.awt.image.BufferedImage; |
|
30 |
|
|
31 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
|
32 |
import org.gvsig.app.project.documents.layout.tools.listener.LayoutMoveListener; |
|
33 |
import org.gvsig.app.project.documents.layout.tools.listener.LayoutToolListener; |
|
34 |
import org.gvsig.fmap.mapcontrol.tools.BehaviorException; |
|
35 |
import org.gvsig.fmap.mapcontrol.tools.Events.PointEvent; |
|
36 |
|
|
37 |
/** |
|
38 |
* Behaviour que espera un listener de tipo MoveListener. |
|
39 |
* |
|
40 |
* @author Vicente Caballero Navarro |
|
41 |
*/ |
|
42 |
public class LayoutViewZoomBehavior extends LayoutBehavior { |
|
43 |
|
|
44 |
private LayoutMoveListener listener; |
|
45 |
private boolean dragged = false; |
|
46 |
|
|
47 |
/** |
|
48 |
* Crea un nuevo MoveBehavior. |
|
49 |
* |
|
50 |
* @param pli |
|
51 |
* listener. |
|
52 |
*/ |
|
53 |
public LayoutViewZoomBehavior(LayoutMoveListener lpl) { |
|
54 |
listener = lpl; |
|
55 |
} |
|
56 |
|
|
57 |
/** |
|
58 |
* @see org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior#paintComponent(java.awt.Graphics) |
|
59 |
*/ |
|
60 |
public void paintComponent(Graphics g) { |
|
61 |
BufferedImage img = getLayoutControl().getImage(); |
|
62 |
BufferedImage imgRuler = getLayoutControl().getImgRuler(); |
|
63 |
g.drawImage(img, 0, 0, getLayoutControl().getComponent()); |
|
64 |
g.drawImage(imgRuler, 0, 0, getLayoutControl().getComponent()); |
|
65 |
g.setColor(Color.black); |
|
66 |
g.setXORMode(Color.white); |
|
67 |
|
|
68 |
// Borramos el anterior |
|
69 |
Rectangle r = new Rectangle(); |
|
70 |
|
|
71 |
// Dibujamos el actual |
|
72 |
if (dragged && (getLayoutControl().getFirstPoint() != null) |
|
73 |
&& (getLayoutControl().getLastPoint() != null)) { |
|
74 |
r.setFrameFromDiagonal(getLayoutControl().getFirstPoint(), |
|
75 |
getLayoutControl().getLastPoint()); |
|
76 |
g.drawRect(r.x, r.y, r.width, r.height); |
|
77 |
} |
|
78 |
IFFrame[] frames = |
|
79 |
getLayoutControl().getLayoutContext().getSelectedFFrames(); |
|
80 |
for (int i = 0; i < frames.length; i++) { |
|
81 |
g.setColor(Color.black); |
|
82 |
frames[i].drawHandlers((Graphics2D) g); |
|
83 |
} |
|
84 |
g.setPaintMode(); |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* @throws BehaviorException |
|
89 |
* @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent) |
|
90 |
*/ |
|
91 |
public void mousePressed(MouseEvent e) throws BehaviorException { |
|
92 |
super.mousePressed(e); |
|
93 |
PointEvent event = new PointEvent(e.getPoint(), e); |
|
94 |
listener.press(event); |
|
95 |
} |
|
96 |
|
|
97 |
/** |
|
98 |
* Reimplementaci?n del m?todo mouseReleased de Behavior. |
|
99 |
* |
|
100 |
* @param e |
|
101 |
* MouseEvent |
|
102 |
* |
|
103 |
* @throws BehaviorException |
|
104 |
* Excepci?n lanzada cuando el Behavior. |
|
105 |
*/ |
|
106 |
public void mouseReleased(MouseEvent e) throws BehaviorException { |
|
107 |
super.mouseReleased(e); |
|
108 |
PointEvent event = new PointEvent(e.getPoint(), e); |
|
109 |
listener.release(event); |
|
110 |
dragged = false; |
|
111 |
} |
|
112 |
|
|
113 |
/** |
|
114 |
* Reimplementaci?n del m?todo mouseDragged de Behavior. |
|
115 |
* |
|
116 |
* @param e |
|
117 |
* MouseEvent |
|
118 |
* @throws BehaviorException |
|
119 |
*/ |
|
120 |
public void mouseDragged(MouseEvent e) throws BehaviorException { |
|
121 |
super.mouseDragged(e); |
|
122 |
PointEvent event = new PointEvent(e.getPoint(), e); |
|
123 |
listener.drag(event); |
|
124 |
dragged = true; |
|
125 |
} |
|
126 |
|
|
127 |
/** |
|
128 |
* @see org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior#setListener(com.iver.cit.gvsig.fmap.tools.ToolListener) |
|
129 |
*/ |
|
130 |
public void setListener(LayoutToolListener listener) { |
|
131 |
this.listener = (LayoutMoveListener) listener; |
|
132 |
} |
|
133 |
|
|
134 |
/** |
|
135 |
* @see org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior#getListener() |
|
136 |
*/ |
|
137 |
public LayoutToolListener getListener() { |
|
138 |
return listener; |
|
139 |
} |
|
140 |
} |
tags/org.gvsig.app.document.layout2.app-2.0.43/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/tools/behavior/LayoutViewMoveBehavior.java | ||
---|---|---|
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.behavior; |
|
23 |
|
|
24 |
import java.awt.Color; |
|
25 |
import java.awt.Graphics; |
|
26 |
import java.awt.Graphics2D; |
|
27 |
import java.awt.event.MouseEvent; |
|
28 |
import java.awt.geom.Rectangle2D; |
|
29 |
|
|
30 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
|
31 |
import org.gvsig.app.project.documents.layout.fframes.IFFrameUseFMap; |
Also available in: Unified diff