coordinates

How to get the x and y of a program window in Java?

[亡魂溺海] 提交于 2019-11-26 02:02:48
问题 Is there a way for me to get the X and Y values of a window in java? I read that I\'ll have to use runtime, since java can\'t mess directly, however I am not so sure of how to do this. Can anyone point me some links/tips on how to get this? 回答1: To get the x and y position of "any other unrelated application" you're going to have to query the OS and that means likely using either JNI, JNA or some other scripting utility such as AutoIt (if Windows). I recommend either JNA or the scripting

Measuring the distance between two coordinates in PHP

我只是一个虾纸丫 提交于 2019-11-26 01:56:00
问题 Hi I have the need to calculate the distance between two points having the lat and long. I would like to avoid any call to external API. I tried to implement the Haversine Formula in PHP: Here is the code: class CoordDistance { public $lat_a = 0; public $lon_a = 0; public $lat_b = 0; public $lon_b = 0; public $measure_unit = \'kilometers\'; public $measure_state = false; public $measure = 0; public $error = \'\'; public function DistAB() { $delta_lat = $this->lat_b - $this->lat_a ; $delta_lon

Getting View's coordinates relative to the root layout

倾然丶 夕夏残阳落幕 提交于 2019-11-26 01:06:09
问题 Can I get a View\'s x and y position relative to the root layout of my Activity in Android? 回答1: This is one solution, though since APIs change over time and there may be other ways of doing it, make sure to check the other answers. One claims to be faster, and another claims to be easier. private int getRelativeLeft(View myView) { if (myView.getParent() == myView.getRootView()) return myView.getLeft(); else return myView.getLeft() + getRelativeLeft((View) myView.getParent()); } private int

latitude/longitude find nearest latitude/longitude - complex sql or complex calculation

这一生的挚爱 提交于 2019-11-26 00:38:54
问题 I have latitude and longitude and I want to pull the record from the database, which has nearest latitude and longitude by the distance, if that distance gets longer than specified one, then don\'t retrieve it. Table structure: id latitude longitude place name city country state zip sealevel 回答1: What you need is to translate the distance into degrees of longitude and latitude, filter based on those to bound the entries that are roughly in the bounding box, then do a more precise distance