tds/src/main/java/thredds/server/wfs/GMLFeatureWriter.java
private String writePolygon(Polygon poly) {

        String xml = "";
        xml += "<gml:Polygon>";

        Polygon polygon = poly;
        
    //    while (polygon != null) {

            if (!polygon.getInteriorRing()) {
                xml += "<gml:exterior><gml:LinearRing><gml:posList>";

                for (Point point : polygon.getPoints()) {
                    xml += point.getX() + " " + point.getY() + " ";
                }

                xml += "</gml:posList></gml:LinearRing></gml:exterior>";

            }

            else {
                xml += "<gml:interior><gml:LinearRing><gml:posList>";

                for (Point point : polygon.getPoints()) {
                    xml += point.getX() + " " + point.getY() + " ";
                }

                xml += "</gml:posList></gml:LinearRing></gml:interior>";
            }

      //      polygon = polygon.getNext();
       // }

        xml += "</gml:Polygon>";
        return xml;
    }
private String writePolygon(Polygon poly) {

        String xml = "";
        xml += "<gml:Polygon>";

        Polygon polygon = poly;
        
    //    while (polygon != null) {

            if (!polygon.getInteriorRing()) {
                xml += "<gml:exterior><gml:LinearRing><gml:posList>";

                for (Point point : polygon.getPoints()) {
                    xml += point.getX() + " " + point.getY() + " ";
                }

                xml += "</gml:posList></gml:LinearRing></gml:exterior>";

            }

            else {
                xml += "<gml:interior><gml:LinearRing><gml:posList>";

                for (Point point : polygon.getPoints()) {
                    xml += point.getX() + " " + point.getY() + " ";
                }

                xml += "</gml:posList></gml:LinearRing></gml:interior>";
            }

      //      polygon = polygon.getNext();
       // }

        xml += "</gml:Polygon>";
        return xml;
    }
private String writePolygon ( Polygon poly ) { String xml = "" ; xml += "<gml:Polygon>" ; Polygon polygon = poly ; //    while (polygon != null) {
 if ( ! polygon . getInteriorRing ( ) ) { xml += "<gml:exterior><gml:LinearRing><gml:posList>" ; for ( Point point : polygon . getPoints ( ) ) { xml += point . getX ( ) + " " + point . getY ( ) + " " ; } xml += "</gml:posList></gml:LinearRing></gml:exterior>" ; } else { xml += "<gml:interior><gml:LinearRing><gml:posList>" ; for ( Point point : polygon . getPoints ( ) ) { xml += point . getX ( ) + " " + point . getY ( ) + " " ; } xml += "</gml:posList></gml:LinearRing></gml:interior>" ; } //      polygon = polygon.getNext();
 // }
 xml += "</gml:Polygon>" ; return xml ; }
Takes in a polygon, checks whether it is an interior or exterior ring, and writes the corresponding xml.
Iterates through all linked polygons

@param polygon the polygon
@return the xml
Takes in a polygon checks whether it is an interior or exterior ring and writes the corresponding xml . Iterates through all linked polygons