de.jreality.geometry
Class GeometryMergeFactory

java.lang.Object
  extended by de.jreality.geometry.GeometryMergeFactory

public class GeometryMergeFactory
extends Object

this Factory merges IndexedFaceSets, Indexed Line Sets, PointSets or scenegraphs containing such things to a single geometry.

For an example of this factory, see this tutorial. TODO Problems: ifs and ils together

TODO: merge only IndexedFaceSets of a SceneGraph

TODO: merge FaceSets and linesets seperate to avoid "holes" in the AttributeList and gather in the end

TODO: refactor to conform to the jReality factory pattern (use update() to regenerate current state).

Author:
gonska
See Also:
if you wish also to combine duplicated vertex, edge, or face data.

Constructor Summary
GeometryMergeFactory()
           
 
Method Summary
 List<Attribute> getDefaultEdgeAttributes()
           
 List<List<double[]>> getDefaultEdgeAttributeValues()
           
 List<Attribute> getDefaultFaceAttributes()
           
 List<List<double[]>> getDefaultFaceAttributeValues()
           
 List<Attribute> getDefaultVertexAttributes()
           
 List<List<double[]>> getDefaultVertexAttributeValues()
           
 List<Attribute> getImportantEdgeDefaultAttributes()
           
 List<Attribute> getImportantFaceDefaultAttributes()
           
 List<Attribute> getImportantVertexDefaultAttributes()
           
 boolean isGenerateFaceNormals()
           
 boolean isGenerateVertexNormals()
           
 boolean isRespectEdges()
           
 boolean isRespectFaces()
           
 boolean isRespectVertices()
          Deprecated. use not yet implemented
 IndexedFaceSet mergeGeometrySets(SceneGraphComponent cmp)
          merges all IndexedFaceSets, IndexeedLineSets and PointSets of the given SceneGraph to one IndexedFaceSet Attention: several values can be set bevorhand
 IndexedFaceSet mergeIndexedFaceSets(PointSet[] geo)
          merges all IndexedFaceSets to one IndexedFaceSet Attention: several values can be set bevorhand
 IndexedFaceSet mergeIndexedFaceSets(SceneGraphComponent cmp)
          merges all IndexedFaceSets, IndexeedLineSets and PointSets of the given SceneGraph to one IndexedFaceSet EdgeAttributes will be ignored.
 IndexedLineSet mergeIndexedLineSets(IndexedLineSet[] ils)
          merges all IndexeedLineSets to one IndexedLineSet Attention: several values can be set bevorhand
 IndexedLineSet mergeIndexedLineSets(SceneGraphComponent cmp)
          merges all IndexedFaceSets, IndexeedLineSets and PointSets of the given SceneGraph to one IndexedLineSet FaceAttributes will be ignored.
 PointSet mergePointSets(PointSet[] ps)
          merges all PointSets to one PointSet Attention: several values can be set bevorhand
 PointSet mergePointSets(SceneGraphComponent cmp)
          merges all IndexedFaceSets, IndexeedLineSets and PointSets of the given SceneGraph to one PointSet Face and Edge-Attributes will be ignored.
 void setDefaultEdgeAttributes(List<Attribute> defaultAttributes, List<List<double[]>> defaultAttributeValues)
          see setDefaultFaceAttributes
 void setDefaultFaceAttributes(List<Attribute> defaultAttributes, List<List<double[]>> defaultAttributeValues)
          Attributes which will be set to the given default, if not yet supported in the geometry.
 void setDefaultVertexAttributes(List<Attribute> defaultAttributes, List<List<double[]>> defaultAttributeValues)
          see setDefaultFaceAttributes
 void setGenerateFaceNormals(boolean generateFaceNormals)
          generates FaceNormals if not already given
 void setGenerateVertexNormals(boolean generateVertexNormals)
          generates VertexNormals if not already given
 void setImportantEdgeDefaultAttributes(List<Attribute> importantEdgeDefaultAttributes)
           
 void setImportantFaceDefaultAttributes(List<Attribute> importantFaceDefaultAttributes)
          default Attributes wich are defined will normaly not be used if no Geometry supports them.
 void setImportantVertexDefaultAttributes(List<Attribute> importantVertexDefaultAttributes)
           
 void setRespectEdges(boolean respectEdges)
          Edge Attributes will not be ignored
 void setRespectFaces(boolean respectFaces)
          Face Attributes will not be ignored
 void setRespectVertices(boolean respectVertices)
          Deprecated. use not yet implemented
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeometryMergeFactory

public GeometryMergeFactory()
Method Detail

mergeGeometrySets

public IndexedFaceSet mergeGeometrySets(SceneGraphComponent cmp)
merges all IndexedFaceSets, IndexeedLineSets and PointSets of the given SceneGraph to one IndexedFaceSet Attention: several values can be set bevorhand

Parameters:
RootNode -

mergeIndexedFaceSets

public IndexedFaceSet mergeIndexedFaceSets(PointSet[] geo)
merges all IndexedFaceSets to one IndexedFaceSet Attention: several values can be set bevorhand

