<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Simple Picture Marker Rotate in ArcGIS Runtime SDK for WPF (Retired) Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/simple-picture-marker-rotate/m-p/750500#M3752</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's an example of how you could achieve this with a GraphicsLayer / FeatureLayer. It involves creating a unique value renderer with values from 0-360 and creating the same number of picture marker symbols, each rotated by one degree. Then assign the UVR to a graphics layer (in this cases I�??ve just added 100 graphics, each with an "Angle" property of between 0 and 360). If you weren't so concerned about each individual angle, you could use a ClassBreaksRenderer for ranges of angle values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
GraphicsLayer _graphicsLayer;

// Create an ImageBrush
ImageBrush simpleArrow = new ImageBrush();
simpleArrow.ImageSource = new BitmapImage(new Uri("pack://application:,,,/Images/SimpleArrow.png", UriKind.Absolute));
// Found an image on http://www.iconfinder.com/search/?q=simple+arrow

// Add an Ellipse Element &amp;amp; use the ImageBrush as the Fill for the Ellipse
Ellipse myEllipse = new Ellipse();
myEllipse.Fill = simpleArrow;
myEllipse.HorizontalAlignment = HorizontalAlignment.Center;
myEllipse.VerticalAlignment = VerticalAlignment.Center;
myEllipse.Width = 24;
myEllipse.Height = 24;

// Create a UniqueValueRenderer based on the Angle attribute/field in the underlying data
var renderer = new UniqueValueRenderer()
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; Field = "Angle",
};

// Create UniqueValueInfo objects for each integer value 0-360 and an associated PictureMarkerSymbol for each one, rotated to that value.
for (int i = 0; i &amp;lt; 361; i++)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Rotate by the angle 0-360 and about the center of the 24x24 pixel image.
&amp;nbsp;&amp;nbsp;&amp;nbsp; myEllipse.RenderTransform = new RotateTransform(i,12,12);

&amp;nbsp;&amp;nbsp;&amp;nbsp; //Force a render
&amp;nbsp;&amp;nbsp;&amp;nbsp; myEllipse.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
&amp;nbsp;&amp;nbsp;&amp;nbsp; myEllipse.Arrange(new Rect(myEllipse.DesiredSize));
&amp;nbsp;&amp;nbsp;&amp;nbsp; RenderTargetBitmap render = new RenderTargetBitmap(34, 34, 96, 96, PixelFormats.Default);
&amp;nbsp;&amp;nbsp;&amp;nbsp; render.Render(myEllipse);

&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create a PictureMarkerSymbol
&amp;nbsp;&amp;nbsp;&amp;nbsp; PictureMarkerSymbol pms = new PictureMarkerSymbol()
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Source = render,
&amp;nbsp;&amp;nbsp;&amp;nbsp; };

&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create the UniqueValueInfo
&amp;nbsp;&amp;nbsp;&amp;nbsp; UniqueValueInfo uniqueValueInfo = new UniqueValueInfo() 
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value = i,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Symbol = pms,
&amp;nbsp;&amp;nbsp;&amp;nbsp; };
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Add the UniqueValueInfo to the Infos property on the renderer
&amp;nbsp;&amp;nbsp;&amp;nbsp; renderer.Infos.Add(uniqueValueInfo);
}

// Create a new GraphicsLayer 
_graphicsLayer = new GraphicsLayer();

&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create a instance of the Random class to generate random coordinate pairs.
Random random = new Random();

// Add graphics to a List&amp;lt;Graphic&amp;gt; 
var graphicsList = new List&amp;lt;Graphic&amp;gt;();
for (int i = 0; i &amp;lt; 100; i++)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; var x = (random.NextDouble() * 40000000) - 20000000;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var y = (random.NextDouble() * 40000000) - 20000000;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var graphic = new Graphic()
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // assign each graphic a number 0, 1, 2 - we''ll use this to represent he color
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Geometry = new MapPoint(x, y),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Attributes = { { "Angle", random.Next(0,361)} }
&amp;nbsp;&amp;nbsp;&amp;nbsp; };
&amp;nbsp;&amp;nbsp;&amp;nbsp; graphicsList.Add(graphic);
}

// Set the renderer
_graphicsLayer.Renderer = renderer;

// Bulk add of graphics - more efficient than adding one graphic at a time
_graphicsLayer.Graphics.AddRange(graphicsList);

