Пример #1
0
 public object CreateElement(InitializeContext context)
 {
     return(typeConverter.ConvertFrom(namespaces, sourceUri, valueFactory.CreateElement(context)));
 }
Пример #2
0
 public void InitializeElement(object element, InitializeContext context)
 {
     propertyAdapter.SetValue(element, propertyValueFactory.CreateElement(context), context.ValueSource);
 }
Пример #3
0
 public object CreateElement(InitializeContext context)
 {
     return(((IMarkupExtension)valueFactory.CreateElement(context)).ProvideValue(context));
 }
Пример #4
0
        /// <summary>
        /// 添加图元
        /// </summary>
        /// <param name="layerName">图层名称</param>
        /// <param name="kml">Kml对象</param>
        /// <returns></returns>
        public IMFElement AddElement(string layerName, Kml kml)
        {
            if (kml == null)
            {
                return(null);
            }
            if (kml.Placemark == null)
            {
                return(null);
            }
            if (kml.Placemark.Graph == null)
            {
                return(null);
            }
            if (string.IsNullOrEmpty(kml.Placemark.Name))
            {
                return(null);
            }

            var layer = layerMgr.GetLayer(layerName);

            if (layer == null)
            {
                return(null);
            }

            IElementFactory elementFactory = null;
            Type            type           = kml.Placemark.Graph.GetType();

            // 点
            if (type == typeof(KmlPoint))
            {
                elementFactory = pointFac;
            }
            // 线
            else if (type == typeof(KmlLineString))
            {
                elementFactory = lineFac;
            }
            // 面
            else if (type == typeof(KmlPolygon))
            {
                elementFactory = polygonFac;
            }
            // 文字
            else if (type == typeof(KmlText))
            {
                elementFactory = textFac;
            }
            // 圆
            else if (type == typeof(KmlCircle))
            {
                elementFactory = circleFac;
            }
            // 三维模型
            else if (type == typeof(KmlModel3d))
            {
                elementFactory = model3dFac;
            }

            if (elementFactory == null)
            {
                return(null);
            }

            IMFElement element = elementFactory.CreateElement(kml, layer);

            if (element != null)
            {
                element.ElementName = kml.Placemark.Name;
            }
            return(element);
        }
Пример #5
0
 public object CreateElement(InitializeContext context)
 {
     return(TypeConverter.ConvertValue(valueFactory.CreateElement(context), ElementType, namespaces));
 }