fixed styles parameter to display legend of non-wms standard layers
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/gis-viewer@121792 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
2275ff77da
commit
050bf42a47
|
@ -1136,19 +1136,14 @@ implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandle
|
|||
break;
|
||||
|
||||
}
|
||||
|
||||
if(styles!=null & styles.size()>0){
|
||||
|
||||
GWT.log("styles "+styles);
|
||||
|
||||
if((styles!=null) && (styles.size()>0)){
|
||||
l.setHasLegend(true);
|
||||
l.setDefaultStyle(styles.get(0));
|
||||
l.setStyle(styles.get(0));
|
||||
l.setStyles(styles);
|
||||
}else{
|
||||
try{
|
||||
WmsUrlValidator.getValueOfParameter(WmsParameters.STYLES, serverWmsRequest);
|
||||
l.setHasLegend(true);
|
||||
}catch(Exception e){
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
List<LayerItem> layerItems = new ArrayList<LayerItem>();
|
||||
|
|
|
@ -236,10 +236,9 @@ public class WmsUrlValidator {
|
|||
*
|
||||
* @param wmsParam the wms param
|
||||
* @param wmsRequestParamaters the url wms parameters
|
||||
* @return the value of parameter
|
||||
* @throws Exception sent Exception if wmsParam not exists
|
||||
* @return the value of parameter or null if parameter not exists
|
||||
*/
|
||||
public static String getValueOfParameter(WmsParameters wmsParam, String wmsRequestParamaters) throws Exception{
|
||||
public static String getValueOfParameter(WmsParameters wmsParam, String wmsRequestParamaters) {
|
||||
// logger.trace("finding: "+wmsParam +" into "+url);
|
||||
int index = wmsRequestParamaters.toLowerCase().indexOf(wmsParam.getParameter().toLowerCase());
|
||||
// logger.trace("start index of "+wmsParam+ " is: "+index);
|
||||
|
@ -251,8 +250,9 @@ public class WmsUrlValidator {
|
|||
int indexOfSeparator = sub.indexOf("&");
|
||||
int end = indexOfSeparator!=-1?indexOfSeparator:sub.length();
|
||||
value = sub.substring(0, end);
|
||||
}else
|
||||
throw new Exception(wmsParam.getParameter() +" not found");
|
||||
}else
|
||||
return null;
|
||||
|
||||
// logger.trace("return value: "+value);
|
||||
return value;
|
||||
}
|
||||
|
|
|
@ -294,7 +294,7 @@ public class LayerToolsPanel extends VerticalPanel {
|
|||
btnLegend.setToolTip("Show Legend");
|
||||
toolbar3.add(btnLegend);
|
||||
|
||||
String defaultStyle = layerItem.getStyle()!=null?layerItem.getStyle():"Unknown Style Name";
|
||||
String defaultStyle = layerItem.getStyle()!=null && !layerItem.getStyle().isEmpty()?layerItem.getStyle():"Unknown Style Name";
|
||||
|
||||
// legend list
|
||||
if (layerItem.getStyles().size()==0 || layerItem.getStyles().size()==1) {
|
||||
|
|
Loading…
Reference in New Issue