ur_rna.StructureEditor.services.drawing

## Class View2D

- java.lang.Object
- - ur_rna.StructureEditor.services.drawing.View2D

-     public class View2D
      extends java.lang.Object

  Encapsulates the AffineTransform that converts from model coordinates to screen coordinates along with its inverse transform and allows conversion of points between the two. Also contains the bounds of the screen in both coordinate systems.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static View2D` | `IDENTITY`
    `java.awt.geom.Rectangle2D` | `modelBounds` Represents the bounds of the screen in model coordinates.
    `java.awt.Rectangle` | `screenBounds` Represents the bounds of the screen (in screen) coordinates, so the location is always (0,0).
    `java.awt.Dimension` | `screenMargin`
    `private java.awt.geom.Point2D.Double` | `tmpPt1`
    `private java.awt.geom.Point2D.Double` | `tmpPt2`
    `java.awt.geom.AffineTransform` | `trToModel` Converts screen coordinates to model coordinates.
    `java.awt.geom.AffineTransform` | `trToScreen` Converts model coordinates to screen coordinates.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `View2D()`
    `View2D(java.awt.geom.AffineTransform transform, java.awt.Rectangle bounds)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `hashCode()`
    `boolean` | `isInModelBounds(java.awt.geom.Point2D modelPoint)`
    `boolean` | `isInModelBounds(java.awt.Shape modelShape)`
    `boolean` | `isInScreenBounds(java.awt.geom.Point2D screenPoint)`
    `boolean` | `isInScreenBounds(java.awt.Shape screenShape)`
    `java.awt.geom.Point2D` | `rayToModel(java.awt.geom.Point2D p)`
    `java.awt.geom.Point2D` | `rayToModel(java.awt.geom.Point2D p, java.awt.geom.Point2D pDest)`
    `java.awt.geom.Point2D` | `rayToScreen(java.awt.geom.Point2D p)`
    `java.awt.geom.Point2D` | `rayToScreen(java.awt.geom.Point2D p, java.awt.geom.Point2D pDest)`
    `void` | `setView(java.awt.geom.AffineTransform modelToScreenTransform, java.awt.Rectangle screenBounds)`
    `void` | `setView(View2D copyFrom)`
    `java.awt.geom.Point2D` | `toModel(java.awt.geom.Point2D p)`
    `java.awt.geom.Point2D` | `toModel(java.awt.geom.Point2D p, java.awt.geom.Point2D pDest)`
    `java.awt.geom.Rectangle2D` | `toModel(java.awt.geom.Rectangle2D r)`
    `java.awt.geom.Rectangle2D` | `toModel(java.awt.geom.Rectangle2D r, java.awt.geom.Rectangle2D rDest)`
    `java.awt.geom.Point2D` | `toScreen(java.awt.geom.Point2D p)`
    `java.awt.geom.Point2D` | `toScreen(java.awt.geom.Point2D p, java.awt.geom.Point2D pDest)`
    `java.awt.geom.Rectangle2D` | `toScreen(java.awt.geom.Rectangle2D r)`
    `java.awt.geom.Rectangle2D` | `toScreen(java.awt.geom.Rectangle2D r, java.awt.geom.Rectangle2D rDest)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### IDENTITY

          public static final View2D IDENTITY

    - #### modelBounds

          public final java.awt.geom.Rectangle2D modelBounds

      Represents the bounds of the screen in model coordinates.

    - #### screenBounds

          public final java.awt.Rectangle screenBounds

      Represents the bounds of the screen (in screen) coordinates, so the location is always (0,0).

    - #### screenMargin

          public final java.awt.Dimension screenMargin

    - #### tmpPt1

          private final java.awt.geom.Point2D.Double tmpPt1

    - #### tmpPt2

          private final java.awt.geom.Point2D.Double tmpPt2

    - #### trToModel

          public final java.awt.geom.AffineTransform trToModel

      Converts screen coordinates to model coordinates.

    - #### trToScreen

          public final java.awt.geom.AffineTransform trToScreen

      Converts model coordinates to screen coordinates.

  - ### Constructor Detail

    - #### View2D

          public View2D()

    - #### View2D

          public View2D(java.awt.geom.AffineTransform transform,
                        java.awt.Rectangle bounds)

  - ### Method Detail

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### isInModelBounds

          public boolean isInModelBounds(java.awt.geom.Point2D modelPoint)

    - #### isInModelBounds

          public boolean isInModelBounds(java.awt.Shape modelShape)

    - #### isInScreenBounds

          public boolean isInScreenBounds(java.awt.geom.Point2D screenPoint)

    - #### isInScreenBounds

          public boolean isInScreenBounds(java.awt.Shape screenShape)

    - #### rayToModel

          public java.awt.geom.Point2D rayToModel(java.awt.geom.Point2D p)

    - #### rayToModel

          public java.awt.geom.Point2D rayToModel(java.awt.geom.Point2D p,
                                                  java.awt.geom.Point2D pDest)

    - #### rayToScreen

          public java.awt.geom.Point2D rayToScreen(java.awt.geom.Point2D p)

    - #### rayToScreen

          public java.awt.geom.Point2D rayToScreen(java.awt.geom.Point2D p,
                                                   java.awt.geom.Point2D pDest)

    - #### setView

          public void setView(java.awt.geom.AffineTransform modelToScreenTransform,
                              java.awt.Rectangle screenBounds)

    - #### setView

          public void setView(View2D copyFrom)

    - #### toModel

          public java.awt.geom.Point2D toModel(java.awt.geom.Point2D p)

    - #### toModel

          public java.awt.geom.Point2D toModel(java.awt.geom.Point2D p,
                                               java.awt.geom.Point2D pDest)

    - #### toModel

          public java.awt.geom.Rectangle2D toModel(java.awt.geom.Rectangle2D r)

    - #### toModel

          public java.awt.geom.Rectangle2D toModel(java.awt.geom.Rectangle2D r,
                                                   java.awt.geom.Rectangle2D rDest)

    - #### toScreen

          public java.awt.geom.Point2D toScreen(java.awt.geom.Point2D p)

    - #### toScreen

          public java.awt.geom.Point2D toScreen(java.awt.geom.Point2D p,
                                                java.awt.geom.Point2D pDest)

    - #### toScreen

          public java.awt.geom.Rectangle2D toScreen(java.awt.geom.Rectangle2D r)

    - #### toScreen

          public java.awt.geom.Rectangle2D toScreen(java.awt.geom.Rectangle2D r,
                                                    java.awt.geom.Rectangle2D rDest)