Пример #1
0
        public override void GetDisplayList(DisplayItemList DLList
            , Matrix44 trans)
        {
            Debug.Assert(DLList != null && trans != null);
            if (null == DLList || null == trans) return;

            GePoint Base = new GePoint(0, 0, 0);
            GePoint End = new GePoint(m_Width, 0, 0);
            GePoint Top = new GePoint(m_Width, m_Height / 2, 0);
            GePoint Bottom = new GePoint(m_Width, -m_Height / 2, 0);
            Base.Transform(trans);
            End.Transform(trans);
            Top.Transform(trans);
            Bottom.Transform(trans);

            FRList<GePoint> PointList = new FRList<GePoint>();
            PointList.Add(Base);
            PointList.Add(Top);
            PointList.Add(Bottom);
            PointList.Add(Base);

            DisplayItemBuilder.GenDisplayItemLines(DLList, PointList);
            DisplayItemBuilder.GenDisplayItemPoint(DLList, Base);
            DisplayItemBuilder.GenDisplayItemPoint(DLList, End);
        }
Пример #2
0
        public override void GenerateGraphics(DisplayItemList DLList)
        {
            Debug.Assert(DLList != null);
            if (null == DLList) return;

            DisplayItemText DLText =
                DisplayItemBuilder.GenDisplayItemText(DLList, m_String, m_Position
                , PtApp.ActiveView.GetRichStringRange(m_String));

            GeRectangle rec = DLText.Range;
            if (rec != null)
            {
                rec.MoveTo(m_Position);

                GePoint MinPoint = rec.MinPoint;
                GePoint MaxPoint = rec.MaxPoint;
                GePoint Corner1 = new GePoint(MinPoint.X, MaxPoint.Y);
                GePoint Corner2 = new GePoint(MaxPoint.X, MinPoint.Y);

                DisplayItemBuilder.GenDisplayItemPoint(DLList, MinPoint);
                DisplayItemBuilder.GenDisplayItemPoint(DLList, MaxPoint);
                DisplayItemBuilder.GenDisplayItemPoint(DLList, Corner1);
                DisplayItemBuilder.GenDisplayItemPoint(DLList, Corner2);
            }
        }
Пример #3
0
        public static DisplayItemCircle GenDisplayItemCircle(DisplayItemList list, GePoint center, double radius)
        {
            DisplayItemCircle Circle = new DisplayItemCircle(
                center, radius);
            if (list != null)
                list.AddItem(Circle);

            return Circle;
        }
Пример #4
0
        public override void GenerateGraphics(DisplayItemList DLList)
        {
            Debug.Assert(DLList != null);
            if (null == DLList) return;

            if (m_Points.Count < 2) return;

            DisplayItemBuilder.GenDisplayItemPoints(DLList, m_Points);
            DisplayItemBuilder.GenDisplayItemLines(DLList, m_Points);
        }
Пример #5
0
        public static void GenDisplayItemLine(DisplayItemList DLList
            , GePoint startPoint, GePoint endPoint)
        {
            Debug.Assert(DLList != null && startPoint != null && endPoint != null);
            if (null == DLList || null == startPoint || null == endPoint) return;

            if (!startPoint.IsEqualTo(endPoint))
            {
                DisplayItemLine dpLine = new DisplayItemLine(startPoint, endPoint);
                DLList.AddItem(dpLine);
            }
        }
Пример #6
0
        protected GraphicNode(SymbolConstraint instance)
        {
            m_Instance = instance;

            // Attach the observer to sync the display list.
            //m_Instance.Attach(this);
            m_ItemList = new DisplayItemList();
            m_Visible = true;
            m_CanBeSelected = true;

            // Observe the instance change.
            ObserverManager.Instance.AddObserver(instance, this, EventType.eUpdate);
        }
        private DisplayItemList GetDisplayList()
        {
            if (m_ItemList != null)
                return m_ItemList;

            m_ItemList = new DisplayItemList();

            double radius = MathUtil.Min(m_ViewWidth / 3, m_ViewHeight / 3);
            GePoint center = new GePoint(m_ViewWidth / 2, m_ViewHeight / 2);
            DisplayItemBuilder.GenDisplayItemCircle(m_ItemList , center, radius);

            return m_ItemList;
        }
        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);
                 }
             }
        }
Пример #9
0
        public static void GenDisplayItemLines(DisplayItemList DLList, FRList<GePoint> points)
        {
            Debug.Assert(DLList != null && points != null);
            if (null == DLList || null == points) return;

            if (points.Count < 2) return;

            for (int i = 0; i < points.Count - 1; i++)
            {
                GePoint sp = points[i];
                GePoint ep = points[i + 1];

                GenDisplayItemLine(DLList, sp, ep);
            }
        }
Пример #10
0
        public override void GenerateGraphics(DisplayItemList DLList)
        {
            Debug.Assert(DLList != null);
            if (null == DLList) return;

            // create a 3D feature.
            DisplayItemList extDL = Extrusion.GetDisplayList();
            DLList.AddItem(extDL);

            Matrix44 trans = Matrix44.Identity;
            trans.SetScaling(2);
            trans.SetRotate(MathUtil.PI / 4, UnitVector.kXAxis, GePoint.kOrigin);
            trans.SetTranslation(new Vector(50, 50, 0));
            DLList.Transformation = trans;
        }
        public override void GenerateGraphics(DisplayItemList DLList)
        {
            if (null == DLList) return;

            GePoint leftButtom = m_BasePoint + UnitVector.kYAxis.Vector * m_Height * (-0.5);
            GePoint leftTop = m_BasePoint + UnitVector.kYAxis.Vector * m_Height * 0.5;
            GePoint rightButtom = leftButtom + m_Direction.Vector * m_Length;
            GePoint rightTop = leftTop + UnitVector.kXAxis.Vector * m_Length;

            //DisplayItemList DisplayList = new DisplayItemList();

            DisplayItemBuilder.GenDisplayItemLine(DLList, leftButtom, leftTop);
            DisplayItemBuilder.GenDisplayItemLine(DLList, leftTop, rightTop);
            DisplayItemBuilder.GenDisplayItemLine(DLList, rightTop, rightButtom);
            DisplayItemBuilder.GenDisplayItemLine(DLList, rightButtom, leftButtom);
        }
