     @currentLayer.addContour(pos)
     @trigger("updateLayer", @currentLayer.getSmoothedContourList())
 
+
   finishLayer : ->
 
     unless @currentLayer?

    @activeCell   = null
    @currentLayer = null        # Layer currently edited
    @idCount      = @contentData.nextCell || 1

    @stateLogger  = new VolumeTracingStateLogger(
      @flycam, tracing.version, tracing.id, tracing.typ,

    @binary.cube.labelVoxels(iterator, labelValue)
    console.log "Labeling time:", ((new Date()).getTime() - start)

    @updateDirection(@currentLayer.getCentroid())
    @currentLayer = null

    @trigger "volumeAnnotated"


  updateDirection : (centroid) ->
    console.log @lastCentroid, centroid
    if @lastCentroid?
      @flycam.setDirection([
        centroid[0] - @lastCentroid[0]
        centroid[1] - @lastCentroid[1]
        centroid[2] - @lastCentroid[2]
      ])
    @lastCentroid = centroid


  getActiveCellId : ->
