protected override int SubSetAttributes(DrawableTraits traits) { int i = AttributesFlags.DrawableIsInvisible.GetHashCode(); if (Invisible == true) { return(AttributesFlags.DrawableIsInvisible.GetHashCode()); } if (traits is SubEntityTraits) { SubEntityTraits entTraits = (SubEntityTraits)traits; switch (Status) { case GripData.DrawType.WarmGrip: entTraits.TrueColor = m_pOwner.GRIPCOLOR; break; case GripData.DrawType.HotGrip: case GripData.DrawType.DragImageGrip: entTraits.TrueColor = m_pOwner.GRIPHOT; break; case GripData.DrawType.HoverGrip: entTraits.TrueColor = m_pOwner.GRIPHOVER; break; } } return(AttributesFlags.DrawableNone.GetHashCode()); }
public TraitsState(SubEntityTraits subEntityTraits) { _subEntityTraits = subEntityTraits; _entColor = subEntityTraits.TrueColor; _transparency = subEntityTraits.Transparency; _visualStyle = subEntityTraits.VisualStyle; _selectionFlags = subEntityTraits.SelectionFlags; }
protected override int SubSetAttributes(DrawableTraits traits) { if (null == cloneEnt) { return(AttributesFlags.DrawableIsInvisible.GetHashCode()); } else { int iRet = cloneEnt.SetAttributes(traits); if (traits is SubEntityTraits) { SubEntityTraits pEntityTraits = (SubEntityTraits)traits; pEntityTraits.FillType = FillType.FillNever; return(iRet); } } return(AttributesFlags.DrawableNone.GetHashCode()); }
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); } }
private bool SetColor(SubEntityTraits st, System.Drawing.Color color) { st.TrueColor = new Teigha.Colors.EntityColor(color.R, color.G, color.B); st.Transparency = new Teigha.Colors.Transparency(color.A); return(true); }
public override bool WorldDraw(Drawable drawable, WorldDraw wd) { if (wd.RegenAbort || wd.IsDragging) { return(base.WorldDraw(drawable, wd)); } RebarPos pos = drawable as RebarPos; if (pos == null) { return(base.WorldDraw(drawable, wd)); } PosShape shape = PosShape.GetPosShape(pos.Shape); Extents3d?shapeExt = shape.Bounds; if (!shapeExt.HasValue) { return(base.WorldDraw(drawable, wd)); } Extents3d ext = shapeExt.Value; WorldGeometry g = wd.Geometry; SubEntityTraits s = wd.SubEntityTraits; TextStyle style = new TextStyle(); // Get geometry Point3d pt = pos.BasePoint; Vector3d dir = pos.DirectionVector; Vector3d up = pos.UpVector; Vector3d norm = pos.NormalVector; double w = pos.Width / dir.Length; double h = pos.Height / dir.Length; // Draw bound dimension lines foreach (RebarPos.BoundDimension dim in pos.GetBoundDimensions()) { Line line = new Line(dim.TextPosition, pos.BasePoint); g.Draw(line); } // Draw shape double xmin = ext.MinPoint.X, ymin = ext.MinPoint.Y, xmax = ext.MaxPoint.X, ymax = ext.MaxPoint.Y; // Scale double scale = 0.025; // Client offsets double xoff = (w - scale * (xmax - xmin)) / 2.0; double yoff = 2.0 * h;//(h - scale * (ymax - ymin)) / 2.0; // Transform Matrix3d trans = Matrix3d.AlignCoordinateSystem(new Point3d(xmin, ymin, 0), Vector3d.XAxis / scale, Vector3d.YAxis / scale, Vector3d.ZAxis / scale, pt + dir * xoff + up * yoff, dir, up, norm); g.PushModelTransform(trans); // Draw shapes shape.SetShapeTexts(pos.A, pos.B, pos.C, pos.D, pos.E, pos.F); g.Draw(shape); shape.ClearShapeTexts(); // Reset transform g.PopModelTransform(); return(base.WorldDraw(drawable, wd)); }