⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getservices.java

📁 world wind java sdk 源码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        private void addKeywords(BinaryLogicalOperator logicOps, String keywordText)                throws Exception        {            List<String> keywords = null;            keywordText = keywordText.trim();            if (keywordText.length() > 0)            {                String[] tokens = keywordText.split("[ ,]");                if (tokens != null && tokens.length > 0)                {                    for (String s : tokens)                    {                        if (s != null)                        {                            s = s.trim();                            if (s.length() > 0)                            {                                if (keywords == null)                                    keywords = new ArrayList<String>();                                keywords.add("*" + s + "*");                            }                        }                    }                }            }            // WMS 1.1 Service/Title            // WFS 1.1 ServiceIdentification/Name            //"/$srv/Name/LocalizedString/@value"            // WMS 1.1 Service/Name            // WFS 1.1 ServiceIdentification/Title            //"/$srv/Slot[@name='Title']/ValueList/Value"            // WMS 1.1 Service/Abstract            // WFS 1.1 ServiceIdentification/Abstract            //"/$srv/Description/LocalizedString/@value"            // WMS 1.1 Service/KeywordList/Keyword            //"/$srv/Slot[@name='KeywordList']/ValueList/Value"            // WFS 1.1 ServiceIdentification/Keywords/Keyword            //"/$service/Slot[@name='Keyword']/ValueList/Value"            //"/$service/Slot[@name='Keywords']/ValueList/Value"            if (keywords != null && keywords.size() > 0)            {                for (String s : keywords)                {                    PropertyIsLike like = new PropertyIsLike();                    like.addPropertyName("/$srv/Description/LocalizedString/@value");                    like.addLiteral(s);                    logicOps.addComparisonOperator(like);                }            }        }        private void addServiceTypes(BinaryLogicalOperator logicOps, boolean isWMS, boolean isWFS, boolean isWCS)                throws Exception        {            PropertyIsEqualTo equalTo = new PropertyIsEqualTo();            equalTo.addExpression(new PropertyName("/$srv/@id"));            equalTo.addExpression(new PropertyName("/$cls/@classifiedObject"));            logicOps.addComparisonOperator(equalTo);            equalTo = new PropertyIsEqualTo();            equalTo.addExpression(new PropertyName("/$cls/@classificationNode"));            equalTo.addExpression(new PropertyName("/$clsNode/@id"));            logicOps.addComparisonOperator(equalTo);            Or or = new Or();            logicOps.addLogicalOperator(or);            if (isWMS)            {                PropertyIsLike like = new PropertyIsLike();                like.addPropertyName("/$clsNode/@code");                like.addLiteral("*WMS*");                or.addComparisonOperator(like);            }            if (isWFS)            {                PropertyIsLike like = new PropertyIsLike();                like.addPropertyName("/$clsNode/@code");                like.addLiteral("*WFS*");                or.addComparisonOperator(like);            }            if (isWCS)            {                PropertyIsLike like = new PropertyIsLike();                like.addPropertyName("/$clsNode/@code");                like.addLiteral("*WCS*");                or.addComparisonOperator(like);            }        }        private void addDateRange(BinaryLogicalOperator logicOps, Date minDate, Date maxDate)                throws Exception        {            String propertyName = "/$srv/Slot[@name='Harvest Date']/ValueList/Value";            if (minDate != null)            {                String min = ParserUtils.formatAsOGCDate(minDate);                PropertyIsGreaterThanOrEqualTo gequal = new PropertyIsGreaterThanOrEqualTo();                gequal.addExpression(new PropertyName(propertyName));                gequal.addExpression(new Literal(min));                logicOps.addComparisonOperator(gequal);            }            if (maxDate != null)            {                String max = ParserUtils.formatAsOGCDate(maxDate);                PropertyIsLessThanOrEqualTo lequal = new PropertyIsLessThanOrEqualTo();                lequal.addExpression(new PropertyName(propertyName));                lequal.addExpression(new Literal(max));                logicOps.addComparisonOperator(lequal);            }        }        private void addBoundingBox(BinaryLogicalOperator logicOps, Sector bounds) throws Exception        {            PropertyIsEqualTo equalTo = new PropertyIsEqualTo();            equalTo.addExpression(new PropertyName("/$srv/@id"));            equalTo.addExpression(new PropertyName("/$assoc/@sourceObject"));            logicOps.addComparisonOperator(equalTo);            equalTo = new PropertyIsEqualTo();            equalTo.addExpression(new PropertyName("/$eo/@id"));            equalTo.addExpression(new PropertyName("/$assoc/@targetObject"));            logicOps.addComparisonOperator(equalTo);            equalTo = new PropertyIsEqualTo();            equalTo.addExpression(new PropertyName("/$assoc/@associationType"));            equalTo.addExpression(new Literal("Offers"));            logicOps.addComparisonOperator(equalTo);            BBOX bbox = new BBOX();            bbox.addPropertyName("/$eo/Slot[@name='FootPrint']/ValueList/Value");            bbox.addEnvelope(bounds);            logicOps.addSpatialOperator(bbox);        }    }    protected static class ResponseParser extends SAXResponseParser    {        private GetServices getServices;        public ResponseParser(GetServices getServices)        {            this.getServices = getServices;        }        protected void doStartDocument(String name, org.xml.sax.Attributes attributes)        {            GetRecordsResponseParser parser = new GetRecordsResponseParser(name, attributes, this.getServices);            setDocumentElement(parser);        }    }    protected static class GetRecordsResponseParser extends ElementParser    {        private GetServices getServices;        private Service currentService = null;        public GetRecordsResponseParser(String name, org.xml.sax.Attributes attributes, GetServices getServices)        {            super(name, attributes);            this.getServices = getServices;        }        protected void doStartElement(String name, org.xml.sax.Attributes attributes)        {            // Skip the "SearchStatus" element.            // Skip the "SearchResults" element.            if (ServiceParser.ELEMENT_NAME.equalsIgnoreCase(name))            {                ServiceParser parser = new ServiceParser(name, attributes);                this.currentService = parser;                setCurrentElement(parser);            }        }        protected void doEndElement(String name)        {            if (ServiceParser.ELEMENT_NAME.equalsIgnoreCase(name))            {                if (this.currentService != null)                {                    this.getServices.addService(this.currentService);                    this.currentService = null;                }            }        }    }    protected static boolean getBooleanValue(AVList avList, String key)    {        Object o = avList.getValue(key);        if (o == null)            return false;        if (o instanceof Boolean)            return (Boolean) o;        String v = AVListImpl.getStringValue(avList, key);        //noinspection SimplifiableIfStatement        if (v == null)            return false;        return Boolean.parseBoolean(v);    }    protected static Date getDateValue(AVList avList, String key)    {        Object o = avList.getValue(key);        if (o == null)            return null;        if (o instanceof Date)            return (Date) o;        Long l = AVListImpl.getLongValue(avList, key);        if (l != null)            return new Date(l);        String v = AVListImpl.getStringValue(avList, key);        if (v == null)            return null;        try        {            return DateFormat.getDateInstance().parse(v);        }        catch (java.text.ParseException e)        {            Logging.logger().log(Level.SEVERE, "Configuration.ConversionError", v);            return null;        }    }    protected static Angle getAngleValue(AVList avList, String key)    {        Object o = avList.getValue(key);        if (o == null)            return null;        if (o instanceof Angle)            return (Angle) o;        Double d = AVListImpl.getDoubleValue(avList, key);        if (d != null)            return Angle.fromDegrees(d);        return null;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -