Accelerated display limitations

4864
9
07-15-2012 05:03 PM
Labels (1)
BKuiper
Occasional Contributor III
Hi,

I'm aware that accelerated display still has some limitations, as mentioned here:
http://resources.arcgis.com/en/help/runtime-wpf/concepts/index.html#//01700000006s000000#ESRI_SECTIO...

but i'm not sure if this is a known issue.

I'm using the following style for my renderer:

    <esri:SimpleRenderer x:Key="MySimpleRendererLines">
        <esri:SimpleRenderer.Symbol>
            <esri:LineSymbol>
                <esri:LineSymbol.ControlTemplate>
                    <ControlTemplate>


                    </ControlTemplate>
                </esri:LineSymbol.ControlTemplate>
            </esri:LineSymbol>
        </esri:SimpleRenderer.Symbol>
    </esri:SimpleRenderer>


But this is not supported by the accelerated display, as it doesn't allow LineSymbol to be part of SimpleRenderer because LineSymbol is not IJsonSerializable.

I guess i could try to replace the LineSymbol template with a SimpleLineSymbol, but wasn't successful at that yet. Also a couple of your examples use LineSymbol instead of SimpleLineSymbol.

Any recommendations ?
0 Kudos
9 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

Any symbol which cannot be supported in the new accelerated display will raise a System.Argument exception with the message "Graphic Symbol is not serializable to JSON". The supported symbol types are esri SimpleMarkerSymbols, PictureMarkerSymbols, SimpleLineSymbols, and SimpleFillSymbols. Symbols with control templates are not supported.

If you would like to use custom symbols you can use the AcceleratedDisplayLayers group layer. Any layers outside this group (above or below in the layer stack) will be rendered by the standard WPF rendering engine.

Cheers

Mike
0 Kudos
BKuiper
Occasional Contributor III
Thanks for your quick reply Mike.

Just for your information, i'm templating the symbol so I can use the VisualStateManager.VisualStateGroups.
0 Kudos
AnttiKajanus1
Regular Contributor II
I have been thinking ways to leverage both Accelerated and non-Accelerated layers with graphics to work together to gain most of the performance out from drawing, so this is very interesting topic.

Since AcceleratedLayers does not support ControlTemplates so visual states and animations are out of the picture which makes ie. Selected state indication quite hard. So far the best solution that I have used is to work simultaneously with one accelerated layer and one normal layer and changing the graphic from layer to layer when selected. I haven't checked the performance with huge amount of graphics but this way I can use accelerated graphics when the graphic is in normal state and use animation when it is selected.

What do you guys think about this approach?

