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

📄 wcscapstransformer.java

📁 电子地图服务器,搭建自己的地图服务
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        /**
         * DOCUMENT ME!
         *
         * @param kwords
         *            DOCUMENT ME!
         *
         * @throws SAXException
         *             DOCUMENT ME!
         */
        private void handleKeywords(List kwords) {
            start("keywords");

            if (kwords != null) {
                for (Iterator it = kwords.iterator(); it.hasNext();) {
                    element("keyword", it.next().toString());
                }
            }

            end("keywords");
        }

        /**
         * Handles contacts.
         *
         * @param config
         *            the service.
         */
        private void handleContact(Service config) {
            String tmp = "";

            if (((config.getGeoServer().getContactPerson() != null)
                    && (config.getGeoServer().getContactPerson() != ""))
                    || ((config.getGeoServer().getContactOrganization() != null)
                    && (config.getGeoServer().getContactOrganization() != ""))) {
                start("responsibleParty");

                tmp = config.getGeoServer().getContactPerson();

                if ((tmp != null) && (tmp != "")) {
                    element("individualName", tmp);

                    tmp = config.getGeoServer().getContactOrganization();

                    if ((tmp != null) && (tmp != "")) {
                        element("organisationName", tmp);
                    }
                } else {
                    tmp = config.getGeoServer().getContactOrganization();

                    if ((tmp != null) && (tmp != "")) {
                        element("organisationName", tmp);
                    }
                }

                tmp = config.getGeoServer().getContactPosition();

                if ((tmp != null) && (tmp != "")) {
                    element("positionName", tmp);
                }

                start("contactInfo");

                start("phone");
                tmp = config.getGeoServer().getContactVoice();

                if ((tmp != null) && (tmp != "")) {
                    element("voice", tmp);
                }

                tmp = config.getGeoServer().getContactFacsimile();

                if ((tmp != null) && (tmp != "")) {
                    element("facsimile", tmp);
                }

                end("phone");

                start("address");
                tmp = config.getGeoServer().getAddressType();

                if ((tmp != null) && (tmp != "")) {
                    String addr = "";
                    addr = config.getGeoServer().getAddress();

                    if ((addr != null) && (addr != "")) {
                        element("deliveryPoint", tmp + " " + addr);
                    }
                } else {
                    tmp = config.getGeoServer().getAddress();

                    if ((tmp != null) && (tmp != "")) {
                        element("deliveryPoint", tmp);
                    }
                }

                tmp = config.getGeoServer().getAddressCity();

                if ((tmp != null) && (tmp != "")) {
                    element("city", tmp);
                }

                tmp = config.getGeoServer().getAddressState();

                if ((tmp != null) && (tmp != "")) {
                    element("administrativeArea", tmp);
                }

                tmp = config.getGeoServer().getAddressPostalCode();

                if ((tmp != null) && (tmp != "")) {
                    element("postalCode", tmp);
                }

                tmp = config.getGeoServer().getAddressCountry();

                if ((tmp != null) && (tmp != "")) {
                    element("country", tmp);
                }

                tmp = config.getGeoServer().getContactEmail();

                if ((tmp != null) && (tmp != "")) {
                    element("electronicMailAddress", tmp);
                }

                end("address");

                tmp = config.getGeoServer().getOnlineResource();

                if ((tmp != null) && (tmp != "")) {
                    AttributesImpl attributes = new AttributesImpl();
                    attributes.addAttribute("", "xlink:href", "xlink:href", "", tmp);
                    start("onlineResource", attributes);
                    end("onlineResource");
                }

                end("contactInfo");

                end("responsibleParty");
            }
        }

        /**
         * Handles the printing of the exceptions information, prints the
         * formats that GeoServer can return exceptions in.
         *
         * @param config
         *            The wms service global config.
         *
         * @throws SAXException
         *             For any problems.
         */
        private void handleExceptions(WCS config) {
            start("Exception");

            final String[] formats = config.getExceptionFormats();
            final int length = formats.length;

            for (int i = 0; i < length; i++) {
                element("Format", formats[i]);
            }

            end("Exception");
        }

        /**
         * Handles the vendor specific capabilities. Right now there are none,
         * so we do nothing.
         *
         * @param config
         *            The global config that may contain vendor specifics.
         *
         * @throws SAXException
         *             For any problems.
         */
        private void handleVendorSpecifics(WCS config) {
        }

        private void handleEnvelope(GeneralEnvelope envelope) {
            AttributesImpl attributes = new AttributesImpl();

            attributes.addAttribute("", "srsName", "srsName", "", /*"urn:ogc:def:crs:OGC:1.3:CRS84"*/
                "WGS84(DD)");
            start("lonLatEnvelope", attributes);
            element("gml:pos",
                new StringBuffer(Double.toString(envelope.getLowerCorner().getOrdinate(0))).append(
                    " ").append(envelope.getLowerCorner().getOrdinate(1)).toString());
            element("gml:pos",
                new StringBuffer(Double.toString(envelope.getUpperCorner().getOrdinate(0))).append(
                    " ").append(envelope.getUpperCorner().getOrdinate(1)).toString());
            end("lonLatEnvelope");
        }

        /**
         * DOCUMENT ME!
         *
         * @param metadataLink
         *            DOCUMENT ME!
         *
         * @throws SAXException
         *             DOCUMENT ME!
         */
        private void handleMetadataLink(MetaDataLink mdl) {
            if (mdl != null) {
                AttributesImpl attributes = new AttributesImpl();

                if ((mdl.getAbout() != null) && (mdl.getAbout() != "")) {
                    attributes.addAttribute("", "about", "about", "", mdl.getAbout());
                }

                // if( mdl.getType() != null && mdl.getType() != "" ) {
                // attributes.addAttribute("", "type", "type", "",
                // mdl.getType());
                // }
                if ((mdl.getMetadataType() != null) && (mdl.getMetadataType() != "")) {
                    attributes.addAttribute("", "metadataType", "metadataType", "",
                        mdl.getMetadataType());
                }

                if (attributes.getLength() > 0) {
                    start("metadataLink", attributes);
                    // characters(mdl.getContent());
                    end("metadataLink");
                }
            }
        }

        private void handleContentMetadata(WCS config) {
            AttributesImpl attributes = new AttributesImpl();
            attributes.addAttribute("", "version", "version", "", CUR_VERSION);

            start("ContentMetadata", attributes);

            List coverages = new ArrayList(config.getData().getCoverageInfos().values());
            Collections.sort(coverages, new CoverageInfoLabelComparator());
            for (Iterator i = coverages.iterator(); i.hasNext();) {
                handleCoverageOfferingBrief(config,
                    (CoverageInfo) i.next());
            }

            end("ContentMetadata");
        }

        private void handleCoverageOfferingBrief(WCS config, CoverageInfo cv) {
            if (cv.isEnabled()) {
                start("CoverageOfferingBrief");

                String tmp;

                handleMetadataLink(cv.getMetadataLink());
                tmp = cv.getDescription();

                if ((tmp != null) && (tmp != "")) {
                    element("description", tmp);
                }

                tmp = cv.getName();

                if ((tmp != null) && (tmp != "")) {
                    element("name", tmp);
                }

                tmp = cv.getLabel();

                if ((tmp != null) && (tmp != "")) {
                    element("label", tmp);
                }

                handleEnvelope(cv.getWGS84LonLatEnvelope());
                handleKeywords(cv.getKeywords());

                end("CoverageOfferingBrief");
            }
        }
    }
}

⌨️ 快捷键说明

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