coordinates

How can I draw on JPanel using another quadrant for the coordinates?

别来无恙 提交于 2019-12-08 10:56:20
问题 I would like to draw some shapes on a JPanel by overriding paintComponent . I would like to be able to pan and zoom. Panning and zooming is easy to do with AffineTransform and the setTransform method on the Graphics2D object. After doing that I can easyli draw the shapes with g2.draw(myShape) The shapes are defined with the "world coordinates" so it works fine when panning and I have to translate them to the canvas/JPanel coordinates before drawing. Now I would like to change the quadrant of

Dynamic Margin on Window Drag

旧城冷巷雨未停 提交于 2019-12-08 10:24:33
问题 Ok so complete rewrite of the question due to lack of replies. I want a window that is drag-able but as it's being dragged, alter the margin to extend as far as the old position of the window. I.e. Window moves right X, extend margin left X. Now I've hit a few snags such as the window having it's edges cut off for some reason. Here's my code, let me know if you can spot anything! private void Window_LocationChanged(object sender, EventArgs e) { double TmpLeft = Math.Abs(this.Left - WinLeft);

Code to find absolute position of an element of DOM in Java

霸气de小男生 提交于 2019-12-08 10:00:56
问题 I am working on a project in Java . In this project, I have to find absolute position of an element of DOM. But I don't know how to do this. I searched on net, I found the same for Javascript. I found this from here. Code is this , function getPosition(element) { var xPosition = 0; var yPosition = 0; while(element) { xPosition += (element.offsetLeft - element.scrollLeft + element.clientLeft); yPosition += (element.offsetTop - element.scrollTop + element.clientTop); element = element

Javascript (jQuery) limit mouse movement speed inside an element

坚强是说给别人听的谎言 提交于 2019-12-08 09:45:40
问题 The task is to draw a curve ob canvas. The problem is that if mouse is moved too fast, the coordinates are skipped and not captured. (Html5/Js canvas capturing mouse coords when it moves fast - my previous post..) Is there a cross-browser way to limit mouse speed inside an element (div, canvas, etc.)? 回答1: I assume by "limiting mouse speed" you actually mean enable capturing high volume of mouse events so that you get more detailed information, or resolution, of the mouse path. The browser

Android, google maps, polyline, shortest path

自闭症网瘾萝莉.ら 提交于 2019-12-08 09:37:10
问题 I have already read some topics on Stack Overflow but didn't found the exact solution for my problem. I will try to explain my problem. For example let say that I have a grid 9x9. The coordinates are represented by the junctions. Is there a method or did someone already implemented a procedure that draw a line from coordinate A (X, Y) to coordinate B (V, W) where the line represents the shortest path.. In my problem I am using Google Maps and I would like to draw a poly-line between

2D isometric engine - Math problems - Cube selection - diamond shape map

十年热恋 提交于 2019-12-08 09:27:10
问题 I calculate my coordinates when i create a layer with a std::vector , filled with cube objects(wich is a class of mine): for(int J = 0; J < mapSize; J++) { for(int I = 0; I < mapSize; I++) { x = (J - I) * (cubeSize/2); y = (J + I) * (cubeSize/4); c = new cube(cubeSize, x, y, z, I, J); cs.push_back(*c); } } I wanna do this : cs[getCubeByID(mouseX, mouseY)].setTexture(...); Example of use: The cube in I-J [0, 0] have the number 0 in the cubes array. if i click on 0,0 i got this number. EDIT: We

Geocoding - Converting an address (in String form) into LatLng in GoogleMaps Java

走远了吗. 提交于 2019-12-08 08:37:20
问题 I'm a beginner programmer, took a few courses in university and therefore don't have a complete understanding of the field. I figured I'd give a shot at coding an android application with GoogleMaps API and found the need to convert a user inputted address (in String format) into Google's complementary LatLng class , or more precisely, extract latitude and longitude coordinates in order to input into the LatLng constructor (JAVA). My search online in the matter yielded little to no results as

How to convert MGRS to decimal degrees

≡放荡痞女 提交于 2019-12-08 08:19:57
问题 I am making an iPhone application. I want my app to Convert MGRS co-ordinates to Decimal Degrees. How to do this Programatically ? 回答1: I searched and founded : Determine the grid coordinates of a point on a military map . Here, they have given the manual process of how to determine the six-digit grid coordinates for the point on the map with a 100meter tolerance. You can go through that process and can create your Objective-C code for that. Take a look at this C++ Class : GeoCoords.cpp .

Determine coordinates for an object at a specific distance and angle from a point

自古美人都是妖i 提交于 2019-12-08 05:31:53
问题 In a 2d space, I have an object of coordinates x1 and y1 and it is facing a specific direction , we'll call it "viewer". At start, the angle that measures the object rotation is 0, so the object starts always facing the same way. The angle is measured by a variable called yrot. let D be the distance from the object determined by sqrt ((x1-x2)^2 + (y1-y2)^2), consider this distance known. Now, knowing the viewer coordinates, the D distance and the yrot angle I want to determine the coordinates

Saving coordinates and data from Google maps in a database

守給你的承諾、 提交于 2019-12-08 04:37:50
问题 I am making a map project where when I choose an area (with google maps drawing tools) an info window pops up and I can write a Name and a Description and then save these and its coordinates. I am using a POST form and to this moment I am able to save in my DB the Name and Description but I cant find a way to save the coordinates. I have already tried with no success to pass it through POST or put some PHP in my JS. Here is my js code for the rectangle drawing tool: google.maps.event