ArcGIS Wpf MarkerSymbol 图形符号无法序列化为 JSON
【问题贴,尚不知如何解决】
在GraphicsLayer中添加一个点,使用自定义模板渲染该点,在Vs2012设计界面可以看到,但运行时出现异常
代码如下:
<esri:Graphic x:Name="MyGrapic" >
<esri:Graphic.Geometry>
<esri:MapPoint X="120.198704" Y="35.957860" >
<esri:MapPoint.SpatialReference>
<esri:SpatialReference WKID=""/>
</esri:MapPoint.SpatialReference>
</esri:MapPoint>
</esri:Graphic.Geometry>
<esri:Graphic.Symbol>
<esri:MarkerSymbol>
<esri:MarkerSymbol.ControlTemplate>
<ControlTemplate>
<Image Source="Images\addvector.png"></Image>
</ControlTemplate>
</esri:MarkerSymbol.ControlTemplate>
</esri:MarkerSymbol>
</esri:Graphic.Symbol>
</esri:Graphic>
异常信息:
未处理System.ArgumentException
HResult=-
Message=图形符号无法序列化为 JSON
Source=ESRI.ArcGIS.Client
StackTrace:
在 ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.GetSymbolJson(Graphic graphic)
在 ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.SerializeGraphic(Graphic graphic, Geometry displayGeometry, BinaryWriter output)
在 ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.<>c__DisplayClass6.<AddGraphics>b__5(BinaryWriter w)
在 ESRI.ArcGIS.Client.Utils.BinaryWriterExtensions.Write(Action` writeAction)
在 ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.AddGraphics(IEnumerable` graphicGeometryPairs)
在 ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.AddGraphics()
在 ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.Initialize()
在 ESRI.ArcGIS.Client.NativeMap.AddLayer(Int32 index, Layer layer)
在 ESRI.ArcGIS.Client.DrawingSurface.AddLayer(Int32 index, Layer layer)
在 ESRI.ArcGIS.Client.DrawingSurface.FindIndexAndAddLayer(Layer layer, IList` collection)
在 ESRI.ArcGIS.Client.Map.TryAddLayerToDrawSurface(Layer layer)
在 ESRI.ArcGIS.Client.Map.layer_Initialized(Object sender, EventArgs e)
在 System.EventHandler`.Invoke(Object sender, TEventArgs e)
在 ESRI.ArcGIS.Client.Layer.OnInitialized(EventArgs e)
在 ESRI.ArcGIS.Client.Layer.Initialize()
在 ESRI.ArcGIS.Client.Map.OnApplyTemplate()
在 System.Windows.FrameworkElement.ApplyTemplate()
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Controls.Grid.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Controls.Grid.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
在 System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Controls.Border.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Window.MeasureOverrideHelper(Size constraint)
在 System.Windows.Window.MeasureOverride(Size availableSize)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Interop.HwndSource.SetLayoutSize()
在 System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
在 System.Windows.Window.SetRootVisualAndUpdateSTC()
在 System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
在 System.Windows.Window.CreateSourceWindow(Boolean duringShow)
在 System.Windows.Window.ShowHelper(Object booleanBox)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
在 System.Windows.Threading.DispatcherOperation.InvokeImpl()
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Windows.Threading.DispatcherOperation.Invoke()
在 System.Windows.Threading.Dispatcher.ProcessQueue()
在 System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
在 System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
在 MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
在 System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
在 System.Windows.Application.RunInternal(Window window)
在 System.Windows.Application.Run()
在 ArcGISWpfApplication1.App.Main() 位置 e:\-LituGaoke\ProjectCode\2015Projects\IOS\IOS\obj\Debug\Application.g.cs:行号
在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
在 System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
InnerException:
官方Api也是这么写的:
http://resources.arcgis.com/en/help/runtime-wpf/apiref/index.html - ESRI.ArcGIS.Client.Symbols Namespace : Symbol Class
<esriSymbols:MarkerSymbol OffsetX="" OffsetY="">
<esriSymbols:MarkerSymbol.ControlTemplate>
<ControlTemplate>
<Border Width="" Height="" CornerRadius=""
BorderBrush="Black" BorderThickness=""
Background="Blue">
<Image Source="myImage.png" />
</Border>
</ControlTemplate>
</esriSymbols:MarkerSymbol.ControlTemplate>
</esriSymbols:MarkerSymbol>
有遇到了另一个问题,使用<esri:PictureMarkerSymbol.ControlTemplate>自定义PictureMarkerSymbol,报出“不支持所指定方法”,异常信息如下:
未处理System.NotSupportedException
HResult=-
Message=不支持所指定的方法。
Source=ESRI.ArcGIS.Client
StackTrace:
在 ESRI.ArcGIS.Client.Symbols.PictureMarkerSymbol.ToJsonInternal(Boolean nativeMapSerialization)
在 ESRI.ArcGIS.Client.Symbols.PictureMarkerSymbol.ESRI.ArcGIS.Client.IJsonSerializableNativeDisplay.ToNativeDisplayJson()
在 ESRI.ArcGIS.Client.JsonSerializableExtensions.SerializeToJson(Object o, Boolean nativeDisplay)
在 ESRI.ArcGIS.Client.SimpleRenderer.ToJsonInternal(Boolean nativeDisplay)
在 ESRI.ArcGIS.Client.SimpleRenderer.ESRI.ArcGIS.Client.IJsonSerializableNativeDisplay.ToNativeDisplayJson()
在 ESRI.ArcGIS.Client.JsonSerializableExtensions.SerializeToJson(Object o, Boolean nativeDisplay)
在 ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.UpdateRenderer()
在 ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.OnPropertyChanged(String propertyName)
在 ESRI.ArcGIS.Client.Runtime.NativeLayer.layer_PropertyChanged(Object sender, PropertyChangedEventArgs e)
在 System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)
在 ESRI.ArcGIS.Client.Layer.OnPropertyChanged(String propertyName)
在 ESRI.ArcGIS.Client.GraphicsLayer.set_Renderer(IRenderer value)
在 IOS.MainWindow.LbxFuntion_OnSelectionChanged(Object sender, SelectionChangedEventArgs e) 位置 e:\-LituGaoke\ProjectCode\2015Projects\IOS\IOS\MainWindow.xaml.cs:行号
在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
在 System.Windows.Controls.ListBox.OnSelectionChanged(SelectionChangedEventArgs e)
在 System.Windows.Controls.Primitives.Selector.SelectionChanger.End()
在 System.Windows.Controls.Primitives.Selector.SetSelectedHelper(Object item, FrameworkElement UI, Boolean selected)
在 System.Windows.Controls.Primitives.Selector.NotifyIsSelectedChanged(FrameworkElement container, Boolean selected, RoutedEventArgs e)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
在 System.Windows.Controls.ListBoxItem.OnSelected(RoutedEventArgs e)
在 System.Windows.Controls.ListBoxItem.OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
在 System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
在 System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
在 System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
在 System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
在 System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
在 System.Windows.DependencyObject.SetCurrentValueInternal(DependencyProperty dp, Object value)
在 System.Windows.Controls.ListBox.NotifyListItemClicked(ListBoxItem item, MouseButton mouseButton)
在 System.Windows.Controls.ListBoxItem.OnMouseLeftButtonDown(MouseButtonEventArgs e)
在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
在 System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
在 System.Windows.Input.InputManager.ProcessStagingArea()
在 System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
在 System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
在 System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
在 System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
在 MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
在 System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
在 System.Windows.Application.RunInternal(Window window)
在 System.Windows.Application.Run()
在 ArcGISWpfApplication1.App.Main() 位置 e:\-LituGaoke\ProjectCode\2015Projects\IOS\IOS\obj\Debug\Application.g.cs:行号
在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
在 System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
InnerException:
ArcGIS Wpf MarkerSymbol 图形符号无法序列化为 JSON的更多相关文章
- ArcGIS 添加 MarkerSymbol 弹出“图形符号无法序列化为 JSON”错误
今天在做一个demo,向自定义图层中添加MarkerSymbol的时候,弹出“图形符号无法序列化为 JSON”错误,之前都没有出现过这个问题,我们首先来看一看我是怎样去添加图层,然后向图层中添加Gra ...
- ArcGIS Runtime SDK for WPF之SimpleRenderer无法添加、报错“图形符号无法序列化为 JSON”
ArcGIS Runtime SDK for WPF之SimpleRenderer无法添加.报错“图形符号无法序列化为 JSON” 在上一篇博文中如果在 esri:Map 里面是否设置了的UseAcc ...
- Jquery 将表单序列化为Json对象
大家知道Jquery中有serialize方法,可以将表单序列化为一个“&”连接的字符串,但却没有提供序列化为Json的方法.不过,我们可以写一个插件实现. 我在网上看到有人用替换的方法,先用 ...
- 使用DataContractJsonSerializer类将类型实例序列化为JSON字符串和反序列化为实例对象 分类: JSON 前端 2014-11-10 10:20 97人阅读 评论(1) 收藏
一.JSON简介 JSON(JavaScript Object Notation,JavaScript对象表示法)是一种轻量级的数据交换格式. JSON是"名值对"的集合.结构由大 ...
- jQuery表单验证以及将表单序列化为json对象小练习
jquery表单验证(非实时验证),同时,将表单序列化为json对象提交表单. <!DOCTYPE html> <html lang="en"> <h ...
- JavaScriptSerializer类 对象序列化为JSON,JSON反序列化为对象
JavaScriptSerializer 类由异步通信层内部使用,用于序列化和反序列化在浏览器和 Web 服务器之间传递的数据.说白了就是能够直接将一个C#对象传送到前台页面成为javascript对 ...
- 将Dictionary序列化为json数据 、json数据反序列化为Dictionary
需要引用System.Web.Extensions dll类库 /// <summary> /// 将json数据反序列化为Dictionary /// </summary> ...
- 类对象序列化为json串,json串反序列化为类对象
1.类对象序列化为json串: 方法一: class P(object): def __init__(self,name,age,sex): self.name=name self.age=age s ...
- 将表单序列化为JSON对象
将表单序列化为JSON对象的工具方法: $(function() { //工具方法,可以将指定的表单中的输入项目序列化为JSON数据 $.fn.serializeJson = function() { ...
随机推荐
- moment.js 的简单应用
moment.js :时间处理的组件 例子:moment.html <!DOCTYPE html> <html> <head> <title>mome ...
- 11 TCP/IP 基础与Linux的网络配置
1. TCP/IP与OSI参考模型 TCP/IP是Unix/Linux世界的网络基础,在某种意义上Unix网络就是TCP/IP,而TCP/IP就是网络互联的标准.它不是一个独立的协议,而是一组协议.其 ...
- python 实现二分法查找
二分查找图 二叉树: 代码 #!/usr/bin/python #-*-coding:utf-8-*- #----------------------------------------------- ...
- 操作系统中前台进程与后台进程(适用于Linux)
两种进程的主要区别: 1.前台进程用户可以操作,后台进程用户不能操作(除了把它关闭). 2.前台进程不全是由计算机自动控制,后台进程全都是由计算机自动控制. 3.后台进程一般用作系统服务,可以用cro ...
- UML精粹4 - 对象图,包图,部署图,用例
对象图object diagram 对象图是某个时间点上的对象在系统中的快照,也经常被称为实例图.一般在展示组合对象结构时比较有用.例如 组合结构的类图 一个时刻的对象图 包图package diag ...
- 子类实例化和Super
在子类的构造函数当中,必须调用父类的构造函数,通过super的参数个数和类型来决定调用父类哪一个构造函数. class Student extends Person{ Student(){ super ...
- KVO/KVC 实现机理分析
来源:http://blog.csdn.net/dqjyong/article/details/7672865 Objective-C里面的Key-Value Observing (KVO)机制,非常 ...
- springmvc视图解析流程
无论目标方法返回String.VIew或者是ModelAndView,springmvc都会转化成ModelAndView 然后通过视图解析器(如InternalResouceViewResolver ...
- Java中的异常-Throwable-Error-Exception-RuntimeExcetpion-throw-throws-try catch
今天在做一个将String转换为Integer的功能时,发现Integer.parseInte()会抛出异常NumberFormatException. 函数Integer.parseInt(Stri ...
- Chap6: question38 - 42
38. 数字 k 在有序数组中出现的次数 二分查找:找出第一个 k 和最后一个 k . #include <iostream> using namespace std; int getFi ...