Index: /experimental/distortionNG/DistortionManipulator.cpp
===================================================================
--- /experimental/distortionNG/DistortionManipulator.cpp	(revision 352)
+++ /experimental/distortionNG/DistortionManipulator.cpp	(revision 353)
@@ -20,4 +20,5 @@
 
 #include<osgViewer/Viewer>
+#include<osg/Point>
 
 using namespace osg;
@@ -25,5 +26,6 @@
 
 
-DistortionManipulator::DistortionManipulator()
+DistortionManipulator::DistortionManipulator(DistortionSet* ds)
+ : _highlightColor( osg::Vec4(1.0f, 1.0f, 0.0f, 1.0f) ), _distortionSet( ds )
 {
 	activeSetupMode = DISABLED;
@@ -32,5 +34,10 @@
 	activeVisualizationMode = NONE;
 
-	_distortionSet = NULL;
+	_highlighter = NULL;
+	
+	createVertexHighlighter();
+
+	_camera = 0;
+	//_distortionMesh(distortionMesh)
 }
 
@@ -52,11 +59,4 @@
 bool DistortionManipulator::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, osg::Object* obj, osg::NodeVisitor* nv)
 {
-	//osgViewer::View* viewer = dynamic_cast<osgViewer::View*>(&aa);
-	//if ( viewer && !_distortionSet.isValid())
-	//{
-	//	OSG_ALWAYS<<"Fetching valid DistortionSet!"<<std::endl;
-	//	_distortionSet = viewer->getDistortionSet();
-	//}
-
 	switch(ea.getEventType())
     {
@@ -64,12 +64,37 @@
         case(osgGA::GUIEventAdapter::DRAG):
 		{
-			OSG_ALWAYS<<"DRAG!"<<std::endl;
-			break;
+			osg::notify(osg::ALWAYS)<<std::endl<<"Drag:"<<std::endl<<"ea.getGraphicsContext()="<<ea.getGraphicsContext()<<std::endl;
+			osg::notify(osg::ALWAYS)<<"ea.getXnormalized()="<<ea.getXnormalized()<<std::endl;
+			osg::notify(osg::ALWAYS)<<"ea.getYnormalized()="<<ea.getYnormalized()<<std::endl;
+			osg::notify(osg::ALWAYS)<<"ea.getX()="<<ea.getX()<<std::endl;
+			osg::notify(osg::ALWAYS)<<"ea.getXin()="<<ea.getXmin()<<std::endl;
+			osg::notify(osg::ALWAYS)<<"ea.getXmax()="<<ea.getXmax()<<std::endl;
+			osg::notify(osg::ALWAYS)<<"ea.getY()="<<ea.getY()<<std::endl;
+			osg::notify(osg::ALWAYS)<<"ea.getYin()="<<ea.getYmin()<<std::endl;
+			osg::notify(osg::ALWAYS)<<"ea.getYmax()="<<ea.getYmax()<<std::endl;
+
+			return true;	// true means event handled: not forwarded to the camera manipulator;
+
 		}
         case(osgGA::GUIEventAdapter::PUSH):
 		{
-			if(ea.getButton() == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON)
-			{
-				OSG_ALWAYS<<"mouse click left!"<<std::endl;
+			OSG_ALWAYS<<"mouse click!"<<std::endl;
+			if ( activeSetupMode == MANUAL && ea.getModKeyMask()&osgGA::GUIEventAdapter::MODKEY_CTRL && ea.getButton() == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON )
+			{
+				osgViewer::View* viewer = dynamic_cast<osgViewer::View*>(&aa);
+				if ( viewer )
+				{
+					osg::notify(osg::ALWAYS)<<std::endl<<"Intersection:"<<std::endl<<"ea.getX()="<<ea.getX()<<std::endl;
+					osg::notify(osg::ALWAYS)<<"ea.getY()="<<ea.getY()<<std::endl;
+					osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector = new osgUtil::LineSegmentIntersector(osgUtil::Intersector::PROJECTION, ea.getX(), ea.getY());
+					osgUtil::IntersectionVisitor iv( intersector.get() );
+					_distortionSet->getDistortionCamera()->accept( iv );
+			        
+					if ( intersector->containsIntersections() )
+					{
+						osgUtil::LineSegmentIntersector::Intersection& result = *(intersector->getIntersections().begin());
+						computeSelectedVertex( result );
+					}
+				}
 			}
 			break;
@@ -92,10 +117,27 @@
 				switch(activeSetupMode)
 				{
-					case DISABLED : activeSetupMode = MANUAL; break;
-					case MANUAL : activeSetupMode = DELEGATED; break;
-					case DELEGATED : activeSetupMode = DISABLED; break;
+					case DISABLED : 
+					{
+						activeSetupMode = MANUAL;
+						OSG_ALWAYS<<"SetupMode MANUAL activated"<<std::endl;
+						_distortionSet->getDistortionInternals()->setValue(1, true); // per definition #0 = mesh, #1 = highlighter
+						break;
+					}
+					case MANUAL :
+					{
+						activeSetupMode = DELEGATED;
+						_distortionSet->getDistortionInternals()->setValue(1, false); // per definition #0 = mesh, #1 = highlighter
+						OSG_ALWAYS<<"SetupMode DELEGATED activated"<<std::endl;
+						break;
+					}
+					case DELEGATED :
+					{
+						activeSetupMode = DISABLED;
+						_distortionSet->getDistortionInternals()->setValue(1, false); // per definition #0 = mesh, #1 = highlighter
+						OSG_ALWAYS<<"SetupMode DISABLED activated"<<std::endl;
+						break;
+					}
 				}
 
-				OSG_ALWAYS<<"KEY_KP_4 : Setup Mode now "<<activeSetupMode<<std::endl;
 				return(true);
 			}
@@ -229,2 +271,67 @@
 			_distortionSet->setShowIntensityMapOnly(show);
 }
+
+void DistortionManipulator::createVertexHighlighter()
+{
+	osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array(1);
+	(*colors)[0] = _highlightColor;
+
+	_highlighter = new osg::Geometry;
+	_highlighter->setDataVariance( osg::Object::DYNAMIC );
+	_highlighter->setUseDisplayList( false );
+	_highlighter->setUseVertexBufferObjects( true );
+	_highlighter->setVertexArray( new osg::Vec3Array(1) );	// The highlighter vertex is updated by computeSelectedVertex(..)
+	_highlighter->setColorArray( colors.get() );
+	_highlighter->setColorBinding( osg::Geometry::BIND_OVERALL );
+	_highlighter->addPrimitiveSet( new osg::DrawArrays(GL_POINTS, 0, 1) );
+
+	
+	osg::ref_ptr<osg::Geode> geode = new osg::Geode;
+	geode->addDrawable( _highlighter.get() );
+	geode->getOrCreateStateSet()->setAttributeAndModes( new osg::Point(8.0f) );
+	geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
+	geode->setCullingActive(false);	// disable the culling for the selector, otherwise the selector is culled away on the edge.
+
+	_distortionSet->getDistortionInternals()->addChild(geode, false);
+}
+
+void DistortionManipulator::computeSelectedVertex( osgUtil::LineSegmentIntersector::Intersection& result )
+{
+	osg::Geometry* geom = dynamic_cast<osg::Geometry*>( result.drawable.get() );
+	if ( !geom || geom==_highlighter )
+		return;
+
+	osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>( geom->getVertexArray() );
+	osg::Vec3Array* selVertices = dynamic_cast<osg::Vec3Array*>( _highlighter->getVertexArray() );
+	if ( !vertices || !selVertices )
+		return;
+	
+	OSG_NOTIFY(osg::ALWAYS)<<"size of vertices="<<vertices->size()<<std::endl;
+	OSG_NOTIFY(osg::ALWAYS)<<"size of selVertices="<<selVertices->size()<<std::endl;
+
+	osg::Vec3 point = result.getWorldIntersectPoint();
+	osg::Matrix matrix = osg::computeLocalToWorld( result.nodePath );	// To compute the intersection vertices in world coordinates not in model coordinates
+	OSG_NOTIFY(osg::ALWAYS) << "Intersection-indices: Size=" << result.indexList.size() << std::endl;
+	const std::vector<unsigned int>& selIndices = result.indexList;
+	{
+		double maxRatio = 0.0;
+		int closestVertexIndex = 0;
+		for ( unsigned int i=0; i<3 && i<result.ratioList.size(); i++ )	//iterate through rations and search for maxRation=nearestVertex
+		{
+			if(result.ratioList[i] > maxRatio)
+			{
+				maxRatio = result.ratioList[i];
+				closestVertexIndex = result.indexList[i];
+			}
+			OSG_NOTIFY(osg::ALWAYS)<<"maxRatio="<<maxRatio<<std::endl;
+			OSG_NOTIFY(osg::ALWAYS)<<"closestVertexIndex="<<closestVertexIndex<<std::endl;
+		}
+		OSG_NOTIFY(osg::ALWAYS)<<"nearest vertex: X="<<(*vertices)[closestVertexIndex].x()<<" Y="<<(*vertices)[closestVertexIndex].y()<<" Z="<<(*vertices)[closestVertexIndex].z()<<std::endl;
+		osg::Vec3 vertex = (*vertices)[closestVertexIndex] * matrix;
+
+		selVertices->front() = vertex;		
+		OSG_NOTIFY(osg::ALWAYS)<<"selected vertice: X="<<vertex.x()<<" Y="<<vertex.y()<<" Z="<<vertex.z()<<std::endl;
+	}
+	selVertices->dirty();
+	_highlighter->dirtyBound(); 
+}
Index: /experimental/distortionNG/DistortionManipulator.h
===================================================================
--- /experimental/distortionNG/DistortionManipulator.h	(revision 352)
+++ /experimental/distortionNG/DistortionManipulator.h	(revision 353)
@@ -21,9 +21,15 @@
 
 #include <osgGA/GUIEventHandler>
-#include<osg/Referenced>
+#include <osg/Referenced>
+#include <osg/Switch>
+#include <osg/Geometry>
+#include <osgUtil/IntersectionVisitor>
+#include <osgUtil/LineSegmentIntersector>
+
 #include "DistortionSet.h"
 
 
 namespace osgViewer {
+
 
 class DistortionManipulator : public osgGA::GUIEventHandler
@@ -50,5 +56,5 @@
 
 
-	DistortionManipulator();
+	DistortionManipulator(DistortionSet* ds);
 	virtual ~DistortionManipulator();
 
@@ -58,4 +64,6 @@
 	void setDistortionSet(DistortionSet* ds) {_distortionSet = ds;}
 
+	
+
 private:
 	void resetIntensityMap();
@@ -63,4 +71,7 @@
 	void showDistortionMesh(bool show);
 	void showIntensityMap(bool show);
+
+	void computeSelectedVertex( osgUtil::LineSegmentIntersector::Intersection& result );
+	void createVertexHighlighter();
 
 	SetupMode activeSetupMode;
@@ -70,4 +81,10 @@
 
 	osg::ref_ptr<DistortionSet> _distortionSet;
+
+
+	osg::ref_ptr<osg::Geometry> _highlighter;
+    osg::observer_ptr<osg::Camera> _camera;
+	osg::Geometry* _distortionMesh;
+	const osg::Vec4 _highlightColor;
 };
 
Index: /experimental/distortionNG/DistortionSet.cpp
===================================================================
--- /experimental/distortionNG/DistortionSet.cpp	(revision 352)
+++ /experimental/distortionNG/DistortionSet.cpp	(revision 353)
@@ -36,4 +36,9 @@
 
 	_showIntesityMapMapOnly = false;
+
+	_camera = NULL;
+	_distortionInternals = NULL;
+
+	_distortionInternals = new osg::Switch();
 }
 
@@ -41,5 +46,4 @@
 {
 }
-
 
 REGISTER_OBJECT_WRAPPER( osgViewer_DistortionSet,                  // The unique wrapper name
Index: /experimental/distortionNG/DistortionSet.h
===================================================================
--- /experimental/distortionNG/DistortionSet.h	(revision 352)
+++ /experimental/distortionNG/DistortionSet.h	(revision 353)
@@ -21,4 +21,6 @@
 #include <osg/Image>
 #include <osg/Matrixd>
+#include <osg/Camera>
+#include <osg/Switch>
 
 namespace osgViewer {
@@ -46,4 +48,9 @@
 	osg::Image* getIntensityMap()  { return _intensityMap; }	// Also for manipulating the intensity map
 	bool& getShowIntensityMapOnlyAsRef()	{ return _showIntesityMapMapOnly;}
+
+	void setDistortionCamera(osg::Camera* camera)	{ _camera = camera;}
+	osg::Camera* getDistortionCamera()	{ return _camera.get(); }
+
+	osg::Switch* getDistortionInternals()	{ return _distortionInternals; }
 
 
@@ -92,4 +99,9 @@
 
 	bool _showIntesityMapMapOnly;	// Intensity Blending is done by a frag shader. To control it on runtime, the uniform must be bound to a central variable.
+
+	// Interconnect-Pointer to allow acces between distortion elements (osgViewer) and the distortion manipulator.
+	// These variable are therefor not saved/restored by the serializer but populated on runtime.
+	osg::observer_ptr<osg::Camera> _camera;	// is used to pass the distortion cam from osgViewers setupDistortion() method to the manipulator.
+	osg::ref_ptr<osg::Switch> _distortionInternals;
 };
 
Index: /experimental/distortionNG/distortionNG.cpp
===================================================================
--- /experimental/distortionNG/distortionNG.cpp	(revision 352)
+++ /experimental/distortionNG/distortionNG.cpp	(revision 353)
@@ -5,14 +5,4 @@
 
 #include<osgViewer/Viewer>
-
-
-
-distortionNG::distortionNG()
-{
-}
-
-distortionNG::~distortionNG()
-{
-}
 
 
@@ -79,5 +69,5 @@
         osg::notify(osg::ALWAYS)<<"ea.getYmax()="<<ea.getYmax()<<std::endl;
 
-		return true;	// true means event handeld: not forwarded to the camera manipulator;
+		return true;	// true means event handled: not forwarded to the camera manipulator;
 	}
 
Index: /experimental/distortionNG/distortionNG.h
===================================================================
--- /experimental/distortionNG/distortionNG.h	(revision 352)
+++ /experimental/distortionNG/distortionNG.h	(revision 353)
@@ -30,12 +30,2 @@
 	const osg::Vec4 _highlightColor;
 };
