Operating system requirements: iOS 5.0 or later.
Mobile device: iPad.
This example describes working with geographic data of map data source. After starting the example the following operations are executed:
A map data source is created by means of pivot object for building data tables.
Array of fixed dimensions of map data source is retrieved.
Geographic coordinates and specified data series title are set.
Array of data series identifiers is retrieved, for which geographic data is set.
Geographic coordinates and title of one of data series identifiers are retrieved from the obtained array.
Key of metric dimension in map data source is retrieved.
Metric dimension name dictionary is retrieved.
Metric dimension element name dictionary is retrieved.
Executing the example requires to place the following code in the body of the executeExample method of the ViewController class (see the Displaying of Express Report section):
// Create a pivot object for building data tables SPPLPivot pivot = PPLPivot::pivot(m_olapReport); // Create a map data source MapDataViewDatasource *mapDatasource = [[MapDataViewDatasource alloc] initWithPivot:pivot withFullTopoSelection:YES]; // Set up dimensions in map data source [mapDatasource performSelector:@selector(dimensionsSetup) withObject:nil]; // Get array of fixed dimensions of map data source SNArray fixed = [mapDatasource fixedDimensions]; // Get first dimenion in array of fixed dimensions SPPLDimension dimensionFromFixed = fixed->objectAtIndex<PPLDimension>(0); // Display obtained dimension name in the development environment console NSLog(@"Fixed dimension in map data source: %@", dimensionFromFixed->name()->nsString()); // Set geographic data for data series with the "RU" identifier CLLocationCoordinate2D coordinate; coordinate.latitude = 66; coordinate.longitude = 94; [mapDatasource addGeographicSeriesWithID:@"RU" title:@"RF" coordinate:coordinate]; // Get array of data series identifiers, for which geographic data is set NSArray *coordinatesList = [mapDatasource seriesWithGeographicDataIDList]; // Get first data series identifier with geographic data NSString *id1 = [coordinatesList objectAtIndex: 0]; // Get data series title by its identifier NSString *title =[mapDatasource titleWithID: id1]; // Get and display data series geographic coordinates in the development environment console CLLocationCoordinate2D coordinateFromID = [mapDatasource coordinateWithID: id1]; NSLog(@"Data series "%@"; title: "%@"; latitude: %f; longitude: %f", id1, title, coordinateFromID.latitude, coordinateFromID.longitude); // Get and display metric dimension key in the development environment console int64 metricsKey = [mapDatasource currentMetricsDimensionKey]; NSLog(@"Metric dimension key: %d",metricsKey); // Get metric dimension name dictionary NSDictionary *metricsDimensionsKeys = [mapDatasource metricsDimensionsKeys]; // Display name of the first dictionary element in the development environment console NSLog(@"First dimension in metric dimension name dictionary: %@",[metricsDimensionsKeys objectForKey:[[metricsDimensionsKeys allKeys] objectAtIndex:0]]); // Get metric dimension element name dictionary NSDictionary *metricsDimensionElementsKeys = [mapDatasource metricsDimensionElementsKeys]; // Display name of the first dictionary element in the development environment console NSLog(@"First element in metric dimension element name dictionary: %@",[metricsDimensionElementsKeys objectForKey:[[metricsDimensionElementsKeys allKeys] objectAtIndex:0]]);
After executing the example the development environment console displays information about map data source, and also geographic data for one of the source data series:
Fixed dimension in map data source: Indicators
The data series "RU"; title: "RF"; latitude: 66.000000; longitude: 94.000000
Metric dimension key: 1557
First dimension in metric dimension name dictionary: Indicators
First element in metric dimension element name dictionary: Monetary holdings (liabilities)
See also: