public CoordPoint searchTextCoordXYInScreen(string colorForamt, string target) { string ret = this.OcrEx(0, 0, 2000, 2000, colorForamt, 0.8); logger.InfoFormat(" 2000 OCR 识别的内容是 {0}", ret); CoordPoint point = new CoordPoint(); if (ret == null || ret.Length == 0) { return(point); } int idx = ret.IndexOf(target); if (idx < 0) { return(point); } string[] arr = ret.Split('|'); int len = arr[0].Length; string[] xy = arr[idx + 1].Split(','); // TODO: 目前必须在全屏下才能成功正确找到 确定按钮 int x = Int32.Parse(xy[0]); int y = Int32.Parse(xy[1]); point.x = x; point.y = y; return(point); }
public override void ImportFromParameters(ParameterCollection p) { if (p == null) { throw new ArgumentNullException(nameof(p)); } base.ImportFromParameters(p); LibReference = p["LIBREFERENCE"].AsStringOrDefault(); ComponentDescription = p["COMPONENTDESCRIPTION"].AsStringOrDefault(); PartCount = p["PARTCOUNT"].AsIntOrDefault() - 1; // for some reason this number is one more than the actual number of parts DisplayModeCount = p["DISPLAYMODECOUNT"].AsIntOrDefault(); DisplayMode = p["DISPLAYMODE"].AsIntOrDefault(); Location = new CoordPoint( Utils.DxpFracToCoord(p["LOCATION.X"].AsIntOrDefault(), p["LOCATION.X_FRAC"].AsIntOrDefault()), Utils.DxpFracToCoord(p["LOCATION.Y"].AsIntOrDefault(), p["LOCATION.Y_FRAC"].AsIntOrDefault())); LibraryPath = p["LIBRARYPATH"].AsStringOrDefault(); SourceLibraryName = p["SOURCELIBRARYNAME"].AsStringOrDefault(); SheetPartFilename = p["SHEETPARTFILENAME"].AsStringOrDefault(); TargetFilename = p["TARGETFILENAME"].AsStringOrDefault(); AreaColor = p["AREACOLOR"].AsColorOrDefault(); Color = p["COLOR"].AsColorOrDefault(); PartIdLocked = p["PARTIDLOCKED"].AsBool(); AliasList = p["ALIASLIST"].AsStringOrDefault(); }
protected override JsonCommand DoExecute(string args) { CoordPoint p = CoordPoint.FromAndAdjustRemote(args); int ret = bidActionManager.MoveCursor(p); return(null); }
private void SaveMapData() { MapItem item = MapItemStorage.Items.FirstOrDefault(); if (item != null) { MapPushpin pin = (MapPushpin)item; GeoPoint location = (GeoPoint)pin.Location; //If lat and long are zero, then there was no geocode to begin with and the user didn't specify one //during the edit, so don't update the values if (location.Longitude != 0 || location.Latitude != 0) { if (_selectedRecord.GeoCode == null) { _selectedRecord.GeoCode = new GeoCode(); } GeoCode geoCode = _selectedRecord.GeoCode; geoCode.PushLat = location.Latitude; geoCode.PushLong = location.Longitude; geoCode.ManualChecked = true; CoordPoint p1 = MapControl.ScreenPointToCoordPoint(new MapPoint()); CoordPoint p2 = MapControl.ScreenPointToCoordPoint(new MapPoint(MapControl.Width, MapControl.Height)); GeoPoint gp1 = (GeoPoint)p1; GeoPoint gp2 = (GeoPoint)p2; geoCode.NorthLat = gp1.Latitude; geoCode.WestLong = gp1.Longitude; geoCode.SouthLat = gp2.Latitude; geoCode.EastLong = gp2.Longitude; } } }
protected virtual void OnSelectedItemChanged(Object newValue) { if (newValue is MapPushpin item) { SelectedItemCoords = item.Location; } }
//Single Uncertainty public Uncertainty(CoordPoint coordinate, double xUncertainty, double yUncertainty, bool Percentage, Canvas currentCanvas, ChartBounds currentBounds) { this.coordinate = coordinate; this.currentCanvas = currentCanvas; this.minBoundsX = currentBounds.MinBoundsX; this.minBoundsY = currentBounds.MinBoundsY; this.maxBoundsX = currentBounds.MaxBoundsX; this.maxBoundsY = currentBounds.MaxBoundsY; if (Percentage) { this.xUncertaintyPlus = coordinate.X * (xUncertainty / 100); this.xUncertaintyMinus = coordinate.X * (xUncertainty / 100); this.yUncertaintyPlus = coordinate.Y * (yUncertainty / 100); this.yUncertaintyMinus = coordinate.Y * (yUncertainty / 100); } else { this.xUncertaintyPlus = xUncertainty; this.xUncertaintyMinus = xUncertainty; this.yUncertaintyPlus = yUncertainty; this.yUncertaintyMinus = yUncertainty; } PlotXLineMinus(); PlotYLineMinus(); PlotYLinePlus(); PlotXLinePlus(); }
public CoordPoint SearchTextCoordXYInFlashScreen(int x1, int y1, int width, int height, string colorForamt, string target) { long s1 = KK.CurrentMills(); string ret = this.OcrEx(x1, y1, x1 + width, y1 + height, colorForamt, 0.8); logger.DebugFormat("Search {0} OCR 识别的内容是 {1}, {2}. elapsed {3}ms, ret is {4}.", width, x1, y1, KK.CurrentMills() - s1, ret); CoordPoint point = new CoordPoint(); if (ret == null || ret.Length == 0) { return(point); } int idx = ret.IndexOf(target); if (idx < 0) { return(point); } string[] arr = ret.Split('|'); int len = arr[0].Length; string[] xy = arr[idx + 1].Split(','); // TODO: 目前必须在全屏下才能成功正确找到 确定按钮 int x = int.Parse(xy[0]); int y = int.Parse(xy[1]); point.x = x; point.y = y; return(point); }
public static double CalculateSquareDistanceFromPointToSegment(CoordPoint firstSegmentPoint, CoordPoint secondSegmentPoint, CoordPoint point) { if (firstSegmentPoint == secondSegmentPoint) { return(CalculateSquareDistance(firstSegmentPoint, point)); } double acSquare = CalculateSquareDistance(firstSegmentPoint, secondSegmentPoint); double abSquare = CalculateSquareDistance(firstSegmentPoint, point); double bcSquare = CalculateSquareDistance(secondSegmentPoint, point); if (abSquare >= bcSquare + acSquare) { return(bcSquare); } if (bcSquare >= abSquare + acSquare) { return(abSquare); } double interimValue = abSquare + acSquare - bcSquare; double distance = abSquare - interimValue * interimValue / acSquare * 0.25; return(Math.Max(distance, 0)); }
public override void ImportFromParameters(ParameterCollection p) { if (p == null) { throw new ArgumentNullException(nameof(p)); } base.ImportFromParameters(p); Location = new CoordPoint( Utils.DxpFracToCoord(p["LOCATION.X"].AsIntOrDefault(), p["LOCATION.X_FRAC"].AsIntOrDefault()), Utils.DxpFracToCoord(p["LOCATION.Y"].AsIntOrDefault(), p["LOCATION.Y_FRAC"].AsIntOrDefault())); Corner = new CoordPoint( Utils.DxpFracToCoord(p["CORNER.X"].AsIntOrDefault(), p["CORNER.X_FRAC"].AsIntOrDefault()), Utils.DxpFracToCoord(p["CORNER.Y"].AsIntOrDefault(), p["CORNER.Y_FRAC"].AsIntOrDefault())); LineWidth = (LineWidth)p["LINEWIDTH"].AsIntOrDefault(); Color = p["COLOR"].AsColorOrDefault(); AreaColor = p["AREACOLOR"].AsColorOrDefault(); TextColor = p["TEXTCOLOR"].AsColorOrDefault(); FontId = p["FONTID"].AsIntOrDefault(); IsSolid = p["ISSOLID"].AsBool(); ShowBorder = p["SHOWBORDER"].AsBool(); Alignment = p["ALIGNMENT"].AsIntOrDefault(); WordWrap = p["WORDWRAP"].AsBool(); ClipToRect = p["CLIPTORECT"].AsBool(); Text = p["TEXT"].AsStringOrDefault(); }
internal static double CalculateSquareDistance(CoordPoint a, CoordPoint b) { double dx = b.GetX() - a.GetX(); double dy = b.GetY() - a.GetY(); return(dx * dx + dy * dy); }
/// <summary> /// 如果 isAbsolute != true, 在相对坐标(x, y)上点击一次 /// 否则 在绝对坐标(x, y)上点击一次 /// </summary> /// <param name="p12"></param> /// <param name="isAbsolute"></param> public void ClickBtnOnceAtPoint(CoordPoint p12, string memo = "", bool isAbsolute = false, int delayMills = 0, int clickCount = 1) { if (delayMills > 0) { KK.Sleep(delayMills); } long t1 = KK.CurrentMills(); CoordPoint po = p12; if (!isAbsolute) { po = Datum.AddDelta(p12.x, p12.y); } int ret = robot.MoveTo(po.x, po.y); robot.LeftClick(); if (clickCount > 1) { robot.LeftClick(); } logger.InfoFormat("点击按钮#{0} @ {1} with count#{2}, elapsed {3}.", memo, po.ToString(), clickCount, KK.CurrentMills() - t1); }
public SchRectangle() : base() { Corner = new CoordPoint(Utils.DxpFracToCoord(50, 0), Utils.DxpFracToCoord(50, 0)); Color = ColorTranslator.FromWin32(128); AreaColor = ColorTranslator.FromWin32(11599871); IsSolid = true; }
protected override JsonCommand DoExecute(InputTextCommandRequest req) { string[] arr = req.Coord.Split(','); string x1 = arr[0]; string y1 = arr[1]; // get coord CoordPoint p = new CoordPoint(int.Parse(x1), int.Parse(y1)).DeltaRemote(); // if need clear first bool needClear = true; // extract text string text = req.Text; CoordPoint cp = p; if (req.ScreenModeVal != 10) { cp = bidActionManager.DeltaPoint(p); } bidActionManager.InputTextAtPoint(cp, text, needClear, "remote-input"); return(null); }
private void mapControl1_MouseMove(object sender, MouseEventArgs e) { if (pin != null) { CoordPoint point = this.mapControl1.ScreenPointToCoordPoint(new MapPoint(e.X, e.Y)); pin.Location = point; } }
// private void clickConfirmBidOkAtPhase1(CoordPoint p12) { long t1 = KK.CurrentMills(); int ret = robot.MoveTo(p12.x, p12.y); robot.LeftClick(); logger.InfoFormat("第一阶段 尝试点击 - 出价结果 确认 按钮 - {0}, {1}, {2}", p12.x, p12.y, KK.CurrentMills() - t1); }
private void PrjToGeo(CoordPoint pt, ICoordinateTransform coordTran) { double prjX = 0, prjY = 0; coordTran.Prj2Geo(pt.X, pt.Y, out prjX, out prjY); pt.X = prjX; pt.Y = prjY; }
private void MapControl_MouseMove(object sender, MouseEventArgs e) { if (_pin != null) { CoordPoint point = MapControl.ScreenPointToCoordPoint(new MapPoint(e.X, e.Y)); _pin.Location = point; } }
private void testToolStripMenuItem_Click(object sender, EventArgs e) { SetActiveContainer(null); var schLib = new SchLib { new SchComponent { new SchRectangle { Corner = CoordPoint.FromMils(500, 1100) }, new SchPin { Location = CoordPoint.FromMils(500, 100) }, new SchPin { Location = CoordPoint.FromMils(500, 250) }, new SchPin { Location = CoordPoint.FromMils(500, 400) }, new SchPin { Location = CoordPoint.FromMils(500, 550) }, new SchPin { Location = CoordPoint.FromMils(500, 700) }, new SchPin { Location = CoordPoint.FromMils(500, 850) }, new SchPin { Location = CoordPoint.FromMils(500, 1000) }, new SchPin { Designator = "P8", Location = CoordPoint.FromMils(0, 1000), Orientation = TextOrientations.Flipped }, new SchPin { Location = CoordPoint.FromMils(0, 850), Orientation = TextOrientations.Flipped }, new SchPin { Location = CoordPoint.FromMils(0, 700), Orientation = TextOrientations.Flipped }, new SchPin { Location = CoordPoint.FromMils(0, 550), Orientation = TextOrientations.Flipped }, new SchPin { Location = CoordPoint.FromMils(0, 400), Orientation = TextOrientations.Flipped }, new SchPin { Location = CoordPoint.FromMils(0, 250), Orientation = TextOrientations.Flipped }, new SchPin { Location = CoordPoint.FromMils(0, 100), Orientation = TextOrientations.Flipped } } }; SetData(schLib); }
public ImportExport() { InitializeComponent(); DataContext = this; shapefileWorldResources = new ShapefileWorldResources(); ZoomLevel = 1; CenterPoint = new GeoPoint(0, 0); FileUri = shapefileWorldResources.CountriesFileUri; }
public HotelsViewModel() { CoordinateSystemType = CoordinateSystemType.Geo; MinZoomLevel = geoMinZoomLevel; MaxZoomLevel = geoMaxZoomLevel; ZoomLevel = mapDefaultZoomLevel; CenterPoint = mapDefaultPosition; HotelInfos = LoadDataFromXML(); }
bool IsEdgeBroken(int aPrev, int aNext, int bPrev, int bNext) { CoordPoint aPreviousPoint = this.polygonsPoints[aPrev]; CoordPoint aNextPoint = this.polygonsPoints[aNext]; CoordPoint bPreviousPoint = this.polygonsPoints[bPrev]; CoordPoint bNextPoint = this.polygonsPoints[bNext]; return(!((aPreviousPoint == bNextPoint && aNextPoint == bPreviousPoint) || (aPreviousPoint == bPreviousPoint) && (aNextPoint == bNextPoint))); }
private void mapControl1_MouseUp(object sender, MouseEventArgs e) { if (pin != null) { CoordPoint point = this.mapControl1.ScreenPointToCoordPoint(new MapPoint(e.X, e.Y)); pin.Location = point; this.mapControl1.EnableScrolling = true; pin = null; } }
public static VirtualRasterHeader Create(CoordPoint leftBottom, int width, int height, float resolutionX, float resolutionY) { VirtualRasterHeader vr = new VirtualRasterHeader(); vr.Width = width; vr.Height = height; vr.ResolutionX = resolutionX; vr.ResolutionY = resolutionY; vr.CoordEnvelope = CoordEnvelope.FromLBWH(leftBottom.X, leftBottom.Y, resolutionX * width, resolutionY * height); return(vr); }
public void FindAndSetCoordOfCurrentTime() { robot.UseDict(DictIndex.INDEX_CURRENT_TIME); var p = robot.SearchTextCoordXYInFlashScreen(Datum.x + 20, Datum.y + 365, 370, 190, "0066cc-101010", "目前时间"); if (p != null && p.x > 0 && p.y > 0) { logger.DebugFormat("find coord of current-time is {0}", p.ToString()); this.coordOfCurrentTime = p; } }
// private void clickLoginAtLogin(CoordPoint p6) { long t1 = KK.CurrentMills(); if (p6.x > 0 && p6.y > 0) { logger.InfoFormat("找到 - 参加投标竞买 按钮 - {0}, {1}", p6.x, p6.y); robot.MoveTo(p6.x + 10, p6.y + 2); robot.LeftClick(); logger.InfoFormat("点击了 - 参加投标竞买 按钮 - {0}, {1}, {2}", p6.x, p6.y, KK.CurrentMills() - t1); } }
// private void inputCaptchAtPhase1(CoordPoint p13, string captcha) { long t1 = KK.CurrentMills(); if (p13.x > 0 && p13.y > 0) { robot.MoveTo(p13.x, p13.y); robot.LeftClick(); robot.KeyPressString(captcha); logger.InfoFormat("第一阶段 尝试输入 - 验证码 输入框 - {0}, {1}, {2}", p13.x, p13.y, KK.CurrentMills() - t1); } }
private void mapControl1_MouseDown(object sender, MouseEventArgs e) { if ((Control.ModifierKeys & Keys.Control) == Keys.Control) { CoordPoint point = mapControl1.ScreenPointToCoordPoint(e.Location); PushpinAdapter.Items.Add(new MapPushpin() { Location = point, Text = PushpinAdapter.Items.Count.ToString() }); listBox1.Items.Add(point); } }
private void MapControl_MouseUp(object sender, MouseEventArgs e) { if (_pin != null) { CoordPoint point = MapControl.ScreenPointToCoordPoint(new MapPoint(e.X, e.Y)); _pin.Location = point; MapControl.EnableScrolling = true; DisplayPointCoordinates((GeoPoint)point); SaveMapData(); _pin = null; } }
public override void ImportFromParameters(ParameterCollection p) { if (p == null) { throw new ArgumentNullException(nameof(p)); } base.ImportFromParameters(p); Location = new CoordPoint( Utils.DxpFracToCoord(p["LOCATION.X"].AsIntOrDefault(), p["LOCATION.X_FRAC"].AsIntOrDefault()), Utils.DxpFracToCoord(p["LOCATION.Y"].AsIntOrDefault(), p["LOCATION.Y_FRAC"].AsIntOrDefault())); Color = p["COLOR"].AsColorOrDefault(); }
public void ClickLoginButton() { // 可能有身份证输入框 var d2 = new CoordPoint(642, 473); actionManager.ClickBtnOnceAtPoint(d2, "投标竞拍T2"); KK.Sleep(200); // 没有身份证输入框 var d1 = new CoordPoint(642, 427); actionManager.ClickBtnOnceAtPoint(d1, "投标竞拍T1"); }