How can I got a point's GPS position when select it on the static map - google-maps-api-2

Firstly,I use google static map API to get the image to display on html/wml.
And then, I want to get the point's GPS position where user pressed on the image.
Is there some way to get the GPS position if I got the co-ordinates on the image?

The short answer is probably not. You can't be sure exactly what the static map's dimensions are (the server might change the location slightly to fit things better, etc.). If you're just asking for a map by center and zoom then you stand a slightly better chance, but it will still be tricky.
If you're trying to add dynamic behaviour to a static map, have you considered instead the Maps JavaScript API? Finding the coordinates of where a user clicks is trivial there. (Also, you can disable the zooming, panning, controls, etc. if you want so that it still feels like it's static).

Related

Localize Hololens in mapped space between application runs (wihout anchors)

Please is it possible to localize Hololens in specific map between application runs without using anchors? I would like to use coordinate system provided by SpatialStationaryFrameOfReference as it makes more sense for my use-case than anchors. However this would obviously result in different origin for each application run. Therefore I am looking for a way to get transform from SpatialStationaryFrameOfReference -> to absolute position in current map.
For example 3D view in device portal always shows Hololens in correct relation to current map - even when no anchors are placed in it. Therefore I thought it should be possible to do this also from application. So far I have only thought of placing some random anchor that would be then used to get a transform from the anchor’s coordinate system to that of the stationary reference frame (using TryGetTransformTo). I guess this should technically work, but I there might be also a better way, right? Thanks.
Another way to set the application's origin is to detect the QR code in the environment and establish a coordinate system. For more information please see:QR code tracking

Android SMS Messaging like UI

I'm going to make an app which will require messaging. Now I have questions about making the messaging UI. I want to make it similar to Go SMS Theme Minimal UI
I am assuming that I'll have to use listview and 9 patch png.
But I need a expert advice.
I would say that that is a good approach. You will definitely need a list view, the real question is just how to build the list item background.
Looking at the image you shared, the pointy part of the box (outlined in red) is really all that can't be stretched, so you could make a 9 patch similar to this.
The top and left are the important part, they tell the 9 patch which parts can be stretched (or repeated, really. The bottom and right tell it which parts can contain content. So if you always need a certain amount of padding then you can use those to define that.
I'm not a designer, but what I like to do is take an image like this, obviously trim out the content, then trim it down in the middle so one black line on either part (top/bottom, left/right) is only 2 pixels wide. This allows the smallest possible asset so you don't load as large of a bitmap, but still gets all of the appropriate information.

Point in Polygon check with SVG and JavaScript?

I have a map that I converted from a raster graphic into an SVG file by converting the differently coloured areas into paths.
I know how to do a basic point-in-polygon check given an array of edges, but the svg:path elements represent multiple polygons as well as masks (to account for seas etc) and extracting that information by parsing the d attribute seems rather heavy-handed.
Is there a JS library that allows me to simplify that check? I basically want to create random points and then check whether they are on land (i.e. inside the polygons) or water (i.e. outside).
As SVG elements seem to allow for mouse event handling, I would think that this shouldn't be much of a problem (i.e. if you can tell whether the mouse pointer is on top of an element, you are already solving the point-in-polygon problem).
EDIT: Complicating the matter a bit, I should mention that the svg:path elements seem to be based on curves rather than lines, so just parsing the d attribute to create an array of edges doesn't seem to be an option.
As the elements can take a fill attribute, a ghetto approach of rendering the SVG on a canvas and then finding the colour value of the pixel at the given point could work, but that seems like a really, really awful way to do it.
The answers on Hit-testing SVG shapes? may help you in this quest. There are issues with missing browser support, but you could perhaps use svgroot.checkIntersection to hit test a small (perhaps even 0 width/height would work?) rectangle within your polygon shape.
The approach I suggested as a last resort seems to be the easiest solution for this problem.
I found a nice JS library that makes it easy to render SVG on a canvas. With the SVG rendered, all it takes is a call to the 2D context's getImageData method for a 1x1 region at the point you want to check. I guess it helps to create a copy of the SVG with colour coding to make the check easier if your SVG is more complex than the one I'm using (you'll have to check the RGBA value byte-by-byte).
This feels terribly hackish as you're actually inspecting the pixels of a raster image, but the performance seems to be decent enough and the colour checks can be written in a way that allows for impurities (e.g. near the edges).
I guess if you want relative coordinates you could try creating a 1-to-1 sized canvas and then divide the pixel coordinates by the canvas dimensions.
If somebody comes up with a better answer, I'll accept it instead. Until then, this one serves as a placeholder in case someone comes here with the same problem looking for an easy solution.

Modifying a model and texture mid-game code

Just have a question for anyone out there who knows some sort of game engine pretty well. What I am trying to implement is some sort of script or code that will allow me to make a custom game character and textures mid-game. A few examples would be along the lines of changing facial expressions and body part positions in the game SecondLife. I don't really need a particular language, feel free to use your favorite, I'm just really looking for an example on how to go about this.
Also I was wondering if there is anyway to combine textures for optimization; for example if i wanted to add a tattoo to a character midgame, is there any code that could combine his body texture and the tattoo texture into one texture to use (this way I can simply just render one texture per body.)
Any tips would be appreciated, sorry if the question is a wee bit to vauge.
I think that "swappable tattoos" are typically done as a second render pass of the polygons. You could do some research into "detail maps" and see if they provide what you're looking for.
As for actually modifying the texture data at runtime, all you need to do is composite the textures into a new one. You could even use the rendering API to do it for you, more than likely; render the textures you want to combine in the order you want to combine them into a new texture. Mind, doing this every frame would be a disoptimization since it'll be slower to render two textures into one and then draw the new one than it would be just to draw the two sources one after the other.

How does Nike's website do this Flash effect when the user selects a choice

I was wondering how does Nike website make the change you can see when selecting a color or a sole. At first I thought they were only using images and when the user picked a color you just replaced that part, but when I selected a different sole I noticed it didn't changed like an image it looked a bit more as if it was being rendered. Does anybody happens to know how this is made? Or where can I get further info about making this effect :)?
It's hard to know for sure, but my guess would be that they're using a rendering service similar to that provided by Adobe's Scene7.
It's a product that is used to colorize/customize a base product image based on user choices.
If you're interested in using the service, I'd suggest signing up for their weekly webinar. I attended one a while back and was very impressed with their offering. They showed the Converse site (which had functionality almost identical functionality to the Nike site) as a demo.
A lot of these tools are built out in Flash using a variety of techniques:
1) You can use Flash's BitmapData object to directly shift the hues of the pixels in your item. This is probably the simplest technique but often limits you to simple color transformations.
2) You can pre-render transparent PNG's (or photos, I guess) containing the various textures you would want to show on your object (for instance patterns or textures) and have them dynamically added to your stage at runtime. This, I think, offers the highest fidelity but means you need all of your items rendered upfront.
3) You can create 3D collada files and load them via a library like Papervision3D. Then dynamically change the texture at runtime. This is the most memory intensive technique and tends to result in far worse fidelity, but for that you get a full 3D object that you can view in space.
I'm sure there are other techniques but those are the top 3 I can think of. I hope that helps!

Resources