protected override void SubViewportDraw(ViewportDraw vd)
 {
     SetColor(vd.SubEntityTraits, Colour);
     Drawables.ForEach(drawable => drawable.VieportDraw(vd));
     SetColor(vd.SubEntityTraits, ColourSelected);
     SelectedDrawables.ForEach(drawable => drawable.VieportDraw(vd));
 }
Exemplo n.º 2
0
        protected override void SubViewportDraw(ViewportDraw vd)
        {
            //Draw a square polygon at snap point

            /*   Point2d gSize = vd.Viewport.GetNumPixelsInUnitSquare(_point);
             * double gHeight = CustomObjectSnapMode.GlyphSize / gSize.Y;
             * Matrix3d dTOw = vd.Viewport.EyeToWorldTransform;
             * Point3d[] gPts =
             *     {
             *         new Point3d(_point.X - gHeight/2.0, _point.Y - gHeight/2.0, _point.X).TransformBy(dTOw),
             *         new Point3d(_point.X + gHeight/2.0, _point.Y - gHeight/2.0, _point.X).TransformBy(dTOw),
             *         new Point3d(_point.X + gHeight/2.0, _point.Y + gHeight/2.0, _point.X).TransformBy(dTOw),
             *         new Point3d(_point.X - gHeight/2.0, _point.Y + gHeight/2.0, _point.X).TransformBy(dTOw),
             *    };
             * vd.Geometry.Polygon(new Point3dCollection(gPts));*/
            ////-----------------------------------------------------------
            ////如果你想画一个圆在提前点,
            ////简单的注释掉的代码和以上
            ////取消下面的代码
            ////-----------------------------------------------------------
            Point2d gSize = vd.Viewport.GetNumPixelsInUnitSquare(_point);
            double  dia   = CustomObjectSnapMode.GlyphSize / gSize.Y;

            vd.Geometry.Circle(_point, dia, Vector3d.ZAxis);
        }
Exemplo n.º 3
0
                public override bool ViewportDraw(ViewportDraw vd, ObjectId entityId, GripData.DrawType type, Point3d?imageGripPoint, int gripSize)
                {
                    Point2d unit = vd.Viewport.GetNumPixelsInUnitSquare(GripPoint);

                    vd.Geometry.Circle(GripPoint, gripSize / unit.X, vd.Viewport.ViewDirection);
                    return(true);
                }
Exemplo n.º 4
0
 protected override void SubViewportDraw(ViewportDraw vd)
 {
     foreach (var _ent in EntitiyList)
     {
         _ent.ViewportDraw(vd);
     }
 }
Exemplo n.º 5
0
        public int ViewportDrawLogicalFlags(ViewportDraw vd)
        {
            createInstance();
            int ViewportDrawL = BaseDrawable.ViewportDrawLogicalFlags(vd);

            tr.Dispose();
            return(ViewportDrawL);
        }
 public void VieportDraw(ViewportDraw wd)
 {
     if (_geometry is Rhino.Geometry.Point point)
     {
         var dbPoint = new Teigha.DatabaseServices.DBPoint(point.Location.ToHost());
         dbPoint.ViewportDraw(wd);
         dbPoint.Dispose();
     }
 }
Exemplo n.º 7
0
 protected override void SubViewportDraw(ViewportDraw vd)
 {
     using (var trSt = new TraitsState(vd.SubEntityTraits))
     {
         SetColor(vd.SubEntityTraits, Color);
         _drawables.ForEach(drawable => drawable.VieportDraw(vd));
         SetColor(vd.SubEntityTraits, ColorSelected);
         _selectedDrawables.ForEach(drawable => drawable.VieportDraw(vd));
     }
 }
Exemplo n.º 8
0
        protected override void SubViewportDraw(ViewportDraw vd)
        {
            Teigha.GraphicsInterface.Viewport vp = vd.Viewport;
            Matrix3d mat = vp.WorldToEyeTransform;
            Point3d  p0  = mat * m_pts[0];
            Point3d  p2  = mat * m_pts[2];

            m_pts[1] = new Point3d(p0.X, p2.Y, p2.Z);
            m_pts[3] = new Point3d(p2.X, p0.Y, p2.Z);

            mat      = vp.EyeToWorldTransform;
            m_pts[1] = m_pts[1].TransformBy(mat);
            m_pts[3] = m_pts[3].TransformBy(mat);
            vd.SubEntityTraits.FillType = FillType.FillNever;
            vd.Geometry.Polygon(m_pts);
            vp = null;
        }
