Package cds.moc

Class SMoc

All Implemented Interfaces:
Cloneable, Comparable<Moc>, Iterable<MocCell>
Direct Known Subclasses:
HealpixMoc

public class SMoc extends Moc1D
The SMoc class implements the methods specific to spatial MOCs. It is based on the HEALpix tesselation of the sphere. See: IVOA MOC 2.0 standard => https://www.ivoa.net/documents/MOC/
  • Field Details

  • Constructor Details

  • Method Details

    • maxOrder

      public final int maxOrder()
      Return the deepest possible order (ex: 29 for SMoc, 61 for TMoc)
      Specified by:
      maxOrder in class Moc1D
    • shiftOrder

      public final int shiftOrder()
      Return the number of bit shifting between two consecutive orders (ex: 2 for SMoc, 1 for TMoc)
      Specified by:
      shiftOrder in class Moc1D
    • cDim

      public final char cDim()
      Return the Moc signature character (ex: 's' for SMoc, 't' for TMOC)
      Specified by:
      cDim in class Moc1D
    • maxVal

      public final long maxVal()
      Return the number of values at the deepest order (ex: 2x2^29x2^29 for SMoc, 2^61 for TMoc)
      Specified by:
      maxVal in class Moc1D
    • sys

      public final String sys()
      Return the default reference system
      Specified by:
      sys in class Moc1D
    • clear

      public void clear()
      Reinitialisation of the MOC - data only (not the properties)
      Overrides:
      clear in class Moc1D
    • clone

      public SMoc clone() throws CloneNotSupportedException
      Clone Moc (deep copy)
      Specified by:
      clone in class Moc
      Throws:
      CloneNotSupportedException
    • clone1

      protected void clone1(Moc moc) throws CloneNotSupportedException
      Deep copy. The source is this, the target is the Moc in parameter
      Overrides:
      clone1 in class Moc1D
      Throws:
      CloneNotSupportedException
    • dup

      public SMoc dup()
      Create and instance of same class, same sys, but no data nor mocorder
      Specified by:
      dup in class Moc
    • sizeOfCoding

      public int sizeOfCoding()
      Return the number of bytes used for coding each FITS value (4 for integer, 8 for long)
      Specified by:
      sizeOfCoding in class Moc
    • getNbCoding

      public int getNbCoding()
      Return the number of values to write in FITS serialization
      Specified by:
      getNbCoding in class Moc
    • add

      public void add(Moc moc) throws Exception
      Add directly a SMoc
      Overrides:
      add in class Moc1D
      Throws:
      Exception
    • add

      public void add(HealpixImpl healpix, double alpha, double delta) throws Exception
      Add a Moc pixel (at max order) corresponding to the alpha,delta position
      Parameters:
      alpha - , delta position
      Throws:
      Exception
    • contains

      public boolean contains(HealpixImpl healpix, double alpha, double delta) throws Exception
      Check if the spherical coord is inside the MOC. The coordinate system must be compatible with the MOC coordinate system.
      Parameters:
      alpha - in degrees
      delta - in degrees
      Returns:
      true if the coordinates is in one MOC pixel
      Throws:
      Exception
    • queryDisc

      public SMoc queryDisc(HealpixImpl healpix, double alpha, double delta, double radius) throws Exception
      Provide Moc pixels totally or partially inside a circle
      Parameters:
      alpha - circle center (in degrees)
      delta - circle center (in degrees)
      radius - circle radius (in degrees)
      Returns:
      an HealpixMox containing the list of pixels
      Throws:
      Exception
    • setSpaceSys

      public void setSpaceSys(String coosys)
      Set alternative Coosys. All celestial SMoc must be expressed in ICRS (see IVOA MOC 2.0) but alternative is possible for other sphere coverage notably the planets
      Overrides:
      setSpaceSys in class Moc
      Parameters:
      coosys - alternative coosys keyword (not standardized in IVOA document)
    • getSpaceSys

      public String getSpaceSys()
      Get the Coosys. See setSpaceSys()
      Overrides:
      getSpaceSys in class Moc
    • setMinOrder

      public void setMinOrder(int minOrder) throws Exception
      Set min Moc min Order. The hierarchical view will be start at this order. 0 by default
      Overrides:
      setMinOrder in class Moc1D
      Throws:
      Exception
    • getMinOrder

      public int getMinOrder()
      get min Moc min Order. The hierarchical view will be start at this order. 0 by default
      Overrides:
      getMinOrder in class Moc1D
    • getAngularRes

      public double getAngularRes()
      Provide the angular resolution (in degrees) of the SMoc (sqrt of the smallest pixel area)
    • contains

      public boolean contains(long npix)
      True if the npix at the deepest order is in the MOC
    • isIncluding

      public boolean isIncluding(Moc moc) throws Exception
      Operations
      Specified by:
      isIncluding in class Moc
      Throws:
      Exception
    • isIntersecting

      public boolean isIntersecting(Moc moc) throws Exception
      Specified by:
      isIntersecting in class Moc
      Throws:
      Exception
    • union

      public SMoc union(Moc moc) throws Exception
      Return the Union with another Moc
      Overrides:
      union in class Moc
      Throws:
      Exception
    • intersection

      public SMoc intersection(Moc moc) throws Exception
      Return the Intersection with another Moc
      Overrides:
      intersection in class Moc
      Throws:
      Exception
    • subtraction

      public SMoc subtraction(Moc moc) throws Exception
      Return the subtraction with another Moc
      Overrides:
      subtraction in class Moc
      Throws:
      Exception
    • complement

      public SMoc complement() throws Exception
      Return the complement
      Overrides:
      complement in class Moc1D
      Throws:
      Exception
    • readSpecificData

      protected void readSpecificData(InputStream in, int naxis1, int naxis2, int nbyte, cds.moc.Moc.HeaderFits header) throws Exception
      Internal method: read FITS data according to the type of MOC.
      Specified by:
      readSpecificData in class Moc
      Parameters:
      in - The input stream
      naxis1 - size of FITS row (in bytes) (generally ==nbyte, but may be 1024 for buffering)
      naxis2 - number of values
      nbyte - size of each value (in bytes)
      header - HDU1 header
      Throws:
      Exception
    • writeSpecificFitsProp

      protected int writeSpecificFitsProp(OutputStream out) throws Exception
      Write specifical SMOC properties
      Specified by:
      writeSpecificFitsProp in class Moc
      Throws:
      Exception
    • writeSpecificData

      protected int writeSpecificData(OutputStream out) throws Exception
      Write SMOC data -> hierarchy mode
      Overrides:
      writeSpecificData in class Moc
      Throws:
      Exception