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; }
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; }
public Settings(ref Cyotek.Windows.Forms.ImageBox ib) { InitializeComponent(); initComboBox(); imageBox = ib; btn_cross.BackColor = GlobalSettings.crossPen.Color; btn_lines.BackColor = GlobalSettings.linesPen.Color; btn_profil.BackColor = GlobalSettings.profilPen.Color; btn_selected.BackColor = GlobalSettings.selectedPen.Color; btn_colorIndex.BackColor = GlobalSettings.indexBrush.Color; btn_colorDesc.BackColor = GlobalSettings.descriptionBrush.Color; tb_length.Text = GlobalSettings.lineLength.ToString(); cb_description.Checked = GlobalSettings.desc; cb_physical_points.Checked = GlobalSettings.points; cb_physical_points_desc.Checked = GlobalSettings.pointsDesc; cb__lines.Checked = GlobalSettings.lines; cb_lines_index.Checked = GlobalSettings.linesDesc; cb_lineNumber.Checked = GlobalSettings.lineFringeNumber; cb__profil.Checked = GlobalSettings.profil; textBox1.Text = GlobalSettings.roundTime.ToString(); textBox2.Text = GlobalSettings.roundPitchPlunge.ToString(); textBox3.Text = GlobalSettings.roundOthers.ToString(); cb_fringeLabelsPanel.Checked = GlobalSettings.fringeLabelsPanel; cb_fringeLabels.Checked = GlobalSettings.fringeLabels; tb_fringeLabelsCircleSize.Text = GlobalSettings.fringeCircleSize.ToString(); tb_from.Text = GlobalSettings.fringeLabelsFrom.ToString(); tb_to.Text = GlobalSettings.fringeLabelsTo.ToString(); btn_fringeLabelsColor.BackColor = GlobalSettings.fringeLabelsColor; afterInit = true; }
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; }
public PointF LocationIndexSuper(Cyotek.Windows.Forms.ImageBox i) { System.Windows.Vector v = new System.Windows.Vector(pointOfProfile.Point.X - pointOnProfile.Point.X, pointOfProfile.Point.Y - pointOnProfile.Point.Y); v.Normalize(); double distancePlus = GetDistanceBetween(pointOnProfile.Point, pointOfProfile.Point) + (20); v = System.Windows.Vector.Multiply(distancePlus, v); PointF p = new PointF((float)(pointOnProfile.Point.X + v.X), (float)(pointOnProfile.Point.Y + v.Y)); p.X -= 3; p.Y -= 3; return p; }
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); }
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; }
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; }
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))); }
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; }
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; }