SGARView


Displays SGAnnotations in an augmented reality enviornment.

Superclass: UIView
Declared In: SGARView.h

Discussion

The main intention of this class is to be used as the cameraOverlayView for UIImagePickerController when the camera source type is selected. You can easily create this as a subview of another view and still achieve the same effect if you wish.

The SRARView is responsible for rendering the entire augmented reality scene. The view asks the data source for the annotations and their corresponding views.



Methods

-addContainer:

Adds a new conatiner as a subview of the SGARView .

-addResponder:

Adds a responder to the responder chain to be notified of incoming touch events and gestures.

-clear

 Resets the view sending a release call to all annotation views.

-dequeueReuseableAnnotationViewWithIdentifier:

Returns an unused, pre-allocate SGAnnotationView view if one is available.

-getContainers

 Returns all SGAnnotationViewContainers that are currently registered with the SGARView .

-reloadData

 Removes all annotation views from the envoirnment and loads in a new data set from dataSource .

-removeContainer:

Remove the conatiner from its superview and unregister it from touch events.

-removeResponder:

Removes the a responder from the responder chain.

-startAnimation

 Begins rendering the AR enviornment.

-stopAnimation

 Stops rendering the augment reality view.


addContainer:


Adds a new conatiner as a subview of the SGARView.

- (void) addContainer:(SGAnnotationViewContainer*)container; 
Parameters
container

The @//simplegeo/ooc/cl/SGAnnotationViewContainer SGAnnotationViewContainer .

Discussion

If the container has served its purpose, call removeContainer: to remove it from its superview. If the view is hidden or transparent in some way, it is still liable for touch events.


addResponder:


Adds a responder to the responder chain to be notified of incoming touch events and gestures.

- (void) addResponder:(id<SGARResponder>)responder; 
Parameters
responder

The responder to add.


clear


 Resets the view sending a release call to all annotation views.

- (void) clear; 
Discussion

This is much different then reloadData . It does not go through the entire process of asking the dataSource for new annotations. It assumes that you no longer want to display anything in the AR enviornment and that your only desire is to have a blank camera view.


dequeueReuseableAnnotationViewWithIdentifier:


Returns an unused, pre-allocate SGAnnotationView view if one is available.

- (SGAnnotationView*) 
        dequeueReuseableAnnotationViewWithIdentifier:(NSString*)viewId; 
Parameters
viewId

The identifier associated with the desired annotation view.

Return Value

An unused object view; otherwise nil if there are none.

Discussion

This methods behaves identically to that of UITableView's dequeue method. After a call to reloadData, the view will remove all views from the enviornment and prepare them all for reuse.


getContainers


 Returns all SGAnnotationViewContainers that are currently registered with the SGARView.

- (NSArray*) getContainers; 
Return Value

 An array of SGAnnotationViewContainers.


reloadData


 Removes all annotation views from the envoirnment and loads in a new data set from dataSource.

- (void) reloadData; 
Discussion

Once reloadData is called, all annotaiton views are sent prepareForReuses. The views are then awaiting to be dequeue and resused.


removeContainer:


Remove the conatiner from its superview and unregister it from touch events.

- (void) removeContainer:(SGAnnotationViewContainer*)container; 
Parameters
container

The @//simplegeo/ooc/cl/SGAnnotationViewContainer SGAnnotationViewContainer to remove.


removeResponder:


Removes the a responder from the responder chain.

- (void) removeResponder:(id<SGARResponder>)responder; 
Parameters
responder

The responder to remove.


startAnimation


 Begins rendering the AR enviornment.

- (void) startAnimation; 
Discussion

 See stopAnimation


stopAnimation


 Stops rendering the augment reality view.

- (void) stopAnimation; 
Discussion

 You can use both this method and startAnimation to create a freeze frame wihin the augmented reality or just to stop the rendering process altogether. You must call clear in order to reset the entire view.

Properties

dataSource

See data source

enableGridLines

YES if gridlines should be drawn. Otherwize; NO. The default is NO.

enableWalking

Allows a user to move around in the AR view.

gridLineColor

The color of the grid lines.

locationManager

The location manager that is used for obtaining the heading and location of the device.

movableStack

The movable stack that is present when a drag event is produced over a annotation view within the AR enviornment.

radar

The radar that is associated with the AR view.


dataSource


See data source

@property (
    nonatomic,
    assign) id<SGARViewDataSource> dataSource; 


enableGridLines


YES if gridlines should be drawn. Otherwize; NO. The default is NO.

@property (
    nonatomic,
    assign) BOOL enableGridLines; 


enableWalking


Allows a user to move around in the AR view.

@property (
    nonatomic,
    assign) BOOL enableWalking; 
Discussion

The notion of walking just means that the user is able to create touch events that will move them in the direction at which they are facing in the AR enviornment. For example, if a user is facing North and they create a pinch gesture, they will decrease the distance between their current position in the AR view to the records that are displayed directly North of them. The change in position is reflected both in the AR enviornment and also in the radar .

The following gestures will generate the effect: pinch => forward, pull => backward, double tap => move forward 3 meters, and single tap => move backward 3 meters.


gridLineColor


The color of the grid lines.

@property (
    nonatomic,
    retain) UIColor* gridLineColor; 


locationManager


The location manager that is used for obtaining the heading and location of the device.

@property (
    nonatomic,
    readonly) CLLocationManager* locationManager; 


movableStack


The movable stack that is present when a drag event is produced over a annotation view within the AR enviornment.

@property (
    nonatomic,
    retain) SGMovableStack* movableStack; 
Discussion

If a movable to stack is present, it will be added as a subview of SGARView. Set this property to nil in order to not allow views to be collected.


radar


The radar that is associated with the AR view.

@property (
    nonatomic,
    retain) SGRadar* radar; 

© SimpleGeo Last Updated: 03/31/2010