Skip to content

Commit bd6e8b2

Browse files
committed
Merge branch 'master' of https://bitbucket.org/kuon/osx-gmap
2 parents 9a4c245 + 7246097 commit bd6e8b2

15 files changed

+322
-40
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ xcuserdata
1414
profile
1515
*.moved-aside
1616
docset-installed.txt
17+
update_apidoc.rb
1718
GMap.framework

DemoApp/DemoApp/DemoApp-Info.plist

+2
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,7 @@
3030
<string>MainMenu</string>
3131
<key>NSPrincipalClass</key>
3232
<string>NSApplication</string>
33+
<key>GMTileURLFormat</key>
34+
<string>http://otile1.mqcdn.com/tiles/1.0.0/osm/%ld/%ld/%ld.jpg</string>
3335
</dict>
3436
</plist>

DemoApp/DemoApp/GNAppDelegate.h

+2
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@
1313

1414
@property (nonatomic) BOOL addCircleOnClick;
1515

16+
- (IBAction)fitOverlays:(id)sender;
17+
1618
@end

DemoApp/DemoApp/GNAppDelegate.m

+6
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,10 @@ - (void)mapView:(GMMapView *)mapView doubleClickedAtPoint:(GMMapPoint)mapPoint l
119119
NSLog(@"double click @ (%@,%@)", @(mapPoint.x), @(mapPoint.y));
120120
}
121121

122+
- (IBAction)fitOverlays:(id)sender
123+
{
124+
[self.mapView zoomToFitOverlays:self.mapView.overlays];
125+
}
126+
127+
122128
@end

DemoApp/DemoApp/en.lproj/MainMenu.xib

