Revision 28801
tags/tmp_build/extensions/extGridViewLayout/src/com/iver/cit/gvsig/FFrameGridExtension.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package com.iver.cit.gvsig; |
|
42 |
|
|
43 |
import com.iver.andami.PluginServices; |
|
44 |
import com.iver.andami.plugins.Extension; |
|
45 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
46 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameGrid; |
|
47 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameGridFactory; |
|
48 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameView; |
|
49 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FrameFactory; |
|
50 |
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame; |
|
51 |
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.FFrameGridDialog; |
|
52 |
import com.iver.cit.gvsig.project.documents.layout.gui.Layout; |
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
/** |
|
57 |
* Extensi?n preparada para controlar las opciones que se pueden realizar sobre |
|
58 |
* una vista a?adida en el Layout. |
|
59 |
* |
|
60 |
* @author Vicente Caballero Navarro |
|
61 |
*/ |
|
62 |
public class FFrameGridExtension extends Extension { |
|
63 |
private Layout layout = null; |
|
64 |
/** |
|
65 |
* @see com.iver.andami.plugins.IExtension#initialize() |
|
66 |
*/ |
|
67 |
public void initialize() { |
|
68 |
FFrameGridFactory.register(); |
|
69 |
} |
|
70 |
|
|
71 |
/** |
|
72 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String) |
|
73 |
*/ |
|
74 |
public void execute(String s) { |
|
75 |
layout = (Layout) PluginServices.getMDIManager().getActiveWindow(); |
|
76 |
if (s.equals("CUADRICULA")) { |
|
77 |
FFrameGrid fframe =(FFrameGrid)FrameFactory.createFrameFromName(FFrameGridFactory.registerName); |
|
78 |
fframe.setLayout(layout); |
|
79 |
FFrameGridDialog fframedialog = new FFrameGridDialog(layout, fframe); |
|
80 |
if (fframedialog != null) { |
|
81 |
PluginServices.getMDIManager().addWindow(fframedialog); |
|
82 |
} |
|
83 |
IFFrame newFrame= fframedialog.getFFrame(); |
|
84 |
if (newFrame!=null) { |
|
85 |
layout.getLayoutContext().addFFrame(newFrame, true,true); |
|
86 |
} |
|
87 |
PluginServices.getMainFrame().enableControls(); |
|
88 |
layout.getLayoutControl().refresh(); |
|
89 |
layout.getModel().setModified(true); |
|
90 |
} |
|
91 |
} |
|
92 |
|
|
93 |
/** |
|
94 |
* @see com.iver.andami.plugins.IExtension#isEnabled() |
|
95 |
*/ |
|
96 |
public boolean isEnabled() { |
|
97 |
Layout l = (Layout)PluginServices.getMDIManager().getActiveWindow(); |
|
98 |
IFFrame[] fframes = l.getLayoutContext().getFFrameSelected(); |
|
99 |
if (!l.getLayoutContext().isEditable()) |
|
100 |
return false; |
|
101 |
for (int i = 0; i < fframes.length; i++) { |
|
102 |
if (fframes[i] instanceof FFrameView) { |
|
103 |
return true; |
|
104 |
} |
|
105 |
} |
|
106 |
|
|
107 |
return false; |
|
108 |
} |
|
109 |
|
|
110 |
/** |
|
111 |
* @see com.iver.andami.plugins.IExtension#isVisible() |
|
112 |
*/ |
|
113 |
public boolean isVisible() { |
|
114 |
IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
|
115 |
|
|
116 |
if (f == null) { |
|
117 |
return false; |
|
118 |
} |
|
119 |
|
|
120 |
if (f instanceof Layout) { |
|
121 |
return true; //layout.m_Display.getMapControl().getMapContext().getLayers().layerCount() > 0; |
|
122 |
} |
|
123 |
return false; |
|
124 |
} |
|
125 |
} |
|
0 | 126 |
tags/tmp_build/extensions/extGridViewLayout/src/com/iver/cit/gvsig/project/documents/layout/tools/LayoutAddGridListenerImpl.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package com.iver.cit.gvsig.project.documents.layout.tools; |
|
42 |
|
|
43 |
import java.awt.Image; |
|
44 |
import java.awt.geom.Rectangle2D; |
|
45 |
|
|
46 |
import javax.swing.ImageIcon; |
|
47 |
|
|
48 |
import com.iver.andami.PluginServices; |
|
49 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
50 |
import com.iver.cit.gvsig.fmap.tools.BehaviorException; |
|
51 |
import com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent; |
|
52 |
import com.iver.cit.gvsig.project.documents.layout.FLayoutUtilities; |
|
53 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameGrid; |
|
54 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameGridFactory; |
|
55 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FrameFactory; |
|
56 |
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame; |
|
57 |
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.FFrameGridDialog; |
|
58 |
import com.iver.cit.gvsig.project.documents.layout.gui.Layout; |
|
59 |
import com.iver.cit.gvsig.project.documents.layout.tools.listener.LayoutAddRectangleListener; |
|
60 |
|
|
61 |
|
|
62 |
/** |
|
63 |
* Implementaci?n de la interfaz LayoutRectangleListener como herramienta para |
|
64 |
* realizar una inserci?n por rect?ngulo. |
|
65 |
* |
|
66 |
* @author Vicente Caballero Navarro |
|
67 |
*/ |
|
68 |
public class LayoutAddGridListenerImpl extends LayoutAddRectangleListener { |
|
69 |
private final Image img = new ImageIcon(MapControl.class.getResource( |
|
70 |
"images/RectSelectCursor.gif")).getImage(); |
|
71 |
|
|
72 |
/** |
|
73 |
* Crea un nuevo LayoutAddRectangleListener. |
|
74 |
* |
|
75 |
* @param l Layout. |
|
76 |
*/ |
|
77 |
public LayoutAddGridListenerImpl(Layout l) { |
|
78 |
super(l); |
|
79 |
} |
|
80 |
|
|
81 |
/** |
|
82 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.RectangleListener#rectangle(com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent) |
|
83 |
*/ |
|
84 |
public void rectangle(RectangleEvent event) throws BehaviorException { |
|
85 |
FFrameGrid fframe =(FFrameGrid)FrameFactory.createFrameFromName(FFrameGridFactory.registerName); |
|
86 |
|
|
87 |
fframe.setLayout(layout); |
|
88 |
Rectangle2D r = new Rectangle2D.Double(); //rectOrigin.x+m_PointAnt.x,rectOrigin.y+m_PointAnt.y,m_LastPoint.x-m_PointAnt.x,m_LastPoint.y-m_PointAnt.y); |
|
89 |
|
|
90 |
r=getRectangle(TOLERANCE); |
|
91 |
fframe.setBoundBox(FLayoutUtilities.toSheetRect(r, layout.getLayoutControl().getAT())); |
|
92 |
FFrameGridDialog fframedialog = new FFrameGridDialog(layout, fframe); |
|
93 |
if (fframedialog != null) { |
|
94 |
fframedialog.setRectangle(fframe.getBoundingBox(layout.getLayoutControl().getAT())); |
|
95 |
PluginServices.getMDIManager().addWindow(fframedialog); |
|
96 |
} |
|
97 |
|
|
98 |
IFFrame newFrame= fframedialog.getFFrame(); |
|
99 |
if (newFrame!=null) { |
|
100 |
layout.getLayoutContext().addFFrame(newFrame, true,true); |
|
101 |
} |
|
102 |
PluginServices.getMainFrame().enableControls(); |
|
103 |
layout.getLayoutControl().refresh(); |
|
104 |
} |
|
105 |
|
|
106 |
/** |
|
107 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#getCursor() |
|
108 |
*/ |
|
109 |
public Image getImageCursor() { |
|
110 |
return img; |
|
111 |
} |
|
112 |
|
|
113 |
/** |
|
114 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#cancelDrawing() |
|
115 |
*/ |
|
116 |
public boolean cancelDrawing() { |
|
117 |
return false; |
|
118 |
} |
|
119 |
} |
|
0 | 120 |
tags/tmp_build/extensions/extGridViewLayout/src/com/iver/cit/gvsig/project/documents/layout/fframes/gui/dialogs/FFrameGridDialog.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
import java.awt.event.ActionEvent; |
|
5 |
import java.awt.event.ActionListener; |
|
6 |
import java.awt.geom.Rectangle2D; |
|
7 |
|
|
8 |
import javax.swing.ButtonGroup; |
|
9 |
import javax.swing.JLabel; |
|
10 |
import javax.swing.JList; |
|
11 |
import javax.swing.JPanel; |
|
12 |
import javax.swing.JRadioButton; |
|
13 |
import javax.swing.JScrollPane; |
|
14 |
import javax.swing.JTextField; |
|
15 |
|
|
16 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
|
17 |
|
|
18 |
import com.iver.andami.PluginServices; |
|
19 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
|
20 |
import com.iver.cit.gvsig.gui.panels.ColorChooserPanel; |
|
21 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameGrid; |
|
22 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameView; |
|
23 |
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame; |
|
24 |
import com.iver.cit.gvsig.project.documents.layout.fframes.ListViewModel; |
|
25 |
import com.iver.cit.gvsig.project.documents.layout.gui.Layout; |
|
26 |
|
|
27 |
public class FFrameGridDialog extends JPanel implements IFFrameDialog{ |
|
28 |
|
|
29 |
private JPanel pMarcoVista=null; |
|
30 |
private JScrollPane jScrollPane; |
|
31 |
private JList liVistas; |
|
32 |
private Layout layout; |
|
33 |
private FFrameGrid fframegrid; |
|
34 |
private FFrameView fframeview; |
|
35 |
private JLabel lblInterval = null; |
|
36 |
private JTextField txtInterval = null; |
|
37 |
private JRadioButton rbPoints = null; |
|
38 |
private JRadioButton rbLines = null; |
|
39 |
private JLabel lblWight = null; |
|
40 |
private JTextField txtWidth = null; |
|
41 |
private JLabel lblColor = null; |
|
42 |
private ColorChooserPanel m_colorFont=null; |
|
43 |
private JLabel lblColorLine = null; |
|
44 |
private ColorChooserPanel m_colorLine=null; // @jve:decl-index=0:visual-constraint="441,177" |
|
45 |
private AcceptCancelPanel accept; |
|
46 |
private FFrameGrid newFFrameGrid; |
|
47 |
private Rectangle2D rect; |
|
48 |
private Color textcolor; |
|
49 |
private Color linecolor; |
|
50 |
private boolean isAcepted; |
|
51 |
private JLabel lblFontSize = null; |
|
52 |
private JTextField txtFontSize = null; |
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
/** |
|
59 |
* This is the default constructor |
|
60 |
*/ |
|
61 |
public FFrameGridDialog(Layout layout, FFrameGrid fframe) { |
|
62 |
super(); |
|
63 |
this.layout=layout; |
|
64 |
this.fframegrid=fframe; |
|
65 |
linecolor=fframegrid.getLineColor(); |
|
66 |
textcolor=fframegrid.getFontColor(); |
|
67 |
initialize(); |
|
68 |
} |
|
69 |
/** |
|
70 |
* This method initializes pMarcoVista |
|
71 |
* |
|
72 |
* @return javax.swing.JPanel |
|
73 |
*/ |
|
74 |
private JPanel getPMarcoVista() { |
|
75 |
if (pMarcoVista == null) { |
|
76 |
pMarcoVista = new JPanel(); |
|
77 |
pMarcoVista.setBorder(javax.swing.BorderFactory.createTitledBorder( |
|
78 |
null, PluginServices.getText(this,PluginServices.getText(this,"marco_vista")),javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.black)); |
|
79 |
pMarcoVista.setBounds(new java.awt.Rectangle(12,12,270,91)); |
|
80 |
pMarcoVista.add(getJScrollPane(), null); |
|
81 |
} |
|
82 |
|
|
83 |
return pMarcoVista; |
|
84 |
} |
|
85 |
private javax.swing.JScrollPane getJScrollPane() { |
|
86 |
if (jScrollPane == null) { |
|
87 |
jScrollPane = new javax.swing.JScrollPane(); |
|
88 |
jScrollPane.setPreferredSize(new java.awt.Dimension(250,55)); |
|
89 |
jScrollPane.setViewportView(getLiVistas()); |
|
90 |
} |
|
91 |
return jScrollPane; |
|
92 |
} |
|
93 |
private javax.swing.JList getLiVistas() { |
|
94 |
if (liVistas == null) { |
|
95 |
ListViewModel listmodel = new ListViewModel(); |
|
96 |
listmodel.addViews(layout); |
|
97 |
|
|
98 |
///ArrayList list = listmodel.getViews(); |
|
99 |
|
|
100 |
liVistas = new javax.swing.JList(); |
|
101 |
|
|
102 |
liVistas.setSize(new java.awt.Dimension(250,52)); |
|
103 |
liVistas.setModel(listmodel); |
|
104 |
|
|
105 |
for (int i = 0; i < liVistas.getModel().getSize(); i++) { |
|
106 |
if (fframegrid.getFFrameDependence() != null) { |
|
107 |
fframeview = (FFrameView) liVistas.getModel().getElementAt(i); |
|
108 |
|
|
109 |
if (fframeview == fframegrid.getFFrameDependence()[0]) { |
|
110 |
liVistas.setSelectedIndex(i); |
|
111 |
} |
|
112 |
} |
|
113 |
} |
|
114 |
|
|
115 |
liVistas.addListSelectionListener(new javax.swing.event.ListSelectionListener() { |
|
116 |
private int selectIndex=-1; |
|
117 |
public void valueChanged( |
|
118 |
javax.swing.event.ListSelectionEvent e) { |
|
119 |
IFFrame[] fframes=layout.getLayoutContext().getFFrames(); |
|
120 |
int selectInt = ((JList) e.getSource()) |
|
121 |
.getSelectedIndex(); |
|
122 |
if (selectInt != selectIndex) { |
|
123 |
selectIndex = selectInt; |
|
124 |
if (selectIndex == -1) |
|
125 |
return; |
|
126 |
fframeview = (FFrameView) liVistas.getModel() |
|
127 |
.getElementAt(selectInt); |
|
128 |
|
|
129 |
for (int i = 0; i < fframes.length; i++) { |
|
130 |
IFFrame f = fframes[i]; |
|
131 |
|
|
132 |
if (f instanceof FFrameView) { |
|
133 |
if (((FFrameView) f).getView() == fframeview |
|
134 |
.getView()) { |
|
135 |
fframegrid |
|
136 |
.setFFrameDependence(fframeview); |
|
137 |
} |
|
138 |
} |
|
139 |
} |
|
140 |
|
|
141 |
// getTNumIntervalos().setText( |
|
142 |
// String.valueOf(fframescalebar |
|
143 |
// .getNumInterval())); |
|
144 |
// getTDivIzquierda().setText( |
|
145 |
// String.valueOf(fframescalebar |
|
146 |
// .getNumLeft())); |
|
147 |
// getTIntervalo().setText( |
|
148 |
// fframescalebar.obtainInterval()); |
|
149 |
// getTfNumberScale().setText( |
|
150 |
// fframescalebar.getDescription()); |
|
151 |
} |
|
152 |
} |
|
153 |
}); |
|
154 |
} |
|
155 |
|
|
156 |
return liVistas; |
|
157 |
} |
|
158 |
|
|
159 |
/** |
|
160 |
* This method initializes this |
|
161 |
* |
|
162 |
* @return void |
|
163 |
*/ |
|
164 |
private void initialize() { |
|
165 |
lblFontSize = new JLabel(); |
|
166 |
lblFontSize.setBounds(new java.awt.Rectangle(13,177,98,24)); |
|
167 |
lblFontSize.setText("font_size"); |
|
168 |
lblColorLine = new JLabel(); |
|
169 |
lblColorLine.setBounds(new java.awt.Rectangle(204,207,87,27)); |
|
170 |
lblColorLine.setText("color_linea"); |
|
171 |
lblColor = new JLabel(); |
|
172 |
lblColor.setBounds(new java.awt.Rectangle(15,210,96,21)); |
|
173 |
lblColor.setText("color_fuente"); |
|
174 |
lblWight = new JLabel(); |
|
175 |
lblWight.setBounds(new java.awt.Rectangle(205,111,88,24)); |
|
176 |
lblWight.setText("grosor_linea"); |
|
177 |
lblInterval = new JLabel(); |
|
178 |
lblInterval.setBounds(new java.awt.Rectangle(13,111,89,23)); |
|
179 |
lblInterval.setText("intervalo"); |
|
180 |
this.setLayout(null); |
|
181 |
this.setSize(426, 295); |
|
182 |
this.add(getPMarcoVista(), null); |
|
183 |
this.add(lblInterval, null); |
|
184 |
this.add(getTxtInterval(), null); |
|
185 |
|
|
186 |
this.add(getRbPoints(), null); |
|
187 |
this.add(getRbLines(), null); |
|
188 |
this.add(lblWight, null); |
|
189 |
this.add(getTxtWidth(), null); |
|
190 |
this.add(lblColor, null); |
|
191 |
this.add(getColorFont(), null); |
|
192 |
this.add(lblColorLine, null); |
|
193 |
this.add(getColorLine(), null); |
|
194 |
this.add(getAcceptCancelPanel(), null); |
|
195 |
this.add(lblFontSize, null); |
|
196 |
this.add(getTxtFontSize(), null); |
|
197 |
ButtonGroup group = new ButtonGroup(); |
|
198 |
group.add(getRbPoints()); |
|
199 |
group.add(getRbLines()); |
|
200 |
} |
|
201 |
|
|
202 |
public void setRectangle(Rectangle2D r) { |
|
203 |
rect=r; |
|
204 |
} |
|
205 |
private ColorChooserPanel getColorFont() { |
|
206 |
if (m_colorFont == null) { |
|
207 |
m_colorFont = new ColorChooserPanel(); |
|
208 |
m_colorFont.setAlpha(255); |
|
209 |
m_colorFont.setBounds(new java.awt.Rectangle(126,208,63,25)); |
|
210 |
m_colorFont.setColor(fframegrid.getFontColor()); |
|
211 |
m_colorFont.addActionListener(new java.awt.event.ActionListener() { |
|
212 |
public void actionPerformed(ActionEvent e) { |
|
213 |
textcolor=m_colorFont.getColor(); |
|
214 |
} |
|
215 |
}); |
|
216 |
} |
|
217 |
return m_colorFont; |
|
218 |
} |
|
219 |
private ColorChooserPanel getColorLine() { |
|
220 |
if (m_colorLine == null) { |
|
221 |
m_colorLine = new ColorChooserPanel(); |
|
222 |
m_colorLine.setAlpha(255); |
|
223 |
m_colorLine.setBounds(new java.awt.Rectangle(304,208,61,25)); |
|
224 |
m_colorLine.setSize(new java.awt.Dimension(80,25)); |
|
225 |
m_colorLine.setColor(fframegrid.getLineColor()); |
|
226 |
m_colorLine.addActionListener(new java.awt.event.ActionListener() { |
|
227 |
public void actionPerformed(ActionEvent e) { |
|
228 |
linecolor=m_colorLine.getColor(); |
|
229 |
} |
|
230 |
}); |
|
231 |
} |
|
232 |
return m_colorLine; |
|
233 |
} |
|
234 |
public WindowInfo getWindowInfo() { |
|
235 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG|WindowInfo.RESIZABLE); |
|
236 |
m_viewinfo.setTitle(PluginServices.getText(this, |
|
237 |
"cuadricula")); |
|
238 |
|
|
239 |
return m_viewinfo; |
|
240 |
} |
|
241 |
public Object getWindowProfile() { |
|
242 |
return WindowInfo.DIALOG_PROFILE; |
|
243 |
} |
|
244 |
|
|
245 |
public boolean getIsAcepted() { |
|
246 |
// TODO Auto-generated method stub |
|
247 |
return false; |
|
248 |
} |
|
249 |
|
|
250 |
public IFFrame getFFrame() { |
|
251 |
return newFFrameGrid; |
|
252 |
} |
|
253 |
/** |
|
254 |
* This method initializes txtInterval |
|
255 |
* |
|
256 |
* @return javax.swing.JTextField |
|
257 |
*/ |
|
258 |
private JTextField getTxtInterval() { |
|
259 |
if (txtInterval == null) { |
|
260 |
txtInterval = new JTextField(); |
|
261 |
txtInterval.setBounds(new java.awt.Rectangle(115,111,85,23)); |
|
262 |
txtInterval.setText(String.valueOf(fframegrid.getInterval())); |
|
263 |
} |
|
264 |
return txtInterval; |
|
265 |
} |
|
266 |
/** |
|
267 |
* This method initializes rbPoints |
|
268 |
* |
|
269 |
* @return javax.swing.JRadioButton |
|
270 |
*/ |
|
271 |
private JRadioButton getRbPoints() { |
|
272 |
if (rbPoints == null) { |
|
273 |
rbPoints = new JRadioButton(); |
|
274 |
rbPoints.setBounds(new java.awt.Rectangle(17,148,120,21)); |
|
275 |
rbPoints.setText("puntos"); |
|
276 |
rbPoints.setSelected(!fframegrid.isLine()); |
|
277 |
} |
|
278 |
return rbPoints; |
|
279 |
} |
|
280 |
/** |
|
281 |
* This method initializes rbLines |
|
282 |
* |
|
283 |
* @return javax.swing.JRadioButton |
|
284 |
*/ |
|
285 |
private JRadioButton getRbLines() { |
|
286 |
if (rbLines == null) { |
|
287 |
rbLines = new JRadioButton(); |
|
288 |
rbLines.setBounds(new java.awt.Rectangle(149,146,154,25)); |
|
289 |
rbLines.setText("lineas"); |
|
290 |
rbLines.setSelected(fframegrid.isLine()); |
|
291 |
} |
|
292 |
return rbLines; |
|
293 |
} |
|
294 |
/** |
|
295 |
* This method initializes txtWidth |
|
296 |
* |
|
297 |
* @return javax.swing.JTextField |
|
298 |
*/ |
|
299 |
private JTextField getTxtWidth() { |
|
300 |
if (txtWidth == null) { |
|
301 |
txtWidth = new JTextField(); |
|
302 |
txtWidth.setBounds(new java.awt.Rectangle(298,112,47,23)); |
|
303 |
txtWidth.setText(String.valueOf(fframegrid.getLineWidth())); |
|
304 |
} |
|
305 |
return txtWidth; |
|
306 |
} |
|
307 |
private AcceptCancelPanel getAcceptCancelPanel() { |
|
308 |
if (accept == null) { |
|
309 |
ActionListener okAction, cancelAction; |
|
310 |
okAction = new java.awt.event.ActionListener() { |
|
311 |
|
|
312 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
313 |
newFFrameGrid = (FFrameGrid) fframegrid |
|
314 |
.cloneFFrame(layout); |
|
315 |
newFFrameGrid.setFFrameDependence(fframeview); |
|
316 |
newFFrameGrid.setBoundBox(); |
|
317 |
newFFrameGrid.setInterval(Double.parseDouble(getTxtInterval().getText().toString())); |
|
318 |
newFFrameGrid.setLineWidth((Double.parseDouble(getTxtWidth().getText().toString()))); |
|
319 |
|
|
320 |
newFFrameGrid.setTextColor(textcolor); |
|
321 |
newFFrameGrid.setLineColor(linecolor); |
|
322 |
|
|
323 |
newFFrameGrid.setIsLine(getRbLines().isSelected()); |
|
324 |
newFFrameGrid.setSizeFont(Integer.parseInt(getTxtFontSize().getText())); |
|
325 |
|
|
326 |
newFFrameGrid.setRotation(fframeview.getRotation()); |
|
327 |
PluginServices.getMDIManager().closeWindow( |
|
328 |
FFrameGridDialog.this); |
|
329 |
// m_layout.refresh(); |
|
330 |
isAcepted = true; |
|
331 |
} |
|
332 |
}; |
|
333 |
cancelAction = new java.awt.event.ActionListener() { |
|
334 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
335 |
newFFrameGrid=null; |
|
336 |
PluginServices.getMDIManager().closeWindow( |
|
337 |
FFrameGridDialog.this); |
|
338 |
} |
|
339 |
}; |
|
340 |
accept = new AcceptCancelPanel(okAction, cancelAction); |
|
341 |
accept.setPreferredSize(new java.awt.Dimension(300, 300)); |
|
342 |
// accept.setBounds(new java.awt.Rectangle(243,387,160,28)); |
|
343 |
accept.setEnabled(true); |
|
344 |
accept.setBounds(new java.awt.Rectangle(45, 250, 300, 32)); |
|
345 |
accept.setVisible(true); |
|
346 |
} |
|
347 |
return accept; |
|
348 |
} |
|
349 |
/** |
|
350 |
* This method initializes txtFontSize |
|
351 |
* |
|
352 |
* @return javax.swing.JTextField |
|
353 |
*/ |
|
354 |
private JTextField getTxtFontSize() { |
|
355 |
if (txtFontSize == null) { |
|
356 |
txtFontSize = new JTextField(); |
|
357 |
txtFontSize.setBounds(new java.awt.Rectangle(127,176,52,26)); |
|
358 |
txtFontSize.setText(String.valueOf(fframegrid.getSizeFont())); |
|
359 |
} |
|
360 |
return txtFontSize; |
|
361 |
} |
|
362 |
|
|
363 |
} // @jve:decl-index=0:visual-constraint="10,10" |
|
0 | 364 |
tags/tmp_build/extensions/extGridViewLayout/src/com/iver/cit/gvsig/project/documents/layout/fframes/FFrameGrid.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.project.documents.layout.fframes; |
|
2 |
|
|
3 |
import java.awt.BasicStroke; |
|
4 |
import java.awt.Color; |
|
5 |
import java.awt.Font; |
|
6 |
import java.awt.Graphics2D; |
|
7 |
import java.awt.font.FontRenderContext; |
|
8 |
import java.awt.font.TextLayout; |
|
9 |
import java.awt.geom.AffineTransform; |
|
10 |
import java.awt.geom.Point2D; |
|
11 |
import java.awt.geom.Rectangle2D; |
|
12 |
import java.awt.image.BufferedImage; |
|
13 |
|
|
14 |
import javax.print.attribute.PrintRequestAttributeSet; |
|
15 |
|
|
16 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
17 |
import com.iver.andami.PluginServices; |
|
18 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
19 |
import com.iver.cit.gvsig.project.documents.exceptions.SaveException; |
|
20 |
import com.iver.cit.gvsig.project.documents.layout.FLayoutUtilities; |
|
21 |
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.FFrameGridDialog; |
|
22 |
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.IFFrameDialog; |
|
23 |
import com.iver.cit.gvsig.project.documents.layout.gui.Layout; |
|
24 |
import com.iver.utiles.StringUtilities; |
|
25 |
import com.iver.utiles.XMLEntity; |
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
/** |
|
30 |
* FFrame para introducir una cuadr?cula sobre una vista en el Layout. |
|
31 |
* |
|
32 |
* @author Vicente Caballero Navarro |
|
33 |
*/ |
|
34 |
public class FFrameGrid extends FFrame implements IFFrameViewDependence{ |
|
35 |
|
|
36 |
private FFrameView fframeview; |
|
37 |
private double interval; |
|
38 |
private double lineWidth; |
|
39 |
private Color textColor=Color.black; |
|
40 |
private Color lineColor=Color.black; |
|
41 |
private boolean isLine; |
|
42 |
private int sizeFont=8; |
|
43 |
private int dependenceIndex; |
|
44 |
|
|
45 |
public void draw(Graphics2D g, AffineTransform at, Rectangle2D rv, BufferedImage imgBase) throws ReadDriverException { |
|
46 |
FontRenderContext frc = g.getFontRenderContext(); |
|
47 |
double myScale = at.getScaleX() * 0.0234; //FLayoutUtilities.fromSheetDistance(folio.getAncho(),at)/rv.getWidth(); |
|
48 |
int scaledFontSize = (int) (myScale * sizeFont); |
|
49 |
Font font=new Font(g.getFont().getFamily(),g.getFont().getStyle(),scaledFontSize); |
|
50 |
Rectangle2D.Double r = getBoundingBox(at); |
|
51 |
Rectangle2D rView=fframeview.getBoundingBox(at); |
|
52 |
g.rotate(Math.toRadians(getRotation()), r.x + (r.width / 2), |
|
53 |
r.y + (r.height / 2)); |
|
54 |
AffineTransform atView=fframeview.getATMap(); |
|
55 |
|
|
56 |
|
|
57 |
Rectangle2D extent=fframeview.getMapContext().getViewPort().getAdjustedExtent(); |
|
58 |
double extentX=extent.getMinX(); |
|
59 |
double extentY=extent.getMinY(); |
|
60 |
|
|
61 |
double restX=(extentX/interval) % 1; |
|
62 |
double distX=restX*interval; |
|
63 |
//double distPixelsX=FLayoutUtilities.fromSheetDistance(distX,atView); |
|
64 |
double restY=(extentY/interval) % 1; |
|
65 |
double distY=restY*interval; |
|
66 |
//double distPixelsY=FLayoutUtilities.fromSheetDistance(distY,atView); |
|
67 |
|
|
68 |
double x=extentX-distX; |
|
69 |
//double pixelsX = rView.getMinX()-distPixelsX; |
|
70 |
double y=extentY-distY; |
|
71 |
//double pixelsY = rView.getMinY()-distPixelsY; |
|
72 |
|
|
73 |
//fframeview.getMapContext().getViewPort().fromMapPoint(extentX,extentY); |
|
74 |
//double pixelsInterval=FLayoutUtilities.fromSheetDistance(interval,atView); |
|
75 |
g.setStroke(new BasicStroke((int)lineWidth)); |
|
76 |
g.setColor(Color.black); |
|
77 |
|
|
78 |
|
|
79 |
// Dibuja los m?rgenes |
|
80 |
double valueIntervalX=((extentX/interval)-restX) * interval-interval; |
|
81 |
while(x<extent.getMaxX()){ |
|
82 |
if (x>extentX) { |
|
83 |
Point2D p2=fframeview.getMapContext().getViewPort().fromMapPoint(x,extentY); |
|
84 |
Point2D p1=fframeview.getMapContext().getViewPort().fromMapPoint(x,extent.getMaxY()); |
|
85 |
g.setColor(lineColor); |
|
86 |
g.drawLine((int)p1.getX(),(int)p1.getY()-5,(int)p1.getX(),(int)p1.getY()); |
|
87 |
g.drawLine((int)p2.getX(),(int)p2.getY(),(int)p2.getX(),(int)p2.getY()+5); |
|
88 |
TextLayout textaux = new TextLayout(String.valueOf(valueIntervalX), |
|
89 |
font, frc); |
|
90 |
|
|
91 |
double w=textaux.getBounds().getWidth(); |
|
92 |
double h=textaux.getBounds().getHeight(); |
|
93 |
g.setColor(textColor); |
|
94 |
textaux.draw(g,(int)(p1.getX()-w/2),(int)(p1.getY()-h)-5); |
|
95 |
textaux.draw(g,(int)(p2.getX()-w/2),(int)(p2.getY()+h*2)+5); |
|
96 |
} |
|
97 |
valueIntervalX=valueIntervalX+interval; |
|
98 |
x=x+interval; |
|
99 |
} |
|
100 |
double valueIntervalY=((extentY/interval)-restY) * interval-interval; |
|
101 |
while(y<extent.getMaxY()){ |
|
102 |
if (y>extentY) { |
|
103 |
Point2D p1=fframeview.getMapContext().getViewPort().fromMapPoint(extentX,y); |
|
104 |
Point2D p2=fframeview.getMapContext().getViewPort().fromMapPoint(extent.getMaxX(),y); |
|
105 |
g.setColor(lineColor); |
|
106 |
g.drawLine((int)p1.getX()-5,(int)p1.getY(),(int)p1.getX(),(int)p1.getY()); |
|
107 |
g.drawLine((int)p2.getX(),(int)p2.getY(),(int)p2.getX()+5,(int)p2.getY()); |
|
108 |
TextLayout textaux = new TextLayout(String.valueOf(valueIntervalY), |
|
109 |
font, frc); |
|
110 |
double w=textaux.getBounds().getWidth(); |
|
111 |
double h=textaux.getBounds().getHeight(); |
|
112 |
g.setColor(textColor); |
|
113 |
textaux.draw(g,(int)(p1.getX()-w-10),(int)(p1.getY()+h/2)); |
|
114 |
textaux.draw(g,(int)p2.getX()+10,(int)(p2.getY()+h/2)); |
|
115 |
} |
|
116 |
valueIntervalY=valueIntervalY+interval; |
|
117 |
y=y+interval; |
|
118 |
} |
|
119 |
g.setColor(lineColor); |
|
120 |
|
|
121 |
g.draw(rView); |
|
122 |
|
|
123 |
x = extentX-distX; |
|
124 |
y = extentY-distY; |
|
125 |
|
|
126 |
if (isLine) { // Dibuja las l?neas. |
|
127 |
// while(x<extent.getMaxX()){ |
|
128 |
// if (x>extentX) { |
|
129 |
// g.drawLine((int)pixelsX,(int)rView.getMinY(),(int)pixelsX,(int)rView.getMaxY()); |
|
130 |
// } |
|
131 |
// pixelsX=pixelsX+pixelsInterval; |
|
132 |
// } |
|
133 |
// while(pixelsY<rView.getMaxY()){ |
|
134 |
// if (pixelsY>rView.getMinY()) |
|
135 |
// g.drawLine((int)rView.getMinX(),(int)pixelsY,(int)rView.getMaxX(),(int)pixelsY); |
|
136 |
// pixelsY=pixelsY+pixelsInterval; |
|
137 |
// } |
|
138 |
while(x<extent.getMaxX()){ |
|
139 |
Point2D antPoint=fframeview.getMapContext().getViewPort().fromMapPoint(x,extentY); |
|
140 |
if (x>extentX) { |
|
141 |
while(y<=extent.getMaxY()){ |
|
142 |
if (y>=extentY) { |
|
143 |
Point2D p=fframeview.getMapContext().getViewPort().fromMapPoint(x,y); |
|
144 |
g.drawLine((int)antPoint.getX(),(int)antPoint.getY(),(int)p.getX(),(int)p.getY()); |
|
145 |
antPoint=(Point2D)p.clone(); |
|
146 |
} |
|
147 |
|
|
148 |
y=y+interval; |
|
149 |
} |
|
150 |
Point2D p=fframeview.getMapContext().getViewPort().fromMapPoint(x,extent.getMaxY()); |
|
151 |
g.drawLine((int)antPoint.getX(),(int)antPoint.getY(),(int)p.getX(),(int)p.getY()); |
|
152 |
antPoint=(Point2D)p.clone(); |
|
153 |
y=extentY-distY; |
|
154 |
|
|
155 |
} |
|
156 |
|
|
157 |
|
|
158 |
x=x+interval; |
|
159 |
} |
|
160 |
while(y<=extent.getMaxY()){ |
|
161 |
Point2D antPoint=fframeview.getMapContext().getViewPort().fromMapPoint(extentX,y); |
|
162 |
if (y>extentY) { |
|
163 |
while(x<=extent.getMaxX()){ |
|
164 |
if (x>=extentX) { |
|
165 |
Point2D p=fframeview.getMapContext().getViewPort().fromMapPoint(x,y); |
|
166 |
g.drawLine((int)antPoint.getX(),(int)antPoint.getY(),(int)p.getX(),(int)p.getY()); |
|
167 |
antPoint=p; |
|
168 |
} |
|
169 |
x=x+interval; |
|
170 |
} |
|
171 |
Point2D p=fframeview.getMapContext().getViewPort().fromMapPoint(extent.getMaxX(),y); |
|
172 |
g.drawLine((int)antPoint.getX(),(int)antPoint.getY(),(int)p.getX(),(int)p.getY()); |
|
173 |
antPoint=(Point2D)p.clone(); |
|
174 |
x=extentX-distX; |
|
175 |
} |
|
176 |
y=y+interval; |
|
177 |
} |
|
178 |
} else { //Dibuja los puntos |
|
179 |
while(x<=extent.getMaxX()){ |
|
180 |
if (x>extentX) { |
|
181 |
while(y<=extent.getMaxY()){ |
|
182 |
if (y>=extentY) { |
|
183 |
Point2D p=fframeview.getMapContext().getViewPort().fromMapPoint(x,y); |
|
184 |
g.drawLine((int)p.getX()-10,(int)p.getY(),(int)p.getX()+10,(int)p.getY()); |
|
185 |
g.drawLine((int)p.getX(),(int)p.getY()-10,(int)p.getX(),(int)p.getY()+10); |
|
186 |
} |
|
187 |
y=y+interval; |
|
188 |
} |
|
189 |
y=extentY-distY; |
|
190 |
} |
|
191 |
x=x+interval; |
|
192 |
} |
|
193 |
|
|
194 |
} |
|
195 |
|
|
196 |
g.rotate(Math.toRadians(-getRotation()), r.x + (r.width / 2), |
|
197 |
r.y + (r.height / 2)); |
|
198 |
} |
|
199 |
|
|
200 |
public void print(Graphics2D g, AffineTransform at, FShape shape,PrintRequestAttributeSet properties) throws ReadDriverException { |
|
201 |
draw(g,at,null,null); |
|
202 |
} |
|
203 |
|
|
204 |
public XMLEntity getXMLEntity() throws SaveException { |
|
205 |
XMLEntity xml = super.getXMLEntity(); |
|
206 |
try { |
|
207 |
xml.putProperty("interval", interval); |
|
208 |
xml.putProperty("isLine", isLine); |
|
209 |
xml.putProperty("lineColor", StringUtilities.color2String(lineColor)); |
|
210 |
xml.putProperty("lineWidth", lineWidth); |
|
211 |
xml.putProperty("sizeFont", sizeFont); |
|
212 |
xml.putProperty("textColor", StringUtilities.color2String(textColor)); |
|
213 |
|
|
214 |
if (fframeview != null) { |
|
215 |
Layout layout = fframeview.getLayout(); |
|
216 |
IFFrame[] fframes = layout.getLayoutContext().getAllFFrames(); |
|
217 |
|
|
218 |
for (int i = 0; i < fframes.length; i++) { |
|
219 |
if (fframeview.equals(fframes[i])) { |
|
220 |
xml.putProperty("index", i); |
|
221 |
break; |
|
222 |
} |
|
223 |
} |
|
224 |
} |
|
225 |
} catch (Exception e) { |
|
226 |
throw new SaveException(e, this.getClass().getName()); |
|
227 |
} |
|
228 |
return xml; |
|
229 |
} |
|
230 |
public void setXMLEntity(XMLEntity xml) { |
|
231 |
if (xml.getIntProperty("m_Selected") != 0) { |
|
232 |
this.setSelected(true); |
|
233 |
} else { |
|
234 |
this.setSelected(false); |
|
235 |
} |
|
236 |
|
|
237 |
this.interval = xml.getDoubleProperty("interval"); |
|
238 |
this.isLine = xml.getBooleanProperty("isLine"); |
|
239 |
this.lineColor = StringUtilities.string2Color(xml |
|
240 |
.getStringProperty("lineColor")); |
|
241 |
this.lineWidth = xml.getDoubleProperty("lineWidth"); |
|
242 |
this.sizeFont = xml.getIntProperty("sizeFont"); |
|
243 |
this.textColor = StringUtilities.string2Color(xml |
|
244 |
.getStringProperty("textColor")); |
|
245 |
|
|
246 |
setRotation(xml.getDoubleProperty("m_rotation")); |
|
247 |
|
|
248 |
if (xml.contains("index")) { |
|
249 |
dependenceIndex = xml.getIntProperty("index"); |
|
250 |
} |
|
251 |
} |
|
252 |
|
|
253 |
public void setXMLEntity03(XMLEntity xml, Layout l) { |
|
254 |
// TODO Auto-generated method stub |
|
255 |
|
|
256 |
} |
|
257 |
|
|
258 |
public String getNameFFrame() { |
|
259 |
return PluginServices.getText(this, "cuadricula")+ num; |
|
260 |
} |
|
261 |
|
|
262 |
public void cloneActions(IFFrame frame) { |
|
263 |
// TODO Auto-generated method stub |
|
264 |
|
|
265 |
} |
|
266 |
|
|
267 |
public void setFFrameDependence(IFFrame f) { |
|
268 |
fframeview=(FFrameView)f; |
|
269 |
fframeview.refresh(); |
|
270 |
setBoundBox(); |
|
271 |
} |
|
272 |
|
|
273 |
public IFFrame[] getFFrameDependence() { |
|
274 |
return new IFFrame[] {fframeview}; |
|
275 |
} |
|
276 |
|
|
277 |
/** |
|
278 |
* Actualiza las dependencias que tenga este FFrame con el resto. |
|
279 |
* |
|
280 |
* @param fframes Resto de FFrames. |
|
281 |
*/ |
|
282 |
public void initDependence(IFFrame[] fframes) { |
|
283 |
if ((dependenceIndex != -1) && |
|
284 |
fframes[dependenceIndex] instanceof FFrameView) { |
|
285 |
fframeview = (FFrameView) fframes[dependenceIndex]; |
|
286 |
} |
|
287 |
} |
|
288 |
|
|
289 |
public void setInterval(double d) { |
|
290 |
interval=d; |
|
291 |
} |
|
292 |
public double getInterval() { |
|
293 |
return interval; |
|
294 |
} |
|
295 |
|
|
296 |
public void setLineWidth(double d) { |
|
297 |
lineWidth=d; |
|
298 |
} |
|
299 |
|
|
300 |
public void setTextColor(Color textcolor) { |
|
301 |
textColor=textcolor; |
|
302 |
} |
|
303 |
|
|
304 |
public void setLineColor(Color linecolor) { |
|
305 |
lineColor=linecolor; |
|
306 |
} |
|
307 |
|
|
308 |
public void setIsLine(boolean b) { |
|
309 |
isLine=b; |
|
310 |
} |
|
311 |
public boolean isLine() { |
|
312 |
return isLine; |
|
313 |
} |
|
314 |
|
|
315 |
public IFFrameDialog getPropertyDialog() { |
|
316 |
return new FFrameGridDialog(getLayout(),this); |
|
317 |
} |
|
318 |
|
|
319 |
public double getLineWidth() { |
|
320 |
return lineWidth; |
|
321 |
} |
|
322 |
|
|
323 |
public Color getFontColor() { |
|
324 |
return textColor; |
|
325 |
} |
|
326 |
|
|
327 |
public Color getLineColor() { |
|
328 |
return lineColor; |
|
329 |
} |
|
330 |
|
|
331 |
public int getSizeFont() { |
|
332 |
return sizeFont; |
|
333 |
} |
|
334 |
|
|
335 |
public void setSizeFont(int sizeFont) { |
|
336 |
this.sizeFont = sizeFont; |
|
337 |
} |
|
338 |
|
|
339 |
public void setBoundBox() { |
|
340 |
Rectangle2D r=fframeview.getBoundBox(); |
|
341 |
Rectangle2D extent=fframeview.getMapContext().getViewPort().getAdjustedExtent(); |
|
342 |
double extentX=extent.getMaxX(); |
|
343 |
double extentY=extent.getMaxY(); |
|
344 |
int lengthX=String.valueOf((long)extentX).length(); |
|
345 |
double myScale = getLayout().getLayoutControl().getAT().getScaleX() * 0.0234; //FLayoutUtilities.fromSheetDistance(folio.getAncho(),at)/rv.getWidth(); |
|
346 |
int scaledFontSize = (int) (myScale * sizeFont); |
|
347 |
int pixelsX=(int)(lengthX*scaledFontSize*0.7); |
|
348 |
int lengthY=String.valueOf((long)extentY).length(); |
|
349 |
int pixelsY=(lengthY*scaledFontSize); |
|
350 |
double dX=FLayoutUtilities.toSheetDistance(pixelsX,getLayout().getLayoutControl().getAT()); |
|
351 |
double dY=FLayoutUtilities.toSheetDistance(pixelsY,getLayout().getLayoutControl().getAT()); |
|
352 |
Rectangle2D rBound=new Rectangle2D.Double(r.getMinX()-dY,r.getMinY()-dX,r.getWidth()+dY*2,r.getHeight()+dX*2); |
|
353 |
super.setBoundBox(rBound); |
|
354 |
} |
|
355 |
public Rectangle2D getMovieRect(int difx, int dify) { |
|
356 |
return this.getBoundingBox(null); |
|
357 |
} |
|
358 |
|
|
359 |
public void refreshDependence(IFFrame fant, IFFrame fnew) { |
|
360 |
if (fframeview.equals(fant)) { |
|
361 |
fframeview=(FFrameView)fnew; |
|
362 |
fframeview.refresh(); |
|
363 |
setBoundBox(); |
|
364 |
} |
|
365 |
|
|
366 |
} |
|
367 |
} |
|
0 | 368 |
tags/tmp_build/extensions/extGridViewLayout/src/com/iver/cit/gvsig/project/documents/layout/fframes/FFrameGridFactory.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.project.documents.layout.fframes; |
|
2 |
|
|
3 |
import com.iver.andami.PluginServices; |
|
4 |
|
|
5 |
|
|
6 |
/** |
|
7 |
* Factory of FFrameGrid. |
|
8 |
* |
|
9 |
* @author Vicente Caballero Navarro |
|
10 |
*/ |
|
11 |
public class FFrameGridFactory extends FrameFactory { |
|
12 |
public static String registerName = "FFrameGrid"; |
|
13 |
|
|
14 |
|
|
15 |
/** |
|
16 |
* Create a new IFFrame. |
|
17 |
* |
|
18 |
* @return IFFrame. |
|
19 |
*/ |
|
20 |
public IFFrame createFrame() { |
|
21 |
FFrameGrid grid = new FFrameGrid(); |
|
22 |
grid.setFrameLayoutFactory(this); |
|
23 |
return grid; |
|
24 |
} |
|
25 |
|
|
26 |
/** |
|
27 |
* Returns the name of registration in the point of extension. |
|
28 |
* |
|
29 |
* @return Name of registration |
|
30 |
*/ |
|
31 |
public String getRegisterName() { |
|
32 |
return registerName; |
|
33 |
} |
|
34 |
|
|
35 |
/** |
|
36 |
* Returns the name of IFFrame. |
|
37 |
* |
|
38 |
* @return Name of IFFrame. |
|
39 |
*/ |
|
40 |
public String getNameType() { |
|
41 |
return PluginServices.getText(this, "FFrameGrid"); |
|
42 |
} |
|
43 |
|
|
44 |
/** |
|
45 |
* Registers in the points of extension the Factory with alias. |
|
46 |
* |
|
47 |
*/ |
|
48 |
public static void register() { |
|
49 |
register(registerName, new FFrameGridFactory()); |
|
50 |
|
|
51 |
} |
|
52 |
|
|
53 |
} |
|
0 | 54 |
tags/tmp_build/extensions/extGridViewLayout/.cvsignore | ||
---|---|---|
1 |
bin |
|
0 | 2 |
tags/tmp_build/extensions/extGridViewLayout/build.xml | ||
---|---|---|
1 |
<project name="Generar extension en Andami" default="generate-without-source" basedir="."> |
|
2 |
<description> |
|
3 |
Instala el plugin en Andami |
|
4 |
</description> |
|
5 |
<!-- set global properties for this build --> |
|
6 |
<property name="src" location="src"/> |
|
7 |
<property name="build" location="bin"/> |
|
8 |
<property name="dist" location="dist"/> |
|
9 |
<property name="mainplugin" value="com.iver.cit.gvsig"/> |
|
10 |
<property name="plugin" value="com.iver.cit.gvsig.gridlayout"/> |
|
11 |
<property name="gvsiglibjar" value="gvsig-grid"/> |
|
12 |
<property name="andami" location="../_fwAndami" /> |
|
13 |
<property name="extensionsDir" location="../_fwAndami/gvSIG/extensiones"/> |
|
14 |
<property name="drivers-dir" location="${extensionsDir}/${mainplugin}/drivers" /> |
|
15 |
<property name="lib-dir" location="${extensionsDir}/${mainplugin}/lib"/> |
|
16 |
<property name="andamiLibs" location="${andami}/lib" /> |
|
17 |
<property name="andamiJar" location="${andami}/andami.jar"/> |
|
18 |
<property name="gvsigJar" location="${extensionsDir}/${mainplugin}/lib/${mainplugin}.jar"/> |
|
19 |
|
|
20 |
<target name="init"> |
|
21 |
<!-- Create the time stamp --> |
|
22 |
<tstamp/> |
|
23 |
<!-- Create the build directory structure used by compile --> |
|
24 |
<mkdir dir="${build}"/> |
|
25 |
<mkdir dir="${dist}"/> |
|
26 |
|
|
27 |
</target> |
|
28 |
|
|
29 |
<target name="generate-without-source" |
|
30 |
description="generate the distribution without the source file"> |
|
31 |
<!-- Create the distribution directory --> |
|
32 |
<mkdir dir="${dist}"/> |
|
33 |
|
|
34 |
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file --> |
|
35 |
<jar jarfile="${dist}/${plugin}.jar" basedir="${build}" includes="com/iver/cit/gvsig/**" |
|
36 |
excludes="com/iver/cit/gvsig/fmap/**"/> |
|
37 |
<copy file="config/config.xml" todir="${dist}"/> |
|
38 |
<copy todir="${dist}"> |
|
39 |
<fileset dir="config" includes="text*.properties"/> |
|
40 |
</copy> |
|
41 |
<copy todir="${dist}/images"> |
|
42 |
<fileset dir="images/" includes="*"/> |
|
43 |
</copy> |
|
44 |
<!--copy todir="${lib-dir}"> |
|
45 |
<fileset dir="./lib" includes="*.jar,*.zip"/> |
|
46 |
<fileset dir="." includes=".keystore"/> |
|
47 |
</copy--> |
|
48 |
<move todir="${extensionsDir}/${mainplugin}/lib"> |
|
49 |
<fileset dir="${dist}" includes="${gvsiglibjar}.jar"/> |
|
50 |
</move> |
|
51 |
<move todir="${extensionsDir}/${plugin}/"> |
|
52 |
<fileset dir="${dist}" includes="**/**"/> |
|
53 |
</move> |
|
54 |
</target> |
|
55 |
|
|
56 |
|
|
57 |
<target name="batch-build" |
|
58 |
description="compile the sources, create the jar file" |
|
59 |
depends="compile,create-jar,copy-data-files"> |
|
60 |
</target> |
|
61 |
|
|
62 |
<target name="compile" description="compile the source" > |
|
63 |
<!-- Compile the Java code from ${src} to ${build} --> |
|
64 |
<mkdir dir="${build}" /> |
|
65 |
<echo>${compile-classpath}</echo> |
|
66 |
<javac srcdir="${src}" |
|
67 |
destdir="${build}" |
|
68 |
source="1.4" |
|
69 |
target="1.4" |
|
70 |
debug="${debug}" |
|
71 |
debuglevel="${debuglevel}" |
|
72 |
classpath="${compile-classpath}"/> |
|
73 |
</target> |
|
74 |
|
|
75 |
<target name="create-jar" |
|
76 |
description="Creates the plugin jar"> |
|
77 |
<mkdir dir="${dist}/lib"/> |
|
78 |
<jar jarfile="${dist}/${plugin}.jar" basedir="${build}" includes="com/iver/cit/gvsig/**" |
|
79 |
excludes="com/iver/cit/gvsig/fmap/**" |
|
80 |
/> |
|
81 |
<jar jarfile="${dist}/${fmapjar}.jar" basedir="${build}" |
|
82 |
includes="com/iver/cit/gvsig/fmap/**" /> |
|
83 |
</target> |
|
84 |
|
|
85 |
<target name="copy-data-files"> |
|
86 |
<copy file="config/config.xml" todir="${dist}"/> |
|
87 |
<copy todir="${dist}"> |
|
88 |
<fileset dir="config" includes="text*.properties"/> |
|
89 |
</copy> |
|
90 |
<copy todir="${dist}/images"> |
|
91 |
<fileset dir="images/" includes="*"/> |
|
92 |
</copy> |
|
93 |
</target> |
|
94 |
|
|
95 |
|
|
96 |
<target name="clean" |
|
97 |
description="clean up" > |
|
98 |
<!-- Delete the ${build} and ${dist} directory trees --> |
|
99 |
<delete dir="${dist}"/> |
|
100 |
<delete dir="${build}"/> |
|
101 |
</target> |
|
102 |
</project> |
|
103 |
|
|
0 | 104 |
tags/tmp_build/extensions/extGridViewLayout/.classpath | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<classpath> |
|
3 |
<classpathentry kind="src" path="src"/> |
|
4 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> |
|
5 |
<classpathentry combineaccessrules="false" kind="src" path="/appgvSIG"/> |
|
6 |
<classpathentry combineaccessrules="false" kind="src" path="/_fwAndami"/> |
|
7 |
<classpathentry combineaccessrules="false" kind="src" path="/libFMap"/> |
|
8 |
<classpathentry kind="lib" path="/_fwAndami/lib/iver-utiles.jar" sourcepath="/libIverUtiles/src"/> |
|
9 |
<classpathentry kind="lib" path="/libFMap/lib/gdbms-0.8-SNAPSHOT.jar" sourcepath="/libGDBMS"/> |
|
10 |
<classpathentry kind="lib" path="/libFMap/lib/org.gvsig.exceptions.jar"/> |
|
11 |
<classpathentry kind="lib" path="/_fwAndami/lib/org.gvsig.ui.jar" sourcepath="/libUIComponent/src"/> |
|
12 |
<classpathentry kind="output" path="bin"/> |
|
13 |
</classpath> |
|
0 | 14 |
tags/tmp_build/extensions/extGridViewLayout/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>extGridViewLayout</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
<buildCommand> |
|
14 |
<name>de.loskutov.FileSync.FSBuilder</name> |
|
15 |
<arguments> |
|
16 |
</arguments> |
|
17 |
</buildCommand> |
|
18 |
</buildSpec> |
|
19 |
<natures> |
|
20 |
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> |
|
21 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
22 |
<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature> |
|
23 |
</natures> |
|
24 |
</projectDescription> |
|
0 | 25 |
tags/tmp_build/extensions/extGridViewLayout/config/text_zh.properties | ||
---|---|---|
1 |
Aceptar=\u786e\u5b9a |
|
2 |
Cancelar=\u53d6\u6d88 |
|
0 | 3 |
tags/tmp_build/extensions/extGridViewLayout/config/text_en.properties | ||
---|---|---|
1 |
Aceptar=Accept |
|
2 |
Cancelar=Cancel |
|
0 | 3 |
tags/tmp_build/extensions/extGridViewLayout/config/text_gl.properties | ||
---|---|---|
1 |
Aceptar=Aceptar |
|
2 |
Cancelar=Cancelar |
|
0 | 3 |
tags/tmp_build/extensions/extGridViewLayout/config/text_ca.properties | ||
---|---|---|
1 |
Aceptar=Acceptar |
|
2 |
Cancelar=Cancel\u00b7lar |
|
0 | 3 |
tags/tmp_build/extensions/extGridViewLayout/config/text_pt.properties | ||
---|---|---|
1 |
Aceptar=Aceitar |
|
2 |
Cancelar=Cancelar |
|
0 | 3 |
tags/tmp_build/extensions/extGridViewLayout/config/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<depends plugin-name="com.iver.cit.gvsig"/> |
|
4 |
<libraries library-dir="."/> |
|
5 |
<resourceBundle name="text"/> |
|
6 |
<extensions> |
|
7 |
<extension class-name="com.iver.cit.gvsig.FFrameGridExtension" |
|
8 |
description="M?dulo de inserci?n de cuadr?cula." |
|
9 |
active="true" |
|
10 |
priority="1"> |
|
11 |
<menu text="Mapa/Graficos/grid" action-command="CUADRICULA" icon="images/grid.png" |
|
12 |
position="8"/> |
|
13 |
<tool-bar name="Layout_Tools_View" position="9"> |
|
14 |
<action-tool icon="images/grid.png" action-command="CUADRICULA" tooltip="cuadricula" position="5"/> |
|
15 |
</tool-bar> |
|
16 |
</extension> |
|
17 |
</extensions> |
|
18 |
|
|
19 |
|
|
20 |
</plugin-config> |
|
0 | 21 |
tags/tmp_build/extensions/extGridViewLayout/config/text_cs.properties | ||
---|---|---|
1 |
Aceptar=Budi\u017e |
|
2 |
Cancelar=Zru\u0161it |
|
0 | 3 |
tags/tmp_build/extensions/extGridViewLayout/config/text_fr.properties | ||
---|---|---|
1 |
Aceptar=Accepter |
|
2 |
Cancelar=Annuler |
|
0 | 3 |
tags/tmp_build/extensions/extGridViewLayout/config/text_de.properties | ||
---|---|---|
1 |
Aceptar=OK |
|
2 |
Cancelar=Abbrechen |
|
0 | 3 |
tags/tmp_build/extensions/extGridViewLayout/config/plugin.dtd | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO_8859-1"?> |
|
2 |
<!ELEMENT class EMPTY > |
|
3 |
<!ATTLIST class name NMTOKEN #REQUIRED > |
|
4 |
|
|
5 |
<!ELEMENT extension ( class | menu | toolBar | toolBoxItem | popupMenu)* > |
|
6 |
<!ATTLIST extension enabled NMTOKEN #IMPLIED > |
|
7 |
<!ATTLIST extension position NMTOKEN #IMPLIED > |
|
8 |
|
|
9 |
<!ELEMENT fileExtension ( class ) > |
|
10 |
<!ATTLIST fileExtension description CDATA #REQUIRED > |
|
11 |
<!ATTLIST fileExtension enabled NMTOKEN #IMPLIED > |
|
12 |
<!ATTLIST fileExtension endsWith CDATA #REQUIRED > |
|
13 |
<!ATTLIST fileExtension dialog CDATA #REQUIRED > |
|
14 |
|
|
15 |
<!ELEMENT import EMPTY > |
|
16 |
<!ATTLIST import plugin NMTOKEN #REQUIRED > |
|
17 |
|
|
18 |
<!ELEMENT libraries ( library+ ) > |
|
19 |
|
|
20 |
<!ELEMENT library EMPTY > |
|
21 |
<!ATTLIST library file NMTOKEN #REQUIRED > |
|
22 |
|
|
23 |
<!ELEMENT menu EMPTY > |
|
24 |
<!ATTLIST menu actionCommand NMTOKEN #IMPLIED > |
|
25 |
<!ATTLIST menu enableText CDATA #IMPLIED > |
|
26 |
<!ATTLIST menu key NMTOKEN #IMPLIED > |
|
27 |
<!ATTLIST menu mnemonic NMTOKEN #IMPLIED > |
|
28 |
<!ATTLIST menu icon CDATA #IMPLIED > |
|
29 |
<!ATTLIST menu text CDATA #REQUIRED > |
|
30 |
<!ATTLIST menu tooltip CDATA #IMPLIED > |
|
31 |
|
|
32 |
<!ELEMENT plugin ( import*, libraries, resourceBundle, labelSet*, extension*, fileExtension*, icon*) > |
|
33 |
|
|
34 |
<!ELEMENT icon EMPTY > |
|
35 |
<!ATTLIST icon src CDATA #REQUIRED > |
|
36 |
<!ATTLIST icon text CDATA #REQUIRED > |
|
37 |
|
|
38 |
<!ELEMENT resourceBundle EMPTY > |
|
39 |
<!ATTLIST resourceBundle name NMTOKEN #REQUIRED > |
|
40 |
|
|
41 |
<!ELEMENT tool EMPTY > |
|
42 |
<!ATTLIST tool actionCommand NMTOKEN #IMPLIED > |
|
43 |
<!ATTLIST tool enableText CDATA #IMPLIED > |
|
44 |
<!ATTLIST tool icon CDATA #IMPLIED > |
|
45 |
<!ATTLIST tool text NMTOKEN #IMPLIED > |
|
46 |
<!ATTLIST tool tooltip CDATA #IMPLIED > |
|
47 |
|
|
48 |
<!ELEMENT toolBar ( tool+ ) > |
|
49 |
<!ATTLIST toolBar name NMTOKEN #IMPLIED > |
|
50 |
|
|
51 |
<!ELEMENT entry EMPTY > |
|
52 |
<!ATTLIST entry text CDATA #IMPLIED > |
|
53 |
<!ATTLIST entry enableText CDATA #IMPLIED > |
|
54 |
<!ATTLIST entry tooltip CDATA #IMPLIED > |
|
55 |
<!ATTLIST entry actionCommand NMTOKEN #IMPLIED > |
|
56 |
|
|
57 |
<!ELEMENT popupMenu ( entry+ ) > |
|
58 |
<!ATTLIST popupMenu name NMTOKEN #IMPLIED > |
Also available in: Unified diff