/// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (AnnotationLayout != null)
         {
             hashCode = hashCode * 59 + AnnotationLayout.GetHashCode();
         }
         if (Title != null)
         {
             hashCode = hashCode * 59 + Title.GetHashCode();
         }
         if (Content != null)
         {
             hashCode = hashCode * 59 + Content.GetHashCode();
         }
         hashCode = hashCode * 59 + LineWidth.GetHashCode();
         hashCode = hashCode * 59 + AbsoluteAnnotationLineWidth.GetHashCode();
         if (Color != null)
         {
             hashCode = hashCode * 59 + Color.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #2
0
        public override void WidthLine()
        {
            ILineWidth lineWidth = new LineWidth();

            _centerPoint = _startPoint;
            int X0    = _startPoint.X;
            int Y0    = _startPoint.Y;
            int x     = 0;
            int y     = (int)R;
            int delta = 1 - 2 * (int)R;
            int error;

            while (y >= 0)
            {
                lineWidth.LWidth(new Point(X0 + x, Y0 + y), new Point(X0 + x, Y0 + y), _linewWidth, _colorLine);
                lineWidth.LWidth(new Point(X0 + x, Y0 - y), new Point(X0 + x, Y0 - y), _linewWidth, _colorLine);
                lineWidth.LWidth(new Point(X0 - x, Y0 + y), new Point(X0 - x, Y0 + y), _linewWidth, _colorLine);
                lineWidth.LWidth(new Point(X0 - x, Y0 - y), new Point(X0 - x, Y0 - y), _linewWidth, _colorLine);

                error = 2 * (delta + y) - 1;
                if ((delta < 0) && (error <= 0))
                {
                    delta += 2 * ++x + 1;
                    continue;
                }
                if ((delta > 0) && (error > 0))
                {
                    delta -= 2 * --y + 1;
                    continue;
                }
                delta += 2 * (++x - --y);
            }
        }
Beispiel #3
0
        public override void Serialize(XmlDocument dom, XmlElement node)
        {
            base.Serialize(dom, node);

            node.SetAttribute("target", Target.ID);

            if (LayoutData != null)
            {
                node.SetAttribute("cp1_length", LayoutData.CP1.Length.ToString());
                node.SetAttribute("cp1_angle", LayoutData.CP1.Angle.ToString());
                node.SetAttribute("cp2_length", LayoutData.CP2.Length.ToString());
                node.SetAttribute("cp2_angle", LayoutData.CP2.Angle.ToString());
            }

            node.SetAttribute("width", LineWidth.ToString());
            if (!Color.IsEmpty)
            {
                node.SetAttribute("color", ST.ToString(Color));
            }
            node.SetAttribute("line_style", LineStyle.ToString());
            node.SetAttribute("start_cap", StartCap.ToString());
            node.SetAttribute("end_cap", EndCap.ToString());
            node.SetAttribute("text", Text);
            node.SetAttribute("hyperlink", Hyperlink);

            if (!string.IsNullOrEmpty(Remark))
            {
                ST.WriteTextNode(node, "remark", Remark);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Returns true if LineAnnotationParameters instances are equal
        /// </summary>
        /// <param name="input">Instance of LineAnnotationParameters to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(LineAnnotationParameters input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     LineStartX == input.LineStartX ||
                     LineStartX.Equals(input.LineStartX)
                     ) &&
                 (
                     LineStartY == input.LineStartY ||
                     LineStartY.Equals(input.LineStartY)
                 ) &&
                 (
                     LineEndX == input.LineEndX ||
                     LineEndX.Equals(input.LineEndX)
                 ) &&
                 (
                     LineEndY == input.LineEndY ||
                     LineEndY.Equals(input.LineEndY)
                 ) &&
                 (
                     Title == input.Title ||
                     (Title != null &&
                      Title.Equals(input.Title))
                 ) &&
                 (
                     Content == input.Content ||
                     (Content != null &&
                      Content.Equals(input.Content))
                 ) &&
                 (
                     LineStartStyle == input.LineStartStyle ||
                     LineStartStyle.Equals(input.LineStartStyle)
                 ) &&
                 (
                     LineEndStyle == input.LineEndStyle ||
                     LineEndStyle.Equals(input.LineEndStyle)
                 ) &&
                 (
                     ShowContent == input.ShowContent ||
                     ShowContent.Equals(input.ShowContent)
                 ) &&
                 (
                     LineWidth == input.LineWidth ||
                     LineWidth.Equals(input.LineWidth)
                 ) &&
                 (
                     AbsoluteAnnotationLineWidth == input.AbsoluteAnnotationLineWidth ||
                     AbsoluteAnnotationLineWidth.Equals(input.AbsoluteAnnotationLineWidth)
                 ) &&
                 (
                     Color == input.Color ||
                     (Color != null &&
                      Color.Equals(input.Color))
                 ));
        }
