5

I see some ways to do it:

1) Draw using OpenGL programmatically.

2) Draw using QuartzCore and CoreAnimation programmatically.

3) Draw map in AutoCad and then somehow connect it to iOS.

4) Draw map using SVG.

Requirments are supporting pathfinding and gps navigation.

For first 2 ways I think that it's expensive in terms of performance way, redraw all elements on scaling; and I don't think that this way may have GPS-navigation support.

Using AutoCad pictured maps is hard to understand for me how to connect it with graphs\paths for pathfinding.

My colleagues will develop this app on web using SVG. I found it - https://github.com/SVGKit/SVGKit , but still have no idea how it will support pathfinding and navigation.

I would appreciate any help.

Aft3rmath
  • 669
  • 2
  • 12
  • 21

1 Answers1

4

Generally there are two types of map application:

A) They display a map, (with or without a user position) without needing to calculate a path like a navigation system does (see point B)

B) Application that use the vectors of a map and calculate something: e.g to find a best path. The shortest connection, e.g A navighation system , etc.

Application for A) are usually less complex then that of B), because the vectors can be somewhat inacurate, have no conections, have small gaps, have no logic between the edges, etc.

1) To only display a building map, you would only need a list of edges. (An edge is pair of coordinates (x1,y1) - (x2,y2). How ever you get that. E.g MapInfo Professional format mif/mid.
Or even you could dispaly a pdf that contains the map of the builing. Right with the built in PDF View, (also with SVG but more difficult).

Things get much more complicated if it is not a relative map, but also a map that is positioned with an reference coordinate system, like latitude/longitude (WGS84).
In that case you would use a Tool (mapInfoProfessional, to import AutoCad DXF Files, and apply 3 GPS measured reference points at the corner of the house, and convert that to LatLong WGS84 coordinates system.
With ios you cannot measure that 3 Points because you cannot average a position, ios stops sending when you are standing still at one corner of the house. You could try to extract the positions from a google earth satellite foto if you are living in a region where google Sattelite fotos have high resolution. (But this might violate the license conditions of that Satellite Foto provider (Topic: derived data))

Finally you now have a list of edges in Lat Lon coordinate System.

For Displaying I personally would either do with 1) OpenGL) or 2) Quartz2D.

Now the Path finding part.

Probaly you need a second "map" that defines the possible paths inside the building. This structure must be a connect graph (points with connected neighbours). Computer games do it that way. (Some even allow you to display that path in developper mode)

The path can be drawn, in a different layer of the floor plan. But this path has higher requirements: No gaps are allowed, all must be perfect connected.

Call that layer "Path" and export it as own plan.
Now use only this path layer, and import, and create a graph of nodes with connect neighbours.

Use Dijkstra Algo to search for shortest path.

AlexWien
  • 28,470
  • 6
  • 53
  • 83
  • Thanks for detailed answer! So, as I understood, I have to make AutoCad map, convert it using mapInfoProfessional into something, that supports LatLong coordinate system, and then draw it using OpenGL/Quartz2D? I still can't understand how make this map interact with iOS, just draw it in some view? Or any specified component? And LatLong coordinate system must be applied to AutoCad map exactly, or to already drawn map in iOS? – Aft3rmath Feb 15 '13 at 11:45
  • yes, just draw it in a view, CGRectlineTo. the conversion of the map to LAtLong can also be done by you, using a Helmert Transformation. when drawing the map you also need to convert back latLong to screen coordinates (Using a cylinder projection) – AlexWien Feb 15 '13 at 12:10
  • Thank you a lot! But what about scaling? Should I create different resolutions maps for every step of scaling, and then redraw map's fragment on scale, using another resolution auto cad map? – Aft3rmath Feb 15 '13 at 12:14
  • no, you dont draw bitmaps, you draw lines, vectors, that scale by simple multiply the coordinazes with the zoom factor – AlexWien Feb 15 '13 at 12:20
  • or better use setTransform() of the view, usingba CgAffineTransformationScale. Apple will then scale it for you. – AlexWien Feb 15 '13 at 12:28
  • I'm confused ;) For what then I need to create AutoCad map, If I will draw all primitives programmatically on view? – Aft3rmath Feb 15 '13 at 12:32
  • maybevou dont need, if you draw it with the SVG Web Application. autocad is one tool to create a floorplan as vectors. and its widley used by architects. big buildings probably already habe an floorplan created with autocad. it not easy to create a tool for floorplan creation, if you ever drawedba floorplan you know the high number ofvfeatures which are neccesarry to comfortabky draw a floorplan. – AlexWien Feb 15 '13 at 12:39
  • Feel myself so stupid, but still have no luck with understanding that. What point to use SVG or AutoCad if have to draw lines and other primitives programmatically in -drawRect method? Or I must draw exactly that I create in SVG/AutoCad? If that's it, how to do it? I feel like I miss something – Aft3rmath Feb 15 '13 at 13:36
  • You can draw the lines in the application on the screen, But where does the floor plane comes from.?? WHo crteates that? With wich tool?, for what purpose? You probaly should design that project with experienced software enginieers. – AlexWien Feb 15 '13 at 15:26
  • For example my gf create .pdf and .dxf maps of our house. It's completed for tests of pathfinding. I mean where AutoCAD/SVG files will be used, if you told me draw all primitives programmatically? This is what I didn't understand – Aft3rmath Feb 15 '13 at 17:45
  • Autcad file ar enot neccesarrily matehjmaticaly poerfect connected,. you have to check that in software. So I would draw an explicity map addionally foir the path, called pathMap, and check in import that all points in path can reach each other (using Dijkstra distance) – AlexWien Feb 15 '13 at 17:51
  • Which software should I use to check it(check what?)? So I must display autoCAD map and draw my path on layer above AutoCAD map, which contains all possible points to determine smallest path? What component can display AutoCAD map? – Aft3rmath Feb 15 '13 at 19:29