VisualizationFoundation CAT3DFaceGPEditHelper

Usage: you must use this class as is. You should never derive it.


public class CAT3DFaceGPEditHelper

Class to edit CAT3DFaceGP and CAT3DPlanarFace graphic primitive.
CATGraphicPrimitive must be edited in context, this class handles edition authorization. NB : Do not keep EditHelper alive wore than necessary. Edition context notifcation is done on destruction. That's why heap allocation is forbidden.


Constructor and Destructor Index


o CAT3DFaceGPEditHelper()
Constructor.
o ~CAT3DFaceGPEditHelper()
Destructor.

Method Index


o GetFace()
Get the currently edited CAT3DFaceGP.
o GetIndices(int**,int*,int**,int*,int**,int**,int*,int**)
Retrieves the tessellation information from the face.
o GetNormals(float**,int*)
Retrieves face normals.
o GetTextureCoordinates(float**,int*)
Retrieves the texture coordinates.
o GetUV(float**,int*)
Retrieves the face surfacic mesh parameters.
o GetVertices(float**,int*)
Retrieves face vertices.
o IsEditionPossible(CAT3DFaceGP*,CATRep*)
Get if the edition of the given graphic primitive is possible, and if not, why.
o Reset(CAT3DFaceGP*,CATRep*)
Set the currenlty edited CAT3DFaceGP with its edition context In case of success, if the EditHelper is not empty, the old edition context is notified.
o ResetExtended(CAT3DFaceGP*,CATRep*,unsigned int)
Set the currenlty edited CAT3DFaceGP with its edition context.
o SetTextureCoordinates(float const*,unsigned int)
Sets the texture coordinates.
o SetUV(float const*)
Sets the UV array.

Data Member Index


o DoNotUpdateBoundingElement
o EnsureVBEditionPossible
o ReplaceByDuplicateIfMultiAggreg

Constructor and Destructor


o CAT3DFaceGPEditHelper
public CAT3DFaceGPEditHelper()
Constructor. Construct an empty helper. Use the Reset methods to be able to use it.
o ~CAT3DFaceGPEditHelper
public ~CAT3DFaceGPEditHelper()
Destructor. If the EditHelper is not empty, the edition context is notified.

Methods


o GetFace
public GetFace()
Get the currently edited CAT3DFaceGP.
Returns:
The currently edited CAT3DFaceGP. If the EditHelper was empty, NULL is returned.
o GetIndices
public GetIndices( oTriangleIndices,
oNbTriangle,
oTriangleStripIndices,
oNbTriangleStrip,
oNbVertexPerTriangleStrip,
oTriangleFanIndices,
oNbTriangleFan,
oNbVertexPerTriangleFan)
Retrieves the tessellation information from the face.
Parameters:
oTriangleIndices
Retrieves the array used to store the single triangles vertices. Each of its field represents a vertex index, in the oVertices array. As, we find, in the *oVertices array, the XYZ coordinates for each vertex, the indices used to designate the vertices are multiples of three. So, the first three indices of the *oTriangleIndices array, are the indices of the face first single triangle three vertices.

                 -----------------       
                |*oTriangleIndices |
                 -----------------
                |       i00       |   }
                |       i01       |   } triangle 0 defined by index i00, i01 and i02
                |       i02       |   }
                |        .        |
                |        .        |
                |       ij0       |   }
                |       ij1       |   } triangle j defined by index ij0, ij1 and ij2. 
                |       ij2       |   }
                |        .        |
                |        .        |
                 -----------------

   
For example, index ij0 enables access to the face j-th single triangle first vertex, which coordinates are X = *oVertices[ij0], Y = *oVertices[ij0+1] and Z = *oVertices[ij0+2], and which normal has coordinates Nx = *oNormals[ij0], Ny = *oNormals[ij0+1] and Nz = *oNormals[ij0+2].
oNbTriangle
Retrieves the number of single triangles in the face.
oTriangleStripIndices
Retrieves the array used to store the face triangles strips vertices. Each field contains a vertex index, belonging to one of the strips, in the oVertices array. As, we find, in the oVertices array, the XYZ coordinates for each vertex, the indices used to designate the vertices are multiples of three.


                   ----------------------
                  | oTriangleStripIndices |
                   ----------------------
                  |          i00         |   }
                  |          i01         |   } first triangle strip defined
                  |           .          |   } by the first n1 indices
                  |           .          |   }
                  |          i0n1        |   }
                  |           .          |
                  |           .          |
                  |           .          |   
                  |          ij0         |   }
                  |          ij1         |   }
                  |           .          |   } triangle strip j
                  |           .          |   } with nj vertices
                  |          ijnj        |   }
                   ----------------------


    
