protected override Manipulator OnItemSelection(DisplayItemText SelectedItem) { try { return new TextManipulator((TextInstance)m_Node.GetInstance()); } catch { return null; } }
public override void GenerateGraphics(DisplayItemList DLList) { Debug.Assert(DLList != null); if (null == DLList) return; // It must exist two point at least. if (m_AttachPoint == null) return; if (m_InternalPoints.Empty()) return; // Attach point to the first internal point GePoint p1 = m_AttachPoint; GePoint p2 = m_InternalPoints[0]; // If the first two points are equal, we needn't continue to calculate. if (p1.IsEqualTo(p2)) return; Matrix44 trans = new Matrix44(); trans.SetTranslation(p1 - GePoint.kOrigin); //trans.SetRotate(MathFactory.Math.PI, UnitVector.kZAxis, GePoint.kOrigin); Vector direction = p2 - p1; trans.SetRotate(UnitVector.kXAxis, direction.UnitVector, GePoint.kOrigin); //trans.SetRotate(UnitVector.kXAxis, UnitVector.kYAxis, p2); // Arrowhead BFxSolidArrowHead arrow = new BFxSolidArrowHead(); arrow.GetDisplayList(DLList, trans); DisplayItemBuilder.GenDisplayItemLine(DLList, p1, p2); DisplayItemBuilder.GenDisplayItemPoint(DLList, p1); DisplayItemBuilder.GenDisplayItemLines(DLList, m_InternalPoints); DisplayItemBuilder.GenDisplayItemPoints(DLList, m_InternalPoints); // Text if (!m_Text.Empty) { GeRectangle rec = PtApp.ActiveView.GetRichStringRange(m_Text); if (rec != null) { Vector offset = new Vector(0, -rec.Height / 2, 0); GePoint basePoint = m_InternalPoints[m_InternalPoints.Count - 1] + offset; DisplayItemText DLText = new DisplayItemText(m_Text.GetString(), basePoint, PtApp.ActiveDocument.GetFontManager().GetFont(m_Text.FontID)); DLList.AddItem(DLText); rec.MoveTo(basePoint); DisplayItemBuilder.GenDisplayItemLines(DLList, rec); } } }
protected virtual Manipulator OnItemSelection(DisplayItemText SelectedItem) { return null; }
public static DisplayItemText GenDisplayItemText(DisplayItemList list, RichString str, GePoint position, GeRectangle rec) { //GeRectangle rec = PtApp.ActiveView.GetRichStringRange(str); DisplayItemText DLText = new DisplayItemText(str.GetString(), position, str.GetFont()); DLText.Range = rec; if (list != null) list.AddItem(DLText); return DLText; }