public void onTentativeMove ( GeometryEditTentativeMoveEvent event ) { try { Coordinate [ ] vertices = editService . getIndexService ( ) . getSiblingVertices ( editService . getGeometry ( ) , editService . getInsertIndex ( ) ) ; String geometryType = editService . getIndexService ( ) . getGeometryType ( editService . getGeometry ( ) , editService . getInsertIndex ( ) ) ; if ( vertices != null && ( Geometry . LINE_STRING . equals ( geometryType ) || Geometry . LINEAR_RING . equals ( geometryType ) ) ) { Coordinate temp1 = event . getOrigin ( ) ; Coordinate temp2 = event . getCurrentPosition ( ) ; Coordinate c1 = mapPresenter . getViewPort ( ) . getTransformationService ( ) . transform ( temp1 , RenderSpace . WORLD , RenderSpace . SCREEN ) ; Coordinate c2 = mapPresenter . getViewPort ( ) . getTransformationService ( ) . transform ( temp2 , RenderSpace . WORLD , RenderSpace . SCREEN ) ; tentativeMoveLine . setStep ( 0 , new MoveTo ( false , c1 . getX ( ) , c1 . getY ( ) ) ) ; tentativeMoveLine . setStep ( 1 , new LineTo ( false , c2 . getX ( ) , c2 . getY ( ) ) ) ; } else if ( vertices != null && Geometry . LINEAR_RING . equals ( geometryType ) ) { // Draw the second line (as an option...) } } catch ( GeometryIndexNotFoundException e ) { throw new IllegalStateException ( e ) ; } }
Renders a line from the last inserted point to the current mouse position indicating what the new situation would look like if a vertex where to be inserted at the mouse location .