MultiPoint Class

package javaxt.geospatial.geometry;

//******************************************************************************
//**  MultiPoint Class
//******************************************************************************
/**
 *   Used to represent a MultiPoint Geometry
 *
 ******************************************************************************/

public class MultiPoint extends Points implements Geometry {
    
    
    private String srs = "EPSG:4326";
    
    
  //**************************************************************************
  //** Creates a new instance of MultiPoint
  //**************************************************************************
    
    public MultiPoint(Point[] Points){
        super(Points);
    }
    
    
    public MultiPoint(){
        super();
    }
    
    
  //**************************************************************************
  //** getSRS
  //**************************************************************************
  //** Sets the srs attribute for this Geometry. */
    
    public void setSRS(String srsName){
        if (srsName==null) srs = "";
        else srs = srsName.trim();
    }
    
    
  //**************************************************************************
  //** getSRS
  //**************************************************************************
  //** Returns the srs name of this Geometry. */
    
    public String getSRS(){
        return srs;
    }
    
    
  //**************************************************************************
  //** getName
  //**************************************************************************
  //** Returns the name of this Geometry. */
    
    public String getName(){ 
        return new Geometry.Name(this).toString(); 
    }
    
    
  //**************************************************************************
  //** toGML
  //**************************************************************************
  /**  Used to convert a MultiPoint to GML (xml fragment) */
    
    public String toGML(){
        Point[] Points = super.getArray();
        if (Points==null) return "";
        else{
            
            String srsName = " srsName=\"" + srs + "\"";
            if (srs.length()==0) srsName = "";
            
            StringBuffer Coordinates = new StringBuffer();
            Coordinates.append("<gml:MultiPoint" + srsName + ">");
            for (int i=0; i<Points.length; i++){
                 Point Point = Points[i];
                 Coordinates.append("<gml:pointMember>");
                 Coordinates.append("<gml:Point>");
                 Coordinates.append("<gml:coordinates>");
                 Coordinates.append(Point.toString(","));
                 Coordinates.append("</gml:coordinates>");
                 Coordinates.append("</gml:Point>");
                 Coordinates.append("</gml:pointMember>");
            }

            Coordinates.append("</gml:MultiPoint>");
            return Coordinates.toString().trim();
        }
    }
    
    
    
  //**************************************************************************
  //** toString
  //**************************************************************************
  /** Used to return a Well-known Text (WKT) representation of the points. */
    
    public String toString(){
        Point[] Points = super.getArray();
        if (Points==null || Points.length<=0) return null;
        else{
            return "MULTIPOINT((" + toString(" ", ", ") + "))";
        }
    }

}