public static void PositionRaster(UIElement renderedGeometry, BoundingBox boundingBox, IViewport viewport) { UpdateRenderTransform(renderedGeometry, viewport); // since the render transform will take care of the rotation, calculate top-left using unrotated viewport var topLeft = viewport.WorldToScreenUnrotated(boundingBox.TopLeft); var rectWidthPixels = boundingBox.Width / viewport.Resolution; var rectHeightPixels = boundingBox.Height / viewport.Resolution; ((XamlMedia.RectangleGeometry)((XamlShapes.Path)renderedGeometry).Data).Rect = RoundToPixel(new Rect(topLeft.X, topLeft.Y, rectWidthPixels, rectHeightPixels)); }
public Point WorldToScreenUnrotated(double worldX, double worldY) { return(_viewport.WorldToScreenUnrotated(worldX, worldY)); }