protected void Draw(Graphics g, int w, int h) { IReferenceFrame f = collection; ReferenceFrame frame = f.Own; IPositionCollection pos = collection.Positions; ICollection <IPosition> l = pos.Positions; g.FillRectangle(backBrush, 0, 0, (float)w, (float)h); foreach (IPosition p in l) { frame.GetPositon(p, auxPos); double x = auxPos[0]; double y = auxPos[1]; int xx = (int)(((x - x1) / (x2 - x1)) * (double)w); int yy = (int)(((y - y1) / (y2 - y1)) * (double)h); Brush br = drawBrush; Draw(p, g, xx, yy); } }
/// <summary> /// Prepares itself /// </summary> protected virtual void Prepare() { IReferenceFrame f = collection; ReferenceFrame frame = f.Own; IPositionCollection positions = collection.Positions; bool first = true; foreach (IPosition p in positions.Positions) { frame.GetPositon(p, auxPos); if (first) { x1 = auxPos[0]; x2 = x1; y1 = auxPos[1]; y2 = y1; first = false; continue; } double x = auxPos[0]; double y = auxPos[1]; if (x < x1) { x1 = x; } if (x > x2) { x2 = x; } if (y < y1) { y1 = y; } if (y > y2) { y2 = y; } } }