In this test I baked mouse click on the graphic in ViewModel to keep things simple and on click I change collection accordingly if the graphic is selected or not.

 <Window.Resources>
        <esri:SimpleRenderer x:Key="MySimpleRenderer">
            <esri:SimpleRenderer.Symbol>
                <esri:SimpleMarkerSymbol Color="Black" Size="10"/>
            </esri:SimpleRenderer.Symbol>
        </esri:SimpleRenderer>
        <esri:SimpleRenderer x:Key="SelectedRenderer">
            <esri:SimpleMarkerSymbol>
                <esri:SimpleMarkerSymbol.ControlTemplate>
                    <ControlTemplate>
                        <Grid Margin="-19,-19,0,0">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Selected">
                                        <Storyboard RepeatBehavior="Forever">
                                            <DoubleAnimation BeginTime="0"
                                                                 Storyboard.TargetName="ellipse" Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                                                 From="1" To="10" Duration="00:00:01" />


                                            <DoubleAnimation BeginTime="0"
                                                                 Storyboard.TargetName="ellipse" Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                                                 From="1" To="10" Duration="00:00:01" />


                                            <DoubleAnimation BeginTime="0"
                                                                 Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                 From="1" To="0" Duration="00:00:01" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Unselected" />
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Ellipse x:Name="ellipse" Width="10" Height="10" Stroke="Red" StrokeThickness="1" IsHitTestVisible="False" RenderTransformOrigin="0.5,0.5" >
                                <Ellipse.RenderTransform>
                                    <ScaleTransform />
                                </Ellipse.RenderTransform>
                                <Ellipse.Fill>
                                    <RadialGradientBrush>
                                        <GradientStop Color="#00FF0000" />
                                        <GradientStop Color="#FFFF0000" Offset="0.25"/>
                                        <GradientStop Color="#00FF0000" Offset="0.5"/>
                                        <GradientStop Color="#FFFF0000" Offset="0.75"/>
                                        <GradientStop Color="#00FF0000" Offset="1"/>
                                    </RadialGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                            <Ellipse Fill="Red" Width="38" Height="38" Stroke="White" StrokeThickness="1"/>
                        </Grid>
                    </ControlTemplate>
                </esri:SimpleMarkerSymbol.ControlTemplate>
            </esri:SimpleMarkerSymbol>
        </esri:SimpleRenderer>           
    </Window.Resources>


    <Grid>
        <esri:Map>
            <esri:Map.Resources>
                <local:DataContextProxy x:Key="proxy" Data="{Binding}"/>
            </esri:Map.Resources>
            <esri:AcceleratedDisplayLayers>
                <esri:ArcGISTiledMapServiceLayer ID="PhysicalTiledLayer" 
                      Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
                <esri:GraphicsLayer ID="MyGraphicsLayer" 
                    GraphicsSource="{Binding Path=Data.SearchResults, Source={StaticResource proxy}}" 
                    Renderer="{StaticResource MySimpleRenderer}" />
            </esri:AcceleratedDisplayLayers>
            <esri:GraphicsLayer ID="SelectedGraphics" 
                                GraphicsSource="{Binding Path=Data.SelectedGraphics, Source={StaticResource proxy}}" 
                                Renderer="{StaticResource SelectedRenderer}">
            </esri:GraphicsLayer>
        </esri:Map>      
    </Grid>


Edit: Added image

[ATTACH=CONFIG]16563[/ATTACH]
0 Kudos
AnttiKajanus1
Regular Contributor II
I would be very interested on benchmarks about WPF rendering and DirextX rendering in different cases.

One specific point would also be that what kind of overhead is to change a graphic or 100 graphics from WPF rendering to Accelerated rendering and vice verse.

Also I would pleased if someone from Runtime team could open a curtain what really happens when the WPF control is drawing stuff in DirectX and how the information ends up to DirectX rendering pipeline.
0 Kudos
ae
by
Occasional Contributor
When panning the map while using the accelerateddisplay with picturemarkersymbols I get a strange behaviour where the symbols seems to lag behind the panning for some while before they catch up again. I experience this not only in my own applications, but also when looking at the samples that comes with the SDK. Is it only me that experience this problem, and is there some way to overcome it?

Cheers
0 Kudos
BKuiper
Occasional Contributor III

After one and a half year this problem has resurfaced for the work i'm doing. When Accelerated Display is not used the highlighting that occurs through IsSelected doesn't work.

This is an issue when people are using Remote Desktop as DirectX is not supported through RDP.

Can anybody verify if this is still the case or that any new workaround has been established? Otherwise i will look into the approach Antti proposed.

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi Bjorn,

Welcome back!

In the WPF SDK the managed and native displays are two completely different rendering engines and there are unfortunately some unavoidable differences.

Is your project locked into the original WPF SDK or are you able to use the new .NET SDK?

Cheers

Mike

0 Kudos
BKuiper
Occasional Contributor III

Hi Mike,

thank you for the quick reply and welcoming me back! I will need to discuss this with the product owner as we have a major release coming up, so i don't expect us to switch just yet. I will keep you informed. Could you perhaps drop me an e-mail (or pm) so I have your email address again. That way i can chime you in on what we are doing.

Thanks!

0 Kudos
AnttiKajanus1
Regular Contributor II

Hey Bjorn,

It's good see that you are back in the forums too. You can contact me on akajanus esri.com and Mike mbranscomb esri.com

0 Kudos