├── .gitignore ├── .gitmodules ├── CHANGELOG.md ├── CONTRIBUTING.md ├── License.txt ├── MapView ├── Map │ ├── Mapbox.h │ ├── RMAbstractMercatorTileSource.h │ ├── RMAbstractMercatorTileSource.m │ ├── RMAbstractWebMapSource.h │ ├── RMAbstractWebMapSource.m │ ├── RMAnnotation.h │ ├── RMAnnotation.m │ ├── RMAttributionViewController.h │ ├── RMAttributionViewController.m │ ├── RMBingSource.h │ ├── RMBingSource.m │ ├── RMCacheObject.h │ ├── RMCacheObject.m │ ├── RMCircle.h │ ├── RMCircle.m │ ├── RMCircleAnnotation.h │ ├── RMCircleAnnotation.m │ ├── RMCompositeSource.h │ ├── RMCompositeSource.m │ ├── RMConfiguration.h │ ├── RMConfiguration.m │ ├── RMCoordinateGridSource.h │ ├── RMCoordinateGridSource.m │ ├── RMDBMapSource.h │ ├── RMDBMapSource.m │ ├── RMDatabaseCache.h │ ├── RMDatabaseCache.m │ ├── RMFoundation.c │ ├── RMFoundation.h │ ├── RMFractalTileProjection.h │ ├── RMFractalTileProjection.m │ ├── RMGenericMapSource.h │ ├── RMGenericMapSource.m │ ├── RMGlobalConstants.h │ ├── RMGreatCircleAnnotation.h │ ├── RMGreatCircleAnnotation.m │ ├── RMInteractiveSource.h │ ├── RMInteractiveSource.m │ ├── RMLoadingTileView.h │ ├── RMLoadingTileView.m │ ├── RMMBTilesSource.h │ ├── RMMBTilesSource.m │ ├── RMMapLayer.h │ ├── RMMapLayer.m │ ├── RMMapOverlayView.h │ ├── RMMapOverlayView.m │ ├── RMMapQuestOSMSource.h │ ├── RMMapQuestOSMSource.m │ ├── RMMapQuestOpenAerialSource.h │ ├── RMMapQuestOpenAerialSource.m │ ├── RMMapScrollView.h │ ├── RMMapScrollView.m │ ├── RMMapTiledLayerView.h │ ├── RMMapTiledLayerView.m │ ├── RMMapView.h │ ├── RMMapView.m │ ├── RMMapViewDelegate.h │ ├── RMMapboxSource.h │ ├── RMMapboxSource.m │ ├── RMMarker.h │ ├── RMMarker.m │ ├── RMMemoryCache.h │ ├── RMMemoryCache.m │ ├── RMNotifications.h │ ├── RMOpenCycleMapSource.h │ ├── RMOpenCycleMapSource.m │ ├── RMOpenSeaMapLayer.h │ ├── RMOpenSeaMapLayer.m │ ├── RMOpenSeaMapSource.h │ ├── RMOpenSeaMapSource.m │ ├── RMOpenStreetMapSource.h │ ├── RMOpenStreetMapSource.m │ ├── RMPixel.c │ ├── RMPixel.h │ ├── RMPointAnnotation.h │ ├── RMPointAnnotation.m │ ├── RMPolygonAnnotation.h │ ├── RMPolygonAnnotation.m │ ├── RMPolylineAnnotation.h │ ├── RMPolylineAnnotation.m │ ├── RMProjection.h │ ├── RMProjection.m │ ├── RMQuadTree.h │ ├── RMQuadTree.m │ ├── RMShape.h │ ├── RMShape.m │ ├── RMShapeAnnotation.h │ ├── RMShapeAnnotation.m │ ├── RMStaticMapView.h │ ├── RMStaticMapView.m │ ├── RMTile.c │ ├── RMTile.h │ ├── RMTileCache.h │ ├── RMTileCache.m │ ├── RMTileCacheDownloadOperation.h │ ├── RMTileCacheDownloadOperation.m │ ├── RMTileImage.h │ ├── RMTileImage.m │ ├── RMTileMillSource.h │ ├── RMTileMillSource.m │ ├── RMTileSource.h │ ├── RMTileSourcesContainer.h │ ├── RMTileSourcesContainer.m │ ├── RMUserLocation.h │ ├── RMUserLocation.m │ ├── RMUserTrackingBarButtonItem.h │ ├── RMUserTrackingBarButtonItem.m │ └── Resources │ │ ├── Compass.png │ │ ├── Compass@2x.png │ │ ├── HeadingAngleLarge.png │ │ ├── HeadingAngleLarge@2x.png │ │ ├── HeadingAngleMaskLarge.png │ │ ├── HeadingAngleMaskLarge@2x.png │ │ ├── HeadingAngleMaskMedium.png │ │ ├── HeadingAngleMaskMedium@2x.png │ │ ├── HeadingAngleMaskSmall.png │ │ ├── HeadingAngleMaskSmall@2x.png │ │ ├── HeadingAngleMedium.png │ │ ├── HeadingAngleMedium@2x.png │ │ ├── HeadingAngleSmall.png │ │ ├── HeadingAngleSmall@2x.png │ │ ├── LoadingTile.png │ │ ├── LoadingTile6.png │ │ ├── TrackingDot.png │ │ ├── TrackingDot@2x.png │ │ ├── TrackingDotHalo.png │ │ ├── TrackingDotHalo@2x.png │ │ ├── TrackingHeading.png │ │ ├── TrackingHeading@2x.png │ │ ├── TrackingHeadingMask.png │ │ ├── TrackingHeadingMask@2x.png │ │ ├── TrackingHeadingMaskLandscape@2x.png │ │ ├── TrackingLocation.png │ │ ├── TrackingLocation@2x.png │ │ ├── TrackingLocationMask.png │ │ ├── TrackingLocationMask@2x.png │ │ ├── TrackingLocationMaskLandscape@2x.png │ │ ├── TrackingLocationOffMask.png │ │ ├── TrackingLocationOffMask@2x.png │ │ ├── TrackingLocationOffMaskLandscape@2x.png │ │ ├── mapbox-logo.png │ │ ├── mapbox-logo@2x.png │ │ ├── mapbox.png │ │ └── mapbox@2x.png ├── MapView.xcodeproj │ └── project.pbxproj └── MapView_Prefix.pch ├── Mapbox-iOS-SDK.podspec ├── PULL_REQUEST_TEMPLATE.md ├── Proj4 ├── Makefile ├── Makefile.am ├── Makefile.in ├── PJ_aea.c ├── PJ_aeqd.c ├── PJ_airy.c ├── PJ_aitoff.c ├── PJ_august.c ├── PJ_bacon.c ├── PJ_bipc.c ├── PJ_boggs.c ├── PJ_bonne.c ├── PJ_cass.c ├── PJ_cc.c ├── PJ_cea.c ├── PJ_chamb.c ├── PJ_collg.c ├── PJ_crast.c ├── PJ_denoy.c ├── PJ_eck1.c ├── PJ_eck2.c ├── PJ_eck3.c ├── PJ_eck4.c ├── PJ_eck5.c ├── PJ_eqc.c ├── PJ_eqdc.c ├── PJ_fahey.c ├── PJ_fouc_s.c ├── PJ_gall.c ├── PJ_geos.c ├── PJ_gins8.c ├── PJ_gn_sinu.c ├── PJ_gnom.c ├── PJ_goode.c ├── PJ_gstmerc.c ├── PJ_hammer.c ├── PJ_hatano.c ├── PJ_imw_p.c ├── PJ_krovak.c ├── PJ_labrd.c ├── PJ_laea.c ├── PJ_lagrng.c ├── PJ_larr.c ├── PJ_lask.c ├── PJ_lcc.c ├── PJ_lcca.c ├── PJ_loxim.c ├── PJ_lsat.c ├── PJ_mbt_fps.c ├── PJ_mbtfpp.c ├── PJ_mbtfpq.c ├── PJ_merc.c ├── PJ_mill.c ├── PJ_mod_ster.c ├── PJ_moll.c ├── PJ_nell.c ├── PJ_nell_h.c ├── PJ_nocol.c ├── PJ_nsper.c ├── PJ_nzmg.c ├── PJ_ob_tran.c ├── PJ_ocea.c ├── PJ_oea.c ├── PJ_omerc.c ├── PJ_ortho.c ├── PJ_poly.c ├── PJ_putp2.c ├── PJ_putp3.c ├── PJ_putp4p.c ├── PJ_putp5.c ├── PJ_putp6.c ├── PJ_robin.c ├── PJ_rpoly.c ├── PJ_sconics.c ├── PJ_somerc.c ├── PJ_stere.c ├── PJ_sterea.c ├── PJ_sts.c ├── PJ_tcc.c ├── PJ_tcea.c ├── PJ_tmerc.c ├── PJ_tpeqd.c ├── PJ_urm5.c ├── PJ_urmfps.c ├── PJ_vandg.c ├── PJ_vandg2.c ├── PJ_vandg4.c ├── PJ_wag2.c ├── PJ_wag3.c ├── PJ_wag7.c ├── PJ_wink1.c ├── PJ_wink2.c ├── Proj4.xcodeproj │ ├── TemplateIcon.icns │ └── project.pbxproj ├── Proj4_Prefix.pch ├── aasincos.c ├── adjlon.c ├── bch2bps.c ├── bchgen.c ├── biveval.c ├── cs2cs.c ├── dmstor.c ├── emess.c ├── emess.h ├── gen_cheb.c ├── geocent.c ├── geocent.h ├── geod.c ├── geod_for.c ├── geod_inv.c ├── geod_set.c ├── geodesic.h ├── jniproj.c ├── libProj4.a ├── makefile.vc ├── mk_cheby.c ├── nad2bin.c ├── nad2nad.c ├── nad_cvt.c ├── nad_init.c ├── nad_intr.c ├── nad_list.h ├── org_proj4_Projections.h ├── p_series.c ├── pj_apply_gridshift.c ├── pj_auth.c ├── pj_datum_set.c ├── pj_datums.c ├── pj_deriv.c ├── pj_ell_set.c ├── pj_ellps.c ├── pj_errno.c ├── pj_factors.c ├── pj_fwd.c ├── pj_gauss.c ├── pj_geocent.c ├── pj_gridinfo.c ├── pj_gridlist.c ├── pj_init.c ├── pj_initcache.c ├── pj_inv.c ├── pj_latlong.c ├── pj_list.c ├── pj_list.h ├── pj_malloc.c ├── pj_mlfn.c ├── pj_msfn.c ├── pj_mutex.c ├── pj_open_lib.c ├── pj_param.c ├── pj_phi2.c ├── pj_pr_list.c ├── pj_qsfn.c ├── pj_release.c ├── pj_strerrno.c ├── pj_transform.c ├── pj_tsfn.c ├── pj_units.c ├── pj_utils.c ├── pj_zpoly1.c ├── proj.c ├── proj.def ├── proj_api.h ├── proj_config.h ├── proj_config.h.in ├── proj_mdist.c ├── proj_rouss.c ├── projects.h ├── rtodms.c └── vector1.c ├── README-old.markdown ├── README.markdown ├── install_docs.sh └── remove_docs.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | build 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | *.xcworkspace 12 | !default.xcworkspace 13 | xcuserdata 14 | profile 15 | *.moved-aside 16 | 17 | # OS X 18 | .DS_Store 19 | Icon? 20 | 21 | # Thumbnails 22 | ._* 23 | 24 | # Files that might appear on external disk 25 | .Spotlight-V100 26 | .Trashes 27 | 28 | # Project-specific ignores 29 | Docs 30 | CocoaPods 31 | _site 32 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "MapView/Map/FMDB"] 2 | path = MapView/Map/FMDB 3 | url = https://github.com/ccgus/fmdb.git 4 | [submodule "MapView/Map/GRMustache"] 5 | path = MapView/Map/GRMustache 6 | url = https://github.com/groue/GRMustache.git 7 | [submodule "MapView/Map/SMCalloutView"] 8 | path = MapView/Map/SMCalloutView 9 | url = https://github.com/nfarina/calloutview.git 10 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | CONTRIBUTING 2 | ------------ 3 | 4 | **Please note that this legacy tree of the Mapbox iOS SDK is deprecated. As such, this project is not under active development. The `2.0.0` and above tree, based on code located at https://github.com/mapbox/mapbox-gl-native/, is a complete rewrite based on OpenGL ES and vector map rendering.** 5 | 6 | If you have a usage question, please email help-at-mapbox.com. 7 | -------------------------------------------------------------------------------- /MapView/Map/Mapbox.h: -------------------------------------------------------------------------------- 1 | // 2 | // Mapbox.h 3 | // 4 | // Copyright (c) 2008-2013, Mapbox & Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // The list of header files for more convenient Route-Me import to projects. 29 | // (in alphabetic order) 30 | 31 | #import "RMAnnotation.h" 32 | #import "RMCacheObject.h" 33 | #import "RMCircle.h" 34 | #import "RMCircleAnnotation.h" 35 | #import "RMCompositeSource.h" 36 | #import "RMConfiguration.h" 37 | #import "RMCoordinateGridSource.h" 38 | #import "RMDatabaseCache.h" 39 | #import "RMGreatCircleAnnotation.h" 40 | #import "RMInteractiveSource.h" 41 | #import "RMMBTilesSource.h" 42 | #import "RMMapboxSource.h" 43 | #import "RMMapView.h" 44 | #import "RMMapViewDelegate.h" 45 | #import "RMMarker.h" 46 | #import "RMMemoryCache.h" 47 | #import "RMPointAnnotation.h" 48 | #import "RMPolygonAnnotation.h" 49 | #import "RMPolylineAnnotation.h" 50 | #import "RMShape.h" 51 | #import "RMStaticMapView.h" 52 | #import "RMTileCache.h" 53 | #import "RMTileMillSource.h" 54 | #import "RMUserLocation.h" 55 | #import "RMUserTrackingBarButtonItem.h" 56 | -------------------------------------------------------------------------------- /MapView/Map/RMAbstractMercatorTileSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMAbstractMercatorTileSource.h 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #import "RMTileSource.h" 29 | #import "RMFractalTileProjection.h" 30 | 31 | #pragma mark --- begin constants --- 32 | 33 | #define kDefaultTileSize 256 34 | #define kDefaultMinTileZoom 0 35 | #define kDefaultMaxTileZoom 18 36 | #define kDefaultLatLonBoundingBox ((RMSphericalTrapezium){.northEast = {.latitude = 90.0, .longitude = 180.0}, .southWest = {.latitude = -90.0, .longitude = -180.0}}) 37 | 38 | #pragma mark --- end constants --- 39 | 40 | /** Abstract class representing a Mercator projection for the display of map tiles. Developers wanting to provide custom network-based tiles should subclass RMAbstractWebMapSource. */ 41 | @interface RMAbstractMercatorTileSource : NSObject 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /MapView/Map/RMAttributionViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMAttributionViewController.h 3 | // MapView 4 | // 5 | // Created by Justin Miller on 6/19/12. 6 | // Copyright (c) 2012-2013 Mapbox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RMMapView; 12 | 13 | @interface RMAttributionViewController : UIViewController 14 | 15 | - (id)initWithMapView:(RMMapView *)mapView; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /MapView/Map/RMBingSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMBingSource.h 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #import "RMAbstractWebMapSource.h" 29 | 30 | typedef enum : NSUInteger { 31 | RMBingImagerySetRoad = 0, // default 32 | RMBingImagerySetAerial = 1, 33 | RMBingImagerySetAerialWithLabels = 2, 34 | } RMBingImagerySet; 35 | 36 | @interface RMBingSource : RMAbstractWebMapSource 37 | 38 | - (id)initWithMapsKey:(NSString *)mapsKey; 39 | - (id)initWithMapsKey:(NSString *)mapsKey forImagerySet:(RMBingImagerySet)imagerySet; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /MapView/Map/RMCompositeSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMCompositeSource.h 3 | // MapView 4 | // 5 | // Copyright (c) 2008-2013, Route-Me Contributors 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are met: 10 | // 11 | // * Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above copyright notice, 14 | // this list of conditions and the following disclaimer in the documentation 15 | // and/or other materials provided with the distribution. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | // POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #import "RMAbstractMercatorTileSource.h" 30 | 31 | /** RMCompositeSource combines two or more other tile sources, compositing them into a single image per tile and caching that composited result to the tile cache. 32 | * 33 | * RMCompositeSource can have better performance for instances of fully opaque tiles that are layered above other tiles in the tile source stacking order. It will determine if a tile is opaque and stop iteration of tile sources below it early as a result, since they would be obscured anyway. */ 34 | @interface RMCompositeSource : RMAbstractMercatorTileSource 35 | 36 | /** @name Creating Tile Sources */ 37 | 38 | /** Initialize a compositing tile source. 39 | * 40 | * @param tileSources An array of tile sources to be composited. 41 | * @param tileCacheKey A tile cache key for storage of composited result tiles. 42 | * @return An initialized compositing tile source. */ 43 | - (id)initWithTileSources:(NSArray *)tileSources tileCacheKey:(NSString *)tileCacheKey; 44 | 45 | /** @name Querying Tile Source Information */ 46 | 47 | /** An array of tile sources being composited. */ 48 | @property (nonatomic, weak, readonly) NSArray *tileSources; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /MapView/Map/RMCoordinateGridSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMCoordinateGridSource.h 3 | // MapView 4 | // 5 | // Copyright (c) 2008-2013, Route-Me Contributors 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are met: 10 | // 11 | // * Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above copyright notice, 14 | // this list of conditions and the following disclaimer in the documentation 15 | // and/or other materials provided with the distribution. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | // POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #import "RMAbstractMercatorTileSource.h" 30 | #import "RMProjection.h" 31 | 32 | typedef enum : short { 33 | GridModeGeographic, // 47˚ 33' 34 | GridModeGeographicDecimal, // 47.56 35 | GridModeUTM // 32T 5910 36 | } CoordinateGridMode; 37 | 38 | // UTM grid is missing for now 39 | 40 | @interface RMCoordinateGridSource : RMAbstractMercatorTileSource 41 | 42 | @property (nonatomic, assign) CoordinateGridMode gridMode; 43 | 44 | @property (nonatomic, strong) UIColor *gridColor; 45 | @property (nonatomic, assign) CGFloat gridLineWidth; 46 | @property (nonatomic, assign) NSUInteger gridLabelInterval; 47 | 48 | @property (nonatomic, strong) UIColor *minorLabelColor; 49 | @property (nonatomic, strong) UIFont *minorLabelFont; 50 | @property (nonatomic, strong) UIColor *majorLabelColor; 51 | @property (nonatomic, strong) UIFont *majorLabelFont; 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /MapView/Map/RMDBMapSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMDBMapSource.h 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #import "RMAbstractMercatorTileSource.h" 29 | #import "RMProjection.h" 30 | 31 | @interface RMDBMapSource : RMAbstractMercatorTileSource 32 | 33 | - (id)initWithPath:(NSString *)path; 34 | 35 | - (CLLocationCoordinate2D)topLeftOfCoverage; 36 | - (CLLocationCoordinate2D)bottomRightOfCoverage; 37 | - (CLLocationCoordinate2D)centerOfCoverage; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /MapView/Map/RMGenericMapSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMGenericMapSource.h 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #import "RMAbstractWebMapSource.h" 29 | 30 | @interface RMGenericMapSource : RMAbstractWebMapSource 31 | 32 | - (id)initWithHost:(NSString *)host tileCacheKey:(NSString *)tileCacheKey minZoom:(float)minZoom maxZoom:(float)maxZoom; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /MapView/Map/RMGlobalConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMGlobalConstants.h 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef _GLOBAL_CONSTANTS_H_ 29 | #define _GLOBAL_CONSTANTS_H_ 30 | 31 | #define kMaxLong 180.0 32 | #define kMaxLat 90.0 33 | 34 | static const double kRMMinLatitude = -kMaxLat; 35 | static const double kRMMaxLatitude = kMaxLat; 36 | static const double kRMMinLongitude = -kMaxLong; 37 | static const double kRMMaxLongitude = kMaxLong; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /MapView/Map/RMLoadingTileView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMTileLoadingView.h 3 | // MapView 4 | // 5 | // Copyright (c) 2008-2013, Route-Me Contributors 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are met: 10 | // 11 | // * Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above copyright notice, 14 | // this list of conditions and the following disclaimer in the documentation 15 | // and/or other materials provided with the distribution. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | // POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #import 30 | 31 | @interface RMLoadingTileView : UIScrollView 32 | 33 | @property (nonatomic, assign) BOOL mapZooming; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /MapView/Map/RMMapOverlayView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMMapOverlayView.h 3 | // MapView 4 | // 5 | // Copyright (c) 2008-2013, Route-Me Contributors 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are met: 10 | // 11 | // * Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above copyright notice, 14 | // this list of conditions and the following disclaimer in the documentation 15 | // and/or other materials provided with the distribution. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | // POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #import 30 | 31 | @class RMAnnotation; 32 | 33 | @interface RMMapOverlayView : UIView 34 | 35 | - (NSUInteger)sublayersCount; 36 | 37 | - (void)addSublayer:(CALayer *)aLayer; 38 | - (void)insertSublayer:(CALayer *)aLayer atIndex:(unsigned)index; 39 | 40 | - (void)insertSublayer:(CALayer *)aLayer below:(CALayer *)sublayer; 41 | - (void)insertSublayer:(CALayer *)aLayer above:(CALayer *)sublayer; 42 | 43 | - (void)moveLayersBy:(CGPoint)delta; 44 | 45 | - (CALayer *)overlayHitTest:(CGPoint)point; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /MapView/Map/RMMapQuestOSMSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMMapQuestOSMSource.h 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // 29 | // !!!!!! 30 | // 31 | // Please note the MapQuest Terms of Use for attribution and limitations before using this tile source: 32 | // http://developer.mapquest.com/web/products/open/map#terms 33 | // 34 | 35 | #import "RMAbstractWebMapSource.h" 36 | 37 | @interface RMMapQuestOSMSource : RMAbstractWebMapSource 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /MapView/Map/RMMapQuestOSMSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // RMMapQuestOSMSource.m 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #import "RMMapQuestOSMSource.h" 29 | 30 | @implementation RMMapQuestOSMSource 31 | 32 | - (id)init 33 | { 34 | if (!(self = [super init])) 35 | return nil; 36 | 37 | self.minZoom = 1; 38 | self.maxZoom = 18; 39 | 40 | return self; 41 | } 42 | 43 | - (NSURL *)URLForTile:(RMTile)tile 44 | { 45 | NSAssert4(((tile.zoom >= self.minZoom) && (tile.zoom <= self.maxZoom)), 46 | @"%@ tried to retrieve tile with zoomLevel %d, outside source's defined range %f to %f", 47 | self, tile.zoom, self.minZoom, self.maxZoom); 48 | 49 | return [NSURL URLWithString:[NSString stringWithFormat:@"http://otile1.mqcdn.com/tiles/1.0.0/osm/%d/%d/%d.png", tile.zoom, tile.x, tile.y]]; 50 | } 51 | 52 | - (NSString *)uniqueTilecacheKey 53 | { 54 | return @"MapQuestOSM"; 55 | } 56 | 57 | - (NSString *)shortName 58 | { 59 | return @"MapQuest"; 60 | } 61 | 62 | - (NSString *)longDescription 63 | { 64 | return @"Map tiles courtesy of MapQuest."; 65 | } 66 | 67 | - (NSString *)shortAttribution 68 | { 69 | return @"Tiles courtesy of MapQuest."; 70 | } 71 | 72 | - (NSString *)longAttribution 73 | { 74 | return @"Tiles courtesy of MapQuest and OpenStreetMap contributors."; 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /MapView/Map/RMMapQuestOpenAerialSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMMapQuestOpenAerialSource.h 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // 29 | // !!!!!! 30 | // 31 | // Please note the MapQuest Terms of Use for attribution and limitations before using this tile source: 32 | // http://developer.mapquest.com/web/products/open/map#terms 33 | // 34 | 35 | #import "RMAbstractWebMapSource.h" 36 | 37 | @interface RMMapQuestOpenAerialSource : RMAbstractWebMapSource 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /MapView/Map/RMMapScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMMapScrollView.h 3 | // MapView 4 | // 5 | // Copyright (c) 2008-2013, Route-Me Contributors 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are met: 10 | // 11 | // * Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above copyright notice, 14 | // this list of conditions and the following disclaimer in the documentation 15 | // and/or other materials provided with the distribution. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | // POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #import 30 | 31 | @class RMMapScrollView; 32 | 33 | @protocol RMMapScrollViewDelegate 34 | 35 | - (void)scrollView:(RMMapScrollView *)aScrollView correctedContentOffset:(inout CGPoint *)aContentOffset; 36 | - (void)scrollView:(RMMapScrollView *)aScrollView correctedContentSize:(inout CGSize *)aContentSize; 37 | 38 | @end 39 | 40 | @interface RMMapScrollView : UIScrollView 41 | 42 | @property (nonatomic, weak) id mapScrollViewDelegate; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /MapView/Map/RMMapTiledLayerView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMMapTiledLayerView.h 3 | // MapView 4 | // 5 | // Copyright (c) 2008-2013, Route-Me Contributors 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are met: 10 | // 11 | // * Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above copyright notice, 14 | // this list of conditions and the following disclaimer in the documentation 15 | // and/or other materials provided with the distribution. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | // POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #import "RMTileSource.h" 30 | 31 | @class RMMapView; 32 | 33 | @interface RMMapTiledLayerView : UIView 34 | 35 | @property (nonatomic, assign) BOOL useSnapshotRenderer; 36 | 37 | @property (nonatomic, readonly) id tileSource; 38 | 39 | - (id)initWithFrame:(CGRect)frame mapView:(RMMapView *)aMapView forTileSource:(id )aTileSource; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /MapView/Map/RMMemoryCache.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMMemoryCache.h 3 | // 4 | // Copyright (c) 2008-2009, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #import 29 | #import "RMTile.h" 30 | #import "RMTileCache.h" 31 | 32 | /** An RMMemoryCache object represents memory-based caching of map tile images. Since memory is constrained in the iOS environment, this cache is relatively small, but useful for increasing performance. */ 33 | @interface RMMemoryCache : NSObject 34 | 35 | /** @name Initializing Memory Caches */ 36 | 37 | /** Initializes and returns a newly allocated memory cache object with the specified tile count capacity. 38 | * @param aCapacity The maximum number of tiles to be held in the cache. 39 | * @return An initialized memory cache object or `nil` if the object couldn't be created. */ 40 | - (id)initWithCapacity:(NSUInteger)aCapacity; 41 | 42 | /** @name Cache Capacity */ 43 | 44 | /** The capacity, in number of tiles, that the memory cache can hold. */ 45 | @property (nonatomic, readonly, assign) NSUInteger capacity; 46 | 47 | /** @name Making Space in the Cache */ 48 | 49 | /** Remove the least-recently used image from the cache if the cache is at or over capacity. This removes a single image from the cache. */ 50 | - (void)makeSpaceInCache; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /MapView/Map/RMNotifications.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMNofications.h 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | static const NSString *RMSuspendNetworkOperations = @"RMSuspendNetworkOperations"; 29 | static const NSString *RMResumeNetworkOperations = @"RMResumeNetworkOperations"; 30 | -------------------------------------------------------------------------------- /MapView/Map/RMOpenCycleMapSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // OpenCycleMapSource.h 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #import "RMAbstractWebMapSource.h" 29 | 30 | @interface RMOpenCycleMapSource : RMAbstractWebMapSource 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /MapView/Map/RMOpenSeaMapLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMOpenSeaMapLayer.h 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #import "RMAbstractWebMapSource.h" 29 | 30 | @interface RMOpenSeaMapLayer : RMAbstractWebMapSource 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /MapView/Map/RMOpenSeaMapSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMOpenSeaMapSource.h 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #import "RMAbstractWebMapSource.h" 29 | 30 | @interface RMOpenSeaMapSource : RMAbstractWebMapSource 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /MapView/Map/RMOpenStreetMapSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // OpenStreetMapsSource.h 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #import "RMAbstractWebMapSource.h" 29 | 30 | @interface RMOpenStreetMapSource : RMAbstractWebMapSource 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /MapView/Map/RMPixel.c: -------------------------------------------------------------------------------- 1 | // 2 | // RMPixel.c 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #include "RMPixel.h" 29 | 30 | CGPoint RMScaleCGPointAboutPoint(CGPoint point, float factor, CGPoint pivot) 31 | { 32 | point.x = (point.x - pivot.x) * factor + pivot.x; 33 | point.y = (point.y - pivot.y) * factor + pivot.y; 34 | 35 | return point; 36 | } 37 | 38 | CGRect RMScaleCGRectAboutPoint(CGRect rect, float factor, CGPoint pivot) 39 | { 40 | rect.origin = RMScaleCGPointAboutPoint(rect.origin, factor, pivot); 41 | rect.size.width *= factor; 42 | rect.size.height *= factor; 43 | 44 | return rect; 45 | } 46 | 47 | CGPoint RMTranslateCGPointBy(CGPoint point, CGSize delta) 48 | { 49 | point.x += delta.width; 50 | point.y += delta.height; 51 | 52 | return point; 53 | } 54 | 55 | CGRect RMTranslateCGRectBy(CGRect rect, CGSize delta) 56 | { 57 | rect.origin = RMTranslateCGPointBy(rect.origin, delta); 58 | 59 | return rect; 60 | } 61 | -------------------------------------------------------------------------------- /MapView/Map/RMPixel.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMPixel.h 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef _RMPIXEL_H_ 29 | #define _RMPIXEL_H_ 30 | 31 | // Pixel coordinates are stored using apple-standard CGRects. 32 | 33 | #include 34 | 35 | CGPoint RMScaleCGPointAboutPoint(CGPoint point, float factor, CGPoint pivot); 36 | CGRect RMScaleCGRectAboutPoint(CGRect rect, float factor, CGPoint pivot); 37 | CGPoint RMTranslateCGPointBy(CGPoint point, CGSize delta); 38 | CGRect RMTranslateCGRectBy(CGRect rect, CGSize delta); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /MapView/Map/RMPointAnnotation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMPointAnnotation.h 3 | // MapView 4 | // 5 | // Copyright (c) 2008-2012, Route-Me Contributors 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are met: 10 | // 11 | // * Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above copyright notice, 14 | // this list of conditions and the following disclaimer in the documentation 15 | // and/or other materials provided with the distribution. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | // POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #import "RMAnnotation.h" 30 | 31 | /** An RMPointAnnotation is used to represent a single point on a map. The annotation will automatically have a layer created when needed that displays an RMMarker with either a default point icon or the supplied image. 32 | * 33 | * If you wish to customize the layer appearance in more detail, you should instead create an RMAnnotation and configure its layer directly. Providing a layer manually for instances of RMPointAnnotation will not have any effect. */ 34 | @interface RMPointAnnotation : RMAnnotation 35 | 36 | /** An image for the annotation's point. */ 37 | @property (nonatomic, strong) UIImage *image; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /MapView/Map/RMPointAnnotation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RMPointAnnotation.m 3 | // MapView 4 | // 5 | // Copyright (c) 2008-2012, Route-Me Contributors 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are met: 10 | // 11 | // * Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above copyright notice, 14 | // this list of conditions and the following disclaimer in the documentation 15 | // and/or other materials provided with the distribution. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | // POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #import "RMPointAnnotation.h" 30 | 31 | #import "RMMarker.h" 32 | #import "RMMapView.h" 33 | 34 | @implementation RMPointAnnotation 35 | 36 | - (void)setLayer:(RMMapLayer *)newLayer 37 | { 38 | if ( ! newLayer) 39 | [super setLayer:nil]; 40 | else 41 | RMLog(@"Setting a custom layer on an %@ is a no-op", [self class]); 42 | } 43 | 44 | - (RMMapLayer *)layer 45 | { 46 | if ( ! [super layer]) 47 | { 48 | RMMarker *marker = [[RMMarker alloc] initWithMapboxMarkerImage:nil tintColor:(RMPostVersion7 ? self.mapView.tintColor : nil)]; 49 | 50 | marker.canShowCallout = YES; 51 | 52 | super.layer = marker; 53 | } 54 | 55 | return [super layer]; 56 | } 57 | 58 | - (void)setImage:(UIImage *)image 59 | { 60 | [(RMMarker *)[self layer] replaceUIImage:image]; 61 | } 62 | 63 | - (UIImage *)image 64 | { 65 | return [UIImage imageWithCGImage:(CGImageRef)[self layer].contents]; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /MapView/Map/RMPolylineAnnotation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMPolylineAnnotation.h 3 | // MapView 4 | // 5 | // Copyright (c) 2008-2012, Route-Me Contributors 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are met: 10 | // 11 | // * Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above copyright notice, 14 | // this list of conditions and the following disclaimer in the documentation 15 | // and/or other materials provided with the distribution. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | // POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #import "RMShapeAnnotation.h" 30 | 31 | /** An RMPolylineAnnotation is a concrete subclass of RMShapeAnnotation that is used to represent a shape consisting of one or more points that define connecting line segments. The points are connected end-to-end in the order they are provided. The first and last points are not connected to each other. The annotation will automatically have a layer created when needed that displays an RMShape. 32 | * 33 | * If you wish to customize the layer appearance in more detail, you should instead create an RMAnnotation and configure its layer directly. Providing a layer manually for instances of RMPolylineAnnotation will not have any effect. */ 34 | @interface RMPolylineAnnotation : RMShapeAnnotation 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /MapView/Map/RMPolylineAnnotation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RMPolylineAnnotation.m 3 | // MapView 4 | // 5 | // Copyright (c) 2008-2012, Route-Me Contributors 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are met: 10 | // 11 | // * Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above copyright notice, 14 | // this list of conditions and the following disclaimer in the documentation 15 | // and/or other materials provided with the distribution. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | // POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #import "RMPolylineAnnotation.h" 30 | 31 | #import "RMShape.h" 32 | 33 | @implementation RMPolylineAnnotation 34 | 35 | - (void)setLayer:(RMMapLayer *)newLayer 36 | { 37 | if ( ! newLayer) 38 | [super setLayer:nil]; 39 | else 40 | RMLog(@"Setting a custom layer on an %@ is a no-op", [self class]); 41 | } 42 | 43 | - (RMMapLayer *)layer 44 | { 45 | if ( ! [super layer]) 46 | { 47 | RMShape *shape = [[RMShape alloc] initWithView:self.mapView]; 48 | 49 | [shape performBatchOperations:^(RMShape *aShape) 50 | { 51 | [aShape moveToCoordinate:self.coordinate]; 52 | 53 | for (CLLocation *point in self.points) 54 | [aShape addLineToCoordinate:point.coordinate]; 55 | }]; 56 | 57 | super.layer = shape; 58 | } 59 | 60 | return [super layer]; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /MapView/Map/RMTile.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMTile.h 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #ifndef _RMTILE_H_ 29 | #define _RMTILE_H_ 30 | 31 | #include 32 | #include 33 | 34 | // Uniquely specifies coordinates and zoom level for a particular tile in some tile source. 35 | typedef struct { 36 | uint32_t x, y; 37 | short zoom; 38 | } RMTile; 39 | 40 | typedef struct { 41 | RMTile tile; 42 | CGPoint offset; 43 | } RMTilePoint; 44 | 45 | typedef struct { 46 | RMTilePoint origin; 47 | CGSize size; 48 | } RMTileRect; 49 | 50 | char RMTilesEqual(RMTile one, RMTile two); 51 | 52 | char RMTileIsDummy(RMTile tile); 53 | RMTile RMTileDummy(); 54 | 55 | RMTile RMTileMake(uint32_t x, uint32_t y, short zoom); 56 | 57 | // Return a hash of the tile, used to override the NSObject hash method for RMTile. 58 | uint64_t RMTileHash(RMTile tile); 59 | 60 | // Returns a unique key of the tile for use in the SQLite cache 61 | uint64_t RMTileKey(RMTile tile); 62 | 63 | // Round the rectangle to whole numbers of tiles 64 | RMTileRect RMTileRectRound(RMTileRect rect); 65 | 66 | // Dump a description of the tile to the console 67 | void RMLogTile(RMTile tile); 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /MapView/Map/RMTileCacheDownloadOperation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMTileCacheDownloadOperation.h 3 | // 4 | // Copyright (c) 2008-2013, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #import 29 | 30 | #import "RMTile.h" 31 | #import "RMTileSource.h" 32 | #import "RMTileCache.h" 33 | 34 | @interface RMTileCacheDownloadOperation : NSOperation 35 | 36 | - (id)initWithTile:(RMTile)tile forTileSource:(id )source usingCache:(RMTileCache *)cache; 37 | 38 | @property (nonatomic, strong) NSError *error; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /MapView/Map/RMTileImage.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMTileImage.h 3 | // 4 | // Copyright (c) 2008-2009, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | @interface RMTileImage : NSObject 29 | 30 | + (UIImage *)errorTile; 31 | + (UIImage *)missingTile; 32 | 33 | + (void)setErrorTile:(UIImage *)newErrorTile; 34 | + (void)setMissingTile:(UIImage *)newMissingTile; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /MapView/Map/RMTileImage.m: -------------------------------------------------------------------------------- 1 | // 2 | // RMTileImage.m 3 | // 4 | // Copyright (c) 2008-2009, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #import "RMTileImage.h" 29 | 30 | static BOOL _didLoadErrorTile = NO; 31 | static BOOL _didLoadMissingTile = NO; 32 | static UIImage *_errorTile = nil; 33 | static UIImage *_missingTile = nil; 34 | 35 | @implementation RMTileImage 36 | 37 | + (UIImage *)errorTile 38 | { 39 | if (_errorTile) 40 | return _errorTile; 41 | 42 | if (_didLoadErrorTile) 43 | return nil; 44 | 45 | _errorTile = [UIImage imageNamed:@"error.png"]; 46 | _didLoadErrorTile = YES; 47 | 48 | return _errorTile; 49 | } 50 | 51 | + (void)setErrorTile:(UIImage *)newErrorTile 52 | { 53 | if (_errorTile == newErrorTile) return; 54 | _errorTile = newErrorTile; 55 | _didLoadErrorTile = YES; 56 | } 57 | 58 | + (UIImage *)missingTile 59 | { 60 | if (_missingTile) 61 | return _missingTile; 62 | 63 | if (_didLoadMissingTile) 64 | return nil; 65 | 66 | _missingTile = [UIImage imageNamed:@"missing.png"]; 67 | _didLoadMissingTile = YES; 68 | 69 | return _missingTile; 70 | } 71 | 72 | + (void)setMissingTile:(UIImage *)newMissingTile 73 | { 74 | if (_missingTile == newMissingTile) return; 75 | _missingTile = newMissingTile; 76 | _didLoadMissingTile = YES; 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /MapView/Map/RMTileMillSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // RMTileMillSource.m 3 | // 4 | // Copyright (c) 2008-2012, Route-Me Contributors 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // * Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | 28 | #import "RMTileMillSource.h" 29 | 30 | @implementation RMTileMillSource 31 | 32 | - (id)initWithMapName:(NSString *)mapName tileCacheKey:(NSString *)tileCacheKey minZoom:(float)minZoom maxZoom:(float)maxZoom 33 | { 34 | return [self initWithHost:@"localhost" mapName:mapName tileCacheKey:tileCacheKey minZoom:minZoom maxZoom:maxZoom]; 35 | } 36 | 37 | - (id)initWithHost:(NSString *)host mapName:(NSString *)mapName tileCacheKey:(NSString *)tileCacheKey minZoom:(float)minZoom maxZoom:(float)maxZoom 38 | { 39 | return [super initWithHost:[NSString stringWithFormat:@"%@:20008/tile/%@", host, mapName] tileCacheKey:tileCacheKey minZoom:minZoom maxZoom:maxZoom]; 40 | } 41 | 42 | - (NSURL *)URLForTile:(RMTile)tile 43 | { 44 | NSURL *tileURL = [super URLForTile:tile]; 45 | 46 | return [NSURL URLWithString:[[tileURL absoluteString] stringByAppendingFormat:@"?updated=%i", (int)[[NSDate date] timeIntervalSince1970]]]; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /MapView/Map/RMUserLocation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMUserLocation.h 3 | // MapView 4 | // 5 | // Copyright (c) 2008-2013, Route-Me Contributors 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are met: 10 | // 11 | // * Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above copyright notice, 14 | // this list of conditions and the following disclaimer in the documentation 15 | // and/or other materials provided with the distribution. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | // POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #import "RMAnnotation.h" 30 | 31 | /** The RMUserLocation class defines a specific type of annotation that identifies the user’s current location. You do not create instances of this class directly. Instead, you retrieve an existing RMUserLocation object from the userLocation property of the map view displayed in your application. */ 32 | @interface RMUserLocation : RMAnnotation 33 | 34 | /** @name Determining the User’s Position */ 35 | 36 | /** A Boolean value indicating whether the user’s location is currently being updated. (read-only) */ 37 | @property (nonatomic, readonly, getter=isUpdating) BOOL updating; 38 | 39 | /** The current location of the device. (read-only) 40 | * 41 | * This property contains `nil` if the map view is not currently showing the user location or if the user’s location has not yet been determined. */ 42 | @property (nonatomic, readonly) CLLocation *location; 43 | 44 | /** The heading of the user location. (read-only) 45 | * 46 | * This property is `nil` if the user location tracking mode is not `RMUserTrackingModeFollowWithHeading`. */ 47 | @property (nonatomic, readonly) CLHeading *heading; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /MapView/Map/RMUserTrackingBarButtonItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMUserTrackingBarButtonItem.h 3 | // MapView 4 | // 5 | // Copyright (c) 2008-2013, Route-Me Contributors 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are met: 10 | // 11 | // * Redistributions of source code must retain the above copyright notice, this 12 | // list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above copyright notice, 14 | // this list of conditions and the following disclaimer in the documentation 15 | // and/or other materials provided with the distribution. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | // POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #import 30 | 31 | @class RMMapView; 32 | 33 | /** An RMUserTrackingBarButtonItem object is a specialized bar button item that allows the user to toggle through the user tracking modes. For example, when the user taps the button, the map view toggles between tracking the user with and without heading. The button also reflects the current user tracking mode if set elsewhere. This bar button item is associated to a single map view. */ 34 | @interface RMUserTrackingBarButtonItem : UIBarButtonItem 35 | 36 | /** @name Initializing */ 37 | 38 | /** Initializes a newly created bar button item with the specified map view. 39 | * @param mapView The map view used by this bar button item. 40 | * @return The initialized bar button item. */ 41 | - (id)initWithMapView:(RMMapView *)mapView; 42 | 43 | /** @name Accessing Properties */ 44 | 45 | /** The map view associated with this bar button item. */ 46 | @property (nonatomic, strong) IBOutlet RMMapView *mapView; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /MapView/Map/Resources/Compass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/Compass.png -------------------------------------------------------------------------------- /MapView/Map/Resources/Compass@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/Compass@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/HeadingAngleLarge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/HeadingAngleLarge.png -------------------------------------------------------------------------------- /MapView/Map/Resources/HeadingAngleLarge@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/HeadingAngleLarge@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/HeadingAngleMaskLarge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/HeadingAngleMaskLarge.png -------------------------------------------------------------------------------- /MapView/Map/Resources/HeadingAngleMaskLarge@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/HeadingAngleMaskLarge@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/HeadingAngleMaskMedium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/HeadingAngleMaskMedium.png -------------------------------------------------------------------------------- /MapView/Map/Resources/HeadingAngleMaskMedium@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/HeadingAngleMaskMedium@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/HeadingAngleMaskSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/HeadingAngleMaskSmall.png -------------------------------------------------------------------------------- /MapView/Map/Resources/HeadingAngleMaskSmall@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/HeadingAngleMaskSmall@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/HeadingAngleMedium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/HeadingAngleMedium.png -------------------------------------------------------------------------------- /MapView/Map/Resources/HeadingAngleMedium@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/HeadingAngleMedium@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/HeadingAngleSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/HeadingAngleSmall.png -------------------------------------------------------------------------------- /MapView/Map/Resources/HeadingAngleSmall@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/HeadingAngleSmall@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/LoadingTile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/LoadingTile.png -------------------------------------------------------------------------------- /MapView/Map/Resources/LoadingTile6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/LoadingTile6.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingDot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingDot.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingDot@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingDot@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingDotHalo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingDotHalo.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingDotHalo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingDotHalo@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingHeading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingHeading.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingHeading@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingHeading@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingHeadingMask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingHeadingMask.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingHeadingMask@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingHeadingMask@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingHeadingMaskLandscape@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingHeadingMaskLandscape@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingLocation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingLocation.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingLocation@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingLocation@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingLocationMask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingLocationMask.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingLocationMask@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingLocationMask@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingLocationMaskLandscape@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingLocationMaskLandscape@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingLocationOffMask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingLocationOffMask.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingLocationOffMask@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingLocationOffMask@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/TrackingLocationOffMaskLandscape@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/TrackingLocationOffMaskLandscape@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/mapbox-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/mapbox-logo.png -------------------------------------------------------------------------------- /MapView/Map/Resources/mapbox-logo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/mapbox-logo@2x.png -------------------------------------------------------------------------------- /MapView/Map/Resources/mapbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/mapbox.png -------------------------------------------------------------------------------- /MapView/Map/Resources/mapbox@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/MapView/Map/Resources/mapbox@2x.png -------------------------------------------------------------------------------- /MapView/MapView_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'MapView' target in the 'MapView' project 3 | // 4 | 5 | #if __OBJC__ 6 | #import 7 | #import 8 | #import 9 | #import 10 | 11 | #import "RMGlobalConstants.h" 12 | #endif 13 | 14 | #if DEBUG 15 | #define RMLog(args...) NSLog(@"%@", [NSString stringWithFormat: args]) 16 | #define LogMethod() NSLog(@"logged method call: -[%@ %@] (line %d)", self, NSStringFromSelector(_cmd), __LINE__) 17 | #define WarnDeprecated() NSLog(@"***** WARNING: deprecated method call: -[%@ %@] (line %d)", self, NSStringFromSelector(_cmd), __LINE__) 18 | #else 19 | // DEBUG not defined: 20 | 21 | #define RMLog(args...) // do nothing. 22 | #define LogMethod() 23 | #define WarnDeprecated() 24 | #define NS_BLOCK_ASSERTIONS 1 25 | #endif 26 | 27 | #define RMPostVersion6 (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_5_1) 28 | #define RMPreVersion6 (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_5_1) 29 | 30 | #define RMPostVersion7 (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) 31 | #define RMPreVersion7 (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) 32 | -------------------------------------------------------------------------------- /PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Thank you kindly for your contribution. However, this repository is DEPRECATED; we will not be making further code changes here and your pull request will not be merged. 2 | 3 | Please refer to https://github.com/mapbox/mapbox-gl-native for current Mapbox iOS SDK development. We would be happy to receive a pull request there. 4 | -------------------------------------------------------------------------------- /Proj4/PJ_august.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | #include 3 | PROJ_HEAD(august, "August Epicycloidal") "\n\tMisc Sph, no inv."; 4 | #define M 1.333333333333333 5 | FORWARD(s_forward); /* spheroid */ 6 | double t, c1, c, x1, x12, y1, y12; 7 | 8 | t = tan(.5 * lp.phi); 9 | c1 = sqrt(1. - t * t); 10 | c = 1. + c1 * cos(lp.lam *= .5); 11 | x1 = sin(lp.lam) * c1 / c; 12 | y1 = t / c; 13 | xy.x = M * x1 * (3. + (x12 = x1 * x1) - 3. * (y12 = y1 * y1)); 14 | xy.y = M * y1 * (3. + 3. * x12 - y12); 15 | return (xy); 16 | } 17 | FREEUP; if (P) pj_dalloc(P); } 18 | ENTRY0(august) P->inv = 0; P->fwd = s_forward; P->es = 0.; ENDENTRY(P) 19 | -------------------------------------------------------------------------------- /Proj4/PJ_bacon.c: -------------------------------------------------------------------------------- 1 | # define HLFPI2 2.46740110027233965467 2 | # define EPS 1e-10 3 | #define PROJ_PARMS__ \ 4 | int bacn; \ 5 | int ortl; 6 | #define PJ_LIB__ 7 | #include 8 | PROJ_HEAD(apian, "Apian Globular I") "\n\tMisc Sph, no inv."; 9 | PROJ_HEAD(ortel, "Ortelius Oval") "\n\tMisc Sph, no inv."; 10 | PROJ_HEAD(bacon, "Bacon Globular") "\n\tMisc Sph, no inv."; 11 | FORWARD(s_forward); /* spheroid */ 12 | double ax, f; 13 | 14 | xy.y = P->bacn ? HALFPI * sin(lp.phi) : lp.phi; 15 | if ((ax = fabs(lp.lam)) >= EPS) { 16 | if (P->ortl && ax >= HALFPI) 17 | xy.x = sqrt(HLFPI2 - lp.phi * lp.phi + EPS) + ax - HALFPI; 18 | else { 19 | f = 0.5 * (HLFPI2 / ax + ax); 20 | xy.x = ax - f + sqrt(f * f - xy.y * xy.y); 21 | } 22 | if (lp.lam < 0.) xy.x = - xy.x; 23 | } else 24 | xy.x = 0.; 25 | return (xy); 26 | } 27 | FREEUP; if (P) pj_dalloc(P); } 28 | ENTRY0(bacon) 29 | P->bacn = 1; 30 | P->ortl = 0; 31 | P->es = 0.; P->fwd = s_forward; 32 | ENDENTRY(P) 33 | ENTRY0(apian) 34 | P->bacn = P->ortl = 0; 35 | P->es = 0.; P->fwd = s_forward; 36 | ENDENTRY(P) 37 | ENTRY0(ortel) 38 | P->bacn = 0; 39 | P->ortl = 1; 40 | P->es = 0.; P->fwd = s_forward; 41 | ENDENTRY(P) 42 | -------------------------------------------------------------------------------- /Proj4/PJ_boggs.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | # include 3 | PROJ_HEAD(boggs, "Boggs Eumorphic") "\n\tPCyl., no inv., Sph."; 4 | # define NITER 20 5 | # define EPS 1e-7 6 | # define ONETOL 1.000001 7 | # define FXC 2.00276 8 | # define FXC2 1.11072 9 | # define FYC 0.49931 10 | # define FYC2 1.41421356237309504880 11 | FORWARD(s_forward); /* spheroid */ 12 | double theta, th1, c; 13 | int i; 14 | 15 | theta = lp.phi; 16 | if (fabs(fabs(lp.phi) - HALFPI) < EPS) 17 | xy.x = 0.; 18 | else { 19 | c = sin(theta) * PI; 20 | for (i = NITER; i; --i) { 21 | theta -= th1 = (theta + sin(theta) - c) / 22 | (1. + cos(theta)); 23 | if (fabs(th1) < EPS) break; 24 | } 25 | theta *= 0.5; 26 | xy.x = FXC * lp.lam / (1. / cos(lp.phi) + FXC2 / cos(theta)); 27 | } 28 | xy.y = FYC * (lp.phi + FYC2 * sin(theta)); 29 | return (xy); 30 | } 31 | FREEUP; if (P) pj_dalloc(P); } 32 | ENTRY0(boggs) P->es = 0.; P->fwd = s_forward; ENDENTRY(P) 33 | -------------------------------------------------------------------------------- /Proj4/PJ_bonne.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double phi1; \ 3 | double cphi1; \ 4 | double am1; \ 5 | double m1; \ 6 | double *en; 7 | #define PJ_LIB__ 8 | #include 9 | PROJ_HEAD(bonne, "Bonne (Werner lat_1=90)") 10 | "\n\tConic Sph&Ell\n\tlat_1="; 11 | #define EPS10 1e-10 12 | FORWARD(e_forward); /* ellipsoid */ 13 | double rh, E, c; 14 | 15 | rh = P->am1 + P->m1 - pj_mlfn(lp.phi, E = sin(lp.phi), c = cos(lp.phi), P->en); 16 | E = c * lp.lam / (rh * sqrt(1. - P->es * E * E)); 17 | xy.x = rh * sin(E); 18 | xy.y = P->am1 - rh * cos(E); 19 | return (xy); 20 | } 21 | FORWARD(s_forward); /* spheroid */ 22 | double E, rh; 23 | 24 | rh = P->cphi1 + P->phi1 - lp.phi; 25 | if (fabs(rh) > EPS10) { 26 | xy.x = rh * sin(E = lp.lam * cos(lp.phi) / rh); 27 | xy.y = P->cphi1 - rh * cos(E); 28 | } else 29 | xy.x = xy.y = 0.; 30 | return (xy); 31 | } 32 | INVERSE(s_inverse); /* spheroid */ 33 | double rh; 34 | 35 | rh = hypot(xy.x, xy.y = P->cphi1 - xy.y); 36 | lp.phi = P->cphi1 + P->phi1 - rh; 37 | if (fabs(lp.phi) > HALFPI) I_ERROR; 38 | if (fabs(fabs(lp.phi) - HALFPI) <= EPS10) 39 | lp.lam = 0.; 40 | else 41 | lp.lam = rh * atan2(xy.x, xy.y) / cos(lp.phi); 42 | return (lp); 43 | } 44 | INVERSE(e_inverse); /* ellipsoid */ 45 | double s, rh; 46 | 47 | rh = hypot(xy.x, xy.y = P->am1 - xy.y); 48 | lp.phi = pj_inv_mlfn(P->am1 + P->m1 - rh, P->es, P->en); 49 | if ((s = fabs(lp.phi)) < HALFPI) { 50 | s = sin(lp.phi); 51 | lp.lam = rh * atan2(xy.x, xy.y) * 52 | sqrt(1. - P->es * s * s) / cos(lp.phi); 53 | } else if (fabs(s - HALFPI) <= EPS10) 54 | lp.lam = 0.; 55 | else I_ERROR; 56 | return (lp); 57 | } 58 | FREEUP; 59 | if (P) { 60 | if (P->en) 61 | pj_dalloc(P->en); 62 | pj_dalloc(P); 63 | } 64 | } 65 | ENTRY1(bonne, en) 66 | double c; 67 | 68 | P->phi1 = pj_param(P->params, "rlat_1").f; 69 | if (fabs(P->phi1) < EPS10) E_ERROR(-23); 70 | if (P->es) { 71 | P->en = pj_enfn(P->es); 72 | P->m1 = pj_mlfn(P->phi1, P->am1 = sin(P->phi1), 73 | c = cos(P->phi1), P->en); 74 | P->am1 = c / (sqrt(1. - P->es * P->am1 * P->am1) * P->am1); 75 | P->inv = e_inverse; 76 | P->fwd = e_forward; 77 | } else { 78 | if (fabs(P->phi1) + EPS10 >= HALFPI) 79 | P->cphi1 = 0.; 80 | else 81 | P->cphi1 = 1. / tan(P->phi1); 82 | P->inv = s_inverse; 83 | P->fwd = s_forward; 84 | } 85 | ENDENTRY(P) 86 | -------------------------------------------------------------------------------- /Proj4/PJ_cass.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double m0; \ 3 | double n; \ 4 | double t; \ 5 | double a1; \ 6 | double c; \ 7 | double r; \ 8 | double dd; \ 9 | double d2; \ 10 | double a2; \ 11 | double tn; \ 12 | double *en; 13 | #define PJ_LIB__ 14 | # include 15 | PROJ_HEAD(cass, "Cassini") "\n\tCyl, Sph&Ell"; 16 | # define EPS10 1e-10 17 | # define C1 .16666666666666666666 18 | # define C2 .00833333333333333333 19 | # define C3 .04166666666666666666 20 | # define C4 .33333333333333333333 21 | # define C5 .06666666666666666666 22 | FORWARD(e_forward); /* ellipsoid */ 23 | xy.y = pj_mlfn(lp.phi, P->n = sin(lp.phi), P->c = cos(lp.phi), P->en); 24 | P->n = 1./sqrt(1. - P->es * P->n * P->n); 25 | P->tn = tan(lp.phi); P->t = P->tn * P->tn; 26 | P->a1 = lp.lam * P->c; 27 | P->c *= P->es * P->c / (1 - P->es); 28 | P->a2 = P->a1 * P->a1; 29 | xy.x = P->n * P->a1 * (1. - P->a2 * P->t * 30 | (C1 - (8. - P->t + 8. * P->c) * P->a2 * C2)); 31 | xy.y -= P->m0 - P->n * P->tn * P->a2 * 32 | (.5 + (5. - P->t + 6. * P->c) * P->a2 * C3); 33 | return (xy); 34 | } 35 | FORWARD(s_forward); /* spheroid */ 36 | xy.x = asin(cos(lp.phi) * sin(lp.lam)); 37 | xy.y = atan2(tan(lp.phi) , cos(lp.lam)) - P->phi0; 38 | return (xy); 39 | } 40 | INVERSE(e_inverse); /* ellipsoid */ 41 | double ph1; 42 | 43 | ph1 = pj_inv_mlfn(P->m0 + xy.y, P->es, P->en); 44 | P->tn = tan(ph1); P->t = P->tn * P->tn; 45 | P->n = sin(ph1); 46 | P->r = 1. / (1. - P->es * P->n * P->n); 47 | P->n = sqrt(P->r); 48 | P->r *= (1. - P->es) * P->n; 49 | P->dd = xy.x / P->n; 50 | P->d2 = P->dd * P->dd; 51 | lp.phi = ph1 - (P->n * P->tn / P->r) * P->d2 * 52 | (.5 - (1. + 3. * P->t) * P->d2 * C3); 53 | lp.lam = P->dd * (1. + P->t * P->d2 * 54 | (-C4 + (1. + 3. * P->t) * P->d2 * C5)) / cos(ph1); 55 | return (lp); 56 | } 57 | INVERSE(s_inverse); /* spheroid */ 58 | lp.phi = asin(sin(P->dd = xy.y + P->phi0) * cos(xy.x)); 59 | lp.lam = atan2(tan(xy.x), cos(P->dd)); 60 | return (lp); 61 | } 62 | FREEUP; 63 | if (P) { 64 | if (P->en) 65 | pj_dalloc(P->en); 66 | pj_dalloc(P); 67 | } 68 | } 69 | ENTRY1(cass, en) 70 | if (P->es) { 71 | if (!(P->en = pj_enfn(P->es))) E_ERROR_0; 72 | P->m0 = pj_mlfn(P->phi0, sin(P->phi0), cos(P->phi0), P->en); 73 | P->inv = e_inverse; 74 | P->fwd = e_forward; 75 | } else { 76 | P->inv = s_inverse; 77 | P->fwd = s_forward; 78 | } 79 | ENDENTRY(P) 80 | -------------------------------------------------------------------------------- /Proj4/PJ_cc.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double ap; 3 | #define PJ_LIB__ 4 | #include 5 | PROJ_HEAD(cc, "Central Cylindrical") "\n\tCyl, Sph"; 6 | #define EPS10 1.e-10 7 | FORWARD(s_forward); /* spheroid */ 8 | if (fabs(fabs(lp.phi) - HALFPI) <= EPS10) F_ERROR; 9 | xy.x = lp.lam; 10 | xy.y = tan(lp.phi); 11 | return (xy); 12 | } 13 | INVERSE(s_inverse); /* spheroid */ 14 | lp.phi = atan(xy.y); 15 | lp.lam = xy.x; 16 | return (lp); 17 | } 18 | FREEUP; if (P) pj_dalloc(P); } 19 | ENTRY0(cc) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 20 | -------------------------------------------------------------------------------- /Proj4/PJ_cea.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double qp; \ 3 | double *apa; 4 | #define PJ_LIB__ 5 | # include 6 | PROJ_HEAD(cea, "Equal Area Cylindrical") "\n\tCyl, Sph&Ell\n\tlat_ts="; 7 | # define EPS 1e-10 8 | FORWARD(e_forward); /* spheroid */ 9 | xy.x = P->k0 * lp.lam; 10 | xy.y = .5 * pj_qsfn(sin(lp.phi), P->e, P->one_es) / P->k0; 11 | return (xy); 12 | } 13 | FORWARD(s_forward); /* spheroid */ 14 | xy.x = P->k0 * lp.lam; 15 | xy.y = sin(lp.phi) / P->k0; 16 | return (xy); 17 | } 18 | INVERSE(e_inverse); /* spheroid */ 19 | lp.phi = pj_authlat(asin( 2. * xy.y * P->k0 / P->qp), P->apa); 20 | lp.lam = xy.x / P->k0; 21 | return (lp); 22 | } 23 | INVERSE(s_inverse); /* spheroid */ 24 | double t; 25 | 26 | if ((t = fabs(xy.y *= P->k0)) - EPS <= 1.) { 27 | if (t >= 1.) 28 | lp.phi = xy.y < 0. ? -HALFPI : HALFPI; 29 | else 30 | lp.phi = asin(xy.y); 31 | lp.lam = xy.x / P->k0; 32 | } else I_ERROR; 33 | return (lp); 34 | } 35 | FREEUP; 36 | if (P) { 37 | if (P->apa) 38 | pj_dalloc(P->apa); 39 | pj_dalloc(P); 40 | } 41 | } 42 | ENTRY1(cea, apa) 43 | double t; 44 | 45 | if (pj_param(P->params, "tlat_ts").i && 46 | (P->k0 = cos(t = pj_param(P->params, "rlat_ts").f)) < 0.) E_ERROR(-24) 47 | else 48 | t = 0.; 49 | if (P->es) { 50 | t = sin(t); 51 | P->k0 /= sqrt(1. - P->es * t * t); 52 | P->e = sqrt(P->es); 53 | if (!(P->apa = pj_authset(P->es))) E_ERROR_0; 54 | P->qp = pj_qsfn(1., P->e, P->one_es); 55 | P->inv = e_inverse; 56 | P->fwd = e_forward; 57 | } else { 58 | P->inv = s_inverse; 59 | P->fwd = s_forward; 60 | } 61 | ENDENTRY(P) 62 | -------------------------------------------------------------------------------- /Proj4/PJ_collg.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | # include 3 | PROJ_HEAD(collg, "Collignon") "\n\tPCyl, Sph."; 4 | #define FXC 1.12837916709551257390 5 | #define FYC 1.77245385090551602729 6 | #define ONEEPS 1.0000001 7 | FORWARD(s_forward); /* spheroid */ 8 | if ((xy.y = 1. - sin(lp.phi)) <= 0.) 9 | xy.y = 0.; 10 | else 11 | xy.y = sqrt(xy.y); 12 | xy.x = FXC * lp.lam * xy.y; 13 | xy.y = FYC * (1. - xy.y); 14 | return (xy); 15 | } 16 | INVERSE(s_inverse); /* spheroid */ 17 | lp.phi = xy.y / FYC - 1.; 18 | if (fabs(lp.phi = 1. - lp.phi * lp.phi) < 1.) 19 | lp.phi = asin(lp.phi); 20 | else if (fabs(lp.phi) > ONEEPS) I_ERROR 21 | else lp.phi = lp.phi < 0. ? -HALFPI : HALFPI; 22 | if ((lp.lam = 1. - sin(lp.phi)) <= 0.) 23 | lp.lam = 0.; 24 | else 25 | lp.lam = xy.x / (FXC * sqrt(lp.lam)); 26 | return (lp); 27 | } 28 | FREEUP; if (P) pj_dalloc(P); } 29 | ENTRY0(collg) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 30 | -------------------------------------------------------------------------------- /Proj4/PJ_crast.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | # include 3 | PROJ_HEAD(crast, "Craster Parabolic (Putnins P4)") 4 | "\n\tPCyl., Sph."; 5 | #define XM 0.97720502380583984317 6 | #define RXM 1.02332670794648848847 7 | #define YM 3.06998012383946546542 8 | #define RYM 0.32573500793527994772 9 | #define THIRD 0.333333333333333333 10 | FORWARD(s_forward); /* spheroid */ 11 | lp.phi *= THIRD; 12 | xy.x = XM * lp.lam * (2. * cos(lp.phi + lp.phi) - 1.); 13 | xy.y = YM * sin(lp.phi); 14 | return (xy); 15 | } 16 | INVERSE(s_inverse); /* spheroid */ 17 | lp.phi = 3. * asin(xy.y * RYM); 18 | lp.lam = xy.x * RXM / (2. * cos((lp.phi + lp.phi) * THIRD) - 1); 19 | return (lp); 20 | } 21 | FREEUP; if (P) pj_dalloc(P); } 22 | ENTRY0(crast) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 23 | -------------------------------------------------------------------------------- /Proj4/PJ_denoy.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | #include 3 | PROJ_HEAD(denoy, "Denoyer Semi-Elliptical") "\n\tPCyl., no inv., Sph."; 4 | #define C0 0.95 5 | #define C1 -.08333333333333333333 6 | #define C3 .00166666666666666666 7 | #define D1 0.9 8 | #define D5 0.03 9 | FORWARD(s_forward); /* spheroid */ 10 | xy.y = lp.phi; 11 | xy.x = lp.lam; 12 | lp.lam = fabs(lp.lam); 13 | xy.x *= cos((C0 + lp.lam * (C1 + lp.lam * lp.lam * C3)) * 14 | (lp.phi * (D1 + D5 * lp.phi * lp.phi * lp.phi * lp.phi))); 15 | return (xy); 16 | } 17 | FREEUP; if (P) pj_dalloc(P); } 18 | ENTRY0(denoy) P->es = 0.; P->fwd = s_forward; ENDENTRY(P) 19 | -------------------------------------------------------------------------------- /Proj4/PJ_eck1.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | #include 3 | PROJ_HEAD(eck1, "Eckert I") "\n\tPCyl., Sph."; 4 | #define FC .92131773192356127802 5 | #define RP .31830988618379067154 6 | FORWARD(s_forward); /* spheroid */ 7 | xy.x = FC * lp.lam * (1. - RP * fabs(lp.phi)); 8 | xy.y = FC * lp.phi; 9 | return (xy); 10 | } 11 | INVERSE(s_inverse); /* spheroid */ 12 | lp.phi = xy.y / FC; 13 | lp.lam = xy.x / (FC * (1. - RP * fabs(lp.phi))); 14 | return (lp); 15 | } 16 | FREEUP; if (P) pj_dalloc(P); } 17 | ENTRY0(eck1) 18 | P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; 19 | ENDENTRY(P) 20 | -------------------------------------------------------------------------------- /Proj4/PJ_eck2.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | # include 3 | PROJ_HEAD(eck2, "Eckert II") "\n\tPCyl. Sph."; 4 | #define FXC 0.46065886596178063902 5 | #define FYC 1.44720250911653531871 6 | #define C13 0.33333333333333333333 7 | #define ONEEPS 1.0000001 8 | FORWARD(s_forward); /* spheroid */ 9 | xy.x = FXC * lp.lam * (xy.y = sqrt(4. - 3. * sin(fabs(lp.phi)))); 10 | xy.y = FYC * (2. - xy.y); 11 | if ( lp.phi < 0.) xy.y = -xy.y; 12 | return (xy); 13 | } 14 | INVERSE(s_inverse); /* spheroid */ 15 | lp.lam = xy.x / (FXC * ( lp.phi = 2. - fabs(xy.y) / FYC) ); 16 | lp.phi = (4. - lp.phi * lp.phi) * C13; 17 | if (fabs(lp.phi) >= 1.) { 18 | if (fabs(lp.phi) > ONEEPS) I_ERROR 19 | else 20 | lp.phi = lp.phi < 0. ? -HALFPI : HALFPI; 21 | } else 22 | lp.phi = asin(lp.phi); 23 | if (xy.y < 0) 24 | lp.phi = -lp.phi; 25 | return (lp); 26 | } 27 | FREEUP; if (P) pj_dalloc(P); } 28 | ENTRY0(eck2); P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 29 | -------------------------------------------------------------------------------- /Proj4/PJ_eck3.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double C_x, C_y, A, B; 3 | #define PJ_LIB__ 4 | #include 5 | PROJ_HEAD(eck3, "Eckert III") "\n\tPCyl, Sph."; 6 | PROJ_HEAD(putp1, "Putnins P1") "\n\tPCyl, Sph."; 7 | PROJ_HEAD(wag6, "Wagner VI") "\n\tPCyl, Sph."; 8 | PROJ_HEAD(kav7, "Kavraisky VII") "\n\tPCyl, Sph."; 9 | FORWARD(s_forward); /* spheroid */ 10 | xy.y = P->C_y * lp.phi; 11 | xy.x = P->C_x * lp.lam * (P->A + asqrt(1. - P->B * lp.phi * lp.phi)); 12 | return (xy); 13 | } 14 | INVERSE(s_inverse); /* spheroid */ 15 | lp.phi = xy.y / P->C_y; 16 | lp.lam = xy.x / (P->C_x * (P->A + asqrt(1. - P->B * lp.phi * lp.phi))); 17 | return (lp); 18 | } 19 | FREEUP; if (P) pj_dalloc(P); } 20 | static PJ * 21 | setup(PJ *P) { 22 | P->es = 0.; 23 | P->inv = s_inverse; 24 | P->fwd = s_forward; 25 | return P; 26 | } 27 | ENTRY0(eck3) 28 | P->C_x = .42223820031577120149; 29 | P->C_y = .84447640063154240298; 30 | P->A = 1.; 31 | P->B = 0.4052847345693510857755; 32 | ENDENTRY(setup(P)) 33 | ENTRY0(kav7) 34 | P->C_x = 0.2632401569273184856851; 35 | P->C_x = 0.8660254037844; 36 | P->C_y = 1.; 37 | P->A = 0.; 38 | P->B = 0.30396355092701331433; 39 | ENDENTRY(setup(P)) 40 | ENTRY0(wag6); 41 | P->C_x = P->C_y = 0.94745; 42 | P->A = 0.; 43 | P->B = 0.30396355092701331433; 44 | ENDENTRY(setup(P)) 45 | ENTRY0(putp1); 46 | P->C_x = 1.89490; 47 | P->C_y = 0.94745; 48 | P->A = -0.5; 49 | P->B = 0.30396355092701331433; 50 | ENDENTRY(setup(P)) 51 | -------------------------------------------------------------------------------- /Proj4/PJ_eck4.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | #include 3 | PROJ_HEAD(eck4, "Eckert IV") "\n\tPCyl, Sph."; 4 | #define C_x .42223820031577120149 5 | #define C_y 1.32650042817700232218 6 | #define RC_y .75386330736002178205 7 | #define C_p 3.57079632679489661922 8 | #define RC_p .28004957675577868795 9 | #define EPS 1e-7 10 | #define NITER 6 11 | FORWARD(s_forward); /* spheroid */ 12 | double p, V, s, c; 13 | int i; 14 | 15 | p = C_p * sin(lp.phi); 16 | V = lp.phi * lp.phi; 17 | lp.phi *= 0.895168 + V * ( 0.0218849 + V * 0.00826809 ); 18 | for (i = NITER; i ; --i) { 19 | c = cos(lp.phi); 20 | s = sin(lp.phi); 21 | lp.phi -= V = (lp.phi + s * (c + 2.) - p) / 22 | (1. + c * (c + 2.) - s * s); 23 | if (fabs(V) < EPS) 24 | break; 25 | } 26 | if (!i) { 27 | xy.x = C_x * lp.lam; 28 | xy.y = lp.phi < 0. ? -C_y : C_y; 29 | } else { 30 | xy.x = C_x * lp.lam * (1. + cos(lp.phi)); 31 | xy.y = C_y * sin(lp.phi); 32 | } 33 | return (xy); 34 | } 35 | INVERSE(s_inverse); /* spheroid */ 36 | double c; 37 | 38 | lp.phi = aasin(xy.y / C_y); 39 | lp.lam = xy.x / (C_x * (1. + (c = cos(lp.phi)))); 40 | lp.phi = aasin((lp.phi + sin(lp.phi) * (c + 2.)) / C_p); 41 | return (lp); 42 | } 43 | FREEUP; if (P) pj_dalloc(P); } 44 | ENTRY0(eck4); P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 45 | -------------------------------------------------------------------------------- /Proj4/PJ_eck5.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | # include 3 | PROJ_HEAD(eck5, "Eckert V") "\n\tPCyl, Sph."; 4 | #define XF 0.44101277172455148219 5 | #define RXF 2.26750802723822639137 6 | #define YF 0.88202554344910296438 7 | #define RYF 1.13375401361911319568 8 | FORWARD(s_forward); /* spheroid */ 9 | xy.x = XF * (1. + cos(lp.phi)) * lp.lam; 10 | xy.y = YF * lp.phi; 11 | return (xy); 12 | } 13 | INVERSE(s_inverse); /* spheroid */ 14 | lp.lam = RXF * xy.x / (1. + cos( lp.phi = RYF * xy.y)); 15 | return (lp); 16 | } 17 | FREEUP; if (P) pj_dalloc(P); } 18 | ENTRY0(eck5); P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 19 | -------------------------------------------------------------------------------- /Proj4/PJ_eqc.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double rc; 3 | #define PJ_LIB__ 4 | # include 5 | PROJ_HEAD(eqc, "Equidistant Cylindrical (Plate Caree)") 6 | "\n\tCyl, Sph\n\tlat_ts=[, lat_0=0]"; 7 | FORWARD(s_forward); /* spheroid */ 8 | xy.x = P->rc * lp.lam; 9 | xy.y = lp.phi - P->phi0; 10 | return (xy); 11 | } 12 | INVERSE(s_inverse); /* spheroid */ 13 | lp.lam = xy.x / P->rc; 14 | lp.phi = xy.y + P->phi0; 15 | return (lp); 16 | } 17 | FREEUP; if (P) pj_dalloc(P); } 18 | ENTRY0(eqc) 19 | if ((P->rc = cos(pj_param(P->params, "rlat_ts").f)) <= 0.) E_ERROR(-24); 20 | P->inv = s_inverse; 21 | P->fwd = s_forward; 22 | P->es = 0.; 23 | ENDENTRY(P) 24 | -------------------------------------------------------------------------------- /Proj4/PJ_eqdc.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double phi1; \ 3 | double phi2; \ 4 | double n; \ 5 | double rho; \ 6 | double rho0; \ 7 | double c; \ 8 | double *en; \ 9 | int ellips; 10 | #define PJ_LIB__ 11 | #include 12 | PROJ_HEAD(eqdc, "Equidistant Conic") 13 | "\n\tConic, Sph&Ell\n\tlat_1= lat_2="; 14 | # define EPS10 1.e-10 15 | FORWARD(e_forward); /* sphere & ellipsoid */ 16 | P->rho = P->c - (P->ellips ? pj_mlfn(lp.phi, sin(lp.phi), 17 | cos(lp.phi), P->en) : lp.phi); 18 | xy.x = P->rho * sin( lp.lam *= P->n ); 19 | xy.y = P->rho0 - P->rho * cos(lp.lam); 20 | return (xy); 21 | } 22 | INVERSE(e_inverse); /* sphere & ellipsoid */ 23 | if ((P->rho = hypot(xy.x, xy.y = P->rho0 - xy.y)) != 0.0 ) { 24 | if (P->n < 0.) { 25 | P->rho = -P->rho; 26 | xy.x = -xy.x; 27 | xy.y = -xy.y; 28 | } 29 | lp.phi = P->c - P->rho; 30 | if (P->ellips) 31 | lp.phi = pj_inv_mlfn(lp.phi, P->es, P->en); 32 | lp.lam = atan2(xy.x, xy.y) / P->n; 33 | } else { 34 | lp.lam = 0.; 35 | lp.phi = P->n > 0. ? HALFPI : - HALFPI; 36 | } 37 | return (lp); 38 | } 39 | SPECIAL(fac) { 40 | double sinphi, cosphi; 41 | 42 | sinphi = sin(lp.phi); 43 | cosphi = cos(lp.phi); 44 | fac->code |= IS_ANAL_HK; 45 | fac->h = 1.; 46 | fac->k = P->n * (P->c - (P->ellips ? pj_mlfn(lp.phi, sinphi, 47 | cosphi, P->en) : lp.phi)) / pj_msfn(sinphi, cosphi, P->es); 48 | } 49 | FREEUP; if (P) { if (P->en) pj_dalloc(P->en); pj_dalloc(P); } } 50 | ENTRY1(eqdc, en) 51 | double cosphi, sinphi; 52 | int secant; 53 | 54 | P->phi1 = pj_param(P->params, "rlat_1").f; 55 | P->phi2 = pj_param(P->params, "rlat_2").f; 56 | if (fabs(P->phi1 + P->phi2) < EPS10) E_ERROR(-21); 57 | if (!(P->en = pj_enfn(P->es))) 58 | E_ERROR_0; 59 | P->n = sinphi = sin(P->phi1); 60 | cosphi = cos(P->phi1); 61 | secant = fabs(P->phi1 - P->phi2) >= EPS10; 62 | if( (P->ellips = (P->es > 0.)) ) { 63 | double ml1, m1; 64 | 65 | m1 = pj_msfn(sinphi, cosphi, P->es); 66 | ml1 = pj_mlfn(P->phi1, sinphi, cosphi, P->en); 67 | if (secant) { /* secant cone */ 68 | sinphi = sin(P->phi2); 69 | cosphi = cos(P->phi2); 70 | P->n = (m1 - pj_msfn(sinphi, cosphi, P->es)) / 71 | (pj_mlfn(P->phi2, sinphi, cosphi, P->en) - ml1); 72 | } 73 | P->c = ml1 + m1 / P->n; 74 | P->rho0 = P->c - pj_mlfn(P->phi0, sin(P->phi0), 75 | cos(P->phi0), P->en); 76 | } else { 77 | if (secant) 78 | P->n = (cosphi - cos(P->phi2)) / (P->phi2 - P->phi1); 79 | P->c = P->phi1 + cos(P->phi1) / P->n; 80 | P->rho0 = P->c - P->phi0; 81 | } 82 | P->inv = e_inverse; 83 | P->fwd = e_forward; 84 | P->spc = fac; 85 | ENDENTRY(P) 86 | -------------------------------------------------------------------------------- /Proj4/PJ_fahey.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | # include 3 | PROJ_HEAD(fahey, "Fahey") "\n\tPcyl, Sph."; 4 | #define TOL 1e-6 5 | FORWARD(s_forward); /* spheroid */ 6 | xy.y = 1.819152 * ( xy.x = tan(0.5 * lp.phi) ); 7 | xy.x = 0.819152 * lp.lam * asqrt(1 - xy.x * xy.x); 8 | return (xy); 9 | } 10 | INVERSE(s_inverse); /* spheroid */ 11 | lp.phi = 2. * atan(xy.y /= 1.819152); 12 | lp.lam = fabs(xy.y = 1. - xy.y * xy.y) < TOL ? 0. : 13 | xy.x / (0.819152 * sqrt(xy.y)); 14 | return (lp); 15 | } 16 | FREEUP; if (P) pj_dalloc(P); } 17 | ENTRY0(fahey) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 18 | -------------------------------------------------------------------------------- /Proj4/PJ_fouc_s.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double n, n1; 3 | #define PJ_LIB__ 4 | #include 5 | PROJ_HEAD(fouc_s, "Foucaut Sinusoidal") "\n\tPCyl., Sph."; 6 | #define MAX_ITER 10 7 | #define LOOP_TOL 1e-7 8 | FORWARD(s_forward); /* spheroid */ 9 | double t; 10 | 11 | t = cos(lp.phi); 12 | xy.x = lp.lam * t / (P->n + P->n1 * t); 13 | xy.y = P->n * lp.phi + P->n1 * sin(lp.phi); 14 | return (xy); 15 | } 16 | INVERSE(s_inverse); /* spheroid */ 17 | double V; 18 | int i; 19 | 20 | if (P->n) { 21 | lp.phi = xy.y; 22 | for (i = MAX_ITER; i ; --i) { 23 | lp.phi -= V = (P->n * lp.phi + P->n1 * sin(lp.phi) - xy.y ) / 24 | (P->n + P->n1 * cos(lp.phi)); 25 | if (fabs(V) < LOOP_TOL) 26 | break; 27 | } 28 | if (!i) 29 | lp.phi = xy.y < 0. ? -HALFPI : HALFPI; 30 | } else 31 | lp.phi = aasin(xy.y); 32 | V = cos(lp.phi); 33 | lp.lam = xy.x * (P->n + P->n1 * V) / V; 34 | return (lp); 35 | } 36 | FREEUP; if (P) pj_dalloc(P); } 37 | ENTRY0(fouc_s) 38 | P->n = pj_param(P->params, "dn").f; 39 | if (P->n < 0. || P->n > 1.) 40 | E_ERROR(-99) 41 | P->n1 = 1. - P->n; 42 | P->es = 0; 43 | P->inv = s_inverse; 44 | P->fwd = s_forward; 45 | ENDENTRY(P) 46 | -------------------------------------------------------------------------------- /Proj4/PJ_gall.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | #include 3 | PROJ_HEAD(gall, "Gall (Gall Stereographic)") "\n\tCyl, Sph"; 4 | #define YF 1.70710678118654752440 5 | #define XF 0.70710678118654752440 6 | #define RYF 0.58578643762690495119 7 | #define RXF 1.41421356237309504880 8 | FORWARD(s_forward); /* spheroid */ 9 | xy.x = XF * lp.lam; 10 | xy.y = YF * tan(.5 * lp.phi); 11 | return (xy); 12 | } 13 | INVERSE(s_inverse); /* spheroid */ 14 | lp.lam = RXF * xy.x; 15 | lp.phi = 2. * atan(xy.y * RYF); 16 | return (lp); 17 | } 18 | FREEUP; if (P) pj_dalloc(P); } 19 | ENTRY0(gall) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 20 | -------------------------------------------------------------------------------- /Proj4/PJ_gins8.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | # include 3 | PROJ_HEAD(gins8, "Ginsburg VIII (TsNIIGAiK)") "\n\tPCyl, Sph., no inv."; 4 | #define Cl 0.000952426 5 | #define Cp 0.162388 6 | #define C12 0.08333333333333333 7 | FORWARD(s_forward); /* spheroid */ 8 | double t = lp.phi * lp.phi; 9 | 10 | xy.y = lp.phi * (1. + t * C12); 11 | xy.x = lp.lam * (1. - Cp * t); 12 | t = lp.lam * lp.lam; 13 | xy.x *= (0.87 - Cl * t * t); 14 | return (xy); 15 | } 16 | FREEUP; if (P) pj_dalloc(P); } 17 | ENTRY0(gins8) P->es = 0.; P->inv = 0; P->fwd = s_forward; ENDENTRY(P) 18 | -------------------------------------------------------------------------------- /Proj4/PJ_gnom.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double sinph0; \ 3 | double cosph0; \ 4 | int mode; 5 | #define PJ_LIB__ 6 | #include 7 | PROJ_HEAD(gnom, "Gnomonic") "\n\tAzi, Sph."; 8 | #define EPS10 1.e-10 9 | #define N_POLE 0 10 | #define S_POLE 1 11 | #define EQUIT 2 12 | #define OBLIQ 3 13 | FORWARD(s_forward); /* spheroid */ 14 | double coslam, cosphi, sinphi; 15 | 16 | sinphi = sin(lp.phi); 17 | cosphi = cos(lp.phi); 18 | coslam = cos(lp.lam); 19 | switch (P->mode) { 20 | case EQUIT: 21 | xy.y = cosphi * coslam; 22 | break; 23 | case OBLIQ: 24 | xy.y = P->sinph0 * sinphi + P->cosph0 * cosphi * coslam; 25 | break; 26 | case S_POLE: 27 | xy.y = - sinphi; 28 | break; 29 | case N_POLE: 30 | xy.y = sinphi; 31 | break; 32 | } 33 | if (xy.y <= EPS10) F_ERROR; 34 | xy.x = (xy.y = 1. / xy.y) * cosphi * sin(lp.lam); 35 | switch (P->mode) { 36 | case EQUIT: 37 | xy.y *= sinphi; 38 | break; 39 | case OBLIQ: 40 | xy.y *= P->cosph0 * sinphi - P->sinph0 * cosphi * coslam; 41 | break; 42 | case N_POLE: 43 | coslam = - coslam; 44 | case S_POLE: 45 | xy.y *= cosphi * coslam; 46 | break; 47 | } 48 | return (xy); 49 | } 50 | INVERSE(s_inverse); /* spheroid */ 51 | double rh, cosz, sinz; 52 | 53 | rh = hypot(xy.x, xy.y); 54 | sinz = sin(lp.phi = atan(rh)); 55 | cosz = sqrt(1. - sinz * sinz); 56 | if (fabs(rh) <= EPS10) { 57 | lp.phi = P->phi0; 58 | lp.lam = 0.; 59 | } else { 60 | switch (P->mode) { 61 | case OBLIQ: 62 | lp.phi = cosz * P->sinph0 + xy.y * sinz * P->cosph0 / rh; 63 | if (fabs(lp.phi) >= 1.) 64 | lp.phi = lp.phi > 0. ? HALFPI : - HALFPI; 65 | else 66 | lp.phi = asin(lp.phi); 67 | xy.y = (cosz - P->sinph0 * sin(lp.phi)) * rh; 68 | xy.x *= sinz * P->cosph0; 69 | break; 70 | case EQUIT: 71 | lp.phi = xy.y * sinz / rh; 72 | if (fabs(lp.phi) >= 1.) 73 | lp.phi = lp.phi > 0. ? HALFPI : - HALFPI; 74 | else 75 | lp.phi = asin(lp.phi); 76 | xy.y = cosz * rh; 77 | xy.x *= sinz; 78 | break; 79 | case S_POLE: 80 | lp.phi -= HALFPI; 81 | break; 82 | case N_POLE: 83 | lp.phi = HALFPI - lp.phi; 84 | xy.y = -xy.y; 85 | break; 86 | } 87 | lp.lam = atan2(xy.x, xy.y); 88 | } 89 | return (lp); 90 | } 91 | FREEUP; if (P) pj_dalloc(P); } 92 | ENTRY0(gnom) 93 | if (fabs(fabs(P->phi0) - HALFPI) < EPS10) 94 | P->mode = P->phi0 < 0. ? S_POLE : N_POLE; 95 | else if (fabs(P->phi0) < EPS10) 96 | P->mode = EQUIT; 97 | else { 98 | P->mode = OBLIQ; 99 | P->sinph0 = sin(P->phi0); 100 | P->cosph0 = cos(P->phi0); 101 | } 102 | P->inv = s_inverse; 103 | P->fwd = s_forward; 104 | P->es = 0.; 105 | ENDENTRY(P) 106 | -------------------------------------------------------------------------------- /Proj4/PJ_goode.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | struct PJconsts *sinu; \ 3 | struct PJconsts *moll; 4 | #define PJ_LIB__ 5 | #include 6 | PROJ_HEAD(goode, "Goode Homolosine") "\n\tPCyl, Sph."; 7 | C_NAMESPACE PJ 8 | *pj_sinu(PJ *), *pj_moll(PJ *); 9 | #define Y_COR 0.05280 10 | #define PHI_LIM .71093078197902358062 11 | FORWARD(s_forward); /* spheroid */ 12 | if (fabs(lp.phi) <= PHI_LIM) 13 | xy = P->sinu->fwd(lp, P->sinu); 14 | else { 15 | xy = P->moll->fwd(lp, P->moll); 16 | xy.y -= lp.phi >= 0.0 ? Y_COR : -Y_COR; 17 | } 18 | return (xy); 19 | } 20 | INVERSE(s_inverse); /* spheroid */ 21 | if (fabs(xy.y) <= PHI_LIM) 22 | lp = P->sinu->inv(xy, P->sinu); 23 | else { 24 | xy.y += xy.y >= 0.0 ? Y_COR : -Y_COR; 25 | lp = P->moll->inv(xy, P->moll); 26 | } 27 | return (lp); 28 | } 29 | FREEUP; 30 | if (P) { 31 | if (P->sinu) 32 | (*(P->sinu->pfree))(P->sinu); 33 | if (P->moll) 34 | (*(P->moll->pfree))(P->moll); 35 | pj_dalloc(P); 36 | } 37 | } 38 | ENTRY2(goode, sinu, moll) 39 | P->es = 0.; 40 | if (!(P->sinu = pj_sinu(0)) || !(P->moll = pj_moll(0))) 41 | E_ERROR_0; 42 | if (!(P->sinu = pj_sinu(P->sinu)) || !(P->moll = pj_moll(P->moll))) 43 | E_ERROR_0; 44 | P->fwd = s_forward; 45 | P->inv = s_inverse; 46 | ENDENTRY(P) 47 | -------------------------------------------------------------------------------- /Proj4/PJ_gstmerc.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double lamc;\ 3 | double phic;\ 4 | double c;\ 5 | double n1;\ 6 | double n2;\ 7 | double XS;\ 8 | double YS; 9 | 10 | #define PJ_LIB__ 11 | # include 12 | PROJ_HEAD(gstmerc, "Gauss-Schreiber Transverse Mercator (aka Gauss-Laborde Reunion)") 13 | "\n\tCyl, Sph&Ell\n\tlat_0= lon_0= k_0="; 14 | FORWARD(s_forward); /* spheroid */ 15 | double L, Ls, sinLs1, Ls1; 16 | L= P->n1*lp.lam; 17 | Ls= P->c+P->n1*log(pj_tsfn(-1.0*lp.phi,-1.0*sin(lp.phi),P->e)); 18 | sinLs1= sin(L)/cosh(Ls); 19 | Ls1= log(pj_tsfn(-1.0*asin(sinLs1),0.0,0.0)); 20 | xy.x= (P->XS + P->n2*Ls1)*P->ra; 21 | xy.y= (P->YS + P->n2*atan(sinh(Ls)/cos(L)))*P->ra; 22 | /*fprintf(stderr,"fwd:\nL =%16.13f\nLs =%16.13f\nLs1 =%16.13f\nLP(%16.13f,%16.13f)=XY(%16.4f,%16.4f)\n",L,Ls,Ls1,lp.lam+P->lam0,lp.phi,(xy.x*P->a + P->x0)*P->to_meter,(xy.y*P->a + P->y0)*P->to_meter);*/ 23 | return (xy); 24 | } 25 | INVERSE(s_inverse); /* spheroid */ 26 | double L, LC, sinC; 27 | L= atan(sinh((xy.x*P->a - P->XS)/P->n2)/cos((xy.y*P->a - P->YS)/P->n2)); 28 | sinC= sin((xy.y*P->a - P->YS)/P->n2)/cosh((xy.x*P->a - P->XS)/P->n2); 29 | LC= log(pj_tsfn(-1.0*asin(sinC),0.0,0.0)); 30 | lp.lam= L/P->n1; 31 | lp.phi= -1.0*pj_phi2(exp((LC-P->c)/P->n1),P->e); 32 | /*fprintf(stderr,"inv:\nL =%16.13f\nsinC =%16.13f\nLC =%16.13f\nXY(%16.4f,%16.4f)=LP(%16.13f,%16.13f)\n",L,sinC,LC,((xy.x/P->ra)+P->x0)/P->to_meter,((xy.y/P->ra)+P->y0)/P->to_meter,lp.lam+P->lam0,lp.phi);*/ 33 | return (lp); 34 | } 35 | FREEUP; if (P) pj_dalloc(P); } 36 | ENTRY0(gstmerc) 37 | P->lamc= P->lam0; 38 | P->n1= sqrt(1.0+P->es*pow(cos(P->phi0),4.0)/(1.0-P->es)); 39 | P->phic= asin(sin(P->phi0)/P->n1); 40 | P->c= log(pj_tsfn(-1.0*P->phic,0.0,0.0)) 41 | -P->n1*log(pj_tsfn(-1.0*P->phi0,-1.0*sin(P->phi0),P->e)); 42 | P->n2= P->k0*P->a*sqrt(1.0-P->es)/(1.0-P->es*sin(P->phi0)*sin(P->phi0)); 43 | P->XS= 0;/* -P->x0 */ 44 | P->YS= -1.0*P->n2*P->phic;/* -P->y0 */ 45 | P->inv= s_inverse; 46 | P->fwd= s_forward; 47 | /*fprintf(stderr,"a (m) =%16.4f\ne =%16.13f\nl0(rad)=%16.13f\np0(rad)=%16.13f\nk0 =%16.4f\nX0 (m)=%16.4f\nY0 (m)=%16.4f\n\nlC(rad)=%16.13f\npC(rad)=%16.13f\nc =%16.13f\nn1 =%16.13f\nn2 (m) =%16.4f\nXS (m) =%16.4f\nYS (m) =%16.4f\n", P->a, P->e, P->lam0, P->phi0, P->k0, P->x0, P->y0, P->lamc, P->phic, P->c, P->n1, P->n2, P->XS +P->x0, P->YS + P->y0);*/ 48 | ENDENTRY(P) 49 | -------------------------------------------------------------------------------- /Proj4/PJ_hammer.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double w; \ 3 | double m, rm; 4 | #define PJ_LIB__ 5 | # include 6 | PROJ_HEAD(hammer, "Hammer & Eckert-Greifendorff") 7 | "\n\tMisc Sph, no inv.\n\tW= M="; 8 | FORWARD(s_forward); /* spheroid */ 9 | double cosphi, d; 10 | 11 | d = sqrt(2./(1. + (cosphi = cos(lp.phi)) * cos(lp.lam *= P->w))); 12 | xy.x = P->m * d * cosphi * sin(lp.lam); 13 | xy.y = P->rm * d * sin(lp.phi); 14 | return (xy); 15 | } 16 | FREEUP; if (P) pj_dalloc(P); } 17 | ENTRY0(hammer) 18 | if (pj_param(P->params, "tW").i) { 19 | if ((P->w = fabs(pj_param(P->params, "dW").f)) <= 0.) E_ERROR(-27); 20 | } else 21 | P->w = .5; 22 | if (pj_param(P->params, "tM").i) { 23 | if ((P->m = fabs(pj_param(P->params, "dM").f)) <= 0.) E_ERROR(-27); 24 | } else 25 | P->m = 1.; 26 | P->rm = 1. / P->m; 27 | P->m /= P->w; 28 | P->es = 0.; P->fwd = s_forward; 29 | ENDENTRY(P) 30 | -------------------------------------------------------------------------------- /Proj4/PJ_hatano.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | #include 3 | PROJ_HEAD(hatano, "Hatano Asymmetrical Equal Area") "\n\tPCyl, Sph."; 4 | #define NITER 20 5 | #define EPS 1e-7 6 | #define ONETOL 1.000001 7 | #define CN 2.67595 8 | #define CS 2.43763 9 | #define RCN 0.37369906014686373063 10 | #define RCS 0.41023453108141924738 11 | #define FYCN 1.75859 12 | #define FYCS 1.93052 13 | #define RYCN 0.56863737426006061674 14 | #define RYCS 0.51799515156538134803 15 | #define FXC 0.85 16 | #define RXC 1.17647058823529411764 17 | FORWARD(s_forward); /* spheroid */ 18 | double th1, c; 19 | int i; 20 | 21 | c = sin(lp.phi) * (lp.phi < 0. ? CS : CN); 22 | for (i = NITER; i; --i) { 23 | lp.phi -= th1 = (lp.phi + sin(lp.phi) - c) / (1. + cos(lp.phi)); 24 | if (fabs(th1) < EPS) break; 25 | } 26 | xy.x = FXC * lp.lam * cos(lp.phi *= .5); 27 | xy.y = sin(lp.phi) * (lp.phi < 0. ? FYCS : FYCN); 28 | return (xy); 29 | } 30 | INVERSE(s_inverse); /* spheroid */ 31 | double th; 32 | 33 | th = xy.y * ( xy.y < 0. ? RYCS : RYCN); 34 | if (fabs(th) > 1.) 35 | if (fabs(th) > ONETOL) I_ERROR 36 | else th = th > 0. ? HALFPI : - HALFPI; 37 | else 38 | th = asin(th); 39 | lp.lam = RXC * xy.x / cos(th); 40 | th += th; 41 | lp.phi = (th + sin(th)) * (xy.y < 0. ? RCS : RCN); 42 | if (fabs(lp.phi) > 1.) 43 | if (fabs(lp.phi) > ONETOL) I_ERROR 44 | else lp.phi = lp.phi > 0. ? HALFPI : - HALFPI; 45 | else 46 | lp.phi = asin(lp.phi); 47 | return (lp); 48 | } 49 | FREEUP; if (P) pj_dalloc(P); } 50 | ENTRY0(hatano) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 51 | -------------------------------------------------------------------------------- /Proj4/PJ_krovak.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/Proj4/PJ_krovak.c -------------------------------------------------------------------------------- /Proj4/PJ_lagrng.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double hrw; \ 3 | double rw; \ 4 | double a1; 5 | #define TOL 1e-10 6 | #define PJ_LIB__ 7 | #include 8 | PROJ_HEAD(lagrng, "Lagrange") "\n\tMisc Sph, no inv.\n\tW="; 9 | FORWARD(s_forward); /* spheroid */ 10 | double v, c; 11 | 12 | if (fabs(fabs(lp.phi) - HALFPI) < TOL) { 13 | xy.x = 0; 14 | xy.y = lp.phi < 0 ? -2. : 2.; 15 | } else { 16 | lp.phi = sin(lp.phi); 17 | v = P->a1 * pow((1. + lp.phi)/(1. - lp.phi), P->hrw); 18 | if ((c = 0.5 * (v + 1./v) + cos(lp.lam *= P->rw)) < TOL) 19 | F_ERROR; 20 | xy.x = 2. * sin(lp.lam) / c; 21 | xy.y = (v - 1./v) / c; 22 | } 23 | return (xy); 24 | } 25 | FREEUP; if (P) pj_dalloc(P); } 26 | ENTRY0(lagrng) 27 | double phi1; 28 | 29 | if ((P->rw = pj_param(P->params, "dW").f) <= 0) E_ERROR(-27); 30 | P->hrw = 0.5 * (P->rw = 1. / P->rw); 31 | phi1 = pj_param(P->params, "rlat_1").f; 32 | if (fabs(fabs(phi1 = sin(phi1)) - 1.) < TOL) E_ERROR(-22); 33 | P->a1 = pow((1. - phi1)/(1. + phi1), P->hrw); 34 | P->es = 0.; P->fwd = s_forward; 35 | ENDENTRY(P) 36 | -------------------------------------------------------------------------------- /Proj4/PJ_larr.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ 2 | #define PJ_LIB__ 3 | #include 4 | PROJ_HEAD(larr, "Larrivee") "\n\tMisc Sph, no inv."; 5 | #define SIXTH .16666666666666666 6 | FORWARD(s_forward); /* sphere */ 7 | xy.x = 0.5 * lp.lam * (1. + sqrt(cos(lp.phi))); 8 | xy.y = lp.phi / (cos(0.5 * lp.phi) * cos(SIXTH * lp.lam)); 9 | return (xy); 10 | } 11 | FREEUP; if (P) pj_dalloc(P); } 12 | ENTRY0(larr) P->fwd = s_forward; P->inv = 0; P->es = 0.; ENDENTRY(P) 13 | -------------------------------------------------------------------------------- /Proj4/PJ_lask.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ 2 | #define PJ_LIB__ 3 | #include 4 | PROJ_HEAD(lask, "Laskowski") "\n\tMisc Sph, no inv."; 5 | #define a10 0.975534 6 | #define a12 -0.119161 7 | #define a32 -0.0143059 8 | #define a14 -0.0547009 9 | #define b01 1.00384 10 | #define b21 0.0802894 11 | #define b03 0.0998909 12 | #define b41 0.000199025 13 | #define b23 -0.0285500 14 | #define b05 -0.0491032 15 | FORWARD(s_forward); /* sphere */ 16 | double l2, p2; 17 | 18 | l2 = lp.lam * lp.lam; 19 | p2 = lp.phi * lp.phi; 20 | xy.x = lp.lam * (a10 + p2 * (a12 + l2 * a32 + p2 * a14)); 21 | xy.y = lp.phi * (b01 + l2 * (b21 + p2 * b23 + l2 * b41) + 22 | p2 * (b03 + p2 * b05)); 23 | return (xy); 24 | } 25 | FREEUP; if (P) pj_dalloc(P); } 26 | ENTRY0(lask) P->fwd = s_forward; P->inv = 0; P->es = 0.; ENDENTRY(P) 27 | -------------------------------------------------------------------------------- /Proj4/PJ_lcca.c: -------------------------------------------------------------------------------- 1 | static const char RCS_ID[] = "$Id: PJ_lcca.c 1504 2009-01-06 02:11:57Z warmerdam $"; 2 | /* PROJ.4 Cartographic Projection System 3 | */ 4 | #define MAX_ITER 10 5 | #define DEL_TOL 1e-12 6 | #define PROJ_PARMS__ \ 7 | double *en; \ 8 | double r0, l, M0; \ 9 | double C; 10 | #define PJ_LIB__ 11 | #include 12 | 13 | PROJ_HEAD(lcca, "Lambert Conformal Conic Alternative") 14 | "\n\tConic, Sph&Ell\n\tlat_0="; 15 | 16 | static double /* func to compute dr */ 17 | fS(double S, double C) { 18 | return(S * ( 1. + S * S * C)); 19 | } 20 | static double /* deriv of fs */ 21 | fSp(double S, double C) { 22 | return(1. + 3.* S * S * C); 23 | } 24 | FORWARD(e_forward); /* ellipsoid */ 25 | double S, S3, r, dr; 26 | 27 | S = pj_mlfn(lp.phi, sin(lp.phi), cos(lp.phi), P->en) - P->M0; 28 | dr = fS(S, P->C); 29 | r = P->r0 - dr; 30 | xy.x = P->k0 * (r * sin( lp.lam *= P->l ) ); 31 | xy.y = P->k0 * (P->r0 - r * cos(lp.lam) ); 32 | return (xy); 33 | } 34 | INVERSE(e_inverse); /* ellipsoid & spheroid */ 35 | double theta, dr, S, dif; 36 | int i; 37 | 38 | xy.x /= P->k0; 39 | xy.y /= P->k0; 40 | theta = atan2(xy.x , P->r0 - xy.y); 41 | dr = xy.y - xy.x * tan(0.5 * theta); 42 | lp.lam = theta / P->l; 43 | S = dr; 44 | for (i = MAX_ITER; i ; --i) { 45 | S -= (dif = (fS(S, P->C) - dr) / fSp(S, P->C)); 46 | if (fabs(dif) < DEL_TOL) break; 47 | } 48 | if (!i) I_ERROR 49 | lp.phi = pj_inv_mlfn(S + P->M0, P->es, P->en); 50 | return (lp); 51 | } 52 | FREEUP; if (P) { if (P->en) pj_dalloc(P->en); pj_dalloc(P); } } 53 | ENTRY0(lcca) 54 | double s2p0, N0, R0, tan0, tan20; 55 | 56 | if (!(P->en = pj_enfn(P->es))) E_ERROR_0; 57 | if (!pj_param(P->params, "tlat_0").i) E_ERROR(50); 58 | if (P->phi0 == 0.) E_ERROR(51); 59 | P->l = sin(P->phi0); 60 | P->M0 = pj_mlfn(P->phi0, P->l, cos(P->phi0), P->en); 61 | s2p0 = P->l * P->l; 62 | R0 = 1. / (1. - P->es * s2p0); 63 | N0 = sqrt(R0); 64 | R0 *= P->one_es * N0; 65 | tan0 = tan(P->phi0); 66 | tan20 = tan0 * tan0; 67 | P->r0 = N0 / tan0; 68 | P->C = 1. / (6. * R0 * N0); 69 | P->inv = e_inverse; 70 | P->fwd = e_forward; 71 | ENDENTRY(P) 72 | 73 | -------------------------------------------------------------------------------- /Proj4/PJ_loxim.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double phi1; \ 3 | double cosphi1; \ 4 | double tanphi1; 5 | #define PJ_LIB__ 6 | #include 7 | PROJ_HEAD(loxim, "Loximuthal") "\n\tPCyl Sph"; 8 | #define EPS 1e-8 9 | FORWARD(s_forward); /* spheroid */ 10 | xy.y = lp.phi - P->phi1; 11 | if (fabs(xy.y) < EPS) 12 | xy.x = lp.lam * P->cosphi1; 13 | else { 14 | xy.x = FORTPI + 0.5 * lp.phi; 15 | if (fabs(xy.x) < EPS || fabs(fabs(xy.x) - HALFPI) < EPS) 16 | xy.x = 0.; 17 | else 18 | xy.x = lp.lam * xy.y / log( tan(xy.x) / P->tanphi1 ); 19 | } 20 | return (xy); 21 | } 22 | INVERSE(s_inverse); /* spheroid */ 23 | lp.phi = xy.y + P->phi1; 24 | if (fabs(xy.y) < EPS) 25 | lp.lam = xy.x / P->cosphi1; 26 | else 27 | if (fabs( lp.lam = FORTPI + 0.5 * lp.phi ) < EPS || 28 | fabs(fabs(lp.lam) - HALFPI) < EPS) 29 | lp.lam = 0.; 30 | else 31 | lp.lam = xy.x * log( tan(lp.lam) / P->tanphi1 ) / xy.y ; 32 | return (lp); 33 | } 34 | FREEUP; if (P) pj_dalloc(P); } 35 | ENTRY0(loxim); 36 | P->phi1 = pj_param(P->params, "rlat_1").f; 37 | if ((P->cosphi1 = cos(P->phi1)) < EPS) E_ERROR(-22); 38 | P->tanphi1 = tan(FORTPI + 0.5 * P->phi1); 39 | P->inv = s_inverse; P->fwd = s_forward; 40 | P->es = 0.; 41 | ENDENTRY(P) 42 | -------------------------------------------------------------------------------- /Proj4/PJ_mbt_fps.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | #include 3 | PROJ_HEAD(mbt_fps, "McBryde-Thomas Flat-Pole Sine (No. 2)") "\n\tCyl., Sph."; 4 | #define MAX_ITER 10 5 | #define LOOP_TOL 1e-7 6 | #define C1 0.45503 7 | #define C2 1.36509 8 | #define C3 1.41546 9 | #define C_x 0.22248 10 | #define C_y 1.44492 11 | #define C1_2 0.33333333333333333333333333 12 | FORWARD(s_forward); /* spheroid */ 13 | double k, V, t; 14 | int i; 15 | 16 | k = C3 * sin(lp.phi); 17 | for (i = MAX_ITER; i ; --i) { 18 | t = lp.phi / C2; 19 | lp.phi -= V = (C1 * sin(t) + sin(lp.phi) - k) / 20 | (C1_2 * cos(t) + cos(lp.phi)); 21 | if (fabs(V) < LOOP_TOL) 22 | break; 23 | } 24 | t = lp.phi / C2; 25 | xy.x = C_x * lp.lam * (1. + 3. * cos(lp.phi)/cos(t) ); 26 | xy.y = C_y * sin(t); 27 | return (xy); 28 | } 29 | INVERSE(s_inverse); /* spheroid */ 30 | double t, s; 31 | 32 | lp.phi = C2 * (t = aasin(xy.y / C_y)); 33 | lp.lam = xy.x / (C_x * (1. + 3. * cos(lp.phi)/cos(t))); 34 | lp.phi = aasin((C1 * sin(t) + sin(lp.phi)) / C3); 35 | return (lp); 36 | } 37 | FREEUP; if (P) pj_dalloc(P); } 38 | ENTRY0(mbt_fps) P->es = 0; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 39 | -------------------------------------------------------------------------------- /Proj4/PJ_mbtfpp.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | #include 3 | PROJ_HEAD(mbtfpp, "McBride-Thomas Flat-Polar Parabolic") "\n\tCyl., Sph."; 4 | #define CS .95257934441568037152 5 | #define FXC .92582009977255146156 6 | #define FYC 3.40168025708304504493 7 | #define C23 .66666666666666666666 8 | #define C13 .33333333333333333333 9 | #define ONEEPS 1.0000001 10 | FORWARD(s_forward); /* spheroid */ 11 | lp.phi = asin(CS * sin(lp.phi)); 12 | xy.x = FXC * lp.lam * (2. * cos(C23 * lp.phi) - 1.); 13 | xy.y = FYC * sin(C13 * lp.phi); 14 | return (xy); 15 | } 16 | INVERSE(s_inverse); /* spheroid */ 17 | lp.phi = xy.y / FYC; 18 | if (fabs(lp.phi) >= 1.) { 19 | if (fabs(lp.phi) > ONEEPS) I_ERROR 20 | else lp.phi = (lp.phi < 0.) ? -HALFPI : HALFPI; 21 | } else 22 | lp.phi = asin(lp.phi); 23 | lp.lam = xy.x / ( FXC * (2. * cos(C23 * (lp.phi *= 3.)) - 1.) ); 24 | if (fabs(lp.phi = sin(lp.phi) / CS) >= 1.) { 25 | if (fabs(lp.phi) > ONEEPS) I_ERROR 26 | else lp.phi = (lp.phi < 0.) ? -HALFPI : HALFPI; 27 | } else 28 | lp.phi = asin(lp.phi); 29 | return (lp); 30 | } 31 | FREEUP; if (P) pj_dalloc(P); } 32 | ENTRY0(mbtfpp) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 33 | -------------------------------------------------------------------------------- /Proj4/PJ_mbtfpq.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | #include 3 | PROJ_HEAD(mbtfpq, "McBryde-Thomas Flat-Polar Quartic") "\n\tCyl., Sph."; 4 | #define NITER 20 5 | #define EPS 1e-7 6 | #define ONETOL 1.000001 7 | #define C 1.70710678118654752440 8 | #define RC 0.58578643762690495119 9 | #define FYC 1.87475828462269495505 10 | #define RYC 0.53340209679417701685 11 | #define FXC 0.31245971410378249250 12 | #define RXC 3.20041258076506210122 13 | FORWARD(s_forward); /* spheroid */ 14 | double th1, c; 15 | int i; 16 | 17 | c = C * sin(lp.phi); 18 | for (i = NITER; i; --i) { 19 | lp.phi -= th1 = (sin(.5*lp.phi) + sin(lp.phi) - c) / 20 | (.5*cos(.5*lp.phi) + cos(lp.phi)); 21 | if (fabs(th1) < EPS) break; 22 | } 23 | xy.x = FXC * lp.lam * (1.0 + 2. * cos(lp.phi)/cos(0.5 * lp.phi)); 24 | xy.y = FYC * sin(0.5 * lp.phi); 25 | return (xy); 26 | } 27 | INVERSE(s_inverse); /* spheroid */ 28 | double t; 29 | 30 | lp.phi = RYC * xy.y; 31 | if (fabs(lp.phi) > 1.) { 32 | if (fabs(lp.phi) > ONETOL) I_ERROR 33 | else if (lp.phi < 0.) { t = -1.; lp.phi = -PI; } 34 | else { t = 1.; lp.phi = PI; } 35 | } else 36 | lp.phi = 2. * asin(t = lp.phi); 37 | lp.lam = RXC * xy.x / (1. + 2. * cos(lp.phi)/cos(0.5 * lp.phi)); 38 | lp.phi = RC * (t + sin(lp.phi)); 39 | if (fabs(lp.phi) > 1.) 40 | if (fabs(lp.phi) > ONETOL) I_ERROR 41 | else lp.phi = lp.phi < 0. ? -HALFPI : HALFPI; 42 | else 43 | lp.phi = asin(lp.phi); 44 | return (lp); 45 | } 46 | FREEUP; if (P) pj_dalloc(P); } 47 | ENTRY0(mbtfpq) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 48 | -------------------------------------------------------------------------------- /Proj4/PJ_merc.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | #include 3 | PROJ_HEAD(merc, "Mercator") "\n\tCyl, Sph&Ell\n\tlat_ts="; 4 | #define EPS10 1.e-10 5 | FORWARD(e_forward); /* ellipsoid */ 6 | if (fabs(fabs(lp.phi) - HALFPI) <= EPS10) F_ERROR; 7 | xy.x = P->k0 * lp.lam; 8 | xy.y = - P->k0 * log(pj_tsfn(lp.phi, sin(lp.phi), P->e)); 9 | return (xy); 10 | } 11 | FORWARD(s_forward); /* spheroid */ 12 | if (fabs(fabs(lp.phi) - HALFPI) <= EPS10) F_ERROR; 13 | xy.x = P->k0 * lp.lam; 14 | xy.y = P->k0 * log(tan(FORTPI + .5 * lp.phi)); 15 | return (xy); 16 | } 17 | INVERSE(e_inverse); /* ellipsoid */ 18 | if ((lp.phi = pj_phi2(exp(- xy.y / P->k0), P->e)) == HUGE_VAL) I_ERROR; 19 | lp.lam = xy.x / P->k0; 20 | return (lp); 21 | } 22 | INVERSE(s_inverse); /* spheroid */ 23 | lp.phi = HALFPI - 2. * atan(exp(-xy.y / P->k0)); 24 | lp.lam = xy.x / P->k0; 25 | return (lp); 26 | } 27 | FREEUP; if (P) pj_dalloc(P); } 28 | ENTRY0(merc) 29 | double phits=0.0; 30 | int is_phits; 31 | 32 | if( (is_phits = pj_param(P->params, "tlat_ts").i) ) { 33 | phits = fabs(pj_param(P->params, "rlat_ts").f); 34 | if (phits >= HALFPI) E_ERROR(-24); 35 | } 36 | if (P->es) { /* ellipsoid */ 37 | if (is_phits) 38 | P->k0 = pj_msfn(sin(phits), cos(phits), P->es); 39 | P->inv = e_inverse; 40 | P->fwd = e_forward; 41 | } else { /* sphere */ 42 | if (is_phits) 43 | P->k0 = cos(phits); 44 | P->inv = s_inverse; 45 | P->fwd = s_forward; 46 | } 47 | ENDENTRY(P) 48 | -------------------------------------------------------------------------------- /Proj4/PJ_mill.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | # include 3 | PROJ_HEAD(mill, "Miller Cylindrical") "\n\tCyl, Sph"; 4 | FORWARD(s_forward); /* spheroid */ 5 | xy.x = lp.lam; 6 | xy.y = log(tan(FORTPI + lp.phi * .4)) * 1.25; 7 | return (xy); 8 | } 9 | INVERSE(s_inverse); /* spheroid */ 10 | lp.lam = xy.x; 11 | lp.phi = 2.5 * (atan(exp(.8 * xy.y)) - FORTPI); 12 | return (lp); 13 | } 14 | FREEUP; if (P) pj_dalloc(P); } 15 | ENTRY0(mill) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 16 | -------------------------------------------------------------------------------- /Proj4/PJ_moll.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double C_x, C_y, C_p; 3 | #define PJ_LIB__ 4 | #include 5 | PROJ_HEAD(moll, "Mollweide") "\n\tPCyl., Sph."; 6 | PROJ_HEAD(wag4, "Wagner IV") "\n\tPCyl., Sph."; 7 | PROJ_HEAD(wag5, "Wagner V") "\n\tPCyl., Sph."; 8 | #define MAX_ITER 10 9 | #define LOOP_TOL 1e-7 10 | FORWARD(s_forward); /* spheroid */ 11 | double k, V; 12 | int i; 13 | 14 | k = P->C_p * sin(lp.phi); 15 | for (i = MAX_ITER; i ; --i) { 16 | lp.phi -= V = (lp.phi + sin(lp.phi) - k) / 17 | (1. + cos(lp.phi)); 18 | if (fabs(V) < LOOP_TOL) 19 | break; 20 | } 21 | if (!i) 22 | lp.phi = (lp.phi < 0.) ? -HALFPI : HALFPI; 23 | else 24 | lp.phi *= 0.5; 25 | xy.x = P->C_x * lp.lam * cos(lp.phi); 26 | xy.y = P->C_y * sin(lp.phi); 27 | return (xy); 28 | } 29 | INVERSE(s_inverse); /* spheroid */ 30 | double th, s; 31 | 32 | lp.phi = aasin(xy.y / P->C_y); 33 | lp.lam = xy.x / (P->C_x * cos(lp.phi)); 34 | lp.phi += lp.phi; 35 | lp.phi = aasin((lp.phi + sin(lp.phi)) / P->C_p); 36 | return (lp); 37 | } 38 | FREEUP; if (P) pj_dalloc(P); } 39 | static PJ * 40 | setup(PJ *P, double p) { 41 | double r, sp, p2 = p + p; 42 | 43 | P->es = 0; 44 | sp = sin(p); 45 | r = sqrt(TWOPI * sp / (p2 + sin(p2))); 46 | P->C_x = 2. * r / PI; 47 | P->C_y = r / sp; 48 | P->C_p = p2 + sin(p2); 49 | P->inv = s_inverse; 50 | P->fwd = s_forward; 51 | return P; 52 | } 53 | ENTRY0(moll) ENDENTRY(setup(P, HALFPI)) 54 | ENTRY0(wag4) ENDENTRY(setup(P, PI/3.)) 55 | ENTRY0(wag5) 56 | P->es = 0; 57 | P->C_x = 0.90977; 58 | P->C_y = 1.65014; 59 | P->C_p = 3.00896; 60 | P->inv = s_inverse; 61 | P->fwd = s_forward; 62 | ENDENTRY(P) 63 | -------------------------------------------------------------------------------- /Proj4/PJ_nell.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | #include 3 | PROJ_HEAD(nell, "Nell") "\n\tPCyl., Sph."; 4 | #define MAX_ITER 10 5 | #define LOOP_TOL 1e-7 6 | FORWARD(s_forward); /* spheroid */ 7 | double k, V; 8 | int i; 9 | 10 | k = 2. * sin(lp.phi); 11 | V = lp.phi * lp.phi; 12 | lp.phi *= 1.00371 + V * (-0.0935382 + V * -0.011412); 13 | for (i = MAX_ITER; i ; --i) { 14 | lp.phi -= V = (lp.phi + sin(lp.phi) - k) / 15 | (1. + cos(lp.phi)); 16 | if (fabs(V) < LOOP_TOL) 17 | break; 18 | } 19 | xy.x = 0.5 * lp.lam * (1. + cos(lp.phi)); 20 | xy.y = lp.phi; 21 | return (xy); 22 | } 23 | INVERSE(s_inverse); /* spheroid */ 24 | double th, s; 25 | 26 | lp.lam = 2. * xy.x / (1. + cos(xy.y)); 27 | lp.phi = aasin(0.5 * (xy.y + sin(xy.y))); 28 | return (lp); 29 | } 30 | FREEUP; if (P) pj_dalloc(P); } 31 | ENTRY0(nell) P->es = 0; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 32 | -------------------------------------------------------------------------------- /Proj4/PJ_nell_h.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | # include 3 | PROJ_HEAD(nell_h, "Nell-Hammer") "\n\tPCyl., Sph."; 4 | #define NITER 9 5 | #define EPS 1e-7 6 | FORWARD(s_forward); /* spheroid */ 7 | xy.x = 0.5 * lp.lam * (1. + cos(lp.phi)); 8 | xy.y = 2.0 * (lp.phi - tan(0.5 *lp.phi)); 9 | return (xy); 10 | } 11 | INVERSE(s_inverse); /* spheroid */ 12 | double V, c, p; 13 | int i; 14 | 15 | p = 0.5 * xy.y; 16 | for (i = NITER; i ; --i) { 17 | c = cos(0.5 * lp.phi); 18 | lp.phi -= V = (lp.phi - tan(lp.phi/2) - p)/(1. - 0.5/(c*c)); 19 | if (fabs(V) < EPS) 20 | break; 21 | } 22 | if (!i) { 23 | lp.phi = p < 0. ? -HALFPI : HALFPI; 24 | lp.lam = 2. * xy.x; 25 | } else 26 | lp.lam = 2. * xy.x / (1. + cos(lp.phi)); 27 | return (lp); 28 | } 29 | FREEUP; if (P) pj_dalloc(P); } 30 | ENTRY0(nell_h) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 31 | -------------------------------------------------------------------------------- /Proj4/PJ_nocol.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | #include 3 | PROJ_HEAD(nicol, "Nicolosi Globular") "\n\tMisc Sph, no inv."; 4 | #define EPS 1e-10 5 | FORWARD(s_forward); /* spheroid */ 6 | if (fabs(lp.lam) < EPS) { 7 | xy.x = 0; 8 | xy.y = lp.phi; 9 | } else if (fabs(lp.phi) < EPS) { 10 | xy.x = lp.lam; 11 | xy.y = 0.; 12 | } else if (fabs(fabs(lp.lam) - HALFPI) < EPS) { 13 | xy.x = lp.lam * cos(lp.phi); 14 | xy.y = HALFPI * sin(lp.phi); 15 | } else if (fabs(fabs(lp.phi) - HALFPI) < EPS) { 16 | xy.x = 0; 17 | xy.y = lp.phi; 18 | } else { 19 | double tb, c, d, m, n, r2, sp; 20 | 21 | tb = HALFPI / lp.lam - lp.lam / HALFPI; 22 | c = lp.phi / HALFPI; 23 | d = (1 - c * c)/((sp = sin(lp.phi)) - c); 24 | r2 = tb / d; 25 | r2 *= r2; 26 | m = (tb * sp / d - 0.5 * tb)/(1. + r2); 27 | n = (sp / r2 + 0.5 * d)/(1. + 1./r2); 28 | xy.x = cos(lp.phi); 29 | xy.x = sqrt(m * m + xy.x * xy.x / (1. + r2)); 30 | xy.x = HALFPI * ( m + (lp.lam < 0. ? -xy.x : xy.x)); 31 | xy.y = sqrt(n * n - (sp * sp / r2 + d * sp - 1.) / 32 | (1. + 1./r2)); 33 | xy.y = HALFPI * ( n + (lp.phi < 0. ? xy.y : -xy.y )); 34 | } 35 | return (xy); 36 | } 37 | FREEUP; if (P) pj_dalloc(P); } 38 | ENTRY0(nicol) P->es = 0.; P->fwd = s_forward; ENDENTRY(P) 39 | -------------------------------------------------------------------------------- /Proj4/PJ_ocea.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double rok; \ 3 | double rtk; \ 4 | double sinphi; \ 5 | double cosphi; \ 6 | double singam; \ 7 | double cosgam; 8 | #define PJ_LIB__ 9 | #include 10 | PROJ_HEAD(ocea, "Oblique Cylindrical Equal Area") "\n\tCyl, Sph" 11 | "lonc= alpha= or\n\tlat_1= lat_2= lon_1= lon_2="; 12 | FORWARD(s_forward); /* spheroid */ 13 | double t; 14 | 15 | xy.y = sin(lp.lam); 16 | /* 17 | xy.x = atan2((tan(lp.phi) * P->cosphi + P->sinphi * xy.y) , cos(lp.lam)); 18 | */ 19 | t = cos(lp.lam); 20 | xy.x = atan((tan(lp.phi) * P->cosphi + P->sinphi * xy.y) / t); 21 | if (t < 0.) 22 | xy.x += PI; 23 | xy.x *= P->rtk; 24 | xy.y = P->rok * (P->sinphi * sin(lp.phi) - P->cosphi * cos(lp.phi) * xy.y); 25 | return (xy); 26 | } 27 | INVERSE(s_inverse); /* spheroid */ 28 | double t, s; 29 | 30 | xy.y /= P->rok; 31 | xy.x /= P->rtk; 32 | t = sqrt(1. - xy.y * xy.y); 33 | lp.phi = asin(xy.y * P->sinphi + t * P->cosphi * (s = sin(xy.x))); 34 | lp.lam = atan2(t * P->sinphi * s - xy.y * P->cosphi, 35 | t * cos(xy.x)); 36 | return (lp); 37 | } 38 | FREEUP; if (P) pj_dalloc(P); } 39 | ENTRY0(ocea) 40 | double phi_0=0.0, phi_1, phi_2, lam_1, lam_2, lonz, alpha; 41 | 42 | P->rok = P->a / P->k0; 43 | P->rtk = P->a * P->k0; 44 | if ( pj_param(P->params, "talpha").i) { 45 | alpha = pj_param(P->params, "ralpha").f; 46 | lonz = pj_param(P->params, "rlonc").f; 47 | P->singam = atan(-cos(alpha)/(-sin(phi_0) * sin(alpha))) + lonz; 48 | P->sinphi = asin(cos(phi_0) * sin(alpha)); 49 | } else { 50 | phi_1 = pj_param(P->params, "rlat_1").f; 51 | phi_2 = pj_param(P->params, "rlat_2").f; 52 | lam_1 = pj_param(P->params, "rlon_1").f; 53 | lam_2 = pj_param(P->params, "rlon_2").f; 54 | P->singam = atan2(cos(phi_1) * sin(phi_2) * cos(lam_1) - 55 | sin(phi_1) * cos(phi_2) * cos(lam_2), 56 | sin(phi_1) * cos(phi_2) * sin(lam_2) - 57 | cos(phi_1) * sin(phi_2) * sin(lam_1) ); 58 | P->sinphi = atan(-cos(P->singam - lam_1) / tan(phi_1)); 59 | } 60 | P->lam0 = P->singam + HALFPI; 61 | P->cosphi = cos(P->sinphi); 62 | P->sinphi = sin(P->sinphi); 63 | P->cosgam = cos(P->singam); 64 | P->singam = sin(P->singam); 65 | P->inv = s_inverse; 66 | P->fwd = s_forward; 67 | P->es = 0.; 68 | ENDENTRY(P) 69 | -------------------------------------------------------------------------------- /Proj4/PJ_oea.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double theta; \ 3 | double m, n; \ 4 | double two_r_m, two_r_n, rm, rn, hm, hn; \ 5 | double cp0, sp0; 6 | #define PJ_LIB__ 7 | #include 8 | PROJ_HEAD(oea, "Oblated Equal Area") "\n\tMisc Sph\n\tn= m= theta="; 9 | FORWARD(s_forward); /* sphere */ 10 | double Az, M, N, cp, sp, cl, shz; 11 | 12 | cp = cos(lp.phi); 13 | sp = sin(lp.phi); 14 | cl = cos(lp.lam); 15 | Az = aatan2(cp * sin(lp.lam), P->cp0 * sp - P->sp0 * cp * cl) + P->theta; 16 | shz = sin(0.5 * aacos(P->sp0 * sp + P->cp0 * cp * cl)); 17 | M = aasin(shz * sin(Az)); 18 | N = aasin(shz * cos(Az) * cos(M) / cos(M * P->two_r_m)); 19 | xy.y = P->n * sin(N * P->two_r_n); 20 | xy.x = P->m * sin(M * P->two_r_m) * cos(N) / cos(N * P->two_r_n); 21 | return (xy); 22 | } 23 | INVERSE(s_inverse); /* sphere */ 24 | double N, M, xp, yp, z, Az, cz, sz, cAz; 25 | 26 | N = P->hn * aasin(xy.y * P->rn); 27 | M = P->hm * aasin(xy.x * P->rm * cos(N * P->two_r_n) / cos(N)); 28 | xp = 2. * sin(M); 29 | yp = 2. * sin(N) * cos(M * P->two_r_m) / cos(M); 30 | cAz = cos(Az = aatan2(xp, yp) - P->theta); 31 | z = 2. * aasin(0.5 * hypot(xp, yp)); 32 | sz = sin(z); 33 | cz = cos(z); 34 | lp.phi = aasin(P->sp0 * cz + P->cp0 * sz * cAz); 35 | lp.lam = aatan2(sz * sin(Az), 36 | P->cp0 * cz - P->sp0 * sz * cAz); 37 | return (lp); 38 | } 39 | FREEUP; if (P) pj_dalloc(P); } 40 | ENTRY0(oea) 41 | if (((P->n = pj_param(P->params, "dn").f) <= 0.) || 42 | ((P->m = pj_param(P->params, "dm").f) <= 0.)) 43 | E_ERROR(-39) 44 | else { 45 | P->theta = pj_param(P->params, "rtheta").f; 46 | P->sp0 = sin(P->phi0); 47 | P->cp0 = cos(P->phi0); 48 | P->rn = 1./ P->n; 49 | P->rm = 1./ P->m; 50 | P->two_r_n = 2. * P->rn; 51 | P->two_r_m = 2. * P->rm; 52 | P->hm = 0.5 * P->m; 53 | P->hn = 0.5 * P->n; 54 | P->fwd = s_forward; 55 | P->inv = s_inverse; 56 | P->es = 0.; 57 | } 58 | ENDENTRY(P) 59 | -------------------------------------------------------------------------------- /Proj4/PJ_putp2.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | #include 3 | PROJ_HEAD(putp2, "Putnins P2") "\n\tPCyl., Sph."; 4 | #define C_x 1.89490 5 | #define C_y 1.71848 6 | #define C_p 0.6141848493043784 7 | #define EPS 1e-10 8 | #define NITER 10 9 | #define PI_DIV_3 1.0471975511965977 10 | FORWARD(s_forward); /* spheroid */ 11 | double p, c, s, V; 12 | int i; 13 | 14 | p = C_p * sin(lp.phi); 15 | s = lp.phi * lp.phi; 16 | lp.phi *= 0.615709 + s * ( 0.00909953 + s * 0.0046292 ); 17 | for (i = NITER; i ; --i) { 18 | c = cos(lp.phi); 19 | s = sin(lp.phi); 20 | lp.phi -= V = (lp.phi + s * (c - 1.) - p) / 21 | (1. + c * (c - 1.) - s * s); 22 | if (fabs(V) < EPS) 23 | break; 24 | } 25 | if (!i) 26 | lp.phi = lp.phi < 0 ? - PI_DIV_3 : PI_DIV_3; 27 | xy.x = C_x * lp.lam * (cos(lp.phi) - 0.5); 28 | xy.y = C_y * sin(lp.phi); 29 | return (xy); 30 | } 31 | INVERSE(s_inverse); /* spheroid */ 32 | double c; 33 | 34 | lp.phi = aasin(xy.y / C_y); 35 | lp.lam = xy.x / (C_x * ((c = cos(lp.phi)) - 0.5)); 36 | lp.phi = aasin((lp.phi + sin(lp.phi) * (c - 1.)) / C_p); 37 | return (lp); 38 | } 39 | FREEUP; if (P) pj_dalloc(P); } 40 | ENTRY0(putp2) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 41 | -------------------------------------------------------------------------------- /Proj4/PJ_putp3.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double A; 3 | #define PJ_LIB__ 4 | # include 5 | PROJ_HEAD(putp3, "Putnins P3") "\n\tPCyl., Sph."; 6 | PROJ_HEAD(putp3p, "Putnins P3'") "\n\tPCyl., no inv., Sph."; 7 | #define C 0.79788456 8 | #define RPISQ 0.1013211836 9 | FORWARD(s_forward); /* spheroid */ 10 | xy.x = C * lp.lam * (1. - P->A * lp.phi * lp.phi); 11 | xy.y = C * lp.phi; 12 | return (xy); 13 | } 14 | INVERSE(s_inverse); /* spheroid */ 15 | lp.phi = xy.y / C; 16 | lp.lam = xy.x / (C * (1. - P->A * lp.phi * lp.phi)); 17 | return (lp); 18 | } 19 | FREEUP; if (P) pj_dalloc(P); } 20 | static PJ * 21 | setup(PJ *P) { 22 | P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; 23 | return P; 24 | } 25 | ENTRY0(putp3) P->A = 4. * RPISQ; ENDENTRY(setup(P)) 26 | ENTRY0(putp3p) P->A = 2. * RPISQ; ENDENTRY(setup(P)) 27 | -------------------------------------------------------------------------------- /Proj4/PJ_putp4p.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double C_x, C_y; 3 | #define PJ_LIB__ 4 | # include 5 | PROJ_HEAD(putp4p, "Putnins P4'") "\n\tPCyl., Sph."; 6 | PROJ_HEAD(weren, "Werenskiold I") "\n\tPCyl., Sph."; 7 | FORWARD(s_forward); /* spheroid */ 8 | lp.phi = aasin(0.883883476 * sin(lp.phi)); 9 | xy.x = P->C_x * lp.lam * cos(lp.phi); 10 | xy.x /= cos(lp.phi *= 0.333333333333333); 11 | xy.y = P->C_y * sin(lp.phi); 12 | return (xy); 13 | } 14 | INVERSE(s_inverse); /* spheroid */ 15 | lp.phi = aasin(xy.y / P->C_y); 16 | lp.lam = xy.x * cos(lp.phi) / P->C_x; 17 | lp.phi *= 3.; 18 | lp.lam /= cos(lp.phi); 19 | lp.phi = aasin(1.13137085 * sin(lp.phi)); 20 | return (lp); 21 | } 22 | FREEUP; if (P) pj_dalloc(P); } 23 | static PJ * 24 | setup(PJ *P) { 25 | P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; 26 | return P; 27 | } 28 | ENTRY0(putp4p) P->C_x = 0.874038744; P->C_y = 3.883251825; ENDENTRY(setup(P)) 29 | ENTRY0(weren) P->C_x = 1.; P->C_y = 4.442882938; ENDENTRY(setup(P)) 30 | -------------------------------------------------------------------------------- /Proj4/PJ_putp5.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double A, B; 3 | #define PJ_LIB__ 4 | # include 5 | PROJ_HEAD(putp5, "Putnins P5") "\n\tPCyl., Sph."; 6 | PROJ_HEAD(putp5p, "Putnins P5'") "\n\tPCyl., Sph."; 7 | #define C 1.01346 8 | #define D 1.2158542 9 | FORWARD(s_forward); /* spheroid */ 10 | xy.x = C * lp.lam * (P->A - P->B * sqrt(1. + D * lp.phi * lp.phi)); 11 | xy.y = C * lp.phi; 12 | return (xy); 13 | } 14 | INVERSE(s_inverse); /* spheroid */ 15 | lp.phi = xy.y / C; 16 | lp.lam = xy.x / (C * (P->A - P->B * sqrt(1. + D * lp.phi * lp.phi))); 17 | return (lp); 18 | } 19 | FREEUP; if (P) pj_dalloc(P); } 20 | static PJ * 21 | setup(PJ *P) { 22 | P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; 23 | return P; 24 | } 25 | ENTRY0(putp5) P->A = 2.; P->B = 1.; ENDENTRY(setup(P)) 26 | ENTRY0(putp5p) P->A = 1.5; P->B = 0.5; ENDENTRY(setup(P)) 27 | -------------------------------------------------------------------------------- /Proj4/PJ_putp6.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double C_x, C_y, A, B, D; 3 | #define PJ_LIB__ 4 | #include 5 | PROJ_HEAD(putp6, "Putnins P6") "\n\tPCyl., Sph."; 6 | PROJ_HEAD(putp6p, "Putnins P6'") "\n\tPCyl., Sph."; 7 | #define EPS 1e-10 8 | #define NITER 10 9 | #define CON_POLE 1.732050807568877 10 | FORWARD(s_forward); /* spheroid */ 11 | double p, r, V; 12 | int i; 13 | 14 | p = P->B * sin(lp.phi); 15 | lp.phi *= 1.10265779; 16 | for (i = NITER; i ; --i) { 17 | r = sqrt(1. + lp.phi * lp.phi); 18 | lp.phi -= V = ( (P->A - r) * lp.phi - log(lp.phi + r) - p ) / 19 | (P->A - 2. * r); 20 | if (fabs(V) < EPS) 21 | break; 22 | } 23 | if (!i) 24 | lp.phi = p < 0. ? -CON_POLE : CON_POLE; 25 | xy.x = P->C_x * lp.lam * (P->D - sqrt(1. + lp.phi * lp.phi)); 26 | xy.y = P->C_y * lp.phi; 27 | return (xy); 28 | } 29 | INVERSE(s_inverse); /* spheroid */ 30 | double r; 31 | 32 | lp.phi = xy.y / P->C_y; 33 | r = sqrt(1. + lp.phi * lp.phi); 34 | lp.lam = xy.x / (P->C_x * (P->D - r)); 35 | lp.phi = aasin( ( (P->A - r) * lp.phi - log(lp.phi + r) ) / P->B); 36 | return (lp); 37 | } 38 | FREEUP; if (P) pj_dalloc(P); } 39 | static PJ * 40 | setup(PJ *P) { 41 | P->es = 0.; 42 | P->inv = s_inverse; 43 | P->fwd = s_forward; 44 | return P; 45 | } 46 | ENTRY0(putp6) 47 | P->C_x = 1.01346; 48 | P->C_y = 0.91910; 49 | P->A = 4.; 50 | P->B = 2.1471437182129378784; 51 | P->D = 2.; 52 | ENDENTRY(setup(P)) 53 | ENTRY0(putp6p) 54 | P->C_x = 0.44329; 55 | P->C_y = 0.80404; 56 | P->A = 6.; 57 | P->B = 5.61125; 58 | P->D = 3.; 59 | ENDENTRY(setup(P)) 60 | -------------------------------------------------------------------------------- /Proj4/PJ_rpoly.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double phi1; \ 3 | double fxa; \ 4 | double fxb; \ 5 | int mode; 6 | #define EPS 1e-9 7 | #define PJ_LIB__ 8 | #include 9 | PROJ_HEAD(rpoly, "Rectangular Polyconic") 10 | "\n\tConic, Sph., no inv.\n\tlat_ts="; 11 | FORWARD(s_forward); /* spheroid */ 12 | double fa; 13 | 14 | if (P->mode) 15 | fa = tan(lp.lam * P->fxb) * P->fxa; 16 | else 17 | fa = 0.5 * lp.lam; 18 | if (fabs(lp.phi) < EPS) { 19 | xy.x = fa + fa; 20 | xy.y = - P->phi0; 21 | } else { 22 | xy.y = 1. / tan(lp.phi); 23 | xy.x = sin(fa = 2. * atan(fa * sin(lp.phi))) * xy.y; 24 | xy.y = lp.phi - P->phi0 + (1. - cos(fa)) * xy.y; 25 | } 26 | return (xy); 27 | } 28 | FREEUP; if (P) pj_dalloc(P); } 29 | ENTRY0(rpoly) 30 | if ((P->mode = (P->phi1 = fabs(pj_param(P->params, "rlat_ts").f)) > EPS)) { 31 | P->fxb = 0.5 * sin(P->phi1); 32 | P->fxa = 0.5 / P->fxb; 33 | } 34 | P->es = 0.; P->fwd = s_forward; 35 | ENDENTRY(P) 36 | -------------------------------------------------------------------------------- /Proj4/PJ_somerc.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double K, c, hlf_e, kR, cosp0, sinp0; 3 | #define PJ_LIB__ 4 | #include 5 | PROJ_HEAD(somerc, "Swiss. Obl. Mercator") "\n\tCyl, Ell\n\tFor CH1903"; 6 | #define EPS 1.e-10 7 | #define NITER 6 8 | FORWARD(e_forward); 9 | double phip, lamp, phipp, lampp, sp, cp; 10 | 11 | sp = P->e * sin(lp.phi); 12 | phip = 2.* atan( exp( P->c * ( 13 | log(tan(FORTPI + 0.5 * lp.phi)) - P->hlf_e * log((1. + sp)/(1. - sp))) 14 | + P->K)) - HALFPI; 15 | lamp = P->c * lp.lam; 16 | cp = cos(phip); 17 | phipp = aasin(P->cosp0 * sin(phip) - P->sinp0 * cp * cos(lamp)); 18 | lampp = aasin(cp * sin(lamp) / cos(phipp)); 19 | xy.x = P->kR * lampp; 20 | xy.y = P->kR * log(tan(FORTPI + 0.5 * phipp)); 21 | return (xy); 22 | } 23 | INVERSE(e_inverse); /* ellipsoid & spheroid */ 24 | double phip, lamp, phipp, lampp, cp, esp, con, delp; 25 | int i; 26 | 27 | phipp = 2. * (atan(exp(xy.y / P->kR)) - FORTPI); 28 | lampp = xy.x / P->kR; 29 | cp = cos(phipp); 30 | phip = aasin(P->cosp0 * sin(phipp) + P->sinp0 * cp * cos(lampp)); 31 | lamp = aasin(cp * sin(lampp) / cos(phip)); 32 | con = (P->K - log(tan(FORTPI + 0.5 * phip)))/P->c; 33 | for (i = NITER; i ; --i) { 34 | esp = P->e * sin(phip); 35 | delp = (con + log(tan(FORTPI + 0.5 * phip)) - P->hlf_e * 36 | log((1. + esp)/(1. - esp)) ) * 37 | (1. - esp * esp) * cos(phip) * P->rone_es; 38 | phip -= delp; 39 | if (fabs(delp) < EPS) 40 | break; 41 | } 42 | if (i) { 43 | lp.phi = phip; 44 | lp.lam = lamp / P->c; 45 | } else 46 | I_ERROR 47 | return (lp); 48 | } 49 | FREEUP; if (P) pj_dalloc(P); } 50 | ENTRY0(somerc) 51 | double cp, phip0, sp; 52 | 53 | P->hlf_e = 0.5 * P->e; 54 | cp = cos(P->phi0); 55 | cp *= cp; 56 | P->c = sqrt(1 + P->es * cp * cp * P->rone_es); 57 | sp = sin(P->phi0); 58 | P->cosp0 = cos( phip0 = aasin(P->sinp0 = sp / P->c) ); 59 | sp *= P->e; 60 | P->K = log(tan(FORTPI + 0.5 * phip0)) - P->c * ( 61 | log(tan(FORTPI + 0.5 * P->phi0)) - P->hlf_e * 62 | log((1. + sp) / (1. - sp))); 63 | P->kR = P->k0 * sqrt(P->one_es) / (1. - sp * sp); 64 | P->inv = e_inverse; 65 | P->fwd = e_forward; 66 | ENDENTRY(P) 67 | -------------------------------------------------------------------------------- /Proj4/PJ_sts.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double C_x, C_y, C_p; \ 3 | int tan_mode; 4 | #define PJ_LIB__ 5 | # include 6 | PROJ_HEAD(kav5, "Kavraisky V") "\n\tPCyl., Sph."; 7 | PROJ_HEAD(qua_aut, "Quartic Authalic") "\n\tPCyl., Sph."; 8 | PROJ_HEAD(mbt_s, "McBryde-Thomas Flat-Polar Sine (No. 1)") "\n\tPCyl., Sph."; 9 | PROJ_HEAD(fouc, "Foucaut") "\n\tPCyl., Sph."; 10 | FORWARD(s_forward); /* spheroid */ 11 | double c; 12 | 13 | xy.x = P->C_x * lp.lam * cos(lp.phi); 14 | xy.y = P->C_y; 15 | lp.phi *= P->C_p; 16 | c = cos(lp.phi); 17 | if (P->tan_mode) { 18 | xy.x *= c * c; 19 | xy.y *= tan(lp.phi); 20 | } else { 21 | xy.x /= c; 22 | xy.y *= sin(lp.phi); 23 | } 24 | return (xy); 25 | } 26 | INVERSE(s_inverse); /* spheroid */ 27 | double c; 28 | 29 | xy.y /= P->C_y; 30 | c = cos(lp.phi = P->tan_mode ? atan(xy.y) : aasin(xy.y)); 31 | lp.phi /= P->C_p; 32 | lp.lam = xy.x / (P->C_x * cos(lp.phi)); 33 | if (P->tan_mode) 34 | lp.lam /= c * c; 35 | else 36 | lp.lam *= c; 37 | return (lp); 38 | } 39 | FREEUP; if (P) pj_dalloc(P); } 40 | static PJ * 41 | setup(PJ *P, double p, double q, int mode) { 42 | P->es = 0.; 43 | P->inv = s_inverse; 44 | P->fwd = s_forward; 45 | P->C_x = q / p; 46 | P->C_y = p; 47 | P->C_p = 1/ q; 48 | P->tan_mode = mode; 49 | return P; 50 | } 51 | ENTRY0(kav5) ENDENTRY(setup(P, 1.50488, 1.35439, 0)) 52 | ENTRY0(qua_aut) ENDENTRY(setup(P, 2., 2., 0)) 53 | ENTRY0(mbt_s) ENDENTRY(setup(P, 1.48875, 1.36509, 0)) 54 | ENTRY0(fouc) ENDENTRY(setup(P, 2., 2., 1)) 55 | -------------------------------------------------------------------------------- /Proj4/PJ_tcc.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double ap; 3 | #define EPS10 1.e-10 4 | #define PJ_LIB__ 5 | #include 6 | PROJ_HEAD(tcc, "Transverse Central Cylindrical") "\n\tCyl, Sph, no inv."; 7 | FORWARD(s_forward); /* spheroid */ 8 | double b, bt; 9 | 10 | b = cos(lp.phi) * sin(lp.lam); 11 | if ((bt = 1. - b * b) < EPS10) F_ERROR; 12 | xy.x = b / sqrt(bt); 13 | xy.y = atan2(tan(lp.phi) , cos(lp.lam)); 14 | return (xy); 15 | } 16 | FREEUP; if (P) pj_dalloc(P); } 17 | ENTRY0(tcc) P->es = 0.; P->fwd = s_forward; ENDENTRY(P) 18 | -------------------------------------------------------------------------------- /Proj4/PJ_tcea.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double rk0; 3 | #define PJ_LIB__ 4 | #include 5 | PROJ_HEAD(tcea, "Transverse Cylindrical Equal Area") "\n\tCyl, Sph"; 6 | FORWARD(s_forward); /* spheroid */ 7 | xy.x = P->rk0 * cos(lp.phi) * sin(lp.lam); 8 | xy.y = P->k0 * (atan2(tan(lp.phi), cos(lp.lam)) - P->phi0); 9 | return (xy); 10 | } 11 | INVERSE(s_inverse); /* spheroid */ 12 | double t; 13 | 14 | xy.y = xy.y * P->rk0 + P->phi0; 15 | xy.x *= P->k0; 16 | t = sqrt(1. - xy.x * xy.x); 17 | lp.phi = asin(t * sin(xy.y)); 18 | lp.lam = atan2(xy.x, t * cos(xy.y)); 19 | return (lp); 20 | } 21 | FREEUP; if (P) pj_dalloc(P); } 22 | ENTRY0(tcea) 23 | P->rk0 = 1 / P->k0; 24 | P->inv = s_inverse; 25 | P->fwd = s_forward; 26 | P->es = 0.; 27 | ENDENTRY(P) 28 | -------------------------------------------------------------------------------- /Proj4/PJ_urm5.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double m, rmn, q3, n; 3 | #define PJ_LIB__ 4 | # include 5 | PROJ_HEAD(urm5, "Urmaev V") "\n\tPCyl., Sph.\n\tn= q= alphi="; 6 | FORWARD(s_forward); /* spheroid */ 7 | double t; 8 | 9 | t = lp.phi = aasin(P->n * sin(lp.phi)); 10 | xy.x = P->m * lp.lam * cos(lp.phi); 11 | t *= t; 12 | xy.y = lp.phi * (1. + t * P->q3) * P->rmn; 13 | return xy; 14 | } 15 | FREEUP; if (P) pj_dalloc(P); } 16 | ENTRY0(urm5) 17 | double alpha, t; 18 | 19 | P->n = pj_param(P->params, "dn").f; 20 | P->q3 = pj_param(P->params, "dq").f / 3.; 21 | alpha = pj_param(P->params, "ralpha").f; 22 | t = P->n * sin(alpha); 23 | P->m = cos(alpha) / sqrt(1. - t * t); 24 | P->rmn = 1. / (P->m * P->n); 25 | P->es = 0.; 26 | P->inv = 0; 27 | P->fwd = s_forward; 28 | ENDENTRY(P) 29 | -------------------------------------------------------------------------------- /Proj4/PJ_urmfps.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double n, C_y; 3 | #define PJ_LIB__ 4 | #include 5 | PROJ_HEAD(urmfps, "Urmaev Flat-Polar Sinusoidal") "\n\tPCyl, Sph.\n\tn="; 6 | PROJ_HEAD(wag1, "Wagner I (Kavraisky VI)") "\n\tPCyl, Sph."; 7 | #define C_x 0.8773826753 8 | #define Cy 1.139753528477 9 | FORWARD(s_forward); /* sphere */ 10 | lp.phi = aasin(P->n * sin(lp.phi)); 11 | xy.x = C_x * lp.lam * cos(lp.phi); 12 | xy.y = P->C_y * lp.phi; 13 | return (xy); 14 | } 15 | INVERSE(s_inverse); /* sphere */ 16 | xy.y /= P->C_y; 17 | lp.phi = aasin(sin(xy.y) / P->n); 18 | lp.lam = xy.x / (C_x * cos(xy.y)); 19 | return (lp); 20 | } 21 | FREEUP; if (P) pj_dalloc(P); } 22 | static PJ * 23 | setup(PJ *P) { 24 | P->C_y = Cy / P->n; 25 | P->es = 0.; 26 | P->inv = s_inverse; 27 | P->fwd = s_forward; 28 | return P; 29 | } 30 | ENTRY0(urmfps) 31 | if (pj_param(P->params, "tn").i) { 32 | P->n = pj_param(P->params, "dn").f; 33 | if (P->n <= 0. || P->n > 1.) 34 | E_ERROR(-40) 35 | } else 36 | E_ERROR(-40) 37 | ENDENTRY(setup(P)) 38 | ENTRY0(wag1) 39 | P->n = 0.8660254037844386467637231707; 40 | ENDENTRY(setup(P)) 41 | -------------------------------------------------------------------------------- /Proj4/PJ_vandg.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | # include 3 | PROJ_HEAD(vandg, "van der Grinten (I)") "\n\tMisc Sph"; 4 | # define TOL 1.e-10 5 | # define THIRD .33333333333333333333 6 | # define TWO_THRD .66666666666666666666 7 | # define C2_27 .07407407407407407407 8 | # define PI4_3 4.18879020478639098458 9 | # define PISQ 9.86960440108935861869 10 | # define TPISQ 19.73920880217871723738 11 | # define HPISQ 4.93480220054467930934 12 | FORWARD(s_forward); /* spheroid */ 13 | double al, al2, g, g2, p2; 14 | 15 | p2 = fabs(lp.phi / HALFPI); 16 | if ((p2 - TOL) > 1.) F_ERROR; 17 | if (p2 > 1.) 18 | p2 = 1.; 19 | if (fabs(lp.phi) <= TOL) { 20 | xy.x = lp.lam; 21 | xy.y = 0.; 22 | } else if (fabs(lp.lam) <= TOL || fabs(p2 - 1.) < TOL) { 23 | xy.x = 0.; 24 | xy.y = PI * tan(.5 * asin(p2)); 25 | if (lp.phi < 0.) xy.y = -xy.y; 26 | } else { 27 | al = .5 * fabs(PI / lp.lam - lp.lam / PI); 28 | al2 = al * al; 29 | g = sqrt(1. - p2 * p2); 30 | g = g / (p2 + g - 1.); 31 | g2 = g * g; 32 | p2 = g * (2. / p2 - 1.); 33 | p2 = p2 * p2; 34 | xy.x = g - p2; g = p2 + al2; 35 | xy.x = PI * (al * xy.x + sqrt(al2 * xy.x * xy.x - g * (g2 - p2))) / g; 36 | if (lp.lam < 0.) xy.x = -xy.x; 37 | xy.y = fabs(xy.x / PI); 38 | xy.y = 1. - xy.y * (xy.y + 2. * al); 39 | if (xy.y < -TOL) F_ERROR; 40 | if (xy.y < 0.) xy.y = 0.; 41 | else xy.y = sqrt(xy.y) * (lp.phi < 0. ? -PI : PI); 42 | } 43 | return (xy); 44 | } 45 | INVERSE(s_inverse); /* spheroid */ 46 | double t, c0, c1, c2, c3, al, r2, r, m, d, ay, x2, y2; 47 | 48 | x2 = xy.x * xy.x; 49 | if ((ay = fabs(xy.y)) < TOL) { 50 | lp.phi = 0.; 51 | t = x2 * x2 + TPISQ * (x2 + HPISQ); 52 | lp.lam = fabs(xy.x) <= TOL ? 0. : 53 | .5 * (x2 - PISQ + sqrt(t)) / xy.x; 54 | return (lp); 55 | } 56 | y2 = xy.y * xy.y; 57 | r = x2 + y2; r2 = r * r; 58 | c1 = - PI * ay * (r + PISQ); 59 | c3 = r2 + TWOPI * (ay * r + PI * (y2 + PI * (ay + HALFPI))); 60 | c2 = c1 + PISQ * (r - 3. * y2); 61 | c0 = PI * ay; 62 | c2 /= c3; 63 | al = c1 / c3 - THIRD * c2 * c2; 64 | m = 2. * sqrt(-THIRD * al); 65 | d = C2_27 * c2 * c2 * c2 + (c0 * c0 - THIRD * c2 * c1) / c3; 66 | if (((t = fabs(d = 3. * d / (al * m))) - TOL) <= 1.) { 67 | d = t > 1. ? (d > 0. ? 0. : PI) : acos(d); 68 | lp.phi = PI * (m * cos(d * THIRD + PI4_3) - THIRD * c2); 69 | if (xy.y < 0.) lp.phi = -lp.phi; 70 | t = r2 + TPISQ * (x2 - y2 + HPISQ); 71 | lp.lam = fabs(xy.x) <= TOL ? 0. : 72 | .5 * (r - PISQ + (t <= 0. ? 0. : sqrt(t))) / xy.x; 73 | } else 74 | I_ERROR; 75 | return (lp); 76 | } 77 | FREEUP; if (P) pj_dalloc(P); } 78 | ENTRY0(vandg) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 79 | -------------------------------------------------------------------------------- /Proj4/PJ_vandg2.c: -------------------------------------------------------------------------------- 1 | # define TOL 1e-10 2 | # define TWORPI 0.63661977236758134308 3 | #define PROJ_PARMS__ \ 4 | int vdg3; 5 | #define PJ_LIB__ 6 | #include 7 | PROJ_HEAD(vandg2, "van der Grinten II") "\n\tMisc Sph, no inv."; 8 | PROJ_HEAD(vandg3, "van der Grinten III") "\n\tMisc Sph, no inv."; 9 | FORWARD(s_forward); /* spheroid */ 10 | double x1, at, bt, ct; 11 | 12 | bt = fabs(TWORPI * lp.phi); 13 | if ((ct = 1. - bt * bt) < 0.) 14 | ct = 0.; 15 | else 16 | ct = sqrt(ct); 17 | if (fabs(lp.lam) < TOL) { 18 | xy.x = 0.; 19 | xy.y = PI * (lp.phi < 0. ? -bt : bt) / (1. + ct); 20 | } else { 21 | at = 0.5 * fabs(PI / lp.lam - lp.lam / PI); 22 | if (P->vdg3) { 23 | x1 = bt / (1. + ct); 24 | xy.x = PI * (sqrt(at * at + 1. - x1 * x1) - at); 25 | xy.y = PI * x1; 26 | } else { 27 | x1 = (ct * sqrt(1. + at * at) - at * ct * ct) / 28 | (1. + at * at * bt * bt); 29 | xy.x = PI * x1; 30 | xy.y = PI * sqrt(1. - x1 * (x1 + 2. * at) + TOL); 31 | } 32 | if ( lp.lam < 0.) xy.x = -xy.x; 33 | if ( lp.phi < 0.) xy.y = -xy.y; 34 | } 35 | return (xy); 36 | } 37 | FREEUP; if (P) pj_dalloc(P); } 38 | ENTRY0(vandg2) 39 | P->vdg3 = 0; 40 | P->inv = 0; P->fwd = s_forward; 41 | ENDENTRY(P) 42 | ENTRY0(vandg3) 43 | P->vdg3 = 1; 44 | P->es = 0.; P->fwd = s_forward; 45 | ENDENTRY(P) 46 | -------------------------------------------------------------------------------- /Proj4/PJ_vandg4.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | #include 3 | PROJ_HEAD(vandg4, "van der Grinten IV") "\n\tMisc Sph, no inv."; 4 | #define TOL 1e-10 5 | #define TWORPI 0.63661977236758134308 6 | FORWARD(s_forward); /* spheroid */ 7 | double x1, t, bt, ct, ft, bt2, ct2, dt, dt2; 8 | 9 | if (fabs(lp.phi) < TOL) { 10 | xy.x = lp.lam; 11 | xy.y = 0.; 12 | } else if (fabs(lp.lam) < TOL || fabs(fabs(lp.phi) - HALFPI) < TOL) { 13 | xy.x = 0.; 14 | xy.y = lp.phi; 15 | } else { 16 | bt = fabs(TWORPI * lp.phi); 17 | bt2 = bt * bt; 18 | ct = 0.5 * (bt * (8. - bt * (2. + bt2)) - 5.) 19 | / (bt2 * (bt - 1.)); 20 | ct2 = ct * ct; 21 | dt = TWORPI * lp.lam; 22 | dt = dt + 1. / dt; 23 | dt = sqrt(dt * dt - 4.); 24 | if ((fabs(lp.lam) - HALFPI) < 0.) dt = -dt; 25 | dt2 = dt * dt; 26 | x1 = bt + ct; x1 *= x1; 27 | t = bt + 3.*ct; 28 | ft = x1 * (bt2 + ct2 * dt2 - 1.) + (1.-bt2) * ( 29 | bt2 * (t * t + 4. * ct2) + 30 | ct2 * (12. * bt * ct + 4. * ct2) ); 31 | x1 = (dt*(x1 + ct2 - 1.) + 2.*sqrt(ft)) / 32 | (4.* x1 + dt2); 33 | xy.x = HALFPI * x1; 34 | xy.y = HALFPI * sqrt(1. + dt * fabs(x1) - x1 * x1); 35 | if (lp.lam < 0.) xy.x = -xy.x; 36 | if (lp.phi < 0.) xy.y = -xy.y; 37 | } 38 | return (xy); 39 | } 40 | FREEUP; if (P) pj_dalloc(P); } 41 | ENTRY0(vandg4) P->es = 0.; P->fwd = s_forward; ENDENTRY(P) 42 | -------------------------------------------------------------------------------- /Proj4/PJ_wag2.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | # include 3 | PROJ_HEAD(wag2, "Wagner II") "\n\tPCyl., Sph."; 4 | #define C_x 0.92483 5 | #define C_y 1.38725 6 | #define C_p1 0.88022 7 | #define C_p2 0.88550 8 | FORWARD(s_forward); /* spheroid */ 9 | lp.phi = aasin(C_p1 * sin(C_p2 * lp.phi)); 10 | xy.x = C_x * lp.lam * cos(lp.phi); 11 | xy.y = C_y * lp.phi; 12 | return (xy); 13 | } 14 | INVERSE(s_inverse); /* spheroid */ 15 | lp.phi = xy.y / C_y; 16 | lp.lam = xy.x / (C_x * cos(lp.phi)); 17 | lp.phi = aasin(sin(lp.phi) / C_p1) / C_p2; 18 | return (lp); 19 | } 20 | FREEUP; if (P) pj_dalloc(P); } 21 | ENTRY0(wag2) P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; ENDENTRY(P) 22 | -------------------------------------------------------------------------------- /Proj4/PJ_wag3.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double C_x; 3 | #define PJ_LIB__ 4 | # include 5 | PROJ_HEAD(wag3, "Wagner III") "\n\tPCyl., Sph.\n\tlat_ts="; 6 | #define TWOTHIRD 0.6666666666666666666667 7 | FORWARD(s_forward); /* spheroid */ 8 | xy.x = P->C_x * lp.lam * cos(TWOTHIRD * lp.phi); 9 | xy.y = lp.phi; 10 | return (xy); 11 | } 12 | INVERSE(s_inverse); /* spheroid */ 13 | lp.phi = xy.y; 14 | lp.lam = xy.x / (P->C_x * cos(TWOTHIRD * lp.phi)); 15 | return (lp); 16 | } 17 | FREEUP; if (P) pj_dalloc(P); } 18 | ENTRY0(wag3) 19 | double ts; 20 | 21 | ts = pj_param(P->params, "rlat_ts").f; 22 | P->C_x = cos(ts) / cos(2.*ts/3.); 23 | P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; 24 | ENDENTRY(P) 25 | -------------------------------------------------------------------------------- /Proj4/PJ_wag7.c: -------------------------------------------------------------------------------- 1 | #define PJ_LIB__ 2 | #include 3 | PROJ_HEAD(wag7, "Wagner VII") "\n\tMisc Sph, no inv."; 4 | FORWARD(s_forward); /* sphere */ 5 | double theta, ct, D; 6 | 7 | theta = asin(xy.y = 0.90630778703664996 * sin(lp.phi)); 8 | xy.x = 2.66723 * (ct = cos(theta)) * sin(lp.lam /= 3.); 9 | xy.y *= 1.24104 * (D = 1/(sqrt(0.5 * (1 + ct * cos(lp.lam))))); 10 | xy.x *= D; 11 | return (xy); 12 | } 13 | FREEUP; if (P) pj_dalloc(P); } 14 | ENTRY0(wag7) P->fwd = s_forward; P->inv = 0; P->es = 0.; ENDENTRY(P) 15 | -------------------------------------------------------------------------------- /Proj4/PJ_wink1.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double cosphi1; 3 | #define PJ_LIB__ 4 | # include 5 | PROJ_HEAD(wink1, "Winkel I") "\n\tPCyl., Sph.\n\tlat_ts="; 6 | FORWARD(s_forward); /* spheroid */ 7 | xy.x = .5 * lp.lam * (P->cosphi1 + cos(lp.phi)); 8 | xy.y = lp.phi; 9 | return (xy); 10 | } 11 | INVERSE(s_inverse); /* spheroid */ 12 | lp.phi = xy.y; 13 | lp.lam = 2. * xy.x / (P->cosphi1 + cos(lp.phi)); 14 | return (lp); 15 | } 16 | FREEUP; if (P) pj_dalloc(P); } 17 | ENTRY0(wink1) 18 | P->cosphi1 = cos(pj_param(P->params, "rlat_ts").f); 19 | P->es = 0.; P->inv = s_inverse; P->fwd = s_forward; 20 | ENDENTRY(P) 21 | -------------------------------------------------------------------------------- /Proj4/PJ_wink2.c: -------------------------------------------------------------------------------- 1 | #define PROJ_PARMS__ \ 2 | double cosphi1; 3 | #define PJ_LIB__ 4 | # include 5 | PROJ_HEAD(wink2, "Winkel II") "\n\tPCyl., Sph., no inv.\n\tlat_1="; 6 | #define MAX_ITER 10 7 | #define LOOP_TOL 1e-7 8 | #define TWO_D_PI 0.636619772367581343 9 | FORWARD(s_forward); /* spheroid */ 10 | double k, V; 11 | int i; 12 | 13 | xy.y = lp.phi * TWO_D_PI; 14 | k = PI * sin(lp.phi); 15 | lp.phi *= 1.8; 16 | for (i = MAX_ITER; i ; --i) { 17 | lp.phi -= V = (lp.phi + sin(lp.phi) - k) / 18 | (1. + cos(lp.phi)); 19 | if (fabs(V) < LOOP_TOL) 20 | break; 21 | } 22 | if (!i) 23 | lp.phi = (lp.phi < 0.) ? -HALFPI : HALFPI; 24 | else 25 | lp.phi *= 0.5; 26 | xy.x = 0.5 * lp.lam * (cos(lp.phi) + P->cosphi1); 27 | xy.y = FORTPI * (sin(lp.phi) + xy.y); 28 | return (xy); 29 | } 30 | FREEUP; if (P) pj_dalloc(P); } 31 | ENTRY0(wink2) 32 | P->cosphi1 = cos(pj_param(P->params, "rlat_1").f); 33 | P->es = 0.; P->inv = 0; P->fwd = s_forward; 34 | ENDENTRY(P) 35 | -------------------------------------------------------------------------------- /Proj4/Proj4.xcodeproj/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/Proj4/Proj4.xcodeproj/TemplateIcon.icns -------------------------------------------------------------------------------- /Proj4/Proj4_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Proj4' target in the 'Proj4' project. 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Proj4/aasincos.c: -------------------------------------------------------------------------------- 1 | /* arc sin, cosine, tan2 and sqrt that will NOT fail */ 2 | #include 3 | #define ONE_TOL 1.00000000000001 4 | #define TOL 0.000000001 5 | #define ATOL 1e-50 6 | double 7 | aasin(double v) { 8 | double av; 9 | 10 | if ((av = fabs(v)) >= 1.) { 11 | if (av > ONE_TOL) 12 | pj_errno = -19; 13 | return (v < 0. ? -HALFPI : HALFPI); 14 | } 15 | return asin(v); 16 | } 17 | double 18 | aacos(double v) { 19 | double av; 20 | 21 | if ((av = fabs(v)) >= 1.) { 22 | if (av > ONE_TOL) 23 | pj_errno = -19; 24 | return (v < 0. ? PI : 0.); 25 | } 26 | return acos(v); 27 | } 28 | double 29 | asqrt(double v) { return ((v <= 0) ? 0. : sqrt(v)); } 30 | double 31 | aatan2(double n, double d) { 32 | return ((fabs(n) < ATOL && fabs(d) < ATOL) ? 0. : atan2(n,d)); 33 | } 34 | -------------------------------------------------------------------------------- /Proj4/adjlon.c: -------------------------------------------------------------------------------- 1 | /* reduce argument to range +/- PI */ 2 | #include 3 | #include 4 | 5 | #define SPI 3.14159265359 6 | #define TWOPI 6.2831853071795864769 7 | #define ONEPI 3.14159265358979323846 8 | 9 | double adjlon (double lon) { 10 | if (fabs(lon) <= SPI) return( lon ); 11 | lon += ONEPI; /* adjust to 0..2pi rad */ 12 | lon -= TWOPI * floor(lon / TWOPI); /* remove integral # of 'revolutions'*/ 13 | lon -= ONEPI; /* adjust back to -pi..pi rad */ 14 | return( lon ); 15 | } 16 | -------------------------------------------------------------------------------- /Proj4/bchgen.c: -------------------------------------------------------------------------------- 1 | /* generate double bivariate Chebychev polynomial */ 2 | #include 3 | int 4 | bchgen(projUV a, projUV b, int nu, int nv, projUV **f, projUV(*func)(projUV)) { 5 | int i, j, k; 6 | projUV arg, *t, bma, bpa, *c; 7 | double d, fac; 8 | 9 | bma.u = 0.5 * (b.u - a.u); bma.v = 0.5 * (b.v - a.v); 10 | bpa.u = 0.5 * (b.u + a.u); bpa.v = 0.5 * (b.v + a.v); 11 | for ( i = 0; i < nu; ++i) { 12 | arg.u = cos(PI * (i + 0.5) / nu) * bma.u + bpa.u; 13 | for ( j = 0; j < nv; ++j) { 14 | arg.v = cos(PI * (j + 0.5) / nv) * bma.v + bpa.v; 15 | f[i][j] = (*func)(arg); 16 | if ((f[i][j]).u == HUGE_VAL) 17 | return(1); 18 | } 19 | } 20 | if (!(c = (projUV *) vector1(nu, sizeof(projUV)))) return 1; 21 | fac = 2. / nu; 22 | for ( j = 0; j < nv ; ++j) { 23 | for ( i = 0; i < nu; ++i) { 24 | arg.u = arg.v = 0.; 25 | for (k = 0; k < nu; ++k) { 26 | d = cos(PI * i * (k + .5) / nu); 27 | arg.u += f[k][j].u * d; 28 | arg.v += f[k][j].v * d; 29 | } 30 | arg.u *= fac; 31 | arg.v *= fac; 32 | c[i] = arg; 33 | } 34 | for (i = 0; i < nu; ++i) 35 | f[i][j] = c[i]; 36 | } 37 | pj_dalloc(c); 38 | if (!(c = (projUV*) vector1(nv, sizeof(projUV)))) return 1; 39 | fac = 2. / nv; 40 | for ( i = 0; i < nu; ++i) { 41 | t = f[i]; 42 | for (j = 0; j < nv; ++j) { 43 | arg.u = arg.v = 0.; 44 | for (k = 0; k < nv; ++k) { 45 | d = cos(PI * j * (k + .5) / nv); 46 | arg.u += t[k].u * d; 47 | arg.v += t[k].v * d; 48 | } 49 | arg.u *= fac; 50 | arg.v *= fac; 51 | c[j] = arg; 52 | } 53 | f[i] = c; 54 | c = t; 55 | } 56 | pj_dalloc(c); 57 | return(0); 58 | } 59 | -------------------------------------------------------------------------------- /Proj4/biveval.c: -------------------------------------------------------------------------------- 1 | /* procedures for evaluating Tseries */ 2 | # include 3 | # define NEAR_ONE 1.00001 4 | static double ceval(struct PW_COEF *C, int n, projUV w, projUV w2) { 5 | double d=0, dd=0, vd, vdd, tmp, *c; 6 | int j; 7 | 8 | for (C += n ; n-- ; --C ) { 9 | if ((j = C->m)) { 10 | vd = vdd = 0.; 11 | for (c = C->c + --j; j ; --j ) { 12 | vd = w2.v * (tmp = vd) - vdd + *c--; 13 | vdd = tmp; 14 | } 15 | d = w2.u * (tmp = d) - dd + w.v * vd - vdd + 0.5 * *c; 16 | } else 17 | d = w2.u * (tmp = d) - dd; 18 | dd = tmp; 19 | } 20 | if ((j = C->m)) { 21 | vd = vdd = 0.; 22 | for (c = C->c + --j; j ; --j ) { 23 | vd = w2.v * (tmp = vd) - vdd + *c--; 24 | vdd = tmp; 25 | } 26 | return (w.u * d - dd + 0.5 * ( w.v * vd - vdd + 0.5 * *c )); 27 | } else 28 | return (w.u * d - dd); 29 | } 30 | projUV /* bivariate Chebyshev polynomial entry point */ 31 | bcheval(projUV in, Tseries *T) { 32 | projUV w2, w; 33 | projUV out; 34 | /* scale to +-1 */ 35 | w.u = ( in.u + in.u - T->a.u ) * T->b.u; 36 | w.v = ( in.v + in.v - T->a.v ) * T->b.v; 37 | if (fabs(w.u) > NEAR_ONE || fabs(w.v) > NEAR_ONE) { 38 | out.u = out.v = HUGE_VAL; 39 | pj_errno = -36; 40 | } else { /* double evaluation */ 41 | w2.u = w.u + w.u; 42 | w2.v = w.v + w.v; 43 | out.u = ceval(T->cu, T->mu, w, w2); 44 | out.v = ceval(T->cv, T->mv, w, w2); 45 | } 46 | return out; 47 | } 48 | projUV /* bivariate power polynomial entry point */ 49 | bpseval(projUV in, Tseries *T) { 50 | projUV out; 51 | double *c, row; 52 | int i, m; 53 | 54 | out.u = out.v = 0.; 55 | for (i = T->mu; i >= 0; --i) { 56 | row = 0.; 57 | if ((m = T->cu[i].m)) { 58 | c = T->cu[i].c + m; 59 | while (m--) 60 | row = *--c + in.v * row; 61 | } 62 | out.u = row + in.u * out.u; 63 | } 64 | for (i = T->mv; i >= 0; --i) { 65 | row = 0.; 66 | if ((m = T->cv[i].m)) { 67 | c = T->cv[i].c + m; 68 | while (m--) 69 | row = *--c + in.v * row; 70 | } 71 | out.v = row + in.u * out.v; 72 | } 73 | return out; 74 | } 75 | 76 | projUV /* general entry point selecting evaluation mode */ 77 | biveval(projUV in, Tseries *T) { 78 | 79 | if (T->power) { 80 | return bpseval(in, T); 81 | } else { 82 | return bcheval(in, T); 83 | } 84 | } 85 | 86 | -------------------------------------------------------------------------------- /Proj4/emess.c: -------------------------------------------------------------------------------- 1 | /* Error message processing */ 2 | 3 | #ifdef _MSC_VER 4 | # ifndef _CRT_SECURE_NO_DEPRECATE 5 | # define _CRT_SECURE_NO_DEPRECATE 6 | # endif 7 | # ifndef _CRT_NONSTDC_NO_DEPRECATE 8 | # define _CRT_NONSTDC_NO_DEPRECATE 9 | # endif 10 | #endif 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #define EMESS_ROUTINE 19 | #include "emess.h" 20 | void 21 | emess(int code, char *fmt, ...) { 22 | va_list args; 23 | 24 | va_start(args, fmt); 25 | /* prefix program name, if given */ 26 | if (fmt != NULL) 27 | (void)fprintf(stderr,"%s\n<%s>: ",pj_get_release(), 28 | emess_dat.Prog_name); 29 | /* print file name and line, if given */ 30 | if (emess_dat.File_name != NULL && *emess_dat.File_name) { 31 | (void)fprintf(stderr,"while processing file: %s", emess_dat.File_name); 32 | if (emess_dat.File_line > 0) 33 | (void)fprintf(stderr,", line %d\n", emess_dat.File_line); 34 | else 35 | (void)fputc('\n', stderr); 36 | } else 37 | putc('\n', stderr); 38 | /* if |code|==2, print errno code data */ 39 | if (code == 2 || code == -2) 40 | (void)fprintf(stderr, "Sys errno: %d: %s\n", 41 | errno, 42 | #ifdef HAVE_STRERROR 43 | strerror(errno)); 44 | #else 45 | ""); 46 | #endif 47 | /* post remainder of call data */ 48 | (void)vfprintf(stderr,fmt,args); 49 | va_end(args); 50 | /* die if code positive */ 51 | if (code > 0) { 52 | (void)fputs("\nprogram abnormally terminated\n", stderr); 53 | exit(code); 54 | } 55 | else 56 | putc('\n', stderr); 57 | } 58 | -------------------------------------------------------------------------------- /Proj4/emess.h: -------------------------------------------------------------------------------- 1 | /* Error message processing header file */ 2 | #ifndef EMESS_H 3 | #define EMESS_H 4 | 5 | #ifndef lint 6 | static char EMESS_H_ID[] = "@(#)emess.h 4.1 93/03/08 GIE REL"; 7 | #endif 8 | 9 | struct EMESS { 10 | char *File_name, /* input file name */ 11 | *Prog_name; /* name of program */ 12 | int File_line; /* approximate line read 13 | where error occured */ 14 | }; 15 | 16 | #ifdef EMESS_ROUTINE /* use type */ 17 | /* for emess procedure */ 18 | struct EMESS emess_dat = { (char *)0, (char *)0, 0 }; 19 | 20 | #ifdef sun /* Archaic SunOs 4.1.1, etc. */ 21 | extern char *sys_errlist[]; 22 | #define strerror(n) (sys_errlist[n]) 23 | #endif 24 | 25 | #else /* for for calling procedures */ 26 | 27 | extern struct EMESS emess_dat; 28 | void emess(int, char *, ...); 29 | 30 | #endif /* use type */ 31 | 32 | #endif /* end EMESS_H */ 33 | -------------------------------------------------------------------------------- /Proj4/gen_cheb.c: -------------------------------------------------------------------------------- 1 | /* generates 'T' option output */ 2 | #define PJ_LIB__ 3 | #include "projects.h" 4 | #include 5 | #include 6 | #include 7 | #include "emess.h" 8 | #ifndef COEF_LINE_MAX 9 | #define COEF_LINE_MAX 60 10 | #endif 11 | void 12 | gen_cheb(int inverse, projUV (*proj)(projUV), char *s, PJ *P, int iargc, char **iargv) { 13 | int NU = 15, NV = 15, i, res = -1, errin = 0, pwr; 14 | char *arg, fmt[15]; 15 | projUV low, upp, resid; 16 | Tseries *F; 17 | extern void p_series(Tseries *, FILE *, char *); 18 | double (*input)(const char *, char **); 19 | 20 | input = inverse ? strtod : dmstor; 21 | if (*s) low.u = input(s, &s); else ++errin; 22 | if (*s == ',') upp.u = input(s+1, &s); else ++errin; 23 | if (*s == ',') low.v = input(s+1, &s); else ++errin; 24 | if (*s == ',') upp.v = input(s+1, &s); else ++errin; 25 | if (errin) 26 | emess(16,"null or absent -T parameters"); 27 | if (*s == ',') if (*++s != ',') res = strtol(s, &s, 10); 28 | if (*s == ',') if (*++s != ',') NU = strtol(s, &s, 10); 29 | if (*s == ',') if (*++s != ',') NV = strtol(s, &s, 10); 30 | pwr = s && *s && !strcmp(s, ",P"); 31 | (void)printf("#proj_%s\n# run-line:\n", 32 | pwr ? "Power" : "Chebyshev"); 33 | if (iargc > 0) { /* proj execution audit trail */ 34 | int n = 0, L; 35 | 36 | for( i = 0 ; iargc ; --iargc) { 37 | arg = *iargv++; 38 | if (*arg != '+') { 39 | if (!n) { putchar('#'); ++n; } 40 | (void)printf(" %s%n",arg, &L); 41 | if ((n += L) > 50) { putchar('\n'); n = 0; } 42 | } 43 | } 44 | if (n) putchar('\n'); 45 | } 46 | (void)printf("# projection parameters\n"); 47 | pj_pr_list(P); 48 | if (low.u == upp.u || low.v >= upp.v) 49 | emess(16,"approx. argument range error"); 50 | if (low.u > upp.u) 51 | low.u -= TWOPI; 52 | if (NU < 2 || NV < 2) 53 | emess(16,"approx. work dimensions (%d %d) too small",NU,NV); 54 | if (!(F = mk_cheby(low, upp, pow(10., (double)res)*.5, &resid, proj, 55 | NU, NV, pwr))) 56 | emess(16,"generation of approx failed\nreason: %s\n", 57 | pj_strerrno(errno)); 58 | (void)printf("%c,%.12g,%.12g,%.12g,%.12g,%.12g\n",inverse?'I':'F', 59 | P->lam0*RAD_TO_DEG, 60 | low.u*(inverse?1.:RAD_TO_DEG),upp.u*(inverse?1.:RAD_TO_DEG), 61 | low.v*(inverse?1.:RAD_TO_DEG),upp.v*(inverse?1.:RAD_TO_DEG)); 62 | if (pwr) 63 | strcpy(fmt, "%.15g"); 64 | else if (res <= 0) 65 | (void)sprintf(fmt,"%%.%df",-res+1); 66 | else 67 | (void)strcpy(fmt,"%.0f"); 68 | p_series(F, stdout, fmt); 69 | (void)printf("# |u,v| sums %g %g\n#end_proj_%s\n", 70 | resid.u, resid.v, pwr ? "Power" : "Chebyshev"); 71 | } 72 | -------------------------------------------------------------------------------- /Proj4/geod_for.c: -------------------------------------------------------------------------------- 1 | # include "projects.h" 2 | # include "geodesic.h" 3 | # define MERI_TOL 1e-9 4 | static double 5 | th1,costh1,sinth1,sina12,cosa12,M,N,c1,c2,D,P,s1; 6 | static int 7 | merid, signS; 8 | void 9 | geod_pre(void) { 10 | al12 = adjlon(al12); /* reduce to +- 0-PI */ 11 | signS = fabs(al12) > HALFPI ? 1 : 0; 12 | th1 = ellipse ? atan(onef * tan(phi1)) : phi1; 13 | costh1 = cos(th1); 14 | sinth1 = sin(th1); 15 | if ((merid = fabs(sina12 = sin(al12)) < MERI_TOL)) { 16 | sina12 = 0.; 17 | cosa12 = fabs(al12) < HALFPI ? 1. : -1.; 18 | M = 0.; 19 | } else { 20 | cosa12 = cos(al12); 21 | M = costh1 * sina12; 22 | } 23 | N = costh1 * cosa12; 24 | if (ellipse) { 25 | if (merid) { 26 | c1 = 0.; 27 | c2 = f4; 28 | D = 1. - c2; 29 | D *= D; 30 | P = c2 / D; 31 | } else { 32 | c1 = geod_f * M; 33 | c2 = f4 * (1. - M * M); 34 | D = (1. - c2)*(1. - c2 - c1 * M); 35 | P = (1. + .5 * c1 * M) * c2 / D; 36 | } 37 | } 38 | if (merid) s1 = HALFPI - th1; 39 | else { 40 | s1 = (fabs(M) >= 1.) ? 0. : acos(M); 41 | s1 = sinth1 / sin(s1); 42 | s1 = (fabs(s1) >= 1.) ? 0. : acos(s1); 43 | } 44 | } 45 | void 46 | geod_for(void) { 47 | double d,sind,u,V,X,ds,cosds,sinds,ss,de; 48 | 49 | if (ellipse) { 50 | d = geod_S / (D * geod_a); 51 | if (signS) d = -d; 52 | u = 2. * (s1 - d); 53 | V = cos(u + d); 54 | X = c2 * c2 * (sind = sin(d)) * cos(d) * (2. * V * V - 1.); 55 | ds = d + X - 2. * P * V * (1. - 2. * P * cos(u)) * sind; 56 | ss = s1 + s1 - ds; 57 | } else { 58 | ds = geod_S / geod_a; 59 | if (signS) ds = - ds; 60 | } 61 | cosds = cos(ds); 62 | sinds = sin(ds); 63 | if (signS) sinds = - sinds; 64 | al21 = N * cosds - sinth1 * sinds; 65 | if (merid) { 66 | phi2 = atan( tan(HALFPI + s1 - ds) / onef); 67 | if (al21 > 0.) { 68 | al21 = PI; 69 | if (signS) 70 | de = PI; 71 | else { 72 | phi2 = - phi2; 73 | de = 0.; 74 | } 75 | } else { 76 | al21 = 0.; 77 | if (signS) { 78 | phi2 = - phi2; 79 | de = 0; 80 | } else 81 | de = PI; 82 | } 83 | } else { 84 | al21 = atan(M / al21); 85 | if (al21 > 0) 86 | al21 += PI; 87 | if (al12 < 0.) 88 | al21 -= PI; 89 | al21 = adjlon(al21); 90 | phi2 = atan(-(sinth1 * cosds + N * sinds) * sin(al21) / 91 | (ellipse ? onef * M : M)); 92 | de = atan2(sinds * sina12 , 93 | (costh1 * cosds - sinth1 * sinds * cosa12)); 94 | if (ellipse) { 95 | if (signS) 96 | de += c1 * ((1. - c2) * ds + 97 | c2 * sinds * cos(ss)); 98 | else 99 | de -= c1 * ((1. - c2) * ds - 100 | c2 * sinds * cos(ss)); 101 | } 102 | } 103 | lam2 = adjlon( lam1 + de ); 104 | } 105 | -------------------------------------------------------------------------------- /Proj4/geod_inv.c: -------------------------------------------------------------------------------- 1 | # include "projects.h" 2 | # include "geodesic.h" 3 | # define DTOL 1e-12 4 | void 5 | geod_inv(void) { 6 | double th1,th2,thm,dthm,dlamm,dlam,sindlamm,costhm,sinthm,cosdthm, 7 | sindthm,L,E,cosd,d,X,Y,T,sind,tandlammp,u,v,D,A,B; 8 | 9 | if (ellipse) { 10 | th1 = atan(onef * tan(phi1)); 11 | th2 = atan(onef * tan(phi2)); 12 | } else { 13 | th1 = phi1; 14 | th2 = phi2; 15 | } 16 | thm = .5 * (th1 + th2); 17 | dthm = .5 * (th2 - th1); 18 | dlamm = .5 * ( dlam = adjlon(lam2 - lam1) ); 19 | if (fabs(dlam) < DTOL && fabs(dthm) < DTOL) { 20 | al12 = al21 = geod_S = 0.; 21 | return; 22 | } 23 | sindlamm = sin(dlamm); 24 | costhm = cos(thm); sinthm = sin(thm); 25 | cosdthm = cos(dthm); sindthm = sin(dthm); 26 | L = sindthm * sindthm + (cosdthm * cosdthm - sinthm * sinthm) 27 | * sindlamm * sindlamm; 28 | d = acos(cosd = 1 - L - L); 29 | if (ellipse) { 30 | E = cosd + cosd; 31 | sind = sin( d ); 32 | Y = sinthm * cosdthm; 33 | Y *= (Y + Y) / (1. - L); 34 | T = sindthm * costhm; 35 | T *= (T + T) / L; 36 | X = Y + T; 37 | Y -= T; 38 | T = d / sind; 39 | D = 4. * T * T; 40 | A = D * E; 41 | B = D + D; 42 | geod_S = geod_a * sind * (T - f4 * (T * X - Y) + 43 | f64 * (X * (A + (T - .5 * (A - E)) * X) - 44 | Y * (B + E * Y) + D * X * Y)); 45 | tandlammp = tan(.5 * (dlam - .25 * (Y + Y - E * (4. - X)) * 46 | (f2 * T + f64 * (32. * T - (20. * T - A) 47 | * X - (B + 4.) * Y)) * tan(dlam))); 48 | } else { 49 | geod_S = geod_a * d; 50 | tandlammp = tan(dlamm); 51 | } 52 | u = atan2(sindthm , (tandlammp * costhm)); 53 | v = atan2(cosdthm , (tandlammp * sinthm)); 54 | al12 = adjlon(TWOPI + v - u); 55 | al21 = adjlon(TWOPI - v - u); 56 | } 57 | -------------------------------------------------------------------------------- /Proj4/geod_set.c: -------------------------------------------------------------------------------- 1 | 2 | #define _IN_GEOD_SET 3 | 4 | #include 5 | #include "projects.h" 6 | #include "geodesic.h" 7 | #include "emess.h" 8 | void 9 | geod_set(int argc, char **argv) { 10 | paralist *start = 0, *curr; 11 | double es; 12 | char *name; 13 | int i; 14 | 15 | /* put arguments into internal linked list */ 16 | if (argc <= 0) 17 | emess(1, "no arguments in initialization list"); 18 | for (i = 0; i < argc; ++i) 19 | if (i) 20 | curr = curr->next = pj_mkparam(argv[i]); 21 | else 22 | start = curr = pj_mkparam(argv[i]); 23 | /* set elliptical parameters */ 24 | if (pj_ell_set(start, &geod_a, &es)) emess(1,"ellipse setup failure"); 25 | /* set units */ 26 | if ((name = pj_param(start, "sunits").s)) { 27 | char *s; 28 | struct PJ_UNITS *unit_list = pj_get_units_ref(); 29 | for (i = 0; (s = unit_list[i].id) && strcmp(name, s) ; ++i) ; 30 | if (!s) 31 | emess(1,"%s unknown unit conversion id", name); 32 | fr_meter = 1. / (to_meter = atof(unit_list[i].to_meter)); 33 | } else 34 | to_meter = fr_meter = 1.; 35 | if ((ellipse = es != 0.)) { 36 | onef = sqrt(1. - es); 37 | geod_f = 1 - onef; 38 | f2 = geod_f/2; 39 | f4 = geod_f/4; 40 | f64 = geod_f*geod_f/64; 41 | } else { 42 | onef = 1.; 43 | geod_f = f2 = f4 = f64 = 0.; 44 | } 45 | /* check if line or arc mode */ 46 | if (pj_param(start, "tlat_1").i) { 47 | double del_S; 48 | #undef f 49 | phi1 = pj_param(start, "rlat_1").f; 50 | lam1 = pj_param(start, "rlon_1").f; 51 | if (pj_param(start, "tlat_2").i) { 52 | phi2 = pj_param(start, "rlat_2").f; 53 | lam2 = pj_param(start, "rlon_2").f; 54 | geod_inv(); 55 | geod_pre(); 56 | } else if ((geod_S = pj_param(start, "dS").f)) { 57 | al12 = pj_param(start, "rA").f; 58 | geod_pre(); 59 | geod_for(); 60 | } else emess(1,"incomplete geodesic/arc info"); 61 | if ((n_alpha = pj_param(start, "in_A").i) > 0) { 62 | if (!(del_alpha = pj_param(start, "rdel_A").f)) 63 | emess(1,"del azimuth == 0"); 64 | } else if ((del_S = fabs(pj_param(start, "ddel_S").f))) { 65 | n_S = geod_S / del_S + .5; 66 | } else if ((n_S = pj_param(start, "in_S").i) <= 0) 67 | emess(1,"no interval divisor selected"); 68 | } 69 | /* free up linked list */ 70 | for ( ; start; start = curr) { 71 | curr = start->next; 72 | pj_dalloc(start); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Proj4/geodesic.h: -------------------------------------------------------------------------------- 1 | #ifndef lint 2 | static char GEODESIC_H_ID[] = "@(#)geodesic.h 4.3 95/08/19 GIE REL"; 3 | #endif 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifndef _IN_GEOD_SET 10 | # define GEOD_EXTERN extern 11 | #else 12 | # define GEOD_EXTERN 13 | #endif 14 | 15 | GEOD_EXTERN struct geodesic { 16 | double A; 17 | double LAM1, PHI1, ALPHA12; 18 | double LAM2, PHI2, ALPHA21; 19 | double DIST; 20 | double ONEF, FLAT, FLAT2, FLAT4, FLAT64; 21 | int ELLIPSE; 22 | } GEODESIC; 23 | 24 | # define geod_a GEODESIC.A 25 | # define lam1 GEODESIC.LAM1 26 | # define phi1 GEODESIC.PHI1 27 | # define al12 GEODESIC.ALPHA12 28 | # define lam2 GEODESIC.LAM2 29 | # define phi2 GEODESIC.PHI2 30 | # define al21 GEODESIC.ALPHA21 31 | # define geod_S GEODESIC.DIST 32 | # define geod_f GEODESIC.FLAT 33 | # define onef GEODESIC.ONEF 34 | # define f2 GEODESIC.FLAT2 35 | # define f4 GEODESIC.FLAT4 36 | # define ff2 GEODESIC.FLAT4 37 | # define f64 GEODESIC.FLAT64 38 | # define ellipse GEODESIC.ELLIPSE 39 | 40 | 41 | GEOD_EXTERN int n_alpha, n_S; 42 | GEOD_EXTERN double to_meter, fr_meter, del_alpha; 43 | 44 | void geod_set(int, char **); 45 | void geod_for(void); 46 | void geod_pre(void); 47 | void geod_inv(void); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | -------------------------------------------------------------------------------- /Proj4/libProj4.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapbox/DEPRECATED-mapbox-ios-sdk/a496f1766fdcea108261dfad011688dc4287456e/Proj4/libProj4.a -------------------------------------------------------------------------------- /Proj4/nad2bin.c: -------------------------------------------------------------------------------- 1 | /* Convert bivariate ASCII NAD27 to NAD83 tables to binary structure */ 2 | #include 3 | #include 4 | #define PJ_LIB__ 5 | #include 6 | #define U_SEC_TO_RAD 4.848136811095359935899141023e-12 7 | static char 8 | *usage = " 3 | #define MAX_TRY 9 4 | #define TOL 1e-12 5 | LP 6 | nad_cvt(LP in, int inverse, struct CTABLE *ct) { 7 | LP t, tb; 8 | 9 | if (in.lam == HUGE_VAL) 10 | return in; 11 | /* normalize input to ll origin */ 12 | tb = in; 13 | tb.lam -= ct->ll.lam; 14 | tb.phi -= ct->ll.phi; 15 | tb.lam = adjlon(tb.lam - PI) + PI; 16 | t = nad_intr(tb, ct); 17 | if (inverse) { 18 | LP del, dif; 19 | int i = MAX_TRY; 20 | 21 | if (t.lam == HUGE_VAL) return t; 22 | t.lam = tb.lam + t.lam; 23 | t.phi = tb.phi - t.phi; 24 | 25 | do { 26 | del = nad_intr(t, ct); 27 | 28 | /* This case used to return failure, but I have 29 | changed it to return the first order approximation 30 | of the inverse shift. This avoids cases where the 31 | grid shift *into* this grid came from another grid. 32 | While we aren't returning optimally correct results 33 | I feel a close result in this case is better than 34 | no result. NFW 35 | To demonstrate use -112.5839956 49.4914451 against 36 | the NTv2 grid shift file from Canada. */ 37 | if (del.lam == HUGE_VAL) 38 | { 39 | if( getenv( "PROJ_DEBUG" ) != NULL ) 40 | fprintf( stderr, 41 | "Inverse grid shift iteration failed, presumably at grid edge.\n" 42 | "Using first approximation.\n" ); 43 | /* return del */; 44 | break; 45 | } 46 | 47 | t.lam -= dif.lam = t.lam - del.lam - tb.lam; 48 | t.phi -= dif.phi = t.phi + del.phi - tb.phi; 49 | } while (i-- && fabs(dif.lam) > TOL && fabs(dif.phi) > TOL); 50 | if (i < 0) { 51 | if( getenv( "PROJ_DEBUG" ) != NULL ) 52 | fprintf( stderr, 53 | "Inverse grid shift iterator failed to converge.\n" ); 54 | t.lam = t.phi = HUGE_VAL; 55 | return t; 56 | } 57 | in.lam = adjlon(t.lam + ct->ll.lam); 58 | in.phi = t.phi + ct->ll.phi; 59 | } else { 60 | if (t.lam == HUGE_VAL) 61 | in = t; 62 | else { 63 | in.lam -= t.lam; 64 | in.phi += t.phi; 65 | } 66 | } 67 | return in; 68 | } 69 | -------------------------------------------------------------------------------- /Proj4/nad_intr.c: -------------------------------------------------------------------------------- 1 | /* Determine nad table correction value */ 2 | #define PJ_LIB__ 3 | #include 4 | LP 5 | nad_intr(LP t, struct CTABLE *ct) { 6 | LP val, frct; 7 | ILP indx; 8 | double m00, m10, m01, m11; 9 | FLP *f00, *f10, *f01, *f11; 10 | long index; 11 | int in; 12 | 13 | indx.lam = floor(t.lam /= ct->del.lam); 14 | indx.phi = floor(t.phi /= ct->del.phi); 15 | frct.lam = t.lam - indx.lam; 16 | frct.phi = t.phi - indx.phi; 17 | val.lam = val.phi = HUGE_VAL; 18 | if (indx.lam < 0) { 19 | if (indx.lam == -1 && frct.lam > 0.99999999999) { 20 | ++indx.lam; 21 | frct.lam = 0.; 22 | } else 23 | return val; 24 | } else if ((in = indx.lam + 1) >= ct->lim.lam) { 25 | if (in == ct->lim.lam && frct.lam < 1e-11) { 26 | --indx.lam; 27 | frct.lam = 1.; 28 | } else 29 | return val; 30 | } 31 | if (indx.phi < 0) { 32 | if (indx.phi == -1 && frct.phi > 0.99999999999) { 33 | ++indx.phi; 34 | frct.phi = 0.; 35 | } else 36 | return val; 37 | } else if ((in = indx.phi + 1) >= ct->lim.phi) { 38 | if (in == ct->lim.phi && frct.phi < 1e-11) { 39 | --indx.phi; 40 | frct.phi = 1.; 41 | } else 42 | return val; 43 | } 44 | index = indx.phi * ct->lim.lam + indx.lam; 45 | f00 = ct->cvs + index++; 46 | f10 = ct->cvs + index; 47 | index += ct->lim.lam; 48 | f11 = ct->cvs + index--; 49 | f01 = ct->cvs + index; 50 | m11 = m10 = frct.lam; 51 | m00 = m01 = 1. - frct.lam; 52 | m11 *= frct.phi; 53 | m01 *= frct.phi; 54 | frct.phi = 1. - frct.phi; 55 | m00 *= frct.phi; 56 | m10 *= frct.phi; 57 | val.lam = m00 * f00->lam + m10 * f10->lam + 58 | m01 * f01->lam + m11 * f11->lam; 59 | val.phi = m00 * f00->phi + m10 * f10->phi + 60 | m01 * f01->phi + m11 * f11->phi; 61 | return val; 62 | } 63 | -------------------------------------------------------------------------------- /Proj4/nad_list.h: -------------------------------------------------------------------------------- 1 | /* projection list for program nad2nad */ 2 | PROJ_HEAD(lcc, "Lambert Conformal Conic") 3 | PROJ_HEAD(omerc, "Oblique Mercator") 4 | PROJ_HEAD(poly, "Polyconic (American)") 5 | PROJ_HEAD(tmerc, "Transverse Mercator") 6 | PROJ_HEAD(utm, "Universal Transverse Mercator (UTM)") 7 | -------------------------------------------------------------------------------- /Proj4/org_proj4_Projections.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_proj4_Projections */ 4 | 5 | #ifndef _Included_org_proj4_Projections 6 | #define _Included_org_proj4_Projections 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_proj4_Projections 12 | * Method: getProjInfo 13 | * Signature: (Ljava/lang/String;)Ljava/lang/String; 14 | */ 15 | JNIEXPORT jstring JNICALL Java_org_proj4_Projections_getProjInfo 16 | (JNIEnv *, jobject, jstring); 17 | 18 | /* 19 | * Class: org_proj4_Projections 20 | * Method: getEllipsInfo 21 | * Signature: (Ljava/lang/String;)Ljava/lang/String; 22 | */ 23 | JNIEXPORT jstring JNICALL Java_org_proj4_Projections_getEllipsInfo 24 | (JNIEnv *, jobject, jstring); 25 | 26 | /* 27 | * Class: org_proj4_Projections 28 | * Method: transform 29 | * Signature: ([D[D[DLjava/lang/String;Ljava/lang/String;JI)V 30 | */ 31 | JNIEXPORT void JNICALL Java_org_proj4_Projections_transform 32 | (JNIEnv *, jobject, jdoubleArray, jdoubleArray, jdoubleArray, jstring, jstring, jlong, jint); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | #endif 38 | -------------------------------------------------------------------------------- /Proj4/p_series.c: -------------------------------------------------------------------------------- 1 | /* print row coefficients of Tseries structure */ 2 | #include "projects.h" 3 | #include 4 | #include 5 | #define NF 20 /* length of final format string */ 6 | #define CUT 60 /* check length of line */ 7 | void 8 | p_series(Tseries *T, FILE *file, char *fmt) { 9 | int i, j, n, L; 10 | char format[NF+1]; 11 | 12 | *format = ' '; 13 | strncpy(format + 1, fmt, NF - 3); 14 | strcat(format, "%n"); 15 | fprintf(file, "u: %d\n", T->mu+1); 16 | for (i = 0; i <= T->mu; ++i) 17 | if (T->cu[i].m) { 18 | fprintf(file, "%d %d%n", i, T->cu[i].m, &L); 19 | n = 0; 20 | for (j = 0; j < T->cu[i].m; ++j) { 21 | if ((L += n) > CUT) 22 | fprintf(file, "\n %n", &L); 23 | fprintf(file, format, T->cu[i].c[j], &n); 24 | } 25 | fputc('\n', file); 26 | } 27 | fprintf(file, "v: %d\n", T->mv+1); 28 | for (i = 0; i <= T->mv; ++i) 29 | if (T->cv[i].m) { 30 | fprintf(file, "%d %d%n", i, T->cv[i].m, &L); 31 | n = 0; 32 | for (j = 0; j < T->cv[i].m; ++j) { 33 | if ((L += n) > 60) 34 | fprintf(file, "\n %n", &L); 35 | fprintf(file, format, T->cv[i].c[j], &n); 36 | } 37 | fputc('\n', file); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Proj4/pj_auth.c: -------------------------------------------------------------------------------- 1 | /* determine latitude from authalic latitude */ 2 | #include 3 | # define P00 .33333333333333333333 4 | # define P01 .17222222222222222222 5 | # define P02 .10257936507936507936 6 | # define P10 .06388888888888888888 7 | # define P11 .06640211640211640211 8 | # define P20 .01641501294219154443 9 | #define APA_SIZE 3 10 | double * 11 | pj_authset(double es) { 12 | double t, *APA; 13 | 14 | if ((APA = (double *)pj_malloc(APA_SIZE * sizeof(double)))) { 15 | APA[0] = es * P00; 16 | t = es * es; 17 | APA[0] += t * P01; 18 | APA[1] = t * P10; 19 | t *= es; 20 | APA[0] += t * P02; 21 | APA[1] += t * P11; 22 | APA[2] = t * P20; 23 | } 24 | return APA; 25 | } 26 | double 27 | pj_authlat(double beta, double *APA) { 28 | double t = beta+beta; 29 | return(beta + APA[0] * sin(t) + APA[1] * sin(t+t) + APA[2] * sin(t+t+t)); 30 | } 31 | -------------------------------------------------------------------------------- /Proj4/pj_deriv.c: -------------------------------------------------------------------------------- 1 | /* dervative of (*P->fwd) projection */ 2 | #define PJ_LIB__ 3 | #include "projects.h" 4 | int 5 | pj_deriv(LP lp, double h, PJ *P, struct DERIVS *der) { 6 | XY t; 7 | 8 | lp.lam += h; 9 | lp.phi += h; 10 | if (fabs(lp.phi) > HALFPI) return 1; 11 | h += h; 12 | t = (*P->fwd)(lp, P); 13 | if (t.x == HUGE_VAL) return 1; 14 | der->x_l = t.x; der->y_p = t.y; der->x_p = -t.x; der->y_l = -t.y; 15 | lp.phi -= h; 16 | if (fabs(lp.phi) > HALFPI) return 1; 17 | t = (*P->fwd)(lp, P); 18 | if (t.x == HUGE_VAL) return 1; 19 | der->x_l += t.x; der->y_p -= t.y; der->x_p += t.x; der->y_l -= t.y; 20 | lp.lam -= h; 21 | t = (*P->fwd)(lp, P); 22 | if (t.x == HUGE_VAL) return 1; 23 | der->x_l -= t.x; der->y_p -= t.y; der->x_p += t.x; der->y_l += t.y; 24 | lp.phi += h; 25 | t = (*P->fwd)(lp, P); 26 | if (t.x == HUGE_VAL) return 1; 27 | der->x_l -= t.x; der->y_p += t.y; der->x_p -= t.x; der->y_l += t.y; 28 | der->x_l /= (h += h); 29 | der->y_p /= h; 30 | der->x_p /= h; 31 | der->y_l /= h; 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /Proj4/pj_errno.c: -------------------------------------------------------------------------------- 1 | /* For full ANSI compliance of global variable */ 2 | 3 | #include 4 | 5 | C_NAMESPACE_VAR int pj_errno = 0; 6 | 7 | /************************************************************************/ 8 | /* pj_get_errno_ref() */ 9 | /************************************************************************/ 10 | 11 | int *pj_get_errno_ref() 12 | 13 | { 14 | return &pj_errno; 15 | } 16 | 17 | /* end */ 18 | -------------------------------------------------------------------------------- /Proj4/pj_fwd.c: -------------------------------------------------------------------------------- 1 | /* general forward projection */ 2 | #define PJ_LIB__ 3 | #include 4 | #include 5 | # define EPS 1.0e-12 6 | XY /* forward projection entry */ 7 | pj_fwd(LP lp, PJ *P) { 8 | XY xy; 9 | double t; 10 | 11 | /* check for forward and latitude or longitude overange */ 12 | if ((t = fabs(lp.phi)-HALFPI) > EPS || fabs(lp.lam) > 10.) { 13 | xy.x = xy.y = HUGE_VAL; 14 | pj_errno = -14; 15 | } else { /* proceed with projection */ 16 | errno = pj_errno = 0; 17 | if (fabs(t) <= EPS) 18 | lp.phi = lp.phi < 0. ? -HALFPI : HALFPI; 19 | else if (P->geoc) 20 | lp.phi = atan(P->rone_es * tan(lp.phi)); 21 | lp.lam -= P->lam0; /* compute del lp.lam */ 22 | if (!P->over) 23 | lp.lam = adjlon(lp.lam); /* adjust del longitude */ 24 | xy = (*P->fwd)(lp, P); /* project */ 25 | if (pj_errno || (pj_errno = errno)) 26 | xy.x = xy.y = HUGE_VAL; 27 | /* adjust for major axis and easting/northings */ 28 | else { 29 | xy.x = P->fr_meter * (P->a * xy.x + P->x0); 30 | xy.y = P->fr_meter * (P->a * xy.y + P->y0); 31 | } 32 | } 33 | return xy; 34 | } 35 | -------------------------------------------------------------------------------- /Proj4/pj_geocent.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * $Id: pj_geocent.c 1504 2009-01-06 02:11:57Z warmerdam $ 3 | * 4 | * Project: PROJ.4 5 | * Purpose: Stub projection for geocentric. The transformation isn't 6 | * really done here since this code is 2D. The real transformation 7 | * is handled by pj_transform.c. 8 | * Author: Frank Warmerdam, warmerdam@pobox.com 9 | * 10 | ****************************************************************************** 11 | * Copyright (c) 2002, Frank Warmerdam 12 | * 13 | * Permission is hereby granted, free of charge, to any person obtaining a 14 | * copy of this software and associated documentation files (the "Software"), 15 | * to deal in the Software without restriction, including without limitation 16 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | * and/or sell copies of the Software, and to permit persons to whom the 18 | * Software is furnished to do so, subject to the following conditions: 19 | * 20 | * The above copyright notice and this permission notice shall be included 21 | * in all copies or substantial portions of the Software. 22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 24 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 26 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 29 | * DEALINGS IN THE SOFTWARE. 30 | *****************************************************************************/ 31 | 32 | #define PJ_LIB__ 33 | #include 34 | 35 | PJ_CVSID("$Id: pj_geocent.c 1504 2009-01-06 02:11:57Z warmerdam $"); 36 | 37 | PROJ_HEAD(geocent, "Geocentric") "\n\t"; 38 | 39 | FORWARD(forward); 40 | xy.x = lp.lam; 41 | xy.y = lp.phi; 42 | return xy; 43 | } 44 | INVERSE(inverse); 45 | lp.phi = xy.y; 46 | lp.lam = xy.x; 47 | return lp; 48 | } 49 | FREEUP; if (P) pj_dalloc(P); } 50 | 51 | ENTRY0(geocent) 52 | P->is_geocent = 1; 53 | P->x0 = 0.0; 54 | P->y0 = 0.0; 55 | P->inv = inverse; P->fwd = forward; 56 | ENDENTRY(P) 57 | 58 | -------------------------------------------------------------------------------- /Proj4/pj_inv.c: -------------------------------------------------------------------------------- 1 | /* general inverse projection */ 2 | #define PJ_LIB__ 3 | #include 4 | #include 5 | # define EPS 1.0e-12 6 | LP /* inverse projection entry */ 7 | pj_inv(XY xy, PJ *P) { 8 | LP lp; 9 | 10 | /* can't do as much preliminary checking as with forward */ 11 | if (xy.x == HUGE_VAL || xy.y == HUGE_VAL) { 12 | lp.lam = lp.phi = HUGE_VAL; 13 | pj_errno = -15; 14 | } 15 | errno = pj_errno = 0; 16 | xy.x = (xy.x * P->to_meter - P->x0) * P->ra; /* descale and de-offset */ 17 | xy.y = (xy.y * P->to_meter - P->y0) * P->ra; 18 | lp = (*P->inv)(xy, P); /* inverse project */ 19 | if (pj_errno || (pj_errno = errno)) 20 | lp.lam = lp.phi = HUGE_VAL; 21 | else { 22 | lp.lam += P->lam0; /* reduce from del lp.lam */ 23 | if (!P->over) 24 | lp.lam = adjlon(lp.lam); /* adjust longitude to CM */ 25 | if (P->geoc && fabs(fabs(lp.phi)-HALFPI) > EPS) 26 | lp.phi = atan(P->one_es * tan(lp.phi)); 27 | } 28 | return lp; 29 | } 30 | -------------------------------------------------------------------------------- /Proj4/pj_list.c: -------------------------------------------------------------------------------- 1 | /* Projection System: default list of projections 2 | ** Use local definition of PJ_LIST_H for subset. 3 | */ 4 | #define PJ_LIST_H "pj_list.h" 5 | #include "projects.h" 6 | 7 | struct PJ_LIST *pj_get_list_ref() 8 | 9 | { 10 | return pj_list; 11 | } 12 | -------------------------------------------------------------------------------- /Proj4/pj_malloc.c: -------------------------------------------------------------------------------- 1 | /* allocate and deallocate memory */ 2 | /* These routines are used so that applications can readily replace 3 | ** projection system memory allocation/deallocation call with custom 4 | ** application procedures. */ 5 | #include 6 | #include 7 | 8 | void * 9 | pj_malloc(size_t size) { 10 | // Currently, pj_malloc is a hack to solve an errno problem. 11 | // The problem is described in more details at 12 | // https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=86420. 13 | // It seems, that pj_init and similar functions incorrectly 14 | // (under debian/glibs-2.3.2) assume that pj_malloc resets 15 | // errno after success. pj_malloc tries to mimic this. 16 | int old_errno = errno; 17 | void *res = malloc(size); 18 | if ( res && !old_errno ) 19 | errno = 0; 20 | return res; 21 | } 22 | void 23 | pj_dalloc(void *ptr) { 24 | free(ptr); 25 | } 26 | -------------------------------------------------------------------------------- /Proj4/pj_mlfn.c: -------------------------------------------------------------------------------- 1 | #include 2 | /* meridinal distance for ellipsoid and inverse 3 | ** 8th degree - accurate to < 1e-5 meters when used in conjuction 4 | ** with typical major axis values. 5 | ** Inverse determines phi to EPS (1e-11) radians, about 1e-6 seconds. 6 | */ 7 | #define C00 1. 8 | #define C02 .25 9 | #define C04 .046875 10 | #define C06 .01953125 11 | #define C08 .01068115234375 12 | #define C22 .75 13 | #define C44 .46875 14 | #define C46 .01302083333333333333 15 | #define C48 .00712076822916666666 16 | #define C66 .36458333333333333333 17 | #define C68 .00569661458333333333 18 | #define C88 .3076171875 19 | #define EPS 1e-11 20 | #define MAX_ITER 10 21 | #define EN_SIZE 5 22 | double * 23 | pj_enfn(double es) { 24 | double t, *en; 25 | 26 | if ((en = (double *)pj_malloc(EN_SIZE * sizeof(double)))) { 27 | en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08))); 28 | en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08))); 29 | en[2] = (t = es * es) * (C44 - es * (C46 + es * C48)); 30 | en[3] = (t *= es) * (C66 - es * C68); 31 | en[4] = t * es * C88; 32 | } /* else return NULL if unable to allocate memory */ 33 | return en; 34 | } 35 | double 36 | pj_mlfn(double phi, double sphi, double cphi, double *en) { 37 | cphi *= sphi; 38 | sphi *= sphi; 39 | return(en[0] * phi - cphi * (en[1] + sphi*(en[2] 40 | + sphi*(en[3] + sphi*en[4])))); 41 | } 42 | double 43 | pj_inv_mlfn(double arg, double es, double *en) { 44 | double s, t, phi, k = 1./(1.-es); 45 | int i; 46 | 47 | phi = arg; 48 | for (i = MAX_ITER; i ; --i) { /* rarely goes over 2 iterations */ 49 | s = sin(phi); 50 | t = 1. - es * s * s; 51 | phi -= t = (pj_mlfn(phi, s, cos(phi), en) - arg) * (t * sqrt(t)) * k; 52 | if (fabs(t) < EPS) 53 | return phi; 54 | } 55 | pj_errno = -17; 56 | return phi; 57 | } 58 | -------------------------------------------------------------------------------- /Proj4/pj_msfn.c: -------------------------------------------------------------------------------- 1 | /* determine constant small m */ 2 | #include 3 | #include 4 | double 5 | pj_msfn(double sinphi, double cosphi, double es) { 6 | return (cosphi / sqrt (1. - es * sinphi * sinphi)); 7 | } 8 | -------------------------------------------------------------------------------- /Proj4/pj_phi2.c: -------------------------------------------------------------------------------- 1 | /* determine latitude angle phi-2 */ 2 | #include 3 | 4 | #define HALFPI 1.5707963267948966 5 | #define TOL 1.0e-10 6 | #define N_ITER 15 7 | 8 | double 9 | pj_phi2(double ts, double e) { 10 | double eccnth, Phi, con, dphi; 11 | int i; 12 | 13 | eccnth = .5 * e; 14 | Phi = HALFPI - 2. * atan (ts); 15 | i = N_ITER; 16 | do { 17 | con = e * sin (Phi); 18 | dphi = HALFPI - 2. * atan (ts * pow((1. - con) / 19 | (1. + con), eccnth)) - Phi; 20 | Phi += dphi; 21 | } while ( fabs(dphi) > TOL && --i); 22 | if (i <= 0) 23 | pj_errno = -18; 24 | return Phi; 25 | } 26 | -------------------------------------------------------------------------------- /Proj4/pj_qsfn.c: -------------------------------------------------------------------------------- 1 | /* determine small q */ 2 | #include 3 | #include 4 | 5 | # define EPSILON 1.0e-7 6 | double 7 | pj_qsfn(double sinphi, double e, double one_es) { 8 | double con; 9 | 10 | if (e >= EPSILON) { 11 | con = e * sinphi; 12 | return (one_es * (sinphi / (1. - con * con) - 13 | (.5 / e) * log ((1. - con) / (1. + con)))); 14 | } else 15 | return (sinphi + sinphi); 16 | } 17 | -------------------------------------------------------------------------------- /Proj4/pj_release.c: -------------------------------------------------------------------------------- 1 | /* <<< Release Notice for library >>> */ 2 | 3 | #include 4 | 5 | char const pj_release[]="Rel. 4.7.1, 23 September 2009"; 6 | 7 | const char *pj_get_release() 8 | 9 | { 10 | return pj_release; 11 | } 12 | -------------------------------------------------------------------------------- /Proj4/pj_tsfn.c: -------------------------------------------------------------------------------- 1 | /* determine small t */ 2 | #include 3 | #include 4 | #define HALFPI 1.5707963267948966 5 | double 6 | pj_tsfn(double phi, double sinphi, double e) { 7 | sinphi *= e; 8 | return (tan (.5 * (HALFPI - phi)) / 9 | pow((1. - sinphi) / (1. + sinphi), .5 * e)); 10 | } 11 | -------------------------------------------------------------------------------- /Proj4/pj_units.c: -------------------------------------------------------------------------------- 1 | /* definition of standard cartesian units */ 2 | #define PJ_UNITS__ 3 | #include 4 | /* Field 2 that contains the multiplier to convert named units to meters 5 | ** may be expressed by either a simple floating point constant or a 6 | ** numerator/denomenator values (e.g. 1/1000) */ 7 | C_NAMESPACE_VAR struct PJ_UNITS 8 | pj_units[] = { 9 | "km", "1000.", "Kilometer", 10 | "m", "1.", "Meter", 11 | "dm", "1/10", "Decimeter", 12 | "cm", "1/100", "Centimeter", 13 | "mm", "1/1000", "Millimeter", 14 | "kmi", "1852.0", "International Nautical Mile", 15 | "in", "0.0254", "International Inch", 16 | "ft", "0.3048", "International Foot", 17 | "yd", "0.9144", "International Yard", 18 | "mi", "1609.344", "International Statute Mile", 19 | "fath", "1.8288", "International Fathom", 20 | "ch", "20.1168", "International Chain", 21 | "link", "0.201168", "International Link", 22 | "us-in", "1./39.37", "U.S. Surveyor's Inch", 23 | "us-ft", "0.304800609601219", "U.S. Surveyor's Foot", 24 | "us-yd", "0.914401828803658", "U.S. Surveyor's Yard", 25 | "us-ch", "20.11684023368047", "U.S. Surveyor's Chain", 26 | "us-mi", "1609.347218694437", "U.S. Surveyor's Statute Mile", 27 | "ind-yd", "0.91439523", "Indian Yard", 28 | "ind-ft", "0.30479841", "Indian Foot", 29 | "ind-ch", "20.11669506", "Indian Chain", 30 | (char *)0, (char *)0, (char *)0 31 | }; 32 | 33 | struct PJ_UNITS *pj_get_units_ref() 34 | 35 | { 36 | return pj_units; 37 | } 38 | -------------------------------------------------------------------------------- /Proj4/pj_zpoly1.c: -------------------------------------------------------------------------------- 1 | /* evaluate complex polynomial */ 2 | #include 3 | /* note: coefficients are always from C_1 to C_n 4 | ** i.e. C_0 == (0., 0) 5 | ** n should always be >= 1 though no checks are made 6 | */ 7 | COMPLEX 8 | pj_zpoly1(COMPLEX z, COMPLEX *C, int n) { 9 | COMPLEX a; 10 | double t; 11 | 12 | a = *(C += n); 13 | while (n-- > 0) { 14 | a.r = (--C)->r + z.r * (t = a.r) - z.i * a.i; 15 | a.i = C->i + z.r * a.i + z.i * t; 16 | } 17 | a.r = z.r * (t = a.r) - z.i * a.i; 18 | a.i = z.r * a.i + z.i * t; 19 | return a; 20 | } 21 | /* evaluate complex polynomial and derivative */ 22 | COMPLEX 23 | pj_zpolyd1(COMPLEX z, COMPLEX *C, int n, COMPLEX *der) { 24 | COMPLEX a, b; 25 | double t; 26 | int first = 1; 27 | 28 | a = *(C += n); 29 | while (n-- > 0) { 30 | if (first) { 31 | first = 0; 32 | b = a; 33 | } else { 34 | b.r = a.r + z.r * (t = b.r) - z.i * b.i; 35 | b.i = a.i + z.r * b.i + z.i * t; 36 | } 37 | a.r = (--C)->r + z.r * (t = a.r) - z.i * a.i; 38 | a.i = C->i + z.r * a.i + z.i * t; 39 | } 40 | b.r = a.r + z.r * (t = b.r) - z.i * b.i; 41 | b.i = a.i + z.r * b.i + z.i * t; 42 | a.r = z.r * (t = a.r) - z.i * a.i; 43 | a.i = z.r * a.i + z.i * t; 44 | *der = b; 45 | return a; 46 | } 47 | -------------------------------------------------------------------------------- /Proj4/proj.def: -------------------------------------------------------------------------------- 1 | VERSION 1.2 2 | EXPORTS 3 | pj_init @1 4 | pj_fwd @2 5 | pj_inv @3 6 | pj_free @4 7 | pj_transform @5 8 | pj_geocentric_to_geodetic @6 9 | pj_geodetic_to_geocentric @7 10 | pj_deallocate_grids @8 11 | pj_init_plus @9 12 | pj_latlong_from_proj @10 13 | pj_is_latlong @11 14 | pj_get_errno_ref @12 15 | pj_set_finder @13 16 | pj_strerrno @14 17 | pj_errno @15 18 | pj_get_def @16 19 | pj_dalloc @17 20 | pj_is_geocent @18 21 | pj_get_release @19 22 | pj_malloc @20 23 | pj_pr_list @21 24 | pj_compare_datums @22 25 | pj_apply_gridshift @23 26 | pj_datum_transform @24 27 | pj_set_searchpath @25 28 | dmstor @26 29 | pj_get_ellps_ref @27 30 | pj_get_datums_ref @28 31 | pj_get_units_ref @29 32 | pj_get_list_ref @30 33 | pj_get_prime_meridians_ref @31 34 | rtodms @32 35 | set_rtodms @33 36 | pj_factors @34 37 | mk_cheby @35 38 | adjlon @36 39 | pj_param @37 40 | pj_ell_set @38 41 | pj_mkparam @39 42 | -------------------------------------------------------------------------------- /Proj4/proj_config.h: -------------------------------------------------------------------------------- 1 | /* src/proj_config.h. Generated from proj_config.h.in by configure. */ 2 | /* src/proj_config.h.in. Generated from configure.in by autoheader. */ 3 | 4 | /* Define to 1 if you have the header file. */ 5 | #define HAVE_DLFCN_H 1 6 | 7 | /* Define to 1 if you have the header file. */ 8 | #define HAVE_INTTYPES_H 1 9 | 10 | /* Define to 1 if you have the `m' library (-lm). */ 11 | #define HAVE_LIBM 1 12 | 13 | /* Define to 1 if you have the header file. */ 14 | #define HAVE_MEMORY_H 1 15 | 16 | /* Define to 1 if you have the header file. */ 17 | #define HAVE_STDINT_H 1 18 | 19 | /* Define to 1 if you have the header file. */ 20 | #define HAVE_STDLIB_H 1 21 | 22 | /* Define to 1 if you have the header file. */ 23 | #define HAVE_STRINGS_H 1 24 | 25 | /* Define to 1 if you have the header file. */ 26 | #define HAVE_STRING_H 1 27 | 28 | /* Define to 1 if you have the header file. */ 29 | #define HAVE_SYS_STAT_H 1 30 | 31 | /* Define to 1 if you have the header file. */ 32 | #define HAVE_SYS_TYPES_H 1 33 | 34 | /* Define to 1 if you have the header file. */ 35 | #define HAVE_UNISTD_H 1 36 | 37 | /* Enabled for Java/JNI Support */ 38 | /* #undef JNI_ENABLED */ 39 | 40 | /* Name of package */ 41 | #define PACKAGE "proj" 42 | 43 | /* Define to the address where bug reports for this package should be sent. */ 44 | #define PACKAGE_BUGREPORT "warmerdam@pobox.com" 45 | 46 | /* Define to the full name of this package. */ 47 | #define PACKAGE_NAME "PROJ.4 Projections" 48 | 49 | /* Define to the full name and version of this package. */ 50 | #define PACKAGE_STRING "PROJ.4 Projections 4.6.0" 51 | 52 | /* Define to the one symbol short name of this package. */ 53 | #define PACKAGE_TARNAME "proj" 54 | 55 | /* Define to the version of this package. */ 56 | #define PACKAGE_VERSION "4.6.0" 57 | 58 | /* Define to 1 if you have the ANSI C header files. */ 59 | #define STDC_HEADERS 1 60 | 61 | /* Version number of package */ 62 | #define VERSION "4.6.0" 63 | -------------------------------------------------------------------------------- /Proj4/proj_config.h.in: -------------------------------------------------------------------------------- 1 | /* src/proj_config.h.in. Generated from configure.in by autoheader. */ 2 | 3 | /* Define to 1 if you have the header file. */ 4 | #undef HAVE_DLFCN_H 5 | 6 | /* Define to 1 if you have the header file. */ 7 | #undef HAVE_INTTYPES_H 8 | 9 | /* Define to 1 if you have the `m' library (-lm). */ 10 | #undef HAVE_LIBM 11 | 12 | /* Define to 1 if you have the header file. */ 13 | #undef HAVE_MEMORY_H 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #undef HAVE_STDINT_H 17 | 18 | /* Define to 1 if you have the header file. */ 19 | #undef HAVE_STDLIB_H 20 | 21 | /* Define to 1 if you have the header file. */ 22 | #undef HAVE_STRINGS_H 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #undef HAVE_STRING_H 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #undef HAVE_SYS_STAT_H 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #undef HAVE_SYS_TYPES_H 32 | 33 | /* Define to 1 if you have the header file. */ 34 | #undef HAVE_UNISTD_H 35 | 36 | /* Enabled for Java/JNI Support */ 37 | #undef JNI_ENABLED 38 | 39 | /* Name of package */ 40 | #undef PACKAGE 41 | 42 | /* Define to the address where bug reports for this package should be sent. */ 43 | #undef PACKAGE_BUGREPORT 44 | 45 | /* Define to the full name of this package. */ 46 | #undef PACKAGE_NAME 47 | 48 | /* Define to the full name and version of this package. */ 49 | #undef PACKAGE_STRING 50 | 51 | /* Define to the one symbol short name of this package. */ 52 | #undef PACKAGE_TARNAME 53 | 54 | /* Define to the version of this package. */ 55 | #undef PACKAGE_VERSION 56 | 57 | /* Define to 1 if you have the ANSI C header files. */ 58 | #undef STDC_HEADERS 59 | 60 | /* Version number of package */ 61 | #undef VERSION 62 | -------------------------------------------------------------------------------- /Proj4/rtodms.c: -------------------------------------------------------------------------------- 1 | /* Convert radian argument to DMS ascii format */ 2 | #include 3 | #include 4 | #include 5 | /* 6 | ** RES is fractional second figures 7 | ** RES60 = 60 * RES 8 | ** CONV = 180 * 3600 * RES / PI (radians to RES seconds) 9 | */ 10 | static double 11 | RES = 1000., 12 | RES60 = 60000., 13 | CONV = 206264806.24709635515796003417; 14 | static char 15 | format[50] = "%dd%d'%.3f\"%c"; 16 | static int 17 | dolong = 0; 18 | void 19 | set_rtodms(int fract, int con_w) { 20 | int i; 21 | 22 | if (fract >= 0 && fract < 9 ) { 23 | RES = 1.; 24 | /* following not very elegant, but used infrequently */ 25 | for (i = 0; i < fract; ++i) 26 | RES *= 10.; 27 | RES60 = RES * 60.; 28 | CONV = 180. * 3600. * RES / PI; 29 | if (! con_w) 30 | (void)sprintf(format,"%%dd%%d'%%.%df\"%%c", fract); 31 | else 32 | (void)sprintf(format,"%%dd%%02d'%%0%d.%df\"%%c", 33 | fract+2+(fract?1:0), fract); 34 | dolong = con_w; 35 | } 36 | } 37 | char * 38 | rtodms(char *s, double r, int pos, int neg) { 39 | int deg, min, sign; 40 | char *ss = s; 41 | double sec; 42 | 43 | if (r < 0) { 44 | r = -r; 45 | if (!pos) { *ss++ = '-'; sign = 0; } 46 | else sign = neg; 47 | } else 48 | sign = pos; 49 | r = floor(r * CONV + .5); 50 | sec = fmod(r / RES, 60.); 51 | r = floor(r / RES60); 52 | min = fmod(r, 60.); 53 | r = floor(r / 60.); 54 | deg = r; 55 | 56 | if (dolong) 57 | (void)sprintf(ss,format,deg,min,sec,sign); 58 | else if (sec) { 59 | char *p, *q; 60 | 61 | (void)sprintf(ss,format,deg,min,sec,sign); 62 | for (q = p = ss + strlen(ss) - (sign ? 3 : 2); *p == '0'; --p) ; 63 | if (*p != '.') 64 | ++p; 65 | if (++q != p) 66 | (void)strcpy(p, q); 67 | } else if (min) 68 | (void)sprintf(ss,"%dd%d'%c",deg,min,sign); 69 | else 70 | (void)sprintf(ss,"%dd%c",deg, sign); 71 | return s; 72 | } 73 | -------------------------------------------------------------------------------- /Proj4/vector1.c: -------------------------------------------------------------------------------- 1 | /* make storage for one and two dimensional matricies */ 2 | #include 3 | #include 4 | void * /* one dimension array */ 5 | vector1(int nvals, int size) { return((void *)pj_malloc(size * nvals)); } 6 | void /* free 2D array */ 7 | freev2(void **v, int nrows) { 8 | if (v) { 9 | for (v += nrows; nrows > 0; --nrows) 10 | pj_dalloc(*--v); 11 | pj_dalloc(v); 12 | } 13 | } 14 | void ** /* two dimension array */ 15 | vector2(int nrows, int ncols, int size) { 16 | void **s; 17 | 18 | if ((s = (void **)pj_malloc(sizeof(void *) * nrows))) { 19 | int rsize, i; 20 | 21 | rsize = size * ncols; 22 | for (i = 0; i < nrows; ++i) 23 | if (!(s[i] = pj_malloc(rsize))) { 24 | freev2(s, i); 25 | return (void **)0; 26 | } 27 | } 28 | return s; 29 | } 30 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | **This project is deprecated in favor of the [Mapbox iOS SDK](https://www.mapbox.com/ios-sdk/)** 2 | 3 | See [the old readme](README-old.markdown) for the old project details. 4 | -------------------------------------------------------------------------------- /install_docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -z `which appledoc` ]; then 4 | echo "Unable to find appledoc. Consider installing it from source or Homebrew." 5 | exit 1 6 | fi 7 | 8 | VERSION=$( git tag | sort -r | sed -n '1p' ) 9 | echo "Creating new docs for $VERSION..." 10 | echo 11 | 12 | appledoc \ 13 | --output /tmp/`uuidgen` \ 14 | --project-name "Mapbox iOS SDK $VERSION" \ 15 | --project-company Mapbox \ 16 | --create-docset \ 17 | --company-id com.mapbox \ 18 | --ignore build \ 19 | --ignore FMDB \ 20 | --ignore GRMustache \ 21 | --ignore SMCalloutView \ 22 | --ignore .c \ 23 | --ignore .m \ 24 | --ignore RMAttributionViewController.h \ 25 | --ignore RMBingSource.h \ 26 | --ignore RMCoordinateGridSource.h \ 27 | --ignore RMDBMapSource.h \ 28 | --ignore RMFoundation.h \ 29 | --ignore RMFractalTileProjection.h \ 30 | --ignore RMGenericMapSource.h \ 31 | --ignore RMGlobalConstants.h \ 32 | --ignore RMLoadingTileView.h \ 33 | --ignore RMMapOverlayView.h \ 34 | --ignore RMMapQuestOpenAerialSource.h \ 35 | --ignore RMMapQuestOSMSource.h \ 36 | --ignore RMMapScrollView.h \ 37 | --ignore RMMapTiledLayerView.h \ 38 | --ignore RMNotifications.h \ 39 | --ignore RMOpenCycleMapSource.h \ 40 | --ignore RMOpenSeaMapLayer.h \ 41 | --ignore RMOpenSeaMapSource.h \ 42 | --ignore RMPixel.h \ 43 | --ignore RMProjection.h \ 44 | --ignore RMTile.h \ 45 | --ignore RMTileImage.h \ 46 | --ignore RMTileSourcesContainer.h \ 47 | --index-desc README.markdown \ 48 | . -------------------------------------------------------------------------------- /remove_docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo 4 | echo "Removing docs from ~/Library/Developer/Shared/Documentation/DocSets..." 5 | echo 6 | 7 | rm -rfv ~/Library/Developer/Shared/Documentation/DocSets/com.mapbox.Mapbox-1.* --------------------------------------------------------------------------------