Beispiel #5
0
 protected Geom()
 {
     _Color = new Color(new float[] { 0, 0, 0, 1 });
     AddAttr(_Color);
     _LineWidth = new LineWidth(1);
     AddAttr(_LineWidth);
 }
Beispiel #6
0
 public void DrawLine (Line line, ConsoleColor? color = null, LineWidth lineWidth = LineWidth.Single)
 {
     if (line.IsHorizontal)
         DrawHorizontalLine(line.X, line.Y, line.Width, color, lineWidth);
     else if (line.IsVertical)
         DrawVerticalLine(line.X, line.Y, line.Height, color, lineWidth);
 }
Beispiel #7
0
        /// <summary>
        /// Converts object to the string of the format specified.
        /// </summary>
        /// <param name="format"></param>
        /// <param name="formatProvider"></param>
        /// <returns></returns>
        protected override string ToStringInternal(string format, IFormatProvider formatProvider)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Path(")
            .Append("w=")
            .Append(LineWidth?.ToString(format, formatProvider) ?? "null")
            .Append(",c=")
            .Append(Color ?? "null")
            .Append(",f=")
            .Append(Fill?.ToString(formatProvider).ToLower() ?? "null");

            if (Elements.Count > 0)
            {
                sb.Append(",[");
                for (int i = 0; i < Elements.Count; i++)
                {
                    if (i > 0)
                    {
                        sb.Append(',');
                    }
                    sb.Append(Elements[i].ToString());
                }
                sb.Append("]");
            }
            sb.Append(')');
            return(sb.ToString());
        }
Beispiel #8
0
        /// <summary>
        /// Gnuplotコマンド用の文字列を取得します。
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            List <string> format = new List <string>();

            if (LineType > 0)
            {
                format.Add($"lt {LineType}");
            }
            if (!string.IsNullOrEmpty(LineColor))
            {
                format.Add($"lc rgbcolor '{LineColor}'");
            }
            else
            {
                format.Add($"lc {LineColorIndex}");
            }
            if (LineWidth > 0)
            {
                format.Add($"lw {LineWidth.ToString("f1")}");
            }
            if (PointType > 0)
            {
                format.Add($"pt {PointType}");
            }
            if (PointSize > 0)
            {
                format.Add($"ps {LineWidth.ToString("f1")}");
            }

            return(string.Join(" ", format.ToArray()));
        }
Beispiel #9
0
 public LineThickness(LineWidth left, LineWidth top, LineWidth right, LineWidth bottom)
 {
     Left   = left;
     Top    = top;
     Right  = right;
     Bottom = bottom;
 }
        public override void WidthLine()
        {
            ILineWidth lineWidth   = new LineWidth();
            int        x0          = _startPoint.X;
            int        y0          = _startPoint.Y;
            int        x1          = _endPoint.X;
            int        y1          = _endPoint.Y;
            double     angleRadian = 60 * Math.PI / 180;
            //Находим вторую пару координат линии, которую мы разворачиваем на 60 градусов.
            int x2 = (int)((x0 - x1) * Math.Cos(angleRadian) - (y0 - y1) * Math.Sin(angleRadian) + x1);
            int y2 = (int)((x0 - x1) * Math.Sin(angleRadian) + (y0 - y1) * Math.Cos(angleRadian) + y1);

            List <Point> listPoint = new List <Point>();

            lineWidth.LWidth(new Point(x0, y0), new Point(x1, y1), _linewWidth, _colorLine);
            lineWidth.LWidth(new Point(x1, y1), new Point(x2, y2), _linewWidth, _colorLine);
            lineWidth.LWidth(new Point(x2, y2), new Point(x0, y0), _linewWidth, _colorLine);

            double lengthSize1 = Math.Sqrt(Math.Pow((x1 - x0), 2) + Math.Pow((y1 - y0), 2));
            double lengthSize2 = Math.Sqrt(Math.Pow((x2 - x1), 2) + Math.Pow((y2 - y1), 2));
            double lengthSize3 = Math.Sqrt(Math.Pow((x0 - x2), 2) + Math.Pow((y0 - y2), 2));

            _centerPoint.X = (int)((lengthSize1 * x2 + lengthSize2 * x0 + lengthSize3 * x1) / (lengthSize1 + lengthSize2 + lengthSize3));
            _centerPoint.Y = (int)((lengthSize1 * y2 + lengthSize2 * y0 + lengthSize3 * y1) / (lengthSize1 + lengthSize2 + lengthSize3));
            _centerPoint   = new Point(_centerPoint.X, _centerPoint.Y);
        }
