public ComplexLine(Port start,Port end): base(start,end) { mSegments = new Segments(); Segment segment = new Segment(Start,End); Segments.Add(segment); segment.SegmentInvalid += new EventHandler(segment_SegmentInvalid); AllowExpand = true; }
public ComplexLine(ComplexLine prototype): base (prototype) { mSegments = new Segments(); Segment segment = new Segment(Start, End); Segments.Add(segment); segment.SegmentInvalid += new EventHandler(segment_SegmentInvalid); //Set up segments for (int i = 0; i < prototype.Segments.Count-1; i++) { segment = AddSegment(i+1,new Origin((PointF) prototype.Points[i+1])); segment.Start.Marker = prototype.Segments[i+1].Start.Marker; } DrawPath(); AllowExpand = prototype.AllowExpand; }
public SegmentsEventArgs(Segment value) { mValue = value; }
//Renders a graphics marker protected virtual void RenderSegment(Segment segment,PointF targetPoint,PointF referencePoint,Graphics graphics, IRender render) { if (segment.Label == null && segment.Image == null) return; //Get midpoint of segment PointF midPoint = new PointF(targetPoint.X + ((referencePoint.X - targetPoint.X) /2),targetPoint.Y + ((referencePoint.Y - targetPoint.Y) /2)); //Save the graphics state Matrix gstate = graphics.Transform; //Apply the rotation transform around the centre graphics.Transform = GetSegmentTransform(midPoint,referencePoint,graphics.Transform); //Offset and draw image if (segment.Image != null) { graphics.TranslateTransform(0,-segment.Image.Bitmap.Height /2); segment.Image.Render(graphics,render); graphics.TranslateTransform(0,segment.Image.Bitmap.Height /2); } //Draw annotation if (segment.Label != null) { segment.Label.Render(graphics,render); } //Restore the graphics state graphics.Transform = gstate; }
//Returns the index of an Segment public virtual int IndexOf(Segment value) { return List.IndexOf(value); }
//Methods public virtual Segment AddSegment(int position, Origin origin) { //Valid the position if (position < 1) throw new ArgumentException("Position must be greater than zero.","position"); if (position > Segments.Count) throw new ArgumentException("Position cannot be greater than the total number of segments.","position"); if (origin == null) throw new ArgumentNullException("origin","Origin may not be null."); //Create new segment Segment segment = new Segment(origin,Segments[position-1].End); //Set the previous end to the new origin Segments[position-1].SetEnd(origin); Segments.Insert(position,segment); origin.OriginInvalid +=new EventHandler(Origin_OriginInvalid); segment.SegmentInvalid += new EventHandler(segment_SegmentInvalid); origin.SetLine(this); DrawPath(); OnElementInvalid(); return segment; }
//Returns true if list contains Segment public virtual bool Contains(Segment value) { return List.Contains(value); }
//Removes an Segment from the list protected internal virtual void Remove(Segment value ) { List.Remove(value); }
//Inserts an elelemnt into the list protected internal virtual void Insert(int index, Segment value) { if (value == null) throw new ArgumentNullException("Segment parameter cannot be null reference.","value"); List.Insert(index, value); }
//Adds an Segment to the list protected internal virtual int Add(Segment value) { if (value == null) throw new ArgumentNullException("Segment parameter cannot be null reference.","value"); return List.Add(value); }
public ExpandHandle(Segment segment) { Type = HandleType.Expand; Segment = segment; }