Exemplo n.º 1
0
 public override void DrawLine(
     GePoint sPoint, GePoint ePoint)
 {
     Pen pen = GetPen();
     m_Graphics.DrawLine(pen, sPoint.X, sPoint.Y,
         ePoint.X, ePoint.Y);
 }
 public LeaderTextGraphicState(DataFragment fragment)
     : base(fragment)
 {
     m_AttachPoint = new GePoint();
     m_InternalPoints = new FRList<GePoint>();
     m_Text = new RichString(PtApp.ActiveDocument.GetFontManager());
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
            }
        }
        public override void DrawPoint(GePoint point)
        {
            SelectionGraphicContext GpCtx = (SelectionGraphicContext)m_GraphicContext;
            if (GpCtx == null) return;

            point = GetDevicePoint(point);

            // Apply the point attribute
            PointSizeAttribute sizeAtt = new PointSizeAttribute(GpCtx.m_fPointViewRadius * 2);
            ColorAttribute colAtt = new ColorAttribute(GpCtx.m_PointBrushColor);
            sizeAtt.Apply(m_Device);
            colAtt.Apply(m_Device);

            m_Device.DrawPoint(point);

            colAtt.UnApply(m_Device);
            sizeAtt.UnApply(m_Device);

            LineStyleAttribute linAtt = new LineStyleAttribute(2.0f);
            ColorAttribute linColAtt = new ColorAttribute(GpCtx.m_PointPenColor);
            linAtt.Apply(m_Device);
            linColAtt.Apply(m_Device);

            m_Device.DrawCircle(point, GpCtx.m_fPointViewRadius);

            linColAtt.UnApply(m_Device);
            linAtt.UnApply(m_Device);
        }
Exemplo n.º 6
0
 public DisplayItemText(String str, GePoint Position, Font font)
 {
     m_String = str;
     m_Position = Position;
     m_Font = font;
     m_Range = new GeRectangle();
 }
Exemplo n.º 7
0
        public GeLine(GePoint sp, GePoint ep)
        {
            Debug.Assert(sp != null && ep != null);

            VectorAdaptor dir = ep._Proxy - sp._Proxy;
            m_Proxy = MathAdaptorFactory.Instance.CreateLineAdaptor(
                sp._Proxy, dir.UnitVectorAdaptor);
        }
Exemplo n.º 8
0
        public virtual void DrawCircle(
            GePoint centerPoint, float fRadius)
        {
            float raduis = (float)GetWorldToDeviceScale() * fRadius;

            m_Device.DrawCircle(GetDevicePoint(centerPoint)
                , raduis);
        }
 public UmlTimeLineGraphicState(DataFragment fragment)
     : base(fragment)
 {
     m_Height = 40.0;
     m_Length = 200.0;
     m_BasePoint = new GePoint(50.0, 20.0, 0.0);
     m_Direction = UnitVector.kXAxis;
 }
Exemplo n.º 10
0
 public PositionDataItem(GePoint point)
 {
     Debug.Assert(point != null);
     if(point != null)
     {
         m_point = (GePoint)point.Clone();
     }
 }
Exemplo n.º 11
0
 public override void DrawCircle(
     GePoint cneterPoint, float fRadius)
 {
     // Add 1 to justify the circle  size.
     // When we draw a point with the bound circle,
     // the bound circle should be greater than the point size.
     m_OpenGL.DrawCircle(cneterPoint, fRadius + 1);
 }
Exemplo n.º 12
0
 public GeRectangle(GeRectangle src)
 {
     if(src != null)
     {
         m_MinPoint = new GePoint(src.MinPoint);
         m_MaxPoint = new GePoint(src.m_MaxPoint);
     }
 }
        public ViewTransformManipulator(Matrix44 DeviceToWorld)
        {
            Debug.Assert(DeviceToWorld != null);

            m_DeviceToWorld = DeviceToWorld;

            m_LastPoint = GePoint.kOrigin;
            m_CursorShape = "Translation.cur";
        }
Exemplo n.º 14
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;
        }
Exemplo n.º 15
0
        public override void DrawCircle(
            GePoint cneterPoint, float fRadius)
        {
            Pen pen = GetPen();

            RectangleF rect = new RectangleF(cneterPoint.X - fRadius, cneterPoint.Y - fRadius
                , fRadius * 2, fRadius * 2);
            m_Graphics.DrawArc(pen, rect, 0, 360);
        }
Exemplo n.º 16
0
        public void SetPosition(GePoint Position)
        {
            Debug.Assert(Position != null);
            if (Position != null)
                m_Position = (GePoint)Position.Clone();

            //if (m_String.FontID > -1)
            //GraphicChangeNotify();
        }
        public override void DrawLine(GePoint sPoint, GePoint ePoint)
        {
            if (m_GraphicContext == null) return;
            ColorAttribute colAtt = new ColorAttribute(m_GraphicContext.m_DrawingColor);
            colAtt.Apply(m_Device);

            base.DrawLine(sPoint, ePoint);

            colAtt.UnApply(m_Device);
        }
        private SymbolConstraint m_SymbolToAttach; // it is null if there is no

        #endregion Fields

        #region Constructors

        public CircleCenterMoveRequest(CircleInstance draggedCircle,
            GePoint newPosition,
            SymbolConstraint symbolToAttach,
            int pointIndex)
        {
            m_DraggedCircle = draggedCircle;
            m_NewPosition = newPosition;
            m_SymbolToAttach = symbolToAttach;
            m_PointIndex = pointIndex;
        }
        public override void DrawCircle(
            GePoint centerPoint, float fRadius)
        {
            if (m_GraphicContext == null) return;
            ColorAttribute colAtt = new ColorAttribute(m_GraphicContext.m_DrawingColor);
            colAtt.Apply(m_Device);

            base.DrawCircle(centerPoint, fRadius);

            colAtt.UnApply(m_Device);
        }
