//const int InitialStringLength = 20; public PreviewIcicle(PreviewPoint point1, PreviewPoint point2, ElementNode selectedNode, double zoomLevel) { // If we are creating this fresh, we need to know so we can add strings, etc. as drawn. creating = true; initialNode = selectedNode; ZoomLevel = zoomLevel; AddPoint(PointToZoomPoint(point1)); AddPoint(PointToZoomPoint(point2)); if (selectedNode != null) { if (selectedNode.Children.Count() > 0 && PreviewTools.GetLeafNodes(selectedNode).Count == 0) { StringType = StringTypes.Pixel; _strings = new List<PreviewBaseShape>(); foreach (ElementNode child in selectedNode.Children) { int pixelCount = child.Children.Count(); PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(10, 10), pixelCount, child, ZoomLevel); line.Parent = this; _strings.Add(line); } _stringCount = _strings.Count; creating = false; } else { StringType = StringTypes.Standard; } } Layout(); }
protected void removeEffects() { m_form.SelectedDisplayItems.Clear(); PreviewPoint translatedPoint = new PreviewPoint(m_newDisplay.Shape.Pixels[0].X, m_newDisplay.Shape.Pixels[0].Y); m_form.SelectItemUnderPoint(translatedPoint, false); m_form.SeparateTemplateItems(m_newDisplay); }
public PreviewMultiString(PreviewPoint point1, PreviewPoint point2, ElementNode selectedNode, double zoomLevel) { ZoomLevel = zoomLevel; AddPoint(PointToZoomPoint(point1)); _strings = new List<PreviewBaseShape>(); Creating = true; inputElements = selectedNode; }
public PreviewCustom(PreviewPoint point, List<PreviewBaseShape> shapes) { _topLeft = point; if (shapes != null) Strings = shapes; Layout(); }
public PreviewTriangle(PreviewPoint point1, ElementNode selectedNode, double zoomLevel) { ZoomLevel = zoomLevel; _bottomRightPoint = PointToZoomPoint(point1); _point1 = new PreviewPoint(_bottomRightPoint); _point2 = new PreviewPoint(_bottomRightPoint); _point3 = new PreviewPoint(_bottomRightPoint); _strings = new List<PreviewBaseShape>(); if (selectedNode != null) { List<ElementNode> children = PreviewTools.GetLeafNodes(selectedNode); if (children.Count >= 6) // { int increment = children.Count/3; int pixelsLeft = children.Count; StringType = StringTypes.Pixel; // Just add lines, they will be layed out in Layout() for (int i = 0; i < 3; i++) { PreviewLine line; if (pixelsLeft >= increment) { line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), increment, null, ZoomLevel); } else { line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), pixelsLeft, null, ZoomLevel); } line.PixelColor = Color.White; _strings.Add(line); pixelsLeft -= increment; } int pixelNum = 0; foreach (PreviewPixel pixel in Pixels) { pixel.Node = children[pixelNum]; pixel.NodeId = children[pixelNum].Id; pixelNum++; } } } if (_strings.Count == 0) { // Just add lines, they will be layed out in Layout() for (int i = 0; i < 3; i++) { PreviewLine line; line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), 10, selectedNode, ZoomLevel); line.PixelColor = Color.White; _strings.Add(line); } } Layout(); }
public PreviewRectangle(PreviewPoint point1, ElementNode selectedNode) { _topLeft = point1; _topRight = new PreviewPoint(point1); _bottomLeft = new PreviewPoint(point1); _bottomRight = new PreviewPoint(point1); _strings = new List<PreviewBaseShape>(); if (selectedNode != null) { List<ElementNode> children = PreviewTools.GetLeafNodes(selectedNode); if (children.Count >= 8) { int increment = children.Count/4; int pixelsLeft = children.Count; StringType = StringTypes.Pixel; // Just add lines, they will be layed out in Layout() for (int i = 0; i < 4; i++) { PreviewLine line; if (pixelsLeft >= increment) { line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), increment, null); } else { line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), pixelsLeft, null); } line.PixelColor = Color.White; _strings.Add(line); pixelsLeft -= increment; } int pixelNum = 0; foreach (PreviewPixel pixel in Pixels) { pixel.Node = children[pixelNum]; pixel.NodeId = children[pixelNum].Id; pixelNum++; } } } if (_strings.Count == 0) { // Just add lines, they will be layed out in Layout() for (int i = 0; i < 4; i++) { PreviewLine line; line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), 10, selectedNode); line.PixelColor = Color.White; _strings.Add(line); } } Layout(); //DoResize += new ResizeEvent(OnResize); }
public PreviewNet(PreviewPoint point1, ElementNode selectedNode) { _topLeft = point1; _topRight = new PreviewPoint(point1); _bottomLeft = new PreviewPoint(point1); _bottomRight = new PreviewPoint(point1); initiallyAssignedNode = selectedNode; Layout(); }
public PreviewCane(PreviewPoint point, ElementNode selectedNode) { _topLeftPoint = point; _bottomRightPoint = new PreviewPoint(point.X, point.Y); _archLeftPoint = new PreviewPoint(point.X, point.Y); _archPixelCount = 8; _linePixelCount = 8; int lightCount = _archPixelCount + _linePixelCount; if (selectedNode != null) { //List<ElementNode> children = selectedNode.Children.ToList(); List<ElementNode> children = PreviewTools.GetLeafNodes(selectedNode); // is this a single node? if (children.Count >= 8) { StringType = StringTypes.Pixel; _archPixelCount = children.Count/2; _linePixelCount = children.Count/2; if (_archPixelCount + _linePixelCount > children.Count) { _archPixelCount -= 1; } else if (_archPixelCount + _linePixelCount < children.Count) { _linePixelCount -= 1; } lightCount = children.Count; // Just add the pixels, they will get layed out next foreach (ElementNode child in children) { PreviewPixel pixel = AddPixel(10, 10); pixel.Node = child; //pixel.NodeId = child.Id; pixel.PixelColor = Color.White; } } } if (_pixels.Count == 0) { // Just add the pixels, they will get layed out next for (int lightNum = 0; lightNum < lightCount; lightNum++) { PreviewPixel pixel = AddPixel(10, 10); pixel.PixelColor = Color.White; if (selectedNode != null && selectedNode.IsLeaf) { pixel.Node = selectedNode; //pixel.NodeId = selectedNode.Id; } } } // Lay out the pixels Layout(); //DoResize += new ResizeEvent(OnResize); }
public PreviewNet(PreviewPoint point1, ElementNode selectedNode, double zoomLevel) { ZoomLevel = zoomLevel; _topLeft = PointToZoomPoint(point1); _topRight = new PreviewPoint(_topLeft); _bottomLeft = new PreviewPoint(_topLeft); _bottomRight = new PreviewPoint(_topLeft); initiallyAssignedNode = selectedNode; Layout(); }
public PreviewStar(PreviewPoint point, ElementNode selectedNode, double zoomLevel) { ZoomLevel = zoomLevel; _topLeftPoint = PointToZoomPoint(point); _bottomRightPoint = PointToZoomPoint(point); _pointCount = 0; _pixelCount = 0; _insideSize = 40; if (selectedNode != null) { AddAllChildren(selectedNode); if (IsPixelStar(selectedNode)) StringType = StringTypes.Pixel; } if (_pixels.Count >= 5 && _pointCount == 0) { if (_pixels.Count % 5 == 0) { _pointCount = 5; } else if (_pixels.Count % 3 == 0) { _pointCount = 3; } else if (_pixels.Count % 2 == 0) { _pointCount = 4; } } if (_pixels.Count < 5) { _pixelCount = 40; _pointCount = 5; // Just add the pixels, they will get layed out next for (int lightNum = 0; lightNum < _pixelCount; lightNum++) { PreviewPixel pixel = AddPixel(10, 10); pixel.PixelColor = Color.White; if (selectedNode != null && selectedNode.IsLeaf) { pixel.Node = selectedNode; } } } //Console.WriteLine("Star Pixel Count: " + _pixelCount + ":" + _pixels.Count()); // Lay out the pixels Layout(); }
protected void addGroupEffects() { DisplayItem selectDisplayItem; var nextShape = false; m_form.SelectedDisplayItems.Clear(); foreach (var shape in m_newDisplay.Shape.Strings) { PreviewPoint translatedPoint = new PreviewPoint(shape.Pixels[0].X, shape.Pixels[0].Y); m_form.SelectItemUnderPoint(translatedPoint, nextShape); nextShape = true; } m_form.AddNewGroup(out selectDisplayItem, m_form.SelectedDisplayItems); }
public PreviewArch(PreviewPoint point1, ElementNode selectedNode) { _topLeft = point1; _bottomRight = new PreviewPoint(_topLeft.X, _topLeft.Y); int lightCount = 25; //// Just add the pixels, they will get layed out next //for (int lightNum = 0; lightNum < 25; lightNum++) //{ // PreviewPixel pixel = AddPixel(10, 10); // pixel.PixelColor = Color.White; //} if (selectedNode != null) { //List<ElementNode> children = selectedNode.Children.ToList(); List<ElementNode> children = PreviewTools.GetLeafNodes(selectedNode); // is this a single node? if (children.Count >= 4) { StringType = StringTypes.Pixel; lightCount = children.Count; // Just add the pixels, they will get layed out next foreach (ElementNode child in children) { { PreviewPixel pixel = AddPixel(10, 10); pixel.Node = child; //pixel.NodeId = child.Id; pixel.PixelColor = Color.White; } } } } if (_pixels.Count == 0) { // Just add the pixels, they will get layed out next for (int lightNum = 0; lightNum < lightCount; lightNum++) { PreviewPixel pixel = AddPixel(10, 10); pixel.PixelColor = Color.White; if (selectedNode != null && selectedNode.IsLeaf) { pixel.Node = selectedNode; //pixel.NodeId = selectedNode.Id; } } } // Lay out the pixels Layout(); //DoResize += new ResizeEvent(OnResize); }
public PreviewStarBurst(PreviewPoint point1, ElementNode selectedNode, double zoomLevel) { ZoomLevel = zoomLevel; _topLeft = PointToZoomPoint(point1); _topRight = new PreviewPoint(_topLeft); _bottomLeft = new PreviewPoint(_topLeft); _bottomRight = new PreviewPoint(_topLeft); _strings = new List<PreviewBaseShape>(); if (selectedNode != null) { List<ElementNode> children = PreviewTools.GetLeafNodes(selectedNode); int stringCount = PreviewTools.GetParentNodes(selectedNode).Count(); if (stringCount >= 4) { int spokePixelCount = 0; foreach (ElementNode node in selectedNode.Children) { spokePixelCount = Math.Max(spokePixelCount, node.Children.Count()); } StringType = StringTypes.Pixel; foreach (ElementNode node in selectedNode.Children) { PreviewLine line; line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), spokePixelCount, node, ZoomLevel); line.PixelColor = Color.White; _strings.Add(line); } } } if (_strings.Count == 0) { // Just add lines, they will be layed out in Layout() StringType = StringTypes.Standard; for (int i = 0; i < 8; i++) { PreviewLine line; line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), 10, selectedNode, ZoomLevel); line.PixelColor = Color.White; line.StringType = StringTypes.Standard; _strings.Add(line); } } Layout(); }
public PreviewLine(PreviewPoint point1, PreviewPoint point2, int lightCount, ElementNode selectedNode) { AddPoint(point1); AddPoint(point2); if (selectedNode != null) { //List<ElementNode> children = selectedNode.Children.ToList(); List<ElementNode> children = PreviewTools.GetLeafNodes(selectedNode); // is this a single node? if (children.Count == 0) { StringType = StringTypes.Standard; // Just add the pixels, they will get layed out next for (int lightNum = 0; lightNum < lightCount; lightNum++) { //Console.WriteLine("Added: " + lightNum.ToString()); PreviewPixel pixel = AddPixel(10, 10); pixel.PixelColor = Color.White; if (selectedNode.IsLeaf) pixel.Node = selectedNode; //pixel.NodeId = selectedNode.Id; } } else { StringType = StringTypes.Pixel; lightCount = children.Count; // Just add the pixels, they will get layed out next foreach (ElementNode child in children) { { PreviewPixel pixel = AddPixel(10, 10); pixel.Node = child; pixel.NodeId = child.Id; pixel.PixelColor = Color.White; } } } } else { // Just add the pixels, they will get layed out next for (int lightNum = 0; lightNum < lightCount; lightNum++) { //Console.WriteLine("Added: " + lightNum.ToString()); PreviewPixel pixel = AddPixel(10, 10); pixel.PixelColor = Color.White; } } // Lay out the pixels Layout(); //DoResize += new ResizeEvent(OnResize); }
public PreviewPolyLine(PreviewPoint point1, PreviewPoint point2, ElementNode selectedNode, double zoomLevel) { ZoomLevel = zoomLevel; AddPoint(PointToZoomPoint(point1)); if (selectedNode != null) { List<ElementNode> children = PreviewTools.GetLeafNodes(selectedNode); // is this a single node? if (children.Count == 0) { StringType = StringTypes.Standard; PixelCount = 2; _pixels[0].PixelColor = Color.White; if (selectedNode.IsLeaf) _pixels[0].Node = selectedNode; Creating = true; CreateDefaultPixels = true; } else { StringType = StringTypes.Pixel; PixelCount = children.Count; // Just add the pixels, they will get layed out next int pixelNum = 0; foreach (ElementNode child in children) { { PreviewPixel pixel = _pixels[pixelNum]; pixel.Node = child; pixel.NodeId = child.Id; pixel.PixelColor = Color.White; } pixelNum++; } Creating = true; } } else { Creating = true; CreateDefaultPixels = true; PixelCount = 2; } Layout(); }
public PreviewSingle(PreviewPoint point, ElementNode selectedNode, double zoomLevel) { ZoomLevel = zoomLevel; p1 = PointToZoomPoint(point); PreviewPixel pixel = AddPixel(10, 10); pixel.PixelColor = Color.White; if (selectedNode != null) { if (selectedNode.IsLeaf) { pixel.Node = selectedNode; } } // Lay out the pixels Layout(); }
public PreviewMegaTree(PreviewPoint point1, ElementNode selectedNode) { _topLeft = point1; _bottomRight = new PreviewPoint(_topLeft.X, _topLeft.Y); _stringCount = 16; _topWidth = 20; _topHeight = _topWidth/2; _baseHeight = 40; _lightsPerString = 50; _degrees = 360; _strings = new List<PreviewBaseShape>(); int childLightCount; if (IsPixelTreeSelected(selectedNode, out childLightCount)) { StringType = StringTypes.Pixel; _lightsPerString = childLightCount; foreach (ElementNode child in selectedNode.Children) { PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(10, 10), _lightsPerString, child); _strings.Add(line); } _stringCount = _strings.Count; } else if (IsStandardTreeSelected(selectedNode)) { StringType = StringTypes.Standard; foreach (ElementNode child in selectedNode.Children) { PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(10, 10), _lightsPerString, child); _strings.Add(line); } _stringCount = _strings.Count; } else { // Just add the pixels, we don't care where they go... they get positioned in Layout() for (int stringNum = 0; stringNum < _stringCount; stringNum++) { PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(10, 10), _lightsPerString, null); _strings.Add(line); } } // Lay out the pixels Layout(); //DoResize += new ResizeEvent(OnResize); }
public PreviewPixelGrid(PreviewPoint point1, ElementNode selectedNode, double zoomLevel) { ZoomLevel = zoomLevel; _topRight = PointToZoomPoint(point1); _topLeft = PointToZoomPoint(point1); _bottomRight = new PreviewPoint(_topLeft.X, _topLeft.Y); _bottomLeft = new PreviewPoint(_bottomRight); int defaultStringCount = 16; int defaultLightsPerString = 50; _strings = new List<PreviewBaseShape>(); int childLightCount; if (IsPixelGridSelected(selectedNode, out childLightCount)) { StringType = StringTypes.Pixel; foreach (ElementNode child in selectedNode.Children) { PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(10, 10), childLightCount, child, ZoomLevel); _strings.Add(line); } LightsPerString = childLightCount; } else if (IsStandardGridSelected(selectedNode)) { StringType = StringTypes.Standard; foreach (ElementNode child in selectedNode.Children) { PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(10, 10), defaultLightsPerString, child, ZoomLevel); _strings.Add(line); } } else { // Just add the pixels, we don't care where they go... they get positioned in Layout() for (int stringNum = 0; stringNum < defaultStringCount; stringNum++) { PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(10, 10), defaultLightsPerString, null, ZoomLevel); _strings.Add(line); } } if (childLightCount == -1) { LightsPerString = defaultLightsPerString; } StringCount = _strings.Count(); // Lay out the pixels Layout(); }
//, p2Start; public PreviewSingle(PreviewPoint point, ElementNode selectedNode) { p1 = point; // new PreviewPoint(point.X, point.Y); //p2 = new PreviewPoint(point.X, point.Y); PreviewPixel pixel = AddPixel(10, 10); pixel.PixelColor = Color.White; if (selectedNode != null) { if (selectedNode.IsLeaf) { pixel.Node = selectedNode; //pixel.NodeId = selectedNode.Id; } } // Lay out the pixels Layout(); //DoResize += new ResizeEvent(OnResize); }
public PreviewFlood(PreviewPoint point, ElementNode selectedNode) { _p1 = point; PixelSize = 40; StringType = StringTypes.Standard; PreviewPixel pixel = AddPixel(10, 10); pixel.PixelColor = Color.White; if (selectedNode != null) { if (selectedNode.IsLeaf) { pixel.Node = selectedNode; pixel.NodeId = selectedNode.Id; } } // Lay out the flood Layout(); }
public PreviewArch(PreviewPoint point1, ElementNode selectedNode, double zoomLevel) { ZoomLevel = zoomLevel; TopLeft = PointToZoomPoint(point1).ToPoint(); BottomRight = new PreviewPoint(_topLeft.X, _topLeft.Y).ToPoint(); int lightCount = 25; if (selectedNode != null) { List<ElementNode> children = PreviewTools.GetLeafNodes(selectedNode); // is this a single node? if (children.Count >= 4) { StringType = StringTypes.Pixel; lightCount = children.Count; // Just add the pixels, they will get layed out next foreach (ElementNode child in children) { { PreviewPixel pixel = AddPixel(10, 10); pixel.Node = child; pixel.PixelColor = Color.White; } } } } if (_pixels.Count == 0) { // Just add the pixels, they will get layed out next for (int lightNum = 0; lightNum < lightCount; lightNum++) { PreviewPixel pixel = AddPixel(10, 10); pixel.PixelColor = Color.White; if (selectedNode != null && selectedNode.IsLeaf) { pixel.Node = selectedNode; } } } // Lay out the pixels Layout(); }
public void AddPoint(PreviewPoint point) { _points.Add(point); }
public override void SetSelectPoint(PreviewPoint point) { if (point == null) { topLeftStart = new PreviewPoint(_topLeft.X, _topLeft.Y); topRightStart = new PreviewPoint(_topRight.X, _topRight.Y); bottomLeftStart = new PreviewPoint(_bottomLeft.X, _bottomLeft.Y); bottomRightStart = new PreviewPoint(_bottomRight.X, _bottomRight.Y); } _selectedPoint = point; }
public abstract bool PointInShape(PreviewPoint point);
public abstract void SetSelectPoint(PreviewPoint point = null);
public PreviewPoint(PreviewPoint pointToClone) { _x = pointToClone.X; _y = pointToClone.Y; }
public override void SetSelectPoint(PreviewPoint point) { if (point == null) { p1Start = new PreviewPoint(_point1.X, _point1.Y); p2Start = new PreviewPoint(_point2.X, _point2.Y); p3Start = new PreviewPoint(_point3.X, _point3.Y); } _selectedPoint = point; }
public override void SetSelectPoint(PreviewPoint point) { if (point == null) { p1Start = new PreviewPoint(_points[0].X, _points[0].Y); p2Start = new PreviewPoint(_points[1].X, _points[1].Y); } _selectedPoint = point; }
public PreviewPoint PointInSelectPoint(PreviewPoint point) { if (_selectPoints != null) { foreach (PreviewPoint selectPoint in _selectPoints) { if (selectPoint != null) { if (point.X >= selectPoint.X - (SelectPointSize/2) && point.Y >= selectPoint.Y - (SelectPointSize/2) && point.X <= selectPoint.X + (SelectPointSize/2) && point.Y <= selectPoint.Y + (SelectPointSize/2)) { return selectPoint; } } } } return null; }
public override void MouseMove(int x, int y, int changeX, int changeY) { PreviewPoint point = PointToZoomPoint(new PreviewPoint(x, y)); if (_selectedPoint != null) { // Should the height = the width? if (_selectedPoint == _bottomRight && System.Windows.Forms.Control.ModifierKeys == System.Windows.Forms.Keys.Control) { int height = point.Y - _topRight.Y; _topRight.X = _topLeft.X + height; _topRight.Y = _topLeft.Y; _bottomLeft.X = _topLeft.X; _bottomLeft.Y = _topRight.Y + height; _selectedPoint.X = _topRight.X; _selectedPoint.Y = _bottomLeft.Y; } else { _selectedPoint.X = point.X; _selectedPoint.Y = point.Y; } if (_selectedPoint == _topRight) { _topLeft.Y = _topRight.Y; _bottomRight.X = _topRight.X; } else if (_selectedPoint == _bottomLeft) { _topLeft.X = _bottomLeft.X; _bottomRight.Y = _bottomLeft.Y; } else if (_selectedPoint == _topLeft) { _bottomLeft.X = _topLeft.X; _topRight.Y = _topLeft.Y; } else if (_selectedPoint == _bottomRight) { _topRight.X = _bottomRight.X; _bottomLeft.Y = _bottomRight.Y; } Layout(); } // If we get here, we're moving else { //_topLeft.X = topLeftStart.X + changeX; //_topLeft.Y = topLeftStart.Y + changeY; //_topRight.X = topRightStart.X + changeX; //_topRight.Y = topRightStart.Y + changeY; //_bottomLeft.X = bottomLeftStart.X + changeX; //_bottomLeft.Y = bottomLeftStart.Y + changeY; //_bottomRight.X = bottomRightStart.X + changeX; //_bottomRight.Y = bottomRightStart.Y + changeY; _topLeft.X = Convert.ToInt32(topLeftStart.X * ZoomLevel) + changeX; _topLeft.Y = Convert.ToInt32(topLeftStart.Y * ZoomLevel) + changeY; _topRight.X = Convert.ToInt32(topRightStart.X * ZoomLevel) + changeX; _topRight.Y = Convert.ToInt32(topRightStart.Y * ZoomLevel) + changeY; _bottomLeft.X = Convert.ToInt32(bottomLeftStart.X * ZoomLevel) + changeX; _bottomLeft.Y = Convert.ToInt32(bottomLeftStart.Y * ZoomLevel) + changeY; _bottomRight.X = Convert.ToInt32(bottomRightStart.X * ZoomLevel) + changeX; _bottomRight.Y = Convert.ToInt32(bottomRightStart.Y * ZoomLevel) + changeY; PointToZoomPointRef(_topLeft); PointToZoomPointRef(_topRight); PointToZoomPointRef(_bottomLeft); PointToZoomPointRef(_bottomRight); Layout(); } }
public static Point TransformPreviewPoint(this RotateTransform @this, PreviewPoint point) { var p = new Point(point.X, point.Y); return(@this.Transform(p)); }
public override bool PointInShape(PreviewPoint point) { foreach (PreviewPixel pixel in Pixels) { Rectangle r = new Rectangle(pixel.X - (SelectPointSize/2), pixel.Y - (SelectPointSize/2), SelectPointSize, SelectPointSize); if (point.X >= r.X && point.X <= r.X + r.Width && point.Y >= r.Y && point.Y <= r.Y + r.Height) { return true; } } return false; }
public PreviewPoint PointToZoomPointAdd(PreviewPoint p) { return(new PreviewPoint(Convert.ToInt32(p.X * ZoomLevel), Convert.ToInt32(p.Y * ZoomLevel))); }
public override void SelectDefaultSelectPoint() { // The triangle is strange. When first drawn, the default select point should be the bottom // right corner. This point will not be avalable again... _bottomRightPoint = new PreviewPoint(10, 10); _bottomRightPoint.X = Math.Max(_point1.X, _point2.X); _bottomRightPoint.X = Math.Max(_bottomRightPoint.X, _point3.X); _bottomRightPoint.Y = Math.Max(_point1.Y, _point2.Y); _bottomRightPoint.Y = Math.Max(_bottomRightPoint.Y, _point3.Y); _bottomRightPoint.PointType = PreviewPoint.PointTypes.None; _selectPoints.Add(_bottomRightPoint); _selectedPoint = _bottomRightPoint; pBottomRightStart = new PreviewPoint(_bottomRightPoint.X, _bottomRightPoint.Y); }
public PreviewRectangle(PreviewPoint point1, ElementNode selectedNode, double zoomLevel) { ZoomLevel = zoomLevel; _topLeft = PointToZoomPoint(point1); _topRight = new PreviewPoint(_topLeft); _bottomLeft = new PreviewPoint(_topLeft); _bottomRight = new PreviewPoint(_topLeft); _strings = new List <PreviewBaseShape>(); if (selectedNode != null) { List <ElementNode> parents = PreviewTools.GetParentNodes(selectedNode); // Do we have the 4 sides of the rectangle defined in our elements? if (parents.Count() == 4) { foreach (ElementNode pixelString in parents) { PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), pixelString.Children.Count(), pixelString, ZoomLevel); line.PixelColor = Color.White; _strings.Add(line); } } else { List <ElementNode> children = PreviewTools.GetLeafNodes(selectedNode); if (children.Count >= 8) { int increment = children.Count / 4; int pixelsLeft = children.Count; StringType = StringTypes.Pixel; // Just add lines, they will be layed out in Layout() for (int i = 0; i < 4; i++) { PreviewLine line; if (pixelsLeft >= increment) { line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), increment, null, ZoomLevel); } else { line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), pixelsLeft, null, ZoomLevel); } line.PixelColor = Color.White; _strings.Add(line); pixelsLeft -= increment; } int pixelNum = 0; foreach (PreviewPixel pixel in Pixels) { pixel.Node = children[pixelNum]; pixel.NodeId = children[pixelNum].Id; pixelNum++; } } } } if (_strings.Count == 0) { // Just add lines, they will be layed out in Layout() for (int i = 0; i < 4; i++) { PreviewLine line; line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(20, 20), 10, selectedNode, ZoomLevel); line.PixelColor = Color.White; _strings.Add(line); } } Layout(); }