Class SectionSet3DInt

All Implemented Interfaces:
java.awt.datatransfer.Transferable, java.lang.Comparable<InterfaceShape>, AttributeListener, AttributeObject, InterfaceView3DObject, InterfaceObject, PersistentObject, VariableObject, PopupMenuObject, NamedObject, InterfaceQueryObject, InterfaceShapeQueryObject, ShapeSet, ShapeListener, VertexDataColumnListener, InterfaceTransferable, TreeObject, CleanableObject, XMLObject, IconObject, org.jogamp.java3d.GeometryUpdater
Direct Known Subclasses:
MorphSections3DInt

public class SectionSet3DInt
extends Shape3DInt
implements ShapeListener, ShapeSet, InterfaceView3DObject
Represents a set of parallel sections, based upon a reference plane (thisShape), and a spacing value. Stores 2D shape sets in a value map, such that the value is an integer i specifying the section at i * spacing units from the reference plane.
Since:
1.0
Version:
1.0
Author:
Andrew Reid
  • Field Details

    • sections

      public java.util.HashMap<java.lang.Integer,​ShapeSet2DInt> sections
    • scene3DNodes

      public ValueMap scene3DNodes
    • width

      public double width
    • boundBox2D

      public Rect2D boundBox2D
    • blnUpdate

      public boolean blnUpdate
    • shapeAttr

      public AttributeList shapeAttr
    • clip_planes

      public org.jogamp.java3d.ModelClip clip_planes
  • Constructor Details

    • SectionSet3DInt

      public SectionSet3DInt()
    • SectionSet3DInt

      public SectionSet3DInt​(java.lang.String sName, Plane3D refPlane, float spacing)
    • SectionSet3DInt

      public SectionSet3DInt​(java.lang.String sName, Plane3D refPlane, float spacing, double sectWidth)
  • Method Details

    • getGeometryInstance

      public Shape getGeometryInstance()
      Description copied from class: InterfaceShape
      Returns an instance of this InterfaceShape's geometry class.
      Overrides:
      getGeometryInstance in class Shape3DInt
      Returns:
    • getIndexOf

      public int getIndexOf​(InterfaceShape section_set)
      Returns the index of section_set in this set.
      Specified by:
      getIndexOf in interface ShapeSet
      Returns:
      index of shape, or -1 if it is not in this set
    • getClosestSection

      public int getClosestSection​(org.jogamp.vecmath.Point3f point)
      Returns the index of the section in this set which is closest to point.
      Parameters:
      point -
      Returns:
    • setUnit

      public void setUnit​(SpatialUnit unit)
      Does nothing for SectionSet3DInt; the unit is set by the parent set (or the the default from InterfaceEnvironment, if no parent is set.
      Specified by:
      setUnit in interface ShapeSet
      Overrides:
      setUnit in class InterfaceShape
    • isAncestorSet

      public boolean isAncestorSet​(ShapeSet set)
      Description copied from interface: ShapeSet
      Determines whether set is an ancestor set of this set; i.e., whether this set is a subset of set.
      Specified by:
      isAncestorSet in interface ShapeSet
      Returns:
    • setIcon

      protected void setIcon()
      Overrides:
      setIcon in class Shape3DInt
    • init

      protected void init()
      Overrides:
      init in class Shape3DInt
    • getMembers

      public java.util.ArrayList<InterfaceShape> getMembers()
      Returns a copy of this set's member list.
      Specified by:
      getMembers in interface ShapeSet
      Returns:
      a list of members
    • getSectionForShape

      public int getSectionForShape​(Shape2DInt shape)
    • getShowSection3D

      public boolean getShowSection3D()
    • getSectionOf

      public int getSectionOf​(ShapeSet2DInt set)
      Returns the index of set in this section set object, if it exists. Otherwise, returns Integer.MAX_VALUE.
      Parameters:
      set - The set to check
      Returns:
      The index of set, or Integer.MAX_VALUE if it is not in this section set.
    • attributeUpdated

      public void attributeUpdated​(AttributeEvent e)
      Description copied from class: Shape3DInt
      Responds to an update in one of this shape's attributes.

      Subclasses should override and call this super method AFTER handling the attribute change appropriately. Subclasses should also override needsRedraw() to indicate whether the scene node should be regenerated.

      Specified by:
      attributeUpdated in interface AttributeListener
      Overrides:
      attributeUpdated in class Shape3DInt
      Parameters:
      e - an AttributeEvent specifying which attribute has been changed
    • needsRedraw

      public boolean needsRedraw​(Attribute<?> a)
      Description copied from class: InterfaceShape
      Returns true if a change to attribute will require a redraw of this shape.
      Overrides:
      needsRedraw in class Shape3DInt
      Returns:
    • getSize

      public int getSize()
      Description copied from interface: ShapeSet
      Returns the number of shapes in this set
      Specified by:
      getSize in interface ShapeSet
      Returns:
    • getView3D

      public View3D getView3D()
      TODO: update coordinates to according to model's coordinate system public void setModel(ShapeModel3D m){ if (model == m) return; if (model != null) removeShapeListener(model); model = m; setID(model.idFactory.getID()); addShapeListener(model); Iterator itr = sections.values().iterator(); while (itr.hasNext()) itr.next().setModel(m); }
      Specified by:
      getView3D in interface InterfaceView3DObject
    • getView3D

      public View3D getView3D​(double distance)
    • setUpdateable

      public void setUpdateable​(boolean b)
    • getUpdateable

      public boolean getUpdateable()
    • getBoundBox2D

      public Rect2D getBoundBox2D()
    • setBoundBox2D

      public void setBoundBox2D​(Rect2D thisBox)
    • getRefPlane

      public Plane3D getRefPlane()
      Gets the reference plane (i.e., at index 0) for this section set.
    • setRefPlane

      public void setRefPlane​(Plane3D thisPlane)
      Sets the reference plane (i.e., at index 0) for this section set.
      Parameters:
      thisPlane -
    • getSpacing

      public float getSpacing()
    • setSpacing

      public void setSpacing​(float s)
      Sets the spacing distance for this section set.
      Parameters:
      s -
    • getApplyClip

      public boolean getApplyClip()
    • setApplyClip

      public void setApplyClip​(boolean apply)
    • getClipDistUp

      public float getClipDistUp()
      Gets the upwards clipping distance for this section set
    • setClipDistUp

      public void setClipDistUp​(float dist)
      Sets the upwards clipping distance for this section set
      Parameters:
      dist -
    • getClipDistDown

      public float getClipDistDown()
      Gets the downwards clipping distance for this section set
    • setClipDistDown

      public void setClipDistDown​(float dist)
      Sets the downwards clipping distance for this section set
      Parameters:
      dist -
    • getInvertClip

      public boolean getInvertClip()
    • setInvertClip

      public void setInvertClip​(boolean apply)
    • getClipPlanes

      public org.jogamp.java3d.ModelClip getClipPlanes​(int section)
      Get a set of two ModelClip nodes parallel to this section's plane, at distances defined by getClipDistUp() and getClipDistDown().

      If the clipping nodes already exist, they will be updated by this method.

      Parameters:
      section -
      parent - test whether parent is already the current parent; otherwise must create new node
      Returns:
    • hasClipPlanes

      public boolean hasClipPlanes()
    • addShape2D

      public void addShape2D​(Shape2DInt thisShape, int section, boolean update)
    • addShape2D

      public void addShape2D​(Shape2DInt shape, int section, boolean updateShape, boolean updateListeners)
      Adds a 2D shape to the section shape set at index section.
      Parameters:
      shape -
      section -
      updateShape -
      updateListeners -
    • addSection

      public ShapeSet2DInt addSection​(int section, boolean updateShape)
      Add a section shape set to this section set.
      Parameters:
      section -
      updateShape -
      Returns:
    • removeSection

      public boolean removeSection​(int section, boolean updateShape, boolean updateListeners)
      Remove the section at index section.
      Parameters:
      section -
      updateShape -
      updateListeners -
      Returns:
    • getShapeSet

      public ShapeSet2DInt getShapeSet​(int section)
    • getShapeSet

      public ShapeSet2DInt getShapeSet​(int section, double sectionWidth)
      Return a ShapeSet2DInt of all objects intersected by the current section plane and its upper and lower bounds.
      Parameters:
      section -
      sectionWidth -
      Returns:
    • issueTreeNode

      public InterfaceTreeNode issueTreeNode()
      Description copied from class: Shape3DInt
      Issues a new tree node for this ShapeInt. Creates the node and then calls InterfaceShape.setTreeNode(mgui.interfaces.trees.InterfaceTreeNode) to construct it. setTreeNode should be overridden by subclasses.
      Specified by:
      issueTreeNode in interface TreeObject
      Overrides:
      issueTreeNode in class Shape3DInt
      Returns:
      a new InterfaceTreeNode, which is an instance of Shape3DTreeNode.
    • setTreeNode

      public void setTreeNode​(InterfaceTreeNode treeNode)
      Description copied from class: InterfaceShape
      Constructs a tree node from this shape. Adds an AttributeTreeNode via the super method, and also adds a node to display the vertex-wise data columns associated with this ShapeInt.

      If overriding this method, subclass implementations should first call this super method to initialize the node and provide a basic construction.

      Specified by:
      setTreeNode in interface TreeObject
      Overrides:
      setTreeNode in class InterfaceShape
      Parameters:
      treeNode - the tree node to construct
    • hasSection

      public boolean hasSection​(int i)
      Checks whether a section exists at index i.
      Parameters:
      i -
      Returns:
    • hasSections

      public boolean hasSections()
      Checks whether any sections have yet been set for this section set.
      Returns:
    • getSectionDist

      public double getSectionDist​(int i)
      Gets the distance of the section plane at index i from the reference plance (i.e., at index 0).
      Parameters:
      i -
      Returns:
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class Shape3DInt
    • shapeUpdated

      public void shapeUpdated​(ShapeEvent e)
      Description copied from interface: ShapeListener
      A shape that this object is listening to has been updated. The specific type of event is defined by ShapeEvent.EventType.
      Specified by:
      shapeUpdated in interface ShapeListener
    • getShape2DType

      public ShapeSet2DInt getShape2DType​(Shape2DInt shape)
    • getShape2DType

      public ShapeSet2DInt getShape2DType​(Shape2DInt shape, boolean recurse)
    • addUnionSet

      public void addUnionSet​(ShapeSet2DInt thisSet, int section)
    • addUnionSet

      public void addUnionSet​(ShapeSet2DInt thisSet, int section, boolean updateShape, boolean updateListeners)
    • addUnionSet

      public void addUnionSet​(SectionSet3DInt uSet, boolean init)
    • updateShape

      public void updateShape​(ShapeSet2DInt thisSet, int section)
    • removeShape

      public void removeShape​(InterfaceShape shape)
      Description copied from interface: ShapeSet
      Removes a shape from this set
      Specified by:
      removeShape in interface ShapeSet
    • removeShape

      public void removeShape​(Shape2DInt shape, boolean updateShape, boolean updateListeners)
    • getShape2DInt

      public Shape2DInt getShape2DInt​(Plane3D p, float above_dist, float below_dist, boolean listen)
      Description copied from class: Shape3DInt
      Determines a 2D shape which is the projection of this 3D shape onto plane, within the projection limits defined by above_dist and below_dist.
      Overrides:
      getShape2DInt in class Shape3DInt
      above_dist - The projection limit above the plane
    • getShape2D

      public Shape2DInt getShape2D​(Plane3D plane, float above_dist, float below_dist)
      Description copied from class: Shape3DInt
      To be overridden by subclasses implementing a 2D representation
      Overrides:
      getShape2D in class Shape3DInt
      Parameters:
      plane - Plane on which to render
      above_dist - Distance above plane within which to project a shape
      below_dist - Distance below plane within which to project a shape
      Returns:
    • crossesPlane

      public boolean crossesPlane​(Plane3D plane)
      Description copied from class: Shape3DInt
      Convenience method which determines whether this shape cross plane.
      Overrides:
      crossesPlane in class Shape3DInt
      Returns:
    • removeSelectionSet

      public void removeSelectionSet​(ShapeSelectionSet selSet)
    • getScene3DObject

      public org.jogamp.java3d.BranchGroup getScene3DObject​(ShapeSelectionSet selSet)
      Overrides:
      getScene3DObject in class Shape3DInt
    • setScene3DObject

      public void setScene3DObject()
      Description copied from class: Shape3DInt
      Sets this ShapeInt's Java3D scene node from its current geometry and rendering attributes. This node should be retrieved using the Shape3DInt.getShapeSceneNode() method. A scene node will only created if one of these conditions is met:
      • The shape is auxiliary (i.e., not a model shape, but a helper shape such as a section polygon)
      • The shape is associated with a ShapeModel3D, and this model is live (is associated with at least one Java3D scene graph).
      Subclasses which call this super method should always check that a scene node has indeed been created.
      Overrides:
      setScene3DObject in class Shape3DInt
    • setScene3DObject

      public void setScene3DObject​(boolean make_live)
      Description copied from class: Shape3DInt
      Sets this ShapeInt's Java3D scene node from its current geometry and rendering attributes. This node should be retrieved using the Shape3DInt.getShapeSceneNode() method. A scene node will only created if one of these conditions is met:
      • The shape is auxiliary (i.e., not a model shape, but a helper shape such as a section polygon)
      • The shape is associated with a ShapeModel3D, and this model is live (is associated with at least one Java3D scene graph).
      Subclasses which call this super method should always check that a scene node has indeed been created.
      Overrides:
      setScene3DObject in class Shape3DInt
    • setScene3DObject

      public void setScene3DObject​(ShapeSelectionSet filter, boolean make_live)
    • getVertices

      public java.util.ArrayList<org.jogamp.vecmath.Point3f> getVertices()
      Overrides:
      getVertices in class Shape3DInt
    • getShapeSet3DInt

      public ShapeSet3DInt getShapeSet3DInt()
    • getPlaneAt

      public Plane3D getPlaneAt​(int section)
      Return the plane corresponding to the specified section
      Parameters:
      section -
      Returns:
      Plane at this section
    • getShapeSet3DInt

      public ShapeSet3DInt getShapeSet3DInt​(ShapeSelectionSet selSet)
    • updateShape

      public void updateShape()
      Description copied from class: Shape3DInt
      Updates the geometric bounds of this ShapeInt. Does not call Shape3DInt.setScene3DObject().
      Overrides:
      updateShape in class Shape3DInt
    • getFirstSection

      public int getFirstSection()
    • getLastSection

      public int getLastSection()
    • setFromSectionSet

      public void setFromSectionSet​(SectionSet3DInt thisSet)
    • getInitSectionSet

      public SectionSet3DInt getInitSectionSet()
    • validateNodes

      public boolean validateNodes()
    • getIterator

      public java.util.Iterator getIterator()
    • getShapeCount

      public int getShapeCount()
    • updateLightShapes

      public void updateLightShapes()
    • addShape

      public boolean addShape​(InterfaceShape shape)
      Description copied from interface: ShapeSet
      Adds a shape to this set
      Specified by:
      addShape in interface ShapeSet
      Returns:
    • moveShapeBefore

      public boolean moveShapeBefore​(InterfaceShape shape, InterfaceShape target)
      Description copied from interface: ShapeSet
      Moves the order of shape to the spot before target.
      Specified by:
      moveShapeBefore in interface ShapeSet
      Returns:
    • getShapeSet

      public java.util.Set<InterfaceShape> getShapeSet()
      Specified by:
      getShapeSet in interface ShapeSet
    • get2DShapes

      public java.util.ArrayList<Shape2DInt> get2DShapes()
      Returns a list of all 2D shapes in this section set
      Returns:
    • get2DShapes

      public java.util.ArrayList<Shape2DInt> get2DShapes​(boolean recurse)
      Returns a list of all 2D shapes in this section set
      Returns:
    • getSubSets

      public java.util.Set<ShapeSet> getSubSets()
      Specified by:
      getSubSets in interface ShapeSet
    • hasShape

      public boolean hasShape​(InterfaceShape s)
      Not implemented.
      Specified by:
      hasShape in interface ShapeSet
    • hasShape

      public boolean hasShape​(InterfaceShape s, boolean recurse)
      Not implemented.
      Specified by:
      hasShape in interface ShapeSet
    • getLocalName

      public java.lang.String getLocalName()
      Description copied from interface: XMLObject
      Returns the local name associated with this XML object.
      Specified by:
      getLocalName in interface XMLObject
      Overrides:
      getLocalName in class Shape3DInt
      Returns:
    • getXML

      public java.lang.String getXML​(int tab, XMLObject.XMLType type)
      Overrides:
      getXML in class InterfaceShape
    • writeXML

      public void writeXML​(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOException
      Description copied from interface: XMLObject
      Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format of XMLFormat.Ascii will be used.
      Specified by:
      writeXML in interface XMLObject
      Overrides:
      writeXML in class InterfaceShape
      Parameters:
      tab - The number of tabs to place before the XML text
      writer - The writer
      options - XMLOutputOptions defining the write parameters
      progress_bar - Optional progress updater (may be null)
      Throws:
      java.io.IOException
    • getLastAdded

      public InterfaceShape getLastAdded()
      Specified by:
      getLastAdded in interface ShapeSet
    • getLastRemoved

      public InterfaceShape getLastRemoved()
      Specified by:
      getLastRemoved in interface ShapeSet
    • getLastModified

      public InterfaceShape getLastModified()
      Specified by:
      getLastModified in interface ShapeSet
    • getLastInserted

      public InterfaceShape getLastInserted()
      Specified by:
      getLastInserted in interface ShapeSet
    • getLastMoved

      public InterfaceShape getLastMoved()
      Specified by:
      getLastMoved in interface ShapeSet
    • getLastInsert

      public int getLastInsert()
      Specified by:
      getLastInsert in interface ShapeSet