Exemple #1
0
 public bool IsHit(PointF p, Cyotek.Windows.Forms.ImageBox i)
 {
     p = i.GetOffsetPoint(p);
     PointF offsetPoint = i.GetOffsetPoint(location);
     if ((p.X - offsetPoint.X) * (p.X - offsetPoint.X) + (p.Y - offsetPoint.Y) * (p.Y - offsetPoint.Y) <= ratio*ratio)
         return true;
     return false;
 }
Exemple #2
0
 public bool isDesHit(PointF p, Cyotek.Windows.Forms.ImageBox i)
 {
     p = i.GetOffsetPoint(p);
     PointF offsetPoint = i.GetOffsetPoint(locationDesc);
     if (p.X < offsetPoint.X + sizeString.Width
         && p.X > offsetPoint.X
         && p.Y < offsetPoint.Y + sizeString.Height
         && p.Y > offsetPoint.Y)
         return true;
     return false;
 }
Exemple #3
0
        public PointF LocationIndex(Cyotek.Windows.Forms.ImageBox i,Graphics e)
        {
            var s = new SizeF();
            var v1 = new System.Windows.Vector(this.pointOfProfile.Point.X - this.pointOnProfile.Point.X, this.pointOfProfile.Point.Y - this.pointOnProfile.Point.Y);
            //v1.Normalize();
            var v2 = new System.Windows.Vector(1, 0);
            var angleBetween = System.Windows.Vector.AngleBetween(v1, v2);
            angleBetween = angleBetween * Math.PI / 180;

            if (angleBetween < 0)
                angleBetween = 2 * pi + angleBetween;
            if(GlobalSettings.lineFringeNumber && GlobalSettings.linesDesc)
                s = e.MeasureString(this.Index.ToString() + "/" + this.F_Index, GlobalSettings.fontLines);
            else if (GlobalSettings.lineFringeNumber && !GlobalSettings.linesDesc)
                s = e.MeasureString( this.F_Index, GlobalSettings.fontLines);
            else if (!GlobalSettings.lineFringeNumber && GlobalSettings.linesDesc)
                s = e.MeasureString(this.Index.ToString(), GlobalSettings.fontLines);
            s = new SizeF((float)(s.Width / i.ZoomFactor), (float)(s.Height / i.ZoomFactor));

            var tmpPoint = new PointF(pointOfProfile.Point.X + (float)(s.Width * xFactor(angleBetween)), pointOfProfile.Point.Y + (float)(s.Height * yFactor(angleBetween)));

            return i.GetOffsetPoint(tmpPoint);
        }
Exemple #4
0
        public bool IsHit(PointF p, Cyotek.Windows.Forms.ImageBox i)
        {
            p = i.GetOffsetPoint(p);
            PointF offsetPointOn = i.GetOffsetPoint(pointOnProfile.Point);
            PointF offsetPointOf = i.GetOffsetPoint(pointOfProfile.Point);

            System.Windows.Vector vAC = new System.Windows.Vector(p.X - offsetPointOn.X, p.Y - offsetPointOn.Y);
            System.Windows.Vector vAB = new System.Windows.Vector(offsetPointOf.X - offsetPointOn.X, offsetPointOf.Y - offsetPointOn.Y);

            double distanceOfProfile = GetDistanceBetween(offsetPointOn, p);
            double distanceFromProfile = GetDistanceBetween(offsetPointOf, p);

            double distace = GetDistanceBetween(offsetPointOn, offsetPointOf);
            double Ca = ((distanceOfProfile * distanceOfProfile) - (distanceFromProfile * distanceFromProfile) + (distace * distace)) / (2 * distace);
            double Vc = Math.Sqrt((distanceOfProfile * distanceOfProfile) - (Ca * Ca));

            double angle = System.Windows.Vector.AngleBetween(vAB, vAC);
            //angle = angle * (180 / Math.PI);
            double distanceFromLine = distanceFromProfile * Math.Sin(angle);

            distanceFromLine /= i.ZoomFactor;
            if (Vc <= 5 && distanceOfProfile<distace && distanceFromProfile<distace)
                return true;
            else
                return false;
        }
