Revision 280 trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/extension/FFrameViewExtension.java
FFrameViewExtension.java | ||
---|---|---|
50 | 50 |
*/ |
51 | 51 |
public class FFrameViewExtension extends Extension { |
52 | 52 |
|
53 |
private LayoutPanel layout = null; |
|
54 | 53 |
private static Logger logger = LoggerFactory.getLogger(FFrameViewExtension.class); |
55 |
//.info("Can't change scale of view.", ex); |
|
56 | 54 |
|
57 | 55 |
/** |
58 | 56 |
* @see org.gvsig.andami.plugins.IExtension#initialize() |
... | ... | |
71 | 69 |
if (!(window instanceof LayoutPanel)) { |
72 | 70 |
return; |
73 | 71 |
} |
74 |
layout = (LayoutPanel) window; |
|
72 |
LayoutPanel layout = (LayoutPanel) window;
|
|
75 | 73 |
try { |
76 | 74 |
if (args.length>0) { |
77 | 75 |
Long scale = (Long) ToolsLocator.getDataTypesManager().coerce(DataTypes.LONG, args[0]); |
... | ... | |
95 | 93 |
* @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String) |
96 | 94 |
*/ |
97 | 95 |
public void execute(String s) { |
98 |
layout = (LayoutPanel) PluginServices.getMDIManager().getActiveWindow(); |
|
96 |
LayoutPanel layout = (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
|
|
99 | 97 |
|
100 | 98 |
if (s.compareTo("layout-view-navigation-zoom-in-topoint") == 0) { |
101 | 99 |
layout.getLayoutControl().setTool("layoutviewzoomin"); |
... | ... | |
107 | 105 |
} catch (ReadException e) { |
108 | 106 |
NotificationManager.addError("Error de Driver", e); |
109 | 107 |
} |
110 |
} else if (s.compareTo("layout-view-navigation-pan") == 0) { |
|
111 |
layout.getLayoutControl().setTool("layoutviewpan"); |
|
112 |
} else if (s.compareTo("layout-view-add-layer") == 0) { |
|
113 |
PluginsManager manager = PluginsLocator.getManager(); |
|
114 |
AddLayer plugin = (AddLayer) manager.getExtension(AddLayer.class); |
|
115 |
IFFrameUseFMap[] fframes = this.layout.getLayoutContext().getSelectedFFrames(IFFrameUseFMap.class); |
|
116 |
if (fframes.length>0) { |
|
117 |
plugin.addLayers(fframes[0].getMapContext()); |
|
118 |
fframes[0].refresh(); |
|
119 |
} |
|
120 | 108 |
} |
109 |
else { |
|
110 |
return; |
|
111 |
} |
|
121 | 112 |
layout.getDocument().setModified(true); |
122 | 113 |
} |
123 | 114 |
|
... | ... | |
135 | 126 |
} |
136 | 127 |
IFFrameUseFMap[] fframes = l.getLayoutContext().getSelectedFFrames(IFFrameUseFMap.class); |
137 | 128 |
if (fframes.length==1 && !(fframes[0] instanceof FFrameOverView)) { |
138 |
return true; |
|
129 |
IFFrameUseFMap fframeview = (IFFrameUseFMap) fframes[0]; |
|
130 |
if (fframeview.getScaleType()==IFFrameUseFMap.SCALE_TYPE.NORMAL) { |
|
131 |
return true; |
|
132 |
} |
|
139 | 133 |
} |
140 | 134 |
} |
141 | 135 |
return false; |
... | ... | |
152 | 146 |
} |
153 | 147 |
|
154 | 148 |
if (f instanceof LayoutPanel) { |
155 |
// Layout layout = (Layout) f; |
|
156 |
|
|
157 |
return true; // layout.m_Display.getMapControl().getMapContext().getLayers().layerCount() |
|
158 |
// > 0; |
|
149 |
return true; |
|
159 | 150 |
} else { |
160 | 151 |
return false; |
161 | 152 |
} |
Also available in: Unified diff