Esempio n. 1
0
        internal DiagramItem(Diagram diagram)
        {
            _diagram = diagram;
            _label = null;
            _drawer = null;
            _geometry = null;
            _border = null;

            NeedRecalc = true;

            IsSelectable = true;
        }
Esempio n. 2
0
        protected void DrawSelectionBorder(Diagram diagram, DrawingContext dc, DiagramSelectionBorder border)
        {
            if (border == null)
                return;

            for (var i = 0; i < border.ResizeInfos.Count; i++)
            {
                var curInfo = border.ResizeInfos[i];
                var prevPointIndex = i != 0 ? i - 1 : border.ResizeInfos.Count - 1;
                var prevInfo = border.ResizeInfos[prevPointIndex];
                if (!curInfo.Point.HasValue || !prevInfo.Point.HasValue)
                    continue;

                if (border.IsLinked)
                    dc.DrawLine(GlobalData.BorderPen, curInfo.Point.Value, prevInfo.Point.Value);//GeometryTranslater.OffsetPoint(, diagram.Offset, diagram.Scale), GeometryTranslater.OffsetPoint(prevInfo.Point.Value, diagram.Offset, diagram.Scale));

                var resizeRect = curInfo.Rect;
                if (!resizeRect.HasValue)
                    continue;

                if (curInfo.ResizeDirection != ResizeDirection.None)
                    dc.DrawRectangle(GlobalData.BorderBrush, GlobalData.BorderPen, resizeRect.Value);//GeometryTranslater.OffsetRect(resizeRect.Value, diagram.Offset, diagram.Scale));
            }
        }
Esempio n. 3
0
        protected void CalculateGeometry(IDiagramItemDrawer drawer)
        {
            if (drawer == null)
                return;

            if (NeedRecalc == false)
                return;

            _geometry = drawer.CalculateGeometry(this);
            _border = drawer.CalculateBorder(this);

            NeedRecalc = false;
        }