Parameters:
IndexedFaceSets - to merge

mergeIndexedLineSets

public IndexedLineSet mergeIndexedLineSets(IndexedLineSet[] ils)
merges all IndexeedLineSets to one IndexedLineSet Attention: several values can be set bevorhand

Parameters:
IndexedLineSets - to merge

mergePointSets

public PointSet mergePointSets(PointSet[] ps)
merges all PointSets to one PointSet Attention: several values can be set bevorhand

Parameters:
Pointsets - to merge

mergeIndexedFaceSets

public IndexedFaceSet mergeIndexedFaceSets(SceneGraphComponent cmp)
merges all IndexedFaceSets, IndexeedLineSets and PointSets of the given SceneGraph to one IndexedFaceSet EdgeAttributes will be ignored. Attention: several values can be set bevorhand

Parameters:
RootNode -

mergeIndexedLineSets

public IndexedLineSet mergeIndexedLineSets(SceneGraphComponent cmp)
merges all IndexedFaceSets, IndexeedLineSets and PointSets of the given SceneGraph to one IndexedLineSet FaceAttributes will be ignored. Attention: several values can be set bevorhand

Parameters:
RootNode -

mergePointSets

public PointSet mergePointSets(SceneGraphComponent cmp)
merges all IndexedFaceSets, IndexeedLineSets and PointSets of the given SceneGraph to one PointSet Face and Edge-Attributes will be ignored. Attention: several values can be set bevorhand

Parameters:
RootNode -

setDefaultFaceAttributes

public void setDefaultFaceAttributes(List<Attribute> defaultAttributes,
                                     List<List<double[]>> defaultAttributeValues)
Attributes which will be set to the given default, if not yet supported in the geometry. must be doubleArrayArray Attributes !!

Parameters:
defaultFaceAttributes - list of default Attributes
defaultAttributeValues - must have the same length. Each entry can individualy have - just a single entry (default for all is the same) - multiple entrys (one for each geometry) - null or empty (works like no default is given)

setDefaultEdgeAttributes

public void setDefaultEdgeAttributes(List<Attribute> defaultAttributes,
                                     List<List<double[]>> defaultAttributeValues)
see setDefaultFaceAttributes


setDefaultVertexAttributes

public void setDefaultVertexAttributes(List<Attribute> defaultAttributes,
                                       List<List<double[]>> defaultAttributeValues)
see setDefaultFaceAttributes


setImportantFaceDefaultAttributes

public void setImportantFaceDefaultAttributes(List<Attribute> importantFaceDefaultAttributes)
default Attributes wich are defined will normaly not be used if no Geometry supports them. Attributes which are also listed here will although be used.

Parameters:
importantDefaultAttributes -

setImportantEdgeDefaultAttributes

public void setImportantEdgeDefaultAttributes(List<Attribute> importantEdgeDefaultAttributes)

setImportantVertexDefaultAttributes

public void setImportantVertexDefaultAttributes(List<Attribute> importantVertexDefaultAttributes)

setGenerateFaceNormals

public void setGenerateFaceNormals(boolean generateFaceNormals)
generates FaceNormals if not already given

Parameters:
generateVertexNormals -

setGenerateVertexNormals

public void setGenerateVertexNormals(boolean generateVertexNormals)
generates VertexNormals if not already given

Parameters:
generateVertexNormals -

setRespectEdges

public void setRespectEdges(boolean respectEdges)
Edge Attributes will not be ignored

Parameters:
respectEdges -

setRespectFaces

public void setRespectFaces(boolean respectFaces)
Face Attributes will not be ignored

Parameters:
respectEdges -

setRespectVertices

public void setRespectVertices(boolean respectVertices)
Deprecated. use not yet implemented

Verrtex Attributes will not be ignored

Parameters:
respectEdges -

getDefaultEdgeAttributes

public List<Attribute> getDefaultEdgeAttributes()

getDefaultEdgeAttributeValues

public List<List<double[]>> getDefaultEdgeAttributeValues()

getDefaultFaceAttributes

public List<Attribute> getDefaultFaceAttributes()

getDefaultFaceAttributeValues

public List<List<double[]>> getDefaultFaceAttributeValues()

getDefaultVertexAttributes

public List<Attribute> getDefaultVertexAttributes()

getDefaultVertexAttributeValues

public List<List<double[]>> getDefaultVertexAttributeValues()

getImportantFaceDefaultAttributes

public List<Attribute> getImportantFaceDefaultAttributes()

getImportantEdgeDefaultAttributes

public List<Attribute> getImportantEdgeDefaultAttributes()

getImportantVertexDefaultAttributes

public List<Attribute> getImportantVertexDefaultAttributes()

isGenerateFaceNormals

public boolean isGenerateFaceNormals()

isGenerateVertexNormals

public boolean isGenerateVertexNormals()

isRespectEdges

public boolean isRespectEdges()

isRespectFaces

public boolean isRespectFaces()

isRespectVertices

public boolean isRespectVertices()
Deprecated. use not yet implemented