representando un mapa topológico usando java

I'm developing a indoor navigation program for android, and i'm stuck right at the beginning:
How do you represent a map in java?
I will prefer a way that will allow me to apply Dijkstra's algorithm easily.

note: i need the program to know the size of each room and where are the entrances and exits.

editar: i'm looking for a object to use in the BL not the UI

preguntado el 31 de julio de 12 a las 15:07

Do you mean something like a geographical map? -

You can represent it as an undirected graph: -

You are able to represent it any way you want. The data structure you wish to use is more up to you. I don't think you're question("How do you represent a map in java?") has an answer because you are able to represent it in many ways. -

You shouldn't use the "map" tag as it refers to the data structure which isn't what you seem to be searching for. -

2 Respuestas

Android has a built-in GUI element called a mapView that you can add to a screen in your application. It is a Google map and will require you to obtain your applications API key. You can add overlays to it and locate points on the map based on latitude and longitude (I think it supports other methods as well) and these points could be used for Dijkstra's algorithm. Hope this helps, good luck.

Respondido 31 Jul 12, 15:07

If you are working on an indoor map then you would have to draw that yourself, in which case I would suggest using a canvas. You can modify the onDraw() method to draw everything manually or you can draw pictures and text onto the view. The same concept of overlays should work although I'm not sure how they would be located if you can not use lat/long. You could link the overlay points to a pixel where an entrance or exit is located and just change the value of that pixel based on how the user moves the image around - Ramboslice

@share i was not so clear in my question. what i'm looking for is for the BL. - elyashiv

I think, what you are describing is a extended topological map (where you have an estimate on the nodes absolute location). So you basically need a component that can draw a graph with locations attached to the nodes. Also, you might want the possibility to draw addistional stuff (like heat maps for wifi connectivitiy, bluetooth devices or whatever you are using to estimate your position and gather information about the environment). You are also dealing with the SLAM problem.

I don't know of any existing component that can do the visual task for that, but maybe you find something with google. I wouldn't however recommend it. I would just create my own component (using a TextView and draw my stuff on that). It is much more flexible, not that much of an effort and you can choose the functionality and data format, which can be very helpful in such cases...

Once you have all the rest running (which is a lot!), you still can decide to look for some fancy component that may integrate even google maps, is able to zoom or so.

Respondido 31 Jul 12, 15:07

i think i was missed under stood - i'm looking for something for the BL (Business layer) not something graphical. - elyashiv

@elyashiv Oh, I see. Then you should ask for a data structure that can hold a topolocial map. If you have a list of all neighbouring nodes within each node, you can apply Djikstra very easily. I would create a class Node holding a list of nodes + some additional information (size, list of locations of door to the respective rooms, etc)... - brimborio

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.