Ejemplo n.º 1
0
        /// <summary>
        /// Given a size, this will return the native symbolizer that has been adjusted to the specified size.
        /// </summary>
        /// <param name="size">The size of the symbol</param>
        /// <param name="color">The color of the symbol</param>
        /// <returns>The adjusted symbolizer.</returns>
        public IFeatureSymbolizer GetSymbolizer(double size, Color color)
        {
            IFeatureSymbolizer copy = Symbolizer.Copy();

            // preserve aspect ratio, larger dimension specified
            IPointSymbolizer ps = copy as IPointSymbolizer;

            if (ps != null)
            {
                Size2D s     = ps.GetSize();
                double ratio = size / Math.Max(s.Width, s.Height);
                s.Width  *= ratio;
                s.Height *= ratio;
                ps.SetSize(s);
                ps.SetFillColor(color);
            }

            ILineSymbolizer ls = copy as ILineSymbolizer;

            if (ls != null)
            {
                ls.SetWidth(size);
                ls.SetFillColor(color);
            }

            return(copy);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns a shallow copy of this category with the exception of
        /// the TextSymbolizer, which is duplicated.  This uses memberwise
        /// clone, so sublcasses using this method will return an appropriate
        /// version.
        /// </summary>
        /// <returns>A shallow copy of this object.</returns>
        public virtual LabelCategory Copy()
        {
            var result = MemberwiseClone() as LabelCategory;

            if (result == null)
            {
                return(null);
            }
            result.Symbolizer          = Symbolizer.Copy();
            result.SelectionSymbolizer = SelectionSymbolizer.Copy();
            return(result);
        }