// Add layer to Map
MyMap.Layers.Add(_graphicsLayer);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 07:52:25 GMT</pubDate>
    <dc:creator>MichaelBranscomb</dc:creator>
    <dc:date>2021-12-12T07:52:25Z</dc:date>
    <item>
      <title>Simple Picture Marker Rotate</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/simple-picture-marker-rotate/m-p/750498#M3750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Would like to rotate symbol based on attributes, any one have any ideas have not seen any angle in the Docs.&amp;nbsp; Maybe using the ControlTemplate and then just setting the rendertransform?? not sure?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Apr 2013 16:31:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/simple-picture-marker-rotate/m-p/750498#M3750</guid>
      <dc:creator>BrianLocke</dc:creator>
      <dc:date>2013-04-11T16:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Picture Marker Rotate</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/simple-picture-marker-rotate/m-p/750499#M3751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rotating symbols based on an attribute is on the roadmap for a future release but in the mean time the best alternative is to create a renderer which will . This will depend on how many discrete values you have - you could use a UniqueValueRenderer for specific values (e.g. 0, 90, 180, 270) or a ClassBreaksRenderer for ranges of values (0-90, 91-180, 181-270, 271-360).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For an example, take a look at &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/runtime-wpf/samples/index.html#/Rendering_with_XAML/02q200000036000000/"&gt;http://resources.arcgis.com/en/help/runtime-wpf/samples/index.html#/Rendering_with_XAML/02q200000036000000/&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would recommend avoiding ControlTemplating symbols because this is not supported in the hardware accelerated display (i.e. when you set Map.UseAcceleratedDisplay to True).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can programmatically create symbols too - that's just given me a great idea for a new sample. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Apr 2013 10:06:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/simple-picture-marker-rotate/m-p/750499#M3751</guid>
      <dc:creator>MichaelBranscomb</dc:creator>
      <dc:date>2013-04-12T10:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Picture Marker Rotate</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/simple-picture-marker-rotate/m-p/750500#M3752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's an example of how you could achieve this with a GraphicsLayer / FeatureLayer. It involves creating a unique value renderer with values from 0-360 and creating the same number of picture marker symbols, each rotated by one degree. Then assign the UVR to a graphics layer (in this cases I�??ve just added 100 graphics, each with an "Angle" property of between 0 and 360). If you weren't so concerned about each individual angle, you could use a ClassBreaksRenderer for ranges of angle values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
GraphicsLayer _graphicsLayer;

// Create an ImageBrush
ImageBrush simpleArrow = new ImageBrush();
simpleArrow.ImageSource = new BitmapImage(new Uri("pack://application:,,,/Images/SimpleArrow.png", UriKind.Absolute));
// Found an image on http://www.iconfinder.com/search/?q=simple+arrow

// Add an Ellipse Element &amp;amp; use the ImageBrush as the Fill for the Ellipse
Ellipse myEllipse = new Ellipse();
myEllipse.Fill = simpleArrow;
myEllipse.HorizontalAlignment = HorizontalAlignment.Center;
myEllipse.VerticalAlignment = VerticalAlignment.Center;
myEllipse.Width = 24;
myEllipse.Height = 24;

// Create a UniqueValueRenderer based on the Angle attribute/field in the underlying data
var renderer = new UniqueValueRenderer()
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; Field = "Angle",
};

// Create UniqueValueInfo objects for each integer value 0-360 and an associated PictureMarkerSymbol for each one, rotated to that value.
for (int i = 0; i &amp;lt; 361; i++)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Rotate by the angle 0-360 and about the center of the 24x24 pixel image.
&amp;nbsp;&amp;nbsp;&amp;nbsp; myEllipse.RenderTransform = new RotateTransform(i,12,12);

&amp;nbsp;&amp;nbsp;&amp;nbsp; //Force a render
&amp;nbsp;&amp;nbsp;&amp;nbsp; myEllipse.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
&amp;nbsp;&amp;nbsp;&amp;nbsp; myEllipse.Arrange(new Rect(myEllipse.DesiredSize));
&amp;nbsp;&amp;nbsp;&amp;nbsp; RenderTargetBitmap render = new RenderTargetBitmap(34, 34, 96, 96, PixelFormats.Default);
&amp;nbsp;&amp;nbsp;&amp;nbsp; render.Render(myEllipse);

