public override void Layout() { if (_topLeft != null && _bottomRight != null) { if (Direction == Directions.CounterClockwise) { // Start in the lower left corner and move counter clockwise around the rectangle. PreviewLine line = Strings[0] as PreviewLine; line.Point1 = BottomLeftPoint; line.Point2 = BottomRightPoint; line.Layout(); line = Strings[1] as PreviewLine; var ySpacing = (BottomRightPoint.Y - TopRightPoint.Y) / (line.PixelCount + 1); line.Point1 = new Point(BottomRightPoint.X, BottomRightPoint.Y - ySpacing); line.Point2 = new Point(TopRightPoint.X, TopRightPoint.Y + ySpacing); line.Layout(); line = Strings[2] as PreviewLine; line.Point1 = TopRightPoint; line.Point2 = TopLeftPoint; line.Layout(); line = Strings[3] as PreviewLine; line.Point1 = new Point(TopLeftPoint.X, TopLeftPoint.Y + ySpacing); line.Point2 = new Point(BottomLeftPoint.X, BottomLeftPoint.Y - ySpacing); line.Layout(); } else { // Start in the lower left corner and move clockwise around the rectangle. PreviewLine line = Strings[0] as PreviewLine; line.Point1 = BottomLeftPoint; line.Point2 = TopLeftPoint; line.Layout(); line = Strings[1] as PreviewLine; var xSpacing = (TopRightPoint.X - TopLeftPoint.X) / (line.PixelCount + 1); line.Point1 = new Point(TopLeftPoint.X + xSpacing, TopLeftPoint.Y); line.Point2 = new Point(TopRightPoint.X - xSpacing, TopRightPoint.Y); line.Layout(); line = Strings[2] as PreviewLine; line.Point1 = TopRightPoint; line.Point2 = BottomRightPoint; line.Layout(); line = Strings[3] as PreviewLine; line.Point1 = new Point(BottomRightPoint.X - xSpacing, BottomRightPoint.Y); line.Point2 = new Point(BottomLeftPoint.X + xSpacing, BottomLeftPoint.Y); line.Layout(); } } }
public override void Layout() { if (StringOrientation == StringOrientations.Vertical) { int width = _bottomRight.X - _topLeft.X; int height = _bottomRight.Y - _topLeft.Y; double stringXSpacing = (double)width / (double)(StringCount - 1); int x = _topLeft.X; int y = _topLeft.Y; for (int stringNum = 0; stringNum < StringCount; stringNum++) { PreviewLine line = _strings[stringNum] as PreviewLine; line.SetPoint0(x, y + height); line.SetPoint1(x, y); line.Layout(); x += (int)stringXSpacing; } } else { int width = _bottomRight.X - _bottomLeft.X; int height = _bottomLeft.Y - _topLeft.Y; double stringYSpacing = (double)height / (double)(StringCount - 1); int x = _bottomLeft.X; int y = _bottomLeft.Y; for (int stringNum = 0; stringNum < StringCount; stringNum++) { PreviewLine line = _strings[stringNum] as PreviewLine; line.SetPoint0(x, y); line.SetPoint1(x + width, y); line.Layout(); y -= (int)stringYSpacing; } } }
public override void Layout() { if (_bottomRight != null && _topLeft != null) { int width = _bottomRight.X - _topLeft.X; int height = _bottomRight.Y - _topLeft.Y; List <Point> _topEllipsePoints; List <Point> _baseEllipsePoints; double _topLeftOffset = _topLeft.X + (width / 2) - (_topWidth / 2); double bottomTopOffset = _bottomRight.Y - _baseHeight; double totalStringsInEllipse = Math.Ceiling((360d / Convert.ToDouble(_degrees)) * Convert.ToDouble(StringCount)); _topEllipsePoints = PreviewTools.GetEllipsePoints(_topLeftOffset, _topLeft.Y, _topWidth, _topHeight, totalStringsInEllipse, _degrees, 0); _baseEllipsePoints = PreviewTools.GetEllipsePoints(_topLeft.X, bottomTopOffset, width, _baseHeight, totalStringsInEllipse, _degrees, 0); for (int stringNum = 0; stringNum < (int)_stringCount; stringNum++) { if (stringNum < StringCount && stringNum < _topEllipsePoints.Count()) { Point topPixel = _topEllipsePoints[_stringCount - 1 - stringNum]; Point basePixel = _baseEllipsePoints[_stringCount - 1 - stringNum]; PreviewLine line = _strings[stringNum] as PreviewLine; line.SetPoint0(basePixel.X, basePixel.Y); line.SetPoint1(topPixel.X, topPixel.Y); line.Layout(); } } SetPixelZoom(); } }
public override void Layout() { int width = _bottomRight.X - _topLeft.X; int height = _bottomRight.Y - _topLeft.Y; List <Point> _topEllipsePoints; List <Point> _baseEllipsePoints; // First we'll get the top and bottom ellipses //double _topLeftOffset = _topLeft.X + (width / 2) - (_topWidth / 2); //_topEllipsePoints = PreviewTools.GetEllipsePoints(_topLeftOffset, _topLeft.Y, _topWidth, _topHeight, _stringCount, _degrees); //double bottomTopOffset = _bottomRight.Y - _baseHeight; //_baseEllipsePoints = PreviewTools.GetEllipsePoints(_topLeft.X, bottomTopOffset, width, _baseHeight, _stringCount, _degrees); double _topLeftOffset = _topLeft.X + (width / 2) - (_topWidth / 2); double bottomTopOffset = _bottomRight.Y - _baseHeight; //if (_degrees < 360) //{ // _topEllipsePoints = PreviewTools.GetEllipsePoints(_topLeftOffset, _topLeft.Y, _topWidth, _topHeight, _stringCount+1, 360, 0); // _baseEllipsePoints = PreviewTools.GetEllipsePoints(_topLeft.X, bottomTopOffset, width, _baseHeight, _stringCount+1, 360, 0); //} //else //{ _topEllipsePoints = PreviewTools.GetEllipsePoints(_topLeftOffset, _topLeft.Y, _topWidth, _topHeight, _stringCount, _degrees, 0); _baseEllipsePoints = PreviewTools.GetEllipsePoints(_topLeft.X, bottomTopOffset, width, _baseHeight, _stringCount, _degrees, 0); //} _stringsInDegrees = (double)_stringCount * ((double)_degrees / 360); for (int stringNum = 0; stringNum < (int)_stringCount; stringNum++) { if (stringNum < (int)_stringsInDegrees) { Point topPixel = _topEllipsePoints[stringNum]; Point basePixel = _baseEllipsePoints[stringNum]; PreviewLine line = _strings[stringNum] as PreviewLine; line.SetPoint0(basePixel.X, basePixel.Y); line.SetPoint1(topPixel.X, topPixel.Y); line.Layout(); } } }
public override void Layout() { if (_bottomRight != null && _topLeft != null) { if (StringOrientation == StringOrientations.Vertical) { int width = _bottomRight.X - _topLeft.X; int height = _bottomRight.Y - _topLeft.Y; double stringXSpacing = (double)width / (double)(StringCount - 1); double x = _topLeft.X; int y = _topLeft.Y; for (int stringNum = 0; stringNum < StringCount; stringNum++) { PreviewLine line = _strings[stringNum] as PreviewLine; var x1 = (int)Math.Round(x, MidpointRounding.AwayFromZero); line.SetPoint0(x1, y + height); line.SetPoint1(x1, y); line.Layout(); x += stringXSpacing; } } else { int width = _bottomRight.X - _bottomLeft.X; int height = _bottomLeft.Y - _topLeft.Y; double stringYSpacing = height / (double)(StringCount - 1); int x = _bottomLeft.X; double y = _bottomLeft.Y; for (int stringNum = 0; stringNum < StringCount; stringNum++) { PreviewLine line = _strings[stringNum] as PreviewLine; var y1 = (int)Math.Round(y, MidpointRounding.AwayFromZero); line.SetPoint0(x, y1); line.SetPoint1((x + width), y1); line.Layout(); y -= stringYSpacing; } } SetPixelZoom(); } }
private void SetupLine(bool horizontal) { preview.Data = new VixenPreviewData(); preview.LoadBackground(); preview.BackgroundAlpha = 0; displayItem = new DisplayItem(); PreviewPoint p1, p2; if (horizontal) { p1 = new PreviewPoint(10, preview.Height/2); p2 = new PreviewPoint(preview.Width - 10, preview.Height/2); } else { p1 = new PreviewPoint(preview.Width/2, preview.Height - 10); p2 = new PreviewPoint(preview.Width/2, 10); } PreviewLine line = new PreviewLine(p1, p2, PixelsPerString(), null, 1); line.PixelCount = PixelsPerString(); line.PixelSize = Data.PixelSize; line.PixelColor = Color.White; line.Layout(); displayItem.Shape = line; preview.AddDisplayItem(displayItem); }
public override void Layout() { //int width = _bottomRight.X - _topLeft.X; //int height = _bottomRight.Y - _topLeft.Y; //List<Point> _topEllipsePoints; //List<Point> _baseEllipsePoints; //double _topLeftOffset = _topLeft.X + (width/2) - (_topWidth/2); //double bottomTopOffset = _bottomRight.Y - _baseHeight; //_topEllipsePoints = PreviewTools.GetEllipsePoints(_topLeftOffset, _topLeft.Y, _topWidth, _topHeight, _stringCount, // _degrees, 0); //_baseEllipsePoints = PreviewTools.GetEllipsePoints(_topLeft.X, bottomTopOffset, width, _baseHeight, _stringCount, // _degrees, 0); //_stringsInDegrees = (double) _stringCount*((double) _degrees/360); //for (int stringNum = 0; stringNum < (int) _stringCount; stringNum++) { // if (stringNum < (int) _stringsInDegrees) { // if (stringNum < _topEllipsePoints.Count()) { // Point topPixel = _topEllipsePoints[stringNum]; // Point basePixel = _baseEllipsePoints[stringNum]; // PreviewLine line = _strings[stringNum] as PreviewLine; // line.SetPoint0(basePixel.X, basePixel.Y); // line.SetPoint1(topPixel.X, topPixel.Y); // line.Layout(); // } // } //} // DB: Added 8/4/2013 int width = _bottomRight.X - _topLeft.X; int height = _bottomRight.Y - _topLeft.Y; List <Point> _topEllipsePoints; List <Point> _baseEllipsePoints; double _topLeftOffset = _topLeft.X + (width / 2) - (_topWidth / 2); double bottomTopOffset = _bottomRight.Y - _baseHeight; double totalStringsInEllipse = Math.Ceiling((360d / Convert.ToDouble(_degrees)) * Convert.ToDouble(StringCount)); _topEllipsePoints = PreviewTools.GetEllipsePoints(_topLeftOffset, _topLeft.Y, _topWidth, _topHeight, totalStringsInEllipse, _degrees, 0); _baseEllipsePoints = PreviewTools.GetEllipsePoints(_topLeft.X, bottomTopOffset, width, _baseHeight, totalStringsInEllipse, _degrees, 0); for (int stringNum = 0; stringNum < (int)_stringCount; stringNum++) { if (stringNum < StringCount && stringNum < _topEllipsePoints.Count()) { Point topPixel = _topEllipsePoints[_stringCount - 1 - stringNum]; Point basePixel = _baseEllipsePoints[_stringCount - 1 - stringNum]; //Console.WriteLine("topPixel " + topPixel.ToString() + ", basePixel " + basePixel.ToString()); PreviewLine line = _strings[stringNum] as PreviewLine; line.SetPoint0(basePixel.X, basePixel.Y); line.SetPoint1(topPixel.X, topPixel.Y); line.Layout(); } } }