Hi,
I want to display geometries from a custom graphic layer as in the sample I mentioned. The only difference is that I am developing using the WPF library and there are som differences from using ordinary WinForms.
Below is the code I want to "migrate" to WPF. And as I mentioned in my previous post there is no Draw method to override in the GraphicLayer class in wpf name space. OnRender is the closest thing I've found so far...
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using ESRI.ArcGIS.Mobile;
using ESRI.ArcGIS.Mobile.Geometries;
namespace CustomLayer_Win
{
public class CustomGraphicLayer: MapGraphicLayer
{
/// Defines a symbol class instance for displaying point
private Symbol m_pointSymbol;
/// Defines a CoordinateCollection instance to store custom features
private CoordinateCollection m_coordinateCollection = new CoordinateCollection();
/// Get or set coordinate collection stored in custom graphic layer
public CoordinateCollection Coordinates
{
get {
return m_coordinateCollection;
}
set {
m_coordinateCollection = value;
}
}
/// Initializes a new instance of custom graphic layer
public CustomGraphicLayer(): base("CustomGraphicLayer")
{
m_pointSymbol = new Symbol(
new PointPaintOperation(
Color.LightGreen, 2, 0, Color.LightGreen, 50, 25, PointPaintStyle.Circle));
}
/// Draw method being called after adding to map
protected override void Draw(Display display)
{
//return if display is null
if (display == null)
return;
//return if drawing is cancelled
if (display.DrawingCanceled)
return;
//draw coordinate collection using DrawMultipoint method
m_pointSymbol.DrawMultipoint(display, m_coordinateCollection);
}
protected override void Dispose(bool disposing)
{
//Dispose symbol implementing IDisposible
try
{
if (disposing)
{
if (m_pointSymbol != null)
m_pointSymbol.Dispose();
m_pointSymbol = null;
m_coordinateCollection = null;
}
}
finally
{
base.Dispose(disposing);
}
}
}
}