public void RecalcChart(bool noRedraw = false) { float fsz = (float)Math.Round(fOptions.DefFontSize * fModel.Scale); fModel.DrawFont = AppHost.GfxProvider.CreateFont(fOptions.DefFontName, fsz, false); Graphics gfx = null; if (fRenderer is TreeChartGfxRenderer) { gfx = CreateGraphics(); fRenderer.SetTarget(gfx, false); } try { fModel.RecalcChart(noRedraw); } finally { if (fRenderer is TreeChartGfxRenderer && gfx != null) { gfx.Dispose(); } } var imageSize = GetImageSize(); AdjustViewport(imageSize, noRedraw); }
private void DrawDeep(DeepMode mode, int spx, int spy) { try { using (var deepModel = new TreeChartModel()) { deepModel.Assign(fModel); deepModel.SetRenderer(fRenderer); deepModel.DepthLimitAncestors = 2; deepModel.DepthLimitDescendants = 2; deepModel.GenChart(fSelected.Rec, TreeChartKind.ckBoth, true); deepModel.RecalcChart(true); var pers = deepModel.FindPersonByRec(fSelected.Rec); if (pers == null) { Logger.WriteError("TreeChartBox.DrawDeep(): unexpected failure"); return; } int dmX = (spx + (fSelected.PtX - pers.PtX)); int dmY = (spy + (fSelected.PtY - pers.PtY)); deepModel.SetOffsets(dmX, dmY); deepModel.VisibleArea = ExtRect.CreateBounds(0, 0, deepModel.ImageWidth, deepModel.ImageHeight); switch (mode) { case DeepMode.Background: fRenderer.SetTranslucent(0.75f); break; case DeepMode.Foreground: fRenderer.SetTranslucent(0.25f); IPen xpen = fRenderer.CreatePen(ChartRenderer.GetColor(BSDColors.Black), 2.0f); IColor bColor = ChartRenderer.GetColor(BSDColors.White); fRenderer.DrawRoundedRectangle(xpen, bColor, dmX, dmY, deepModel.ImageWidth, deepModel.ImageHeight, 6); fRenderer.SetTranslucent(0.00f); break; } deepModel.Draw(ChartDrawMode.dmStatic); } } catch (Exception ex) { Logger.WriteError("TreeChartBox.DrawDeep()", ex); } }
public void RecalcChart(bool noRedraw = false) { Graphics gfx = null; if (fRenderer is EtoGfxRenderer) { //gfx = CreateGraphics(); //fRenderer.SetTarget(gfx, false); } try { fModel.RecalcChart(noRedraw); } finally { if (fRenderer is EtoGfxRenderer && gfx != null) { gfx.Dispose(); } } var imageSize = GetImageSize(); SetImageSize(imageSize, noRedraw); }