&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create a PictureMarkerSymbol
&amp;nbsp;&amp;nbsp;&amp;nbsp; PictureMarkerSymbol pms = new PictureMarkerSymbol()
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Source = render,
&amp;nbsp;&amp;nbsp;&amp;nbsp; };

&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create the UniqueValueInfo
&amp;nbsp;&amp;nbsp;&amp;nbsp; UniqueValueInfo uniqueValueInfo = new UniqueValueInfo() 
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value = i,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Symbol = pms,
&amp;nbsp;&amp;nbsp;&amp;nbsp; };
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Add the UniqueValueInfo to the Infos property on the renderer
&amp;nbsp;&amp;nbsp;&amp;nbsp; renderer.Infos.Add(uniqueValueInfo);
}

// Create a new GraphicsLayer 
_graphicsLayer = new GraphicsLayer();

&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create a instance of the Random class to generate random coordinate pairs.
Random random = new Random();

// Add graphics to a List&amp;lt;Graphic&amp;gt; 
var graphicsList = new List&amp;lt;Graphic&amp;gt;();
for (int i = 0; i &amp;lt; 100; i++)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; var x = (random.NextDouble() * 40000000) - 20000000;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var y = (random.NextDouble() * 40000000) - 20000000;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var graphic = new Graphic()
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // assign each graphic a number 0, 1, 2 - we''ll use this to represent he color
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Geometry = new MapPoint(x, y),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Attributes = { { "Angle", random.Next(0,361)} }
&amp;nbsp;&amp;nbsp;&amp;nbsp; };
&amp;nbsp;&amp;nbsp;&amp;nbsp; graphicsList.Add(graphic);
}

// Set the renderer
_graphicsLayer.Renderer = renderer;

// Bulk add of graphics - more efficient than adding one graphic at a time
_graphicsLayer.Graphics.AddRange(graphicsList);

// Add layer to Map
MyMap.Layers.Add(_graphicsLayer);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:52:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/simple-picture-marker-rotate/m-p/750500#M3752</guid>
      <dc:creator>MichaelBranscomb</dc:creator>
      <dc:date>2021-12-12T07:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Picture Marker Rotate</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/simple-picture-marker-rotate/m-p/750501#M3753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mike,&lt;BR /&gt;I've just run into this myself. While your solution looks like it will work for me, you mention that this was on the roadmap for the runtime sdk. As it's been a couple years since this post, I was wondering what the current status of this is?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;-Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 18:53:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/simple-picture-marker-rotate/m-p/750501#M3753</guid>
      <dc:creator>ChrisPyle</dc:creator>
      <dc:date>2015-04-03T18:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Picture Marker Rotate</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/simple-picture-marker-rotate/m-p/750502#M3754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes it was added to the WPF SDK as a property on renderers - the links below relate to the SimpleRenderer:&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/runtime-wpf/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.SimpleRenderer~RotationExpression.html" title="http://resources.arcgis.com/en/help/runtime-wpf/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.SimpleRenderer~RotationExpression.html"&gt;RotationExpression Property&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/runtime-wpf/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.SimpleRenderer~RotationType.html" title="http://resources.arcgis.com/en/help/runtime-wpf/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.SimpleRenderer~RotationType.html"&gt;RotationType Property&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And you will also find it in the new .NET SDK - again the example here is for a SimpleRenderer:&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/net/desktop/api-reference//html/P_Esri_ArcGISRuntime_Symbology_SimpleRenderer_RotationExpression.htm" title="https://developers.arcgis.com/net/desktop/api-reference//html/P_Esri_ArcGISRuntime_Symbology_SimpleRenderer_RotationExpression.htm"&gt;SimpleRenderer.RotationExpression Property&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/net/desktop/api-reference//html/P_Esri_ArcGISRuntime_Symbology_SimpleRenderer_RotationType.htm" title="https://developers.arcgis.com/net/desktop/api-reference//html/P_Esri_ArcGISRuntime_Symbology_SimpleRenderer_RotationType.htm"&gt;SimpleRenderer.RotationType Property&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2015 09:04:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/simple-picture-marker-rotate/m-p/750502#M3754</guid>
      <dc:creator>MichaelBranscomb</dc:creator>
      <dc:date>2015-04-08T09:04:21Z</dc:date>
    </item>
  </channel>
</rss>

