This project has moved. For the latest updates, please go here.

Rotation on EllipseGeometry

Jun 29, 2015 at 4:40 PM
Hello,

First of all, many thanks for this great api.

I am trying to apply rotation to an EllipseGeometry doing like this :
<DataTemplate DataType="{x:Type al:EllipseVM}">
        <Canvas>
            <Canvas.RenderTransform>
                <TransformGroup>
                    <RotateTransform Angle="45"/>
                </TransformGroup>
            </Canvas.RenderTransform>

            <map:MapPanel>
                <Path x:Name="start" 
                  map:MapPanel.Location="{Binding Center}" 
                  Fill="Red"
                  Opacity="0.5">
                    <Path.Data>
                        <EllipseGeometry RadiusX="{Binding SemiMajorAxis}" RadiusY="{Binding SemiMinorAxis}" 
                                     Transform="{Binding Path=ScaleTransform, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type map:Map}}}">
                        </EllipseGeometry>
                    </Path.Data>
                </Path>
                <Canvas x:Name="polylineLabel"
                            map:MapPanel.Location="{Binding LabelLocation}"  
                            IsHitTestVisible="False"
                            Visibility="Visible" 
                             Margin="10,-10,0,0">
                    <views:TextPath Text="{Binding Label}" 
                                        FontSize="12" FontWeight="Normal"
                                        Fill="Red" 
                                        StrokeThickness="1" Stroke="Black" />
                </Canvas>
            </map:MapPanel>
        </Canvas>

    </DataTemplate>
The rotation is ok but the Location is not.
If i zoom in the location change and follow the zoom.

I suppose i am not doing it correctly, could you please help me (i tried to apply the render transform to the MapPanel with no success) ?
Coordinator
Jun 29, 2015 at 4:59 PM
Edited Jun 29, 2015 at 4:59 PM
Hard to tell. Is that DataTemplate used as the ItemTemplate of a MapItemsControl? The top-level Canvas may probably be replaced by a MapPanel.
Jun 30, 2015 at 9:00 AM
Yes, the dataTemplateis used as the ItemTemplate of a MapItemsControl that refer to the style inside a ressource dictionary.
No change with your proposal.

I also tried this :
<map:Map x:Name="SurpolMap" Grid.Column="0" Grid.ColumnSpan="2"
                 Center="{Binding MapCenter, Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged}"
                 TargetCenter="{Binding MapVM.TargetMapCenter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                 TargetZoomLevel="{Binding MapZoomLevel, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                 MaxZoomLevel="20" MinZoomLevel="1" 
                 TileLayer="{Binding MapVM.CurrentTileLayer}"
                 ManipulationInertiaStarting="MapManipulationInertiaStarting"
                 MouseMove="MapMouseMove"
                 MouseLeave="MapMouseLeave"
                 MouseDown="SurpolMap_MouseDown"                 
                 IsHitTestVisible="True">

            <!-- The graticule for the map  -->
            <map:MapGraticule Opacity="0.6" 
                                Visibility="{Binding ShowGraticule, Converter={StaticResource BooleanToVisibilityConverter}, 
                                Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>

            <map:MapItemsControl>
                <map:MapPanel>
                    <map:MapPanel.RenderTransform>
                        <TransformGroup>
                            <RotateTransform Angle="45"/>
                        </TransformGroup>
                    </map:MapPanel.RenderTransform>
                    <map:MapPanel>
                        <Path x:Name="start" 
                      map:MapPanel.Location="54.3, 0.2" 
                      Fill="Blue"
                      Opacity="0.5">
                            <Path.Data>
                                <EllipseGeometry RadiusX="1832000" RadiusY="832000" 
                                 Transform="{Binding Path=ScaleTransform, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type map:Map}}}"/>
                            </Path.Data>
                        </Path>
                    </map:MapPanel>
                </map:MapPanel>
            </map:MapItemsControl>

        </map:Map>
With no success.
Jun 30, 2015 at 9:05 AM
New Test :

I added the only the path to the Map with a render Transform and everything goes fine.

It seems to be linked to the MapPanel and MapItemControl.
Coordinator
Jun 30, 2015 at 10:27 AM
Edited Jun 30, 2015 at 10:28 AM
map:MapPanel.Location="{Binding Center}" has to be set on the item container (i.e. a MapItem), not on an element in the ItemTemplate. You'll have to set it in an ItemContainerStyle for MapItem, as shown in the sample applications:
<Style x:Key="PointItemStyle" TargetType="map:MapItem">
    <Setter Property="map:MapPanel.Location" Value="{Binding Location}"/>
    ...
</Style>
Jun 30, 2015 at 12:54 PM
Got it ;)

Thank you.

I also removed the MapPanel Container to complete.