Пример #1
0
        internal string GetTag()
        {
            StringBuilder stringBuilder = new StringBuilder("\r\n<AREA SHAPE=\"", 120);

            if (shape == MapAreaShape.Circle)
            {
                stringBuilder.Append("circle\"");
            }
            else if (shape == MapAreaShape.Rectangle)
            {
                stringBuilder.Append("rect\"");
            }
            else if (shape == MapAreaShape.Polygon)
            {
                stringBuilder.Append("poly\"");
            }
            if (Href.Length > 0)
            {
                stringBuilder.Append(" HREF=\"");
                if (Href.StartsWith("WWW.", StringComparison.OrdinalIgnoreCase))
                {
                    stringBuilder.Append("http://");
                }
                stringBuilder.Append(Href);
                stringBuilder.Append("\"");
            }
            if (ToolTip.Length > 0)
            {
                stringBuilder.Append(" Title=\"");
                stringBuilder.Append(ToolTip);
                stringBuilder.Append("\"");
            }
            stringBuilder.Append(" COORDS=\"");
            float[] array = new float[Coordinates.Length];
            Coordinates.CopyTo(array, 0);
            bool flag = true;

            float[] array2 = array;
            foreach (float num in array2)
            {
                if (!flag)
                {
                    stringBuilder.Append(",");
                }
                flag = false;
                stringBuilder.Append((int)Math.Round(num));
            }
            stringBuilder.Append("\"");
            if (MapAreaAttributes.Length > 0)
            {
                stringBuilder.Append(" ");
                stringBuilder.Append(MapAreaAttributes);
            }
            stringBuilder.Append(">");
            return(stringBuilder.ToString());
        }
Пример #2
0
        internal string GetTag(ChartGraphics graph)
        {
            StringBuilder stringBuilder = new StringBuilder("\r\n<area shape=\"", 120);

            if (shape == MapAreaShape.Circle)
            {
                stringBuilder.Append("circle\"");
            }
            else if (shape == MapAreaShape.Rectangle)
            {
                stringBuilder.Append("rect\"");
            }
            else if (shape == MapAreaShape.Polygon)
            {
                stringBuilder.Append("poly\"");
            }
            if (Href.Length > 0)
            {
                stringBuilder.Append(" href=\"");
                if (Href.StartsWith("www.", StringComparison.OrdinalIgnoreCase))
                {
                    stringBuilder.Append("http://");
                }
                stringBuilder.Append(Href);
                stringBuilder.Append("\"");
            }
            if (ToolTip.Length > 0)
            {
                stringBuilder.Append(" title=\"");
                stringBuilder.Append(ToolTip);
                stringBuilder.Append("\"");
            }
            stringBuilder.Append(" coords=\"");
            float[] array = new float[Coordinates.Length];
            if (Shape == MapAreaShape.Circle)
            {
                PointF absolutePoint = graph.GetAbsolutePoint(new PointF(Coordinates[0], Coordinates[1]));
                array[0] = absolutePoint.X;
                array[1] = absolutePoint.Y;
                array[2] = graph.GetAbsolutePoint(new PointF(Coordinates[2], Coordinates[1])).X;
            }
            else if (Shape == MapAreaShape.Rectangle)
            {
                PointF absolutePoint2 = graph.GetAbsolutePoint(new PointF(Coordinates[0], Coordinates[1]));
                array[0]       = absolutePoint2.X;
                array[1]       = absolutePoint2.Y;
                absolutePoint2 = graph.GetAbsolutePoint(new PointF(Coordinates[2], Coordinates[3]));
                array[2]       = absolutePoint2.X;
                array[3]       = absolutePoint2.Y;
                if ((int)Math.Round(array[0]) == (int)Math.Round(array[2]))
                {
                    array[2] = (float)Math.Round(array[2]) + 1f;
                }
                if ((int)Math.Round(array[1]) == (int)Math.Round(array[3]))
                {
                    array[3] = (float)Math.Round(array[3]) + 1f;
                }
            }
            else
            {
                PointF pointF   = Point.Empty;
                PointF relative = Point.Empty;
                for (int i = 0; i < Coordinates.Length - 1; i += 2)
                {
                    relative.X   = Coordinates[i];
                    relative.Y   = Coordinates[i + 1];
                    pointF       = graph.GetAbsolutePoint(relative);
                    array[i]     = pointF.X;
                    array[i + 1] = pointF.Y;
                }
            }
            bool flag = true;

            float[] array2 = array;
            foreach (float num in array2)
            {
                if (!flag)
                {
                    stringBuilder.Append(",");
                }
                flag = false;
                stringBuilder.Append((int)Math.Round(num));
            }
            stringBuilder.Append("\"");
            if (MapAreaAttributes.Length > 0)
            {
                stringBuilder.Append(" ");
                stringBuilder.Append(MapAreaAttributes);
            }
            if (stringBuilder.ToString().IndexOf("alt=", StringComparison.Ordinal) == -1)
            {
                stringBuilder.Append(" alt=\"\"");
            }
            stringBuilder.Append("/>");
            return(stringBuilder.ToString());
        }
 protected override void OnParametersSet()
 {
     Contract.Requires <InvalidOperationException>((Href is not null) && (Href.StartsWith("#")), $"{nameof(HxScrollspyNavLink)}.{nameof(HxScrollspyNavLink.Href)} has to start with #. Use only for local elements.");
 }