For example, index ij0 allows to access to the face j-th strip first vertex wich coordinates are X = *oVertices[ij0], Y = *oVertices[ij0 + 1] and Z = *oVertices[ij0 + 2], and which normal coordinates are Nx = *oNormals[ij0], Ny = *oNormals[ij0 + 1] and Nz = *oNormals[ij0 + 2].
oNbTriangleStrip
Retrieves the number of face triangles strips.
oNbVertexPerTriangleStrip
Retrieves an array containing the number of vertices for each face triangles strip. The size of this array is equal to *oNbTriangleStrip. For example, the first strip is made with *oNbVertexPerTriangleStrip[0] vertices.
                --------------------------
               |*oNbVertexPerTriangleStrip|
                --------------------------
               |             n1           |
               |             .            |
               |             .            |   m = Number of triangle strips(*oNbTriangleStrip)
               |             nm           |   nm = number of vertices of the m-th strip. (*oNbVertexPerTriangleStrip[m]
                --------------------------    

   
oTriangleFanIndices
Retrieves the array used to store the face triangles fans vertices. Each field contains a vertex index, belonging to one of the fans, in the oVertices array. As, we find, in the oVertices array, the XYZ coordinates for each vertex, the indices used to designate the vertices are multiples of three.


                   ----------------------
                  | *oTriangleFanIndices  |
                   ----------------------
                  |          i00         |   }
                  |          i01         |   } first triangle fan defined
                  |           .          |   } by the first n1 indices
                  |           .          |   }
                  |          i0n1        |   }
                  |           .          |
                  |           .          |
                  |           .          |   
                  |          ij0         |   }
                  |          ij1         |   }
                  |           .          |   } triangle fan j
                  |           .          |   } with nj vertices
                  |          ijnj        |   }
                   ----------------------


    
