Ejemplo n.º 1
0
        /// <summary>
        /// Handles the rendering of icons used in the layer title and 'map manager'
        /// </summary>
        /// <param name="context">Identifies whether panel icon or layer list icon is requested</param>
        /// <returns>Icon for required LayerIconContext</returns>
        private UIElement RenderIcon(LayerIconContext context)
        {
            switch (context)
            {
                case LayerIconContext.PanelTitle:
                    {
                        // Return an image to be used for the layer title shown above the panel control on the left
                        Image image = new Image();

                        // As the image file is an embedded resource you need to add "/AssemblyName;component/" before the image path
                        image.Source = new BitmapImage(new Uri("/TweetHeatFinal;component/Resources/TweetHeatIcon.png", UriKind.Relative));
                        return image;
                    }

                case LayerIconContext.LayerList:
                    {
                        // Return a custom UIElement to be used in the 'map manager' using the basic pushpin control

                        // Create a pushpin primitive
                        PointPrimitive primitive = this.parent.PushpinFactoryContract.CreateStandardPushpin(new Location(0, 0));

                        // Use the layers color for the new pushpin control
                        if (this.Color.HasValue)
                        {
                            primitive.Color = this.Color;
                        }

                        // Render the pushpin primitive to a UIElement
                        UIElement element = primitive.Render(null);
                        return element;
                    }
            }

            return null;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Rendered icon for required LayerIconContext
        /// </summary>
        /// <param name="context">PanelTitle or LayerList(Manage Map/Legend)</param>
        /// <returns>Icon for required LayerIconContext</returns>
        private UIElement RenderIcon(LayerIconContext context)
        {
            switch (context)
            {
                case LayerIconContext.PanelTitle:
                    {
                        Image image = new Image();
                        image.Source = new BitmapImage(new Uri("/" + GetType().Namespace + ";component/Resources/TemplateIcon.png", UriKind.Relative));
                        return image;
                    }

                case LayerIconContext.LayerList:
                    {
                        // create a pushpin primitive
                        PointPrimitive primitive = this.parent.PushpinFactoryContract.CreateStandardPushpin(new Location());
                        if (this.Color.HasValue)
                        {
                            primitive.Color = this.Color;
                        }

                        // render the pushpin primitive to a UIElement
                        UIElement element = primitive.Render(null);
                        return element;
                    }
            }

            return null;
        }