Beispiel #11
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         hashCode = hashCode * 59 + LineStartX.GetHashCode();
         hashCode = hashCode * 59 + LineStartY.GetHashCode();
         hashCode = hashCode * 59 + LineEndX.GetHashCode();
         hashCode = hashCode * 59 + LineEndY.GetHashCode();
         if (Title != null)
         {
             hashCode = hashCode * 59 + Title.GetHashCode();
         }
         if (Content != null)
         {
             hashCode = hashCode * 59 + Content.GetHashCode();
         }
         hashCode = hashCode * 59 + LineStartStyle.GetHashCode();
         hashCode = hashCode * 59 + LineEndStyle.GetHashCode();
         hashCode = hashCode * 59 + ShowContent.GetHashCode();
         hashCode = hashCode * 59 + LineWidth.GetHashCode();
         hashCode = hashCode * 59 + AbsoluteAnnotationLineWidth.GetHashCode();
         if (Color != null)
         {
             hashCode = hashCode * 59 + Color.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #12
0
        protected override IEnumerator ProcessPayload(VisualPayload payload)
        {
            payload.VisualData.Bound.name = "Line Graph Bound";

            var lineGraph = VisualizerFactory.InstantiateLineGraph();

            lineGraph.Initialize(this, payload);

            AssignStates(lineGraph);

            var entries = EntryField.GetLastKeyValue(payload.Data) as IEnumerable <MutableObject>;

            if (entries == null)
            {
                throw new Exception("Illegal mutable field here!  " + EntryField.AbsoluteKey + " is not an enumerable of mutables!");
            }

            if (!entries.Any())
            {
                yield return(null);

                yield break;
            }

            foreach (var entry in entries)
            {
                Vector3 entryPosition =
                    new Vector3(
                        XAxis.GetLastKeyValue(entry),
                        YAxis.GetLastKeyValue(entry),
                        ZAxis.GetLastKeyValue(entry)
                        );

                Color pointColor = PointColor.GetLastKeyValue(entry);

                lineGraph.AddPoint(entryPosition, pointColor);

                yield return(null);
            }

            yield return(null);

            lineGraph.SetLineData(MainColor.GetLastKeyValue(payload.Data),
                                  LineWidth.GetLastKeyValue(payload.Data),
                                  ZDepthOffset.GetLastKeyValue(payload.Data),
                                  EdgeColor.GetLastKeyValue(payload.Data),
                                  EdgeWidth.GetLastKeyValue(payload.Data),
                                  PointWidth.GetLastKeyValue(payload.Data),
                                  PulseLine.GetLastKeyValue(payload.Data),
                                  PulseWidth.GetLastKeyValue(payload.Data),
                                  Wipe.GetLastKeyValue(payload.Data),
                                  StartTime.GetLastKeyValue(payload.Data),
                                  WipeDuration.GetLastKeyValue(payload.Data)
                                  );

            lineGraph.ApplyPoints();
        }
Beispiel #13
0
 public override void SetObjectData(IJsonReadData data)
 {
     base.SetObjectData(data);
     startPoint  = data.GetProperty <GeoPoint>("StartPoint");
     endPoint    = data.GetProperty <GeoPoint>("EndPoint");
     colorDef    = data.GetPropertyOrDefault <ColorDef>("ColorDef");
     lineWidth   = data.GetPropertyOrDefault <LineWidth>("LineWidth");
     linePattern = data.GetPropertyOrDefault <LinePattern>("LinePattern");
 }
Beispiel #14
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (Item != null)
         {
             hashCode = hashCode * 59 + Item.GetHashCode();
         }
         if (Axis != null)
         {
             hashCode = hashCode * 59 + Axis.GetHashCode();
         }
         if (Label != null)
         {
             hashCode = hashCode * 59 + Label.GetHashCode();
         }
         if (Chart != null)
         {
             hashCode = hashCode * 59 + Chart.GetHashCode();
         }
         if (Legend != null)
         {
             hashCode = hashCode * 59 + Legend.GetHashCode();
         }
         if (Fill != null)
         {
             hashCode = hashCode * 59 + Fill.GetHashCode();
         }
         if (LineColor != null)
         {
             hashCode = hashCode * 59 + LineColor.GetHashCode();
         }
         if (LineWidth != null)
         {
             hashCode = hashCode * 59 + LineWidth.GetHashCode();
         }
         if (LineStyle != null)
         {
             hashCode = hashCode * 59 + LineStyle.GetHashCode();
         }
         if (MarkerColor != null)
         {
             hashCode = hashCode * 59 + MarkerColor.GetHashCode();
         }
         if (MarkerSymbol != null)
         {
             hashCode = hashCode * 59 + MarkerSymbol.GetHashCode();
         }
         if (RepeatTime != null)
         {
             hashCode = hashCode * 59 + RepeatTime.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #15
0
 public static double GetLineWidth(this LineWidth lineWidth)
 {
     return(lineWidth switch
     {
         LineWidth.VERY_THIN => 1.0,
         LineWidth.THIN => 2.0,
         LineWidth.THICK => 3.0,
         LineWidth.ULTRA_THICK => 4.0,
         _ => throw new ArgumentException("LineWidth cannot be converted"),
     });
Beispiel #16
0
 public override void Out2Sw(System.IO.StreamWriter sw)
 {
     sw.WriteLine("Start");
     sw.WriteLine("Circle");
     sw.WriteLine(Layer);
     sw.WriteLine(Color.R.ToString() + "," + Color.G.ToString() + "," + Color.B.ToString());
     sw.WriteLine(LineWidth.ToString());
     sw.WriteLine(_center.X.ToString() + "," + _center.Y.ToString());
     sw.WriteLine(_r.ToString());
     sw.WriteLine("End");
 }
Beispiel #17
0
        }  ///  获得线的长度及方向

        public override void Out2Sw(System.IO.StreamWriter sw)
        {
            sw.WriteLine("Start");
            sw.WriteLine("Line");
            sw.WriteLine(Layer);
            sw.WriteLine(Color.R.ToString() + "," + Color.G.ToString() + "," + Color.B.ToString());
            sw.WriteLine(LineWidth.ToString());
            sw.WriteLine(_startpoint.X.ToString() + "," + _startpoint.Y.ToString());
            sw.WriteLine(_endpoint.X.ToString() + "," + _endpoint.Y.ToString());
            sw.WriteLine("End");
        }
Beispiel #18
0
 /// <summary>
 /// Constructor required by deserialization
 /// </summary>
 /// <param name="info">SerializationInfo</param>
 /// <param name="context">StreamingContext</param>
 protected Line(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     startPoint  = (GeoPoint)info.GetValue("StartPoint", typeof(GeoPoint));
     endPoint    = (GeoPoint)info.GetValue("EndPoint", typeof(GeoPoint));
     colorDef    = ColorDef.Read(info, context);
     lineWidth   = LineWidth.Read("LineWidth", info, context);
     linePattern = LinePattern.Read("LinePattern", info, context);
     if (Constructed != null)
     {
         Constructed(this);
     }
 }
Beispiel #19
0
 public override void Out2Sw(System.IO.StreamWriter sw)
 {
     sw.WriteLine("Start");
     sw.WriteLine("PolyLine");
     sw.WriteLine(Layer);
     sw.WriteLine(Color.R.ToString() + "," + Color.G.ToString() + "," + Color.B.ToString());
     sw.WriteLine(LineWidth.ToString());
     sw.WriteLine(Count.ToString());
     for (int i = 0; i < Count; i++)
     {
         sw.WriteLine(Vertexs[i].X.ToString() + "," + Vertexs[i].Y.ToString());
     }
     sw.WriteLine("End");
 }
Beispiel #20
0
 public TikzStyle(
     Color strokeColor,
     Color fillColor,
     LineEnding lineEnding = LineEnding.NONE,
     LineWidth lineWidth   = LineWidth.THIN,
     LineType lineType     = LineType.SOLID
     )
 {
     LineEnding  = lineEnding;
     LineWidth   = lineWidth;
     LineType    = lineType;
     StrokeColor = strokeColor;
     FillColor   = fillColor;
 }
        public static RectangleLineSet Set(LineWidth lineWidth)
        {
            switch (lineWidth)
            {
            case LineWidth.Thin:
                return(Thin);

            case LineWidth.Thick:
                return(Thick);

            default:
                throw new ArgumentException();
            }
        }
Beispiel #22
0
 public bool Equals(LineBasicMaterial other)
 {
     if (other == null)
     {
         return(false);
     }
     else
     {
         return(Color.Equals(other.Color) &&
                LineWidth.Equals(other.LineWidth)); //&&
         //LineJoin.Equals(other.LineJoin)&&
         //LineCap.Equals(other.LineCap);
     }
 }
Beispiel #23
0
 public void DrawVerticalLine (int x, int y, int height, ConsoleColor? color = null, LineWidth lineWidth = LineWidth.Single)
 {
     if (lineWidth == LineWidth.None)
         return;
     int y1 = y, y2 = y + height;
     OffsetX(ref x).OffsetY(ref y1).OffsetY(ref y2);
     if (!ClipVerticalLine(x, ref y1, ref y2))
         return;
     for (int iy = y1; iy < y2; iy++) {
         ConsoleChar[] charsLine = GetLine(iy);
         if (color != null)
             charsLine[x].ForegroundColor = color.Value;
         charsLine[x].LineWidthVertical = lineWidth;
     }
 }
Beispiel #24
0
 public void DrawHorizontalLine (int x, int y, int width, ConsoleColor? color = null, LineWidth lineWidth = LineWidth.Single)
 {
     if (lineWidth == LineWidth.None)
         return;
     int x1 = x, x2 = x + width;
     OffsetY(ref y).OffsetX(ref x1).OffsetX(ref x2);
     if (!ClipHorizontalLine(y, ref x1, ref x2))
         return;
     ConsoleChar[] charsLine = GetLine(y);
     for (int ix = x1; ix < x2; ix++) {
         if (color != null)
             charsLine[ix].ForegroundColor = color.Value;
         charsLine[ix].LineWidthHorizontal = lineWidth;
     }
 }
        public override void WidthLine()
        {
            ILineWidth lineWidth = new LineWidth();

            int X0 = _startPoint.X;
            int Y0 = _startPoint.Y;
            int X1 = _endPoint.X;
            int Y1 = _endPoint.Y;

            lineWidth.LWidth(new Point(X0, Y0), new Point(X1, Y0), _linewWidth, _colorLine);
            lineWidth.LWidth(new Point(X1, Y0), new Point(X1, Y1), _linewWidth, _colorLine);
            lineWidth.LWidth(new Point(X1, Y1), new Point(X0, Y1), _linewWidth, _colorLine);
            lineWidth.LWidth(new Point(X0, Y1), new Point(X0, Y0), _linewWidth, _colorLine);

            _centerPoint = new Point(X0 + ((X1 - X0) / 2), Y0 + ((Y1 - Y0) / 2));
        }
        /// <summary>
        /// Converts object to the string of the format specified.
        /// </summary>
        /// <param name="format"></param>
        /// <param name="formatProvider"></param>
        /// <returns></returns>
        protected override string ToStringInternal(string format, IFormatProvider formatProvider)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Line(")
            .Append("s=")
            .Append(Start.ToString(format, formatProvider))
            .Append(",e=")
            .Append(End.ToString(format, formatProvider))
            .Append(",w=")
            .Append(LineWidth?.ToString(format, formatProvider) ?? "null")
            .Append(",c=")
            .Append(Color ?? "null")
            .Append(')');
            return(sb.ToString());
        }
Beispiel #27
0
    public override int GetHashCode()
    {
        unchecked
        {
            var n    = 23;
            var hash = 17;

            hash = hash * n + IconUrl.GetHashCode();
            hash = hash * n + IconColour.GetHashCode();
            hash = hash * n + IconScale.GetHashCode();
            hash = hash * n + LineColour.GetHashCode();
            hash = hash * n + LineWidth.GetHashCode();
            hash = hash * n + PolygonColour.GetHashCode();

            return(hash);
        }
    }
Beispiel #28
0
 private void OnMultiLineWidthSelectionChanged(LineWidth selected)
 {
     isChangingMultipleAttributes = true;
     using (frame.Project.Undo.UndoFrame)
     {
         for (int i = 0; i < selectedObjects.Count; ++i)
         {
             ILineWidth ilw = selectedObjects[i] as ILineWidth;
             if (ilw != null)
             {
                 ilw.LineWidth = selected;
             }
         }
     }
     isChangingMultipleAttributes = false;
     MultiChangeDone();
 }
Beispiel #29
0
        /// <summary>
        /// Calculate the screen coordinate width for a <see cref="LineWidth"/> value.
        /// </summary>
        private float ScaleLineWidth(LineWidth lineWidth)
        {
            // width 1 equals to 1px at 100% zoom, width 2 equals to 2px, and so on
            switch (lineWidth)
            {
            case LineWidth.Small:
                return(ScalePixelLength(1.0f));

            case LineWidth.Medium:
                return(ScalePixelLength(3.0f));

            case LineWidth.Large:
                return(ScalePixelLength(5.0f));

            default:
                return(0.0f);
            }
        }
        public override void Rotate()
        {
            ConnectPoints cp        = new ConnectPoints();
            ILineWidth    lineWidth = new LineWidth();

            int          x0        = _startPoint.X;
            int          y0        = _startPoint.Y;
            int          x1        = _endPoint.X;
            int          y1        = _endPoint.Y;
            List <Point> listPoint = new List <Point>();

            double lengthSize1 = Math.Sqrt(Math.Pow((x1 - x0), 2) + Math.Pow((y1 - y0), 2));
            double lengthSize2 = Math.Sqrt(Math.Pow((x0 - x1), 2) + Math.Pow((y1 - y1), 2));
            double lengthSize3 = Math.Sqrt(Math.Pow((x0 - x0), 2) + Math.Pow((y0 - y1), 2));


            double tmpX = (x0 - node3.X) * Math.Cos(_angle) - (y0 - node3.Y) * Math.Sin(_angle) + node3.X;
            double tmpY = (x0 - node3.X) * Math.Sin(_angle) + (y0 - node3.Y) * Math.Cos(_angle) + node3.Y;

            x0 = (int)tmpX;
            y0 = (int)tmpY;

            tmpX = (x1 - node3.X) * Math.Cos(_angle) - (y1 - node3.Y) * Math.Sin(_angle) + node3.X;
            tmpY = (x1 - node3.X) * Math.Sin(_angle) + (y1 - node3.Y) * Math.Cos(_angle) + node3.Y;
            x1   = (int)tmpX;
            y1   = (int)tmpY;

            List <Point> listpoint = new List <Point>();

            listPoint.AddRange(cp.ConnectTwoPoints(new Point(x0, y0), new Point(x1, y1)));
            listPoint.AddRange(cp.ConnectTwoPoints(new Point(x1, y1), new Point(node3.X, node3.Y)));
            listPoint.AddRange(cp.ConnectTwoPoints(new Point(node3.X, node3.Y), new Point(x0, y0)));

            lineWidth.LWidth(new Point(x0, y0), new Point(x1, y1), _linewWidth, _colorLine);
            lineWidth.LWidth(new Point(x1, y1), new Point(node3.X, node3.Y), _linewWidth, _colorLine);
            lineWidth.LWidth(new Point(node3.X, node3.Y), new Point(x0, y0), _linewWidth, _colorLine);
            _centerPoint.X = (int)((lengthSize1 * x0 + lengthSize2 * node3.X + lengthSize3 * x1) / (lengthSize1 + lengthSize2 + lengthSize3));
            _centerPoint.Y = (int)((lengthSize1 * y1 + lengthSize2 * node3.Y + lengthSize3 * y1) / (lengthSize1 + lengthSize2 + lengthSize3));
            _centerPoint   = new Point(_centerPoint.X, _centerPoint.Y);
            _startPoint.X  = x0;
            _startPoint.Y  = y0;
            _endPoint.X    = x1;
            _endPoint.Y    = y1;
        }
Beispiel #31
0
        public LineWidthSelectionProperty(string ResourceId, LineWidthList lineWidthList, ILineWidth iLineWidth, bool includeUndefined)
        {
            this.lineWidthList = lineWidthList;
            resourceId         = ResourceId;
            LineWidth select = iLineWidth.LineWidth;

            if (includeUndefined)
            {
                choices = new string[lineWidthList.Count + 1];
                for (int i = 0; i < lineWidthList.Count; ++i)
                {
                    choices[i + 1] = lineWidthList[i].Name;
                }
                string undef = StringTable.GetString("LineWidth.Undefined");
                // sollte es den Namen schon geben, werden solange - davor und dahintergemacht, bis es den Namen mehr gibt
                while (lineWidthList.Find(undef) != null)
                {
                    undef = "-" + undef + "-";
                }
                choices[0] = undef;
                if (select != null)
                {
                    base.selectedText = select.Name;
                }
                else
                {
                    base.selectedText = undef;
                }
            }
            else
            {
                choices = new string[lineWidthList.Count];
                for (int i = 0; i < lineWidthList.Count; ++i)
                {
                    choices[i] = lineWidthList[i].Name;
                }
                if (select != null)
                {
                    base.selectedText = select.Name;
                }
            }
            this.iLineWidth = iLineWidth;
            toWatch         = iLineWidth as IGeoObject;
        }
Beispiel #32
0
        /// <summary>
        /// Converts object to the string of the format specified.
        /// </summary>
        /// <param name="format"></param>
        /// <param name="formatProvider"></param>
        /// <returns></returns>
        protected override string ToStringInternal(string format, IFormatProvider formatProvider)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Circle(")
            .Append("p=")
            .Append(Center.ToString(format, formatProvider))
            .Append(",r=")
            .Append(Radius.ToString(format, formatProvider))
            .Append(",w=")
            .Append(LineWidth?.ToString(format, formatProvider) ?? "null")
            .Append(",c=")
            .Append(Color ?? "null")
            .Append(",f=")
            .Append(Fill?.ToString(formatProvider).ToLower() ?? "null")
            .Append(')');

            return(sb.ToString());
        }
Beispiel #33
0
        /// <summary>
        /// Converts object to the string of the format specified.
        /// </summary>
        /// <param name="format"></param>
        /// <param name="formatProvider"></param>
        /// <returns></returns>
        protected override string ToStringInternal(string format, IFormatProvider formatProvider)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Rectangle(")
            .Append("p=")
            .Append(TopLeft.ToString(format, formatProvider))
            .Append(",s=")
            .Append(Size.ToString(format, formatProvider))
            .Append(",w=")
            .Append(LineWidth?.ToString(format, formatProvider) ?? "null")
            .Append(",c=")
            .Append(Color ?? "null")
            .Append(",f=")
            .Append(Fill?.ToString(formatProvider).ToLower() ?? "null")
            .Append(')');

            return(sb.ToString());
        }
			public void AddLine(TextPoint start, Double width)
			{
				if (width > _maxWidth)
				{
					_maxWidth = width;
				}
				foreach (LineWidth width2 in _cachedLines)
				{
					if (width2.Start != start)
					{
						continue;
					}
					if ((width2.Width == _maxWidth) && (width < width2.Width))
					{
						_maxWidth = Double.MaxValue;
					}
					width2.Width = width;
					return;
				}
				if (_cachedLines.Count < 50)
				{
					_cachedLines.Add(new LineWidth(start, width));
				}
				else
				{
					Int32 num = 0;
					for (var i = 1; i < _cachedLines.Count; i++)
					{
						if (_cachedLines[i].Width < _cachedLines[num].Width)
						{
							num = i;
						}
					}
					if (width > _cachedLines[num].Width)
					{
						_cachedLines[num] = new LineWidth(start, width);
					}
				}
			}
Beispiel #35
0
 public void DrawRectangle (Rect rect, ConsoleColor? color = null, LineWidth lineWidth = LineWidth.Single)
 {
     DrawRectangle(rect.X, rect.Y, rect.Width, rect.Height, color, lineWidth);
 }
Beispiel #36
0
 public void DrawRectangle (int x, int y, int width, int height, ConsoleColor? color = null, LineWidth lineWidth = LineWidth.Single)
 {
     DrawRectangle(x, y, width, height, color, new LineThickness(lineWidth));
 }
Beispiel #37
0
 public static LineWidth Max (LineWidth left, LineWidth right) => (LineWidth)Math.Max((int)left, (int)right);