Exemplo n.º 1
0
        public MarkerStyleAttrib GetMarkerStyleAttrib(MapGraphics g)
        {
            MarkerStyleAttrib markerStyleAttrib = new MarkerStyleAttrib();

            if (!string.IsNullOrEmpty(this.Image))
            {
                return(markerStyleAttrib);
            }
            float absoluteDimension  = g.GetAbsoluteDimension(this.MarkerLength);
            float absoluteDimension2 = g.GetAbsoluteDimension(this.Width);

            markerStyleAttrib.path = g.CreateMarker(new PointF(0f, 0f), absoluteDimension2, absoluteDimension, this.MarkerStyle);
            float num = 0f;

            if (this.Placement == Placement.Cross || this.Placement == Placement.Inside)
            {
                num = (float)(num + 180.0);
            }
            if (this.GetGauge().GetOrientation() == Orientation.Vertical)
            {
                num = (float)(num + 270.0);
            }
            if (num > 0.0)
            {
                using (Matrix matrix = new Matrix())
                {
                    matrix.Rotate(num);
                    markerStyleAttrib.path.Transform(matrix);
                }
            }
            float       num2              = this.CalculateMarkerDistance();
            LinearScale scale             = this.GetScale();
            float       positionFromValue = scale.GetPositionFromValue(scale.GetValueLimit(this.Position));
            PointF      pointOrigin       = Point.Empty;

            pointOrigin             = ((this.GetGauge().GetOrientation() != 0) ? g.GetAbsolutePoint(new PointF(num2, positionFromValue)) : g.GetAbsolutePoint(new PointF(positionFromValue, num2)));
            markerStyleAttrib.brush = g.GetMarkerBrush(markerStyleAttrib.path, this.MarkerStyle, pointOrigin, 0f, this.FillColor, this.FillGradientType, this.FillSecondaryColor, this.FillHatchStyle);
            using (Matrix matrix2 = new Matrix())
            {
                matrix2.Translate(pointOrigin.X, pointOrigin.Y, MatrixOrder.Append);
                markerStyleAttrib.path.Transform(matrix2);
                return(markerStyleAttrib);
            }
        }
Exemplo n.º 2
0
 public void Render(MapGraphics g)
 {
     if (this.Common != null && this.Visible && this.GetScale() != null)
     {
         g.StartHotRegion(this);
         if (!string.IsNullOrEmpty(this.Image))
         {
             this.DrawImage(g, false);
             g.EndHotRegion();
         }
         else
         {
             Pen pen = new Pen(this.BorderColor, (float)this.BorderWidth);
             pen.DashStyle = MapGraphics.GetPenStyle(this.BorderStyle);
             if (pen.DashStyle != 0)
             {
                 pen.Alignment = PenAlignment.Center;
             }
             MarkerStyleAttrib markerStyleAttrib = this.GetMarkerStyleAttrib(g);
             try
             {
                 if (markerStyleAttrib.path != null)
                 {
                     bool circularFill = (byte)((this.MarkerStyle == MarkerStyle.Circle) ? 1 : 0) != 0;
                     g.FillPath(markerStyleAttrib.brush, markerStyleAttrib.path, 0f, true, circularFill);
                 }
                 if (this.BorderWidth > 0 && markerStyleAttrib.path != null)
                 {
                     g.DrawPath(pen, markerStyleAttrib.path);
                 }
             }
             catch (Exception)
             {
                 markerStyleAttrib.Dispose();
             }
             if (markerStyleAttrib.path != null)
             {
                 this.Common.MapCore.HotRegionList.SetHotRegion(g, this, markerStyleAttrib.path);
             }
             g.EndHotRegion();
         }
     }
 }
Exemplo n.º 3
0
        public GraphicsPath GetPointerPath(MapGraphics g)
        {
            if (!this.Visible)
            {
                return(null);
            }
            GraphicsPath graphicsPath = new GraphicsPath();
            LinearScale  scale        = this.GetScale();

            scale.GetPositionFromValue(scale.GetValueLimit(this.Position));
            if (this.Type == LinearPointerType.Marker)
            {
                MarkerStyleAttrib markerStyleAttrib = this.GetMarkerStyleAttrib(g);
                if (markerStyleAttrib.path != null)
                {
                    graphicsPath.AddPath(markerStyleAttrib.path, false);
                }
            }
            return(graphicsPath);
        }