public void onGeometryEditMove ( GeometryEditMoveEvent event ) { // Find the elements that need updating: Map < GeometryIndex , Boolean > indicesToUpdate = new HashMap < GeometryIndex , Boolean > ( ) ; for ( GeometryIndex index : event . getIndices ( ) ) { if ( ! indicesToUpdate . containsKey ( index ) ) { indicesToUpdate . put ( index , false ) ; if ( ! Geometry . POINT . equals ( editService . getGeometry ( ) . getGeometryType ( ) ) && ! Geometry . MULTI_POINT . equals ( editService . getGeometry ( ) . getGeometryType ( ) ) ) { try { List < GeometryIndex > neighbors ; switch ( editService . getIndexService ( ) . getType ( index ) ) { case TYPE_VERTEX : // Move current vertex to the back. This helps the delete operation. indicesToUpdate . put ( index , true ) ; neighbors = editService . getIndexService ( ) . getAdjacentEdges ( event . getGeometry ( ) , index ) ; if ( neighbors != null ) { for ( GeometryIndex neighborIndex : neighbors ) { if ( ! indicesToUpdate . containsKey ( neighborIndex ) ) { indicesToUpdate . put ( neighborIndex , false ) ; } } } neighbors = editService . getIndexService ( ) . getAdjacentVertices ( event . getGeometry ( ) , index ) ; if ( neighbors != null ) { for ( GeometryIndex neighborIndex : neighbors ) { if ( ! indicesToUpdate . containsKey ( neighborIndex ) ) { indicesToUpdate . put ( neighborIndex , false ) ; } } } break ; case TYPE_EDGE : neighbors = editService . getIndexService ( ) . getAdjacentVertices ( event . getGeometry ( ) , index ) ; if ( neighbors != null ) { for ( GeometryIndex neighborIndex : neighbors ) { if ( ! indicesToUpdate . containsKey ( neighborIndex ) ) { indicesToUpdate . put ( neighborIndex , false ) ; } } } break ; default : } } catch ( GeometryIndexNotFoundException e ) { throw new IllegalStateException ( e ) ; } } } } // Check if we need to draw the background (nice, but slows down): if ( styleProvider . getBackgroundStyle ( ) != null && styleProvider . getBackgroundStyle ( ) . getFillOpacity ( ) > 0 ) { if ( event . getGeometry ( ) . getGeometryType ( ) . equals ( Geometry . POLYGON ) ) { update ( null , false ) ; } else if ( event . getGeometry ( ) . getGeometryType ( ) . equals ( Geometry . MULTI_POLYGON ) && event . getGeometry ( ) . getGeometries ( ) != null ) { for ( int i = 0 ; i < event . getGeometry ( ) . getGeometries ( ) . length ; i ++ ) { GeometryIndex index = editService . getIndexService ( ) . create ( GeometryIndexType . TYPE_GEOMETRY , i ) ; indicesToUpdate . put ( index , false ) ; } } } // Next, redraw the list: for ( GeometryIndex index : indicesToUpdate . keySet ( ) ) { update ( index , indicesToUpdate . get ( index ) ) ; } }
Figure out what s being moved and update only adjacent objects . This is far more performing than simply redrawing everything .