Class ElementPLY

java.lang.Object
com.irurueta.geometry.io.ElementPLY

public class ElementPLY extends Object
Contains an element of the header in a PLY file.
  • Field Details

    • name

      private final String name
      Name of the element (i.e. 'vertex' or 'face').
    • nInstances

      private final long nInstances
      Number of instances of this element (i.e. number of vertices or faces).
    • properties

      private final List<PropertyPLY> properties
      List of properties forming this element. For a property it could be x, y, z properties for vertex coordinates, nx, ny, nz for vertex normals or red, green, blue, alpha for vertex color.
  • Constructor Details

    • ElementPLY

      public ElementPLY(String name, long nInstances)
      Constructor.
      Parameters:
      name - Name of this element (i.e. 'vertex' or 'face').
      nInstances - Number of instances of this element (i.e. number of vertices or faces).
    • ElementPLY

      public ElementPLY(String name, long nInstances, PropertyPLY property)
      Constructor.
      Parameters:
      name - Name of this element (i.e. 'vertex' or 'face').
      nInstances - Number of instances of this element (i.e. number of vertices or faces).
      property - Property to be set on this element.
    • ElementPLY

      public ElementPLY(String name, long nInstances, List<PropertyPLY> properties)
      Constructor.
      Parameters:
      name - Name of this element (i.e. 'vertex' or 'face').
      nInstances - Number of instances of this element (i.e. number of vertices or faces).
      properties - List of properties to be assigned to this element.
  • Method Details

    • getName

      public String getName() throws NotAvailableException
      Returns name of this element.
      Returns:
      name of this element.
      Throws:
      NotAvailableException - Raised if name is not available.
    • isNameAvailable

      public boolean isNameAvailable()
      Determines whether a name for this element has been provided or not.
      Returns:
      True if element is set (different of null), false otherwise.
    • getNumberOfInstances

      public long getNumberOfInstances()
      Returns number of instances of this element (i.e. number of vertices or number of faces).
      Returns:
      Number of instances of this element in the file.
    • getProperties

      public List<PropertyPLY> getProperties() throws NotAvailableException
      Returns list of properties contained in this element.
      Returns:
      List of properties contained in this element.
      Throws:
      NotAvailableException - Raised if no properties have already been set.
    • arePropertiesAvailable

      public boolean arePropertiesAvailable()
      Indicates whether properties have already been set and are available for retrieval.
      Returns:
      True if properties are available, false otherwise.
    • isValidElement

      public boolean isValidElement()
      Indicates if this element is valid (i.e. it has a name)
      Returns:
      True if element is valid, false otherwise.
    • toString

      public String toString()
      Converts this element to string representation ready to be written in the header of a PLY file.
      Overrides:
      toString in class Object
      Returns:
      String representation of this element.