jvx.geom

## Class PwUnfold

- java.lang.Object
- - jv.object.PsObject
  - - jvx.project.PjWorkshop
    - - jvx.geom.PwUnfold

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Runnable, PsTimeListenerIf, PsUpdateIf, PjWorkshopIf

      public class PwUnfold
      extends PjWorkshop
      implements PsTimeListenerIf, java.lang.Runnable

  Workshop for unfolding of geometries. Unfolding may be animated. Optionally tabs that help to create a paper model of the geometry can be generated.
  See Also:
    Serialized Form
  Author:
    Klaus Hildebrandt
  Version:
    08.05.08, 2.30 revised (ur) Cut splices if the angle is too big.
    13.09.06, 2.20 revised (ur) Enabled selecting edges by hand.
    28.11.03, 2.10 revised (kp) Update improved.
    30.04.03, 2.00 revised (kh) Method improve unfolding and related methods added.
    30.04.03, 1.20 revised (kh) Removed inner class priority queue class now uses jvx.geom.PuPriorityQueue.
    29.01.02, 1.10 revised (kh) Unfolding now accepts elements of arbitrary size.
    00.00.01, 1.00 created (kh)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `WEIGHT_BY_SELECTION` Compute unfolding respecting which are edges selected by the user.
    `static int` | `WEIGHT_EDGELENGTH` Compute unfolding respecting the length of the edges.
    `static int` | `WEIGHT_ELEMENTINDEX` Compute unfolding respecting at each interior edge the absolute of the difference of the two adjacent elements.

    - ### Fields inherited from class jv.object.PsObject

      `HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS`

    - ### Fields inherited from interface jv.project.PjWorkshopIf

      `MODE_BUG, MODE_STANDARD, MODE_VALIDATE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PwUnfold()` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cancel()` Stop any animation and restore the geometry to its original state.
    `void` | `fitGeometry(boolean flag)` Enable/Disable fitting of geometry to the display after each step of the animation.
    `void` | `flatten(double d)` Incrementally flatten the registered geometry.
    `PsAnimation` | `getAnimation()` Get the animation of the unfolding.
    `int` | `getFixedElement()` Get index of element to be fixed.
    `int` | `getWeight()` Get the weight used to compute the unfolding.
    `boolean` | `hasAnimation()` Check if the animation is available.
    `boolean` | `improveUnfolding()` Method to reduce the number of components the unfolding consists of.
    `void` | `init()` Initialization.
    `boolean` | `isEnabledFixingElement()` Check if freezing of the position of one element while the animation runs is enabled.
    `boolean` | `isFittingGeometry()` Check if fitting of geometry to the display after each step of the animation is enabled.
    `boolean` | `isRunning()` Check whether smoothing prcess will be stopped.
    `boolean` | `isShowingSplices()` Check visibility of splices along cuts of the flattened surface.
    `boolean` | `isStopped()` Check whether smoothing prcess is currently NOT running a thread.
    `void` | `ok()` Accept current version of the geometry as new version.
    `void` | `refold()` Refold the geometry to its original position.
    `void` | `reset()` Reset workshop and geometry to original state.
    `void` | `run()`
    `void` | `setAnimation(PsAnimation anim)` Register an animation to the workshop.
    `void` | `setEnabledFixingElement(boolean flag)` Enable/Disable freezing of the position of one element while the animation runs.
    `void` | `setFixedElement(int anIndex)` Give index of element to be fixed.
    `void` | `setGeometry(PgElementSet geom)` Set geometry to work on.
    `boolean` | `setTime(PsTimeEvent timeEvent)` Set the time of the animation.
    `void` | `setWeight(int weight)` Set the weight used to compute the unfolding.
    `void` | `showPolygonSet(boolean bShow)` Add a polygonSet to the display.
    `void` | `showSplices(boolean flag)` Enable visibility of splices along cuts of the flattened surface.
    `void` | `start()` Start smoothing in separate thread.
    `void` | `stop()` Stop smoothing in separate thread.
    `void` | `storeEdges()` Store the cutting edges to the geometry.
    `void` | `unfold()` Unfold the actual geometry.
    `void` | `unselectAllEdges()` Unselect all edges.
    `boolean` | `update(java.lang.Object event)` Update the class whenever a child has changed.

    - ### Methods inherited from class jvx.project.PjWorkshop

      `close, getDisplay, getDisplays, getGeometry, getMode, getSavedGeometry, getViewer, isModal, isStandalone, removeGeometry, setDisplay, setDisplays, setGeometry, setModal, setMode, setStandalone, setViewer`

    - ### Methods inherited from class jv.object.PsObject

      `addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels`

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

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface jv.anim.PsTimeListenerIf

      `getName`

    - ### Methods inherited from interface jv.object.PsUpdateIf

      `getFather, getName, setParent`

- - ### Field Detail

    - #### WEIGHT_EDGELENGTH

          public static final int WEIGHT_EDGELENGTH

      Compute unfolding respecting the length of the edges.
      See Also:
        Constant Field Values

    - #### WEIGHT_ELEMENTINDEX

          public static final int WEIGHT_ELEMENTINDEX

      Compute unfolding respecting at each interior edge the absolute of the difference of the two adjacent elements.
      See Also:
        Constant Field Values

    - #### WEIGHT_BY_SELECTION

          public static final int WEIGHT_BY_SELECTION

      Compute unfolding respecting which are edges selected by the user. Selected edges are weighted by 0, unselected edges by 1. Not selected edges are more likely to be cut.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PwUnfold

          public PwUnfold()

      Constructor.

  - ### Method Detail

    - #### init

          public void init()

      Initialization.
      Overrides:
        `init` in class `PjWorkshop`

    - #### reset

          public void reset()

      Reset workshop and geometry to original state.
      Overrides:
        `reset` in class `PjWorkshop`

    - #### ok

          public void ok()

      Accept current version of the geometry as new version. Close workshop. The copy of the original geometry is ignored.
      Overrides:
        `ok` in class `PjWorkshop`

    - #### cancel

          public void cancel()

      Stop any animation and restore the geometry to its original state.
      Overrides:
        `cancel` in class `PjWorkshop`

    - #### update

          public boolean update(java.lang.Object event)

      Update the class whenever a child has changed. Method is usually invoked from the children.
      Specified by:
        `update` in interface `PsUpdateIf`
      Overrides:
        `update` in class `PjWorkshop`
      Parameters:
        `event` - sender of this update.
      Returns:
        true if update was correctly handled by superclass.
      See Also:
        `PsObject.setParent(PsUpdateIf)`, `PsObject.getFather()`, `PsObject.addUpdateListener(PsUpdateIf)`
      Version:
        28.11.03, 1.00 created (kp)

    - #### setGeometry

          public void setGeometry(PgElementSet geom)

      Set geometry to work on.
      Parameters:
        `geom` - Geometry will be unfolded.

    - #### showPolygonSet

          public void showPolygonSet(boolean bShow)

      Add a polygonSet to the display. This polygonSet may be used to mark edges, which the user does not want to be cut.
      Author:
        Ulrich Reitebuch
      Version:
        13.09.06, 1.00 created (ur)

    - #### unselectAllEdges

          public void unselectAllEdges()

      Unselect all edges.
      Author:
        Ulrich Reitebuch
      Version:
        13.09.06, 1.00 created (ur)

    - #### setWeight

          public void setWeight(int weight)

      Set the weight used to compute the unfolding. Weight is not used by improve unfolding

    - #### getWeight

          public int getWeight()

      Get the weight used to compute the unfolding. Weight is not used by improve unfolding

    - #### flatten

          public void flatten(double d)

      Incrementally flatten the registered geometry.
      Parameters:
        `d` - parameter in [0,1] describes the flattening state.
      Version:
        08.05.08, 1.20 revised (ur) Added step unfold mode.
        09.11.02, 1.10 revised (kp) Method made public.
        00.00.01, 1.00 created (kh)

    - #### storeEdges

          public void storeEdges()

      Store the cutting edges to the geometry. For this purpose the geometry will be set to the initial state. Edges are enabled, glued edges are selected and the geometry is saved as jvx file.
      Author:
        Ulrich Reitebuch
      Version:
        20.09.06, 1.00 created (ur)

    - #### setEnabledFixingElement

          public void setEnabledFixingElement(boolean flag)

      Enable/Disable freezing of the position of one element while the animation runs. This avoids unnecessary bouncing of the geometry during the animation.
      See Also:
        `isEnabledFixingElement()`, `setFixedElement(int)`, `getFixedElement()`

    - #### isEnabledFixingElement

          public boolean isEnabledFixingElement()

      Check if freezing of the position of one element while the animation runs is enabled.
      See Also:
        `setEnabledFixingElement(boolean)`, `setFixedElement(int)`, `getFixedElement()`

    - #### setFixedElement

          public void setFixedElement(int anIndex)

      Give index of element to be fixed. The position of this element are freezed when the animation runs.
      See Also:
        `isEnabledFixingElement()`, `getFixedElement()`

    - #### getFixedElement

          public int getFixedElement()

      Get index of element to be fixed. The position of this element are freezed when the animation runs.
      See Also:
        `isEnabledFixingElement()`, `setFixedElement(int)`

    - #### fitGeometry

          public void fitGeometry(boolean flag)

      Enable/Disable fitting of geometry to the display after each step of the animation.
      See Also:
        `isFittingGeometry()`

    - #### isFittingGeometry

          public boolean isFittingGeometry()

      Check if fitting of geometry to the display after each step of the animation is enabled.
      See Also:
        `fitGeometry(boolean)`

    - #### isShowingSplices

          public boolean isShowingSplices()

      Check visibility of splices along cuts of the flattened surface.
      Since:
        JavaView 2.87.000
      Version:
        23.07.03, 1.00 created (kp)

    - #### showSplices

          public void showSplices(boolean flag)

      Enable visibility of splices along cuts of the flattened surface. This enables to glue papers models to closed surfaces.

      Note, splices are only visible if the model is fully flattened. During all other states splices are automatically switched off.

      Since:
        JavaView 2.87.000
      Version:
        23.07.03, 1.00 created (kp)

    - #### unfold

          public void unfold()

      Unfold the actual geometry.
      See Also:
        `refold()`

    - #### refold

          public void refold()

      Refold the geometry to its original position.
      See Also:
        `unfold()`

    - #### getAnimation

          public PsAnimation getAnimation()

      Get the animation of the unfolding.
      Specified by:
        `getAnimation` in interface `PsTimeListenerIf`
      See Also:
        `PsAnimation`, `PsTimeListenerIf`

    - #### hasAnimation

          public boolean hasAnimation()

      Check if the animation is available.
      Specified by:
        `hasAnimation` in interface `PsTimeListenerIf`
      See Also:
        `PsAnimation`, `PsTimeListenerIf`

    - #### setAnimation

          public void setAnimation(PsAnimation anim)

      Register an animation to the workshop.
      Specified by:
        `setAnimation` in interface `PsTimeListenerIf`
      See Also:
        `PsAnimation`, `PsTimeListenerIf`

    - #### setTime

          public boolean setTime(PsTimeEvent timeEvent)

      Set the time of the animation. Animation updates the dynamic object through this method whenever time has changed.
      Specified by:
        `setTime` in interface `PsTimeListenerIf`
      See Also:
        `PsAnimation`, `PsTimeListenerIf`

    - #### improveUnfolding

          public boolean improveUnfolding()

      Method to reduce the number of components the unfolding consists of. The method unfold must be called in advance.
      Returns:
        boolean true is the number of components has been reduces, false if not.

    - #### isRunning

          public boolean isRunning()

      Check whether smoothing prcess will be stopped.
      Returns:
        false, if the energy minimizer will stop (just shutting down regularely).

    - #### isStopped

          public boolean isStopped()

      Check whether smoothing prcess is currently NOT running a thread.

    - #### start

          public void start()

      Start smoothing in separate thread.
      See Also:
        `stop()`

    - #### stop

          public void stop()

      Stop smoothing in separate thread.
      See Also:
        `start()`

    - #### run

          public void run()

      Specified by:
        `run` in interface `java.lang.Runnable`

"

The software JavaView? is copyright protected. All Rights Reserved.
"