private void DrawChild(int xStart, int yStart, int xFinish, int yFinish, int addX, int addY, int divisor, int modder, int startingpointX, int startingpointY, int counterside) { //this.X = node.VX1 + 75 * NumofChild(); //this.Y = (node.VY1 - 120); int newRectStart = 0, newRectFinish = 0, newRectStagnan = 0; int multiplier = 0; if (counterside % 2 == 0) { if (counterside == 0) { this.X = xStart + addX * (NumofChild() % modder); this.Y = yStart + addY; } else { this.X = xStart + addX * ((NumofChild() + 1) % modder); this.Y = yStart + addY; } } else { this.X = xStart + addX; this.Y = yStart + addY * (NumofChild() % modder); } /*if (counterside == 0) * { * this.X = xStart + addX * (NumofChild() % modder); * this.Y = yStart + addY; * } * else if (counterside == 2) * { * this.X = xStart + addX * (NumofChild()+1 % modder); * this.Y = yStart + addY; * } */ this.newRect = new RectangleSegment(X, Y, 70, 50); rectChild.Add(newRect); this.canvas.AddDrawingObject(newRect); this.canvas.AddRectangleObject(newRect); if (counterside == 0) { multiplier = NumofChild() % modder; } else if (counterside == 2) { multiplier = (NumofChild() % modder) + 1; } //set koordinat VX1 this.newRect.VX1 = this.newRect.X; this.newRect.VY1 = this.newRect.Y; //set koordinat VX2, VY2 this.newRect.VX2 = this.newRect.VX1 + this.newRect.Width; this.newRect.VY2 = this.newRect.VY1; this.newRect.VX3 = this.newRect.VX1; this.newRect.VY3 = this.newRect.VY1 + this.newRect.Height; this.newRect.VX4 = this.newRect.VX1 + this.newRect.Width; this.newRect.VY4 = this.newRect.VY1 + this.newRect.Height; if (counterside == 0) { newRectStart = this.newRect.VX3; newRectFinish = this.newRect.VX4; newRectStagnan = this.newRect.VY3; lineChild = new LineSegment(new System.Drawing.Point(((xFinish - xStart) / divisor) * multiplier + startingpointX, startingpointY), new System.Drawing.Point((newRectStart + newRectFinish) / 2, newRectStagnan)); } else if (counterside == 1) { newRectStart = this.newRect.VY1; newRectFinish = this.newRect.VY3; newRectStagnan = this.newRect.VX1; lineChild = new LineSegment(new System.Drawing.Point(((xFinish - xStart) / divisor) * multiplier + startingpointX, startingpointY), new System.Drawing.Point(newRectStagnan, 50)); //lineChild = new LineSegment(new System.Drawing.Point( startingpointX, ((yFinish - yStart) / divisor) * multiplier + startingpointY), new System.Drawing.Point(newRectStagnan, (newRectFinish - newRectStart) / 2)); // Debug.WriteLine("HASIL PADA COUNTERSIDE 1 koordinat Y : " + ((yFinish - yStart) / divisor) * multiplier + startingpointY + " FINISH : " + (newRectStart + newRectFinish) / 2); } else if (counterside == 2) { newRectStart = this.newRect.VX1; newRectFinish = this.newRect.VX2; newRectStagnan = this.newRect.VY1; lineChild = new LineSegment(new System.Drawing.Point(((xFinish - xStart) / divisor) * multiplier + startingpointX, startingpointY), new System.Drawing.Point((newRectStart + newRectFinish) / 2, newRectStagnan)); } else if (counterside == 3) { newRectStart = this.newRect.VY2; newRectFinish = this.newRect.VY4; newRectStagnan = this.newRect.VX2; lineChild = new LineSegment(new System.Drawing.Point(startingpointX, ((yFinish - yStart) / divisor) * multiplier + startingpointY), new System.Drawing.Point(newRectStagnan, (newRectStart + newRectFinish) / 2)); } //lineChild = new LineSegment(new System.Drawing.Point(((node.VX2 - node.VX1) / 4) * NumofChild() + node.VX1, node.VY1), new System.Drawing.Point((newRect.VX3 + newRect.VX4) / 2, newRect.VY3)); lineChild = new LineSegment(new System.Drawing.Point(((xFinish - xStart) / divisor) * multiplier + startingpointX, startingpointY), new System.Drawing.Point((newRectStart + newRectFinish) / 2, newRectStagnan)); this.canvas.AddDrawingObject(lineChild); node.Subscribe(lineChild); newRect.Subscribe(lineChild); lineChild.AddVertexStartObject(node); lineChild.AddVertexEndObject(newRect); MindmapTree mindmapTree = new MindmapTree(newRect, this.canvas); child.Add(mindmapTree); this.canvas.AddMindmapObject(mindmapTree); childBtnObject = new ButtonObject(X, Y, newRect.ID, this.canvas); this.canvas.AddButtonObject(childBtnObject); textSegmentChild = new TextSegment(); textSegmentChild.Value = "Child"; textSegmentChild.Position = new System.Drawing.PointF((float)((newRect.X + (newRect.X + newRect.Width)) / 2), (float)((newRect.Y + (newRect.Y + newRect.Height)) / 2)); bool added = newRect.Add(textSegmentChild); newRect.SetTextSegment(textSegmentChild); newRect.Select(); Debug.WriteLine("Jumlah Node : " + NumofChild()); }