//-------------------------------------------------------------------------------------------------- protected override void CalculateExtents() { // Update bounding rect Bnd_Box2d aabb = new Bnd_Box2d(); var shapes = _Source?.GetBreps(); if (shapes != null) { foreach (var shape in shapes) { double xmin = 0; double xmax = 0; double ymin = 0; double ymax = 0; double zmin = 0; double zmax = 0; shape.BoundingBox()?.Get(ref xmin, ref ymin, ref zmin, ref xmax, ref ymax, ref zmax); aabb.Add(new Pnt2d(xmin, ymin)); aabb.Add(new Pnt2d(xmax, ymax)); } } Extents = aabb; }
protected override void CalculateExtents() { var aabb = new Bnd_Box2d(); aabb.Add(Pnt2d.Origin); aabb.Add(DrawingRenderHelper.MeasureText(Text, Style).ToPnt()); Extents = aabb; }
public void ReferenceValues() { Bnd_Box2d box = new Bnd_Box2d(); box.Add(new Pnt2d(1, 2)); box.Add(new Pnt2d(-1, -2)); double xmin = 0, ymin = 0, xmax = 0, ymax = 0; box.Get(ref xmin, ref ymin, ref xmax, ref ymax); Assert.AreEqual(-1, xmin); Assert.AreEqual(1, xmax); Assert.AreEqual(-2, ymin); Assert.AreEqual(2, ymax); }
//-------------------------------------------------------------------------------------------------- MemoryStream _Export(VectorExportLayer[] layers) { // Create group var group = new SvgGroupElement { ID = _Template.ToString(), IsLayer = _Template == VectorExportTemplate.Contours }; BoundingBox = new Bnd_Box2d(); // Export foreach (var layer in layers) { var subgroup = _ExportLayer(layer); if (subgroup != null) { group.Children.Add(subgroup); } } // Scale double width = 100; double height = 100; if (!BoundingBox.IsVoid()) { BoundingBox.SetGap(10.0); // 1cm on each side double xmin = 0, xmax = 0, ymin = 0, ymax = 0; BoundingBox.Get(ref xmin, ref ymin, ref xmax, ref ymax); width = xmax - xmin; height = ymax - ymin; group.Transforms.Add(new SvgTranslateTransform(-xmin, -ymax)); } // Create Document var doc = new SvgDocument { DotsPerInch = DotsPerInch, Width = width, Height = height }; doc.Children.Add(group); return(doc.WriteToStream()); }
public void FillBndBox(Geom2d_Curve C2d, double First, double Last, int NPoints, bool Exact, Bnd_Box2d Box) { throw new NotImplementedException(); }
public void Substitute(int theIndex, TopoDS_Shape theKey1, Bnd_Box2d theItem) { throw new NotImplementedException(); }
public int Add(TopoDS_Shape theKey1, Bnd_Box2d theItem) { throw new NotImplementedException(); }
public IntPatch_PolyArc(Adaptor2d_HCurve2d A, int NbSample, double Pfirst, double Plast, Bnd_Box2d BoxOtherPolygon) : base() { throw new NotImplementedException(); }
public void Add(gp_Elips2d C, double Tol, Bnd_Box2d B) { throw new NotImplementedException(); }
public void BndBoxWire(TopoDS_Wire aWire, Bnd_Box2d aB2d) { throw new NotImplementedException(); }
public void Parab2dBox(gp_Parab2d theParab2d, Bnd_Box2d bounding, Bnd_Box2d boxHypr) { throw new NotImplementedException(); }
public bool UnionVertexes(ShapeExtend_WireData sewd, TopoDS_Edge edge1, TopoDS_Edge edge2, int num2, ShapeFix_DataMapOfShapeBox2d boxes, Bnd_Box2d B2) { throw new NotImplementedException(); }
public void ComputeWithBox(Adaptor2d_Curve2d Curve, Bnd_Box2d OtherBox) { throw new NotImplementedException(); }
public Bnd_Box2d Bound(TopoDS_Shape theKey, Bnd_Box2d theItem) { throw new NotImplementedException(); }
public bool GetBox2d(TopoDS_Shape S, Bnd_Box2d Box2d) { throw new NotImplementedException(); }
public void Lin2dBox(gp_Lin2d theLin2d, Bnd_Box2d bounding, Bnd_Box2d boxLin) { throw new NotImplementedException(); }
public void Add(Adaptor2d_Curve2d C, double U1, double U2, double Tol, Bnd_Box2d B) { throw new NotImplementedException(); }
public int Inters2d(gp_Parab2d theCurve, Bnd_Box2d Domain) { throw new NotImplementedException(); }
public void Add(Geom2d_Curve C, double Tol, Bnd_Box2d Box) { throw new NotImplementedException(); }
public void AddUVBounds(TopoDS_Face F, TopoDS_Edge E, Bnd_Box2d B) { throw new NotImplementedException(); }
public void AddOptimal(Geom2d_Curve C, double U1, double U2, double Tol, Bnd_Box2d B) { throw new NotImplementedException(); }
public void Add(gp_Hypr2d H, double P1, double P2, double Tol, Bnd_Box2d B) { throw new NotImplementedException(); }
public bool FindFromKey(TopoDS_Shape theKey1, Bnd_Box2d theValue) { throw new NotImplementedException(); }