-
-
-
-class distortionNG : public osg::Referenced
-{
-
-public:
-	distortionNG();
-	virtual ~distortionNG();
-};
Index: /experimental/distortionNG/extViewer.cpp
===================================================================
--- /experimental/distortionNG/extViewer.cpp	(revision 352)
+++ /experimental/distortionNG/extViewer.cpp	(revision 353)
@@ -20,4 +20,5 @@
 #include "distortionNG.h"
 
+#include <osg/Switch>
 #include <osg/PolygonOffset>
 #include <osg/Texture2D>
@@ -273,21 +274,14 @@
         camera->setViewMatrix(osg::Matrix::identity());
 
-		osg::ref_ptr<osg::Group> root = new osg::Group;
-		root->addChild(geode);	// add mesh to root so camera renders mesh (and  thus render the scene)
+		osg::ref_ptr<osg::Switch> root = _distortionSet->getDistortionInternals();
+		root->addChild(geode, true);	// adds mesh,shader,.. so camera renders mesh (and  thus render the scene)
 		camera->addChild(root);
 
-		// selector
-		//geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
-		//geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) );
-		//osg::ref_ptr<distortionHandler> selectorHandler = new distortionHandler( camera, distortionMesh );
-		//osg::Geode* selectorHighlighter = selectorHandler->createVertexHighlighter();
-		//selectorHighlighter->setCullingActive(false);	// disable the culling for the selector, otherwise the selector is culled away on the edge.
-		//root->addChild(selectorHighlighter);
-		//addEventHandler( selectorHandler.get() );// should be in main.cpp
+		_distortionSet->setDistortionCamera( camera );
+
+		// Ensure selector is visible:
+		geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
+		geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) );
 		
