/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PaintTo3D (IPaintTo3D)"/> /// </summary> /// <param name="paintTo3D"></param> public override void PaintTo3D(IPaintTo3D paintTo3D) { if (!paintTo3D.SelectMode) { if (colorDef != null) { paintTo3D.SetColor(colorDef.Color); } } if (OnPaintTo3D != null && OnPaintTo3D(this, paintTo3D)) { return; } if (paintTo3D.SelectMode) { // paintTo3D.Points(new GeoPoint[] { this.location }, (float)this.size); // im Selectmode gibts Abstürze bei "0901_06_01_0.dxf", wenn man eine Bemaßung markiert // und die normale Darstellung verwendet paintTo3D.Points(new GeoPoint[] { location }, (float)size, this.symbol | PointSymbol.Select); } else { paintTo3D.Points(new GeoPoint[] { location }, 1.0f, symbol); // folgendes geht viel schneller: //paintTo3D.Polyline(new GeoPoint[] { location - size * GeoVector.XAxis, location + size * GeoVector.XAxis }); //paintTo3D.Polyline(new GeoPoint[] { location - size * GeoVector.YAxis, location + size * GeoVector.YAxis }); //paintTo3D.Polyline(new GeoPoint[] { location - size * GeoVector.ZAxis, location + size * GeoVector.ZAxis }); } }
void ICanvas.ShowView(IView toShow) { if (paintTo3D is PaintToOpenGL openGL) { openGL.Disconnect(this); } view = toShow; switch (toShow.PaintType) { case "GDI": // create the GDI paint machine this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, false); paintTo3D = new PaintToGDI(toShow.Projection, this.CreateGraphics()); break; case "3D": default: { // create the OpenGL machine this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, false); this.DoubleBuffered = false; PaintToOpenGL paintToOpenGL = new PaintToOpenGL(1e-6); paintToOpenGL.Init(this); paintTo3D = paintToOpenGL; } break; } view.Connect(this); Invalidate(); }
internal static void InvokeSetProjection(IntPtr renderContext, IPaintTo3D paintTo3D, Projection projection, BoundingCube boundingCube) { if (SetProjectionEvent != null) { SetProjectionEvent(renderContext, paintTo3D, projection, boundingCube); } }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PaintTo3D (IPaintTo3D)"/> /// </summary> /// <param name="paintTo3D"></param> public override void PaintTo3D(IPaintTo3D paintTo3D) { if (OnPaintTo3D != null && OnPaintTo3D(this, paintTo3D)) { return; } if (!paintTo3D.SelectMode) { if (colorDef != null) { paintTo3D.SetColor(colorDef.Color); } } if (lineWidth != null) { paintTo3D.SetLineWidth(lineWidth); } if (linePattern != null) { paintTo3D.SetLinePattern(linePattern); } else { paintTo3D.SetLinePattern(null); } paintTo3D.Polyline(new GeoPoint[] { startPoint, endPoint }); }
void IFeedBack.PaintTo3D(IPaintTo3D paintTo3D) { paintTo3D.UseZBuffer(true); paintTo3D.Blending(true); paintTo3D.SetColor(color); GeoPoint[] pnts = new GeoPoint[4]; pnts[0] = pln.ToGlobal(new GeoPoint2D(-width / 2, -height / 2)); pnts[1] = pln.ToGlobal(new GeoPoint2D(width / 2, -height / 2)); pnts[2] = pln.ToGlobal(new GeoPoint2D(width / 2, height / 2)); pnts[3] = pln.ToGlobal(new GeoPoint2D(-width / 2, height / 2)); GeoVector[] norm = new GeoVector[4]; norm[0] = pln.Normal; norm[1] = pln.Normal; norm[2] = pln.Normal; norm[3] = pln.Normal; int[] ind = new int[6]; ind[0] = 0; ind[1] = 1; ind[2] = 2; ind[3] = 0; ind[4] = 2; ind[5] = 3; paintTo3D.Triangle(pnts, norm, ind); paintTo3D.Blending(false); paintTo3D.UseZBuffer(true); }
private void PaintFlatVisibleLayer(IPaintTo3D iPaintTo3D, IGeoObject go, Hashtable visibleLayers) { // beim Drucken dürfen keine Displaylisten verwendet werden, denn es geht auf ein Bitmap // deshalb hier rekursiv runterbrechen, bis die Ebene klar ist und dann ohne Liste // auf iPaintTo3D ausgeben. if (go is Block) { Block blk = go as Block; for (int i = 0; i < blk.Count; ++i) { PaintFlatVisibleLayer(iPaintTo3D, blk.Child(i), visibleLayers); } } else if (go is BlockRef) { PaintFlatVisibleLayer(iPaintTo3D, (go as BlockRef).Flattened, visibleLayers); } else { if (go.Layer == null || visibleLayers.ContainsKey(go.Layer)) { go.PaintTo3D(iPaintTo3D); // iPaintTo3D enthält die Information, dass keine Listen verwendet werden dürfen } } }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PaintTo3D (IPaintTo3D)"/> /// </summary> /// <param name="paintTo3D"></param> public override void PaintTo3D(IPaintTo3D paintTo3D) { ModOp m = ModOp.Translate(location.x, location.y, location.z) * ModOp.Scale(paintTo3D.PixelToWorld); paintTo3D.PushMultModOp(m); geoObject.PaintTo3D(paintTo3D); paintTo3D.PopModOp(); }
internal void Repaint(Rectangle IsInvalid, IView View, IPaintTo3D paintTo3D) { if (Settings.GlobalSettings.GetBoolValue("ActionFeedBack.UseZBuffer", true)) { paintTo3D.UseZBuffer(true); } Color selectColor = frame.GetColorSetting("Select.SelectColor", Color.Yellow); // die Farbe für die selektierten Objekte Color focusColor = frame.GetColorSetting("Select.FocusColor", Color.LightBlue); // die Farbe für das Objekt mit dem Focus foreach (IView vw in frame.AllViews) { for (int i = 0; i < repaintObjects.Count; ++i) { IFeedBack go = repaintObjects[i] as IFeedBack; if (go != null) { go.PaintTo3D(paintTo3D); } } bool oldSelectMode = paintTo3D.SelectMode; paintTo3D.SelectMode = true; for (int i = 0; i < paintAsSelected.Count; ++i) { IGeoObjectImpl go = paintAsSelected[i] as IGeoObjectImpl; if (go != null) { paintTo3D.SelectColor = selectColor; paintTo3D.OpenList("feedback"); go.PaintTo3D(paintTo3D); IPaintTo3DList list = paintTo3D.CloseList(); if (list != null) { paintTo3D.SelectedList(list, selectWidth); } } } paintTo3D.SelectMode = oldSelectMode; } if (paintAsTransparent.Count > 0) { paintTo3D.OpenList("feedback-transparent"); foreach (IGeoObject go in paintAsTransparent) { go.PaintTo3D(paintTo3D); } IPaintTo3DList displayList = paintTo3D.CloseList(); paintTo3D.Blending(true); paintTo3D.List(displayList); paintTo3D.Blending(false); } }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PrePaintTo3D (IPaintTo3D)"/> /// </summary> /// <param name="paintTo3D"></param> public override void PrePaintTo3D(IPaintTo3D paintTo3D) { // lock (this) { foreach (IGeoObjectImpl go in containedObjects) { go.PrePaintTo3D(paintTo3D); } } }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PaintTo3D (IPaintTo3D)"/> /// </summary> /// <param name="paintTo3D"></param> public override void PaintTo3D(IPaintTo3D paintTo3D) { if (this.compoundShape == null) { return; } if ((paintTo3D.Capabilities & PaintCapabilities.CanFillPaths) != 0 && hatchStyle is HatchStyleSolid) { paintTo3D.OpenPath(); Path[] paths = compoundShape.MakePaths(this.plane); for (int i = 0; i < paths.Length; i++) { paths[i].PaintTo3D(paintTo3D); paintTo3D.CloseFigure(); } Color clr; if (paintTo3D.SelectMode) { clr = paintTo3D.SelectColor; } else { if ((hatchStyle as HatchStyleSolid).Color == null && this.ColorDef != null) { clr = this.ColorDef.Color; } else { clr = (hatchStyle as HatchStyleSolid).Color.Color; } } paintTo3D.ClosePath(clr); } else { if (needsRecalc) { Recalc(); } if (OnPaintTo3D != null && OnPaintTo3D(this, paintTo3D)) { return; } bool ps = paintTo3D.PaintSurfaces; paintTo3D.PaintFaces(CADability.PaintTo3D.PaintMode.All); // kommt immer mit CurvesOnly... for (int i = 0; i < base.Count; ++i) { (Child(i) as IGeoObjectImpl).PaintTo3D(paintTo3D); } if (!ps) { paintTo3D.PaintFaces(CADability.PaintTo3D.PaintMode.CurvesOnly); } } }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PaintTo3DList (IPaintTo3D, ICategorizedDislayLists)"/> /// </summary> /// <param name="paintTo3D"></param> /// <param name="lists"></param> public override void PaintTo3DList(IPaintTo3D paintTo3D, ICategorizedDislayLists lists) { if (this.compoundShape == null) { return; } if (needsRecalc) { Recalc(); } base.PaintTo3DList(paintTo3D, lists); }
public static void Arrow1(IPaintTo3D paintTo3D, GeoPoint base1, GeoPoint base2, GeoPoint apex) { GeoVector nor1 = (apex - base1) ^ (apex - base2); nor1.Norm(); //double l = base1 | base2; //GeoPoint c = new GeoPoint(base1, base2); //GeoPoint base3 = c + l / 2.0 * nor1; //GeoPoint base4 = c - l / 2.0 * nor1; //GeoVector nor2 = (apex - base3) ^ (apex - base4); paintTo3D.Triangle(new GeoPoint[] { apex, base1, base2 }, new GeoVector[] { nor1, nor1, nor1 }, new int[] { 0, 1, 2 }); //paintTo3D.Triangle(new GeoPoint[] { apex, base3, base4 }, new GeoVector[] { nor2, nor2, nor2 }, new int[] { 0, 1, 2 }); }
public static void PaintHandle(IPaintTo3D paintTo3D, PointF pf, int width, Color color) { paintTo3D.SetColor(color); paintTo3D.SetLineWidth(null); paintTo3D.SetLinePattern(null); paintTo3D.Line2D((int)pf.X - width, (int)pf.Y - width, (int)pf.X - width, (int)pf.Y + width); paintTo3D.Line2D((int)pf.X - width, (int)pf.Y + width, (int)pf.X + width, (int)pf.Y + width); paintTo3D.Line2D((int)pf.X + width, (int)pf.Y + width, (int)pf.X + width, (int)pf.Y - width); paintTo3D.Line2D((int)pf.X + width, (int)pf.Y - width, (int)pf.X - width, (int)pf.Y - width); //paintTo3D.Point2D((int)pf.X + width, (int)pf.Y + width); //paintTo3D.Point2D((int)pf.X + width, (int)pf.Y - width); //paintTo3D.Point2D((int)pf.X - width, (int)pf.Y + width); //paintTo3D.Point2D((int)pf.X - width, (int)pf.Y - width); }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PaintTo3DList (IPaintTo3D, ICategorizedDislayLists)"/> /// </summary> /// <param name="paintTo3D"></param> /// <param name="lists"></param> public override void PaintTo3DList(IPaintTo3D paintTo3D, ICategorizedDislayLists lists) { //paintTo3D.PushMultModOp(insertion); //// TODO: hier dem paint3D noch Layer und Color mitgeben für LayerByBlock bzw. ColorByBlock //CategorizedDislayLists tmp = new CategorizedDislayLists(); //idea.PaintTo3DList(paintTo3D, tmp); //paintTo3D.PopModOp(); //tmp.AddToDislayLists(paintTo3D, UniqueId, lists); // jetzt auf flattened zeichnen, da sind alle ModOps schon drin, das ist hier einfacher // eine bessere aber aufwendigere Lösung wäre evtl. in ICategorizedDislayLists die ModOp zu pushen und popen Block blk = Flattened; blk.PaintTo3DList(paintTo3D, lists); }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PaintTo3DList (IPaintTo3D, ICategorizedDislayLists)"/> /// </summary> /// <param name="paintTo3D"></param> /// <param name="lists"></param> public override void PaintTo3DList(IPaintTo3D paintTo3D, ICategorizedDislayLists lists) { lock (this) { for (int i = 0; i < containedObjects.Count; ++i) { // die Überprüfung der Sichtbarkeit erfolgt vor dem Aufruf dieser Methode. Deshalb // muss sie auch vor dem Aufruf der enthaltenen Objekte erfolgen. Sonst müsste man bei jedem geoObject // diesen Test machen if (containedObjects[i].IsVisible) { containedObjects[i].PaintTo3DList(paintTo3D, lists); } } } }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PaintTo3D (IPaintTo3D)"/> /// </summary> /// <param name="paintTo3D"></param> public override void PaintTo3D(IPaintTo3D paintTo3D) { if (OnPaintTo3D != null && OnPaintTo3D(this, paintTo3D)) { return; } //paintTo3D.PushMultModOp(insertion); //idea.PaintTo3D(paintTo3D); //paintTo3D.PopModOp(); // hier nicht Flatten aufrufen, denn beim Verschieben über ClipBoard // wird sonst immer Clone gemacht, und das geht in die Zeit und außerdem mag // Mauell das nicht bei DRPSymbolen Block blk = FlattenedP; blk.PaintTo3D(paintTo3D); }
public static void PaintHandle(IPaintTo3D paintTo3D, int x, int y, int width, Color color) { paintTo3D.SetLineWidth(null); // dünnstmöglich paintTo3D.SetLinePattern(null); paintTo3D.SetColor(color); paintTo3D.Line2D(x - width, y - width, x - width, y + width); paintTo3D.Line2D(x - width, y + width, x + width, y + width); paintTo3D.Line2D(x + width, y + width, x + width, y - width); paintTo3D.Line2D(x + width, y - width, x - width, y - width); // ohne die folgenden Aufrufe fehlt meist ein Punkt im Quadrat // hängt vom OpenGl Treiber ab: manchmal sind diese Punkte versetzt //paintTo3D.Point2D(x - width, y - width); //paintTo3D.Point2D(x - width, y + width); //paintTo3D.Point2D(x + width, y + width); //paintTo3D.Point2D(x + width, y - width); }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PaintTo3D (IPaintTo3D)"/> /// </summary> /// <param name="paintTo3D"></param> public override void PaintTo3D(IPaintTo3D paintTo3D) { // kommt im Normalfall nicht dran, da der Block beim Darstellen schon aufgelöst wird // (wg. der verschiedenen Layer) // wird allerdings beim aktiven Objekt aufgerufen if (OnPaintTo3D != null && OnPaintTo3D(this, paintTo3D)) { return; } // lock (this) das lock ausgeschaltet, sollte das nicht bei den einzelnen Objekten, vor allem Faces, genügen? // { foreach (IGeoObjectImpl go in containedObjects) { go.PaintTo3D(paintTo3D); } } }
void OnRepaint(IView View, IPaintTo3D paintTo3D) { BoundingRect ext; if (layoutPatch.Area == null) { ext = new BoundingRect(0.0, 0.0, layoutView.Layout.PaperWidth, layoutView.Layout.PaperHeight); } else { ext = layoutPatch.Area.Extent; } LayoutView lv = View as LayoutView; if (lv != null) { GeoPoint2D clipll = lv.layoutToScreen * ext.GetLowerLeft(); GeoPoint2D clipur = lv.layoutToScreen * ext.GetUpperRight(); paintTo3D.SetColor(Color.LightGray); paintTo3D.FillRect2D(clipll.PointF, clipur.PointF); } }
private void RepaintZoomRect(Rectangle IsInvalid, IView View, IPaintTo3D PaintToActive) { if (View != activeView) { return; // nur ein Fadenkreuz bzw. Rechteck } Color bckgnd = Frame.GetColorSetting("Colors.Background", Color.AliceBlue); Color infocolor; if (bckgnd.GetBrightness() > 0.5) { infocolor = Color.Black; } else { infocolor = Color.White; } Rectangle ClipRect = View.Canvas.ClientRectangle; switch (Mode) { case 0: // Fadenkreuz zeichnen PaintToActive.SetColor(infocolor); PaintToActive.Line2D(FirstPoint.X, ClipRect.Top, FirstPoint.X, ClipRect.Bottom); PaintToActive.Line2D(ClipRect.Left, FirstPoint.Y, ClipRect.Right, FirstPoint.Y); break; case 1: // Rechteck zeichnen PaintToActive.SetColor(infocolor); PaintToActive.Line2D(FirstPoint.X, FirstPoint.Y, SecondPoint.X, FirstPoint.Y); PaintToActive.Line2D(SecondPoint.X, FirstPoint.Y, SecondPoint.X, SecondPoint.Y); PaintToActive.Line2D(SecondPoint.X, SecondPoint.Y, FirstPoint.X, SecondPoint.Y); PaintToActive.Line2D(FirstPoint.X, SecondPoint.Y, FirstPoint.X, FirstPoint.Y); break; } }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PrePaintTo3D (IPaintTo3D)"/> /// </summary> /// <param name="paintTo3D"></param> public override void PrePaintTo3D(IPaintTo3D paintTo3D) { paintTo3D.PrepareBitmap(bitmap, offsetx, offsety); }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PaintTo3DList (IPaintTo3D, ICategorizedDislayLists)"/> /// </summary> /// <param name="paintTo3D"></param> /// <param name="lists"></param> public override void PaintTo3DList(IPaintTo3D paintTo3D, ICategorizedDislayLists lists) { PrePaintTo3D(paintTo3D); lists.Add(this.Layer, true, false, this); }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PrePaintTo3D (IPaintTo3D)"/> /// </summary> /// <param name="paintTo3D"></param> public override void PrePaintTo3D(IPaintTo3D paintTo3D) { paintTo3D.PrepareBitmap(bitmap); }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PaintTo3D (IPaintTo3D)"/> /// </summary> /// <param name="paintTo3D"></param> public override void PaintTo3D(IPaintTo3D paintTo3D) { paintTo3D.RectangularBitmap(bitmap, location, directionWidth, directionHeight); }
private void OnPrintPage(object sender, PrintPageEventArgs e) { Rectangle r = e.PageBounds; // ist IMMER in 100 dpi // die Pixelauflösung des Druckers ist in e.Graphics.DpiX bzw. DpiY double fctpap = 100 / 25.4; //double fct = 100 / 25.4; double fct = e.Graphics.DpiX / 25.4; // das ist die echte Auflösung // fct /= 2; war nur ein Test e.Graphics.PageScale = (float)(1.0); for (int i = 0; i < layout.PatchCount; ++i) { LayoutPatch lp = layout.Patches[i]; e.Graphics.Transform = new System.Drawing.Drawing2D.Matrix((float)fctpap, 0.0f, 0.0f, (float)-fctpap, 0.0f, (float)(layout.PaperHeight * fctpap)); BoundingRect ext; if (lp.Area != null) { ext = lp.Area.Extent; } else { ext = new BoundingRect(0.0, 0.0, layout.PaperWidth, layout.PaperHeight); } // der Faktor fct ist willkürlich, macht man ihn zu groß, gibt es ein OutOfMemory in OpenGl // zu klein, wird die Auflösung beim Drucken zu grob. Abhilfe würde es schaffen, wenn man nicht ein // Bitmap erzeugt, sondern dieses kachelt. Ob man es aber nahtlos zusammensetzen kann? // eigentlich gefragt wäre hier die Pixelauflösung des Graphics, aber vielleicht gibt es die garnicht // und es ist ein Metafile, der zum Drucker weitergereicht wird. GeoPoint2D ll = ext.GetLowerLeft(); GeoPoint2D ur = ext.GetUpperRight(); Rectangle clipRectangle = Rectangle.FromLTRB((int)ll.x, (int)ll.y, (int)ur.x, (int)ur.y); System.Drawing.Bitmap PaintToBitmap; int bitmapwidth = (int)(clipRectangle.Width * fct); int bitmapheight = (int)(clipRectangle.Height * fct); PaintToBitmap = new System.Drawing.Bitmap(bitmapwidth, bitmapheight); IPaintTo3D ipaintTo3D = Frame.UIService.CreatePaintInterface(PaintToBitmap, lp.Model.Extent.Size / 1000); ipaintTo3D.MakeCurrent(); ipaintTo3D.Clear(Color.White); ipaintTo3D.AvoidColor(Color.White); Projection pr = lp.Projection.Clone(); pr.SetUnscaledProjection(new ModOp(1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0) * pr.UnscaledProjection); double factor, dx, dy; pr.GetPlacement(out factor, out dx, out dy); //new System.Drawing.Drawing2D.Matrix((float)factor, 0.0f, 0.0f, (float)-factor, 0.0f, (float)(layout.PaperHeight * factor)); pr.SetPlacement(fct * factor, fct * (dx - ext.Left), fct * (dy - ext.Bottom)); ipaintTo3D.SetProjection(pr, lp.Model.Extent); ipaintTo3D.UseZBuffer(true); ipaintTo3D.PaintFaces(PaintTo3D.PaintMode.All); ipaintTo3D.UseLineWidth = true; // hier darf nicht mit Listen gearbeitet werden, sonst macht OpanGL die Krätsche foreach (IGeoObject go in lp.Model) { PaintFlatVisibleLayer(ipaintTo3D, go, lp.visibleLayers); } //CategorizedDislayLists displayLists = new CategorizedDislayLists(); //// beim Zeichnen auf Bitmaps müssen die Displaylisten lokal zu diesem rendercontext gehören //// obwohl sharelists angegeben wurde und das keinen Fehler bringt //// leider wird alles hierbei flach. Man könnte das höchstens damit übertricksen, //// dass man bei tringle die Farbe an jedem Eckpunkt mit dem Normalenvektor verrechnet //// aber ob das hilft? //foreach (IGeoObject go in lp.Model) //{ // go.PaintTo3DList(ipaintTo3D, displayLists); //} //displayLists.Finish(ipaintTo3D); //ipaintTo3D.PaintFaces(PaintTo3D.PaintMode.FacesOnly); //foreach (KeyValuePair<Layer, IPaintTo3DList> kv in displayLists.layerFaceDisplayList) //{ // if (lp.IsLayerVisible(kv.Key) || displayLists.NullLayer == kv.Key) // { // ipaintTo3D.List(kv.Value); // } //} //ipaintTo3D.PaintFaces(PaintTo3D.PaintMode.CurvesOnly); //foreach (KeyValuePair<Layer, IPaintTo3DList> kv in displayLists.layerCurveDisplayList) //{ // if (lp.IsLayerVisible(kv.Key) || displayLists.NullLayer == kv.Key) // { // ipaintTo3D.List(kv.Value); // } //} //// wozu war das folgende noch? ////foreach (IGeoObject go in lp.Model) ////{ //// go.PaintTo3D(ipaintTo3D); ////} //// ipaintTo3D.Dispose(); gibt OpenGL Fehler //ipaintTo3D.FinishPaint(); //gr.ReleaseHdc(dc); //displayLists = null; //System.GC.Collect(); //System.GC.WaitForPendingFinalizers(); //ipaintTo3D.Dispose(); PaintToBitmap.MakeTransparent(Color.White); //e.Graphics.DrawImageUnscaled(PaintToBitmap, clipRectangle); PointF[] dest = new PointF[3]; dest[0].X = (float)ll.x; dest[0].Y = (float)ur.y; dest[1].X = (float)ur.x; dest[1].Y = (float)ur.y; dest[2].X = (float)ll.x; dest[2].Y = (float)ll.y; RectangleF src = new RectangleF(new PointF(0.0f, 0.0f), PaintToBitmap.Size); e.Graphics.DrawImage(PaintToBitmap, dest, src, GraphicsUnit.Pixel); } }
void IView.OnPaint(PaintEventArgs e) { IPaintTo3D paintTo3D = canvas.PaintTo3D; Rectangle clr = e.ClipRectangle; if (!IsInitialized) { ZoomTotal(1.1); } //PaintToOpenGl paintTo3D = new PaintToOpenGl(1e-3); // woher nehmen? // IntPtr dc = e.Graphics.GetHdc(); //paintTo3D.Init(dc, condorCtrl.ClientRectangle.Width, condorCtrl.ClientRectangle.Height, false); IPaintTo3D ipaintTo3D = paintTo3D; // ipaintTo3D.Init(condorCtrl); // das erzeugt jedesmal einen neuen renderContext, das kann doch nicht richtig sein ipaintTo3D.MakeCurrent(); ipaintTo3D.Clear(Color.Black); // damit ist black die Backgroundcolor //e.Graphics.FillRectangle(Brushes.Black, e.Graphics.ClipBounds); GeoPoint2D ll = layoutToScreen * new GeoPoint2D(0.0, 0.0); GeoPoint2D ur = layoutToScreen * new GeoPoint2D(layout.PaperWidth, layout.PaperHeight); RectangleF paperrect = RectangleF.FromLTRB((float)ll.x, (float)ur.y, (float)ur.x, (float)ll.y); //e.Graphics.FillRectangle(Brushes.White, paperrect); //BoundingCube bc = new BoundingCube(ll.x, ur.x, ll.y, ur.y, -1.0, 1.0); //ipaintTo3D.SetProjection(new Projection(Projection.StandardProjection.FromTop), bc); ipaintTo3D.UseZBuffer(false); ipaintTo3D.SetColor(Color.White); ipaintTo3D.FillRect2D(ll.PointF, ur.PointF); //ipaintTo3D.FinishPaint();// DEBUG //return; // DEBUG ipaintTo3D.AvoidColor(Color.White); if (RepaintActionEvent != null) { RepaintActionEvent(this, ipaintTo3D); } for (int i = 0; i < layout.Patches.Length; ++i) { LayoutPatch lp = layout.Patches[i]; BoundingRect paperRect = new BoundingRect(0.0, 0.0, layout.PaperWidth, layout.PaperHeight); BoundingRect ext; if (lp.Area != null) { ext = lp.Area.Extent; } else { ext = paperRect; } GeoPoint2D clipll = layoutToScreen * ext.GetLowerLeft(); GeoPoint2D clipur = layoutToScreen * ext.GetUpperRight(); Rectangle clipRectangle = Rectangle.FromLTRB((int)clipll.x, (int)clipur.y, (int)clipur.x, (int)clipll.y); Projection pr = lp.Projection.Clone(); double factor, dx, dy; pr.GetPlacement(out factor, out dx, out dy); pr.SetPlacement(layoutToScreen.Factor * factor, ll.x + layoutToScreen.Factor * dx, ll.y - layoutToScreen.Factor * dy); pr.Precision = lp.Model.Extent.Size / 1000; ipaintTo3D.Precision = pr.Precision; ipaintTo3D.SetProjection(pr, lp.Model.Extent); ipaintTo3D.UseZBuffer(true); ipaintTo3D.SetClip(clipRectangle); ipaintTo3D.PaintFaces(PaintTo3D.PaintMode.All); // lp.Model.ClearDisplayLists(); lp.Model.RecalcDisplayLists(ipaintTo3D); if (lp.Projection.ShowFaces) { ipaintTo3D.PaintFaces(PaintTo3D.PaintMode.FacesOnly); foreach (KeyValuePair <Layer, IPaintTo3DList> kv in lp.Model.layerFaceDisplayList) { if (lp.IsLayerVisible(kv.Key) || lp.Model.nullLayer == kv.Key) { ipaintTo3D.List(kv.Value); } } } ipaintTo3D.PaintFaces(PaintTo3D.PaintMode.CurvesOnly); foreach (KeyValuePair <Layer, IPaintTo3DList> kv in lp.Model.layerCurveDisplayList) { if (lp.IsLayerVisible(kv.Key) || lp.Model.nullLayer == kv.Key) { ipaintTo3D.List(kv.Value); } } ipaintTo3D.SetClip(Rectangle.Empty); } ipaintTo3D.FinishPaint(); }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PaintTo3D (IPaintTo3D)"/> /// </summary> /// <param name="paintTo3D"></param> public override void PaintTo3D(IPaintTo3D paintTo3D) { paintTo3D.DisplayBitmap(location, bitmap); }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PrePaintTo3D (IPaintTo3D)"/> /// </summary> /// <param name="paintTo3D"></param> public override void PrePaintTo3D(IPaintTo3D paintTo3D) { geoObject.PrePaintTo3D(paintTo3D); }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PaintTo3DList (IPaintTo3D, ICategorizedDislayLists)"/> /// </summary> /// <param name="paintTo3D"></param> /// <param name="lists"></param> public override void PaintTo3DList(IPaintTo3D paintTo3D, ICategorizedDislayLists lists) { lists.Add(Layer, false, false, this); // base.PaintTo3DList(paintTo3D, lists); }
/// <summary> /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.PaintTo3DList (IPaintTo3D, ICategorizedDislayLists)"/> /// </summary> /// <param name="paintTo3D"></param> /// <param name="lists"></param> public override void PaintTo3DList(IPaintTo3D paintTo3D, ICategorizedDislayLists lists) { // zählt zu den linienartigen, damit kommt es etwas nach vorne // in der Basisklasse schon richtig implementiert base.PaintTo3DList(paintTo3D, lists); }