# Class JSExporter

java.lang.Object
org.jmol.export.___Exporter
org.jmol.export.__CartesianExporter
org.jmol.export.JSExporter

public class JSExporter extends __CartesianExporter
A class to output WebGL graphics. Only minimally fleshed out. No text, for instance. This class demonstrates a way of interacting with JavaScript that other classes in Jmol do not use. The methods here that start with "js" -- jsInitExport, jsEndExport, etc., are all implemented in JSmolGLmol.js -- that is, they are overridden in the JavaScript. The advantage to this is that this code references just the one line of JavaScript below, which is a static call and serves to extend the prototype. extendJSExporter is in JSmolGLmol.js.

## Field Summary

### Fields inherited from class __CartesianExporter

`canCapCylinders, noColor, sphereMatrix, viewpoint`

### Fields inherited from class ___Exporter

`apertureAngle, backgroundColix, cameraDistance, cameraPosition, center, commandLineOptions, commentChar, degreesPerRadian, depthZ, export3D, exportScale, fileName, fixedRotationCenter, gdata, lightSource, lineWidthMad, out, privateKey, referenceCenter, scalePixelsPerAngstrom, screenHeight, screenWidth, slabZ, solidOnly, tempP1, tempP2, tempP3, tempV1, tempV2, tm, vwr`

## Constructor Summary

Constructors
Constructor
Description
`JSExporter()`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`jsSurface(Object applet, T3[] vertices, T3[] normals, int[][] indices, int nVertices, int nPolygons, int nFaces, BS bsPolygons, int faceVertexMax, int color, int[] vertexColors, int[] polygonColors)`
`protected void`
`output(T3 pt)`
`protected void`
`outputCircle(P3 pt1, P3 pt2, float radius, short colix, boolean doFill)`
`protected void`
`outputCone(P3 ptBase, P3 ptTip, float radius, short colix)`
`protected boolean`
`outputCylinder(P3 ptCenter, P3 pt1, P3 pt2, short colix, byte endcaps, float radius, P3 ptX, P3 ptY, boolean checkRadius)`
`protected void`
`outputEllipsoid(P3 center, P3[] points, short colix)`
`protected void`
`outputFace(int[] is, int[] coordMap, int faceVertexMax)`
`protected void`
`outputFooter()`
`protected void`
`outputHeader()`
///////////////// standard exporter methods //////////////////
`protected void`
`outputSphere(P3 ptCenter, float radius, short colix, boolean checkRadius)`
`protected void`
`outputSurface(T3[] vertices, T3[] normals, short[] vertexColixes, int[][] indices, short[] polygonColixes, int nVertices, int nPolygons, int nTriangles, BS bsPolygons, int faceVertexMax, short colix, Lst<Short> colorList, Map<Short,Integer> htColixes, P3 offset)`
`protected void`
`outputTextPixel(P3 pt, int argb)`
`protected void`
`outputTriangle(T3 pt1, T3 pt2, T3 pt3, short colix)`

### Methods inherited from class __CartesianExporter

`fillTriangle, getCameraPosition, getCoordinateMap, getModelCenter, getNormalMap, outputIndices, outputSolidPlate, setSphereMatrix`

### Methods inherited from class ___Exporter

`finalizeOutput, finalizeOutput2, fixScreenZ, getByteCount, getColorList, getConeMesh, getExportDate, getJmolPerspective, getRotationMatrix, getRotationMatrix, getTriad, getTriadC, initOutput, opacityFractionalFromArgb, opacityFractionalFromColix, output, outputComment, outputJmolPerspective, outputVertex, outputVertices, rgbFractionalFromArgb, rgbFractionalFromColix, round, round, setTempVertex, translucencyFractionalFromColix`

### Methods inherited from class Object

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

## Constructor Details

### JSExporter

public JSExporter()

## Method Details

### jsSurface

protected void jsSurface(Object applet, T3[] vertices, T3[] normals, int[][] indices, int nVertices, int nPolygons, int nFaces, BS bsPolygons, int faceVertexMax, int color, int[] vertexColors, int[] polygonColors)

Parameters:
  `applet` -
  `vertices` -
  `normals` -
  `indices` -
  `nVertices` -
  `nPolygons` -
  `nFaces` -
  `bsPolygons` -
  `faceVertexMax` -
  `color` -
  `vertexColors` -
  `polygonColors` -

### outputHeader

protected void outputHeader()
///////////////// standard exporter methods //////////////////

Specified by:
  `outputHeader` in class `___Exporter`

### outputFooter

protected void outputFooter()

Overrides:
  `outputFooter` in class `___Exporter`

### outputSphere

protected void outputSphere(P3 ptCenter, float radius, short colix, boolean checkRadius)

Specified by:
  `outputSphere` in class `__CartesianExporter`

### outputCylinder

protected boolean outputCylinder(P3 ptCenter, P3 pt1, P3 pt2, short colix, byte endcaps, float radius, P3 ptX, P3 ptY, boolean checkRadius)

Specified by:
  `outputCylinder` in class `__CartesianExporter`

### outputCircle

protected void outputCircle(P3 pt1, P3 pt2, float radius, short colix, boolean doFill)

Specified by:
  `outputCircle` in class `__CartesianExporter`

### outputEllipsoid

protected void outputEllipsoid(P3 center, P3[] points, short colix)

Specified by:
  `outputEllipsoid` in class `__CartesianExporter`

### outputCone

protected void outputCone(P3 ptBase, P3 ptTip, float radius, short colix)

Specified by:
  `outputCone` in class `__CartesianExporter`

### outputSurface

protected void outputSurface(T3[] vertices, T3[] normals, short[] vertexColixes, int[][] indices, short[] polygonColixes, int nVertices, int nPolygons, int nTriangles, BS bsPolygons, int faceVertexMax, short colix, Lst<Short> colorList, Map<Short,Integer> htColixes, P3 offset)

Overrides:
  `outputSurface` in class `___Exporter`
Parameters:
  `vertices` - generally unique vertices [0:nVertices)
  `normals` - one per vertex
  `vertexColixes` - one per vertex, or null
  `indices` - one per triangular or quad polygon; may have additional elements beyond vertex indices if faceVertexMax = 3 triangular if faceVertexMax == 3; 3 or 4 if face VertexMax = 4
  `polygonColixes` - face-based colixes
  `nVertices` - vertices[nVertices-1] is last vertex
  `nPolygons` - indices[nPolygons - 1] is last polygon
  `nTriangles` - number of triangular faces required
  `bsPolygons` - number of polygons (triangles or quads)
  `faceVertexMax` - (3) triangles only, indices[][i] may have more elements (4) triangles and quads; indices[][i].length determines
  `colix` - overall (solid) color index
  `colorList` - list of unique color IDs
  `htColixes` - map of color IDs to colorList
  `offset` -

### outputTriangle

protected void outputTriangle(T3 pt1, T3 pt2, T3 pt3, short colix)

Specified by:
  `outputTriangle` in class `__CartesianExporter`

### outputTextPixel

protected void outputTextPixel(P3 pt, int argb)

Specified by:
  `outputTextPixel` in class `__CartesianExporter`

### outputFace

protected void outputFace(int[] is, int[] coordMap, int faceVertexMax)

Specified by:
  `outputFace` in class `__CartesianExporter`

### output

protected void output(T3 pt)

Specified by:
  `output` in class `___Exporter`