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

📄 gmlschematranslator.java

📁 电子地图服务器,搭建自己的地图服务
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
/*
 * Created on Feb 5, 2004
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package org.geoserver.wfs.xml;

import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryCollection;
import com.vividsolutions.jts.geom.LineString;
import com.vividsolutions.jts.geom.MultiLineString;
import com.vividsolutions.jts.geom.MultiPoint;
import com.vividsolutions.jts.geom.MultiPolygon;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.Polygon;
import org.geotools.feature.FeatureCollection;
import java.util.HashSet;
import java.util.Set;


/**
 * XMLSchemaTranslator purpose.
 * <p>
 * This instance of the NameSpaceTranslator should be used with http://www.opengis.net/gml namespace.
 * </p>
 * <p>
 * Instances of this object should always be retrieved through the NameSpaceTranslatorFactory.
 * </p>
 * @see NameSpaceTranslatorFactory
 *
 * @author dzwiers, Refractions Research, Inc.
 * @author $Author: dmzwiers $ (last modification)
 * @version $Id: GMLSchemaTranslator.java 6177 2007-02-19 10:11:27Z aaime $
 */
public class GMLSchemaTranslator extends NameSpaceTranslator {
    private HashSet elements;

    /**
     * XMLSchemaTranslator constructor.
     * <p>
     * Description
     * </p>
     * @param prefix
     */
    public GMLSchemaTranslator(String prefix) {
        super(prefix);
        elements = new HashSet();
        /*elements.add(new PointElement(prefix));
        elements.add(new LineStringElement(prefix));
        elements.add(new LinearRingElement(prefix));
        elements.add(new BoxElement(prefix));
        elements.add(new PolygonElement(prefix));
        elements.add(new GeometryCollectionElement(prefix));
        elements.add(new MultiPointElement(prefix));
        elements.add(new MultiLineStringElement(prefix));
        elements.add(new MultiPolygonElement(prefix));
        elements.add(new CoordElement(prefix));
        elements.add(new CoordinatesElement(prefix));*/
        elements.add(new PointPropertyElement(prefix));
        elements.add(new PolygonPropertyElement(prefix));
        elements.add(new LineStringPropertyElement(prefix));
        elements.add(new MultiPointPropertyElement(prefix));
        elements.add(new MultiLineStringPropertyElement(prefix));
        elements.add(new MultiPolygonPropertyElement(prefix));
        elements.add(new MultiGeometryPropertyElement(prefix));
        elements.add(new NullElement(prefix));
        elements.add(new AbstractFeatureElement(prefix));
        elements.add(new AbstractFeatureCollectionBaseElement(prefix));
        elements.add(new AbstractFeatureCollectionElement(prefix));
        elements.add(new GeometryPropertyElement(prefix));

        /*elements.add(new GeometryPropertyElement(prefix));
        elements.add(new FeatureAssociationElement(prefix));
        elements.add(new BoundingShapeElement(prefix));
        elements.add(new AbstractGeometryElement(prefix));
        elements.add(new AbstractGeometryCollectionBaseElement(prefix));
        elements.add(new AssociationAttributeGroupElement(prefix));
        elements.add(new GeometryAssociationElement(prefix));
        elements.add(new PointMemberElement(prefix));
        elements.add(new LineStringMemberElement(prefix));
        elements.add(new PolygonMemberElement(prefix));
        elements.add(new LinearRingMemberElement(prefix));*/
    }

    /**
     * Implementation of getElements.
     *
     * @see org.vfny.geoserver.global.xml.NameSpaceTranslator#getElements()
     *
     * @return
     */
    public Set getElements() {
        return elements;
    }

    /**
     * Implementation of getNameSpace.
     *
     * @see org.vfny.geoserver.global.xml.NameSpaceTranslator#getNameSpace()
     *
     * @return
     */
    public String getNameSpace() {
        return "http://www.opengis.net/gml";
    }
}


class AbstractFeatureElement extends NameSpaceElement {
    public AbstractFeatureElement(String prefix) {
        super(prefix);
    }

    public String getTypeDefName() {
        return "AbstractFeatureType";
    }

    public String getTypeRefName() {
        return null;
    }

    public String getQualifiedTypeDefName() {
        return prefix + ":AbstractFeatureType";
    }