+65-15
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,7 @@
13091309
<string key="NSWindowClass">NSWindow</string>
13101310
<nil key="NSViewClass"/>
13111311
<nil key="NSUserInterfaceItemIdentifier"/>
1312-
<string key="NSWindowContentMinSize">{500, 500}</string>
1312+
<string key="NSWindowContentMinSize">{800, 600}</string>
13131313
<object class="NSView" key="NSWindowView" id="439893737">
13141314
<reference key="NSNextResponder"/>
13151315
<int key="NSvFlags">256</int>
@@ -1500,7 +1500,7 @@
15001500
<string key="NSFrame">{{491, 24}, {131, 22}}</string>
15011501
<reference key="NSSuperview" ref="439893737"/>
15021502
<reference key="NSWindow"/>
1503-
<reference key="NSNextKeyView"/>
1503+
<reference key="NSNextKeyView" ref="265939853"/>
15041504
<string key="NSReuseIdentifierKey">_NS:9</string>
15051505
<bool key="NSEnabled">YES</bool>
15061506
<object class="NSTextFieldCell" key="NSCell" id="571337660">
@@ -1717,14 +1717,39 @@
17171717
</object>
17181718
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
17191719
</object>
1720+
<object class="NSButton" id="265939853">
1721+
<reference key="NSNextResponder" ref="439893737"/>
1722+
<int key="NSvFlags">289</int>
1723+
<string key="NSFrame">{{844, 17}, {112, 32}}</string>
1724+
<reference key="NSSuperview" ref="439893737"/>
1725+
<reference key="NSWindow"/>
1726+
<reference key="NSNextKeyView"/>
1727+
<string key="NSReuseIdentifierKey">_NS:9</string>
1728+
<bool key="NSEnabled">YES</bool>
1729+
<object class="NSButtonCell" key="NSCell" id="618793319">
1730+
<int key="NSCellFlags">67108864</int>
1731+
<int key="NSCellFlags2">134217728</int>
1732+
<string key="NSContents">Fit overlays</string>
1733+
<reference key="NSSupport" ref="272384590"/>
1734+
<string key="NSCellIdentifier">_NS:9</string>
1735+
<reference key="NSControlView" ref="265939853"/>
1736+
<int key="NSButtonFlags">-2038284288</int>
1737+
<int key="NSButtonFlags2">129</int>
1738+
<string key="NSAlternateContents"/>
1739+
<string key="NSKeyEquivalent"/>
1740+
<int key="NSPeriodicDelay">200</int>
1741+
<int key="NSPeriodicInterval">25</int>
1742+
</object>
1743+
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
1744+
</object>
17201745
</array>
17211746
<string key="NSFrameSize">{970, 791}</string>
17221747
<reference key="NSSuperview"/>
17231748
<reference key="NSWindow"/>
17241749
<reference key="NSNextKeyView" ref="150488294"/>
17251750
</object>
17261751
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
1727-
<string key="NSMinSize">{500, 522}</string>
1752+
<string key="NSMinSize">{800, 622}</string>
17281753
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
17291754
<bool key="NSWindowIsRestorable">YES</bool>
17301755
</object>
@@ -1752,7 +1777,7 @@
17521777
<nil key="NSViewClass"/>
17531778
<nil key="NSUserInterfaceItemIdentifier"/>
17541779
<object class="NSView" key="NSWindowView" id="429942864">
1755-
<reference key="NSNextResponder"/>
1780+
<nil key="NSNextResponder"/>
17561781
<int key="NSvFlags">256</int>
17571782
<array class="NSMutableArray" key="NSSubviews">
17581783
<object class="NSColorWell" id="942030693">
@@ -1763,7 +1788,6 @@
17631788
</set>
17641789
<string key="NSFrame">{{106, 112}, {121, 23}}</string>
17651790
<reference key="NSSuperview" ref="429942864"/>
1766-
<reference key="NSWindow"/>
17671791
<reference key="NSNextKeyView" ref="671540070"/>
17681792
<string key="NSReuseIdentifierKey">_NS:1116</string>
17691793
<bool key="NSEnabled">YES</bool>
@@ -1782,7 +1806,6 @@
17821806
</set>
17831807
<string key="NSFrame">{{106, 81}, {121, 23}}</string>
17841808
<reference key="NSSuperview" ref="429942864"/>
1785-
<reference key="NSWindow"/>
17861809
<reference key="NSNextKeyView" ref="138266908"/>
17871810
<string key="NSReuseIdentifierKey">_NS:1116</string>
17881811
<bool key="NSEnabled">YES</bool>
@@ -1798,7 +1821,6 @@
17981821
<int key="NSvFlags">268</int>
17991822
<string key="NSFrame">{{38, 115}, {63, 17}}</string>
18001823
<reference key="NSSuperview" ref="429942864"/>
1801-
<reference key="NSWindow"/>
18021824
<reference key="NSNextKeyView" ref="942030693"/>
18031825
<string key="NSReuseIdentifierKey">_NS:1535</string>
18041826
<bool key="NSEnabled">YES</bool>
@@ -1819,7 +1841,6 @@
18191841
<int key="NSvFlags">268</int>
18201842
<string key="NSFrame">{{17, 84}, {84, 17}}</string>
18211843
<reference key="NSSuperview" ref="429942864"/>
1822-
<reference key="NSWindow"/>
18231844
<reference key="NSNextKeyView" ref="263303711"/>
18241845
<string key="NSReuseIdentifierKey">_NS:1535</string>
18251846
<bool key="NSEnabled">YES</bool>
@@ -1840,7 +1861,6 @@
18401861
<int key="NSvFlags">268</int>
18411862
<string key="NSFrame">{{50, 52}, {51, 17}}</string>
18421863
<reference key="NSSuperview" ref="429942864"/>
1843-
<reference key="NSWindow"/>
18441864
<reference key="NSNextKeyView" ref="329805967"/>
18451865
<string key="NSReuseIdentifierKey">_NS:1535</string>
18461866
<bool key="NSEnabled">YES</bool>
@@ -1861,7 +1881,6 @@
18611881
<int key="NSvFlags">268</int>
18621882
<string key="NSFrame">{{104, 48}, {125, 21}}</string>
18631883
<reference key="NSSuperview" ref="429942864"/>
1864-
<reference key="NSWindow"/>
18651884
<reference key="NSNextKeyView" ref="997330724"/>
18661885
<string key="NSReuseIdentifierKey">_NS:9</string>
18671886
<bool key="NSEnabled">YES</bool>
@@ -1887,8 +1906,6 @@
18871906
<int key="NSvFlags">268</int>
18881907
<string key="NSFrame">{{170, 18}, {57, 25}}</string>
18891908
<reference key="NSSuperview" ref="429942864"/>
1890-
<reference key="NSWindow"/>
1891-
<reference key="NSNextKeyView"/>
18921909
<string key="NSReuseIdentifierKey">_NS:9</string>
18931910
<bool key="NSEnabled">YES</bool>
18941911
<object class="NSButtonCell" key="NSCell" id="24320232">
@@ -1914,8 +1931,6 @@
19141931
</object>
19151932
</array>
19161933
<string key="NSFrameSize">{247, 155}</string>
1917-
<reference key="NSSuperview"/>
1918-
<reference key="NSWindow"/>
19191934
<reference key="NSNextKeyView" ref="243662052"/>
19201935
<string key="NSReuseIdentifierKey">_NS:21</string>
19211936
</object>
@@ -2622,6 +2637,14 @@
26222637
</object>
26232638
<int key="connectionID">717</int>
26242639
</object>
2640+
<object class="IBConnectionRecord">
2641+
<object class="IBActionConnection" key="connection">
2642+
<string key="label">fitOverlays:</string>
2643+
<reference key="source" ref="976324537"/>
2644+
<reference key="destination" ref="265939853"/>
2645+
</object>
2646+
<int key="connectionID">735</int>
2647+
</object>
26252648
<object class="IBConnectionRecord">
26262649
<object class="IBBindingConnection" key="connection">
26272650
<string key="label">value: self.mapView.zoomLevel</string>
@@ -3326,6 +3349,7 @@
33263349
<reference ref="241647912"/>
33273350
<reference ref="264987841"/>
33283351
<reference ref="139919514"/>
3352+
<reference ref="265939853"/>
33293353
</array>
33303354
<reference key="parent" ref="972006081"/>
33313355
</object>
@@ -4069,6 +4093,19 @@
40694093
<reference key="object" ref="24320232"/>
40704094
<reference key="parent" ref="997330724"/>
40714095
</object>
4096+
<object class="IBObjectRecord">
4097+
<int key="objectID">733</int>
4098+
<reference key="object" ref="265939853"/>
4099+
<array class="NSMutableArray" key="children">
4100+
<reference ref="618793319"/>
4101+
</array>
4102+
<reference key="parent" ref="439893737"/>
4103+
</object>
4104+
<object class="IBObjectRecord">
4105+
<int key="objectID">734</int>
4106+
<reference key="object" ref="618793319"/>
4107+
<reference key="parent" ref="265939853"/>
4108+
</object>
40724109
</array>
40734110
</object>
40744111
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -4267,6 +4304,8 @@
42674304
<string key="723.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
42684305
<string key="724.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
42694306
<string key="73.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
4307+
<string key="733.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
4308+
<string key="734.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
42704309
<string key="74.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
42714310
<string key="75.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
42724311
<string key="77.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -4281,13 +4320,24 @@
42814320
<nil key="activeLocalization"/>
42824321
<dictionary class="NSMutableDictionary" key="localizations"/>
42834322
<nil key="sourceID"/>
4284-
<int key="maxID">732</int>
4323+
<int key="maxID">735</int>
42854324
</object>
42864325
<object class="IBClassDescriber" key="IBDocument.Classes">
42874326
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
42884327
<object class="IBPartialClassDescription">
42894328
<string key="className">GNAppDelegate</string>
42904329
<string key="superclassName">NSObject</string>
4330+
<object class="NSMutableDictionary" key="actions">
4331+
<string key="NS.key.0">fitOverlays:</string>
4332+
<string key="NS.object.0">id</string>
4333+
</object>
4334+
<object class="NSMutableDictionary" key="actionInfosByName">
4335+
<string key="NS.key.0">fitOverlays:</string>
4336+
<object class="IBActionInfo" key="NS.object.0">
4337+
<string key="name">fitOverlays:</string>
4338+
<string key="candidateClassName">id</string>
4339+
</object>
4340+
</object>
42914341
<dictionary class="NSMutableDictionary" key="outlets">
42924342
<string key="inspectorPanel">NSPanel</string>
42934343
<string key="window">NSWindow</string>

