Revision 38063 trunk/extensions/extWMS/src/com/iver/cit/gvsig/gui/toc/ZoomToVisibleScaleTocMenuEntry.java
ZoomToVisibleScaleTocMenuEntry.java | ||
---|---|---|
54 | 54 |
public class ZoomToVisibleScaleTocMenuEntry extends TocMenuEntry { |
55 | 55 |
private JMenuItem propsMenuItem; |
56 | 56 |
FLayer lyr = null; |
57 |
|
|
57 |
|
|
58 | 58 |
public void initialize(FPopupMenu m) { |
59 | 59 |
super.initialize(m); |
60 |
|
|
60 |
|
|
61 | 61 |
if (isTocItemBranch()) { |
62 | 62 |
lyr = getNodeLayer(); |
63 | 63 |
if ((lyr instanceof FLyrWMS)) { |
64 | 64 |
propsMenuItem = new JMenuItem(PluginServices.getText(this, "zoom_to_visible_scale")); |
65 | 65 |
getMenu().add( propsMenuItem ); |
66 |
propsMenuItem.setFont(FPopupMenu.theFont); |
|
67 | 66 |
getMenu().setEnabled(true); |
68 |
propsMenuItem.addActionListener(this);
|
|
67 |
propsMenuItem.addActionListener(this); |
|
69 | 68 |
} |
70 | 69 |
} |
71 | 70 |
} |
72 |
|
|
71 |
|
|
73 | 72 |
public void actionPerformed(ActionEvent e) { |
74 | 73 |
lyr = getNodeLayer(); |
75 | 74 |
if (lyr.isAvailable()) { |
... | ... | |
77 | 76 |
FLyrWMS wmsLayer = (FLyrWMS) lyr; |
78 | 77 |
MapContext mp = getMapContext(); |
79 | 78 |
double mapScale = (double) mp.getScaleView(); |
80 |
double correctedMinScale = wmsLayer.getCorrectedServerMinScale();
|
|
79 |
double correctedMinScale = wmsLayer.getCorrectedServerMinScale(); |
|
81 | 80 |
double correctedMaxScale = wmsLayer.getCorrectedServerMaxScale(); |
82 | 81 |
|
83 | 82 |
if (correctedMinScale>0 // -1 and 0 are invalid values for scale |
... | ... | |
88 | 87 |
&& mapScale>=correctedMaxScale){ |
89 | 88 |
/** |
90 | 89 |
* As the WMS 1.3 standard defines the MAX DENOMINATOR SCALE as a non-inclusive |
91 |
* interval limit, we have to subtract a constant to MAX_SCALE in order to
|
|
90 |
* interval limit, we have to subtract a constant to MAX_SCALE in order to |
|
92 | 91 |
* move to the "safe side" of the limit. |
93 | 92 |
*/ |
94 | 93 |
mp.setScaleView((long)correctedMaxScale-1); |
Also available in: Unified diff