-		//// Avoid that the highlighter is culled away
-		//osg::CullSettings::CullingMode mode = camera->getCullingMode();
-		//camera->setCullingMode( mode & (~osg::CullSettings::SMALL_FEATURE_CULLING) );
-
         camera->setName("Dist Cam");
 
Index: /experimental/distortionNG/main.cpp
===================================================================
--- /experimental/distortionNG/main.cpp	(revision 352)
+++ /experimental/distortionNG/main.cpp	(revision 353)
@@ -47,8 +47,6 @@
 	osg::Image* intMap = osgDB::readImageFile("intensitymap.png");
 	if (!intMap)
-	{
-		osg::notify(osg::WARN) << "Couldn't find intensity map, quiting." << std::endl;
-		return -1;
-	} 
+		osg::notify(osg::WARN) << "Couldn't find intensity map, skip intensityMap setup." << std::endl;
+
 	// Create DistortionSet
 	osg::ref_ptr<osgViewer::DistortionSet> _distortionSet = new osgViewer::DistortionSet();
@@ -62,33 +60,30 @@
 
 	// set up the camera manipulators.
+    osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
+
+    keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() );
+    keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
+    keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
+    keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
+
+    std::string pathfile;
+    char keyForAnimationPath = '5';
+    while (arguments.read("-p",pathfile))
     {
-        osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
-
-        keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() );
-        keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
-        keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
-        keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
-
-        std::string pathfile;
-        char keyForAnimationPath = '5';
-        while (arguments.read("-p",pathfile))
+        osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
+        if (apm || !apm->valid()) 
         {
-            osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
-            if (apm || !apm->valid()) 
-            {
-                unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
-                keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
-                keyswitchManipulator->selectMatrixManipulator(num);
-                ++keyForAnimationPath;
-            }
+            unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
+            keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
+            keyswitchManipulator->selectMatrixManipulator(num);
+            ++keyForAnimationPath;
         }
-
-        viewer.setCameraManipulator( keyswitchManipulator.get() );
     }
 
+	// Add keyswitch manipulator for multiple scene controls-
+    viewer.setCameraManipulator( keyswitchManipulator.get() );
+
 	// Add the distortion manipulator
-	osgViewer::DistortionManipulator* distManip = new osgViewer::DistortionManipulator();
-	distManip->setDistortionSet(_distortionSet);
-	viewer.addEventHandler(distManip);
+	viewer.addEventHandler(new osgViewer::DistortionManipulator(_distortionSet));
 
     // add the state manipulator