GMap.xcodeproj/project.pbxproj

+17-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
361CDF431643223C009BF877 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 361CDF421643223C009BF877 /* libsqlite3.dylib */; };
1110
363AE2CD16342C4800970D21 /* GMTile.h in Headers */ = {isa = PBXBuildFile; fileRef = 363AE2CB16342C4800970D21 /* GMTile.h */; };
1211
363AE2CE16342C4800970D21 /* GMTile.m in Sources */ = {isa = PBXBuildFile; fileRef = 363AE2CC16342C4800970D21 /* GMTile.m */; };
1312
3660FBEC1641CEC300C9CFF7 /* GMOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 3660FBEA1641CEC300C9CFF7 /* GMOverlay.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -33,7 +32,6 @@
3332
/* End PBXBuildFile section */
3433

3534
/* Begin PBXFileReference section */
36-
361CDF421643223C009BF877 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; };
3735
363AE2CB16342C4800970D21 /* GMTile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GMTile.h; sourceTree = "<group>"; };
3836
363AE2CC16342C4800970D21 /* GMTile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GMTile.m; sourceTree = "<group>"; };
3937
3660FBEA1641CEC300C9CFF7 /* GMOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GMOverlay.h; sourceTree = "<group>"; };
@@ -50,7 +48,6 @@
5048
36D689EC162D8EDD0072667D /* GMap.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GMap.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5149
36D689EF162D8EDD0072667D /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
5250
36D689F2162D8EDD0072667D /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
53-
36D689F3162D8EDD0072667D /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
5451
36D689F4162D8EDD0072667D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
5552
36D689F7162D8EDD0072667D /* GMap-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GMap-Info.plist"; sourceTree = "<group>"; };
5653
36D689F9162D8EDD0072667D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
@@ -73,7 +70,6 @@
7370
36D68A58162E0C930072667D /* QuartzCore.framework in Frameworks */,
7471
36D68A5A162E10F30072667D /* Quartz.framework in Frameworks */,
7572
3675CE5516414E2A00ECBAB7 /* libcurl.dylib in Frameworks */,
76-
361CDF431643223C009BF877 /* libsqlite3.dylib in Frameworks */,
7773
);
7874
runOnlyForDeploymentPostprocessing = 0;
7975
};
@@ -126,7 +122,6 @@
126122
36D689EE162D8EDD0072667D /* Frameworks */ = {
127123
isa = PBXGroup;
128124
children = (
129-
361CDF421643223C009BF877 /* libsqlite3.dylib */,
130125
3675CE5416414E2A00ECBAB7 /* libcurl.dylib */,
131126
36D68A59162E10F30072667D /* Quartz.framework */,
132127
36D68A57162E0C930072667D /* QuartzCore.framework */,
@@ -140,7 +135,6 @@
140135
isa = PBXGroup;
141136
children = (
142137
36D689F2162D8EDD0072667D /* AppKit.framework */,
143-
36D689F3162D8EDD0072667D /* CoreData.framework */,
144138
36D689F4162D8EDD0072667D /* Foundation.framework */,
145139
);
146140
name = "Other Frameworks";
@@ -197,6 +191,7 @@
197191
isa = PBXNativeTarget;
198192
buildConfigurationList = 36D68A01162D8EDD0072667D /* Build configuration list for PBXNativeTarget "GMap" */;
199193
buildPhases = (
194+
3676CD3D1690D6FA0041E0A1 /* ShellScript */,
200195
36D689E7162D8EDD0072667D /* Sources */,
201196
36D689E8162D8EDD0072667D /* Frameworks */,
202197
36D689E9162D8EDD0072667D /* Headers */,
@@ -248,6 +243,22 @@
248243
};
249244
/* End PBXResourcesBuildPhase section */
250245

246+
/* Begin PBXShellScriptBuildPhase section */
247+
3676CD3D1690D6FA0041E0A1 /* ShellScript */ = {
248+
isa = PBXShellScriptBuildPhase;
249+
buildActionMask = 2147483647;
250+
files = (
251+
);
252+
inputPaths = (
253+
);
254+
outputPaths = (
255+
);
256+
runOnlyForDeploymentPostprocessing = 0;
257+
shellPath = /bin/sh;
258+
shellScript = "#!/bin/bash\n\n# This script automatically sets the version and short version string of\n# an Xcode project from the Git repository containing the project.\n#\n# To use this script in Xcode 4, add the contents to a \"Run Script\" build\n# phase for your application target.\n\nset -o errexit\nset -o nounset\n\nINFO_PLIST=\"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Info\"\nGIT_DIR=\"${PROJECT_DIR}/.git\"\n\n# Get git tag and hash in the FulLVersion\nFULL_VERSION=$(git --git-dir=\"${GIT_DIR}\" --work-tree=\"${PROJECT_DIR}/\" describe --dirty | sed -e 's/^v//' -e 's/g//')\n\n# Use the latest tag for short version (You'll have to make sure that all your tags are of the format 0.0.0,\n# this is to satisfy Apple's rule that short version be three integers separated by dots)\nSHORT_VERSION=$(git --git-dir=\"${GIT_DIR}\" --work-tree=\"${PROJECT_DIR}/\" describe --abbrev=0)\n\n# I'd like to use the Git commit hash for CFBundleVersion.\n# VERSION=$(git --git-dir=\"${PROJECT_DIR}/.git\" --work-tree=\"${PROJECT_DIR}\" rev-parse --short HEAD)\n\n# But Apple wants this value to be a monotonically increasing integer, so\n# instead use the number of commits on the master branch. If you like to\n# play fast and loose with your Git history, this may cause you problems.\n# Thanks to @amrox for pointing out the issue and fix.\nVERSION=$(git --git-dir=\"${GIT_DIR}\" --work-tree=\"${PROJECT_DIR}/\" rev-list master | wc -l)\n\ndefaults write \"$INFO_PLIST\" CFBundleShortVersionString $SHORT_VERSION\ndefaults write \"$INFO_PLIST\" CFBundleVersion $VERSION\ndefaults write \"$INFO_PLIST\" FullVersion $FULL_VERSION\n\necho \"${INFO_PLIST}\"\necho \"VERSION: ${VERSION}\"\necho \"SHORT VERSION: ${SHORT_VERSION}\"\necho \"FULL VERSION: ${FULL_VERSION}\"";
259+
};
260+
/* End PBXShellScriptBuildPhase section */
261+
251262
/* Begin PBXSourcesBuildPhase section */
252263
36D689E7162D8EDD0072667D /* Sources */ = {
253264
isa = PBXSourcesBuildPhase;

GMap/GMCoordinate.h

+25-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
#define GM_INLINE NS_INLINE
55
#endif
66

7+
#ifndef GM_EXTERN
8+
#define GM_EXTERN extern
9+
#endif
10+
711
static const double kTileSize = 256.0; // in pixel
812
static const double kEquatorLength = 40075016.686; // in meters
913

@@ -15,6 +19,8 @@ typedef struct
1519
GMFloat y;
1620
} GMMapPoint;
1721

22+
GM_EXTERN GMMapPoint GMMapPointZero;
23+
1824
GM_INLINE GMMapPoint GMMapPointMake(GMFloat x, GMFloat y)
1925
{
2026
GMMapPoint pt;
@@ -44,6 +50,8 @@ typedef struct
4450
GMMapPoint bottomRight;
4551
} GMMapBounds;
4652

53+
GM_EXTERN GMMapBounds GMMapBoundsZero;
54+
4755
GM_INLINE GMMapBounds GMMapBoundsMake(GMFloat topLeftX, GMFloat topLeftY, GMFloat bottomRightX, GMFloat bottomRightY)
4856
{
4957
GMMapBounds bounds;
@@ -95,11 +103,15 @@ GM_INLINE GMMapBounds GMMapBoundsAddMapPoint(GMMapBounds bounds, GMMapPoint pt)
95103
return bounds;
96104
}
97105

98-
GM_INLINE GMMapBounds GMMapBoundsAddMapBounds(GMMapBounds bounds1, GMMapBounds bounds2)
106+
GM_INLINE GMMapBounds GMMapBoundsAddMapBounds(GMMapBounds bounds, GMMapBounds boundsToAdd)
99107
{
100-
NSRect rect = NSUnionRect(NSRectFromMapBounds(bounds1), NSRectFromMapBounds(bounds2));
108+
bounds.topLeft.x = MIN(bounds.topLeft.x, boundsToAdd.topLeft.x);
109+
bounds.topLeft.y = MIN(bounds.topLeft.y, boundsToAdd.topLeft.y);
101110

102-
return GMMapBoundsFromNSRect(rect);
111+
bounds.bottomRight.x = MAX(bounds.bottomRight.x, boundsToAdd.bottomRight.x);
112+
bounds.bottomRight.y = MAX(bounds.bottomRight.y, boundsToAdd.bottomRight.y);
113+
114+
return bounds;
103115
}
104116

105117
GM_INLINE BOOL GMMapBoundsContainsMapPoint(GMMapBounds bounds, GMMapPoint pt)
@@ -126,6 +138,16 @@ GM_INLINE GMFloat GMMapBoundsSemiPerimeter(GMMapBounds bounds)
126138
return bounds.bottomRight.x - bounds.topLeft.x + bounds.bottomRight.y - bounds.topLeft.y;
127139
}
128140

141+
GM_INLINE GMMapPoint GMMapBoundsCenterPoint(GMMapBounds bounds)
142+
{
143+
return GMMapPointMake(bounds.topLeft.x + (bounds.bottomRight.x - bounds.topLeft.x) / 2.0, bounds.topLeft.y + (bounds.bottomRight.y - bounds.topLeft.y) / 2.0);
144+
}
145+
146+
GM_INLINE GMFloat GMMapBoundsArea(GMMapBounds bounds)
147+
{
148+
return (bounds.bottomRight.x - bounds.topLeft.x) * (bounds.bottomRight.y - bounds.topLeft.y);
149+
}
150+
129151
@interface NSValue (GMMapBounds)
130152

131153
- (GMMapBounds)mapBoundsValue;

GMap/GMCoordinate.m

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#import "GMCoordinate.h"
22

3+
GMMapPoint GMMapPointZero = (GMMapPoint){0, 0};
4+
GMMapBounds GMMapBoundsZero = (GMMapBounds){{0, 0}, {0, 0}};
35

46
@implementation NSValue (GMMapPoint)
57

0 commit comments

Comments
 (0)