    public String getQualifiedTypeRefName() {
        return null;
    }

    public String getQualifiedTypeDefName(String prefix) {
        if (prefix != null) {
            return prefix + ":AbstractFeatureType";
        }

        if (this.prefix != null) {
            return this.prefix + ":AbstractFeatureType";
        }

        return null;
    }

    public String getQualifiedTypeRefName(String prefix) {
        return null;
    }

    public Class getJavaClass() {
        return Object.class;
    }

    public boolean isAbstract() {
        return true;
    }
}


class AbstractFeatureCollectionBaseElement extends NameSpaceElement {
    public AbstractFeatureCollectionBaseElement(String prefix) {
        super(prefix);
    }

    public String getTypeDefName() {
        return "AbstractFeatureCollectionBaseType";
    }

    public String getTypeRefName() {
        return null;
    }

    public String getQualifiedTypeDefName() {
        return prefix + ":AbstractFeatureCollectionBaseType";
    }

    public String getQualifiedTypeRefName() {
        return null;
    }

    public String getQualifiedTypeDefName(String prefix) {
        if (prefix != null) {
            return prefix + ":AbstractFeatureCollectionBaseType";
        }

        if (this.prefix != null) {
            return this.prefix + ":AbstractFeatureCollectionBaseType";
        }

        return null;
    }

    public String getQualifiedTypeRefName(String prefix) {
        return null;
    }

    public Class getJavaClass() {
        return FeatureCollection.class;
    }

    public boolean isAbstract() {
        return true;
    }
}


class AbstractFeatureCollectionElement extends NameSpaceElement {
    public AbstractFeatureCollectionElement(String prefix) {
        super(prefix);
    }

    public String getTypeDefName() {
        return "AbstractFeatureCollectionType";
    }

    public String getTypeRefName() {
        return null;
    }

    public String getQualifiedTypeDefName() {
        return prefix + ":AbstractFeatureCollectionType";
    }

    public String getQualifiedTypeRefName() {
        return null;
    }

    public String getQualifiedTypeDefName(String prefix) {
        if (prefix != null) {
            return prefix + ":AbstractFeatureCollectionType";
        }

        if (this.prefix != null) {
            return this.prefix + ":AbstractFeatureCollectionType";
        }

        return null;
    }

    public String getQualifiedTypeRefName(String prefix) {
        return null;
    }

    public Class getJavaClass() {
        return FeatureCollection.class;
    }

    public boolean isAbstract() {
        return true;
    }
}


// I don't think this big chunk of junk is useful, as I don't think you're 
// going to define a schema with it, unless you do something more complicated
// then what we are doing.  We only want the GeometryPropertyType stuff, which
// allows us to name the element as we will.  The rest is only useful if you
// are doing more complex stuff than we allow.  But I will leave this in
// and commented out, in case I am wrong and this junk does have a use.

// I think perhaps it may just need better objects, that can actually use
// these?  Since the geometry objects they are given can't use them.
class GeometryPropertyElement extends NameSpaceElement {
    public GeometryPropertyElement(String prefix) {
        super(prefix);
    }

    public String getTypeDefName() {
        return "GeometryPropertyType";
    }

    public String getTypeRefName() {
        return null;
    }

    public String getQualifiedTypeDefName() {
        return prefix + ":GeometryPropertyType";
    }

    public String getQualifiedTypeRefName() {
        return null;
    }

    public String getQualifiedTypeDefName(String prefix) {
        if (prefix != null) {
            return prefix + ":GeometryPropertyType";
        }

        if (this.prefix != null) {
            return this.prefix + ":GeometryPropertyType";
        }

        return null;
    }

    public String getQualifiedTypeRefName(String prefix) {
        return null;
    }

    public Class getJavaClass() {
        return Geometry.class;
    }

    public boolean isAbstract() {
        return true;
    }
}


