This is my first question, but I suffered for a long time. I divided it into two parts, one part explaining what I am doing and why I think this is the way, the second of which is an actual question that I cannot solve for myself.
What am I doing? I am currently developing an environment for rendering two-dimensional functions intended for display in real time. You can come up with an application, such as Google Maps, in your browser, but the structure is designed to display all kinds of geographic data (and not just axis-oriented raster data such as Google Tiles).
The frame should be integrated into our (latest company product), which is a WPF application for desktops and laptops.
So I chose WPF to actually display the geometry; Culling visibility and occlusion are done by me, as well as input processing (mouse selection), camera movement, etc.
As a real-time application, it needs to achieve at least 30 FPS. The frame is adequate when rendering images: I can draw several thousand raster images per frame without problems, but polyatomic data is a serious problem.
Topical issue
I provide a large amount of polyline and polygonal data using WPF, in particular using DrawingContext and StreamGeometry. So far I understand that this is the way to go if I need performance. However, I cannot achieve the results that I expected from this.
This is how I populate StreamGeometry with actual data:
using (StreamGeometryContext ctx = Geometry.Open())
{
foreach (var segment in segments)
{
var first = ToWpf(segment[0]);
ctx.BeginFigure(first, false, false);
List<Point> points = segment.Skip(1).Select(ToWpf).ToList();
ctx.PolyLineTo(points, true, false);
}
}
Geometry.Freeze();
And this is how I draw my geometry:
_dc.PushTransform(_mercatorToView);
_dc.DrawGeometry(null, _pen, polyline);
_dc.Pop();
As a test, I downloaded ESRI forms from OpenStreetMap to my application to check its performance, however I am not satisfied at all: My test data consists of ~ 3500 line segments with a total length of ~ 20 thousand lines.
Comparing each segment with its own StreamGeometry does very poorly, but I kind of expected that already: rendering takes about 14 seconds.
StreamGeometry, :
80 StreamGeometry, 50 .
, . 100 . : 100 .
, , , ?
, DirectX , WPF, , - .
, : , , Google Maps : , . , , , Google , > 25 FPS, ; - .
*
, , . - Google, ( ).
*
, :
, : , , , , , .
"" . , : 30 FPS, . , , , , .
, -, MapInfo, , . , .
, , -. , : , , WPF .
, DrawingVisual , , , RenderOpened(). , , , .
: , - , , , , - ; , .
,
, , , , hickups, (, , , ) RenderOpen , .
, - ( googling ), , , hickup ( ), ( , , ) WPF DirectX.
, , WPF .