Пример #1
0
        object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is SimpleMarkerSymbol)
            {
                return(Visibility.Visible);
            }

            ConfigurableFeatureLayer featureLayer = value as ConfigurableFeatureLayer;

            if (featureLayer != null)
            {
                return(featureLayer.GeometryType == GeometryType.Point ? Visibility.Visible : Visibility.Collapsed);
            }

            if (value is ConfigurableGraphicsLayer) // SharePoint list layer
            {
                return(Visibility.Visible);
            }
            return(Visibility.Collapsed);
        }
Пример #2
0
        public static Symbol GetDefaultSymbolForLayer(Layer layer)
        {
            GraphicsLayer graphicsLayer = layer as GraphicsLayer;

            if (graphicsLayer != null)
            {
                ClassBreaksRenderer renderer = graphicsLayer.Renderer as ClassBreaksRenderer;
                if (renderer != null)
                {
                    return(renderer.DefaultSymbol);
                }
                else
                {
                    ConfigurableFeatureLayer featureLayer = layer as ConfigurableFeatureLayer;
                    if (featureLayer != null)
                    {
                        if (featureLayer.FeatureSymbol != null)
                        {
                            return(featureLayer.FeatureSymbol);
                        }
                        else
                        {
                            // All Graphics share the same symbol. Return a reference to the first one
                            if (featureLayer.Graphics.Count > 0)
                            {
                                return(featureLayer.Graphics[0].Symbol);
                            }
                        }
                    }
                    else
                    {
                        // All Graphics share the same symbol. Return a reference to the first one
                        if (graphicsLayer.Graphics.Count > 0)
                        {
                            return(graphicsLayer.Graphics[0].Symbol);
                        }
                    }
                }
            }
            return(null);
        }
Пример #3
0
        object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is SimpleLineSymbol)
            {
                return(Visibility.Visible);
            }

            ConfigurableFeatureLayer featureLayer = value as ConfigurableFeatureLayer;

            if (featureLayer != null)
            {
                return(featureLayer.GeometryType == GeometryType.PolyLine ? Visibility.Visible : Visibility.Collapsed);
            }

            ClassBreakInfo classBreak = value as ClassBreakInfo;

            if (classBreak != null)
            {
                return(classBreak.Symbol is SimpleLineSymbol ? Visibility.Visible : Visibility.Collapsed);
            }

            return(Visibility.Collapsed);
        }