Exemplo n.º 20
0
        // The old point can't be null, the trans can be null.
        public static GePoint GetTransformedPoint(GePoint oldPoint, Matrix44 trans)
        {
            Debug.Assert(oldPoint != null);
            GePoint newPoint = null;
            if (oldPoint != null && trans != null)
                newPoint = trans * oldPoint;
            else // either of them is null.
                newPoint = oldPoint;

            return newPoint;
        }
Exemplo n.º 21
0
        public void DrawLine(GePoint start, GePoint end)
        {
            Debug.Assert(start != null && end != null);
            if (null == start || null == end) return;

            //Draw Line
            GL.glBegin(GL.GL_LINES);
            GL.glVertex3d(start.X, start.Y, start.Z);
            GL.glVertex3d(end.X, end.Y, end.Z);
            GL.glEnd();
        }
Exemplo n.º 22
0
        protected override EventResult OnLeftDoubleClick(EventContext Context)
        {
            m_MousePoint = Context.MouseWorldPoint;

            DMStateCommand cmd = m_ParentState.CommandExeCtx.Command as DMStateCommand;

            if (cmd != null)
                cmd.ShowDialog();

            return EventResult.eDone;
        }
Exemplo n.º 23
0
        public SelectContext()
        {
            //m_dSelTolerance = 5;
            m_RefPoint = new GePoint(0, 0);
            m_bMultiSelect = false;

            m_HittedDLPoints = new FRMultiMap<double, DisplayItem>();
            m_HittedDLItems = new FRMultiMap<double, DisplayItem>();

            m_SelectTolerance = 5;
            m_Device = null;
        }
Exemplo n.º 24
0
        public void AddLastPointBefore(GePoint point)
        {
            if (point != null)
            {
                if (!m_Points.Empty())
                    m_Points.Insert(m_Points.Count - 1, point);
                else
                    m_Points.Add(point);

                //GraphicChangeNotify();
            }
        }
Exemplo n.º 25
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);
            }
        }
Exemplo n.º 26
0
        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;
        }
Exemplo n.º 27
0
 public void AddLastPointBefore(GePoint point)
 {
     if (point != null)
     {
         if (m_InternalPoints.Empty())
         {
             m_AttachPoint.Point = point;
             m_InternalPoints.Add(point);
         }
         else
             m_InternalPoints.Insert(m_InternalPoints.Count - 1, point);
     }
 }
Exemplo n.º 28
0
        public void Match(GePoint point, PositionIntent itent)
        {
            Debug.Assert(point != null && itent != null && m_SnapContext != null);
            if (null == point || null == itent) return;

            // Point match
            m_SnapContext.Accept(new GePointVisitor(m_SnapContext, point));
            if(m_SnapContext.HasResult())
            {
                itent.SetGeometryConstraint(m_SnapContext.SnappedGeometryConstraint);
                itent.SetPoint(m_SnapContext.SnappedPoint);
                return;
            }

            // Line match

            return;
        }
Exemplo n.º 29
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);
        }
Exemplo n.º 30
0
        public static SnapContext InitalizeSnapContextFromPreSelection(GePoint mousePoint)
        {
            Debug.Assert(mousePoint != null);

            SnapContext snapCtx = new SnapContext(PtApp.ActiveDocument.Database);

            PtSelectContext sltCtx = new PtSelectContext();
            sltCtx.WorldPoint = mousePoint;

            SelectionSet tempSet =
                PtApp.ActiveView.SelectionMgr.CreateSelectionSet("SnapTemporarySet");
            tempSet.Clear();
            sltCtx.CurrentSelectionSet = tempSet;

            PtApp.ActiveView.Select(sltCtx);

            // Set selection set.
            SelectionSet PreSet = PtApp.ActiveView.SelectionMgr.GetPreviewSelectionSet();
            PreSet.Clear();

            if (!tempSet.Empty())
            {
                foreach (Selection selection in tempSet.Selections)
                {
                    SymbolConstraint instance = selection.GetInstance();
                    Debug.Assert(instance != null);

                    SymbolGeometryConstraint constr = instance.GetGeometryConstraint(
                        mousePoint, snapCtx.SnapTolerance);
                    if (constr != null)
                    {
                        // We just highlight the snapped nodes.
                        snapCtx.CandidateProxies.Add(constr);
                        PreSet.AddSelection(selection);
                    }
                }
            }

            PtApp.ActiveView.UpdateView();

            return snapCtx;
        }