diff options
author | Julian Rex <julian.rex@mapbox.com> | 2018-02-23 18:15:19 -0500 |
---|---|---|
committer | Julian Rex <julian.rex@mapbox.com> | 2018-02-23 18:15:19 -0500 |
commit | 0e7c1ff394aeb6e8432b1d7048d1332db2bad4f3 (patch) | |
tree | 4757ef096ddd97600017eb431a5a861b679051fc | |
parent | 5de373fff0e71496b6aa11ecb6556f958a28d80b (diff) | |
download | qtlocation-mapboxgl-upstream/jrex-macosapp-visible-annotations.tar.gz |
[macos] Added debug menu to log number of visible annotations.upstream/jrex-macosapp-visible-annotations
-rw-r--r-- | platform/macos/app/Base.lproj/MainMenu.xib | 20 | ||||
-rw-r--r-- | platform/macos/app/MapDocument.m | 9 |
2 files changed, 22 insertions, 7 deletions
diff --git a/platform/macos/app/Base.lproj/MainMenu.xib b/platform/macos/app/Base.lproj/MainMenu.xib index 72e9c5a189..5ef418dbe6 100644 --- a/platform/macos/app/Base.lproj/MainMenu.xib +++ b/platform/macos/app/Base.lproj/MainMenu.xib @@ -555,10 +555,16 @@ <action selector="drawAnimatedAnnotation:" target="-1" id="CYM-WB-s97"/> </connections> </menuItem> - <menuItem title="Show All Annnotations" keyEquivalent="A" id="yMj-uM-8SN"> + <menuItem title="Show Visible Annotation Count" id="yMj-uM-8SN"> + <modifierMask key="keyEquivalentModifierMask"/> + <connections> + <action selector="showVisibleAnnotationCount:" target="-1" id="Ghm-3T-vcd"/> + </connections> + </menuItem> + <menuItem title="Show All Annnotations" keyEquivalent="A" id="5KJ-x3-wmY"> <modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/> <connections> - <action selector="showAllAnnotations:" target="-1" id="ahr-OR-Em2"/> + <action selector="showAllAnnotations:" target="-1" id="upE-Fg-e7Z"/> </connections> </menuItem> <menuItem title="Remove All Annotations" id="6rC-68-vk0"> @@ -674,7 +680,7 @@ CA <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <rect key="contentRect" x="109" y="131" width="350" height="84"/> - <rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/> + <rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/> <view key="contentView" id="eA4-n3-qPe"> <rect key="frame" x="0.0" y="0.0" width="350" height="84"/> <autoresizingMask key="autoresizingMask"/> @@ -750,7 +756,7 @@ CA <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" utility="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <rect key="contentRect" x="830" y="430" width="400" height="300"/> - <rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/> + <rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/> <view key="contentView" id="8ha-hw-zOD"> <rect key="frame" x="0.0" y="0.0" width="400" height="300"/> <autoresizingMask key="autoresizingMask"/> @@ -758,11 +764,11 @@ CA <scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Q8b-0e-dLv"> <rect key="frame" x="-1" y="20" width="402" height="281"/> <clipView key="contentView" id="J9U-Yx-o2S"> - <rect key="frame" x="1" y="0.0" width="400" height="280"/> + <rect key="frame" x="1" y="0.0" width="400" height="265"/> <autoresizingMask key="autoresizingMask"/> <subviews> <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" autosaveColumns="NO" headerView="MAZ-Iq-hBi" id="Ato-Vu-HYT"> - <rect key="frame" x="0.0" y="0.0" width="423" height="257"/> + <rect key="frame" x="0.0" y="0.0" width="423" height="242"/> <autoresizingMask key="autoresizingMask"/> <size key="intercellSpacing" width="3" height="2"/> <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> @@ -901,7 +907,7 @@ CA </subviews> </clipView> <scroller key="horizontalScroller" verticalHuggingPriority="750" horizontal="YES" id="QLr-6P-Ogs"> - <rect key="frame" x="1" y="264" width="400" height="16"/> + <rect key="frame" x="1" y="265" width="400" height="15"/> <autoresizingMask key="autoresizingMask"/> </scroller> <scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="q0K-eE-mzL"> diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m index 7d39f93347..b82f36748a 100644 --- a/platform/macos/app/MapDocument.m +++ b/platform/macos/app/MapDocument.m @@ -563,6 +563,12 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio _isShowingAnimatedAnnotation = NO; } +- (IBAction)showVisibleAnnotationCount:(id)sender { + NSArray *visibleAnnotations = self.mapView.visibleAnnotations; + NSLog(@"Number of visible annotations = %ld", visibleAnnotations.count); +} + + - (IBAction)startWorldTour:(id)sender { _isTouringWorld = YES; @@ -1123,6 +1129,9 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio if (menuItem.action == @selector(insertGraticuleLayer:)) { return ![self.mapView.style sourceWithIdentifier:@"graticule"]; } + if (menuItem.action == @selector(showVisibleAnnotationCount:)) { + return YES; + } if (menuItem.action == @selector(showAllAnnotations:) || menuItem.action == @selector(removeAllAnnotations:)) { return self.mapView.annotations.count > 0; } |