예제 #1
0
        public void GenChart(GEDCOMIndividualRecord iRec, TreeChartKind kind, bool rootCenter)
        {
            if (iRec == null)
            {
                return;
            }

            try
            {
                fSelected = null;

                fModel.GenChart(iRec, kind, rootCenter);

                RecalcChart();

                if (rootCenter)
                {
                    CenterPerson(fModel.Root, false);
                }

                NavAdd(iRec);
                DoRootChanged(fModel.Root);
            }
            catch (Exception ex)
            {
                Logger.LogWrite("TreeChartBox.GenChart(): " + ex.Message);
            }
        }
예제 #2
0
        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);
            }
        }