For example, index ij0 allows to access to the face j-th fan first vertex wich coordinates are X = *oVertices[ij0], Y = *oVertices[ij0 + 1] and Z = *oVertices[ij0 + 2], and which normal coordinates are Nx = *oNormals[ij0], Ny = *oNormals[ij0 + 1] and Nz = *oNormals[ij0 + 2]. Each ij0, j in [0, jn], represents the j-th fan center.
oNbTriangleFan
Retrieves the number of face triangles fans.
oNbVertexPerTriangleFan
Retrieves the array containing the number of vertices for each face triangles fan. The size of this array is equal to *oNbTriangleFan. For example, the first fan is made with *oNbVertexPerTriangleStrip[0] vertices.
                --------------------------
               | *oNbVertexPerTriangleFan |
                --------------------------
               |             n1           |
               |             .            |
               |             .            |   m = Number of triangle fans(*oNbTriangleFan)
               |             nm           |   nm = number of vertices of the m-th fan. (*oNbVertexPerTriangleFan[m]
                --------------------------    

   
o GetNormals
public GetNormals( oNormals,
oNormalsArraySize)
Retrieves face normals.
Role: As this method is designed to return values on its parameters, it must be called like this :
 float* normals;
 ...
 GetNormals(&normals, ...);
 

Parameters:
oNormals
Retrieves an array made of face normals coordinates: XYZXYZXYZ... Its size is equal to three times the face normals number, if the face was not a planar face, 3 otherwise.
oNormalsArraySize
Retrieves the size, in floats, of the oVertices array. Equal to three times the vertices number if the face was not a planar face, 3 otherwise. If information on vertices is shared with another element, returned size for this parameter is equal to 0.
o GetTextureCoordinates
public GetTextureCoordinates( oTextureCoord,
oDimension)
Retrieves the texture coordinates. This method must be used like this:
 float * textureCoord;
 GetTextureCoord(&textureCoord);
 
Parameters:
oTextureCoord
Retrieves the array of texture coordinates. Each vertex has an associated position in the texture map. The number of texture coordinates groups is always equal to the number of vertices.
oDimension
Retrieve the number of coordinates per vertex.
o GetUV
public GetUV( oUV,
oUVArraySize)
Retrieves the face surfacic mesh parameters.
Parameters:
oUV
Retrieves the UV array. Each vertex has an associated UV couple.
oUVArraySize
Retrieves the size of the UV array. Equals 0 if the mesh is shared with another element or if the array is NULL, two times the number of vertices elsewhere.
o GetVertices
public GetVertices( oVertices,
oVerticesArraySize)
Retrieves face vertices.
Role: As this method is designed to return values on its parameters, it must be called like this :
 float* vertices;
 ...
 GetVertices(&vertices, ...);
 

Parameters:
oVertices
Retrieves an array made of face vertices coordinates: XYZXYZXYZ... Its size is equal to three times the face vertices number.
oVerticesArraySize
Retrieves the size, in floats, of the oVertices array. Equal to three times the vertices number. If information on vertices is shared with another element, returned size for this parameter is equal to 0.
o IsEditionPossible
public static IsEditionPossible( iFace,
iRep)
Get if the edition of the given graphic primitive is possible, and if not, why.
Parameters:
iFace
The face to be edited
iRep
The Rep which should contain the face
Returns:
A CATGraphicPrimitiveEditHelper::EditAuthorization value, depending of the context.
o Reset
public Reset( iFace,
iRep)
Set the currenlty edited CAT3DFaceGP with its edition context In case of success, if the EditHelper is not empty, the old edition context is notified.
Parameters:
iFace
The CAT3DFaceGP instance which will be edited.
iRep
The Rep containing the CAT3DFaceGP. Currently supported rep are CATSurfacicRep and CAT3DCustomRep. If the face is not contained in any Rep, this parameter can be NULL
Returns:
If the face can be edited in the provided context, S_OK, otherwise, E_FAIL It should be noted that if the face is contained in more than one Rep, it will always fail. If the face is contained in a Stripped SurfacicRep, it will fail.
o ResetExtended
public ResetExtended( iFace,
iRep,
iFlag)
Set the currenlty edited CAT3DFaceGP with its edition context. Compared to Reset, this methods supports additional flags which can perform operation to ensure that some edition features will be supported. CAUTION : using these flags can result in duplicate elements and can cause memory issues. In case of success, if the EditHelper is not empty, the old edition context is notified.
Parameters:
iFace
The CAT3DFaceGP instance which will be edited.
iRep
The Rep containing the CAT3DFaceGP. Currently supported rep are CATSurfacicRep and CAT3DCustomRep. If the face is not contained in any Rep, this parameter can be NULL
iFlags
Additional flags which will perform operation needed to access some edition features. -EnsureVBEditionPossible : If the face's vertex buffer is referenced by several face, edition on vertices won't be available. This flag will create a new VertexBuffer if needed to allow edition. -ReplaceByDuplicateIfMultiAggreg : If the face is aggregated in more than one Rep, this flag will make a copy of the face and replace the original face in the rep. The face's VertexBuffer will also be duplicated.
Returns:
If the face can be edited in the provided context, S_OK, otherwise, E_FAIL If the face is contained in a Stripped SurfacicRep, it will fail.
o SetTextureCoordinates
public SetTextureCoordinates( iTextureCoord,
iTextureFormat)
Sets the texture coordinates. If the face shares its vertices, it also shares its texture coordinates.
Parameters:
iTextureCoord
Array of texture coordinates. Each vertex has an associated position in the texture map. The number of texture coordinates groups is always equal to the number of vertices. Because vertex and normal information is being sorted at the face creation, texture coordinates are to be generated with the tessellation parameters that are retrieved after the face creation (ie with properly translated indices). Nevertheless, a mapping operator can be applied at anytime, when the face is the owner of it's vertex data. If computed before the face creation, texture coordinates can be given at the face construction method. In this case, coordinates order is rearranged in parallel with vertices coordinates.
iTextureFormat
iTextureFormat is the number of fields associated to one vertex in the iTextureCoord array. It is also the number of texture coordinates associated to each vertex. Indeed, each vertex has associated coordinates in the texture map. The number of coordinates depends on the map dimension: the texture map may be in 1D, 2D or 3D.
Legal values:
1
The texture map is a one dimension map. Each vertex has a single associated texture coordinate
2
The texture map is a two-dimension map. Each vertex has two associated texture coordinates
3
The texture map is a three-dimension map. Each vertex has three associated texture coordinates
If data is shared, the format for the given texture coordinates must be three.
o SetUV
public SetUV( iUV)
Sets the UV array.
Parameters:
iUV
Array of UV parameters. Its size is equal to 2/3 the vertices array size. The management of this array follows the vertices array management concerning the allocation mode.

Data Members


o DoNotUpdateBoundingElement
  public static const unsigned int DoNotUpdateBoundingElement
o EnsureVBEditionPossible
  public static const unsigned int EnsureVBEditionPossible
o ReplaceByDuplicateIfMultiAggreg
  public static const unsigned int ReplaceByDuplicateIfMultiAggreg

This object is included in the file: CAT3DFaceGPEditHelper.h
If needed, your Imakefile.mk should include the module: CATVisFoundation

Copyright © 1999-2015, Dassault Systèmes. All rights reserved.