Class StreamAlignment

All Implemented Interfaces:
AsciiSerializable, FieldAccessor, LockableObject, hec.map.MapObjectInterface, hec.map.streamAlignment.StreamAlignmentIfc, hec.map.streamAlignment.StreamAlignmentNodeIfc, MessagePrinter, TsRecordContainer, Serializable, Cloneable, Comparable, Observer, mil.army.usace.hec.rmi.csinterface.CallBackInterface, rma.lang.Modifiable

public class StreamAlignment extends Manager implements hec.map.MapObjectInterface, hec.map.streamAlignment.StreamAlignmentIfc
Stream coordinate system for model discretizations.

See Also:
  • Field Details

  • Constructor Details

    • StreamAlignment

      public StreamAlignment()
  • Method Details

    • init

      public void init()
      Specified by:
      init in class Manager
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Specified by:
      addPropertyChangeListener in interface hec.map.streamAlignment.StreamAlignmentIfc
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Specified by:
      removePropertyChangeListener in interface hec.map.streamAlignment.StreamAlignmentIfc
    • getElementVector

      public Vector getElementVector()
      Specified by:
      getElementVector in interface hec.map.streamAlignment.StreamAlignmentIfc
    • getNodeVector

      public Vector getNodeVector()
      Specified by:
      getNodeVector in interface hec.map.streamAlignment.StreamAlignmentIfc
    • getDrawProp

      public hec.map.streamAlignment.StreamAlignmentProps getDrawProp()
      Specified by:
      getDrawProp in interface hec.map.streamAlignment.StreamAlignmentIfc
    • getJunctionVector

      public Vector getJunctionVector()
      Specified by:
      getJunctionVector in interface hec.map.streamAlignment.StreamAlignmentIfc
    • newStreamElement

      public StreamElement newStreamElement()
      Specified by:
      newStreamElement in interface hec.map.streamAlignment.StreamAlignmentIfc
    • newStreamNode

      public StreamNode newStreamNode(StreamElement reach)
      Specified by:
      newStreamNode in interface hec.map.streamAlignment.StreamAlignmentIfc
    • deleteStreamNode

      public void deleteStreamNode(StreamNode node)
      Specified by:
      deleteStreamNode in interface hec.map.streamAlignment.StreamAlignmentIfc
    • newStreamJunction

      public StreamJunction newStreamJunction()
      Specified by:
      newStreamJunction in interface hec.map.streamAlignment.StreamAlignmentIfc
    • findNearestReach

      public StreamElement findNearestReach(hec.map.WorldPt wpt, hec.map.WorldPt wptbest)
      finds the stream element nearest the given point. returns the nearest stream element or null ptnbest to the nearest point on the stream
      Specified by:
      findNearestReach in interface hec.map.streamAlignment.StreamAlignmentIfc
    • findNearestReach

      public StreamElement findNearestReach(hec.map.WorldPt wpt, hec.map.WorldPt wptbest, double[] mindist)
      finds the stream element nearest the given point. returns the nearest stream element or null ptnbest to the nearest point on the stream, mindist must have a size of at least 1
      Specified by:
      findNearestReach in interface hec.map.streamAlignment.StreamAlignmentIfc
    • findReach

      public StreamElement findReach(hec.map.WorldPt wpt, double tol)
      Finds a Reach that Contains the given World Point
      Specified by:
      findReach in interface hec.map.streamAlignment.StreamAlignmentIfc
    • findReach

      public StreamElement findReach(StreamNode node, hec.map.WorldPt wpt, double tol)
      Finds a reach that contains the given world point but does not have the given node.
    • findReach

      public StreamElement findReach(hec.map.WorldPt wpt, double tol, StreamElement rch0)
      Finds a Reach that Contains the given World Point for creating reaches
      Specified by:
      findReach in interface hec.map.streamAlignment.StreamAlignmentIfc
    • findReach

      public StreamElement findReach(String name)
      Specified by:
      findReach in interface hec.map.streamAlignment.StreamAlignmentIfc
    • findReach

      public StreamElement findReach(int idx)
      Specified by:
      findReach in interface hec.map.streamAlignment.StreamAlignmentIfc
    • deleteReach

      public boolean deleteReach(int index)
    • deleteReach

      public boolean deleteReach(String name)
      Specified by:
      deleteReach in interface hec.map.streamAlignment.StreamAlignmentIfc
    • deleteAll

      public boolean deleteAll()
      Deletes all elements, nodes, and reaches.
      Specified by:
      deleteAll in interface hec.map.streamAlignment.StreamAlignmentIfc
    • getReach

      public StreamElement getReach(int id)
      Specified by:
      getReach in interface hec.map.streamAlignment.StreamAlignmentIfc
    • getJunction

      public StreamJunction getJunction(int id)
      Specified by:
      getJunction in interface hec.map.streamAlignment.StreamAlignmentIfc
    • getNode

      public StreamNode getNode(int id)
      Specified by:
      getNode in interface hec.map.streamAlignment.StreamAlignmentNodeIfc
    • createReach

      public StreamElement createReach(StreamPolyLine line, double tol)
      Specified by:
      createReach in interface hec.map.streamAlignment.StreamAlignmentIfc
    • connectAlignment

      public void connectAlignment(double tolerance)
      Iterates through the stream alignment connecting the stream elements together.
      Specified by:
      connectAlignment in interface hec.map.streamAlignment.StreamAlignmentIfc
    • connectReach

      public void connectReach(StreamElement elem, double tol)
      Specified by:
      connectReach in interface hec.map.streamAlignment.StreamAlignmentIfc
    • connectNode

      public boolean connectNode(StreamElement elem, StreamNode node, double tol)
      Specified by:
      connectNode in interface hec.map.streamAlignment.StreamAlignmentIfc
    • unload

      public void unload()
      Description copied from interface: hec.map.MapObjectInterface
      Method to tell the Map Object to unload, because the map is done
      Specified by:
      unload in interface hec.map.MapObjectInterface
    • load

      public void load() throws IOException
      Description copied from interface: hec.map.MapObjectInterface
      Method to tell the Map Object to load its data into memory
      Specified by:
      load in interface hec.map.MapObjectInterface
      Throws:
      IOException - Description of Exception
    • readFile

      public boolean readFile(Identifier id)
      Overrides:
      readFile in class Manager
    • writeFile

      public boolean writeFile(Identifier id)
      Overrides:
      writeFile in class Manager
    • setMapIdentifier

      public void setMapIdentifier(hec.map.MapIdentifier id)
      Description copied from interface: hec.map.MapObjectInterface
      Sets the MapIdentifier attribute of the MapObjectInterface object
      Specified by:
      setMapIdentifier in interface hec.map.MapObjectInterface
      Parameters:
      id - The new MapIdentifier value
    • getMapIdentifier

      public hec.map.MapIdentifier getMapIdentifier()
      Description copied from interface: hec.map.MapObjectInterface
      Gets the MapIdentifier attribute of the MapObjectInterface object
      Specified by:
      getMapIdentifier in interface hec.map.MapObjectInterface
      Returns:
      The MapIdentifier value
    • setExtent

      public void setExtent(hec.map.WorldRect rc)
      Description copied from interface: hec.map.MapObjectInterface
      Sets the Extent attribute of the MapObjectInterface object
      Specified by:
      setExtent in interface hec.map.MapObjectInterface
      Parameters:
      rc - The new Extent value
    • getExtent

      public hec.map.WorldRect getExtent()
      Description copied from interface: hec.map.MapObjectInterface
      Gets the Extent attribute of the MapObjectInterface object
      Specified by:
      getExtent in interface hec.map.MapObjectInterface
      Returns:
      The Extent value
    • updateJunctionLocations

      public void updateJunctionLocations()
      Specified by:
      updateJunctionLocations in interface hec.map.streamAlignment.StreamAlignmentIfc
    • findStreamJunction

      public StreamJunction findStreamJunction(StreamElement stream, hec.map.WorldPt wpt, double tol)
      look for a stream junction on the given stream near the given point
      Specified by:
      findStreamJunction in interface hec.map.streamAlignment.StreamAlignmentIfc
    • findStreamNode

      public StreamNode findStreamNode(StreamElement stream, hec.map.WorldPt wpt, double tol)
      look for a stream node on the given stream near the given point
      Specified by:
      findStreamNode in interface hec.map.streamAlignment.StreamAlignmentIfc
    • findNearestStreamNode

      public StreamNode findNearestStreamNode(StreamElement stream, hec.map.WorldPt wpt)
      Specified by:
      findNearestStreamNode in interface hec.map.streamAlignment.StreamAlignmentIfc
    • findDownstreamNode

      public StreamNode findDownstreamNode(StreamElement stream, double coord)
      Specified by:
      findDownstreamNode in interface hec.map.streamAlignment.StreamAlignmentIfc
    • findUpstreamNode

      public StreamNode findUpstreamNode(StreamElement stream, double coord)
      Specified by:
      findUpstreamNode in interface hec.map.streamAlignment.StreamAlignmentIfc
    • removeReachFromJunction

      public boolean removeReachFromJunction(String name, boolean upStream)
      Specified by:
      removeReachFromJunction in interface hec.map.streamAlignment.StreamAlignmentIfc
    • getStreamSegmentsByNodes

      public String getStreamSegmentsByNodes(Vector nodeVec, Vector ndirVec, Vector segVec)
      develops a set of stream segments bounded by the given nodes, also determines whether the nodes are inflow points or outflow points relative to the bounded segments. An error message is returned if the set of nodes do not form a closed pool.

      Specified by:
      getStreamSegmentsByNodes in interface hec.map.streamAlignment.StreamAlignmentIfc
    • findDistanceBetween

      public double findDistanceBetween(StreamElement upstreamElement, double upstreamCoordinateLoc, StreamElement downstreamElement, double downstreamCoordinateLoc)
      Get the distance (in terms of Stream Stationing) from (upstreamElement, upstreamCoordinateLoc) to (downstreamElement, downstreamCoordinateLoc) following a path along the StreamElements and junctions in the StreamAlignment
      Parameters:
      upstreamElement - A non-null StreamElement in this StreamAlignment
      upstreamCoordinateLoc - A coordinate location (1 to 0) on upstreamElement
      downstreamElement - A non-null StreamElement in this StreamAlignment that is the same as, or downstream of upstreamElement
      downstreamCoordinateLoc - A coordinate location (1 to 0) on downstreamElement. If upstreamElement == downstreamElement, this value must be less than upstreamCoordinateLoc
      Returns:
      The distance, in terms of Stream Stationing, from (upstreamElement, upstreamCoordinateLoc) to (downstreamElement, downstreamCoordinateLoc), or HEC_UNDEFINED_DOUBLE if a valid path cannot be found.
    • getNextLineIndex

      public int getNextLineIndex()
      Specified by:
      getNextLineIndex in interface hec.map.streamAlignment.StreamAlignmentIfc
    • getCoordinateReferenceSystem

      public hec.map.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
      Description copied from interface: hec.map.MapObjectInterface
      Returns the coordinate reference system that describes the location of this map. Users can return NULL if they don't have CoordinateReferenceSystem.
      Specified by:
      getCoordinateReferenceSystem in interface hec.map.MapObjectInterface
      Returns:
    • setCoordinateReferenceSystem

      public void setCoordinateReferenceSystem(hec.map.crs.CoordinateReferenceSystem crs)
      Specified by:
      setCoordinateReferenceSystem in interface hec.map.streamAlignment.StreamAlignmentIfc
    • getNextDefaultElementName

      public String getNextDefaultElementName()
      Specified by:
      getNextDefaultElementName in interface hec.map.streamAlignment.StreamAlignmentIfc
    • getFieldObject

      public Object getFieldObject(Field fld)
      Description copied from interface: FieldAccessor
      This method allows access to java.lang.reflect.Field objects within the implementing class.
      Specified by:
      getFieldObject in interface FieldAccessor
      Overrides:
      getFieldObject in class Manager
      Parameters:
      fld - The field to get.
      Returns:
      The data object that is stored in the given field
    • setFieldObject

      public boolean setFieldObject(Field fld, Object fobj)
      Description copied from interface: FieldAccessor
      This allows access to fields withing the implementing object to set there data.
      Specified by:
      setFieldObject in interface FieldAccessor
      Overrides:
      setFieldObject in class Manager
      Parameters:
      fld - The java field object representing the member field to be set
      fobj - The data to set in that field
      Returns:
      returns true if successful