/*
class FeatureAssociationElement extends NameSpaceElement{
        public FeatureAssociationElement(String prefix){super(prefix);}
        public String getTypeDefName(){return "FeatureAssociationType";}
        public String getTypeRefName(){return null;}
        public String getQualifiedTypeDefName(){return prefix+":FeatureAssociationType";}
        public String getQualifiedTypeRefName(){return null;}
        public String getQualifiedTypeDefName(String prefix){
                if(prefix!=null)
                        return prefix+":FeatureAssociationType";
                if(this.prefix!=null)
                        return this.prefix+":FeatureAssociationType";
                return null;
        }
        public String getQualifiedTypeRefName(String prefix){return null;}
        public Class getJavaClass(){return Feature.class;}
        public boolean isAbstract(){return true;}
}

class BoundingShapeElement extends NameSpaceElement{
        public BoundingShapeElement(String prefix){super(prefix);}
        public String getTypeDefName(){return "BoundingShapeType";}
        public String getTypeRefName(){return null;}
        public String getQualifiedTypeDefName(){return prefix+":BoundingShapeType";}
        public String getQualifiedTypeRefName(){return null;}
        public String getQualifiedTypeDefName(String prefix){
                if(prefix!=null)
                        return prefix+":BoundingShapeType";
                if(this.prefix!=null)
                        return this.prefix+":BoundingShapeType";
                return null;
        }
        public String getQualifiedTypeRefName(String prefix){return null;}
        public Class getJavaClass(){return Filter.class;}
        public boolean isAbstract(){return false;}
}

class AbstractGeometryElement extends NameSpaceElement{
        public AbstractGeometryElement(String prefix){super(prefix);}
        public String getTypeDefName(){return "AbstractGeometryType";}
        public String getTypeRefName(){return null;}
        public String getQualifiedTypeDefName(){return prefix+":AbstractGeometryType";}
        public String getQualifiedTypeRefName(){return null;}
        public String getQualifiedTypeDefName(String prefix){
                if(prefix!=null)
                        return prefix+":AbstractGeometryType";
                if(this.prefix!=null)
                        return this.prefix+":AbstractGeometryType";
                return null;
        }
        public String getQualifiedTypeRefName(String prefix){return null;}
        public Class getJavaClass(){return Geometry.class;}
        public boolean isAbstract(){return true;}
}

class AbstractGeometryCollectionBaseElement extends NameSpaceElement{
        public AbstractGeometryCollectionBaseElement(String prefix){super(prefix);}
        public String getTypeDefName(){return "AbstractGeometryCollectionBase";}
        public String getTypeRefName(){return null;}
        public String getQualifiedTypeDefName(){return prefix+":AbstractGeometryCollectionBase";}
        public String getQualifiedTypeRefName(){return null;}
        public String getQualifiedTypeDefName(String prefix){
                if(prefix!=null)
                        return prefix+":AbstractGeometryCollectionBase";
                if(this.prefix!=null)
                        return this.prefix+":AbstractGeometryCollectionBase";
                return null;
        }
        public String getQualifiedTypeRefName(String prefix){return null;}
        public Class getJavaClass(){return GeometryCollection.class;}
        public boolean isAbstract(){return true;}
}

class AssociationAttributeGroupElement extends NameSpaceElement{
        public AssociationAttributeGroupElement(String prefix){super(prefix);}
        public String getTypeDefName(){return "AssociationAttributeGroup";}
        public String getTypeRefName(){return null;}
        public String getQualifiedTypeDefName(){return prefix+":AssociationAttributeGroup";}
        public String getQualifiedTypeRefName(){return null;}
        public String getQualifiedTypeDefName(String prefix){
                if(prefix!=null)
                        return prefix+":AssociationAttributeGroup";
                if(this.prefix!=null)
                        return this.prefix+":AssociationAttributeGroup";
                return null;
        }
        public String getQualifiedTypeRefName(String prefix){return null;}
        public Class getJavaClass(){return Collection.class;}
        public boolean isAbstract(){return true;}
}

class GeometryAssociationElement extends NameSpaceElement{
        public GeometryAssociationElement(String prefix){super(prefix);}
        public String getTypeDefName(){return "GeometryAssociationType";}
        public String getTypeRefName(){return null;}
        public String getQualifiedTypeDefName(){return prefix+":GeometryAssociationType";}
        public String getQualifiedTypeRefName(){return null;}
        public String getQualifiedTypeDefName(String prefix){
                if(prefix!=null)
                        return prefix+":GeometryAssociationType";

⌨️ 快捷键说明

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