Is there a way to grid my google map in Android? - java

I've created a map I want to classify my map into Let's say hexagon grids like cellular networks so I can be able to color each hexagon independently, the only work around I found was to manually draw circles using the overlay class and the ondraw method, but in order to manually do so I'll have to create like thousands of circles. I need a hexagrid on the whole map so when I need to color a hexagon I just find it by Let's say it's name or number. does Android support such feature?

No, Android does not have a built-in hexagon overlay for Google Maps. It is conceivable that you could find a third-party component for this, but more likely you will need to implement it yourself.

Related

Android map API V2. GroundOverlays over Polygons

I am working on a mobile Android map of my university campus using Google's Android map API. I have currently used Polygons to color in each building according to their faculty. I have also placed GroundOverlays to show where each food place/ATM is. However, the Polygon's seem to lay on top of the Groundoverlays, but I want the opposite to happen. Is this possible?
you must use Zindex to change the layering of items:
put polygons without setting zIndex (or set a low value), then put ground overlay zIndex to hundreds (or thousands) and you are done!
https://developer.android.com/reference/com/google/android/gms/maps/model/GroundOverlay.html#setZIndex(float)

Need assistance on HTML5 japplet or canvas

So basically I am building a GUI type interface for my website that needs to have multiple requirements.
Image to interact with i.e draw straight lines on it, curved lines, circles etc (different color lines too)
The image will need to have the option to "save" the current state and access it later
The image will have different objects on it that will have different "states" i.e active or not active etc.
What is the best way to accomplish this? I have looked into GUI builder and Canvas for HTML5 but have not found a solid guide to satisfy my needs. Any further assistance will be much appreciated!
You should be able to do that with the 2dContext provided by the canvas. This url gives you a list of all the methods
https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D
That gives you options to draw circles, rectangles etc and you can set up click events and hit tests on those objects.
You can also save the canvas output to an image or an array.

Android map overlay with sprites pathfinding

I want to make an Android App, with a real map and a overlay for the map, where sprites are drawn (can be dots or small images).
This is a rather hard question, so I have made a sketch of a map of a small city, where only roads and streets can be seen. That might look something like this on the device:
Imagine the red dots to be bots, and they want to get to the yellow dot, assuming they know the position.
What Android Map API should I use to be able to:
Draw custom sprites on a given location on the map (geo-coordinates rather than screen coordinates).
Generate valid paths from the streets and roads on the map, which the dots can move on (black lines).
Use pathfinding to calculate the shortest routes, e.g. from red dot to yellow dot.
Must be able to draw more than 10 sprites on the map.
(the map doesn't have to support 3d views or street views. Plain old top-down view is just fine)
If no map API exists that does not meet these requirements, what are some other solutions?
I'm really excited about this project, but I'm having a lot of trouble getting started with it, so any help or guidance will be much appreciated.
EDIT:
It seems that there is no answer to my question. I will leave this open and report back with my own solution.
Google Maps Android API v2 and Marker class.
All valid paths? You probably should not need it if you use Android API v2 with real map drawn for you, but you can also try to use Google Directions API.
Google Directions API.
No API exist that can handle more than 10 objects. You probably need something from NASA.
Have fun coding.

How to make a customizable graph

I'm looking to use the java2d API to make a graph in which users can manipulate certain features using their mouse - such as the scale used for an axis or move around the different points plotted on the graph.
So far all I have found is the drawX methods on a Graphics2D object, however there does not seem to be an easy way to capture a user clicking on one of these and moving it so that I can redraw the graph.
Can anyone suggest the best/easiest way to implement this? Just looking for a point in the right direction.
Not reinventing the wheel is always the best way, there are plenty of excellent libraries you can use: http://www.jfree.org/jfreechart/
If you are looking to implement this yourself, you would listen to mouse events on whatever component you're actually using to display your chart (say a JPanel), and then would have to convert between screen and chart coordinates to figure out what you need to change.

android opengl game

I'm trying to develop a 2D game to android using opengl.
I know how to print images on the screen and animate them. But in my game I have a map and a want to zoom in and out and scroll the map. But I can't figure out the best way of doing it.
Can anybody help me?
I don't have any api examples but I did games design at college so I'll give my two bits.
The method you use will depend on your map style, size, functionality and format.
For example if you are looking for a very static non changing map, use a simple picture image. You can use the API frame for a picture view, enabling you to zoom in and out as you do in the gallery and to scroll on zoomed images, or in this case, zoom locations on your map.
Alternatively, if your map is based off a tiling system, a good example of this is the original Pokémon and Legend of Zelda games from the old game boy, then each area stores a tile 'thumbnail' for itself as a bitmap. These are then put into their appropriate locations on a grid depending on what areas are discovered.
This is the probably the most flexible way to build your map as you are not relying on a set bitmap for the entirety your map meaning it can change its look efficiently; you can build it as desired to show areas of choice (useful for if the map only reveals places the gamer has covered) and it also means you can do tile based overlay:
ie - if a certain area should contain treasure, theres a treasure icon overlayed on that tiles x,y position on the map grid.
I used the tiling option in my game projects from college and it made everything else map related easier. It also made the map side of things smaller storage wise.
The simplest approach would be to just call glTranslatef(-scrollX,-scrollY,0) followed by glScalef(zoom,zoom,zoom) before you render your map.

Categories

Resources