Beispiel #1
0
    public List<String> createXMLLines() {
      PsrxmlCoordinate coord = null;
      if (tagname.equals("StartCoordinate")) {
        coord = psrxml.getStartCoordinate();
      } else if (tagname.equals("EndCoordinate")) {
        coord = psrxml.getEndCoordinate();
      } else if (tagname.equals("RequestedCoordinate")) {
        coord = psrxml.getRequestedCoordinate();
      }

      ArrayList<String> out = new ArrayList<String>();
      if (coord != null) {
        out.add("<" + XMLWriter.mangleName(tagname) + ">");
        out.add("\t<coordinate>");
        out.add("\t\t<ra units='degrees'>" + coord.getRA().toDegrees() + "</ra>");
        out.add("\t\t<dec units='degrees'>" + coord.getDec().toDegrees() + "</dec>");
        if (coord.getEpoch() != null) {
          out.add("\t\t<position_epoch>" + coord.getEpoch() + "</position_epoch>");
        }
        if (!Double.isNaN(coord.getError())) {
          out.add("\t\t<position_error>" + coord.getError() + "</position_error>");
        }
        out.add("\t\t<friendly_eq>" + coord.toString(false) + "</friendly_eq>");

        out.add("\t\t<friendly_gal>" + coord.toString(true) + "</friendly_gal>");

        out.add("\t</coordinate>");
        out.add("</" + XMLWriter.mangleName(tagname) + ">");
      }
      return out;
    }
Beispiel #2
0
 public void endTag(String localname, StringBuffer content) throws SAXException {
   Map<String, String> attributes = attr.get(localname);
   if (localname.equals("ra")) {
     this.ra = StringConvertable.ANGLE.fromString(content.toString(), attributes);
   } else if (localname.equals("dec")) {
     this.dec = StringConvertable.ANGLE.fromString(content.toString(), attributes);
   } else if (localname.equals("position_epoch")) {
     this.epoch = StringConvertable.STRING.fromString(content.toString(), attributes);
   } else if (localname.equals("possition_error")) {
     this.error = StringConvertable.DOUBLE.fromString(content.toString(), attributes);
   } else if (localname.equals("start_coordinate")) {
     PsrxmlCoordinate coord = new PsrxmlCoordinate(new RA(ra), new Dec(dec));
     coord.setEpoch(epoch);
     coord.setError(error);
     psrxml.setStartCoordinate(coord);
   } else if (localname.equals("end_coordinate")) {
     PsrxmlCoordinate coord = new PsrxmlCoordinate(new RA(ra), new Dec(dec));
     coord.setEpoch(epoch);
     coord.setError(error);
     psrxml.setEndCoordinate(coord);
   } else if (localname.equals("requested_coordinate")) {
     PsrxmlCoordinate coord = new PsrxmlCoordinate(new RA(ra), new Dec(dec));
     coord.setEpoch(epoch);
     coord.setError(error);
     psrxml.setRequestedCoordinate(requestedCoordinate);
   }
 }