Exemple #5
0
 public bool IsHitLabel(PointF p, Cyotek.Windows.Forms.ImageBox i)
 {
     p = i.GetOffsetPoint(p);
     PointF offsetPoint = i.GetOffsetPoint(new PointF(location.X + labelOffsetX, location.Y + labelOffsetY));
     if (p.X < offsetPoint.X + sizeString.Width
         && p.X > offsetPoint.X
         && p.Y < offsetPoint.Y + sizeString.Height + (float)(8 * ((i.ZoomFactor - 0.7) / 0.3))
         && p.Y > offsetPoint.Y + (float)(8 * ((i.ZoomFactor - 0.7) / 0.3)))
         return true;
     return false;
 }
Exemple #6
0
 public PointF GetLabelLocation(Cyotek.Windows.Forms.ImageBox i)
 {
     return new PointF(i.GetOffsetPoint(new PointF(location.X + labelOffsetX, location.Y + labelOffsetY)).X, i.GetOffsetPoint(new PointF(location.X + labelOffsetX, location.Y + labelOffsetY)).Y + (float)(8 * ((i.ZoomFactor - 0.7) / 0.3)));
 }
Exemple #7
0
        public bool IsHit(Point p, Cyotek.Windows.Forms.ImageBox i, bool isFringe = false)
        {
            if (isFringe)
            {
                p = i.PointToImage(p);
                if ((p.X - location.X) * (p.X - location.X) + (p.Y - location.Y) * (p.Y - location.Y) <= ratio * ratio)
                    return true;
                return false;
            }

            p = i.GetOffsetPoint(p);
            PointF offsetPoint = i.GetOffsetPoint(location);
            if ((p.X - offsetPoint.X) * (p.X - offsetPoint.X) + (p.Y - offsetPoint.Y) * (p.Y - offsetPoint.Y) <= ratio * ratio)
                return true;
            return false;
        }
Exemple #8
0
        public bool IsHitLabel(PointF p, Cyotek.Windows.Forms.ImageBox i, bool isFringeLabel = false)
        {
            PointF offsetPoint;
            if (isFringeLabel)
            {
                SizeF size = i.CreateGraphics().MeasureString(this.label,GlobalSettings.fringeLabelsFont);
                var l = i.GetOffsetPoint(location);
                //click = i.GetOffsetPoint(p);
                offsetPoint = i.GetOffsetPoint(new PointF(location.X + labelOffsetX, location.Y + labelOffsetY));
                if (p.X < offsetPoint.X + size.Width
                    && p.X > offsetPoint.X - 4
                    && p.Y < offsetPoint.Y + size.Height + (float)(8 * ((i.ZoomFactor - 0.7) / 0.3))
                    && p.Y > offsetPoint.Y + (float)(8 * ((i.ZoomFactor - 0.7) / 0.3)))
                    return true;
                return false;
            }

            p = i.GetOffsetPoint(p);
            offsetPoint = i.GetOffsetPoint(new PointF(location.X + labelOffsetX, location.Y + labelOffsetY));
            if (p.X < offsetPoint.X + sizeString.Width
                && p.X > offsetPoint.X
                && p.Y < offsetPoint.Y + sizeString.Height + (float)(8 * ((i.ZoomFactor - 0.7) / 0.3))
                && p.Y > offsetPoint.Y + (float)(8 * ((i.ZoomFactor - 0.7) / 0.3)))
                return true;
            return false;
        }
Exemple #9
0
 public bool IsHit(PointF p,Cyotek.Windows.Forms.ImageBox i)
 {
     if (!Point.IsEmpty)
     {
         PointF offsetPoint = i.GetOffsetPoint(Point);
         p = i.GetOffsetPoint(p);
         double s = size * 1;
         if ((offsetPoint.X + (s / 2)) >= p.X &&
             (offsetPoint.X - (s / 2)) <= p.X &&
             (offsetPoint.Y + (s / 2)) >= p.Y &&
             (offsetPoint.Y - (s / 2)) <= p.Y)
             return true;
         else
             return false;
     }
     else
         return false;
 }