package com.artenum.cassandra.plugin.cloud;

public class ScalarBarExporter {
	
	public ScalarBarExporter(){
		
	}
	
	void export(){
		
		/*
		print "first we hide all other actors."
		for index in xrange(cassandra.getPipeLineManager().getActorList().getSize()):
		    cassandra.getPipeLineManager().getActorList().getElementAt(index).getVtkObject().SetVisibility(0)

		print "second, we recover the initial size of the panel"
		scal = cassandra.getPipeLineManager().getScalarBarList().getElementAt(0).getVtkObject()

		initialScalHeight = scal.GetHeight()
		initialScalWidth = scal.GetWidth()

		initialPanelSize = cassandra.getRendererPanel().getSize()

		print "we adjust the panel to the scalar bar and adjust this last one"
		snapshotPanelHeight = int( initialPanelSize.getHeight() / initialScalHeight)
		snapshotPanelWidth = int( initialPanelSize.getWidth() / initialScalWidth)

		scal.SetHeight(0.9)
		scal.SetWidth(0.9)
		scal.SetPosition(0.05, 0.05)

		cassandra.getPipeLineManager().getCassandraView().setSize( snapshotPanelWidth, snapshotPanelHeight)

		cassandra.getPipeLineManager().getCassandraView().validateViewAndGo()

		print "make a snapshot"
		imageTexturePath = "/tmp/scabar.png"
		cassandra.getPipeLineManager().getCassandraView().saveToPNG(imageTexturePath)

		#print "resize the panel at the initial size"
		cassandra.getPipeLineManager().getCassandraView().setSize(  int(initialPanelSize.getWidth()), int(initialPanelSize.getHeight()))

		#print "make actors visibles back"
		#for index in xrange(cassandra.getPipeLineManager().getActorList().getSize()):
		#    cassandra.getPipeLineManager().getActorList().getElementAt(index).getVtkObject().SetVisibility(1)

		#print "create the 3D actor with the mapped texture"
		#planeSource = vtkPlaneSource()
		#mapper = vtkPolyDataMapper()
		#mapper.SetInputConnection( planeSource.GetOutputPort())
		#planeActor = vtkActor()
		#planeActor.SetMapper(mapper)


		#reader = vtk.vtkPNGReader()
		#reader.SetFileName( imageTexturePath )
		#texture = vtk.vtkTexture()
		#texture.InterpolateOn()
		#texture.SetInputConnection( reader.GetOutputPort())

		#planeActor.SetTexture( texture )
		#cassandra.getPipeLineManager().addActor( planeActor, "planeActor")

		#scal.SetHeight(initialScalHeight)
		#scal.SetWidth(initialScalWidth)

		#cassandra.getPipeLineManager().getCassandraView().validateViewAndGo()
		#planeActor.SetVisibility(1)

		*/	
	}
}
