Package org.geowebcache.io

Examples of org.geowebcache.io.XMLBuilder$NodeInfo


        }
    }

    private String generateGetCapabilities(Charset encoding) {
        StringBuilder str = new StringBuilder();
        XMLBuilder xml = new XMLBuilder(str);
       
        try {
            xml.header("1.0", encoding);
            xml.indentElement("Capabilities");
            xml.attribute("xmlns", "http://www.opengis.net/wmts/1.0");
            xml.attribute("xmlns:ows", "http://www.opengis.net/ows/1.1");
            xml.attribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
            xml.attribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
            xml.attribute("xmlns:gml", "http://www.opengis.net/gml");
            xml.attribute("xsi:schemaLocation", "http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd");
            xml.attribute("version", "1.0.0");
            // There were some contradictions in the draft schema, haven't checked whether they've fixed those
            //str.append("xsi:schemaLocation=\"http://www.opengis.net/wmts/1.0 http://geowebcache.org/schema/opengis/wmts/1.0.0/wmtsGetCapabilities_response.xsd\"\n");
           
            serviceIdentification(xml);
            serviceProvider(xml);
            operationsMetadata(xml);
            contents(xml);
            xml.indentElement("ServiceMetadataURL")
                .attribute("xlink:href", baseUrl+"?REQUEST=getcapabilities&VERSION=1.0.0")
                .endElement();
           
            xml.endElement("Capabilities");
           
            return str.toString();
        } catch (IOException e) {
            // Should not happen as StringBuilder doesn't throw
            throw new IllegalStateException(e);
View Full Code Here


        this.encoding = encoding;
    }
   
    protected String getTileMapServiceDoc() {
        StringBuilder str = new StringBuilder();
        XMLBuilder xml = new XMLBuilder(str);
        try {
            xml.header("1.0", encoding);
            xml.indentElement("TileMapService")
            .attribute("version", "1.0.0")
            .attribute("services", urlMangler.buildURL(baseUrl, contextPath, ""));
            // TODO can have these set through Spring
            xml.simpleElement("Title", "Tile Map Service", true);
            xml.simpleElement("Abstract", "A Tile Map Service served by GeoWebCache", true);
            //TODO Optional stuff, note that there is some meta data stuff on the
            // TileLayer object that we simply don't use yet
           
            // <KeywordList>example tile service</KeywordList>
            // <ContactInformation>
            //   <ContactPersonPrimary>
            //     <ContactPerson>Paul Ramsey</ContactPerson>
            //     <ContactOrganization>Refractions Research</ContactOrganization>
            //   </ContactPersonPrimary>
            //   <ContactPosition>Manager</ContactPosition>
            //   <ContactAddress>
            //     <AddressType>postal</AddressType>
            //     <Address>300 - 1207 Douglas Street</Address>
            //     <City>Victoria</City>
            //     <StateOrProvince>British Columbia</StateOrProvince>
            //     <PostCode>V8W2E7</PostCode>
            //     <Country>Canada</Country>
            //   </ContactAddress>
            //   <ContactVoiceTelephone>12503833022</ContactVoiceTelephone>
            //   <ContactFacsimileTelephone>12503832140</ContactFacsimileTelephone>
            //   <ContactElectronicMailAddress>pramsey@refractions.net</ContactElectronicMailAddress>
            // </ContactInformation>
            xml.indentElement("TileMaps");
            Iterable<TileLayer> iter = tld.getLayerList();
            for (TileLayer layer : iter) {
                if(!layer.isEnabled()){
                    continue;
                }
                tileMapsForLayer(xml, layer);
            }
            xml.endElement();
            xml.endElement();
           
            return str.toString();
        } catch (IOException ex) {
            // Should not happen
            throw new IllegalStateException(ex);
View Full Code Here

        }
    }
   
    protected String getTileMapDoc(TileLayer layer, GridSubset gridSub, GridSetBroker gsb, MimeType mimeType) {
        StringBuilder str = new StringBuilder();
        XMLBuilder xml = new XMLBuilder(str);
        try {
            xml.header("1.0", encoding);
            xml.indentElement("TileMap")
            .attribute("version", "1.0.0")
            .attribute("tilemapservice", urlMangler.buildURL(baseUrl, contextPath, "/service/tms/1.0.0"));
            xml.simpleElement("Title", tileMapTitle(layer), true);
            xml.simpleElement("Abstract", tileMapDescription(layer), true);
           
            // <KeywordList></KeywordList>
           // <Metadata type="TC211" mime-type="text/xml" href="http://www.org" />
           // <Attribution>
           //   <Title>National Geospatial Intelligence Agency</Title>
           //   <Logo width="10" height="10" href="http://nga.mil/logo.gif" mime-type="image/gif" />
           // </Attribution>
           // <WebMapContext href="http://wms.org" />
           // <Face>0</Face>
           
            // Check with tschaub whether we actually have to provide this as OSGEO:40041
            // No.
            xml.simpleElement("SRS", gridSub.getSRS().toString(), true);
            double[] coords = gridSub.getCoverageBestFitBounds().getCoords();
            xml.boundingBox(null, coords[0], coords[1], coords[2], coords[3]);
            xml.indentElement("Origin")
                .attribute("x", Double.toString(coords[0]))
                .attribute("y", Double.toString(coords[1]))
                .endElement();
            // Can we have multiple formats? NO
            xml.indentElement("TileFormat")
                .attribute("width", Integer.toString(gridSub.getTileWidth()))
                .attribute("height", Integer.toString(gridSub.getTileHeight()))
                .attribute("mime-type", mimeType.getMimeType())
                .attribute("extension", mimeType.getFileExtension())
                .endElement();
            xml.indentElement("TileSets")
                .attribute("profile", profileForGridSet(gridSub.getGridSet()));
            double[] resolutions = gridSub.getResolutions();
            int resIdx = 0;
          
            for(int zoom = gridSub.getZoomStart(); zoom <= gridSub.getZoomStop(); zoom++) {
                xml.indentElement("TileSet");
                xml.attribute("href", tileMapUrl(layer, gridSub, mimeType, zoom));
                xml.attribute("units-per-pixel", Double.toString(resolutions[resIdx]));
                xml.attribute("order", Integer.toString(resIdx));
                xml.endElement();;
                resIdx++;
            }
           
            xml.endElement();
            xml.endElement();
           
            return str.toString();
        } catch (IOException ex) {
            // Should not happen
            throw new IllegalStateException(ex);
View Full Code Here

        }
    }

    String generateGetCapabilities(Charset encoding) {
        StringBuilder str = new StringBuilder();
        XMLBuilder xml = new XMLBuilder(str);
       
        try {
            xml.header("1.0", encoding);
            xml.appendUnescaped("<!DOCTYPE WMT_MS_Capabilities SYSTEM \"http://schemas.opengis.net/wms/1.1.1/capabilities_1_1_1.dtd\" ");
            if (includeVendorSpecific) {
                xml.appendUnescaped("[\n");
                xml.appendUnescaped("<!ELEMENT VendorSpecificCapabilities (TileSet*) >\n");
                xml.appendUnescaped("<!ELEMENT TileSet (SRS, BoundingBox?, Resolutions, Width, Height, Format, Layers*, Styles*) >\n");
                xml.appendUnescaped("<!ELEMENT Resolutions (#PCDATA) >\n");
                xml.appendUnescaped("<!ELEMENT Width (#PCDATA) >\n");
                xml.appendUnescaped("<!ELEMENT Height (#PCDATA) >\n");
                xml.appendUnescaped("<!ELEMENT Layers (#PCDATA) >\n");
                xml.appendUnescaped("<!ELEMENT Styles (#PCDATA) >\n");
                xml.appendUnescaped("]");
            }
            xml.appendUnescaped(">\n");
            xml.indentElement("WMT_MS_Capabilities").attribute("version", "1.1.1");
   
            // The actual meat
            service(xml);
            capability(xml);
            xml.endElement();
        } catch (IOException e) {
            // Should not happen as StringBuilder doesn't throw IOException
            throw new IllegalStateException(e);
        }

View Full Code Here

TOP

Related Classes of org.geowebcache.io.XMLBuilder$NodeInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.