コード例 #1
0
        internal MarkerStyleAttrib GetMarkerStyleAttrib(MapGraphics g)
        {
            MarkerStyleAttrib markerStyleAttrib = new MarkerStyleAttrib();

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

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

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

            pointF = ((GetGauge().GetOrientation() != 0) ? g.GetAbsolutePoint(new PointF(num2, positionFromValue)) : g.GetAbsolutePoint(new PointF(positionFromValue, num2)));
            markerStyleAttrib.brush = g.GetMarkerBrush(markerStyleAttrib.path, MarkerStyle, pointF, 0f, FillColor, FillGradientType, FillSecondaryColor, FillHatchStyle);
            using (Matrix matrix2 = new Matrix())
            {
                matrix2.Translate(pointF.X, pointF.Y, MatrixOrder.Append);
                markerStyleAttrib.path.Transform(matrix2);
                return(markerStyleAttrib);
            }
        }
コード例 #2
0
        internal void Render(MapGraphics g)
        {
            if (Common == null || !Visible || GetScale() == null)
            {
                return;
            }
            g.StartHotRegion(this);
            if (!string.IsNullOrEmpty(Image))
            {
                DrawImage(g, drawShadow: false);
                g.EndHotRegion();
                return;
            }
            Pen pen = new Pen(BorderColor, BorderWidth);

            pen.DashStyle = MapGraphics.GetPenStyle(BorderStyle);
            if (pen.DashStyle != 0)
            {
                pen.Alignment = PenAlignment.Center;
            }
            MarkerStyleAttrib markerStyleAttrib = GetMarkerStyleAttrib(g);

            try
            {
                if (markerStyleAttrib.path != null)
                {
                    bool circularFill = (MarkerStyle == MarkerStyle.Circle) ? true : false;
                    g.FillPath(markerStyleAttrib.brush, markerStyleAttrib.path, 0f, useBrushOffset: true, circularFill);
                }
                if (BorderWidth > 0 && markerStyleAttrib.path != null)
                {
                    g.DrawPath(pen, markerStyleAttrib.path);
                }
            }
            catch (Exception)
            {
                markerStyleAttrib.Dispose();
            }
            if (markerStyleAttrib.path != null)
            {
                Common.MapCore.HotRegionList.SetHotRegion(g, this, markerStyleAttrib.path);
            }
            g.EndHotRegion();
        }
コード例 #3
0
        internal GraphicsPath GetPointerPath(MapGraphics g)
        {
            if (!Visible)
            {
                return(null);
            }
            GraphicsPath graphicsPath = new GraphicsPath();
            LinearScale  scale        = GetScale();

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