src/main/java/de/blau/android/osm/StorageDelegator.java
/**
     * Rotate all nodes in a way, since the nodes keep their ids, the way itself doesn't change and doesn't need to be
     * saved apply translation only once to each node. Rotation is done in screen coords
     * 
     * @param way way to rotate
     * @param angle angle to rotate the way by
     * @param direction rotation direction
     * @param pivotX screen X coordinate of the pivot point
     * @param pivotY screen Y coordinate of the pivot point
     * @param w screen width
     * @param h screen height
     * @param v screen viewbox
     */
Rotate all nodes in a way, since the nodes keep their ids, the way itself doesn't change and doesn't need to be
saved apply translation only once to each node. Rotation is done in screen coords


Rotate all nodes in a way since the nodes keep their ids the way itself doesn ' t change and doesn ' t need to be saved apply translation only once to each node . Rotation is done in screen coords
public void rotateWay(@NonNull final Way way, final float angle, final int direction, final float pivotX, final float pivotY, int w, int h,
            @NonNull ViewBox v) {
        if (Float.isNaN(angle)) {
            Log.e(DEBUG_TAG, "rotateWay angle is NaN");
            return;
        }
        dirty = true;
        double cos = Math.cos(angle);
        double sin = Math.sin(angle);
        try {
            Set<Node> nodes = new HashSet<>(way.getNodes()); 
            invalidateWayBoundingBox(nodes);
            for (Node nd : nodes) {
                undo.save(nd);
                double nodeX = GeoMath.lonE7ToX(w, v, nd.getLon());
                double nodeY = GeoMath.latE7ToY(h, w, v, nd.getLat());
                double newX = pivotX + (nodeX - pivotX) * cos - direction * (nodeY - pivotY) * sin;
                double newY = pivotY + direction * (nodeX - pivotX) * sin + (nodeY - pivotY) * cos;
                updateLatLon(nd, GeoMath.yToLatE7(h, w, v, (float) newY), GeoMath.xToLonE7(w, v, (float) newX));
            }
        } catch (StorageException e) {
            Log.e(DEBUG_TAG, "rotateWay got " + e.getMessage());
        }
    }
public void rotateWay ( @ NonNull final Way way , final float angle , final int direction , final float pivotX , final float pivotY , int w , int h , @ NonNull ViewBox v ) { if ( Float . isNaN ( angle ) ) { Log . e ( DEBUG_TAG , "rotateWay angle is NaN" ) ; return ; } dirty = true ; double cos = Math . cos ( angle ) ; double sin = Math . sin ( angle ) ; try { Set < Node > nodes = new HashSet < > ( way . getNodes ( ) ) ; invalidateWayBoundingBox ( nodes ) ; for ( Node nd : nodes ) { undo . save ( nd ) ; double nodeX = GeoMath . lonE7ToX ( w , v , nd . getLon ( ) ) ; double nodeY = GeoMath . latE7ToY ( h , w , v , nd . getLat ( ) ) ; double newX = pivotX + ( nodeX - pivotX ) * cos - direction * ( nodeY - pivotY ) * sin ; double newY = pivotY + direction * ( nodeX - pivotX ) * sin + ( nodeY - pivotY ) * cos ; updateLatLon ( nd , GeoMath . yToLatE7 ( h , w , v , ( float ) newY ) , GeoMath . xToLonE7 ( w , v , ( float ) newX ) ) ; } } catch ( StorageException e ) { Log . e ( DEBUG_TAG , "rotateWay got " + e . getMessage ( ) ) ; } }
Rotate all nodes in a way, since the nodes keep their ids, the way itself doesn't change and doesn't need to be
 saved apply translation only once to each node.
Rotate all nodes in a way since the nodes keep their ids the way itself doesn ' t change and doesn ' t need to be saved apply translation only once to each node .
// Guarantee uniqueness // Don't call onElementChanged(null, new ArrayList<>(nodes)); // TODO handle OOM