Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
0
 // this more informative callback may be used to implement subentities selection
 public override SelectionReactorResult Selected(PathNode pthNode, Teigha.GraphicsInterface.Viewport viewInfo)
 {
     return(SelectionReactorResult.NotImplemented);
 }