coordinates

Get the center coordinates of phone screen

拟墨画扇 提交于 2019-12-22 04:19:11
问题 Can someone give me an example of how to get the center coordinates of the current displayed screen? I would like my objects to always be relative to the center coordinates of the active view. 回答1: You can try with DisplayMetrics to achieve your solution int mWidth= this.getResources().getDisplayMetrics().widthPixels; int mHeight= this.getResources().getDisplayMetrics().heightPixels; 回答2: Here is how I resolved the issue. As a background, I have a button that once the user moves the map to

UIView touch location coordinates

别等时光非礼了梦想. 提交于 2019-12-22 01:31:49
问题 What are the coordinates used in UIViews and their corresponding superviews? I have this code which i would like to detect a 'corridor' where the user can touch... similar to this image:alt text http://img17.imageshack.us/img17/4416/bildschirmfoto20100721u.png This is the code i have: CGPoint touch = [recognizer locationInView:[shuttle superview]]; CGPoint centre = shuttle.center; int outerRadius = shuttle.bounds.size.width/2; int innerRadius = (shuttle.bounds.size.width/2) - 30; if ((touch.x

Calculate correct cursor position with pan and zoom

不打扰是莪最后的温柔 提交于 2019-12-21 23:14:30
问题 I've been messing around with this problem for about an hour now. I have a viewport which supports panning and zooming, the panning is handled by storing an offset for the X and Y axis. The zoom is just a float going from 0.2 to 14. My problem is that I need to be able to place stuff where the user clicks in the viewport but when I zoom and pan the mouse coordinates are not correct. I haven't been able to figure out how to properly calculate the mouse coordinates. Here's an image showing what

Generating pixel values of line connecting 2 points

风流意气都作罢 提交于 2019-12-21 22:28:10
问题 I am having some troubles trying to connect separate points in my picture (see below). Right now, the code I have is as follows: first_time = resulting_coords[0:40] for i in range(len(first_time)): if(i < (len(first_time))-1): cv2.line(copy_test_image[0], (resulting_coords[i,0],resulting_coords[i,1]), (resulting_coords[i+1,0],resulting_coords[i+1,1]), (0,0,225), 2) elif(i>=(len(first_time))-1): # print(i) cv2.line(copy_test_image[0], (resulting_coords[i,0],resulting_coords[i,1]), (resulting

Find Coordinates for point on screen?

南楼画角 提交于 2019-12-21 20:36:47
问题 The thing is I have some graphics shown in a form, rectangle for example, and I want to capture when the point gets over thees fields. So I Thoght I try to find the corrrdinates for thees rectangles, but as thay are the coords in the form it dose not match the ones with the mouse location. So I wonder is there a way to find what coord on the screen a Point has on the screen and not in the form or controller? 回答1: Each control hs PointToFoo methods for conversion. Note that you should call

How to get Coordinates and PixelColor of TouchPoint in iOS/ObjectiveC

老子叫甜甜 提交于 2019-12-21 06:38:08
问题 I need to get the Coordinates and PixelColor of a TouchPoint in Objective-C. Is this even possible? If yes I would be very interested in the how-to or any hint in the right direction. Thanx!!! 回答1: I get the color under the mouse click point with a UIView category method posted by ivanzoid (How to get the color of a pixel in an UIView?). I use it like this in a custom view implementation: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[event allTouches]

identify zip codes that fall within latitude and longitudinal coordinates

≡放荡痞女 提交于 2019-12-21 06:10:32
问题 I have several data frames in R. The first data frame contains the computed convex hull of a set of lat and long coordinates by market (courtesy of chull in R). It looks like this: MyGeo<- "Part of Chicago & Wisconsin" Longitude <- c(-90.31914, -90.61911, -89.37842, -88.0988, -87.44875) Latitude <- c(38.45781, 38.80097, 43.07961, 43.0624,41.49182) dat <- data.frame(Longitude, Latitude, MyGeo) The second has zip codes by their latitude and longitudinal coordinates (courtesy of the US census

Comparing Touch Coordinates

孤人 提交于 2019-12-21 06:04:40
问题 Is it possible to compare touch coordinates made by the users on the UIView to the one store in a plist or txt format? The argument looks like this; if (user touch coordinate == touch coordinate stored in plist or text) then (do something) else (do something) If possible in what format should i write the coordinates in the list and how to associate it inside the program? thanks in advance and sorry if you find my question a bit noobie. 回答1: Not sure if there's a one-liner solution. On a

Python win32com and 2-dimensional arrays

≯℡__Kan透↙ 提交于 2019-12-21 05:44:16
问题 When using python and win32com to automate the software form Adobe one encounters problem with passing arrays of 2d coordinates. If one looks at code that Adobe ships for visual basic (VB) its simple. A simplified example for drawing a line in Illustrator would look as follows: Set appObj = CreateObject("Illustrator.Application") Set docObj = appObj.Documents.Add Set pathItem = docObj.PathItems.Add pathItem.SetEntirePath Array(Array(0.0, 0.0), Array(20.0, 20.0)) Now the naive assumption is

How to accurately make a map for a map-overlay

不羁岁月 提交于 2019-12-21 05:41:23
问题 I have images covering the whole of South Africa. These are in Tiff format and have coordinates embedded into them. I am trying to take these images (about 20 images) and use them as an map overlay in my iPhone app. My problem lies with cutting the maps up into tiles (accurately). MapTiler is the application which I plan on using to cut these massive images up into the tiles, but it askes me for several details. I have to choose from: Custom definition of the system (WKT, Proj. 4, ...) WGS84