public void DrawAncestors() { int numberOfSegments = fSegments.Count; for (int i = 0; i < numberOfSegments; i++) { AncPersonSegment segment = (AncPersonSegment)fSegments[i]; bool draw = (!Options.HideEmptySegments || segment.IRec != null); if (draw) { int brIndex; if (fGroupsMode) { brIndex = (segment.GroupIndex == -1) ? 11 : segment.GroupIndex; } else { brIndex = (segment.Gen == 0) ? CircleChartModel.CENTRAL_INDEX : segment.Gen - 1; } IBrush brush = (fSelected == segment) ? fDarkBrushes[brIndex] : fCircleBrushes[brIndex]; IGfxPath path = segment.Path; fRenderer.FillPath(brush, path); fRenderer.DrawPath(fPen, path); } DrawPersonName(fSegments[i]); } }
public override void FillPath(IBrush brush, IGfxPath path) { Brush sdBrush = ((BrushHandler)brush).Handle; GraphicsPath sdPath = ((GfxPathHandler)path).Handle; fCanvas.FillPath(sdBrush, sdPath); }
public override void DrawPath(IPen pen, IGfxPath path) { Pen sdPen = ((PenHandler)pen).Handle; GraphicsPath sdPath = ((GfxPathHandler)path).Handle; fCanvas.DrawPath(sdPen, sdPath); }
public override void CreateCircleSegment(IGfxPath path, int ctX, int ctY, float inRad, float extRad, float wedgeAngle, float ang1, float ang2) { GraphicsPath sdPath = ((GfxPathHandler)path).Handle; UIHelper.CreateCircleSegment(sdPath, ctX, ctY, inRad, extRad, wedgeAngle, ang1, ang2); }
private void CalcDescendants(DescPersonSegment segment, float inRad, float startAngle, float stepAngle) { IGfxPath path = segment.Path; float extRad; if (segment.Gen == 0) { segment.StartAngle = startAngle; segment.WedgeAngle = 360.0f; segment.IntRad = 0; segment.ExtRad = inRad; path.StartFigure(); path.AddEllipse(-inRad, -inRad, inRad * 2.0f, inRad * 2.0f); path.CloseFigure(); extRad = inRad; } else { extRad = inRad + fGenWidth; int size = Math.Max(1, segment.TotalSubSegments); float wedgeAngle = stepAngle * size; // in Eto.Drawings 360 degrees for the segments // leads to a crash of drawing if (wedgeAngle == 360.0f) { wedgeAngle -= 0.1f; } segment.StartAngle = startAngle; segment.WedgeAngle = wedgeAngle; segment.Rad = inRad + 50; segment.IntRad = inRad; segment.ExtRad = extRad; fRenderer.CreateCircleSegment(path, inRad, extRad, wedgeAngle, startAngle, startAngle + wedgeAngle); } for (int i = 0; i < segment.ChildSegments.Count; i++) { DescPersonSegment childSegment = segment.ChildSegments[i]; CalcDescendants(childSegment, extRad, startAngle, stepAngle); int steps = Math.Max(1, childSegment.TotalSubSegments); startAngle += stepAngle * steps; } }
public override void FillPath(IBrush brush, IGfxPath path) { if (fGfx != null) { if (path is IGfxCirclePath) { var circlePath = path as IGfxCirclePath; fGfx.DrawEllipse(circlePath.X, circlePath.Y, circlePath.Width, circlePath.Height, null /*pen*/, brush); } else if (path is IGfxCircleSegmentPath) { var segmPath = path as IGfxCircleSegmentPath; fGfx.DrawCircleSegment(0, 0, segmPath.InRad, segmPath.ExtRad, segmPath.Ang1, segmPath.Ang2, null /*pen*/, brush); } } }
public override void DrawPath(IPen pen, IBrush brush, IGfxPath path) { if (fGfx != null) { if (path is IGfxCirclePath) { var circlePath = (IGfxCirclePath)path; fGfx.DrawEllipse(circlePath.X, circlePath.Y, circlePath.Width, circlePath.Height, pen, brush); } else if (path is IGfxCircleSegmentPath) { var segmPath = (IGfxCircleSegmentPath)path; fGfx.DrawCircleSegment(0, 0, segmPath.InRad, segmPath.ExtRad, segmPath.Ang1, segmPath.Ang2, pen, brush); } } }
public override void DrawPath(IPen pen, IBrush brush, IGfxPath path) { GraphicsPath sdPath = ((GfxPathHandler)path).Handle; if (brush != null) { Brush sdBrush = ((BrushHandler)brush).Handle; fCanvas.FillPath(sdBrush, sdPath); } if (pen != null) { Pen sdPen = ((PenHandler)pen).Handle; fCanvas.DrawPath(sdPen, sdPath); } }
public void DrawDescendants() { int numberOfSegments = fSegments.Count; for (int i = 0; i < numberOfSegments; i++) { DescPersonSegment segment = (DescPersonSegment)fSegments[i]; if (segment.IRec == null) { continue; } int brIndex = (segment.Gen == 0) ? CircleChartModel.CENTRAL_INDEX : segment.Gen - 1; IBrush brush = (fSelected == segment) ? fDarkBrushes[brIndex] : fCircleBrushes[brIndex]; IGfxPath path = segment.Path; fRenderer.FillPath(brush, path); fRenderer.DrawPath(fPen, path); DrawPersonName(fSegments[i]); } }
public void BuildAncTree() { fSegments.Clear(); const float startRad = CircleChartModel.CENTER_RAD - 50; float inRad = startRad; AncPersonSegment segment = new AncPersonSegment(0); segment.IntRad = 0; segment.ExtRad = inRad; segment.StartAngle = 0 - 90.0f; segment.WedgeAngle = segment.StartAngle + 360.0f; IGfxPath path = segment.Path; path.StartFigure(); path.AddEllipse(-inRad, -inRad, inRad * 2.0f, inRad * 2.0f); path.CloseFigure(); fSegments.Add(segment); int maxSteps = 1; for (int gen = 1; gen <= fMaxGenerations; gen++) { inRad = startRad + ((gen - 1) * fGenWidth); float extRad = inRad + fGenWidth; maxSteps *= 2; float stepAngle = (360.0f / maxSteps); for (int step = 0; step < maxSteps; step++) { float ang1 = (step * stepAngle) - 90.0f; float ang2 = ang1 + stepAngle; segment = new AncPersonSegment(gen); segment.StartAngle = ang1; segment.WedgeAngle = stepAngle; fRenderer.CreateCircleSegment(segment.Path, inRad, extRad, stepAngle, ang1, ang2); fSegments.Add(segment); } } // traverse tree fGroupCount = -1; fIndividualsCount = 0; if (fRootPerson == null) { return; } fIndividualsCount++; AncPersonSegment rootSegment = SetSegmentParams(0, fRootPerson, 0, -1); if (rootSegment == null) { return; } rootSegment.WedgeAngle = 360.0f; GEDCOMIndividualRecord father = null, mother = null; GEDCOMFamilyRecord fam = fRootPerson.GetParentsFamily(); if (fam != null && fBase.Context.IsRecordAccess(fam.Restriction)) { father = fam.GetHusband(); mother = fam.GetWife(); } if (mother != null) { rootSegment.MotherSegment = TraverseAncestors(mother, 90f, 1, CircleChartModel.CENTER_RAD, 90.0f, 1, -1); } if (father != null) { rootSegment.FatherSegment = TraverseAncestors(father, 270.0f, 1, CircleChartModel.CENTER_RAD, 90.0f, 1, -1); } }
public abstract void CreateCircleSegment(IGfxPath path, int ctX, int ctY, float inRad, float extRad, float wedgeAngle, float ang1, float ang2);
public abstract void FillPath(IBrush brush, IGfxPath path);
public abstract void DrawPath(IPen pen, IBrush brush, IGfxPath path);
protected CircleSegment(int generation) { Gen = generation; IRec = null; Path = AppHost.GfxProvider.CreatePath(); }
public override void DrawPath(IPen pen, IBrush brush, IGfxPath path) { }
public override void FillPath(IBrush brush, IGfxPath path) { }
public override void CreateCircleSegment(IGfxPath path, int ctX, int ctY, float inRad, float extRad, float wedgeAngle, float ang1, float ang2) { }
public override void CreateCircleSegment(IGfxPath path, float inRad, float extRad, float wedgeAngle, float ang1, float ang2) { CreateCircleSegment(path, 0, 0, inRad, extRad, wedgeAngle, ang1, ang2); }