Ejemplo n.º 1
0
        internal void GetCachedBitmap(ImageInst img, ref Bitmap bmp, ref Point offset)
        {
            ImageCached imgCached = _listImageCached.Find(delegate(ImageCached imgc) { return(imgc.Matches(img)); });

            if (null == imgCached)
            {
                imgCached = new ImageCached(img.Analysis, img.AxisLength, img.AxisWidth);
                _listImageCached.Add(imgCached);
            }
            AnalysisHomo analysis = imgCached.Analysis;

            // *** get size in pixels
            int    xmin = int.MaxValue, ymin = int.MaxValue, xmax = int.MinValue, ymax = int.MinValue;
            BBox3D bbox = analysis.Solution.BBoxGlobal;

            foreach (Vector3D vPt in bbox.Corners)
            {
                Point pt = TransformPoint(GetCurrentTransformation() * imgCached.RelativeTransf, vPt);
                xmin = Math.Min(xmin, pt.X);
                xmax = Math.Max(xmax, pt.X);
                ymin = Math.Min(ymin, pt.Y);
                ymax = Math.Max(ymax, pt.Y);
            }
            Size s = new Size(xmax - xmin + 1, ymax - ymin + 1);
            // ***

            Point ptZero = TransformPoint(GetCurrentTransformation(), Vector3D.Zero);

            bmp = imgCached.Image(s, CameraPosition, Target, ref offset);
        }
Ejemplo n.º 2
0
        internal void Draw(ImageInst img)
        {
            try
            {
                Point ptImg = TransformPoint(GetCurrentTransformation(), img.PointBase);

                Bitmap bmp      = null;
                Point  ptOffset = Point.Empty;
                GetCachedBitmap(img, ref bmp, ref ptOffset);

                if (ptImg.X > 0 || ptImg.Y > 0)
                {
                    System.Drawing.Graphics g = Graphics;
                    g.DrawImage(bmp, new Point(ptImg.X - ptOffset.X, ptImg.Y - ptOffset.Y));
                }
                else
                {
                    _log.Error("Invalid image position");
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }
Ejemplo n.º 3
0
        internal void Draw(ImageInst img)
        {
            Point ptImg = TransformPoint(GetCurrentTransformation(), img.PointBase);

            Bitmap bmp      = null;
            Point  ptOffset = Point.Empty;

            GetCachedBitmap(img, ref bmp, ref ptOffset);

            System.Drawing.Graphics g = Graphics;
            g.DrawImage(bmp, new Point(ptImg.X - ptOffset.X, ptImg.Y - ptOffset.Y));
        }
Ejemplo n.º 4
0
 public bool Matches(ImageInst img)
 {
     return(_analysis == img.Analysis && _axisLength == img.AxisLength && _axisWidth == img.AxisWidth);
 }
Ejemplo n.º 5
0
 public bool Matches(ImageInst img)
 {
     return(Content.Equals(img.Content) && AxisLength == img.AxisLength && AxisWidth == img.AxisWidth);
 }