Exemplo n.º 9
0
            public override bool ViewportDraw(ViewportDraw worldDraw, ObjectId entityId, DrawType type, Point3d?imageGripPoint,
                                              int gripSizeInPixels)
            {
                CoordinateSystem3d eCS = GetECS(entityId);
                Point2d            numPixelsInUnitSquare = worldDraw.Viewport.GetNumPixelsInUnitSquare(GripPoint);
                double             num = (double)gripSizeInPixels / numPixelsInUnitSquare.X;
                Point3dCollection  point3dCollections = new Point3dCollection();

                point3dCollections.Add((GripPoint - (num * eCS.Xaxis)) - (num * eCS.Yaxis));
                point3dCollections.Add((GripPoint - (num * eCS.Xaxis)) + (num * eCS.Yaxis));
                point3dCollections.Add((GripPoint + (num * eCS.Xaxis)) + (num * eCS.Yaxis));
                point3dCollections.Add((GripPoint + (num * eCS.Xaxis)) - (num * eCS.Yaxis));
                worldDraw.SubEntityTraits.FillType = FillType.FillAlways;
                worldDraw.Geometry.Polygon(point3dCollections);
                worldDraw.SubEntityTraits.FillType  = FillType.FillNever;
                worldDraw.SubEntityTraits.TrueColor = new EntityColor(0, 0, 0);
                worldDraw.Geometry.Polygon(point3dCollections);
                return(true);
            }
Exemplo n.º 10
0
        protected override void SubViewportDraw(ViewportDraw vd)
        {
            Point3d ptComputed = new Point3d();
            Point3d pDrawAtDrag;

            if (computeDragPoint(ref ptComputed))
            {
                pDrawAtDrag = ptComputed;
            }

            using (Teigha.GraphicsInterface.Viewport pViewport = vd.Viewport)
            {
                if (m_pOwner.Model == null || m_pOwner.Model.RenderType.GetHashCode() < 2 /*Teigha.GraphicsSystem.RenderType.kDirect*/)
                {
                    // Commented since renderTypes implemented, so no need to translate objects for kDirect renderType
                    Vector3d vpDirection = pViewport.ViewDirection;
                    Point3d  vpOrigin    = pViewport.CameraLocation;
                    Vector3d vecTmp      = ptComputed - vpOrigin;
                    double   ptLength    = vecTmp.DotProduct(vpDirection);
                    ptComputed -= vpDirection * ptLength;
                }

                Point2d  ptDim = pViewport.GetNumPixelsInUnitSquare(m_point);
                Vector3d v     = new Vector3d(m_pOwner.GRIPSIZE / ptDim.X, 0, 0);
                v = v.TransformBy(pViewport.WorldToEyeTransform);
                double dGripSize = v.Length;

                Point3d ptOnScreen = ptComputed.TransformBy(pViewport.WorldToEyeTransform);
                using (SubEntityTraits pSubTraits = vd.SubEntityTraits)
                {
                    pSubTraits.FillType = FillType.FillAlways;
                }
                Point3dCollection ptColl = new Point3dCollection();
                ptColl.Add(new Point3d(ptOnScreen.X - dGripSize, ptOnScreen.Y - dGripSize, ptOnScreen.Z));
                ptColl.Add(new Point3d(ptOnScreen.X + dGripSize, ptOnScreen.Y - dGripSize, ptOnScreen.Z));
                ptColl.Add(new Point3d(ptOnScreen.X + dGripSize, ptOnScreen.Y + dGripSize, ptOnScreen.Z));
                ptColl.Add(new Point3d(ptOnScreen.X - dGripSize, ptOnScreen.Y + dGripSize, ptOnScreen.Z));
                vd.Geometry.PolygonEye(ptColl);
            }
        }
