Saturday, December 27, 2008

Iphone application development

I have recently been researching how we can implement our application on the mobile device. Since we are using an Iphone for a testbed it has become an interesting problem on how to use OpenGL and Objective-C to transfer our program to this device.

I have found some great resources related to these problems and some sample code that should be of great use to us. Below are some links that I am posting as a reference later on when I will actually implement the program on the mobile device.

/* This link is sample code for GLSprite. The GLSprite sample application shows how to create a texture from an image. By looking at the code, you can learn how to use Core Graphics to create a bitmap context and draw an image into the context. You can then see how to use OpenGL ES to create a texture from the image data.

This application is built on the Cocoa Touch OpenGL Application template. Instead of using GL_COLOR_ARRAY as provided in the template, GLSprite renders a texture. The textured sprite in the application rotates using the timer that's provided with the template. */

http://developer.apple.com/iphone/library/samplecode/GLSprite/index.html

/* XMLPerformance -- This sample explores two approaches to parsing XML, focusing on performance with respect to speed, memory footprint, and user experience. The XML data used is the current "Top 300" songs from the iTunes store. The data itself is not particularly important to the sample - it was chosen because of its simplicity, availability, and because the size (approximately 850KB) is sufficient to demonstrate the performance issues central to the sample.

This could be very useful if we can find a way to export the database in a XML format which would be easy to transfer, as well as being less data intensive and non-chatty */

http://developer.apple.com/iphone/library/samplecode/XMLPerformance/index.html

/* LocateMe -- Shows how to use the CLLocationManager class to determine the user's current location. It demonstrates starting and stopping updates, error handling, and changing location parameters.

This can be used to determine a users location that will enable us to provide location based content for the user. Can also be used for tracking users and other possible applications. */

http://developer.apple.com/iphone/library/samplecode/LocateMe/index.html

/*UICatalog -- This sample is a catalog of all the UI elements found in the iPhone's UIKit framework. It is designed to exhibit a large variety of views and controls along with all their varying properties and styles. If you need code to create specific UI controls or views, refer to this sample and it should give you a good head start in building your user interface. In most cases you can simply copy and paste the code snippets you need. */

http://developer.apple.com/iphone/library/samplecode/UICatalog/index.html

/*SeismicXML -- The SeismicXML sample application demonstrates how to use NSXMLParser to parse XML documents. When you launch the application it fetches and parses an RSS feed from the USGS that provides data on recent earthquakes around the world. It displays the location, date, and magnitude of each earthquake, along with a color-coded graphic that indicates the severity of the earthquake. */

http://developer.apple.com/iphone/library/samplecode/SeismicXML/index.html


There are also many other sample apps available that should prove very useful in the development of the NIJ mobile device implementation. These other sample source code and program can be found at:

http://developer.apple.com/iphone/library/navigation/SampleCode.html


Thursday, December 11, 2008

NIJ Project Conceptual Architecture and Data Flow Models

This figure is the conceptual project architecture for the NIJ Project.  This image was adapted from the orignal project proposal by Dr. Jiyeong Lee.  It describes in detail all of the aspects of the project and how data will be inputted and interfaces used.





The next image represents the flow of data from original building CAD file to the final mobile and desktop interfaces.





Mobile Application Implementation

Today I have finished composing a document that details the functionality and goals of the mobile application for NIJ project.  I will include a few of the key details in this post.

Mobile Application Goal

Implement a mobile application to support the operation of a GIS-based intelligent emergency response system (GIERS) (Kwan and Lee, 2005) that uses a 3D geocoding technology for locations in large buildings.  The application will aim to facilitate quick response to emergencies on multi-level structures using existing network technologies.  The mobile application will be a key component in the overall project in order to further the gathering of real-time data to aid in the decision making process.  This will allow emergency managers to respond to emergencies accurately, and evaluate and implement emergency response plans accordingly. 

Along with providing remote data gathering capabilities, the mobile application will serve as a secondary means of communication between dispatchers and emergency responders.  By using informative visualizations we hope to provide a means to guide responders through complex urban structures to points of interest  within the building.  In combination with our desktop application, the mobile application will provide a comprehensive set of tools to reduce the amount of time required to respond to emergencies in large and complex structures.

Functionality

·         Device

o   Provide a UI that is fully integrated for mobile use

o   Use network connections such as Wi-Fi or 3G

o   Effectively visualize key data

o   Useful in an emergency situation

o   Use GPS or cell phone triangulation to locate users

·         Application

o   Allow connection to Postgresql database or web interface

o   Allow editing and viewing of certain data

o   Send/receive data efficiently

o   Display real time information from data source

o   Allow users to easily identify/flag critical information (blocked hallways, stairways, room destinations)

o   Intuitive and easy to use

o   Allow multiple user types with different levels of access

o   Allow self-location of mobile users using GPS or triangulation

o   Allow reporting of different emergency types (fires, flood, chemical spill, etc.)

o   Provide interactive navigational guidance to critical locations 

Sunday, December 7, 2008

Project Update

For the next week or so I will be working on figuring out the conceptual framework and goals of our mobile application. I have been reading through the relevant research articles related to our study and have been finding out different ways to implement a solution.

As mentioned in a previous post, we will most likely be creating some kind of web interface that we will use to manipulate the data sets and allow users to edit things in the environment.

