Пример #1
0
        /// <summary>
        /// Ensures this style has a pen that is compatible with the supplied draw object.
        /// </summary>
        /// <param name="draw">The draw object</param>
        /// <returns>The corresponding pen</returns>
        internal ScaleSpecificPen GetPen(ISpatialDisplay draw)
        {
            if (IsScaleDependent)
            {
                if (m_Pen != null && m_Pen.IsCompatible(draw))
                {
                    return(m_Pen);
                }

                m_Pen = new ScaleSpecificPen(this, draw);
                return(m_Pen);
            }

            if (m_Pen == null)
            {
                m_Pen = new ScaleSpecificPen(this, draw);
            }

            return(m_Pen);
        }
Пример #2
0
        /// <summary>
        /// Defines the supplied pen with this style
        /// </summary>
        /// <param name="pen">The pen to define</param>
        /// <param name="draw">The definition of the draw</param>
        internal override void DefinePen(ScaleSpecificPen pen, ISpatialDisplay draw)
        {
            float fwt = (m_Weight > 0.0 ? draw.LengthToDisplay(m_Weight) : 0.0F);

            if (m_Pattern != null)
            {
                m_Pattern.DefinePen(pen.Pen, draw, fwt, new SolidBrush(this.Color));
            }

            // MUST be solid for anything that has non-zero weight
            //else if ((int)fwt != 0)
            //    pen.CreateSolidPen(fwt, this.Color);
            else
            {
                pen.CreateSolidPen(0.0F, this.Color);
                Pen p = pen.Pen;
                p.DashStyle = m_Style;
                p.Width     = fwt;
                p.StartCap  = LineCap.Round;
                p.EndCap    = LineCap.Round;
            }
        }
Пример #3
0
 /// <summary>
 /// Creates a new <c>Style</c> with the specified color (does not create the pen object).
 /// </summary>
 /// <param name="col">The display colour</param>
 internal Style(Color col)
 {
     m_Color = col;
     m_Pen   = null;
 }
Пример #4
0
 /// <summary>
 /// Defines the supplied pen with this style This implementation just defines a solid pen
 /// with this style's color and a width of 1 pixel.
 /// </summary>
 /// <param name="pen">The pen to define</param>
 internal void DefinePen(ScaleSpecificPen pen)
 {
     pen.CreateSolidPen(0, m_Color);
 }
Пример #5
0
 /// <summary>
 /// Defines the supplied pen with this style This implementation just defines a solid pen
 /// with this style's color and a width of 1 pixel. The <see cref="LineStyle"/> class
 /// provides an override that does more fancy pens.
 /// </summary>
 /// <param name="pen">The pen to define</param>
 /// <param name="draw">The definition of the draw (not used)</param>
 internal virtual void DefinePen(ScaleSpecificPen pen, ISpatialDisplay draw)
 {
     DefinePen(pen);
 }
Пример #6
0
 /// <summary>
 /// Defines the supplied pen with this style This implementation just defines a solid pen
 /// with this style's color and a width of 1 pixel.
 /// </summary> 
 /// <param name="pen">The pen to define</param>
 internal void DefinePen(ScaleSpecificPen pen)
 {
     pen.CreateSolidPen(0, m_Color);
 }
Пример #7
0
 /// <summary>
 /// Defines the supplied pen with this style This implementation just defines a solid pen
 /// with this style's color and a width of 1 pixel. The <see cref="LineStyle"/> class
 /// provides an override that does more fancy pens.
 /// </summary> 
 /// <param name="pen">The pen to define</param>
 /// <param name="draw">The definition of the draw (not used)</param>
 internal virtual void DefinePen(ScaleSpecificPen pen, ISpatialDisplay draw)
 {
     DefinePen(pen);
 }
Пример #8
0
 /// <summary>
 /// Creates a new <c>Style</c> with the specified color (does not create the pen object).
 /// </summary>
 /// <param name="col">The display colour</param>
 internal Style(Color col)
 {
     m_Color = col;
     m_Pen = null;
 }
Пример #9
0
        /// <summary>
        /// Ensures this style has a pen that is compatible with the supplied draw object.
        /// </summary>
        /// <param name="draw">The draw object</param>
        /// <returns>The corresponding pen</returns>
        internal ScaleSpecificPen GetPen(ISpatialDisplay draw)
        {
            if (IsScaleDependent)
            {
                if (m_Pen!=null && m_Pen.IsCompatible(draw))
                    return m_Pen;

                m_Pen = new ScaleSpecificPen(this, draw);
                return m_Pen;
            }

            if (m_Pen == null)
                m_Pen = new ScaleSpecificPen(this, draw);

            return m_Pen;
        }
Пример #10
0
        /// <summary>
        /// Defines the supplied pen with this style
        /// </summary>
        /// <param name="pen">The pen to define</param>
        /// <param name="draw">The definition of the draw</param>
        internal override void DefinePen(ScaleSpecificPen pen, ISpatialDisplay draw)
        {
            float fwt = (m_Weight > 0.0 ? draw.LengthToDisplay(m_Weight) : 0.0F);

            if (m_Pattern != null)
                m_Pattern.DefinePen(pen.Pen, draw, fwt, new SolidBrush(this.Color));

            // MUST be solid for anything that has non-zero weight
            //else if ((int)fwt != 0)
            //    pen.CreateSolidPen(fwt, this.Color);
            else
            {
                pen.CreateSolidPen(0.0F, this.Color);
                Pen p = pen.Pen;
                p.DashStyle = m_Style;
                p.Width = fwt;
                p.StartCap = LineCap.Round;
                p.EndCap = LineCap.Round;
            }
        }