Exemplo n.º 11
0
 protected override int SubViewportDrawLogicalFlags(ViewportDraw vd)
 {
     return(0);
 }
Exemplo n.º 12
0
 protected override void SubViewportDraw(ViewportDraw vd)
 {
 }
Exemplo n.º 13
0
 protected override int SubViewportDrawLogicalFlags(ViewportDraw vd) => (int)AttributesFlags.DrawableNone;
Exemplo n.º 14
0
 public void ViewportDraw(ViewportDraw vd)
 {
     createInstance();
     BaseDrawable.ViewportDraw(vd);
     tr.Dispose();
 }
        /// <inheritdoc />
        public override bool ViewportDraw(
            ViewportDraw worldDraw, ObjectId entityId, DrawType type, Point3d?imageGripPoint, int gripSizeInPixels)
        {
            var ecs = GetECS(entityId);
            var numPixelsInUnitSquare = worldDraw.Viewport.GetNumPixelsInUnitSquare(GripPoint);
            var num = gripSizeInPixels / numPixelsInUnitSquare.X;

            var point3dCollections = new Point3dCollection();

            switch (GripType)
            {
            case GripType.Point:
                point3dCollections = PointsForSquareGrip(num, ecs);
                break;

            case GripType.Plus:
                point3dCollections = PointsForPlusGrip(num, ecs);
                break;

            case GripType.Minus:
                point3dCollections = PointsForMinusGrip(num, ecs);
                break;

            case GripType.BasePoint:
                point3dCollections = PointsForSquareGrip(num, ecs);
                break;
            }

            var backupColor    = worldDraw.SubEntityTraits.Color;
            var backupFillType = worldDraw.SubEntityTraits.FillType;

            // Дополнительный круг и отрезки для точки отсчета
            if (GripType == GripType.BasePoint)
            {
                worldDraw.SubEntityTraits.Color = 110;
                worldDraw.Geometry.WorldLine(GripPoint - (num * 3 * ecs.Xaxis), GripPoint + (num * 3 * ecs.Xaxis));
                worldDraw.Geometry.WorldLine(GripPoint - (num * 3 * ecs.Yaxis), GripPoint + (num * 3 * ecs.Yaxis));
                worldDraw.Geometry.Circle(GripPoint, num * 2, Vector3d.ZAxis);
            }

            worldDraw.SubEntityTraits.FillType = FillType.FillAlways;
            worldDraw.SubEntityTraits.Color    = GetGripColor();
            if (GripType != GripType.Mirror)
            {
                worldDraw.Geometry.Polygon(point3dCollections);
            }
            else
            {
                worldDraw.Geometry.Polygon(PointsForReverseGripFirstArrow(num, ecs));
                worldDraw.Geometry.Polygon(PointsForReverseGripSecondArrow(num, ecs));
            }

            worldDraw.SubEntityTraits.FillType = FillType.FillNever;

            // обводка
            worldDraw.SubEntityTraits.Color = 250;
            if (GripType != GripType.Mirror)
            {
                worldDraw.Geometry.Polygon(point3dCollections);
            }
            else
            {
                worldDraw.Geometry.Polygon(PointsForReverseGripFirstArrow(num, ecs));
                worldDraw.Geometry.Polygon(PointsForReverseGripSecondArrow(num, ecs));
            }

            // restore
            worldDraw.SubEntityTraits.Color    = backupColor;
            worldDraw.SubEntityTraits.FillType = backupFillType;

            return(true);
        }
Exemplo n.º 16
0
 protected override void SubViewportDraw(ViewportDraw vd)
 {
     _ent.ViewportDraw(vd);
 }
Exemplo n.º 17
0
 public void ViewportDraw(ViewportDraw vd)
 {
     createInstance();
     BaseDrawable.ViewportDraw(vd);
     tr.Dispose();
 }
Exemplo n.º 18
0
 public int ViewportDrawLogicalFlags(ViewportDraw vd)
 {
     createInstance();
     int ViewportDrawL = BaseDrawable.ViewportDrawLogicalFlags(vd);
     tr.Dispose();
     return ViewportDrawL;
 }