For this week I will be composing a document related to this which will be distributed about to be modified by the PI's and other researchers. It will later be distributed to the researchers at Purdue and other relevant people in hopes that it may generate new ideas on the mobile app implementation.

Wednesday, December 3, 2008

iPhone app implementation

I have been trying to find the best way to implement our application on the iPhone and I have run into a few problems and a variety of different solutions. The main problem with connecting to the database server can be solved by installed an app already written for the iPhone, Mobile Can 2.0. Another option is to install an SSH client to make the connection, and there and several of those are available: iSSH, pTerm, and TouchTerm. Each of these programs are available from the App store for a fee. One large problem arises with using these is that only one application can run at a time on the iPhone unless special software is installed to allow this which requires you to "jailbreak" the iPhone in order to install this app which makes changes to a critical config file. This would not let me take advantage of this software and allow me to "listen" to the outputs of these programs in an external program.

Since this seems to not be a very viable solution, I have trying to find other methods for obtaining data remotely from our database. Another option that I have discovered is a program called phpPgAdmin which is a web based postgresql database administration tool. This would essentially make the database available for updates and modifications just by visiting a web address. This would be much easier to use in the iPhone since no other additional apps would be required to install, and updates (for example blocking a hallway) could be executed by constructing SQL queries and sending them through the iPhone's web interface to the database server. However, this would require that the database server also be a web server with PHP enabled. This means that we would have to get Scott to install the software, as well as enable Apache and PHP for CCID147.

The great thing about using the phpPgAdmin web interface is that any mobile device with access to the internet can make updates to the database, not just the iPhone. This means that any program we write for the iPhone can be ported to another mobile OS (ie. Windows Mobile 6, Android) relatively easy without having to use proprietary iPhone software.

If this is not possible there are other routes that we can take such as creating a REST API to send/receive data. This would also allow for interoperability across multiple platforms other than the iPhone.

I am awaiting an email on whether to proceed with the phpPgAdmin installation.


Iphone Programming resources

I have been tasked with creating an extension of our program to be used on the iPhone. I have looking around the web for tutorials and explanations on how to program using Cocoa Touch, Objective-C, and other tools. Here are some useful websites that I have discovered related to these topics:

CS193P - Stanford iPhone programming class lecture notes and other information
http://www.stanford.edu/class/cs193p/cgi-bin/index.php

iPhone development blog (3rdparty)
http://icodeblog.com/

Apple iPhone Dev Center
http://developer.apple.com/iphone/

Getting started video
http://www.wonderhowto.com/how-to/video/how-to-get-started-with-iphone-programming-in-cocoa-184437/


Friday, November 14, 2008

Updates to CAD_database

After I uploaded an erroneous table to the database, It was necessary to delete the whole thing and start over again. Today I reuploaded all the previous files that were in the database with a few new additions.

These new additions included the woodward_rooms files that I have created. These files are simply the RM$ layer or the CAD files and refer only to the room polygons. I have also put in two files called Woodward_test* to the database. These will be used for testing the automation process with Jianfei's program. I will begin putting more of these in with varying degrees of complexity so as to test how his program interprets these files.

Thursday, November 13, 2008

New buildings coming soon

I have put in a request with Fred Brillante from Facilities Management to get more CAD data files. I have requested that we receive preferably the SAC, Cone Center, College of Health and Human Services, and the College of Education.

The main idea with this is to create a "urban cluster" that will be similar to the type of data we will be working with in an actual urban environment. When this data is incorporated we will most likely begin testing out the automation portion of this project to see how effective our techniques are in setting up this type of data. We can then also begin testing various scenarios related to urban clusters and emergency management.

Tuesday, November 4, 2008

New database and files for automation process

I have created a new database entitled "CAD_database" which I will be using to put CAD shapefile in a PostGIS database. The purpose of this database is to hold all of the data that will be nessessary in order to automate the room number/name and type assignments.

Currently, I have the raw converted shapefiles in there along with a generalized version of the Cameron buildings polygon file. I have deleted all unessessary polygons from the file (called: cri_rooms*) and it only contains the room geometry.

I hope to use the original shapefile to further divide the polygons into several groups of files that will be used to relate room numbers to polygons in the table. There are several ways to achieve this, however, I must see what Jianfei wants to do in order to cater to his needs. Since each building, and sometimes floor, have different labels and layers this may be a hard process to accomplish.

Friday, October 31, 2008

Geo-referenced Raw CAD Shapefiles

Today I have been using the spatial adjustment tool in ArcGIS to geo-reference the CAD shapefiles I created. We have been moving towards using these in a effort to save time and set up the data so that automated creation of our other data can begin.

Currently, I have CRI and Woodward Hall CAD shapefiles correctly geo-referenced using the Mecklenburg County building footprint file as my building reference. This process only takes about 20 minutes per building, and is much faster than the previous method of copy and pasting the CAD polygons directly into our geo-database.

I have noticed some descrepincies in the types of CAD files from building to building. In the CRI files, the room numbers are actually contained in the polygon, point, and annotation layers of the CAD shapefiles. From what I have noticed, the Woodward Hall CAD shapefiles do not have this type of information anywhere other than the annotations made on the original CAD files. This will definently be a problem in the future, especially if we find that most building exclude this information from the CAD files.

I am now working on getting the Atkins library files geo-referenced and should be done with that by the end of the day.