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

📄 capabilitiestransformer.java

📁 电子地图服务器,搭建自己的地图服务
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                 *                        the URL form defined in subclause 4.3.2 of
                 *                        refernce[2].
                 *                     </xsd:documentation>
                 *                  </xsd:annotation>
                 *               </xsd:element>
                 *               <xsd:element name="OtherSRS"
                 *                            type="xsd:anyURI"
                 *                            minOccurs="0" maxOccurs="unbounded">
                 *                  <xsd:annotation>
                 *                     <xsd:documentation>
                 *                        The OtherSRS element is used to indicate other
                 *                        supported SRSs within query and transaction
                 *                        operations.  A supported SRS means that the
                 *                        WFS supports the transformation of spatial
                 *                        properties between the OtherSRS and the internal
                 *                        storage SRS.  The effects of such transformations
                 *                        must be considered when determining and declaring
                 *                        the guaranteed data accuracy.
                 *                     </xsd:documentation>
                 *                  </xsd:annotation>
                 *               </xsd:element>
                 *            </xsd:sequence>
                 *            <xsd:element name="NoSRS">
                 *              <xsd:complexType/>
                 *            </xsd:element>
                 *         </xsd:choice>
                 *         <xsd:element name="Operations"
                 *                      type="wfs:OperationsType"
                 *                      minOccurs="0"/>
                 *         <xsd:element name="OutputFormats"
                 *                      type="wfs:OutputFormatListType"
                 *                      minOccurs="0"/>
                 *         <xsd:element ref="ows:WGS84BoundingBox"
                 *                      minOccurs="1" maxOccurs="unbounded"/>
                 *         <xsd:element name="MetadataURL"
                 *                      type="wfs:MetadataURLType"
                 *                      minOccurs="0" maxOccurs="unbounded"/>
                 *      </xsd:sequence>
                 *   </xsd:complexType>
                 *         </pre>
                 * </p>
                 * @param featureType
                 */
            void featureType(FeatureTypeInfo featureType) {
                String prefix = featureType.getNameSpace().getPrefix();
                String uri = featureType.getNameSpace().getURI();

                start("FeatureType", attributes(new String[] { "xmlns:" + prefix, uri }));

                element("Name", featureType.getName());
                element("Title", featureType.getTitle());
                element("Abstract", featureType.getAbstract());
                keywords(featureType.getKeywords());

                //default srs
                element("DefaultSRS", "urn:x-ogc:def:crs:EPSG:6.11.2:" + featureType.getSRS());

                //TODO: other srs's
                start("OutputFormats");

                Collection featureProducers = GeoServerExtensions.extensions(WFSGetFeatureOutputFormat.class);
                for (Iterator i = featureProducers.iterator(); i.hasNext();) {
                    WFSGetFeatureOutputFormat format = (WFSGetFeatureOutputFormat) i.next();
                    for ( Iterator f = format.getOutputFormats().iterator(); f.hasNext(); ) {
                        element( "Format", f.next().toString() );
                    }
                }
                    
                end("OutputFormats");

                Envelope bbox = null;

                try {
                    bbox = featureType.getLatLongBoundingBox();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }

                start("ows:WGS84BoundingBox");

                element("ows:LowerCorner", bbox.getMinX() + " " + bbox.getMinY());
                element("ows:UpperCorner", bbox.getMaxX() + " " + bbox.getMaxY());

                end("ows:WGS84BoundingBox");

                end("FeatureType");
            }

            /**
                 * Encodes the wfs:SupportsGMLObjectTypeList element.
                 *        <p>
                 *        <pre>
                 *&lt;xsd:complexType name="GMLObjectTypeListType"&gt;
                 *        &lt;xsd:sequence&gt;
                 *             &lt;xsd:element name="GMLObjectType" type="wfs:GMLObjectTypeType"
                 *               maxOccurs="unbounded"&gt;
                 *                &lt;xsd:annotation&gt;
                 *                   &lt;xsd:documentation&gt;
                 *                      Name of this GML object type, including any namespace prefix
                 *                   &lt;/xsd:documentation&gt;
                 *                &lt;/xsd:annotation&gt;
                 *             &lt;/xsd:element&gt;
                 *          &lt;/xsd:sequence&gt;
                 * &lt;/xsd:complexType&gt;
                 *        </pre>
                 *        </p>
                 */
            void supportsGMLObjectTypeList() {
                element("SupportsGMLObjectTypeList", null);
            }

            /**
                 * Encodes the ogc:Filter_Capabilities element.
                 * <p>
                 * <pre>
                 * *&lt;xsd:element name="Filter_Capabilities"&gt;
                 *      &lt;xsd:complexType&gt;
                 *         &lt;xsd:sequence&gt;
                 *            &lt;xsd:element name="Spatial_Capabilities"
                 *                         type="ogc:Spatial_CapabilitiesType"/&gt;
                 *            &lt;xsd:element name="Scalar_Capabilities"
                 *                         type="ogc:Scalar_CapabilitiesType"/&gt;
                 *            &lt;xsd:element name="Id_Capabilities"
                 *                         type="ogc:Id_CapabilitiesType"/&gt;
                 *         &lt;/xsd:sequence&gt;
                 *      &lt;/xsd:complexType&gt;
                 *   &lt;/xsd:element&gt;
                 * </pre>
                 * </p>
                 *
                 */
            void filterCapabilities() {
                start("ogc:Filter_Capabilities");

                start("ogc:Spatial_Capabilities");

                start("ogc:GeometryOperands");
                element("ogc:GeometryOperand", "gml:Envelope");
                element("ogc:GeometryOperand", "gml:Point");
                element("ogc:GeometryOperand", "gml:LineString");
                element("ogc:GeometryOperand", "gml:Polygon");
                end("ogc:GeometryOperands");

                start("ogc:SpatialOperators");
                element("ogc:SpatialOperator", null, attributes(new String[] { "name", "Disjoint" }));
                element("ogc:SpatialOperator", null, attributes(new String[] { "name", "Equals" }));
                element("ogc:SpatialOperator", null, attributes(new String[] { "name", "DWithin" }));
                element("ogc:SpatialOperator", null, attributes(new String[] { "name", "Beyond" }));
                element("ogc:SpatialOperator", null,
                    attributes(new String[] { "name", "Intersects" }));
                element("ogc:SpatialOperator", null, attributes(new String[] { "name", "Touches" }));
                element("ogc:SpatialOperator", null, attributes(new String[] { "name", "Crosses" }));
                element("ogc:SpatialOperator", null, attributes(new String[] { "name", "Contains" }));
                element("ogc:SpatialOperator", null, attributes(new String[] { "name", "Overlaps" }));
                element("ogc:SpatialOperator", null, attributes(new String[] { "name", "BBOX" }));
                end("ogc:SpatialOperators");

                end("ogc:Spatial_Capabilities");

                start("ogc:Scalar_Capabilities");

                element("ogc:LogicalOperators", null);

                start("ogc:ComparisonOperators");
                element("ogc:ComparisonOperator", "LessThan");
                element("ogc:ComparisonOperator", "GreaterThan");
                element("ogc:ComparisonOperator", "LessThanEqualTo");
                element("ogc:ComparisonOperator", "GreaterThanEqualTo");
                element("ogc:ComparisonOperator", "EqualTo");
                element("ogc:ComparisonOperator", "NotEqualTo");
                element("ogc:ComparisonOperator", "Like");
                element("ogc:ComparisonOperator", "Between");
                element("ogc:ComparisonOperator", "NullCheck");
                end("ogc:ComparisonOperators");

                start("ogc:ArithmeticOperators");
                element("ogc:SimpleArithmetic", null);

                functions();

                end("ogc:ArithmeticOperators");

                end("ogc:Scalar_Capabilities");

                start("ogc:Id_Capabilities");
                element("ogc:FID", null);
                element("ogc:EID", null);
                end("ogc:Id_Capabilities");

                end("ogc:Filter_Capabilities");
            }

            void functions() {
                start("ogc:Functions");

                Iterator itr = FactoryRegistry.lookupProviders(Function.class);

                if (itr.hasNext()) {
                    start("ogc:FunctionNames");

                    SortedSet sortedFunctions = new TreeSet(new Comparator() {
                                public int compare(Object o1, Object o2) {
                                    String n1 = ((Function) o1).getName();
                                    String n2 = ((Function) o2).getName();

                                    return n1.toLowerCase().compareTo(n2.toLowerCase());
                                }
                            });

                    while (itr.hasNext()) {
                        sortedFunctions.add(itr.next());
                    }

                    //write them now that functions are sorted by name
                    itr = sortedFunctions.iterator();

                    while (itr.hasNext()) {
                        Function fe = (Function) itr.next();
                        String name = fe.getName();
                        int nargs = fe.getParameters().size();

                        element("ogc:FunctionName", name,
                            attributes(new String[] { "nArgs", "" + nargs }));
                    }

                    end("ogc:FunctionNames");
                }

                end("ogc:Functions");
            }

            /**
                 * Encodes the ows:Keywords element.
                 * <p>
                 * <pre>
                 * &lt;complexType name="KeywordsType"&gt;
                 *     &lt;annotation&gt;
                 *          &lt;documentation&gt;Unordered list of one or more commonly used or formalised word(s) or phrase(s) used to describe the subject. When needed, the optional "type" can name the type of the associated list of keywords that shall all have the same type. Also when needed, the codeSpace attribute of that "type" can reference the type name authority and/or thesaurus. &lt;/documentation&gt;
                 *          &lt;documentation&gt;For OWS use, the optional thesaurusName element was omitted as being complex information that could be referenced by the codeSpace attribute of the Type element. &lt;/documentation&gt;
                 *     &lt;/annotation&gt;
                 *     &lt;sequence&gt;
                 *          &lt;element name="Keyword" type="string" maxOccurs="unbounded"/&gt;
                 *          &lt;element name="Type" type="ows:CodeType" minOccurs="0"/&gt;
                 *     &lt;/sequence&gt;
                 * &lt;/complexType&gt;
                 * </pre>
                 * </p>
                 * @param keywords
                 */
            void keywords(String[] keywords) {
                if ((keywords == null) || (keywords.length == 0)) {
                    return;
                }

                start("ows:Keywords");

                for (int i = 0; i < keywords.length; i++) {
                    element("ows:Keyword", keywords[i]);
                }

                end("ows:Keywords");
            }

            void keywords(List keywords) {
                keywords((String[]) keywords.toArray(new String[keywords.size()]));
            }

            /**
                 * Encodes the ows:Operation element.
                 * <p>
                 * <pre>
                 * &lt;complexType&gt;
                 *      &lt;sequence&gt;
                 *        &lt;element ref="ows:DCP" maxOccurs="unbounded"&gt;
                 *          &lt;annotation&gt;
                 *            &lt;documentation&gt;Unordered list of Distributed Computing Platforms (DCPs) supported for this operation. At present, only the HTTP DCP is defined, so this element will appear only once. &lt;/documentation&gt;
                 *          &lt;/annotation&gt;
                 *        &lt;/element&gt;
                 *        &lt;element name="Parameter" type="ows:DomainType" minOccurs="0" maxOccurs="unbounded"&gt;
                 *          &lt;annotation&gt;
                 *            &lt;documentation&gt;Optional unordered list of parameter domains that each apply to this operation which this server implements. If one of these Parameter elements has the same "name" attribute as a Parameter element in the OperationsMetadata element, this Parameter element shall override the other one for this operation. The list of required and optional parameter domain limitations for this operation shall be specified in the Implementation Specification for this service. &lt;/documentation&gt;
                 *          &lt;/annotation&gt;
                 *        &lt;/element&gt;
                 *        &lt;element name="Constraint" type="ows:DomainType" minOccurs="0" maxOccurs="unbounded"&gt;
                 *  

⌨️ 快捷键说明

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