Operating system requirements: iOS 5.0 or later.
Mobile device: iPad.
This example displays a list of map area attribute names and values, a list of platform attribute names and values, a list of platform attribute parameters, and also value of one of the platform attributes is changed, and user interaction with a timeline is denied.
Executing the example requires to place the following code in the body of the executeExample method of the ViewController class (see the Creating a Map with a Timeline section):
// Get object for working with map layer MapLayer *layer = [[m_view layers] objectAtIndex:0]; // Parse all areas of obtained map layer in cycle for(MapShape *shape in [layer allShapes]) { // Compare current area identifier with the specified one if([shape.ID isEqual:@"RU"] == YES) { // Display a tooltip in specified area [m_view showPopupInShape:shape]; // Get object for working with a tooltip MapTooltip *tooltip = [shape tooltip]; // Set tooltip border color [tooltip setBorderColor:[UIColor blackColor]]; NSLog(@"XML attributes of SVG data"); // Get area attribute array NSDictionary *attributes = [shape attributes]; // Get attribute array keys NSArray *attributesKeys = [attributes allKeys]; // Parse array of keys in cycle for(NSString *key in attributesKeys) { // Get current key value id value = [attributes valueForKey:key]; // Display attribute information in the development environment console NSLog(@"Attribute: \"%@\", value: \"%@\"", key, value); } NSLog(@"Platform XML attributes"); // Get array of platform attributes NSDictionary *ppatributes = [shape ppattributeParameters]; // Get keys of platform attributes array NSArray *keys = [ppatributeParameters allKeys]; // Parse array of keys in cycle for(NSString *key in keys) { // Get current key value id obj = [ppatributeParameters valueForKey:key]; // Get parameter type from the obtained value NSString *type = [obj valueForKey:@"Type"]; /* Display in the development environment console */ information about platform attribute parameters NSLog(@"Parameter: \"%@\", type: \"%@\"",name, type); } } }
It is also required to replace the contents of the mapChart:touchDownInShape: method of the ViewController class (see see Creating a Map with a Timeline section) with the following code:
// Compare selected area identifier with the specified one if([shape.ID isEqual:@"RU"] == YES) { // Deny user interaction with timeline [[m_view timeAxis] setInactiveMode:YES]; // Get array of platform attributes NSDictionary *ppatributes = [shape ppattributes]; // Set new value for the Name attribute [ppatributes setValue:@"Russian Federation" forKey:@"Name"]; // Hide earlier displayed area tooltip [m_view showPopupInShape:shape]; // Display a tooltip again [m_view showPopupInShape:shape]; }
After executing the example the development environment console displays information about map area attributes and platform attributes:
XML attributes of SVG data
Attribute: "id", value: "RU"
Platform XML attributes
Attribute: "ISO", value: "RU"
Attribute: "IdMapping", value: "643"
Attribute: "TextOriginOffset", value: "0.5,0.5"
Attribute: "BarOriginOffset", value: "0.5,0.5"
Attribute: "PieOriginOffset", value: "0.5,0.5"
Attribute: "ImageOriginOffset", value: "0.5,0.5"
Attribute: "Name:, value: "Russian Federation"
Attribute: "Description", value: "Russian Federation"
Attribute: "OriginOffset", value: "0.5,0.5"
Platform attribute parameters
Parameter: "ISO", type: "string"
Parameter: "IdMapping", type: "int"
Parameter: "TextOriginOffset", type: "point"
Parameter: "BarOriginOffset", type: "point"
Parameter: "PieOriginOffset", type: "point"
Parameter: "ImageOriginOffset", type: "point"
Parameter: "Name", type: "string"
Parameter: "Description", type: "string"
Parameter: "OriginOffset", type: "point"
A tooltip containing information obtained from platform attributes is displayed for the map layer area with the RU identifier:
Then manually press the map layer area with the RU identifier. As a result, the user interaction with the timeline is denied. The timeline is replaced with a text on the screen corresponding to the current timeline value. Data of the attribute containing map area name are changed. The map area tooltip is hidden and displayed again with refreshed data:
See also: