Exemplo n.º 1
0
        public override void Draw(Graphics graphics)
        {
            if (Visible)
            {
                SetDrawerGraphic(graphics);

                positionSetDrawerPump.ResetPump();
                positionSetDrawerPump.DrawCoordinate(pointCoordinateDrawer);
                positionSetDrawerPump.DrawPoint(pointDrawer);
                positionSetDrawerPump.Run();
            }
        }
Exemplo n.º 2
0
        public override void Draw(Graphics graphics)
        {
            if (Visible)
            {
                SetDrawerGraphic(graphics);

                positionSetDrawerPump.ResetPump();
                positionSetDrawerPump.DrawPoint(hullPointDrawer);
                positionSetDrawerPump.DrawCoordinate(hullPointCoordinateDrawer);
                positionSetDrawerPump.DrawLineClose(hullLineDrawer);
                if (fillColor)
                {
                    positionSetDrawerPump.FillPloygon(polygonDrawer);
                }
                positionSetDrawerPump.Run();
            }
        }
Exemplo n.º 3
0
        public override void Draw(Graphics graphics)
        {
            if (Visible)
            {
                SetDrawerGraphic(graphics);

                List <IPosition_Connected> PartMiddlePointList = new List <IPosition_Connected>();

                List <PointF[]> PointArrayList = new List <PointF[]>();

                ILevel       level       = m2mStructure.GetLevel(levelSequence);
                IPart        rootPart    = m2mStructure.GetLevel(0).GetPartRefByPartIndex(0, 0);
                IPositionSet positionSet = m2mStructure.GetDescendentPositionSetByAncestorPart(levelSequence, rootPart, 0);

                Dictionary <IPosition, IPosition_Connected_Edit> partToPositionDictionary = new Dictionary <IPosition, IPosition_Connected_Edit>();

                positionSet.InitToTraverseSet();
                while (positionSet.NextPosition())
                {
                    Position_Connected_Edit PartDeputyPosition_Connected = new Position_Connected_Edit();
                    partToPositionDictionary.Add(positionSet.GetPosition(), PartDeputyPosition_Connected);
                }

                positionSet.InitToTraverseSet();

                while (positionSet.NextPosition())
                {
                    IPart_Connected currentPart = (IPart_Connected)positionSet.GetPosition();

                    IPositionSet bottomLevelPositionSet = m2mStructure.GetBottonLevelPositionSetByAncestorPart(currentPart, levelSequence);

                    IPosition tempPoint = PositionSetAttribute.GetGravityCenter(bottomLevelPositionSet);

                    IPosition_Connected_Edit PartDeputyPosition_Connected;
                    partToPositionDictionary.TryGetValue(positionSet.GetPosition(), out PartDeputyPosition_Connected);
                    PartDeputyPosition_Connected.SetX(tempPoint.GetX());
                    PartDeputyPosition_Connected.SetY(tempPoint.GetY());


                    currentPart.GetAdjacencyPositionSet().InitToTraverseSet();

                    while (currentPart.GetAdjacencyPositionSet().NextPosition())
                    {
                        IPosition_Connected_Edit adjDeputy;
                        partToPositionDictionary.TryGetValue(currentPart.GetAdjacencyPositionSet().GetPosition(), out adjDeputy);

                        PartDeputyPosition_Connected.GetAdjacencyPositionSetEdit().AddAdjacency(
                            adjDeputy, currentPart.GetAdjacencyPositionSet().GetDistanceToAdjacency());
                    }

                    PartMiddlePointList.Add(PartDeputyPosition_Connected);

                    IPositionSet ConvexHullPointSet = null;

                    if (bottomLevelPositionSet.GetNum() > 1)
                    {
                        ConvexHullPointSet = new QuickHull().ConvexHull(bottomLevelPositionSet);
                    }
                    else
                    {
                        ConvexHullPointSet = bottomLevelPositionSet;
                    }

                    PointF[] tempArray = new PointF[ConvexHullPointSet.GetNum()];

                    int sequence = 0;
                    ConvexHullPointSet.InitToTraverseSet();
                    while (ConvexHullPointSet.NextPosition())
                    {
                        tempArray[sequence].X = ConvertRealXToScreenX(ConvexHullPointSet.GetPosition().GetX());
                        tempArray[sequence].Y = ConvertRealYToScreenY(ConvexHullPointSet.GetPosition().GetY());
                        sequence++;
                    }

                    PointArrayList.Add(tempArray);
                }

                Pen   pen   = new Pen(partColor, partBorderWidth);
                Brush brush = new SolidBrush(Color.FromArgb(alpha, partColor));

                foreach (PointF[] pointArray in PointArrayList)
                {
                    if (pointArray.Length >= 2)
                    {
                        graphics.DrawPolygon(pen, pointArray);
                        graphics.FillPolygon(brush, pointArray);
                    }
                }

                this.positionSet = new PositionSet_ConnectedEdit(PartMiddlePointList);

                positionSetDrawerPump.ResetPump();
                positionSetDrawerPump.DrawCoordinate(pointCoordinateDrawer);
                positionSetDrawerPump.DrawPoint(pointDrawer);
                positionSetDrawerPump.DrawConnection(connectionDrawer);
                positionSetDrawerPump.Run();
            }
        }