Пример #12
0
        public override void GenerateGraphics(DisplayItemList DLList)
        {
            if (null == DLList) return;

            if (m_dRadius < 0)
                return;

            //DisplayItemList DisplayList = new DisplayItemList();

            DisplayItemCircle Circle = new DisplayItemCircle(
                m_CenterPoint, m_dRadius);
            DLList.AddItem(Circle);

            DisplayItemPoint CenterPoint = new DisplayItemPoint(m_CenterPoint);
            DLList.AddItem(CenterPoint);
        }
Пример #13
0
        public override void GetDisplayList(DisplayItemList DLList
            , Matrix44 trans)
        {
            Debug.Assert(DLList != null && trans != null);
            if (null == DLList || null == trans) return;

            GePoint Base = new GePoint(0, 0, 0);
            GePoint End = new GePoint(m_Width, 0, 0);
            GePoint Top = new GePoint(m_Width, m_Height / 2, 0);
            GePoint Bottom = new GePoint(m_Width, -m_Height / 2, 0);
            Base.Transform(trans);
            End.Transform(trans);
            Top.Transform(trans);
            Bottom.Transform(trans);

            FRList<GePoint> PointList = new FRList<GePoint>();
            PointList.Add(Base);
            PointList.Add(Top);
            PointList.Add(Bottom);
            PointList.Add(Base);

            FRList<GePoint> meshPoints = new FRList<GePoint>();
            meshPoints.Add(Base);
            meshPoints.Add(End);
            meshPoints.Add(Top);
            meshPoints.Add(Bottom);

            // Use two triangles
            FRList<int> connectivity = new FRList<int>();
            connectivity.Add(0);
            connectivity.Add(1);
            connectivity.Add(2);

            connectivity.Add(0);
            connectivity.Add(1);
            connectivity.Add(3);

            DisplayItemBuilder.GenDisplayItemLines(DLList, PointList);
            DisplayItemBuilder.GenDisplayItemMesh(DLList
                , connectivity, meshPoints, null, null);
            DisplayItemBuilder.GenDisplayItemPoint(DLList, Base);
            DisplayItemBuilder.GenDisplayItemPoint(DLList, End);
        }
Пример #14
0
        public static void GenDisplayItemLines(DisplayItemList DLList, GeRectangle rec)
        {
            Debug.Assert(DLList != null && rec != null);
            if (null == DLList || null == rec) return;

            GePoint MinPoint = rec.MinPoint;
            GePoint MaxPoint = rec.MaxPoint;
            GePoint Corner1 = new GePoint(MinPoint.X, MaxPoint.Y);
            GePoint Corner2 = new GePoint(MaxPoint.X, MinPoint.Y);

            // Add the bounding of the rectangular.
            GenDisplayItemLine(DLList, Corner1, MinPoint);
            GenDisplayItemLine(DLList, MinPoint, Corner2);
            GenDisplayItemLine(DLList, Corner2, MaxPoint);
            GenDisplayItemLine(DLList, MaxPoint, Corner1);
            DLList.AddItem(new DisplayItemPoint(MinPoint));
            DLList.AddItem(new DisplayItemPoint(MaxPoint));
            DLList.AddItem(new DisplayItemPoint(Corner1));
            DLList.AddItem(new DisplayItemPoint(Corner2));
        }
Пример #15
0
 public RotateGraphicObserver(double width, double height)
 {
     m_ViewWidth = width;
     m_ViewHeight = height;
     m_ItemList = null;
 }
Пример #16
0
        public static DisplayItemPoint GenDisplayItemPoint(DisplayItemList list, GePoint position)
        {
            DisplayItemPoint DLPoint = new DisplayItemPoint(position);
            if (list != null)
                list.AddItem(DLPoint);

            return DLPoint;
        }
Пример #17
0
 public abstract void GetDisplayList(DisplayItemList DLList, Matrix44 trans);
Пример #18
0
        public static void GenDisplayItemPoints(DisplayItemList DLList, FRList<GePoint> points)
        {
            Debug.Assert(DLList != null && points != null);
            if (null == DLList || null == points) return;

            for (int i = 0; i < points.Count; i++)
            {
                GePoint point = points[i];
                DisplayItemPoint DLPoint = new DisplayItemPoint(point);
                DLList.AddItem(DLPoint);
            }
        }
Пример #19
0
        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;
        }
Пример #20
0
        public static void GenDisplayItemMesh(DisplayItemList DLList, FRList<int> connectivity
            , FRList<GePoint> points, FRList<UnitVector> normals
            , FRList<Color> colors)
        {
            Debug.Assert(DLList != null && connectivity != null && points != null);
            if (null == DLList || null == connectivity || null == points) return;

            if (connectivity.Count < 3 || points.Count < 3) return;

            DisplayItemMesh mesh = new DisplayItemMesh();

            mesh.Connectivity = connectivity;
            mesh.Points = points;
            mesh.Normals = normals;
            mesh.Colors = colors;

            DLList.AddItem(mesh);
        }