wwxml.java
来自「world wind java sdk 源码」· Java 代码 · 共 1,246 行 · 第 1/4 页
JAVA
1,246 行
{ String message = Logging.getMessage("nullValue.ParameterNameIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } Object o = params.getValue(paramKey); if (o == null) { Integer d = getInteger(context, paramName, xpath); if (d != null) params.setValue(paramKey, d); } } /** * Checks a parameter list for a specified key and if not present attempts to find a value for the key from an * element matched by an XPath expression. If found, the key and value are added to the parameter list. * * @param context the context from which to start the XPath search. * @param params the parameter list. * @param paramKey the key used to identify the paramater in the parameter list. * @param paramName the Xpath expression identifying the parameter value within the specified context. * @param xpath an {@link XPath} object to use for the search. This allows the caller to re-use XPath objects * when performing multiple searches. May be null. * * @throws IllegalArgumentException if either the context, parameter list, parameter key or parameter name are * null. */ public static void checkAndSetLongParam(Element context, AVList params, String paramKey, String paramName, XPath xpath) { if (context == null) { String message = Logging.getMessage("nullValue.ElementIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (params == null) { String message = Logging.getMessage("nullValue.ParametersIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (paramKey == null) { String message = Logging.getMessage("nullValue.ParameterKeyIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (paramName == null) { String message = Logging.getMessage("nullValue.ParameterNameIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } Object o = params.getValue(paramKey); if (o == null) { Long d = getLong(context, paramName, xpath); if (d != null) params.setValue(paramKey, d); } } /** * Checks a parameter list for a specified key and if not present attempts to find a value for the key from an * element matched by an XPath expression. If found, the key and value are added to the parameter list. * * @param context the context from which to start the XPath search. * @param params the parameter list. * @param paramKey the key used to identify the paramater in the parameter list. * @param paramName the Xpath expression identifying the parameter value within the specified context. * @param xpath an {@link XPath} object to use for the search. This allows the caller to re-use XPath objects * when performing multiple searches. May be null. * * @throws IllegalArgumentException if either the context, parameter list, parameter key or parameter name are * null. */ public static void checkAndSetBooleanParam(Element context, AVList params, String paramKey, String paramName, XPath xpath) { if (context == null) { String message = Logging.getMessage("nullValue.ElementIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (params == null) { String message = Logging.getMessage("nullValue.ParametersIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (paramKey == null) { String message = Logging.getMessage("nullValue.ParameterKeyIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (paramName == null) { String message = Logging.getMessage("nullValue.ParameterNameIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } Object o = params.getValue(paramKey); if (o == null) { Boolean d = getBoolean(context, paramName, xpath); if (d != null) params.setValue(paramKey, d); } } /** * Checks a parameter list for a specified key and if not present attempts to find a value for the key from an * element matched by an XPath expression. If found, the key and value are added to the parameter list. * * @param context the context from which to start the XPath search. * @param params the parameter list. * @param paramKey the key used to identify the paramater in the parameter list. * @param paramName the Xpath expression identifying the parameter value within the specified context. * @param xpath an {@link XPath} object to use for the search. This allows the caller to re-use XPath objects * when performing multiple searches. May be null. * * @throws IllegalArgumentException if either the context, parameter list, parameter key or parameter name are * null. */ public static void checkAndSetLatLonParam(Element context, AVList params, String paramKey, String paramName, XPath xpath) { if (context == null) { String message = Logging.getMessage("nullValue.ElementIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (params == null) { String message = Logging.getMessage("nullValue.ParametersIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (paramKey == null) { String message = Logging.getMessage("nullValue.ParameterKeyIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (paramName == null) { String message = Logging.getMessage("nullValue.ParameterNameIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } Object o = params.getValue(paramKey); if (o == null) { LatLon ll = getLatLon(context, paramName, xpath); if (ll != null) params.setValue(paramKey, ll); } } /** * Checks a parameter list for a specified key and if not present attempts to find a value for the key from an * element matched by an XPath expression. If found, the key and value are added to the parameter list. * * @param context the context from which to start the XPath search. * @param params the parameter list. * @param paramKey the key used to identify the paramater in the parameter list. * @param paramName the Xpath expression identifying the parameter value within the specified context. * @param xpath an {@link XPath} object to use for the search. This allows the caller to re-use XPath objects * when performing multiple searches. May be null. * * @throws IllegalArgumentException if either the context, parameter list, parameter key or parameter name are * null. */ public static void checkAndSetSectorParam(Element context, AVList params, String paramKey, String paramName, XPath xpath) { if (context == null) { String message = Logging.getMessage("nullValue.ElementIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (params == null) { String message = Logging.getMessage("nullValue.ParametersIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (paramKey == null) { String message = Logging.getMessage("nullValue.ParameterKeyIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (paramName == null) { String message = Logging.getMessage("nullValue.ParameterNameIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } Object o = params.getValue(paramKey); if (o == null) { Sector sector = getSector(context, paramName, xpath); if (sector != null) params.setValue(paramKey, sector); } } /** * Checks a parameter list for a specified key and if not present attempts to find a value for the key from an * element matched by an XPath expression. If found, the key and value are added to the parameter list. * * @param context the context from which to start the XPath search. * @param params the parameter list. * @param paramKey the key used to identify the paramater in the parameter list. * @param paramName the Xpath expression identifying the parameter value within the specified context. * @param xpath an {@link XPath} object to use for the search. This allows the caller to re-use XPath objects * when performing multiple searches. May be null. * * @throws IllegalArgumentException if either the context, parameter list, parameter key or parameter name are * null. */ public static void checkAndSetSectorResolutionParam(Element context, AVList params, String paramKey, String paramName, XPath xpath) { if (context == null) { String message = Logging.getMessage("nullValue.ElementIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (params == null) { String message = Logging.getMessage("nullValue.ParametersIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (paramKey == null) { String message = Logging.getMessage("nullValue.ParameterKeyIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (paramName == null) { String message = Logging.getMessage("nullValue.ParameterNameIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } Object o = params.getValue(paramKey); if (o == null) { Element[] els = getElements(context, paramName, xpath); if (els == null || els.length == 0) return; LevelSet.SectorResolution[] srs = new LevelSet.SectorResolution[els.length]; for (int i = 0; i < els.length; i++) { LevelSet.SectorResolution sr = getSectorResolutionLimit(els[i], null, xpath); if (sr != null) srs[i] = sr; } params.setValue(paramKey, srs); } } public static String fixGetMapString(String gms) { gms = gms.trim(); int qMarkIndex = gms.indexOf("?"); if (qMarkIndex < 0) gms += "?"; else if (qMarkIndex != gms.length() - 1) if (gms.lastIndexOf("&") != gms.length() - 1) gms += "&"; return gms; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?