/// <summary> /// setzt die Werte für eine Darstellung ohne Bitmap /// </summary> /// <param name="typ"></param> /// <param name="innerwidth"></param> /// <param name="borderwidth"></param> /// <param name="day1"></param> /// <param name="day2"></param> /// <param name="night1"></param> /// <param name="night2"></param> public void SetWidthAndColors(PolylineType typ, uint innerwidth, uint borderwidth, Color day1, Color day2, Color night1, Color night2) { //if (borderwidth == 0 && // (typ == PolylineType.Day2 || // typ == PolylineType.Day2_Night2 || // typ == PolylineType.Day1_Night2)) // throw new Exception("Falscher Linientyp bei Randbreite 0."); if (borderwidth > 0 && (typ == PolylineType.NoBorder_Day1 || // NoBorder-Typen sollten wahrscheinlich gar nicht ohne Bitmap verwendet werden typ == PolylineType.NoBorder_Day1_Night1 || typ == PolylineType.NoBorder_Day2_Night1)) { throw new Exception("Falscher Linientyp bei Randbreite > 0."); } XBitmapDay = null; XBitmapNight = null; if (Polylinetype != typ) { Polylinetype = typ; } InnerWidth = innerwidth; BorderWidth = borderwidth; BitmapHeight = 0; DayColor1 = day1; DayColor2 = day2; NightColor1 = night1; NightColor2 = night2; }
/// <summary> /// /// </summary> /// <param name="Pl"></param> /// <param name="normal"></param> /// <returns></returns> public static Polyline ToAcad(PolylineType Pl, Vector3d normal) { int i, index; Polyline acPl; PolylineElement elem; i = 0; index = 0; acPl = new Polyline(); acPl.Closed = false; while ((elem = Pl.getByIndex(index++)) != null) { switch (elem.TypeElement) { case PolylineElementType.Point: acPl.AddVertexAt(i, ToAcad_2d(elem.Point), 0, 0, 0); i++; break; case PolylineElementType.Segment: if (i == 0) { acPl.AddVertexAt(0, ToAcad_2d(elem.Segment.StartPoint), 0, 0, 0); acPl.AddVertexAt(1, ToAcad_2d(elem.Segment.EndPoint), 0, 0, 0); i = 2; } else { acPl.JoinEntity(ToAcad(elem.Segment)); i++; } break; case PolylineElementType.Arc: if (i == 0) { acPl.AddVertexAt(0, ToAcad_2d(elem.Arc.StartPoint), 0, 0, 0); acPl.JoinEntity(ToAcad(elem.Arc, normal)); acPl.ReverseCurve(); i = 2; } else { acPl.JoinEntity(ToAcad(elem.Arc, normal)); i++; } break; } } return(acPl); }
/// <summary> /// setzt das Bitmap und die Farben neu /// </summary> /// <param name="typ"></param> /// <param name="bmday"></param> public void SetBitmap(PolylineType typ, Bitmap bmday) { if (bmday.Width != 32 || bmday.Height > 31) { throw new Exception("Das Bitmap muß 32 breit sein und darf höchstens 31 hoch sein."); } if (Polylinetype != typ) { Polylinetype = typ; } switch (Polylinetype) { case PolylineType.Day1_Night2: case PolylineType.NoBorder_Day1: case PolylineType.NoBorder_Day1_Night1: XBitmapDay = new PixMap(bmday, BitmapColorMode.POLY1TR); break; case PolylineType.Day2: case PolylineType.Day2_Night2: case PolylineType.NoBorder_Day2_Night1: XBitmapDay = new PixMap(bmday, BitmapColorMode.POLY2); break; } BitmapHeight = (uint)bmday.Height; DayColor1 = XBitmapDay.GetColor(0); switch (typ) { case PolylineType.Day2: case PolylineType.Day2_Night2: case PolylineType.NoBorder_Day2_Night1: DayColor2 = XBitmapDay.Colors > 1 ? XBitmapDay.GetColor(1) : Color.CornflowerBlue; break; } switch (typ) { case PolylineType.NoBorder_Day1_Night1: case PolylineType.NoBorder_Day2_Night1: NightColor1 = DayColor1; break; case PolylineType.Day1_Night2: case PolylineType.Day2_Night2: base.NightColor1 = DayColor1; base.NightColor2 = DayColor2; break; } }
public PolylineVisualizer() { type = PolylineType.Linear; polyline = new LinearPolyline(); points = new List <Vector3>(); }
public void SetWidthAndColors(PolylineType typ, uint innerwidth) { SetWidthAndColors(typ, innerwidth, BorderWidth, DayColor1, DayColor2, NightColor1, NightColor2); }
public void SetWidthAndColors(PolylineType typ, uint innerwidth, uint borderwidth, Color day1, Color day2) { SetWidthAndColors(typ, innerwidth, borderwidth, day1, day2, NightColor1, NightColor2); }